ethtool: add support to set/get tx copybreak buf size via ethtool

Add support for ethtool to set/get tx copybreak buf size.

Signed-off-by: Hao Chen <chenhao288@hisilicon.com>
Signed-off-by: Guangbin Huang <huangguangbin2@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: hongrongxuan <hongrongxuan@huawei.com>
This commit is contained in:
Hao Chen 2021-11-18 20:12:40 +08:00 committed by Jianping Liu
parent 278b9dcaf7
commit ea084da501
3 changed files with 3 additions and 0 deletions

View File

@ -221,6 +221,7 @@ enum tunable_id {
ETHTOOL_RX_COPYBREAK, ETHTOOL_RX_COPYBREAK,
ETHTOOL_TX_COPYBREAK, ETHTOOL_TX_COPYBREAK,
ETHTOOL_PFC_PREVENTION_TOUT, /* timeout in msecs */ ETHTOOL_PFC_PREVENTION_TOUT, /* timeout in msecs */
ETHTOOL_TX_COPYBREAK_BUF_SIZE,
/* /*
* Add your fresh new tunable attribute above and remember to update * Add your fresh new tunable attribute above and remember to update
* tunable_strings[] in net/ethtool/common.c * tunable_strings[] in net/ethtool/common.c

View File

@ -77,6 +77,7 @@ tunable_strings[__ETHTOOL_TUNABLE_COUNT][ETH_GSTRING_LEN] = {
[ETHTOOL_RX_COPYBREAK] = "rx-copybreak", [ETHTOOL_RX_COPYBREAK] = "rx-copybreak",
[ETHTOOL_TX_COPYBREAK] = "tx-copybreak", [ETHTOOL_TX_COPYBREAK] = "tx-copybreak",
[ETHTOOL_PFC_PREVENTION_TOUT] = "pfc-prevention-tout", [ETHTOOL_PFC_PREVENTION_TOUT] = "pfc-prevention-tout",
[ETHTOOL_TX_COPYBREAK_BUF_SIZE] = "tx-copybreak-buf-size",
}; };
const char const char

View File

@ -2222,6 +2222,7 @@ static int ethtool_tunable_valid(const struct ethtool_tunable *tuna)
switch (tuna->id) { switch (tuna->id) {
case ETHTOOL_RX_COPYBREAK: case ETHTOOL_RX_COPYBREAK:
case ETHTOOL_TX_COPYBREAK: case ETHTOOL_TX_COPYBREAK:
case ETHTOOL_TX_COPYBREAK_BUF_SIZE:
if (tuna->len != sizeof(u32) || if (tuna->len != sizeof(u32) ||
tuna->type_id != ETHTOOL_TUNABLE_U32) tuna->type_id != ETHTOOL_TUNABLE_U32)
return -EINVAL; return -EINVAL;