Skip to contentSkip to conversation

e1000: remove unused and incorrect code

PATCH New Jesse Brandeburg 4 participants 5 messages Sep 18, 2020 – Oct 1, 2020

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

PATCH 1/1 e1000: remove unused and incorrect code

The e1000_clear_vfta function was triggering a warning in kbuild-bot testing. It's actually a bug but has no functional impact.

drivers/net/ethernet/intel/e1000/e1000_hw.c:4415:58: warning: Same expression in both branches of ternary operator. [duplicateExpressionTernary]

Fix this warning by removing the offending code and simplifying the routine to do exactly what it did before, no functional change.

---

NOTE: I don't recommend this go to stable as there is no functional change.

---
 drivers/net/ethernet/intel/e1000/e1000_hw.c | 10 +---------
 1 file changed, 1 insertion(+), 9 deletions(-)
drivers/net/ethernet/intel/e1000/e1000_hw.c +1 -9
index 2120dacfd55c..c5d702543daa 100644
@@ -4403,17 +4403,9 @@ void e1000_write_vfta(struct e1000_hw *hw, u32 offset, u32 value)
 static void e1000_clear_vfta(struct e1000_hw *hw)
 {
 	u32 offset;
-	u32 vfta_value = 0;
-	u32 vfta_offset = 0;
-	u32 vfta_bit_in_reg = 0;
 
 	for (offset = 0; offset < E1000_VLAN_FILTER_TBL_SIZE; offset++) {
-		/* If the offset we want to clear is the same offset of the
-		 * manageability VLAN ID, then clear all bits except that of the
-		 * manageability unit
-		 */
-		vfta_value = (offset == vfta_offset) ? vfta_bit_in_reg : 0;
-		E1000_WRITE_REG_ARRAY(hw, VFTA, offset, vfta_value);
+		E1000_WRITE_REG_ARRAY(hw, VFTA, offset, 0);
 		E1000_WRITE_FLUSH();
 	}
 }

base-commit: aa042f60e4961d4bec57e3268624df1f3a6befa4

Signature · 1 line
2.25.4
#1 lore raw

PATCH 1/1 e1000: remove unused and incorrect code

Quoted 18 lines

From: Intel-wired-lan <[email protected]> On Behalf Of Jesse Brandeburg
Sent: Friday, September 18, 2020 11:42 AM
To: intel-wired-lan at lists.osuosl.org
Subject: [Intel-wired-lan] [PATCH net-next v1] e1000: remove unused and incorrect code

The e1000_clear_vfta function was triggering a warning in kbuild-bot testing. It's actually a bug but has no functional impact.

drivers/net/ethernet/intel/e1000/e1000_hw.c:4415:58: warning: Same expression in both branches of ternary operator. [duplicateExpressionTernary]

Fix this warning by removing the offending code and simplifying the routine to do exactly what it did before, no functional change.

Quoted 8 lines

---

NOTE: I don't recommend this go to stable as there is no functional change.

---
 drivers/net/ethernet/intel/e1000/e1000_hw.c | 10 +---------
 1 file changed, 1 insertion(+), 9 deletions(-)
#2 lore raw

PATCH 1/1 e1000: remove unused and incorrect code

In reply to Jesse Brandeburg

Dear Jesse,

Am 18.09.20 um 20:41 schrieb Jesse Brandeburg:

Quoted 8 lines

The e1000_clear_vfta function was triggering a warning in kbuild-bot testing. It's actually a bug but has no functional impact.

drivers/net/ethernet/intel/e1000/e1000_hw.c:4415:58: warning: Same expression in both branches of ternary operator. [duplicateExpressionTernary]

Fix this warning by removing the offending code and simplifying the routine to do exactly what it did before, no functional change.

It looks like this fixes commit 1532ecea (e1000: drop dead pcie code from e1000) removing support for e1000_82573?

Quoted 14 lines

---

NOTE: I don't recommend this go to stable as there is no functional change.

---
  drivers/net/ethernet/intel/e1000/e1000_hw.c | 10 +---------
  1 file changed, 1 insertion(+), 9 deletions(-)
drivers/net/ethernet/intel/e1000/e1000_hw.c +0 -0
index 2120dacfd55c..c5d702543daa 100644

drivers/net/ethernet/intel/e1000/e1000_hw.c void e1000_write_vfta(struct e1000_hw *hw, u32 offset, u32 value) · line 4403

Quoted 1 line
drivers/net/ethernet/intel/e1000/e1000_hw.c +0 -0
@@ -4403,17 +4403,9 @@ void e1000_write_vfta(struct e1000_hw *hw, u32 offset, u32 value)
  static void e1000_clear_vfta(struct e1000_hw *hw)

(Why is the diff also mentioning the function before void e1000_write_vfta()?)

Quoted 7 lines
drivers/net/ethernet/intel/e1000/e1000_hw.c +0 -3
  {
  	u32 offset;
-	u32 vfta_value = 0;
-	u32 vfta_offset = 0;
-	u32 vfta_bit_in_reg = 0;
 
  	for (offset = 0; offset < E1000_VLAN_FILTER_TBL_SIZE; offset++) {

drivers/net/ethernet/intel/e1000/e1000_hw.c void e1000_write_vfta(struct e1000_hw *hw, u32 offset, u32 value) · line 4411

Quoted 10 lines
drivers/net/ethernet/intel/e1000/e1000_hw.c +1 -6
-		/* If the offset we want to clear is the same offset of the
-		 * manageability VLAN ID, then clear all bits except that of the
-		 * manageability unit
-		 */
-		vfta_value = (offset == vfta_offset) ? vfta_bit_in_reg : 0;
-		E1000_WRITE_REG_ARRAY(hw, VFTA, offset, vfta_value);
+		E1000_WRITE_REG_ARRAY(hw, VFTA, offset, 0);
  		E1000_WRITE_FLUSH();
  	}
  }

It?d be great if you updated the commit description.

Kind regards,

Paul

#3 lore raw

PATCH 1/1 e1000: remove unused and incorrect code

Quoted 6 lines · Paul Menzel
Quoted 3 lines

Fix this warning by removing the offending code and simplifying the routine to do exactly what it did before, no functional change.

It looks like this fixes commit 1532ecea (e1000: drop dead pcie code from e1000) removing support for e1000_82573?

It may, but that commit is from 2009, and since this code change actually doesn't fix any bug I didn't think it was a) worth davem targeting to net, b) worth the bots picking up for backporting to stable, as it is just waste of time, and maybe wouldn't be considered as important enough for stable.

Quoted 5 lines
Quoted 5 lines

---

NOTE: I don't recommend this go to stable as there is no functional change.

You'll note I attempted to address your comment with the above line even before you made it.

Quoted 4 lines
Quoted 4 lines
---
  drivers/net/ethernet/intel/e1000/e1000_hw.c | 10 +---------
  1 file changed, 1 insertion(+), 9 deletions(-)
Quoted 9 lines

drivers/net/ethernet/intel/e1000/e1000_hw.c void e1000_write_vfta(struct e1000_hw *hw, u32 offset, u32 value) · line 4403

Quoted 6 lines
drivers/net/ethernet/intel/e1000/e1000_hw.c +0 -0
index 2120dacfd55c..c5d702543daa 100644
@@ -4403,17 +4403,9 @@ void e1000_write_vfta(struct e1000_hw *hw, u32 offset, u32 value)
  static void e1000_clear_vfta(struct e1000_hw *hw)

(Why is the diff also mentioning the function before void e1000_write_vfta()?)

This is an artifact of how diff works, since the e1000_clear_vfta function was part of the diff context, the "previous function search" that diff does found write_vfta. There is no issue here, everything is working as it should.

Quoted 19 lines
Quoted 8 lines
drivers/net/ethernet/intel/e1000/e1000_hw.c +0 -3
  {
      u32 offset;
-     u32 vfta_value = 0;
-     u32 vfta_offset = 0;
-     u32 vfta_bit_in_reg = 0;
 
      for (offset = 0; offset < E1000_VLAN_FILTER_TBL_SIZE; offset++) {

drivers/net/ethernet/intel/e1000/e1000_hw.c void e1000_write_vfta(struct e1000_hw *hw, u32 offset, u32 value) · line 4411

Quoted 10 lines
drivers/net/ethernet/intel/e1000/e1000_hw.c +1 -6
-             /* If the offset we want to clear is the same offset of the
-              * manageability VLAN ID, then clear all bits except that of the
-              * manageability unit
-              */
-             vfta_value = (offset == vfta_offset) ? vfta_bit_in_reg : 0;
-             E1000_WRITE_REG_ARRAY(hw, VFTA, offset, vfta_value);
+             E1000_WRITE_REG_ARRAY(hw, VFTA, offset, 0);
              E1000_WRITE_FLUSH();
      }
  }
Quoted 1 line

It?d be great if you updated the commit description.

Thanks for your feedback, but in this case I don't think there is anything to change, I recommend we send the patch as-is. I appreciate your time spent reviewing!

Jesse

#4 lore raw

PATCH 1/1 e1000: remove unused and incorrect code

Dear Jesse,

Am 01.10.20 um 20:08 schrieb Jesse Brandeburg:

Quoted 5 lines · Paul Menzel
Quoted 4 lines
Quoted 3 lines

Fix this warning by removing the offending code and simplifying the routine to do exactly what it did before, no functional change.

Quoted 8 lines
Quoted 2 lines

It looks like this fixes commit 1532ecea (e1000: drop dead pcie code from e1000) removing support for e1000_82573?

It may, but that commit is from 2009, and since this code change actually doesn't fix any bug I didn't think it was a) worth davem targeting to net, b) worth the bots picking up for backporting to stable, as it is just waste of time, and maybe wouldn't be considered as important enough for stable.

You do not have to create a Fixes tag, but mentioning it in the commit message is well warranted, as it?s unclear, why the complicated code is there in the first place, and it took me several minutes to figure it out.

Quoted 8 lines
Quoted 5 lines
Quoted 5 lines

---

NOTE: I don't recommend this go to stable as there is no functional change.

You'll note I attempted to address your comment with the above line even before you made it.

I didn?t write, it should be applied to the stable series.

Quoted 38 lines
Quoted 4 lines
Quoted 4 lines
---
   drivers/net/ethernet/intel/e1000/e1000_hw.c | 10 +---------
   1 file changed, 1 insertion(+), 9 deletions(-)
Quoted 9 lines

drivers/net/ethernet/intel/e1000/e1000_hw.c void e1000_write_vfta(struct e1000_hw *hw, u32 offset, u32 value) · line 4403

Quoted 6 lines
drivers/net/ethernet/intel/e1000/e1000_hw.c +0 -0
index 2120dacfd55c..c5d702543daa 100644
@@ -4403,17 +4403,9 @@ void e1000_write_vfta(struct e1000_hw *hw, u32 offset, u32 value)
   static void e1000_clear_vfta(struct e1000_hw *hw)

(Why is the diff also mentioning the function before void e1000_write_vfta()?)

This is an artifact of how diff works, since the e1000_clear_vfta function was part of the diff context, the "previous function search" that diff does found write_vfta. There is no issue here, everything is working as it should.

Quoted 19 lines
Quoted 18 lines
drivers/net/ethernet/intel/e1000/e1000_hw.c +1 -9
   {
       u32 offset;
-     u32 vfta_value = 0;
-     u32 vfta_offset = 0;
-     u32 vfta_bit_in_reg = 0;
 
       for (offset = 0; offset < E1000_VLAN_FILTER_TBL_SIZE; offset++) {
-             /* If the offset we want to clear is the same offset of the
-              * manageability VLAN ID, then clear all bits except that of the
-              * manageability unit
-              */
-             vfta_value = (offset == vfta_offset) ? vfta_bit_in_reg : 0;
-             E1000_WRITE_REG_ARRAY(hw, VFTA, offset, vfta_value);
+             E1000_WRITE_REG_ARRAY(hw, VFTA, offset, 0);
               E1000_WRITE_FLUSH();
       }
   }
Quoted 5 lines
Quoted 1 line

It?d be great if you updated the commit description.

Thanks for your feedback, but in this case I don't think there is anything to change, I recommend we send the patch as-is. I appreciate your time spent reviewing!

Thank you for the reply.

Kind regards,

Paul