Received: by 2002:a25:f815:0:0:0:0:0 with SMTP id u21csp501104ybd; Wed, 26 Jun 2019 01:44:38 -0700 (PDT) X-Google-Smtp-Source: APXvYqwtKRQ4OTxGNlNuM1UF7DcP3furTWg4ij15Mu0keyzXgxvfZrEjfyiK78RsbmwLuFnk9WbE X-Received: by 2002:a17:90a:bf0e:: with SMTP id c14mr3162499pjs.55.1561538678393; Wed, 26 Jun 2019 01:44:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561538678; cv=none; d=google.com; s=arc-20160816; b=SPfkZ8Rt+evjvam/P5bw73RIjeVCmVE0TOZ/jFJU7FFKZzWg9j2/DMKw9Jc09iIsoe CGE6c5oX5m+9d4ItePdT2oystL/3JmGQuU8DhBT9U/a63dZzt8yr4ofe1aBHK5N9ZWn6 OHYcpBicjdLB7CKuyJ5DPABBwvQwMh3r9vX0+vh9HDQysMxzIiQ9262iclgtmVpU/BU9 OtPrUD5mesnI4dDdbQRCh5QnFVBwNyXZcXmuVgpkPpCGJTl7jSSm4kGUQFqCGCV6TIqH 77t+MBlBkeKfBxwFntZ3+LIMeyF9tIyn5GZrJnSN2Vvrj7SQtwe6WVv2uAzJQV9Y8sRK 7H3Q== 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=YXKS4pov1MGHnCyYvpa1bSjCcJI0S4ZFshgfFM+Ry9Y=; b=jJJAXKuWUp+NuiZh+D9dKKWM9u8xJJjOxg0hSzIAJHa+0J81NimJee5eZrb8DlSVKC fgsEXvxcg6IgqsapZSGcRFN7I6PZ44bwV4pwu96mUeyeW6Qp6Pw99Se91ytk0Q2+cWlJ wjOav39HW2W0Q4kMRm9+Y/gbPW1VO+iNnC9pkxiBOljHidwHVzlo7zhOBPRxcdR7sW4F Zlm2qmkpY0YyI1avbMBHswO1QUv/H0wWD7v0gkIl9i6VMKSbkkljisK/ZyVxaaHrGF/y m4UneQgT1JipCL1WyrhR3sOW6MzsmUAlkxCociWp5tpQwHaAbZ7utvpvrvJq/mFi+Uez Lr8Q== 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 b40si2882586plb.426.2019.06.26.01.44.21; Wed, 26 Jun 2019 01:44:38 -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 S1726716AbfFZIoQ (ORCPT + 99 others); Wed, 26 Jun 2019 04:44:16 -0400 Received: from relay6-d.mail.gandi.net ([217.70.183.198]:56683 "EHLO relay6-d.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726006AbfFZIoP (ORCPT ); Wed, 26 Jun 2019 04:44:15 -0400 X-Originating-IP: 86.250.200.211 Received: from mc-bl-xps13.lan (lfbn-1-17395-211.w86-250.abo.wanadoo.fr [86.250.200.211]) (Authenticated sender: maxime.chevallier@bootlin.com) by relay6-d.mail.gandi.net (Postfix) with ESMTPSA id 973EFC000C; Wed, 26 Jun 2019 08:44:07 +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 Subject: [PATCH net-next] net: ethtool: Allow parsing ETHER_FLOW types when using flow_rule Date: Wed, 26 Jun 2019 10:44:03 +0200 Message-Id: <20190626084403.17749-1-maxime.chevallier@bootlin.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When parsing an ethtool_rx_flow_spec, users can specify an ethernet flow which could contain matches based on the ethernet header, such as the MAC address, the VLAN tag or the ethertype. Only the ethtype field is specific to the ether flow, the MAC and vlan fields are processed using the special FLOW_EXT and FLOW_MAC_EXT flags. Signed-off-by: Maxime Chevallier --- net/core/ethtool.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/net/core/ethtool.c b/net/core/ethtool.c index 4d1011b2e24f..01ceba556341 100644 --- a/net/core/ethtool.c +++ b/net/core/ethtool.c @@ -2883,6 +2883,18 @@ ethtool_rx_flow_rule_create(const struct ethtool_rx_flow_spec_input *input) match->mask.basic.n_proto = htons(0xffff); switch (fs->flow_type & ~(FLOW_EXT | FLOW_MAC_EXT | FLOW_RSS)) { + case ETHER_FLOW: { + const struct ethhdr *ether_spec, *ether_m_spec; + + ether_spec = &fs->h_u.ether_spec; + ether_m_spec = &fs->m_u.ether_spec; + + if (ether_m_spec->h_proto) { + match->key.basic.n_proto = ether_spec->h_proto; + match->mask.basic.n_proto = ether_m_spec->h_proto; + } + } + break; case TCP_V4_FLOW: case UDP_V4_FLOW: { const struct ethtool_tcpip4_spec *v4_spec, *v4_m_spec; -- 2.20.1