Lines Matching +full:always +full:- +full:wait +full:- +full:for +full:- +full:ack

1 /* SPDX-License-Identifier: GPL-2.0-only */
9 * Copyright (c) 2005-6 Ian McDonald <ian.mcdonald@jandi.co.nz>
20 * DCCP - specific warning and debugging macros.
56 * Set safe upper bounds for header and option length. Since Data Offset is 8
59 * - DCCP-Response with ACK Subheader and 4 bytes of Service code OR
60 * - DCCP-Reset with ACK Subheader and 4 bytes of Reset Code fields
61 * Hence a safe upper bound for the maximum option length is 1020-28 = 992
65 #define DCCP_MAX_OPT_LEN (MAX_DCCP_SPECIFIC_HEADER - DCCP_MAX_PACKET_HDR)
68 /* Upper bound for initial feature-negotiation overhead (padded to 32 bits) */
71 #define DCCP_TIMEWAIT_LEN (60 * HZ) /* how long to wait to destroy TIME-WAIT
78 * The maximum back-off value for retransmissions. This is needed for
79 * - retransmitting client-Requests (sec. 8.1.1),
80 * - retransmitting Close/CloseReq when closing (sec. 8.3),
81 * - feature-negotiation retransmission (sec. 6.6.3),
82 * - Acks in client-PARTOPEN state (sec. 8.1.5).
93 /* sysctl variables for DCCP */
101 * 48-bit sequence number arithmetic (signed and unsigned)
104 #define UINT48_MAX 0xFFFFFFFFFFFFLL /* 2^48 - 1 */
105 #define COMPLEMENT48(x) (0x1000000000000LL - (x)) /* 2^48 - x */
106 #define TO_SIGNED48(x) (((x) < INT48_MIN)? (x) : -COMPLEMENT48( (x)))
107 #define TO_UNSIGNED48(x) (((x) >= 0)? (x) : COMPLEMENT48(-(x)))
116 /* signed mod-2^48 distance: pos. if seqno1 < seqno2, neg. if seqno1 > seqno2 */
127 return (s64)((seq2 << 16) - (seq1 << 16)) > 0; in before48()
136 return (seq3 << 16) - (seq2 << 16) >= (seq1 << 16) - (seq2 << 16); in between48()
145 * dccp_loss_count - Approximate the number of lost data packets in a burst loss
155 delta -= ndp + 1; in dccp_loss_count()
161 * dccp_loss_free - Evaluate condition for data loss from RFC 4340, 7.7.1
204 if (dh->dccph_cscov == 0) in dccp_csum_coverage()
205 return skb->len; in dccp_csum_coverage()
206 return (dh->dccph_doff + dh->dccph_cscov - 1) * sizeof(u32); in dccp_csum_coverage()
213 if (cov >= skb->len) in dccp_csum_outgoing()
214 dccp_hdr(skb)->dccph_cscov = 0; in dccp_csum_outgoing()
216 skb->csum = skb_checksum(skb, 0, (cov > skb->len)? skb->len : cov, 0); in dccp_csum_outgoing()
306 poll_table *wait);
321 if (dp->dccps_service == service) in dccp_bad_service_code()
323 return !dccp_list_has_service(dp->dccps_service_list, service); in dccp_bad_service_code()
327 * dccp_skb_cb - DCCP per-packet control information
336 * This is used for transmission as well as for reception.
354 #define DCCP_SKB_CB(__skb) ((struct dccp_skb_cb *)&((__skb)->cb[0]))
359 const __u8 type = DCCP_SKB_CB(skb)->dccpd_type; in dccp_non_data_packet()
372 const __u8 type = DCCP_SKB_CB(skb)->dccpd_type; in dccp_data_packet()
382 const __u8 type = DCCP_SKB_CB(skb)->dccpd_type; in dccp_packet_without_ack()
393 dh->dccph_seq2 = 0; in dccp_hdr_set_seq()
394 dh->dccph_seq = htons((gss >> 32) & 0xfffff); in dccp_hdr_set_seq()
395 dhx->dccph_seq_low = htonl(gss & 0xffffffff); in dccp_hdr_set_seq()
401 dhack->dccph_reserved1 = 0; in dccp_hdr_set_ack()
402 dhack->dccph_ack_nr_high = htons(gsr >> 32); in dccp_hdr_set_ack()
403 dhack->dccph_ack_nr_low = htonl(gsr & 0xffffffff); in dccp_hdr_set_ack()
410 if (after48(seq, dp->dccps_gsr)) in dccp_update_gsr()
411 dp->dccps_gsr = seq; in dccp_update_gsr()
413 dp->dccps_swl = SUB48(ADD48(dp->dccps_gsr, 1), dp->dccps_r_seq_win / 4); in dccp_update_gsr()
417 * always > 32, so for the first W/W' packets in the lifetime of a in dccp_update_gsr()
418 * connection we always have to adjust SWL. in dccp_update_gsr()
420 * the feature-remote value of Sequence Window: nothing stops the peer in dccp_update_gsr()
421 * from updating this value while we are busy adjusting SWL for the in dccp_update_gsr()
423 * Therefore it is safer to always make sure that the Sequence Window in dccp_update_gsr()
425 * continually updating the feature-remote Sequence-Window. in dccp_update_gsr()
427 * (48 bit), and this measure prevents Sequence-number attacks. in dccp_update_gsr()
429 if (before48(dp->dccps_swl, dp->dccps_isr)) in dccp_update_gsr()
430 dp->dccps_swl = dp->dccps_isr; in dccp_update_gsr()
431 dp->dccps_swh = ADD48(dp->dccps_gsr, (3 * dp->dccps_r_seq_win) / 4); in dccp_update_gsr()
438 dp->dccps_gss = seq; in dccp_update_gss()
439 /* Ack validity window depends on local Sequence Window value (7.5.1) */ in dccp_update_gss()
440 dp->dccps_awl = SUB48(ADD48(dp->dccps_gss, 1), dp->dccps_l_seq_win); in dccp_update_gss()
441 /* Adjust AWL so that it is not below ISS - see comment above for SWL */ in dccp_update_gss()
442 if (before48(dp->dccps_awl, dp->dccps_iss)) in dccp_update_gss()
443 dp->dccps_awl = dp->dccps_iss; in dccp_update_gss()
444 dp->dccps_awh = dp->dccps_gss; in dccp_update_gss()
449 return dccp_sk(sk)->dccps_hc_rx_ackvec != NULL && in dccp_ackvec_pending()
450 !dccp_ackvec_is_empty(dccp_sk(sk)->dccps_hc_rx_ackvec); in dccp_ackvec_pending()