X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;ds=inline;f=drivers%2Fvdpa%2Fmlx5%2Fmlx5_vdpa_event.c;h=dd60150fee223993322df1f5ec100a2f369e7e79;hb=ee750eaa1476d55b812673fcfbe6352f67b890b4;hp=17fd9dd4fc6fe54b4a09e5d39c1933538945bbbb;hpb=30b6974441b09665617db5ce67d5d0100590a520;p=dpdk.git diff --git a/drivers/vdpa/mlx5/mlx5_vdpa_event.c b/drivers/vdpa/mlx5/mlx5_vdpa_event.c index 17fd9dd4fc..dd60150fee 100644 --- a/drivers/vdpa/mlx5/mlx5_vdpa_event.c +++ b/drivers/vdpa/mlx5/mlx5_vdpa_event.c @@ -4,6 +4,7 @@ #include #include #include +#include #include #include @@ -156,17 +157,9 @@ mlx5_vdpa_cq_create(struct mlx5_vdpa_priv *priv, uint16_t log_desc_n, rte_errno = errno; goto error; } - /* Subscribe CQ event to the guest FD only if it is not in poll mode. */ - if (callfd != -1) { - ret = mlx5_glue->devx_subscribe_devx_event_fd(priv->eventc, - callfd, - cq->cq->obj, 0); - if (ret) { - DRV_LOG(ERR, "Failed to subscribe CQE event fd."); - rte_errno = errno; - goto error; - } - } + cq->callfd = callfd; + /* Init CQ to ones to be in HW owner in the start. */ + memset((void *)(uintptr_t)cq->umem_buf, 0xFF, attr.db_umem_offset); /* First arming. */ mlx5_vdpa_cq_arm(priv, cq); return 0; @@ -231,6 +224,9 @@ mlx5_vdpa_interrupt_handler(void *cb_arg) rte_spinlock_lock(&cq->sl); mlx5_vdpa_cq_poll(priv, cq); mlx5_vdpa_cq_arm(priv, cq); + if (cq->callfd != -1) + /* Notify guest for descriptors consuming. */ + eventfd_write(cq->callfd, (eventfd_t)1); rte_spinlock_unlock(&cq->sl); DRV_LOG(DEBUG, "CQ %d event: new cq_ci = %u.", cq->cq->id, cq->cq_ci); @@ -241,8 +237,14 @@ mlx5_vdpa_interrupt_handler(void *cb_arg) int mlx5_vdpa_cqe_event_setup(struct mlx5_vdpa_priv *priv) { - int flags = fcntl(priv->eventc->fd, F_GETFL); - int ret = fcntl(priv->eventc->fd, F_SETFL, flags | O_NONBLOCK); + int flags; + int ret; + + if (!priv->eventc) + /* All virtqs are in poll mode. */ + return 0; + flags = fcntl(priv->eventc->fd, F_GETFL); + ret = fcntl(priv->eventc->fd, F_SETFL, flags | O_NONBLOCK); if (ret) { DRV_LOG(ERR, "Failed to change event channel FD."); rte_errno = errno;