Skip to content

Commit f0d2ca1

Browse files
minimaxwelldavem330
authored andcommitted
net: ethtool: Allow matching on vlan DEI bit
Using ethtool, users can specify a classification action matching on the full vlan tag, which includes the DEI bit (also previously called CFI). However, when converting the ethool_flow_spec to a flow_rule, we use dissector keys to represent the matching patterns. Since the vlan dissector key doesn't include the DEI bit, this information was silently discarded when translating the ethtool flow spec in to a flow_rule. This commit adds the DEI bit into the vlan dissector key, and allows propagating the information to the driver when parsing the ethtool flow spec. Fixes: eca4205 ("ethtool: add ethtool_rx_flow_spec to flow_rule structure translator") Reported-by: Michał Mirosław <mirq-linux@rere.qmqm.pl> Signed-off-by: Maxime Chevallier <maxime.chevallier@bootlin.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent bb2e05e commit f0d2ca1

2 files changed

Lines changed: 6 additions & 0 deletions

File tree

‎include/net/flow_dissector.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ struct flow_dissector_key_tags {
4646

4747
struct flow_dissector_key_vlan {
4848
u16 vlan_id:12,
49+
vlan_dei:1,
4950
vlan_priority:3;
5051
__be16 vlan_tpid;
5152
};

‎net/core/ethtool.c‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3020,6 +3020,11 @@ ethtool_rx_flow_rule_create(const struct ethtool_rx_flow_spec_input *input)
30203020
match->mask.vlan.vlan_id =
30213021
ntohs(ext_m_spec->vlan_tci) & 0x0fff;
30223022

3023+
match->key.vlan.vlan_dei =
3024+
!!(ext_h_spec->vlan_tci & htons(0x1000));
3025+
match->mask.vlan.vlan_dei =
3026+
!!(ext_m_spec->vlan_tci & htons(0x1000));
3027+
30233028
match->key.vlan.vlan_priority =
30243029
(ntohs(ext_h_spec->vlan_tci) & 0xe000) >> 13;
30253030
match->mask.vlan.vlan_priority =

0 commit comments

Comments
 (0)