summaryrefslogtreecommitdiff
path: root/drivers/net/ethernet/freescale/dpaa2/dpaa2-ethtool.c
diff options
context:
space:
mode:
authorIoana Ciornei <ioana.ciornei@nxp.com>2021-10-15 12:01:27 +0300
committerDavid S. Miller <davem@davemloft.net>2021-10-15 14:32:41 +0100
commitfc398bec03879a7469f0c8e16567698b7d5d814c (patch)
tree3c0ece069ddb593aae8548e01fb21992a1cdb2c3 /drivers/net/ethernet/freescale/dpaa2/dpaa2-ethtool.c
parent69651bd8d303e0b4d160569de37d04512acd6b2f (diff)
net: dpaa2: add adaptive interrupt coalescing
Add support for adaptive interrupt coalescing to the dpaa2-eth driver. First of all, ETHTOOL_COALESCE_USE_ADAPTIVE_RX is defined as a supported coalesce parameter and the requested state is configured through the dpio APIs added in the previous patch. Besides the ethtool API interaction, we keep track of how many bytes and frames are dequeued per CDAN (Channel Data Availability Notification) and update the Net DIM instance through the dpaa2_io_update_net_dim() API. Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/freescale/dpaa2/dpaa2-ethtool.c')
-rw-r--r--drivers/net/ethernet/freescale/dpaa2/dpaa2-ethtool.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/drivers/net/ethernet/freescale/dpaa2/dpaa2-ethtool.c b/drivers/net/ethernet/freescale/dpaa2/dpaa2-ethtool.c
index 69a6860e11fa..adb8ce5306ee 100644
--- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-ethtool.c
+++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-ethtool.c
@@ -829,6 +829,7 @@ static int dpaa2_eth_get_coalesce(struct net_device *dev,
struct dpaa2_io *dpio = priv->channel[0]->dpio;
dpaa2_io_get_irq_coalescing(dpio, &ic->rx_coalesce_usecs);
+ ic->use_adaptive_rx_coalesce = dpaa2_io_get_adaptive_coalescing(dpio);
return 0;
}
@@ -840,17 +841,21 @@ static int dpaa2_eth_set_coalesce(struct net_device *dev,
{
struct dpaa2_eth_priv *priv = netdev_priv(dev);
struct dpaa2_io *dpio;
+ int prev_adaptive;
u32 prev_rx_usecs;
int i, j, err;
/* Keep track of the previous value, just in case we fail */
dpio = priv->channel[0]->dpio;
dpaa2_io_get_irq_coalescing(dpio, &prev_rx_usecs);
+ prev_adaptive = dpaa2_io_get_adaptive_coalescing(dpio);
/* Setup new value for rx coalescing */
for (i = 0; i < priv->num_channels; i++) {
dpio = priv->channel[i]->dpio;
+ dpaa2_io_set_adaptive_coalescing(dpio,
+ ic->use_adaptive_rx_coalesce);
err = dpaa2_io_set_irq_coalescing(dpio, ic->rx_coalesce_usecs);
if (err)
goto restore_rx_usecs;
@@ -863,13 +868,15 @@ restore_rx_usecs:
dpio = priv->channel[j]->dpio;
dpaa2_io_set_irq_coalescing(dpio, prev_rx_usecs);
+ dpaa2_io_set_adaptive_coalescing(dpio, prev_adaptive);
}
return err;
}
const struct ethtool_ops dpaa2_ethtool_ops = {
- .supported_coalesce_params = ETHTOOL_COALESCE_RX_USECS,
+ .supported_coalesce_params = ETHTOOL_COALESCE_RX_USECS |
+ ETHTOOL_COALESCE_USE_ADAPTIVE_RX,
.get_drvinfo = dpaa2_eth_get_drvinfo,
.nway_reset = dpaa2_eth_nway_reset,
.get_link = ethtool_op_get_link,