net: bcmgenet: rewrite bcmgenet_rx_refill()
authorPetri Gynther <[email protected]>
Thu, 12 Mar 2015 22:48:00 +0000 (15:48 -0700)
committerDavid S. Miller <[email protected]>
Fri, 13 Mar 2015 19:48:15 +0000 (15:48 -0400)
commitd6707bec598649450ee0887bf11896e525777874
tree8e33b10d376a8365d6d369ffd52ae8a461737719
parent5e1459ca13eddea516f8c56122cb3253e7b0e03e
net: bcmgenet: rewrite bcmgenet_rx_refill()

Currently, bcmgenet_desc_rx() calls bcmgenet_rx_refill() at the end of
Rx packet processing loop, after the current Rx packet has already been
passed to napi_gro_receive(). However, bcmgenet_rx_refill() might fail
to allocate a new Rx skb, thus leaving a hole on the Rx queue where no
valid Rx buffer exists.

To eliminate this situation:
1. Rewrite bcmgenet_rx_refill() to retain the current Rx skb on the Rx
   queue if a new replacement Rx skb can't be allocated and DMA-mapped.
   In this case, the data on the current Rx skb is effectively dropped.
2. Modify bcmgenet_desc_rx() to call bcmgenet_rx_refill() at the top of
   Rx packet processing loop, so that the new replacement Rx skb is
   already in place before the current Rx skb is processed.

Signed-off-by: Petri Gynther <[email protected]>
Tested-by: Jaedon Shin <[email protected]>--
Reviewed-by: Florian Fainelli <[email protected]>
Tested-by: Florian Fainelli <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
drivers/net/ethernet/broadcom/genet/bcmgenet.c