代码拉取完成,页面将自动刷新
同步操作将从 src-openEuler/gazelle 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
From 5ba19529acaf76a681313245a9a278356b615687 Mon Sep 17 00:00:00 2001
From: yangchen <yangchen145@huawei.com>
Date: Mon, 4 Mar 2024 14:10:43 +0800
Subject: [PATCH] support udp pkglen > mtu
---
src/lstack/core/lstack_lwip.c | 20 ++++++++++++++++++--
src/lstack/include/lstack_dpdk.h | 2 +-
2 files changed, 19 insertions(+), 3 deletions(-)
diff --git a/src/lstack/core/lstack_lwip.c b/src/lstack/core/lstack_lwip.c
index 7715cf3..f4199f8 100644
--- a/src/lstack/core/lstack_lwip.c
+++ b/src/lstack/core/lstack_lwip.c
@@ -252,6 +252,13 @@ struct pbuf *do_lwip_get_from_sendring(struct lwip_sock *sock, uint16_t remain_s
return NULL;
}
+ /* udp send a pbuf chain, dequeue all pbufs except head pbuf */
+ if (NETCONN_IS_UDP(sock) && remain_size > MBUF_MAX_DATA_LEN) {
+ int size = (remain_size + MBUF_MAX_DATA_LEN - 1) / MBUF_MAX_DATA_LEN - 1;
+ struct pbuf *pbuf_used[size];
+ gazelle_ring_sc_dequeue(sock->send_ring, (void **)&pbuf_used, size);
+ }
+
if (get_protocol_stack_group()->latency_start) {
calculate_lstack_latency(&sock->stack->latency, pbuf, GAZELLE_LATENCY_WRITE_LWIP);
}
@@ -285,7 +292,7 @@ void do_lwip_get_from_sendring_over(struct lwip_sock *sock)
sock->stack->stats.write_lwip_cnt++;
}
-static ssize_t do_app_write(struct pbuf *pbufs[], void *buf, size_t len, uint32_t write_num)
+static ssize_t do_app_write(struct lwip_sock *sock, struct pbuf *pbufs[], void *buf, size_t len, uint32_t write_num)
{
ssize_t send_len = 0;
uint32_t i = 0;
@@ -297,6 +304,11 @@ static ssize_t do_app_write(struct pbuf *pbufs[], void *buf, size_t len, uint32_
rte_memcpy((char *)pbufs[i]->payload, (char *)buf + send_len, MBUF_MAX_DATA_LEN);
pbufs[i]->tot_len = pbufs[i]->len = MBUF_MAX_DATA_LEN;
send_len += MBUF_MAX_DATA_LEN;
+
+ /* if udp pkg len > mtu, use pbuf chain to send it */
+ if (NETCONN_IS_UDP(sock) && i > 0) {
+ pbuf_cat(pbufs[0], pbufs[i]);
+ }
}
/* reduce the branch in loop */
@@ -305,6 +317,10 @@ static ssize_t do_app_write(struct pbuf *pbufs[], void *buf, size_t len, uint32_
pbufs[i]->tot_len = pbufs[i]->len = copy_len;
send_len += copy_len;
+ if (NETCONN_IS_UDP(sock) && i > 0) {
+ pbuf_cat(pbufs[0], pbufs[i]);
+ }
+
return send_len;
}
@@ -320,7 +336,7 @@ static inline ssize_t app_buff_write(struct lwip_sock *sock, void *buf, size_t l
time_stamp_into_pbuf(write_num, pbufs, time_stamp);
}
- ssize_t send_len = do_app_write(pbufs, buf, len, write_num);
+ ssize_t send_len = do_app_write(sock, pbufs, buf, len, write_num);
if (addr) {
if (addr->sa_family == AF_INET) {
diff --git a/src/lstack/include/lstack_dpdk.h b/src/lstack/include/lstack_dpdk.h
index c40f3c0..c7cfbdf 100644
--- a/src/lstack/include/lstack_dpdk.h
+++ b/src/lstack/include/lstack_dpdk.h
@@ -21,7 +21,7 @@
#define KNI_NB_MBUF (DEFAULT_RING_SIZE << 4)
-#define MAX_PACKET_SZ 1530
+#define MAX_PACKET_SZ 1538
#define RING_SIZE(x) ((x) - 1)
--
2.27.0
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。