A hds-thresh value is not set correctly if input value is 0. The cause is that ethtool_ringparam_get_cfg(), which is a internal function that returns ringparameters from both ->get_ringparam() and dev->cfg can't return a correct hds-thresh value.
The first patch fixes ethtool_ringparam_get_cfg() to set hds-thresh value correcltly.
The second patch adds random test for hds-thresh value. So that we can test 0 value for a hds-thresh properly.
v2: - Skips set_hds_thresh_random test when hds-thresh-max value is too small. (2/2) - Change random range from 1-MAX to 1-(MAX-1). (2/2)
Taehee Yoo (2): net: ethtool: fix ethtool_ringparam_get_cfg() returns a hds_thresh value always as 0. selftests: drv-net: test random value for hds-thresh
net/ethtool/common.c | 1 + tools/testing/selftests/drivers/net/hds.py | 33 +++++++++++++++++++++- 2 files changed, 33 insertions(+), 1 deletion(-)