lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Tue, 10 Oct 2023 19:17:09 -0700
From: Jakub Kicinski <kuba@...nel.org>
To: Amritha Nambiar <amritha.nambiar@...el.com>
Cc: netdev@...r.kernel.org, sridhar.samudrala@...el.com
Subject: Re: [net-next PATCH v4 02/10] net: Add queue and napi association

On Fri, 06 Oct 2023 02:14:48 -0700 Amritha Nambiar wrote:
>  #endif
> +	/* NAPI instance for the queue */
> +	struct napi_struct		*napi;

What's the protection on this field?
Writers and readers must be under rtnl_lock?

>  } ____cacheline_aligned_in_smp;
>  
>  /*
> diff --git a/net/core/dev.c b/net/core/dev.c
> index 606a366cc209..9b63a7b76c01 100644
> --- a/net/core/dev.c
> +++ b/net/core/dev.c
> @@ -6394,6 +6394,40 @@ int dev_set_threaded(struct net_device *dev, bool threaded)
>  }
>  EXPORT_SYMBOL(dev_set_threaded);
>  
> +/**
> + * netif_queue_set_napi - Associate queue with the napi
> + * @queue_index: Index of queue
> + * @type: queue type as RX or TX
> + * @napi: NAPI context
> + *
> + * Set queue with its corresponding napi context

Let's add more relevant info, like the fact that NAPI must already be
added before calling, calling context, etc.

> + */
> +int netif_queue_set_napi(unsigned int queue_index, enum netdev_queue_type type,
> +			 struct napi_struct *napi)

Let's make this helper void.
It will be a PITA for callers to handle any error this may return.

> +{
> +	struct net_device *dev = napi->dev;
> +	struct netdev_rx_queue *rxq;
> +	struct netdev_queue *txq;
> +
> +	if (!dev)
> +		return -EINVAL;

	if (WARN_ON_ONCE(...))
		return;

> +	default:
> +		return -EINVAL;
> +	}

same here

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ