Netdev List
 help / color / mirror / Atom feed
* [PATCH net v2] hinic: remove unused ethtool RSS user configuration buffers
@ 2026-07-22  2:53 Chenguang Zhao
  2026-07-22 12:09 ` Joe Damato
  0 siblings, 1 reply; 2+ messages in thread
From: Chenguang Zhao @ 2026-07-22  2:53 UTC (permalink / raw)
  To: cai.huoqing, andrew+netdev, davem, edumazet, kuba, pabeni
  Cc: netdev, chenguang.zhao, Chenguang Zhao

From: Chenguang Zhao <zhaochenguang@kylinos.cn>

rss_indir_user and rss_hkey_user are allocated and filled in
__set_rss_rxfh() when the user configures RSS via ethtool, but
nothing ever reads them. hinic_get_rxfh() fetches the state from
the device, and the hardware is programmed from the original
indir/key arguments. These buffers only leaked on driver unload.

Drop the unused allocations, memcpys, and struct fields.

Fixes: 4fdc51bb4e92 ("hinic: add support for rss parameters with ethtool")
Signed-off-by: Chenguang Zhao <zhaochenguang@kylinos.cn>
---
v2:
 - Remove buffer allocation operations as suggested by Joe.

v1:
 - https://lore.kernel.org/all/20260720091102.1653378-1-chenguang.zhao@linux.dev/

 drivers/net/ethernet/huawei/hinic/hinic_dev.h |  2 --
 .../net/ethernet/huawei/hinic/hinic_ethtool.c | 21 -------------------
 2 files changed, 23 deletions(-)

diff --git a/drivers/net/ethernet/huawei/hinic/hinic_dev.h b/drivers/net/ethernet/huawei/hinic/hinic_dev.h
index 52ea97c818b8..d9ab94910a2a 100644
--- a/drivers/net/ethernet/huawei/hinic/hinic_dev.h
+++ b/drivers/net/ethernet/huawei/hinic/hinic_dev.h
@@ -104,8 +104,6 @@ struct hinic_dev {
 	u16				num_rss;
 	u16				rss_limit;
 	struct hinic_rss_type		rss_type;
-	u8				*rss_hkey_user;
-	s32				*rss_indir_user;
 	struct hinic_intr_coal_info	*rx_intr_coalesce;
 	struct hinic_intr_coal_info	*tx_intr_coalesce;
 	struct hinic_sriov_info sriov_info;
diff --git a/drivers/net/ethernet/huawei/hinic/hinic_ethtool.c b/drivers/net/ethernet/huawei/hinic/hinic_ethtool.c
index a8b129ce1b7e..f75e8563f23a 100644
--- a/drivers/net/ethernet/huawei/hinic/hinic_ethtool.c
+++ b/drivers/net/ethernet/huawei/hinic/hinic_ethtool.c
@@ -1064,17 +1064,6 @@ static int __set_rss_rxfh(struct net_device *netdev,
 	int err;
 
 	if (indir) {
-		if (!nic_dev->rss_indir_user) {
-			nic_dev->rss_indir_user =
-				kzalloc(sizeof(u32) * HINIC_RSS_INDIR_SIZE,
-					GFP_KERNEL);
-			if (!nic_dev->rss_indir_user)
-				return -ENOMEM;
-		}
-
-		memcpy(nic_dev->rss_indir_user, indir,
-		       sizeof(u32) * HINIC_RSS_INDIR_SIZE);
-
 		err = hinic_rss_set_indir_tbl(nic_dev,
 					      nic_dev->rss_tmpl_idx, indir);
 		if (err)
@@ -1082,16 +1071,6 @@ static int __set_rss_rxfh(struct net_device *netdev,
 	}
 
 	if (key) {
-		if (!nic_dev->rss_hkey_user) {
-			nic_dev->rss_hkey_user =
-				kzalloc(HINIC_RSS_KEY_SIZE * 2, GFP_KERNEL);
-
-			if (!nic_dev->rss_hkey_user)
-				return -ENOMEM;
-		}
-
-		memcpy(nic_dev->rss_hkey_user, key, HINIC_RSS_KEY_SIZE);
-
 		err = hinic_rss_set_template_tbl(nic_dev,
 						 nic_dev->rss_tmpl_idx, key);
 		if (err)
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH net v2] hinic: remove unused ethtool RSS user configuration buffers
  2026-07-22  2:53 [PATCH net v2] hinic: remove unused ethtool RSS user configuration buffers Chenguang Zhao
@ 2026-07-22 12:09 ` Joe Damato
  0 siblings, 0 replies; 2+ messages in thread
From: Joe Damato @ 2026-07-22 12:09 UTC (permalink / raw)
  To: Chenguang Zhao
  Cc: cai.huoqing, andrew+netdev, davem, edumazet, kuba, pabeni, netdev,
	Chenguang Zhao

On Wed, Jul 22, 2026 at 10:53:53AM +0800, Chenguang Zhao wrote:
> From: Chenguang Zhao <zhaochenguang@kylinos.cn>
> 
> rss_indir_user and rss_hkey_user are allocated and filled in
> __set_rss_rxfh() when the user configures RSS via ethtool, but
> nothing ever reads them. hinic_get_rxfh() fetches the state from
> the device, and the hardware is programmed from the original
> indir/key arguments. These buffers only leaked on driver unload.
> 
> Drop the unused allocations, memcpys, and struct fields.
> 
> Fixes: 4fdc51bb4e92 ("hinic: add support for rss parameters with ethtool")

I like this approach a lot better, thanks for re-sending it with the
unnecessary fields and copies removed.

Reviewed-by: Joe Damato <joe@dama.to>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-07-22 12:09 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-22  2:53 [PATCH net v2] hinic: remove unused ethtool RSS user configuration buffers Chenguang Zhao
2026-07-22 12:09 ` Joe Damato

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox