amd-xgbe: Configure and retrieve 'tx-usecs' for Tx coalescing
Subsystems (3)
PATCH RESEND 1/1 amd-xgbe: Configure and retrieve 'tx-usecs' for Tx coalescing
Ethtool has advanced with additional configurable options, but the current driver does not support tx-usecs configuration.
Add support to configure and retrieve 'tx-usecs' using ethtool, which specifies the wait time before servicing an interrupt for Tx coalescing.
--- drivers/net/ethernet/amd/xgbe/xgbe-ethtool.c | 19 +++++++++++++++++-- drivers/net/ethernet/amd/xgbe/xgbe.h | 1 + 2 files changed, 18 insertions(+), 2 deletions(-)
drivers/net/ethernet/amd/xgbe/xgbe-ethtool.c +17 -2
@@ -450,6 +450,7 @@ static int xgbe_get_coalesce(struct net_device *netdev, ec->rx_coalesce_usecs = pdata->rx_usecs; ec->rx_max_coalesced_frames = pdata->rx_frames; + ec->tx_coalesce_usecs = pdata->tx_usecs; ec->tx_max_coalesced_frames = pdata->tx_frames;return 0 ;
@@ -463,7 +464,7 @@ static int xgbe_set_coalesce(struct net_device *netdev,struct xgbe_prv_data *pdata =netdev_priv (netdev);struct xgbe_hw_if *hw_if = &pdata->hw_if;unsigned int rx_frames, rx_riwt, rx_usecs; -unsigned int tx_frames; +unsigned int tx_frames, tx_usecs; rx_riwt = hw_if->usec_to_riwt (pdata, ec->rx_coalesce_usecs); rx_usecs = ec->rx_coalesce_usecs;
@@ -485,9 +486,22 @@ static int xgbe_set_coalesce(struct net_device *netdev,return -EINVAL ; } + tx_usecs = ec->tx_coalesce_usecs; tx_frames = ec->tx_max_coalesced_frames; +/* Check if both tx_usecs and tx_frames are set to 0 simultaneously */ +if (!tx_usecs && !tx_frames) { +netdev_err (netdev, +"tx_usecs and tx_frames must not be 0 together\n" ); +return -EINVAL ; + } +/* Check the bounds of values for Tx */ +if (tx_usecs >XGMAC_MAX_COAL_TX_TICK ) { +netdev_err (netdev,"tx-usecs is limited to %d usec\n" , +XGMAC_MAX_COAL_TX_TICK ); +return -EINVAL ; + }if (tx_frames > pdata->tx_desc_count) {netdev_err (netdev,"tx-frames is limited to %d frames\n" , pdata->tx_desc_count);
@@ -499,6 +513,7 @@ static int xgbe_set_coalesce(struct net_device *netdev, pdata->rx_frames = rx_frames; hw_if->config_rx_coalesce (pdata); + pdata->tx_usecs = tx_usecs; pdata->tx_frames = tx_frames; hw_if->config_tx_coalesce (pdata);
@@ -830,7 +845,7 @@ static int xgbe_set_channels(struct net_device *netdev, }static const struct ethtool_ops xgbe_ethtool_ops = { - .supported_coalesce_params =ETHTOOL_COALESCE_RX_USECS | + .supported_coalesce_params =ETHTOOL_COALESCE_USECS |ETHTOOL_COALESCE_MAX_FRAMES , .get_drvinfo = xgbe_get_drvinfo, .get_msglevel = xgbe_get_msglevel,
drivers/net/ethernet/amd/xgbe/xgbe.h +1 -0
@@ -272,6 +272,7 @@/* Default coalescing parameters */ #define XGMAC_INIT_DMA_TX_USECS 1000#define XGMAC_INIT_DMA_TX_FRAMES 25 +#define XGMAC_MAX_COAL_TX_TICK 100000#define XGMAC_MAX_DMA_RIWT 0xff#define XGMAC_INIT_DMA_RX_USECS 30
Signature · 1 line
2.34.1
Quoted 58 lines · Vishal Badole
Ethtool has advanced with additional configurable options, but the current driver does not support tx-usecs configuration.
Add support to configure and retrieve 'tx-usecs' using ethtool, which specifies the wait time before servicing an interrupt for Tx coalescing.
Signed-off-by Vishal Badole <[email protected]>Acked-by Shyam Sundar S K <[email protected]>--- drivers/net/ethernet/amd/xgbe/xgbe-ethtool.c | 19 +++++++++++++++++-- drivers/net/ethernet/amd/xgbe/xgbe.h | 1 + 2 files changed, 18 insertions(+), 2 deletions(-)drivers/net/ethernet/amd/xgbe/xgbe-ethtool.c +15
-1@@ -450,6 +450,7 @@ static int xgbe_get_coalesce(struct net_device *netdev, ec->rx_coalesce_usecs = pdata->rx_usecs; ec->rx_max_coalesced_frames = pdata->rx_frames; + ec->tx_coalesce_usecs = pdata->tx_usecs; ec->tx_max_coalesced_frames = pdata->tx_frames;return 0 ;@@ -463,7 +464,7 @@ static int xgbe_set_coalesce(struct net_device *netdev,struct xgbe_prv_data *pdata =netdev_priv (netdev);struct xgbe_hw_if *hw_if = &pdata->hw_if;unsigned int rx_frames, rx_riwt, rx_usecs; -unsigned int tx_frames; +unsigned int tx_frames, tx_usecs; rx_riwt = hw_if->usec_to_riwt (pdata, ec->rx_coalesce_usecs); rx_usecs = ec->rx_coalesce_usecs;@@ -485,9 +486,22 @@ static int xgbe_set_coalesce(struct net_device *netdev,return -EINVAL ; } + tx_usecs = ec->tx_coalesce_usecs; tx_frames = ec->tx_max_coalesced_frames; +/* Check if both tx_usecs and tx_frames are set to 0 simultaneously */ +if (!tx_usecs && !tx_frames) { +netdev_err (netdev, +"tx_usecs and tx_frames must not be 0 together\n" ); +return -EINVAL ; + } +/* Check the bounds of values for Tx */ +if (tx_usecs >XGMAC_MAX_COAL_TX_TICK ) { +netdev_err (netdev,"tx-usecs is limited to %d usec\n" , +XGMAC_MAX_COAL_TX_TICK ); +return -EINVAL ; + }if (tx_frames > pdata->tx_desc_count) {netdev_err (netdev,"tx-frames is limited to %d frames\n" , pdata->tx_desc_count);
drivers/net/ethernet/amd/xgbe/xgbe-ethtool.c static int xgbe_set_coalesce(struct net_device *netdev, · line 519
Quoted 7 lines
drivers/net/ethernet/amd/xgbe/xgbe-ethtool.c +1
-0@@ -499,6 +513,7 @@ static int xgbe_set_coalesce(struct net_device *netdev, pdata->rx_frames = rx_frames; hw_if->config_rx_coalesce (pdata); + pdata->tx_usecs = tx_usecs; pdata->tx_frames = tx_frames; hw_if->config_tx_coalesce (pdata);
I'm not quite sure, but it looks like it never works. config_tx_coalesce() callback equals to xgbe_config_tx_coalesce() which is implemented as:
static int xgbe_config_tx_coalesce(struct xgbe_prv_data *pdata)
{
return 0;
}How is it expected to change anything from HW side?
Quoted 21 lines
drivers/net/ethernet/amd/xgbe/xgbe-ethtool.c +1
-1@@ -830,7 +845,7 @@ static int xgbe_set_channels(struct net_device *netdev, }static const struct ethtool_ops xgbe_ethtool_ops = { - .supported_coalesce_params =ETHTOOL_COALESCE_RX_USECS | + .supported_coalesce_params =ETHTOOL_COALESCE_USECS |ETHTOOL_COALESCE_MAX_FRAMES , .get_drvinfo = xgbe_get_drvinfo, .get_msglevel = xgbe_get_msglevel,drivers/net/ethernet/amd/xgbe/xgbe.h +1
-0@@ -272,6 +272,7 @@/* Default coalescing parameters */ #define XGMAC_INIT_DMA_TX_USECS 1000#define XGMAC_INIT_DMA_TX_FRAMES 25 +#define XGMAC_MAX_COAL_TX_TICK 100000#define XGMAC_MAX_DMA_RIWT 0xff#define XGMAC_INIT_DMA_RX_USECS 30
Quoted 69 lines · Vadim Fedorenko
Quoted 57 lines · Vishal Badole
Ethtool has advanced with additional configurable options, but the current driver does not support tx-usecs configuration.
Add support to configure and retrieve 'tx-usecs' using ethtool, which specifies the wait time before servicing an interrupt for Tx coalescing.
Signed-off-by Vishal Badole <[email protected]>Acked-by Shyam Sundar S K <[email protected]>---
drivers/net/ethernet/amd/xgbe/xgbe-ethtool.c| 19 +++++++++++++++++-- drivers/net/ethernet/amd/xgbe/xgbe.h | 1 +2 files changed, 18 insertions(+), 2 deletions(-)drivers/net/ethernet/amd/xgbe/xgbe-ethtool.c +4
-1@@ -450,6 +450,7 @@ static int xgbe_get_coalesce(struct net_device *netdev, ec->rx_coalesce_usecs = pdata->rx_usecs; ec->rx_max_coalesced_frames = pdata->rx_frames; + ec->tx_coalesce_usecs = pdata->tx_usecs; ec->tx_max_coalesced_frames = pdata->tx_frames; return 0;@@ -463,7 +464,7 @@ static int xgbe_set_coalesce(struct net_device *netdev, struct xgbe_prv_data *pdata = netdev_priv(netdev); struct xgbe_hw_if *hw_if = &pdata->hw_if; unsigned int rx_frames, rx_riwt, rx_usecs; - unsigned int tx_frames; + unsigned int tx_frames, tx_usecs; rx_riwt = hw_if->usec_to_riwt(pdata, ec->rx_coalesce_usecs); rx_usecs = ec->rx_coalesce_usecs;@@ -485,9 +486,22 @@ static int xgbe_set_coalesce(struct net_device *netdev, return -EINVAL; } + tx_usecs = ec->tx_coalesce_usecs; tx_frames = ec->tx_max_coalesced_frames; + /* Check if both tx_usecs and tx_frames are set to 0simultaneously */
+ if (!tx_usecs && !tx_frames) {
+ netdev_err(netdev,
+ "tx_usecsandtx_framesmust not be 0 together\n"); + return-EINVAL;
+ }
+
/* Check the bounds of values for Tx */
+ if (tx_usecs>XGMAC_MAX_COAL_TX_TICK) {
+netdev_err(netdev, "tx-usecs is limited to %d usec\n", + XGMAC_MAX_COAL_TX_TICK);
+ return-EINVAL;
+ }
if (tx_frames>pdata->tx_desc_count) {netdev_err(netdev, "tx-frames is limited to %d frames\n", pdata->tx_desc_count);drivers/net/ethernet/amd/xgbe/xgbe-ethtool.c static int xgbe_set_coalesce(struct net_device · line 519
Quoted 7 lines
drivers/net/ethernet/amd/xgbe/xgbe-ethtool.c +1
-0@@ -499,6 +513,7 @@ static int xgbe_set_coalesce(struct net_device *netdev, pdata->rx_frames = rx_frames; hw_if->config_rx_coalesce(pdata); + pdata->tx_usecs = tx_usecs; pdata->tx_frames = tx_frames; hw_if->config_tx_coalesce(pdata);I'm not quite sure, but it looks like it never works.
config_tx_coalesce()callback equals toxgbe_config_tx_coalesce()which is implemented as:
Quoted 7 lines
static int
xgbe_config_tx_coalesce(struct xgbe_prv_data *pdata){
return 0;
}How is it expected to change anything from HW side?
The code analysis reveals that pdata, a pointer to xgbe_prv_data, is obtained via netdev_priv(netdev). The tx_usecs member of the xgbe_prv_data structure is then updated with the user-specified value through this pdata pointer. This updated tx_usecs value propagates throughout the codebase wherever TX coalescing functionality is referenced.
We have validated this behavior through log analysis and transmission timestamps, confirming the parameter updates are taking effect.
Since this is a legacy driver implementation where xgbe_config_tx_coalesce() currently lacks actual hardware configuration logic for TX coalescing parameters, we plan to modernize the xgbe driver and eliminate redundant code segments in future releases.
Quoted 21 lines
Quoted 20 lines
drivers/net/ethernet/amd/xgbe/xgbe-ethtool.c +1
-1@@ -830,7 +845,7 @@ static int xgbe_set_channels(struct net_device *netdev, } static const struct ethtool_ops xgbe_ethtool_ops = { - .supported_coalesce_params = ETHTOOL_COALESCE_RX_USECS | + .supported_coalesce_params = ETHTOOL_COALESCE_USECS | ETHTOOL_COALESCE_MAX_FRAMES, .get_drvinfo = xgbe_get_drvinfo, .get_msglevel = xgbe_get_msglevel,drivers/net/ethernet/amd/xgbe/xgbe.h +1
-0@@ -272,6 +272,7 @@ /* Default coalescing parameters */ #define XGMAC_INIT_DMA_TX_USECS 1000 #define XGMAC_INIT_DMA_TX_FRAMES 25 +#define XGMAC_MAX_COAL_TX_TICK 100000 #define XGMAC_MAX_DMA_RIWT 0xff #define XGMAC_INIT_DMA_RX_USECS 30
Quoted 72 lines · Vishal
Quoted 69 lines · Vadim Fedorenko
Quoted 53 lines · Vishal Badole
Ethtool has advanced with additional configurable options, but the current driver does not support tx-usecs configuration.
Add support to configure and retrieve 'tx-usecs' using ethtool, which specifies the wait time before servicing an interrupt for Tx coalescing.
Signed-off-by Vishal Badole <[email protected]>Acked-by Shyam Sundar S K <[email protected]>---
drivers/net/ethernet/amd/xgbe/xgbe-ethtool.c| 19 +++++++++++++++++-- drivers/net/ethernet/amd/xgbe/xgbe.h | 1 +2 files changed, 18 insertions(+), 2 deletions(-)drivers/net/ethernet/amd/xgbe/xgbe-ethtool.c +15
-1@@ -450,6 +450,7 @@ static int xgbe_get_coalesce(struct net_device *netdev, ec->rx_coalesce_usecs = pdata->rx_usecs; ec->rx_max_coalesced_frames = pdata->rx_frames; + ec->tx_coalesce_usecs = pdata->tx_usecs; ec->tx_max_coalesced_frames = pdata->tx_frames; return 0;@@ -463,7 +464,7 @@ static int xgbe_set_coalesce(struct net_device *netdev, struct xgbe_prv_data *pdata = netdev_priv(netdev); struct xgbe_hw_if *hw_if = &pdata->hw_if; unsigned int rx_frames, rx_riwt, rx_usecs; - unsigned int tx_frames; + unsigned int tx_frames, tx_usecs; rx_riwt = hw_if->usec_to_riwt(pdata, ec->rx_coalesce_usecs); rx_usecs = ec->rx_coalesce_usecs;@@ -485,9 +486,22 @@ static int xgbe_set_coalesce(struct net_device *netdev, return -EINVAL; } + tx_usecs = ec->tx_coalesce_usecs; tx_frames = ec->tx_max_coalesced_frames; + /* Check if both tx_usecs and tx_frames are set to 0 simultaneously */ + if (!tx_usecs && !tx_frames) { + netdev_err(netdev, + "tx_usecs and tx_frames must not be 0 together\n"); + return -EINVAL; + } + /* Check the bounds of values for Tx */ + if (tx_usecs > XGMAC_MAX_COAL_TX_TICK) { + netdev_err(netdev, "tx-usecs is limited to %d usec\n", + XGMAC_MAX_COAL_TX_TICK); + return -EINVAL; + } if (tx_frames > pdata->tx_desc_count) { netdev_err(netdev, "tx-frames is limited to %d frames\n", pdata->tx_desc_count);drivers/net/ethernet/amd/xgbe/xgbe-ethtool.c static int xgbe_set_coalesce(struct net_device *netdev, · line 518
Quoted 6 lines
drivers/net/ethernet/amd/xgbe/xgbe-ethtool.c +1
-0@@ -499,6 +513,7 @@ static int xgbe_set_coalesce(struct net_device *netdev, pdata->rx_frames = rx_frames; hw_if->config_rx_coalesce(pdata); + pdata->tx_usecs = tx_usecs; pdata->tx_frames = tx_frames; hw_if->config_tx_coalesce(pdata);I'm not quite sure, but it looks like it never works.
config_tx_coalesce()callback equals toxgbe_config_tx_coalesce()which is implemented as:static int
xgbe_config_tx_coalesce(struct xgbe_prv_data *pdata){
return 0;
}
Quoted 8 lines
Quoted 2 lines
How is it expected to change anything from HW side?
The code analysis reveals that pdata, a pointer to
xgbe_prv_data, is obtained vianetdev_priv(netdev). Thetx_usecsmember of thexgbe_prv_datastructure is then updated with the user-specified value through this pdata pointer. This updatedtx_usecsvalue propagates throughout the codebase wherever TX coalescing functionality is referenced.We have validated this behavior through log analysis and transmission timestamps, confirming the parameter updates are taking effect.
Since this is a legacy driver implementation where
xgbe_config_tx_coalesce()currently lacks actual hardware configuration logic for TX coalescing parameters, we plan to modernize the xgbe driver and eliminate redundant code segments in future releases.
Effectively, when the user asks for the coalescing configuration, the driver reports values which are not really HW-configured values. At the same time driver reports correct configuration even though the configuration is not
actually supported by the driver and it doesn't configure HW. This sounds odd.
Why didn't you start with the actual implementation instead of doing this useless copying of values?
Quoted 22 lines
Quoted 21 lines
Quoted 20 lines
drivers/net/ethernet/amd/xgbe/xgbe-ethtool.c +1
-1@@ -830,7 +845,7 @@ static int xgbe_set_channels(struct net_device *netdev, } static const struct ethtool_ops xgbe_ethtool_ops = { - .supported_coalesce_params = ETHTOOL_COALESCE_RX_USECS | + .supported_coalesce_params = ETHTOOL_COALESCE_USECS | ETHTOOL_COALESCE_MAX_FRAMES, .get_drvinfo = xgbe_get_drvinfo, .get_msglevel = xgbe_get_msglevel,drivers/net/ethernet/amd/xgbe/xgbe.h +1
-0@@ -272,6 +272,7 @@ /* Default coalescing parameters */ #define XGMAC_INIT_DMA_TX_USECS 1000 #define XGMAC_INIT_DMA_TX_FRAMES 25 +#define XGMAC_MAX_COAL_TX_TICK 100000 #define XGMAC_MAX_DMA_RIWT 0xff #define XGMAC_INIT_DMA_RX_USECS 30
Quoted 85 lines · Vadim Fedorenko
Quoted 84 lines · Vishal
Quoted 69 lines · Vadim Fedorenko
Quoted 57 lines · Vishal Badole
Ethtool has advanced with additional configurable options, but the current driver does not support tx-usecs configuration.
Add support to configure and retrieve 'tx-usecs' using ethtool, which specifies the wait time before servicing an interrupt for Tx coalescing.
Signed-off-by Vishal Badole <[email protected]>Acked-by Shyam Sundar S K <[email protected]>---
drivers/net/ethernet/amd/xgbe/xgbe-ethtool.c| 19 +++++++++++++++++-- drivers/net/ethernet/amd/xgbe/xgbe.h | 1 +2 files changed, 18 insertions(+), 2 deletions(-)drivers/net/ethernet/amd/xgbe/xgbe-ethtool.c +4
-1@@ -450,6 +450,7 @@ static int xgbe_get_coalesce(struct net_device *netdev, ec->rx_coalesce_usecs = pdata->rx_usecs; ec->rx_max_coalesced_frames = pdata->rx_frames; + ec->tx_coalesce_usecs = pdata->tx_usecs; ec->tx_max_coalesced_frames = pdata->tx_frames; return 0;@@ -463,7 +464,7 @@ static int xgbe_set_coalesce(struct net_device *netdev, struct xgbe_prv_data *pdata = netdev_priv(netdev); struct xgbe_hw_if *hw_if = &pdata->hw_if; unsigned int rx_frames, rx_riwt, rx_usecs; - unsigned int tx_frames; + unsigned int tx_frames, tx_usecs; rx_riwt = hw_if->usec_to_riwt(pdata, ec->rx_coalesce_usecs); rx_usecs = ec->rx_coalesce_usecs;@@ -485,9 +486,22 @@ static int xgbe_set_coalesce(struct net_device *netdev, return -EINVAL; } + tx_usecs = ec->tx_coalesce_usecs; tx_frames = ec->tx_max_coalesced_frames; + /* Check if both tx_usecs and tx_frames are set to 0simultaneously */
+ if (!tx_usecs && !tx_frames) {
+ netdev_err(netdev,
+ "tx_usecsandtx_framesmust not be 0 together\n"); + return-EINVAL;
+ }
+
/* Check the bounds of values for Tx */
+ if (tx_usecs>XGMAC_MAX_COAL_TX_TICK) {
+netdev_err(netdev, "tx-usecs is limited to %d usec\n", + XGMAC_MAX_COAL_TX_TICK);
+ return-EINVAL;
+ }
if (tx_frames>pdata->tx_desc_count) {netdev_err(netdev, "tx-frames is limited to %d frames\n", pdata->tx_desc_count);drivers/net/ethernet/amd/xgbe/xgbe-ethtool.c static int xgbe_set_coalesce(struct net_device · line 519
Quoted 7 lines
drivers/net/ethernet/amd/xgbe/xgbe-ethtool.c +1
-0@@ -499,6 +513,7 @@ static int xgbe_set_coalesce(struct net_device *netdev, pdata->rx_frames = rx_frames; hw_if->config_rx_coalesce(pdata); + pdata->tx_usecs = tx_usecs; pdata->tx_frames = tx_frames; hw_if->config_tx_coalesce(pdata);I'm not quite sure, but it looks like it never works.
config_tx_coalesce()callback equals toxgbe_config_tx_coalesce()which is implemented as:Quoted 7 lines
static int
xgbe_config_tx_coalesce(struct xgbe_prv_data *pdata){
return 0;
}How is it expected to change anything from HW side?
The code analysis reveals that pdata, a pointer to
xgbe_prv_data, is obtained vianetdev_priv(netdev). Thetx_usecsmember of thexgbe_prv_datastructure is then updated with the user-specified value through this pdata pointer. This updatedtx_usecsvalue propagates throughout the codebase wherever TX coalescing functionality is referenced.We have validated this behavior through log analysis and transmission timestamps, confirming the parameter updates are taking effect.
Quoted 10 lines
Quoted 1 line
Since this is a legacy driver implementation where
xgbe_config_tx_coalesce()currently lacks actual hardware configuration logic for TX coalescing parameters, we plan to modernize the xgbe driver and eliminate redundant code segments in future releases.Effectively, when the user asks for the coalescing configuration, the driver reports values which are not really HW-configured values. At the same time driver reports correct configuration even though the configuration is not
actually supported by the driver and it doesn't configure HW. This sounds odd.Why didn't you start with the actual implementation instead of doing this useless copying of values?
Since the XGMAC controller does not provide hardware-level register support for tx_usecs-based TX interrupt coalescing, the driver employs an advanced timer-driven software implementation to achieve interrupt batching and improve performance. The tx_usecs parameter is accessible through the pdata structure pointer, allowing dynamic updates that automatically influence the TX coalescing timer mechanism across the driver implementation.
Quoted 24 lines
Quoted 23 lines
Quoted 22 lines
Quoted 21 lines
drivers/net/ethernet/amd/xgbe/xgbe-ethtool.c +1
-1@@ -830,7 +845,7 @@ static int xgbe_set_channels(struct net_device *netdev, } static const struct ethtool_ops xgbe_ethtool_ops = { - .supported_coalesce_params = ETHTOOL_COALESCE_RX_USECS | + .supported_coalesce_params = ETHTOOL_COALESCE_USECS | ETHTOOL_COALESCE_MAX_FRAMES, .get_drvinfo = xgbe_get_drvinfo, .get_msglevel = xgbe_get_msglevel,drivers/net/ethernet/amd/xgbe/xgbe.h +1
-0@@ -272,6 +272,7 @@ /* Default coalescing parameters */ #define XGMAC_INIT_DMA_TX_USECS 1000 #define XGMAC_INIT_DMA_TX_FRAMES 25 +#define XGMAC_MAX_COAL_TX_TICK 100000 #define XGMAC_MAX_DMA_RIWT 0xff #define XGMAC_INIT_DMA_RX_USECS 30
Jakub Kicinski
maintainerdrivers/net/ethernet/amd/xgbe/xgbe-ethtool.c static int xgbe_set_coalesce(struct net_device *netdev, · line 504
Quoted 13 lines · On Sat, 19 Jul 2025 12:56:08 +0530 Vishal Badole wrote:
drivers/net/ethernet/amd/xgbe/xgbe-ethtool.c +12
-0+/* Check if both tx_usecs and tx_frames are set to 0 simultaneously */ +if (!tx_usecs && !tx_frames) { +netdev_err (netdev, +"tx_usecs and tx_frames must not be 0 together\n" ); +return -EINVAL ; + } +/* Check the bounds of values for Tx */ +if (tx_usecs >XGMAC_MAX_COAL_TX_TICK ) { +netdev_err (netdev,"tx-usecs is limited to %d usec\n" , +XGMAC_MAX_COAL_TX_TICK ); +return -EINVAL ; + }
Please use extack to report the error to the user rather than system logs.
Signature · 1 line
pw-bot: cr
Quoted 17 lines · Jakub Kicinski
drivers/net/ethernet/amd/xgbe/xgbe-ethtool.c static int xgbe_set_coalesce(struct net_device *netdev, · line 504
Quoted 13 lines · On Sat, 19 Jul 2025 12:56:08 +0530 Vishal Badole wrote:
drivers/net/ethernet/amd/xgbe/xgbe-ethtool.c +12
-0+/* Check if both tx_usecs and tx_frames are set to 0 simultaneously */ +if (!tx_usecs && !tx_frames) { +netdev_err (netdev, +"tx_usecs and tx_frames must not be 0 together\n" ); +return -EINVAL ; + } +/* Check the bounds of values for Tx */ +if (tx_usecs >XGMAC_MAX_COAL_TX_TICK ) { +netdev_err (netdev,"tx-usecs is limited to %d usec\n" , +XGMAC_MAX_COAL_TX_TICK ); +return -EINVAL ; + }Please use extack to report the error to the user rather than system logs.
Thank you for your observations. Since this driver is quite old, we have used netdev_err() to report errors to maintain consistency. In the future, we plan to upgrade the driver to use netlink interfaces with extack parameters for returning error information to user-space.
Jakub Kicinski
maintainerQuoted 5 lines · On Sat, 19 Jul 2025 12:56:08 +0530 Vishal Badole wrote:
Ethtool has advanced with additional configurable options, but the current driver does not support tx-usecs configuration.
Add support to configure and retrieve 'tx-usecs' using ethtool, which specifies the wait time before servicing an interrupt for Tx coalescing.
If you're reviving this patch in PW I strongly advise you to stop.