Message ID | 1431177038-11555-7-git-send-email-jiri@resnulli.us |
---|---|
State | Changes Requested, archived |
Delegated to: | David Miller |
Headers | show |
On 05/09/2015 06:10 AM, Jiri Pirko wrote: > __skb_tx_hash function has no relation to flow_dissect so just muve it > to skbuff.c (it is declared in skbuff.h) > > Signed-off-by: Jiri Pirko <jiri@resnulli.us> Minor nit, move is spelled with an o, not a u. Also any reason for moving this to skbuff.c instead of dev.c? It seems like this might be better placed there since the only caller is in netdevice.h. - Alex -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Mon, May 11, 2015 at 05:55:11PM CEST, alexander.h.duyck@redhat.com wrote: >On 05/09/2015 06:10 AM, Jiri Pirko wrote: >>__skb_tx_hash function has no relation to flow_dissect so just muve it >>to skbuff.c (it is declared in skbuff.h) >> >>Signed-off-by: Jiri Pirko <jiri@resnulli.us> > >Minor nit, move is spelled with an o, not a u. Noted. > >Also any reason for moving this to skbuff.c instead of dev.c? It seems like >this might be better placed there since the only caller is in netdevice.h. Okay. > >- Alex -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On Sat, May 9, 2015 at 6:10 AM, Jiri Pirko <jiri@resnulli.us> wrote: > __skb_tx_hash function has no relation to flow_dissect so just muve it > to skbuff.c (it is declared in skbuff.h) > It calls __skb_get_hash() in most of the cases, and __skb_get_hash() is in flow_dissector.c. There are many functions declared in skbuff.h but defined in a different file than skbuff.c. Why bother? -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Tue, May 12, 2015 at 01:21:01AM CEST, cwang@twopensource.com wrote: >On Sat, May 9, 2015 at 6:10 AM, Jiri Pirko <jiri@resnulli.us> wrote: >> __skb_tx_hash function has no relation to flow_dissect so just muve it >> to skbuff.c (it is declared in skbuff.h) >> > >It calls __skb_get_hash() in most of the cases, and __skb_get_hash() >is in flow_dissector.c. > >There are many functions declared in skbuff.h but defined in a different >file than skbuff.c. > >Why bother? To make this a little bit cleaner? -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/net/core/flow_dissector.c b/net/core/flow_dissector.c index 0d9bc3a..07ca11d 100644 --- a/net/core/flow_dissector.c +++ b/net/core/flow_dissector.c @@ -371,34 +371,6 @@ __u32 skb_get_hash_perturb(const struct sk_buff *skb, u32 perturb) } EXPORT_SYMBOL(skb_get_hash_perturb); -/* - * Returns a Tx hash based on the given packet descriptor a Tx queues' number - * to be used as a distribution range. - */ -u16 __skb_tx_hash(const struct net_device *dev, struct sk_buff *skb, - unsigned int num_tx_queues) -{ - u32 hash; - u16 qoffset = 0; - u16 qcount = num_tx_queues; - - if (skb_rx_queue_recorded(skb)) { - hash = skb_get_rx_queue(skb); - while (unlikely(hash >= num_tx_queues)) - hash -= num_tx_queues; - return hash; - } - - if (dev->num_tc) { - u8 tc = netdev_get_prio_tc_map(dev, skb->priority); - qoffset = dev->tc_to_txq[tc].offset; - qcount = dev->tc_to_txq[tc].count; - } - - return (u16) reciprocal_scale(skb_get_hash(skb), qcount) + qoffset; -} -EXPORT_SYMBOL(__skb_tx_hash); - u32 __skb_get_poff(const struct sk_buff *skb, void *data, const struct flow_keys *keys, int hlen) { diff --git a/net/core/skbuff.c b/net/core/skbuff.c index b9eb90b..76d0aad 100644 --- a/net/core/skbuff.c +++ b/net/core/skbuff.c @@ -4515,3 +4515,31 @@ failure: return NULL; } EXPORT_SYMBOL(alloc_skb_with_frags); + +/* + * Returns a Tx hash based on the given packet descriptor a Tx queues' number + * to be used as a distribution range. + */ +u16 __skb_tx_hash(const struct net_device *dev, struct sk_buff *skb, + unsigned int num_tx_queues) +{ + u32 hash; + u16 qoffset = 0; + u16 qcount = num_tx_queues; + + if (skb_rx_queue_recorded(skb)) { + hash = skb_get_rx_queue(skb); + while (unlikely(hash >= num_tx_queues)) + hash -= num_tx_queues; + return hash; + } + + if (dev->num_tc) { + u8 tc = netdev_get_prio_tc_map(dev, skb->priority); + qoffset = dev->tc_to_txq[tc].offset; + qcount = dev->tc_to_txq[tc].count; + } + + return (u16) reciprocal_scale(skb_get_hash(skb), qcount) + qoffset; +} +EXPORT_SYMBOL(__skb_tx_hash);
__skb_tx_hash function has no relation to flow_dissect so just muve it to skbuff.c (it is declared in skbuff.h) Signed-off-by: Jiri Pirko <jiri@resnulli.us> --- net/core/flow_dissector.c | 28 ---------------------------- net/core/skbuff.c | 28 ++++++++++++++++++++++++++++ 2 files changed, 28 insertions(+), 28 deletions(-)