Commit 10a429ba authored by Danielle Ratson's avatar Danielle Ratson Committed by David S. Miller

devlink: Move set attribute of devlink_port_attrs to devlink_port

The struct devlink_port_attrs holds the attributes of devlink_port.

The 'set' field is not devlink_port's attribute as opposed to most of the
others.

Move 'set' to be devlink_port's field called 'attrs_set'.
Signed-off-by: default avatarDanielle Ratson <danieller@mellanox.com>
Reviewed-by: default avatarJiri Pirko <jiri@mellanox.com>
Signed-off-by: default avatarIdo Schimmel <idosch@mellanox.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent faea30ed
...@@ -65,8 +65,7 @@ struct devlink_port_pci_vf_attrs { ...@@ -65,8 +65,7 @@ struct devlink_port_pci_vf_attrs {
}; };
struct devlink_port_attrs { struct devlink_port_attrs {
u8 set:1, u8 split:1,
split:1,
switch_port:1; switch_port:1;
enum devlink_port_flavour flavour; enum devlink_port_flavour flavour;
struct netdev_phys_item_id switch_id; struct netdev_phys_item_id switch_id;
...@@ -90,6 +89,7 @@ struct devlink_port { ...@@ -90,6 +89,7 @@ struct devlink_port {
enum devlink_port_type desired_type; enum devlink_port_type desired_type;
void *type_dev; void *type_dev;
struct devlink_port_attrs attrs; struct devlink_port_attrs attrs;
u8 attrs_set:1;
struct delayed_work type_warn_dw; struct delayed_work type_warn_dw;
}; };
......
...@@ -528,7 +528,7 @@ static int devlink_nl_port_attrs_put(struct sk_buff *msg, ...@@ -528,7 +528,7 @@ static int devlink_nl_port_attrs_put(struct sk_buff *msg,
{ {
struct devlink_port_attrs *attrs = &devlink_port->attrs; struct devlink_port_attrs *attrs = &devlink_port->attrs;
if (!attrs->set) if (!devlink_port->attrs_set)
return 0; return 0;
if (nla_put_u16(msg, DEVLINK_ATTR_PORT_FLAVOUR, attrs->flavour)) if (nla_put_u16(msg, DEVLINK_ATTR_PORT_FLAVOUR, attrs->flavour))
return -EMSGSIZE; return -EMSGSIZE;
...@@ -7518,7 +7518,7 @@ static int __devlink_port_attrs_set(struct devlink_port *devlink_port, ...@@ -7518,7 +7518,7 @@ static int __devlink_port_attrs_set(struct devlink_port *devlink_port,
if (WARN_ON(devlink_port->registered)) if (WARN_ON(devlink_port->registered))
return -EEXIST; return -EEXIST;
attrs->set = true; devlink_port->attrs_set = true;
attrs->flavour = flavour; attrs->flavour = flavour;
if (switch_id) { if (switch_id) {
attrs->switch_port = true; attrs->switch_port = true;
...@@ -7626,7 +7626,7 @@ static int __devlink_port_phys_port_name_get(struct devlink_port *devlink_port, ...@@ -7626,7 +7626,7 @@ static int __devlink_port_phys_port_name_get(struct devlink_port *devlink_port,
struct devlink_port_attrs *attrs = &devlink_port->attrs; struct devlink_port_attrs *attrs = &devlink_port->attrs;
int n = 0; int n = 0;
if (!attrs->set) if (!devlink_port->attrs_set)
return -EOPNOTSUPP; return -EOPNOTSUPP;
switch (attrs->flavour) { switch (attrs->flavour) {
......
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