From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM01-SN1-obe.outbound.protection.outlook.com (mail-sn1nam01on0044.outbound.protection.outlook.com [104.47.32.44]) by dpdk.org (Postfix) with ESMTP id 8D81B1B201 for ; Tue, 9 Oct 2018 11:32:05 +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=MEzb31eqCLcZzZK+z07MbIaEki1Iya3JOcumSM99KPw=; b=ZarO7UWi6PVjK+mWtOKyfcSL/qQtqL5kVM7nV8ht5HQZ24XnpktacguJxZs0BYwq3XzLxuG/em9d/5jgRdZM0gieUOe6wE68+Sc3Jtc5b5tFEUp9htbrxK8ittAmGl20HYzZmh7BkYPjOjwgRae+fUBTjn/s1YntqBLZwv39wes= Received: from BLUPR0701MB1651.namprd07.prod.outlook.com (10.163.84.21) by BLUPR0701MB1650.namprd07.prod.outlook.com (10.163.84.20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1207.23; Tue, 9 Oct 2018 09:32:03 +0000 Received: from BLUPR0701MB1651.namprd07.prod.outlook.com ([fe80::7c97:1527:4c0:8b46]) by BLUPR0701MB1651.namprd07.prod.outlook.com ([fe80::7c97:1527:4c0:8b46%3]) with mapi id 15.20.1207.024; Tue, 9 Oct 2018 09:32:03 +0000 From: Igor Russkikh To: "dev@dpdk.org" CC: Pavel Belous , Igor Russkikh , "ferruh.yigit@intel.com" , Pavel Belous Thread-Topic: [PATCH v4 20/22] net/atlantic: LED control DPDK and private APIs Thread-Index: AQHUX7LvcpgL3QHJsUikvzYpq0sXJw== Date: Tue, 9 Oct 2018 09:32:03 +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: AM0PR01CA0028.eurprd01.prod.exchangelabs.com (2603:10a6:208:69::41) To BLUPR0701MB1651.namprd07.prod.outlook.com (2a01:111:e400:58c6::21) 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; BLUPR0701MB1650; 6:f0W95dLsspohFtJ1wTJpveaGAelJ1UFNL+DTU/qRZZPRujzaZGY8dn9jRUCGdLrxkm9WxLp2toMPwY5ykg7XHR0jxHhfWouEGgmGH9rHQyNpiSV1JdcTwESGt42ZFHFW6gvZrJTqwGGLKED/u6BMG4YykON0mvRRlUYf2atrDRKXrUFpTccjX+cGNg/0c4XIcbXqKiokgUrWZBZJFNZ5xS5S85zc/09crsDM5DfV32RNci0pC/NKWarKbYS5I6w8iO6Frs7NSKTKnOG7g8qkvJ2/owt3GwYkBm6eCXNHIKjbwkUIZEoXehEU1amMiL/UpjT4PzHjFxi8x5ZnlKsa1FjKxFN6I4YTKP0y0qaGSVdLMmarOtOCEe87s+fU0CxUg9xTOLPSQ5bpswsb+SEzVYPQkawa7gFi8G1N0qaFTq25sTlXiSk6+x9GUpsSc6B3rLttHXXpnDXqTmckNh79ew==; 5:UPCst8JoXhFUI5oiAeJc8RnAZY2rzJC1CM+/n1ImhIpdPMt7ED0g41dafEGbINNZcvC9w/0aPXCLiuKNcQQ+xgrM+1RvP23fgUzVkwsPo8SnMbUk9FOdzOikzNG9v3QsW4MdSJ895SrW8+eY62+xmRnH0QnntDyWnPnBJ8HIBkA=; 7:RVortA/Aq1oT995xlpkXwWSzKTyDftPH8oEGy2oKwWR0wuxFiSxaV0XfCV4ml/by8PJy2uVV5E76w4Vf8i00VmF5nzLAcgTUjm0YqwPpxlzbWMN1BLFfEocxmQFtYn2exjDpZ0tlKsgKC4PvVuO8B9NK0qlOceRC3rIitEsmx2tojK9EeK8+PD5IE9GeNWoYV3cMpxinU8cZiItOLKB84iBtER8IYi5XzM/+T/vh42loDtd6O/AdeMqOL6+bctRj x-ms-office365-filtering-correlation-id: 53e33793-0836-46dc-1c58-08d62dca124f x-microsoft-antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(2017052603328)(7153060)(7193020); SRVR:BLUPR0701MB1650; x-ms-traffictypediagnostic: BLUPR0701MB1650: 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)(10201501046)(3231355)(944501410)(52105095)(93006095)(93001095)(3002001)(149066)(150057)(6041310)(20161123564045)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123558120)(201708071742011)(7699051); SRVR:BLUPR0701MB1650; BCL:0; PCL:0; RULEID:; SRVR:BLUPR0701MB1650; x-forefront-prvs: 08200063E9 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(1496009)(366004)(39850400004)(346002)(376002)(396003)(136003)(189003)(199004)(81156014)(5640700003)(6116002)(71200400001)(105586002)(68736007)(316002)(3846002)(107886003)(71190400001)(26005)(118296001)(2616005)(5250100002)(25786009)(4326008)(102836004)(44832011)(446003)(476003)(11346002)(186003)(2906002)(106356001)(97736004)(2501003)(2351001)(486006)(478600001)(99286004)(53936002)(386003)(1730700003)(5660300001)(6506007)(36756003)(66066001)(54906003)(305945005)(256004)(86362001)(575784001)(7736002)(2900100001)(76176011)(8936002)(52116002)(8676002)(6486002)(72206003)(6436002)(14454004)(81166006)(6512007)(6916009); DIR:OUT; SFP:1101; SCL:1; SRVR:BLUPR0701MB1650; H:BLUPR0701MB1651.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: IrAKcbSRxhndkTAi0AbTNWWxev0EPpIQL/VpOBOhYFvOtXZZUhlp2rkjSIg0QvC4OIpe1t3STbq2NRpxb4T9PFihbv70wbl0bJBcJj4rQW8VKUXPdKRLV6ntjKh4udtbSMO/JhvbXRJAE0mBwo+9RkBoJGfwP1K7xi+mBD7DumhTJ+qD5KiCbG1RyywRGRz1KlyD0BCfOVhfcazZ0Mqq9M6vn70O+tMGJ4fzbyxaVXcc1ywTRSkjICF+Z38F1lTUHEg45sRF/uuaOqDLQGImx5MSZ0ub8FuXHRt4QQrU65//j8u3MAoAHdpvagf3uM/dhRwL2PuEWpjNrjHb1r0slJ3olTLJZoNvTIZ7fW/7s3s= 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: 53e33793-0836-46dc-1c58-08d62dca124f X-MS-Exchange-CrossTenant-originalarrivaltime: 09 Oct 2018 09:32:03.7005 (UTC) 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 v4 20/22] net/atlantic: LED control DPDK and private APIs 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: Tue, 09 Oct 2018 09:32:06 -0000 Signed-off-by: Igor Russkikh Signed-off-by: Pavel Belous --- drivers/net/atlantic/Makefile | 4 +++ drivers/net/atlantic/atl_ethdev.c | 53 +++++++++++++++++++++++++++++= ++++ drivers/net/atlantic/atl_ethdev.h | 3 ++ drivers/net/atlantic/meson.build | 3 ++ drivers/net/atlantic/rte_pmd_atlantic.c | 19 ++++++++++++ drivers/net/atlantic/rte_pmd_atlantic.h | 44 +++++++++++++++++++++++++++ 6 files changed, 126 insertions(+) create mode 100644 drivers/net/atlantic/rte_pmd_atlantic.c create mode 100644 drivers/net/atlantic/rte_pmd_atlantic.h diff --git a/drivers/net/atlantic/Makefile b/drivers/net/atlantic/Makefile index 62dcdbffa69c..6e821e013af9 100644 --- a/drivers/net/atlantic/Makefile +++ b/drivers/net/atlantic/Makefile @@ -31,5 +31,9 @@ SRCS-$(CONFIG_RTE_LIBRTE_ATLANTIC_PMD) +=3D hw_atl_utils.= c SRCS-$(CONFIG_RTE_LIBRTE_ATLANTIC_PMD) +=3D hw_atl_llh.c SRCS-$(CONFIG_RTE_LIBRTE_ATLANTIC_PMD) +=3D hw_atl_utils_fw2x.c SRCS-$(CONFIG_RTE_LIBRTE_ATLANTIC_PMD) +=3D hw_atl_b0.c +SRCS-$(CONFIG_RTE_LIBRTE_ATLANTIC_PMD) +=3D rte_pmd_atlantic.c + +# install this header file +SYMLINK-$(CONFIG_RTE_LIBRTE_ATLANTIC_PMD)-include :=3D rte_pmd_atlantic.h =20 include $(RTE_SDK)/mk/rte.lib.mk diff --git a/drivers/net/atlantic/atl_ethdev.c b/drivers/net/atlantic/atl_e= thdev.c index 323769db8087..fb23dc89f88c 100644 --- a/drivers/net/atlantic/atl_ethdev.c +++ b/drivers/net/atlantic/atl_ethdev.c @@ -69,6 +69,10 @@ 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 +/* LEDs */ +static int atl_dev_led_on(struct rte_eth_dev *dev); +static int atl_dev_led_off(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, @@ -276,6 +280,10 @@ 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 + /* LEDs */ + .dev_led_on =3D atl_dev_led_on, + .dev_led_off =3D atl_dev_led_off, + /* EEPROM */ .get_eeprom_length =3D atl_dev_get_eeprom_length, .get_eeprom =3D atl_dev_get_eeprom, @@ -1183,6 +1191,51 @@ atl_dev_interrupt_handler(void *param) atl_dev_interrupt_action(dev, dev->intr_handle); } =20 +/** + * LED ON Enables software controllable LED blinking. + * LED status then is independent of link status or traffic + */ +static int +atl_dev_led_on(struct rte_eth_dev *dev) +{ + struct aq_hw_s *hw =3D ATL_DEV_PRIVATE_TO_HW(dev->data->dev_private); + + if (hw->aq_fw_ops->led_control =3D=3D NULL) + return -ENOTSUP; + + return hw->aq_fw_ops->led_control(hw, + AQ_HW_LED_BLINK | + (AQ_HW_LED_BLINK << 2) | + (AQ_HW_LED_BLINK << 4)); +} + +/** + * LED OFF disables software controllable LED blinking + * LED is controlled by default logic and depends on link status and + * traffic activity + */ +static int +atl_dev_led_off(struct rte_eth_dev *dev) +{ + struct aq_hw_s *hw =3D ATL_DEV_PRIVATE_TO_HW(dev->data->dev_private); + + if (hw->aq_fw_ops->led_control =3D=3D NULL) + return -ENOTSUP; + + return hw->aq_fw_ops->led_control(hw, AQ_HW_LED_DEFAULT); +} + +int +atl_dev_led_control(struct rte_eth_dev *dev, int control) +{ + struct aq_hw_s *hw =3D ATL_DEV_PRIVATE_TO_HW(dev->data->dev_private); + + if (hw->aq_fw_ops->led_control =3D=3D NULL) + return -ENOTSUP; + + return hw->aq_fw_ops->led_control(hw, control); +} + #define SFP_EEPROM_SIZE 0xff =20 static int diff --git a/drivers/net/atlantic/atl_ethdev.h b/drivers/net/atlantic/atl_e= thdev.h index f0854e0f1d9f..538359ac3f6f 100644 --- a/drivers/net/atlantic/atl_ethdev.h +++ b/drivers/net/atlantic/atl_ethdev.h @@ -105,4 +105,7 @@ uint16_t atl_xmit_pkts(void *tx_queue, struct rte_mbuf = **tx_pkts, uint16_t atl_prep_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts); =20 +int +atl_dev_led_control(struct rte_eth_dev *dev, int control); + #endif /* _ATLANTIC_ETHDEV_H_ */ diff --git a/drivers/net/atlantic/meson.build b/drivers/net/atlantic/meson.= build index 28fb97cace6e..c6f39d8a7b0a 100644 --- a/drivers/net/atlantic/meson.build +++ b/drivers/net/atlantic/meson.build @@ -9,4 +9,7 @@ sources =3D files( 'hw_atl/hw_atl_llh.c', 'hw_atl/hw_atl_utils_fw2x.c', 'hw_atl/hw_atl_utils.c', + 'rte_pmd_atlantic.c', ) + +install_headers('rte_pmd_atlantic.h') diff --git a/drivers/net/atlantic/rte_pmd_atlantic.c b/drivers/net/atlantic= /rte_pmd_atlantic.c new file mode 100644 index 000000000000..4cb09baf2afc --- /dev/null +++ b/drivers/net/atlantic/rte_pmd_atlantic.c @@ -0,0 +1,19 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2018 Aquantia Corporation + */ + +#include + +#include "rte_pmd_atlantic.h" +#include "atl_ethdev.h" + +int rte_pmd_atl_dev_led_control(int port, int control) +{ + struct rte_eth_dev *dev; + + RTE_ETH_VALID_PORTID_OR_ERR_RET(port, -ENODEV); + + dev =3D &rte_eth_devices[port]; + + return atl_dev_led_control(dev, control); +} diff --git a/drivers/net/atlantic/rte_pmd_atlantic.h b/drivers/net/atlantic= /rte_pmd_atlantic.h new file mode 100644 index 000000000000..1c80330911a0 --- /dev/null +++ b/drivers/net/atlantic/rte_pmd_atlantic.h @@ -0,0 +1,44 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2018 Aquantia Corporation + */ + +/** + * @file rte_pmd_atlantic.h + * atlantic PMD specific functions. + * + **/ + +#ifndef _PMD_ATLANTIC_H_ +#define _PMD_ATLANTIC_H_ + +#include + +#define RTE_PMD_AQ_HW_LED_OFF 0x3U +#define RTE_PMD_AQ_HW_LED_BLINK 0x2U +#define RTE_PMD_AQ_HW_LED_ON 0x1U +#define RTE_PMD_AQ_HW_LED_DEFAULT 0x0U + +/** + * This is a custom API for adapter's LED controls. + * + * @param dev + * Ethernet device to apply control to + * @param control + * 6 bit value (3 leds each 2bit): + * - bits 0-1: LED0 control + * - bits 2-3: LED1 control + * - bits 4-5: LED2 control + * Each two bit control value is: + * - 0: Firmware manages this LED activity + * - 1: Permanent ON + * - 2: Blinking + * - 3: Permanent OFF + * + * @return + * - (0) if successful. + * - (-ENOTSUP) if hardware doesn't support. + */ +int rte_pmd_atl_dev_led_control(int port, int control); + + +#endif /* _PMD_ATLANTIC_H_ */ --=20 2.7.4