/* This function will unregister network interface device and delete it from network interface device list. */
int netdev_unregister(struct netdev *netdev)
/* This function will unregister network interface device and delete it from network interface device list. */
int netdev_unregister(struct netdev *netdev)
{
    slist_t *node = NULL;
    struct netdev *cur_netdev = NULL;
    ASSERT(netdev);
    if (netdev_list == NULL)
    {
        return -1;
    }
    CPSR_ALLOC();
    RHINO_CPU_INTRPT_DISABLE();
    slist_for_each_entry_safe(&(netdev_list->list), node, cur_netdev, struct netdev, list)
    {
        if (cur_netdev && (memcmp(cur_netdev, netdev, sizeof(struct netdev)) == 0))
        {
            slist_del(&(cur_netdev->list), &(netdev_list->list));
            RHINO_CPU_INTRPT_ENABLE();
            return 0;
        }
    }
    RHINO_CPU_INTRPT_ENABLE();
    return -1;
}