From: Simon Kuenzer Date: Tue, 12 Oct 2021 15:19:03 +0000 (+0200) Subject: Probe network device features X-Git-Tag: RELEASE-0.8.0~2 X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=fdd235a400401b137aa64cb62111cda72a001ab7;p=unikraft%2Flibs%2Flwip.git Probe network device features Latest lib/uknetdev updates make it necessary that new network interfaces need to be probed for feature negotiation before the interface can be used. Signed-off-by: Simon Kuenzer Reviewed-by: Sergiu Moga Approved-by: Marc Rittinghaus Tested-by: Unikraft CI GitHub-Pull-Request: #10 --- diff --git a/init.c b/init.c index 5502bd3..584c0a5 100644 --- a/init.c +++ b/init.c @@ -138,6 +138,7 @@ static int liblwip_init(void) const char __maybe_unused *strcfg; uint16_t __maybe_unused int16cfg; int is_first_nf; + int ret; #if LWIP_IPV4 ip4_addr_t ip4; ip4_addr_t *ip4_arg; @@ -174,12 +175,25 @@ static int liblwip_init(void) dev = uk_netdev_get(devid); if (!dev) continue; - if (uk_netdev_state_get(dev) != UK_NETDEV_UNCONFIGURED) { + if (uk_netdev_state_get(dev) != UK_NETDEV_UNCONFIGURED + && uk_netdev_state_get(dev) != UK_NETDEV_UNPROBED) { uk_pr_info("Skipping to add network device %u to lwIP: Not in unconfigured state\n", devid); continue; } + if (uk_netdev_state_get(dev) == UK_NETDEV_UNPROBED) { + ret = uk_netdev_probe(dev); + if (ret < 0) { + uk_pr_err("Failed to probe features of network device %u: %d; skipping device...\n", + devid, ret); + continue; + } + } + + /* Here, the device has to be in unconfigured state */ + UK_ASSERT(uk_netdev_state_get(dev) == UK_NETDEV_UNCONFIGURED); + uk_pr_info("Attach network device %u to lwIP...\n", devid);