加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
0043-add-prefetch.patch 1.67 KB
一键复制 编辑 原始数据 按行查看 历史
Aurora 提交于 2023-12-07 03:26 . update lwip to 2.1.3-39.oe2203sp1
From 3d63cb611a0b7a3cde0bb9e74b0ec83501966c51 Mon Sep 17 00:00:00 2001
From: wuchangsheng <wuchangsheng2@huawei.com>
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 <rte_prefetch.h>
+#endif
#include <string.h>
@@ -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 <rte_prefetch.h>
#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
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化