!209 [sync] PR-206: remove mbuf reserve in mbuf alloc
From: @openeuler-sync-bot Reviewed-by: @jiangheng12 Signed-off-by: @jiangheng12
This commit is contained in:
commit
41755ad768
94
0162-remove-mbuf-reserve-in-mbuf-alloc.patch
Normal file
94
0162-remove-mbuf-reserve-in-mbuf-alloc.patch
Normal file
@ -0,0 +1,94 @@
|
||||
From aacafde3598f8e9ec4e9fd13a17ce9d0a23c3fe5 Mon Sep 17 00:00:00 2001
|
||||
From: jiangheng <jiangheng14@huawei.com>
|
||||
Date: Sat, 17 Dec 2022 20:33:16 +0800
|
||||
Subject: [PATCH] remove mbuf reserve in mbuf alloc
|
||||
|
||||
---
|
||||
src/lstack/core/lstack_dpdk.c | 9 ---------
|
||||
src/lstack/core/lstack_lwip.c | 10 +++++-----
|
||||
src/lstack/include/lstack_dpdk.h | 1 -
|
||||
3 files changed, 5 insertions(+), 15 deletions(-)
|
||||
|
||||
diff --git a/src/lstack/core/lstack_dpdk.c b/src/lstack/core/lstack_dpdk.c
|
||||
index 4be31c3..76ebe96 100644
|
||||
--- a/src/lstack/core/lstack_dpdk.c
|
||||
+++ b/src/lstack/core/lstack_dpdk.c
|
||||
@@ -194,15 +194,6 @@ int32_t pktmbuf_pool_init(struct protocol_stack *stack, uint16_t stack_num)
|
||||
return 0;
|
||||
}
|
||||
|
||||
-int32_t gazelle_alloc_mbuf_with_reserve(struct rte_mempool *pool, struct rte_mbuf **mbufs, unsigned count)
|
||||
-{
|
||||
- if (rte_mempool_avail_count(pool) < RESERVE_NIC_RECV) {
|
||||
- return -1;
|
||||
- }
|
||||
-
|
||||
- return rte_pktmbuf_alloc_bulk(pool, mbufs, count);
|
||||
-}
|
||||
-
|
||||
struct rte_ring *create_ring(const char *name, uint32_t count, uint32_t flags, int32_t queue_id)
|
||||
{
|
||||
char ring_name[RTE_RING_NAMESIZE] = {0};
|
||||
diff --git a/src/lstack/core/lstack_lwip.c b/src/lstack/core/lstack_lwip.c
|
||||
index d4e2d9c..c04ed27 100644
|
||||
--- a/src/lstack/core/lstack_lwip.c
|
||||
+++ b/src/lstack/core/lstack_lwip.c
|
||||
@@ -134,7 +134,7 @@ static bool replenish_send_idlembuf(struct protocol_stack *stack, struct rte_rin
|
||||
return false;
|
||||
}
|
||||
|
||||
- if (gazelle_alloc_mbuf_with_reserve(stack->rxtx_pktmbuf_pool, (struct rte_mbuf **)pbuf, replenish_cnt) != 0) {
|
||||
+ if (rte_pktmbuf_alloc_bulk(stack->rxtx_pktmbuf_pool, (struct rte_mbuf **)pbuf, replenish_cnt) != 0) {
|
||||
stack->stats.tx_allocmbuf_fail++;
|
||||
return true;
|
||||
}
|
||||
@@ -225,7 +225,7 @@ int32_t gazelle_alloc_pktmbuf(struct rte_mempool *pool, struct rte_mbuf **mbufs,
|
||||
{
|
||||
struct pbuf_custom *pbuf_custom = NULL;
|
||||
|
||||
- int32_t ret = gazelle_alloc_mbuf_with_reserve(pool, mbufs, num);
|
||||
+ int32_t ret = rte_pktmbuf_alloc_bulk(pool, mbufs, num);
|
||||
if (ret != 0) {
|
||||
return ret;
|
||||
}
|
||||
@@ -243,7 +243,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 (gazelle_alloc_mbuf_with_reserve(stack->rxtx_pktmbuf_pool, &mbuf, 1) != 0) {
|
||||
+ if (rte_pktmbuf_alloc_bulk(stack->rxtx_pktmbuf_pool, &mbuf, 1) != 0) {
|
||||
stack->stats.tx_allocmbuf_fail++;
|
||||
return NULL;
|
||||
}
|
||||
@@ -353,7 +353,7 @@ static inline ssize_t app_direct_write(struct protocol_stack *stack, struct lwip
|
||||
}
|
||||
|
||||
/* first pbuf get from send_ring. and malloc pbufs attach to first pbuf */
|
||||
- if (gazelle_alloc_mbuf_with_reserve(stack->rxtx_pktmbuf_pool, (struct rte_mbuf **)&pbufs[1], write_num - 1) != 0) {
|
||||
+ if (rte_pktmbuf_alloc_bulk(stack->rxtx_pktmbuf_pool, (struct rte_mbuf **)&pbufs[1], write_num - 1) != 0) {
|
||||
stack->stats.tx_allocmbuf_fail++;
|
||||
free(pbufs);
|
||||
return 0;
|
||||
@@ -389,7 +389,7 @@ static inline ssize_t app_direct_attach(struct protocol_stack *stack, struct pbu
|
||||
}
|
||||
|
||||
/* first pbuf get from send_ring. and malloc pbufs attach to first pbuf */
|
||||
- if (gazelle_alloc_mbuf_with_reserve(stack->rxtx_pktmbuf_pool, (struct rte_mbuf **)pbufs, write_num) != 0) {
|
||||
+ if (rte_pktmbuf_alloc_bulk(stack->rxtx_pktmbuf_pool, (struct rte_mbuf **)pbufs, write_num) != 0) {
|
||||
stack->stats.tx_allocmbuf_fail++;
|
||||
free(pbufs);
|
||||
return 0;
|
||||
diff --git a/src/lstack/include/lstack_dpdk.h b/src/lstack/include/lstack_dpdk.h
|
||||
index a0f09af..c3bc527 100644
|
||||
--- a/src/lstack/include/lstack_dpdk.h
|
||||
+++ b/src/lstack/include/lstack_dpdk.h
|
||||
@@ -51,6 +51,5 @@ void dpdk_skip_nic_init(void);
|
||||
int32_t dpdk_init_lstack_kni(void);
|
||||
void dpdk_restore_pci(void);
|
||||
bool port_in_stack_queue(uint32_t src_ip, uint32_t dst_ip, uint16_t src_port, uint16_t dst_port);
|
||||
-int32_t gazelle_alloc_mbuf_with_reserve(struct rte_mempool *pool, struct rte_mbuf **mbufs, unsigned count);
|
||||
|
||||
#endif /* GAZELLE_DPDK_H */
|
||||
--
|
||||
2.23.0
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
|
||||
Name: gazelle
|
||||
Version: 1.0.1
|
||||
Release: 35
|
||||
Release: 36
|
||||
Summary: gazelle is a high performance user-mode stack
|
||||
License: MulanPSL-2.0
|
||||
URL: https://gitee.com/openeuler/gazelle
|
||||
@ -176,6 +176,7 @@ Patch9158: 0158-add-RXTX_NB_MBUF_MAX-to-limit-mbuf_pool_size-to-its-.patch
|
||||
Patch9159: 0159-stack-thread-params-default-val.patch
|
||||
Patch9160: 0160-optimite-net-type.patch
|
||||
Patch9161: 0161-app-bind-numa-when-epoll-poll-create.patch
|
||||
Patch9162: 0162-remove-mbuf-reserve-in-mbuf-alloc.patch
|
||||
|
||||
%description
|
||||
%{name} is a high performance user-mode stack.
|
||||
@ -216,6 +217,9 @@ install -Dpm 0640 %{_builddir}/%{name}-%{version}/src/ltran/ltran.conf %{b
|
||||
%config(noreplace) %{conf_path}/ltran.conf
|
||||
|
||||
%changelog
|
||||
* Sat Dec 17 2022 jiangheng <jiangheng14@huawei.com> - 1.0.1-36
|
||||
- remove mbuf reserve in mbuf alloc
|
||||
|
||||
* Sat Dec 17 2022 jiangheng <jiangheng14@huawei.com> - 1.0.1-35
|
||||
- optimite net type
|
||||
app bind numa when epoll/poll create
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user