Received: by 2002:ac0:8845:0:0:0:0:0 with SMTP id g63csp1235527img; Tue, 26 Feb 2019 17:15:44 -0800 (PST) X-Google-Smtp-Source: AHgI3IYwI17o+sV0ZES/OTZKI5HV713I5JJ2pcFMf5eL/t/WWPBavu5VcPIU7e+V9UEca+FajZFY X-Received: by 2002:a65:510c:: with SMTP id f12mr396161pgq.40.1551230144693; Tue, 26 Feb 2019 17:15:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551230144; cv=none; d=google.com; s=arc-20160816; b=0TfvJv/B3bJVNxBlXYgXE40WNwaLtOeMVIAD9evx5NhIudQFq2smavszaFfNtxheX+ DIyd/DYE4barcNdwSFFZ+WdJXiaD6BTlEMwLoqIbThdTfmHYHRSk8IcA7o2/KZ8nnVS/ 5eBd60WlmX0oGFYLWMOcuqMuncmNs7MOYCVzY0SyzgFl89U4L7c6IXyPPsuw+FvwkJ0d giYc9QZQ4+nd8ieSx3D8qpzkWLdlr7xXpAg/Ri9mHDxTHUH+OlTJVUKjzErLYf1Nsz/2 Vjj5mPh33jSYCjPRbnI0CXhfThXlihVDPHk03Fs/GvbfAPd9yQgh5OnXUmSG7du4U7Tq gMdw== 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=Gq/qAOtWNvcuwUtUaSW2EYY4Z4jqPnX1n6JjQenVLBM=; b=qc3GTUSLZy2dcn106lICBwB7niVUc/VV90U5deUSeFdpSnNgu8LC4un7s+hgPfxWmh mV0Nfy6iktO4qF0DfcN8vhV9OyxeDDmbhvnoaXpJgq65UFGnLg1z8DXuRGCrXTjTR7p9 bcntwDDaYLvtSq0zbix5Ckt/SVevry/qqQkiLyImoKkErZmpvKCFUMk7WziQD1x22D1l RdLdzjSzwa6Px7ZwCwpo7p6Y4XnEx7+/se75RPXwLubM00YUh/A9gjg4vW2xDg02x5fM l4hyZAaEmJ1IXrTOiO6a/B7s0Bfi1uGBSsLNdu6bo98qb+a9P7Vfep/1vki4brxS7tB4 5yAQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=g4+NDr7r; 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 l71si12388304pgd.529.2019.02.26.17.15.30; Tue, 26 Feb 2019 17:15:44 -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=g4+NDr7r; 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 S1729629AbfB0BOx (ORCPT + 99 others); Tue, 26 Feb 2019 20:14:53 -0500 Received: from mail-pl1-f194.google.com ([209.85.214.194]:38156 "EHLO mail-pl1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727998AbfB0BOu (ORCPT ); Tue, 26 Feb 2019 20:14:50 -0500 Received: by mail-pl1-f194.google.com with SMTP id g37so4311135plb.5; Tue, 26 Feb 2019 17:14:50 -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=Gq/qAOtWNvcuwUtUaSW2EYY4Z4jqPnX1n6JjQenVLBM=; b=g4+NDr7r61K9ERC3quk5u63rKL/N4u3wkUo2s/Ez3fiOkzAyRQFgZvxxyxR6NpqaRM /Y6aGQsAS5AC5maDmuQ1fd6ah/WZUQhSGPS6/v8AE0ROwx7YwcQYMyYE2taCRdeQl5f7 yPnV/xVbYZVOnjV/AuDDF9+9ZJuFq0ezRBXrwsF7cejTgNxJs6KwEKDT71keOJCSCPvP PE4xT02oQDO7/wbE7nSBhzP5MrHMtNgc32j2a7+lAZKz1WaH04MkTz2I8ErUEpgujTmf XMjRAQ8Qfa+dzGKsb95rDbsBn2ZIbQRtAbsl/ffFqs0XncQzwyPVKaxZEtieb1ZjMyP4 rh1g== 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=Gq/qAOtWNvcuwUtUaSW2EYY4Z4jqPnX1n6JjQenVLBM=; b=tpeIaGT6GvaELP1ElRzwwjMuvh11bxy9BTs+1h1H8EA7ORveB7/Ur8H+QdP+PznXTr TBT5BXf8iHogrGyJbPrPrMXQPrFXNLpDXyji0JB8ovUG4ddnvLe5k2r6oDbLw3OLTnRo RBdVoR7jVAdv1BsscepIJwKKt5vr8BKAXiQkzg6zZli7k2n+FEn8pTEQMHscff5F/G9K OmOTDGdSXUsjuzCJZXsitrWx7G5igqhFzwyxxJeFiPn01LM6yliOsdqLMcu+5pzdQE2i bf2vwGy519bZkApIK/Wyqqv0yZUydCYl331Mc9vBWP4XBRnJaOMKFxIxVXBz0sljSgq5 7hEg== X-Gm-Message-State: AHQUAuZT97x9BsKXfodQg+zePkTMJ76Iovb8tQXqDeg7+e9UL/W46m4l n4qt3TDovc30mFGmovUsO4uj5aRK X-Received: by 2002:a17:902:be15:: with SMTP id r21mr28516146pls.143.1551230089558; Tue, 26 Feb 2019 17:14:49 -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.45 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 26 Feb 2019 17:14:48 -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 3/8] net: dsa: Handle SWITCHDEV_PORT_ATTR_SET Date: Tue, 26 Feb 2019 17:14:22 -0800 Message-Id: <20190227011427.16487-4-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 DSA 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 dsa_slave_port_attr_set() can process. Signed-off-by: Florian Fainelli --- net/dsa/slave.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/net/dsa/slave.c b/net/dsa/slave.c index 7274499293c9..b089b43120e1 100644 --- a/net/dsa/slave.c +++ b/net/dsa/slave.c @@ -1524,6 +1524,19 @@ static int dsa_slave_netdevice_event(struct notifier_block *nb, return NOTIFY_DONE; } +static int +dsa_slave_switchdev_port_attr_set_event(struct net_device *netdev, + struct switchdev_notifier_port_attr_info *port_attr_info) +{ + int err; + + err = dsa_slave_port_attr_set(netdev, port_attr_info->attr, + port_attr_info->trans); + + port_attr_info->handled = true; + return notifier_from_errno(err); +} + struct dsa_switchdev_event_work { struct work_struct work; struct switchdev_notifier_fdb_info fdb_info; @@ -1602,6 +1615,9 @@ static int dsa_slave_switchdev_event(struct notifier_block *unused, if (!dsa_slave_dev_check(dev)) return NOTIFY_DONE; + if (event == SWITCHDEV_PORT_ATTR_SET) + return dsa_slave_switchdev_port_attr_set_event(dev, ptr); + switchdev_work = kzalloc(sizeof(*switchdev_work), GFP_ATOMIC); if (!switchdev_work) return NOTIFY_BAD; @@ -1664,6 +1680,8 @@ 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: + return dsa_slave_switchdev_port_attr_set_event(dev, ptr); } return NOTIFY_DONE; -- 2.17.1