Beruflich Dokumente
Kultur Dokumente
protocol was interfaced to the socket, and how data was removed from the
application and placed in queues for transmission. In this section, we cover the
actual packet transmission (see Figure).
Now it is time to transmit the TCP segments, and the function tcp_Transmit_skb does
the actual packet transmission. It sends the packets that are queued to the socket.
It can be called from anywhere in TCP state processing when there is a request to
send a segment. Earlier, we saw how tcp_sendmsg readied the segments for
transmission and queued them to the socket�s write queue. In tcp_transmit_skb, we
build the TCP packet header and pass the packet on to IP.
if(skb != NULL) {
Inet points to the inet options structure, and tp points to the TCP options
structure. It is in tcp_opt where the socket keeps most of the configuration and
connection state information for TCP. Tcb points to the TCP control buffer
containing most of the flags as well as the partially constructed TCP header. Th is
a pointer to the TCP header. Later, it will point to the header part of the skb,
and sysctl_flags is for some critical parameters configured via sysctl and
setsockopt calls.
tcp_header_size += (TCPOLEN_SACK_BASE_ALIGNED +
(tp->eff_sacks * TCPOLEN_SACK_PERBLOCK));
}
?
Now that we know the size of the TCP header, we adjust the skb to allow for
sufficient space.
th->source = inet->sport;
th->dest = inet->dport;
th->seq = htonl(tcb->seq);
th->ack_seq = htonl(tp->rcv_nxt);
*(((__u16 *)th)+6)=htons(((tcp_header_size >> 2)<<12)|
tcb->flags);
?
The advertised window size is determined. If this packet is a SYN packet;
otherwise, the window size is scaled by calling tcp_select_window.
err = tp->af_specific->queue_xmit(skb);
if (err <= 0)
return err;
tcp_enter_cwr(tp);
?
A return of a value less than zero tells the caller that the packet is dropped. We
return all errors except explicit congestion notification, which doesn�t indicate
to the caller that the packet was dropped.