lwip-users
[Top][All Lists]
Advanced

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

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


From: Pomeroy, Marty
Subject: Re: [lwip-users] Calling netif_set_link_up/down in my driver
Date: Thu, 24 May 2012 08:54:35 -0400

Mason

In my phy interrupt, I use:
    err_t tmp = tcpip_callback_with_block( s_HandlePhyInterrupt, NULL,
0); 

That puts a callback to s_HandlePhyInterrupt into the tcpip thread.
Then in s_HandlePhyInterrupt is all the phy status processing and the
calls to netif_set_link*().

Hope that helps!

Marty


-----Original Message-----
From: address@hidden
[mailto:address@hidden On
Behalf Of Mason
Sent: Thursday, May 24, 2012 7:42 AM
To: Mailing list for lwIP users
Subject: [lwip-users] Calling netif_set_link_up/down in my driver

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.

_______________________________________________
lwip-users mailing list
address@hidden
https://lists.nongnu.org/mailman/listinfo/lwip-users



reply via email to

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