• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1From 3d63cb611a0b7a3cde0bb9e74b0ec83501966c51 Mon Sep 17 00:00:00 2001
2From: wuchangsheng <wuchangsheng2@huawei.com>
3Date: Sun, 18 Dec 2022 18:50:33 +0800
4Subject: [PATCH 2/2] add prefetch
5
6---
7 src/core/pbuf.c    | 7 +++++++
8 src/core/tcp_out.c | 6 ++++++
9 2 files changed, 13 insertions(+)
10
11diff --git a/src/core/pbuf.c b/src/core/pbuf.c
12index 404c8a7..ad75aa6 100644
13--- a/src/core/pbuf.c
14+++ b/src/core/pbuf.c
15@@ -83,6 +83,9 @@
16 #if LWIP_CHECKSUM_ON_COPY
17 #include "lwip/inet_chksum.h"
18 #endif
19+#if USE_LIBOS
20+#include <rte_prefetch.h>
21+#endif
22
23 #include <string.h>
24
25@@ -750,6 +753,10 @@ pbuf_free(struct pbuf *p)
26   /* de-allocate all consecutive pbufs from the head of the chain that
27    * obtain a zero reference count after decrementing*/
28   while (p != NULL) {
29+#if USE_LIBOS
30+    if (p->next)
31+      rte_prefetch0(p->next);
32+#endif
33     LWIP_PBUF_REF_T ref;
34     SYS_ARCH_DECL_PROTECT(old_level);
35     /* Since decrementing ref cannot be guaranteed to be a single machine operation
36diff --git a/src/core/tcp_out.c b/src/core/tcp_out.c
37index 55053d8..3c4dc4b 100644
38--- a/src/core/tcp_out.c
39+++ b/src/core/tcp_out.c
40@@ -82,6 +82,7 @@
41
42 #if USE_LIBOS
43 #include "lwipsock.h"
44+#include <rte_prefetch.h>
45 #if CHECKSUM_GEN_TCP_HW
46 #include "dpdk_cksum.h"
47 #endif
48@@ -1762,6 +1763,11 @@ tcp_output_segment(struct tcp_seg *seg, struct tcp_pcb *pcb, struct netif *netif
49   }
50 #endif
51
52+#if USE_LIBOS
53+  /* pbuf into mbuf. ref dpdk_common.h */
54+  rte_prefetch0((uint8_t *)(seg->p) - sizeof(struct rte_mbuf) - sizeof(uint64_t) * 2);
55+#endif
56+
57   /* Set retransmission timer running if it is not currently enabled
58      This must be set before checking the route. */
59   if (pcb->rtime < 0) {
60--
612.8.4.windows.1
62
63