PERFORCE change 157798 for review

Andre Oppermann andre at FreeBSD.org
Mon Feb 16 08:18:09 PST 2009


http://perforce.freebsd.org/chv.cgi?CH=157798

Change 157798 by andre at andre_flirtbox on 2009/02/16 16:17:35

	Unify mbuf storage size calculation into common m_storagesize.

Affected files ...

.. //depot/projects/tcp_reass/netinet/tcp_reass.c#23 edit

Differences ...

==== //depot/projects/tcp_reass/netinet/tcp_reass.c#23 (text+ko) ====

@@ -339,7 +339,7 @@
 		if (tcp_reass_spacetime) {
 			tqe->trq_m =  m_collapse(tqe->trq_m, M_DONTWAIT, 1024);
 			tp->t_trqmcnt -= tqe->trq_mcnt;
-			tqe->trq_mcnt = m_storagespace(tqe->trq_m);
+			tqe->trq_mcnt = m_storagesize(tqe->trq_m);
 			tqe->trq_mcnt += tp->t_trqmcnt;
 		}
 		if (LIST_FIRST(&tp->t_trq_sack) != tqe) {
@@ -376,9 +376,7 @@
 				tcpstat.tcps_rcvpartduppack++;
 				tcpstat.tcps_rcvpartdupbyte += i;
 				/* Update accounting. */
-				for (mcnt = 0, n = m; n; n = n->m_next)
-					mcnt += (n->m_flags & M_EXT) ?
-					    n->m_ext.ext_size + MSIZE : MSIZE;
+				mcnt = m_storagesize(m);
 			}
 			tqe->trq_len += *tlenp;
 			tqe->trq_mcnt += mcnt;
@@ -459,7 +457,7 @@
 				tcpstat.tcps_rcvpartduppack++;
 				tcpstat.tcps_rcvpartdupbyte += i;
 				/* Update accounting. */
-				mcnt = m_storagespace(m);
+				mcnt = m_storagesize(m);
 			}
 			tqe->trq_len += *tlenp;
 			tqe->trq_mcnt += mcnt;
@@ -526,6 +524,10 @@
 		tcpstat.tcps_reass_blocks++;
 	}
 	tcp_reass_qsize++;
+	if (tcp_reass_spacetime) {
+		m = m_collapse();
+		mcnt = m_storagesize(m);
+	}
 	tqen->trq_seq = th_seq;
 	tqen->trq_len = *tlenp;
 	tqen->trq_mcnt = mcnt;
@@ -613,9 +615,6 @@
 static void
 tcp_reass_merge(struct tcpcb *tp, struct trq *tqe, struct trq *tqen)
 {
-#if 0
-	struct mbuf *m;
-#endif
 	int i;
 
 	KASSERT(tqe != NULL && tqen != NULL,
@@ -644,15 +643,11 @@
 		m_adj(tqen->trq_m, i);
 		tqen->trq_len -= i;
 		tcpstat.tcps_rcvpartdupbyte += i;		/* Statistics */
-#if 0
-		/* Trim ... */
-		while (tqen->trq_m->m_len == 0) {
-			m = tqen->trq_m;
-			tqen->trq_m = tqen->trq_m->m_next;
-			/* mcnt */
-			m_free(m);
+		/* Dispose of empty mbufs. */
+		if (tcp_reass_spacetime) {
+			tqen->trq_m = m_trimhead(tqen->trq_m);
+			tqen->trq_mcnt = m_storagesize(tqen->trq_m);
 		}
-#endif
 		KASSERT(tqen->trq_m != NULL,
 		    ("%s: no remaining mbufs in block", __func__));
 	}


More information about the p4-projects mailing list