From owner-p4-projects@FreeBSD.ORG Sun Oct 14 00:55:30 2007 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 32D3716A41A; Sun, 14 Oct 2007 00:55:30 +0000 (UTC) Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DE8EE16A417 for ; Sun, 14 Oct 2007 00:55:29 +0000 (UTC) (envelope-from kmacy@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id C411313C455 for ; Sun, 14 Oct 2007 00:55:29 +0000 (UTC) (envelope-from kmacy@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.1/8.14.1) with ESMTP id l9E0tTuT096840 for ; Sun, 14 Oct 2007 00:55:29 GMT (envelope-from kmacy@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.1/8.14.1/Submit) id l9E0tTiv096837 for perforce@freebsd.org; Sun, 14 Oct 2007 00:55:29 GMT (envelope-from kmacy@freebsd.org) Date: Sun, 14 Oct 2007 00:55:29 GMT Message-Id: <200710140055.l9E0tTiv096837@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to kmacy@freebsd.org using -f From: Kip Macy To: Perforce Change Reviews Cc: Subject: PERFORCE change 127490 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 14 Oct 2007 00:55:30 -0000 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 #include +#include #include #include #include #include +#include +#include + +#include +#include +#include + + #include #include - -#include -#include - +#include #include #include #include +/* :-/ */ +#include + 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 +__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);