/** * Perform Sanity check of user-configurable values, and initialize all modules. */ void lwip_init(void) { /* Sanity check user-configurable values */ lwip_sanity_check(); /* Modules initialization */ stats_init(); #if !NO_SYS sys_init(); #endif /* !NO_SYS */ mem_init(); memp_init(); pbuf_init(); netif_init(); #if LWIP_SOCKET lwip_socket_init(); #endif /* LWIP_SOCKET */ ip_init(); #if LWIP_ARP etharp_init(); #endif /* LWIP_ARP */ #if LWIP_RAW raw_init(); #endif /* LWIP_RAW */ #if LWIP_UDP udp_init(); #endif /* LWIP_UDP */ #if LWIP_TCP tcp_init(); #endif /* LWIP_TCP */ #if LWIP_SNMP snmp_init(); #endif /* LWIP_SNMP */ #if LWIP_AUTOIP autoip_init(); #endif /* LWIP_AUTOIP */ #if LWIP_IGMP igmp_init(); #endif /* LWIP_IGMP */ #if LWIP_DNS dns_init(); #endif /* LWIP_DNS */ #if LWIP_TIMERS sys_timeouts_init(); #endif /* LWIP_TIMERS */ #if !NO_SYS /* in the Xilinx lwIP 1.2.0 port, lwip_init() was added as a convenience utility function to initialize all the lwIP layers. lwIP 1.3.0 introduced lwip_init() in the base lwIP itself. However a user cannot use lwip_init() regardless of whether it is raw or socket modes. The following call to lwip_sock_init() is made to make sure that lwIP is properly initialized in both raw & socket modes with just a call to lwip_init(). */ lwip_sock_init(); #endif }
/** * Perform Sanity check of user-configurable values, and initialize all modules. */ void lwip_init(void) { /* Sanity check user-configurable values */ lwip_sanity_check(); /* Modules initialization */ stats_init(); #if !NO_SYS sys_init(); #endif /* !NO_SYS */ mem_init(); memp_init(); pbuf_init(); netif_init(); #if LWIP_SOCKET lwip_socket_init(); #endif /* LWIP_SOCKET */ ip_init(); #if LWIP_ARP etharp_init(); #endif /* LWIP_ARP */ #if LWIP_RAW raw_init(); #endif /* LWIP_RAW */ #if LWIP_UDP udp_init(); #endif /* LWIP_UDP */ #if LWIP_TCP tcp_init(); #endif /* LWIP_TCP */ #if LWIP_SNMP snmp_init(); #endif /* LWIP_SNMP */ #if LWIP_AUTOIP autoip_init(); #endif /* LWIP_AUTOIP */ #if LWIP_IGMP igmp_init(); #endif /* LWIP_IGMP */ #if LWIP_DNS dns_init(); #endif /* LWIP_DNS */ #if LWIP_TIMERS sys_timeouts_init(); #endif /* LWIP_TIMERS */ }
/** * Perform Sanity check of user-configurable values, and initialize all modules. */ void lwip_init(void) { lwip_init_globals(); /* Sanity check user-configurable values */ lwip_sanity_check(); /* Modules initialization */ stats_init(); sys_init(); mem_init(); memp_init(); pbuf_init(); netif_init(); #if LWIP_SOCKET lwip_socket_init(); #endif /* LWIP_SOCKET */ ip_init(); #if LWIP_ARP etharp_init(); #endif /* LWIP_ARP */ #if LWIP_RAW raw_init(); #endif /* LWIP_RAW */ #if LWIP_UDP udp_init(); #endif /* LWIP_UDP */ #if LWIP_TCP /* Initialize the network stack */ // [MS_CHANGE] - tcpip_init() is a no-op. This method actually initializes the tcpip stack. tcpip_init(NULL,NULL); #endif /* LWIP_TCP */ #if LWIP_SNMP snmp_init(); #endif /* LWIP_SNMP */ #if LWIP_AUTOIP autoip_init(); #endif /* LWIP_AUTOIP */ #if LWIP_IGMP igmp_init(); #endif /* LWIP_IGMP */ #if LWIP_DNS dns_init(); #endif /* LWIP_DNS */ }
/** * Perform Sanity check of user-configurable values, and initialize all modules. * * \param card_name Name of service implementing ethernet driver * \param queueid Queueid which is allocated to this application * \param opt_waitset Optional pointer to waitset to be used by LWIP * \param opt_mutex Optional pointer to mutex to protect multi-threaded domains * * \returns True iff init completes */ bool lwip_init_ex(const char *card_name, uint64_t queueid, struct waitset *opt_waitset, struct thread_mutex *opt_mutex) { printf("lwip_init_ex: starting......................\n"); DEBUGPRINTPS("LWIP_other: Inside lwip_init\n"); static bool run_once; if (run_once) { return false; } run_once = true; if (opt_waitset == NULL) { printf("#### %s Going ahead with default wait-set\n", disp_name()); lwip_waitset = get_default_waitset(); } else { printf("#### %s Going ahead with non-default wait-set\n", disp_name()); // lwip_waitset = get_default_waitset(); lwip_waitset = opt_waitset; } if (opt_mutex != NULL) { lwip_mutex = opt_mutex; } /* Sanity check user-configurable values */ lwip_sanity_check(); DEBUGPRINTPS("LWIP: lwip_init: done with sanity check\n"); printf("LWIP: done with sanity check\n"); /* Modules initialization */ char port_manager_name[MAX_NET_SERVICE_NAME_LEN]; snprintf(port_manager_name, sizeof(port_manager_name), "%s%s", card_name, NET_PORTS_MNG_SUFFIX); // Connecting to the port_manager_service idc_connect_port_manager_service(port_manager_name); if (is_ctl != 1) { // connecting to ARP lookup service // Doing this before everything else so that we know all needed // services are up and running. char ARP_service_name[MAX_NET_SERVICE_NAME_LEN]; snprintf(ARP_service_name, sizeof(ARP_service_name), "%s%s", card_name, NET_ARP_LOOKUP_SUFFIX); idc_connect_ARP_lookup_service(ARP_service_name); } DEBUGPRINTPS("LWIP: lwip_init: done with connection setup\n"); printf("LWIP: done with connection setup\n"); remaining_lwip_initialization((char *) card_name, queueid); if (is_ctl != 1) { DEBUGPRINTPS("getting IP from ARP service\n"); printf("LWIP: getting IP from ARP service\n"); idc_get_ip_from_ARP_lookup(); } // Register timers... (TCP only) // FIXME: These timers should be added only when first TCP connection // is requested and not when networking is started!!!! static struct periodic_event tcp_timer; errval_t err = periodic_event_create(&tcp_timer, lwip_waitset, TCP_TMR_INTERVAL * 1000, MKCLOSURE((void (*)(void *)) call_tcp_tmr, NULL)); assert(err_is_ok(err)); // FIXME: I am not sure if this should be in the codepath for both // is_ctl and non-is_ctl. Specially becasuse non is_ctl is anyways // adding one interface with idc_get_ip* call. // Bring interface up struct ip_addr ipaddr, netmask, gw; ip_addr_set(&ipaddr, IP_ADDR_ANY); ip_addr_set(&netmask, IP_ADDR_ANY); ip_addr_set(&gw, IP_ADDR_ANY); struct netif *n = netif_add(&netif, &ipaddr, &netmask, &gw, NULL, bfeth_init, ethernet_input); assert(n != NULL); extern bool lwip_init_done; lwip_init_done = true; printf("lwip_init_ex: done......................\n"); return true; }