sh->dev_cap.txpp_en = 0;
#endif
/* Check for LRO support. */
- if (sh->dev_cap.dest_tir && sh->dev_cap.dv_flow_en &&
- hca_attr->lro_cap) {
+ if (mlx5_devx_obj_ops_en(sh) && hca_attr->lro_cap) {
/* TBD check tunnel lro caps. */
sh->dev_cap.lro_supported = 1;
DRV_LOG(DEBUG, "Device supports LRO.");
if (mlx5_flex_item_port_init(eth_dev) < 0)
goto error;
}
- if (sh->cdev->config.devx && sh->config.dv_flow_en &&
- sh->dev_cap.dest_tir) {
+ if (mlx5_devx_obj_ops_en(sh)) {
priv->obj_ops = devx_obj_ops;
mlx5_queue_counter_id_prepare(eth_dev);
priv->obj_ops.lb_dummy_queue_create =
DR_DUMP_REC_TYPE_PMD_COUNTER = 4430,
};
+/**
+ * Indicates whether HW objects operations can be created by DevX.
+ *
+ * This function is used for both:
+ * Before creation - deciding whether to create HW objects operations by DevX.
+ * After creation - indicator if HW objects operations were created by DevX.
+ *
+ * @param sh
+ * Pointer to shared device context.
+ *
+ * @return
+ * True if HW objects were created by DevX, False otherwise.
+ */
+static inline bool
+mlx5_devx_obj_ops_en(struct mlx5_dev_ctx_shared *sh)
+{
+ /*
+ * When advanced DR API is available and DV flow is supported and
+ * DevX is supported, HW objects operations are created by DevX.
+ */
+ return (sh->cdev->config.devx && sh->config.dv_flow_en &&
+ sh->dev_cap.dest_tir);
+}
+
/* mlx5.c */
int mlx5_getenv_int(const char *);
{
struct mlx5_priv *priv = dev->data->dev_private;
- if (!priv->sh->cdev->config.devx || !priv->sh->dev_cap.dest_tir ||
- !priv->sh->config.dv_flow_en) {
+ if (!mlx5_devx_obj_ops_en(priv->sh)) {
rte_errno = ENOTSUP;
return -rte_errno;
}
dev->data->port_id, strerror(rte_errno));
goto error;
}
- if ((priv->sh->cdev->config.devx && priv->sh->config.dv_flow_en &&
- priv->sh->dev_cap.dest_tir) &&
+ if (mlx5_devx_obj_ops_en(priv->sh) &&
priv->obj_ops.lb_dummy_queue_create) {
ret = priv->obj_ops.lb_dummy_queue_create(dev);
if (ret)