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=-17.9 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,NICE_REPLY_A, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=unavailable 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 6F05FC433E0 for ; Fri, 12 Feb 2021 17:09:06 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 36A5D64E02 for ; Fri, 12 Feb 2021 17:09:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231264AbhBLRIl (ORCPT ); Fri, 12 Feb 2021 12:08:41 -0500 Received: from fllv0016.ext.ti.com ([198.47.19.142]:51682 "EHLO fllv0016.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229796AbhBLRId (ORCPT ); Fri, 12 Feb 2021 12:08:33 -0500 Received: from lelv0265.itg.ti.com ([10.180.67.224]) by fllv0016.ext.ti.com (8.15.2/8.15.2) with ESMTP id 11CH6bsR045358; Fri, 12 Feb 2021 11:06:37 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1613149597; bh=hf5kWh4b5xDP8/ITjPs8a9MASJP8ofalTmmZo5fWH2Q=; h=Subject:To:CC:References:From:Date:In-Reply-To; b=DFIbWSgCQWA/CFtOEJ9k6ghvxRwb+jnjL17WQaQzmdbVY076+UvXHAUFzLS48kByX zLkAcl0JgDJ5E9jOkPdBqFDC3SbZhZ2wbIMLYqtHLNrISr7PiwcctLXU5+kGpWdj9s xfqcIlJtilCmH6Ndtu6kbSryqd88COz3EjUOy7MQ= Received: from DLEE115.ent.ti.com (dlee115.ent.ti.com [157.170.170.26]) by lelv0265.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 11CH6bUm081026 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Fri, 12 Feb 2021 11:06:37 -0600 Received: from DLEE113.ent.ti.com (157.170.170.24) by DLEE115.ent.ti.com (157.170.170.26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1979.3; Fri, 12 Feb 2021 11:06:37 -0600 Received: from lelv0327.itg.ti.com (10.180.67.183) by DLEE113.ent.ti.com (157.170.170.24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1979.3 via Frontend Transport; Fri, 12 Feb 2021 11:06:36 -0600 Received: from [10.250.100.73] (ileax41-snat.itg.ti.com [10.172.224.153]) by lelv0327.itg.ti.com (8.15.2/8.15.2) with ESMTP id 11CH6Wj1016094; Fri, 12 Feb 2021 11:06:32 -0600 Subject: Re: [PATCH v5 net-next 05/10] net: switchdev: pass flags and mask to both {PRE_,}BRIDGE_FLAGS attributes To: Vladimir Oltean , Jakub Kicinski , "David S. Miller" CC: Andrew Lunn , Vivien Didelot , Florian Fainelli , , , , Roopa Prabhu , Nikolay Aleksandrov , Jiri Pirko , Ido Schimmel , Claudiu Manoil , Alexandre Belloni , , Vadym Kochan , Taras Chornyi , Vignesh Raghavendra , Ioana Ciornei , Ivan Vecera , References: <20210212151600.3357121-1-olteanv@gmail.com> <20210212151600.3357121-6-olteanv@gmail.com> From: Grygorii Strashko Message-ID: Date: Fri, 12 Feb 2021 19:06:26 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <20210212151600.3357121-6-olteanv@gmail.com> Content-Type: text/plain; charset="utf-8"; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 12/02/2021 17:15, Vladimir Oltean wrote: > From: Vladimir Oltean > > This switchdev attribute offers a counterproductive API for a driver > writer, because although br_switchdev_set_port_flag gets passed a > "flags" and a "mask", those are passed piecemeal to the driver, so while > the PRE_BRIDGE_FLAGS listener knows what changed because it has the > "mask", the BRIDGE_FLAGS listener doesn't, because it only has the final > value. But certain drivers can offload only certain combinations of > settings, like for example they cannot change unicast flooding > independently of multicast flooding - they must be both on or both off. > The way the information is passed to switchdev makes drivers not > expressive enough, and unable to reject this request ahead of time, in > the PRE_BRIDGE_FLAGS notifier, so they are forced to reject it during > the deferred BRIDGE_FLAGS attribute, where the rejection is currently > ignored. > > This patch also changes drivers to make use of the "mask" field for edge > detection when possible. > > Signed-off-by: Vladimir Oltean > --- > Changes in v5: > Rebased on top of AM65 CPSW driver. > > Changes in v4: > Patch is new. > > .../marvell/prestera/prestera_switchdev.c | 23 +++++---- > .../mellanox/mlxsw/spectrum_switchdev.c | 50 +++++++++++-------- > drivers/net/ethernet/rocker/rocker_main.c | 10 ++-- > drivers/net/ethernet/ti/am65-cpsw-switchdev.c | 24 +++++---- > drivers/net/ethernet/ti/cpsw_switchdev.c | 24 +++++---- > drivers/staging/fsl-dpaa2/ethsw/ethsw.c | 34 ++++++++----- > include/net/switchdev.h | 7 ++- > net/bridge/br_switchdev.c | 6 +-- > net/dsa/dsa_priv.h | 6 ++- > net/dsa/port.c | 34 +++++++------ > 10 files changed, 129 insertions(+), 89 deletions(-) > Reviewed-by: Grygorii Strashko -- Best regards, grygorii