cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
7,495 Views
Registered: ‎10-15-2010

LWIP problem, cannot send frame smaller than 952Bytes

Hi,

 

I'm using LWIP stack with a virtex5 PPC440 and HDMA(8192 buffers of 2048 Bytes).

It's actually working pretty well (250Mbps), with frame between 952Bytes to 64KBytes.

 

My problem is that when i use the tcp_write() function, i have to put frame lenght with a multiple of 2048 bigger than 952Bytes (average).

For example :

2040 Bytes => OK

556 Bytes => BAD

4088 Bytes => 2048 + 2040 => OK

4120 Bytes => 2048 + 2048 + 24 => BAD

 

It's really strange and i don't understand at all why i cannot put the size i want. Anyway when i'm on a bad way i get a tcp_err = -4 that correspond to "#define ERR_ABRT       -4    /* Connection aborted.      */"

 

Can someone help me please !!!

Thank you so much

 

bellow my lwipopts.h:

--------------------------------------------------------------------------------------------------------------

#ifndef __LWIPOPTS_H_
#define __LWIPOPTS_H_

#define SYS_LIGHTWEIGHT_PROT 1

#define NO_SYS 1
#define LWIP_SOCKET 0
#define LWIP_COMPAT_SOCKETS 0
#define LWIP_NETCONN 0

#define MEM_ALIGNMENT 64
#define MEM_SIZE 131072
#define MEMP_NUM_PBUF 16
#define MEMP_NUM_UDP_PCB 4
#define MEMP_NUM_TCP_PCB 32
#define MEMP_NUM_TCP_PCB_LISTEN 8
#define MEMP_NUM_TCP_SEG 256
#define LWIP_USE_HEAP_FROM_INTERRUPT 1

#define MEMP_NUM_SYS_TIMEOUT 8
#define PBUF_POOL_SIZE 256
#define PBUF_POOL_BUFSIZE 1700
#define PBUF_LINK_HLEN 16

#define ARP_TABLE_SIZE 10
#define ARP_QUEUEING 1

#define ICMP_TTL 255

#define IP_OPTIONS 0
#define IP_FORWARD 0
#define IP_REASSEMBLY 1
#define IP_FRAG 1
#define IP_REASS_BUFSIZE 5760
#define IP_FRAG_MAX_MTU 1500
#define IP_DEFAULT_TTL 255
#define LWIP_CHKSUM_ALGORITHM 3

#define LWIP_UDP 1
#define UDP_TTL 255

#define LWIP_TCP 1
#define TCP_SND_QUEUELEN   16 * TCP_SND_BUF/TCP_MSS
#define TCP_MSS 1460
#define TCP_SND_BUF 8192
#define TCP_WND 2048
#define TCP_TTL 255
#define TCP_MAXRTX 12
#define TCP_SYNMAXRTX 4
#define TCP_QUEUE_OOSEQ 1
#define CHECKSUM_GEN_TCP 0
#define CHECKSUM_CHECK_TCP 0

#define LWIP_DHCP 0
#define DHCP_DOES_ARP_CHECK false

#define CONFIG_LINKSPEED_AUTODETECT 1

#endif
--------------------------------------------------------------------------------------------------------------

Tags (3)
0 Kudos
8 Replies
7,486 Views
Registered: ‎10-15-2010

please help !!

0 Kudos
7,479 Views
Registered: ‎10-15-2010

PLEASE .............

0 Kudos
heedaf
Explorer
Explorer
7,453 Views
Registered: ‎06-25-2008

Are you able to step through the code to see where the problem is occurring?

 

What about taking out jumbo frames and see if it works consistent without it?

0 Kudos
7,445 Views
Registered: ‎10-15-2010

Thanks to reply !!

 

>Are you able to step through the code to see where the problem is occurring?

not really, i just use the LWIP macro "tcp_write"

 

>What about taking out jumbo frames and see if it works consistent without it?

I disable it on the "plateform setting", what makes you think that i'm using it ? do i miss something ?

0 Kudos
heedaf
Explorer
Explorer
7,431 Views
Registered: ‎06-25-2008

If you are not using Jumbo Frames then you should be limited to 1460 bytes for the data size of the packet.

0 Kudos
7,418 Views
Registered: ‎10-15-2010

Actually i did a mistake on my explanation. Sorry.

As you said the limitation is 1460bytes, and not 2048.

 

Anyway, the problem is still the same cause for a 2048bytes packet, it should be cut in 2 TCP packets (1460+588).

So if i send :

- less than 900bytes (approximatly) i got a -4 error on the LWIP.

- if it's between 900 and 1460, it works well

- if it's more than 1460 but the last packet is more than 900 (ex : 2484 = 1460+1024), it works well

- if it's more than 1460 but the last packet is less than 900 (ex : 3462 = 1460+1460+542), i got a -4 error on the LWIP.

0 Kudos
stephenm
Xilinx Employee
Xilinx Employee
7,413 Views
Registered: ‎09-12-2007

Are you guys using XAPP1026? Then you have come across a bug that I have fixed in the next release. Below is a summary of the issue:

 

In the section "Interacting with the TFTP Server", when I execute put or get command to transfer exact multiple of 512bytes data, transaction never finishes.

According to tftp protocol specification, it says "If the size of the transferred file is an exact multiple of the block-size, the source sends a final DATA packet containing 0 bytes of data."
I referred this web page.
http://en.wikipedia.org/wiki/Trivial_File_Transfer_Protocol

The fuctions in tftpserver.c, 0 byte of data isn't sent.
int tftp_process_read(int sd, struct sockaddr_in *to, char *fname)
int tftp_process_write(int sd, struct sockaddr_in *to, char *fname)

After modify the source code, it works.

[int tftp_process_read(int sd, struct sockaddr_in *to, char *fname)]
Original code:
n = mfs_file_read(fd, buf, TFTP_DATA_PACKET_MSG_LEN);
if (n <= 0)
    break;

Modified code:
n = mfs_file_read(fd, buf, TFTP_DATA_PACKET_MSG_LEN);
if (n == 0){
    if( last_packet == TFTP_DATA_PACKET_MSG_LEN){
        // If previous data is equal to TFTP_DATA_PACKET_MSG_LEN then send 0 byte data.
    }else{
        break;
    }
}else if(n < 0){
    break;
}
last_packet = n;

[int tftp_process_write(int sd, struct sockaddr_in *to, char *fname)]
Original code:
if ((datalen > 4) && (tftp_extract_block(buf) == (block + 1)))
    data_received = 1;

Modified code:
if ((datalen >= 4) && (tftp_extract_block(buf) == (block + 1)))
    data_received = 1; <script type="text/javascript">// function toggleToc(el) { var parEl = el.parentNode; while(parEl.id != "toc") { parEl = parEl.parentNode; } var tocTable = parEl.getElementsByTagName('ul')[0]; if (tocTable.style.display == 'none') { el.innerHTML = "Hide"; tocTable.style.display = 'block'; document.cookie = 'hidetoc=0'; } else { el.innerHTML = "Show"; tocTable.style.display = 'none'; document.cookie = 'hidetoc=1'; }} // </script>

0 Kudos
7,411 Views
Registered: ‎10-15-2010

>

Thanks for your help, but i don't use the TFTP server application. I use a custom app based on the web server.

So the function that i use to send data over the LAN is "tcp_write".

Do you know if there is kind of same problem with this function ?

 


0 Kudos