Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp4630679ybi; Tue, 11 Jun 2019 09:44:18 -0700 (PDT) X-Google-Smtp-Source: APXvYqzB6g+apzFr8Aewn/TXmEPPuqagOUNRc82Qz5mntq8jKI/8xBQdmQx3gjMN5Ph4P0o5wmHN X-Received: by 2002:a17:902:15c5:: with SMTP id a5mr78104812plh.39.1560271458787; Tue, 11 Jun 2019 09:44:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560271458; cv=none; d=google.com; s=arc-20160816; b=SLc6Yz7jNLTyIHEBaYlMuaxu0EfI5MXELLIDMTSESx7jDL3pfoVzCYeY1vxktEiG+L cgbY3WDp1LTJYmlJxo5LwyfGTpDXAHHU7A5TOKUlU1OvSwDWy3/YTKhirfUbqc0m6M1L xjmyB5eqRUPZqRLKBtfVY2scVechhuPQ/AI5ewoRFGll2dA39ODhgrdVg17dsRxAdvFo apco6/63uR6svPxDNHl8hlPhIMSFqtwfmpM9B72Eei4DKiRb/s0GKWcQujroDcuftisE qP99fRBtr4HM6xM8K552rmm6dgFlib9V9VrbB+9JWQoH1+8gpNRAOf6oR6ZItJMfQdaW OZPw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=pa+SBeIsIf5PdxIXwjdhMLvWPN3R/s+fE4jIWMn6nOc=; b=l+wTusis+5YbOPIHKxzVcdrRhjr1m7t6J4h1GbpsDyeprMfX46odLtpaWlSK1haIqw 2V1m1+y8owRiyrHpW0W15pbjtA6Q9S9E+5TdFJoxkCxHnU86SSDW5Bzfp5aAqm/I3beG B3oMpJmWO9+LiV48sjIl/YrM4I8mn2DgIYgeq4VYvHi+0QQeFMKizRNTEYzO3m6ijJAQ Lio7wYFSSqPCcSeeo4yrEhCV6cpZ1JmXNI7vCk5aYzGE8VQTitjJINJ+qUNRU6ASnmbX 9fcWc7Aed0yzIueXsvoJLcOg8JkUyddVuIFQW39oIwgGO6Qzy6nzUFmU+S6Y7mk2EdwO qqTw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m5si2699430pjs.88.2019.06.11.09.44.03; Tue, 11 Jun 2019 09:44:18 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2391852AbfFKPzg (ORCPT + 99 others); Tue, 11 Jun 2019 11:55:36 -0400 Received: from relay3-d.mail.gandi.net ([217.70.183.195]:48875 "EHLO relay3-d.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388958AbfFKPzg (ORCPT ); Tue, 11 Jun 2019 11:55:36 -0400 X-Originating-IP: 90.88.159.246 Received: from mc-bl-xps13.lan (aaubervilliers-681-1-40-246.w90-88.abo.wanadoo.fr [90.88.159.246]) (Authenticated sender: maxime.chevallier@bootlin.com) by relay3-d.mail.gandi.net (Postfix) with ESMTPSA id 6B74B60016; Tue, 11 Jun 2019 15:55:29 +0000 (UTC) From: Maxime Chevallier To: davem@davemloft.net, Pablo Neira Ayuso , Florian Fainelli , Jiri Pirko , Jakub Kicinski Cc: Maxime Chevallier , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Antoine Tenart , thomas.petazzoni@bootlin.com, =?UTF-8?q?Micha=C5=82=20Miros=C5=82aw?= Subject: [PATCH net] net: ethtool: Allow matching on vlan CFI bit Date: Tue, 11 Jun 2019 17:54:56 +0200 Message-Id: <20190611155456.15360-1-maxime.chevallier@bootlin.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Using ethtool, users can specify a classification action matching on the full vlan tag, which includes the CFI bit. 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 CFI bit, this information was silently discarded when translating the ethtool flow spec in to a flow_rule. This commit adds the CFI 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 Signed-off-by: Maxime Chevallier --- Hi all, Although this prevents information to be silently discarded when parsing an ethtool_flow_spec, this information doesn't seem to be used by any driver that converts an ethtool_flow_spec to a flow_rule, hence I'm not sure this is suitable for -net. Thanks, Maxime include/net/flow_dissector.h | 1 + net/core/ethtool.c | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/include/net/flow_dissector.h b/include/net/flow_dissector.h index 7c5a8d9a8d2a..9d2e395c6568 100644 --- 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_cfi:1, vlan_priority:3; __be16 vlan_tpid; }; diff --git a/net/core/ethtool.c b/net/core/ethtool.c index d08b1e19ce9c..43df34c1ebe1 100644 --- a/net/core/ethtool.c +++ b/net/core/ethtool.c @@ -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_cfi = + !!(ntohs(ext_h_spec->vlan_tci) & 0x1000); + match->mask.vlan.vlan_cfi = + !!(ntohs(ext_m_spec->vlan_tci) & 0x1000); + match->key.vlan.vlan_priority = (ntohs(ext_h_spec->vlan_tci) & 0xe000) >> 13; match->mask.vlan.vlan_priority = -- 2.20.1