ethdev: add device flag to bypass auto-filled queue xstats
[dpdk.git] / drivers / net / mlx5 / linux / mlx5_os.c
index c5332a0..10f6370 100644 (file)
@@ -520,9 +520,9 @@ out:
  *   Queue index in DPDK Tx queue array.
  *
  * @return
- *   The DevX/Verbs object initialized, NULL otherwise and rte_errno is set.
+ *   0 on success, a negative errno value otherwise and rte_errno is set.
  */
-static struct mlx5_txq_obj *
+static int
 mlx5_os_txq_obj_new(struct rte_eth_dev *dev, uint16_t idx)
 {
        struct mlx5_priv *priv = dev->data->dev_private;
@@ -1098,6 +1098,20 @@ err_secondary:
                                        priv->mtr_color_reg);
                        }
                }
+#endif
+#if defined(HAVE_MLX5DV_DR) && defined(HAVE_MLX5_DR_CREATE_ACTION_FLOW_SAMPLE)
+               if (config->hca_attr.log_max_ft_sampler_num > 0  &&
+                   config->dv_flow_en) {
+                       priv->sampler_en = 1;
+                       DRV_LOG(DEBUG, "The Sampler enabled!\n");
+               } else {
+                       priv->sampler_en = 0;
+                       if (!config->hca_attr.log_max_ft_sampler_num)
+                               DRV_LOG(WARNING, "No available register for"
+                                               " Sampler.");
+                       else
+                               DRV_LOG(DEBUG, "DV flow is not supported!\n");
+               }
 #endif
        }
        if (config->tx_pp) {
@@ -1263,6 +1277,7 @@ err_secondary:
        priv->dev_data = eth_dev->data;
        eth_dev->data->mac_addrs = priv->mac;
        eth_dev->device = dpdk_dev;
+       eth_dev->data->dev_flags |= RTE_ETH_DEV_AUTOFILL_QUEUE_XSTATS;
        /* Configure the first MAC address by default. */
        if (mlx5_get_mac(eth_dev, &mac.addr_bytes)) {
                DRV_LOG(ERR,
@@ -1375,6 +1390,13 @@ err_secondary:
                                                ibv_obj_ops.drop_action_create;
                priv->obj_ops.drop_action_destroy =
                                                ibv_obj_ops.drop_action_destroy;
+#ifndef HAVE_MLX5DV_DEVX_UAR_OFFSET
+               priv->obj_ops.txq_obj_modify = ibv_obj_ops.txq_obj_modify;
+#else
+               if (!config->dv_esw_en)
+                       priv->obj_ops.txq_obj_modify =
+                                               ibv_obj_ops.txq_obj_modify;
+#endif
        } else {
                priv->obj_ops = ibv_obj_ops;
        }