PERFORCE change 130787 for review
Kip Macy
kmacy at FreeBSD.org
Wed Dec 12 22:18:22 PST 2007
http://perforce.freebsd.org/chv.cgi?CH=130787
Change 130787 by kmacy at kmacy:storage:toestack on 2007/12/13 06:17:46
revamp driver to work with updated MI interface names
fix TIME_WAIT1 handling for closed socket and linger case
Affected files ...
.. //depot/projects/toestack/sys/dev/cxgb/ulp/toecore/toedev.c#4 edit
.. //depot/projects/toestack/sys/dev/cxgb/ulp/tom/cxgb_cpl_io.c#33 edit
.. //depot/projects/toestack/sys/dev/cxgb/ulp/tom/cxgb_defs.h#12 edit
.. //depot/projects/toestack/sys/dev/cxgb/ulp/tom/cxgb_tom.c#15 edit
.. //depot/projects/toestack/sys/dev/cxgb/ulp/tom/cxgb_tom.h#15 edit
.. //depot/projects/toestack/sys/netinet/tcp_ofld.c#8 edit
.. //depot/projects/toestack/sys/netinet/tcp_ofld.h#10 edit
.. //depot/projects/toestack/sys/netinet/tcp_var.h#11 edit
.. //depot/projects/toestack/sys/netinet/toedev.h#4 edit
Differences ...
==== //depot/projects/toestack/sys/dev/cxgb/ulp/toecore/toedev.c#4 (text+ko) ====
@@ -83,7 +83,7 @@
static inline int
is_attached(const struct toedev *dev)
{
- return dev->offload_mod != NULL;
+ return dev->tod_offload_mod != NULL;
}
/*
@@ -100,9 +100,9 @@
TAILQ_FOREACH(t, &offload_module_list, entry) {
const struct offload_id *entry;
- entry = id_find(dev->ttid, t->id_table);
- if (entry && t->attach(dev, entry) == 0) {
- dev->offload_mod = t;
+ entry = id_find(dev->tod_ttid, t->ti_id_table);
+ if (entry && t->ti_attach(dev, entry) == 0) {
+ dev->tod_offload_mod = t;
return 0;
}
}
@@ -149,7 +149,7 @@
struct toedev *dev;
TAILQ_FOREACH(dev, &offload_dev_list, entry) {
- if (!strncmp(dev->name, name, TOENAMSIZ))
+ if (!strncmp(dev->tod_name, name, TOENAMSIZ))
return dev;
}
return NULL;
@@ -186,7 +186,7 @@
if (snprintf(s, sizeof(s), name, i) >= sizeof(s))
return -1; /* name too long */
if (!__find_offload_dev_by_name(s)) {
- strcpy(dev->name, s);
+ strcpy(dev->tod_name, s);
return 0;
}
}
@@ -229,7 +229,7 @@
if ((ret = assign_name(dev, name, 32)) != 0)
goto out;
- dev->offload_mod = NULL;
+ dev->tod_offload_mod = NULL;
TAILQ_INSERT_TAIL(&offload_dev_list, dev, entry);
out:
mtx_unlock(&offload_db_lock);
@@ -298,10 +298,10 @@
int r;
critical_enter(); /* XXX neccessary? */
- r = dev->send(dev, m);
+ r = dev->tod_send(dev, m);
critical_exit();
if (r)
- BPF_MTAP(dev->lldev, m);
+ BPF_MTAP(dev->tod_lldev, m);
return r;
}
@@ -319,13 +319,13 @@
int
toe_receive_mbuf(struct toedev *dev, struct mbuf **m, int n)
{
- if (__predict_true(!bpf_peers_present(dev->lldev->if_bpf)))
- return dev->recv(dev, m, n);
+ if (__predict_true(!bpf_peers_present(dev->tod_lldev->if_bpf)))
+ return dev->tod_recv(dev, m, n);
for ( ; n; n--, m++) {
- m[0]->m_pkthdr.rcvif = dev->lldev;
- BPF_MTAP(dev->lldev, m[0]);
- dev->recv(dev, m, 1);
+ m[0]->m_pkthdr.rcvif = dev->tod_lldev;
+ BPF_MTAP(dev->tod_lldev, m[0]);
+ dev->tod_recv(dev, m, 1);
}
return 0;
}
@@ -344,8 +344,8 @@
if (ifp && ifnet_is_offload(ifp)) {
struct toedev *tdev = TOEDEV(ifp);
- if (tdev && tdev->arp_update)
- tdev->arp_update(tdev, rt);
+ if (tdev && tdev->tod_arp_update)
+ tdev->tod_arp_update(tdev, rt);
}
}
@@ -368,9 +368,9 @@
#if 0
while (root_dev && ifnet_is_offload(root_dev)) {
- if (root_dev->priv_flags & IFF_802_1Q_VLAN)
+ if (root_dev->tod_priv_flags & IFF_802_1Q_VLAN)
root_dev = VLAN_DEV_INFO(root_dev)->real_dev;
- else if (root_dev->flags & IFF_MASTER)
+ else if (root_dev->tod_flags & IFF_MASTER)
root_dev = toe_bond_get_slave(root_dev, sk, context);
else
break;
==== //depot/projects/toestack/sys/dev/cxgb/ulp/tom/cxgb_cpl_io.c#33 (text+ko) ====
@@ -149,7 +149,7 @@
static inline int
is_t3a(const struct toedev *dev)
{
- return (dev->ttid == TOE_ID_CHELSIO_T3);
+ return (dev->tod_ttid == TOE_ID_CHELSIO_T3);
}
static void
@@ -981,7 +981,7 @@
wnd = MIN_RCV_WND;
/* PR 5138 */
- max_rcv_wnd = (dev->ttid == TOE_ID_CHELSIO_T3B ?
+ max_rcv_wnd = (dev->tod_ttid == TOE_ID_CHELSIO_T3B ?
(uint32_t)d->rx_page_size * 23 :
MAX_RCV_WND);
@@ -1234,14 +1234,13 @@
*/
int
t3_connect(struct toedev *tdev, struct socket *so,
- struct ifnet *egress_ifp)
+ struct rtentry *rt, struct sockaddr *nam)
{
struct mbuf *m;
struct l2t_entry *e;
struct tom_data *d = TOM_DATA(tdev);
struct inpcb *inp = sotoinpcb(so);
struct tcpcb *tp = intotcpcb(inp);
- struct rtentry *dst = inp->inp_route.ro_rt;
struct toepcb *toep; /* allocated by init_offload_socket */
int atid;
@@ -1253,7 +1252,7 @@
if ((atid = cxgb_alloc_atid(d->cdev, d->client, toep)) < 0)
goto out_err;
- e = t3_l2t_get(d->cdev, dst, egress_ifp, &inp->inp_route.ro_dst);
+ e = t3_l2t_get(d->cdev, rt, rt->rt_ifp, nam);
if (!e)
goto free_tid;
@@ -1266,7 +1265,7 @@
#endif
SOCK_LOCK(so);
- init_offload_socket(so, tdev, atid, e, dst, toep);
+ init_offload_socket(so, tdev, atid, e, rt, toep);
install_offload_ops(so);
@@ -1841,7 +1840,7 @@
default:
log(LOG_ERR,
"%s: TID %u received PEER_CLOSE in bad state %d\n",
- TOE_DEV(so)->name, toep->tp_tid, tp->t_state);
+ TOE_DEV(so)->tod_name, toep->tp_tid, tp->t_state);
}
INP_INFO_WUNLOCK(&tcbinfo);
if (tp)
@@ -1922,6 +1921,8 @@
#ifdef notyet
dst_confirm(sk->sk_dst_cache);
#endif
+ soisdisconnecting(so);
+
if ((so->so_state & SS_NOFDREF) == 0) {
/*
* Wake up lingering close
@@ -1929,19 +1930,16 @@
sowwakeup(so);
sorwakeup(so);
wakeup(&so->so_timeo);
- } else
- printf("FIN_WAIT1 shutdown handling incomplete\n");
-
-#if 0
- else if (tcp_sk(sk)->linger2 < 0 &&
- !sock_flag(so, ABORT_SHUTDOWN))
- abort_conn(so, skb, LINUX_MIB_TCPABORTONLINGER);
-#endif
+ } else if ((so->so_options & SO_LINGER) && so->so_linger == 0 &&
+ (toep->tp_flags & TP_ABORT_SHUTDOWN) == 0) {
+ tp = tcp_drop(tp, 0);
+ }
+
break;
default:
log(LOG_ERR,
"%s: TID %u received CLOSE_CON_RPL in bad state %d\n",
- TOE_DEV(so)->name, toep->tp_tid,
+ TOE_DEV(so)->tod_name, toep->tp_tid,
tp->t_state);
}
INP_INFO_WUNLOCK(&tcbinfo);
@@ -2356,7 +2354,7 @@
struct toedev *tdev = TOE_DEV(parent);
do_abort_syn_rcv(child, parent);
- if (tdev->ttid == TOE_ID_CHELSIO_T3) {
+ if (tdev->tod_ttid == TOE_ID_CHELSIO_T3) {
struct cpl_pass_accept_rpl *rpl = cplhdr(m);
rpl->opt0h = htonl(F_TCAM_BYPASS);
@@ -2554,7 +2552,7 @@
reply_mbuf = m_gethdr(M_NOWAIT, MT_DATA);
if (__predict_false(reply_mbuf == NULL)) {
- if (tdev->ttid == TOE_ID_CHELSIO_T3)
+ if (tdev->tod_ttid == TOE_ID_CHELSIO_T3)
t3_defer_reply(m, tdev, reject_pass_request);
else {
cxgb_queue_tid_release(cdev, tid);
@@ -2617,16 +2615,13 @@
dst = rtalloc2((struct sockaddr *)&nam, 1, 0);
if (dst == NULL) {
-
- DPRINTF("failed to find route\n");
-
+ printf("failed to find route\n");
+ goto reject;
}
e = newtoep->tp_l2t = t3_l2t_get(d->cdev, dst, tim.dev,
(struct sockaddr *)&nam);
if (e == NULL) {
-
DPRINTF("failed to get l2t\n");
-
}
/*
* Point to our listen socket until accept
@@ -2707,7 +2702,7 @@
#endif
return;
reject:
- if (tdev->ttid == TOE_ID_CHELSIO_T3)
+ if (tdev->tod_ttid == TOE_ID_CHELSIO_T3)
mk_pass_accept_rpl(reply_mbuf, m);
else
mk_tid_release(reply_mbuf, NULL, tid);
==== //depot/projects/toestack/sys/dev/cxgb/ulp/tom/cxgb_defs.h#12 (text+ko) ====
@@ -46,7 +46,8 @@
void t3_listen_start(struct toedev *dev, struct socket *so, struct t3cdev *cdev);
void t3_listen_stop(struct toedev *dev, struct socket *so, struct t3cdev *cdev);
int t3_push_frames(struct socket *so, int req_completion);
-int t3_connect(struct toedev *tdev, struct socket *so, struct ifnet *egress_ifp);
+int t3_connect(struct toedev *tdev, struct socket *so, struct rtentry *rt,
+ struct sockaddr *nam);
void t3_init_listen_cpl_handlers(void);
int t3_init_cpl_io(void);
void t3_init_wr_tab(unsigned int wr_len);
==== //depot/projects/toestack/sys/dev/cxgb/ulp/tom/cxgb_tom.c#15 (text+ko) ====
@@ -103,9 +103,9 @@
};
static struct tom_info t3_tom_info = {
- .attach = t3_toe_attach,
- .id_table = t3_toe_id_tab,
- .name = "Chelsio-T3"
+ .ti_attach = t3_toe_attach,
+ .ti_id_table = t3_toe_id_tab,
+ .ti_name = "Chelsio-T3"
};
struct cxgb_client t3c_tom_client = {
@@ -115,7 +115,6 @@
.redirect = NULL
};
-
/*
* Add an skb to the deferred skb queue for processing from process context.
*/
@@ -218,9 +217,9 @@
/* Register TCP offload device */
tdev = &t->tdev;
- tdev->ttid = (cdev->type == T3A ?
+ tdev->tod_ttid = (cdev->type == T3A ?
TOE_ID_CHELSIO_T3 : TOE_ID_CHELSIO_T3B);
- tdev->lldev = cdev->lldev;
+ tdev->tod_lldev = cdev->lldev;
if (register_toedev(tdev, "toe%d")) {
printf("unable to register offload device");
@@ -286,7 +285,7 @@
can_offload(struct toedev *dev, struct socket *so)
{
struct tom_data *tomd = TOM_DATA(dev);
- struct t3cdev *cdev = T3CDEV(dev->lldev);
+ struct t3cdev *cdev = T3CDEV(dev->tod_lldev);
struct tid_info *t = &(T3C_DATA(cdev))->tid_maps;
return sotoinpcb(so)->inp_depend4.inp4_options == NULL &&
@@ -341,14 +340,14 @@
/* Adjust TOE activation for this module */
t->conf.activated = activated;
- dev->can_offload = can_offload;
- dev->connect = t3_connect;
- dev->ctl = tom_ctl;
+ dev->tod_can_offload = can_offload;
+ dev->tod_connect = t3_connect;
+ dev->tod_ctl = tom_ctl;
#if 0
#ifndef NETEVENT
- dev->neigh_update = tom_neigh_update;
+ dev->tod_neigh_update = tom_neigh_update;
#endif
- dev->failover = t3_failover;
+ dev->tod_failover = t3_failover;
#endif
err = cdev->ctl(cdev, GET_DDP_PARAMS, &ddp);
if (err)
==== //depot/projects/toestack/sys/dev/cxgb/ulp/tom/cxgb_tom.h#15 (text+ko) ====
@@ -120,7 +120,7 @@
int ulp_mode;
};
-#define TOM_DATA(dev) (*(struct tom_data **)&(dev)->l4opt)
+#define TOM_DATA(dev) (*(struct tom_data **)&(dev)->tod_l4opt)
#define T3C_DEV(sk) ((TOM_DATA(TOE_DEV(sk)))->cdev)
#define TOEP_T3C_DEV(toep) (TOM_DATA(toep->tp_toedev)->cdev)
#define TOM_TUNABLE(dev, param) (TOM_DATA(dev)->conf.param)
==== //depot/projects/toestack/sys/netinet/tcp_ofld.c#8 (text+ko) ====
@@ -1,3 +1,33 @@
+/*-
+ * Copyright (c) 2007, Chelsio Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ *
+ * 2. Neither the name of the Chelsio Corporation nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD: src/sys/netinet/tcp_ofld.c,v 1.2 2007/12/12 23:31:49 kmacy Exp $");
+
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/types.h>
@@ -5,7 +35,6 @@
#include <sys/kernel.h>
#include <sys/sysctl.h>
#include <sys/mbuf.h>
-
#include <sys/socket.h>
#include <sys/socketvar.h>
@@ -13,8 +42,6 @@
#include <net/if_types.h>
#include <net/if_var.h>
-
-
#include <netinet/in.h>
#include <netinet/in_systm.h>
#include <netinet/in_pcb.h>
@@ -26,83 +53,74 @@
int
ofld_connect(struct socket *so, struct sockaddr *nam)
{
- struct inpcb *inp = sotoinpcb(so);
struct ifnet *ifp;
struct toedev *tdev;
- int err;
+ struct rtentry *rt;
+ int error;
- if (inp->inp_route.ro_rt == NULL) {
- inp->inp_route.ro_rt = rtalloc2(nam, 1, 0);
- if (inp->inp_route.ro_rt)
- memcpy(&inp->inp_route.ro_dst, nam, sizeof(struct sockaddr));
- }
+ rt = rtalloc2(nam, 1, 0);
+ if (rt == NULL)
+ return (EHOSTUNREACH);
- if (inp->inp_route.ro_rt == NULL) {
- printf("no route found for offload\n");
-
- return (EHOSTUNREACH);
- }
-
- ifp = inp->inp_route.ro_rt->rt_ifp;
+ ifp = rt->rt_ifp;
tdev = TOEDEV(ifp);
- if (tdev == NULL)
+ if (tdev == NULL)
return (EINVAL);
-
- if (tdev->can_offload(tdev, so) == 0) {
- printf("can't offload\n");
-
+
+ if (tdev->tod_can_offload(tdev, so) == 0)
return (EINVAL);
- }
-
- if ((err = tdev->connect(tdev, so, ifp)))
- return (err);
-
- printf("connected!!!\n");
-
+
+ if ((error = tdev->tod_connect(tdev, so, rt, nam)))
+ return (error);
+
return (0);
}
int
ofld_send(struct tcpcb *tp)
{
- return tp->t_tu->tu_send(tp);
+
+ return (tp->t_tu->tu_send(tp));
}
int
ofld_rcvd(struct tcpcb *tp)
{
- return tp->t_tu->tu_rcvd(tp);
+ return (tp->t_tu->tu_rcvd(tp));
}
int
ofld_disconnect(struct tcpcb *tp)
{
- return tp->t_tu->tu_disconnect(tp);
+
+ return (tp->t_tu->tu_disconnect(tp));
}
int
ofld_abort(struct tcpcb *tp)
{
- return tp->t_tu->tu_abort(tp);
+
+ return (tp->t_tu->tu_abort(tp));
}
void
ofld_detach(struct tcpcb *tp)
-{
+{
+
tp->t_tu->tu_detach(tp);
}
void
ofld_listen_open(struct tcpcb *tp)
{
+
EVENTHANDLER_INVOKE(ofld_listen, OFLD_LISTEN_OPEN, tp);
}
void
ofld_listen_close(struct tcpcb *tp)
{
+
EVENTHANDLER_INVOKE(ofld_listen, OFLD_LISTEN_CLOSE, tp);
}
-
-
==== //depot/projects/toestack/sys/netinet/tcp_ofld.h#10 (text+ko) ====
@@ -1,35 +1,65 @@
+/*-
+ * Copyright (c) 2007, Chelsio Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ *
+ * 2. Neither the name of the Chelsio Corporation nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ * $FreeBSD: src/sys/netinet/tcp_ofld.h,v 1.3 2007/12/13 01:24:20 kmacy Exp $
+ */
+
#ifndef _NETINET_TCP_OFLD_H_
-#define _NETINET_TCP_OFLD_H_
+#define _NETINET_TCP_OFLD_H_
+#ifndef _KERNEL
+#error "no user-serviceable parts inside"
+#endif
-#define tp_offload(tp) ((tp)->t_flags & TF_TOE)
-#define SO_OFFLOADABLE(so) ((so->so_options & SO_NO_OFFLOAD) == 0)
+#define SC_ENTRY_PRESENT 1
+#define SC_DROP 2
-int ofld_connect(struct socket *so, struct sockaddr *nam);
-int ofld_can_offload(struct tcpcb *tp, struct sockaddr *nam);
+#define tp_offload(tp) ((tp)->t_flags & TF_TOE)
+#define SO_OFFLOADABLE(so) ((so->so_options & SO_NO_OFFLOAD) == 0)
-int ofld_send(struct tcpcb *tp);
-int ofld_rcvd(struct tcpcb *tp);
-int ofld_disconnect(struct tcpcb *tp);
-int ofld_abort(struct tcpcb *tp);
-void ofld_detach(struct tcpcb *tp);
+int ofld_connect(struct socket *so, struct sockaddr *nam);
+int ofld_can_offload(struct tcpcb *tp, struct sockaddr *nam);
-void ofld_listen_open(struct tcpcb *tp);
-void ofld_listen_close(struct tcpcb *tp);
+int ofld_abort(struct tcpcb *tp);
+int ofld_disconnect(struct tcpcb *tp);
+int ofld_send(struct tcpcb *tp);
+int ofld_rcvd(struct tcpcb *tp);
+void ofld_detach(struct tcpcb *tp);
+void ofld_listen_close(struct tcpcb *tp);
+void ofld_listen_open(struct tcpcb *tp);
#ifndef DISABLE_TCP_OFFLOAD
static __inline int
tcp_gen_connect(struct socket *so, struct sockaddr *nam)
{
+ struct tcpcb *tp = sototcpcb(so);
int error;
- struct tcpcb *tp = sototcpcb(so);
-
+
if (!SO_OFFLOADABLE(so) || (error = ofld_connect(so, nam)) != 0)
error = tcp_output(tp);
- else
- printf("connection offloaded\n");
-
-
return (error);
}
@@ -42,7 +72,6 @@
error = ofld_disconnect(tp);
else
error = tcp_output(tp);
-
return (error);
}
@@ -55,7 +84,6 @@
error = ofld_abort(tp);
else
error = tcp_output(tp);
-
return (error);
}
@@ -68,7 +96,6 @@
error = ofld_send(tp);
else
error = tcp_output(tp);
-
return (error);
}
@@ -81,13 +108,13 @@
error = ofld_rcvd(tp);
else
error = tcp_output(tp);
-
return (error);
}
static __inline void
tcp_gen_listen_open(struct tcpcb *tp)
{
+
if (SO_OFFLOADABLE(tp->t_inpcb->inp_socket))
ofld_listen_open(tp);
}
@@ -101,7 +128,8 @@
static __inline void
tcp_gen_detach(struct tcpcb *tp)
{
- ofld_detach(tp);
+ if (tp_offload(tp))
+ ofld_detach(tp);
}
#else
@@ -109,45 +137,53 @@
static __inline int
tcp_gen_connect(struct socket *so, struct sockaddr *nam)
{
- return tcp_output(tp);
+
+ return (tcp_output(tp));
}
static __inline int
tcp_gen_disconnect(struct tcpcb *tp)
{
- return tcp_output(tp);
+
+ return (tcp_output(tp));
}
static __inline int
tcp_gen_abort(struct tcpcb *tp)
{
- return tcp_output(tp);
+
+ return (tcp_output(tp));
}
static __inline int
tcp_gen_send(struct tcpcb *tp)
{
- return tcp_output(tp);
+
+ return (tcp_output(tp));
}
static __inline int
tcp_gen_rcvd(struct tcpcb *tp)
{
- return tcp_output(tp);
+
+ return (tcp_output(tp));
}
static __inline void
-tcp_gen_listen_open(struct tcpcb *tp) {}
+tcp_gen_listen_open(struct tcpcb *tp)
+{
+}
static __inline void
-tcp_gen_listen_close(struct tcpcb *tp) {}
+tcp_gen_listen_close(struct tcpcb *tp)
+{
+}
static __inline void
-tcp_gen_detach(struct tcpcb *tp) {}
+tcp_gen_detach(struct tcpcb *tp)
+{
+}
-
-
-
#endif
struct toe_usrreqs {
@@ -157,12 +193,11 @@
int (*tu_abort)(struct tcpcb *tp);
void (*tu_detach)(struct tcpcb *tp);
void (*tu_syncache_event)(int event, void *toep);
-
};
-#define OFLD_LISTEN_OPEN 1
-#define OFLD_LISTEN_CLOSE 2
-typedef void (*ofld_listen_fn)(void *, int, struct tcpcb *);
+#define OFLD_LISTEN_OPEN 1
+#define OFLD_LISTEN_CLOSE 2
+typedef void (*ofld_listen_fn)(void *, int, struct tcpcb *);
EVENTHANDLER_DECLARE(ofld_listen, ofld_listen_fn);
#endif
==== //depot/projects/toestack/sys/netinet/tcp_var.h#11 (text+ko) ====
@@ -207,10 +207,10 @@
int t_rttlow; /* smallest observerved RTT */
u_int32_t rfbuf_ts; /* recv buffer autoscaling timestamp */
int rfbuf_cnt; /* recv buffer autoscaling byte count */
+ void *t_pspare[2]; /* toe usrreqs / toepcb * / congestion algo / vimage / 1 general use */
struct toe_usrreqs *t_tu; /* offload operations vector */
void *t_toe; /* TOE pcb pointer */
- char *t_cong_control; /* congestion control algorithm name*/
- void *t_pspare[2]; /* vimage / 1 general use */
+ void *t_cong_control;
};
#define IN_FASTRECOVERY(tp) (tp->t_flags & TF_FASTRECOVERY)
==== //depot/projects/toestack/sys/netinet/toedev.h#4 (text+ko) ====
@@ -1,46 +1,46 @@
+/*-
+ * Copyright (c) 2007, Chelsio Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ *
+ * 2. Neither the name of the Chelsio Corporation nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ * $FreeBSD: src/sys/netinet/toedev.h,v 1.2 2007/12/12 23:31:49 kmacy Exp $
+ */
-/**************************************************************************
+#ifndef _NETINET_TOEDEV_H_
+#define _NETINET_TOEDEV_H_
-Copyright (c) 2007, Chelsio Inc.
-All rights reserved.
+#ifndef _KERNEL
+#error "no user-serviceable parts inside"
+#endif
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-
- 1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
-
- 2. Neither the name of the Chelsio Corporation nor the names of its
- contributors may be used to endorse or promote products derived from
- this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
-LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-POSSIBILITY OF SUCH DAMAGE.
-
-$FreeBSD: src/sys/dev/cxgb/ulp/toecore/toedev.h,v 1.1 2007/05/25 16:17:59 kmacy Exp $
-
-***************************************************************************/
-
-#ifndef _OFFLOAD_DEV_H_
-#define _OFFLOAD_DEV_H_
-
-
-/* Parameter values for offload_get_phys_egress() */
+/* Parameter values for offload_get_phys_egress(). */
enum {
TOE_OPEN,
TOE_FAILOVER,
};
-/* Parameter values for toe_failover() */
+/* Parameter values for toe_failover(). */
enum {
TOE_ACTIVE_SLAVE,
TOE_LINK_DOWN,
@@ -49,16 +49,14 @@
TOE_RELEASE_ALL,
};
-#define TOENAMSIZ 16
+#define TOENAMSIZ 16
-/* belongs in linux/netdevice.h */
-#define NETIF_F_TCPIP_OFFLOAD (1 << 15)
+/* Get the toedev associated with a ifnet. */
+#define TOEDEV(ifp) ((ifp)->if_llsoftc)
-/* Get the toedev associated with a ifnet */
-#define TOEDEV(ifp) ((ifp)->if_llsoftc)
struct offload_id {
- unsigned int id;
- unsigned long data;
+ unsigned int id;
+ unsigned long data;
};
struct ifnet;
@@ -70,87 +68,73 @@
struct toedev {
TAILQ_ENTRY(toedev) entry;
- char name[TOENAMSIZ]; /* TOE device name */
- unsigned int ttid; /* TOE type id */
- unsigned long flags; /* device flags */
- unsigned int mtu; /* max size of TX offloaded data */
- unsigned int nconn; /* max # of offloaded connections */
- struct ifnet *lldev; /* LL device associated with TOE messages */
- const struct tom_info *offload_mod; /* attached TCP offload module */
- struct sysctl_oid *sysctl_root; /* root of proc dir for this TOE */
- 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 (*arp_update)(struct toedev *dev, struct rtentry *neigh);
- void (*failover)(struct toedev *dev, struct ifnet *bond_ifp,
+ char tod_name[TOENAMSIZ]; /* TOE device name */
+ unsigned int tod_ttid; /* TOE type id */
+ unsigned long tod_flags; /* device flags */
+ unsigned int tod_mtu; /* max TX offloaded data */
+ unsigned int tod_nconn; /* max # of offloaded
+ * connections
+ */
+ struct ifnet *tod_lldev; /* first interface */
+ const struct tom_info *tod_offload_mod; /* TCP offload module */
+
+ int (*tod_open)(struct toedev *dev);
+ int (*tod_close)(struct toedev *dev);
+ int (*tod_can_offload)(struct toedev *dev, struct socket *so);
+ int (*tod_connect)(struct toedev *dev, struct socket *so,
+ struct rtentry *rt, struct sockaddr *nam);
+ int (*tod_send)(struct toedev *dev, struct mbuf *m);
+ int (*tod_recv)(struct toedev *dev, struct mbuf **m, int n);
+ int (*tod_ctl)(struct toedev *dev, unsigned int req, void *data);
+ void (*tod_arp_update)(struct toedev *dev, struct rtentry *neigh);
+ void (*tod_failover)(struct toedev *dev, struct ifnet *bond_ifp,
struct ifnet *ndev, int event);
- void *priv; /* driver private data */
- void *l2opt; /* optional layer 2 data */
- void *l3opt; /* optional layer 3 data */
- void *l4opt; /* optional layer 4 data */
- void *ulp; /* ulp stuff */
+ void *tod_priv; /* driver private data */
+ void *tod_l2opt; /* optional layer 2 data */
+ void *tod_l3opt; /* optional layer 3 data */
+ void *tod_l4opt; /* optional layer 4 data */
+ void *tod_ulp; /* upper lever protocol */
};
struct tom_info {
- TAILQ_ENTRY(tom_info) entry;
- 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;
+ int (*ti_attach)(struct toedev *dev,
+ const struct offload_id *entry);
+ int (*ti_detach)(struct toedev *dev);
+ const char *ti_name;
+ const struct offload_id *ti_id_table;
};
-static inline void init_offload_dev(struct toedev *dev)
+static __inline void
+init_offload_dev(struct toedev *dev)
{
+}
+
+int register_tom(struct tom_info *t);
+int unregister_tom(struct tom_info *t);
+int register_toedev(struct toedev *dev, const char *name);
+int unregister_toedev(struct toedev *dev);
+int activate_offload(struct toedev *dev);
+int toe_send(struct toedev *dev, struct mbuf *m);
+void toe_arp_update(struct rtentry *rt);
+struct ifnet *offload_get_phys_egress(struct ifnet *ifp,
+ struct socket *so, int context);
+int toe_receive_mbuf(struct toedev *dev, struct mbuf **m, int n);
+static __inline void
+toe_neigh_update(struct ifnet *ifp)
+{
}
-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 void toe_arp_update(struct rtentry *rt);
-extern struct ifnet *offload_get_phys_egress(struct ifnet *dev,
- struct socket *so,
- int context);
-extern int toe_receive_mbuf(struct toedev *dev, struct mbuf **m, int n);
-
-#if defined(CONFIG_TCP_OFFLOAD_MODULE)
-static inline int toe_receive_mbuf(struct toedev *dev, struct mbuf **m,
- int n)
+static __inline void
+toe_failover(struct ifnet *bond_ifp, struct ifnet *fail_ifp, int event)
{
- 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)
+static __inline int
+toe_enslave(struct ifnet *bond_ifp, struct ifnet *slave_ifp)
{
- return 0;
+ return (0);
}
>>> TRUNCATED FOR MAIL (1000 lines) <<<
More information about the p4-projects
mailing list