Commit 7d1e2a10 authored by Andrew Lunn's avatar Andrew Lunn Committed by David S. Miller

net: dsa: Add helper for converting devlink port to ds and port

Hide away from DSA drivers how devlink works.
Signed-off-by: default avatarAndrew Lunn <andrew@lunn.ch>
Reviewed-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
Reviewed-by: default avatarVladimir Oltean <olteanv@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 08156ba4
...@@ -701,6 +701,20 @@ static inline struct dsa_switch *dsa_devlink_to_ds(struct devlink *dl) ...@@ -701,6 +701,20 @@ static inline struct dsa_switch *dsa_devlink_to_ds(struct devlink *dl)
return dl_priv->ds; return dl_priv->ds;
} }
static inline
struct dsa_switch *dsa_devlink_port_to_ds(struct devlink_port *port)
{
struct devlink *dl = port->devlink;
struct dsa_devlink_priv *dl_priv = devlink_priv(dl);
return dl_priv->ds;
}
static inline int dsa_devlink_port_to_port(struct devlink_port *port)
{
return port->index;
}
struct dsa_switch_driver { struct dsa_switch_driver {
struct list_head list; struct list_head list;
const struct dsa_switch_ops *ops; const struct dsa_switch_ops *ops;
......
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