From 0330ef2df069d5d1a76abf2c3477201dbece7868 Mon Sep 17 00:00:00 2001 From: Simon Kuenzer Date: Thu, 3 Dec 2020 00:32:14 +0100 Subject: [PATCH] Option to force polling mode Introduces an option to force polling mode for uknetdev devices irrespective if the device supports interrupt-driven mode. Because this option always causes 100% CPU utilization it should be considered as workaround for cases where interrupt-based handling performs badly. Signed-off-by: Simon Kuenzer Reviewed-by: Cezar Craciunoiu --- Config.uk | 14 ++++++++++++++ uknetdev.c | 4 ++++ 2 files changed, 18 insertions(+) diff --git a/Config.uk b/Config.uk index 658e272..6d1fdb1 100644 --- a/Config.uk +++ b/Config.uk @@ -23,6 +23,20 @@ config LWIP_UKNETDEV driver does not support receive interrupts the network interfaces have to be polled manually (uknetdev_poll()). +if LWIP_UKNETDEV +config LWIP_UKNETDEV_POLLONLY + depends on LWIP_THREADS + bool "Force polling mode (workaround)" + default n + help + This option forces polling mode for uknetdev devices + irrespective if the device supports interrupt-driven + mode. + Because this option always causes 100% CPU utilization + it should be considered as workaround for cases where + interrupt-based handling performs badly. +endif + config LWIP_UKNETDEV_SCRATCH int default 64 diff --git a/uknetdev.c b/uknetdev.c index 0524f12..b665830 100644 --- a/uknetdev.c +++ b/uknetdev.c @@ -477,6 +477,10 @@ err_t uknetdev_init(struct netif *nf) if (!lwip_data->dev_info.max_rx_queues || !lwip_data->dev_info.max_tx_queues) return ERR_IF; +#if CONFIG_LWIP_UKNETDEV_POLLONLY + /* Unset receive interrupt support: We force polling mode */ + lwip_data->dev_info.features &= ~UK_FEATURE_RXQ_INTR_AVAILABLE; +#endif /* CONFIG_LWIP_UKNETDEV_POLLONLY */ lwip_data->pkt_a = a; LWIP_DEBUGF(NETIF_DEBUG, -- 2.39.5