加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
0118-udp-do-not-merge-data-into-last-pbuf.patch 1.46 KB
一键复制 编辑 原始数据 按行查看 历史
yinbin6 提交于 2024-01-20 14:40 . sync adpat dpdk 23.11
From b90801a943f140a62761158a058d1076212dccf3 Mon Sep 17 00:00:00 2001
From: yangchen <yangchen145@huawei.com>
Date: Thu, 18 Jan 2024 10:01:52 +0800
Subject: [PATCH] udp: do not merge data into last pbuf
---
src/lstack/core/lstack_lwip.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/src/lstack/core/lstack_lwip.c b/src/lstack/core/lstack_lwip.c
index 87ec1f5..6ebe589 100644
--- a/src/lstack/core/lstack_lwip.c
+++ b/src/lstack/core/lstack_lwip.c
@@ -542,14 +542,14 @@ static ssize_t do_lwip_fill_sendring(struct lwip_sock *sock, const void *buf, si
}
struct protocol_stack *stack = sock->stack;
- if (!stack|| len == 0) {
+ if (!stack || len == 0) {
return 0;
}
ssize_t send_len = 0;
/* merge data into last pbuf */
- if (sock->remain_len) {
+ if (!NETCONN_IS_UDP(sock) && sock->remain_len) {
send_len = merge_data_lastpbuf(sock, (char *)buf, len);
if (send_len >= len) {
send_len = len;
@@ -1045,6 +1045,11 @@ ssize_t do_lwip_read_from_stack(int32_t fd, void *buf, size_t len, int32_t flags
calculate_lstack_latency(&sock->stack->latency, pbuf, GAZELLE_LATENCY_READ);
}
gazelle_ring_read_over(sock->recv_ring);
+
+ /* in udp, if pbuf remaining len less than copy_len, discard these packets */
+ if (recvd > 0 && NETCONN_IS_UDP(sock)) {
+ break;
+ }
}
}
--
2.33.0
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化