Commit 3a5e5234 authored by Jiri Pirko's avatar Jiri Pirko Committed by David S. Miller

devlink: remove pointless data_len arg from region snapshot create

The size of the snapshot has to be the same as the size of the region,
therefore no need to pass it again during snapshot creation. Remove the
arg and use region->size instead.
Signed-off-by: default avatarJiri Pirko <jiri@mellanox.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 1a991488
...@@ -99,8 +99,7 @@ static void mlx4_crdump_collect_crspace(struct mlx4_dev *dev, ...@@ -99,8 +99,7 @@ static void mlx4_crdump_collect_crspace(struct mlx4_dev *dev,
readl(cr_space + offset); readl(cr_space + offset);
err = devlink_region_snapshot_create(crdump->region_crspace, err = devlink_region_snapshot_create(crdump->region_crspace,
cr_res_size, crspace_data, crspace_data, id, &kvfree);
id, &kvfree);
if (err) { if (err) {
kvfree(crspace_data); kvfree(crspace_data);
mlx4_warn(dev, "crdump: devlink create %s snapshot id %d err %d\n", mlx4_warn(dev, "crdump: devlink create %s snapshot id %d err %d\n",
...@@ -139,9 +138,7 @@ static void mlx4_crdump_collect_fw_health(struct mlx4_dev *dev, ...@@ -139,9 +138,7 @@ static void mlx4_crdump_collect_fw_health(struct mlx4_dev *dev,
readl(health_buf_start + offset); readl(health_buf_start + offset);
err = devlink_region_snapshot_create(crdump->region_fw_health, err = devlink_region_snapshot_create(crdump->region_fw_health,
HEALTH_BUFFER_SIZE, health_data, id, &kvfree);
health_data,
id, &kvfree);
if (err) { if (err) {
kvfree(health_data); kvfree(health_data);
mlx4_warn(dev, "crdump: devlink create %s snapshot id %d err %d\n", mlx4_warn(dev, "crdump: devlink create %s snapshot id %d err %d\n",
......
...@@ -702,7 +702,7 @@ struct devlink_region *devlink_region_create(struct devlink *devlink, ...@@ -702,7 +702,7 @@ struct devlink_region *devlink_region_create(struct devlink *devlink,
u64 region_size); u64 region_size);
void devlink_region_destroy(struct devlink_region *region); void devlink_region_destroy(struct devlink_region *region);
u32 devlink_region_shapshot_id_get(struct devlink *devlink); u32 devlink_region_shapshot_id_get(struct devlink *devlink);
int devlink_region_snapshot_create(struct devlink_region *region, u64 data_len, int devlink_region_snapshot_create(struct devlink_region *region,
u8 *data, u32 snapshot_id, u8 *data, u32 snapshot_id,
devlink_snapshot_data_dest_t *data_destructor); devlink_snapshot_data_dest_t *data_destructor);
int devlink_info_serial_number_put(struct devlink_info_req *req, int devlink_info_serial_number_put(struct devlink_info_req *req,
......
...@@ -342,7 +342,6 @@ struct devlink_snapshot { ...@@ -342,7 +342,6 @@ struct devlink_snapshot {
struct list_head list; struct list_head list;
struct devlink_region *region; struct devlink_region *region;
devlink_snapshot_data_dest_t *data_destructor; devlink_snapshot_data_dest_t *data_destructor;
u64 data_len;
u8 *data; u8 *data;
u32 id; u32 id;
}; };
...@@ -3748,8 +3747,8 @@ static int devlink_nl_region_read_snapshot_fill(struct sk_buff *skb, ...@@ -3748,8 +3747,8 @@ static int devlink_nl_region_read_snapshot_fill(struct sk_buff *skb,
if (!snapshot) if (!snapshot)
return -EINVAL; return -EINVAL;
if (end_offset > snapshot->data_len || dump) if (end_offset > region->size || dump)
end_offset = snapshot->data_len; end_offset = region->size;
while (curr_offset < end_offset) { while (curr_offset < end_offset) {
u32 data_size; u32 data_size;
...@@ -6784,12 +6783,11 @@ EXPORT_SYMBOL_GPL(devlink_region_shapshot_id_get); ...@@ -6784,12 +6783,11 @@ EXPORT_SYMBOL_GPL(devlink_region_shapshot_id_get);
* The @snapshot_id should be obtained using the getter function. * The @snapshot_id should be obtained using the getter function.
* *
* @region: devlink region of the snapshot * @region: devlink region of the snapshot
* @data_len: size of snapshot data
* @data: snapshot data * @data: snapshot data
* @snapshot_id: snapshot id to be created * @snapshot_id: snapshot id to be created
* @data_destructor: pointer to destructor function to free data * @data_destructor: pointer to destructor function to free data
*/ */
int devlink_region_snapshot_create(struct devlink_region *region, u64 data_len, int devlink_region_snapshot_create(struct devlink_region *region,
u8 *data, u32 snapshot_id, u8 *data, u32 snapshot_id,
devlink_snapshot_data_dest_t *data_destructor) devlink_snapshot_data_dest_t *data_destructor)
{ {
...@@ -6819,7 +6817,6 @@ int devlink_region_snapshot_create(struct devlink_region *region, u64 data_len, ...@@ -6819,7 +6817,6 @@ int devlink_region_snapshot_create(struct devlink_region *region, u64 data_len,
snapshot->id = snapshot_id; snapshot->id = snapshot_id;
snapshot->region = region; snapshot->region = region;
snapshot->data = data; snapshot->data = data;
snapshot->data_len = data_len;
snapshot->data_destructor = data_destructor; snapshot->data_destructor = data_destructor;
list_add_tail(&snapshot->list, &region->snapshot_list); list_add_tail(&snapshot->list, &region->snapshot_list);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment