diff mbox

[net] net: i40e: fix shifting error in i40e_led_get

Message ID 1387490237-27260-1-git-send-email-dborkman@redhat.com
State Awaiting Upstream, archived
Delegated to: David Miller
Headers show

Commit Message

Daniel Borkmann Dec. 19, 2013, 9:57 p.m. UTC
In function i40e_led_get(), we fetch the LED mode from the GPIO
registers and extract it from gpio_val. However, regardless of
the outcome of the fetched value in gpio_val, the calculation
to extract the mode will always be 0, as we do the following:

  (gpio_val & (61440U /* 0xf << 12 */)) >> 17

Instead of I40E_GLGEN_GPIO_CTL_INT_MODE_SHIFT, we need to use
I40E_GLGEN_GPIO_CTL_LED_MODE_SHIFT to fix this.

Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
---
 Seems like this is still unfixed, so sending to netdev.

 drivers/net/ethernet/intel/i40e/i40e_common.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Kirsher, Jeffrey T Dec. 19, 2013, 10:04 p.m. UTC | #1
On Thu, 2013-12-19 at 22:57 +0100, Daniel Borkmann wrote:
> In function i40e_led_get(), we fetch the LED mode from the GPIO
> registers and extract it from gpio_val. However, regardless of
> the outcome of the fetched value in gpio_val, the calculation
> to extract the mode will always be 0, as we do the following:
> 
>   (gpio_val & (61440U /* 0xf << 12 */)) >> 17
> 
> Instead of I40E_GLGEN_GPIO_CTL_INT_MODE_SHIFT, we need to use
> I40E_GLGEN_GPIO_CTL_LED_MODE_SHIFT to fix this.
> 
> Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
> ---
>  Seems like this is still unfixed, so sending to netdev.
> 
>  drivers/net/ethernet/intel/i40e/i40e_common.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

Thanks Daniel, I may already have a patch in my queue that fixes this,
but if not, I will add this to my queue.
Daniel Borkmann Dec. 19, 2013, 10:41 p.m. UTC | #2
On 12/19/2013 11:04 PM, Jeff Kirsher wrote:
> On Thu, 2013-12-19 at 22:57 +0100, Daniel Borkmann wrote:
>> In function i40e_led_get(), we fetch the LED mode from the GPIO
>> registers and extract it from gpio_val. However, regardless of
>> the outcome of the fetched value in gpio_val, the calculation
>> to extract the mode will always be 0, as we do the following:
>>
>>    (gpio_val & (61440U /* 0xf << 12 */)) >> 17
>>
>> Instead of I40E_GLGEN_GPIO_CTL_INT_MODE_SHIFT, we need to use
>> I40E_GLGEN_GPIO_CTL_LED_MODE_SHIFT to fix this.
>>
>> Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
>> ---
>>   Seems like this is still unfixed, so sending to netdev.
>>
>>   drivers/net/ethernet/intel/i40e/i40e_common.c | 4 ++--
>>   1 file changed, 2 insertions(+), 2 deletions(-)
>
> Thanks Daniel, I may already have a patch in my queue that fixes this,
> but if not, I will add this to my queue.

I reported that plus fix > 1 months ago, so I guess it seems not
yet in the queue. ;-)

Anyways, thanks Jeff!
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/net/ethernet/intel/i40e/i40e_common.c b/drivers/net/ethernet/intel/i40e/i40e_common.c
index 1e4ea13..a170761 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_common.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_common.c
@@ -365,8 +365,8 @@  u32 i40e_led_get(struct i40e_hw *hw)
 		if (port != hw->port)
 			continue;
 
-		mode = (gpio_val & I40E_GLGEN_GPIO_CTL_LED_MODE_MASK)
-				>> I40E_GLGEN_GPIO_CTL_INT_MODE_SHIFT;
+		mode = (gpio_val & I40E_GLGEN_GPIO_CTL_LED_MODE_MASK) >>
+		       I40E_GLGEN_GPIO_CTL_LED_MODE_SHIFT;
 		break;
 	}