summaryrefslogtreecommitdiff
path: root/net/core
diff options
context:
space:
mode:
authorAmritha Nambiar <amritha.nambiar@intel.com>2020-02-24 10:56:00 -0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2020-04-08 09:08:46 +0200
commit238112fcf3911bdc6b3f32b248c554d704f64c33 (patch)
tree8dc6dff3d84ecafbc245370c1a70583b2f79dee7 /net/core
parent15ee8da79ee3447d1c483c4c5500e0f12f07b6e2 (diff)
net: Fix Tx hash bound checking
commit 6e11d1578fba8d09d03a286740ffcf336d53928c upstream. Fixes the lower and upper bounds when there are multiple TCs and traffic is on the the same TC on the same device. The lower bound is represented by 'qoffset' and the upper limit for hash value is 'qcount + qoffset'. This gives a clean Rx to Tx queue mapping when there are multiple TCs, as the queue indices for upper TCs will be offset by 'qoffset'. v2: Fixed commit description based on comments. Fixes: 1b837d489e06 ("net: Revoke export for __skb_tx_hash, update it to just be static skb_tx_hash") Fixes: eadec877ce9c ("net: Add support for subordinate traffic classes to netdev_pick_tx") Signed-off-by: Amritha Nambiar <amritha.nambiar@intel.com> Reviewed-by: Alexander Duyck <alexander.h.duyck@linux.intel.com> Reviewed-by: Sridhar Samudrala <sridhar.samudrala@intel.com> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'net/core')
-rw-r--r--net/core/dev.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/net/core/dev.c b/net/core/dev.c
index 931dfdcbabf1..c19c424197e3 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -2795,6 +2795,8 @@ static u16 skb_tx_hash(const struct net_device *dev,
if (skb_rx_queue_recorded(skb)) {
hash = skb_get_rx_queue(skb);
+ if (hash >= qoffset)
+ hash -= qoffset;
while (unlikely(hash >= qcount))
hash -= qcount;
return hash + qoffset;