netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH iwl-net v2 0/2] igc: ethtool: Check VLAN TCI mask
@ 2023-12-01  7:50 Kurt Kanzenbach
  2023-12-01  7:50 ` [PATCH iwl-net v2 1/2] igc: Report VLAN EtherType matching back to user Kurt Kanzenbach
  2023-12-01  7:50 ` [PATCH iwl-net v2 2/2] igc: Check VLAN TCI mask Kurt Kanzenbach
  0 siblings, 2 replies; 11+ messages in thread
From: Kurt Kanzenbach @ 2023-12-01  7:50 UTC (permalink / raw)
  To: Jesse Brandeburg, Tony Nguyen, Vinicius Costa Gomes
  Cc: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	intel-wired-lan, netdev, Kurt Kanzenbach

Hi,

currently it is possible to configure receive queue assignment using the VLAN
TCI field with arbitrary masks. However, the hardware only supports steering
either by full TCI or the priority (PCP) field. In case a wrong mask is given by
the user the driver will silently convert it into a PCP filter which is not
desired. Therefore, add a check for it.

Patch #1 is a minor thing found along the way.

Changes since v1:

 - Split patches 4 and 5 for -net
 - Rebase to -net
 - Wrap commit message at 75 chars
 - Add Ack from Vinicius

Previous versions:

 - https://lore.kernel.org/netdev/20231128074849.16863-1-kurt@linutronix.de/

Kurt Kanzenbach (2):
  igc: Report VLAN EtherType matching back to user
  igc: Check VLAN TCI mask

 drivers/net/ethernet/intel/igc/igc.h         |  1 +
 drivers/net/ethernet/intel/igc/igc_ethtool.c | 34 ++++++++++++++++++--
 2 files changed, 32 insertions(+), 3 deletions(-)

-- 
2.39.2


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH iwl-net v2 1/2] igc: Report VLAN EtherType matching back to user
  2023-12-01  7:50 [PATCH iwl-net v2 0/2] igc: ethtool: Check VLAN TCI mask Kurt Kanzenbach
@ 2023-12-01  7:50 ` Kurt Kanzenbach
  2023-12-01  9:55   ` [EXT] " Suman Ghosh
                     ` (2 more replies)
  2023-12-01  7:50 ` [PATCH iwl-net v2 2/2] igc: Check VLAN TCI mask Kurt Kanzenbach
  1 sibling, 3 replies; 11+ messages in thread
From: Kurt Kanzenbach @ 2023-12-01  7:50 UTC (permalink / raw)
  To: Jesse Brandeburg, Tony Nguyen, Vinicius Costa Gomes
  Cc: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	intel-wired-lan, netdev, Kurt Kanzenbach

Currently the driver allows to configure matching by VLAN EtherType.
However, the retrieval function does not report it back to the user. Add
it.

Before:
|root@host:~# ethtool -N enp3s0 flow-type ether vlan-etype 0x8100 action 0
|Added rule with ID 63
|root@host:~# ethtool --show-ntuple enp3s0
|4 RX rings available
|Total 1 rules
|
|Filter: 63
|        Flow Type: Raw Ethernet
|        Src MAC addr: 00:00:00:00:00:00 mask: FF:FF:FF:FF:FF:FF
|        Dest MAC addr: 00:00:00:00:00:00 mask: FF:FF:FF:FF:FF:FF
|        Ethertype: 0x0 mask: 0xFFFF
|        Action: Direct to queue 0

After:
|root@host:~# ethtool -N enp3s0 flow-type ether vlan-etype 0x8100 action 0
|Added rule with ID 63
|root@host:~# ethtool --show-ntuple enp3s0
|4 RX rings available
|Total 1 rules
|
|Filter: 63
|        Flow Type: Raw Ethernet
|        Src MAC addr: 00:00:00:00:00:00 mask: FF:FF:FF:FF:FF:FF
|        Dest MAC addr: 00:00:00:00:00:00 mask: FF:FF:FF:FF:FF:FF
|        Ethertype: 0x0 mask: 0xFFFF
|        VLAN EtherType: 0x8100 mask: 0x0
|        VLAN: 0x0 mask: 0xffff
|        User-defined: 0x0 mask: 0xffffffffffffffff
|        Action: Direct to queue 0

Fixes: 2b477d057e33 ("igc: Integrate flex filter into ethtool ops")
Signed-off-by: Kurt Kanzenbach <kurt@linutronix.de>
Acked-by: Vinicius Costa Gomes <vinicius.gomes@intel.com>
---
 drivers/net/ethernet/intel/igc/igc_ethtool.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/net/ethernet/intel/igc/igc_ethtool.c b/drivers/net/ethernet/intel/igc/igc_ethtool.c
index 785eaa8e0ba8..69b2fd006293 100644
--- a/drivers/net/ethernet/intel/igc/igc_ethtool.c
+++ b/drivers/net/ethernet/intel/igc/igc_ethtool.c
@@ -980,6 +980,12 @@ static int igc_ethtool_get_nfc_rule(struct igc_adapter *adapter,
 		fsp->m_u.ether_spec.h_proto = ETHER_TYPE_FULL_MASK;
 	}
 
+	if (rule->filter.match_flags & IGC_FILTER_FLAG_VLAN_ETYPE) {
+		fsp->flow_type |= FLOW_EXT;
+		fsp->h_ext.vlan_etype = rule->filter.vlan_etype;
+		fsp->m_ext.vlan_etype = ETHER_TYPE_FULL_MASK;
+	}
+
 	if (rule->filter.match_flags & IGC_FILTER_FLAG_VLAN_TCI) {
 		fsp->flow_type |= FLOW_EXT;
 		fsp->h_ext.vlan_tci = htons(rule->filter.vlan_tci);
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH iwl-net v2 2/2] igc: Check VLAN TCI mask
  2023-12-01  7:50 [PATCH iwl-net v2 0/2] igc: ethtool: Check VLAN TCI mask Kurt Kanzenbach
  2023-12-01  7:50 ` [PATCH iwl-net v2 1/2] igc: Report VLAN EtherType matching back to user Kurt Kanzenbach
@ 2023-12-01  7:50 ` Kurt Kanzenbach
  2023-12-10 11:51   ` Simon Horman
  2023-12-26 10:49   ` [Intel-wired-lan] " naamax.meir
  1 sibling, 2 replies; 11+ messages in thread
From: Kurt Kanzenbach @ 2023-12-01  7:50 UTC (permalink / raw)
  To: Jesse Brandeburg, Tony Nguyen, Vinicius Costa Gomes
  Cc: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	intel-wired-lan, netdev, Kurt Kanzenbach

Currently the driver accepts VLAN TCI steering rules regardless of the
configured mask. And things might fail silently or with confusing error
messages to the user.

There are two ways to handle the VLAN TCI mask:

 1. Match on the PCP field using a VLAN prio filter
 2. Match on complete TCI field using a flex filter

Therefore, add checks and code for that.

For instance the following rule is invalid and will be converted into a
VLAN prio rule which is not correct:
|root@host:~# ethtool -N enp3s0 flow-type ether vlan 0x0001 m 0xf000 \
|             action 1
|Added rule with ID 61
|root@host:~# ethtool --show-ntuple enp3s0
|4 RX rings available
|Total 1 rules
|
|Filter: 61
|        Flow Type: Raw Ethernet
|        Src MAC addr: 00:00:00:00:00:00 mask: FF:FF:FF:FF:FF:FF
|        Dest MAC addr: 00:00:00:00:00:00 mask: FF:FF:FF:FF:FF:FF
|        Ethertype: 0x0 mask: 0xFFFF
|        VLAN EtherType: 0x0 mask: 0xffff
|        VLAN: 0x1 mask: 0x1fff
|        User-defined: 0x0 mask: 0xffffffffffffffff
|        Action: Direct to queue 1

After:
|root@host:~# ethtool -N enp3s0 flow-type ether vlan 0x0001 m 0xf000 \
|             action 1
|rmgr: Cannot insert RX class rule: Operation not supported

Fixes: 7991487ecb2d ("igc: Allow for Flex Filters to be installed")
Signed-off-by: Kurt Kanzenbach <kurt@linutronix.de>
Acked-by: Vinicius Costa Gomes <vinicius.gomes@intel.com>
---
 drivers/net/ethernet/intel/igc/igc.h         |  1 +
 drivers/net/ethernet/intel/igc/igc_ethtool.c | 28 +++++++++++++++++---
 2 files changed, 26 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/intel/igc/igc.h b/drivers/net/ethernet/intel/igc/igc.h
index f48f82d5e274..85cc16396506 100644
--- a/drivers/net/ethernet/intel/igc/igc.h
+++ b/drivers/net/ethernet/intel/igc/igc.h
@@ -568,6 +568,7 @@ struct igc_nfc_filter {
 	u16 etype;
 	__be16 vlan_etype;
 	u16 vlan_tci;
+	u16 vlan_tci_mask;
 	u8 src_addr[ETH_ALEN];
 	u8 dst_addr[ETH_ALEN];
 	u8 user_data[8];
diff --git a/drivers/net/ethernet/intel/igc/igc_ethtool.c b/drivers/net/ethernet/intel/igc/igc_ethtool.c
index 69b2fd006293..b56b4f338bd3 100644
--- a/drivers/net/ethernet/intel/igc/igc_ethtool.c
+++ b/drivers/net/ethernet/intel/igc/igc_ethtool.c
@@ -958,6 +958,7 @@ static int igc_ethtool_set_coalesce(struct net_device *netdev,
 }
 
 #define ETHER_TYPE_FULL_MASK ((__force __be16)~0)
+#define VLAN_TCI_FULL_MASK ((__force __be16)~0)
 static int igc_ethtool_get_nfc_rule(struct igc_adapter *adapter,
 				    struct ethtool_rxnfc *cmd)
 {
@@ -989,7 +990,7 @@ static int igc_ethtool_get_nfc_rule(struct igc_adapter *adapter,
 	if (rule->filter.match_flags & IGC_FILTER_FLAG_VLAN_TCI) {
 		fsp->flow_type |= FLOW_EXT;
 		fsp->h_ext.vlan_tci = htons(rule->filter.vlan_tci);
-		fsp->m_ext.vlan_tci = htons(VLAN_PRIO_MASK);
+		fsp->m_ext.vlan_tci = htons(rule->filter.vlan_tci_mask);
 	}
 
 	if (rule->filter.match_flags & IGC_FILTER_FLAG_DST_MAC_ADDR) {
@@ -1224,6 +1225,7 @@ static void igc_ethtool_init_nfc_rule(struct igc_nfc_rule *rule,
 
 	if ((fsp->flow_type & FLOW_EXT) && fsp->m_ext.vlan_tci) {
 		rule->filter.vlan_tci = ntohs(fsp->h_ext.vlan_tci);
+		rule->filter.vlan_tci_mask = ntohs(fsp->m_ext.vlan_tci);
 		rule->filter.match_flags |= IGC_FILTER_FLAG_VLAN_TCI;
 	}
 
@@ -1261,11 +1263,19 @@ static void igc_ethtool_init_nfc_rule(struct igc_nfc_rule *rule,
 		memcpy(rule->filter.user_mask, fsp->m_ext.data, sizeof(fsp->m_ext.data));
 	}
 
-	/* When multiple filter options or user data or vlan etype is set, use a
-	 * flex filter.
+	/* The i225/i226 has various different filters. Flex filters provide a
+	 * way to match up to the first 128 bytes of a packet. Use them for:
+	 *   a) For specific user data
+	 *   b) For VLAN EtherType
+	 *   c) For full TCI match
+	 *   d) Or in case multiple filter criteria are set
+	 *
+	 * Otherwise, use the simple MAC, VLAN PRIO or EtherType filters.
 	 */
 	if ((rule->filter.match_flags & IGC_FILTER_FLAG_USER_DATA) ||
 	    (rule->filter.match_flags & IGC_FILTER_FLAG_VLAN_ETYPE) ||
+	    ((rule->filter.match_flags & IGC_FILTER_FLAG_VLAN_TCI) &&
+	     rule->filter.vlan_tci_mask == ntohs(VLAN_TCI_FULL_MASK)) ||
 	    (rule->filter.match_flags & (rule->filter.match_flags - 1)))
 		rule->flex = true;
 	else
@@ -1335,6 +1345,18 @@ static int igc_ethtool_add_nfc_rule(struct igc_adapter *adapter,
 		return -EINVAL;
 	}
 
+	/* There are two ways to match the VLAN TCI:
+	 *  1. Match on PCP field and use vlan prio filter for it
+	 *  2. Match on complete TCI field and use flex filter for it
+	 */
+	if ((fsp->flow_type & FLOW_EXT) &&
+	    fsp->m_ext.vlan_tci &&
+	    fsp->m_ext.vlan_tci != htons(VLAN_PRIO_MASK) &&
+	    fsp->m_ext.vlan_tci != VLAN_TCI_FULL_MASK) {
+		netdev_dbg(netdev, "VLAN mask not supported\n");
+		return -EOPNOTSUPP;
+	}
+
 	if (fsp->location >= IGC_MAX_RXNFC_RULES) {
 		netdev_dbg(netdev, "Invalid location\n");
 		return -EINVAL;
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* RE: [EXT] [PATCH iwl-net v2 1/2] igc: Report VLAN EtherType matching back to user
  2023-12-01  7:50 ` [PATCH iwl-net v2 1/2] igc: Report VLAN EtherType matching back to user Kurt Kanzenbach
@ 2023-12-01  9:55   ` Suman Ghosh
  2023-12-01 13:31     ` Kurt Kanzenbach
  2023-12-01 16:16     ` Suman Ghosh
  2023-12-10 11:51   ` Simon Horman
  2023-12-25  9:47   ` [Intel-wired-lan] " naamax.meir
  2 siblings, 2 replies; 11+ messages in thread
From: Suman Ghosh @ 2023-12-01  9:55 UTC (permalink / raw)
  To: Kurt Kanzenbach, Jesse Brandeburg, Tony Nguyen,
	Vinicius Costa Gomes
  Cc: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	intel-wired-lan@lists.osuosl.org, netdev@vger.kernel.org

Hi Kurt,


>+	if (rule->filter.match_flags & IGC_FILTER_FLAG_VLAN_ETYPE) {
>+		fsp->flow_type |= FLOW_EXT;
>+		fsp->h_ext.vlan_etype = rule->filter.vlan_etype;
>+		fsp->m_ext.vlan_etype = ETHER_TYPE_FULL_MASK;
[Suman] User can provide mask for vlan-etype as well. Why not take that rather than hard coding it? I checked you are already doing the same for TCI in the other patch.
>+	}
>+
> 	if (rule->filter.match_flags & IGC_FILTER_FLAG_VLAN_TCI) {
> 		fsp->flow_type |= FLOW_EXT;
> 		fsp->h_ext.vlan_tci = htons(rule->filter.vlan_tci);
>--
>2.39.2
>


^ permalink raw reply	[flat|nested] 11+ messages in thread

* RE: [EXT] [PATCH iwl-net v2 1/2] igc: Report VLAN EtherType matching back to user
  2023-12-01  9:55   ` [EXT] " Suman Ghosh
@ 2023-12-01 13:31     ` Kurt Kanzenbach
  2023-12-01 16:16     ` Suman Ghosh
  1 sibling, 0 replies; 11+ messages in thread
From: Kurt Kanzenbach @ 2023-12-01 13:31 UTC (permalink / raw)
  To: Suman Ghosh, Jesse Brandeburg, Tony Nguyen, Vinicius Costa Gomes
  Cc: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	intel-wired-lan@lists.osuosl.org, netdev@vger.kernel.org

[-- Attachment #1: Type: text/plain, Size: 616 bytes --]

Hi Suman,

On Fri Dec 01 2023, Suman Ghosh wrote:
> Hi Kurt,
>
>
>>+	if (rule->filter.match_flags & IGC_FILTER_FLAG_VLAN_ETYPE) {
>>+		fsp->flow_type |= FLOW_EXT;
>>+		fsp->h_ext.vlan_etype = rule->filter.vlan_etype;
>>+		fsp->m_ext.vlan_etype = ETHER_TYPE_FULL_MASK;
> [Suman] User can provide mask for vlan-etype as well. Why not take
> that rather than hard coding it? I checked you are already doing the
> same for TCI in the other patch.

Currently the driver allows/supports to match the VLAN EtherType only by
full mask. That is different from TCI, where two different mask values
are possible.

Thanks,
Kurt

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 861 bytes --]

^ permalink raw reply	[flat|nested] 11+ messages in thread

* RE: [EXT] [PATCH iwl-net v2 1/2] igc: Report VLAN EtherType matching back to user
  2023-12-01  9:55   ` [EXT] " Suman Ghosh
  2023-12-01 13:31     ` Kurt Kanzenbach
@ 2023-12-01 16:16     ` Suman Ghosh
  2023-12-06  7:45       ` Kurt Kanzenbach
  1 sibling, 1 reply; 11+ messages in thread
From: Suman Ghosh @ 2023-12-01 16:16 UTC (permalink / raw)
  To: Kurt Kanzenbach, Jesse Brandeburg, Tony Nguyen,
	Vinicius Costa Gomes
  Cc: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	netdev@vger.kernel.org

>Hi Kurt,
>
>
>>+	if (rule->filter.match_flags & IGC_FILTER_FLAG_VLAN_ETYPE) {
>>+		fsp->flow_type |= FLOW_EXT;
>>+		fsp->h_ext.vlan_etype = rule->filter.vlan_etype;
>>+		fsp->m_ext.vlan_etype = ETHER_TYPE_FULL_MASK;
>[Suman] User can provide mask for vlan-etype as well. Why not take that
>rather than hard coding it? I checked you are already doing the same for
>TCI in the other patch.

Currently the driver allows/supports to match the VLAN EtherType only by
full mask. That is different from TCI, where two different mask values
are possible.

Thanks,
Kurt
>>+	}
[Suman] It is up to you. But I feel, in that case we should have some checks to reject the ntuple rule if user is providing some valid mask value. Otherwise, there will be mismatch between user expectation and driver functionality.
>>+
>> 	if (rule->filter.match_flags & IGC_FILTER_FLAG_VLAN_TCI) {
>> 		fsp->flow_type |= FLOW_EXT;
>> 		fsp->h_ext.vlan_tci = htons(rule->filter.vlan_tci);
>>--
>>2.39.2
>>


^ permalink raw reply	[flat|nested] 11+ messages in thread

* RE: [EXT] [PATCH iwl-net v2 1/2] igc: Report VLAN EtherType matching back to user
  2023-12-01 16:16     ` Suman Ghosh
@ 2023-12-06  7:45       ` Kurt Kanzenbach
  0 siblings, 0 replies; 11+ messages in thread
From: Kurt Kanzenbach @ 2023-12-06  7:45 UTC (permalink / raw)
  To: Suman Ghosh, Jesse Brandeburg, Tony Nguyen, Vinicius Costa Gomes
  Cc: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	netdev@vger.kernel.org

[-- Attachment #1: Type: text/plain, Size: 386 bytes --]

> [Suman] It is up to you. But I feel, in that case we should have some
> checks to reject the ntuple rule if user is providing some valid mask
> value.

Sure. That's another issue and deserves a separate patch.

> Otherwise, there will be mismatch between user expectation and
> driver functionality.

Yeah, it's the whole point of series to improve the user experience.

Thanks,
Kurt

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 861 bytes --]

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH iwl-net v2 1/2] igc: Report VLAN EtherType matching back to user
  2023-12-01  7:50 ` [PATCH iwl-net v2 1/2] igc: Report VLAN EtherType matching back to user Kurt Kanzenbach
  2023-12-01  9:55   ` [EXT] " Suman Ghosh
@ 2023-12-10 11:51   ` Simon Horman
  2023-12-25  9:47   ` [Intel-wired-lan] " naamax.meir
  2 siblings, 0 replies; 11+ messages in thread
From: Simon Horman @ 2023-12-10 11:51 UTC (permalink / raw)
  To: Kurt Kanzenbach
  Cc: Jesse Brandeburg, Tony Nguyen, Vinicius Costa Gomes,
	David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	intel-wired-lan, netdev

On Fri, Dec 01, 2023 at 08:50:42AM +0100, Kurt Kanzenbach wrote:
> Currently the driver allows to configure matching by VLAN EtherType.
> However, the retrieval function does not report it back to the user. Add
> it.
> 
> Before:
> |root@host:~# ethtool -N enp3s0 flow-type ether vlan-etype 0x8100 action 0
> |Added rule with ID 63
> |root@host:~# ethtool --show-ntuple enp3s0
> |4 RX rings available
> |Total 1 rules
> |
> |Filter: 63
> |        Flow Type: Raw Ethernet
> |        Src MAC addr: 00:00:00:00:00:00 mask: FF:FF:FF:FF:FF:FF
> |        Dest MAC addr: 00:00:00:00:00:00 mask: FF:FF:FF:FF:FF:FF
> |        Ethertype: 0x0 mask: 0xFFFF
> |        Action: Direct to queue 0
> 
> After:
> |root@host:~# ethtool -N enp3s0 flow-type ether vlan-etype 0x8100 action 0
> |Added rule with ID 63
> |root@host:~# ethtool --show-ntuple enp3s0
> |4 RX rings available
> |Total 1 rules
> |
> |Filter: 63
> |        Flow Type: Raw Ethernet
> |        Src MAC addr: 00:00:00:00:00:00 mask: FF:FF:FF:FF:FF:FF
> |        Dest MAC addr: 00:00:00:00:00:00 mask: FF:FF:FF:FF:FF:FF
> |        Ethertype: 0x0 mask: 0xFFFF
> |        VLAN EtherType: 0x8100 mask: 0x0
> |        VLAN: 0x0 mask: 0xffff
> |        User-defined: 0x0 mask: 0xffffffffffffffff
> |        Action: Direct to queue 0
> 
> Fixes: 2b477d057e33 ("igc: Integrate flex filter into ethtool ops")
> Signed-off-by: Kurt Kanzenbach <kurt@linutronix.de>
> Acked-by: Vinicius Costa Gomes <vinicius.gomes@intel.com>

Reviewed-by: Simon Horman <horms@kernel.org>


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH iwl-net v2 2/2] igc: Check VLAN TCI mask
  2023-12-01  7:50 ` [PATCH iwl-net v2 2/2] igc: Check VLAN TCI mask Kurt Kanzenbach
@ 2023-12-10 11:51   ` Simon Horman
  2023-12-26 10:49   ` [Intel-wired-lan] " naamax.meir
  1 sibling, 0 replies; 11+ messages in thread
From: Simon Horman @ 2023-12-10 11:51 UTC (permalink / raw)
  To: Kurt Kanzenbach
  Cc: Jesse Brandeburg, Tony Nguyen, Vinicius Costa Gomes,
	David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	intel-wired-lan, netdev

On Fri, Dec 01, 2023 at 08:50:43AM +0100, Kurt Kanzenbach wrote:
> Currently the driver accepts VLAN TCI steering rules regardless of the
> configured mask. And things might fail silently or with confusing error
> messages to the user.
> 
> There are two ways to handle the VLAN TCI mask:
> 
>  1. Match on the PCP field using a VLAN prio filter
>  2. Match on complete TCI field using a flex filter
> 
> Therefore, add checks and code for that.
> 
> For instance the following rule is invalid and will be converted into a
> VLAN prio rule which is not correct:
> |root@host:~# ethtool -N enp3s0 flow-type ether vlan 0x0001 m 0xf000 \
> |             action 1
> |Added rule with ID 61
> |root@host:~# ethtool --show-ntuple enp3s0
> |4 RX rings available
> |Total 1 rules
> |
> |Filter: 61
> |        Flow Type: Raw Ethernet
> |        Src MAC addr: 00:00:00:00:00:00 mask: FF:FF:FF:FF:FF:FF
> |        Dest MAC addr: 00:00:00:00:00:00 mask: FF:FF:FF:FF:FF:FF
> |        Ethertype: 0x0 mask: 0xFFFF
> |        VLAN EtherType: 0x0 mask: 0xffff
> |        VLAN: 0x1 mask: 0x1fff
> |        User-defined: 0x0 mask: 0xffffffffffffffff
> |        Action: Direct to queue 1
> 
> After:
> |root@host:~# ethtool -N enp3s0 flow-type ether vlan 0x0001 m 0xf000 \
> |             action 1
> |rmgr: Cannot insert RX class rule: Operation not supported
> 
> Fixes: 7991487ecb2d ("igc: Allow for Flex Filters to be installed")
> Signed-off-by: Kurt Kanzenbach <kurt@linutronix.de>
> Acked-by: Vinicius Costa Gomes <vinicius.gomes@intel.com>

Reviewed-by: Simon Horman <horms@kernel.org>


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [Intel-wired-lan] [PATCH iwl-net v2 1/2] igc: Report VLAN EtherType matching back to user
  2023-12-01  7:50 ` [PATCH iwl-net v2 1/2] igc: Report VLAN EtherType matching back to user Kurt Kanzenbach
  2023-12-01  9:55   ` [EXT] " Suman Ghosh
  2023-12-10 11:51   ` Simon Horman
@ 2023-12-25  9:47   ` naamax.meir
  2 siblings, 0 replies; 11+ messages in thread
From: naamax.meir @ 2023-12-25  9:47 UTC (permalink / raw)
  To: Kurt Kanzenbach, Jesse Brandeburg, Tony Nguyen,
	Vinicius Costa Gomes
  Cc: netdev, Eric Dumazet, intel-wired-lan, Jakub Kicinski,
	Paolo Abeni, David S. Miller

On 12/1/2023 09:50, Kurt Kanzenbach wrote:
> Currently the driver allows to configure matching by VLAN EtherType.
> However, the retrieval function does not report it back to the user. Add
> it.
> 
> Before:
> |root@host:~# ethtool -N enp3s0 flow-type ether vlan-etype 0x8100 action 0
> |Added rule with ID 63
> |root@host:~# ethtool --show-ntuple enp3s0
> |4 RX rings available
> |Total 1 rules
> |
> |Filter: 63
> |        Flow Type: Raw Ethernet
> |        Src MAC addr: 00:00:00:00:00:00 mask: FF:FF:FF:FF:FF:FF
> |        Dest MAC addr: 00:00:00:00:00:00 mask: FF:FF:FF:FF:FF:FF
> |        Ethertype: 0x0 mask: 0xFFFF
> |        Action: Direct to queue 0
> 
> After:
> |root@host:~# ethtool -N enp3s0 flow-type ether vlan-etype 0x8100 action 0
> |Added rule with ID 63
> |root@host:~# ethtool --show-ntuple enp3s0
> |4 RX rings available
> |Total 1 rules
> |
> |Filter: 63
> |        Flow Type: Raw Ethernet
> |        Src MAC addr: 00:00:00:00:00:00 mask: FF:FF:FF:FF:FF:FF
> |        Dest MAC addr: 00:00:00:00:00:00 mask: FF:FF:FF:FF:FF:FF
> |        Ethertype: 0x0 mask: 0xFFFF
> |        VLAN EtherType: 0x8100 mask: 0x0
> |        VLAN: 0x0 mask: 0xffff
> |        User-defined: 0x0 mask: 0xffffffffffffffff
> |        Action: Direct to queue 0
> 
> Fixes: 2b477d057e33 ("igc: Integrate flex filter into ethtool ops")
> Signed-off-by: Kurt Kanzenbach <kurt@linutronix.de>
> Acked-by: Vinicius Costa Gomes <vinicius.gomes@intel.com>
> ---
>   drivers/net/ethernet/intel/igc/igc_ethtool.c | 6 ++++++
>   1 file changed, 6 insertions(+)

Tested-by: Naama Meir <naamax.meir@linux.intel.com>

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [Intel-wired-lan] [PATCH iwl-net v2 2/2] igc: Check VLAN TCI mask
  2023-12-01  7:50 ` [PATCH iwl-net v2 2/2] igc: Check VLAN TCI mask Kurt Kanzenbach
  2023-12-10 11:51   ` Simon Horman
@ 2023-12-26 10:49   ` naamax.meir
  1 sibling, 0 replies; 11+ messages in thread
From: naamax.meir @ 2023-12-26 10:49 UTC (permalink / raw)
  To: Kurt Kanzenbach, Jesse Brandeburg, Tony Nguyen,
	Vinicius Costa Gomes
  Cc: netdev, Eric Dumazet, intel-wired-lan, Jakub Kicinski,
	Paolo Abeni, David S. Miller

On 12/1/2023 09:50, Kurt Kanzenbach wrote:
> Currently the driver accepts VLAN TCI steering rules regardless of the
> configured mask. And things might fail silently or with confusing error
> messages to the user.
> 
> There are two ways to handle the VLAN TCI mask:
> 
>   1. Match on the PCP field using a VLAN prio filter
>   2. Match on complete TCI field using a flex filter
> 
> Therefore, add checks and code for that.
> 
> For instance the following rule is invalid and will be converted into a
> VLAN prio rule which is not correct:
> |root@host:~# ethtool -N enp3s0 flow-type ether vlan 0x0001 m 0xf000 \
> |             action 1
> |Added rule with ID 61
> |root@host:~# ethtool --show-ntuple enp3s0
> |4 RX rings available
> |Total 1 rules
> |
> |Filter: 61
> |        Flow Type: Raw Ethernet
> |        Src MAC addr: 00:00:00:00:00:00 mask: FF:FF:FF:FF:FF:FF
> |        Dest MAC addr: 00:00:00:00:00:00 mask: FF:FF:FF:FF:FF:FF
> |        Ethertype: 0x0 mask: 0xFFFF
> |        VLAN EtherType: 0x0 mask: 0xffff
> |        VLAN: 0x1 mask: 0x1fff
> |        User-defined: 0x0 mask: 0xffffffffffffffff
> |        Action: Direct to queue 1
> 
> After:
> |root@host:~# ethtool -N enp3s0 flow-type ether vlan 0x0001 m 0xf000 \
> |             action 1
> |rmgr: Cannot insert RX class rule: Operation not supported
> 
> Fixes: 7991487ecb2d ("igc: Allow for Flex Filters to be installed")
> Signed-off-by: Kurt Kanzenbach <kurt@linutronix.de>
> Acked-by: Vinicius Costa Gomes <vinicius.gomes@intel.com>
> ---
>   drivers/net/ethernet/intel/igc/igc.h         |  1 +
>   drivers/net/ethernet/intel/igc/igc_ethtool.c | 28 +++++++++++++++++---
>   2 files changed, 26 insertions(+), 3 deletions(-)

Tested-by: Naama Meir <naamax.meir@linux.intel.com>

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2023-12-26 10:49 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-12-01  7:50 [PATCH iwl-net v2 0/2] igc: ethtool: Check VLAN TCI mask Kurt Kanzenbach
2023-12-01  7:50 ` [PATCH iwl-net v2 1/2] igc: Report VLAN EtherType matching back to user Kurt Kanzenbach
2023-12-01  9:55   ` [EXT] " Suman Ghosh
2023-12-01 13:31     ` Kurt Kanzenbach
2023-12-01 16:16     ` Suman Ghosh
2023-12-06  7:45       ` Kurt Kanzenbach
2023-12-10 11:51   ` Simon Horman
2023-12-25  9:47   ` [Intel-wired-lan] " naamax.meir
2023-12-01  7:50 ` [PATCH iwl-net v2 2/2] igc: Check VLAN TCI mask Kurt Kanzenbach
2023-12-10 11:51   ` Simon Horman
2023-12-26 10:49   ` [Intel-wired-lan] " naamax.meir

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).