From patchwork Mon Jun 7 17:59:21 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nithin Dabilpuram X-Patchwork-Id: 93996 X-Patchwork-Delegate: jerinj@marvell.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 6B15FA034F; Mon, 7 Jun 2021 20:08:10 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 2AC32411CC; Mon, 7 Jun 2021 20:05:11 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by mails.dpdk.org (Postfix) with ESMTP id C4E6A411A1 for ; Mon, 7 Jun 2021 20:05:09 +0200 (CEST) Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 157I1ar7017502 for ; Mon, 7 Jun 2021 11:05:09 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type; s=pfpt0220; bh=nkU0N4Qyyd0koiym+Aww5jQ5ZohxuYn7kP20XoSpsts=; b=BDL1EUNAkGfEvF/cfwl3JoF0RxXsk0Ng2kFazvBLDoN7/GsiXefRLMxKWm7Hi/FrXQr0 OhXWiC55LJco7PCvteueXHNAXnJHHAlzBBEb8fx7gVu+JlDjT74g6UCaxzBPiUqaQKpz LH/PBwaIaqmyIb7hABkzQKFWxJaBtQm+89PK0gcIuB+RrldgaiweE4ZR7avWnvT3YdTI Ms9Jm2vlWsa4bw2FHGIrBOSgB3EtfJQ9LH8h28G6Pu1MYiJlFzppx6Infwz4ZDim5rDV AtOXOWTNxvyYKi3rgIOFHEKwEs5FDY3e4I9UcUv3ODiOITKIsmgvaez2HEp9qgIn0C4G YA== Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0b-0016f401.pphosted.com with ESMTP id 391ecv2ekk-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Mon, 07 Jun 2021 11:05:09 -0700 Received: from DC5-EXCH02.marvell.com (10.69.176.39) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Mon, 7 Jun 2021 11:05:07 -0700 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Mon, 7 Jun 2021 11:05:07 -0700 Received: from hyd1588t430.marvell.com (unknown [10.29.52.204]) by maili.marvell.com (Postfix) with ESMTP id 93F253F7044; Mon, 7 Jun 2021 11:05:04 -0700 (PDT) From: Nithin Dabilpuram To: CC: , , , , , , Date: Mon, 7 Jun 2021 23:29:21 +0530 Message-ID: <20210607175943.31690-41-ndabilpuram@marvell.com> X-Mailer: git-send-email 2.8.4 In-Reply-To: <20210607175943.31690-1-ndabilpuram@marvell.com> References: <20210306153404.10781-1-ndabilpuram@marvell.com> <20210607175943.31690-1-ndabilpuram@marvell.com> MIME-Version: 1.0 X-Proofpoint-GUID: l7mUy07CPZnwpkxrM6a0EiijV4AQtY9P X-Proofpoint-ORIG-GUID: l7mUy07CPZnwpkxrM6a0EiijV4AQtY9P X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.391, 18.0.761 definitions=2021-06-07_14:2021-06-04, 2021-06-07 signatures=0 Subject: [dpdk-dev] [PATCH v2 40/62] net/cnxk: add EEPROM module info get operations 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 Sender: "dev" From: Sunil Kumar Kori Patch implements eeprom module info get ethops for cn9k and cn10k platforms. Signed-off-by: Sunil Kumar Kori --- doc/guides/nics/features/cnxk.ini | 1 + doc/guides/nics/features/cnxk_vec.ini | 1 + doc/guides/nics/features/cnxk_vf.ini | 1 + drivers/net/cnxk/cnxk_ethdev.c | 2 ++ drivers/net/cnxk/cnxk_ethdev.h | 4 ++++ drivers/net/cnxk/cnxk_ethdev_ops.c | 39 +++++++++++++++++++++++++++++++++++ 6 files changed, 48 insertions(+) diff --git a/doc/guides/nics/features/cnxk.ini b/doc/guides/nics/features/cnxk.ini index afd0f01..b1e8641 100644 --- a/doc/guides/nics/features/cnxk.ini +++ b/doc/guides/nics/features/cnxk.ini @@ -31,6 +31,7 @@ L4 checksum offload = Y Inner L3 checksum = Y Inner L4 checksum = Y Packet type parsing = Y +Module EEPROM dump = Y Linux = Y ARMv8 = Y Usage doc = Y diff --git a/doc/guides/nics/features/cnxk_vec.ini b/doc/guides/nics/features/cnxk_vec.ini index 4bd11ce..0f99634 100644 --- a/doc/guides/nics/features/cnxk_vec.ini +++ b/doc/guides/nics/features/cnxk_vec.ini @@ -29,6 +29,7 @@ L4 checksum offload = Y Inner L3 checksum = Y Inner L4 checksum = Y Packet type parsing = Y +Module EEPROM dump = Y Linux = Y ARMv8 = Y Usage doc = Y diff --git a/doc/guides/nics/features/cnxk_vf.ini b/doc/guides/nics/features/cnxk_vf.ini index 335d082..cecced9 100644 --- a/doc/guides/nics/features/cnxk_vf.ini +++ b/doc/guides/nics/features/cnxk_vf.ini @@ -26,6 +26,7 @@ L4 checksum offload = Y Inner L3 checksum = Y Inner L4 checksum = Y Packet type parsing = Y +Module EEPROM dump = Y Linux = Y ARMv8 = Y Usage doc = Y diff --git a/drivers/net/cnxk/cnxk_ethdev.c b/drivers/net/cnxk/cnxk_ethdev.c index 3be641a..cf53bee 100644 --- a/drivers/net/cnxk/cnxk_ethdev.c +++ b/drivers/net/cnxk/cnxk_ethdev.c @@ -1162,6 +1162,8 @@ struct eth_dev_ops cnxk_eth_dev_ops = { .flow_ctrl_set = cnxk_nix_flow_ctrl_set, .dev_set_link_up = cnxk_nix_set_link_up, .dev_set_link_down = cnxk_nix_set_link_down, + .get_module_info = cnxk_nix_get_module_info, + .get_module_eeprom = cnxk_nix_get_module_eeprom, }; static int diff --git a/drivers/net/cnxk/cnxk_ethdev.h b/drivers/net/cnxk/cnxk_ethdev.h index 6500433..c4a562b 100644 --- a/drivers/net/cnxk/cnxk_ethdev.h +++ b/drivers/net/cnxk/cnxk_ethdev.h @@ -238,6 +238,10 @@ int cnxk_nix_flow_ctrl_get(struct rte_eth_dev *eth_dev, struct rte_eth_fc_conf *fc_conf); int cnxk_nix_set_link_up(struct rte_eth_dev *eth_dev); int cnxk_nix_set_link_down(struct rte_eth_dev *eth_dev); +int cnxk_nix_get_module_info(struct rte_eth_dev *eth_dev, + struct rte_eth_dev_module_info *modinfo); +int cnxk_nix_get_module_eeprom(struct rte_eth_dev *eth_dev, + struct rte_dev_eeprom_info *info); int cnxk_nix_configure(struct rte_eth_dev *eth_dev); int cnxk_nix_tx_queue_setup(struct rte_eth_dev *eth_dev, uint16_t qid, diff --git a/drivers/net/cnxk/cnxk_ethdev_ops.c b/drivers/net/cnxk/cnxk_ethdev_ops.c index 37ba211..a1a963a 100644 --- a/drivers/net/cnxk/cnxk_ethdev_ops.c +++ b/drivers/net/cnxk/cnxk_ethdev_ops.c @@ -553,3 +553,42 @@ cnxk_nix_set_link_down(struct rte_eth_dev *eth_dev) exit: return rc; } + +int +cnxk_nix_get_module_info(struct rte_eth_dev *eth_dev, + struct rte_eth_dev_module_info *modinfo) +{ + struct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev); + struct roc_nix_eeprom_info eeprom_info = {0}; + struct roc_nix *nix = &dev->nix; + int rc; + + rc = roc_nix_eeprom_info_get(nix, &eeprom_info); + if (rc) + return rc; + + modinfo->type = eeprom_info.sff_id; + modinfo->eeprom_len = ROC_NIX_EEPROM_SIZE; + return 0; +} + +int +cnxk_nix_get_module_eeprom(struct rte_eth_dev *eth_dev, + struct rte_dev_eeprom_info *info) +{ + struct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev); + struct roc_nix_eeprom_info eeprom_info = {0}; + struct roc_nix *nix = &dev->nix; + int rc = -EINVAL; + + if (!info->data || !info->length || + (info->offset + info->length > ROC_NIX_EEPROM_SIZE)) + return rc; + + rc = roc_nix_eeprom_info_get(nix, &eeprom_info); + if (rc) + return rc; + + rte_memcpy(info->data, eeprom_info.buf + info->offset, info->length); + return 0; +}