From 3d63cb611a0b7a3cde0bb9e74b0ec83501966c51 Mon Sep 17 00:00:00 2001 From: wuchangsheng Date: Sun, 18 Dec 2022 18:50:33 +0800 Subject: [PATCH 2/2] add prefetch --- src/core/pbuf.c | 7 +++++++ src/core/tcp_out.c | 6 ++++++ 2 files changed, 13 insertions(+) diff --git a/src/core/pbuf.c b/src/core/pbuf.c index 404c8a7..ad75aa6 100644 --- a/src/core/pbuf.c +++ b/src/core/pbuf.c @@ -83,6 +83,9 @@ #if LWIP_CHECKSUM_ON_COPY #include "lwip/inet_chksum.h" #endif +#if USE_LIBOS +#include +#endif #include @@ -750,6 +753,10 @@ pbuf_free(struct pbuf *p) /* de-allocate all consecutive pbufs from the head of the chain that * obtain a zero reference count after decrementing*/ while (p != NULL) { +#if USE_LIBOS + if (p->next) + rte_prefetch0(p->next); +#endif LWIP_PBUF_REF_T ref; SYS_ARCH_DECL_PROTECT(old_level); /* Since decrementing ref cannot be guaranteed to be a single machine operation diff --git a/src/core/tcp_out.c b/src/core/tcp_out.c index 55053d8..3c4dc4b 100644 --- a/src/core/tcp_out.c +++ b/src/core/tcp_out.c @@ -82,6 +82,7 @@ #if USE_LIBOS #include "lwipsock.h" +#include #if CHECKSUM_GEN_TCP_HW #include "dpdk_cksum.h" #endif @@ -1762,6 +1763,11 @@ tcp_output_segment(struct tcp_seg *seg, struct tcp_pcb *pcb, struct netif *netif } #endif +#if USE_LIBOS + /* pbuf into mbuf. ref dpdk_common.h */ + rte_prefetch0((uint8_t *)(seg->p) - sizeof(struct rte_mbuf) - sizeof(uint64_t) * 2); +#endif + /* Set retransmission timer running if it is not currently enabled This must be set before checking the route. */ if (pcb->rtime < 0) { -- 2.8.4.windows.1