Lines Matching +full:de +full:- +full:skew

1 // SPDX-License-Identifier: GPL-2.0-or-later
6 * Arnaldo Carvalho de Melo <acme@conectiva.com.br>
31 WARN_ON(sk->sk_send_head); in dccp_skb_entail()
32 sk->sk_send_head = skb; in dccp_skb_entail()
33 return skb_clone(sk->sk_send_head, gfp_any()); in dccp_skb_entail()
53 dccp_packet_hdr_len(dcb->dccpd_type); in dccp_transmit_skb()
55 u64 ackno = dp->dccps_gsr; in dccp_transmit_skb()
60 dcb->dccpd_seq = ADD48(dp->dccps_gss, 1); in dccp_transmit_skb()
62 switch (dcb->dccpd_type) { in dccp_transmit_skb()
72 /* Use ISS on the first (non-retransmitted) Request. */ in dccp_transmit_skb()
73 if (icsk->icsk_retransmits == 0) in dccp_transmit_skb()
74 dcb->dccpd_seq = dp->dccps_iss; in dccp_transmit_skb()
79 ackno = dcb->dccpd_ack_seq; in dccp_transmit_skb()
86 * through here with skb->sk set. in dccp_transmit_skb()
88 WARN_ON(skb->sk); in dccp_transmit_skb()
95 return -EPROTO; in dccp_transmit_skb()
101 dh->dccph_type = dcb->dccpd_type; in dccp_transmit_skb()
102 dh->dccph_sport = inet->inet_sport; in dccp_transmit_skb()
103 dh->dccph_dport = inet->inet_dport; in dccp_transmit_skb()
104 dh->dccph_doff = (dccp_header_size + dcb->dccpd_opt_len) / 4; in dccp_transmit_skb()
105 dh->dccph_ccval = dcb->dccpd_ccval; in dccp_transmit_skb()
106 dh->dccph_cscov = dp->dccps_pcslen; in dccp_transmit_skb()
108 dh->dccph_x = 1; in dccp_transmit_skb()
110 dccp_update_gss(sk, dcb->dccpd_seq); in dccp_transmit_skb()
111 dccp_hdr_set_seq(dh, dp->dccps_gss); in dccp_transmit_skb()
115 switch (dcb->dccpd_type) { in dccp_transmit_skb()
117 dccp_hdr_request(skb)->dccph_req_service = in dccp_transmit_skb()
118 dp->dccps_service; in dccp_transmit_skb()
123 dp->dccps_awl = dp->dccps_iss; in dccp_transmit_skb()
126 dccp_hdr_reset(skb)->dccph_reset_code = in dccp_transmit_skb()
127 dcb->dccpd_reset_code; in dccp_transmit_skb()
131 icsk->icsk_af_ops->send_check(sk, skb); in dccp_transmit_skb()
138 err = icsk->icsk_af_ops->queue_xmit(sk, skb, &inet->cork.fl); in dccp_transmit_skb()
141 return -ENOBUFS; in dccp_transmit_skb()
145 * dccp_determine_ccmps - Find out about CCID-specific packet-size limits
148 * We only consider the HC-sender CCID for setting the CCMPS (RFC 4340, 14.),
154 const struct ccid *tx_ccid = dp->dccps_hc_tx_ccid; in dccp_determine_ccmps()
156 if (tx_ccid == NULL || tx_ccid->ccid_ops == NULL) in dccp_determine_ccmps()
158 return tx_ccid->ccid_ops->ccid_ccmps; in dccp_determine_ccmps()
169 cur_mps -= (icsk->icsk_af_ops->net_header_len + icsk->icsk_ext_hdr_len + in dccp_sync_mss()
174 * This only considers options which may appear on DCCP-Data packets, as in dccp_sync_mss()
178 * - 1 byte for Slow Receiver (11.6) in dccp_sync_mss()
179 * - 6 bytes for Timestamp (13.1) in dccp_sync_mss()
180 * - 10 bytes for Timestamp Echo (13.3) in dccp_sync_mss()
181 * - 8 bytes for NDP count (7.7, when activated) in dccp_sync_mss()
182 * - 6 bytes for Data Checksum (9.3) in dccp_sync_mss()
183 * - %DCCPAV_MIN_OPTLEN bytes for Ack Vector size (11.4, when enabled) in dccp_sync_mss()
185 cur_mps -= roundup(1 + 6 + 10 + dp->dccps_send_ndp_count * 8 + 6 + in dccp_sync_mss()
186 (dp->dccps_hc_rx_ackvec ? DCCPAV_MIN_OPTLEN : 0), 4); in dccp_sync_mss()
189 icsk->icsk_pmtu_cookie = pmtu; in dccp_sync_mss()
190 dp->dccps_mss_cache = cur_mps; in dccp_sync_mss()
202 wq = rcu_dereference(sk->sk_wq); in dccp_write_space()
204 wake_up_interruptible(&wq->wait); in dccp_write_space()
213 * dccp_wait_for_ccid - Await CCID send permission
225 sk->sk_write_pending++; in dccp_wait_for_ccid()
231 sk->sk_write_pending--; in dccp_wait_for_ccid()
234 if (signal_pending(current) || sk->sk_err) in dccp_wait_for_ccid()
235 return -1; in dccp_wait_for_ccid()
240 * dccp_xmit_packet - Send data packet under control of CCID
243 * Transmits next-queued payload and informs CCID to account for the packet.
253 len = skb->len; in dccp_xmit_packet()
255 if (sk->sk_state == DCCP_PARTOPEN) { in dccp_xmit_packet()
256 const u32 cur_mps = dp->dccps_mss_cache - DCCP_FEATNEG_OVERHEAD; in dccp_xmit_packet()
258 * See 8.1.5 - Handshake Completion. in dccp_xmit_packet()
264 if (!list_empty(&dp->dccps_featneg) && len > cur_mps) { in dccp_xmit_packet()
267 dccp_feat_list_purge(&dp->dccps_featneg); in dccp_xmit_packet()
272 inet_csk(sk)->icsk_rto, in dccp_xmit_packet()
274 DCCP_SKB_CB(skb)->dccpd_type = DCCP_PKT_DATAACK; in dccp_xmit_packet()
276 DCCP_SKB_CB(skb)->dccpd_type = DCCP_PKT_DATAACK; in dccp_xmit_packet()
278 DCCP_SKB_CB(skb)->dccpd_type = DCCP_PKT_DATA; in dccp_xmit_packet()
289 ccid_hc_tx_packet_sent(dp->dccps_hc_tx_ccid, sk, len); in dccp_xmit_packet()
292 * If the CCID needs to transfer additional header options out-of-band in dccp_xmit_packet()
293 * (e.g. Ack Vectors or feature-negotiation options), it activates this in dccp_xmit_packet()
297 if (dp->dccps_sync_scheduled) in dccp_xmit_packet()
298 dccp_send_sync(sk, dp->dccps_gsr, DCCP_PKT_SYNC); in dccp_xmit_packet()
302 * dccp_flush_write_queue - Drain queue at end of connection
308 * HC-sender CCID a grace period of up to @time_budget jiffies. If this function
309 * returns with a non-empty write queue, it will be purged later.
317 while (*time_budget > 0 && (skb = skb_peek(&sk->sk_write_queue))) { in dccp_flush_write_queue()
318 rc = ccid_hc_tx_send_packet(dp->dccps_hc_tx_ccid, sk, skb); in dccp_flush_write_queue()
336 *time_budget -= (delay - rc); in dccp_flush_write_queue()
343 skb_dequeue(&sk->sk_write_queue); in dccp_flush_write_queue()
356 int rc = ccid_hc_tx_send_packet(dp->dccps_hc_tx_ccid, sk, skb); in dccp_write_xmit()
362 sk_reset_timer(sk, &dp->dccps_xmit_timer, in dccp_write_xmit()
376 * dccp_retransmit_skb - Retransmit Request, Close, or CloseReq packets
380 * - Request in client-REQUEST state (sec. 8.1.1),
381 * - CloseReq in server-CLOSEREQ state (sec. 8.3),
382 * - Close in node-CLOSING state (sec. 8.3),
383 * - Acks in client-PARTOPEN state (sec. 8.1.5, handled by dccp_delack_timer()).
384 * This function expects sk->sk_send_head to contain the original skb.
388 WARN_ON(sk->sk_send_head == NULL); in dccp_retransmit_skb()
390 if (inet_csk(sk)->icsk_af_ops->rebuild_header(sk) != 0) in dccp_retransmit_skb()
391 return -EHOSTUNREACH; /* Routing failure or similar. */ in dccp_retransmit_skb()
394 inet_csk(sk)->icsk_retransmits++; in dccp_retransmit_skb()
396 return dccp_transmit_skb(sk, skb_clone(sk->sk_send_head, GFP_ATOMIC)); in dccp_retransmit_skb()
410 * sock_wmalloc() will atomically change sk->sk_wmem_alloc, in dccp_make_response()
423 if (inet_rsk(req)->acked) /* increase GSS upon retransmission */ in dccp_make_response()
424 dccp_inc_seqno(&dreq->dreq_gss); in dccp_make_response()
425 DCCP_SKB_CB(skb)->dccpd_type = DCCP_PKT_RESPONSE; in dccp_make_response()
426 DCCP_SKB_CB(skb)->dccpd_seq = dreq->dreq_gss; in dccp_make_response()
438 dh->dccph_sport = htons(inet_rsk(req)->ir_num); in dccp_make_response()
439 dh->dccph_dport = inet_rsk(req)->ir_rmt_port; in dccp_make_response()
440 dh->dccph_doff = (dccp_header_size + in dccp_make_response()
441 DCCP_SKB_CB(skb)->dccpd_opt_len) / 4; in dccp_make_response()
442 dh->dccph_type = DCCP_PKT_RESPONSE; in dccp_make_response()
443 dh->dccph_x = 1; in dccp_make_response()
444 dccp_hdr_set_seq(dh, dreq->dreq_gss); in dccp_make_response()
445 dccp_hdr_set_ack(dccp_hdr_ack_bits(skb), dreq->dreq_gsr); in dccp_make_response()
446 dccp_hdr_response(skb)->dccph_resp_service = dreq->dreq_service; in dccp_make_response()
451 inet_rsk(req)->acked = 1; in dccp_make_response()
472 skb = alloc_skb(sk->sk_prot->max_header, GFP_ATOMIC); in dccp_ctl_make_reset()
476 skb_reserve(skb, sk->sk_prot->max_header); in dccp_ctl_make_reset()
480 dh->dccph_type = DCCP_PKT_RESET; in dccp_ctl_make_reset()
481 dh->dccph_sport = rxdh->dccph_dport; in dccp_ctl_make_reset()
482 dh->dccph_dport = rxdh->dccph_sport; in dccp_ctl_make_reset()
483 dh->dccph_doff = dccp_hdr_reset_len / 4; in dccp_ctl_make_reset()
484 dh->dccph_x = 1; in dccp_ctl_make_reset()
487 dhr->dccph_reset_code = dcb->dccpd_reset_code; in dccp_ctl_make_reset()
489 switch (dcb->dccpd_reset_code) { in dccp_ctl_make_reset()
491 dhr->dccph_reset_data[0] = rxdh->dccph_type; in dccp_ctl_make_reset()
495 memcpy(dhr->dccph_reset_data, dcb->dccpd_reset_data, 3); in dccp_ctl_make_reset()
503 if (dcb->dccpd_ack_seq != DCCP_PKT_WITHOUT_ACK_SEQ) in dccp_ctl_make_reset()
504 dccp_hdr_set_seq(dh, ADD48(dcb->dccpd_ack_seq, 1)); in dccp_ctl_make_reset()
505 dccp_hdr_set_ack(dccp_hdr_ack_bits(skb), dcb->dccpd_seq); in dccp_ctl_make_reset()
521 int err = inet_csk(sk)->icsk_af_ops->rebuild_header(sk); in dccp_send_reset()
526 skb = sock_wmalloc(sk, sk->sk_prot->max_header, 1, GFP_ATOMIC); in dccp_send_reset()
528 return -ENOBUFS; in dccp_send_reset()
531 skb_reserve(skb, sk->sk_prot->max_header); in dccp_send_reset()
532 DCCP_SKB_CB(skb)->dccpd_type = DCCP_PKT_RESET; in dccp_send_reset()
533 DCCP_SKB_CB(skb)->dccpd_reset_code = code; in dccp_send_reset()
548 sk->sk_err = 0; in dccp_connect()
555 return -EPROTO; in dccp_connect()
558 dp->dccps_gar = dp->dccps_iss; in dccp_connect()
560 skb = alloc_skb(sk->sk_prot->max_header, sk->sk_allocation); in dccp_connect()
562 return -ENOBUFS; in dccp_connect()
565 skb_reserve(skb, sk->sk_prot->max_header); in dccp_connect()
567 DCCP_SKB_CB(skb)->dccpd_type = DCCP_PKT_REQUEST; in dccp_connect()
573 icsk->icsk_retransmits = 0; in dccp_connect()
575 icsk->icsk_rto, DCCP_RTO_MAX); in dccp_connect()
584 if (sk->sk_state != DCCP_CLOSED) { in dccp_send_ack()
585 struct sk_buff *skb = alloc_skb(sk->sk_prot->max_header, in dccp_send_ack()
590 inet_csk(sk)->icsk_ack.ato = TCP_ATO_MIN; in dccp_send_ack()
598 skb_reserve(skb, sk->sk_prot->max_header); in dccp_send_ack()
599 DCCP_SKB_CB(skb)->dccpd_type = DCCP_PKT_ACK; in dccp_send_ack()
607 /* FIXME: Is this still necessary (11.3) - currently nowhere used by DCCP. */
612 * FIXME: tune this timer. elapsed time fixes the skew, so no problem
619 if (icsk->icsk_ack.pending & ICSK_ACK_TIMER) {
625 if (icsk->icsk_ack.blocked) {
630 if (!time_before(timeout, icsk->icsk_ack.timeout))
631 timeout = icsk->icsk_ack.timeout;
633 icsk->icsk_ack.pending |= ICSK_ACK_SCHED | ICSK_ACK_TIMER;
634 icsk->icsk_ack.timeout = timeout;
635 sk_reset_timer(sk, &icsk->icsk_delack_timer, timeout);
647 struct sk_buff *skb = alloc_skb(sk->sk_prot->max_header, GFP_ATOMIC); in dccp_send_sync()
656 skb_reserve(skb, sk->sk_prot->max_header); in dccp_send_sync()
657 DCCP_SKB_CB(skb)->dccpd_type = pkt_type; in dccp_send_sync()
658 DCCP_SKB_CB(skb)->dccpd_ack_seq = ackno; in dccp_send_sync()
661 * Clear the flag in case the Sync was scheduled for out-of-band data, in dccp_send_sync()
664 dccp_sk(sk)->dccps_sync_scheduled = 0; in dccp_send_sync()
682 skb = alloc_skb(sk->sk_prot->max_header, prio); in dccp_send_close()
687 skb_reserve(skb, sk->sk_prot->max_header); in dccp_send_close()
688 if (dp->dccps_role == DCCP_ROLE_SERVER && !dp->dccps_server_timewait) in dccp_send_close()
689 DCCP_SKB_CB(skb)->dccpd_type = DCCP_PKT_CLOSEREQ; in dccp_send_close()
691 DCCP_SKB_CB(skb)->dccpd_type = DCCP_PKT_CLOSE; in dccp_send_close()
696 * Retransmission timer for active-close: RFC 4340, 8.3 requires in dccp_send_close()