Branch data Line data Source code
1 : : /* SPDX-License-Identifier: BSD-3-Clause
2 : : * Copyright(C) 2024 Marvell.
3 : : */
4 : :
5 : : #ifndef __CN20K_WORKER_H__
6 : : #define __CN20K_WORKER_H__
7 : :
8 : : #include <rte_event_timer_adapter.h>
9 : : #include <rte_eventdev.h>
10 : :
11 : : #include "cn20k_cryptodev_event_dp.h"
12 : : #include "cn20k_eventdev.h"
13 : : #include "cn20k_rx.h"
14 : : #include "cnxk_worker.h"
15 : :
16 : : /* CN20K Rx event fastpath */
17 : :
18 : : static __rte_always_inline void
19 : : cn20k_wqe_to_mbuf(uint64_t wqe, const uint64_t __mbuf, uint8_t port_id, const uint32_t tag,
20 : : const uint32_t flags, const void *const lookup_mem, uintptr_t cpth,
21 : : uintptr_t sa_base)
22 : : {
23 : : const uint64_t mbuf_init =
24 : : 0x100010000ULL | RTE_PKTMBUF_HEADROOM | (flags & NIX_RX_OFFLOAD_TSTAMP_F ? 8 : 0);
25 : 0 : struct rte_mbuf *mbuf = (struct rte_mbuf *)__mbuf;
26 : : uint64_t buf_sz = 0;
27 : :
28 : : if (flags & NIX_RX_REAS_F)
29 : : buf_sz = cnxk_nix_inl_bufsize_get(port_id, lookup_mem);
30 : :
31 : 0 : cn20k_nix_cqe_to_mbuf((struct nix_cqe_hdr_s *)wqe, tag, (struct rte_mbuf *)mbuf, lookup_mem,
32 [ # # # # ]: 0 : mbuf_init | ((uint64_t)port_id) << 48, cpth, sa_base, buf_sz, flags);
33 : : }
34 : :
35 : : static void
36 : 0 : cn20k_sso_process_tstamp(uint64_t u64, uint64_t mbuf, struct cnxk_timesync_info *tstamp)
37 : : {
38 : : uint64_t tstamp_ptr;
39 : : uint8_t laptr;
40 : :
41 : 0 : laptr = (uint8_t)*(uint64_t *)(u64 + (CNXK_SSO_WQE_LAYR_PTR * sizeof(uint64_t)));
42 [ # # ]: 0 : if (laptr == sizeof(uint64_t)) {
43 : : /* Extracting tstamp, if PTP enabled*/
44 : 0 : tstamp_ptr = *(uint64_t *)(((struct nix_wqe_hdr_s *)u64) + CNXK_SSO_WQE_SG_PTR);
45 [ # # ]: 0 : cn20k_nix_mbuf_to_tstamp((struct rte_mbuf *)mbuf, tstamp, true,
46 : : (uint64_t *)tstamp_ptr);
47 : : }
48 : 0 : }
49 : :
50 : : static __rte_always_inline void
51 : : cn20k_process_vwqe(uintptr_t vwqe, uint16_t port_id, const uint32_t flags, struct cn20k_sso_hws *ws)
52 : : {
53 : : uint64_t mbuf_init = 0x100010000ULL | RTE_PKTMBUF_HEADROOM;
54 : 0 : struct cnxk_timesync_info *tstamp = ws->tstamp[port_id];
55 : : uint8_t m_sz = sizeof(struct rte_mbuf);
56 : 0 : void *lookup_mem = ws->lookup_mem;
57 : 0 : uintptr_t lbase = ws->lmt_base;
58 : : uint64_t meta_aura = 0, laddr;
59 : : struct rte_event_vector *vec;
60 : : uint16_t nb_mbufs, non_vec;
61 : : struct rte_mempool *mp;
62 : : uint16_t lmt_id, d_off;
63 : : struct rte_mbuf **wqe;
64 : : struct rte_mbuf *mbuf;
65 : : uint64_t sa_base = 0;
66 : : uint64_t buf_sz = 0;
67 : : uintptr_t cpth = 0;
68 : : uint8_t loff = 0;
69 : : int i;
70 : :
71 : 0 : mbuf_init |= ((uint64_t)port_id) << 48;
72 : : vec = (struct rte_event_vector *)vwqe;
73 : 0 : wqe = vec->mbufs;
74 : :
75 : 0 : rte_prefetch0(&vec->ptrs[0]);
76 : : #define OBJS_PER_CLINE (RTE_CACHE_LINE_SIZE / sizeof(void *))
77 [ # # # # : 0 : for (i = OBJS_PER_CLINE; i < vec->nb_elem; i += OBJS_PER_CLINE)
# # ]
78 : 0 : rte_prefetch0(&vec->ptrs[i]);
79 : :
80 [ # # # # ]: 0 : if (flags & NIX_RX_OFFLOAD_TSTAMP_F && tstamp)
81 : 0 : mbuf_init |= 8;
82 : :
83 : : if (flags & NIX_RX_OFFLOAD_SECURITY_F) {
84 : 0 : mp = (struct rte_mempool *)cnxk_nix_inl_metapool_get(port_id, lookup_mem);
85 [ # # # # ]: 0 : if (mp)
86 : 0 : meta_aura = mp->pool_id;
87 : : }
88 : :
89 : 0 : nb_mbufs = RTE_ALIGN_FLOOR(vec->nb_elem, NIX_DESCS_PER_LOOP);
90 : 0 : nb_mbufs = cn20k_nix_recv_pkts_vector(&mbuf_init, wqe, nb_mbufs, flags | NIX_RX_VWQE_F,
91 : : lookup_mem, tstamp, lbase, meta_aura);
92 : 0 : wqe += nb_mbufs;
93 : 0 : non_vec = vec->nb_elem - nb_mbufs;
94 : :
95 [ # # # # ]: 0 : if (flags & NIX_RX_OFFLOAD_SECURITY_F && non_vec) {
96 : : uint64_t sg_w1;
97 : :
98 : 0 : mbuf = (struct rte_mbuf *)((uintptr_t)wqe[0] - sizeof(struct rte_mbuf));
99 : : /* Pick first mbuf's aura handle assuming all
100 : : * mbufs are from a vec and are from same RQ.
101 : : */
102 [ # # # # ]: 0 : if (!meta_aura)
103 : 0 : meta_aura = mbuf->pool->pool_id;
104 : : ROC_LMT_BASE_ID_GET(lbase, lmt_id);
105 : : laddr = lbase;
106 : 0 : laddr += 8;
107 : 0 : sg_w1 = *(uint64_t *)(((uintptr_t)wqe[0]) + 72);
108 : 0 : d_off = sg_w1 - (uintptr_t)mbuf;
109 : 0 : sa_base = cnxk_nix_sa_base_get(mbuf_init >> 48, lookup_mem);
110 : 0 : sa_base &= ~(ROC_NIX_INL_SA_BASE_ALIGN - 1);
111 : :
112 : : if (flags & NIX_RX_REAS_F)
113 : : buf_sz = cnxk_nix_inl_bufsize_get(port_id, lookup_mem);
114 : : }
115 : :
116 [ # # # # : 0 : while (non_vec) {
# # ]
117 : 0 : struct nix_cqe_hdr_s *cqe = (struct nix_cqe_hdr_s *)wqe[0];
118 : :
119 : 0 : mbuf = (struct rte_mbuf *)((char *)cqe - sizeof(struct rte_mbuf));
120 : :
121 : : /* Mark mempool obj as "get" as it is alloc'ed by NIX */
122 : : RTE_MEMPOOL_CHECK_COOKIES(mbuf->pool, (void **)&mbuf, 1, 1);
123 : :
124 : : /* Translate meta to mbuf */
125 : : if (flags & NIX_RX_OFFLOAD_SECURITY_F) {
126 : 0 : const uint64_t cq_w1 = *((const uint64_t *)cqe + 1);
127 : :
128 : 0 : cpth = ((uintptr_t)mbuf + (uint16_t)d_off);
129 : :
130 [ # # # # ]: 0 : if (cq_w1 & BIT(11)) {
131 : : /* Mark meta mbuf as put */
132 : : RTE_MEMPOOL_CHECK_COOKIES(mbuf->pool, (void **)&mbuf, 1, 0);
133 : :
134 : : /* Store meta in lmtline to free
135 : : * Assume all meta's from same aura.
136 : : */
137 : 0 : *(uint64_t *)(laddr + (loff << 3)) = (uint64_t)mbuf;
138 : 0 : loff = loff + 1;
139 : 0 : mbuf = (struct rte_mbuf *)(*(uint64_t *)(cpth + 8) - m_sz);
140 : : /* Mark inner mbuf as get */
141 : : RTE_MEMPOOL_CHECK_COOKIES(mbuf->pool, (void **)&mbuf, 1, 1);
142 : : }
143 : : }
144 : :
145 [ # # # # ]: 0 : cn20k_nix_cqe_to_mbuf(cqe, cqe->tag, mbuf, lookup_mem, mbuf_init, cpth, sa_base,
146 : : buf_sz, flags);
147 : :
148 : : if (flags & NIX_RX_OFFLOAD_TSTAMP_F)
149 : 0 : cn20k_sso_process_tstamp((uint64_t)wqe[0], (uint64_t)mbuf, tstamp);
150 : 0 : wqe[0] = (struct rte_mbuf *)mbuf;
151 : 0 : non_vec--;
152 : 0 : wqe++;
153 : : }
154 : :
155 : : /* Free remaining meta buffers if any */
156 [ # # # # ]: 0 : if (flags & NIX_RX_OFFLOAD_SECURITY_F && loff) {
157 : : nix_sec_flush_meta(laddr, lmt_id, loff, meta_aura);
158 : 0 : plt_io_wmb();
159 : : }
160 : 0 : }
161 : :
162 : : static __rte_always_inline void
163 : : cn20k_sso_hws_post_process(struct cn20k_sso_hws *ws, uint64_t *u64, const uint32_t flags)
164 : : {
165 : : uint8_t m_sz = sizeof(struct rte_mbuf);
166 : : uintptr_t sa_base = 0;
167 : :
168 : 0 : u64[0] = (u64[0] & (0x3ull << 32)) << 6 | (u64[0] & (0x3FFull << 36)) << 4 |
169 : 0 : (u64[0] & 0xffffffff);
170 [ # # # # : 0 : if (CNXK_EVENT_TYPE_FROM_TAG(u64[0]) == RTE_EVENT_TYPE_CRYPTODEV) {
# # ]
171 : 0 : u64[1] = cn20k_cpt_crypto_adapter_dequeue(u64[1]);
172 [ # # # # : 0 : } else if (CNXK_EVENT_TYPE_FROM_TAG(u64[0]) == RTE_EVENT_TYPE_CRYPTODEV_VECTOR) {
# # ]
173 : 0 : u64[1] = cn20k_cpt_crypto_adapter_vector_dequeue(u64[1]);
174 [ # # # # : 0 : } else if (CNXK_EVENT_TYPE_FROM_TAG(u64[0]) == RTE_EVENT_TYPE_ETHDEV) {
# # ]
175 : 0 : uint8_t port = CNXK_SUB_EVENT_FROM_TAG(u64[0]);
176 : : uintptr_t cpth = 0;
177 : : uint64_t mbuf;
178 : :
179 : 0 : mbuf = u64[1] - sizeof(struct rte_mbuf);
180 : 0 : rte_prefetch0((void *)mbuf);
181 : :
182 : : /* Mark mempool obj as "get" as it is alloc'ed by NIX */
183 : : RTE_MEMPOOL_CHECK_COOKIES(((struct rte_mbuf *)mbuf)->pool, (void **)&mbuf, 1, 1);
184 : :
185 : : if (flags & NIX_RX_OFFLOAD_SECURITY_F) {
186 : 0 : void *lookup_mem = ws->lookup_mem;
187 : : struct rte_mempool *mp = NULL;
188 : : uint64_t meta_aura;
189 : : struct rte_mbuf *m;
190 : : uint64_t iova = 0;
191 : : uint8_t loff = 0;
192 : : uint16_t d_off;
193 : : uint64_t cq_w1;
194 : :
195 : : m = (struct rte_mbuf *)mbuf;
196 : 0 : d_off = (*(uint64_t *)(u64[1] + 72)) - (uintptr_t)m;
197 : 0 : cq_w1 = *(uint64_t *)(u64[1] + 8);
198 : :
199 [ # # # # ]: 0 : sa_base = cnxk_nix_sa_base_get(port, ws->lookup_mem);
200 : 0 : sa_base &= ~(ROC_NIX_INL_SA_BASE_ALIGN - 1);
201 : :
202 [ # # # # ]: 0 : cpth = ((uintptr_t)mbuf + (uint16_t)d_off);
203 : 0 : mp = (struct rte_mempool *)cnxk_nix_inl_metapool_get(port, lookup_mem);
204 [ # # # # ]: 0 : meta_aura = mp ? mp->pool_id : m->pool->pool_id;
205 : :
206 [ # # # # ]: 0 : if (cq_w1 & BIT(11)) {
207 : : /* Mark meta mbuf as put */
208 : : RTE_MEMPOOL_CHECK_COOKIES(m->pool, (void **)&m, 1, 0);
209 : :
210 : : /* Store meta in lmtline to free
211 : : * Assume all meta's from same aura.
212 : : */
213 : : *(uint64_t *)((uintptr_t)&iova + (loff << 3)) = (uint64_t)m;
214 : : loff = loff + 1;
215 : 0 : mbuf = (uint64_t)(*(uint64_t *)(cpth + 8) - m_sz);
216 : : /* Mark inner mbuf as get */
217 : : RTE_MEMPOOL_CHECK_COOKIES(((struct rte_mbuf *)mbuf)->pool,
218 : : (void **)&mbuf, 1, 1);
219 : 0 : roc_npa_aura_op_free(meta_aura, 0, iova);
220 : : }
221 : : }
222 : :
223 : 0 : u64[0] = CNXK_CLR_SUB_EVENT(u64[0]);
224 [ # # # # ]: 0 : cn20k_wqe_to_mbuf(u64[1], mbuf, port, u64[0] & 0xFFFFF, flags, ws->lookup_mem, cpth,
225 : : sa_base);
226 : : if (flags & NIX_RX_OFFLOAD_TSTAMP_F)
227 : 0 : cn20k_sso_process_tstamp(u64[1], mbuf, ws->tstamp[port]);
228 : : u64[1] = mbuf;
229 [ # # # # : 0 : } else if (CNXK_EVENT_TYPE_FROM_TAG(u64[0]) == RTE_EVENT_TYPE_ETHDEV_VECTOR) {
# # ]
230 : 0 : uint8_t port = CNXK_SUB_EVENT_FROM_TAG(u64[0]);
231 : 0 : __uint128_t vwqe_hdr = *(__uint128_t *)u64[1];
232 : :
233 : 0 : vwqe_hdr = ((vwqe_hdr >> 64) & 0xFFF) | BIT_ULL(31) | ((vwqe_hdr & 0xFFFF) << 48) |
234 : 0 : ((uint64_t)port << 32);
235 : 0 : *(uint64_t *)u64[1] = (uint64_t)vwqe_hdr;
236 : 0 : cn20k_process_vwqe(u64[1], port, flags, ws);
237 : : /* Mark vector mempool object as get */
238 : : RTE_MEMPOOL_CHECK_COOKIES(rte_mempool_from_obj((void *)u64[1]), (void **)&u64[1], 1,
239 : : 1);
240 [ # # # # : 0 : } else if (CNXK_EVENT_TYPE_FROM_TAG(u64[0]) == RTE_EVENT_TYPE_TIMER) {
# # ]
241 : 0 : struct rte_event_timer *tev = (struct rte_event_timer *)u64[1];
242 : :
243 : 0 : tev->state = RTE_EVENT_TIMER_NOT_ARMED;
244 : 0 : u64[1] = tev->ev.u64;
245 : : }
246 : : }
247 : :
248 : : static __rte_always_inline uint16_t
249 : : cn20k_sso_hws_get_work(struct cn20k_sso_hws *ws, struct rte_event *ev, const uint32_t flags)
250 : : {
251 : : union {
252 : : __uint128_t get_work;
253 : : uint64_t u64[2];
254 : : } gw;
255 : :
256 : : gw.get_work = ws->gw_wdata;
257 : : #if defined(RTE_ARCH_ARM64)
258 : : #if defined(__clang__)
259 : : register uint64_t x0 __asm("x0") = (uint64_t)gw.u64[0];
260 : : register uint64_t x1 __asm("x1") = (uint64_t)gw.u64[1];
261 : : #if defined(RTE_ARM_USE_WFE)
262 : : plt_write64(gw.u64[0], ws->base + SSOW_LF_GWS_OP_GET_WORK0);
263 : : asm volatile(PLT_CPU_FEATURE_PREAMBLE
264 : : " ldp %[x0], %[x1], [%[tag_loc]] \n"
265 : : " tbz %[x0], %[pend_gw], done%= \n"
266 : : " sevl \n"
267 : : "rty%=: wfe \n"
268 : : " ldp %[x0], %[x1], [%[tag_loc]] \n"
269 : : " tbnz %[x0], %[pend_gw], rty%= \n"
270 : : "done%=: \n"
271 : : " dmb ld \n"
272 : : : [x0] "+r" (x0), [x1] "+r" (x1)
273 : : : [tag_loc] "r"(ws->base + SSOW_LF_GWS_WQE0),
274 : : [pend_gw] "i"(SSOW_LF_GWS_TAG_PEND_GET_WORK_BIT)
275 : : : "memory");
276 : : #else
277 : : asm volatile(".arch armv8-a+lse\n"
278 : : "caspal %[x0], %[x1], %[x0], %[x1], [%[dst]]\n"
279 : : : [x0] "+r" (x0), [x1] "+r" (x1)
280 : : : [dst] "r"(ws->base + SSOW_LF_GWS_OP_GET_WORK0)
281 : : : "memory");
282 : : #endif
283 : : gw.u64[0] = x0;
284 : : gw.u64[1] = x1;
285 : : #else
286 : : #if defined(RTE_ARM_USE_WFE)
287 : : plt_write64(gw.u64[0], ws->base + SSOW_LF_GWS_OP_GET_WORK0);
288 : : asm volatile(PLT_CPU_FEATURE_PREAMBLE
289 : : " ldp %[wdata], %H[wdata], [%[tag_loc]] \n"
290 : : " tbz %[wdata], %[pend_gw], done%= \n"
291 : : " sevl \n"
292 : : "rty%=: wfe \n"
293 : : " ldp %[wdata], %H[wdata], [%[tag_loc]] \n"
294 : : " tbnz %[wdata], %[pend_gw], rty%= \n"
295 : : "done%=: \n"
296 : : " dmb ld \n"
297 : : : [wdata] "=&r"(gw.get_work)
298 : : : [tag_loc] "r"(ws->base + SSOW_LF_GWS_WQE0),
299 : : [pend_gw] "i"(SSOW_LF_GWS_TAG_PEND_GET_WORK_BIT)
300 : : : "memory");
301 : : #else
302 : : asm volatile(PLT_CPU_FEATURE_PREAMBLE
303 : : "caspal %[wdata], %H[wdata], %[wdata], %H[wdata], [%[gw_loc]]\n"
304 : : : [wdata] "+r"(gw.get_work)
305 : : : [gw_loc] "r"(ws->base + SSOW_LF_GWS_OP_GET_WORK0)
306 : : : "memory");
307 : : #endif
308 : : #endif
309 : : #else
310 : : plt_write64(gw.u64[0], ws->base + SSOW_LF_GWS_OP_GET_WORK0);
311 : : do {
312 : : roc_load_pair(gw.u64[0], gw.u64[1], ws->base + SSOW_LF_GWS_WQE0);
313 : : } while (gw.u64[0] & BIT_ULL(63));
314 : : rte_atomic_thread_fence(rte_memory_order_seq_cst);
315 : : #endif
316 : : ws->gw_rdata = gw.u64[0];
317 : : if (gw.u64[1])
318 : : cn20k_sso_hws_post_process(ws, gw.u64, flags);
319 : :
320 : : ev->event = gw.u64[0];
321 : : ev->u64 = gw.u64[1];
322 : :
323 : : return !!gw.u64[1];
324 : : }
325 : :
326 : : /* Used in cleaning up workslot. */
327 : : static __rte_always_inline uint16_t
328 : : cn20k_sso_hws_get_work_empty(struct cn20k_sso_hws *ws, struct rte_event *ev, const uint32_t flags)
329 : : {
330 : : union {
331 : : __uint128_t get_work;
332 : : uint64_t u64[2];
333 : : } gw;
334 : :
335 : : #ifdef RTE_ARCH_ARM64
336 : : asm volatile(PLT_CPU_FEATURE_PREAMBLE
337 : : " ldp %[tag], %[wqp], [%[tag_loc]] \n"
338 : : " tbz %[tag], 63, .Ldone%= \n"
339 : : " sevl \n"
340 : : ".Lrty%=: wfe \n"
341 : : " ldp %[tag], %[wqp], [%[tag_loc]] \n"
342 : : " tbnz %[tag], 63, .Lrty%= \n"
343 : : ".Ldone%=: dmb ld \n"
344 : : : [tag] "=&r"(gw.u64[0]), [wqp] "=&r"(gw.u64[1])
345 : : : [tag_loc] "r"(ws->base + SSOW_LF_GWS_WQE0)
346 : : : "memory");
347 : : #else
348 : : do {
349 [ # # # # : 0 : roc_load_pair(gw.u64[0], gw.u64[1], ws->base + SSOW_LF_GWS_WQE0);
# # ]
350 [ # # # # : 0 : } while (gw.u64[0] & BIT_ULL(63));
# # ]
351 : : #endif
352 : :
353 : 0 : ws->gw_rdata = gw.u64[0];
354 [ # # # # : 0 : if (gw.u64[1])
# # ]
355 : : cn20k_sso_hws_post_process(ws, gw.u64, flags);
356 : : else
357 : 0 : gw.u64[0] = (gw.u64[0] & (0x3ull << 32)) << 6 |
358 : 0 : (gw.u64[0] & (0x3FFull << 36)) << 4 | (gw.u64[0] & 0xffffffff);
359 : :
360 [ # # # # ]: 0 : ev->event = gw.u64[0];
361 : : ev->u64 = gw.u64[1];
362 : :
363 : : return !!gw.u64[1];
364 : : }
365 : :
366 : : /* CN20K Fastpath functions. */
367 : : uint16_t __rte_hot cn20k_sso_hws_enq_burst(void *port, const struct rte_event ev[],
368 : : uint16_t nb_events);
369 : : uint16_t __rte_hot cn20k_sso_hws_enq_new_burst(void *port, const struct rte_event ev[],
370 : : uint16_t nb_events);
371 : : uint16_t __rte_hot cn20k_sso_hws_enq_fwd_burst(void *port, const struct rte_event ev[],
372 : : uint16_t nb_events);
373 : : int __rte_hot cn20k_sso_hws_profile_switch(void *port, uint8_t profile);
374 : : int __rte_hot cn20k_sso_hws_preschedule_modify(void *port,
375 : : enum rte_event_dev_preschedule_type type);
376 : : void __rte_hot cn20k_sso_hws_preschedule(void *port, enum rte_event_dev_preschedule_type type);
377 : :
378 : : #define R(name, flags) \
379 : : uint16_t __rte_hot cn20k_sso_hws_deq_burst_##name( \
380 : : void *port, struct rte_event ev[], uint16_t nb_events, uint64_t timeout_ticks); \
381 : : uint16_t __rte_hot cn20k_sso_hws_deq_tmo_burst_##name( \
382 : : void *port, struct rte_event ev[], uint16_t nb_events, uint64_t timeout_ticks); \
383 : : uint16_t __rte_hot cn20k_sso_hws_deq_ca_burst_##name( \
384 : : void *port, struct rte_event ev[], uint16_t nb_events, uint64_t timeout_ticks); \
385 : : uint16_t __rte_hot cn20k_sso_hws_deq_tmo_ca_burst_##name( \
386 : : void *port, struct rte_event ev[], uint16_t nb_events, uint64_t timeout_ticks); \
387 : : uint16_t __rte_hot cn20k_sso_hws_deq_seg_burst_##name( \
388 : : void *port, struct rte_event ev[], uint16_t nb_events, uint64_t timeout_ticks); \
389 : : uint16_t __rte_hot cn20k_sso_hws_deq_tmo_seg_burst_##name( \
390 : : void *port, struct rte_event ev[], uint16_t nb_events, uint64_t timeout_ticks); \
391 : : uint16_t __rte_hot cn20k_sso_hws_deq_ca_seg_burst_##name( \
392 : : void *port, struct rte_event ev[], uint16_t nb_events, uint64_t timeout_ticks); \
393 : : uint16_t __rte_hot cn20k_sso_hws_deq_tmo_ca_seg_burst_##name( \
394 : : void *port, struct rte_event ev[], uint16_t nb_events, uint64_t timeout_ticks); \
395 : : uint16_t __rte_hot cn20k_sso_hws_reas_deq_burst_##name( \
396 : : void *port, struct rte_event ev[], uint16_t nb_events, uint64_t timeout_ticks); \
397 : : uint16_t __rte_hot cn20k_sso_hws_reas_deq_tmo_burst_##name( \
398 : : void *port, struct rte_event ev[], uint16_t nb_events, uint64_t timeout_ticks); \
399 : : uint16_t __rte_hot cn20k_sso_hws_reas_deq_ca_burst_##name( \
400 : : void *port, struct rte_event ev[], uint16_t nb_events, uint64_t timeout_ticks); \
401 : : uint16_t __rte_hot cn20k_sso_hws_reas_deq_tmo_ca_burst_##name( \
402 : : void *port, struct rte_event ev[], uint16_t nb_events, uint64_t timeout_ticks); \
403 : : uint16_t __rte_hot cn20k_sso_hws_reas_deq_seg_burst_##name( \
404 : : void *port, struct rte_event ev[], uint16_t nb_events, uint64_t timeout_ticks); \
405 : : uint16_t __rte_hot cn20k_sso_hws_reas_deq_tmo_seg_burst_##name( \
406 : : void *port, struct rte_event ev[], uint16_t nb_events, uint64_t timeout_ticks); \
407 : : uint16_t __rte_hot cn20k_sso_hws_reas_deq_ca_seg_burst_##name( \
408 : : void *port, struct rte_event ev[], uint16_t nb_events, uint64_t timeout_ticks); \
409 : : uint16_t __rte_hot cn20k_sso_hws_reas_deq_tmo_ca_seg_burst_##name( \
410 : : void *port, struct rte_event ev[], uint16_t nb_events, uint64_t timeout_ticks);
411 : :
412 : : NIX_RX_FASTPATH_MODES
413 : : #undef R
414 : :
415 : : #define SSO_DEQ(fn, flags) \
416 : : static __rte_always_inline uint16_t fn(void *port, struct rte_event *ev, \
417 : : uint64_t timeout_ticks) \
418 : : { \
419 : : struct cn20k_sso_hws *ws = port; \
420 : : RTE_SET_USED(timeout_ticks); \
421 : : if (ws->swtag_req) { \
422 : : ws->swtag_req = 0; \
423 : : ws->gw_rdata = cnxk_sso_hws_swtag_wait(ws->base + SSOW_LF_GWS_WQE0); \
424 : : return 1; \
425 : : } \
426 : : return cn20k_sso_hws_get_work(ws, ev, flags); \
427 : : }
428 : :
429 : : #define SSO_DEQ_SEG(fn, flags) SSO_DEQ(fn, flags | NIX_RX_MULTI_SEG_F)
430 : :
431 : : #define SSO_DEQ_TMO(fn, flags) \
432 : : static __rte_always_inline uint16_t fn(void *port, struct rte_event *ev, \
433 : : uint64_t timeout_ticks) \
434 : : { \
435 : : struct cn20k_sso_hws *ws = port; \
436 : : uint16_t ret = 1; \
437 : : uint64_t iter; \
438 : : if (ws->swtag_req) { \
439 : : ws->swtag_req = 0; \
440 : : ws->gw_rdata = cnxk_sso_hws_swtag_wait(ws->base + SSOW_LF_GWS_WQE0); \
441 : : return ret; \
442 : : } \
443 : : ret = cn20k_sso_hws_get_work(ws, ev, flags); \
444 : : for (iter = 1; iter < timeout_ticks && (ret == 0); iter++) \
445 : : ret = cn20k_sso_hws_get_work(ws, ev, flags); \
446 : : return ret; \
447 : : }
448 : :
449 : : #define SSO_DEQ_TMO_SEG(fn, flags) SSO_DEQ_TMO(fn, flags | NIX_RX_MULTI_SEG_F)
450 : :
451 : : #define R(name, flags) \
452 : : SSO_DEQ(cn20k_sso_hws_deq_##name, flags) \
453 : : SSO_DEQ(cn20k_sso_hws_reas_deq_##name, flags | NIX_RX_REAS_F) \
454 : : SSO_DEQ_SEG(cn20k_sso_hws_deq_seg_##name, flags) \
455 : : SSO_DEQ_SEG(cn20k_sso_hws_reas_deq_seg_##name, flags | NIX_RX_REAS_F) \
456 : : SSO_DEQ_TMO(cn20k_sso_hws_deq_tmo_##name, flags) \
457 : : SSO_DEQ_TMO(cn20k_sso_hws_reas_deq_tmo_##name, flags | NIX_RX_REAS_F) \
458 : : SSO_DEQ_TMO_SEG(cn20k_sso_hws_deq_tmo_seg_##name, flags) \
459 : : SSO_DEQ_TMO_SEG(cn20k_sso_hws_reas_deq_tmo_seg_##name, flags | NIX_RX_REAS_F)
460 : :
461 : : NIX_RX_FASTPATH_MODES
462 : : #undef R
463 : :
464 : : #define SSO_CMN_DEQ_BURST(fnb, fn, flags) \
465 : : uint16_t __rte_hot fnb(void *port, struct rte_event ev[], uint16_t nb_events, \
466 : : uint64_t timeout_ticks) \
467 : : { \
468 : : RTE_SET_USED(nb_events); \
469 : : return fn(port, ev, timeout_ticks); \
470 : : }
471 : :
472 : : #define SSO_CMN_DEQ_SEG_BURST(fnb, fn, flags) \
473 : : uint16_t __rte_hot fnb(void *port, struct rte_event ev[], uint16_t nb_events, \
474 : : uint64_t timeout_ticks) \
475 : : { \
476 : : RTE_SET_USED(nb_events); \
477 : : return fn(port, ev, timeout_ticks); \
478 : : }
479 : :
480 : : uint16_t __rte_hot cn20k_sso_hws_deq_burst_all_offload(void *port, struct rte_event ev[],
481 : : uint16_t nb_events, uint64_t timeout_ticks);
482 : : uint16_t __rte_hot cn20k_sso_hws_deq_burst_all_offload_tst(void *port, struct rte_event ev[],
483 : : uint16_t nb_events,
484 : : uint64_t timeout_ticks);
485 : :
486 : : #endif
|