Received: by 2002:ac0:a679:0:0:0:0:0 with SMTP id p54csp170964imp; Wed, 20 Feb 2019 16:59:54 -0800 (PST) X-Google-Smtp-Source: AHgI3IYCdhbBO/WQkv29HJT7JHKci4U5cQUXaavQef0+SgsO2N8sx2E0Wh2fwYHErHAY9LbZERhu X-Received: by 2002:a17:902:42e:: with SMTP id 43mr38957031ple.88.1550710794008; Wed, 20 Feb 2019 16:59:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550710794; cv=none; d=google.com; s=arc-20160816; b=fVFsuLLy4oILg0HRmsIEuyqRIb4Qh+KG22pX1g52A15Yj8Yn+w0z/rBUSd6QozWG77 GojCOqH9eIejxAOUDghqXfhfS6IkC4gHLtdvUJeE9En5+iRcMpH1vZ76AubQk7Wq+E/c lxtiFx5myx5n2FzXZyXKZMNtYGkvCZyT9V4l2Q60tSsP37jbDed+B3ht4Os1H5gMraL0 HsW2Much9FhRHkNc4jd7QbS0l6z8xP7b95Bo2zJneknPwEw5px41A7kKcDeN0jxE47LW e6oaLFWhjf8XOOmRQ2BxYQynRzfByl++mmt0ehPNQJWvA9mEU6M+FHjL7zFrE4ZdL0J4 9EZQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=l46VvHT7eqrMkE6E40frKPiWzb4eR8K705HCwYquJCU=; b=POxAvZFwwtdNhvfMDHyxsfgMhZeHhk/oNbHotzqbwQE+iXor74HZDfJBk2iQTnYc8Q YkQi78O1fMLmofMQQSY2fK18C7hLSdf0ddc4KauU1BZfzE+UmiRy+RT2QKzbpeDE+gvW ocMbLiY1IIcAmKcze+29KaB7MTC0qzhaxHcpPEIA7IVQDq6pEH2q/7u+uavZjlX282CL b8wnlF45Rd1XOgGMuItJib3w8ynLkWtYL6RCf5KQkH+Dv8/L7gdP27Q4/lfbqAWmewiC YUw4ElmuTXp1AT7LVViHkYxB214w9jSciw/4BkV5QiwpCkYL43erERhnK8xEhshV5SCm Sz2Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=txh9ImLw; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v71si357218pgd.499.2019.02.20.16.59.39; Wed, 20 Feb 2019 16:59:53 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=txh9ImLw; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727239AbfBUA7C (ORCPT + 99 others); Wed, 20 Feb 2019 19:59:02 -0500 Received: from mail-pl1-f193.google.com ([209.85.214.193]:37765 "EHLO mail-pl1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725875AbfBUA7B (ORCPT ); Wed, 20 Feb 2019 19:59:01 -0500 Received: by mail-pl1-f193.google.com with SMTP id q3so5812493pll.4; Wed, 20 Feb 2019 16:59:01 -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; bh=l46VvHT7eqrMkE6E40frKPiWzb4eR8K705HCwYquJCU=; b=txh9ImLwOaMk2Pj6TsIYFuyxEpUJqVwgwNymksKWtPWisIJo2EiDoRKdrew+nKzHNe PTAz+ddwdXucDqiIBxUrJ0sc70xW6LOifRCyznfbhJGZeQ2mo4zGhbrQSkZPNHdip7WN l5uHQT+VJGmWm/gUwO8v7jRroVFoe6C1t4m5IP4AUqqocUPP+cW4EmpadcUIvS8/6AQ7 t99n36Yvjx8Zbh8yIIkWBKvcgFkiK09KpgbH/iF5KlD/Ndac++AIG2wQCCEo8NjoyUag /rXTlITaLmSZrnaXrahsWpLrwdn5Whhop+Pv80iZ/6jWN2ujAnXh88N84GRlid2jSZxU Mu5Q== 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; bh=l46VvHT7eqrMkE6E40frKPiWzb4eR8K705HCwYquJCU=; b=dXiQMS48tx5V8zVpvnzuX+mpc/RpjKRPpAeQwBQsO12kBGT4HLUUfbsQ2eOiu+EG+0 g0LctSZ0DT40FCXKti7e1Kt0/VTHBI65C2n0VAk6Obb/J5RGs1EiswiTnbMq/dvTPwk9 I/PvaRdb7Ji5dfOxfSYa0k808UCB5or6u3wAhOEh1VDpCRP60AFfY81LdqtBW0WfEf0U 1pvBmLzOxhP2ZKXNRT0PB7fQKlAJrEGhvGLzeXLkgNu4n6hu/N9V1V+GnvAsOArYDukQ wRtoskYNh30u/tYnWNl8eKiLV2aJ/6R8TMG67xGSdDFg1KDqxI5U6rUQZNo7/Lt+9G40 55ow== X-Gm-Message-State: AHQUAubdFv64G4xDeM+rcEURRMj7sFGlcEsnwGV3PSwJqlrCed1Aq9dz ac4gK+nkfCmr6DRz+wmrGzwOwTQw X-Received: by 2002:a17:902:6b03:: with SMTP id o3mr39617799plk.126.1550710740732; Wed, 20 Feb 2019 16:59:00 -0800 (PST) Received: from fainelli-desktop.igp.broadcom.net ([192.19.223.250]) by smtp.gmail.com with ESMTPSA id z15sm17203255pgc.25.2019.02.20.16.58.56 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 20 Feb 2019 16:58:59 -0800 (PST) From: Florian Fainelli To: netdev@vger.kernel.org Cc: Florian Fainelli , "David S. Miller" , Ido Schimmel , linux-kernel@vger.kernel.org (open list), devel@driverdev.osuosl.org (open list:STAGING SUBSYSTEM), bridge@lists.linux-foundation.org (moderated list:ETHERNET BRIDGE), jiri@mellanox.com, andrew@lunn.ch, vivien.didelot@gmail.com Subject: [PATCH net-next v3 6/8] net: bridge: Stop calling switchdev_port_attr_get() Date: Wed, 20 Feb 2019 16:58:24 -0800 Message-Id: <20190221005826.26317-7-f.fainelli@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190221005826.26317-1-f.fainelli@gmail.com> References: <20190221005826.26317-1-f.fainelli@gmail.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Now that all switchdev drivers have been converted to check the SWITCHDEV_ATTR_ID_PORT_PRE_BRIDGE_FLAGS flags and report flags that they do not support accordingly, we can migrate the bridge code to try to set that attribute first, check the results and then do the actual setting. Signed-off-by: Florian Fainelli --- net/bridge/br_switchdev.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/net/bridge/br_switchdev.c b/net/bridge/br_switchdev.c index db9e8ab96d48..af57c4a2b78a 100644 --- a/net/bridge/br_switchdev.c +++ b/net/bridge/br_switchdev.c @@ -64,21 +64,19 @@ int br_switchdev_set_port_flag(struct net_bridge_port *p, { struct switchdev_attr attr = { .orig_dev = p->dev, - .id = SWITCHDEV_ATTR_ID_PORT_BRIDGE_FLAGS_SUPPORT, + .id = SWITCHDEV_ATTR_ID_PORT_PRE_BRIDGE_FLAGS, + .u.brport_flags = mask, }; int err; if (mask & ~BR_PORT_FLAGS_HW_OFFLOAD) return 0; - err = switchdev_port_attr_get(p->dev, &attr); + err = switchdev_port_attr_set(p->dev, &attr); if (err == -EOPNOTSUPP) return 0; - if (err) - return err; - /* Check if specific bridge flag attribute offload is supported */ - if (!(attr.u.brport_flags_support & mask)) { + if (err) { br_warn(p->br, "bridge flag offload is not supported %u(%s)\n", (unsigned int)p->port_no, p->dev->name); return -EOPNOTSUPP; @@ -87,6 +85,7 @@ int br_switchdev_set_port_flag(struct net_bridge_port *p, attr.id = SWITCHDEV_ATTR_ID_PORT_BRIDGE_FLAGS; attr.flags = SWITCHDEV_F_DEFER; attr.u.brport_flags = flags; + err = switchdev_port_attr_set(p->dev, &attr); if (err) { br_warn(p->br, "error setting offload flag on port %u(%s)\n", -- 2.17.1