Skip to content

Commit 751302c

Browse files
ffainellidavem330
authored andcommitted
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: Jiri Pirko <jiri@mellanox.com> Signed-off-by: Florian Fainelli <f.fainelli@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 25ba860 commit 751302c

File tree

1 file changed

+13
-20
lines changed

1 file changed

+13
-20
lines changed

drivers/net/ethernet/mscc/ocelot.c

Lines changed: 13 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -916,6 +916,18 @@ static int ocelot_set_features(struct net_device *dev,
916916
return 0;
917917
}
918918

919+
static int ocelot_get_port_parent_id(struct net_device *dev,
920+
struct netdev_phys_item_id *ppid)
921+
{
922+
struct ocelot_port *ocelot_port = netdev_priv(dev);
923+
struct ocelot *ocelot = ocelot_port->ocelot;
924+
925+
ppid->id_len = sizeof(ocelot->base_mac);
926+
memcpy(&ppid->id, &ocelot->base_mac, ppid->id_len);
927+
928+
return 0;
929+
}
930+
919931
static const struct net_device_ops ocelot_port_netdev_ops = {
920932
.ndo_open = ocelot_port_open,
921933
.ndo_stop = ocelot_port_stop,
@@ -930,6 +942,7 @@ static const struct net_device_ops ocelot_port_netdev_ops = {
930942
.ndo_vlan_rx_add_vid = ocelot_vlan_rx_add_vid,
931943
.ndo_vlan_rx_kill_vid = ocelot_vlan_rx_kill_vid,
932944
.ndo_set_features = ocelot_set_features,
945+
.ndo_get_port_parent_id = ocelot_get_port_parent_id,
933946
};
934947

935948
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 = {
10131026
.set_link_ksettings = phy_ethtool_set_link_ksettings,
10141027
};
10151028

1016-
static int ocelot_port_attr_get(struct net_device *dev,
1017-
struct switchdev_attr *attr)
1018-
{
1019-
struct ocelot_port *ocelot_port = netdev_priv(dev);
1020-
struct ocelot *ocelot = ocelot_port->ocelot;
1021-
1022-
switch (attr->id) {
1023-
case SWITCHDEV_ATTR_ID_PORT_PARENT_ID:
1024-
attr->u.ppid.id_len = sizeof(ocelot->base_mac);
1025-
memcpy(&attr->u.ppid.id, &ocelot->base_mac,
1026-
attr->u.ppid.id_len);
1027-
break;
1028-
default:
1029-
return -EOPNOTSUPP;
1030-
}
1031-
1032-
return 0;
1033-
}
1034-
10351029
static int ocelot_port_attr_stp_state_set(struct ocelot_port *ocelot_port,
10361030
struct switchdev_trans *trans,
10371031
u8 state)
@@ -1331,7 +1325,6 @@ static int ocelot_port_obj_del(struct net_device *dev,
13311325
}
13321326

13331327
static const struct switchdev_ops ocelot_port_switchdev_ops = {
1334-
.switchdev_port_attr_get = ocelot_port_attr_get,
13351328
.switchdev_port_attr_set = ocelot_port_attr_set,
13361329
};
13371330

0 commit comments

Comments
 (0)