From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM01-SN1-obe.outbound.protection.outlook.com (mail-sn1nam01on0074.outbound.protection.outlook.com [104.47.32.74]) by dpdk.org (Postfix) with ESMTP id DEA5A1B5AF for ; Fri, 12 Oct 2018 13:09:52 +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=ZpHkeJyChMGflLeRik4L6XP1ZXHSRjRbJNSpmag4o94=; b=AB2TPOentQ0zweb86bdDgbyLQrkSmj3C76D8bxfqAAVtzsD0bBDZoCB15vaEaey5XivyDKucVh8hi/XAcFfvJat3krRnTlRkhOy74VR8qKcyRZ4euVYvcG09Bupcy/K6ma1XG86All0ETRdstbmkTDgX4dB5IL3zJuVa/hUNpsE= Received: from BY1PR0701MB1660.namprd07.prod.outlook.com (10.162.110.22) by BY1PR0701MB1627.namprd07.prod.outlook.com (10.162.110.156) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1228.22; Fri, 12 Oct 2018 11:09:51 +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; Fri, 12 Oct 2018 11:09:51 +0000 From: Igor Russkikh To: "dev@dpdk.org" CC: Pavel Belous , Igor Russkikh , "ferruh.yigit@intel.com" , Pavel Belous Thread-Topic: [PATCH v6 20/22] net/atlantic: implement EEPROM get/set Thread-Index: AQHUYhwYz3ioYhb9ZkuMBSO9nyZ1ew== Date: Fri, 12 Oct 2018 11:09:51 +0000 Message-ID: References: In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: AM5PR0701CA0008.eurprd07.prod.outlook.com (2603:10a6:203:51::18) 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; BY1PR0701MB1627; 6:7gXl51lPpgDYp4FjbnLBZ895JR8m3gB9wR0UzuISQbq5sALO6KkTQ05tQ1EyEl6ysc32K5ArmyTSzv0Xbuwp1NsGz0eW1Lr9vHGXHXdQnG82szAq6t+DHwtnB6I1f2g4/0nUEFh7vyj0IKdlFcUJzlVjm6wdi+P7Zx0rWIykDTr6Kk5a86ReYV+y392VbDPAggzQoVGp28Wr5Ow3twkU+1urn3tmqpRf3bmqojjo2HhFr7j3C2GedPJcNyCj3q3qCCfiow8sjD6d4LrtmgiIDYtistD4q/MmXg4/fIZNt71Rorfpae3D5kmWN+D1oHqfGPSDqzrjTiar/l2E4LGvHbgO/clz5lO6dKyeikZ+RsXOAsv82HzqIhMbceXByPRdHuw5vw+LB7BIc0wQwd2mPxb8XODs8JUwTCozQhSgP8sUQ2DKCClxZLB2Uuc/dQulITSXkPjzOldFD6X5eNlIfSjIFZCqsuUJR81vS3Caeag=; 5:hW+PkWvDXusifPYnAPPEMXF6CNIKun+otRruTspTm1tlgJV6KDbzBwQI1QoUUPYfLCAqCiPAKvmqoYzwHpS6b7FKUxUd+ZYBMViYyCQ5XFo8mKvwwQfrzX+q1s2FQQ++085JG2oYHQWgL4EJXyM1dC6/y0yfkjoJI7pUn6XCwZI=; 7:Yd5lt5vh04iy7c1OTeoQJQ69BfumA7qzbbtFycexgHgi73BN/wC/WhP6O/cpqQvzoZ1bpDfeVPqKz90L+p5+xZay5Ns5QrHGN+pvXNhF033vaHDSokPwjWyRNxaLzdLVfeBOkGeff443PG9GGydUJBDEZbEKWz7wkSI58EBixzKroO3Ucvin0BzTiqqDmCyKvGApQA+5HcbMGmxYdiHkay8tkrldENYi2hEHqv4sLmyljH6FGqWxe+3gmFBs1z9j x-ms-office365-filtering-correlation-id: b7452caa-d920-4cd2-1a40-08d630333af5 x-microsoft-antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(2017052603328)(7153060)(7193020); SRVR:BY1PR0701MB1627; x-ms-traffictypediagnostic: BY1PR0701MB1627: 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)(3231355)(944501410)(52105095)(3002001)(93006095)(93001095)(10201501046)(149066)(150057)(6041310)(20161123560045)(20161123562045)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(201708071742011)(7699051)(76991067); SRVR:BY1PR0701MB1627; BCL:0; PCL:0; RULEID:; SRVR:BY1PR0701MB1627; x-forefront-prvs: 0823A5777B x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(346002)(366004)(376002)(136003)(39850400004)(396003)(189003)(199004)(186003)(6116002)(486006)(5640700003)(446003)(6436002)(6512007)(53936002)(71200400001)(71190400001)(14454004)(72206003)(316002)(2351001)(44832011)(3846002)(7736002)(305945005)(2906002)(4326008)(6486002)(107886003)(97736004)(26005)(2501003)(102836004)(5250100002)(11346002)(86362001)(25786009)(476003)(2616005)(106356001)(54906003)(105586002)(256004)(5660300001)(66066001)(81166006)(81156014)(1730700003)(8676002)(478600001)(36756003)(68736007)(6916009)(8936002)(99286004)(386003)(6506007)(118296001)(2900100001)(52116002)(76176011); DIR:OUT; SFP:1101; SCL:1; SRVR:BY1PR0701MB1627; H:BY1PR0701MB1660.namprd07.prod.outlook.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-antispam-message-info: kUu05wp6ylziWczSxovl7pLB/NWEoZjbTdKVVoSkeq+AtdhpRXpXALhLnSBlCY7K8b7+IT5/Lv/WJ20ANklsmqRpR9CABQh1GxU/mZOsNCH2uw7gXqD/XU3NEDkqL3dJctLwRn692SstDGHUl1pPq8ZP9wmXHcDqO+4971ZcpOTWY6ini3z0/xW+cxIsZwI0NXRIFWnsjbOHwzc6Na/UZhgDmomfPugranTwlnzo9gHYaLLU0TLZEloNOifHUPiiHMJmKxqiZ2Gg5+mjAZ0Zp8AYu+aMl1TGNaa8uWQTIOR/czCETyulXn8UwQlfMUVwM2DFWwyWS8K8WOzLFxThxoeiUULaA4Z015mp/wWXuLs= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: aquantia.com X-MS-Exchange-CrossTenant-Network-Message-Id: b7452caa-d920-4cd2-1a40-08d630333af5 X-MS-Exchange-CrossTenant-originalarrivaltime: 12 Oct 2018 11:09:51.4384 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 83e2e134-991c-4ede-8ced-34d47e38e6b1 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY1PR0701MB1627 Subject: [dpdk-dev] [PATCH v6 20/22] net/atlantic: implement 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: , X-List-Received-Date: Fri, 12 Oct 2018 11:09:53 -0000 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/featur= es/atlantic.ini index 66949b816284..f09a75691a28 100644 --- a/doc/guides/nics/features/atlantic.ini +++ b/doc/guides/nics/features/atlantic.ini @@ -29,6 +29,7 @@ Basic stats =3D Y Extended stats =3D Y Stats per queue =3D Y FW version =3D Y +EEPROM dump =3D Y Linux UIO =3D Y ARMv8 =3D Y x86-32 =3D Y diff --git a/drivers/net/atlantic/atl_ethdev.c b/drivers/net/atlantic/atl_e= thdev.c index 6ebc02864cfe..824e624dd772 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); =20 +/* 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); @@ -259,6 +266,11 @@ static const struct eth_dev_ops atl_eth_dev_ops =3D { .rx_descriptor_status =3D atl_dev_rx_descriptor_status, .tx_descriptor_status =3D atl_dev_tx_descriptor_status, =20 + /* EEPROM */ + .get_eeprom_length =3D atl_dev_get_eeprom_length, + .get_eeprom =3D atl_dev_get_eeprom, + .set_eeprom =3D atl_dev_set_eeprom, + /* Flow Control */ .flow_ctrl_get =3D atl_flow_ctrl_get, .flow_ctrl_set =3D atl_flow_ctrl_set, @@ -1076,6 +1088,41 @@ atl_dev_interrupt_handler(void *param) atl_dev_interrupt_action(dev, dev->intr_handle); } =20 +#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 *ee= prom) +{ + struct aq_hw_s *hw =3D ATL_DEV_PRIVATE_TO_HW(dev->data->dev_private); + + if (hw->aq_fw_ops->get_eeprom =3D=3D NULL) + return -ENOTSUP; + + if (eeprom->length !=3D SFP_EEPROM_SIZE || eeprom->data =3D=3D 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 *ee= prom) +{ + struct aq_hw_s *hw =3D ATL_DEV_PRIVATE_TO_HW(dev->data->dev_private); + + if (hw->aq_fw_ops->set_eeprom =3D=3D NULL) + return -ENOTSUP; + + if (eeprom->length !=3D SFP_EEPROM_SIZE || eeprom->data =3D=3D NULL) + return -EINVAL; + + return hw->aq_fw_ops->set_eeprom(hw, eeprom->data, eeprom->length); +} =20 static int atl_flow_ctrl_get(struct rte_eth_dev *dev, struct rte_eth_fc_conf *fc_conf= ) --=20 2.7.4