[lib][minip] add a mechanism to wait for the stack to be configured
Configured in this case means an ip address assigned and a nic installed.
This commit is contained in:
committed by
Travis Geiselbrecht
parent
9caf62273c
commit
fe28bd8a95
@@ -9,6 +9,7 @@
|
||||
*/
|
||||
|
||||
#include <lk/err.h>
|
||||
#include <lk/init.h>
|
||||
#include <lk/trace.h>
|
||||
#include <arch/x86/mmu.h>
|
||||
#include <platform.h>
|
||||
@@ -300,9 +301,16 @@ void platform_init(void) {
|
||||
#endif
|
||||
|
||||
platform_init_mmu_mappings();
|
||||
}
|
||||
|
||||
#if WITH_LIB_MINIP
|
||||
extern int e1000_tx(pktbuf_t *p);
|
||||
minip_init_dhcp(e1000_tx, 0);
|
||||
#endif
|
||||
void _start_minip(uint level) {
|
||||
extern status_t e1000_register_with_minip(void);
|
||||
status_t err = e1000_register_with_minip();
|
||||
if (err == NO_ERROR) {
|
||||
minip_start_dhcp();
|
||||
}
|
||||
}
|
||||
|
||||
LK_INIT_HOOK(start_minip, _start_minip, LK_INIT_LEVEL_APPS - 1);
|
||||
#endif
|
||||
|
||||
@@ -226,16 +226,16 @@ void platform_init(void) {
|
||||
TRACEF("found virtio networking interface\n");
|
||||
|
||||
/* start minip */
|
||||
minip_set_macaddr(mac_addr);
|
||||
minip_set_eth(virtio_net_send_minip_pkt, NULL, mac_addr);
|
||||
|
||||
__UNUSED uint32_t ip_addr = IPV4(192, 168, 0, 99);
|
||||
__UNUSED uint32_t ip_mask = IPV4(255, 255, 255, 0);
|
||||
__UNUSED uint32_t ip_gateway = IPV4_NONE;
|
||||
|
||||
//minip_init(virtio_net_send_minip_pkt, NULL, ip_addr, ip_mask, ip_gateway);
|
||||
minip_init_dhcp(virtio_net_send_minip_pkt, NULL);
|
||||
|
||||
virtio_net_start();
|
||||
|
||||
//minip_start_static(ip_addr, ip_mask, ip_gateway);
|
||||
minip_start_dhcp();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -106,16 +106,16 @@ void platform_init(void) {
|
||||
TRACEF("found virtio networking interface\n");
|
||||
|
||||
/* start minip */
|
||||
minip_set_macaddr(mac_addr);
|
||||
minip_set_eth(virtio_net_send_minip_pkt, NULL, mac_addr);
|
||||
|
||||
__UNUSED uint32_t ip_addr = IPV4(192, 168, 0, 99);
|
||||
__UNUSED uint32_t ip_mask = IPV4(255, 255, 255, 0);
|
||||
__UNUSED uint32_t ip_gateway = IPV4_NONE;
|
||||
|
||||
//minip_init(virtio_net_send_minip_pkt, NULL, ip_addr, ip_mask, ip_gateway);
|
||||
minip_init_dhcp(virtio_net_send_minip_pkt, NULL);
|
||||
|
||||
virtio_net_start();
|
||||
|
||||
//minip_start_static(ip_addr, ip_mask, ip_gateway);
|
||||
minip_start_dhcp();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -198,16 +198,19 @@ void platform_init(void) {
|
||||
TRACEF("found virtio networking interface\n");
|
||||
|
||||
/* start minip */
|
||||
minip_set_macaddr(mac_addr);
|
||||
minip_set_eth(virtio_net_send_minip_pkt, NULL, mac_addr);
|
||||
|
||||
virtio_net_start();
|
||||
|
||||
#if 0
|
||||
__UNUSED uint32_t ip_addr = IPV4(192, 168, 0, 99);
|
||||
__UNUSED uint32_t ip_mask = IPV4(255, 255, 255, 0);
|
||||
__UNUSED uint32_t ip_gateway = IPV4_NONE;
|
||||
|
||||
//minip_init(virtio_net_send_minip_pkt, NULL, ip_addr, ip_mask, ip_gateway);
|
||||
minip_init_dhcp(virtio_net_send_minip_pkt, NULL);
|
||||
|
||||
virtio_net_start();
|
||||
minip_start_static(ip_addr, ip_mask, ip_gateway);
|
||||
#else
|
||||
minip_start_dhcp();
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user