lwip-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lwip-users] Calling netif_set_link_up/down in my driver


From: Mason
Subject: [lwip-users] Calling netif_set_link_up/down in my driver
Date: Thu, 24 May 2012 13:42:18 +0200
User-agent: Mozilla/5.0 (Windows NT 5.1; rv:12.0) Gecko/20120429 Firefox/12.0 SeaMonkey/2.9.1

Hello,

On my platform, the hardware notifies the driver of link status
changes by calling a user-defined call-back function.

In this call-back, I pass the notification up to lwip.
Here's my rough code:

static int mac_link_callback(ethernet_device_t *dev, unsigned status)
{
  if ((status & LINK_STATUS) == 0)
  {
    netif_set_link_down(mynetif);
  }
  else
  {
    netif_set_link_up(mynetif);
  }
  return 0;
}

However, this call-back is invoked by an Ethernet-specific task
(phy_ops_update_task) i.e. not in the context of tcpip_thread.

I think this means I am not allowed to call netif_* functions
directly, and I must use the netifapi_netif_* variants?

So my call-back should call
netifapi_netif_set_link_down and netifapi_netif_set_link_up?

NB : AFAICS, netifapi_netif_set_link_* are not defined in
netifapi.h

-- 
Regards.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]