common/mlx5: fix device list operations concurrency
[dpdk.git] / drivers / event / cnxk / cn9k_worker.h
index cc1e141..3e8f214 100644 (file)
@@ -8,6 +8,7 @@
 #include "cnxk_ethdev.h"
 #include "cnxk_eventdev.h"
 #include "cnxk_worker.h"
+#include "cn9k_cryptodev_ops.h"
 
 #include "cn9k_ethdev.h"
 #include "cn9k_rx.h"
@@ -187,8 +188,12 @@ cn9k_sso_hws_dual_get_work(struct cn9k_sso_hws_state *ws,
                    (gw.u64[0] & 0xffffffff);
 
        if (CNXK_TT_FROM_EVENT(gw.u64[0]) != SSO_TT_EMPTY) {
-               if (CNXK_EVENT_TYPE_FROM_TAG(gw.u64[0]) ==
-                   RTE_EVENT_TYPE_ETHDEV) {
+               if ((flags & CPT_RX_WQE_F) &&
+                   (CNXK_EVENT_TYPE_FROM_TAG(gw.u64[0]) ==
+                    RTE_EVENT_TYPE_CRYPTODEV)) {
+                       gw.u64[1] = cn9k_cpt_crypto_adapter_dequeue(gw.u64[1]);
+               } else if (CNXK_EVENT_TYPE_FROM_TAG(gw.u64[0]) ==
+                          RTE_EVENT_TYPE_ETHDEV) {
                        uint8_t port = CNXK_SUB_EVENT_FROM_TAG(gw.u64[0]);
 
                        gw.u64[0] = CNXK_CLR_SUB_EVENT(gw.u64[0]);
@@ -260,8 +265,12 @@ cn9k_sso_hws_get_work(struct cn9k_sso_hws *ws, struct rte_event *ev,
                    (gw.u64[0] & 0xffffffff);
 
        if (CNXK_TT_FROM_EVENT(gw.u64[0]) != SSO_TT_EMPTY) {
-               if (CNXK_EVENT_TYPE_FROM_TAG(gw.u64[0]) ==
-                   RTE_EVENT_TYPE_ETHDEV) {
+               if ((flags & CPT_RX_WQE_F) &&
+                   (CNXK_EVENT_TYPE_FROM_TAG(gw.u64[0]) ==
+                    RTE_EVENT_TYPE_CRYPTODEV)) {
+                       gw.u64[1] = cn9k_cpt_crypto_adapter_dequeue(gw.u64[1]);
+               } else if (CNXK_EVENT_TYPE_FROM_TAG(gw.u64[0]) ==
+                          RTE_EVENT_TYPE_ETHDEV) {
                        uint8_t port = CNXK_SUB_EVENT_FROM_TAG(gw.u64[0]);
 
                        gw.u64[0] = CNXK_CLR_SUB_EVENT(gw.u64[0]);
@@ -366,6 +375,10 @@ uint16_t __rte_hot cn9k_sso_hws_dual_enq_new_burst(void *port,
 uint16_t __rte_hot cn9k_sso_hws_dual_enq_fwd_burst(void *port,
                                                   const struct rte_event ev[],
                                                   uint16_t nb_events);
+uint16_t __rte_hot cn9k_sso_hws_ca_enq(void *port, struct rte_event ev[],
+                                      uint16_t nb_events);
+uint16_t __rte_hot cn9k_sso_hws_dual_ca_enq(void *port, struct rte_event ev[],
+                                           uint16_t nb_events);
 
 #define R(name, f5, f4, f3, f2, f1, f0, flags)                                 \
        uint16_t __rte_hot cn9k_sso_hws_deq_##name(                            \
@@ -378,6 +391,11 @@ uint16_t __rte_hot cn9k_sso_hws_dual_enq_fwd_burst(void *port,
        uint16_t __rte_hot cn9k_sso_hws_deq_tmo_burst_##name(                  \
                void *port, struct rte_event ev[], uint16_t nb_events,         \
                uint64_t timeout_ticks);                                       \
+       uint16_t __rte_hot cn9k_sso_hws_deq_ca_##name(                         \
+               void *port, struct rte_event *ev, uint64_t timeout_ticks);     \
+       uint16_t __rte_hot cn9k_sso_hws_deq_ca_burst_##name(                   \
+               void *port, struct rte_event ev[], uint16_t nb_events,         \
+               uint64_t timeout_ticks);                                       \
        uint16_t __rte_hot cn9k_sso_hws_deq_seg_##name(                        \
                void *port, struct rte_event *ev, uint64_t timeout_ticks);     \
        uint16_t __rte_hot cn9k_sso_hws_deq_seg_burst_##name(                  \
@@ -386,6 +404,11 @@ uint16_t __rte_hot cn9k_sso_hws_dual_enq_fwd_burst(void *port,
        uint16_t __rte_hot cn9k_sso_hws_deq_tmo_seg_##name(                    \
                void *port, struct rte_event *ev, uint64_t timeout_ticks);     \
        uint16_t __rte_hot cn9k_sso_hws_deq_tmo_seg_burst_##name(              \
+               void *port, struct rte_event ev[], uint16_t nb_events,         \
+               uint64_t timeout_ticks);                                       \
+       uint16_t __rte_hot cn9k_sso_hws_deq_ca_seg_##name(                     \
+               void *port, struct rte_event *ev, uint64_t timeout_ticks);     \
+       uint16_t __rte_hot cn9k_sso_hws_deq_ca_seg_burst_##name(               \
                void *port, struct rte_event ev[], uint16_t nb_events,         \
                uint64_t timeout_ticks);
 
@@ -403,6 +426,11 @@ NIX_RX_FASTPATH_MODES
        uint16_t __rte_hot cn9k_sso_hws_dual_deq_tmo_burst_##name(             \
                void *port, struct rte_event ev[], uint16_t nb_events,         \
                uint64_t timeout_ticks);                                       \
+       uint16_t __rte_hot cn9k_sso_hws_dual_deq_ca_##name(                    \
+               void *port, struct rte_event *ev, uint64_t timeout_ticks);     \
+       uint16_t __rte_hot cn9k_sso_hws_dual_deq_ca_burst_##name(              \
+               void *port, struct rte_event ev[], uint16_t nb_events,         \
+               uint64_t timeout_ticks);                                       \
        uint16_t __rte_hot cn9k_sso_hws_dual_deq_seg_##name(                   \
                void *port, struct rte_event *ev, uint64_t timeout_ticks);     \
        uint16_t __rte_hot cn9k_sso_hws_dual_deq_seg_burst_##name(             \
@@ -411,6 +439,11 @@ NIX_RX_FASTPATH_MODES
        uint16_t __rte_hot cn9k_sso_hws_dual_deq_tmo_seg_##name(               \
                void *port, struct rte_event *ev, uint64_t timeout_ticks);     \
        uint16_t __rte_hot cn9k_sso_hws_dual_deq_tmo_seg_burst_##name(         \
+               void *port, struct rte_event ev[], uint16_t nb_events,         \
+               uint64_t timeout_ticks);                                       \
+       uint16_t __rte_hot cn9k_sso_hws_dual_deq_ca_seg_##name(                \
+               void *port, struct rte_event *ev, uint64_t timeout_ticks);     \
+       uint16_t __rte_hot cn9k_sso_hws_dual_deq_ca_seg_burst_##name(          \
                void *port, struct rte_event ev[], uint16_t nb_events,         \
                uint64_t timeout_ticks);
 
@@ -420,7 +453,8 @@ NIX_RX_FASTPATH_MODES
 static __rte_always_inline void
 cn9k_sso_txq_fc_wait(const struct cn9k_eth_txq *txq)
 {
-       while (!(((txq)->nb_sqb_bufs_adj - *(txq)->fc_mem)
+       while (!((txq->nb_sqb_bufs_adj -
+                 __atomic_load_n(txq->fc_mem, __ATOMIC_RELAXED))
                 << (txq)->sqes_per_sqb_log2))
                ;
 }