Changeset 4c55a64 in mainline for uspace/srv/net/tl/tcp/seq_no.c
- Timestamp:
- 2011-09-19T21:01:16Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 0093ab6
- Parents:
- c5808b41
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/net/tl/tcp/seq_no.c
rc5808b41 r4c55a64 68 68 } 69 69 70 /** Determine wheter ack is duplicate. 71 * 72 * ACK is duplicate if it refers to a sequence number that has 73 * aleady been acked (SEG.ACK < SND.UNA). 74 */ 75 bool seq_no_ack_duplicate(tcp_conn_t *conn, uint32_t seg_ack) 76 { 77 uint32_t diff; 78 79 /* 80 * There does not seem to be a three-point comparison 81 * equivalent of SEG.ACK < SND.UNA. Thus we do it 82 * on a best-effort basis, based on the difference. 83 * [-2^31, 0) means less-than, [0, 2^31) means greater-than. 84 */ 85 diff = seg_ack - conn->snd_una; 86 return (diff & (0x1 << 31)) != 0; 87 } 88 89 /** Determine segment has new window update. 90 * 91 * Window update is new if either SND.WL1 < SEG.SEQ or 92 * (SND.WL1 = SEG.SEQ and SND.WL2 <= SEG.ACK). 93 */ 94 bool seq_no_new_wnd_update(tcp_conn_t *conn, tcp_segment_t *seg) 95 { 96 bool n_seq, n_ack; 97 98 assert(seq_no_segment_acceptable(conn, seg)); 99 100 /* 101 * We make use of the fact that the peer should not ACK anything 102 * beyond our send window (we surely haven't sent that yet) 103 * as we should have filtered those acks out. 104 * We use SND.UNA+SND.WND as the third point of comparison. 105 */ 106 107 n_seq = seq_no_lt_le(conn->snd_wl1, seg->seq, 108 conn->snd_una + conn->snd_wnd); 109 110 n_ack = conn->snd_wl1 == seg->seq && 111 seq_no_le_lt(conn->snd_wl2, seg->ack, 112 conn->snd_una + conn->snd_wnd + 1); 113 114 return n_seq || n_ack; 115 } 116 70 117 /** Determine if segment is ready for processing. 71 118 *
Note:
See TracChangeset
for help on using the changeset viewer.