Subject: Re: NetBSD/xen network problems (need help)
To: YAMAMOTO Takashi <yamt@mwd.biglobe.ne.jp>
From: Manuel Bouyer <bouyer@antioche.eu.org>
List: port-xen
Date: 03/15/2006 09:49:43
On Wed, Mar 15, 2006 at 08:35:34AM +0900, YAMAMOTO Takashi wrote:
> > m_makewritable origlen 112 newlen 182 error 0
> > panic: m_makewritable: length changed
> 
> the following would be the minimal fix.
> 
> YAMAMOTO Takashi
> 
> Index: if_xennet.c
> ===================================================================
> --- if_xennet.c	(revision 1576)
> +++ if_xennet.c	(working copy)
> @@ -787,8 +787,7 @@ xen_network_handler(void *arg)
>  			 * memory, copy data and push the receive
>  			 * buffer back to the hypervisor.
>  			 */
> -			m->m_len = MHLEN;
> -			m->m_pkthdr.len = 0;
> +			m->m_len = m->m_pkthdr.len = 0;
>  			m_copyback(m, 0, rx->status, pktp);
>  			xennet_rx_push_buffer(sc, rx->id);
>  			if (m->m_pkthdr.len < rx->status) {

I think setting m_len to 0 will cause the m_copyback() to add a second mbuf to
the chain to store the data, leaving the first one with a NULL size.

Now, it seems that m_copyback() adjust m->m_pkthdr.len, but not m->m_len.
Should it ? It so, adding
			m->m_len = m->m_pkthdr.len;
after the call to m_copyback() should be enough.

-- 
Manuel Bouyer <bouyer@antioche.eu.org>
     NetBSD: 26 ans d'experience feront toujours la difference
--