Date: Sun, 14 Oct 2007 00:55:29 GMT From: Kip Macy <kmacy@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 127490 for review Message-ID: <200710140055.l9E0tTiv096837@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=127490 Change 127490 by kmacy@kmacy:storage:toestack on 2007/10/14 00:55:12 initial tie-in of connect to toecore Affected files ... .. //depot/projects/toestack/sys/netinet/tcp_ofld.c#2 edit .. //depot/projects/toestack/sys/netinet/tcp_ofld.h#2 edit .. //depot/projects/toestack/sys/netinet/tcp_usrreq.c#5 edit Differences ... ==== //depot/projects/toestack/sys/netinet/tcp_ofld.c#2 (text+ko) ==== @@ -1,26 +1,59 @@ #include <sys/param.h> #include <sys/systm.h> +#include <sys/types.h> #include <sys/malloc.h> #include <sys/kernel.h> #include <sys/sysctl.h> #include <sys/mbuf.h> +#include <sys/socket.h> +#include <sys/socketvar.h> + +#include <net/if.h> +#include <net/if_types.h> +#include <net/if_var.h> + + #include <netinet/in.h> #include <netinet/in_systm.h> - -#include <sys/socket.h> -#include <sys/socketvar.h> - +#include <netinet/in_pcb.h> #include <netinet/tcp.h> #include <netinet/tcp_var.h> #include <netinet/tcp_ofld.h> +/* :-/ */ +#include <dev/cxgb/ulp/toecore/toedev.h> + int -ofld_connect(struct tcpcb *tp, struct sockaddr *nam) +ofld_connect(struct socket *so, struct sockaddr *nam) { + struct inpcb *inp = sotoinpcb(so); + struct ifnet *ifp; + struct toedev *tdev; + + if (inp->inp_route.ro_rt == NULL) { + struct sockaddr_in *dst = (struct sockaddr_in *)&inp->inp_route.ro_dst; + + bzero(dst, sizeof(*dst)); + dst->sin_family = AF_INET; + dst->sin_len = sizeof(*dst); + dst->sin_addr.s_addr = *(in_addr_t *)&nam->sa_data; + + rtalloc_ign(&inp->inp_route, 0); + } + + if (inp->inp_route.ro_rt == NULL) + return (0); + ifp = inp->inp_route.ro_rt->rt_ifp; + tdev = TOEDEV(ifp); - return tp->t_tu->tu_connect(tp, nam); + if ((tdev == NULL) || (tdev->can_offload(tdev, so) == 0)) + return (0); + if (tdev->connect(tdev, so, ifp)) + return (1); + + return (0); } int ==== //depot/projects/toestack/sys/netinet/tcp_ofld.h#2 (text+ko) ==== @@ -3,8 +3,11 @@ #define tp_offload(tp) ((tp)->t_flags & TF_TOE) +#define SO_OFFLOADABLE(so) ((so->so_options & SO_NOOFFLOAD) == 0) + -int ofld_connect(struct tcpcb *tp, struct sockaddr *nam); +int ofld_connect(struct socket *so, struct sockaddr *nam); +int ofld_can_offload(struct tcpcb *tp, struct sockaddr *nam); int ofld_disconnect(struct tcpcb *tp); int ofld_abort(struct tcpcb *tp); int ofld_send(struct tcpcb *tp); @@ -14,12 +17,13 @@ static __inline int -tcp_gen_connect(struct tcpcb *tp, struct sockaddr *nam) +tcp_gen_connect(struct socket *so, struct sockaddr *nam) { int error; - - if (tp_offload(tp)) - error = ofld_connect(tp, nam); + struct tcpcb *tp = sototcpcb(so); + + if (SO_OFFLOADABLE(so)) + error = ofld_connect(so, nam); else error = tcp_output(tp); ==== //depot/projects/toestack/sys/netinet/tcp_usrreq.c#5 (text+ko) ==== @@ -29,9 +29,11 @@ * SUCH DAMAGE. * * From: @(#)tcp_usrreq.c 8.2 (Berkeley) 1/3/94 - * $FreeBSD: src/sys/netinet/tcp_usrreq.c,v 1.162 2007/09/24 05:26:24 silby Exp $ */ +#include <sys/cdefs.h> +__FBSDID("$FreeBSD: src/sys/netinet/tcp_usrreq.c,v 1.163 2007/10/07 20:44:24 silby Exp $"); + #include "opt_ddb.h" #include "opt_inet.h" #include "opt_inet6.h" @@ -476,7 +478,7 @@ TCPDEBUG1(); if ((error = tcp_connect(tp, nam, td)) != 0) goto out; - error = tcp_gen_connect(tp, nam); + error = tcp_gen_connect(so, nam); out: TCPDEBUG2(PRU_CONNECT); INP_UNLOCK(inp); @@ -528,7 +530,7 @@ inp->inp_vflag &= ~INP_IPV6; if ((error = tcp_connect(tp, (struct sockaddr *)&sin, td)) != 0) goto out; - error = tcp_gen_connect(tp, nam); + error = tcp_gen_connect(so, nam); goto out; } inp->inp_vflag &= ~INP_IPV4; @@ -536,7 +538,7 @@ inp->inp_inc.inc_isipv6 = 1; if ((error = tcp6_connect(tp, nam, td)) != 0) goto out; - error = tcp_gen_connect(tp, nam); + error = tcp_gen_connect(so, nam); out: TCPDEBUG2(PRU_CONNECT);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200710140055.l9E0tTiv096837>