linux-kernel.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>,
	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 v3 08/12] rocker: Implement ndo_get_port_parent_id()
Date: Tue,  5 Feb 2019 15:53:22 -0800	[thread overview]
Message-ID: <20190205235326.14600-9-f.fainelli@gmail.com> (raw)
In-Reply-To: <20190205235326.14600-1-f.fainelli@gmail.com>

mlxsw 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.

Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
 drivers/net/ethernet/rocker/rocker_main.c | 17 +++++++++++++----
 1 file changed, 13 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/rocker/rocker_main.c b/drivers/net/ethernet/rocker/rocker_main.c
index 62a205eba9f7..596f44dbfae1 100644
--- a/drivers/net/ethernet/rocker/rocker_main.c
+++ b/drivers/net/ethernet/rocker/rocker_main.c
@@ -2026,6 +2026,18 @@ static void rocker_port_neigh_destroy(struct net_device *dev,
 			    err);
 }
 
+static int rocker_port_get_port_parent_id(struct net_device *dev,
+					  struct netdev_phys_item_id *ppid)
+{
+	const struct rocker_port *rocker_port = netdev_priv(dev);
+	const struct rocker *rocker = rocker_port->rocker;
+
+	ppid->id_len = sizeof(rocker->hw.id);
+	memcpy(&ppid->id, &rocker->hw.id, ppid->id_len);
+
+	return 0;
+}
+
 static const struct net_device_ops rocker_port_netdev_ops = {
 	.ndo_open			= rocker_port_open,
 	.ndo_stop			= rocker_port_stop,
@@ -2035,6 +2047,7 @@ static const struct net_device_ops rocker_port_netdev_ops = {
 	.ndo_get_phys_port_name		= rocker_port_get_phys_port_name,
 	.ndo_change_proto_down		= rocker_port_change_proto_down,
 	.ndo_neigh_destroy		= rocker_port_neigh_destroy,
+	.ndo_get_port_parent_id		= rocker_port_get_port_parent_id,
 };
 
 /********************
@@ -2049,10 +2062,6 @@ static int rocker_port_attr_get(struct net_device *dev,
 	int err = 0;
 
 	switch (attr->id) {
-	case SWITCHDEV_ATTR_ID_PORT_PARENT_ID:
-		attr->u.ppid.id_len = sizeof(rocker->hw.id);
-		memcpy(&attr->u.ppid.id, &rocker->hw.id, attr->u.ppid.id_len);
-		break;
 	case SWITCHDEV_ATTR_ID_PORT_BRIDGE_FLAGS:
 		err = rocker_world_port_attr_bridge_flags_get(rocker_port,
 							      &attr->u.brport_flags);
-- 
2.17.1


  parent reply	other threads:[~2019-02-05 23:56 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-05 23:53 [PATCH net-next v3 00/12] net: Introduce ndo_get_port_parent_id() Florian Fainelli
2019-02-05 23:53 ` [PATCH net-next v3 01/12] " Florian Fainelli
2019-02-06 12:54   ` Jiri Pirko
2019-02-05 23:53 ` [PATCH net-next v3 02/12] bnxt: Implement ndo_get_port_parent_id() Florian Fainelli
2019-02-06 12:59   ` Jiri Pirko
2019-02-05 23:53 ` [PATCH net-next v3 03/12] liquidio: " Florian Fainelli
2019-02-06 13:10   ` Jiri Pirko
2019-02-05 23:53 ` [PATCH net-next v3 04/12] net/mlx5e: " Florian Fainelli
2019-02-06 13:12   ` Jiri Pirko
2019-02-05 23:53 ` [PATCH net-next v3 05/12] mlxsw: " Florian Fainelli
2019-02-06 13:14   ` Jiri Pirko
2019-02-05 23:53 ` [PATCH net-next v3 06/12] mscc: ocelot: " Florian Fainelli
2019-02-06 13:16   ` Jiri Pirko
2019-02-05 23:53 ` [PATCH net-next v3 07/12] nfp: " Florian Fainelli
2019-02-06 13:23   ` Jiri Pirko
2019-02-05 23:53 ` Florian Fainelli [this message]
2019-02-06 13:23   ` [PATCH net-next v3 08/12] rocker: " Jiri Pirko
2019-02-05 23:53 ` [PATCH net-next v3 09/12] netdevsim: " Florian Fainelli
2019-02-06 13:24   ` Jiri Pirko
2019-02-05 23:53 ` [PATCH net-next v3 10/12] staging: fsl-dpaa2: ethsw: " Florian Fainelli
2019-02-05 23:53 ` [PATCH net-next v3 11/12] net: dsa: " Florian Fainelli
2019-02-06 13:27   ` Jiri Pirko
2019-02-06 18:21   ` Vivien Didelot
2019-02-05 23:53 ` [PATCH net-next v3 12/12] net: Get rid of SWITCHDEV_ATTR_ID_PORT_PARENT_ID Florian Fainelli
2019-02-06 13:34   ` Jiri Pirko
2019-02-06  7:51 ` [PATCH net-next v3 00/12] net: Introduce ndo_get_port_parent_id() Ido Schimmel
2019-02-06 14:24   ` Ido Schimmel

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=20190205235326.14600-9-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).