Project Home
Project Home
Wiki
Wiki
Discussion Forums
Discussions
Project Information
Project Info
Forum Topic - FTP slows down when rx drop packets. Nagle for TCP/SWS: (19 Items)
   
FTP slows down when rx drop packets. Nagle for TCP/SWS  
Hi, 

We encounter a FTP slowed down problem. Need help on this.

Problem Description:
- FTP large file (>40M) transfer slows down significantly after a couple iterations.
The more transfer, the worse the transfer.
- When this happens, nicinfo shows, the Ethernet Driver (8572 TSEC) driver drops packets, the more it drops, the slower 
the transfer. In some cases, FTP failed.


Question:
- The symptom looks like TCP SWS. Is the Nagle algorithm implemented in the io-pkt?
- I use MDI-AutoNegotiation and MDI_SetSpeedDuplex to control the TSEC. Any known problem with these routines.
- Any quick way to control the FTP/TCP for this problem?

Appreciated very much for a quick answer.

Regards,
Sherry
Re: FTP slows down when rx drop packets. Nagle for TCP/SWS  
On Mon, Jul 20, 2009 at 03:27:12PM -0400, Sherry Chen wrote:
> Hi, 
> 
> We encounter a FTP slowed down problem. Need help on this.
> 
> Problem Description:
> - FTP large file (>40M) transfer slows down significantly after a couple iterations.
> The more transfer, the worse the transfer.
> - When this happens, nicinfo shows, the Ethernet Driver (8572 TSEC) driver drops packets, the more it drops, the 
slower the transfer. In some cases, FTP failed.
> 
> 
> Question:
> - The symptom looks like TCP SWS. Is the Nagle algorithm implemented in the io-pkt?

Dropping packets doesn't sound like SWS.
Yes, Nagle is implemented.  TCP_NODELAY is used
to turn it off (see getsockopt()) but ftp doesn't
do so.

> - I use MDI-AutoNegotiation and MDI_SetSpeedDuplex to control the TSEC. Any known problem with these routines.
> - Any quick way to control the FTP/TCP for this problem?
> 
> Appreciated very much for a quick answer.
> 
> Regards,
> Sherry
> 
> 
> 
> _______________________________________________
> 
> General
> http://community.qnx.com/sf/go/post34100
> 
Re: FTP slows down when rx drop packets. Nagle for TCP/SWS  
Thanks very much for the fast response.

The rx drop packets is the cause of the slowdown.  The symptom looks like SWS. If not SWS, What else could cause the FTP
 to slow down significantly? even to fail? 

What tools can we use to diagnose in additional to nicinfo?

Regards,
Sherry

Re: FTP slows down when rx drop packets. Nagle for TCP/SWS  
> Thanks very much for the fast response.
> 
> The rx drop packets is the cause of the slowdown.  The symptom looks like SWS.
>  If not SWS, What else could cause the FTP to slow down significantly? even to
>  fail? 
> 
> What tools can we use to diagnose in additional to nicinfo?
> 
> Regards,
> Sherry
> 

Note: the percentage of the drop can not explain the significant slowdown/failure of the FTP.



Re: FTP slows down when rx drop packets. Nagle for TCP/SWS  
On Mon, Jul 20, 2009 at 04:19:14PM -0400, Sherry Chen wrote:
> Thanks very much for the fast response.
> 
> The rx drop packets is the cause of the slowdown.  The symptom looks like SWS. If not SWS, What else could cause the 
FTP to slow down significantly? even to fail? 

As you mention above, "The rx drop packets is the cause of the
slowdown".  If that's the cause then it's not SWS which is
something different.

> 
> What tools can we use to diagnose in additional to nicinfo?
> 
> Regards,
> Sherry
> 
> 
> 
> 
> 
> _______________________________________________
> 
> General
> http://community.qnx.com/sf/go/post34113
> 
Re: FTP slows down when rx drop packets. Nagle for TCP/SWS  
> On Mon, Jul 20, 2009 at 04:19:14PM -0400, Sherry Chen wrote:
> > Thanks very much for the fast response.
> > 
> > The rx drop packets is the cause of the slowdown.  The symptom looks like 
> SWS. If not SWS, What else could cause the FTP to slow down significantly? 
> even to fail? 
> 
> As you mention above, "The rx drop packets is the cause of the
> slowdown".  If that's the cause then it's not SWS which is
> something different.

My theory is drop packet cause the io-pkt behave differently.  It is not SWS, could it be something similar in nature. 
Drop packets should not accelerate the slowdown or even trigger failure after iternations of the same transfer.

I am look for clues what could go wrong.


> > 
> > What tools can we use to diagnose in additional to nicinfo?
> > 
> > Regards,
> > Sherry
> > 
> > 
> > 
> > 
> > 
> > _______________________________________________
> > 
> > General
> > http://community.qnx.com/sf/go/post34113
> > 


RE: FTP slows down when rx drop packets. Nagle for TCP/SWS  
Can you post the nicinfo output?  Also, if you
can start the mpc85xx driver with the verbose
option, and post the sloginfo output, that will
help diagnose why the packets are being dropped.
 
Frankly, I'm surprised - the tsec/etsec hardware
is dma-ring based, and I've seen gige wire rate
with this hardware and driver.
 
I will be interested to learn if your hardware is
etsec or (older, slower) tsec - I remember on
the 8313 (with the tsec) it was a bit of a trick 
to get it's speed up.
 
We need to figure out if you have a bus bandwidth
problem - nic is unable to DMA fast enough - OR 
if you are simply running out of receive descriptors 
because of excessive scheduling latency.
 
If it's door #2, you can try specifying "receive=2048"
or some other large number to mpc85xx to give it
more receive buffers, to tolerate scheduling latency.
 
Are there any really high priority threads running
which would starve the driver?
 
--
aboyd
 
Re: RE: FTP slows down when rx drop packets. Nagle for TCP/SWS  
Hi Aboyd, 

Thanks a lot for replying me.

> Can you post the nicinfo output?  Also, if you
> can start the mpc85xx driver with the verbose
> option, and post the sloginfo output, that will
> help diagnose why the packets are being dropped.
==> We have turned on the verbose mode, Drop packet does not produce any more messages. 

>  
> Frankly, I'm surprised - the tsec/etsec hardware
> is dma-ring based, and I've seen gige wire rate
> with this hardware and driver.
>  
> I will be interested to learn if your hardware is
> etsec or (older, slower) tsec - I remember on
> the 8313 (with the tsec) it was a bit of a trick 
> to get it's speed up.
==> We are using io-net based tsec, not the io-pkt native 85xx tsec driver.
   Not sure this makes a difference. Our 8572E TSEC is the latest freescale chip, We use the driver QNX provided us.

> We need to figure out if you have a bus bandwidth
> problem - nic is unable to DMA fast enough - OR 
> if you are simply running out of receive descriptors 
> because of excessive scheduling latency.
==> When packets are dropped, increase io-pkt rx thread's priority reduce it at a ratio 1000 to 3. The problem is 
scheduling latency.  Also we calculate the packets received by TSEC HW is what it supposed to receive and nicinfo 
records packet drop. This leads to the conclusion of excessive scheduling latency.

> If it's door #2, you can try specifying "receive=2048"
> or some other large number to mpc85xx to give it
> more receive buffers, to tolerate scheduling latency.
==> I shall find out if receive=2048 will improve it, since I do not know the default setting.

> Are there any really high priority threads running
> which would starve the driver?
==> Yes, we do have our own hardware demanding CPU at interrupt priority.

Btw,

We found after MDI_ResetPhy and MDI_SyncPhy, MDI_AutoNegotiate, The AutoNegotiate would fail a few time. This causes the
 Rx reports CRC error. I am not sure Drop packet is related.

Regards,
Sherry


Re: FTP slows down when rx drop packets. Nagle for TCP/SWS  
Hi Sherry,

> - FTP large file (>40M) transfer slows down significantly after a couple iterations.
> The more transfer, the worse the transfer.
Are you saying that each FTP file transfer is slower than the previous 
one or that each file transfer slows down during the transfer after 
initially having a higher speed?

In general, packet drop is treated as congestion by TCP. I suggest you 
start look at why you have packet drop (incl. the suggestions Andrew 
posted) and if that doesn't make anything obvious you should look at 
what TCP congestion algorithms you employ (SACK, New Reno, socket 
options, etc, - see e.g sysctl -a |grep tcp) and analyze a packet trace 
of the TCP session.

Hope this helps!
/P
Re: FTP slows down when rx drop packets. Nagle for TCP/SWS  
> Hi Sherry,
> 
> > - FTP large file (>40M) transfer slows down significantly after a couple 
> iterations.
> > The more transfer, the worse the transfer.
> Are you saying that each FTP file transfer is slower than the previous 
> one or that each file transfer slows down during the transfer after 
> initially having a higher speed?
==> Yes, Exactly. Compare to previous transfer of the same file, it takes longer. Here, I am not sure this is caused by 
packet drop or CRC error (see my previous message).
Part of this info was given to me.

As for my own test, 1) The packet drop case, Initially, it drops much less for the same file, as iterate goes on, drop 
count increases then levels out at about the same level. 2) CRC error case, it is caused by bad auto-negotiation, It 
seems taking even longer for the same file to transfer, may be the effective baud rate was bad, even ifconfig says it 
transfer at the same 100M FD. My college told me, it starts fast, then gradually   slow down, eventually failed. 

> 
> In general, packet drop is treated as congestion by TCP. I suggest you 
> start look at why you have packet drop (incl. the suggestions Andrew 
> posted) 
==> We very possibly have a scheduling latency problem, since increase io-pkt rx priority relieves the symptom 
dramatically. I do not know if bad auto-negotiation would cause TSEC HW to report packet drop. Could you clarify this? I
 do not have experience with this situation.

and if that doesn't make anything obvious you should look at 
> what TCP congestion algorithms you employ (SACK, New Reno, socket 
> options, etc, - see e.g sysctl -a |grep tcp) and analyze a packet trace 
> of the TCP session.
> 
> Hope this helps!
> /P

The following is my sysctl -a| grep tcp. Analyze the packet trace will take me a while,
 I am not a TCP person yet.

test_eth(130):set_verbose=0, rc=0
# sysctl -a | grep tcp
net.inet.tcp.rfc1323 = 1
net.inet.tcp.sendspace = 22528
net.inet.tcp.recvspace = 32768
net.inet.tcp.mssdflt = 536
net.inet.tcp.syn_cache_limit = 10255
net.inet.tcp.syn_bucket_limit = 105
net.inet.tcp.init_win = 0
net.inet.tcp.mss_ifmtu = 0
net.inet.tcp.sack.enable = 1
net.inet.tcp.sack.maxholes = 32
net.inet.tcp.sack.globalmaxholes = 1024
net.inet.tcp.sack.globalholes = 0
net.inet.tcp.win_scale = 1
net.inet.tcp.timestamps = 1
net.inet.tcp.compat_42 = 0
net.inet.tcp.cwm = 0
net.inet.tcp.cwm_burstsize = 4
net.inet.tcp.ack_on_push = 0
net.inet.tcp.keepidle = 14400
net.inet.tcp.keepintvl = 150
net.inet.tcp.keepcnt = 8
net.inet.tcp.slowhz = 2
net.inet.tcp.log_refused = 0
net.inet.tcp.init_win_local = 4
net.inet.tcp.rstppslimit = 100
net.inet.tcp.delack_ticks = 23
net.inet.tcp.hiwat_adjust = 1
net.inet.tcp.do_loopback_cksum = 0
net.inet.tcp.congctl.available = reno newreno
net.inet.tcp.congctl.selected = newreno
net.inet.tcp.ecn.enable = 0
net.inet.tcp.ecn.maxretries = 1
net.inet.tcp.iss_hash = 0
net.inet.tcp.abc.enable = 1
net.inet.tcp.abc.aggressive = 1
qnx.net.inet.tcp.hiwat_adjust = 1



RE: FTP slows down when rx drop packets. Nagle for TCP/SWS  
> We very possibly have a scheduling latency problem, 
> since increase io-pkt rx priority relieves the symptom 
> dramatically. 

Well, there's your problem, which is good news - you don't
have a DMA problem, you simply need to allocate more CPU to
the ethernet driver, OR make it more tolerant of scheduling
latency with:

  receive=2048

command line option, which on the io-net devn-mpc85xx.so
driver, increase the number of rx descriptors from the
default of 64, which IMHO is very low.  
 
When I ported this driver from io-net to io-pkt I increased 
the default number of rx descriptors to 512, which uses more 
memory, but won't lose packets as easily, which really bugs
the protocols.  

And if someone wants to decrease the memory footprint of io-pkt 
(and any dma-based driver) they can use the receive=X option to 
do so.  But with io-pkt, at least the default behaviour is that 
it functions correctly, albeit it might be a bit porkier.  But, 
you would be amazed how few people are concerned about the memory
footprint of io-pkt.  But, I digress.

You mention CRC errors, and auto-negotiation.  I would not
worry about CRC errors during auto-neg - what I would worry
about is continuous link up / link down messages.

As long as the link stays up - which it should - then
auto-neg will not occur, and thus the CRC errors (during
auto-neg) will not occur, either.

I would really like to see an output of the "nicinfo" command.

I'm pretty confident that if we bump up the number of receive
descriptors, we can make the io-net devn-mpc85xx.so driver more
tolerant of your system's scheduling latency.

--
aboyd
Re: RE: FTP slows down when rx drop packets. Nagle for TCP/SWS  
> 
> > We very possibly have a scheduling latency problem, 
> > since increase io-pkt rx priority relieves the symptom 
> > dramatically. 
> 
> Well, there's your problem, which is good news - you don't
> have a DMA problem, you simply need to allocate more CPU to
> the ethernet driver, OR make it more tolerant of scheduling
> latency with:
> 
>   receive=2048

==> Thanks very much for the important tip. I shall try this when I got use privilege to access the setup.

> 
> command line option, which on the io-net devn-mpc85xx.so
> driver, increase the number of rx descriptors from the
> default of 64, which IMHO is very low.  
>  
> When I ported this driver from io-net to io-pkt I increased 
> the default number of rx descriptors to 512, which uses more 
> memory, but won't lose packets as easily, which really bugs
> the protocols.  
> 
> And if someone wants to decrease the memory footprint of io-pkt 
> (and any dma-based driver) they can use the receive=X option to 
> do so.  But with io-pkt, at least the default behaviour is that 
> it functions correctly, albeit it might be a bit porkier.  But, 
> you would be amazed how few people are concerned about the memory
> footprint of io-pkt.  But, I digress.
> 
> You mention CRC errors, and auto-negotiation.  I would not
> worry about CRC errors during auto-neg - what I would worry
> about is continuous link up / link down messages.
> 
> As long as the link stays up - which it should - then
> auto-neg will not occur, and thus the CRC errors (during
> auto-neg) will not occur, either.
==> The CRC error I mentioned is caused by bad AN result, not during the AN.
   That is,  AN did not complete successfully. As a result, all following file transfer generate higt rate CRC errors. 
The same file transfered multiple times, Each time it takes longer and longer and eventually FTP failed. I do not have 
records of nicinfo for this.


> I would really like to see an output of the "nicinfo" command.
==> The attached is an example of nicinfo. 

The data I collected when the system has problem. The file size is 78M, same file transferred 6 times.

Data listed in the table
- Packets recieved OK,
- Received packets with CRC errors
- Packets Dropped on receive

       Recieved OK    CRC errors   Dropped
 0      749                 0               0
 1      56664             14              263
 2     115140             39             1539
 3     172275             59             2610
 4     230367             85             3828
 5     288174            111            5078
 6     345849            141            6393 

# nicinfo -r en0 
en0: 
  MPC85XX TSEC Ethernet Controller

  Physical Node ID ........................... 00E00C 0000FD
  Current Physical Node ID ................... 040000 00002D
  Current Operation Rate ..................... 100.00 Mb/s full-duplex
  Active Interface Type ...................... MII
    Active PHY address ....................... 2
  Maximum Transmittable data Unit ............ 1514
  Maximum Receivable data Unit ............... 1514
  Hardware Interrupt ......................... 0x15
  Hardware Interrupt ......................... 0x16
  Hardware Interrupt ......................... 0x17
  Memory Aperture ............................ 0xe0027000 - 0xe0027fff
  Promiscuous Mode ........................... Off
  Multicast Support .......................... Enabled

  Packets Transmitted OK ..................... 35769
  Bytes Transmitted OK ....................... 2647860

  Packets Received OK ........................ 86649
  Bytes Received OK .......................... 126335615

  Single Collisions on Transmit .............. 0
  Multiple Collisions on Transmit ............ 0
  Deferred Transmits ......................... 0
  Late Collision on Transmit...
View Full Message
RE: RE: FTP slows down when rx drop packets. Nagle for TCP/SWS  
> AN did not complete successfully

This concerns me.  How do you know that the AN
did not complete successfully?  Did the nicinfo
utility report the incorrect speed or duplex?

You should definitely run the mpc85xx driver
with the "verbose" option, so that you can 
track the link up/down events in sloginfo,
and see the resulting link speed/duplex.

What device (switch?) is at the other end?
Have you tried another switch, or brand of
switch?

Also, how long is your cable?  Have you tried
a different cable?  Sometimes cables get pinched,
and that's not good for them.

Is there any significant source of electromagnetic
interference nearby?  Induced current is not supposed
to be a problem with the design of twisted pair, but
it's worth mentioning.

Also, what PHY are you running on your hardware?
Does it require any custom initialization?  If
so, you should add it to the mii.c file of the
driver.  I would be surprised if this is the problem
because all modern PHYs conform to the IEEE 802.3
register specification, but anything is possible.

Another longshot is a hardware problem with the
PHY in your board.  Does it have adequate voltage?
Does it run ok when it is cool, but have a problem 
when it gets hot?

--
aboyd
Re: RE: RE: FTP slows down when rx drop packets. Nagle for TCP/SWS  
> 
> > AN did not complete successfully
> 
> This concerns me.  How do you know that the AN
> did not complete successfully?  Did the nicinfo
> utility report the incorrect speed or duplex?
==> The problem is that nicinfo reports good speed/duplex. Actually the AN was not successful.  
     Special devctl code was implemented in our TSEC driver, that user can turn on/off special diagnostics print. One of
 which is to log all the MII MDIO read/write. With that I know the AN is not complete.

> You should definitely run the mpc85xx driver
> with the "verbose" option, so that you can 
> track the link up/down events in sloginfo,
> and see the resulting link speed/duplex.
> 
> What device (switch?) is at the other end?
> Have you tried another switch, or brand of
> switch?
==> The symptom varies with different switches. Some CRC, some drop packets.


> Also, how long is your cable?  Have you tried
> a different cable?  Sometimes cables get pinched,
> and that's not good for them.
> 
> Is there any significant source of electromagnetic
> interference nearby?  Induced current is not supposed
> to be a problem with the design of twisted pair, but
> it's worth mentioning.
> 
> Also, what PHY are you running on your hardware?
> Does it require any custom initialization?  If
> so, you should add it to the mii.c file of the
> driver.  I would be surprised if this is the problem
> because all modern PHYs conform to the IEEE 802.3
> register specification, but anything is possible.

==> One thing I did not mention in my previous report is that this AN problem is caused by  devctl calls we implemented 
to change media mode, i.e. Activate AN, forced speed or FD/HD mode, etc.  (The MDI_ routines was invoked directly from 
the devctl issued at random run time). This conflicts with the TSEC monitor state machine in the MII callback routine 
and resulted weird AN behavior. I found this just recently.

The problem here is that when this happen, the TSEC HW still works, sometimes it drops packets and sometime it logs CRC 
error.

When above happen, I was in the middle of investigating TSEC performance, i.e. TSEC drop packets under IXIA stress test.
 

Btw, Thanks a lot for the receive=2048 tips, We have tested to find it relieves the packet drop symptom with IXIA stress
 test quite a lot. 


With the problem I encountered,  I learned that MDI_activateNegotiation does not work reliably and does not check all 
the registers specified in the SPEC, And it does not work well with MDI_SetSpeedDuplex, MDI_InitPhy, MDI_SyncPhy call 
inbetween and it does not have error recoveries when this happen. Yes, I definitely have some bugs to fix for my part.

What puzzles me is that, after bad AN, the TSEC HW reports drop packets with some switches, which is not the same drop 
packets symptom with the IXIA stress test. I say that is because if we activate a few more AN, the drop packets symptom 
went away.

Here, I just need clarification that drop packet could be caused by bad AN.

> Another longshot is a hardware problem with the
> PHY in your board.  Does it have adequate voltage?
> Does it run ok when it is cool, but have a problem 
> when it gets hot?
> 
> --
> aboyd


Thanks a lot for writing me the important tips that I need to investigate when bad AN happen, if the problem is not 
caused by software bug.

Best,
Sherry


RE: RE: RE: FTP slows down when rx drop packets. Nagle for TCP/SWS  
> this AN problem is caused by devctl calls we implemented 
> to change media mode

You don't need to do that!!!  This functionality is ALREADY
cleanly provided under io-pkt by the bsd_media.c driver file.

Using the ifconfig utility, you can manually set speed,
duplex, etc.  

Please stop hitting the PHY registers directly, and
your AN problems will go away.

> Thanks a lot for the receive=2048 tips, We have tested 
> to find it relieves the packet drop symptom with IXIA 
> stress test quite a lot. 

Great!

--
aboyd
Re: RE: RE: RE: FTP slows down when rx drop packets. Nagle for TCP/SWS  
> 
> > this AN problem is caused by devctl calls we implemented 
> > to change media mode
> 
> You don't need to do that!!!  This functionality is ALREADY
> cleanly provided under io-pkt by the bsd_media.c driver file.
> 
> Using the ifconfig utility, you can manually set speed,
> duplex, etc.  
> 
> Please stop hitting the PHY registers directly, and
> your AN problems will go away.
> 


==> Since we are using io-pkt-v4/shim/devn-mpc85xx, not aware of bsd_media.c.
        Our spec allow user change mode via API, and it will take me a while to trace the call sequence from ifconfig to
 bsd_media.c, do you mind telling me the IOCTL cmd name for this function?

Thanks ahead,
Sherry
Re: RE: RE: RE: FTP slows down when rx drop packets. Nagle for TCP/SWS  
c.
>         Our spec allow user change mode via API, and it will take me a while 
> to trace the call sequence from ifconfig to bsd_media.c, do you mind telling 
> me the IOCTL cmd name for this function?
> 

Never mind, I Found it.

Thanks,
Sherry


RE: RE: RE: RE: FTP slows down when rx drop packets. Nagle for TCP/SWS  
> we are using io-pkt-v4/shim/devn-mpc85xx

devn-mpc85xx.so is an io-net driver, which runs 
under io-pkt using the shim.

However, there is a native io-pkt driver called
devnp-mpc85xx.so (note the extra "p" after the devn)
which does not require the overhead of the shim
(thread switch on rx, npkt <-> mbuf xlation).

devnp-mpc85xx.so defaults to 512 rx descriptors
as opposed to the default of 64 for devn-mpc85xx.so

Both take the "receive=2048" option to increase
your tolerance for scheduling latency.

However, the big difference between the two is
that the io-pkt (devnp) driver ALREADY had ioctl
support for changing speed and duplex via the
ifconfig mediaopt calls.

So, you really should use the io-pkt devnp-mpc85xx.so
driver, both for the performance increase - which I 
understand is critical to you - and for the additional
feature of forceable runtime link configuration.

Hope this helps,

--
aboyd   www.poweredbyqnx.com/images/L39_rollout.jpg
Re: RE: RE: RE: RE: FTP slows down when rx drop packets. Nagle for TCP/SWS  
> 
> So, you really should use the io-pkt devnp-mpc85xx.so
> driver, both for the performance increase - which I 
> understand is critical to you - and for the additional
> feature of forceable runtime link configuration.
> 
==> Thanks a lot for the clear explaination. We will definitely move the native driver when schedule allows (i.e. we are
 in the code freeze stage).

Regards,
Sherry