net/mlx5: fix LRO configuration in drop Rx queue
[dpdk.git] / drivers / net / mlx5 / mlx5_flow_meter.c
index 2310ea6..a3d1f2c 100644 (file)
@@ -15,6 +15,9 @@
 #include "mlx5.h"
 #include "mlx5_flow.h"
 
+static int mlx5_flow_meter_disable(struct rte_eth_dev *dev,
+               uint32_t meter_id, struct rte_mtr_error *error);
+
 /**
  * Create the meter action.
  *
@@ -658,8 +661,8 @@ mlx5_flow_meter_policy_validate(struct rte_eth_dev *dev,
        struct rte_mtr_error *error)
 {
        struct mlx5_priv *priv = dev->data->dev_private;
-       struct rte_flow_attr attr = { .transfer =
-                       priv->config.dv_esw_en ? 1 : 0};
+       struct rte_flow_attr attr = { .transfer = priv->sh->config.dv_esw_en ?
+                                                 1 : 0 };
        bool is_rss = false;
        uint8_t policy_mode;
        uint8_t domain_bitmap;
@@ -746,8 +749,8 @@ mlx5_flow_meter_policy_add(struct rte_eth_dev *dev,
                        struct rte_mtr_error *error)
 {
        struct mlx5_priv *priv = dev->data->dev_private;
-       struct rte_flow_attr attr = { .transfer =
-                       priv->config.dv_esw_en ? 1 : 0};
+       struct rte_flow_attr attr = { .transfer = priv->sh->config.dv_esw_en ?
+                                                 1 : 0 };
        uint32_t sub_policy_idx = 0;
        uint32_t policy_idx = 0;
        struct mlx5_flow_meter_policy *mtr_policy = NULL;
@@ -1213,7 +1216,7 @@ mlx5_flow_meter_create(struct rte_eth_dev *dev, uint32_t meter_id,
                        (&priv->sh->mtrmng->def_policy_ref_cnt,
                        1, __ATOMIC_RELAXED);
                domain_bitmap = MLX5_MTR_ALL_DOMAIN_BIT;
-               if (!priv->config.dv_esw_en)
+               if (!priv->sh->config.dv_esw_en)
                        domain_bitmap &= ~MLX5_MTR_DOMAIN_TRANSFER_BIT;
        } else {
                if (!priv->sh->meter_aso_en)
@@ -1288,7 +1291,7 @@ mlx5_flow_meter_create(struct rte_eth_dev *dev, uint32_t meter_id,
        }
        /* Add to the flow meter list. */
        fm->active_state = 1; /* Config meter starts as active. */
-       fm->is_enable = 1;
+       fm->is_enable = params->meter_enable;
        fm->shared = !!shared;
        __atomic_add_fetch(&fm->profile->ref_cnt, 1, __ATOMIC_RELAXED);
        if (params->meter_policy_id == priv->sh->mtrmng->def_policy_id) {
@@ -1313,7 +1316,10 @@ mlx5_flow_meter_create(struct rte_eth_dev *dev, uint32_t meter_id,
                data.dword = mtr_idx;
                if (mlx5_l3t_set_entry(priv->mtr_idx_tbl, meter_id, &data))
                        goto error;
+       } else if (!params->meter_enable && mlx5_flow_meter_disable(dev, meter_id, error)) {
+               goto error;
        }
+       fm->active_state = params->meter_enable;
        if (mtr_policy)
                __atomic_add_fetch(&mtr_policy->ref_cnt, 1, __ATOMIC_RELAXED);
        return 0;
@@ -1726,7 +1732,7 @@ mlx5_flow_meter_stats_read(struct rte_eth_dev *dev,
        memset(stats, 0, sizeof(*stats));
        if (fm->drop_cnt) {
                ret = mlx5_counter_query(dev, fm->drop_cnt, clear, &pkts,
-                                                &bytes);
+                                                &bytes, NULL);
                if (ret)
                        goto error;
                /* If need to read the packets, set it. */