Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 25 Aug 2005 20:12:43 +0000 (UTC)
From:      John Baldwin <jhb@FreeBSD.org>
To:        src-committers@FreeBSD.org, cvs-src@FreeBSD.org, cvs-all@FreeBSD.org
Subject:   cvs commit: src/sys/pci if_de.c if_devar.h
Message-ID:  <200508252012.j7PKChaw077847@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
jhb         2005-08-25 20:12:43 UTC

  FreeBSD src repository

  Modified files:
    sys/pci              if_de.c if_devar.h 
  Log:
  Major rototill of this driver to add FreeBSD bus-dma support:
  - Allocate arrays of metadata for the descriptors in the rx and tx rings
    and change the ring pointers to walk the metadata array rather than the
    actual descriptor rings.  Each metadata object contains a pointer to its
    descriptor, a pointer to any associated mbuf, and a pointer to the
    associated bus_dmamap_t in the bus_dma case.  The mbuf pointers replace
    the tulip_txq and tulip_rxq local ifqueue's in the softc.
  - Add lots of KTR trace entries using a local KTR_TULIP level which
    defaults to 0, but can be changed to KTR_DEV at the top of the file
    when debugging.
  - Rename tulip_init(), tulip_start(), tulip_ifinit(), and tulip_ifstart()
    to tulip_init_locked(), tulip_start_locked(), tulip_init(), and
    tulip_start(), respectively, to match the convention in other drivers.
  - Add a TULIP_SP_MAC() macro to encode two bytes of the MAC address into
    the setup buffer and use that in place of lots of BYTE_ORDER #ifdef's.
    Also, remove an incorrect XXX comment I added earlier, the driver was
    correct (at least it does the same thing dc(4) does).  TULIP_SP_MAC
    was shamelessly copied from DC_SP_MAC() in dc(4).
  - Remove the #ifdef'd NetBSD bus-dma code and replace it with FreeBSD
    bus-dma code that not only compiles but even works at runtime.
  - Use callout_init_mtx() instead of just callout_init().
  - Correct the various wrapper macros for bus_dmamap_sync() for the rx
    and tx buffers to only ask for the sync ops that they actually need.
  - Tidy the #ifdef TULIP_COPY_RXDATA code by expanding an #ifdef a bit
    so it becomes easier to read at the expense of a couple of duplicated
    lines of code.  Also, use m_getcl() to get an mbuf cluster rather than
    MGETHDR() followed by MCLGET().
  - Maintain the ring free (ri_free) count for the rx ring metadata since
    we no longer have tulip_rxq.ifq_len around to indicate how many mbuf's
    are currently in the rx ring.
  - Add code to teardown bus_dma resources when attach fails and generally
    fixup attach to do a better job of cleaning up when it fails.  This
    gets us a good bit closer to possibly having a detach method someday
    and making this driver an unloadable module.
  - Add some functions that can be called from ddb to dump the state of
    a descriptor ring and to dump the state of an individual descriptor.
  - Various comment grammer and spelling fixes.
  
  I have bus-dma turned on by default, but I've left the non-bus-dma code
  around so that it can be turned off to aid in debugging should any problems
  turn up later on.  I'll be removing the non-bus-dma code in a subsequent
  commit.
  
  Revision  Changes    Path
  1.171     +706 -450  src/sys/pci/if_de.c
  1.38      +74 -85    src/sys/pci/if_devar.h



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200508252012.j7PKChaw077847>