Skip to content

Commit 07ff135

Browse files
Amit Cohenkuba-moo
authored andcommitted
mlxsw: Introduce flex key elements for Spectrum-4
Spectrum-4 ASIC will support more virtual routers and local ports compared to the existing ASICs. Therefore, the virtual router and local port ACL key elements need to be increased. Introduce new key elements for Spectrum-4 to be aligned with the elements used already for other Spectrum ASICs. The key blocks layout is the same for Spectrum-4, so use the existing code for encode_block() and clear_block(), just create separate blocks. Note that size of `VIRT_ROUTER_MSB` is 4 bits in Spectrum-4, therefore declare it using `MLXSW_AFK_ELEMENT_INST_U32()`, in order to be able to set `.avoid_size_check` to true. Otherwise, `mlxsw_afk_blocks_check()` will fail and warn. Signed-off-by: Amit Cohen <amcohen@nvidia.com> Signed-off-by: Ido Schimmel <idosch@nvidia.com> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
1 parent 6d5d8eb commit 07ff135

File tree

2 files changed

+43
-0
lines changed

2 files changed

+43
-0
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1106,6 +1106,7 @@ extern const struct mlxsw_afa_ops mlxsw_sp2_act_afa_ops;
11061106
/* spectrum_acl_flex_keys.c */
11071107
extern const struct mlxsw_afk_ops mlxsw_sp1_afk_ops;
11081108
extern const struct mlxsw_afk_ops mlxsw_sp2_afk_ops;
1109+
extern const struct mlxsw_afk_ops mlxsw_sp4_afk_ops;
11091110

11101111
/* spectrum_matchall.c */
11111112
struct mlxsw_sp_mall_ops {

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

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -311,3 +311,45 @@ const struct mlxsw_afk_ops mlxsw_sp2_afk_ops = {
311311
.encode_block = mlxsw_sp2_afk_encode_block,
312312
.clear_block = mlxsw_sp2_afk_clear_block,
313313
};
314+
315+
static struct mlxsw_afk_element_inst mlxsw_sp_afk_element_info_mac_5b[] = {
316+
MLXSW_AFK_ELEMENT_INST_U32(VID, 0x04, 18, 12),
317+
MLXSW_AFK_ELEMENT_INST_EXT_U32(SRC_SYS_PORT, 0x04, 0, 9, -1, true), /* RX_ACL_SYSTEM_PORT */
318+
};
319+
320+
static struct mlxsw_afk_element_inst mlxsw_sp_afk_element_info_ipv4_4b[] = {
321+
MLXSW_AFK_ELEMENT_INST_U32(VIRT_ROUTER_LSB, 0x04, 13, 8),
322+
MLXSW_AFK_ELEMENT_INST_EXT_U32(VIRT_ROUTER_MSB, 0x04, 21, 4, 0, true),
323+
};
324+
325+
static struct mlxsw_afk_element_inst mlxsw_sp_afk_element_info_ipv6_2b[] = {
326+
MLXSW_AFK_ELEMENT_INST_BUF(DST_IP_96_127, 0x04, 4),
327+
};
328+
329+
static const struct mlxsw_afk_block mlxsw_sp4_afk_blocks[] = {
330+
MLXSW_AFK_BLOCK(0x10, mlxsw_sp_afk_element_info_mac_0),
331+
MLXSW_AFK_BLOCK(0x11, mlxsw_sp_afk_element_info_mac_1),
332+
MLXSW_AFK_BLOCK(0x12, mlxsw_sp_afk_element_info_mac_2),
333+
MLXSW_AFK_BLOCK(0x13, mlxsw_sp_afk_element_info_mac_3),
334+
MLXSW_AFK_BLOCK(0x14, mlxsw_sp_afk_element_info_mac_4),
335+
MLXSW_AFK_BLOCK(0x1A, mlxsw_sp_afk_element_info_mac_5b),
336+
MLXSW_AFK_BLOCK(0x38, mlxsw_sp_afk_element_info_ipv4_0),
337+
MLXSW_AFK_BLOCK(0x39, mlxsw_sp_afk_element_info_ipv4_1),
338+
MLXSW_AFK_BLOCK(0x3A, mlxsw_sp_afk_element_info_ipv4_2),
339+
MLXSW_AFK_BLOCK(0x35, mlxsw_sp_afk_element_info_ipv4_4b),
340+
MLXSW_AFK_BLOCK(0x40, mlxsw_sp_afk_element_info_ipv6_0),
341+
MLXSW_AFK_BLOCK(0x41, mlxsw_sp_afk_element_info_ipv6_1),
342+
MLXSW_AFK_BLOCK(0x47, mlxsw_sp_afk_element_info_ipv6_2b),
343+
MLXSW_AFK_BLOCK(0x43, mlxsw_sp_afk_element_info_ipv6_3),
344+
MLXSW_AFK_BLOCK(0x44, mlxsw_sp_afk_element_info_ipv6_4),
345+
MLXSW_AFK_BLOCK(0x45, mlxsw_sp_afk_element_info_ipv6_5),
346+
MLXSW_AFK_BLOCK(0x90, mlxsw_sp_afk_element_info_l4_0),
347+
MLXSW_AFK_BLOCK(0x92, mlxsw_sp_afk_element_info_l4_2),
348+
};
349+
350+
const struct mlxsw_afk_ops mlxsw_sp4_afk_ops = {
351+
.blocks = mlxsw_sp4_afk_blocks,
352+
.blocks_count = ARRAY_SIZE(mlxsw_sp4_afk_blocks),
353+
.encode_block = mlxsw_sp2_afk_encode_block,
354+
.clear_block = mlxsw_sp2_afk_clear_block,
355+
};

0 commit comments

Comments
 (0)