Skip to content

Commit a64b442

Browse files
IoanaCiorneidavem330
authored andcommitted
net: dpaa2: add support for manual setup of IRQ coalesing
Use the newly exported dpio driver API to manually configure the IRQ coalescing parameters requested by the user. The .get_coalesce() and .set_coalesce() net_device callbacks are implemented and directly export or setup the rx-usecs on all the channels configured. Signed-off-by: Ioana Ciornei <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent ed1d214 commit a64b442

File tree

1 file changed

+51
-0
lines changed

1 file changed

+51
-0
lines changed

drivers/net/ethernet/freescale/dpaa2/dpaa2-ethtool.c

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -820,7 +820,56 @@ static int dpaa2_eth_set_tunable(struct net_device *net_dev,
820820
return err;
821821
}
822822

823+
static int dpaa2_eth_get_coalesce(struct net_device *dev,
824+
struct ethtool_coalesce *ic,
825+
struct kernel_ethtool_coalesce *kernel_coal,
826+
struct netlink_ext_ack *extack)
827+
{
828+
struct dpaa2_eth_priv *priv = netdev_priv(dev);
829+
struct dpaa2_io *dpio = priv->channel[0]->dpio;
830+
831+
dpaa2_io_get_irq_coalescing(dpio, &ic->rx_coalesce_usecs);
832+
833+
return 0;
834+
}
835+
836+
static int dpaa2_eth_set_coalesce(struct net_device *dev,
837+
struct ethtool_coalesce *ic,
838+
struct kernel_ethtool_coalesce *kernel_coal,
839+
struct netlink_ext_ack *extack)
840+
{
841+
struct dpaa2_eth_priv *priv = netdev_priv(dev);
842+
struct dpaa2_io *dpio;
843+
u32 prev_rx_usecs;
844+
int i, j, err;
845+
846+
/* Keep track of the previous value, just in case we fail */
847+
dpio = priv->channel[0]->dpio;
848+
dpaa2_io_get_irq_coalescing(dpio, &prev_rx_usecs);
849+
850+
/* Setup new value for rx coalescing */
851+
for (i = 0; i < priv->num_channels; i++) {
852+
dpio = priv->channel[i]->dpio;
853+
854+
err = dpaa2_io_set_irq_coalescing(dpio, ic->rx_coalesce_usecs);
855+
if (err)
856+
goto restore_rx_usecs;
857+
}
858+
859+
return 0;
860+
861+
restore_rx_usecs:
862+
for (j = 0; j < i; j++) {
863+
dpio = priv->channel[j]->dpio;
864+
865+
dpaa2_io_set_irq_coalescing(dpio, prev_rx_usecs);
866+
}
867+
868+
return err;
869+
}
870+
823871
const struct ethtool_ops dpaa2_ethtool_ops = {
872+
.supported_coalesce_params = ETHTOOL_COALESCE_RX_USECS,
824873
.get_drvinfo = dpaa2_eth_get_drvinfo,
825874
.nway_reset = dpaa2_eth_nway_reset,
826875
.get_link = ethtool_op_get_link,
@@ -836,4 +885,6 @@ const struct ethtool_ops dpaa2_ethtool_ops = {
836885
.get_ts_info = dpaa2_eth_get_ts_info,
837886
.get_tunable = dpaa2_eth_get_tunable,
838887
.set_tunable = dpaa2_eth_set_tunable,
888+
.get_coalesce = dpaa2_eth_get_coalesce,
889+
.set_coalesce = dpaa2_eth_set_coalesce,
839890
};

0 commit comments

Comments
 (0)