Received: by 2002:ac0:8c9a:0:0:0:0:0 with SMTP id r26csp979000ima; Fri, 1 Feb 2019 14:11:44 -0800 (PST) X-Google-Smtp-Source: AHgI3IZB4AJFR25+N8jCvUISt3qhXcbQlObEvO5BnpjzVr/tMH5z8GVB8feCUjIap7+CARKPAciN X-Received: by 2002:a65:40ca:: with SMTP id u10mr2823487pgp.321.1549059104565; Fri, 01 Feb 2019 14:11:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549059104; cv=none; d=google.com; s=arc-20160816; b=YxUg63O42ueHzzjGiXRTa7KkZxgo87w4SPdS/bMZgIUpoTNioZwjuKWc9GnFrHsYmC k640k32UT0S36a7JCXmzyk+Cj5xgNebWk85liIu0g8L9fuxNOYbLrZ6+3dh7tMsfTbEW b+O7/bfziLR5s3ZIvxrk0QAHV8Cp4SL0oHpMYnE+zl7eI6cfH8wtl9OYhzG8Evm1dc8N 74UHXUbCK7JaBtIupZhQE1iOYDgBOI2/pqPEypvM3HwKZySEQWPA8Mf9AK3LTBJS0AhZ d6H1zgDj2iEPS6QqmhYMSOuFeRFjBX5Q694qqGP3Vgc80k1EPBAbZ+cgGgykiwjIElBh 9IZQ== 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=EdvrqqPZG0RgbxnptDAB2xEG3F6tOGq5U35WAFrinLM=; b=jcPJ1A/y9JJBN80esJq54vvdymJWGjdkUVaXpaJTbLTWvjo49SG6lg+r3NPy6EM4zY rnj6k6fxYvEExbS33KWi+8xhYFNYkuWuP7NKRlH27OnnPs6rLjX3capsbRHTStzep72A dIvzA0E7CYH2XKKPQNzA4djIIrO80LVIWg23OcM0RM7mF/Oy4dVtC7M5kFFDOSjrTB25 XOKtzFy0XQP/FWL921I4yrL0NuvEbTIbf7qsfIUBHDhthfllL8WeUj6YNHbYguzMYgrc +btKpHE53KOzC18GfKLNgYpywrDbEp9dGiY3oYbmM/duAAQLjRzXFnLScgjFSrPkPbxz wK1Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=NMwusL59; 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 c12si8260261pgh.257.2019.02.01.14.11.29; Fri, 01 Feb 2019 14:11:44 -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=NMwusL59; 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 S1727266AbfBAWIR (ORCPT + 99 others); Fri, 1 Feb 2019 17:08:17 -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-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-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 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; -- 2.17.1