gazelle/0194-eneble-TSO-and-fix-TSO-mbuf-pktlen-error.patch
kircher f6de817ffb sync eneble TSO and fix TSO mbuf pktlen error
(cherry picked from commit 0fc3494b9c57beb387a3301c0b92c9cef6e454b4)
2023-02-22 16:34:27 +08:00

93 lines
3.3 KiB
Diff

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