Author: rrs
Date: Thu Oct 24 05:54:30 2019
New Revision: 354013
URL: https://svnweb.freebsd.org/changeset/base/354013

Log:
  Fix a small bug in bbr when running under a VM. Basically what
  happens is we are more delayed in the pacer calling in so
  we remove the stack from the pacer and recalculate how
  much time is left after all data has been acknowledged. However
  the comparision was backwards so we end up with a negative
  value in the last_pacing_delay time which causes us to
  add in a huge value to the next pacing time thus stalling
  the connection.
  
  Reported by:  vm2.fina...@gmail.com

Modified:
  head/sys/netinet/tcp_stacks/bbr.c

Modified: head/sys/netinet/tcp_stacks/bbr.c
==============================================================================
--- head/sys/netinet/tcp_stacks/bbr.c   Thu Oct 24 04:12:38 2019        
(r354012)
+++ head/sys/netinet/tcp_stacks/bbr.c   Thu Oct 24 05:54:30 2019        
(r354013)
@@ -11814,12 +11814,13 @@ bbr_do_segment_nounlock(struct mbuf *m, struct tcphdr 
                                                uint32_t del;
 
                                                del = lcts - 
bbr->rc_pacer_started;
-                                               if (del > 
bbr->r_ctl.rc_last_delay_val) {
+                                               if 
(bbr->r_ctl.rc_last_delay_val > del) {
                                                        
BBR_STAT_INC(bbr_force_timer_start);
                                                        
bbr->r_ctl.rc_last_delay_val -= del;
                                                        bbr->rc_pacer_started = 
lcts;
                                                } else {
                                                        /* We are late */
+                                                       
bbr->r_ctl.rc_last_delay_val = 0;
                                                        
BBR_STAT_INC(bbr_force_output);
                                                        
(void)tp->t_fb->tfb_tcp_output(tp);
                                                }
@@ -12278,8 +12279,9 @@ bbr_output_wtime(struct tcpcb *tp, const struct timeva
                         * We are early setup to adjust 
                         * our slot time.
                         */
+                       uint64_t merged_val;
+                       
                        bbr->r_ctl.rc_agg_early += 
(bbr->r_ctl.rc_last_delay_val - delay_calc);
-                       bbr->r_ctl.rc_last_delay_val = 0;
                        bbr->r_agg_early_set = 1;
                        if (bbr->r_ctl.rc_hptsi_agg_delay) {
                                if (bbr->r_ctl.rc_hptsi_agg_delay >= 
bbr->r_ctl.rc_agg_early) {
@@ -12292,9 +12294,13 @@ bbr_output_wtime(struct tcpcb *tp, const struct timeva
                                        bbr->r_ctl.rc_hptsi_agg_delay = 0;
                                }
                        }
+                       merged_val = bbr->rc_pacer_started;
+                       merged_val <<= 32;
+                       merged_val |= bbr->r_ctl.rc_last_delay_val;
                        bbr_log_pacing_delay_calc(bbr, inp->inp_hpts_calls,
-                                                bbr->r_ctl.rc_agg_early, cts, 
3, 0,
+                                                bbr->r_ctl.rc_agg_early, cts, 
delay_calc, merged_val,
                                                 bbr->r_agg_early_set, 3);
+                       bbr->r_ctl.rc_last_delay_val = 0;
                        BBR_STAT_INC(bbr_early);
                        delay_calc = 0;
                }
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to