summaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/intel/i40e/i40e_fcoe.c
diff options
context:
space:
mode:
authorAlexander Duyck2016-02-17 20:02:50 +0100
committerJeff Kirsher2016-02-19 08:27:05 +0100
commit2d37490b82afe1d1b745811e6ce0a4d16bc5e996 (patch)
treed553eeb43f16160ca628b835fb3738bc05ccf89f /drivers/net/ethernet/intel/i40e/i40e_fcoe.c
parenti40e/i40evf: Break up xmit_descriptor_count from maybe_stop_tx (diff)
downloadkernel-qcow2-linux-2d37490b82afe1d1b745811e6ce0a4d16bc5e996.tar.gz
kernel-qcow2-linux-2d37490b82afe1d1b745811e6ce0a4d16bc5e996.tar.xz
kernel-qcow2-linux-2d37490b82afe1d1b745811e6ce0a4d16bc5e996.zip
i40e/i40evf: Rewrite logic for 8 descriptor per packet check
This patch is meant to rewrite the logic for how we determine if we can transmit the frame or if it needs to be linearized. The previous code for this function was using a mix of division and modulus division as a part of computing if we need to take the slow path. Instead I have replaced this by simply working with a sliding window which will tell us if the frame would be capable of causing a single packet to span several descriptors. The logic for the scan is fairly simple. If any given group of 6 fragments is less than gso_size - 1 then it is possible for us to have one byte coming out of the first fragment, 6 fragments, and one or more bytes coming out of the last fragment. This gives us a total of 8 fragments which exceeds what we can allow so we send such frames to be linearized. Arguably the use of modulus might be more exact as the approach I propose may generate some false positives. However the likelihood of us taking much of a hit for those false positives is fairly low, and I would rather not add more overhead in the case where we are receiving a frame composed of 4K pages. Signed-off-by: Alexander Duyck <aduyck@mirantis.com> Tested-by: Andrew Bowers <andrewx.bowers@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Diffstat (limited to 'drivers/net/ethernet/intel/i40e/i40e_fcoe.c')
-rw-r--r--drivers/net/ethernet/intel/i40e/i40e_fcoe.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/net/ethernet/intel/i40e/i40e_fcoe.c b/drivers/net/ethernet/intel/i40e/i40e_fcoe.c
index 518d72ea1059..052df93f1da4 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_fcoe.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_fcoe.c
@@ -1368,6 +1368,12 @@ static netdev_tx_t i40e_fcoe_xmit_frame(struct sk_buff *skb,
goto out_drop;
count = i40e_xmit_descriptor_count(skb);
+ if (i40e_chk_linearize(skb, count)) {
+ if (__skb_linearize(skb))
+ goto out_drop;
+ count = TXD_USE_COUNT(skb->len);
+ tx_ring->tx_stats.tx_linearize++;
+ }
/* need: 1 descriptor per page * PAGE_SIZE/I40E_MAX_DATA_PER_TXD,
* + 1 desc for skb_head_len/I40E_MAX_DATA_PER_TXD,