summaryrefslogtreecommitdiff
path: root/debian/patches/libdde_rx_queue.patch
blob: 6d8802322f7b814a977ed1738650df8ccba737d9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
commit d5a9e24afb4ab38110ebb777588ea0bd0eacbd0a
Author: David S. Miller <davem@davemloft.net>
Date:   Tue Jan 27 16:22:11 2009 -0800

    net: Allow RX queue selection to seed TX queue hashing.
    
    The idea is that drivers which implement multiqueue RX
    pre-seed the SKB by recording the RX queue selected by
    the hardware.
    
    If such a seed is found on TX, we'll use that to select
    the outgoing TX queue.
    
    This helps get more consistent load balancing on router
    and firewall loads.
    
    Signed-off-by: David S. Miller <davem@davemloft.net>

Index: hurd-debian/libdde-linux26/contrib/include/linux/skbuff.h
===================================================================
--- hurd-debian.orig/libdde-linux26/contrib/include/linux/skbuff.h	2012-04-16 00:34:56.000000000 +0000
+++ hurd-debian/libdde-linux26/contrib/include/linux/skbuff.h	2012-04-16 00:35:11.000000000 +0000
@@ -1903,6 +1903,21 @@
 	to->queue_mapping = from->queue_mapping;
 }
 
+static inline void skb_record_rx_queue(struct sk_buff *skb, u16 rx_queue)
+{
+	skb->queue_mapping = rx_queue + 1;
+}
+
+static inline u16 skb_get_rx_queue(struct sk_buff *skb)
+{
+	return skb->queue_mapping - 1;
+}
+
+static inline bool skb_rx_queue_recorded(struct sk_buff *skb)
+{
+	return (skb->queue_mapping != 0);
+}
+
 #ifdef CONFIG_XFRM
 static inline struct sec_path *skb_sec_path(struct sk_buff *skb)
 {
Index: hurd-debian/libdde-linux26/lib/src/net/core/dev.c
===================================================================
--- hurd-debian.orig/libdde-linux26/lib/src/net/core/dev.c	2012-04-16 00:34:51.000000000 +0000
+++ hurd-debian/libdde-linux26/lib/src/net/core/dev.c	2012-04-16 00:35:11.000000000 +0000
@@ -1731,6 +1731,13 @@
 		simple_tx_hashrnd_initialized = 1;
 	}
 
+	if (skb_rx_queue_recorded(skb)) {
+		u32 val = skb_get_rx_queue(skb);
+
+		hash = jhash_1word(val, simple_tx_hashrnd);
+		goto out;
+	}
+
 	switch (skb->protocol) {
 	case htons(ETH_P_IP):
 		if (!(ip_hdr(skb)->frag_off & htons(IP_MF | IP_OFFSET)))
@@ -1768,6 +1775,7 @@
 
 	hash = jhash_3words(addr1, addr2, ports, simple_tx_hashrnd);
 
+out:
 	return (u16) (((u64) hash * dev->real_num_tx_queues) >> 32);
 }