aboutsummaryrefslogtreecommitdiffstats
path: root/net/core/devlink.c
diff options
context:
space:
mode:
authorJiri Pirko <jiri@mellanox.com>2019-08-12 14:28:31 +0200
committerJakub Kicinski <jakub.kicinski@netronome.com>2019-08-13 14:55:46 -0700
commit92b49822288134b4cd17a2c02a15ad265b9b327c (patch)
treefe5fc208afaf2c411e17af14e8ec12ea00dc2289 /net/core/devlink.c
parentcaif: no need to check return value of debugfs_create functions (diff)
downloadlinux-dev-92b49822288134b4cd17a2c02a15ad265b9b327c.tar.xz
linux-dev-92b49822288134b4cd17a2c02a15ad265b9b327c.zip
devlink: send notifications for deleted snapshots on region destroy
Currently the notifications for deleted snapshots are sent only in case user deletes a snapshot manually. Send the notifications in case region is destroyed too. Signed-off-by: Jiri Pirko <jiri@mellanox.com> Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Diffstat (limited to 'net/core/devlink.c')
-rw-r--r--net/core/devlink.c23
1 files changed, 12 insertions, 11 deletions
diff --git a/net/core/devlink.c b/net/core/devlink.c
index e8f0b891f000..e3a1ae44f93d 100644
--- a/net/core/devlink.c
+++ b/net/core/devlink.c
@@ -370,14 +370,6 @@ devlink_region_snapshot_get_by_id(struct devlink_region *region, u32 id)
return NULL;
}
-static void devlink_region_snapshot_del(struct devlink_snapshot *snapshot)
-{
- snapshot->region->cur_snapshots--;
- list_del(&snapshot->list);
- (*snapshot->data_destructor)(snapshot->data);
- kfree(snapshot);
-}
-
#define DEVLINK_NL_FLAG_NEED_DEVLINK BIT(0)
#define DEVLINK_NL_FLAG_NEED_PORT BIT(1)
#define DEVLINK_NL_FLAG_NEED_SB BIT(2)
@@ -3595,6 +3587,16 @@ out_free_msg:
nlmsg_free(msg);
}
+static void devlink_region_snapshot_del(struct devlink_region *region,
+ struct devlink_snapshot *snapshot)
+{
+ devlink_nl_region_notify(region, snapshot, DEVLINK_CMD_REGION_DEL);
+ region->cur_snapshots--;
+ list_del(&snapshot->list);
+ (*snapshot->data_destructor)(snapshot->data);
+ kfree(snapshot);
+}
+
static int devlink_nl_cmd_region_get_doit(struct sk_buff *skb,
struct genl_info *info)
{
@@ -3690,8 +3692,7 @@ static int devlink_nl_cmd_region_del(struct sk_buff *skb,
if (!snapshot)
return -EINVAL;
- devlink_nl_region_notify(region, snapshot, DEVLINK_CMD_REGION_DEL);
- devlink_region_snapshot_del(snapshot);
+ devlink_region_snapshot_del(region, snapshot);
return 0;
}
@@ -6743,7 +6744,7 @@ void devlink_region_destroy(struct devlink_region *region)
/* Free all snapshots of region */
list_for_each_entry_safe(snapshot, ts, &region->snapshot_list, list)
- devlink_region_snapshot_del(snapshot);
+ devlink_region_snapshot_del(region, snapshot);
list_del(&region->list);