Skip to content

Commit

Permalink
devlink: extend devlink_nl_put_nested_handle() with attrtype arg
Browse files Browse the repository at this point in the history
As the next patch is going to call this helper with need to fill another
type of nested attribute, pass it over function arg.

Signed-off-by: Jiri Pirko <jiri@nvidia.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Jiri Pirko authored and David S. Miller committed Sep 17, 2023
1 parent af1f140 commit 1c2197c
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion net/devlink/devl_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ devlink_nl_put_handle(struct sk_buff *msg, struct devlink *devlink)
}

int devlink_nl_put_nested_handle(struct sk_buff *msg, struct net *net,
struct devlink *devlink);
struct devlink *devlink, int attrtype);
int devlink_nl_msg_reply_and_new(struct sk_buff **msg, struct genl_info *info);

/* Notify */
Expand Down
3 changes: 2 additions & 1 deletion net/devlink/linecard.c
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,8 @@ static int devlink_nl_linecard_fill(struct sk_buff *msg,

if (linecard->nested_devlink &&
devlink_nl_put_nested_handle(msg, devlink_net(devlink),
linecard->nested_devlink))
linecard->nested_devlink,
DEVLINK_ATTR_NESTED_DEVLINK))
goto nla_put_failure;

genlmsg_end(msg, hdr);
Expand Down
4 changes: 2 additions & 2 deletions net/devlink/netlink.c
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,11 @@ static const struct nla_policy devlink_nl_policy[DEVLINK_ATTR_MAX + 1] = {
};

int devlink_nl_put_nested_handle(struct sk_buff *msg, struct net *net,
struct devlink *devlink)
struct devlink *devlink, int attrtype)
{
struct nlattr *nested_attr;

nested_attr = nla_nest_start(msg, DEVLINK_ATTR_NESTED_DEVLINK);
nested_attr = nla_nest_start(msg, attrtype);
if (!nested_attr)
return -EMSGSIZE;
if (devlink_nl_put_handle(msg, devlink))
Expand Down

0 comments on commit 1c2197c

Please sign in to comment.