linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Michal Kubecek <mkubecek@suse.cz>
To: netdev@vger.kernel.org
Cc: Andrew Lunn <andrew@lunn.ch>, David Miller <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>, Jiri Pirko <jiri@resnulli.us>,
	Florian Fainelli <f.fainelli@gmail.com>,
	John Linville <linville@tuxdriver.com>,
	Johannes Berg <johannes@sipsolutions.net>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH net-next 3/7] ethtool: set message mask with DEBUG_SET request
Date: Mon, 27 Jan 2020 07:23:17 +0100	[thread overview]
Message-ID: <20200127062317.GB570@unicorn.suse.cz> (raw)
In-Reply-To: <20200127002206.GC12816@lunn.ch>

On Mon, Jan 27, 2020 at 01:22:06AM +0100, Andrew Lunn wrote:
> On Sun, Jan 26, 2020 at 11:11:07PM +0100, Michal Kubecek wrote:
> > Implement DEBUG_SET netlink request to set debugging settings for a device.
> > At the moment, only message mask corresponding to message level as set by
> > ETHTOOL_SMSGLVL ioctl request can be set. (It is called message level in
> > ioctl interface but almost all drivers interpret it as a bit mask.)
> > 
> > Signed-off-by: Michal Kubecek <mkubecek@suse.cz>
> > +int ethnl_set_debug(struct sk_buff *skb, struct genl_info *info)
> > +{
> > +	struct nlattr *tb[ETHTOOL_A_DEBUG_MAX + 1];
> > +	struct ethnl_req_info req_info = {};
> > +	struct net_device *dev;
> > +	bool mod = false;
> > +	u32 msg_mask;
> > +	int ret;
> > +
> > +	ret = nlmsg_parse(info->nlhdr, GENL_HDRLEN, tb,
> > +			  ETHTOOL_A_DEBUG_MAX, debug_set_policy,
> > +			  info->extack);
> > +	if (ret < 0)
> > +		return ret;
> > +	ret = ethnl_parse_header(&req_info, tb[ETHTOOL_A_DEBUG_HEADER],
> > +				 genl_info_net(info), info->extack, true);
> > +	if (ret < 0)
> > +		return ret;
> > +	dev = req_info.dev;
> > +	if (!dev->ethtool_ops->get_msglevel || !dev->ethtool_ops->set_msglevel)
> > +		return -EOPNOTSUPP;
> 
> This seems like a new requirement, that both get and set callbacks are
> implemented. However, A quick look thought the code suggests all
> drivers already do have both get and set. So i think this is safe.

Technically it's a new requirement but as ethtool (userspace utility)
always issues ETHTOOL_GMSGLVL before ETHTOOL_SMSGLVL and does so even
for command lines like "ethtool -s eth0 msglvl 5" where it's not really
needed, providing ->set_msglevel() without ->get_msglevel() wouldn't
be of much use even now.

Michal

> 
> Reviewed-by: Andrew Lunn <andrew@lunn.ch>
> 
>     Andrew

  reply	other threads:[~2020-01-27  6:23 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-26 22:10 [PATCH net-next 0/7] ethtool netlink interface, part 2 Michal Kubecek
2020-01-26 22:11 ` [PATCH net-next 1/7] ethtool: fix kernel-doc descriptions Michal Kubecek
2020-01-26 22:11 ` [PATCH net-next 2/7] ethtool: provide message mask with DEBUG_GET request Michal Kubecek
2020-01-26 23:52   ` Andrew Lunn
2020-01-26 22:11 ` [PATCH net-next 3/7] ethtool: set message mask with DEBUG_SET request Michal Kubecek
2020-01-27  0:22   ` Andrew Lunn
2020-01-27  6:23     ` Michal Kubecek [this message]
2020-01-27  1:04   ` Andrew Lunn
2020-01-27  6:24     ` Michal Kubecek
2020-01-26 22:11 ` [PATCH net-next 4/7] ethtool: add DEBUG_NTF notification Michal Kubecek
2020-01-27  1:17   ` Andrew Lunn
2020-01-26 22:11 ` [PATCH net-next 5/7] ethtool: provide WoL settings with WOL_GET request Michal Kubecek
2020-01-27  2:11   ` Andrew Lunn
2020-01-26 22:11 ` [PATCH net-next 6/7] ethtool: set wake-on-lan settings with WOL_SET request Michal Kubecek
2020-01-26 22:11 ` [PATCH net-next 7/7] ethtool: add WOL_NTF notification Michal Kubecek
2020-01-26 23:34 ` [PATCH net-next 0/7] ethtool netlink interface, part 2 Andrew Lunn
2020-01-27  7:30   ` Michal Kubecek
2020-01-27  9:40 ` David Miller
2020-01-27  9:57   ` Michal Kubecek
2020-01-27 10:27     ` David Miller
2020-01-27 10:32     ` David Miller
2020-01-27 13:45       ` Andrew Lunn

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=20200127062317.GB570@unicorn.suse.cz \
    --to=mkubecek@suse.cz \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=f.fainelli@gmail.com \
    --cc=jiri@resnulli.us \
    --cc=johannes@sipsolutions.net \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linville@tuxdriver.com \
    --cc=netdev@vger.kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).