提交 ec581f6a 编写于 作者: E Eric Dumazet 提交者: David S. Miller

net: Fix skb_tx_hash() for forwarding workloads.

When skb_rx_queue_recorded() is true, we dont want to use jash distribution
as the device driver exactly told us which queue was selected at RX time.
jhash makes a statistical shuffle, but this wont work with 8 static inputs.

Later improvements would be to compute reciprocal value of real_num_tx_queues
to avoid a divide here. But this computation should be done once,
when real_num_tx_queues is set. This needs a separate patch, and a new
field in struct net_device.
Reported-by: NAndrew Dickinson <andrew@whydna.net>
Signed-off-by: NEric Dumazet <dada1@cosmosbay.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 7a67e56f
......@@ -1735,11 +1735,12 @@ u16 skb_tx_hash(const struct net_device *dev, const struct sk_buff *skb)
{
u32 hash;
if (skb_rx_queue_recorded(skb)) {
hash = skb_get_rx_queue(skb);
} else if (skb->sk && skb->sk->sk_hash) {
if (skb_rx_queue_recorded(skb))
return skb_get_rx_queue(skb) % dev->real_num_tx_queues;
if (skb->sk && skb->sk->sk_hash)
hash = skb->sk->sk_hash;
} else
else
hash = skb->protocol;
hash = jhash_1word(hash, skb_tx_hashrnd);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册