netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stephen Hemminger <shemminger@vyatta.com>
To: Travis Stratman <tstratman@emacinc.com>
Cc: netdev@vger.kernel.org
Subject: Re: data received but not detected
Date: Tue, 17 Jun 2008 15:27:33 -0700	[thread overview]
Message-ID: <20080617152733.7f469f2e@extreme> (raw)
In-Reply-To: <1213740538.5771.192.camel@localhost.localdomain>

On Tue, 17 Jun 2008 17:08:58 -0500
Travis Stratman <tstratman@emacinc.com> wrote:

> Hello,
> 
> (I sent this earlier today but it doesn't look like it made it, I
> apologize if it gets through multiple times)
> 
> I am working on an application that uses a fairly simple UDP protocol to
> send data between two embedded devices. I'm noticing an issue with an
> initial test that was written where datagrams are received but not seen
> by the recvfrom() call until more data arrives after it. As of right now
> the test case does not implement any type of lost packet protection or
> other flow control, which is what makes the issue so noticeable.
> 
> The target for this code is a board using the Atmel AT91SAM9260 ARM
> processor. I have tested with 2.6.20 and 2.6.25 on this board.
> 
> The test consists of a two applications with the following pseudo code
> (msg_size = 127, 9003/9005 are the UDP ports used):
> 
> "client app"
> while(1) {
>     sendto(9003, &msg_size, 4bytes);
>     sendto(9003, buffer, msg_size);
>     recvfrom(9005, &msg_size, 4bytes);
>     recvfrom(9005, buffer, msg_size);
> }
> 
> "server app"
> while(1) {
>     recvfrom(9003, &msg_size, 4bytes);
>     recvfrom(9003, buffer, msg_size);
>     sendto(9005, &msg_size, 4bytes);
>     sendto(9005, buffer, msg_size);
> }
> 
> As long as the server is started first and no packets are lost or out of
> order, the client and server should continue indefinitely. When run
> between two boards on a local gigabit switch, the application will run
> smoothly most of the time, but I periodically see delays of 30 seconds
> or more where one of the applications is waiting for the second datagram
> to arrive before sending the next packet. Wireshark shows that the data
> was sent very shortly after the first datagram, and no packets are ever
> lost, ifconfig reports no collisions, overruns, or errors.
> 
> When I run the application between two identical devices on a cross-over
> cable, data is transferred for a few seconds after which everything
> freezes until I send a ping between the two boards in the background.
> This forces the communication to start up again for a few seconds before
> they hang up again. If I insert a delay between the sendto() calls with
> usleep(1) (CONFIG_HZ is 100 so this could be up to 10ms) everything
> seems to work. Using a busy loop I was able to determine that
> approximately 500 us delay is required to "fix" the issue but even then
> I saw one hang up in several hours of testing.
> 
> At first I thought that this was the "rotting packet" case that the NAPI
> references where an IRQ is missed on Rx, so I rewrote the poll function
> in the macb driver to try to fix this but I didn't see any noticeable
> differences. If I enable debugging in the MACB driver it slows things
> down enough to make everything work.
> 
> Next, I tested on a Cirrus ep93xx based board (with 2.6.20) and a 133
> MHz x86 board (with 2.6.14.7) and noticed the same issue when run
> between the target and my PC. When run between my 2.6.23 2GHz PC and
> another similar PC, the issue does not show up (these both use Intel
> NICs). I also tested on the local loopback and things worked as
> expected.
> 
> I would very much appreciate any suggestions that anyone could give to
> point me in the right direction.
> 
> Thanks in advance,
> 
> Travis

I am unfamiliar with interrupts on the ARM. Are IRQ's level or edge triggered?
NAPI won't work if interrupts are edge-triggered.

  reply	other threads:[~2008-06-17 22:27 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-06-17 22:08 data received but not detected Travis Stratman
2008-06-17 22:27 ` Stephen Hemminger [this message]
2008-06-17 22:40   ` Travis Stratman
2008-06-17 22:31 ` Ben Greear
2008-06-17 22:58   ` Travis Stratman
2008-06-17 23:45     ` Ben Greear
2008-06-19 22:53       ` Travis Stratman
2008-06-19 23:08         ` Ben Greear
2008-06-22  9:16         ` James Chapman
2008-07-07 21:56           ` Travis Stratman
2008-07-08  9:37             ` James Chapman
2008-07-15 20:46               ` Travis Stratman
2008-06-18  6:28     ` Evgeniy Polyakov
2008-06-19 23:10       ` Travis Stratman
     [not found]         ` <20080620060219.GA22784@2ka.mipt.ru>
2008-06-20 17:10           ` Travis Stratman
2008-06-20 17:25             ` Evgeniy Polyakov
2008-06-20 17:41               ` Travis Stratman
2008-06-20 17:54                 ` Evgeniy Polyakov
2008-06-20 18:17                   ` Travis Stratman
2008-06-20 18:23                     ` Evgeniy Polyakov
2008-06-20 21:06                       ` Travis Stratman
2008-06-21  7:12                         ` Evgeniy Polyakov
2008-07-07 21:10                           ` Travis Stratman
2008-07-07 21:25                             ` Evgeniy Polyakov
2008-07-15 20:43                               ` Travis Stratman

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=20080617152733.7f469f2e@extreme \
    --to=shemminger@vyatta.com \
    --cc=netdev@vger.kernel.org \
    --cc=tstratman@emacinc.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 NNTP newsgroup(s).