[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [lwip-devel] Missing initialization somewhere?
From: |
Sergey Kubushyn |
Subject: |
Re: [lwip-devel] Missing initialization somewhere? |
Date: |
Thu, 13 Oct 2011 07:45:05 -0700 (PDT) |
User-agent: |
Alpine 2.02 (LFD 1266 2009-07-14) |
On Thu, 13 Oct 2011, Kieran Mansley wrote:
On Wed, 2011-10-12 at 18:22 -0700, Sergey Kubushyn wrote:
The problem is it does not happen on every reset. Something like half
of
them result in a non-working system. On a connection attempt MCU sends
ARP
for the remote on the first SYN packet received, gets a response and
then
network is dead. No echo replies, no ARP requests/replies, nothing. It
hangs
on the very first SYN so tcp_accept() callback is not called etc.
This doesn't sounds familiar, so I don't think anyone else has already
found and fixed your problem. Do you have ARP_QUEUING turned on? I
was just wondering if that could explain the difference between TCP and
ICMP, as without it you would be relying on the TCP retransmission
timers, whereas with ping another ICMP packet would come along a second
later. I would certainly investigate whether the TCP timers are being
called correctly, although that doesn't explain why the stack wouldn't
respond to other packets. For that to happen it sounds like a race
condition that has caused a list in lwIP to be corrupted and so
something that iterates the list to be in an infinite loop. This is
usually because of not interfacing the application or driver to lwIP
correctly, resulting in concurrent access from more than one context.
Yes, I do have ARP_QUEUING turned on. Why it is not responding to other
packets is simple -- netif (i.e. whatever this pointer points to) has it's
UP flag bit set to zero. So for all practical purposes the interface is down
and there is no way for the stack to send a packet out.
It doesn't look like it has something to do with ARPs but I might be wrong.
The sequence is:
- Remote sends ARP for the MCU IP;
- MCU (lwIP) responds to ARP request properly;
- Remote sends SYN initiating 3-way TCP handshake;
- MCU sends ARP request for the remote IP (only once, not
for every SYN packet);
- Remote responds to that ARP;
- MCU generates a proper SYN/ACK packet and attempts to send it;
- That attempts fails in ip_route() because is_netif_up() tells the
netif is not up so there is no route out;
- After a timeout remote resends that initial SYN;
- MCU again generates a proper SYN/ACK packet and again attempts to
send it out with exactly the same result.
- That netif is down for ALL packets that is why nothing is going
out of the MCU. And there is nothing there to bring it back up.
I didn't have time to check the netif list yet, probably will do it in an
hour or so.
And this never happens if the first packet is ICMP echo request. MCU
properly sends an ARP, gets a reply, sends an ICMP echo reply out and from
now everything's dandy -- all TCP connections go as they supposed to,
nothing fails, TCP traffic seems to be rather decent without extensive
retransmits, dupacks etc. with a sustained rate of ~4MBytes/sec on 80MHz
Stellaris LM3S9B92 MCU 100Mbit Ethernet without any optimization for IP/TCP
checksumming and ntoh*/hton* (stock lwIP software functions used.) This
NEVER fails, ICMP works on each and every reset and after one ICMP packet
everything else also works.
Kieran
_______________________________________________
lwip-devel mailing list
address@hidden
https://lists.nongnu.org/mailman/listinfo/lwip-devel
---
******************************************************************
* address@hidden KOI8 Net < > The impossible we do immediately. *
* Las Vegas NV, USA < > Miracles require 24-hour notice. *
******************************************************************
- [lwip-devel] Missing initialization somewhere?, Sergey Kubushyn, 2011/10/12
- Re: [lwip-devel] Missing initialization somewhere?, Kieran Mansley, 2011/10/13
- Re: [lwip-devel] Missing initialization somewhere?,
Sergey Kubushyn <=
- Re: [lwip-devel] Missing initialization somewhere?, address@hidden, 2011/10/13
- Re: [lwip-devel] Missing initialization somewhere?, Sergey Kubushyn, 2011/10/13
- Re: [lwip-devel] Missing initialization somewhere?, address@hidden, 2011/10/13
- Re: [lwip-devel] Missing initialization somewhere?, Sergey Kubushyn, 2011/10/13
- Re: [lwip-devel] Missing initialization somewhere?, Sergey Kubushyn, 2011/10/13