Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp2102930rwe; Sun, 28 Aug 2022 04:03:53 -0700 (PDT) X-Google-Smtp-Source: AA6agR5y2M+BVqT2fg+ecNpATMuuRIiTBpP8K4AtetQYq+D8UPded5C6yZ3SJI4++uCbcOPnmJSf X-Received: by 2002:a63:5b61:0:b0:41d:3227:37b8 with SMTP id l33-20020a635b61000000b0041d322737b8mr9899769pgm.265.1661684633051; Sun, 28 Aug 2022 04:03:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661684633; cv=none; d=google.com; s=arc-20160816; b=wfgm1xHNcg6US84JN7OnISoOxxasHl62eoYEd43CYZNAxtI8zBRDYp+sls2ODK8Y+o 8KJSn1FRTdWMvbuAhrlzbdO2hVE5ZckUeddWUtiW6JCMB/zOZEVouW4XYd5u03iuhkUd wOcLUWX+xnKlbpJZ1D1EN96rima7MGuumWex2+HgmspjuDxP8F1xGl/3aQrPPNdDWiBc Cbn01WxNFSmAboF6XuNY5dlheeeTVtyIZ+DFYvzpmzP2OfCWlngS+svCUD72ul/HSzJw vdxyRO4S1czPZhdqyBXI0ohtW7Rvl/Pfl+cwwETkrUx5ruZzwYXJSMqBjLFOS6rJWf8i hmkg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:message-id:user-agent :references:in-reply-to:subject:cc:to:from:date:mime-version; bh=nPMeF7UlMqmgavNyldRYKQLhZoRZBGDHg4Lf9x0BnkU=; b=VKmlGZIgxk6LMM22rZWFCTYA5GCszfB2EKSVULKCpjkZvq3T4ibYUbKoPulwOwgfbY iHa/518RVkHsXbCl/SP4TOWlJ+yBQwEKFyf4wAPIcXwxLS+AT43W8Ng8CUAN/B3lgPZ0 4+l2IG6VuRXe/0fdDa6VfuPM2nr1JfmSWheezb2I+L1OkVuLXGpQNCWL3Jp/rD1C1iEE O1EvbvNyLM+xSrpaX9aKRQIoo0NGigxSah2pBMGrKiUGA3KJxUchmACmfIdBrsl68AgQ 5QRBb+C06tzvsVQZ3/8bh219JxcwSkeIcNT/grfZZe929BRVffyrQLrQ2s1jKL3yJdz4 oT3g== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z1-20020a63ac41000000b0042b40b59852si6621492pgn.554.2022.08.28.04.03.42; Sun, 28 Aug 2022 04:03:53 -0700 (PDT) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229595AbiH1KXi (ORCPT + 99 others); Sun, 28 Aug 2022 06:23:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57504 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229436AbiH1KXe (ORCPT ); Sun, 28 Aug 2022 06:23:34 -0400 Received: from mailout-taastrup.gigahost.dk (mailout-taastrup.gigahost.dk [46.183.139.199]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A35F74B0E4; Sun, 28 Aug 2022 03:23:32 -0700 (PDT) Received: from mailout.gigahost.dk (mailout.gigahost.dk [89.186.169.112]) by mailout-taastrup.gigahost.dk (Postfix) with ESMTP id DDFDB18845DE; Sun, 28 Aug 2022 10:23:30 +0000 (UTC) Received: from smtp.gigahost.dk (smtp.gigahost.dk [89.186.169.109]) by mailout.gigahost.dk (Postfix) with ESMTP id D259325032B7; Sun, 28 Aug 2022 10:23:30 +0000 (UTC) Received: by smtp.gigahost.dk (Postfix, from userid 1000) id C77859EC0009; Sun, 28 Aug 2022 10:23:30 +0000 (UTC) X-Screener-Id: 413d8c6ce5bf6eab4824d0abaab02863e8e3f662 MIME-Version: 1.0 Date: Sun, 28 Aug 2022 12:23:30 +0200 From: netdev@kapio-technology.com To: Ido Schimmel Cc: davem@davemloft.net, kuba@kernel.org, netdev@vger.kernel.org, Florian Fainelli , Andrew Lunn , Vivien Didelot , Vladimir Oltean , Eric Dumazet , Paolo Abeni , Kurt Kanzenbach , Hauke Mehrtens , Woojung Huh , UNGLinuxDriver@microchip.com, Sean Wang , Landen Chao , DENG Qingfang , Matthias Brugger , Claudiu Manoil , Alexandre Belloni , Jiri Pirko , Ivan Vecera , Roopa Prabhu , Nikolay Aleksandrov , Shuah Khan , Christian Marangi , Daniel Borkmann , Yuwei Wang , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, bridge@lists.linux-foundation.org, linux-kselftest@vger.kernel.org Subject: Re: [PATCH v5 net-next 1/6] net: bridge: add locked entry fdb flag to extend locked port feature In-Reply-To: References: <20220826114538.705433-1-netdev@kapio-technology.com> <20220826114538.705433-2-netdev@kapio-technology.com> User-Agent: Gigahost Webmail Message-ID: X-Sender: netdev@kapio-technology.com Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW, SPF_HELO_NONE,SPF_NONE,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 On 2022-08-27 17:19, Ido Schimmel wrote: > On Fri, Aug 26, 2022 at 01:45:33PM +0200, Hans Schultz wrote: >> >> nbp_switchdev_frame_mark(p, skb); >> @@ -943,6 +946,10 @@ static int br_setport(struct net_bridge_port *p, >> struct nlattr *tb[], >> br_set_port_flag(p, tb, IFLA_BRPORT_NEIGH_SUPPRESS, >> BR_NEIGH_SUPPRESS); >> br_set_port_flag(p, tb, IFLA_BRPORT_ISOLATED, BR_ISOLATED); >> br_set_port_flag(p, tb, IFLA_BRPORT_LOCKED, BR_PORT_LOCKED); >> + br_set_port_flag(p, tb, IFLA_BRPORT_MAB, BR_PORT_MAB); >> + >> + if (!(p->flags & BR_PORT_LOCKED)) >> + p->flags &= ~BR_PORT_MAB; The reason for this is that I wanted it to be so that if you have MAB enabled (and locked of course) and unlock the port, it will automatically clear both flags instead of having to first disable MAB and then unlock the port. > > Any reason not to emit an error if MAB is enabled while the port is > unlocked? Something like this (untested): > > diff --git a/net/bridge/br_netlink.c b/net/bridge/br_netlink.c > index 5aeb3646e74c..18353a4c29e1 100644 > --- a/net/bridge/br_netlink.c > +++ b/net/bridge/br_netlink.c > @@ -944,6 +944,12 @@ static int br_setport(struct net_bridge_port *p, > struct nlattr *tb[], > br_set_port_flag(p, tb, IFLA_BRPORT_ISOLATED, BR_ISOLATED); > br_set_port_flag(p, tb, IFLA_BRPORT_LOCKED, BR_PORT_LOCKED); > > + if (!(p->flags & BR_PORT_LOCKED) && (p->flags & BR_PORT_MAB)) { > + NL_SET_ERR_MSG(extack, "MAB cannot be enabled when > port is unlocked"); > + p->flags = old_flags; > + return -EINVAL; > + } > + > changed_mask = old_flags ^ p->flags; > > err = br_switchdev_set_port_flag(p, p->flags, changed_mask, > extack); >