From: Jakub Kicinski <kuba@kernel.org>
To: Dragos Tatulea <dtatulea@nvidia.com>
Cc: "David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Paolo Abeni <pabeni@redhat.com>, Simon Horman <horms@kernel.org>,
Andrew Lunn <andrew+netdev@lunn.ch>, Jens Axboe <axboe@kernel.dk>,
<parav@nvidia.com>, Cosmin Ratio <cratiu@nvidia.com>,
Tariq Toukan <tariqt@nvidia.com>,
Pavel Begunkov <asml.silence@gmail.com>,
Mina Almasry <almasrymina@google.com>, <netdev@vger.kernel.org>,
<linux-kernel@vger.kernel.org>, <io-uring@vger.kernel.org>
Subject: Re: [PATCH v2 net-next] net: Allow SF devices to be used for ZC DMA
Date: Mon, 14 Jul 2025 18:11:36 -0700 [thread overview]
Message-ID: <20250714181136.7fd53312@kernel.org> (raw)
In-Reply-To: <20250711092634.2733340-2-dtatulea@nvidia.com>
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
next prev parent reply other threads:[~2025-07-15 1:11 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-11 9:26 [PATCH v2 net-next] net: Allow SF devices to be used for ZC DMA Dragos Tatulea
2025-07-15 1:11 ` Jakub Kicinski [this message]
2025-07-15 4:39 ` Christoph Hellwig
2025-07-15 13:06 ` Jakub Kicinski
2025-07-16 11:14 ` Christoph Hellwig
2025-07-16 11:23 ` Parav Pandit
2025-07-21 7:00 ` Dragos Tatulea
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=20250714181136.7fd53312@kernel.org \
--to=kuba@kernel.org \
--cc=almasrymina@google.com \
--cc=andrew+netdev@lunn.ch \
--cc=asml.silence@gmail.com \
--cc=axboe@kernel.dk \
--cc=cratiu@nvidia.com \
--cc=davem@davemloft.net \
--cc=dtatulea@nvidia.com \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=io-uring@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=parav@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