Received: by 2002:a05:6a10:6d25:0:0:0:0 with SMTP id gq37csp1907513pxb; Mon, 13 Sep 2021 07:57:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyUFkGPI09EExaU+R3oSM9g7wVYc1wWYRJMK4L8FVZM9IBjXhiepB7KtVez1vH4jCyYtdBK X-Received: by 2002:a17:906:144e:: with SMTP id q14mr13012375ejc.19.1631545061015; Mon, 13 Sep 2021 07:57:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631545061; cv=none; d=google.com; s=arc-20160816; b=R9D9auG+iI8R0PAiGaXNwqVlC/8Ea6PH40aEN1qP9Q50HHQl4DwrAwEuyWcTG+GhMY P8iG+VhLldYF+39g8O1Otxu5NGZZFjc9aoNWTHaqzAfCcRGZwot3VzbVHNsReFtOv2vL esZPzLTxNZZuiZzANs6zKtfQcxWpNXJG2Hqzrm3jheEKuLbsj0AIyzXtwqtlPKKkMxnq XNBXIMPPDlVmIbzOF3MUA0mPl1bdLNzPME39KM5NIQ0wH+FCLYV+1wzQiLPfsOAx1oiy /U7Rmrqki+L+l3iq+fw5WAuQjA5l49SY96gZExZbZqKzBmXVJoD8WVnNw35+B1MUiI7u 0Pig== 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-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=7Hugz/+OONUxuIBhoIuTQLQDjY595cqMrn5yj0K0lzM=; b=N1zqb2JRuNdjHH0vjtGiRiYZcF0SRuLLKTS8YYG4JWFA03XdMm3vn+rZt6QuYQs+GH jkLDZiPb7ucOm89kc+qRjINyK7DcX4DyNC1m2pGLjWLVmz8Yil14fEz/TKUBeUW2YgVO NjSh9coHE9fpfXnIllxuUukYQuX5MM7Cho32Tneucj337f4iUsevdDVfCGYh7k8HvC4u dt1hhk3XiHEjJyOhyXJSln6W5jbf5udskeSgGXn2FpOj817Qz1wHnUUJS2aCEIalOrjo Vtkcc5qfMWZzegwYIGsk8jI0WeQ+WQsPeoI5TBByCKRJ7lfuYomBe2Xnsk0OA693IuSB fFhA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=cR8wuHYo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id e2si8864411ejs.346.2021.09.13.07.57.15; Mon, 13 Sep 2021 07:57:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=cR8wuHYo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S1345677AbhIMOyD (ORCPT + 99 others); Mon, 13 Sep 2021 10:54:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48670 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346764AbhIMOtH (ORCPT ); Mon, 13 Sep 2021 10:49:07 -0400 Received: from mail-ed1-x536.google.com (mail-ed1-x536.google.com [IPv6:2a00:1450:4864:20::536]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D3B20C028BA3; Mon, 13 Sep 2021 06:31:33 -0700 (PDT) Received: by mail-ed1-x536.google.com with SMTP id c22so12997860edn.12; Mon, 13 Sep 2021 06:31:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=7Hugz/+OONUxuIBhoIuTQLQDjY595cqMrn5yj0K0lzM=; b=cR8wuHYosPSDj/uz3fuTLgksvjvk1j8FNRACyVsbGIySnNK7/+iV3qiKlleBUvIyuW QMcJGoao9TxQ0hZrcBwjAv0Scc+RA6IyK+fda8+/IpGogmboTd5ykH12mGHdWpvKQ+7v Gl5ORap11bejGGFuCZxlAPGItJ5Gy0h4l2owY+CRMKvrnVPL0WCaoEh5MYp3FPIxhezJ liOFdzY5s2EK5Z4xDooyxpIsTyFGRMT+Pu1SWaMVRIZLUit2X7YcIskokK5GgK+wtP4u oOALSyOTK7t6zOqLX8UakUGcrkPKlbVjx8lioL1/4lr4AAk1DZ5kD7LNUtXf7pMvy9qE w5Hg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=7Hugz/+OONUxuIBhoIuTQLQDjY595cqMrn5yj0K0lzM=; b=inKmxvMXNR1hXxwhC879rZxtNXtfNDp0sFOUSroX46NiY8DkYP6uyBt5XaWQppkUeZ /0h9bntTdWNtVOOR57/x4qKge7btDGVyggI+xN+XHwU1EMP2EmjxL3U1AgfYcG+owWeq osJfAen+JHyxVffAoRq5kUT6b2wJRdtqaDpp90aAFYtuiEMJ+lTlCM+eYqeIDvAu/HqX DkwgXm4aYz8ISWJr6zYUjzpK2itmalgeIYtGSGDBQ06mxm1OIkb53tQibFZUvnc4KCS1 7n8YNdFrMR+/1fjdIA6bsk5pUUiqtlIUa38uDaTb6cVDFIYGSubNTvM9n8SPw9wY9yfx PEGQ== X-Gm-Message-State: AOAM531W6YjL/YeGlJN0ijYmCVUGPoWDTy0UCk0uo5O0HdBqbql+BfRz LRPty+X/rHnj9k+U4B2zu3k= X-Received: by 2002:aa7:d1d3:: with SMTP id g19mr6012882edp.103.1631539892404; Mon, 13 Sep 2021 06:31:32 -0700 (PDT) Received: from skbuf ([82.78.148.104]) by smtp.gmail.com with ESMTPSA id v13sm3458353ejh.62.2021.09.13.06.31.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Sep 2021 06:31:32 -0700 (PDT) Date: Mon, 13 Sep 2021 16:31:30 +0300 From: Vladimir Oltean To: Andrew Lunn Cc: Vladimir Oltean , netdev@vger.kernel.org, Florian Fainelli , Vivien Didelot , "David S. Miller" , Jakub Kicinski , Kurt Kanzenbach , Hauke Mehrtens , Woojung Huh , UNGLinuxDriver@microchip.com, Sean Wang , Landen Chao , DENG Qingfang , Matthias Brugger , Claudiu Manoil , Alexandre Belloni , Linus Walleij , George McCollister , Heiner Kallweit , Russell King , Oleksij Rempel , Michael Grzeschik , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, Lino Sanfilippo Subject: Re: [RFC PATCH net 2/5] net: dsa: be compatible with masters which unregister on shutdown Message-ID: <20210913133130.ohk4co56v4mtljyk@skbuf> References: <20210912120932.993440-1-vladimir.oltean@nxp.com> <20210912120932.993440-3-vladimir.oltean@nxp.com> <20210912131837.4i6pzwgn573xutmo@skbuf> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Sep 13, 2021 at 03:23:12PM +0200, Andrew Lunn wrote: > > I will fix this when I send the v2 patch, but I will not send that now, > > as I would like to get some feedback on the approach first. > > It would of been nice to have less boilerplate code, but the basic > idea seems O.K. > > Have you tested it with a D in DSA system? To various degrees. I cannot easily patch DSA masters to just implement ->shutdown as ->remove so as to reproduce Lino's case with the Raspberry Pi, but I did perform basic regression-testing on: - the Bluebox 3 board with the 2x SJA1110 switches in a "real" DSA multi switch tree setup, with dpaa2-eth as the master and drivers/spi/spi-sc18is602.c as the SPI controller - the weird board with disjoint DSA trees comprised of 2x SJA1105 switches hanging off of the internal Felix/Ocelot switch of the LS1028A which in itself has the fsl-enetc driver as its master. Here I could test the fsl-enetc driver with and without the ->shutdown method. I also tested with and without dspi_shutdown so as to walk through both the sja1105's shutdown and remove methods. - the Turris MOX board where I did not notice any issues during regression testing. The only new message is that the link of the DSA interfaces goes down, this is because the net devices are actually unregistered on shutdown. It would be possible to have less boilerplate code, by implementing the DSA shutdown procedure as dsa_unregister_switch itself. For buses where the ->remove and ->shutdown have the same prototype (they both return void), like PCI, the code added is minimal (although we still need to add the "if this then not that" scheme, to avoid the function body getting executed twice). For the other buses, there would still need to be a separate shutdown method, which calls the remove method. Although in principle, this also has functional consequences which I am not sure whether I like or not. To walk the full-blown unbind code path or to do a shutdown with the minimal necessities?