Changeset View
Changeset View
Standalone View
Standalone View
sys/netinet/tcp_output.c
| Show First 20 Lines • Show All 253 Lines • ▼ Show 20 Lines | #endif | ||||
| tp->t_flags &= ~TF_LASTIDLE; | tp->t_flags &= ~TF_LASTIDLE; | ||||
| if (idle) { | if (idle) { | ||||
| if (tp->t_flags & TF_MORETOCOME) { | if (tp->t_flags & TF_MORETOCOME) { | ||||
| tp->t_flags |= TF_LASTIDLE; | tp->t_flags |= TF_LASTIDLE; | ||||
| idle = 0; | idle = 0; | ||||
| } | } | ||||
| } | } | ||||
| again: | again: | ||||
| sendwin = 0; | |||||
| /* | /* | ||||
| * If we've recently taken a timeout, snd_max will be greater than | * If we've recently taken a timeout, snd_max will be greater than | ||||
| * snd_nxt. There may be SACK information that allows us to avoid | * snd_nxt. There may be SACK information that allows us to avoid | ||||
| * resending already delivered data. Adjust snd_nxt accordingly. | * resending already delivered data. Adjust snd_nxt accordingly. | ||||
| */ | */ | ||||
| if ((tp->t_flags & TF_SACK_PERMIT) && | if ((tp->t_flags & TF_SACK_PERMIT) && | ||||
| SEQ_LT(tp->snd_nxt, tp->snd_max)) | SEQ_LT(tp->snd_nxt, tp->snd_max)) | ||||
| tcp_sack_adjust(tp); | sendwin = tcp_sack_adjust(tp); | ||||
| sendalot = 0; | sendalot = 0; | ||||
| tso = 0; | tso = 0; | ||||
| mtu = 0; | mtu = 0; | ||||
| off = tp->snd_nxt - tp->snd_una; | off = tp->snd_nxt - tp->snd_una; | ||||
| sendwin = min(tp->snd_wnd, tp->snd_cwnd); | sendwin = min(tp->snd_wnd, tp->snd_cwnd + sendwin); | ||||
| flags = tcp_outflags[tp->t_state]; | flags = tcp_outflags[tp->t_state]; | ||||
| /* | /* | ||||
| * Send any SACK-generated retransmissions. If we're explicitly trying | * Send any SACK-generated retransmissions. If we're explicitly trying | ||||
| * to send out new data (when sendalot is 1), bypass this function. | * to send out new data (when sendalot is 1), bypass this function. | ||||
| * If we retransmit in fast recovery mode, decrement snd_cwnd, since | * If we retransmit in fast recovery mode, decrement snd_cwnd, since | ||||
| * we're replacing a (future) new transmission with a retransmission | * we're replacing a (future) new transmission with a retransmission | ||||
| * now, and we previously incremented snd_cwnd in tcp_input(). | * now, and we previously incremented snd_cwnd in tcp_input(). | ||||
| */ | */ | ||||
| /* | /* | ||||
| * Still in sack recovery , reset rxmit flag to zero. | * Still in sack recovery , reset rxmit flag to zero. | ||||
| */ | */ | ||||
| sack_rxmit = 0; | sack_rxmit = 0; | ||||
| sack_bytes_rxmt = 0; | sack_bytes_rxmt = 0; | ||||
| len = 0; | len = 0; | ||||
| p = NULL; | p = NULL; | ||||
| if ((tp->t_flags & TF_SACK_PERMIT) && IN_FASTRECOVERY(tp->t_flags) && | if ((tp->t_flags & TF_SACK_PERMIT) && | ||||
| (IN_FASTRECOVERY(tp->t_flags) || SEQ_LT(tp->snd_nxt, tp->snd_max)) && | |||||
| (p = tcp_sack_output(tp, &sack_bytes_rxmt))) { | (p = tcp_sack_output(tp, &sack_bytes_rxmt))) { | ||||
| uint32_t cwin; | uint32_t cwin; | ||||
| cwin = | cwin = | ||||
| imax(min(tp->snd_wnd, tp->snd_cwnd) - sack_bytes_rxmt, 0); | imax(min(tp->snd_wnd, tp->snd_cwnd) - sack_bytes_rxmt, 0); | ||||
| /* Do not retransmit SACK segments beyond snd_recover */ | /* Do not retransmit SACK segments beyond snd_recover */ | ||||
| if (SEQ_GT(p->end, tp->snd_recover)) { | if (SEQ_GT(p->end, tp->snd_recover)) { | ||||
| /* | /* | ||||
| ▲ Show 20 Lines • Show All 82 Lines • ▼ Show 20 Lines | after_sack_rexmit: | ||||
| * In the normal retransmit-FIN-only case, however, snd_nxt will | * In the normal retransmit-FIN-only case, however, snd_nxt will | ||||
| * be set to snd_una, the offset will be 0, and the length may | * be set to snd_una, the offset will be 0, and the length may | ||||
| * wind up 0. | * wind up 0. | ||||
| * | * | ||||
| * If sack_rxmit is true we are retransmitting from the scoreboard | * If sack_rxmit is true we are retransmitting from the scoreboard | ||||
| * in which case len is already set. | * in which case len is already set. | ||||
| */ | */ | ||||
| if (sack_rxmit == 0) { | if (sack_rxmit == 0) { | ||||
| if (sack_bytes_rxmt == 0) { | if ((sack_bytes_rxmt == 0) || SEQ_LT(tp->snd_nxt, tp->snd_max)) { | ||||
cc: Same here for readability, it's better to remove () between relational operators:
```
if… | |||||
| len = ((int32_t)min(sbavail(&so->so_snd), sendwin) - | len = ((int32_t)min(sbavail(&so->so_snd), sendwin) - | ||||
| off); | off); | ||||
| } else { | } else { | ||||
| int32_t cwin; | int32_t cwin; | ||||
| /* | /* | ||||
| * We are inside of a SACK recovery episode and are | * We are inside of a SACK recovery episode and are | ||||
| * sending new data, having retransmitted all the | * sending new data, having retransmitted all the | ||||
| ▲ Show 20 Lines • Show All 1,231 Lines • ▼ Show 20 Lines | if (flags & TH_SYN) | ||||
| ++xlen; | ++xlen; | ||||
| if (flags & TH_FIN) { | if (flags & TH_FIN) { | ||||
| ++xlen; | ++xlen; | ||||
| tp->t_flags |= TF_SENTFIN; | tp->t_flags |= TF_SENTFIN; | ||||
| } | } | ||||
| if (SEQ_GT(tp->snd_nxt + xlen, tp->snd_max)) | if (SEQ_GT(tp->snd_nxt + xlen, tp->snd_max)) | ||||
| tp->snd_max = tp->snd_nxt + xlen; | tp->snd_max = tp->snd_nxt + xlen; | ||||
| } | } | ||||
| if ((error == 0) && | if ((error == 0) && | ||||
| (TCPS_HAVEESTABLISHED(tp->t_state) && | (tp->rcv_numsacks > 0) && | ||||
| (tp->t_flags & TF_SACK_PERMIT) && | TCPS_HAVEESTABLISHED(tp->t_state) && | ||||
| tp->rcv_numsacks > 0)) { | (tp->t_flags & TF_SACK_PERMIT)) { | ||||
| /* Clean up any DSACK's sent */ | /* Clean up any DSACK's sent */ | ||||
| tcp_clean_dsack_blocks(tp); | tcp_clean_dsack_blocks(tp); | ||||
| } | |||||
| if ((error == 0) && | |||||
| sack_rxmit && | |||||
| SEQ_LT(tp->snd_nxt, SEQ_MIN(p->rxmit, p->end))) { | |||||
| tp->snd_nxt = SEQ_MIN(p->rxmit, p->end); | |||||
Not Done Inline ActionsSame here for readability, it's better to remove () between relational operators and re-align: if (error == 0 && sack_rxmit &&
SEQ_LT(tp->snd_nxt, SEQ_MIN(p->rxmit, p->end))) {cc: Same here for readability, it's better to remove () between relational operators and re-align… | |||||
| } | } | ||||
Not Done Inline ActionsSame here for readability, it's better to remove () between relational operators and re-align: if (error == 0 && tp->rcv_numsacks > 0 &&
TCPS_HAVEESTABLISHED(tp->t_state) &&
tp->t_flags & TF_SACK_PERMIT) {cc: Same here for readability, it's better to remove () between relational operators and re-align… | |||||
| if (error) { | if (error) { | ||||
| /* | /* | ||||
| * We know that the packet was lost, so back out the | * We know that the packet was lost, so back out the | ||||
| * sequence number advance, if any. | * sequence number advance, if any. | ||||
| * | * | ||||
| * If the error is EPERM the packet got blocked by the | * If the error is EPERM the packet got blocked by the | ||||
| * local firewall. Normally we should terminate the | * local firewall. Normally we should terminate the | ||||
| * connection but the blocking may have been spurious | * connection but the blocking may have been spurious | ||||
| ▲ Show 20 Lines • Show All 521 Lines • Show Last 20 Lines | |||||
Same here for readability, it's better to remove () between relational operators:
if (sack_bytes_rxmt == 0 || SEQ_LT(tp->snd_nxt, tp->snd_max)) {