MCPcopy Create free account
hub / github.com/RT-Thread/rt-thread / netdev_set_up

Function netdev_set_up

components/net/netdev/src/netdev.c:520–547  ·  view source on GitHub ↗

* This function will enable network interface device . * * @param netdev the network interface device to change * * @return 0: set status successfully * -1: set status failed */

Source from the content-addressed store, hash-verified

518 * -1: set status failed
519 */
520int netdev_set_up(struct netdev *netdev)
521{
522 int err = 0;
523
524 RT_ASSERT(netdev);
525
526 if (!netdev->ops || !netdev->ops->set_up)
527 {
528 LOG_E("The network interface device(%s) not support to set status.", netdev->name);
529 return -RT_ERROR;
530 }
531
532 /* network interface device status flags check */
533 if (netdev_is_up(netdev))
534 {
535 return RT_EOK;
536 }
537
538 /* execute enable network interface device operations by network interface device driver */
539 err = netdev->ops->set_up(netdev);
540
541#if defined(SAL_USING_AF_NETLINK)
542 if (err)
543 rtnl_ip_notify(netdev, RTM_NEWLINK);
544#endif
545
546 return err;
547}
548/**
549 * This function will disable network interface device.
550 *

Callers 2

sal_ioctlsocketFunction · 0.85
test_netdev_status_setFunction · 0.85

Calls

no outgoing calls

Tested by 1

test_netdev_status_setFunction · 0.68