Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp3036203imj; Mon, 11 Feb 2019 12:42:09 -0800 (PST) X-Google-Smtp-Source: AHgI3IZkuminX0LG1h93m1Bc3rXT4/ECyB1G7ehVxisegJv7+wiphyjuhpV0YGBtkV1TWViASnA7 X-Received: by 2002:a62:c42:: with SMTP id u63mr104489pfi.73.1549917728991; Mon, 11 Feb 2019 12:42:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549917728; cv=none; d=google.com; s=arc-20160816; b=OYjQTpRulUoCTCf2F2bmRN+jmVz+t1dki/80zdIWqKnHVd03QENDvUIPzszzafhHrk RB+COw803FHpfLkwjJxyi/JTmvCVvhXsyhK4luKXVHMS7abnw2BvAB7VjHmTLVlEJFoI Zfch3bXiYxifyVDBGTK0JCtNHucrnQilWFWFO1Pa7HUoO59K+ZpzilT4F0jKLh1WPp24 q/smQoIITE/fQbY78PISQpEfLXvKp2FuHcZ52qgZDSQZMNS7n11ViUJAHS1E6i2JtPQK LHcTQnE4vCFGG8Y80sBfO3yFvddI4EAYTvf3pqjfbEwNCJbaiq0o47sotj2pNSjAKsIG oWVA== 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=gHKxFom+TS/uF5v75rmvzWOuknaksPpVihcsZQowL1A=; b=Ag7aQOMyshlUeAAH6+m+QL4+OtENfddwgZ16v5IH/6t6PeuYIyM3/Qtgoac2ogrcie n1+Bqrm7wQ2Ed0i7Ip1B5GGeEN6+N5NHXxM8/gdyLYRHye4oAlNe3FH2+22UvhncCLHN 8EnCwRrT2SzAtaUG1a61GCZF6274Mu/c2Z98GMzIAg5RzAw7ITJ/cX7JO505EGTbaFQX uTdPmlnOnPHo0rMKpLj08YmxuG+CQkYb/DyQbur7PEHl0oZNUQi2MfNYpgMKv/XmK6l0 ZWi8r8U/jIA/rNoT6tcdntIyvDU9OMp9Bz/SDWgSNhFnzUNW7U2SEpkGjKTK9yvuIPza xVyw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=MVlbH4dz; 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 d5si7255719pfe.79.2019.02.11.12.41.53; Mon, 11 Feb 2019 12:42:08 -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=MVlbH4dz; 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 S2387869AbfBKTKu (ORCPT + 99 others); Mon, 11 Feb 2019 14:10:50 -0500 Received: from mail-pl1-f196.google.com ([209.85.214.196]:42422 "EHLO mail-pl1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387839AbfBKTKt (ORCPT ); Mon, 11 Feb 2019 14:10:49 -0500 Received: by mail-pl1-f196.google.com with SMTP id s1so5721539plp.9; Mon, 11 Feb 2019 11:10:49 -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=gHKxFom+TS/uF5v75rmvzWOuknaksPpVihcsZQowL1A=; b=MVlbH4dzntI3IR9RVcIK2FK8xRxzeOeNb27b9kw5jLskOwT1wRIwWxZRbtILQhYpJW ANUTedMB3lzTaedxha+8Yeh/5jB8x5sRGrS15zyaUzv/2vXgLajWhJw2CG/5hOCv33jv DfPe4aBGANyQubzxw2DNkITnX/a9ezGDmDRFfG9JAj21wkM8zI7vS6XvPlGbwMKLOaL2 dsvLtiZSUaFmPVT3gzZllCliRN6ptrgNR1M+MQMXHjnkHAInZLuj9FRNBB8DL5RQ39Zj w8RSbGA15xJoCRXcfBaTJ2ogmtA/m9d9Ad0m8LN635J5Pb2ekspQec6ORBQJRUaQWhiu FqVg== 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=gHKxFom+TS/uF5v75rmvzWOuknaksPpVihcsZQowL1A=; b=pLo5q2dNn5uMmHtxbaaPNgKSYnyKmE64rlvgQf7RVFCdIw8wR4H8lKUiHO6oP3e7j6 k3eUjdobcWa7LlkzA/isw2ybTWoG3bknO0O5AmUETkhgN3hl9kaMRSsqYsEJY0jsuJt8 54dUQA4yXCerHnAdrL9bbKxqdAkRkzh8UB8wInQ0wwt4NiesY/wdv/PXrjom0aQFCGDs mc3/NZIAZuR/jzhANsLQwXzr0a4XGyKNdDw036O0ir7pIL51ZvaT6/UEWIO6Dp97M2gs pu24fINQ2qJDeaeDHxpX4zt6C/MD1Cy0MXzHsvzUIgpf9jxFrk3GHYnWTRwpy0a/eG6v 8CXA== X-Gm-Message-State: AHQUAuYUI/6+LmljJxVKm1LMj9GtLxCZXOF49bLckRcq33NTqfg23oUG oDmNBQRH5yG4RPjUJ/AaZcrjSHBd X-Received: by 2002:a17:902:6a4:: with SMTP id 33mr38282056plh.99.1549912248637; Mon, 11 Feb 2019 11:10:48 -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.44 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 11 Feb 2019 11:10:47 -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 5/9] net: mscc: ocelot: Handle SWITCHDEV_PORT_ATTR_GET/SET Date: Mon, 11 Feb 2019 11:09:57 -0800 Message-Id: <20190211191001.8623-6-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 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. Acked-by: Jiri Pirko Signed-off-by: Florian Fainelli --- drivers/net/ethernet/mscc/ocelot.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/drivers/net/ethernet/mscc/ocelot.c b/drivers/net/ethernet/mscc/ocelot.c index 195306d05bcd..2708809713ed 100644 --- a/drivers/net/ethernet/mscc/ocelot.c +++ b/drivers/net/ethernet/mscc/ocelot.c @@ -1582,6 +1582,24 @@ 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; + } + + 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) { @@ -1600,6 +1618,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: /* fall through */ + case SWITCHDEV_PORT_ATTR_GET: + return ocelot_switchdev_port_attr_event(event, dev, ptr); } return NOTIFY_DONE; -- 2.17.1