DPDK patches and discussions
 help / color / mirror / Atom feed
From: Wei Dai <wei.dai@intel.com>
To: dev@dpdk.org
Cc: helin.zhang@intel.com, konstantin.ananyev@intel.com,
	Wei Dai <wei.dai@intel.com>
Subject: [dpdk-dev] [PATCH v2 07/30] net/ixgbe/base: store link active LED
Date: Wed, 21 Dec 2016 17:47:51 +0800	[thread overview]
Message-ID: <1482313694-31602-8-git-send-email-wei.dai@intel.com> (raw)
In-Reply-To: <1482313694-31602-1-git-send-email-wei.dai@intel.com>

Add support to get the link active LED index via the LEDCTL register.
If the LEDCTL register does not have link active LED set then
use MAC default LED index.
Link active LED is used for adapter identify/blink support.

Signed-off-by: Wei Dai <wei.dai@intel.com>
---
 drivers/net/ixgbe/base/ixgbe_common.c | 45 +++++++++++++++++++++++++++++++++++
 drivers/net/ixgbe/base/ixgbe_common.h |  1 +
 drivers/net/ixgbe/base/ixgbe_type.h   |  2 ++
 3 files changed, 48 insertions(+)

diff --git a/drivers/net/ixgbe/base/ixgbe_common.c b/drivers/net/ixgbe/base/ixgbe_common.c
index a6016dc..89b4b5f 100644
--- a/drivers/net/ixgbe/base/ixgbe_common.c
+++ b/drivers/net/ixgbe/base/ixgbe_common.c
@@ -113,6 +113,7 @@ s32 ixgbe_init_ops_generic(struct ixgbe_hw *hw)
 	mac->ops.led_off = ixgbe_led_off_generic;
 	mac->ops.blink_led_start = ixgbe_blink_led_start_generic;
 	mac->ops.blink_led_stop = ixgbe_blink_led_stop_generic;
+	mac->ops.init_led_link_act = ixgbe_init_led_link_act_generic;
 
 	/* RAR, Multicast, VLAN */
 	mac->ops.set_rar = ixgbe_set_rar_generic;
@@ -497,6 +498,9 @@ s32 ixgbe_init_hw_generic(struct ixgbe_hw *hw)
 		status = hw->mac.ops.start_hw(hw);
 	}
 
+	/* Initialize the LED link active for LED blink support */
+	hw->mac.ops.init_led_link_act(hw);
+
 	return status;
 }
 
@@ -1136,6 +1140,47 @@ s32 ixgbe_stop_adapter_generic(struct ixgbe_hw *hw)
 }
 
 /**
+ *  ixgbe_init_led_link_act_generic - Store the LED index link/activity.
+ *  @hw: pointer to hardware structure
+ *
+ *  Store the index for the link active LED. This will be used to support
+ *  blinking the LED.
+ **/
+s32 ixgbe_init_led_link_act_generic(struct ixgbe_hw *hw)
+{
+	struct ixgbe_mac_info *mac = &hw->mac;
+	u32 led_reg, led_mode;
+	u16 i;
+
+	led_reg = IXGBE_READ_REG(hw, IXGBE_LEDCTL);
+
+	/* Get LED link active from the LEDCTL register */
+	for (i = 0; i < 4; i++) {
+		led_mode = led_reg >> IXGBE_LED_MODE_SHIFT(i);
+
+		if ((led_mode & IXGBE_LED_MODE_MASK_BASE) ==
+		     IXGBE_LED_LINK_ACTIVE) {
+			mac->led_link_act = i;
+			return IXGBE_SUCCESS;
+		}
+	}
+
+	/*
+	 * If LEDCTL register does not have the LED link active set, then use
+	 * known MAC defaults.
+	 */
+	switch (hw->mac.type) {
+	case ixgbe_mac_X550EM_a:
+	case ixgbe_mac_X550EM_x:
+		mac->led_link_act = 1;
+		break;
+	default:
+		mac->led_link_act = 2;
+	}
+	return IXGBE_SUCCESS;
+}
+
+/**
  *  ixgbe_led_on_generic - Turns on the software controllable LEDs.
  *  @hw: pointer to hardware structure
  *  @index: led number to turn on
diff --git a/drivers/net/ixgbe/base/ixgbe_common.h b/drivers/net/ixgbe/base/ixgbe_common.h
index ae28206..93e80ea 100644
--- a/drivers/net/ixgbe/base/ixgbe_common.h
+++ b/drivers/net/ixgbe/base/ixgbe_common.h
@@ -72,6 +72,7 @@ s32 ixgbe_stop_adapter_generic(struct ixgbe_hw *hw);
 
 s32 ixgbe_led_on_generic(struct ixgbe_hw *hw, u32 index);
 s32 ixgbe_led_off_generic(struct ixgbe_hw *hw, u32 index);
+s32 ixgbe_init_led_link_act_generic(struct ixgbe_hw *hw);
 
 s32 ixgbe_init_eeprom_params_generic(struct ixgbe_hw *hw);
 s32 ixgbe_write_eeprom_generic(struct ixgbe_hw *hw, u16 offset, u16 data);
diff --git a/drivers/net/ixgbe/base/ixgbe_type.h b/drivers/net/ixgbe/base/ixgbe_type.h
index 5b2506a..b90ae6d 100644
--- a/drivers/net/ixgbe/base/ixgbe_type.h
+++ b/drivers/net/ixgbe/base/ixgbe_type.h
@@ -3886,6 +3886,7 @@ struct ixgbe_mac_operations {
 	s32 (*led_off)(struct ixgbe_hw *, u32);
 	s32 (*blink_led_start)(struct ixgbe_hw *, u32);
 	s32 (*blink_led_stop)(struct ixgbe_hw *, u32);
+	s32 (*init_led_link_act)(struct ixgbe_hw *);
 
 	/* RAR, Multicast, VLAN */
 	s32 (*set_rar)(struct ixgbe_hw *, u32, u8 *, u32, u32);
@@ -4029,6 +4030,7 @@ struct ixgbe_mac_info {
 	struct ixgbe_dmac_config dmac_config;
 	bool set_lben;
 	u32  max_link_up_time;
+	u8   led_link_act;
 };
 
 struct ixgbe_phy_info {
-- 
2.7.4

  parent reply	other threads:[~2016-12-21  9:51 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-21  9:47 [dpdk-dev] [PATCH v2 00/30] update ixgbe shared code to version 16.11.21 Wei Dai
2016-12-21  9:47 ` [dpdk-dev] [PATCH v2 01/30] net/ixgbe/base: fix PHY reset check for x550em-ext Wei Dai
2016-12-21  9:47 ` [dpdk-dev] [PATCH v2 02/30] net/ixgbe/base: fix clearing SAN MAC address Wei Dai
2016-12-21  9:47 ` [dpdk-dev] [PATCH v2 03/30] net/ixgbe/base: use fast MDIO for non-10G devices Wei Dai
2016-12-21  9:47 ` [dpdk-dev] [PATCH v2 04/30] net/ixgbe/base: fix PHY identification for x550a Wei Dai
2016-12-21  9:47 ` [dpdk-dev] [PATCH v2 05/30] net/ixgbe/base: clean up X557 link status check Wei Dai
2016-12-21  9:47 ` [dpdk-dev] [PATCH v2 06/30] net/ixgbe/base: add driver version to firmware Wei Dai
2016-12-21  9:47 ` Wei Dai [this message]
2016-12-21  9:47 ` [dpdk-dev] [PATCH v2 08/30] net/ixgbe/base: cleanup X540 checksum calculation Wei Dai
2016-12-21  9:47 ` [dpdk-dev] [PATCH v2 09/30] net/ixgbe/base: enable LASI only for X552 devices Wei Dai
2016-12-21  9:47 ` [dpdk-dev] [PATCH v2 10/30] net/ixgbe/base: limit iXFI setup to " Wei Dai
2016-12-21  9:47 ` [dpdk-dev] [PATCH v2 11/30] net/ixgbe/base: fix getting PHY type for some x550 devices Wei Dai
2016-12-21  9:47 ` [dpdk-dev] [PATCH v2 12/30] net/ixgbe/base: fix SGMII link setup for M88 PHYs Wei Dai
2016-12-21  9:47 ` [dpdk-dev] [PATCH v2 13/30] net/ixgbe/base: cleanup dead EEE code Wei Dai
2016-12-21  9:47 ` [dpdk-dev] [PATCH v2 14/30] net/ixgbe/base: fix setting unsupported autoneg speeds Wei Dai
2016-12-21  9:47 ` [dpdk-dev] [PATCH v2 15/30] net/ixgbe/base: support FW commands to control some PHYs Wei Dai
2016-12-21  9:48 ` [dpdk-dev] [PATCH v2 16/30] net/ixgbe/base: use " Wei Dai
2016-12-21  9:48 ` [dpdk-dev] [PATCH v2 17/30] net/ixgbe/base: support busy SGMII register reads Wei Dai
2016-12-21  9:48 ` [dpdk-dev] [PATCH v2 18/30] net/ixgbe/base: include new speeds in VFLINK interpretation Wei Dai
2016-12-21  9:48 ` [dpdk-dev] [PATCH v2 19/30] net/ixgbe/base: limit 5Gb support to X550 devices Wei Dai
2016-12-21  9:48 ` [dpdk-dev] [PATCH v2 20/30] net/ixgbe/base: add physical layer options for FW PHY type Wei Dai
2016-12-21  9:48 ` [dpdk-dev] [PATCH v2 21/30] net/ixgbe/base: remove unneeded MAC type check Wei Dai
2016-12-21  9:48 ` [dpdk-dev] [PATCH v2 22/30] net/ixgbe/base: remove unused PHY ID Wei Dai
2016-12-21  9:48 ` [dpdk-dev] [PATCH v2 23/30] net/ixgbe/base: update FW PHY flow control Wei Dai
2016-12-21  9:48 ` [dpdk-dev] [PATCH v2 24/30] net/ixgbe/base: add EEE support for some PHYs Wei Dai
2016-12-21  9:48 ` [dpdk-dev] [PATCH v2 25/30] net/ixgbe/base: remove unused enum type Wei Dai
2016-12-21  9:48 ` [dpdk-dev] [PATCH v2 26/30] net/ixgbe/base: fix IXGBE LSWFW register Wei Dai
2016-12-21  9:48 ` [dpdk-dev] [PATCH v2 27/30] net/ixgbe/base: remove unused EEE code Wei Dai
2016-12-21  9:48 ` [dpdk-dev] [PATCH v2 28/30] net/ixgbe/base: add write flush required by Inphi PHY Wei Dai
2016-12-21  9:48 ` [dpdk-dev] [PATCH v2 29/30] net/ixgbe/base: report physical layer for SGMII PHY type Wei Dai
2016-12-21  9:48 ` [dpdk-dev] [PATCH v2 30/30] net/ixgbe/base: update shared code version to 2016.11.21 Wei Dai
2016-12-21 17:20 ` [dpdk-dev] [PATCH v2 00/30] update ixgbe shared code to version 16.11.21 Ferruh Yigit
2016-12-22  2:35   ` Dai, Wei

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=1482313694-31602-8-git-send-email-wei.dai@intel.com \
    --to=wei.dai@intel.com \
    --cc=dev@dpdk.org \
    --cc=helin.zhang@intel.com \
    --cc=konstantin.ananyev@intel.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).