Skip to content

Commit 4b23258

Browse files
jpirkodavem330
authored andcommitted
mlxsw: spectrum_acl: Pass mlxsw_sp_port down to ruleset bind/unbind ops
No need to convert from mlxsw_sp_port to net_device and back again. Signed-off-by: Jiri Pirko <[email protected]> Acked-by: David Ahern <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 3aaff32 commit 4b23258

File tree

3 files changed

+17
-20
lines changed

3 files changed

+17
-20
lines changed

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -470,9 +470,11 @@ struct mlxsw_sp_acl_profile_ops {
470470
void *priv, void *ruleset_priv);
471471
void (*ruleset_del)(struct mlxsw_sp *mlxsw_sp, void *ruleset_priv);
472472
int (*ruleset_bind)(struct mlxsw_sp *mlxsw_sp, void *ruleset_priv,
473-
struct net_device *dev, bool ingress);
473+
struct mlxsw_sp_port *mlxsw_sp_port,
474+
bool ingress);
474475
void (*ruleset_unbind)(struct mlxsw_sp *mlxsw_sp, void *ruleset_priv,
475-
struct net_device *dev, bool ingress);
476+
struct mlxsw_sp_port *mlxsw_sp_port,
477+
bool ingress);
476478
u16 (*ruleset_group_id)(void *ruleset_priv);
477479
size_t rule_priv_size;
478480
int (*rule_add)(struct mlxsw_sp *mlxsw_sp,

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ mlxsw_sp_acl_ruleset_bind(struct mlxsw_sp *mlxsw_sp,
169169
const struct mlxsw_sp_acl_profile_ops *ops = ruleset->ht_key.ops;
170170

171171
return ops->ruleset_bind(mlxsw_sp, ruleset->priv,
172-
binding->mlxsw_sp_port->dev, binding->ingress);
172+
binding->mlxsw_sp_port, binding->ingress);
173173
}
174174

175175
static void
@@ -181,7 +181,7 @@ mlxsw_sp_acl_ruleset_unbind(struct mlxsw_sp *mlxsw_sp,
181181
const struct mlxsw_sp_acl_profile_ops *ops = ruleset->ht_key.ops;
182182

183183
ops->ruleset_unbind(mlxsw_sp, ruleset->priv,
184-
binding->mlxsw_sp_port->dev, binding->ingress);
184+
binding->mlxsw_sp_port, binding->ingress);
185185
}
186186

187187
static bool mlxsw_sp_acl_ruleset_block_bound(struct mlxsw_sp_acl_block *block)

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

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -258,15 +258,11 @@ static void mlxsw_sp_acl_tcam_group_del(struct mlxsw_sp *mlxsw_sp,
258258
static int
259259
mlxsw_sp_acl_tcam_group_bind(struct mlxsw_sp *mlxsw_sp,
260260
struct mlxsw_sp_acl_tcam_group *group,
261-
struct net_device *dev, bool ingress)
261+
struct mlxsw_sp_port *mlxsw_sp_port,
262+
bool ingress)
262263
{
263-
struct mlxsw_sp_port *mlxsw_sp_port;
264264
char ppbt_pl[MLXSW_REG_PPBT_LEN];
265265

266-
if (!mlxsw_sp_port_dev_check(dev))
267-
return -EINVAL;
268-
269-
mlxsw_sp_port = netdev_priv(dev);
270266
mlxsw_reg_ppbt_pack(ppbt_pl, ingress ? MLXSW_REG_PXBT_E_IACL :
271267
MLXSW_REG_PXBT_E_EACL,
272268
MLXSW_REG_PXBT_OP_BIND, mlxsw_sp_port->local_port,
@@ -277,15 +273,11 @@ mlxsw_sp_acl_tcam_group_bind(struct mlxsw_sp *mlxsw_sp,
277273
static void
278274
mlxsw_sp_acl_tcam_group_unbind(struct mlxsw_sp *mlxsw_sp,
279275
struct mlxsw_sp_acl_tcam_group *group,
280-
struct net_device *dev, bool ingress)
276+
struct mlxsw_sp_port *mlxsw_sp_port,
277+
bool ingress)
281278
{
282-
struct mlxsw_sp_port *mlxsw_sp_port;
283279
char ppbt_pl[MLXSW_REG_PPBT_LEN];
284280

285-
if (WARN_ON(!mlxsw_sp_port_dev_check(dev)))
286-
return;
287-
288-
mlxsw_sp_port = netdev_priv(dev);
289281
mlxsw_reg_ppbt_pack(ppbt_pl, ingress ? MLXSW_REG_PXBT_E_IACL :
290282
MLXSW_REG_PXBT_E_EACL,
291283
MLXSW_REG_PXBT_OP_UNBIND, mlxsw_sp_port->local_port,
@@ -1054,22 +1046,25 @@ mlxsw_sp_acl_tcam_flower_ruleset_del(struct mlxsw_sp *mlxsw_sp,
10541046
static int
10551047
mlxsw_sp_acl_tcam_flower_ruleset_bind(struct mlxsw_sp *mlxsw_sp,
10561048
void *ruleset_priv,
1057-
struct net_device *dev, bool ingress)
1049+
struct mlxsw_sp_port *mlxsw_sp_port,
1050+
bool ingress)
10581051
{
10591052
struct mlxsw_sp_acl_tcam_flower_ruleset *ruleset = ruleset_priv;
10601053

10611054
return mlxsw_sp_acl_tcam_group_bind(mlxsw_sp, &ruleset->group,
1062-
dev, ingress);
1055+
mlxsw_sp_port, ingress);
10631056
}
10641057

10651058
static void
10661059
mlxsw_sp_acl_tcam_flower_ruleset_unbind(struct mlxsw_sp *mlxsw_sp,
10671060
void *ruleset_priv,
1068-
struct net_device *dev, bool ingress)
1061+
struct mlxsw_sp_port *mlxsw_sp_port,
1062+
bool ingress)
10691063
{
10701064
struct mlxsw_sp_acl_tcam_flower_ruleset *ruleset = ruleset_priv;
10711065

1072-
mlxsw_sp_acl_tcam_group_unbind(mlxsw_sp, &ruleset->group, dev, ingress);
1066+
mlxsw_sp_acl_tcam_group_unbind(mlxsw_sp, &ruleset->group,
1067+
mlxsw_sp_port, ingress);
10731068
}
10741069

10751070
static u16

0 commit comments

Comments
 (0)