Loading net/dccp/ackvec.c +2 −27 Original line number Diff line number Diff line Loading @@ -290,12 +290,12 @@ int dccp_ackvec_add(struct dccp_ackvec *av, const struct sock *sk, while (1) { const u8 len = dccp_ackvec_len(av, index); const u8 state = dccp_ackvec_state(av, index); const u8 av_state = dccp_ackvec_state(av, index); /* * valid packets not yet in av_buf have a reserved * entry, with a len equal to 0. */ if (state == DCCP_ACKVEC_STATE_NOT_RECEIVED && if (av_state == DCCP_ACKVEC_STATE_NOT_RECEIVED && len == 0 && delta == 0) { /* Found our reserved seat! */ dccp_pr_debug("Found %llu reserved seat!\n", Loading Loading @@ -325,31 +325,6 @@ int dccp_ackvec_add(struct dccp_ackvec *av, const struct sock *sk, return -EILSEQ; } #ifdef CONFIG_IP_DCCP_DEBUG void dccp_ackvector_print(const u64 ackno, const unsigned char *vector, int len) { dccp_pr_debug_cat("ACK vector len=%d, ackno=%llu |", len, (unsigned long long)ackno); while (len--) { const u8 state = (*vector & DCCP_ACKVEC_STATE_MASK) >> 6; const u8 rl = *vector & DCCP_ACKVEC_LEN_MASK; dccp_pr_debug_cat("%d,%d|", state, rl); ++vector; } dccp_pr_debug_cat("\n"); } void dccp_ackvec_print(const struct dccp_ackvec *av) { dccp_ackvector_print(av->av_buf_ackno, av->av_buf + av->av_buf_head, av->av_vec_len); } #endif static void dccp_ackvec_throw_record(struct dccp_ackvec *av, struct dccp_ackvec_record *avr) { Loading net/dccp/ccids/ccid3.c +10 −4 Original line number Diff line number Diff line Loading @@ -159,8 +159,8 @@ static void ccid3_hc_tx_update_x(struct sock *sk, ktime_t *stamp) } else if (ktime_us_delta(now, hctx->ccid3hctx_t_ld) - (s64)hctx->ccid3hctx_rtt >= 0) { hctx->ccid3hctx_x = max(min(2 * hctx->ccid3hctx_x, min_rate), hctx->ccid3hctx_x = min(2 * hctx->ccid3hctx_x, min_rate); hctx->ccid3hctx_x = max(hctx->ccid3hctx_x, scaled_div(((__u64)hctx->ccid3hctx_s) << 6, hctx->ccid3hctx_rtt)); hctx->ccid3hctx_t_ld = now; Loading Loading @@ -329,7 +329,13 @@ static int ccid3_hc_tx_send_packet(struct sock *sk, struct sk_buff *skb) hctx->ccid3hctx_x = rfc3390_initial_rate(sk); hctx->ccid3hctx_t_ld = now; } else { /* Sender does not have RTT sample: X_pps = 1 pkt/sec */ /* * Sender does not have RTT sample: * - set fallback RTT (RFC 4340, 3.4) since a RTT value * is needed in several parts (e.g. window counter); * - set sending rate X_pps = 1pps as per RFC 3448, 4.2. */ hctx->ccid3hctx_rtt = DCCP_FALLBACK_RTT; hctx->ccid3hctx_x = hctx->ccid3hctx_s; hctx->ccid3hctx_x <<= 6; } Loading net/dccp/ccids/lib/tfrc.c +0 −8 Original line number Diff line number Diff line Loading @@ -14,14 +14,6 @@ module_param(tfrc_debug, bool, 0444); MODULE_PARM_DESC(tfrc_debug, "Enable debug messages"); #endif extern int tfrc_tx_packet_history_init(void); extern void tfrc_tx_packet_history_exit(void); extern int tfrc_rx_packet_history_init(void); extern void tfrc_rx_packet_history_exit(void); extern int tfrc_li_init(void); extern void tfrc_li_exit(void); static int __init tfrc_module_init(void) { int rc = tfrc_li_init(); Loading net/dccp/ccids/lib/tfrc.h +15 −10 Original line number Diff line number Diff line Loading @@ -15,7 +15,7 @@ * (at your option) any later version. */ #include <linux/types.h> #include <asm/div64.h> #include <linux/math64.h> #include "../../dccp.h" /* internal includes that this module exports: */ #include "loss_interval.h" Loading @@ -29,21 +29,19 @@ extern int tfrc_debug; #endif /* integer-arithmetic divisions of type (a * 1000000)/b */ static inline u64 scaled_div(u64 a, u32 b) static inline u64 scaled_div(u64 a, u64 b) { BUG_ON(b==0); a *= 1000000; do_div(a, b); return a; return div64_u64(a * 1000000, b); } static inline u32 scaled_div32(u64 a, u32 b) static inline u32 scaled_div32(u64 a, u64 b) { u64 result = scaled_div(a, b); if (result > UINT_MAX) { DCCP_CRIT("Overflow: a(%llu)/b(%u) > ~0U", (unsigned long long)a, b); DCCP_CRIT("Overflow: %llu/%llu > UINT_MAX", (unsigned long long)a, (unsigned long long)b); return UINT_MAX; } return result; Loading @@ -61,4 +59,11 @@ static inline u32 tfrc_ewma(const u32 avg, const u32 newval, const u8 weight) extern u32 tfrc_calc_x(u16 s, u32 R, u32 p); extern u32 tfrc_calc_x_reverse_lookup(u32 fvalue); extern int tfrc_tx_packet_history_init(void); extern void tfrc_tx_packet_history_exit(void); extern int tfrc_rx_packet_history_init(void); extern void tfrc_rx_packet_history_exit(void); extern int tfrc_li_init(void); extern void tfrc_li_exit(void); #endif /* _TFRC_H_ */ net/dccp/ccids/lib/tfrc_equation.c +4 −4 Original line number Diff line number Diff line Loading @@ -661,7 +661,7 @@ u32 tfrc_calc_x(u16 s, u32 R, u32 p) EXPORT_SYMBOL_GPL(tfrc_calc_x); /* /** * tfrc_calc_x_reverse_lookup - try to find p given f(p) * * @fvalue: function value to match, scaled by 1000000 Loading @@ -676,11 +676,11 @@ u32 tfrc_calc_x_reverse_lookup(u32 fvalue) /* Error cases. */ if (fvalue < tfrc_calc_x_lookup[0][1]) { DCCP_WARN("fvalue %d smaller than resolution\n", fvalue); return tfrc_calc_x_lookup[0][1]; DCCP_WARN("fvalue %u smaller than resolution\n", fvalue); return TFRC_SMALLEST_P; } if (fvalue > tfrc_calc_x_lookup[TFRC_CALC_X_ARRSIZE - 1][0]) { DCCP_WARN("fvalue %d exceeds bounds!\n", fvalue); DCCP_WARN("fvalue %u exceeds bounds!\n", fvalue); return 1000000; } Loading Loading
net/dccp/ackvec.c +2 −27 Original line number Diff line number Diff line Loading @@ -290,12 +290,12 @@ int dccp_ackvec_add(struct dccp_ackvec *av, const struct sock *sk, while (1) { const u8 len = dccp_ackvec_len(av, index); const u8 state = dccp_ackvec_state(av, index); const u8 av_state = dccp_ackvec_state(av, index); /* * valid packets not yet in av_buf have a reserved * entry, with a len equal to 0. */ if (state == DCCP_ACKVEC_STATE_NOT_RECEIVED && if (av_state == DCCP_ACKVEC_STATE_NOT_RECEIVED && len == 0 && delta == 0) { /* Found our reserved seat! */ dccp_pr_debug("Found %llu reserved seat!\n", Loading Loading @@ -325,31 +325,6 @@ int dccp_ackvec_add(struct dccp_ackvec *av, const struct sock *sk, return -EILSEQ; } #ifdef CONFIG_IP_DCCP_DEBUG void dccp_ackvector_print(const u64 ackno, const unsigned char *vector, int len) { dccp_pr_debug_cat("ACK vector len=%d, ackno=%llu |", len, (unsigned long long)ackno); while (len--) { const u8 state = (*vector & DCCP_ACKVEC_STATE_MASK) >> 6; const u8 rl = *vector & DCCP_ACKVEC_LEN_MASK; dccp_pr_debug_cat("%d,%d|", state, rl); ++vector; } dccp_pr_debug_cat("\n"); } void dccp_ackvec_print(const struct dccp_ackvec *av) { dccp_ackvector_print(av->av_buf_ackno, av->av_buf + av->av_buf_head, av->av_vec_len); } #endif static void dccp_ackvec_throw_record(struct dccp_ackvec *av, struct dccp_ackvec_record *avr) { Loading
net/dccp/ccids/ccid3.c +10 −4 Original line number Diff line number Diff line Loading @@ -159,8 +159,8 @@ static void ccid3_hc_tx_update_x(struct sock *sk, ktime_t *stamp) } else if (ktime_us_delta(now, hctx->ccid3hctx_t_ld) - (s64)hctx->ccid3hctx_rtt >= 0) { hctx->ccid3hctx_x = max(min(2 * hctx->ccid3hctx_x, min_rate), hctx->ccid3hctx_x = min(2 * hctx->ccid3hctx_x, min_rate); hctx->ccid3hctx_x = max(hctx->ccid3hctx_x, scaled_div(((__u64)hctx->ccid3hctx_s) << 6, hctx->ccid3hctx_rtt)); hctx->ccid3hctx_t_ld = now; Loading Loading @@ -329,7 +329,13 @@ static int ccid3_hc_tx_send_packet(struct sock *sk, struct sk_buff *skb) hctx->ccid3hctx_x = rfc3390_initial_rate(sk); hctx->ccid3hctx_t_ld = now; } else { /* Sender does not have RTT sample: X_pps = 1 pkt/sec */ /* * Sender does not have RTT sample: * - set fallback RTT (RFC 4340, 3.4) since a RTT value * is needed in several parts (e.g. window counter); * - set sending rate X_pps = 1pps as per RFC 3448, 4.2. */ hctx->ccid3hctx_rtt = DCCP_FALLBACK_RTT; hctx->ccid3hctx_x = hctx->ccid3hctx_s; hctx->ccid3hctx_x <<= 6; } Loading
net/dccp/ccids/lib/tfrc.c +0 −8 Original line number Diff line number Diff line Loading @@ -14,14 +14,6 @@ module_param(tfrc_debug, bool, 0444); MODULE_PARM_DESC(tfrc_debug, "Enable debug messages"); #endif extern int tfrc_tx_packet_history_init(void); extern void tfrc_tx_packet_history_exit(void); extern int tfrc_rx_packet_history_init(void); extern void tfrc_rx_packet_history_exit(void); extern int tfrc_li_init(void); extern void tfrc_li_exit(void); static int __init tfrc_module_init(void) { int rc = tfrc_li_init(); Loading
net/dccp/ccids/lib/tfrc.h +15 −10 Original line number Diff line number Diff line Loading @@ -15,7 +15,7 @@ * (at your option) any later version. */ #include <linux/types.h> #include <asm/div64.h> #include <linux/math64.h> #include "../../dccp.h" /* internal includes that this module exports: */ #include "loss_interval.h" Loading @@ -29,21 +29,19 @@ extern int tfrc_debug; #endif /* integer-arithmetic divisions of type (a * 1000000)/b */ static inline u64 scaled_div(u64 a, u32 b) static inline u64 scaled_div(u64 a, u64 b) { BUG_ON(b==0); a *= 1000000; do_div(a, b); return a; return div64_u64(a * 1000000, b); } static inline u32 scaled_div32(u64 a, u32 b) static inline u32 scaled_div32(u64 a, u64 b) { u64 result = scaled_div(a, b); if (result > UINT_MAX) { DCCP_CRIT("Overflow: a(%llu)/b(%u) > ~0U", (unsigned long long)a, b); DCCP_CRIT("Overflow: %llu/%llu > UINT_MAX", (unsigned long long)a, (unsigned long long)b); return UINT_MAX; } return result; Loading @@ -61,4 +59,11 @@ static inline u32 tfrc_ewma(const u32 avg, const u32 newval, const u8 weight) extern u32 tfrc_calc_x(u16 s, u32 R, u32 p); extern u32 tfrc_calc_x_reverse_lookup(u32 fvalue); extern int tfrc_tx_packet_history_init(void); extern void tfrc_tx_packet_history_exit(void); extern int tfrc_rx_packet_history_init(void); extern void tfrc_rx_packet_history_exit(void); extern int tfrc_li_init(void); extern void tfrc_li_exit(void); #endif /* _TFRC_H_ */
net/dccp/ccids/lib/tfrc_equation.c +4 −4 Original line number Diff line number Diff line Loading @@ -661,7 +661,7 @@ u32 tfrc_calc_x(u16 s, u32 R, u32 p) EXPORT_SYMBOL_GPL(tfrc_calc_x); /* /** * tfrc_calc_x_reverse_lookup - try to find p given f(p) * * @fvalue: function value to match, scaled by 1000000 Loading @@ -676,11 +676,11 @@ u32 tfrc_calc_x_reverse_lookup(u32 fvalue) /* Error cases. */ if (fvalue < tfrc_calc_x_lookup[0][1]) { DCCP_WARN("fvalue %d smaller than resolution\n", fvalue); return tfrc_calc_x_lookup[0][1]; DCCP_WARN("fvalue %u smaller than resolution\n", fvalue); return TFRC_SMALLEST_P; } if (fvalue > tfrc_calc_x_lookup[TFRC_CALC_X_ARRSIZE - 1][0]) { DCCP_WARN("fvalue %d exceeds bounds!\n", fvalue); DCCP_WARN("fvalue %u exceeds bounds!\n", fvalue); return 1000000; } Loading