提交 4553d0bb 编写于 作者: A Amritha Nambiar 提交者: Yang Yingliang

net: Fix Tx hash bound checking

stable inclusion
from linux-4.19.115
commit b1cb7f2bc9b4f776ae1ab9583802b1bca34d215a

--------------------------------

commit 6e11d157 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: 1b837d48 ("net: Revoke export for __skb_tx_hash, update it to just be static skb_tx_hash")
Fixes: eadec877 ("net: Add support for subordinate traffic classes to netdev_pick_tx")
Signed-off-by: NAmritha Nambiar <amritha.nambiar@intel.com>
Reviewed-by: NAlexander Duyck <alexander.h.duyck@linux.intel.com>
Reviewed-by: NSridhar Samudrala <sridhar.samudrala@intel.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
Signed-off-by: NLi Aichun <liaichun@huawei.com>
Reviewed-by: Nguodeqing <geffrey.guo@huawei.com>
Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
上级 611f604d
...@@ -2854,6 +2854,8 @@ static u16 skb_tx_hash(const struct net_device *dev, ...@@ -2854,6 +2854,8 @@ static u16 skb_tx_hash(const struct net_device *dev,
if (skb_rx_queue_recorded(skb)) { if (skb_rx_queue_recorded(skb)) {
hash = skb_get_rx_queue(skb); hash = skb_get_rx_queue(skb);
if (hash >= qoffset)
hash -= qoffset;
while (unlikely(hash >= qcount)) while (unlikely(hash >= qcount))
hash -= qcount; hash -= qcount;
return hash + qoffset; return hash + qoffset;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册