lkml.org 
[lkml]   [2019]   [Jun]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 5.1 22/98] net: ethtool: Allow matching on vlan DEI bit
    Date
    From: Maxime Chevallier <maxime.chevallier@bootlin.com>

    [ Upstream commit f0d2ca1531377e7da888913e277eefac05a59b6f ]

    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: eca4205f9ec3 ("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>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    ---
    include/net/flow_dissector.h | 1 +
    net/core/ethtool.c | 5 +++++
    2 files changed, 6 insertions(+)

    --- a/include/net/flow_dissector.h
    +++ b/include/net/flow_dissector.h
    @@ -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;
    };
    --- a/net/core/ethtool.c
    +++ b/net/core/ethtool.c
    @@ -3022,6 +3022,11 @@ ethtool_rx_flow_rule_create(const struct
    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 =

    \
     
     \ /
      Last update: 2019-06-20 20:20    [W:4.058 / U:0.744 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site