The TCP SKB control block is defined in
struct tcp_skb_cb { union { struct inet_skb_parmh4; struct inet6_skb_parmh6; } header; /* For incoming frames */ ...
... __u32 seq; /* Starting sequence number */ __u32 end_seq; /* SEQ + FIN + SYN + datalen */ ...
... __u32 when; /* used to compute rtt's */ ...
... __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 ...
... __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) ...
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.