net/hns3: refactor multi-process initialization
[dpdk.git] / drivers / vdpa / mlx5 / mlx5_vdpa_event.c
index 979a2ab..042d227 100644 (file)
@@ -411,12 +411,17 @@ mlx5_vdpa_err_event_setup(struct mlx5_vdpa_priv *priv)
                DRV_LOG(ERR, "Failed to change device event channel FD.");
                goto error;
        }
-       priv->err_intr_handle.fd = priv->err_chnl->fd;
-       priv->err_intr_handle.type = RTE_INTR_HANDLE_EXT;
-       if (rte_intr_callback_register(&priv->err_intr_handle,
+
+       if (rte_intr_fd_set(priv->err_intr_handle, priv->err_chnl->fd))
+               goto error;
+
+       if (rte_intr_type_set(priv->err_intr_handle, RTE_INTR_HANDLE_EXT))
+               goto error;
+
+       if (rte_intr_callback_register(priv->err_intr_handle,
                                       mlx5_vdpa_err_interrupt_handler,
                                       priv)) {
-               priv->err_intr_handle.fd = 0;
+               rte_intr_fd_set(priv->err_intr_handle, 0);
                DRV_LOG(ERR, "Failed to register error interrupt for device %d.",
                        priv->vid);
                goto error;
@@ -436,20 +441,20 @@ mlx5_vdpa_err_event_unset(struct mlx5_vdpa_priv *priv)
        int retries = MLX5_VDPA_INTR_RETRIES;
        int ret = -EAGAIN;
 
-       if (!priv->err_intr_handle.fd)
+       if (!rte_intr_fd_get(priv->err_intr_handle))
                return;
        while (retries-- && ret == -EAGAIN) {
-               ret = rte_intr_callback_unregister(&priv->err_intr_handle,
+               ret = rte_intr_callback_unregister(priv->err_intr_handle,
                                            mlx5_vdpa_err_interrupt_handler,
                                            priv);
                if (ret == -EAGAIN) {
                        DRV_LOG(DEBUG, "Try again to unregister fd %d "
                                "of error interrupt, retries = %d.",
-                               priv->err_intr_handle.fd, retries);
+                               rte_intr_fd_get(priv->err_intr_handle),
+                               retries);
                        rte_pause();
                }
        }
-       memset(&priv->err_intr_handle, 0, sizeof(priv->err_intr_handle));
        if (priv->err_chnl) {
 #ifdef HAVE_IBV_DEVX_EVENT
                union {
@@ -593,8 +598,9 @@ mlx5_vdpa_event_qp_create(struct mlx5_vdpa_priv *priv, uint16_t desc_n,
                return -1;
        if (mlx5_vdpa_cq_create(priv, log_desc_n, callfd, &eqp->cq))
                return -1;
-       attr.pd = priv->pdn;
-       attr.ts_format = mlx5_ts_format_conv(priv->qp_ts_format);
+       attr.pd = priv->cdev->pdn;
+       attr.ts_format =
+               mlx5_ts_format_conv(priv->cdev->config.hca_attr.qp_ts_format);
        eqp->fw_qp = mlx5_devx_cmd_create_qp(priv->cdev->ctx, &attr);
        if (!eqp->fw_qp) {
                DRV_LOG(ERR, "Failed to create FW QP(%u).", rte_errno);
@@ -605,7 +611,8 @@ mlx5_vdpa_event_qp_create(struct mlx5_vdpa_priv *priv, uint16_t desc_n,
        attr.rq_size = RTE_BIT32(log_desc_n);
        attr.log_rq_stride = rte_log2_u32(MLX5_WSEG_SIZE);
        attr.sq_size = 0; /* No need SQ. */
-       attr.ts_format = mlx5_ts_format_conv(priv->qp_ts_format);
+       attr.ts_format =
+               mlx5_ts_format_conv(priv->cdev->config.hca_attr.qp_ts_format);
        ret = mlx5_devx_qp_create(priv->cdev->ctx, &(eqp->sw_qp), log_desc_n,
                                  &attr, SOCKET_ID_ANY);
        if (ret) {