Commit feec084a authored by Jason Wang's avatar Jason Wang Committed by David S. Miller

tun: use symmetric hash

Tun actually expects a symmetric hash for queue selecting to work
correctly, otherwise packets belongs to a single flow may be
redirected to the wrong queue. So this patch switch to use
__skb_get_hash_symmetric().
Signed-off-by: default avatarJason Wang <jasowang@redhat.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 5461bd41
...@@ -465,7 +465,7 @@ static u16 tun_select_queue(struct net_device *dev, struct sk_buff *skb, ...@@ -465,7 +465,7 @@ static u16 tun_select_queue(struct net_device *dev, struct sk_buff *skb,
rcu_read_lock(); rcu_read_lock();
numqueues = ACCESS_ONCE(tun->numqueues); numqueues = ACCESS_ONCE(tun->numqueues);
txq = skb_get_hash(skb); txq = __skb_get_hash_symmetric(skb);
if (txq) { if (txq) {
e = tun_flow_find(&tun->flows[tun_hashfn(txq)], txq); e = tun_flow_find(&tun->flows[tun_hashfn(txq)], txq);
if (e) { if (e) {
...@@ -867,7 +867,7 @@ static netdev_tx_t tun_net_xmit(struct sk_buff *skb, struct net_device *dev) ...@@ -867,7 +867,7 @@ static netdev_tx_t tun_net_xmit(struct sk_buff *skb, struct net_device *dev)
*/ */
__u32 rxhash; __u32 rxhash;
rxhash = skb_get_hash(skb); rxhash = __skb_get_hash_symmetric(skb);
if (rxhash) { if (rxhash) {
struct tun_flow_entry *e; struct tun_flow_entry *e;
e = tun_flow_find(&tun->flows[tun_hashfn(rxhash)], e = tun_flow_find(&tun->flows[tun_hashfn(rxhash)],
...@@ -1334,7 +1334,7 @@ static ssize_t tun_get_user(struct tun_struct *tun, struct tun_file *tfile, ...@@ -1334,7 +1334,7 @@ static ssize_t tun_get_user(struct tun_struct *tun, struct tun_file *tfile,
skb_reset_network_header(skb); skb_reset_network_header(skb);
skb_probe_transport_header(skb, 0); skb_probe_transport_header(skb, 0);
rxhash = skb_get_hash(skb); rxhash = __skb_get_hash_symmetric(skb);
#ifndef CONFIG_4KSTACKS #ifndef CONFIG_4KSTACKS
tun_rx_batched(tun, tfile, skb, more); tun_rx_batched(tun, tfile, skb, more);
#else #else
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment