DOC PREVIEW
U of I CS 498 - LECTURE

This preview shows page 1-2-3-18-19-37-38-39 out of 39 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 39 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 39 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 39 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 39 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 39 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 39 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 39 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 39 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 39 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

CS 498 Lecture 16 TCP Implementation in LinuxOutlinePath of Incoming SegmentsTCP Implementation in Linuxtcp_v4_rcv(skb,len)Process of Receiving a Segmenttcp_v4_do_rcv()tcp_rcv_established(sk,skb,th,len)TCP HeaderSlide 10Slide 11Header PredictionSlide 13Fast Path in tcp_rcv_established()Slide 15Slide 16Slide 17Slide 18Helper Function – tcp_ack()Helper Function – tcp_data_snd_check()Window Kept at the SenderSlow PathSlow Path (cont’d)Slide 24Helper Function – tcp_ack_snd_check()Window Kept at the ReceiverPath of Outgoing SegmentsSlide 28PowerPoint Presentationtcp_sendmsg()Slide 31tcp_send_skb()tcp_snd_test()Slide 34Slide 35tcp_transmit_skb()Slide 37Slide 38tcp_push_pending_frames()CS 498 Lecture 16 TCP Implementation in LinuxJennifer HouDepartment of Computer Science University of Illinois at Urbana-ChampaignReading: Chapter 24, The Linux Networking Architecture: Design and Implementation of Network Protocols in the Linux KernelOutlinePaths of Incoming and outgoing segments (this lecture)Connection management (lecture 17)Flow control and congestion control (lecture 18)Path of Incoming SegmentsTCP Implementation in Linuxip_input.cip_input.cip_local_deliverip_output.cip_output.cip_queue_xmittcp_v4_rcvtcp_v4_do_rcv__tcp_v4_lookup()tcp_rcv_establishedTCP_ESTABLISHEDtcp_rcv_state_processtcp_sendmsgtcp_send_skbtcp_transmit_skbtcp_ack_snd_checktcp_data_snd_checktcp_write_xmittcp_write_timertcp_re -transmit_skbtcp_send_(delayed)_acktcp_acktcp_datatcp_data _queuesk->data_readyFast PathFast PathSlowPathsendPureACKRetrans.TimerTCPAbschnitt 24.3tcp_v4_rcv(skb,len)Checks if the packet is really addressed to the host (skbpkt_type == PACKET_HOST). If not, the packet is discarded.Invokes tcp_v4_lookup() to search the hash table of active sockets for the matching sock structure.Source/destination IP addresses and ports and the network device index skbdstrt_iif at which the segment arrive are used to index into the hash table.If a matched sock structure is located, tcp_v4_do_rcv() is invoked; otherwise, tcp_send_reset() sends a RESET segment.Process of Receiving a Segmenttcp_v4_rcvtcp_v4_do_rcvsk_filtertcp_rcv_establishedtcp_send_resetip_local_delivertcp_v4_lookuptcp_rcv_state_processSee Section 24.3, „Connection Management“Alternative call, which is not covered in the discussionHeader-PredictionFast-Path . . .Slow-Path . . .tcp_v4_do_rcv()If the TCP state (skstate) is TCP_ESTABLISHED, invokes tcp_rcv_established().One of the other states, invokes tcp_rcv_state_process(), i.e., the TCP state machine will be examined to determine state transition.tcp_rcv_established(sk,skb,th,len)Dispatches packets to fast path or slow pathPackets are processed in fast path ifThe segment received is a pure ACK segment for the data sent last.The segment received contains the data expected.TCP HeaderSource port Destination portSequence numberAcknowledgement numberWindow SizeChecksum Urgent pointerOptions (0 or more 32-bit words)TCP data (optional)HeaderLengthBit 0 16 31URGACKPSHRSTSYNFINSource port Destination portSequence numberAcknowledgement numberWindow SizeChecksum Urgent pointerOptions (0 or more 32-bit words)TCP data (optional)HeaderLengthBit 0 16 31URGACKPSHRSTSYNFINURGACKPSHRSTSYNFINtcp_rcv_established(sk,skb,th,len)Packets are processed in slow path ifIf SYN, URG, FIN, RST flag is set (detected in Header Prediction).The SN of the segment does not correspond to tprcv_nxt.The communication is two-way.The segment contains a zero window advertisement.The segment contains TCP options other than the timestamp option.Process of Receiving a Segmenttcp_v4_rcvtcp_v4_do_rcvsk_filtertcp_rcv_establishedtcp_send_resetip_local_delivertcp_v4_lookuptcp_rcv_state_processSee Section 24.3, „Connection Management“Alternative call, which is not covered in the discussionHeader-PredictionFast-Path . . .Slow-Path . . .Header Predictionif ((tcp_flag_word(th) & TCP_HP_BITS) == tp->pred_flags && TCP_SKB_CB(skb)->seq == tp->rcv_nxt) { (… FAST PATH…) }else{ (… SLOW PATH…) }Note that 1. #define TCP_HP_BITS (~(TCP_RESERVED_BITS|TCP_FLAG_PSH))2. tp->pred_flags is set in tcp_fast_path_on()Header Predictionstatic __inline__ void __tcp_fast_path_on(struct tcp_opt *tp, u32 snd_wnd) { tp->pred_flags = htonl((tp->tcp_header_len << 26) | ntohl(TCP_FLAG_ACK) | snd_wnd); } static __inline__ void tcp_fast_path_on(struct tcp_opt *tp) { __tcp_fast_path_on(tp, tp->snd_wnd>>tp->snd_wscale); }Fast Path in tcp_rcv_established()1. TCP_SKB_CB(skb)seq == tprcv_nxt? If so, proceed.2. Checks if the timestamp option exists. If so, the timestamp value, Tsval and Tsecr are read. If the condition to update the tpts_recent timestamp is met (i.e., tp->rcv_tsval - tp->ts_recent < 0 ), the values are accepted by tcp_store_ts_recent().Type:8 Len:10 Timestamp valueValue of timestamp received1 Byte 1 Byte 4 Bytes 4 BytesTsvalTsecrFast Path in tcp_rcv_established()3. packet header length == segment length?4. Yes  ACM segmentInvokes tcp_ack() to process the ack.Invokes __kfree_skb() to release the socket bufferInvokes tcp_data_snd_check() to check if local packets can be sent (because of the send quota induced by the ack).Fast Path in tcp_rcv_established()5. No  Data segmentIf the payload can be copied directly into the user space, the statistics of the connection are updatedthe relevant process is informedthe payload is copied into the receive memory of the processThe sequence number expected next is updatedIf the payload cannot be copied directlyChecks if the receive buffer for the socket is sufficientThe statistics of the connection are updatedThe segment is added to the end of the receive queue of the socketThe sequence number expected next is updated.TCP Implementation in Linuxip_input.cip_input.cip_local_deliverip_output.cip_output.cip_queue_xmittcp_v4_rcvtcp_v4_do_rcv__tcp_v4_lookup()tcp_rcv_establishedTCP_ESTABLISHEDtcp_rcv_state_processtcp_sendmsgtcp_send_skbtcp_transmit_skbtcp_ack_snd_checktcp_data_snd_checktcp_write_xmittcp_write_timertcp_re -transmit_skbtcp_send_(delayed)_acktcp_acktcp_datatcp_data _queuesk->data_readyFast PathFast PathSlowPathsendPureACKRetrans.TimerTCPAbschnitt 24.3Fast Path in tcp_rcv_established()5. No  Data segment (cont’d)Invokes tcp_event_data_rcv() to carry out various management tasks If the segment contains an ack, then invoke tcp_ack() to process the ack and tcp_data_snd_check() to initiate transmission of waiting


View Full Document

U of I CS 498 - LECTURE

Documents in this Course
Lecture 5

Lecture 5

13 pages

Assurance

Assurance

44 pages

LECTURE

LECTURE

36 pages

Pthreads

Pthreads

29 pages

Load more
Download LECTURE
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view LECTURE and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view LECTURE 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?