Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp3035203imj; Mon, 11 Feb 2019 12:41:00 -0800 (PST) X-Google-Smtp-Source: AHgI3Ia+ZzTfQhtJMIsoZRMhWNO+nz3k1i/EsJ1Eezw+Sukkv/HiNzSVewE2He4dKMM212x/7N5j X-Received: by 2002:a63:5359:: with SMTP id t25mr85182pgl.99.1549917660803; Mon, 11 Feb 2019 12:41:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549917660; cv=none; d=google.com; s=arc-20160816; b=L97FUC1pTertiyDR/57WnEGMszl9H9m4VIUNflKd7rtAt3t1szUSqqBT3RI8lpoSWa tT6xyd135E+WHqnrrCeP1Uf84nv8OaxEMOlZ42SrBk2lGqH9XKh7s4IQ54oDyzwOs4/e CfW1BGD8XLcK7Cz2mt+jOcF90O6/edFWLwDaO1B46F1wsVye4SKMVHI5EFj8rAtnMiy0 nrOHeRDFIVx7e8TBVh4xKFyleiJjPQzY3jKxaRTxpIdQiJuPOyJ9ZLVLDurfq3mEiGot AInMXiyBJCCpyWPrcqw1bJP7NQZZurDOz4rIbTXxVEP8k3dEpaTgWMpXzmqmj+gihxBq XyNA== 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=QPgFt5j6UGQb+YmlyjgIvSlCGoFlyBm2NR9++YJ/iss=; b=zbx8iSkMdYMp0dDNmI4zJLd93aaJaOCPOoDo/gscnhYVOIjNy2T2g2fw6p24Yvi12u RTUuZSdS6jTAtYRfgPdU+RVb7G3GxhE2m7LSsQbJPY1ntUTUux39jlQoJRK1d1+4qEiR /9wrrlr7Xyo6zHGgHI+8YFr6Z7xTcPrDCR081auQXGCv3xoJoBTJzfxoTZKXrJ0Jl2eJ xQO+gWPy494bQpOOqOlfZjPtW9GbA850Ytnbq76tP29AkF2dzvqOwHJhcoAljpPW/Tt6 NeJf6rPl3mre1qjpaxjIFolZerwAnBrvKl6Sh2UQxnDmL41E4fa0wKO3MgOmFjQQbs0f frSQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=t8yCDwGf; 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 n7si10858079plk.18.2019.02.11.12.40.45; Mon, 11 Feb 2019 12:41:00 -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=t8yCDwGf; 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 S2387930AbfBKTLB (ORCPT + 99 others); Mon, 11 Feb 2019 14:11:01 -0500 Received: from mail-pf1-f193.google.com ([209.85.210.193]:34252 "EHLO mail-pf1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732003AbfBKTK7 (ORCPT ); Mon, 11 Feb 2019 14:10:59 -0500 Received: by mail-pf1-f193.google.com with SMTP id j18so15229pfe.1; Mon, 11 Feb 2019 11:10:58 -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=QPgFt5j6UGQb+YmlyjgIvSlCGoFlyBm2NR9++YJ/iss=; b=t8yCDwGfisKuIVMD1tXN+vqj45cMlPM2XmC78pl355j/537+oBFV3mapZqnNmlg+k0 NoQUOCWfKGYPJch0bYxXfo+Hz5T3OVDjUs2iddTX7edc76wz/hicWpluIMn6uawBRSak EQuAcpqirdfhYdYb5oNPA/UGHWlEtp0DJbdMuI7v2K7uQTMWoB+Sm68latHf5turkcFg lc8i5Bkaa53IUazdHwY0vsMTqr7bnj8xGVtnwfC9OTtL50ilvBaudJ+Xg8gTKarKtGT1 eota6GzH3QYlXbdcpLi1M3zZSKNX0Cy/s6jJG7HWiTgQMnJ2/IcOaV8SjvnTUu0zE2tY WdGA== 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=QPgFt5j6UGQb+YmlyjgIvSlCGoFlyBm2NR9++YJ/iss=; b=Hm3hVUasBDawC8Et+HGCyRpDEQN0gE2pgDmOmAffef1Vt5IJapKxZvGlHLikvxQDkD rNeVMhVuaiE+TFCk1U3KTB9E4cnNEmBPJjcm9ECTWYT55YU63JG7RXO0ul+5DdWueKrO 8irZJ84Wnt4k8zNBZ5qETNUrGTQ9DQ6jKTG+FtoaRbELb4uqrUGa9AC+ftzcuH1aIvGI 2cgmOSKQbx3jEaOxJuEbUuwr+RSx6I1I5g46EH9SzjJ4ryGSWTIBN1xGwma4kqj/UPc2 JdhjYtMGzf8sB7arFqtPqefoackst8S5trlX2eUmSgxIHXwY5NYBwgcZ/kKJXLXBPyAP cz5A== X-Gm-Message-State: AHQUAualiViVChEvR+bICYj8l1NltrwQG+a6wKZ6qpzvzkLQxgPMz6lP +FPHx4+pUS7FB6nF0QUBqFMpkfGF X-Received: by 2002:a62:6e07:: with SMTP id j7mr39117095pfc.135.1549912258113; Mon, 11 Feb 2019 11:10:58 -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.53 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 11 Feb 2019 11:10:57 -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 7/9] net: dsa: Handle SWITCHDEV_PORT_ATTR_GET/SET Date: Mon, 11 Feb 2019 11:09:59 -0800 Message-Id: <20190211191001.8623-8-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 DSA to support receiving notifier events targeting SWITCHDEV_PORT_ATTR_GET/SET and simply translate that into the existing dsa_slave_port_attr_{set,get} calls. Acked-by: Jiri Pirko Signed-off-by: Florian Fainelli --- net/dsa/slave.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/net/dsa/slave.c b/net/dsa/slave.c index 2e5e7c04821b..66c6c353f4f7 100644 --- a/net/dsa/slave.c +++ b/net/dsa/slave.c @@ -1558,6 +1558,27 @@ dsa_slave_switchdev_port_obj_event(unsigned long event, return notifier_from_errno(err); } +static int +dsa_slave_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 = dsa_slave_port_attr_set(netdev, port_attr_info->attr, + port_attr_info->trans); + break; + case SWITCHDEV_PORT_ATTR_GET: + err = dsa_slave_port_attr_get(netdev, port_attr_info->attr); + break; + } + + port_attr_info->handled = true; + return notifier_from_errno(err); +} + static int dsa_slave_switchdev_blocking_event(struct notifier_block *unused, unsigned long event, void *ptr) { @@ -1570,6 +1591,9 @@ static int dsa_slave_switchdev_blocking_event(struct notifier_block *unused, case SWITCHDEV_PORT_OBJ_ADD: /* fall through */ case SWITCHDEV_PORT_OBJ_DEL: return dsa_slave_switchdev_port_obj_event(event, dev, ptr); + case SWITCHDEV_PORT_ATTR_SET: /* fall through */ + case SWITCHDEV_PORT_ATTR_GET: + return dsa_slave_switchdev_port_attr_event(event, dev, ptr); } return NOTIFY_DONE; -- 2.17.1