Skip to content

Commit

Permalink
net: ethtool: Allow matching on vlan DEI bit
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Maxime Chevallier <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
minimaxwell authored and davem330 committed Jun 12, 2019
1 parent bb2e05e commit f0d2ca1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions include/net/flow_dissector.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ struct flow_dissector_key_tags {

struct flow_dissector_key_vlan {
u16 vlan_id:12,
vlan_dei:1,
vlan_priority:3;
__be16 vlan_tpid;
};
Expand Down
5 changes: 5 additions & 0 deletions net/core/ethtool.c
Original file line number Diff line number Diff line change
Expand Up @@ -3020,6 +3020,11 @@ ethtool_rx_flow_rule_create(const struct ethtool_rx_flow_spec_input *input)
match->mask.vlan.vlan_id =
ntohs(ext_m_spec->vlan_tci) & 0x0fff;

match->key.vlan.vlan_dei =
!!(ext_h_spec->vlan_tci & htons(0x1000));
match->mask.vlan.vlan_dei =
!!(ext_m_spec->vlan_tci & htons(0x1000));

match->key.vlan.vlan_priority =
(ntohs(ext_h_spec->vlan_tci) & 0xe000) >> 13;
match->mask.vlan.vlan_priority =
Expand Down

0 comments on commit f0d2ca1

Please sign in to comment.