Commit 49c958cc authored by Jiri Pirko's avatar Jiri Pirko Committed by David S. Miller

mlxsw: spectrum_acl: Move block helpers into inline header functions

The struct is defined in the header, no need to have the helpers
in the c file. Move the helpers to the header.
Signed-off-by: default avatarJiri Pirko <jiri@mellanox.com>
Signed-off-by: default avatarIdo Schimmel <idosch@mellanox.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 6488f11f
...@@ -677,12 +677,57 @@ struct mlxsw_sp_acl_block { ...@@ -677,12 +677,57 @@ struct mlxsw_sp_acl_block {
}; };
struct mlxsw_afk *mlxsw_sp_acl_afk(struct mlxsw_sp_acl *acl); struct mlxsw_afk *mlxsw_sp_acl_afk(struct mlxsw_sp_acl *acl);
struct mlxsw_sp *mlxsw_sp_acl_block_mlxsw_sp(struct mlxsw_sp_acl_block *block);
unsigned int static inline struct mlxsw_sp *
mlxsw_sp_acl_block_rule_count(const struct mlxsw_sp_acl_block *block); mlxsw_sp_acl_block_mlxsw_sp(struct mlxsw_sp_acl_block *block)
void mlxsw_sp_acl_block_disable_inc(struct mlxsw_sp_acl_block *block); {
void mlxsw_sp_acl_block_disable_dec(struct mlxsw_sp_acl_block *block); return block->mlxsw_sp;
bool mlxsw_sp_acl_block_disabled(const struct mlxsw_sp_acl_block *block); }
static inline unsigned int
mlxsw_sp_acl_block_rule_count(const struct mlxsw_sp_acl_block *block)
{
return block ? block->rule_count : 0;
}
static inline void
mlxsw_sp_acl_block_disable_inc(struct mlxsw_sp_acl_block *block)
{
if (block)
block->disable_count++;
}
static inline void
mlxsw_sp_acl_block_disable_dec(struct mlxsw_sp_acl_block *block)
{
if (block)
block->disable_count--;
}
static inline bool
mlxsw_sp_acl_block_disabled(const struct mlxsw_sp_acl_block *block)
{
return block->disable_count;
}
static inline bool
mlxsw_sp_acl_block_is_egress_bound(const struct mlxsw_sp_acl_block *block)
{
return block->egress_binding_count;
}
static inline bool
mlxsw_sp_acl_block_is_ingress_bound(const struct mlxsw_sp_acl_block *block)
{
return block->ingress_binding_count;
}
static inline bool
mlxsw_sp_acl_block_is_mixed_bound(const struct mlxsw_sp_acl_block *block)
{
return block->ingress_binding_count && block->egress_binding_count;
}
struct mlxsw_sp_acl_block *mlxsw_sp_acl_block_create(struct mlxsw_sp *mlxsw_sp, struct mlxsw_sp_acl_block *mlxsw_sp_acl_block_create(struct mlxsw_sp *mlxsw_sp,
struct net *net); struct net *net);
void mlxsw_sp_acl_block_destroy(struct mlxsw_sp_acl_block *block); void mlxsw_sp_acl_block_destroy(struct mlxsw_sp_acl_block *block);
...@@ -695,9 +740,6 @@ int mlxsw_sp_acl_block_unbind(struct mlxsw_sp *mlxsw_sp, ...@@ -695,9 +740,6 @@ int mlxsw_sp_acl_block_unbind(struct mlxsw_sp *mlxsw_sp,
struct mlxsw_sp_acl_block *block, struct mlxsw_sp_acl_block *block,
struct mlxsw_sp_port *mlxsw_sp_port, struct mlxsw_sp_port *mlxsw_sp_port,
bool ingress); bool ingress);
bool mlxsw_sp_acl_block_is_egress_bound(const struct mlxsw_sp_acl_block *block);
bool mlxsw_sp_acl_block_is_ingress_bound(const struct mlxsw_sp_acl_block *block);
bool mlxsw_sp_acl_block_is_mixed_bound(const struct mlxsw_sp_acl_block *block);
struct mlxsw_sp_acl_ruleset * struct mlxsw_sp_acl_ruleset *
mlxsw_sp_acl_ruleset_lookup(struct mlxsw_sp *mlxsw_sp, mlxsw_sp_acl_ruleset_lookup(struct mlxsw_sp *mlxsw_sp,
struct mlxsw_sp_acl_block *block, u32 chain_index, struct mlxsw_sp_acl_block *block, u32 chain_index,
......
...@@ -94,49 +94,6 @@ struct mlxsw_sp_fid *mlxsw_sp_acl_dummy_fid(struct mlxsw_sp *mlxsw_sp) ...@@ -94,49 +94,6 @@ struct mlxsw_sp_fid *mlxsw_sp_acl_dummy_fid(struct mlxsw_sp *mlxsw_sp)
return mlxsw_sp->acl->dummy_fid; return mlxsw_sp->acl->dummy_fid;
} }
struct mlxsw_sp *mlxsw_sp_acl_block_mlxsw_sp(struct mlxsw_sp_acl_block *block)
{
return block->mlxsw_sp;
}
unsigned int
mlxsw_sp_acl_block_rule_count(const struct mlxsw_sp_acl_block *block)
{
return block ? block->rule_count : 0;
}
void mlxsw_sp_acl_block_disable_inc(struct mlxsw_sp_acl_block *block)
{
if (block)
block->disable_count++;
}
void mlxsw_sp_acl_block_disable_dec(struct mlxsw_sp_acl_block *block)
{
if (block)
block->disable_count--;
}
bool mlxsw_sp_acl_block_disabled(const struct mlxsw_sp_acl_block *block)
{
return block->disable_count;
}
bool mlxsw_sp_acl_block_is_egress_bound(const struct mlxsw_sp_acl_block *block)
{
return block->egress_binding_count;
}
bool mlxsw_sp_acl_block_is_ingress_bound(const struct mlxsw_sp_acl_block *block)
{
return block->ingress_binding_count;
}
bool mlxsw_sp_acl_block_is_mixed_bound(const struct mlxsw_sp_acl_block *block)
{
return block->ingress_binding_count && block->egress_binding_count;
}
static bool static bool
mlxsw_sp_acl_ruleset_is_singular(const struct mlxsw_sp_acl_ruleset *ruleset) mlxsw_sp_acl_ruleset_is_singular(const struct mlxsw_sp_acl_ruleset *ruleset)
{ {
......
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