cvs commit: src/sys/dev/dc if_dc.c if_dcreg.h

Marius Strobl marius at FreeBSD.org
Sun Aug 5 04:28:20 PDT 2007


marius      2007-08-05 11:28:19 UTC

  FreeBSD src repository

  Modified files:
    sys/dev/dc           if_dc.c if_dcreg.h 
  Log:
  o In order to reduce bug and code duplication fold handling of NICs
    requiring DC_TX_ALIGN or DC_TX_COALESCE, which was previously done
    in dc_start_locked(), into dc_encap().
  o In dc_encap():
    - If m_defrag() fails just drop the packet like other NIC drivers
      do. This should only happen when there's a mbuf shortage, in which
      case it was possible to end up with an IFQ full of packets which
      couldn't be processed as they couldn't be defragmented as they
      were taking up all the mbufs themselves. This includes adjusting
      dc_start_locked() to not trying to prepend the mbuf (chain) if
      dc_encap() has freed it.
    - Likewise, if bus_dmamap_load_mbuf() fails as dc_dma_map_txbuf()
      failed, free the mbuf possibly allocated by the above call to
      m_defrag() and drop the packet.
  o In dc_txeof():
    - Don't clear IFF_DRV_OACTIVE unless there are at least 6 free TX
      descriptors. Further down the road dc_encap() will bail if there
      are only 5 or fewer free TX descriptors, causing dc_start_locked()
      to abort and prepend the dequeued mbuf again so it makes no sense
      to pretend we could process mbufs again when in fact we won't.
      While at it replace this magic 5 with a macro DC_TX_LIST_RSVD.
    - Just always assign idx to sc->dc_cdata.dc_tx_cons; it doesn't
      make much sense to exclude the idx == sc->dc_cdata.dc_tx_cons
      case.
  o In dc_dma_map_txbuf() there's no need to set sc->dc_cdata.dc_tx_err
    to error if the latter is != 0, bus_dmamap_load_mbuf() already
    returns the same error value in that case anyway.
  o For less overhead, convert to use bus_dmamap_load_mbuf_sg() for
    loading RX buffers.
  o Remove some banal and/or outdated comments.
  
  Approved by:    re (kensmith)
  MFC after:      1 week
  
  Revision  Changes    Path
  1.192     +30 -67    src/sys/dev/dc/if_dc.c
  1.54      +1 -2      src/sys/dev/dc/if_dcreg.h


More information about the cvs-src mailing list