From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM03-BY2-obe.outbound.protection.outlook.com (mail-by2nam03on0086.outbound.protection.outlook.com [104.47.42.86]) by dpdk.org (Postfix) with ESMTP id A3F875398 for ; Fri, 7 Sep 2018 17:23:30 +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=FQaVsG3JbelhaRp1lgNNGzBupxmTHk4+XZGvA6DyY6k=; b=acBqZ4i/ay7/dHIiVF6TMnnUWPKtA9C6DmyCYQkk53jBztTLm69heFRSyjFJEB1Ymqwyq0FCbxqsCrVEXOP+xsRB5VS4eJA75thUvtwqDHec4frs5ERF33JNh9p1t/GGmaAPys/F373IQr+h+WCVtVsWmtGm9K4sHWfBzKx+0iE= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Igor.Russkikh@aquantia.com; Received: from ubuntubox.rdc.aquantia.com (95.79.108.179) by BLUPR0701MB1652.namprd07.prod.outlook.com (2a01:111:e400:58c6::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1122.16; Fri, 7 Sep 2018 15:23:27 +0000 From: Igor Russkikh To: dev@dpdk.org Cc: pavel.belous@aquantia.com, Nadezhda.Krupnina@aquantia.com, igor.russkikh@aquantia.com, Simon.Edelhaus@aquantia.com, Corey Melton , Ashish Kumar Date: Fri, 7 Sep 2018 18:21:52 +0300 Message-Id: <1536333719-32155-15-git-send-email-igor.russkikh@aquantia.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1536333719-32155-1-git-send-email-igor.russkikh@aquantia.com> References: <1536333719-32155-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: BN6PR20CA0060.namprd20.prod.outlook.com (2603:10b6:404:151::22) To BLUPR0701MB1652.namprd07.prod.outlook.com (2a01:111:e400:58c6::22) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 747bb60d-c9f0-4e4e-8752-08d614d5dcfb X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989137)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(5600074)(711020)(2017052603328)(7153060)(7193020); SRVR:BLUPR0701MB1652; X-Microsoft-Exchange-Diagnostics: 1; BLUPR0701MB1652; 3:yFGopBL0PC2m7R7WVSI/L+sWHntc0ICOAC1SzdFPlgMMpReoWMEz0YdiZRwSfCqsWx6Td9g7k6FpFkbLzpBIBq7oxinXDF8K+40olOwvUFNXlAyNtGzFP8Btq02BxEUMzNoGWSYJ7bOXMySprBXUyGdgJbVkAu3W97S12i+pXL+1Fq/NPFXuAjYrXnFZo3BxASAkJWh1y4ibLCfXcdCRtc98/uDirvBAHxqUISU/RXFd+h+yNS5cPQgDVUZnMsKP; 25:fMROOtHyHcEVU8CrYELK9rkaWCs7MBmTuAPXXT6ztS/qNlI4WDASZK5dYZBSg3v9i6htYIQZZVpfvLJ1Jh2x2EC7T3UjMjQa4cnGRR/4XBLely4Yg5ssCBc8AA81XrWyjZHyCexlKtxCC6c1w+vfLswxpdKPnbWX34/fHCWL5gv15J1H03VUM5sMPGRmI1l6oo2kZUp5QCMxLdftkhfWi8mwh4ZWIqcRxv6aORAAzyGDVIhqXfl/NGfSHRj8wPn+FuyMjN5Qa5rBmAFgIC1oQjtIjWpoIhFNXwjZ/3aFQYnLJ69/SzBpTUfk1Qs+t3t14wb3RuayEteTTi7OIc0w8w==; 31:tVJgZLjob6UinFVwEGeEYVBoEeob7jz2KyipFBa6aliDL1QOZ3sVCOHfGtX6zyAU6lSdOrFud+gmDBEBEfN/4xlPpSUTRLDY30p8yomnmHIg8yjRv+hSi8NXxXArWcg7Qx3pVzfIZgohP4arpcfMhJAoreV6L06f4Ne7rMYaBUXkER62IunbmCJaOexaZe0lsyn+qJBfCnfD2ylwbwZTw8rVyr92y4258eZrWeMGge8= X-MS-TrafficTypeDiagnostic: BLUPR0701MB1652: X-Microsoft-Exchange-Diagnostics: 1; BLUPR0701MB1652; 20:Rwy6vPRQe31ZKzXPJtY8t0nDysXRtVazeRE6TREH8f5g4HhUZtysaKV18X3o91aUUDMAl1SgsE54ZhqgoDDcYm33xSMMekRvKWyloILgvS1NPxKSJ9zC+XPahwFXxLpEAx0vPAc5HcsCffh9BgORDU1Q2SGhu7F7vR5Ms93vMWzLsb2t/oOjK6mfFTyCxM5hT/OaXECEsAnxpWWMh52sV3+h9onLP2E0AuvSbfvRE5EbatYV4tMU0t3Jx03TE2Z4joJXhw8CyOwv7i7dXQ6t29kWkf+Wlo7MvqhrUt4MnI935pBI6ozPDElJVykH/QpfdZz3HGc7XtVrcA++D8Kh8g39A836O8rWcSGC9KapDFdqP6moRWEPDFt5o4FI1MkNpVObL5/vCC7WATkS2T6PSjAWiCz7BIy2XhUzhWYNxdnppctIW9CvDDtHycLkfGljtAmIR5SpE4ciO3BAud+Q1NK0+dmQPpQloL4zs9UR71PcGaiqJrp4X/z3eXdqup6K; 4:8X2D8C/Yyef4LIUiPPFURd1R7o0scRT17ddFw8shFcefHTz1XTJ90TPSLFYaDTNtINk7aKr5wgO+D0Dv5gieBZY3A9ZkoTTPgo3v7rcVtn/8A9w2rlBbXy7uaHJxpBp6smxMz8NDI/ZQ8JKRBhic/0VMXkqRpGQd6BFvtUPE2QJwDAEbTYrzTGYfrJb/YcBrmMmZ1L4kDTnXWWuapIWKAaf5Ek4SQ2jZA424IYrqIoe5daFjwH5P11o8O8DfM3M/TdA14r9v3A/NhZp1R50GTg== 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)(3231311)(944501410)(52105095)(10201501046)(3002001)(149027)(150027)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(20161123562045)(20161123564045)(20161123560045)(201708071742011)(7699050); SRVR:BLUPR0701MB1652; BCL:0; PCL:0; RULEID:; SRVR:BLUPR0701MB1652; X-Forefront-PRVS: 07880C4932 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(39850400004)(396003)(376002)(366004)(346002)(136003)(189003)(199004)(81156014)(81166006)(44832011)(8936002)(2351001)(486006)(106356001)(2361001)(105586002)(446003)(2906002)(50226002)(476003)(11346002)(956004)(2616005)(305945005)(7736002)(16586007)(316002)(54906003)(14444005)(16526019)(66066001)(26005)(7696005)(52116002)(8676002)(51416003)(76176011)(186003)(386003)(68736007)(478600001)(6666003)(6916009)(6486002)(5660300001)(53936002)(47776003)(4326008)(25786009)(86362001)(48376002)(50466002)(575784001)(72206003)(6116002)(97736004)(36756003)(3846002); DIR:OUT; SFP:1101; SCL:1; SRVR:BLUPR0701MB1652; H:ubuntubox.rdc.aquantia.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; Received-SPF: None (protection.outlook.com: aquantia.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BLUPR0701MB1652; 23:t28m7XZMAvGKKpzjifXAJHDMfOYGR4hQX+PkO6Y?= =?us-ascii?Q?vzBlRYt4DD6JBQzEU+aMcAAJ2GbTlzA1ygaNrrVnaXC9D5ScuXj0tMFdY8dz?= =?us-ascii?Q?2tbjmOHwEO0LmguztCWFj//kNtIAnRA81EZH6fTIDApyhgxErvWhDK0oQUCS?= =?us-ascii?Q?CL7eSbhqgx2ojhculg7hGWwHej0IZY3RQXH48FMSB27lkT0qs5W1Y7BL9Qgc?= =?us-ascii?Q?yjq9CXmwsoGW626pC/tLaPN/b63VZr2PBmPodL7f6mQvRuuAKf71tNKNcGi1?= =?us-ascii?Q?n0/UFk82LDtiutC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z9GZ2S6GSqtm2jt3FucngBLpAFOjdexSDSmfbgt7EJRRvfjYS3qc+fF6nvel5BxXuBYv9vx8tMRxJ4DCZ8D/LuVyDR6dYVBFzUMbBtxM25BvdOLB67oOOpEjHflB5oYlyqzFiTaoNfwNJkKgDZsuY15kFuZwTLt54s=; 7:1jqMQEj3cN1pnASdQAhTgspk7Bw1p+MKXY31OU3uPlvEKYctF2T+Q7DEo2jA1xHRNdZzK8iPQwpq8cPT6h8Dt848tj/jOk24CSVrFFPDxRuZn1THFpPLvLlnszQYZnqJgg4haf6aH92TvxJxbrg7nEmVaXzArmACrAz11LfUT6NjoMIHIxQH37WAZpY+RvyPAYQZAJSx41+/06sF9Dwj5m5o59jMNe/F+SauugSdPYDbl8dpudYm7tXYIoCstLaS SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: aquantia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Sep 2018 15:23:27.4104 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 747bb60d-c9f0-4e4e-8752-08d614d5dcfb X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 83e2e134-991c-4ede-8ced-34d47e38e6b1 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BLUPR0701MB1652 Subject: [dpdk-dev] [PATCH 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: Fri, 07 Sep 2018 15:23:31 -0000 From: Pavel Belous Signed-off-by: Igor Russkikh --- drivers/net/atlantic/atl_ethdev.c | 77 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 77 insertions(+) diff --git a/drivers/net/atlantic/atl_ethdev.c b/drivers/net/atlantic/atl_ethdev.c index 24c3a0cf3..fe1560923 100644 --- a/drivers/net/atlantic/atl_ethdev.c +++ b/drivers/net/atlantic/atl_ethdev.c @@ -66,6 +66,14 @@ 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); @@ -174,6 +182,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, @@ -842,6 +856,69 @@ 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