netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jakub Kicinski <kuba@kernel.org>
To: Guangbin Huang <huangguangbin2@huawei.com>
Cc: <davem@davemloft.net>, <pabeni@redhat.com>, <mkubecek@suse.cz>,
	<netdev@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	<lipeng321@huawei.com>, <chenhao288@hisilicon.com>,
	<wangjie125@huawei.com>
Subject: Re: [PATCH net-next 2/3] net: ethtool: move checks before rtnl_lock() in ethnl_set_rings
Date: Fri, 8 Apr 2022 14:58:50 -0700	[thread overview]
Message-ID: <20220408145850.2c5882ec@kernel.org> (raw)
In-Reply-To: <20220408071245.40554-3-huangguangbin2@huawei.com>

On Fri, 8 Apr 2022 15:12:44 +0800 Guangbin Huang wrote:
> +	if (tb[ETHTOOL_A_RINGS_RX_BUF_LEN] &&
> +	    nla_get_u32(tb[ETHTOOL_A_RINGS_RX_BUF_LEN]) != 0 &&

I think we can drop the value checking. If attribute is present and
drivers doesn't support - reject. I don't think that would require 
any changes to existing user space but please double check.

> +	    !(ops->supported_ring_params & ETHTOOL_RING_USE_RX_BUF_LEN)) {
> +		ret = -EOPNOTSUPP;
> +		NL_SET_ERR_MSG_ATTR(info->extack,
> +				    tb[ETHTOOL_A_RINGS_RX_BUF_LEN],
> +				    "setting rx buf len not supported");
> +		goto out_dev;
> +	}
> +
> +	if (tb[ETHTOOL_A_RINGS_CQE_SIZE] &&
> +	    nla_get_u32(tb[ETHTOOL_A_RINGS_CQE_SIZE]) &&
> +	    !(ops->supported_ring_params & ETHTOOL_RING_USE_CQE_SIZE)) {
> +		ret = -EOPNOTSUPP;
> +		NL_SET_ERR_MSG_ATTR(info->extack,
> +				    tb[ETHTOOL_A_RINGS_CQE_SIZE],
> +				    "setting cqe size not supported");
> +		goto out_dev;
> +	}

  reply	other threads:[~2022-04-08 21:58 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-08  7:12 [PATCH net-next 0/3] net: ethool: add support to get/set tx push by ethtool -G/g Guangbin Huang
2022-04-08  7:12 ` [PATCH net-next 1/3] net: ethtool: extend ringparam set/get APIs for tx_push Guangbin Huang
2022-04-08 21:55   ` Jakub Kicinski
2022-04-11  7:58     ` wangjie (L)
2022-04-08  7:12 ` [PATCH net-next 2/3] net: ethtool: move checks before rtnl_lock() in ethnl_set_rings Guangbin Huang
2022-04-08 21:58   ` Jakub Kicinski [this message]
2022-04-11  8:01     ` wangjie (L)
2022-04-08  7:12 ` [PATCH net-next 3/3] net: hns3: add tx push support in hns3 ring param process Guangbin Huang

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=20220408145850.2c5882ec@kernel.org \
    --to=kuba@kernel.org \
    --cc=chenhao288@hisilicon.com \
    --cc=davem@davemloft.net \
    --cc=huangguangbin2@huawei.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lipeng321@huawei.com \
    --cc=mkubecek@suse.cz \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=wangjie125@huawei.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;
as well as URLs for NNTP newsgroup(s).