Commit af91fd7e authored by David S. Miller's avatar David S. Miller

Merge branch 'ethtool-consolidate-irq-coalescing-part-4'

Jakub Kicinski says:

====================
ethtool: consolidate irq coalescing - part 4

Convert more drivers following the groundwork laid in a recent
patch set [1] and continued in [2], [3]. The aim of the effort
is to consolidate irq coalescing parameter validation in the core.

This set converts 15 drivers in drivers/net/ethernet - remaining
Intel drivers, Freescale/NXP, and others.
2 more conversion sets to come.

[1] https://lore.kernel.org/netdev/20200305051542.991898-1-kuba@kernel.org/
[2] https://lore.kernel.org/netdev/20200306010602.1620354-1-kuba@kernel.org/
[3] https://lore.kernel.org/netdev/20200310021512.1861626-1-kuba@kernel.org/
====================
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents c7449b75 e259b911
...@@ -1408,6 +1408,9 @@ static int be_set_priv_flags(struct net_device *netdev, u32 flags) ...@@ -1408,6 +1408,9 @@ static int be_set_priv_flags(struct net_device *netdev, u32 flags)
} }
const struct ethtool_ops be_ethtool_ops = { const struct ethtool_ops be_ethtool_ops = {
.supported_coalesce_params = ETHTOOL_COALESCE_USECS |
ETHTOOL_COALESCE_USE_ADAPTIVE |
ETHTOOL_COALESCE_USECS_LOW_HIGH,
.get_drvinfo = be_get_drvinfo, .get_drvinfo = be_get_drvinfo,
.get_wol = be_get_wol, .get_wol = be_get_wol,
.set_wol = be_set_wol, .set_wol = be_set_wol,
......
...@@ -525,7 +525,6 @@ static int dpaa_get_coalesce(struct net_device *dev, ...@@ -525,7 +525,6 @@ static int dpaa_get_coalesce(struct net_device *dev,
c->rx_coalesce_usecs = period; c->rx_coalesce_usecs = period;
c->rx_max_coalesced_frames = thresh; c->rx_max_coalesced_frames = thresh;
c->use_adaptive_rx_coalesce = false;
return 0; return 0;
} }
...@@ -540,9 +539,6 @@ static int dpaa_set_coalesce(struct net_device *dev, ...@@ -540,9 +539,6 @@ static int dpaa_set_coalesce(struct net_device *dev,
u8 thresh, prev_thresh; u8 thresh, prev_thresh;
int cpu, res; int cpu, res;
if (c->use_adaptive_rx_coalesce)
return -EINVAL;
period = c->rx_coalesce_usecs; period = c->rx_coalesce_usecs;
thresh = c->rx_max_coalesced_frames; thresh = c->rx_max_coalesced_frames;
...@@ -582,6 +578,8 @@ static int dpaa_set_coalesce(struct net_device *dev, ...@@ -582,6 +578,8 @@ static int dpaa_set_coalesce(struct net_device *dev,
} }
const struct ethtool_ops dpaa_ethtool_ops = { const struct ethtool_ops dpaa_ethtool_ops = {
.supported_coalesce_params = ETHTOOL_COALESCE_RX_USECS |
ETHTOOL_COALESCE_RX_MAX_FRAMES,
.get_drvinfo = dpaa_get_drvinfo, .get_drvinfo = dpaa_get_drvinfo,
.get_msglevel = dpaa_get_msglevel, .get_msglevel = dpaa_get_msglevel,
.set_msglevel = dpaa_set_msglevel, .set_msglevel = dpaa_set_msglevel,
......
...@@ -2641,6 +2641,8 @@ fec_enet_set_wol(struct net_device *ndev, struct ethtool_wolinfo *wol) ...@@ -2641,6 +2641,8 @@ fec_enet_set_wol(struct net_device *ndev, struct ethtool_wolinfo *wol)
} }
static const struct ethtool_ops fec_enet_ethtool_ops = { static const struct ethtool_ops fec_enet_ethtool_ops = {
.supported_coalesce_params = ETHTOOL_COALESCE_USECS |
ETHTOOL_COALESCE_MAX_FRAMES,
.get_drvinfo = fec_enet_get_drvinfo, .get_drvinfo = fec_enet_get_drvinfo,
.get_regs_len = fec_enet_get_regs_len, .get_regs_len = fec_enet_get_regs_len,
.get_regs = fec_enet_get_regs, .get_regs = fec_enet_get_regs,
......
...@@ -1474,6 +1474,8 @@ static int gfar_get_ts_info(struct net_device *dev, ...@@ -1474,6 +1474,8 @@ static int gfar_get_ts_info(struct net_device *dev,
} }
const struct ethtool_ops gfar_ethtool_ops = { const struct ethtool_ops gfar_ethtool_ops = {
.supported_coalesce_params = ETHTOOL_COALESCE_USECS |
ETHTOOL_COALESCE_MAX_FRAMES,
.get_drvinfo = gfar_gdrvinfo, .get_drvinfo = gfar_gdrvinfo,
.get_regs_len = gfar_reglen, .get_regs_len = gfar_reglen,
.get_regs = gfar_get_regs, .get_regs = gfar_get_regs,
......
...@@ -1264,6 +1264,11 @@ static int hns_get_rxnfc(struct net_device *netdev, ...@@ -1264,6 +1264,11 @@ static int hns_get_rxnfc(struct net_device *netdev,
} }
static const struct ethtool_ops hns_ethtool_ops = { static const struct ethtool_ops hns_ethtool_ops = {
.supported_coalesce_params = ETHTOOL_COALESCE_USECS |
ETHTOOL_COALESCE_MAX_FRAMES |
ETHTOOL_COALESCE_USE_ADAPTIVE |
ETHTOOL_COALESCE_USECS_LOW_HIGH |
ETHTOOL_COALESCE_MAX_FRAMES_LOW_HIGH,
.get_drvinfo = hns_nic_get_drvinfo, .get_drvinfo = hns_nic_get_drvinfo,
.get_link = hns_nic_get_link, .get_link = hns_nic_get_link,
.get_ringparam = hns_get_ringparam, .get_ringparam = hns_get_ringparam,
......
...@@ -1390,7 +1390,13 @@ static int hns3_set_fecparam(struct net_device *netdev, ...@@ -1390,7 +1390,13 @@ static int hns3_set_fecparam(struct net_device *netdev,
return ops->set_fec(handle, fec_mode); return ops->set_fec(handle, fec_mode);
} }
#define HNS3_ETHTOOL_COALESCE (ETHTOOL_COALESCE_USECS | \
ETHTOOL_COALESCE_USE_ADAPTIVE | \
ETHTOOL_COALESCE_RX_USECS_HIGH | \
ETHTOOL_COALESCE_TX_USECS_HIGH)
static const struct ethtool_ops hns3vf_ethtool_ops = { static const struct ethtool_ops hns3vf_ethtool_ops = {
.supported_coalesce_params = HNS3_ETHTOOL_COALESCE,
.get_drvinfo = hns3_get_drvinfo, .get_drvinfo = hns3_get_drvinfo,
.get_ringparam = hns3_get_ringparam, .get_ringparam = hns3_get_ringparam,
.set_ringparam = hns3_set_ringparam, .set_ringparam = hns3_set_ringparam,
...@@ -1416,6 +1422,7 @@ static const struct ethtool_ops hns3vf_ethtool_ops = { ...@@ -1416,6 +1422,7 @@ static const struct ethtool_ops hns3vf_ethtool_ops = {
}; };
static const struct ethtool_ops hns3_ethtool_ops = { static const struct ethtool_ops hns3_ethtool_ops = {
.supported_coalesce_params = HNS3_ETHTOOL_COALESCE,
.self_test = hns3_self_test, .self_test = hns3_self_test,
.get_drvinfo = hns3_get_drvinfo, .get_drvinfo = hns3_get_drvinfo,
.get_link = hns3_get_link, .get_link = hns3_get_link,
......
...@@ -1852,6 +1852,7 @@ static void e1000_get_strings(struct net_device *netdev, u32 stringset, ...@@ -1852,6 +1852,7 @@ static void e1000_get_strings(struct net_device *netdev, u32 stringset,
} }
static const struct ethtool_ops e1000_ethtool_ops = { static const struct ethtool_ops e1000_ethtool_ops = {
.supported_coalesce_params = ETHTOOL_COALESCE_RX_USECS,
.get_drvinfo = e1000_get_drvinfo, .get_drvinfo = e1000_get_drvinfo,
.get_regs_len = e1000_get_regs_len, .get_regs_len = e1000_get_regs_len,
.get_regs = e1000_get_regs, .get_regs = e1000_get_regs,
......
...@@ -1151,6 +1151,8 @@ static int fm10k_set_channels(struct net_device *dev, ...@@ -1151,6 +1151,8 @@ static int fm10k_set_channels(struct net_device *dev,
} }
static const struct ethtool_ops fm10k_ethtool_ops = { static const struct ethtool_ops fm10k_ethtool_ops = {
.supported_coalesce_params = ETHTOOL_COALESCE_USECS |
ETHTOOL_COALESCE_USE_ADAPTIVE,
.get_strings = fm10k_get_strings, .get_strings = fm10k_get_strings,
.get_sset_count = fm10k_get_sset_count, .get_sset_count = fm10k_get_sset_count,
.get_ethtool_stats = fm10k_get_ethtool_stats, .get_ethtool_stats = fm10k_get_ethtool_stats,
......
...@@ -5249,6 +5249,11 @@ static const struct ethtool_ops i40e_ethtool_recovery_mode_ops = { ...@@ -5249,6 +5249,11 @@ static const struct ethtool_ops i40e_ethtool_recovery_mode_ops = {
}; };
static const struct ethtool_ops i40e_ethtool_ops = { static const struct ethtool_ops i40e_ethtool_ops = {
.supported_coalesce_params = ETHTOOL_COALESCE_USECS |
ETHTOOL_COALESCE_MAX_FRAMES_IRQ |
ETHTOOL_COALESCE_USE_ADAPTIVE |
ETHTOOL_COALESCE_RX_USECS_HIGH |
ETHTOOL_COALESCE_TX_USECS_HIGH,
.get_drvinfo = i40e_get_drvinfo, .get_drvinfo = i40e_get_drvinfo,
.get_regs_len = i40e_get_regs_len, .get_regs_len = i40e_get_regs_len,
.get_regs = i40e_get_regs, .get_regs = i40e_get_regs,
......
...@@ -996,6 +996,10 @@ static int iavf_set_rxfh(struct net_device *netdev, const u32 *indir, ...@@ -996,6 +996,10 @@ static int iavf_set_rxfh(struct net_device *netdev, const u32 *indir,
} }
static const struct ethtool_ops iavf_ethtool_ops = { static const struct ethtool_ops iavf_ethtool_ops = {
.supported_coalesce_params = ETHTOOL_COALESCE_USECS |
ETHTOOL_COALESCE_MAX_FRAMES |
ETHTOOL_COALESCE_MAX_FRAMES_IRQ |
ETHTOOL_COALESCE_USE_ADAPTIVE,
.get_drvinfo = iavf_get_drvinfo, .get_drvinfo = iavf_get_drvinfo,
.get_link = ethtool_op_get_link, .get_link = ethtool_op_get_link,
.get_ringparam = iavf_get_ringparam, .get_ringparam = iavf_get_ringparam,
......
...@@ -2183,27 +2183,6 @@ static int igb_set_coalesce(struct net_device *netdev, ...@@ -2183,27 +2183,6 @@ static int igb_set_coalesce(struct net_device *netdev,
struct igb_adapter *adapter = netdev_priv(netdev); struct igb_adapter *adapter = netdev_priv(netdev);
int i; int i;
if (ec->rx_max_coalesced_frames ||
ec->rx_coalesce_usecs_irq ||
ec->rx_max_coalesced_frames_irq ||
ec->tx_max_coalesced_frames ||
ec->tx_coalesce_usecs_irq ||
ec->stats_block_coalesce_usecs ||
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_low ||
ec->tx_max_coalesced_frames_low ||
ec->pkt_rate_high ||
ec->rx_coalesce_usecs_high ||
ec->rx_max_coalesced_frames_high ||
ec->tx_coalesce_usecs_high ||
ec->tx_max_coalesced_frames_high ||
ec->rate_sample_interval)
return -ENOTSUPP;
if ((ec->rx_coalesce_usecs > IGB_MAX_ITR_USECS) || if ((ec->rx_coalesce_usecs > IGB_MAX_ITR_USECS) ||
((ec->rx_coalesce_usecs > 3) && ((ec->rx_coalesce_usecs > 3) &&
(ec->rx_coalesce_usecs < IGB_MIN_ITR_USECS)) || (ec->rx_coalesce_usecs < IGB_MIN_ITR_USECS)) ||
...@@ -3477,6 +3456,7 @@ static int igb_set_priv_flags(struct net_device *netdev, u32 priv_flags) ...@@ -3477,6 +3456,7 @@ static int igb_set_priv_flags(struct net_device *netdev, u32 priv_flags)
} }
static const struct ethtool_ops igb_ethtool_ops = { static const struct ethtool_ops igb_ethtool_ops = {
.supported_coalesce_params = ETHTOOL_COALESCE_USECS,
.get_drvinfo = igb_get_drvinfo, .get_drvinfo = igb_get_drvinfo,
.get_regs_len = igb_get_regs_len, .get_regs_len = igb_get_regs_len,
.get_regs = igb_get_regs, .get_regs = igb_get_regs,
......
...@@ -424,6 +424,7 @@ static void igbvf_get_strings(struct net_device *netdev, u32 stringset, ...@@ -424,6 +424,7 @@ static void igbvf_get_strings(struct net_device *netdev, u32 stringset,
} }
static const struct ethtool_ops igbvf_ethtool_ops = { static const struct ethtool_ops igbvf_ethtool_ops = {
.supported_coalesce_params = ETHTOOL_COALESCE_RX_USECS,
.get_drvinfo = igbvf_get_drvinfo, .get_drvinfo = igbvf_get_drvinfo,
.get_regs_len = igbvf_get_regs_len, .get_regs_len = igbvf_get_regs_len,
.get_regs = igbvf_get_regs, .get_regs = igbvf_get_regs,
......
...@@ -861,27 +861,6 @@ static int igc_set_coalesce(struct net_device *netdev, ...@@ -861,27 +861,6 @@ static int igc_set_coalesce(struct net_device *netdev,
struct igc_adapter *adapter = netdev_priv(netdev); struct igc_adapter *adapter = netdev_priv(netdev);
int i; int i;
if (ec->rx_max_coalesced_frames ||
ec->rx_coalesce_usecs_irq ||
ec->rx_max_coalesced_frames_irq ||
ec->tx_max_coalesced_frames ||
ec->tx_coalesce_usecs_irq ||
ec->stats_block_coalesce_usecs ||
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_low ||
ec->tx_max_coalesced_frames_low ||
ec->pkt_rate_high ||
ec->rx_coalesce_usecs_high ||
ec->rx_max_coalesced_frames_high ||
ec->tx_coalesce_usecs_high ||
ec->tx_max_coalesced_frames_high ||
ec->rate_sample_interval)
return -ENOTSUPP;
if (ec->rx_coalesce_usecs > IGC_MAX_ITR_USECS || if (ec->rx_coalesce_usecs > IGC_MAX_ITR_USECS ||
(ec->rx_coalesce_usecs > 3 && (ec->rx_coalesce_usecs > 3 &&
ec->rx_coalesce_usecs < IGC_MIN_ITR_USECS) || ec->rx_coalesce_usecs < IGC_MIN_ITR_USECS) ||
...@@ -1915,6 +1894,7 @@ static int igc_set_link_ksettings(struct net_device *netdev, ...@@ -1915,6 +1894,7 @@ static int igc_set_link_ksettings(struct net_device *netdev,
} }
static const struct ethtool_ops igc_ethtool_ops = { static const struct ethtool_ops igc_ethtool_ops = {
.supported_coalesce_params = ETHTOOL_COALESCE_USECS,
.get_drvinfo = igc_get_drvinfo, .get_drvinfo = igc_get_drvinfo,
.get_regs_len = igc_get_regs_len, .get_regs_len = igc_get_regs_len,
.get_regs = igc_get_regs, .get_regs = igc_get_regs,
......
...@@ -3444,6 +3444,7 @@ static int ixgbe_set_priv_flags(struct net_device *netdev, u32 priv_flags) ...@@ -3444,6 +3444,7 @@ static int ixgbe_set_priv_flags(struct net_device *netdev, u32 priv_flags)
} }
static const struct ethtool_ops ixgbe_ethtool_ops = { static const struct ethtool_ops ixgbe_ethtool_ops = {
.supported_coalesce_params = ETHTOOL_COALESCE_USECS,
.get_drvinfo = ixgbe_get_drvinfo, .get_drvinfo = ixgbe_get_drvinfo,
.get_regs_len = ixgbe_get_regs_len, .get_regs_len = ixgbe_get_regs_len,
.get_regs = ixgbe_get_regs, .get_regs = ixgbe_get_regs,
......
...@@ -968,6 +968,7 @@ static int ixgbevf_set_priv_flags(struct net_device *netdev, u32 priv_flags) ...@@ -968,6 +968,7 @@ static int ixgbevf_set_priv_flags(struct net_device *netdev, u32 priv_flags)
} }
static const struct ethtool_ops ixgbevf_ethtool_ops = { static const struct ethtool_ops ixgbevf_ethtool_ops = {
.supported_coalesce_params = ETHTOOL_COALESCE_USECS,
.get_drvinfo = ixgbevf_get_drvinfo, .get_drvinfo = ixgbevf_get_drvinfo,
.get_regs_len = ixgbevf_get_regs_len, .get_regs_len = ixgbevf_get_regs_len,
.get_regs = ixgbevf_get_regs, .get_regs = ixgbevf_get_regs,
......
...@@ -211,6 +211,14 @@ bool ethtool_convert_link_mode_to_legacy_u32(u32 *legacy_u32, ...@@ -211,6 +211,14 @@ bool ethtool_convert_link_mode_to_legacy_u32(u32 *legacy_u32,
ETHTOOL_COALESCE_TX_MAX_FRAMES_IRQ) ETHTOOL_COALESCE_TX_MAX_FRAMES_IRQ)
#define ETHTOOL_COALESCE_USE_ADAPTIVE \ #define ETHTOOL_COALESCE_USE_ADAPTIVE \
(ETHTOOL_COALESCE_USE_ADAPTIVE_RX | ETHTOOL_COALESCE_USE_ADAPTIVE_TX) (ETHTOOL_COALESCE_USE_ADAPTIVE_RX | ETHTOOL_COALESCE_USE_ADAPTIVE_TX)
#define ETHTOOL_COALESCE_USECS_LOW_HIGH \
(ETHTOOL_COALESCE_RX_USECS_LOW | ETHTOOL_COALESCE_TX_USECS_LOW | \
ETHTOOL_COALESCE_RX_USECS_HIGH | ETHTOOL_COALESCE_TX_USECS_HIGH)
#define ETHTOOL_COALESCE_MAX_FRAMES_LOW_HIGH \
(ETHTOOL_COALESCE_RX_MAX_FRAMES_LOW | \
ETHTOOL_COALESCE_TX_MAX_FRAMES_LOW | \
ETHTOOL_COALESCE_RX_MAX_FRAMES_HIGH | \
ETHTOOL_COALESCE_TX_MAX_FRAMES_HIGH)
#define ETHTOOL_COALESCE_PKT_RATE_RX_USECS \ #define ETHTOOL_COALESCE_PKT_RATE_RX_USECS \
(ETHTOOL_COALESCE_USE_ADAPTIVE_RX | \ (ETHTOOL_COALESCE_USE_ADAPTIVE_RX | \
ETHTOOL_COALESCE_RX_USECS_LOW | ETHTOOL_COALESCE_RX_USECS_HIGH | \ ETHTOOL_COALESCE_RX_USECS_LOW | ETHTOOL_COALESCE_RX_USECS_HIGH | \
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment