Commit 4b5ed2b5 authored by Jiri Pirko's avatar Jiri Pirko Committed by Jakub Kicinski

devlink: save devlink_port_ops into a variable in devlink_port_function_validate()

Now when the original ops variable is removed, introduce it again
but this time for devlink_port_ops.
Signed-off-by: default avatarJiri Pirko <jiri@nvidia.com>
Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 216ba9f4
...@@ -1185,16 +1185,16 @@ static int devlink_port_function_validate(struct devlink_port *devlink_port, ...@@ -1185,16 +1185,16 @@ static int devlink_port_function_validate(struct devlink_port *devlink_port,
struct nlattr **tb, struct nlattr **tb,
struct netlink_ext_ack *extack) struct netlink_ext_ack *extack)
{ {
const struct devlink_port_ops *ops = devlink_port->ops;
struct nlattr *attr; struct nlattr *attr;
if (tb[DEVLINK_PORT_FUNCTION_ATTR_HW_ADDR] && if (tb[DEVLINK_PORT_FUNCTION_ATTR_HW_ADDR] &&
!devlink_port->ops->port_fn_hw_addr_set) { !ops->port_fn_hw_addr_set) {
NL_SET_ERR_MSG_ATTR(extack, tb[DEVLINK_PORT_FUNCTION_ATTR_HW_ADDR], NL_SET_ERR_MSG_ATTR(extack, tb[DEVLINK_PORT_FUNCTION_ATTR_HW_ADDR],
"Port doesn't support function attributes"); "Port doesn't support function attributes");
return -EOPNOTSUPP; return -EOPNOTSUPP;
} }
if (tb[DEVLINK_PORT_FN_ATTR_STATE] && if (tb[DEVLINK_PORT_FN_ATTR_STATE] && !ops->port_fn_state_set) {
!devlink_port->ops->port_fn_state_set) {
NL_SET_ERR_MSG_ATTR(extack, tb[DEVLINK_PORT_FUNCTION_ATTR_HW_ADDR], NL_SET_ERR_MSG_ATTR(extack, tb[DEVLINK_PORT_FUNCTION_ATTR_HW_ADDR],
"Function does not support state setting"); "Function does not support state setting");
return -EOPNOTSUPP; return -EOPNOTSUPP;
...@@ -1205,13 +1205,13 @@ static int devlink_port_function_validate(struct devlink_port *devlink_port, ...@@ -1205,13 +1205,13 @@ static int devlink_port_function_validate(struct devlink_port *devlink_port,
caps = nla_get_bitfield32(attr); caps = nla_get_bitfield32(attr);
if (caps.selector & DEVLINK_PORT_FN_CAP_ROCE && if (caps.selector & DEVLINK_PORT_FN_CAP_ROCE &&
!devlink_port->ops->port_fn_roce_set) { !ops->port_fn_roce_set) {
NL_SET_ERR_MSG_ATTR(extack, attr, NL_SET_ERR_MSG_ATTR(extack, attr,
"Port doesn't support RoCE function attribute"); "Port doesn't support RoCE function attribute");
return -EOPNOTSUPP; return -EOPNOTSUPP;
} }
if (caps.selector & DEVLINK_PORT_FN_CAP_MIGRATABLE) { if (caps.selector & DEVLINK_PORT_FN_CAP_MIGRATABLE) {
if (!devlink_port->ops->port_fn_migratable_set) { if (!ops->port_fn_migratable_set) {
NL_SET_ERR_MSG_ATTR(extack, attr, NL_SET_ERR_MSG_ATTR(extack, attr,
"Port doesn't support migratable function attribute"); "Port doesn't support migratable function attribute");
return -EOPNOTSUPP; return -EOPNOTSUPP;
......
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