aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFlorian Fainelli <f.fainelli@gmail.com>2019-02-06 12:45:44 -0500
committerDavid S. Miller <davem@davemloft.net>2019-02-06 17:17:03 -0500
commit7870a7bd570bc1bd43622c7c6828931d3ea98b8c (patch)
treece0a2b2681917d268cf43115f9d21cd10d293194
parente58df56c8564b701491236381fc1e75202952736 (diff)
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>
-rw-r--r--drivers/staging/fsl-dpaa2/ethsw/ethsw.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/drivers/staging/fsl-dpaa2/ethsw/ethsw.c b/drivers/staging/fsl-dpaa2/ethsw/ethsw.c
index daabaceeea52..e559f4c25cf7 100644
--- a/drivers/staging/fsl-dpaa2/ethsw/ethsw.c
+++ b/drivers/staging/fsl-dpaa2/ethsw/ethsw.c
@@ -505,6 +505,17 @@ static netdev_tx_t port_dropframe(struct sk_buff *skb,
505 return NETDEV_TX_OK; 505 return NETDEV_TX_OK;
506} 506}
507 507
508static 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
508static const struct net_device_ops ethsw_port_ops = { 519static const struct net_device_ops ethsw_port_ops = {
509 .ndo_open = port_open, 520 .ndo_open = port_open,
510 .ndo_stop = port_stop, 521 .ndo_stop = port_stop,
@@ -515,6 +526,7 @@ static const struct net_device_ops ethsw_port_ops = {
515 .ndo_get_offload_stats = port_get_offload_stats, 526 .ndo_get_offload_stats = port_get_offload_stats,
516 527
517 .ndo_start_xmit = port_dropframe, 528 .ndo_start_xmit = port_dropframe,
529 .ndo_get_port_parent_id = swdev_get_port_parent_id,
518}; 530};
519 531
520static void ethsw_links_state_update(struct ethsw_core *ethsw) 532static void ethsw_links_state_update(struct ethsw_core *ethsw)
@@ -634,10 +646,6 @@ static int swdev_port_attr_get(struct net_device *netdev,
634 struct ethsw_port_priv *port_priv = netdev_priv(netdev); 646 struct ethsw_port_priv *port_priv = netdev_priv(netdev);
635 647
636 switch (attr->id) { 648 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;
641 case SWITCHDEV_ATTR_ID_PORT_BRIDGE_FLAGS: 649 case SWITCHDEV_ATTR_ID_PORT_BRIDGE_FLAGS:
642 attr->u.brport_flags = 650 attr->u.brport_flags =
643 (port_priv->ethsw_data->learning ? BR_LEARNING : 0) | 651 (port_priv->ethsw_data->learning ? BR_LEARNING : 0) |