From owner-freebsd-current@FreeBSD.ORG Wed Jan 7 11:32:32 2004 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id B36C216A4CE; Wed, 7 Jan 2004 11:32:32 -0800 (PST) Received: from gw.catspoiler.org (217-ip-163.nccn.net [209.79.217.163]) by mx1.FreeBSD.org (Postfix) with ESMTP id EDC6443D31; Wed, 7 Jan 2004 11:32:30 -0800 (PST) (envelope-from truckman@FreeBSD.org) Received: from FreeBSD.org (mousie.catspoiler.org [192.168.101.2]) by gw.catspoiler.org (8.12.9p2/8.12.9) with ESMTP id i07JWN7E017376; Wed, 7 Jan 2004 11:32:27 -0800 (PST) (envelope-from truckman@FreeBSD.org) Message-Id: <200401071932.i07JWN7E017376@gw.catspoiler.org> Date: Wed, 7 Jan 2004 11:32:23 -0800 (PST) From: Don Lewis To: current@FreeBSD.org MIME-Version: 1.0 Content-Type: TEXT/plain; charset=us-ascii cc: re@FreeBSD.org Subject: Call for testers - dc ethernet driver patch X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Jan 2004 19:32:32 -0000 The dc driver has been broken ever since it was converted to use busdma. The symptoms are that it reports spurious output errors and collisions, even when running in full-duplex mode. I believe the patch below fixes the problem, but I do not have the appropriate hardware to test it. I have had one gotten one report so far from someone who claims this patch fixed the problems he was seeing. I'd appreciate further testing of this patch, especially with as many of the chipsets supported by the driver as possible so that I can commit this patch. Please mention the type of hardware you are using (machine architecture and card probe message) in your reports. This is somewhat time critical because I've had users express interest in getting this into 5.2. Index: sys/pci/if_dc.c =================================================================== RCS file: /home/ncvs/src/sys/pci/if_dc.c,v retrieving revision 1.137 diff -u -r1.137 if_dc.c --- sys/pci/if_dc.c 6 Dec 2003 02:29:31 -0000 1.137 +++ sys/pci/if_dc.c 5 Jan 2004 21:33:28 -0000 @@ -2859,7 +2859,7 @@ if (txstat & DC_TXSTAT_OWN) break; - if (!(ctl & DC_TXCTL_FIRSTFRAG) || ctl & DC_TXCTL_SETUP) { + if (!(ctl & DC_TXCTL_LASTFRAG) || ctl & DC_TXCTL_SETUP) { if (ctl & DC_TXCTL_SETUP) { /* * Yes, the PNIC is so brain damaged @@ -3262,6 +3262,7 @@ sc->dc_cdata.dc_tx_prod = frag; sc->dc_cdata.dc_tx_cnt += nseg; sc->dc_ldata->dc_tx_list[cur].dc_ctl |= htole32(DC_TXCTL_LASTFRAG); + sc->dc_cdata.dc_tx_chain[cur] = sc->dc_cdata.dc_tx_mapping; if (sc->dc_flags & DC_TX_INTR_FIRSTFRAG) sc->dc_ldata->dc_tx_list[first].dc_ctl |= htole32(DC_TXCTL_FINT); @@ -3311,13 +3312,13 @@ * of fragments or hit the end of the mbuf chain. */ idx = sc->dc_cdata.dc_tx_prod; + sc->dc_cdata.dc_tx_mapping = *m_head; error = bus_dmamap_load_mbuf(sc->dc_mtag, sc->dc_cdata.dc_tx_map[idx], *m_head, dc_dma_map_txbuf, sc, 0); if (error) return (error); if (sc->dc_cdata.dc_tx_err != 0) return (sc->dc_cdata.dc_tx_err); - sc->dc_cdata.dc_tx_chain[idx] = *m_head; bus_dmamap_sync(sc->dc_mtag, sc->dc_cdata.dc_tx_map[idx], BUS_DMASYNC_PREWRITE); bus_dmamap_sync(sc->dc_ltag, sc->dc_lmap, @@ -3768,7 +3769,7 @@ if (cd->dc_tx_chain[i] != NULL) { ctl = le32toh(ld->dc_tx_list[i].dc_ctl); if ((ctl & DC_TXCTL_SETUP) || - !(ctl & DC_TXCTL_FIRSTFRAG)) { + !(ctl & DC_TXCTL_LASTFRAG)) { cd->dc_tx_chain[i] = NULL; continue; } Index: sys/pci/if_dcreg.h =================================================================== RCS file: /home/ncvs/src/sys/pci/if_dcreg.h,v retrieving revision 1.40 diff -u -r1.40 if_dcreg.h --- sys/pci/if_dcreg.h 6 Dec 2003 02:29:31 -0000 1.40 +++ sys/pci/if_dcreg.h 5 Jan 2004 19:58:05 -0000 @@ -486,6 +486,7 @@ struct dc_chain_data { struct mbuf *dc_rx_chain[DC_RX_LIST_CNT]; struct mbuf *dc_tx_chain[DC_TX_LIST_CNT]; + struct mbuf *dc_tx_mapping; bus_dmamap_t dc_rx_map[DC_RX_LIST_CNT]; bus_dmamap_t dc_tx_map[DC_TX_LIST_CNT]; u_int32_t *dc_sbuf;