From owner-p4-projects@FreeBSD.ORG Fri Nov 9 05:35:11 2007 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 6A67816A41A; Fri, 9 Nov 2007 05:35:11 +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 0937316A419 for ; Fri, 9 Nov 2007 05:35:11 +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 EB0AB13C49D for ; Fri, 9 Nov 2007 05:35:10 +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 lA95ZAdn047480 for ; Fri, 9 Nov 2007 05:35:10 GMT (envelope-from kmacy@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.1/8.14.1/Submit) id lA95ZAfO047477 for perforce@freebsd.org; Fri, 9 Nov 2007 05:35:10 GMT (envelope-from kmacy@freebsd.org) Date: Fri, 9 Nov 2007 05:35:10 GMT Message-Id: <200711090535.lA95ZAfO047477@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 128852 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: Fri, 09 Nov 2007 05:35:11 -0000 http://perforce.freebsd.org/chv.cgi?CH=128852 Change 128852 by kmacy@kmacy:storage:toestack on 2007/11/09 05:34:25 add callback and callback arg to in_conninfo, to support: - notify TOE when a syncache entry is dropped or is already present so that the TOE can release any associated resources and drop connection state - when a syncache entry is upgraded to a socket, we retain the toepcb association Affected files ... .. //depot/projects/toestack/sys/netinet/in_pcb.h#3 edit .. //depot/projects/toestack/sys/netinet/tcp_syncache.c#5 edit Differences ... ==== //depot/projects/toestack/sys/netinet/in_pcb.h#3 (text+ko) ==== @@ -89,6 +89,13 @@ #define ie6_laddr ie_dependladdr.ie6_local }; + +#define SC_ENTRY_PRESENT 1 +#define SC_DROP 2 + +typedef void (*sc_eh_t)(int event, void *arg); + + /* * XXX The defines for inc_* are hacks and should be changed to direct * references. @@ -99,6 +106,8 @@ u_int16_t inc_pad; /* XXX alignment for in_endpoints */ /* protocol dependent part */ struct in_endpoints inc_ie; + sc_eh_t inc_eh; /* syncache event handler - timeout or already present */ + void *inc_ext; /* external TCP connection state */ }; #define inc_isipv6 inc_flags /* temp compatability */ #define inc_fport inc_ie.ie_fport ==== //depot/projects/toestack/sys/netinet/tcp_syncache.c#5 (text+ko) ==== @@ -353,6 +353,10 @@ TAILQ_REMOVE(&sch->sch_bucket, sc, sc_hash); sch->sch_length--; +#ifndef DISABLE_TCP_OFFLOAD + if (sc->sc_inc.inc_eh && sc->sc_inc.inc_ext) + sc->sc_inc.inc_eh(SC_DROP, sc->sc_inc.inc_ext); +#endif syncache_free(sc); tcp_syncache.cache_count--; } @@ -403,7 +407,10 @@ sch->sch_nextc = sc->sc_rxttime; continue; } - +#ifndef DISABLE_TCP_OFFLOAD + if (sc->sc_inc.inc_eh != NULL) + continue; +#endif if (sc->sc_rxmits > tcp_syncache.rexmt_limit) { if ((s = tcp_log_addrs(&sc->sc_inc, NULL, NULL, NULL))) { log(LOG_DEBUG, "%s; %s: Retransmits exhausted, " @@ -1028,6 +1035,10 @@ sc = syncache_lookup(inc, &sch); /* returns locked entry */ SCH_LOCK_ASSERT(sch); if (sc != NULL) { +#ifndef DISABLE_TCP_OFFLOAD + if (sc->sc_inc.inc_eh && sc->sc_inc.inc_ext) + sc->sc_inc.inc_eh(SC_ENTRY_PRESENT, sc->sc_inc.inc_ext); +#endif tcpstat.tcps_sc_dupsyn++; if (ipopts) { /* @@ -1062,7 +1073,7 @@ s, __func__); free(s, M_TCPLOG); } - if (syncache_respond(sc) == 0) { + if ((inc->inc_eh == NULL) && syncache_respond(sc) == 0) { sc->sc_rxmits = 0; syncache_timeout(sc, sch, 1); tcpstat.tcps_sndacks++; @@ -1203,7 +1214,7 @@ /* * Do a standard 3-way handshake. */ - if (syncache_respond(sc) == 0) { + if (inc->inc_ext != NULL || syncache_respond(sc) == 0) { if (tcp_syncookies && tcp_syncookiesonly && sc != &scs) syncache_free(sc); else if (sc != &scs) @@ -1221,8 +1232,11 @@ if (sc == &scs) mac_syncache_destroy(&maclabel); #endif - *lsop = NULL; - m_freem(m); + if (m) { + + *lsop = NULL; + m_freem(m); + } return; }