Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 09 Jul 2000 22:53:46 -0700
From:      David Greenman <dg@root.com>
To:        Alfred Perlstein <bright@wintelcom.net>
Cc:        net@freebsd.org, dg@freebsd.org, wollman@freebsd.org
Subject:   Re: argh! Re: weird things with M_EXT and large packets 
Message-ID:  <200007100553.WAA01544@implode.root.com>
In-Reply-To: Your message of "Sun, 09 Jul 2000 20:51:24 PDT." <20000709205124.A25571@fw.wintelcom.net> 

next in thread | previous in thread | raw e-mail | index | archive | help
>* Alfred Perlstein <bright@wintelcom.net> [000709 14:04] wrote:
>> I have some code here sending a mbuf via:
>> 
>> error = (*so->so_proto->pr_usrreqs->pru_send)(so, 0, m, 0, 0, p);
>> 
>> m is setup like so:
>> 
>>     m->m_ext.ext_free = kblob_mbuf_free;
>>     m->m_ext.ext_ref = kblob_mbuf_ref;
>>     m->m_ext.ext_buf = (void *)kb;
>>     m->m_ext.ext_size = kb->kb_len;
>>     m->m_data = (char *) kb->kb_data + uap->offset;
>>     m->m_flags |= M_EXT;
>>     m->m_pkthdr.len = m->m_len = uap->nbytes;
>> 
>> uap->nbytes is 59499.
>> 
>> It looks like the packet is being broken up or referenced to be sent,
>> but at a certain point it hangs.
>
>I'm 99.99% sure what's going on is that since I'm using normal kernel
>malloc for these external clusters what's happening is that the device
>driver is failing to notice that the data contained crosses a page
>boundry and isn't breaking the data up properly.  Since the memory is
>fragmented it's passing garbage over the wire that doesn't match the
>checksum (hence the resending of the data)
>
>Doing a transfer over localhost works fine.
>
>If use contigmalloc to allocate the buffers then it works, I would really
>rather not use contigmalloc because frankly it scares me.
>
>Is there a specific reason the network drivers (or at least fxp)
>don't seem to check page boundries so that discontig kmem can be
>passed to the drivers in large chunks?  I'd rather not have to
>allocate size/PAGE_SIZE mbuf headers for each send.
>
>This may only fxp doing this incorrectly, or I may be just be
>totally off, does this all make sense?

   You're correct that the fxp driver doesn't try to detect page breaks. It
(wrongfully in your case) assumes that buffers are 1 page or less in size and
don't cross physical page boundries. The driver was written to be fast, and
doing multiple vtophys operations to detect a case which previously would
never happen isn't a good thing for performance.

-DG

David Greenman
Co-founder, The FreeBSD Project - http://www.freebsd.org
Manufacturer of high-performance Internet servers - http://www.terasolutions.com
Pave the road of life with opportunities.


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-net" in the body of the message




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