Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp1113993imj; Thu, 14 Feb 2019 01:17:40 -0800 (PST) X-Google-Smtp-Source: AHgI3Iaw4lwqxS89IK1N2//hWcDW56t1senqp4tsfEIgOm5xlXd8ZmCLUP8447hcR5xAloT9iOKh X-Received: by 2002:a17:902:e78e:: with SMTP id cp14mr3114699plb.4.1550135859998; Thu, 14 Feb 2019 01:17:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550135859; cv=none; d=google.com; s=arc-20160816; b=PQtyFcc+Mz9AbfeXdAY0vVRxB2BAAV5ocThZULVg3tyxJLHqam3lWD3UCwRpD4nZ60 wZlJJ+aIgS1TmrQ6flQ5/vw5nTiCV1aVCvt5gjsmTjzoit4IKRcoQGmPzLET7KmqODVn aZ8tBTuP5YVwBGP9cEgaZ6MdQ99a5Oslbv5oFqZ4puWt4wZjtfrYDAPQZ9aMhV/zftWK 2N5BguVkT2dyxoFlANv6GLveMErMZaHYKIje0Qzh5QCRbwBcy3/bg7uePXN56pfms4gv we+6sFjTbpsgW0JnC9LWGGuknGvGmTPYtcZs4pxCtuMy8Hl/rwfNS6tH93d9OgVypvte nw+w== 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=/FNSaCPkNb/ATQEB/CndFveaqB+F4uCmwJCbnMmSO6Y=; b=LdhiqWIK7CmBSSWpIqWBbPih803HZg6vDiHgA4nYiO9jGQeHG5cKIswVBvAnhr7wJH qhDulWIja+A6M6VfptAkIX4/f7dqP6aiJM6ZBP1tqnsG1SfBTPqZD7blVZpmuNhvvSsH pb3hmsLCkPCPj41RUuFYbi4rf+hkOIjZAFhlis3DEbQh07nzBMQMbcW3iiWRb/lrHZvV RX+2tT5nce7BIGl74F7mLusEHeAb6qkABcDG9BZREc5otfe4R91rcl1pI3Kep6pCrYH6 62Ue+Z6Z27BdNB0ZSkF1lxqFpeQpVKbKc296OnBv6h42LCqXprKWYLguyyrtxDnpUcV9 7gTw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=GEvgGTcZ; 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 h33si1833369pgl.157.2019.02.14.01.17.24; Thu, 14 Feb 2019 01:17:39 -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=GEvgGTcZ; 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 S2437026AbfBMWHp (ORCPT + 99 others); Wed, 13 Feb 2019 17:07:45 -0500 Received: from mail-pl1-f193.google.com ([209.85.214.193]:38790 "EHLO mail-pl1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730382AbfBMWHn (ORCPT ); Wed, 13 Feb 2019 17:07:43 -0500 Received: by mail-pl1-f193.google.com with SMTP id e5so1877908plb.5; Wed, 13 Feb 2019 14:07:43 -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=/FNSaCPkNb/ATQEB/CndFveaqB+F4uCmwJCbnMmSO6Y=; b=GEvgGTcZLNMZ5vvQeqU/k8nRu5G+1FWJyGtVUNNs73ELZjVy1d4zrlIHNw6Nnnesup rq00QhhI5fbhL3Y60R4eJjPe/fYHn0DlBi5jyYTXfWXw58NHOF2Y9g7xmlmStNJ5EX7E TKVk2Of6QjynIJblOeoQTgGiDFEQwHJgiSYN7L5FDUMg4qVOQZrRnOzNcJbW8Affnv5d 893XIuI+5unQ/6y1+XodepjRdfhGNkT+qb/lb9kktI/PZ72zzEFrmtgZ2lvlVv4HtZMY RAqGhO/tRCH1wr/GSFWpHxuJ7rRLdvoWFJIBW0TeRbAsvzmvzeQ5kEU85/z56/YZd/fF GxoQ== 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=/FNSaCPkNb/ATQEB/CndFveaqB+F4uCmwJCbnMmSO6Y=; b=NGzzYRGVYUhfu+RRolNq9xV3vDWpnHwOejWscy+j/Pi/KB2TiK0RD6ANsj/WNI0D4H LplZsna6pM/kvjavpzOQzNWS7WRroU1B1jjBz6bHuJQyMirSQrr6AYFx9MGICOqU/0sv lvDsMT5A4RttbqIn1wQCURTikyfut0Yk+XZjz74N0ScfkHT8URLcyTFN+ruC4ia9NbLI u6Jm3sNhqNYCeoIjCVK2sh/4qAA+o4G+kl70PymArIgWgG5vUIKGVLCitnq7eDctidRb 3HSTijtkSGxcbRJQR+qPQb8cwza8w7XeXnsyyuBYrjcBSs11szufBJBz2uBcemRiDs36 GDXw== X-Gm-Message-State: AHQUAubdsMKgnGhtLWNX+1ACCS1U3uWkAAFPnoUvkifcsAOy7B63q25I 71biWvMVMLINchidjFW1YooIJJMr X-Received: by 2002:a17:902:15a8:: with SMTP id m37mr420819pla.129.1550095662182; Wed, 13 Feb 2019 14:07:42 -0800 (PST) Received: from fainelli-desktop.igp.broadcom.net ([192.19.223.250]) by smtp.gmail.com with ESMTPSA id o1sm383735pgn.63.2019.02.13.14.07.38 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 13 Feb 2019 14:07:41 -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 7/9] net: bridge: Stop calling switchdev_port_attr_get() Date: Wed, 13 Feb 2019 14:06:36 -0800 Message-Id: <20190213220638.1552-8-f.fainelli@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190213220638.1552-1-f.fainelli@gmail.com> References: <20190213220638.1552-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 checking the bridge port flags during the prepare phase of the switchdev_port_attr_set() when the process SWITCHDEV_ATTR_ID_PORT_PRE_BRIDGE_FLAGS, we can avoid calling switchdev_port_attr_get() with SWITCHDEV_ATTR_ID_PORT_BRIDGE_FLAGS_SUPPORT. Signed-off-by: Florian Fainelli --- net/bridge/br_switchdev.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/net/bridge/br_switchdev.c b/net/bridge/br_switchdev.c index db9e8ab96d48..8f88f8a1a7fa 100644 --- a/net/bridge/br_switchdev.c +++ b/net/bridge/br_switchdev.c @@ -64,29 +64,27 @@ 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 = flags, }; int err; if (mask & ~BR_PORT_FLAGS_HW_OFFLOAD) return 0; - err = switchdev_port_attr_get(p->dev, &attr); - if (err == -EOPNOTSUPP) - return 0; - if (err) + err = switchdev_port_attr_set(p->dev, &attr); + if (err && err != -EOPNOTSUPP) return err; - /* Check if specific bridge flag attribute offload is supported */ - if (!(attr.u.brport_flags_support & mask)) { + if (err == -EOPNOTSUPP) { br_warn(p->br, "bridge flag offload is not supported %u(%s)\n", (unsigned int)p->port_no, p->dev->name); - return -EOPNOTSUPP; + return err; } 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