From patchwork Wed Jan 6 23:17:21 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 357978 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 94876C433E9 for ; Wed, 6 Jan 2021 23:19:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 6CB9F22D6F for ; Wed, 6 Jan 2021 23:19:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727819AbhAFXS4 (ORCPT ); Wed, 6 Jan 2021 18:18:56 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55094 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726908AbhAFXSz (ORCPT ); Wed, 6 Jan 2021 18:18:55 -0500 Received: from mail-ej1-x62f.google.com (mail-ej1-x62f.google.com [IPv6:2a00:1450:4864:20::62f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BF38FC06134C for ; Wed, 6 Jan 2021 15:17:53 -0800 (PST) Received: by mail-ej1-x62f.google.com with SMTP id ce23so7273523ejb.8 for ; Wed, 06 Jan 2021 15:17:53 -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=EI1wC9Xkqmpzjm/YrEjem0fZLb6nFmO7JkSvvcJ589s=; b=WIU1X/MNDdWK9IreQuDVOm9p6tii8JTaRYi+MZ9gibK73q4Ho2F7gdKVd6Lxv4+/TE YvQsrIVZYGhSA6Ft+eeQPU0GwR+mh38hOMLaArMbZ1ZRaMYNKAC1Jldgn8jj1IyLICr6 uYVczxBSkqFSRpNZj92MCFMEqsgEwfdzj6+E5tZdJ5c3aG6lOF8/e3Ap2VTlfWxF3WU2 QzvF8D5SQU4lOZuxSZS9SB41iADOinWWdHgofRXRFSkqyHq3m/utGu02f8R97h2bkJPY JRLTFADr3mKDKrzw84GimKF9gzxnQ6i8m9ZU0UuS3uHJx10pnUDCDEw2RrSfXSRAdrk/ 1z1A== 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=EI1wC9Xkqmpzjm/YrEjem0fZLb6nFmO7JkSvvcJ589s=; b=RxtJa5r1zRb1ThfeZSlrHQEFUZSnKtLW2V1AXYoZAtcSMQPO+cyoQCMvfJyr4DbGqv GxfYE2UhWgixu+muEOW9OEWh2HrZRkL/xks9kczOZ6spdSytQ9Ri//+HUXJwFUJ8NpBi 4AcNYLqly0JsWifnFJxQMTPFqugAGoYN9ZRafonmXKd1BvKEzdcsyNmJlNfQAwY3z+qB WLfkSPtMympxebC+plpoZyaCrGOELXx9d9Kd3Cddvn4d8gV3I1PF+A3lljX8DZSrOQNK Pys295+uLBCflvPF/LMjC+x00jAANAmuGSX6ZUw/8pKOVPgSzvEN5KhONNPpFwbZfvxY IOPQ== X-Gm-Message-State: AOAM533KXe5baWxvBoU8v37dGhugfWsEqzPeE6OX/P01iXIj/Pu+1cWf AarOmc6oiFRT+ZYFRuGeDtI= X-Google-Smtp-Source: ABdhPJxqChjizXmHX17T2+IE7H4WTLyBiv8cBGJ68hJbx+x1aX1ug/5eZDpwt2Jx9Iyj7FBVi/ovYQ== X-Received: by 2002:a17:906:7146:: with SMTP id z6mr4337237ejj.379.1609975072510; Wed, 06 Jan 2021 15:17:52 -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.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Jan 2021 15:17:52 -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 04/11] net: switchdev: delete switchdev_port_obj_add_now Date: Thu, 7 Jan 2021 01:17:21 +0200 Message-Id: <20210106231728.1363126-5-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 From: Vladimir Oltean After the removal of the transactional model inside switchdev_port_obj_add_now, it has no added value and we can just call switchdev_port_obj_notify directly, bypassing this function. Let's delete it. Signed-off-by: Vladimir Oltean Reviewed-by: Florian Fainelli Reviewed-by: Ido Schimmel Acked-by: Linus Walleij Acked-by: Jiri Pirko --- Changes in v3: None. Changes in v2: None. net/switchdev/switchdev.c | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/net/switchdev/switchdev.c b/net/switchdev/switchdev.c index a575bb33ee6c..3509d362056d 100644 --- a/net/switchdev/switchdev.c +++ b/net/switchdev/switchdev.c @@ -242,23 +242,15 @@ static int switchdev_port_obj_notify(enum switchdev_notifier_type nt, return 0; } -static int switchdev_port_obj_add_now(struct net_device *dev, - const struct switchdev_obj *obj, - struct netlink_ext_ack *extack) -{ - ASSERT_RTNL(); - - return switchdev_port_obj_notify(SWITCHDEV_PORT_OBJ_ADD, - dev, obj, extack); -} - static void switchdev_port_obj_add_deferred(struct net_device *dev, const void *data) { const struct switchdev_obj *obj = data; int err; - err = switchdev_port_obj_add_now(dev, obj, NULL); + ASSERT_RTNL(); + err = switchdev_port_obj_notify(SWITCHDEV_PORT_OBJ_ADD, + dev, obj, NULL); if (err && err != -EOPNOTSUPP) netdev_err(dev, "failed (err=%d) to add object (id=%d)\n", err, obj->id); @@ -290,7 +282,8 @@ int switchdev_port_obj_add(struct net_device *dev, if (obj->flags & SWITCHDEV_F_DEFER) return switchdev_port_obj_add_defer(dev, obj); ASSERT_RTNL(); - return switchdev_port_obj_add_now(dev, obj, extack); + return switchdev_port_obj_notify(SWITCHDEV_PORT_OBJ_ADD, + dev, obj, extack); } EXPORT_SYMBOL_GPL(switchdev_port_obj_add); From patchwork Wed Jan 6 23:17:24 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 357977 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 0888EC4332E for ; Wed, 6 Jan 2021 23:19:12 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D359423340 for ; Wed, 6 Jan 2021 23:19:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727875AbhAFXTK (ORCPT ); Wed, 6 Jan 2021 18:19:10 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55130 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727855AbhAFXTI (ORCPT ); Wed, 6 Jan 2021 18:19:08 -0500 Received: from mail-ed1-x52d.google.com (mail-ed1-x52d.google.com [IPv6:2a00:1450:4864:20::52d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 80D42C061358 for ; Wed, 6 Jan 2021 15:17:59 -0800 (PST) Received: by mail-ed1-x52d.google.com with SMTP id cw27so5965321edb.5 for ; Wed, 06 Jan 2021 15:17:59 -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=tRal1g/VgJAzNaJgMB+W4qTGAGhdIzdkTkjKxacO5Do=; b=hO8zoGnsPL1OEDDNXKKHuaJUn2E6YmR72Gzch33kY5eq1/ekDAOlJDd46ZLuDH7S8C hg8g8Oj+ZyuvD8Ywc84yEeeRKLKx+lvWI9qFQEhbeQpF5jiEZo9mmvTHP5uySXYYmZAO DQdqpFQt87hI41a618nEGZAfbUon1QYL4xTPk29SHnkXunfjTrhL6/4aXm9SKVY+bxgN vxAfwHF1HDkVlU5JYz1MbiFpt/Hgx/MsSb+XYeN2qUPhZF6piPIWVrOUij0e4pkjjUHy o2Urj9pm9OZvW59/SR8G3lnvub29Uj56lg6pb7K9GnqhZBbnlpECIOIhUmnkv5obWmJV jyPg== 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=tRal1g/VgJAzNaJgMB+W4qTGAGhdIzdkTkjKxacO5Do=; b=hZCd/syXovmqL5w8zR2u6wosS9b3cmhKd+ArPdHjrCTFxbjz5pigpoc9viCqdkVaJh tQKS4TrebkME9T+1geFi8BHx4wQNMs2H6BuoBVs+2zDKqToGf30OgzjS/I7E3J9sAlKd 5FTP5QDd577xMObDLvWyq5ek+zPM2vdqUWAi1ZeJx6I/VvSYXTzWaVkCaCduQGpZdpLP 0zVyWgIdVg19aCGFOCTXSxKE/tMNuU3Rw3dNw5xT/7AYVeo3hparVgBdIQ1Y8TwqXThu zGY57pO9xaEvw5qLoTwaM7xW6YjSqKOXZqVr/MB0IgGd3O/FUiS5+Nb1g3fg8jiuzt+R 7XNA== X-Gm-Message-State: AOAM531be0bAGskchf/6mrspwLRO8Zr6ZAKdg0/2KfaX0RPRd4vkkUHd Rp2i9zMt8n3ozHRXGkt1vEk= X-Google-Smtp-Source: ABdhPJzRh0xQliP8LRrmSgjZ+uZsLIfI8EdrRNCsk6DcwlezNlO+2VaWSwqPWhO0Bk31oayc3Dhiwg== X-Received: by 2002:a50:d646:: with SMTP id c6mr5445476edj.177.1609975078137; Wed, 06 Jan 2021 15:17:58 -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.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Jan 2021 15:17:57 -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 07/11] net: dsa: remove the transactional logic from MDB entries Date: Thu, 7 Jan 2021 01:17:24 +0200 Message-Id: <20210106231728.1363126-8-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 From: Vladimir Oltean For many drivers, the .port_mdb_prepare callback was not a good opportunity to avoid any error condition, and they would suppress errors found during the actual commit phase. Where a logical separation between the prepare and the commit phase existed, the function that used to implement the .port_mdb_prepare callback still exists, but now it is called directly from .port_mdb_add, which was modified to return an int code. Signed-off-by: Vladimir Oltean Reviewed-by: Florian Fainelli Acked-by: Linus Walleij Acked-by: Jiri Pirko Reviewed-by: Kurt Kanzenbach # hellcreek Reviewed-by: Linus Wallei # RTL8366 --- Changes in v3: None. Changes in v2: Propagating errors better now. drivers/net/dsa/b53/b53_common.c | 19 +++---------------- drivers/net/dsa/b53/b53_priv.h | 6 ++---- drivers/net/dsa/bcm_sf2.c | 1 - drivers/net/dsa/lan9303-core.c | 12 ++++++++---- drivers/net/dsa/microchip/ksz8795.c | 1 - drivers/net/dsa/microchip/ksz9477.c | 14 +++++++++----- drivers/net/dsa/microchip/ksz_common.c | 16 +++++----------- drivers/net/dsa/microchip/ksz_common.h | 6 ++---- drivers/net/dsa/mv88e6xxx/chip.c | 24 +++++++----------------- drivers/net/dsa/ocelot/felix.c | 14 +++----------- drivers/net/dsa/sja1105/sja1105_main.c | 14 +++----------- include/net/dsa.h | 4 +--- net/dsa/switch.c | 15 ++++++--------- 13 files changed, 49 insertions(+), 97 deletions(-) diff --git a/drivers/net/dsa/b53/b53_common.c b/drivers/net/dsa/b53/b53_common.c index 99c9b528884e..122636eb362e 100644 --- a/drivers/net/dsa/b53/b53_common.c +++ b/drivers/net/dsa/b53/b53_common.c @@ -1741,8 +1741,8 @@ int b53_fdb_dump(struct dsa_switch *ds, int port, } EXPORT_SYMBOL(b53_fdb_dump); -int b53_mdb_prepare(struct dsa_switch *ds, int port, - const struct switchdev_obj_port_mdb *mdb) +int b53_mdb_add(struct dsa_switch *ds, int port, + const struct switchdev_obj_port_mdb *mdb) { struct b53_device *priv = ds->priv; @@ -1752,19 +1752,7 @@ int b53_mdb_prepare(struct dsa_switch *ds, int port, if (is5325(priv) || is5365(priv)) return -EOPNOTSUPP; - return 0; -} -EXPORT_SYMBOL(b53_mdb_prepare); - -void b53_mdb_add(struct dsa_switch *ds, int port, - const struct switchdev_obj_port_mdb *mdb) -{ - struct b53_device *priv = ds->priv; - int ret; - - ret = b53_arl_op(priv, 0, port, mdb->addr, mdb->vid, true); - if (ret) - dev_err(ds->dev, "failed to add MDB entry\n"); + return b53_arl_op(priv, 0, port, mdb->addr, mdb->vid, true); } EXPORT_SYMBOL(b53_mdb_add); @@ -2205,7 +2193,6 @@ static const struct dsa_switch_ops b53_switch_ops = { .port_fdb_del = b53_fdb_del, .port_mirror_add = b53_mirror_add, .port_mirror_del = b53_mirror_del, - .port_mdb_prepare = b53_mdb_prepare, .port_mdb_add = b53_mdb_add, .port_mdb_del = b53_mdb_del, .port_max_mtu = b53_get_max_mtu, diff --git a/drivers/net/dsa/b53/b53_priv.h b/drivers/net/dsa/b53/b53_priv.h index 24893b592216..224423ab0682 100644 --- a/drivers/net/dsa/b53/b53_priv.h +++ b/drivers/net/dsa/b53/b53_priv.h @@ -360,10 +360,8 @@ int b53_fdb_del(struct dsa_switch *ds, int port, const unsigned char *addr, u16 vid); int b53_fdb_dump(struct dsa_switch *ds, int port, dsa_fdb_dump_cb_t *cb, void *data); -int b53_mdb_prepare(struct dsa_switch *ds, int port, - const struct switchdev_obj_port_mdb *mdb); -void b53_mdb_add(struct dsa_switch *ds, int port, - const struct switchdev_obj_port_mdb *mdb); +int b53_mdb_add(struct dsa_switch *ds, int port, + const struct switchdev_obj_port_mdb *mdb); int b53_mdb_del(struct dsa_switch *ds, int port, const struct switchdev_obj_port_mdb *mdb); int b53_mirror_add(struct dsa_switch *ds, int port, diff --git a/drivers/net/dsa/bcm_sf2.c b/drivers/net/dsa/bcm_sf2.c index 1e9a0adda2d6..4c493bb47d30 100644 --- a/drivers/net/dsa/bcm_sf2.c +++ b/drivers/net/dsa/bcm_sf2.c @@ -1123,7 +1123,6 @@ static const struct dsa_switch_ops bcm_sf2_ops = { .set_rxnfc = bcm_sf2_set_rxnfc, .port_mirror_add = b53_mirror_add, .port_mirror_del = b53_mirror_del, - .port_mdb_prepare = b53_mdb_prepare, .port_mdb_add = b53_mdb_add, .port_mdb_del = b53_mdb_del, }; diff --git a/drivers/net/dsa/lan9303-core.c b/drivers/net/dsa/lan9303-core.c index aa1142d6a9f5..344374025426 100644 --- a/drivers/net/dsa/lan9303-core.c +++ b/drivers/net/dsa/lan9303-core.c @@ -1232,14 +1232,19 @@ static int lan9303_port_mdb_prepare(struct dsa_switch *ds, int port, return 0; } -static void lan9303_port_mdb_add(struct dsa_switch *ds, int port, - const struct switchdev_obj_port_mdb *mdb) +static int lan9303_port_mdb_add(struct dsa_switch *ds, int port, + const struct switchdev_obj_port_mdb *mdb) { struct lan9303 *chip = ds->priv; + int err; + + err = lan9303_port_mdb_prepare(ds, port, mdb); + if (err) + return err; dev_dbg(chip->dev, "%s(%d, %pM, %d)\n", __func__, port, mdb->addr, mdb->vid); - lan9303_alr_add_port(chip, mdb->addr, port, false); + return lan9303_alr_add_port(chip, mdb->addr, port, false); } static int lan9303_port_mdb_del(struct dsa_switch *ds, int port, @@ -1274,7 +1279,6 @@ static const struct dsa_switch_ops lan9303_switch_ops = { .port_fdb_add = lan9303_port_fdb_add, .port_fdb_del = lan9303_port_fdb_del, .port_fdb_dump = lan9303_port_fdb_dump, - .port_mdb_prepare = lan9303_port_mdb_prepare, .port_mdb_add = lan9303_port_mdb_add, .port_mdb_del = lan9303_port_mdb_del, }; diff --git a/drivers/net/dsa/microchip/ksz8795.c b/drivers/net/dsa/microchip/ksz8795.c index 6a9ec8a0f92f..89e1c01cf5b8 100644 --- a/drivers/net/dsa/microchip/ksz8795.c +++ b/drivers/net/dsa/microchip/ksz8795.c @@ -1114,7 +1114,6 @@ static const struct dsa_switch_ops ksz8795_switch_ops = { .port_vlan_add = ksz8795_port_vlan_add, .port_vlan_del = ksz8795_port_vlan_del, .port_fdb_dump = ksz_port_fdb_dump, - .port_mdb_prepare = ksz_port_mdb_prepare, .port_mdb_add = ksz_port_mdb_add, .port_mdb_del = ksz_port_mdb_del, .port_mirror_add = ksz8795_port_mirror_add, diff --git a/drivers/net/dsa/microchip/ksz9477.c b/drivers/net/dsa/microchip/ksz9477.c index 446c088ce5c5..08bf54eb9f5f 100644 --- a/drivers/net/dsa/microchip/ksz9477.c +++ b/drivers/net/dsa/microchip/ksz9477.c @@ -774,14 +774,15 @@ static int ksz9477_port_fdb_dump(struct dsa_switch *ds, int port, return ret; } -static void ksz9477_port_mdb_add(struct dsa_switch *ds, int port, - const struct switchdev_obj_port_mdb *mdb) +static int ksz9477_port_mdb_add(struct dsa_switch *ds, int port, + const struct switchdev_obj_port_mdb *mdb) { struct ksz_device *dev = ds->priv; u32 static_table[4]; u32 data; int index; u32 mac_hi, mac_lo; + int err = 0; mac_hi = ((mdb->addr[0] << 8) | mdb->addr[1]); mac_lo = ((mdb->addr[2] << 24) | (mdb->addr[3] << 16)); @@ -796,7 +797,8 @@ static void ksz9477_port_mdb_add(struct dsa_switch *ds, int port, ksz_write32(dev, REG_SW_ALU_STAT_CTRL__4, data); /* wait to be finished */ - if (ksz9477_wait_alu_sta_ready(dev)) { + err = ksz9477_wait_alu_sta_ready(dev); + if (err) { dev_dbg(dev->dev, "Failed to read ALU STATIC\n"); goto exit; } @@ -819,8 +821,10 @@ static void ksz9477_port_mdb_add(struct dsa_switch *ds, int port, } /* no available entry */ - if (index == dev->num_statics) + if (index == dev->num_statics) { + err = -ENOSPC; goto exit; + } /* add entry */ static_table[0] = ALU_V_STATIC_VALID; @@ -842,6 +846,7 @@ static void ksz9477_port_mdb_add(struct dsa_switch *ds, int port, exit: mutex_unlock(&dev->alu_mutex); + return err; } static int ksz9477_port_mdb_del(struct dsa_switch *ds, int port, @@ -1395,7 +1400,6 @@ static const struct dsa_switch_ops ksz9477_switch_ops = { .port_fdb_dump = ksz9477_port_fdb_dump, .port_fdb_add = ksz9477_port_fdb_add, .port_fdb_del = ksz9477_port_fdb_del, - .port_mdb_prepare = ksz_port_mdb_prepare, .port_mdb_add = ksz9477_port_mdb_add, .port_mdb_del = ksz9477_port_mdb_del, .port_mirror_add = ksz9477_port_mirror_add, diff --git a/drivers/net/dsa/microchip/ksz_common.c b/drivers/net/dsa/microchip/ksz_common.c index cf743133b0b9..f2c9ff3ea4be 100644 --- a/drivers/net/dsa/microchip/ksz_common.c +++ b/drivers/net/dsa/microchip/ksz_common.c @@ -253,16 +253,8 @@ int ksz_port_fdb_dump(struct dsa_switch *ds, int port, dsa_fdb_dump_cb_t *cb, } EXPORT_SYMBOL_GPL(ksz_port_fdb_dump); -int ksz_port_mdb_prepare(struct dsa_switch *ds, int port, - const struct switchdev_obj_port_mdb *mdb) -{ - /* nothing to do */ - return 0; -} -EXPORT_SYMBOL_GPL(ksz_port_mdb_prepare); - -void ksz_port_mdb_add(struct dsa_switch *ds, int port, - const struct switchdev_obj_port_mdb *mdb) +int ksz_port_mdb_add(struct dsa_switch *ds, int port, + const struct switchdev_obj_port_mdb *mdb) { struct ksz_device *dev = ds->priv; struct alu_struct alu; @@ -284,7 +276,7 @@ void ksz_port_mdb_add(struct dsa_switch *ds, int port, /* no available entry */ if (index == dev->num_statics && !empty) - return; + return -ENOSPC; /* add entry */ if (index == dev->num_statics) { @@ -301,6 +293,8 @@ void ksz_port_mdb_add(struct dsa_switch *ds, int port, alu.fid = mdb->vid; } dev->dev_ops->w_sta_mac_table(dev, index, &alu); + + return 0; } EXPORT_SYMBOL_GPL(ksz_port_mdb_add); diff --git a/drivers/net/dsa/microchip/ksz_common.h b/drivers/net/dsa/microchip/ksz_common.h index 720f22275c84..a1f0929d45a0 100644 --- a/drivers/net/dsa/microchip/ksz_common.h +++ b/drivers/net/dsa/microchip/ksz_common.h @@ -165,10 +165,8 @@ int ksz_port_vlan_prepare(struct dsa_switch *ds, int port, const struct switchdev_obj_port_vlan *vlan); int ksz_port_fdb_dump(struct dsa_switch *ds, int port, dsa_fdb_dump_cb_t *cb, void *data); -int ksz_port_mdb_prepare(struct dsa_switch *ds, int port, - const struct switchdev_obj_port_mdb *mdb); -void ksz_port_mdb_add(struct dsa_switch *ds, int port, - const struct switchdev_obj_port_mdb *mdb); +int ksz_port_mdb_add(struct dsa_switch *ds, int port, + const struct switchdev_obj_port_mdb *mdb); int ksz_port_mdb_del(struct dsa_switch *ds, int port, const struct switchdev_obj_port_mdb *mdb); int ksz_enable_port(struct dsa_switch *ds, int port, struct phy_device *phy); diff --git a/drivers/net/dsa/mv88e6xxx/chip.c b/drivers/net/dsa/mv88e6xxx/chip.c index bbf1a71ce55c..e9c517c0f89c 100644 --- a/drivers/net/dsa/mv88e6xxx/chip.c +++ b/drivers/net/dsa/mv88e6xxx/chip.c @@ -5238,27 +5238,18 @@ static enum dsa_tag_protocol mv88e6xxx_get_tag_protocol(struct dsa_switch *ds, return chip->info->tag_protocol; } -static int mv88e6xxx_port_mdb_prepare(struct dsa_switch *ds, int port, - const struct switchdev_obj_port_mdb *mdb) -{ - /* We don't need any dynamic resource from the kernel (yet), - * so skip the prepare phase. - */ - - return 0; -} - -static void mv88e6xxx_port_mdb_add(struct dsa_switch *ds, int port, - const struct switchdev_obj_port_mdb *mdb) +static int mv88e6xxx_port_mdb_add(struct dsa_switch *ds, int port, + const struct switchdev_obj_port_mdb *mdb) { struct mv88e6xxx_chip *chip = ds->priv; + int err; mv88e6xxx_reg_lock(chip); - if (mv88e6xxx_port_db_load_purge(chip, port, mdb->addr, mdb->vid, - MV88E6XXX_G1_ATU_DATA_STATE_MC_STATIC)) - dev_err(ds->dev, "p%d: failed to load multicast MAC address\n", - port); + err = mv88e6xxx_port_db_load_purge(chip, port, mdb->addr, mdb->vid, + MV88E6XXX_G1_ATU_DATA_STATE_MC_STATIC); mv88e6xxx_reg_unlock(chip); + + return err; } static int mv88e6xxx_port_mdb_del(struct dsa_switch *ds, int port, @@ -5403,7 +5394,6 @@ static const struct dsa_switch_ops mv88e6xxx_switch_ops = { .port_fdb_add = mv88e6xxx_port_fdb_add, .port_fdb_del = mv88e6xxx_port_fdb_del, .port_fdb_dump = mv88e6xxx_port_fdb_dump, - .port_mdb_prepare = mv88e6xxx_port_mdb_prepare, .port_mdb_add = mv88e6xxx_port_mdb_add, .port_mdb_del = mv88e6xxx_port_mdb_del, .port_mirror_add = mv88e6xxx_port_mirror_add, diff --git a/drivers/net/dsa/ocelot/felix.c b/drivers/net/dsa/ocelot/felix.c index 7c36cdd01e27..d3a954ba7e1b 100644 --- a/drivers/net/dsa/ocelot/felix.c +++ b/drivers/net/dsa/ocelot/felix.c @@ -65,19 +65,12 @@ static int felix_fdb_del(struct dsa_switch *ds, int port, return ocelot_fdb_del(ocelot, port, addr, vid); } -/* This callback needs to be present */ -static int felix_mdb_prepare(struct dsa_switch *ds, int port, - const struct switchdev_obj_port_mdb *mdb) -{ - return 0; -} - -static void felix_mdb_add(struct dsa_switch *ds, int port, - const struct switchdev_obj_port_mdb *mdb) +static int felix_mdb_add(struct dsa_switch *ds, int port, + const struct switchdev_obj_port_mdb *mdb) { struct ocelot *ocelot = ds->priv; - ocelot_port_mdb_add(ocelot, port, mdb); + return ocelot_port_mdb_add(ocelot, port, mdb); } static int felix_mdb_del(struct dsa_switch *ds, int port, @@ -771,7 +764,6 @@ const struct dsa_switch_ops felix_switch_ops = { .port_fdb_dump = felix_fdb_dump, .port_fdb_add = felix_fdb_add, .port_fdb_del = felix_fdb_del, - .port_mdb_prepare = felix_mdb_prepare, .port_mdb_add = felix_mdb_add, .port_mdb_del = felix_mdb_del, .port_bridge_join = felix_bridge_join, diff --git a/drivers/net/dsa/sja1105/sja1105_main.c b/drivers/net/dsa/sja1105/sja1105_main.c index 1a3456e52b90..5afb3d44f9d5 100644 --- a/drivers/net/dsa/sja1105/sja1105_main.c +++ b/drivers/net/dsa/sja1105/sja1105_main.c @@ -1524,17 +1524,10 @@ static int sja1105_fdb_dump(struct dsa_switch *ds, int port, return 0; } -/* This callback needs to be present */ -static int sja1105_mdb_prepare(struct dsa_switch *ds, int port, - const struct switchdev_obj_port_mdb *mdb) -{ - return 0; -} - -static void sja1105_mdb_add(struct dsa_switch *ds, int port, - const struct switchdev_obj_port_mdb *mdb) +static int sja1105_mdb_add(struct dsa_switch *ds, int port, + const struct switchdev_obj_port_mdb *mdb) { - sja1105_fdb_add(ds, port, mdb->addr, mdb->vid); + return sja1105_fdb_add(ds, port, mdb->addr, mdb->vid); } static int sja1105_mdb_del(struct dsa_switch *ds, int port, @@ -3288,7 +3281,6 @@ static const struct dsa_switch_ops sja1105_switch_ops = { .port_vlan_filtering = sja1105_vlan_filtering, .port_vlan_add = sja1105_vlan_add, .port_vlan_del = sja1105_vlan_del, - .port_mdb_prepare = sja1105_mdb_prepare, .port_mdb_add = sja1105_mdb_add, .port_mdb_del = sja1105_mdb_del, .port_hwtstamp_get = sja1105_hwtstamp_get, diff --git a/include/net/dsa.h b/include/net/dsa.h index 7727b56a4eee..2d715b0502e3 100644 --- a/include/net/dsa.h +++ b/include/net/dsa.h @@ -580,10 +580,8 @@ struct dsa_switch_ops { /* * Multicast database */ - int (*port_mdb_prepare)(struct dsa_switch *ds, int port, + int (*port_mdb_add)(struct dsa_switch *ds, int port, const struct switchdev_obj_port_mdb *mdb); - void (*port_mdb_add)(struct dsa_switch *ds, int port, - const struct switchdev_obj_port_mdb *mdb); int (*port_mdb_del)(struct dsa_switch *ds, int port, const struct switchdev_obj_port_mdb *mdb); /* diff --git a/net/dsa/switch.c b/net/dsa/switch.c index c6b3ac93bcc7..5f5e19c5e43a 100644 --- a/net/dsa/switch.c +++ b/net/dsa/switch.c @@ -181,24 +181,21 @@ static bool dsa_switch_mdb_match(struct dsa_switch *ds, int port, static int dsa_switch_mdb_add(struct dsa_switch *ds, struct dsa_notifier_mdb_info *info) { - int port, err; + int err = 0; + int port; - if (!ds->ops->port_mdb_prepare || !ds->ops->port_mdb_add) + if (!ds->ops->port_mdb_add) return -EOPNOTSUPP; for (port = 0; port < ds->num_ports; port++) { if (dsa_switch_mdb_match(ds, port, info)) { - err = ds->ops->port_mdb_prepare(ds, port, info->mdb); + err = ds->ops->port_mdb_add(ds, port, info->mdb); if (err) - return err; + break; } } - for (port = 0; port < ds->num_ports; port++) - if (dsa_switch_mdb_match(ds, port, info)) - ds->ops->port_mdb_add(ds, port, info->mdb); - - return 0; + return err; } static int dsa_switch_mdb_del(struct dsa_switch *ds, From patchwork Wed Jan 6 23:17:27 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 357975 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 D26B5C43381 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 B627222D74 for ; Wed, 6 Jan 2021 23:19:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727906AbhAFXTR (ORCPT ); Wed, 6 Jan 2021 18:19:17 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55146 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727878AbhAFXTL (ORCPT ); Wed, 6 Jan 2021 18:19:11 -0500 Received: from mail-ej1-x636.google.com (mail-ej1-x636.google.com [IPv6:2a00:1450:4864:20::636]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 372FEC06135B for ; Wed, 6 Jan 2021 15:18:05 -0800 (PST) Received: by mail-ej1-x636.google.com with SMTP id q22so7367733eja.2 for ; Wed, 06 Jan 2021 15:18:05 -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=zRUgN6h11Fruj8QZN9ZX8W0q8/MQWVUot1iJdv2ebks=; b=R5qomqyx5ywaY8kTRnv0MCl56afJpaJ2ziz2IVl1BVLs/ex2vS8YXDLuTb5vBaIREE EHmyGxQdwbfgSLLd7n2BE/J+PCedUdRBrMYeh2g4PNreVLi8Ea2AYouD/DLf8MCLiYHy S5cGiLzKfjMMkIp7zO1wpuzXtCHTfkatAZV5gsjCykiA5PGDj5f8kPR55fT7ZfiWZoDr r0RTqckGHnTuOMbfryEYiiEnH69Zgd8Yi+ZLm6r/PPN0HtCaRZ3tksZwrXmnfvTrNxUI qzHKMdQSOA7LGM01fQmM3NG8k25kIjVdF/JFz99npnSCtqbX+x5TB2qXmyD2pLHt2dC+ wc2Q== 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=zRUgN6h11Fruj8QZN9ZX8W0q8/MQWVUot1iJdv2ebks=; b=joS6jUw8YE/rdh9eZJpdbWhc+dKueWg09ub/2FHKYmRBw8a4tXAk5Jucfy6wIwfq5k DMAx1lDK3/OzGsVb/GU34kiKwo4iKAz9o18uUYIGw+BsA639PiOggrYNo5CTAbqKblgN hE3eDdQDmKvcHopxZanUx5BeZ8f9nG2+uXxHLvxt2UyOt1rJDO3N1qwlBU5B6YL+3vdl /5ZoDJtW1zicLyWZr0XMjy10rIvuruFw4hrdXXmFd+xq7XU4XpVZBRnlD9PWodbxKQTl 2kWJIPeUxPNjsi/dKcqhPPb0PJLx6nyMdiNNzTGc8tb1olGlMZDlFdCaD9TCdH7UGemC F2Qg== X-Gm-Message-State: AOAM5306HqbWLWbdSEPEULoffW8XGp1lIQ/uGpHOAdgOhwWMVtsk5V6j 5ed3R+Y7y3PysGw6WGortHA= X-Google-Smtp-Source: ABdhPJzQxZwD5Ls08HEHLq+zoNF3sXmtwZq2ko+X2rOMJb5u4ZsgFQJQ7ANmhtMiKQOwtY8TdH/e9w== X-Received: by 2002:a17:906:4c55:: with SMTP id d21mr4465344ejw.116.1609975083926; Wed, 06 Jan 2021 15:18:03 -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.18.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Jan 2021 15:18:02 -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 10/11] mlxsw: spectrum_switchdev: remove transactional logic for VLAN objects Date: Thu, 7 Jan 2021 01:17:27 +0200 Message-Id: <20210106231728.1363126-11-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 From: Vladimir Oltean As of commit 457e20d65924 ("mlxsw: spectrum_switchdev: Avoid returning errors in commit phase"), the mlxsw driver performs the VLAN object offloading during the prepare phase. So conversion just seems to be a matter of removing the code that was running in the commit phase. Signed-off-by: Vladimir Oltean Acked-by: Linus Walleij Acked-by: Jiri Pirko Reviewed-by: Ido Schimmel --- Changes in v3: Restored the comment to its original state. Changes in v2: Rebased on top of VLAN ranges removal. .../mellanox/mlxsw/spectrum_switchdev.c | 34 +++---------------- 1 file changed, 4 insertions(+), 30 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c index 003c4a4fc8db..34a622506d36 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c +++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c @@ -1196,7 +1196,6 @@ mlxsw_sp_br_ban_rif_pvid_change(struct mlxsw_sp *mlxsw_sp, static int mlxsw_sp_port_vlans_add(struct mlxsw_sp_port *mlxsw_sp_port, const struct switchdev_obj_port_vlan *vlan, - struct switchdev_trans *trans, struct netlink_ext_ack *extack) { bool flag_untagged = vlan->flags & BRIDGE_VLAN_INFO_UNTAGGED; @@ -1209,8 +1208,7 @@ static int mlxsw_sp_port_vlans_add(struct mlxsw_sp_port *mlxsw_sp_port, int err = 0; if ((vlan->flags & BRIDGE_VLAN_INFO_BRENTRY) && - br_vlan_enabled(orig_dev) && - switchdev_trans_ph_prepare(trans)) + br_vlan_enabled(orig_dev)) err = mlxsw_sp_br_ban_rif_pvid_change(mlxsw_sp, orig_dev, vlan); if (!err) @@ -1218,9 +1216,6 @@ static int mlxsw_sp_port_vlans_add(struct mlxsw_sp_port *mlxsw_sp_port, return err; } - if (switchdev_trans_ph_commit(trans)) - return 0; - bridge_port = mlxsw_sp_bridge_port_find(mlxsw_sp->bridge, orig_dev); if (WARN_ON(!bridge_port)) return -EINVAL; @@ -1764,16 +1759,13 @@ static int mlxsw_sp_port_obj_add(struct net_device *dev, { struct mlxsw_sp_port *mlxsw_sp_port = netdev_priv(dev); const struct switchdev_obj_port_vlan *vlan; - struct switchdev_trans trans; int err = 0; switch (obj->id) { case SWITCHDEV_OBJ_ID_PORT_VLAN: vlan = SWITCHDEV_OBJ_PORT_VLAN(obj); - trans.ph_prepare = true; - err = mlxsw_sp_port_vlans_add(mlxsw_sp_port, vlan, &trans, - extack); + err = mlxsw_sp_port_vlans_add(mlxsw_sp_port, vlan, extack); if (err) break; @@ -1783,10 +1775,6 @@ static int mlxsw_sp_port_obj_add(struct net_device *dev, * updated bridge state. */ mlxsw_sp_span_respin(mlxsw_sp_port->mlxsw_sp); - - trans.ph_prepare = false; - err = mlxsw_sp_port_vlans_add(mlxsw_sp_port, vlan, &trans, - extack); break; case SWITCHDEV_OBJ_ID_PORT_MDB: err = mlxsw_sp_port_mdb_add(mlxsw_sp_port, @@ -3350,8 +3338,7 @@ mlxsw_sp_switchdev_vxlan_vlan_del(struct mlxsw_sp *mlxsw_sp, static int mlxsw_sp_switchdev_vxlan_vlans_add(struct net_device *vxlan_dev, struct switchdev_notifier_port_obj_info * - port_obj_info, - struct switchdev_trans *trans) + port_obj_info) { struct switchdev_obj_port_vlan *vlan = SWITCHDEV_OBJ_PORT_VLAN(port_obj_info->obj); @@ -3373,9 +3360,6 @@ mlxsw_sp_switchdev_vxlan_vlans_add(struct net_device *vxlan_dev, port_obj_info->handled = true; - if (switchdev_trans_ph_commit(trans)) - return 0; - bridge_device = mlxsw_sp_bridge_device_find(mlxsw_sp->bridge, br_dev); if (!bridge_device) return -EINVAL; @@ -3426,22 +3410,12 @@ mlxsw_sp_switchdev_handle_vxlan_obj_add(struct net_device *vxlan_dev, struct switchdev_notifier_port_obj_info * port_obj_info) { - struct switchdev_trans trans; int err = 0; switch (port_obj_info->obj->id) { case SWITCHDEV_OBJ_ID_PORT_VLAN: - trans.ph_prepare = true; - err = mlxsw_sp_switchdev_vxlan_vlans_add(vxlan_dev, - port_obj_info, - &trans); - if (err) - break; - - trans.ph_prepare = false; err = mlxsw_sp_switchdev_vxlan_vlans_add(vxlan_dev, - port_obj_info, - &trans); + port_obj_info); break; default: break; From patchwork Wed Jan 6 23:17:28 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 357976 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 AA672C433DB 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 7FE8723139 for ; Wed, 6 Jan 2021 23:19:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727898AbhAFXTQ (ORCPT ); Wed, 6 Jan 2021 18:19:16 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55148 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727880AbhAFXTL (ORCPT ); Wed, 6 Jan 2021 18:19:11 -0500 Received: from mail-ej1-x62c.google.com (mail-ej1-x62c.google.com [IPv6:2a00:1450:4864:20::62c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F1439C06135C for ; Wed, 6 Jan 2021 15:18:06 -0800 (PST) Received: by mail-ej1-x62c.google.com with SMTP id qw4so7215729ejb.12 for ; Wed, 06 Jan 2021 15:18:06 -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=M2VqyHG2HX9apOvyYcN1fNwb6SDnXCbaKG0Lb94i9BU=; b=qPFC4Fd88p0lJ8qSJWPwy03M8rZNicZ0ZHsgHS1btlUfzVy5Ci3olfKX5CKeajwIDJ /0A8IAv6SLQgLFHlA/1H+yJRvFlDfEAIMSWou7Ugohhj1dz5gPEvZ+o2Kq3/rIOc/8Av bI3aFrnAmpkRBNvBF5f9Si3dQeVHbw1UDDFi/f5ssJ8tbo1i74Afh5RnCnHNKpXz89EZ ayz7Bfw24YGZK/zGlHVr7Pvw5psbn3/ia5lg2xgYF+uvfPq6lNuSM6z7A7ZH94P+GPIv MN7wrXEcpMeTRiAyQwr1Si7lXdc8KpN7qW6h7xuQYXf/8Pk5AErXs2NL3dqy8ScPfYxA wzrQ== 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=M2VqyHG2HX9apOvyYcN1fNwb6SDnXCbaKG0Lb94i9BU=; b=QYlm1ZnFF4p2cLLwZ8DrBSrSt3dpKNNigG/6iWgJtXYG1cexrLAXfXaUvvR0Su87VG Vsk3Fq/rSMhC8r6ocAcXekGTJq3od88Bvw8zAne1NURA472EIkbdKU/xDLNweRVeD9NY PKYboBw3ymJPp8mz6/QmM/Ez5kLhkTAWPfUHhVuqdPT66gegqPLW9ZcRlvVB3vJKjFhE SB6Ufu2FDN2TxiZeN1wPtNAVJTK2EkSE706jqaxMpAzVP7ySdeFFiSHHr16n1q6HG0Pw JKwlX0JFl2Rq9LO7Nrz/rUE4JsCFvL9qC3qwLVX4RV4UegYe8469qB62ZlwGYtygg0PY VMbw== X-Gm-Message-State: AOAM5324RZy7+zhw3PsfsBUAFmXw6GuLolw37FwjM1ah/Z5qEgWBYhBp UKGDUMcfHOIGRQe3l14wVq4= X-Google-Smtp-Source: ABdhPJwAuKrpWhW0ZiAc/1SqSWeJjpsfpz2y1MP7P+qBEs46BQQTTPYA88N62KaI6NmkVU25WI8Rfw== X-Received: by 2002:a17:906:26d7:: with SMTP id u23mr4353061ejc.210.1609975085662; Wed, 06 Jan 2021 15:18:05 -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.18.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Jan 2021 15:18:05 -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 11/11] net: switchdev: delete the transaction object Date: Thu, 7 Jan 2021 01:17:28 +0200 Message-Id: <20210106231728.1363126-12-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 From: Vladimir Oltean Now that all users of struct switchdev_trans have been modified to do without it, we can remove this structure and the two helpers to determine the phase. Signed-off-by: Vladimir Oltean Reviewed-by: Florian Fainelli Reviewed-by: Ido Schimmel Acked-by: Linus Walleij Acked-by: Jiri Pirko --- Changes in v3: None. Changes in v2: None. include/net/switchdev.h | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/include/net/switchdev.h b/include/net/switchdev.h index f873e2c5e125..88fcac140966 100644 --- a/include/net/switchdev.h +++ b/include/net/switchdev.h @@ -16,20 +16,6 @@ #define SWITCHDEV_F_SKIP_EOPNOTSUPP BIT(1) #define SWITCHDEV_F_DEFER BIT(2) -struct switchdev_trans { - bool ph_prepare; -}; - -static inline bool switchdev_trans_ph_prepare(struct switchdev_trans *trans) -{ - return trans && trans->ph_prepare; -} - -static inline bool switchdev_trans_ph_commit(struct switchdev_trans *trans) -{ - return trans && !trans->ph_prepare; -} - enum switchdev_attr_id { SWITCHDEV_ATTR_ID_UNDEFINED, SWITCHDEV_ATTR_ID_PORT_STP_STATE,