Skip to content

Commit 65e3609

Browse files
committed
net: ethtool: fix ethtool_ringparam_get_cfg() returns a hds_thresh value always as 0.
JIRA: https://issues.redhat.com/browse/RHEL-75603 commit 216a61d Author: Taehee Yoo <ap420073@gmail.com> Date: Fri Apr 4 12:21:25 2025 +0000 net: ethtool: fix ethtool_ringparam_get_cfg() returns a hds_thresh value always as 0. When hds-thresh is configured, ethnl_set_rings() is called, and it calls ethtool_ringparam_get_cfg() to get ringparameters from .get_ringparam() callback and dev->cfg. Both hds_config and hds_thresh values should be set from dev->cfg, not from .get_ringparam(). But ethtool_ringparam_get_cfg() sets only hds_config from dev->cfg. So, ethtool_ringparam_get_cfg() returns always a hds_thresh as 0. If an input value of hds-thresh is 0, a hds_thresh value from ethtool_ringparam_get_cfg() are same. So ethnl_set_rings() does nothing and returns immediately. It causes a bug that setting a hds-thresh value to 0 is not working. Reproducer: modprobe netdevsim echo 1 > /sys/bus/netdevsim/new_device ethtool -G eth0 hds-thresh 100 ethtool -G eth0 hds-thresh 0 ethtool -g eth0 #hds-thresh value should be 0, but it shows 100. The tools/testing/selftests/drivers/net/hds.py can test it too with applying a following patch for hds.py. Fixes: 928459b ("net: ethtool: populate the default HDS params in the core") Signed-off-by: Taehee Yoo <ap420073@gmail.com> Link: https://patch.msgid.link/20250404122126.1555648-2-ap420073@gmail.com Signed-off-by: Jakub Kicinski <kuba@kernel.org> Signed-off-by: Mohammad Heib <mheib@redhat.com>
1 parent df473e5 commit 65e3609

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

net/ethtool/common.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -828,6 +828,7 @@ void ethtool_ringparam_get_cfg(struct net_device *dev,
828828

829829
/* Driver gives us current state, we want to return current config */
830830
kparam->tcp_data_split = dev->cfg->hds_config;
831+
kparam->hds_thresh = dev->cfg->hds_thresh;
831832
}
832833

833834
static void ethtool_init_tsinfo(struct kernel_ethtool_ts_info *info)

0 commit comments

Comments
 (0)