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,
	Pavel Belous <Pavel.Belous@aquantia.com>
Subject: [dpdk-dev] [PATCH v3 20/22] net/atlantic: LED control DPDK and private APIs
Date: Sat, 29 Sep 2018 13:30:34 +0300	[thread overview]
Message-ID: <1385c7733c0ad133b20b424957ac26662ecc8df7.1538215990.git.igor.russkikh@aquantia.com> (raw)
In-Reply-To: <cover.1538215990.git.igor.russkikh@aquantia.com>

Signed-off-by: Igor Russkikh <igor.russkikh@aquantia.com>
Signed-off-by: Pavel Belous <Pavel.Belous@aquantia.com>
---
 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) += hw_atl_utils.c
 SRCS-$(CONFIG_RTE_LIBRTE_ATLANTIC_PMD) += hw_atl_llh.c
 SRCS-$(CONFIG_RTE_LIBRTE_ATLANTIC_PMD) += hw_atl_utils_fw2x.c
 SRCS-$(CONFIG_RTE_LIBRTE_ATLANTIC_PMD) += hw_atl_b0.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 b3a19f96e8c8..90ab8d9c0b1d 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);
 
+/* 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,
@@ -273,6 +277,10 @@ static const struct eth_dev_ops atl_eth_dev_ops = {
 	.rx_descriptor_status = atl_dev_rx_descriptor_status,
 	.tx_descriptor_status = atl_dev_tx_descriptor_status,
 
+	/* 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,
@@ -1183,6 +1191,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 69612a016089..51d6042088c7 100644
--- a/drivers/net/atlantic/atl_ethdev.h
+++ b/drivers/net/atlantic/atl_ethdev.h
@@ -104,4 +104,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);
 
+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 7575e471e306..8e992f2406f6 100644
--- a/drivers/net/atlantic/meson.build
+++ b/drivers/net/atlantic/meson.build
@@ -11,8 +11,11 @@ sources = files(
 	'hw_atl/hw_atl_llh.c',
 	'hw_atl/hw_atl_utils_fw2x.c',
 	'hw_atl/hw_atl_utils.c',
+	'rte_pmd_atlantic.c',
 )
 
 deps += ['eal']
 
 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 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 <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 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 <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.7.4

  parent reply	other threads:[~2018-09-29 10:32 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-29 10:30 [dpdk-dev] [PATCH v3 00/22] net/atlantic: Aquantia aQtion 10G NIC Family DPDK PMD driver Igor Russkikh
2018-09-29 10:30 ` [dpdk-dev] [PATCH v3 01/22] net/atlantic: atlantic PMD driver skeleton Igor Russkikh
2018-10-03 18:48   ` Ferruh Yigit
2018-09-29 10:30 ` [dpdk-dev] [PATCH v3 02/22] net/atlantic: logging macroes and some typedefs Igor Russkikh
2018-10-03 18:49   ` Ferruh Yigit
2018-09-29 10:30 ` [dpdk-dev] [PATCH v3 03/22] net/atlantic: hardware register access routines Igor Russkikh
2018-09-29 10:30 ` [dpdk-dev] [PATCH v3 04/22] net/atlantic: hw_atl register declarations Igor Russkikh
2018-09-29 10:30 ` [dpdk-dev] [PATCH v3 05/22] net/atlantic: firmware operations layer Igor Russkikh
2018-09-29 10:30 ` [dpdk-dev] [PATCH v3 06/22] net/atlantic: b0 hardware layer main logic Igor Russkikh
2018-09-29 10:30 ` [dpdk-dev] [PATCH v3 07/22] net/atlantic: rte device start, stop, initial configuration Igor Russkikh
2018-09-29 10:30 ` [dpdk-dev] [PATCH v3 08/22] net/atlantic: TX/RX function prototypes Igor Russkikh
2018-09-29 10:30 ` [dpdk-dev] [PATCH v3 09/22] net/atlantic: RX side structures and implementation Igor Russkikh
2018-09-29 10:30 ` [dpdk-dev] [PATCH v3 10/22] net/atlantic: TX " Igor Russkikh
2018-09-29 10:30 ` [dpdk-dev] [PATCH v3 11/22] net/atlantic: link status and interrupt management Igor Russkikh
2018-09-29 10:30 ` [dpdk-dev] [PATCH v3 12/22] net/atlantic: device statistics, xstats Igor Russkikh
2018-09-29 10:30 ` [dpdk-dev] [PATCH v3 13/22] net/atlantic: support for RX/TX descriptors information Igor Russkikh
2018-09-29 10:30 ` [dpdk-dev] [PATCH v3 14/22] net/atlantic: promisc and allmulti configuration Igor Russkikh
2018-09-29 10:30 ` [dpdk-dev] [PATCH v3 15/22] net/atlantic: RSS and RETA manipulation API Igor Russkikh
2018-09-29 10:30 ` [dpdk-dev] [PATCH v3 16/22] net/atlantic: flow control configuration Igor Russkikh
2018-09-29 10:30 ` [dpdk-dev] [PATCH v3 17/22] net/atlantic: MAC address manipulations Igor Russkikh
2018-09-29 10:30 ` [dpdk-dev] [PATCH v3 18/22] net/atlantic: VLAN filters and offloads Igor Russkikh
2018-09-29 10:30 ` [dpdk-dev] [PATCH v3 19/22] net/atlantic: eeprom and register manipulation routines Igor Russkikh
2018-09-29 10:30 ` Igor Russkikh [this message]
2018-09-29 10:30 ` [dpdk-dev] [PATCH v3 21/22] net/atlantic: support for read MAC registers for debug purposes Igor Russkikh
2018-09-29 10:30 ` [dpdk-dev] [PATCH v3 22/22] net/atlantic: documentation and rel notes Igor Russkikh
2018-10-03 18:47 ` [dpdk-dev] [PATCH v3 00/22] net/atlantic: Aquantia aQtion 10G NIC Family DPDK PMD driver Ferruh Yigit
2018-10-04  9:42   ` Igor Russkikh
2018-10-04 10:29     ` 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=1385c7733c0ad133b20b424957ac26662ecc8df7.1538215990.git.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).