linux-rdma.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Florian Fainelli <f.fainelli@gmail.com>
To: netdev@vger.kernel.org
Cc: Florian Fainelli <f.fainelli@gmail.com>,
	"David S. Miller" <davem@davemloft.net>,
	Ido Schimmel <idosch@mellanox.com>,
	open list <linux-kernel@vger.kernel.org>,
	"open list:MELLANOX MLX5 core VPI driver"
	<linux-rdma@vger.kernel.org>,
	"open list:NETRONOME ETHERNET DRIVERS"
	<oss-drivers@netronome.com>,
	"open list:STAGING SUBSYSTEM" <devel@driverdev.osuosl.org>,
	"moderated list:ETHERNET BRIDGE"
	<bridge@lists.linux-foundation.org>
Subject: [PATCH net-next v4 11/12] net: dsa: Implement ndo_get_port_parent_id()
Date: Wed,  6 Feb 2019 09:45:45 -0800	[thread overview]
Message-ID: <20190206174546.23597-12-f.fainelli@gmail.com> (raw)
In-Reply-To: <20190206174546.23597-1-f.fainelli@gmail.com>

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 <jiri@mellanox.com>
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
 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

  parent reply	other threads:[~2019-02-06 17:45 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-06 17:45 [PATCH net-next v4 00/12] net: Introduce ndo_get_port_parent_id() Florian Fainelli
2019-02-06 17:45 ` [PATCH net-next v4 01/12] " Florian Fainelli
2019-02-06 19:10   ` Ido Schimmel
2019-02-06 17:45 ` [PATCH net-next v4 02/12] bnxt: Implement ndo_get_port_parent_id() Florian Fainelli
2019-02-06 17:45 ` [PATCH net-next v4 03/12] liquidio: " Florian Fainelli
2019-02-06 17:45 ` [PATCH net-next v4 04/12] net/mlx5e: " Florian Fainelli
2019-02-06 17:45 ` [PATCH net-next v4 05/12] mlxsw: " Florian Fainelli
2019-02-06 19:04   ` Ido Schimmel
2019-02-06 17:45 ` [PATCH net-next v4 06/12] mscc: ocelot: " Florian Fainelli
2019-02-06 17:45 ` [PATCH net-next v4 07/12] nfp: " Florian Fainelli
2019-02-06 17:45 ` [PATCH net-next v4 08/12] rocker: " Florian Fainelli
2019-02-06 17:45 ` [PATCH net-next v4 09/12] netdevsim: " Florian Fainelli
2019-02-06 17:45 ` [PATCH net-next v4 10/12] staging: fsl-dpaa2: ethsw: " Florian Fainelli
2019-02-06 17:45 ` Florian Fainelli [this message]
2019-02-06 17:45 ` [PATCH net-next v4 12/12] net: Get rid of SWITCHDEV_ATTR_ID_PORT_PARENT_ID Florian Fainelli
2019-02-06 19:10   ` Ido Schimmel
2019-02-06 21:50 ` [PATCH net-next v4 00/12] net: Introduce ndo_get_port_parent_id() David Miller
2019-02-06 22:18   ` David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190206174546.23597-12-f.fainelli@gmail.com \
    --to=f.fainelli@gmail.com \
    --cc=bridge@lists.linux-foundation.org \
    --cc=davem@davemloft.net \
    --cc=devel@driverdev.osuosl.org \
    --cc=idosch@mellanox.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=oss-drivers@netronome.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).