- pthread_mutex_init(&priv->timer_lock, NULL);
- pthread_cond_init(&priv->timer_cond, NULL);
- priv->timer_on = 0;
- priv->timer_delay_us = MLX5_VDPA_DEFAULT_TIMER_DELAY_US;
- ret = pthread_create(&priv->timer_tid, NULL, mlx5_vdpa_poll_handle,
- (void *)priv);
- if (ret) {
- DRV_LOG(ERR, "Failed to create timer thread.");
- return -1;
+ if (priv->event_mode != MLX5_VDPA_EVENT_MODE_ONLY_INTERRUPT) {
+ pthread_mutex_init(&priv->timer_lock, NULL);
+ pthread_cond_init(&priv->timer_cond, NULL);
+ priv->timer_on = 0;
+ ret = pthread_create(&priv->timer_tid, NULL,
+ mlx5_vdpa_poll_handle, (void *)priv);
+ if (ret) {
+ DRV_LOG(ERR, "Failed to create timer thread.");
+ return -1;
+ }