Skip to contentSkip to conversation

net: i40e: fix shifting error in i40e_led_get

PATCH In review Daniel Borkmann 2 participants 3 messages Dec 19, 2013

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net: i40e: fix shifting error in i40e_led_get

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.

---
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(-)
drivers/net/ethernet/intel/i40e/i40e_common.c +2 -2
index 1e4ea13..a170761 100644
@@ -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;
 	}
 
Signature · 1 line
1.8.3.1
#1 lore raw
Quoted 10 lines · Daniel Borkmann

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.

Quoted 6 lines

---
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.

#2 lore raw
Quoted 15 lines · Jeff Kirsher
Quoted 14 lines · Daniel Borkmann

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.

---
Seems like this is still unfixed, so sending to netdev.

Quoted 5 lines
Quoted 2 lines
  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!