patches for DPDK stable branches
 help / color / mirror / Atom feed
* [dpdk-stable] [PATCH 1/1] net/bnxt: fix handling of null flow mask
@ 2021-03-18 19:52 Lance Richardson
  2021-03-19  3:51 ` Ajit Khaparde
  0 siblings, 1 reply; 2+ messages in thread
From: Lance Richardson @ 2021-03-18 19:52 UTC (permalink / raw)
  To: Ajit Khaparde, Somnath Kotur; +Cc: dev, stable

[-- Attachment #1: Type: text/plain, Size: 3357 bytes --]

When the mask field of an rte_flow pattern item is NULL,
the default mask for that item type should be used.

Fixes: 5ef3b79fdfe6 ("net/bnxt: support flow filter ops")
Cc: stable@dpdk.org

Signed-off-by: Lance Richardson <lance.richardson@broadcom.com>
---
 drivers/net/bnxt/bnxt_flow.c | 47 +++++++++++++++++++++++++++---------
 1 file changed, 36 insertions(+), 11 deletions(-)

diff --git a/drivers/net/bnxt/bnxt_flow.c b/drivers/net/bnxt/bnxt_flow.c
index a8f5d91fc4..e3906b4779 100644
--- a/drivers/net/bnxt/bnxt_flow.c
+++ b/drivers/net/bnxt/bnxt_flow.c
@@ -188,11 +188,15 @@ bnxt_validate_and_parse_flow_type(struct bnxt *bp,
 				PMD_DRV_LOG(DEBUG, "Parse inner header\n");
 			break;
 		case RTE_FLOW_ITEM_TYPE_ETH:
-			if (!item->spec || !item->mask)
+			if (!item->spec)
 				break;
 
 			eth_spec = item->spec;
-			eth_mask = item->mask;
+
+			if (item->mask)
+				eth_mask = item->mask;
+			else
+				eth_mask = &rte_flow_item_eth_mask;
 
 			/* Source MAC address mask cannot be partially set.
 			 * Should be All 0's or all 1's.
@@ -281,7 +285,12 @@ bnxt_validate_and_parse_flow_type(struct bnxt *bp,
 			break;
 		case RTE_FLOW_ITEM_TYPE_VLAN:
 			vlan_spec = item->spec;
-			vlan_mask = item->mask;
+
+			if (item->mask)
+				vlan_mask = item->mask;
+			else
+				vlan_mask = &rte_flow_item_vlan_mask;
+
 			if (en & en_ethertype) {
 				rte_flow_error_set(error, EINVAL,
 						   RTE_FLOW_ERROR_TYPE_ITEM,
@@ -324,11 +333,15 @@ bnxt_validate_and_parse_flow_type(struct bnxt *bp,
 		case RTE_FLOW_ITEM_TYPE_IPV4:
 			/* If mask is not involved, we could use EM filters. */
 			ipv4_spec = item->spec;
-			ipv4_mask = item->mask;
 
-			if (!item->spec || !item->mask)
+			if (!item->spec)
 				break;
 
+			if (item->mask)
+				ipv4_mask = item->mask;
+			else
+				ipv4_mask = &rte_flow_item_ipv4_mask;
+
 			/* Only IP DST and SRC fields are maskable. */
 			if (ipv4_mask->hdr.version_ihl ||
 			    ipv4_mask->hdr.type_of_service ||
@@ -385,11 +398,15 @@ bnxt_validate_and_parse_flow_type(struct bnxt *bp,
 			break;
 		case RTE_FLOW_ITEM_TYPE_IPV6:
 			ipv6_spec = item->spec;
-			ipv6_mask = item->mask;
 
-			if (!item->spec || !item->mask)
+			if (!item->spec)
 				break;
 
+			if (item->mask)
+				ipv6_mask = item->mask;
+			else
+				ipv6_mask = &rte_flow_item_ipv6_mask;
+
 			/* Only IP DST and SRC fields are maskable. */
 			if (ipv6_mask->hdr.vtc_flow ||
 			    ipv6_mask->hdr.payload_len ||
@@ -437,11 +454,15 @@ bnxt_validate_and_parse_flow_type(struct bnxt *bp,
 			break;
 		case RTE_FLOW_ITEM_TYPE_TCP:
 			tcp_spec = item->spec;
-			tcp_mask = item->mask;
 
-			if (!item->spec || !item->mask)
+			if (!item->spec)
 				break;
 
+			if (item->mask)
+				tcp_mask = item->mask;
+			else
+				tcp_mask = &rte_flow_item_tcp_mask;
+
 			/* Check TCP mask. Only DST & SRC ports are maskable */
 			if (tcp_mask->hdr.sent_seq ||
 			    tcp_mask->hdr.recv_ack ||
@@ -482,11 +503,15 @@ bnxt_validate_and_parse_flow_type(struct bnxt *bp,
 			break;
 		case RTE_FLOW_ITEM_TYPE_UDP:
 			udp_spec = item->spec;
-			udp_mask = item->mask;
 
-			if (!item->spec || !item->mask)
+			if (!item->spec)
 				break;
 
+			if (item->mask)
+				udp_mask = item->mask;
+			else
+				udp_mask = &rte_flow_item_udp_mask;
+
 			if (udp_mask->hdr.dgram_len ||
 			    udp_mask->hdr.dgram_cksum) {
 				rte_flow_error_set(error,
-- 
2.25.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [dpdk-stable] [PATCH 1/1] net/bnxt: fix handling of null flow mask
  2021-03-18 19:52 [dpdk-stable] [PATCH 1/1] net/bnxt: fix handling of null flow mask Lance Richardson
@ 2021-03-19  3:51 ` Ajit Khaparde
  0 siblings, 0 replies; 2+ messages in thread
From: Ajit Khaparde @ 2021-03-19  3:51 UTC (permalink / raw)
  To: Lance Richardson; +Cc: Somnath Kotur, dpdk-dev, dpdk stable

[-- Attachment #1: Type: text/plain, Size: 5444 bytes --]

On Thu, Mar 18, 2021 at 12:52 PM Lance Richardson
<lance.richardson@broadcom.com> wrote:
>
> When the mask field of an rte_flow pattern item is NULL,
> the default mask for that item type should be used.
>
> Fixes: 5ef3b79fdfe6 ("net/bnxt: support flow filter ops")
> Cc: stable@dpdk.org
>
> Signed-off-by: Lance Richardson <lance.richardson@broadcom.com>
Patch applied to dpdk-next-net-brcm.

> ---
>  drivers/net/bnxt/bnxt_flow.c | 47 +++++++++++++++++++++++++++---------
>  1 file changed, 36 insertions(+), 11 deletions(-)
>
> diff --git a/drivers/net/bnxt/bnxt_flow.c b/drivers/net/bnxt/bnxt_flow.c
> index a8f5d91fc4..e3906b4779 100644
> --- a/drivers/net/bnxt/bnxt_flow.c
> +++ b/drivers/net/bnxt/bnxt_flow.c
> @@ -188,11 +188,15 @@ bnxt_validate_and_parse_flow_type(struct bnxt *bp,
>                                 PMD_DRV_LOG(DEBUG, "Parse inner header\n");
>                         break;
>                 case RTE_FLOW_ITEM_TYPE_ETH:
> -                       if (!item->spec || !item->mask)
> +                       if (!item->spec)
>                                 break;
>
>                         eth_spec = item->spec;
> -                       eth_mask = item->mask;
> +
> +                       if (item->mask)
> +                               eth_mask = item->mask;
> +                       else
> +                               eth_mask = &rte_flow_item_eth_mask;
>
>                         /* Source MAC address mask cannot be partially set.
>                          * Should be All 0's or all 1's.
> @@ -281,7 +285,12 @@ bnxt_validate_and_parse_flow_type(struct bnxt *bp,
>                         break;
>                 case RTE_FLOW_ITEM_TYPE_VLAN:
>                         vlan_spec = item->spec;
> -                       vlan_mask = item->mask;
> +
> +                       if (item->mask)
> +                               vlan_mask = item->mask;
> +                       else
> +                               vlan_mask = &rte_flow_item_vlan_mask;
> +
>                         if (en & en_ethertype) {
>                                 rte_flow_error_set(error, EINVAL,
>                                                    RTE_FLOW_ERROR_TYPE_ITEM,
> @@ -324,11 +333,15 @@ bnxt_validate_and_parse_flow_type(struct bnxt *bp,
>                 case RTE_FLOW_ITEM_TYPE_IPV4:
>                         /* If mask is not involved, we could use EM filters. */
>                         ipv4_spec = item->spec;
> -                       ipv4_mask = item->mask;
>
> -                       if (!item->spec || !item->mask)
> +                       if (!item->spec)
>                                 break;
>
> +                       if (item->mask)
> +                               ipv4_mask = item->mask;
> +                       else
> +                               ipv4_mask = &rte_flow_item_ipv4_mask;
> +
>                         /* Only IP DST and SRC fields are maskable. */
>                         if (ipv4_mask->hdr.version_ihl ||
>                             ipv4_mask->hdr.type_of_service ||
> @@ -385,11 +398,15 @@ bnxt_validate_and_parse_flow_type(struct bnxt *bp,
>                         break;
>                 case RTE_FLOW_ITEM_TYPE_IPV6:
>                         ipv6_spec = item->spec;
> -                       ipv6_mask = item->mask;
>
> -                       if (!item->spec || !item->mask)
> +                       if (!item->spec)
>                                 break;
>
> +                       if (item->mask)
> +                               ipv6_mask = item->mask;
> +                       else
> +                               ipv6_mask = &rte_flow_item_ipv6_mask;
> +
>                         /* Only IP DST and SRC fields are maskable. */
>                         if (ipv6_mask->hdr.vtc_flow ||
>                             ipv6_mask->hdr.payload_len ||
> @@ -437,11 +454,15 @@ bnxt_validate_and_parse_flow_type(struct bnxt *bp,
>                         break;
>                 case RTE_FLOW_ITEM_TYPE_TCP:
>                         tcp_spec = item->spec;
> -                       tcp_mask = item->mask;
>
> -                       if (!item->spec || !item->mask)
> +                       if (!item->spec)
>                                 break;
>
> +                       if (item->mask)
> +                               tcp_mask = item->mask;
> +                       else
> +                               tcp_mask = &rte_flow_item_tcp_mask;
> +
>                         /* Check TCP mask. Only DST & SRC ports are maskable */
>                         if (tcp_mask->hdr.sent_seq ||
>                             tcp_mask->hdr.recv_ack ||
> @@ -482,11 +503,15 @@ bnxt_validate_and_parse_flow_type(struct bnxt *bp,
>                         break;
>                 case RTE_FLOW_ITEM_TYPE_UDP:
>                         udp_spec = item->spec;
> -                       udp_mask = item->mask;
>
> -                       if (!item->spec || !item->mask)
> +                       if (!item->spec)
>                                 break;
>
> +                       if (item->mask)
> +                               udp_mask = item->mask;
> +                       else
> +                               udp_mask = &rte_flow_item_udp_mask;
> +
>                         if (udp_mask->hdr.dgram_len ||
>                             udp_mask->hdr.dgram_cksum) {
>                                 rte_flow_error_set(error,
> --
> 2.25.1
>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-03-19  3:52 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-18 19:52 [dpdk-stable] [PATCH 1/1] net/bnxt: fix handling of null flow mask Lance Richardson
2021-03-19  3:51 ` Ajit Khaparde

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).