hisilicon: let core reject the unsupported coalescing parameters
authorJakub Kicinski <kuba@kernel.org>
Thu, 5 Mar 2020 05:15:37 +0000 (21:15 -0800)
committerDavid S. Miller <davem@davemloft.net>
Thu, 5 Mar 2020 20:12:35 +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/hisilicon/hip04_eth.c

index d9718b87279dba872a0959aa8bfbb0864f67fb98..12f6c2442a7ad83ae026035907c8c70d3e4cda0b 100644 (file)
@@ -811,20 +811,6 @@ static int hip04_set_coalesce(struct net_device *netdev,
 {
        struct hip04_priv *priv = netdev_priv(netdev);
 
-       /* Check not supported parameters  */
-       if ((ec->rx_max_coalesced_frames) || (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->rx_coalesce_usecs) ||
-           (ec->tx_max_coalesced_frames_irq) ||
-           (ec->stats_block_coalesce_usecs) ||
-           (ec->tx_max_coalesced_frames_high) || (ec->rate_sample_interval))
-               return -EOPNOTSUPP;
-
        if ((ec->tx_coalesce_usecs > HIP04_MAX_TX_COALESCE_USECS ||
             ec->tx_coalesce_usecs < HIP04_MIN_TX_COALESCE_USECS) ||
            (ec->tx_max_coalesced_frames > HIP04_MAX_TX_COALESCE_FRAMES ||
@@ -845,6 +831,8 @@ static void hip04_get_drvinfo(struct net_device *netdev,
 }
 
 static const struct ethtool_ops hip04_ethtool_ops = {
+       .supported_coalesce_params = ETHTOOL_COALESCE_TX_USECS |
+                                    ETHTOOL_COALESCE_TX_MAX_FRAMES,
        .get_coalesce           = hip04_get_coalesce,
        .set_coalesce           = hip04_set_coalesce,
        .get_drvinfo            = hip04_get_drvinfo,