Received: by 2002:a25:f815:0:0:0:0:0 with SMTP id u21csp535348ybd; Wed, 26 Jun 2019 02:24:28 -0700 (PDT) X-Google-Smtp-Source: APXvYqyMwN1BlKdy262vXA/gvCfukD1WIgBj8J44+Wg8viqiEYcRmb6hYIq8QyHhsPYt4/qlYTN6 X-Received: by 2002:a17:902:1566:: with SMTP id b35mr4366618plh.147.1561541068361; Wed, 26 Jun 2019 02:24:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561541068; cv=none; d=google.com; s=arc-20160816; b=oWnbl7B5uHk0Zr8sMrkjIBkgpA4HpuMUIuhB5PIWiOPOSi+I6iNh18k+0LJ8MDYdl+ eJdBsOZj69dMAcvmIpUrqYZI/7zBhPZA/41r1+PvBSMaT8KUztZ/tKle5Lsc3n82a/9Y 1TkNiIeTF954ayYYBddyJngly5Z3JhrZI/2+DW3I8bJS/Ze3dOZmnZhNkHymFHXrvgfX lxNdcQyElXs72qsK556FlqAdl+dAboRyvUUbxJr6A97ke66uoG8PAMcNN7R9mHRCkUYX nTpeaAQcOwD/zbyjR2UGsKb76lTWQ0H9T5ILiCFNbvU1iEm36FXLpi43hmkJaKFXAGlI 9a2g== 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 :references:in-reply-to:message-id:subject:cc:to:from:date; bh=HUD71kmTkP0l6NUsqqHjNATkh1lvEFJ+Xwi2i2wbuRU=; b=VTWl6yz0Wa4srgS7pLOKcmUYdfoDRKnQ/ll9cdXTsedIJ5QHp46pmERa4i9M7WwMk9 yqV9lKk0/b/oOrCwy1Wjq+ywlM5KyU+0hSdN+lEWfXbKsErWU7xlYMVjw8K8rhPr8cJ4 0Jhz3r3oRuRZZ8WCLIKZ0XuiZKknlncAYnv3XZ51xV93HjTGeDiPJ41T1MzZrhws+3QO qR2w4ESHEwG56mUMQB2K9RfPSyHtN/cofZlpctzS/o9yY4z0V0Sf7TRwlbYHFFTO5p2L GRLjaAW6eIU2Gr96UTKTPOWw3BWuiPNRyILvRMqwbI7FiTBobB4TIODNzJyP/zKol5ql WBbQ== 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 x21si2934525pln.192.2019.06.26.02.24.12; Wed, 26 Jun 2019 02:24:28 -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 S1726708AbfFZJXv (ORCPT + 99 others); Wed, 26 Jun 2019 05:23:51 -0400 Received: from relay4-d.mail.gandi.net ([217.70.183.196]:44543 "EHLO relay4-d.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725379AbfFZJXu (ORCPT ); Wed, 26 Jun 2019 05:23:50 -0400 X-Originating-IP: 86.250.200.211 Received: from bootlin.com (lfbn-1-17395-211.w86-250.abo.wanadoo.fr [86.250.200.211]) (Authenticated sender: maxime.chevallier@bootlin.com) by relay4-d.mail.gandi.net (Postfix) with ESMTPSA id 65EECE0005; Wed, 26 Jun 2019 09:23:45 +0000 (UTC) Date: Wed, 26 Jun 2019 11:23:55 +0200 From: Maxime Chevallier To: Pablo Neira Ayuso Cc: davem@davemloft.net, Florian Fainelli , Jiri Pirko , Jakub Kicinski , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Antoine Tenart , thomas.petazzoni@bootlin.com Subject: Re: [PATCH net-next] net: ethtool: Allow parsing ETHER_FLOW types when using flow_rule Message-ID: <20190626112355.73a1e74f@bootlin.com> In-Reply-To: <20190626085846.ax277ojvyp5k3abt@salvia> References: <20190626084403.17749-1-maxime.chevallier@bootlin.com> <20190626085846.ax277ojvyp5k3abt@salvia> X-Mailer: Claws Mail 3.17.3 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Pablo, On Wed, 26 Jun 2019 10:58:46 +0200 Pablo Neira Ayuso wrote: >On Wed, Jun 26, 2019 at 10:44:03AM +0200, Maxime Chevallier wrote: >> 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; >> + } > >I see some drivers in the tree also interpret the h_source and h_dest >fields? Ah yes you're right. I assumed these fields were specific to the FLOW_MAC_EXT flags, but by looking into the ethtool code, it seems we do need to handle the h_source and h_dest fields. I'll respin with these fields added. Thanks for the review, Maxime