This is the mail archive of the
ecos-discuss@sources.redhat.com
mailing list for the eCos project.
Re: slow connect in ftp_test
- From: Gary Thomas <gthomas at redhat dot com>
- To: Paul Randall <prandall at delta-info dot com>
- Cc: eCos Discussion <ecos-discuss at sources dot redhat dot com>
- Date: 28 May 2002 20:39:40 +0100
- Subject: Re: [ECOS] slow connect in ftp_test
- References: <3CF3CCFA.88F97981@delta-info.com>
A *lot* of things have been improved and/or fixed wrt the Viper
networking, now available from anonymous CVS. Please update and
try this again and let us know if you still have problems.
On Tue, 2002-05-28 at 19:31, Paul Randall wrote:
> Hi all,
>
> I recently tried running the ftp_test network test on my A&M Viper
> board. I set up the viper to login to a FTP server which I ran on the
> host PC. I am debugging with Insight over the serial port.
>
> During the test, the ethernet interface is initialized ok, but when
> connect() is called, it takes about 60 seconds for the function to
> return. The strange thing is, there is absolutely no traffic on the
> network until close to the end of the 60 seconds when the viper
> successfully connects to the host. After a successful connection, the
> login process (username and password) also take a long time (about 20
> seconds).
>
> I used Insight to trace into the connect() call and saw the 60 second
> delay happened in the bsd_connect() function of sockio.c:
>
> static int bsd_connect ( cyg_file *fp, const sockaddr *sa, socklen_t
> len )
> {
> register struct socket *so;
> struct mbuf *nam;
> int error, s;
>
> so = (struct socket *)fp->f_data;
>
> if ((so->so_state & SS_NBIO) && (so->so_state & SS_ISCONNECTING))
> return (EALREADY);
>
> error = sockargs(&nam, (caddr_t)sa, len, MT_SONAME);
>
> if (error)
> return (error);
>
> error = soconnect(so, nam);
> if (error)
> goto bad;
>
> if ((so->so_state & SS_NBIO) && (so->so_state & SS_ISCONNECTING)) {
> m_freem(nam);
> return (EINPROGRESS);
> }
>
> s = splsoftnet();
> while ((so->so_state & SS_ISCONNECTING) && so->so_error == 0) {
> error = tsleep((caddr_t)&so->so_timeo, PSOCK | PCATCH,
> netcon, 0);
> if (error)
> break;
> }
>
> if (error == 0) {
> error = so->so_error;
> so->so_error = 0;
> }
>
> splx(s);
>
> bad:
> so->so_state &= ~SS_ISCONNECTING;
> m_freem(nam);
>
> return error;
> }
>
> The 60 second delay happens during the tsleep() call in the while loop
> after the soconnect() call. The tsleep is waiting for a semaphore to be
> posted, but it is not posted until 60 seconds after the soconnect()
> call.
>
> When the semaphore is finally posted it is posted from the tcp_input()
> function in tcp_input.c. The call stack is:
>
> Cyg_HardwareThread::thread_entry(Cyg_thread *)
> cyg_netint
> ipintr
> ipv4_input
> tcp_input
> soisconnected
> cyg_wakeup
> cyg_semaphore_post
>
> Why does it take 60 seconds for this semaphore to be posted?
>
> Paul Randall
> Delta Information Systems
>
>
> --
> Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
> and search the list archive: http://sources.redhat.com/ml/ecos-discuss
--
Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
and search the list archive: http://sources.redhat.com/ml/ecos-discuss