From owner-cvs-all Mon May 24 7:56:59 1999 Delivered-To: cvs-all@freebsd.org Received: from freefall.freebsd.org (freefall.FreeBSD.ORG [204.216.27.21]) by hub.freebsd.org (Postfix) with ESMTP id C0335153EE; Mon, 24 May 1999 07:56:57 -0700 (PDT) (envelope-from wpaul@FreeBSD.org) Received: (from wpaul@localhost) by freefall.freebsd.org (8.9.3/8.9.2) id HAA56050; Mon, 24 May 1999 07:56:57 -0700 (PDT) (envelope-from wpaul@FreeBSD.org) Message-Id: <199905241456.HAA56050@freefall.freebsd.org> From: Bill Paul Date: Mon, 24 May 1999 07:56:57 -0700 (PDT) To: cvs-committers@FreeBSD.org, cvs-all@FreeBSD.org Subject: cvs commit: src/sys/pci if_ti.c Sender: owner-cvs-all@FreeBSD.ORG Precedence: bulk wpaul 1999/05/24 07:56:57 PDT Modified files: sys/pci if_ti.c Log: 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 Brought to my attention by: dg Revision Changes Path 1.6 +3 -3 src/sys/pci/if_ti.c To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe cvs-all" in the body of the message