From patchwork Mon May 29 13:09:30 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dongdong Liu X-Patchwork-Id: 127667 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id B074242BD3; Mon, 29 May 2023 15:12:20 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id D207242D0C; Mon, 29 May 2023 15:12:14 +0200 (CEST) Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by mails.dpdk.org (Postfix) with ESMTP id 741194111C; Mon, 29 May 2023 15:12:11 +0200 (CEST) Received: from kwepemi500017.china.huawei.com (unknown [172.30.72.56]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4QVG9N1PkHzLmSF; Mon, 29 May 2023 21:10:32 +0800 (CST) Received: from localhost.localdomain (10.28.79.22) by kwepemi500017.china.huawei.com (7.221.188.110) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.23; Mon, 29 May 2023 21:12:05 +0800 From: Dongdong Liu To: , , , , CC: , , , , Subject: [PATCH 01/11] net/hns3: fix uninitialized RTC time Date: Mon, 29 May 2023 21:09:30 +0800 Message-ID: <20230529130940.1501-2-liudongdong3@huawei.com> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20230529130940.1501-1-liudongdong3@huawei.com> References: <20230529130940.1501-1-liudongdong3@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.28.79.22] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To kwepemi500017.china.huawei.com (7.221.188.110) X-CFilter-Loop: Reflected X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org From: Huisong Li Driver doesn't initialize RTC time during probe phase, which lead to an inaccurate time. Fixes: 38b539d96eb6 ("net/hns3: support IEEE 1588 PTP") Cc: stable@dpdk.org Signed-off-by: Huisong Li Signed-off-by: Dongdong Liu --- drivers/net/hns3/hns3_ptp.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/net/hns3/hns3_ptp.c b/drivers/net/hns3/hns3_ptp.c index db3c007b12..fb834bb180 100644 --- a/drivers/net/hns3/hns3_ptp.c +++ b/drivers/net/hns3/hns3_ptp.c @@ -59,6 +59,8 @@ hns3_ptp_int_en(struct hns3_hw *hw, bool en) int hns3_ptp_init(struct hns3_hw *hw) { + struct timespec sys_time; + struct rte_eth_dev *dev; int ret; if (!hns3_dev_get_support(hw, PTP)) @@ -71,6 +73,11 @@ hns3_ptp_init(struct hns3_hw *hw) /* Start PTP timer */ hns3_write_dev(hw, HNS3_CFG_TIME_CYC_EN, 1); + /* Initializing the RTC. */ + dev = &rte_eth_devices[hw->data->port_id]; + clock_gettime(CLOCK_REALTIME, &sys_time); + (void)hns3_timesync_write_time(dev, &sys_time); + return 0; } From patchwork Mon May 29 13:09:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dongdong Liu X-Patchwork-Id: 127677 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 7BCFA42BD3; Mon, 29 May 2023 15:13:30 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0256342D20; Mon, 29 May 2023 15:13:10 +0200 (CEST) Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by mails.dpdk.org (Postfix) with ESMTP id AB94940151; Mon, 29 May 2023 15:13:07 +0200 (CEST) Received: from kwepemi500017.china.huawei.com (unknown [172.30.72.56]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4QVG7l58QSzLq9F; Mon, 29 May 2023 21:09:07 +0800 (CST) Received: from localhost.localdomain (10.28.79.22) by kwepemi500017.china.huawei.com (7.221.188.110) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.23; Mon, 29 May 2023 21:12:05 +0800 From: Dongdong Liu To: , , , , CC: , , , , Subject: [PATCH 02/11] net/hns3: fix unenabled RTC time after reset Date: Mon, 29 May 2023 21:09:31 +0800 Message-ID: <20230529130940.1501-3-liudongdong3@huawei.com> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20230529130940.1501-1-liudongdong3@huawei.com> References: <20230529130940.1501-1-liudongdong3@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.28.79.22] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To kwepemi500017.china.huawei.com (7.221.188.110) X-CFilter-Loop: Reflected X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org From: Huisong Li The enabled status of RTC time will be cleared after global or IMP reset, which cause the local RTC time doesn't work. So this patch fix it. Fixes: 38b539d96eb6 ("net/hns3: support IEEE 1588 PTP") Cc: stable@dpdk.org Signed-off-by: Huisong Li Signed-off-by: Dongdong Liu --- drivers/net/hns3/hns3_ethdev.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c index 07d907d6a1..39bbee1d7b 100644 --- a/drivers/net/hns3/hns3_ethdev.c +++ b/drivers/net/hns3/hns3_ethdev.c @@ -4412,6 +4412,12 @@ hns3_init_hardware(struct hns3_adapter *hns) goto err_mac_init; } + ret = hns3_ptp_init(hw); + if (ret) { + PMD_INIT_LOG(ERR, "Failed to init PTP, ret = %d", ret); + goto err_mac_init; + } + return 0; err_mac_init: @@ -4573,10 +4579,6 @@ hns3_init_pf(struct rte_eth_dev *eth_dev) goto err_intr_callback_register; } - ret = hns3_ptp_init(hw); - if (ret) - goto err_get_config; - /* Enable interrupt */ rte_intr_enable(pci_dev->intr_handle); hns3_pf_enable_irq0(hw); From patchwork Mon May 29 13:09:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dongdong Liu X-Patchwork-Id: 127666 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 6AC0842BD3; Mon, 29 May 2023 15:12:14 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id BD49A42B7E; Mon, 29 May 2023 15:12:13 +0200 (CEST) Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by mails.dpdk.org (Postfix) with ESMTP id 7620D410D7; Mon, 29 May 2023 15:12:08 +0200 (CEST) Received: from kwepemi500017.china.huawei.com (unknown [172.30.72.56]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4QVGC3189GzTkvd; Mon, 29 May 2023 21:11:59 +0800 (CST) Received: from localhost.localdomain (10.28.79.22) by kwepemi500017.china.huawei.com (7.221.188.110) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.23; Mon, 29 May 2023 21:12:06 +0800 From: Dongdong Liu To: , , , , CC: , , , , Subject: [PATCH 03/11] net/hns3: add the uninitialization process of PTP Date: Mon, 29 May 2023 21:09:32 +0800 Message-ID: <20230529130940.1501-4-liudongdong3@huawei.com> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20230529130940.1501-1-liudongdong3@huawei.com> References: <20230529130940.1501-1-liudongdong3@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.28.79.22] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To kwepemi500017.china.huawei.com (7.221.188.110) X-CFilter-Loop: Reflected X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org From: Huisong Li This patch adds the uninitialization process of PTP in case of having an impact on PF driver in kernel. Fixes: 38b539d96eb6 ("net/hns3: support IEEE 1588 PTP") Cc: stable@dpdk.org Signed-off-by: Huisong Li Signed-off-by: Dongdong Liu --- drivers/net/hns3/hns3_ethdev.c | 2 + drivers/net/hns3/hns3_ethdev.h | 1 + drivers/net/hns3/hns3_ptp.c | 68 +++++++++++++++++++++------------- 3 files changed, 46 insertions(+), 25 deletions(-) diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c index 39bbee1d7b..b62058a0a9 100644 --- a/drivers/net/hns3/hns3_ethdev.c +++ b/drivers/net/hns3/hns3_ethdev.c @@ -4633,6 +4633,7 @@ hns3_init_pf(struct rte_eth_dev *eth_dev) hns3_fdir_filter_uninit(hns); err_fdir: hns3_uninit_umv_space(hw); + hns3_ptp_uninit(hw); err_init_hw: hns3_stats_uninit(hw); err_get_config: @@ -4668,6 +4669,7 @@ hns3_uninit_pf(struct rte_eth_dev *eth_dev) hns3_flow_uninit(eth_dev); hns3_fdir_filter_uninit(hns); hns3_uninit_umv_space(hw); + hns3_ptp_uninit(hw); hns3_stats_uninit(hw); hns3_config_mac_tnl_int(hw, false); hns3_pf_disable_irq0(hw); diff --git a/drivers/net/hns3/hns3_ethdev.h b/drivers/net/hns3/hns3_ethdev.h index 88146f5054..a03dc9fa89 100644 --- a/drivers/net/hns3/hns3_ethdev.h +++ b/drivers/net/hns3/hns3_ethdev.h @@ -1043,6 +1043,7 @@ int hns3_restore_ptp(struct hns3_adapter *hns); int hns3_mbuf_dyn_rx_timestamp_register(struct rte_eth_dev *dev, struct rte_eth_conf *conf); int hns3_ptp_init(struct hns3_hw *hw); +void hns3_ptp_uninit(struct hns3_hw *hw); int hns3_timesync_enable(struct rte_eth_dev *dev); int hns3_timesync_disable(struct rte_eth_dev *dev); int hns3_timesync_read_rx_timestamp(struct rte_eth_dev *dev, diff --git a/drivers/net/hns3/hns3_ptp.c b/drivers/net/hns3/hns3_ptp.c index fb834bb180..44cba29854 100644 --- a/drivers/net/hns3/hns3_ptp.c +++ b/drivers/net/hns3/hns3_ptp.c @@ -56,31 +56,6 @@ hns3_ptp_int_en(struct hns3_hw *hw, bool en) return ret; } -int -hns3_ptp_init(struct hns3_hw *hw) -{ - struct timespec sys_time; - struct rte_eth_dev *dev; - int ret; - - if (!hns3_dev_get_support(hw, PTP)) - return 0; - - ret = hns3_ptp_int_en(hw, true); - if (ret) - return ret; - - /* Start PTP timer */ - hns3_write_dev(hw, HNS3_CFG_TIME_CYC_EN, 1); - - /* Initializing the RTC. */ - dev = &rte_eth_devices[hw->data->port_id]; - clock_gettime(CLOCK_REALTIME, &sys_time); - (void)hns3_timesync_write_time(dev, &sys_time); - - return 0; -} - static int hns3_timesync_configure(struct hns3_adapter *hns, bool en) { @@ -301,3 +276,46 @@ hns3_restore_ptp(struct hns3_adapter *hns) return ret; } + +int +hns3_ptp_init(struct hns3_hw *hw) +{ + struct timespec sys_time; + struct rte_eth_dev *dev; + int ret; + + if (!hns3_dev_get_support(hw, PTP)) + return 0; + + ret = hns3_ptp_int_en(hw, true); + if (ret != 0) + return ret; + + /* Start PTP timer */ + hns3_write_dev(hw, HNS3_CFG_TIME_CYC_EN, 1); + + /* Initializing the RTC. */ + dev = &rte_eth_devices[hw->data->port_id]; + clock_gettime(CLOCK_REALTIME, &sys_time); + (void)hns3_timesync_write_time(dev, &sys_time); + + return 0; +} + +void +hns3_ptp_uninit(struct hns3_hw *hw) +{ + struct hns3_adapter *hns = HNS3_DEV_HW_TO_ADAPTER(hw); + int ret; + + if (!hns3_dev_get_support(hw, PTP)) + return; + + ret = hns3_ptp_int_en(hw, false); + if (ret != 0) + hns3_err(hw, "disable PTP interrupt failed, ret = %d.", ret); + + ret = hns3_timesync_configure(hns, false); + if (ret != 0) + hns3_err(hw, "disable timesync failed, ret = %d.", ret); +} From patchwork Mon May 29 13:09:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dongdong Liu X-Patchwork-Id: 127668 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id DCDC242BD3; Mon, 29 May 2023 15:12:30 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 788E142D3D; Mon, 29 May 2023 15:12:16 +0200 (CEST) Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by mails.dpdk.org (Postfix) with ESMTP id 7170C410DD; Mon, 29 May 2023 15:12:10 +0200 (CEST) Received: from kwepemi500017.china.huawei.com (unknown [172.30.72.55]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4QVG5t21pRzqTQt; Mon, 29 May 2023 21:07:30 +0800 (CST) Received: from localhost.localdomain (10.28.79.22) by kwepemi500017.china.huawei.com (7.221.188.110) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.23; Mon, 29 May 2023 21:12:06 +0800 From: Dongdong Liu To: , , , , CC: , , , , Subject: [PATCH 04/11] net/hns3: extract a PTP header file Date: Mon, 29 May 2023 21:09:33 +0800 Message-ID: <20230529130940.1501-5-liudongdong3@huawei.com> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20230529130940.1501-1-liudongdong3@huawei.com> References: <20230529130940.1501-1-liudongdong3@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.28.79.22] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To kwepemi500017.china.huawei.com (7.221.188.110) X-CFilter-Loop: Reflected X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org From: Huisong Li This patch extracts a PTP header file to contain PTP registers and external API in order to make PTP code structure more clear. Fixes: 38b539d96eb6 ("net/hns3: support IEEE 1588 PTP") Cc: stable@dpdk.org Signed-off-by: Huisong Li Signed-off-by: Dongdong Liu --- drivers/net/hns3/hns3_ethdev.c | 1 + drivers/net/hns3/hns3_ethdev.h | 17 ------------ drivers/net/hns3/hns3_ptp.c | 2 +- drivers/net/hns3/hns3_ptp.h | 48 ++++++++++++++++++++++++++++++++++ drivers/net/hns3/hns3_regs.h | 23 ---------------- 5 files changed, 50 insertions(+), 41 deletions(-) create mode 100644 drivers/net/hns3/hns3_ptp.h diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c index b62058a0a9..aa37e7d450 100644 --- a/drivers/net/hns3/hns3_ethdev.c +++ b/drivers/net/hns3/hns3_ethdev.c @@ -15,6 +15,7 @@ #include "hns3_dcb.h" #include "hns3_mp.h" #include "hns3_flow.h" +#include "hns3_ptp.h" #include "hns3_ethdev.h" #define HNS3_SERVICE_INTERVAL 1000000 /* us */ diff --git a/drivers/net/hns3/hns3_ethdev.h b/drivers/net/hns3/hns3_ethdev.h index a03dc9fa89..3a2d687440 100644 --- a/drivers/net/hns3/hns3_ethdev.h +++ b/drivers/net/hns3/hns3_ethdev.h @@ -1039,23 +1039,6 @@ void hns3vf_update_link_status(struct hns3_hw *hw, uint8_t link_status, uint32_t link_speed, uint8_t link_duplex); void hns3vf_update_push_lsc_cap(struct hns3_hw *hw, bool supported); -int hns3_restore_ptp(struct hns3_adapter *hns); -int hns3_mbuf_dyn_rx_timestamp_register(struct rte_eth_dev *dev, - struct rte_eth_conf *conf); -int hns3_ptp_init(struct hns3_hw *hw); -void hns3_ptp_uninit(struct hns3_hw *hw); -int hns3_timesync_enable(struct rte_eth_dev *dev); -int hns3_timesync_disable(struct rte_eth_dev *dev); -int hns3_timesync_read_rx_timestamp(struct rte_eth_dev *dev, - struct timespec *timestamp, - uint32_t flags __rte_unused); -int hns3_timesync_read_tx_timestamp(struct rte_eth_dev *dev, - struct timespec *timestamp); -int hns3_timesync_read_time(struct rte_eth_dev *dev, struct timespec *ts); -int hns3_timesync_write_time(struct rte_eth_dev *dev, - const struct timespec *ts); -int hns3_timesync_adjust_time(struct rte_eth_dev *dev, int64_t delta); - const char *hns3_get_media_type_name(uint8_t media_type); static inline bool diff --git a/drivers/net/hns3/hns3_ptp.c b/drivers/net/hns3/hns3_ptp.c index 44cba29854..5d8cfc1b29 100644 --- a/drivers/net/hns3/hns3_ptp.c +++ b/drivers/net/hns3/hns3_ptp.c @@ -7,7 +7,7 @@ #include #include "hns3_ethdev.h" -#include "hns3_regs.h" +#include "hns3_ptp.h" #include "hns3_logs.h" uint64_t hns3_timestamp_rx_dynflag; diff --git a/drivers/net/hns3/hns3_ptp.h b/drivers/net/hns3/hns3_ptp.h new file mode 100644 index 0000000000..2b8717fa3c --- /dev/null +++ b/drivers/net/hns3/hns3_ptp.h @@ -0,0 +1,48 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2023 HiSilicon Limited. + */ + +#ifndef HNS3_PTP_H +#define HNS3_PTP_H + +/* Register bit for 1588 event */ +#define HNS3_VECTOR0_1588_INT_B 0 + +#define HNS3_PTP_BASE_ADDRESS 0x29000 + +#define HNS3_TX_1588_SEQID_BACK (HNS3_PTP_BASE_ADDRESS + 0x0) +#define HNS3_TX_1588_TSP_BACK_0 (HNS3_PTP_BASE_ADDRESS + 0x4) +#define HNS3_TX_1588_TSP_BACK_1 (HNS3_PTP_BASE_ADDRESS + 0x8) +#define HNS3_TX_1588_TSP_BACK_2 (HNS3_PTP_BASE_ADDRESS + 0xc) + +#define HNS3_TX_1588_BACK_TSP_CNT (HNS3_PTP_BASE_ADDRESS + 0x30) + +#define HNS3_CFG_TIME_SYNC_H (HNS3_PTP_BASE_ADDRESS + 0x50) +#define HNS3_CFG_TIME_SYNC_M (HNS3_PTP_BASE_ADDRESS + 0x54) +#define HNS3_CFG_TIME_SYNC_L (HNS3_PTP_BASE_ADDRESS + 0x58) +#define HNS3_CFG_TIME_SYNC_RDY (HNS3_PTP_BASE_ADDRESS + 0x5c) + +#define HNS3_CFG_TIME_CYC_EN (HNS3_PTP_BASE_ADDRESS + 0x70) + +#define HNS3_CURR_TIME_OUT_H (HNS3_PTP_BASE_ADDRESS + 0x74) +#define HNS3_CURR_TIME_OUT_L (HNS3_PTP_BASE_ADDRESS + 0x78) +#define HNS3_CURR_TIME_OUT_NS (HNS3_PTP_BASE_ADDRESS + 0x7c) + +int hns3_restore_ptp(struct hns3_adapter *hns); +int hns3_mbuf_dyn_rx_timestamp_register(struct rte_eth_dev *dev, + struct rte_eth_conf *conf); +int hns3_ptp_init(struct hns3_hw *hw); +void hns3_ptp_uninit(struct hns3_hw *hw); +int hns3_timesync_enable(struct rte_eth_dev *dev); +int hns3_timesync_disable(struct rte_eth_dev *dev); +int hns3_timesync_read_rx_timestamp(struct rte_eth_dev *dev, + struct timespec *timestamp, + uint32_t flags __rte_unused); +int hns3_timesync_read_tx_timestamp(struct rte_eth_dev *dev, + struct timespec *timestamp); +int hns3_timesync_read_time(struct rte_eth_dev *dev, struct timespec *ts); +int hns3_timesync_write_time(struct rte_eth_dev *dev, + const struct timespec *ts); +int hns3_timesync_adjust_time(struct rte_eth_dev *dev, int64_t delta); + +#endif /* HNS3_PTP_H */ diff --git a/drivers/net/hns3/hns3_regs.h b/drivers/net/hns3/hns3_regs.h index 459bbaf773..6b037f81c1 100644 --- a/drivers/net/hns3/hns3_regs.h +++ b/drivers/net/hns3/hns3_regs.h @@ -124,29 +124,6 @@ #define HNS3_TQP_INTR_RL_DEFAULT 0 #define HNS3_TQP_INTR_QL_DEFAULT 0 -/* Register bit for 1588 event */ -#define HNS3_VECTOR0_1588_INT_B 0 - -#define HNS3_PTP_BASE_ADDRESS 0x29000 - -#define HNS3_TX_1588_SEQID_BACK (HNS3_PTP_BASE_ADDRESS + 0x0) -#define HNS3_TX_1588_TSP_BACK_0 (HNS3_PTP_BASE_ADDRESS + 0x4) -#define HNS3_TX_1588_TSP_BACK_1 (HNS3_PTP_BASE_ADDRESS + 0x8) -#define HNS3_TX_1588_TSP_BACK_2 (HNS3_PTP_BASE_ADDRESS + 0xc) - -#define HNS3_TX_1588_BACK_TSP_CNT (HNS3_PTP_BASE_ADDRESS + 0x30) - -#define HNS3_CFG_TIME_SYNC_H (HNS3_PTP_BASE_ADDRESS + 0x50) -#define HNS3_CFG_TIME_SYNC_M (HNS3_PTP_BASE_ADDRESS + 0x54) -#define HNS3_CFG_TIME_SYNC_L (HNS3_PTP_BASE_ADDRESS + 0x58) -#define HNS3_CFG_TIME_SYNC_RDY (HNS3_PTP_BASE_ADDRESS + 0x5c) - -#define HNS3_CFG_TIME_CYC_EN (HNS3_PTP_BASE_ADDRESS + 0x70) - -#define HNS3_CURR_TIME_OUT_H (HNS3_PTP_BASE_ADDRESS + 0x74) -#define HNS3_CURR_TIME_OUT_L (HNS3_PTP_BASE_ADDRESS + 0x78) -#define HNS3_CURR_TIME_OUT_NS (HNS3_PTP_BASE_ADDRESS + 0x7c) - /* gl_usec convert to hardware count, as writing each 1 represents 2us */ #define HNS3_GL_USEC_TO_REG(gl_usec) ((gl_usec) >> 1) /* rl_usec convert to hardware count, as writing each 1 represents 4us */ From patchwork Mon May 29 13:09:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dongdong Liu X-Patchwork-Id: 127673 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 3739F42BD3; Mon, 29 May 2023 15:13:06 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 6A95942D74; Mon, 29 May 2023 15:12:27 +0200 (CEST) Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by mails.dpdk.org (Postfix) with ESMTP id 0E60442D64; Mon, 29 May 2023 15:12:25 +0200 (CEST) Received: from kwepemi500017.china.huawei.com (unknown [172.30.72.56]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4QVG9V2gPBzLmSx; Mon, 29 May 2023 21:10:38 +0800 (CST) Received: from localhost.localdomain (10.28.79.22) by kwepemi500017.china.huawei.com (7.221.188.110) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.23; Mon, 29 May 2023 21:12:11 +0800 From: Dongdong Liu To: , , , , CC: , , , , Subject: [PATCH 05/11] net/hns3: fix mbuf leak when start rxq in resetting Date: Mon, 29 May 2023 21:09:34 +0800 Message-ID: <20230529130940.1501-6-liudongdong3@huawei.com> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20230529130940.1501-1-liudongdong3@huawei.com> References: <20230529130940.1501-1-liudongdong3@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.28.79.22] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To kwepemi500017.china.huawei.com (7.221.188.110) X-CFilter-Loop: Reflected X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org From: Chengwen Feng In the reset restore-conf phase, the reset process will allocate for the Rx ring mbufs unconditionlly. And the rte_eth_dev_rx_queue_start() will also allocate for the Rx ring mbufs unconditionlly. So if the rte_eth_dev_rx_queue_start() is invoked before restore-conf phase, then the mbufs allocated by rte_eth_dev_rx_queue_start() will leak. Because the hw->reset.resetting was always true during the phases from stop-service to restore-conf, so fix it by returning an error if the hw->reset.resetting is set. This patch adds the above logic in both rx_queue_start/rx_queue_stop/ tx_queue_start/tx_queue_stop ops. Fixes: fa29fe45a7b4 ("net/hns3: support queue start and stop") Cc: stable@dpdk.org Signed-off-by: Chengwen Feng Signed-off-by: Dongdong Liu --- drivers/net/hns3/hns3_rxtx.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/drivers/net/hns3/hns3_rxtx.c b/drivers/net/hns3/hns3_rxtx.c index 6468da903e..2bfc5507e3 100644 --- a/drivers/net/hns3/hns3_rxtx.c +++ b/drivers/net/hns3/hns3_rxtx.c @@ -4523,6 +4523,13 @@ hns3_dev_rx_queue_start(struct rte_eth_dev *dev, uint16_t rx_queue_id) return -ENOTSUP; rte_spinlock_lock(&hw->lock); + + if (__atomic_load_n(&hw->reset.resetting, __ATOMIC_RELAXED)) { + hns3_err(hw, "fail to start Rx queue during resetting."); + rte_spinlock_unlock(&hw->lock); + return -EIO; + } + ret = hns3_reset_queue(hw, rx_queue_id, HNS3_RING_TYPE_RX); if (ret) { hns3_err(hw, "fail to reset Rx queue %u, ret = %d.", @@ -4569,6 +4576,13 @@ hns3_dev_rx_queue_stop(struct rte_eth_dev *dev, uint16_t rx_queue_id) return -ENOTSUP; rte_spinlock_lock(&hw->lock); + + if (__atomic_load_n(&hw->reset.resetting, __ATOMIC_RELAXED)) { + hns3_err(hw, "fail to stop Rx queue during resetting."); + rte_spinlock_unlock(&hw->lock); + return -EIO; + } + hns3_enable_rxq(rxq, false); hns3_rx_queue_release_mbufs(rxq); @@ -4591,6 +4605,13 @@ hns3_dev_tx_queue_start(struct rte_eth_dev *dev, uint16_t tx_queue_id) return -ENOTSUP; rte_spinlock_lock(&hw->lock); + + if (__atomic_load_n(&hw->reset.resetting, __ATOMIC_RELAXED)) { + hns3_err(hw, "fail to start Tx queue during resetting."); + rte_spinlock_unlock(&hw->lock); + return -EIO; + } + ret = hns3_reset_queue(hw, tx_queue_id, HNS3_RING_TYPE_TX); if (ret) { hns3_err(hw, "fail to reset Tx queue %u, ret = %d.", @@ -4617,6 +4638,13 @@ hns3_dev_tx_queue_stop(struct rte_eth_dev *dev, uint16_t tx_queue_id) return -ENOTSUP; rte_spinlock_lock(&hw->lock); + + if (__atomic_load_n(&hw->reset.resetting, __ATOMIC_RELAXED)) { + hns3_err(hw, "fail to stop Tx queue during resetting."); + rte_spinlock_unlock(&hw->lock); + return -EIO; + } + hns3_enable_txq(txq, false); hns3_tx_queue_release_mbufs(txq); /* From patchwork Mon May 29 13:09:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dongdong Liu X-Patchwork-Id: 127674 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 2E34042BD3; Mon, 29 May 2023 15:13:12 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id A35BD42D84; Mon, 29 May 2023 15:12:28 +0200 (CEST) Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by mails.dpdk.org (Postfix) with ESMTP id 7C9DA42D75; Mon, 29 May 2023 15:12:25 +0200 (CEST) Received: from kwepemi500017.china.huawei.com (unknown [172.30.72.54]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4QVGC863N2zTkvB; Mon, 29 May 2023 21:12:04 +0800 (CST) Received: from localhost.localdomain (10.28.79.22) by kwepemi500017.china.huawei.com (7.221.188.110) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.23; Mon, 29 May 2023 21:12:11 +0800 From: Dongdong Liu To: , , , , CC: , , , , Subject: [PATCH 06/11] net/hns3: fix mbuf leak when start rxq after resetting Date: Mon, 29 May 2023 21:09:35 +0800 Message-ID: <20230529130940.1501-7-liudongdong3@huawei.com> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20230529130940.1501-1-liudongdong3@huawei.com> References: <20230529130940.1501-1-liudongdong3@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.28.79.22] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To kwepemi500017.china.huawei.com (7.221.188.110) X-CFilter-Loop: Reflected X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org From: Chengwen Feng In the reset restore-conf phase, the reset process will allocate for the Rx ring mbufs unconditionlly. And the rte_eth_dev_rx_queue_start() will also allocate for the Rx ring mbufs unconditionlly. So if the rte_eth_dev_rx_queue_start() is invoked after restore-conf phase, then the mbufs allocated in restore-conf phase will leak. So fix it by conditional release Rx ring mbufs in rte_eth_dev_rx_queue_start(): if the Rx ring mbufs were allocated then release them first. This patch also set all sw-ring[]'s mbuf is NULL when release Rx ring mbufs so that we can determine whether the Rx ring mbufs were allocated based only on the first sw-ring[0]'s mbuf. Fixes: fa29fe45a7b4 ("net/hns3: support queue start and stop") Cc: stable@dpdk.org Signed-off-by: Chengwen Feng Signed-off-by: Dongdong Liu --- drivers/net/hns3/hns3_rxtx.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/net/hns3/hns3_rxtx.c b/drivers/net/hns3/hns3_rxtx.c index 2bfc5507e3..2493748683 100644 --- a/drivers/net/hns3/hns3_rxtx.c +++ b/drivers/net/hns3/hns3_rxtx.c @@ -50,6 +50,8 @@ hns3_rx_queue_release_mbufs(struct hns3_rx_queue *rxq) rxq->sw_ring[i].mbuf = NULL; } } + for (i = 0; i < rxq->rx_rearm_nb; i++) + rxq->sw_ring[rxq->rx_rearm_start + i].mbuf = NULL; } for (i = 0; i < rxq->bulk_mbuf_num; i++) @@ -4538,6 +4540,9 @@ hns3_dev_rx_queue_start(struct rte_eth_dev *dev, uint16_t rx_queue_id) return ret; } + if (rxq->sw_ring[0].mbuf != NULL) + hns3_rx_queue_release_mbufs(rxq); + ret = hns3_init_rxq(hns, rx_queue_id); if (ret) { hns3_err(hw, "fail to init Rx queue %u, ret = %d.", From patchwork Mon May 29 13:09:36 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dongdong Liu X-Patchwork-Id: 127669 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 13FB342BD3; Mon, 29 May 2023 15:12:39 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id A669442D48; Mon, 29 May 2023 15:12:17 +0200 (CEST) Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by mails.dpdk.org (Postfix) with ESMTP id 707AC427E9; Mon, 29 May 2023 15:12:14 +0200 (CEST) Received: from kwepemi500017.china.huawei.com (unknown [172.30.72.54]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4QVG8l6rpPzsSG3; Mon, 29 May 2023 21:09:59 +0800 (CST) Received: from localhost.localdomain (10.28.79.22) by kwepemi500017.china.huawei.com (7.221.188.110) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.23; Mon, 29 May 2023 21:12:12 +0800 From: Dongdong Liu To: , , , , CC: , , , , Subject: [PATCH 07/11] net/hns3: fix no errcode returned when failed to init queue Date: Mon, 29 May 2023 21:09:36 +0800 Message-ID: <20230529130940.1501-8-liudongdong3@huawei.com> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20230529130940.1501-1-liudongdong3@huawei.com> References: <20230529130940.1501-1-liudongdong3@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.28.79.22] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To kwepemi500017.china.huawei.com (7.221.188.110) X-CFilter-Loop: Reflected X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org From: Chengwen Feng If hns3_init_queues() return failed, the hns3vf_do_start() should return errcode. This patch fixes it. Fixes: 43d8adf3891c ("net/hns3: fix RSS flow rule restore") Cc: stable@dpdk.org Signed-off-by: Chengwen Feng Signed-off-by: Dongdong Liu --- drivers/net/hns3/hns3_ethdev_vf.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/net/hns3/hns3_ethdev_vf.c b/drivers/net/hns3/hns3_ethdev_vf.c index d051a1357b..5aac62a41f 100644 --- a/drivers/net/hns3/hns3_ethdev_vf.c +++ b/drivers/net/hns3/hns3_ethdev_vf.c @@ -1674,8 +1674,10 @@ hns3vf_do_start(struct hns3_adapter *hns, bool reset_queue) hns3_enable_rxd_adv_layout(hw); ret = hns3_init_queues(hns, reset_queue); - if (ret) + if (ret) { hns3_err(hw, "failed to init queues, ret = %d.", ret); + return ret; + } return hns3_restore_filter(hns); } From patchwork Mon May 29 13:09:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dongdong Liu X-Patchwork-Id: 127670 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 9C1D342BD3; Mon, 29 May 2023 15:12:46 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C222242D43; Mon, 29 May 2023 15:12:20 +0200 (CEST) Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by mails.dpdk.org (Postfix) with ESMTP id 9209F410DD; Mon, 29 May 2023 15:12:14 +0200 (CEST) Received: from kwepemi500017.china.huawei.com (unknown [172.30.72.54]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4QVG7t4tQVzLq95; Mon, 29 May 2023 21:09:14 +0800 (CST) Received: from localhost.localdomain (10.28.79.22) by kwepemi500017.china.huawei.com (7.221.188.110) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.23; Mon, 29 May 2023 21:12:12 +0800 From: Dongdong Liu To: , , , , CC: , , , , Subject: [PATCH 08/11] net/hns3: fix uninitialized variable Date: Mon, 29 May 2023 21:09:37 +0800 Message-ID: <20230529130940.1501-9-liudongdong3@huawei.com> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20230529130940.1501-1-liudongdong3@huawei.com> References: <20230529130940.1501-1-liudongdong3@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.28.79.22] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To kwepemi500017.china.huawei.com (7.221.188.110) X-CFilter-Loop: Reflected X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org From: Jie Hai This patch fixes possible use of uninitialized variable "old_tuple_fields". Fixes: e3069658da9f ("net/hns3: reimplement hash flow function") Cc: stable@dpdk.org Signed-off-by: Jie Hai Signed-off-by: Dongdong Liu --- drivers/net/hns3/hns3_flow.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/net/hns3/hns3_flow.c b/drivers/net/hns3/hns3_flow.c index e132d88fa1..a5a7e452d8 100644 --- a/drivers/net/hns3/hns3_flow.c +++ b/drivers/net/hns3/hns3_flow.c @@ -1944,8 +1944,9 @@ hns3_flow_set_rss_ptype_tuple(struct hns3_hw *hw, if (ret != 0) return ret; - hns3_info(hw, "RSS tuple fields changed from 0x%" PRIx64 " to 0x%" PRIx64, - old_tuple_fields, new_tuple_fields); + if (!cfg_global_tuple) + hns3_info(hw, "RSS tuple fields changed from 0x%" PRIx64 " to 0x%" PRIx64, + old_tuple_fields, new_tuple_fields); return 0; } From patchwork Mon May 29 13:09:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dongdong Liu X-Patchwork-Id: 127671 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 7E9A042BD3; Mon, 29 May 2023 15:12:53 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0A08E42D56; Mon, 29 May 2023 15:12:22 +0200 (CEST) Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by mails.dpdk.org (Postfix) with ESMTP id 9BCEC42D40; Mon, 29 May 2023 15:12:17 +0200 (CEST) Received: from kwepemi500017.china.huawei.com (unknown [172.30.72.57]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4QVG7v0pwyzLqBy; Mon, 29 May 2023 21:09:15 +0800 (CST) Received: from localhost.localdomain (10.28.79.22) by kwepemi500017.china.huawei.com (7.221.188.110) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.23; Mon, 29 May 2023 21:12:13 +0800 From: Dongdong Liu To: , , , , CC: , , , , Subject: [PATCH 09/11] net/hns3: make code more clean Date: Mon, 29 May 2023 21:09:38 +0800 Message-ID: <20230529130940.1501-10-liudongdong3@huawei.com> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20230529130940.1501-1-liudongdong3@huawei.com> References: <20230529130940.1501-1-liudongdong3@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.28.79.22] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To kwepemi500017.china.huawei.com (7.221.188.110) X-CFilter-Loop: Reflected X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org From: Dengdui Huang This patch modify the code that violates the coding standards. Signed-off-by: Dengdui Huang Signed-off-by: Dongdong Liu --- drivers/net/hns3/hns3_regs.c | 3 +-- drivers/net/hns3/hns3_rxtx.c | 10 +++------- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/drivers/net/hns3/hns3_regs.c b/drivers/net/hns3/hns3_regs.c index 5d6f92e4bb..be1be6a89c 100644 --- a/drivers/net/hns3/hns3_regs.c +++ b/drivers/net/hns3/hns3_regs.c @@ -385,10 +385,9 @@ hns3_dfx_reg_cmd_send(struct hns3_hw *hw, struct hns3_cmd_desc *desc, hns3_cmd_setup_basic_desc(&desc[i], opcode, true); ret = hns3_cmd_send(hw, desc, bd_num); - if (ret) { + if (ret) hns3_err(hw, "fail to query dfx registers, opcode = 0x%04X, " "ret = %d.\n", opcode, ret); - } return ret; } diff --git a/drivers/net/hns3/hns3_rxtx.c b/drivers/net/hns3/hns3_rxtx.c index 2493748683..cf04dc857e 100644 --- a/drivers/net/hns3/hns3_rxtx.c +++ b/drivers/net/hns3/hns3_rxtx.c @@ -751,7 +751,7 @@ hns3pf_reset_all_tqps(struct hns3_hw *hw) for (i = 0; i < hw->cfg_max_queues; i++) { ret = hns3pf_reset_tqp(hw, i); if (ret) { - hns3_err(hw, "fail to reset tqp, queue_id = %d, ret = %d.", + hns3_err(hw, "fail to reset tqp, queue_id = %u, ret = %d.", i, ret); return ret; } @@ -829,15 +829,13 @@ hns3_send_reset_queue_cmd(struct hns3_hw *hw, uint16_t queue_id, { struct hns3_reset_tqp_queue_cmd *req; struct hns3_cmd_desc desc; - int queue_direction; int ret; hns3_cmd_setup_basic_desc(&desc, HNS3_OPC_RESET_TQP_QUEUE_INDEP, false); req = (struct hns3_reset_tqp_queue_cmd *)desc.data; req->tqp_id = rte_cpu_to_le_16(queue_id); - queue_direction = queue_type == HNS3_RING_TYPE_TX ? 0 : 1; - req->queue_direction = rte_cpu_to_le_16(queue_direction); + req->queue_direction = queue_type == HNS3_RING_TYPE_TX ? 0 : 1; hns3_set_bit(req->reset_req, HNS3_TQP_RESET_B, enable ? 1 : 0); ret = hns3_cmd_send(hw, &desc, 1); @@ -855,15 +853,13 @@ hns3_get_queue_reset_status(struct hns3_hw *hw, uint16_t queue_id, { struct hns3_reset_tqp_queue_cmd *req; struct hns3_cmd_desc desc; - int queue_direction; int ret; hns3_cmd_setup_basic_desc(&desc, HNS3_OPC_RESET_TQP_QUEUE_INDEP, true); req = (struct hns3_reset_tqp_queue_cmd *)desc.data; req->tqp_id = rte_cpu_to_le_16(queue_id); - queue_direction = queue_type == HNS3_RING_TYPE_TX ? 0 : 1; - req->queue_direction = rte_cpu_to_le_16(queue_direction); + req->queue_direction = queue_type == HNS3_RING_TYPE_TX ? 0 : 1; ret = hns3_cmd_send(hw, &desc, 1); if (ret) { From patchwork Mon May 29 13:09:39 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dongdong Liu X-Patchwork-Id: 127676 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id A605242BD3; Mon, 29 May 2023 15:13:24 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 81BD842D69; Mon, 29 May 2023 15:12:32 +0200 (CEST) Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by mails.dpdk.org (Postfix) with ESMTP id BF0A442D8E; Mon, 29 May 2023 15:12:30 +0200 (CEST) Received: from kwepemi500017.china.huawei.com (unknown [172.30.72.53]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4QVGCH03MJzTkvd; Mon, 29 May 2023 21:12:10 +0800 (CST) Received: from localhost.localdomain (10.28.79.22) by kwepemi500017.china.huawei.com (7.221.188.110) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.23; Mon, 29 May 2023 21:12:18 +0800 From: Dongdong Liu To: , , , , CC: , , , , Subject: [PATCH 10/11] net/hns3: fix inaccurate log Date: Mon, 29 May 2023 21:09:39 +0800 Message-ID: <20230529130940.1501-11-liudongdong3@huawei.com> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20230529130940.1501-1-liudongdong3@huawei.com> References: <20230529130940.1501-1-liudongdong3@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.28.79.22] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To kwepemi500017.china.huawei.com (7.221.188.110) X-CFilter-Loop: Reflected X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org From: Dengdui Huang This patch fix inaccurate log Fixes: bba636698316 ("net/hns3: support Rx/Tx and related operations") Fixes: a951c1ed3ab5 ("net/hns3: support different numbers of Rx and Tx queues") Cc: stable@dpdk.org Signed-off-by: Dengdui Huang Signed-off-by: Dongdong Liu --- drivers/net/hns3/hns3_rxtx.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/hns3/hns3_rxtx.c b/drivers/net/hns3/hns3_rxtx.c index cf04dc857e..f3c3b38c55 100644 --- a/drivers/net/hns3/hns3_rxtx.c +++ b/drivers/net/hns3/hns3_rxtx.c @@ -586,7 +586,7 @@ hns3_tqp_enable(struct hns3_hw *hw, uint16_t queue_id, bool enable) ret = hns3_cmd_send(hw, &desc, 1); if (ret) - hns3_err(hw, "TQP enable fail, ret = %d", ret); + hns3_err(hw, "TQP %s fail, ret = %d", enable ? "enable" : "disable", ret); return ret; } @@ -1635,7 +1635,7 @@ hns3_set_fake_rx_or_tx_queues(struct rte_eth_dev *dev, uint16_t nb_rx_q, ret = hns3_fake_tx_queue_config(hw, tx_need_add_nb_q); if (ret) { - hns3_err(hw, "Fail to configure fake rx queues: %d", ret); + hns3_err(hw, "Fail to configure fake tx queues: %d", ret); goto cfg_fake_tx_q_fail; } From patchwork Mon May 29 13:09:40 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dongdong Liu X-Patchwork-Id: 127672 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 84F2C42BD3; Mon, 29 May 2023 15:13:00 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 2973F42D62; Mon, 29 May 2023 15:12:24 +0200 (CEST) Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by mails.dpdk.org (Postfix) with ESMTP id 7ED8042D36; Mon, 29 May 2023 15:12:21 +0200 (CEST) Received: from kwepemi500017.china.huawei.com (unknown [172.30.72.54]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4QVGCH2c0kzTkvp; Mon, 29 May 2023 21:12:11 +0800 (CST) Received: from localhost.localdomain (10.28.79.22) by kwepemi500017.china.huawei.com (7.221.188.110) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.23; Mon, 29 May 2023 21:12:18 +0800 From: Dongdong Liu To: , , , , CC: , , , , Subject: [PATCH 11/11] net/hns3: remove log redundant line break Date: Mon, 29 May 2023 21:09:40 +0800 Message-ID: <20230529130940.1501-12-liudongdong3@huawei.com> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20230529130940.1501-1-liudongdong3@huawei.com> References: <20230529130940.1501-1-liudongdong3@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.28.79.22] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To kwepemi500017.china.huawei.com (7.221.188.110) X-CFilter-Loop: Reflected X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org From: Dengdui Huang This patch remove log redundant line break Fixes: d51867db65c1 ("net/hns3: add initialization") Fixes: c6332c3cf9f0 ("net/hns3: support module EEPROM dump") Cc: stable@dpdk.org Signed-off-by: Dengdui Huang Signed-off-by: Dongdong Liu --- drivers/net/hns3/hns3_ethdev.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c index aa37e7d450..3155542c31 100644 --- a/drivers/net/hns3/hns3_ethdev.c +++ b/drivers/net/hns3/hns3_ethdev.c @@ -3629,7 +3629,7 @@ hns3_get_mac_ethertype_cmd_status(uint16_t cmdq_resp, uint8_t resp_code) if (cmdq_resp) { PMD_INIT_LOG(ERR, - "cmdq execute failed for get_mac_ethertype_cmd_status, status=%u.\n", + "cmdq execute failed for get_mac_ethertype_cmd_status, status=%u.", cmdq_resp); return -EIO; } @@ -6245,7 +6245,7 @@ hns3_optical_module_existed(struct hns3_hw *hw) ret = hns3_cmd_send(hw, &desc, 1); if (ret) { hns3_err(hw, - "fail to get optical module exist state, ret = %d.\n", + "fail to get optical module exist state, ret = %d.", ret); return false; } @@ -6283,7 +6283,7 @@ hns3_get_module_eeprom_data(struct hns3_hw *hw, uint32_t offset, ret = hns3_cmd_send(hw, desc, HNS3_SFP_INFO_CMD_NUM); if (ret) { - hns3_err(hw, "fail to get module EEPROM info, ret = %d.\n", + hns3_err(hw, "fail to get module EEPROM info, ret = %d.", ret); return ret; } @@ -6320,7 +6320,7 @@ hns3_get_module_eeprom(struct rte_eth_dev *dev, return -ENOTSUP; if (!hns3_optical_module_existed(hw)) { - hns3_err(hw, "fail to read module EEPROM: no module is connected.\n"); + hns3_err(hw, "fail to read module EEPROM: no module is connected."); return -EIO; } @@ -6383,7 +6383,7 @@ hns3_get_module_info(struct rte_eth_dev *dev, modinfo->eeprom_len = RTE_ETH_MODULE_SFF_8636_MAX_LEN; break; default: - hns3_err(hw, "unknown module, type = %u, extra_type = %u.\n", + hns3_err(hw, "unknown module, type = %u, extra_type = %u.", sfp_type.type, sfp_type.ext_type); return -EINVAL; }