Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp1112494imj; Thu, 14 Feb 2019 01:15:57 -0800 (PST) X-Google-Smtp-Source: AHgI3IaFEZPr2iiuNkZLZrItsVumUTqcW/5lNYCD6e6D4/PcvmxpV+UEYVRX5bCs1jnzjIaEDpkB X-Received: by 2002:a63:eb49:: with SMTP id b9mr2830814pgk.196.1550135757363; Thu, 14 Feb 2019 01:15:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550135757; cv=none; d=google.com; s=arc-20160816; b=ehPgwOgMJIfxGceNuBDVG5sUvmOJyso85YH6tz/7eaR+PcLQwFUbGUmeRdXuQOz+rD 44KRyzbzlUha4TJ1oN9122Z7XdHYqOSsuXDqr4bEaLbE22fVzldUkZwP9Pm6hezOqvO1 Q6xJ2YJESKEBMJJgUlQLzG6q7CtWr8f9EYxOPK4ymCuFS1DXIjhFt3FUDHrsNTlQ1h3j GQdk5QbESIYXqBXcFnBrtc1vKOGdFnfmAQcXthS+kHoWMe2644fUyZSDLcVYFFaBgcAv JYA5zF7f1r36zH4VmjA3SEm4Iy6fYEVbXueA8wDKFon7/R4M9wyDYd7GzbW7Tx2p6ZXS swDA== 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=a873itx+S/T6yC+oMc+1M1LiImcgfFyeED4oExKC26w=; b=yOtYSidIC1gio8QkW7xRCKemvKWf5AT/YB858g70E4Q9JmH8iJtwN1/Q5BRZbdsQb/ VpQksJqNLqFUffc+XfpUPQgxzfFJaWnjfkbB3NBOArhaSf63f84gnvX4NDk5fxn00zLy z/C6M7UU2eS1pvFLm9RngBn5jC3COYHl9VlkU5V6sFBqsu8f8RQnvT3NbL0JLYKPNUeA 4bkqvfz7E3J7GEaeptNibXIuMfFgEmlc+CQiAkuPx6u4JL9Smm1uctK/oW4Fgdq+Xq3/ nleu7YKLsku9O6AMJQk+1HmdKEYMDkrTo24GEhnCsdpJxaljRwTaEVARuOFAzY0Qs0DF zChg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=mKaPj6sm; 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 t194si1894533pgc.588.2019.02.14.01.15.42; Thu, 14 Feb 2019 01:15:57 -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=mKaPj6sm; 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 S2404046AbfBMWHb (ORCPT + 99 others); Wed, 13 Feb 2019 17:07:31 -0500 Received: from mail-pf1-f195.google.com ([209.85.210.195]:33857 "EHLO mail-pf1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729139AbfBMWHa (ORCPT ); Wed, 13 Feb 2019 17:07:30 -0500 Received: by mail-pf1-f195.google.com with SMTP id j18so1858172pfe.1; Wed, 13 Feb 2019 14:07:29 -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=a873itx+S/T6yC+oMc+1M1LiImcgfFyeED4oExKC26w=; b=mKaPj6sm8tggLzNs698hl1jZiyYmcNwQSzZ1b7TwTtX6DapyetiOaR4Azzlo9/pDDy yZDQ9nhhHJGcDxDqj3/f5G+EJZI4a+/2CMm+Wr+xo+6o7xvxJ0BIhjWYiXxtgvWULLXm HXo/x3VR04o90sr171OmGBP4/s0LyFrO0DgBYkFNdeOHLrqycgzDTGTmcUD41+OJTGYq uuKq2QZJQHAK9fj3spFs4fgBOxJsF8o1rim92padBvg4S7qnci7boN9mGJF/IASIv8QC DHmund0/LVFNKI3uOYI5V/ffOFLXykVjllaOfikCTuME3qgMdl5VbiELKNWwOpy1j3+l TUBQ== 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=a873itx+S/T6yC+oMc+1M1LiImcgfFyeED4oExKC26w=; b=GwHqeXZLSEzgDcHo764CQ/DwmDkgq4JuUPteDaSGIR28h3u9K10HrfrvlDyDQIe7EW apZAN48Hp4VzGUYL9tKntdug64IyBXWzUtNa1/4Rxo/1JWA2K1sRcMFjuroDMntwTiN9 ziCXkcL2Mgw364ctl7PkL0lK7ltJDZWuqj37Vj++MRAeaJyZzGBSgZmAzJxmlsZfkwNP IYjDjxVZur2Gat0WG93fHOzO392up19A0FWQagp47QEqX4sxECml+onpdg/YOmPIKvrS U3+8S4GgPdAuGKPNJymsSdFS32tRnldNwPEwaEwr7PKVKDNNMsEmufRgH0A2pN/b0x2P W+zw== X-Gm-Message-State: AHQUAua5Xbt7fxycBDtPGNVW+Gv/83rfMWK3AG7vNyHT9DFv/jhJ/wg4 aBydjj1BUVg/1IMZtoarjGyxWpaf X-Received: by 2002:a65:41c2:: with SMTP id b2mr377141pgq.67.1550095648813; Wed, 13 Feb 2019 14:07:28 -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.24 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 13 Feb 2019 14:07:28 -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 4/9] staging: fsl-dpaa2: ethsw: Check bridge port flags during prepare Date: Wed, 13 Feb 2019 14:06:33 -0800 Message-Id: <20190213220638.1552-5-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 In preparation for removing SWITCHDEV_ATTR_ID_PORT_BRIDGE_FLAGS_SUPPORT, have ethsw check that the bridge port flags that are being set are supported when SWITCHDEV_ATTR_ID_PORT_PRE_BRIDGE_FLAGS is specified. Signed-off-by: Florian Fainelli --- drivers/staging/fsl-dpaa2/ethsw/ethsw.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/drivers/staging/fsl-dpaa2/ethsw/ethsw.c b/drivers/staging/fsl-dpaa2/ethsw/ethsw.c index 1b3943b71254..f788a9458b89 100644 --- a/drivers/staging/fsl-dpaa2/ethsw/ethsw.c +++ b/drivers/staging/fsl-dpaa2/ethsw/ethsw.c @@ -668,13 +668,16 @@ static int port_attr_stp_state_set(struct net_device *netdev, static int port_attr_br_flags_set(struct net_device *netdev, struct switchdev_trans *trans, - unsigned long flags) + unsigned long flags, bool pre_set) { struct ethsw_port_priv *port_priv = netdev_priv(netdev); int err = 0; - if (switchdev_trans_ph_prepare(trans)) + if (switchdev_trans_ph_prepare(trans) && pre_set) { + if (flags & ~(BR_LEARNING | BR_FLOOD)) + return -EOPNOTSUPP; return 0; + } /* Learning is enabled per switch */ err = ethsw_set_learning(port_priv->ethsw_data, flags & BR_LEARNING); @@ -691,6 +694,7 @@ static int swdev_port_attr_set(struct net_device *netdev, const struct switchdev_attr *attr, struct switchdev_trans *trans) { + bool pre_set = false; int err = 0; switch (attr->id) { @@ -698,9 +702,11 @@ static int swdev_port_attr_set(struct net_device *netdev, err = port_attr_stp_state_set(netdev, trans, attr->u.stp_state); break; + case SWITCHDEV_ATTR_ID_PORT_PRE_BRIDGE_FLAGS: + pre_set = true; /* fall through */ case SWITCHDEV_ATTR_ID_PORT_BRIDGE_FLAGS: err = port_attr_br_flags_set(netdev, trans, - attr->u.brport_flags); + attr->u.brport_flags, pre_set); break; case SWITCHDEV_ATTR_ID_BRIDGE_VLAN_FILTERING: /* VLANs are supported by default */ -- 2.17.1