Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp5940791ybi; Wed, 12 Jun 2019 11:05:01 -0700 (PDT) X-Google-Smtp-Source: APXvYqz9Oe3xeVmChRbAwD2YpQsuVcItJmOJEiLal5rfU+FgA5aoLL7rN8DcGFotnRQqnyRwXHdR X-Received: by 2002:a63:364f:: with SMTP id d76mr18747548pga.147.1560362700787; Wed, 12 Jun 2019 11:05:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560362700; cv=none; d=google.com; s=arc-20160816; b=Wb7jqaqlR//50wrezF11qJa17MOu4w1ty+twp7vPMjTdeEzKFKsG61bCt1gcxYlV+d CjdYJ3BAcBQWWATWWZam0fDpAmjcDIqMcYay+vhPTXYGFLcWOdaHzDIYrTYZqPEsMA0Y UpqF0YVFzl3BzTlUC2xHM6+hdiNIjF2Axm/iK7+g7EmD64nlc+O3yHdE4e1+X6OVPxnk RB8vE+PB7XJiIEzpf+jpRoP7u5JwwOeHsbG8h8A+KOBhlRF1U3T4PIgmZZIjFfwdU3DZ C8KTKdDzIflB/OF9Zj25nq79YFdhhaCCPveAEcpRMX2LV8mgNU6QX0pfb7P+ROL3DRBw fjWQ== 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=K/EGhktvhxsnBhdrBA7fiepWVHbMHmv2g4z6tu3a51A=; b=cdmY3Y+lYNb1qJWmSiyot4IQt+uIk4qCqUPy46PyJMdIGp77CDkBQGJdB/JfNtJeJT 6XXlWZDtGu0fE2AW/bEbbWxHpY2xsz6bWXllGYzYIi/iCf+12kGxAqe3g498gxXFyzF1 1zhCaS3Dacut69Gb23udoUJcOzai3rHNSJ4o4NiGRhRIjXheiZX644sJb1BN2QoQqcY/ k+aMkplk8H0CTBsLC0N4hfdDPKvo3jJyHgUPMMUbmZJsqhxDQHOgG+YG3mwJzFWrskXl 92gfdngTcrM/yx8CyaFOKJEqTGgyTZVSeoJ4d4jNKug/eAAsAmJ5rtzL1W/qKmmQD12e Bptw== 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 r18si402139pgv.433.2019.06.12.11.04.45; Wed, 12 Jun 2019 11:05:00 -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 S1729593AbfFLPSp (ORCPT + 99 others); Wed, 12 Jun 2019 11:18:45 -0400 Received: from relay9-d.mail.gandi.net ([217.70.183.199]:46931 "EHLO relay9-d.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726454AbfFLPSp (ORCPT ); Wed, 12 Jun 2019 11:18:45 -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 relay9-d.mail.gandi.net (Postfix) with ESMTPSA id 9184BFF81C; Wed, 12 Jun 2019 15:18:40 +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?= , Toshiaki Makita Subject: [PATCH net v2] net: ethtool: Allow matching on vlan DEI bit Date: Wed, 12 Jun 2019 17:18:38 +0200 Message-Id: <20190612151838.7455-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 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 Signed-off-by: Maxime Chevallier --- V1 -> V2: Use "DEI" instead of the old name "CFI", as suggested by Toshiaki. Perform endianness swap on the constant, sothat it's done at build-time, as suggested by Jakub. 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..dfabc0503446 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_dei:1, vlan_priority:3; __be16 vlan_tpid; }; diff --git a/net/core/ethtool.c b/net/core/ethtool.c index d08b1e19ce9c..4d1011b2e24f 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_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 = -- 2.20.1