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:	Mon, 21 Dec 2015 20:03:55 +0000
From:	"Liang, Kan" <kan.liang@...el.com>
To:	Ben Hutchings <ben@...adent.org.uk>,
	"netdev@...r.kernel.org" <netdev@...r.kernel.org>,
	"davem@...emloft.net" <davem@...emloft.net>,
	"bwh@...nel.org" <bwh@...nel.org>
CC:	"Brandeburg, Jesse" <jesse.brandeburg@...el.com>,
	"andi@...stfloor.org" <andi@...stfloor.org>,
	"f.fainelli@...il.com" <f.fainelli@...il.com>,
	"alexander.duyck@...il.com" <alexander.duyck@...il.com>,
	"Kirsher, Jeffrey T" <jeffrey.t.kirsher@...el.com>,
	"Nelson, Shannon" <shannon.nelson@...el.com>,
	"Wyborny, Carolyn" <carolyn.wyborny@...el.com>,
	"Skidmore, Donald C" <donald.c.skidmore@...el.com>,
	"Williams, Mitch A" <mitch.a.williams@...el.com>,
	"ogerlitz@...lanox.com" <ogerlitz@...lanox.com>,
	"edumazet@...gle.com" <edumazet@...gle.com>,
	"jiri@...lanox.com" <jiri@...lanox.com>,
	"sfeldma@...il.com" <sfeldma@...il.com>,
	"gospo@...ulusnetworks.com" <gospo@...ulusnetworks.com>,
	"sasha.levin@...cle.com" <sasha.levin@...cle.com>,
	"dsahern@...il.com" <dsahern@...il.com>,
	"tj@...nel.org" <tj@...nel.org>,
	"cascardo@...hat.com" <cascardo@...hat.com>,
	"corbet@....net" <corbet@....net>
Subject: RE: [RFC 1/5] net/ethtool: introduce a new ioctl for per queue
 setting



> > +#define MAX_QUEUE		4096
> > +#define MAX_QUEUE_MASK		(MAX_QUEUE / 64)
> > +
> > +/**
> > + * struct ethtool_per_queue_op - apply sub command to the queues in
> mask.
> > + * @cmd: ETHTOOL_PERQUEUE
> > + * @queue_mask: Mask the queues which sub command apply to
> > + * @sub_command: the sub command
> > + * @data: parameters of the command
> > + */
> > +struct ethtool_per_queue_op {
> > +	__u32	cmd;
> > +	__u64	queue_mask[MAX_QUEUE_MASK];
> > +	__u32	sub_command;
> 
> This leaves a hole in the structure on i386, which would then require
> conversion in the compat ioctl implementation.  I suggest you move the
> sub_command next to cmd.

OK. I will modify it in V2.

> 
> > +	char	data[];
> > +};
> >
> >  /* CMDs currently supported */
> >  #define ETHTOOL_GSET		0x00000001 /* Get settings. */
> > @@ -1226,6 +1242,8 @@ enum ethtool_sfeatures_retval_bits {
> >  #define ETHTOOL_GTUNABLE	0x00000048 /* Get tunable
> configuration */
> >  #define ETHTOOL_STUNABLE	0x00000049 /* Set tunable
> configuration */
> >
> > +#define ETHTOOL_PERQUEUE	0x0000004a /* Set per queue
> options */
> 
> But it will actually be used for both set and get, right?

Right.

> 
> > +
> >  /* compatibility with older code */
> >  #define SPARC_ETH_GSET		ETHTOOL_GSET
> >  #define SPARC_ETH_SSET		ETHTOOL_SSET
> > diff --git a/net/core/ethtool.c b/net/core/ethtool.c index
> > 29edf74..125fb32 100644
> > --- a/net/core/ethtool.c
> > +++ b/net/core/ethtool.c
> > @@ -1748,6 +1748,20 @@ out:
> >  	return ret;
> >  }
> >
> > +static int ethtool_set_per_queue(struct net_device *dev, void __user
> > +*useraddr) {
> > +	struct ethtool_per_queue_op per_queue_opt;
> > +
> > +	if (copy_from_user(&per_queue_opt, useraddr,
> sizeof(per_queue_opt)))
> > +		return -EFAULT;
> > +
> > +	switch (per_queue_opt.sub_command) {
> > +
> > +	default:
> > +		return -EOPNOTSUPP;
> > +	};
> > +}
> > +
> >  /* The main entry point in this file.  Called from
> > net/core/dev_ioctl.c */
> >
> >  int dev_ethtool(struct net *net, struct ifreq *ifr) @@ -1991,6
> > +2005,9 @@ int dev_ethtool(struct net *net, struct ifreq *ifr)
> >  	case ETHTOOL_STUNABLE:
> >  		rc = ethtool_set_tunable(dev, useraddr);
> >  		break;
> > +	case ETHTOOL_PERQUEUE:
> > +		rc = ethtool_set_per_queue(dev, useraddr);
> > +		break;
> >  	default:
> >  		rc = -EOPNOTSUPP;
> >  	}
> 
> I think the first switch statement to determine whether the command
> requires CAP_NET_ADMIN should also handle ETHTOOL_PERQUEUE,
> checking the sub-command number.
>

OK. I will add it in V2. Only 'get' can be done by anyone.

Thanks,
Kan

 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ