output.c (9b8321531a90c400e9c561d903926eee79639dcf) | output.c (871a2c16c21b988688b4ab1a78eadd969765c0a3) |
---|---|
1/* 2 * net/dccp/output.c 3 * 4 * An implementation of the DCCP protocol 5 * Arnaldo Carvalho de Melo <acme@conectiva.com.br> 6 * 7 * This program is free software; you can redistribute it and/or 8 * modify it under the terms of the GNU General Public License --- 228 unchanged lines hidden (view full) --- 237/** 238 * dccp_xmit_packet - Send data packet under control of CCID 239 * Transmits next-queued payload and informs CCID to account for the packet. 240 */ 241static void dccp_xmit_packet(struct sock *sk) 242{ 243 int err, len; 244 struct dccp_sock *dp = dccp_sk(sk); | 1/* 2 * net/dccp/output.c 3 * 4 * An implementation of the DCCP protocol 5 * Arnaldo Carvalho de Melo <acme@conectiva.com.br> 6 * 7 * This program is free software; you can redistribute it and/or 8 * modify it under the terms of the GNU General Public License --- 228 unchanged lines hidden (view full) --- 237/** 238 * dccp_xmit_packet - Send data packet under control of CCID 239 * Transmits next-queued payload and informs CCID to account for the packet. 240 */ 241static void dccp_xmit_packet(struct sock *sk) 242{ 243 int err, len; 244 struct dccp_sock *dp = dccp_sk(sk); |
245 struct sk_buff *skb = skb_dequeue(&sk->sk_write_queue); | 245 struct sk_buff *skb = dccp_qpolicy_pop(sk); |
246 247 if (unlikely(skb == NULL)) 248 return; 249 len = skb->len; 250 251 if (sk->sk_state == DCCP_PARTOPEN) { 252 const u32 cur_mps = dp->dccps_mss_cache - DCCP_FEATNEG_OVERHEAD; 253 /* --- 24 unchanged lines hidden (view full) --- 278 if (err) 279 dccp_pr_debug("transmit_skb() returned err=%d\n", err); 280 /* 281 * Register this one as sent even if an error occurred. To the remote 282 * end a local packet drop is indistinguishable from network loss, i.e. 283 * any local drop will eventually be reported via receiver feedback. 284 */ 285 ccid_hc_tx_packet_sent(dp->dccps_hc_tx_ccid, sk, len); | 246 247 if (unlikely(skb == NULL)) 248 return; 249 len = skb->len; 250 251 if (sk->sk_state == DCCP_PARTOPEN) { 252 const u32 cur_mps = dp->dccps_mss_cache - DCCP_FEATNEG_OVERHEAD; 253 /* --- 24 unchanged lines hidden (view full) --- 278 if (err) 279 dccp_pr_debug("transmit_skb() returned err=%d\n", err); 280 /* 281 * Register this one as sent even if an error occurred. To the remote 282 * end a local packet drop is indistinguishable from network loss, i.e. 283 * any local drop will eventually be reported via receiver feedback. 284 */ 285 ccid_hc_tx_packet_sent(dp->dccps_hc_tx_ccid, sk, len); |
286 287 /* 288 * If the CCID needs to transfer additional header options out-of-band 289 * (e.g. Ack Vectors or feature-negotiation options), it activates this 290 * flag to schedule a Sync. The Sync will automatically incorporate all 291 * currently pending header options, thus clearing the backlog. 292 */ 293 if (dp->dccps_sync_scheduled) 294 dccp_send_sync(sk, dp->dccps_gsr, DCCP_PKT_SYNC); |
|
286} 287 288/** 289 * dccp_flush_write_queue - Drain queue at end of connection 290 * Since dccp_sendmsg queues packets without waiting for them to be sent, it may 291 * happen that the TX queue is not empty at the end of a connection. We give the 292 * HC-sender CCID a grace period of up to @time_budget jiffies. If this function 293 * returns with a non-empty write queue, it will be purged later. --- 37 unchanged lines hidden (view full) --- 331 } 332} 333 334void dccp_write_xmit(struct sock *sk) 335{ 336 struct dccp_sock *dp = dccp_sk(sk); 337 struct sk_buff *skb; 338 | 295} 296 297/** 298 * dccp_flush_write_queue - Drain queue at end of connection 299 * Since dccp_sendmsg queues packets without waiting for them to be sent, it may 300 * happen that the TX queue is not empty at the end of a connection. We give the 301 * HC-sender CCID a grace period of up to @time_budget jiffies. If this function 302 * returns with a non-empty write queue, it will be purged later. --- 37 unchanged lines hidden (view full) --- 340 } 341} 342 343void dccp_write_xmit(struct sock *sk) 344{ 345 struct dccp_sock *dp = dccp_sk(sk); 346 struct sk_buff *skb; 347 |
339 while ((skb = skb_peek(&sk->sk_write_queue))) { | 348 while ((skb = dccp_qpolicy_top(sk))) { |
340 int rc = ccid_hc_tx_send_packet(dp->dccps_hc_tx_ccid, sk, skb); 341 342 switch (ccid_packet_dequeue_eval(rc)) { 343 case CCID_PACKET_WILL_DEQUEUE_LATER: 344 return; 345 case CCID_PACKET_DELAY: 346 sk_reset_timer(sk, &dp->dccps_xmit_timer, 347 jiffies + msecs_to_jiffies(rc)); 348 return; 349 case CCID_PACKET_SEND_AT_ONCE: 350 dccp_xmit_packet(sk); 351 break; 352 case CCID_PACKET_ERR: | 349 int rc = ccid_hc_tx_send_packet(dp->dccps_hc_tx_ccid, sk, skb); 350 351 switch (ccid_packet_dequeue_eval(rc)) { 352 case CCID_PACKET_WILL_DEQUEUE_LATER: 353 return; 354 case CCID_PACKET_DELAY: 355 sk_reset_timer(sk, &dp->dccps_xmit_timer, 356 jiffies + msecs_to_jiffies(rc)); 357 return; 358 case CCID_PACKET_SEND_AT_ONCE: 359 dccp_xmit_packet(sk); 360 break; 361 case CCID_PACKET_ERR: |
353 skb_dequeue(&sk->sk_write_queue); 354 kfree_skb(skb); | 362 dccp_qpolicy_drop(sk, skb); |
355 dccp_pr_debug("packet discarded due to err=%d\n", rc); 356 } 357 } 358} 359 360/** 361 * dccp_retransmit_skb - Retransmit Request, Close, or CloseReq packets 362 * There are only four retransmittable packet types in DCCP: --- 268 unchanged lines hidden (view full) --- 631 return; 632 } 633 634 /* Reserve space for headers and prepare control bits. */ 635 skb_reserve(skb, sk->sk_prot->max_header); 636 DCCP_SKB_CB(skb)->dccpd_type = pkt_type; 637 DCCP_SKB_CB(skb)->dccpd_ack_seq = ackno; 638 | 363 dccp_pr_debug("packet discarded due to err=%d\n", rc); 364 } 365 } 366} 367 368/** 369 * dccp_retransmit_skb - Retransmit Request, Close, or CloseReq packets 370 * There are only four retransmittable packet types in DCCP: --- 268 unchanged lines hidden (view full) --- 639 return; 640 } 641 642 /* Reserve space for headers and prepare control bits. */ 643 skb_reserve(skb, sk->sk_prot->max_header); 644 DCCP_SKB_CB(skb)->dccpd_type = pkt_type; 645 DCCP_SKB_CB(skb)->dccpd_ack_seq = ackno; 646 |
647 /* 648 * Clear the flag in case the Sync was scheduled for out-of-band data, 649 * such as carrying a long Ack Vector. 650 */ 651 dccp_sk(sk)->dccps_sync_scheduled = 0; 652 |
|
639 dccp_transmit_skb(sk, skb); 640} 641 642EXPORT_SYMBOL_GPL(dccp_send_sync); 643 644/* 645 * Send a DCCP_PKT_CLOSE/CLOSEREQ. The caller locks the socket for us. This 646 * cannot be allowed to fail queueing a DCCP_PKT_CLOSE/CLOSEREQ frame under --- 37 unchanged lines hidden --- | 653 dccp_transmit_skb(sk, skb); 654} 655 656EXPORT_SYMBOL_GPL(dccp_send_sync); 657 658/* 659 * Send a DCCP_PKT_CLOSE/CLOSEREQ. The caller locks the socket for us. This 660 * cannot be allowed to fail queueing a DCCP_PKT_CLOSE/CLOSEREQ frame under --- 37 unchanged lines hidden --- |