- Use jumbo buffers only when MTU > 1518 bytes.
authorSepherosa Ziehau <sephe@dragonflybsd.org>
Thu, 21 Dec 2006 14:13:04 +0000 (14:13 +0000)
committerSepherosa Ziehau <sephe@dragonflybsd.org>
Thu, 21 Dec 2006 14:13:04 +0000 (14:13 +0000)
commitff7f301d0dc19da6b37efe5992b80b4e38c213ad
treec577084546bb0150e15ef61f3a1e65c2cca3af3b
parent201eb0a7adb9b0fb52d41dc26b8d2327fdac47e8
- Use jumbo buffers only when MTU > 1518 bytes.
  o  In sk_dma_alloc(), allocate additional DMA stuffs for normal mbuf cluster
     to use.
  o  In sk_init(), set sk_if_softc.sk_use_jumbo if ifnet.if_mtu > 1518.  This
     should only be done after sk_stop(), so sk_stop() will not free wrong RX
     buffers.  Add a comment about it.
  o  Don't touch jumbo buffer related bits in hardware registers, if jumbo
     buffer is not used currently.
  o  Rename old sk_newbuf() to sk_newbuf_jumbo().
  o  Implement sk_newbuf_std(), which allocates RX buffer using mbuf clusters.
  o  Add a wrapper function, sk_newbuf(), to switch between above two functions
     based on whether sk_if_softc.sk_use_jumbo is set or not.
- If something fail in sk_rxeof(), don't call sk_newbuf() with old mbuf:
  Hardware will not change RX descriptor's buffer address part.  Only
  controlling bits of the RX descriptor need to be set up properly.
  Nuke third parameter (i.e. mbuf) of sk_newbuf() after this change and
  rearrange sk_newbuf_jumbo() accordingly.
- Since sk_chain and TX/RX descriptor use same index, nuke unnecessary
  sk_chain.sk_desc field, which points to a corresponding TX/RX descriptor.
  Pass the TX/RX descriptor index to sk_newbuf() instead of sk_chain pointer.
  Nuke never used sk_chain.sk_next field.  These changes degenarate sk_chain
  into a mbuf pointer, so nuke no longer needed sk_chain structure.

Tested-by: Rumko <rumcic@gmail.com> and Gergo Szakal <bastyaelvtars@gmail.com>
Partially-reviewed-by: dillon@
sys/dev/netif/sk/if_sk.c
sys/dev/netif/sk/if_skvar.h