* [PATCH 00/15] fix and feature for hns3 PMD @ 2022-01-07 10:15 Min Hu (Connor) 2022-01-07 10:15 ` [PATCH 01/15] net/hns3: remove unnecessary assignment Min Hu (Connor) ` (16 more replies) 0 siblings, 17 replies; 38+ messages in thread From: Min Hu (Connor) @ 2022-01-07 10:15 UTC (permalink / raw) To: dev; +Cc: ferruh.yigit, thomas This patch contains 15 patches, which include fixing codecheck warning ,code refactor and indirect counter action support. Chengwen Feng (4): net/hns3: remove invalid encapsulation function net/hns3: delete strerror invoke net/hns3: rename function net/hns3: support indirect counter action Huisong Li (10): net/hns3: remove unnecessary assignment net/hns3: fix a misjudgment expression net/hns3: extract a common API to initialize MAC addrs net/hns3: remove unnecessary black lines net/hns3: extract a function to handle reset fail net/hns3: extract functions to create RSS and FDIR flow rule net/hns3: remove unused variables net/hns3: remove the number of queue descriptors net/hns3: remove the printing of memory addresses net/hns3: extract a common interface to obtain revision ID Jie Hai (1): net/hns3: remove unnecessary 'inline' drivers/net/hns3/hns3_cmd.c | 12 +- drivers/net/hns3/hns3_common.c | 76 ++++++ drivers/net/hns3/hns3_common.h | 3 + drivers/net/hns3/hns3_dcb.c | 12 +- drivers/net/hns3/hns3_ethdev.c | 85 ++----- drivers/net/hns3/hns3_ethdev.h | 5 - drivers/net/hns3/hns3_ethdev_vf.c | 93 +------ drivers/net/hns3/hns3_fdir.c | 3 +- drivers/net/hns3/hns3_fdir.h | 1 + drivers/net/hns3/hns3_flow.c | 399 ++++++++++++++++++++++++------ drivers/net/hns3/hns3_flow.h | 11 +- drivers/net/hns3/hns3_intr.c | 54 ++-- drivers/net/hns3/hns3_rxtx.c | 6 - drivers/net/hns3/hns3_rxtx.h | 2 - 14 files changed, 476 insertions(+), 286 deletions(-) -- 2.33.0 ^ permalink raw reply [flat|nested] 38+ messages in thread
* [PATCH 01/15] net/hns3: remove unnecessary assignment 2022-01-07 10:15 [PATCH 00/15] fix and feature for hns3 PMD Min Hu (Connor) @ 2022-01-07 10:15 ` Min Hu (Connor) 2022-01-07 10:15 ` [PATCH 02/15] net/hns3: fix a misjudgment expression Min Hu (Connor) ` (15 subsequent siblings) 16 siblings, 0 replies; 38+ messages in thread From: Min Hu (Connor) @ 2022-01-07 10:15 UTC (permalink / raw) To: dev; +Cc: ferruh.yigit, thomas From: Huisong Li <lihuisong@huawei.com> Remove unnecessary assignment. Signed-off-by: Huisong Li <lihuisong@huawei.com> --- drivers/net/hns3/hns3_flow.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/net/hns3/hns3_flow.c b/drivers/net/hns3/hns3_flow.c index 9f2f9cb6cd..df5caae83c 100644 --- a/drivers/net/hns3/hns3_flow.c +++ b/drivers/net/hns3/hns3_flow.c @@ -1890,7 +1890,6 @@ hns3_flow_destroy(struct rte_eth_dev *dev, struct rte_flow *flow, } } rte_free(flow); - flow = NULL; return 0; } -- 2.33.0 ^ permalink raw reply [flat|nested] 38+ messages in thread
* [PATCH 02/15] net/hns3: fix a misjudgment expression 2022-01-07 10:15 [PATCH 00/15] fix and feature for hns3 PMD Min Hu (Connor) 2022-01-07 10:15 ` [PATCH 01/15] net/hns3: remove unnecessary assignment Min Hu (Connor) @ 2022-01-07 10:15 ` Min Hu (Connor) 2022-01-07 10:15 ` [PATCH 03/15] net/hns3: extract a common API to initialize MAC addrs Min Hu (Connor) ` (14 subsequent siblings) 16 siblings, 0 replies; 38+ messages in thread From: Min Hu (Connor) @ 2022-01-07 10:15 UTC (permalink / raw) To: dev; +Cc: ferruh.yigit, thomas From: Huisong Li <lihuisong@huawei.com> The enum type variables cannot be used as bool variables. This patch fixes for "with->func" in hns3_action_rss_same(). Fixes: eb158fc756a5 ("net/hns3: fix config when creating RSS rule after flush") Cc: stable@dpdk.org Signed-off-by: Huisong Li <lihuisong@huawei.com> --- drivers/net/hns3/hns3_flow.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/net/hns3/hns3_flow.c b/drivers/net/hns3/hns3_flow.c index df5caae83c..479c9963b2 100644 --- a/drivers/net/hns3/hns3_flow.c +++ b/drivers/net/hns3/hns3_flow.c @@ -1251,7 +1251,8 @@ hns3_action_rss_same(const struct rte_flow_action_rss *comp, if (comp->func == RTE_ETH_HASH_FUNCTION_MAX) func_is_same = false; else - func_is_same = with->func ? (comp->func == with->func) : true; + func_is_same = (with->func != RTE_ETH_HASH_FUNCTION_DEFAULT) ? + (comp->func == with->func) : true; return (func_is_same && comp->types == (with->types & HNS3_ETH_RSS_SUPPORT) && -- 2.33.0 ^ permalink raw reply [flat|nested] 38+ messages in thread
* [PATCH 03/15] net/hns3: extract a common API to initialize MAC addrs 2022-01-07 10:15 [PATCH 00/15] fix and feature for hns3 PMD Min Hu (Connor) 2022-01-07 10:15 ` [PATCH 01/15] net/hns3: remove unnecessary assignment Min Hu (Connor) 2022-01-07 10:15 ` [PATCH 02/15] net/hns3: fix a misjudgment expression Min Hu (Connor) @ 2022-01-07 10:15 ` Min Hu (Connor) 2022-01-07 10:15 ` [PATCH 04/15] net/hns3: remove unnecessary 'inline' Min Hu (Connor) ` (13 subsequent siblings) 16 siblings, 0 replies; 38+ messages in thread From: Min Hu (Connor) @ 2022-01-07 10:15 UTC (permalink / raw) To: dev; +Cc: ferruh.yigit, thomas From: Huisong Li <lihuisong@huawei.com> The code logic to initialize "data->mac_addrs" for PF and VF is similar. This patch extracts a common API to initialize it to improve code maintainabiliy. Signed-off-by: Huisong Li <lihuisong@huawei.com> --- drivers/net/hns3/hns3_common.c | 54 +++++++++++++++++++++++++++++++ drivers/net/hns3/hns3_common.h | 1 + drivers/net/hns3/hns3_ethdev.c | 31 +++--------------- drivers/net/hns3/hns3_ethdev_vf.c | 33 +++---------------- 4 files changed, 63 insertions(+), 56 deletions(-) diff --git a/drivers/net/hns3/hns3_common.c b/drivers/net/hns3/hns3_common.c index eac2aa1040..cb581bb25a 100644 --- a/drivers/net/hns3/hns3_common.c +++ b/drivers/net/hns3/hns3_common.c @@ -581,6 +581,60 @@ hns3_remove_mac_addr(struct rte_eth_dev *dev, uint32_t idx) } } +int +hns3_init_mac_addrs(struct rte_eth_dev *dev) +{ + struct hns3_hw *hw = HNS3_DEV_PRIVATE_TO_HW(dev->data->dev_private); + struct hns3_adapter *hns = HNS3_DEV_HW_TO_ADAPTER(hw); + const char *memory_name = hns->is_vf ? "hns3vf-mac" : "hns3-mac"; + uint16_t mac_addrs_capa = hns->is_vf ? HNS3_VF_UC_MACADDR_NUM : + HNS3_UC_MACADDR_NUM; + char mac_str[RTE_ETHER_ADDR_FMT_SIZE]; + struct rte_ether_addr *eth_addr; + + /* Allocate memory for storing MAC addresses */ + dev->data->mac_addrs = rte_zmalloc(memory_name, + sizeof(struct rte_ether_addr) * mac_addrs_capa, + 0); + if (dev->data->mac_addrs == NULL) { + hns3_err(hw, "failed to allocate %zx bytes needed to store MAC addresses", + sizeof(struct rte_ether_addr) * mac_addrs_capa); + return -ENOMEM; + } + + eth_addr = (struct rte_ether_addr *)hw->mac.mac_addr; + if (!hns->is_vf) { + if (!rte_is_valid_assigned_ether_addr(eth_addr)) { + rte_eth_random_addr(hw->mac.mac_addr); + hns3_ether_format_addr(mac_str, RTE_ETHER_ADDR_FMT_SIZE, + (struct rte_ether_addr *)hw->mac.mac_addr); + hns3_warn(hw, "default mac_addr from firmware is an invalid " + "unicast address, using random MAC address %s", + mac_str); + } + } else { + /* + * The hns3 PF ethdev driver in kernel support setting VF MAC + * address on the host by "ip link set ..." command. To avoid + * some incorrect scenes, for example, hns3 VF PMD driver fails + * to receive and send packets after user configure the MAC + * address by using the "ip link set ..." command, hns3 VF PMD + * driver keep the same MAC address strategy as the hns3 kernel + * ethdev driver in the initialization. If user configure a MAC + * address by the ip command for VF device, then hns3 VF PMD + * driver will start with it, otherwise start with a random MAC + * address in the initialization. + */ + if (rte_is_zero_ether_addr(eth_addr)) + rte_eth_random_addr(hw->mac.mac_addr); + } + + rte_ether_addr_copy((struct rte_ether_addr *)hw->mac.mac_addr, + &dev->data->mac_addrs[0]); + + return 0; +} + int hns3_init_ring_with_vector(struct hns3_hw *hw) { diff --git a/drivers/net/hns3/hns3_common.h b/drivers/net/hns3/hns3_common.h index 0dbb1c0413..a9e8a9cccf 100644 --- a/drivers/net/hns3/hns3_common.h +++ b/drivers/net/hns3/hns3_common.h @@ -52,6 +52,7 @@ int hns3_set_mc_mac_addr_list(struct rte_eth_dev *dev, uint32_t nb_mc_addr); void hns3_ether_format_addr(char *buf, uint16_t size, const struct rte_ether_addr *ether_addr); +int hns3_init_mac_addrs(struct rte_eth_dev *dev); int hns3_init_ring_with_vector(struct hns3_hw *hw); int hns3_map_rx_interrupt(struct rte_eth_dev *dev); diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c index 0bd12907d8..44bd7e8b22 100644 --- a/drivers/net/hns3/hns3_ethdev.c +++ b/drivers/net/hns3/hns3_ethdev.c @@ -6623,8 +6623,6 @@ static int hns3_dev_init(struct rte_eth_dev *eth_dev) { struct hns3_adapter *hns = eth_dev->data->dev_private; - char mac_str[RTE_ETHER_ADDR_FMT_SIZE]; - struct rte_ether_addr *eth_addr; struct hns3_hw *hw = &hns->hw; int ret; @@ -6667,30 +6665,9 @@ hns3_dev_init(struct rte_eth_dev *eth_dev) goto err_init_pf; } - /* Allocate memory for storing MAC addresses */ - eth_dev->data->mac_addrs = rte_zmalloc("hns3-mac", - sizeof(struct rte_ether_addr) * - HNS3_UC_MACADDR_NUM, 0); - if (eth_dev->data->mac_addrs == NULL) { - PMD_INIT_LOG(ERR, "Failed to allocate %zx bytes needed " - "to store MAC addresses", - sizeof(struct rte_ether_addr) * - HNS3_UC_MACADDR_NUM); - ret = -ENOMEM; - goto err_rte_zmalloc; - } - - eth_addr = (struct rte_ether_addr *)hw->mac.mac_addr; - if (!rte_is_valid_assigned_ether_addr(eth_addr)) { - rte_eth_random_addr(hw->mac.mac_addr); - hns3_ether_format_addr(mac_str, RTE_ETHER_ADDR_FMT_SIZE, - (struct rte_ether_addr *)hw->mac.mac_addr); - hns3_warn(hw, "default mac_addr from firmware is an invalid " - "unicast address, using random MAC address %s", - mac_str); - } - rte_ether_addr_copy((struct rte_ether_addr *)hw->mac.mac_addr, - ð_dev->data->mac_addrs[0]); + ret = hns3_init_mac_addrs(eth_dev); + if (ret != 0) + goto err_init_mac_addrs; hw->adapter_state = HNS3_NIC_INITIALIZED; @@ -6706,7 +6683,7 @@ hns3_dev_init(struct rte_eth_dev *eth_dev) hns3_info(hw, "hns3 dev initialization successful!"); return 0; -err_rte_zmalloc: +err_init_mac_addrs: hns3_uninit_pf(eth_dev); err_init_pf: diff --git a/drivers/net/hns3/hns3_ethdev_vf.c b/drivers/net/hns3/hns3_ethdev_vf.c index 805abd4543..58b4a107d3 100644 --- a/drivers/net/hns3/hns3_ethdev_vf.c +++ b/drivers/net/hns3/hns3_ethdev_vf.c @@ -2400,34 +2400,9 @@ hns3vf_dev_init(struct rte_eth_dev *eth_dev) goto err_init_vf; } - /* Allocate memory for storing MAC addresses */ - eth_dev->data->mac_addrs = rte_zmalloc("hns3vf-mac", - sizeof(struct rte_ether_addr) * - HNS3_VF_UC_MACADDR_NUM, 0); - if (eth_dev->data->mac_addrs == NULL) { - PMD_INIT_LOG(ERR, "Failed to allocate %zx bytes needed " - "to store MAC addresses", - sizeof(struct rte_ether_addr) * - HNS3_VF_UC_MACADDR_NUM); - ret = -ENOMEM; - goto err_rte_zmalloc; - } - - /* - * The hns3 PF ethdev driver in kernel support setting VF MAC address - * on the host by "ip link set ..." command. To avoid some incorrect - * scenes, for example, hns3 VF PMD fails to receive and send - * packets after user configure the MAC address by using the - * "ip link set ..." command, hns3 VF PMD keep the same MAC - * address strategy as the hns3 kernel ethdev driver in the - * initialization. If user configure a MAC address by the ip command - * for VF device, then hns3 VF PMD will start with it, otherwise - * start with a random MAC address in the initialization. - */ - if (rte_is_zero_ether_addr((struct rte_ether_addr *)hw->mac.mac_addr)) - rte_eth_random_addr(hw->mac.mac_addr); - rte_ether_addr_copy((struct rte_ether_addr *)hw->mac.mac_addr, - ð_dev->data->mac_addrs[0]); + ret = hns3_init_mac_addrs(eth_dev); + if (ret != 0) + goto err_init_mac_addrs; hw->adapter_state = HNS3_NIC_INITIALIZED; @@ -2443,7 +2418,7 @@ hns3vf_dev_init(struct rte_eth_dev *eth_dev) eth_dev); return 0; -err_rte_zmalloc: +err_init_mac_addrs: hns3vf_uninit_vf(eth_dev); err_init_vf: -- 2.33.0 ^ permalink raw reply [flat|nested] 38+ messages in thread
* [PATCH 04/15] net/hns3: remove unnecessary 'inline' 2022-01-07 10:15 [PATCH 00/15] fix and feature for hns3 PMD Min Hu (Connor) ` (2 preceding siblings ...) 2022-01-07 10:15 ` [PATCH 03/15] net/hns3: extract a common API to initialize MAC addrs Min Hu (Connor) @ 2022-01-07 10:15 ` Min Hu (Connor) 2022-01-07 10:15 ` [PATCH 05/15] net/hns3: remove unnecessary black lines Min Hu (Connor) ` (12 subsequent siblings) 16 siblings, 0 replies; 38+ messages in thread From: Min Hu (Connor) @ 2022-01-07 10:15 UTC (permalink / raw) To: dev; +Cc: ferruh.yigit, thomas From: Jie Hai <haijie1@huawei.com> This function is a control-plane interface and does not need to use inline. Signed-off-by: Jie Hai <haijie1@huawei.com> --- drivers/net/hns3/hns3_ethdev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c index 44bd7e8b22..4906575b59 100644 --- a/drivers/net/hns3/hns3_ethdev.c +++ b/drivers/net/hns3/hns3_ethdev.c @@ -4859,7 +4859,7 @@ hns3_check_port_speed(struct hns3_hw *hw, uint32_t link_speeds) return 0; } -static inline uint32_t +static uint32_t hns3_get_link_speed(uint32_t link_speeds) { uint32_t speed = RTE_ETH_SPEED_NUM_NONE; -- 2.33.0 ^ permalink raw reply [flat|nested] 38+ messages in thread
* [PATCH 05/15] net/hns3: remove unnecessary black lines 2022-01-07 10:15 [PATCH 00/15] fix and feature for hns3 PMD Min Hu (Connor) ` (3 preceding siblings ...) 2022-01-07 10:15 ` [PATCH 04/15] net/hns3: remove unnecessary 'inline' Min Hu (Connor) @ 2022-01-07 10:15 ` Min Hu (Connor) 2022-01-07 10:15 ` [PATCH 06/15] net/hns3: extract a function to handle reset fail Min Hu (Connor) ` (11 subsequent siblings) 16 siblings, 0 replies; 38+ messages in thread From: Min Hu (Connor) @ 2022-01-07 10:15 UTC (permalink / raw) To: dev; +Cc: ferruh.yigit, thomas From: Huisong Li <lihuisong@huawei.com> Remove unnecessary black lines. Signed-off-by: Huisong Li <lihuisong@huawei.com> --- drivers/net/hns3/hns3_ethdev.c | 1 - drivers/net/hns3/hns3_rxtx.h | 2 -- 2 files changed, 3 deletions(-) diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c index 4906575b59..756645a410 100644 --- a/drivers/net/hns3/hns3_ethdev.c +++ b/drivers/net/hns3/hns3_ethdev.c @@ -6301,7 +6301,6 @@ hns3_fec_set(struct rte_eth_dev *dev, uint32_t mode) struct hns3_adapter *hns = dev->data->dev_private; struct hns3_hw *hw = HNS3_DEV_PRIVATE_TO_HW(hns); struct hns3_pf *pf = &hns->pf; - struct rte_eth_fec_capa fec_capa[FEC_CAPA_NUM]; uint32_t cur_capa; uint32_t num = FEC_CAPA_NUM; diff --git a/drivers/net/hns3/hns3_rxtx.h b/drivers/net/hns3/hns3_rxtx.h index 5423568cd0..55192361f7 100644 --- a/drivers/net/hns3/hns3_rxtx.h +++ b/drivers/net/hns3/hns3_rxtx.h @@ -344,7 +344,6 @@ struct hns3_rx_queue { struct rte_mbuf fake_mbuf; /* fake mbuf used with vector rx */ - /* * The following fields are not accessed in the I/O path, so they are * placed at the end. @@ -518,7 +517,6 @@ struct hns3_tx_queue { struct hns3_tx_basic_stats basic_stats; struct hns3_tx_dfx_stats dfx_stats; - /* * The following fields are not accessed in the I/O path, so they are * placed at the end. -- 2.33.0 ^ permalink raw reply [flat|nested] 38+ messages in thread
* [PATCH 06/15] net/hns3: extract a function to handle reset fail 2022-01-07 10:15 [PATCH 00/15] fix and feature for hns3 PMD Min Hu (Connor) ` (4 preceding siblings ...) 2022-01-07 10:15 ` [PATCH 05/15] net/hns3: remove unnecessary black lines Min Hu (Connor) @ 2022-01-07 10:15 ` Min Hu (Connor) 2022-01-07 10:15 ` [PATCH 07/15] net/hns3: extract functions to create RSS and FDIR flow rule Min Hu (Connor) ` (10 subsequent siblings) 16 siblings, 0 replies; 38+ messages in thread From: Min Hu (Connor) @ 2022-01-07 10:15 UTC (permalink / raw) To: dev; +Cc: ferruh.yigit, thomas From: Huisong Li <lihuisong@huawei.com> Extract a function to handle reset fail for clearer code logic. Signed-off-by: Huisong Li <lihuisong@huawei.com> --- drivers/net/hns3/hns3_intr.c | 54 +++++++++++++++++++++--------------- 1 file changed, 32 insertions(+), 22 deletions(-) diff --git a/drivers/net/hns3/hns3_intr.c b/drivers/net/hns3/hns3_intr.c index 66dc509086..3ca2e1e338 100644 --- a/drivers/net/hns3/hns3_intr.c +++ b/drivers/net/hns3/hns3_intr.c @@ -2770,6 +2770,37 @@ hns3_reset_post(struct hns3_adapter *hns) return -EIO; } +static void +hns3_reset_fail_handle(struct hns3_adapter *hns) +{ + struct hns3_hw *hw = &hns->hw; + struct timeval tv_delta; + struct timeval tv; + + hns3_clear_reset_level(hw, &hw->reset.pending); + if (hns3_reset_err_handle(hns)) { + hw->reset.stage = RESET_STAGE_PREWAIT; + hns3_schedule_reset(hns); + return; + } + + rte_spinlock_lock(&hw->lock); + if (hw->reset.mbuf_deferred_free) { + hns3_dev_release_mbufs(hns); + hw->reset.mbuf_deferred_free = false; + } + rte_spinlock_unlock(&hw->lock); + __atomic_store_n(&hns->hw.reset.resetting, 0, __ATOMIC_RELAXED); + hw->reset.stage = RESET_STAGE_NONE; + hns3_clock_gettime(&tv); + timersub(&tv, &hw->reset.start_time, &tv_delta); + hns3_warn(hw, "%s reset fail delta %" PRIu64 " ms time=%ld.%.6ld", + reset_string[hw->reset.level], + hns3_clock_calctime_ms(&tv_delta), + tv.tv_sec, tv.tv_usec); + hw->reset.level = HNS3_NONE_RESET; +} + /* * There are three scenarios as follows: * When the reset is not in progress, the reset process starts. @@ -2784,7 +2815,6 @@ int hns3_reset_process(struct hns3_adapter *hns, enum hns3_reset_level new_level) { struct hns3_hw *hw = &hns->hw; - struct timeval tv_delta; struct timeval tv; int ret; @@ -2843,27 +2873,7 @@ hns3_reset_process(struct hns3_adapter *hns, enum hns3_reset_level new_level) if (ret == -EAGAIN) return ret; err: - hns3_clear_reset_level(hw, &hw->reset.pending); - if (hns3_reset_err_handle(hns)) { - hw->reset.stage = RESET_STAGE_PREWAIT; - hns3_schedule_reset(hns); - } else { - rte_spinlock_lock(&hw->lock); - if (hw->reset.mbuf_deferred_free) { - hns3_dev_release_mbufs(hns); - hw->reset.mbuf_deferred_free = false; - } - rte_spinlock_unlock(&hw->lock); - __atomic_store_n(&hns->hw.reset.resetting, 0, __ATOMIC_RELAXED); - hw->reset.stage = RESET_STAGE_NONE; - hns3_clock_gettime(&tv); - timersub(&tv, &hw->reset.start_time, &tv_delta); - hns3_warn(hw, "%s reset fail delta %" PRIu64 " ms time=%ld.%.6ld", - reset_string[hw->reset.level], - hns3_clock_calctime_ms(&tv_delta), - tv.tv_sec, tv.tv_usec); - hw->reset.level = HNS3_NONE_RESET; - } + hns3_reset_fail_handle(hns); return -EIO; } -- 2.33.0 ^ permalink raw reply [flat|nested] 38+ messages in thread
* [PATCH 07/15] net/hns3: extract functions to create RSS and FDIR flow rule 2022-01-07 10:15 [PATCH 00/15] fix and feature for hns3 PMD Min Hu (Connor) ` (5 preceding siblings ...) 2022-01-07 10:15 ` [PATCH 06/15] net/hns3: extract a function to handle reset fail Min Hu (Connor) @ 2022-01-07 10:15 ` Min Hu (Connor) 2022-01-07 10:15 ` [PATCH 08/15] net/hns3: remove unused variables Min Hu (Connor) ` (9 subsequent siblings) 16 siblings, 0 replies; 38+ messages in thread From: Min Hu (Connor) @ 2022-01-07 10:15 UTC (permalink / raw) To: dev; +Cc: ferruh.yigit, thomas From: Huisong Li <lihuisong@huawei.com> Extract two functions to create the RSS and FDIR flow rule for clearer code logic. Signed-off-by: Huisong Li <lihuisong@huawei.com> --- drivers/net/hns3/hns3_flow.c | 173 +++++++++++++++++++++-------------- 1 file changed, 106 insertions(+), 67 deletions(-) diff --git a/drivers/net/hns3/hns3_flow.c b/drivers/net/hns3/hns3_flow.c index 479c9963b2..2ee21190fb 100644 --- a/drivers/net/hns3/hns3_flow.c +++ b/drivers/net/hns3/hns3_flow.c @@ -1706,6 +1706,105 @@ hns3_flow_validate(struct rte_eth_dev *dev, const struct rte_flow_attr *attr, return hns3_parse_fdir_filter(dev, pattern, actions, &fdir_rule, error); } +static int +hns3_flow_create_rss_rule(struct rte_eth_dev *dev, + const struct rte_flow_action *act, + struct rte_flow *flow) +{ + struct hns3_hw *hw = HNS3_DEV_PRIVATE_TO_HW(dev->data->dev_private); + struct hns3_rss_conf_ele *rss_filter_ptr; + const struct hns3_rss_conf *rss_conf; + int ret; + + rss_filter_ptr = rte_zmalloc("hns3 rss filter", + sizeof(struct hns3_rss_conf_ele), 0); + if (rss_filter_ptr == NULL) { + hns3_err(hw, "failed to allocate hns3_rss_filter memory"); + return -ENOMEM; + } + + /* + * After all the preceding tasks are successfully configured, configure + * rules to the hardware to simplify the rollback of rules in the + * hardware. + */ + rss_conf = (const struct hns3_rss_conf *)act->conf; + ret = hns3_flow_parse_rss(dev, rss_conf, true); + if (ret != 0) { + rte_free(rss_filter_ptr); + return ret; + } + + hns3_rss_conf_copy(&rss_filter_ptr->filter_info, &rss_conf->conf); + rss_filter_ptr->filter_info.valid = true; + TAILQ_INSERT_TAIL(&hw->flow_rss_list, rss_filter_ptr, entries); + flow->rule = rss_filter_ptr; + flow->filter_type = RTE_ETH_FILTER_HASH; + + return 0; +} + +static int +hns3_flow_create_fdir_rule(struct rte_eth_dev *dev, + const struct rte_flow_item pattern[], + const struct rte_flow_action actions[], + struct rte_flow_error *error, + struct rte_flow *flow) +{ + struct hns3_hw *hw = HNS3_DEV_PRIVATE_TO_HW(dev->data->dev_private); + struct hns3_adapter *hns = HNS3_DEV_HW_TO_ADAPTER(hw); + struct hns3_fdir_rule_ele *fdir_rule_ptr; + struct hns3_fdir_rule fdir_rule; + int ret; + + memset(&fdir_rule, 0, sizeof(struct hns3_fdir_rule)); + ret = hns3_parse_fdir_filter(dev, pattern, actions, &fdir_rule, error); + if (ret != 0) + return ret; + + if (fdir_rule.flags & HNS3_RULE_FLAG_COUNTER) { + ret = hns3_counter_new(dev, fdir_rule.act_cnt.shared, + fdir_rule.act_cnt.id, error); + if (ret != 0) + return ret; + + flow->counter_id = fdir_rule.act_cnt.id; + } + + fdir_rule_ptr = rte_zmalloc("hns3 fdir rule", + sizeof(struct hns3_fdir_rule_ele), 0); + if (fdir_rule_ptr == NULL) { + hns3_err(hw, "failed to allocate fdir_rule memory."); + ret = -ENOMEM; + goto err_malloc; + } + + /* + * After all the preceding tasks are successfully configured, configure + * rules to the hardware to simplify the rollback of rules in the + * hardware. + */ + ret = hns3_fdir_filter_program(hns, &fdir_rule, false); + if (ret != 0) + goto err_fdir_filter; + + memcpy(&fdir_rule_ptr->fdir_conf, &fdir_rule, + sizeof(struct hns3_fdir_rule)); + TAILQ_INSERT_TAIL(&hw->flow_fdir_list, fdir_rule_ptr, entries); + flow->rule = fdir_rule_ptr; + flow->filter_type = RTE_ETH_FILTER_FDIR; + + return 0; + +err_fdir_filter: + rte_free(fdir_rule_ptr); +err_malloc: + if (fdir_rule.flags & HNS3_RULE_FLAG_COUNTER) + hns3_counter_release(dev, fdir_rule.act_cnt.id); + + return ret; +} + /* * Create or destroy a flow rule. * Theorically one rule can match more than one filters. @@ -1720,13 +1819,9 @@ hns3_flow_create(struct rte_eth_dev *dev, const struct rte_flow_attr *attr, { struct hns3_adapter *hns = dev->data->dev_private; struct hns3_hw *hw = &hns->hw; - const struct hns3_rss_conf *rss_conf; - struct hns3_fdir_rule_ele *fdir_rule_ptr; - struct hns3_rss_conf_ele *rss_filter_ptr; struct hns3_flow_mem *flow_node; const struct rte_flow_action *act; struct rte_flow *flow; - struct hns3_fdir_rule fdir_rule; int ret; ret = hns3_flow_validate(dev, attr, pattern, actions, error); @@ -1752,76 +1847,20 @@ hns3_flow_create(struct rte_eth_dev *dev, const struct rte_flow_attr *attr, TAILQ_INSERT_TAIL(&hw->flow_list, flow_node, entries); act = hns3_find_rss_general_action(pattern, actions); - if (act) { - rss_conf = act->conf; - - ret = hns3_flow_parse_rss(dev, rss_conf, true); - if (ret) - goto err; - - rss_filter_ptr = rte_zmalloc("hns3 rss filter", - sizeof(struct hns3_rss_conf_ele), - 0); - if (rss_filter_ptr == NULL) { - hns3_err(hw, - "Failed to allocate hns3_rss_filter memory"); - ret = -ENOMEM; - goto err; - } - hns3_rss_conf_copy(&rss_filter_ptr->filter_info, - &rss_conf->conf); - rss_filter_ptr->filter_info.valid = true; - TAILQ_INSERT_TAIL(&hw->flow_rss_list, rss_filter_ptr, entries); - - flow->rule = rss_filter_ptr; - flow->filter_type = RTE_ETH_FILTER_HASH; - return flow; - } - - memset(&fdir_rule, 0, sizeof(struct hns3_fdir_rule)); - ret = hns3_parse_fdir_filter(dev, pattern, actions, &fdir_rule, error); - if (ret) - goto out; - - if (fdir_rule.flags & HNS3_RULE_FLAG_COUNTER) { - ret = hns3_counter_new(dev, 0, fdir_rule.act_cnt.id, error); - if (ret) - goto out; - - flow->counter_id = fdir_rule.act_cnt.id; - } - - fdir_rule_ptr = rte_zmalloc("hns3 fdir rule", - sizeof(struct hns3_fdir_rule_ele), - 0); - if (fdir_rule_ptr == NULL) { - hns3_err(hw, "failed to allocate fdir_rule memory."); - ret = -ENOMEM; - goto err_fdir; - } - - ret = hns3_fdir_filter_program(hns, &fdir_rule, false); - if (!ret) { - memcpy(&fdir_rule_ptr->fdir_conf, &fdir_rule, - sizeof(struct hns3_fdir_rule)); - TAILQ_INSERT_TAIL(&hw->flow_fdir_list, fdir_rule_ptr, entries); - flow->rule = fdir_rule_ptr; - flow->filter_type = RTE_ETH_FILTER_FDIR; - + if (act) + ret = hns3_flow_create_rss_rule(dev, act, flow); + else + ret = hns3_flow_create_fdir_rule(dev, pattern, actions, + error, flow); + if (ret == 0) return flow; - } - rte_free(fdir_rule_ptr); -err_fdir: - if (fdir_rule.flags & HNS3_RULE_FLAG_COUNTER) - hns3_counter_release(dev, fdir_rule.act_cnt.id); -err: rte_flow_error_set(error, -ret, RTE_FLOW_ERROR_TYPE_HANDLE, NULL, "Failed to create flow"); -out: TAILQ_REMOVE(&hw->flow_list, flow_node, entries); rte_free(flow_node); rte_free(flow); + return NULL; } -- 2.33.0 ^ permalink raw reply [flat|nested] 38+ messages in thread
* [PATCH 08/15] net/hns3: remove unused variables 2022-01-07 10:15 [PATCH 00/15] fix and feature for hns3 PMD Min Hu (Connor) ` (6 preceding siblings ...) 2022-01-07 10:15 ` [PATCH 07/15] net/hns3: extract functions to create RSS and FDIR flow rule Min Hu (Connor) @ 2022-01-07 10:15 ` Min Hu (Connor) 2022-01-07 10:15 ` [PATCH 09/15] net/hns3: remove the number of queue descriptors Min Hu (Connor) ` (8 subsequent siblings) 16 siblings, 0 replies; 38+ messages in thread From: Min Hu (Connor) @ 2022-01-07 10:15 UTC (permalink / raw) To: dev; +Cc: ferruh.yigit, thomas From: Huisong Li <lihuisong@huawei.com> Remove unused variables. Signed-off-by: Huisong Li <lihuisong@huawei.com> --- drivers/net/hns3/hns3_dcb.c | 12 +----------- drivers/net/hns3/hns3_ethdev.c | 3 --- drivers/net/hns3/hns3_ethdev.h | 2 -- 3 files changed, 1 insertion(+), 16 deletions(-) diff --git a/drivers/net/hns3/hns3_dcb.c b/drivers/net/hns3/hns3_dcb.c index 3d0159d787..136ada626b 100644 --- a/drivers/net/hns3/hns3_dcb.c +++ b/drivers/net/hns3/hns3_dcb.c @@ -750,19 +750,9 @@ static int hns3_dcb_update_tc_queue_mapping(struct hns3_hw *hw, uint16_t nb_rx_q, uint16_t nb_tx_q) { - struct hns3_adapter *hns = HNS3_DEV_HW_TO_ADAPTER(hw); - struct hns3_pf *pf = &hns->pf; - int ret; - hw->num_tc = hw->dcb_info.num_tc; - ret = hns3_queue_to_tc_mapping(hw, nb_rx_q, nb_tx_q); - if (ret) - return ret; - if (!hns->is_vf) - memcpy(pf->prio_tc, hw->dcb_info.prio_tc, HNS3_MAX_USER_PRIO); - - return 0; + return hns3_queue_to_tc_mapping(hw, nb_rx_q, nb_tx_q); } int diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c index 756645a410..bf64a4f45e 100644 --- a/drivers/net/hns3/hns3_ethdev.c +++ b/drivers/net/hns3/hns3_ethdev.c @@ -2552,9 +2552,6 @@ hns3_parse_cfg(struct hns3_cfg *cfg, struct hns3_cmd_desc *desc) cfg->media_type = hns3_get_field(rte_le_to_cpu_32(req->param[1]), HNS3_CFG_MEDIA_TP_M, HNS3_CFG_MEDIA_TP_S); - cfg->rx_buf_len = hns3_get_field(rte_le_to_cpu_32(req->param[1]), - HNS3_CFG_RX_BUF_LEN_M, - HNS3_CFG_RX_BUF_LEN_S); /* get mac address */ mac_addr_tmp = rte_le_to_cpu_32(req->param[2]); mac_addr_tmp_high = hns3_get_field(rte_le_to_cpu_32(req->param[3]), diff --git a/drivers/net/hns3/hns3_ethdev.h b/drivers/net/hns3/hns3_ethdev.h index aa45b31261..ea92d94e37 100644 --- a/drivers/net/hns3/hns3_ethdev.h +++ b/drivers/net/hns3/hns3_ethdev.h @@ -156,7 +156,6 @@ struct hns3_tc_queue_info { struct hns3_cfg { uint8_t tc_num; uint16_t tqp_desc_num; - uint16_t rx_buf_len; uint16_t rss_size_max; uint8_t phy_addr; uint8_t media_type; @@ -804,7 +803,6 @@ struct hns3_pf { uint8_t tc_max; /* max number of tc driver supported */ uint8_t local_max_tc; /* max number of local tc */ uint8_t pfc_max; - uint8_t prio_tc[HNS3_MAX_USER_PRIO]; /* TC indexed by prio */ uint16_t pause_time; bool support_fc_autoneg; /* support FC autonegotiate */ bool support_multi_tc_pause; -- 2.33.0 ^ permalink raw reply [flat|nested] 38+ messages in thread
* [PATCH 09/15] net/hns3: remove the number of queue descriptors 2022-01-07 10:15 [PATCH 00/15] fix and feature for hns3 PMD Min Hu (Connor) ` (7 preceding siblings ...) 2022-01-07 10:15 ` [PATCH 08/15] net/hns3: remove unused variables Min Hu (Connor) @ 2022-01-07 10:15 ` Min Hu (Connor) 2022-01-07 10:15 ` [PATCH 10/15] net/hns3: remove the printing of memory addresses Min Hu (Connor) ` (7 subsequent siblings) 16 siblings, 0 replies; 38+ messages in thread From: Min Hu (Connor) @ 2022-01-07 10:15 UTC (permalink / raw) To: dev; +Cc: ferruh.yigit, thomas From: Huisong Li <lihuisong@huawei.com> Application can specify the number of Rx/Tx queue descriptors in DPDK. So driver does not obtain the default value from firmware and PF. Signed-off-by: Huisong Li <lihuisong@huawei.com> --- drivers/net/hns3/hns3_ethdev.c | 5 ----- drivers/net/hns3/hns3_ethdev.h | 3 --- drivers/net/hns3/hns3_ethdev_vf.c | 26 -------------------------- 3 files changed, 34 deletions(-) diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c index bf64a4f45e..1deba2a055 100644 --- a/drivers/net/hns3/hns3_ethdev.c +++ b/drivers/net/hns3/hns3_ethdev.c @@ -2542,9 +2542,6 @@ hns3_parse_cfg(struct hns3_cfg *cfg, struct hns3_cmd_desc *desc) /* get the configuration */ cfg->tc_num = hns3_get_field(rte_le_to_cpu_32(req->param[0]), HNS3_CFG_TC_NUM_M, HNS3_CFG_TC_NUM_S); - cfg->tqp_desc_num = hns3_get_field(rte_le_to_cpu_32(req->param[0]), - HNS3_CFG_TQP_DESC_N_M, - HNS3_CFG_TQP_DESC_N_S); cfg->phy_addr = hns3_get_field(rte_le_to_cpu_32(req->param[1]), HNS3_CFG_PHY_ADDR_M, @@ -2855,8 +2852,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->num_tx_desc = cfg.tqp_desc_num; - hw->num_rx_desc = cfg.tqp_desc_num; hw->dcb_info.num_pg = 1; hw->dcb_info.hw_pfc_map = 0; diff --git a/drivers/net/hns3/hns3_ethdev.h b/drivers/net/hns3/hns3_ethdev.h index ea92d94e37..15ab39796e 100644 --- a/drivers/net/hns3/hns3_ethdev.h +++ b/drivers/net/hns3/hns3_ethdev.h @@ -155,7 +155,6 @@ struct hns3_tc_queue_info { struct hns3_cfg { uint8_t tc_num; - uint16_t tqp_desc_num; uint16_t rss_size_max; uint8_t phy_addr; uint8_t media_type; @@ -512,8 +511,6 @@ struct hns3_hw { uint16_t intr_tqps_num; /* num queue pairs mapping interrupt */ uint16_t rss_size_max; /* HW defined max RSS task queue */ uint16_t rx_buf_len; /* hold min hardware rx buf len */ - uint16_t num_tx_desc; /* desc num of per tx queue */ - uint16_t num_rx_desc; /* desc num of per rx queue */ uint32_t mng_entry_num; /* number of manager table entry */ uint32_t mac_entry_num; /* number of mac-vlan table entry */ diff --git a/drivers/net/hns3/hns3_ethdev_vf.c b/drivers/net/hns3/hns3_ethdev_vf.c index 58b4a107d3..0921534205 100644 --- a/drivers/net/hns3/hns3_ethdev_vf.c +++ b/drivers/net/hns3/hns3_ethdev_vf.c @@ -941,27 +941,6 @@ hns3vf_get_queue_info(struct hns3_hw *hw) return hns3vf_check_tqp_info(hw); } -static int -hns3vf_get_queue_depth(struct hns3_hw *hw) -{ -#define HNS3VF_TQPS_DEPTH_INFO_LEN 4 - uint8_t resp_msg[HNS3VF_TQPS_DEPTH_INFO_LEN]; - int ret; - - ret = hns3_send_mbx_msg(hw, HNS3_MBX_GET_QDEPTH, 0, NULL, 0, true, - resp_msg, HNS3VF_TQPS_DEPTH_INFO_LEN); - if (ret) { - PMD_INIT_LOG(ERR, "Failed to get tqp depth info from PF: %d", - ret); - return ret; - } - - memcpy(&hw->num_tx_desc, &resp_msg[0], sizeof(uint16_t)); - memcpy(&hw->num_rx_desc, &resp_msg[2], sizeof(uint16_t)); - - return 0; -} - static void hns3vf_update_caps(struct hns3_hw *hw, uint32_t caps) { @@ -1052,11 +1031,6 @@ hns3vf_get_configuration(struct hns3_hw *hw) if (ret) return ret; - /* Get queue depth info from PF */ - ret = hns3vf_get_queue_depth(hw); - if (ret) - return ret; - /* Get user defined VF MAC addr from PF */ ret = hns3vf_get_host_mac_addr(hw); if (ret) -- 2.33.0 ^ permalink raw reply [flat|nested] 38+ messages in thread
* [PATCH 10/15] net/hns3: remove the printing of memory addresses 2022-01-07 10:15 [PATCH 00/15] fix and feature for hns3 PMD Min Hu (Connor) ` (8 preceding siblings ...) 2022-01-07 10:15 ` [PATCH 09/15] net/hns3: remove the number of queue descriptors Min Hu (Connor) @ 2022-01-07 10:15 ` Min Hu (Connor) 2022-01-07 10:15 ` [PATCH 11/15] net/hns3: extract a common interface to obtain revision ID Min Hu (Connor) ` (6 subsequent siblings) 16 siblings, 0 replies; 38+ messages in thread From: Min Hu (Connor) @ 2022-01-07 10:15 UTC (permalink / raw) To: dev; +Cc: ferruh.yigit, thomas From: Huisong Li <lihuisong@huawei.com> Remove the printing of memory addresses. Signed-off-by: Huisong Li <lihuisong@huawei.com> --- drivers/net/hns3/hns3_cmd.c | 12 ++++-------- drivers/net/hns3/hns3_rxtx.c | 6 ------ 2 files changed, 4 insertions(+), 14 deletions(-) diff --git a/drivers/net/hns3/hns3_cmd.c b/drivers/net/hns3/hns3_cmd.c index 2ce59d8de6..96f8f38cbb 100644 --- a/drivers/net/hns3/hns3_cmd.c +++ b/drivers/net/hns3/hns3_cmd.c @@ -60,18 +60,14 @@ hns3_allocate_dma_mem(struct hns3_hw *hw, struct hns3_cmq_ring *ring, ring->desc = mz->addr; ring->desc_dma_addr = mz->iova; ring->zone = (const void *)mz; - hns3_dbg(hw, "memzone %s allocated with physical address: %" PRIu64, - mz->name, ring->desc_dma_addr); + hns3_dbg(hw, "cmd ring memzone name: %s", mz->name); return 0; } static void -hns3_free_dma_mem(struct hns3_hw *hw, struct hns3_cmq_ring *ring) +hns3_free_dma_mem(struct hns3_cmq_ring *ring) { - hns3_dbg(hw, "memzone %s to be freed with physical address: %" PRIu64, - ((const struct rte_memzone *)ring->zone)->name, - ring->desc_dma_addr); rte_memzone_free((const struct rte_memzone *)ring->zone); ring->buf_size = 0; ring->desc = NULL; @@ -93,10 +89,10 @@ hns3_alloc_cmd_desc(struct hns3_hw *hw, struct hns3_cmq_ring *ring) } static void -hns3_free_cmd_desc(struct hns3_hw *hw, struct hns3_cmq_ring *ring) +hns3_free_cmd_desc(__rte_unused struct hns3_hw *hw, struct hns3_cmq_ring *ring) { if (ring->desc) - hns3_free_dma_mem(hw, ring); + hns3_free_dma_mem(ring); } static int diff --git a/drivers/net/hns3/hns3_rxtx.c b/drivers/net/hns3/hns3_rxtx.c index f365daadf8..390ac3e905 100644 --- a/drivers/net/hns3/hns3_rxtx.c +++ b/drivers/net/hns3/hns3_rxtx.c @@ -1382,9 +1382,6 @@ hns3_alloc_rxq_and_dma_zone(struct rte_eth_dev *dev, rxq->rx_ring = (struct hns3_desc *)rx_mz->addr; rxq->rx_ring_phys_addr = rx_mz->iova; - hns3_dbg(hw, "No.%u rx descriptors iova 0x%" PRIx64, q_info->idx, - rxq->rx_ring_phys_addr); - return rxq; } @@ -1469,9 +1466,6 @@ hns3_alloc_txq_and_dma_zone(struct rte_eth_dev *dev, txq->tx_ring = (struct hns3_desc *)tx_mz->addr; txq->tx_ring_phys_addr = tx_mz->iova; - hns3_dbg(hw, "No.%u tx descriptors iova 0x%" PRIx64, q_info->idx, - txq->tx_ring_phys_addr); - /* Clear tx bd */ desc = txq->tx_ring; for (i = 0; i < txq->nb_tx_desc; i++) { -- 2.33.0 ^ permalink raw reply [flat|nested] 38+ messages in thread
* [PATCH 11/15] net/hns3: extract a common interface to obtain revision ID 2022-01-07 10:15 [PATCH 00/15] fix and feature for hns3 PMD Min Hu (Connor) ` (9 preceding siblings ...) 2022-01-07 10:15 ` [PATCH 10/15] net/hns3: remove the printing of memory addresses Min Hu (Connor) @ 2022-01-07 10:15 ` Min Hu (Connor) 2022-01-07 10:15 ` [PATCH 12/15] net/hns3: remove invalid encapsulation function Min Hu (Connor) ` (5 subsequent siblings) 16 siblings, 0 replies; 38+ messages in thread From: Min Hu (Connor) @ 2022-01-07 10:15 UTC (permalink / raw) To: dev; +Cc: ferruh.yigit, thomas From: Huisong Li <lihuisong@huawei.com> The code logic of obtaining the revision ID of PCI device is the same for PF and VF driver. This patch extracts a common interface to do it. Signed-off-by: Huisong Li <lihuisong@huawei.com> --- drivers/net/hns3/hns3_common.c | 22 ++++++++++++++++++++++ drivers/net/hns3/hns3_common.h | 2 ++ drivers/net/hns3/hns3_ethdev.c | 16 ++++------------ drivers/net/hns3/hns3_ethdev_vf.c | 21 ++++----------------- 4 files changed, 32 insertions(+), 29 deletions(-) diff --git a/drivers/net/hns3/hns3_common.c b/drivers/net/hns3/hns3_common.c index cb581bb25a..1878bedf6c 100644 --- a/drivers/net/hns3/hns3_common.c +++ b/drivers/net/hns3/hns3_common.c @@ -815,3 +815,25 @@ hns3_restore_rx_interrupt(struct hns3_hw *hw) return 0; } + +int +hns3_get_pci_revision_id(struct hns3_hw *hw, uint8_t *revision_id) +{ + struct rte_pci_device *pci_dev; + struct rte_eth_dev *eth_dev; + uint8_t revision; + int ret; + + eth_dev = &rte_eth_devices[hw->data->port_id]; + pci_dev = RTE_ETH_DEV_TO_PCI(eth_dev); + ret = rte_pci_read_config(pci_dev, &revision, HNS3_PCI_REVISION_ID_LEN, + HNS3_PCI_REVISION_ID); + if (ret != HNS3_PCI_REVISION_ID_LEN) { + hns3_err(hw, "failed to read pci revision id, ret = %d", ret); + return -EIO; + } + + *revision_id = revision; + + return 0; +} diff --git a/drivers/net/hns3/hns3_common.h b/drivers/net/hns3/hns3_common.h index a9e8a9cccf..2994e4a269 100644 --- a/drivers/net/hns3/hns3_common.h +++ b/drivers/net/hns3/hns3_common.h @@ -59,4 +59,6 @@ int hns3_map_rx_interrupt(struct rte_eth_dev *dev); void hns3_unmap_rx_interrupt(struct rte_eth_dev *dev); int hns3_restore_rx_interrupt(struct hns3_hw *hw); +int hns3_get_pci_revision_id(struct hns3_hw *hw, uint8_t *revision_id); + #endif /* _HNS3_COMMON_H_ */ diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c index 1deba2a055..a4ed08b52b 100644 --- a/drivers/net/hns3/hns3_ethdev.c +++ b/drivers/net/hns3/hns3_ethdev.c @@ -5,7 +5,6 @@ #include <rte_alarm.h> #include <rte_bus_pci.h> #include <ethdev_pci.h> -#include <rte_pci.h> #include "hns3_ethdev.h" #include "hns3_common.h" @@ -2738,7 +2737,6 @@ hns3_get_capability(struct hns3_hw *hw) struct hns3_pf *pf = &hns->pf; struct rte_eth_dev *eth_dev; uint16_t device_id; - uint8_t revision; int ret; eth_dev = &rte_eth_devices[hw->data->port_id]; @@ -2751,17 +2749,11 @@ hns3_get_capability(struct hns3_hw *hw) device_id == HNS3_DEV_ID_200G_RDMA) hns3_set_bit(hw->capability, HNS3_DEV_SUPPORT_DCB_B, 1); - /* Get PCI revision id */ - ret = rte_pci_read_config(pci_dev, &revision, HNS3_PCI_REVISION_ID_LEN, - HNS3_PCI_REVISION_ID); - if (ret != HNS3_PCI_REVISION_ID_LEN) { - PMD_INIT_LOG(ERR, "failed to read pci revision id, ret = %d", - ret); - return -EIO; - } - hw->revision = revision; + ret = hns3_get_pci_revision_id(hw, &hw->revision); + if (ret) + return ret; - if (revision < PCI_REVISION_ID_HIP09_A) { + if (hw->revision < PCI_REVISION_ID_HIP09_A) { hns3_set_default_dev_specifications(hw); hw->intr.mapping_mode = HNS3_INTR_MAPPING_VEC_RSV_ONE; hw->intr.gl_unit = HNS3_INTR_COALESCE_GL_UINT_2US; diff --git a/drivers/net/hns3/hns3_ethdev_vf.c b/drivers/net/hns3/hns3_ethdev_vf.c index 0921534205..18abf9b109 100644 --- a/drivers/net/hns3/hns3_ethdev_vf.c +++ b/drivers/net/hns3/hns3_ethdev_vf.c @@ -6,7 +6,6 @@ #include <rte_alarm.h> #include <ethdev_pci.h> #include <rte_io.h> -#include <rte_pci.h> #include <rte_vfio.h> #include "hns3_ethdev.h" @@ -810,25 +809,13 @@ hns3vf_get_push_lsc_cap(struct hns3_hw *hw) static int hns3vf_get_capability(struct hns3_hw *hw) { - struct rte_pci_device *pci_dev; - struct rte_eth_dev *eth_dev; - uint8_t revision; int ret; - eth_dev = &rte_eth_devices[hw->data->port_id]; - pci_dev = RTE_ETH_DEV_TO_PCI(eth_dev); - - /* Get PCI revision id */ - ret = rte_pci_read_config(pci_dev, &revision, HNS3_PCI_REVISION_ID_LEN, - HNS3_PCI_REVISION_ID); - if (ret != HNS3_PCI_REVISION_ID_LEN) { - PMD_INIT_LOG(ERR, "failed to read pci revision id, ret = %d", - ret); - return -EIO; - } - hw->revision = revision; + ret = hns3_get_pci_revision_id(hw, &hw->revision); + if (ret) + return ret; - if (revision < PCI_REVISION_ID_HIP09_A) { + if (hw->revision < PCI_REVISION_ID_HIP09_A) { hns3vf_set_default_dev_specifications(hw); hw->intr.mapping_mode = HNS3_INTR_MAPPING_VEC_RSV_ONE; hw->intr.gl_unit = HNS3_INTR_COALESCE_GL_UINT_2US; -- 2.33.0 ^ permalink raw reply [flat|nested] 38+ messages in thread
* [PATCH 12/15] net/hns3: remove invalid encapsulation function 2022-01-07 10:15 [PATCH 00/15] fix and feature for hns3 PMD Min Hu (Connor) ` (10 preceding siblings ...) 2022-01-07 10:15 ` [PATCH 11/15] net/hns3: extract a common interface to obtain revision ID Min Hu (Connor) @ 2022-01-07 10:15 ` Min Hu (Connor) 2022-01-07 10:15 ` [PATCH 13/15] net/hns3: delete strerror invoke Min Hu (Connor) ` (4 subsequent siblings) 16 siblings, 0 replies; 38+ messages in thread From: Min Hu (Connor) @ 2022-01-07 10:15 UTC (permalink / raw) To: dev; +Cc: ferruh.yigit, thomas From: Chengwen Feng <fengchengwen@huawei.com> This patch remove invalid encapsulation functions. Signed-off-by: Chengwen Feng <fengchengwen@huawei.com> --- drivers/net/hns3/hns3_ethdev.c | 27 ++++++++------------------- drivers/net/hns3/hns3_ethdev_vf.c | 13 ++----------- 2 files changed, 10 insertions(+), 30 deletions(-) diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c index a4ed08b52b..a876afe3c3 100644 --- a/drivers/net/hns3/hns3_ethdev.c +++ b/drivers/net/hns3/hns3_ethdev.c @@ -593,22 +593,6 @@ hns3_set_vlan_rx_offload_cfg(struct hns3_adapter *hns, return ret; } -static void -hns3_update_rx_offload_cfg(struct hns3_adapter *hns, - struct hns3_rx_vtag_cfg *vcfg) -{ - struct hns3_pf *pf = &hns->pf; - memcpy(&pf->vtag_config.rx_vcfg, vcfg, sizeof(pf->vtag_config.rx_vcfg)); -} - -static void -hns3_update_tx_offload_cfg(struct hns3_adapter *hns, - struct hns3_tx_vtag_cfg *vcfg) -{ - struct hns3_pf *pf = &hns->pf; - memcpy(&pf->vtag_config.tx_vcfg, vcfg, sizeof(pf->vtag_config.tx_vcfg)); -} - static int hns3_en_hw_strip_rxvtag(struct hns3_adapter *hns, bool enable) { @@ -638,7 +622,8 @@ hns3_en_hw_strip_rxvtag(struct hns3_adapter *hns, bool enable) return ret; } - hns3_update_rx_offload_cfg(hns, &rxvlan_cfg); + memcpy(&hns->pf.vtag_config.rx_vcfg, &rxvlan_cfg, + sizeof(struct hns3_rx_vtag_cfg)); return ret; } @@ -836,7 +821,9 @@ hns3_vlan_txvlan_cfg(struct hns3_adapter *hns, uint16_t port_base_vlan_state, return ret; } - hns3_update_tx_offload_cfg(hns, &txvlan_cfg); + memcpy(&hns->pf.vtag_config.tx_vcfg, &txvlan_cfg, + sizeof(struct hns3_tx_vtag_cfg)); + return ret; } @@ -962,7 +949,9 @@ hns3_en_pvid_strip(struct hns3_adapter *hns, int on) if (ret) return ret; - hns3_update_rx_offload_cfg(hns, &rx_vlan_cfg); + memcpy(&hns->pf.vtag_config.rx_vcfg, &rx_vlan_cfg, + sizeof(struct hns3_rx_vtag_cfg)); + return ret; } diff --git a/drivers/net/hns3/hns3_ethdev_vf.c b/drivers/net/hns3/hns3_ethdev_vf.c index 18abf9b109..0842631e9c 100644 --- a/drivers/net/hns3/hns3_ethdev_vf.c +++ b/drivers/net/hns3/hns3_ethdev_vf.c @@ -1026,15 +1026,6 @@ hns3vf_get_configuration(struct hns3_hw *hw) return hns3vf_get_port_base_vlan_filter_state(hw); } -static int -hns3vf_set_tc_queue_mapping(struct hns3_adapter *hns, uint16_t nb_rx_q, - uint16_t nb_tx_q) -{ - struct hns3_hw *hw = &hns->hw; - - return hns3_queue_to_tc_mapping(hw, nb_rx_q, nb_tx_q); -} - static void hns3vf_request_link_info(struct hns3_hw *hw) { @@ -1530,7 +1521,7 @@ hns3vf_init_vf(struct rte_eth_dev *eth_dev) goto err_set_tc_queue; } - ret = hns3vf_set_tc_queue_mapping(hns, hw->tqps_num, hw->tqps_num); + ret = hns3_queue_to_tc_mapping(hw, hw->tqps_num, hw->tqps_num); if (ret) { PMD_INIT_LOG(ERR, "failed to set tc info, ret = %d.", ret); goto err_set_tc_queue; @@ -1739,7 +1730,7 @@ hns3vf_do_start(struct hns3_adapter *hns, bool reset_queue) uint16_t nb_tx_q = hw->data->nb_tx_queues; int ret; - ret = hns3vf_set_tc_queue_mapping(hns, nb_rx_q, nb_tx_q); + ret = hns3_queue_to_tc_mapping(hw, nb_rx_q, nb_tx_q); if (ret) return ret; -- 2.33.0 ^ permalink raw reply [flat|nested] 38+ messages in thread
* [PATCH 13/15] net/hns3: delete strerror invoke 2022-01-07 10:15 [PATCH 00/15] fix and feature for hns3 PMD Min Hu (Connor) ` (11 preceding siblings ...) 2022-01-07 10:15 ` [PATCH 12/15] net/hns3: remove invalid encapsulation function Min Hu (Connor) @ 2022-01-07 10:15 ` Min Hu (Connor) 2022-01-07 10:15 ` [PATCH 14/15] net/hns3: rename function Min Hu (Connor) ` (3 subsequent siblings) 16 siblings, 0 replies; 38+ messages in thread From: Min Hu (Connor) @ 2022-01-07 10:15 UTC (permalink / raw) To: dev; +Cc: ferruh.yigit, thomas From: Chengwen Feng <fengchengwen@huawei.com> This patch delete strerror invoke which was non-reentrant. Signed-off-by: Chengwen Feng <fengchengwen@huawei.com> --- drivers/net/hns3/hns3_fdir.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/net/hns3/hns3_fdir.c b/drivers/net/hns3/hns3_fdir.c index d043f5786d..2a7978ac07 100644 --- a/drivers/net/hns3/hns3_fdir.c +++ b/drivers/net/hns3/hns3_fdir.c @@ -919,8 +919,7 @@ static int hns3_insert_fdir_filter(struct hns3_hw *hw, sig = rte_hash_crc(key, sizeof(*key), 0); ret = rte_hash_add_key_with_hash(fdir_info->hash_handle, key, sig); if (ret < 0) { - hns3_err(hw, "Hash table full? err:%d(%s)!", ret, - strerror(-ret)); + hns3_err(hw, "Hash table full? err:%d!", ret); return ret; } -- 2.33.0 ^ permalink raw reply [flat|nested] 38+ messages in thread
* [PATCH 14/15] net/hns3: rename function 2022-01-07 10:15 [PATCH 00/15] fix and feature for hns3 PMD Min Hu (Connor) ` (12 preceding siblings ...) 2022-01-07 10:15 ` [PATCH 13/15] net/hns3: delete strerror invoke Min Hu (Connor) @ 2022-01-07 10:15 ` Min Hu (Connor) 2022-01-07 10:15 ` [PATCH 15/15] net/hns3: support indirect counter action Min Hu (Connor) ` (2 subsequent siblings) 16 siblings, 0 replies; 38+ messages in thread From: Min Hu (Connor) @ 2022-01-07 10:15 UTC (permalink / raw) To: dev; +Cc: ferruh.yigit, thomas From: Chengwen Feng <fengchengwen@huawei.com> This patch rename hns3_parse_rss_key with hns3_adjust_rss_key to improve readability. Signed-off-by: Chengwen Feng <fengchengwen@huawei.com> --- drivers/net/hns3/hns3_flow.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/hns3/hns3_flow.c b/drivers/net/hns3/hns3_flow.c index 2ee21190fb..e669bfae32 100644 --- a/drivers/net/hns3/hns3_flow.c +++ b/drivers/net/hns3/hns3_flow.c @@ -1405,7 +1405,7 @@ hns3_disable_rss(struct hns3_hw *hw) } static void -hns3_parse_rss_key(struct hns3_hw *hw, struct rte_flow_action_rss *rss_conf) +hns3_adjust_rss_key(struct hns3_hw *hw, struct rte_flow_action_rss *rss_conf) { if (rss_conf->key == NULL || rss_conf->key_len < HNS3_RSS_KEY_SIZE) { hns3_warn(hw, "Default RSS hash key to be set"); @@ -1449,7 +1449,7 @@ hns3_hw_rss_hash_set(struct hns3_hw *hw, struct rte_flow_action_rss *rss_config) struct hns3_rss_tuple_cfg *tuple; int ret; - hns3_parse_rss_key(hw, rss_config); + hns3_adjust_rss_key(hw, rss_config); ret = hns3_parse_rss_algorithm(hw, &rss_config->func, &hw->rss_info.hash_algo); -- 2.33.0 ^ permalink raw reply [flat|nested] 38+ messages in thread
* [PATCH 15/15] net/hns3: support indirect counter action 2022-01-07 10:15 [PATCH 00/15] fix and feature for hns3 PMD Min Hu (Connor) ` (13 preceding siblings ...) 2022-01-07 10:15 ` [PATCH 14/15] net/hns3: rename function Min Hu (Connor) @ 2022-01-07 10:15 ` Min Hu (Connor) 2022-01-21 17:29 ` [PATCH 00/15] fix and feature for hns3 PMD Ferruh Yigit 2022-01-22 1:51 ` [PATCH v2 " Min Hu (Connor) 16 siblings, 0 replies; 38+ messages in thread From: Min Hu (Connor) @ 2022-01-07 10:15 UTC (permalink / raw) To: dev; +Cc: ferruh.yigit, thomas From: Chengwen Feng <fengchengwen@huawei.com> This patch support indirect counter action because the shared counter attribute has been deprecated in DPDK 21.11. Signed-off-by: Chengwen Feng <fengchengwen@huawei.com> --- drivers/net/hns3/hns3_fdir.h | 1 + drivers/net/hns3/hns3_flow.c | 222 +++++++++++++++++++++++++++++++++-- drivers/net/hns3/hns3_flow.h | 11 +- 3 files changed, 224 insertions(+), 10 deletions(-) diff --git a/drivers/net/hns3/hns3_fdir.h b/drivers/net/hns3/hns3_fdir.h index f9efff3b52..3376c40c8e 100644 --- a/drivers/net/hns3/hns3_fdir.h +++ b/drivers/net/hns3/hns3_fdir.h @@ -125,6 +125,7 @@ struct hns3_fd_ad_data { #define HNS3_RULE_FLAG_FDID 0x1 #define HNS3_RULE_FLAG_VF_ID 0x2 #define HNS3_RULE_FLAG_COUNTER 0x4 +#define HNS3_RULE_FLAG_COUNTER_INDIR 0x8 struct hns3_fdir_key_conf { struct hns3_fd_rule_tuples spec; diff --git a/drivers/net/hns3/hns3_flow.c b/drivers/net/hns3/hns3_flow.c index e669bfae32..c917b84606 100644 --- a/drivers/net/hns3/hns3_flow.c +++ b/drivers/net/hns3/hns3_flow.c @@ -154,7 +154,7 @@ hns3_counter_lookup(struct rte_eth_dev *dev, uint32_t id) } static int -hns3_counter_new(struct rte_eth_dev *dev, uint32_t shared, uint32_t id, +hns3_counter_new(struct rte_eth_dev *dev, uint32_t indirect, uint32_t id, struct rte_flow_error *error) { struct hns3_adapter *hns = dev->data->dev_private; @@ -166,11 +166,14 @@ hns3_counter_new(struct rte_eth_dev *dev, uint32_t shared, uint32_t id, cnt = hns3_counter_lookup(dev, id); if (cnt) { - if (!cnt->shared || cnt->shared != shared) + if (!cnt->indirect || cnt->indirect != indirect) return rte_flow_error_set(error, ENOTSUP, RTE_FLOW_ERROR_TYPE_ACTION_CONF, cnt, - "Counter id is used, shared flag not match"); + "Counter id is used, indirect flag not match"); + /* Clear the indirect counter on first use. */ + if (cnt->indirect && cnt->ref_cnt == 1) + (void)hns3_get_count(hw, id, &value); cnt->ref_cnt++; return 0; } @@ -188,7 +191,7 @@ hns3_counter_new(struct rte_eth_dev *dev, uint32_t shared, uint32_t id, RTE_FLOW_ERROR_TYPE_HANDLE, cnt, "Alloc mem for counter failed"); cnt->id = id; - cnt->shared = shared; + cnt->indirect = indirect; cnt->ref_cnt = 1; cnt->hits = 0; LIST_INSERT_HEAD(&pf->flow_counters, cnt, next); @@ -253,16 +256,30 @@ hns3_counter_release(struct rte_eth_dev *dev, uint32_t id) static void hns3_counter_flush(struct rte_eth_dev *dev) { - struct hns3_adapter *hns = dev->data->dev_private; - struct hns3_pf *pf = &hns->pf; + struct hns3_pf *pf = HNS3_DEV_PRIVATE_TO_PF(dev->data->dev_private); + LIST_HEAD(counters, hns3_flow_counter) indir_counters; struct hns3_flow_counter *cnt_ptr; + LIST_INIT(&indir_counters); cnt_ptr = LIST_FIRST(&pf->flow_counters); while (cnt_ptr) { LIST_REMOVE(cnt_ptr, next); - rte_free(cnt_ptr); + if (cnt_ptr->indirect) + LIST_INSERT_HEAD(&indir_counters, cnt_ptr, next); + else + rte_free(cnt_ptr); cnt_ptr = LIST_FIRST(&pf->flow_counters); } + + /* Reset the indirect action and add to pf->flow_counters list. */ + cnt_ptr = LIST_FIRST(&indir_counters); + while (cnt_ptr) { + LIST_REMOVE(cnt_ptr, next); + cnt_ptr->ref_cnt = 1; + cnt_ptr->hits = 0; + LIST_INSERT_HEAD(&pf->flow_counters, cnt_ptr, next); + cnt_ptr = LIST_FIRST(&indir_counters); + } } static int @@ -332,6 +349,30 @@ hns3_handle_action_queue_region(struct rte_eth_dev *dev, return 0; } +static int +hns3_handle_action_indirect(struct rte_eth_dev *dev, + const struct rte_flow_action *action, + struct hns3_fdir_rule *rule, + struct rte_flow_error *error) +{ + const struct rte_flow_action_handle *indir = action->conf; + + if (indir->indirect_type != HNS3_INDIRECT_ACTION_TYPE_COUNT) + return rte_flow_error_set(error, EINVAL, + RTE_FLOW_ERROR_TYPE_ACTION_CONF, + action, "Invalid indirect type"); + + if (hns3_counter_lookup(dev, indir->counter_id) == NULL) + return rte_flow_error_set(error, EINVAL, + RTE_FLOW_ERROR_TYPE_ACTION_CONF, + action, "Counter id not exist"); + + rule->act_cnt.id = indir->counter_id; + rule->flags |= (HNS3_RULE_FLAG_COUNTER | HNS3_RULE_FLAG_COUNTER_INDIR); + + return 0; +} + /* * Parse actions structure from the provided pattern. * The pattern is validated as the items are copied. @@ -403,6 +444,13 @@ hns3_handle_actions(struct rte_eth_dev *dev, "Invalid counter id"); rule->act_cnt = *act_count; rule->flags |= HNS3_RULE_FLAG_COUNTER; + rule->flags &= ~HNS3_RULE_FLAG_COUNTER_INDIR; + break; + case RTE_FLOW_ACTION_TYPE_INDIRECT: + ret = hns3_handle_action_indirect(dev, actions, rule, + error); + if (ret) + return ret; break; case RTE_FLOW_ACTION_TYPE_VOID: break; @@ -1755,6 +1803,7 @@ hns3_flow_create_fdir_rule(struct rte_eth_dev *dev, struct hns3_adapter *hns = HNS3_DEV_HW_TO_ADAPTER(hw); struct hns3_fdir_rule_ele *fdir_rule_ptr; struct hns3_fdir_rule fdir_rule; + bool indir; int ret; memset(&fdir_rule, 0, sizeof(struct hns3_fdir_rule)); @@ -1762,9 +1811,10 @@ hns3_flow_create_fdir_rule(struct rte_eth_dev *dev, if (ret != 0) return ret; + indir = !!(fdir_rule.flags & HNS3_RULE_FLAG_COUNTER_INDIR); if (fdir_rule.flags & HNS3_RULE_FLAG_COUNTER) { - ret = hns3_counter_new(dev, fdir_rule.act_cnt.shared, - fdir_rule.act_cnt.id, error); + ret = hns3_counter_new(dev, indir, fdir_rule.act_cnt.id, + error); if (ret != 0) return ret; @@ -2086,6 +2136,157 @@ hns3_flow_query_wrap(struct rte_eth_dev *dev, struct rte_flow *flow, return ret; } +static int +hns3_check_indir_action(const struct rte_flow_indir_action_conf *conf, + const struct rte_flow_action *action, + struct rte_flow_error *error) +{ + if (!conf->ingress) + return rte_flow_error_set(error, EINVAL, + RTE_FLOW_ERROR_TYPE_ACTION, + NULL, "Indir action ingress can't be zero"); + + if (conf->egress) + return rte_flow_error_set(error, EINVAL, + RTE_FLOW_ERROR_TYPE_ACTION, + NULL, "Indir action not support egress"); + + if (conf->transfer) + return rte_flow_error_set(error, EINVAL, + RTE_FLOW_ERROR_TYPE_ACTION, + NULL, "Indir action not support transfer"); + + if (action->type != RTE_FLOW_ACTION_TYPE_COUNT) + return rte_flow_error_set(error, EINVAL, + RTE_FLOW_ERROR_TYPE_ACTION, + NULL, "Indir action only support count"); + + return 0; +} + +static struct rte_flow_action_handle * +hns3_flow_action_create(struct rte_eth_dev *dev, + const struct rte_flow_indir_action_conf *conf, + const struct rte_flow_action *action, + struct rte_flow_error *error) +{ + struct hns3_hw *hw = HNS3_DEV_PRIVATE_TO_HW(dev->data->dev_private); + struct hns3_pf *pf = HNS3_DEV_PRIVATE_TO_PF(dev->data->dev_private); + const struct rte_flow_action_count *act_count; + struct rte_flow_action_handle *handle = NULL; + struct hns3_flow_counter *counter; + + if (hns3_check_indir_action(conf, action, error)) + return NULL; + + handle = rte_zmalloc("hns3 action handle", + sizeof(struct rte_flow_action_handle), 0); + if (handle == NULL) { + rte_flow_error_set(error, ENOMEM, RTE_FLOW_ERROR_TYPE_HANDLE, + NULL, "Failed to allocate action memory"); + return NULL; + } + + pthread_mutex_lock(&hw->flows_lock); + + act_count = (const struct rte_flow_action_count *)action->conf; + if (act_count->id >= pf->fdir.fd_cfg.cnt_num[HNS3_FD_STAGE_1]) { + rte_flow_error_set(error, EINVAL, + RTE_FLOW_ERROR_TYPE_ACTION_CONF, + action, "Invalid counter id"); + goto err_exit; + } + + if (hns3_counter_new(dev, false, act_count->id, error)) + goto err_exit; + + counter = hns3_counter_lookup(dev, act_count->id); + if (counter == NULL) { + rte_flow_error_set(error, EINVAL, + RTE_FLOW_ERROR_TYPE_ACTION_CONF, + action, "Counter id not found"); + goto err_exit; + } + + counter->indirect = true; + handle->indirect_type = HNS3_INDIRECT_ACTION_TYPE_COUNT; + handle->counter_id = counter->id; + + pthread_mutex_unlock(&hw->flows_lock); + return handle; + +err_exit: + pthread_mutex_unlock(&hw->flows_lock); + rte_free(handle); + return NULL; +} + +static int +hns3_flow_action_destroy(struct rte_eth_dev *dev, + struct rte_flow_action_handle *handle, + struct rte_flow_error *error) +{ + struct hns3_hw *hw = HNS3_DEV_PRIVATE_TO_HW(dev->data->dev_private); + struct hns3_flow_counter *counter; + + pthread_mutex_lock(&hw->flows_lock); + + if (handle->indirect_type != HNS3_INDIRECT_ACTION_TYPE_COUNT) { + pthread_mutex_unlock(&hw->flows_lock); + return rte_flow_error_set(error, EINVAL, + RTE_FLOW_ERROR_TYPE_ACTION_CONF, + handle, "Invalid indirect type"); + } + + counter = hns3_counter_lookup(dev, handle->counter_id); + if (counter == NULL) { + pthread_mutex_unlock(&hw->flows_lock); + return rte_flow_error_set(error, EINVAL, + RTE_FLOW_ERROR_TYPE_ACTION_CONF, + handle, "Counter id not exist"); + } + + if (counter->ref_cnt > 1) { + pthread_mutex_unlock(&hw->flows_lock); + return rte_flow_error_set(error, EBUSY, + RTE_FLOW_ERROR_TYPE_HANDLE, + handle, "Counter id in use"); + } + + (void)hns3_counter_release(dev, handle->counter_id); + rte_free(handle); + + pthread_mutex_unlock(&hw->flows_lock); + return 0; +} + +static int +hns3_flow_action_query(struct rte_eth_dev *dev, + const struct rte_flow_action_handle *handle, + void *data, + struct rte_flow_error *error) +{ + struct hns3_hw *hw = HNS3_DEV_PRIVATE_TO_HW(dev->data->dev_private); + struct rte_flow flow; + int ret; + + pthread_mutex_lock(&hw->flows_lock); + + if (handle->indirect_type != HNS3_INDIRECT_ACTION_TYPE_COUNT) { + pthread_mutex_unlock(&hw->flows_lock); + return rte_flow_error_set(error, EINVAL, + RTE_FLOW_ERROR_TYPE_ACTION_CONF, + handle, "Invalid indirect type"); + } + + memset(&flow, 0, sizeof(flow)); + flow.counter_id = handle->counter_id; + ret = hns3_counter_query(dev, &flow, + (struct rte_flow_query_count *)data, error); + pthread_mutex_unlock(&hw->flows_lock); + return ret; +} + static const struct rte_flow_ops hns3_flow_ops = { .validate = hns3_flow_validate_wrap, .create = hns3_flow_create_wrap, @@ -2093,6 +2294,9 @@ static const struct rte_flow_ops hns3_flow_ops = { .flush = hns3_flow_flush_wrap, .query = hns3_flow_query_wrap, .isolate = NULL, + .action_handle_create = hns3_flow_action_create, + .action_handle_destroy = hns3_flow_action_destroy, + .action_handle_query = hns3_flow_action_query, }; int diff --git a/drivers/net/hns3/hns3_flow.h b/drivers/net/hns3/hns3_flow.h index 2eb451b720..1ab3f9f5c6 100644 --- a/drivers/net/hns3/hns3_flow.h +++ b/drivers/net/hns3/hns3_flow.h @@ -9,7 +9,7 @@ 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 indirect:1; /* Indirect counter flag */ uint32_t ref_cnt:31; /* Reference counter. */ uint16_t id; /* Counter ID. */ uint64_t hits; /* Number of packets matched by the rule. */ @@ -33,6 +33,15 @@ struct hns3_flow_mem { struct rte_flow *flow; }; +enum { + HNS3_INDIRECT_ACTION_TYPE_COUNT = 1, +}; + +struct rte_flow_action_handle { + int indirect_type; + uint32_t counter_id; +}; + TAILQ_HEAD(hns3_rss_filter_list, hns3_rss_conf_ele); TAILQ_HEAD(hns3_flow_mem_list, hns3_flow_mem); -- 2.33.0 ^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [PATCH 00/15] fix and feature for hns3 PMD 2022-01-07 10:15 [PATCH 00/15] fix and feature for hns3 PMD Min Hu (Connor) ` (14 preceding siblings ...) 2022-01-07 10:15 ` [PATCH 15/15] net/hns3: support indirect counter action Min Hu (Connor) @ 2022-01-21 17:29 ` Ferruh Yigit 2022-01-22 1:52 ` Min Hu (Connor) 2022-01-22 1:51 ` [PATCH v2 " Min Hu (Connor) 16 siblings, 1 reply; 38+ messages in thread From: Ferruh Yigit @ 2022-01-21 17:29 UTC (permalink / raw) To: Min Hu (Connor), dev; +Cc: thomas On 1/7/2022 10:15 AM, Min Hu (Connor) wrote: > This patch contains 15 patches, which include fixing codecheck warning > ,code refactor and indirect counter action support. > > > Chengwen Feng (4): > net/hns3: remove invalid encapsulation function > net/hns3: delete strerror invoke > net/hns3: rename function > net/hns3: support indirect counter action > > Huisong Li (10): > net/hns3: remove unnecessary assignment > net/hns3: fix a misjudgment expression > net/hns3: extract a common API to initialize MAC addrs > net/hns3: remove unnecessary black lines > net/hns3: extract a function to handle reset fail > net/hns3: extract functions to create RSS and FDIR flow rule > net/hns3: remove unused variables > net/hns3: remove the number of queue descriptors > net/hns3: remove the printing of memory addresses > net/hns3: extract a common interface to obtain revision ID > > Jie Hai (1): > net/hns3: remove unnecessary 'inline' > Hi Connor, Patch by patch build fails, first failing patch is 7/15. Can you please fix it with a new version? ^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [PATCH 00/15] fix and feature for hns3 PMD 2022-01-21 17:29 ` [PATCH 00/15] fix and feature for hns3 PMD Ferruh Yigit @ 2022-01-22 1:52 ` Min Hu (Connor) 0 siblings, 0 replies; 38+ messages in thread From: Min Hu (Connor) @ 2022-01-22 1:52 UTC (permalink / raw) To: Ferruh Yigit, dev; +Cc: thomas Hi, Ferruh, fixed in v2, thanks. 在 2022/1/22 1:29, Ferruh Yigit 写道: > On 1/7/2022 10:15 AM, Min Hu (Connor) wrote: >> This patch contains 15 patches, which include fixing codecheck warning >> ,code refactor and indirect counter action support. >> >> >> Chengwen Feng (4): >> net/hns3: remove invalid encapsulation function >> net/hns3: delete strerror invoke >> net/hns3: rename function >> net/hns3: support indirect counter action >> >> Huisong Li (10): >> net/hns3: remove unnecessary assignment >> net/hns3: fix a misjudgment expression >> net/hns3: extract a common API to initialize MAC addrs >> net/hns3: remove unnecessary black lines >> net/hns3: extract a function to handle reset fail >> net/hns3: extract functions to create RSS and FDIR flow rule >> net/hns3: remove unused variables >> net/hns3: remove the number of queue descriptors >> net/hns3: remove the printing of memory addresses >> net/hns3: extract a common interface to obtain revision ID >> >> Jie Hai (1): >> net/hns3: remove unnecessary 'inline' >> > > Hi Connor, > > Patch by patch build fails, first failing patch is 7/15. > Can you please fix it with a new version? > . ^ permalink raw reply [flat|nested] 38+ messages in thread
* [PATCH v2 00/15] fix and feature for hns3 PMD 2022-01-07 10:15 [PATCH 00/15] fix and feature for hns3 PMD Min Hu (Connor) ` (15 preceding siblings ...) 2022-01-21 17:29 ` [PATCH 00/15] fix and feature for hns3 PMD Ferruh Yigit @ 2022-01-22 1:51 ` Min Hu (Connor) 2022-01-22 1:51 ` [PATCH v2 01/15] net/hns3: remove unnecessary assignment Min Hu (Connor) ` (15 more replies) 16 siblings, 16 replies; 38+ messages in thread From: Min Hu (Connor) @ 2022-01-22 1:51 UTC (permalink / raw) To: dev; +Cc: ferruh.yigit, andrew.rybchenko, thomas This patch contains 15 patches, which include fixing codecheck warning ,code refactor and indirect counter action support. Chengwen Feng (4): net/hns3: remove invalid encapsulation function net/hns3: delete strerror invoke net/hns3: rename function net/hns3: support indirect counter action Huisong Li (10): net/hns3: remove unnecessary assignment net/hns3: fix a misjudgment expression net/hns3: extract a common API to initialize MAC addrs net/hns3: remove unnecessary black lines net/hns3: extract a function to handle reset fail net/hns3: remove unused variables net/hns3: remove the number of queue descriptors net/hns3: remove the printing of memory addresses net/hns3: extract a common interface to obtain revision ID net/hns3: extract functions to create RSS and FDIR flow rule Jie Hai (1): net/hns3: remove unnecessary 'inline' V2: * fix compiling errors. drivers/net/hns3/hns3_cmd.c | 12 +- drivers/net/hns3/hns3_common.c | 76 ++++++ drivers/net/hns3/hns3_common.h | 3 + drivers/net/hns3/hns3_dcb.c | 12 +- drivers/net/hns3/hns3_ethdev.c | 85 ++----- drivers/net/hns3/hns3_ethdev.h | 5 - drivers/net/hns3/hns3_ethdev_vf.c | 93 +------ drivers/net/hns3/hns3_fdir.c | 3 +- drivers/net/hns3/hns3_fdir.h | 1 + drivers/net/hns3/hns3_flow.c | 399 ++++++++++++++++++++++++------ drivers/net/hns3/hns3_flow.h | 11 +- drivers/net/hns3/hns3_intr.c | 54 ++-- drivers/net/hns3/hns3_rxtx.c | 6 - drivers/net/hns3/hns3_rxtx.h | 2 - 14 files changed, 476 insertions(+), 286 deletions(-) -- 2.33.0 ^ permalink raw reply [flat|nested] 38+ messages in thread
* [PATCH v2 01/15] net/hns3: remove unnecessary assignment 2022-01-22 1:51 ` [PATCH v2 " Min Hu (Connor) @ 2022-01-22 1:51 ` Min Hu (Connor) 2022-01-22 1:51 ` [PATCH v2 02/15] net/hns3: fix a misjudgment expression Min Hu (Connor) ` (14 subsequent siblings) 15 siblings, 0 replies; 38+ messages in thread From: Min Hu (Connor) @ 2022-01-22 1:51 UTC (permalink / raw) To: dev; +Cc: ferruh.yigit, andrew.rybchenko, thomas From: Huisong Li <lihuisong@huawei.com> Remove unnecessary assignment. Signed-off-by: Huisong Li <lihuisong@huawei.com> --- drivers/net/hns3/hns3_flow.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/net/hns3/hns3_flow.c b/drivers/net/hns3/hns3_flow.c index 0dbc3f6502..5f2b279546 100644 --- a/drivers/net/hns3/hns3_flow.c +++ b/drivers/net/hns3/hns3_flow.c @@ -1890,7 +1890,6 @@ hns3_flow_destroy(struct rte_eth_dev *dev, struct rte_flow *flow, } } rte_free(flow); - flow = NULL; return 0; } -- 2.33.0 ^ permalink raw reply [flat|nested] 38+ messages in thread
* [PATCH v2 02/15] net/hns3: fix a misjudgment expression 2022-01-22 1:51 ` [PATCH v2 " Min Hu (Connor) 2022-01-22 1:51 ` [PATCH v2 01/15] net/hns3: remove unnecessary assignment Min Hu (Connor) @ 2022-01-22 1:51 ` Min Hu (Connor) 2022-01-22 1:51 ` [PATCH v2 03/15] net/hns3: extract a common API to initialize MAC addrs Min Hu (Connor) ` (13 subsequent siblings) 15 siblings, 0 replies; 38+ messages in thread From: Min Hu (Connor) @ 2022-01-22 1:51 UTC (permalink / raw) To: dev; +Cc: ferruh.yigit, andrew.rybchenko, thomas From: Huisong Li <lihuisong@huawei.com> The enum type variables cannot be used as bool variables. This patch fixes for "with->func" in hns3_action_rss_same(). Fixes: eb158fc756a5 ("net/hns3: fix config when creating RSS rule after flush") Cc: stable@dpdk.org Signed-off-by: Huisong Li <lihuisong@huawei.com> --- drivers/net/hns3/hns3_flow.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/net/hns3/hns3_flow.c b/drivers/net/hns3/hns3_flow.c index 5f2b279546..00084872ad 100644 --- a/drivers/net/hns3/hns3_flow.c +++ b/drivers/net/hns3/hns3_flow.c @@ -1251,7 +1251,8 @@ hns3_action_rss_same(const struct rte_flow_action_rss *comp, if (comp->func == RTE_ETH_HASH_FUNCTION_MAX) func_is_same = false; else - func_is_same = with->func ? (comp->func == with->func) : true; + func_is_same = (with->func != RTE_ETH_HASH_FUNCTION_DEFAULT) ? + (comp->func == with->func) : true; return (func_is_same && comp->types == (with->types & HNS3_ETH_RSS_SUPPORT) && -- 2.33.0 ^ permalink raw reply [flat|nested] 38+ messages in thread
* [PATCH v2 03/15] net/hns3: extract a common API to initialize MAC addrs 2022-01-22 1:51 ` [PATCH v2 " Min Hu (Connor) 2022-01-22 1:51 ` [PATCH v2 01/15] net/hns3: remove unnecessary assignment Min Hu (Connor) 2022-01-22 1:51 ` [PATCH v2 02/15] net/hns3: fix a misjudgment expression Min Hu (Connor) @ 2022-01-22 1:51 ` Min Hu (Connor) 2022-01-22 1:51 ` [PATCH v2 04/15] net/hns3: remove unnecessary 'inline' Min Hu (Connor) ` (12 subsequent siblings) 15 siblings, 0 replies; 38+ messages in thread From: Min Hu (Connor) @ 2022-01-22 1:51 UTC (permalink / raw) To: dev; +Cc: ferruh.yigit, andrew.rybchenko, thomas From: Huisong Li <lihuisong@huawei.com> The code logic to initialize "data->mac_addrs" for PF and VF is similar. This patch extracts a common API to initialize it to improve code maintainabiliy. Signed-off-by: Huisong Li <lihuisong@huawei.com> --- drivers/net/hns3/hns3_common.c | 54 +++++++++++++++++++++++++++++++ drivers/net/hns3/hns3_common.h | 1 + drivers/net/hns3/hns3_ethdev.c | 31 +++--------------- drivers/net/hns3/hns3_ethdev_vf.c | 33 +++---------------- 4 files changed, 63 insertions(+), 56 deletions(-) diff --git a/drivers/net/hns3/hns3_common.c b/drivers/net/hns3/hns3_common.c index 0bb552ea3e..b5ac6313ff 100644 --- a/drivers/net/hns3/hns3_common.c +++ b/drivers/net/hns3/hns3_common.c @@ -581,6 +581,60 @@ hns3_remove_mac_addr(struct rte_eth_dev *dev, uint32_t idx) } } +int +hns3_init_mac_addrs(struct rte_eth_dev *dev) +{ + struct hns3_hw *hw = HNS3_DEV_PRIVATE_TO_HW(dev->data->dev_private); + struct hns3_adapter *hns = HNS3_DEV_HW_TO_ADAPTER(hw); + const char *memory_name = hns->is_vf ? "hns3vf-mac" : "hns3-mac"; + uint16_t mac_addrs_capa = hns->is_vf ? HNS3_VF_UC_MACADDR_NUM : + HNS3_UC_MACADDR_NUM; + char mac_str[RTE_ETHER_ADDR_FMT_SIZE]; + struct rte_ether_addr *eth_addr; + + /* Allocate memory for storing MAC addresses */ + dev->data->mac_addrs = rte_zmalloc(memory_name, + sizeof(struct rte_ether_addr) * mac_addrs_capa, + 0); + if (dev->data->mac_addrs == NULL) { + hns3_err(hw, "failed to allocate %zx bytes needed to store MAC addresses", + sizeof(struct rte_ether_addr) * mac_addrs_capa); + return -ENOMEM; + } + + eth_addr = (struct rte_ether_addr *)hw->mac.mac_addr; + if (!hns->is_vf) { + if (!rte_is_valid_assigned_ether_addr(eth_addr)) { + rte_eth_random_addr(hw->mac.mac_addr); + hns3_ether_format_addr(mac_str, RTE_ETHER_ADDR_FMT_SIZE, + (struct rte_ether_addr *)hw->mac.mac_addr); + hns3_warn(hw, "default mac_addr from firmware is an invalid " + "unicast address, using random MAC address %s", + mac_str); + } + } else { + /* + * The hns3 PF ethdev driver in kernel support setting VF MAC + * address on the host by "ip link set ..." command. To avoid + * some incorrect scenes, for example, hns3 VF PMD driver fails + * to receive and send packets after user configure the MAC + * address by using the "ip link set ..." command, hns3 VF PMD + * driver keep the same MAC address strategy as the hns3 kernel + * ethdev driver in the initialization. If user configure a MAC + * address by the ip command for VF device, then hns3 VF PMD + * driver will start with it, otherwise start with a random MAC + * address in the initialization. + */ + if (rte_is_zero_ether_addr(eth_addr)) + rte_eth_random_addr(hw->mac.mac_addr); + } + + rte_ether_addr_copy((struct rte_ether_addr *)hw->mac.mac_addr, + &dev->data->mac_addrs[0]); + + return 0; +} + int hns3_init_ring_with_vector(struct hns3_hw *hw) { diff --git a/drivers/net/hns3/hns3_common.h b/drivers/net/hns3/hns3_common.h index 0dbb1c0413..a9e8a9cccf 100644 --- a/drivers/net/hns3/hns3_common.h +++ b/drivers/net/hns3/hns3_common.h @@ -52,6 +52,7 @@ int hns3_set_mc_mac_addr_list(struct rte_eth_dev *dev, uint32_t nb_mc_addr); void hns3_ether_format_addr(char *buf, uint16_t size, const struct rte_ether_addr *ether_addr); +int hns3_init_mac_addrs(struct rte_eth_dev *dev); int hns3_init_ring_with_vector(struct hns3_hw *hw); int hns3_map_rx_interrupt(struct rte_eth_dev *dev); diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c index 3b897492d3..56beb8972a 100644 --- a/drivers/net/hns3/hns3_ethdev.c +++ b/drivers/net/hns3/hns3_ethdev.c @@ -6623,8 +6623,6 @@ static int hns3_dev_init(struct rte_eth_dev *eth_dev) { struct hns3_adapter *hns = eth_dev->data->dev_private; - char mac_str[RTE_ETHER_ADDR_FMT_SIZE]; - struct rte_ether_addr *eth_addr; struct hns3_hw *hw = &hns->hw; int ret; @@ -6667,30 +6665,9 @@ hns3_dev_init(struct rte_eth_dev *eth_dev) goto err_init_pf; } - /* Allocate memory for storing MAC addresses */ - eth_dev->data->mac_addrs = rte_zmalloc("hns3-mac", - sizeof(struct rte_ether_addr) * - HNS3_UC_MACADDR_NUM, 0); - if (eth_dev->data->mac_addrs == NULL) { - PMD_INIT_LOG(ERR, "Failed to allocate %zx bytes needed " - "to store MAC addresses", - sizeof(struct rte_ether_addr) * - HNS3_UC_MACADDR_NUM); - ret = -ENOMEM; - goto err_rte_zmalloc; - } - - eth_addr = (struct rte_ether_addr *)hw->mac.mac_addr; - if (!rte_is_valid_assigned_ether_addr(eth_addr)) { - rte_eth_random_addr(hw->mac.mac_addr); - hns3_ether_format_addr(mac_str, RTE_ETHER_ADDR_FMT_SIZE, - (struct rte_ether_addr *)hw->mac.mac_addr); - hns3_warn(hw, "default mac_addr from firmware is an invalid " - "unicast address, using random MAC address %s", - mac_str); - } - rte_ether_addr_copy((struct rte_ether_addr *)hw->mac.mac_addr, - ð_dev->data->mac_addrs[0]); + ret = hns3_init_mac_addrs(eth_dev); + if (ret != 0) + goto err_init_mac_addrs; hw->adapter_state = HNS3_NIC_INITIALIZED; @@ -6706,7 +6683,7 @@ hns3_dev_init(struct rte_eth_dev *eth_dev) hns3_info(hw, "hns3 dev initialization successful!"); return 0; -err_rte_zmalloc: +err_init_mac_addrs: hns3_uninit_pf(eth_dev); err_init_pf: diff --git a/drivers/net/hns3/hns3_ethdev_vf.c b/drivers/net/hns3/hns3_ethdev_vf.c index 5015fe0d5f..5a1286e17b 100644 --- a/drivers/net/hns3/hns3_ethdev_vf.c +++ b/drivers/net/hns3/hns3_ethdev_vf.c @@ -2400,34 +2400,9 @@ hns3vf_dev_init(struct rte_eth_dev *eth_dev) goto err_init_vf; } - /* Allocate memory for storing MAC addresses */ - eth_dev->data->mac_addrs = rte_zmalloc("hns3vf-mac", - sizeof(struct rte_ether_addr) * - HNS3_VF_UC_MACADDR_NUM, 0); - if (eth_dev->data->mac_addrs == NULL) { - PMD_INIT_LOG(ERR, "Failed to allocate %zx bytes needed " - "to store MAC addresses", - sizeof(struct rte_ether_addr) * - HNS3_VF_UC_MACADDR_NUM); - ret = -ENOMEM; - goto err_rte_zmalloc; - } - - /* - * The hns3 PF ethdev driver in kernel support setting VF MAC address - * on the host by "ip link set ..." command. To avoid some incorrect - * scenes, for example, hns3 VF PMD fails to receive and send - * packets after user configure the MAC address by using the - * "ip link set ..." command, hns3 VF PMD keep the same MAC - * address strategy as the hns3 kernel ethdev driver in the - * initialization. If user configure a MAC address by the ip command - * for VF device, then hns3 VF PMD will start with it, otherwise - * start with a random MAC address in the initialization. - */ - if (rte_is_zero_ether_addr((struct rte_ether_addr *)hw->mac.mac_addr)) - rte_eth_random_addr(hw->mac.mac_addr); - rte_ether_addr_copy((struct rte_ether_addr *)hw->mac.mac_addr, - ð_dev->data->mac_addrs[0]); + ret = hns3_init_mac_addrs(eth_dev); + if (ret != 0) + goto err_init_mac_addrs; hw->adapter_state = HNS3_NIC_INITIALIZED; @@ -2443,7 +2418,7 @@ hns3vf_dev_init(struct rte_eth_dev *eth_dev) eth_dev); return 0; -err_rte_zmalloc: +err_init_mac_addrs: hns3vf_uninit_vf(eth_dev); err_init_vf: -- 2.33.0 ^ permalink raw reply [flat|nested] 38+ messages in thread
* [PATCH v2 04/15] net/hns3: remove unnecessary 'inline' 2022-01-22 1:51 ` [PATCH v2 " Min Hu (Connor) ` (2 preceding siblings ...) 2022-01-22 1:51 ` [PATCH v2 03/15] net/hns3: extract a common API to initialize MAC addrs Min Hu (Connor) @ 2022-01-22 1:51 ` Min Hu (Connor) 2022-01-22 1:51 ` [PATCH v2 05/15] net/hns3: remove unnecessary black lines Min Hu (Connor) ` (11 subsequent siblings) 15 siblings, 0 replies; 38+ messages in thread From: Min Hu (Connor) @ 2022-01-22 1:51 UTC (permalink / raw) To: dev; +Cc: ferruh.yigit, andrew.rybchenko, thomas From: Jie Hai <haijie1@huawei.com> This function is a control-plane interface and does not need to use inline. Signed-off-by: Jie Hai <haijie1@huawei.com> --- drivers/net/hns3/hns3_ethdev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c index 56beb8972a..7e966b51d1 100644 --- a/drivers/net/hns3/hns3_ethdev.c +++ b/drivers/net/hns3/hns3_ethdev.c @@ -4859,7 +4859,7 @@ hns3_check_port_speed(struct hns3_hw *hw, uint32_t link_speeds) return 0; } -static inline uint32_t +static uint32_t hns3_get_link_speed(uint32_t link_speeds) { uint32_t speed = RTE_ETH_SPEED_NUM_NONE; -- 2.33.0 ^ permalink raw reply [flat|nested] 38+ messages in thread
* [PATCH v2 05/15] net/hns3: remove unnecessary black lines 2022-01-22 1:51 ` [PATCH v2 " Min Hu (Connor) ` (3 preceding siblings ...) 2022-01-22 1:51 ` [PATCH v2 04/15] net/hns3: remove unnecessary 'inline' Min Hu (Connor) @ 2022-01-22 1:51 ` Min Hu (Connor) 2022-01-22 1:51 ` [PATCH v2 06/15] net/hns3: extract a function to handle reset fail Min Hu (Connor) ` (10 subsequent siblings) 15 siblings, 0 replies; 38+ messages in thread From: Min Hu (Connor) @ 2022-01-22 1:51 UTC (permalink / raw) To: dev; +Cc: ferruh.yigit, andrew.rybchenko, thomas From: Huisong Li <lihuisong@huawei.com> Remove unnecessary black lines. Signed-off-by: Huisong Li <lihuisong@huawei.com> --- drivers/net/hns3/hns3_ethdev.c | 1 - drivers/net/hns3/hns3_rxtx.h | 2 -- 2 files changed, 3 deletions(-) diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c index 7e966b51d1..00949b8aa6 100644 --- a/drivers/net/hns3/hns3_ethdev.c +++ b/drivers/net/hns3/hns3_ethdev.c @@ -6301,7 +6301,6 @@ hns3_fec_set(struct rte_eth_dev *dev, uint32_t mode) struct hns3_adapter *hns = dev->data->dev_private; struct hns3_hw *hw = HNS3_DEV_PRIVATE_TO_HW(hns); struct hns3_pf *pf = &hns->pf; - struct rte_eth_fec_capa fec_capa[FEC_CAPA_NUM]; uint32_t cur_capa; uint32_t num = FEC_CAPA_NUM; diff --git a/drivers/net/hns3/hns3_rxtx.h b/drivers/net/hns3/hns3_rxtx.h index e202eb9c30..094b65b7de 100644 --- a/drivers/net/hns3/hns3_rxtx.h +++ b/drivers/net/hns3/hns3_rxtx.h @@ -344,7 +344,6 @@ struct hns3_rx_queue { struct rte_mbuf fake_mbuf; /* fake mbuf used with vector rx */ - /* * The following fields are not accessed in the I/O path, so they are * placed at the end. @@ -518,7 +517,6 @@ struct hns3_tx_queue { struct hns3_tx_basic_stats basic_stats; struct hns3_tx_dfx_stats dfx_stats; - /* * The following fields are not accessed in the I/O path, so they are * placed at the end. -- 2.33.0 ^ permalink raw reply [flat|nested] 38+ messages in thread
* [PATCH v2 06/15] net/hns3: extract a function to handle reset fail 2022-01-22 1:51 ` [PATCH v2 " Min Hu (Connor) ` (4 preceding siblings ...) 2022-01-22 1:51 ` [PATCH v2 05/15] net/hns3: remove unnecessary black lines Min Hu (Connor) @ 2022-01-22 1:51 ` Min Hu (Connor) 2022-01-22 1:51 ` [PATCH v2 07/15] net/hns3: remove unused variables Min Hu (Connor) ` (9 subsequent siblings) 15 siblings, 0 replies; 38+ messages in thread From: Min Hu (Connor) @ 2022-01-22 1:51 UTC (permalink / raw) To: dev; +Cc: ferruh.yigit, andrew.rybchenko, thomas From: Huisong Li <lihuisong@huawei.com> Extract a function to handle reset fail for clearer code logic. Signed-off-by: Huisong Li <lihuisong@huawei.com> --- drivers/net/hns3/hns3_intr.c | 54 +++++++++++++++++++++--------------- 1 file changed, 32 insertions(+), 22 deletions(-) diff --git a/drivers/net/hns3/hns3_intr.c b/drivers/net/hns3/hns3_intr.c index 66dc509086..3ca2e1e338 100644 --- a/drivers/net/hns3/hns3_intr.c +++ b/drivers/net/hns3/hns3_intr.c @@ -2770,6 +2770,37 @@ hns3_reset_post(struct hns3_adapter *hns) return -EIO; } +static void +hns3_reset_fail_handle(struct hns3_adapter *hns) +{ + struct hns3_hw *hw = &hns->hw; + struct timeval tv_delta; + struct timeval tv; + + hns3_clear_reset_level(hw, &hw->reset.pending); + if (hns3_reset_err_handle(hns)) { + hw->reset.stage = RESET_STAGE_PREWAIT; + hns3_schedule_reset(hns); + return; + } + + rte_spinlock_lock(&hw->lock); + if (hw->reset.mbuf_deferred_free) { + hns3_dev_release_mbufs(hns); + hw->reset.mbuf_deferred_free = false; + } + rte_spinlock_unlock(&hw->lock); + __atomic_store_n(&hns->hw.reset.resetting, 0, __ATOMIC_RELAXED); + hw->reset.stage = RESET_STAGE_NONE; + hns3_clock_gettime(&tv); + timersub(&tv, &hw->reset.start_time, &tv_delta); + hns3_warn(hw, "%s reset fail delta %" PRIu64 " ms time=%ld.%.6ld", + reset_string[hw->reset.level], + hns3_clock_calctime_ms(&tv_delta), + tv.tv_sec, tv.tv_usec); + hw->reset.level = HNS3_NONE_RESET; +} + /* * There are three scenarios as follows: * When the reset is not in progress, the reset process starts. @@ -2784,7 +2815,6 @@ int hns3_reset_process(struct hns3_adapter *hns, enum hns3_reset_level new_level) { struct hns3_hw *hw = &hns->hw; - struct timeval tv_delta; struct timeval tv; int ret; @@ -2843,27 +2873,7 @@ hns3_reset_process(struct hns3_adapter *hns, enum hns3_reset_level new_level) if (ret == -EAGAIN) return ret; err: - hns3_clear_reset_level(hw, &hw->reset.pending); - if (hns3_reset_err_handle(hns)) { - hw->reset.stage = RESET_STAGE_PREWAIT; - hns3_schedule_reset(hns); - } else { - rte_spinlock_lock(&hw->lock); - if (hw->reset.mbuf_deferred_free) { - hns3_dev_release_mbufs(hns); - hw->reset.mbuf_deferred_free = false; - } - rte_spinlock_unlock(&hw->lock); - __atomic_store_n(&hns->hw.reset.resetting, 0, __ATOMIC_RELAXED); - hw->reset.stage = RESET_STAGE_NONE; - hns3_clock_gettime(&tv); - timersub(&tv, &hw->reset.start_time, &tv_delta); - hns3_warn(hw, "%s reset fail delta %" PRIu64 " ms time=%ld.%.6ld", - reset_string[hw->reset.level], - hns3_clock_calctime_ms(&tv_delta), - tv.tv_sec, tv.tv_usec); - hw->reset.level = HNS3_NONE_RESET; - } + hns3_reset_fail_handle(hns); return -EIO; } -- 2.33.0 ^ permalink raw reply [flat|nested] 38+ messages in thread
* [PATCH v2 07/15] net/hns3: remove unused variables 2022-01-22 1:51 ` [PATCH v2 " Min Hu (Connor) ` (5 preceding siblings ...) 2022-01-22 1:51 ` [PATCH v2 06/15] net/hns3: extract a function to handle reset fail Min Hu (Connor) @ 2022-01-22 1:51 ` Min Hu (Connor) 2022-01-22 1:51 ` [PATCH v2 08/15] net/hns3: remove the number of queue descriptors Min Hu (Connor) ` (8 subsequent siblings) 15 siblings, 0 replies; 38+ messages in thread From: Min Hu (Connor) @ 2022-01-22 1:51 UTC (permalink / raw) To: dev; +Cc: ferruh.yigit, andrew.rybchenko, thomas From: Huisong Li <lihuisong@huawei.com> Remove unused variables. Signed-off-by: Huisong Li <lihuisong@huawei.com> --- drivers/net/hns3/hns3_dcb.c | 12 +----------- drivers/net/hns3/hns3_ethdev.c | 3 --- drivers/net/hns3/hns3_ethdev.h | 2 -- 3 files changed, 1 insertion(+), 16 deletions(-) diff --git a/drivers/net/hns3/hns3_dcb.c b/drivers/net/hns3/hns3_dcb.c index e4417e87fd..73693786d1 100644 --- a/drivers/net/hns3/hns3_dcb.c +++ b/drivers/net/hns3/hns3_dcb.c @@ -750,19 +750,9 @@ static int hns3_dcb_update_tc_queue_mapping(struct hns3_hw *hw, uint16_t nb_rx_q, uint16_t nb_tx_q) { - struct hns3_adapter *hns = HNS3_DEV_HW_TO_ADAPTER(hw); - struct hns3_pf *pf = &hns->pf; - int ret; - hw->num_tc = hw->dcb_info.num_tc; - ret = hns3_queue_to_tc_mapping(hw, nb_rx_q, nb_tx_q); - if (ret) - return ret; - if (!hns->is_vf) - memcpy(pf->prio_tc, hw->dcb_info.prio_tc, HNS3_MAX_USER_PRIO); - - return 0; + return hns3_queue_to_tc_mapping(hw, nb_rx_q, nb_tx_q); } int diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c index 00949b8aa6..45a423a638 100644 --- a/drivers/net/hns3/hns3_ethdev.c +++ b/drivers/net/hns3/hns3_ethdev.c @@ -2552,9 +2552,6 @@ hns3_parse_cfg(struct hns3_cfg *cfg, struct hns3_cmd_desc *desc) cfg->media_type = hns3_get_field(rte_le_to_cpu_32(req->param[1]), HNS3_CFG_MEDIA_TP_M, HNS3_CFG_MEDIA_TP_S); - cfg->rx_buf_len = hns3_get_field(rte_le_to_cpu_32(req->param[1]), - HNS3_CFG_RX_BUF_LEN_M, - HNS3_CFG_RX_BUF_LEN_S); /* get mac address */ mac_addr_tmp = rte_le_to_cpu_32(req->param[2]); mac_addr_tmp_high = hns3_get_field(rte_le_to_cpu_32(req->param[3]), diff --git a/drivers/net/hns3/hns3_ethdev.h b/drivers/net/hns3/hns3_ethdev.h index 153e67337f..1dd388625b 100644 --- a/drivers/net/hns3/hns3_ethdev.h +++ b/drivers/net/hns3/hns3_ethdev.h @@ -156,7 +156,6 @@ struct hns3_tc_queue_info { struct hns3_cfg { uint8_t tc_num; uint16_t tqp_desc_num; - uint16_t rx_buf_len; uint16_t rss_size_max; uint8_t phy_addr; uint8_t media_type; @@ -804,7 +803,6 @@ struct hns3_pf { uint8_t tc_max; /* max number of tc driver supported */ uint8_t local_max_tc; /* max number of local tc */ uint8_t pfc_max; - uint8_t prio_tc[HNS3_MAX_USER_PRIO]; /* TC indexed by prio */ uint16_t pause_time; bool support_fc_autoneg; /* support FC autonegotiate */ bool support_multi_tc_pause; -- 2.33.0 ^ permalink raw reply [flat|nested] 38+ messages in thread
* [PATCH v2 08/15] net/hns3: remove the number of queue descriptors 2022-01-22 1:51 ` [PATCH v2 " Min Hu (Connor) ` (6 preceding siblings ...) 2022-01-22 1:51 ` [PATCH v2 07/15] net/hns3: remove unused variables Min Hu (Connor) @ 2022-01-22 1:51 ` Min Hu (Connor) 2022-01-22 1:51 ` [PATCH v2 09/15] net/hns3: remove the printing of memory addresses Min Hu (Connor) ` (7 subsequent siblings) 15 siblings, 0 replies; 38+ messages in thread From: Min Hu (Connor) @ 2022-01-22 1:51 UTC (permalink / raw) To: dev; +Cc: ferruh.yigit, andrew.rybchenko, thomas From: Huisong Li <lihuisong@huawei.com> Application can specify the number of Rx/Tx queue descriptors in DPDK. So driver does not obtain the default value from firmware and PF. Signed-off-by: Huisong Li <lihuisong@huawei.com> --- drivers/net/hns3/hns3_ethdev.c | 5 ----- drivers/net/hns3/hns3_ethdev.h | 3 --- drivers/net/hns3/hns3_ethdev_vf.c | 26 -------------------------- 3 files changed, 34 deletions(-) diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c index 45a423a638..eac7858622 100644 --- a/drivers/net/hns3/hns3_ethdev.c +++ b/drivers/net/hns3/hns3_ethdev.c @@ -2542,9 +2542,6 @@ hns3_parse_cfg(struct hns3_cfg *cfg, struct hns3_cmd_desc *desc) /* get the configuration */ cfg->tc_num = hns3_get_field(rte_le_to_cpu_32(req->param[0]), HNS3_CFG_TC_NUM_M, HNS3_CFG_TC_NUM_S); - cfg->tqp_desc_num = hns3_get_field(rte_le_to_cpu_32(req->param[0]), - HNS3_CFG_TQP_DESC_N_M, - HNS3_CFG_TQP_DESC_N_S); cfg->phy_addr = hns3_get_field(rte_le_to_cpu_32(req->param[1]), HNS3_CFG_PHY_ADDR_M, @@ -2855,8 +2852,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->num_tx_desc = cfg.tqp_desc_num; - hw->num_rx_desc = cfg.tqp_desc_num; hw->dcb_info.num_pg = 1; hw->dcb_info.hw_pfc_map = 0; diff --git a/drivers/net/hns3/hns3_ethdev.h b/drivers/net/hns3/hns3_ethdev.h index 1dd388625b..cf6380ebb2 100644 --- a/drivers/net/hns3/hns3_ethdev.h +++ b/drivers/net/hns3/hns3_ethdev.h @@ -155,7 +155,6 @@ struct hns3_tc_queue_info { struct hns3_cfg { uint8_t tc_num; - uint16_t tqp_desc_num; uint16_t rss_size_max; uint8_t phy_addr; uint8_t media_type; @@ -512,8 +511,6 @@ struct hns3_hw { uint16_t intr_tqps_num; /* num queue pairs mapping interrupt */ uint16_t rss_size_max; /* HW defined max RSS task queue */ uint16_t rx_buf_len; /* hold min hardware rx buf len */ - uint16_t num_tx_desc; /* desc num of per tx queue */ - uint16_t num_rx_desc; /* desc num of per rx queue */ uint32_t mng_entry_num; /* number of manager table entry */ uint32_t mac_entry_num; /* number of mac-vlan table entry */ diff --git a/drivers/net/hns3/hns3_ethdev_vf.c b/drivers/net/hns3/hns3_ethdev_vf.c index 5a1286e17b..36d860d08a 100644 --- a/drivers/net/hns3/hns3_ethdev_vf.c +++ b/drivers/net/hns3/hns3_ethdev_vf.c @@ -941,27 +941,6 @@ hns3vf_get_queue_info(struct hns3_hw *hw) return hns3vf_check_tqp_info(hw); } -static int -hns3vf_get_queue_depth(struct hns3_hw *hw) -{ -#define HNS3VF_TQPS_DEPTH_INFO_LEN 4 - uint8_t resp_msg[HNS3VF_TQPS_DEPTH_INFO_LEN]; - int ret; - - ret = hns3_send_mbx_msg(hw, HNS3_MBX_GET_QDEPTH, 0, NULL, 0, true, - resp_msg, HNS3VF_TQPS_DEPTH_INFO_LEN); - if (ret) { - PMD_INIT_LOG(ERR, "Failed to get tqp depth info from PF: %d", - ret); - return ret; - } - - memcpy(&hw->num_tx_desc, &resp_msg[0], sizeof(uint16_t)); - memcpy(&hw->num_rx_desc, &resp_msg[2], sizeof(uint16_t)); - - return 0; -} - static void hns3vf_update_caps(struct hns3_hw *hw, uint32_t caps) { @@ -1052,11 +1031,6 @@ hns3vf_get_configuration(struct hns3_hw *hw) if (ret) return ret; - /* Get queue depth info from PF */ - ret = hns3vf_get_queue_depth(hw); - if (ret) - return ret; - /* Get user defined VF MAC addr from PF */ ret = hns3vf_get_host_mac_addr(hw); if (ret) -- 2.33.0 ^ permalink raw reply [flat|nested] 38+ messages in thread
* [PATCH v2 09/15] net/hns3: remove the printing of memory addresses 2022-01-22 1:51 ` [PATCH v2 " Min Hu (Connor) ` (7 preceding siblings ...) 2022-01-22 1:51 ` [PATCH v2 08/15] net/hns3: remove the number of queue descriptors Min Hu (Connor) @ 2022-01-22 1:51 ` Min Hu (Connor) 2022-01-22 1:51 ` [PATCH v2 10/15] net/hns3: extract a common interface to obtain revision ID Min Hu (Connor) ` (6 subsequent siblings) 15 siblings, 0 replies; 38+ messages in thread From: Min Hu (Connor) @ 2022-01-22 1:51 UTC (permalink / raw) To: dev; +Cc: ferruh.yigit, andrew.rybchenko, thomas From: Huisong Li <lihuisong@huawei.com> Remove the printing of memory addresses. Signed-off-by: Huisong Li <lihuisong@huawei.com> --- drivers/net/hns3/hns3_cmd.c | 12 ++++-------- drivers/net/hns3/hns3_rxtx.c | 6 ------ 2 files changed, 4 insertions(+), 14 deletions(-) diff --git a/drivers/net/hns3/hns3_cmd.c b/drivers/net/hns3/hns3_cmd.c index 5b42d38aa5..5dc874fd7a 100644 --- a/drivers/net/hns3/hns3_cmd.c +++ b/drivers/net/hns3/hns3_cmd.c @@ -60,18 +60,14 @@ hns3_allocate_dma_mem(struct hns3_hw *hw, struct hns3_cmq_ring *ring, ring->desc = mz->addr; ring->desc_dma_addr = mz->iova; ring->zone = (const void *)mz; - hns3_dbg(hw, "memzone %s allocated with physical address: %" PRIu64, - mz->name, ring->desc_dma_addr); + hns3_dbg(hw, "cmd ring memzone name: %s", mz->name); return 0; } static void -hns3_free_dma_mem(struct hns3_hw *hw, struct hns3_cmq_ring *ring) +hns3_free_dma_mem(struct hns3_cmq_ring *ring) { - hns3_dbg(hw, "memzone %s to be freed with physical address: %" PRIu64, - ((const struct rte_memzone *)ring->zone)->name, - ring->desc_dma_addr); rte_memzone_free((const struct rte_memzone *)ring->zone); ring->buf_size = 0; ring->desc = NULL; @@ -93,10 +89,10 @@ hns3_alloc_cmd_desc(struct hns3_hw *hw, struct hns3_cmq_ring *ring) } static void -hns3_free_cmd_desc(struct hns3_hw *hw, struct hns3_cmq_ring *ring) +hns3_free_cmd_desc(__rte_unused struct hns3_hw *hw, struct hns3_cmq_ring *ring) { if (ring->desc) - hns3_free_dma_mem(hw, ring); + hns3_free_dma_mem(ring); } static int diff --git a/drivers/net/hns3/hns3_rxtx.c b/drivers/net/hns3/hns3_rxtx.c index d240e36e6a..b236ff6fb7 100644 --- a/drivers/net/hns3/hns3_rxtx.c +++ b/drivers/net/hns3/hns3_rxtx.c @@ -1382,9 +1382,6 @@ hns3_alloc_rxq_and_dma_zone(struct rte_eth_dev *dev, rxq->rx_ring = (struct hns3_desc *)rx_mz->addr; rxq->rx_ring_phys_addr = rx_mz->iova; - hns3_dbg(hw, "No.%u rx descriptors iova 0x%" PRIx64, q_info->idx, - rxq->rx_ring_phys_addr); - return rxq; } @@ -1469,9 +1466,6 @@ hns3_alloc_txq_and_dma_zone(struct rte_eth_dev *dev, txq->tx_ring = (struct hns3_desc *)tx_mz->addr; txq->tx_ring_phys_addr = tx_mz->iova; - hns3_dbg(hw, "No.%u tx descriptors iova 0x%" PRIx64, q_info->idx, - txq->tx_ring_phys_addr); - /* Clear tx bd */ desc = txq->tx_ring; for (i = 0; i < txq->nb_tx_desc; i++) { -- 2.33.0 ^ permalink raw reply [flat|nested] 38+ messages in thread
* [PATCH v2 10/15] net/hns3: extract a common interface to obtain revision ID 2022-01-22 1:51 ` [PATCH v2 " Min Hu (Connor) ` (8 preceding siblings ...) 2022-01-22 1:51 ` [PATCH v2 09/15] net/hns3: remove the printing of memory addresses Min Hu (Connor) @ 2022-01-22 1:51 ` Min Hu (Connor) 2022-01-22 1:51 ` [PATCH v2 11/15] net/hns3: remove invalid encapsulation function Min Hu (Connor) ` (5 subsequent siblings) 15 siblings, 0 replies; 38+ messages in thread From: Min Hu (Connor) @ 2022-01-22 1:51 UTC (permalink / raw) To: dev; +Cc: ferruh.yigit, andrew.rybchenko, thomas From: Huisong Li <lihuisong@huawei.com> The code logic of obtaining the revision ID of PCI device is the same for PF and VF driver. This patch extracts a common interface to do it. Signed-off-by: Huisong Li <lihuisong@huawei.com> --- drivers/net/hns3/hns3_common.c | 22 ++++++++++++++++++++++ drivers/net/hns3/hns3_common.h | 2 ++ drivers/net/hns3/hns3_ethdev.c | 16 ++++------------ drivers/net/hns3/hns3_ethdev_vf.c | 21 ++++----------------- 4 files changed, 32 insertions(+), 29 deletions(-) diff --git a/drivers/net/hns3/hns3_common.c b/drivers/net/hns3/hns3_common.c index b5ac6313ff..ccf3e76655 100644 --- a/drivers/net/hns3/hns3_common.c +++ b/drivers/net/hns3/hns3_common.c @@ -815,3 +815,25 @@ hns3_restore_rx_interrupt(struct hns3_hw *hw) return 0; } + +int +hns3_get_pci_revision_id(struct hns3_hw *hw, uint8_t *revision_id) +{ + struct rte_pci_device *pci_dev; + struct rte_eth_dev *eth_dev; + uint8_t revision; + int ret; + + eth_dev = &rte_eth_devices[hw->data->port_id]; + pci_dev = RTE_ETH_DEV_TO_PCI(eth_dev); + ret = rte_pci_read_config(pci_dev, &revision, HNS3_PCI_REVISION_ID_LEN, + HNS3_PCI_REVISION_ID); + if (ret != HNS3_PCI_REVISION_ID_LEN) { + hns3_err(hw, "failed to read pci revision id, ret = %d", ret); + return -EIO; + } + + *revision_id = revision; + + return 0; +} diff --git a/drivers/net/hns3/hns3_common.h b/drivers/net/hns3/hns3_common.h index a9e8a9cccf..2994e4a269 100644 --- a/drivers/net/hns3/hns3_common.h +++ b/drivers/net/hns3/hns3_common.h @@ -59,4 +59,6 @@ int hns3_map_rx_interrupt(struct rte_eth_dev *dev); void hns3_unmap_rx_interrupt(struct rte_eth_dev *dev); int hns3_restore_rx_interrupt(struct hns3_hw *hw); +int hns3_get_pci_revision_id(struct hns3_hw *hw, uint8_t *revision_id); + #endif /* _HNS3_COMMON_H_ */ diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c index eac7858622..9db0cb19f8 100644 --- a/drivers/net/hns3/hns3_ethdev.c +++ b/drivers/net/hns3/hns3_ethdev.c @@ -5,7 +5,6 @@ #include <rte_alarm.h> #include <rte_bus_pci.h> #include <ethdev_pci.h> -#include <rte_pci.h> #include "hns3_ethdev.h" #include "hns3_common.h" @@ -2738,7 +2737,6 @@ hns3_get_capability(struct hns3_hw *hw) struct hns3_pf *pf = &hns->pf; struct rte_eth_dev *eth_dev; uint16_t device_id; - uint8_t revision; int ret; eth_dev = &rte_eth_devices[hw->data->port_id]; @@ -2751,17 +2749,11 @@ hns3_get_capability(struct hns3_hw *hw) device_id == HNS3_DEV_ID_200G_RDMA) hns3_set_bit(hw->capability, HNS3_DEV_SUPPORT_DCB_B, 1); - /* Get PCI revision id */ - ret = rte_pci_read_config(pci_dev, &revision, HNS3_PCI_REVISION_ID_LEN, - HNS3_PCI_REVISION_ID); - if (ret != HNS3_PCI_REVISION_ID_LEN) { - PMD_INIT_LOG(ERR, "failed to read pci revision id, ret = %d", - ret); - return -EIO; - } - hw->revision = revision; + ret = hns3_get_pci_revision_id(hw, &hw->revision); + if (ret) + return ret; - if (revision < PCI_REVISION_ID_HIP09_A) { + if (hw->revision < PCI_REVISION_ID_HIP09_A) { hns3_set_default_dev_specifications(hw); hw->intr.mapping_mode = HNS3_INTR_MAPPING_VEC_RSV_ONE; hw->intr.gl_unit = HNS3_INTR_COALESCE_GL_UINT_2US; diff --git a/drivers/net/hns3/hns3_ethdev_vf.c b/drivers/net/hns3/hns3_ethdev_vf.c index 36d860d08a..a9e129288b 100644 --- a/drivers/net/hns3/hns3_ethdev_vf.c +++ b/drivers/net/hns3/hns3_ethdev_vf.c @@ -6,7 +6,6 @@ #include <rte_alarm.h> #include <ethdev_pci.h> #include <rte_io.h> -#include <rte_pci.h> #include <rte_vfio.h> #include "hns3_ethdev.h" @@ -810,25 +809,13 @@ hns3vf_get_push_lsc_cap(struct hns3_hw *hw) static int hns3vf_get_capability(struct hns3_hw *hw) { - struct rte_pci_device *pci_dev; - struct rte_eth_dev *eth_dev; - uint8_t revision; int ret; - eth_dev = &rte_eth_devices[hw->data->port_id]; - pci_dev = RTE_ETH_DEV_TO_PCI(eth_dev); - - /* Get PCI revision id */ - ret = rte_pci_read_config(pci_dev, &revision, HNS3_PCI_REVISION_ID_LEN, - HNS3_PCI_REVISION_ID); - if (ret != HNS3_PCI_REVISION_ID_LEN) { - PMD_INIT_LOG(ERR, "failed to read pci revision id, ret = %d", - ret); - return -EIO; - } - hw->revision = revision; + ret = hns3_get_pci_revision_id(hw, &hw->revision); + if (ret) + return ret; - if (revision < PCI_REVISION_ID_HIP09_A) { + if (hw->revision < PCI_REVISION_ID_HIP09_A) { hns3vf_set_default_dev_specifications(hw); hw->intr.mapping_mode = HNS3_INTR_MAPPING_VEC_RSV_ONE; hw->intr.gl_unit = HNS3_INTR_COALESCE_GL_UINT_2US; -- 2.33.0 ^ permalink raw reply [flat|nested] 38+ messages in thread
* [PATCH v2 11/15] net/hns3: remove invalid encapsulation function 2022-01-22 1:51 ` [PATCH v2 " Min Hu (Connor) ` (9 preceding siblings ...) 2022-01-22 1:51 ` [PATCH v2 10/15] net/hns3: extract a common interface to obtain revision ID Min Hu (Connor) @ 2022-01-22 1:51 ` Min Hu (Connor) 2022-01-27 13:04 ` Ferruh Yigit 2022-01-22 1:51 ` [PATCH v2 12/15] net/hns3: delete strerror invoke Min Hu (Connor) ` (4 subsequent siblings) 15 siblings, 1 reply; 38+ messages in thread From: Min Hu (Connor) @ 2022-01-22 1:51 UTC (permalink / raw) To: dev; +Cc: ferruh.yigit, andrew.rybchenko, thomas From: Chengwen Feng <fengchengwen@huawei.com> This patch remove invalid encapsulation functions. Signed-off-by: Chengwen Feng <fengchengwen@huawei.com> --- drivers/net/hns3/hns3_ethdev.c | 27 ++++++++------------------- drivers/net/hns3/hns3_ethdev_vf.c | 13 ++----------- 2 files changed, 10 insertions(+), 30 deletions(-) diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c index 9db0cb19f8..491fa41888 100644 --- a/drivers/net/hns3/hns3_ethdev.c +++ b/drivers/net/hns3/hns3_ethdev.c @@ -593,22 +593,6 @@ hns3_set_vlan_rx_offload_cfg(struct hns3_adapter *hns, return ret; } -static void -hns3_update_rx_offload_cfg(struct hns3_adapter *hns, - struct hns3_rx_vtag_cfg *vcfg) -{ - struct hns3_pf *pf = &hns->pf; - memcpy(&pf->vtag_config.rx_vcfg, vcfg, sizeof(pf->vtag_config.rx_vcfg)); -} - -static void -hns3_update_tx_offload_cfg(struct hns3_adapter *hns, - struct hns3_tx_vtag_cfg *vcfg) -{ - struct hns3_pf *pf = &hns->pf; - memcpy(&pf->vtag_config.tx_vcfg, vcfg, sizeof(pf->vtag_config.tx_vcfg)); -} - static int hns3_en_hw_strip_rxvtag(struct hns3_adapter *hns, bool enable) { @@ -638,7 +622,8 @@ hns3_en_hw_strip_rxvtag(struct hns3_adapter *hns, bool enable) return ret; } - hns3_update_rx_offload_cfg(hns, &rxvlan_cfg); + memcpy(&hns->pf.vtag_config.rx_vcfg, &rxvlan_cfg, + sizeof(struct hns3_rx_vtag_cfg)); return ret; } @@ -836,7 +821,9 @@ hns3_vlan_txvlan_cfg(struct hns3_adapter *hns, uint16_t port_base_vlan_state, return ret; } - hns3_update_tx_offload_cfg(hns, &txvlan_cfg); + memcpy(&hns->pf.vtag_config.tx_vcfg, &txvlan_cfg, + sizeof(struct hns3_tx_vtag_cfg)); + return ret; } @@ -962,7 +949,9 @@ hns3_en_pvid_strip(struct hns3_adapter *hns, int on) if (ret) return ret; - hns3_update_rx_offload_cfg(hns, &rx_vlan_cfg); + memcpy(&hns->pf.vtag_config.rx_vcfg, &rx_vlan_cfg, + sizeof(struct hns3_rx_vtag_cfg)); + return ret; } diff --git a/drivers/net/hns3/hns3_ethdev_vf.c b/drivers/net/hns3/hns3_ethdev_vf.c index a9e129288b..1af2e07e81 100644 --- a/drivers/net/hns3/hns3_ethdev_vf.c +++ b/drivers/net/hns3/hns3_ethdev_vf.c @@ -1026,15 +1026,6 @@ hns3vf_get_configuration(struct hns3_hw *hw) return hns3vf_get_port_base_vlan_filter_state(hw); } -static int -hns3vf_set_tc_queue_mapping(struct hns3_adapter *hns, uint16_t nb_rx_q, - uint16_t nb_tx_q) -{ - struct hns3_hw *hw = &hns->hw; - - return hns3_queue_to_tc_mapping(hw, nb_rx_q, nb_tx_q); -} - static void hns3vf_request_link_info(struct hns3_hw *hw) { @@ -1530,7 +1521,7 @@ hns3vf_init_vf(struct rte_eth_dev *eth_dev) goto err_set_tc_queue; } - ret = hns3vf_set_tc_queue_mapping(hns, hw->tqps_num, hw->tqps_num); + ret = hns3_queue_to_tc_mapping(hw, hw->tqps_num, hw->tqps_num); if (ret) { PMD_INIT_LOG(ERR, "failed to set tc info, ret = %d.", ret); goto err_set_tc_queue; @@ -1739,7 +1730,7 @@ hns3vf_do_start(struct hns3_adapter *hns, bool reset_queue) uint16_t nb_tx_q = hw->data->nb_tx_queues; int ret; - ret = hns3vf_set_tc_queue_mapping(hns, nb_rx_q, nb_tx_q); + ret = hns3_queue_to_tc_mapping(hw, nb_rx_q, nb_tx_q); if (ret) return ret; -- 2.33.0 ^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [PATCH v2 11/15] net/hns3: remove invalid encapsulation function 2022-01-22 1:51 ` [PATCH v2 11/15] net/hns3: remove invalid encapsulation function Min Hu (Connor) @ 2022-01-27 13:04 ` Ferruh Yigit 0 siblings, 0 replies; 38+ messages in thread From: Ferruh Yigit @ 2022-01-27 13:04 UTC (permalink / raw) To: Min Hu (Connor), dev; +Cc: andrew.rybchenko, thomas On 1/22/2022 1:51 AM, Min Hu (Connor) wrote: > From: Chengwen Feng <fengchengwen@huawei.com> > > This patch remove invalid encapsulation functions. removed functions don't look like encapsulation functions, updating commit log while merging. > > Signed-off-by: Chengwen Feng <fengchengwen@huawei.com> > --- > drivers/net/hns3/hns3_ethdev.c | 27 ++++++++------------------- > drivers/net/hns3/hns3_ethdev_vf.c | 13 ++----------- > 2 files changed, 10 insertions(+), 30 deletions(-) > > diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c > index 9db0cb19f8..491fa41888 100644 > --- a/drivers/net/hns3/hns3_ethdev.c > +++ b/drivers/net/hns3/hns3_ethdev.c > @@ -593,22 +593,6 @@ hns3_set_vlan_rx_offload_cfg(struct hns3_adapter *hns, > return ret; > } > > -static void > -hns3_update_rx_offload_cfg(struct hns3_adapter *hns, > - struct hns3_rx_vtag_cfg *vcfg) > -{ > - struct hns3_pf *pf = &hns->pf; > - memcpy(&pf->vtag_config.rx_vcfg, vcfg, sizeof(pf->vtag_config.rx_vcfg)); > -} > - > -static void > -hns3_update_tx_offload_cfg(struct hns3_adapter *hns, > - struct hns3_tx_vtag_cfg *vcfg) > -{ > - struct hns3_pf *pf = &hns->pf; > - memcpy(&pf->vtag_config.tx_vcfg, vcfg, sizeof(pf->vtag_config.tx_vcfg)); > -} > - > static int > hns3_en_hw_strip_rxvtag(struct hns3_adapter *hns, bool enable) > { > @@ -638,7 +622,8 @@ hns3_en_hw_strip_rxvtag(struct hns3_adapter *hns, bool enable) > return ret; > } > > - hns3_update_rx_offload_cfg(hns, &rxvlan_cfg); > + memcpy(&hns->pf.vtag_config.rx_vcfg, &rxvlan_cfg, > + sizeof(struct hns3_rx_vtag_cfg)); > > return ret; > } > @@ -836,7 +821,9 @@ hns3_vlan_txvlan_cfg(struct hns3_adapter *hns, uint16_t port_base_vlan_state, > return ret; > } > > - hns3_update_tx_offload_cfg(hns, &txvlan_cfg); > + memcpy(&hns->pf.vtag_config.tx_vcfg, &txvlan_cfg, > + sizeof(struct hns3_tx_vtag_cfg)); > + > return ret; > } > > @@ -962,7 +949,9 @@ hns3_en_pvid_strip(struct hns3_adapter *hns, int on) > if (ret) > return ret; > > - hns3_update_rx_offload_cfg(hns, &rx_vlan_cfg); > + memcpy(&hns->pf.vtag_config.rx_vcfg, &rx_vlan_cfg, > + sizeof(struct hns3_rx_vtag_cfg)); > + > return ret; > } > > diff --git a/drivers/net/hns3/hns3_ethdev_vf.c b/drivers/net/hns3/hns3_ethdev_vf.c > index a9e129288b..1af2e07e81 100644 > --- a/drivers/net/hns3/hns3_ethdev_vf.c > +++ b/drivers/net/hns3/hns3_ethdev_vf.c > @@ -1026,15 +1026,6 @@ hns3vf_get_configuration(struct hns3_hw *hw) > return hns3vf_get_port_base_vlan_filter_state(hw); > } > > -static int > -hns3vf_set_tc_queue_mapping(struct hns3_adapter *hns, uint16_t nb_rx_q, > - uint16_t nb_tx_q) > -{ > - struct hns3_hw *hw = &hns->hw; > - > - return hns3_queue_to_tc_mapping(hw, nb_rx_q, nb_tx_q); > -} > - > static void > hns3vf_request_link_info(struct hns3_hw *hw) > { > @@ -1530,7 +1521,7 @@ hns3vf_init_vf(struct rte_eth_dev *eth_dev) > goto err_set_tc_queue; > } > > - ret = hns3vf_set_tc_queue_mapping(hns, hw->tqps_num, hw->tqps_num); > + ret = hns3_queue_to_tc_mapping(hw, hw->tqps_num, hw->tqps_num); > if (ret) { > PMD_INIT_LOG(ERR, "failed to set tc info, ret = %d.", ret); > goto err_set_tc_queue; > @@ -1739,7 +1730,7 @@ hns3vf_do_start(struct hns3_adapter *hns, bool reset_queue) > uint16_t nb_tx_q = hw->data->nb_tx_queues; > int ret; > > - ret = hns3vf_set_tc_queue_mapping(hns, nb_rx_q, nb_tx_q); > + ret = hns3_queue_to_tc_mapping(hw, nb_rx_q, nb_tx_q); > if (ret) > return ret; > ^ permalink raw reply [flat|nested] 38+ messages in thread
* [PATCH v2 12/15] net/hns3: delete strerror invoke 2022-01-22 1:51 ` [PATCH v2 " Min Hu (Connor) ` (10 preceding siblings ...) 2022-01-22 1:51 ` [PATCH v2 11/15] net/hns3: remove invalid encapsulation function Min Hu (Connor) @ 2022-01-22 1:51 ` Min Hu (Connor) 2022-01-22 1:51 ` [PATCH v2 13/15] net/hns3: rename function Min Hu (Connor) ` (3 subsequent siblings) 15 siblings, 0 replies; 38+ messages in thread From: Min Hu (Connor) @ 2022-01-22 1:51 UTC (permalink / raw) To: dev; +Cc: ferruh.yigit, andrew.rybchenko, thomas From: Chengwen Feng <fengchengwen@huawei.com> This patch delete strerror invoke which was non-reentrant. Signed-off-by: Chengwen Feng <fengchengwen@huawei.com> --- drivers/net/hns3/hns3_fdir.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/net/hns3/hns3_fdir.c b/drivers/net/hns3/hns3_fdir.c index d043f5786d..2a7978ac07 100644 --- a/drivers/net/hns3/hns3_fdir.c +++ b/drivers/net/hns3/hns3_fdir.c @@ -919,8 +919,7 @@ static int hns3_insert_fdir_filter(struct hns3_hw *hw, sig = rte_hash_crc(key, sizeof(*key), 0); ret = rte_hash_add_key_with_hash(fdir_info->hash_handle, key, sig); if (ret < 0) { - hns3_err(hw, "Hash table full? err:%d(%s)!", ret, - strerror(-ret)); + hns3_err(hw, "Hash table full? err:%d!", ret); return ret; } -- 2.33.0 ^ permalink raw reply [flat|nested] 38+ messages in thread
* [PATCH v2 13/15] net/hns3: rename function 2022-01-22 1:51 ` [PATCH v2 " Min Hu (Connor) ` (11 preceding siblings ...) 2022-01-22 1:51 ` [PATCH v2 12/15] net/hns3: delete strerror invoke Min Hu (Connor) @ 2022-01-22 1:51 ` Min Hu (Connor) 2022-01-22 1:51 ` [PATCH v2 14/15] net/hns3: extract functions to create RSS and FDIR flow rule Min Hu (Connor) ` (2 subsequent siblings) 15 siblings, 0 replies; 38+ messages in thread From: Min Hu (Connor) @ 2022-01-22 1:51 UTC (permalink / raw) To: dev; +Cc: ferruh.yigit, andrew.rybchenko, thomas From: Chengwen Feng <fengchengwen@huawei.com> This patch rename hns3_parse_rss_key with hns3_adjust_rss_key to improve readability. Signed-off-by: Chengwen Feng <fengchengwen@huawei.com> --- drivers/net/hns3/hns3_flow.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/hns3/hns3_flow.c b/drivers/net/hns3/hns3_flow.c index 00084872ad..72986abaff 100644 --- a/drivers/net/hns3/hns3_flow.c +++ b/drivers/net/hns3/hns3_flow.c @@ -1405,7 +1405,7 @@ hns3_disable_rss(struct hns3_hw *hw) } static void -hns3_parse_rss_key(struct hns3_hw *hw, struct rte_flow_action_rss *rss_conf) +hns3_adjust_rss_key(struct hns3_hw *hw, struct rte_flow_action_rss *rss_conf) { if (rss_conf->key == NULL || rss_conf->key_len < HNS3_RSS_KEY_SIZE) { hns3_warn(hw, "Default RSS hash key to be set"); @@ -1449,7 +1449,7 @@ hns3_hw_rss_hash_set(struct hns3_hw *hw, struct rte_flow_action_rss *rss_config) struct hns3_rss_tuple_cfg *tuple; int ret; - hns3_parse_rss_key(hw, rss_config); + hns3_adjust_rss_key(hw, rss_config); ret = hns3_parse_rss_algorithm(hw, &rss_config->func, &hw->rss_info.hash_algo); -- 2.33.0 ^ permalink raw reply [flat|nested] 38+ messages in thread
* [PATCH v2 14/15] net/hns3: extract functions to create RSS and FDIR flow rule 2022-01-22 1:51 ` [PATCH v2 " Min Hu (Connor) ` (12 preceding siblings ...) 2022-01-22 1:51 ` [PATCH v2 13/15] net/hns3: rename function Min Hu (Connor) @ 2022-01-22 1:51 ` Min Hu (Connor) 2022-01-22 1:51 ` [PATCH v2 15/15] net/hns3: support indirect counter action Min Hu (Connor) 2022-01-27 12:49 ` [PATCH v2 00/15] fix and feature for hns3 PMD Ferruh Yigit 15 siblings, 0 replies; 38+ messages in thread From: Min Hu (Connor) @ 2022-01-22 1:51 UTC (permalink / raw) To: dev; +Cc: ferruh.yigit, andrew.rybchenko, thomas From: Huisong Li <lihuisong@huawei.com> Extract two functions to create the RSS and FDIR flow rule for clearer code logic. Signed-off-by: Huisong Li <lihuisong@huawei.com> --- drivers/net/hns3/hns3_flow.c | 173 +++++++++++++++++++++-------------- 1 file changed, 106 insertions(+), 67 deletions(-) diff --git a/drivers/net/hns3/hns3_flow.c b/drivers/net/hns3/hns3_flow.c index 72986abaff..4f271a32dd 100644 --- a/drivers/net/hns3/hns3_flow.c +++ b/drivers/net/hns3/hns3_flow.c @@ -1706,6 +1706,105 @@ hns3_flow_validate(struct rte_eth_dev *dev, const struct rte_flow_attr *attr, return hns3_parse_fdir_filter(dev, pattern, actions, &fdir_rule, error); } +static int +hns3_flow_create_rss_rule(struct rte_eth_dev *dev, + const struct rte_flow_action *act, + struct rte_flow *flow) +{ + struct hns3_hw *hw = HNS3_DEV_PRIVATE_TO_HW(dev->data->dev_private); + struct hns3_rss_conf_ele *rss_filter_ptr; + const struct hns3_rss_conf *rss_conf; + int ret; + + rss_filter_ptr = rte_zmalloc("hns3 rss filter", + sizeof(struct hns3_rss_conf_ele), 0); + if (rss_filter_ptr == NULL) { + hns3_err(hw, "failed to allocate hns3_rss_filter memory"); + return -ENOMEM; + } + + /* + * After all the preceding tasks are successfully configured, configure + * rules to the hardware to simplify the rollback of rules in the + * hardware. + */ + rss_conf = (const struct hns3_rss_conf *)act->conf; + ret = hns3_flow_parse_rss(dev, rss_conf, true); + if (ret != 0) { + rte_free(rss_filter_ptr); + return ret; + } + + hns3_rss_conf_copy(&rss_filter_ptr->filter_info, &rss_conf->conf); + rss_filter_ptr->filter_info.valid = true; + TAILQ_INSERT_TAIL(&hw->flow_rss_list, rss_filter_ptr, entries); + flow->rule = rss_filter_ptr; + flow->filter_type = RTE_ETH_FILTER_HASH; + + return 0; +} + +static int +hns3_flow_create_fdir_rule(struct rte_eth_dev *dev, + const struct rte_flow_item pattern[], + const struct rte_flow_action actions[], + struct rte_flow_error *error, + struct rte_flow *flow) +{ + struct hns3_hw *hw = HNS3_DEV_PRIVATE_TO_HW(dev->data->dev_private); + struct hns3_adapter *hns = HNS3_DEV_HW_TO_ADAPTER(hw); + struct hns3_fdir_rule_ele *fdir_rule_ptr; + struct hns3_fdir_rule fdir_rule; + int ret; + + memset(&fdir_rule, 0, sizeof(struct hns3_fdir_rule)); + ret = hns3_parse_fdir_filter(dev, pattern, actions, &fdir_rule, error); + if (ret != 0) + return ret; + + if (fdir_rule.flags & HNS3_RULE_FLAG_COUNTER) { + ret = hns3_counter_new(dev, 0, + fdir_rule.act_cnt.id, error); + if (ret != 0) + return ret; + + flow->counter_id = fdir_rule.act_cnt.id; + } + + fdir_rule_ptr = rte_zmalloc("hns3 fdir rule", + sizeof(struct hns3_fdir_rule_ele), 0); + if (fdir_rule_ptr == NULL) { + hns3_err(hw, "failed to allocate fdir_rule memory."); + ret = -ENOMEM; + goto err_malloc; + } + + /* + * After all the preceding tasks are successfully configured, configure + * rules to the hardware to simplify the rollback of rules in the + * hardware. + */ + ret = hns3_fdir_filter_program(hns, &fdir_rule, false); + if (ret != 0) + goto err_fdir_filter; + + memcpy(&fdir_rule_ptr->fdir_conf, &fdir_rule, + sizeof(struct hns3_fdir_rule)); + TAILQ_INSERT_TAIL(&hw->flow_fdir_list, fdir_rule_ptr, entries); + flow->rule = fdir_rule_ptr; + flow->filter_type = RTE_ETH_FILTER_FDIR; + + return 0; + +err_fdir_filter: + rte_free(fdir_rule_ptr); +err_malloc: + if (fdir_rule.flags & HNS3_RULE_FLAG_COUNTER) + hns3_counter_release(dev, fdir_rule.act_cnt.id); + + return ret; +} + /* * Create or destroy a flow rule. * Theorically one rule can match more than one filters. @@ -1720,13 +1819,9 @@ hns3_flow_create(struct rte_eth_dev *dev, const struct rte_flow_attr *attr, { struct hns3_adapter *hns = dev->data->dev_private; struct hns3_hw *hw = &hns->hw; - const struct hns3_rss_conf *rss_conf; - struct hns3_fdir_rule_ele *fdir_rule_ptr; - struct hns3_rss_conf_ele *rss_filter_ptr; struct hns3_flow_mem *flow_node; const struct rte_flow_action *act; struct rte_flow *flow; - struct hns3_fdir_rule fdir_rule; int ret; ret = hns3_flow_validate(dev, attr, pattern, actions, error); @@ -1752,76 +1847,20 @@ hns3_flow_create(struct rte_eth_dev *dev, const struct rte_flow_attr *attr, TAILQ_INSERT_TAIL(&hw->flow_list, flow_node, entries); act = hns3_find_rss_general_action(pattern, actions); - if (act) { - rss_conf = act->conf; - - ret = hns3_flow_parse_rss(dev, rss_conf, true); - if (ret) - goto err; - - rss_filter_ptr = rte_zmalloc("hns3 rss filter", - sizeof(struct hns3_rss_conf_ele), - 0); - if (rss_filter_ptr == NULL) { - hns3_err(hw, - "Failed to allocate hns3_rss_filter memory"); - ret = -ENOMEM; - goto err; - } - hns3_rss_conf_copy(&rss_filter_ptr->filter_info, - &rss_conf->conf); - rss_filter_ptr->filter_info.valid = true; - TAILQ_INSERT_TAIL(&hw->flow_rss_list, rss_filter_ptr, entries); - - flow->rule = rss_filter_ptr; - flow->filter_type = RTE_ETH_FILTER_HASH; - return flow; - } - - memset(&fdir_rule, 0, sizeof(struct hns3_fdir_rule)); - ret = hns3_parse_fdir_filter(dev, pattern, actions, &fdir_rule, error); - if (ret) - goto out; - - if (fdir_rule.flags & HNS3_RULE_FLAG_COUNTER) { - ret = hns3_counter_new(dev, 0, fdir_rule.act_cnt.id, error); - if (ret) - goto out; - - flow->counter_id = fdir_rule.act_cnt.id; - } - - fdir_rule_ptr = rte_zmalloc("hns3 fdir rule", - sizeof(struct hns3_fdir_rule_ele), - 0); - if (fdir_rule_ptr == NULL) { - hns3_err(hw, "failed to allocate fdir_rule memory."); - ret = -ENOMEM; - goto err_fdir; - } - - ret = hns3_fdir_filter_program(hns, &fdir_rule, false); - if (!ret) { - memcpy(&fdir_rule_ptr->fdir_conf, &fdir_rule, - sizeof(struct hns3_fdir_rule)); - TAILQ_INSERT_TAIL(&hw->flow_fdir_list, fdir_rule_ptr, entries); - flow->rule = fdir_rule_ptr; - flow->filter_type = RTE_ETH_FILTER_FDIR; - + if (act) + ret = hns3_flow_create_rss_rule(dev, act, flow); + else + ret = hns3_flow_create_fdir_rule(dev, pattern, actions, + error, flow); + if (ret == 0) return flow; - } - rte_free(fdir_rule_ptr); -err_fdir: - if (fdir_rule.flags & HNS3_RULE_FLAG_COUNTER) - hns3_counter_release(dev, fdir_rule.act_cnt.id); -err: rte_flow_error_set(error, -ret, RTE_FLOW_ERROR_TYPE_HANDLE, NULL, "Failed to create flow"); -out: TAILQ_REMOVE(&hw->flow_list, flow_node, entries); rte_free(flow_node); rte_free(flow); + return NULL; } -- 2.33.0 ^ permalink raw reply [flat|nested] 38+ messages in thread
* [PATCH v2 15/15] net/hns3: support indirect counter action 2022-01-22 1:51 ` [PATCH v2 " Min Hu (Connor) ` (13 preceding siblings ...) 2022-01-22 1:51 ` [PATCH v2 14/15] net/hns3: extract functions to create RSS and FDIR flow rule Min Hu (Connor) @ 2022-01-22 1:51 ` Min Hu (Connor) 2022-01-27 12:49 ` [PATCH v2 00/15] fix and feature for hns3 PMD Ferruh Yigit 15 siblings, 0 replies; 38+ messages in thread From: Min Hu (Connor) @ 2022-01-22 1:51 UTC (permalink / raw) To: dev; +Cc: ferruh.yigit, andrew.rybchenko, thomas From: Chengwen Feng <fengchengwen@huawei.com> This patch support indirect counter action because the shared counter attribute has been deprecated in DPDK 21.11. Signed-off-by: Chengwen Feng <fengchengwen@huawei.com> --- drivers/net/hns3/hns3_fdir.h | 1 + drivers/net/hns3/hns3_flow.c | 222 +++++++++++++++++++++++++++++++++-- drivers/net/hns3/hns3_flow.h | 11 +- 3 files changed, 224 insertions(+), 10 deletions(-) diff --git a/drivers/net/hns3/hns3_fdir.h b/drivers/net/hns3/hns3_fdir.h index 07b393393d..8d588ffef3 100644 --- a/drivers/net/hns3/hns3_fdir.h +++ b/drivers/net/hns3/hns3_fdir.h @@ -125,6 +125,7 @@ struct hns3_fd_ad_data { #define HNS3_RULE_FLAG_FDID 0x1 #define HNS3_RULE_FLAG_VF_ID 0x2 #define HNS3_RULE_FLAG_COUNTER 0x4 +#define HNS3_RULE_FLAG_COUNTER_INDIR 0x8 struct hns3_fdir_key_conf { struct hns3_fd_rule_tuples spec; diff --git a/drivers/net/hns3/hns3_flow.c b/drivers/net/hns3/hns3_flow.c index 4f271a32dd..56ef6f57b2 100644 --- a/drivers/net/hns3/hns3_flow.c +++ b/drivers/net/hns3/hns3_flow.c @@ -154,7 +154,7 @@ hns3_counter_lookup(struct rte_eth_dev *dev, uint32_t id) } static int -hns3_counter_new(struct rte_eth_dev *dev, uint32_t shared, uint32_t id, +hns3_counter_new(struct rte_eth_dev *dev, uint32_t indirect, uint32_t id, struct rte_flow_error *error) { struct hns3_adapter *hns = dev->data->dev_private; @@ -166,11 +166,14 @@ hns3_counter_new(struct rte_eth_dev *dev, uint32_t shared, uint32_t id, cnt = hns3_counter_lookup(dev, id); if (cnt) { - if (!cnt->shared || cnt->shared != shared) + if (!cnt->indirect || cnt->indirect != indirect) return rte_flow_error_set(error, ENOTSUP, RTE_FLOW_ERROR_TYPE_ACTION_CONF, cnt, - "Counter id is used, shared flag not match"); + "Counter id is used, indirect flag not match"); + /* Clear the indirect counter on first use. */ + if (cnt->indirect && cnt->ref_cnt == 1) + (void)hns3_get_count(hw, id, &value); cnt->ref_cnt++; return 0; } @@ -188,7 +191,7 @@ hns3_counter_new(struct rte_eth_dev *dev, uint32_t shared, uint32_t id, RTE_FLOW_ERROR_TYPE_HANDLE, cnt, "Alloc mem for counter failed"); cnt->id = id; - cnt->shared = shared; + cnt->indirect = indirect; cnt->ref_cnt = 1; cnt->hits = 0; LIST_INSERT_HEAD(&pf->flow_counters, cnt, next); @@ -253,16 +256,30 @@ hns3_counter_release(struct rte_eth_dev *dev, uint32_t id) static void hns3_counter_flush(struct rte_eth_dev *dev) { - struct hns3_adapter *hns = dev->data->dev_private; - struct hns3_pf *pf = &hns->pf; + struct hns3_pf *pf = HNS3_DEV_PRIVATE_TO_PF(dev->data->dev_private); + LIST_HEAD(counters, hns3_flow_counter) indir_counters; struct hns3_flow_counter *cnt_ptr; + LIST_INIT(&indir_counters); cnt_ptr = LIST_FIRST(&pf->flow_counters); while (cnt_ptr) { LIST_REMOVE(cnt_ptr, next); - rte_free(cnt_ptr); + if (cnt_ptr->indirect) + LIST_INSERT_HEAD(&indir_counters, cnt_ptr, next); + else + rte_free(cnt_ptr); cnt_ptr = LIST_FIRST(&pf->flow_counters); } + + /* Reset the indirect action and add to pf->flow_counters list. */ + cnt_ptr = LIST_FIRST(&indir_counters); + while (cnt_ptr) { + LIST_REMOVE(cnt_ptr, next); + cnt_ptr->ref_cnt = 1; + cnt_ptr->hits = 0; + LIST_INSERT_HEAD(&pf->flow_counters, cnt_ptr, next); + cnt_ptr = LIST_FIRST(&indir_counters); + } } static int @@ -332,6 +349,30 @@ hns3_handle_action_queue_region(struct rte_eth_dev *dev, return 0; } +static int +hns3_handle_action_indirect(struct rte_eth_dev *dev, + const struct rte_flow_action *action, + struct hns3_fdir_rule *rule, + struct rte_flow_error *error) +{ + const struct rte_flow_action_handle *indir = action->conf; + + if (indir->indirect_type != HNS3_INDIRECT_ACTION_TYPE_COUNT) + return rte_flow_error_set(error, EINVAL, + RTE_FLOW_ERROR_TYPE_ACTION_CONF, + action, "Invalid indirect type"); + + if (hns3_counter_lookup(dev, indir->counter_id) == NULL) + return rte_flow_error_set(error, EINVAL, + RTE_FLOW_ERROR_TYPE_ACTION_CONF, + action, "Counter id not exist"); + + rule->act_cnt.id = indir->counter_id; + rule->flags |= (HNS3_RULE_FLAG_COUNTER | HNS3_RULE_FLAG_COUNTER_INDIR); + + return 0; +} + /* * Parse actions structure from the provided pattern. * The pattern is validated as the items are copied. @@ -403,6 +444,13 @@ hns3_handle_actions(struct rte_eth_dev *dev, "Invalid counter id"); rule->act_cnt = *act_count; rule->flags |= HNS3_RULE_FLAG_COUNTER; + rule->flags &= ~HNS3_RULE_FLAG_COUNTER_INDIR; + break; + case RTE_FLOW_ACTION_TYPE_INDIRECT: + ret = hns3_handle_action_indirect(dev, actions, rule, + error); + if (ret) + return ret; break; case RTE_FLOW_ACTION_TYPE_VOID: break; @@ -1755,6 +1803,7 @@ hns3_flow_create_fdir_rule(struct rte_eth_dev *dev, struct hns3_adapter *hns = HNS3_DEV_HW_TO_ADAPTER(hw); struct hns3_fdir_rule_ele *fdir_rule_ptr; struct hns3_fdir_rule fdir_rule; + bool indir; int ret; memset(&fdir_rule, 0, sizeof(struct hns3_fdir_rule)); @@ -1762,9 +1811,10 @@ hns3_flow_create_fdir_rule(struct rte_eth_dev *dev, if (ret != 0) return ret; + indir = !!(fdir_rule.flags & HNS3_RULE_FLAG_COUNTER_INDIR); if (fdir_rule.flags & HNS3_RULE_FLAG_COUNTER) { - ret = hns3_counter_new(dev, 0, - fdir_rule.act_cnt.id, error); + ret = hns3_counter_new(dev, indir, fdir_rule.act_cnt.id, + error); if (ret != 0) return ret; @@ -2086,6 +2136,157 @@ hns3_flow_query_wrap(struct rte_eth_dev *dev, struct rte_flow *flow, return ret; } +static int +hns3_check_indir_action(const struct rte_flow_indir_action_conf *conf, + const struct rte_flow_action *action, + struct rte_flow_error *error) +{ + if (!conf->ingress) + return rte_flow_error_set(error, EINVAL, + RTE_FLOW_ERROR_TYPE_ACTION, + NULL, "Indir action ingress can't be zero"); + + if (conf->egress) + return rte_flow_error_set(error, EINVAL, + RTE_FLOW_ERROR_TYPE_ACTION, + NULL, "Indir action not support egress"); + + if (conf->transfer) + return rte_flow_error_set(error, EINVAL, + RTE_FLOW_ERROR_TYPE_ACTION, + NULL, "Indir action not support transfer"); + + if (action->type != RTE_FLOW_ACTION_TYPE_COUNT) + return rte_flow_error_set(error, EINVAL, + RTE_FLOW_ERROR_TYPE_ACTION, + NULL, "Indir action only support count"); + + return 0; +} + +static struct rte_flow_action_handle * +hns3_flow_action_create(struct rte_eth_dev *dev, + const struct rte_flow_indir_action_conf *conf, + const struct rte_flow_action *action, + struct rte_flow_error *error) +{ + struct hns3_hw *hw = HNS3_DEV_PRIVATE_TO_HW(dev->data->dev_private); + struct hns3_pf *pf = HNS3_DEV_PRIVATE_TO_PF(dev->data->dev_private); + const struct rte_flow_action_count *act_count; + struct rte_flow_action_handle *handle = NULL; + struct hns3_flow_counter *counter; + + if (hns3_check_indir_action(conf, action, error)) + return NULL; + + handle = rte_zmalloc("hns3 action handle", + sizeof(struct rte_flow_action_handle), 0); + if (handle == NULL) { + rte_flow_error_set(error, ENOMEM, RTE_FLOW_ERROR_TYPE_HANDLE, + NULL, "Failed to allocate action memory"); + return NULL; + } + + pthread_mutex_lock(&hw->flows_lock); + + act_count = (const struct rte_flow_action_count *)action->conf; + if (act_count->id >= pf->fdir.fd_cfg.cnt_num[HNS3_FD_STAGE_1]) { + rte_flow_error_set(error, EINVAL, + RTE_FLOW_ERROR_TYPE_ACTION_CONF, + action, "Invalid counter id"); + goto err_exit; + } + + if (hns3_counter_new(dev, false, act_count->id, error)) + goto err_exit; + + counter = hns3_counter_lookup(dev, act_count->id); + if (counter == NULL) { + rte_flow_error_set(error, EINVAL, + RTE_FLOW_ERROR_TYPE_ACTION_CONF, + action, "Counter id not found"); + goto err_exit; + } + + counter->indirect = true; + handle->indirect_type = HNS3_INDIRECT_ACTION_TYPE_COUNT; + handle->counter_id = counter->id; + + pthread_mutex_unlock(&hw->flows_lock); + return handle; + +err_exit: + pthread_mutex_unlock(&hw->flows_lock); + rte_free(handle); + return NULL; +} + +static int +hns3_flow_action_destroy(struct rte_eth_dev *dev, + struct rte_flow_action_handle *handle, + struct rte_flow_error *error) +{ + struct hns3_hw *hw = HNS3_DEV_PRIVATE_TO_HW(dev->data->dev_private); + struct hns3_flow_counter *counter; + + pthread_mutex_lock(&hw->flows_lock); + + if (handle->indirect_type != HNS3_INDIRECT_ACTION_TYPE_COUNT) { + pthread_mutex_unlock(&hw->flows_lock); + return rte_flow_error_set(error, EINVAL, + RTE_FLOW_ERROR_TYPE_ACTION_CONF, + handle, "Invalid indirect type"); + } + + counter = hns3_counter_lookup(dev, handle->counter_id); + if (counter == NULL) { + pthread_mutex_unlock(&hw->flows_lock); + return rte_flow_error_set(error, EINVAL, + RTE_FLOW_ERROR_TYPE_ACTION_CONF, + handle, "Counter id not exist"); + } + + if (counter->ref_cnt > 1) { + pthread_mutex_unlock(&hw->flows_lock); + return rte_flow_error_set(error, EBUSY, + RTE_FLOW_ERROR_TYPE_HANDLE, + handle, "Counter id in use"); + } + + (void)hns3_counter_release(dev, handle->counter_id); + rte_free(handle); + + pthread_mutex_unlock(&hw->flows_lock); + return 0; +} + +static int +hns3_flow_action_query(struct rte_eth_dev *dev, + const struct rte_flow_action_handle *handle, + void *data, + struct rte_flow_error *error) +{ + struct hns3_hw *hw = HNS3_DEV_PRIVATE_TO_HW(dev->data->dev_private); + struct rte_flow flow; + int ret; + + pthread_mutex_lock(&hw->flows_lock); + + if (handle->indirect_type != HNS3_INDIRECT_ACTION_TYPE_COUNT) { + pthread_mutex_unlock(&hw->flows_lock); + return rte_flow_error_set(error, EINVAL, + RTE_FLOW_ERROR_TYPE_ACTION_CONF, + handle, "Invalid indirect type"); + } + + memset(&flow, 0, sizeof(flow)); + flow.counter_id = handle->counter_id; + ret = hns3_counter_query(dev, &flow, + (struct rte_flow_query_count *)data, error); + pthread_mutex_unlock(&hw->flows_lock); + return ret; +} + static const struct rte_flow_ops hns3_flow_ops = { .validate = hns3_flow_validate_wrap, .create = hns3_flow_create_wrap, @@ -2093,6 +2294,9 @@ static const struct rte_flow_ops hns3_flow_ops = { .flush = hns3_flow_flush_wrap, .query = hns3_flow_query_wrap, .isolate = NULL, + .action_handle_create = hns3_flow_action_create, + .action_handle_destroy = hns3_flow_action_destroy, + .action_handle_query = hns3_flow_action_query, }; int diff --git a/drivers/net/hns3/hns3_flow.h b/drivers/net/hns3/hns3_flow.h index 2eb451b720..1ab3f9f5c6 100644 --- a/drivers/net/hns3/hns3_flow.h +++ b/drivers/net/hns3/hns3_flow.h @@ -9,7 +9,7 @@ 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 indirect:1; /* Indirect counter flag */ uint32_t ref_cnt:31; /* Reference counter. */ uint16_t id; /* Counter ID. */ uint64_t hits; /* Number of packets matched by the rule. */ @@ -33,6 +33,15 @@ struct hns3_flow_mem { struct rte_flow *flow; }; +enum { + HNS3_INDIRECT_ACTION_TYPE_COUNT = 1, +}; + +struct rte_flow_action_handle { + int indirect_type; + uint32_t counter_id; +}; + TAILQ_HEAD(hns3_rss_filter_list, hns3_rss_conf_ele); TAILQ_HEAD(hns3_flow_mem_list, hns3_flow_mem); -- 2.33.0 ^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [PATCH v2 00/15] fix and feature for hns3 PMD 2022-01-22 1:51 ` [PATCH v2 " Min Hu (Connor) ` (14 preceding siblings ...) 2022-01-22 1:51 ` [PATCH v2 15/15] net/hns3: support indirect counter action Min Hu (Connor) @ 2022-01-27 12:49 ` Ferruh Yigit 2022-01-27 13:50 ` Ferruh Yigit 15 siblings, 1 reply; 38+ messages in thread From: Ferruh Yigit @ 2022-01-27 12:49 UTC (permalink / raw) To: Min Hu (Connor), dev; +Cc: andrew.rybchenko, thomas On 1/22/2022 1:51 AM, Min Hu (Connor) wrote: > This patch contains 15 patches, which include fixing codecheck warning > ,code refactor and indirect counter action support. > > Chengwen Feng (4): > net/hns3: remove invalid encapsulation function > net/hns3: delete strerror invoke > net/hns3: rename function > net/hns3: support indirect counter action > > Huisong Li (10): > net/hns3: remove unnecessary assignment > net/hns3: fix a misjudgment expression > net/hns3: extract a common API to initialize MAC addrs > net/hns3: remove unnecessary black lines > net/hns3: extract a function to handle reset fail > net/hns3: remove unused variables > net/hns3: remove the number of queue descriptors > net/hns3: remove the printing of memory addresses > net/hns3: extract a common interface to obtain revision ID > net/hns3: extract functions to create RSS and FDIR flow rule > > Jie Hai (1): > net/hns3: remove unnecessary 'inline' > Hi Connor, There are some patches in the set that are sent by non maintainers, for them it requires maintainer ack. Since you are sending the patch, it implies that you are OK with them but can you please add your explicit review/ack tags to them? ^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [PATCH v2 00/15] fix and feature for hns3 PMD 2022-01-27 12:49 ` [PATCH v2 00/15] fix and feature for hns3 PMD Ferruh Yigit @ 2022-01-27 13:50 ` Ferruh Yigit 2022-01-28 0:40 ` Min Hu (Connor) 0 siblings, 1 reply; 38+ messages in thread From: Ferruh Yigit @ 2022-01-27 13:50 UTC (permalink / raw) To: Min Hu (Connor), dev; +Cc: andrew.rybchenko, thomas On 1/27/2022 12:49 PM, Ferruh Yigit wrote: > On 1/22/2022 1:51 AM, Min Hu (Connor) wrote: >> This patch contains 15 patches, which include fixing codecheck warning >> ,code refactor and indirect counter action support. >> >> Chengwen Feng (4): >> net/hns3: remove invalid encapsulation function >> net/hns3: delete strerror invoke >> net/hns3: rename function >> net/hns3: support indirect counter action >> >> Huisong Li (10): >> net/hns3: remove unnecessary assignment >> net/hns3: fix a misjudgment expression >> net/hns3: extract a common API to initialize MAC addrs >> net/hns3: remove unnecessary black lines >> net/hns3: extract a function to handle reset fail >> net/hns3: remove unused variables >> net/hns3: remove the number of queue descriptors >> net/hns3: remove the printing of memory addresses >> net/hns3: extract a common interface to obtain revision ID >> net/hns3: extract functions to create RSS and FDIR flow rule >> >> Jie Hai (1): >> net/hns3: remove unnecessary 'inline' >> > > Hi Connor, > > There are some patches in the set that are sent by non maintainers, > for them it requires maintainer ack. > Since you are sending the patch, it implies that you are OK with them > but can you please add your explicit review/ack tags to them? Implicit ack converted to an explicit one: For series, Acked-by: Min Hu (Connor) <humin29@huawei.com> Series applied to dpdk-next-net/main, thanks. ^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [PATCH v2 00/15] fix and feature for hns3 PMD 2022-01-27 13:50 ` Ferruh Yigit @ 2022-01-28 0:40 ` Min Hu (Connor) 0 siblings, 0 replies; 38+ messages in thread From: Min Hu (Connor) @ 2022-01-28 0:40 UTC (permalink / raw) To: Ferruh Yigit, dev; +Cc: andrew.rybchenko, thomas 在 2022/1/27 21:50, Ferruh Yigit 写道: > On 1/27/2022 12:49 PM, Ferruh Yigit wrote: >> On 1/22/2022 1:51 AM, Min Hu (Connor) wrote: >>> This patch contains 15 patches, which include fixing codecheck warning >>> ,code refactor and indirect counter action support. >>> >>> Chengwen Feng (4): >>> net/hns3: remove invalid encapsulation function >>> net/hns3: delete strerror invoke >>> net/hns3: rename function >>> net/hns3: support indirect counter action >>> >>> Huisong Li (10): >>> net/hns3: remove unnecessary assignment >>> net/hns3: fix a misjudgment expression >>> net/hns3: extract a common API to initialize MAC addrs >>> net/hns3: remove unnecessary black lines >>> net/hns3: extract a function to handle reset fail >>> net/hns3: remove unused variables >>> net/hns3: remove the number of queue descriptors >>> net/hns3: remove the printing of memory addresses >>> net/hns3: extract a common interface to obtain revision ID >>> net/hns3: extract functions to create RSS and FDIR flow rule >>> >>> Jie Hai (1): >>> net/hns3: remove unnecessary 'inline' >>> >> >> Hi Connor, >> >> There are some patches in the set that are sent by non maintainers, >> for them it requires maintainer ack. >> Since you are sending the patch, it implies that you are OK with them >> but can you please add your explicit review/ack tags to them? Yes, I am OK with them. > > > Implicit ack converted to an explicit one: Thanks Ferruh. > > For series, > Acked-by: Min Hu (Connor) <humin29@huawei.com> > > Series applied to dpdk-next-net/main, thanks. > . ^ permalink raw reply [flat|nested] 38+ messages in thread
end of thread, other threads:[~2022-01-28 0:40 UTC | newest] Thread overview: 38+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2022-01-07 10:15 [PATCH 00/15] fix and feature for hns3 PMD Min Hu (Connor) 2022-01-07 10:15 ` [PATCH 01/15] net/hns3: remove unnecessary assignment Min Hu (Connor) 2022-01-07 10:15 ` [PATCH 02/15] net/hns3: fix a misjudgment expression Min Hu (Connor) 2022-01-07 10:15 ` [PATCH 03/15] net/hns3: extract a common API to initialize MAC addrs Min Hu (Connor) 2022-01-07 10:15 ` [PATCH 04/15] net/hns3: remove unnecessary 'inline' Min Hu (Connor) 2022-01-07 10:15 ` [PATCH 05/15] net/hns3: remove unnecessary black lines Min Hu (Connor) 2022-01-07 10:15 ` [PATCH 06/15] net/hns3: extract a function to handle reset fail Min Hu (Connor) 2022-01-07 10:15 ` [PATCH 07/15] net/hns3: extract functions to create RSS and FDIR flow rule Min Hu (Connor) 2022-01-07 10:15 ` [PATCH 08/15] net/hns3: remove unused variables Min Hu (Connor) 2022-01-07 10:15 ` [PATCH 09/15] net/hns3: remove the number of queue descriptors Min Hu (Connor) 2022-01-07 10:15 ` [PATCH 10/15] net/hns3: remove the printing of memory addresses Min Hu (Connor) 2022-01-07 10:15 ` [PATCH 11/15] net/hns3: extract a common interface to obtain revision ID Min Hu (Connor) 2022-01-07 10:15 ` [PATCH 12/15] net/hns3: remove invalid encapsulation function Min Hu (Connor) 2022-01-07 10:15 ` [PATCH 13/15] net/hns3: delete strerror invoke Min Hu (Connor) 2022-01-07 10:15 ` [PATCH 14/15] net/hns3: rename function Min Hu (Connor) 2022-01-07 10:15 ` [PATCH 15/15] net/hns3: support indirect counter action Min Hu (Connor) 2022-01-21 17:29 ` [PATCH 00/15] fix and feature for hns3 PMD Ferruh Yigit 2022-01-22 1:52 ` Min Hu (Connor) 2022-01-22 1:51 ` [PATCH v2 " Min Hu (Connor) 2022-01-22 1:51 ` [PATCH v2 01/15] net/hns3: remove unnecessary assignment Min Hu (Connor) 2022-01-22 1:51 ` [PATCH v2 02/15] net/hns3: fix a misjudgment expression Min Hu (Connor) 2022-01-22 1:51 ` [PATCH v2 03/15] net/hns3: extract a common API to initialize MAC addrs Min Hu (Connor) 2022-01-22 1:51 ` [PATCH v2 04/15] net/hns3: remove unnecessary 'inline' Min Hu (Connor) 2022-01-22 1:51 ` [PATCH v2 05/15] net/hns3: remove unnecessary black lines Min Hu (Connor) 2022-01-22 1:51 ` [PATCH v2 06/15] net/hns3: extract a function to handle reset fail Min Hu (Connor) 2022-01-22 1:51 ` [PATCH v2 07/15] net/hns3: remove unused variables Min Hu (Connor) 2022-01-22 1:51 ` [PATCH v2 08/15] net/hns3: remove the number of queue descriptors Min Hu (Connor) 2022-01-22 1:51 ` [PATCH v2 09/15] net/hns3: remove the printing of memory addresses Min Hu (Connor) 2022-01-22 1:51 ` [PATCH v2 10/15] net/hns3: extract a common interface to obtain revision ID Min Hu (Connor) 2022-01-22 1:51 ` [PATCH v2 11/15] net/hns3: remove invalid encapsulation function Min Hu (Connor) 2022-01-27 13:04 ` Ferruh Yigit 2022-01-22 1:51 ` [PATCH v2 12/15] net/hns3: delete strerror invoke Min Hu (Connor) 2022-01-22 1:51 ` [PATCH v2 13/15] net/hns3: rename function Min Hu (Connor) 2022-01-22 1:51 ` [PATCH v2 14/15] net/hns3: extract functions to create RSS and FDIR flow rule Min Hu (Connor) 2022-01-22 1:51 ` [PATCH v2 15/15] net/hns3: support indirect counter action Min Hu (Connor) 2022-01-27 12:49 ` [PATCH v2 00/15] fix and feature for hns3 PMD Ferruh Yigit 2022-01-27 13:50 ` Ferruh Yigit 2022-01-28 0:40 ` Min Hu (Connor)
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).