ice: Limit the ice_add_rx_frag to frag addition
authorMaciej Fijalkowski <maciej.fijalkowski@intel.com>
Wed, 13 Feb 2019 18:51:06 +0000 (10:51 -0800)
committerJeff Kirsher <jeffrey.t.kirsher@intel.com>
Mon, 25 Mar 2019 16:55:35 +0000 (09:55 -0700)
commit712edbbb67d404bae055d88e162e13980b426663
tree5397503461d62c9ba567b37a5ba2e9a0dc26c7cf
parent1d032bc77bb8f85d8adfd14a1a8c67c12b07eece
ice: Limit the ice_add_rx_frag to frag addition

Refactor ice_fetch_rx_buf and ice_add_rx_frag in a way that we have
standalone functions that do either the skb construction or frag
addition to previously constructed skb.

The skb handling between rx_bufs is spread among various functions. The
ice_get_rx_buf will retrieve the skb pointer from rx_buf and if it is a
NULL pointer then we do the ice_construct_skb, otherwise we add a frag
to the current skb via ice_add_rx_frag. Then, on the ice_put_rx_buf the
skb pointer that belongs to rx_buf will be cleared. Moving further, if
the current frame is not EOP frame we assign the current skb to the
rx_buf that is pointed by updated next_to_clean indicator.

What is more during the buffer reuse let's assign each member of
ice_rx_buf individually so we avoid the unnecessary copy of skb.

Last but not least, this logic split will allow us for better code reuse
when adding a support for build_skb.

Signed-off-by: Maciej Fijalkowski <maciej.fijalkowski@intel.com>
Signed-off-by: Anirudh Venkataramanan <anirudh.venkataramanan@intel.com>
Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
drivers/net/ethernet/intel/ice/ice_txrx.c