From patchwork Fri Feb 1 22:06:50 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Fainelli X-Patchwork-Id: 10793807 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E298C922 for ; Fri, 1 Feb 2019 22:09:53 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D423432E9E for ; Fri, 1 Feb 2019 22:09:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C6C8B32F11; Fri, 1 Feb 2019 22:09:53 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6B39A32E9E for ; Fri, 1 Feb 2019 22:09:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727192AbfBAWIQ (ORCPT ); Fri, 1 Feb 2019 17:08:16 -0500 Received: from mail-pl1-f196.google.com ([209.85.214.196]:45126 "EHLO mail-pl1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727172AbfBAWIQ (ORCPT ); Fri, 1 Feb 2019 17:08:16 -0500 Received: by mail-pl1-f196.google.com with SMTP id a14so3868221plm.12; Fri, 01 Feb 2019 14:08:15 -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=EdvrqqPZG0RgbxnptDAB2xEG3F6tOGq5U35WAFrinLM=; b=NMwusL59e8LfyNukpg+9B8SRXJf4O3Z+ARaXPyWpHixRDIn6Im0+RieGNy9wP0WZoK sL8azsQ3duXP//83E1I5Y1VrzWsy+xR+PMHLa9yKVIFiIHpe8zTtiOM3GH2ProZalQAI QynYityGiwK8mqEZ/ahD+ubU4pvdXa9miaDtcKB32gk5sG8OmjVjGDRsObtC4d0Bi764 hBAAKgxonZB+PdEhbxYqaiIM0idvesPTM+RTIxnb8D+2Rbn5A98g309F0U528uwkRq5g AFG6/jxCABwT9uW7gBNA2FX21v/G6siMomGj8oYeY+4Hx5W7dywBcY02kusA8gKHlNbF Fwvg== 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=EdvrqqPZG0RgbxnptDAB2xEG3F6tOGq5U35WAFrinLM=; b=R2npwtq5M1LszeKEFJpaoKFgU+IbhdalMSndz4EVlumwl9oeqX16OX3tXmvbCWEiZ+ rkoxemGSuisEaEoLg0xu/7NsKrtj+QuxjnKrlwlSOwqL+am80vVGUqRaBlYI+SuOXf4O TYBEMR4xubm6I99KI3OXEACQL+E0KMhof74F7uFBN7nxDCTw/wV3B0bruCx0KGfUdVgJ Eul0xndzi5ukSk1+41zZAWNQNcunUVD6sVhzLcjzb46rERyThLSh+3971+4Uaubd0tlS VNGmKTJt7LMWFQRWBefi62JYBRHIRMH8z2kxDEFiwRA0b5I3rbkqZX8vhmhF8d+yCw3F oGxw== X-Gm-Message-State: AJcUukdaS9Iuv4aT0nv0mE9kytgWtnYUeUXm9FW6BBl62PBTIa4+TQGm NYF0S2udKsmad3LR0xk4Ma6OulZz X-Google-Smtp-Source: ALg8bN5Lh0tscJjEvu47XQxN0Ee13nVs9I7Tt/Dfb5i80Oxe4NkraPsbHXWoLKSvbwb4fTUQ1zC5xg== X-Received: by 2002:a17:902:848f:: with SMTP id c15mr34045596plo.119.1549058894650; Fri, 01 Feb 2019 14:08:14 -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.12 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 01 Feb 2019 14:08:13 -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 06/13] staging: fsl-dpaa2: ethsw: Handle SWITCHDEV_PORT_ATTR_GET/SET Date: Fri, 1 Feb 2019 14:06:50 -0800 Message-Id: <20190201220657.30170-7-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-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 ethsw to support receiving notifier events targeting SWITCHDEV_PORT_ATTR_GET/SET and simply translate that into the existing swdev_port_attr_{set,get} calls. Signed-off-by: Florian Fainelli --- drivers/staging/fsl-dpaa2/ethsw/ethsw.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/drivers/staging/fsl-dpaa2/ethsw/ethsw.c b/drivers/staging/fsl-dpaa2/ethsw/ethsw.c index daabaceeea52..b18e112d84e6 100644 --- a/drivers/staging/fsl-dpaa2/ethsw/ethsw.c +++ b/drivers/staging/fsl-dpaa2/ethsw/ethsw.c @@ -1103,6 +1103,27 @@ ethsw_switchdev_port_obj_event(unsigned long event, struct net_device *netdev, return notifier_from_errno(err); } +static int +ethsw_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 = swdev_port_attr_set(netdev, port_attr_info->attr, + port_attr_info->trans); + break; + case SWITCHDEV_PORT_ATTR_GET: + err = swdev_port_attr_get(netdev, port_attr_info->attr); + break; + } + + port_attr_info->handled = true; + return notifier_from_errno(err); +} + static int port_switchdev_blocking_event(struct notifier_block *unused, unsigned long event, void *ptr) { @@ -1115,6 +1136,9 @@ static int port_switchdev_blocking_event(struct notifier_block *unused, case SWITCHDEV_PORT_OBJ_ADD: /* fall through */ case SWITCHDEV_PORT_OBJ_DEL: return ethsw_switchdev_port_obj_event(event, dev, ptr); + case SWITCHDEV_PORT_ATTR_SET: + case SWITCHDEV_PORT_ATTR_GET: + return ethsw_switchdev_port_attr_event(event, dev, ptr); } return NOTIFY_DONE;