The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* [PATCH net-next v2] tun: Implement ethtool's get_channels() callback
@ 2024-02-02  7:53 Yunjian Wang
  2024-02-02  8:53 ` Jiri Pirko
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Yunjian Wang @ 2024-02-02  7:53 UTC (permalink / raw)
  To: willemdebruijn.kernel, jasowang, kuba, davem, jiri
  Cc: netdev, linux-kernel, xudingke, Yunjian Wang

Implement the tun .get_channels functionality. This feature is necessary
for some tools, such as libxdp, which need to retrieve the queue count.

Signed-off-by: Yunjian Wang <wangyunjian@huawei.com>
---
  v2: add conditional on IFF_MULTI_QUEUE
---
 drivers/net/tun.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/drivers/net/tun.c b/drivers/net/tun.c
index afa5497f7c35..0b6d25ede7fc 100644
--- a/drivers/net/tun.c
+++ b/drivers/net/tun.c
@@ -3638,12 +3638,22 @@ static int tun_set_coalesce(struct net_device *dev,
 	return 0;
 }
 
+static void tun_get_channels(struct net_device *dev,
+			     struct ethtool_channels *channels)
+{
+	struct tun_struct *tun = netdev_priv(dev);
+
+	channels->combined_count = tun->numqueues;
+	channels->max_combined = tun->flags & IFF_MULTI_QUEUE ? MAX_TAP_QUEUES : 1;
+}
+
 static const struct ethtool_ops tun_ethtool_ops = {
 	.supported_coalesce_params = ETHTOOL_COALESCE_RX_MAX_FRAMES,
 	.get_drvinfo	= tun_get_drvinfo,
 	.get_msglevel	= tun_get_msglevel,
 	.set_msglevel	= tun_set_msglevel,
 	.get_link	= ethtool_op_get_link,
+	.get_channels   = tun_get_channels,
 	.get_ts_info	= ethtool_op_get_ts_info,
 	.get_coalesce   = tun_get_coalesce,
 	.set_coalesce   = tun_set_coalesce,
-- 
2.33.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH net-next v2] tun: Implement ethtool's get_channels() callback
  2024-02-02  7:53 [PATCH net-next v2] tun: Implement ethtool's get_channels() callback Yunjian Wang
@ 2024-02-02  8:53 ` Jiri Pirko
  2024-02-02 14:59 ` Willem de Bruijn
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Jiri Pirko @ 2024-02-02  8:53 UTC (permalink / raw)
  To: Yunjian Wang
  Cc: willemdebruijn.kernel, jasowang, kuba, davem, netdev,
	linux-kernel, xudingke

Fri, Feb 02, 2024 at 08:53:20AM CET, wangyunjian@huawei.com wrote:
>Implement the tun .get_channels functionality. This feature is necessary
>for some tools, such as libxdp, which need to retrieve the queue count.
>
>Signed-off-by: Yunjian Wang <wangyunjian@huawei.com>

Reviewed-by: Jiri Pirko <jiri@nvidia.com>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH net-next v2] tun: Implement ethtool's get_channels() callback
  2024-02-02  7:53 [PATCH net-next v2] tun: Implement ethtool's get_channels() callback Yunjian Wang
  2024-02-02  8:53 ` Jiri Pirko
@ 2024-02-02 14:59 ` Willem de Bruijn
  2024-02-04  1:27 ` Jason Wang
  2024-02-04 15:50 ` patchwork-bot+netdevbpf
  3 siblings, 0 replies; 5+ messages in thread
From: Willem de Bruijn @ 2024-02-02 14:59 UTC (permalink / raw)
  To: Yunjian Wang, willemdebruijn.kernel, jasowang, kuba, davem, jiri
  Cc: netdev, linux-kernel, xudingke, Yunjian Wang

Yunjian Wang wrote:
> Implement the tun .get_channels functionality. This feature is necessary
> for some tools, such as libxdp, which need to retrieve the queue count.
> 
> Signed-off-by: Yunjian Wang <wangyunjian@huawei.com>

Reviewed-by: Willem de Bruijn <willemb@google.com>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH net-next v2] tun: Implement ethtool's get_channels() callback
  2024-02-02  7:53 [PATCH net-next v2] tun: Implement ethtool's get_channels() callback Yunjian Wang
  2024-02-02  8:53 ` Jiri Pirko
  2024-02-02 14:59 ` Willem de Bruijn
@ 2024-02-04  1:27 ` Jason Wang
  2024-02-04 15:50 ` patchwork-bot+netdevbpf
  3 siblings, 0 replies; 5+ messages in thread
From: Jason Wang @ 2024-02-04  1:27 UTC (permalink / raw)
  To: Yunjian Wang
  Cc: willemdebruijn.kernel, kuba, davem, jiri, netdev, linux-kernel,
	xudingke

On Fri, Feb 2, 2024 at 3:53 PM Yunjian Wang <wangyunjian@huawei.com> wrote:
>
> Implement the tun .get_channels functionality. This feature is necessary
> for some tools, such as libxdp, which need to retrieve the queue count.
>
> Signed-off-by: Yunjian Wang <wangyunjian@huawei.com>
> ---
>   v2: add conditional on IFF_MULTI_QUEUE
> ---
>  drivers/net/tun.c | 10 ++++++++++
>  1 file changed, 10 insertions(+)

Acked-by: Jason Wang <jasowang@redhat.com>

Thanks


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH net-next v2] tun: Implement ethtool's get_channels() callback
  2024-02-02  7:53 [PATCH net-next v2] tun: Implement ethtool's get_channels() callback Yunjian Wang
                   ` (2 preceding siblings ...)
  2024-02-04  1:27 ` Jason Wang
@ 2024-02-04 15:50 ` patchwork-bot+netdevbpf
  3 siblings, 0 replies; 5+ messages in thread
From: patchwork-bot+netdevbpf @ 2024-02-04 15:50 UTC (permalink / raw)
  To: Yunjian Wang
  Cc: willemdebruijn.kernel, jasowang, kuba, davem, jiri, netdev,
	linux-kernel, xudingke

Hello:

This patch was applied to netdev/net-next.git (main)
by David S. Miller <davem@davemloft.net>:

On Fri, 2 Feb 2024 15:53:20 +0800 you wrote:
> Implement the tun .get_channels functionality. This feature is necessary
> for some tools, such as libxdp, which need to retrieve the queue count.
> 
> Signed-off-by: Yunjian Wang <wangyunjian@huawei.com>
> ---
>   v2: add conditional on IFF_MULTI_QUEUE
> 
> [...]

Here is the summary with links:
  - [net-next,v2] tun: Implement ethtool's get_channels() callback
    https://git.kernel.org/netdev/net-next/c/45a96c407eb1

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2024-02-04 15:50 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-02-02  7:53 [PATCH net-next v2] tun: Implement ethtool's get_channels() callback Yunjian Wang
2024-02-02  8:53 ` Jiri Pirko
2024-02-02 14:59 ` Willem de Bruijn
2024-02-04  1:27 ` Jason Wang
2024-02-04 15:50 ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox