mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-06 14:48:06 +00:00
dsa: pass switch ID through devlink_port_attrs_set()
Pass the switch ID down the to devlink through devlink_port_attrs_set() so it can be used by devlink_compat_switch_id_get(). Leave ndo_get_port_parent_id implementation only for legacy. Signed-off-by: Jiri Pirko <jiri@mellanox.com> Reviewed-by: Florian Fainelli <f.fainelli@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
df535f4c47
commit
15b04aceeb
2 changed files with 10 additions and 1 deletions
|
@ -260,6 +260,7 @@ static int dsa_port_setup(struct dsa_port *dp)
|
||||||
{
|
{
|
||||||
enum devlink_port_flavour flavour;
|
enum devlink_port_flavour flavour;
|
||||||
struct dsa_switch *ds = dp->ds;
|
struct dsa_switch *ds = dp->ds;
|
||||||
|
struct dsa_switch_tree *dst = ds->dst;
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
if (dp->type == DSA_PORT_TYPE_UNUSED)
|
if (dp->type == DSA_PORT_TYPE_UNUSED)
|
||||||
|
@ -286,7 +287,8 @@ static int dsa_port_setup(struct dsa_port *dp)
|
||||||
* independent from front panel port numbers.
|
* independent from front panel port numbers.
|
||||||
*/
|
*/
|
||||||
devlink_port_attrs_set(&dp->devlink_port, flavour,
|
devlink_port_attrs_set(&dp->devlink_port, flavour,
|
||||||
dp->index, false, 0, NULL, 0);
|
dp->index, false, 0,
|
||||||
|
(const char *) &dst->index, sizeof(dst->index));
|
||||||
err = devlink_port_register(ds->devlink, &dp->devlink_port,
|
err = devlink_port_register(ds->devlink, &dp->devlink_port,
|
||||||
dp->index);
|
dp->index);
|
||||||
if (err)
|
if (err)
|
||||||
|
|
|
@ -379,6 +379,13 @@ static int dsa_slave_get_port_parent_id(struct net_device *dev,
|
||||||
struct dsa_switch *ds = dp->ds;
|
struct dsa_switch *ds = dp->ds;
|
||||||
struct dsa_switch_tree *dst = ds->dst;
|
struct dsa_switch_tree *dst = ds->dst;
|
||||||
|
|
||||||
|
/* For non-legacy ports, devlink is used and it takes
|
||||||
|
* care of the name generation. This ndo implementation
|
||||||
|
* should be removed with legacy support.
|
||||||
|
*/
|
||||||
|
if (dp->ds->devlink)
|
||||||
|
return -EOPNOTSUPP;
|
||||||
|
|
||||||
ppid->id_len = sizeof(dst->index);
|
ppid->id_len = sizeof(dst->index);
|
||||||
memcpy(&ppid->id, &dst->index, ppid->id_len);
|
memcpy(&ppid->id, &dst->index, ppid->id_len);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue