public inbox for ecos-discuss@sourceware.org
 help / color / mirror / Atom feed
* [ECOS] Fwd: Packet size limit on TCP/IP stack ?
@ 2003-09-03  0:32 권순환
  2003-09-03  3:13 ` Jonathan Larmour
  0 siblings, 1 reply; 17+ messages in thread
From: 권순환 @ 2003-09-03  0:32 UTC (permalink / raw)
  To: ecos-discuss



Hi, all

I'm making a simple application using "net" option of package.(FreeBSD TCP/IP, CVS latest eCos)

But, I found that the  TCP user data which is over 98 bytes cannot be sent from or into target board.
(target is ARM INTEGRATOR with ARM920T)

When it comes to the Ping test, it also shows that ping packet with data size of over 119 bytes cannot be sent.

If the packet size is larger than the size, program contorl is stuck on sendto or send.

This happens on both IPv4 and IPv6 stack.

Does eCos TCP/IP stack limit the packet size? or did I missed out some option from CDL?

Thanks alot.

Regards,
Kwon


-- 
Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
and search the list archive: http://sources.redhat.com/ml/ecos-discuss

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [ECOS] Fwd: Packet size limit on TCP/IP stack ?
  2003-09-03  0:32 [ECOS] Fwd: Packet size limit on TCP/IP stack ? 권순환
@ 2003-09-03  3:13 ` Jonathan Larmour
  2003-09-05 11:52   ` mohanlal jangir
  0 siblings, 1 reply; 17+ messages in thread
From: Jonathan Larmour @ 2003-09-03  3:13 UTC (permalink / raw)
  To: shkwon123; +Cc: ecos-discuss

??? wrote:
> 
> Hi, all
> 
> I'm making a simple application using "net" option of package.(FreeBSD
> TCP/IP, CVS latest eCos)
> 
> But, I found that the  TCP user data which is over 98 bytes cannot be
> sent from or into target board. (target is ARM INTEGRATOR with ARM920T)
> 
> When it comes to the Ping test, it also shows that ping packet with
> data size of over 119 bytes cannot be sent.
> 
> If the packet size is larger than the size, program contorl is stuck on
> sendto or send.
> 
> This happens on both IPv4 and IPv6 stack.
> 
> Does eCos TCP/IP stack limit the packet size? or did I missed out some
> option from CDL?

This would be quite a big problem if widespread, which probably makes it 
something specific to your situation.

Run "ecosconfig export foo.ecm" in the same directory as your .ecc to 
generate a foo.ecm file that will show you what options are different from 
the default (although a few of them e.g. for header files get set 
automatically in the net template).

Jifl
-- 
eCosCentric    http://www.eCosCentric.com/    The eCos and RedBoot experts
--["No sense being pessimistic, it wouldn't work anyway"]-- Opinions==mine


-- 
Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
and search the list archive: http://sources.redhat.com/ml/ecos-discuss

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [ECOS] Fwd: Packet size limit on TCP/IP stack ?
  2003-09-03  3:13 ` Jonathan Larmour
@ 2003-09-05 11:52   ` mohanlal jangir
  2003-09-05 14:03     ` Jonathan Larmour
  0 siblings, 1 reply; 17+ messages in thread
From: mohanlal jangir @ 2003-09-05 11:52 UTC (permalink / raw)
  To: Jonathan Larmour, shkwon123; +Cc: ecos-discuss

> ??? wrote:
> >
> > Hi, all
> >
> > I'm making a simple application using "net" option of package.(FreeBSD
> > TCP/IP, CVS latest eCos)
> >
> > But, I found that the  TCP user data which is over 98 bytes cannot be
> > sent from or into target board. (target is ARM INTEGRATOR with ARM920T)
> >
> > When it comes to the Ping test, it also shows that ping packet with
> > data size of over 119 bytes cannot be sent.
> >
> > If the packet size is larger than the size, program contorl is stuck on
> > sendto or send.
> >
> > This happens on both IPv4 and IPv6 stack.
> >
> > Does eCos TCP/IP stack limit the packet size? or did I missed out some
> > option from CDL?
>
> This would be quite a big problem if widespread, which probably makes it
> something specific to your situation.
>
> Run "ecosconfig export foo.ecm" in the same directory as your .ecc to
> generate a foo.ecm file that will show you what options are different from
> the default (although a few of them e.g. for header files get set
> automatically in the net template).
>
> Jifl
> --

Well, I did not find any solution but a little details on this behaviour.
Regarding following two lines in file i82559.c in function TxMachine (The
hardware is same as above)

        OUTL(VIRT_TO_BUS(p_txcb), ioaddr + SCBPointer);
        OUTW(CU_START, ioaddr + SCBCmd);

when I see data starting from p_txcb I find it correct in both cases (first
sending total packet size less then or equal to160 and later total packet
size more than 160). This are first 16 bytes starting from p_txcb for total
packet length of 200. (by total packet length, I mean including ethernet, ip
headers)
(gdb)x/16xb p_txcb
0xf333cc: 0x00 0x00 0x04 0xe0 0xcc 0x3c 0xf3 0x80
0xf33cd4: 0xff 0xff 0xff 0xff 0xc8 0x80 0x10 0x00
(gdb)p /x p_txcb
0xf33ccc

pressing command next at line OUTW(CU_START, ioaddr + SCBCmd) sends packet
out if  packet length is less than 160 but does not send if packet lengh is
more than 160. Is it possible that addresses (p_txcb + 160) onwards are
somehow invalid?

Regards
Mohanlal

-- 
Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
and search the list archive: http://sources.redhat.com/ml/ecos-discuss

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [ECOS] Fwd: Packet size limit on TCP/IP stack ?
  2003-09-05 11:52   ` mohanlal jangir
@ 2003-09-05 14:03     ` Jonathan Larmour
  2003-09-09  1:37       ` mohanlal jangir
  0 siblings, 1 reply; 17+ messages in thread
From: Jonathan Larmour @ 2003-09-05 14:03 UTC (permalink / raw)
  To: mohanlal jangir; +Cc: shkwon123, ecos-discuss

mohanlal jangir wrote:
> 
>         OUTL(VIRT_TO_BUS(p_txcb), ioaddr + SCBPointer);
>         OUTW(CU_START, ioaddr + SCBCmd);
> 
> when I see data starting from p_txcb I find it correct in both cases (first
> sending total packet size less then or equal to160 and later total packet
> size more than 160). This are first 16 bytes starting from p_txcb for total
> packet length of 200. (by total packet length, I mean including ethernet, ip
> headers)
> (gdb)x/16xb p_txcb
> 0xf333cc: 0x00 0x00 0x04 0xe0 0xcc 0x3c 0xf3 0x80
> 0xf33cd4: 0xff 0xff 0xff 0xff 0xc8 0x80 0x10 0x00
> (gdb)p /x p_txcb
> 0xf33ccc
> 
> pressing command next at line OUTW(CU_START, ioaddr + SCBCmd) sends packet
> out if  packet length is less than 160 but does not send if packet lengh is
> more than 160. Is it possible that addresses (p_txcb + 160) onwards are
> somehow invalid?

Certainly could... you should examine your PCI window setup. InitTxRing() 
allocates these buffers from the PCI window. Perhaps the memory is 
corrupted, or overlaps with something else. i.e. look at 
CYGHWR_INTEL_I82559_PCI_MEM_MAP_SIZE and 
CYGHWR_INTEL_I82559_PCI_MEM_MAP_BASE. And of course your MMU setup (see if 
there are any special properties of the address at (start of packet + 160).

Jifl
-- 
eCosCentric    http://www.eCosCentric.com/    The eCos and RedBoot experts
--["No sense being pessimistic, it wouldn't work anyway"]-- Opinions==mine


-- 
Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
and search the list archive: http://sources.redhat.com/ml/ecos-discuss

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [ECOS] Fwd: Packet size limit on TCP/IP stack ?
  2003-09-05 14:03     ` Jonathan Larmour
@ 2003-09-09  1:37       ` mohanlal jangir
  2003-09-09  6:42         ` Andrew Lunn
  0 siblings, 1 reply; 17+ messages in thread
From: mohanlal jangir @ 2003-09-09  1:37 UTC (permalink / raw)
  To: Jonathan Larmour; +Cc: ecos-discuss


> mohanlal jangir wrote:
> >
> >         OUTL(VIRT_TO_BUS(p_txcb), ioaddr + SCBPointer);
> >         OUTW(CU_START, ioaddr + SCBCmd);
> >
> > when I see data starting from p_txcb I find it correct in both cases
(first
> > sending total packet size less then or equal to160 and later total
packet
> > size more than 160). This are first 16 bytes starting from p_txcb for
total
> > packet length of 200. (by total packet length, I mean including
ethernet, ip
> > headers)
> > (gdb)x/16xb p_txcb
> > 0xf333cc: 0x00 0x00 0x04 0xe0 0xcc 0x3c 0xf3 0x80
> > 0xf33cd4: 0xff 0xff 0xff 0xff 0xc8 0x80 0x10 0x00
> > (gdb)p /x p_txcb
> > 0xf33ccc
> >
> > pressing command next at line OUTW(CU_START, ioaddr + SCBCmd) sends
packet
> > out if  packet length is less than 160 but does not send if packet lengh
is
> > more than 160. Is it possible that addresses (p_txcb + 160) onwards are
> > somehow invalid?
>
> Certainly could... you should examine your PCI window setup. InitTxRing()
> allocates these buffers from the PCI window. Perhaps the memory is
> corrupted, or overlaps with something else. i.e. look at
> CYGHWR_INTEL_I82559_PCI_MEM_MAP_SIZE and
> CYGHWR_INTEL_I82559_PCI_MEM_MAP_BASE. And of course your MMU setup (see if
> there are any special properties of the address at (start of packet +
160).
>
> Jifl

PCI window memory seems to be ok. This is snapshot of target.ld
MEMORY
{
       ram : ORIGIN = 0, LENGTH = 0x01000000
}

__pci_window = 0xf00000; . = __pci_window + 0x100000;

CYGHWR_INTEL_I82559_PCI_MEM_MAP_BASE is initialized to
CYGARC_PHYSICAL_ADDRESS(CYG_LABEL_NAME(__pci_window)) and
CYGHWR_INTEL_I82559_PCI_MEM_MAP_SIZE is 0x100000. InitTxRing allocates
memory from this space. I have also enabled assert to see if PCI window is
going out of bounds but that never asserts.
MMU macros are as follows:
#define  CYGHWR_INTEL_I82559_PCI_VIRT_TO_BUS( _x_ )  (((cyg_uint32)( _x_ ))
| INTEGRATOT_HDR0_SDRAM_BASE)
#define CYGHWR_INTEL_I82559_PCI_BUS_TO_VIRT ( _x_ )  (((cyg_uint32( ( _x_ ))
& ~ INTEGRATOT_HDR0_SDRAM_BASE)

INTEGRATOT_HDR0_SDRAM_BASE is defined to 0x80000000. This seems to be  ok
for packets of size 160 as well as 160+.
I enabled DEBUG macro for i82559.c. Driver seems to working fair. All the
packets are transmitted well by driver but only packets having length less
than 160 are reaching to other end. Apparently there is no problem in
receiving packet of length more than 160. Problem occurs at transmission
time only. Any clue in this regard is appreciated.

Regards
Mohanlal

-- 
Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
and search the list archive: http://sources.redhat.com/ml/ecos-discuss

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [ECOS] Fwd: Packet size limit on TCP/IP stack ?
  2003-09-09  1:37       ` mohanlal jangir
@ 2003-09-09  6:42         ` Andrew Lunn
  2003-09-09  7:48           ` mohanlal jangir
  2003-09-10 10:23           ` [ECOS] Fwd: Packet size limit on TCP/IP stack ? mohanlal jangir
  0 siblings, 2 replies; 17+ messages in thread
From: Andrew Lunn @ 2003-09-09  6:42 UTC (permalink / raw)
  To: mohanlal jangir; +Cc: Jonathan Larmour, ecos-discuss

> I enabled DEBUG macro for i82559.c. Driver seems to working fair. All the
> packets are transmitted well by driver but only packets having length less
> than 160 are reaching to other end. Apparently there is no problem in
> receiving packet of length more than 160. Problem occurs at transmission
> time only. Any clue in this regard is appreciated.

A few things to try. For the moment i'm assuming the software is OK
and its a hardware/configuration problem. Check to see if there are
any runt packets on the network. The i82559 does a TX by first
prefilling the TX fifo with part of the packet. It then starts the TX
using what it has already in the fifo and getting the rest of the
packet from memory as quick as it can. I've had a problem with a
broken PCI arbiter which resulted in the transfer from main memory
being too slow and the i82559 sent all it had in its fifo while the
rest of the packet was still being DMAed from main memory. The i82559
then has to abort the packet. There is a register that controls how
much it should prefill the fifo with. Try increasing the prefill. Are
you running it at 100Mbit/s or 10? Try forcing it to 10 and see if
that makes a difference. At 10 it gives it more time to get the packet
from main memory.

     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

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [ECOS] Fwd: Packet size limit on TCP/IP stack ?
  2003-09-09  6:42         ` Andrew Lunn
@ 2003-09-09  7:48           ` mohanlal jangir
  2003-09-09  7:59             ` Andrew Lunn
  2003-09-10 10:23           ` [ECOS] Fwd: Packet size limit on TCP/IP stack ? mohanlal jangir
  1 sibling, 1 reply; 17+ messages in thread
From: mohanlal jangir @ 2003-09-09  7:48 UTC (permalink / raw)
  To: Andrew Lunn; +Cc: Jonathan Larmour, ecos-discuss


> > I enabled DEBUG macro for i82559.c. Driver seems to working fair. All
the
> > packets are transmitted well by driver but only packets having length
less
> > than 160 are reaching to other end. Apparently there is no problem in
> > receiving packet of length more than 160. Problem occurs at transmission
> > time only. Any clue in this regard is appreciated.
>
> A few things to try. For the moment i'm assuming the software is OK
> and its a hardware/configuration problem.
Some observations to be noted here: I have ARM Integrator board and i82559
network interface. On the same board, I have one wireless interface. I am
able to send any size packet over wireless interface but not with i82559.
Then I have one intel x86 machine having i82559 interface and there also I
am able to send any size packet. The problem is with Integrator board and
i82559 combination.

> Check to see if there are  any runt packets on the network.
No, I don't see any runt packets. Packets of size less than 160 appears well
and packets of size more than 160 does not appear at all.

> The i82559 does a TX by first
> prefilling the TX fifo with part of the packet. It then starts the TX
> using what it has already in the fifo and getting the rest of the
> packet from memory as quick as it can. I've had a problem with a
> broken PCI arbiter which resulted in the transfer from main memory
> being too slow and the i82559 sent all it had in its fifo while the
> rest of the packet was still being DMAed from main memory. The i82559
> then has to abort the packet. There is a register that controls how
> much it should prefill the fifo with. Try increasing the prefill.
You mean packets are being DMAed from driver transmission rings to network
card memory? I did look into i82559_configure function. There it seems to
configuring the device. I see array config_bytes in this function is filled
and later (in same function) device reads this array to configure itself.
Unfortunately I do not have i82559 manual available so I don't know which
byte is doing what. Is it  possible that prefill is zero? Because this could
be reason that I don't see runt packets and it is taking much time to DMA
packets of length more than 160. Could you please tell me how to change
prefill value?

> Are you running it at 100Mbit/s or 10? Try forcing it to 10 and see if
> that makes a difference. At 10 it gives it more time to get the packet
> from main memory.
I am running at 100Mbit/s. Again, I think this is configured in
i82559_configure. Please let me know how to change this.

Regards
Mohanlal


-- 
Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
and search the list archive: http://sources.redhat.com/ml/ecos-discuss

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [ECOS] Fwd: Packet size limit on TCP/IP stack ?
  2003-09-09  7:48           ` mohanlal jangir
@ 2003-09-09  7:59             ` Andrew Lunn
  2003-09-09 10:41               ` mohanlal jangir
  0 siblings, 1 reply; 17+ messages in thread
From: Andrew Lunn @ 2003-09-09  7:59 UTC (permalink / raw)
  To: mohanlal jangir; +Cc: Andrew Lunn, Jonathan Larmour, ecos-discuss

> No, I don't see any runt packets. Packets of size less than 160 appears well
> and packets of size more than 160 does not appear at all.

I would not totally trust that runt are not being sent. Only a few
network cards will actually tell you about them. Most silently discard
them.

> 
> > The i82559 does a TX by first
> > prefilling the TX fifo with part of the packet. It then starts the TX
> > using what it has already in the fifo and getting the rest of the
> > packet from memory as quick as it can. I've had a problem with a
> > broken PCI arbiter which resulted in the transfer from main memory
> > being too slow and the i82559 sent all it had in its fifo while the
> > rest of the packet was still being DMAed from main memory. The i82559
> > then has to abort the packet. There is a register that controls how
> > much it should prefill the fifo with. Try increasing the prefill.

> You mean packets are being DMAed from driver transmission rings to network
> card memory? 

Yes.

I did look into i82559_configure function. There it seems to
> configuring the device. I see array config_bytes in this function is filled
> and later (in same function) device reads this array to configure itself.
> Unfortunately I do not have i82559 manual available so I don't know which
> byte is doing what.

The i82558 programming manual is ( was the last time i looked) from
the Intel web site. The i82559 is backward compatible, so you can use
that for most of the registers.

> > Are you running it at 100Mbit/s or 10? Try forcing it to 10 and see if
> > that makes a difference. At 10 it gives it more time to get the packet
> > from main memory.

> I am running at 100Mbit/s. Again, I think this is configured in
> i82559_configure. Please let me know how to change this.

Connect your device to an old hub that only supports 10Mbit/s. The
i82559 will then negotiate down to 10Mbit/s. You can also set a
register in the i82559, but thats a bit harder to do.

       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

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [ECOS] Fwd: Packet size limit on TCP/IP stack ?
  2003-09-09  7:59             ` Andrew Lunn
@ 2003-09-09 10:41               ` mohanlal jangir
  2003-09-09 10:52                 ` Andrew Lunn
  0 siblings, 1 reply; 17+ messages in thread
From: mohanlal jangir @ 2003-09-09 10:41 UTC (permalink / raw)
  To: Andrew Lunn; +Cc: ecos-discuss

> I would not totally trust that runt are not being sent. Only a few
> network cards will actually tell you about them. Most silently discard
> them.
I think you are right because 82559 manual have some lines which favours
your statement. I wanted to confirm this by reading statistical counters of
82559 chip. It has one counter for packets which could not be transmitted
because of transmission underrun. The manual says, "A transmit underrun
occurs because the system bus can not keep up with the transmission. This
counter contains the number of frames that were either not transmitted or
retransmitted due to a transmit DMA underrun".
For reading the counters I tried to insert this code after call to TxMachine
{
   cyg_uint32  my_ioaddr = p_i82559->io_address;
   unsigned char stat_counters[20] = { 0x00 };
   unsigned char i;
   OUTL(VIRT_TO_BUS(stat_counters), my_ioaddr + SCBPointer);
   OUTW(CU_SHOWSTATS, my_ioaddr + SCBCmd);

   for(i = 0; i < sizeof(stat_counters); i++)
       os_printf("%02x ", stat_counters[i]);
   os_printf("\n");
}

But I was unable to read anything. It was showing all zeros. I haven't
interfaced with hardware device earlier. I thought, issuing CU_SHOWSTATS to
NIC will fill statistical counter values to address stat_counters. Could you
please help me in reading statistical counters?


> The i82558 programming manual is ( was the last time i looked) from
> the Intel web site. The i82559 is backward compatible, so you can use
> that for most of the registers.
Thanks. I have downloaded 8255X_OpenSDM.pdf and 82559 datasheet. These are
really very helpful.

> > I am running at 100Mbit/s. Again, I think this is configured in
> > i82559_configure. Please let me know how to change this.
>
> Connect your device to an old hub that only supports 10Mbit/s. The
> i82559 will then negotiate down to 10Mbit/s. You can also set a
> register in the i82559, but thats a bit harder to do.
I will try this option later. For this I have to manage suitable hub :-(

Regards
Mohanlal


-- 
Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
and search the list archive: http://sources.redhat.com/ml/ecos-discuss

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [ECOS] Fwd: Packet size limit on TCP/IP stack ?
  2003-09-09 10:41               ` mohanlal jangir
@ 2003-09-09 10:52                 ` Andrew Lunn
  2003-09-09 11:29                   ` mohanlal jangir
  0 siblings, 1 reply; 17+ messages in thread
From: Andrew Lunn @ 2003-09-09 10:52 UTC (permalink / raw)
  To: mohanlal jangir; +Cc: ecos-discuss

> For reading the counters I tried to insert this code after call to TxMachine
> {
>    cyg_uint32  my_ioaddr = p_i82559->io_address;
>    unsigned char stat_counters[20] = { 0x00 };
>    unsigned char i;
>    OUTL(VIRT_TO_BUS(stat_counters), my_ioaddr + SCBPointer);
>    OUTW(CU_SHOWSTATS, my_ioaddr + SCBCmd);
> 
>    for(i = 0; i < sizeof(stat_counters); i++)
>        os_printf("%02x ", stat_counters[i]);
>    os_printf("\n");
> }
> 
> But I was unable to read anything. It was showing all zeros. I haven't
> interfaced with hardware device earlier. I thought, issuing CU_SHOWSTATS to
> NIC will fill statistical counter values to address stat_counters. Could you
> please help me in reading statistical counters?

The variable stat_counters[] need to be in the PCI window otherwise
the device cannot access it over the PCI bus. Allocate the memory for
it using pciwindow_mem_alloc().  

   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

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [ECOS] Fwd: Packet size limit on TCP/IP stack ?
  2003-09-09 10:52                 ` Andrew Lunn
@ 2003-09-09 11:29                   ` mohanlal jangir
  2003-09-09 12:07                     ` Andrew Lunn
  0 siblings, 1 reply; 17+ messages in thread
From: mohanlal jangir @ 2003-09-09 11:29 UTC (permalink / raw)
  To: Andrew Lunn; +Cc: ecos-discuss

> The variable stat_counters[] need to be in the PCI window otherwise
> the device cannot access it over the PCI bus. Allocate the memory for
> it using pciwindow_mem_alloc().
>
oops..  my mistake. But it is still showing zero even after allocating from
PCI window. Any clue?
Regards
Mohanlal

-- 
Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
and search the list archive: http://sources.redhat.com/ml/ecos-discuss

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [ECOS] Fwd: Packet size limit on TCP/IP stack ?
  2003-09-09 11:29                   ` mohanlal jangir
@ 2003-09-09 12:07                     ` Andrew Lunn
  2003-09-10  1:58                       ` [ECOS] how to read statistical counters of 82559 !!! mohanlal jangir
  0 siblings, 1 reply; 17+ messages in thread
From: Andrew Lunn @ 2003-09-09 12:07 UTC (permalink / raw)
  To: mohanlal jangir; +Cc: ecos-discuss

On Tue, Sep 09, 2003 at 08:29:16PM +0530, mohanlal jangir wrote:
> > The variable stat_counters[] need to be in the PCI window otherwise
> > the device cannot access it over the PCI bus. Allocate the memory for
> > it using pciwindow_mem_alloc().
> >
> oops..  my mistake. But it is still showing zero even after allocating from
> PCI window. Any clue?

You need to use wait_for_cmd_done(). Look at how other commands are
executed.

        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

^ permalink raw reply	[flat|nested] 17+ messages in thread

* [ECOS] how to read statistical counters of 82559 !!!
  2003-09-09 12:07                     ` Andrew Lunn
@ 2003-09-10  1:58                       ` mohanlal jangir
  2003-09-10  6:25                         ` [ECOS] how to read statistical counters of 82559 !!! - success mohanlal jangir
  0 siblings, 1 reply; 17+ messages in thread
From: mohanlal jangir @ 2003-09-10  1:58 UTC (permalink / raw)
  To: ecos-discuss; +Cc: Andrew Lunn

[ Thanks to Andrew for his continuous support ]


I have been trying to read statistical counters of i82559 chip but
unsuccessful so far. This is the code, I inserted in i82559_send after call
to TxMachine.

{
#define MY_SIZE 64
   cyg_uint32 my_ioaddr = p_i82559->io_address;
   unsigned char *status_register = (unsigned
char*)pciwindow_mem_alloc(MY_SIZE);
   unsigned char i = 0;
   if(!status_register) {
      os_printf("memory out !!\n");
      goto out_of_scope;
   }
   memset(status_register, 0, MY_SIZE);
   wait_for_cmd_done(my_ioaddr, WAIT_CU);
   OUTL(VIRT_TO_BUS(status_register), my_ioaddr + SCBPointer);
   OUTW(CU_SHOWSTATS, my_ioaddr + SCBCmd);
   // wait_for_cmd_done(my_ioaddr, WAIT_CU);

   for(i = 0; i < MY_SIZE; i++) {
      os_printf("%02x  ",status_register[i]);
      if( i % 8 == 7)
           os_printf("\n");
   }
   os_printf("\n\n\n");
}

This dumps all zeros. I was not sure about call to wait_for_cmd_done. I did
try to call it before lines OUTL(VIRT_TO_BUS(status_register), my_ioaddr +
SCBPointer) then after line OUTW(CU_SHOWSTATS, my_ioaddr + SCBCmd) and then
at both place [hit and trial :-( ], but all dumps zero only. Can someone
give me some suggestions, what is wrong with code?
I have some questions in this regard. The second argument to function
wait_for_cmd_done is either WAIT_CU or WAIT_RU, corrosponding to Command
Unit and Receive Unit. I think dumping statistical counters is related to
Command Unit. Can someone give me more details about this? Also I found in
i82559.c, the function wait_for_cmd_done is called before writing to device,
while the function name indicates that it waits for "given command done".
Can someone clarify, when should I call wait_for_cmd_done. Before
writing/reading to device or after?
Please excuse me if my questions are silly. It's first time, I am
interfacing with some device.

Regards
Mohanlal


-- 
Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
and search the list archive: http://sources.redhat.com/ml/ecos-discuss

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [ECOS] how to read statistical counters of 82559 !!! - success
  2003-09-10  1:58                       ` [ECOS] how to read statistical counters of 82559 !!! mohanlal jangir
@ 2003-09-10  6:25                         ` mohanlal jangir
  2003-09-10  6:42                           ` Andrew Lunn
  0 siblings, 1 reply; 17+ messages in thread
From: mohanlal jangir @ 2003-09-10  6:25 UTC (permalink / raw)
  To: ecos-discuss

Well, I succedded finally. It was a matter of issuing wrong command.

wait_for_cmd_done(my_ioaddr, WAIT_CU);
OUTL(VIRT_TO_BUS(status_register), my_ioaddr + SCBPointer);
OUTW(SCB_M | CU_STATSADDR, my_ioaddr + SCBCmd);
wait_for_cmd_done(my_ioaddr, WAIT_CU);
OUTW(SCB_M | CU_DUMPSTATS, my_ioaddr + SCBCmd);

This filled address status_register with statistical counters. Thanks a  lot
to Andrew Lunn for his patience replies.
Can someone explain, why SCB_M is necessary?

Regards
Mohanlal

-- 
Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
and search the list archive: http://sources.redhat.com/ml/ecos-discuss

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [ECOS] how to read statistical counters of 82559 !!! - success
  2003-09-10  6:25                         ` [ECOS] how to read statistical counters of 82559 !!! - success mohanlal jangir
@ 2003-09-10  6:42                           ` Andrew Lunn
  0 siblings, 0 replies; 17+ messages in thread
From: Andrew Lunn @ 2003-09-10  6:42 UTC (permalink / raw)
  To: mohanlal jangir; +Cc: ecos-discuss

On Wed, Sep 10, 2003 at 03:13:33PM -0700, mohanlal jangir wrote:
> Well, I succedded finally. It was a matter of issuing wrong command.
> 
> wait_for_cmd_done(my_ioaddr, WAIT_CU);
> OUTL(VIRT_TO_BUS(status_register), my_ioaddr + SCBPointer);
> OUTW(SCB_M | CU_STATSADDR, my_ioaddr + SCBCmd);
> wait_for_cmd_done(my_ioaddr, WAIT_CU);
> OUTW(SCB_M | CU_DUMPSTATS, my_ioaddr + SCBCmd);
> 
> This filled address status_register with statistical counters. Thanks a  lot
> to Andrew Lunn for his patience replies.
> Can someone explain, why SCB_M is necessary?

Not from the top of my head. 

The best source of information about things like this is the data
sheet for the chip. I will be explained in there, you just need to
find it.

     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

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [ECOS] Fwd: Packet size limit on TCP/IP stack ?
  2003-09-09  6:42         ` Andrew Lunn
  2003-09-09  7:48           ` mohanlal jangir
@ 2003-09-10 10:23           ` mohanlal jangir
  2003-09-10 11:32             ` [ECOS] Fwd: Packet size limit on TCP/IP stack ? - success mohanlal jangir
  1 sibling, 1 reply; 17+ messages in thread
From: mohanlal jangir @ 2003-09-10 10:23 UTC (permalink / raw)
  To: Andrew Lunn; +Cc: ecos-discuss

> A few things to try. For the moment i'm assuming the software is OK
> and its a hardware/configuration problem. Check to see if there are
> any runt packets on the network. The i82559 does a TX by first
> prefilling the TX fifo with part of the packet. It then starts the TX
> using what it has already in the fifo and getting the rest of the
> packet from memory as quick as it can.
After having a deep eye on document 8255X_OpenSDM.pdf and fiddling with
82559 driver source code, conclusion is that you are absolutely right :-). I
found that on every packet (of length more than 160) transmission, the
counter tx_underrun is incremened by one. My all five packets of length more
than 160 are becoming runt . But I don't know why counter tx_good always
shows 0xFFFFFFFF although five packets (of length equal to 160) are reaching
to other end.

> I've had a problem with a
> broken PCI arbiter which resulted in the transfer from main memory
> being too slow and the i82559 sent all it had in its fifo while the
> rest of the packet was still being DMAed from main memory. The i82559
> then has to abort the packet.
Seems I am also having same problem. So how do I go now? Do I need to look
in PCI arbiter settings?

> There is a register that controls how
> much it should prefill the fifo with. Try increasing the prefill.
In 8255X_OpenSDM.pdf, I could not figure out about prefill. It is talking
about some pre-amble but not prefill (Is it some standard word?). The
pre-amble lengh is set to 7(decimal) and could be max 10. I did try to
change to 10 but that is having no effect. So I am assuming this is
different from prefill, you are talking about. I am still looking in
document to find which register controls prefill value. Any clue?

Regards
Mohanlal

-- 
Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
and search the list archive: http://sources.redhat.com/ml/ecos-discuss

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [ECOS] Fwd: Packet size limit on TCP/IP stack ? - success
  2003-09-10 10:23           ` [ECOS] Fwd: Packet size limit on TCP/IP stack ? mohanlal jangir
@ 2003-09-10 11:32             ` mohanlal jangir
  0 siblings, 0 replies; 17+ messages in thread
From: mohanlal jangir @ 2003-09-10 11:32 UTC (permalink / raw)
  To: Andrew Lunn; +Cc: ecos-discuss

 > A few things to try. For the moment i'm assuming the software is OK
 > and its a hardware/configuration problem. Check to see if there are
 > any runt packets on the network. The i82559 does a TX by first
 > prefilling the TX fifo with part of the packet. It then starts the TX
 > using what it has already in the fifo and getting the rest of the
 > packet from memory as quick as it can.

Hi Andrew,
   It is working now :-). Thanks a lot for your support. I changed in
function i82559_configure for "UnderRun Retry" bits. This affects to
prefill.
Thanks a lot.

Regards
Mohanlal

-- 
Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
and search the list archive: http://sources.redhat.com/ml/ecos-discuss

^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2003-09-10 11:32 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-09-03  0:32 [ECOS] Fwd: Packet size limit on TCP/IP stack ? 권순환
2003-09-03  3:13 ` Jonathan Larmour
2003-09-05 11:52   ` mohanlal jangir
2003-09-05 14:03     ` Jonathan Larmour
2003-09-09  1:37       ` mohanlal jangir
2003-09-09  6:42         ` Andrew Lunn
2003-09-09  7:48           ` mohanlal jangir
2003-09-09  7:59             ` Andrew Lunn
2003-09-09 10:41               ` mohanlal jangir
2003-09-09 10:52                 ` Andrew Lunn
2003-09-09 11:29                   ` mohanlal jangir
2003-09-09 12:07                     ` Andrew Lunn
2003-09-10  1:58                       ` [ECOS] how to read statistical counters of 82559 !!! mohanlal jangir
2003-09-10  6:25                         ` [ECOS] how to read statistical counters of 82559 !!! - success mohanlal jangir
2003-09-10  6:42                           ` Andrew Lunn
2003-09-10 10:23           ` [ECOS] Fwd: Packet size limit on TCP/IP stack ? mohanlal jangir
2003-09-10 11:32             ` [ECOS] Fwd: Packet size limit on TCP/IP stack ? - success mohanlal jangir

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).