!290 [sync] PR-287: sync eneble TSO and fix TSO mbuf pktlen error

From: @openeuler-sync-bot 
Reviewed-by: @jiangheng12 
Signed-off-by: @jiangheng12
This commit is contained in:
openeuler-ci-bot 2023-02-22 13:14:17 +00:00 committed by Gitee
commit 8672413072
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
3 changed files with 133 additions and 1 deletions

View File

@ -0,0 +1,34 @@
From 9fd7ce8ede4f5fcb730137d2593bfb8f470fad56 Mon Sep 17 00:00:00 2001
From: kircher <majun65@huawei.com>
Date: Tue, 21 Feb 2023 17:08:29 +0800
Subject: [PATCH] check and fix wakeup_list when null appears
---
src/lstack/api/lstack_epoll.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/src/lstack/api/lstack_epoll.c b/src/lstack/api/lstack_epoll.c
index 7860163..da29590 100644
--- a/src/lstack/api/lstack_epoll.c
+++ b/src/lstack/api/lstack_epoll.c
@@ -84,6 +84,17 @@ void wakeup_stack_epoll(struct protocol_stack *stack, bool wakeup_thread_enable)
struct list_node *node, *temp;
list_for_each_safe(node, temp, &stack->wakeup_list) {
+ /* When temp is NULL, find the tail node in the wekeup_list and connect it to the back of the node */
+ if (unlikely(temp == NULL)) {
+ struct list_node *nod = &stack->wakeup_list;
+ while (nod->prev && nod->prev != node) {
+ nod = nod->prev;
+ }
+ nod->prev = node;
+ node->next = nod;
+ temp = nod;
+ }
+
struct wakeup_poll *wakeup = container_of((node - stack->queue_id), struct wakeup_poll, wakeup_list);
if (!wakeup_thread_enable) {
--
2.33.0

View File

@ -0,0 +1,92 @@
From e0d447225bc208962e567385cd078aa51bbbe3f1 Mon Sep 17 00:00:00 2001
From: kircher <majun65@huawei.com>
Date: Tue, 21 Feb 2023 14:19:04 +0800
Subject: [PATCH] eneble TSO and fix TSO mbuf pktlen error
---
src/common/dpdk_common.c | 10 +++++-----
src/lstack/netif/lstack_ethdev.c | 14 +++++++-------
2 files changed, 12 insertions(+), 12 deletions(-)
diff --git a/src/common/dpdk_common.c b/src/common/dpdk_common.c
index 89f7dfa..2938a25 100644
--- a/src/common/dpdk_common.c
+++ b/src/common/dpdk_common.c
@@ -118,11 +118,6 @@ void eth_params_checksum(struct rte_eth_conf *conf, struct rte_eth_dev_info *dev
COMMON_INFO("DEV_TX_OFFLOAD_TCP_CKSUM\n");
}
- //if (tx_ol_capa & DEV_TX_OFFLOAD_TCP_TSO) {
- // tx_ol |= (DEV_TX_OFFLOAD_TCP_TSO | DEV_TX_OFFLOAD_MULTI_SEGS);
- // COMMON_INFO("DEV_TX_OFFLOAD_TCP_TSO\n");
- //}
-
if (!(rx_ol & DEV_RX_OFFLOAD_TCP_CKSUM) || !(rx_ol & DEV_RX_OFFLOAD_IPV4_CKSUM)) {
rx_ol = 0;
}
@@ -130,6 +125,11 @@ void eth_params_checksum(struct rte_eth_conf *conf, struct rte_eth_dev_info *dev
tx_ol = 0;
}
+ if (tx_ol_capa & DEV_TX_OFFLOAD_TCP_TSO) {
+ tx_ol |= (DEV_TX_OFFLOAD_TCP_TSO | DEV_TX_OFFLOAD_MULTI_SEGS);
+ COMMON_INFO("DEV_TX_OFFLOAD_TCP_TSO\n");
+ }
+
conf->rxmode.offloads = rx_ol;
conf->txmode.offloads = tx_ol;
diff --git a/src/lstack/netif/lstack_ethdev.c b/src/lstack/netif/lstack_ethdev.c
index 4426b1a..db353f9 100644
--- a/src/lstack/netif/lstack_ethdev.c
+++ b/src/lstack/netif/lstack_ethdev.c
@@ -167,7 +167,11 @@ static err_t eth_dev_output(struct netif *netif, struct pbuf *pbuf)
struct protocol_stack *stack = get_protocol_stack();
struct rte_mbuf *pre_mbuf = NULL;
struct rte_mbuf *first_mbuf = NULL;
- struct pbuf *first_pbuf = NULL;
+ struct pbuf *first_pbuf = pbuf;
+ uint16_t header_len = 0;
+ if (likely(first_pbuf != NULL)) {
+ header_len = first_pbuf->l2_len + first_pbuf->l3_len + first_pbuf->l4_len;
+ }
while (likely(pbuf != NULL)) {
struct rte_mbuf *mbuf = pbuf_to_mbuf(pbuf);
@@ -175,20 +179,20 @@ static err_t eth_dev_output(struct netif *netif, struct pbuf *pbuf)
mbuf->data_len = pbuf->len;
mbuf->pkt_len = pbuf->tot_len;
mbuf->ol_flags = pbuf->ol_flags;
+ mbuf->next = NULL;
if (first_mbuf == NULL) {
first_mbuf = mbuf;
first_pbuf = pbuf;
first_mbuf->nb_segs = 1;
if (pbuf->header_off > 0) {
- mbuf->data_off -= first_pbuf->l2_len + first_pbuf->l3_len + first_pbuf->l4_len;
+ mbuf->data_off -= header_len;
pbuf->header_off = 0;
}
} else {
first_mbuf->nb_segs++;
pre_mbuf->next = mbuf;
if (pbuf->header_off == 0) {
- uint16_t header_len = first_pbuf->l2_len + first_pbuf->l3_len + first_pbuf->l4_len;
mbuf->data_off += header_len;
pbuf->header_off = header_len;
}
@@ -204,10 +208,6 @@ static err_t eth_dev_output(struct netif *netif, struct pbuf *pbuf)
pre_mbuf = mbuf;
rte_mbuf_refcnt_update(mbuf, 1);
- if (pbuf->rexmit) {
- mbuf->next = NULL;
- break;
- }
pbuf->rexmit = 1;
pbuf = pbuf->next;
}
--
2.33.0

View File

@ -2,7 +2,7 @@
Name: gazelle
Version: 1.0.1
Release: 48
Release: 49
Summary: gazelle is a high performance user-mode stack
License: MulanPSL-2.0
URL: https://gitee.com/openeuler/gazelle
@ -207,6 +207,8 @@ Patch9189: 0189-fix-coredump-in-example-server-mum-mode.patch
Patch9190: 0190-bring-up-kni-when-init.patch
Patch9191: 0191-change-mbuf_pool_size-in-lstack.conf-to-tcp_conn_cou.patch
Patch9192: 0192-fix-build-error-in-lstack.patch
Patch9193: 0193-check-and-fix-wakeup_list-when-null-appears.patch
Patch9194: 0194-eneble-TSO-and-fix-TSO-mbuf-pktlen-error.patch
%description
%{name} is a high performance user-mode stack.
@ -247,6 +249,10 @@ install -Dpm 0640 %{_builddir}/%{name}-%{version}/src/ltran/ltran.conf %{b
%config(noreplace) %{conf_path}/ltran.conf
%changelog
* Wed Feb 22 2023 kircher <majun65@huawei.com> - 1.0.1-49
- eneble TSO and fix TSO mbuf pktlen error
- check and fix wakeup_list when null appears
* Mon Feb 13 2023 net <jiangheng14@huawei.com> - 1.0.1-48
- change mbuf_pool_size in lstack.conf to tcp_conn_count * mbuf_count_per_conn
- bring up kni when init