Intel-Wired-Lan Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Ahmed Zaki <ahmed.zaki@intel.com>
To: Paolo Abeni <pabeni@redhat.com>, <netdev@vger.kernel.org>
Cc: <intel-wired-lan@lists.osuosl.org>, <andrew+netdev@lunn.ch>,
	<edumazet@google.com>, <kuba@kernel.org>, <horms@kernel.org>,
	<davem@davemloft.net>, <michael.chan@broadcom.com>,
	<tariqt@nvidia.com>, <anthony.l.nguyen@intel.com>,
	<przemyslaw.kitszel@intel.com>, <jdamato@fastly.com>,
	<shayd@nvidia.com>, <akpm@linux-foundation.org>,
	<shayagr@amazon.com>, <kalesh-anakkur.purayil@broadcom.com>,
	<pavan.chebbi@broadcom.com>
Subject: Re: [Intel-wired-lan] [PATCH net-next v8 3/6] net: napi: add CPU affinity to napi_config
Date: Thu, 13 Feb 2025 08:45:21 -0700	[thread overview]
Message-ID: <7dd230fb-ca58-4407-98df-03ddb2ac68a9@intel.com> (raw)
In-Reply-To: <738fed19-378f-4aa9-8d42-5c18b8ea321d@redhat.com>



On 2025-02-13 5:26 a.m., Paolo Abeni wrote:
> On 2/11/25 10:06 PM, Ahmed Zaki wrote:
>> @@ -394,10 +395,8 @@ struct napi_struct {
>>   	struct list_head	dev_list;
>>   	struct hlist_node	napi_hash_node;
>>   	int			irq;
>> -#ifdef CONFIG_RFS_ACCEL
>>   	struct irq_affinity_notify notify;
>>   	int			napi_rmap_idx;
>> -#endif
> 
> I'm sorry for the late doubt, but it's not clear to me why you need to
> add the #ifdef in the previous patch ?!?

It was there to make the code consistent, since the rmap and the 
notifier were only needed for ARFS.

It can be removed, although I am not sure if there would be any warnings 
since on !CONFIG_ARFS_ACCEL the fields would never be used.

> 
>> diff --git a/net/core/dev.c b/net/core/dev.c
>> index 209296cef3cd..d2c942bbd5e6 100644
>> --- a/net/core/dev.c
>> +++ b/net/core/dev.c
>> @@ -6871,28 +6871,39 @@ void netif_queue_set_napi(struct net_device *dev, unsigned int queue_index,
>>   }
>>   EXPORT_SYMBOL(netif_queue_set_napi);
>>   
>> -#ifdef CONFIG_RFS_ACCEL
>>   static void
>> -netif_irq_cpu_rmap_notify(struct irq_affinity_notify *notify,
>> -			  const cpumask_t *mask)
>> +netif_napi_irq_notify(struct irq_affinity_notify *notify,
>> +		      const cpumask_t *mask)
>>   {
>>   	struct napi_struct *napi =
>>   		container_of(notify, struct napi_struct, notify);
>> +#ifdef CONFIG_RFS_ACCEL
>>   	struct cpu_rmap *rmap = napi->dev->rx_cpu_rmap;
>>   	int err;
>> +#endif
>>   
>> -	err = cpu_rmap_update(rmap, napi->napi_rmap_idx, mask);
>> -	if (err)
>> -		netdev_warn(napi->dev, "RMAP update failed (%d)\n",
>> -			    err);
>> +	if (napi->config && napi->dev->irq_affinity_auto)
>> +		cpumask_copy(&napi->config->affinity_mask, mask);
>> +
>> +#ifdef CONFIG_RFS_ACCEL
>> +	if (napi->dev->rx_cpu_rmap_auto) {
>> +		err = cpu_rmap_update(rmap, napi->napi_rmap_idx, mask);
>> +		if (err)
>> +			netdev_warn(napi->dev, "RMAP update failed (%d)\n",
>> +				    err);
>> +	}
>> +#endif
> 
> Minor nit: if you provide a netif_rx_cpu_rmap() helper returning
> dev->rx_cpu_rmap or NULL for !CONFIG_RFS_ACCEL build, you can avoid the
> above 2 ifdefs and possibly more below.
> 

Thanks, I will add this if there is a new version.


>> @@ -6915,7 +6926,6 @@ static int napi_irq_cpu_rmap_add(struct napi_struct *napi, int irq)
>>   	if (rc)
>>   		goto err_set;
>>   
>> -	set_bit(NAPI_STATE_HAS_NOTIFIER, &napi->state);
> 
> Minor nit: I think it would be better if the previous patch would add
> directly this line in netif_napi_set_irq_locked() (avoding the removal
> here).
> 

yes, it just made more sense for that patch.


  reply	other threads:[~2025-02-13 15:45 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-11 21:06 [Intel-wired-lan] [PATCH net-next v8 0/6] net: napi: add CPU affinity to napi->config Ahmed Zaki
2025-02-11 21:06 ` [Intel-wired-lan] [PATCH net-next v8 1/6] ice: clear NAPI's IRQ numbers in ice_vsi_clear_napi_queues() Ahmed Zaki
2025-02-11 21:06 ` [Intel-wired-lan] [PATCH net-next v8 2/6] net: move ARFS rmap management to core Ahmed Zaki
2025-02-15 17:53   ` Jakub Kicinski
2025-02-11 21:06 ` [Intel-wired-lan] [PATCH net-next v8 3/6] net: napi: add CPU affinity to napi_config Ahmed Zaki
2025-02-13 12:26   ` Paolo Abeni
2025-02-13 15:45     ` Ahmed Zaki [this message]
2025-02-15 17:58   ` Jakub Kicinski
2025-02-11 21:06 ` [Intel-wired-lan] [PATCH net-next v8 4/6] bnxt: use napi's irq affinity Ahmed Zaki
2025-02-11 21:06 ` [Intel-wired-lan] [PATCH net-next v8 5/6] ice: " Ahmed Zaki
2025-02-11 21:06 ` [Intel-wired-lan] [PATCH net-next v8 6/6] idpf: " Ahmed Zaki
2025-02-15 17:41 ` [Intel-wired-lan] [PATCH net-next v8 0/6] net: napi: add CPU affinity to napi->config Jakub Kicinski
2025-02-15 17:43   ` Jakub Kicinski

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=7dd230fb-ca58-4407-98df-03ddb2ac68a9@intel.com \
    --to=ahmed.zaki@intel.com \
    --cc=akpm@linux-foundation.org \
    --cc=andrew+netdev@lunn.ch \
    --cc=anthony.l.nguyen@intel.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=horms@kernel.org \
    --cc=intel-wired-lan@lists.osuosl.org \
    --cc=jdamato@fastly.com \
    --cc=kalesh-anakkur.purayil@broadcom.com \
    --cc=kuba@kernel.org \
    --cc=michael.chan@broadcom.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=pavan.chebbi@broadcom.com \
    --cc=przemyslaw.kitszel@intel.com \
    --cc=shayagr@amazon.com \
    --cc=shayd@nvidia.com \
    --cc=tariqt@nvidia.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