Skip to content

Commit

Permalink
mlxsw: spectrum_matchall: Put matchall list into substruct of flow st…
Browse files Browse the repository at this point in the history
…ruct

As there are going to be other matchall specific fields in flow
structure, put the existing list field into matchall substruct.

Signed-off-by: Jiri Pirko <[email protected]>
Signed-off-by: Ido Schimmel <[email protected]>
Signed-off-by: Jakub Kicinski <[email protected]>
  • Loading branch information
jpirko authored and kuba-moo committed May 9, 2020
1 parent 593bb84 commit 5a2939b
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
4 changes: 3 additions & 1 deletion drivers/net/ethernet/mellanox/mlxsw/spectrum.h
Original file line number Diff line number Diff line change
Expand Up @@ -636,7 +636,9 @@ struct mlxsw_sp_acl_rule_info {
/* spectrum_flow.c */
struct mlxsw_sp_flow_block {
struct list_head binding_list;
struct list_head mall_list;
struct {
struct list_head list;
} mall;
struct mlxsw_sp_acl_ruleset *ruleset_zero;
struct mlxsw_sp *mlxsw_sp;
unsigned int rule_count;
Expand Down
2 changes: 1 addition & 1 deletion drivers/net/ethernet/mellanox/mlxsw/spectrum_flow.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ mlxsw_sp_flow_block_create(struct mlxsw_sp *mlxsw_sp, struct net *net)
if (!block)
return NULL;
INIT_LIST_HEAD(&block->binding_list);
INIT_LIST_HEAD(&block->mall_list);
INIT_LIST_HEAD(&block->mall.list);
block->mlxsw_sp = mlxsw_sp;
block->net = net;
return block;
Expand Down
10 changes: 5 additions & 5 deletions drivers/net/ethernet/mellanox/mlxsw/spectrum_matchall.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ mlxsw_sp_mall_entry_find(struct mlxsw_sp_flow_block *block, unsigned long cookie
{
struct mlxsw_sp_mall_entry *mall_entry;

list_for_each_entry(mall_entry, &block->mall_list, list)
list_for_each_entry(mall_entry, &block->mall.list, list)
if (mall_entry->cookie == cookie)
return mall_entry;

Expand Down Expand Up @@ -244,7 +244,7 @@ int mlxsw_sp_mall_replace(struct mlxsw_sp_flow_block *block,
block->egress_blocker_rule_count++;
else
block->ingress_blocker_rule_count++;
list_add_tail(&mall_entry->list, &block->mall_list);
list_add_tail(&mall_entry->list, &block->mall.list);
return 0;

rollback:
Expand Down Expand Up @@ -285,15 +285,15 @@ int mlxsw_sp_mall_port_bind(struct mlxsw_sp_flow_block *block,
struct mlxsw_sp_mall_entry *mall_entry;
int err;

list_for_each_entry(mall_entry, &block->mall_list, list) {
list_for_each_entry(mall_entry, &block->mall.list, list) {
err = mlxsw_sp_mall_port_rule_add(mlxsw_sp_port, mall_entry);
if (err)
goto rollback;
}
return 0;

rollback:
list_for_each_entry_continue_reverse(mall_entry, &block->mall_list,
list_for_each_entry_continue_reverse(mall_entry, &block->mall.list,
list)
mlxsw_sp_mall_port_rule_del(mlxsw_sp_port, mall_entry);
return err;
Expand All @@ -304,6 +304,6 @@ void mlxsw_sp_mall_port_unbind(struct mlxsw_sp_flow_block *block,
{
struct mlxsw_sp_mall_entry *mall_entry;

list_for_each_entry(mall_entry, &block->mall_list, list)
list_for_each_entry(mall_entry, &block->mall.list, list)
mlxsw_sp_mall_port_rule_del(mlxsw_sp_port, mall_entry);
}

0 comments on commit 5a2939b

Please sign in to comment.