diff options
-rw-r--r-- | include/linux/skbuff.h | 15 | ||||
-rw-r--r-- | net/core/dev.c | 8 |
2 files changed, 23 insertions, 0 deletions
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h index cf2cb50f77d1..a2c2378a9c58 100644 --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h | |||
@@ -1904,6 +1904,21 @@ static inline void skb_copy_queue_mapping(struct sk_buff *to, const struct sk_bu | |||
1904 | to->queue_mapping = from->queue_mapping; | 1904 | to->queue_mapping = from->queue_mapping; |
1905 | } | 1905 | } |
1906 | 1906 | ||
1907 | static inline void skb_record_rx_queue(struct sk_buff *skb, u16 rx_queue) | ||
1908 | { | ||
1909 | skb->queue_mapping = rx_queue + 1; | ||
1910 | } | ||
1911 | |||
1912 | static inline u16 skb_get_rx_queue(struct sk_buff *skb) | ||
1913 | { | ||
1914 | return skb->queue_mapping - 1; | ||
1915 | } | ||
1916 | |||
1917 | static inline bool skb_rx_queue_recorded(struct sk_buff *skb) | ||
1918 | { | ||
1919 | return (skb->queue_mapping != 0); | ||
1920 | } | ||
1921 | |||
1907 | #ifdef CONFIG_XFRM | 1922 | #ifdef CONFIG_XFRM |
1908 | static inline struct sec_path *skb_sec_path(struct sk_buff *skb) | 1923 | static inline struct sec_path *skb_sec_path(struct sk_buff *skb) |
1909 | { | 1924 | { |
diff --git a/net/core/dev.c b/net/core/dev.c index 5379b0c1190a..b21ad0b47aae 100644 --- a/net/core/dev.c +++ b/net/core/dev.c | |||
@@ -1722,6 +1722,13 @@ static u16 simple_tx_hash(struct net_device *dev, struct sk_buff *skb) | |||
1722 | simple_tx_hashrnd_initialized = 1; | 1722 | simple_tx_hashrnd_initialized = 1; |
1723 | } | 1723 | } |
1724 | 1724 | ||
1725 | if (skb_rx_queue_recorded(skb)) { | ||
1726 | u32 val = skb_get_rx_queue(skb); | ||
1727 | |||
1728 | hash = jhash_1word(val, simple_tx_hashrnd); | ||
1729 | goto out; | ||
1730 | } | ||
1731 | |||
1725 | switch (skb->protocol) { | 1732 | switch (skb->protocol) { |
1726 | case htons(ETH_P_IP): | 1733 | case htons(ETH_P_IP): |
1727 | if (!(ip_hdr(skb)->frag_off & htons(IP_MF | IP_OFFSET))) | 1734 | if (!(ip_hdr(skb)->frag_off & htons(IP_MF | IP_OFFSET))) |
@@ -1759,6 +1766,7 @@ static u16 simple_tx_hash(struct net_device *dev, struct sk_buff *skb) | |||
1759 | 1766 | ||
1760 | hash = jhash_3words(addr1, addr2, ports, simple_tx_hashrnd); | 1767 | hash = jhash_3words(addr1, addr2, ports, simple_tx_hashrnd); |
1761 | 1768 | ||
1769 | out: | ||
1762 | return (u16) (((u64) hash * dev->real_num_tx_queues) >> 32); | 1770 | return (u16) (((u64) hash * dev->real_num_tx_queues) >> 32); |
1763 | } | 1771 | } |
1764 | 1772 | ||