Received: by 2002:ac0:b08d:0:0:0:0:0 with SMTP id l13csp2017204imc; Fri, 22 Feb 2019 16:02:59 -0800 (PST) X-Google-Smtp-Source: AHgI3IYplZmBa9nci+njtzDd3M7uGOQyTM5nyymNtw5yEgPsm39uba73souqXr3FxOFYe9LxU1mR X-Received: by 2002:a17:902:8c95:: with SMTP id t21mr6653850plo.300.1550880179009; Fri, 22 Feb 2019 16:02:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550880179; cv=none; d=google.com; s=arc-20160816; b=RWWjikohQuFDhMlJQ35GBvzXn9cdbvmyAvfrsNYCfBTzlFyddoqJSURfWKKVZloCpD h8X2w21nOv+DNp9BIHfxUAfP7acWg2IgtJDuMgDuF8pnZUWpcBgYzS/drK+XKoqzKijS bPTtnSswjYhOAOtjt46nsFcG2yh5kgr9QU3GcIscxmPWFOoJBtsY6fRTUa+cnWa909UR zL7MgB2/54qPn9MeEfZQLwGrsrW18SGHPIiIR1HvSgEOQL6U5WXe6lLpr+NrUSTbvkpC vkWAT9ayQdf+CnG605lfcReq6fe2XaVUvqvtgQokcSUqii9+5viEDgHCmcnbWgIwwsDQ lXSg== 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=Nuo4dpRE9ulHu0E+wlum6XOB46T2GQb5E3Eru2gkHj0=; b=Y3sQ3RFQ9Tbw30Cc2190AWCfT0v7uaRS4LeX6e9QOuFqb61csOp8dLHXchoFB2EY5c 9yn1SQeun6cUoqOyLu83amE1U+AlE8gc1O2iPFrqygis3m9ZZyJ5MU4lY/LwX/kJcQX5 rjgJDc7h5sR3dD9QO7UOXraV2FgceDxjBUB41zXTJoFTn30GbvDqhisPVXK6Y+Mw5fff YzwhYzT3r2+MxNAvYwxVe2obCnwzPmDZBcsnan8KyhrWdhEe4JXCHxDQYy/c6/aRdmAP lGHOCNKgZ+g/CzPns5P3YmhNbaIKP3zDV4l4T1/S923umJVpZ1nTzzKPzLlisz+0EMso H0mw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=jedwLRM6; 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 k64si2571134pgc.303.2019.02.22.16.02.43; Fri, 22 Feb 2019 16:02:58 -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=jedwLRM6; 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 S1727749AbfBWAAw (ORCPT + 99 others); Fri, 22 Feb 2019 19:00:52 -0500 Received: from mail-pg1-f196.google.com ([209.85.215.196]:37485 "EHLO mail-pg1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726681AbfBWAAv (ORCPT ); Fri, 22 Feb 2019 19:00:51 -0500 Received: by mail-pg1-f196.google.com with SMTP id q206so1816831pgq.4; Fri, 22 Feb 2019 16:00: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=Nuo4dpRE9ulHu0E+wlum6XOB46T2GQb5E3Eru2gkHj0=; b=jedwLRM663AEfpijeu14tk5kWc+E0khChSJruqPX6Ig2sd1t0N4Np25mj0RfJkUGup bXr6cbzVOjkJtOFRdZ6qFAtL1zilM+8Yx7bY8ZQ2wmbnl7nJXxzITW0g6o2vKQ6fT8mf /nLBnEP0YBvIdgIpcGfk1awSj3Wy+BYXyBE8e6ynCtXK02/X9tL2eeNVBljkVRVnvGpd lG1o8Bx6VLf+T3j9N7uySJmYv4JNt3YYPFnUtQ2pCLmzoly7iAqJNaLqXYHaMn5yFJ2B Gs1Hg+K91ba+R0wG4T8Hd3TyGkOJYHSZSN6HCjHgdASGjATtOAPcx70F3uwU/RdEctuJ BCLg== 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=Nuo4dpRE9ulHu0E+wlum6XOB46T2GQb5E3Eru2gkHj0=; b=agbFgwW6pudsXPsvpW01yN3mWD0mcR9S7veWPG/LJFw4Pvhh4HmBQVRLnfFeRkJTV2 WmgPif1kErhYKf7sm+myoYTIO8ZZP8EtAjBx1DjSMiiBmoafBIIkrNAiKjZ5+3w6GUi6 4F7p57+473kNFI+MoHXgfAaK0lFG8Hv54ULe9kKM6axsGzwgof4Mehzy3ULrpsqT+2iB ydikk+IcZ6X1GtCDE3zP2J7RDCMfwEEzFfd/gCrvoa4CpHe/KLIsXeGrGXnuXQecK5k9 cMlF946b3YJu74W4+l2g8X9SzQlwVl7I3JlDcE0RcCjuUeLmOVMAfZA4TTI0BAfvYTLQ xs2g== X-Gm-Message-State: AHQUAuYirBW2xDoBEZTS/DoOz5cruVbdZVpNNDN+ujub/5qtx77U0EFB Rn07T0Q1W+slhybUSzlZWoEKdPzb X-Received: by 2002:a62:cf02:: with SMTP id b2mr6802528pfg.71.1550880049723; Fri, 22 Feb 2019 16:00:49 -0800 (PST) Received: from fainelli-desktop.igp.broadcom.net ([192.19.223.250]) by smtp.gmail.com with ESMTPSA id z12sm3327872pgv.0.2019.02.22.16.00.45 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 22 Feb 2019 16:00:49 -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 6/8] staging: fsl-dpaa2: ethsw: Handle SWITCHDEV_PORT_ATTR_SET Date: Fri, 22 Feb 2019 15:59:24 -0800 Message-Id: <20190222235927.10295-7-f.fainelli@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190222235927.10295-1-f.fainelli@gmail.com> References: <20190222235927.10295-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..73efc2a5fd91 100644 --- a/drivers/staging/fsl-dpaa2/ethsw/ethsw.c +++ b/drivers/staging/fsl-dpaa2/ethsw/ethsw.c @@ -1047,6 +1047,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; @@ -1103,6 +1109,19 @@ ethsw_switchdev_port_obj_event(unsigned long event, struct net_device *netdev, return notifier_from_errno(err); } +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); +} + static int port_switchdev_blocking_event(struct notifier_block *unused, unsigned long event, void *ptr) { @@ -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