Skip to content

Commit e443d15

Browse files
scosumarckleinebudde
authored andcommitted
can: m_can: Limit coalescing to peripheral instances
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>
1 parent 733dbf5 commit e443d15

1 file changed

Lines changed: 9 additions & 7 deletions

File tree

drivers/net/can/m_can/m_can.c

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2184,7 +2184,7 @@ static int m_can_set_coalesce(struct net_device *dev,
21842184
return 0;
21852185
}
21862186

2187-
static const struct ethtool_ops m_can_ethtool_ops = {
2187+
static const struct ethtool_ops m_can_ethtool_ops_coalescing = {
21882188
.supported_coalesce_params = ETHTOOL_COALESCE_RX_USECS_IRQ |
21892189
ETHTOOL_COALESCE_RX_MAX_FRAMES_IRQ |
21902190
ETHTOOL_COALESCE_TX_USECS_IRQ |
@@ -2195,18 +2195,20 @@ static const struct ethtool_ops m_can_ethtool_ops = {
21952195
.set_coalesce = m_can_set_coalesce,
21962196
};
21972197

2198-
static const struct ethtool_ops m_can_ethtool_ops_polling = {
2198+
static const struct ethtool_ops m_can_ethtool_ops = {
21992199
.get_ts_info = ethtool_op_get_ts_info,
22002200
};
22012201

2202-
static int register_m_can_dev(struct net_device *dev)
2202+
static int register_m_can_dev(struct m_can_classdev *cdev)
22032203
{
2204+
struct net_device *dev = cdev->net;
2205+
22042206
dev->flags |= IFF_ECHO; /* we support local echo */
22052207
dev->netdev_ops = &m_can_netdev_ops;
2206-
if (dev->irq)
2207-
dev->ethtool_ops = &m_can_ethtool_ops;
2208+
if (dev->irq && cdev->is_peripheral)
2209+
dev->ethtool_ops = &m_can_ethtool_ops_coalescing;
22082210
else
2209-
dev->ethtool_ops = &m_can_ethtool_ops_polling;
2211+
dev->ethtool_ops = &m_can_ethtool_ops;
22102212

22112213
return register_candev(dev);
22122214
}
@@ -2392,7 +2394,7 @@ int m_can_class_register(struct m_can_classdev *cdev)
23922394
if (ret)
23932395
goto rx_offload_del;
23942396

2395-
ret = register_m_can_dev(cdev->net);
2397+
ret = register_m_can_dev(cdev);
23962398
if (ret) {
23972399
dev_err(cdev->dev, "registering %s failed (err=%d)\n",
23982400
cdev->net->name, ret);

0 commit comments

Comments
 (0)