ethtool: fix ethtool msg len calculation for pause stats
[ Upstream commit 1aabe578dd86e9f2867c4db4fba9a15f4ba1825d ]
ETHTOOL_A_PAUSE_STAT_MAX is the MAX attribute id,
so we need to subtract non-stats and add one to
get a count (IOW -2+1 == -1).
Otherwise we'll see:
ethnl cmd 21: calculated reply length 40, but consumed 52
Fixes: 9a27a33027
("ethtool: add standard pause stats")
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Reviewed-by: Saeed Mahameed <saeedm@nvidia.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:

committed by
Greg Kroah-Hartman

parent
e78c267eb7
commit
628773a759
@@ -394,7 +394,9 @@ enum {
|
||||
ETHTOOL_A_PAUSE_STAT_TX_FRAMES,
|
||||
ETHTOOL_A_PAUSE_STAT_RX_FRAMES,
|
||||
|
||||
/* add new constants above here */
|
||||
/* add new constants above here
|
||||
* adjust ETHTOOL_PAUSE_STAT_CNT if adding non-stats!
|
||||
*/
|
||||
__ETHTOOL_A_PAUSE_STAT_CNT,
|
||||
ETHTOOL_A_PAUSE_STAT_MAX = (__ETHTOOL_A_PAUSE_STAT_CNT - 1)
|
||||
};
|
||||
|
Reference in New Issue
Block a user