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]
Message-ID: <20250714181136.7fd53312@kernel.org>
Date: Mon, 14 Jul 2025 18:11:36 -0700
From: Jakub Kicinski <kuba@...nel.org>
To: Dragos Tatulea <dtatulea@...dia.com>
Cc: "David S. Miller" <davem@...emloft.net>, Eric Dumazet
 <edumazet@...gle.com>, Paolo Abeni <pabeni@...hat.com>, Simon Horman
 <horms@...nel.org>, Andrew Lunn <andrew+netdev@...n.ch>, Jens Axboe
 <axboe@...nel.dk>, <parav@...dia.com>, Cosmin Ratio <cratiu@...dia.com>,
 Tariq Toukan <tariqt@...dia.com>, Pavel Begunkov <asml.silence@...il.com>,
 Mina Almasry <almasrymina@...gle.com>, <netdev@...r.kernel.org>,
 <linux-kernel@...r.kernel.org>, <io-uring@...r.kernel.org>
Subject: Re: [PATCH v2 net-next] net: Allow SF devices to be used for ZC DMA

On Fri, 11 Jul 2025 09:26:34 +0000 Dragos Tatulea wrote:
> diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
> index 5847c20994d3..53aa63d6e5a3 100644
> --- a/include/linux/netdevice.h
> +++ b/include/linux/netdevice.h
> @@ -5560,4 +5560,25 @@ extern struct net_device *blackhole_netdev;
>  		atomic_long_add((VAL), &(DEV)->stats.__##FIELD)
>  #define DEV_STATS_READ(DEV, FIELD) atomic_long_read(&(DEV)->stats.__##FIELD)
>  
> +static inline struct device *netdev_get_dma_dev(const struct net_device *dev)
> +{
> +	struct device *dma_dev = dev->dev.parent;
> +
> +	if (!dma_dev)
> +		return NULL;
> +
> +	/* Common case: dma device is parent device of netdev. */
> +	if (dma_dev->dma_mask)
> +		return dma_dev;
> +
> +	/* SF netdevs have an auxdev device as parent, the dma device being the
> +	 * grandparent.
> +	 */
> +	dma_dev = dma_dev->parent;
> +	if (dma_dev && dma_dev->dma_mask)
> +		return dma_dev;
> +
> +	return NULL;
> +}

LGTM, but we need a better place for this function. netdevice.h is
included directly by 1.5k files, and indirectly by probably another 5k.
It's not a great place to put random helpers with 2 callers. 
Maybe net/netdev_rx_queue.h and net/core/netdev_rx_queue.c?
I don't think it needs to be a static inline either.
-- 
pw-bot: cr

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ