From: Huisong Li <lihuisong@huawei.com>
To: <stable@dpdk.org>, <ktraynor@redhat.com>
Cc: <liudongdong3@huawei.com>, <huangdaode@huawei.com>,
<liuyonglong@huawei.com>, <lihuisong@huawei.com>
Subject: [PATCH 21.11 01/17] net/hns3: separate Tx prepare from getting Tx function
Date: Tue, 21 Mar 2023 17:22:50 +0800 [thread overview]
Message-ID: <20230321092306.16918-2-lihuisong@huawei.com> (raw)
In-Reply-To: <20230321092306.16918-1-lihuisong@huawei.com>
[ upstream commit 6a934ba4c6c48691b119a878981a4e3748766518 ]
Separate getting tx prepare from hns3_get_tx_function by extracting
an independent function.
Fixes: d7ec2c076579 ("net/hns3: select Tx prepare based on Tx offload")
Signed-off-by: Huisong Li <lihuisong@huawei.com>
Signed-off-by: Dongdong Liu <liudongdong3@huawei.com>
---
drivers/net/hns3/hns3_rxtx.c | 32 ++++++++++++++------------------
drivers/net/hns3/hns3_rxtx.h | 3 +--
2 files changed, 15 insertions(+), 20 deletions(-)
diff --git a/drivers/net/hns3/hns3_rxtx.c b/drivers/net/hns3/hns3_rxtx.c
index 5c7de80e7b..18f96f3055 100644
--- a/drivers/net/hns3/hns3_rxtx.c
+++ b/drivers/net/hns3/hns3_rxtx.c
@@ -4327,26 +4327,30 @@ hns3_get_tx_prep_needed(struct rte_eth_dev *dev)
RTE_ETH_TX_OFFLOAD_GENEVE_TNL_TSO)
uint64_t tx_offload = dev->data->dev_conf.txmode.offloads;
+
if (tx_offload & HNS3_DEV_TX_CSKUM_TSO_OFFLOAD_MASK)
return true;
return false;
}
+static eth_tx_prep_t
+hns3_get_tx_prepare(struct rte_eth_dev *dev)
+{
+ return hns3_get_tx_prep_needed(dev) ? hns3_prep_pkts : NULL;
+}
+
eth_tx_burst_t
-hns3_get_tx_function(struct rte_eth_dev *dev, eth_tx_prep_t *prep)
+hns3_get_tx_function(struct rte_eth_dev *dev)
{
struct hns3_adapter *hns = dev->data->dev_private;
bool vec_allowed, sve_allowed, simple_allowed;
- bool vec_support, tx_prepare_needed;
+ bool vec_support;
vec_support = hns3_tx_check_vec_support(dev) == 0;
vec_allowed = vec_support && hns3_get_default_vec_support();
sve_allowed = vec_support && hns3_get_sve_support();
simple_allowed = hns3_tx_check_simple_support(dev);
- tx_prepare_needed = hns3_get_tx_prep_needed(dev);
-
- *prep = NULL;
if (hns->tx_func_hint == HNS3_IO_FUNC_HINT_VEC && vec_allowed)
return hns3_xmit_pkts_vec;
@@ -4354,19 +4358,14 @@ hns3_get_tx_function(struct rte_eth_dev *dev, eth_tx_prep_t *prep)
return hns3_xmit_pkts_vec_sve;
if (hns->tx_func_hint == HNS3_IO_FUNC_HINT_SIMPLE && simple_allowed)
return hns3_xmit_pkts_simple;
- if (hns->tx_func_hint == HNS3_IO_FUNC_HINT_COMMON) {
- if (tx_prepare_needed)
- *prep = hns3_prep_pkts;
+ if (hns->tx_func_hint == HNS3_IO_FUNC_HINT_COMMON)
return hns3_xmit_pkts;
- }
if (vec_allowed)
return hns3_xmit_pkts_vec;
if (simple_allowed)
return hns3_xmit_pkts_simple;
- if (tx_prepare_needed)
- *prep = hns3_prep_pkts;
return hns3_xmit_pkts;
}
@@ -4414,7 +4413,6 @@ hns3_set_rxtx_function(struct rte_eth_dev *eth_dev)
{
struct hns3_hw *hw = HNS3_DEV_PRIVATE_TO_HW(eth_dev->data->dev_private);
struct hns3_adapter *hns = eth_dev->data->dev_private;
- eth_tx_prep_t prep = NULL;
if (hns->hw.adapter_state == HNS3_NIC_STARTED &&
__atomic_load_n(&hns->hw.reset.resetting, __ATOMIC_RELAXED) == 0) {
@@ -4422,8 +4420,8 @@ hns3_set_rxtx_function(struct rte_eth_dev *eth_dev)
eth_dev->rx_descriptor_status = hns3_dev_rx_descriptor_status;
eth_dev->tx_pkt_burst = hw->set_link_down ?
hns3_dummy_rxtx_burst :
- hns3_get_tx_function(eth_dev, &prep);
- eth_dev->tx_pkt_prepare = prep;
+ hns3_get_tx_function(eth_dev);
+ eth_dev->tx_pkt_prepare = hns3_get_tx_prepare(eth_dev);
eth_dev->tx_descriptor_status = hns3_dev_tx_descriptor_status;
} else {
eth_dev->rx_pkt_burst = hns3_dummy_rxtx_burst;
@@ -4769,10 +4767,8 @@ hns3_stop_tx_datapath(struct rte_eth_dev *dev)
void
hns3_start_tx_datapath(struct rte_eth_dev *dev)
{
- eth_tx_prep_t prep = NULL;
-
- dev->tx_pkt_burst = hns3_get_tx_function(dev, &prep);
- dev->tx_pkt_prepare = prep;
+ dev->tx_pkt_burst = hns3_get_tx_function(dev);
+ dev->tx_pkt_prepare = hns3_get_tx_prepare(dev);
hns3_eth_dev_fp_ops_config(dev);
if (rte_eal_process_type() == RTE_PROC_SECONDARY)
diff --git a/drivers/net/hns3/hns3_rxtx.h b/drivers/net/hns3/hns3_rxtx.h
index 0e412d07b3..b24a0f31bb 100644
--- a/drivers/net/hns3/hns3_rxtx.h
+++ b/drivers/net/hns3/hns3_rxtx.h
@@ -729,8 +729,7 @@ int hns3_tx_burst_mode_get(struct rte_eth_dev *dev,
const uint32_t *hns3_dev_supported_ptypes_get(struct rte_eth_dev *dev);
void hns3_init_rx_ptype_tble(struct rte_eth_dev *dev);
void hns3_set_rxtx_function(struct rte_eth_dev *eth_dev);
-eth_tx_burst_t hns3_get_tx_function(struct rte_eth_dev *dev,
- eth_tx_prep_t *prep);
+eth_tx_burst_t hns3_get_tx_function(struct rte_eth_dev *dev);
uint16_t hns3_dummy_rxtx_burst(void *dpdk_txq __rte_unused,
struct rte_mbuf **pkts __rte_unused,
uint16_t pkts_n __rte_unused);
--
2.22.0
next prev parent reply other threads:[~2023-03-21 9:24 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-21 9:22 [PATCH 21.11 00/17] backport some patches for hns3 Huisong Li
2023-03-21 9:22 ` Huisong Li [this message]
2023-03-21 9:22 ` [PATCH 21.11 02/17] net/hns3: make getting Tx function static Huisong Li
2023-03-21 9:22 ` [PATCH 21.11 03/17] net/hns3: fix RSS key size compatibility Huisong Li
2023-03-21 9:22 ` [PATCH 21.11 04/17] net/hns3: fix burst mode query with dummy function Huisong Li
2023-03-21 9:22 ` [PATCH 21.11 05/17] net/hns3: extract common functions to set Rx/Tx Huisong Li
2023-03-21 9:22 ` [PATCH 21.11 06/17] net/hns3: use hardware config to report hash key Huisong Li
2023-03-21 9:22 ` [PATCH 21.11 07/17] net/hns3: use hardware config to report hash types Huisong Li
2023-03-21 9:22 ` [PATCH 21.11 08/17] net/hns3: separate setting hash algorithm Huisong Li
2023-03-21 9:22 ` [PATCH 21.11 09/17] net/hns3: separate setting hash key Huisong Li
2023-03-21 9:22 ` [PATCH 21.11 10/17] net/hns3: separate setting RSS types Huisong Li
2023-03-21 9:23 ` [PATCH 21.11 11/17] net/hns3: use new RSS rule to configure hardware Huisong Li
2023-03-21 9:23 ` [PATCH 21.11 12/17] net/hns3: save hash algo to RSS filter list node Huisong Li
2023-03-21 9:23 ` [PATCH 21.11 13/17] net/hns3: remove unused structures Huisong Li
2023-03-21 9:23 ` [PATCH 21.11 14/17] net/hns3: allow adding queue buffer size hash rule Huisong Li
2023-03-21 9:23 ` [PATCH 21.11 15/17] net/hns3: separate flow RSS config from RSS conf Huisong Li
2023-03-21 9:23 ` [PATCH 21.11 16/17] net/hns3: reimplement hash flow function Huisong Li
2023-03-21 9:23 ` [PATCH 21.11 17/17] net/hns3: add verification of RSS types Huisong Li
2023-03-21 16:21 ` [PATCH 21.11 00/17] backport some patches for hns3 Kevin Traynor
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230321092306.16918-2-lihuisong@huawei.com \
--to=lihuisong@huawei.com \
--cc=huangdaode@huawei.com \
--cc=ktraynor@redhat.com \
--cc=liudongdong3@huawei.com \
--cc=liuyonglong@huawei.com \
--cc=stable@dpdk.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).