diff options
author | Jiri Pirko <jiri@mellanox.com> | 2018-01-17 05:46:55 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2018-01-17 14:53:57 -0500 |
commit | 02caf4995ad07c592d5bbf045f6198c08cd63e87 (patch) | |
tree | 4ae1fa52d8472cea293317f6f6b1c90a2d9a8b87 | |
parent | 9fe5fdf27e543c340d97f69f379bcd29a59f5723 (diff) |
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 <jiri@mellanox.com>
Acked-by: David Ahern <dsahern@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/net/ethernet/mellanox/mlxsw/spectrum.h | 3 | ||||
-rw-r--r-- | drivers/net/ethernet/mellanox/mlxsw/spectrum_acl.c | 9 | ||||
-rw-r--r-- | drivers/net/ethernet/mellanox/mlxsw/spectrum_acl_tcam.c | 33 |
3 files changed, 24 insertions, 21 deletions
diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum.h b/drivers/net/ethernet/mellanox/mlxsw/spectrum.h index 237cad373dbe..a21613de094a 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/spectrum.h +++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum.h | |||
@@ -469,7 +469,8 @@ struct mlxsw_sp_acl_profile_ops { | |||
469 | void (*ruleset_del)(struct mlxsw_sp *mlxsw_sp, void *ruleset_priv); | 469 | void (*ruleset_del)(struct mlxsw_sp *mlxsw_sp, void *ruleset_priv); |
470 | int (*ruleset_bind)(struct mlxsw_sp *mlxsw_sp, void *ruleset_priv, | 470 | int (*ruleset_bind)(struct mlxsw_sp *mlxsw_sp, void *ruleset_priv, |
471 | struct net_device *dev, bool ingress); | 471 | 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); | ||
473 | u16 (*ruleset_group_id)(void *ruleset_priv); | 474 | u16 (*ruleset_group_id)(void *ruleset_priv); |
474 | size_t rule_priv_size; | 475 | size_t rule_priv_size; |
475 | int (*rule_add)(struct mlxsw_sp *mlxsw_sp, | 476 | int (*rule_add)(struct mlxsw_sp *mlxsw_sp, |
diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_acl.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_acl.c index ead4cb8cc386..7fb41a4ef0b3 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_acl.c +++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_acl.c | |||
@@ -128,11 +128,12 @@ static int mlxsw_sp_acl_ruleset_bind(struct mlxsw_sp *mlxsw_sp, | |||
128 | } | 128 | } |
129 | 129 | ||
130 | static void mlxsw_sp_acl_ruleset_unbind(struct mlxsw_sp *mlxsw_sp, | 130 | 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) | ||
132 | { | 133 | { |
133 | const struct mlxsw_sp_acl_profile_ops *ops = ruleset->ht_key.ops; | 134 | const struct mlxsw_sp_acl_profile_ops *ops = ruleset->ht_key.ops; |
134 | 135 | ||
135 | ops->ruleset_unbind(mlxsw_sp, ruleset->priv); | 136 | ops->ruleset_unbind(mlxsw_sp, ruleset->priv, dev, ingress); |
136 | } | 137 | } |
137 | 138 | ||
138 | static struct mlxsw_sp_acl_ruleset * | 139 | static struct mlxsw_sp_acl_ruleset * |
@@ -200,7 +201,9 @@ static void mlxsw_sp_acl_ruleset_destroy(struct mlxsw_sp *mlxsw_sp, | |||
200 | struct mlxsw_sp_acl *acl = mlxsw_sp->acl; | 201 | struct mlxsw_sp_acl *acl = mlxsw_sp->acl; |
201 | 202 | ||
202 | if (!ruleset->ht_key.chain_index) | 203 | 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); | ||
204 | rhashtable_remove_fast(&acl->ruleset_ht, &ruleset->ht_node, | 207 | rhashtable_remove_fast(&acl->ruleset_ht, &ruleset->ht_node, |
205 | mlxsw_sp_acl_ruleset_ht_params); | 208 | mlxsw_sp_acl_ruleset_ht_params); |
206 | ops->ruleset_del(mlxsw_sp, ruleset->priv); | 209 | ops->ruleset_del(mlxsw_sp, ruleset->priv); |
diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_acl_tcam.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_acl_tcam.c index 7e8284b46968..50b2f9add20a 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_acl_tcam.c +++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_acl_tcam.c | |||
@@ -154,10 +154,6 @@ struct mlxsw_sp_acl_tcam_group { | |||
154 | struct list_head region_list; | 154 | struct list_head region_list; |
155 | unsigned int region_count; | 155 | unsigned int region_count; |
156 | struct rhashtable chunk_ht; | 156 | struct rhashtable chunk_ht; |
157 | struct { | ||
158 | u16 local_port; | ||
159 | bool ingress; | ||
160 | } bound; | ||
161 | struct mlxsw_sp_acl_tcam_group_ops *ops; | 157 | struct mlxsw_sp_acl_tcam_group_ops *ops; |
162 | const struct mlxsw_sp_acl_tcam_pattern *patterns; | 158 | const struct mlxsw_sp_acl_tcam_pattern *patterns; |
163 | unsigned int patterns_count; | 159 | unsigned int patterns_count; |
@@ -271,26 +267,28 @@ mlxsw_sp_acl_tcam_group_bind(struct mlxsw_sp *mlxsw_sp, | |||
271 | return -EINVAL; | 267 | return -EINVAL; |
272 | 268 | ||
273 | mlxsw_sp_port = netdev_priv(dev); | 269 | mlxsw_sp_port = netdev_priv(dev); |
274 | group->bound.local_port = mlxsw_sp_port->local_port; | 270 | mlxsw_reg_ppbt_pack(ppbt_pl, ingress ? MLXSW_REG_PXBT_E_IACL : |
275 | group->bound.ingress = ingress; | 271 | MLXSW_REG_PXBT_E_EACL, |
276 | mlxsw_reg_ppbt_pack(ppbt_pl, | 272 | MLXSW_REG_PXBT_OP_BIND, mlxsw_sp_port->local_port, |
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, | ||
280 | group->id); | 273 | group->id); |
281 | return mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(ppbt), ppbt_pl); | 274 | return mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(ppbt), ppbt_pl); |
282 | } | 275 | } |
283 | 276 | ||
284 | static void | 277 | static void |
285 | mlxsw_sp_acl_tcam_group_unbind(struct mlxsw_sp *mlxsw_sp, | 278 | 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) | ||
287 | { | 281 | { |
282 | struct mlxsw_sp_port *mlxsw_sp_port; | ||
288 | char ppbt_pl[MLXSW_REG_PPBT_LEN]; | 283 | char ppbt_pl[MLXSW_REG_PPBT_LEN]; |
289 | 284 | ||
290 | mlxsw_reg_ppbt_pack(ppbt_pl, | 285 | if (WARN_ON(!mlxsw_sp_port_dev_check(dev))) |
291 | group->bound.ingress ? MLXSW_REG_PXBT_E_IACL : | 286 | return; |
292 | MLXSW_REG_PXBT_E_EACL, | 287 | |
293 | MLXSW_REG_PXBT_OP_UNBIND, group->bound.local_port, | 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, | ||
294 | group->id); | 292 | group->id); |
295 | mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(ppbt), ppbt_pl); | 293 | mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(ppbt), ppbt_pl); |
296 | } | 294 | } |
@@ -1066,11 +1064,12 @@ mlxsw_sp_acl_tcam_flower_ruleset_bind(struct mlxsw_sp *mlxsw_sp, | |||
1066 | 1064 | ||
1067 | static void | 1065 | static void |
1068 | mlxsw_sp_acl_tcam_flower_ruleset_unbind(struct mlxsw_sp *mlxsw_sp, | 1066 | 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) | ||
1070 | { | 1069 | { |
1071 | struct mlxsw_sp_acl_tcam_flower_ruleset *ruleset = ruleset_priv; | 1070 | struct mlxsw_sp_acl_tcam_flower_ruleset *ruleset = ruleset_priv; |
1072 | 1071 | ||
1073 | mlxsw_sp_acl_tcam_group_unbind(mlxsw_sp, &ruleset->group); | 1072 | mlxsw_sp_acl_tcam_group_unbind(mlxsw_sp, &ruleset->group, dev, ingress); |
1074 | } | 1073 | } |
1075 | 1074 | ||
1076 | static u16 | 1075 | static u16 |