The TCP SKB control block is defined in as follows:


struct tcp_skb_cb {
	union {
		struct inet_skb_parmh4;
		struct inet6_skb_parmh6;
	} header;	/* For incoming frames */
	...

Before input TCP packets are processed by TCP, the upper layer (ipv4 or ipv6) examine the packet first. They also use the SKB control block area to record various bits of per-packet information. For example, ipv4 records the IP header options parsed from the protocol header. In order to not corrupt the protocol level data stored here by ipv4/ipv6, we define this union at the front of the TCP control block.
	...
	__u32		seq;		/* Starting sequence number	*/
	__u32		end_seq;	/* SEQ + FIN + SYN + datalen	*/
	...

These define the TCP sequence numbers covered by the packet. The seq value is simply the sequence number in the TCP packet header on input. As suggested by the comment, the end_seq member is calculated as seq plus the number of data bytes in the TCP packet, plus 1 if the FIN bit is set, and plus 1 if the SYN bit is set.
	...
	__u32		when;		/* used to compute rtt's	*/
	...

When a TCP packet is sent, we record the current jiffies value here. It is used to later calculate the round trip time estimates, if necessary.
	...
	__u8		flags;		/* TCP header flags.		*/

	/* NOTE: These must match up to the flags byte in a
	 *	 real TCP header.
	 */
#define TCPCB_FLAG_FIN		0x01
#define TCPCB_FLAG_SYN		0x02
#define TCPCB_FLAG_RST		0x04
#define TCPCB_FLAG_PSH		0x08
#define TCPCB_FLAG_ACK		0x10
#define TCPCB_FLAG_URG		0x20
#define TCPCB_FLAG_ECE		0x40
#define TCPCB_FLAG_CWR		0x80
	...

This member records the raw TCP header flags field we will use in the packet we send out. It is used by tcp_transmit_skb() to fill in the TCP header properly.
	...
	__u8		sacked;		/* State flags for SACK/FACK.	*/
#define TCPCB_SACKED_ACKED	0x01	/* SKB ACK'd by a SACK block	*/
#define TCPCB_SACKED_RETRANS	0x02	/* SKB retransmitted		*/
#define TCPCB_LOST		0x04	/* SKB is lost			*/
#define TCPCB_TAGBITS		0x07	/* All tag bits			*/

#define TCPCB_EVER_RETRANS	0x80	/* Ever retransmitted frame	*/
#define TCPCB_RETRANS		(TCPCB_SACKED_RETRANS|TCPCB_EVER_RETRANS)

#define TCPCB_URG		0x20	/* Urgent pointer advenced here	*/

#define TCPCB_AT_TAIL		(TCPCB_URG)
	...

The sacked field holds the retransmission state for a packet. It also indicates whether the packet contains urgent data or not. As SACK packets arrive from the receiver, they are inspected and the TCPCB_TAGBITS fields are updated as needed. Then, the retransmission engine decides whether the retransmit packets or not.

If a retransmit timeout occurs, all of the SACK state tage bits are cleared, and we forget that state.

If an SKB is retransmitted in any way (either via timeout, or via fast retransmit), the TCPCB_EVER_RETRANS bit is set. Both TCPCB_SACK_RETRANS and TCPCB_EVER_RETRANS are set by tcp_retransmit_skb(). The TCPCB_SACK_RETRANS bit is selectively cleared by routines such as tcp_enter_loss().


	...
	__u16		urg_ptr;	/* Valid w/URG flags is set.	*/
	__u32		ack_seq;	/* Sequence number ACK'd	*/
};

#define TCP_SKB_CB(__skb)((struct tcp_skb_cb *)&((__skb)->cb[0]))

The urg_ptr states the URG pointer TCP header value to use if TCPCB_FLAG_URG is set in the flags. The ack_seq is the ACK sequence from the TCP header on input packets.


Google