[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <fefa92f9-7981-c705-529b-992d712c413c@intel.com>
Date: Wed, 12 Jul 2023 12:53:34 -0700
From: "Nambiar, Amritha" <amritha.nambiar@...el.com>
To: Simon Horman <simon.horman@...igine.com>
CC: <netdev@...r.kernel.org>, <kuba@...nel.org>, <davem@...emloft.net>,
<sridhar.samudrala@...el.com>
Subject: Re: [net-next/RFC PATCH v1 2/4] net: Add support for associating napi
with queue[s]
On 6/2/2023 8:42 AM, Simon Horman wrote:
> On Thu, Jun 01, 2023 at 10:42:30AM -0700, Amritha Nambiar wrote:
>> After the napi context is initialized, map the napi instance
>> with the queue/queue-set on the corresponding irq line.
>>
>> Signed-off-by: Amritha Nambiar <amritha.nambiar@...el.com>
>
> Hi Amritha,
>
> some minor feedback from my side.
>
> ...
>
>> diff --git a/net/core/dev.c b/net/core/dev.c
>> index 9ee8eb3ef223..ba712119ec85 100644
>> --- a/net/core/dev.c
>> +++ b/net/core/dev.c
>> @@ -6366,6 +6366,40 @@ int dev_set_threaded(struct net_device *dev, bool threaded)
>> }
>> EXPORT_SYMBOL(dev_set_threaded);
>>
>> +/**
>> + * netif_napi_add_queue - Associate queue with the napi
>> + * @napi: NAPI context
>> + * @queue_index: Index of queue
>> + * @napi_container_type: queue type as RX or TX
>
> s/@...i_container_type:/@...e:/
>
Will fix.
>> + *
>> + * Add queue with its corresponding napi context
>> + */
>> +int netif_napi_add_queue(struct napi_struct *napi, u16 queue_index,
>> + enum napi_container_type type)
>> +{
>> + struct napi_queue *napi_queue;
>> +
>> + napi_queue = kzalloc(sizeof(*napi_queue), GFP_KERNEL);
>> + if (!napi_queue)
>> + return -ENOMEM;
>> +
>> + napi_queue->queue_index = queue_index;
>> +
>> + switch (type) {
>> + case NAPI_RX_CONTAINER:
>> + list_add_rcu(&napi_queue->q_list, &napi->napi_rxq_list);
>> + break;
>> + case NAPI_TX_CONTAINER:
>> + list_add_rcu(&napi_queue->q_list, &napi->napi_txq_list);
>> + break;
>> + default:
>
> Perhaps napi_queue is leaked here.
>
My bad. Will fix in the next version.
>> + return -EINVAL;
>> + }
>> +
>> + return 0;
>> +}
>> +EXPORT_SYMBOL(netif_napi_add_queue);
>> +
>> void netif_napi_add_weight(struct net_device *dev, struct napi_struct *napi,
>> int (*poll)(struct napi_struct *, int), int weight)
>> {
>>
>>
Powered by blists - more mailing lists