From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 2D5DAA0597; Thu, 9 Apr 2020 11:42:26 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 7B5FC1C20D; Thu, 9 Apr 2020 11:42:25 +0200 (CEST) Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2056.outbound.protection.outlook.com [40.107.243.56]) by dpdk.org (Postfix) with ESMTP id BC66D1C1EF for ; Thu, 9 Apr 2020 11:42:23 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=AJhf7PeQseJcD+N42m1Jh5hNzgDlw5jvyp/x0Ydj0VlsqBA/WyUSp9EQDjy3/2+s7wkSefQVUWU23bH8Zq6D23uxfhgdIUZwnJCMjZvT1oJnnzaGK8s6jKWjWC26XzgLKYcu+pa42gcp6+o50f/BuHJ109/vRmy4w/nNiG8qPZpl3SX1s33OXbuZ/rX96R/FPWkOjFiGZcW0AQWojiZ3hr6KhoNok5NWy25+0dNg6uWATvR246/tNWmKjqKFe+4DXdx94y0eDYj6e186cFYkndO/EucGgvlsY5dbVGobbE6ETwz+STMvoBdmk5OUVRpuHo1mZsFpY7QJJQIfk9pcqQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=KQEjkX5J8nJfVO7kwVT4OwksVcT1paGkORGBAPQnw30=; b=AS6k2HmCiuJNNYVhmFfL1YBQ54odSaPgNzQQARGU9nyHIFt71GISNmxkm89YOyd/7EA50gpPXKk1jo4K1pl09LYkIoECVAt3LWtw6yLCHku9DXVpvXWO3YZUyYWQzObAVn83/uLiIyvGXZNDBgJVDhLHuCNvbGwTRi6+eAFZJ5w0wzTzkZRzpFta+Yg2rjwcPnvWAfwXUcXj3v7jZxt6fy2lIOV1LxmIFgMGAy7MoJzesrytzRPivA0CIn7kK+sLOmwvZ1ANbVv74oI0cWnk4W1p4S9deHKipmUWkYCMFmLLJMvsL8cckHp/x5EMGJC/+TmJ/3L10fCoNneKU4SRYg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amdcloud.onmicrosoft.com; s=selector2-amdcloud-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=KQEjkX5J8nJfVO7kwVT4OwksVcT1paGkORGBAPQnw30=; b=2R1I6JfN9Vl4uvBGyYIJ24wM1FojGeNzE48iLT5ej9/bOmH+8vdJMcwwm+YuTpqwOpCYSwOiZIyLYKvQfJbbsJYn5h/Z77H9ZY2fWoLYAVJRYUuxKRZggTpOI6yI6LOcLlDYfzJHXXdUG3r0iL38sL6INTC6FxT/djjN/Vvtm+o= Received: from DM6PR12MB2987.namprd12.prod.outlook.com (2603:10b6:5:3b::25) by DM6PR12MB4057.namprd12.prod.outlook.com (2603:10b6:5:213::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2878.20; Thu, 9 Apr 2020 09:42:21 +0000 Received: from DM6PR12MB2987.namprd12.prod.outlook.com ([fe80::1500:497a:6cb9:53bd]) by DM6PR12MB2987.namprd12.prod.outlook.com ([fe80::1500:497a:6cb9:53bd%2]) with mapi id 15.20.2878.018; Thu, 9 Apr 2020 09:42:21 +0000 From: "Kumar, Ravi1" To: "Somalapuram, Amaranath" , "dev@dpdk.org" Thread-Topic: [PATCH v1] net/axgbe: support sfp module EEPROM Thread-Index: AQHWDXSBLa0JEnqZ7EKjLJ5wejW+8Khwi8UA Date: Thu, 9 Apr 2020 09:42:21 +0000 Message-ID: References: <20200408070803.32051-1-asomalap@amd.com> In-Reply-To: <20200408070803.32051-1-asomalap@amd.com> Accept-Language: en-IN, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: msip_labels: MSIP_Label_0d814d60-469d-470c-8cb0-58434e2bf457_Enabled=true; MSIP_Label_0d814d60-469d-470c-8cb0-58434e2bf457_SetDate=2020-04-09T09:44:18Z; MSIP_Label_0d814d60-469d-470c-8cb0-58434e2bf457_Method=Privileged; MSIP_Label_0d814d60-469d-470c-8cb0-58434e2bf457_Name=Public_0; MSIP_Label_0d814d60-469d-470c-8cb0-58434e2bf457_SiteId=3dd8961f-e488-4e60-8e11-a82d994e183d; MSIP_Label_0d814d60-469d-470c-8cb0-58434e2bf457_ActionId=336e2a10-0265-46b5-8590-0000ad16af69; MSIP_Label_0d814d60-469d-470c-8cb0-58434e2bf457_ContentBits=1 msip_label_0d814d60-469d-470c-8cb0-58434e2bf457_enabled: true msip_label_0d814d60-469d-470c-8cb0-58434e2bf457_setdate: 2020-04-09T09:44:26Z msip_label_0d814d60-469d-470c-8cb0-58434e2bf457_method: Privileged msip_label_0d814d60-469d-470c-8cb0-58434e2bf457_name: Public_0 msip_label_0d814d60-469d-470c-8cb0-58434e2bf457_siteid: 3dd8961f-e488-4e60-8e11-a82d994e183d msip_label_0d814d60-469d-470c-8cb0-58434e2bf457_actionid: 90f31af1-4782-42d4-9be7-0000abd455fb msip_label_0d814d60-469d-470c-8cb0-58434e2bf457_contentbits: 0 authentication-results: spf=none (sender IP is ) smtp.mailfrom=Ravi1.Kumar@amd.com; x-originating-ip: [103.117.202.208] x-ms-publictraffictype: Email x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: 325d7379-6e54-418a-b2b9-08d7dc6a4d41 x-ms-traffictypediagnostic: DM6PR12MB4057:|DM6PR12MB4057: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:6108; x-forefront-prvs: 0368E78B5B x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM6PR12MB2987.namprd12.prod.outlook.com; PTR:; CAT:NONE; SFTY:; SFS:(10009020)(4636009)(136003)(366004)(346002)(376002)(39860400002)(396003)(316002)(55016002)(110136005)(6506007)(81156014)(8676002)(7696005)(71200400001)(86362001)(8936002)(66946007)(478600001)(186003)(76116006)(66476007)(64756008)(26005)(81166007)(66556008)(33656002)(9686003)(52536014)(2906002)(5660300002)(66446008); DIR:OUT; SFP:1101; received-spf: None (protection.outlook.com: amd.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: jtniC+M1NfUkDjF072MFCxWZYxF/zM6eqs504PnawHudJniOt+R8ZQCVd7PSO9RafnWIdvXcxtRk0aTynadGOUVZhpena1EQ+wibGN5/TPJmYj/5/1uY9yI4c60iUe0BsJFmiORgYVScKgZCwQ/cFMMFyzAJJZ7/Nwclh28fXd7kXi+BUHrun6X8OHSMiE0/g8fbw5ihQ157TqHBEtYELEdUNATm6z8EGjIkhiODJT6ET7QFTzD+FvF07SmbV5f21lc3FC4IWrdyfuyD1KBb0/e5VtiQlNd/fhtwK9xlEQLzaOXMY5vjRyvABvJr/13k3xkikcISh0qqxrAFAX8HGpeUQ8jcCnUEHxHB4PoMyV1YAb062iY7Qts2xQJAvLVnoop0eN2cmsfMdWYsQQNMOgdGfHg04wYyPs/K+vpLQ3AWDWBVkrPwGx2/ei0/xHV4 x-ms-exchange-antispam-messagedata: ETtAH6LClDM2j63SvL1BQOSZjny5VXuTSGxObGxh4Ivb3MUpI3Q+yJtEpGKb7001Zy9yfBLP2AYx7MaLeT1KwDIcgYQe94mW8pw4wqZdUHVKkGV9JyYePpNEyMq2++ZVIwsS7ItosjJCVzFgx4h0QQ== Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 325d7379-6e54-418a-b2b9-08d7dc6a4d41 X-MS-Exchange-CrossTenant-originalarrivaltime: 09 Apr 2020 09:42:21.4731 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: xkldHOZAxdrFC7yR0DUVvSMDwy0bQ1CX/FA0OZQLu0INS6iogLwOveIVln7G/WR0wvnDno/58qkQgr278TXLfg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB4057 Subject: Re: [dpdk-dev] [PATCH v1] net/axgbe: support sfp module EEPROM 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" [AMD Public Use] Acked-by: Ravi Kumar > > >-----Original Message----- >From: Somalapuram, Amaranath =20 >Sent: Wednesday, April 8, 2020 12:38 PM >To: dev@dpdk.org >Cc: Kumar, Ravi1 >Subject: [PATCH v1] net/axgbe: support sfp module EEPROM > >From: Amaranath Somalapuram > >Adding API for get_module_eeprom and get_module_info. > >Signed-off-by: Amaranath Somalapuram >--- > drivers/net/axgbe/axgbe_ethdev.c | 2 + > drivers/net/axgbe/axgbe_phy.h | 4 ++ > drivers/net/axgbe/axgbe_phy_impl.c | 107 +++++++++++++++++++++++++++++ > 3 files changed, 113 insertions(+) > >diff --git a/drivers/net/axgbe/axgbe_ethdev.c b/drivers/net/axgbe/axgbe_et= hdev.c >index 867058845..ea2f9bba1 100644 >--- a/drivers/net/axgbe/axgbe_ethdev.c >+++ b/drivers/net/axgbe/axgbe_ethdev.c >@@ -214,6 +214,8 @@ static const struct eth_dev_ops axgbe_eth_dev_ops =3D = { > .dev_supported_ptypes_get =3D axgbe_dev_supported_ptypes_get, > .rx_descriptor_status =3D axgbe_dev_rx_descriptor_status, > .tx_descriptor_status =3D axgbe_dev_tx_descriptor_status, >+ .get_module_info =3D axgbe_get_module_info, >+ .get_module_eeprom =3D axgbe_get_module_eeprom, > }; >=20 > static int axgbe_phy_reset(struct axgbe_port *pdata) diff --git a/drivers= /net/axgbe/axgbe_phy.h b/drivers/net/axgbe/axgbe_phy.h index 77ee20a31..d9d= 7fde41 100644 >--- a/drivers/net/axgbe/axgbe_phy.h >+++ b/drivers/net/axgbe/axgbe_phy.h >@@ -188,5 +188,9 @@ > #define DUPLEX_FULL 0x01 > #define DUPLEX_UNKNOWN 0xff >=20 >+int axgbe_get_module_info(struct rte_eth_dev *dev, >+ struct rte_eth_dev_module_info *modinfo); int=20 >+axgbe_get_module_eeprom(struct rte_eth_dev *dev, >+ struct rte_dev_eeprom_info *info); > #endif > /* PHY */ >diff --git a/drivers/net/axgbe/axgbe_phy_impl.c b/drivers/net/axgbe/axgbe_= phy_impl.c >index 02236ec19..53716071f 100644 >--- a/drivers/net/axgbe/axgbe_phy_impl.c >+++ b/drivers/net/axgbe/axgbe_phy_impl.c >@@ -141,12 +141,18 @@ enum axgbe_sfp_speed { >=20 > #define AXGBE_SFP_EXTD_CC 31 >=20 >+#define AXGBE_SFP_EEPROM_PAGE_SIZE 256 >+ > struct axgbe_sfp_eeprom { > u8 base[64]; > u8 extd[32]; > u8 vendor[32]; > }; >=20 >+struct axgbe_sfp_eeprom_module { >+ u8 base[256]; >+}; >+ > #define AXGBE_BEL_FUSE_VENDOR "BEL-FUSE" > #define AXGBE_BEL_FUSE_PARTNO "1GBT-SFP06" >=20 >@@ -734,6 +740,106 @@ static int axgbe_phy_sfp_read_eeprom(struct axgbe_po= rt *pdata) > return ret; > } >=20 >+int axgbe_get_module_info(struct rte_eth_dev *dev, >+ struct rte_eth_dev_module_info *modinfo) { >+ struct axgbe_port *pdata =3D dev->data->dev_private; >+ struct axgbe_sfp_eeprom sfp_eeprom; >+ uint8_t eeprom_addr; >+ int ret; >+ >+ ret =3D axgbe_phy_get_comm_ownership(pdata); >+ >+ if (ret) >+ return -EIO; >+ >+ ret =3D axgbe_phy_sfp_get_mux(pdata); >+ >+ if (ret) { >+ PMD_DRV_LOG(ERR, "I2C error setting SFP MUX\n"); >+ return ret; >+ } >+ >+ eeprom_addr =3D 0; >+ ret =3D axgbe_phy_i2c_read(pdata, AXGBE_SFP_SERIAL_ID_ADDRESS, >+ &eeprom_addr, sizeof(eeprom_addr), >+ &sfp_eeprom, sizeof(sfp_eeprom)); >+ >+ if (ret) { >+ PMD_DRV_LOG(ERR, "I2C error reading SFP EEPROM\n"); >+ goto put; >+ } >+ >+ if (sfp_eeprom.extd[AXGBE_SFP_EXTD_SFF_8472] !=3D 0xff) { >+ if (sfp_eeprom.extd[AXGBE_SFP_EXTD_SFF_8472] =3D=3D 0) { >+ modinfo->type =3D RTE_ETH_MODULE_SFF_8079; >+ modinfo->eeprom_len =3D RTE_ETH_MODULE_SFF_8079_LEN; >+ } else { >+ modinfo->type =3D RTE_ETH_MODULE_SFF_8472; >+ modinfo->eeprom_len =3D RTE_ETH_MODULE_SFF_8472_LEN; >+ } >+ } >+ >+ >+put: >+ axgbe_phy_sfp_put_mux(pdata); >+ axgbe_phy_put_comm_ownership(pdata); >+ return 0; >+} >+ >+int axgbe_get_module_eeprom(struct rte_eth_dev *dev, >+ struct rte_dev_eeprom_info *info) >+{ >+ struct axgbe_port *pdata =3D dev->data->dev_private; >+ struct axgbe_sfp_eeprom_module sfp_eeprom; >+ uint8_t eeprom_addr; >+ uint8_t *data; >+ uint32_t i; >+ int ret; >+ >+ ret =3D axgbe_phy_get_comm_ownership(pdata); >+ >+ if (ret) >+ return -EIO; >+ >+ if (!info || !info->length || !info->data) >+ return -EINVAL; >+ >+ ret =3D axgbe_phy_sfp_get_mux(pdata); >+ if (ret) { >+ PMD_DRV_LOG(ERR, "I2C error setting SFP MUX\n"); >+ return ret; >+ } >+ >+ eeprom_addr =3D 0; >+ ret =3D axgbe_phy_i2c_read(pdata, AXGBE_SFP_SERIAL_ID_ADDRESS, >+ &eeprom_addr, sizeof(eeprom_addr), >+ &sfp_eeprom, sizeof(sfp_eeprom)); >+ if (ret) { >+ PMD_DRV_LOG(ERR, "I2C error reading SFP EEPROM\n"); >+ goto put; >+ } >+ data =3D info->data; >+ >+ /* for AXGBE_SFP_SERIAL_ID_ADDRESS */ >+ for (i =3D 0; i < AXGBE_SFP_EEPROM_PAGE_SIZE; i++) >+ data[i] =3D sfp_eeprom.base[i]; >+ >+ eeprom_addr =3D 0; >+ ret =3D axgbe_phy_i2c_read(pdata, AXGBE_SFP_DIAG_INFO_ADDRESS, >+ &eeprom_addr, sizeof(eeprom_addr), >+ &sfp_eeprom, sizeof(sfp_eeprom)); >+ >+ /* for AXGBE_SFP_DIAG_INFO_ADDRESS */ >+ for (i =3D 0; i < info->length - AXGBE_SFP_EEPROM_PAGE_SIZE; i++) >+ data[i + AXGBE_SFP_EEPROM_PAGE_SIZE] =3D sfp_eeprom.base[i]; >+ >+put: >+ axgbe_phy_sfp_put_mux(pdata); >+ axgbe_phy_put_comm_ownership(pdata); >+ return 0; >+} >+ > static void axgbe_phy_sfp_signals(struct axgbe_port *pdata) { > struct axgbe_phy_data *phy_data =3D pdata->phy_data; @@ -741,6 +847,7 @@= static void axgbe_phy_sfp_signals(struct axgbe_port *pdata) > u8 gpio_reg, gpio_ports[2]; > int ret; >=20 >+ > /* Read the input port registers */ > gpio_reg =3D 0; > ret =3D axgbe_phy_i2c_read(pdata, phy_data->sfp_gpio_address, >-- >2.17.1 >