@@ -968,8 +968,20 @@ static int tcp_options_fit_accecn(struct tcp_out_options *opts, int required,
opts->num_accecn_fields--;
size -= TCPOLEN_ACCECN_PERFIELD;
}
- if (opts->num_accecn_fields < required)
+ if (opts->num_accecn_fields < required) {
+ if (opts->num_sack_blocks > 2) {
+ /* Try to fit the option by removing one SACK block */
+ opts->num_sack_blocks--;
+ size = tcp_options_fit_accecn(opts, required,
+ remaining + TCPOLEN_SACK_PERBLOCK,
+ max_combine_saving);
+ if (opts->options & OPTION_ACCECN)
+ return size - TCPOLEN_SACK_PERBLOCK;
+
+ opts->num_sack_blocks++;
+ }
return 0;
+ }
opts->options |= OPTION_ACCECN;
return size;