Variable TCP Receive Window

Explains how to improve performance of TCP/IP stack.

The performance of the existing Symbian platform TCP/IP stack is improved by doing the following:

  • Setting an initial TCP receive window size that depends on the bearer type.

  • Allowing the TCP receive window size to dynamically resize when there is a change in modulation. For example, GPRS to EDGE or 2G to 3G.

Bearers provide different bandwidth for data transmission using TCP/IP. The connection setup between TCP hosts are through three-way handshake. The TCP receive window size parameter is set during the connection startup.

To indicate the TCP receive window size, the TCP header contains a 16-bit window field. The TCP receive window size denotes the maximum number of bytes that a sender can send and a receiver can receive. The TCP header can have any value between 0 and 64KB. Use the TCP window scaling to increase the window size beyond 64kB. The sender and receiver must agree to the scaling factor. The scaling factor can be multiplied at both the ends to increase the window size. For example, if the scaling factor is 2 and the window size negotiated is 96KB, then the stored window size is 48KB. Also a scaling factor of 2 yields the effective size of 96KB. The TCP receive maximum window size is mentioned in tcpip.ini file.

At ROM build time, the (NetMCPR) plug-in configures the TCP receive window. It is possible to enable or disable the adaptive window size based on the bearer type. This helps some bearers to use adaptive window size and other bearers to use fixed pre-defined windows. The lookup table provides the information on TCP receive window size at licensees specific MCPR (NetMCPR). Licensees are provided with the TCP receive window interface.

TCP receive window must be changed due to the following reasons:

  • Change in modulation due to the network change - modulation value for bearer varies in different network. Modulation change in the network triggers the notification to change the TCP receive window for the connected TCP sockets. For example, change in network from 2.5G to 3G.

  • Change in bearer - Forces the TCP/IP stack to supply a new TCP receive window that is specific to the new bearer.

Bearer types

The following are the bearer types that support the TCP receive window:

  • General Packet Radio Service (GPRS 2.5G)

  • Enhanced Data Rate for GSM Evolution (EDGE 2.75G or 3G – depends on the modulation scheme)

  • Universal Mobile Telecommunications System (UMTS 3G)

  • High-Speed Downlink Packet Access (HSDPA 3G)

  • WLAN

Lookup table

The lookup table contains the entries of TCP receive window size for each bearer type. To set the TCP receive window size for bearer, licensees must override the SetTcpWin() function. The licensees can define their own TCP window lookup table and set the TCP receive window size for a bearer.

Symbian uses the following lookup table for testing purpose. The licensees can replace the TCP receive window size with their own values:

Bearer or Modulation

TCP receive window size

GPRS

12240 – 17520

EDGE

21760 – 49640

UMTS

29920 – 33580

HSDPA

65535 or greater

WLAN

65535 or greater

Ethernet

65335

Handling TCP receive window in TCP/IP stack

The following are the scenarios to handle the TCP receive window:

  • Increase window size - Change in the bearer increases the window size.

  • Decrease window size - Change in the bearer decreases the window size till it reaches the appropriate size for the new bearer.