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, Nadezhda.Krupnina@aquantia.com,
	igor.russkikh@aquantia.com, Simon.Edelhaus@aquantia.com,
	Corey Melton <comelton@cisco.com>,
	Ashish Kumar <ashishk2@cisco.com>
Subject: [dpdk-dev] [PATCH 15/21] net/atlantic: LED control DPDK and private APIs
Date: Fri,  7 Sep 2018 18:21:53 +0300	[thread overview]
Message-ID: <1536333719-32155-16-git-send-email-igor.russkikh@aquantia.com> (raw)
In-Reply-To: <1536333719-32155-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       | 52 +++++++++++++++++++++++++++++++++
 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, 124 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 d70ee4380..4b0e6f06c 100644
--- a/drivers/net/atlantic/Makefile
+++ b/drivers/net/atlantic/Makefile
@@ -55,5 +55,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 fe1560923..00e686639 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, struct rte_dev_eeprom_info *eeprom);
@@ -184,6 +189,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,
@@ -856,6 +866,48 @@ 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..34f063ea4
--- /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..7c0a6a214
--- /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-07 15:23 UTC|newest]

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

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=1536333719-32155-16-git-send-email-igor.russkikh@aquantia.com \
    --to=igor.russkikh@aquantia.com \
    --cc=Nadezhda.Krupnina@aquantia.com \
    --cc=Simon.Edelhaus@aquantia.com \
    --cc=ashishk2@cisco.com \
    --cc=comelton@cisco.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).