2 * Copyright (c) 2007, Chelsio Inc.
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
8 * 1. Redistributions of source code must retain the above copyright notice,
9 * this list of conditions and the following disclaimer.
11 * 2. Neither the name of the Chelsio Corporation nor the names of its
12 * contributors may be used to endorse or promote products derived from
13 * this software without specific prior written permission.
15 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
16 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
19 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
20 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
21 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
22 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
23 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
24 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
25 * POSSIBILITY OF SUCH DAMAGE.
30 #ifndef _NETINET_TOEDEV_H_
31 #define _NETINET_TOEDEV_H_
34 #error "no user-serviceable parts inside"
37 /* Parameter values for offload_get_phys_egress(). */
43 /* Parameter values for toe_failover(). */
54 /* Get the toedev associated with a ifnet. */
55 #define TOEDEV(ifp) ((ifp)->if_llsoftc)
70 TAILQ_ENTRY(toedev) entry;
71 char tod_name[TOENAMSIZ]; /* TOE device name */
72 unsigned int tod_ttid; /* TOE type id */
73 unsigned long tod_flags; /* device flags */
74 unsigned int tod_mtu; /* max TX offloaded data */
75 unsigned int tod_nconn; /* max # of offloaded
78 struct ifnet *tod_lldev; /* first interface */
79 const struct tom_info *tod_offload_mod; /* TCP offload module */
82 * This TOE device is capable of offloading the connection for socket so
84 int (*tod_can_offload)(struct toedev *dev, struct socket *so);
87 * Establish a connection to nam using the TOE device dev
89 int (*tod_connect)(struct toedev *dev, struct socket *so,
90 struct rtentry *rt, struct sockaddr *nam);
92 * Send an mbuf down to the toe device
94 int (*tod_send)(struct toedev *dev, struct mbuf *m);
96 * Receive an array of mbufs from the TOE device dev
98 int (*tod_recv)(struct toedev *dev, struct mbuf **m, int n);
100 * Device specific ioctl interface
102 int (*tod_ctl)(struct toedev *dev, unsigned int req, void *data);
104 * Update L2 entry in toedev
106 void (*tod_arp_update)(struct toedev *dev, struct rtentry *neigh);
108 * Failover from one toe device to another
110 void (*tod_failover)(struct toedev *dev, struct ifnet *bond_ifp,
111 struct ifnet *ndev, int event);
112 void *tod_priv; /* driver private data */
113 void *tod_l2opt; /* optional layer 2 data */
114 void *tod_l3opt; /* optional layer 3 data */
115 void *tod_l4opt; /* optional layer 4 data */
116 void *tod_ulp; /* upper lever protocol */
120 TAILQ_ENTRY(tom_info) entry;
121 int (*ti_attach)(struct toedev *dev,
122 const struct offload_id *entry);
123 int (*ti_detach)(struct toedev *dev);
125 const struct offload_id *ti_id_table;
129 init_offload_dev(struct toedev *dev)
133 int register_tom(struct tom_info *t);
134 int unregister_tom(struct tom_info *t);
135 int register_toedev(struct toedev *dev, const char *name);
136 int unregister_toedev(struct toedev *dev);
137 int activate_offload(struct toedev *dev);
138 int toe_send(struct toedev *dev, struct mbuf *m);
139 void toe_arp_update(struct rtentry *rt);
140 struct ifnet *offload_get_phys_egress(struct ifnet *ifp,
141 struct socket *so, int context);
142 int toe_receive_mbuf(struct toedev *dev, struct mbuf **m, int n);
145 toe_neigh_update(struct ifnet *ifp)
150 toe_failover(struct ifnet *bond_ifp, struct ifnet *fail_ifp, int event)
155 toe_enslave(struct ifnet *bond_ifp, struct ifnet *slave_ifp)
160 #endif /* _NETINET_TOEDEV_H_ */