Received: by 2002:ac0:8c9a:0:0:0:0:0 with SMTP id r26csp977154ima; Fri, 1 Feb 2019 14:09:58 -0800 (PST) X-Google-Smtp-Source: AHgI3Ib4SeTPjbbTkkijM4+WEiRpOctV8gjOTshiFOVcmJzKz/GiuatNXQ+uljp7LzE/Ww075u5Q X-Received: by 2002:a63:f615:: with SMTP id m21mr4074258pgh.428.1549058998868; Fri, 01 Feb 2019 14:09:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549058998; cv=none; d=google.com; s=arc-20160816; b=mfJc867TBprqerq3OWfaJ17MX3oBVWjz/qsMs0rmgdW2JmsC0C4coVFAa3sQarB/78 bEt8CYja9OnyANkB5JbLs44/D1wG/ZjG9yvxlt4c2xvkFem4MSa4lP7kLu5eH1I7Jssa pqybZb+co/kecrD+9wO9RGdlaWIl16Y6ccbl0hyi5IwzFaBquyfHe1cvGUeuynDZgvsv rib5JSqui/UlCHjKMeM99/Ytta88Oh6qfr2ndGt2/ZQBJlvS+SVodxJBOMKId4xlY/VY LA0DO8gltI8GgQt4d5LhIkUekAe+vA1xhLeSOuiWPgvH2chYXR1su2uKNIF9zBhSSHMr pXEA== 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=7WmijFqzuqz1KotgSCwjHOSZrSkpByjh6pj33/dW9ug=; b=yMRZtUxBoa1MPxqmst1WSaf+mUeYS6q/FKGFNbhUZHBESrL9cqdYHxNet4HtU/iM4H 9e0DgmW+Z+w56LpCm/nK2BqmSfPnJ99vMLVzZU2euTKfal7RWrAunRRj5YN1rW/MyYCz TKfnKTGN5/ezXHgGUu2ZD+l9hL9IIJuYU5S2YdpAqpjzx9/1W1Kiy1w40Q4Wrfq6tWej 26TpnIMPpcUz6XkpQiCTHHhBO9sOGzwUtHMkhUxeyBT5xO1vavB23XP9OHbAReQ380bY 2mrlqNCVPEt7Nc5bApv2IzkN4nPx1MCDPtO7gOJgBsOjuJK9lWhQroq9VIVlqCtx7Usx XqwA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=fhVihm7c; 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 d10si8643696pls.170.2019.02.01.14.09.43; Fri, 01 Feb 2019 14:09:58 -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=fhVihm7c; 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 S1727119AbfBAWIL (ORCPT + 99 others); Fri, 1 Feb 2019 17:08:11 -0500 Received: from mail-pl1-f194.google.com ([209.85.214.194]:43176 "EHLO mail-pl1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727068AbfBAWIK (ORCPT ); Fri, 1 Feb 2019 17:08:10 -0500 Received: by mail-pl1-f194.google.com with SMTP id gn14so3878801plb.10; Fri, 01 Feb 2019 14:08:10 -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=7WmijFqzuqz1KotgSCwjHOSZrSkpByjh6pj33/dW9ug=; b=fhVihm7cJ7mJIdfoZZqjirUZ/PmWZ0q9xHlFia/0EYWqZZzSXcfOHppUWIL380lfhM lQkhrkwWy8t7vpkSl39ti9X5YxbkVN6Wxq2mePHHpClph8a/iV6egW4PrGkjlsgcDUQe UjimpNZbvNo017806FzlHeIVdeMCqZXopiosWO9qgBLpR5TS3lZAZfRisCPwItuvw1Uq XG7F9hnud39qasi6KIT4m81pXOduo/tNMdV7Rc25SGFY/AG/agDABw/LnD8FKWj12evp ntkPf+gAwK1Ybw3PuOuIQ8hgCmm9Xo9dxNELc1kmJyJ39LQp+YSYphqP7r7y+nArnCoC 4JsA== 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=7WmijFqzuqz1KotgSCwjHOSZrSkpByjh6pj33/dW9ug=; b=sfoltEfNFG26TQjHNl64fzwDPBTCIfefm5935StMvZUKlryPHB0tYP3Das+Qr0UwaH HOFqnX0rcf1rQIyJf0oZeIWBzo3qfYaXxLjA5h5i9MQde+AiIVd/7najetlbCIeblFRU OY9SFMnrzOtsGaBnTyWn/kaATse0+TUEfWndYshnRi7k/FcMDNbI5ZD2m9SqCwUY+Vz4 kyu2IcOPq7HgzyjLriTocfODbT/8pnxiXq6RZ9cUetH9K813si5mjr7NlsChJi3NdoZr RkJomd8h6vzoYLKaICcOpwhdCMKpi47UG5Ko3BSIL6v0r8iAbpdeaTYyPe8eN+Rv/wft 71iw== X-Gm-Message-State: AJcUukeRbkXSL37XynPx20gQAUCBc5i+vTN9pML0eDjxr050DuSkduAh N6ckAB4Wem+0VWs1CVkBU7jNLgPN X-Received: by 2002:a17:902:6acc:: with SMTP id i12mr40371951plt.148.1549058889563; Fri, 01 Feb 2019 14:08:09 -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.07 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 01 Feb 2019 14:08:08 -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 04/13] mlxsw: spectrum_switchdev: Handle SWITCHDEV_PORT_ATTR_GET/SET Date: Fri, 1 Feb 2019 14:06:48 -0800 Message-Id: <20190201220657.30170-5-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 mlxsw to support receiving notifier events targeting SWITCHDEV_PORT_ATTR_GET/SET and simply translate that into the existing mlxsw_sp_port_attr_{set,get} calls. Signed-off-by: Florian Fainelli --- .../mellanox/mlxsw/spectrum_switchdev.c | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c index 0f4e68d31cc3..7c0df736587c 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c +++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c @@ -3442,6 +3442,26 @@ mlxsw_sp_switchdev_handle_vxlan_obj_del(struct net_device *vxlan_dev, } } +static int +mlxsw_sp_switchdev_port_attr_event(unsigned long event, struct net_device *dev, + struct switchdev_notifier_port_attr_info *port_attr_info) +{ + int err = -EOPNOTSUPP; + + switch (event) { + case SWITCHDEV_PORT_ATTR_SET: + err = mlxsw_sp_port_attr_set(dev, port_attr_info->attr, + port_attr_info->trans); + break; + case SWITCHDEV_PORT_ATTR_GET: + err = mlxsw_sp_port_attr_get(dev, port_attr_info->attr); + break; + } + + port_attr_info->handled = true; + return notifier_from_errno(err); +} + static int mlxsw_sp_switchdev_blocking_event(struct notifier_block *unused, unsigned long event, void *ptr) { @@ -3465,6 +3485,9 @@ static int mlxsw_sp_switchdev_blocking_event(struct notifier_block *unused, mlxsw_sp_port_dev_check, mlxsw_sp_port_obj_del); return notifier_from_errno(err); + case SWITCHDEV_PORT_ATTR_SET: + case SWITCHDEV_PORT_ATTR_GET: + return mlxsw_sp_switchdev_port_attr_event(event, dev, ptr); } return NOTIFY_DONE; -- 2.17.1