netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jason Wang <jasowang@redhat.com>
To: John Fastabend <john.fastabend@gmail.com>,
	mst@redhat.com, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org, davem@davemloft.net
Cc: brouer@redhat.com, eric.dumazet@gmail.com, kvm@vger.kernel.org,
	virtualization@lists.linux-foundation.org
Subject: Re: [PATCH net-next V3 5/6] net: introduce NETDEV_CHANGE_TX_QUEUE_LEN
Date: Thu, 30 Jun 2016 14:43:00 +0800	[thread overview]
Message-ID: <5774BF74.9000508@redhat.com> (raw)
In-Reply-To: <5774B553.5070701@redhat.com>



On 2016年06月30日 13:59, Jason Wang wrote:
>
>
> On 2016年06月30日 13:12, Jason Wang wrote:
>>
>>
>> On 2016年06月30日 12:56, John Fastabend wrote:
>>> On 16-06-29 08:52 PM, Jason Wang wrote:
>>>> This patch introduces a new event - NETDEV_CHANGE_TX_QUEUE_LEN, this
>>>> will be triggered when tx_queue_len. It could be used by net device
>>>> who want to do some processing at that time. An example is tun who may
>>>> want to resize tx array when tx_queue_len is changed.
>>>>
>>>> Signed-off-by: Jason Wang <jasowang@redhat.com>
>>>> ---
>>>>   include/linux/netdevice.h |  1 +
>>>>   net/core/net-sysfs.c      | 15 ++++++++++++++-
>>>>   2 files changed, 15 insertions(+), 1 deletion(-)
>>>>
>>>> diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
>>>> index e84d9d2..7dc2ec7 100644
>>>> --- a/include/linux/netdevice.h
>>>> +++ b/include/linux/netdevice.h
>>>> @@ -2237,6 +2237,7 @@ struct netdev_lag_lower_state_info {
>>>>   #define NETDEV_PRECHANGEUPPER    0x001A
>>>>   #define NETDEV_CHANGELOWERSTATE    0x001B
>>>>   #define NETDEV_UDP_TUNNEL_PUSH_INFO    0x001C
>>>> +#define NETDEV_CHANGE_TX_QUEUE_LEN    0x001E
>>>>     int register_netdevice_notifier(struct notifier_block *nb);
>>>>   int unregister_netdevice_notifier(struct notifier_block *nb);
>>>> diff --git a/net/core/net-sysfs.c b/net/core/net-sysfs.c
>>>> index 7a0b616..6e4f347 100644
>>>> --- a/net/core/net-sysfs.c
>>>> +++ b/net/core/net-sysfs.c
>>>> @@ -322,7 +322,20 @@ NETDEVICE_SHOW_RW(flags, fmt_hex);
>>>>     static int change_tx_queue_len(struct net_device *dev, unsigned 
>>>> long new_len)
>>>>   {
>>>> -    dev->tx_queue_len = new_len;
>>>> +    int res, orig_len = dev->tx_queue_len;
>>>> +
>>>> +    if (new_len != orig_len) {
>>>> +        dev->tx_queue_len = new_len;
>>>> +        res = call_netdevice_notifiers(NETDEV_CHANGE_TX_QUEUE_LEN, 
>>>> dev);
>>>> +        res = notifier_to_errno(res);
>>>> +        if (res) {
>>>> +            netdev_err(dev,
>>>> +                   "refused to change device tx_queue_len\n");
>>>> +            dev->tx_queue_len = orig_len;
>>>> +            return -EFAULT;
>>>> +        }
>>>> +    }
>>>> +
>>>>       return 0;
>>>>   }
>>>>
>>> Acked-by: John Fastabend <john.r.fastabend@intel.com>
>>>
>>> Great timing I was just looking into this because I need it for the
>>> qdisc side.
>>>
>>> It looks like this covers the sysfs change but the tx_queue_len can
>>> also be changed via rtnetlink as well. So we need another patch for
>>> that path right?
>>>
>>>          if (tb[IFLA_TXQLEN]) {
>>>                  unsigned long value = nla_get_u32(tb[IFLA_TXQLEN]);
>>>
>>>                  if (dev->tx_queue_len ^ value)
>>>                          status |= DO_SETLINK_NOTIFY;
>>>
>>>                  dev->tx_queue_len = value;
>>>          }
>>>
>>> Thanks,
>>> John
>>>
>>
>> Right, will do this in next version.
>>
>> Thanks
>
> Ok, since Michael has acked on the series, will prepare a patch on top.
>
> Thanks 

Since kbuild test robot has found a minor issue on this series, I will 
post v4 with this fixed.

Thanks
_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

  reply	other threads:[~2016-06-30  6:43 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-30  3:52 [PATCH net-next V3 0/6] switch to use tx skb array in tun Jason Wang
2016-06-30  3:52 ` [PATCH net-next V3 1/6] ptr_ring: support zero length ring Jason Wang
2016-06-30  3:52 ` [PATCH net-next V3 2/6] skb_array: minor tweak Jason Wang
2016-06-30  3:52 ` [PATCH net-next V3 3/6] ptr_ring: support resizing multiple queues Jason Wang
2016-06-30  3:52 ` [PATCH net-next V3 4/6] skb_array: add wrappers for resizing Jason Wang
2016-06-30  3:52 ` [PATCH net-next V3 5/6] net: introduce NETDEV_CHANGE_TX_QUEUE_LEN Jason Wang
2016-06-30  4:56   ` John Fastabend
2016-06-30  5:12     ` Jason Wang
2016-06-30  5:59       ` Jason Wang
2016-06-30  6:43         ` Jason Wang [this message]
2016-06-30  3:52 ` [PATCH net-next V3 6/6] tun: switch to use skb array for tx Jason Wang
2016-06-30  6:20   ` kbuild test robot
2016-06-30  6:20   ` [PATCH] tun: fix semicolon.cocci warnings kbuild test robot
2016-06-30  5:37 ` [PATCH net-next V3 0/6] switch to use tx skb array in tun Michael S. Tsirkin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5774BF74.9000508@redhat.com \
    --to=jasowang@redhat.com \
    --cc=brouer@redhat.com \
    --cc=davem@davemloft.net \
    --cc=eric.dumazet@gmail.com \
    --cc=john.fastabend@gmail.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mst@redhat.com \
    --cc=netdev@vger.kernel.org \
    --cc=virtualization@lists.linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).