Commit 7026b8a6 authored by Florian Fainelli's avatar Florian Fainelli Committed by David S. Miller

rocker: Implement ndo_get_port_parent_id()

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.
Acked-by: default avatarJiri Pirko <jiri@mellanox.com>
Signed-off-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent a5084bb7
......@@ -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,
};
/********************
......@@ -2045,14 +2058,9 @@ static int rocker_port_attr_get(struct net_device *dev,
struct switchdev_attr *attr)
{
const struct rocker_port *rocker_port = netdev_priv(dev);
const struct rocker *rocker = rocker_port->rocker;
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);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment