X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=drivers%2Fvdpa%2Fmlx5%2Fmlx5_vdpa.h;h=98c71aad4cc4202209c111e477f4902760081ef3;hb=306a2fcd1b2d549b4094232f0a03c9c62228e298;hp=fcbc12ab0c669c5d13ebd8e7d3deab372d8c35fc;hpb=118494d3ad0882a3be77a99457f8659df15756d6;p=dpdk.git diff --git a/drivers/vdpa/mlx5/mlx5_vdpa.h b/drivers/vdpa/mlx5/mlx5_vdpa.h index fcbc12ab0c..98c71aad4c 100644 --- a/drivers/vdpa/mlx5/mlx5_vdpa.h +++ b/drivers/vdpa/mlx5/mlx5_vdpa.h @@ -22,6 +22,7 @@ #include #include +#include #include @@ -36,7 +37,7 @@ #define VIRTIO_F_RING_PACKED 34 #endif -#define MLX5_VDPA_DEFAULT_TIMER_DELAY_US 100u +#define MLX5_VDPA_DEFAULT_TIMER_DELAY_US 0u #define MLX5_VDPA_DEFAULT_TIMER_STEP_US 1u struct mlx5_vdpa_cq { @@ -46,13 +47,7 @@ struct mlx5_vdpa_cq { uint32_t armed:1; int callfd; rte_spinlock_t sl; - struct mlx5_devx_obj *cq; - struct mlx5dv_devx_umem *umem_obj; - union { - volatile void *umem_buf; - volatile struct mlx5_cqe *cqes; - }; - volatile uint32_t *db_rec; + struct mlx5_devx_cq cq_obj; uint64_t errors; }; @@ -87,6 +82,7 @@ struct mlx5_vdpa_virtq { uint16_t vq_size; uint8_t notifier_state; bool stopped; + uint32_t version; struct mlx5_vdpa_priv *priv; struct mlx5_devx_obj *virtq; struct mlx5_devx_obj *counters; @@ -97,6 +93,8 @@ struct mlx5_vdpa_virtq { uint32_t size; } umems[3]; struct rte_intr_handle intr_handle; + uint64_t err_time[3]; /* RDTSC time of recent errors. */ + uint32_t n_retry; struct mlx5_devx_virtio_q_couners_attr reset; }; @@ -128,9 +126,13 @@ struct mlx5_vdpa_priv { pthread_cond_t timer_cond; volatile uint8_t timer_on; int event_mode; + int event_core; /* Event thread cpu affinity core. */ uint32_t event_us; uint32_t timer_delay_us; uint32_t no_traffic_time_s; + uint8_t hw_latency_mode; /* Hardware CQ moderation mode. */ + uint16_t hw_max_latency_us; /* Hardware CQ moderation period in usec. */ + uint16_t hw_max_pending_comp; /* Hardware CQ moderation counter. */ struct rte_vdpa_device *vdev; /* vDPA device. */ int vid; /* vhost device id. */ struct ibv_context *ctx; /* Device context. */ @@ -141,13 +143,15 @@ struct mlx5_vdpa_priv { uint32_t gpa_mkey_index; struct ibv_mr *null_mr; struct rte_vhost_memory *vmem; - uint32_t eqn; struct mlx5dv_devx_event_channel *eventc; + struct mlx5dv_devx_event_channel *err_chnl; struct mlx5dv_devx_uar *uar; struct rte_intr_handle intr_handle; + struct rte_intr_handle err_intr_handle; struct mlx5_devx_obj *td; - struct mlx5_devx_obj *tis; + struct mlx5_devx_obj *tiss[16]; /* TIS list for each LAG port. */ uint16_t nr_virtqs; + uint8_t num_lag_ports; uint64_t features; /* Negotiated features. */ uint16_t log_max_rqt_size; struct mlx5_vdpa_steer steer; @@ -259,6 +263,25 @@ int mlx5_vdpa_cqe_event_setup(struct mlx5_vdpa_priv *priv); */ void mlx5_vdpa_cqe_event_unset(struct mlx5_vdpa_priv *priv); +/** + * Setup error interrupt handler. + * + * @param[in] priv + * The vdpa driver private structure. + * + * @return + * 0 on success, a negative errno value otherwise and rte_errno is set. + */ +int mlx5_vdpa_err_event_setup(struct mlx5_vdpa_priv *priv); + +/** + * Unset error event handler. + * + * @param[in] priv + * The vdpa driver private structure. + */ +void mlx5_vdpa_err_event_unset(struct mlx5_vdpa_priv *priv); + /** * Release a virtq and all its related resources. * @@ -392,6 +415,19 @@ int mlx5_vdpa_virtq_modify(struct mlx5_vdpa_virtq *virtq, int state); */ int mlx5_vdpa_virtq_stop(struct mlx5_vdpa_priv *priv, int index); +/** + * Query virtq information. + * + * @param[in] priv + * The vdpa driver private structure. + * @param[in] index + * The virtq index. + * + * @return + * 0 on success, a negative value otherwise. + */ +int mlx5_vdpa_virtq_query(struct mlx5_vdpa_priv *priv, int index); + /** * Get virtq statistics. *