Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 621D3C636D4 for ; Thu, 2 Feb 2023 15:46:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232648AbjBBPqe (ORCPT ); Thu, 2 Feb 2023 10:46:34 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45972 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232024AbjBBPqb (ORCPT ); Thu, 2 Feb 2023 10:46:31 -0500 Received: from vps0.lunn.ch (vps0.lunn.ch [156.67.10.101]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CA92977DD9; Thu, 2 Feb 2023 07:46:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lunn.ch; s=20171124; h=In-Reply-To:Content-Disposition:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:From:Sender:Reply-To:Subject: Date:Message-ID:To:Cc:MIME-Version:Content-Type:Content-Transfer-Encoding: Content-ID:Content-Description:Content-Disposition:In-Reply-To:References; bh=BF3GBvlC/+RSSxBp90Pqw55bNKBsJW82s0xPbbxC8Ow=; b=FR2nOapuJ0SlEF+innoLhrdDvB HxY/xDZyhmI9nJVlH/PGIKWzGxmQrHLpgOnNraQmbn16e2p1P3D/XoLwi07kwZxdvpbS4hPGAjVFt vvG7xnsqBo1uzGzUvV+fBsoTim06sW5gKBMeR3D3e2SAv/aJUSOgoCzJ7E3QGnkLra+Q=; Received: from andrew by vps0.lunn.ch with local (Exim 4.94.2) (envelope-from ) id 1pNbhU-003uPH-C5; Thu, 02 Feb 2023 16:40:36 +0100 Date: Thu, 2 Feb 2023 16:40:36 +0100 From: Andrew Lunn To: Rakesh Sankaranarayanan Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, f.fainelli@gmail.com, olteanv@gmail.com, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, woojung.huh@microchip.com, UNGLinuxDriver@microchip.com, linux@armlinux.org.uk Subject: Re: [RFC PATCH net-next 07/11] net: dsa: microchip: lan937x: update switch register Message-ID: References: <20230202125930.271740-1-rakesh.sankaranarayanan@microchip.com> <20230202125930.271740-8-rakesh.sankaranarayanan@microchip.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230202125930.271740-8-rakesh.sankaranarayanan@microchip.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Feb 02, 2023 at 06:29:26PM +0530, Rakesh Sankaranarayanan wrote: > Second switch in cascaded connection doesn't have port with macb > interface. dsa_switch_register returns error if macb interface is > not up. Due to this reason, second switch in cascaded connection will > not report error during dsa_switch_register and mib thread work will be > invoked even if actual switch register is not done. This will lead to > kernel warning and it can be avoided by checking device tree setup > status. This will return true only after actual switch register is done. What i think you need to do is move the code into ksz_setup(). With a D in DSA setup, dsa_switch_register() adds the switch to the list of switches, and then a check is performed to see if all switches in the cluster have been registered. If not, it just returns. If all switches have been registered, it then iterates over all the switches can calls dsa_switch_ops.setup(). By moving the start of the MIB counter into setup(), it will only be started once all the switches are present, and it means you don't need to look at DSA core internal state. Andrew