lwip-users
[Top][All Lists]
Advanced

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

Re: [lwip-users] Help with LwIP Modem


From: Jaime Fernandez Hoffiz
Subject: Re: [lwip-users] Help with LwIP Modem
Date: Fri, 15 Jul 2016 10:57:02 -0500

Thanks Sergio,

Yes, I will spend sometime with the docs.

"I call netif_add() passing ethernet_input() as my input function; then I call my_netif->input() from the same and only context the other lwIP functions run, no interrupts, because this is NO_SYS=1"vAm I correct?

Yes, I modified this implementation to: instead of calling ethernet_input() directly, I call my_netif->input(). But my library is built with NO_SYS=0. In a previous email Simon suggested that the port is calling my_netif->input() from the tcpip thread thus should be ok. I have not been successful in changing it to work with tcpip_input().

I would like to still use the interrupts. What I'm trying to do is set lwip to work with interrupts, not polling, but intercepting the Ethernet packet as is. Potentially not even pass it to lwip but relay it out. Like a repeater. You could argue that it could be done without lwip but I kind of like the pbuf and how the port was implemented. 

Again thanks for your suggestions and patience. 

On Fri, Jul 15, 2016 at 8:33 AM, Sergio R. Caprile <address@hidden> wrote:
Perhaps you might spend some quality time with the docs

[me ~]$ more <lwip>/src/include/lwip/netif.h
/** Whether the network interface is 'up'. This is
 * a software flag used to control whether this network
 * interface is enabled and processes traffic.
 * It is set by the startup code (for static IP configuration) or
 * by dhcp/autoip when an address has been assigned.
 */
#define NETIF_FLAG_UP           0x01U
/** If set, the netif has broadcast capability.
 * Set by the netif driver in its init function. */
#define NETIF_FLAG_BROADCAST    0x02U
/** If set, the netif is one end of a point-to-point connection.
 * Set by the netif driver in its init function. */
#define NETIF_FLAG_POINTTOPOINT 0x04U
/** If set, the interface is configured using DHCP.
 * Set by the DHCP code when starting or stopping DHCP. */
#define NETIF_FLAG_DHCP         0x08U
/** If set, the interface has an active link
 *  (set by the network interface driver).
 * Either set by the netif driver in its init function (if the link
 * is up at that time) or at a later point once the link comes up
 * (if link detection is supported by the hardware). */
#define NETIF_FLAG_LINK_UP      0x10U
/** If set, the netif is an ethernet device using ARP.
 * Set by the netif driver in its init function.
 * Used to check input packet types and use of DHCP. */
#define NETIF_FLAG_ETHARP       0x20U
/** If set, the netif is an ethernet device. It might not use
 * ARP or TCP/IP if it is used for PPPoE only.
 */
#define NETIF_FLAG_ETHERNET     0x40U
/** If set, the netif has IGMP capability.
 * Set by the netif driver in its init function. */
#define NETIF_FLAG_IGMP         0x80U

My netif is ethernet and I don't use IGMP, so its netif_init() function does:

netif->flags =
        NETIF_FLAG_BROADCAST | NETIF_FLAG_LINK_UP | NETIF_FLAG_ETHARP ;

Yours is ... and so it will have these and those flags.

Your driver must comply with http://lwip.wikia.com/wiki/Writing_a_device_driver

> This HW port calls ethernet_input inside the RX callback to pass the
> packet directly to lwip.

I assume this means:
"I call netif_add() passing ethernet_input() as my input function; then I call my_netif->input() from the same and only context the other lwIP functions run, no interrupts, because this is NO_SYS=1"
Am I correct?

Well, for ethernet netifs, that is correct. "For non-ethernet netifs, this must be set to ip_input (pass the pbuf without link headers, p->payload pointing to the IP header)"
Ethernet netifs deliver the frame with ethernet headers.
Your netif ...

Anyway,
You should be able to follow the incoming frame, see it being delivered to lwIP, and then see where lwIP does not answer back (assuming it is delivered the datagram), and hence the reason why.




_______________________________________________
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]