Skip to contentSkip to conversation

tun, rfs: fix the incorrect hash value

net-next bugfix Applied Zhi Yong Wu 3 participants 3 messages Jan 2, 2014

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

From: Zhi Yong Wu <[email protected]>

The code incorrectly save the queue index as the hash, so this patch is fixing it with the hash received in the stack receive path.

---
 drivers/net/tun.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/net/tun.c +1 -1
index 3cf0457..09f6662 100644
@@ -378,8 +378,8 @@ static u16 tun_select_queue(struct net_device *dev, struct sk_buff *skb)
 	if (txq) {
 		e = tun_flow_find(&tun->flows[tun_hashfn(txq)], txq);
 		if (e) {
-			txq = e->queue_index;
 			tun_flow_save_rps_rxhash(e, txq);
+			txq = e->queue_index;
 		} else
 			/* use multiply and shift instead of expensive divide */
 			txq = ((u64)txq * numqueues) >> 32;
Signature · 1 line
1.7.6.5
Acked-by
#1 lore raw
Quoted 15 lines · Zhi Yong Wu

From: Zhi Yong Wu <[email protected]>

The code incorrectly save the queue index as the hash, so this patch is fixing it with the hash received in the stack receive path.

---
 drivers/net/tun.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/net/tun.c +0 -0
index 3cf0457..09f6662 100644

drivers/net/tun.c static u16 tun_select_queue(struct net_device *dev, struct sk_buff *skb) · line 385

Quoted 9 lines
drivers/net/tun.c +1 -1
@@ -378,8 +378,8 @@ static u16 tun_select_queue(struct net_device *dev, struct sk_buff *skb)
 	if (txq) {
 		e = tun_flow_find(&tun->flows[tun_hashfn(txq)], txq);
 		if (e) {
-			txq = e->queue_index;
 			tun_flow_save_rps_rxhash(e, txq);
+			txq = e->queue_index;
 		} else
 			/* use multiply and shift instead of expensive divide */
 			txq = ((u64)txq * numqueues) >> 32;