]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
can: m_can: Limit coalescing to peripheral instances
authorMarkus Schneider-Pargmann <msp@baylibre.com>
Mon, 5 Aug 2024 18:30:47 +0000 (20:30 +0200)
committerMarc Kleine-Budde <mkl@pengutronix.de>
Tue, 6 Aug 2024 07:25:31 +0000 (09:25 +0200)
The use of coalescing for non-peripheral chips in the current
implementation is limited to non-existing. Disable the possibility to
set coalescing through ethtool.

Signed-off-by: Markus Schneider-Pargmann <msp@baylibre.com>
Link: https://lore.kernel.org/all/20240805183047.305630-8-msp@baylibre.com
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
drivers/net/can/m_can/m_can.c

index 67c4c740c416f37d18eb44e6e8bd9ca30439b357..012c3d22b01dd3d8558f2a40448770ca1da1aa1e 100644 (file)
@@ -2184,7 +2184,7 @@ static int m_can_set_coalesce(struct net_device *dev,
        return 0;
 }
 
-static const struct ethtool_ops m_can_ethtool_ops = {
+static const struct ethtool_ops m_can_ethtool_ops_coalescing = {
        .supported_coalesce_params = ETHTOOL_COALESCE_RX_USECS_IRQ |
                ETHTOOL_COALESCE_RX_MAX_FRAMES_IRQ |
                ETHTOOL_COALESCE_TX_USECS_IRQ |
@@ -2195,18 +2195,20 @@ static const struct ethtool_ops m_can_ethtool_ops = {
        .set_coalesce = m_can_set_coalesce,
 };
 
-static const struct ethtool_ops m_can_ethtool_ops_polling = {
+static const struct ethtool_ops m_can_ethtool_ops = {
        .get_ts_info = ethtool_op_get_ts_info,
 };
 
-static int register_m_can_dev(struct net_device *dev)
+static int register_m_can_dev(struct m_can_classdev *cdev)
 {
+       struct net_device *dev = cdev->net;
+
        dev->flags |= IFF_ECHO; /* we support local echo */
        dev->netdev_ops = &m_can_netdev_ops;
-       if (dev->irq)
-               dev->ethtool_ops = &m_can_ethtool_ops;
+       if (dev->irq && cdev->is_peripheral)
+               dev->ethtool_ops = &m_can_ethtool_ops_coalescing;
        else
-               dev->ethtool_ops = &m_can_ethtool_ops_polling;
+               dev->ethtool_ops = &m_can_ethtool_ops;
 
        return register_candev(dev);
 }
@@ -2392,7 +2394,7 @@ int m_can_class_register(struct m_can_classdev *cdev)
        if (ret)
                goto rx_offload_del;
 
-       ret = register_m_can_dev(cdev->net);
+       ret = register_m_can_dev(cdev);
        if (ret) {
                dev_err(cdev->dev, "registering %s failed (err=%d)\n",
                        cdev->net->name, ret);