net/mlx5: support match ICMP identifier fields
A message that is not in the archive (sent off-list or not yet received): [email protected]
PATCH v4 1/1 net/mlx5: support match ICMP identifier fields
PRM expose fields "Icmp_header_data" in IPv4 ICMP.
Update ICMP mask parameter with ICMP identifier and sequence number fields. ICMP sequence number spec with mask, Icmp_header_data low 16 bits are set. ICMP identifier spec with mask, Icmp_header_data high 16 bits are set.
--- doc/guides/nics/mlx5.rst | 4 ++-- doc/guides/rel_notes/release_20_11.rst | 2 +- drivers/net/mlx5/mlx5_flow.c | 10 ++++++++-- drivers/net/mlx5/mlx5_flow_dv.c | 24 ++++++++++++++++++++++-- 4 files changed, 33 insertions(+), 7 deletions(-)
doc/guides/nics/mlx5.rst +2 -2
@@ -288,7 +288,7 @@ Limitations - The input buffer, providing the removal size, is not validated. - The buffer size must match the length of the headers to be removed. -- ICMP/ICMP6 code/type matching, IP-in-IP and MPLS flow matching are all +- ICMP(code/type/identifier/sequence number) / ICMP6(code/type) matching, IP-in-IP and MPLS flow matching are all mutually exclusive features which cannot be supported together (see :ref:`mlx5_firmware_config`).
@@ -1009,7 +1009,7 @@ Below are some firmware configurations listed. FLEX_PARSER_PROFILE_ENABLE=1 -- enable ICMP/ICMP6 code/type fields matching:: +- enable ICMP(code/type/identifier/sequence number) / ICMP6(code/type) fields matching:: FLEX_PARSER_PROFILE_ENABLE=2
doc/guides/rel_notes/release_20_11.rst +1 -1
@@ -73,7 +73,7 @@ New Features * Added flag action. * Added raw encap/decap actions. * Added VXLAN encap/decap actions. - * Added ICMP and ICMP6 matching items. + * Added ICMP(code/type/identifier/sequence number) and ICMP6(code/type) matching items. * Added option to set port mask for insertion/deletion: ``--portmask=N`` where N represents the hexadecimal bitmask of ports used.
drivers/net/mlx5/mlx5_flow.c +8 -2
@@ -1303,6 +1303,12 @@ mlx5_flow_validate_item_icmp(const struct rte_flow_item *item, struct rte_flow_error *error) {const struct rte_flow_item_icmp *mask = item->mask; +const struct rte_flow_item_icmp nic_mask = { + .hdr.icmp_type =0xff , + .hdr.icmp_code =0xff , + .hdr.icmp_ident =RTE_BE16 (0xffff ), + .hdr.icmp_seq_nb =RTE_BE16 (0xffff ), + };const int tunnel = !!(item_flags &MLX5_FLOW_LAYER_TUNNEL );const uint64_t l3m = tunnel ?MLX5_FLOW_LAYER_INNER_L3_IPV4 :MLX5_FLOW_LAYER_OUTER_L3_IPV4 ;
@@ -1325,10 +1331,10 @@ mlx5_flow_validate_item_icmp(const struct rte_flow_item *item,RTE_FLOW_ERROR_TYPE_ITEM , item, "multiple L4 layers not supported");if (!mask) - mask = &rte_flow_item_icmp_mask; + mask = &nic_mask; ret =mlx5_flow_item_acceptable (item, (const uint8_t *)mask, - (const uint8_t *)&rte_flow_item_icmp_mask, + (const uint8_t *)&nic_mask,sizeof (struct rte_flow_item_icmp ), error);if (ret <0 )return ret;
drivers/net/mlx5/mlx5_flow_dv.c +22 -2
@@ -7378,6 +7378,14 @@ flow_dv_translate_item_icmp(void *matcher, void *key, {const struct rte_flow_item_icmp *icmp_m = item->mask;const struct rte_flow_item_icmp *icmp_v = item->spec; +const struct rte_flow_item_icmp nic_mask = { + .hdr.icmp_type =0xff , + .hdr.icmp_code =0xff , + .hdr.icmp_ident =RTE_BE16 (0xffff ), + .hdr.icmp_seq_nb =RTE_BE16 (0xffff ), + }; +uint32_t icmp_header_data_m =0 ; +uint32_t icmp_header_data_v =0 ;void *headers_m;void *headers_v; void *misc3_m = MLX5_ADDR_OF(fte_match_param, matcher,
@@ -7396,8 +7404,14 @@ flow_dv_translate_item_icmp(void *matcher, void *key,MLX5_SET (fte_match_set_lyr_2_4, headers_v, ip_protocol,IPPROTO_ICMP );if (!icmp_v)return ; -if (!icmp_m) - icmp_m = &rte_flow_item_icmp_mask; +if (!icmp_m) { + icmp_m = &nic_mask; + icmp_header_data_m =UINT32_MAX ; + }else { + icmp_header_data_m =rte_be_to_cpu_16 (icmp_m->hdr.icmp_seq_nb); + icmp_header_data_m |= +rte_be_to_cpu_16 (icmp_m->hdr.icmp_ident) <<16 ; + }/* * Force flow only to match the non-fragmented IPv4 ICMP packets. * If only the protocol is specified, no need to match the frag.
@@ -7412,6 +7426,12 @@ flow_dv_translate_item_icmp(void *matcher, void *key, icmp_m->hdr.icmp_code);MLX5_SET (fte_match_set_misc3, misc3_v, icmp_code, icmp_v->hdr.icmp_code & icmp_m->hdr.icmp_code); + icmp_header_data_v =rte_be_to_cpu_16 (icmp_v->hdr.icmp_seq_nb); + icmp_header_data_v |=rte_be_to_cpu_16 (icmp_v->hdr.icmp_ident) <<16 ; +MLX5_SET (fte_match_set_misc3, misc3_m, icmp_header_data, + icmp_header_data_m); +MLX5_SET (fte_match_set_misc3, misc3_v, icmp_header_data, + icmp_header_data_v & icmp_header_data_m); }/**
Signature · 1 line
2.21.0
Hi Li
PSB
Best,
Ori
Quoted 98 lines
-----Original Message-----
From: dev <[email protected]> On Behalf Of Li Zhang
Sent: Friday, October 2, 2020 11:41 AM
Subject: [dpdk-dev] [PATCH v4 1/1] net/mlx5: support match ICMP identifier fieldsPRM expose fields "
Icmp_header_data" in IPv4 ICMP.
Update ICMP mask parameter with ICMP identifier and sequence number fields.
ICMP sequence number spec with mask,Icmp_header_datalow 16 bits are set. ICMP identifier spec with mask,Icmp_header_datahigh 16 bits are set.Signed-off-by Li Zhang <[email protected]>--- doc/guides/nics/mlx5.rst | 4 ++-- doc/guides/rel_notes/release_20_11.rst | 2 +- drivers/net/mlx5/mlx5_flow.c | 10 ++++++++-- drivers/net/mlx5/mlx5_flow_dv.c | 24 ++++++++++++++++++++++-- 4 files changed, 33 insertions(+), 7 deletions(-)doc/guides/nics/mlx5.rst +1
-1@@ -288,7 +288,7 @@ Limitations - The input buffer, providing the removal size, is not validated. - The buffer size must match the length of the headers to be removed. -- ICMP/ICMP6 code/type matching, IP-in-IP and MPLS flow matching are all +- ICMP(code/type/identifier/sequence number) / ICMP6(code/type) matching,IP-in-IP and MPLS flow matching are all
mutually exclusive features which cannot be supported together (see :ref:mlx5_firmware_config).doc/guides/nics/mlx5.rst +1
-1@@ -1009,7 +1009,7 @@ Below are some firmware configurations listed. FLEX_PARSER_PROFILE_ENABLE=1 -- enable ICMP/ICMP6 code/type fields matching:: +- enable ICMP(code/type/identifier/sequence number) / ICMP6(code/type)fields matching::
FLEX_PARSER_PROFILE_ENABLE=2
doc/guides/rel_notes/release_20_11.rst +1
-1@@ -73,7 +73,7 @@ New Features * Added flag action. * Added raw encap/decap actions. * Added VXLAN encap/decap actions. - * Added ICMP and ICMP6 matching items. + * Added ICMP(code/type/identifier/sequence number) andICMP6(code/type) matching items.
* Added option to set port mask for insertion/deletion:
``--portmask=N``
where N represents the hexadecimal bitmask of ports used.drivers/net/mlx5/mlx5_flow.c +6
-0@@ -1303,6 +1303,12 @@ mlx5_flow_validate_item_icmp(const structrte_flow_item *item, struct rte_flow_error *error) { const struct rte_flow_item_icmp *mask = item->mask; +const struct rte_flow_item_icmp nic_mask = { + .hdr.icmp_type =0xff , + .hdr.icmp_code =0xff , + .hdr.icmp_ident =RTE_BE16 (0xffff ), + .hdr.icmp_seq_nb =RTE_BE16 (0xffff ), + };const int tunnel = !!(item_flags &MLX5_FLOW_LAYER_TUNNEL ); const uint64_t l3m = tunnel ? MLX5_FLOW_LAYER_INNER_L3_IPV4 :drivers/net/mlx5/mlx5_flow.c +2
-2MLX5_FLOW_LAYER_OUTER_L3_IPV4 ;@@ -1325,10 +1331,10 @@ mlx5_flow_validate_item_icmp(const struct rte_flow_item *item,RTE_FLOW_ERROR_TYPE_ITEM , item, "multiple L4 layers not supported");if (!mask) - mask = &rte_flow_item_icmp_mask; + mask = &nic_mask; ret =mlx5_flow_item_acceptable (item, (const uint8_t *)mask, - (const uint8_t *)&rte_flow_item_icmp_mask, + (const uint8_t *)&nic_mask,sizeof (struct rte_flow_item_icmp ), error);drivers/net/mlx5/mlx5_flow.c +0
-0if (ret <0 )return ret;drivers/net/mlx5/mlx5_flow_dv.c +0
-0
drivers/net/mlx5/mlx5_flow_dv.c flow_dv_translate_item_icmp(void *matcher, void · line 7387
Quoted 10 lines
drivers/net/mlx5/mlx5_flow_dv.c +6
-0@@ -7378,6 +7378,14 @@ flow_dv_translate_item_icmp(void *matcher, void *key, {const struct rte_flow_item_icmp *icmp_m = item->mask;const struct rte_flow_item_icmp *icmp_v = item->spec; +const struct rte_flow_item_icmp nic_mask = { + .hdr.icmp_type =0xff , + .hdr.icmp_code =0xff , + .hdr.icmp_ident =RTE_BE16 (0xffff ), + .hdr.icmp_seq_nb =RTE_BE16 (0xffff ), + };
This is incorrect, like before, you are changing existing app behavior. Think about it this way, until now the app didn't place any mask so he just matched on the rte_default now with our new version all the matching will fail. Since you are adding more must fields.
Quoted 6 lines
drivers/net/mlx5/mlx5_flow_dv.c +2
-0+uint32_t icmp_header_data_m =0 ; +uint32_t icmp_header_data_v =0 ;void *headers_m;void *headers_v;drivers/net/mlx5/mlx5_flow_dv.c +0
-0void *misc3_m = MLX5_ADDR_OF(fte_match_param, matcher,
drivers/net/mlx5/mlx5_flow_dv.c flow_dv_translate_item_icmp(void *matcher, void · line 7411
Quoted 10 lines
drivers/net/mlx5/mlx5_flow_dv.c +3
-2@@ -7396,8 +7404,14 @@ flow_dv_translate_item_icmp(void *matcher, void *key,MLX5_SET (fte_match_set_lyr_2_4, headers_v, ip_protocol,IPPROTO_ICMP );if (!icmp_v)return ; -if (!icmp_m) - icmp_m = &rte_flow_item_icmp_mask; +if (!icmp_m) { + icmp_m = &nic_mask; + icmp_header_data_m =UINT32_MAX ;
Please see comment above.
Quoted 26 lines
drivers/net/mlx5/mlx5_flow_dv.c +5
-0+ }else { + icmp_header_data_m =rte_be_to_cpu_16 (icmp_m- >hdr.icmp_seq_nb); + icmp_header_data_m |= +rte_be_to_cpu_16 (icmp_m->hdr.icmp_ident) <<16 ; + }drivers/net/mlx5/mlx5_flow_dv.c +6
-0/* * Force flow only to match the non-fragmented IPv4 ICMP packets. * If only the protocol is specified, no need to match the frag. @@ -7412,6 +7426,12 @@ flow_dv_translate_item_icmp(void *matcher, void *key, icmp_m->hdr.icmp_code);MLX5_SET (fte_match_set_misc3, misc3_v, icmp_code, icmp_v->hdr.icmp_code & icmp_m->hdr.icmp_code); + icmp_header_data_v =rte_be_to_cpu_16 (icmp_v->hdr.icmp_seq_nb); + icmp_header_data_v |=rte_be_to_cpu_16 (icmp_v->hdr.icmp_ident) <<16 ; +MLX5_SET (fte_match_set_misc3, misc3_m, icmp_header_data, + icmp_header_data_m); +MLX5_SET (fte_match_set_misc3, misc3_v, icmp_header_data, + icmp_header_data_v & icmp_header_data_m); }/**
--
2.21.0
Hi Qri,
Thanks for your comments.
I will update it in V5 patch.
Please help review it to make sure I got your point.
Regards,
Li Zhang
Quoted 179 lines
-----Original Message-----
From: Ori Kam <[email protected]>
Sent: Sunday, October 4, 2020 7:59 PM
To: Li Zhang <[email protected]>; Dekel Peled <[email protected]>; Slava Ovsiienko <[email protected]>; Matan Azrad <[email protected]>
Cc: [email protected]; NBU-Contact-Thomas Monjalon <[email protected]>; Raslan Darawsheh <[email protected]>
Subject: RE: [dpdk-dev] [PATCH v4 1/1] net/mlx5: support match ICMP identifier fieldsHi Li
PSB
Best,
OriQuoted 10 lines
-----Original Message-----
From: dev <[email protected]> On Behalf Of Li Zhang
Sent: Friday, October 2, 2020 11:41 AM
Subject: [dpdk-dev] [PATCH v4 1/1] net/mlx5: support match ICMP identifier fieldsPRM expose fields "
Icmp_header_data" in IPv4 ICMP.
Update ICMP mask parameter with ICMP identifier and sequence number fields.
ICMP sequence number spec with mask,Icmp_header_datalow 16 bits areset.
Quoted 69 lines
ICMP identifier spec with mask,
Icmp_header_datahigh 16 bits are set.Signed-off-by Li Zhang <[email protected]>--- doc/guides/nics/mlx5.rst | 4 ++-- doc/guides/rel_notes/release_20_11.rst | 2 +- drivers/net/mlx5/mlx5_flow.c | 10 ++++++++-- drivers/net/mlx5/mlx5_flow_dv.c | 24 ++++++++++++++++++++++-- 4 files changed, 33 insertions(+), 7 deletions(-)doc/guides/nics/mlx5.rst index renamed from doc/guides/nics/mlx5.rst +0
-0
211c0c5a6c..576dbe5efd100644doc/guides/nics/mlx5.rst +0
-1@@ -288,7 +288,7 @@ Limitations - The input buffer, providing the removal size, is not validated. - The buffer size must match the length of the headers to be removed. -- ICMP/ICMP6 code/type matching, IP-in-IP and MPLS flow matching areall
+- ICMP(code/type/identifier/sequence number) / ICMP6(code/type) +matching,
IP-in-IP and MPLS flow matching are all
mutually exclusive features which cannot be supported together (see :ref:mlx5_firmware_config).doc/guides/nics/mlx5.rst +2
-1@@ -1009,7 +1009,7 @@ Below are some firmware configurations listed. FLEX_PARSER_PROFILE_ENABLE=1 -- enable ICMP/ICMP6 code/type fields matching:: +- enable ICMP(code/type/identifier/sequence number) / +ICMP6(code/type)fields matching::
FLEX_PARSER_PROFILE_ENABLE=2
doc/guides/rel_notes/release_20_11.rst +1
-1@@ -73,7 +73,7 @@ New Features * Added flag action. * Added raw encap/decap actions. * Added VXLAN encap/decap actions. - * Added ICMP and ICMP6 matching items. + * Added ICMP(code/type/identifier/sequence number) andICMP6(code/type) matching items.
* Added option to set port mask for insertion/deletion:
``--portmask=N``
where N represents the hexadecimal bitmask of ports used.(quoted diff) +0
-0
b/drivers/net/mlx5/mlx5_flow.cindex416505f1c8..3cabfd4627100644drivers/net/mlx5/mlx5_flow.c +6
-0@@ -1303,6 +1303,12 @@ mlx5_flow_validate_item_icmp(const structrte_flow_item *item, struct rte_flow_error *error) { const struct rte_flow_item_icmp *mask = item->mask; +const struct rte_flow_item_icmp nic_mask = { + .hdr.icmp_type =0xff , + .hdr.icmp_code =0xff , + .hdr.icmp_ident =RTE_BE16 (0xffff ), + .hdr.icmp_seq_nb =RTE_BE16 (0xffff ), + };const int tunnel = !!(item_flags &MLX5_FLOW_LAYER_TUNNEL );const uint64_t l3m = tunnel ?MLX5_FLOW_LAYER_INNER_L3_IPV4 :MLX5_FLOW_LAYER_OUTER_L3_IPV4 ;(quoted diff) +0
-0@@ -1325,10 +1331,10 @@ > mlx5_flow_validate_item_icmp(const struct rte_flow_item *item, > RTE_FLOW_ERROR_TYPE_ITEM, > item, > "multiple L4 layers not supported"); > if (!mask) > - mask = &rte_flow_item_icmp_mask; > + mask = &nic_mask;drivers/net/mlx5/mlx5_flow_dv.c flow_dv_translate_item_icmp(void *matcher,
Quoted 12 lines
drivers/net/mlx5/mlx5_flow.c +1
-1ret =mlx5_flow_item_acceptable (item, (const uint8_t *)mask, - (const uint8_t *)&rte_flow_item_icmp_mask, + (const uint8_t *)&nic_mask,sizeof (struct rte_flow_item_icmp ), error);if (ret <0 )return ret;(quoted diff) +0
-0
b/drivers/net/mlx5/mlx5_flow_dv.cindex3819cdb266..a0b78934fd100644drivers/net/mlx5/mlx5_flow_dv.c +0
-0@@ -7378,6 +7378,14 @@ flow_dv_translate_item_icmp(void *matcher,void
drivers/net/mlx5/mlx5_flow_dv.c flow_dv_translate_item_icmp(void *matcher, void *key, · line 7386
Quoted 9 lines
drivers/net/mlx5/mlx5_flow_dv.c +6
-0*key, {const struct rte_flow_item_icmp *icmp_m = item->mask;const struct rte_flow_item_icmp *icmp_v = item->spec; +const struct rte_flow_item_icmp nic_mask = { + .hdr.icmp_type =0xff , + .hdr.icmp_code =0xff , + .hdr.icmp_ident =RTE_BE16 (0xffff ), + .hdr.icmp_seq_nb =RTE_BE16 (0xffff ), + };This is incorrect, like before, you are changing existing app behavior. Think about it this way, until now the app didn't place any mask so he just matched on the
rte_defaultnow with our new version all the matching will fail. Since you are adding more must fields.drivers/net/mlx5/mlx5_flow_dv.c flow_dv_translate_item_icmp(void *matcher, void *key,
Quoted 5 lines
drivers/net/mlx5/mlx5_flow_dv.c +2
-0+uint32_t icmp_header_data_m =0 ; +uint32_t icmp_header_data_v =0 ;void *headers_m;void *headers_v; void *misc3_m = MLX5_ADDR_OF(fte_match_param, matcher, @@ -7396,8
drivers/net/mlx5/mlx5_flow_dv.c flow_dv_translate_item_icmp(void *matcher, void *key, · line 7409
Quoted 10 lines
+7404,14 @@ flow_dv_translate_item_icmp(void *matcher, void *key,
MLX5_SET(fte_match_set_lyr_2_4,headers_v,ip_protocol,IPPROTO_ICMP);drivers/net/mlx5/mlx5_flow_dv.c +3
-2if (!icmp_v)return ; -if (!icmp_m) - icmp_m = &rte_flow_item_icmp_mask; +if (!icmp_m) { + icmp_m = &nic_mask; + icmp_header_data_m =UINT32_MAX ;Please see comment above.
drivers/net/mlx5/mlx5_flow_dv.c flow_dv_translate_item_icmp(void *matcher,
Quoted 10 lines
drivers/net/mlx5/mlx5_flow_dv.c +2
-0+ }else { + icmp_header_data_m = rte_be_to_cpu_16(icmp_m-Quoted 1 line
hdr.icmp_seq_nb);
drivers/net/mlx5/mlx5_flow_dv.c +3
-0+ icmp_header_data_m |= +rte_be_to_cpu_16 (icmp_m->hdr.icmp_ident) <<16 ; + }/* * Force flow only to match the non-fragmented IPv4 ICMP packets. * If only the protocol is specified, no need to match the frag. @@ -7412,6 +7426,12 @@ flow_dv_translate_item_icmp(void *matcher,void
Quoted 17 lines
drivers/net/mlx5/mlx5_flow_dv.c +6
-0*key, icmp_m->hdr.icmp_code);MLX5_SET (fte_match_set_misc3, misc3_v, icmp_code, icmp_v->hdr.icmp_code & icmp_m->hdr.icmp_code); + icmp_header_data_v =rte_be_to_cpu_16 (icmp_v- hdr.icmp_seq_nb); + icmp_header_data_v |=rte_be_to_cpu_16 (icmp_v->hdr.icmp_ident) <<16 ; +MLX5_SET (fte_match_set_misc3, misc3_m, icmp_header_data, + icmp_header_data_m); +MLX5_SET (fte_match_set_misc3, misc3_v, icmp_header_data, + icmp_header_data_v & icmp_header_data_m);}
/**
--
2.21.0
Hi Qri,
Please help review the new patch V6
https://patchwork.dpdk.org/patch/79613/
Regards,
Li Zhang
Quoted 201 lines
-----Original Message-----
From: Li Zhang
Sent: Monday, October 5, 2020 5:20 PM
To: Ori Kam <[email protected]>; Dekel Peled <[email protected]>; Slava Ovsiienko <[email protected]>; Matan Azrad <[email protected]>
Cc: [email protected]; NBU-Contact-Thomas Monjalon <[email protected]>; Raslan Darawsheh <[email protected]>
Subject: RE: [dpdk-dev] [PATCH v4 1/1] net/mlx5: support match ICMP identifier fieldsHi Qri,
Thanks for your comments.
I will update it in V5 patch.
Please help review it to make sure I got your point.Regards,
Li ZhangQuoted 6 lines
-----Original Message-----
From: Ori Kam <[email protected]>
Sent: Sunday, October 4, 2020 7:59 PM
To: Li Zhang <[email protected]>; Dekel Peled <[email protected]>; Slava Ovsiienko <[email protected]>; Matan Azrad <[email protected]>
Cc: [email protected]; NBU-Contact-Thomas MonjalonQuoted 175 lines
Raslan Darawsheh <[email protected]>
Subject: RE: [dpdk-dev] [PATCH v4 1/1] net/mlx5: support match ICMP identifier fieldsHi Li
PSB
Best,
OriQuoted 11 lines
-----Original Message-----
From: dev <[email protected]> On Behalf Of Li Zhang
Sent: Friday, October 2, 2020 11:41 AM
Subject: [dpdk-dev] [PATCH v4 1/1] net/mlx5: support match ICMP identifier fieldsPRM expose fields "
Icmp_header_data" in IPv4 ICMP. Update ICMP mask parameter with ICMP identifier and sequence number fields.
ICMP sequence number spec with mask,Icmp_header_datalow 16 bits areset.
Quoted 69 lines
ICMP identifier spec with mask,
Icmp_header_datahigh 16 bits are set.Signed-off-by Li Zhang <[email protected]>--- doc/guides/nics/mlx5.rst | 4 ++-- doc/guides/rel_notes/release_20_11.rst | 2 +- drivers/net/mlx5/mlx5_flow.c | 10 ++++++++-- drivers/net/mlx5/mlx5_flow_dv.c | 24 ++++++++++++++++++++++-- 4 files changed, 33 insertions(+), 7 deletions(-)doc/guides/nics/mlx5.rst +0
-1@@ -288,7 +288,7 @@ Limitations - The input buffer, providing the removal size, is not validated. - The buffer size must match the length of the headers to be removed. -- ICMP/ICMP6 code/type matching, IP-in-IP and MPLS flow matchingare all
+- ICMP(code/type/identifier/sequence number) / ICMP6(code/type) +matching,
IP-in-IP and MPLS flow matching are all
mutually exclusive features which cannot be supported together (see :ref:mlx5_firmware_config).doc/guides/nics/mlx5.rst +2
-1@@ -1009,7 +1009,7 @@ Below are some firmware configurations listed. FLEX_PARSER_PROFILE_ENABLE=1 -- enable ICMP/ICMP6 code/type fields matching:: +- enable ICMP(code/type/identifier/sequence number) / +ICMP6(code/type)fields matching::
FLEX_PARSER_PROFILE_ENABLE=2
doc/guides/rel_notes/release_20_11.rst +1
-1@@ -73,7 +73,7 @@ New Features * Added flag action. * Added raw encap/decap actions. * Added VXLAN encap/decap actions. - * Added ICMP and ICMP6 matching items. + * Added ICMP(code/type/identifier/sequence number) andICMP6(code/type) matching items.
* Added option to set port mask for insertion/deletion:
``--portmask=N``
where N represents the hexadecimal bitmask of ports used.(quoted diff) +0
-0
b/drivers/net/mlx5/mlx5_flow.cindex416505f1c8..3cabfd4627100644drivers/net/mlx5/mlx5_flow.c +6
-0@@ -1303,6 +1303,12 @@ mlx5_flow_validate_item_icmp(const structrte_flow_item *item, struct rte_flow_error *error) { const struct rte_flow_item_icmp *mask = item->mask; +const struct rte_flow_item_icmp nic_mask = { + .hdr.icmp_type =0xff , + .hdr.icmp_code =0xff , + .hdr.icmp_ident =RTE_BE16 (0xffff ), + .hdr.icmp_seq_nb =RTE_BE16 (0xffff ), + };const int tunnel = !!(item_flags &MLX5_FLOW_LAYER_TUNNEL );const uint64_t l3m = tunnel ?MLX5_FLOW_LAYER_INNER_L3_IPV4 :MLX5_FLOW_LAYER_OUTER_L3_IPV4 ;(quoted diff) +0
-0@@ -1325,10 +1331,10 @@ > mlx5_flow_validate_item_icmp(const struct rte_flow_item *item, > RTE_FLOW_ERROR_TYPE_ITEM, > item, > "multiple L4 layers not supported"); > if (!mask) > - mask = &rte_flow_item_icmp_mask; > + mask = &nic_mask;drivers/net/mlx5/mlx5_flow_dv.c flow_dv_translate_item_icmp(void *matcher,
Quoted 13 lines
drivers/net/mlx5/mlx5_flow.c +1
-1ret =mlx5_flow_item_acceptable (item, (const uint8_t *)mask, - (const uint8_t *)&rte_flow_item_icmp_mask, + (const uint8_t *)&nic_mask,sizeof (struct rte_flow_item_icmp ), error);if (ret <0 )return ret;(quoted diff) +0
-0
b/drivers/net/mlx5/mlx5_flow_dv.cindex3819cdb266..a0b78934fd100644drivers/net/mlx5/mlx5_flow_dv.c +0
-0@@ -7378,6 +7378,14 @@ flow_dv_translate_item_icmp(void *matcher,void
drivers/net/mlx5/mlx5_flow_dv.c flow_dv_translate_item_icmp(void *matcher, void *key, · line 7386
Quoted 9 lines
drivers/net/mlx5/mlx5_flow_dv.c +6
-0*key, {const struct rte_flow_item_icmp *icmp_m = item->mask;const struct rte_flow_item_icmp *icmp_v = item->spec; +const struct rte_flow_item_icmp nic_mask = { + .hdr.icmp_type =0xff , + .hdr.icmp_code =0xff , + .hdr.icmp_ident =RTE_BE16 (0xffff ), + .hdr.icmp_seq_nb =RTE_BE16 (0xffff ), + };This is incorrect, like before, you are changing existing app behavior. Think about it this way, until now the app didn't place any mask so he just matched on the
rte_defaultnow with our new version all the matching will fail. Since you are adding more must fields.drivers/net/mlx5/mlx5_flow_dv.c flow_dv_translate_item_icmp(void *matcher, void *key,
Quoted 5 lines
drivers/net/mlx5/mlx5_flow_dv.c +2
-0+uint32_t icmp_header_data_m =0 ; +uint32_t icmp_header_data_v =0 ;void *headers_m;void *headers_v; void *misc3_m = MLX5_ADDR_OF(fte_match_param, matcher, @@ -7396,8
drivers/net/mlx5/mlx5_flow_dv.c flow_dv_translate_item_icmp(void *matcher, void *key, · line 7409
Quoted 10 lines
+7404,14 @@ flow_dv_translate_item_icmp(void *matcher, void *key,
MLX5_SET(fte_match_set_lyr_2_4,headers_v,ip_protocol,IPPROTO_ICMP);drivers/net/mlx5/mlx5_flow_dv.c +3
-2if (!icmp_v)return ; -if (!icmp_m) - icmp_m = &rte_flow_item_icmp_mask; +if (!icmp_m) { + icmp_m = &nic_mask; + icmp_header_data_m =UINT32_MAX ;Please see comment above.
drivers/net/mlx5/mlx5_flow_dv.c flow_dv_translate_item_icmp(void *matcher,
Quoted 10 lines
drivers/net/mlx5/mlx5_flow_dv.c +2
-0+ }else { + icmp_header_data_m = rte_be_to_cpu_16(icmp_m-Quoted 1 line
hdr.icmp_seq_nb);
drivers/net/mlx5/mlx5_flow_dv.c +3
-0+ icmp_header_data_m |= +rte_be_to_cpu_16 (icmp_m->hdr.icmp_ident) <<16 ; + }/* * Force flow only to match the non-fragmented IPv4 ICMP packets. * If only the protocol is specified, no need to match the frag. @@ -7412,6 +7426,12 @@ flow_dv_translate_item_icmp(void *matcher,void
Quoted 17 lines
drivers/net/mlx5/mlx5_flow_dv.c +6
-0*key, icmp_m->hdr.icmp_code);MLX5_SET (fte_match_set_misc3, misc3_v, icmp_code, icmp_v->hdr.icmp_code & icmp_m->hdr.icmp_code); + icmp_header_data_v =rte_be_to_cpu_16 (icmp_v- hdr.icmp_seq_nb); + icmp_header_data_v |=rte_be_to_cpu_16 (icmp_v->hdr.icmp_ident) <<16 ; +MLX5_SET (fte_match_set_misc3, misc3_m, icmp_header_data, + icmp_header_data_m); +MLX5_SET (fte_match_set_misc3, misc3_v, icmp_header_data, + icmp_header_data_v & icmp_header_data_m);}
/**
--
2.21.0
PATCH v5 1/1 net/mlx5: support match ICMP identifier fields
In reply to Li ZhangPRM expose fields "Icmp_header_data" in IPv4 ICMP.
Update ICMP mask parameter with ICMP identifier and sequence number fields. ICMP sequence number spec with mask, Icmp_header_data low 16 bits are set. ICMP identifier spec with mask, Icmp_header_data high 16 bits are set.
--- doc/guides/nics/mlx5.rst | 4 ++-- doc/guides/rel_notes/release_20_11.rst | 2 +- drivers/net/mlx5/mlx5_flow.c | 10 ++++++++-- drivers/net/mlx5/mlx5_flow_dv.c | 12 ++++++++++++ 4 files changed, 23 insertions(+), 5 deletions(-)
doc/guides/nics/mlx5.rst +2 -2
@@ -288,7 +288,7 @@ Limitations - The input buffer, providing the removal size, is not validated. - The buffer size must match the length of the headers to be removed. -- ICMP/ICMP6 code/type matching, IP-in-IP and MPLS flow matching are all +- ICMP(code/type/identifier/sequence number) / ICMP6(code/type) matching, IP-in-IP and MPLS flow matching are all mutually exclusive features which cannot be supported together (see :ref:`mlx5_firmware_config`).
@@ -1009,7 +1009,7 @@ Below are some firmware configurations listed. FLEX_PARSER_PROFILE_ENABLE=1 -- enable ICMP/ICMP6 code/type fields matching:: +- enable ICMP(code/type/identifier/sequence number) / ICMP6(code/type) fields matching:: FLEX_PARSER_PROFILE_ENABLE=2
doc/guides/rel_notes/release_20_11.rst +1 -1
@@ -73,7 +73,7 @@ New Features * Added flag action. * Added raw encap/decap actions. * Added VXLAN encap/decap actions. - * Added ICMP and ICMP6 matching items. + * Added ICMP(code/type/identifier/sequence number) and ICMP6(code/type) matching items. * Added option to set port mask for insertion/deletion: ``--portmask=N`` where N represents the hexadecimal bitmask of ports used.
drivers/net/mlx5/mlx5_flow.c +8 -2
@@ -1303,6 +1303,12 @@ mlx5_flow_validate_item_icmp(const struct rte_flow_item *item, struct rte_flow_error *error) {const struct rte_flow_item_icmp *mask = item->mask; +const struct rte_flow_item_icmp nic_mask = { + .hdr.icmp_type =0xff , + .hdr.icmp_code =0xff , + .hdr.icmp_ident =RTE_BE16 (0xffff ), + .hdr.icmp_seq_nb =RTE_BE16 (0xffff ), + };const int tunnel = !!(item_flags &MLX5_FLOW_LAYER_TUNNEL );const uint64_t l3m = tunnel ?MLX5_FLOW_LAYER_INNER_L3_IPV4 :MLX5_FLOW_LAYER_OUTER_L3_IPV4 ;
@@ -1325,10 +1331,10 @@ mlx5_flow_validate_item_icmp(const struct rte_flow_item *item,RTE_FLOW_ERROR_TYPE_ITEM , item, "multiple L4 layers not supported");if (!mask) - mask = &rte_flow_item_icmp_mask; + mask = &nic_mask; ret =mlx5_flow_item_acceptable (item, (const uint8_t *)mask, - (const uint8_t *)&rte_flow_item_icmp_mask, + (const uint8_t *)&nic_mask,sizeof (struct rte_flow_item_icmp ), error);if (ret <0 )return ret;
drivers/net/mlx5/mlx5_flow_dv.c +12 -0
@@ -7378,6 +7378,8 @@ flow_dv_translate_item_icmp(void *matcher, void *key, {const struct rte_flow_item_icmp *icmp_m = item->mask;const struct rte_flow_item_icmp *icmp_v = item->spec; +uint32_t icmp_header_data_m =0 ; +uint32_t icmp_header_data_v =0 ;void *headers_m;void *headers_v; void *misc3_m = MLX5_ADDR_OF(fte_match_param, matcher,
@@ -7412,6 +7414,16 @@ flow_dv_translate_item_icmp(void *matcher, void *key, icmp_m->hdr.icmp_code);MLX5_SET (fte_match_set_misc3, misc3_v, icmp_code, icmp_v->hdr.icmp_code & icmp_m->hdr.icmp_code); + icmp_header_data_m =rte_be_to_cpu_16 (icmp_m->hdr.icmp_seq_nb); + icmp_header_data_m |=rte_be_to_cpu_16 (icmp_m->hdr.icmp_ident) <<16 ; +if (icmp_header_data_m) { + icmp_header_data_v =rte_be_to_cpu_16 (icmp_v->hdr.icmp_seq_nb); + icmp_header_data_v |=rte_be_to_cpu_16 (icmp_v->hdr.icmp_ident) <<16 ; +MLX5_SET (fte_match_set_misc3, misc3_m, icmp_header_data, + icmp_header_data_m); +MLX5_SET (fte_match_set_misc3, misc3_v, icmp_header_data, + icmp_header_data_v & icmp_header_data_m); + } }/**
Signature · 1 line
2.21.0
PATCH v6 1/1 net/mlx5: support match ICMP identifier fields
PRM expose fields "Icmp_header_data" in IPv4 ICMP.
Update ICMP mask parameter with ICMP identifier and sequence number fields. ICMP sequence number spec with mask, Icmp_header_data low 16 bits are set. ICMP identifier spec with mask, Icmp_header_data high 16 bits are set.
--- doc/guides/nics/mlx5.rst | 4 ++-- doc/guides/rel_notes/release_20_11.rst | 2 +- drivers/net/mlx5/mlx5_flow.c | 10 ++++++++-- drivers/net/mlx5/mlx5_flow_dv.c | 12 ++++++++++++ 4 files changed, 23 insertions(+), 5 deletions(-)
doc/guides/nics/mlx5.rst +2 -2
@@ -288,7 +288,7 @@ Limitations - The input buffer, providing the removal size, is not validated. - The buffer size must match the length of the headers to be removed. -- ICMP/ICMP6 code/type matching, IP-in-IP and MPLS flow matching are all +- ICMP(code/type/identifier/sequence number) / ICMP6(code/type) matching, IP-in-IP and MPLS flow matching are all mutually exclusive features which cannot be supported together (see :ref:`mlx5_firmware_config`).
@@ -1009,7 +1009,7 @@ Below are some firmware configurations listed. FLEX_PARSER_PROFILE_ENABLE=1 -- enable ICMP/ICMP6 code/type fields matching:: +- enable ICMP(code/type/identifier/sequence number) / ICMP6(code/type) fields matching:: FLEX_PARSER_PROFILE_ENABLE=2
doc/guides/rel_notes/release_20_11.rst +1 -1
@@ -73,7 +73,7 @@ New Features * Added flag action. * Added raw encap/decap actions. * Added VXLAN encap/decap actions. - * Added ICMP and ICMP6 matching items. + * Added ICMP(code/type/identifier/sequence number) and ICMP6(code/type) matching items. * Added option to set port mask for insertion/deletion: ``--portmask=N`` where N represents the hexadecimal bitmask of ports used.
drivers/net/mlx5/mlx5_flow.c +8 -2
@@ -1303,6 +1303,12 @@ mlx5_flow_validate_item_icmp(const struct rte_flow_item *item, struct rte_flow_error *error) {const struct rte_flow_item_icmp *mask = item->mask; +const struct rte_flow_item_icmp nic_mask = { + .hdr.icmp_type =0xff , + .hdr.icmp_code =0xff , + .hdr.icmp_ident =RTE_BE16 (0xffff ), + .hdr.icmp_seq_nb =RTE_BE16 (0xffff ), + };const int tunnel = !!(item_flags &MLX5_FLOW_LAYER_TUNNEL );const uint64_t l3m = tunnel ?MLX5_FLOW_LAYER_INNER_L3_IPV4 :MLX5_FLOW_LAYER_OUTER_L3_IPV4 ;
@@ -1325,10 +1331,10 @@ mlx5_flow_validate_item_icmp(const struct rte_flow_item *item,RTE_FLOW_ERROR_TYPE_ITEM , item, "multiple L4 layers not supported");if (!mask) - mask = &rte_flow_item_icmp_mask; + mask = &nic_mask; ret =mlx5_flow_item_acceptable (item, (const uint8_t *)mask, - (const uint8_t *)&rte_flow_item_icmp_mask, + (const uint8_t *)&nic_mask,sizeof (struct rte_flow_item_icmp ), error);if (ret <0 )return ret;
drivers/net/mlx5/mlx5_flow_dv.c +12 -0
@@ -7378,6 +7378,8 @@ flow_dv_translate_item_icmp(void *matcher, void *key, {const struct rte_flow_item_icmp *icmp_m = item->mask;const struct rte_flow_item_icmp *icmp_v = item->spec; +uint32_t icmp_header_data_m =0 ; +uint32_t icmp_header_data_v =0 ;void *headers_m;void *headers_v; void *misc3_m = MLX5_ADDR_OF(fte_match_param, matcher,
@@ -7412,6 +7414,16 @@ flow_dv_translate_item_icmp(void *matcher, void *key, icmp_m->hdr.icmp_code);MLX5_SET (fte_match_set_misc3, misc3_v, icmp_code, icmp_v->hdr.icmp_code & icmp_m->hdr.icmp_code); + icmp_header_data_m =rte_be_to_cpu_16 (icmp_m->hdr.icmp_seq_nb); + icmp_header_data_m |=rte_be_to_cpu_16 (icmp_m->hdr.icmp_ident) <<16 ; +if (icmp_header_data_m) { + icmp_header_data_v =rte_be_to_cpu_16 (icmp_v->hdr.icmp_seq_nb); + icmp_header_data_v |=rte_be_to_cpu_16 (icmp_v->hdr.icmp_ident) <<16 ; +MLX5_SET (fte_match_set_misc3, misc3_m, icmp_header_data, + icmp_header_data_m); +MLX5_SET (fte_match_set_misc3, misc3_v, icmp_header_data, + icmp_header_data_v & icmp_header_data_m); + } }/**
Signature · 1 line
2.21.0
Hi Li,
Quoted 10 lines
-----Original Message-----
From: dev <[email protected]> On Behalf Of Li Zhang
Sent: Monday, October 5, 2020 12:32 PM
To: Dekel Peled <[email protected]>; Ori Kam <[email protected]>; Slava Ovsiienko <[email protected]>; Matan Azrad <[email protected]>
Cc: [email protected]; NBU-Contact-Thomas Monjalon <[email protected]>; Raslan Darawsheh <[email protected]>
Subject: [dpdk-dev] [PATCH v6 1/1] net/mlx5: support match ICMP identifier fields
Quoted 8 lines
PRM expose fields "
Icmp_header_data" in IPv4 ICMP.
Update ICMP mask parameter with ICMP identifier and sequence number fields.
ICMP sequence number spec with mask,Icmp_header_datalow 16 bits are set. ICMP identifier spec with mask,Icmp_header_datahigh 16 bits are set.Signed-off-by Li Zhang <[email protected]>---
Thanks,
Ori
Hi Ori,
What's your comment?
I can not find it in last mail.
Can you help give more detail about it?
Thanks,
Regards,
Li Zhang
Quoted 36 lines
-----Original Message-----
From: Ori Kam <[email protected]>
Sent: Monday, October 5, 2020 6:33 PM
To: Li Zhang <[email protected]>; Dekel Peled <[email protected]>; Slava Ovsiienko <[email protected]>; Matan Azrad <[email protected]>
Cc: [email protected]; NBU-Contact-Thomas Monjalon <[email protected]>; Raslan Darawsheh <[email protected]>
Subject: RE: [dpdk-dev] [PATCH v6 1/1] net/mlx5: support match ICMP identifier fieldsHi Li,
Quoted 6 lines
-----Original Message-----
From: dev <[email protected]> On Behalf Of Li Zhang
Sent: Monday, October 5, 2020 12:32 PM
To: Dekel Peled <[email protected]>; Ori Kam <[email protected]>; Slava Ovsiienko <[email protected]>; Matan Azrad <[email protected]>
Cc: [email protected]; NBU-Contact-Thomas MonjalonQuoted 8 lines
Raslan Darawsheh <[email protected]>
Subject: [dpdk-dev] [PATCH v6 1/1] net/mlx5: support match ICMP identifier fieldsPRM expose fields "
Icmp_header_data" in IPv4 ICMP.
Update ICMP mask parameter with ICMP identifier and sequence number fields.
ICMP sequence number spec with mask,Icmp_header_datalow 16 bits areset.
Quoted 4 lines
ICMP identifier spec with mask,
Icmp_header_datahigh 16 bits are set.Signed-off-by Li Zhang <[email protected]>---
Acked-by Ori Kam <[email protected]>Thanks,
Ori
Hi Li
There was no comment. I acked your patch.
Thanks,
Ori
Quoted 56 lines
-----Original Message-----
From: Li Zhang <[email protected]>
Sent: Tuesday, October 6, 2020 8:12 AM
To: Ori Kam <[email protected]>; Dekel Peled <[email protected]>; Slava Ovsiienko <[email protected]>; Matan Azrad <[email protected]>
Cc: [email protected]; NBU-Contact-Thomas Monjalon <[email protected]>; Raslan Darawsheh <[email protected]>
Subject: RE: [dpdk-dev] [PATCH v6 1/1] net/mlx5: support match ICMP identifier fieldsHi Ori,
What's your comment?
I can not find it in last mail.
Can you help give more detail about it?Thanks,
Regards,
Li ZhangQuoted 36 lines
-----Original Message-----
From: Ori Kam <[email protected]>
Sent: Monday, October 5, 2020 6:33 PM
To: Li Zhang <[email protected]>; Dekel Peled <[email protected]>; Slava Ovsiienko <[email protected]>; Matan Azrad <[email protected]>
Cc: [email protected]; NBU-Contact-Thomas Monjalon <[email protected]>; Raslan Darawsheh <[email protected]>
Subject: RE: [dpdk-dev] [PATCH v6 1/1] net/mlx5: support match ICMP identifier fieldsHi Li,
Quoted 6 lines
-----Original Message-----
From: dev <[email protected]> On Behalf Of Li Zhang
Sent: Monday, October 5, 2020 12:32 PM
To: Dekel Peled <[email protected]>; Ori Kam <[email protected]>; Slava Ovsiienko <[email protected]>; Matan Azrad <[email protected]>
Cc: [email protected]; NBU-Contact-Thomas MonjalonQuoted 8 lines
Raslan Darawsheh <[email protected]>
Subject: [dpdk-dev] [PATCH v6 1/1] net/mlx5: support match ICMP identifier fieldsPRM expose fields "
Icmp_header_data" in IPv4 ICMP.
Update ICMP mask parameter with ICMP identifier and sequence number fields.
ICMP sequence number spec with mask,Icmp_header_datalow 16 bits areset.
Quoted 4 lines
ICMP identifier spec with mask,
Icmp_header_datahigh 16 bits are set.Signed-off-by Li Zhang <[email protected]>---
Acked-by Ori Kam <[email protected]>Thanks,
Ori
Hi Ori,
My latest patch V6 as below:
Please help review it.
https://patchwork.dpdk.org/patch/79613/
Thanks,
Regards,
Li Zhang
Quoted 76 lines
-----Original Message-----
From: Ori Kam <[email protected]>
Sent: Tuesday, October 6, 2020 8:07 PM
To: Li Zhang <[email protected]>; Dekel Peled <[email protected]>; Slava Ovsiienko <[email protected]>; Matan Azrad <[email protected]>
Cc: [email protected]; NBU-Contact-Thomas Monjalon <[email protected]>; Raslan Darawsheh <[email protected]>
Subject: RE: [dpdk-dev] [PATCH v6 1/1] net/mlx5: support match ICMP identifier fieldsHi Li
There was no comment. I acked your patch.
Thanks,
OriQuoted 6 lines
-----Original Message-----
From: Li Zhang <[email protected]>
Sent: Tuesday, October 6, 2020 8:12 AM
To: Ori Kam <[email protected]>; Dekel Peled <[email protected]>; Slava Ovsiienko <[email protected]>; Matan Azrad <[email protected]>
Cc: [email protected]; NBU-Contact-Thomas MonjalonQuoted 6 lines
Raslan Darawsheh <[email protected]>
Subject: RE: [dpdk-dev] [PATCH v6 1/1] net/mlx5: support match ICMP identifier fieldsHi Ori,
Quoted 15 lines
What's your comment?
I can not find it in last mail.
Can you help give more detail about it?Thanks,
Regards,
Li ZhangQuoted 7 lines
-----Original Message-----
From: Ori Kam <[email protected]>
Sent: Monday, October 5, 2020 6:33 PM
To: Li Zhang <[email protected]>; Dekel Peled <[email protected]>; Slava Ovsiienko <[email protected]>; Matan Azrad <[email protected]>
Cc: [email protected]; NBU-Contact-Thomas MonjalonQuoted 30 lines
Quoted 30 lines
Raslan Darawsheh <[email protected]>
Subject: RE: [dpdk-dev] [PATCH v6 1/1] net/mlx5: support match ICMP identifier fieldsHi Li,
Quoted 7 lines
-----Original Message-----
From: dev <[email protected]> On Behalf Of Li Zhang
Sent: Monday, October 5, 2020 12:32 PM
To: Dekel Peled <[email protected]>; Ori Kam <[email protected]>; Slava Ovsiienko <[email protected]>; Matan Azrad <[email protected]>
Cc: [email protected]; NBU-Contact-Thomas MonjalonQuoted 9 lines
Raslan Darawsheh <[email protected]>
Subject: [dpdk-dev] [PATCH v6 1/1] net/mlx5: support match ICMP identifier fieldsPRM expose fields "
Icmp_header_data" in IPv4 ICMP. Update ICMP mask parameter with ICMP identifier and sequence number fields.
ICMP sequence number spec with mask,Icmp_header_datalow 16 bits areset.
Quoted 4 lines
ICMP identifier spec with mask,
Icmp_header_datahigh 16 bits are set.Signed-off-by Li Zhang <[email protected]>---
PATCH v7 1/1 net/mlx5: support match ICMP identifier fields
In reply to Li ZhangPRM expose fields "Icmp_header_data" in IPv4 ICMP.
Update ICMP mask parameter with ICMP identifier and sequence number fields. ICMP sequence number spec with mask, Icmp_header_data low 16 bits are set. ICMP identifier spec with mask, Icmp_header_data high 16 bits are set.
--- doc/guides/nics/mlx5.rst | 4 ++-- doc/guides/rel_notes/release_20_11.rst | 2 +- drivers/net/mlx5/mlx5_flow.c | 10 ++++++++-- drivers/net/mlx5/mlx5_flow_dv.c | 13 +++++++++++++ 4 files changed, 24 insertions(+), 5 deletions(-)
doc/guides/nics/mlx5.rst +2 -2
@@ -288,7 +288,7 @@ Limitations - The input buffer, providing the removal size, is not validated. - The buffer size must match the length of the headers to be removed. -- ICMP/ICMP6 code/type matching, IP-in-IP and MPLS flow matching are all +- ICMP(code/type/identifier/sequence number) / ICMP6(code/type) matching, IP-in-IP and MPLS flow matching are all mutually exclusive features which cannot be supported together (see :ref:`mlx5_firmware_config`).
@@ -1009,7 +1009,7 @@ Below are some firmware configurations listed. FLEX_PARSER_PROFILE_ENABLE=1 -- enable ICMP/ICMP6 code/type fields matching:: +- enable ICMP(code/type/identifier/sequence number) / ICMP6(code/type) fields matching:: FLEX_PARSER_PROFILE_ENABLE=2
doc/guides/rel_notes/release_20_11.rst +1 -1
@@ -102,7 +102,7 @@ New Features * Added flag action. * Added raw encap/decap actions. * Added VXLAN encap/decap actions. - * Added ICMP and ICMP6 matching items. + * Added ICMP(code/type/identifier/sequence number) and ICMP6(code/type) matching items. * Added option to set port mask for insertion/deletion: ``--portmask=N`` where N represents the hexadecimal bitmask of ports used.
drivers/net/mlx5/mlx5_flow.c +8 -2
@@ -1629,6 +1629,12 @@ mlx5_flow_validate_item_icmp(const struct rte_flow_item *item, struct rte_flow_error *error) {const struct rte_flow_item_icmp *mask = item->mask; +const struct rte_flow_item_icmp nic_mask = { + .hdr.icmp_type =0xff , + .hdr.icmp_code =0xff , + .hdr.icmp_ident =RTE_BE16 (0xffff ), + .hdr.icmp_seq_nb =RTE_BE16 (0xffff ), + };const int tunnel = !!(item_flags &MLX5_FLOW_LAYER_TUNNEL );const uint64_t l3m = tunnel ?MLX5_FLOW_LAYER_INNER_L3_IPV4 :MLX5_FLOW_LAYER_OUTER_L3_IPV4 ;
@@ -1651,10 +1657,10 @@ mlx5_flow_validate_item_icmp(const struct rte_flow_item *item,RTE_FLOW_ERROR_TYPE_ITEM , item, "multiple L4 layers not supported");if (!mask) - mask = &rte_flow_item_icmp_mask; + mask = &nic_mask; ret =mlx5_flow_item_acceptable (item, (const uint8_t *)mask, - (const uint8_t *)&rte_flow_item_icmp_mask, + (const uint8_t *)&nic_mask,sizeof (struct rte_flow_item_icmp ), error);if (ret <0 )return ret;
drivers/net/mlx5/mlx5_flow_dv.c +13 -0
@@ -7378,6 +7378,8 @@ flow_dv_translate_item_icmp(void *matcher, void *key, {const struct rte_flow_item_icmp *icmp_m = item->mask;const struct rte_flow_item_icmp *icmp_v = item->spec; +uint32_t icmp_header_data_m =0 ; +uint32_t icmp_header_data_v =0 ;void *headers_m;void *headers_v; void *misc3_m = MLX5_ADDR_OF(fte_match_param, matcher,
@@ -7412,6 +7414,17 @@ flow_dv_translate_item_icmp(void *matcher, void *key, icmp_m->hdr.icmp_code);MLX5_SET (fte_match_set_misc3, misc3_v, icmp_code, icmp_v->hdr.icmp_code & icmp_m->hdr.icmp_code); + icmp_header_data_m =rte_be_to_cpu_16 (icmp_m->hdr.icmp_seq_nb); + icmp_header_data_m |=rte_be_to_cpu_16 (icmp_m->hdr.icmp_ident) <<16 ; +if (icmp_header_data_m) { + icmp_header_data_v =rte_be_to_cpu_16 (icmp_v->hdr.icmp_seq_nb); + icmp_header_data_v |= +rte_be_to_cpu_16 (icmp_v->hdr.icmp_ident) <<16 ; +MLX5_SET (fte_match_set_misc3, misc3_m, icmp_header_data, + icmp_header_data_m); +MLX5_SET (fte_match_set_misc3, misc3_v, icmp_header_data, + icmp_header_data_v & icmp_header_data_m); + } }/**
Signature · 1 line
2.21.0
PATCH v8 1/1 net/mlx5: support match ICMP identifier fields
PRM expose fields "Icmp_header_data" in IPv4 ICMP.
Update ICMP mask parameter with ICMP identifier and sequence number fields. ICMP sequence number spec with mask, Icmp_header_data low 16 bits are set. ICMP identifier spec with mask, Icmp_header_data high 16 bits are set.
--- doc/guides/nics/mlx5.rst | 4 ++-- doc/guides/rel_notes/release_20_11.rst | 2 +- drivers/net/mlx5/mlx5_flow.c | 10 ++++++++-- drivers/net/mlx5/mlx5_flow_dv.c | 13 +++++++++++++ 4 files changed, 24 insertions(+), 5 deletions(-)
doc/guides/nics/mlx5.rst +2 -2
@@ -288,7 +288,7 @@ Limitations - The input buffer, providing the removal size, is not validated. - The buffer size must match the length of the headers to be removed. -- ICMP/ICMP6 code/type matching, IP-in-IP and MPLS flow matching are all +- ICMP(code/type/identifier/sequence number) / ICMP6(code/type) matching, IP-in-IP and MPLS flow matching are all mutually exclusive features which cannot be supported together (see :ref:`mlx5_firmware_config`).
@@ -1009,7 +1009,7 @@ Below are some firmware configurations listed. FLEX_PARSER_PROFILE_ENABLE=1 -- enable ICMP/ICMP6 code/type fields matching:: +- enable ICMP(code/type/identifier/sequence number) / ICMP6(code/type) fields matching:: FLEX_PARSER_PROFILE_ENABLE=2
doc/guides/rel_notes/release_20_11.rst +1 -1
@@ -102,7 +102,7 @@ New Features * Added flag action. * Added raw encap/decap actions. * Added VXLAN encap/decap actions. - * Added ICMP and ICMP6 matching items. + * Added ICMP(code/type/identifier/sequence number) and ICMP6(code/type) matching items. * Added option to set port mask for insertion/deletion: ``--portmask=N`` where N represents the hexadecimal bitmask of ports used.
drivers/net/mlx5/mlx5_flow.c +8 -2
@@ -1629,6 +1629,12 @@ mlx5_flow_validate_item_icmp(const struct rte_flow_item *item, struct rte_flow_error *error) {const struct rte_flow_item_icmp *mask = item->mask; +const struct rte_flow_item_icmp nic_mask = { + .hdr.icmp_type =0xff , + .hdr.icmp_code =0xff , + .hdr.icmp_ident =RTE_BE16 (0xffff ), + .hdr.icmp_seq_nb =RTE_BE16 (0xffff ), + };const int tunnel = !!(item_flags &MLX5_FLOW_LAYER_TUNNEL );const uint64_t l3m = tunnel ?MLX5_FLOW_LAYER_INNER_L3_IPV4 :MLX5_FLOW_LAYER_OUTER_L3_IPV4 ;
@@ -1651,10 +1657,10 @@ mlx5_flow_validate_item_icmp(const struct rte_flow_item *item,RTE_FLOW_ERROR_TYPE_ITEM , item, "multiple L4 layers not supported");if (!mask) - mask = &rte_flow_item_icmp_mask; + mask = &nic_mask; ret =mlx5_flow_item_acceptable (item, (const uint8_t *)mask, - (const uint8_t *)&rte_flow_item_icmp_mask, + (const uint8_t *)&nic_mask,sizeof (struct rte_flow_item_icmp ), error);if (ret <0 )return ret;
drivers/net/mlx5/mlx5_flow_dv.c +13 -0
@@ -7378,6 +7378,8 @@ flow_dv_translate_item_icmp(void *matcher, void *key, {const struct rte_flow_item_icmp *icmp_m = item->mask;const struct rte_flow_item_icmp *icmp_v = item->spec; +uint32_t icmp_header_data_m =0 ; +uint32_t icmp_header_data_v =0 ;void *headers_m;void *headers_v; void *misc3_m = MLX5_ADDR_OF(fte_match_param, matcher,
@@ -7412,6 +7414,17 @@ flow_dv_translate_item_icmp(void *matcher, void *key, icmp_m->hdr.icmp_code);MLX5_SET (fte_match_set_misc3, misc3_v, icmp_code, icmp_v->hdr.icmp_code & icmp_m->hdr.icmp_code); + icmp_header_data_m =rte_be_to_cpu_16 (icmp_m->hdr.icmp_seq_nb); + icmp_header_data_m |=rte_be_to_cpu_16 (icmp_m->hdr.icmp_ident) <<16 ; +if (icmp_header_data_m) { + icmp_header_data_v =rte_be_to_cpu_16 (icmp_v->hdr.icmp_seq_nb); + icmp_header_data_v |= +rte_be_to_cpu_16 (icmp_v->hdr.icmp_ident) <<16 ; +MLX5_SET (fte_match_set_misc3, misc3_m, icmp_header_data, + icmp_header_data_m); +MLX5_SET (fte_match_set_misc3, misc3_v, icmp_header_data, + icmp_header_data_v & icmp_header_data_m); + } }/**
Signature · 1 line
2.21.0
PATCH v9 1/1 net/mlx5: support match ICMP identifier fields
PRM expose fields "Icmp_header_data" in IPv4 ICMP.
Update ICMP mask parameter with ICMP identifier and sequence number fields. ICMP sequence number spec with mask, Icmp_header_data low 16 bits are set. ICMP identifier spec with mask, Icmp_header_data high 16 bits are set.
--- doc/guides/nics/mlx5.rst | 4 ++-- doc/guides/rel_notes/release_20_11.rst | 2 +- drivers/net/mlx5/mlx5_flow.c | 10 ++++++++-- drivers/net/mlx5/mlx5_flow_dv.c | 13 +++++++++++++ 4 files changed, 24 insertions(+), 5 deletions(-)
doc/guides/nics/mlx5.rst +2 -2
@@ -288,7 +288,7 @@ Limitations - The input buffer, providing the removal size, is not validated. - The buffer size must match the length of the headers to be removed. -- ICMP/ICMP6 code/type matching, IP-in-IP and MPLS flow matching are all +- ICMP(code/type/identifier/sequence number) / ICMP6(code/type) matching, IP-in-IP and MPLS flow matching are all mutually exclusive features which cannot be supported together (see :ref:`mlx5_firmware_config`).
@@ -1009,7 +1009,7 @@ Below are some firmware configurations listed. FLEX_PARSER_PROFILE_ENABLE=1 -- enable ICMP/ICMP6 code/type fields matching:: +- enable ICMP(code/type/identifier/sequence number) / ICMP6(code/type) fields matching:: FLEX_PARSER_PROFILE_ENABLE=2
doc/guides/rel_notes/release_20_11.rst +1 -1
@@ -102,7 +102,7 @@ New Features * Added flag action. * Added raw encap/decap actions. * Added VXLAN encap/decap actions. - * Added ICMP and ICMP6 matching items. + * Added ICMP(code/type/identifier/sequence number) and ICMP6(code/type) matching items. * Added option to set port mask for insertion/deletion: ``--portmask=N`` where N represents the hexadecimal bitmask of ports used.
drivers/net/mlx5/mlx5_flow.c +8 -2
@@ -1629,6 +1629,12 @@ mlx5_flow_validate_item_icmp(const struct rte_flow_item *item, struct rte_flow_error *error) {const struct rte_flow_item_icmp *mask = item->mask; +const struct rte_flow_item_icmp nic_mask = { + .hdr.icmp_type =0xff , + .hdr.icmp_code =0xff , + .hdr.icmp_ident =RTE_BE16 (0xffff ), + .hdr.icmp_seq_nb =RTE_BE16 (0xffff ), + };const int tunnel = !!(item_flags &MLX5_FLOW_LAYER_TUNNEL );const uint64_t l3m = tunnel ?MLX5_FLOW_LAYER_INNER_L3_IPV4 :MLX5_FLOW_LAYER_OUTER_L3_IPV4 ;
@@ -1651,10 +1657,10 @@ mlx5_flow_validate_item_icmp(const struct rte_flow_item *item,RTE_FLOW_ERROR_TYPE_ITEM , item, "multiple L4 layers not supported");if (!mask) - mask = &rte_flow_item_icmp_mask; + mask = &nic_mask; ret =mlx5_flow_item_acceptable (item, (const uint8_t *)mask, - (const uint8_t *)&rte_flow_item_icmp_mask, + (const uint8_t *)&nic_mask,sizeof (struct rte_flow_item_icmp ), error);if (ret <0 )return ret;
drivers/net/mlx5/mlx5_flow_dv.c +13 -0
@@ -7378,6 +7378,8 @@ flow_dv_translate_item_icmp(void *matcher, void *key, {const struct rte_flow_item_icmp *icmp_m = item->mask;const struct rte_flow_item_icmp *icmp_v = item->spec; +uint32_t icmp_header_data_m =0 ; +uint32_t icmp_header_data_v =0 ;void *headers_m;void *headers_v; void *misc3_m = MLX5_ADDR_OF(fte_match_param, matcher,
@@ -7412,6 +7414,17 @@ flow_dv_translate_item_icmp(void *matcher, void *key, icmp_m->hdr.icmp_code);MLX5_SET (fte_match_set_misc3, misc3_v, icmp_code, icmp_v->hdr.icmp_code & icmp_m->hdr.icmp_code); + icmp_header_data_m =rte_be_to_cpu_16 (icmp_m->hdr.icmp_seq_nb); + icmp_header_data_m |=rte_be_to_cpu_16 (icmp_m->hdr.icmp_ident) <<16 ; +if (icmp_header_data_m) { + icmp_header_data_v =rte_be_to_cpu_16 (icmp_v->hdr.icmp_seq_nb); + icmp_header_data_v |= +rte_be_to_cpu_16 (icmp_v->hdr.icmp_ident) <<16 ; +MLX5_SET (fte_match_set_misc3, misc3_m, icmp_header_data, + icmp_header_data_m); +MLX5_SET (fte_match_set_misc3, misc3_v, icmp_header_data, + icmp_header_data_v & icmp_header_data_m); + } }/**
Signature · 1 line
2.21.0
Hi,
Quoted 137 lines
-----Original Message-----
From: Li Zhang <[email protected]>
Sent: Friday, October 9, 2020 9:12 AM
To: Dekel Peled <[email protected]>; Ori Kam <[email protected]>; Slava Ovsiienko <[email protected]>; Matan Azrad <[email protected]>
Cc: [email protected]; NBU-Contact-Thomas Monjalon <[email protected]>; Raslan Darawsheh <[email protected]>
Subject: [PATCH v9 1/1] net/mlx5: support match ICMP identifier fieldsPRM expose fields "
Icmp_header_data" in IPv4 ICMP.
Update ICMP mask parameter with ICMP identifier and sequence number fields.
ICMP sequence number spec with mask,Icmp_header_datalow 16 bits are set.
ICMP identifier spec with mask,Icmp_header_datahigh 16 bits are set.Signed-off-by Li Zhang <[email protected]>Acked-by Ori Kam <[email protected]>--- doc/guides/nics/mlx5.rst | 4 ++-- doc/guides/rel_notes/release_20_11.rst | 2 +- drivers/net/mlx5/mlx5_flow.c | 10 ++++++++-- drivers/net/mlx5/mlx5_flow_dv.c | 13 +++++++++++++ 4 files changed, 24 insertions(+), 5 deletions(-)doc/guides/nics/mlx5.rst +1
-1@@ -288,7 +288,7 @@ Limitations - The input buffer, providing the removal size, is not validated. - The buffer size must match the length of the headers to be removed. -- ICMP/ICMP6 code/type matching, IP-in-IP and MPLS flow matching are all +- ICMP(code/type/identifier/sequence number) / ICMP6(code/type)matching, IP-in-IP and MPLS flow matching are all
mutually exclusive features which cannot be supported together (see :ref:mlx5_firmware_config).doc/guides/nics/mlx5.rst +1
-1@@ -1009,7 +1009,7 @@ Below are some firmware configurations listed. FLEX_PARSER_PROFILE_ENABLE=1 -- enable ICMP/ICMP6 code/type fields matching:: +- enable ICMP(code/type/identifier/sequence number) /ICMP6(code/type) fields matching::
FLEX_PARSER_PROFILE_ENABLE=2
doc/guides/rel_notes/release_20_11.rst +1
-1@@ -102,7 +102,7 @@ New Features * Added flag action. * Added raw encap/decap actions. * Added VXLAN encap/decap actions. - * Added ICMP and ICMP6 matching items. + * Added ICMP(code/type/identifier/sequence number) andICMP6(code/type) matching items.
* Added option to set port mask for insertion/deletion:
``--portmask=N``
where N represents the hexadecimal bitmask of ports used.drivers/net/mlx5/mlx5_flow.c +6
-0@@ -1629,6 +1629,12 @@ mlx5_flow_validate_item_icmp(const structrte_flow_item *item, struct rte_flow_error *error) { const struct rte_flow_item_icmp *mask = item->mask; +const struct rte_flow_item_icmp nic_mask = { + .hdr.icmp_type =0xff , + .hdr.icmp_code =0xff , + .hdr.icmp_ident =RTE_BE16 (0xffff ), + .hdr.icmp_seq_nb =RTE_BE16 (0xffff ), + };const int tunnel = !!(item_flags &MLX5_FLOW_LAYER_TUNNEL ); const uint64_t l3m = tunnel ? MLX5_FLOW_LAYER_INNER_L3_IPV4 :drivers/net/mlx5/mlx5_flow.c +2
-2MLX5_FLOW_LAYER_OUTER_L3_IPV4 ;@@ -1651,10 +1657,10 @@ mlx5_flow_validate_item_icmp(const struct rte_flow_item *item,RTE_FLOW_ERROR_TYPE_ITEM , item, "multiple L4 layers not supported");if (!mask) - mask = &rte_flow_item_icmp_mask; + mask = &nic_mask; ret =mlx5_flow_item_acceptable (item, (const uint8_t *)mask, - (const uint8_t *)&rte_flow_item_icmp_mask, + (const uint8_t *)&nic_mask,sizeof (struct rte_flow_item_icmp ), error);drivers/net/mlx5/mlx5_flow.c +0
-0if (ret <0 )return ret;drivers/net/mlx5/mlx5_flow_dv.c +2
-0@@ -7378,6 +7378,8 @@ flow_dv_translate_item_icmp(void *matcher, void *key, {const struct rte_flow_item_icmp *icmp_m = item->mask;const struct rte_flow_item_icmp *icmp_v = item->spec; +uint32_t icmp_header_data_m =0 ; +uint32_t icmp_header_data_v =0 ;void *headers_m;void *headers_v;drivers/net/mlx5/mlx5_flow_dv.c +4
-0void *misc3_m = MLX5_ADDR_OF(fte_match_param, matcher,@@ -7412,6 +7414,17 @@ flow_dv_translate_item_icmp(void *matcher,void *key, icmp_m->hdr.icmp_code);MLX5_SET (fte_match_set_misc3, misc3_v, icmp_code, icmp_v->hdr.icmp_code & icmp_m->hdr.icmp_code); + icmp_header_data_m =rte_be_to_cpu_16 (icmp_m- >hdr.icmp_seq_nb); + icmp_header_data_m |=rte_be_to_cpu_16 (icmp_m- >hdr.icmp_ident) << 16; +if (icmp_header_data_m) { + icmp_header_data_v = rte_be_to_cpu_16(icmp_v-Quoted 1 line
hdr.icmp_seq_nb);
drivers/net/mlx5/mlx5_flow_dv.c +3
-0+ icmp_header_data_v |= +rte_be_to_cpu_16 (icmp_v->hdr.icmp_ident) <<16 ; + MLX5_SET(fte_match_set_misc3, misc3_m,
icmp_header_data,drivers/net/mlx5/mlx5_flow_dv.c +2
-0+ icmp_header_data_m); + MLX5_SET(fte_match_set_misc3, misc3_v,
icmp_header_data,drivers/net/mlx5/mlx5_flow_dv.c +2
-1+ icmp_header_data_v & icmp_header_data_m); + } }/** --
Quoted 1 line
2.21.0
Patch applied to next-net-mlx,
Kindest regards,
Raslan Darawsheh