Skip to contentSkip to conversation

devlink: stop using NL_SET_ERR_MSG_MOD

PATCH Applied Jacob Keller 3 participants 3 messages Feb 9, 2023 – Feb 13, 2023

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 devlink: stop using NL_SET_ERR_MSG_MOD

NL_SET_ERR_MSG_MOD inserts the KBUILD_MODNAME and a ':' before the actual extended error message. The devlink feature hasn't been able to be compiled as a module since commit f4b6bcc7002f ("net: devlink: turn devlink into a built-in").

Stop using NL_SET_ERR_MSG_MOD, and just use the base NL_SET_ERR_MSG. This aligns the extended error messages better with the NL_SET_ERR_MSG_ATTR messages as well.

---
From [1] I think we can just stop using the _MOD version in devlink code because its not a module. I haven't yet figured out a good way to handle GENL_REQ_ATTR_CHECK so I've punted on that for now...

[1]: https://lore.kernel.org/netdev/[email protected]/

 net/devlink/dev.c      |  20 +++----
 net/devlink/leftover.c | 115 ++++++++++++++++++++---------------------
 2 files changed, 65 insertions(+), 70 deletions(-)
net/devlink/dev.c +8 -12
index 78d824eda5ec..7cf2de44e02f 100644
@@ -305,7 +305,7 @@ static struct net *devlink_netns_get(struct sk_buff *skb,
 	struct net *net;
 
 	if (!!netns_pid_attr + !!netns_fd_attr + !!netns_id_attr > 1) {
-		NL_SET_ERR_MSG_MOD(info->extack, "multiple netns identifying attributes specified");
+		NL_SET_ERR_MSG(info->extack, "multiple netns identifying attributes specified");
 		return ERR_PTR(-EINVAL);
 	}
 
@@ -323,7 +323,7 @@ static struct net *devlink_netns_get(struct sk_buff *skb,
 		net = ERR_PTR(-EINVAL);
 	}
 	if (IS_ERR(net)) {
-		NL_SET_ERR_MSG_MOD(info->extack, "Unknown network namespace");
+		NL_SET_ERR_MSG(info->extack, "Unknown network namespace");
 		return ERR_PTR(-EINVAL);
 	}
 	if (!netlink_ns_capable(skb, net->user_ns, CAP_NET_ADMIN)) {
@@ -425,7 +425,7 @@ int devlink_nl_cmd_reload(struct sk_buff *skb, struct genl_info *info)
 
 	err = devlink_resources_validate(devlink, NULL, info);
 	if (err) {
-		NL_SET_ERR_MSG_MOD(info->extack, "resources size validation failed");
+		NL_SET_ERR_MSG(info->extack, "resources size validation failed");
 		return err;
 	}
 
@@ -435,8 +435,7 @@ int devlink_nl_cmd_reload(struct sk_buff *skb, struct genl_info *info)
 		action = DEVLINK_RELOAD_ACTION_DRIVER_REINIT;
 
 	if (!devlink_reload_action_is_supported(devlink, action)) {
-		NL_SET_ERR_MSG_MOD(info->extack,
-				   "Requested reload action is not supported by the driver");
+		NL_SET_ERR_MSG(info->extack, "Requested reload action is not supported by the driver");
 		return -EOPNOTSUPP;
 	}
 
@@ -448,7 +447,7 @@ int devlink_nl_cmd_reload(struct sk_buff *skb, struct genl_info *info)
 		limits = nla_get_bitfield32(info->attrs[DEVLINK_ATTR_RELOAD_LIMITS]);
 		limits_selected = limits.value & limits.selector;
 		if (!limits_selected) {
-			NL_SET_ERR_MSG_MOD(info->extack, "Invalid limit selected");
+			NL_SET_ERR_MSG(info->extack, "Invalid limit selected");
 			return -EINVAL;
 		}
 		for (limit = 0 ; limit <= DEVLINK_RELOAD_LIMIT_MAX ; limit++)
@@ -456,18 +455,15 @@ int devlink_nl_cmd_reload(struct sk_buff *skb, struct genl_info *info)
 				break;
 		/* UAPI enables multiselection, but currently it is not used */
 		if (limits_selected != BIT(limit)) {
-			NL_SET_ERR_MSG_MOD(info->extack,
-					   "Multiselection of limit is not supported");
+			NL_SET_ERR_MSG(info->extack, "Multiselection of limit is not supported");
 			return -EOPNOTSUPP;
 		}
 		if (!devlink_reload_limit_is_supported(devlink, limit)) {
-			NL_SET_ERR_MSG_MOD(info->extack,
-					   "Requested limit is not supported by the driver");
+			NL_SET_ERR_MSG(info->extack, "Requested limit is not supported by the driver");
 			return -EOPNOTSUPP;
 		}
 		if (devlink_reload_combination_is_invalid(action, limit)) {
-			NL_SET_ERR_MSG_MOD(info->extack,
-					   "Requested limit is invalid for this action");
+			NL_SET_ERR_MSG(info->extack, "Requested limit is invalid for this action");
 			return -EINVAL;
 		}
 	}
net/devlink/leftover.c +57 -58

417 lines not on this page · raw message

Signature · 1 line
2.39.1.405.gd4c25cc71f83
maintainer Acked-by on v1 1/1
#1 lore raw
Quoted 10 lines · On Thu, 9 Feb 2023 14:20:45 -0800 Jacob Keller wrote:

NL_SET_ERR_MSG_MOD inserts the KBUILD_MODNAME and a ':' before the actual extended error message. The devlink feature hasn't been able to be compiled as a module since commit f4b6bcc7002f ("net: devlink: turn devlink into a built-in").

Stop using NL_SET_ERR_MSG_MOD, and just use the base NL_SET_ERR_MSG. This aligns the extended error messages better with the NL_SET_ERR_MSG_ATTR messages as well.

Thanks!

#2 lore raw
In reply to Jacob Keller
This patch was applied to netdev/net-next.git (master) by David S. Miller <[email protected]>:

Hello:

This patch was applied to netdev/net-next.git (master) by David S. Miller <[email protected]>:

Quoted 10 lines · On Thu, 9 Feb 2023 14:20:45 -0800 you wrote:

NL_SET_ERR_MSG_MOD inserts the KBUILD_MODNAME and a ':' before the actual extended error message. The devlink feature hasn't been able to be compiled as a module since commit f4b6bcc7002f ("net: devlink: turn devlink into a built-in").

Stop using NL_SET_ERR_MSG_MOD, and just use the base NL_SET_ERR_MSG. This aligns the extended error messages better with the NL_SET_ERR_MSG_ATTR messages as well.

[...]

Here is the summary with links:
- [net-next] devlink: stop using NL_SET_ERR_MSG_MOD

    https://git.kernel.org/netdev/net-next/c/6d86bb0a5cb8

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html