]> xenbits.xensource.com Git - unikraft/libs/lwip.git/commitdiff
Option to force polling mode RELEASE-0.5
authorSimon Kuenzer <simon.kuenzer@neclab.eu>
Wed, 2 Dec 2020 23:32:14 +0000 (00:32 +0100)
committerSimon Kuenzer <simon.kuenzer@neclab.eu>
Mon, 21 Dec 2020 10:46:48 +0000 (11:46 +0100)
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 <simon.kuenzer@neclab.eu>
Reviewed-by: Cezar Craciunoiu <cezar.craciunoiu@gmail.com>
Config.uk
uknetdev.c

index 658e272e2de546a09869c551d1e00bef0eaec383..6d1fdb1a20f3fe9d63774a74b851a00b2c1f56b0 100644 (file)
--- 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
index 0524f12fde53aa3d133d94a37bd67bf3277a8094..b665830e1f6fb0e278d232d4d99ac493f2e67c47 100644 (file)
@@ -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,