]> CyberLeo.Net >> Repos - FreeBSD/stable/8.git/commit
MFC r218832:
authoryongari <yongari@ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f>
Sun, 27 Mar 2011 22:48:58 +0000 (22:48 +0000)
committeryongari <yongari@ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f>
Sun, 27 Mar 2011 22:48:58 +0000 (22:48 +0000)
commit2f49c9e666252f9dffe6add3c88fffca963eeb49
treed9b65f70e9d86cf26e1f5b76e8c931addf4ce729
parente4abf96d653841956a9353cba20c9bd42b791b76
MFC r218832:
  Split common TX/RX descriptor DMA tag to TX and RX DMA tags
  respectively and fix all bus_dma(9) issues seen when bounce buffers
  are used.
   o Setup frame handling had no bus_dmamap_sync(9) which prevented
     driver from configuring RX filter. Add missing bus_dmamap_sync(9)
     in both dc_setfilt_21143()/dc_setfilt_xircom() and dc_txeof().
   o Use bus_addr_t for DMA segment instead of using u_int32_t.
   o Introduce dc_dma_alloc()/dc_dma_free() functions to allocate/free
     DMA'able memory.
   o Create two DMA descriptor list for each TX/RX lists. This change
     will minimize the size of bounce buffers that would be used in
     each TX/RX path.  Previously driver had to copy both TX/RX lists
     when bounce buffer is active.
   o 21143 data sheet says descriptor list requires 4 bytes alignment.
     Remove PAGE_SIZE alignment restriction and use
     sizeof(struct dc_dec).
   o Setup frame requires 4 bytes alignment.  Remove PAGE_SIZE
     alignment restriction and use sizeof(struct dc_dec).
   o Add missing DMA map unload for both setup frame and TX/RX
     descriptor list.
   o Overhaul RX handling logic such that make driver always allocate
     new RX buffer with dc_newbuf(). Previously driver allowed to
     copy received frame with m_devget(9) after passing the
     descriptor ownership to controller. This can lead to passing
     wrong frame to upper stack.
   o Introduce dc_discard_rxbuf() which will discard received frame
     and reuse loaded DMA map and RX mbuf.
   o Correct several wrong bus_dmamap_sync(9) usage in dc_rxeof and
     dc_txeof. The TX/RX descriptor lists are updated by both driver
     and HW so READ/WRITE semantics should be used.
   o If driver failed to allocate new RX buffer, update if_iqdrops
     counter instead of if_ierrors since driver received the frame
     without errors.
   o Make sure to unload loaded setup frame DMA map in dc_txeof and
     clear the mark of setup frame of the TX descriptor in dc_txeof().
   o Add check for possible TX descriptor overruns in dc_encap() and
     move check for free buffer to caller, dc_start_locked().
   o Swap the loaded DMA map and the last DMA map for multi-segmented
     frames. Since dc_txeof() assumes the last descriptor of the
     frame has the DMA map, driver should swap the first and the last
     DMA map in dc_encap(). Previously driver tried to unload
     not-yet-loaded DMA map such that the loaded DMA map was not
     unloaded at all for multi-segmented frames.
   o Rewrite DC_RXDESC/DC_TXDESC macro to simpler one.
   o Remove definition of ETHER_ALIGN, it's already defined in
     ethernet.h.
  With this changes, dc(4) works with bounce buffers and it shall
  also fix issues which might have shown in PAE environments.

  Tested by: marius

git-svn-id: svn://svn.freebsd.org/base/stable/8@220072 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
sys/dev/dc/if_dc.c
sys/dev/dc/if_dcreg.h