Page MenuHomeFreeBSD

D14540.id39819.diff
No OneTemporary

D14540.id39819.diff

Index: sys/netinet/tcp_lro.c
===================================================================
--- sys/netinet/tcp_lro.c
+++ sys/netinet/tcp_lro.c
@@ -57,6 +57,7 @@
#include <netinet/ip.h>
#include <netinet/ip_var.h>
#include <netinet/tcp.h>
+#include <netinet/tcp_seq.h>
#include <netinet/tcp_lro.h>
#include <netinet/tcp_var.h>
@@ -794,7 +795,9 @@
/* Try to append the new segment. */
if (__predict_false(seq != le->next_seq ||
- (tcp_data_len == 0 && le->ack_seq == th->th_ack))) {
+ (tcp_data_len == 0 &&
+ le->ack_seq == th->th_ack &&
+ le->window == th->th_win))) {
/* Out of order packet or duplicate ACK. */
tcp_lro_active_remove(le);
tcp_lro_flush(lc, le);
@@ -811,12 +814,20 @@
le->tsval = tsval;
le->tsecr = *(ts_ptr + 2);
}
-
- le->next_seq += tcp_data_len;
- le->ack_seq = th->th_ack;
- le->window = th->th_win;
- le->append_cnt++;
-
+ if (tcp_data_len || SEQ_GT(ntohl(th->th_ack), ntohl(le->ack_seq))) {
+ le->next_seq += tcp_data_len;
+ le->ack_seq = th->th_ack;
+ le->window = th->th_win;
+ le->append_cnt++;
+ } else if (th->th_ack == le->ack_seq) {
+ le->window = WIN_MAX(le->window, th->th_win);
+ le->append_cnt++;
+ } else {
+ /* no data and old seq */
+ le->append_cnt++;
+ m_freem(m);
+ return (0);
+ }
#ifdef TCP_LRO_UPDATE_CSUM
le->ulp_csum += tcp_lro_rx_csum_fixup(le, l3hdr, th,
tcp_data_len, ~csum);
Index: sys/netinet/tcp_seq.h
===================================================================
--- sys/netinet/tcp_seq.h
+++ sys/netinet/tcp_seq.h
@@ -47,6 +47,14 @@
#define SEQ_MIN(a, b) ((SEQ_LT(a, b)) ? (a) : (b))
#define SEQ_MAX(a, b) ((SEQ_GT(a, b)) ? (a) : (b))
+#define WIN_LT(a,b) ((short)(ntohs(a)-ntohs(b)) < 0)
+#define WIN_LEQ(a,b) ((short)(ntohs(a)-ntohs(b)) <= 0)
+#define WIN_GT(a,b) ((short)(ntohs(a)-ntohs(b)) > 0)
+#define WIN_GEQ(a,b) ((short)(ntohs(a)-ntohs(b)) >= 0)
+
+#define WIN_MIN(a, b) ((WIN_LT(a, b)) ? (a) : (b))
+#define WIN_MAX(a, b) ((WIN_GT(a, b)) ? (a) : (b))
+
/* for modulo comparisons of timestamps */
#define TSTMP_LT(a,b) ((int)((a)-(b)) < 0)
#define TSTMP_GT(a,b) ((int)((a)-(b)) > 0)

File Metadata

Mime Type
text/plain
Expires
Thu, Nov 6, 1:16 AM (9 h, 29 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
24896523
Default Alt Text
D14540.id39819.diff (2 KB)

Event Timeline