net/mlx5: move static asserts to global scope
[dpdk.git] / drivers / net / mlx5 / mlx5_txpp.c
index 8aad92f..d61e43e 100644 (file)
 #include "mlx5_rxtx.h"
 #include "mlx5_common_os.h"
 
+static_assert(sizeof(struct mlx5_cqe_ts) == sizeof(rte_int128_t),
+               "Wrong timestamp CQE part size");
+
 static const char * const mlx5_txpp_stat_names[] = {
-       "txpp_err_miss_int", /* Missed service interrupt. */
-       "txpp_err_rearm_queue", /* Rearm Queue errors. */
-       "txpp_err_clock_queue", /* Clock Queue errors. */
-       "txpp_err_ts_past", /* Timestamp in the past. */
-       "txpp_err_ts_future", /* Timestamp in the distant future. */
-       "txpp_jitter", /* Timestamp jitter (one Clock Queue completion). */
-       "txpp_wander", /* Timestamp jitter (half of Clock Queue completions). */
-       "txpp_sync_lost", /* Scheduling synchronization lost. */
+       "tx_pp_missed_interrupt_errors", /* Missed service interrupt. */
+       "tx_pp_rearm_queue_errors", /* Rearm Queue errors. */
+       "tx_pp_clock_queue_errors", /* Clock Queue errors. */
+       "tx_pp_timestamp_past_errors", /* Timestamp in the past. */
+       "tx_pp_timestamp_future_errors", /* Timestamp in the distant future. */
+       "tx_pp_jitter", /* Timestamp jitter (one Clock Queue completion). */
+       "tx_pp_wander", /* Timestamp wander (half of Clock Queue CQEs). */
+       "tx_pp_sync_lost", /* Scheduling synchronization lost. */
 };
 
 /* Destroy Event Queue Notification Channel. */
@@ -57,11 +60,16 @@ mlx5_txpp_create_event_channel(struct mlx5_dev_ctx_shared *sh)
 static void
 mlx5_txpp_free_pp_index(struct mlx5_dev_ctx_shared *sh)
 {
+#ifdef HAVE_MLX5DV_PP_ALLOC
        if (sh->txpp.pp) {
                mlx5_glue->dv_free_pp(sh->txpp.pp);
                sh->txpp.pp = NULL;
                sh->txpp.pp_id = 0;
        }
+#else
+       RTE_SET_USED(sh);
+       DRV_LOG(ERR, "Freeing pacing index is not supported.");
+#endif
 }
 
 /* Allocate Packet Pacing index from kernel via mlx5dv call. */
@@ -736,8 +744,6 @@ mlx5_txpp_update_timestamp(struct mlx5_dev_ctx_shared *sh)
        uint64_t ts;
        uint16_t ci;
 
-       static_assert(sizeof(struct mlx5_cqe_ts) == sizeof(rte_int128_t),
-                     "Wrong timestamp CQE part size");
        mlx5_atomic_read_cqe((rte_int128_t *)&cqe->timestamp, &to.u128);
        if (to.cts.op_own >> 4) {
                DRV_LOG(DEBUG, "Clock Queue error sync lost.");
@@ -764,15 +770,11 @@ mlx5_txpp_init_timestamp(struct mlx5_dev_ctx_shared *sh)
        sh->txpp.ts_p = 0;
        sh->txpp.ts_n = 0;
        for (wait = 0; wait < MLX5_TXPP_WAIT_INIT_TS; wait++) {
-               struct timespec onems;
-
                mlx5_txpp_update_timestamp(sh);
                if (wq->sq_ci)
                        return;
                /* Wait one millisecond and try again. */
-               onems.tv_sec = 0;
-               onems.tv_nsec = NS_PER_S / MS_PER_S;
-               nanosleep(&onems, 0);
+               rte_delay_us_sleep(US_PER_S / MS_PER_S);
        }
        DRV_LOG(ERR, "Unable to initialize timestamp.");
        sh->txpp.sync_lost = 1;