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>
This commit is contained in:
parent
e58df56c85
commit
7870a7bd57
|
@ -505,6 +505,17 @@ static netdev_tx_t port_dropframe(struct sk_buff *skb,
|
||||||
return NETDEV_TX_OK;
|
return NETDEV_TX_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int swdev_get_port_parent_id(struct net_device *dev,
|
||||||
|
struct netdev_phys_item_id *ppid)
|
||||||
|
{
|
||||||
|
struct ethsw_port_priv *port_priv = netdev_priv(dev);
|
||||||
|
|
||||||
|
ppid->id_len = 1;
|
||||||
|
ppid->id[0] = port_priv->ethsw_data->dev_id;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
static const struct net_device_ops ethsw_port_ops = {
|
static const struct net_device_ops ethsw_port_ops = {
|
||||||
.ndo_open = port_open,
|
.ndo_open = port_open,
|
||||||
.ndo_stop = port_stop,
|
.ndo_stop = port_stop,
|
||||||
|
@ -515,6 +526,7 @@ static const struct net_device_ops ethsw_port_ops = {
|
||||||
.ndo_get_offload_stats = port_get_offload_stats,
|
.ndo_get_offload_stats = port_get_offload_stats,
|
||||||
|
|
||||||
.ndo_start_xmit = port_dropframe,
|
.ndo_start_xmit = port_dropframe,
|
||||||
|
.ndo_get_port_parent_id = swdev_get_port_parent_id,
|
||||||
};
|
};
|
||||||
|
|
||||||
static void ethsw_links_state_update(struct ethsw_core *ethsw)
|
static void ethsw_links_state_update(struct ethsw_core *ethsw)
|
||||||
|
@ -634,10 +646,6 @@ static int swdev_port_attr_get(struct net_device *netdev,
|
||||||
struct ethsw_port_priv *port_priv = netdev_priv(netdev);
|
struct ethsw_port_priv *port_priv = netdev_priv(netdev);
|
||||||
|
|
||||||
switch (attr->id) {
|
switch (attr->id) {
|
||||||
case SWITCHDEV_ATTR_ID_PORT_PARENT_ID:
|
|
||||||
attr->u.ppid.id_len = 1;
|
|
||||||
attr->u.ppid.id[0] = port_priv->ethsw_data->dev_id;
|
|
||||||
break;
|
|
||||||
case SWITCHDEV_ATTR_ID_PORT_BRIDGE_FLAGS:
|
case SWITCHDEV_ATTR_ID_PORT_BRIDGE_FLAGS:
|
||||||
attr->u.brport_flags =
|
attr->u.brport_flags =
|
||||||
(port_priv->ethsw_data->learning ? BR_LEARNING : 0) |
|
(port_priv->ethsw_data->learning ? BR_LEARNING : 0) |
|
||||||
|
|
Loading…
Reference in New Issue