Force networking thread to wakeup at link_up and link_down in wifi.c

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
hachc_2137126
Level 5
Level 5
10 likes given 5 likes given First like received

Hi,

Just a question about the consistence of managing networking thread while doing notification of link status.

Is anyone know the reason that why it doesn't need to *force wake up* networking thread at link_up case?

I happened to see the missing of link_up callback been called successfully to my application, is this related to this design?

static void link_up( void )

{

    if ( wiced_sta_link_up == WICED_FALSE )

    {

        wiced_network_notify_link_up( WICED_STA_INTERFACE );

        wiced_rtos_send_asynchronous_event( WICED_NETWORKING_WORKER_THREAD, wiced_wireless_link_up_handler, 0 );

        wiced_sta_link_up = WICED_TRUE;

    }

    else

    {

        wiced_rtos_send_asynchronous_event( WICED_NETWORKING_WORKER_THREAD, wiced_wireless_link_renew_handler, 0 );

    }

}

static void link_down( void )

{

    if ( wiced_sta_link_up == WICED_TRUE )

    {

        /* Notify network stack that the link is down. Further processing will be done in the link down handler */

        wiced_network_notify_link_down( WICED_STA_INTERFACE );

        /* Force awake the networking thread. It might still be blocked on receive or send timeouts */

        wiced_rtos_thread_force_awake( &(WICED_NETWORKING_WORKER_THREAD->thread) );

        wiced_rtos_send_asynchronous_event( WICED_NETWORKING_WORKER_THREAD, wiced_wireless_link_down_handler, 0 );

        wiced_sta_link_up = WICED_FALSE;

    }

}

0 Likes
1 Solution
Anonymous
Not applicable

Force wake is not needed for link up because when link is down there should be no other activity on the networking thread which means that it is in a state where a normal wake event will always wake it up

View solution in original post

2 Replies
Anonymous
Not applicable

Force wake is not needed for link up because when link is down there should be no other activity on the networking thread which means that it is in a state where a normal wake event will always wake it up

Well noted and thanks!

0 Likes