Skip to content

Commit 7870a7b

Browse files
ffainellidavem330
authored andcommitted
staging: fsl-dpaa2: ethsw: Implement ndo_get_port_parent_id()
ethsw 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> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent e58df56 commit 7870a7b

File tree

1 file changed

+12
-4
lines changed
  • drivers/staging/fsl-dpaa2/ethsw

1 file changed

+12
-4
lines changed

drivers/staging/fsl-dpaa2/ethsw/ethsw.c

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -505,6 +505,17 @@ static netdev_tx_t port_dropframe(struct sk_buff *skb,
505505
return NETDEV_TX_OK;
506506
}
507507

508+
static int swdev_get_port_parent_id(struct net_device *dev,
509+
struct netdev_phys_item_id *ppid)
510+
{
511+
struct ethsw_port_priv *port_priv = netdev_priv(dev);
512+
513+
ppid->id_len = 1;
514+
ppid->id[0] = port_priv->ethsw_data->dev_id;
515+
516+
return 0;
517+
}
518+
508519
static const struct net_device_ops ethsw_port_ops = {
509520
.ndo_open = port_open,
510521
.ndo_stop = port_stop,
@@ -515,6 +526,7 @@ static const struct net_device_ops ethsw_port_ops = {
515526
.ndo_get_offload_stats = port_get_offload_stats,
516527

517528
.ndo_start_xmit = port_dropframe,
529+
.ndo_get_port_parent_id = swdev_get_port_parent_id,
518530
};
519531

520532
static void ethsw_links_state_update(struct ethsw_core *ethsw)
@@ -634,10 +646,6 @@ static int swdev_port_attr_get(struct net_device *netdev,
634646
struct ethsw_port_priv *port_priv = netdev_priv(netdev);
635647

636648
switch (attr->id) {
637-
case SWITCHDEV_ATTR_ID_PORT_PARENT_ID:
638-
attr->u.ppid.id_len = 1;
639-
attr->u.ppid.id[0] = port_priv->ethsw_data->dev_id;
640-
break;
641649
case SWITCHDEV_ATTR_ID_PORT_BRIDGE_FLAGS:
642650
attr->u.brport_flags =
643651
(port_priv->ethsw_data->learning ? BR_LEARNING : 0) |

0 commit comments

Comments
 (0)