From patchwork Wed Dec 6 14:07:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kurt Kanzenbach X-Patchwork-Id: 1872782 X-Patchwork-Delegate: anthony.l.nguyen@intel.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=osuosl.org header.i=@osuosl.org header.a=rsa-sha256 header.s=default header.b=PbwjR7RY; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=osuosl.org (client-ip=2605:bc80:3010::137; helo=smtp4.osuosl.org; envelope-from=intel-wired-lan-bounces@osuosl.org; receiver=patchwork.ozlabs.org) Received: from smtp4.osuosl.org (smtp4.osuosl.org [IPv6:2605:bc80:3010::137]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4SlfP24gZ1z1ySd for ; Thu, 7 Dec 2023 01:07:34 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id A8E4440105; Wed, 6 Dec 2023 14:07:32 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org A8E4440105 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=osuosl.org; s=default; t=1701871652; bh=/QlNX7yil6Re+pE9vSSnX5K/3QMkLLmErc7kfyzicWs=; h=From:To:Date:Subject:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:Cc:From; b=PbwjR7RY1c5X7zgDu52pXsqvYk3XXHX4UrEG1XhY8PvbFN6TR2n6/DVXpRll2Oe7Q Htrt0Yq1I+vu1qdYIQfr3ZOURke5na/e43cnbKmNKJb3R1HcIj9p87YVSe0OC6yYoc WMoyo33TjFUtSnV5J4gUc6f58jq7w8nib4reTciXf71GiYY++3HlBHF0iVEgrulFHk XGkUuK0CSPmGkQ4HvH9xHyqVDRZn3qfgu5oqNMjXD1tPxhvcTInBki1QJ7EOtIEnTD RkmNH6bNU9VD66+bBSqBANGknHhkkUKUHZZijNqKVJLlqwKt9g4tKkjc3ye9xKrQpM ZozQNFP0GXhCg== X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id iZs_EEaVucu2; Wed, 6 Dec 2023 14:07:31 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by smtp4.osuosl.org (Postfix) with ESMTP id 9EB0041EBE; Wed, 6 Dec 2023 14:07:31 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org 9EB0041EBE X-Original-To: intel-wired-lan@lists.osuosl.org Delivered-To: intel-wired-lan@lists.osuosl.org Received: from smtp4.osuosl.org (smtp4.osuosl.org [140.211.166.137]) by ash.osuosl.org (Postfix) with ESMTP id 79A951BF388 for ; Wed, 6 Dec 2023 14:07:30 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id 5AAFA41EBE for ; Wed, 6 Dec 2023 14:07:30 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org 5AAFA41EBE X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id DV5lF6h5imhV for ; Wed, 6 Dec 2023 14:07:29 +0000 (UTC) Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by smtp4.osuosl.org (Postfix) with ESMTPS id 3CD1840105 for ; Wed, 6 Dec 2023 14:07:29 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org 3CD1840105 From: Kurt Kanzenbach To: Jesse Brandeburg , Tony Nguyen , Vinicius Costa Gomes Date: Wed, 6 Dec 2023 15:07:18 +0100 Message-Id: <20231206140718.57433-1-kurt@linutronix.de> MIME-Version: 1.0 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1701871646; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=Q2jnrPRUFhsAeYH7XvPmL7PATOC17eZj15WDzaage5s=; b=GcqNaTUtG7eqsXFf8V1NftoLAINABIzn+tQ31uAH/P88GOKa8CKwbW+vBPEG1UA7NCJbgP +i0QAW7aWRRgoVO7BiixoE/9ILw1TlRwLR7aDyCaCsAOjWEK6XsHsYo4txHZqXTdpbl6MB c/uP/S10AMfuPLG9xJ5zOJvC0f92wRNuJb3EvQw4tz4YSTee/4NodbOUh/xpPXtyCoK8me IfG4Fz15mDM/b4BOpbcVTBE5AcwQg9MYoOEXZ3YpTvN5V8HeBsCE9vzelVLjuVFtRAT2rS A3UZhmAMb4P/TJNkZU02ywNBdNfm3+QGtLlVY0H2pIujWUIDLhqo3BAIWRs9Ow== X-Mailman-Original-DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1701871646; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=Q2jnrPRUFhsAeYH7XvPmL7PATOC17eZj15WDzaage5s=; b=FYpP6LAQqvbdBWga33Jedl/SR6do2iIzUIzTzxt/JZ7IOo5C28C1BNxhkUIoPyGU02l3hx 8ygKcpCz1adEznDA== X-Mailman-Original-Authentication-Results: smtp4.osuosl.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.a=rsa-sha256 header.s=2020 header.b=GcqNaTUt; dkim=pass header.d=linutronix.de header.i=@linutronix.de header.a=ed25519-sha256 header.s=2020e header.b=FYpP6LAQ Subject: [Intel-wired-lan] [PATCH iwl-net] igc: Check VLAN EtherType mask X-BeenThere: intel-wired-lan@osuosl.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel Wired Ethernet Linux Kernel Driver Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: netdev@vger.kernel.org, Kurt Kanzenbach , Eric Dumazet , intel-wired-lan@lists.osuosl.org, Jakub Kicinski , Paolo Abeni , "David S. Miller" , Suman Ghosh Errors-To: intel-wired-lan-bounces@osuosl.org Sender: "Intel-wired-lan" Currently the driver accepts VLAN EtherType steering rules regardless of the configured mask. And things might fail silently or with confusing error messages to the user. The VLAN EtherType can only be matched by full mask. Therefore, add a check for that. For instance the following rule is invalid, but the driver accepts it and ignores the user specified mask: |root@host:~# ethtool -N enp3s0 flow-type ether vlan-etype 0x8100 \ | m 0x00ff action 0 |Added rule with ID 63 |root@host:~# ethtool --show-ntuple enp3s0 |4 RX rings available |Total 1 rules | |Filter: 63 | Flow Type: Raw Ethernet | Src MAC addr: 00:00:00:00:00:00 mask: FF:FF:FF:FF:FF:FF | Dest MAC addr: 00:00:00:00:00:00 mask: FF:FF:FF:FF:FF:FF | Ethertype: 0x0 mask: 0xFFFF | VLAN EtherType: 0x8100 mask: 0x0 | VLAN: 0x0 mask: 0xffff | User-defined: 0x0 mask: 0xffffffffffffffff | Action: Direct to queue 0 After: |root@host:~# ethtool -N enp3s0 flow-type ether vlan-etype 0x8100 \ | m 0x00ff action 0 |rmgr: Cannot insert RX class rule: Operation not supported Fixes: 2b477d057e33 ("igc: Integrate flex filter into ethtool ops") Suggested-by: Suman Ghosh Signed-off-by: Kurt Kanzenbach Acked-by: Vinicius Costa Gomes Reviewed-by: Simon Horman Tested-by: Naama Meir --- Note: This is a follow up of https://lore.kernel.org/netdev/20231201075043.7822-1-kurt@linutronix.de/ and should apply to net-queue tree. drivers/net/ethernet/intel/igc/igc_ethtool.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/net/ethernet/intel/igc/igc_ethtool.c b/drivers/net/ethernet/intel/igc/igc_ethtool.c index b56b4f338bd3..859b2636f3d9 100644 --- a/drivers/net/ethernet/intel/igc/igc_ethtool.c +++ b/drivers/net/ethernet/intel/igc/igc_ethtool.c @@ -1357,6 +1357,14 @@ static int igc_ethtool_add_nfc_rule(struct igc_adapter *adapter, return -EOPNOTSUPP; } + /* VLAN EtherType can only be matched by full mask. */ + if ((fsp->flow_type & FLOW_EXT) && + fsp->m_ext.vlan_etype && + fsp->m_ext.vlan_etype != ETHER_TYPE_FULL_MASK) { + netdev_dbg(netdev, "VLAN EtherType mask not supported\n"); + return -EOPNOTSUPP; + } + if (fsp->location >= IGC_MAX_RXNFC_RULES) { netdev_dbg(netdev, "Invalid location\n"); return -EINVAL;