Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 3 May 2010 16:00:45 +0200
From:      Fabien Thomas <fabien.thomas@netasq.com>
To:        freebsd-current@freebsd.org
Subject:   m_getjcl and packet cache
Message-ID:  <6EF4A177-00E8-47C7-9F9E-9F580FFE2585@netasq.com>

next in thread | raw e-mail | index | archive | help

--Apple-Mail-2-382786253
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain;
	charset=us-ascii

	Hi,

I've posted on -net but in case people will have some feedback on this =
before commit.
There is two solutions, let every driver get a test for MCLBYTES and =
call m_getcl (and then add support for at least igb, em, ixgbe)=20
or integrate the fast path in m_getjcl.

I've chosen to integrate the fast path in m_getjcl and patched the two =
case now redundant in the attached patch.

=46rom freebsd-net@:

While doing some 10Gb benchmark i've found that m_getjcl does not =
benefit from the packet zone.
There is a ~ 80% increase in FPS when applying the following patch.

256B frame driver to driver / stable_8:
- 3 765 066 FPS
- 6 868 153 FPS with the patch applied.

Any advice ?

Fabien



--Apple-Mail-2-382786253
Content-Disposition: attachment;
	filename=patch-m_getjcl-packet
Content-Type: application/octet-stream; x-unix-mode=0644;
	name="patch-m_getjcl-packet"
Content-Transfer-Encoding: 7bit

Index: dev/bce/if_bce.c
===================================================================
--- dev/bce/if_bce.c	(revision 207555)
+++ dev/bce/if_bce.c	(working copy)
@@ -5059,11 +5059,8 @@
 #ifdef BCE_JUMBO_HDRSPLIT
 		MGETHDR(m_new, M_DONTWAIT, MT_DATA);
 #else
-		if (sc->rx_bd_mbuf_alloc_size <= MCLBYTES)
-			m_new = m_getcl(M_DONTWAIT, MT_DATA, M_PKTHDR);
-		else
-			m_new = m_getjcl(M_DONTWAIT, MT_DATA, M_PKTHDR,
-			    sc->rx_bd_mbuf_alloc_size);
+		m_new = m_getjcl(M_DONTWAIT, MT_DATA, M_PKTHDR,
+		    sc->rx_bd_mbuf_alloc_size);
 #endif
 
 		if (m_new == NULL) {
Index: dev/mxge/if_mxge.c
===================================================================
--- dev/mxge/if_mxge.c	(revision 207555)
+++ dev/mxge/if_mxge.c	(working copy)
@@ -2400,10 +2400,7 @@
 	mxge_rx_ring_t *rx = &ss->rx_big;
 	int cnt, err, i;
 
-	if (rx->cl_size == MCLBYTES)
-		m = m_getcl(M_DONTWAIT, MT_DATA, M_PKTHDR);
-	else
-		m = m_getjcl(M_DONTWAIT, MT_DATA, M_PKTHDR, rx->cl_size);
+	m = m_getjcl(M_DONTWAIT, MT_DATA, M_PKTHDR, rx->cl_size);
 	if (m == NULL) {
 		rx->alloc_fail++;
 		err = ENOBUFS;
Index: sys/mbuf.h
===================================================================
--- sys/mbuf.h	(revision 207555)
+++ sys/mbuf.h	(working copy)
@@ -523,6 +523,9 @@
 	struct mbuf *m, *n;
 	uma_zone_t zone;
 
+	if (size == MCLBYTES)
+		return m_getcl(how, type, flags);
+
 	args.flags = flags;
 	args.type = type;
 

--Apple-Mail-2-382786253--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?6EF4A177-00E8-47C7-9F9E-9F580FFE2585>