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 : __uint128_t vwqe_hdr = *(__uint128_t *)u64[1];
174 : 0 : vwqe_hdr = ((vwqe_hdr >> 64) & 0xFFF) | BIT_ULL(31) | ((vwqe_hdr & 0xFFFF) << 48);
175 : 0 : *(uint64_t *)u64[1] = (uint64_t)vwqe_hdr;
176 : 0 : u64[1] = cn20k_cpt_crypto_adapter_vector_dequeue(u64[1]);
177 [ # # # # : 0 : } else if (CNXK_EVENT_TYPE_FROM_TAG(u64[0]) == RTE_EVENT_TYPE_ETHDEV) {
# # ]
178 : 0 : uint8_t port = CNXK_SUB_EVENT_FROM_TAG(u64[0]);
179 : : uintptr_t cpth = 0;
180 : : uint64_t mbuf;
181 : :
182 : 0 : mbuf = u64[1] - sizeof(struct rte_mbuf);
183 : 0 : rte_prefetch0((void *)mbuf);
184 : :
185 : : /* Mark mempool obj as "get" as it is alloc'ed by NIX */
186 : : RTE_MEMPOOL_CHECK_COOKIES(((struct rte_mbuf *)mbuf)->pool, (void **)&mbuf, 1, 1);
187 : :
188 : : if (flags & NIX_RX_OFFLOAD_SECURITY_F) {
189 : 0 : void *lookup_mem = ws->lookup_mem;
190 : : struct rte_mempool *mp = NULL;
191 : : uint64_t meta_aura;
192 : : struct rte_mbuf *m;
193 : : uint64_t iova = 0;
194 : : uint8_t loff = 0;
195 : : uint16_t d_off;
196 : : uint64_t cq_w1;
197 : :
198 : : m = (struct rte_mbuf *)mbuf;
199 : 0 : d_off = (*(uint64_t *)(u64[1] + 72)) - (uintptr_t)m;
200 : 0 : cq_w1 = *(uint64_t *)(u64[1] + 8);
201 : :
202 [ # # # # ]: 0 : sa_base = cnxk_nix_sa_base_get(port, ws->lookup_mem);
203 : 0 : sa_base &= ~(ROC_NIX_INL_SA_BASE_ALIGN - 1);
204 : :
205 [ # # # # ]: 0 : cpth = ((uintptr_t)mbuf + (uint16_t)d_off);
206 : 0 : mp = (struct rte_mempool *)cnxk_nix_inl_metapool_get(port, lookup_mem);
207 [ # # # # ]: 0 : meta_aura = mp ? mp->pool_id : m->pool->pool_id;
208 : :
209 [ # # # # ]: 0 : if (cq_w1 & BIT(11)) {
210 : : /* Mark meta mbuf as put */
211 : : RTE_MEMPOOL_CHECK_COOKIES(m->pool, (void **)&m, 1, 0);
212 : :
213 : : /* Store meta in lmtline to free
214 : : * Assume all meta's from same aura.
215 : : */
216 : : *(uint64_t *)((uintptr_t)&iova + (loff << 3)) = (uint64_t)m;
217 : : loff = loff + 1;
218 : 0 : mbuf = (uint64_t)(*(uint64_t *)(cpth + 8) - m_sz);
219 : : /* Mark inner mbuf as get */
220 : : RTE_MEMPOOL_CHECK_COOKIES(((struct rte_mbuf *)mbuf)->pool,
221 : : (void **)&mbuf, 1, 1);
222 : 0 : roc_npa_aura_op_free(meta_aura, 0, iova);
223 : : }
224 : : }
225 : :
226 : 0 : u64[0] = CNXK_CLR_SUB_EVENT(u64[0]);
227 [ # # # # ]: 0 : cn20k_wqe_to_mbuf(u64[1], mbuf, port, u64[0] & 0xFFFFF, flags, ws->lookup_mem, cpth,
228 : : sa_base);
229 : : if (flags & NIX_RX_OFFLOAD_TSTAMP_F)
230 : 0 : cn20k_sso_process_tstamp(u64[1], mbuf, ws->tstamp[port]);
231 : : u64[1] = mbuf;
232 [ # # # # : 0 : } else if (CNXK_EVENT_TYPE_FROM_TAG(u64[0]) == RTE_EVENT_TYPE_ETHDEV_VECTOR) {
# # ]
233 : 0 : uint8_t port = CNXK_SUB_EVENT_FROM_TAG(u64[0]);
234 : 0 : __uint128_t vwqe_hdr = *(__uint128_t *)u64[1];
235 : :
236 : 0 : vwqe_hdr = ((vwqe_hdr >> 64) & 0xFFF) | BIT_ULL(31) | ((vwqe_hdr & 0xFFFF) << 48) |
237 : 0 : ((uint64_t)port << 32);
238 : 0 : *(uint64_t *)u64[1] = (uint64_t)vwqe_hdr;
239 : 0 : cn20k_process_vwqe(u64[1], port, flags, ws);
240 : : /* Mark vector mempool object as get */
241 : : RTE_MEMPOOL_CHECK_COOKIES(rte_mempool_from_obj((void *)u64[1]), (void **)&u64[1], 1,
242 : : 1);
243 [ # # # # : 0 : } else if (CNXK_EVENT_TYPE_FROM_TAG(u64[0]) == RTE_EVENT_TYPE_TIMER) {
# # ]
244 : 0 : struct rte_event_timer *tev = (struct rte_event_timer *)u64[1];
245 : :
246 : 0 : tev->state = RTE_EVENT_TIMER_NOT_ARMED;
247 : 0 : u64[1] = tev->ev.u64;
248 : : }
249 : : }
250 : :
251 : : static __rte_always_inline uint16_t
252 : : cn20k_sso_hws_get_work(struct cn20k_sso_hws *ws, struct rte_event *ev, const uint32_t flags)
253 : : {
254 : : union {
255 : : __uint128_t get_work;
256 : : uint64_t u64[2];
257 : : } gw;
258 : :
259 : : gw.get_work = ws->gw_wdata;
260 : : #if defined(RTE_ARCH_ARM64)
261 : : #if defined(__clang__)
262 : : register uint64_t x0 __asm("x0") = (uint64_t)gw.u64[0];
263 : : register uint64_t x1 __asm("x1") = (uint64_t)gw.u64[1];
264 : : #if defined(RTE_ARM_USE_WFE)
265 : : plt_write64(gw.u64[0], ws->base + SSOW_LF_GWS_OP_GET_WORK0);
266 : : asm volatile(PLT_CPU_FEATURE_PREAMBLE
267 : : " ldp %[x0], %[x1], [%[tag_loc]] \n"
268 : : " tbz %[x0], %[pend_gw], done%= \n"
269 : : " sevl \n"
270 : : "rty%=: wfe \n"
271 : : " ldp %[x0], %[x1], [%[tag_loc]] \n"
272 : : " tbnz %[x0], %[pend_gw], rty%= \n"
273 : : "done%=: \n"
274 : : " dmb ld \n"
275 : : : [x0] "+r" (x0), [x1] "+r" (x1)
276 : : : [tag_loc] "r"(ws->base + SSOW_LF_GWS_WQE0),
277 : : [pend_gw] "i"(SSOW_LF_GWS_TAG_PEND_GET_WORK_BIT)
278 : : : "memory");
279 : : #else
280 : : asm volatile(".arch armv8-a+lse\n"
281 : : "caspal %[x0], %[x1], %[x0], %[x1], [%[dst]]\n"
282 : : : [x0] "+r" (x0), [x1] "+r" (x1)
283 : : : [dst] "r"(ws->base + SSOW_LF_GWS_OP_GET_WORK0)
284 : : : "memory");
285 : : #endif
286 : : gw.u64[0] = x0;
287 : : gw.u64[1] = x1;
288 : : #else
289 : : #if defined(RTE_ARM_USE_WFE)
290 : : plt_write64(gw.u64[0], ws->base + SSOW_LF_GWS_OP_GET_WORK0);
291 : : asm volatile(PLT_CPU_FEATURE_PREAMBLE
292 : : " ldp %[wdata], %H[wdata], [%[tag_loc]] \n"
293 : : " tbz %[wdata], %[pend_gw], done%= \n"
294 : : " sevl \n"
295 : : "rty%=: wfe \n"
296 : : " ldp %[wdata], %H[wdata], [%[tag_loc]] \n"
297 : : " tbnz %[wdata], %[pend_gw], rty%= \n"
298 : : "done%=: \n"
299 : : " dmb ld \n"
300 : : : [wdata] "=&r"(gw.get_work)
301 : : : [tag_loc] "r"(ws->base + SSOW_LF_GWS_WQE0),
302 : : [pend_gw] "i"(SSOW_LF_GWS_TAG_PEND_GET_WORK_BIT)
303 : : : "memory");
304 : : #else
305 : : asm volatile(PLT_CPU_FEATURE_PREAMBLE
306 : : "caspal %[wdata], %H[wdata], %[wdata], %H[wdata], [%[gw_loc]]\n"
307 : : : [wdata] "+r"(gw.get_work)
308 : : : [gw_loc] "r"(ws->base + SSOW_LF_GWS_OP_GET_WORK0)
309 : : : "memory");
310 : : #endif
311 : : #endif
312 : : #else
313 : : plt_write64(gw.u64[0], ws->base + SSOW_LF_GWS_OP_GET_WORK0);
314 : : do {
315 : : roc_load_pair(gw.u64[0], gw.u64[1], ws->base + SSOW_LF_GWS_WQE0);
316 : : } while (gw.u64[0] & BIT_ULL(63));
317 : : rte_atomic_thread_fence(rte_memory_order_seq_cst);
318 : : #endif
319 : : ws->gw_rdata = gw.u64[0];
320 : : if (gw.u64[1])
321 : : cn20k_sso_hws_post_process(ws, gw.u64, flags);
322 : :
323 : : ev->event = gw.u64[0];
324 : : ev->u64 = gw.u64[1];
325 : :
326 : : return !!gw.u64[1];
327 : : }
328 : :
329 : : /* Used in cleaning up workslot. */
330 : : static __rte_always_inline uint16_t
331 : : cn20k_sso_hws_get_work_empty(struct cn20k_sso_hws *ws, struct rte_event *ev, const uint32_t flags)
332 : : {
333 : : union {
334 : : __uint128_t get_work;
335 : : uint64_t u64[2];
336 : : } gw;
337 : :
338 : : #ifdef RTE_ARCH_ARM64
339 : : asm volatile(PLT_CPU_FEATURE_PREAMBLE
340 : : " ldp %[tag], %[wqp], [%[tag_loc]] \n"
341 : : " tbz %[tag], 63, .Ldone%= \n"
342 : : " sevl \n"
343 : : ".Lrty%=: wfe \n"
344 : : " ldp %[tag], %[wqp], [%[tag_loc]] \n"
345 : : " tbnz %[tag], 63, .Lrty%= \n"
346 : : ".Ldone%=: dmb ld \n"
347 : : : [tag] "=&r"(gw.u64[0]), [wqp] "=&r"(gw.u64[1])
348 : : : [tag_loc] "r"(ws->base + SSOW_LF_GWS_WQE0)
349 : : : "memory");
350 : : #else
351 : : do {
352 [ # # # # : 0 : roc_load_pair(gw.u64[0], gw.u64[1], ws->base + SSOW_LF_GWS_WQE0);
# # ]
353 [ # # # # : 0 : } while (gw.u64[0] & BIT_ULL(63));
# # ]
354 : : #endif
355 : :
356 : 0 : ws->gw_rdata = gw.u64[0];
357 [ # # # # : 0 : if (gw.u64[1])
# # ]
358 : : cn20k_sso_hws_post_process(ws, gw.u64, flags);
359 : : else
360 : 0 : gw.u64[0] = (gw.u64[0] & (0x3ull << 32)) << 6 |
361 : 0 : (gw.u64[0] & (0x3FFull << 36)) << 4 | (gw.u64[0] & 0xffffffff);
362 : :
363 [ # # # # ]: 0 : ev->event = gw.u64[0];
364 : : ev->u64 = gw.u64[1];
365 : :
366 : : return !!gw.u64[1];
367 : : }
368 : :
369 : : /* CN20K Fastpath functions. */
370 : : uint16_t __rte_hot cn20k_sso_hws_enq_burst(void *port, const struct rte_event ev[],
371 : : uint16_t nb_events);
372 : : uint16_t __rte_hot cn20k_sso_hws_enq_new_burst(void *port, const struct rte_event ev[],
373 : : uint16_t nb_events);
374 : : uint16_t __rte_hot cn20k_sso_hws_enq_fwd_burst(void *port, const struct rte_event ev[],
375 : : uint16_t nb_events);
376 : : int __rte_hot cn20k_sso_hws_profile_switch(void *port, uint8_t profile);
377 : : int __rte_hot cn20k_sso_hws_preschedule_modify(void *port,
378 : : enum rte_event_dev_preschedule_type type);
379 : : void __rte_hot cn20k_sso_hws_preschedule(void *port, enum rte_event_dev_preschedule_type type);
380 : :
381 : : #define R(name, flags) \
382 : : uint16_t __rte_hot cn20k_sso_hws_deq_burst_##name( \
383 : : void *port, struct rte_event ev[], uint16_t nb_events, uint64_t timeout_ticks); \
384 : : uint16_t __rte_hot cn20k_sso_hws_deq_tmo_burst_##name( \
385 : : void *port, struct rte_event ev[], uint16_t nb_events, uint64_t timeout_ticks); \
386 : : uint16_t __rte_hot cn20k_sso_hws_deq_ca_burst_##name( \
387 : : void *port, struct rte_event ev[], uint16_t nb_events, uint64_t timeout_ticks); \
388 : : uint16_t __rte_hot cn20k_sso_hws_deq_tmo_ca_burst_##name( \
389 : : void *port, struct rte_event ev[], uint16_t nb_events, uint64_t timeout_ticks); \
390 : : uint16_t __rte_hot cn20k_sso_hws_deq_seg_burst_##name( \
391 : : void *port, struct rte_event ev[], uint16_t nb_events, uint64_t timeout_ticks); \
392 : : uint16_t __rte_hot cn20k_sso_hws_deq_tmo_seg_burst_##name( \
393 : : void *port, struct rte_event ev[], uint16_t nb_events, uint64_t timeout_ticks); \
394 : : uint16_t __rte_hot cn20k_sso_hws_deq_ca_seg_burst_##name( \
395 : : void *port, struct rte_event ev[], uint16_t nb_events, uint64_t timeout_ticks); \
396 : : uint16_t __rte_hot cn20k_sso_hws_deq_tmo_ca_seg_burst_##name( \
397 : : void *port, struct rte_event ev[], uint16_t nb_events, uint64_t timeout_ticks); \
398 : : uint16_t __rte_hot cn20k_sso_hws_reas_deq_burst_##name( \
399 : : void *port, struct rte_event ev[], uint16_t nb_events, uint64_t timeout_ticks); \
400 : : uint16_t __rte_hot cn20k_sso_hws_reas_deq_tmo_burst_##name( \
401 : : void *port, struct rte_event ev[], uint16_t nb_events, uint64_t timeout_ticks); \
402 : : uint16_t __rte_hot cn20k_sso_hws_reas_deq_ca_burst_##name( \
403 : : void *port, struct rte_event ev[], uint16_t nb_events, uint64_t timeout_ticks); \
404 : : uint16_t __rte_hot cn20k_sso_hws_reas_deq_tmo_ca_burst_##name( \
405 : : void *port, struct rte_event ev[], uint16_t nb_events, uint64_t timeout_ticks); \
406 : : uint16_t __rte_hot cn20k_sso_hws_reas_deq_seg_burst_##name( \
407 : : void *port, struct rte_event ev[], uint16_t nb_events, uint64_t timeout_ticks); \
408 : : uint16_t __rte_hot cn20k_sso_hws_reas_deq_tmo_seg_burst_##name( \
409 : : void *port, struct rte_event ev[], uint16_t nb_events, uint64_t timeout_ticks); \
410 : : uint16_t __rte_hot cn20k_sso_hws_reas_deq_ca_seg_burst_##name( \
411 : : void *port, struct rte_event ev[], uint16_t nb_events, uint64_t timeout_ticks); \
412 : : uint16_t __rte_hot cn20k_sso_hws_reas_deq_tmo_ca_seg_burst_##name( \
413 : : void *port, struct rte_event ev[], uint16_t nb_events, uint64_t timeout_ticks);
414 : :
415 : : NIX_RX_FASTPATH_MODES
416 : : #undef R
417 : :
418 : : #define SSO_DEQ(fn, flags) \
419 : : static __rte_always_inline uint16_t fn(void *port, struct rte_event *ev, \
420 : : uint64_t timeout_ticks) \
421 : : { \
422 : : struct cn20k_sso_hws *ws = port; \
423 : : RTE_SET_USED(timeout_ticks); \
424 : : if (ws->swtag_req) { \
425 : : ws->swtag_req = 0; \
426 : : ws->gw_rdata = cnxk_sso_hws_swtag_wait(ws->base + SSOW_LF_GWS_WQE0); \
427 : : return 1; \
428 : : } \
429 : : return cn20k_sso_hws_get_work(ws, ev, flags); \
430 : : }
431 : :
432 : : #define SSO_DEQ_SEG(fn, flags) SSO_DEQ(fn, flags | NIX_RX_MULTI_SEG_F)
433 : :
434 : : #define SSO_DEQ_TMO(fn, flags) \
435 : : static __rte_always_inline uint16_t fn(void *port, struct rte_event *ev, \
436 : : uint64_t timeout_ticks) \
437 : : { \
438 : : struct cn20k_sso_hws *ws = port; \
439 : : uint16_t ret = 1; \
440 : : uint64_t iter; \
441 : : if (ws->swtag_req) { \
442 : : ws->swtag_req = 0; \
443 : : ws->gw_rdata = cnxk_sso_hws_swtag_wait(ws->base + SSOW_LF_GWS_WQE0); \
444 : : return ret; \
445 : : } \
446 : : ret = cn20k_sso_hws_get_work(ws, ev, flags); \
447 : : for (iter = 1; iter < timeout_ticks && (ret == 0); iter++) \
448 : : ret = cn20k_sso_hws_get_work(ws, ev, flags); \
449 : : return ret; \
450 : : }
451 : :
452 : : #define SSO_DEQ_TMO_SEG(fn, flags) SSO_DEQ_TMO(fn, flags | NIX_RX_MULTI_SEG_F)
453 : :
454 : : #define R(name, flags) \
455 : : SSO_DEQ(cn20k_sso_hws_deq_##name, flags) \
456 : : SSO_DEQ(cn20k_sso_hws_reas_deq_##name, flags | NIX_RX_REAS_F) \
457 : : SSO_DEQ_SEG(cn20k_sso_hws_deq_seg_##name, flags) \
458 : : SSO_DEQ_SEG(cn20k_sso_hws_reas_deq_seg_##name, flags | NIX_RX_REAS_F) \
459 : : SSO_DEQ_TMO(cn20k_sso_hws_deq_tmo_##name, flags) \
460 : : SSO_DEQ_TMO(cn20k_sso_hws_reas_deq_tmo_##name, flags | NIX_RX_REAS_F) \
461 : : SSO_DEQ_TMO_SEG(cn20k_sso_hws_deq_tmo_seg_##name, flags) \
462 : : SSO_DEQ_TMO_SEG(cn20k_sso_hws_reas_deq_tmo_seg_##name, flags | NIX_RX_REAS_F)
463 : :
464 : : NIX_RX_FASTPATH_MODES
465 : : #undef R
466 : :
467 : : #define SSO_CMN_DEQ_BURST(fnb, fn, flags) \
468 : : uint16_t __rte_hot fnb(void *port, struct rte_event ev[], uint16_t nb_events, \
469 : : uint64_t timeout_ticks) \
470 : : { \
471 : : RTE_SET_USED(nb_events); \
472 : : return fn(port, ev, timeout_ticks); \
473 : : }
474 : :
475 : : #define SSO_CMN_DEQ_SEG_BURST(fnb, fn, flags) \
476 : : uint16_t __rte_hot fnb(void *port, struct rte_event ev[], uint16_t nb_events, \
477 : : uint64_t timeout_ticks) \
478 : : { \
479 : : RTE_SET_USED(nb_events); \
480 : : return fn(port, ev, timeout_ticks); \
481 : : }
482 : :
483 : : uint16_t __rte_hot cn20k_sso_hws_deq_burst_all_offload(void *port, struct rte_event ev[],
484 : : uint16_t nb_events, uint64_t timeout_ticks);
485 : : uint16_t __rte_hot cn20k_sso_hws_deq_burst_all_offload_tst(void *port, struct rte_event ev[],
486 : : uint16_t nb_events,
487 : : uint64_t timeout_ticks);
488 : :
489 : : #endif
|