From patchwork Wed Jan 6 13:10:01 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 12001561 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 5217BC433E6 for ; Wed, 6 Jan 2021 13:11:20 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1500D23102 for ; Wed, 6 Jan 2021 13:11:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726788AbhAFNLT (ORCPT ); Wed, 6 Jan 2021 08:11:19 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44722 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726749AbhAFNLR (ORCPT ); Wed, 6 Jan 2021 08:11:17 -0500 Received: from mail-ej1-x631.google.com (mail-ej1-x631.google.com [IPv6:2a00:1450:4864:20::631]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3EC8CC06135C for ; Wed, 6 Jan 2021 05:10:26 -0800 (PST) Received: by mail-ej1-x631.google.com with SMTP id ga15so4973466ejb.4 for ; Wed, 06 Jan 2021 05:10:26 -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=P4meT77TCaBjctaliqtHAU/6WAIjqV/US7V1kqVTudg=; b=fQVAG5NKJPPEf9pFsIQzyEonUgrA+Zi0tWj2d4l7QmmhsI0IOZbW0a+p5uBT4Glkn9 ZK4bpc9PrLeDQ+a49CSvZGS9gDQIV3BzptLLu3WE4D94d8R9aT+iFCJEQoCAR3aLZ0uV ecJKJcfk6Zd7vx8X4XrF00oVh8mpCRaNxQ/glNZNoD47qNeba0arj6XhLklyH9ZzCtWn e1RqhTswa+XVvspoZCITrN/wElUJnuUdXmDyYaOkHE3UuCd4YT83QZouWCN4NksmYMf8 8FccWTSLY8uO0sjmscTUdpLCwJ+VBMcize91igl4qvTthhTVO3U7MbjOpAcsPDk7J6oO +U7w== 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=P4meT77TCaBjctaliqtHAU/6WAIjqV/US7V1kqVTudg=; b=pDNO0OAvwBY4b5uNWD1nJ+XQdeAaHbfWCwopbymfDRgx4Q5eTF2xWmQMfEdtBsNPMS sFLJWOi0P2Wr2AZyFbNhsXqx2QYzM2rDt3xUhDl8mO3hh748lCYcnw78JIqTzlN33Nmt UnMfeEjQ/U65IYP3RZ1c1yc+9/zi6kHHCVlXwZKix7lozn+OC/hr6DuUc38aPkF1K8DY w/lvLGcgMU2O4Jv1DZOmDyorcNL1Xn/nhp9Z0MY0mrmmEGNqLq1Z+IauZqpqBWG5mZw7 QKS0+Ot4WQiaTv3r1oozz/Sn93Lat5c904qnKxmdqN8dyTRT2N4TWWPVLAtCzyPtQsJS zbBQ== X-Gm-Message-State: AOAM532FREPg1ydb51maT7gLTcaMn9gkUiMw5HX2n9NcsM8XFnDyzznx +w5ynPtX7ESOs3nP9aUNh4g= X-Google-Smtp-Source: ABdhPJy1hz1jU2Fj6/CKfslxU26xweLg0u9zZjd8bQJ6Pm2YVjq5LxOCeaCvKOWGLfk8+4RAlc0XZA== X-Received: by 2002:a17:906:7f0b:: with SMTP id d11mr2891501ejr.7.1609938624965; Wed, 06 Jan 2021 05:10:24 -0800 (PST) Received: from localhost.localdomain (5-12-227-87.residential.rdsnet.ro. [5.12.227.87]) by smtp.gmail.com with ESMTPSA id p22sm1241858ejx.59.2021.01.06.05.10.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Jan 2021 05:10:24 -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 v2 net-next 05/10] net: dsa: remove the transactional logic from ageing time notifiers Date: Wed, 6 Jan 2021 15:10:01 +0200 Message-Id: <20210106131006.577312-6-olteanv@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210106131006.577312-1-olteanv@gmail.com> References: <20210106131006.577312-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 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);