Optimize packet I/O and timeouts
- Introduce per-thread I/O statistics for packet I/O to reduce performance overhead. - Implement packet_io_yield() for better thread management during I/O operations. - Refactor time wheel management: - Replace timeouts-based cron tasks with (now_ts - last_ts > timeout) for scheduled tasks. - Update the time wheel every 5 ms for improved time management.
This commit is contained in:
@@ -619,7 +619,7 @@ TEST(IPV6_REASSEMBLE, NORMAL)
|
||||
assy = ip_reassembly_new(&opts);
|
||||
EXPECT_TRUE(assy != NULL);
|
||||
|
||||
check_stat(ip_reassembly_get_stat(assy),
|
||||
check_stat(ip_reassembly_stat(assy),
|
||||
0, 0, 0, 0, // ip4: find, add, del, timeout
|
||||
0, 0, 0, 0, 0, 0, // ip4: nospace, overlap, many frag, invalid length, dup first frag, dup last frag
|
||||
0, 0, 0, 0, // ip6: find, add, del, timeout
|
||||
@@ -630,7 +630,7 @@ TEST(IPV6_REASSEMBLE, NORMAL)
|
||||
new_pkt = ip_reassembly_packet(assy, &pkt, 1);
|
||||
EXPECT_TRUE(new_pkt == NULL);
|
||||
|
||||
check_stat(ip_reassembly_get_stat(assy),
|
||||
check_stat(ip_reassembly_stat(assy),
|
||||
0, 0, 0, 0, // ip4: find, add, del, timeout
|
||||
0, 0, 0, 0, 0, 0, // ip4: nospace, overlap, many frag, invalid length, dup first frag, dup last frag
|
||||
1, 1, 0, 0, // ip6: find, add, del, timeout
|
||||
@@ -641,7 +641,7 @@ TEST(IPV6_REASSEMBLE, NORMAL)
|
||||
new_pkt = ip_reassembly_packet(assy, &pkt, 1);
|
||||
EXPECT_TRUE(new_pkt == NULL);
|
||||
|
||||
check_stat(ip_reassembly_get_stat(assy),
|
||||
check_stat(ip_reassembly_stat(assy),
|
||||
0, 0, 0, 0, // ip4: find, add, del, timeout
|
||||
0, 0, 0, 0, 0, 0, // ip4: nospace, overlap, many frag, invalid length, dup first frag, dup last frag
|
||||
2, 1, 0, 0, // ip6: find, add, del, timeout
|
||||
@@ -652,7 +652,7 @@ TEST(IPV6_REASSEMBLE, NORMAL)
|
||||
new_pkt = ip_reassembly_packet(assy, &pkt, 1);
|
||||
EXPECT_TRUE(new_pkt == NULL);
|
||||
|
||||
check_stat(ip_reassembly_get_stat(assy),
|
||||
check_stat(ip_reassembly_stat(assy),
|
||||
0, 0, 0, 0, // ip4: find, add, del, timeout
|
||||
0, 0, 0, 0, 0, 0, // ip4: nospace, overlap, many frag, invalid length, dup first frag, dup last frag
|
||||
3, 1, 0, 0, // ip6: find, add, del, timeout
|
||||
@@ -663,7 +663,7 @@ TEST(IPV6_REASSEMBLE, NORMAL)
|
||||
new_pkt = ip_reassembly_packet(assy, &pkt, 1);
|
||||
EXPECT_TRUE(new_pkt);
|
||||
|
||||
check_stat(ip_reassembly_get_stat(assy),
|
||||
check_stat(ip_reassembly_stat(assy),
|
||||
0, 0, 0, 0, // ip4: find, add, del, timeout
|
||||
0, 0, 0, 0, 0, 0, // ip4: nospace, overlap, many frag, invalid length, dup first frag, dup last frag
|
||||
4, 1, 1, 0, // ip6: find, add, del, timeout
|
||||
@@ -727,7 +727,7 @@ TEST(IPV6_REASSEMBLE, EXPIRE)
|
||||
assy = ip_reassembly_new(&opts);
|
||||
EXPECT_TRUE(assy != NULL);
|
||||
|
||||
check_stat(ip_reassembly_get_stat(assy),
|
||||
check_stat(ip_reassembly_stat(assy),
|
||||
0, 0, 0, 0, // ip4: find, add, del, timeout
|
||||
0, 0, 0, 0, 0, 0, // ip4: nospace, overlap, many frag, invalid length, dup first frag, dup last frag
|
||||
0, 0, 0, 0, // ip6: find, add, del, timeout
|
||||
@@ -738,7 +738,7 @@ TEST(IPV6_REASSEMBLE, EXPIRE)
|
||||
new_pkt = ip_reassembly_packet(assy, &pkt, 1);
|
||||
EXPECT_TRUE(new_pkt == NULL);
|
||||
|
||||
check_stat(ip_reassembly_get_stat(assy),
|
||||
check_stat(ip_reassembly_stat(assy),
|
||||
0, 0, 0, 0, // ip4: find, add, del, timeout
|
||||
0, 0, 0, 0, 0, 0, // ip4: nospace, overlap, many frag, invalid length, dup first frag, dup last frag
|
||||
1, 1, 0, 0, // ip6: find, add, del, timeout
|
||||
@@ -749,7 +749,7 @@ TEST(IPV6_REASSEMBLE, EXPIRE)
|
||||
new_pkt = ip_reassembly_packet(assy, &pkt, 2);
|
||||
EXPECT_TRUE(new_pkt == NULL);
|
||||
|
||||
check_stat(ip_reassembly_get_stat(assy),
|
||||
check_stat(ip_reassembly_stat(assy),
|
||||
0, 0, 0, 0, // ip4: find, add, del, timeout
|
||||
0, 0, 0, 0, 0, 0, // ip4: nospace, overlap, many frag, invalid length, dup first frag, dup last frag
|
||||
2, 2, 1, 1, // ip6: find, add, del, timeout
|
||||
@@ -779,7 +779,7 @@ TEST(IPV6_REASSEMBLE, DUP_FIRST_FRAG)
|
||||
assy = ip_reassembly_new(&opts);
|
||||
EXPECT_TRUE(assy != NULL);
|
||||
|
||||
check_stat(ip_reassembly_get_stat(assy),
|
||||
check_stat(ip_reassembly_stat(assy),
|
||||
0, 0, 0, 0, // ip4: find, add, del, timeout
|
||||
0, 0, 0, 0, 0, 0, // ip4: nospace, overlap, many frag, invalid length, dup first frag, dup last frag
|
||||
0, 0, 0, 0, // ip6: find, add, del, timeout
|
||||
@@ -790,7 +790,7 @@ TEST(IPV6_REASSEMBLE, DUP_FIRST_FRAG)
|
||||
new_pkt = ip_reassembly_packet(assy, &pkt, 1);
|
||||
EXPECT_TRUE(new_pkt == NULL);
|
||||
|
||||
check_stat(ip_reassembly_get_stat(assy),
|
||||
check_stat(ip_reassembly_stat(assy),
|
||||
0, 0, 0, 0, // ip4: find, add, del, timeout
|
||||
0, 0, 0, 0, 0, 0, // ip4: nospace, overlap, many frag, invalid length, dup first frag, dup last frag
|
||||
1, 1, 0, 0, // ip6: find, add, del, timeout
|
||||
@@ -801,7 +801,7 @@ TEST(IPV6_REASSEMBLE, DUP_FIRST_FRAG)
|
||||
new_pkt = ip_reassembly_packet(assy, &pkt, 1);
|
||||
EXPECT_TRUE(new_pkt == NULL);
|
||||
|
||||
check_stat(ip_reassembly_get_stat(assy),
|
||||
check_stat(ip_reassembly_stat(assy),
|
||||
0, 0, 0, 0, // ip4: find, add, del, timeout
|
||||
0, 0, 0, 0, 0, 0, // ip4: nospace, overlap, many frag, invalid length, dup first frag, dup last frag
|
||||
2, 1, 0, 0, // ip6: find, add, del, timeout
|
||||
@@ -812,7 +812,7 @@ TEST(IPV6_REASSEMBLE, DUP_FIRST_FRAG)
|
||||
new_pkt = ip_reassembly_packet(assy, &pkt, 1);
|
||||
EXPECT_TRUE(new_pkt == NULL);
|
||||
|
||||
check_stat(ip_reassembly_get_stat(assy),
|
||||
check_stat(ip_reassembly_stat(assy),
|
||||
0, 0, 0, 0, // ip4: find, add, del, timeout
|
||||
0, 0, 0, 0, 0, 0, // ip4: nospace, overlap, many frag, invalid length, dup first frag, dup last frag
|
||||
3, 1, 0, 0, // ip6: find, add, del, timeout
|
||||
@@ -823,7 +823,7 @@ TEST(IPV6_REASSEMBLE, DUP_FIRST_FRAG)
|
||||
new_pkt = ip_reassembly_packet(assy, &pkt, 1);
|
||||
EXPECT_TRUE(new_pkt == NULL);
|
||||
|
||||
check_stat(ip_reassembly_get_stat(assy),
|
||||
check_stat(ip_reassembly_stat(assy),
|
||||
0, 0, 0, 0, // ip4: find, add, del, timeout
|
||||
0, 0, 0, 0, 0, 0, // ip4: nospace, overlap, many frag, invalid length, dup first frag, dup last frag
|
||||
4, 1, 0, 0, // ip6: find, add, del, timeout
|
||||
@@ -834,7 +834,7 @@ TEST(IPV6_REASSEMBLE, DUP_FIRST_FRAG)
|
||||
new_pkt = ip_reassembly_packet(assy, &pkt, 1);
|
||||
EXPECT_TRUE(new_pkt);
|
||||
|
||||
check_stat(ip_reassembly_get_stat(assy),
|
||||
check_stat(ip_reassembly_stat(assy),
|
||||
0, 0, 0, 0, // ip4: find, add, del, timeout
|
||||
0, 0, 0, 0, 0, 0, // ip4: nospace, overlap, many frag, invalid length, dup first frag, dup last frag
|
||||
5, 1, 1, 0, // ip6: find, add, del, timeout
|
||||
@@ -899,7 +899,7 @@ TEST(IPV6_REASSEMBLE, DUP_LAST_FRAG)
|
||||
assy = ip_reassembly_new(&opts);
|
||||
EXPECT_TRUE(assy != NULL);
|
||||
|
||||
check_stat(ip_reassembly_get_stat(assy),
|
||||
check_stat(ip_reassembly_stat(assy),
|
||||
0, 0, 0, 0, // ip4: find, add, del, timeout
|
||||
0, 0, 0, 0, 0, 0, // ip4: nospace, overlap, many frag, invalid length, dup first frag, dup last frag
|
||||
0, 0, 0, 0, // ip6: find, add, del, timeout
|
||||
@@ -910,7 +910,7 @@ TEST(IPV6_REASSEMBLE, DUP_LAST_FRAG)
|
||||
new_pkt = ip_reassembly_packet(assy, &pkt, 1);
|
||||
EXPECT_TRUE(new_pkt == NULL);
|
||||
|
||||
check_stat(ip_reassembly_get_stat(assy),
|
||||
check_stat(ip_reassembly_stat(assy),
|
||||
0, 0, 0, 0, // ip4: find, add, del, timeout
|
||||
0, 0, 0, 0, 0, 0, // ip4: nospace, overlap, many frag, invalid length, dup first frag, dup last frag
|
||||
1, 1, 0, 0, // ip6: find, add, del, timeout
|
||||
@@ -921,7 +921,7 @@ TEST(IPV6_REASSEMBLE, DUP_LAST_FRAG)
|
||||
new_pkt = ip_reassembly_packet(assy, &pkt, 1);
|
||||
EXPECT_TRUE(new_pkt == NULL);
|
||||
|
||||
check_stat(ip_reassembly_get_stat(assy),
|
||||
check_stat(ip_reassembly_stat(assy),
|
||||
0, 0, 0, 0, // ip4: find, add, del, timeout
|
||||
0, 0, 0, 0, 0, 0, // ip4: nospace, overlap, many frag, invalid length, dup first frag, dup last frag
|
||||
2, 1, 0, 0, // ip6: find, add, del, timeout
|
||||
@@ -932,7 +932,7 @@ TEST(IPV6_REASSEMBLE, DUP_LAST_FRAG)
|
||||
new_pkt = ip_reassembly_packet(assy, &pkt, 1);
|
||||
EXPECT_TRUE(new_pkt == NULL);
|
||||
|
||||
check_stat(ip_reassembly_get_stat(assy),
|
||||
check_stat(ip_reassembly_stat(assy),
|
||||
0, 0, 0, 0, // ip4: find, add, del, timeout
|
||||
0, 0, 0, 0, 0, 0, // ip4: nospace, overlap, many frag, invalid length, dup first frag, dup last frag
|
||||
3, 1, 0, 0, // ip6: find, add, del, timeout
|
||||
@@ -943,7 +943,7 @@ TEST(IPV6_REASSEMBLE, DUP_LAST_FRAG)
|
||||
new_pkt = ip_reassembly_packet(assy, &pkt, 1);
|
||||
EXPECT_TRUE(new_pkt == NULL);
|
||||
|
||||
check_stat(ip_reassembly_get_stat(assy),
|
||||
check_stat(ip_reassembly_stat(assy),
|
||||
0, 0, 0, 0, // ip4: find, add, del, timeout
|
||||
0, 0, 0, 0, 0, 0, // ip4: nospace, overlap, many frag, invalid length, dup first frag, dup last frag
|
||||
4, 1, 0, 0, // ip6: find, add, del, timeout
|
||||
@@ -954,7 +954,7 @@ TEST(IPV6_REASSEMBLE, DUP_LAST_FRAG)
|
||||
new_pkt = ip_reassembly_packet(assy, &pkt, 1);
|
||||
EXPECT_TRUE(new_pkt);
|
||||
|
||||
check_stat(ip_reassembly_get_stat(assy),
|
||||
check_stat(ip_reassembly_stat(assy),
|
||||
0, 0, 0, 0, // ip4: find, add, del, timeout
|
||||
0, 0, 0, 0, 0, 0, // ip4: nospace, overlap, many frag, invalid length, dup first frag, dup last frag
|
||||
5, 1, 1, 0, // ip6: find, add, del, timeout
|
||||
@@ -1019,7 +1019,7 @@ TEST(IPV6_REASSEMBLE, FULL)
|
||||
assy = ip_reassembly_new(&opts);
|
||||
EXPECT_TRUE(assy != NULL);
|
||||
|
||||
check_stat(ip_reassembly_get_stat(assy),
|
||||
check_stat(ip_reassembly_stat(assy),
|
||||
0, 0, 0, 0, // ip4: find, add, del, timeout
|
||||
0, 0, 0, 0, 0, 0, // ip4: nospace, overlap, many frag, invalid length, dup first frag, dup last frag
|
||||
0, 0, 0, 0, // ip6: find, add, del, timeout
|
||||
@@ -1035,7 +1035,7 @@ TEST(IPV6_REASSEMBLE, FULL)
|
||||
new_pkt = ip_reassembly_packet(assy, &pkt, 1);
|
||||
EXPECT_TRUE(new_pkt == NULL);
|
||||
|
||||
check_stat(ip_reassembly_get_stat(assy),
|
||||
check_stat(ip_reassembly_stat(assy),
|
||||
0, 0, 0, 0, // ip4: find, add, del, timeout
|
||||
0, 0, 0, 0, 0, 0, // ip4: nospace, overlap, many frag, invalid length, dup first frag, dup last frag
|
||||
1, 1, 0, 0, // ip6: find, add, del, timeout
|
||||
@@ -1047,7 +1047,7 @@ TEST(IPV6_REASSEMBLE, FULL)
|
||||
new_pkt = ip_reassembly_packet(assy, &pkt, 1);
|
||||
EXPECT_TRUE(new_pkt == NULL);
|
||||
|
||||
check_stat(ip_reassembly_get_stat(assy),
|
||||
check_stat(ip_reassembly_stat(assy),
|
||||
0, 0, 0, 0, // ip4: find, add, del, timeout
|
||||
0, 0, 0, 0, 0, 0, // ip4: nospace, overlap, many frag, invalid length, dup first frag, dup last frag
|
||||
2, 2, 0, 0, // ip6: find, add, del, timeout
|
||||
@@ -1059,7 +1059,7 @@ TEST(IPV6_REASSEMBLE, FULL)
|
||||
new_pkt = ip_reassembly_packet(assy, &pkt, 1);
|
||||
EXPECT_TRUE(new_pkt == NULL);
|
||||
|
||||
check_stat(ip_reassembly_get_stat(assy),
|
||||
check_stat(ip_reassembly_stat(assy),
|
||||
0, 0, 0, 0, // ip4: find, add, del, timeout
|
||||
0, 0, 0, 0, 0, 0, // ip4: nospace, overlap, many frag, invalid length, dup first frag, dup last frag
|
||||
3, 2, 0, 0, // ip6: find, add, del, timeout
|
||||
@@ -1088,7 +1088,7 @@ TEST(IPV6_REASSEMBLE, OVERLAP)
|
||||
assy = ip_reassembly_new(&opts);
|
||||
EXPECT_TRUE(assy != NULL);
|
||||
|
||||
check_stat(ip_reassembly_get_stat(assy),
|
||||
check_stat(ip_reassembly_stat(assy),
|
||||
0, 0, 0, 0, // ip4: find, add, del, timeout
|
||||
0, 0, 0, 0, 0, 0, // ip4: nospace, overlap, many frag, invalid length, dup first frag, dup last frag
|
||||
0, 0, 0, 0, // ip6: find, add, del, timeout
|
||||
@@ -1099,7 +1099,7 @@ TEST(IPV6_REASSEMBLE, OVERLAP)
|
||||
new_pkt = ip_reassembly_packet(assy, &pkt, 1);
|
||||
EXPECT_TRUE(new_pkt == NULL);
|
||||
|
||||
check_stat(ip_reassembly_get_stat(assy),
|
||||
check_stat(ip_reassembly_stat(assy),
|
||||
0, 0, 0, 0, // ip4: find, add, del, timeout
|
||||
0, 0, 0, 0, 0, 0, // ip4: nospace, overlap, many frag, invalid length, dup first frag, dup last frag
|
||||
1, 1, 0, 0, // ip6: find, add, del, timeout
|
||||
@@ -1110,7 +1110,7 @@ TEST(IPV6_REASSEMBLE, OVERLAP)
|
||||
new_pkt = ip_reassembly_packet(assy, &pkt, 1);
|
||||
EXPECT_TRUE(new_pkt == NULL);
|
||||
|
||||
check_stat(ip_reassembly_get_stat(assy),
|
||||
check_stat(ip_reassembly_stat(assy),
|
||||
0, 0, 0, 0, // ip4: find, add, del, timeout
|
||||
0, 0, 0, 0, 0, 0, // ip4: nospace, overlap, many frag, invalid length, dup first frag, dup last frag
|
||||
2, 1, 0, 0, // ip6: find, add, del, timeout
|
||||
@@ -1124,7 +1124,7 @@ TEST(IPV6_REASSEMBLE, OVERLAP)
|
||||
new_pkt = ip_reassembly_packet(assy, &pkt, 1);
|
||||
EXPECT_TRUE(new_pkt == NULL);
|
||||
|
||||
check_stat(ip_reassembly_get_stat(assy),
|
||||
check_stat(ip_reassembly_stat(assy),
|
||||
0, 0, 0, 0, // ip4: find, add, del, timeout
|
||||
0, 0, 0, 0, 0, 0, // ip4: nospace, overlap, many frag, invalid length, dup first frag, dup last frag
|
||||
3, 1, 0, 0, // ip6: find, add, del, timeout
|
||||
@@ -1135,7 +1135,7 @@ TEST(IPV6_REASSEMBLE, OVERLAP)
|
||||
new_pkt = ip_reassembly_packet(assy, &pkt, 1);
|
||||
EXPECT_TRUE(new_pkt == NULL);
|
||||
|
||||
check_stat(ip_reassembly_get_stat(assy),
|
||||
check_stat(ip_reassembly_stat(assy),
|
||||
0, 0, 0, 0, // ip4: find, add, del, timeout
|
||||
0, 0, 0, 0, 0, 0, // ip4: nospace, overlap, many frag, invalid length, dup first frag, dup last frag
|
||||
4, 1, 1, 0, // ip6: find, add, del, timeout
|
||||
|
||||
Reference in New Issue
Block a user