From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM01-SN1-obe.outbound.protection.outlook.com (mail-sn1nam01on0075.outbound.protection.outlook.com [104.47.32.75]) by dpdk.org (Postfix) with ESMTP id 6444F8D86 for ; Thu, 13 Sep 2018 13:36:08 +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=zA1SbrH0RXBFuE2MGJ5scRYF4+ODv2mCInd4sJ0jf74=; b=pXajzdtlVwsJDzAmf8bq9Nwfe88HTzCwstfyBxSuXaeo5/kjPUFn77qPpdJEvXwAY0P62obVpE3tzGxANwOYXLUe3D1tTozXT2EXaLQv7l+EpxjcZsjvVd9tkm4TqQwUJQHkfI7EIwJV6C0DsIVVcxpNTJQhVuWyGmm8tDO9rzc= 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:06 +0000 From: Igor Russkikh To: dev@dpdk.org Cc: pavel.belous@aquantia.com, igor.russkikh@aquantia.com Date: Thu, 13 Sep 2018 14:35:22 +0300 Message-Id: <1536838528-11800-15-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: 07447e02-b68b-40d1-bc59-08d6196d1865 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:BAA7i2YTpaEgk6PJSDWr4o0MYhdmUdippq6lEuJrtrHTiJQGK0EC+FeQf0N2UpN9D58G6rUoDZVrrjx0JMRdBc1Ez0beYqkJ3OYkEoL6WaVWGvn9UDZT3FbhTQyYkv6Eihw8xl/crVQHI/IgivqGiwotuYWxzBsd2ZWcEspPZaICn55GG9b6f5HzJxhfxqK6YQIgbhmWanrsYAW0RKyD9HRbpchCQ3MGzic1h5v52M3uEHKdYnZPUeqzBsDAPGFn; 25:dpOxr3rSGb+7A093Dk7Pq7FNlA0d29jLGz7eqkNjGPcn5g/w0F9hW17DMTX5ZrRDcGdh0p1N28wgDkxdL5q+TS0AbCQcHMEG3qVNVYduhAvLo/CFUe8V5N8VavWA3UteuCss/zAAUstI+97OoiTNfLBAcumiBZ8Wj3iAo9pOdxUPyF2zr+A3oJzpW0f96TMEglaTM0CLPKKBfEef7u3dIyqhXN0/Hct58ohVVJdg4RpQ5nNgJ256U8wkeAA4gcwaqqnocOZSwX8Ng9/ePdOTsIFPsC5IZT4GwV/R5+fyQ3cVQ44DDp9wg0ojq4RGBReIF8Zbfn7//LtH0cHc561HHA==; 31:xKoOhlkIv/lqqIqvwM9l6hqyf6TzAzmzQTPVRxfCsEinodWdBrPFZXflS7TdP4eYUrrdRVCqbsU6WVBF/klhax2tEe7v2NKSBsAj51EGliQMT9pkUzXZVW+puL1+yUtQ0L+jm8mP7r3RTjZEPbhYb90SU+sz6862TrafcFa3Dqr4QkIabATZqmhiDH4q7lLWh2vUF8vizt2Po+nbV7hneUE+yYr5dT67rrYINRwUGMc= X-MS-TrafficTypeDiagnostic: BLUPR0701MB1650: X-Microsoft-Exchange-Diagnostics: 1; BLUPR0701MB1650; 20:1nDUj50/pBdAR+pu5FfnzkbmjEMu6C4jdfOjDg2z94YiUxPblc7OyvUbl1uO4hFbV5gEaw4V9F0VGvvl9TsVbIErdSfVRwPhjU420bdKpQGoH6fZFoCLoYXUwBFe+vivwUhSlQDBM2kzXUdZo1crVREvBTodFdxANs6+t+HS6wDXFenRuWgqBq56XaiCMrgDow0TGIgI90BhNnfoMwnLBbfUJVmULWf0zcx/XEmWjrlrECGoN+hK+o323XSe9gaIk25ffmAy5zNFyUYUdhwtO8kA7YP9rwP/918Ne4ruLxDDvy5lKrl+aAZ5YhFUvHalOb4YkDeU0DI8sxyAIjvJ6KYvd7yMzYfKEQwWsF60iw+5kdh//NCIzoxKc2ADozECRq6H3H2zN3jnskI/79qJaUgWgPtg4URcIPptRAhNLsQbRS0I/bP6BULEDy163fXXuL0+07VRK2eBvo42r2D6nCJvE4sE59fKq4C4FytIboGjRpgRmiaPHD+/Y6QOQZ1M; 4:UNQd0L5JVh/0dMFMESf33PsanR9PRwJ4PYGMZcoWkLqYmMQj3Veq7pXo1HvFB6gKhGR4/d3iiLCFmkPZk6i8avHgsXB9uKB3OGridKAjal++JjkkBIGp0/AYC6ZEXEyHo28+4WWmJMB5DiStOCpyDDyB8BUTV61ukl1BaurJ0sa2UZ5Zok7kv57FHQYiWSkOw/BFmz/Ayt5+ZFAye72QFWk30E+B/x6kOq742ZgAsYiiNcsyTiKcDBYD39DA+hApY/1sTIin/6sp0EAeoSg0hQ== 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)(575784001)(316002)(52116002)(8676002)(16586007)(7736002)(305945005)(11346002)(446003)(476003)(956004)(47776003)(72206003)(66066001)(44832011)(478600001)(486006)(186003)(26005)(16526019)(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:1YMF5t5KwR436xTfpPhly90SaAxfmKaPYqwJrFf?= =?us-ascii?Q?dNfWs03K/iTBQkcsDHKgBJI4DXGgBcTRAzBdHCqyVi0WtjmuDGWYAimu4xr5?= =?us-ascii?Q?uh+xH8YNpQeW+aL6VyNvspao2R0i1t6ERGEw3jc4f6EmZn15NMNuG1ebgy8H?= =?us-ascii?Q?Ms10YkYbYgqeUsJCicDqLjJrb5h3wigWUTrHHCiISnDLiRmzGGtAPUmBnGwW?= =?us-ascii?Q?MrWg+o3r8v2nQCNSxasuVxoHujtrsBcD7bkjzQgFTD45GeQEzWtXLdRQd2JD?= =?us-ascii?Q?zeEMytkw/HL5juJaqKhD7le4KxL28slx2hlzJZ/ZVO/QqCPXGsVzKQj6F5o+?= =?us-ascii?Q?O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TexkdepVI8GAF9Iw7wu6beYnlsqs+f0ylDUcGNDxq5Sm3xlh6fYxM0AumDYom4wzij+/j9tytVndVmk=; 7:BXOy8r5+xTlBrNS6qXh73VIuqlRzD7dvidJIQzdoii4esme8No28Ce2njzPrYqyQiFRgeRCthett/3GT9656U5Vc6yR0PyzcZ/EG1OzCi7kh1fFBskwijjmWSPI50YXAkWoMYnNoQCK9Pn7RR+86vNBNHcPmMSa7YToEJzDjVeg5qx3G96C3rhwSaMiZSH1MDI51KldlOKb613TePmi7L61UFSufEvd6I+DrTpcq7LKfi/dh5dDyicinF7m8Bmsd SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: aquantia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Sep 2018 11:36:06.2026 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 07447e02-b68b-40d1-bc59-08d6196d1865 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 15/21] 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: Thu, 13 Sep 2018 11:36:09 -0000 Signed-off-by: Igor Russkikh --- drivers/net/atlantic/Makefile | 4 +++ drivers/net/atlantic/atl_ethdev.c | 55 +++++++++++++++++++++++++++++++++ drivers/net/atlantic/atl_ethdev.h | 2 ++ 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, 127 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 9e3c17ac9..8af64d082 100644 --- a/drivers/net/atlantic/Makefile +++ b/drivers/net/atlantic/Makefile @@ -32,5 +32,9 @@ VPATH += $(SRCDIR)/hw_atl # all source are stored in SRCS-y # SRCS-$(CONFIG_RTE_LIBRTE_ATLANTIC_PMD) += atl_ethdev.c +SRCS-$(CONFIG_RTE_LIBRTE_ATLANTIC_PMD) += rte_pmd_atlantic.c + +# install this header file +SYMLINK-$(CONFIG_RTE_LIBRTE_ATLANTIC_PMD)-include := rte_pmd_atlantic.h include $(RTE_SDK)/mk/rte.lib.mk diff --git a/drivers/net/atlantic/atl_ethdev.c b/drivers/net/atlantic/atl_ethdev.c index c16d179fd..08f1a07c8 100644 --- a/drivers/net/atlantic/atl_ethdev.c +++ b/drivers/net/atlantic/atl_ethdev.c @@ -66,6 +66,11 @@ 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); + +/* 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, @@ -188,6 +193,11 @@ static const struct eth_dev_ops atl_eth_dev_ops = { .get_reg = atl_dev_get_regs, + + /* LEDs */ + .dev_led_on = atl_dev_led_on, + .dev_led_off = atl_dev_led_off, + /* EEPROM */ .get_eeprom_length = atl_dev_get_eeprom_length, .get_eeprom = atl_dev_get_eeprom, @@ -866,6 +876,51 @@ atl_dev_interrupt_handler(void *param) atl_dev_interrupt_action(dev, dev->intr_handle); } +/** + * 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 = ATL_DEV_PRIVATE_TO_HW(dev->data->dev_private); + + if (hw->aq_fw_ops->led_control == 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 = ATL_DEV_PRIVATE_TO_HW(dev->data->dev_private); + + if (hw->aq_fw_ops->led_control == 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 = ATL_DEV_PRIVATE_TO_HW(dev->data->dev_private); + + if (hw->aq_fw_ops->led_control == NULL) + return -ENOTSUP; + + return hw->aq_fw_ops->led_control(hw, control); +} + #define SFP_EEPROM_SIZE 0xff static int diff --git a/drivers/net/atlantic/atl_ethdev.h b/drivers/net/atlantic/atl_ethdev.h index ce4bc9544..3ebef1f43 100644 --- a/drivers/net/atlantic/atl_ethdev.h +++ b/drivers/net/atlantic/atl_ethdev.h @@ -46,4 +46,6 @@ struct atl_adapter { #define ATL_DEV_PRIVATE_TO_CFG(adapter) \ (&((struct atl_adapter *)adapter)->hw_cfg) +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 187ca9808..19fa41cd3 100644 --- a/drivers/net/atlantic/meson.build +++ b/drivers/net/atlantic/meson.build @@ -5,6 +5,7 @@ sources = files( 'atl_ethdev.c', + 'rte_pmd_atlantic.c', ) deps += ['hash', 'eal'] @@ -17,3 +18,5 @@ if get_option('buildtype') == 'debug' endif allow_experimental_apis = true + +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 000000000..4cb09baf2 --- /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 = &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 000000000..1c8033091 --- /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_ */ -- 2.13.3.windows.1