cancel
Showing results for 
Search instead for 
Did you mean: 

LWIP 2 interfaces issue

Ivan4S4
Associate II

Dear colleagues, hello! Question about LWIP. I have two network interfaces, one on the QCA 7000 chip via SPI, the second on LAN 8742, installed on the debug board. I use the Socket API. The problem is as follows: The server is running on one interface, the client on the other. When they are not running at the same time, everything works fine. But if you enable them at the same time, sometimes the outgoing packet on the QCA 7000 interface gets stuck in the LWIP library for about 210ms. And this time interval is always the same. Please tell me which way to look to solve this problem

9 REPLIES 9
Andrew Neil
Super User

Welcome to the forum.

Please see How to write your question to maximize your chances to find a solution for best results.

 


@Ivan4S4 wrote:

on the debug board.


What board is that?

 


@Ivan4S4 wrote:

Please tell me which way to look to solve this problem


See this article for LwIP debug options.

See also: https://www.nongnu.org/lwip/2_0_x/group__lwip__opts__debugmsg.html 

A complex system that works is invariably found to have evolved from a simple system that worked.
A complex system designed from scratch never works and cannot be patched up to make it work.
LCE
Principal II

Just guessing and googling: maybe it's the same problem?

tcp - LwIP echo client with multiple netif interfaces, how to select a particular netif interface - Stack Overflow

"LwIP wasn't designed to work well with multiple netif's. The function ip4_route is used, which wrongly selects the first netif it can find, so the tcp traffic used two different physical ports for the same source IP address when routed to the same switch"

 

And have you given each netif a dedicated IP address?



@LCE wrote:

"LwIP wasn't designed to work well with multiple netif's..."



Indeed - people often forget that the "Lw" in "LwIP" stands for Light-weight.

From the LwIP Home Page:

"lwIP is a small independent implementation of the TCP/IP protocol suite"

"The focus of the lwIP TCP/IP implementation is to reduce resource usage while still having a full scale TCP. This makes lwIP suitable for use in embedded systems with tens of kilobytes of free RAM and room for around 40 kilobytes of code ROM."

 

@Ivan4S4 hasn't said what MCU is being used, but F7 is tagged - which has resources far beyond that "tens of kilobytes of free RAM and room for around 40 kilobytes of code" !

So maybe a more capable stack would be appropriate?

A complex system that works is invariably found to have evolved from a simple system that worked.
A complex system designed from scratch never works and cannot be patched up to make it work.

The SO question is 5 years old. Better ask via the LwIP mailing list 

https://lists.nongnu.org/archive/html/lwip-users/

https://lists.nongnu.org/mailman/listinfo/lwip-users

Ivan4S4
Associate II

Dear colleagues, thank you to everyone who joined the discussion. Yes, I am using the STM32F746 Discovery debugging board. By setting the SO_BINDTODEVICE option, I assigned a specific interface to the sockets, as mentioned above. I'm scanning packets using Wireshark. And I see that when using two interfaces at the same time, outgoing packets on one of them are lost from time to time.

So have you enabled the debug trace options to see what's going on?

A complex system that works is invariably found to have evolved from a simple system that worked.
A complex system designed from scratch never works and cannot be patched up to make it work.
Ivan4S4
Associate II

By the way, if I turn off the TCP client and use PING, ICMP packets that I send to the first interface, this also happens from time to time.

What kind of debugging option do you have in mind?

The ones I linked in my first reply!

A complex system that works is invariably found to have evolved from a simple system that worked.
A complex system designed from scratch never works and cannot be patched up to make it work.