How to increase TCP throughput

Microchip TCP/IP Stack

Microchip TCP/IP Stack Help
How to increase TCP throughput

Methods to increase TCP throughput

  1. Enlarge generic TCP rx/tx buffer size. Refer to TCPIP MRF24W.h.

In TCPIP MRF24W.h modify the buffer size accordingly. 

For example, 

{TCP_PURPOSE_GENERIC_TCP_CLIENT, TCP_ETH_RAM, 1024, 100}, 

{TCP_PURPOSE_GENERIC_TCP_SERVER, TCP_ETH_RAM, 20, 4096}, 

 

  1. In tcp.c, increase max TCP segment size.

For example, change #define TCP_MAX_SEG_SIZE_RX from (536u) to (1460u). 

 

3. Disable TCP rx checksum check. This is not necessary because packet integrity is guaranteed by the MAC layer CRC32 check. 

BOOL TCPProcess(NODE_INFO* remote, IP_ADDR* localIP, WORD len) { 

TCP_HEADER TCPHeader; 

PSEUDO_HEADER pseudoHeader; 

WORD_VAL checksum1; 

WORD_VAL checksum2; 

BYTE optionsSize; 

 

#if 0 // disable TCP RX checksum check 

// Calculate IP pseudoheader checksum. 

pseudoHeader.SourceAddress = remote->IPAddr; 

pseudoHeader.DestAddress = *localIP; 

pseudoHeader.Zero = 0x0; 

pseudoHeader.Protocol = IP_PROT_TCP; 

pseudoHeader.Length = len; 

SwapPseudoHeader(pseudoHeader); 

checksum1.Val = ~CalcIPChecksum((BYTE*)&pseudoHeader, 

sizeof(pseudoHeader)); 

// Now calculate TCP packet checksum in NIC RAM - should match 

// pesudo header checksum 

checksum2.Val = CalcIPBufferChecksum(len); 

// Compare checksums. 

if(checksum1.Val != checksum2.Val) 

MACDiscardRx(); 

return TRUE; 

#endif 

 

4. Use PIC ram as TCB buffer instead of MRF24W scratch memory. 

Iin TCPIP MRF24W.h 

for example 

Change 

{TCP_PURPOSE_FTP_DATA, TCP_ETH_RAM, 0, 128}, 

to 

{TCP_PURPOSE_FTP_DATA, TCP_PIC_RAM, 0, 4096},

Microchip TCP/IP Stack 5.42.08 - June 15, 2013
Copyright © 2012 Microchip Technology, Inc.  All rights reserved.