sync to master branch
sync patches ranges from versoin 9 t0 17 from master branch Signed-off-by: speech_white <humin29@huawei.com>
This commit is contained in:
parent
a30e3534f2
commit
1c77287214
188
0215-net-hns3-add-start-stop-Tx-datapath-request-for-MP.patch
Normal file
188
0215-net-hns3-add-start-stop-Tx-datapath-request-for-MP.patch
Normal file
@ -0,0 +1,188 @@
|
||||
From 15c150affb3d486df5e7a4ab55e3ed1cdf8504ef Mon Sep 17 00:00:00 2001
|
||||
From: Huisong Li <lihuisong@huawei.com>
|
||||
Date: Mon, 26 Jul 2021 18:59:39 +0800
|
||||
Subject: [PATCH] net/hns3: add start/stop Tx datapath request for MP
|
||||
|
||||
Currently, hns3 PMD has supported start/stop RxTx datapath request message
|
||||
between the primary and secondary processes. However, there are some cases
|
||||
only to start/stop Tx datapath. This patch adds start/stop Tx datapath
|
||||
request for MP.
|
||||
|
||||
Signed-off-by: Huisong Li <lihuisong@huawei.com>
|
||||
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
|
||||
---
|
||||
drivers/net/hns3/hns3_ethdev.h | 4 +++-
|
||||
drivers/net/hns3/hns3_mp.c | 50 ++++++++++++++++++++++++++++++++++--------
|
||||
drivers/net/hns3/hns3_mp.h | 3 +++
|
||||
drivers/net/hns3/hns3_rxtx.c | 4 ++--
|
||||
drivers/net/hns3/hns3_rxtx.h | 6 +++++
|
||||
5 files changed, 55 insertions(+), 12 deletions(-)
|
||||
|
||||
diff --git a/drivers/net/hns3/hns3_ethdev.h b/drivers/net/hns3/hns3_ethdev.h
|
||||
index 8e66d9f..2e48ff6 100644
|
||||
--- a/drivers/net/hns3/hns3_ethdev.h
|
||||
+++ b/drivers/net/hns3/hns3_ethdev.h
|
||||
@@ -699,7 +699,9 @@ struct hns3_vtag_cfg {
|
||||
/* Request types for IPC. */
|
||||
enum hns3_mp_req_type {
|
||||
HNS3_MP_REQ_START_RXTX = 1,
|
||||
- HNS3_MP_REQ_STOP_RXTX,
|
||||
+ HNS3_MP_REQ_STOP_RXTX = 2,
|
||||
+ HNS3_MP_REQ_START_TX = 3,
|
||||
+ HNS3_MP_REQ_STOP_TX = 4,
|
||||
HNS3_MP_REQ_MAX
|
||||
};
|
||||
|
||||
diff --git a/drivers/net/hns3/hns3_mp.c b/drivers/net/hns3/hns3_mp.c
|
||||
index a8485f5..cd514ac 100644
|
||||
--- a/drivers/net/hns3/hns3_mp.c
|
||||
+++ b/drivers/net/hns3/hns3_mp.c
|
||||
@@ -73,6 +73,7 @@ mp_secondary_handle(const struct rte_mp_msg *mp_msg, const void *peer)
|
||||
struct hns3_mp_param *res = (struct hns3_mp_param *)mp_res.param;
|
||||
const struct hns3_mp_param *param =
|
||||
(const struct hns3_mp_param *)mp_msg->param;
|
||||
+ eth_tx_prep_t prep = NULL;
|
||||
struct rte_eth_dev *dev;
|
||||
int ret;
|
||||
|
||||
@@ -87,19 +88,23 @@ mp_secondary_handle(const struct rte_mp_msg *mp_msg, const void *peer)
|
||||
PMD_INIT_LOG(INFO, "port %u starting datapath",
|
||||
dev->data->port_id);
|
||||
hns3_set_rxtx_function(dev);
|
||||
- rte_mb();
|
||||
- mp_init_msg(dev, &mp_res, param->type);
|
||||
- res->result = 0;
|
||||
- ret = rte_mp_reply(&mp_res, peer);
|
||||
break;
|
||||
case HNS3_MP_REQ_STOP_RXTX:
|
||||
PMD_INIT_LOG(INFO, "port %u stopping datapath",
|
||||
dev->data->port_id);
|
||||
hns3_set_rxtx_function(dev);
|
||||
- rte_mb();
|
||||
- mp_init_msg(dev, &mp_res, param->type);
|
||||
- res->result = 0;
|
||||
- ret = rte_mp_reply(&mp_res, peer);
|
||||
+ break;
|
||||
+ case HNS3_MP_REQ_START_TX:
|
||||
+ PMD_INIT_LOG(INFO, "port %u starting Tx datapath",
|
||||
+ dev->data->port_id);
|
||||
+ dev->tx_pkt_burst = hns3_get_tx_function(dev, &prep);
|
||||
+ dev->tx_pkt_prepare = prep;
|
||||
+ break;
|
||||
+ case HNS3_MP_REQ_STOP_TX:
|
||||
+ PMD_INIT_LOG(INFO, "port %u stopping Tx datapath",
|
||||
+ dev->data->port_id);
|
||||
+ dev->tx_pkt_burst = hns3_dummy_rxtx_burst;
|
||||
+ dev->tx_pkt_prepare = NULL;
|
||||
break;
|
||||
default:
|
||||
rte_errno = EINVAL;
|
||||
@@ -107,9 +112,24 @@ mp_secondary_handle(const struct rte_mp_msg *mp_msg, const void *peer)
|
||||
dev->data->port_id);
|
||||
return -rte_errno;
|
||||
}
|
||||
+
|
||||
+ rte_mb();
|
||||
+ mp_init_msg(dev, &mp_res, param->type);
|
||||
+ res->result = 0;
|
||||
+ ret = rte_mp_reply(&mp_res, peer);
|
||||
+
|
||||
return ret;
|
||||
}
|
||||
|
||||
+static bool
|
||||
+mp_req_type_is_valid(enum hns3_mp_req_type type)
|
||||
+{
|
||||
+ return type == HNS3_MP_REQ_START_RXTX ||
|
||||
+ type == HNS3_MP_REQ_STOP_RXTX ||
|
||||
+ type == HNS3_MP_REQ_START_TX ||
|
||||
+ type == HNS3_MP_REQ_STOP_TX;
|
||||
+}
|
||||
+
|
||||
/*
|
||||
* Broadcast request of stopping/starting data-path to secondary processes.
|
||||
*
|
||||
@@ -132,7 +152,7 @@ mp_req_on_rxtx(struct rte_eth_dev *dev, enum hns3_mp_req_type type)
|
||||
|
||||
if (rte_eal_process_type() == RTE_PROC_SECONDARY || !hw->secondary_cnt)
|
||||
return;
|
||||
- if (type != HNS3_MP_REQ_START_RXTX && type != HNS3_MP_REQ_STOP_RXTX) {
|
||||
+ if (!mp_req_type_is_valid(type)) {
|
||||
hns3_err(hw, "port %u unknown request (req_type %d)",
|
||||
dev->data->port_id, type);
|
||||
return;
|
||||
@@ -189,6 +209,18 @@ void hns3_mp_req_stop_rxtx(struct rte_eth_dev *dev)
|
||||
mp_req_on_rxtx(dev, HNS3_MP_REQ_STOP_RXTX);
|
||||
}
|
||||
|
||||
+void
|
||||
+hns3_mp_req_stop_tx(struct rte_eth_dev *dev)
|
||||
+{
|
||||
+ mp_req_on_rxtx(dev, HNS3_MP_REQ_STOP_TX);
|
||||
+}
|
||||
+
|
||||
+void
|
||||
+hns3_mp_req_start_tx(struct rte_eth_dev *dev)
|
||||
+{
|
||||
+ mp_req_on_rxtx(dev, HNS3_MP_REQ_START_TX);
|
||||
+}
|
||||
+
|
||||
/*
|
||||
* Initialize by primary process.
|
||||
*/
|
||||
diff --git a/drivers/net/hns3/hns3_mp.h b/drivers/net/hns3/hns3_mp.h
|
||||
index 1a73598..e0e4aea 100644
|
||||
--- a/drivers/net/hns3/hns3_mp.h
|
||||
+++ b/drivers/net/hns3/hns3_mp.h
|
||||
@@ -7,6 +7,9 @@
|
||||
|
||||
void hns3_mp_req_start_rxtx(struct rte_eth_dev *dev);
|
||||
void hns3_mp_req_stop_rxtx(struct rte_eth_dev *dev);
|
||||
+void hns3_mp_req_start_tx(struct rte_eth_dev *dev);
|
||||
+void hns3_mp_req_stop_tx(struct rte_eth_dev *dev);
|
||||
+
|
||||
int hns3_mp_init_primary(void);
|
||||
void hns3_mp_uninit_primary(void);
|
||||
int hns3_mp_init_secondary(void);
|
||||
diff --git a/drivers/net/hns3/hns3_rxtx.c b/drivers/net/hns3/hns3_rxtx.c
|
||||
index d3fbe08..7d8176f 100644
|
||||
--- a/drivers/net/hns3/hns3_rxtx.c
|
||||
+++ b/drivers/net/hns3/hns3_rxtx.c
|
||||
@@ -4309,7 +4309,7 @@ hns3_get_tx_prep_needed(struct rte_eth_dev *dev)
|
||||
#endif
|
||||
}
|
||||
|
||||
-static eth_tx_burst_t
|
||||
+eth_tx_burst_t
|
||||
hns3_get_tx_function(struct rte_eth_dev *dev, eth_tx_prep_t *prep)
|
||||
{
|
||||
struct hns3_adapter *hns = dev->data->dev_private;
|
||||
@@ -4346,7 +4346,7 @@ hns3_get_tx_function(struct rte_eth_dev *dev, eth_tx_prep_t *prep)
|
||||
return hns3_xmit_pkts;
|
||||
}
|
||||
|
||||
-static uint16_t
|
||||
+uint16_t
|
||||
hns3_dummy_rxtx_burst(void *dpdk_txq __rte_unused,
|
||||
struct rte_mbuf **pkts __rte_unused,
|
||||
uint16_t pkts_n __rte_unused)
|
||||
diff --git a/drivers/net/hns3/hns3_rxtx.h b/drivers/net/hns3/hns3_rxtx.h
|
||||
index 56c1b80..141de7a 100644
|
||||
--- a/drivers/net/hns3/hns3_rxtx.h
|
||||
+++ b/drivers/net/hns3/hns3_rxtx.h
|
||||
@@ -729,6 +729,12 @@ 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);
|
||||
+uint16_t hns3_dummy_rxtx_burst(void *dpdk_txq __rte_unused,
|
||||
+ struct rte_mbuf **pkts __rte_unused,
|
||||
+ uint16_t pkts_n __rte_unused);
|
||||
+
|
||||
uint32_t hns3_get_tqp_intr_reg_offset(uint16_t tqp_intr_id);
|
||||
void hns3_set_queue_intr_gl(struct hns3_hw *hw, uint16_t queue_id,
|
||||
uint8_t gl_idx, uint16_t gl_value);
|
||||
--
|
||||
2.7.4
|
||||
|
||||
287
0216-net-hns3-support-set-link-up-down-for-PF.patch
Normal file
287
0216-net-hns3-support-set-link-up-down-for-PF.patch
Normal file
@ -0,0 +1,287 @@
|
||||
From 0a3e6a5d6e2ab6eec0a16db1d5d5f5d0b75bcf8b Mon Sep 17 00:00:00 2001
|
||||
From: Huisong Li <lihuisong@huawei.com>
|
||||
Date: Mon, 26 Jul 2021 18:59:40 +0800
|
||||
Subject: [PATCH] net/hns3: support set link up/down for PF
|
||||
|
||||
This patch adds set link up/down feature. RxTx datapath and link status
|
||||
will be disabled when dev_set_link_down() is called, and can be enabled by
|
||||
dev_start() or dev_set_link_up().
|
||||
|
||||
Signed-off-by: Huisong Li <lihuisong@huawei.com>
|
||||
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
|
||||
---
|
||||
drivers/net/hns3/hns3_ethdev.c | 107 ++++++++++++++++++++++++++++++++++++++---
|
||||
drivers/net/hns3/hns3_ethdev.h | 11 +++--
|
||||
drivers/net/hns3/hns3_rxtx.c | 28 ++++++++++-
|
||||
drivers/net/hns3/hns3_rxtx.h | 2 +
|
||||
4 files changed, 138 insertions(+), 10 deletions(-)
|
||||
|
||||
diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c
|
||||
index a374fa7..7d37004 100644
|
||||
--- a/drivers/net/hns3/hns3_ethdev.c
|
||||
+++ b/drivers/net/hns3/hns3_ethdev.c
|
||||
@@ -103,6 +103,7 @@ static int hns3_restore_fec(struct hns3_hw *hw);
|
||||
static int hns3_query_dev_fec_info(struct hns3_hw *hw);
|
||||
static int hns3_do_stop(struct hns3_adapter *hns);
|
||||
static int hns3_check_port_speed(struct hns3_hw *hw, uint32_t link_speeds);
|
||||
+static int hns3_cfg_mac_mode(struct hns3_hw *hw, bool enable);
|
||||
|
||||
void hns3_ether_format_addr(char *buf, uint16_t size,
|
||||
const struct rte_ether_addr *ether_addr)
|
||||
@@ -2924,6 +2925,88 @@ hns3_dev_link_update(struct rte_eth_dev *eth_dev, int wait_to_complete)
|
||||
}
|
||||
|
||||
static int
|
||||
+hns3_dev_set_link_up(struct rte_eth_dev *dev)
|
||||
+{
|
||||
+ struct hns3_hw *hw = HNS3_DEV_PRIVATE_TO_HW(dev->data->dev_private);
|
||||
+ int ret;
|
||||
+
|
||||
+ /*
|
||||
+ * The "tx_pkt_burst" will be restored. But the secondary process does
|
||||
+ * not support the mechanism for notifying the primary process.
|
||||
+ */
|
||||
+ if (rte_eal_process_type() != RTE_PROC_PRIMARY) {
|
||||
+ hns3_err(hw, "secondary process does not support to set link up.");
|
||||
+ return -ENOTSUP;
|
||||
+ }
|
||||
+
|
||||
+ /*
|
||||
+ * If device isn't started Rx/Tx function is still disabled, setting
|
||||
+ * link up is not allowed. But it is probably better to return success
|
||||
+ * to reduce the impact on the upper layer.
|
||||
+ */
|
||||
+ if (hw->adapter_state != HNS3_NIC_STARTED) {
|
||||
+ hns3_info(hw, "device isn't started, can't set link up.");
|
||||
+ return 0;
|
||||
+ }
|
||||
+
|
||||
+ if (!hw->set_link_down)
|
||||
+ return 0;
|
||||
+
|
||||
+ rte_spinlock_lock(&hw->lock);
|
||||
+ ret = hns3_cfg_mac_mode(hw, true);
|
||||
+ if (ret) {
|
||||
+ rte_spinlock_unlock(&hw->lock);
|
||||
+ hns3_err(hw, "failed to set link up, ret = %d", ret);
|
||||
+ return ret;
|
||||
+ }
|
||||
+
|
||||
+ hw->set_link_down = false;
|
||||
+ hns3_start_tx_datapath(dev);
|
||||
+ rte_spinlock_unlock(&hw->lock);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static int
|
||||
+hns3_dev_set_link_down(struct rte_eth_dev *dev)
|
||||
+{
|
||||
+ struct hns3_hw *hw = HNS3_DEV_PRIVATE_TO_HW(dev->data->dev_private);
|
||||
+ int ret;
|
||||
+
|
||||
+ /*
|
||||
+ * The "tx_pkt_burst" will be set to dummy function. But the secondary
|
||||
+ * process does not support the mechanism for notifying the primary
|
||||
+ * process.
|
||||
+ */
|
||||
+ if (rte_eal_process_type() != RTE_PROC_PRIMARY) {
|
||||
+ hns3_err(hw, "secondary process does not support to set link down.");
|
||||
+ return -ENOTSUP;
|
||||
+ }
|
||||
+
|
||||
+ /*
|
||||
+ * If device isn't started or the API has been called, link status is
|
||||
+ * down, return success.
|
||||
+ */
|
||||
+ if (hw->adapter_state != HNS3_NIC_STARTED || hw->set_link_down)
|
||||
+ return 0;
|
||||
+
|
||||
+ rte_spinlock_lock(&hw->lock);
|
||||
+ hns3_stop_tx_datapath(dev);
|
||||
+ ret = hns3_cfg_mac_mode(hw, false);
|
||||
+ if (ret) {
|
||||
+ hns3_start_tx_datapath(dev);
|
||||
+ rte_spinlock_unlock(&hw->lock);
|
||||
+ hns3_err(hw, "failed to set link down, ret = %d", ret);
|
||||
+ return ret;
|
||||
+ }
|
||||
+
|
||||
+ hw->set_link_down = true;
|
||||
+ rte_spinlock_unlock(&hw->lock);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static int
|
||||
hns3_parse_func_status(struct hns3_hw *hw, struct hns3_func_status_cmd *status)
|
||||
{
|
||||
struct hns3_adapter *hns = HNS3_DEV_HW_TO_ADAPTER(hw);
|
||||
@@ -5576,6 +5659,7 @@ static int
|
||||
hns3_do_start(struct hns3_adapter *hns, bool reset_queue)
|
||||
{
|
||||
struct hns3_hw *hw = &hns->hw;
|
||||
+ bool link_en;
|
||||
int ret;
|
||||
|
||||
ret = hns3_update_queue_map_configure(hns);
|
||||
@@ -5600,7 +5684,8 @@ hns3_do_start(struct hns3_adapter *hns, bool reset_queue)
|
||||
return ret;
|
||||
}
|
||||
|
||||
- ret = hns3_cfg_mac_mode(hw, true);
|
||||
+ link_en = hw->set_link_down ? false : true;
|
||||
+ ret = hns3_cfg_mac_mode(hw, link_en);
|
||||
if (ret) {
|
||||
PMD_INIT_LOG(ERR, "failed to enable MAC, ret = %d", ret);
|
||||
goto err_config_mac_mode;
|
||||
@@ -5731,6 +5816,7 @@ hns3_dev_start(struct rte_eth_dev *dev)
|
||||
{
|
||||
struct hns3_adapter *hns = dev->data->dev_private;
|
||||
struct hns3_hw *hw = &hns->hw;
|
||||
+ bool old_state = hw->set_link_down;
|
||||
int ret;
|
||||
|
||||
PMD_INIT_FUNC_TRACE();
|
||||
@@ -5740,12 +5826,17 @@ hns3_dev_start(struct rte_eth_dev *dev)
|
||||
rte_spinlock_lock(&hw->lock);
|
||||
hw->adapter_state = HNS3_NIC_STARTING;
|
||||
|
||||
+ /*
|
||||
+ * If the dev_set_link_down() API has been called, the "set_link_down"
|
||||
+ * flag can be cleared by dev_start() API. In addition, the flag should
|
||||
+ * also be cleared before calling hns3_do_start() so that MAC can be
|
||||
+ * enabled in dev_start stage.
|
||||
+ */
|
||||
+ hw->set_link_down = false;
|
||||
ret = hns3_do_start(hns, true);
|
||||
- if (ret) {
|
||||
- hw->adapter_state = HNS3_NIC_CONFIGURED;
|
||||
- rte_spinlock_unlock(&hw->lock);
|
||||
- return ret;
|
||||
- }
|
||||
+ if (ret)
|
||||
+ goto do_start_fail;
|
||||
+
|
||||
ret = hns3_map_rx_interrupt(dev);
|
||||
if (ret)
|
||||
goto map_rx_inter_err;
|
||||
@@ -5801,6 +5892,8 @@ hns3_dev_start(struct rte_eth_dev *dev)
|
||||
hns3_stop_all_txqs(dev);
|
||||
map_rx_inter_err:
|
||||
(void)hns3_do_stop(hns);
|
||||
+do_start_fail:
|
||||
+ hw->set_link_down = old_state;
|
||||
hw->adapter_state = HNS3_NIC_CONFIGURED;
|
||||
rte_spinlock_unlock(&hw->lock);
|
||||
|
||||
@@ -7345,6 +7438,8 @@ static const struct eth_dev_ops hns3_eth_dev_ops = {
|
||||
.mac_addr_set = hns3_set_default_mac_addr,
|
||||
.set_mc_addr_list = hns3_set_mc_mac_addr_list,
|
||||
.link_update = hns3_dev_link_update,
|
||||
+ .dev_set_link_up = hns3_dev_set_link_up,
|
||||
+ .dev_set_link_down = hns3_dev_set_link_down,
|
||||
.rss_hash_update = hns3_dev_rss_hash_update,
|
||||
.rss_hash_conf_get = hns3_dev_rss_hash_conf_get,
|
||||
.reta_update = hns3_dev_rss_reta_update,
|
||||
diff --git a/drivers/net/hns3/hns3_ethdev.h b/drivers/net/hns3/hns3_ethdev.h
|
||||
index 2e48ff6..0e4e426 100644
|
||||
--- a/drivers/net/hns3/hns3_ethdev.h
|
||||
+++ b/drivers/net/hns3/hns3_ethdev.h
|
||||
@@ -481,6 +481,11 @@ struct hns3_hw {
|
||||
struct hns3_cmq cmq;
|
||||
struct hns3_mbx_resp_status mbx_resp; /* mailbox response */
|
||||
struct hns3_mac mac;
|
||||
+ /*
|
||||
+ * This flag indicates dev_set_link_down() API is called, and is cleared
|
||||
+ * by dev_set_link_up() or dev_start().
|
||||
+ */
|
||||
+ bool set_link_down;
|
||||
unsigned int secondary_cnt; /* Number of secondary processes init'd. */
|
||||
struct hns3_tqp_stats tqp_stats;
|
||||
/* Include Mac stats | Rx stats | Tx stats */
|
||||
@@ -699,9 +704,9 @@ struct hns3_vtag_cfg {
|
||||
/* Request types for IPC. */
|
||||
enum hns3_mp_req_type {
|
||||
HNS3_MP_REQ_START_RXTX = 1,
|
||||
- HNS3_MP_REQ_STOP_RXTX = 2,
|
||||
- HNS3_MP_REQ_START_TX = 3,
|
||||
- HNS3_MP_REQ_STOP_TX = 4,
|
||||
+ HNS3_MP_REQ_STOP_RXTX,
|
||||
+ HNS3_MP_REQ_START_TX,
|
||||
+ HNS3_MP_REQ_STOP_TX,
|
||||
HNS3_MP_REQ_MAX
|
||||
};
|
||||
|
||||
diff --git a/drivers/net/hns3/hns3_rxtx.c b/drivers/net/hns3/hns3_rxtx.c
|
||||
index 7d8176f..0f222b3 100644
|
||||
--- a/drivers/net/hns3/hns3_rxtx.c
|
||||
+++ b/drivers/net/hns3/hns3_rxtx.c
|
||||
@@ -20,6 +20,7 @@
|
||||
#include "hns3_rxtx.h"
|
||||
#include "hns3_regs.h"
|
||||
#include "hns3_logs.h"
|
||||
+#include "hns3_mp.h"
|
||||
|
||||
#define HNS3_CFG_DESC_NUM(num) ((num) / 8 - 1)
|
||||
#define HNS3_RX_RING_PREFETCTH_MASK 3
|
||||
@@ -4372,6 +4373,7 @@ hns3_trace_rxtx_function(struct rte_eth_dev *dev)
|
||||
|
||||
void 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;
|
||||
|
||||
@@ -4379,7 +4381,9 @@ void hns3_set_rxtx_function(struct rte_eth_dev *eth_dev)
|
||||
__atomic_load_n(&hns->hw.reset.resetting, __ATOMIC_RELAXED) == 0) {
|
||||
eth_dev->rx_pkt_burst = hns3_get_rx_function(eth_dev);
|
||||
eth_dev->rx_descriptor_status = hns3_dev_rx_descriptor_status;
|
||||
- eth_dev->tx_pkt_burst = hns3_get_tx_function(eth_dev, &prep);
|
||||
+ 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;
|
||||
eth_dev->tx_descriptor_status = hns3_dev_tx_descriptor_status;
|
||||
hns3_trace_rxtx_function(eth_dev);
|
||||
@@ -4703,3 +4707,25 @@ hns3_enable_rxd_adv_layout(struct hns3_hw *hw)
|
||||
if (hns3_dev_rxd_adv_layout_supported(hw))
|
||||
hns3_write_dev(hw, HNS3_RXD_ADV_LAYOUT_EN_REG, 1);
|
||||
}
|
||||
+
|
||||
+void
|
||||
+hns3_stop_tx_datapath(struct rte_eth_dev *dev)
|
||||
+{
|
||||
+ dev->tx_pkt_burst = hns3_dummy_rxtx_burst;
|
||||
+ dev->tx_pkt_prepare = NULL;
|
||||
+ rte_wmb();
|
||||
+ /* Disable tx datapath on secondary process. */
|
||||
+ hns3_mp_req_stop_tx(dev);
|
||||
+ /* Prevent crashes when queues are still in use. */
|
||||
+ rte_delay_ms(dev->data->nb_tx_queues);
|
||||
+}
|
||||
+
|
||||
+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;
|
||||
+ hns3_mp_req_start_tx(dev);
|
||||
+}
|
||||
diff --git a/drivers/net/hns3/hns3_rxtx.h b/drivers/net/hns3/hns3_rxtx.h
|
||||
index 141de7a..cd7c21c 100644
|
||||
--- a/drivers/net/hns3/hns3_rxtx.h
|
||||
+++ b/drivers/net/hns3/hns3_rxtx.h
|
||||
@@ -766,5 +766,7 @@ void hns3_enable_rxd_adv_layout(struct hns3_hw *hw);
|
||||
int hns3_dev_rx_descriptor_status(void *rx_queue, uint16_t offset);
|
||||
int hns3_dev_tx_descriptor_status(void *tx_queue, uint16_t offset);
|
||||
void hns3_tx_push_init(struct rte_eth_dev *dev);
|
||||
+void hns3_stop_tx_datapath(struct rte_eth_dev *dev);
|
||||
+void hns3_start_tx_datapath(struct rte_eth_dev *dev);
|
||||
|
||||
#endif /* _HNS3_RXTX_H_ */
|
||||
--
|
||||
2.7.4
|
||||
|
||||
58
0217-net-hns3-fix-queue-flow-action-validation.patch
Normal file
58
0217-net-hns3-fix-queue-flow-action-validation.patch
Normal file
@ -0,0 +1,58 @@
|
||||
From 15c37af398c3a22b5f46aff8abfc9166f949567c Mon Sep 17 00:00:00 2001
|
||||
From: Chengchang Tang <tangchengchang@huawei.com>
|
||||
Date: Mon, 30 Aug 2021 16:26:49 +0800
|
||||
Subject: [PATCH] net/hns3: fix queue flow action validation
|
||||
|
||||
The used_rx_queues only takes effect after device is started, and
|
||||
its value is incorrect before the device is started. Therefore, it
|
||||
is not suitable for flow action to use it to verify the queue index
|
||||
before the device is started.
|
||||
|
||||
E.g. Enable dedicated queue in bonding device will configure a queue
|
||||
flow action before start its slave devices. The above problem will
|
||||
make this reasonable flow action configuration fail.
|
||||
|
||||
This patch use the nb_rx_queues from the configuration phase to
|
||||
achieve verification.
|
||||
|
||||
Fixes: a951c1ed3ab5 ("net/hns3: support different numbers of Rx and Tx queues")
|
||||
Fixes: f8e7fcbfd0b8 ("net/hns3: support flow action of queue region")
|
||||
Cc: stable@dpdk.org
|
||||
|
||||
Signed-off-by: Chengchang Tang <tangchengchang@huawei.com>
|
||||
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
|
||||
---
|
||||
drivers/net/hns3/hns3_flow.c | 8 ++++----
|
||||
1 file changed, 4 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/drivers/net/hns3/hns3_flow.c b/drivers/net/hns3/hns3_flow.c
|
||||
index fc77979c5f..841e0b9da3 100644
|
||||
--- a/drivers/net/hns3/hns3_flow.c
|
||||
+++ b/drivers/net/hns3/hns3_flow.c
|
||||
@@ -275,10 +275,10 @@ hns3_handle_action_queue(struct rte_eth_dev *dev,
|
||||
struct hns3_hw *hw = &hns->hw;
|
||||
|
||||
queue = (const struct rte_flow_action_queue *)action->conf;
|
||||
- if (queue->index >= hw->used_rx_queues) {
|
||||
+ if (queue->index >= hw->data->nb_rx_queues) {
|
||||
hns3_err(hw, "queue ID(%u) is greater than number of "
|
||||
"available queue (%u) in driver.",
|
||||
- queue->index, hw->used_rx_queues);
|
||||
+ queue->index, hw->data->nb_rx_queues);
|
||||
return rte_flow_error_set(error, EINVAL,
|
||||
RTE_FLOW_ERROR_TYPE_ACTION_CONF,
|
||||
action, "Invalid queue ID in PF");
|
||||
@@ -308,8 +308,8 @@ hns3_handle_action_queue_region(struct rte_eth_dev *dev,
|
||||
|
||||
if ((!rte_is_power_of_2(conf->queue_num)) ||
|
||||
conf->queue_num > hw->rss_size_max ||
|
||||
- conf->queue[0] >= hw->used_rx_queues ||
|
||||
- conf->queue[0] + conf->queue_num > hw->used_rx_queues) {
|
||||
+ conf->queue[0] >= hw->data->nb_rx_queues ||
|
||||
+ conf->queue[0] + conf->queue_num > hw->data->nb_rx_queues) {
|
||||
return rte_flow_error_set(error, EINVAL,
|
||||
RTE_FLOW_ERROR_TYPE_ACTION_CONF, action,
|
||||
"Invalid start queue ID and queue num! the start queue "
|
||||
--
|
||||
2.33.0
|
||||
|
||||
35
0218-net-hns3-fix-taskqueue-pair-reset-command.patch
Normal file
35
0218-net-hns3-fix-taskqueue-pair-reset-command.patch
Normal file
@ -0,0 +1,35 @@
|
||||
From 9c5fac6cc28c70fe549e60b3765ddef5a58d76f3 Mon Sep 17 00:00:00 2001
|
||||
From: Chengchang Tang <tangchengchang@huawei.com>
|
||||
Date: Mon, 30 Aug 2021 16:26:50 +0800
|
||||
Subject: [PATCH] net/hns3: fix taskqueue pair reset command
|
||||
|
||||
This new taskqueue pair reset command is used incorrectly, resulting in
|
||||
the new command not taking effect.
|
||||
|
||||
This patch fixes the incorrect use.
|
||||
|
||||
Fixes: 6911e7c22c61 ("net/hns3: fix long task queue pairs reset time")
|
||||
Cc: stable@dpdk.org
|
||||
|
||||
Signed-off-by: Chengchang Tang <tangchengchang@huawei.com>
|
||||
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
|
||||
---
|
||||
drivers/net/hns3/hns3_rxtx.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/drivers/net/hns3/hns3_rxtx.c b/drivers/net/hns3/hns3_rxtx.c
|
||||
index 0f222b37f9..481872e395 100644
|
||||
--- a/drivers/net/hns3/hns3_rxtx.c
|
||||
+++ b/drivers/net/hns3/hns3_rxtx.c
|
||||
@@ -697,7 +697,7 @@ hns3_reset_rcb_cmd(struct hns3_hw *hw, uint8_t *reset_status)
|
||||
|
||||
hns3_cmd_setup_basic_desc(&desc, HNS3_OPC_CFG_RST_TRIGGER, false);
|
||||
req = (struct hns3_reset_cmd *)desc.data;
|
||||
- hns3_set_bit(req->mac_func_reset, HNS3_CFG_RESET_RCB_B, 1);
|
||||
+ hns3_set_bit(req->fun_reset_rcb, HNS3_CFG_RESET_RCB_B, 1);
|
||||
|
||||
/*
|
||||
* The start qid should be the global qid of the first tqp of the
|
||||
--
|
||||
2.33.0
|
||||
|
||||
53
0219-net-hns3-fix-Tx-push-capability.patch
Normal file
53
0219-net-hns3-fix-Tx-push-capability.patch
Normal file
@ -0,0 +1,53 @@
|
||||
From 85289d2ec86fa522962d6599521af0a2f604ac52 Mon Sep 17 00:00:00 2001
|
||||
From: "Min Hu (Connor)" <humin29@huawei.com>
|
||||
Date: Mon, 30 Aug 2021 16:26:51 +0800
|
||||
Subject: [PATCH] net/hns3: fix Tx push capability
|
||||
|
||||
This patch fixes Tx push capability to be compatible with Kunpeng 920,
|
||||
as Tx push is only supported on Kunpeng 930.
|
||||
|
||||
Fixes: 23e317dd1fbf ("net/hns3: support Tx push quick doorbell for performance")
|
||||
Cc: stable@dpdk.org
|
||||
|
||||
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
|
||||
---
|
||||
drivers/net/hns3/hns3_cmd.c | 3 +++
|
||||
drivers/net/hns3/hns3_cmd.h | 1 +
|
||||
2 files changed, 4 insertions(+)
|
||||
|
||||
diff --git a/drivers/net/hns3/hns3_cmd.c b/drivers/net/hns3/hns3_cmd.c
|
||||
index 928f938536..6a1e634684 100644
|
||||
--- a/drivers/net/hns3/hns3_cmd.c
|
||||
+++ b/drivers/net/hns3/hns3_cmd.c
|
||||
@@ -423,6 +423,7 @@ hns3_get_caps_name(uint32_t caps_id)
|
||||
} dev_caps[] = {
|
||||
{ HNS3_CAPS_FD_QUEUE_REGION_B, "fd_queue_region" },
|
||||
{ HNS3_CAPS_PTP_B, "ptp" },
|
||||
+ { HNS3_CAPS_TX_PUSH_B, "tx_push" },
|
||||
{ HNS3_CAPS_PHY_IMP_B, "phy_imp" },
|
||||
{ HNS3_CAPS_TQP_TXRX_INDEP_B, "tqp_txrx_indep" },
|
||||
{ HNS3_CAPS_HW_PAD_B, "hw_pad" },
|
||||
@@ -492,6 +493,8 @@ hns3_parse_capability(struct hns3_hw *hw,
|
||||
hns3_warn(hw, "ignore PTP capability due to lack of "
|
||||
"rxd advanced layout capability.");
|
||||
}
|
||||
+ if (hns3_get_bit(caps, HNS3_CAPS_TX_PUSH_B))
|
||||
+ hns3_set_bit(hw->capability, HNS3_DEV_SUPPORT_TX_PUSH_B, 1);
|
||||
if (hns3_get_bit(caps, HNS3_CAPS_PHY_IMP_B))
|
||||
hns3_set_bit(hw->capability, HNS3_DEV_SUPPORT_COPPER_B, 1);
|
||||
if (hns3_get_bit(caps, HNS3_CAPS_TQP_TXRX_INDEP_B))
|
||||
diff --git a/drivers/net/hns3/hns3_cmd.h b/drivers/net/hns3/hns3_cmd.h
|
||||
index 88683dfaaa..a4683de0aa 100644
|
||||
--- a/drivers/net/hns3/hns3_cmd.h
|
||||
+++ b/drivers/net/hns3/hns3_cmd.h
|
||||
@@ -315,6 +315,7 @@ enum HNS3_CAPS_BITS {
|
||||
*/
|
||||
HNS3_CAPS_FD_QUEUE_REGION_B = 2,
|
||||
HNS3_CAPS_PTP_B,
|
||||
+ HNS3_CAPS_TX_PUSH_B = 6,
|
||||
HNS3_CAPS_PHY_IMP_B = 7,
|
||||
HNS3_CAPS_TQP_TXRX_INDEP_B,
|
||||
HNS3_CAPS_HW_PAD_B,
|
||||
--
|
||||
2.33.0
|
||||
|
||||
30
0220-examples-kni-close-port-before-exit.patch
Normal file
30
0220-examples-kni-close-port-before-exit.patch
Normal file
@ -0,0 +1,30 @@
|
||||
From 96fdb80048e279289e012fafe762f5b53e2ecd23 Mon Sep 17 00:00:00 2001
|
||||
From: Huisong Li <lihuisong@huawei.com>
|
||||
Date: Tue, 14 Sep 2021 14:02:19 +0800
|
||||
Subject: [PATCH 01/17] examples/kni: close port before exit
|
||||
|
||||
This patch adds dev_close() step to release network adapter resources
|
||||
when kni free.
|
||||
|
||||
Signed-off-by: Huisong Li <lihuisong@huawei.com>
|
||||
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
|
||||
Acked-by: Ferruh Yigit <ferruh.yigit@intel.com>
|
||||
---
|
||||
examples/kni/main.c | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
diff --git a/examples/kni/main.c b/examples/kni/main.c
|
||||
index fe93b8618..40e1790c4 100644
|
||||
--- a/examples/kni/main.c
|
||||
+++ b/examples/kni/main.c
|
||||
@@ -1031,6 +1031,7 @@ kni_free_kni(uint16_t port_id)
|
||||
if (ret != 0)
|
||||
RTE_LOG(ERR, APP, "Failed to stop port %d: %s\n",
|
||||
port_id, rte_strerror(-ret));
|
||||
+ rte_eth_dev_close(port_id);
|
||||
|
||||
return 0;
|
||||
}
|
||||
--
|
||||
2.23.0
|
||||
|
||||
141
0221-net-hns3-fix-residual-MAC-after-setting-default-MAC.patch
Normal file
141
0221-net-hns3-fix-residual-MAC-after-setting-default-MAC.patch
Normal file
@ -0,0 +1,141 @@
|
||||
From 5fcd00f784f9b984bf1f8a084a6be32816585717 Mon Sep 17 00:00:00 2001
|
||||
From: Huisong Li <lihuisong@huawei.com>
|
||||
Date: Wed, 22 Sep 2021 11:41:51 +0800
|
||||
Subject: [PATCH 02/17] net/hns3: fix residual MAC after setting default MAC
|
||||
|
||||
This problem occurs in the following scenarios:
|
||||
1) reset is encountered when the adapter is running.
|
||||
2) set a new default MAC address
|
||||
|
||||
After the above two steps, the old default MAC address should be not
|
||||
take effect. But the current behavior is contrary to that. This is due
|
||||
to the change of the "default_addr_setted" in hw->mac from 'true' to
|
||||
'false' after the reset. As a result, the old MAC address is not removed
|
||||
when the new default MAC address is set. This variable controls whether
|
||||
to delete the old default MAC address when setting the default MAC
|
||||
address. It is only used when the mac_addr_set API is called for the
|
||||
first time. In fact, when a unicast MAC address is deleted, if the
|
||||
address isn't in the MAC address table, the driver doesn't return
|
||||
failure. So this patch remove the redundant and troublesome variables to
|
||||
resolve this problem.
|
||||
|
||||
Fixes: 7d7f9f80bbfb ("net/hns3: support MAC address related operations")
|
||||
Cc: stable@dpdk.org
|
||||
|
||||
Signed-off-by: Huisong Li <lihuisong@huawei.com>
|
||||
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
|
||||
---
|
||||
drivers/net/hns3/hns3_ethdev.c | 38 ++++++++++------------------------
|
||||
drivers/net/hns3/hns3_ethdev.h | 1 -
|
||||
2 files changed, 11 insertions(+), 28 deletions(-)
|
||||
|
||||
diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c
|
||||
index 2fb0c466c..d6228601f 100644
|
||||
--- a/drivers/net/hns3/hns3_ethdev.c
|
||||
+++ b/drivers/net/hns3/hns3_ethdev.c
|
||||
@@ -1651,7 +1651,7 @@ hns3_remove_mc_addr_common(struct hns3_hw *hw, struct rte_ether_addr *mac_addr)
|
||||
|
||||
static int
|
||||
hns3_add_mac_addr(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr,
|
||||
- uint32_t idx, __rte_unused uint32_t pool)
|
||||
+ __rte_unused uint32_t idx, __rte_unused uint32_t pool)
|
||||
{
|
||||
struct hns3_hw *hw = HNS3_DEV_PRIVATE_TO_HW(dev->data->dev_private);
|
||||
char mac_str[RTE_ETHER_ADDR_FMT_SIZE];
|
||||
@@ -1682,8 +1682,6 @@ hns3_add_mac_addr(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr,
|
||||
return ret;
|
||||
}
|
||||
|
||||
- if (idx == 0)
|
||||
- hw->mac.default_addr_setted = true;
|
||||
rte_spinlock_unlock(&hw->lock);
|
||||
|
||||
return ret;
|
||||
@@ -1748,30 +1746,19 @@ hns3_set_default_mac_addr(struct rte_eth_dev *dev,
|
||||
struct hns3_hw *hw = HNS3_DEV_PRIVATE_TO_HW(dev->data->dev_private);
|
||||
struct rte_ether_addr *oaddr;
|
||||
char mac_str[RTE_ETHER_ADDR_FMT_SIZE];
|
||||
- bool default_addr_setted;
|
||||
int ret, ret_val;
|
||||
|
||||
- /*
|
||||
- * It has been guaranteed that input parameter named mac_addr is valid
|
||||
- * address in the rte layer of DPDK framework.
|
||||
- */
|
||||
- oaddr = (struct rte_ether_addr *)hw->mac.mac_addr;
|
||||
- default_addr_setted = hw->mac.default_addr_setted;
|
||||
- if (default_addr_setted && !!rte_is_same_ether_addr(mac_addr, oaddr))
|
||||
- return 0;
|
||||
-
|
||||
rte_spinlock_lock(&hw->lock);
|
||||
- if (default_addr_setted) {
|
||||
- ret = hns3_remove_uc_addr_common(hw, oaddr);
|
||||
- if (ret) {
|
||||
- hns3_ether_format_addr(mac_str, RTE_ETHER_ADDR_FMT_SIZE,
|
||||
- oaddr);
|
||||
- hns3_warn(hw, "Remove old uc mac address(%s) fail: %d",
|
||||
- mac_str, ret);
|
||||
+ oaddr = (struct rte_ether_addr *)hw->mac.mac_addr;
|
||||
+ ret = hns3_remove_uc_addr_common(hw, oaddr);
|
||||
+ if (ret) {
|
||||
+ hns3_ether_format_addr(mac_str, RTE_ETHER_ADDR_FMT_SIZE,
|
||||
+ oaddr);
|
||||
+ hns3_warn(hw, "Remove old uc mac address(%s) fail: %d",
|
||||
+ mac_str, ret);
|
||||
|
||||
- rte_spinlock_unlock(&hw->lock);
|
||||
- return ret;
|
||||
- }
|
||||
+ rte_spinlock_unlock(&hw->lock);
|
||||
+ return ret;
|
||||
}
|
||||
|
||||
ret = hns3_add_uc_addr_common(hw, mac_addr);
|
||||
@@ -1790,7 +1777,6 @@ hns3_set_default_mac_addr(struct rte_eth_dev *dev,
|
||||
|
||||
rte_ether_addr_copy(mac_addr,
|
||||
(struct rte_ether_addr *)hw->mac.mac_addr);
|
||||
- hw->mac.default_addr_setted = true;
|
||||
rte_spinlock_unlock(&hw->lock);
|
||||
|
||||
return 0;
|
||||
@@ -1811,7 +1797,6 @@ hns3_set_default_mac_addr(struct rte_eth_dev *dev,
|
||||
hns3_ether_format_addr(mac_str, RTE_ETHER_ADDR_FMT_SIZE, oaddr);
|
||||
hns3_warn(hw, "Failed to restore old uc mac addr(%s): %d",
|
||||
mac_str, ret_val);
|
||||
- hw->mac.default_addr_setted = false;
|
||||
}
|
||||
rte_spinlock_unlock(&hw->lock);
|
||||
|
||||
@@ -3470,7 +3455,6 @@ hns3_get_board_configuration(struct hns3_hw *hw)
|
||||
hw->rss_dis_flag = false;
|
||||
memcpy(hw->mac.mac_addr, cfg.mac_addr, RTE_ETHER_ADDR_LEN);
|
||||
hw->mac.phy_addr = cfg.phy_addr;
|
||||
- hw->mac.default_addr_setted = false;
|
||||
hw->num_tx_desc = cfg.tqp_desc_num;
|
||||
hw->num_rx_desc = cfg.tqp_desc_num;
|
||||
hw->dcb_info.num_pg = 1;
|
||||
@@ -5928,7 +5912,7 @@ hns3_do_stop(struct hns3_adapter *hns)
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
- hw->mac.default_addr_setted = false;
|
||||
+
|
||||
return 0;
|
||||
}
|
||||
|
||||
diff --git a/drivers/net/hns3/hns3_ethdev.h b/drivers/net/hns3/hns3_ethdev.h
|
||||
index ab44894a8..57387e05b 100644
|
||||
--- a/drivers/net/hns3/hns3_ethdev.h
|
||||
+++ b/drivers/net/hns3/hns3_ethdev.h
|
||||
@@ -188,7 +188,6 @@ enum hns3_media_type {
|
||||
|
||||
struct hns3_mac {
|
||||
uint8_t mac_addr[RTE_ETHER_ADDR_LEN];
|
||||
- bool default_addr_setted; /* whether default addr(mac_addr) is set */
|
||||
uint8_t media_type;
|
||||
uint8_t phy_addr;
|
||||
uint8_t link_duplex : 1; /* ETH_LINK_[HALF/FULL]_DUPLEX */
|
||||
--
|
||||
2.23.0
|
||||
|
||||
210
0222-net-hns3-fix-input-parameters-of-MAC-functions.patch
Normal file
210
0222-net-hns3-fix-input-parameters-of-MAC-functions.patch
Normal file
@ -0,0 +1,210 @@
|
||||
From bc25acd9ac200067f0f1a68c192076a65e4c76e6 Mon Sep 17 00:00:00 2001
|
||||
From: Huisong Li <lihuisong@huawei.com>
|
||||
Date: Wed, 22 Sep 2021 11:41:52 +0800
|
||||
Subject: [PATCH 03/17] net/hns3: fix input parameters of MAC functions
|
||||
|
||||
When adding multicast and unicast MAC addresses, three descriptors and
|
||||
one descriptor are required for querying or adding MAC VLAN table,
|
||||
respectively. This patch uses the number of descriptors as input
|
||||
parameter to complete this task to make the function more secure.
|
||||
|
||||
Fixes: 7d7f9f80bbfb ("net/hns3: support MAC address related operations")
|
||||
Cc: stable@dpdk.org
|
||||
|
||||
Signed-off-by: Huisong Li <lihuisong@huawei.com>
|
||||
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
|
||||
---
|
||||
drivers/net/hns3/hns3_cmd.h | 3 +-
|
||||
drivers/net/hns3/hns3_ethdev.c | 88 +++++++++++++++++++---------------
|
||||
2 files changed, 51 insertions(+), 40 deletions(-)
|
||||
|
||||
diff --git a/drivers/net/hns3/hns3_cmd.h b/drivers/net/hns3/hns3_cmd.h
|
||||
index a4683de0a..81bc9e9d9 100644
|
||||
--- a/drivers/net/hns3/hns3_cmd.h
|
||||
+++ b/drivers/net/hns3/hns3_cmd.h
|
||||
@@ -923,7 +923,8 @@ enum hns3_mac_vlan_add_resp_code {
|
||||
HNS3_ADD_MC_OVERFLOW, /* ADD failed for MC overflow */
|
||||
};
|
||||
|
||||
-#define HNS3_MC_MAC_VLAN_ADD_DESC_NUM 3
|
||||
+#define HNS3_MC_MAC_VLAN_OPS_DESC_NUM 3
|
||||
+#define HNS3_UC_MAC_VLAN_OPS_DESC_NUM 1
|
||||
|
||||
#define HNS3_MAC_VLAN_BIT0_EN_B 0
|
||||
#define HNS3_MAC_VLAN_BIT1_EN_B 1
|
||||
diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c
|
||||
index d6228601f..02d68e496 100644
|
||||
--- a/drivers/net/hns3/hns3_ethdev.c
|
||||
+++ b/drivers/net/hns3/hns3_ethdev.c
|
||||
@@ -1427,28 +1427,31 @@ hns3_get_mac_vlan_cmd_status(struct hns3_hw *hw, uint16_t cmdq_resp,
|
||||
static int
|
||||
hns3_lookup_mac_vlan_tbl(struct hns3_hw *hw,
|
||||
struct hns3_mac_vlan_tbl_entry_cmd *req,
|
||||
- struct hns3_cmd_desc *desc, bool is_mc)
|
||||
+ struct hns3_cmd_desc *desc, uint8_t desc_num)
|
||||
{
|
||||
uint8_t resp_code;
|
||||
uint16_t retval;
|
||||
int ret;
|
||||
+ int i;
|
||||
|
||||
- hns3_cmd_setup_basic_desc(&desc[0], HNS3_OPC_MAC_VLAN_ADD, true);
|
||||
- if (is_mc) {
|
||||
- desc[0].flag |= rte_cpu_to_le_16(HNS3_CMD_FLAG_NEXT);
|
||||
- memcpy(desc[0].data, req,
|
||||
- sizeof(struct hns3_mac_vlan_tbl_entry_cmd));
|
||||
- hns3_cmd_setup_basic_desc(&desc[1], HNS3_OPC_MAC_VLAN_ADD,
|
||||
- true);
|
||||
- desc[1].flag |= rte_cpu_to_le_16(HNS3_CMD_FLAG_NEXT);
|
||||
- hns3_cmd_setup_basic_desc(&desc[2], HNS3_OPC_MAC_VLAN_ADD,
|
||||
+ if (desc_num == HNS3_MC_MAC_VLAN_OPS_DESC_NUM) {
|
||||
+ for (i = 0; i < desc_num - 1; i++) {
|
||||
+ hns3_cmd_setup_basic_desc(&desc[i],
|
||||
+ HNS3_OPC_MAC_VLAN_ADD, true);
|
||||
+ desc[i].flag |= rte_cpu_to_le_16(HNS3_CMD_FLAG_NEXT);
|
||||
+ if (i == 0)
|
||||
+ memcpy(desc[i].data, req,
|
||||
+ sizeof(struct hns3_mac_vlan_tbl_entry_cmd));
|
||||
+ }
|
||||
+ hns3_cmd_setup_basic_desc(&desc[i], HNS3_OPC_MAC_VLAN_ADD,
|
||||
true);
|
||||
- ret = hns3_cmd_send(hw, desc, HNS3_MC_MAC_VLAN_ADD_DESC_NUM);
|
||||
} else {
|
||||
+ hns3_cmd_setup_basic_desc(&desc[0], HNS3_OPC_MAC_VLAN_ADD,
|
||||
+ true);
|
||||
memcpy(desc[0].data, req,
|
||||
sizeof(struct hns3_mac_vlan_tbl_entry_cmd));
|
||||
- ret = hns3_cmd_send(hw, desc, 1);
|
||||
}
|
||||
+ ret = hns3_cmd_send(hw, desc, desc_num);
|
||||
if (ret) {
|
||||
hns3_err(hw, "lookup mac addr failed for cmd_send, ret =%d.",
|
||||
ret);
|
||||
@@ -1464,38 +1467,40 @@ hns3_lookup_mac_vlan_tbl(struct hns3_hw *hw,
|
||||
static int
|
||||
hns3_add_mac_vlan_tbl(struct hns3_hw *hw,
|
||||
struct hns3_mac_vlan_tbl_entry_cmd *req,
|
||||
- struct hns3_cmd_desc *mc_desc)
|
||||
+ struct hns3_cmd_desc *desc, uint8_t desc_num)
|
||||
{
|
||||
uint8_t resp_code;
|
||||
uint16_t retval;
|
||||
int cfg_status;
|
||||
int ret;
|
||||
+ int i;
|
||||
|
||||
- if (mc_desc == NULL) {
|
||||
- struct hns3_cmd_desc desc;
|
||||
-
|
||||
- hns3_cmd_setup_basic_desc(&desc, HNS3_OPC_MAC_VLAN_ADD, false);
|
||||
- memcpy(desc.data, req,
|
||||
+ if (desc_num == HNS3_UC_MAC_VLAN_OPS_DESC_NUM) {
|
||||
+ hns3_cmd_setup_basic_desc(desc, HNS3_OPC_MAC_VLAN_ADD, false);
|
||||
+ memcpy(desc->data, req,
|
||||
sizeof(struct hns3_mac_vlan_tbl_entry_cmd));
|
||||
- ret = hns3_cmd_send(hw, &desc, 1);
|
||||
- resp_code = (rte_le_to_cpu_32(desc.data[0]) >> 8) & 0xff;
|
||||
- retval = rte_le_to_cpu_16(desc.retval);
|
||||
+ ret = hns3_cmd_send(hw, desc, desc_num);
|
||||
+ resp_code = (rte_le_to_cpu_32(desc->data[0]) >> 8) & 0xff;
|
||||
+ retval = rte_le_to_cpu_16(desc->retval);
|
||||
|
||||
cfg_status = hns3_get_mac_vlan_cmd_status(hw, retval, resp_code,
|
||||
HNS3_MAC_VLAN_ADD);
|
||||
} else {
|
||||
- hns3_cmd_reuse_desc(&mc_desc[0], false);
|
||||
- mc_desc[0].flag |= rte_cpu_to_le_16(HNS3_CMD_FLAG_NEXT);
|
||||
- hns3_cmd_reuse_desc(&mc_desc[1], false);
|
||||
- mc_desc[1].flag |= rte_cpu_to_le_16(HNS3_CMD_FLAG_NEXT);
|
||||
- hns3_cmd_reuse_desc(&mc_desc[2], false);
|
||||
- mc_desc[2].flag &= rte_cpu_to_le_16(~HNS3_CMD_FLAG_NEXT);
|
||||
- memcpy(mc_desc[0].data, req,
|
||||
+ for (i = 0; i < desc_num; i++) {
|
||||
+ hns3_cmd_reuse_desc(&desc[i], false);
|
||||
+ if (i == desc_num - 1)
|
||||
+ desc[i].flag &=
|
||||
+ rte_cpu_to_le_16(~HNS3_CMD_FLAG_NEXT);
|
||||
+ else
|
||||
+ desc[i].flag |=
|
||||
+ rte_cpu_to_le_16(HNS3_CMD_FLAG_NEXT);
|
||||
+ }
|
||||
+ memcpy(desc[0].data, req,
|
||||
sizeof(struct hns3_mac_vlan_tbl_entry_cmd));
|
||||
- mc_desc[0].retval = 0;
|
||||
- ret = hns3_cmd_send(hw, mc_desc, HNS3_MC_MAC_VLAN_ADD_DESC_NUM);
|
||||
- resp_code = (rte_le_to_cpu_32(mc_desc[0].data[0]) >> 8) & 0xff;
|
||||
- retval = rte_le_to_cpu_16(mc_desc[0].retval);
|
||||
+ desc[0].retval = 0;
|
||||
+ ret = hns3_cmd_send(hw, desc, desc_num);
|
||||
+ resp_code = (rte_le_to_cpu_32(desc[0].data[0]) >> 8) & 0xff;
|
||||
+ retval = rte_le_to_cpu_16(desc[0].retval);
|
||||
|
||||
cfg_status = hns3_get_mac_vlan_cmd_status(hw, retval, resp_code,
|
||||
HNS3_MAC_VLAN_ADD);
|
||||
@@ -1540,7 +1545,7 @@ hns3_add_uc_addr_common(struct hns3_hw *hw, struct rte_ether_addr *mac_addr)
|
||||
struct hns3_adapter *hns = HNS3_DEV_HW_TO_ADAPTER(hw);
|
||||
struct hns3_mac_vlan_tbl_entry_cmd req;
|
||||
struct hns3_pf *pf = &hns->pf;
|
||||
- struct hns3_cmd_desc desc[3];
|
||||
+ struct hns3_cmd_desc desc;
|
||||
char mac_str[RTE_ETHER_ADDR_FMT_SIZE];
|
||||
uint16_t egress_port = 0;
|
||||
uint8_t vf_id;
|
||||
@@ -1574,10 +1579,12 @@ hns3_add_uc_addr_common(struct hns3_hw *hw, struct rte_ether_addr *mac_addr)
|
||||
* it if the entry is inexistent. Repeated unicast entry
|
||||
* is not allowed in the mac vlan table.
|
||||
*/
|
||||
- ret = hns3_lookup_mac_vlan_tbl(hw, &req, desc, false);
|
||||
+ ret = hns3_lookup_mac_vlan_tbl(hw, &req, &desc,
|
||||
+ HNS3_UC_MAC_VLAN_OPS_DESC_NUM);
|
||||
if (ret == -ENOENT) {
|
||||
if (!hns3_is_umv_space_full(hw)) {
|
||||
- ret = hns3_add_mac_vlan_tbl(hw, &req, NULL);
|
||||
+ ret = hns3_add_mac_vlan_tbl(hw, &req, &desc,
|
||||
+ HNS3_UC_MAC_VLAN_OPS_DESC_NUM);
|
||||
if (!ret)
|
||||
hns3_update_umv_space(hw, false);
|
||||
return ret;
|
||||
@@ -1867,8 +1874,8 @@ hns3_update_desc_vfid(struct hns3_cmd_desc *desc, uint8_t vfid, bool clr)
|
||||
static int
|
||||
hns3_add_mc_addr(struct hns3_hw *hw, struct rte_ether_addr *mac_addr)
|
||||
{
|
||||
+ struct hns3_cmd_desc desc[HNS3_MC_MAC_VLAN_OPS_DESC_NUM];
|
||||
struct hns3_mac_vlan_tbl_entry_cmd req;
|
||||
- struct hns3_cmd_desc desc[3];
|
||||
char mac_str[RTE_ETHER_ADDR_FMT_SIZE];
|
||||
uint8_t vf_id;
|
||||
int ret;
|
||||
@@ -1885,7 +1892,8 @@ hns3_add_mc_addr(struct hns3_hw *hw, struct rte_ether_addr *mac_addr)
|
||||
memset(&req, 0, sizeof(req));
|
||||
hns3_set_bit(req.entry_type, HNS3_MAC_VLAN_BIT0_EN_B, 0);
|
||||
hns3_prepare_mac_addr(&req, mac_addr->addr_bytes, true);
|
||||
- ret = hns3_lookup_mac_vlan_tbl(hw, &req, desc, true);
|
||||
+ ret = hns3_lookup_mac_vlan_tbl(hw, &req, desc,
|
||||
+ HNS3_MC_MAC_VLAN_OPS_DESC_NUM);
|
||||
if (ret) {
|
||||
/* This mac addr do not exist, add new entry for it */
|
||||
memset(desc[0].data, 0, sizeof(desc[0].data));
|
||||
@@ -1899,7 +1907,8 @@ hns3_add_mc_addr(struct hns3_hw *hw, struct rte_ether_addr *mac_addr)
|
||||
*/
|
||||
vf_id = HNS3_PF_FUNC_ID;
|
||||
hns3_update_desc_vfid(desc, vf_id, false);
|
||||
- ret = hns3_add_mac_vlan_tbl(hw, &req, desc);
|
||||
+ ret = hns3_add_mac_vlan_tbl(hw, &req, desc,
|
||||
+ HNS3_MC_MAC_VLAN_OPS_DESC_NUM);
|
||||
if (ret) {
|
||||
if (ret == -ENOSPC)
|
||||
hns3_err(hw, "mc mac vlan table is full");
|
||||
@@ -1932,7 +1941,8 @@ hns3_remove_mc_addr(struct hns3_hw *hw, struct rte_ether_addr *mac_addr)
|
||||
memset(&req, 0, sizeof(req));
|
||||
hns3_set_bit(req.entry_type, HNS3_MAC_VLAN_BIT0_EN_B, 0);
|
||||
hns3_prepare_mac_addr(&req, mac_addr->addr_bytes, true);
|
||||
- ret = hns3_lookup_mac_vlan_tbl(hw, &req, desc, true);
|
||||
+ ret = hns3_lookup_mac_vlan_tbl(hw, &req, desc,
|
||||
+ HNS3_MC_MAC_VLAN_OPS_DESC_NUM);
|
||||
if (ret == 0) {
|
||||
/*
|
||||
* This mac addr exist, remove this handle's VFID for it.
|
||||
--
|
||||
2.23.0
|
||||
|
||||
@ -0,0 +1,84 @@
|
||||
From 19dc6356916c60f282b6d3046f5d2f1d74d48d35 Mon Sep 17 00:00:00 2001
|
||||
From: Chengchang Tang <tangchengchang@huawei.com>
|
||||
Date: Wed, 22 Sep 2021 15:09:12 +0800
|
||||
Subject: [PATCH 10/17] net/bonding: fix dedicated queue mode in vector burst
|
||||
|
||||
If the vector burst mode is selected, the dedicated queue mode will not
|
||||
take effect on some PMDs because these PMDs may have some limitations
|
||||
in vector burst mode. For example, the limit on burst size. Currently,
|
||||
both hns3 and intel I40E require four alignments when receiving packets
|
||||
in vector mode. As a result, they can't accept packets if burst size
|
||||
below four. However, in dedicated queue mode, the burst size of periodic
|
||||
packets processing is one.
|
||||
|
||||
This patch fixes the above problem by modifying the burst size to 32.
|
||||
This approach also makes the packet processing of the dedicated queue
|
||||
mode more reasonable. Currently, if multiple LACP protocol packets are
|
||||
received in the hardware queue in a cycle, only one LACP packet will be
|
||||
processed in this cycle, and the left packets will be processed in the
|
||||
following cycle. After the modification, all the LACP packets will be
|
||||
processed at one time, which seems more reasonable and closer to the
|
||||
behavior of the bonding driver when the dedicated queue is not turned on.
|
||||
|
||||
Fixes: 112891cd27e5 ("net/bonding: add dedicated HW queues for LACP control")
|
||||
Cc: stable@dpdk.org
|
||||
|
||||
Signed-off-by: Chengchang Tang <tangchengchang@huawei.com>
|
||||
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
|
||||
---
|
||||
drivers/net/bonding/rte_eth_bond_8023ad.c | 32 ++++++++++++++++-------
|
||||
1 file changed, 23 insertions(+), 9 deletions(-)
|
||||
|
||||
diff --git a/drivers/net/bonding/rte_eth_bond_8023ad.c b/drivers/net/bonding/rte_eth_bond_8023ad.c
|
||||
index 67ca0730f..0bcce6652 100644
|
||||
--- a/drivers/net/bonding/rte_eth_bond_8023ad.c
|
||||
+++ b/drivers/net/bonding/rte_eth_bond_8023ad.c
|
||||
@@ -823,6 +823,27 @@ rx_machine_update(struct bond_dev_private *internals, uint16_t slave_id,
|
||||
rx_machine(internals, slave_id, NULL);
|
||||
}
|
||||
|
||||
+static void
|
||||
+bond_mode_8023ad_dedicated_rxq_process(struct bond_dev_private *internals,
|
||||
+ uint16_t slave_id)
|
||||
+{
|
||||
+#define DEDICATED_QUEUE_BURST_SIZE 32
|
||||
+ struct rte_mbuf *lacp_pkt[DEDICATED_QUEUE_BURST_SIZE];
|
||||
+ uint16_t rx_count = rte_eth_rx_burst(slave_id,
|
||||
+ internals->mode4.dedicated_queues.rx_qid,
|
||||
+ lacp_pkt, DEDICATED_QUEUE_BURST_SIZE);
|
||||
+
|
||||
+ if (rx_count) {
|
||||
+ uint16_t i;
|
||||
+
|
||||
+ for (i = 0; i < rx_count; i++)
|
||||
+ bond_mode_8023ad_handle_slow_pkt(internals, slave_id,
|
||||
+ lacp_pkt[i]);
|
||||
+ } else {
|
||||
+ rx_machine_update(internals, slave_id, NULL);
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
static void
|
||||
bond_mode_8023ad_periodic_cb(void *arg)
|
||||
{
|
||||
@@ -911,15 +932,8 @@ bond_mode_8023ad_periodic_cb(void *arg)
|
||||
|
||||
rx_machine_update(internals, slave_id, lacp_pkt);
|
||||
} else {
|
||||
- uint16_t rx_count = rte_eth_rx_burst(slave_id,
|
||||
- internals->mode4.dedicated_queues.rx_qid,
|
||||
- &lacp_pkt, 1);
|
||||
-
|
||||
- if (rx_count == 1)
|
||||
- bond_mode_8023ad_handle_slow_pkt(internals,
|
||||
- slave_id, lacp_pkt);
|
||||
- else
|
||||
- rx_machine_update(internals, slave_id, NULL);
|
||||
+ bond_mode_8023ad_dedicated_rxq_process(internals,
|
||||
+ slave_id);
|
||||
}
|
||||
|
||||
periodic_machine(internals, slave_id);
|
||||
--
|
||||
2.23.0
|
||||
|
||||
143
0224-net-bonding-fix-RSS-key-length.patch
Normal file
143
0224-net-bonding-fix-RSS-key-length.patch
Normal file
@ -0,0 +1,143 @@
|
||||
From 464bfbd345224ddb04399297988c0d99cbe8acc6 Mon Sep 17 00:00:00 2001
|
||||
From: Chengchang Tang <tangchengchang@huawei.com>
|
||||
Date: Wed, 22 Sep 2021 15:09:13 +0800
|
||||
Subject: [PATCH 11/17] net/bonding: fix RSS key length
|
||||
|
||||
Currently the hash_key_size information has not been set. So, apps can
|
||||
not get the key size from dev_info(), this make some problem.
|
||||
|
||||
e.g, in testpmd, the hash_key_size will be checked before configure
|
||||
or get the hash key:
|
||||
testpmd> show port 4 rss-hash
|
||||
dev_info did not provide a valid hash key size
|
||||
testpmd> show port 4 rss-hash key
|
||||
dev_info did not provide a valid hash key size
|
||||
testpmd> port config 4 rss-hash-key ipv4 (hash key)
|
||||
dev_info did not provide a valid hash key size
|
||||
|
||||
In this patch, the meaning of rss_key_len has been modified. It only
|
||||
indicated the length of the configured hash key before. Therefore,
|
||||
its value depends on the user's configuration. This seems unreasonable.
|
||||
And now, it indicates the minimum hash key length required by the
|
||||
bonded device. Its value will be the shortest hash key among all slave
|
||||
drivers.
|
||||
|
||||
Fixes: 734ce47f71e0 ("bonding: support RSS dynamic configuration")
|
||||
Cc: stable@dpdk.org
|
||||
|
||||
Signed-off-by: Chengchang Tang <tangchengchang@huawei.com>
|
||||
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
|
||||
---
|
||||
drivers/net/bonding/rte_eth_bond_api.c | 6 ++++
|
||||
drivers/net/bonding/rte_eth_bond_pmd.c | 44 ++++++++++++++++----------
|
||||
2 files changed, 33 insertions(+), 17 deletions(-)
|
||||
|
||||
diff --git a/drivers/net/bonding/rte_eth_bond_api.c b/drivers/net/bonding/rte_eth_bond_api.c
|
||||
index 44775f61e..c751a1242 100644
|
||||
--- a/drivers/net/bonding/rte_eth_bond_api.c
|
||||
+++ b/drivers/net/bonding/rte_eth_bond_api.c
|
||||
@@ -290,6 +290,7 @@ eth_bond_slave_inherit_dev_info_rx_first(struct bond_dev_private *internals,
|
||||
struct rte_eth_rxconf *rxconf_i = &internals->default_rxconf;
|
||||
|
||||
internals->reta_size = di->reta_size;
|
||||
+ internals->rss_key_len = di->hash_key_size;
|
||||
|
||||
/* Inherit Rx offload capabilities from the first slave device */
|
||||
internals->rx_offload_capa = di->rx_offload_capa;
|
||||
@@ -385,6 +386,11 @@ eth_bond_slave_inherit_dev_info_rx_next(struct bond_dev_private *internals,
|
||||
*/
|
||||
if (internals->reta_size > di->reta_size)
|
||||
internals->reta_size = di->reta_size;
|
||||
+ if (internals->rss_key_len > di->hash_key_size) {
|
||||
+ RTE_BOND_LOG(WARNING, "slave has different rss key size, "
|
||||
+ "configuring rss may fail");
|
||||
+ internals->rss_key_len = di->hash_key_size;
|
||||
+ }
|
||||
|
||||
if (!internals->max_rx_pktlen &&
|
||||
di->max_rx_pktlen < internals->candidate_max_rx_pktlen)
|
||||
diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c b/drivers/net/bonding/rte_eth_bond_pmd.c
|
||||
index 057b1ada5..c21df6d6f 100644
|
||||
--- a/drivers/net/bonding/rte_eth_bond_pmd.c
|
||||
+++ b/drivers/net/bonding/rte_eth_bond_pmd.c
|
||||
@@ -1705,14 +1705,11 @@ slave_configure(struct rte_eth_dev *bonded_eth_dev,
|
||||
|
||||
/* If RSS is enabled for bonding, try to enable it for slaves */
|
||||
if (bonded_eth_dev->data->dev_conf.rxmode.mq_mode & ETH_MQ_RX_RSS_FLAG) {
|
||||
- if (internals->rss_key_len != 0) {
|
||||
- slave_eth_dev->data->dev_conf.rx_adv_conf.rss_conf.rss_key_len =
|
||||
+ /* rss_key won't be empty if RSS is configured in bonded dev */
|
||||
+ slave_eth_dev->data->dev_conf.rx_adv_conf.rss_conf.rss_key_len =
|
||||
internals->rss_key_len;
|
||||
- slave_eth_dev->data->dev_conf.rx_adv_conf.rss_conf.rss_key =
|
||||
+ slave_eth_dev->data->dev_conf.rx_adv_conf.rss_conf.rss_key =
|
||||
internals->rss_key;
|
||||
- } else {
|
||||
- slave_eth_dev->data->dev_conf.rx_adv_conf.rss_conf.rss_key = NULL;
|
||||
- }
|
||||
|
||||
slave_eth_dev->data->dev_conf.rx_adv_conf.rss_conf.rss_hf =
|
||||
bonded_eth_dev->data->dev_conf.rx_adv_conf.rss_conf.rss_hf;
|
||||
@@ -2234,6 +2231,7 @@ bond_ethdev_info(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
|
||||
dev_info->flow_type_rss_offloads = internals->flow_type_rss_offloads;
|
||||
|
||||
dev_info->reta_size = internals->reta_size;
|
||||
+ dev_info->hash_key_size = internals->rss_key_len;
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -3023,13 +3021,15 @@ bond_ethdev_rss_hash_update(struct rte_eth_dev *dev,
|
||||
if (bond_rss_conf.rss_hf != 0)
|
||||
dev->data->dev_conf.rx_adv_conf.rss_conf.rss_hf = bond_rss_conf.rss_hf;
|
||||
|
||||
- if (bond_rss_conf.rss_key && bond_rss_conf.rss_key_len <
|
||||
- sizeof(internals->rss_key)) {
|
||||
- if (bond_rss_conf.rss_key_len == 0)
|
||||
- bond_rss_conf.rss_key_len = 40;
|
||||
- internals->rss_key_len = bond_rss_conf.rss_key_len;
|
||||
+ if (bond_rss_conf.rss_key) {
|
||||
+ if (bond_rss_conf.rss_key_len < internals->rss_key_len)
|
||||
+ return -EINVAL;
|
||||
+ else if (bond_rss_conf.rss_key_len > internals->rss_key_len)
|
||||
+ RTE_BOND_LOG(WARNING, "rss_key will be truncated");
|
||||
+
|
||||
memcpy(internals->rss_key, bond_rss_conf.rss_key,
|
||||
internals->rss_key_len);
|
||||
+ bond_rss_conf.rss_key_len = internals->rss_key_len;
|
||||
}
|
||||
|
||||
for (i = 0; i < internals->slave_count; i++) {
|
||||
@@ -3491,14 +3491,24 @@ bond_ethdev_configure(struct rte_eth_dev *dev)
|
||||
* Fall back to default RSS key if the key is not specified
|
||||
*/
|
||||
if (dev->data->dev_conf.rxmode.mq_mode & ETH_MQ_RX_RSS) {
|
||||
- if (dev->data->dev_conf.rx_adv_conf.rss_conf.rss_key != NULL) {
|
||||
- internals->rss_key_len =
|
||||
- dev->data->dev_conf.rx_adv_conf.rss_conf.rss_key_len;
|
||||
- memcpy(internals->rss_key,
|
||||
- dev->data->dev_conf.rx_adv_conf.rss_conf.rss_key,
|
||||
+ struct rte_eth_rss_conf *rss_conf =
|
||||
+ &dev->data->dev_conf.rx_adv_conf.rss_conf;
|
||||
+ if (rss_conf->rss_key != NULL) {
|
||||
+ if (internals->rss_key_len > rss_conf->rss_key_len) {
|
||||
+ RTE_BOND_LOG(ERR, "Invalid rss key length(%u)",
|
||||
+ rss_conf->rss_key_len);
|
||||
+ return -EINVAL;
|
||||
+ }
|
||||
+
|
||||
+ memcpy(internals->rss_key, rss_conf->rss_key,
|
||||
internals->rss_key_len);
|
||||
} else {
|
||||
- internals->rss_key_len = sizeof(default_rss_key);
|
||||
+ if (internals->rss_key_len > sizeof(default_rss_key)) {
|
||||
+ RTE_BOND_LOG(ERR,
|
||||
+ "There is no suitable default hash key");
|
||||
+ return -EINVAL;
|
||||
+ }
|
||||
+
|
||||
memcpy(internals->rss_key, default_rss_key,
|
||||
internals->rss_key_len);
|
||||
}
|
||||
--
|
||||
2.23.0
|
||||
|
||||
247
0225-app-testpmd-add-command-to-show-LACP-bonding-info.patch
Normal file
247
0225-app-testpmd-add-command-to-show-LACP-bonding-info.patch
Normal file
@ -0,0 +1,247 @@
|
||||
From 992fb12f5a2061144190986a1a82c64f9b324e5b Mon Sep 17 00:00:00 2001
|
||||
From: Chengchang Tang <tangchengchang@huawei.com>
|
||||
Date: Fri, 24 Sep 2021 17:57:20 +0800
|
||||
Subject: [PATCH 12/17] app/testpmd: add command to show LACP bonding info
|
||||
|
||||
Add a new cmdline to help diagnostic the bonding mode 4 in testpmd.
|
||||
|
||||
Show the lacp information about the bonded device and its slaves:
|
||||
show bonding lacp info <bonded device port_id>
|
||||
|
||||
Signed-off-by: Chengchang Tang <tangchengchang@huawei.com>
|
||||
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
|
||||
Acked-by: Xiaoyun Li <xiaoyun.li@intel.com>
|
||||
---
|
||||
app/test-pmd/cmdline.c | 184 ++++++++++++++++++++
|
||||
doc/guides/testpmd_app_ug/testpmd_funcs.rst | 6 +
|
||||
2 files changed, 190 insertions(+)
|
||||
|
||||
diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
|
||||
index b69c648bf..5691fab94 100644
|
||||
--- a/app/test-pmd/cmdline.c
|
||||
+++ b/app/test-pmd/cmdline.c
|
||||
@@ -631,6 +631,9 @@ static void cmd_help_long_parsed(void *parsed_result,
|
||||
"show bonding config (port_id)\n"
|
||||
" Show the bonding config for port_id.\n\n"
|
||||
|
||||
+ "show bonding lacp info (port_id)\n"
|
||||
+ " Show the bonding lacp information for port_id.\n\n"
|
||||
+
|
||||
"set bonding mac_addr (port_id) (address)\n"
|
||||
" Set the MAC address of a bonded device.\n\n"
|
||||
|
||||
@@ -6040,6 +6043,186 @@ cmdline_parse_inst_t cmd_set_balance_xmit_policy = {
|
||||
}
|
||||
};
|
||||
|
||||
+/* *** SHOW IEEE802.3 BONDING INFORMATION *** */
|
||||
+struct cmd_show_bonding_lacp_info_result {
|
||||
+ cmdline_fixed_string_t show;
|
||||
+ cmdline_fixed_string_t bonding;
|
||||
+ cmdline_fixed_string_t lacp;
|
||||
+ cmdline_fixed_string_t info;
|
||||
+ portid_t port_id;
|
||||
+};
|
||||
+
|
||||
+static void port_param_show(struct port_params *params)
|
||||
+{
|
||||
+ char buf[RTE_ETHER_ADDR_FMT_SIZE];
|
||||
+
|
||||
+ printf("\t\tsystem priority: %u\n", params->system_priority);
|
||||
+ rte_ether_format_addr(buf, RTE_ETHER_ADDR_FMT_SIZE, ¶ms->system);
|
||||
+ printf("\t\tsystem mac address: %s\n", buf);
|
||||
+ printf("\t\tport key: %u\n", params->key);
|
||||
+ printf("\t\tport priority: %u\n", params->port_priority);
|
||||
+ printf("\t\tport number: %u\n", params->port_number);
|
||||
+}
|
||||
+
|
||||
+static void lacp_slave_info_show(struct rte_eth_bond_8023ad_slave_info *info)
|
||||
+{
|
||||
+ char a_state[256] = { 0 };
|
||||
+ char p_state[256] = { 0 };
|
||||
+ int a_len = 0;
|
||||
+ int p_len = 0;
|
||||
+ uint32_t i;
|
||||
+
|
||||
+ static const char * const state[] = {
|
||||
+ "ACTIVE",
|
||||
+ "TIMEOUT",
|
||||
+ "AGGREGATION",
|
||||
+ "SYNCHRONIZATION",
|
||||
+ "COLLECTING",
|
||||
+ "DISTRIBUTING",
|
||||
+ "DEFAULTED",
|
||||
+ "EXPIRED"
|
||||
+ };
|
||||
+ static const char * const selection[] = {
|
||||
+ "UNSELECTED",
|
||||
+ "STANDBY",
|
||||
+ "SELECTED"
|
||||
+ };
|
||||
+
|
||||
+ for (i = 0; i < RTE_DIM(state); i++) {
|
||||
+ if ((info->actor_state >> i) & 1)
|
||||
+ a_len += snprintf(&a_state[a_len],
|
||||
+ RTE_DIM(a_state) - a_len, "%s ",
|
||||
+ state[i]);
|
||||
+
|
||||
+ if ((info->partner_state >> i) & 1)
|
||||
+ p_len += snprintf(&p_state[p_len],
|
||||
+ RTE_DIM(p_state) - p_len, "%s ",
|
||||
+ state[i]);
|
||||
+ }
|
||||
+ printf("\tAggregator port id: %u\n", info->agg_port_id);
|
||||
+ printf("\tselection: %s\n", selection[info->selected]);
|
||||
+ printf("\tActor detail info:\n");
|
||||
+ port_param_show(&info->actor);
|
||||
+ printf("\t\tport state: %s\n", a_state);
|
||||
+ printf("\tPartner detail info:\n");
|
||||
+ port_param_show(&info->partner);
|
||||
+ printf("\t\tport state: %s\n", p_state);
|
||||
+ printf("\n");
|
||||
+}
|
||||
+
|
||||
+static void lacp_conf_show(struct rte_eth_bond_8023ad_conf *conf)
|
||||
+{
|
||||
+ printf("\tfast period: %u ms\n", conf->fast_periodic_ms);
|
||||
+ printf("\tslow period: %u ms\n", conf->slow_periodic_ms);
|
||||
+ printf("\tshort timeout: %u ms\n", conf->short_timeout_ms);
|
||||
+ printf("\tlong timeout: %u ms\n", conf->long_timeout_ms);
|
||||
+ printf("\taggregate wait timeout: %u ms\n",
|
||||
+ conf->aggregate_wait_timeout_ms);
|
||||
+ printf("\ttx period: %u ms\n", conf->tx_period_ms);
|
||||
+ printf("\trx marker period: %u ms\n", conf->rx_marker_period_ms);
|
||||
+ printf("\tupdate timeout: %u ms\n", conf->update_timeout_ms);
|
||||
+ switch (conf->agg_selection) {
|
||||
+ case AGG_BANDWIDTH:
|
||||
+ printf("\taggregation mode: bandwidth\n");
|
||||
+ break;
|
||||
+ case AGG_STABLE:
|
||||
+ printf("\taggregation mode: stable\n");
|
||||
+ break;
|
||||
+ case AGG_COUNT:
|
||||
+ printf("\taggregation mode: count\n");
|
||||
+ break;
|
||||
+ default:
|
||||
+ printf("\taggregation mode: invalid\n");
|
||||
+ break;
|
||||
+ }
|
||||
+
|
||||
+ printf("\n");
|
||||
+}
|
||||
+
|
||||
+static void cmd_show_bonding_lacp_info_parsed(void *parsed_result,
|
||||
+ __rte_unused struct cmdline *cl,
|
||||
+ __rte_unused void *data)
|
||||
+{
|
||||
+ struct cmd_show_bonding_lacp_info_result *res = parsed_result;
|
||||
+ struct rte_eth_bond_8023ad_slave_info slave_info;
|
||||
+ struct rte_eth_bond_8023ad_conf port_conf;
|
||||
+ portid_t slaves[RTE_MAX_ETHPORTS];
|
||||
+ portid_t port_id = res->port_id;
|
||||
+ int num_active_slaves;
|
||||
+ int bonding_mode;
|
||||
+ int i;
|
||||
+ int ret;
|
||||
+
|
||||
+ bonding_mode = rte_eth_bond_mode_get(port_id);
|
||||
+ if (bonding_mode != BONDING_MODE_8023AD) {
|
||||
+ fprintf(stderr, "\tBonding mode is not mode 4\n");
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ num_active_slaves = rte_eth_bond_active_slaves_get(port_id, slaves,
|
||||
+ RTE_MAX_ETHPORTS);
|
||||
+ if (num_active_slaves < 0) {
|
||||
+ fprintf(stderr, "\tFailed to get active slave list for port = %u\n",
|
||||
+ port_id);
|
||||
+ return;
|
||||
+ }
|
||||
+ if (num_active_slaves == 0)
|
||||
+ fprintf(stderr, "\tIEEE802.3 port %u has no active slave\n",
|
||||
+ port_id);
|
||||
+
|
||||
+ printf("\tIEEE802.3 port: %u\n", port_id);
|
||||
+ ret = rte_eth_bond_8023ad_conf_get(port_id, &port_conf);
|
||||
+ if (ret) {
|
||||
+ fprintf(stderr, "\tGet bonded device %u info failed\n",
|
||||
+ port_id);
|
||||
+ return;
|
||||
+ }
|
||||
+ lacp_conf_show(&port_conf);
|
||||
+
|
||||
+ for (i = 0; i < num_active_slaves; i++) {
|
||||
+ ret = rte_eth_bond_8023ad_slave_info(port_id, slaves[i],
|
||||
+ &slave_info);
|
||||
+ if (ret) {
|
||||
+ fprintf(stderr, "\tGet slave device %u info failed\n",
|
||||
+ slaves[i]);
|
||||
+ return;
|
||||
+ }
|
||||
+ printf("\tSlave Port: %u\n", slaves[i]);
|
||||
+ lacp_slave_info_show(&slave_info);
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+cmdline_parse_token_string_t cmd_show_bonding_lacp_info_show =
|
||||
+TOKEN_STRING_INITIALIZER(struct cmd_show_bonding_lacp_info_result,
|
||||
+ show, "show");
|
||||
+cmdline_parse_token_string_t cmd_show_bonding_lacp_info_bonding =
|
||||
+TOKEN_STRING_INITIALIZER(struct cmd_show_bonding_lacp_info_result,
|
||||
+ bonding, "bonding");
|
||||
+cmdline_parse_token_string_t cmd_show_bonding_lacp_info_lacp =
|
||||
+TOKEN_STRING_INITIALIZER(struct cmd_show_bonding_lacp_info_result,
|
||||
+ bonding, "lacp");
|
||||
+cmdline_parse_token_string_t cmd_show_bonding_lacp_info_info =
|
||||
+TOKEN_STRING_INITIALIZER(struct cmd_show_bonding_lacp_info_result,
|
||||
+ info, "info");
|
||||
+cmdline_parse_token_num_t cmd_show_bonding_lacp_info_port_id =
|
||||
+TOKEN_NUM_INITIALIZER(struct cmd_show_bonding_lacp_info_result,
|
||||
+ port_id, RTE_UINT16);
|
||||
+
|
||||
+cmdline_parse_inst_t cmd_show_bonding_lacp_info = {
|
||||
+ .f = cmd_show_bonding_lacp_info_parsed,
|
||||
+ .help_str = "show bonding lacp info <port_id> : "
|
||||
+ "Show bonding IEEE802.3 information for port_id",
|
||||
+ .data = NULL,
|
||||
+ .tokens = {
|
||||
+ (void *)&cmd_show_bonding_lacp_info_show,
|
||||
+ (void *)&cmd_show_bonding_lacp_info_bonding,
|
||||
+ (void *)&cmd_show_bonding_lacp_info_lacp,
|
||||
+ (void *)&cmd_show_bonding_lacp_info_info,
|
||||
+ (void *)&cmd_show_bonding_lacp_info_port_id,
|
||||
+ NULL
|
||||
+ }
|
||||
+};
|
||||
+
|
||||
/* *** SHOW NIC BONDING CONFIGURATION *** */
|
||||
struct cmd_show_bonding_config_result {
|
||||
cmdline_fixed_string_t show;
|
||||
@@ -17027,6 +17210,7 @@ cmdline_parse_ctx_t main_ctx[] = {
|
||||
#ifdef RTE_NET_BOND
|
||||
(cmdline_parse_inst_t *) &cmd_set_bonding_mode,
|
||||
(cmdline_parse_inst_t *) &cmd_show_bonding_config,
|
||||
+ (cmdline_parse_inst_t *) &cmd_show_bonding_lacp_info,
|
||||
(cmdline_parse_inst_t *) &cmd_set_bonding_primary,
|
||||
(cmdline_parse_inst_t *) &cmd_add_bonding_slave,
|
||||
(cmdline_parse_inst_t *) &cmd_remove_bonding_slave,
|
||||
diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
|
||||
index f0e04232a..d5e85b083 100644
|
||||
--- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst
|
||||
+++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
|
||||
@@ -2609,6 +2609,12 @@ in balance mode with a transmission policy of layer 2+3::
|
||||
Active Slaves (3): [1 3 4]
|
||||
Primary: [3]
|
||||
|
||||
+show bonding lacp info
|
||||
+~~~~~~~~~~~~~~~~~~~~~~
|
||||
+
|
||||
+Show information about the Link Bonding device in mode 4 (link-aggregation-802.3ad)::
|
||||
+
|
||||
+ testpmd> show bonding lacp info (port_id)
|
||||
|
||||
Register Functions
|
||||
------------------
|
||||
--
|
||||
2.23.0
|
||||
|
||||
@ -0,0 +1,40 @@
|
||||
From 65de76da4d8fc270af6bce73334399d0d3c20fa3 Mon Sep 17 00:00:00 2001
|
||||
From: Huisong Li <lihuisong@huawei.com>
|
||||
Date: Mon, 11 Oct 2021 17:12:46 +0800
|
||||
Subject: [PATCH 13/17] app/testpmd: retain all original dev conf when config
|
||||
DCB
|
||||
|
||||
When configuring DCB, testpmd retains the rx_mode/tx_mode configuration in
|
||||
rte_port->dev_conf. But some configurations, such as the link_speed, were
|
||||
not saved if they were set before configuring DCB.
|
||||
|
||||
Fixes: 1a572499beb6 ("app/testpmd: setup DCB forwarding based on traffic class")
|
||||
Cc: stable@dpdk.org
|
||||
|
||||
Signed-off-by: Huisong Li <lihuisong@huawei.com>
|
||||
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
|
||||
Acked-by: Xiaoyun Li <xiaoyun.li@intel.com>
|
||||
---
|
||||
app/test-pmd/testpmd.c | 6 ++----
|
||||
1 file changed, 2 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
|
||||
index 3098df6c5..0eaa4852d 100644
|
||||
--- a/app/test-pmd/testpmd.c
|
||||
+++ b/app/test-pmd/testpmd.c
|
||||
@@ -3484,10 +3484,8 @@ init_port_dcb_config(portid_t pid,
|
||||
|
||||
rte_port = &ports[pid];
|
||||
|
||||
- memset(&port_conf, 0, sizeof(struct rte_eth_conf));
|
||||
-
|
||||
- port_conf.rxmode = rte_port->dev_conf.rxmode;
|
||||
- port_conf.txmode = rte_port->dev_conf.txmode;
|
||||
+ /* retain the original device configuration. */
|
||||
+ memcpy(&port_conf, &rte_port->dev_conf, sizeof(struct rte_eth_conf));
|
||||
|
||||
/*set configuration of DCB in vt mode and DCB in non-vt mode*/
|
||||
retval = get_eth_dcb_conf(pid, &port_conf, dcb_mode, num_tcs, pfc_en);
|
||||
--
|
||||
2.23.0
|
||||
|
||||
593
0227-net-hns3-remove-similar-macro-function-definitions.patch
Normal file
593
0227-net-hns3-remove-similar-macro-function-definitions.patch
Normal file
@ -0,0 +1,593 @@
|
||||
From 637fc8040d4aa52eba9c7c78a5c826f4a13c4da0 Mon Sep 17 00:00:00 2001
|
||||
From: Chengchang Tang <tangchengchang@huawei.com>
|
||||
Date: Sat, 9 Oct 2021 15:48:05 +0800
|
||||
Subject: [PATCH 14/17] net/hns3: remove similar macro function definitions
|
||||
|
||||
For different capabilities, we declare different macro functions to
|
||||
determine whether the capabilities are supported.
|
||||
|
||||
This patch declare a unified macro function to judge capabilities.
|
||||
|
||||
Signed-off-by: Chengchang Tang <tangchengchang@huawei.com>
|
||||
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
|
||||
---
|
||||
drivers/net/hns3/hns3_cmd.c | 6 ++---
|
||||
drivers/net/hns3/hns3_dcb.c | 4 +--
|
||||
drivers/net/hns3/hns3_ethdev.c | 24 +++++++++---------
|
||||
drivers/net/hns3/hns3_ethdev.h | 41 ++-----------------------------
|
||||
drivers/net/hns3/hns3_ethdev_vf.c | 6 ++---
|
||||
drivers/net/hns3/hns3_flow.c | 2 +-
|
||||
drivers/net/hns3/hns3_intr.c | 2 +-
|
||||
drivers/net/hns3/hns3_ptp.c | 18 +++++++-------
|
||||
drivers/net/hns3/hns3_rxtx.c | 32 ++++++++++++------------
|
||||
drivers/net/hns3/hns3_rxtx_vec.c | 4 +--
|
||||
drivers/net/hns3/hns3_tm.c | 10 ++++----
|
||||
11 files changed, 56 insertions(+), 93 deletions(-)
|
||||
|
||||
diff --git a/drivers/net/hns3/hns3_cmd.c b/drivers/net/hns3/hns3_cmd.c
|
||||
index cfa943523..6e49108d2 100644
|
||||
--- a/drivers/net/hns3/hns3_cmd.c
|
||||
+++ b/drivers/net/hns3/hns3_cmd.c
|
||||
@@ -619,7 +619,7 @@ hns3_update_dev_lsc_cap(struct hns3_hw *hw, int fw_compact_cmd_result)
|
||||
static int
|
||||
hns3_apply_fw_compat_cmd_result(struct hns3_hw *hw, int result)
|
||||
{
|
||||
- if (result != 0 && hns3_dev_copper_supported(hw)) {
|
||||
+ if (result != 0 && hns3_dev_get_support(hw, COPPER)) {
|
||||
hns3_err(hw, "firmware fails to initialize the PHY, ret = %d.",
|
||||
result);
|
||||
return result;
|
||||
@@ -658,7 +658,7 @@ hns3_firmware_compat_config(struct hns3_hw *hw, bool is_init)
|
||||
}
|
||||
if (revision == PCI_REVISION_ID_HIP09_A) {
|
||||
struct hns3_pf *pf = HNS3_DEV_HW_TO_PF(hw);
|
||||
- if (hns3_dev_copper_supported(hw) == 0 || pf->is_tmp_phy) {
|
||||
+ if (hns3_dev_get_support(hw, COPPER) == 0 || pf->is_tmp_phy) {
|
||||
PMD_INIT_LOG(ERR, "***use temp phy driver in dpdk***");
|
||||
pf->is_tmp_phy = true;
|
||||
hns3_set_bit(hw->capability,
|
||||
@@ -676,7 +676,7 @@ hns3_firmware_compat_config(struct hns3_hw *hw, bool is_init)
|
||||
if (is_init) {
|
||||
hns3_set_bit(compat, HNS3_LINK_EVENT_REPORT_EN_B, 1);
|
||||
hns3_set_bit(compat, HNS3_NCSI_ERROR_REPORT_EN_B, 0);
|
||||
- if (hns3_dev_copper_supported(hw))
|
||||
+ if (hns3_dev_get_support(hw, COPPER))
|
||||
hns3_set_bit(compat, HNS3_FIRMWARE_PHY_DRIVER_EN_B, 1);
|
||||
}
|
||||
req->compat = rte_cpu_to_le_32(compat);
|
||||
diff --git a/drivers/net/hns3/hns3_dcb.c b/drivers/net/hns3/hns3_dcb.c
|
||||
index b71e2e9ea..8753c340e 100644
|
||||
--- a/drivers/net/hns3/hns3_dcb.c
|
||||
+++ b/drivers/net/hns3/hns3_dcb.c
|
||||
@@ -918,7 +918,7 @@ hns3_dcb_pri_dwrr_cfg(struct hns3_hw *hw)
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
- if (!hns3_dev_dcb_supported(hw))
|
||||
+ if (!hns3_dev_get_support(hw, DCB))
|
||||
return 0;
|
||||
|
||||
ret = hns3_dcb_ets_tc_dwrr_cfg(hw);
|
||||
@@ -1368,7 +1368,7 @@ hns3_dcb_pause_setup_hw(struct hns3_hw *hw)
|
||||
}
|
||||
|
||||
/* Only DCB-supported dev supports qset back pressure and pfc cmd */
|
||||
- if (!hns3_dev_dcb_supported(hw))
|
||||
+ if (!hns3_dev_get_support(hw, DCB))
|
||||
return 0;
|
||||
|
||||
ret = hns3_pfc_setup_hw(hw);
|
||||
diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c
|
||||
index 02d68e496..c5c355d95 100644
|
||||
--- a/drivers/net/hns3/hns3_ethdev.c
|
||||
+++ b/drivers/net/hns3/hns3_ethdev.c
|
||||
@@ -2408,7 +2408,7 @@ hns3_setup_dcb(struct rte_eth_dev *dev)
|
||||
struct hns3_hw *hw = &hns->hw;
|
||||
int ret;
|
||||
|
||||
- if (!hns3_dev_dcb_supported(hw)) {
|
||||
+ if (!hns3_dev_get_support(hw, DCB)) {
|
||||
hns3_err(hw, "this port does not support dcb configurations.");
|
||||
return -EOPNOTSUPP;
|
||||
}
|
||||
@@ -2746,14 +2746,14 @@ hns3_dev_infos_get(struct rte_eth_dev *eth_dev, struct rte_eth_dev_info *info)
|
||||
DEV_TX_OFFLOAD_MBUF_FAST_FREE |
|
||||
hns3_txvlan_cap_get(hw));
|
||||
|
||||
- if (hns3_dev_outer_udp_cksum_supported(hw))
|
||||
+ if (hns3_dev_get_support(hw, OUTER_UDP_CKSUM))
|
||||
info->tx_offload_capa |= DEV_TX_OFFLOAD_OUTER_UDP_CKSUM;
|
||||
|
||||
- if (hns3_dev_indep_txrx_supported(hw))
|
||||
+ if (hns3_dev_get_support(hw, INDEP_TXRX))
|
||||
info->dev_capa = RTE_ETH_DEV_CAPA_RUNTIME_RX_QUEUE_SETUP |
|
||||
RTE_ETH_DEV_CAPA_RUNTIME_TX_QUEUE_SETUP;
|
||||
|
||||
- if (hns3_dev_ptp_supported(hw))
|
||||
+ if (hns3_dev_get_support(hw, PTP))
|
||||
info->rx_offload_capa |= DEV_RX_OFFLOAD_TIMESTAMP;
|
||||
|
||||
info->rx_desc_lim = (struct rte_eth_desc_lim) {
|
||||
@@ -3418,7 +3418,7 @@ hns3_check_media_type(struct hns3_hw *hw, uint8_t media_type)
|
||||
|
||||
switch (media_type) {
|
||||
case HNS3_MEDIA_TYPE_COPPER:
|
||||
- if (!hns3_dev_copper_supported(hw)) {
|
||||
+ if (!hns3_dev_get_support(hw, COPPER)) {
|
||||
PMD_INIT_LOG(ERR,
|
||||
"Media type is copper, not supported.");
|
||||
ret = -EOPNOTSUPP;
|
||||
@@ -3486,7 +3486,7 @@ hns3_get_board_configuration(struct hns3_hw *hw)
|
||||
}
|
||||
|
||||
/* Dev does not support DCB */
|
||||
- if (!hns3_dev_dcb_supported(hw)) {
|
||||
+ if (!hns3_dev_get_support(hw, DCB)) {
|
||||
pf->tc_max = 1;
|
||||
pf->pfc_max = 0;
|
||||
} else
|
||||
@@ -3799,7 +3799,7 @@ hns3_is_rx_buf_ok(struct hns3_hw *hw, struct hns3_pkt_buf_alloc *buf_alloc,
|
||||
tc_num = hns3_get_tc_num(hw);
|
||||
aligned_mps = roundup(pf->mps, HNS3_BUF_SIZE_UNIT);
|
||||
|
||||
- if (hns3_dev_dcb_supported(hw))
|
||||
+ if (hns3_dev_get_support(hw, DCB))
|
||||
shared_buf_min = HNS3_BUF_MUL_BY * aligned_mps +
|
||||
pf->dv_buf_size;
|
||||
else
|
||||
@@ -3816,7 +3816,7 @@ hns3_is_rx_buf_ok(struct hns3_hw *hw, struct hns3_pkt_buf_alloc *buf_alloc,
|
||||
|
||||
shared_buf = rounddown(rx_all - rx_priv, HNS3_BUF_SIZE_UNIT);
|
||||
buf_alloc->s_buf.buf_size = shared_buf;
|
||||
- if (hns3_dev_dcb_supported(hw)) {
|
||||
+ if (hns3_dev_get_support(hw, DCB)) {
|
||||
buf_alloc->s_buf.self.high = shared_buf - pf->dv_buf_size;
|
||||
buf_alloc->s_buf.self.low = buf_alloc->s_buf.self.high
|
||||
- roundup(aligned_mps / HNS3_BUF_DIV_BY,
|
||||
@@ -3827,7 +3827,7 @@ hns3_is_rx_buf_ok(struct hns3_hw *hw, struct hns3_pkt_buf_alloc *buf_alloc,
|
||||
buf_alloc->s_buf.self.low = aligned_mps;
|
||||
}
|
||||
|
||||
- if (hns3_dev_dcb_supported(hw)) {
|
||||
+ if (hns3_dev_get_support(hw, DCB)) {
|
||||
hi_thrd = shared_buf - pf->dv_buf_size;
|
||||
|
||||
if (tc_num <= NEED_RESERVE_TC_NUM)
|
||||
@@ -4033,7 +4033,7 @@ static int
|
||||
hns3_rx_buffer_calc(struct hns3_hw *hw, struct hns3_pkt_buf_alloc *buf_alloc)
|
||||
{
|
||||
/* When DCB is not supported, rx private buffer is not allocated. */
|
||||
- if (!hns3_dev_dcb_supported(hw)) {
|
||||
+ if (!hns3_dev_get_support(hw, DCB)) {
|
||||
struct hns3_adapter *hns = HNS3_DEV_HW_TO_ADAPTER(hw);
|
||||
struct hns3_pf *pf = &hns->pf;
|
||||
uint32_t rx_all = pf->pkt_buf_size;
|
||||
@@ -4261,7 +4261,7 @@ hns3_buffer_alloc(struct hns3_hw *hw)
|
||||
return ret;
|
||||
}
|
||||
|
||||
- if (hns3_dev_dcb_supported(hw)) {
|
||||
+ if (hns3_dev_get_support(hw, DCB)) {
|
||||
ret = hns3_rx_priv_wl_config(hw, &pkt_buf);
|
||||
if (ret) {
|
||||
PMD_INIT_LOG(ERR,
|
||||
@@ -6230,7 +6230,7 @@ hns3_priority_flow_ctrl_set(struct rte_eth_dev *dev,
|
||||
struct hns3_hw *hw = HNS3_DEV_PRIVATE_TO_HW(dev->data->dev_private);
|
||||
int ret;
|
||||
|
||||
- if (!hns3_dev_dcb_supported(hw)) {
|
||||
+ if (!hns3_dev_get_support(hw, DCB)) {
|
||||
hns3_err(hw, "This port does not support dcb configurations.");
|
||||
return -EOPNOTSUPP;
|
||||
}
|
||||
diff --git a/drivers/net/hns3/hns3_ethdev.h b/drivers/net/hns3/hns3_ethdev.h
|
||||
index 57387e05b..94fd14bfc 100644
|
||||
--- a/drivers/net/hns3/hns3_ethdev.h
|
||||
+++ b/drivers/net/hns3/hns3_ethdev.h
|
||||
@@ -883,45 +883,8 @@ enum {
|
||||
HNS3_DEV_SUPPORT_VF_VLAN_FLT_MOD_B,
|
||||
};
|
||||
|
||||
-#define hns3_dev_dcb_supported(hw) \
|
||||
- hns3_get_bit((hw)->capability, HNS3_DEV_SUPPORT_DCB_B)
|
||||
-
|
||||
-/* Support copper media type */
|
||||
-#define hns3_dev_copper_supported(hw) \
|
||||
- hns3_get_bit((hw)->capability, HNS3_DEV_SUPPORT_COPPER_B)
|
||||
-
|
||||
-/* Support the queue region action rule of flow directory */
|
||||
-#define hns3_dev_fd_queue_region_supported(hw) \
|
||||
- hns3_get_bit((hw)->capability, HNS3_DEV_SUPPORT_FD_QUEUE_REGION_B)
|
||||
-
|
||||
-/* Support PTP timestamp offload */
|
||||
-#define hns3_dev_ptp_supported(hw) \
|
||||
- hns3_get_bit((hw)->capability, HNS3_DEV_SUPPORT_PTP_B)
|
||||
-
|
||||
-/* Support to Independently enable/disable/reset Tx or Rx queues */
|
||||
-#define hns3_dev_indep_txrx_supported(hw) \
|
||||
- hns3_get_bit((hw)->capability, HNS3_DEV_SUPPORT_INDEP_TXRX_B)
|
||||
-
|
||||
-#define hns3_dev_stash_supported(hw) \
|
||||
- hns3_get_bit((hw)->capability, HNS3_DEV_SUPPORT_STASH_B)
|
||||
-
|
||||
-#define hns3_dev_rxd_adv_layout_supported(hw) \
|
||||
- hns3_get_bit((hw)->capability, HNS3_DEV_SUPPORT_RXD_ADV_LAYOUT_B)
|
||||
-
|
||||
-#define hns3_dev_outer_udp_cksum_supported(hw) \
|
||||
- hns3_get_bit((hw)->capability, HNS3_DEV_SUPPORT_OUTER_UDP_CKSUM_B)
|
||||
-
|
||||
-#define hns3_dev_ras_imp_supported(hw) \
|
||||
- hns3_get_bit((hw)->capability, HNS3_DEV_SUPPORT_RAS_IMP_B)
|
||||
-
|
||||
-#define hns3_dev_tx_push_supported(hw) \
|
||||
- hns3_get_bit((hw)->capability, HNS3_DEV_SUPPORT_TX_PUSH_B)
|
||||
-
|
||||
-#define hns3_dev_tm_supported(hw) \
|
||||
- hns3_get_bit((hw)->capability, HNS3_DEV_SUPPORT_TM_B)
|
||||
-
|
||||
-#define hns3_dev_vf_vlan_flt_supported(hw) \
|
||||
- hns3_get_bit((hw)->capability, HNS3_DEV_SUPPORT_VF_VLAN_FLT_MOD_B)
|
||||
+#define hns3_dev_get_support(hw, _name) \
|
||||
+ hns3_get_bit((hw)->capability, HNS3_DEV_SUPPORT_##_name##_B)
|
||||
|
||||
#define HNS3_DEV_PRIVATE_TO_HW(adapter) \
|
||||
(&((struct hns3_adapter *)adapter)->hw)
|
||||
diff --git a/drivers/net/hns3/hns3_ethdev_vf.c b/drivers/net/hns3/hns3_ethdev_vf.c
|
||||
index e07eb2088..d2895b140 100644
|
||||
--- a/drivers/net/hns3/hns3_ethdev_vf.c
|
||||
+++ b/drivers/net/hns3/hns3_ethdev_vf.c
|
||||
@@ -988,10 +988,10 @@ hns3vf_dev_infos_get(struct rte_eth_dev *eth_dev, struct rte_eth_dev_info *info)
|
||||
DEV_TX_OFFLOAD_MBUF_FAST_FREE |
|
||||
hns3_txvlan_cap_get(hw));
|
||||
|
||||
- if (hns3_dev_outer_udp_cksum_supported(hw))
|
||||
+ if (hns3_dev_get_support(hw, OUTER_UDP_CKSUM))
|
||||
info->tx_offload_capa |= DEV_TX_OFFLOAD_OUTER_UDP_CKSUM;
|
||||
|
||||
- if (hns3_dev_indep_txrx_supported(hw))
|
||||
+ if (hns3_dev_get_support(hw, INDEP_TXRX))
|
||||
info->dev_capa = RTE_ETH_DEV_CAPA_RUNTIME_RX_QUEUE_SETUP |
|
||||
RTE_ETH_DEV_CAPA_RUNTIME_TX_QUEUE_SETUP;
|
||||
|
||||
@@ -1623,7 +1623,7 @@ hns3vf_en_vlan_filter(struct hns3_hw *hw, bool enable)
|
||||
uint8_t msg_data;
|
||||
int ret;
|
||||
|
||||
- if (!hns3_dev_vf_vlan_flt_supported(hw))
|
||||
+ if (!hns3_dev_get_support(hw, VF_VLAN_FLT_MOD))
|
||||
return 0;
|
||||
|
||||
msg_data = enable ? 1 : 0;
|
||||
diff --git a/drivers/net/hns3/hns3_flow.c b/drivers/net/hns3/hns3_flow.c
|
||||
index 6844a5dbe..b25fccbca 100644
|
||||
--- a/drivers/net/hns3/hns3_flow.c
|
||||
+++ b/drivers/net/hns3/hns3_flow.c
|
||||
@@ -301,7 +301,7 @@ hns3_handle_action_queue_region(struct rte_eth_dev *dev,
|
||||
struct hns3_hw *hw = &hns->hw;
|
||||
uint16_t idx;
|
||||
|
||||
- if (!hns3_dev_fd_queue_region_supported(hw))
|
||||
+ if (!hns3_dev_get_support(hw, FD_QUEUE_REGION))
|
||||
return rte_flow_error_set(error, ENOTSUP,
|
||||
RTE_FLOW_ERROR_TYPE_ACTION, action,
|
||||
"Not support config queue region!");
|
||||
diff --git a/drivers/net/hns3/hns3_intr.c b/drivers/net/hns3/hns3_intr.c
|
||||
index 0b307fdd1..3484c76d2 100644
|
||||
--- a/drivers/net/hns3/hns3_intr.c
|
||||
+++ b/drivers/net/hns3/hns3_intr.c
|
||||
@@ -2368,7 +2368,7 @@ hns3_handle_error(struct hns3_adapter *hns)
|
||||
{
|
||||
struct hns3_hw *hw = &hns->hw;
|
||||
|
||||
- if (hns3_dev_ras_imp_supported(hw)) {
|
||||
+ if (hns3_dev_get_support(hw, RAS_IMP)) {
|
||||
hns3_handle_hw_error_v2(hw);
|
||||
hns3_schedule_reset(hns);
|
||||
} else {
|
||||
diff --git a/drivers/net/hns3/hns3_ptp.c b/drivers/net/hns3/hns3_ptp.c
|
||||
index 146b69db7..14c1ad3e4 100644
|
||||
--- a/drivers/net/hns3/hns3_ptp.c
|
||||
+++ b/drivers/net/hns3/hns3_ptp.c
|
||||
@@ -61,7 +61,7 @@ hns3_ptp_init(struct hns3_hw *hw)
|
||||
{
|
||||
int ret;
|
||||
|
||||
- if (!hns3_dev_ptp_supported(hw))
|
||||
+ if (!hns3_dev_get_support(hw, PTP))
|
||||
return 0;
|
||||
|
||||
ret = hns3_ptp_int_en(hw, true);
|
||||
@@ -120,7 +120,7 @@ hns3_timesync_enable(struct rte_eth_dev *dev)
|
||||
struct hns3_pf *pf = &hns->pf;
|
||||
int ret;
|
||||
|
||||
- if (!hns3_dev_ptp_supported(hw))
|
||||
+ if (!hns3_dev_get_support(hw, PTP))
|
||||
return -ENOTSUP;
|
||||
|
||||
if (pf->ptp_enable)
|
||||
@@ -140,7 +140,7 @@ hns3_timesync_disable(struct rte_eth_dev *dev)
|
||||
struct hns3_pf *pf = &hns->pf;
|
||||
int ret;
|
||||
|
||||
- if (!hns3_dev_ptp_supported(hw))
|
||||
+ if (!hns3_dev_get_support(hw, PTP))
|
||||
return -ENOTSUP;
|
||||
|
||||
if (!pf->ptp_enable)
|
||||
@@ -164,7 +164,7 @@ hns3_timesync_read_rx_timestamp(struct rte_eth_dev *dev,
|
||||
struct hns3_pf *pf = &hns->pf;
|
||||
uint64_t ns, sec;
|
||||
|
||||
- if (!hns3_dev_ptp_supported(hw))
|
||||
+ if (!hns3_dev_get_support(hw, PTP))
|
||||
return -ENOTSUP;
|
||||
|
||||
ns = pf->rx_timestamp & TIME_RX_STAMP_NS_MASK;
|
||||
@@ -190,7 +190,7 @@ hns3_timesync_read_tx_timestamp(struct rte_eth_dev *dev,
|
||||
uint64_t ns;
|
||||
int ts_cnt;
|
||||
|
||||
- if (!hns3_dev_ptp_supported(hw))
|
||||
+ if (!hns3_dev_get_support(hw, PTP))
|
||||
return -ENOTSUP;
|
||||
|
||||
ts_cnt = hns3_read_dev(hw, HNS3_TX_1588_BACK_TSP_CNT) &
|
||||
@@ -219,7 +219,7 @@ hns3_timesync_read_time(struct rte_eth_dev *dev, struct timespec *ts)
|
||||
struct hns3_hw *hw = HNS3_DEV_PRIVATE_TO_HW(dev->data->dev_private);
|
||||
uint64_t ns, sec;
|
||||
|
||||
- if (!hns3_dev_ptp_supported(hw))
|
||||
+ if (!hns3_dev_get_support(hw, PTP))
|
||||
return -ENOTSUP;
|
||||
|
||||
sec = hns3_read_dev(hw, HNS3_CURR_TIME_OUT_L);
|
||||
@@ -240,7 +240,7 @@ hns3_timesync_write_time(struct rte_eth_dev *dev, const struct timespec *ts)
|
||||
uint64_t sec = ts->tv_sec;
|
||||
uint64_t ns = ts->tv_nsec;
|
||||
|
||||
- if (!hns3_dev_ptp_supported(hw))
|
||||
+ if (!hns3_dev_get_support(hw, PTP))
|
||||
return -ENOTSUP;
|
||||
|
||||
/* Set the timecounters to a new value. */
|
||||
@@ -261,7 +261,7 @@ hns3_timesync_adjust_time(struct rte_eth_dev *dev, int64_t delta)
|
||||
struct timespec cur_time;
|
||||
uint64_t ns;
|
||||
|
||||
- if (!hns3_dev_ptp_supported(hw))
|
||||
+ if (!hns3_dev_get_support(hw, PTP))
|
||||
return -ENOTSUP;
|
||||
|
||||
(void)hns3_timesync_read_time(dev, &cur_time);
|
||||
@@ -280,7 +280,7 @@ hns3_restore_ptp(struct hns3_adapter *hns)
|
||||
bool en = pf->ptp_enable;
|
||||
int ret;
|
||||
|
||||
- if (!hns3_dev_ptp_supported(hw))
|
||||
+ if (!hns3_dev_get_support(hw, PTP))
|
||||
return 0;
|
||||
|
||||
ret = hns3_timesync_configure(hns, en);
|
||||
diff --git a/drivers/net/hns3/hns3_rxtx.c b/drivers/net/hns3/hns3_rxtx.c
|
||||
index 80d2614d2..bb1723e29 100644
|
||||
--- a/drivers/net/hns3/hns3_rxtx.c
|
||||
+++ b/drivers/net/hns3/hns3_rxtx.c
|
||||
@@ -381,7 +381,7 @@ hns3_enable_all_queues(struct hns3_hw *hw, bool en)
|
||||
int i;
|
||||
|
||||
for (i = 0; i < hw->cfg_max_queues; i++) {
|
||||
- if (hns3_dev_indep_txrx_supported(hw)) {
|
||||
+ if (hns3_dev_get_support(hw, INDEP_TXRX)) {
|
||||
rxq = i < nb_rx_q ? hw->data->rx_queues[i] : NULL;
|
||||
txq = i < nb_tx_q ? hw->data->tx_queues[i] : NULL;
|
||||
|
||||
@@ -426,7 +426,7 @@ hns3_enable_txq(struct hns3_tx_queue *txq, bool en)
|
||||
struct hns3_hw *hw = &txq->hns->hw;
|
||||
uint32_t reg;
|
||||
|
||||
- if (hns3_dev_indep_txrx_supported(hw)) {
|
||||
+ if (hns3_dev_get_support(hw, INDEP_TXRX)) {
|
||||
reg = hns3_read_dev(txq, HNS3_RING_TX_EN_REG);
|
||||
if (en)
|
||||
reg |= BIT(HNS3_RING_EN_B);
|
||||
@@ -443,7 +443,7 @@ hns3_enable_rxq(struct hns3_rx_queue *rxq, bool en)
|
||||
struct hns3_hw *hw = &rxq->hns->hw;
|
||||
uint32_t reg;
|
||||
|
||||
- if (hns3_dev_indep_txrx_supported(hw)) {
|
||||
+ if (hns3_dev_get_support(hw, INDEP_TXRX)) {
|
||||
reg = hns3_read_dev(rxq, HNS3_RING_RX_EN_REG);
|
||||
if (en)
|
||||
reg |= BIT(HNS3_RING_EN_B);
|
||||
@@ -1618,7 +1618,7 @@ hns3_set_fake_rx_or_tx_queues(struct rte_eth_dev *dev, uint16_t nb_rx_q,
|
||||
uint16_t q;
|
||||
int ret;
|
||||
|
||||
- if (hns3_dev_indep_txrx_supported(hw))
|
||||
+ if (hns3_dev_get_support(hw, INDEP_TXRX))
|
||||
return 0;
|
||||
|
||||
/* Setup new number of fake RX/TX queues and reconfigure device. */
|
||||
@@ -1862,7 +1862,7 @@ hns3_rx_queue_setup(struct rte_eth_dev *dev, uint16_t idx, uint16_t nb_desc,
|
||||
conf->rx_free_thresh : HNS3_DEFAULT_RX_FREE_THRESH;
|
||||
|
||||
rxq->rx_deferred_start = conf->rx_deferred_start;
|
||||
- if (rxq->rx_deferred_start && !hns3_dev_indep_txrx_supported(hw)) {
|
||||
+ if (rxq->rx_deferred_start && !hns3_dev_get_support(hw, INDEP_TXRX)) {
|
||||
hns3_warn(hw, "deferred start is not supported.");
|
||||
rxq->rx_deferred_start = false;
|
||||
}
|
||||
@@ -1898,7 +1898,7 @@ hns3_rx_queue_setup(struct rte_eth_dev *dev, uint16_t idx, uint16_t nb_desc,
|
||||
HNS3_PORT_BASE_VLAN_ENABLE;
|
||||
else
|
||||
rxq->pvid_sw_discard_en = false;
|
||||
- rxq->ptype_en = hns3_dev_rxd_adv_layout_supported(hw) ? true : false;
|
||||
+ rxq->ptype_en = hns3_dev_get_support(hw, RXD_ADV_LAYOUT) ? true : false;
|
||||
rxq->configured = true;
|
||||
rxq->io_base = (void *)((char *)hw->io_base + HNS3_TQP_REG_OFFSET +
|
||||
idx * HNS3_TQP_REG_SIZE);
|
||||
@@ -2026,7 +2026,7 @@ hns3_dev_supported_ptypes_get(struct rte_eth_dev *dev)
|
||||
dev->rx_pkt_burst == hns3_recv_scattered_pkts ||
|
||||
dev->rx_pkt_burst == hns3_recv_pkts_vec ||
|
||||
dev->rx_pkt_burst == hns3_recv_pkts_vec_sve) {
|
||||
- if (hns3_dev_rxd_adv_layout_supported(hw))
|
||||
+ if (hns3_dev_get_support(hw, RXD_ADV_LAYOUT))
|
||||
return adv_layout_ptypes;
|
||||
else
|
||||
return ptypes;
|
||||
@@ -2928,7 +2928,7 @@ hns3_tx_push_init(struct rte_eth_dev *dev)
|
||||
volatile uint32_t *reg;
|
||||
uint32_t val;
|
||||
|
||||
- if (!hns3_dev_tx_push_supported(hw))
|
||||
+ if (!hns3_dev_get_support(hw, TX_PUSH))
|
||||
return;
|
||||
|
||||
reg = (volatile uint32_t *)hns3_tx_push_get_queue_tail_reg(dev, 0);
|
||||
@@ -2949,7 +2949,7 @@ hns3_tx_push_queue_init(struct rte_eth_dev *dev,
|
||||
struct hns3_tx_queue *txq)
|
||||
{
|
||||
struct hns3_hw *hw = HNS3_DEV_PRIVATE_TO_HW(dev->data->dev_private);
|
||||
- if (!hns3_dev_tx_push_supported(hw)) {
|
||||
+ if (!hns3_dev_get_support(hw, TX_PUSH)) {
|
||||
txq->tx_push_enable = false;
|
||||
return;
|
||||
}
|
||||
@@ -2994,7 +2994,7 @@ hns3_tx_queue_setup(struct rte_eth_dev *dev, uint16_t idx, uint16_t nb_desc,
|
||||
}
|
||||
|
||||
txq->tx_deferred_start = conf->tx_deferred_start;
|
||||
- if (txq->tx_deferred_start && !hns3_dev_indep_txrx_supported(hw)) {
|
||||
+ if (txq->tx_deferred_start && !hns3_dev_get_support(hw, INDEP_TXRX)) {
|
||||
hns3_warn(hw, "deferred start is not supported.");
|
||||
txq->tx_deferred_start = false;
|
||||
}
|
||||
@@ -4276,7 +4276,7 @@ hns3_tx_check_simple_support(struct rte_eth_dev *dev)
|
||||
uint64_t offloads = dev->data->dev_conf.txmode.offloads;
|
||||
|
||||
struct hns3_hw *hw = HNS3_DEV_PRIVATE_TO_HW(dev->data->dev_private);
|
||||
- if (hns3_dev_ptp_supported(hw))
|
||||
+ if (hns3_dev_get_support(hw, PTP))
|
||||
return false;
|
||||
|
||||
return (offloads == (offloads & DEV_TX_OFFLOAD_MBUF_FAST_FREE));
|
||||
@@ -4437,7 +4437,7 @@ hns3_dev_rx_queue_start(struct rte_eth_dev *dev, uint16_t rx_queue_id)
|
||||
struct hns3_adapter *hns = HNS3_DEV_HW_TO_ADAPTER(hw);
|
||||
int ret;
|
||||
|
||||
- if (!hns3_dev_indep_txrx_supported(hw))
|
||||
+ if (!hns3_dev_get_support(hw, INDEP_TXRX))
|
||||
return -ENOTSUP;
|
||||
|
||||
rte_spinlock_lock(&hw->lock);
|
||||
@@ -4483,7 +4483,7 @@ hns3_dev_rx_queue_stop(struct rte_eth_dev *dev, uint16_t rx_queue_id)
|
||||
struct hns3_hw *hw = HNS3_DEV_PRIVATE_TO_HW(dev->data->dev_private);
|
||||
struct hns3_rx_queue *rxq = dev->data->rx_queues[rx_queue_id];
|
||||
|
||||
- if (!hns3_dev_indep_txrx_supported(hw))
|
||||
+ if (!hns3_dev_get_support(hw, INDEP_TXRX))
|
||||
return -ENOTSUP;
|
||||
|
||||
rte_spinlock_lock(&hw->lock);
|
||||
@@ -4505,7 +4505,7 @@ hns3_dev_tx_queue_start(struct rte_eth_dev *dev, uint16_t tx_queue_id)
|
||||
struct hns3_tx_queue *txq = dev->data->tx_queues[tx_queue_id];
|
||||
int ret;
|
||||
|
||||
- if (!hns3_dev_indep_txrx_supported(hw))
|
||||
+ if (!hns3_dev_get_support(hw, INDEP_TXRX))
|
||||
return -ENOTSUP;
|
||||
|
||||
rte_spinlock_lock(&hw->lock);
|
||||
@@ -4531,7 +4531,7 @@ hns3_dev_tx_queue_stop(struct rte_eth_dev *dev, uint16_t tx_queue_id)
|
||||
struct hns3_hw *hw = HNS3_DEV_PRIVATE_TO_HW(dev->data->dev_private);
|
||||
struct hns3_tx_queue *txq = dev->data->tx_queues[tx_queue_id];
|
||||
|
||||
- if (!hns3_dev_indep_txrx_supported(hw))
|
||||
+ if (!hns3_dev_get_support(hw, INDEP_TXRX))
|
||||
return -ENOTSUP;
|
||||
|
||||
rte_spinlock_lock(&hw->lock);
|
||||
@@ -4704,7 +4704,7 @@ hns3_enable_rxd_adv_layout(struct hns3_hw *hw)
|
||||
* If the hardware support rxd advanced layout, then driver enable it
|
||||
* default.
|
||||
*/
|
||||
- if (hns3_dev_rxd_adv_layout_supported(hw))
|
||||
+ if (hns3_dev_get_support(hw, RXD_ADV_LAYOUT))
|
||||
hns3_write_dev(hw, HNS3_RXD_ADV_LAYOUT_EN_REG, 1);
|
||||
}
|
||||
|
||||
diff --git a/drivers/net/hns3/hns3_rxtx_vec.c b/drivers/net/hns3/hns3_rxtx_vec.c
|
||||
index 15a0bd075..bfe84e833 100644
|
||||
--- a/drivers/net/hns3/hns3_rxtx_vec.c
|
||||
+++ b/drivers/net/hns3/hns3_rxtx_vec.c
|
||||
@@ -19,7 +19,7 @@ hns3_tx_check_vec_support(struct rte_eth_dev *dev)
|
||||
struct rte_eth_txmode *txmode = &dev->data->dev_conf.txmode;
|
||||
|
||||
struct hns3_hw *hw = HNS3_DEV_PRIVATE_TO_HW(dev->data->dev_private);
|
||||
- if (hns3_dev_ptp_supported(hw))
|
||||
+ if (hns3_dev_get_support(hw, PTP))
|
||||
return -ENOTSUP;
|
||||
|
||||
/* Only support DEV_TX_OFFLOAD_MBUF_FAST_FREE */
|
||||
@@ -234,7 +234,7 @@ hns3_rx_check_vec_support(struct rte_eth_dev *dev)
|
||||
DEV_RX_OFFLOAD_VLAN;
|
||||
|
||||
struct hns3_hw *hw = HNS3_DEV_PRIVATE_TO_HW(dev->data->dev_private);
|
||||
- if (hns3_dev_ptp_supported(hw))
|
||||
+ if (hns3_dev_get_support(hw, PTP))
|
||||
return -ENOTSUP;
|
||||
|
||||
if (dev->data->scattered_rx)
|
||||
diff --git a/drivers/net/hns3/hns3_tm.c b/drivers/net/hns3/hns3_tm.c
|
||||
index db5ac786c..44b607af7 100644
|
||||
--- a/drivers/net/hns3/hns3_tm.c
|
||||
+++ b/drivers/net/hns3/hns3_tm.c
|
||||
@@ -31,7 +31,7 @@ hns3_tm_conf_init(struct rte_eth_dev *dev)
|
||||
struct hns3_hw *hw = HNS3_DEV_PRIVATE_TO_HW(dev->data->dev_private);
|
||||
uint32_t max_tx_queues = hns3_tm_max_tx_queues_get(dev);
|
||||
|
||||
- if (!hns3_dev_tm_supported(hw))
|
||||
+ if (!hns3_dev_get_support(hw, TM))
|
||||
return;
|
||||
|
||||
pf->tm_conf.nb_leaf_nodes_max = max_tx_queues;
|
||||
@@ -58,7 +58,7 @@ hns3_tm_conf_uninit(struct rte_eth_dev *dev)
|
||||
struct hns3_tm_shaper_profile *shaper_profile;
|
||||
struct hns3_tm_node *tm_node;
|
||||
|
||||
- if (!hns3_dev_tm_supported(hw))
|
||||
+ if (!hns3_dev_get_support(hw, TM))
|
||||
return;
|
||||
|
||||
if (pf->tm_conf.nb_queue_node > 0) {
|
||||
@@ -1233,7 +1233,7 @@ hns3_tm_ops_get(struct rte_eth_dev *dev, void *arg)
|
||||
if (arg == NULL)
|
||||
return -EINVAL;
|
||||
|
||||
- if (!hns3_dev_tm_supported(hw))
|
||||
+ if (!hns3_dev_get_support(hw, TM))
|
||||
return -EOPNOTSUPP;
|
||||
|
||||
*(const void **)arg = &hns3_tm_ops;
|
||||
@@ -1246,7 +1246,7 @@ hns3_tm_dev_start_proc(struct hns3_hw *hw)
|
||||
{
|
||||
struct hns3_pf *pf = HNS3_DEV_HW_TO_PF(hw);
|
||||
|
||||
- if (!hns3_dev_tm_supported(hw))
|
||||
+ if (!hns3_dev_get_support(hw, TM))
|
||||
return;
|
||||
|
||||
if (pf->tm_conf.root && !pf->tm_conf.committed)
|
||||
@@ -1295,7 +1295,7 @@ hns3_tm_conf_update(struct hns3_hw *hw)
|
||||
struct hns3_pf *pf = HNS3_DEV_HW_TO_PF(hw);
|
||||
struct rte_tm_error error;
|
||||
|
||||
- if (!hns3_dev_tm_supported(hw))
|
||||
+ if (!hns3_dev_get_support(hw, TM))
|
||||
return 0;
|
||||
|
||||
if (pf->tm_conf.root == NULL || !pf->tm_conf.committed)
|
||||
--
|
||||
2.23.0
|
||||
|
||||
33
0228-net-hns3-fix-interrupt-vector-freeing.patch
Normal file
33
0228-net-hns3-fix-interrupt-vector-freeing.patch
Normal file
@ -0,0 +1,33 @@
|
||||
From b00fefaae559f49fbbbc39ec6ec1aaa1f4f5ba39 Mon Sep 17 00:00:00 2001
|
||||
From: Chengwen Feng <fengchengwen@huawei.com>
|
||||
Date: Wed, 13 Oct 2021 16:09:08 +0800
|
||||
Subject: [PATCH 15/17] net/hns3: fix interrupt vector freeing
|
||||
|
||||
The intr_handle->intr_vec is allocated by rte_zmalloc(), but freed by
|
||||
free(), this patch fixes it.
|
||||
|
||||
Fixes: 02a7b55657b2 ("net/hns3: support Rx interrupt")
|
||||
Cc: stable@dpdk.org
|
||||
|
||||
Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
|
||||
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
|
||||
---
|
||||
drivers/net/hns3/hns3_ethdev_vf.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/drivers/net/hns3/hns3_ethdev_vf.c b/drivers/net/hns3/hns3_ethdev_vf.c
|
||||
index d2895b140..9dfc22d2d 100644
|
||||
--- a/drivers/net/hns3/hns3_ethdev_vf.c
|
||||
+++ b/drivers/net/hns3/hns3_ethdev_vf.c
|
||||
@@ -2355,7 +2355,7 @@ hns3vf_map_rx_interrupt(struct rte_eth_dev *dev)
|
||||
return 0;
|
||||
|
||||
vf_bind_vector_error:
|
||||
- free(intr_handle->intr_vec);
|
||||
+ rte_free(intr_handle->intr_vec);
|
||||
intr_handle->intr_vec = NULL;
|
||||
vf_alloc_intr_vec_error:
|
||||
rte_intr_efd_disable(intr_handle);
|
||||
--
|
||||
2.23.0
|
||||
|
||||
179
0229-net-hns3-add-runtime-config-for-mailbox-limit-time.patch
Normal file
179
0229-net-hns3-add-runtime-config-for-mailbox-limit-time.patch
Normal file
@ -0,0 +1,179 @@
|
||||
From 61c8349bbed069317c59da812598b74d2e076ced Mon Sep 17 00:00:00 2001
|
||||
From: Chengchang Tang <tangchengchang@huawei.com>
|
||||
Date: Fri, 22 Oct 2021 09:38:40 +0800
|
||||
Subject: [PATCH 16/17] net/hns3: add runtime config for mailbox limit time
|
||||
|
||||
Current, the max waiting time for MBX response is 500ms, but in
|
||||
some scenarios, it is not enough. Since it depends on the response
|
||||
of the kernel mode driver, and its response time is related to the
|
||||
scheduling of the system. In this special scenario, most of the
|
||||
cores are isolated, and only a few cores are used for system
|
||||
scheduling. When a large number of services are started, the
|
||||
scheduling of the system will be very busy, and the reply of the
|
||||
mbx message will time out, which will cause our PMD initialization
|
||||
to fail.
|
||||
|
||||
This patch add a runtime config to set the max wait time. For the
|
||||
above scenes, users can adjust the waiting time to a suitable value
|
||||
by themselves.
|
||||
|
||||
Fixes: 463e748964f5 ("net/hns3: support mailbox")
|
||||
Cc: stable@dpdk.org
|
||||
|
||||
Signed-off-by: Chengchang Tang <tangchengchang@huawei.com>
|
||||
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
|
||||
---
|
||||
drivers/net/hns3/hns3_ethdev.c | 32 ++++++++++++++++++++++++++++++-
|
||||
drivers/net/hns3/hns3_ethdev.h | 3 +++
|
||||
drivers/net/hns3/hns3_ethdev_vf.c | 3 ++-
|
||||
drivers/net/hns3/hns3_mbx.c | 8 +++++---
|
||||
drivers/net/hns3/hns3_mbx.h | 1 +
|
||||
5 files changed, 42 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c
|
||||
index c5c355d95..2ae4cb9b7 100644
|
||||
--- a/drivers/net/hns3/hns3_ethdev.c
|
||||
+++ b/drivers/net/hns3/hns3_ethdev.c
|
||||
@@ -7348,9 +7348,30 @@ hns3_parse_dev_caps_mask(const char *key, const char *value, void *extra_args)
|
||||
return 0;
|
||||
}
|
||||
|
||||
+static int
|
||||
+hns3_parse_mbx_time_limit(const char *key, const char *value, void *extra_args)
|
||||
+{
|
||||
+ uint32_t val;
|
||||
+
|
||||
+ RTE_SET_USED(key);
|
||||
+
|
||||
+ val = strtoul(value, NULL, 10);
|
||||
+
|
||||
+ /*
|
||||
+ * 500ms is empirical value in process of mailbox communication. If
|
||||
+ * the delay value is set to one lower thanthe empirical value, mailbox
|
||||
+ * communication may fail.
|
||||
+ */
|
||||
+ if (val > HNS3_MBX_DEF_TIME_LIMIT_MS && val <= UINT16_MAX)
|
||||
+ *(uint16_t *)extra_args = val;
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
void
|
||||
hns3_parse_devargs(struct rte_eth_dev *dev)
|
||||
{
|
||||
+ uint16_t mbx_time_limit_ms = HNS3_MBX_DEF_TIME_LIMIT_MS;
|
||||
struct hns3_adapter *hns = dev->data->dev_private;
|
||||
uint32_t rx_func_hint = HNS3_IO_FUNC_HINT_NONE;
|
||||
uint32_t tx_func_hint = HNS3_IO_FUNC_HINT_NONE;
|
||||
@@ -7371,6 +7392,9 @@ hns3_parse_devargs(struct rte_eth_dev *dev)
|
||||
&hns3_parse_io_hint_func, &tx_func_hint);
|
||||
(void)rte_kvargs_process(kvlist, HNS3_DEVARG_DEV_CAPS_MASK,
|
||||
&hns3_parse_dev_caps_mask, &dev_caps_mask);
|
||||
+ (void)rte_kvargs_process(kvlist, HNS3_DEVARG_MBX_TIME_LIMIT_MS,
|
||||
+ &hns3_parse_mbx_time_limit, &mbx_time_limit_ms);
|
||||
+
|
||||
rte_kvargs_free(kvlist);
|
||||
|
||||
if (rx_func_hint != HNS3_IO_FUNC_HINT_NONE)
|
||||
@@ -7386,6 +7410,11 @@ hns3_parse_devargs(struct rte_eth_dev *dev)
|
||||
hns3_warn(hw, "parsed %s = 0x%" PRIx64 ".",
|
||||
HNS3_DEVARG_DEV_CAPS_MASK, dev_caps_mask);
|
||||
hns->dev_caps_mask = dev_caps_mask;
|
||||
+
|
||||
+ if (mbx_time_limit_ms != HNS3_MBX_DEF_TIME_LIMIT_MS)
|
||||
+ hns3_warn(hw, "parsed %s = %u.", HNS3_DEVARG_MBX_TIME_LIMIT_MS,
|
||||
+ mbx_time_limit_ms);
|
||||
+ hns->mbx_time_limit_ms = mbx_time_limit_ms;
|
||||
}
|
||||
|
||||
static const struct eth_dev_ops hns3_eth_dev_ops = {
|
||||
@@ -7642,6 +7671,7 @@ RTE_PMD_REGISTER_KMOD_DEP(net_hns3, "* igb_uio | vfio-pci");
|
||||
RTE_PMD_REGISTER_PARAM_STRING(net_hns3,
|
||||
HNS3_DEVARG_RX_FUNC_HINT "=vec|sve|simple|common "
|
||||
HNS3_DEVARG_TX_FUNC_HINT "=vec|sve|simple|common "
|
||||
- HNS3_DEVARG_DEV_CAPS_MASK "=<1-65535> ");
|
||||
+ HNS3_DEVARG_DEV_CAPS_MASK "=<1-65535> "
|
||||
+ HNS3_DEVARG_MBX_TIME_LIMIT_MS "=<uint16> ");
|
||||
RTE_LOG_REGISTER(hns3_logtype_init, pmd.net.hns3.init, NOTICE);
|
||||
RTE_LOG_REGISTER(hns3_logtype_driver, pmd.net.hns3.driver, NOTICE);
|
||||
diff --git a/drivers/net/hns3/hns3_ethdev.h b/drivers/net/hns3/hns3_ethdev.h
|
||||
index 94fd14bfc..84f5a9f29 100644
|
||||
--- a/drivers/net/hns3/hns3_ethdev.h
|
||||
+++ b/drivers/net/hns3/hns3_ethdev.h
|
||||
@@ -851,6 +851,7 @@ struct hns3_adapter {
|
||||
uint32_t tx_func_hint;
|
||||
|
||||
uint64_t dev_caps_mask;
|
||||
+ uint16_t mbx_time_limit_ms; /* wait time for mbx message */
|
||||
|
||||
struct hns3_ptype_table ptype_tbl __rte_cache_aligned;
|
||||
};
|
||||
@@ -868,6 +869,8 @@ enum {
|
||||
|
||||
#define HNS3_DEVARG_DEV_CAPS_MASK "dev_caps_mask"
|
||||
|
||||
+#define HNS3_DEVARG_MBX_TIME_LIMIT_MS "mbx_time_limit_ms"
|
||||
+
|
||||
enum {
|
||||
HNS3_DEV_SUPPORT_DCB_B,
|
||||
HNS3_DEV_SUPPORT_COPPER_B,
|
||||
diff --git a/drivers/net/hns3/hns3_ethdev_vf.c b/drivers/net/hns3/hns3_ethdev_vf.c
|
||||
index 9dfc22d2d..29313c2f7 100644
|
||||
--- a/drivers/net/hns3/hns3_ethdev_vf.c
|
||||
+++ b/drivers/net/hns3/hns3_ethdev_vf.c
|
||||
@@ -3112,4 +3112,5 @@ RTE_PMD_REGISTER_KMOD_DEP(net_hns3_vf, "* igb_uio | vfio-pci");
|
||||
RTE_PMD_REGISTER_PARAM_STRING(net_hns3_vf,
|
||||
HNS3_DEVARG_RX_FUNC_HINT "=vec|sve|simple|common "
|
||||
HNS3_DEVARG_TX_FUNC_HINT "=vec|sve|simple|common "
|
||||
- HNS3_DEVARG_DEV_CAPS_MASK "=<1-65535> ");
|
||||
+ HNS3_DEVARG_DEV_CAPS_MASK "=<1-65535> "
|
||||
+ HNS3_DEVARG_MBX_TIME_LIMIT_MS "=<uint16_t> ");
|
||||
diff --git a/drivers/net/hns3/hns3_mbx.c b/drivers/net/hns3/hns3_mbx.c
|
||||
index 411c5ebe9..a4d9afc45 100644
|
||||
--- a/drivers/net/hns3/hns3_mbx.c
|
||||
+++ b/drivers/net/hns3/hns3_mbx.c
|
||||
@@ -61,8 +61,9 @@ static int
|
||||
hns3_get_mbx_resp(struct hns3_hw *hw, uint16_t code, uint16_t subcode,
|
||||
uint8_t *resp_data, uint16_t resp_len)
|
||||
{
|
||||
-#define HNS3_MAX_RETRY_US 500000
|
||||
#define HNS3_WAIT_RESP_US 100
|
||||
+#define US_PER_MS 1000
|
||||
+ uint32_t mbx_time_limit;
|
||||
struct hns3_adapter *hns = HNS3_DEV_HW_TO_ADAPTER(hw);
|
||||
struct hns3_mbx_resp_status *mbx_resp;
|
||||
uint32_t wait_time = 0;
|
||||
@@ -74,7 +75,8 @@ hns3_get_mbx_resp(struct hns3_hw *hw, uint16_t code, uint16_t subcode,
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
- while (wait_time < HNS3_MAX_RETRY_US) {
|
||||
+ mbx_time_limit = (uint32_t)hns->mbx_time_limit_ms * US_PER_MS;
|
||||
+ while (wait_time < mbx_time_limit) {
|
||||
if (__atomic_load_n(&hw->reset.disable_cmd, __ATOMIC_RELAXED)) {
|
||||
hns3_err(hw, "Don't wait for mbx respone because of "
|
||||
"disable_cmd");
|
||||
@@ -103,7 +105,7 @@ hns3_get_mbx_resp(struct hns3_hw *hw, uint16_t code, uint16_t subcode,
|
||||
wait_time += HNS3_WAIT_RESP_US;
|
||||
}
|
||||
hw->mbx_resp.req_msg_data = 0;
|
||||
- if (wait_time >= HNS3_MAX_RETRY_US) {
|
||||
+ if (wait_time >= mbx_time_limit) {
|
||||
hns3_mbx_proc_timeout(hw, code, subcode);
|
||||
return -ETIME;
|
||||
}
|
||||
diff --git a/drivers/net/hns3/hns3_mbx.h b/drivers/net/hns3/hns3_mbx.h
|
||||
index f868e33a9..d637bd2b2 100644
|
||||
--- a/drivers/net/hns3/hns3_mbx.h
|
||||
+++ b/drivers/net/hns3/hns3_mbx.h
|
||||
@@ -87,6 +87,7 @@ enum hns3_mbx_link_fail_subcode {
|
||||
|
||||
#define HNS3_MBX_MAX_MSG_SIZE 16
|
||||
#define HNS3_MBX_MAX_RESP_DATA_SIZE 8
|
||||
+#define HNS3_MBX_DEF_TIME_LIMIT_MS 500
|
||||
|
||||
enum {
|
||||
HNS3_MBX_RESP_MATCHING_SCHEME_OF_ORIGINAL = 0,
|
||||
--
|
||||
2.23.0
|
||||
|
||||
39
0230-net-hns3-fix-mailbox-communication-with-HW.patch
Normal file
39
0230-net-hns3-fix-mailbox-communication-with-HW.patch
Normal file
@ -0,0 +1,39 @@
|
||||
From a277f7dbaa54e8ea10f41a7dc4dadec5f08b61b3 Mon Sep 17 00:00:00 2001
|
||||
From: "Min Hu (Connor)" <humin29@huawei.com>
|
||||
Date: Thu, 28 Oct 2021 19:52:30 +0800
|
||||
Subject: [PATCH 17/17] net/hns3: fix mailbox communication with HW
|
||||
|
||||
Mailbox is the communication mechanism between SW and HW. There exist
|
||||
two approaches for SW to recognize mailbox message from HW. One way is
|
||||
using match_id, the other is to compare the message code. The two
|
||||
approaches are independent and used in different scenarios.
|
||||
|
||||
But for the second approach, "next_to_use" should be updated and written
|
||||
to HW register. If it not done, HW do not know the position SW steps,
|
||||
then, the communication between SW and HW will turn to be failed.
|
||||
|
||||
Fixes: dbbbad23e380 ("net/hns3: fix VF handling LSC event in secondary process")
|
||||
Cc: stable@dpdk.org
|
||||
|
||||
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
|
||||
---
|
||||
drivers/net/hns3/hns3_mbx.c | 3 +++
|
||||
1 file changed, 3 insertions(+)
|
||||
|
||||
diff --git a/drivers/net/hns3/hns3_mbx.c b/drivers/net/hns3/hns3_mbx.c
|
||||
index a4d9afc45..3ad85e721 100644
|
||||
--- a/drivers/net/hns3/hns3_mbx.c
|
||||
+++ b/drivers/net/hns3/hns3_mbx.c
|
||||
@@ -435,6 +435,9 @@ hns3_handle_mbx_msg_out_intr(struct hns3_hw *hw)
|
||||
scan_next:
|
||||
next_to_use = (next_to_use + 1) % hw->cmq.crq.desc_num;
|
||||
}
|
||||
+
|
||||
+ crq->next_to_use = next_to_use;
|
||||
+ hns3_write_dev(hw, HNS3_CMDQ_RX_HEAD_REG, crq->next_to_use);
|
||||
}
|
||||
|
||||
void
|
||||
--
|
||||
2.23.0
|
||||
|
||||
421
0231-app-testpmd-support-multi-process.patch
Normal file
421
0231-app-testpmd-support-multi-process.patch
Normal file
@ -0,0 +1,421 @@
|
||||
From c7a841ce328cda8338494640b103d5182268fd1e Mon Sep 17 00:00:00 2001
|
||||
From: "Min Hu (Connor)" <humin29@huawei.com>
|
||||
Date: Wed, 25 Aug 2021 10:06:38 +0800
|
||||
Subject: [PATCH] app/testpmd: support multi-process
|
||||
|
||||
This patch adds multi-process support for testpmd.
|
||||
For example the following commands run two testpmd
|
||||
processes:
|
||||
|
||||
* the primary process:
|
||||
|
||||
./dpdk-testpmd --proc-type=auto -l 0-1 -- -i \
|
||||
--rxq=4 --txq=4 --num-procs=2 --proc-id=0
|
||||
|
||||
* the secondary process:
|
||||
|
||||
./dpdk-testpmd --proc-type=auto -l 2-3 -- -i \
|
||||
--rxq=4 --txq=4 --num-procs=2 --proc-id=1
|
||||
|
||||
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
|
||||
Signed-off-by: Lijun Ou <oulijun@huawei.com>
|
||||
Signed-off-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
|
||||
Acked-by: Xiaoyun Li <xiaoyun.li@intel.com>
|
||||
Acked-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
|
||||
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
|
||||
Acked-by: Aman Deep Singh <aman.deep.singh@intel.com>
|
||||
---
|
||||
app/test-pmd/cmdline.c | 6 ++
|
||||
app/test-pmd/config.c | 20 +++++-
|
||||
app/test-pmd/parameters.c | 9 +++
|
||||
app/test-pmd/testpmd.c | 92 +++++++++++++++++++++++----
|
||||
app/test-pmd/testpmd.h | 11 ++++
|
||||
doc/guides/testpmd_app_ug/run_app.rst | 84 ++++++++++++++++++++++++
|
||||
6 files changed, 210 insertions(+), 12 deletions(-)
|
||||
|
||||
diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
|
||||
index 5691fab94..b701129d8 100644
|
||||
--- a/app/test-pmd/cmdline.c
|
||||
+++ b/app/test-pmd/cmdline.c
|
||||
@@ -5441,6 +5441,12 @@ cmd_set_flush_rx_parsed(void *parsed_result,
|
||||
__rte_unused void *data)
|
||||
{
|
||||
struct cmd_set_flush_rx *res = parsed_result;
|
||||
+
|
||||
+ if (num_procs > 1 && (strcmp(res->mode, "on") == 0)) {
|
||||
+ printf("multi-process doesn't support to flush Rx queues.\n");
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
no_flush_rx = (uint8_t)((strcmp(res->mode, "on") == 0) ? 0 : 1);
|
||||
}
|
||||
|
||||
diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
|
||||
index 7af13f65c..0d6639020 100644
|
||||
--- a/app/test-pmd/config.c
|
||||
+++ b/app/test-pmd/config.c
|
||||
@@ -3117,6 +3117,8 @@ rss_fwd_config_setup(void)
|
||||
queueid_t rxq;
|
||||
queueid_t nb_q;
|
||||
streamid_t sm_id;
|
||||
+ int start;
|
||||
+ int end;
|
||||
|
||||
nb_q = nb_rxq;
|
||||
if (nb_q > nb_txq)
|
||||
@@ -3134,7 +3136,21 @@ rss_fwd_config_setup(void)
|
||||
init_fwd_streams();
|
||||
|
||||
setup_fwd_config_of_each_lcore(&cur_fwd_config);
|
||||
- rxp = 0; rxq = 0;
|
||||
+
|
||||
+ if (proc_id > 0 && nb_q % num_procs != 0)
|
||||
+ printf("Warning! queue numbers should be multiple of processes, or packet loss will happen.\n");
|
||||
+
|
||||
+ /**
|
||||
+ * In multi-process, All queues are allocated to different
|
||||
+ * processes based on num_procs and proc_id. For example:
|
||||
+ * if supports 4 queues(nb_q), 2 processes(num_procs),
|
||||
+ * the 0~1 queue for primary process.
|
||||
+ * the 2~3 queue for secondary process.
|
||||
+ */
|
||||
+ start = proc_id * nb_q / num_procs;
|
||||
+ end = start + nb_q / num_procs;
|
||||
+ rxp = 0;
|
||||
+ rxq = start;
|
||||
for (sm_id = 0; sm_id < cur_fwd_config.nb_fwd_streams; sm_id++) {
|
||||
struct fwd_stream *fs;
|
||||
|
||||
@@ -3151,6 +3167,8 @@ rss_fwd_config_setup(void)
|
||||
continue;
|
||||
rxp = 0;
|
||||
rxq++;
|
||||
+ if (rxq >= end)
|
||||
+ rxq = start;
|
||||
}
|
||||
}
|
||||
|
||||
diff --git a/app/test-pmd/parameters.c b/app/test-pmd/parameters.c
|
||||
index 414a0068f..c464c42f6 100644
|
||||
--- a/app/test-pmd/parameters.c
|
||||
+++ b/app/test-pmd/parameters.c
|
||||
@@ -487,6 +487,9 @@ parse_event_printing_config(const char *optarg, int enable)
|
||||
void
|
||||
launch_args_parse(int argc, char** argv)
|
||||
{
|
||||
+#define PARAM_PROC_ID "proc-id"
|
||||
+#define PARAM_NUM_PROCS "num-procs"
|
||||
+
|
||||
int n, opt;
|
||||
char **argvopt;
|
||||
int opt_idx;
|
||||
@@ -603,6 +606,8 @@ launch_args_parse(int argc, char** argv)
|
||||
{ "rx-mq-mode", 1, 0, 0 },
|
||||
{ "record-core-cycles", 0, 0, 0 },
|
||||
{ "record-burst-stats", 0, 0, 0 },
|
||||
+ { PARAM_NUM_PROCS, 1, 0, 0 },
|
||||
+ { PARAM_PROC_ID, 1, 0, 0 },
|
||||
{ 0, 0, 0, 0 },
|
||||
};
|
||||
|
||||
@@ -1359,6 +1364,10 @@ launch_args_parse(int argc, char** argv)
|
||||
record_core_cycles = 1;
|
||||
if (!strcmp(lgopts[opt_idx].name, "record-burst-stats"))
|
||||
record_burst_stats = 1;
|
||||
+ if (!strcmp(lgopts[opt_idx].name, PARAM_NUM_PROCS))
|
||||
+ num_procs = atoi(optarg);
|
||||
+ if (!strcmp(lgopts[opt_idx].name, PARAM_PROC_ID))
|
||||
+ proc_id = atoi(optarg);
|
||||
break;
|
||||
case 'h':
|
||||
usage(argv[0]);
|
||||
diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
|
||||
index 0eaa4852d..983d8827d 100644
|
||||
--- a/app/test-pmd/testpmd.c
|
||||
+++ b/app/test-pmd/testpmd.c
|
||||
@@ -505,6 +505,61 @@ uint8_t gro_flush_cycles = GRO_DEFAULT_FLUSH_CYCLES;
|
||||
* hexadecimal bitmask of RX mq mode can be enabled.
|
||||
*/
|
||||
enum rte_eth_rx_mq_mode rx_mq_mode = ETH_MQ_RX_VMDQ_DCB_RSS;
|
||||
+/*
|
||||
+ * ID of the current process in multi-process, used to
|
||||
+ * configure the queues to be polled.
|
||||
+ */
|
||||
+int proc_id;
|
||||
+
|
||||
+/*
|
||||
+ * Number of processes in multi-process, used to
|
||||
+ * configure the queues to be polled.
|
||||
+ */
|
||||
+unsigned int num_procs = 1;
|
||||
+
|
||||
+static int
|
||||
+eth_dev_configure_mp(uint16_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q,
|
||||
+ const struct rte_eth_conf *dev_conf)
|
||||
+{
|
||||
+ if (is_proc_primary())
|
||||
+ return rte_eth_dev_configure(port_id, nb_rx_q, nb_tx_q,
|
||||
+ dev_conf);
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static int
|
||||
+eth_dev_start_mp(uint16_t port_id)
|
||||
+{
|
||||
+ if (is_proc_primary())
|
||||
+ return rte_eth_dev_start(port_id);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static int
|
||||
+eth_dev_stop_mp(uint16_t port_id)
|
||||
+{
|
||||
+ if (is_proc_primary())
|
||||
+ return rte_eth_dev_stop(port_id);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static void
|
||||
+mempool_free_mp(struct rte_mempool *mp)
|
||||
+{
|
||||
+ if (is_proc_primary())
|
||||
+ rte_mempool_free(mp);
|
||||
+}
|
||||
+
|
||||
+static int
|
||||
+eth_dev_set_mtu_mp(uint16_t port_id, uint16_t mtu)
|
||||
+{
|
||||
+ if (is_proc_primary())
|
||||
+ return rte_eth_dev_set_mtu(port_id, mtu);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
|
||||
/* Forward function declarations */
|
||||
static void setup_attached_port(portid_t pi);
|
||||
@@ -964,6 +1019,14 @@ mbuf_pool_create(uint16_t mbuf_seg_size, unsigned nb_mbuf,
|
||||
|
||||
mb_size = sizeof(struct rte_mbuf) + mbuf_seg_size;
|
||||
mbuf_poolname_build(socket_id, pool_name, sizeof(pool_name), size_idx);
|
||||
+ if (!is_proc_primary()) {
|
||||
+ rte_mp = rte_mempool_lookup(pool_name);
|
||||
+ if (rte_mp == NULL)
|
||||
+ rte_exit(EXIT_FAILURE,
|
||||
+ "Get mbuf pool for socket %u failed: %s\n",
|
||||
+ socket_id, rte_strerror(rte_errno));
|
||||
+ return rte_mp;
|
||||
+ }
|
||||
|
||||
TESTPMD_LOG(INFO,
|
||||
"create a new mbuf pool <%s>: n=%u, size=%u, socket=%u\n",
|
||||
@@ -1969,6 +2032,11 @@ flush_fwd_rx_queues(void)
|
||||
uint64_t prev_tsc = 0, diff_tsc, cur_tsc, timer_tsc = 0;
|
||||
uint64_t timer_period;
|
||||
|
||||
+ if (num_procs > 1) {
|
||||
+ printf("multi-process not support for flushing fwd Rx queues, skip the below lines and return.\n");
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
/* convert to number of cycles */
|
||||
timer_period = rte_get_timer_hz(); /* 1 second timeout */
|
||||
|
||||
@@ -2456,7 +2524,7 @@ start_port(portid_t pid)
|
||||
return -1;
|
||||
}
|
||||
/* configure port */
|
||||
- diag = rte_eth_dev_configure(pi, nb_rxq + nb_hairpinq,
|
||||
+ diag = eth_dev_configure_mp(pi, nb_rxq + nb_hairpinq,
|
||||
nb_txq + nb_hairpinq,
|
||||
&(port->dev_conf));
|
||||
if (diag != 0) {
|
||||
@@ -2470,7 +2538,7 @@ start_port(portid_t pid)
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
- if (port->need_reconfig_queues > 0) {
|
||||
+ if (port->need_reconfig_queues > 0 && is_proc_primary()) {
|
||||
port->need_reconfig_queues = 0;
|
||||
/* setup tx queues */
|
||||
for (qi = 0; qi < nb_txq; qi++) {
|
||||
@@ -2571,7 +2639,7 @@ start_port(portid_t pid)
|
||||
cnt_pi++;
|
||||
|
||||
/* start port */
|
||||
- if (rte_eth_dev_start(pi) < 0) {
|
||||
+ if (eth_dev_start_mp(pi) < 0) {
|
||||
printf("Fail to start port %d\n", pi);
|
||||
|
||||
/* Fail to setup rx queue, return */
|
||||
@@ -2700,7 +2768,7 @@ stop_port(portid_t pid)
|
||||
}
|
||||
}
|
||||
|
||||
- if (rte_eth_dev_stop(pi) != 0)
|
||||
+ if (eth_dev_stop_mp(pi) != 0)
|
||||
RTE_LOG(ERR, EAL, "rte_eth_dev_stop failed for port %u\n",
|
||||
pi);
|
||||
|
||||
@@ -2769,8 +2837,10 @@ close_port(portid_t pid)
|
||||
continue;
|
||||
}
|
||||
|
||||
- port_flow_flush(pi);
|
||||
- rte_eth_dev_close(pi);
|
||||
+ if (is_proc_primary()) {
|
||||
+ port_flow_flush(pi);
|
||||
+ rte_eth_dev_close(pi);
|
||||
+ }
|
||||
}
|
||||
|
||||
remove_invalid_ports();
|
||||
@@ -3035,7 +3105,7 @@ pmd_test_exit(void)
|
||||
}
|
||||
for (i = 0 ; i < RTE_DIM(mempools) ; i++) {
|
||||
if (mempools[i])
|
||||
- rte_mempool_free(mempools[i]);
|
||||
+ mempool_free_mp(mempools[i]);
|
||||
}
|
||||
|
||||
printf("\nBye...\n");
|
||||
@@ -3482,6 +3552,10 @@ init_port_dcb_config(portid_t pid,
|
||||
int retval;
|
||||
uint16_t i;
|
||||
|
||||
+ if (num_procs > 1) {
|
||||
+ printf("The multi-process feature doesn't support dcb.\n");
|
||||
+ return -ENOTSUP;
|
||||
+ }
|
||||
rte_port = &ports[pid];
|
||||
|
||||
/* retain the original device configuration. */
|
||||
@@ -3646,10 +3720,6 @@ main(int argc, char** argv)
|
||||
rte_exit(EXIT_FAILURE, "Cannot init EAL: %s\n",
|
||||
rte_strerror(rte_errno));
|
||||
|
||||
- if (rte_eal_process_type() == RTE_PROC_SECONDARY)
|
||||
- rte_exit(EXIT_FAILURE,
|
||||
- "Secondary process type not supported.\n");
|
||||
-
|
||||
ret = register_eth_event_callback();
|
||||
if (ret != 0)
|
||||
rte_exit(EXIT_FAILURE, "Cannot register for ethdev events");
|
||||
diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h
|
||||
index 303bed830..122fca29c 100644
|
||||
--- a/app/test-pmd/testpmd.h
|
||||
+++ b/app/test-pmd/testpmd.h
|
||||
@@ -626,6 +626,17 @@ extern struct mplsoudp_decap_conf mplsoudp_decap_conf;
|
||||
|
||||
extern enum rte_eth_rx_mq_mode rx_mq_mode;
|
||||
|
||||
+extern struct rte_flow_action_conntrack conntrack_context;
|
||||
+
|
||||
+extern int proc_id;
|
||||
+extern unsigned int num_procs;
|
||||
+
|
||||
+static inline bool
|
||||
+is_proc_primary(void)
|
||||
+{
|
||||
+ return rte_eal_process_type() == RTE_PROC_PRIMARY;
|
||||
+}
|
||||
+
|
||||
static inline unsigned int
|
||||
lcore_num(void)
|
||||
{
|
||||
diff --git a/doc/guides/testpmd_app_ug/run_app.rst b/doc/guides/testpmd_app_ug/run_app.rst
|
||||
index ca67105b7..098cbbd43 100644
|
||||
--- a/doc/guides/testpmd_app_ug/run_app.rst
|
||||
+++ b/doc/guides/testpmd_app_ug/run_app.rst
|
||||
@@ -529,3 +529,87 @@ The command line options are:
|
||||
bit 1 - two hairpin ports paired
|
||||
bit 0 - two hairpin ports loop
|
||||
The default value is 0. Hairpin will use single port mode and implicit Tx flow mode.
|
||||
+
|
||||
+
|
||||
+Testpmd Multi-Process Command-line Options
|
||||
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
+
|
||||
+The following are the command-line options for testpmd multi-process support:
|
||||
+
|
||||
+* primary process:
|
||||
+
|
||||
+.. code-block:: console
|
||||
+
|
||||
+ sudo ./dpdk-testpmd -a xxx --proc-type=auto -l 0-1 -- -i --rxq=4 --txq=4 \
|
||||
+ --num-procs=2 --proc-id=0
|
||||
+
|
||||
+* secondary process:
|
||||
+
|
||||
+.. code-block:: console
|
||||
+
|
||||
+ sudo ./dpdk-testpmd -a xxx --proc-type=auto -l 2-3 -- -i --rxq=4 --txq=4 \
|
||||
+ --num-procs=2 --proc-id=1
|
||||
+
|
||||
+The command line options are:
|
||||
+
|
||||
+* ``--num-procs=N``
|
||||
+
|
||||
+ The number of processes which will be used.
|
||||
+
|
||||
+* ``--proc-id=ID``
|
||||
+
|
||||
+ The ID of the current process (ID < num-procs). ID should be different in
|
||||
+ primary process and secondary process, which starts from '0'.
|
||||
+
|
||||
+Calculation rule for queue:
|
||||
+All queues are allocated to different processes based on ``proc_num`` and
|
||||
+``proc_id``.
|
||||
+Calculation rule for the testpmd to allocate queues to each process:
|
||||
+* start(queue start id) = proc_id * nb_q / num_procs£»
|
||||
+
|
||||
+* end(queue end id) = start + nb_q / num_procs£»
|
||||
+
|
||||
+For example, if testpmd is configured to have 4 Tx and Rx queues,
|
||||
+queues 0 and 1 will be used by the primary process and
|
||||
+queues 2 and 3 will be used by the secondary process.
|
||||
+
|
||||
+The number of queues should be a multiple of the number of processes. If not,
|
||||
+redundant queues will exist after queues are allocated to processes. If RSS
|
||||
+is enabled, packet loss occurs when traffic is sent to all processes at the same
|
||||
+time. Some traffic goes to redundant queues and cannot be forwarded.
|
||||
+
|
||||
+All the dev ops is supported in primary process. While secondary process is
|
||||
+not permitted to allocate or release shared memory, so some ops are not supported
|
||||
+as follows:
|
||||
+
|
||||
+- ``dev_configure``
|
||||
+- ``dev_start``
|
||||
+- ``dev_stop``
|
||||
+- ``rx_queue_setup``
|
||||
+- ``tx_queue_setup``
|
||||
+- ``rx_queue_release``
|
||||
+- ``tx_queue_release``
|
||||
+
|
||||
+So, any command from testpmd which calls those APIs will not be supported in
|
||||
+secondary process, like:
|
||||
+
|
||||
+.. code-block:: console
|
||||
+
|
||||
+ port config all rxq|txq|rxd|txd <value>
|
||||
+ port config <port_id> rx_offload xxx on/off
|
||||
+ port config <port_id> tx_offload xxx on/off
|
||||
+
|
||||
+etc.
|
||||
+
|
||||
+When secondary is running, port in primary is not permitted to be stopped.
|
||||
+Reconfigure operation is only valid in primary.
|
||||
+
|
||||
+Stats is supported, stats will not change when one quits and starts, as they
|
||||
+share the same buffer to store the stats. Flow rules are maintained in process
|
||||
+level: primary and secondary has its own flow list (but one flow list in HW).
|
||||
+The two can see all the queues, so setting the flow rules for the other is OK.
|
||||
+But in the testpmd primary process receiving or transmitting packets from the
|
||||
+queue allocated for secondary process is not permitted, and same for secondary
|
||||
+process.
|
||||
+
|
||||
+Flow API and RSS are supported.
|
||||
--
|
||||
2.23.0
|
||||
|
||||
55
0232-app-testpmd-fix-key-for-RSS-flow-rule.patch
Normal file
55
0232-app-testpmd-fix-key-for-RSS-flow-rule.patch
Normal file
@ -0,0 +1,55 @@
|
||||
From b57927702a58685e46d87960aba25a7b1fa0279e Mon Sep 17 00:00:00 2001
|
||||
From: Alvin Zhang <alvinx.zhang@intel.com>
|
||||
Date: Thu, 21 Jan 2021 17:41:54 +0800
|
||||
Subject: [PATCH] app/testpmd: fix key for RSS flow rule
|
||||
|
||||
Since the patch '1848b117' has initialized the variable 'key' in
|
||||
'struct rte_flow_action_rss' with 'NULL', the PMD cannot get the
|
||||
RSS key now. Details as bellow:
|
||||
|
||||
testpmd> flow create 0 ingress pattern eth / ipv4 / end actions
|
||||
rss types ipv4-other end key
|
||||
1234567890123456789012345678901234567890FFFFFFFFFFFF123
|
||||
4567890123456789012345678901234567890FFFFFFFFFFFF
|
||||
queues end / end
|
||||
Flow rule #1 created
|
||||
testpmd> show port 0 rss-hash key
|
||||
RSS functions:
|
||||
all ipv4-other ip
|
||||
RSS key:
|
||||
4439796BB54C5023B675EA5B124F9F30B8A2C03DDFDC4D02A08C9B3
|
||||
34AF64A4C05C6FA343958D8557D99583AE138C92E81150366
|
||||
|
||||
This patch sets offset and size of the 'key' variable as the first
|
||||
parameter of the token 'key'. Later, the address of the RSS key will
|
||||
be copied to 'key' variable.
|
||||
|
||||
Fixes: 1848b117cca1 ("app/testpmd: fix RSS key for flow API RSS rule")
|
||||
Cc: stable@dpdk.org
|
||||
|
||||
Signed-off-by: Alvin Zhang <alvinx.zhang@intel.com>
|
||||
Tested-by: Jun W Zhou <junx.w.zhou@intel.com>
|
||||
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
|
||||
---
|
||||
app/test-pmd/cmdline_flow.c | 5 ++++-
|
||||
1 file changed, 4 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c
|
||||
index 0618611ab1..067e120743 100644
|
||||
--- a/app/test-pmd/cmdline_flow.c
|
||||
+++ b/app/test-pmd/cmdline_flow.c
|
||||
@@ -3541,7 +3541,10 @@ static const struct token token_list[] = {
|
||||
.name = "key",
|
||||
.help = "RSS hash key",
|
||||
.next = NEXT(action_rss, NEXT_ENTRY(HEX)),
|
||||
- .args = ARGS(ARGS_ENTRY_ARB(0, 0),
|
||||
+ .args = ARGS(ARGS_ENTRY_ARB
|
||||
+ (offsetof(struct action_rss_data, conf) +
|
||||
+ offsetof(struct rte_flow_action_rss, key),
|
||||
+ sizeof(((struct rte_flow_action_rss *)0)->key)),
|
||||
ARGS_ENTRY_ARB
|
||||
(offsetof(struct action_rss_data, conf) +
|
||||
offsetof(struct rte_flow_action_rss, key_len),
|
||||
--
|
||||
2.33.0
|
||||
|
||||
40
0233-app-testpmd-release-flows-left-before-port-stop.patch
Normal file
40
0233-app-testpmd-release-flows-left-before-port-stop.patch
Normal file
@ -0,0 +1,40 @@
|
||||
From b71d309637e90a67f7814604f3a17b696b6304ce Mon Sep 17 00:00:00 2001
|
||||
From: Gregory Etelson <getelson@nvidia.com>
|
||||
Date: Thu, 26 Nov 2020 18:43:02 +0200
|
||||
Subject: [PATCH] app/testpmd: release flows left before port stop
|
||||
|
||||
According to RTE flow user guide, PMD will not keep flow rules after
|
||||
port stop. Application resources that refer to flow rules become
|
||||
obsolete after port stop and must not be used.
|
||||
Testpmd maintains linked list of active flows for each port. Entries in
|
||||
that list are allocated dynamically and must be explicitly released to
|
||||
prevent memory leak.
|
||||
The patch releases testpmd port flow_list that holds remaining flows
|
||||
before port is stopped.
|
||||
|
||||
Cc: stable@dpdk.org
|
||||
|
||||
Signed-off-by: Gregory Etelson <getelson@nvidia.com>
|
||||
Acked-by: Ori Kam <orika@nvidia.com>
|
||||
Acked-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
|
||||
---
|
||||
app/test-pmd/testpmd.c | 3 +++
|
||||
1 file changed, 3 insertions(+)
|
||||
|
||||
diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
|
||||
index 60636830b..7bede14ce 100644
|
||||
--- a/app/test-pmd/testpmd.c
|
||||
+++ b/app/test-pmd/testpmd.c
|
||||
@@ -2768,6 +2768,9 @@ stop_port(portid_t pid)
|
||||
}
|
||||
}
|
||||
|
||||
+ if (port->flow_list)
|
||||
+ port_flow_flush(pi);
|
||||
+
|
||||
if (eth_dev_stop_mp(pi) != 0)
|
||||
RTE_LOG(ERR, EAL, "rte_eth_dev_stop failed for port %u\n",
|
||||
pi);
|
||||
--
|
||||
2.33.0
|
||||
|
||||
33
0234-app-testpmd-delete-unused-function.patch
Normal file
33
0234-app-testpmd-delete-unused-function.patch
Normal file
@ -0,0 +1,33 @@
|
||||
From 888d05e90f1dd78cd5075048206e573b0e30e40c Mon Sep 17 00:00:00 2001
|
||||
From: "Min Hu (Connor)" <humin29@huawei.com>
|
||||
Date: Wed, 10 Nov 2021 16:50:56 +0800
|
||||
Subject: [PATCH 01/33] app/testpmd: delete unused function
|
||||
|
||||
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
|
||||
---
|
||||
app/test-pmd/testpmd.c | 9 ---------
|
||||
1 file changed, 9 deletions(-)
|
||||
|
||||
diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
|
||||
index 50a2a5a94..e3b5a165d 100644
|
||||
--- a/app/test-pmd/testpmd.c
|
||||
+++ b/app/test-pmd/testpmd.c
|
||||
@@ -552,15 +552,6 @@ mempool_free_mp(struct rte_mempool *mp)
|
||||
rte_mempool_free(mp);
|
||||
}
|
||||
|
||||
-static int
|
||||
-eth_dev_set_mtu_mp(uint16_t port_id, uint16_t mtu)
|
||||
-{
|
||||
- if (is_proc_primary())
|
||||
- return rte_eth_dev_set_mtu(port_id, mtu);
|
||||
-
|
||||
- return 0;
|
||||
-}
|
||||
-
|
||||
/* Forward function declarations */
|
||||
static void setup_attached_port(portid_t pi);
|
||||
static void check_all_ports_link_status(uint32_t port_mask);
|
||||
--
|
||||
2.33.0
|
||||
|
||||
7487
0235-dmadev-introduce-DMA-device-support.patch
Normal file
7487
0235-dmadev-introduce-DMA-device-support.patch
Normal file
File diff suppressed because it is too large
Load Diff
75
0236-net-hns3-rename-multicast-address-function.patch
Normal file
75
0236-net-hns3-rename-multicast-address-function.patch
Normal file
@ -0,0 +1,75 @@
|
||||
From d7faa4a4fee44a2fdaa003e3ab8df477d710f76c Mon Sep 17 00:00:00 2001
|
||||
From: Huisong Li <lihuisong@huawei.com>
|
||||
Date: Fri, 22 Oct 2021 17:19:52 +0800
|
||||
Subject: [PATCH 03/33] net/hns3: rename multicast address function
|
||||
|
||||
This patch renames hns3_add_mc_addr() to hns3_add_mc_mac_addr().
|
||||
|
||||
Signed-off-by: Huisong Li <lihuisong@huawei.com>
|
||||
---
|
||||
drivers/net/hns3/hns3_ethdev.c | 14 +++++++-------
|
||||
1 file changed, 7 insertions(+), 7 deletions(-)
|
||||
|
||||
diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c
|
||||
index 2ae4cb9b7..b67386b1f 100644
|
||||
--- a/drivers/net/hns3/hns3_ethdev.c
|
||||
+++ b/drivers/net/hns3/hns3_ethdev.c
|
||||
@@ -95,8 +95,8 @@ static int hns3_vlan_pvid_configure(struct hns3_adapter *hns, uint16_t pvid,
|
||||
static int hns3_update_link_info(struct rte_eth_dev *eth_dev);
|
||||
static bool hns3_update_link_status(struct hns3_hw *hw);
|
||||
|
||||
-static int hns3_add_mc_addr(struct hns3_hw *hw,
|
||||
- struct rte_ether_addr *mac_addr);
|
||||
+static int hns3_add_mc_mac_addr(struct hns3_hw *hw,
|
||||
+ struct rte_ether_addr *mac_addr);
|
||||
static int hns3_remove_mc_addr(struct hns3_hw *hw,
|
||||
struct rte_ether_addr *mac_addr);
|
||||
static int hns3_restore_fec(struct hns3_hw *hw);
|
||||
@@ -1630,7 +1630,7 @@ hns3_add_mc_addr_common(struct hns3_hw *hw, struct rte_ether_addr *mac_addr)
|
||||
}
|
||||
}
|
||||
|
||||
- ret = hns3_add_mc_addr(hw, mac_addr);
|
||||
+ ret = hns3_add_mc_mac_addr(hw, mac_addr);
|
||||
if (ret) {
|
||||
hns3_ether_format_addr(mac_str, RTE_ETHER_ADDR_FMT_SIZE,
|
||||
mac_addr);
|
||||
@@ -1826,7 +1826,7 @@ hns3_configure_all_mac_addr(struct hns3_adapter *hns, bool del)
|
||||
continue;
|
||||
if (rte_is_multicast_ether_addr(addr))
|
||||
ret = del ? hns3_remove_mc_addr(hw, addr) :
|
||||
- hns3_add_mc_addr(hw, addr);
|
||||
+ hns3_add_mc_mac_addr(hw, addr);
|
||||
else
|
||||
ret = del ? hns3_remove_uc_addr_common(hw, addr) :
|
||||
hns3_add_uc_addr_common(hw, addr);
|
||||
@@ -1872,7 +1872,7 @@ hns3_update_desc_vfid(struct hns3_cmd_desc *desc, uint8_t vfid, bool clr)
|
||||
}
|
||||
|
||||
static int
|
||||
-hns3_add_mc_addr(struct hns3_hw *hw, struct rte_ether_addr *mac_addr)
|
||||
+hns3_add_mc_mac_addr(struct hns3_hw *hw, struct rte_ether_addr *mac_addr)
|
||||
{
|
||||
struct hns3_cmd_desc desc[HNS3_MC_MAC_VLAN_OPS_DESC_NUM];
|
||||
struct hns3_mac_vlan_tbl_entry_cmd req;
|
||||
@@ -2156,7 +2156,7 @@ hns3_set_mc_mac_addr_list(struct rte_eth_dev *dev,
|
||||
/* Add mc mac addresses */
|
||||
for (i = 0; i < add_addr_num; i++) {
|
||||
addr = &add_addr_list[i];
|
||||
- ret = hns3_add_mc_addr(hw, addr);
|
||||
+ ret = hns3_add_mc_mac_addr(hw, addr);
|
||||
if (ret) {
|
||||
rte_spinlock_unlock(&hw->lock);
|
||||
return ret;
|
||||
@@ -2188,7 +2188,7 @@ hns3_configure_all_mc_mac_addr(struct hns3_adapter *hns, bool del)
|
||||
if (del)
|
||||
ret = hns3_remove_mc_addr(hw, addr);
|
||||
else
|
||||
- ret = hns3_add_mc_addr(hw, addr);
|
||||
+ ret = hns3_add_mc_mac_addr(hw, addr);
|
||||
if (ret) {
|
||||
err = ret;
|
||||
hns3_ether_format_addr(mac_str, RTE_ETHER_ADDR_FMT_SIZE,
|
||||
--
|
||||
2.33.0
|
||||
|
||||
65
0237-net-hns3-rename-unicast-address-function.patch
Normal file
65
0237-net-hns3-rename-unicast-address-function.patch
Normal file
@ -0,0 +1,65 @@
|
||||
From 5182a373038fc21368ffb61450e5e63d63471d4f Mon Sep 17 00:00:00 2001
|
||||
From: Huisong Li <lihuisong@huawei.com>
|
||||
Date: Fri, 22 Oct 2021 17:19:53 +0800
|
||||
Subject: [PATCH 04/33] net/hns3: rename unicast address function
|
||||
|
||||
This patch renames hns3_add_uc_addr() to hns3_add_uc_mac_addr().
|
||||
|
||||
Signed-off-by: Huisong Li <lihuisong@huawei.com>
|
||||
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
|
||||
---
|
||||
drivers/net/hns3/hns3_ethdev.c | 10 +++++-----
|
||||
1 file changed, 5 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c
|
||||
index b67386b1f..83472a83b 100644
|
||||
--- a/drivers/net/hns3/hns3_ethdev.c
|
||||
+++ b/drivers/net/hns3/hns3_ethdev.c
|
||||
@@ -1540,7 +1540,7 @@ hns3_remove_mac_vlan_tbl(struct hns3_hw *hw,
|
||||
}
|
||||
|
||||
static int
|
||||
-hns3_add_uc_addr_common(struct hns3_hw *hw, struct rte_ether_addr *mac_addr)
|
||||
+hns3_add_uc_mac_addr(struct hns3_hw *hw, struct rte_ether_addr *mac_addr)
|
||||
{
|
||||
struct hns3_adapter *hns = HNS3_DEV_HW_TO_ADAPTER(hw);
|
||||
struct hns3_mac_vlan_tbl_entry_cmd req;
|
||||
@@ -1678,7 +1678,7 @@ hns3_add_mac_addr(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr,
|
||||
if (rte_is_multicast_ether_addr(mac_addr))
|
||||
ret = hns3_add_mc_addr_common(hw, mac_addr);
|
||||
else
|
||||
- ret = hns3_add_uc_addr_common(hw, mac_addr);
|
||||
+ ret = hns3_add_uc_mac_addr(hw, mac_addr);
|
||||
|
||||
if (ret) {
|
||||
rte_spinlock_unlock(&hw->lock);
|
||||
@@ -1768,7 +1768,7 @@ hns3_set_default_mac_addr(struct rte_eth_dev *dev,
|
||||
return ret;
|
||||
}
|
||||
|
||||
- ret = hns3_add_uc_addr_common(hw, mac_addr);
|
||||
+ ret = hns3_add_uc_mac_addr(hw, mac_addr);
|
||||
if (ret) {
|
||||
hns3_ether_format_addr(mac_str, RTE_ETHER_ADDR_FMT_SIZE,
|
||||
mac_addr);
|
||||
@@ -1799,7 +1799,7 @@ hns3_set_default_mac_addr(struct rte_eth_dev *dev,
|
||||
}
|
||||
|
||||
err_add_uc_addr:
|
||||
- ret_val = hns3_add_uc_addr_common(hw, oaddr);
|
||||
+ ret_val = hns3_add_uc_mac_addr(hw, oaddr);
|
||||
if (ret_val) {
|
||||
hns3_ether_format_addr(mac_str, RTE_ETHER_ADDR_FMT_SIZE, oaddr);
|
||||
hns3_warn(hw, "Failed to restore old uc mac addr(%s): %d",
|
||||
@@ -1829,7 +1829,7 @@ hns3_configure_all_mac_addr(struct hns3_adapter *hns, bool del)
|
||||
hns3_add_mc_mac_addr(hw, addr);
|
||||
else
|
||||
ret = del ? hns3_remove_uc_addr_common(hw, addr) :
|
||||
- hns3_add_uc_addr_common(hw, addr);
|
||||
+ hns3_add_uc_mac_addr(hw, addr);
|
||||
|
||||
if (ret) {
|
||||
err = ret;
|
||||
--
|
||||
2.33.0
|
||||
|
||||
@ -0,0 +1,76 @@
|
||||
From 11e3b4820eba69f93a623565609fa3e48de6dbdb Mon Sep 17 00:00:00 2001
|
||||
From: Huisong Li <lihuisong@huawei.com>
|
||||
Date: Fri, 22 Oct 2021 17:19:54 +0800
|
||||
Subject: [PATCH 05/33] net/hns3: rename multicast address removal function
|
||||
|
||||
This patch renames hns3_remove_mc_addr() to hns3_remove_mc_mac_addr().
|
||||
|
||||
Signed-off-by: Huisong Li <lihuisong@huawei.com>
|
||||
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
|
||||
---
|
||||
drivers/net/hns3/hns3_ethdev.c | 14 +++++++-------
|
||||
1 file changed, 7 insertions(+), 7 deletions(-)
|
||||
|
||||
diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c
|
||||
index 83472a83b..e0ec99811 100644
|
||||
--- a/drivers/net/hns3/hns3_ethdev.c
|
||||
+++ b/drivers/net/hns3/hns3_ethdev.c
|
||||
@@ -97,8 +97,8 @@ static bool hns3_update_link_status(struct hns3_hw *hw);
|
||||
|
||||
static int hns3_add_mc_mac_addr(struct hns3_hw *hw,
|
||||
struct rte_ether_addr *mac_addr);
|
||||
-static int hns3_remove_mc_addr(struct hns3_hw *hw,
|
||||
- struct rte_ether_addr *mac_addr);
|
||||
+static int hns3_remove_mc_mac_addr(struct hns3_hw *hw,
|
||||
+ struct rte_ether_addr *mac_addr);
|
||||
static int hns3_restore_fec(struct hns3_hw *hw);
|
||||
static int hns3_query_dev_fec_info(struct hns3_hw *hw);
|
||||
static int hns3_do_stop(struct hns3_adapter *hns);
|
||||
@@ -1646,7 +1646,7 @@ hns3_remove_mc_addr_common(struct hns3_hw *hw, struct rte_ether_addr *mac_addr)
|
||||
char mac_str[RTE_ETHER_ADDR_FMT_SIZE];
|
||||
int ret;
|
||||
|
||||
- ret = hns3_remove_mc_addr(hw, mac_addr);
|
||||
+ ret = hns3_remove_mc_mac_addr(hw, mac_addr);
|
||||
if (ret) {
|
||||
hns3_ether_format_addr(mac_str, RTE_ETHER_ADDR_FMT_SIZE,
|
||||
mac_addr);
|
||||
@@ -1825,7 +1825,7 @@ hns3_configure_all_mac_addr(struct hns3_adapter *hns, bool del)
|
||||
if (rte_is_zero_ether_addr(addr))
|
||||
continue;
|
||||
if (rte_is_multicast_ether_addr(addr))
|
||||
- ret = del ? hns3_remove_mc_addr(hw, addr) :
|
||||
+ ret = del ? hns3_remove_mc_mac_addr(hw, addr) :
|
||||
hns3_add_mc_mac_addr(hw, addr);
|
||||
else
|
||||
ret = del ? hns3_remove_uc_addr_common(hw, addr) :
|
||||
@@ -1921,7 +1921,7 @@ hns3_add_mc_mac_addr(struct hns3_hw *hw, struct rte_ether_addr *mac_addr)
|
||||
}
|
||||
|
||||
static int
|
||||
-hns3_remove_mc_addr(struct hns3_hw *hw, struct rte_ether_addr *mac_addr)
|
||||
+hns3_remove_mc_mac_addr(struct hns3_hw *hw, struct rte_ether_addr *mac_addr)
|
||||
{
|
||||
struct hns3_mac_vlan_tbl_entry_cmd req;
|
||||
struct hns3_cmd_desc desc[3];
|
||||
@@ -2145,7 +2145,7 @@ hns3_set_mc_mac_addr_list(struct rte_eth_dev *dev,
|
||||
for (i = 0; i < rm_addr_num; i++) {
|
||||
num = rm_addr_num - i - 1;
|
||||
addr = &rm_addr_list[num];
|
||||
- ret = hns3_remove_mc_addr(hw, addr);
|
||||
+ ret = hns3_remove_mc_mac_addr(hw, addr);
|
||||
if (ret) {
|
||||
rte_spinlock_unlock(&hw->lock);
|
||||
return ret;
|
||||
@@ -2186,7 +2186,7 @@ hns3_configure_all_mc_mac_addr(struct hns3_adapter *hns, bool del)
|
||||
if (!rte_is_multicast_ether_addr(addr))
|
||||
continue;
|
||||
if (del)
|
||||
- ret = hns3_remove_mc_addr(hw, addr);
|
||||
+ ret = hns3_remove_mc_mac_addr(hw, addr);
|
||||
else
|
||||
ret = hns3_add_mc_mac_addr(hw, addr);
|
||||
if (ret) {
|
||||
--
|
||||
2.33.0
|
||||
|
||||
114
0239-net-hns3-extract-common-interface-to-check-duplicate.patch
Normal file
114
0239-net-hns3-extract-common-interface-to-check-duplicate.patch
Normal file
@ -0,0 +1,114 @@
|
||||
From e7ad3ead98f61e7f759293ad05dfe48627c72e2c Mon Sep 17 00:00:00 2001
|
||||
From: Huisong Li <lihuisong@huawei.com>
|
||||
Date: Fri, 22 Oct 2021 17:19:55 +0800
|
||||
Subject: [PATCH 06/33] net/hns3: extract common interface to check duplicates
|
||||
|
||||
Extract a common interface for PF and VF to check whether the configured
|
||||
multicast MAC address from rte_eth_dev_mac_addr_add() is the same as the
|
||||
multicast MAC address from rte_eth_dev_set_mc_addr_list().
|
||||
|
||||
Signed-off-by: Huisong Li <lihuisong@huawei.com>
|
||||
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
|
||||
---
|
||||
drivers/net/hns3/hns3_ethdev.c | 25 ++++++++++++++++++-------
|
||||
drivers/net/hns3/hns3_ethdev.h | 4 ++++
|
||||
drivers/net/hns3/hns3_ethdev_vf.c | 16 ++--------------
|
||||
3 files changed, 24 insertions(+), 21 deletions(-)
|
||||
|
||||
diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c
|
||||
index e0ec99811..f1346ee9f 100644
|
||||
--- a/drivers/net/hns3/hns3_ethdev.c
|
||||
+++ b/drivers/net/hns3/hns3_ethdev.c
|
||||
@@ -1609,27 +1609,38 @@ hns3_add_uc_mac_addr(struct hns3_hw *hw, struct rte_ether_addr *mac_addr)
|
||||
return ret;
|
||||
}
|
||||
|
||||
-static int
|
||||
-hns3_add_mc_addr_common(struct hns3_hw *hw, struct rte_ether_addr *mac_addr)
|
||||
+bool
|
||||
+hns3_find_duplicate_mc_addr(struct hns3_hw *hw, struct rte_ether_addr *mc_addr)
|
||||
{
|
||||
char mac_str[RTE_ETHER_ADDR_FMT_SIZE];
|
||||
struct rte_ether_addr *addr;
|
||||
- int ret;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < hw->mc_addrs_num; i++) {
|
||||
addr = &hw->mc_addrs[i];
|
||||
- /* Check if there are duplicate addresses */
|
||||
- if (rte_is_same_ether_addr(addr, mac_addr)) {
|
||||
+ /* Check if there are duplicate addresses in mc_addrs[] */
|
||||
+ if (rte_is_same_ether_addr(addr, mc_addr)) {
|
||||
hns3_ether_format_addr(mac_str, RTE_ETHER_ADDR_FMT_SIZE,
|
||||
- addr);
|
||||
+ addr);
|
||||
hns3_err(hw, "failed to add mc mac addr, same addrs"
|
||||
"(%s) is added by the set_mc_mac_addr_list "
|
||||
"API", mac_str);
|
||||
- return -EINVAL;
|
||||
+ return true;
|
||||
}
|
||||
}
|
||||
|
||||
+ return false;
|
||||
+}
|
||||
+
|
||||
+static int
|
||||
+hns3_add_mc_addr_common(struct hns3_hw *hw, struct rte_ether_addr *mac_addr)
|
||||
+{
|
||||
+ char mac_str[RTE_ETHER_ADDR_FMT_SIZE];
|
||||
+ int ret;
|
||||
+
|
||||
+ if (hns3_find_duplicate_mc_addr(hw, mac_addr))
|
||||
+ return -EINVAL;
|
||||
+
|
||||
ret = hns3_add_mc_mac_addr(hw, mac_addr);
|
||||
if (ret) {
|
||||
hns3_ether_format_addr(mac_str, RTE_ETHER_ADDR_FMT_SIZE,
|
||||
diff --git a/drivers/net/hns3/hns3_ethdev.h b/drivers/net/hns3/hns3_ethdev.h
|
||||
index 84f5a9f29..a97406198 100644
|
||||
--- a/drivers/net/hns3/hns3_ethdev.h
|
||||
+++ b/drivers/net/hns3/hns3_ethdev.h
|
||||
@@ -1049,6 +1049,10 @@ void hns3vf_update_link_status(struct hns3_hw *hw, uint8_t link_status,
|
||||
uint32_t link_speed, uint8_t link_duplex);
|
||||
void hns3_parse_devargs(struct rte_eth_dev *dev);
|
||||
void hns3vf_update_push_lsc_cap(struct hns3_hw *hw, bool supported);
|
||||
+
|
||||
+bool hns3_find_duplicate_mc_addr(struct hns3_hw *hw,
|
||||
+ struct rte_ether_addr *mc_addr);
|
||||
+
|
||||
int hns3_restore_ptp(struct hns3_adapter *hns);
|
||||
int hns3_mbuf_dyn_rx_timestamp_register(struct rte_eth_dev *dev,
|
||||
struct rte_eth_conf *conf);
|
||||
diff --git a/drivers/net/hns3/hns3_ethdev_vf.c b/drivers/net/hns3/hns3_ethdev_vf.c
|
||||
index 29313c2f7..f60849606 100644
|
||||
--- a/drivers/net/hns3/hns3_ethdev_vf.c
|
||||
+++ b/drivers/net/hns3/hns3_ethdev_vf.c
|
||||
@@ -208,22 +208,10 @@ static int
|
||||
hns3vf_add_mc_addr_common(struct hns3_hw *hw, struct rte_ether_addr *mac_addr)
|
||||
{
|
||||
char mac_str[RTE_ETHER_ADDR_FMT_SIZE];
|
||||
- struct rte_ether_addr *addr;
|
||||
int ret;
|
||||
- int i;
|
||||
|
||||
- for (i = 0; i < hw->mc_addrs_num; i++) {
|
||||
- addr = &hw->mc_addrs[i];
|
||||
- /* Check if there are duplicate addresses */
|
||||
- if (rte_is_same_ether_addr(addr, mac_addr)) {
|
||||
- hns3_ether_format_addr(mac_str, RTE_ETHER_ADDR_FMT_SIZE,
|
||||
- addr);
|
||||
- hns3_err(hw, "failed to add mc mac addr, same addrs"
|
||||
- "(%s) is added by the set_mc_mac_addr_list "
|
||||
- "API", mac_str);
|
||||
- return -EINVAL;
|
||||
- }
|
||||
- }
|
||||
+ if (hns3_find_duplicate_mc_addr(hw, mac_addr))
|
||||
+ return -EINVAL;
|
||||
|
||||
ret = hns3vf_add_mc_mac_addr(hw, mac_addr);
|
||||
if (ret) {
|
||||
--
|
||||
2.33.0
|
||||
|
||||
117
0240-net-hns3-remove-redundant-multicast-MAC-interface.patch
Normal file
117
0240-net-hns3-remove-redundant-multicast-MAC-interface.patch
Normal file
@ -0,0 +1,117 @@
|
||||
From b84b0e518dc64f3aada5b30511db1c6f6fdb0694 Mon Sep 17 00:00:00 2001
|
||||
From: Huisong Li <lihuisong@huawei.com>
|
||||
Date: Fri, 22 Oct 2021 17:19:56 +0800
|
||||
Subject: [PATCH 07/33] net/hns3: remove redundant multicast MAC interface
|
||||
|
||||
This patch removes hns3_add_mc_addr_common() in PF and
|
||||
hns3vf_add_mc_addr_common() in VF.
|
||||
|
||||
Signed-off-by: Huisong Li <lihuisong@huawei.com>
|
||||
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
|
||||
---
|
||||
drivers/net/hns3/hns3_ethdev.c | 31 ++++++++-----------------------
|
||||
drivers/net/hns3/hns3_ethdev_vf.c | 30 ++++++++----------------------
|
||||
2 files changed, 16 insertions(+), 45 deletions(-)
|
||||
|
||||
diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c
|
||||
index f1346ee9f..7f4419c54 100644
|
||||
--- a/drivers/net/hns3/hns3_ethdev.c
|
||||
+++ b/drivers/net/hns3/hns3_ethdev.c
|
||||
@@ -1632,25 +1632,6 @@ hns3_find_duplicate_mc_addr(struct hns3_hw *hw, struct rte_ether_addr *mc_addr)
|
||||
return false;
|
||||
}
|
||||
|
||||
-static int
|
||||
-hns3_add_mc_addr_common(struct hns3_hw *hw, struct rte_ether_addr *mac_addr)
|
||||
-{
|
||||
- char mac_str[RTE_ETHER_ADDR_FMT_SIZE];
|
||||
- int ret;
|
||||
-
|
||||
- if (hns3_find_duplicate_mc_addr(hw, mac_addr))
|
||||
- return -EINVAL;
|
||||
-
|
||||
- ret = hns3_add_mc_mac_addr(hw, mac_addr);
|
||||
- if (ret) {
|
||||
- hns3_ether_format_addr(mac_str, RTE_ETHER_ADDR_FMT_SIZE,
|
||||
- mac_addr);
|
||||
- hns3_err(hw, "failed to add mc mac addr(%s), ret = %d",
|
||||
- mac_str, ret);
|
||||
- }
|
||||
- return ret;
|
||||
-}
|
||||
-
|
||||
static int
|
||||
hns3_remove_mc_addr_common(struct hns3_hw *hw, struct rte_ether_addr *mac_addr)
|
||||
{
|
||||
@@ -1686,11 +1667,15 @@ hns3_add_mac_addr(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr,
|
||||
* using the rte_eth_dev_mac_addr_add API function to set MC mac address
|
||||
* may affect the specifications of UC mac addresses.
|
||||
*/
|
||||
- if (rte_is_multicast_ether_addr(mac_addr))
|
||||
- ret = hns3_add_mc_addr_common(hw, mac_addr);
|
||||
- else
|
||||
+ if (rte_is_multicast_ether_addr(mac_addr)) {
|
||||
+ if (hns3_find_duplicate_mc_addr(hw, mac_addr)) {
|
||||
+ rte_spinlock_unlock(&hw->lock);
|
||||
+ return -EINVAL;
|
||||
+ }
|
||||
+ ret = hns3_add_mc_mac_addr(hw, mac_addr);
|
||||
+ } else {
|
||||
ret = hns3_add_uc_mac_addr(hw, mac_addr);
|
||||
-
|
||||
+ }
|
||||
if (ret) {
|
||||
rte_spinlock_unlock(&hw->lock);
|
||||
hns3_ether_format_addr(mac_str, RTE_ETHER_ADDR_FMT_SIZE,
|
||||
diff --git a/drivers/net/hns3/hns3_ethdev_vf.c b/drivers/net/hns3/hns3_ethdev_vf.c
|
||||
index f60849606..92673d29b 100644
|
||||
--- a/drivers/net/hns3/hns3_ethdev_vf.c
|
||||
+++ b/drivers/net/hns3/hns3_ethdev_vf.c
|
||||
@@ -204,25 +204,6 @@ hns3vf_remove_uc_mac_addr(struct hns3_hw *hw, struct rte_ether_addr *mac_addr)
|
||||
return ret;
|
||||
}
|
||||
|
||||
-static int
|
||||
-hns3vf_add_mc_addr_common(struct hns3_hw *hw, struct rte_ether_addr *mac_addr)
|
||||
-{
|
||||
- char mac_str[RTE_ETHER_ADDR_FMT_SIZE];
|
||||
- int ret;
|
||||
-
|
||||
- if (hns3_find_duplicate_mc_addr(hw, mac_addr))
|
||||
- return -EINVAL;
|
||||
-
|
||||
- ret = hns3vf_add_mc_mac_addr(hw, mac_addr);
|
||||
- if (ret) {
|
||||
- hns3_ether_format_addr(mac_str, RTE_ETHER_ADDR_FMT_SIZE,
|
||||
- mac_addr);
|
||||
- hns3_err(hw, "failed to add mc mac addr(%s), ret = %d",
|
||||
- mac_str, ret);
|
||||
- }
|
||||
- return ret;
|
||||
-}
|
||||
-
|
||||
static int
|
||||
hns3vf_add_mac_addr(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr,
|
||||
__rte_unused uint32_t idx,
|
||||
@@ -243,10 +224,15 @@ hns3vf_add_mac_addr(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr,
|
||||
* using the rte_eth_dev_mac_addr_add API function to set MC mac address
|
||||
* may affect the specifications of UC mac addresses.
|
||||
*/
|
||||
- if (rte_is_multicast_ether_addr(mac_addr))
|
||||
- ret = hns3vf_add_mc_addr_common(hw, mac_addr);
|
||||
- else
|
||||
+ if (rte_is_multicast_ether_addr(mac_addr)) {
|
||||
+ if (hns3_find_duplicate_mc_addr(hw, mac_addr)) {
|
||||
+ rte_spinlock_unlock(&hw->lock);
|
||||
+ return -EINVAL;
|
||||
+ }
|
||||
+ ret = hns3vf_add_mc_mac_addr(hw, mac_addr);
|
||||
+ } else {
|
||||
ret = hns3vf_add_uc_mac_addr(hw, mac_addr);
|
||||
+ }
|
||||
|
||||
rte_spinlock_unlock(&hw->lock);
|
||||
if (ret) {
|
||||
--
|
||||
2.33.0
|
||||
|
||||
66
0241-net-hns3-rename-unicast-address-removal-function.patch
Normal file
66
0241-net-hns3-rename-unicast-address-removal-function.patch
Normal file
@ -0,0 +1,66 @@
|
||||
From d89d75e54b10a18d40306e3dcc8921275cc9b81b Mon Sep 17 00:00:00 2001
|
||||
From: Huisong Li <lihuisong@huawei.com>
|
||||
Date: Fri, 22 Oct 2021 17:19:57 +0800
|
||||
Subject: [PATCH 08/33] net/hns3: rename unicast address removal function
|
||||
|
||||
This patch renames hns3_remove_uc_addr_common() to
|
||||
hns3_remove_uc_mac_addr() in PF.
|
||||
|
||||
Signed-off-by: Huisong Li <lihuisong@huawei.com>
|
||||
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
|
||||
---
|
||||
drivers/net/hns3/hns3_ethdev.c | 10 +++++-----
|
||||
1 file changed, 5 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c
|
||||
index 7f4419c54..485995a43 100644
|
||||
--- a/drivers/net/hns3/hns3_ethdev.c
|
||||
+++ b/drivers/net/hns3/hns3_ethdev.c
|
||||
@@ -1691,7 +1691,7 @@ hns3_add_mac_addr(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr,
|
||||
}
|
||||
|
||||
static int
|
||||
-hns3_remove_uc_addr_common(struct hns3_hw *hw, struct rte_ether_addr *mac_addr)
|
||||
+hns3_remove_uc_mac_addr(struct hns3_hw *hw, struct rte_ether_addr *mac_addr)
|
||||
{
|
||||
struct hns3_mac_vlan_tbl_entry_cmd req;
|
||||
char mac_str[RTE_ETHER_ADDR_FMT_SIZE];
|
||||
@@ -1732,7 +1732,7 @@ hns3_remove_mac_addr(struct rte_eth_dev *dev, uint32_t idx)
|
||||
if (rte_is_multicast_ether_addr(mac_addr))
|
||||
ret = hns3_remove_mc_addr_common(hw, mac_addr);
|
||||
else
|
||||
- ret = hns3_remove_uc_addr_common(hw, mac_addr);
|
||||
+ ret = hns3_remove_uc_mac_addr(hw, mac_addr);
|
||||
rte_spinlock_unlock(&hw->lock);
|
||||
if (ret) {
|
||||
hns3_ether_format_addr(mac_str, RTE_ETHER_ADDR_FMT_SIZE,
|
||||
@@ -1753,7 +1753,7 @@ hns3_set_default_mac_addr(struct rte_eth_dev *dev,
|
||||
|
||||
rte_spinlock_lock(&hw->lock);
|
||||
oaddr = (struct rte_ether_addr *)hw->mac.mac_addr;
|
||||
- ret = hns3_remove_uc_addr_common(hw, oaddr);
|
||||
+ ret = hns3_remove_uc_mac_addr(hw, oaddr);
|
||||
if (ret) {
|
||||
hns3_ether_format_addr(mac_str, RTE_ETHER_ADDR_FMT_SIZE,
|
||||
oaddr);
|
||||
@@ -1785,7 +1785,7 @@ hns3_set_default_mac_addr(struct rte_eth_dev *dev,
|
||||
return 0;
|
||||
|
||||
err_pause_addr_cfg:
|
||||
- ret_val = hns3_remove_uc_addr_common(hw, mac_addr);
|
||||
+ ret_val = hns3_remove_uc_mac_addr(hw, mac_addr);
|
||||
if (ret_val) {
|
||||
hns3_ether_format_addr(mac_str, RTE_ETHER_ADDR_FMT_SIZE,
|
||||
mac_addr);
|
||||
@@ -1824,7 +1824,7 @@ hns3_configure_all_mac_addr(struct hns3_adapter *hns, bool del)
|
||||
ret = del ? hns3_remove_mc_mac_addr(hw, addr) :
|
||||
hns3_add_mc_mac_addr(hw, addr);
|
||||
else
|
||||
- ret = del ? hns3_remove_uc_addr_common(hw, addr) :
|
||||
+ ret = del ? hns3_remove_uc_mac_addr(hw, addr) :
|
||||
hns3_add_uc_mac_addr(hw, addr);
|
||||
|
||||
if (ret) {
|
||||
--
|
||||
2.33.0
|
||||
|
||||
@ -0,0 +1,53 @@
|
||||
From 3e96668301de4168ef51a6b43535b851c25290da Mon Sep 17 00:00:00 2001
|
||||
From: Huisong Li <lihuisong@huawei.com>
|
||||
Date: Fri, 22 Oct 2021 17:19:58 +0800
|
||||
Subject: [PATCH 09/33] net/hns3: remove redundant multicast removal interface
|
||||
|
||||
This patch removes redundant hns3_remove_mc_addr_common(), which can be
|
||||
replaced by hns3_remove_mc_mac_addr().
|
||||
|
||||
Signed-off-by: Huisong Li <lihuisong@huawei.com>
|
||||
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
|
||||
---
|
||||
drivers/net/hns3/hns3_ethdev.c | 18 +-----------------
|
||||
1 file changed, 1 insertion(+), 17 deletions(-)
|
||||
|
||||
diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c
|
||||
index 485995a43..a2d365a28 100644
|
||||
--- a/drivers/net/hns3/hns3_ethdev.c
|
||||
+++ b/drivers/net/hns3/hns3_ethdev.c
|
||||
@@ -1632,22 +1632,6 @@ hns3_find_duplicate_mc_addr(struct hns3_hw *hw, struct rte_ether_addr *mc_addr)
|
||||
return false;
|
||||
}
|
||||
|
||||
-static int
|
||||
-hns3_remove_mc_addr_common(struct hns3_hw *hw, struct rte_ether_addr *mac_addr)
|
||||
-{
|
||||
- char mac_str[RTE_ETHER_ADDR_FMT_SIZE];
|
||||
- int ret;
|
||||
-
|
||||
- ret = hns3_remove_mc_mac_addr(hw, mac_addr);
|
||||
- if (ret) {
|
||||
- hns3_ether_format_addr(mac_str, RTE_ETHER_ADDR_FMT_SIZE,
|
||||
- mac_addr);
|
||||
- hns3_err(hw, "failed to remove mc mac addr(%s), ret = %d",
|
||||
- mac_str, ret);
|
||||
- }
|
||||
- return ret;
|
||||
-}
|
||||
-
|
||||
static int
|
||||
hns3_add_mac_addr(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr,
|
||||
__rte_unused uint32_t idx, __rte_unused uint32_t pool)
|
||||
@@ -1730,7 +1714,7 @@ hns3_remove_mac_addr(struct rte_eth_dev *dev, uint32_t idx)
|
||||
rte_spinlock_lock(&hw->lock);
|
||||
|
||||
if (rte_is_multicast_ether_addr(mac_addr))
|
||||
- ret = hns3_remove_mc_addr_common(hw, mac_addr);
|
||||
+ ret = hns3_remove_mc_mac_addr(hw, mac_addr);
|
||||
else
|
||||
ret = hns3_remove_uc_mac_addr(hw, mac_addr);
|
||||
rte_spinlock_unlock(&hw->lock);
|
||||
--
|
||||
2.33.0
|
||||
|
||||
106
0243-net-hns3-add-HW-ops-structure-to-operate-hardware.patch
Normal file
106
0243-net-hns3-add-HW-ops-structure-to-operate-hardware.patch
Normal file
@ -0,0 +1,106 @@
|
||||
From ce3a4cda823aabc34c9166022b0cdb102723ef2a Mon Sep 17 00:00:00 2001
|
||||
From: Huisong Li <lihuisong@huawei.com>
|
||||
Date: Fri, 22 Oct 2021 17:19:59 +0800
|
||||
Subject: [PATCH 10/33] net/hns3: add HW ops structure to operate hardware
|
||||
|
||||
This patch adds hns3_hw_ops structure to operate hardware in PF and VF
|
||||
driver.
|
||||
|
||||
Signed-off-by: Huisong Li <lihuisong@huawei.com>
|
||||
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
|
||||
---
|
||||
drivers/net/hns3/hns3_ethdev.c | 10 ++++++++++
|
||||
drivers/net/hns3/hns3_ethdev.h | 13 +++++++++++++
|
||||
drivers/net/hns3/hns3_ethdev_vf.c | 10 ++++++++++
|
||||
3 files changed, 33 insertions(+)
|
||||
|
||||
diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c
|
||||
index a2d365a28..48c6483e1 100644
|
||||
--- a/drivers/net/hns3/hns3_ethdev.c
|
||||
+++ b/drivers/net/hns3/hns3_ethdev.c
|
||||
@@ -7478,6 +7478,15 @@ static const struct hns3_reset_ops hns3_reset_ops = {
|
||||
.start_service = hns3_start_service,
|
||||
};
|
||||
|
||||
+static void
|
||||
+hns3_init_hw_ops(struct hns3_hw *hw)
|
||||
+{
|
||||
+ hw->ops.add_mc_mac_addr = hns3_add_mc_mac_addr;
|
||||
+ hw->ops.del_mc_mac_addr = hns3_remove_mc_mac_addr;
|
||||
+ hw->ops.add_uc_mac_addr = hns3_add_uc_mac_addr;
|
||||
+ hw->ops.del_uc_mac_addr = hns3_remove_uc_mac_addr;
|
||||
+}
|
||||
+
|
||||
static int
|
||||
hns3_dev_init(struct rte_eth_dev *eth_dev)
|
||||
{
|
||||
@@ -7530,6 +7539,7 @@ hns3_dev_init(struct rte_eth_dev *eth_dev)
|
||||
goto err_init_reset;
|
||||
hw->reset.ops = &hns3_reset_ops;
|
||||
|
||||
+ hns3_init_hw_ops(hw);
|
||||
ret = hns3_init_pf(eth_dev);
|
||||
if (ret) {
|
||||
PMD_INIT_LOG(ERR, "Failed to init pf: %d", ret);
|
||||
diff --git a/drivers/net/hns3/hns3_ethdev.h b/drivers/net/hns3/hns3_ethdev.h
|
||||
index a97406198..73947e194 100644
|
||||
--- a/drivers/net/hns3/hns3_ethdev.h
|
||||
+++ b/drivers/net/hns3/hns3_ethdev.h
|
||||
@@ -428,6 +428,17 @@ struct hns3_reset_data {
|
||||
struct hns3_wait_data *wait_data;
|
||||
};
|
||||
|
||||
+struct hns3_hw_ops {
|
||||
+ int (*add_mc_mac_addr)(struct hns3_hw *hw,
|
||||
+ struct rte_ether_addr *mac_addr);
|
||||
+ int (*del_mc_mac_addr)(struct hns3_hw *hw,
|
||||
+ struct rte_ether_addr *mac_addr);
|
||||
+ int (*add_uc_mac_addr)(struct hns3_hw *hw,
|
||||
+ struct rte_ether_addr *mac_addr);
|
||||
+ int (*del_uc_mac_addr)(struct hns3_hw *hw,
|
||||
+ struct rte_ether_addr *mac_addr);
|
||||
+};
|
||||
+
|
||||
#define HNS3_INTR_MAPPING_VEC_RSV_ONE 0
|
||||
#define HNS3_INTR_MAPPING_VEC_ALL 1
|
||||
|
||||
@@ -638,6 +649,8 @@ struct hns3_hw {
|
||||
struct hns3_rss_filter_list flow_rss_list; /* flow RSS rule list */
|
||||
struct hns3_flow_mem_list flow_list;
|
||||
|
||||
+ struct hns3_hw_ops ops;
|
||||
+
|
||||
/*
|
||||
* PMD setup and configuration is not thread safe. Since it is not
|
||||
* performance sensitive, it is better to guarantee thread-safety
|
||||
diff --git a/drivers/net/hns3/hns3_ethdev_vf.c b/drivers/net/hns3/hns3_ethdev_vf.c
|
||||
index 92673d29b..1020b42e1 100644
|
||||
--- a/drivers/net/hns3/hns3_ethdev_vf.c
|
||||
+++ b/drivers/net/hns3/hns3_ethdev_vf.c
|
||||
@@ -2920,6 +2920,15 @@ static const struct hns3_reset_ops hns3vf_reset_ops = {
|
||||
.start_service = hns3vf_start_service,
|
||||
};
|
||||
|
||||
+static void
|
||||
+hns3vf_init_hw_ops(struct hns3_hw *hw)
|
||||
+{
|
||||
+ hw->ops.add_mc_mac_addr = hns3vf_add_mc_mac_addr;
|
||||
+ hw->ops.del_mc_mac_addr = hns3vf_remove_mc_mac_addr;
|
||||
+ hw->ops.add_uc_mac_addr = hns3vf_add_uc_mac_addr;
|
||||
+ hw->ops.del_uc_mac_addr = hns3vf_remove_uc_mac_addr;
|
||||
+}
|
||||
+
|
||||
static int
|
||||
hns3vf_dev_init(struct rte_eth_dev *eth_dev)
|
||||
{
|
||||
@@ -2964,6 +2973,7 @@ hns3vf_dev_init(struct rte_eth_dev *eth_dev)
|
||||
goto err_init_reset;
|
||||
hw->reset.ops = &hns3vf_reset_ops;
|
||||
|
||||
+ hns3vf_init_hw_ops(hw);
|
||||
ret = hns3vf_init_vf(eth_dev);
|
||||
if (ret) {
|
||||
PMD_INIT_LOG(ERR, "Failed to init vf: %d", ret);
|
||||
--
|
||||
2.33.0
|
||||
|
||||
213
0244-net-hns3-use-HW-ops-to-config-MAC-features.patch
Normal file
213
0244-net-hns3-use-HW-ops-to-config-MAC-features.patch
Normal file
@ -0,0 +1,213 @@
|
||||
From 6e06ab138687a620035dbc3643c115d2199f5058 Mon Sep 17 00:00:00 2001
|
||||
From: Huisong Li <lihuisong@huawei.com>
|
||||
Date: Fri, 22 Oct 2021 17:20:00 +0800
|
||||
Subject: [PATCH 11/33] net/hns3: use HW ops to config MAC features
|
||||
|
||||
This patch uses APIs in hns3_hw_ops to configure MAC related features.
|
||||
|
||||
Signed-off-by: Huisong Li <lihuisong@huawei.com>
|
||||
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
|
||||
---
|
||||
drivers/net/hns3/hns3_ethdev.c | 32 +++++++++++++++----------------
|
||||
drivers/net/hns3/hns3_ethdev_vf.c | 27 +++++++++++++-------------
|
||||
2 files changed, 30 insertions(+), 29 deletions(-)
|
||||
|
||||
diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c
|
||||
index 48c6483e1..00016d58e 100644
|
||||
--- a/drivers/net/hns3/hns3_ethdev.c
|
||||
+++ b/drivers/net/hns3/hns3_ethdev.c
|
||||
@@ -1656,9 +1656,9 @@ hns3_add_mac_addr(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr,
|
||||
rte_spinlock_unlock(&hw->lock);
|
||||
return -EINVAL;
|
||||
}
|
||||
- ret = hns3_add_mc_mac_addr(hw, mac_addr);
|
||||
+ ret = hw->ops.add_mc_mac_addr(hw, mac_addr);
|
||||
} else {
|
||||
- ret = hns3_add_uc_mac_addr(hw, mac_addr);
|
||||
+ ret = hw->ops.add_uc_mac_addr(hw, mac_addr);
|
||||
}
|
||||
if (ret) {
|
||||
rte_spinlock_unlock(&hw->lock);
|
||||
@@ -1714,9 +1714,9 @@ hns3_remove_mac_addr(struct rte_eth_dev *dev, uint32_t idx)
|
||||
rte_spinlock_lock(&hw->lock);
|
||||
|
||||
if (rte_is_multicast_ether_addr(mac_addr))
|
||||
- ret = hns3_remove_mc_mac_addr(hw, mac_addr);
|
||||
+ ret = hw->ops.del_mc_mac_addr(hw, mac_addr);
|
||||
else
|
||||
- ret = hns3_remove_uc_mac_addr(hw, mac_addr);
|
||||
+ ret = hw->ops.del_uc_mac_addr(hw, mac_addr);
|
||||
rte_spinlock_unlock(&hw->lock);
|
||||
if (ret) {
|
||||
hns3_ether_format_addr(mac_str, RTE_ETHER_ADDR_FMT_SIZE,
|
||||
@@ -1737,7 +1737,7 @@ hns3_set_default_mac_addr(struct rte_eth_dev *dev,
|
||||
|
||||
rte_spinlock_lock(&hw->lock);
|
||||
oaddr = (struct rte_ether_addr *)hw->mac.mac_addr;
|
||||
- ret = hns3_remove_uc_mac_addr(hw, oaddr);
|
||||
+ ret = hw->ops.del_uc_mac_addr(hw, oaddr);
|
||||
if (ret) {
|
||||
hns3_ether_format_addr(mac_str, RTE_ETHER_ADDR_FMT_SIZE,
|
||||
oaddr);
|
||||
@@ -1748,7 +1748,7 @@ hns3_set_default_mac_addr(struct rte_eth_dev *dev,
|
||||
return ret;
|
||||
}
|
||||
|
||||
- ret = hns3_add_uc_mac_addr(hw, mac_addr);
|
||||
+ ret = hw->ops.add_uc_mac_addr(hw, mac_addr);
|
||||
if (ret) {
|
||||
hns3_ether_format_addr(mac_str, RTE_ETHER_ADDR_FMT_SIZE,
|
||||
mac_addr);
|
||||
@@ -1769,7 +1769,7 @@ hns3_set_default_mac_addr(struct rte_eth_dev *dev,
|
||||
return 0;
|
||||
|
||||
err_pause_addr_cfg:
|
||||
- ret_val = hns3_remove_uc_mac_addr(hw, mac_addr);
|
||||
+ ret_val = hw->ops.del_uc_mac_addr(hw, mac_addr);
|
||||
if (ret_val) {
|
||||
hns3_ether_format_addr(mac_str, RTE_ETHER_ADDR_FMT_SIZE,
|
||||
mac_addr);
|
||||
@@ -1779,7 +1779,7 @@ hns3_set_default_mac_addr(struct rte_eth_dev *dev,
|
||||
}
|
||||
|
||||
err_add_uc_addr:
|
||||
- ret_val = hns3_add_uc_mac_addr(hw, oaddr);
|
||||
+ ret_val = hw->ops.add_uc_mac_addr(hw, oaddr);
|
||||
if (ret_val) {
|
||||
hns3_ether_format_addr(mac_str, RTE_ETHER_ADDR_FMT_SIZE, oaddr);
|
||||
hns3_warn(hw, "Failed to restore old uc mac addr(%s): %d",
|
||||
@@ -1805,11 +1805,11 @@ hns3_configure_all_mac_addr(struct hns3_adapter *hns, bool del)
|
||||
if (rte_is_zero_ether_addr(addr))
|
||||
continue;
|
||||
if (rte_is_multicast_ether_addr(addr))
|
||||
- ret = del ? hns3_remove_mc_mac_addr(hw, addr) :
|
||||
- hns3_add_mc_mac_addr(hw, addr);
|
||||
+ ret = del ? ops->del_mc_mac_addr(hw, addr) :
|
||||
+ ops->add_mc_mac_addr(hw, addr);
|
||||
else
|
||||
- ret = del ? hns3_remove_uc_mac_addr(hw, addr) :
|
||||
- hns3_add_uc_mac_addr(hw, addr);
|
||||
+ ret = del ? ops->del_uc_mac_addr(hw, addr) :
|
||||
+ ops->add_uc_mac_addr(hw, addr);
|
||||
|
||||
if (ret) {
|
||||
err = ret;
|
||||
@@ -2125,7 +2125,7 @@ hns3_set_mc_mac_addr_list(struct rte_eth_dev *dev,
|
||||
for (i = 0; i < rm_addr_num; i++) {
|
||||
num = rm_addr_num - i - 1;
|
||||
addr = &rm_addr_list[num];
|
||||
- ret = hns3_remove_mc_mac_addr(hw, addr);
|
||||
+ ret = hw->ops.del_mc_mac_addr(hw, addr);
|
||||
if (ret) {
|
||||
rte_spinlock_unlock(&hw->lock);
|
||||
return ret;
|
||||
@@ -2136,7 +2136,7 @@ hns3_set_mc_mac_addr_list(struct rte_eth_dev *dev,
|
||||
/* Add mc mac addresses */
|
||||
for (i = 0; i < add_addr_num; i++) {
|
||||
addr = &add_addr_list[i];
|
||||
- ret = hns3_add_mc_mac_addr(hw, addr);
|
||||
+ ret = hw->ops.add_mc_mac_addr(hw, addr);
|
||||
if (ret) {
|
||||
rte_spinlock_unlock(&hw->lock);
|
||||
return ret;
|
||||
@@ -2166,9 +2166,9 @@ hns3_configure_all_mc_mac_addr(struct hns3_adapter *hns, bool del)
|
||||
if (!rte_is_multicast_ether_addr(addr))
|
||||
continue;
|
||||
if (del)
|
||||
- ret = hns3_remove_mc_mac_addr(hw, addr);
|
||||
+ ret = hw->ops.del_mc_mac_addr(hw, addr);
|
||||
else
|
||||
- ret = hns3_add_mc_mac_addr(hw, addr);
|
||||
+ ret = hw->ops.add_mc_mac_addr(hw, addr);
|
||||
if (ret) {
|
||||
err = ret;
|
||||
hns3_ether_format_addr(mac_str, RTE_ETHER_ADDR_FMT_SIZE,
|
||||
diff --git a/drivers/net/hns3/hns3_ethdev_vf.c b/drivers/net/hns3/hns3_ethdev_vf.c
|
||||
index 1020b42e1..f9c5e3b4f 100644
|
||||
--- a/drivers/net/hns3/hns3_ethdev_vf.c
|
||||
+++ b/drivers/net/hns3/hns3_ethdev_vf.c
|
||||
@@ -229,9 +229,9 @@ hns3vf_add_mac_addr(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr,
|
||||
rte_spinlock_unlock(&hw->lock);
|
||||
return -EINVAL;
|
||||
}
|
||||
- ret = hns3vf_add_mc_mac_addr(hw, mac_addr);
|
||||
+ ret = hw->ops.add_mc_mac_addr(hw, mac_addr);
|
||||
} else {
|
||||
- ret = hns3vf_add_uc_mac_addr(hw, mac_addr);
|
||||
+ ret = hw->ops.add_uc_mac_addr(hw, mac_addr);
|
||||
}
|
||||
|
||||
rte_spinlock_unlock(&hw->lock);
|
||||
@@ -257,9 +257,9 @@ hns3vf_remove_mac_addr(struct rte_eth_dev *dev, uint32_t idx)
|
||||
rte_spinlock_lock(&hw->lock);
|
||||
|
||||
if (rte_is_multicast_ether_addr(mac_addr))
|
||||
- ret = hns3vf_remove_mc_mac_addr(hw, mac_addr);
|
||||
+ ret = hw->ops.del_mc_mac_addr(hw, mac_addr);
|
||||
else
|
||||
- ret = hns3vf_remove_uc_mac_addr(hw, mac_addr);
|
||||
+ ret = hw->ops.del_uc_mac_addr(hw, mac_addr);
|
||||
|
||||
rte_spinlock_unlock(&hw->lock);
|
||||
if (ret) {
|
||||
@@ -326,9 +326,10 @@ hns3vf_set_default_mac_addr(struct rte_eth_dev *dev,
|
||||
static int
|
||||
hns3vf_configure_mac_addr(struct hns3_adapter *hns, bool del)
|
||||
{
|
||||
+ char mac_str[RTE_ETHER_ADDR_FMT_SIZE];
|
||||
struct hns3_hw *hw = &hns->hw;
|
||||
+ struct hns3_hw_ops *ops = &hw->ops;
|
||||
struct rte_ether_addr *addr;
|
||||
- char mac_str[RTE_ETHER_ADDR_FMT_SIZE];
|
||||
int err = 0;
|
||||
int ret;
|
||||
int i;
|
||||
@@ -338,11 +339,11 @@ hns3vf_configure_mac_addr(struct hns3_adapter *hns, bool del)
|
||||
if (rte_is_zero_ether_addr(addr))
|
||||
continue;
|
||||
if (rte_is_multicast_ether_addr(addr))
|
||||
- ret = del ? hns3vf_remove_mc_mac_addr(hw, addr) :
|
||||
- hns3vf_add_mc_mac_addr(hw, addr);
|
||||
+ ret = del ? ops->del_mc_mac_addr(hw, addr) :
|
||||
+ ops->add_mc_mac_addr(hw, addr);
|
||||
else
|
||||
- ret = del ? hns3vf_remove_uc_mac_addr(hw, addr) :
|
||||
- hns3vf_add_uc_mac_addr(hw, addr);
|
||||
+ ret = del ? ops->del_uc_mac_addr(hw, addr) :
|
||||
+ ops->add_uc_mac_addr(hw, addr);
|
||||
|
||||
if (ret) {
|
||||
err = ret;
|
||||
@@ -484,7 +485,7 @@ hns3vf_set_mc_mac_addr_list(struct rte_eth_dev *dev,
|
||||
for (i = 0; i < cur_addr_num; i++) {
|
||||
num = cur_addr_num - i - 1;
|
||||
addr = &hw->mc_addrs[num];
|
||||
- ret = hns3vf_remove_mc_mac_addr(hw, addr);
|
||||
+ ret = hw->ops.del_mc_mac_addr(hw, addr);
|
||||
if (ret) {
|
||||
rte_spinlock_unlock(&hw->lock);
|
||||
return ret;
|
||||
@@ -496,7 +497,7 @@ hns3vf_set_mc_mac_addr_list(struct rte_eth_dev *dev,
|
||||
set_addr_num = (int)nb_mc_addr;
|
||||
for (i = 0; i < set_addr_num; i++) {
|
||||
addr = &mc_addr_set[i];
|
||||
- ret = hns3vf_add_mc_mac_addr(hw, addr);
|
||||
+ ret = hw->ops.add_mc_mac_addr(hw, addr);
|
||||
if (ret) {
|
||||
rte_spinlock_unlock(&hw->lock);
|
||||
return ret;
|
||||
@@ -525,9 +526,9 @@ hns3vf_configure_all_mc_mac_addr(struct hns3_adapter *hns, bool del)
|
||||
if (!rte_is_multicast_ether_addr(addr))
|
||||
continue;
|
||||
if (del)
|
||||
- ret = hns3vf_remove_mc_mac_addr(hw, addr);
|
||||
+ ret = hw->ops.del_mc_mac_addr(hw, addr);
|
||||
else
|
||||
- ret = hns3vf_add_mc_mac_addr(hw, addr);
|
||||
+ ret = hw->ops.add_mc_mac_addr(hw, addr);
|
||||
if (ret) {
|
||||
err = ret;
|
||||
hns3_ether_format_addr(mac_str, RTE_ETHER_ADDR_FMT_SIZE,
|
||||
--
|
||||
2.33.0
|
||||
|
||||
251
0245-net-hns3-unify-MAC-and-multicast-address-configurati.patch
Normal file
251
0245-net-hns3-unify-MAC-and-multicast-address-configurati.patch
Normal file
@ -0,0 +1,251 @@
|
||||
From 67d013484d9b521fd174e8485f7ebed333195bca Mon Sep 17 00:00:00 2001
|
||||
From: Huisong Li <lihuisong@huawei.com>
|
||||
Date: Fri, 22 Oct 2021 17:20:01 +0800
|
||||
Subject: [PATCH 12/33] net/hns3: unify MAC and multicast address configuration
|
||||
|
||||
Currently, the interface logic for adding and deleting all MAC address
|
||||
and multicast address in PF and VF driver is the same. This patch
|
||||
extracts two common interfaces to configure them separately.
|
||||
|
||||
Signed-off-by: Huisong Li <lihuisong@huawei.com>
|
||||
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
|
||||
---
|
||||
drivers/net/hns3/hns3_ethdev.c | 32 ++++++-------
|
||||
drivers/net/hns3/hns3_ethdev.h | 2 +
|
||||
drivers/net/hns3/hns3_ethdev_vf.c | 77 +++----------------------------
|
||||
3 files changed, 25 insertions(+), 86 deletions(-)
|
||||
|
||||
diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c
|
||||
index 00016d58e..bdd29220a 100644
|
||||
--- a/drivers/net/hns3/hns3_ethdev.c
|
||||
+++ b/drivers/net/hns3/hns3_ethdev.c
|
||||
@@ -1790,17 +1790,20 @@ hns3_set_default_mac_addr(struct rte_eth_dev *dev,
|
||||
return ret;
|
||||
}
|
||||
|
||||
-static int
|
||||
+int
|
||||
hns3_configure_all_mac_addr(struct hns3_adapter *hns, bool del)
|
||||
{
|
||||
char mac_str[RTE_ETHER_ADDR_FMT_SIZE];
|
||||
struct hns3_hw *hw = &hns->hw;
|
||||
+ struct hns3_hw_ops *ops = &hw->ops;
|
||||
struct rte_ether_addr *addr;
|
||||
- int err = 0;
|
||||
- int ret;
|
||||
+ uint16_t mac_addrs_capa;
|
||||
+ int ret = 0;
|
||||
int i;
|
||||
|
||||
- for (i = 0; i < HNS3_UC_MACADDR_NUM; i++) {
|
||||
+ mac_addrs_capa =
|
||||
+ hns->is_vf ? HNS3_VF_UC_MACADDR_NUM : HNS3_UC_MACADDR_NUM;
|
||||
+ for (i = 0; i < mac_addrs_capa; i++) {
|
||||
addr = &hw->data->mac_addrs[i];
|
||||
if (rte_is_zero_ether_addr(addr))
|
||||
continue;
|
||||
@@ -1812,15 +1815,14 @@ hns3_configure_all_mac_addr(struct hns3_adapter *hns, bool del)
|
||||
ops->add_uc_mac_addr(hw, addr);
|
||||
|
||||
if (ret) {
|
||||
- err = ret;
|
||||
hns3_ether_format_addr(mac_str, RTE_ETHER_ADDR_FMT_SIZE,
|
||||
- addr);
|
||||
- hns3_err(hw, "failed to %s mac addr(%s) index:%d "
|
||||
- "ret = %d.", del ? "remove" : "restore",
|
||||
- mac_str, i, ret);
|
||||
+ addr);
|
||||
+ hns3_err(hw, "failed to %s mac addr(%s) index:%d ret = %d.",
|
||||
+ del ? "remove" : "restore", mac_str, i, ret);
|
||||
}
|
||||
}
|
||||
- return err;
|
||||
+
|
||||
+ return ret;
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -2151,14 +2153,13 @@ hns3_set_mc_mac_addr_list(struct rte_eth_dev *dev,
|
||||
return 0;
|
||||
}
|
||||
|
||||
-static int
|
||||
+int
|
||||
hns3_configure_all_mc_mac_addr(struct hns3_adapter *hns, bool del)
|
||||
{
|
||||
char mac_str[RTE_ETHER_ADDR_FMT_SIZE];
|
||||
struct hns3_hw *hw = &hns->hw;
|
||||
struct rte_ether_addr *addr;
|
||||
- int err = 0;
|
||||
- int ret;
|
||||
+ int ret = 0;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < hw->mc_addrs_num; i++) {
|
||||
@@ -2170,14 +2171,13 @@ hns3_configure_all_mc_mac_addr(struct hns3_adapter *hns, bool del)
|
||||
else
|
||||
ret = hw->ops.add_mc_mac_addr(hw, addr);
|
||||
if (ret) {
|
||||
- err = ret;
|
||||
hns3_ether_format_addr(mac_str, RTE_ETHER_ADDR_FMT_SIZE,
|
||||
addr);
|
||||
- hns3_dbg(hw, "%s mc mac addr: %s failed for pf: ret = %d",
|
||||
+ hns3_dbg(hw, "failed to %s mc mac addr: %s ret = %d",
|
||||
del ? "Remove" : "Restore", mac_str, ret);
|
||||
}
|
||||
}
|
||||
- return err;
|
||||
+ return ret;
|
||||
}
|
||||
|
||||
static int
|
||||
diff --git a/drivers/net/hns3/hns3_ethdev.h b/drivers/net/hns3/hns3_ethdev.h
|
||||
index 73947e194..942e8419c 100644
|
||||
--- a/drivers/net/hns3/hns3_ethdev.h
|
||||
+++ b/drivers/net/hns3/hns3_ethdev.h
|
||||
@@ -1065,6 +1065,8 @@ void hns3vf_update_push_lsc_cap(struct hns3_hw *hw, bool supported);
|
||||
|
||||
bool hns3_find_duplicate_mc_addr(struct hns3_hw *hw,
|
||||
struct rte_ether_addr *mc_addr);
|
||||
+int hns3_configure_all_mc_mac_addr(struct hns3_adapter *hns, bool del);
|
||||
+int hns3_configure_all_mac_addr(struct hns3_adapter *hns, bool del);
|
||||
|
||||
int hns3_restore_ptp(struct hns3_adapter *hns);
|
||||
int hns3_mbuf_dyn_rx_timestamp_register(struct rte_eth_dev *dev,
|
||||
diff --git a/drivers/net/hns3/hns3_ethdev_vf.c b/drivers/net/hns3/hns3_ethdev_vf.c
|
||||
index f9c5e3b4f..cce4d3450 100644
|
||||
--- a/drivers/net/hns3/hns3_ethdev_vf.c
|
||||
+++ b/drivers/net/hns3/hns3_ethdev_vf.c
|
||||
@@ -323,40 +323,6 @@ hns3vf_set_default_mac_addr(struct rte_eth_dev *dev,
|
||||
return ret;
|
||||
}
|
||||
|
||||
-static int
|
||||
-hns3vf_configure_mac_addr(struct hns3_adapter *hns, bool del)
|
||||
-{
|
||||
- char mac_str[RTE_ETHER_ADDR_FMT_SIZE];
|
||||
- struct hns3_hw *hw = &hns->hw;
|
||||
- struct hns3_hw_ops *ops = &hw->ops;
|
||||
- struct rte_ether_addr *addr;
|
||||
- int err = 0;
|
||||
- int ret;
|
||||
- int i;
|
||||
-
|
||||
- for (i = 0; i < HNS3_VF_UC_MACADDR_NUM; i++) {
|
||||
- addr = &hw->data->mac_addrs[i];
|
||||
- if (rte_is_zero_ether_addr(addr))
|
||||
- continue;
|
||||
- if (rte_is_multicast_ether_addr(addr))
|
||||
- ret = del ? ops->del_mc_mac_addr(hw, addr) :
|
||||
- ops->add_mc_mac_addr(hw, addr);
|
||||
- else
|
||||
- ret = del ? ops->del_uc_mac_addr(hw, addr) :
|
||||
- ops->add_uc_mac_addr(hw, addr);
|
||||
-
|
||||
- if (ret) {
|
||||
- err = ret;
|
||||
- hns3_ether_format_addr(mac_str, RTE_ETHER_ADDR_FMT_SIZE,
|
||||
- addr);
|
||||
- hns3_err(hw, "failed to %s mac addr(%s) index:%d "
|
||||
- "ret = %d.", del ? "remove" : "restore",
|
||||
- mac_str, i, ret);
|
||||
- }
|
||||
- }
|
||||
- return err;
|
||||
-}
|
||||
-
|
||||
static int
|
||||
hns3vf_add_mc_mac_addr(struct hns3_hw *hw,
|
||||
struct rte_ether_addr *mac_addr)
|
||||
@@ -511,35 +477,6 @@ hns3vf_set_mc_mac_addr_list(struct rte_eth_dev *dev,
|
||||
return 0;
|
||||
}
|
||||
|
||||
-static int
|
||||
-hns3vf_configure_all_mc_mac_addr(struct hns3_adapter *hns, bool del)
|
||||
-{
|
||||
- char mac_str[RTE_ETHER_ADDR_FMT_SIZE];
|
||||
- struct hns3_hw *hw = &hns->hw;
|
||||
- struct rte_ether_addr *addr;
|
||||
- int err = 0;
|
||||
- int ret;
|
||||
- int i;
|
||||
-
|
||||
- for (i = 0; i < hw->mc_addrs_num; i++) {
|
||||
- addr = &hw->mc_addrs[i];
|
||||
- if (!rte_is_multicast_ether_addr(addr))
|
||||
- continue;
|
||||
- if (del)
|
||||
- ret = hw->ops.del_mc_mac_addr(hw, addr);
|
||||
- else
|
||||
- ret = hw->ops.add_mc_mac_addr(hw, addr);
|
||||
- if (ret) {
|
||||
- err = ret;
|
||||
- hns3_ether_format_addr(mac_str, RTE_ETHER_ADDR_FMT_SIZE,
|
||||
- addr);
|
||||
- hns3_err(hw, "Failed to %s mc mac addr: %s for vf: %d",
|
||||
- del ? "Remove" : "Restore", mac_str, ret);
|
||||
- }
|
||||
- }
|
||||
- return err;
|
||||
-}
|
||||
-
|
||||
static int
|
||||
hns3vf_set_promisc_mode(struct hns3_hw *hw, bool en_bc_pmc,
|
||||
bool en_uc_pmc, bool en_mc_pmc)
|
||||
@@ -2077,7 +2014,7 @@ hns3vf_do_stop(struct hns3_adapter *hns)
|
||||
hns3_dev_release_mbufs(hns);
|
||||
|
||||
if (__atomic_load_n(&hw->reset.disable_cmd, __ATOMIC_RELAXED) == 0) {
|
||||
- hns3vf_configure_mac_addr(hns, true);
|
||||
+ hns3_configure_all_mac_addr(hns, true);
|
||||
ret = hns3_reset_all_tqps(hns);
|
||||
if (ret) {
|
||||
hns3_err(hw, "failed to reset all queues ret = %d",
|
||||
@@ -2172,7 +2109,7 @@ hns3vf_dev_close(struct rte_eth_dev *eth_dev)
|
||||
hns3_reset_abort(hns);
|
||||
hw->adapter_state = HNS3_NIC_CLOSED;
|
||||
rte_eal_alarm_cancel(hns3vf_keep_alive_handler, eth_dev);
|
||||
- hns3vf_configure_all_mc_mac_addr(hns, true);
|
||||
+ hns3_configure_all_mc_mac_addr(hns, true);
|
||||
hns3vf_remove_all_vlan_table(hns);
|
||||
hns3vf_uninit_vf(eth_dev);
|
||||
hns3_free_all_queues(eth_dev);
|
||||
@@ -2598,7 +2535,7 @@ hns3vf_stop_service(struct hns3_adapter *hns)
|
||||
* required to delete the entries.
|
||||
*/
|
||||
if (__atomic_load_n(&hw->reset.disable_cmd, __ATOMIC_RELAXED) == 0)
|
||||
- hns3vf_configure_all_mc_mac_addr(hns, true);
|
||||
+ hns3_configure_all_mc_mac_addr(hns, true);
|
||||
rte_spinlock_unlock(&hw->lock);
|
||||
|
||||
return 0;
|
||||
@@ -2684,11 +2621,11 @@ hns3vf_restore_conf(struct hns3_adapter *hns)
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
- ret = hns3vf_configure_mac_addr(hns, false);
|
||||
+ ret = hns3_configure_all_mac_addr(hns, false);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
- ret = hns3vf_configure_all_mc_mac_addr(hns, false);
|
||||
+ ret = hns3_configure_all_mc_mac_addr(hns, false);
|
||||
if (ret)
|
||||
goto err_mc_mac;
|
||||
|
||||
@@ -2729,9 +2666,9 @@ hns3vf_restore_conf(struct hns3_adapter *hns)
|
||||
return 0;
|
||||
|
||||
err_vlan_table:
|
||||
- hns3vf_configure_all_mc_mac_addr(hns, true);
|
||||
+ hns3_configure_all_mc_mac_addr(hns, true);
|
||||
err_mc_mac:
|
||||
- hns3vf_configure_mac_addr(hns, true);
|
||||
+ hns3_configure_all_mac_addr(hns, true);
|
||||
return ret;
|
||||
}
|
||||
|
||||
--
|
||||
2.33.0
|
||||
|
||||
177
0246-net-hns3-unify-MAC-address-add-and-remove.patch
Normal file
177
0246-net-hns3-unify-MAC-address-add-and-remove.patch
Normal file
@ -0,0 +1,177 @@
|
||||
From f1e4c77136cc5d65606ad07cd7204c0994c14904 Mon Sep 17 00:00:00 2001
|
||||
From: Huisong Li <lihuisong@huawei.com>
|
||||
Date: Fri, 22 Oct 2021 17:20:02 +0800
|
||||
Subject: [PATCH 13/33] net/hns3: unify MAC address add and remove
|
||||
|
||||
The code logic of adding and removing MAC address in PF and VF is the
|
||||
same.
|
||||
This patch extracts two common interfaces to add and remove them
|
||||
separately.
|
||||
|
||||
Signed-off-by: Huisong Li <lihuisong@huawei.com>
|
||||
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
|
||||
---
|
||||
drivers/net/hns3/hns3_ethdev.c | 11 ++---
|
||||
drivers/net/hns3/hns3_ethdev.h | 5 ++-
|
||||
drivers/net/hns3/hns3_ethdev_vf.c | 70 +------------------------------
|
||||
3 files changed, 9 insertions(+), 77 deletions(-)
|
||||
|
||||
diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c
|
||||
index bdd29220a..bf49d5f75 100644
|
||||
--- a/drivers/net/hns3/hns3_ethdev.c
|
||||
+++ b/drivers/net/hns3/hns3_ethdev.c
|
||||
@@ -1609,7 +1609,7 @@ hns3_add_uc_mac_addr(struct hns3_hw *hw, struct rte_ether_addr *mac_addr)
|
||||
return ret;
|
||||
}
|
||||
|
||||
-bool
|
||||
+static bool
|
||||
hns3_find_duplicate_mc_addr(struct hns3_hw *hw, struct rte_ether_addr *mc_addr)
|
||||
{
|
||||
char mac_str[RTE_ETHER_ADDR_FMT_SIZE];
|
||||
@@ -1632,7 +1632,7 @@ hns3_find_duplicate_mc_addr(struct hns3_hw *hw, struct rte_ether_addr *mc_addr)
|
||||
return false;
|
||||
}
|
||||
|
||||
-static int
|
||||
+int
|
||||
hns3_add_mac_addr(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr,
|
||||
__rte_unused uint32_t idx, __rte_unused uint32_t pool)
|
||||
{
|
||||
@@ -1660,17 +1660,14 @@ hns3_add_mac_addr(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr,
|
||||
} else {
|
||||
ret = hw->ops.add_uc_mac_addr(hw, mac_addr);
|
||||
}
|
||||
+ rte_spinlock_unlock(&hw->lock);
|
||||
if (ret) {
|
||||
- rte_spinlock_unlock(&hw->lock);
|
||||
hns3_ether_format_addr(mac_str, RTE_ETHER_ADDR_FMT_SIZE,
|
||||
mac_addr);
|
||||
hns3_err(hw, "failed to add mac addr(%s), ret = %d", mac_str,
|
||||
ret);
|
||||
- return ret;
|
||||
}
|
||||
|
||||
- rte_spinlock_unlock(&hw->lock);
|
||||
-
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -1702,7 +1699,7 @@ hns3_remove_uc_mac_addr(struct hns3_hw *hw, struct rte_ether_addr *mac_addr)
|
||||
return ret;
|
||||
}
|
||||
|
||||
-static void
|
||||
+void
|
||||
hns3_remove_mac_addr(struct rte_eth_dev *dev, uint32_t idx)
|
||||
{
|
||||
struct hns3_hw *hw = HNS3_DEV_PRIVATE_TO_HW(dev->data->dev_private);
|
||||
diff --git a/drivers/net/hns3/hns3_ethdev.h b/drivers/net/hns3/hns3_ethdev.h
|
||||
index 942e8419c..276ac8b54 100644
|
||||
--- a/drivers/net/hns3/hns3_ethdev.h
|
||||
+++ b/drivers/net/hns3/hns3_ethdev.h
|
||||
@@ -1063,10 +1063,11 @@ void hns3vf_update_link_status(struct hns3_hw *hw, uint8_t link_status,
|
||||
void hns3_parse_devargs(struct rte_eth_dev *dev);
|
||||
void hns3vf_update_push_lsc_cap(struct hns3_hw *hw, bool supported);
|
||||
|
||||
-bool hns3_find_duplicate_mc_addr(struct hns3_hw *hw,
|
||||
- struct rte_ether_addr *mc_addr);
|
||||
int hns3_configure_all_mc_mac_addr(struct hns3_adapter *hns, bool del);
|
||||
int hns3_configure_all_mac_addr(struct hns3_adapter *hns, bool del);
|
||||
+int hns3_add_mac_addr(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr,
|
||||
+ __rte_unused uint32_t idx, __rte_unused uint32_t pool);
|
||||
+void hns3_remove_mac_addr(struct rte_eth_dev *dev, uint32_t idx);
|
||||
|
||||
int hns3_restore_ptp(struct hns3_adapter *hns);
|
||||
int hns3_mbuf_dyn_rx_timestamp_register(struct rte_eth_dev *dev,
|
||||
diff --git a/drivers/net/hns3/hns3_ethdev_vf.c b/drivers/net/hns3/hns3_ethdev_vf.c
|
||||
index cce4d3450..fb7eda21d 100644
|
||||
--- a/drivers/net/hns3/hns3_ethdev_vf.c
|
||||
+++ b/drivers/net/hns3/hns3_ethdev_vf.c
|
||||
@@ -204,72 +204,6 @@ hns3vf_remove_uc_mac_addr(struct hns3_hw *hw, struct rte_ether_addr *mac_addr)
|
||||
return ret;
|
||||
}
|
||||
|
||||
-static int
|
||||
-hns3vf_add_mac_addr(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr,
|
||||
- __rte_unused uint32_t idx,
|
||||
- __rte_unused uint32_t pool)
|
||||
-{
|
||||
- struct hns3_hw *hw = HNS3_DEV_PRIVATE_TO_HW(dev->data->dev_private);
|
||||
- char mac_str[RTE_ETHER_ADDR_FMT_SIZE];
|
||||
- int ret;
|
||||
-
|
||||
- rte_spinlock_lock(&hw->lock);
|
||||
-
|
||||
- /*
|
||||
- * In hns3 network engine adding UC and MC mac address with different
|
||||
- * commands with firmware. We need to determine whether the input
|
||||
- * address is a UC or a MC address to call different commands.
|
||||
- * By the way, it is recommended calling the API function named
|
||||
- * rte_eth_dev_set_mc_addr_list to set the MC mac address, because
|
||||
- * using the rte_eth_dev_mac_addr_add API function to set MC mac address
|
||||
- * may affect the specifications of UC mac addresses.
|
||||
- */
|
||||
- if (rte_is_multicast_ether_addr(mac_addr)) {
|
||||
- if (hns3_find_duplicate_mc_addr(hw, mac_addr)) {
|
||||
- rte_spinlock_unlock(&hw->lock);
|
||||
- return -EINVAL;
|
||||
- }
|
||||
- ret = hw->ops.add_mc_mac_addr(hw, mac_addr);
|
||||
- } else {
|
||||
- ret = hw->ops.add_uc_mac_addr(hw, mac_addr);
|
||||
- }
|
||||
-
|
||||
- rte_spinlock_unlock(&hw->lock);
|
||||
- if (ret) {
|
||||
- hns3_ether_format_addr(mac_str, RTE_ETHER_ADDR_FMT_SIZE,
|
||||
- mac_addr);
|
||||
- hns3_err(hw, "failed to add mac addr(%s), ret = %d", mac_str,
|
||||
- ret);
|
||||
- }
|
||||
-
|
||||
- return ret;
|
||||
-}
|
||||
-
|
||||
-static void
|
||||
-hns3vf_remove_mac_addr(struct rte_eth_dev *dev, uint32_t idx)
|
||||
-{
|
||||
- struct hns3_hw *hw = HNS3_DEV_PRIVATE_TO_HW(dev->data->dev_private);
|
||||
- /* index will be checked by upper level rte interface */
|
||||
- struct rte_ether_addr *mac_addr = &dev->data->mac_addrs[idx];
|
||||
- char mac_str[RTE_ETHER_ADDR_FMT_SIZE];
|
||||
- int ret;
|
||||
-
|
||||
- rte_spinlock_lock(&hw->lock);
|
||||
-
|
||||
- if (rte_is_multicast_ether_addr(mac_addr))
|
||||
- ret = hw->ops.del_mc_mac_addr(hw, mac_addr);
|
||||
- else
|
||||
- ret = hw->ops.del_uc_mac_addr(hw, mac_addr);
|
||||
-
|
||||
- rte_spinlock_unlock(&hw->lock);
|
||||
- if (ret) {
|
||||
- hns3_ether_format_addr(mac_str, RTE_ETHER_ADDR_FMT_SIZE,
|
||||
- mac_addr);
|
||||
- hns3_err(hw, "failed to remove mac addr(%s), ret = %d",
|
||||
- mac_str, ret);
|
||||
- }
|
||||
-}
|
||||
-
|
||||
static int
|
||||
hns3vf_set_default_mac_addr(struct rte_eth_dev *dev,
|
||||
struct rte_ether_addr *mac_addr)
|
||||
@@ -2831,8 +2765,8 @@ static const struct eth_dev_ops hns3vf_eth_dev_ops = {
|
||||
.txq_info_get = hns3_txq_info_get,
|
||||
.rx_burst_mode_get = hns3_rx_burst_mode_get,
|
||||
.tx_burst_mode_get = hns3_tx_burst_mode_get,
|
||||
- .mac_addr_add = hns3vf_add_mac_addr,
|
||||
- .mac_addr_remove = hns3vf_remove_mac_addr,
|
||||
+ .mac_addr_add = hns3_add_mac_addr,
|
||||
+ .mac_addr_remove = hns3_remove_mac_addr,
|
||||
.mac_addr_set = hns3vf_set_default_mac_addr,
|
||||
.set_mc_addr_list = hns3vf_set_mc_mac_addr_list,
|
||||
.link_update = hns3vf_dev_link_update,
|
||||
--
|
||||
2.33.0
|
||||
|
||||
157
0247-net-hns3-unify-multicast-address-check.patch
Normal file
157
0247-net-hns3-unify-multicast-address-check.patch
Normal file
@ -0,0 +1,157 @@
|
||||
From 35da8e628f28e84f1f7b1dff10a984a44bae44e0 Mon Sep 17 00:00:00 2001
|
||||
From: Huisong Li <lihuisong@huawei.com>
|
||||
Date: Fri, 22 Oct 2021 17:20:03 +0800
|
||||
Subject: [PATCH 14/33] net/hns3: unify multicast address check
|
||||
|
||||
This patch uniforms a common function to check multicast address
|
||||
validity for PF and VF.
|
||||
|
||||
Signed-off-by: Huisong Li <lihuisong@huawei.com>
|
||||
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
|
||||
---
|
||||
drivers/net/hns3/hns3_ethdev.c | 12 ++++--
|
||||
drivers/net/hns3/hns3_ethdev.h | 4 +-
|
||||
drivers/net/hns3/hns3_ethdev_vf.c | 66 +------------------------------
|
||||
3 files changed, 12 insertions(+), 70 deletions(-)
|
||||
|
||||
diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c
|
||||
index bf49d5f75..97129c428 100644
|
||||
--- a/drivers/net/hns3/hns3_ethdev.c
|
||||
+++ b/drivers/net/hns3/hns3_ethdev.c
|
||||
@@ -1947,13 +1947,15 @@ hns3_remove_mc_mac_addr(struct hns3_hw *hw, struct rte_ether_addr *mac_addr)
|
||||
return ret;
|
||||
}
|
||||
|
||||
-static int
|
||||
+int
|
||||
hns3_set_mc_addr_chk_param(struct hns3_hw *hw,
|
||||
struct rte_ether_addr *mc_addr_set,
|
||||
uint32_t nb_mc_addr)
|
||||
{
|
||||
+ struct hns3_adapter *hns = HNS3_DEV_HW_TO_ADAPTER(hw);
|
||||
char mac_str[RTE_ETHER_ADDR_FMT_SIZE];
|
||||
struct rte_ether_addr *addr;
|
||||
+ uint16_t mac_addrs_capa;
|
||||
uint32_t i;
|
||||
uint32_t j;
|
||||
|
||||
@@ -1993,12 +1995,14 @@ hns3_set_mc_addr_chk_param(struct hns3_hw *hw,
|
||||
* Check if there are duplicate addresses between mac_addrs
|
||||
* and mc_addr_set
|
||||
*/
|
||||
- for (j = 0; j < HNS3_UC_MACADDR_NUM; j++) {
|
||||
+ mac_addrs_capa = hns->is_vf ? HNS3_VF_UC_MACADDR_NUM :
|
||||
+ HNS3_UC_MACADDR_NUM;
|
||||
+ for (j = 0; j < mac_addrs_capa; j++) {
|
||||
if (rte_is_same_ether_addr(addr,
|
||||
&hw->data->mac_addrs[j])) {
|
||||
hns3_ether_format_addr(mac_str,
|
||||
- RTE_ETHER_ADDR_FMT_SIZE,
|
||||
- addr);
|
||||
+ RTE_ETHER_ADDR_FMT_SIZE,
|
||||
+ addr);
|
||||
hns3_err(hw, "failed to set mc mac addr, "
|
||||
"addrs invalid. addrs(%s) has already "
|
||||
"configured in mac_addr add API",
|
||||
diff --git a/drivers/net/hns3/hns3_ethdev.h b/drivers/net/hns3/hns3_ethdev.h
|
||||
index 276ac8b54..1606a6407 100644
|
||||
--- a/drivers/net/hns3/hns3_ethdev.h
|
||||
+++ b/drivers/net/hns3/hns3_ethdev.h
|
||||
@@ -1062,7 +1062,9 @@ void hns3vf_update_link_status(struct hns3_hw *hw, uint8_t link_status,
|
||||
uint32_t link_speed, uint8_t link_duplex);
|
||||
void hns3_parse_devargs(struct rte_eth_dev *dev);
|
||||
void hns3vf_update_push_lsc_cap(struct hns3_hw *hw, bool supported);
|
||||
-
|
||||
+int hns3_set_mc_addr_chk_param(struct hns3_hw *hw,
|
||||
+ struct rte_ether_addr *mc_addr_set,
|
||||
+ uint32_t nb_mc_addr);
|
||||
int hns3_configure_all_mc_mac_addr(struct hns3_adapter *hns, bool del);
|
||||
int hns3_configure_all_mac_addr(struct hns3_adapter *hns, bool del);
|
||||
int hns3_add_mac_addr(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr,
|
||||
diff --git a/drivers/net/hns3/hns3_ethdev_vf.c b/drivers/net/hns3/hns3_ethdev_vf.c
|
||||
index fb7eda21d..835e783c3 100644
|
||||
--- a/drivers/net/hns3/hns3_ethdev_vf.c
|
||||
+++ b/drivers/net/hns3/hns3_ethdev_vf.c
|
||||
@@ -299,70 +299,6 @@ hns3vf_remove_mc_mac_addr(struct hns3_hw *hw,
|
||||
return ret;
|
||||
}
|
||||
|
||||
-static int
|
||||
-hns3vf_set_mc_addr_chk_param(struct hns3_hw *hw,
|
||||
- struct rte_ether_addr *mc_addr_set,
|
||||
- uint32_t nb_mc_addr)
|
||||
-{
|
||||
- char mac_str[RTE_ETHER_ADDR_FMT_SIZE];
|
||||
- struct rte_ether_addr *addr;
|
||||
- uint32_t i;
|
||||
- uint32_t j;
|
||||
-
|
||||
- if (nb_mc_addr > HNS3_MC_MACADDR_NUM) {
|
||||
- hns3_err(hw, "failed to set mc mac addr, nb_mc_addr(%u) "
|
||||
- "invalid. valid range: 0~%d",
|
||||
- nb_mc_addr, HNS3_MC_MACADDR_NUM);
|
||||
- return -EINVAL;
|
||||
- }
|
||||
-
|
||||
- /* Check if input mac addresses are valid */
|
||||
- for (i = 0; i < nb_mc_addr; i++) {
|
||||
- addr = &mc_addr_set[i];
|
||||
- if (!rte_is_multicast_ether_addr(addr)) {
|
||||
- hns3_ether_format_addr(mac_str, RTE_ETHER_ADDR_FMT_SIZE,
|
||||
- addr);
|
||||
- hns3_err(hw,
|
||||
- "failed to set mc mac addr, addr(%s) invalid.",
|
||||
- mac_str);
|
||||
- return -EINVAL;
|
||||
- }
|
||||
-
|
||||
- /* Check if there are duplicate addresses */
|
||||
- for (j = i + 1; j < nb_mc_addr; j++) {
|
||||
- if (rte_is_same_ether_addr(addr, &mc_addr_set[j])) {
|
||||
- hns3_ether_format_addr(mac_str,
|
||||
- RTE_ETHER_ADDR_FMT_SIZE,
|
||||
- addr);
|
||||
- hns3_err(hw, "failed to set mc mac addr, "
|
||||
- "addrs invalid. two same addrs(%s).",
|
||||
- mac_str);
|
||||
- return -EINVAL;
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- /*
|
||||
- * Check if there are duplicate addresses between mac_addrs
|
||||
- * and mc_addr_set
|
||||
- */
|
||||
- for (j = 0; j < HNS3_VF_UC_MACADDR_NUM; j++) {
|
||||
- if (rte_is_same_ether_addr(addr,
|
||||
- &hw->data->mac_addrs[j])) {
|
||||
- hns3_ether_format_addr(mac_str,
|
||||
- RTE_ETHER_ADDR_FMT_SIZE,
|
||||
- addr);
|
||||
- hns3_err(hw, "failed to set mc mac addr, "
|
||||
- "addrs invalid. addrs(%s) has already "
|
||||
- "configured in mac_addr add API",
|
||||
- mac_str);
|
||||
- return -EINVAL;
|
||||
- }
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- return 0;
|
||||
-}
|
||||
-
|
||||
static int
|
||||
hns3vf_set_mc_mac_addr_list(struct rte_eth_dev *dev,
|
||||
struct rte_ether_addr *mc_addr_set,
|
||||
@@ -376,7 +312,7 @@ hns3vf_set_mc_mac_addr_list(struct rte_eth_dev *dev,
|
||||
int ret;
|
||||
int i;
|
||||
|
||||
- ret = hns3vf_set_mc_addr_chk_param(hw, mc_addr_set, nb_mc_addr);
|
||||
+ ret = hns3_set_mc_addr_chk_param(hw, mc_addr_set, nb_mc_addr);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
--
|
||||
2.33.0
|
||||
|
||||
171
0248-net-hns3-refactor-multicast-MAC-address-set-for-PF.patch
Normal file
171
0248-net-hns3-refactor-multicast-MAC-address-set-for-PF.patch
Normal file
@ -0,0 +1,171 @@
|
||||
From 4696316a47ed084bdfddc5a7fd12ad743643b602 Mon Sep 17 00:00:00 2001
|
||||
From: Huisong Li <lihuisong@huawei.com>
|
||||
Date: Fri, 22 Oct 2021 17:20:04 +0800
|
||||
Subject: [PATCH 15/33] net/hns3: refactor multicast MAC address set for PF
|
||||
|
||||
Currently, when configuring a group of multicast MAC addresses, the PF
|
||||
driver reorder mc_addr array in hw struct to remove multicast MAC
|
||||
addresses that are not in mc_addr_set array from user and then adds new
|
||||
multicast MAC addresses. Actually, it can be simplified by removing all
|
||||
previous MAC addresses and then adding new MAC addresses.
|
||||
|
||||
Signed-off-by: Huisong Li <lihuisong@huawei.com>
|
||||
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
|
||||
---
|
||||
drivers/net/hns3/hns3_ethdev.c | 112 ++++-----------------------------
|
||||
1 file changed, 11 insertions(+), 101 deletions(-)
|
||||
|
||||
diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c
|
||||
index 97129c428..dd239f6e7 100644
|
||||
--- a/drivers/net/hns3/hns3_ethdev.c
|
||||
+++ b/drivers/net/hns3/hns3_ethdev.c
|
||||
@@ -2015,94 +2015,15 @@ hns3_set_mc_addr_chk_param(struct hns3_hw *hw,
|
||||
return 0;
|
||||
}
|
||||
|
||||
-static void
|
||||
-hns3_set_mc_addr_calc_addr(struct hns3_hw *hw,
|
||||
- struct rte_ether_addr *mc_addr_set,
|
||||
- int mc_addr_num,
|
||||
- struct rte_ether_addr *reserved_addr_list,
|
||||
- int *reserved_addr_num,
|
||||
- struct rte_ether_addr *add_addr_list,
|
||||
- int *add_addr_num,
|
||||
- struct rte_ether_addr *rm_addr_list,
|
||||
- int *rm_addr_num)
|
||||
-{
|
||||
- struct rte_ether_addr *addr;
|
||||
- int current_addr_num;
|
||||
- int reserved_num = 0;
|
||||
- int add_num = 0;
|
||||
- int rm_num = 0;
|
||||
- int num;
|
||||
- int i;
|
||||
- int j;
|
||||
- bool same_addr;
|
||||
-
|
||||
- /* Calculate the mc mac address list that should be removed */
|
||||
- current_addr_num = hw->mc_addrs_num;
|
||||
- for (i = 0; i < current_addr_num; i++) {
|
||||
- addr = &hw->mc_addrs[i];
|
||||
- same_addr = false;
|
||||
- for (j = 0; j < mc_addr_num; j++) {
|
||||
- if (rte_is_same_ether_addr(addr, &mc_addr_set[j])) {
|
||||
- same_addr = true;
|
||||
- break;
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- if (!same_addr) {
|
||||
- rte_ether_addr_copy(addr, &rm_addr_list[rm_num]);
|
||||
- rm_num++;
|
||||
- } else {
|
||||
- rte_ether_addr_copy(addr,
|
||||
- &reserved_addr_list[reserved_num]);
|
||||
- reserved_num++;
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- /* Calculate the mc mac address list that should be added */
|
||||
- for (i = 0; i < mc_addr_num; i++) {
|
||||
- addr = &mc_addr_set[i];
|
||||
- same_addr = false;
|
||||
- for (j = 0; j < current_addr_num; j++) {
|
||||
- if (rte_is_same_ether_addr(addr, &hw->mc_addrs[j])) {
|
||||
- same_addr = true;
|
||||
- break;
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- if (!same_addr) {
|
||||
- rte_ether_addr_copy(addr, &add_addr_list[add_num]);
|
||||
- add_num++;
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- /* Reorder the mc mac address list maintained by driver */
|
||||
- for (i = 0; i < reserved_num; i++)
|
||||
- rte_ether_addr_copy(&reserved_addr_list[i], &hw->mc_addrs[i]);
|
||||
-
|
||||
- for (i = 0; i < rm_num; i++) {
|
||||
- num = reserved_num + i;
|
||||
- rte_ether_addr_copy(&rm_addr_list[i], &hw->mc_addrs[num]);
|
||||
- }
|
||||
-
|
||||
- *reserved_addr_num = reserved_num;
|
||||
- *add_addr_num = add_num;
|
||||
- *rm_addr_num = rm_num;
|
||||
-}
|
||||
-
|
||||
static int
|
||||
hns3_set_mc_mac_addr_list(struct rte_eth_dev *dev,
|
||||
struct rte_ether_addr *mc_addr_set,
|
||||
uint32_t nb_mc_addr)
|
||||
{
|
||||
struct hns3_hw *hw = HNS3_DEV_PRIVATE_TO_HW(dev->data->dev_private);
|
||||
- struct rte_ether_addr reserved_addr_list[HNS3_MC_MACADDR_NUM];
|
||||
- struct rte_ether_addr add_addr_list[HNS3_MC_MACADDR_NUM];
|
||||
- struct rte_ether_addr rm_addr_list[HNS3_MC_MACADDR_NUM];
|
||||
struct rte_ether_addr *addr;
|
||||
- int reserved_addr_num;
|
||||
- int add_addr_num;
|
||||
- int rm_addr_num;
|
||||
- int mc_addr_num;
|
||||
+ int cur_addr_num;
|
||||
+ int set_addr_num;
|
||||
int num;
|
||||
int ret;
|
||||
int i;
|
||||
@@ -2113,40 +2034,29 @@ hns3_set_mc_mac_addr_list(struct rte_eth_dev *dev,
|
||||
return ret;
|
||||
|
||||
rte_spinlock_lock(&hw->lock);
|
||||
-
|
||||
- /*
|
||||
- * Calculate the mc mac address lists those should be removed and be
|
||||
- * added, Reorder the mc mac address list maintained by driver.
|
||||
- */
|
||||
- mc_addr_num = (int)nb_mc_addr;
|
||||
- hns3_set_mc_addr_calc_addr(hw, mc_addr_set, mc_addr_num,
|
||||
- reserved_addr_list, &reserved_addr_num,
|
||||
- add_addr_list, &add_addr_num,
|
||||
- rm_addr_list, &rm_addr_num);
|
||||
-
|
||||
- /* Remove mc mac addresses */
|
||||
- for (i = 0; i < rm_addr_num; i++) {
|
||||
- num = rm_addr_num - i - 1;
|
||||
- addr = &rm_addr_list[num];
|
||||
+ cur_addr_num = hw->mc_addrs_num;
|
||||
+ for (i = 0; i < cur_addr_num; i++) {
|
||||
+ num = cur_addr_num - i - 1;
|
||||
+ addr = &hw->mc_addrs[num];
|
||||
ret = hw->ops.del_mc_mac_addr(hw, addr);
|
||||
if (ret) {
|
||||
rte_spinlock_unlock(&hw->lock);
|
||||
return ret;
|
||||
}
|
||||
+
|
||||
hw->mc_addrs_num--;
|
||||
}
|
||||
|
||||
- /* Add mc mac addresses */
|
||||
- for (i = 0; i < add_addr_num; i++) {
|
||||
- addr = &add_addr_list[i];
|
||||
+ set_addr_num = (int)nb_mc_addr;
|
||||
+ for (i = 0; i < set_addr_num; i++) {
|
||||
+ addr = &mc_addr_set[i];
|
||||
ret = hw->ops.add_mc_mac_addr(hw, addr);
|
||||
if (ret) {
|
||||
rte_spinlock_unlock(&hw->lock);
|
||||
return ret;
|
||||
}
|
||||
|
||||
- num = reserved_addr_num + i;
|
||||
- rte_ether_addr_copy(addr, &hw->mc_addrs[num]);
|
||||
+ rte_ether_addr_copy(addr, &hw->mc_addrs[hw->mc_addrs_num]);
|
||||
hw->mc_addrs_num++;
|
||||
}
|
||||
rte_spinlock_unlock(&hw->lock);
|
||||
--
|
||||
2.33.0
|
||||
|
||||
132
0249-net-hns3-unify-multicast-MAC-address-set-list.patch
Normal file
132
0249-net-hns3-unify-multicast-MAC-address-set-list.patch
Normal file
@ -0,0 +1,132 @@
|
||||
From bbe20957bf59a4c2467b768865daa02c74ef907c Mon Sep 17 00:00:00 2001
|
||||
From: Huisong Li <lihuisong@huawei.com>
|
||||
Date: Fri, 22 Oct 2021 17:20:05 +0800
|
||||
Subject: [PATCH 16/33] net/hns3: unify multicast MAC address set list
|
||||
|
||||
This patch removes hns3vf_set_mc_mac_addr_list() and uses
|
||||
hns3_set_mc_mac_addr_list() to do this.
|
||||
|
||||
Signed-off-by: Huisong Li <lihuisong@huawei.com>
|
||||
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
|
||||
---
|
||||
drivers/net/hns3/hns3_ethdev.c | 4 +--
|
||||
drivers/net/hns3/hns3_ethdev.h | 7 ++---
|
||||
drivers/net/hns3/hns3_ethdev_vf.c | 50 +------------------------------
|
||||
3 files changed, 6 insertions(+), 55 deletions(-)
|
||||
|
||||
diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c
|
||||
index dd239f6e7..85c50ce67 100644
|
||||
--- a/drivers/net/hns3/hns3_ethdev.c
|
||||
+++ b/drivers/net/hns3/hns3_ethdev.c
|
||||
@@ -1947,7 +1947,7 @@ hns3_remove_mc_mac_addr(struct hns3_hw *hw, struct rte_ether_addr *mac_addr)
|
||||
return ret;
|
||||
}
|
||||
|
||||
-int
|
||||
+static int
|
||||
hns3_set_mc_addr_chk_param(struct hns3_hw *hw,
|
||||
struct rte_ether_addr *mc_addr_set,
|
||||
uint32_t nb_mc_addr)
|
||||
@@ -2015,7 +2015,7 @@ hns3_set_mc_addr_chk_param(struct hns3_hw *hw,
|
||||
return 0;
|
||||
}
|
||||
|
||||
-static int
|
||||
+int
|
||||
hns3_set_mc_mac_addr_list(struct rte_eth_dev *dev,
|
||||
struct rte_ether_addr *mc_addr_set,
|
||||
uint32_t nb_mc_addr)
|
||||
diff --git a/drivers/net/hns3/hns3_ethdev.h b/drivers/net/hns3/hns3_ethdev.h
|
||||
index 1606a6407..1f1364304 100644
|
||||
--- a/drivers/net/hns3/hns3_ethdev.h
|
||||
+++ b/drivers/net/hns3/hns3_ethdev.h
|
||||
@@ -1062,15 +1062,14 @@ void hns3vf_update_link_status(struct hns3_hw *hw, uint8_t link_status,
|
||||
uint32_t link_speed, uint8_t link_duplex);
|
||||
void hns3_parse_devargs(struct rte_eth_dev *dev);
|
||||
void hns3vf_update_push_lsc_cap(struct hns3_hw *hw, bool supported);
|
||||
-int hns3_set_mc_addr_chk_param(struct hns3_hw *hw,
|
||||
- struct rte_ether_addr *mc_addr_set,
|
||||
- uint32_t nb_mc_addr);
|
||||
int hns3_configure_all_mc_mac_addr(struct hns3_adapter *hns, bool del);
|
||||
int hns3_configure_all_mac_addr(struct hns3_adapter *hns, bool del);
|
||||
int hns3_add_mac_addr(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr,
|
||||
__rte_unused uint32_t idx, __rte_unused uint32_t pool);
|
||||
void hns3_remove_mac_addr(struct rte_eth_dev *dev, uint32_t idx);
|
||||
-
|
||||
+int hns3_set_mc_mac_addr_list(struct rte_eth_dev *dev,
|
||||
+ struct rte_ether_addr *mc_addr_set,
|
||||
+ uint32_t nb_mc_addr);
|
||||
int hns3_restore_ptp(struct hns3_adapter *hns);
|
||||
int hns3_mbuf_dyn_rx_timestamp_register(struct rte_eth_dev *dev,
|
||||
struct rte_eth_conf *conf);
|
||||
diff --git a/drivers/net/hns3/hns3_ethdev_vf.c b/drivers/net/hns3/hns3_ethdev_vf.c
|
||||
index 835e783c3..095f635cc 100644
|
||||
--- a/drivers/net/hns3/hns3_ethdev_vf.c
|
||||
+++ b/drivers/net/hns3/hns3_ethdev_vf.c
|
||||
@@ -299,54 +299,6 @@ hns3vf_remove_mc_mac_addr(struct hns3_hw *hw,
|
||||
return ret;
|
||||
}
|
||||
|
||||
-static int
|
||||
-hns3vf_set_mc_mac_addr_list(struct rte_eth_dev *dev,
|
||||
- struct rte_ether_addr *mc_addr_set,
|
||||
- uint32_t nb_mc_addr)
|
||||
-{
|
||||
- struct hns3_hw *hw = HNS3_DEV_PRIVATE_TO_HW(dev->data->dev_private);
|
||||
- struct rte_ether_addr *addr;
|
||||
- int cur_addr_num;
|
||||
- int set_addr_num;
|
||||
- int num;
|
||||
- int ret;
|
||||
- int i;
|
||||
-
|
||||
- ret = hns3_set_mc_addr_chk_param(hw, mc_addr_set, nb_mc_addr);
|
||||
- if (ret)
|
||||
- return ret;
|
||||
-
|
||||
- rte_spinlock_lock(&hw->lock);
|
||||
- cur_addr_num = hw->mc_addrs_num;
|
||||
- for (i = 0; i < cur_addr_num; i++) {
|
||||
- num = cur_addr_num - i - 1;
|
||||
- addr = &hw->mc_addrs[num];
|
||||
- ret = hw->ops.del_mc_mac_addr(hw, addr);
|
||||
- if (ret) {
|
||||
- rte_spinlock_unlock(&hw->lock);
|
||||
- return ret;
|
||||
- }
|
||||
-
|
||||
- hw->mc_addrs_num--;
|
||||
- }
|
||||
-
|
||||
- set_addr_num = (int)nb_mc_addr;
|
||||
- for (i = 0; i < set_addr_num; i++) {
|
||||
- addr = &mc_addr_set[i];
|
||||
- ret = hw->ops.add_mc_mac_addr(hw, addr);
|
||||
- if (ret) {
|
||||
- rte_spinlock_unlock(&hw->lock);
|
||||
- return ret;
|
||||
- }
|
||||
-
|
||||
- rte_ether_addr_copy(addr, &hw->mc_addrs[hw->mc_addrs_num]);
|
||||
- hw->mc_addrs_num++;
|
||||
- }
|
||||
- rte_spinlock_unlock(&hw->lock);
|
||||
-
|
||||
- return 0;
|
||||
-}
|
||||
-
|
||||
static int
|
||||
hns3vf_set_promisc_mode(struct hns3_hw *hw, bool en_bc_pmc,
|
||||
bool en_uc_pmc, bool en_mc_pmc)
|
||||
@@ -2704,7 +2656,7 @@ static const struct eth_dev_ops hns3vf_eth_dev_ops = {
|
||||
.mac_addr_add = hns3_add_mac_addr,
|
||||
.mac_addr_remove = hns3_remove_mac_addr,
|
||||
.mac_addr_set = hns3vf_set_default_mac_addr,
|
||||
- .set_mc_addr_list = hns3vf_set_mc_mac_addr_list,
|
||||
+ .set_mc_addr_list = hns3_set_mc_mac_addr_list,
|
||||
.link_update = hns3vf_dev_link_update,
|
||||
.rss_hash_update = hns3_dev_rss_hash_update,
|
||||
.rss_hash_conf_get = hns3_dev_rss_hash_conf_get,
|
||||
--
|
||||
2.33.0
|
||||
|
||||
38
0250-bonding-show-Tx-policy-for-802.3AD-mode.patch
Normal file
38
0250-bonding-show-Tx-policy-for-802.3AD-mode.patch
Normal file
@ -0,0 +1,38 @@
|
||||
From 6ae8a77985dd6a896c304fa1c344980747e88e66 Mon Sep 17 00:00:00 2001
|
||||
From: "Min Hu (Connor)" <humin29@huawei.com>
|
||||
Date: Mon, 25 Oct 2021 11:15:11 +0800
|
||||
Subject: [PATCH 17/33] bonding: show Tx policy for 802.3AD mode
|
||||
|
||||
As balance xmit policy is supported in bonding mode 4(802.3AD). This
|
||||
patch adds balance xmit policy show in testpmd commands for mode 4. Like:
|
||||
testpmd> show bonding config 2
|
||||
Bonding mode: 4
|
||||
Balance Xmit Policy: BALANCE_XMIT_POLICY_LAYER34
|
||||
IEEE802.3AD Aggregator Mode: stable
|
||||
Slaves (2): [0 1]
|
||||
Active Slaves (2): [1 0]
|
||||
Primary: [1]
|
||||
|
||||
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
|
||||
Acked-by: Ferruh Yigit <ferruh.yigit@intel.com>
|
||||
---
|
||||
app/test-pmd/cmdline.c | 3 ++-
|
||||
1 file changed, 2 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
|
||||
index b701129d8..66e3815de 100644
|
||||
--- a/app/test-pmd/cmdline.c
|
||||
+++ b/app/test-pmd/cmdline.c
|
||||
@@ -6257,7 +6257,8 @@ static void cmd_show_bonding_config_parsed(void *parsed_result,
|
||||
} else
|
||||
printf("\tBonding mode: %d\n", bonding_mode);
|
||||
|
||||
- if (bonding_mode == BONDING_MODE_BALANCE) {
|
||||
+ if (bonding_mode == BONDING_MODE_BALANCE ||
|
||||
+ bonding_mode == BONDING_MODE_8023AD) {
|
||||
int balance_xmit_policy;
|
||||
|
||||
balance_xmit_policy = rte_eth_bond_xmit_policy_get(port_id);
|
||||
--
|
||||
2.33.0
|
||||
|
||||
116
0251-net-hns3-fix-secondary-process-reference-count.patch
Normal file
116
0251-net-hns3-fix-secondary-process-reference-count.patch
Normal file
@ -0,0 +1,116 @@
|
||||
From 1058a9cd1fa03e94b7e8634f1f26902ed9a376b1 Mon Sep 17 00:00:00 2001
|
||||
From: Huisong Li <lihuisong@huawei.com>
|
||||
Date: Tue, 2 Nov 2021 09:38:26 +0800
|
||||
Subject: [PATCH 18/33] net/hns3: fix secondary process reference count
|
||||
|
||||
The "secondary_cnt" will be increased when a secondary process
|
||||
initialized. But the value of this variable is not decreased when the
|
||||
secondary process exits, which causes the primary process senses that
|
||||
the secondary process still exists. As a result, the primary process
|
||||
fails to send messages to the secondary process after the secondary
|
||||
process exits.
|
||||
|
||||
Fixes: 23d4b61fee5d ("net/hns3: support multiple process")
|
||||
Cc: stable@dpdk.org
|
||||
|
||||
Signed-off-by: Huisong Li <lihuisong@huawei.com>
|
||||
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
|
||||
---
|
||||
drivers/net/hns3/hns3_ethdev.c | 10 +++++++---
|
||||
drivers/net/hns3/hns3_ethdev_vf.c | 10 +++++++---
|
||||
drivers/net/hns3/hns3_mp.c | 4 +++-
|
||||
3 files changed, 17 insertions(+), 7 deletions(-)
|
||||
|
||||
diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c
|
||||
index 85c50ce67..31d027836 100644
|
||||
--- a/drivers/net/hns3/hns3_ethdev.c
|
||||
+++ b/drivers/net/hns3/hns3_ethdev.c
|
||||
@@ -5894,8 +5894,10 @@ hns3_dev_close(struct rte_eth_dev *eth_dev)
|
||||
struct hns3_hw *hw = &hns->hw;
|
||||
int ret = 0;
|
||||
|
||||
- if (rte_eal_process_type() != RTE_PROC_PRIMARY)
|
||||
+ if (rte_eal_process_type() != RTE_PROC_PRIMARY) {
|
||||
+ __atomic_fetch_sub(&hw->secondary_cnt, 1, __ATOMIC_RELAXED);
|
||||
return 0;
|
||||
+ }
|
||||
|
||||
if (hw->adapter_state == HNS3_NIC_STARTED)
|
||||
ret = hns3_dev_stop(eth_dev);
|
||||
@@ -7421,7 +7423,7 @@ hns3_dev_init(struct rte_eth_dev *eth_dev)
|
||||
"process, ret = %d", ret);
|
||||
goto err_mp_init_secondary;
|
||||
}
|
||||
- hw->secondary_cnt++;
|
||||
+ __atomic_fetch_add(&hw->secondary_cnt, 1, __ATOMIC_RELAXED);
|
||||
hns3_tx_push_init(eth_dev);
|
||||
return 0;
|
||||
}
|
||||
@@ -7524,8 +7526,10 @@ hns3_dev_uninit(struct rte_eth_dev *eth_dev)
|
||||
|
||||
PMD_INIT_FUNC_TRACE();
|
||||
|
||||
- if (rte_eal_process_type() != RTE_PROC_PRIMARY)
|
||||
+ if (rte_eal_process_type() != RTE_PROC_PRIMARY) {
|
||||
+ __atomic_fetch_sub(&hw->secondary_cnt, 1, __ATOMIC_RELAXED);
|
||||
return 0;
|
||||
+ }
|
||||
|
||||
if (hw->adapter_state < HNS3_NIC_CLOSING)
|
||||
hns3_dev_close(eth_dev);
|
||||
diff --git a/drivers/net/hns3/hns3_ethdev_vf.c b/drivers/net/hns3/hns3_ethdev_vf.c
|
||||
index 095f635cc..76721b0d7 100644
|
||||
--- a/drivers/net/hns3/hns3_ethdev_vf.c
|
||||
+++ b/drivers/net/hns3/hns3_ethdev_vf.c
|
||||
@@ -1921,8 +1921,10 @@ hns3vf_dev_close(struct rte_eth_dev *eth_dev)
|
||||
struct hns3_hw *hw = &hns->hw;
|
||||
int ret = 0;
|
||||
|
||||
- if (rte_eal_process_type() != RTE_PROC_PRIMARY)
|
||||
+ if (rte_eal_process_type() != RTE_PROC_PRIMARY) {
|
||||
+ __atomic_fetch_sub(&hw->secondary_cnt, 1, __ATOMIC_RELAXED);
|
||||
return 0;
|
||||
+ }
|
||||
|
||||
if (hw->adapter_state == HNS3_NIC_STARTED)
|
||||
ret = hns3vf_dev_stop(eth_dev);
|
||||
@@ -2710,7 +2712,7 @@ hns3vf_dev_init(struct rte_eth_dev *eth_dev)
|
||||
"process, ret = %d", ret);
|
||||
goto err_mp_init_secondary;
|
||||
}
|
||||
- hw->secondary_cnt++;
|
||||
+ __atomic_fetch_add(&hw->secondary_cnt, 1, __ATOMIC_RELAXED);
|
||||
hns3_tx_push_init(eth_dev);
|
||||
return 0;
|
||||
}
|
||||
@@ -2812,8 +2814,10 @@ hns3vf_dev_uninit(struct rte_eth_dev *eth_dev)
|
||||
|
||||
PMD_INIT_FUNC_TRACE();
|
||||
|
||||
- if (rte_eal_process_type() != RTE_PROC_PRIMARY)
|
||||
+ if (rte_eal_process_type() != RTE_PROC_PRIMARY) {
|
||||
+ __atomic_fetch_sub(&hw->secondary_cnt, 1, __ATOMIC_RELAXED);
|
||||
return 0;
|
||||
+ }
|
||||
|
||||
if (hw->adapter_state < HNS3_NIC_CLOSING)
|
||||
hns3vf_dev_close(eth_dev);
|
||||
diff --git a/drivers/net/hns3/hns3_mp.c b/drivers/net/hns3/hns3_mp.c
|
||||
index 4891c6e4f..184acfe02 100644
|
||||
--- a/drivers/net/hns3/hns3_mp.c
|
||||
+++ b/drivers/net/hns3/hns3_mp.c
|
||||
@@ -150,8 +150,10 @@ mp_req_on_rxtx(struct rte_eth_dev *dev, enum hns3_mp_req_type type)
|
||||
int ret;
|
||||
int i;
|
||||
|
||||
- if (rte_eal_process_type() == RTE_PROC_SECONDARY || !hw->secondary_cnt)
|
||||
+ if (rte_eal_process_type() == RTE_PROC_SECONDARY ||
|
||||
+ __atomic_load_n(&hw->secondary_cnt, __ATOMIC_RELAXED) == 0)
|
||||
return;
|
||||
+
|
||||
if (!mp_req_type_is_valid(type)) {
|
||||
hns3_err(hw, "port %u unknown request (req_type %d)",
|
||||
dev->data->port_id, type);
|
||||
--
|
||||
2.33.0
|
||||
|
||||
166
0252-net-hns3-fix-multi-process-action-register-and-unreg.patch
Normal file
166
0252-net-hns3-fix-multi-process-action-register-and-unreg.patch
Normal file
@ -0,0 +1,166 @@
|
||||
From c4ae016e0b548882c5f777cd1782b8661a34f252 Mon Sep 17 00:00:00 2001
|
||||
From: Huisong Li <lihuisong@huawei.com>
|
||||
Date: Tue, 2 Nov 2021 09:38:27 +0800
|
||||
Subject: [PATCH 19/33] net/hns3: fix multi-process action register and
|
||||
unregister
|
||||
|
||||
The multi-process has the following problems:
|
||||
1) After a port in primary process is closed, the mp action of the
|
||||
process is unregistered. Which will cause that other device in the
|
||||
primary process cannot respond to requests from secondary processes.
|
||||
2) Because variable "hns3_inited" is set to true without returning an
|
||||
initial value, the mp action cannot be registered again after it is
|
||||
unregistered.
|
||||
3) The mp action of primary and secondary process need to be registered
|
||||
only once regardless of port numbers in the process. That's what
|
||||
variable "hns3_inited" does. But the variable is difficult to
|
||||
understand.
|
||||
|
||||
This patch adds a hns3_process_local_data structure to resolve above
|
||||
problems.
|
||||
|
||||
Fixes: 9570b1fdbdad ("net/hns3: check multi-process action register result")
|
||||
Fixes: 23d4b61fee5d ("net/hns3: support multiple process")
|
||||
|
||||
Signed-off-by: Huisong Li <lihuisong@huawei.com>
|
||||
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
|
||||
---
|
||||
drivers/net/hns3/hns3_ethdev.c | 2 ++
|
||||
drivers/net/hns3/hns3_ethdev_vf.c | 2 ++
|
||||
drivers/net/hns3/hns3_mp.c | 37 ++++++++++++++++++-------------
|
||||
drivers/net/hns3/hns3_mp.h | 7 ++++++
|
||||
4 files changed, 33 insertions(+), 15 deletions(-)
|
||||
|
||||
diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c
|
||||
index 31d027836..2f2d2a605 100644
|
||||
--- a/drivers/net/hns3/hns3_ethdev.c
|
||||
+++ b/drivers/net/hns3/hns3_ethdev.c
|
||||
@@ -7424,6 +7424,7 @@ hns3_dev_init(struct rte_eth_dev *eth_dev)
|
||||
goto err_mp_init_secondary;
|
||||
}
|
||||
__atomic_fetch_add(&hw->secondary_cnt, 1, __ATOMIC_RELAXED);
|
||||
+ process_data.eth_dev_cnt++;
|
||||
hns3_tx_push_init(eth_dev);
|
||||
return 0;
|
||||
}
|
||||
@@ -7435,6 +7436,7 @@ hns3_dev_init(struct rte_eth_dev *eth_dev)
|
||||
ret);
|
||||
goto err_mp_init_primary;
|
||||
}
|
||||
+ process_data.eth_dev_cnt++;
|
||||
|
||||
hw->adapter_state = HNS3_NIC_UNINITIALIZED;
|
||||
hns->is_vf = false;
|
||||
diff --git a/drivers/net/hns3/hns3_ethdev_vf.c b/drivers/net/hns3/hns3_ethdev_vf.c
|
||||
index 76721b0d7..108bd61d5 100644
|
||||
--- a/drivers/net/hns3/hns3_ethdev_vf.c
|
||||
+++ b/drivers/net/hns3/hns3_ethdev_vf.c
|
||||
@@ -2713,6 +2713,7 @@ hns3vf_dev_init(struct rte_eth_dev *eth_dev)
|
||||
goto err_mp_init_secondary;
|
||||
}
|
||||
__atomic_fetch_add(&hw->secondary_cnt, 1, __ATOMIC_RELAXED);
|
||||
+ process_data.eth_dev_cnt++;
|
||||
hns3_tx_push_init(eth_dev);
|
||||
return 0;
|
||||
}
|
||||
@@ -2724,6 +2725,7 @@ hns3vf_dev_init(struct rte_eth_dev *eth_dev)
|
||||
ret);
|
||||
goto err_mp_init_primary;
|
||||
}
|
||||
+ process_data.eth_dev_cnt++;
|
||||
|
||||
hw->adapter_state = HNS3_NIC_UNINITIALIZED;
|
||||
hns->is_vf = true;
|
||||
diff --git a/drivers/net/hns3/hns3_mp.c b/drivers/net/hns3/hns3_mp.c
|
||||
index 184acfe02..753b93f09 100644
|
||||
--- a/drivers/net/hns3/hns3_mp.c
|
||||
+++ b/drivers/net/hns3/hns3_mp.c
|
||||
@@ -12,7 +12,8 @@
|
||||
#include "hns3_rxtx.h"
|
||||
#include "hns3_mp.h"
|
||||
|
||||
-static bool hns3_inited;
|
||||
+/* local data for primary or secondary process. */
|
||||
+struct hns3_process_local_data process_data;
|
||||
|
||||
/*
|
||||
* Initialize IPC message.
|
||||
@@ -230,14 +231,15 @@ int hns3_mp_init_primary(void)
|
||||
{
|
||||
int ret;
|
||||
|
||||
- if (!hns3_inited) {
|
||||
- /* primary is allowed to not support IPC */
|
||||
- ret = rte_mp_action_register(HNS3_MP_NAME, mp_primary_handle);
|
||||
- if (ret && rte_errno != ENOTSUP)
|
||||
- return ret;
|
||||
+ if (process_data.init_done)
|
||||
+ return 0;
|
||||
|
||||
- hns3_inited = true;
|
||||
- }
|
||||
+ /* primary is allowed to not support IPC */
|
||||
+ ret = rte_mp_action_register(HNS3_MP_NAME, mp_primary_handle);
|
||||
+ if (ret && rte_errno != ENOTSUP)
|
||||
+ return ret;
|
||||
+
|
||||
+ process_data.init_done = true;
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -247,8 +249,12 @@ int hns3_mp_init_primary(void)
|
||||
*/
|
||||
void hns3_mp_uninit_primary(void)
|
||||
{
|
||||
- if (hns3_inited)
|
||||
+ process_data.eth_dev_cnt--;
|
||||
+
|
||||
+ if (process_data.eth_dev_cnt == 0) {
|
||||
rte_mp_action_unregister(HNS3_MP_NAME);
|
||||
+ process_data.init_done = false;
|
||||
+ }
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -258,13 +264,14 @@ int hns3_mp_init_secondary(void)
|
||||
{
|
||||
int ret;
|
||||
|
||||
- if (!hns3_inited) {
|
||||
- ret = rte_mp_action_register(HNS3_MP_NAME, mp_secondary_handle);
|
||||
- if (ret)
|
||||
- return ret;
|
||||
+ if (process_data.init_done)
|
||||
+ return 0;
|
||||
|
||||
- hns3_inited = true;
|
||||
- }
|
||||
+ ret = rte_mp_action_register(HNS3_MP_NAME, mp_secondary_handle);
|
||||
+ if (ret)
|
||||
+ return ret;
|
||||
+
|
||||
+ process_data.init_done = true;
|
||||
|
||||
return 0;
|
||||
}
|
||||
diff --git a/drivers/net/hns3/hns3_mp.h b/drivers/net/hns3/hns3_mp.h
|
||||
index e0e4aeaf6..b49532f98 100644
|
||||
--- a/drivers/net/hns3/hns3_mp.h
|
||||
+++ b/drivers/net/hns3/hns3_mp.h
|
||||
@@ -5,6 +5,13 @@
|
||||
#ifndef _HNS3_MP_H_
|
||||
#define _HNS3_MP_H_
|
||||
|
||||
+/* Local data for primary or secondary process. */
|
||||
+struct hns3_process_local_data {
|
||||
+ bool init_done; /* Process action register completed flag. */
|
||||
+ int eth_dev_cnt; /* Ethdev count under the current process. */
|
||||
+};
|
||||
+extern struct hns3_process_local_data process_data;
|
||||
+
|
||||
void hns3_mp_req_start_rxtx(struct rte_eth_dev *dev);
|
||||
void hns3_mp_req_stop_rxtx(struct rte_eth_dev *dev);
|
||||
void hns3_mp_req_start_tx(struct rte_eth_dev *dev);
|
||||
--
|
||||
2.33.0
|
||||
|
||||
128
0253-net-hns3-unregister-MP-action-on-close-for-secondary.patch
Normal file
128
0253-net-hns3-unregister-MP-action-on-close-for-secondary.patch
Normal file
@ -0,0 +1,128 @@
|
||||
From 9bc0df6a4fa9b3ea1decc519c778e48a27037589 Mon Sep 17 00:00:00 2001
|
||||
From: Huisong Li <lihuisong@huawei.com>
|
||||
Date: Tue, 2 Nov 2021 09:38:28 +0800
|
||||
Subject: [PATCH 20/33] net/hns3: unregister MP action on close for secondary
|
||||
|
||||
This patch fixes lack of unregistering MP action for secondary process
|
||||
when PMD is closed.
|
||||
|
||||
Fixes: 9570b1fdbdad ("net/hns3: check multi-process action register result")
|
||||
Fixes: 23d4b61fee5d ("net/hns3: support multiple process")
|
||||
|
||||
Signed-off-by: Huisong Li <lihuisong@huawei.com>
|
||||
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
|
||||
---
|
||||
drivers/net/hns3/hns3_ethdev.c | 6 ++++--
|
||||
drivers/net/hns3/hns3_ethdev_vf.c | 6 ++++--
|
||||
drivers/net/hns3/hns3_mp.c | 5 +----
|
||||
drivers/net/hns3/hns3_mp.h | 2 +-
|
||||
4 files changed, 10 insertions(+), 9 deletions(-)
|
||||
|
||||
diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c
|
||||
index 2f2d2a605..b4f375bf2 100644
|
||||
--- a/drivers/net/hns3/hns3_ethdev.c
|
||||
+++ b/drivers/net/hns3/hns3_ethdev.c
|
||||
@@ -5896,6 +5896,7 @@ hns3_dev_close(struct rte_eth_dev *eth_dev)
|
||||
|
||||
if (rte_eal_process_type() != RTE_PROC_PRIMARY) {
|
||||
__atomic_fetch_sub(&hw->secondary_cnt, 1, __ATOMIC_RELAXED);
|
||||
+ hns3_mp_uninit();
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -5912,7 +5913,7 @@ hns3_dev_close(struct rte_eth_dev *eth_dev)
|
||||
hns3_uninit_pf(eth_dev);
|
||||
hns3_free_all_queues(eth_dev);
|
||||
rte_free(hw->reset.wait_data);
|
||||
- hns3_mp_uninit_primary();
|
||||
+ hns3_mp_uninit();
|
||||
hns3_warn(hw, "Close port %u finished", hw->data->port_id);
|
||||
|
||||
return ret;
|
||||
@@ -7507,7 +7508,7 @@ hns3_dev_init(struct rte_eth_dev *eth_dev)
|
||||
rte_free(hw->reset.wait_data);
|
||||
|
||||
err_init_reset:
|
||||
- hns3_mp_uninit_primary();
|
||||
+ hns3_mp_uninit();
|
||||
|
||||
err_mp_init_primary:
|
||||
err_mp_init_secondary:
|
||||
@@ -7530,6 +7531,7 @@ hns3_dev_uninit(struct rte_eth_dev *eth_dev)
|
||||
|
||||
if (rte_eal_process_type() != RTE_PROC_PRIMARY) {
|
||||
__atomic_fetch_sub(&hw->secondary_cnt, 1, __ATOMIC_RELAXED);
|
||||
+ hns3_mp_uninit();
|
||||
return 0;
|
||||
}
|
||||
|
||||
diff --git a/drivers/net/hns3/hns3_ethdev_vf.c b/drivers/net/hns3/hns3_ethdev_vf.c
|
||||
index 108bd61d5..ac0dcbe36 100644
|
||||
--- a/drivers/net/hns3/hns3_ethdev_vf.c
|
||||
+++ b/drivers/net/hns3/hns3_ethdev_vf.c
|
||||
@@ -1923,6 +1923,7 @@ hns3vf_dev_close(struct rte_eth_dev *eth_dev)
|
||||
|
||||
if (rte_eal_process_type() != RTE_PROC_PRIMARY) {
|
||||
__atomic_fetch_sub(&hw->secondary_cnt, 1, __ATOMIC_RELAXED);
|
||||
+ hns3_mp_uninit();
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1938,7 +1939,7 @@ hns3vf_dev_close(struct rte_eth_dev *eth_dev)
|
||||
hns3vf_uninit_vf(eth_dev);
|
||||
hns3_free_all_queues(eth_dev);
|
||||
rte_free(hw->reset.wait_data);
|
||||
- hns3_mp_uninit_primary();
|
||||
+ hns3_mp_uninit();
|
||||
hns3_warn(hw, "Close port %u finished", hw->data->port_id);
|
||||
|
||||
return ret;
|
||||
@@ -2794,7 +2795,7 @@ hns3vf_dev_init(struct rte_eth_dev *eth_dev)
|
||||
rte_free(hw->reset.wait_data);
|
||||
|
||||
err_init_reset:
|
||||
- hns3_mp_uninit_primary();
|
||||
+ hns3_mp_uninit();
|
||||
|
||||
err_mp_init_primary:
|
||||
err_mp_init_secondary:
|
||||
@@ -2818,6 +2819,7 @@ hns3vf_dev_uninit(struct rte_eth_dev *eth_dev)
|
||||
|
||||
if (rte_eal_process_type() != RTE_PROC_PRIMARY) {
|
||||
__atomic_fetch_sub(&hw->secondary_cnt, 1, __ATOMIC_RELAXED);
|
||||
+ hns3_mp_uninit();
|
||||
return 0;
|
||||
}
|
||||
|
||||
diff --git a/drivers/net/hns3/hns3_mp.c b/drivers/net/hns3/hns3_mp.c
|
||||
index 753b93f09..2ecb16861 100644
|
||||
--- a/drivers/net/hns3/hns3_mp.c
|
||||
+++ b/drivers/net/hns3/hns3_mp.c
|
||||
@@ -244,10 +244,7 @@ int hns3_mp_init_primary(void)
|
||||
return 0;
|
||||
}
|
||||
|
||||
-/*
|
||||
- * Un-initialize by primary process.
|
||||
- */
|
||||
-void hns3_mp_uninit_primary(void)
|
||||
+void hns3_mp_uninit(void)
|
||||
{
|
||||
process_data.eth_dev_cnt--;
|
||||
|
||||
diff --git a/drivers/net/hns3/hns3_mp.h b/drivers/net/hns3/hns3_mp.h
|
||||
index b49532f98..5738ab74a 100644
|
||||
--- a/drivers/net/hns3/hns3_mp.h
|
||||
+++ b/drivers/net/hns3/hns3_mp.h
|
||||
@@ -18,7 +18,7 @@ void hns3_mp_req_start_tx(struct rte_eth_dev *dev);
|
||||
void hns3_mp_req_stop_tx(struct rte_eth_dev *dev);
|
||||
|
||||
int hns3_mp_init_primary(void);
|
||||
-void hns3_mp_uninit_primary(void);
|
||||
+void hns3_mp_uninit(void);
|
||||
int hns3_mp_init_secondary(void);
|
||||
|
||||
#endif /* _HNS3_MP_H_ */
|
||||
--
|
||||
2.33.0
|
||||
|
||||
300
0254-net-hns3-refactor-multi-process-initialization.patch
Normal file
300
0254-net-hns3-refactor-multi-process-initialization.patch
Normal file
@ -0,0 +1,300 @@
|
||||
From 8388c42414d8f33ba97b01cbe4bf4e945a9819b4 Mon Sep 17 00:00:00 2001
|
||||
From: Huisong Li <lihuisong@huawei.com>
|
||||
Date: Tue, 2 Nov 2021 09:38:29 +0800
|
||||
Subject: [PATCH 21/33] net/hns3: refactor multi-process initialization
|
||||
|
||||
Currently, the logic of the PF and VF initialization codes for multiple
|
||||
process is the same. A common function can be extracted to initialize
|
||||
and unload multiple process.
|
||||
|
||||
Signed-off-by: Huisong Li <lihuisong@huawei.com>
|
||||
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
|
||||
---
|
||||
drivers/net/hns3/hns3_ethdev.c | 34 +++++------------
|
||||
drivers/net/hns3/hns3_ethdev_vf.c | 33 +++++-----------
|
||||
drivers/net/hns3/hns3_mp.c | 62 ++++++++++++++++++++++++-------
|
||||
drivers/net/hns3/hns3_mp.h | 6 +--
|
||||
4 files changed, 68 insertions(+), 67 deletions(-)
|
||||
|
||||
diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c
|
||||
index b4f375bf2..ecf912a9f 100644
|
||||
--- a/drivers/net/hns3/hns3_ethdev.c
|
||||
+++ b/drivers/net/hns3/hns3_ethdev.c
|
||||
@@ -5895,8 +5895,7 @@ hns3_dev_close(struct rte_eth_dev *eth_dev)
|
||||
int ret = 0;
|
||||
|
||||
if (rte_eal_process_type() != RTE_PROC_PRIMARY) {
|
||||
- __atomic_fetch_sub(&hw->secondary_cnt, 1, __ATOMIC_RELAXED);
|
||||
- hns3_mp_uninit();
|
||||
+ hns3_mp_uninit(eth_dev);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -5913,7 +5912,7 @@ hns3_dev_close(struct rte_eth_dev *eth_dev)
|
||||
hns3_uninit_pf(eth_dev);
|
||||
hns3_free_all_queues(eth_dev);
|
||||
rte_free(hw->reset.wait_data);
|
||||
- hns3_mp_uninit();
|
||||
+ hns3_mp_uninit(eth_dev);
|
||||
hns3_warn(hw, "Close port %u finished", hw->data->port_id);
|
||||
|
||||
return ret;
|
||||
@@ -7417,28 +7416,15 @@ hns3_dev_init(struct rte_eth_dev *eth_dev)
|
||||
hns3_set_rxtx_function(eth_dev);
|
||||
eth_dev->dev_ops = &hns3_eth_dev_ops;
|
||||
eth_dev->rx_queue_count = hns3_rx_queue_count;
|
||||
+ ret = hns3_mp_init(eth_dev);
|
||||
+ if (ret)
|
||||
+ goto err_mp_init;
|
||||
+
|
||||
if (rte_eal_process_type() != RTE_PROC_PRIMARY) {
|
||||
- ret = hns3_mp_init_secondary();
|
||||
- if (ret) {
|
||||
- PMD_INIT_LOG(ERR, "Failed to init for secondary "
|
||||
- "process, ret = %d", ret);
|
||||
- goto err_mp_init_secondary;
|
||||
- }
|
||||
- __atomic_fetch_add(&hw->secondary_cnt, 1, __ATOMIC_RELAXED);
|
||||
- process_data.eth_dev_cnt++;
|
||||
hns3_tx_push_init(eth_dev);
|
||||
return 0;
|
||||
}
|
||||
|
||||
- ret = hns3_mp_init_primary();
|
||||
- if (ret) {
|
||||
- PMD_INIT_LOG(ERR,
|
||||
- "Failed to init for primary process, ret = %d",
|
||||
- ret);
|
||||
- goto err_mp_init_primary;
|
||||
- }
|
||||
- process_data.eth_dev_cnt++;
|
||||
-
|
||||
hw->adapter_state = HNS3_NIC_UNINITIALIZED;
|
||||
hns->is_vf = false;
|
||||
hw->data = eth_dev->data;
|
||||
@@ -7508,10 +7494,9 @@ hns3_dev_init(struct rte_eth_dev *eth_dev)
|
||||
rte_free(hw->reset.wait_data);
|
||||
|
||||
err_init_reset:
|
||||
- hns3_mp_uninit();
|
||||
+ hns3_mp_uninit(eth_dev);
|
||||
|
||||
-err_mp_init_primary:
|
||||
-err_mp_init_secondary:
|
||||
+err_mp_init:
|
||||
eth_dev->dev_ops = NULL;
|
||||
eth_dev->rx_pkt_burst = NULL;
|
||||
eth_dev->rx_descriptor_status = NULL;
|
||||
@@ -7530,8 +7515,7 @@ hns3_dev_uninit(struct rte_eth_dev *eth_dev)
|
||||
PMD_INIT_FUNC_TRACE();
|
||||
|
||||
if (rte_eal_process_type() != RTE_PROC_PRIMARY) {
|
||||
- __atomic_fetch_sub(&hw->secondary_cnt, 1, __ATOMIC_RELAXED);
|
||||
- hns3_mp_uninit();
|
||||
+ hns3_mp_uninit(eth_dev);
|
||||
return 0;
|
||||
}
|
||||
|
||||
diff --git a/drivers/net/hns3/hns3_ethdev_vf.c b/drivers/net/hns3/hns3_ethdev_vf.c
|
||||
index ac0dcbe36..1e0cb1b63 100644
|
||||
--- a/drivers/net/hns3/hns3_ethdev_vf.c
|
||||
+++ b/drivers/net/hns3/hns3_ethdev_vf.c
|
||||
@@ -1922,8 +1922,7 @@ hns3vf_dev_close(struct rte_eth_dev *eth_dev)
|
||||
int ret = 0;
|
||||
|
||||
if (rte_eal_process_type() != RTE_PROC_PRIMARY) {
|
||||
- __atomic_fetch_sub(&hw->secondary_cnt, 1, __ATOMIC_RELAXED);
|
||||
- hns3_mp_uninit();
|
||||
+ hns3_mp_uninit(eth_dev);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1939,7 +1938,7 @@ hns3vf_dev_close(struct rte_eth_dev *eth_dev)
|
||||
hns3vf_uninit_vf(eth_dev);
|
||||
hns3_free_all_queues(eth_dev);
|
||||
rte_free(hw->reset.wait_data);
|
||||
- hns3_mp_uninit();
|
||||
+ hns3_mp_uninit(eth_dev);
|
||||
hns3_warn(hw, "Close port %u finished", hw->data->port_id);
|
||||
|
||||
return ret;
|
||||
@@ -2706,28 +2705,15 @@ hns3vf_dev_init(struct rte_eth_dev *eth_dev)
|
||||
hns3_set_rxtx_function(eth_dev);
|
||||
eth_dev->dev_ops = &hns3vf_eth_dev_ops;
|
||||
eth_dev->rx_queue_count = hns3_rx_queue_count;
|
||||
+ ret = hns3_mp_init(eth_dev);
|
||||
+ if (ret)
|
||||
+ goto err_mp_init;
|
||||
+
|
||||
if (rte_eal_process_type() != RTE_PROC_PRIMARY) {
|
||||
- ret = hns3_mp_init_secondary();
|
||||
- if (ret) {
|
||||
- PMD_INIT_LOG(ERR, "Failed to init for secondary "
|
||||
- "process, ret = %d", ret);
|
||||
- goto err_mp_init_secondary;
|
||||
- }
|
||||
- __atomic_fetch_add(&hw->secondary_cnt, 1, __ATOMIC_RELAXED);
|
||||
- process_data.eth_dev_cnt++;
|
||||
hns3_tx_push_init(eth_dev);
|
||||
return 0;
|
||||
}
|
||||
|
||||
- ret = hns3_mp_init_primary();
|
||||
- if (ret) {
|
||||
- PMD_INIT_LOG(ERR,
|
||||
- "Failed to init for primary process, ret = %d",
|
||||
- ret);
|
||||
- goto err_mp_init_primary;
|
||||
- }
|
||||
- process_data.eth_dev_cnt++;
|
||||
-
|
||||
hw->adapter_state = HNS3_NIC_UNINITIALIZED;
|
||||
hns->is_vf = true;
|
||||
hw->data = eth_dev->data;
|
||||
@@ -2795,10 +2781,9 @@ hns3vf_dev_init(struct rte_eth_dev *eth_dev)
|
||||
rte_free(hw->reset.wait_data);
|
||||
|
||||
err_init_reset:
|
||||
- hns3_mp_uninit();
|
||||
+ hns3_mp_uninit(eth_dev);
|
||||
|
||||
-err_mp_init_primary:
|
||||
-err_mp_init_secondary:
|
||||
+err_mp_init:
|
||||
eth_dev->dev_ops = NULL;
|
||||
eth_dev->rx_pkt_burst = NULL;
|
||||
eth_dev->rx_descriptor_status = NULL;
|
||||
@@ -2819,7 +2804,7 @@ hns3vf_dev_uninit(struct rte_eth_dev *eth_dev)
|
||||
|
||||
if (rte_eal_process_type() != RTE_PROC_PRIMARY) {
|
||||
__atomic_fetch_sub(&hw->secondary_cnt, 1, __ATOMIC_RELAXED);
|
||||
- hns3_mp_uninit();
|
||||
+ hns3_mp_uninit(eth_dev);
|
||||
return 0;
|
||||
}
|
||||
|
||||
diff --git a/drivers/net/hns3/hns3_mp.c b/drivers/net/hns3/hns3_mp.c
|
||||
index 2ecb16861..63d22bcd3 100644
|
||||
--- a/drivers/net/hns3/hns3_mp.c
|
||||
+++ b/drivers/net/hns3/hns3_mp.c
|
||||
@@ -13,7 +13,7 @@
|
||||
#include "hns3_mp.h"
|
||||
|
||||
/* local data for primary or secondary process. */
|
||||
-struct hns3_process_local_data process_data;
|
||||
+static struct hns3_process_local_data process_data;
|
||||
|
||||
/*
|
||||
* Initialize IPC message.
|
||||
@@ -227,7 +227,8 @@ hns3_mp_req_start_tx(struct rte_eth_dev *dev)
|
||||
/*
|
||||
* Initialize by primary process.
|
||||
*/
|
||||
-int hns3_mp_init_primary(void)
|
||||
+static int
|
||||
+hns3_mp_init_primary(void)
|
||||
{
|
||||
int ret;
|
||||
|
||||
@@ -244,20 +245,11 @@ int hns3_mp_init_primary(void)
|
||||
return 0;
|
||||
}
|
||||
|
||||
-void hns3_mp_uninit(void)
|
||||
-{
|
||||
- process_data.eth_dev_cnt--;
|
||||
-
|
||||
- if (process_data.eth_dev_cnt == 0) {
|
||||
- rte_mp_action_unregister(HNS3_MP_NAME);
|
||||
- process_data.init_done = false;
|
||||
- }
|
||||
-}
|
||||
-
|
||||
/*
|
||||
* Initialize by secondary process.
|
||||
*/
|
||||
-int hns3_mp_init_secondary(void)
|
||||
+static int
|
||||
+hns3_mp_init_secondary(void)
|
||||
{
|
||||
int ret;
|
||||
|
||||
@@ -265,10 +257,52 @@ int hns3_mp_init_secondary(void)
|
||||
return 0;
|
||||
|
||||
ret = rte_mp_action_register(HNS3_MP_NAME, mp_secondary_handle);
|
||||
- if (ret)
|
||||
+ if (ret && rte_errno != ENOTSUP)
|
||||
return ret;
|
||||
|
||||
process_data.init_done = true;
|
||||
|
||||
return 0;
|
||||
}
|
||||
+
|
||||
+int
|
||||
+hns3_mp_init(struct rte_eth_dev *dev)
|
||||
+{
|
||||
+ struct hns3_hw *hw = HNS3_DEV_PRIVATE_TO_HW(dev->data->dev_private);
|
||||
+ int ret;
|
||||
+
|
||||
+ if (rte_eal_process_type() != RTE_PROC_PRIMARY) {
|
||||
+ ret = hns3_mp_init_secondary();
|
||||
+ if (ret) {
|
||||
+ PMD_INIT_LOG(ERR, "Failed to init for secondary process, ret = %d",
|
||||
+ ret);
|
||||
+ return ret;
|
||||
+ }
|
||||
+ __atomic_fetch_add(&hw->secondary_cnt, 1, __ATOMIC_RELAXED);
|
||||
+ } else {
|
||||
+ ret = hns3_mp_init_primary();
|
||||
+ if (ret) {
|
||||
+ PMD_INIT_LOG(ERR, "Failed to init for primary process, ret = %d",
|
||||
+ ret);
|
||||
+ return ret;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ process_data.eth_dev_cnt++;
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+void hns3_mp_uninit(struct rte_eth_dev *dev)
|
||||
+{
|
||||
+ struct hns3_hw *hw = HNS3_DEV_PRIVATE_TO_HW(dev->data->dev_private);
|
||||
+
|
||||
+ if (rte_eal_process_type() != RTE_PROC_PRIMARY)
|
||||
+ __atomic_fetch_sub(&hw->secondary_cnt, 1, __ATOMIC_RELAXED);
|
||||
+
|
||||
+ process_data.eth_dev_cnt--;
|
||||
+ if (process_data.eth_dev_cnt == 0) {
|
||||
+ rte_mp_action_unregister(HNS3_MP_NAME);
|
||||
+ process_data.init_done = false;
|
||||
+ }
|
||||
+}
|
||||
diff --git a/drivers/net/hns3/hns3_mp.h b/drivers/net/hns3/hns3_mp.h
|
||||
index 5738ab74a..a74221d08 100644
|
||||
--- a/drivers/net/hns3/hns3_mp.h
|
||||
+++ b/drivers/net/hns3/hns3_mp.h
|
||||
@@ -10,15 +10,13 @@ struct hns3_process_local_data {
|
||||
bool init_done; /* Process action register completed flag. */
|
||||
int eth_dev_cnt; /* Ethdev count under the current process. */
|
||||
};
|
||||
-extern struct hns3_process_local_data process_data;
|
||||
|
||||
void hns3_mp_req_start_rxtx(struct rte_eth_dev *dev);
|
||||
void hns3_mp_req_stop_rxtx(struct rte_eth_dev *dev);
|
||||
void hns3_mp_req_start_tx(struct rte_eth_dev *dev);
|
||||
void hns3_mp_req_stop_tx(struct rte_eth_dev *dev);
|
||||
|
||||
-int hns3_mp_init_primary(void);
|
||||
-void hns3_mp_uninit(void);
|
||||
-int hns3_mp_init_secondary(void);
|
||||
+int hns3_mp_init(struct rte_eth_dev *dev);
|
||||
+void hns3_mp_uninit(struct rte_eth_dev *dev);
|
||||
|
||||
#endif /* _HNS3_MP_H_ */
|
||||
--
|
||||
2.33.0
|
||||
|
||||
41
0255-usertools-devbind-add-Kunpeng-DMA.patch
Normal file
41
0255-usertools-devbind-add-Kunpeng-DMA.patch
Normal file
@ -0,0 +1,41 @@
|
||||
From 62c1169fb30dd7407c35377364a7da2336ac1c24 Mon Sep 17 00:00:00 2001
|
||||
From: Chengwen Feng <fengchengwen@huawei.com>
|
||||
Date: Tue, 2 Nov 2021 20:37:43 +0800
|
||||
Subject: [PATCH 22/33] usertools/devbind: add Kunpeng DMA
|
||||
|
||||
Add Kunpeng DMA device ID to dmadev category.
|
||||
|
||||
Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
|
||||
---
|
||||
usertools/dpdk-devbind.py | 5 ++++-
|
||||
1 file changed, 4 insertions(+), 1 deletion(-)
|
||||
mode change 100755 => 100644 usertools/dpdk-devbind.py
|
||||
|
||||
diff --git a/usertools/dpdk-devbind.py b/usertools/dpdk-devbind.py
|
||||
old mode 100755
|
||||
new mode 100644
|
||||
index c2ede3d4d..8af3089ae
|
||||
--- a/usertools/dpdk-devbind.py
|
||||
+++ b/usertools/dpdk-devbind.py
|
||||
@@ -45,6 +45,8 @@
|
||||
octeontx2_ree = {'Class': '08', 'Vendor': '177d', 'Device': 'a0f4',
|
||||
'SVendor': None, 'SDevice': None}
|
||||
|
||||
+hisilicon_dma = {'Class': '08', 'Vendor': '19e5', 'Device': 'a122',
|
||||
+ 'SVendor': None, 'SDevice': None}
|
||||
intel_ioat_bdw = {'Class': '08', 'Vendor': '8086',
|
||||
'Device': '6f20,6f21,6f22,6f23,6f24,6f25,6f26,6f27,6f2e,6f2f',
|
||||
'SVendor': None, 'SDevice': None}
|
||||
@@ -62,7 +64,8 @@
|
||||
network_devices = [network_class, cavium_pkx, avp_vnic, ifpga_class]
|
||||
baseband_devices = [acceleration_class]
|
||||
crypto_devices = [encryption_class, intel_processor_class]
|
||||
-eventdev_devices = [cavium_sso, cavium_tim, octeontx2_sso]
|
||||
+dma_devices = [hisilicon_dma]
|
||||
+eventdev_devices = [cavium_sso, cavium_tim, intel_dlb, octeontx2_sso]
|
||||
mempool_devices = [cavium_fpa, octeontx2_npa]
|
||||
compress_devices = [cavium_zip]
|
||||
regex_devices = [octeontx2_ree]
|
||||
--
|
||||
2.33.0
|
||||
|
||||
54
0256-kni-check-error-code-of-allmulticast-mode-switch.patch
Normal file
54
0256-kni-check-error-code-of-allmulticast-mode-switch.patch
Normal file
@ -0,0 +1,54 @@
|
||||
From 72387188c6847df9a88d77c5428604db88441617 Mon Sep 17 00:00:00 2001
|
||||
From: Chengwen Feng <fengchengwen@huawei.com>
|
||||
Date: Fri, 23 Apr 2021 16:12:42 +0800
|
||||
Subject: [PATCH 23/33] kni: check error code of allmulticast mode switch
|
||||
|
||||
Some drivers may return errcode when switch allmulticast mode,
|
||||
so it's necessary to check the return code.
|
||||
|
||||
Fixes: b34801d1aa2e ("kni: support allmulticast mode set")
|
||||
Cc: stable@dpdk.org
|
||||
|
||||
Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
|
||||
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
|
||||
Acked-by: Ferruh Yigit <ferruh.yigit@intel.com>
|
||||
---
|
||||
lib/librte_kni/rte_kni.c | 13 ++++++++++---
|
||||
1 file changed, 10 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/lib/librte_kni/rte_kni.c b/lib/librte_kni/rte_kni.c
|
||||
index 837d0217d..54ea792fc 100644
|
||||
--- a/lib/librte_kni/rte_kni.c
|
||||
+++ b/lib/librte_kni/rte_kni.c
|
||||
@@ -514,6 +514,8 @@ kni_config_promiscusity(uint16_t port_id, uint8_t to_on)
|
||||
static int
|
||||
kni_config_allmulticast(uint16_t port_id, uint8_t to_on)
|
||||
{
|
||||
+ int ret;
|
||||
+
|
||||
if (!rte_eth_dev_is_valid_port(port_id)) {
|
||||
RTE_LOG(ERR, KNI, "Invalid port id %d\n", port_id);
|
||||
return -EINVAL;
|
||||
@@ -523,11 +525,16 @@ kni_config_allmulticast(uint16_t port_id, uint8_t to_on)
|
||||
port_id, to_on);
|
||||
|
||||
if (to_on)
|
||||
- rte_eth_allmulticast_enable(port_id);
|
||||
+ ret = rte_eth_allmulticast_enable(port_id);
|
||||
else
|
||||
- rte_eth_allmulticast_disable(port_id);
|
||||
+ ret = rte_eth_allmulticast_disable(port_id);
|
||||
+ if (ret != 0)
|
||||
+ RTE_LOG(ERR, KNI,
|
||||
+ "Failed to %s allmulticast mode for port %u: %s\n",
|
||||
+ to_on ? "enable" : "disable", port_id,
|
||||
+ rte_strerror(-ret));
|
||||
|
||||
- return 0;
|
||||
+ return ret;
|
||||
}
|
||||
|
||||
int
|
||||
--
|
||||
2.33.0
|
||||
|
||||
42
0257-net-hns3-simplify-queue-DMA-address-arithmetic.patch
Normal file
42
0257-net-hns3-simplify-queue-DMA-address-arithmetic.patch
Normal file
@ -0,0 +1,42 @@
|
||||
From cc6216dd998af8500649b7eeb520af2b80abdb90 Mon Sep 17 00:00:00 2001
|
||||
From: Huisong Li <lihuisong@huawei.com>
|
||||
Date: Sat, 6 Nov 2021 09:42:58 +0800
|
||||
Subject: [PATCH 24/33] net/hns3: simplify queue DMA address arithmetic
|
||||
|
||||
The patch obtains the upper 32 bits of the Rx/Tx queue DMA address in one
|
||||
step instead of two steps.
|
||||
|
||||
Fixes: bba636698316 ("net/hns3: support Rx/Tx and related operations")
|
||||
Cc: stable@dpdk.org
|
||||
|
||||
Signed-off-by: Huisong Li <lihuisong@huawei.com>
|
||||
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
|
||||
---
|
||||
drivers/net/hns3/hns3_rxtx.c | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/drivers/net/hns3/hns3_rxtx.c b/drivers/net/hns3/hns3_rxtx.c
|
||||
index bb1723e29..b63024997 100644
|
||||
--- a/drivers/net/hns3/hns3_rxtx.c
|
||||
+++ b/drivers/net/hns3/hns3_rxtx.c
|
||||
@@ -310,7 +310,7 @@ hns3_init_rx_queue_hw(struct hns3_rx_queue *rxq)
|
||||
|
||||
hns3_write_dev(rxq, HNS3_RING_RX_BASEADDR_L_REG, (uint32_t)dma_addr);
|
||||
hns3_write_dev(rxq, HNS3_RING_RX_BASEADDR_H_REG,
|
||||
- (uint32_t)((dma_addr >> 31) >> 1));
|
||||
+ (uint32_t)(dma_addr >> 32));
|
||||
|
||||
hns3_write_dev(rxq, HNS3_RING_RX_BD_LEN_REG,
|
||||
hns3_buf_size2type(rx_buf_len));
|
||||
@@ -325,7 +325,7 @@ hns3_init_tx_queue_hw(struct hns3_tx_queue *txq)
|
||||
|
||||
hns3_write_dev(txq, HNS3_RING_TX_BASEADDR_L_REG, (uint32_t)dma_addr);
|
||||
hns3_write_dev(txq, HNS3_RING_TX_BASEADDR_H_REG,
|
||||
- (uint32_t)((dma_addr >> 31) >> 1));
|
||||
+ (uint32_t)(dma_addr >> 32));
|
||||
|
||||
hns3_write_dev(txq, HNS3_RING_TX_BD_NUM_REG,
|
||||
HNS3_CFG_DESC_NUM(txq->nb_tx_desc));
|
||||
--
|
||||
2.33.0
|
||||
|
||||
29
0258-net-hns3-remove-redundant-function-declaration.patch
Normal file
29
0258-net-hns3-remove-redundant-function-declaration.patch
Normal file
@ -0,0 +1,29 @@
|
||||
From 0527eaf2489c1657ccf02a9e71f4e684eec5da77 Mon Sep 17 00:00:00 2001
|
||||
From: Huisong Li <lihuisong@huawei.com>
|
||||
Date: Sat, 6 Nov 2021 09:42:59 +0800
|
||||
Subject: [PATCH 25/33] net/hns3: remove redundant function declaration
|
||||
|
||||
This patch removes a redundant function declaration for
|
||||
hns3_rx_check_vec_support().
|
||||
|
||||
Signed-off-by: Huisong Li <lihuisong@huawei.com>
|
||||
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
|
||||
---
|
||||
drivers/net/hns3/hns3_rxtx.h | 1 -
|
||||
1 file changed, 1 deletion(-)
|
||||
|
||||
diff --git a/drivers/net/hns3/hns3_rxtx.h b/drivers/net/hns3/hns3_rxtx.h
|
||||
index cd7c21c1d..4c8b88352 100644
|
||||
--- a/drivers/net/hns3/hns3_rxtx.h
|
||||
+++ b/drivers/net/hns3/hns3_rxtx.h
|
||||
@@ -712,7 +712,6 @@ uint16_t hns3_recv_pkts_vec_sve(void *rx_queue, struct rte_mbuf **rx_pkts,
|
||||
int hns3_rx_burst_mode_get(struct rte_eth_dev *dev,
|
||||
__rte_unused uint16_t queue_id,
|
||||
struct rte_eth_burst_mode *mode);
|
||||
-int hns3_rx_check_vec_support(struct rte_eth_dev *dev);
|
||||
uint16_t hns3_prep_pkts(__rte_unused void *tx_queue, struct rte_mbuf **tx_pkts,
|
||||
uint16_t nb_pkts);
|
||||
uint16_t hns3_xmit_pkts_simple(void *tx_queue, struct rte_mbuf **tx_pkts,
|
||||
--
|
||||
2.33.0
|
||||
|
||||
30
0259-net-hns3-modify-an-indent-alignment.patch
Normal file
30
0259-net-hns3-modify-an-indent-alignment.patch
Normal file
@ -0,0 +1,30 @@
|
||||
From e3b6924c495f721af74a89c001dbb2497dfbcc1d Mon Sep 17 00:00:00 2001
|
||||
From: Huisong Li <lihuisong@huawei.com>
|
||||
Date: Sat, 6 Nov 2021 09:43:00 +0800
|
||||
Subject: [PATCH 26/33] net/hns3: modify an indent alignment
|
||||
|
||||
This patch modifies some code alignment issues to make the code style
|
||||
more consistent.
|
||||
|
||||
Signed-off-by: Huisong Li <lihuisong@huawei.com>
|
||||
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
|
||||
---
|
||||
drivers/net/hns3/hns3_rxtx.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/drivers/net/hns3/hns3_rxtx.c b/drivers/net/hns3/hns3_rxtx.c
|
||||
index b63024997..d5aa72c8f 100644
|
||||
--- a/drivers/net/hns3/hns3_rxtx.c
|
||||
+++ b/drivers/net/hns3/hns3_rxtx.c
|
||||
@@ -1895,7 +1895,7 @@ hns3_rx_queue_setup(struct rte_eth_dev *dev, uint16_t idx, uint16_t nb_desc,
|
||||
*/
|
||||
if (hns->is_vf || hw->vlan_mode == HNS3_SW_SHIFT_AND_DISCARD_MODE)
|
||||
rxq->pvid_sw_discard_en = hw->port_base_vlan_cfg.state ==
|
||||
- HNS3_PORT_BASE_VLAN_ENABLE;
|
||||
+ HNS3_PORT_BASE_VLAN_ENABLE;
|
||||
else
|
||||
rxq->pvid_sw_discard_en = false;
|
||||
rxq->ptype_en = hns3_dev_get_support(hw, RXD_ADV_LAYOUT) ? true : false;
|
||||
--
|
||||
2.33.0
|
||||
|
||||
@ -0,0 +1,39 @@
|
||||
From 36c73d69efda51972d64318ef8cb1c7fefde482f Mon Sep 17 00:00:00 2001
|
||||
From: Huisong Li <lihuisong@huawei.com>
|
||||
Date: Sat, 6 Nov 2021 09:43:01 +0800
|
||||
Subject: [PATCH 27/33] net/hns3: use unsigned integer for bitwise operations
|
||||
|
||||
Bitwise operations should be used only with unsigned integer. This patch
|
||||
modifies some code that does not meet this rule.
|
||||
|
||||
Signed-off-by: Huisong Li <lihuisong@huawei.com>
|
||||
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
|
||||
---
|
||||
drivers/net/hns3/hns3_ethdev.c | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c
|
||||
index ecf912a9f..03f6da5bc 100644
|
||||
--- a/drivers/net/hns3/hns3_ethdev.c
|
||||
+++ b/drivers/net/hns3/hns3_ethdev.c
|
||||
@@ -2104,7 +2104,7 @@ hns3_check_mq_mode(struct rte_eth_dev *dev)
|
||||
int max_tc = 0;
|
||||
int i;
|
||||
|
||||
- if ((rx_mq_mode & ETH_MQ_RX_VMDQ_FLAG) ||
|
||||
+ if (((uint32_t)rx_mq_mode & ETH_MQ_RX_VMDQ_FLAG) ||
|
||||
(tx_mq_mode == ETH_MQ_TX_VMDQ_DCB ||
|
||||
tx_mq_mode == ETH_MQ_TX_VMDQ_ONLY)) {
|
||||
hns3_err(hw, "VMDQ is not supported, rx_mq_mode = %d, tx_mq_mode = %d.",
|
||||
@@ -2114,7 +2114,7 @@ hns3_check_mq_mode(struct rte_eth_dev *dev)
|
||||
|
||||
dcb_rx_conf = &dev->data->dev_conf.rx_adv_conf.dcb_rx_conf;
|
||||
dcb_tx_conf = &dev->data->dev_conf.tx_adv_conf.dcb_tx_conf;
|
||||
- if (rx_mq_mode & ETH_MQ_RX_DCB_FLAG) {
|
||||
+ if ((uint32_t)rx_mq_mode & ETH_MQ_RX_DCB_FLAG) {
|
||||
if (dcb_rx_conf->nb_tcs > pf->tc_max) {
|
||||
hns3_err(hw, "nb_tcs(%u) > max_tc(%u) driver supported.",
|
||||
dcb_rx_conf->nb_tcs, pf->tc_max);
|
||||
--
|
||||
2.33.0
|
||||
|
||||
1143
0261-net-hns3-extract-common-code-to-its-own-file.patch
Normal file
1143
0261-net-hns3-extract-common-code-to-its-own-file.patch
Normal file
File diff suppressed because it is too large
Load Diff
191
0262-net-hns3-move-declarations-in-flow-header-file.patch
Normal file
191
0262-net-hns3-move-declarations-in-flow-header-file.patch
Normal file
@ -0,0 +1,191 @@
|
||||
From f50d0076e2e9dad6e94fcc64108fb52592bf5c00 Mon Sep 17 00:00:00 2001
|
||||
From: "Min Hu (Connor)" <humin29@huawei.com>
|
||||
Date: Sat, 6 Nov 2021 09:43:03 +0800
|
||||
Subject: [PATCH 29/33] net/hns3: move declarations in flow header file
|
||||
|
||||
This patch adds a hns3_flow.h to make the code easier to maintain.
|
||||
|
||||
Signed-off-by: Huisong Li <lihuisong@huawei.com>
|
||||
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
|
||||
---
|
||||
drivers/net/hns3/hns3_ethdev.c | 1 +
|
||||
drivers/net/hns3/hns3_ethdev.h | 1 +
|
||||
drivers/net/hns3/hns3_ethdev_vf.c | 1 +
|
||||
drivers/net/hns3/hns3_fdir.h | 31 ----------------------
|
||||
drivers/net/hns3/hns3_flow.c | 1 +
|
||||
drivers/net/hns3/hns3_flow.h | 44 +++++++++++++++++++++++++++++++
|
||||
6 files changed, 48 insertions(+), 31 deletions(-)
|
||||
create mode 100644 drivers/net/hns3/hns3_flow.h
|
||||
|
||||
diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c
|
||||
index 818835391..5a826c7aa 100644
|
||||
--- a/drivers/net/hns3/hns3_ethdev.c
|
||||
+++ b/drivers/net/hns3/hns3_ethdev.c
|
||||
@@ -15,6 +15,7 @@
|
||||
#include "hns3_regs.h"
|
||||
#include "hns3_dcb.h"
|
||||
#include "hns3_mp.h"
|
||||
+#include "hns3_flow.h"
|
||||
|
||||
#define HNS3_SERVICE_INTERVAL 1000000 /* us */
|
||||
#define HNS3_SERVICE_QUICK_INTERVAL 10
|
||||
diff --git a/drivers/net/hns3/hns3_ethdev.h b/drivers/net/hns3/hns3_ethdev.h
|
||||
index 96671159b..960f781e1 100644
|
||||
--- a/drivers/net/hns3/hns3_ethdev.h
|
||||
+++ b/drivers/net/hns3/hns3_ethdev.h
|
||||
@@ -17,6 +17,7 @@
|
||||
#include "hns3_fdir.h"
|
||||
#include "hns3_stats.h"
|
||||
#include "hns3_tm.h"
|
||||
+#include "hns3_flow.h"
|
||||
|
||||
/* Vendor ID */
|
||||
#define PCI_VENDOR_ID_HUAWEI 0x19e5
|
||||
diff --git a/drivers/net/hns3/hns3_ethdev_vf.c b/drivers/net/hns3/hns3_ethdev_vf.c
|
||||
index c234e74b8..84ae26987 100644
|
||||
--- a/drivers/net/hns3/hns3_ethdev_vf.c
|
||||
+++ b/drivers/net/hns3/hns3_ethdev_vf.c
|
||||
@@ -17,6 +17,7 @@
|
||||
#include "hns3_intr.h"
|
||||
#include "hns3_dcb.h"
|
||||
#include "hns3_mp.h"
|
||||
+#include "hns3_flow.h"
|
||||
|
||||
#define HNS3VF_KEEP_ALIVE_INTERVAL 2000000 /* us */
|
||||
#define HNS3VF_SERVICE_INTERVAL 1000000 /* us */
|
||||
diff --git a/drivers/net/hns3/hns3_fdir.h b/drivers/net/hns3/hns3_fdir.h
|
||||
index 3f610f7b1..f9efff3b5 100644
|
||||
--- a/drivers/net/hns3/hns3_fdir.h
|
||||
+++ b/drivers/net/hns3/hns3_fdir.h
|
||||
@@ -5,8 +5,6 @@
|
||||
#ifndef _HNS3_FDIR_H_
|
||||
#define _HNS3_FDIR_H_
|
||||
|
||||
-#include <rte_flow.h>
|
||||
-
|
||||
struct hns3_fd_key_cfg {
|
||||
uint8_t key_sel;
|
||||
uint8_t inner_sipv6_word_en;
|
||||
@@ -124,14 +122,6 @@ struct hns3_fd_ad_data {
|
||||
uint16_t rule_id;
|
||||
};
|
||||
|
||||
-struct hns3_flow_counter {
|
||||
- LIST_ENTRY(hns3_flow_counter) next; /* Pointer to the next counter. */
|
||||
- uint32_t shared:1; /* Share counter ID with other flow rules. */
|
||||
- uint32_t ref_cnt:31; /* Reference counter. */
|
||||
- uint16_t id; /* Counter ID. */
|
||||
- uint64_t hits; /* Number of packets matched by the rule. */
|
||||
-};
|
||||
-
|
||||
#define HNS3_RULE_FLAG_FDID 0x1
|
||||
#define HNS3_RULE_FLAG_VF_ID 0x2
|
||||
#define HNS3_RULE_FLAG_COUNTER 0x4
|
||||
@@ -173,21 +163,7 @@ struct hns3_fdir_rule_ele {
|
||||
struct hns3_fdir_rule fdir_conf;
|
||||
};
|
||||
|
||||
-/* rss filter list structure */
|
||||
-struct hns3_rss_conf_ele {
|
||||
- TAILQ_ENTRY(hns3_rss_conf_ele) entries;
|
||||
- struct hns3_rss_conf filter_info;
|
||||
-};
|
||||
-
|
||||
-/* hns3_flow memory list structure */
|
||||
-struct hns3_flow_mem {
|
||||
- TAILQ_ENTRY(hns3_flow_mem) entries;
|
||||
- struct rte_flow *flow;
|
||||
-};
|
||||
-
|
||||
TAILQ_HEAD(hns3_fdir_rule_list, hns3_fdir_rule_ele);
|
||||
-TAILQ_HEAD(hns3_rss_filter_list, hns3_rss_conf_ele);
|
||||
-TAILQ_HEAD(hns3_flow_mem_list, hns3_flow_mem);
|
||||
|
||||
/*
|
||||
* A structure used to define fields of a FDIR related info.
|
||||
@@ -199,11 +175,6 @@ struct hns3_fdir_info {
|
||||
struct hns3_fd_cfg fd_cfg;
|
||||
};
|
||||
|
||||
-struct rte_flow {
|
||||
- enum rte_filter_type filter_type;
|
||||
- void *rule;
|
||||
- uint32_t counter_id;
|
||||
-};
|
||||
struct hns3_adapter;
|
||||
|
||||
int hns3_init_fd_config(struct hns3_adapter *hns);
|
||||
@@ -213,8 +184,6 @@ int hns3_fdir_filter_program(struct hns3_adapter *hns,
|
||||
struct hns3_fdir_rule *rule, bool del);
|
||||
int hns3_clear_all_fdir_filter(struct hns3_adapter *hns);
|
||||
int hns3_get_count(struct hns3_hw *hw, uint32_t id, uint64_t *value);
|
||||
-void hns3_flow_init(struct rte_eth_dev *dev);
|
||||
-void hns3_flow_uninit(struct rte_eth_dev *dev);
|
||||
int hns3_restore_all_fdir_filter(struct hns3_adapter *hns);
|
||||
|
||||
#endif /* _HNS3_FDIR_H_ */
|
||||
diff --git a/drivers/net/hns3/hns3_flow.c b/drivers/net/hns3/hns3_flow.c
|
||||
index b25fccbca..73ef91ce9 100644
|
||||
--- a/drivers/net/hns3/hns3_flow.c
|
||||
+++ b/drivers/net/hns3/hns3_flow.c
|
||||
@@ -8,6 +8,7 @@
|
||||
|
||||
#include "hns3_ethdev.h"
|
||||
#include "hns3_logs.h"
|
||||
+#include "hns3_flow.h"
|
||||
|
||||
/* Default default keys */
|
||||
static uint8_t hns3_hash_key[] = {
|
||||
diff --git a/drivers/net/hns3/hns3_flow.h b/drivers/net/hns3/hns3_flow.h
|
||||
new file mode 100644
|
||||
index 000000000..2eb451b72
|
||||
--- /dev/null
|
||||
+++ b/drivers/net/hns3/hns3_flow.h
|
||||
@@ -0,0 +1,44 @@
|
||||
+/* SPDX-License-Identifier: BSD-3-Clause
|
||||
+ * Copyright(C) 2021 HiSilicon Limited
|
||||
+ */
|
||||
+
|
||||
+#ifndef _HNS3_FLOW_H_
|
||||
+#define _HNS3_FLOW_H_
|
||||
+
|
||||
+#include <rte_flow.h>
|
||||
+
|
||||
+struct hns3_flow_counter {
|
||||
+ LIST_ENTRY(hns3_flow_counter) next; /* Pointer to the next counter. */
|
||||
+ uint32_t shared:1; /* Share counter ID with other flow rules. */
|
||||
+ uint32_t ref_cnt:31; /* Reference counter. */
|
||||
+ uint16_t id; /* Counter ID. */
|
||||
+ uint64_t hits; /* Number of packets matched by the rule. */
|
||||
+};
|
||||
+
|
||||
+struct rte_flow {
|
||||
+ enum rte_filter_type filter_type;
|
||||
+ void *rule;
|
||||
+ uint32_t counter_id;
|
||||
+};
|
||||
+
|
||||
+/* rss filter list structure */
|
||||
+struct hns3_rss_conf_ele {
|
||||
+ TAILQ_ENTRY(hns3_rss_conf_ele) entries;
|
||||
+ struct hns3_rss_conf filter_info;
|
||||
+};
|
||||
+
|
||||
+/* hns3_flow memory list structure */
|
||||
+struct hns3_flow_mem {
|
||||
+ TAILQ_ENTRY(hns3_flow_mem) entries;
|
||||
+ struct rte_flow *flow;
|
||||
+};
|
||||
+
|
||||
+TAILQ_HEAD(hns3_rss_filter_list, hns3_rss_conf_ele);
|
||||
+TAILQ_HEAD(hns3_flow_mem_list, hns3_flow_mem);
|
||||
+
|
||||
+int hns3_dev_flow_ops_get(struct rte_eth_dev *dev,
|
||||
+ const struct rte_flow_ops **ops);
|
||||
+void hns3_flow_init(struct rte_eth_dev *dev);
|
||||
+void hns3_flow_uninit(struct rte_eth_dev *dev);
|
||||
+
|
||||
+#endif /* _HNS3_FLOW_H_ */
|
||||
--
|
||||
2.33.0
|
||||
|
||||
53
0263-net-hns3-remove-magic-numbers.patch
Normal file
53
0263-net-hns3-remove-magic-numbers.patch
Normal file
@ -0,0 +1,53 @@
|
||||
From b96b2ca6d5b510d372137ef4b3ef66b762434c92 Mon Sep 17 00:00:00 2001
|
||||
From: Huisong Li <lihuisong@huawei.com>
|
||||
Date: Sat, 6 Nov 2021 09:43:04 +0800
|
||||
Subject: [PATCH 30/33] net/hns3: remove magic numbers
|
||||
|
||||
Removing magic numbers with macros.
|
||||
|
||||
Signed-off-by: Huisong Li <lihuisong@huawei.com>
|
||||
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
|
||||
---
|
||||
drivers/net/hns3/hns3_common.c | 4 ++--
|
||||
drivers/net/hns3/hns3_common.h | 3 +++
|
||||
2 files changed, 5 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/drivers/net/hns3/hns3_common.c b/drivers/net/hns3/hns3_common.c
|
||||
index 85316d342..c306e0b0e 100644
|
||||
--- a/drivers/net/hns3/hns3_common.c
|
||||
+++ b/drivers/net/hns3/hns3_common.c
|
||||
@@ -54,7 +54,7 @@ hns3_parse_dev_caps_mask(const char *key, const char *value, void *extra_args)
|
||||
|
||||
RTE_SET_USED(key);
|
||||
|
||||
- val = strtoull(value, NULL, 16);
|
||||
+ val = strtoull(value, NULL, HNS3_CONVERT_TO_HEXADECIMAL);
|
||||
*(uint64_t *)extra_args = val;
|
||||
|
||||
return 0;
|
||||
@@ -67,7 +67,7 @@ hns3_parse_mbx_time_limit(const char *key, const char *value, void *extra_args)
|
||||
|
||||
RTE_SET_USED(key);
|
||||
|
||||
- val = strtoul(value, NULL, 10);
|
||||
+ val = strtoul(value, NULL, HNS3_CONVERT_TO_DECIMAL);
|
||||
if (val > HNS3_MBX_DEF_TIME_LIMIT_MS && val <= UINT16_MAX)
|
||||
*(uint16_t *)extra_args = val;
|
||||
|
||||
diff --git a/drivers/net/hns3/hns3_common.h b/drivers/net/hns3/hns3_common.h
|
||||
index 094a0bc5f..68f9b1b96 100644
|
||||
--- a/drivers/net/hns3/hns3_common.h
|
||||
+++ b/drivers/net/hns3/hns3_common.h
|
||||
@@ -9,6 +9,9 @@
|
||||
|
||||
#include "hns3_ethdev.h"
|
||||
|
||||
+#define HNS3_CONVERT_TO_DECIMAL 10
|
||||
+#define HNS3_CONVERT_TO_HEXADECIMAL 16
|
||||
+
|
||||
enum {
|
||||
HNS3_IO_FUNC_HINT_NONE = 0,
|
||||
HNS3_IO_FUNC_HINT_VEC,
|
||||
--
|
||||
2.33.0
|
||||
|
||||
38
0264-net-hns3-mark-unchecked-return-of-snprintf.patch
Normal file
38
0264-net-hns3-mark-unchecked-return-of-snprintf.patch
Normal file
@ -0,0 +1,38 @@
|
||||
From dee0abb3ec0a868c1f213165bd88c7a26c4ee253 Mon Sep 17 00:00:00 2001
|
||||
From: Huisong Li <lihuisong@huawei.com>
|
||||
Date: Sat, 6 Nov 2021 09:43:05 +0800
|
||||
Subject: [PATCH 31/33] net/hns3: mark unchecked return of snprintf
|
||||
|
||||
Fixing the return value of the function to clear static warning.
|
||||
|
||||
Fixes: 1181500b2fc5 ("net/hns3: adjust MAC address logging")
|
||||
Cc: stable@dpdk.org
|
||||
|
||||
Signed-off-by: Huisong Li <lihuisong@huawei.com>
|
||||
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
|
||||
---
|
||||
drivers/net/hns3/hns3_common.c | 8 ++++----
|
||||
1 file changed, 4 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/drivers/net/hns3/hns3_common.c b/drivers/net/hns3/hns3_common.c
|
||||
index c306e0b0e..9a47fbfbd 100644
|
||||
--- a/drivers/net/hns3/hns3_common.c
|
||||
+++ b/drivers/net/hns3/hns3_common.c
|
||||
@@ -154,10 +154,10 @@ hns3_clock_gettime_ms(void)
|
||||
void hns3_ether_format_addr(char *buf, uint16_t size,
|
||||
const struct rte_ether_addr *ether_addr)
|
||||
{
|
||||
- snprintf(buf, size, "%02X:**:**:**:%02X:%02X",
|
||||
- ether_addr->addr_bytes[0],
|
||||
- ether_addr->addr_bytes[4],
|
||||
- ether_addr->addr_bytes[5]);
|
||||
+ (void)snprintf(buf, size, "%02X:**:**:**:%02X:%02X",
|
||||
+ ether_addr->addr_bytes[0],
|
||||
+ ether_addr->addr_bytes[4],
|
||||
+ ether_addr->addr_bytes[5]);
|
||||
}
|
||||
|
||||
static int
|
||||
--
|
||||
2.33.0
|
||||
|
||||
1256
0265-net-hns3-remove-PF-VF-duplicate-code.patch
Normal file
1256
0265-net-hns3-remove-PF-VF-duplicate-code.patch
Normal file
File diff suppressed because it is too large
Load Diff
252
0266-app-testpmd-remove-unused-header-file.patch
Normal file
252
0266-app-testpmd-remove-unused-header-file.patch
Normal file
@ -0,0 +1,252 @@
|
||||
From 11bcfb49be7f092d8d20d88dfdc5358196d3ecca Mon Sep 17 00:00:00 2001
|
||||
From: Huisong Li <lihuisong@huawei.com>
|
||||
Date: Mon, 25 Oct 2021 14:39:22 +0800
|
||||
Subject: [PATCH 33/33] app/testpmd: remove unused header file
|
||||
|
||||
This patch removes unused "rte_eth_bond.h" header file.
|
||||
|
||||
Fixes: 2950a769315e ("bond: testpmd support")
|
||||
Cc: stable@dpdk.org
|
||||
|
||||
Signed-off-by: Huisong Li <lihuisong@huawei.com>
|
||||
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
|
||||
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
|
||||
---
|
||||
app/test-pmd/parameters.c | 3 -
|
||||
drivers/net/hns3/hns3_common.c | 101 +++++++++++++++++----------------
|
||||
drivers/net/hns3/hns3_flow.h | 5 +-
|
||||
3 files changed, 55 insertions(+), 54 deletions(-)
|
||||
|
||||
diff --git a/app/test-pmd/parameters.c b/app/test-pmd/parameters.c
|
||||
index c464c42f6..2a69df5b7 100644
|
||||
--- a/app/test-pmd/parameters.c
|
||||
+++ b/app/test-pmd/parameters.c
|
||||
@@ -39,9 +39,6 @@
|
||||
#include <rte_ether.h>
|
||||
#include <rte_ethdev.h>
|
||||
#include <rte_string_fns.h>
|
||||
-#ifdef RTE_NET_BOND
|
||||
-#include <rte_eth_bond.h>
|
||||
-#endif
|
||||
#include <rte_flow.h>
|
||||
|
||||
#include "testpmd.h"
|
||||
diff --git a/drivers/net/hns3/hns3_common.c b/drivers/net/hns3/hns3_common.c
|
||||
index eac2aa104..0328f2beb 100644
|
||||
--- a/drivers/net/hns3/hns3_common.c
|
||||
+++ b/drivers/net/hns3/hns3_common.c
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
#include <rte_kvargs.h>
|
||||
#include <rte_bus_pci.h>
|
||||
-#include <ethdev_pci.h>
|
||||
+#include <rte_ethdev_pci.h>
|
||||
#include <rte_pci.h>
|
||||
|
||||
#include "hns3_common.h"
|
||||
@@ -60,43 +60,42 @@ hns3_dev_infos_get(struct rte_eth_dev *eth_dev, struct rte_eth_dev_info *info)
|
||||
info->min_rx_bufsize = HNS3_MIN_BD_BUF_SIZE;
|
||||
info->max_mtu = info->max_rx_pktlen - HNS3_ETH_OVERHEAD;
|
||||
info->max_lro_pkt_size = HNS3_MAX_LRO_SIZE;
|
||||
- info->rx_offload_capa = (RTE_ETH_RX_OFFLOAD_IPV4_CKSUM |
|
||||
- RTE_ETH_RX_OFFLOAD_TCP_CKSUM |
|
||||
- RTE_ETH_RX_OFFLOAD_UDP_CKSUM |
|
||||
- RTE_ETH_RX_OFFLOAD_SCTP_CKSUM |
|
||||
- RTE_ETH_RX_OFFLOAD_OUTER_IPV4_CKSUM |
|
||||
- RTE_ETH_RX_OFFLOAD_OUTER_UDP_CKSUM |
|
||||
- RTE_ETH_RX_OFFLOAD_SCATTER |
|
||||
- RTE_ETH_RX_OFFLOAD_VLAN_STRIP |
|
||||
- RTE_ETH_RX_OFFLOAD_VLAN_FILTER |
|
||||
- RTE_ETH_RX_OFFLOAD_RSS_HASH |
|
||||
- RTE_ETH_RX_OFFLOAD_TCP_LRO);
|
||||
- info->tx_offload_capa = (RTE_ETH_TX_OFFLOAD_OUTER_IPV4_CKSUM |
|
||||
- RTE_ETH_TX_OFFLOAD_IPV4_CKSUM |
|
||||
- RTE_ETH_TX_OFFLOAD_TCP_CKSUM |
|
||||
- RTE_ETH_TX_OFFLOAD_UDP_CKSUM |
|
||||
- RTE_ETH_TX_OFFLOAD_SCTP_CKSUM |
|
||||
- RTE_ETH_TX_OFFLOAD_MULTI_SEGS |
|
||||
- RTE_ETH_TX_OFFLOAD_TCP_TSO |
|
||||
- RTE_ETH_TX_OFFLOAD_VXLAN_TNL_TSO |
|
||||
- RTE_ETH_TX_OFFLOAD_GRE_TNL_TSO |
|
||||
- RTE_ETH_TX_OFFLOAD_GENEVE_TNL_TSO |
|
||||
- RTE_ETH_TX_OFFLOAD_MBUF_FAST_FREE |
|
||||
- RTE_ETH_TX_OFFLOAD_VLAN_INSERT);
|
||||
+ info->rx_offload_capa = (DEV_RX_OFFLOAD_IPV4_CKSUM |
|
||||
+ DEV_RX_OFFLOAD_TCP_CKSUM |
|
||||
+ DEV_RX_OFFLOAD_UDP_CKSUM |
|
||||
+ DEV_RX_OFFLOAD_SCTP_CKSUM |
|
||||
+ DEV_RX_OFFLOAD_OUTER_IPV4_CKSUM |
|
||||
+ DEV_RX_OFFLOAD_OUTER_UDP_CKSUM |
|
||||
+ DEV_RX_OFFLOAD_SCATTER |
|
||||
+ DEV_RX_OFFLOAD_VLAN_STRIP |
|
||||
+ DEV_RX_OFFLOAD_VLAN_FILTER |
|
||||
+ DEV_RX_OFFLOAD_RSS_HASH |
|
||||
+ DEV_RX_OFFLOAD_TCP_LRO);
|
||||
+ info->tx_offload_capa = (DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM |
|
||||
+ DEV_TX_OFFLOAD_IPV4_CKSUM |
|
||||
+ DEV_TX_OFFLOAD_TCP_CKSUM |
|
||||
+ DEV_TX_OFFLOAD_UDP_CKSUM |
|
||||
+ DEV_TX_OFFLOAD_SCTP_CKSUM |
|
||||
+ DEV_TX_OFFLOAD_MULTI_SEGS |
|
||||
+ DEV_TX_OFFLOAD_TCP_TSO |
|
||||
+ DEV_TX_OFFLOAD_VXLAN_TNL_TSO |
|
||||
+ DEV_TX_OFFLOAD_GRE_TNL_TSO |
|
||||
+ DEV_TX_OFFLOAD_GENEVE_TNL_TSO |
|
||||
+ DEV_TX_OFFLOAD_MBUF_FAST_FREE |
|
||||
+ DEV_TX_OFFLOAD_VLAN_INSERT);
|
||||
|
||||
if (!hw->port_base_vlan_cfg.state)
|
||||
- info->tx_offload_capa |= RTE_ETH_TX_OFFLOAD_QINQ_INSERT;
|
||||
+ info->tx_offload_capa |= DEV_TX_OFFLOAD_QINQ_INSERT;
|
||||
|
||||
if (hns3_dev_get_support(hw, OUTER_UDP_CKSUM))
|
||||
- info->tx_offload_capa |= RTE_ETH_TX_OFFLOAD_OUTER_UDP_CKSUM;
|
||||
+ info->tx_offload_capa |= DEV_TX_OFFLOAD_OUTER_UDP_CKSUM;
|
||||
|
||||
if (hns3_dev_get_support(hw, INDEP_TXRX))
|
||||
info->dev_capa = RTE_ETH_DEV_CAPA_RUNTIME_RX_QUEUE_SETUP |
|
||||
RTE_ETH_DEV_CAPA_RUNTIME_TX_QUEUE_SETUP;
|
||||
- info->dev_capa &= ~RTE_ETH_DEV_CAPA_FLOW_RULE_KEEP;
|
||||
|
||||
if (hns3_dev_get_support(hw, PTP))
|
||||
- info->rx_offload_capa |= RTE_ETH_RX_OFFLOAD_TIMESTAMP;
|
||||
+ info->rx_offload_capa |= DEV_RX_OFFLOAD_TIMESTAMP;
|
||||
|
||||
info->rx_desc_lim = (struct rte_eth_desc_lim) {
|
||||
.nb_max = HNS3_MAX_RING_DESC,
|
||||
@@ -143,7 +142,7 @@ hns3_dev_infos_get(struct rte_eth_dev *eth_dev, struct rte_eth_dev_info *info)
|
||||
*/
|
||||
if (!hns->is_vf) {
|
||||
info->max_mac_addrs = HNS3_UC_MACADDR_NUM;
|
||||
- info->rx_offload_capa |= RTE_ETH_RX_OFFLOAD_KEEP_CRC;
|
||||
+ info->rx_offload_capa |= DEV_RX_OFFLOAD_KEEP_CRC;
|
||||
info->speed_capa = hns3_get_speed_capa(hw);
|
||||
} else {
|
||||
info->max_mac_addrs = HNS3_VF_UC_MACADDR_NUM;
|
||||
@@ -641,7 +640,7 @@ int
|
||||
hns3_map_rx_interrupt(struct rte_eth_dev *dev)
|
||||
{
|
||||
struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
|
||||
- struct rte_intr_handle *intr_handle = pci_dev->intr_handle;
|
||||
+ struct rte_intr_handle *intr_handle = &pci_dev->intr_handle;
|
||||
struct hns3_hw *hw = HNS3_DEV_PRIVATE_TO_HW(dev->data->dev_private);
|
||||
uint16_t base = RTE_INTR_VEC_ZERO_OFFSET;
|
||||
uint16_t vec = RTE_INTR_VEC_ZERO_OFFSET;
|
||||
@@ -664,13 +663,16 @@ hns3_map_rx_interrupt(struct rte_eth_dev *dev)
|
||||
if (rte_intr_efd_enable(intr_handle, intr_vector))
|
||||
return -EINVAL;
|
||||
|
||||
- /* Allocate vector list */
|
||||
- if (rte_intr_vec_list_alloc(intr_handle, "intr_vec",
|
||||
- hw->used_rx_queues)) {
|
||||
- hns3_err(hw, "failed to allocate %u rx_queues intr_vec",
|
||||
- hw->used_rx_queues);
|
||||
- ret = -ENOMEM;
|
||||
- goto alloc_intr_vec_error;
|
||||
+ if (intr_handle->intr_vec == NULL) {
|
||||
+ intr_handle->intr_vec =
|
||||
+ rte_zmalloc("intr_vec",
|
||||
+ hw->used_rx_queues * sizeof(int), 0);
|
||||
+ if (intr_handle->intr_vec == NULL) {
|
||||
+ hns3_err(hw, "failed to allocate %u rx_queues intr_vec",
|
||||
+ hw->used_rx_queues);
|
||||
+ ret = -ENOMEM;
|
||||
+ goto alloc_intr_vec_error;
|
||||
+ }
|
||||
}
|
||||
|
||||
if (rte_intr_allow_others(intr_handle)) {
|
||||
@@ -683,21 +685,20 @@ hns3_map_rx_interrupt(struct rte_eth_dev *dev)
|
||||
HNS3_RING_TYPE_RX, q_id);
|
||||
if (ret)
|
||||
goto bind_vector_error;
|
||||
-
|
||||
- if (rte_intr_vec_list_index_set(intr_handle, q_id, vec))
|
||||
- goto bind_vector_error;
|
||||
+ intr_handle->intr_vec[q_id] = vec;
|
||||
/*
|
||||
* If there are not enough efds (e.g. not enough interrupt),
|
||||
* remaining queues will be bond to the last interrupt.
|
||||
*/
|
||||
- if (vec < base + rte_intr_nb_efd_get(intr_handle) - 1)
|
||||
+ if (vec < base + intr_handle->nb_efd - 1)
|
||||
vec++;
|
||||
}
|
||||
rte_intr_enable(intr_handle);
|
||||
return 0;
|
||||
|
||||
bind_vector_error:
|
||||
- rte_intr_vec_list_free(intr_handle);
|
||||
+ rte_free(intr_handle->intr_vec);
|
||||
+ intr_handle->intr_vec = NULL;
|
||||
alloc_intr_vec_error:
|
||||
rte_intr_efd_disable(intr_handle);
|
||||
return ret;
|
||||
@@ -707,7 +708,7 @@ void
|
||||
hns3_unmap_rx_interrupt(struct rte_eth_dev *dev)
|
||||
{
|
||||
struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
|
||||
- struct rte_intr_handle *intr_handle = pci_dev->intr_handle;
|
||||
+ struct rte_intr_handle *intr_handle = &pci_dev->intr_handle;
|
||||
struct hns3_adapter *hns = dev->data->dev_private;
|
||||
struct hns3_hw *hw = &hns->hw;
|
||||
uint8_t base = RTE_INTR_VEC_ZERO_OFFSET;
|
||||
@@ -727,13 +728,16 @@ hns3_unmap_rx_interrupt(struct rte_eth_dev *dev)
|
||||
(void)hw->ops.bind_ring_with_vector(hw, vec, false,
|
||||
HNS3_RING_TYPE_RX,
|
||||
q_id);
|
||||
- if (vec < base + rte_intr_nb_efd_get(intr_handle) - 1)
|
||||
+ if (vec < base + intr_handle->nb_efd - 1)
|
||||
vec++;
|
||||
}
|
||||
}
|
||||
/* Clean datapath event and queue/vec mapping */
|
||||
rte_intr_efd_disable(intr_handle);
|
||||
- rte_intr_vec_list_free(intr_handle);
|
||||
+ if (intr_handle->intr_vec) {
|
||||
+ rte_free(intr_handle->intr_vec);
|
||||
+ intr_handle->intr_vec = NULL;
|
||||
+ }
|
||||
}
|
||||
|
||||
int
|
||||
@@ -741,7 +745,7 @@ hns3_restore_rx_interrupt(struct hns3_hw *hw)
|
||||
{
|
||||
struct rte_eth_dev *dev = &rte_eth_devices[hw->data->port_id];
|
||||
struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
|
||||
- struct rte_intr_handle *intr_handle = pci_dev->intr_handle;
|
||||
+ struct rte_intr_handle *intr_handle = &pci_dev->intr_handle;
|
||||
uint16_t q_id;
|
||||
int ret;
|
||||
|
||||
@@ -751,9 +755,8 @@ hns3_restore_rx_interrupt(struct hns3_hw *hw)
|
||||
if (rte_intr_dp_is_en(intr_handle)) {
|
||||
for (q_id = 0; q_id < hw->used_rx_queues; q_id++) {
|
||||
ret = hw->ops.bind_ring_with_vector(hw,
|
||||
- rte_intr_vec_list_index_get(intr_handle,
|
||||
- q_id),
|
||||
- true, HNS3_RING_TYPE_RX, q_id);
|
||||
+ intr_handle->intr_vec[q_id], true,
|
||||
+ HNS3_RING_TYPE_RX, q_id);
|
||||
if (ret)
|
||||
return ret;
|
||||
}
|
||||
diff --git a/drivers/net/hns3/hns3_flow.h b/drivers/net/hns3/hns3_flow.h
|
||||
index 2eb451b72..d679e5928 100644
|
||||
--- a/drivers/net/hns3/hns3_flow.h
|
||||
+++ b/drivers/net/hns3/hns3_flow.h
|
||||
@@ -36,8 +36,9 @@ struct hns3_flow_mem {
|
||||
TAILQ_HEAD(hns3_rss_filter_list, hns3_rss_conf_ele);
|
||||
TAILQ_HEAD(hns3_flow_mem_list, hns3_flow_mem);
|
||||
|
||||
-int hns3_dev_flow_ops_get(struct rte_eth_dev *dev,
|
||||
- const struct rte_flow_ops **ops);
|
||||
+int hns3_dev_filter_ctrl(struct rte_eth_dev *dev,
|
||||
+ enum rte_filter_type filter_type,
|
||||
+ enum rte_filter_op filter_op, void *arg);
|
||||
void hns3_flow_init(struct rte_eth_dev *dev);
|
||||
void hns3_flow_uninit(struct rte_eth_dev *dev);
|
||||
|
||||
--
|
||||
2.33.0
|
||||
|
||||
31
0267-usertools-add-Intel-DLB-device-binding.patch
Normal file
31
0267-usertools-add-Intel-DLB-device-binding.patch
Normal file
@ -0,0 +1,31 @@
|
||||
From dfbf3715354e41c8751972d2bcb04a8f5a6961dd Mon Sep 17 00:00:00 2001
|
||||
From: speech_white <humin29@huawei.com>
|
||||
Date: Fri, 10 Dec 2021 09:20:28 +0800
|
||||
Subject: [PATCH] usertools: add Intel DLB device binding
|
||||
|
||||
Fix execution failure to add DLB to usertools/dpdk-devbind.py
|
||||
|
||||
Signed-off-by: speech_white <humin29@huawei.com>
|
||||
---
|
||||
usertools/dpdk-devbind.py | 2 ++
|
||||
1 file changed, 2 insertions(+)
|
||||
mode change 100644 => 100755 usertools/dpdk-devbind.py
|
||||
|
||||
diff --git a/usertools/dpdk-devbind.py b/usertools/dpdk-devbind.py
|
||||
old mode 100644
|
||||
new mode 100755
|
||||
index 8af3089ae..9b063dae9
|
||||
--- a/usertools/dpdk-devbind.py
|
||||
+++ b/usertools/dpdk-devbind.py
|
||||
@@ -47,6 +47,8 @@
|
||||
|
||||
hisilicon_dma = {'Class': '08', 'Vendor': '19e5', 'Device': 'a122',
|
||||
'SVendor': None, 'SDevice': None}
|
||||
+intel_dlb = {'Class': '0b', 'Vendor': '8086', 'Device': '270b,2710,2714',
|
||||
+ 'SVendor': None, 'SDevice': None}
|
||||
intel_ioat_bdw = {'Class': '08', 'Vendor': '8086',
|
||||
'Device': '6f20,6f21,6f22,6f23,6f24,6f25,6f26,6f27,6f2e,6f2f',
|
||||
'SVendor': None, 'SDevice': None}
|
||||
--
|
||||
2.23.0
|
||||
|
||||
63
dpdk.spec
63
dpdk.spec
@ -1,6 +1,6 @@
|
||||
Name: dpdk
|
||||
Version: 20.11
|
||||
Release: 9
|
||||
Release: 10
|
||||
Packager: packaging@6wind.com
|
||||
URL: http://dpdk.org
|
||||
%global source_version 20.11
|
||||
@ -221,6 +221,59 @@ Patch211: 0211-net-hns3-disable-PFC-if-not-configured.patch
|
||||
Patch212: 0212-net-hns3-use-the-correct-HiSilicon-copyright.patch
|
||||
Patch213: 0213-app-testpmd-change-port-link-speed-without-stopping-.patch
|
||||
Patch214: 0214-ethdev-add-dev-configured-flag.patch
|
||||
Patch215: 0215-net-hns3-add-start-stop-Tx-datapath-request-for-MP.patch
|
||||
Patch216: 0216-net-hns3-support-set-link-up-down-for-PF.patch
|
||||
Patch217: 0217-net-hns3-fix-queue-flow-action-validation.patch
|
||||
Patch218: 0218-net-hns3-fix-taskqueue-pair-reset-command.patch
|
||||
Patch219: 0219-net-hns3-fix-Tx-push-capability.patch
|
||||
Patch220: 0220-examples-kni-close-port-before-exit.patch
|
||||
Patch221: 0221-net-hns3-fix-residual-MAC-after-setting-default-MAC.patch
|
||||
Patch222: 0222-net-hns3-fix-input-parameters-of-MAC-functions.patch
|
||||
Patch223: 0223-net-bonding-fix-dedicated-queue-mode-in-vector-burst.patch
|
||||
Patch224: 0224-net-bonding-fix-RSS-key-length.patch
|
||||
Patch225: 0225-app-testpmd-add-command-to-show-LACP-bonding-info.patch
|
||||
Patch226: 0226-app-testpmd-retain-all-original-dev-conf-when-config.patch
|
||||
Patch227: 0227-net-hns3-remove-similar-macro-function-definitions.patch
|
||||
Patch228: 0228-net-hns3-fix-interrupt-vector-freeing.patch
|
||||
Patch229: 0229-net-hns3-add-runtime-config-for-mailbox-limit-time.patch
|
||||
Patch230: 0230-net-hns3-fix-mailbox-communication-with-HW.patch
|
||||
Patch231: 0231-app-testpmd-support-multi-process.patch
|
||||
Patch232: 0232-app-testpmd-fix-key-for-RSS-flow-rule.patch
|
||||
Patch233: 0233-app-testpmd-release-flows-left-before-port-stop.patch
|
||||
Patch234: 0234-app-testpmd-delete-unused-function.patch
|
||||
Patch235: 0235-dmadev-introduce-DMA-device-support.patch
|
||||
Patch236: 0236-net-hns3-rename-multicast-address-function.patch
|
||||
Patch237: 0237-net-hns3-rename-unicast-address-function.patch
|
||||
Patch238: 0238-net-hns3-rename-multicast-address-removal-function.patch
|
||||
Patch239: 0239-net-hns3-extract-common-interface-to-check-duplicate.patch
|
||||
Patch240: 0240-net-hns3-remove-redundant-multicast-MAC-interface.patch
|
||||
Patch241: 0241-net-hns3-rename-unicast-address-removal-function.patch
|
||||
Patch242: 0242-net-hns3-remove-redundant-multicast-removal-interfac.patch
|
||||
Patch243: 0243-net-hns3-add-HW-ops-structure-to-operate-hardware.patch
|
||||
Patch244: 0244-net-hns3-use-HW-ops-to-config-MAC-features.patch
|
||||
Patch245: 0245-net-hns3-unify-MAC-and-multicast-address-configurati.patch
|
||||
Patch246: 0246-net-hns3-unify-MAC-address-add-and-remove.patch
|
||||
Patch247: 0247-net-hns3-unify-multicast-address-check.patch
|
||||
Patch248: 0248-net-hns3-refactor-multicast-MAC-address-set-for-PF.patch
|
||||
Patch249: 0249-net-hns3-unify-multicast-MAC-address-set-list.patch
|
||||
Patch250: 0250-bonding-show-Tx-policy-for-802.3AD-mode.patch
|
||||
Patch251: 0251-net-hns3-fix-secondary-process-reference-count.patch
|
||||
Patch252: 0252-net-hns3-fix-multi-process-action-register-and-unreg.patch
|
||||
Patch253: 0253-net-hns3-unregister-MP-action-on-close-for-secondary.patch
|
||||
Patch254: 0254-net-hns3-refactor-multi-process-initialization.patch
|
||||
Patch255: 0255-usertools-devbind-add-Kunpeng-DMA.patch
|
||||
Patch256: 0256-kni-check-error-code-of-allmulticast-mode-switch.patch
|
||||
Patch257: 0257-net-hns3-simplify-queue-DMA-address-arithmetic.patch
|
||||
Patch258: 0258-net-hns3-remove-redundant-function-declaration.patch
|
||||
Patch259: 0259-net-hns3-modify-an-indent-alignment.patch
|
||||
Patch260: 0260-net-hns3-use-unsigned-integer-for-bitwise-operations.patch
|
||||
Patch261: 0261-net-hns3-extract-common-code-to-its-own-file.patch
|
||||
Patch262: 0262-net-hns3-move-declarations-in-flow-header-file.patch
|
||||
Patch263: 0263-net-hns3-remove-magic-numbers.patch
|
||||
Patch264: 0264-net-hns3-mark-unchecked-return-of-snprintf.patch
|
||||
Patch265: 0265-net-hns3-remove-PF-VF-duplicate-code.patch
|
||||
Patch266: 0266-app-testpmd-remove-unused-header-file.patch
|
||||
Patch267: 0267-usertools-add-Intel-DLB-device-binding.patch
|
||||
|
||||
Summary: Data Plane Development Kit core
|
||||
Group: System Environment/Libraries
|
||||
@ -239,7 +292,8 @@ BuildRequires: meson ninja-build gcc
|
||||
BuildRequires: kernel-devel numactl-devel
|
||||
BuildRequires: libpcap libpcap-devel
|
||||
BuildRequires: uname-build-checks
|
||||
BuildRequires: doxygen python3-sphinx chrpath
|
||||
BuildRequires: chrpath
|
||||
BuildRequires: groff-base
|
||||
|
||||
%define kern_devel_ver %(uname -r)
|
||||
|
||||
@ -275,7 +329,7 @@ This package contains the pdump tool for capture the dpdk network packets.
|
||||
|
||||
%build
|
||||
export CFLAGS="%{optflags}"
|
||||
meson %{target} -Ddisable_drivers=*/octeontx2 -Ddisable_drivers=*/fpga* -Ddisable_drivers=*/ifpga* -Denable_kmods=true -Denable_docs=true
|
||||
meson %{target} -Ddisable_drivers=*/octeontx2 -Ddisable_drivers=*/fpga* -Ddisable_drivers=*/ifpga* -Denable_kmods=true
|
||||
ninja -C %{target}
|
||||
|
||||
%install
|
||||
@ -345,7 +399,6 @@ strip -g $RPM_BUILD_ROOT/lib/modules/${namer}/extra/dpdk/rte_kni.ko
|
||||
/usr/share/dpdk/%{target}/lib/*
|
||||
|
||||
%files doc
|
||||
/usr/local/share/doc/*
|
||||
|
||||
%files tools
|
||||
/usr/bin/dpdk-pdump
|
||||
@ -359,6 +412,8 @@ strip -g $RPM_BUILD_ROOT/lib/modules/${namer}/extra/dpdk/rte_kni.ko
|
||||
/usr/sbin/depmod
|
||||
|
||||
%changelog
|
||||
* Sat Dec 17 2021 Min Hu <humin29@huawei.com> - 20.11-10
|
||||
- sync patches ranges from versoin 9 t0 17 from master branch
|
||||
* Mon Sep 13 2021 chenchen <chen_aka_jan@163.com> - 20.11-9
|
||||
- del rpath from some binaries and bin
|
||||
- add debug package to strip
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user