Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp1754271pxp; Thu, 10 Mar 2022 11:27:27 -0800 (PST) X-Google-Smtp-Source: ABdhPJw5wWV8VPp0WBfI8yyR1XFGgV9S2aUoFVefszZE7XQSnCrrXt8FQF57efgDirfgn3/ExvY3 X-Received: by 2002:aa7:8d0f:0:b0:4e1:31de:9080 with SMTP id j15-20020aa78d0f000000b004e131de9080mr6563148pfe.1.1646940446897; Thu, 10 Mar 2022 11:27:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646940446; cv=none; d=google.com; s=arc-20160816; b=Rj9u0YmLZdByeFKbdIFYjM4+h+JrJCxoGdgG9NV5uvcopSxsN4w9TYXcEiHsNRfstX 0rbjxP3WHN0Kb7GKutNWdc896hftQ13zBeXqq2LaNdtDo7kngUfVqcYUriAZBx675FpT cmeZ0MyFqIVq60Z+IuGqL08HppblLxalVDyeFewHEjEWEtD+zTKG1csYLWcxCPRmMQdm iS+omktGoLpigIGyqCeyp1v0YZegrVsiRCfA+WqlnYEL4BLASJMvm9kbXic4xYjXsLCc lHA2cZJotBAEnLOPnFSJq3s8gVQv93Pgtm0I/7shqnZStlc7ejCGIN6otoCQozfq1gR1 R6nQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:organization :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=NqCB67vT/c9mnsvCZbyxsMiWwZnjZ99KtMNG9ZRMdjE=; b=mfC9fKhk0xQyMurGJk4bKueXBELxd4+KPu5qOTeDdR4owHugRsvt/kphdIGuZlQuyP EP1A9Aa7C3UpEuJxmFe0Wz9ZdTft53H21yaex69hu66Qhy7Rtc6mI7VqXM0Vn0Ly0ZLq +INJHMDhBVgpmGossdVMrHIxNCj28Bxjm2A9QYiEVTO2RbhRlis2O0IbSc6rPUP6Mj96 0HCKE0jvBiX0dmbO3gZ5+dEvtJw8N0LTwhaftgjiwORl0OisaKfTInkm+pJpea4As2Yx 7S/Z6AnmYOrsa0RBXmlVcnKl27E1zWEOYnsmJu0pwaMkhDljqyc0ImXCZ5Isw/p/PiNt vUNA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=nCKpcv8p; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w8-20020a056a0014c800b004f0f64d8505si6270451pfu.177.2022.03.10.11.27.10; Thu, 10 Mar 2022 11:27:26 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=nCKpcv8p; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344515AbiCJOk6 (ORCPT + 99 others); Thu, 10 Mar 2022 09:40:58 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49726 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244409AbiCJO2y (ORCPT ); Thu, 10 Mar 2022 09:28:54 -0500 Received: from mail-lf1-x136.google.com (mail-lf1-x136.google.com [IPv6:2a00:1450:4864:20::136]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 35EECD108F; Thu, 10 Mar 2022 06:23:56 -0800 (PST) Received: by mail-lf1-x136.google.com with SMTP id 3so9730128lfr.7; Thu, 10 Mar 2022 06:23:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:organization:content-transfer-encoding; bh=NqCB67vT/c9mnsvCZbyxsMiWwZnjZ99KtMNG9ZRMdjE=; b=nCKpcv8pOchn2LpC3a/sEnI8cxJFMz8viJQDl7VV8+p0GiE3TYJ7Tvz1BJEHn/4MfZ T7gX/nVKdlYi3BEEDxDduv+dwNSZ6h3g6OBm0IvBc8qgolkU0UP0kMcjP+RYSQpZM9I+ NFQmUbZGwC2h1JkqvAY5XbGLqyvEWKrisf/O0hMRFPLuXTaD/TYBtiR/W5Br/qxcoxev hHid6O4YHi50rYahmytGQ36sGAdlyvB6xYuq5pfU/UWIQXGXDpLenJwB/pX08zahrUEK 6NUOjLb80aPnM8ZT8Y0VsVa1rz6SiO0yAowTfsS4eSbX/c0iRZwRzu+vjyBhUT99hebH WAKw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:organization:content-transfer-encoding; bh=NqCB67vT/c9mnsvCZbyxsMiWwZnjZ99KtMNG9ZRMdjE=; b=hOEqqfbIiXViWCCCbadv5e88pbo7B+FQePZxU8Uo8mtDxuIMu7joFqrOO2uXVGPona L7PdZ2MGv1PDIwA14tVffBv0/pVfkjSZtTxu80XWe85GR2CxsSsF+I6q1KOcUUTYzbi7 n57Zr5plKL+XWBtJsJvZHH3glalGMLT7HUb62OB01js6z4gJNzxt7CPyja3lh3YZ3J+R VRSApQbq162lCo3gVDMD4kdQQ5cBLkO6jmS1834NNTnOGfF//J2URBZBGCwmr9v6KvW3 o14NihTvKxYIWlujc40e522i4+2kbGEN0nvVvI0b/v3RVnQj1oYqkwlv1edqRrEE8jRs AVJg== X-Gm-Message-State: AOAM531jj9e7CtOvwmfmFdcCVAJwcBP7ZSi1ungmW2vSN8bBRtvc83ZC kT1jAEzYdsK0gAcpvEt11NY= X-Received: by 2002:a05:6512:1698:b0:445:bc1d:3835 with SMTP id bu24-20020a056512169800b00445bc1d3835mr3065989lfb.122.1646922227753; Thu, 10 Mar 2022 06:23:47 -0800 (PST) Received: from wse-c0127.beijerelectronics.com ([208.127.141.29]) by smtp.gmail.com with ESMTPSA id 10-20020a2e080a000000b00247f82bbc6fsm1088932lji.54.2022.03.10.06.23.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Mar 2022 06:23:47 -0800 (PST) From: Hans Schultz X-Google-Original-From: Hans Schultz To: davem@davemloft.net, kuba@kernel.org Cc: netdev@vger.kernel.org, Hans Schultz , Andrew Lunn , Vivien Didelot , Florian Fainelli , Vladimir Oltean , Jiri Pirko , Ivan Vecera , Roopa Prabhu , Nikolay Aleksandrov , Daniel Borkmann , Ido Schimmel , linux-kernel@vger.kernel.org, bridge@lists.linux-foundation.org Subject: [PATCH net-next 2/3] net: switchdev: add support for offloading of fdb locked flag Date: Thu, 10 Mar 2022 15:23:19 +0100 Message-Id: <20220310142320.611738-3-schultz.hans+netdev@gmail.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220310142320.611738-1-schultz.hans+netdev@gmail.com> References: <20220310142320.611738-1-schultz.hans+netdev@gmail.com> MIME-Version: 1.0 Organization: Westermo Network Technologies AB Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Used for Mac-auth/MAB feature in the offloaded case. Signed-off-by: Hans Schultz --- include/net/switchdev.h | 3 ++- net/bridge/br.c | 3 ++- net/bridge/br_fdb.c | 7 +++++-- net/bridge/br_private.h | 2 +- 4 files changed, 10 insertions(+), 5 deletions(-) diff --git a/include/net/switchdev.h b/include/net/switchdev.h index 3e424d40fae3..d5d923411f5e 100644 --- a/include/net/switchdev.h +++ b/include/net/switchdev.h @@ -229,7 +229,8 @@ struct switchdev_notifier_fdb_info { u16 vid; u8 added_by_user:1, is_local:1, - offloaded:1; + offloaded:1, + locked:1; }; struct switchdev_notifier_port_obj_info { diff --git a/net/bridge/br.c b/net/bridge/br.c index b1dea3febeea..adcdbecbc218 100644 --- a/net/bridge/br.c +++ b/net/bridge/br.c @@ -166,7 +166,8 @@ static int br_switchdev_event(struct notifier_block *unused, case SWITCHDEV_FDB_ADD_TO_BRIDGE: fdb_info = ptr; err = br_fdb_external_learn_add(br, p, fdb_info->addr, - fdb_info->vid, false); + fdb_info->vid, false, + fdb_info->locked); if (err) { err = notifier_from_errno(err); break; diff --git a/net/bridge/br_fdb.c b/net/bridge/br_fdb.c index 396dcf3084cf..91387aa7e400 100644 --- a/net/bridge/br_fdb.c +++ b/net/bridge/br_fdb.c @@ -987,7 +987,7 @@ static int __br_fdb_add(struct ndmsg *ndm, struct net_bridge *br, "FDB entry towards bridge must be permanent"); return -EINVAL; } - err = br_fdb_external_learn_add(br, p, addr, vid, true); + err = br_fdb_external_learn_add(br, p, addr, vid, true, false); } else { spin_lock_bh(&br->hash_lock); err = fdb_add_entry(br, p, addr, ndm, nlh_flags, vid, nfea_tb); @@ -1216,7 +1216,7 @@ void br_fdb_unsync_static(struct net_bridge *br, struct net_bridge_port *p) int br_fdb_external_learn_add(struct net_bridge *br, struct net_bridge_port *p, const unsigned char *addr, u16 vid, - bool swdev_notify) + bool swdev_notify, bool locked) { struct net_bridge_fdb_entry *fdb; bool modified = false; @@ -1236,6 +1236,9 @@ int br_fdb_external_learn_add(struct net_bridge *br, struct net_bridge_port *p, if (!p) flags |= BIT(BR_FDB_LOCAL); + if (locked) + flags |= BIT(BR_FDB_ENTRY_LOCKED); + fdb = fdb_create(br, p, addr, vid, flags); if (!fdb) { err = -ENOMEM; diff --git a/net/bridge/br_private.h b/net/bridge/br_private.h index f5a0b68c4857..3275e33b112f 100644 --- a/net/bridge/br_private.h +++ b/net/bridge/br_private.h @@ -790,7 +790,7 @@ int br_fdb_sync_static(struct net_bridge *br, struct net_bridge_port *p); void br_fdb_unsync_static(struct net_bridge *br, struct net_bridge_port *p); int br_fdb_external_learn_add(struct net_bridge *br, struct net_bridge_port *p, const unsigned char *addr, u16 vid, - bool swdev_notify); + bool swdev_notify, bool locked); int br_fdb_external_learn_del(struct net_bridge *br, struct net_bridge_port *p, const unsigned char *addr, u16 vid, bool swdev_notify); -- 2.30.2