From: John Fastabend <john.r.fastabend@intel.com>
To: Tom Herbert <therbert@google.com>
Cc: Ben Hutchings <bhutchings@solarflare.com>,
"davem@davemloft.net" <davem@davemloft.net>,
"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
"eric.dumazet@gmail.com" <eric.dumazet@gmail.com>
Subject: Re: [PATCH 3/3] net: allocate tx queues in register_netdevice
Date: Mon, 18 Oct 2010 18:19:57 -0700 [thread overview]
Message-ID: <4CBCF23D.50006@intel.com> (raw)
In-Reply-To: <AANLkTinX+2aW_yDa0o=oiaxt6BJGNWjiifGCS7auz0O9@mail.gmail.com>
On 10/18/2010 5:17 PM, Tom Herbert wrote:
> On Mon, Oct 18, 2010 at 5:12 PM, John Fastabend
> <john.r.fastabend@intel.com> wrote:
>> On 10/18/2010 2:41 PM, Ben Hutchings wrote:
>>> On Mon, 2010-10-18 at 11:02 -0700, Tom Herbert wrote:
>>>> This patch introduces netif_alloc_netdev_queues which is called from
>>>> register_device instead of alloc_netdev_mq. This makes TX queue
>>>> allocation symmetric with RX allocation similarly allows drivers to
>>>> change dev->num_tx_queues after allocating netdev and before
>>>> registering it.
>>>
>>> Changing num_tx_queues is probably *not* desirable, same as for
>>> num_rx_queues.
>>>
>
> Okay, so both netif_set_real_num_rx_queues and
> netif_set_real_num_tx_queues should return -EINVAL if queue count >
> num_[tr]x_queues?
>
Yes and also if txq|rxq < 1 but it looks like this case is covered.
>>
>> Right, this will break ixgbe and other drivers that may call netif_set_real_num_{rx|tx}_queues() to increase the number of
>> queues. Returning an error code seems like a good idea though.
>>
>> John.
>>
>>> [...]
>>>> --- a/net/core/dev.c
>>>> +++ b/net/core/dev.c
>>>> @@ -1553,18 +1553,24 @@ static void dev_queue_xmit_nit(struct sk_buff *skb, struct net_device *dev)
>>>> * Routine to help set real_num_tx_queues. To avoid skbs mapped to queues
>>>> * greater then real_num_tx_queues stale skbs on the qdisc must be flushed.
>>>> */
>>>> -void netif_set_real_num_tx_queues(struct net_device *dev, unsigned int txq)
>>>> +int netif_set_real_num_tx_queues(struct net_device *dev, unsigned int txq)
>>>> {
>>>> - unsigned int real_num = dev->real_num_tx_queues;
>>>> + if (txq < 1)
>>>> + return -EINVAL;
>>>>
>>>> - if (unlikely(txq > dev->num_tx_queues))
>>>> - ;
>>>> - else if (txq > real_num)
>>>> - dev->real_num_tx_queues = txq;
>>>> - else if (txq < real_num) {
>>>> - dev->real_num_tx_queues = txq;
>>>> - qdisc_reset_all_tx_gt(dev, txq);
>>>> - }
>>>> + if (dev->reg_state == NETREG_REGISTERED) {
>>>> + ASSERT_RTNL();
>>>> +
>>>> + if (txq > dev->num_tx_queues)
>>>> + return -EINVAL;
>>>> +
>>>> + if (txq < dev->real_num_tx_queues)
>>>> + qdisc_reset_all_tx_gt(dev, txq);
>>>> + } else
>>>> + dev->num_tx_queues = txq;
>>> [...]
>>>
>>> The kernel-doc comment should be updated to reflect the locking
>>> requirement and the possibility of failure when called after
>>> registration.
>>>
>>> Ben.
>>>
>>
>>
> --
> 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
prev parent reply other threads:[~2010-10-19 1:20 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-10-18 18:02 [PATCH 3/3] net: allocate tx queues in register_netdevice Tom Herbert
2010-10-18 21:41 ` Ben Hutchings
2010-10-19 0:12 ` John Fastabend
2010-10-19 0:17 ` Tom Herbert
2010-10-19 1:19 ` John Fastabend [this message]
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=4CBCF23D.50006@intel.com \
--to=john.r.fastabend@intel.com \
--cc=bhutchings@solarflare.com \
--cc=davem@davemloft.net \
--cc=eric.dumazet@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=therbert@google.com \
/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).