Commit 751302c3 authored by Florian Fainelli's avatar Florian Fainelli Committed by David S. Miller

mscc: ocelot: Implement ndo_get_port_parent_id()

Ocelot only supports SWITCHDEV_ATTR_ID_PORT_PARENT_ID as a valid
switchdev attribute getter, convert it to use ndo_get_port_parent_id()
and get rid of the switchdev_ops::switchdev_port_attr_get altogether.
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 25ba8605
...@@ -916,6 +916,18 @@ static int ocelot_set_features(struct net_device *dev, ...@@ -916,6 +916,18 @@ static int ocelot_set_features(struct net_device *dev,
return 0; return 0;
} }
static int ocelot_get_port_parent_id(struct net_device *dev,
struct netdev_phys_item_id *ppid)
{
struct ocelot_port *ocelot_port = netdev_priv(dev);
struct ocelot *ocelot = ocelot_port->ocelot;
ppid->id_len = sizeof(ocelot->base_mac);
memcpy(&ppid->id, &ocelot->base_mac, ppid->id_len);
return 0;
}
static const struct net_device_ops ocelot_port_netdev_ops = { static const struct net_device_ops ocelot_port_netdev_ops = {
.ndo_open = ocelot_port_open, .ndo_open = ocelot_port_open,
.ndo_stop = ocelot_port_stop, .ndo_stop = ocelot_port_stop,
...@@ -930,6 +942,7 @@ static const struct net_device_ops ocelot_port_netdev_ops = { ...@@ -930,6 +942,7 @@ static const struct net_device_ops ocelot_port_netdev_ops = {
.ndo_vlan_rx_add_vid = ocelot_vlan_rx_add_vid, .ndo_vlan_rx_add_vid = ocelot_vlan_rx_add_vid,
.ndo_vlan_rx_kill_vid = ocelot_vlan_rx_kill_vid, .ndo_vlan_rx_kill_vid = ocelot_vlan_rx_kill_vid,
.ndo_set_features = ocelot_set_features, .ndo_set_features = ocelot_set_features,
.ndo_get_port_parent_id = ocelot_get_port_parent_id,
}; };
static void ocelot_get_strings(struct net_device *netdev, u32 sset, u8 *data) static void ocelot_get_strings(struct net_device *netdev, u32 sset, u8 *data)
...@@ -1013,25 +1026,6 @@ static const struct ethtool_ops ocelot_ethtool_ops = { ...@@ -1013,25 +1026,6 @@ static const struct ethtool_ops ocelot_ethtool_ops = {
.set_link_ksettings = phy_ethtool_set_link_ksettings, .set_link_ksettings = phy_ethtool_set_link_ksettings,
}; };
static int ocelot_port_attr_get(struct net_device *dev,
struct switchdev_attr *attr)
{
struct ocelot_port *ocelot_port = netdev_priv(dev);
struct ocelot *ocelot = ocelot_port->ocelot;
switch (attr->id) {
case SWITCHDEV_ATTR_ID_PORT_PARENT_ID:
attr->u.ppid.id_len = sizeof(ocelot->base_mac);
memcpy(&attr->u.ppid.id, &ocelot->base_mac,
attr->u.ppid.id_len);
break;
default:
return -EOPNOTSUPP;
}
return 0;
}
static int ocelot_port_attr_stp_state_set(struct ocelot_port *ocelot_port, static int ocelot_port_attr_stp_state_set(struct ocelot_port *ocelot_port,
struct switchdev_trans *trans, struct switchdev_trans *trans,
u8 state) u8 state)
...@@ -1331,7 +1325,6 @@ static int ocelot_port_obj_del(struct net_device *dev, ...@@ -1331,7 +1325,6 @@ static int ocelot_port_obj_del(struct net_device *dev,
} }
static const struct switchdev_ops ocelot_port_switchdev_ops = { static const struct switchdev_ops ocelot_port_switchdev_ops = {
.switchdev_port_attr_get = ocelot_port_attr_get,
.switchdev_port_attr_set = ocelot_port_attr_set, .switchdev_port_attr_set = ocelot_port_attr_set,
}; };
......
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