Skip to content

Commit 7afd49a

Browse files
shifty91anguy11
authored andcommitted
igc: Check VLAN EtherType mask
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: 2b477d0 ("igc: Integrate flex filter into ethtool ops") Suggested-by: Suman Ghosh <sumang@marvell.com> Signed-off-by: Kurt Kanzenbach <kurt@linutronix.de> Acked-by: Vinicius Costa Gomes <vinicius.gomes@intel.com> Reviewed-by: Simon Horman <horms@kernel.org> Tested-by: Naama Meir <naamax.meir@linux.intel.com> Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
1 parent b5063cb commit 7afd49a

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

drivers/net/ethernet/intel/igc/igc_ethtool.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1357,6 +1357,14 @@ static int igc_ethtool_add_nfc_rule(struct igc_adapter *adapter,
13571357
return -EOPNOTSUPP;
13581358
}
13591359

1360+
/* VLAN EtherType can only be matched by full mask. */
1361+
if ((fsp->flow_type & FLOW_EXT) &&
1362+
fsp->m_ext.vlan_etype &&
1363+
fsp->m_ext.vlan_etype != ETHER_TYPE_FULL_MASK) {
1364+
netdev_dbg(netdev, "VLAN EtherType mask not supported\n");
1365+
return -EOPNOTSUPP;
1366+
}
1367+
13601368
if (fsp->location >= IGC_MAX_RXNFC_RULES) {
13611369
netdev_dbg(netdev, "Invalid location\n");
13621370
return -EINVAL;

0 commit comments

Comments
 (0)