Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 07 Jul 2014 10:12:07 +0200
From:      Hans Petter Selasky <hps@selasky.org>
To:        freebsd-net@freebsd.org, freebsd-current@FreeBSD.org
Subject:   [RFC] Allow m_dup() to use JUMBO clusters
Message-ID:  <53BA5657.8010309@selasky.org>

next in thread | raw e-mail | index | archive | help
This is a multi-part message in MIME format.
--------------030007040205090607060001
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

Hi,

I'm asking for some input on the attached m_dup() patch, so that 
existing functionality or dependencies are not broken. The background 
for the change is to allow m_dup() to defrag long mbuf chains that 
doesn't fit into a specific hardware's scatter gather entries, typically 
when doing TSO.

In my case the HW limit is 16 entries of length 4K for doing a 64KByte 
TSO packet. Currently m_dup() is at best producing 32 entries of each 2K 
for a 64Kbytes TSO packet.

By allowing m_dup() to get JUMBO clusters when allocating mbufs, we 
avoid creating a new function, specific to the hardware, to defrag some 
rare-occurring very long mbuf chains into a mbuf chain below 16 entries.

Any comments?

--HPS


--------------030007040205090607060001
Content-Type: text/x-patch;
 name="uipc_mbuf.c.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
 filename="uipc_mbuf.c.diff"

=== uipc_mbuf.c
==================================================================
--- uipc_mbuf.c	(revision 268358)
+++ uipc_mbuf.c	(local)
@@ -917,7 +917,15 @@
 		struct mbuf *n;
 
 		/* Get the next new mbuf */
-		if (remain >= MINCLSIZE) {
+		if (remain >= MJUM16BYTES) {
+			/*
+			 * By allocating a bigger mbuf, we get fewer
+			 * scatter gather entries for the hardware to
+			 * process:
+			 */
+			n = m_getjcl(how, m->m_type, 0, MJUM16BYTES);
+			nsize = MJUM16BYTES;
+		} else if (remain >= MINCLSIZE) {
 			n = m_getcl(how, m->m_type, 0);
 			nsize = MCLBYTES;
 		} else {

--------------030007040205090607060001--



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