diff options
Diffstat (limited to 'net')
-rw-r--r-- | net/core/dev.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/net/core/dev.c b/net/core/dev.c index d28b3a023bb2..b25dd087f06a 100644 --- a/net/core/dev.c +++ b/net/core/dev.c | |||
@@ -2112,14 +2112,19 @@ out: | |||
2112 | 2112 | ||
2113 | static u32 hashrnd __read_mostly; | 2113 | static u32 hashrnd __read_mostly; |
2114 | 2114 | ||
2115 | u16 skb_tx_hash(const struct net_device *dev, const struct sk_buff *skb) | 2115 | /* |
2116 | * Returns a Tx hash based on the given packet descriptor a Tx queues' number | ||
2117 | * to be used as a distribution range. | ||
2118 | */ | ||
2119 | u16 __skb_tx_hash(const struct net_device *dev, const struct sk_buff *skb, | ||
2120 | unsigned int num_tx_queues) | ||
2116 | { | 2121 | { |
2117 | u32 hash; | 2122 | u32 hash; |
2118 | 2123 | ||
2119 | if (skb_rx_queue_recorded(skb)) { | 2124 | if (skb_rx_queue_recorded(skb)) { |
2120 | hash = skb_get_rx_queue(skb); | 2125 | hash = skb_get_rx_queue(skb); |
2121 | while (unlikely(hash >= dev->real_num_tx_queues)) | 2126 | while (unlikely(hash >= num_tx_queues)) |
2122 | hash -= dev->real_num_tx_queues; | 2127 | hash -= num_tx_queues; |
2123 | return hash; | 2128 | return hash; |
2124 | } | 2129 | } |
2125 | 2130 | ||
@@ -2129,9 +2134,9 @@ u16 skb_tx_hash(const struct net_device *dev, const struct sk_buff *skb) | |||
2129 | hash = (__force u16) skb->protocol ^ skb->rxhash; | 2134 | hash = (__force u16) skb->protocol ^ skb->rxhash; |
2130 | hash = jhash_1word(hash, hashrnd); | 2135 | hash = jhash_1word(hash, hashrnd); |
2131 | 2136 | ||
2132 | return (u16) (((u64) hash * dev->real_num_tx_queues) >> 32); | 2137 | return (u16) (((u64) hash * num_tx_queues) >> 32); |
2133 | } | 2138 | } |
2134 | EXPORT_SYMBOL(skb_tx_hash); | 2139 | EXPORT_SYMBOL(__skb_tx_hash); |
2135 | 2140 | ||
2136 | static inline u16 dev_cap_txqueue(struct net_device *dev, u16 queue_index) | 2141 | static inline u16 dev_cap_txqueue(struct net_device *dev, u16 queue_index) |
2137 | { | 2142 | { |