Received: by 2002:ac0:8c9a:0:0:0:0:0 with SMTP id r26csp979437ima; Fri, 1 Feb 2019 14:12:11 -0800 (PST) X-Google-Smtp-Source: ALg8bN6KYW8S1yDSSwjQfMwhW5eJ1/oVsDBYnN23ylWNTNDSt0Pu3y5WP2xrDgcXn9YsQIIGL4i0 X-Received: by 2002:a17:902:280b:: with SMTP id e11mr41479422plb.269.1549059131850; Fri, 01 Feb 2019 14:12:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549059131; cv=none; d=google.com; s=arc-20160816; b=v4yXk46xjjzZz+LDMhN97FuNojdG2Sl+DP80KEdRFnGx0RpLV/KM6Q79mLODxiWZEy s5u8ZBIYI/uAhAHlFA0Yp261HNi6RCRfLUeI7PlgzvaxztmOh5gzjDj0RDzxIWYfOItp W/wC5ny1nNo2KAk27EUTxLWtT6M3Q5fJDH9ghgF4JtqWhec7yXY7fmGpqVz29lXJRXGr ujZ4Gf64S0fH3BnED6rf4EwjN6EcHgAXnYsU496RjN+MB4vUlCdLVeskP2efwZ9sjzQj CmwuGm1HU+PMMu0zj710JBlUPG8i/MagW8qh87hOS/kKmIJJtjeLuuuNIbwc1HMYD5ac DBSQ== 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=FKCIMCyyfN1QkkeHgOqs2oTy49pc5Z+rv4NjsW0Dv0o=; b=c5h3uFEkhstrONthLzn04o6AfIAX6o1INzkEnNWo4q+HUjLneYo92vNxQlKo7kY5jO cIKTAUh5JI2mzhmBBArPGg2N9tLE3Z3MzPKH20YObS6KUBYxGtl2ZX5+qiHFsw/gZoKR 4LLQ82CCewPb8iOZ86J+AN5oPknSxHPgYo9TmUNi7au/+zWisTRM3dCPrtIE2BBjqt4Q 1OUJ3mF1IPGaLluzAIrAP5Z+qMv+ymFJQAsSQmqUXtaESmVKX0fTTGaZwkqrWqO4QcpL aMgP4SPRN0LyD/Vkyh2bPhTmzsUJmQXdC/oykH/O5AAKo2aylDhi8QrPccxF+RnFJN6C 964g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=DD257aAj; 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 t74si6789139pgc.150.2019.02.01.14.11.56; Fri, 01 Feb 2019 14:12:11 -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=DD257aAj; 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 S1727052AbfBAWIJ (ORCPT + 99 others); Fri, 1 Feb 2019 17:08:09 -0500 Received: from mail-pl1-f193.google.com ([209.85.214.193]:38108 "EHLO mail-pl1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726116AbfBAWII (ORCPT ); Fri, 1 Feb 2019 17:08:08 -0500 Received: by mail-pl1-f193.google.com with SMTP id e5so3887762plb.5; Fri, 01 Feb 2019 14:08:08 -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=FKCIMCyyfN1QkkeHgOqs2oTy49pc5Z+rv4NjsW0Dv0o=; b=DD257aAjioCFNHxiYzBeOgHIb9oZEXYgIWX6U9NMdBDijp+PBdL5YOlQ+NqHlCZxHK YSRNs0O7nmbfucgo8K/9Kj4N9eEWUJcLBEqU8yqKNvkNoXnCHtpEgEtmWQgt9Hi3z9Fh qVQFWnnlNJSKNAWd1aZ8CPazEOQyinBg5Y6N+ffxExKOhXMOoCmWME8S0NJN/Ew3Jb7S gedunAfF8p3aDtfTSAhryRvV02ZXdBVOR5YNVmCIkb+EkGR7MfHGKp8mcNUGZ72Wt+WQ mOTHJDgEel8XOXVbZWIghpDLRH19K2+MXkgIYwPdfwuWz88LMv0wUETDnX3WyMXum3+o e94g== 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=FKCIMCyyfN1QkkeHgOqs2oTy49pc5Z+rv4NjsW0Dv0o=; b=be2PZNuL29/E7kQZygajX2nlnFTpIXE0yvbpBwqAWAxXDyxv4q5RIbPk8HQMj7n2LV TnrqcFzExKYezK6/CvmD1U6xZ86tq//GdH1XS6n0UzhjjEyJ5vGjmDZuDTXZSBGJbYcP S7A5QusRwxgJRgI63g7EXC1curjpFIhckiM4vVsEmW3fwQmDcKiX4iRCKyQ9fqJ9MO9o fWNxxtqDdYr/lDLCOvys30mI0iAcOiVhYhqu8Xq3HsNRFNiNz5IvaOV3UxIu77l4w3GZ Z06hIxFKb4ObASRzR/lnPVV1mE32xZr3qS/mazTEh3NRmfcG9QPEybPcXoNq8X5EWvRl +JzA== X-Gm-Message-State: AJcUukcD5kpF2HlkcD/W5gcupf9VnyQe0FRjsfrpwH3xmLUQ5tWY3Mzd 4UkJdFqpcLNlX6iCunrvPehagYV2 X-Received: by 2002:a17:902:724a:: with SMTP id c10mr42186693pll.51.1549058887257; Fri, 01 Feb 2019 14:08:07 -0800 (PST) Received: from fainelli-desktop.igp.broadcom.net ([192.19.223.250]) by smtp.gmail.com with ESMTPSA id 78sm11142208pft.184.2019.02.01.14.08.04 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 01 Feb 2019 14:08:06 -0800 (PST) From: Florian Fainelli To: netdev@vger.kernel.org Cc: Florian Fainelli , Michael Chan , "David S. Miller" , Derek Chickles , Satanand Burla , Felix Manlunas , Saeed Mahameed , Leon Romanovsky , Jiri Pirko , Ido Schimmel , Alexandre Belloni , Microchip Linux Driver Support , Jakub Kicinski , Ioana Radulescu , Ioana Ciornei , Greg Kroah-Hartman , Ivan Vecera , Andrew Lunn , Vivien Didelot , Dirk van der Merwe , "Francois H. Theron" , Simon Horman , Quentin Monnet , Daniel Borkmann , Eric Dumazet , John Hurley , Edwin Peer , linux-kernel@vger.kernel.org (open list), linux-rdma@vger.kernel.org (open list:MELLANOX MLX5 core VPI driver), oss-drivers@netronome.com (open list:NETRONOME ETHERNET DRIVERS), devel@driverdev.osuosl.org (open list:STAGING SUBSYSTEM) Subject: [RFC net-next 03/13] net: dsa: Handle SWITCHDEV_PORT_ATTR_GET/SET Date: Fri, 1 Feb 2019 14:06:47 -0800 Message-Id: <20190201220657.30170-4-f.fainelli@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190201220657.30170-1-f.fainelli@gmail.com> References: <20190201220657.30170-1-f.fainelli@gmail.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Following patches will change the way we communicate getting or setting a port's attribute and use a blocking notifier to perform those tasks. Prepare DSA to support receiving notifier events targeting SWITCHDEV_PORT_ATTR_GET/SET and simply translate that into the existing dsa_slave_port_attr_{set,get} calls. Signed-off-by: Florian Fainelli --- net/dsa/slave.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/net/dsa/slave.c b/net/dsa/slave.c index 91de3a663226..bc7d5092a1c7 100644 --- a/net/dsa/slave.c +++ b/net/dsa/slave.c @@ -1549,6 +1549,27 @@ dsa_slave_switchdev_port_obj_event(unsigned long event, return notifier_from_errno(err); } +static int +dsa_slave_switchdev_port_attr_event(unsigned long event, + struct net_device *netdev, + struct switchdev_notifier_port_attr_info *port_attr_info) +{ + int err = -EOPNOTSUPP; + + switch (event) { + case SWITCHDEV_PORT_ATTR_SET: + err = dsa_slave_port_attr_set(netdev, port_attr_info->attr, + port_attr_info->trans); + break; + case SWITCHDEV_PORT_ATTR_GET: + err = dsa_slave_port_attr_get(netdev, port_attr_info->attr); + break; + } + + port_attr_info->handled = true; + return notifier_from_errno(err); +} + static int dsa_slave_switchdev_blocking_event(struct notifier_block *unused, unsigned long event, void *ptr) { @@ -1561,6 +1582,9 @@ static int dsa_slave_switchdev_blocking_event(struct notifier_block *unused, case SWITCHDEV_PORT_OBJ_ADD: /* fall through */ case SWITCHDEV_PORT_OBJ_DEL: return dsa_slave_switchdev_port_obj_event(event, dev, ptr); + case SWITCHDEV_PORT_ATTR_SET: /* fallthrough */ + case SWITCHDEV_PORT_ATTR_GET: + return dsa_slave_switchdev_port_attr_event(event, dev, ptr); } return NOTIFY_DONE; -- 2.17.1