From a3bc2b6f9f491176ec6915617ad59f3707b24956 Mon Sep 17 00:00:00 2001 From: Yonglong Liu Date: Thu, 8 May 2025 15:44:12 +0800 Subject: [PATCH 1/3] net: hns3: disable interrupt when ptp init failed driver inclusion category: bugfix bugzilla: https://gitee.com/openeuler/kernel/issues/IC97QS ---------------------------------------------------------------------- When ptp init failed, we'd better disable the interrupt and clear the flag, to avoid early report interrupt at next probe. Fixes: 0bf5eb788512 ("net: hns3: add support for PTP") Signed-off-by: Yonglong Liu Signed-off-by: Hao Chen Signed-off-by: hbmm --- drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_ptp.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_ptp.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_ptp.c index 251d850708fb2..55a40254bdc93 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_ptp.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_ptp.c @@ -511,14 +511,14 @@ int hclge_ptp_init(struct hclge_dev *hdev) if (ret) { dev_err(&hdev->pdev->dev, "failed to init freq, ret = %d\n", ret); - goto out; + goto out_clear_int; } ret = hclge_ptp_set_ts_mode(hdev, &hdev->ptp->ts_cfg); if (ret) { dev_err(&hdev->pdev->dev, "failed to init ts mode, ret = %d\n", ret); - goto out; + goto out_clear_int; } ktime_get_real_ts64(&ts); @@ -526,7 +526,7 @@ int hclge_ptp_init(struct hclge_dev *hdev) if (ret) { dev_err(&hdev->pdev->dev, "failed to init ts time, ret = %d\n", ret); - goto out; + goto out_clear_int; } set_bit(HCLGE_STATE_PTP_EN, &hdev->state); @@ -534,6 +534,9 @@ int hclge_ptp_init(struct hclge_dev *hdev) return 0; +out_clear_int: + clear_bit(HCLGE_PTP_FLAG_EN, &hdev->ptp->flags); + hclge_ptp_int_en(hdev, false); out: hclge_ptp_destroy_clock(hdev); -- Gitee From 5e31a3ff8b708f7d583e8e1a46aa239d4d43d709 Mon Sep 17 00:00:00 2001 From: Salil Mehta Date: Mon, 10 Jun 2024 12:40:33 +0000 Subject: [PATCH 2/3] net: hns3: avoid unnecessary checking when unmap buffer driver inclusion category: bugfix bugzilla: https://gitee.com/openeuler/kernel/issues/IC97QS ---------------------------------------------------------------------- Page-pool allocates buffers which are already DMA mapped. So it's unnecessary to call hns3_unmap_buffer() when page pool enabled. Fixes: 76ad4f0ee747 ("net: hns3: Add support of HNS3 Ethernet Driver for hip08 SoC") Signed-off-by: Salil Mehta Signed-off-by: Jian Shen Signed-off-by: Hao Chen Signed-off-by: hbmm --- drivers/net/ethernet/hisilicon/hns3/hns3_enet.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c index 0f25d4fa94dd3..53a40d7b521db 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c @@ -3818,9 +3818,11 @@ static void hns3_unmap_buffer(struct hns3_enet_ring *ring, static void hns3_buffer_detach(struct hns3_enet_ring *ring, int i) { - hns3_unmap_buffer(ring, &ring->desc_cb[i]); + if (!ring->page_pool) { + hns3_unmap_buffer(ring, &ring->desc_cb[i]); + ring->desc_cb[i].refill = 0; + } ring->desc[i].addr = 0; - ring->desc_cb[i].refill = 0; } static void hns3_free_buffer_detach(struct hns3_enet_ring *ring, int i, @@ -3930,7 +3932,9 @@ static int hns3_alloc_ring_buffers(struct hns3_enet_ring *ring) static void hns3_replace_buffer(struct hns3_enet_ring *ring, int i, struct hns3_desc_cb *res_cb) { - hns3_unmap_buffer(ring, &ring->desc_cb[i]); + if (!ring->page_pool) + hns3_unmap_buffer(ring, &ring->desc_cb[i]); + ring->desc_cb[i] = *res_cb; ring->desc_cb[i].refill = 1; ring->desc[i].addr = cpu_to_le64(ring->desc_cb[i].dma + -- Gitee From 5d977dfb74a16304def19e1c4691df2fb2aeaf93 Mon Sep 17 00:00:00 2001 From: Yonglong Liu Date: Sat, 22 Feb 2025 15:49:50 +0800 Subject: [PATCH 3/3] net: hns3: fix a use of uninitialized variable problem driver inclusion category: bugfix bugzilla: https://gitee.com/openeuler/kernel/issues/IC97QS ---------------------------------------------------------------------- In hclge_add_fd_entry(), if the flow type is FLOW_EXT, and the data of m_ext is all zero, then some members of the local variable "info" are not initialized. Fixes: 67b0e1428e2f ("net: hns3: add support for user-def data of flow director") Signed-off-by: Yonglong Liu Signed-off-by: Hao Chen Signed-off-by: hbmm --- drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c index 458c39c8fa6f8..f2a827545a59f 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c @@ -7100,8 +7100,8 @@ static int hclge_add_fd_entry(struct hnae3_handle *handle, struct ethtool_rxnfc *cmd) { struct hclge_vport *vport = hclge_get_vport(handle); + struct hclge_fd_user_def_info info = {0}; struct hclge_dev *hdev = vport->back; - struct hclge_fd_user_def_info info; u16 dst_vport_id = 0, q_index = 0; struct ethtool_rx_flow_spec *fs; struct hclge_fd_rule *rule; -- Gitee