[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230524121836.2070879-16-jiri@resnulli.us>
Date: Wed, 24 May 2023 14:18:36 +0200
From: Jiri Pirko <jiri@...nulli.us>
To: netdev@...r.kernel.org
Cc: kuba@...nel.org,
pabeni@...hat.com,
davem@...emloft.net,
edumazet@...gle.com,
leon@...nel.org,
saeedm@...dia.com,
moshe@...dia.com,
jesse.brandeburg@...el.com,
anthony.l.nguyen@...el.com,
tariqt@...dia.com,
idosch@...dia.com,
petrm@...dia.com,
simon.horman@...igine.com,
ecree.xilinx@...il.com,
habetsm.xilinx@...il.com,
michal.wilczynski@...el.com,
jacob.e.keller@...el.com
Subject: [patch net-next 15/15] devlink: save devlink_port_ops into a variable in devlink_port_function_validate()
From: Jiri Pirko <jiri@...dia.com>
Now when the original ops variable is removed, introduce it again
but this time for devlink_port_ops.
Signed-off-by: Jiri Pirko <jiri@...dia.com>
---
net/devlink/leftover.c | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/net/devlink/leftover.c b/net/devlink/leftover.c
index b35dee4dddbc..fd2b1a40b61e 100644
--- a/net/devlink/leftover.c
+++ b/net/devlink/leftover.c
@@ -1185,16 +1185,17 @@ static int devlink_port_function_validate(struct devlink_port *devlink_port,
struct nlattr **tb,
struct netlink_ext_ack *extack)
{
+ const struct devlink_port_ops *ops = devlink_port->ops;
struct nlattr *attr;
if (tb[DEVLINK_PORT_FUNCTION_ATTR_HW_ADDR] &&
- (!devlink_port->ops || !devlink_port->ops->port_fn_hw_addr_set)) {
+ (!ops || !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;
}
if (tb[DEVLINK_PORT_FN_ATTR_STATE] &&
- (!devlink_port->ops || !devlink_port->ops->port_fn_state_set)) {
+ (!ops || !ops->port_fn_state_set)) {
NL_SET_ERR_MSG_ATTR(extack, tb[DEVLINK_PORT_FUNCTION_ATTR_HW_ADDR],
"Function does not support state setting");
return -EOPNOTSUPP;
@@ -1205,15 +1206,13 @@ static int devlink_port_function_validate(struct devlink_port *devlink_port,
caps = nla_get_bitfield32(attr);
if (caps.selector & DEVLINK_PORT_FN_CAP_ROCE &&
- (!devlink_port->ops ||
- !devlink_port->ops->port_fn_roce_set)) {
+ (!ops || !ops->port_fn_roce_set)) {
NL_SET_ERR_MSG_ATTR(extack, attr,
"Port doesn't support RoCE function attribute");
return -EOPNOTSUPP;
}
if (caps.selector & DEVLINK_PORT_FN_CAP_MIGRATABLE) {
- if (!devlink_port->ops ||
- !devlink_port->ops->port_fn_migratable_set) {
+ if (!ops || !ops->port_fn_migratable_set) {
NL_SET_ERR_MSG_ATTR(extack, attr,
"Port doesn't support migratable function attribute");
return -EOPNOTSUPP;
--
2.39.2
Powered by blists - more mailing lists