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=-9.2 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,MAILING_LIST_MULTI, NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 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 E85C3C4361B for ; Thu, 17 Dec 2020 02:14:51 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 98C9423718 for ; Thu, 17 Dec 2020 02:14:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727376AbgLQCOv (ORCPT ); Wed, 16 Dec 2020 21:14:51 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36312 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727073AbgLQCOu (ORCPT ); Wed, 16 Dec 2020 21:14:50 -0500 Received: from mail-pj1-x102c.google.com (mail-pj1-x102c.google.com [IPv6:2607:f8b0:4864:20::102c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DEDF5C061794 for ; Wed, 16 Dec 2020 18:14:09 -0800 (PST) Received: by mail-pj1-x102c.google.com with SMTP id b5so3163158pjk.2 for ; Wed, 16 Dec 2020 18:14:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=eWkkJ2JLd8x2IZKlOPuQU5buDtXm7ilXoF54qeZ5Llc=; b=XbPyxnYVzdunEv3uojruLqt39LNb4y7wj/Vw30fKdDI0d+H8gtnsOaBRGtq2M0Qrfa 3uR7PpuZQU+ATGP7G2ZljkHO0eHTD+sokBeVq5yfqT2Cu4QJTc3tynMRTbagzAhPDbCU i/lEvhKBA0qFS2WjACJLG8ZChE7666uJEF6I+cvlTCwZva+0nWZ9SUcyp4cEi9MrZPnc gz3scDmArUpjJXpbdmZeFAJTpO44/44dauBUopXBHlQypgS5w6XESRLvdhp+FaunZy1m ox4PYIGLZp5QQT/GJtgntUxRC1Fg/+5BbQwlxImhis7fRLV3VyU0oWoFbMKONajQSS2U Kvyw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=eWkkJ2JLd8x2IZKlOPuQU5buDtXm7ilXoF54qeZ5Llc=; b=BBegzFZe4c/3vZQR/jDXGVMQGYWbFXB3porKYj3Xi6n0vsfSI+qWuMI+8x3v38n3uY ak3XQFH3R7zcr9+xN9E+Rn4IsZauoN45hUoSF2xFYiIWqpKq7wMKb6qIKLmJ6Lv/lY9i WVbXPsJ/BA93IbdCeNnCTIeKiIe3KLLIWcxGo3JC0JJAaeuIkrw1i+0xoHSm9FmrFDkU P1mY3/b4Jk6tUQ9ubsncmLeBqfHWG71e2/n+chmjZ9hSAgoCyJDg3c92JHOtAvmGTree ixN2bKoAUjon2NQoAySBJNfN4U9h7mZOaHjgHotuKvq341fnTBcJj3cYZIIQvjTObW23 i1kQ== X-Gm-Message-State: AOAM5334q0NR1ITUxilST9CUJ6CeTaDoDIj4scknl0dNl8Atzwg9LO03 CgknKcyQft05xyzAJZoWYQQ= X-Google-Smtp-Source: ABdhPJxf+f4+e2ydcyC8IRceTPVPKMwQYxqbi2SFM0L5KbPhiDB/Yu5d6m/F81e3PlobRr7aHutpMA== X-Received: by 2002:a17:902:167:b029:d8:cfe5:bdee with SMTP id 94-20020a1709020167b02900d8cfe5bdeemr34169511plb.11.1608171249457; Wed, 16 Dec 2020 18:14:09 -0800 (PST) Received: from [10.230.29.166] ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id v17sm4140975pga.58.2020.12.16.18.14.05 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 16 Dec 2020 18:14:08 -0800 (PST) Subject: Re: [RFC PATCH net-next 1/9] net: switchdev: remove the transaction structure from port object notifiers To: Vladimir Oltean , "David S. Miller" , Jakub Kicinski , netdev@vger.kernel.org Cc: Andrew Lunn , Vivien Didelot , Vladimir Oltean , 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 References: <20201217015822.826304-1-vladimir.oltean@nxp.com> <20201217015822.826304-2-vladimir.oltean@nxp.com> From: Florian Fainelli Message-ID: <1644d807-eaea-3fde-0cea-cf0e9210272c@gmail.com> Date: Wed, 16 Dec 2020 18:14:05 -0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Firefox/78.0 Thunderbird/78.6.0 MIME-Version: 1.0 In-Reply-To: <20201217015822.826304-2-vladimir.oltean@nxp.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On 12/16/2020 5:58 PM, Vladimir Oltean wrote: > 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 -- Florian