diff options
author | Jiri Pirko <jiri@mellanox.com> | 2018-07-08 23:51:23 +0300 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2018-07-09 16:24:17 -0700 |
commit | a5995cc801f9b6a66af1d20b2025ff0c20a4c0bf (patch) | |
tree | 5b36ca53fdb543deffd9901f10dd945bdd679cac /drivers/net/ethernet/mellanox/mlxsw/core_acl_flex_keys.c | |
parent | mlxsw: spectrum_acl: Convert mlxsw_afk_create args to ops (diff) | |
download | linux-dev-a5995cc801f9b6a66af1d20b2025ff0c20a4c0bf.tar.xz linux-dev-a5995cc801f9b6a66af1d20b2025ff0c20a4c0bf.zip |
mlxsw: spectrum_acl: Move block items encoding into Spectrum op
Since Spectrum-2 encodes blocks into different HW layout, push this
code into Spectrum-specific op.
Signed-off-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/mellanox/mlxsw/core_acl_flex_keys.c')
-rw-r--r-- | drivers/net/ethernet/mellanox/mlxsw/core_acl_flex_keys.c | 49 |
1 files changed, 6 insertions, 43 deletions
diff --git a/drivers/net/ethernet/mellanox/mlxsw/core_acl_flex_keys.c b/drivers/net/ethernet/mellanox/mlxsw/core_acl_flex_keys.c index 098665ecba06..bf645215f514 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/core_acl_flex_keys.c +++ b/drivers/net/ethernet/mellanox/mlxsw/core_acl_flex_keys.c @@ -416,45 +416,8 @@ void mlxsw_afk_values_add_buf(struct mlxsw_afk_element_values *values, } EXPORT_SYMBOL(mlxsw_afk_values_add_buf); -static void mlxsw_afk_encode_u32(const struct mlxsw_item *storage_item, - const struct mlxsw_item *output_item, - char *storage, char *output_indexed) -{ - u32 value; - - value = __mlxsw_item_get32(storage, storage_item, 0); - __mlxsw_item_set32(output_indexed, output_item, 0, value); -} - -static void mlxsw_afk_encode_buf(const struct mlxsw_item *storage_item, - const struct mlxsw_item *output_item, - char *storage, char *output_indexed) -{ - char *storage_data = __mlxsw_item_data(storage, storage_item, 0); - char *output_data = __mlxsw_item_data(output_indexed, output_item, 0); - size_t len = output_item->size.bytes; - - memcpy(output_data, storage_data, len); -} - -#define MLXSW_AFK_KEY_BLOCK_SIZE 16 - -static void mlxsw_afk_encode_one(const struct mlxsw_afk_element_inst *elinst, - int block_index, char *storage, char *output) -{ - char *output_indexed = output + block_index * MLXSW_AFK_KEY_BLOCK_SIZE; - const struct mlxsw_item *storage_item = &elinst->info->item; - const struct mlxsw_item *output_item = &elinst->item; - - if (elinst->type == MLXSW_AFK_ELEMENT_TYPE_U32) - mlxsw_afk_encode_u32(storage_item, output_item, - storage, output_indexed); - else if (elinst->type == MLXSW_AFK_ELEMENT_TYPE_BUF) - mlxsw_afk_encode_buf(storage_item, output_item, - storage, output_indexed); -} - -void mlxsw_afk_encode(struct mlxsw_afk_key_info *key_info, +void mlxsw_afk_encode(struct mlxsw_afk *mlxsw_afk, + struct mlxsw_afk_key_info *key_info, struct mlxsw_afk_element_values *values, char *key, char *mask) { @@ -467,10 +430,10 @@ void mlxsw_afk_encode(struct mlxsw_afk_key_info *key_info, &block_index); if (!elinst) continue; - mlxsw_afk_encode_one(elinst, block_index, - values->storage.key, key); - mlxsw_afk_encode_one(elinst, block_index, - values->storage.mask, mask); + mlxsw_afk->ops->encode_one(elinst, block_index, + values->storage.key, key); + mlxsw_afk->ops->encode_one(elinst, block_index, + values->storage.mask, mask); } } EXPORT_SYMBOL(mlxsw_afk_encode); |