@@ -487,3 +487,35 @@ void mlxsw_afk_encode(struct mlxsw_afk *mlxsw_afk,
}
}
EXPORT_SYMBOL(mlxsw_afk_encode);
+
+void mlxsw_afk_encode_range(struct mlxsw_afk *mlxsw_afk,
+ struct mlxsw_afk_key_info *key_info,
+ struct mlxsw_afk_element_values *values,
+ char *key, int block_start, int block_end)
+{
+ char block_key[MLXSW_SP_AFK_KEY_BLOCK_MAX_SIZE];
+ const struct mlxsw_afk_element_inst *elinst;
+ enum mlxsw_afk_element element;
+ int block_index, i;
+
+ for (i = 0; i < key_info->blocks_count; i++) {
+ if (i < block_start || i > block_end)
+ continue;
+
+ memset(block_key, 0, MLXSW_SP_AFK_KEY_BLOCK_MAX_SIZE);
+
+ mlxsw_afk_element_usage_for_each(element, &values->elusage) {
+ elinst = mlxsw_afk_key_info_elinst_get(key_info,
+ element,
+ &block_index);
+ if (!elinst || block_index != i)
+ continue;
+
+ mlxsw_sp_afk_encode_one(elinst, block_key,
+ values->storage.key);
+ }
+
+ mlxsw_afk->ops->encode_block(block_key, i, key);
+ }
+}
+EXPORT_SYMBOL(mlxsw_afk_encode_range);
@@ -260,5 +260,9 @@ 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);
+void mlxsw_afk_encode_range(struct mlxsw_afk *mlxsw_afk,
+ struct mlxsw_afk_key_info *key_info,
+ struct mlxsw_afk_element_values *values,
+ char *key, int block_start, int block_end);
#endif