代码拉取完成,页面将自动刷新
同步操作将从 src-openEuler/gazelle 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
From b3ccf93dec7581adfcfaf99c6ea8b8478da263b1 Mon Sep 17 00:00:00 2001
From: wu-changsheng <wuchangsheng2@huawei.com>
Date: Sat, 8 Oct 2022 11:10:24 +0800
Subject: [PATCH 15/21] fix lwip_send fail free pbuf miss data
---
src/common/dpdk_common.h | 25 +++++++++++++++++++++++++
src/lstack/core/lstack_lwip.c | 7 ++++++-
src/lstack/include/lstack_lwip.h | 1 +
3 files changed, 32 insertions(+), 1 deletion(-)
diff --git a/src/common/dpdk_common.h b/src/common/dpdk_common.h
index 1c3e7e8..c2cbda7 100644
--- a/src/common/dpdk_common.h
+++ b/src/common/dpdk_common.h
@@ -177,6 +177,31 @@ static __rte_always_inline uint32_t gazelle_ring_sc_dequeue(struct rte_ring *r,
return n;
}
+/* get ring obj dont dequeue */
+static __rte_always_inline uint32_t gazelle_ring_sc_peek(struct rte_ring *r, void **obj_table, uint32_t n)
+{
+ uint32_t prod = __atomic_load_n(&r->prod.tail, __ATOMIC_ACQUIRE);
+ uint32_t cons = r->cons.tail;
+
+ uint32_t entries = prod - cons;
+ if (n > entries) {
+ n = entries;
+ }
+ if (unlikely(n == 0)) {
+ return 0;
+ }
+
+
+ __rte_ring_dequeue_elems(r, cons, obj_table, sizeof(void *), n);
+
+ return n;
+}
+
+static __rte_always_inline void gazelle_ring_dequeue_over(struct rte_ring *r, uint32_t n)
+{
+ r->cons.tail += n;
+}
+
static __rte_always_inline uint32_t gazelle_ring_read(struct rte_ring *r, void **obj_table, uint32_t n)
{
uint32_t cons = __atomic_load_n(&r->cons.head, __ATOMIC_ACQUIRE);
diff --git a/src/lstack/core/lstack_lwip.c b/src/lstack/core/lstack_lwip.c
index 6f08a1c..3f21a3a 100644
--- a/src/lstack/core/lstack_lwip.c
+++ b/src/lstack/core/lstack_lwip.c
@@ -229,7 +229,7 @@ struct pbuf *write_lwip_data(struct lwip_sock *sock, uint16_t remain_size, uint8
{
struct pbuf *pbuf = NULL;
- if (gazelle_ring_sc_dequeue(sock->send_ring, (void **)&pbuf, 1) != 1) {
+ if (gazelle_ring_sc_peek(sock->send_ring, (void **)&pbuf, 1) != 1) {
*apiflags &= ~TCP_WRITE_FLAG_MORE;
return NULL;
}
@@ -238,6 +238,11 @@ struct pbuf *write_lwip_data(struct lwip_sock *sock, uint16_t remain_size, uint8
return pbuf;
}
+void write_lwip_over(struct lwip_sock *sock, uint32_t n)
+{
+ gazelle_ring_dequeue_over(sock->send_ring, n);
+}
+
static inline void del_data_out_event(struct lwip_sock *sock)
{
pthread_spin_lock(&sock->wakeup->event_list_lock);
diff --git a/src/lstack/include/lstack_lwip.h b/src/lstack/include/lstack_lwip.h
index c62e99d..968eff2 100644
--- a/src/lstack/include/lstack_lwip.h
+++ b/src/lstack/include/lstack_lwip.h
@@ -27,6 +27,7 @@ void gazelle_init_sock(int32_t fd);
int32_t gazelle_socket(int domain, int type, int protocol);
void gazelle_clean_sock(int32_t fd);
struct pbuf *write_lwip_data(struct lwip_sock *sock, uint16_t remain_size, uint8_t *apiflags);
+void write_lwip_over(struct lwip_sock *sock, uint32_t n);
ssize_t write_stack_data(struct lwip_sock *sock, const void *buf, size_t len);
ssize_t read_stack_data(int32_t fd, void *buf, size_t len, int32_t flags);
ssize_t read_lwip_data(struct lwip_sock *sock, int32_t flags, uint8_t apiflags);
--
2.23.0
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。