net/mlx5: fix E-Switch egress mirror flow validation
[dpdk.git] / drivers / net / bnxt / bnxt_flow.c
index 320b53d..a8f5d91 100644 (file)
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2014-2018 Broadcom
+ * Copyright(c) 2014-2021 Broadcom
  * All rights reserved.
  */
 
@@ -554,7 +554,7 @@ bnxt_validate_and_parse_flow_type(struct bnxt *bp,
                        }
 
                        /* Check if VNI is masked. */
-                       if (vxlan_spec && vxlan_mask) {
+                       if (vxlan_mask != NULL) {
                                vni_masked =
                                        !!memcmp(vxlan_mask->vni, vni_mask,
                                                 RTE_DIM(vni_mask));
@@ -1056,6 +1056,13 @@ start:
                }
                PMD_DRV_LOG(DEBUG, "Queue index %d\n", act_q->index);
 
+               if (use_ntuple && !BNXT_RFS_NEEDS_VNIC(bp)) {
+                       filter->flags =
+                               HWRM_CFA_NTUPLE_FILTER_ALLOC_INPUT_FLAGS_DEST_RFS_RING_IDX;
+                       filter->dst_id = act_q->index;
+                       goto skip_vnic_alloc;
+               }
+
                vnic_id = attr->group;
                if (!vnic_id) {
                        PMD_DRV_LOG(DEBUG, "Group id is 0\n");
@@ -1127,7 +1134,7 @@ use_vnic:
                PMD_DRV_LOG(DEBUG,
                            "Setting vnic ff_idx %d\n", vnic->ff_pool_idx);
                filter->dst_id = vnic->fw_vnic_id;
-
+skip_vnic_alloc:
                /* For ntuple filter, create the L2 filter with default VNIC.
                 * The user specified redirect queue will be set while creating
                 * the ntuple filter in hardware.
@@ -1365,6 +1372,8 @@ use_vnic:
                if (vnic->rx_queue_cnt > 1) {
                        vnic->hash_type =
                                bnxt_rte_to_hwrm_hash_types(rss->types);
+                       vnic->hash_mode =
+                       bnxt_rte_to_hwrm_hash_level(bp, rss->types, rss->level);
 
                        if (!rss->key_len) {
                                /* If hash key has not been specified,
@@ -1806,7 +1815,10 @@ bnxt_flow_create(struct rte_eth_dev *dev,
                }
        }
 
-       vnic = find_matching_vnic(bp, filter);
+       if (BNXT_RFS_NEEDS_VNIC(bp))
+               vnic = find_matching_vnic(bp, filter);
+       else
+               vnic = BNXT_GET_DEFAULT_VNIC(bp);
 done:
        if (!ret || update_flow) {
                flow->filter = filter;