Received: by 2002:ac0:8845:0:0:0:0:0 with SMTP id g63csp1235420img; Tue, 26 Feb 2019 17:15:37 -0800 (PST) X-Google-Smtp-Source: AHgI3IasuLKkC4latoSFHXsKQGLF8vpg3x7ZLQgWzVPN2j31DLctF62gyfOtXovvoxhLjx2G2WRR X-Received: by 2002:a65:6215:: with SMTP id d21mr325120pgv.289.1551230137273; Tue, 26 Feb 2019 17:15:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551230137; cv=none; d=google.com; s=arc-20160816; b=d7lI5BX+m0dCwo8l/Fw3KvJ5ucPAasqvGfNRse8e0JSbI5zzANJx1SZy8MIzbHfAuN O6H8s4RqXG5qsolR0L0BQsGRuzarHXouAkp0MzLUFzDoYAVLplbIlrn7xOcb6wGo4E0d hGutQVMPohAsCEAHn3BAbQs+2gxgb91+YHAAH7JgmGjWYsBaimDtOx8M2EN+2K48xP7O +TIB+fP5SetWGFYkNnzZmNk92HuX6BgyL6AiSbFvem8nqqiwCQKbgsheY1e15dHtbyEs i9zspCuBY/krAHJSyH1n+/QFoMQD3Th1AaycvSYh2u9o3eMxOwaMzoMqQ2dPLGKtA4H6 +vhw== 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=3n08U17XQLLrwYLiDWOdzsQAwXWMIAMlVMMr8OAosZo=; b=QpfGHmfQ3mRi89/YRxBHKz0fzoLQp8tI7FKiHQSxZArNpwA/D/AJ/L6SPlKtND09fr 0d9psgYQdCrHQOlnyfc4qoFRgiVslwHjvUOCJvlXrK4rAVJ2V1PlX5UiqiFjd53CQ5Hn UrY6SrysXVSJY+DwWeUYEOtSbTgpHQZpvJtGuMquIYC02o4FJ3NCiK3K/TB6TCYOLLYx ej+gZBCn0AqlfV6ALf44TAHuRlcbe3gIcG/6SI7Le/fpXQTwZ2M/6Dq81aGoIytw/cO2 b/VZyTbKibDwFkQzHJBxGmZvGGB1jNUNsv4F7aU8PVzzRzf202Y+DaTNPyVO0wAN9q70 vIjg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Kq+GvGKF; 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 x33si13890728pga.130.2019.02.26.17.15.22; Tue, 26 Feb 2019 17:15:37 -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=Kq+GvGKF; 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 S1729595AbfB0BOs (ORCPT + 99 others); Tue, 26 Feb 2019 20:14:48 -0500 Received: from mail-pl1-f195.google.com ([209.85.214.195]:45931 "EHLO mail-pl1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727998AbfB0BOq (ORCPT ); Tue, 26 Feb 2019 20:14:46 -0500 Received: by mail-pl1-f195.google.com with SMTP id r14so7097611pls.12; Tue, 26 Feb 2019 17:14:45 -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=3n08U17XQLLrwYLiDWOdzsQAwXWMIAMlVMMr8OAosZo=; b=Kq+GvGKF34FGKEtRSFVfLhm6jO6TuOKRh0qVtw9NvnM+5ST5rdAdvJ8zRejVB7DtIv 53Jn+RX2v3RPsEXNOoyTMQps3aAUDw49WbeE70Ujhe7epx8R29fFvPQMkYRuf/hyaLzB E8KGL2kyfHLznSdoilwgQpLdx5d45bKV3ax+I2YgJqn/DgSxwbKDhejDDyFUXBag/8h4 assRohbRzP01vow9av3BYtuGKU9qEVbNX64o2qmG7r6Lq6BUYuagUBldAH8hi4iYELLc w6X/35T36JVEDZjOL0YhS1APyH9dgs/xp793WGKtxaRkZi69nZVkL5zgULeIVIsqIv0M C+lA== 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=3n08U17XQLLrwYLiDWOdzsQAwXWMIAMlVMMr8OAosZo=; b=QIg6tnpImPNvCK6X6J9yj2dbZw6aRoI4NgfO26Q038JJfcd9bsofNLVHj+xRF0DJ2P 50/jo12p3SNaCRPGtHICgEKn88IfTIW7CuJcZRRd00Lvv3CLrqH3f9LA37kw4k6N5g9M HNFHbKV0DNLMwsGeP6/Ro1zeSEyljhC2XH391PpOaD10xQw4Y3AdTulK0C2IoShx8L9Q HYb+O5xQvdn4qIRdmDnXsyFmPDX1Xir9xmXudLuo8tTeQkUpwqqs1GgIycpWJz/9HRoA 9g4Iyu4t9bZUo+twmY4n6HAa+QfCsG30FTQC6bNUFUWDlxKgJtCNk2ovhOyYY+UTK03D jWzA== X-Gm-Message-State: AHQUAuZFD8M3JiaLnw3oqwJuHatAkiWH3fG9T70+uZpSPmJHY6lk9sLI 4X5Dn7pVRY4pzCM0WREwXPzQl59M X-Received: by 2002:a17:902:2848:: with SMTP id e66mr17665667plb.181.1551230085193; Tue, 26 Feb 2019 17:14:45 -0800 (PST) Received: from fainelli-desktop.igp.broadcom.net ([192.19.223.250]) by smtp.gmail.com with ESMTPSA id q28sm21885221pgl.35.2019.02.26.17.14.41 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 26 Feb 2019 17:14:44 -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 v2 2/8] rocker: Handle SWITCHDEV_PORT_ATTR_SET Date: Tue, 26 Feb 2019 17:14:21 -0800 Message-Id: <20190227011427.16487-3-f.fainelli@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190227011427.16487-1-f.fainelli@gmail.com> References: <20190227011427.16487-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 setting a port's attribute and use notifiers towards that goal. Prepare rocker to support receiving notifier events targeting SWITCHDEV_PORT_ATTR_SET from both atomic and process context and use a small helper to translate the event notifier into something that rocker_port_attr_set() can process. Signed-off-by: Florian Fainelli --- drivers/net/ethernet/rocker/rocker_main.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/drivers/net/ethernet/rocker/rocker_main.c b/drivers/net/ethernet/rocker/rocker_main.c index 309a6bf9130c..fc772cf079cc 100644 --- a/drivers/net/ethernet/rocker/rocker_main.c +++ b/drivers/net/ethernet/rocker/rocker_main.c @@ -2710,6 +2710,19 @@ static bool rocker_port_dev_check(const struct net_device *dev) return dev->netdev_ops == &rocker_port_netdev_ops; } +static int +rocker_switchdev_port_attr_set_event(struct net_device *netdev, + struct switchdev_notifier_port_attr_info *port_attr_info) +{ + int err; + + err = rocker_port_attr_set(netdev, port_attr_info->attr, + port_attr_info->trans); + + port_attr_info->handled = true; + return notifier_from_errno(err); +} + struct rocker_switchdev_event_work { struct work_struct work; struct switchdev_notifier_fdb_info fdb_info; @@ -2779,6 +2792,9 @@ static int rocker_switchdev_event(struct notifier_block *unused, if (!rocker_port_dev_check(dev)) return NOTIFY_DONE; + if (event == SWITCHDEV_PORT_ATTR_SET) + return rocker_switchdev_port_attr_set_event(dev, ptr); + rocker_port = netdev_priv(dev); switchdev_work = kzalloc(sizeof(*switchdev_work), GFP_ATOMIC); if (WARN_ON(!switchdev_work)) @@ -2841,6 +2857,8 @@ static int rocker_switchdev_blocking_event(struct notifier_block *unused, case SWITCHDEV_PORT_OBJ_ADD: case SWITCHDEV_PORT_OBJ_DEL: return rocker_switchdev_port_obj_event(event, dev, ptr); + case SWITCHDEV_PORT_ATTR_SET: + return rocker_switchdev_port_attr_set_event(dev, ptr); } return NOTIFY_DONE; -- 2.17.1