net/dev: link the net device as order of registration
Signed-off-by: chao.an <anchao@xiaomi.com>
This commit is contained in:
parent
7ac6c0a8de
commit
70f6eb232a
@ -240,6 +240,7 @@ static int get_ifindex(void)
|
|||||||
|
|
||||||
int netdev_register(FAR struct net_driver_s *dev, enum net_lltype_e lltype)
|
int netdev_register(FAR struct net_driver_s *dev, enum net_lltype_e lltype)
|
||||||
{
|
{
|
||||||
|
FAR struct net_driver_s **last;
|
||||||
FAR char devfmt_str[IFNAMSIZ];
|
FAR char devfmt_str[IFNAMSIZ];
|
||||||
FAR const char *devfmt;
|
FAR const char *devfmt;
|
||||||
uint16_t pktsize = 0;
|
uint16_t pktsize = 0;
|
||||||
@ -428,8 +429,15 @@ int netdev_register(FAR struct net_driver_s *dev, enum net_lltype_e lltype)
|
|||||||
|
|
||||||
/* Add the device to the list of known network devices */
|
/* Add the device to the list of known network devices */
|
||||||
|
|
||||||
dev->flink = g_netdevices;
|
last = &g_netdevices;
|
||||||
g_netdevices = dev;
|
while (*last)
|
||||||
|
{
|
||||||
|
last = &((*last)->flink);
|
||||||
|
}
|
||||||
|
|
||||||
|
*last = dev;
|
||||||
|
|
||||||
|
dev->flink = NULL;
|
||||||
|
|
||||||
#ifdef CONFIG_NET_IGMP
|
#ifdef CONFIG_NET_IGMP
|
||||||
/* Configure the device for IGMP support */
|
/* Configure the device for IGMP support */
|
||||||
|
Loading…
Reference in New Issue
Block a user