Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp10099787rwb; Fri, 25 Nov 2022 00:40:47 -0800 (PST) X-Google-Smtp-Source: AA0mqf7mA4BQP7+lZcKYOZLfx0+yGXHvUjF/2mHLHwbMWoQo//Svt63zZLE4tphYt/mT1j1Ke5U0 X-Received: by 2002:a17:902:aa88:b0:188:5c0c:758a with SMTP id d8-20020a170902aa8800b001885c0c758amr17719505plr.134.1669365647049; Fri, 25 Nov 2022 00:40:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669365647; cv=none; d=google.com; s=arc-20160816; b=zAuqLRUa+fvPmUpQ8jbThHOA3zf6ESqUwFJYIuJ/33qtFTQ8i/WiS+NUdeIf0seu23 EPJZTFmzca2wTfPdpIeqiLulY4Z890jJZ+EzLp2o5QciLcgwsYwJP9hrFyIlHfn4tfNX jLykMFnBQs8ZtC1DkE7zMHDeZcxAxPTDCPrvYZdVIEoNDing/xGoFY9kC24IWUhXHG+Y TAEu1SlKM0gk3xXkS/56Kn+rzIRJ7Hic0Ea9GbrkRcdU706XiZC/AmlctN9WNkinpo19 I0ARDBXLkLB8nkU55H59jpOK7MItp7+psIEV+2MJnXWjH6Fs6n7GFUa81dTGSzhCcJ3v Y+Zw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=GsZyIz+AlIIB4Tcc93tNw8aQZgCBW/lGIfiE46J2+qk=; b=TO5NkIUD1H9sqL1KY4ie7JyhDPMIsyt6QP7Uu7Da/N0/O9kQQRXrTdomuuibuq2Q1T z2mzYSU0gWErLGWlTdFQFvH9XuESc8TIJjg0nv7x4q9uVnOc9mAP+tAxaVu0IHKHf5VJ rwdb5KcI5MrxP5uyQt27AkzVMuY8eSk8GPdGnj5epfNNOdw4sRj0Y8QkqYO7uUd+ZCgq odflpPDr9Tab3MNCRQne3Vm82Y+Y7q9kyRVB3reZd1NLFOsdtwy+4Wg6DtS6hKQvk0AT h4jADWhbrwYi7wc6BgMuw5yBHH1qVBp4GfJgXDOiLCVs9xK6O9kd0SrvbZ+Kf0wNNSUN M1vQ== 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 x5-20020a170902ea8500b0018863e1bc39si2991420plb.248.2022.11.25.00.40.35; Fri, 25 Nov 2022 00:40:47 -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; 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 S229618AbiKYHt1 (ORCPT + 87 others); Fri, 25 Nov 2022 02:49:27 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40506 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229576AbiKYHtZ (ORCPT ); Fri, 25 Nov 2022 02:49:25 -0500 Received: from metis.ext.pengutronix.de (metis.ext.pengutronix.de [IPv6:2001:67c:670:201:290:27ff:fe1d:cc33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E92E12F00F for ; Thu, 24 Nov 2022 23:49:23 -0800 (PST) Received: from ptx.hi.pengutronix.de ([2001:67c:670:100:1d::c0]) by metis.ext.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oyTSa-0000mo-6P; Fri, 25 Nov 2022 08:49:20 +0100 Received: from ore by ptx.hi.pengutronix.de with local (Exim 4.92) (envelope-from ) id 1oyTSY-0006IA-Q3; Fri, 25 Nov 2022 08:49:18 +0100 Date: Fri, 25 Nov 2022 08:49:18 +0100 From: Oleksij Rempel To: Arun.Ramadoss@microchip.com Cc: Woojung.Huh@microchip.com, andrew@lunn.ch, f.fainelli@gmail.com, davem@davemloft.net, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, UNGLinuxDriver@microchip.com, edumazet@google.com, pabeni@redhat.com, kernel@pengutronix.de, kuba@kernel.org, olteanv@gmail.com, vivien.didelot@gmail.com Subject: Re: [PATCH net-next v6 6/6] net: dsa: microchip: ksz8: move all DSA configurations to one location Message-ID: <20221125074918.GB22688@pengutronix.de> References: <20221124101458.3353902-1-o.rempel@pengutronix.de> <20221124101458.3353902-7-o.rempel@pengutronix.de> <20221125055240.GA22688@pengutronix.de> <439da76d5f0fb800f11cec66c06a444a7a4e591a.camel@microchip.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <439da76d5f0fb800f11cec66c06a444a7a4e591a.camel@microchip.com> X-Sent-From: Pengutronix Hildesheim X-URL: http://www.pengutronix.de/ X-Accept-Language: de,en X-Accept-Content-Type: text/plain User-Agent: Mutt/1.10.1 (2018-07-13) X-SA-Exim-Connect-IP: 2001:67c:670:100:1d::c0 X-SA-Exim-Mail-From: ore@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS autolearn=unavailable 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 Fri, Nov 25, 2022 at 07:14:32AM +0000, Arun.Ramadoss@microchip.com wrote: > Hi Oleksij, > > On Fri, 2022-11-25 at 06:52 +0100, Oleksij Rempel wrote: > > EXTERNAL EMAIL: Do not click links or open attachments unless you > > know the content is safe > > > > Hi Arun, > > > > On Thu, Nov 24, 2022 at 03:05:27PM +0000, Arun.Ramadoss@microchip.com > > wrote: > > > Hi Oleksij, > > > On Thu, 2022-11-24 at 11:14 +0100, Oleksij Rempel wrote: > > > > EXTERNAL EMAIL: Do not click links or open attachments unless you > > > > know the content is safe > > > > > > > > To make the code more comparable to KSZ9477 code, move DSA > > > > configurations to the same location. > > > > > > > > Signed-off-by: Oleksij Rempel > > > > --- > > > > drivers/net/dsa/microchip/ksz8795.c | 20 ++++++++++---------- > > > > 1 file changed, 10 insertions(+), 10 deletions(-) > > > > > > > > diff --git a/drivers/net/dsa/microchip/ksz8795.c > > > > b/drivers/net/dsa/microchip/ksz8795.c > > > > index 060e41b9b6ef..003b0ac2854c 100644 > > > > --- a/drivers/net/dsa/microchip/ksz8795.c > > > > +++ b/drivers/net/dsa/microchip/ksz8795.c > > > > @@ -1359,6 +1359,16 @@ int ksz8_setup(struct dsa_switch *ds) > > > > > > > > ds->mtu_enforcement_ingress = true; > > > > > > > > + /* We rely on software untagging on the CPU port, so that > > > > we > > > > + * can support both tagged and untagged VLANs > > > > + */ > > > > + ds->untag_bridge_pvid = true; > > > > + > > > > + /* VLAN filtering is partly controlled by the global VLAN > > > > + * Enable flag > > > > + */ > > > > + ds->vlan_filtering_is_global = true; > > > > + > > > > ksz_cfg(dev, S_REPLACE_VID_CTRL, SW_FLOW_CTRL, true); > > > > > > > > /* Enable automatic fast aging when link changed > > > > detected. */ > > > > @@ -1418,16 +1428,6 @@ int ksz8_switch_init(struct ksz_device > > > > *dev) > > > > dev->phy_port_cnt = dev->info->port_cnt - 1; > > > > dev->port_mask = (BIT(dev->phy_port_cnt) - 1) | dev- > > > > >info- > > > > > cpu_ports; > > > > > > Since you moved dsa related items to ksz8_setup, remaining items in > > > ksz8_switch_init are > > > - dev->cpu_port - Used in ksz_setup but called after the individual > > > switch setup function. We can move it ksz8_setup. > > > - dev->phy_port_cnt - Used in ksz8_vlan_filtering and > > > ksz8_config_cpuport. We can move. > > > - dev->port_mask - used in ksz_switch_register. So we cannot move. > > > > > > To make the ksz8_switch_init and ksz9477_switch_init function > > > similar, > > > we can move dev->cpu_port and dev->phy_port_cnt from > > > ksz8_switch_init > > > to ksz8_setup > > > > It make no sense to move this variables. Every place where they are > > used, can be replaced with dsa functions like: > > dsa_switch_for_each_user_port() or dsa_cpu_ports()/dsa_is_cpu_port() > > Making this changes within this patch set make no sense to. > > Agreed. > I thought of cleaning up > ksz8_switch_init/ksz9477_switch_init/lan937x_switch_init, since these > functions are not performing any useful activity other than > initializing these variables. Similarly all the exit function are > performing same reset function. I thought these init and exit function > in the ksz_dev_ops structure is reduntant. I'll try to add ore cleanups to my currently pending patch set. Currently I'm working on following ksz8 related tasks: - add MTU configuration support - add stats64 support - fix fdb_dump and add fdb_add/del support - fix PHY loopback support to make selftest work Regards, Oleksij -- Pengutronix e.K. | | Steuerwalder Str. 21 | http://www.pengutronix.de/ | 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |