3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-12-21 11:42:46 +01:00

netdev: Set callbacks for operstate

When setting operstate to dormant or down, give it a callback for debug
purposes.  It looks like that operstate down message does not have a
chance to go out currently.
This commit is contained in:
Denis Kenzior 2016-06-21 15:18:50 -05:00
parent 844c0a256c
commit dc721a6ae2

View File

@ -204,6 +204,20 @@ bool netdev_get_is_up(struct netdev *netdev)
return netdev->up;
}
static void netdev_operstate_dormant_cb(bool success, void *user_data)
{
struct netdev *netdev = user_data;
l_debug("netdev: %d, success: %d", netdev->index, success);
}
static void netdev_operstate_down_cb(bool success, void *user_data)
{
uint32_t index = L_PTR_TO_UINT(user_data);
l_debug("netdev: %d, success: %d", index, success);
}
static void netdev_free(void *data)
{
struct netdev *netdev = data;
@ -224,7 +238,8 @@ static void netdev_free(void *data)
netdev->eapol_io = NULL;
netdev_set_linkmode_and_operstate(netdev->index, 0, IF_OPER_DOWN,
NULL, NULL);
netdev_operstate_down_cb,
L_UINT_TO_PTR(netdev->index));
l_queue_destroy(netdev->watches, l_free);
@ -1154,7 +1169,9 @@ static void netdev_get_interface_callback(struct l_genl_msg *msg,
l_queue_push_tail(netdev_list, netdev);
netdev_set_linkmode_and_operstate(netdev->index, 1,
IF_OPER_DORMANT, NULL, NULL);
IF_OPER_DORMANT,
netdev_operstate_dormant_cb,
netdev);
l_debug("Found interface %s[%d]", netdev->name, netdev->index);
device_create(wiphy, netdev);