[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220408145850.2c5882ec@kernel.org>
Date: Fri, 8 Apr 2022 14:58:50 -0700
From: Jakub Kicinski <kuba@...nel.org>
To: Guangbin Huang <huangguangbin2@...wei.com>
Cc: <davem@...emloft.net>, <pabeni@...hat.com>, <mkubecek@...e.cz>,
<netdev@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
<lipeng321@...wei.com>, <chenhao288@...ilicon.com>,
<wangjie125@...wei.com>
Subject: Re: [PATCH net-next 2/3] net: ethtool: move checks before
rtnl_lock() in ethnl_set_rings
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;
> + }
Powered by blists - more mailing lists