From patchwork Fri Feb 1 22:06:49 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Fainelli X-Patchwork-Id: 10793809 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 5EBB6184E for ; Fri, 1 Feb 2019 22:09:57 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4FE7F32F11 for ; Fri, 1 Feb 2019 22:09:57 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3E23832ED9; Fri, 1 Feb 2019 22:09:57 +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 D502D32ED9 for ; Fri, 1 Feb 2019 22:09:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727165AbfBAWIP (ORCPT ); Fri, 1 Feb 2019 17:08:15 -0500 Received: from mail-pg1-f193.google.com ([209.85.215.193]:37420 "EHLO mail-pg1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727068AbfBAWIO (ORCPT ); Fri, 1 Feb 2019 17:08:14 -0500 Received: by mail-pg1-f193.google.com with SMTP id c25so3567493pgb.4; Fri, 01 Feb 2019 14:08:12 -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=tivljFOS893zZmUss1AVjf+i1kweQ2vQNLirRIESz1o=; b=grqUg/HuLwUO9b1Sjll2jaggLwu4Jh8KL9FlDzkr5JkdKC/QbEayWQQgTiOPC8Mrwo vlOlOLsxCHMlsNxfOfB6KWHsvFv6dzqvrN7nB59vdK0ixcmsfozpMuOZJ7zYM5Kd7a9M cZUKWtLQ/V9TnKBZctnE29cvSpFueo7IYMmltfDAD7iD1yHc/zLrHMvCPpVuY8DNbaza ifYcYOXo79jhtvLK+VpPaNaztdfZKGZC34MROPbx/FA32PeJoPGS7Hh9/RxYNKUWjWgj O6BY4AfCDvZXudJdX1Foj6/BIOeZQMGAXOHQdK0txUjZxWBeydhkmPKMaWKBY3rWZKfr h2ZA== 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=tivljFOS893zZmUss1AVjf+i1kweQ2vQNLirRIESz1o=; b=IBiMRxsHUJ08Ner+QggH9yamZnmJVWvV4DeDRzl84zjpllimGPRyIHtFSM+p5PwIYn pZ9rkME3vOt4hqZ15BcZxVWTOAk9609/BnQ7bmPLYuMrfbPsIgW+GDc9MefFo6R2+RMP t6MgLolISpHfWuxthoVNLrJx/I+CFgFn2mrEcd+43fQNaRUVYRe5iVfn5Bkbm2rFXtch /PXZhkgBHe/p/NTgVZ9+OYk49Wm4ruKwlVRYt2iAYY3oAbHnIiwPbEH4ke3ok9VfaJRu DmR7WW3h/++MldYXzGUBIHgZDHb5DIiSU2isTlp1OS1+OkvuutZlkNrzSjq1hrOo5i09 w5cA== X-Gm-Message-State: AHQUAubCE2dhT9FHZgwZo4nesGpVRbpJbIv229gTCop+8RTgd9eqnAIJ wk+vf/nTKu7uZlQYBHJt0oEwb7AH X-Google-Smtp-Source: AHgI3IbR9i5uG9whlGG/K7jeaJuS+eNly5PVbFi97tkN8wsH7NnnJg+fW6pHwQwFWOht72h4fi/VmA== X-Received: by 2002:a65:49c9:: with SMTP id t9mr3843831pgs.184.1549058892085; Fri, 01 Feb 2019 14:08:12 -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.09 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 01 Feb 2019 14:08:11 -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 05/13] net: mscc: ocelot: Handle SWITCHDEV_PORT_ATTR_GET/SET Date: Fri, 1 Feb 2019 14:06:49 -0800 Message-Id: <20190201220657.30170-6-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 ocelot to support receiving notifier events targeting SWITCHDEV_PORT_ATTR_GET/SET and simply translate that into the existing ocelot_port_attr_{set,get} calls. Signed-off-by: Florian Fainelli --- drivers/net/ethernet/mscc/ocelot.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/drivers/net/ethernet/mscc/ocelot.c b/drivers/net/ethernet/mscc/ocelot.c index c6a575eb0ff5..8043347a1ed4 100644 --- a/drivers/net/ethernet/mscc/ocelot.c +++ b/drivers/net/ethernet/mscc/ocelot.c @@ -1589,6 +1589,27 @@ struct notifier_block ocelot_netdevice_nb __read_mostly = { }; EXPORT_SYMBOL(ocelot_netdevice_nb); +static int +ocelot_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 = ocelot_port_attr_set(netdev, port_attr_info->attr, + port_attr_info->trans); + break; + case SWITCHDEV_PORT_ATTR_GET: + err = ocelot_port_attr_get(netdev, port_attr_info->attr); + break; + } + + port_attr_info->handled = true; + return notifier_from_errno(err); +} + static int ocelot_switchdev_blocking_event(struct notifier_block *unused, unsigned long event, void *ptr) { @@ -1607,6 +1628,9 @@ static int ocelot_switchdev_blocking_event(struct notifier_block *unused, ocelot_netdevice_dev_check, ocelot_port_obj_del); return notifier_from_errno(err); + case SWITCHDEV_PORT_ATTR_SET: + case SWITCHDEV_PORT_ATTR_GET: + return ocelot_switchdev_port_attr_event(event, dev, ptr); } return NOTIFY_DONE;