Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp3036263imj; Mon, 11 Feb 2019 12:42:13 -0800 (PST) X-Google-Smtp-Source: AHgI3IYQvFmA+ti/t7ccN2tv4Ciwkk4YfOa2Tt6d0VCZTPLViEtMfgr8H/aOyM3K063k3IV+XprI X-Received: by 2002:aa7:8182:: with SMTP id g2mr140693pfi.114.1549917733335; Mon, 11 Feb 2019 12:42:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549917733; cv=none; d=google.com; s=arc-20160816; b=BtlNjiWwcEPC7ZkU4xv7ifho9d/3nQIlFNOJmO0zFj7lhTvhAyYDev2ENiYtR3DOLF iJMJPk0aNREG/TGULlx15J/2kNCel2J6PLO659xMUV7c5YGb74GwmzfyzDb5YiS/xuOe N+j5U7G4xXsxjwPKYBHM47FJy3VP7D6If1L54/LN8duNYZvHlX/PjR0u9pTsLGuviS+n PjUxDTVyIhrZewZOwETaEdCQenrduEA90ieIe90kafvVvRJvvwaaxAqi2U6Br2FgjLS8 L8r3ioZ9nP6m74fD9/odzEGjDKWcJoCt4tsb82apE8N3jJ2aC7W9X43ijqSTa7swwbJu QnKg== 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=PtphDvmR0qKeN+UBu36HCt3kNK/VogT0oyGt8UI1w80=; b=IaksRYVjQZihTvCtmdPwg2CudExBPgr2MPbvJJWkkrVn/HVRKtmzh3/PwDeHAdCD7n N7iH1LGhLqIxORHwf9MBneVw6dEvmc39RTYjcv/6RMJh5PC9szXuXi40Z2jDqxobcgNU u5kkXdxhvfCsZueRB4so3n7APZALdDcSEW2P+LH5rOmgfhXJfvWphpn73KFMH8kRtXKq IA0OGb07k54Vt5NjIOJxd6aOxbF4TiiL5ary0T7HQO07byT4YqNLj/VtsmQhqKA6eVTp Ym+uXe7RRSEJPwpwO40vQcOxt4SyxPRQEVZFtLZ/DuE41Sr9IwO9XkSBxHbaTND3NHho GbIg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=spoQsBYL; 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 n24si10183637pgv.119.2019.02.11.12.41.57; Mon, 11 Feb 2019 12:42:13 -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=spoQsBYL; 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 S2387901AbfBKTK4 (ORCPT + 99 others); Mon, 11 Feb 2019 14:10:56 -0500 Received: from mail-pf1-f196.google.com ([209.85.210.196]:37967 "EHLO mail-pf1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732003AbfBKTKy (ORCPT ); Mon, 11 Feb 2019 14:10:54 -0500 Received: by mail-pf1-f196.google.com with SMTP id q1so3932pfi.5; Mon, 11 Feb 2019 11:10:54 -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=PtphDvmR0qKeN+UBu36HCt3kNK/VogT0oyGt8UI1w80=; b=spoQsBYLruAe2gNmZRBItcN0oBivyr230rVfYZef/4xvMbtFpvaXVMAExm23wgPjBb xaDR0Cds6Oir/q543dy+ipROwGpyQVbzhKEb0X0lGkd8anKb4DILSpbj3S/HtHO+1lyU 1tuX1SiZdXw/flJUVgymW2hj80PRENHW2afbomAb+h3o2chkqtxkxYGDd2BSa9mguiNg ApMUNKE5oMhNb9RUaCXvbLVZMCaufsMn2EUqgMVtbiFN0Pv6kAg/Yd4T0sNsM7it1rYx O4ARjF6WzumFJdLbv7WJhIeZCmd9pgntejakNtJyZcYU3BW8V6iIJ/OLz5SsvYmOU6ey bvdw== 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=PtphDvmR0qKeN+UBu36HCt3kNK/VogT0oyGt8UI1w80=; b=i+wnPWxv/e3Wu/pw1U4gcdMyuipq2GQdJkBk7/VVtM9O+Mu+iwZyUjXGE+qNtm1Qmo yQ+NlFAeT//eJsTEZNQqSFXYZe3QRU4kNy1xeTkphNr0KIevoGVj7hmMkbVSFeCD71w7 J8uWXX99oCgUbSLGXHnPhaU8SHJnYAnBHlU9FqAxAVOObX2YSPJT3IpOPSWvfQNbctkQ rBHfskgB6wB3Dl11tsQp1qWbtfvZXp9jLxWz4VTLamV+eQ07h6raW7HrnbMOTzK+5BFW EdNkJS68fq81fRRcdtN3xqfXB8wsUKsazirrYtkkMf2jHJB3E4RUKaXlX8Y9S9c4Ac5r 4wVA== X-Gm-Message-State: AHQUAuZSWlWFMX5a9Nn2c7demIz08sHgMlBY74P5S6KiHcIefcGkmYAl ioGFeJRicceaAp06Yi0tnzV9Fu+z X-Received: by 2002:a63:4e05:: with SMTP id c5mr3409661pgb.393.1549912253454; Mon, 11 Feb 2019 11:10:53 -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.48 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 11 Feb 2019 11:10:52 -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 6/9] staging: fsl-dpaa2: ethsw: Handle SWITCHDEV_PORT_ATTR_GET/SET Date: Mon, 11 Feb 2019 11:09:58 -0800 Message-Id: <20190211191001.8623-7-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 ethsw to support receiving notifier events targeting SWITCHDEV_PORT_ATTR_GET/SET and simply translate that into the existing swdev_port_attr_{set,get} calls. Acked-by: Jiri Pirko Signed-off-by: Florian Fainelli --- drivers/staging/fsl-dpaa2/ethsw/ethsw.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/drivers/staging/fsl-dpaa2/ethsw/ethsw.c b/drivers/staging/fsl-dpaa2/ethsw/ethsw.c index e559f4c25cf7..7c77fb43233e 100644 --- a/drivers/staging/fsl-dpaa2/ethsw/ethsw.c +++ b/drivers/staging/fsl-dpaa2/ethsw/ethsw.c @@ -1111,6 +1111,27 @@ ethsw_switchdev_port_obj_event(unsigned long event, struct net_device *netdev, return notifier_from_errno(err); } +static int +ethsw_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 = swdev_port_attr_set(netdev, port_attr_info->attr, + port_attr_info->trans); + break; + case SWITCHDEV_PORT_ATTR_GET: + err = swdev_port_attr_get(netdev, port_attr_info->attr); + break; + } + + port_attr_info->handled = true; + return notifier_from_errno(err); +} + static int port_switchdev_blocking_event(struct notifier_block *unused, unsigned long event, void *ptr) { @@ -1123,6 +1144,9 @@ static int port_switchdev_blocking_event(struct notifier_block *unused, case SWITCHDEV_PORT_OBJ_ADD: /* fall through */ case SWITCHDEV_PORT_OBJ_DEL: return ethsw_switchdev_port_obj_event(event, dev, ptr); + case SWITCHDEV_PORT_ATTR_SET: /* fall through */ + case SWITCHDEV_PORT_ATTR_GET: + return ethsw_switchdev_port_attr_event(event, dev, ptr); } return NOTIFY_DONE; -- 2.17.1