Received: by 2002:ac0:8845:0:0:0:0:0 with SMTP id g63csp1235782img; Tue, 26 Feb 2019 17:15:59 -0800 (PST) X-Google-Smtp-Source: AHgI3IZfpHikpP6p2Vs6Lm5SiFdpVC3365MA8WJAOOftVBVM2wHleYFmA3zGdB3Q777eAANuiNzD X-Received: by 2002:a63:7843:: with SMTP id t64mr378212pgc.178.1551230159848; Tue, 26 Feb 2019 17:15:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551230159; cv=none; d=google.com; s=arc-20160816; b=SILWCLip3DoICRT+jHRn70DDSJxPyfzs95LOMKK9B+zr/5nA5Xisc3FiwI7gcfjEzD x5WHjmVua4ADHE7/qildMnkQS8esJnmgWKGU02jPEwUNPVdta+u7nxMuo165ph1LtVWf eWqx9LWEfaotE8Bc1F1/bOoapFdNcAUHnYlIw47nbOK5Lx3ah2C6cVZW4AETGN92AC/n 6NXYATbJOuoPztmyupbtretLR2yLqM7ZHxe9WfpvknzJy2fSglpysl8xjR9XjkN7GSuX nvmI9RoSN5J8egVYq7mRuh+3XCmGAe1l/FBomP58NJ2kbmlttJjqLGWs4JIq8mvPyq6Z vLKg== 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=LyKdp20X8t4ovPHYE9CH/9hVrvQZYs4Dq33a5OBgkXM=; b=jXMPGT/hB1LbRK1mgz5PyQ0Zi8QkWf8T2PHOuT9UZCspzLG+ZvH2Yjn/PgXHbzP46r SIdWR3LTsy5kHP3+6hrUtW3mbh3B17t/gGAHwHOjfp1e4YxIglTvMsNEixPCHNs9UH0L Tnvlos/JwnkP1ltd5ZOdvh+hSu8rWyn+YdlocSSeAUNKpEWXyiSpnDnwiQJF41P7lr6R oS5nCXWXPTrKgAQA1j+KDyJZaaCo0IelPiHd1wdtQSu/GjuGYHyc2N9aK1ic9ajLqUgP MJQVy0CJcyPZUG7Z+fuJt5GbbV+XOWD/o61UpEiqIdHG3OL2VlxeXr6+MbvZSe7PWZMF SWrw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=o2FA62Bn; 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 g1si14068162pld.197.2019.02.26.17.15.45; Tue, 26 Feb 2019 17:15:59 -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=o2FA62Bn; 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 S1729738AbfB0BPF (ORCPT + 99 others); Tue, 26 Feb 2019 20:15:05 -0500 Received: from mail-pl1-f196.google.com ([209.85.214.196]:47051 "EHLO mail-pl1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729723AbfB0BPD (ORCPT ); Tue, 26 Feb 2019 20:15:03 -0500 Received: by mail-pl1-f196.google.com with SMTP id c17so3938517plz.13; Tue, 26 Feb 2019 17:15:03 -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=LyKdp20X8t4ovPHYE9CH/9hVrvQZYs4Dq33a5OBgkXM=; b=o2FA62BnB5vfqvE9uANqgGYsKnlq/OF2lifybXrCMuoNW4XtsgVRmOp+u9HsI0YXqO WMT7aAWUx2e5r7r9g6LDBn4ygH2remUJVlK9eE+HWJlOymjuN++uXBS/t/RUlFRMCp1p FwTXy2vwhRh3A128FH5egRyeWi/Uh/Dir+CnPlx2aRSdzk1rQAVPCLsM9zfd1i7eH69H Xvkk4iDSOFcncdFqRBWFOfFriAUyYJBMp3lVhy0q2jrwWzYkcI3wA5tBcFz0xGlY2jrl MTfu/Z2XEWScwpZC+CBxRLnNSCO4r7O0KrvibSPuAOS1RtZlyzUaehdgjQl8tFELCD/V 1PGw== 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=LyKdp20X8t4ovPHYE9CH/9hVrvQZYs4Dq33a5OBgkXM=; b=iJGKZ424Lysnklo+ehK2+3vdzqTovEjxorsM0ynXJ7cq4VvNTMb5/1l/3u/9zKP0/C a9sLhhweKtoB5QG0CwjYdsngaac7Yo/8dmT+rQo3iC33Qo5vu8A+HNUnfyF1R7bE2P3n Cwbh2rfrcJoqbngWzL9HNUyb9aLL6jbIDSQ/+6Yi+ngfKqkizWpuGhqQ42KU1Zft9N5b j6Pz9QohZJlqk/sEIqZRr882LzM3tbdQDfVjpZlDbViMCIqAbs8THoK3AZZiFlcbQSgH RKHMYxYqgpgg8foaX6EzOhv173ViKqDdZMl6BGBLt7FfpUQiGzXkL3fp1REpueTqA55G P+Og== X-Gm-Message-State: AHQUAua+corOpL5el+M2lAvLvVDzrMhtAmHKEcVPzYggmEuVaCN95jpe cSPtooO8U4KfWsztVzxxeWUGkED3 X-Received: by 2002:a17:902:b590:: with SMTP id a16mr29441716pls.22.1551230102490; Tue, 26 Feb 2019 17:15:02 -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.58 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 26 Feb 2019 17:15:01 -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 6/8] staging: fsl-dpaa2: ethsw: Handle SWITCHDEV_PORT_ATTR_SET Date: Tue, 26 Feb 2019 17:14:25 -0800 Message-Id: <20190227011427.16487-7-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 a blocking notifier to perform those tasks. Prepare ethsw to support receiving notifier events targeting SWITCHDEV_PORT_ATTR_SET and simply translate that into the existing swdev_port_attr_set() call. Signed-off-by: Florian Fainelli --- drivers/staging/fsl-dpaa2/ethsw/ethsw.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/drivers/staging/fsl-dpaa2/ethsw/ethsw.c b/drivers/staging/fsl-dpaa2/ethsw/ethsw.c index 018399ee8731..b0d2d9bf2532 100644 --- a/drivers/staging/fsl-dpaa2/ethsw/ethsw.c +++ b/drivers/staging/fsl-dpaa2/ethsw/ethsw.c @@ -929,6 +929,19 @@ static const struct switchdev_ops ethsw_port_switchdev_ops = { .switchdev_port_attr_set = swdev_port_attr_set, }; +static int +ethsw_switchdev_port_attr_set_event(struct net_device *netdev, + struct switchdev_notifier_port_attr_info *port_attr_info) +{ + int err; + + err = swdev_port_attr_set(netdev, port_attr_info->attr, + port_attr_info->trans); + + port_attr_info->handled = true; + return notifier_from_errno(err); +} + /* For the moment, only flood setting needs to be updated */ static int port_bridge_join(struct net_device *netdev, struct net_device *upper_dev) @@ -1047,6 +1060,12 @@ static int port_switchdev_event(struct notifier_block *unused, struct ethsw_switchdev_event_work *switchdev_work; struct switchdev_notifier_fdb_info *fdb_info = ptr; + if (!ethsw_port_dev_check(dev)) + return NOTIFY_DONE; + + if (event == SWITCHDEV_PORT_ATTR_SET) + return ethsw_switchdev_port_attr_set_event(dev, ptr); + switchdev_work = kzalloc(sizeof(*switchdev_work), GFP_ATOMIC); if (!switchdev_work) return NOTIFY_BAD; @@ -1115,6 +1134,8 @@ 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: + return ethsw_switchdev_port_attr_set_event(dev, ptr); } return NOTIFY_DONE; -- 2.17.1