Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp3035160imj; Mon, 11 Feb 2019 12:40:56 -0800 (PST) X-Google-Smtp-Source: AHgI3Ibd7rPf1e0Ds4jglNKEp3rbeTvy3ZN05SGcO1ekBjlpP7I2PPS/fT9lEgrAkMNO4x4YRzcW X-Received: by 2002:a63:d904:: with SMTP id r4mr83121pgg.207.1549917656832; Mon, 11 Feb 2019 12:40:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549917656; cv=none; d=google.com; s=arc-20160816; b=jSsXKqgRfZmw3XoFxwz/rBHuGvu0cUawjEUeJK3jQ+uFuhGx1tvrWsgsp358lUSpn9 iwiA1+dHVKp5S/McxqQT2OU+c681/4d0OHMWXKJyoJdhPw9AZFc29IprgUlMfrlmCFIb 5dPW6CSrWZEIpC2h3IsvkMCDBkp2VTlskHOh4rEDPecUm0nfgME9jCkGTVIokG/2jTW/ BjaHohax75yhH0aMMD69I3Ge2G1QlpBQlrYjqQk84PMDSdvUDaEsqJRCmkwuLU4jGmxo ellME6A1sgpQgRCBq5vUWY751kHHOd4wIiJiK8GSrc3dOqXKW8LmW74D4rQRvrG6l2qj pKGw== 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=KF6AlsLZoN04sGHp2NFAD11lVXn/Fy4kJgdzP9H47YA=; b=QGBeA6MlBff9WNSrsrAra6Qe5XKrf8mL8MJSwURMAEoHgl5O5DRaM6iuiB8vagB+km NnMQErErwnyf/Yn/157yjmdnVNb9m15a8Gr0voycEiCJ5wAKANUeTjVyOOpao2hbfYrm OCnwfgVIyj0R6/ZKyQEqpSzFsWEnniHI5Rm33w1tDyXvTVq5pTcTXbsUn4bLORkVUf83 25Jm7rBrz6B3eHOkxya8CryZJIZkr3rXTO1YEYfHxLgHWkNFxoLR+DfdzUXnUNQRvKgS e1IbFyTD69W5CHTvggMaBUyI8zge1UEc++TxFIzFf0KZpGJ1/ukg771Qb6SDv4O+Clfy aPfw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=uVqy4Nkv; 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 n20si1811780pgb.195.2019.02.11.12.40.40; Mon, 11 Feb 2019 12:40:56 -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=uVqy4Nkv; 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 S2387828AbfBKTKq (ORCPT + 99 others); Mon, 11 Feb 2019 14:10:46 -0500 Received: from mail-pl1-f193.google.com ([209.85.214.193]:44828 "EHLO mail-pl1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732529AbfBKTKp (ORCPT ); Mon, 11 Feb 2019 14:10:45 -0500 Received: by mail-pl1-f193.google.com with SMTP id p4so5720220plq.11; Mon, 11 Feb 2019 11:10:44 -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=KF6AlsLZoN04sGHp2NFAD11lVXn/Fy4kJgdzP9H47YA=; b=uVqy4Nkvmt3Zd+BDUCRaRjJyPd3UW3yj9gXDuzghFhNImFuBE6egjrdFsKy87mlK2F kwpYWQM++R81qfhI/4V0qq5Pa3YbZduQr6WQE8dm5pCfTwetPj6a+hhUNqsfukLjC1pQ u7/V8AsYn4VxnD8BsnzWjP8C9bfH8Tm+JsIAnsIHpMkPcpGhsgrcFhFCd98Udov6Gm9Q EHkcWRRe0Chx0ZUsujD+UkWORgMJmzIHRWLgMdRAvzgsbTW4vWSOm/Cbk2wohPIU9NAr hIssQAGhcSEAsZ6rL39eVeiwGuKUIV6ELb6cJuHKQnKENVqiNZspJhEPKPkg6Nhf2/V7 tjSg== 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=KF6AlsLZoN04sGHp2NFAD11lVXn/Fy4kJgdzP9H47YA=; b=KKsyVnJ7ehbhc59IPZv8z6/PTDtobylStRnUuOc0QGe457TARipfNkrsk2jrxrO5WC /jMcGY7jaPbLLSt5drRLm2zMZu5OBQdAPle78pv7PwGaeuUTKdkr6mJeJsWX6FN16Jwx 5iVx+GH6fZQ3Esz318rbVsPF/vdUE7XWgPWYxjeDZYNCo43mHuYi1XEtAYtvfb7L3pDZ PpGnp+Q2EdhA8fP6aTQeNpxOqnOYTUtfI/VRPE37pATZnmlNPwtB+vrQgoCPURfv/PYM Hpzo8ZysLNJJXO19uvKOtZjwoFikq8ROiWV2PpIw69+kFEovuAqzqKKmQpBY6BrI7VrO 0icQ== X-Gm-Message-State: AHQUAuYgijZfF2U7Y6wccSwgEEwaQ7OoOregH6HzyEumLtolLMqOoQSM oG4zpQtSJ28g9z7M4tv/AJknrrfn X-Received: by 2002:a17:902:bd0b:: with SMTP id p11mr39081096pls.259.1549912243989; Mon, 11 Feb 2019 11:10:43 -0800 (PST) Received: from fainelli-desktop.igp.broadcom.net ([192.19.223.250]) by smtp.gmail.com with ESMTPSA id i24sm2167206pgg.14.2019.02.11.11.10.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 11 Feb 2019 11:10:43 -0800 (PST) From: Florian Fainelli To: netdev@vger.kernel.org Cc: Florian Fainelli , "David S. Miller" , Ido Schimmel , linux-kernel@vger.kernel.org (open list), devel@driverdev.osuosl.org (open list:STAGING SUBSYSTEM), bridge@lists.linux-foundation.org (moderated list:ETHERNET BRIDGE), jiri@mellanox.com, andrew@lunn.ch, vivien.didelot@gmail.com Subject: [PATCH net-next v4 4/9] mlxsw: spectrum_switchdev: Handle SWITCHDEV_PORT_ATTR_GET/SET Date: Mon, 11 Feb 2019 11:09:56 -0800 Message-Id: <20190211191001.8623-5-f.fainelli@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190211191001.8623-1-f.fainelli@gmail.com> References: <20190211191001.8623-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. Acked-by: Jiri Pirko 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 95e37de3e48f..88d4994309a7 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c +++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c @@ -3443,6 +3443,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) { @@ -3466,6 +3486,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: /* fall through */ + case SWITCHDEV_PORT_ATTR_GET: + return mlxsw_sp_switchdev_port_attr_event(event, dev, ptr); } return NOTIFY_DONE; -- 2.17.1