From patchwork Wed Feb 6 17:45:45 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Fainelli X-Patchwork-Id: 10799751 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id BBA661390 for ; Wed, 6 Feb 2019 17:46:43 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AF05B2CC51 for ; Wed, 6 Feb 2019 17:46:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A07472CF36; Wed, 6 Feb 2019 17:46:43 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4BC022CC51 for ; Wed, 6 Feb 2019 17:46:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730642AbfBFRqZ (ORCPT ); Wed, 6 Feb 2019 12:46:25 -0500 Received: from mail-pg1-f196.google.com ([209.85.215.196]:44702 "EHLO mail-pg1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730599AbfBFRqY (ORCPT ); Wed, 6 Feb 2019 12:46:24 -0500 Received: by mail-pg1-f196.google.com with SMTP id y1so3196454pgk.11; Wed, 06 Feb 2019 09:46:23 -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=Vad9k5cIbVpA9jZzt94KWuIxiLkKjXeF2VpLNCmWqn8=; b=YKoXb10mfQEin253lWpOQ8rjnZW8dAFjFvg45yw/uo7hehOomyTf3ynVYhOIJjSuJz nh3/wZ/KF8YycPrYRLUVS771fYwODz9Eesslj1B1ubuldU1W3q0zofUZ37E6ljKVBmYu zolUpNpPjzTUEGaRgN2zuacB7k90aW8OjGxk3CShFg9/HJJqD4vrq+OmoHY7SGpyhHXK 1Szn3SlsKZ4gs7o2BVQNqGSDIKBgKcGBMrsoLOFveG74D22W1WUvVcdi8+OJ2pq8Qeko Uo1+mpFSVh37i4qvmowiqKxwJL+fIeVj2FMwz64XZNJfto0qeb/G5hzeURKYr9UQbx4I UnYg== 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=Vad9k5cIbVpA9jZzt94KWuIxiLkKjXeF2VpLNCmWqn8=; b=efRguywMZUIoyrPNRHW21bqkK2syklD7cdhsjcSDxABRS+ljRvK2pnMIu61s5lDb0X SjAWzoY6MZoYuK6HT0CDKpVA6oecl8Pcceenad6nAWGe1B7VkuvD+LjqRCvyg1lgNHsl oh/JlsLT3sLtB60Ln5lRpED5gYx4J1Fxbz9djJhbzd+oxNhV0xlbzoNd4UT3/M/YGljU vogSX3usF5khoIXjhPr1lGktbQ7BFYpYrSliDYCECbKEgAj7l2lAgCuyMAqaFihRCs0+ ejtyUXirilgqb1rX4HDWttzENnSt2jD7kmOxXf/kgFPIzULbz6XgoOjVsaHPY17T1I7n XYrA== X-Gm-Message-State: AHQUAuaQ4R2UNYlYnHJZT1bWudzzRooFofHgAegvNAWzmjo4FOQRC7u7 5alEq8C+GOomtvhoV8n5GIyoIrRM X-Google-Smtp-Source: AHgI3IZxwk4yvqEW2FIgob0q9/iAcORWxLr7ql7Dzi+nCcsa4E885ghoBZyO9Th3Pt/kTd3GgpGcMw== X-Received: by 2002:a62:6047:: with SMTP id u68mr11461368pfb.239.1549475183224; Wed, 06 Feb 2019 09:46:23 -0800 (PST) Received: from fainelli-desktop.igp.broadcom.net ([192.19.223.250]) by smtp.gmail.com with ESMTPSA id 15sm10435313pfr.55.2019.02.06.09.46.21 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 06 Feb 2019 09:46:22 -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), linux-rdma@vger.kernel.org (open list:MELLANOX MLX5 core VPI driver), oss-drivers@netronome.com (open list:NETRONOME ETHERNET DRIVERS), devel@driverdev.osuosl.org (open list:STAGING SUBSYSTEM), bridge@lists.linux-foundation.org (moderated list:ETHERNET BRIDGE) Subject: [PATCH net-next v4 11/12] net: dsa: Implement ndo_get_port_parent_id() Date: Wed, 6 Feb 2019 09:45:45 -0800 Message-Id: <20190206174546.23597-12-f.fainelli@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190206174546.23597-1-f.fainelli@gmail.com> References: <20190206174546.23597-1-f.fainelli@gmail.com> Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP DSA implements SWITCHDEV_ATTR_ID_PORT_PARENT_ID and we want to get rid of switchdev_ops eventually, ease that migration by implementing a ndo_get_port_parent_id() function which returns what switchdev_port_attr_get() would do. Acked-by: Jiri Pirko Signed-off-by: Florian Fainelli --- net/dsa/slave.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/net/dsa/slave.c b/net/dsa/slave.c index 91de3a663226..70395a0ae52e 100644 --- a/net/dsa/slave.c +++ b/net/dsa/slave.c @@ -362,18 +362,23 @@ static int dsa_slave_port_obj_del(struct net_device *dev, return err; } -static int dsa_slave_port_attr_get(struct net_device *dev, - struct switchdev_attr *attr) +static int dsa_slave_get_port_parent_id(struct net_device *dev, + struct netdev_phys_item_id *ppid) { struct dsa_port *dp = dsa_slave_to_port(dev); struct dsa_switch *ds = dp->ds; struct dsa_switch_tree *dst = ds->dst; + ppid->id_len = sizeof(dst->index); + memcpy(&ppid->id, &dst->index, ppid->id_len); + + return 0; +} + +static int dsa_slave_port_attr_get(struct net_device *dev, + struct switchdev_attr *attr) +{ switch (attr->id) { - case SWITCHDEV_ATTR_ID_PORT_PARENT_ID: - attr->u.ppid.id_len = sizeof(dst->index); - memcpy(&attr->u.ppid.id, &dst->index, attr->u.ppid.id_len); - break; case SWITCHDEV_ATTR_ID_PORT_BRIDGE_FLAGS_SUPPORT: attr->u.brport_flags_support = 0; break; @@ -1046,6 +1051,7 @@ static const struct net_device_ops dsa_slave_netdev_ops = { .ndo_get_phys_port_name = dsa_slave_get_phys_port_name, .ndo_setup_tc = dsa_slave_setup_tc, .ndo_get_stats64 = dsa_slave_get_stats64, + .ndo_get_port_parent_id = dsa_slave_get_port_parent_id, }; static const struct switchdev_ops dsa_slave_switchdev_ops = {