Subject: Re: [PATCH net-next] net: add skb_get_tx_queue() helper

From: Daniel Borkmann <[email-masked]>
Date: Wed, 27 Aug 2014 11:12:50 +0200

On 08/27/2014 01:51 AM, Tom Herbert wrote:
> On Tue, Aug 26, 2014 at 2:06 PM, Daniel Borkmann <[email-masked]> wrote:
>> Replace occurences of skb_get_queue_mapping() and follow-up
>> netdev_get_tx_queue() with an actual helper function.
>>
>> Signed-off-by: Daniel Borkmann <[email-masked]>
>> ---
>>   include/linux/netdevice.h | 8 ++++++++
>>   net/core/netpoll.c        | 2 +-
>>   net/core/pktgen.c         | 4 +---
>>   net/packet/af_packet.c    | 4 +---
>>   net/sched/sch_generic.c   | 6 ++++--
>>   5 files changed, 15 insertions(+), 9 deletions(-)
>>
>> diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
>> index 039b237..200ee4f 100644
>> --- a/include/linux/netdevice.h
>> +++ b/include/linux/netdevice.h
>> @@ -1747,6 +1747,14 @@ struct netdev_queue *netdev_get_tx_queue(const struct net_device *dev,
>>          return &dev->_tx[index];
>>   }
>>
>> +static inline struct netdev_queue *skb_get_tx_queue(const struct net_device *dev,
>> +                                                   const struct sk_buff *skb)
>> +{
>> +       u16 index = skb_get_queue_mapping(skb);
>> +
>> +       return netdev_get_tx_queue(dev, index);
>> +}
>> +
> return netdev_get_tx_queue(dev, skb_get_queue_mapping(skb));
>
> if you want to be a little more concise.

That's fine by me too, lets keep it a one-liner.