From patchwork Thu Oct 11 10:35:45 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Igor Russkikh X-Patchwork-Id: 46585 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 318771B521; Thu, 11 Oct 2018 12:35:49 +0200 (CEST) Received: from NAM02-CY1-obe.outbound.protection.outlook.com (mail-cys01nam02on0089.outbound.protection.outlook.com [104.47.37.89]) by dpdk.org (Postfix) with ESMTP id CCD471B51A for ; Thu, 11 Oct 2018 12:35:46 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=AQUANTIA1COM.onmicrosoft.com; s=selector1-aquantia-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=+GtNDXj5XHIzFWVoIB8fjCWvtGc9UHkS7RDuBaE77aw=; b=ScJ9Ui0gYoGh70vBHXVj+O7tnptwC3e22SRdbOUNEp4KS/okdP0jXx5l6B5numA2DZaL+emJhK0w+0Ou1JcJZ/eDas10F5zQS4vFS3lK5by+JVE80hj5Mr/J1/3uhGpbK8R2FTcifuKRMUlCShr07ADCeo5kP/j3GKLpim/zlho= Received: from BY1PR0701MB1660.namprd07.prod.outlook.com (10.162.110.22) by BY1PR0701MB1208.namprd07.prod.outlook.com (10.160.105.151) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1207.27; Thu, 11 Oct 2018 10:35:45 +0000 Received: from BY1PR0701MB1660.namprd07.prod.outlook.com ([fe80::346d:e756:e70e:17]) by BY1PR0701MB1660.namprd07.prod.outlook.com ([fe80::346d:e756:e70e:17%3]) with mapi id 15.20.1228.020; Thu, 11 Oct 2018 10:35:45 +0000 From: Igor Russkikh To: "dev@dpdk.org" CC: Pavel Belous , Igor Russkikh , "ferruh.yigit@intel.com" , Pavel Belous Thread-Topic: [PATCH v5 21/23] net/atlantic: support for EEPROM get/set Thread-Index: AQHUYU4qNvQwV45YpUKPnqxWmvhhow== Date: Thu, 11 Oct 2018 10:35:45 +0000 Message-ID: <277a09d2afc8e4e409b65bf591244ab15975b977.1539249721.git.igor.russkikh@aquantia.com> References: In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: VI1PR04CA0088.eurprd04.prod.outlook.com (2603:10a6:803:64::23) To BY1PR0701MB1660.namprd07.prod.outlook.com (2a01:111:e400:522a::22) authentication-results: spf=none (sender IP is ) smtp.mailfrom=Igor.Russkikh@aquantia.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [95.79.108.179] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; BY1PR0701MB1208; 6:9QeMYiGUa8UmgixL7KB0gUjg5ZddssnBUGbencQusrGoi4loi7Ih0Ankn7E/MxLg4hwld4S5NH8EanW1FeuC4JiCsAm4WeLRn/vU23xyXOtBVqm0KlFEJI+/V4THg9Ff22fsJ7SnMYTitZgQSqVXI0eTKBwCm7XSHPA3Nn8A4OsPHza8aneNw7FaRdtO8YyzayIWTiSktxijVF2GnWqQOzerCrCuKRkmzWr3OzT1KyIQGMuuCkNuKOtnVv7dZEwOnph02snWg3Tbxz0otBhwKIGPFlNEQbD6gIiBR6eHT3bxLK9iRQQdn+vWXWN+p3gA+teJ016hNN80nIEVc6GyRXYswmgLHQOgs/2lD0OhJewwZC2zez/3MPWEtCYbSLxaLRR3K90/4uBOFmMtrUGbMgl/6+iamH2apEVmopJMk9xL9ISFTNG0h+hjJx3CmWBOWZIoq8AJ+VopsBLjetp2GnK9MwkCF1ouYdsExqy0qoM=; 5:51mDfttCCDUViCxxUg7EeN76QnQuX8u4yVMTeBa2fdIhm0bl4LE3jwMbCdMs3ThfwvKZeNLr2ySZYcdfov7RPgVPmhG0DH0FGjIDLn/jmvUWO7U4zEgubSspH11fv3+rQU9CTpWRyWzsYv6AJJypeHeDjcdx7hG6Y7D+m3lUHdI=; 7:rIGVEP/XZUVD8MSo/krzkbc4a42o7gyuYQc+dX1QwW4y71+GXFL0jz+EdVg9kBAK8lpiE/N49WK1IpW+QyQKNBc6FWEbOevgLVrPQUz8gHr6eD8soPO28uUlekSKLxH1S0tu+XyDaOHqMNHvNoOIPliSGvlDi+Pin+vaPSJHrKT3X9PuMetGIPB4fbaeyKztglnuIdGS2X8ICG+Wt2MHw6dlDWVpb5dxfkbF5raGeBaOBiU8F8joDBvRH/SiGDxF x-ms-office365-filtering-correlation-id: cd625174-100a-48af-5717-08d62f654cdf x-microsoft-antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(2017052603328)(7153060)(7193020); SRVR:BY1PR0701MB1208; x-ms-traffictypediagnostic: BY1PR0701MB1208: x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:; x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(6040522)(2401047)(5005006)(8121501046)(93006095)(93001095)(10201501046)(3002001)(3231355)(944501410)(52105095)(149066)(150057)(6041310)(20161123562045)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(20161123564045)(201708071742011)(7699051); SRVR:BY1PR0701MB1208; BCL:0; PCL:0; RULEID:; SRVR:BY1PR0701MB1208; x-forefront-prvs: 08220FA8D6 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(376002)(39840400004)(346002)(396003)(136003)(366004)(199004)(189003)(26005)(99286004)(72206003)(478600001)(76176011)(14454004)(486006)(256004)(97736004)(8676002)(316002)(5660300001)(8936002)(476003)(66066001)(4326008)(305945005)(11346002)(2616005)(71190400001)(6116002)(2351001)(54906003)(575784001)(86362001)(446003)(6506007)(6916009)(7736002)(386003)(25786009)(105586002)(106356001)(6512007)(2906002)(36756003)(3846002)(71200400001)(102836004)(68736007)(186003)(118296001)(5250100002)(44832011)(2501003)(81166006)(1730700003)(2900100001)(107886003)(52116002)(53936002)(6486002)(6436002)(81156014)(5640700003); DIR:OUT; SFP:1101; SCL:1; SRVR:BY1PR0701MB1208; H:BY1PR0701MB1660.namprd07.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; received-spf: None (protection.outlook.com: aquantia.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: HxwadacoCQTQQ5xD9JZvEL9ErDAjt3y6onYK6AZsI0v84D+0Jo9zbPruS7p+D0SVPZ2HAxtU+oXdB3N6bDM/zw7UZF3x7jzt4RFdoyRXhI1MYweLOmnqcbMbOOA1nciaxt33Kz5DL+Ej2a7Auki8RspH+YFE3ONeS+afR2hVdrCpR7GU5rhYKwe7xEacInVwhm/enO38VJElFssI6OIuIrRdeNajWJTshVp6d1Lfj20nVqGSG4c8+X2n1R6x+yMV0mkbXyGzIuSnS7VjHPHvCXFWSnFd/l4ngmO+Lx2Rg0Xzb32RIGLUOjdEJ9U6dCxaUiJQyq2LJOE8jSr4jjXP3oPg4jxJZfeEJHdeYKF3FpA= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: aquantia.com X-MS-Exchange-CrossTenant-Network-Message-Id: cd625174-100a-48af-5717-08d62f654cdf X-MS-Exchange-CrossTenant-originalarrivaltime: 11 Oct 2018 10:35:45.2075 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 83e2e134-991c-4ede-8ced-34d47e38e6b1 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY1PR0701MB1208 Subject: [dpdk-dev] [PATCH v5 21/23] net/atlantic: support for EEPROM get/set 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" From: Pavel Belous Add support for EEPROM reading/writing. Signed-off-by: Igor Russkikh Signed-off-by: Pavel Belous --- doc/guides/nics/features/atlantic.ini | 1 + drivers/net/atlantic/atl_ethdev.c | 47 +++++++++++++++++++++++++++++++++++ 2 files changed, 48 insertions(+) diff --git a/doc/guides/nics/features/atlantic.ini b/doc/guides/nics/features/atlantic.ini index f9aec42d9345..e8ddaf0a6477 100644 --- a/doc/guides/nics/features/atlantic.ini +++ b/doc/guides/nics/features/atlantic.ini @@ -29,6 +29,7 @@ Basic stats = Y Extended stats = Y Stats per queue = Y FW version = Y +EEPROM dump = Y Linux UIO = Y x86-32 = Y x86-64 = Y diff --git a/drivers/net/atlantic/atl_ethdev.c b/drivers/net/atlantic/atl_ethdev.c index 105ec0c4e121..aef3db5533dd 100644 --- a/drivers/net/atlantic/atl_ethdev.c +++ b/drivers/net/atlantic/atl_ethdev.c @@ -62,6 +62,13 @@ static void atl_vlan_strip_queue_set(struct rte_eth_dev *dev, static int atl_vlan_tpid_set(struct rte_eth_dev *dev, enum rte_vlan_type vlan_type, uint16_t tpid); +/* EEPROM */ +static int atl_dev_get_eeprom_length(struct rte_eth_dev *dev); +static int atl_dev_get_eeprom(struct rte_eth_dev *dev, + struct rte_dev_eeprom_info *eeprom); +static int atl_dev_set_eeprom(struct rte_eth_dev *dev, + struct rte_dev_eeprom_info *eeprom); + /* Flow control */ static int atl_flow_ctrl_get(struct rte_eth_dev *dev, struct rte_eth_fc_conf *fc_conf); @@ -260,6 +267,11 @@ static const struct eth_dev_ops atl_eth_dev_ops = { .rx_descriptor_status = atl_dev_rx_descriptor_status, .tx_descriptor_status = atl_dev_tx_descriptor_status, + /* EEPROM */ + .get_eeprom_length = atl_dev_get_eeprom_length, + .get_eeprom = atl_dev_get_eeprom, + .set_eeprom = atl_dev_set_eeprom, + /* Flow Control */ .flow_ctrl_get = atl_flow_ctrl_get, .flow_ctrl_set = atl_flow_ctrl_set, @@ -1077,6 +1089,41 @@ atl_dev_interrupt_handler(void *param) atl_dev_interrupt_action(dev, dev->intr_handle); } +#define SFP_EEPROM_SIZE 0xff + +static int +atl_dev_get_eeprom_length(struct rte_eth_dev *dev __rte_unused) +{ + return SFP_EEPROM_SIZE; +} + +static int +atl_dev_get_eeprom(struct rte_eth_dev *dev, struct rte_dev_eeprom_info *eeprom) +{ + struct aq_hw_s *hw = ATL_DEV_PRIVATE_TO_HW(dev->data->dev_private); + + if (hw->aq_fw_ops->get_eeprom == NULL) + return -ENOTSUP; + + if (eeprom->length != SFP_EEPROM_SIZE || eeprom->data == NULL) + return -EINVAL; + + return hw->aq_fw_ops->get_eeprom(hw, eeprom->data, eeprom->length); +} + +static int +atl_dev_set_eeprom(struct rte_eth_dev *dev, struct rte_dev_eeprom_info *eeprom) +{ + struct aq_hw_s *hw = ATL_DEV_PRIVATE_TO_HW(dev->data->dev_private); + + if (hw->aq_fw_ops->set_eeprom == NULL) + return -ENOTSUP; + + if (eeprom->length != SFP_EEPROM_SIZE || eeprom->data == NULL) + return -EINVAL; + + return hw->aq_fw_ops->set_eeprom(hw, eeprom->data, eeprom->length); +} static int atl_flow_ctrl_get(struct rte_eth_dev *dev, struct rte_eth_fc_conf *fc_conf)