Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 1 Dec 2011 15:18:59 -0800
From:      YongHyeon PYUN <pyunyh@gmail.com>
To:        Peter <pmc@citylink.dinoex.sub.org>
Cc:        freebsd-net@FreeBSD.org, yongari@FreeBSD.org
Subject:   Re: kern/162932: [ed][panic][patch] large traffic yields occasional panics
Message-ID:  <20111201231859.GB12942@michelle.cdnetworks.com>
In-Reply-To: <20111201220515.GA3363@gate.oper.dinoex.org>
References:  <201111292303.pATN30W7062450@freefall.freebsd.org> <20111201220515.GA3363@gate.oper.dinoex.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, Dec 01, 2011 at 11:05:15PM +0100, Peter wrote:
> On Tue, Nov 29, 2011 at 11:03:00PM +0000, yongari@FreeBSD.org wrote:
> ! You can find the patch at the following URL.
> ! http://people.freebsd.org/~yongari/ed.pf.diff
> 
> ! Let me know whether this patch works for you.
> 
> Negative. It does not work. 
> 
> It seems You left away the pointer-arithmetics on src side, and
> copy the FIRST byte to the LAST position.
> 
> Putting that right makes it working.
> 
> 	*(mtod(m, uint8_t *))
> should be
> 	*(mtod(m, uint8_t *) + m->m_len - 1)
> (Possibly there is a way to write this construct more beautiful - I
> didn't care.)
> 

Oops, sorry.  It was copy&pate error. :-(

> ! since your patch may still invoke bus_space_write_1(9) if mbuf
> ! length is even bytes.
> 
> Yes, it does. Deliberately. ;)
> The original idea seemed to be: "copy byte-pairs of AT LEAST
> mbuf-size" - on uneven buffers tjat led to copying one byte that
> doesnt belong.
> My idea was "copy byte-pairs of AT MOST mbuf-size" which leads to 
> the last byte missing on uneven buffers - and therefore I did ALWAYS
> copy the LAST byte extra. (Shouldn't hurt copying it twice.)
> 

Yes, the end result would be the same but it would take extra bus
access cycles which might be much slower than CPU cycles.  I'm not
sure whether this also makes any sense on ISA bus but it's true for
all other buses I know(SBus, PCI, PCIe etc).

> Please understand: it's 20 years ago that I coded C. I don't have
> all the niceties handy - but I'll find some way to get it do what
> I want. It looks not always beautiful. ;)
> 
> 
> Today I did reproduce the panic on 7.4-STABLE with the original
> code. Then I tried Your patch - and it did what was to be expected:
> no panic, but when setting "ifconfig ed0 mtu 1499", filetransfers 
> would not proceed at all - the wrong byte obviousely breaks the
> packet checksum.
> 

Updated patch again.
http://people.freebsd.org/~yongari/ed.pf.diff2

> rgds,
> PMc



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