Skip to contentSkip to conversation

igc: Fixes for VLAN priority filtering code

PATCH Superseded Andre Guedes 4 participants 13 messages Apr 3, 2020 – May 1, 2020

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

cover igc: Fixes for VLAN priority filtering code

Hi,

This patch series provides some fixes and improvements to the VLAN priority filtering code from IGC driver.

The improvements focuses on aligning the code organization to follow the same rationale from MAC address filtering code, splitting ethtool and core logic between igc_ethtool.c and igc_main.c. It also adds some log messages to help debugging the code.

Best regards,

Andre

Andre Guedes (4):
igc: Rename IGC_VLAPQF macro
igc: Dump VLANPQF register
igc: Return -EOPNOTSUPP when VLAN mask doesn't match
igc: Refactor VLAN priority filtering code

 drivers/net/ethernet/intel/igc/igc.h         |  3 +
 drivers/net/ethernet/intel/igc/igc_defines.h |  6 +-
 drivers/net/ethernet/intel/igc/igc_ethtool.c | 70 +++++---------------
 drivers/net/ethernet/intel/igc/igc_main.c    | 52 +++++++++++++++
 drivers/net/ethernet/intel/igc/igc_regs.h    |  2 +-
 5 files changed, 76 insertions(+), 57 deletions(-)
Signature · 1 line
2.26.0
#1 lore raw

PATCH 1/4 igc: Rename IGC_VLAPQF macro

This patch renames the IGC_VLAPQF macro to IGC_VLANPQF as well as related macros so they match the register name and fields described in the datasheet.

---
 drivers/net/ethernet/intel/igc/igc_defines.h |  6 +++---
 drivers/net/ethernet/intel/igc/igc_ethtool.c | 21 ++++++++++----------
 drivers/net/ethernet/intel/igc/igc_regs.h    |  2 +-
 3 files changed, 14 insertions(+), 15 deletions(-)
drivers/net/ethernet/intel/igc/igc_defines.h +3 -3
index 63d3d34763da..a4edf344bd63 100644
@@ -514,9 +514,9 @@
 #define IGC_MAX_MAC_HDR_LEN	127
 #define IGC_MAX_NETWORK_HDR_LEN	511
 
-#define IGC_VLAPQF_QUEUE_SEL(_n, q_idx) ((q_idx) << ((_n) * 4))
-#define IGC_VLAPQF_P_VALID(_n)	(0x1 << (3 + (_n) * 4))
-#define IGC_VLAPQF_QUEUE_MASK	0x03
+#define IGC_VLANPQF_QSEL(_n, q_idx) ((q_idx) << ((_n) * 4))
+#define IGC_VLANPQF_VALID(_n)	(0x1 << (3 + (_n) * 4))
+#define IGC_VLANPQF_QUEUE_MASK	0x03
 
 #define IGC_ADVTXD_MACLEN_SHIFT		9  /* Adv ctxt desc mac len shift */
 #define IGC_ADVTXD_TUCMD_L4T_UDP	0x00000000  /* L4 Packet TYPE of UDP */
drivers/net/ethernet/intel/igc/igc_ethtool.c +10 -11
index 47115d73ea61..9811b26f3c59 100644
@@ -1229,23 +1229,23 @@ static int igc_rxnfc_write_vlan_prio_filter(struct igc_adapter *adapter,
 	u16 queue_index;
 	u32 vlapqf;
 
-	vlapqf = rd32(IGC_VLAPQF);
+	vlapqf = rd32(IGC_VLANPQF);
 	vlan_priority = (ntohs(input->filter.vlan_tci) & VLAN_PRIO_MASK)
 				>> VLAN_PRIO_SHIFT;
-	queue_index = (vlapqf >> (vlan_priority * 4)) & IGC_VLAPQF_QUEUE_MASK;
+	queue_index = (vlapqf >> (vlan_priority * 4)) & IGC_VLANPQF_QUEUE_MASK;
 
 	/* check whether this vlan prio is already set */
-	if (vlapqf & IGC_VLAPQF_P_VALID(vlan_priority) &&
+	if (vlapqf & IGC_VLANPQF_VALID(vlan_priority) &&
 	    queue_index != input->action) {
 		netdev_err(adapter->netdev,
 			   "ethtool rxnfc set vlan prio filter failed");
 		return -EEXIST;
 	}
 
-	vlapqf |= IGC_VLAPQF_P_VALID(vlan_priority);
-	vlapqf |= IGC_VLAPQF_QUEUE_SEL(vlan_priority, input->action);
+	vlapqf |= IGC_VLANPQF_VALID(vlan_priority);
+	vlapqf |= IGC_VLANPQF_QSEL(vlan_priority, input->action);
 
-	wr32(IGC_VLAPQF, vlapqf);
+	wr32(IGC_VLANPQF, vlapqf);
 
 	return 0;
 }
@@ -1313,12 +1313,11 @@ static void igc_clear_vlan_prio_filter(struct igc_adapter *adapter,
 
 	vlan_priority = (vlan_tci & VLAN_PRIO_MASK) >> VLAN_PRIO_SHIFT;
 
-	vlapqf = rd32(IGC_VLAPQF);
-	vlapqf &= ~IGC_VLAPQF_P_VALID(vlan_priority);
-	vlapqf &= ~IGC_VLAPQF_QUEUE_SEL(vlan_priority,
-						IGC_VLAPQF_QUEUE_MASK);
+	vlapqf = rd32(IGC_VLANPQF);
+	vlapqf &= ~IGC_VLANPQF_VALID(vlan_priority);
+	vlapqf &= ~IGC_VLANPQF_QSEL(vlan_priority, IGC_VLANPQF_QUEUE_MASK);
 
-	wr32(IGC_VLAPQF, vlapqf);
+	wr32(IGC_VLANPQF, vlapqf);
 }
 
 int igc_erase_filter(struct igc_adapter *adapter, struct igc_nfc_filter *input)
drivers/net/ethernet/intel/igc/igc_regs.h +1 -1
index 7bfba20bf207..ab8ac46d381a 100644
@@ -123,7 +123,7 @@
 #define IGC_UTA			0x0A000  /* Unicast Table Array - RW */
 #define IGC_RAL(_n)		(0x05400 + ((_n) * 0x08))
 #define IGC_RAH(_n)		(0x05404 + ((_n) * 0x08))
-#define IGC_VLAPQF		0x055B0  /* VLAN Priority Queue Filter VLAPQF */
+#define IGC_VLANPQF		0x055B0  /* VLAN Priority Queue Filter - RW */
 
 /* Transmit Register Descriptions */
 #define IGC_TCTL		0x00400  /* Tx Control - RW */
Signature · 1 line
2.26.0
#2 lore raw

PATCH 1/4 igc: Rename IGC_VLAPQF macro

Quoted 10 lines

From: Intel-wired-lan <[email protected]> On Behalf Of Andre Guedes
Sent: Friday, April 3, 2020 11:18 AM
To: intel-wired-lan at lists.osuosl.org
Subject: [Intel-wired-lan] [PATCH 1/4] igc: Rename IGC_VLAPQF macro

This patch renames the IGC_VLAPQF macro to IGC_VLANPQF as well as related macros so they match the register name and fields described in the datasheet.

Quoted 6 lines
---
 drivers/net/ethernet/intel/igc/igc_defines.h |  6 +++---
 drivers/net/ethernet/intel/igc/igc_ethtool.c | 21 ++++++++++----------
 drivers/net/ethernet/intel/igc/igc_regs.h    |  2 +-
 3 files changed, 14 insertions(+), 15 deletions(-)
#3 lore raw

PATCH 2/4 igc: Dump VLANPQF register

In reply to Andre Guedes

This patch adds the VLAN Priority Queue Filter Register (VLANPQF) to the list of registers dumped by igc_get_regs().

---
 drivers/net/ethernet/intel/igc/igc_ethtool.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/net/ethernet/intel/igc/igc_ethtool.c +2 -0
index 9811b26f3c59..dfc21908347d 100644
@@ -316,6 +316,8 @@ static void igc_get_regs(struct net_device *netdev,
 		regs_buff[172 + i] = rd32(IGC_RAL(i));
 	for (i = 0; i < 16; i++)
 		regs_buff[188 + i] = rd32(IGC_RAH(i));
+
+	regs_buff[204] = rd32(IGC_VLANPQF);
 }
 
 static void igc_get_wol(struct net_device *netdev, struct ethtool_wolinfo *wol)
Signature · 1 line
2.26.0
#4 lore raw

PATCH 2/4 igc: Dump VLANPQF register

Quoted 6 lines

From: Intel-wired-lan <[email protected]> On Behalf Of Andre Guedes
Sent: Friday, April 3, 2020 11:18 AM
To: intel-wired-lan at lists.osuosl.org
Subject: [Intel-wired-lan] [PATCH 2/4] igc: Dump VLANPQF register

Quoted 8 lines

This patch adds the VLAN Priority Queue Filter Register (VLANPQF) to the list of registers dumped by igc_get_regs().

---
 drivers/net/ethernet/intel/igc/igc_ethtool.c | 2 ++
 1 file changed, 2 insertions(+)
#5 lore raw

PATCH 3/4 igc: Return -EOPNOTSUPP when VLAN mask doesn't match

In reply to Andre Guedes

The I225 controller supports rx queue assignment based on VLAN priority only. Other Tag Control Information (TCI) are valid, but not supported by the driver. So this patch changes the returning code from igc_add_ ethtool_nfc_entry() to -EOPNOTSUPP in order to provide more meaningful information on why the function failed.

It also adds a debug messages to give the user a hint about what went wrong with the NFC setup.

---
 drivers/net/ethernet/intel/igc/igc_ethtool.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/ethernet/intel/igc/igc_ethtool.c +2 -1
index dfc21908347d..036a2244b76c 100644
@@ -1446,7 +1446,8 @@ static int igc_add_ethtool_nfc_entry(struct igc_adapter *adapter,
 
 	if ((fsp->flow_type & FLOW_EXT) && fsp->m_ext.vlan_tci) {
 		if (fsp->m_ext.vlan_tci != htons(VLAN_PRIO_MASK)) {
-			err = -EINVAL;
+			netdev_dbg(netdev, "VLAN mask not supported");
+			err = -EOPNOTSUPP;
 			goto err_out;
 		}
 		input->filter.vlan_tci = fsp->h_ext.vlan_tci;
Signature · 1 line
2.26.0
#6 lore raw

PATCH 3/4 igc: Return -EOPNOTSUPP when VLAN mask doesn't match

Quoted 13 lines

From: Intel-wired-lan <[email protected]> On Behalf Of Andre Guedes
Sent: Friday, April 3, 2020 11:18 AM
To: intel-wired-lan at lists.osuosl.org
Subject: [Intel-wired-lan] [PATCH 3/4] igc: Return -EOPNOTSUPP when VLAN mask doesn't match

The I225 controller supports rx queue assignment based on VLAN priority only. Other Tag Control Information (TCI) are valid, but not supported by the driver. So this patch changes the returning code from igc_add_ ethtool_nfc_entry() to -EOPNOTSUPP in order to provide more meaningful information on why the function failed.

Quoted 7 lines

It also adds a debug messages to give the user a hint about what went wrong with the NFC setup.

---
 drivers/net/ethernet/intel/igc/igc_ethtool.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
#7 lore raw

PATCH 4/4 igc: Refactor VLAN priority filtering code

In reply to Andre Guedes

The whole VLAN priority filtering code is implemented in igc_ethtool.c and mixes logic from ethtool and core parts. This patch refactors it so core logic is moved to igc_main.c, aligning the VLAN priority filtering code organization with the MAC address filtering code.

This patch also takes the opportunity to add some log messages to ease debugging.

---
 drivers/net/ethernet/intel/igc/igc.h         |  3 +
 drivers/net/ethernet/intel/igc/igc_ethtool.c | 64 ++++----------------
 drivers/net/ethernet/intel/igc/igc_main.c    | 52 ++++++++++++++++
 3 files changed, 68 insertions(+), 51 deletions(-)
drivers/net/ethernet/intel/igc/igc.h +3 -0
index 1b07e8b870c2..48eb9c00a44d 100644
@@ -235,6 +235,9 @@ int igc_add_mac_filter(struct igc_adapter *adapter, const u8 *addr,
 		       const s8 queue, const u8 flags);
 int igc_del_mac_filter(struct igc_adapter *adapter, const u8 *addr,
 		       const u8 flags);
+int igc_add_vlan_prio_filter(struct igc_adapter *adapter, int prio,
+			     int queue);
+void igc_del_vlan_prio_filter(struct igc_adapter *adapter, int prio);
 void igc_update_stats(struct igc_adapter *adapter);
 
 /* igc_dump declarations */
drivers/net/ethernet/intel/igc/igc_ethtool.c +13 -51

89 lines not on this page · raw message

drivers/net/ethernet/intel/igc/igc_main.c +52 -0

58 lines not on this page · raw message

Signature · 1 line
2.26.0
#8 lore raw

PATCH 4/4 igc: Refactor VLAN priority filtering code

Hi,

Quoted 110 lines · Andre Guedes

The whole VLAN priority filtering code is implemented in igc_ethtool.c and mixes logic from ethtool and core parts. This patch refactors it so core logic is moved to igc_main.c, aligning the VLAN priority filtering code organization with the MAC address filtering code.

This patch also takes the opportunity to add some log messages to ease debugging.

---
 drivers/net/ethernet/intel/igc/igc.h         |  3 +
 drivers/net/ethernet/intel/igc/igc_ethtool.c | 64 ++++----------------
 drivers/net/ethernet/intel/igc/igc_main.c    | 52 ++++++++++++++++
 3 files changed, 68 insertions(+), 51 deletions(-)
drivers/net/ethernet/intel/igc/igc.h +3 -0
index 1b07e8b870c2..48eb9c00a44d 100644
@@ -235,6 +235,9 @@ int igc_add_mac_filter(struct igc_adapter *adapter, const u8 *addr,
 		       const s8 queue, const u8 flags);
 int igc_del_mac_filter(struct igc_adapter *adapter, const u8 *addr,
 		       const u8 flags);
+int igc_add_vlan_prio_filter(struct igc_adapter *adapter, int prio,
+			     int queue);
+void igc_del_vlan_prio_filter(struct igc_adapter *adapter, int prio);
 void igc_update_stats(struct igc_adapter *adapter);
 
 /* igc_dump declarations */
drivers/net/ethernet/intel/igc/igc_ethtool.c +8 -48
index 036a2244b76c..35bc125183a0 100644
@@ -1223,35 +1223,6 @@ static int igc_rxnfc_write_etype_filter(struct igc_adapter *adapter,
 	return 0;
 }
 
-static int igc_rxnfc_write_vlan_prio_filter(struct igc_adapter *adapter,
-					    struct igc_nfc_filter *input)
-{
-	struct igc_hw *hw = &adapter->hw;
-	u8 vlan_priority;
-	u16 queue_index;
-	u32 vlapqf;
-
-	vlapqf = rd32(IGC_VLANPQF);
-	vlan_priority = (ntohs(input->filter.vlan_tci) & VLAN_PRIO_MASK)
-				>> VLAN_PRIO_SHIFT;
-	queue_index = (vlapqf >> (vlan_priority * 4)) & IGC_VLANPQF_QUEUE_MASK;
-
-	/* check whether this vlan prio is already set */
-	if (vlapqf & IGC_VLANPQF_VALID(vlan_priority) &&
-	    queue_index != input->action) {
-		netdev_err(adapter->netdev,
-			   "ethtool rxnfc set vlan prio filter failed");
-		return -EEXIST;
-	}
-
-	vlapqf |= IGC_VLANPQF_VALID(vlan_priority);
-	vlapqf |= IGC_VLANPQF_QSEL(vlan_priority, input->action);
-
-	wr32(IGC_VLANPQF, vlapqf);
-
-	return 0;
-}
-
 int igc_add_filter(struct igc_adapter *adapter, struct igc_nfc_filter *input)
 {
 	struct igc_hw *hw = &adapter->hw;
@@ -1285,10 +1256,15 @@ int igc_add_filter(struct igc_adapter *adapter, struct igc_nfc_filter *input)
 			return err;
 	}
 
-	if (input->filter.match_flags & IGC_FILTER_FLAG_VLAN_TCI)
-		err = igc_rxnfc_write_vlan_prio_filter(adapter, input);
+	if (input->filter.match_flags & IGC_FILTER_FLAG_VLAN_TCI) {
+		int prio = (ntohs(input->filter.vlan_tci) & VLAN_PRIO_MASK)
+				>> VLAN_PRIO_SHIFT;
+		err = igc_add_vlan_prio_filter(adapter, prio, input->action);
+		if (err)
+			return err;
+	}
 
-	return err;
+	return 0;
 }
 
 static void igc_clear_etype_filter_regs(struct igc_adapter *adapter,
@@ -1306,31 +1282,17 @@ static void igc_clear_etype_filter_regs(struct igc_adapter *adapter,
 	adapter->etype_bitmap[reg_index] = false;
 }
 
-static void igc_clear_vlan_prio_filter(struct igc_adapter *adapter,
-				       u16 vlan_tci)
-{
-	struct igc_hw *hw = &adapter->hw;
-	u8 vlan_priority;
-	u32 vlapqf;
-
-	vlan_priority = (vlan_tci & VLAN_PRIO_MASK) >> VLAN_PRIO_SHIFT;
-
-	vlapqf = rd32(IGC_VLANPQF);
-	vlapqf &= ~IGC_VLANPQF_VALID(vlan_priority);
-	vlapqf &= ~IGC_VLANPQF_QSEL(vlan_priority, IGC_VLANPQF_QUEUE_MASK);
-
-	wr32(IGC_VLANPQF, vlapqf);
-}
-
 int igc_erase_filter(struct igc_adapter *adapter, struct igc_nfc_filter *input)
 {

drivers/net/ethernet/intel/igc/igc_ethtool.c static void igc_clear_etype_filter_regs(struct igc_adapter *adapter, · line 1293

Quoted 10 lines
drivers/net/ethernet/intel/igc/igc_ethtool.c +3 -3
 	if (input->filter.match_flags & IGC_FILTER_FLAG_ETHER_TYPE)
 		igc_clear_etype_filter_regs(adapter,
 					    input->etype_reg_index);
 
-	if (input->filter.match_flags & IGC_FILTER_FLAG_VLAN_TCI)
-		igc_clear_vlan_prio_filter(adapter,
-					   ntohs(input->filter.vlan_tci));
+	if (input->filter.match_flags & IGC_FILTER_FLAG_VLAN_TCI) {
+		int prio = (ntohs(input->filter.vlan_tci) & VLAN_PRIO_MASK)
+				>> VLAN_PRIO_SHIFT;

As you are refactoring this, one suggestion/question: is it possible to move the ntohs() and friends closer to writing/reading to/from the registers?

Quoted 31 lines
drivers/net/ethernet/intel/igc/igc_ethtool.c +2 -0
+		igc_del_vlan_prio_filter(adapter, prio);
+	}
 
 	if (input->filter.match_flags & IGC_FILTER_FLAG_SRC_MAC_ADDR)
 		igc_del_mac_filter(adapter, input->filter.src_addr,
drivers/net/ethernet/intel/igc/igc_main.c +18 -0
index c3555148ca0e..70f861b418b2 100644
@@ -2315,6 +2315,58 @@ int igc_del_mac_filter(struct igc_adapter *adapter, const u8 *addr,
 	return 0;
 }
 
+/**
+ * igc_add_vlan_prio_filter() - Add VLAN priority filter.
+ * @adapter: Pointer to adapter where the filter should be added.
+ * @prio: VLAN priority value.
+ * @queue: Queue number which matching frames are assigned to.
+ *
+ * Return: 0 in case of success, negative errno code otherwise.
+ */
+int igc_add_vlan_prio_filter(struct igc_adapter *adapter, int prio, int queue)
+{
+	struct net_device *dev = adapter->netdev;
+	struct igc_hw *hw = &adapter->hw;
+	u32 vlanpqf;
+
+	vlanpqf = rd32(IGC_VLANPQF);
+
+	if (vlanpqf & IGC_VLANPQF_VALID(prio)) {
+		netdev_dbg(dev, "VLAN priority filter already in use");

drivers/net/ethernet/intel/igc/igc_main.c int igc_del_mac_filter(struct igc_adapter *adapter, const u8 *addr, · line 2345

Quoted 10 lines
drivers/net/ethernet/intel/igc/igc_main.c +10 -0
+		return -EEXIST;
+	}
+
+	vlanpqf |= IGC_VLANPQF_QSEL(prio, queue);
+	vlanpqf |= IGC_VLANPQF_VALID(prio);
+
+	wr32(IGC_VLANPQF, vlanpqf);
+
+	netdev_dbg(dev, "Add VLAN priority filter: prio %d queue %d",
+		   prio, queue);

As you added a way to dump this register, I don't think this debug statement, and the one below, are that useful.

Quoted 34 lines
drivers/net/ethernet/intel/igc/igc_main.c +24 -0
+	return 0;
+}
+
+/**
+ * igc_del_vlan_prio_filter() - Delete VLAN priority filter.
+ * @adapter: Pointer to adapter where the filter should be deleted from.
+ * @prio: VLAN priority value.
+ */
+void igc_del_vlan_prio_filter(struct igc_adapter *adapter, int prio)
+{
+	struct igc_hw *hw = &adapter->hw;
+	u32 vlanpqf;
+
+	vlanpqf = rd32(IGC_VLANPQF);
+
+	vlanpqf &= ~IGC_VLANPQF_VALID(prio);
+	vlanpqf |= ~IGC_VLANPQF_QSEL(prio, 0);
+
+	wr32(IGC_VLANPQF, vlanpqf);
+
+	netdev_dbg(adapter->netdev, "Delete VLAN priority filter: prio %d",
+		   prio);
+}
+
 static int igc_uc_sync(struct net_device *netdev, const unsigned char *addr)
 {
 	struct igc_adapter *adapter = netdev_priv(netdev);
Signature · 6 lines
2.26.0

_______________________________________________
Intel-wired-lan mailing list
Intel-wired-lan at osuosl.org
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
Signature · 1 line
Vinicius
#9 lore raw

PATCH 4/4 igc: Refactor VLAN priority filtering code

Hi Vinicius,

Quoted 13 lines

drivers/net/ethernet/intel/igc/igc_ethtool.c static void igc_clear_etype_filter_regs(struct igc_adapter *adapter, · line 1293

Quoted 12 lines

int igc_erase_filter(struct igc_adapter *adapter, struct igc_nfc_filter *input)

 {
      if (input->filter.match_flags & IGC_FILTER_FLAG_ETHER_TYPE)
              igc_clear_etype_filter_regs(adapter,
                                          input->etype_reg_index);
drivers/net/ethernet/intel/igc/igc_ethtool.c +3 -3
-     if (input->filter.match_flags & IGC_FILTER_FLAG_VLAN_TCI)
-             igc_clear_vlan_prio_filter(adapter,
-                                        ntohs(input->filter.vlan_tci));
+     if (input->filter.match_flags & IGC_FILTER_FLAG_VLAN_TCI) {
+             int prio = (ntohs(input->filter.vlan_tci) & VLAN_PRIO_MASK)
+                             >> VLAN_PRIO_SHIFT;
Quoted 3 lines

As you are refactoring this, one suggestion/question: is it possible to move the ntohs() and friends closer to writing/reading to/from the registers?

I left this ntohs() here on purpose. The reason why we need it is due to the ethtool byte order convention for the vlan_tci, not the controller. So it makes more sense to have it in igc_ethtool.c instead of igc_main.c.

Quoted 15 lines
Quoted 15 lines
drivers/net/ethernet/intel/igc/igc_main.c +15 -0
+int igc_add_vlan_prio_filter(struct igc_adapter *adapter, int prio, int queue)
+{
+     struct net_device *dev = adapter->netdev;
+     struct igc_hw *hw = &adapter->hw;
+     u32 vlanpqf;
+
+     vlanpqf = rd32(IGC_VLANPQF);
+
+     if (vlanpqf & IGC_VLANPQF_VALID(prio)) {
+             netdev_dbg(dev, "VLAN priority filter already in use");
+             return -EEXIST;
+     }
+
+     vlanpqf |= IGC_VLANPQF_QSEL(prio, queue);
+     vlanpqf |= IGC_VLANPQF_VALID(prio);
Quoted 8 lines

drivers/net/ethernet/intel/igc/igc_main.c int igc_del_mac_filter(struct igc_adapter *adapter, const u8 *addr, · line 2345

Quoted 5 lines
drivers/net/ethernet/intel/igc/igc_main.c +5 -0
+
+     wr32(IGC_VLANPQF, vlanpqf);
+
+     netdev_dbg(dev, "Add VLAN priority filter: prio %d queue %d",
+                prio, queue);

As you added a way to dump this register, I don't think this debug statement, and the one below, are that useful.

Even considering that we are now able to dump the VLANPQF register, these debug messages are still useful for logging purposes. We want to know when VLAN priority filters are added or deleted. The register dump gives us a snapshot of the register value, not the sequence of events that happened to get there.

At least they have been useful to me while debugging this code.

- Andre

#10 lore raw

PATCH 4/4 igc: Refactor VLAN priority filtering code

In reply to Andre Guedes
Quoted 15 lines

From: Intel-wired-lan <[email protected]> On Behalf Of Andre Guedes
Sent: Friday, April 3, 2020 11:18 AM
To: intel-wired-lan at lists.osuosl.org
Subject: [Intel-wired-lan] [PATCH 4/4] igc: Refactor VLAN priority filtering code

The whole VLAN priority filtering code is implemented in igc_ethtool.c and mixes logic from ethtool and core parts. This patch refactors it so core logic is moved to igc_main.c, aligning the VLAN priority filtering code organization with the MAC address filtering code.

This patch also takes the opportunity to add some log messages to ease debugging.

Quoted 7 lines
---
 drivers/net/ethernet/intel/igc/igc.h         |  3 +
 drivers/net/ethernet/intel/igc/igc_ethtool.c | 64 ++++----------------
 drivers/net/ethernet/intel/igc/igc_main.c    | 52 ++++++++++++++++
 3 files changed, 68 insertions(+), 51 deletions(-)
#11 lore raw

PATCH v2 4/4 igc: Refactor VLAN priority filtering code

In reply to Andre Guedes

The whole VLAN priority filtering code is implemented in igc_ethtool.c and mixes logic from ethtool and core parts. This patch refactors it so core logic is moved to igc_main.c, aligning the VLAN priority filtering code organization with the MAC address filtering code.

This patch also takes the opportunity to add some log messages to ease debugging.

---
v2: Previous version had a bug when clearing IGC_VLANPQF_QSEL bits in

    igc_del_vlan_prio_filter().
---
 drivers/net/ethernet/intel/igc/igc.h         |  3 +
 drivers/net/ethernet/intel/igc/igc_ethtool.c | 64 ++++----------------
 drivers/net/ethernet/intel/igc/igc_main.c    | 52 ++++++++++++++++
 3 files changed, 68 insertions(+), 51 deletions(-)
drivers/net/ethernet/intel/igc/igc.h +3 -0
index 1b07e8b870c2..48eb9c00a44d 100644
@@ -235,6 +235,9 @@ int igc_add_mac_filter(struct igc_adapter *adapter, const u8 *addr,
 		       const s8 queue, const u8 flags);
 int igc_del_mac_filter(struct igc_adapter *adapter, const u8 *addr,
 		       const u8 flags);
+int igc_add_vlan_prio_filter(struct igc_adapter *adapter, int prio,
+			     int queue);
+void igc_del_vlan_prio_filter(struct igc_adapter *adapter, int prio);
 void igc_update_stats(struct igc_adapter *adapter);
 
 /* igc_dump declarations */
drivers/net/ethernet/intel/igc/igc_ethtool.c +13 -51

89 lines not on this page · raw message

drivers/net/ethernet/intel/igc/igc_main.c +52 -0

58 lines not on this page · raw message

Signature · 1 line
2.26.0
#12 lore raw

PATCH v2 4/4 igc: Refactor VLAN priority filtering code

Quoted 15 lines

From: Guedes, Andre <[email protected]>
Sent: Thursday, April 23, 2020 6:11 PM
To: intel-wired-lan at lists.osuosl.org; Brown, Aaron F <[email protected]>; Kirsher, Jeffrey T <[email protected]>
Subject: [PATCH v2 4/4] igc: Refactor VLAN priority filtering code

The whole VLAN priority filtering code is implemented in igc_ethtool.c and mixes logic from ethtool and core parts. This patch refactors it so core logic is moved to igc_main.c, aligning the VLAN priority filtering code organization with the MAC address filtering code.

This patch also takes the opportunity to add some log messages to ease debugging.

Quoted 9 lines

---
v2: Previous version had a bug when clearing IGC_VLANPQF_QSEL bits in

    igc_del_vlan_prio_filter().
---
 drivers/net/ethernet/intel/igc/igc.h         |  3 +
 drivers/net/ethernet/intel/igc/igc_ethtool.c | 64 ++++----------------
 drivers/net/ethernet/intel/igc/igc_main.c    | 52 ++++++++++++++++
 3 files changed, 68 insertions(+), 51 deletions(-)