From patchwork Tue Jul 14 06:16:06 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Wei Hu (Xavier)" X-Patchwork-Id: 73992 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 3B48BA0540; Tue, 14 Jul 2020 08:18:36 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 34AF51D5AA; Tue, 14 Jul 2020 08:18:17 +0200 (CEST) Received: from huawei.com (szxga07-in.huawei.com [45.249.212.35]) by dpdk.org (Postfix) with ESMTP id 48BBF1D569 for ; Tue, 14 Jul 2020 08:18:10 +0200 (CEST) Received: from DGGEMS405-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id 6CF1E5C1869E93A3C59A for ; Tue, 14 Jul 2020 14:18:07 +0800 (CST) Received: from localhost.localdomain (10.69.192.56) by DGGEMS405-HUB.china.huawei.com (10.3.19.205) with Microsoft SMTP Server id 14.3.487.0; Tue, 14 Jul 2020 14:17:56 +0800 From: "Wei Hu (Xavier)" To: CC: Date: Tue, 14 Jul 2020 14:16:06 +0800 Message-ID: <1594707369-36270-2-git-send-email-xavier.huwei@huawei.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1594707369-36270-1-git-send-email-xavier.huwei@huawei.com> References: <1594462703-21448-2-git-send-email-xavier.huwei@huawei.com> <1594707369-36270-1-git-send-email-xavier.huwei@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.69.192.56] X-CFilter-Loop: Reflected Subject: [dpdk-dev] [PATCH v3 1/4] net/hns3: support copper media type X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" The hns3 network engine is built-in multiple SoCs, such as kunpeng 920, kunpeng 930, etc. The PCI revision id is 0x21 in kunpeng 920, and the PCI revision id is 0x30 in kunpeng 930. Copper media type is supported for hns3 PF device in kunpeng 930 and later SoCs. The configuration operation for PHY is implemented by firmware. Signed-off-by: Wei Hu (Xavier) --- drivers/net/hns3/hns3_ethdev.c | 6 +++++- drivers/net/hns3/hns3_ethdev.h | 7 +++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c index 9575a05..f218fb8 100644 --- a/drivers/net/hns3/hns3_ethdev.c +++ b/drivers/net/hns3/hns3_ethdev.c @@ -2823,6 +2823,9 @@ hns3_get_capability(struct hns3_hw *hw) } hw->revision = revision; + if (revision >= PCI_REVISION_ID_HIP09_A) + hns3_set_bit(hw->capability, HNS3_DEV_SUPPORT_COPPER_B, 1); + return 0; } @@ -2840,7 +2843,8 @@ hns3_get_board_configuration(struct hns3_hw *hw) return ret; } - if (cfg.media_type == HNS3_MEDIA_TYPE_COPPER) { + if (cfg.media_type == HNS3_MEDIA_TYPE_COPPER && + !hns3_dev_copper_supported(hw)) { PMD_INIT_LOG(ERR, "media type is copper, not supported."); return -EOPNOTSUPP; } diff --git a/drivers/net/hns3/hns3_ethdev.h b/drivers/net/hns3/hns3_ethdev.h index 3c991f4..31d34b0 100644 --- a/drivers/net/hns3/hns3_ethdev.h +++ b/drivers/net/hns3/hns3_ethdev.h @@ -30,6 +30,9 @@ #define HNS3_PCI_REVISION_ID 0x08 #define HNS3_PCI_REVISION_ID_LEN 1 +#define PCI_REVISION_ID_HIP08_B 0x21 +#define PCI_REVISION_ID_HIP09_A 0x30 + #define HNS3_PF_FUNC_ID 0 #define HNS3_1ST_VF_FUNC_ID 1 @@ -530,10 +533,14 @@ struct hns3_adapter { }; #define HNS3_DEV_SUPPORT_DCB_B 0x0 +#define HNS3_DEV_SUPPORT_COPPER_B 0x1 #define hns3_dev_dcb_supported(hw) \ hns3_get_bit((hw)->capability, HNS3_DEV_SUPPORT_DCB_B) +#define hns3_dev_copper_supported(hw) \ + hns3_get_bit((hw)->capability, HNS3_DEV_SUPPORT_COPPER_B) + #define HNS3_DEV_PRIVATE_TO_HW(adapter) \ (&((struct hns3_adapter *)adapter)->hw) #define HNS3_DEV_PRIVATE_TO_ADAPTER(adapter) \