mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-10-02 07:04:24 +00:00
net: dsa: Add helper for converting devlink port to ds and port
Hide away from DSA drivers how devlink works. Signed-off-by: Andrew Lunn <andrew@lunn.ch> Reviewed-by: Florian Fainelli <f.fainelli@gmail.com> Reviewed-by: Vladimir Oltean <olteanv@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
08156ba430
commit
7d1e2a1068
1 changed files with 14 additions and 0 deletions
|
@ -701,6 +701,20 @@ static inline struct dsa_switch *dsa_devlink_to_ds(struct devlink *dl)
|
|||
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 list_head list;
|
||||
const struct dsa_switch_ops *ops;
|
||||
|
|
Loading…
Reference in a new issue