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 extern uint32_t toedev_registration_count;
39 /* Parameter values for offload_get_phys_egress(). */
45 /* Parameter values for toe_failover(). */
56 /* Get the toedev associated with a ifnet. */
57 #define TOEDEV(ifp) ((ifp)->if_llsoftc)
72 TAILQ_ENTRY(toedev) entry;
73 char tod_name[TOENAMSIZ]; /* TOE device name */
74 unsigned int tod_ttid; /* TOE type id */
75 unsigned long tod_flags; /* device flags */
76 unsigned int tod_mtu; /* max TX offloaded data */
77 unsigned int tod_nconn; /* max # of offloaded
80 struct ifnet *tod_lldev; /* first interface */
81 const struct tom_info *tod_offload_mod; /* TCP offload module */
84 * This TOE device is capable of offloading the connection for socket so
86 int (*tod_can_offload)(struct toedev *dev, struct socket *so);
89 * Establish a connection to nam using the TOE device dev
91 int (*tod_connect)(struct toedev *dev, struct socket *so,
92 struct rtentry *rt, struct sockaddr *nam);
94 * Send an mbuf down to the toe device
96 int (*tod_send)(struct toedev *dev, struct mbuf *m);
98 * Receive an array of mbufs from the TOE device dev
100 int (*tod_recv)(struct toedev *dev, struct mbuf **m, int n);
102 * Device specific ioctl interface
104 int (*tod_ctl)(struct toedev *dev, unsigned int req, void *data);
106 * Update L2 entry in toedev
108 void (*tod_arp_update)(struct toedev *dev, struct rtentry *neigh);
110 * Failover from one toe device to another
112 void (*tod_failover)(struct toedev *dev, struct ifnet *bond_ifp,
113 struct ifnet *ndev, int event);
114 void *tod_priv; /* driver private data */
115 void *tod_l2opt; /* optional layer 2 data */
116 void *tod_l3opt; /* optional layer 3 data */
117 void *tod_l4opt; /* optional layer 4 data */
118 void *tod_ulp; /* upper lever protocol */
122 TAILQ_ENTRY(tom_info) entry;
123 int (*ti_attach)(struct toedev *dev,
124 const struct offload_id *entry);
125 int (*ti_detach)(struct toedev *dev);
127 const struct offload_id *ti_id_table;
131 init_offload_dev(struct toedev *dev)
135 int register_tom(struct tom_info *t);
136 int unregister_tom(struct tom_info *t);
137 int register_toedev(struct toedev *dev, const char *name);
138 int unregister_toedev(struct toedev *dev);
139 int activate_offload(struct toedev *dev);
140 int toe_send(struct toedev *dev, struct mbuf *m);
141 void toe_arp_update(struct rtentry *rt);
142 struct ifnet *offload_get_phys_egress(struct ifnet *ifp,
143 struct socket *so, int context);
144 int toe_receive_mbuf(struct toedev *dev, struct mbuf **m, int n);
147 toe_neigh_update(struct ifnet *ifp)
152 toe_failover(struct ifnet *bond_ifp, struct ifnet *fail_ifp, int event)
157 toe_enslave(struct ifnet *bond_ifp, struct ifnet *slave_ifp)
162 #endif /* _NETINET_TOEDEV_H_ */