Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp6128851rwd; Wed, 24 May 2023 11:05:13 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6URgWI/1qaKLxdkr/d8hecuG9tCzEBAO8RaA0WO1P6x32G0KuDDo0qnyEd3m8VkLFDGjvW X-Received: by 2002:a05:6a20:9f99:b0:106:feff:71d with SMTP id mm25-20020a056a209f9900b00106feff071dmr15130680pzb.39.1684951513368; Wed, 24 May 2023 11:05:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684951513; cv=none; d=google.com; s=arc-20160816; b=Iy6fUefgkIVcqw2/je2bS688AzH/4HfI24vAA510jU5OTsdfL9hGEbCZ12OCIkx95o QLdVF7cKiz1GD1I511BbiGO6CExOSRkDNr96ekuVcpE+5nMJ2T7v7gKZQ7q8aVenykHB ElUedVwpKeI1pMMDnK5w23LGaONEsXIkAXwtpxmYcW/Rkv+FpE4GcXDn198hSN1Tu6r5 9wxb2xMnJEu8A3rfF0D8p2hF7Gykh7u0PwzAMWKZ9A26GmY2fG7OO5PY48rA30v7fPcd bLnGe81m/5cq+8dVj/TS5g2KsmKxtqF8hbrSTBivHcn9pCogAQfDMVvRakxyw8E3c0TJ /15w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=UuWZGCzkbOMRI3DKUsjT1bBZX5K7moJ19ldgpCy0JvM=; b=lmh9mHHmNJRF1pguwdLr1xJx191cgMfSJMzwtooRJVDlFxMqgUBAQfp15Kk3WVQIFM kOtM/eqPruV4PicnfBQciNMXtSo9DANEzFY8gfGbFLegqIBYG1+HfwN+jU4/KwFlLZvG bdQHDk8jTt+AM/TAPAqL9q+DgH2mUhGSE/CbGSszKPM5CIHDu0ndxw8Zqtb/qXVRGrw9 gk98uvbEImgvQLT55nym/AquaqzGqdMTl15us72/67y7nBq6tr98eebKlEP+DMTnQs54 nrpVTfHZFpNGIpEiB58xeOjJuX0MVIWns1xFfFbioIW0bHuEwo0dxiCl+UL4Ju+r6761 t/qw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=UshDxhlZ; 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 t22-20020a63b256000000b00528e0b1dd0asi8934125pgo.735.2023.05.24.11.04.57; Wed, 24 May 2023 11:05:13 -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=@gmail.com header.s=20221208 header.b=UshDxhlZ; 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 S232503AbjEXRfV (ORCPT + 99 others); Wed, 24 May 2023 13:35:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50768 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235277AbjEXRfS (ORCPT ); Wed, 24 May 2023 13:35:18 -0400 Received: from mail-ed1-x52a.google.com (mail-ed1-x52a.google.com [IPv6:2a00:1450:4864:20::52a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8C533123; Wed, 24 May 2023 10:35:15 -0700 (PDT) Received: by mail-ed1-x52a.google.com with SMTP id 4fb4d7f45d1cf-510d9218506so145911a12.1; Wed, 24 May 2023 10:35:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1684949714; x=1687541714; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:from:to :cc:subject:date:message-id:reply-to; bh=UuWZGCzkbOMRI3DKUsjT1bBZX5K7moJ19ldgpCy0JvM=; b=UshDxhlZwL2RlsRgWuaG05N4herwcLHOO9gWXg/zppo1pzZCQnkOQ+SWBL8hqPHspS OOtWES1GFmpmKAZO2RPtmxNwV9enRAHPTe9LsWkO2/UVv4ZPF9oCt/jQfOmR8lW3irro D5tBZJTdwBTW9OWhrLg2fEH+WJLA4k97Hp7cEWR4m9EJZ0LTfm3g8IrX2gY+apmywGyy Aq7194GZarDb3AApZTuFTgSQNYaTcVN20dhn72DFej0x0vglISKOH9KddxSDAuDwDnMT glXhmymOYMV/Vyo9/r/jmEgTQAIZ20uJr+sCo6/89V8+73LoerVm2oN+scqnj3FWGuCc BT1Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684949714; x=1687541714; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=UuWZGCzkbOMRI3DKUsjT1bBZX5K7moJ19ldgpCy0JvM=; b=SK6xsOStNhpOS7hYJgX5p1wPQGgc+lgc8ehbMmqOFVMrrbHY4VNl5ovEHOyWtF7XTZ z/G1sy/2ZwqXiI7UxR8yhskjrhBY5pS4kp5eowRg/fUJme2tnedrq1DJNGaFi6lJLKOr wTf+WnlsjE5bi4GrwqBZqe8Q1lNU1p2fTCLQVL+IvgX8KpAedrSmpOvxkGk1sgPGie8T n25nSzuNSsXu5F4b+iTpP/jw66dAL8ew+wxOfmafeeSBm/Pu5WzPllRa2larnsxW3O0R 8Gj8KCpmVVSk+OI4/Va2QQ8qbpUhI58hGZ0jSdLxv1tQHECAeI63bvQhzoeFrZnci3xX BmXQ== X-Gm-Message-State: AC+VfDyWTYrgFj5rOfz0uUG4qOacU5JtJ2sZQDCLAfqwFOXw5GaPqQa5 DA0Aot0s+k9cCXpYMubBtdk= X-Received: by 2002:a05:6402:453:b0:504:a3ec:eacc with SMTP id p19-20020a056402045300b00504a3eceaccmr205970edw.4.1684949713669; Wed, 24 May 2023 10:35:13 -0700 (PDT) Received: from skbuf ([188.27.184.189]) by smtp.gmail.com with ESMTPSA id ba7-20020a0564021ac700b0050bce352dc5sm126542edb.85.2023.05.24.10.35.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 May 2023 10:35:13 -0700 (PDT) Date: Wed, 24 May 2023 20:35:10 +0300 From: Vladimir Oltean To: arinc9.unal@gmail.com Cc: Sean Wang , Landen Chao , DENG Qingfang , Daniel Golle , Andrew Lunn , Florian Fainelli , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Matthias Brugger , AngeloGioacchino Del Regno , Russell King , =?utf-8?B?QXLEsW7DpyDDnE5BTA==?= , Richard van Schagen , Richard van Schagen , Frank Wunderlich , Bartel Eerdekens , erkin.bozoglu@xeront.com, mithat.guner@xeront.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org Subject: Re: [PATCH net-next 06/30] net: dsa: mt7530: improve code path for setting up port 5 Message-ID: <20230524173510.xvq434ekaee4664m@skbuf> References: <20230522121532.86610-1-arinc.unal@arinc9.com> <20230522121532.86610-1-arinc.unal@arinc9.com> <20230522121532.86610-7-arinc.unal@arinc9.com> <20230522121532.86610-7-arinc.unal@arinc9.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20230522121532.86610-7-arinc.unal@arinc9.com> <20230522121532.86610-7-arinc.unal@arinc9.com> 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 On Mon, May 22, 2023 at 03:15:08PM +0300, arinc9.unal@gmail.com wrote: > From: Arınç ÜNAL > > There're two code paths for setting up port 5: > > mt7530_setup() > -> mt7530_setup_port5() > > mt753x_phylink_mac_config() > -> mt753x_mac_config() > -> mt7530_mac_config() > -> mt7530_setup_port5() > > Currently mt7530_setup_port5() from mt7530_setup() always runs. If port 5 > is used as a CPU, DSA, or user port, mt7530_setup_port5() from > mt753x_phylink_mac_config() won't run. That is because priv->p5_interface > set on mt7530_setup_port5() will match state->interface on > mt753x_phylink_mac_config() which will stop running mt7530_setup_port5() > again. > > mt7530_setup_port5() from mt753x_phylink_mac_config() won't run when port 5 > is disabled or used for PHY muxing as port 5 won't be defined on the > devicetree. > > Therefore, mt7530_setup_port5() will never run from > mt753x_phylink_mac_config(). > > Address this by not running mt7530_setup_port5() from mt7530_setup() if > port 5 is used as a CPU, DSA, or user port. For the cases of PHY muxing or > the port being disabled, call mt7530_setup_port5() from mt7530_setup(). So TL;DR: mt7530_setup() -> mt7530_setup_port5() short-circuits mt753x_phylink_mac_config() -> ... -> mt7530_setup_port5() through the stateful variable priv->p5_interface, such that port 5 is effectively never configured by phylink, but statically at probe time. The main goal of the patch is to undo the short-circuit, and let phylink configure port 5. It is worth stating that we know phylink will always be present, because mt7530 isn't in the dsa_switches_apply_workarounds[] array. Otherwise this strategy would have been problematic with some device trees. > Do not set priv->p5_interface on mt7530_setup_port5(). There won't be a > case where mt753x_phylink_mac_config() runs after mt7530_setup_port5() > anymore. The bulk of the change is difficult enough to follow. I believe this part could be done through a separate patch, and the rest would still work.