Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 9 Nov 2007 05:35:10 GMT
From:      Kip Macy <kmacy@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 128852 for review
Message-ID:  <200711090535.lA95ZAfO047477@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
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;
 }
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200711090535.lA95ZAfO047477>