From patchwork Wed Jan 6 23:17:23 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 12002485 X-Patchwork-Delegate: kuba@kernel.org 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=-15.7 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,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT 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 7EEFAC433E0 for ; Wed, 6 Jan 2021 23:19:42 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 4EBCB22D6F for ; Wed, 6 Jan 2021 23:19:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727867AbhAFXTJ (ORCPT ); Wed, 6 Jan 2021 18:19:09 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55128 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727648AbhAFXTI (ORCPT ); Wed, 6 Jan 2021 18:19:08 -0500 Received: from mail-ej1-x635.google.com (mail-ej1-x635.google.com [IPv6:2a00:1450:4864:20::635]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9DC0FC061357 for ; Wed, 6 Jan 2021 15:17:57 -0800 (PST) Received: by mail-ej1-x635.google.com with SMTP id d17so7259851ejy.9 for ; Wed, 06 Jan 2021 15:17:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=a/22oCd/VpJqZUvA8p9jlsZJDNzZETvpQkgVALpueew=; b=JNGgapwB+i/oNlrMJoCGfSlAvOAIbcG2j3HURjaw/gOIMq7eMXp9/DcTcT/TEBRI7o OhnQBPGKsuBrTtu+AELeCht+ifstSgNHALLhRlWRCXY2Y1NGZhhwiuBMGEaS4Il1fSUU BghuqLY4KmLMO1MhN6tdqJG44AqbQj+jTTQPWiqiFN7ikH+RvsFRvByLpwHsWV9peunR iffAS1KR5PmDYdxjTqZbx7c7ErSzi2d2I1MbT+tAYjCVx6Ify9BgH2HJdYOYgs29fHyF euSZIY/msnNHixBjNXeH2WO3qC+XQaGqD2CCO4f8jvdqgCQs3nsYhlmrNWKCmG4ZUmpT 1nhQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=a/22oCd/VpJqZUvA8p9jlsZJDNzZETvpQkgVALpueew=; b=lgD0MFhiDSBsotkn3FjIW1AdCqzs5fUGE20DjSQFmA0UHua+vAjo1EAidd2KCorP1r 5jhfZ3pG13GChdCke/9Tr5M/34dvNBabzsAQobqnVIgSTrgXvNdfngFdV0Z8pKrxSHhG Xo3LBia75vEtUlwn++KA33E9wfYKFAfbjFXgKzGPGtTp78GhbTyGi6fIu93XhYJu0z9f HKu51GGecehUmm++p7r+WO7dX2gomwV3hxoz3KyPtdlynv151kjJrutS5JRLVpB4tWxY 50kjdMmWau8GvG1+8NH5gntlbpAyP3BzzJkh79qpGWSd5nxIWz4xk7TdVomDTGx8JFlJ 5oPQ== X-Gm-Message-State: AOAM53144YQgKAa8gK2CpB4QjJjANi9h0KKftpmaQxA/XG2+YpFqGiBr 8U6/qDOQa43BNqU5mt4wCUM= X-Google-Smtp-Source: ABdhPJzK4ahHT1VuVSxP6sauPtNjDSBBZ53hXxX698QWOnmdJXUvk66LkgLsp3FXV4HC7U2EQa21gw== X-Received: by 2002:a17:906:af5a:: with SMTP id ly26mr4452376ejb.416.1609975076367; Wed, 06 Jan 2021 15:17:56 -0800 (PST) Received: from localhost.localdomain (5-12-227-87.residential.rdsnet.ro. [5.12.227.87]) by smtp.gmail.com with ESMTPSA id a6sm1958263edv.74.2021.01.06.15.17.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Jan 2021 15:17:55 -0800 (PST) From: Vladimir Oltean To: "David S. Miller" , Jakub Kicinski , netdev@vger.kernel.org Cc: Florian Fainelli , 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 Subject: [PATCH v3 net-next 06/11] net: dsa: remove the transactional logic from ageing time notifiers Date: Thu, 7 Jan 2021 01:17:23 +0200 Message-Id: <20210106231728.1363126-7-olteanv@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210106231728.1363126-1-olteanv@gmail.com> References: <20210106231728.1363126-1-olteanv@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org From: Vladimir Oltean Remove the shim introduced in DSA for offloading the bridge ageing time from switchdev, by first checking whether the ageing time is within the range limits requested by the driver. Signed-off-by: Vladimir Oltean Reviewed-by: Florian Fainelli Acked-by: Linus Walleij Acked-by: Jiri Pirko --- Changes in v3: None. Changes in v2: None. net/dsa/dsa_priv.h | 1 - net/dsa/port.c | 6 +----- net/dsa/switch.c | 15 ++++++--------- 3 files changed, 7 insertions(+), 15 deletions(-) diff --git a/net/dsa/dsa_priv.h b/net/dsa/dsa_priv.h index c626fed62541..5bd2327d519f 100644 --- a/net/dsa/dsa_priv.h +++ b/net/dsa/dsa_priv.h @@ -29,7 +29,6 @@ enum { /* DSA_NOTIFIER_AGEING_TIME */ struct dsa_notifier_ageing_time_info { - struct switchdev_trans *trans; unsigned int ageing_time; }; diff --git a/net/dsa/port.c b/net/dsa/port.c index 14bf0053ae01..e59bf66c4c0d 100644 --- a/net/dsa/port.c +++ b/net/dsa/port.c @@ -310,21 +310,17 @@ int dsa_port_ageing_time(struct dsa_port *dp, clock_t ageing_clock) unsigned long ageing_jiffies = clock_t_to_jiffies(ageing_clock); unsigned int ageing_time = jiffies_to_msecs(ageing_jiffies); struct dsa_notifier_ageing_time_info info; - struct switchdev_trans trans; int err; info.ageing_time = ageing_time; - info.trans = &trans; - trans.ph_prepare = true; err = dsa_port_notify(dp, DSA_NOTIFIER_AGEING_TIME, &info); if (err) return err; dp->ageing_time = ageing_time; - trans.ph_prepare = false; - return dsa_port_notify(dp, DSA_NOTIFIER_AGEING_TIME, &info); + return 0; } int dsa_port_pre_bridge_flags(const struct dsa_port *dp, unsigned long flags) diff --git a/net/dsa/switch.c b/net/dsa/switch.c index 17979956d756..c6b3ac93bcc7 100644 --- a/net/dsa/switch.c +++ b/net/dsa/switch.c @@ -33,15 +33,12 @@ static int dsa_switch_ageing_time(struct dsa_switch *ds, struct dsa_notifier_ageing_time_info *info) { unsigned int ageing_time = info->ageing_time; - struct switchdev_trans *trans = info->trans; - - if (switchdev_trans_ph_prepare(trans)) { - if (ds->ageing_time_min && ageing_time < ds->ageing_time_min) - return -ERANGE; - if (ds->ageing_time_max && ageing_time > ds->ageing_time_max) - return -ERANGE; - return 0; - } + + if (ds->ageing_time_min && ageing_time < ds->ageing_time_min) + return -ERANGE; + + if (ds->ageing_time_max && ageing_time > ds->ageing_time_max) + return -ERANGE; /* Program the fastest ageing time in case of multiple bridges */ ageing_time = dsa_switch_fastest_ageing_time(ds, ageing_time);