!806 [sync] PR-801: sync memary error: fix some memary error

From: @openeuler-sync-bot 
Reviewed-by: @jiangheng12 
Signed-off-by: @jiangheng12
This commit is contained in:
openeuler-ci-bot 2024-05-24 08:55:03 +00:00 committed by Gitee
commit 039fdbaf5d
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
3 changed files with 139 additions and 1 deletions

View File

@ -0,0 +1,87 @@
From f9872991239cc4ddcd9b3c706cf135cdbea28a48 Mon Sep 17 00:00:00 2001
From: ningjin <ningjin@kylinos.cn>
Date: Tue, 21 May 2024 10:23:49 +0800
Subject: [PATCH] change gazelle_stat_lstack_proto from u16 to u64
---
src/common/gazelle_dfx_msg.h | 32 ++++++++++++++++----------------
src/ltran/ltran_dfx.c | 20 ++++++++++----------
2 files changed, 26 insertions(+), 26 deletions(-)
diff --git a/src/common/gazelle_dfx_msg.h b/src/common/gazelle_dfx_msg.h
index 9f88203..cad7978 100644
--- a/src/common/gazelle_dfx_msg.h
+++ b/src/common/gazelle_dfx_msg.h
@@ -204,22 +204,22 @@ struct gazelle_stat_lstack_snmp {
/* same as define in lwip/stats.h - struct stats_proto */
struct gazelle_stat_lstack_proto {
/* data */
- uint16_t xmit; /* Transmitted packets. */
- uint16_t recv; /* Received packets. */
- uint16_t tx_in; /* Transmitted in packets. */
- uint16_t tx_out; /* Transmitted out packets. */
- uint16_t rx_in; /* Received in packets. */
- uint16_t rx_out; /* Received out packets. */
- uint16_t fw; /* Forwarded packets. */
- uint16_t drop; /* Dropped packets. */
- uint16_t chkerr; /* Checksum error. */
- uint16_t lenerr; /* Invalid length error. */
- uint16_t memerr; /* Out of memory error. */
- uint16_t rterr; /* Routing error. */
- uint16_t proterr; /* Protocol error. */
- uint16_t opterr; /* Error in options. */
- uint16_t err; /* Misc error. */
- uint16_t cachehit;
+ uint64_t xmit; /* Transmitted packets. */
+ uint64_t recv; /* Received packets. */
+ uint64_t tx_in; /* Transmitted in packets. */
+ uint64_t tx_out; /* Transmitted out packets. */
+ uint64_t rx_in; /* Received in packets. */
+ uint64_t rx_out; /* Received out packets. */
+ uint64_t fw; /* Forwarded packets. */
+ uint64_t drop; /* Dropped packets. */
+ uint64_t chkerr; /* Checksum error. */
+ uint64_t lenerr; /* Invalid length error. */
+ uint64_t memerr; /* Out of memory error. */
+ uint64_t rterr; /* Routing error. */
+ uint64_t proterr; /* Protocol error. */
+ uint64_t opterr; /* Error in options. */
+ uint64_t err; /* Misc error. */
+ uint64_t cachehit;
};
diff --git a/src/ltran/ltran_dfx.c b/src/ltran/ltran_dfx.c
index aa08f25..319f7cd 100644
--- a/src/ltran/ltran_dfx.c
+++ b/src/ltran/ltran_dfx.c
@@ -1115,16 +1115,16 @@ static void gazelle_print_lstack_stat_proto_core(const struct gazelle_stack_dfx_
const struct gazelle_stat_lstack_proto *proto)
{
printf("\n------ stack tid: %6u ------\n", stat->tid);
- printf("tx_in: %u\n", proto->tx_in);
- printf("tx_out: %u\n", proto->tx_out);
- printf("rx_in: %u\n", proto->rx_in);
- printf("rx_out: %u\n", proto->rx_out);
- printf("fw: %u\n", proto->fw);
- printf("drop: %u\n", proto->drop);
- printf("chkerr: %u\n", proto->chkerr);
- printf("lenerr: %u\n", proto->lenerr);
- printf("memerr: %u\n", proto->memerr);
- printf("rterr: %u\n", proto->rterr);
+ printf("tx_in: %lu\n", proto->tx_in);
+ printf("tx_out: %lu\n", proto->tx_out);
+ printf("rx_in: %lu\n", proto->rx_in);
+ printf("rx_out: %lu\n", proto->rx_out);
+ printf("fw: %lu\n", proto->fw);
+ printf("drop: %lu\n", proto->drop);
+ printf("chkerr: %lu\n", proto->chkerr);
+ printf("lenerr: %lu\n", proto->lenerr);
+ printf("memerr: %lu\n", proto->memerr);
+ printf("rterr: %lu\n", proto->rterr);
}
static void gazelle_print_lstack_stat_snmp(void *buf, const struct gazelle_stat_msg_request *req_msg)
--
2.33.0

View File

@ -0,0 +1,45 @@
From 7b859a1e3dbb8ed719035942040a581982d71508 Mon Sep 17 00:00:00 2001
From: yinbin6 <yinbin8@huawei.com>
Date: Sat, 18 May 2024 17:27:35 +0800
Subject: [PATCH] memary error: fix some memary error
---
src/lstack/core/lstack_protocol_stack.c | 3 ++-
src/lstack/netif/lstack_flow.c | 4 ++++
2 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/src/lstack/core/lstack_protocol_stack.c b/src/lstack/core/lstack_protocol_stack.c
index 892c16d..c5a265e 100644
--- a/src/lstack/core/lstack_protocol_stack.c
+++ b/src/lstack/core/lstack_protocol_stack.c
@@ -626,10 +626,11 @@ int32_t stack_setup_app_thread(void)
if (stack_thread_init(t_params) == NULL) {
LSTACK_LOG(INFO, LSTACK, "stack setup failed in app thread\n");
+ free(t_params);
return -1;
}
atomic_fetch_add(&g_stack_group.stack_num, 1);
-
+ free(t_params);
return 0;
}
diff --git a/src/lstack/netif/lstack_flow.c b/src/lstack/netif/lstack_flow.c
index 4e04209..9e8792c 100644
--- a/src/lstack/netif/lstack_flow.c
+++ b/src/lstack/netif/lstack_flow.c
@@ -84,6 +84,10 @@ static void add_rule(char* rule_key, struct rte_flow *flow)
HASH_FIND_STR(g_flow_rules, rule_key, rule);
if (rule == NULL) {
rule = (struct flow_rule*)malloc(sizeof(struct flow_rule));
+ if (rule == NULL) {
+ LSTACK_LOG(ERR, LSTACK, "flow rule add failed. \n");
+ return;
+ }
strcpy_s(rule->rule_key, RULE_KEY_LEN, rule_key);
HASH_ADD_STR(g_flow_rules, rule_key, rule);
}
--
2.33.0

View File

@ -2,7 +2,7 @@
Name: gazelle
Version: 1.0.2
Release: 37
Release: 38
Summary: gazelle is a high performance user-mode stack
License: MulanPSL-2.0
URL: https://gitee.com/openeuler/gazelle
@ -196,6 +196,8 @@ Patch9176: 0176-CFG-fix-multicast-IP-assert-error.patch
Patch9177: 0177-fix-mbuf-leak-in-dpdk-23.11-due-to-kni-removed.patch
Patch9178: 0178-add-riscv64-support.patch
Patch9179: 0179-dfx-fix-gazellectl-x-for-bond.patch
Patch9180: 0180-change-gazelle_stat_lstack_proto-from-u16-to-u64.patch
Patch9181: 0181-memary-error-fix-some-memary-error.patch
%description
%{name} is a high performance user-mode stack.
@ -237,6 +239,10 @@ install -Dpm 0640 %{_builddir}/%{name}-%{version}/src/ltran/ltran.conf %{b
%config(noreplace) %{conf_path}/ltran.conf
%changelog
* Fri May 24 2024 yinbin6 <yinbin8@huawei.com> - 1.0.2-38
- memary error: fix some memary error
- change gazelle_stat_lstack_proto from u16 to u64
* Thu May 16 2024 yinbin6 <yinbin8@huawei.com> - 1.0.2-37
- dfx: fix gazellectl -x for bond