DPDK patches and discussions
 help / color / mirror / Atom feed
From: Igor Russkikh <igor.russkikh@aquantia.com>
To: dev@dpdk.org
Cc: pavel.belous@aquantia.com, igor.russkikh@aquantia.com
Subject: [dpdk-dev] [PATCH v2 15/21] net/atlantic: LED control DPDK and private APIs
Date: Thu, 13 Sep 2018 14:35:22 +0300	[thread overview]
Message-ID: <1536838528-11800-15-git-send-email-igor.russkikh@aquantia.com> (raw)
In-Reply-To: <1536838528-11800-1-git-send-email-igor.russkikh@aquantia.com>

Signed-off-by: Igor Russkikh <igor.russkikh@aquantia.com>
---
 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 <rte_ethdev_driver.h>
+
+#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 <rte_ethdev_driver.h>
+
+#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

  parent reply	other threads:[~2018-09-13 11:36 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-13 11:35 [dpdk-dev] [PATCH v2 01/21] net/atlantic: atlantic PMD driver skeleton Igor Russkikh
2018-09-13 11:35 ` [dpdk-dev] [PATCH v2 02/21] net/atlantic: documentation and rel notes Igor Russkikh
2018-09-13 11:35 ` [dpdk-dev] [PATCH v2 03/21] net/atlantic: logging macroes and some typedefs Igor Russkikh
2018-09-13 11:35 ` [dpdk-dev] [PATCH v2 04/21] net/atlantic: hw_atl register declarations Igor Russkikh
2018-09-13 11:35 ` [dpdk-dev] [PATCH v2 05/21] net/atlantic: b0 hardware layer main logic Igor Russkikh
2018-09-13 11:35 ` [dpdk-dev] [PATCH v2 06/21] net/atlantic: firmware operations layer Igor Russkikh
2018-09-13 11:35 ` [dpdk-dev] [PATCH v2 07/21] net/atlantic: hardware register access routines Igor Russkikh
2018-09-13 11:35 ` [dpdk-dev] [PATCH v2 08/21] net/atlantic: rte device start, stop, initial configuration Igor Russkikh
2018-09-13 11:35 ` [dpdk-dev] [PATCH v2 09/21] net/atlantic: link status and interrupt management Igor Russkikh
2018-09-13 11:35 ` [dpdk-dev] [PATCH v2 10/21] net/atlantic: add hw adapter structures and defines Igor Russkikh
2018-09-13 11:35 ` [dpdk-dev] [PATCH v2 11/21] net/atlantic: RSS and RETA manipulation API Igor Russkikh
2018-09-13 11:35 ` [dpdk-dev] [PATCH v2 12/21] net/atlantic: flow control configuration Igor Russkikh
2018-09-13 11:35 ` [dpdk-dev] [PATCH v2 13/21] net/atlantic: MAC address manipulations Igor Russkikh
2018-09-13 11:35 ` [dpdk-dev] [PATCH v2 14/21] net/atlantic: eeprom and register manipulation routines Igor Russkikh
2018-09-13 11:35 ` Igor Russkikh [this message]
2018-09-13 11:35 ` [dpdk-dev] [PATCH v2 16/21] net/atlantic: promisc and allmulti configuration Igor Russkikh
2018-09-13 11:35 ` [dpdk-dev] [PATCH v2 17/21] net/atlantic: device statistics, xstats Igor Russkikh
2018-09-13 11:35 ` [dpdk-dev] [PATCH v2 18/21] net/atlantic: VLAN filters and offloads Igor Russkikh
2018-09-13 11:35 ` [dpdk-dev] [PATCH v2 19/21] net/atlantic: device MTU and statuses Igor Russkikh
2018-09-13 11:35 ` [dpdk-dev] [PATCH v2 20/21] net/atlantic: RX side structures and implementation Igor Russkikh
2018-09-13 11:35 ` [dpdk-dev] [PATCH v2 21/21] net/atlantic: TX " Igor Russkikh
2018-09-21 14:21 ` [dpdk-dev] [PATCH v2 01/21] net/atlantic: atlantic PMD driver skeleton Ferruh Yigit
2018-09-21 15:35   ` Igor Russkikh
2018-09-21 17:04     ` Ferruh Yigit

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1536838528-11800-15-git-send-email-igor.russkikh@aquantia.com \
    --to=igor.russkikh@aquantia.com \
    --cc=dev@dpdk.org \
    --cc=pavel.belous@aquantia.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).