From: Andrew Lunn <andrew@lunn.ch>
To: Andrea Scian <andrea.scian@wawnet.biz>
Cc: ecos-discuss@sources.redhat.com
Subject: Re: [ECOS] Socket problem with smsc LAN91C96
Date: Thu, 16 Oct 2003 13:45:00 -0000 [thread overview]
Message-ID: <20031016134512.GH32391@lunn.ch> (raw)
In-Reply-To: <004501c393e7$d28c3bc0$1800a8c0@llandrews>
> This is what happen to me: inside a thread, after calling
> init_all_network_interfaces(), I create a socket (AF_INET, SOCK_STREAM) and
> call connect() to a LAN server. When connect() is called after a HW reset it
> waits a long time (more or less it's 4 seconds) before send the first TCP/IP
> packet, after that it all works good.
I have a few ideas.
1) You have DHCP/BOOTP in use and its taking a while for this to
assign you an address. Fix the IP address so you don't have to
negotiate it.
2) The hardware takes 4 seconds to get itself sorted out, negotiate
the line speed/duplex mode with the other end etc. This is possible
and if so there is little you can do about it, except hard wire the
line speed and hope the other end can cope.
3) I think both network stack do a sanity check to see if anybody else
is using the IP address it want to use. It sends out an ARP for its
own address, waits for a while and if it does not receive a reply
it starts to use the address. This could take a second. If you know
you will never have conflicting IP addresses and you can live with
random machines doing strange things when there are conflicts, you
can probably disable this code.
4) The packet is reaching the HW before its completed its
initialization and it throws it away. You then wait for TCP to do a
resend. This resend will probably be a couple of seconds later and
will probably work. You can try to prove this by putting in some
debug code to see packet sent and received. Which TX actually
causes an RX? You might be able to tune your delay so that the
first packet gets sent correctly. Or you can might be able to
change the retransmit timer, but you should see what the RFCs says
about this.
Andrew
--
Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
and search the list archive: http://sources.redhat.com/ml/ecos-discuss
next prev parent reply other threads:[~2003-10-16 13:45 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-10-16 13:13 Andrea Scian
2003-10-16 13:45 ` Andrew Lunn [this message]
2003-10-24 17:26 ` Andrea Scian
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20031016134512.GH32391@lunn.ch \
--to=andrew@lunn.ch \
--cc=andrea.scian@wawnet.biz \
--cc=ecos-discuss@sources.redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).