vdpa/mlx5: validate notifier configuration
When both, direct and indirect notifier management cannot be configured, return an error. Signed-off-by: Matan Azrad <matan@mellanox.com> Acked-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com> Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
This commit is contained in:
parent
bd09eb7b61
commit
f6f1f024b0
@ -46,7 +46,7 @@ mlx5_vdpa_virtq_unset(struct mlx5_vdpa_virtq *virtq)
|
|||||||
int retries = MLX5_VDPA_INTR_RETRIES;
|
int retries = MLX5_VDPA_INTR_RETRIES;
|
||||||
int ret = -EAGAIN;
|
int ret = -EAGAIN;
|
||||||
|
|
||||||
if (virtq->intr_handle.fd) {
|
if (virtq->intr_handle.fd != -1) {
|
||||||
while (retries-- && ret == -EAGAIN) {
|
while (retries-- && ret == -EAGAIN) {
|
||||||
ret = rte_intr_callback_unregister(&virtq->intr_handle,
|
ret = rte_intr_callback_unregister(&virtq->intr_handle,
|
||||||
mlx5_vdpa_virtq_handler,
|
mlx5_vdpa_virtq_handler,
|
||||||
@ -59,7 +59,7 @@ mlx5_vdpa_virtq_unset(struct mlx5_vdpa_virtq *virtq)
|
|||||||
usleep(MLX5_VDPA_INTR_RETRIES_USEC);
|
usleep(MLX5_VDPA_INTR_RETRIES_USEC);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
memset(&virtq->intr_handle, 0, sizeof(virtq->intr_handle));
|
virtq->intr_handle.fd = -1;
|
||||||
}
|
}
|
||||||
if (virtq->virtq) {
|
if (virtq->virtq) {
|
||||||
claim_zero(mlx5_devx_cmd_destroy(virtq->virtq));
|
claim_zero(mlx5_devx_cmd_destroy(virtq->virtq));
|
||||||
@ -262,15 +262,25 @@ mlx5_vdpa_virtq_setup(struct mlx5_vdpa_priv *priv,
|
|||||||
rte_write32(virtq->index, priv->virtq_db_addr);
|
rte_write32(virtq->index, priv->virtq_db_addr);
|
||||||
/* Setup doorbell mapping. */
|
/* Setup doorbell mapping. */
|
||||||
virtq->intr_handle.fd = vq.kickfd;
|
virtq->intr_handle.fd = vq.kickfd;
|
||||||
virtq->intr_handle.type = RTE_INTR_HANDLE_EXT;
|
if (virtq->intr_handle.fd == -1) {
|
||||||
if (rte_intr_callback_register(&virtq->intr_handle,
|
DRV_LOG(WARNING, "Virtq %d kickfd is invalid.", index);
|
||||||
mlx5_vdpa_virtq_handler, virtq)) {
|
if (!priv->direct_notifier) {
|
||||||
virtq->intr_handle.fd = 0;
|
DRV_LOG(ERR, "Virtq %d cannot be notified.", index);
|
||||||
DRV_LOG(ERR, "Failed to register virtq %d interrupt.", index);
|
goto error;
|
||||||
goto error;
|
}
|
||||||
} else {
|
} else {
|
||||||
DRV_LOG(DEBUG, "Register fd %d interrupt for virtq %d.",
|
virtq->intr_handle.type = RTE_INTR_HANDLE_EXT;
|
||||||
virtq->intr_handle.fd, index);
|
if (rte_intr_callback_register(&virtq->intr_handle,
|
||||||
|
mlx5_vdpa_virtq_handler,
|
||||||
|
virtq)) {
|
||||||
|
virtq->intr_handle.fd = -1;
|
||||||
|
DRV_LOG(ERR, "Failed to register virtq %d interrupt.",
|
||||||
|
index);
|
||||||
|
goto error;
|
||||||
|
} else {
|
||||||
|
DRV_LOG(DEBUG, "Register fd %d interrupt for virtq %d.",
|
||||||
|
virtq->intr_handle.fd, index);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
error:
|
error:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user