Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp1490465pxp; Thu, 10 Mar 2022 06:31:06 -0800 (PST) X-Google-Smtp-Source: ABdhPJwAAbnVCM0Tf8AKx93dmrFEa6jY1IXetLw1zj0AlhcAC+6030K/uxTxYdyllRHPOY8KJal2 X-Received: by 2002:a17:906:26da:b0:6d6:da2e:d338 with SMTP id u26-20020a17090626da00b006d6da2ed338mr4419766ejc.700.1646922666103; Thu, 10 Mar 2022 06:31:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646922666; cv=none; d=google.com; s=arc-20160816; b=DuftWtuWYancS6YSwO/zNRIpwVwgNF5aYvExS6qxA3+h1TFqPFqESr//JqaEZddgAn /8VOqivy74QDt0cQqru4GZQR/rv0Trd0SbsQ/LAUWZCRpIzF7zBZpJiNxJFkyZPqoCh9 pyBhtHMegZmG0K6MuSmzrYBZfLTgJbcsmBb/ixonfi6z9jsShMdX+muYJT64GiwqceKW rXr6qlji+cO/VJOg4ny79dhHxVbP4E3t09TQKUe0Kog5tiXctLlSL18G/HBLD7zRGFsr 5N8lJ5unmCQySWZ0Avtycxk+kCP3qnkUTOcf7GJ/tktZqw3k41Q+SeyokL/wItN4i+zq H7dA== 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=uapB2TtYjdNBFokKRIrCFIwuvOmddYz9lpUPRQg9BkbqFrckgWW6OhFfRkUWcWxku1 NwsVJ2IfQSFWufxDORxx9u8V3QJK4GytaJOV2pf4N3bsvXteuO9qKrKCTDfAeWAYj1H5 1JjjrJHwXFMHOYCnxc++UOskrHpeg6u6dee/HS4GmioIhXg7bPG1U0UFSWKf1kP1VLd2 xYrY/C9pPAdreIkfeyJHCH1XFFkYO4/Qe0SB7HrySyepwKA5vfV5nCBSEj1VnASmxy6M iuVr9u1/2DH7iSCYLZsMBVK/ZYDIhXuXwGFLmFEWmuk0Ymywny4bMxYJFEJWf/alr4Sy MWvA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=gkiTNDi5; 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 l3-20020a17090615c300b006d6e53e001csi3192038ejd.390.2022.03.10.06.30.39; Thu, 10 Mar 2022 06:31:06 -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=gkiTNDi5; 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 S242532AbiCJNiG (ORCPT + 99 others); Thu, 10 Mar 2022 08:38:06 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51778 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242501AbiCJNhy (ORCPT ); Thu, 10 Mar 2022 08:37:54 -0500 Received: from mail-lj1-x22e.google.com (mail-lj1-x22e.google.com [IPv6:2a00:1450:4864:20::22e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1470314F285; Thu, 10 Mar 2022 05:36:50 -0800 (PST) Received: by mail-lj1-x22e.google.com with SMTP id h11so7755062ljb.2; Thu, 10 Mar 2022 05:36:49 -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=gkiTNDi5pZ9lk4PtAzuCZONXJq/Ix6gNIP6lS2X8nIxEocHHlWsxFVlQnakJrBoTpF oHT9ruoMDwEr5cLAj0Z3erdEOCp1ualiI3kJq7TIN7mYN1pqCvOzfqEhbFM6W/r8MOxb OS+q7KTn5rQEM8yha5bL9Hq8q4fBL0ePKYvUqYCvVhV4IZx+JI+ExouAmFZjPFZvFySd hn3IA4krwCpeyTjYje2DPMcl0ZVOwG12by+T3JqVPQc8xK/20D3EuGbTTf2JRWiXmTo9 SI/bK9q33kbzhW+ElY1YHK16eercCeiIESDKv96IPGEMz+GYJqaSirVRbsAm6XulchXk Co+A== 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=4k7Fj78dDW+gaZG621lpreKcGx8DbW1TuP9KgRri2xjZGubGjsBlnAt1MxiC2Lqo+m pNMvuFfOF2wHwFqbzzKgJEmQ1IYabfBF87w2GmbMD/cOxlLSuLcuYPTuTUk3KMU93Znc GahAls2YD0EjvT5qiKlsUMB0gSD+r/06rRUZWGI1jt7aAbvQ9LoLOU36RishyMnua02+ FR6NXWn0hpS3TWlnAKvnTavbrMulqal44CrMBzGcJ/QR+ru2EZSTfze+QAXfaGH+qj7H GhWPQwA5onKKUOL8wMYJmWzwmevDLUNG6D0YZ00lAMcuNSTN5nszJjykap6UVY+sv/G0 JjJw== X-Gm-Message-State: AOAM531MRImuYAgAD0LK/llHdK5ddhqZth7bh3WbBlQq4LhVsmoQ/j9A E5XV4zsUgSkgJTSAhylINSc= X-Received: by 2002:a2e:3004:0:b0:223:c126:5d1a with SMTP id w4-20020a2e3004000000b00223c1265d1amr3079728ljw.408.1646919408328; Thu, 10 Mar 2022 05:36:48 -0800 (PST) Received: from wse-c0127.beijerelectronics.com ([208.127.141.29]) by smtp.gmail.com with ESMTPSA id i2-20020a05651c120200b00247d22bc318sm1060299lja.22.2022.03.10.05.36.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Mar 2022 05:36: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 iproute2-next 2/3] net: switchdev: add support for offloading of fdb locked flag Date: Thu, 10 Mar 2022 14:36:16 +0100 Message-Id: <20220310133617.575673-3-schultz.hans+netdev@gmail.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220310133617.575673-1-schultz.hans+netdev@gmail.com> References: <20220310133617.575673-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