Branch data Line data Source code
1 : : /* SPDX-License-Identifier: BSD-3-Clause
2 : : * Copyright(C) 2021 Marvell.
3 : : */
4 : :
5 : : #ifndef __CN10K_WORKER_H__
6 : : #define __CN10K_WORKER_H__
7 : :
8 : : #include <rte_eventdev.h>
9 : : #include "cn10k_cryptodev_event_dp.h"
10 : : #include "cnxk_dma_event_dp.h"
11 : : #include "cn10k_rx.h"
12 : : #include "cnxk_worker.h"
13 : : #include "cn10k_eventdev.h"
14 : :
15 : : /* CN10K Rx event fastpath */
16 : :
17 : : static __rte_always_inline void
18 : : cn10k_wqe_to_mbuf(uint64_t wqe, const uint64_t __mbuf, uint8_t port_id,
19 : : const uint32_t tag, const uint32_t flags,
20 : : const void *const lookup_mem, uintptr_t cpth, uintptr_t sa_base)
21 : : {
22 : : const uint64_t mbuf_init = 0x100010000ULL | RTE_PKTMBUF_HEADROOM |
23 : : (flags & NIX_RX_OFFLOAD_TSTAMP_F ? 8 : 0);
24 : 0 : struct rte_mbuf *mbuf = (struct rte_mbuf *)__mbuf;
25 : :
26 : 0 : cn10k_nix_cqe_to_mbuf((struct nix_cqe_hdr_s *)wqe, tag,
27 : : (struct rte_mbuf *)mbuf, lookup_mem,
28 : : mbuf_init | ((uint64_t)port_id) << 48, cpth, sa_base, flags);
29 : : }
30 : :
31 : : static void
32 : 0 : cn10k_sso_process_tstamp(uint64_t u64, uint64_t mbuf,
33 : : struct cnxk_timesync_info *tstamp)
34 : : {
35 : : uint64_t tstamp_ptr;
36 : : uint8_t laptr;
37 : :
38 : 0 : laptr = (uint8_t) *
39 : 0 : (uint64_t *)(u64 + (CNXK_SSO_WQE_LAYR_PTR * sizeof(uint64_t)));
40 [ # # ]: 0 : if (laptr == sizeof(uint64_t)) {
41 : : /* Extracting tstamp, if PTP enabled*/
42 : 0 : tstamp_ptr = *(uint64_t *)(((struct nix_wqe_hdr_s *)u64) +
43 : : CNXK_SSO_WQE_SG_PTR);
44 [ # # ]: 0 : cn10k_nix_mbuf_to_tstamp((struct rte_mbuf *)mbuf, tstamp, true,
45 : : (uint64_t *)tstamp_ptr);
46 : : }
47 : 0 : }
48 : :
49 : : static __rte_always_inline void
50 : : cn10k_process_vwqe(uintptr_t vwqe, uint16_t port_id, const uint32_t flags, struct cn10k_sso_hws *ws)
51 : : {
52 : : uint64_t mbuf_init = 0x100010000ULL | RTE_PKTMBUF_HEADROOM;
53 : 0 : struct cnxk_timesync_info *tstamp = ws->tstamp[port_id];
54 : 0 : void *lookup_mem = ws->lookup_mem;
55 : 0 : uintptr_t lbase = ws->lmt_base;
56 : : uint64_t meta_aura = 0, laddr;
57 : : struct rte_event_vector *vec;
58 : : uint16_t nb_mbufs, non_vec;
59 : : struct rte_mempool *mp;
60 : : uint16_t lmt_id, d_off;
61 : : struct rte_mbuf **wqe;
62 : : struct rte_mbuf *mbuf;
63 : : uint64_t sa_base = 0;
64 : : uintptr_t cpth = 0;
65 : : uint8_t loff = 0;
66 : : int i;
67 : :
68 : 0 : mbuf_init |= ((uint64_t)port_id) << 48;
69 : : vec = (struct rte_event_vector *)vwqe;
70 : 0 : wqe = vec->mbufs;
71 : :
72 : 0 : rte_prefetch0(&vec->ptrs[0]);
73 : : #define OBJS_PER_CLINE (RTE_CACHE_LINE_SIZE / sizeof(void *))
74 [ # # # # : 0 : for (i = OBJS_PER_CLINE; i < vec->nb_elem; i += OBJS_PER_CLINE)
# # ]
75 : 0 : rte_prefetch0(&vec->ptrs[i]);
76 : :
77 [ # # # # : 0 : if (flags & NIX_RX_OFFLOAD_TSTAMP_F && tstamp)
# # ]
78 : 0 : mbuf_init |= 8;
79 : :
80 : : if (flags & NIX_RX_OFFLOAD_SECURITY_F) {
81 : 0 : mp = (struct rte_mempool *)cnxk_nix_inl_metapool_get(port_id, lookup_mem);
82 [ # # # # : 0 : if (mp)
# # ]
83 : 0 : meta_aura = mp->pool_id;
84 : : }
85 : :
86 : : nb_mbufs = RTE_ALIGN_FLOOR(vec->nb_elem, NIX_DESCS_PER_LOOP);
87 : : nb_mbufs = cn10k_nix_recv_pkts_vector(&mbuf_init, wqe, nb_mbufs,
88 : : flags | NIX_RX_VWQE_F,
89 : : lookup_mem, tstamp,
90 : : lbase, meta_aura);
91 : : wqe += nb_mbufs;
92 : : non_vec = vec->nb_elem - nb_mbufs;
93 : :
94 [ # # # # : 0 : if (flags & NIX_RX_OFFLOAD_SECURITY_F && non_vec) {
# # ]
95 : : uint64_t sg_w1;
96 : :
97 : 0 : mbuf = (struct rte_mbuf *)((uintptr_t)wqe[0] -
98 : : 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 : :
113 [ # # # # : 0 : while (non_vec) {
# # ]
114 : 0 : struct nix_cqe_hdr_s *cqe = (struct nix_cqe_hdr_s *)wqe[0];
115 : :
116 : 0 : mbuf = (struct rte_mbuf *)((char *)cqe -
117 : : sizeof(struct rte_mbuf));
118 : :
119 : : /* Mark mempool obj as "get" as it is alloc'ed by NIX */
120 : : RTE_MEMPOOL_CHECK_COOKIES(mbuf->pool, (void **)&mbuf, 1, 1);
121 : :
122 : : /* Translate meta to mbuf */
123 : : if (flags & NIX_RX_OFFLOAD_SECURITY_F) {
124 : 0 : const uint64_t cq_w1 = *((const uint64_t *)cqe + 1);
125 : 0 : const uint64_t cq_w5 = *((const uint64_t *)cqe + 5);
126 : :
127 : 0 : cpth = ((uintptr_t)mbuf + (uint16_t)d_off);
128 : :
129 : : /* Update mempool pointer for full mode pkt */
130 [ # # # # : 0 : if ((flags & NIX_RX_REAS_F) && (cq_w1 & BIT(11)) &&
# # ]
131 [ # # # # : 0 : !((*(uint64_t *)cpth) & BIT(15)))
# # ]
132 : 0 : mbuf->pool = mp;
133 : :
134 : 0 : mbuf = nix_sec_meta_to_mbuf_sc(cq_w1, cq_w5, sa_base, laddr,
135 : : &loff, mbuf, d_off,
136 : : flags, mbuf_init);
137 : : }
138 : :
139 [ # # # # : 0 : cn10k_nix_cqe_to_mbuf(cqe, cqe->tag, mbuf, lookup_mem,
# # ]
140 : : mbuf_init, cpth, sa_base, flags);
141 : :
142 : : if (flags & NIX_RX_OFFLOAD_TSTAMP_F)
143 : 0 : cn10k_sso_process_tstamp((uint64_t)wqe[0],
144 : : (uint64_t)mbuf, tstamp);
145 : 0 : wqe[0] = (struct rte_mbuf *)mbuf;
146 : 0 : non_vec--;
147 : 0 : wqe++;
148 : : }
149 : :
150 : : /* Free remaining meta buffers if any */
151 [ # # # # : 0 : if (flags & NIX_RX_OFFLOAD_SECURITY_F && loff) {
# # ]
152 : : nix_sec_flush_meta(laddr, lmt_id, loff, meta_aura);
153 : 0 : plt_io_wmb();
154 : : }
155 : : }
156 : :
157 : : static __rte_always_inline void
158 : : cn10k_sso_hws_post_process(struct cn10k_sso_hws *ws, uint64_t *u64,
159 : : const uint32_t flags)
160 : : {
161 : : uintptr_t sa_base = 0;
162 : :
163 : 0 : u64[0] = (u64[0] & (0x3ull << 32)) << 6 |
164 : 0 : (u64[0] & (0x3FFull << 36)) << 4 | (u64[0] & 0xffffffff);
165 [ # # # # : 0 : if (CNXK_EVENT_TYPE_FROM_TAG(u64[0]) == RTE_EVENT_TYPE_CRYPTODEV) {
# # ]
166 : 0 : u64[1] = cn10k_cpt_crypto_adapter_dequeue(u64[1]);
167 [ # # # # : 0 : } else if (CNXK_EVENT_TYPE_FROM_TAG(u64[0]) == RTE_EVENT_TYPE_CRYPTODEV_VECTOR) {
# # ]
168 : 0 : u64[1] = cn10k_cpt_crypto_adapter_vector_dequeue(u64[1]);
169 [ # # # # : 0 : } else if (CNXK_EVENT_TYPE_FROM_TAG(u64[0]) == RTE_EVENT_TYPE_ETHDEV) {
# # ]
170 : 0 : uint8_t port = CNXK_SUB_EVENT_FROM_TAG(u64[0]);
171 : : uintptr_t cpth = 0;
172 : : uint64_t mbuf;
173 : :
174 : 0 : mbuf = u64[1] - sizeof(struct rte_mbuf);
175 : 0 : rte_prefetch0((void *)mbuf);
176 : :
177 : : /* Mark mempool obj as "get" as it is alloc'ed by NIX */
178 : : RTE_MEMPOOL_CHECK_COOKIES(((struct rte_mbuf *)mbuf)->pool, (void **)&mbuf, 1, 1);
179 : :
180 : : if (flags & NIX_RX_OFFLOAD_SECURITY_F) {
181 : 0 : void *lookup_mem = ws->lookup_mem;
182 : : struct rte_mempool *mp = NULL;
183 : : uint64_t meta_aura;
184 : :
185 : : const uint64_t mbuf_init =
186 : : 0x100010000ULL | RTE_PKTMBUF_HEADROOM |
187 : : (flags & NIX_RX_OFFLOAD_TSTAMP_F ? 8 : 0);
188 : : struct rte_mbuf *m;
189 : : uint64_t iova = 0;
190 : : uint8_t loff = 0;
191 : : uint16_t d_off;
192 : : uint64_t cq_w1;
193 : : uint64_t cq_w5;
194 : :
195 : : m = (struct rte_mbuf *)mbuf;
196 : 0 : d_off = (*(uint64_t *)(u64[1] + 72)) - (uintptr_t)m;
197 : :
198 : 0 : cq_w1 = *(uint64_t *)(u64[1] + 8);
199 [ # # # # : 0 : cq_w5 = *(uint64_t *)(u64[1] + 40);
# # ]
200 : :
201 : : sa_base = cnxk_nix_sa_base_get(port, ws->lookup_mem);
202 : 0 : sa_base &= ~(ROC_NIX_INL_SA_BASE_ALIGN - 1);
203 : :
204 [ # # # # : 0 : cpth = ((uintptr_t)mbuf + (uint16_t)d_off);
# # ]
205 : 0 : mp = (struct rte_mempool *)cnxk_nix_inl_metapool_get(port, lookup_mem);
206 [ # # # # : 0 : meta_aura = mp ? mp->pool_id : m->pool->pool_id;
# # ]
207 : :
208 : : /* Update mempool pointer for full mode pkt */
209 [ # # # # : 0 : if (mp && (flags & NIX_RX_REAS_F) && (cq_w1 & BIT(11)) &&
# # # # #
# # # ]
210 [ # # # # : 0 : !((*(uint64_t *)cpth) & BIT(15)))
# # ]
211 : 0 : ((struct rte_mbuf *)mbuf)->pool = mp;
212 : :
213 : 0 : mbuf = (uint64_t)nix_sec_meta_to_mbuf_sc(
214 : : cq_w1, cq_w5, sa_base, (uintptr_t)&iova, &loff,
215 : : (struct rte_mbuf *)mbuf, d_off, flags,
216 [ # # # # : 0 : mbuf_init | ((uint64_t)port) << 48);
# # ]
217 : :
218 [ # # # # : 0 : if (loff)
# # ]
219 : : roc_npa_aura_op_free(meta_aura, 0, iova);
220 : : }
221 : :
222 : 0 : u64[0] = CNXK_CLR_SUB_EVENT(u64[0]);
223 : 0 : cn10k_wqe_to_mbuf(u64[1], mbuf, port, u64[0] & 0xFFFFF, flags,
224 [ # # # # : 0 : ws->lookup_mem, cpth, sa_base);
# # ]
225 : : if (flags & NIX_RX_OFFLOAD_TSTAMP_F)
226 : 0 : cn10k_sso_process_tstamp(u64[1], mbuf,
227 : 0 : 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) |
234 : 0 : ((vwqe_hdr & 0xFFFF) << 48) | ((uint64_t)port << 32);
235 : 0 : *(uint64_t *)u64[1] = (uint64_t)vwqe_hdr;
236 : : cn10k_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]),
239 : : (void **)&u64[1], 1, 1);
240 [ # # # # : 0 : } else if (CNXK_EVENT_TYPE_FROM_TAG(u64[0]) == RTE_EVENT_TYPE_DMADEV) {
# # ]
241 : 0 : u64[1] = cnxk_dma_adapter_dequeue(u64[1]);
242 : : }
243 : : }
244 : :
245 : : static __rte_always_inline uint16_t
246 : : cn10k_sso_hws_get_work(struct cn10k_sso_hws *ws, struct rte_event *ev,
247 : : const uint32_t flags)
248 : : {
249 : : union {
250 : : __uint128_t get_work;
251 : : uint64_t u64[2];
252 : : } gw;
253 : :
254 : : gw.get_work = ws->gw_wdata;
255 : : #if defined(RTE_ARCH_ARM64)
256 : : #if defined(__clang__)
257 : : register uint64_t x0 __asm("x0") = (uint64_t)gw.u64[0];
258 : : register uint64_t x1 __asm("x1") = (uint64_t)gw.u64[1];
259 : : #if defined(RTE_ARM_USE_WFE)
260 : : plt_write64(gw.u64[0], ws->base + SSOW_LF_GWS_OP_GET_WORK0);
261 : : asm volatile(PLT_CPU_FEATURE_PREAMBLE
262 : : " ldp %[x0], %[x1], [%[tag_loc]] \n"
263 : : " tbz %[x0], %[pend_gw], done%= \n"
264 : : " sevl \n"
265 : : "rty%=: wfe \n"
266 : : " ldp %[x0], %[x1], [%[tag_loc]] \n"
267 : : " tbnz %[x0], %[pend_gw], rty%= \n"
268 : : "done%=: \n"
269 : : " dmb ld \n"
270 : : : [x0] "+r" (x0), [x1] "+r" (x1)
271 : : : [tag_loc] "r"(ws->base + SSOW_LF_GWS_WQE0),
272 : : [pend_gw] "i"(SSOW_LF_GWS_TAG_PEND_GET_WORK_BIT)
273 : : : "memory");
274 : : #else
275 : : asm volatile(".arch armv8-a+lse\n"
276 : : "caspal %[x0], %[x1], %[x0], %[x1], [%[dst]]\n"
277 : : : [x0] "+r" (x0), [x1] "+r" (x1)
278 : : : [dst] "r"(ws->base + SSOW_LF_GWS_OP_GET_WORK0)
279 : : : "memory");
280 : : #endif
281 : : gw.u64[0] = x0;
282 : : gw.u64[1] = x1;
283 : : #else
284 : : #if defined(RTE_ARM_USE_WFE)
285 : : plt_write64(gw.u64[0], ws->base + SSOW_LF_GWS_OP_GET_WORK0);
286 : : asm volatile(PLT_CPU_FEATURE_PREAMBLE
287 : : " ldp %[wdata], %H[wdata], [%[tag_loc]] \n"
288 : : " tbz %[wdata], %[pend_gw], done%= \n"
289 : : " sevl \n"
290 : : "rty%=: wfe \n"
291 : : " ldp %[wdata], %H[wdata], [%[tag_loc]] \n"
292 : : " tbnz %[wdata], %[pend_gw], rty%= \n"
293 : : "done%=: \n"
294 : : " dmb ld \n"
295 : : : [wdata] "=&r"(gw.get_work)
296 : : : [tag_loc] "r"(ws->base + SSOW_LF_GWS_WQE0),
297 : : [pend_gw] "i"(SSOW_LF_GWS_TAG_PEND_GET_WORK_BIT)
298 : : : "memory");
299 : : #else
300 : : asm volatile(
301 : : PLT_CPU_FEATURE_PREAMBLE
302 : : "caspal %[wdata], %H[wdata], %[wdata], %H[wdata], [%[gw_loc]]\n"
303 : : : [wdata] "+r"(gw.get_work)
304 : : : [gw_loc] "r"(ws->base + SSOW_LF_GWS_OP_GET_WORK0)
305 : : : "memory");
306 : : #endif
307 : : #endif
308 : : #else
309 : : plt_write64(gw.u64[0], ws->base + SSOW_LF_GWS_OP_GET_WORK0);
310 : : do {
311 : : roc_load_pair(gw.u64[0], gw.u64[1],
312 : : 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 : : cn10k_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 : : cn10k_sso_hws_get_work_empty(struct cn10k_sso_hws *ws, struct rte_event *ev,
329 : : const uint32_t flags)
330 : : {
331 : : union {
332 : : __uint128_t get_work;
333 : : uint64_t u64[2];
334 : : } gw;
335 : :
336 : : #ifdef RTE_ARCH_ARM64
337 : : asm volatile(PLT_CPU_FEATURE_PREAMBLE
338 : : " ldp %[tag], %[wqp], [%[tag_loc]] \n"
339 : : " tbz %[tag], 63, .Ldone%= \n"
340 : : " sevl \n"
341 : : ".Lrty%=: wfe \n"
342 : : " ldp %[tag], %[wqp], [%[tag_loc]] \n"
343 : : " tbnz %[tag], 63, .Lrty%= \n"
344 : : ".Ldone%=: dmb ld \n"
345 : : : [tag] "=&r"(gw.u64[0]), [wqp] "=&r"(gw.u64[1])
346 : : : [tag_loc] "r"(ws->base + SSOW_LF_GWS_WQE0)
347 : : : "memory");
348 : : #else
349 : : do {
350 [ # # # # : 0 : roc_load_pair(gw.u64[0], gw.u64[1],
# # ]
351 : : ws->base + SSOW_LF_GWS_WQE0);
352 [ # # # # : 0 : } while (gw.u64[0] & BIT_ULL(63));
# # ]
353 : : #endif
354 : :
355 : 0 : ws->gw_rdata = gw.u64[0];
356 [ # # # # : 0 : if (gw.u64[1])
# # ]
357 : : cn10k_sso_hws_post_process(ws, gw.u64, flags);
358 : : else
359 : 0 : gw.u64[0] = (gw.u64[0] & (0x3ull << 32)) << 6 |
360 : 0 : (gw.u64[0] & (0x3FFull << 36)) << 4 | (gw.u64[0] & 0xffffffff);
361 : :
362 [ # # # # ]: 0 : ev->event = gw.u64[0];
363 : : ev->u64 = gw.u64[1];
364 : :
365 : : return !!gw.u64[1];
366 : : }
367 : :
368 : : /* CN10K Fastpath functions. */
369 : : uint16_t __rte_hot cn10k_sso_hws_enq_burst(void *port,
370 : : const struct rte_event ev[],
371 : : uint16_t nb_events);
372 : : uint16_t __rte_hot cn10k_sso_hws_enq_new_burst(void *port,
373 : : const struct rte_event ev[],
374 : : uint16_t nb_events);
375 : : uint16_t __rte_hot cn10k_sso_hws_enq_fwd_burst(void *port,
376 : : const struct rte_event ev[],
377 : : uint16_t nb_events);
378 : : int __rte_hot cn10k_sso_hws_profile_switch(void *port, uint8_t profile);
379 : : int __rte_hot cn10k_sso_hws_preschedule_modify(void *port,
380 : : enum rte_event_dev_preschedule_type type);
381 : :
382 : : #define R(name, flags) \
383 : : uint16_t __rte_hot cn10k_sso_hws_deq_burst_##name( \
384 : : void *port, struct rte_event ev[], uint16_t nb_events, \
385 : : uint64_t timeout_ticks); \
386 : : uint16_t __rte_hot cn10k_sso_hws_deq_tmo_burst_##name( \
387 : : void *port, struct rte_event ev[], uint16_t nb_events, \
388 : : uint64_t timeout_ticks); \
389 : : uint16_t __rte_hot cn10k_sso_hws_deq_ca_burst_##name( \
390 : : void *port, struct rte_event ev[], uint16_t nb_events, \
391 : : uint64_t timeout_ticks); \
392 : : uint16_t __rte_hot cn10k_sso_hws_deq_tmo_ca_burst_##name( \
393 : : void *port, struct rte_event ev[], uint16_t nb_events, \
394 : : uint64_t timeout_ticks); \
395 : : uint16_t __rte_hot cn10k_sso_hws_deq_seg_burst_##name( \
396 : : void *port, struct rte_event ev[], uint16_t nb_events, \
397 : : uint64_t timeout_ticks); \
398 : : uint16_t __rte_hot cn10k_sso_hws_deq_tmo_seg_burst_##name( \
399 : : void *port, struct rte_event ev[], uint16_t nb_events, \
400 : : uint64_t timeout_ticks); \
401 : : uint16_t __rte_hot cn10k_sso_hws_deq_ca_seg_burst_##name( \
402 : : void *port, struct rte_event ev[], uint16_t nb_events, \
403 : : uint64_t timeout_ticks); \
404 : : uint16_t __rte_hot cn10k_sso_hws_deq_tmo_ca_seg_burst_##name( \
405 : : void *port, struct rte_event ev[], uint16_t nb_events, \
406 : : uint64_t timeout_ticks); \
407 : : uint16_t __rte_hot cn10k_sso_hws_reas_deq_burst_##name( \
408 : : void *port, struct rte_event ev[], uint16_t nb_events, \
409 : : uint64_t timeout_ticks); \
410 : : uint16_t __rte_hot cn10k_sso_hws_reas_deq_tmo_burst_##name( \
411 : : void *port, struct rte_event ev[], uint16_t nb_events, \
412 : : uint64_t timeout_ticks); \
413 : : uint16_t __rte_hot cn10k_sso_hws_reas_deq_ca_burst_##name( \
414 : : void *port, struct rte_event ev[], uint16_t nb_events, \
415 : : uint64_t timeout_ticks); \
416 : : uint16_t __rte_hot cn10k_sso_hws_reas_deq_tmo_ca_burst_##name( \
417 : : void *port, struct rte_event ev[], uint16_t nb_events, \
418 : : uint64_t timeout_ticks); \
419 : : uint16_t __rte_hot cn10k_sso_hws_reas_deq_seg_burst_##name( \
420 : : void *port, struct rte_event ev[], uint16_t nb_events, \
421 : : uint64_t timeout_ticks); \
422 : : uint16_t __rte_hot cn10k_sso_hws_reas_deq_tmo_seg_burst_##name( \
423 : : void *port, struct rte_event ev[], uint16_t nb_events, \
424 : : uint64_t timeout_ticks); \
425 : : uint16_t __rte_hot cn10k_sso_hws_reas_deq_ca_seg_burst_##name( \
426 : : void *port, struct rte_event ev[], uint16_t nb_events, \
427 : : uint64_t timeout_ticks); \
428 : : uint16_t __rte_hot cn10k_sso_hws_reas_deq_tmo_ca_seg_burst_##name( \
429 : : void *port, struct rte_event ev[], uint16_t nb_events, \
430 : : uint64_t timeout_ticks);
431 : :
432 : : NIX_RX_FASTPATH_MODES
433 : : #undef R
434 : :
435 : : #define SSO_DEQ(fn, flags) \
436 : : static __rte_always_inline uint16_t fn(void *port, struct rte_event *ev, \
437 : : uint64_t timeout_ticks) \
438 : : { \
439 : : struct cn10k_sso_hws *ws = port; \
440 : : RTE_SET_USED(timeout_ticks); \
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 1; \
445 : : } \
446 : : return cn10k_sso_hws_get_work(ws, ev, flags); \
447 : : }
448 : :
449 : : #define SSO_DEQ_SEG(fn, flags) SSO_DEQ(fn, flags | NIX_RX_MULTI_SEG_F)
450 : :
451 : : #define SSO_DEQ_TMO(fn, flags) \
452 : : static __rte_always_inline uint16_t fn(void *port, struct rte_event *ev, \
453 : : uint64_t timeout_ticks) \
454 : : { \
455 : : struct cn10k_sso_hws *ws = port; \
456 : : uint16_t ret = 1; \
457 : : uint64_t iter; \
458 : : if (ws->swtag_req) { \
459 : : ws->swtag_req = 0; \
460 : : ws->gw_rdata = cnxk_sso_hws_swtag_wait(ws->base + SSOW_LF_GWS_WQE0); \
461 : : return ret; \
462 : : } \
463 : : ret = cn10k_sso_hws_get_work(ws, ev, flags); \
464 : : for (iter = 1; iter < timeout_ticks && (ret == 0); iter++) \
465 : : ret = cn10k_sso_hws_get_work(ws, ev, flags); \
466 : : return ret; \
467 : : }
468 : :
469 : : #define SSO_DEQ_TMO_SEG(fn, flags) SSO_DEQ_TMO(fn, flags | NIX_RX_MULTI_SEG_F)
470 : :
471 : : #define R(name, flags) \
472 : : SSO_DEQ(cn10k_sso_hws_deq_##name, flags) \
473 : : SSO_DEQ(cn10k_sso_hws_reas_deq_##name, flags | NIX_RX_REAS_F) \
474 : : SSO_DEQ_SEG(cn10k_sso_hws_deq_seg_##name, flags) \
475 : : SSO_DEQ_SEG(cn10k_sso_hws_reas_deq_seg_##name, flags | NIX_RX_REAS_F) \
476 : : SSO_DEQ_TMO(cn10k_sso_hws_deq_tmo_##name, flags) \
477 : : SSO_DEQ_TMO(cn10k_sso_hws_reas_deq_tmo_##name, flags | NIX_RX_REAS_F) \
478 : : SSO_DEQ_TMO_SEG(cn10k_sso_hws_deq_tmo_seg_##name, flags) \
479 : : SSO_DEQ_TMO_SEG(cn10k_sso_hws_reas_deq_tmo_seg_##name, flags | NIX_RX_REAS_F)
480 : :
481 : : NIX_RX_FASTPATH_MODES
482 : : #undef R
483 : :
484 : : #define SSO_CMN_DEQ_BURST(fnb, fn, flags) \
485 : : uint16_t __rte_hot fnb(void *port, struct rte_event ev[], \
486 : : uint16_t nb_events, uint64_t timeout_ticks) \
487 : : { \
488 : : RTE_SET_USED(nb_events); \
489 : : return fn(port, ev, timeout_ticks); \
490 : : }
491 : :
492 : : #define SSO_CMN_DEQ_SEG_BURST(fnb, fn, flags) \
493 : : uint16_t __rte_hot fnb(void *port, struct rte_event ev[], \
494 : : uint16_t nb_events, uint64_t timeout_ticks) \
495 : : { \
496 : : RTE_SET_USED(nb_events); \
497 : : return fn(port, ev, timeout_ticks); \
498 : : }
499 : :
500 : : uint16_t __rte_hot cn10k_sso_hws_deq_burst_all_offload(void *port, struct rte_event ev[],
501 : : uint16_t nb_events, uint64_t timeout_ticks);
502 : : uint16_t __rte_hot cn10k_sso_hws_deq_burst_all_offload_tst(void *port, struct rte_event ev[],
503 : : uint16_t nb_events,
504 : : uint64_t timeout_ticks);
505 : :
506 : : #endif
|