!132 [sync] PR-128: modify duplicate code
From: @openeuler-sync-bot Reviewed-by: @wu-changsheng Signed-off-by: @wu-changsheng
This commit is contained in:
commit
67cc8077a4
36
0136-modify-duplicate-code.patch
Normal file
36
0136-modify-duplicate-code.patch
Normal file
@ -0,0 +1,36 @@
|
||||
From c776269a5565c93b7ad06593901bb2619b828baf Mon Sep 17 00:00:00 2001
|
||||
From: compile_success <980965867@qq.com>
|
||||
Date: Tue, 15 Nov 2022 03:21:35 +0000
|
||||
Subject: [PATCH] modify duplicate code
|
||||
|
||||
---
|
||||
src/lstack/core/lstack_lwip.c | 6 +-----
|
||||
1 file changed, 1 insertion(+), 5 deletions(-)
|
||||
|
||||
diff --git a/src/lstack/core/lstack_lwip.c b/src/lstack/core/lstack_lwip.c
|
||||
index 4fec74e..2fbbe97 100644
|
||||
--- a/src/lstack/core/lstack_lwip.c
|
||||
+++ b/src/lstack/core/lstack_lwip.c
|
||||
@@ -558,10 +558,6 @@ ssize_t sendmsg_to_stack(int32_t s, const struct msghdr *message, int32_t flags)
|
||||
continue;
|
||||
}
|
||||
|
||||
- if (message->msg_iov[i].iov_len == 0){
|
||||
- continue;
|
||||
- }
|
||||
-
|
||||
ret = write_stack_data(sock, message->msg_iov[i].iov_base, message->msg_iov[i].iov_len);
|
||||
if (ret <= 0) {
|
||||
buflen = (buflen == 0) ? ret : buflen;
|
||||
@@ -730,7 +726,7 @@ void gazelle_connected_callback(struct netconn *conn)
|
||||
}
|
||||
|
||||
if (sock->wakeup != NULL && sock->wakeup->epollfd > 0){
|
||||
- posix_api->epoll_ctl_fn(sock->wakeup->epollfd, EPOLL_CTL_DEL, fd, NULL);
|
||||
+ posix_api->epoll_ctl_fn(sock->wakeup->epollfd, EPOLL_CTL_DEL, fd, NULL);
|
||||
}
|
||||
|
||||
posix_api->shutdown_fn(fd, SHUT_RDWR);
|
||||
--
|
||||
2.33.0
|
||||
|
||||
141
0137-merge-lstack-rx-tx-mbuf-pool.patch
Normal file
141
0137-merge-lstack-rx-tx-mbuf-pool.patch
Normal file
@ -0,0 +1,141 @@
|
||||
From ac68de66115c072361738a8e5f610310d14d3b46 Mon Sep 17 00:00:00 2001
|
||||
From: jiangheng <jiangheng14@huawei.com>
|
||||
Date: Wed, 16 Nov 2022 19:24:54 +0800
|
||||
Subject: [PATCH] merge lstack rx tx mbuf pool
|
||||
|
||||
---
|
||||
src/lstack/core/lstack_dpdk.c | 12 +++---------
|
||||
src/lstack/core/lstack_lwip.c | 4 ++--
|
||||
src/lstack/core/lstack_protocol_stack.c | 2 +-
|
||||
src/lstack/include/lstack_dpdk.h | 6 ++----
|
||||
src/lstack/include/lstack_protocol_stack.h | 3 +--
|
||||
src/lstack/netif/lstack_ethdev.c | 2 +-
|
||||
src/lstack/netif/lstack_vdev.c | 2 +-
|
||||
7 files changed, 11 insertions(+), 20 deletions(-)
|
||||
|
||||
diff --git a/src/lstack/core/lstack_dpdk.c b/src/lstack/core/lstack_dpdk.c
|
||||
index 5dc2e54..535a138 100644
|
||||
--- a/src/lstack/core/lstack_dpdk.c
|
||||
+++ b/src/lstack/core/lstack_dpdk.c
|
||||
@@ -177,15 +177,9 @@ int32_t pktmbuf_pool_init(struct protocol_stack *stack, uint16_t stack_num)
|
||||
return -1;
|
||||
}
|
||||
|
||||
- stack->rx_pktmbuf_pool = create_pktmbuf_mempool("rx_mbuf", RX_NB_MBUF / stack_num, RX_MBUF_CACHE_SZ,
|
||||
+ stack->rxtx_pktmbuf_pool = create_pktmbuf_mempool("rxtx_mbuf", RXTX_NB_MBUF / stack_num, RXTX_CACHE_SZ,
|
||||
stack->queue_id);
|
||||
- if (stack->rx_pktmbuf_pool == NULL) {
|
||||
- return -1;
|
||||
- }
|
||||
-
|
||||
- stack->tx_pktmbuf_pool = create_pktmbuf_mempool("tx_mbuf", TX_NB_MBUF / stack_num, TX_MBUF_CACHE_SZ,
|
||||
- stack->queue_id);
|
||||
- if (stack->tx_pktmbuf_pool == NULL) {
|
||||
+ if (stack->rxtx_pktmbuf_pool == NULL) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -488,7 +482,7 @@ static int32_t dpdk_ethdev_setup(const struct eth_params *eth_params, const stru
|
||||
int32_t ret;
|
||||
|
||||
ret = rte_eth_rx_queue_setup(eth_params->port_id, stack->queue_id, eth_params->nb_rx_desc, stack->socket_id,
|
||||
- ð_params->rx_conf, stack->rx_pktmbuf_pool);
|
||||
+ ð_params->rx_conf, stack->rxtx_pktmbuf_pool);
|
||||
if (ret < 0) {
|
||||
LSTACK_LOG(ERR, LSTACK, "cannot setup rx_queue %hu: %s\n", stack->queue_id, rte_strerror(-ret));
|
||||
return -1;
|
||||
diff --git a/src/lstack/core/lstack_lwip.c b/src/lstack/core/lstack_lwip.c
|
||||
index 2fbbe97..fbc908c 100644
|
||||
--- a/src/lstack/core/lstack_lwip.c
|
||||
+++ b/src/lstack/core/lstack_lwip.c
|
||||
@@ -106,7 +106,7 @@ static void replenish_send_idlembuf(struct protocol_stack *stack, struct rte_rin
|
||||
uint32_t replenish_cnt = gazelle_ring_free_count(ring);
|
||||
|
||||
uint32_t alloc_num = LWIP_MIN(replenish_cnt, RING_SIZE(SOCK_SEND_RING_SIZE));
|
||||
- if (rte_pktmbuf_alloc_bulk(stack->tx_pktmbuf_pool, (struct rte_mbuf **)pbuf, alloc_num) != 0) {
|
||||
+ if (rte_pktmbuf_alloc_bulk(stack->rxtx_pktmbuf_pool, (struct rte_mbuf **)pbuf, alloc_num) != 0) {
|
||||
stack->stats.tx_allocmbuf_fail++;
|
||||
return;
|
||||
}
|
||||
@@ -207,7 +207,7 @@ struct pbuf *lwip_alloc_pbuf(pbuf_layer layer, uint16_t length, pbuf_type type)
|
||||
struct rte_mbuf *mbuf;
|
||||
struct protocol_stack *stack = get_protocol_stack();
|
||||
|
||||
- if (rte_pktmbuf_alloc_bulk(stack->tx_pktmbuf_pool, &mbuf, 1) != 0) {
|
||||
+ if (rte_pktmbuf_alloc_bulk(stack->rxtx_pktmbuf_pool, &mbuf, 1) != 0) {
|
||||
stack->stats.tx_allocmbuf_fail++;
|
||||
return NULL;
|
||||
}
|
||||
diff --git a/src/lstack/core/lstack_protocol_stack.c b/src/lstack/core/lstack_protocol_stack.c
|
||||
index 7a3955d..14c25f5 100644
|
||||
--- a/src/lstack/core/lstack_protocol_stack.c
|
||||
+++ b/src/lstack/core/lstack_protocol_stack.c
|
||||
@@ -697,7 +697,7 @@ void stack_broadcast_arp(struct rte_mbuf *mbuf, struct protocol_stack *cur_stack
|
||||
continue;
|
||||
}
|
||||
|
||||
- ret = gazelle_alloc_pktmbuf(stack->rx_pktmbuf_pool, &mbuf_copy, 1);
|
||||
+ ret = gazelle_alloc_pktmbuf(stack->rxtx_pktmbuf_pool, &mbuf_copy, 1);
|
||||
if (ret != 0) {
|
||||
stack->stats.rx_allocmbuf_fail++;
|
||||
return;
|
||||
diff --git a/src/lstack/include/lstack_dpdk.h b/src/lstack/include/lstack_dpdk.h
|
||||
index 684d025..9a4fb35 100644
|
||||
--- a/src/lstack/include/lstack_dpdk.h
|
||||
+++ b/src/lstack/include/lstack_dpdk.h
|
||||
@@ -15,10 +15,8 @@
|
||||
|
||||
#include "gazelle_opt.h"
|
||||
|
||||
-#define RX_NB_MBUF ((5 * MAX_CLIENTS) + (VDEV_RX_QUEUE_SZ * DEFAULT_BACKUP_RING_SIZE_FACTOR))
|
||||
-#define RX_MBUF_CACHE_SZ (VDEV_RX_QUEUE_SZ)
|
||||
-#define TX_NB_MBUF (128 * DEFAULT_RING_SIZE)
|
||||
-#define TX_MBUF_CACHE_SZ (DEFAULT_RING_SIZE)
|
||||
+#define RXTX_NB_MBUF (128 * 2000) /* mbuf per connect * connect num */
|
||||
+#define RXTX_CACHE_SZ (VDEV_RX_QUEUE_SZ)
|
||||
#define KNI_NB_MBUF (DEFAULT_RING_SIZE << 2)
|
||||
#define KNI_MBUF_CACHE_SZ (DEFAULT_RING_SIZE)
|
||||
|
||||
diff --git a/src/lstack/include/lstack_protocol_stack.h b/src/lstack/include/lstack_protocol_stack.h
|
||||
index 2d9053a..68cbbfa 100644
|
||||
--- a/src/lstack/include/lstack_protocol_stack.h
|
||||
+++ b/src/lstack/include/lstack_protocol_stack.h
|
||||
@@ -43,8 +43,7 @@ struct protocol_stack {
|
||||
cpu_set_t idle_cpuset; /* idle cpu in numa of stack, app thread bind to it */
|
||||
int32_t epollfd; /* kernel event thread epoll fd */
|
||||
|
||||
- struct rte_mempool *rx_pktmbuf_pool;
|
||||
- struct rte_mempool *tx_pktmbuf_pool;
|
||||
+ struct rte_mempool *rxtx_pktmbuf_pool;
|
||||
struct rte_ring *rx_ring;
|
||||
struct rte_ring *tx_ring;
|
||||
struct rte_ring *reg_ring;
|
||||
diff --git a/src/lstack/netif/lstack_ethdev.c b/src/lstack/netif/lstack_ethdev.c
|
||||
index d410a5c..62e4ecf 100644
|
||||
--- a/src/lstack/netif/lstack_ethdev.c
|
||||
+++ b/src/lstack/netif/lstack_ethdev.c
|
||||
@@ -207,7 +207,7 @@ int32_t ethdev_init(struct protocol_stack *stack)
|
||||
|
||||
if (use_ltran()) {
|
||||
stack->rx_ring_used = 0;
|
||||
- int32_t ret = fill_mbuf_to_ring(stack->rx_pktmbuf_pool, stack->rx_ring, RING_SIZE(VDEV_RX_QUEUE_SZ));
|
||||
+ int32_t ret = fill_mbuf_to_ring(stack->rxtx_pktmbuf_pool, stack->rx_ring, RING_SIZE(VDEV_RX_QUEUE_SZ));
|
||||
if (ret != 0) {
|
||||
LSTACK_LOG(ERR, LSTACK, "fill mbuf to rx_ring failed ret=%d\n", ret);
|
||||
return ret;
|
||||
diff --git a/src/lstack/netif/lstack_vdev.c b/src/lstack/netif/lstack_vdev.c
|
||||
index e2671b4..8b0617e 100644
|
||||
--- a/src/lstack/netif/lstack_vdev.c
|
||||
+++ b/src/lstack/netif/lstack_vdev.c
|
||||
@@ -51,7 +51,7 @@ static uint32_t ltran_rx_poll(struct protocol_stack *stack, struct rte_mbuf **pk
|
||||
stack->rx_ring_used += rcvd_pkts;
|
||||
if (unlikely(stack->rx_ring_used >= USED_RX_PKTS_WATERMARK)) {
|
||||
uint32_t free_cnt = LWIP_MIN(stack->rx_ring_used, RING_SIZE(DPDK_PKT_BURST_SIZE));
|
||||
- int32_t ret = gazelle_alloc_pktmbuf(stack->rx_pktmbuf_pool, (struct rte_mbuf **)free_buf, free_cnt);
|
||||
+ int32_t ret = gazelle_alloc_pktmbuf(stack->rxtx_pktmbuf_pool, (struct rte_mbuf **)free_buf, free_cnt);
|
||||
if (likely(ret == 0)) {
|
||||
nr_pkts = gazelle_ring_sp_enqueue(stack->rx_ring, (void **)free_buf, free_cnt);
|
||||
stack->rx_ring_used -= nr_pkts;
|
||||
--
|
||||
2.33.0
|
||||
|
||||
142
0138-avoid-send-stop-when-mbuf-pool-empty.patch
Normal file
142
0138-avoid-send-stop-when-mbuf-pool-empty.patch
Normal file
@ -0,0 +1,142 @@
|
||||
From 3c8c47b30236f9d213fe7bf5877970941e6cd6ac Mon Sep 17 00:00:00 2001
|
||||
From: wu-changsheng <wuchangsheng2@huawei.com>
|
||||
Date: Wed, 16 Nov 2022 19:51:57 +0800
|
||||
Subject: [PATCH] avoid send stop when mbuf pool empty
|
||||
|
||||
---
|
||||
src/lstack/core/lstack_lwip.c | 57 ++++++++++++++++++++++++-----------
|
||||
1 file changed, 40 insertions(+), 17 deletions(-)
|
||||
|
||||
diff --git a/src/lstack/core/lstack_lwip.c b/src/lstack/core/lstack_lwip.c
|
||||
index fbc908c..196420d 100644
|
||||
--- a/src/lstack/core/lstack_lwip.c
|
||||
+++ b/src/lstack/core/lstack_lwip.c
|
||||
@@ -99,7 +99,8 @@ static struct pbuf *init_mbuf_to_pbuf(struct rte_mbuf *mbuf, pbuf_layer layer, u
|
||||
return pbuf;
|
||||
}
|
||||
|
||||
-static void replenish_send_idlembuf(struct protocol_stack *stack, struct rte_ring *ring)
|
||||
+/* true: need replenish again */
|
||||
+static bool replenish_send_idlembuf(struct protocol_stack *stack, struct rte_ring *ring)
|
||||
{
|
||||
void *pbuf[SOCK_SEND_RING_SIZE];
|
||||
|
||||
@@ -108,7 +109,7 @@ static void replenish_send_idlembuf(struct protocol_stack *stack, struct rte_rin
|
||||
uint32_t alloc_num = LWIP_MIN(replenish_cnt, RING_SIZE(SOCK_SEND_RING_SIZE));
|
||||
if (rte_pktmbuf_alloc_bulk(stack->rxtx_pktmbuf_pool, (struct rte_mbuf **)pbuf, alloc_num) != 0) {
|
||||
stack->stats.tx_allocmbuf_fail++;
|
||||
- return;
|
||||
+ return true;
|
||||
}
|
||||
|
||||
for (uint32_t i = 0; i < alloc_num; i++) {
|
||||
@@ -119,6 +120,8 @@ static void replenish_send_idlembuf(struct protocol_stack *stack, struct rte_rin
|
||||
for (uint32_t i = num; i < alloc_num; i++) {
|
||||
pbuf_free(pbuf[i]);
|
||||
}
|
||||
+
|
||||
+ return false;
|
||||
}
|
||||
|
||||
void gazelle_init_sock(int32_t fd)
|
||||
@@ -145,7 +148,7 @@ void gazelle_init_sock(int32_t fd)
|
||||
LSTACK_LOG(ERR, LSTACK, "sock_send create failed. errno: %d.\n", rte_errno);
|
||||
return;
|
||||
}
|
||||
- replenish_send_idlembuf(stack, sock->send_ring);
|
||||
+ (void)replenish_send_idlembuf(stack, sock->send_ring);
|
||||
|
||||
sock->stack = stack;
|
||||
sock->stack->conn_num++;
|
||||
@@ -310,7 +313,22 @@ ssize_t write_stack_data(struct lwip_sock *sock, const void *buf, size_t len)
|
||||
return send_len;
|
||||
}
|
||||
|
||||
-static void do_lwip_send(struct protocol_stack *stack, int32_t fd, struct lwip_sock *sock, int32_t flags)
|
||||
+static inline bool replenish_send_ring(struct protocol_stack *stack, struct lwip_sock *sock)
|
||||
+{
|
||||
+ bool replenish_again = false;
|
||||
+
|
||||
+ if (gazelle_ring_readable_count(sock->send_ring) < SOCK_SEND_REPLENISH_THRES) {
|
||||
+ replenish_again = replenish_send_idlembuf(stack, sock->send_ring);
|
||||
+ }
|
||||
+
|
||||
+ if ((sock->epoll_events & EPOLLOUT) && NETCONN_IS_OUTIDLE(sock)) {
|
||||
+ add_sock_event(sock, EPOLLOUT);
|
||||
+ }
|
||||
+
|
||||
+ return replenish_again;
|
||||
+}
|
||||
+
|
||||
+static inline bool do_lwip_send(struct protocol_stack *stack, int32_t fd, struct lwip_sock *sock, int32_t flags)
|
||||
{
|
||||
/* send all send_ring, so len set lwip send max. */
|
||||
ssize_t len = lwip_send(fd, sock, UINT16_MAX, flags);
|
||||
@@ -320,13 +338,7 @@ static void do_lwip_send(struct protocol_stack *stack, int32_t fd, struct lwip_s
|
||||
add_sock_event(sock, EPOLLERR);
|
||||
}
|
||||
|
||||
- if (gazelle_ring_readable_count(sock->send_ring) < SOCK_SEND_REPLENISH_THRES) {
|
||||
- replenish_send_idlembuf(stack, sock->send_ring);
|
||||
- }
|
||||
-
|
||||
- if ((sock->epoll_events & EPOLLOUT) && NETCONN_IS_OUTIDLE(sock)) {
|
||||
- add_sock_event(sock, EPOLLOUT);
|
||||
- }
|
||||
+ return replenish_send_ring(stack, sock);
|
||||
}
|
||||
|
||||
void stack_send(struct rpc_msg *msg)
|
||||
@@ -348,10 +360,10 @@ void stack_send(struct rpc_msg *msg)
|
||||
return;
|
||||
}
|
||||
|
||||
- do_lwip_send(stack, fd, sock, flags);
|
||||
+ bool replenish_again = do_lwip_send(stack, fd, sock, flags);
|
||||
|
||||
- /* have remain data add sendlist */
|
||||
- if (NETCONN_IS_DATAOUT(sock)) {
|
||||
+ /* have remain data or replenish again add sendlist */
|
||||
+ if (NETCONN_IS_DATAOUT(sock) || replenish_again) {
|
||||
if (list_is_null(&sock->send_list)) {
|
||||
list_add_node(&stack->send_list, &sock->send_list);
|
||||
__atomic_store_n(&sock->in_send, 1, __ATOMIC_RELEASE);
|
||||
@@ -365,6 +377,7 @@ void send_stack_list(struct protocol_stack *stack, uint32_t send_max)
|
||||
struct list_node *node, *temp;
|
||||
struct lwip_sock *sock;
|
||||
uint32_t read_num = 0;
|
||||
+ bool replenish_again;
|
||||
|
||||
list_for_each_safe(node, temp, &stack->send_list) {
|
||||
sock = container_of(node, struct lwip_sock, send_list);
|
||||
@@ -372,14 +385,24 @@ void send_stack_list(struct protocol_stack *stack, uint32_t send_max)
|
||||
__atomic_store_n(&sock->in_send, 0, __ATOMIC_RELEASE);
|
||||
rte_mb();
|
||||
|
||||
- if (sock->conn == NULL || sock->errevent > 0 || !NETCONN_IS_DATAOUT(sock)) {
|
||||
+ if (sock->conn == NULL || sock->errevent > 0) {
|
||||
list_del_node_null(&sock->send_list);
|
||||
continue;
|
||||
}
|
||||
|
||||
- do_lwip_send(stack, sock->conn->socket, sock, 0);
|
||||
-
|
||||
if (!NETCONN_IS_DATAOUT(sock)) {
|
||||
+ replenish_again = replenish_send_ring(stack, sock);
|
||||
+ if (replenish_again) {
|
||||
+ continue;
|
||||
+ }
|
||||
+
|
||||
+ list_del_node_null(&sock->send_list);
|
||||
+ continue;
|
||||
+ }
|
||||
+
|
||||
+ replenish_again = do_lwip_send(stack, sock->conn->socket, sock, 0);
|
||||
+
|
||||
+ if (!NETCONN_IS_DATAOUT(sock) && !replenish_again) {
|
||||
list_del_node_null(&sock->send_list);
|
||||
} else {
|
||||
__atomic_store_n(&sock->in_send, 1, __ATOMIC_RELEASE);
|
||||
--
|
||||
2.33.0
|
||||
|
||||
28
0139-fix-pcb-snd_buf-flip.patch
Normal file
28
0139-fix-pcb-snd_buf-flip.patch
Normal file
@ -0,0 +1,28 @@
|
||||
From d51be32362f49a53d4c186f8da06a317b8dad21b Mon Sep 17 00:00:00 2001
|
||||
From: wu-changsheng <wuchangsheng2@huawei.com>
|
||||
Date: Wed, 16 Nov 2022 20:04:01 +0800
|
||||
Subject: [PATCH] fix pcb snd_buf flip
|
||||
|
||||
---
|
||||
src/lstack/core/lstack_lwip.c | 5 +++++
|
||||
1 file changed, 5 insertions(+)
|
||||
|
||||
diff --git a/src/lstack/core/lstack_lwip.c b/src/lstack/core/lstack_lwip.c
|
||||
index 196420d..8a11aa5 100644
|
||||
--- a/src/lstack/core/lstack_lwip.c
|
||||
+++ b/src/lstack/core/lstack_lwip.c
|
||||
@@ -227,6 +227,11 @@ struct pbuf *write_lwip_data(struct lwip_sock *sock, uint16_t remain_size, uint8
|
||||
return NULL;
|
||||
}
|
||||
|
||||
+ if (pbuf->tot_len > remain_size) {
|
||||
+ *apiflags &= ~TCP_WRITE_FLAG_MORE;
|
||||
+ return NULL;
|
||||
+ }
|
||||
+
|
||||
return pbuf;
|
||||
}
|
||||
|
||||
--
|
||||
2.33.0
|
||||
|
||||
30
0140-fix-lwip-send-return-0-add-err-event.patch
Normal file
30
0140-fix-lwip-send-return-0-add-err-event.patch
Normal file
@ -0,0 +1,30 @@
|
||||
From ecd6f699994dd335fb0c3187d8296f741ff5fd17 Mon Sep 17 00:00:00 2001
|
||||
From: wu-changsheng <wuchangsheng2@huawei.com>
|
||||
Date: Wed, 16 Nov 2022 21:40:43 +0800
|
||||
Subject: [PATCH] fix lwip send return 0 add err event
|
||||
|
||||
---
|
||||
src/lstack/core/lstack_lwip.c | 7 +------
|
||||
1 file changed, 1 insertion(+), 6 deletions(-)
|
||||
|
||||
diff --git a/src/lstack/core/lstack_lwip.c b/src/lstack/core/lstack_lwip.c
|
||||
index 8a11aa5..9271bd6 100644
|
||||
--- a/src/lstack/core/lstack_lwip.c
|
||||
+++ b/src/lstack/core/lstack_lwip.c
|
||||
@@ -336,12 +336,7 @@ static inline bool replenish_send_ring(struct protocol_stack *stack, struct lwip
|
||||
static inline bool do_lwip_send(struct protocol_stack *stack, int32_t fd, struct lwip_sock *sock, int32_t flags)
|
||||
{
|
||||
/* send all send_ring, so len set lwip send max. */
|
||||
- ssize_t len = lwip_send(fd, sock, UINT16_MAX, flags);
|
||||
- if (len == 0) {
|
||||
- /* FIXME: should use POLLRDHUP, when connection be closed. lwip event-callback no POLLRDHUP */
|
||||
- sock->errevent = 1;
|
||||
- add_sock_event(sock, EPOLLERR);
|
||||
- }
|
||||
+ (void)lwip_send(fd, sock, UINT16_MAX, flags);
|
||||
|
||||
return replenish_send_ring(stack, sock);
|
||||
}
|
||||
--
|
||||
2.33.0
|
||||
|
||||
44
0141-fix-data-flow-error-when-use-NIC-in-kernel.patch
Normal file
44
0141-fix-data-flow-error-when-use-NIC-in-kernel.patch
Normal file
@ -0,0 +1,44 @@
|
||||
From aab5985a79d6002b048e35db7376cdb0e3aa4a1d Mon Sep 17 00:00:00 2001
|
||||
From: kircher <majun65@huawei.com>
|
||||
Date: Wed, 16 Nov 2022 21:47:46 +0800
|
||||
Subject: [PATCH] fix data flow error when use NIC in kernel
|
||||
|
||||
---
|
||||
src/lstack/api/lstack_epoll.c | 8 ++++++--
|
||||
1 file changed, 6 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/src/lstack/api/lstack_epoll.c b/src/lstack/api/lstack_epoll.c
|
||||
index 8d5439b..19dd69a 100644
|
||||
--- a/src/lstack/api/lstack_epoll.c
|
||||
+++ b/src/lstack/api/lstack_epoll.c
|
||||
@@ -456,8 +456,10 @@ int32_t lstack_epoll_wait(int32_t epfd, struct epoll_event* events, int32_t maxe
|
||||
wakeup->stat.app_events += lwip_num;
|
||||
|
||||
if (__atomic_load_n(&wakeup->have_kernel_event, __ATOMIC_ACQUIRE)) {
|
||||
- __atomic_store_n(&wakeup->have_kernel_event, false, __ATOMIC_RELEASE);
|
||||
kernel_num = posix_api->epoll_wait_fn(epfd, &events[lwip_num], maxevents - lwip_num, 0);
|
||||
+ if (!kernel_num) {
|
||||
+ __atomic_store_n(&wakeup->have_kernel_event, false, __ATOMIC_RELEASE);
|
||||
+ }
|
||||
}
|
||||
|
||||
if (lwip_num + kernel_num > 0) {
|
||||
@@ -657,12 +659,14 @@ int32_t lstack_poll(struct pollfd *fds, nfds_t nfds, int32_t timeout)
|
||||
lwip_num = poll_lwip_event(fds, nfds);
|
||||
|
||||
if (__atomic_load_n(&wakeup->have_kernel_event, __ATOMIC_ACQUIRE)) {
|
||||
- __atomic_store_n(&wakeup->have_kernel_event, false, __ATOMIC_RELEASE);
|
||||
kernel_num = posix_api->epoll_wait_fn(wakeup->epollfd, wakeup->events, nfds, 0);
|
||||
for (int32_t i = 0; i < kernel_num; i++) {
|
||||
uint32_t index = wakeup->events[i].data.u32;
|
||||
fds[index].revents = wakeup->events[i].events;
|
||||
}
|
||||
+ if (!kernel_num) {
|
||||
+ __atomic_store_n(&wakeup->have_kernel_event, false, __ATOMIC_RELEASE);
|
||||
+ }
|
||||
}
|
||||
|
||||
if (lwip_num + kernel_num > 0) {
|
||||
--
|
||||
2.33.0
|
||||
|
||||
16
gazelle.spec
16
gazelle.spec
@ -2,7 +2,7 @@
|
||||
|
||||
Name: gazelle
|
||||
Version: 1.0.1
|
||||
Release: 22
|
||||
Release: 23
|
||||
Summary: gazelle is a high performance user-mode stack
|
||||
License: MulanPSL-2.0
|
||||
URL: https://gitee.com/openeuler/gazelle
|
||||
@ -150,6 +150,12 @@ Patch9132: 0132-remove-filename_check-in-gazellectl-to-fix-build-err.patch
|
||||
Patch9133: 0133-cancel-kernel-sock-epoll-ctl-when-lwip-sock-connect.patch
|
||||
Patch9134: 0134-modify-readv-and-writev-first-buf-is-null.patch
|
||||
Patch9135: 0135-fix-pdump-and-mutil-NIC-init-fail.patch
|
||||
Patch9136: 0136-modify-duplicate-code.patch
|
||||
Patch9137: 0137-merge-lstack-rx-tx-mbuf-pool.patch
|
||||
Patch9138: 0138-avoid-send-stop-when-mbuf-pool-empty.patch
|
||||
Patch9139: 0139-fix-pcb-snd_buf-flip.patch
|
||||
Patch9140: 0140-fix-lwip-send-return-0-add-err-event.patch
|
||||
Patch9141: 0141-fix-data-flow-error-when-use-NIC-in-kernel.patch
|
||||
|
||||
%description
|
||||
%{name} is a high performance user-mode stack.
|
||||
@ -190,6 +196,14 @@ install -Dpm 0640 %{_builddir}/%{name}-%{version}/src/ltran/ltran.conf %{b
|
||||
%config(noreplace) %{conf_path}/ltran.conf
|
||||
|
||||
%changelog
|
||||
* Wed Nov 16 2022 kircher <majun65@huawei.com> - 1.0.1-23
|
||||
- modify duplicate code
|
||||
- fix data flow error when use NIC in kernel
|
||||
- fix lwip send return 0 add err event
|
||||
- fix pcb snd_buf flip
|
||||
- avoid send stop when mbuf pool empty
|
||||
- merge lstack rx tx mbuf pool
|
||||
|
||||
* Tue Nov 15 2022 kircher <majun65@huawei.com> - 1.0.1-22
|
||||
- fix pdump and mutil NIC init fail
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user