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