]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
mlxsw: spectrum_acl: Avoid size check for RX_ACL_SYSTEM_PORT element
authorJiri Pirko <jiri@mellanox.com>
Wed, 19 Jun 2019 06:41:06 +0000 (09:41 +0300)
committerDavid S. Miller <davem@davemloft.net>
Wed, 19 Jun 2019 14:09:22 +0000 (10:09 -0400)
RX_ACL_SYSTEM_PORT is 8 bit but SRC_SYS_PORT is 16 bits. Internally,
SRC_SYS_PORT is used to carry the value. Relax the checker in case of
RX_ACL_SYSTEM_PORT and allow different size.

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>
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

index f6e44ca50cae03270f389c6a5d613347f44cfe4b..feb4672a5ac04d8f498ed897c6370b144909a1d2 100644 (file)
@@ -30,8 +30,9 @@ static bool mlxsw_afk_blocks_check(struct mlxsw_afk *mlxsw_afk)
 
                        elinst = &block->instances[j];
                        if (elinst->type != elinst->info->type ||
-                           elinst->item.size.bits !=
-                           elinst->info->item.size.bits)
+                           (!elinst->avoid_size_check &&
+                            elinst->item.size.bits !=
+                            elinst->info->item.size.bits))
                                return false;
                }
        }
index 78495826ff17555e5c8f15fa524ff956dafe15af..d99a70eec35790107d5a92b2c101b01dca9fb3ed 100644 (file)
@@ -110,10 +110,11 @@ struct mlxsw_afk_element_inst { /* element instance in actual block */
        int u32_key_diff; /* in case value needs to be adjusted before write
                           * this diff is here to handle that
                           */
+       bool avoid_size_check;
 };
 
 #define MLXSW_AFK_ELEMENT_INST(_type, _element, _offset,                       \
-                              _shift, _size, _u32_key_diff)                    \
+                              _shift, _size, _u32_key_diff, _avoid_size_check) \
        {                                                                       \
                .info = &mlxsw_afk_element_infos[MLXSW_AFK_ELEMENT_##_element], \
                .type = _type,                                                  \
@@ -124,20 +125,23 @@ struct mlxsw_afk_element_inst { /* element instance in actual block */
                        .name = #_element,                                      \
                },                                                              \
                .u32_key_diff = _u32_key_diff,                                  \
+               .avoid_size_check = _avoid_size_check,                          \
        }
 
 #define MLXSW_AFK_ELEMENT_INST_U32(_element, _offset, _shift, _size)           \
        MLXSW_AFK_ELEMENT_INST(MLXSW_AFK_ELEMENT_TYPE_U32,                      \
-                              _element, _offset, _shift, _size, 0)
+                              _element, _offset, _shift, _size, 0, false)
 
 #define MLXSW_AFK_ELEMENT_INST_EXT_U32(_element, _offset,                      \
-                                      _shift, _size, _key_diff)                \
+                                      _shift, _size, _key_diff,                \
+                                      _avoid_size_check)                       \
        MLXSW_AFK_ELEMENT_INST(MLXSW_AFK_ELEMENT_TYPE_U32,                      \
-                              _element, _offset, _shift, _size, _key_diff)
+                              _element, _offset, _shift, _size,                \
+                              _key_diff, _avoid_size_check)
 
 #define MLXSW_AFK_ELEMENT_INST_BUF(_element, _offset, _size)                   \
        MLXSW_AFK_ELEMENT_INST(MLXSW_AFK_ELEMENT_TYPE_BUF,                      \
-                              _element, _offset, 0, _size, 0)
+                              _element, _offset, 0, _size, 0, false)
 
 struct mlxsw_afk_block {
        u16 encoding; /* block ID */
index 682c19e220fab6e56171e4aa9c986f4f94a18087..96fc981ed8511abd0c98ddeca6006890bbe918a0 100644 (file)
@@ -149,7 +149,7 @@ static struct mlxsw_afk_element_inst mlxsw_sp_afk_element_info_mac_4[] = {
 
 static struct mlxsw_afk_element_inst mlxsw_sp_afk_element_info_mac_5[] = {
        MLXSW_AFK_ELEMENT_INST_U32(VID, 0x04, 16, 12),
-       MLXSW_AFK_ELEMENT_INST_EXT_U32(SRC_SYS_PORT, 0x04, 0, 8, -1), /* RX_ACL_SYSTEM_PORT */
+       MLXSW_AFK_ELEMENT_INST_EXT_U32(SRC_SYS_PORT, 0x04, 0, 8, -1, true), /* RX_ACL_SYSTEM_PORT */
 };
 
 static struct mlxsw_afk_element_inst mlxsw_sp_afk_element_info_ipv4_0[] = {