Received: by 2002:ac0:a679:0:0:0:0:0 with SMTP id p54csp170916imp; Wed, 20 Feb 2019 16:59:46 -0800 (PST) X-Google-Smtp-Source: AHgI3IZ5yvHX32keoIazcfYoCSEaS1UWRkm9ijHTv1+ogRFWlW23UcG9hYKVaiaHWw3MK2Ov1jEF X-Received: by 2002:a62:39c5:: with SMTP id u66mr37276842pfj.245.1550710786198; Wed, 20 Feb 2019 16:59:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550710786; cv=none; d=google.com; s=arc-20160816; b=L1vj9AWnMhPQmjwECiz8lOTpihtHyk2/LGdN1bzgHN6DbkWODLt/z2AZ8LV7sg6vX3 cD+vklSvQclr91S9gcqbXWrI1DLiUAJRXeT0C/5iFm7EnM2uoFKIWKC+THO9Apymm7Nq L57Z+FB24ozleEctN5w7EKlTj1BxFqStqVo0Nf5qERxRSoiW2vCZB+6SWM4diNjl5PPX ldWe0SACwjSIqVLqbrhq9MgPHxK66KdrSGApGXIAIkv4JztTFvhvNv0I+63RTSFIwPe8 +UuvoZn6naH/h6YIuwt5ZMZQsfaHxDmmddN/zFmc4ibYcSbOdxkkcvtswlJDXdQLZruZ oF9A== 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=9UDI7X41YNHKHghB/bq/RanLp9N2yQLoh7jMnll+lSo=; b=0HPIPFLBnXndxe2EGGhAIYVp6FMpj7CXqU/4uBNUU0VcGHpJPfVzZQSoXJqdBzRqGq yzrkLNUhpp1O23Fk7qQV9ChabSMJ4bScbPwTl7iA0unMN/PnwOifDB8VPedJYFJUh3X7 aS9JZkKX4+qlSbsjk6SYj7lYmW6lPwysPf6eHgUkMTzAnAG+AeNd0PYF8ojZrMCw07R6 Cq05qOWKvWLqn4NiICsxB4ZSV98DZgSukF2+dF5X7MojRpIt8vN1lB/tYedTDdAgnr21 /k/HRji3rTMEApjwqY/fm9XXB0bjssv8oVNTNBHErYL8MlYk/MUrfXHrwUebKVemCEcM 9GLw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=MHjpDU8v; 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 c19si9542844pgw.516.2019.02.20.16.59.31; Wed, 20 Feb 2019 16:59:46 -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=MHjpDU8v; 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 S1727102AbfBUA6y (ORCPT + 99 others); Wed, 20 Feb 2019 19:58:54 -0500 Received: from mail-pg1-f195.google.com ([209.85.215.195]:34383 "EHLO mail-pg1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725875AbfBUA6x (ORCPT ); Wed, 20 Feb 2019 19:58:53 -0500 Received: by mail-pg1-f195.google.com with SMTP id i130so12843135pgd.1; Wed, 20 Feb 2019 16:58:52 -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=9UDI7X41YNHKHghB/bq/RanLp9N2yQLoh7jMnll+lSo=; b=MHjpDU8vnx8rt7P5+weZq3EGNcz1vZRbdJIk4Wa1yVGy9RR7GxN+6bHHBsWx2j74ix jDHM+4RAghP2+XJ0tNsOTWTqaxm3EvbvSiPOzbcw+G8pbEEVwaYzHB6mGxIc5YRiHaZA 3F1nYnaRM2f8ZEYUd0O8yonZbv9s05Vh4/x8PAfCacgpL3iVPl335peoSUHbS3Oe13WT f6vpsnBlz7YX+h+k5TiQH08SfQClFxYLYBsCzFHDwJvQIN/nsOE4r+ELLgeAUKsHlBaK NxSUmQzVir1DGOxCf6Wc6nuQ00EoldQmF8e9QNWXwO9DtmVIMmRw4JACA+2NwyjOCeRP IanA== 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=9UDI7X41YNHKHghB/bq/RanLp9N2yQLoh7jMnll+lSo=; b=nSGlWqUFrP+C9FfXRbEVio9t7yTKpY6Wqe/TTSeVY98wV9+795gQkzspK5TWJcsOEe INwmgpW9On75m5atD2wZev/7KDRDcfb3jJJWP5opWF42POMW7QHAzlxPzlBfuHTf8ReC 822GlNjtwRtpaQmHhdBxS7x6adkTt3ZerfqQnu1wLgyls10fsP2pt9+g7kreeeUdkH2Z a2Z8+98ee4MZHdma34HCclmtUU8rQmjjl++6UzPZ/uU9g+gAws1PrBylywyr8dtX7YHA Ex4ICUB9ePDFGzqnwYHw0USnpg6p3DV5cUINAzJFDOs/yOG2nCTdgjkpSg9wQgbTWxav Ezbg== X-Gm-Message-State: AHQUAubX0jwM4vWQSesSto5KJbyeZymwEzIPV7EdzJZ1GdZNLDUcAmed TEJ+2tyC7i4jLztjiO/lFHaLldK8 X-Received: by 2002:a62:61c4:: with SMTP id v187mr13313157pfb.133.1550710731786; Wed, 20 Feb 2019 16:58:51 -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.47 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 20 Feb 2019 16:58:51 -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 4/8] net: dsa: Add setter for SWITCHDEV_ATTR_ID_PORT_BRIDGE_FLAGS Date: Wed, 20 Feb 2019 16:58:22 -0800 Message-Id: <20190221005826.26317-5-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 In preparation for removing SWITCHDEV_ATTR_ID_PORT_BRIDGE_FLAGS_SUPPORT, add support for a function that processes the SWITCHDEV_ATTR_ID_PORT_BRIDGE_FLAGS and SWITCHDEV_ATTR_ID_PORT_PRE_BRIDGE_FLAGS attributes and returns not supported for any flag set, since DSA does not currently support toggling those bridge port attributes (yet). Signed-off-by: Florian Fainelli --- net/dsa/dsa_priv.h | 2 ++ net/dsa/port.c | 12 ++++++++++++ net/dsa/slave.c | 4 ++++ 3 files changed, 18 insertions(+) diff --git a/net/dsa/dsa_priv.h b/net/dsa/dsa_priv.h index f4f99ec29f5d..47a1d1379d15 100644 --- a/net/dsa/dsa_priv.h +++ b/net/dsa/dsa_priv.h @@ -160,6 +160,8 @@ int dsa_port_mdb_add(const struct dsa_port *dp, struct switchdev_trans *trans); int dsa_port_mdb_del(const struct dsa_port *dp, const struct switchdev_obj_port_mdb *mdb); +int dsa_port_pre_bridge_flags(const struct dsa_port *dp, unsigned long flags, + struct switchdev_trans *trans); int dsa_port_bridge_flags(const struct dsa_port *dp, unsigned long flags, struct switchdev_trans *trans); int dsa_port_vlan_add(struct dsa_port *dp, diff --git a/net/dsa/port.c b/net/dsa/port.c index 7bc2a5ad95c6..e9b5b50f8cf1 100644 --- a/net/dsa/port.c +++ b/net/dsa/port.c @@ -187,6 +187,18 @@ int dsa_port_ageing_time(struct dsa_port *dp, clock_t ageing_clock, return dsa_port_notify(dp, DSA_NOTIFIER_AGEING_TIME, &info); } +int dsa_port_pre_bridge_flags(const struct dsa_port *dp, unsigned long flags, + struct switchdev_trans *trans) +{ + struct dsa_switch *ds = dp->ds; + + if (!ds->ops->port_egress_floods || + (flags & ~(BR_FLOOD | BR_MCAST_FLOOD))) + return -EINVAL; + + return 0; +} + int dsa_port_bridge_flags(const struct dsa_port *dp, unsigned long flags, struct switchdev_trans *trans) { diff --git a/net/dsa/slave.c b/net/dsa/slave.c index 85dc68611002..44cc4e50dd5a 100644 --- a/net/dsa/slave.c +++ b/net/dsa/slave.c @@ -295,6 +295,10 @@ static int dsa_slave_port_attr_set(struct net_device *dev, case SWITCHDEV_ATTR_ID_BRIDGE_AGEING_TIME: ret = dsa_port_ageing_time(dp, attr->u.ageing_time, trans); break; + case SWITCHDEV_ATTR_ID_PORT_PRE_BRIDGE_FLAGS: + ret = dsa_port_pre_bridge_flags(dp, attr->u.brport_flags, + trans); + break; case SWITCHDEV_ATTR_ID_PORT_BRIDGE_FLAGS: ret = dsa_port_bridge_flags(dp, attr->u.brport_flags, trans); break; -- 2.17.1