代码拉取完成,页面将自动刷新
同步操作将从 src-openEuler/gazelle 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
From 5b3acd311fe20e9055b5faeced028e3099773e5b Mon Sep 17 00:00:00 2001
From: wu-changsheng <wuchangsheng2@huawei.com>
Date: Mon, 12 Dec 2022 11:48:31 +0800
Subject: [PATCH 2/4] fix genarate out event untimely
---
src/lstack/core/lstack_lwip.c | 23 ++++++++++++-----------
1 file changed, 12 insertions(+), 11 deletions(-)
diff --git a/src/lstack/core/lstack_lwip.c b/src/lstack/core/lstack_lwip.c
index d4a2861..0aaae30 100644
--- a/src/lstack/core/lstack_lwip.c
+++ b/src/lstack/core/lstack_lwip.c
@@ -125,25 +125,29 @@ static struct pbuf *init_mbuf_to_pbuf(struct rte_mbuf *mbuf, pbuf_layer layer, u
}
/* true: need replenish again */
-static bool replenish_send_idlembuf(struct protocol_stack *stack, struct rte_ring *ring, uint32_t replenish_cnt)
+static bool replenish_send_idlembuf(struct protocol_stack *stack, struct rte_ring *ring)
{
void *pbuf[SOCK_SEND_RING_SIZE];
- uint32_t alloc_num = LWIP_MIN(replenish_cnt, RING_SIZE(SOCK_SEND_RING_SIZE));
- if (gazelle_alloc_mbuf_with_reserve(stack->rxtx_pktmbuf_pool, (struct rte_mbuf **)pbuf, alloc_num) != 0) {
+ uint32_t replenish_cnt = gazelle_ring_free_count(ring);
+ if (replenish_cnt == 0) {
+ return false;
+ }
+
+ if (gazelle_alloc_mbuf_with_reserve(stack->rxtx_pktmbuf_pool, (struct rte_mbuf **)pbuf, replenish_cnt) != 0) {
stack->stats.tx_allocmbuf_fail++;
return true;
}
uint32_t i = 0;
- for (; i < alloc_num - 1; i++) {
+ for (; i < replenish_cnt - 1; i++) {
rte_prefetch0(mbuf_to_pbuf((void *)pbuf[i + 1]));
pbuf[i] = init_mbuf_to_pbuf(pbuf[i], PBUF_TRANSPORT, MBUF_MAX_DATA_LEN, PBUF_RAM);
}
pbuf[i] = init_mbuf_to_pbuf((struct rte_mbuf *)pbuf[i], PBUF_TRANSPORT, MBUF_MAX_DATA_LEN, PBUF_RAM);
- uint32_t num = gazelle_ring_sp_enqueue(ring, pbuf, alloc_num);
- for (uint32_t i = num; i < alloc_num; i++) {
+ uint32_t num = gazelle_ring_sp_enqueue(ring, pbuf, replenish_cnt);
+ for (uint32_t i = num; i < replenish_cnt; i++) {
pbuf_free(pbuf[i]);
}
@@ -174,7 +178,7 @@ void gazelle_init_sock(int32_t fd)
LSTACK_LOG(ERR, LSTACK, "sock_send create failed. errno: %d.\n", rte_errno);
return;
}
- (void)replenish_send_idlembuf(stack, sock->send_ring, RING_SIZE(SOCK_SEND_RING_SIZE));
+ (void)replenish_send_idlembuf(stack, sock->send_ring);
sock->stack = stack;
sock->stack->conn_num++;
@@ -541,10 +545,7 @@ static inline bool replenish_send_ring(struct protocol_stack *stack, struct lwip
{
bool replenish_again = false;
- uint32_t replenish_cnt = gazelle_ring_free_count(sock->send_ring);
- if (replenish_cnt >= SOCK_SEND_REPLENISH_THRES) {
- replenish_again = replenish_send_idlembuf(stack, sock->send_ring, replenish_cnt);
- }
+ replenish_again = replenish_send_idlembuf(stack, sock->send_ring);
if ((sock->epoll_events & EPOLLOUT) && NETCONN_IS_OUTIDLE(sock)) {
add_sock_event(sock, EPOLLOUT);
--
2.23.0
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。