From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM01-SN1-obe.outbound.protection.outlook.com (mail-sn1nam01on0061.outbound.protection.outlook.com [104.47.32.61]) by dpdk.org (Postfix) with ESMTP id D282C7CEB for ; Thu, 13 Sep 2018 13:36:06 +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=3r8KR4tnoptogPUSTxuojk495lolRVOlQGoIZGtfH3A=; b=vFAtTvWZ4sjqW5kZW35IQaw5hYdVPWoYGCWbGjbUy7r//xlLHP41muOaOqf9fAM2anpcP4wvIDthZlf1DIdHMmVagA0Zv7fApKlqQVIdSbaXmCIRpOwK6BHAnbS/nuWqzaFoih9POSiMv03CQZCiIrJPDG3C9rECPIBtXPy3acg= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Igor.Russkikh@aquantia.com; Received: from ubuntubox.rdc.aquantia.com (95.79.108.179) by BLUPR0701MB1650.namprd07.prod.outlook.com (2a01:111:e400:58c6::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1143.15; Thu, 13 Sep 2018 11:36:04 +0000 From: Igor Russkikh To: dev@dpdk.org Cc: pavel.belous@aquantia.com, igor.russkikh@aquantia.com Date: Thu, 13 Sep 2018 14:35:21 +0300 Message-Id: <1536838528-11800-14-git-send-email-igor.russkikh@aquantia.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1536838528-11800-1-git-send-email-igor.russkikh@aquantia.com> References: <1536838528-11800-1-git-send-email-igor.russkikh@aquantia.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [95.79.108.179] X-ClientProxiedBy: VI1PR0202CA0026.eurprd02.prod.outlook.com (2603:10a6:803:14::39) To BLUPR0701MB1650.namprd07.prod.outlook.com (2a01:111:e400:58c6::20) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 47b8b528-76a0-41dc-acf7-08d6196d177e X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989137)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(5600074)(711020)(2017052603328)(7153060)(7193020); SRVR:BLUPR0701MB1650; X-Microsoft-Exchange-Diagnostics: 1; BLUPR0701MB1650; 3:OGqKzWiSA9m1HN5n9VXOG0H3ecdgyBwLRCkj57JCifKlZwx9Jgmgw1QRxwU2jjNZHfwQfmocMTwjgvHEjUjuz35bh3Hi8d9vl58evDpqhn5AeUe36uHzk4uLj8bDc/ZUHp5efS9AMTVM2JbUMOSDW3m2b2C81bD6q5osKAqVzl9H3tf45Yn4Osujy9xy6CY1ckWPtcwN085WhBn536aOc3N5OYySJZEkC5V3LFixW6N3Y3TrcQHdnCpV8uhSQ5HM; 25:HYh1J1lctGdmFwYQIRy3NwxUA1+qrJcyzgg+Pdt7z/aTER+ibUykZmyNXcZjalZmkygGa86sBNLVmQNN7L2jcPRI7PcKfYNamCaxN/j+0LONg9BT7jlkIPPqXYIUAczLGOCIBK8Yu7Cg6mVDJXv8g0j1uZXiUxzaS+rvNOtDA/darRXY+x9uUcaWrsK9MPmMhaFB6pxIRDbdTL31bLrj5gr/Biep1Hu2kK10vwHzVyQT2mIjTyb9EUS+Ff2ozZqcszNDcF3KN+ipYcCm1uhN9cQ8VjmT9366//M6iw2AlYeXX7pgKk00xi7g4t76GaPdIEDiphioslk5Eya4SVv8OQyzICmEaExBJV4pR5lAgaA=; 31:RXwZeyKU88iMdc40uUIu2b54q/S5jcWdyD+246d9LRnDqPhxoQNNArEpTK9fyl6I1tkhqsmjOSe54gDxaudDYZ4bRMPo/q1Topl1FyHUyQI6hz+EjhsqQLHIBM5trc+MHIFIwl5AygqUkBXPLmn3GictpICFWjo9wdt5OXYJc+PSs6VZRpL15WDDr5J7g3jirkWrrw2660ocQCPYPsAx1YBw3tNoq7h8N/IK5Xumt+4= X-MS-TrafficTypeDiagnostic: BLUPR0701MB1650: X-Microsoft-Exchange-Diagnostics: 1; BLUPR0701MB1650; 20:WLpa9m2pkNIXHa+M8vNzB0mBwMoq0JoVAFWj81dSlMSH7gLyUnOxHhiFpXE9qEHaGyPZ/3uKPbenLqAD1tqB3LL9pzgAJmnuobM01Z2WsZ2rwglA/ch3tJjT0reHLe1ykkl2Q8RgV+i9NXARK+B9bsp2+Ylf7chPddLCGI++0nXIfOMRPyhja7vr0kMPjChJgGtF0EKY2BCOUUKU1G2Xq11am5hKm84WxTGeZZb9E0DeLnrvOGcmRqu8zzK3CgcUPhEC7Xc0U56lRDX96/2foM4XQzyu9im0nQ1TRrmtcjmuK+5te/KdpHikwGO/Rw7HsUWWJnSIVywFygLFtdDMa1s4IlLrlzFMDgGfJ4caqkl2zy+fgR72lwHMZHoNuzuSbIC+chS5xzUQUTcbkkMY0bSDIxfwmj27ITgeRt4g851VSNVDvOfTpG9sEPpVqs90omvjPLUvME9LTAnSCemx0iil+W+kpbwweLtxC9vpfdwdWCQ3WoldAUNIIvXTNWSc; 4:21BVubaFE+mBx9NCDD993CVUplxR0h6RAOKPP6VFEwqAJuJkt4cAiy+22JJP4LPTu/hVFMKfvFxg0dEd9BinEjdiE3FtY5uTIm0jsAUfxBPdgD/fQicXaf7r1xRcypYjy73I20hfvau6b5vAwb/ZB0FmEZn2QjpIO1XLH3vcSfwo6riiINR2fFha3NhqySlRqOXlwatXRvU52VpueSVhBDptUQuW48amCrzJxjn4TFnfimPEzU4ipEsqFyYPbVE2WEl2SjOcodFePEVrgjfJ0Q== 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)(8121501046)(5005006)(93006095)(93001095)(3231311)(944501410)(52105095)(10201501046)(3002001)(149027)(150027)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123564045)(20161123562045)(20161123558120)(201708071742011)(7699050); SRVR:BLUPR0701MB1650; BCL:0; PCL:0; RULEID:; SRVR:BLUPR0701MB1650; X-Forefront-PRVS: 07943272E1 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(39840400004)(366004)(396003)(376002)(136003)(346002)(199004)(189003)(6666003)(6916009)(97736004)(8936002)(68736007)(25786009)(50226002)(81166006)(81156014)(4326008)(107886003)(6486002)(51416003)(2906002)(53936002)(5660300001)(36756003)(86362001)(316002)(52116002)(8676002)(16586007)(7736002)(305945005)(11346002)(446003)(476003)(956004)(47776003)(72206003)(66066001)(44832011)(478600001)(486006)(186003)(26005)(16526019)(14444005)(386003)(48376002)(2351001)(106356001)(2361001)(2616005)(3846002)(105586002)(50466002)(7696005)(6116002)(76176011); DIR:OUT; SFP:1101; SCL:1; SRVR:BLUPR0701MB1650; H:ubuntubox.rdc.aquantia.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-Exchange-Diagnostics: =?us-ascii?Q?1; BLUPR0701MB1650; 23:ACJ5CRwPWfrs4z0JopEwaz+AWaU6rkevuO8KrQT?= =?us-ascii?Q?M82ObxshO0mEt6OybVBlK8+ZoNaZfvo2f7/qtqiwwozJXfw5DbRKs2s/4b8y?= =?us-ascii?Q?tb6Ldk6KLVNWj0kHyc20/puHufBYzvfDCToqcNRnnQD05G69MBRpIzYgth6O?= =?us-ascii?Q?nt2s5pmHg++Du3n8YacUdhFLmGlemygHACju7uMj7JUDxBiBG27QU6HJ3Nuo?= =?us-ascii?Q?IRYgw+RXjKZpiPOUbv/PQkEyUGbjl6oUzMUgXAioyIYzJdyRoTljsqPfBv4t?= =?us-ascii?Q?4t+KeaFDlU7sOSddUck+3yu81TEKNOV8Q345T2wnGc95srAcfHH8ki0Jk80Q?= =?us-ascii?Q?jVx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y0s50PACJv+I38azQrmaI5+eSd5+kjl50pHOZIdZCxIquWsTlTDA/GImDtB6dovAK9Ai/orRn4A5aCgaiO6S7wqMpxLkL8LQ=; 7:/ap5T4t9gPp8zOyJQA/7QeMhuI9wLEu+Hr0A1548fWA+xz5QBlNJhcwV39PyAQEPud3DiGJcF1ZTA04NimrdOhlwTj5gr0sZytrPjXXVxJOFxnKWoGRTsbbsU0wHVkkDgAbu3tmH1kZnV2ly46tpgaX8U04qFAiIgiH7rK6kSBmdqphlKEGlVeliCxrbkv1cyVeDyhUaeXPrKu+c0jjOFer2LxwwAqiJH6nhjvGwyifi+ABa7qxPSMVSR4pDnkUS SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: aquantia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Sep 2018 11:36:04.6893 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 47b8b528-76a0-41dc-acf7-08d6196d177e X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 83e2e134-991c-4ede-8ced-34d47e38e6b1 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BLUPR0701MB1650 Subject: [dpdk-dev] [PATCH v2 14/21] net/atlantic: eeprom and register manipulation routines 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: , X-List-Received-Date: Thu, 13 Sep 2018 11:36:07 -0000 From: Pavel Belous Signed-off-by: Igor Russkikh --- drivers/net/atlantic/atl_ethdev.c | 79 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 79 insertions(+) diff --git a/drivers/net/atlantic/atl_ethdev.c b/drivers/net/atlantic/atl_ethdev.c index 940fd83d9..c16d179fd 100644 --- a/drivers/net/atlantic/atl_ethdev.c +++ b/drivers/net/atlantic/atl_ethdev.c @@ -66,6 +66,17 @@ static void atl_dev_info_get(struct rte_eth_dev *dev, static const uint32_t *atl_dev_supported_ptypes_get(struct rte_eth_dev *dev); +/* 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); + +/* Regs */ +static int atl_dev_get_regs(struct rte_eth_dev *dev, + struct rte_dev_reg_info *regs); + /* Flow control */ static int atl_flow_ctrl_get(struct rte_eth_dev *dev, struct rte_eth_fc_conf *fc_conf); @@ -175,6 +186,12 @@ static const struct eth_dev_ops atl_eth_dev_ops = { /* Link */ .link_update = atl_dev_link_update, + .get_reg = atl_dev_get_regs, + + /* 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, @@ -849,6 +866,68 @@ 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_dev_get_regs(struct rte_eth_dev *dev, struct rte_dev_reg_info *regs) +{ + struct aq_hw_s *hw = ATL_DEV_PRIVATE_TO_HW(dev->data->dev_private); + u32 mif_id; + int err; + + if (regs->data == NULL) { + regs->length = hw_atl_utils_hw_get_reg_length(); + regs->width = sizeof(u32); + return 0; + } + + /* Only full register dump is supported */ + if (regs->length && regs->length != hw_atl_utils_hw_get_reg_length()) + return -ENOTSUP; + + err = hw_atl_utils_hw_get_regs(hw, regs->data); + + /* Device version */ + mif_id = hw_atl_reg_glb_mif_id_get(hw); + regs->version = mif_id & 0xFFU; + + return err; +} + static int atl_flow_ctrl_get(struct rte_eth_dev *dev, struct rte_eth_fc_conf *fc_conf) { -- 2.13.3.windows.1