* [PATCH 1/6] net/hns3: cancel heartbeat alarm when VF reset
2022-06-24 8:59 [PATCH 0/6] some bugfixes for hns3 Dongdong Liu
@ 2022-06-24 8:59 ` Dongdong Liu
2022-06-24 8:59 ` [PATCH 2/6] net/hns3: fix received unknown event print when PTP enable Dongdong Liu
` (5 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Dongdong Liu @ 2022-06-24 8:59 UTC (permalink / raw)
To: dev, ferruh.yigit, andrew.rybchenko, thomas
Cc: stable, Huisong Li, Dongdong Liu, Yisen Zhuang
From: Huisong Li <lihuisong@huawei.com>
The purpose of the heartbeat alarm is to keep alive for VF. The mailbox
channel is disabled when VF is reset, and the heartbeat mailbox message
will fail to send. If the reset is not complete, the error information
about the heartbeat sending failure will be printed continuously.
In fact, VF does set alive when VF restore its configuration. So the
heartbeat alarm can be canceled to prepare to start reset and start the
alarm when start service.
Signed-off-by: Huisong Li <lihuisong@huawei.com>
---
drivers/net/hns3/hns3_ethdev_vf.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/drivers/net/hns3/hns3_ethdev_vf.c b/drivers/net/hns3/hns3_ethdev_vf.c
index 6c8940fde5..2ac712ec77 100644
--- a/drivers/net/hns3/hns3_ethdev_vf.c
+++ b/drivers/net/hns3/hns3_ethdev_vf.c
@@ -1977,6 +1977,8 @@ hns3vf_stop_service(struct hns3_adapter *hns)
} else
hw->reset.mbuf_deferred_free = false;
+ rte_eal_alarm_cancel(hns3vf_keep_alive_handler, eth_dev);
+
/*
* It is cumbersome for hardware to pick-and-choose entries for deletion
* from table space. Hence, for function reset software intervention is
@@ -1998,6 +2000,10 @@ hns3vf_start_service(struct hns3_adapter *hns)
eth_dev = &rte_eth_devices[hw->data->port_id];
hns3_set_rxtx_function(eth_dev);
hns3_mp_req_start_rxtx(eth_dev);
+
+ rte_eal_alarm_set(HNS3VF_KEEP_ALIVE_INTERVAL, hns3vf_keep_alive_handler,
+ eth_dev);
+
if (hw->adapter_state == HNS3_NIC_STARTED) {
hns3vf_start_poll_job(eth_dev);
--
2.22.0
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 2/6] net/hns3: fix received unknown event print when PTP enable
2022-06-24 8:59 [PATCH 0/6] some bugfixes for hns3 Dongdong Liu
2022-06-24 8:59 ` [PATCH 1/6] net/hns3: cancel heartbeat alarm when VF reset Dongdong Liu
@ 2022-06-24 8:59 ` Dongdong Liu
2022-06-24 8:59 ` [PATCH 3/6] net/hns3: fix statistic lock Dongdong Liu
` (4 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Dongdong Liu @ 2022-06-24 8:59 UTC (permalink / raw)
To: dev, ferruh.yigit, andrew.rybchenko, thomas
Cc: stable, Huisong Li, Dongdong Liu, Yisen Zhuang, Min Hu (Connor)
From: Huisong Li <lihuisong@huawei.com>
PMD driver will receive a PTP interrupt when receive a PTP packet.
But driver doesn't distinguish it. As a result, many unknown events
are printed when many PTP packets are received on the link. The PTP
interrupt is normal, so this patch doesn't log and ignores it.
Fixes: 38b539d96eb6 ("net/hns3: support IEEE 1588 PTP")
Cc: stable@dpdk.org
Signed-off-by: Huisong Li <lihuisong@huawei.com>
Signed-off-by: Dongdong Liu <liudongdong3@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 4f507efa35..96fde7550f 100644
--- a/drivers/net/hns3/hns3_ethdev.c
+++ b/drivers/net/hns3/hns3_ethdev.c
@@ -317,7 +317,7 @@ hns3_interrupt_handler(void *param)
hns3_schedule_reset(hns);
} else if (event_cause == HNS3_VECTOR0_EVENT_MBX) {
hns3_dev_handle_mbx_msg(hw);
- } else {
+ } else if (event_cause != HNS3_VECTOR0_EVENT_PTP) {
hns3_warn(hw, "received unknown event: vector0_int_stat:0x%x "
"ras_int_stat:0x%x cmdq_int_stat:0x%x",
vector0_int, ras_int, cmdq_int);
--
2.22.0
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 3/6] net/hns3: fix statistic lock
2022-06-24 8:59 [PATCH 0/6] some bugfixes for hns3 Dongdong Liu
2022-06-24 8:59 ` [PATCH 1/6] net/hns3: cancel heartbeat alarm when VF reset Dongdong Liu
2022-06-24 8:59 ` [PATCH 2/6] net/hns3: fix received unknown event print when PTP enable Dongdong Liu
@ 2022-06-24 8:59 ` Dongdong Liu
2022-06-24 8:59 ` [PATCH 4/6] net/hns3: fix nb-desc not verified when using SVE Dongdong Liu
` (3 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Dongdong Liu @ 2022-06-24 8:59 UTC (permalink / raw)
To: dev, ferruh.yigit, andrew.rybchenko, thomas
Cc: stable, Huisong Li, Dongdong Liu, Yisen Zhuang
From: Huisong Li <lihuisong@huawei.com>
The stats_lock is used to protect statistics update in stats APIs and
periodic task, but current code only protect queue related statistics.
Fixes: 1bb6e9073b82 ("net/hns3: fix MAC and queues hw statistics reversion")
Cc: stable@dpdk.org
Signed-off-by: Huisong Li <lihuisong@huawei.com>
Signed-off-by: Dongdong Liu <liudongdong3@huawei.com>
---
drivers/net/hns3/hns3_stats.c | 22 +++++++++-------------
1 file changed, 9 insertions(+), 13 deletions(-)
diff --git a/drivers/net/hns3/hns3_stats.c b/drivers/net/hns3/hns3_stats.c
index 07fad03485..1b0464f3f7 100644
--- a/drivers/net/hns3/hns3_stats.c
+++ b/drivers/net/hns3/hns3_stats.c
@@ -629,6 +629,7 @@ hns3_stats_get(struct rte_eth_dev *eth_dev, struct rte_eth_stats *rte_stats)
uint16_t i;
int ret;
+ rte_spinlock_lock(&hw->stats_lock);
/* Update imissed stats */
ret = hns3_update_imissed_stats(hw, false);
if (ret) {
@@ -644,10 +645,7 @@ hns3_stats_get(struct rte_eth_dev *eth_dev, struct rte_eth_stats *rte_stats)
if (rxq == NULL)
continue;
- rte_spinlock_lock(&hw->stats_lock);
hns3_rcb_rx_ring_stats_get(rxq, stats);
- rte_spinlock_unlock(&hw->stats_lock);
-
rte_stats->ierrors += rxq->err_stats.l2_errors +
rxq->err_stats.pkt_len_errors;
rte_stats->ibytes += rxq->basic_stats.bytes;
@@ -659,9 +657,7 @@ hns3_stats_get(struct rte_eth_dev *eth_dev, struct rte_eth_stats *rte_stats)
if (txq == NULL)
continue;
- rte_spinlock_lock(&hw->stats_lock);
hns3_rcb_tx_ring_stats_get(txq, stats);
- rte_spinlock_unlock(&hw->stats_lock);
rte_stats->obytes += txq->basic_stats.bytes;
}
@@ -683,7 +679,10 @@ hns3_stats_get(struct rte_eth_dev *eth_dev, struct rte_eth_stats *rte_stats)
rte_stats->opackets = stats->rcb_tx_ring_pktnum_rcd -
rte_stats->oerrors;
rte_stats->rx_nombuf = eth_dev->data->rx_mbuf_alloc_failed;
+
out:
+ rte_spinlock_unlock(&hw->stats_lock);
+
return ret;
}
@@ -697,6 +696,7 @@ hns3_stats_reset(struct rte_eth_dev *eth_dev)
uint16_t i;
int ret;
+ rte_spinlock_lock(&hw->stats_lock);
/*
* Note: Reading hardware statistics of imissed registers will
* clear them.
@@ -732,7 +732,6 @@ hns3_stats_reset(struct rte_eth_dev *eth_dev)
if (rxq == NULL)
continue;
- rte_spinlock_lock(&hw->stats_lock);
memset(&rxq->basic_stats, 0,
sizeof(struct hns3_rx_basic_stats));
@@ -740,7 +739,6 @@ hns3_stats_reset(struct rte_eth_dev *eth_dev)
(void)hns3_read_dev(rxq, HNS3_RING_RX_PKTNUM_RECORD_REG);
rxq->err_stats.pkt_len_errors = 0;
rxq->err_stats.l2_errors = 0;
- rte_spinlock_unlock(&hw->stats_lock);
}
/* Clear all the stats of a txq in a loop to keep them synchronized */
@@ -749,19 +747,18 @@ hns3_stats_reset(struct rte_eth_dev *eth_dev)
if (txq == NULL)
continue;
- rte_spinlock_lock(&hw->stats_lock);
memset(&txq->basic_stats, 0,
sizeof(struct hns3_tx_basic_stats));
/* This register is read-clear */
(void)hns3_read_dev(txq, HNS3_RING_TX_PKTNUM_RECORD_REG);
- rte_spinlock_unlock(&hw->stats_lock);
}
- rte_spinlock_lock(&hw->stats_lock);
hns3_tqp_stats_clear(hw);
- rte_spinlock_unlock(&hw->stats_lock);
+
out:
+ rte_spinlock_unlock(&hw->stats_lock);
+
return ret;
}
@@ -1082,11 +1079,11 @@ hns3_dev_xstats_get(struct rte_eth_dev *dev, struct rte_eth_xstat *xstats,
count++;
}
}
- rte_spinlock_unlock(&hw->stats_lock);
ret = hns3_update_imissed_stats(hw, false);
if (ret) {
hns3_err(hw, "update imissed stats failed, ret = %d", ret);
+ rte_spinlock_unlock(&hw->stats_lock);
return ret;
}
@@ -1115,7 +1112,6 @@ hns3_dev_xstats_get(struct rte_eth_dev *dev, struct rte_eth_xstat *xstats,
}
}
- rte_spinlock_lock(&hw->stats_lock);
hns3_tqp_dfx_stats_get(dev, xstats, &count);
hns3_queue_stats_get(dev, xstats, &count);
rte_spinlock_unlock(&hw->stats_lock);
--
2.22.0
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 4/6] net/hns3: fix nb-desc not verified when using SVE
2022-06-24 8:59 [PATCH 0/6] some bugfixes for hns3 Dongdong Liu
` (2 preceding siblings ...)
2022-06-24 8:59 ` [PATCH 3/6] net/hns3: fix statistic lock Dongdong Liu
@ 2022-06-24 8:59 ` Dongdong Liu
2022-06-24 8:59 ` [PATCH 5/6] net/hns3: make code more clean Dongdong Liu
` (2 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Dongdong Liu @ 2022-06-24 8:59 UTC (permalink / raw)
To: dev, ferruh.yigit, andrew.rybchenko, thomas
Cc: stable, Chengwen Feng, Dongdong Liu, Yisen Zhuang,
Chengchang Tang, Wei Hu (Xavier)
From: Chengwen Feng <fengchengwen@huawei.com>
The SVE algorithm and NEON algorithm have the same requirements for
nb-desc, but the nb-desc is verified only when using NEON. This patch
fixes it.
Fixes: fa29fe45a7b4 ("net/hns3: support queue start and stop")
Cc: stable@dpdk.org
Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
Signed-off-by: Dongdong Liu <liudongdong3@huawei.com>
---
drivers/net/hns3/hns3_rxtx.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/net/hns3/hns3_rxtx.c b/drivers/net/hns3/hns3_rxtx.c
index 0c91e4721e..b48da82b64 100644
--- a/drivers/net/hns3/hns3_rxtx.c
+++ b/drivers/net/hns3/hns3_rxtx.c
@@ -1754,7 +1754,8 @@ hns3_rxq_conf_runtime_check(struct hns3_hw *hw, uint16_t buf_size,
return -EINVAL;
}
- if (pkt_burst == hns3_recv_pkts_vec) {
+ if (pkt_burst == hns3_recv_pkts_vec ||
+ pkt_burst == hns3_recv_pkts_vec_sve) {
min_vec_bds = HNS3_DEFAULT_RXQ_REARM_THRESH +
HNS3_DEFAULT_RX_BURST;
if (nb_desc < min_vec_bds ||
--
2.22.0
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 5/6] net/hns3: make code more clean
2022-06-24 8:59 [PATCH 0/6] some bugfixes for hns3 Dongdong Liu
` (3 preceding siblings ...)
2022-06-24 8:59 ` [PATCH 4/6] net/hns3: fix nb-desc not verified when using SVE Dongdong Liu
@ 2022-06-24 8:59 ` Dongdong Liu
2022-06-24 8:59 ` [PATCH 6/6] net/hns3: delete the unused code Dongdong Liu
2022-06-24 12:37 ` [PATCH 0/6] some bugfixes for hns3 Andrew Rybchenko
6 siblings, 0 replies; 8+ messages in thread
From: Dongdong Liu @ 2022-06-24 8:59 UTC (permalink / raw)
To: dev, ferruh.yigit, andrew.rybchenko, thomas
Cc: stable, Dongdong Liu, Yisen Zhuang
Delete unnecessary code and adjust code to make code more clean.
Signed-off-by: Dongdong Liu <liudongdong3@huawei.com>
---
drivers/net/hns3/hns3_rxtx.c | 10 +++-------
1 file changed, 3 insertions(+), 7 deletions(-)
diff --git a/drivers/net/hns3/hns3_rxtx.c b/drivers/net/hns3/hns3_rxtx.c
index b48da82b64..4ae07fd91d 100644
--- a/drivers/net/hns3/hns3_rxtx.c
+++ b/drivers/net/hns3/hns3_rxtx.c
@@ -1904,8 +1904,6 @@ hns3_rx_queue_setup(struct rte_eth_dev *dev, uint16_t idx, uint16_t nb_desc,
rxq->pvid_sw_discard_en = false;
rxq->ptype_en = hns3_dev_get_support(hw, RXD_ADV_LAYOUT) ? true : false;
rxq->configured = true;
- rxq->io_base = (void *)((char *)hw->io_base + HNS3_TQP_REG_OFFSET +
- idx * HNS3_TQP_REG_SIZE);
rxq->io_base = (void *)((char *)hw->io_base +
hns3_get_tqp_reg_offset(idx));
rxq->io_head_reg = (volatile void *)((char *)rxq->io_base +
@@ -2437,10 +2435,8 @@ hns3_recv_pkts_simple(void *rx_queue,
nmb = hns3_rx_alloc_buffer(rxq);
if (unlikely(nmb == NULL)) {
- uint16_t port_id;
-
- port_id = rxq->port_id;
- rte_eth_devices[port_id].data->rx_mbuf_alloc_failed++;
+ rte_eth_devices[rxq->port_id].data->
+ rx_mbuf_alloc_failed++;
break;
}
@@ -3865,7 +3861,7 @@ hns3_prep_pkt_proc(struct hns3_tx_queue *tx_queue, struct rte_mbuf *m)
#endif
if (hns3_pkt_is_tso(m)) {
if (hns3_pkt_need_linearized(m, m->nb_segs,
- tx_queue->max_non_tso_bd_num) ||
+ tx_queue->max_non_tso_bd_num) ||
hns3_check_tso_pkt_valid(m)) {
rte_errno = EINVAL;
return -EINVAL;
--
2.22.0
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 6/6] net/hns3: delete the unused code
2022-06-24 8:59 [PATCH 0/6] some bugfixes for hns3 Dongdong Liu
` (4 preceding siblings ...)
2022-06-24 8:59 ` [PATCH 5/6] net/hns3: make code more clean Dongdong Liu
@ 2022-06-24 8:59 ` Dongdong Liu
2022-06-24 12:37 ` [PATCH 0/6] some bugfixes for hns3 Andrew Rybchenko
6 siblings, 0 replies; 8+ messages in thread
From: Dongdong Liu @ 2022-06-24 8:59 UTC (permalink / raw)
To: dev, ferruh.yigit, andrew.rybchenko, thomas
Cc: stable, Dongdong Liu, Yisen Zhuang, Huisong Li, Min Hu (Connor)
The RTE_HNS3_ONLY_1630_FPGA macro is not in use, so delete the code.
Fixes: 2192c428f9a6 ("net/hns3: fix firmware compatibility configuration")
Fixes: bdaf190f8235 ("net/hns3: support link speed autoneg for PF")
Cc: stable@dpdk.org
Signed-off-by: Dongdong Liu <liudongdong3@huawei.com>
---
drivers/net/hns3/hns3_cmd.c | 33 ---------------------------------
drivers/net/hns3/hns3_ethdev.c | 11 ++---------
2 files changed, 2 insertions(+), 42 deletions(-)
diff --git a/drivers/net/hns3/hns3_cmd.c b/drivers/net/hns3/hns3_cmd.c
index 5dc874fd7a..0883df1b62 100644
--- a/drivers/net/hns3/hns3_cmd.c
+++ b/drivers/net/hns3/hns3_cmd.c
@@ -631,39 +631,6 @@ hns3_firmware_compat_config(struct hns3_hw *hw, bool is_init)
struct hns3_cmd_desc desc;
uint32_t compat = 0;
-#if defined(RTE_HNS3_ONLY_1630_FPGA)
- /* If resv reg enabled phy driver of imp is not configured, driver
- * will use temporary phy driver.
- */
- 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;
- }
- if (revision == PCI_REVISION_ID_HIP09_A) {
- struct hns3_pf *pf = HNS3_DEV_HW_TO_PF(hw);
- if (hns3_dev_get_support(hw, COPPER) == 0 || pf->is_tmp_phy) {
- PMD_INIT_LOG(ERR, "***use temp phy driver in dpdk***");
- pf->is_tmp_phy = true;
- hns3_set_bit(hw->capability,
- HNS3_DEV_SUPPORT_COPPER_B, 1);
- return 0;
- }
-
- PMD_INIT_LOG(ERR, "***use phy driver in imp***");
- }
-#endif
-
hns3_cmd_setup_basic_desc(&desc, HNS3_OPC_FIRMWARE_COMPAT_CFG, false);
req = (struct hns3_firmware_compat_cmd *)desc.data;
diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c
index 96fde7550f..5822d4fa71 100644
--- a/drivers/net/hns3/hns3_ethdev.c
+++ b/drivers/net/hns3/hns3_ethdev.c
@@ -4970,17 +4970,10 @@ hns3_set_port_link_speed(struct hns3_hw *hw,
{
int ret;
- if (hw->mac.media_type == HNS3_MEDIA_TYPE_COPPER) {
-#if defined(RTE_HNS3_ONLY_1630_FPGA)
- struct hns3_pf *pf = HNS3_DEV_HW_TO_PF(hw);
- if (pf->is_tmp_phy)
- return 0;
-#endif
-
+ if (hw->mac.media_type == HNS3_MEDIA_TYPE_COPPER)
ret = hns3_set_copper_port_link_speed(hw, cfg);
- } else {
+ else
ret = hns3_set_fiber_port_link_speed(hw, cfg);
- }
if (ret) {
hns3_err(hw, "failed to set %s port link speed, ret = %d.",
--
2.22.0
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 0/6] some bugfixes for hns3
2022-06-24 8:59 [PATCH 0/6] some bugfixes for hns3 Dongdong Liu
` (5 preceding siblings ...)
2022-06-24 8:59 ` [PATCH 6/6] net/hns3: delete the unused code Dongdong Liu
@ 2022-06-24 12:37 ` Andrew Rybchenko
6 siblings, 0 replies; 8+ messages in thread
From: Andrew Rybchenko @ 2022-06-24 12:37 UTC (permalink / raw)
To: Dongdong Liu, dev, ferruh.yigit, thomas; +Cc: stable
On 6/24/22 11:59, Dongdong Liu wrote:
> The patchset include some bugfixes and clean code for hns3.
>
> The patchset depend on the below patchset to avoid confilict.
> [PATCH 0/2] net/hns3: support backplane media type
> https://lore.kernel.org/all/8689c6e8-935b-e2dc-3276-d2970a8bd982@xilinx.com/T/
>
> Chengwen Feng (1):
> net/hns3: fix nb-desc not verified when using SVE
>
> Dongdong Liu (2):
> net/hns3: make code more clean
> net/hns3: delete the unused code
>
> Huisong Li (3):
> net/hns3: cancel heartbeat alarm when VF reset
> net/hns3: fix received unknown event print when PTP enable
> net/hns3: fix statistic lock
>
> drivers/net/hns3/hns3_cmd.c | 33 -------------------------------
> drivers/net/hns3/hns3_ethdev.c | 13 +++---------
> drivers/net/hns3/hns3_ethdev_vf.c | 6 ++++++
> drivers/net/hns3/hns3_rxtx.c | 13 +++++-------
> drivers/net/hns3/hns3_stats.c | 22 +++++++++------------
> 5 files changed, 23 insertions(+), 64 deletions(-)
>
> --
> 2.22.0
>
With submitted Signed-off-by added to the first patch
Applied to dpdk-next-net/main, thanks.
^ permalink raw reply [flat|nested] 8+ messages in thread