From patchwork Tue Nov 19 10:19:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Woudstra X-Patchwork-Id: 13879625 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 6900CD60D1B for ; Tue, 19 Nov 2024 10:32:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=v/vUWoqxNIyzC+NeQY2banTy2Lb/YnflO4/5JFbURlo=; b=25cZ7s8JqoYw4/o2J29ihaM41/ /mIbD4WGUAMZ2eqzbczg71Ya0G/mXYucVl1nD+UEry3wHQE3GgeOdeBGn0m037HipefAYEy3/Wd7t 3KMEJZNH8YDbn9wB3Zxu/A+rrfwqIJmH1GT2XlMAHP/leWRyUwF6AYIeDU9TAnIuolCUelOzv8zvt 4BsAmyBNSrTu4yX38G4/bg11m6PHjX6umrA5DD3sJhoj45xLLYdWoqdB90AR/OORTaC9pcs4aAQmJ PFTjujSn3oHKYfAkoCYUwm8Rg3cHbR0qav3mGa9Tt7fj56nLI3noRdxs35I39jalz2hvv5FbfUZ2p MUyvb26w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tDLX6-0000000C4Qn-0i6G; Tue, 19 Nov 2024 10:32:32 +0000 Received: from mail-ej1-x631.google.com ([2a00:1450:4864:20::631]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tDLKb-0000000C15I-1oE8; Tue, 19 Nov 2024 10:19:38 +0000 Received: by mail-ej1-x631.google.com with SMTP id a640c23a62f3a-aa20c733e92so581611066b.0; Tue, 19 Nov 2024 02:19:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1732011575; x=1732616375; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=v/vUWoqxNIyzC+NeQY2banTy2Lb/YnflO4/5JFbURlo=; b=cUwMLs0iIC5yOceaY2cQkURiJ3POS/g+e8x4Vv3eGN40QlfWtrAy5HSA4Qz7G44tG2 Y942yxxxgKbU5yPJEKXFW365dew23ve6YNJ4kL8092P276MEjMqRfHvDMsRTIymXAiV6 v2jJEIMSIBkNuyiVh3tYoavEJSg0JYVvGjXGuepJjTOj8f8kNmoB4HqAnU7wW02R46o+ p3HB9S9PJNHSK6C2677RZkHiksXYoRsvnQxow5Pvx6JTZdSPl2nN9wMHzjdukDynJf7g MaHfJ7fpNDzJUge7FgF4bW/3WHNxawxZun9UjKQPk65DHQK9PNOxgu+m4vcYkTXsPOh0 mHKg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732011575; x=1732616375; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=v/vUWoqxNIyzC+NeQY2banTy2Lb/YnflO4/5JFbURlo=; b=vWvPG6sVbNDQasc/y0aBkCz1flKEBHtflfKkKn1k8SC68ra1brdgAEJyDQu7NUvzFu 9BFa//0ge95NDru21hxPgSJgVZcl6Byibv8tsrn/BIJYzfa1+b9NPc/1NPnCkLWhvJZt 2e7s1I1TdbGxijTapyAIGAtmDbknR9PKqtM7SMMG5N0F1LV8eV9FTMxBVHaEV/++SeSQ kaQ9LoqXzkGAMhhwh3pHvluln2f6J8n5r/H8BGiKZiV9PR8hyTgX3t5tAq5UiCIeVU6Y HtClhYFfZjDjXoUW31py1S6Hmdw3r6dsa5qQrcS/9xhdXAD3hWg5awPgDEFkcOhzT5Ka UmHA== X-Forwarded-Encrypted: i=1; AJvYcCVqc30soLRGsjvzm4PtCB4yWOeKdhnyNizmzyfuAb/aBwsV7ki07MNPu48oiuHs+Gr3UOvEb4XdOACVldkXHu0=@lists.infradead.org, AJvYcCWvBhIP9FVhH/pOmDPkjInjoft/LNcUMGifbDqA763VahAk9XYvMXhFeSxg1+JjnyWALzGEgDNPE0PQIiIP346d@lists.infradead.org X-Gm-Message-State: AOJu0YyiV0ayVDBRo0IWtqByx8ssO7V/lYR6SGik2bgGDU4bKehUxw+j aFMHi6rXs5zlviH5BDKYDDzuYCDiVwyl7KUP6QnII8x4WVcKD4y/ X-Google-Smtp-Source: AGHT+IGpNp2EcDD7KUg0ypC4A+lKeGJDHv/zRaEDzsK/LGdNlutzMURqa+xe7vSUguB7L7JU3yrxXg== X-Received: by 2002:a17:907:70e:b0:a9a:533b:56e3 with SMTP id a640c23a62f3a-aa483454466mr1479164366b.26.1732011575326; Tue, 19 Nov 2024 02:19:35 -0800 (PST) Received: from corebook.localdomain (2001-1c00-020d-1300-1b1c-4449-176a-89ea.cable.dynamic.v6.ziggo.nl. [2001:1c00:20d:1300:1b1c:4449:176a:89ea]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-aa20e081574sm634875566b.179.2024.11.19.02.19.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Nov 2024 02:19:35 -0800 (PST) From: Eric Woudstra To: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Simon Horman , Andrew Lunn , Pablo Neira Ayuso , Jozsef Kadlecsik , Jiri Pirko , Ivan Vecera , Roopa Prabhu , Nikolay Aleksandrov , Matthias Brugger , AngeloGioacchino Del Regno , David Ahern , Sebastian Andrzej Siewior , Lorenzo Bianconi , Joe Damato , Alexander Lobakin , Vladimir Oltean , "Frank Wunderlich" , Daniel Golle Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, netfilter-devel@vger.kernel.org, coreteam@netfilter.org, bridge@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, Eric Woudstra Subject: [PATCH RFC v2 net-next 13/14] bridge: Introduce DEV_PATH_BR_VLAN_KEEP_HW for bridge-fastpath Date: Tue, 19 Nov 2024 11:19:05 +0100 Message-ID: <20241119101906.862680-14-ericwouds@gmail.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241119101906.862680-1-ericwouds@gmail.com> References: <20241119101906.862680-1-ericwouds@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241119_021937_471894_A887D7F1 X-CRM114-Status: GOOD ( 15.89 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org This patch introduces DEV_PATH_BR_VLAN_KEEP_HW. It is needed in the bridge fastpath for switchdevs supporting SWITCHDEV_OBJ_ID_PORT_VLAN. It is similar to DEV_PATH_BR_VLAN_TAG, with the correcponding bit in ingress_vlans set. In the forward fastpath it is not needed. Signed-off-by: Eric Woudstra --- include/linux/netdevice.h | 1 + net/bridge/br_device.c | 4 ++++ net/bridge/br_vlan.c | 18 +++++++++++------- net/netfilter/nft_flow_offload.c | 3 +++ 4 files changed, 19 insertions(+), 7 deletions(-) diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index 15923d177f9e..3bd5c7b45460 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h @@ -870,6 +870,7 @@ struct net_device_path { DEV_PATH_BR_VLAN_TAG, DEV_PATH_BR_VLAN_UNTAG, DEV_PATH_BR_VLAN_UNTAG_HW, + DEV_PATH_BR_VLAN_KEEP_HW, } vlan_mode; u16 vlan_id; __be16 vlan_proto; diff --git a/net/bridge/br_device.c b/net/bridge/br_device.c index c7646afc8b96..112fd8556217 100644 --- a/net/bridge/br_device.c +++ b/net/bridge/br_device.c @@ -430,6 +430,10 @@ static int br_fill_forward_path(struct net_device_path_ctx *ctx, case DEV_PATH_BR_VLAN_UNTAG: ctx->num_vlans--; break; + case DEV_PATH_BR_VLAN_KEEP_HW: + if (!src) + path->bridge.vlan_mode = DEV_PATH_BR_VLAN_KEEP; + break; case DEV_PATH_BR_VLAN_KEEP: break; } diff --git a/net/bridge/br_vlan.c b/net/bridge/br_vlan.c index 0decce5d586a..6a2ca7a5854d 100644 --- a/net/bridge/br_vlan.c +++ b/net/bridge/br_vlan.c @@ -1494,13 +1494,17 @@ int br_vlan_fill_forward_path_mode(struct net_bridge *br, if (!(v->flags & BRIDGE_VLAN_INFO_UNTAGGED)) return 0; - if (path->bridge.vlan_mode == DEV_PATH_BR_VLAN_TAG) - path->bridge.vlan_mode = DEV_PATH_BR_VLAN_KEEP; - else if (v->priv_flags & BR_VLFLAG_TAGGING_BY_SWITCHDEV) - path->bridge.vlan_mode = DEV_PATH_BR_VLAN_UNTAG_HW; - else - path->bridge.vlan_mode = DEV_PATH_BR_VLAN_UNTAG; - + if (path->bridge.vlan_mode == DEV_PATH_BR_VLAN_TAG) { + if (v->priv_flags & BR_VLFLAG_TAGGING_BY_SWITCHDEV) + path->bridge.vlan_mode = DEV_PATH_BR_VLAN_KEEP_HW; + else + path->bridge.vlan_mode = DEV_PATH_BR_VLAN_KEEP; + } else { + if (v->priv_flags & BR_VLFLAG_TAGGING_BY_SWITCHDEV) + path->bridge.vlan_mode = DEV_PATH_BR_VLAN_UNTAG_HW; + else + path->bridge.vlan_mode = DEV_PATH_BR_VLAN_UNTAG; + } return 0; } diff --git a/net/netfilter/nft_flow_offload.c b/net/netfilter/nft_flow_offload.c index 387e5574c31f..ed0e9b499971 100644 --- a/net/netfilter/nft_flow_offload.c +++ b/net/netfilter/nft_flow_offload.c @@ -149,6 +149,9 @@ static void nft_dev_path_info(const struct net_device_path_stack *stack, case DEV_PATH_BR_VLAN_UNTAG_HW: info->ingress_vlans |= BIT(info->num_encaps - 1); break; + case DEV_PATH_BR_VLAN_KEEP_HW: + info->ingress_vlans |= BIT(info->num_encaps); + fallthrough; case DEV_PATH_BR_VLAN_TAG: info->encap[info->num_encaps].id = path->bridge.vlan_id; info->encap[info->num_encaps].proto = path->bridge.vlan_proto;