Notes on the TCP/CM implementation: Linux
The TCP/CM implementation replaces/modifies the following files:
- net/ipv4/tcp_input.c (replaced by cm_tcp_input.c)
- net/ipv4/tcp_output.c (replaced by cm_tcp_output.c)
- net/ipv4/tcp_ipv4.c
- net/ipv4/tcp_timer.c
- include/net/sock.h
- include/net/tcp.h
The changes to the files replaces the congestion control in normal
TCP with calls to congestion manager (CM). The TCP control variables
of snd_cwnd, snd_ssthresh and snd_cwn_cnt have been removed. All
updates and tests of these variables have been removed.
A new variable, snd_max (the max sequence number sent so
far), has been added.
Calls to tcp_write_xmit(sk) have been replaced with
cm_request(SK_CM_FLOW(sk)) in accordance with the CM API.
In tcp.h, the comparison between in_flight and
cwnd has been removed in tcp_snd_test, since this
functionality is implemented using the CM.
In tcp_ipv4.c, tcp_v4_destroy_sock(sk) also calls
cm_close(SK_CM_FLOW(sk)) in addition to doing its thing.
In tcp_timer.c, the function tcp_retrans_timer calls
cm_update() for the packets it has identified as lost or
reached their destination (i.e., cleared the "pipe"). The average
pktsize is used when the exact amount of data is unknown.
In cm_tcp_output.c (which obsoletes tcp_output.c), the following
changes have been made:
- tcp_send_skb() now always enqueues data and calls
cm_request().
- A new function, tcp_cm_callback(), implements the callback
for cm_requests. It simply calls tcp_write_xmit() for the
socket.
- tcp_write_xmit() has been modified to send at most one
MSS-sized packet at a time. If there is more to send, it calls
cm_request() again.
- tcp_connect() calls cm_open in addition to doing its thing.
In cm_tcp_input.c (which obsoletes tcp_input.c), the following
changes have been made:
- tcp_fast_retrans() calls cm_update() for the
packets it has identified as lost or reached their destination (i.e.,
cleared the pipe). The average pktsize is used when the exact amount
of data is unknown.
- In tcp_ack, RTT estimates of 0 are changed to 1 tick; 0
is not accepted by cm_update(). For all new acks, cm_update
is called to match up the estimate of inflight data.
- Calls to tcp_data_snd_check() are replaced with a check
for outstanding data and a call to cm_request().
Current gross hacks
-
cm_update calls for pure header packets (pure ACKs, etc.)
are done as soon as they are sent. This is because there are no ACKs
for these packets.
- Retransmissions are sent without doing a cm_request()
(i.e. they ignore CM). This is to ensure that they are sent in a
timely fashion.
- Pure ACKs, SYNs, SYN-ACKs are sent without cm_request().
This is probably quite alright.