Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp3703891pxp; Tue, 15 Mar 2022 04:45:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx8ogduhDctqe3XHD9mgBcQ6vLfFqZ+sxOCZ+GdeGG0UPP+buHrKUpo6XIlp3317xDSSODB X-Received: by 2002:a17:90b:17ca:b0:1bf:6188:cc00 with SMTP id me10-20020a17090b17ca00b001bf6188cc00mr4244259pjb.2.1647344744348; Tue, 15 Mar 2022 04:45:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1647344744; cv=none; d=google.com; s=arc-20160816; b=uJRt/46eb2WQ7ZZ6zk8V1NowIUVU45RF++OMven5KIke+Qq26fslJ7/keIab3lJsi4 8QE6Yf6jofQB++2R+X8kvEl16curgcOZN8sUSZuMSXoaVrSgdK7Y2ByYoBCoxgKQOxk3 5SQDgLR/QT1jfdpHtQHEYO88vhuuKUKxx1O7rEG1nyDxFM4nKB1BG9ExsA+/bGlv87eA UsuKXJRzqeQrksgA499s6Tb+xSQr1vZYhlyLtG+/7KLWEZUaC4KBZmmMy/AJnVdD4QvY 4ux2mSKIGksTTf2QBgfBMHZndLihNWaGTFIdSQ1qG/BT1TqDJL0SU0aqNR37DpAI5zz8 w4CQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:references :in-reply-to:subject:cc:to:from:dkim-signature; bh=P+sSZ/MIHLkLQskC5zq8hmVD4ykc2QmIuRZHeedkEaI=; b=HgO125ytu+gXDSD3l5Bj8hYYBKnQcWxMA0jAlfKgcIPdl5t3dCMHUgFGOEcD3JxxIj h+YKjlcvljO9l2FFGuqUXUUSwQ1PCTgM3g1iq8uD1cMmDbWxvVgB4OWZe/yKvgHamXpH 1lwvccwwtxQ6iWNUfz7/pBNiGsHJOk0M5X7dAsPhZUq7OsDoCl7+BtNszDPNmWZxCM+o DLsMxMB9nT5t3/uY4x/SVQz2JzCGxU8nXzOMJ34J7cQAuQBs7UPAkiBjPLNgri3n7qyA 8Rx908bjvV7WCwS57BslabBwe8bPFeEKXyM86PO/FiJ+Kz4aMLFftwnjUMUoToDpxp67 d09A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@waldekranz-com.20210112.gappssmtp.com header.s=20210112 header.b=ojFUY1Yd; 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 i71-20020a63874a000000b003813c1e1e4esi4737402pge.701.2022.03.15.04.45.33; Tue, 15 Mar 2022 04:45:44 -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; dkim=pass header.i=@waldekranz-com.20210112.gappssmtp.com header.s=20210112 header.b=ojFUY1Yd; 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 S242461AbiCNWPE (ORCPT + 99 others); Mon, 14 Mar 2022 18:15:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40160 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237433AbiCNWPC (ORCPT ); Mon, 14 Mar 2022 18:15:02 -0400 Received: from mail-lf1-x130.google.com (mail-lf1-x130.google.com [IPv6:2a00:1450:4864:20::130]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 492573D496 for ; Mon, 14 Mar 2022 15:13:51 -0700 (PDT) Received: by mail-lf1-x130.google.com with SMTP id s29so8362146lfb.13 for ; Mon, 14 Mar 2022 15:13:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=waldekranz-com.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:in-reply-to:references:date:message-id :mime-version; bh=P+sSZ/MIHLkLQskC5zq8hmVD4ykc2QmIuRZHeedkEaI=; b=ojFUY1Ydha4EjvryEkE3HsxyjtloLRMCc5AmrdkMj8nj0s1r31KnEkySamhyOGNtxJ cJ4/+NGmk3It+nqJTCZRnc56LmxUKMBDiqc3uQZpAlGXydEiMUR7jJtwdNTo7+XXMIYH QNHQHUqVtdiJqKTkpy7d2LLoYXI9o363C5m5z3JucWS9HzlQMtFiJJdXcQRg0G9WxnEY wXE0rtDHshiBb39cqzlGsSxdkfRzf40J9yLOAikMOoZyBKTD8TtWjpUwsEgllQmeljW2 +DMEUU9d2SVX02w7yjNbVPm+mexqvGQEPcMME9EN0yRU2V4CNpsYEcIrO7KV7jTYwpEG yk0w== 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:in-reply-to:references:date :message-id:mime-version; bh=P+sSZ/MIHLkLQskC5zq8hmVD4ykc2QmIuRZHeedkEaI=; b=nMsQxgT0OLQHnXuiCNAr3sGQNmcRCSvO0o5PAaMllgS9kRGZWRnOT4EQ+SyD1XiN8r 8VAoVuX5URdPGHseQJw6r8bAmW3WzZln9P+y20aGMdzM45+DiWWG7YKiyHFqdDKO5slf FUaGw69EXRGmQQCjSR6kirzuTwI49zUh6UVB4SK3z6miDL4k5ZctC46qqhmdceaYI8cI TbN5l73FuRx6WqtB7Q3wjL1D/Jlm35BwftdvZhKVrnc3O1NZPg/38uku1jUVCOBPwX3x OaXNGM3WSnOrksbIcQjz1F9IJ/Kh5Xytp31vcHrRQf4aG8vD9Qs9Dam2tUupxv49cKxV K8sQ== X-Gm-Message-State: AOAM532Xfd595IOSpDIZBCIP0n0Vo9YsGCrD9nrJ0ZOPnOdu/33cpw2e HBieeE/uVExLvGg9bV48I41syw== X-Received: by 2002:ac2:5441:0:b0:448:5b32:c493 with SMTP id d1-20020ac25441000000b004485b32c493mr14552456lfn.438.1647296029382; Mon, 14 Mar 2022 15:13:49 -0700 (PDT) Received: from wkz-x280 (h-212-85-90-115.A259.priv.bahnhof.se. [212.85.90.115]) by smtp.gmail.com with ESMTPSA id h1-20020a056512054100b0044847b32426sm3481059lfl.156.2022.03.14.15.13.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 14 Mar 2022 15:13:48 -0700 (PDT) From: Tobias Waldekranz To: Vladimir Oltean Cc: davem@davemloft.net, kuba@kernel.org, Andrew Lunn , Vivien Didelot , Florian Fainelli , Jiri Pirko , Ivan Vecera , Roopa Prabhu , Nikolay Aleksandrov , Russell King , Ido Schimmel , Petr Machata , Cooper Lees , Matt Johnston , linux-kernel@vger.kernel.org, netdev@vger.kernel.org, bridge@lists.linux-foundation.org Subject: Re: [PATCH v3 net-next 09/14] net: dsa: Validate hardware support for MST In-Reply-To: <20220314202040.f2r4pidcy6ws34qv@skbuf> References: <20220314095231.3486931-1-tobias@waldekranz.com> <20220314095231.3486931-10-tobias@waldekranz.com> <20220314165649.vtsd3xqv7htut55d@skbuf> <20220314175556.7mjr4tui4vb4i5qn@skbuf> <87mthsl2wn.fsf@waldekranz.com> <20220314202040.f2r4pidcy6ws34qv@skbuf> Date: Mon, 14 Mar 2022 23:13:47 +0100 Message-ID: <87h780kwro.fsf@waldekranz.com> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,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 On Mon, Mar 14, 2022 at 22:20, Vladimir Oltean wrote: > On Mon, Mar 14, 2022 at 09:01:12PM +0100, Tobias Waldekranz wrote: >> On Mon, Mar 14, 2022 at 19:55, Vladimir Oltean wrote: >> > On Mon, Mar 14, 2022 at 06:56:49PM +0200, Vladimir Oltean wrote: >> >> > diff --git a/net/dsa/port.c b/net/dsa/port.c >> >> > index 58291df14cdb..1a17a0efa2fa 100644 >> >> > --- a/net/dsa/port.c >> >> > +++ b/net/dsa/port.c >> >> > @@ -240,6 +240,10 @@ static int dsa_port_switchdev_sync_attrs(struct dsa_port *dp, >> >> > if (err && err != -EOPNOTSUPP) >> >> > return err; >> >> > >> >> > + err = dsa_port_mst_enable(dp, br_mst_enabled(br), extack); >> >> > + if (err && err != -EOPNOTSUPP) >> >> > + return err; >> >> >> >> Sadly this will break down because we don't have unwinding on error in >> >> place (sorry). We'd end up with an unoffloaded bridge port with >> >> partially synced bridge port attributes. Could you please add a patch >> >> previous to this one that handles this, and unoffloads those on error? >> > >> > Actually I would rather rename the entire dsa_port_mst_enable() function >> > to dsa_port_mst_validate() and move it to the beginning of dsa_port_bridge_join(). >> > This simplifies the unwinding that needs to take place quite a bit. >> >> Well you still need to unwind vlan filtering if setting the ageing time >> fails, which is the most complicated one, right? > > Yes, but we can leave that for another day :) > > ...ergo > >> Should the unwinding patch still be part of this series then? > > no. Agreed >> Still, I agree that _validate is a better name, and then _bridge_join >> seems like a more reasonable placement. >> >> While we're here, I actually made this a hard error in both scenarios >> (but forgot to update the log - will do that in v4, depending on what we >> decide here). There's a dilemma: >> >> - When reacting to the attribute event, i.e. changing the mode on a >> member we're apart of, we _can't_ return -EOPNOTSUPP as it will be >> ignored, which is why dsa_port_mst_validate (nee _enable) returns >> -EINVAL. >> >> - When joining a bridge, we _must_ return -EOPNOTSUPP to trigger the >> software fallback. >> >> Having something like this in dsa_port_bridge_join... >> >> err = dsa_port_mst_validate(dp); >> if (err == -EINVAL) >> return -EOPNOTSUPP; >> else if (err) >> return err; >> >> ...works I suppose, but feels somewhat awkwark. Any better ideas? > > What you can do is follow the model of dsa_switch_supports_uc_filtering(), > and create a dsa_switch_supports_mst() which is called inside an > "if br_mst_enabled(br)" check, and returns bool. When false, you could > return -EINVAL or -EOPNOTSUPP, as appropriate. > > This is mostly fine, except for the pesky dsa_port_can_configure_learning(dp) > check :) So while you could name it dsa_port_supports_mst() and pass it > a dsa_port, the problem is that you can't put the implementation of this > new dsa_port_supports_mst() next to dsa_switch_supports_uc_filtering() > where it would be nice to sit for symmetry, because the latter is static > inline and we're missing the definition of dsa_port_can_configure_learning(). > So.. the second best thing is to keep dsa_port_supports_mst() in the > same place where dsa_port_mst_enable() currently is. > > What do you think? I think that would mostly work. It would have to be positioned higher up in the file though, so that it can be called from _bridge_join. Unless we add a forward for it of course, but that seems to break with existing conventions.