Received: by 2002:ac0:8c8e:0:0:0:0:0 with SMTP id r14csp896201ima; Wed, 6 Feb 2019 10:04:49 -0800 (PST) X-Google-Smtp-Source: AHgI3IamesSiucmH6IQMOrLgVNh8vyXiw2N+11EEp9JsmtcTa3/KbRGTEJcFbjvliMgLZuhihH5N X-Received: by 2002:a17:902:1101:: with SMTP id d1mr11898605pla.136.1549476289366; Wed, 06 Feb 2019 10:04:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549476289; cv=none; d=google.com; s=arc-20160816; b=wfC0+ZpBarI7+d4XINrt/1xvgmhil+TySwd6ecdUUwDfgz0BxAcyn+9epaw3g1G/ef y7vkfxkbpU745x8jKZDY9tjPvD7RRB9d2XZryLcdM9AgQG69/HpNte46miHG3G0wUs4K YVl2W7TI4fLw2tYmt0K6ebmkuYsGSUbOa6Ozv9a/BxF1bKjjZf6xP1cGcxTZdhEHAVZ2 d0PICCA+7lf4D7mKH/CN02q2BpmuSK4zT+8z4xKT+q1ZVEcTtHFFpCqykmNG3TyKLdZI oVPL4D1JJZgNP1/BjLnK/Avd02qzfviVi6aXeBjY6Cxg/4Df6bXPyg2pQ9CDlBiqpQ9L CFXQ== 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=Vad9k5cIbVpA9jZzt94KWuIxiLkKjXeF2VpLNCmWqn8=; b=U5IkbRro5TU5x/U83I/yh0f4o12oRhgajFtWGqz+pg8VlCjhxHFd76TYJfBNz6s6Bw ggvOtZDqTrN62dr2/ONXFXD63xv6MqBwjSWOg92YP/BbKKiGBR3RsmUGEBQAJgO89H93 weNnC1HkQwJ2zvrC87+VuP+7JB53+2rWMEdYnSAMKn7UjZd/QBNmsrLs1Yy9SHCHgxpJ eCBWZyium5ZHBbirw2dKlgHTxRldjd9ssJr8rC3WWQElCuXzui04lgG2T8D9dwyOwDbv ESu9u9pNkcmWX3HJEOiewUr+4hO/BVwTrUObcFFAEgKD3tugIj+bFjVujcvfzD7E32Qv Wjpw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=YKoXb10m; 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 t3si6043888pgv.469.2019.02.06.10.04.24; Wed, 06 Feb 2019 10:04:49 -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=YKoXb10m; 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 S1730697AbfBFRq0 (ORCPT + 99 others); Wed, 6 Feb 2019 12:46:26 -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-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-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 = { -- 2.17.1