#ifndef _OFFLOAD_DEV_H_
#define _OFFLOAD_DEV_H_
#include <net/route.h>
enum {
TOE_OPEN,
TOE_FAILOVER,
};
enum {
TOE_ACTIVE_SLAVE,
TOE_LINK_DOWN,
TOE_LINK_UP,
TOE_RELEASE,
TOE_RELEASE_ALL,
};
#define TOENAMSIZ 16
#define NETIF_F_TCPIP_OFFLOAD (1 << 15)
#define TOEDEV(netdev) (*(struct toedev **)&(netdev)->if_softc)
enum {
TOE_ID_CHELSIO_T1 = 1,
TOE_ID_CHELSIO_T1C,
TOE_ID_CHELSIO_T2,
TOE_ID_CHELSIO_T3,
TOE_ID_CHELSIO_T3B,
};
struct offload_id {
unsigned int id;
unsigned long data;
};
struct ifnet;
struct rt_entry;
struct tom_info;
struct sysctl_oid;
struct socket;
struct mbuf;
enum toetype {
T3A = 0,
T3B
};
struct toedev {
char name[TOENAMSIZ];
enum toetype type;
struct adapter *adapter;
unsigned int ttid;
unsigned long flags;
unsigned int mtu;
unsigned int nconn;
struct ifnet *lldev;
const struct tom_info *offload_mod;
struct sysctl_oid *sysctl_root;
TAILQ_ENTRY(toedev) ofld_entry;
int (*open)(struct toedev *dev);
int (*close)(struct toedev *dev);
int (*can_offload)(struct toedev *dev, struct socket *so);
int (*connect)(struct toedev *dev, struct socket *so,
struct ifnet *egress_ifp);
int (*send)(struct toedev *dev, struct mbuf *m);
int (*recv)(struct toedev *dev, struct mbuf **m, int n);
int (*ctl)(struct toedev *dev, unsigned int req, void *data);
void (*neigh_update)(struct toedev *dev, struct rtentry *neigh);
void (*failover)(struct toedev *dev, struct ifnet *bond_ifp,
struct ifnet *ndev, int event);
void *priv;
void *l2opt;
void *l3opt;
void *l4opt;
void *ulp;
};
struct tom_info {
int (*attach)(struct toedev *dev, const struct offload_id *entry);
int (*detach)(struct toedev *dev);
const char *name;
const struct offload_id *id_table;
TAILQ_ENTRY(tom_info) entry;
};
static __inline void init_offload_dev(struct toedev *dev)
{
}
extern int register_tom(struct tom_info *t);
extern int unregister_tom(struct tom_info *t);
extern int register_toedev(struct toedev *dev, const char *name);
extern int unregister_toedev(struct toedev *dev);
extern int activate_offload(struct toedev *dev);
extern int toe_send(struct toedev *dev, struct mbuf *m);
extern struct ifnet *offload_get_phys_egress(struct ifnet *dev,
struct socket *so,
int context);
#if defined(CONFIG_TCP_OFFLOAD_MODULE)
static __inline int toe_receive_mbuf(struct toedev *dev, struct mbuf **m,
int n)
{
return dev->recv(dev, m, n);
}
extern int prepare_tcp_for_offload(void);
extern void restore_tcp_to_nonoffload(void);
#elif defined(CONFIG_TCP_OFFLOAD)
extern int toe_receive_mbuf(struct toedev *dev, struct mbuf **m, int n);
#endif
#if defined(CONFIG_TCP_OFFLOAD) || \
(defined(CONFIG_TCP_OFFLOAD_MODULE) && defined(MODULE))
extern void toe_neigh_update(struct rtentry *neigh);
extern void toe_failover(struct ifnet *bond_ifp,
struct ifnet *fail_ifp, int event);
extern int toe_enslave(struct ifnet *bond_ifp,
struct ifnet *slave_ifp);
#else
static __inline void toe_neigh_update(struct ifnet *neigh) {}
static __inline void toe_failover(struct ifnet *bond_ifp,
struct ifnet *fail_ifp, int event)
{}
static __inline int toe_enslave(struct ifnet *bond_ifp,
struct ifnet *slave_ifp)
{
return 0;
}
#endif
#endif