From owner-freebsd-net Sun Jul 9 23: 5:42 2000 Delivered-To: freebsd-net@freebsd.org Received: from implode.root.com (root.com [209.102.106.178]) by hub.freebsd.org (Postfix) with ESMTP id 7272137B7D7; Sun, 9 Jul 2000 23:05:38 -0700 (PDT) (envelope-from dg@implode.root.com) Received: from implode.root.com (localhost [127.0.0.1]) by implode.root.com (8.8.8/8.8.5) with ESMTP id WAA01544; Sun, 9 Jul 2000 22:53:46 -0700 (PDT) Message-Id: <200007100553.WAA01544@implode.root.com> To: Alfred Perlstein Cc: net@freebsd.org, dg@freebsd.org, wollman@freebsd.org Subject: Re: argh! Re: weird things with M_EXT and large packets In-reply-to: Your message of "Sun, 09 Jul 2000 20:51:24 PDT." <20000709205124.A25571@fw.wintelcom.net> From: David Greenman Reply-To: dg@root.com Date: Sun, 09 Jul 2000 22:53:46 -0700 Sender: owner-freebsd-net@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org >* Alfred Perlstein [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