浅析lwip网络接口卡是如何添加的
/**
* Call netif_add() in a thread-safe way by running that function inside the
* tcpip_thread context.
*
* @note for params @see netif_add()
*/
err_t
netifapi_netif_add(struct netif *netif,
struct ip_addr *ipaddr,
struct ip_addr *netmask,
struct ip_addr *gw,
void *state,
err_t (* init)(struct netif *netif),
err_t (* input)(struct pbuf *p, struct netif *netif))
向tcpip_thread线程发送id为TCPIP_MSG_NETIFAPI的mbox邮箱消息[luther.gliethttp
然后tcpip_thread线程将进一步调用netifapi_netif_add()函数中赋值的.function = do_netifapi_netif_add;
这样do_netifapi_netif_add==>netif_add()函数将实现网卡的添加工作[luther.gliethttp].
/** Generic data structure used for all lwIP network interfaces.
* The following fields should be filled in by the initialization
* function for the device driver: hwaddr_len, hwaddr[], mtu, flags */
struct netif {
....
};
所以
阅读(2401) | 评论(0) | 转发(0) |