Commit 4b23258d authored by Jiri Pirko's avatar Jiri Pirko Committed by David S. Miller

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: default avatarJiri Pirko <jiri@mellanox.com>
Acked-by: default avatarDavid Ahern <dsahern@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 3aaff323
...@@ -470,9 +470,11 @@ struct mlxsw_sp_acl_profile_ops { ...@@ -470,9 +470,11 @@ struct mlxsw_sp_acl_profile_ops {
void *priv, void *ruleset_priv); void *priv, void *ruleset_priv);
void (*ruleset_del)(struct mlxsw_sp *mlxsw_sp, void *ruleset_priv); void (*ruleset_del)(struct mlxsw_sp *mlxsw_sp, void *ruleset_priv);
int (*ruleset_bind)(struct mlxsw_sp *mlxsw_sp, void *ruleset_priv, int (*ruleset_bind)(struct mlxsw_sp *mlxsw_sp, void *ruleset_priv,
struct net_device *dev, bool ingress); struct mlxsw_sp_port *mlxsw_sp_port,
bool ingress);
void (*ruleset_unbind)(struct mlxsw_sp *mlxsw_sp, void *ruleset_priv, void (*ruleset_unbind)(struct mlxsw_sp *mlxsw_sp, void *ruleset_priv,
struct net_device *dev, bool ingress); struct mlxsw_sp_port *mlxsw_sp_port,
bool ingress);
u16 (*ruleset_group_id)(void *ruleset_priv); u16 (*ruleset_group_id)(void *ruleset_priv);
size_t rule_priv_size; size_t rule_priv_size;
int (*rule_add)(struct mlxsw_sp *mlxsw_sp, int (*rule_add)(struct mlxsw_sp *mlxsw_sp,
......
...@@ -169,7 +169,7 @@ mlxsw_sp_acl_ruleset_bind(struct mlxsw_sp *mlxsw_sp, ...@@ -169,7 +169,7 @@ mlxsw_sp_acl_ruleset_bind(struct mlxsw_sp *mlxsw_sp,
const struct mlxsw_sp_acl_profile_ops *ops = ruleset->ht_key.ops; const struct mlxsw_sp_acl_profile_ops *ops = ruleset->ht_key.ops;
return ops->ruleset_bind(mlxsw_sp, ruleset->priv, return ops->ruleset_bind(mlxsw_sp, ruleset->priv,
binding->mlxsw_sp_port->dev, binding->ingress); binding->mlxsw_sp_port, binding->ingress);
} }
static void static void
...@@ -181,7 +181,7 @@ mlxsw_sp_acl_ruleset_unbind(struct mlxsw_sp *mlxsw_sp, ...@@ -181,7 +181,7 @@ mlxsw_sp_acl_ruleset_unbind(struct mlxsw_sp *mlxsw_sp,
const struct mlxsw_sp_acl_profile_ops *ops = ruleset->ht_key.ops; const struct mlxsw_sp_acl_profile_ops *ops = ruleset->ht_key.ops;
ops->ruleset_unbind(mlxsw_sp, ruleset->priv, ops->ruleset_unbind(mlxsw_sp, ruleset->priv,
binding->mlxsw_sp_port->dev, binding->ingress); binding->mlxsw_sp_port, binding->ingress);
} }
static bool mlxsw_sp_acl_ruleset_block_bound(struct mlxsw_sp_acl_block *block) static bool mlxsw_sp_acl_ruleset_block_bound(struct mlxsw_sp_acl_block *block)
......
...@@ -258,15 +258,11 @@ static void mlxsw_sp_acl_tcam_group_del(struct mlxsw_sp *mlxsw_sp, ...@@ -258,15 +258,11 @@ static void mlxsw_sp_acl_tcam_group_del(struct mlxsw_sp *mlxsw_sp,
static int static int
mlxsw_sp_acl_tcam_group_bind(struct mlxsw_sp *mlxsw_sp, mlxsw_sp_acl_tcam_group_bind(struct mlxsw_sp *mlxsw_sp,
struct mlxsw_sp_acl_tcam_group *group, struct mlxsw_sp_acl_tcam_group *group,
struct net_device *dev, bool ingress) struct mlxsw_sp_port *mlxsw_sp_port,
bool ingress)
{ {
struct mlxsw_sp_port *mlxsw_sp_port;
char ppbt_pl[MLXSW_REG_PPBT_LEN]; char ppbt_pl[MLXSW_REG_PPBT_LEN];
if (!mlxsw_sp_port_dev_check(dev))
return -EINVAL;
mlxsw_sp_port = netdev_priv(dev);
mlxsw_reg_ppbt_pack(ppbt_pl, ingress ? MLXSW_REG_PXBT_E_IACL : mlxsw_reg_ppbt_pack(ppbt_pl, ingress ? MLXSW_REG_PXBT_E_IACL :
MLXSW_REG_PXBT_E_EACL, MLXSW_REG_PXBT_E_EACL,
MLXSW_REG_PXBT_OP_BIND, mlxsw_sp_port->local_port, 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, ...@@ -277,15 +273,11 @@ mlxsw_sp_acl_tcam_group_bind(struct mlxsw_sp *mlxsw_sp,
static void static void
mlxsw_sp_acl_tcam_group_unbind(struct mlxsw_sp *mlxsw_sp, mlxsw_sp_acl_tcam_group_unbind(struct mlxsw_sp *mlxsw_sp,
struct mlxsw_sp_acl_tcam_group *group, struct mlxsw_sp_acl_tcam_group *group,
struct net_device *dev, bool ingress) struct mlxsw_sp_port *mlxsw_sp_port,
bool ingress)
{ {
struct mlxsw_sp_port *mlxsw_sp_port;
char ppbt_pl[MLXSW_REG_PPBT_LEN]; char ppbt_pl[MLXSW_REG_PPBT_LEN];
if (WARN_ON(!mlxsw_sp_port_dev_check(dev)))
return;
mlxsw_sp_port = netdev_priv(dev);
mlxsw_reg_ppbt_pack(ppbt_pl, ingress ? MLXSW_REG_PXBT_E_IACL : mlxsw_reg_ppbt_pack(ppbt_pl, ingress ? MLXSW_REG_PXBT_E_IACL :
MLXSW_REG_PXBT_E_EACL, MLXSW_REG_PXBT_E_EACL,
MLXSW_REG_PXBT_OP_UNBIND, mlxsw_sp_port->local_port, 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, ...@@ -1054,22 +1046,25 @@ mlxsw_sp_acl_tcam_flower_ruleset_del(struct mlxsw_sp *mlxsw_sp,
static int static int
mlxsw_sp_acl_tcam_flower_ruleset_bind(struct mlxsw_sp *mlxsw_sp, mlxsw_sp_acl_tcam_flower_ruleset_bind(struct mlxsw_sp *mlxsw_sp,
void *ruleset_priv, void *ruleset_priv,
struct net_device *dev, bool ingress) struct mlxsw_sp_port *mlxsw_sp_port,
bool ingress)
{ {
struct mlxsw_sp_acl_tcam_flower_ruleset *ruleset = ruleset_priv; struct mlxsw_sp_acl_tcam_flower_ruleset *ruleset = ruleset_priv;
return mlxsw_sp_acl_tcam_group_bind(mlxsw_sp, &ruleset->group, return mlxsw_sp_acl_tcam_group_bind(mlxsw_sp, &ruleset->group,
dev, ingress); mlxsw_sp_port, ingress);
} }
static void static void
mlxsw_sp_acl_tcam_flower_ruleset_unbind(struct mlxsw_sp *mlxsw_sp, mlxsw_sp_acl_tcam_flower_ruleset_unbind(struct mlxsw_sp *mlxsw_sp,
void *ruleset_priv, void *ruleset_priv,
struct net_device *dev, bool ingress) struct mlxsw_sp_port *mlxsw_sp_port,
bool ingress)
{ {
struct mlxsw_sp_acl_tcam_flower_ruleset *ruleset = ruleset_priv; struct mlxsw_sp_acl_tcam_flower_ruleset *ruleset = ruleset_priv;
mlxsw_sp_acl_tcam_group_unbind(mlxsw_sp, &ruleset->group, dev, ingress); mlxsw_sp_acl_tcam_group_unbind(mlxsw_sp, &ruleset->group,
mlxsw_sp_port, ingress);
} }
static u16 static u16
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment