All of lore.kernel.org
 help / color / mirror / Atom feed
From: Helin Zhang <helin.zhang-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
To: dev-VfR2kkLFssw@public.gmane.org
Cc: monica.kenguva-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org,
	steven.j.murray-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org,
	shannon.nelson-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org
Subject: [PATCH v2 22/33] i40e/base: update of get/set LED functions
Date: Thu, 30 Apr 2015 23:03:28 +0800	[thread overview]
Message-ID: <1430406219-23901-23-git-send-email-helin.zhang@intel.com> (raw)
In-Reply-To: <1430406219-23901-1-git-send-email-helin.zhang-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>

As it is requried to blink the LEDs only, it should ignore the
activity LEDs. Also a fix is added to clear the GPIO blink field
specifically.

Signed-off-by: Helin Zhang <helin.zhang-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
---
 lib/librte_pmd_i40e/i40e/i40e_common.c | 37 +++++++++++++++++++++++++++++++---
 1 file changed, 34 insertions(+), 3 deletions(-)

diff --git a/lib/librte_pmd_i40e/i40e/i40e_common.c b/lib/librte_pmd_i40e/i40e/i40e_common.c
index c2c14eb..e58d50d 100644
--- a/lib/librte_pmd_i40e/i40e/i40e_common.c
+++ b/lib/librte_pmd_i40e/i40e/i40e_common.c
@@ -1073,8 +1073,11 @@ static u32 i40e_led_is_mine(struct i40e_hw *hw, int idx)
 	return gpio_val;
 }
 
-#define I40E_LED0 22
+#define I40E_COMBINED_ACTIVITY 0xA
+#define I40E_FILTER_ACTIVITY 0xE
 #define I40E_LINK_ACTIVITY 0xC
+#define I40E_MAC_ACTIVITY 0xD
+#define I40E_LED0 22
 
 /**
  * i40e_led_get - return current on/off mode
@@ -1087,6 +1090,7 @@ static u32 i40e_led_is_mine(struct i40e_hw *hw, int idx)
  **/
 u32 i40e_led_get(struct i40e_hw *hw)
 {
+	u32 current_mode = 0;
 	u32 mode = 0;
 	int i;
 
@@ -1099,6 +1103,18 @@ u32 i40e_led_get(struct i40e_hw *hw)
 		if (!gpio_val)
 			continue;
 
+		/* ignore gpio LED src mode entries related to the activity LEDs */
+		current_mode = ((gpio_val & I40E_GLGEN_GPIO_CTL_LED_MODE_MASK) >>
+			I40E_GLGEN_GPIO_CTL_LED_MODE_SHIFT);
+		switch (current_mode) {
+		case I40E_COMBINED_ACTIVITY:
+		case I40E_FILTER_ACTIVITY:
+		case I40E_MAC_ACTIVITY:
+			continue;
+		default:
+			break;
+		}
+
 		mode = (gpio_val & I40E_GLGEN_GPIO_CTL_LED_MODE_MASK) >>
 			I40E_GLGEN_GPIO_CTL_LED_MODE_SHIFT;
 		break;
@@ -1118,6 +1134,7 @@ u32 i40e_led_get(struct i40e_hw *hw)
  **/
 void i40e_led_set(struct i40e_hw *hw, u32 mode, bool blink)
 {
+	u32 current_mode = 0;
 	int i;
 
 	if (mode & 0xfffffff0)
@@ -1132,6 +1149,18 @@ void i40e_led_set(struct i40e_hw *hw, u32 mode, bool blink)
 		if (!gpio_val)
 			continue;
 
+		/* ignore gpio LED src mode entries related to the activity LEDs */
+		current_mode = ((gpio_val & I40E_GLGEN_GPIO_CTL_LED_MODE_MASK) >>
+			I40E_GLGEN_GPIO_CTL_LED_MODE_SHIFT);
+		switch (current_mode) {
+		case I40E_COMBINED_ACTIVITY:
+		case I40E_FILTER_ACTIVITY:
+		case I40E_MAC_ACTIVITY:
+			continue;
+		default:
+			break;
+		}
+
 		gpio_val &= ~I40E_GLGEN_GPIO_CTL_LED_MODE_MASK;
 		/* this & is a bit of paranoia, but serves as a range check */
 		gpio_val |= ((mode << I40E_GLGEN_GPIO_CTL_LED_MODE_SHIFT) &
@@ -1140,8 +1169,10 @@ void i40e_led_set(struct i40e_hw *hw, u32 mode, bool blink)
 		if (mode == I40E_LINK_ACTIVITY)
 			blink = false;
 
-		gpio_val |= (blink ? 1 : 0) <<
-			    I40E_GLGEN_GPIO_CTL_LED_BLINK_SHIFT;
+		if (blink)
+			gpio_val |= (1 << I40E_GLGEN_GPIO_CTL_LED_BLINK_SHIFT);
+		else
+			gpio_val &= ~(1 << I40E_GLGEN_GPIO_CTL_LED_BLINK_SHIFT);
 
 		wr32(hw, I40E_GLGEN_GPIO_CTL(i), gpio_val);
 		break;
-- 
1.8.1.4

  parent reply	other threads:[~2015-04-30 15:03 UTC|newest]

Thread overview: 72+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-20  8:22 [PATCH 00/18] i40e base driver update Helin Zhang
     [not found] ` <1429518150-28098-1-git-send-email-helin.zhang-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2015-04-20  8:22   ` [PATCH 01/18] i40e: copyright update Helin Zhang
2015-04-20  8:22   ` [PATCH 02/18] i40e: disable setting phy configuration Helin Zhang
2015-04-20  8:22   ` [PATCH 03/18] i40e: adjustment of register definitions and relevant Helin Zhang
     [not found]     ` <1429518150-28098-4-git-send-email-helin.zhang-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2015-04-27 17:16       ` Thomas Monjalon
2015-04-28  2:29         ` Zhang, Helin
2015-04-20  8:22   ` [PATCH 04/18] i40e: support of CEE DCBX on recent firmware versions Helin Zhang
2015-04-20  8:22   ` [PATCH 05/18] i40e: rework of 'i40e_hmc_get_object_va' Helin Zhang
2015-04-20  8:22   ` [PATCH 06/18] i40e: support of Fortpark device IDs and mac types Helin Zhang
2015-04-20  8:22   ` [PATCH 07/18] i40e: rename 'err' to 'perrno' Helin Zhang
2015-04-20  8:22   ` [PATCH 08/18] i40e: support NVM read on Fortpark, with minor enhancements Helin Zhang
2015-04-20  8:22   ` [PATCH 09/18] i40e: adminq enhancements Helin Zhang
2015-04-20  8:22   ` [PATCH 10/18] i40e: support of firmware build number Helin Zhang
2015-04-20  8:22   ` [PATCH 11/18] i40e: support of building both PF and VF driver together Helin Zhang
     [not found]     ` <1429518150-28098-12-git-send-email-helin.zhang-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2015-04-27 17:25       ` Thomas Monjalon
2015-04-28  2:33         ` Zhang, Helin
2015-04-20  8:22   ` [PATCH 12/18] i40e: enhancements of AQ commands and common interfaces Helin Zhang
     [not found]     ` <1429518150-28098-13-git-send-email-helin.zhang-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2015-04-27 17:26       ` Thomas Monjalon
2015-04-28  2:34         ` Zhang, Helin
2015-04-20  8:22   ` [PATCH 13/18] i40e: replacement of 'i40e_debug_read_register()' Helin Zhang
     [not found]     ` <1429518150-28098-14-git-send-email-helin.zhang-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2015-04-27 17:28       ` Thomas Monjalon
2015-04-28  2:34         ` Zhang, Helin
2015-04-20  8:22   ` [PATCH 14/18] i40e: add new interfaces of AQ commands and relevant Helin Zhang
2015-04-20  8:22   ` [PATCH 15/18] i40e: support of Fortpark FPGA Helin Zhang
2015-04-20  8:22   ` [PATCH 16/18] i40e: add more virtual channel operations Helin Zhang
2015-04-20  8:22   ` [PATCH 17/18] i40e: support of structure and command length check Helin Zhang
2015-04-20  8:22   ` [PATCH 18/18] i40e: Minor enhancements in i40e_type.h Helin Zhang
2015-04-22  7:26   ` [PATCH 00/18] i40e base driver update Cao, Min
2015-04-30 15:03   ` [PATCH v2 00/33] " Helin Zhang
     [not found]     ` <1430406219-23901-1-git-send-email-helin.zhang-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2015-04-30 15:03       ` [PATCH v2 01/33] i40e: copyright update Helin Zhang
     [not found]         ` <1430406219-23901-2-git-send-email-helin.zhang-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2015-05-08  3:22           ` Wu, Jingjing
2015-04-30 15:03       ` [PATCH v2 02/33] i40e: disable setting of phy configuration Helin Zhang
     [not found]         ` <1430406219-23901-3-git-send-email-helin.zhang-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2015-05-08  3:22           ` Wu, Jingjing
2015-04-30 15:03       ` [PATCH v2 03/33] i40e: adjustment of register definitions and relevant Helin Zhang
     [not found]         ` <1430406219-23901-4-git-send-email-helin.zhang-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2015-05-08  3:21           ` Wu, Jingjing
2015-04-30 15:03       ` [PATCH v2 04/33] i40e/base: rename 'err' to 'perrno' Helin Zhang
     [not found]         ` <1430406219-23901-5-git-send-email-helin.zhang-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2015-05-08  3:20           ` Wu, Jingjing
2015-04-30 15:03       ` [PATCH v2 05/33] i40e/base: support of building both PF and VF driver together Helin Zhang
     [not found]         ` <1430406219-23901-6-git-send-email-helin.zhang-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2015-05-08  3:25           ` Wu, Jingjing
2015-04-30 15:03       ` [PATCH v2 06/33] i40e/base: support of CEE DCBX on recent firmware versions Helin Zhang
2015-04-30 15:03       ` [PATCH v2 07/33] i40e: replacement of 'i40e_debug_read_register()' Helin Zhang
     [not found]         ` <1430406219-23901-8-git-send-email-helin.zhang-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2015-05-08  3:23           ` Wu, Jingjing
2015-04-30 15:03       ` [PATCH v2 08/33] i40e/base: rework of 'i40e_hmc_get_object_va' Helin Zhang
2015-04-30 15:03       ` [PATCH v2 09/33] i40e/base: update of shadow RAM read/write functions Helin Zhang
2015-04-30 15:03       ` [PATCH v2 10/33] i40e/base: catch NVM write semaphore timeout and retry Helin Zhang
2015-04-30 15:03       ` [PATCH v2 11/33] i40e/base: check for AQ timeout in aq_rc decode Helin Zhang
2015-04-30 15:03       ` [PATCH v2 12/33] i40e/base: fix up NVM update sm error handling Helin Zhang
2015-04-30 15:03       ` [PATCH v2 13/33] i40e/base: enhancement of polling NVM semaphore Helin Zhang
2015-04-30 15:03       ` [PATCH v2 14/33] i40e/base: enhancements of NVM checksum calculation Helin Zhang
2015-04-30 15:03       ` [PATCH v2 15/33] i40e/base: replacement of DEBUGOUT() with i40e_debug() Helin Zhang
     [not found]         ` <1430406219-23901-16-git-send-email-helin.zhang-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2015-05-08  3:24           ` Wu, Jingjing
2015-04-30 15:03       ` [PATCH v2 16/33] i40e/base: add fw build info to AQ data Helin Zhang
2015-04-30 15:03       ` [PATCH v2 17/33] i40e/base: define and use i40e_is_vf() Helin Zhang
2015-04-30 15:03       ` [PATCH v2 18/33] i40e/base: grab NVM devstarter version not image version Helin Zhang
2015-04-30 15:03       ` [PATCH v2 19/33] i40e/base: enhancements on adminq init and sending asq command Helin Zhang
2015-04-30 15:03       ` [PATCH v2 20/33] i40e/base: i40e_aq_get_link_info() should be used directly Helin Zhang
2015-04-30 15:03       ` [PATCH v2 21/33] i40e/base: add new interfaces for future use Helin Zhang
2015-04-30 15:03       ` Helin Zhang [this message]
2015-04-30 15:03       ` [PATCH v2 23/33] i40e/base: clean up sparse complaint in i40e_debug_aq Helin Zhang
2015-04-30 15:03       ` [PATCH v2 24/33] i40e/base: get pf_id from HW rather than PCI function Helin Zhang
     [not found]         ` <1430406219-23901-25-git-send-email-helin.zhang-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2015-05-08  3:20           ` Wu, Jingjing
2015-04-30 15:03       ` [PATCH v2 25/33] i40e/base: find partition_id in npar mode, and disable FCOE by default Helin Zhang
2015-04-30 15:03       ` [PATCH v2 26/33] i40e/base: Reassign incorrect PHY type as a workaround for a FW issue Helin Zhang
2015-04-30 15:03       ` [PATCH v2 27/33] i40e/base: add AOC phy types to case statement in get_media_type Helin Zhang
2015-04-30 15:03       ` [PATCH v2 28/33] i40e/base: support for iSCSI capability Helin Zhang
2015-04-30 15:03       ` [PATCH v2 29/33] i40e/base: set FLAG_RD when sending driver version to FW Helin Zhang
2015-04-30 15:03       ` [PATCH v2 30/33] i40e/base: future proof some sizeof calls Helin Zhang
2015-04-30 15:03       ` [PATCH v2 31/33] i40e/base: add more virtual channel operations for future use Helin Zhang
2015-04-30 15:03       ` [PATCH v2 32/33] i40e/base: rework of structures and macros " Helin Zhang
2015-04-30 15:03       ` [PATCH v2 33/33] i40e/base: modifications " Helin Zhang
2015-05-07  1:17       ` [PATCH v2 00/33] i40e base driver update Cao, Min
2015-05-08  5:54       ` Liu, Jijiang

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=1430406219-23901-23-git-send-email-helin.zhang@intel.com \
    --to=helin.zhang-ral2jqcrhueavxtiumwx3w@public.gmane.org \
    --cc=dev-VfR2kkLFssw@public.gmane.org \
    --cc=monica.kenguva-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
    --cc=shannon.nelson-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
    --cc=steven.j.murray-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.