Received: by 2002:ac0:8c9a:0:0:0:0:0 with SMTP id r26csp977909ima; Fri, 1 Feb 2019 14:10:44 -0800 (PST) X-Google-Smtp-Source: AHgI3IaLnT5HCUu3IXoe4Tskc+D4IYK3kRgk42hSgZQ0FovmkKJ7JlnjC8kMO9tTa9OCLHDVwDF4 X-Received: by 2002:a62:8a57:: with SMTP id y84mr10161727pfd.197.1549059044776; Fri, 01 Feb 2019 14:10:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549059044; cv=none; d=google.com; s=arc-20160816; b=DL8vHnXTshjOvdI9PB7p0BvDebmBohUoL/mLpwHmm0gaaDS0zLKevwUOYN1b5n4znW x59/jHcLNcXaOlUnvyeISjwxmCx75wDGcRjK02S/8qNJnmGZugJmH+Lg0Nl91t2JVsWP QLhfZlH7P0GhqGdzIRDdYEmMrRvtJx6reEGmvzzPW7zIsdi67UBiDwcit8cftxsxnObW x/1UHt+XkcEzYzhgZQcnNK40hp38WiFkVxgPsCRXGoZ2t0qtTbmNE81niglQ9uSYeDHP k05N/EBLV5nesbFZtKMaxyFlX1krpqvfGnXGcI8xFZINukHtXaFV7EEzjDPnihiHXevW hh8Q== 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=tivljFOS893zZmUss1AVjf+i1kweQ2vQNLirRIESz1o=; b=0G6b4R2Dn4b0jkvQjypv5gAa3ne3q2/CDw7IjGq/8iGOHgqFdF1llroB1vQosdw081 uJbYpGUqkpYhvs5FOlI9hNdwy5gmdmDthr3PRBBwN7pLKJIr9aGzZaLEVP8t5oBEFKck x1vITRx0R0/VLfNLNjolwGa3xK+x6C0S/Is4S9BwmjY4Vu6q1226Gh2Ve43vsVE5N1Kg 4ANYtdwxLhwwxM/BtUcNobWRK33TenrAj1kfZYaYxMzzRpMVfF9UBmrpfweAuSryPzG8 iU8MhqovNfFZGElto1CFYZVwGutSpw5g1pxEMNX8XL4cKOBFFtzimQuJOn4XRywRdiRJ YeFw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="grqUg/Hu"; 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 4si4680232pff.161.2019.02.01.14.10.29; Fri, 01 Feb 2019 14:10: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="grqUg/Hu"; 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 S1727204AbfBAWIQ (ORCPT + 99 others); Fri, 1 Feb 2019 17:08:16 -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-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-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 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; -- 2.17.1