Skip to content

Commit 6ac0bbf

Browse files
authored
Merge pull request #17893 from benpicco/gnrc_ipv6_nib_iface_up
gnrc_netif: handle NETDEV_EVENT_LINK_UP/DOWN events
2 parents c2a1afa + 838a5e4 commit 6ac0bbf

File tree

28 files changed

+189
-22
lines changed

28 files changed

+189
-22
lines changed

cpu/esp_common/esp-now/esp_now_netdev.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -487,6 +487,9 @@ static int _init(netdev_t *netdev)
487487
{
488488
DEBUG("%s: %p\n", __func__, netdev);
489489

490+
/* signal link UP */
491+
netdev->event_callback(netdev, NETDEV_EVENT_LINK_UP);
492+
490493
return 0;
491494
}
492495

cpu/native/netdev_tap/netdev_tap.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -404,5 +404,9 @@ static int _init(netdev_t *netdev)
404404
native_async_read_add_handler(dev->tap_fd, netdev, _tap_isr);
405405

406406
DEBUG("gnrc_tapnet: initialized.\n");
407+
408+
/* signal link UP */
409+
netdev->event_callback(netdev, NETDEV_EVENT_LINK_UP);
410+
407411
return 0;
408412
}

cpu/nrf5x_common/radio/nrfble/nrfble.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -279,6 +279,10 @@ static int _nrfble_init(netdev_t *dev)
279279
NVIC_EnableIRQ(RADIO_IRQn);
280280

281281
DEBUG("[nrfble] initialization successful\n");
282+
283+
/* signal link UP */
284+
dev->event_callback(dev, NETDEV_EVENT_LINK_UP);
285+
282286
return 0;
283287
}
284288

cpu/nrf5x_common/radio/nrfmin/nrfmin.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -448,6 +448,9 @@ static int nrfmin_init(netdev_t *dev)
448448

449449
DEBUG("[nrfmin] initialization successful\n");
450450

451+
/* signal link UP */
452+
dev->event_callback(dev, NETDEV_EVENT_LINK_UP);
453+
451454
return 0;
452455
}
453456

cpu/sam0_common/sam0_eth/eth-netdev.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,10 @@ static int _sam0_eth_init(netdev_t *netdev)
5555
eui48_t hwaddr;
5656
netdev_eui48_get(netdev, &hwaddr);
5757
sam0_eth_set_mac(&hwaddr);
58+
59+
/* signal link UP */
60+
netdev->event_callback(netdev, NETDEV_EVENT_LINK_UP);
61+
5862
return 0;
5963
}
6064

cpu/stm32/periph/eth.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -460,6 +460,11 @@ static int stm32_eth_init(netdev_t *netdev)
460460

461461
_setup_phy();
462462

463+
/* signal link UP if no proper link detection is enabled */
464+
if (!IS_USED(MODULE_STM32_ETH_LINK_UP)) {
465+
netdev->event_callback(netdev, NETDEV_EVENT_LINK_UP);
466+
}
467+
463468
return 0;
464469
}
465470

drivers/at86rf215/at86rf215_netdev.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,9 @@ static int _init(netdev_t *netdev)
137137
/* reset device to default values and put it into RX state */
138138
at86rf215_reset_and_cfg(dev);
139139

140+
/* signal link UP */
141+
netdev->event_callback(netdev, NETDEV_EVENT_LINK_UP);
142+
140143
return 0;
141144
}
142145

drivers/at86rf2xx/at86rf2xx_netdev.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,9 @@ static int _init(netdev_t *netdev)
108108
/* reset device to default values and put it into RX state */
109109
at86rf2xx_reset(dev);
110110

111+
/* signal link UP */
112+
netdev->event_callback(netdev, NETDEV_EVENT_LINK_UP);
113+
111114
return 0;
112115
}
113116

drivers/cc110x/cc110x_netdev.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -343,6 +343,10 @@ static int cc110x_init(netdev_t *netdev)
343343
}
344344

345345
DEBUG("[cc110x] netdev_driver_t::init(): Success\n");
346+
347+
/* signal link UP */
348+
netdev->event_callback(netdev, NETDEV_EVENT_LINK_UP);
349+
346350
return 0;
347351
}
348352

drivers/cc2420/cc2420_netdev.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,13 @@ static int _init(netdev_t *netdev)
136136
return -1;
137137
}
138138

139-
return cc2420_init(dev);
139+
int res = cc2420_init(dev);
140+
if (res == 0) {
141+
/* signal link UP */
142+
netdev->event_callback(netdev, NETDEV_EVENT_LINK_UP);
143+
}
144+
145+
return res;
140146
}
141147

142148
static void _isr(netdev_t *netdev)

0 commit comments

Comments
 (0)