[PATCH v2] net: pxa168_eth: add netconsole support
From: Alexander Monakov <hidden>
Date: 2018-02-01 19:45:23
Subsystem:
networking drivers, the rest · Maintainers:
Andrew Lunn, "David S. Miller", Eric Dumazet, Jakub Kicinski, Paolo Abeni, Linus Torvalds
This implements ndo_poll_controller callback which is necessary to enable netconsole. Signed-off-by: Alexander Monakov <redacted> Cc: Russell King <redacted> Cc: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com> Cc: Florian Fainelli <f.fainelli@gmail.com> --- Here's the revised patch that performs interrupt disabling correctly as far as I can tell. It's still unclear to me why some drivers use local_irq_save/restore: 1. netconsole must have already disabled local interrupts, and netpoll verifies that; so local_irq_save in ndo_poll_controller must be a nop. 2. local disabling does not ensure that we wouldn't race with the irq handler in progress on some other cpu (but disable_irq does). Please let me know if I'm missing something. Thanks. Alexander drivers/net/ethernet/marvell/pxa168_eth.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
diff --git a/drivers/net/ethernet/marvell/pxa168_eth.c b/drivers/net/ethernet/marvell/pxa168_eth.c
index 7bbd86f08e5f..3a9730612a70 100644
--- a/drivers/net/ethernet/marvell/pxa168_eth.c
+++ b/drivers/net/ethernet/marvell/pxa168_eth.c@@ -1362,6 +1362,15 @@ static int pxa168_eth_do_ioctl(struct net_device *dev, struct ifreq *ifr, return -EOPNOTSUPP; } +#ifdef CONFIG_NET_POLL_CONTROLLER +static void pxa168_eth_netpoll(struct net_device *dev) +{ + disable_irq(dev->irq); + pxa168_eth_int_handler(dev->irq, dev); + enable_irq(dev->irq); +} +#endif + static void pxa168_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info) {
@@ -1390,6 +1399,9 @@ static const struct net_device_ops pxa168_eth_netdev_ops = { .ndo_do_ioctl = pxa168_eth_do_ioctl, .ndo_change_mtu = pxa168_eth_change_mtu, .ndo_tx_timeout = pxa168_eth_tx_timeout, +#ifdef CONFIG_NET_POLL_CONTROLLER + .ndo_poll_controller = pxa168_eth_netpoll, +#endif }; static int pxa168_eth_probe(struct platform_device *pdev)
--
2.11.0