mlxsw: spectrum_flower: Add ability to match on layer 2 miss
authorIdo Schimmel <idosch@nvidia.com>
Mon, 29 May 2023 11:48:34 +0000 (14:48 +0300)
committerJakub Kicinski <kuba@kernel.org>
Wed, 31 May 2023 06:37:00 +0000 (23:37 -0700)
Add the 'fdb_miss' key element to supported key blocks and make use of
it to match on layer 2 miss.

The key is only supported on Spectrum-{2,3,4}. An error is returned for
Spectrum-1 since the key element is not present in any of its key
blocks.

Signed-off-by: Ido Schimmel <idosch@nvidia.com>
Reviewed-by: Nikolay Aleksandrov <razor@blackwall.org>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/mellanox/mlxsw/core_acl_flex_keys.c
drivers/net/ethernet/mellanox/mlxsw/core_acl_flex_keys.h
drivers/net/ethernet/mellanox/mlxsw/spectrum_acl_flex_keys.c
drivers/net/ethernet/mellanox/mlxsw/spectrum_flower.c

index bd1a51a..f0b2963 100644 (file)
@@ -42,6 +42,7 @@ static const struct mlxsw_afk_element_info mlxsw_afk_element_infos[] = {
        MLXSW_AFK_ELEMENT_INFO_BUF(DST_IP_64_95, 0x34, 4),
        MLXSW_AFK_ELEMENT_INFO_BUF(DST_IP_32_63, 0x38, 4),
        MLXSW_AFK_ELEMENT_INFO_BUF(DST_IP_0_31, 0x3C, 4),
+       MLXSW_AFK_ELEMENT_INFO_U32(FDB_MISS, 0x40, 0, 1),
 };
 
 struct mlxsw_afk {
index 3a037fe..65a4aba 100644 (file)
@@ -35,6 +35,7 @@ enum mlxsw_afk_element {
        MLXSW_AFK_ELEMENT_IP_DSCP,
        MLXSW_AFK_ELEMENT_VIRT_ROUTER_MSB,
        MLXSW_AFK_ELEMENT_VIRT_ROUTER_LSB,
+       MLXSW_AFK_ELEMENT_FDB_MISS,
        MLXSW_AFK_ELEMENT_MAX,
 };
 
@@ -69,7 +70,7 @@ struct mlxsw_afk_element_info {
        MLXSW_AFK_ELEMENT_INFO(MLXSW_AFK_ELEMENT_TYPE_BUF,                      \
                               _element, _offset, 0, _size)
 
-#define MLXSW_AFK_ELEMENT_STORAGE_SIZE 0x40
+#define MLXSW_AFK_ELEMENT_STORAGE_SIZE 0x44
 
 struct mlxsw_afk_element_inst { /* element instance in actual block */
        enum mlxsw_afk_element element;
index 00c3232..4dea39f 100644 (file)
@@ -123,10 +123,12 @@ const struct mlxsw_afk_ops mlxsw_sp1_afk_ops = {
 };
 
 static struct mlxsw_afk_element_inst mlxsw_sp_afk_element_info_mac_0[] = {
+       MLXSW_AFK_ELEMENT_INST_U32(FDB_MISS, 0x00, 3, 1),
        MLXSW_AFK_ELEMENT_INST_BUF(DMAC_0_31, 0x04, 4),
 };
 
 static struct mlxsw_afk_element_inst mlxsw_sp_afk_element_info_mac_1[] = {
+       MLXSW_AFK_ELEMENT_INST_U32(FDB_MISS, 0x00, 3, 1),
        MLXSW_AFK_ELEMENT_INST_BUF(SMAC_0_31, 0x04, 4),
 };
 
index 9c62c12..72917f0 100644 (file)
@@ -336,10 +336,8 @@ static int mlxsw_sp_flower_parse_meta(struct mlxsw_sp_acl_rule_info *rulei,
 
        flow_rule_match_meta(rule, &match);
 
-       if (match.mask->l2_miss) {
-               NL_SET_ERR_MSG_MOD(f->common.extack, "Can't match on \"l2_miss\"");
-               return -EOPNOTSUPP;
-       }
+       mlxsw_sp_acl_rulei_keymask_u32(rulei, MLXSW_AFK_ELEMENT_FDB_MISS,
+                                      match.key->l2_miss, match.mask->l2_miss);
 
        return mlxsw_sp_flower_parse_meta_iif(rulei, block, &match,
                                              f->common.extack);