return -EMSGSIZE;
}
-static int devlink_dpipe_send_and_alloc_skb(struct sk_buff **pskb,
- struct genl_info *info)
-{
- int err;
-
- if (*pskb) {
- err = genlmsg_reply(*pskb, info);
- if (err)
- return err;
- }
- *pskb = genlmsg_new(GENLMSG_DEFAULT_SIZE, GFP_KERNEL);
- if (!*pskb)
- return -ENOMEM;
- return 0;
-}
-
static int devlink_dpipe_tables_fill(struct genl_info *info,
enum devlink_command cmd, int flags,
struct list_head *dpipe_tables,
table = list_first_entry(dpipe_tables,
struct devlink_dpipe_table, list);
start_again:
- err = devlink_dpipe_send_and_alloc_skb(&skb, info);
+ err = devlink_nl_msg_reply_and_new(&skb, info);
if (err)
return err;
nlh = nlmsg_put(skb, info->snd_portid, info->snd_seq,
NLMSG_DONE, 0, flags | NLM_F_MULTI);
if (!nlh) {
- err = devlink_dpipe_send_and_alloc_skb(&skb, info);
+ err = devlink_nl_msg_reply_and_new(&skb, info);
if (err)
return err;
goto send_done;
struct devlink *devlink;
int err;
- err = devlink_dpipe_send_and_alloc_skb(&dump_ctx->skb,
- dump_ctx->info);
+ err = devlink_nl_msg_reply_and_new(&dump_ctx->skb,
+ dump_ctx->info);
if (err)
return err;
nlh = nlmsg_put(dump_ctx.skb, info->snd_portid, info->snd_seq,
NLMSG_DONE, 0, flags | NLM_F_MULTI);
if (!nlh) {
- err = devlink_dpipe_send_and_alloc_skb(&dump_ctx.skb, info);
+ err = devlink_nl_msg_reply_and_new(&dump_ctx.skb, info);
if (err)
return err;
goto send_done;
i = 0;
start_again:
- err = devlink_dpipe_send_and_alloc_skb(&skb, info);
+ err = devlink_nl_msg_reply_and_new(&skb, info);
if (err)
return err;
nlh = nlmsg_put(skb, info->snd_portid, info->snd_seq,
NLMSG_DONE, 0, flags | NLM_F_MULTI);
if (!nlh) {
- err = devlink_dpipe_send_and_alloc_skb(&skb, info);
+ err = devlink_nl_msg_reply_and_new(&skb, info);
if (err)
return err;
goto send_done;
resource = list_first_entry(&devlink->resource_list,
struct devlink_resource, list);
start_again:
- err = devlink_dpipe_send_and_alloc_skb(&skb, info);
+ err = devlink_nl_msg_reply_and_new(&skb, info);
if (err)
return err;
nlh = nlmsg_put(skb, info->snd_portid, info->snd_seq,
NLMSG_DONE, 0, flags | NLM_F_MULTI);
if (!nlh) {
- err = devlink_dpipe_send_and_alloc_skb(&skb, info);
+ err = devlink_nl_msg_reply_and_new(&skb, info);
if (err)
return err;
goto send_done;