Re: 5.2-RC oerrs and collisions on dc0

From: Dejan Lesjak <dejan.lesjak_at_ijs.si>
Date: Tue, 6 Jan 2004 05:41:02 +0100
Don Lewis wrote:

> On  5 Jan, Maxime Henrion wrote:
>> Don Lewis wrote:
> 
>>> How about something like the following.  I can't test it because I don't
>>> have the appropriate hardware, but at least it compiles ;-)
> 
>  [ snip ]
>> Looks mostly good, but you missed some occurences of DC_TXCTL_FIRSTFRAG
>> that need to be changed.
> 
> I only found one more, in dc_stop().
> 
> 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
> _at__at_ -2859,7 +2859,7 _at__at_
>  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
> _at__at_ -3262,6 +3262,7 _at__at_
>  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);
> _at__at_ -3311,13 +3312,13 _at__at_
>  * 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,
> _at__at_ -3768,7 +3769,7 _at__at_
>  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
> _at__at_ -486,6 +486,7 _at__at_
>  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;
> 

Yes this seems to work. The machine is running now for about 15 minutes and I 
have no output errors or collisions. I'll leave it working and another one 
fetching a 181M file from it every 5 minutes, so I'll see how it goes, but I 
think this patch solved the problem.
I also cc-ed Andy Farkas who was seeing this problem on Macronics card, 
perhaps he will also try checking this.

Thank you very much and I hope this will make it in RELENG_5_2 branch.

Dejan
Received on Mon Jan 05 2004 - 19:41:11 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:37:36 UTC