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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date: Fri, 2 Feb 2024 02:03:06 +0000
From: wangyunjian <wangyunjian@...wei.com>
To: Willem de Bruijn <willemdebruijn.kernel@...il.com>, "jasowang@...hat.com"
	<jasowang@...hat.com>, "kuba@...nel.org" <kuba@...nel.org>,
	"davem@...emloft.net" <davem@...emloft.net>
CC: "netdev@...r.kernel.org" <netdev@...r.kernel.org>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>, xudingke
	<xudingke@...wei.com>
Subject: RE: [PATCH net-next] tun: Implement ethtool's get_channels() callback

> -----Original Message-----
> From: Willem de Bruijn [mailto:willemdebruijn.kernel@...il.com]
> Sent: Thursday, February 1, 2024 11:43 PM
> To: wangyunjian <wangyunjian@...wei.com>;
> willemdebruijn.kernel@...il.com; jasowang@...hat.com; kuba@...nel.org;
> davem@...emloft.net
> Cc: netdev@...r.kernel.org; linux-kernel@...r.kernel.org; xudingke
> <xudingke@...wei.com>; wangyunjian <wangyunjian@...wei.com>
> Subject: Re: [PATCH net-next] tun: Implement ethtool's get_channels() callback
> 
> 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@...wei.com>
> > ---
> >  drivers/net/tun.c | 10 ++++++++++
> >  1 file changed, 10 insertions(+)
> >
> > diff --git a/drivers/net/tun.c b/drivers/net/tun.c index
> > afa5497f7c35..7cf448ff93ee 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 = MAX_TAP_QUEUES;
> 
> Conditional on IFF_MULTI_QUEUE?

OK, like this?
   channels->combined_count = tun->numqueues;
   channels->max_combined = tun->flags & IFF_MULTI_QUEUE ? MAX_TAP_QUEUES : 1;

Thanks

> 
> > +}
> > +
> >  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
> >
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ