Skip to content

Commit 02caf49

Browse files
jpirkodavem330
authored andcommitted
mlxsw: spectrum_acl: Don't store netdev and ingress for ruleset unbind
Instead, pass netdev and ingress flag to ruleset unbind op. Signed-off-by: Jiri Pirko <[email protected]> Acked-by: David Ahern <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 9fe5fdf commit 02caf49

File tree

3 files changed

+24
-21
lines changed

3 files changed

+24
-21
lines changed

drivers/net/ethernet/mellanox/mlxsw/spectrum.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -469,7 +469,8 @@ struct mlxsw_sp_acl_profile_ops {
469469
void (*ruleset_del)(struct mlxsw_sp *mlxsw_sp, void *ruleset_priv);
470470
int (*ruleset_bind)(struct mlxsw_sp *mlxsw_sp, void *ruleset_priv,
471471
struct net_device *dev, bool ingress);
472-
void (*ruleset_unbind)(struct mlxsw_sp *mlxsw_sp, void *ruleset_priv);
472+
void (*ruleset_unbind)(struct mlxsw_sp *mlxsw_sp, void *ruleset_priv,
473+
struct net_device *dev, bool ingress);
473474
u16 (*ruleset_group_id)(void *ruleset_priv);
474475
size_t rule_priv_size;
475476
int (*rule_add)(struct mlxsw_sp *mlxsw_sp,

drivers/net/ethernet/mellanox/mlxsw/spectrum_acl.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -128,11 +128,12 @@ static int mlxsw_sp_acl_ruleset_bind(struct mlxsw_sp *mlxsw_sp,
128128
}
129129

130130
static void mlxsw_sp_acl_ruleset_unbind(struct mlxsw_sp *mlxsw_sp,
131-
struct mlxsw_sp_acl_ruleset *ruleset)
131+
struct mlxsw_sp_acl_ruleset *ruleset,
132+
struct net_device *dev, bool ingress)
132133
{
133134
const struct mlxsw_sp_acl_profile_ops *ops = ruleset->ht_key.ops;
134135

135-
ops->ruleset_unbind(mlxsw_sp, ruleset->priv);
136+
ops->ruleset_unbind(mlxsw_sp, ruleset->priv, dev, ingress);
136137
}
137138

138139
static struct mlxsw_sp_acl_ruleset *
@@ -200,7 +201,9 @@ static void mlxsw_sp_acl_ruleset_destroy(struct mlxsw_sp *mlxsw_sp,
200201
struct mlxsw_sp_acl *acl = mlxsw_sp->acl;
201202

202203
if (!ruleset->ht_key.chain_index)
203-
mlxsw_sp_acl_ruleset_unbind(mlxsw_sp, ruleset);
204+
mlxsw_sp_acl_ruleset_unbind(mlxsw_sp, ruleset,
205+
ruleset->ht_key.dev,
206+
ruleset->ht_key.ingress);
204207
rhashtable_remove_fast(&acl->ruleset_ht, &ruleset->ht_node,
205208
mlxsw_sp_acl_ruleset_ht_params);
206209
ops->ruleset_del(mlxsw_sp, ruleset->priv);

drivers/net/ethernet/mellanox/mlxsw/spectrum_acl_tcam.c

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -154,10 +154,6 @@ struct mlxsw_sp_acl_tcam_group {
154154
struct list_head region_list;
155155
unsigned int region_count;
156156
struct rhashtable chunk_ht;
157-
struct {
158-
u16 local_port;
159-
bool ingress;
160-
} bound;
161157
struct mlxsw_sp_acl_tcam_group_ops *ops;
162158
const struct mlxsw_sp_acl_tcam_pattern *patterns;
163159
unsigned int patterns_count;
@@ -271,26 +267,28 @@ mlxsw_sp_acl_tcam_group_bind(struct mlxsw_sp *mlxsw_sp,
271267
return -EINVAL;
272268

273269
mlxsw_sp_port = netdev_priv(dev);
274-
group->bound.local_port = mlxsw_sp_port->local_port;
275-
group->bound.ingress = ingress;
276-
mlxsw_reg_ppbt_pack(ppbt_pl,
277-
group->bound.ingress ? MLXSW_REG_PXBT_E_IACL :
278-
MLXSW_REG_PXBT_E_EACL,
279-
MLXSW_REG_PXBT_OP_BIND, group->bound.local_port,
270+
mlxsw_reg_ppbt_pack(ppbt_pl, ingress ? MLXSW_REG_PXBT_E_IACL :
271+
MLXSW_REG_PXBT_E_EACL,
272+
MLXSW_REG_PXBT_OP_BIND, mlxsw_sp_port->local_port,
280273
group->id);
281274
return mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(ppbt), ppbt_pl);
282275
}
283276

284277
static void
285278
mlxsw_sp_acl_tcam_group_unbind(struct mlxsw_sp *mlxsw_sp,
286-
struct mlxsw_sp_acl_tcam_group *group)
279+
struct mlxsw_sp_acl_tcam_group *group,
280+
struct net_device *dev, bool ingress)
287281
{
282+
struct mlxsw_sp_port *mlxsw_sp_port;
288283
char ppbt_pl[MLXSW_REG_PPBT_LEN];
289284

290-
mlxsw_reg_ppbt_pack(ppbt_pl,
291-
group->bound.ingress ? MLXSW_REG_PXBT_E_IACL :
292-
MLXSW_REG_PXBT_E_EACL,
293-
MLXSW_REG_PXBT_OP_UNBIND, group->bound.local_port,
285+
if (WARN_ON(!mlxsw_sp_port_dev_check(dev)))
286+
return;
287+
288+
mlxsw_sp_port = netdev_priv(dev);
289+
mlxsw_reg_ppbt_pack(ppbt_pl, ingress ? MLXSW_REG_PXBT_E_IACL :
290+
MLXSW_REG_PXBT_E_EACL,
291+
MLXSW_REG_PXBT_OP_UNBIND, mlxsw_sp_port->local_port,
294292
group->id);
295293
mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(ppbt), ppbt_pl);
296294
}
@@ -1066,11 +1064,12 @@ mlxsw_sp_acl_tcam_flower_ruleset_bind(struct mlxsw_sp *mlxsw_sp,
10661064

10671065
static void
10681066
mlxsw_sp_acl_tcam_flower_ruleset_unbind(struct mlxsw_sp *mlxsw_sp,
1069-
void *ruleset_priv)
1067+
void *ruleset_priv,
1068+
struct net_device *dev, bool ingress)
10701069
{
10711070
struct mlxsw_sp_acl_tcam_flower_ruleset *ruleset = ruleset_priv;
10721071

1073-
mlxsw_sp_acl_tcam_group_unbind(mlxsw_sp, &ruleset->group);
1072+
mlxsw_sp_acl_tcam_group_unbind(mlxsw_sp, &ruleset->group, dev, ingress);
10741073
}
10751074

10761075
static u16

0 commit comments

Comments
 (0)