]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
Fix bug that can cause transmit corruption. There are actually two 'rings'
authorBill Paul <wpaul@FreeBSD.org>
Mon, 24 May 1999 14:56:55 +0000 (14:56 +0000)
committerBill Paul <wpaul@FreeBSD.org>
Mon, 24 May 1999 14:56:55 +0000 (14:56 +0000)
commit497760a16ab7dba23bf40505df1b571f8f4f49e8
tree68b9481e1d1991b4cd0490f7a52b72437120c406
parente142fadecb5cca130e89a7f373202629f6c8a155
Fix bug that can cause transmit corruption. There are actually two 'rings'
in the transmit code: the TX descriptor ring, and a 'shadow' ring of mbuf
pointers, one for each TX descriptor. When transmitting a packet that
consists of several fragments in an mbuf chain, we link each fragment
to a descriptor in the TX ring, but we only save a pointer to the mbuf
chain. This pointer is saved in the shadow ring entry which corresponds
to the first fragment in the packet. Later, ti_txeof() can release the
whole chain with a single m_freem() call. (We need the second ring to
keep track of the virtual addresses of the mbuf chains.)

The problem with this is that the Tigon isn't actually through with the
mbuf chain until it reaches the last fragment (which has the TI_BDFLAG_END
bit set), however the current scheme releases the mbuf chain as soon as
the first fragment is consumed. This is wrong, since the mbufs can then
be yanked out from under the Tigon and modified before the other fragments
can be transmitted.

The fix is to make a one line change to ti_encap() so that it saves the
mbuf chain pointer in the shadow ring entry that corresponds to the last
fragment in TX ring instead of the first. This prevents the mbufs from
being released until the last fragment is transmitted.

Painstakingly diagnosed and fixed by: Robert Picco <picco@mail.wevinc.com>
Brought to my attention by: dg
sys/dev/ti/if_ti.c
sys/pci/if_ti.c