common/cnxk: add new PCI IDs to supported devices
[dpdk.git] / drivers / event / cnxk / cnxk_tim_evdev.h
index b66aac1..2478a5c 100644 (file)
 #define CNXK_TIM_NB_CHUNK_SLOTS(sz) (((sz) / CNXK_TIM_CHUNK_ALIGNMENT) - 1)
 #define CNXK_TIM_MIN_CHUNK_SLOTS    (0x1)
 #define CNXK_TIM_MAX_CHUNK_SLOTS    (0x1FFE)
+#define CNXK_TIM_MAX_POOL_CACHE_SZ  (128)
 
 #define CN9K_TIM_MIN_TMO_TKS (256)
 
 #define CNXK_TIM_DISABLE_NPA "tim_disable_npa"
 #define CNXK_TIM_CHNK_SLOTS  "tim_chnk_slots"
+#define CNXK_TIM_STATS_ENA   "tim_stats_ena"
 #define CNXK_TIM_RINGS_LMT   "tim_rings_lmt"
+#define CNXK_TIM_RING_CTL    "tim_ring_ctl"
 
-#define CNXK_TIM_SP     0x1
-#define CNXK_TIM_MP     0x2
-#define CNXK_TIM_ENA_FB         0x10
-#define CNXK_TIM_ENA_DFB 0x20
+#define CNXK_TIM_SP       0x1
+#define CNXK_TIM_MP       0x2
+#define CNXK_TIM_ENA_FB           0x10
+#define CNXK_TIM_ENA_DFB   0x20
+#define CNXK_TIM_ENA_STATS 0x40
 
 #define TIM_BUCKET_W1_S_CHUNK_REMAINDER (48)
 #define TIM_BUCKET_W1_M_CHUNK_REMAINDER                                        \
 #define TIM_BUCKET_SEMA_WLOCK                                                  \
        (TIM_BUCKET_CHUNK_REMAIN | (1ull << TIM_BUCKET_W1_S_LOCK))
 
+struct cnxk_tim_ctl {
+       uint16_t ring;
+       uint16_t chunk_slots;
+       uint16_t disable_npa;
+       uint16_t enable_stats;
+};
+
 struct cnxk_tim_evdev {
        struct roc_tim tim;
        struct rte_eventdev *event_dev;
@@ -80,8 +91,11 @@ struct cnxk_tim_evdev {
        uint32_t chunk_sz;
        /* Dev args */
        uint8_t disable_npa;
-       uint16_t chunk_slots;
-       uint16_t min_ring_cnt;
+       uint32_t chunk_slots;
+       uint32_t min_ring_cnt;
+       uint8_t enable_stats;
+       uint16_t ring_ctl_cnt;
+       struct cnxk_tim_ctl *ring_ctl_data;
 };
 
 enum cnxk_tim_clk_src {
@@ -123,6 +137,7 @@ struct cnxk_tim_ring {
        struct rte_reciprocal_u64 fast_bkt;
        uint64_t arm_cnt;
        uint8_t prod_type_sp;
+       uint8_t enable_stats;
        uint8_t disable_npa;
        uint8_t ena_dfb;
        uint16_t ring_id;
@@ -212,23 +227,33 @@ cnxk_tim_cntfrq(void)
 #endif
 
 #define TIM_ARM_FASTPATH_MODES                                                 \
-       FP(sp, 0, 0, CNXK_TIM_ENA_DFB | CNXK_TIM_SP)                           \
-       FP(mp, 0, 1, CNXK_TIM_ENA_DFB | CNXK_TIM_MP)                           \
-       FP(fb_sp, 1, 0, CNXK_TIM_ENA_FB | CNXK_TIM_SP)                         \
-       FP(fb_mp, 1, 1, CNXK_TIM_ENA_FB | CNXK_TIM_MP)
+       FP(sp, 0, 0, 0, CNXK_TIM_ENA_DFB | CNXK_TIM_SP)                        \
+       FP(mp, 0, 0, 1, CNXK_TIM_ENA_DFB | CNXK_TIM_MP)                        \
+       FP(fb_sp, 0, 1, 0, CNXK_TIM_ENA_FB | CNXK_TIM_SP)                      \
+       FP(fb_mp, 0, 1, 1, CNXK_TIM_ENA_FB | CNXK_TIM_MP)                      \
+       FP(stats_sp, 1, 0, 0,                                                  \
+          CNXK_TIM_ENA_STATS | CNXK_TIM_ENA_DFB | CNXK_TIM_SP)                \
+       FP(stats_mp, 1, 0, 1,                                                  \
+          CNXK_TIM_ENA_STATS | CNXK_TIM_ENA_DFB | CNXK_TIM_MP)                \
+       FP(stats_fb_sp, 1, 1, 0,                                               \
+          CNXK_TIM_ENA_STATS | CNXK_TIM_ENA_FB | CNXK_TIM_SP)                 \
+       FP(stats_fb_mp, 1, 1, 1,                                               \
+          CNXK_TIM_ENA_STATS | CNXK_TIM_ENA_FB | CNXK_TIM_MP)
 
 #define TIM_ARM_TMO_FASTPATH_MODES                                             \
-       FP(dfb, 0, CNXK_TIM_ENA_DFB)                                           \
-       FP(fb, 1, CNXK_TIM_ENA_FB)
+       FP(dfb, 0, 0, CNXK_TIM_ENA_DFB)                                        \
+       FP(fb, 0, 1, CNXK_TIM_ENA_FB)                                          \
+       FP(stats_dfb, 1, 0, CNXK_TIM_ENA_STATS | CNXK_TIM_ENA_DFB)             \
+       FP(stats_fb, 1, 1, CNXK_TIM_ENA_STATS | CNXK_TIM_ENA_FB)
 
-#define FP(_name, _f2, _f1, flags)                                             \
+#define FP(_name, _f3, _f2, _f1, flags)                                        \
        uint16_t cnxk_tim_arm_burst_##_name(                                   \
                const struct rte_event_timer_adapter *adptr,                   \
                struct rte_event_timer **tim, const uint16_t nb_timers);
 TIM_ARM_FASTPATH_MODES
 #undef FP
 
-#define FP(_name, _f1, flags)                                                  \
+#define FP(_name, _f2, _f1, flags)                                             \
        uint16_t cnxk_tim_arm_tmo_tick_burst_##_name(                          \
                const struct rte_event_timer_adapter *adptr,                   \
                struct rte_event_timer **tim, const uint64_t timeout_tick,     \
@@ -236,9 +261,14 @@ TIM_ARM_FASTPATH_MODES
 TIM_ARM_TMO_FASTPATH_MODES
 #undef FP
 
+uint16_t
+cnxk_tim_timer_cancel_burst(const struct rte_event_timer_adapter *adptr,
+                           struct rte_event_timer **tim,
+                           const uint16_t nb_timers);
+
 int cnxk_tim_caps_get(const struct rte_eventdev *dev, uint64_t flags,
                      uint32_t *caps,
-                     const struct rte_event_timer_adapter_ops **ops);
+                     const struct event_timer_adapter_ops **ops);
 
 void cnxk_tim_init(struct roc_sso *sso);
 void cnxk_tim_fini(void);