Chinaunix首页 | 论坛 | 博客
  • 博客访问: 15339216
  • 博文数量: 2005
  • 博客积分: 11986
  • 博客等级: 上将
  • 技术积分: 22535
  • 用 户 组: 普通用户
  • 注册时间: 2007-05-17 13:56
文章分类

全部博文(2005)

文章存档

2014年(2)

2013年(2)

2012年(16)

2011年(66)

2010年(368)

2009年(743)

2008年(491)

2007年(317)

分类:

2009-10-23 17:27:10

浅析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 {
    ....
};

所以

阅读(2338) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~