Linux Documentation
 help / color / mirror / Atom feed
From: Simon Horman <horms@kernel.org>
To: gongfan1@huawei.com
Cc: Simon Horman <horms@kernel.org>,
	wudi234@huawei.com, tengpeisen@huawei.com,
	netdev@vger.kernel.org, davem@davemloft.net, edumazet@google.com,
	kuba@kernel.org, pabeni@redhat.com, andrew+netdev@lunn.ch,
	ioana.ciornei@nxp.com, mohsin.bashr@gmail.com,
	linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org,
	luosifu@huawei.com, guoxin09@huawei.com, zhoushuai28@huawei.com,
	wulike1@huawei.com, shijing34@huawei.com,
	zhengjiezhen@h-partners.com, maxime.chevallier@bootlin.com
Subject: Re: [PATCH net-next v09 4/5] hinic3: Add ethtool rss ops
Date: Fri, 12 Jun 2026 17:08:18 +0100	[thread overview]
Message-ID: <20260612160818.690620-1-horms@kernel.org> (raw)
In-Reply-To: <7d1a4375fdf7c3e7a5a6162382cee4f48991d5da.1781062575.git.wudi234@huawei.com>

This is an AI-generated review of your patch. The human sending this
email has considered the AI review valid, or at least plausible.
Full review at: https://sashiko.dev
---
hinic3: Add ethtool rss ops

This commit implements ethtool callback functions for the hinic3 driver.
These callbacks allow users to utilize ethtool for detailed RSS parameters
configuration and monitoring.

> --- a/drivers/net/ethernet/huawei/hinic3/hinic3_rss.c
> +++ b/drivers/net/ethernet/huawei/hinic3/hinic3_rss.c

[ ... ]

> +int hinic3_set_channels(struct net_device *netdev,
> +			struct ethtool_channels *channels)
> +{
[ ... ]
> +	if (netif_running(netdev)) {
> +		q_params = nic_dev->q_params;
> +		q_params.num_qps = (u16)count;
> +		q_params.txqs_res = NULL;
> +		q_params.rxqs_res = NULL;
> +		q_params.irq_cfg = NULL;
> +
> +		err = hinic3_change_channel_settings(netdev, &q_params);
> +		if (err) {
> +			netdev_err(netdev, "Failed to change channel settings\n");
> +			return err;
> +		}
> +	} else {
> +		nic_dev->q_params.num_qps = (u16)count;
> +	}
> +
> +	err = hinic3_rss_update_num_qps_and_reprogram(netdev);
> +	if (err)
> +		return err;

[Severity: Medium]
If hinic3_rss_update_num_qps_and_reprogram() fails, the error code is
returned to the caller, but the queue changes made earlier by
hinic3_change_channel_settings() remain active. Is it expected that a failure
leaves the newly requested channel configuration running?

[ ... ]

> +static int hinic3_set_rss_rxfh(struct net_device *netdev,
> +			       const u32 *indir, u8 *key)
> +{
[ ... ]
> +	if (indir) {
> +		for (i = 0; i < L2NIC_RSS_INDIR_SIZE; i++)
> +			temp_indir[i] = (u16)indir[i];
> +
> +		err = hinic3_rss_set_indir_tbl(nic_dev->hwdev, temp_indir);
> +		if (err) {
> +			netdev_err(netdev, "Failed to set rss indir table\n");
> +			return err;
> +		}
> +
> +		memcpy(nic_dev->rss_indir, temp_indir, L2NIC_RSS_INDIR_SIZE);

[Severity: High]
Does this copy the entire indirection table? Since temp_indir is an array
of u16 elements, copying L2NIC_RSS_INDIR_SIZE bytes instead of
L2NIC_RSS_INDIR_SIZE * sizeof(u16) will only update the first half of the
nic_dev->rss_indir array.

[ ... ]

> +static int hinic3_rss_get_indir_tbl(struct hinic3_hwdev *hwdev,
> +				    u32 *indir_table)
> +{
[ ... ]
> +	err = hinic3_cmdq_detail_resp(hwdev, MGMT_MOD_L2NIC,
> +				      L2NIC_UCODE_CMD_GET_RSS_INDIR_TBL,
> +				      pair.in, pair.out, NULL);
> +	if (err) {
> +		dev_err(hwdev->dev, "Failed to get rss indir table\n");
> +		goto err_get_indir_tbl;
> +	}
> +
> +	indir_tbl = (__force __le16 *)pair.out->buf;
> +	for (i = 0; i < L2NIC_RSS_INDIR_SIZE; i++)
> +		indir_table[i] = le16_to_cpu(*(indir_tbl + i));

[Severity: High]
Should the response buffer words be swabbed using hinic3_cmdq_buf_swab32()
before reading, similar to how it is handled in the set operation? Also,
does the data start immediately at offset 0, or is there a 16-byte
reserved prefix like the one defined in struct l2nic_cmd_rss_set_indir_tbl
that needs to be skipped?

[ ... ]

> +static int hinic3_update_hash_func_type(struct net_device *netdev, u8 hfunc)
> +{
> +	struct hinic3_nic_dev *nic_dev = netdev_priv(netdev);
> +	enum hinic3_rss_hash_type new_rss_hash_type;
> +	int err;
[ ... ]
> +	if (new_rss_hash_type == nic_dev->rss_hash_type)
> +		return 0;
> +
> +	err = hinic3_rss_set_hash_type(nic_dev->hwdev, nic_dev->rss_hash_type);

[Severity: Medium]
Will this push the old hash type to the hardware instead of the newly
requested one? It passes nic_dev->rss_hash_type rather than
new_rss_hash_type.

> +	if (err) {
> +		netdev_err(netdev, "Failed to set RSS hash type to HW\n");
> +		return err;
> +	}
> +
> +	nic_dev->rss_hash_type = new_rss_hash_type;
> +
> +	return 0;
> +}

  parent reply	other threads:[~2026-06-12 16:08 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-10  6:59 [PATCH net-next v09 0/5] net: hinic3: PF initialization Fan Gong
2026-06-10  6:59 ` [PATCH net-next v09 1/5] hinic3: Add ethtool queue ops Fan Gong
2026-06-10 20:21   ` Dimitri Daskalakis
2026-06-12 16:06   ` Simon Horman
2026-06-10  6:59 ` [PATCH net-next v09 2/5] hinic3: Add ethtool statistic ops Fan Gong
2026-06-12 16:07   ` Simon Horman
2026-06-10  6:59 ` [PATCH net-next v09 3/5] hinic3: Add ethtool coalesce ops Fan Gong
2026-06-12 16:08   ` Simon Horman
2026-06-10  6:59 ` [PATCH net-next v09 4/5] hinic3: Add ethtool rss ops Fan Gong
2026-06-10 20:41   ` Dimitri Daskalakis
2026-06-12 16:08   ` Simon Horman [this message]
2026-06-10  6:59 ` [PATCH net-next v09 5/5] hinic3: Remove unneeded coalesce parameters Fan Gong

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=20260612160818.690620-1-horms@kernel.org \
    --to=horms@kernel.org \
    --cc=andrew+netdev@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=gongfan1@huawei.com \
    --cc=guoxin09@huawei.com \
    --cc=ioana.ciornei@nxp.com \
    --cc=kuba@kernel.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luosifu@huawei.com \
    --cc=maxime.chevallier@bootlin.com \
    --cc=mohsin.bashr@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=shijing34@huawei.com \
    --cc=tengpeisen@huawei.com \
    --cc=wudi234@huawei.com \
    --cc=wulike1@huawei.com \
    --cc=zhengjiezhen@h-partners.com \
    --cc=zhoushuai28@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