devlink: Move dpipe entry clear function into devlink
The entry clear routine can be shared between the drivers, thus it is moved inside devlink. Signed-off-by: Arkadi Sharshevsky <arkadis@mellanox.com> Signed-off-by: Jiri Pirko <jiri@mellanox.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
ffd3cdccf2
commit
3580732448
|
@ -114,26 +114,6 @@ static int mlxsw_sp_dpipe_table_erif_matches_dump(void *priv,
|
||||||
return devlink_dpipe_match_put(skb, &match);
|
return devlink_dpipe_match_put(skb, &match);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void mlxsw_sp_erif_entry_clear(struct devlink_dpipe_entry *entry)
|
|
||||||
{
|
|
||||||
unsigned int value_count, value_index;
|
|
||||||
struct devlink_dpipe_value *value;
|
|
||||||
|
|
||||||
value = entry->action_values;
|
|
||||||
value_count = entry->action_values_count;
|
|
||||||
for (value_index = 0; value_index < value_count; value_index++) {
|
|
||||||
kfree(value[value_index].value);
|
|
||||||
kfree(value[value_index].mask);
|
|
||||||
}
|
|
||||||
|
|
||||||
value = entry->match_values;
|
|
||||||
value_count = entry->match_values_count;
|
|
||||||
for (value_index = 0; value_index < value_count; value_index++) {
|
|
||||||
kfree(value[value_index].value);
|
|
||||||
kfree(value[value_index].mask);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
mlxsw_sp_erif_match_action_prepare(struct devlink_dpipe_match *match,
|
mlxsw_sp_erif_match_action_prepare(struct devlink_dpipe_match *match,
|
||||||
struct devlink_dpipe_action *action)
|
struct devlink_dpipe_action *action)
|
||||||
|
@ -270,12 +250,12 @@ start_again:
|
||||||
goto start_again;
|
goto start_again;
|
||||||
rtnl_unlock();
|
rtnl_unlock();
|
||||||
|
|
||||||
mlxsw_sp_erif_entry_clear(&entry);
|
devlink_dpipe_entry_clear(&entry);
|
||||||
return 0;
|
return 0;
|
||||||
err_entry_append:
|
err_entry_append:
|
||||||
err_entry_get:
|
err_entry_get:
|
||||||
rtnl_unlock();
|
rtnl_unlock();
|
||||||
mlxsw_sp_erif_entry_clear(&entry);
|
devlink_dpipe_entry_clear(&entry);
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -323,6 +323,7 @@ int devlink_dpipe_entry_ctx_prepare(struct devlink_dpipe_dump_ctx *dump_ctx);
|
||||||
int devlink_dpipe_entry_ctx_append(struct devlink_dpipe_dump_ctx *dump_ctx,
|
int devlink_dpipe_entry_ctx_append(struct devlink_dpipe_dump_ctx *dump_ctx,
|
||||||
struct devlink_dpipe_entry *entry);
|
struct devlink_dpipe_entry *entry);
|
||||||
int devlink_dpipe_entry_ctx_close(struct devlink_dpipe_dump_ctx *dump_ctx);
|
int devlink_dpipe_entry_ctx_close(struct devlink_dpipe_dump_ctx *dump_ctx);
|
||||||
|
void devlink_dpipe_entry_clear(struct devlink_dpipe_entry *entry);
|
||||||
int devlink_dpipe_action_put(struct sk_buff *skb,
|
int devlink_dpipe_action_put(struct sk_buff *skb,
|
||||||
struct devlink_dpipe_action *action);
|
struct devlink_dpipe_action *action);
|
||||||
int devlink_dpipe_match_put(struct sk_buff *skb,
|
int devlink_dpipe_match_put(struct sk_buff *skb,
|
||||||
|
@ -448,6 +449,11 @@ devlink_dpipe_entry_ctx_close(struct devlink_dpipe_dump_ctx *dump_ctx)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline void
|
||||||
|
devlink_dpipe_entry_clear(struct devlink_dpipe_entry *entry)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
static inline int
|
static inline int
|
||||||
devlink_dpipe_action_put(struct sk_buff *skb,
|
devlink_dpipe_action_put(struct sk_buff *skb,
|
||||||
struct devlink_dpipe_action *action)
|
struct devlink_dpipe_action *action)
|
||||||
|
|
|
@ -1996,6 +1996,28 @@ int devlink_dpipe_entry_ctx_close(struct devlink_dpipe_dump_ctx *dump_ctx)
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL_GPL(devlink_dpipe_entry_ctx_close);
|
EXPORT_SYMBOL_GPL(devlink_dpipe_entry_ctx_close);
|
||||||
|
|
||||||
|
void devlink_dpipe_entry_clear(struct devlink_dpipe_entry *entry)
|
||||||
|
|
||||||
|
{
|
||||||
|
unsigned int value_count, value_index;
|
||||||
|
struct devlink_dpipe_value *value;
|
||||||
|
|
||||||
|
value = entry->action_values;
|
||||||
|
value_count = entry->action_values_count;
|
||||||
|
for (value_index = 0; value_index < value_count; value_index++) {
|
||||||
|
kfree(value[value_index].value);
|
||||||
|
kfree(value[value_index].mask);
|
||||||
|
}
|
||||||
|
|
||||||
|
value = entry->match_values;
|
||||||
|
value_count = entry->match_values_count;
|
||||||
|
for (value_index = 0; value_index < value_count; value_index++) {
|
||||||
|
kfree(value[value_index].value);
|
||||||
|
kfree(value[value_index].mask);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
EXPORT_SYMBOL(devlink_dpipe_entry_clear);
|
||||||
|
|
||||||
static int devlink_dpipe_entries_fill(struct genl_info *info,
|
static int devlink_dpipe_entries_fill(struct genl_info *info,
|
||||||
enum devlink_command cmd, int flags,
|
enum devlink_command cmd, int flags,
|
||||||
struct devlink_dpipe_table *table)
|
struct devlink_dpipe_table *table)
|
||||||
|
|
Loading…
Reference in New Issue