From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1B964C433E0 for ; Wed, 6 Jan 2021 17:43:13 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D56B422CAF for ; Wed, 6 Jan 2021 17:43:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726983AbhAFRm5 (ORCPT ); Wed, 6 Jan 2021 12:42:57 -0500 Received: from new3-smtp.messagingengine.com ([66.111.4.229]:53937 "EHLO new3-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727612AbhAFRm4 (ORCPT ); Wed, 6 Jan 2021 12:42:56 -0500 Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailnew.nyi.internal (Postfix) with ESMTP id 739B558063E; Wed, 6 Jan 2021 12:42:10 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute3.internal (MEProxy); Wed, 06 Jan 2021 12:42:10 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; bh=88WHMK ljyBvjAmh/aCTDdrfA9FdTH2QxRT2ZD5tzrNQ=; b=O76pjQU6SHaDOoRiBCj6tx Euvb5S05S/Bpxcz5dwR7GtWnWOCp10q4N7sCP7n10tZaXU9JTMrhbHc784erCMDn R7uH/LqHg6WwhQKlZq6D0SVvA/chVrxOSYDCiw1p8fJby1Fqh3P3zIczFkLhDIdo ylvUymegaTTmmOpH+ylfsZEcYQcdR0HCkdDMTl41xWuM0Ms2sBWTvKmNhcL0UDCa xeLDgSIfdRIzA1yZVCDAXQyyE/oKs6SYE552ab7oh9vlHUTe6pgoyS5bwe6uVcXA IoJJxxw7qY4E5GC+kFXM1NqslIGubdhTlk+6CtXMGiHVEUNHSzgUaqc0ZdEwp66w == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedujedrvdegtddgtdelucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepfffhvffukfhfgggtuggjsehttdertddttddvnecuhfhrohhmpefkughoucfu tghhihhmmhgvlhcuoehiughoshgthhesihguohhstghhrdhorhhgqeenucggtffrrghtth gvrhhnpedtffekkeefudffveegueejffejhfetgfeuuefgvedtieehudeuueekhfduheel teenucfkphepkeegrddvvdelrdduheefrdeggeenucevlhhushhtvghrufhiiigvpedtne curfgrrhgrmhepmhgrihhlfhhrohhmpehiughoshgthhesihguohhstghhrdhorhhg X-ME-Proxy: Received: from localhost (igld-84-229-153-44.inter.net.il [84.229.153.44]) by mail.messagingengine.com (Postfix) with ESMTPA id 04F1524005A; Wed, 6 Jan 2021 12:42:05 -0500 (EST) Date: Wed, 6 Jan 2021 19:42:02 +0200 From: Ido Schimmel To: Vladimir Oltean Cc: "David S. Miller" , Jakub Kicinski , netdev@vger.kernel.org, Florian Fainelli , Andrew Lunn , Vivien Didelot , Kurt Kanzenbach , Hauke Mehrtens , Woojung Huh , Microchip Linux Driver Support , Sean Wang , Landen Chao , Claudiu Manoil , Alexandre Belloni , Linus Walleij , Vadym Kochan , Taras Chornyi , Jiri Pirko , Ido Schimmel , Grygorii Strashko , Ioana Ciornei , Ivan Vecera Subject: Re: [PATCH v2 net-next 02/10] net: switchdev: remove the transaction structure from port object notifiers Message-ID: <20210106174202.GA1082997@shredder.lan> References: <20210106131006.577312-1-olteanv@gmail.com> <20210106131006.577312-3-olteanv@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210106131006.577312-3-olteanv@gmail.com> Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On Wed, Jan 06, 2021 at 03:09:58PM +0200, Vladimir Oltean wrote: > From: Vladimir Oltean > > Since the introduction of the switchdev API, port objects were > transmitted to drivers for offloading using a two-step transactional > model, with a prepare phase that was supposed to catch all errors, and a > commit phase that was supposed to never fail. > > Some classes of failures can never be avoided, like hardware access, or > memory allocation. In the latter case, merely attempting to move the > memory allocation to the preparation phase makes it impossible to avoid > memory leaks, since commit 91cf8eceffc1 ("switchdev: Remove unused > transaction item queue") which has removed the unused mechanism of > passing on the allocated memory between one phase and another. > > It is time we admit that separating the preparation from the commit > phase is something that is best left for the driver to decide, and not > something that should be baked into the API, especially since there are > no switchdev callers that depend on this. > > This patch removes the struct switchdev_trans member from switchdev port > object notifier structures, and converts drivers to not look at this > member. > > Where driver conversion is trivial (like in the case of the Marvell > Prestera driver, NXP DPAA2 switch, TI CPSW, and Rocker drivers), it is > done in this patch. > > Where driver conversion needs more attention (DSA, Mellanox Spectrum), > the conversion is left for subsequent patches and here we only fake the > prepare/commit phases at a lower level, just not in the switchdev > notifier itself. > > Where the code has a natural structure that is best left alone as a > preparation and a commit phase (as in the case of the Ocelot switch), > that structure is left in place, just made to not depend upon the > switchdev transactional model. > > Signed-off-by: Vladimir Oltean > Reviewed-by: Florian Fainelli > Acked-by: Linus Walleij > Acked-by: Jiri Pirko This looks good to me. I think that faking the prepare/commit phase made it easier to review. Reviewed-by: Ido Schimmel