diff options
author | Jiri Pirko <jiri@nvidia.com> | 2023-05-26 12:28:36 +0200 |
---|---|---|
committer | Jakub Kicinski <kuba@kernel.org> | 2023-05-30 19:32:20 +0200 |
commit | 71c93e37cf3d0528e5d17ecc0b1b07db2086db67 (patch) | |
tree | 55605e6cc1819fff26d481ee7e2318ca23b6a54c /net/devlink | |
parent | mlx5: register devlink ports with ops (diff) | |
download | linux-71c93e37cf3d0528e5d17ecc0b1b07db2086db67.tar.xz linux-71c93e37cf3d0528e5d17ecc0b1b07db2086db67.zip |
devlink: move port_fn_hw_addr_get/set() to devlink_port_ops
Move port_fn_hw_addr_get/set() from devlink_ops into newly introduced
devlink_port_ops.
Signed-off-by: Jiri Pirko <jiri@nvidia.com>
Acked-by: Martin Habets <habetsm.xilinx@gmail.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'net/devlink')
-rw-r--r-- | net/devlink/leftover.c | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/net/devlink/leftover.c b/net/devlink/leftover.c index d69e278ae15a..ac171ea984cc 100644 --- a/net/devlink/leftover.c +++ b/net/devlink/leftover.c @@ -691,8 +691,7 @@ static int devlink_nl_port_attrs_put(struct sk_buff *msg, return 0; } -static int devlink_port_fn_hw_addr_fill(const struct devlink_ops *ops, - struct devlink_port *port, +static int devlink_port_fn_hw_addr_fill(struct devlink_port *port, struct sk_buff *msg, struct netlink_ext_ack *extack, bool *msg_updated) @@ -701,10 +700,10 @@ static int devlink_port_fn_hw_addr_fill(const struct devlink_ops *ops, int hw_addr_len; int err; - if (!ops->port_function_hw_addr_get) + if (!port->ops->port_fn_hw_addr_get) return 0; - err = ops->port_function_hw_addr_get(port, hw_addr, &hw_addr_len, + err = port->ops->port_fn_hw_addr_get(port, hw_addr, &hw_addr_len, extack); if (err) { if (err == -EOPNOTSUPP) @@ -884,8 +883,7 @@ devlink_nl_port_function_attrs_put(struct sk_buff *msg, struct devlink_port *por return -EMSGSIZE; ops = port->devlink->ops; - err = devlink_port_fn_hw_addr_fill(ops, port, msg, extack, - &msg_updated); + err = devlink_port_fn_hw_addr_fill(port, msg, extack, &msg_updated); if (err) goto out; err = devlink_port_fn_caps_fill(ops, port, msg, extack, @@ -1156,7 +1154,6 @@ static int devlink_port_function_hw_addr_set(struct devlink_port *port, const struct nlattr *attr, struct netlink_ext_ack *extack) { - const struct devlink_ops *ops = port->devlink->ops; const u8 *hw_addr; int hw_addr_len; @@ -1177,7 +1174,7 @@ static int devlink_port_function_hw_addr_set(struct devlink_port *port, } } - return ops->port_function_hw_addr_set(port, hw_addr, hw_addr_len, + return port->ops->port_fn_hw_addr_set(port, hw_addr, hw_addr_len, extack); } @@ -1201,7 +1198,7 @@ static int devlink_port_function_validate(struct devlink_port *devlink_port, struct nlattr *attr; if (tb[DEVLINK_PORT_FUNCTION_ATTR_HW_ADDR] && - !ops->port_function_hw_addr_set) { + !devlink_port->ops->port_fn_hw_addr_set) { NL_SET_ERR_MSG_ATTR(extack, tb[DEVLINK_PORT_FUNCTION_ATTR_HW_ADDR], "Port doesn't support function attributes"); return -EOPNOTSUPP; |