OSDN Git Service

stmmac: let core reject the unsupported coalescing parameters
authorJakub Kicinski <kuba@kernel.org>
Thu, 5 Mar 2020 05:15:34 +0000 (21:15 -0800)
committerDavid S. Miller <davem@davemloft.net>
Thu, 5 Mar 2020 20:12:34 +0000 (12:12 -0800)
Set ethtool_ops->supported_coalesce_params to let
the core reject unsupported coalescing parameters.

This driver correctly rejects all unsupported parameters.
No functional changes.

v3: adjust commit message for new error code and member name

Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c

index b29603e..eae11c5 100644 (file)
@@ -732,20 +732,6 @@ static int stmmac_set_coalesce(struct net_device *dev,
        u32 rx_cnt = priv->plat->rx_queues_to_use;
        unsigned int rx_riwt;
 
-       /* Check not supported parameters  */
-       if ((ec->rx_coalesce_usecs_irq) ||
-           (ec->rx_max_coalesced_frames_irq) || (ec->tx_coalesce_usecs_irq) ||
-           (ec->use_adaptive_rx_coalesce) || (ec->use_adaptive_tx_coalesce) ||
-           (ec->pkt_rate_low) || (ec->rx_coalesce_usecs_low) ||
-           (ec->rx_max_coalesced_frames_low) || (ec->tx_coalesce_usecs_high) ||
-           (ec->tx_max_coalesced_frames_low) || (ec->pkt_rate_high) ||
-           (ec->tx_coalesce_usecs_low) || (ec->rx_coalesce_usecs_high) ||
-           (ec->rx_max_coalesced_frames_high) ||
-           (ec->tx_max_coalesced_frames_irq) ||
-           (ec->stats_block_coalesce_usecs) ||
-           (ec->tx_max_coalesced_frames_high) || (ec->rate_sample_interval))
-               return -EOPNOTSUPP;
-
        if (priv->use_riwt && (ec->rx_coalesce_usecs > 0)) {
                rx_riwt = stmmac_usec2riwt(ec->rx_coalesce_usecs, priv);
 
@@ -914,6 +900,8 @@ static int stmmac_set_tunable(struct net_device *dev,
 }
 
 static const struct ethtool_ops stmmac_ethtool_ops = {
+       .supported_coalesce_params = ETHTOOL_COALESCE_USECS |
+                                    ETHTOOL_COALESCE_MAX_FRAMES,
        .begin = stmmac_check_if_running,
        .get_drvinfo = stmmac_ethtool_getdrvinfo,
        .get_msglevel = stmmac_ethtool_getmsglevel,