* [PATCH iwl-net] igc: Check VLAN EtherType mask
@ 2023-12-06 14:07 Kurt Kanzenbach
2023-12-07 1:26 ` Vinicius Costa Gomes
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Kurt Kanzenbach @ 2023-12-06 14:07 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, Suman Ghosh
Currently the driver accepts VLAN EtherType steering rules regardless of
the configured mask. And things might fail silently or with confusing error
messages to the user. The VLAN EtherType can only be matched by full
mask. Therefore, add a check for that.
For instance the following rule is invalid, but the driver accepts it and
ignores the user specified mask:
|root@host:~# ethtool -N enp3s0 flow-type ether vlan-etype 0x8100 \
| m 0x00ff 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
After:
|root@host:~# ethtool -N enp3s0 flow-type ether vlan-etype 0x8100 \
| m 0x00ff action 0
|rmgr: Cannot insert RX class rule: Operation not supported
Fixes: 2b477d057e33 ("igc: Integrate flex filter into ethtool ops")
Suggested-by: Suman Ghosh <sumang@marvell.com>
Signed-off-by: Kurt Kanzenbach <kurt@linutronix.de>
---
Note: This is a follow up of
https://lore.kernel.org/netdev/20231201075043.7822-1-kurt@linutronix.de/
and should apply to net-queue tree.
drivers/net/ethernet/intel/igc/igc_ethtool.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/drivers/net/ethernet/intel/igc/igc_ethtool.c b/drivers/net/ethernet/intel/igc/igc_ethtool.c
index b56b4f338bd3..859b2636f3d9 100644
--- a/drivers/net/ethernet/intel/igc/igc_ethtool.c
+++ b/drivers/net/ethernet/intel/igc/igc_ethtool.c
@@ -1357,6 +1357,14 @@ static int igc_ethtool_add_nfc_rule(struct igc_adapter *adapter,
return -EOPNOTSUPP;
}
+ /* VLAN EtherType can only be matched by full mask. */
+ if ((fsp->flow_type & FLOW_EXT) &&
+ fsp->m_ext.vlan_etype &&
+ fsp->m_ext.vlan_etype != ETHER_TYPE_FULL_MASK) {
+ netdev_dbg(netdev, "VLAN EtherType 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] 5+ messages in thread* Re: [PATCH iwl-net] igc: Check VLAN EtherType mask
2023-12-06 14:07 [PATCH iwl-net] igc: Check VLAN EtherType mask Kurt Kanzenbach
@ 2023-12-07 1:26 ` Vinicius Costa Gomes
2023-12-07 7:22 ` Kurt Kanzenbach
2023-12-10 11:50 ` Simon Horman
2023-12-26 17:01 ` [Intel-wired-lan] " naamax.meir
2 siblings, 1 reply; 5+ messages in thread
From: Vinicius Costa Gomes @ 2023-12-07 1:26 UTC (permalink / raw)
To: Kurt Kanzenbach, Jesse Brandeburg, Tony Nguyen
Cc: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
intel-wired-lan, netdev, Kurt Kanzenbach, Suman Ghosh
Kurt Kanzenbach <kurt@linutronix.de> writes:
> Currently the driver accepts VLAN EtherType steering rules regardless of
> the configured mask. And things might fail silently or with confusing error
> messages to the user. The VLAN EtherType can only be matched by full
> mask. Therefore, add a check for that.
>
> For instance the following rule is invalid, but the driver accepts it and
> ignores the user specified mask:
> |root@host:~# ethtool -N enp3s0 flow-type ether vlan-etype 0x8100 \
> | m 0x00ff 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
>
> After:
> |root@host:~# ethtool -N enp3s0 flow-type ether vlan-etype 0x8100 \
> | m 0x00ff action 0
> |rmgr: Cannot insert RX class rule: Operation not supported
>
> Fixes: 2b477d057e33 ("igc: Integrate flex filter into ethtool ops")
> Suggested-by: Suman Ghosh <sumang@marvell.com>
> Signed-off-by: Kurt Kanzenbach <kurt@linutronix.de>
> ---
I was just wondering if an alternative would be to use flex filters for
matching vlan-etype with a partial mask. But I don't think there's any
real use case for partial masks, better to reject them:
Acked-by: Vinicius Costa Gomes <vinicius.gomes@intel.com>
Cheers,
--
Vinicius
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH iwl-net] igc: Check VLAN EtherType mask
2023-12-07 1:26 ` Vinicius Costa Gomes
@ 2023-12-07 7:22 ` Kurt Kanzenbach
0 siblings, 0 replies; 5+ messages in thread
From: Kurt Kanzenbach @ 2023-12-07 7:22 UTC (permalink / raw)
To: Vinicius Costa Gomes, Jesse Brandeburg, Tony Nguyen
Cc: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
intel-wired-lan, netdev, Suman Ghosh
[-- Attachment #1: Type: text/plain, Size: 1820 bytes --]
On Wed Dec 06 2023, Vinicius Costa Gomes wrote:
> Kurt Kanzenbach <kurt@linutronix.de> writes:
>
>> Currently the driver accepts VLAN EtherType steering rules regardless of
>> the configured mask. And things might fail silently or with confusing error
>> messages to the user. The VLAN EtherType can only be matched by full
>> mask. Therefore, add a check for that.
>>
>> For instance the following rule is invalid, but the driver accepts it and
>> ignores the user specified mask:
>> |root@host:~# ethtool -N enp3s0 flow-type ether vlan-etype 0x8100 \
>> | m 0x00ff 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
>>
>> After:
>> |root@host:~# ethtool -N enp3s0 flow-type ether vlan-etype 0x8100 \
>> | m 0x00ff action 0
>> |rmgr: Cannot insert RX class rule: Operation not supported
>>
>> Fixes: 2b477d057e33 ("igc: Integrate flex filter into ethtool ops")
>> Suggested-by: Suman Ghosh <sumang@marvell.com>
>> Signed-off-by: Kurt Kanzenbach <kurt@linutronix.de>
>> ---
>
> I was just wondering if an alternative would be to use flex filters
> for matching vlan-etype with a partial mask. But I don't think
> there's any real use case for partial masks, better to reject them:
With flex filters it is possible to match by byte wise partial
masks. However, I also think there's no use case for it.
Thanks,
Kurt
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 861 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH iwl-net] igc: Check VLAN EtherType mask
2023-12-06 14:07 [PATCH iwl-net] igc: Check VLAN EtherType mask Kurt Kanzenbach
2023-12-07 1:26 ` Vinicius Costa Gomes
@ 2023-12-10 11:50 ` Simon Horman
2023-12-26 17:01 ` [Intel-wired-lan] " naamax.meir
2 siblings, 0 replies; 5+ messages in thread
From: Simon Horman @ 2023-12-10 11:50 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, Suman Ghosh
On Wed, Dec 06, 2023 at 03:07:18PM +0100, Kurt Kanzenbach wrote:
> Currently the driver accepts VLAN EtherType steering rules regardless of
> the configured mask. And things might fail silently or with confusing error
> messages to the user. The VLAN EtherType can only be matched by full
> mask. Therefore, add a check for that.
>
> For instance the following rule is invalid, but the driver accepts it and
> ignores the user specified mask:
> |root@host:~# ethtool -N enp3s0 flow-type ether vlan-etype 0x8100 \
> | m 0x00ff 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
>
> After:
> |root@host:~# ethtool -N enp3s0 flow-type ether vlan-etype 0x8100 \
> | m 0x00ff action 0
> |rmgr: Cannot insert RX class rule: Operation not supported
>
> Fixes: 2b477d057e33 ("igc: Integrate flex filter into ethtool ops")
> Suggested-by: Suman Ghosh <sumang@marvell.com>
> Signed-off-by: Kurt Kanzenbach <kurt@linutronix.de>
Reviewed-by: Simon Horman <horms@kernel.org>
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [Intel-wired-lan] [PATCH iwl-net] igc: Check VLAN EtherType mask
2023-12-06 14:07 [PATCH iwl-net] igc: Check VLAN EtherType mask Kurt Kanzenbach
2023-12-07 1:26 ` Vinicius Costa Gomes
2023-12-10 11:50 ` Simon Horman
@ 2023-12-26 17:01 ` naamax.meir
2 siblings, 0 replies; 5+ messages in thread
From: naamax.meir @ 2023-12-26 17:01 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, Suman Ghosh
On 12/6/2023 16:07, Kurt Kanzenbach wrote:
> Currently the driver accepts VLAN EtherType steering rules regardless of
> the configured mask. And things might fail silently or with confusing error
> messages to the user. The VLAN EtherType can only be matched by full
> mask. Therefore, add a check for that.
>
> For instance the following rule is invalid, but the driver accepts it and
> ignores the user specified mask:
> |root@host:~# ethtool -N enp3s0 flow-type ether vlan-etype 0x8100 \
> | m 0x00ff 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
>
> After:
> |root@host:~# ethtool -N enp3s0 flow-type ether vlan-etype 0x8100 \
> | m 0x00ff action 0
> |rmgr: Cannot insert RX class rule: Operation not supported
>
> Fixes: 2b477d057e33 ("igc: Integrate flex filter into ethtool ops")
> Suggested-by: Suman Ghosh <sumang@marvell.com>
> Signed-off-by: Kurt Kanzenbach <kurt@linutronix.de>
> ---
>
> Note: This is a follow up of
>
> https://lore.kernel.org/netdev/20231201075043.7822-1-kurt@linutronix.de/
>
> and should apply to net-queue tree.
>
> drivers/net/ethernet/intel/igc/igc_ethtool.c | 8 ++++++++
> 1 file changed, 8 insertions(+)
Tested-by: Naama Meir <naamax.meir@linux.intel.com>
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2023-12-26 17:02 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-12-06 14:07 [PATCH iwl-net] igc: Check VLAN EtherType mask Kurt Kanzenbach
2023-12-07 1:26 ` Vinicius Costa Gomes
2023-12-07 7:22 ` Kurt Kanzenbach
2023-12-10 11:50 ` Simon Horman
2023-12-26 17:01 ` [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).