!922 [sync] PR-896: sync fix issue: create virtio_user based on bond4 main network card

From: @openeuler-sync-bot 
Reviewed-by: @jiangheng12 
Signed-off-by: @jiangheng12
This commit is contained in:
openeuler-ci-bot 2024-08-20 03:12:31 +00:00 committed by Gitee
commit fa3eb4dec2
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
5 changed files with 155 additions and 1 deletions

View File

@ -0,0 +1,41 @@
From 99b72b69ea7ce93077d890829e3db812fa34e2cb Mon Sep 17 00:00:00 2001
From: zhangmengxuan <zhangmengxuan@kylinos.cn>
Date: Wed, 10 Jul 2024 17:23:21 +0800
Subject: [PATCH] dfx: optimize gazellectl -x for bond
---
src/ltran/ltran_dfx.c | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
diff --git a/src/ltran/ltran_dfx.c b/src/ltran/ltran_dfx.c
index 005b09c..5bda330 100644
--- a/src/ltran/ltran_dfx.c
+++ b/src/ltran/ltran_dfx.c
@@ -204,22 +204,19 @@ static void gazelle_print_lstack_xstats(void *buf, const struct gazelle_stat_msg
struct nic_eth_xstats *xstats = &stat->data.nic_xstats;
static const char *nic_stats_border = "########################";
+ printf("###### NIC extended statistics for port %-2d #########\n", xstats->port_id);
if (xstats->bonding.mode >= 0) {
printf("############# NIC bonding mode display #############\n");
printf("%s############################\n", nic_stats_border);
- printf("Bonding mode [%d]\n", xstats->bonding.mode);
+ printf("Bonding mode: [%d]\n", xstats->bonding.mode);
printf("Bonding miimon: [%d]\n", xstats->bonding.miimon);
- printf("Port range: 0->%d; Bonding port is %d\n", xstats->port_id, xstats->port_id);
printf("Slaves(%d): [", xstats->bonding.slave_count);
for (int i = 0; i < xstats->bonding.slave_count - 1; i++) {
printf("%d ", xstats->bonding.slaves[i]);
}
printf("%d]\n", xstats->bonding.slaves[xstats->bonding.slave_count - 1]);
printf("Primary: [%d]\n", xstats->bonding.primary_port_id);
- printf("%s############################\n", nic_stats_border);
}
-
- printf("###### NIC extended statistics for port %-2d #########\n", xstats->port_id);
printf("%s############################\n", nic_stats_border);
if (xstats->len <= 0 || xstats->len > RTE_ETH_XSTATS_MAX_LEN) {
printf("xstats item(%d) num error!\n", xstats->len);
--
2.33.0

View File

@ -0,0 +1,27 @@
From 61b535e5956122e8e07426218b718a05f9ff81b3 Mon Sep 17 00:00:00 2001
From: hkk <hankangkang5@huawei.com>
Date: Thu, 25 Jul 2024 20:20:50 +0800
Subject: [PATCH] virtio: fix dfx error with multiple cpus
---
src/lstack/core/lstack_stack_stat.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/src/lstack/core/lstack_stack_stat.c b/src/lstack/core/lstack_stack_stat.c
index 91ca49a..406e27c 100644
--- a/src/lstack/core/lstack_stack_stat.c
+++ b/src/lstack/core/lstack_stack_stat.c
@@ -413,6 +413,10 @@ int handle_stack_cmd(int fd, struct gazelle_stat_msg_request *msg)
(stat_mode == GAZELLE_STAT_LTRAN_START_LATENCY || stat_mode == GAZELLE_STAT_LTRAN_STOP_LATENCY)) {
continue;
}
+
+ if (i > 0 && stat_mode == GAZELLE_STAT_LSTACK_SHOW_VIRTIO) {
+ break;
+ }
dfx.tid = stack->tid;
dfx.stack_id = i;
--
2.33.0

View File

@ -0,0 +1,42 @@
From 81b3494fbb9a6b346560220bf4b4dc10ae8f9881 Mon Sep 17 00:00:00 2001
From: hkk <hankangkang5@huawei.com>
Date: Wed, 24 Jul 2024 15:30:48 +0800
Subject: [PATCH] fix issue: create virtio_user based on bond4 main network
card
---
src/lstack/core/lstack_dpdk.c | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/src/lstack/core/lstack_dpdk.c b/src/lstack/core/lstack_dpdk.c
index e17242c..50fbdf6 100644
--- a/src/lstack/core/lstack_dpdk.c
+++ b/src/lstack/core/lstack_dpdk.c
@@ -798,6 +798,7 @@ int32_t init_dpdk_ethdev(void)
LSTACK_LOG(ERR, LSTACK, "bond device create failed, ret=%d\n", ret);
return -1;
}
+ port_id = rte_eth_bond_primary_get(get_protocol_stack_group()->port_id);
} else {
port_id = ethdev_port_id(cfg->mac_addr);
if (port_id < 0) {
@@ -818,8 +819,14 @@ int32_t init_dpdk_ethdev(void)
}
}
#endif
- if (get_global_cfg_params()->flow_bifurcation && virtio_port_create(port_id) != 0) {
- return -1;
+ if (cfg->flow_bifurcation) {
+ if (cfg->kni_switch) {
+ LSTACK_LOG(ERR, LSTACK, "flow_bifurcation and kni_switch cannot both be enabled, please check them\n");
+ return -1;
+ }
+ if (virtio_port_create(port_id) != 0) {
+ return -1;
+ }
}
return 0;
--
2.33.0

View File

@ -0,0 +1,34 @@
From c7cb61ee76b78908b5a4a544cd04ea15e497cfe9 Mon Sep 17 00:00:00 2001
From: hkk <hankangkang5@huawei.com>
Date: Tue, 30 Jul 2024 21:11:52 +0800
Subject: [PATCH] virtio_user: modify mbuf index for bond4
---
src/lstack/core/lstack_virtio.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/lstack/core/lstack_virtio.c b/src/lstack/core/lstack_virtio.c
index f907a99..70b025c 100644
--- a/src/lstack/core/lstack_virtio.c
+++ b/src/lstack/core/lstack_virtio.c
@@ -227,7 +227,7 @@ static int virtio_port_init(uint16_t port)
}
for (uint16_t q = 0; q < tx_queue_num; q++) {
- retval = rte_eth_tx_queue_setup(port, q % mbuf_total_num, VIRTIO_TX_RX_RING_SIZE,
+ retval = rte_eth_tx_queue_setup(port, q, VIRTIO_TX_RX_RING_SIZE,
rte_eth_dev_socket_id(port), NULL);
if (retval < 0) {
LSTACK_LOG(ERR, LSTACK, "rte_eth_tx_queue_setup failed (queue %u) retval=%d \n", q, retval);
@@ -236,7 +236,7 @@ static int virtio_port_init(uint16_t port)
}
for (uint16_t q = 0; q < rx_queue_num; q++) {
- struct rte_mempool *rxtx_mbuf_pool = get_protocol_stack_group()->total_rxtx_pktmbuf_pool[q];
+ struct rte_mempool *rxtx_mbuf_pool = get_protocol_stack_group()->total_rxtx_pktmbuf_pool[q % mbuf_total_num];
retval = rte_eth_rx_queue_setup(port, q, VIRTIO_TX_RX_RING_SIZE, rte_eth_dev_socket_id(port),
NULL, rxtx_mbuf_pool);
if (retval < 0) {
--
2.33.0

View File

@ -2,7 +2,7 @@
Name: gazelle
Version: 1.0.2
Release: 52
Release: 53
Summary: gazelle is a high performance user-mode stack
License: MulanPSL-2.0
URL: https://gitee.com/openeuler/gazelle
@ -246,6 +246,10 @@ Patch9226: 0226-support-kernel-connect.patch
Patch9227: 0227-Check-the-return-of-lwip_init.patch
Patch9228: 0228-vitio_user-modify-mbuf-index-for-bond4.patch
Patch9229: 0229-fix-redis-coredump-when-hugetlbs-pagesize-is-1024M.patch
Patch9230: 0230-dfx-optimize-gazellectl-x-for-bond.patch
Patch9231: 0231-virtio-fix-dfx-error-with-multiple-cpus.patch
Patch9232: 0232-fix-issue-create-virtio_user-based-on-bond4-main-net.patch
Patch9233: 0233-virtio_user-modify-mbuf-index-for-bond4.patch
%description
%{name} is a high performance user-mode stack.
@ -287,6 +291,12 @@ install -Dpm 0640 %{_builddir}/%{name}-%{version}/src/ltran/ltran.conf %{b
%config(noreplace) %{conf_path}/ltran.conf
%changelog
* Fri Aug 2 2024 yinbin6 <yinbin8@huawei.com> - 1.0.2-53
- virtio_user: modify mbuf index for bond4
- fix issue: create virtio_user based on bond4 main network card
- virtio: fix dfx error with multiple cpus
- dfx: optimize gazellectl -x for bond
* Thu Jul 25 2024 yangchen555 <yangchen145@huawei.com> - 1.0.2-52
- fix redis coredump when hugetlbs pagesize is 1024M
- vitio_user: modify mbuf index for bond4