The patch looks good to me.
On 2020-12-03 01:32:35, Simon Kuenzer <simon.kuenzer@xxxxxxxxx> wrote:
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
---
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.20.1