/* Emulate SACKs for SACKless connection: account for a new dupack. */
 
-static void tcp_add_reno_sack(struct sock *sk, int num_dupack)
+static void tcp_add_reno_sack(struct sock *sk, int num_dupack, bool ece_ack)
 {
        if (num_dupack) {
                struct tcp_sock *tp = tcp_sk(sk);
 
 /* Account for ACK, ACKing some data in Reno Recovery phase. */
 
-static void tcp_remove_reno_sacks(struct sock *sk, int acked)
+static void tcp_remove_reno_sacks(struct sock *sk, int acked, bool ece_ack)
 {
        struct tcp_sock *tp = tcp_sk(sk);
 
                 * delivered. Lower inflight to clock out (re)tranmissions.
                 */
                if (after(tp->snd_nxt, tp->high_seq) && num_dupack)
-                       tcp_add_reno_sack(sk, num_dupack);
+                       tcp_add_reno_sack(sk, num_dupack, flag & FLAG_ECE);
                else if (flag & FLAG_SND_UNA_ADVANCED)
                        tcp_reset_reno_sack(tp);
        }
        struct inet_connection_sock *icsk = inet_csk(sk);
        struct tcp_sock *tp = tcp_sk(sk);
        int fast_rexmit = 0, flag = *ack_flag;
+       bool ece_ack = flag & FLAG_ECE;
        bool do_lost = num_dupack || ((flag & FLAG_DATA_SACKED) &&
                                      tcp_force_fast_retransmit(sk));
 
 
        /* Now state machine starts.
         * A. ECE, hence prohibit cwnd undoing, the reduction is required. */
-       if (flag & FLAG_ECE)
+       if (ece_ack)
                tp->prior_ssthresh = 0;
 
        /* B. In all the states check for reneging SACKs. */
        case TCP_CA_Recovery:
                if (!(flag & FLAG_SND_UNA_ADVANCED)) {
                        if (tcp_is_reno(tp))
-                               tcp_add_reno_sack(sk, num_dupack);
+                               tcp_add_reno_sack(sk, num_dupack, ece_ack);
                } else {
                        if (tcp_try_undo_partial(sk, prior_snd_una))
                                return;
                if (tcp_is_reno(tp)) {
                        if (flag & FLAG_SND_UNA_ADVANCED)
                                tcp_reset_reno_sack(tp);
-                       tcp_add_reno_sack(sk, num_dupack);
+                       tcp_add_reno_sack(sk, num_dupack, ece_ack);
                }
 
                if (icsk->icsk_ca_state <= TCP_CA_Disorder)
                }
 
                /* Otherwise enter Recovery state */
-               tcp_enter_recovery(sk, (flag & FLAG_ECE));
+               tcp_enter_recovery(sk, ece_ack);
                fast_rexmit = 1;
        }
 
  */
 static int tcp_clean_rtx_queue(struct sock *sk, u32 prior_fack,
                               u32 prior_snd_una,
-                              struct tcp_sacktag_state *sack)
+                              struct tcp_sacktag_state *sack, bool ece_ack)
 {
        const struct inet_connection_sock *icsk = inet_csk(sk);
        u64 first_ackt, last_ackt;
                }
 
                if (tcp_is_reno(tp)) {
-                       tcp_remove_reno_sacks(sk, pkts_acked);
+                       tcp_remove_reno_sacks(sk, pkts_acked, ece_ack);
 
                        /* If any of the cumulatively ACKed segments was
                         * retransmitted, non-SACK case cannot confirm that
                goto no_queue;
 
        /* See if we can take anything off of the retransmit queue. */
-       flag |= tcp_clean_rtx_queue(sk, prior_fack, prior_snd_una, &sack_state);
+       flag |= tcp_clean_rtx_queue(sk, prior_fack, prior_snd_una, &sack_state,
+                                   flag & FLAG_ECE);
 
        tcp_rack_update_reo_wnd(sk, &rs);