]> git.itanic.dy.fi Git - linux-stable/commitdiff
net/mlx5: DR, Add support for matching on Internet Header Length (IHL)
authorYevgeny Kliteynik <kliteyn@nvidia.com>
Wed, 23 Feb 2022 22:58:58 +0000 (00:58 +0200)
committerSaeed Mahameed <saeedm@nvidia.com>
Wed, 9 Mar 2022 21:33:03 +0000 (13:33 -0800)
Add support for matching on new field - Internet Header Length (IHL).

Signed-off-by: Muhammad Sammar <muhammads@nvidia.com>
Signed-off-by: Yevgeny Kliteynik <kliteyn@nvidia.com>
Reviewed-by: Alex Vesker <valex@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
drivers/net/ethernet/mellanox/mlx5/core/steering/dr_matcher.c
drivers/net/ethernet/mellanox/mlx5/core/steering/dr_ste.c
drivers/net/ethernet/mellanox/mlx5/core/steering/dr_ste_v0.c
drivers/net/ethernet/mellanox/mlx5/core/steering/dr_ste_v1.c
drivers/net/ethernet/mellanox/mlx5/core/steering/dr_types.h
include/linux/mlx5/mlx5_ifc.h

index 38971fe1dfe1b5aa8176e87475f2c463d0bcbd6e..1668c2b2f60fe001ce4f5fd4712b52cc3e0dc9a1 100644 (file)
@@ -47,6 +47,11 @@ static bool dr_mask_is_ttl_set(struct mlx5dr_match_spec *spec)
        return spec->ttl_hoplimit;
 }
 
+static bool dr_mask_is_ipv4_ihl_set(struct mlx5dr_match_spec *spec)
+{
+       return spec->ipv4_ihl;
+}
+
 #define DR_MASK_IS_L2_DST(_spec, _misc, _inner_outer) (_spec.first_vid || \
        (_spec).first_cfi || (_spec).first_prio || (_spec).cvlan_tag || \
        (_spec).svlan_tag || (_spec).dmac_47_16 || (_spec).dmac_15_0 || \
@@ -507,7 +512,8 @@ static int dr_matcher_set_ste_builders(struct mlx5dr_matcher *matcher,
                                mlx5dr_ste_build_eth_l3_ipv4_5_tuple(ste_ctx, &sb[idx++],
                                                                     &mask, inner, rx);
 
-                       if (dr_mask_is_ttl_set(&mask.outer))
+                       if (dr_mask_is_ttl_set(&mask.outer) ||
+                           dr_mask_is_ipv4_ihl_set(&mask.outer))
                                mlx5dr_ste_build_eth_l3_ipv4_misc(ste_ctx, &sb[idx++],
                                                                  &mask, inner, rx);
                }
@@ -614,7 +620,8 @@ static int dr_matcher_set_ste_builders(struct mlx5dr_matcher *matcher,
                                mlx5dr_ste_build_eth_l3_ipv4_5_tuple(ste_ctx, &sb[idx++],
                                                                     &mask, inner, rx);
 
-                       if (dr_mask_is_ttl_set(&mask.inner))
+                       if (dr_mask_is_ttl_set(&mask.inner) ||
+                           dr_mask_is_ipv4_ihl_set(&mask.inner))
                                mlx5dr_ste_build_eth_l3_ipv4_misc(ste_ctx, &sb[idx++],
                                                                  &mask, inner, rx);
                }
index 187e29b409b6cfa23f36354fdb153dc770859820..c7094fb10a7f444b6e2ed6953c64183d890c9b1d 100644 (file)
@@ -793,6 +793,7 @@ static void dr_ste_copy_mask_spec(char *mask, struct mlx5dr_match_spec *spec, bo
        spec->tcp_sport = IFC_GET_CLR(fte_match_set_lyr_2_4, mask, tcp_sport, clr);
        spec->tcp_dport = IFC_GET_CLR(fte_match_set_lyr_2_4, mask, tcp_dport, clr);
 
+       spec->ipv4_ihl = IFC_GET_CLR(fte_match_set_lyr_2_4, mask, ipv4_ihl, clr);
        spec->ttl_hoplimit = IFC_GET_CLR(fte_match_set_lyr_2_4, mask, ttl_hoplimit, clr);
 
        spec->udp_sport = IFC_GET_CLR(fte_match_set_lyr_2_4, mask, udp_sport, clr);
index 2d62950f7a294bc461bbe2e32885462884148ab9..80424d1e3bb7d5edf95a9756ed1216f8407e4a7e 100644 (file)
@@ -1152,6 +1152,7 @@ dr_ste_v0_build_eth_l3_ipv4_misc_tag(struct mlx5dr_match_param *value,
        struct mlx5dr_match_spec *spec = sb->inner ? &value->inner : &value->outer;
 
        DR_STE_SET_TAG(eth_l3_ipv4_misc, tag, time_to_live, spec, ttl_hoplimit);
+       DR_STE_SET_TAG(eth_l3_ipv4_misc, tag, ihl, spec, ipv4_ihl);
 
        return 0;
 }
index 6ca06800f1d9e1128d46030bdd40f61ae9cf0f7c..d248a428f8725a0d3a4fc546782ccb1a2b274f74 100644 (file)
@@ -1331,6 +1331,7 @@ static int dr_ste_v1_build_eth_l3_ipv4_misc_tag(struct mlx5dr_match_param *value
        struct mlx5dr_match_spec *spec = sb->inner ? &value->inner : &value->outer;
 
        DR_STE_SET_TAG(eth_l3_ipv4_misc_v1, tag, time_to_live, spec, ttl_hoplimit);
+       DR_STE_SET_TAG(eth_l3_ipv4_misc_v1, tag, ihl, spec, ipv4_ihl);
 
        return 0;
 }
index 55fcb751e24a43616c6c55c066936446c064fe3b..02590f6651744e9549d79a85c9cfc4caae2e04c5 100644 (file)
@@ -555,7 +555,9 @@ struct mlx5dr_match_spec {
         */
        u32 tcp_dport:16;
 
-       u32 reserved_auto1:24;
+       u32 reserved_auto1:16;
+       u32 ipv4_ihl:4;
+       u32 reserved_auto2:4;
        u32 ttl_hoplimit:8;
 
        /* UDP source port.;tcp and udp sport/dport are mutually exclusive */
index 69985e4d8dfe34452e7232bef0f35cf3330551ac..1f0c35162b7b2d3480fbd73bae31769069ee02fd 100644 (file)
@@ -493,7 +493,10 @@ struct mlx5_ifc_fte_match_set_lyr_2_4_bits {
        u8         tcp_sport[0x10];
        u8         tcp_dport[0x10];
 
-       u8         reserved_at_c0[0x18];
+       u8         reserved_at_c0[0x10];
+       u8         ipv4_ihl[0x4];
+       u8         reserved_at_c4[0x4];
+
        u8         ttl_hoplimit[0x8];
 
        u8         udp_sport[0x10];