diff options
author | Jiri Pirko <jiri@nvidia.com> | 2023-08-28 08:16:46 +0200 |
---|---|---|
committer | Jakub Kicinski <kuba@kernel.org> | 2023-08-28 17:02:22 +0200 |
commit | 2475ed158c478c624d8fbc8d639d344a960c1ad8 (patch) | |
tree | 85fe5422675e67b44cd0f8ee469968045d5438c3 /net/devlink/netlink.c | |
parent | devlink: push shared buffer related code into separate file (diff) | |
download | linux-2475ed158c478c624d8fbc8d639d344a960c1ad8.tar.xz linux-2475ed158c478c624d8fbc8d639d344a960c1ad8.zip |
devlink: move and rename devlink_dpipe_send_and_alloc_skb() helper
Since both dpipe and resource code is using this helper, in preparation
for code split to separate files, move
devlink_dpipe_send_and_alloc_skb() helper into netlink.c. Rename it on
the way.
Signed-off-by: Jiri Pirko <jiri@nvidia.com>
Link: https://lore.kernel.org/r/20230828061657.300667-5-jiri@resnulli.us
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to '')
-rw-r--r-- | net/devlink/netlink.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/net/devlink/netlink.c b/net/devlink/netlink.c index 72a5005a64cd..5f57afd31dea 100644 --- a/net/devlink/netlink.c +++ b/net/devlink/netlink.c @@ -82,6 +82,21 @@ static const struct nla_policy devlink_nl_policy[DEVLINK_ATTR_MAX + 1] = { [DEVLINK_ATTR_REGION_DIRECT] = { .type = NLA_FLAG }, }; +int devlink_nl_msg_reply_and_new(struct sk_buff **msg, struct genl_info *info) +{ + int err; + + if (*msg) { + err = genlmsg_reply(*msg, info); + if (err) + return err; + } + *msg = genlmsg_new(GENLMSG_DEFAULT_SIZE, GFP_KERNEL); + if (!*msg) + return -ENOMEM; + return 0; +} + struct devlink * devlink_get_from_attrs_lock(struct net *net, struct nlattr **attrs) { |