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: Sergio R. Caprile
Subject: Re: [lwip-users] Help with LwIP Modem
Date: Fri, 15 Jul 2016 10:33:01 -0300
User-agent: Mozilla/5.0 (Windows NT 6.1; rv:45.0) Gecko/20100101 Thunderbird/45.1.1

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.





reply via email to

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