runtime: move static arp entry creation to late init phase
after per-thread smalloc initializer runs
@@ -342,13 +342,27 @@ int arp_lookup(uint32_t daddr, struct eth_addr *dhost_out, struct mbuf *m)
*/
int arp_init(void)
{
- int i, idx;
- struct arp_entry *e;
+ int i;
spin_lock_init(&arp_lock);
for (i = 0; i < ARP_TABLE_CAPACITY; i++)
rcu_hlist_init_head(&arp_tbl[i]);
+ return 0;
+}
+
+/**
+ * arp_init_late - starts the ARP worker thread
+ *
+ * Returns 0 if successful.
+ */
+int arp_init_late(void)
+{
+ int i, idx;
+ struct arp_entry *e;
+
+ spin_lock_np(&arp_lock);
+
for (i = 0; i < arp_static_count; i++) {
e = create_entry(static_entries[i].ip);
if (!e)
@@ -359,15 +373,7 @@ int arp_init(void)
rcu_hlist_add_head(&arp_tbl[idx], &e->link);
}
- return 0;
-}
+ spin_unlock_np(&arp_lock);
-/**
- * arp_init_late - starts the ARP worker thread
- *
- * Returns 0 if successful.
- */
-int arp_init_late(void)
-{
return thread_spawn(arp_worker, NULL);
}
