net/bnxt: fix link status when port is stopped
[dpdk.git] / drivers / net / mlx5 / mlx5_flow.c
index cd55bdc..f5bdf66 100644 (file)
@@ -1379,8 +1379,11 @@ flow_drv_rxq_flags_set(struct rte_eth_dev *dev,
                return;
        for (i = 0; i != ind_tbl->queues_n; ++i) {
                int idx = ind_tbl->queues[i];
-               struct mlx5_rxq_ctrl *rxq_ctrl = mlx5_rxq_ctrl_get(dev, idx);
+               struct mlx5_rxq_ctrl *rxq_ctrl;
 
+               if (mlx5_is_external_rxq(dev, idx))
+                       continue;
+               rxq_ctrl = mlx5_rxq_ctrl_get(dev, idx);
                MLX5_ASSERT(rxq_ctrl != NULL);
                if (rxq_ctrl == NULL)
                        continue;
@@ -1483,8 +1486,11 @@ flow_drv_rxq_flags_trim(struct rte_eth_dev *dev,
        MLX5_ASSERT(dev->data->dev_started);
        for (i = 0; i != ind_tbl->queues_n; ++i) {
                int idx = ind_tbl->queues[i];
-               struct mlx5_rxq_ctrl *rxq_ctrl = mlx5_rxq_ctrl_get(dev, idx);
+               struct mlx5_rxq_ctrl *rxq_ctrl;
 
+               if (mlx5_is_external_rxq(dev, idx))
+                       continue;
+               rxq_ctrl = mlx5_rxq_ctrl_get(dev, idx);
                MLX5_ASSERT(rxq_ctrl != NULL);
                if (rxq_ctrl == NULL)
                        continue;
@@ -5271,6 +5277,7 @@ flow_meter_split_prep(struct rte_eth_dev *dev,
        uint32_t flow_id = 0;
        uint32_t flow_id_reversed = 0;
        uint8_t flow_id_bits = 0;
+       bool after_meter = false;
        int shift;
 
        /* Prepare the suffix subflow items. */
@@ -5337,6 +5344,7 @@ flow_meter_split_prep(struct rte_eth_dev *dev,
                                tag_action = actions_pre++;
                                action_cur = actions_pre++;
                        }
+                       after_meter = true;
                        break;
                case RTE_FLOW_ACTION_TYPE_VXLAN_DECAP:
                case RTE_FLOW_ACTION_TYPE_NVGRE_DECAP:
@@ -5365,6 +5373,11 @@ flow_meter_split_prep(struct rte_eth_dev *dev,
                                                MLX5_RTE_FLOW_ITEM_TYPE_VLAN;
                        }
                        break;
+               case RTE_FLOW_ACTION_TYPE_COUNT:
+                       if (fm->def_policy)
+                               action_cur = after_meter ?
+                                               actions_sfx++ : actions_pre++;
+                       break;
                default:
                        break;
                }
@@ -5783,7 +5796,7 @@ flow_check_match_action(const struct rte_flow_action actions[],
        return flag ? actions_n + 1 : 0;
 }
 
-#define SAMPLE_SUFFIX_ITEM 2
+#define SAMPLE_SUFFIX_ITEM 3
 
 /**
  * Split the sample flow.
@@ -5824,6 +5837,7 @@ flow_check_match_action(const struct rte_flow_action actions[],
 static int
 flow_sample_split_prep(struct rte_eth_dev *dev,
                       int add_tag,
+                      const struct rte_flow_item items[],
                       struct rte_flow_item sfx_items[],
                       const struct rte_flow_action actions[],
                       struct rte_flow_action actions_sfx[],
@@ -5951,6 +5965,12 @@ flow_sample_split_prep(struct rte_eth_dev *dev,
                        .data = tag_id,
                };
                /* Prepare the suffix subflow items. */
+               for (; items->type != RTE_FLOW_ITEM_TYPE_END; items++) {
+                       if (items->type == RTE_FLOW_ITEM_TYPE_PORT_ID) {
+                               memcpy(sfx_items, items, sizeof(*sfx_items));
+                               sfx_items++;
+                       }
+               }
                tag_spec = (void *)(sfx_items + SAMPLE_SUFFIX_ITEM);
                tag_spec->data = tag_id;
                tag_spec->id = set_tag->id;
@@ -6386,8 +6406,10 @@ flow_create_split_meter(struct rte_eth_dev *dev,
                if (!fm->def_policy && !is_mtr_hierarchy &&
                    (!has_modify || !fm->drop_cnt))
                        set_mtr_reg = false;
-               /* Prefix actions: meter, decap, encap, tag, jump, end. */
-               act_size = sizeof(struct rte_flow_action) * (actions_n + 6) +
+               /* Prefix actions: meter, decap, encap, tag, jump, end, cnt. */
+#define METER_PREFIX_ACTION 7
+               act_size = (sizeof(struct rte_flow_action) *
+                           (actions_n + METER_PREFIX_ACTION)) +
                           sizeof(struct mlx5_rte_flow_action_set_tag);
                /* Suffix items: tag, vlan, port id, end. */
 #define METER_SUFFIX_ITEM 4
@@ -6563,7 +6585,7 @@ flow_create_split_sample(struct rte_eth_dev *dev,
                        jump_table = attr->group * MLX5_FLOW_TABLE_FACTOR +
                                     next_ft_step;
                pre_actions = sfx_actions + actions_n;
-               tag_id = flow_sample_split_prep(dev, add_tag, sfx_items,
+               tag_id = flow_sample_split_prep(dev, add_tag, items, sfx_items,
                                                actions, sfx_actions,
                                                pre_actions, actions_n,
                                                sample_action_pos,