net/cnxk: support base PTP timesync
[dpdk.git] / drivers / net / cnxk / cn10k_rx.h
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright(C) 2021 Marvell.
3  */
4 #ifndef __CN10K_RX_H__
5 #define __CN10K_RX_H__
6
7 #include <rte_ether.h>
8 #include <rte_vect.h>
9
10 #include <cnxk_ethdev.h>
11
12 #define NIX_RX_OFFLOAD_NONE          (0)
13 #define NIX_RX_OFFLOAD_RSS_F         BIT(0)
14 #define NIX_RX_OFFLOAD_PTYPE_F       BIT(1)
15 #define NIX_RX_OFFLOAD_CHECKSUM_F    BIT(2)
16 #define NIX_RX_OFFLOAD_MARK_UPDATE_F BIT(3)
17 #define NIX_RX_OFFLOAD_TSTAMP_F      BIT(4)
18
19 /* Flags to control cqe_to_mbuf conversion function.
20  * Defining it from backwards to denote its been
21  * not used as offload flags to pick function
22  */
23 #define NIX_RX_MULTI_SEG_F BIT(15)
24
25 #define CNXK_NIX_CQ_ENTRY_SZ 128
26 #define NIX_DESCS_PER_LOOP   4
27 #define CQE_CAST(x)          ((struct nix_cqe_hdr_s *)(x))
28 #define CQE_SZ(x)            ((x) * CNXK_NIX_CQ_ENTRY_SZ)
29
30 union mbuf_initializer {
31         struct {
32                 uint16_t data_off;
33                 uint16_t refcnt;
34                 uint16_t nb_segs;
35                 uint16_t port;
36         } fields;
37         uint64_t value;
38 };
39
40 static __rte_always_inline uint64_t
41 nix_clear_data_off(uint64_t oldval)
42 {
43         union mbuf_initializer mbuf_init = {.value = oldval};
44
45         mbuf_init.fields.data_off = 0;
46         return mbuf_init.value;
47 }
48
49 static __rte_always_inline struct rte_mbuf *
50 nix_get_mbuf_from_cqe(void *cq, const uint64_t data_off)
51 {
52         rte_iova_t buff;
53
54         /* Skip CQE, NIX_RX_PARSE_S and SG HDR(9 DWORDs) and peek buff addr */
55         buff = *((rte_iova_t *)((uint64_t *)cq + 9));
56         return (struct rte_mbuf *)(buff - data_off);
57 }
58
59 static __rte_always_inline uint32_t
60 nix_ptype_get(const void *const lookup_mem, const uint64_t in)
61 {
62         const uint16_t *const ptype = lookup_mem;
63         const uint16_t lh_lg_lf = (in & 0xFFF0000000000000) >> 52;
64         const uint16_t tu_l2 = ptype[(in & 0x000FFFF000000000) >> 36];
65         const uint16_t il4_tu = ptype[PTYPE_NON_TUNNEL_ARRAY_SZ + lh_lg_lf];
66
67         return (il4_tu << PTYPE_NON_TUNNEL_WIDTH) | tu_l2;
68 }
69
70 static __rte_always_inline uint32_t
71 nix_rx_olflags_get(const void *const lookup_mem, const uint64_t in)
72 {
73         const uint32_t *const ol_flags =
74                 (const uint32_t *)((const uint8_t *)lookup_mem +
75                                    PTYPE_ARRAY_SZ);
76
77         return ol_flags[(in & 0xfff00000) >> 20];
78 }
79
80 static inline uint64_t
81 nix_update_match_id(const uint16_t match_id, uint64_t ol_flags,
82                     struct rte_mbuf *mbuf)
83 {
84         /* There is no separate bit to check match_id
85          * is valid or not? and no flag to identify it is an
86          * RTE_FLOW_ACTION_TYPE_FLAG vs RTE_FLOW_ACTION_TYPE_MARK
87          * action. The former case addressed through 0 being invalid
88          * value and inc/dec match_id pair when MARK is activated.
89          * The later case addressed through defining
90          * CNXK_FLOW_MARK_DEFAULT as value for
91          * RTE_FLOW_ACTION_TYPE_MARK.
92          * This would translate to not use
93          * CNXK_FLOW_ACTION_FLAG_DEFAULT - 1 and
94          * CNXK_FLOW_ACTION_FLAG_DEFAULT for match_id.
95          * i.e valid mark_id's are from
96          * 0 to CNXK_FLOW_ACTION_FLAG_DEFAULT - 2
97          */
98         if (likely(match_id)) {
99                 ol_flags |= PKT_RX_FDIR;
100                 if (match_id != CNXK_FLOW_ACTION_FLAG_DEFAULT) {
101                         ol_flags |= PKT_RX_FDIR_ID;
102                         mbuf->hash.fdir.hi = match_id - 1;
103                 }
104         }
105
106         return ol_flags;
107 }
108
109 static __rte_always_inline void
110 nix_cqe_xtract_mseg(const union nix_rx_parse_u *rx, struct rte_mbuf *mbuf,
111                     uint64_t rearm)
112 {
113         const rte_iova_t *iova_list;
114         struct rte_mbuf *head;
115         const rte_iova_t *eol;
116         uint8_t nb_segs;
117         uint64_t sg;
118
119         sg = *(const uint64_t *)(rx + 1);
120         nb_segs = (sg >> 48) & 0x3;
121         mbuf->nb_segs = nb_segs;
122         mbuf->data_len = sg & 0xFFFF;
123         sg = sg >> 16;
124
125         eol = ((const rte_iova_t *)(rx + 1) + ((rx->desc_sizem1 + 1) << 1));
126         /* Skip SG_S and first IOVA*/
127         iova_list = ((const rte_iova_t *)(rx + 1)) + 2;
128         nb_segs--;
129
130         rearm = rearm & ~0xFFFF;
131
132         head = mbuf;
133         while (nb_segs) {
134                 mbuf->next = ((struct rte_mbuf *)*iova_list) - 1;
135                 mbuf = mbuf->next;
136
137                 __mempool_check_cookies(mbuf->pool, (void **)&mbuf, 1, 1);
138
139                 mbuf->data_len = sg & 0xFFFF;
140                 sg = sg >> 16;
141                 *(uint64_t *)(&mbuf->rearm_data) = rearm;
142                 nb_segs--;
143                 iova_list++;
144
145                 if (!nb_segs && (iova_list + 1 < eol)) {
146                         sg = *(const uint64_t *)(iova_list);
147                         nb_segs = (sg >> 48) & 0x3;
148                         head->nb_segs += nb_segs;
149                         iova_list = (const rte_iova_t *)(iova_list + 1);
150                 }
151         }
152         mbuf->next = NULL;
153 }
154
155 static __rte_always_inline void
156 cn10k_nix_cqe_to_mbuf(const struct nix_cqe_hdr_s *cq, const uint32_t tag,
157                       struct rte_mbuf *mbuf, const void *lookup_mem,
158                       const uint64_t val, const uint16_t flag)
159 {
160         const union nix_rx_parse_u *rx =
161                 (const union nix_rx_parse_u *)((const uint64_t *)cq + 1);
162         const uint16_t len = rx->pkt_lenm1 + 1;
163         const uint64_t w1 = *(const uint64_t *)rx;
164         uint64_t ol_flags = 0;
165
166         /* Mark mempool obj as "get" as it is alloc'ed by NIX */
167         __mempool_check_cookies(mbuf->pool, (void **)&mbuf, 1, 1);
168
169         if (flag & NIX_RX_OFFLOAD_PTYPE_F)
170                 mbuf->packet_type = nix_ptype_get(lookup_mem, w1);
171         else
172                 mbuf->packet_type = 0;
173
174         if (flag & NIX_RX_OFFLOAD_RSS_F) {
175                 mbuf->hash.rss = tag;
176                 ol_flags |= PKT_RX_RSS_HASH;
177         }
178
179         if (flag & NIX_RX_OFFLOAD_CHECKSUM_F)
180                 ol_flags |= nix_rx_olflags_get(lookup_mem, w1);
181
182         if (flag & NIX_RX_OFFLOAD_MARK_UPDATE_F)
183                 ol_flags = nix_update_match_id(rx->match_id, ol_flags, mbuf);
184
185         mbuf->ol_flags = ol_flags;
186         *(uint64_t *)(&mbuf->rearm_data) = val;
187         mbuf->pkt_len = len;
188
189         if (flag & NIX_RX_MULTI_SEG_F) {
190                 nix_cqe_xtract_mseg(rx, mbuf, val);
191         } else {
192                 mbuf->data_len = len;
193                 mbuf->next = NULL;
194         }
195 }
196
197 static inline uint16_t
198 nix_rx_nb_pkts(struct cn10k_eth_rxq *rxq, const uint64_t wdata,
199                const uint16_t pkts, const uint32_t qmask)
200 {
201         uint32_t available = rxq->available;
202
203         /* Update the available count if cached value is not enough */
204         if (unlikely(available < pkts)) {
205                 uint64_t reg, head, tail;
206
207                 /* Use LDADDA version to avoid reorder */
208                 reg = roc_atomic64_add_sync(wdata, rxq->cq_status);
209                 /* CQ_OP_STATUS operation error */
210                 if (reg & BIT_ULL(NIX_CQ_OP_STAT_OP_ERR) ||
211                     reg & BIT_ULL(NIX_CQ_OP_STAT_CQ_ERR))
212                         return 0;
213
214                 tail = reg & 0xFFFFF;
215                 head = (reg >> 20) & 0xFFFFF;
216                 if (tail < head)
217                         available = tail - head + qmask + 1;
218                 else
219                         available = tail - head;
220
221                 rxq->available = available;
222         }
223
224         return RTE_MIN(pkts, available);
225 }
226
227 static __rte_always_inline uint16_t
228 cn10k_nix_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t pkts,
229                     const uint16_t flags)
230 {
231         struct cn10k_eth_rxq *rxq = rx_queue;
232         const uint64_t mbuf_init = rxq->mbuf_initializer;
233         const void *lookup_mem = rxq->lookup_mem;
234         const uint64_t data_off = rxq->data_off;
235         const uintptr_t desc = rxq->desc;
236         const uint64_t wdata = rxq->wdata;
237         const uint32_t qmask = rxq->qmask;
238         uint16_t packets = 0, nb_pkts;
239         uint32_t head = rxq->head;
240         struct nix_cqe_hdr_s *cq;
241         struct rte_mbuf *mbuf;
242
243         nb_pkts = nix_rx_nb_pkts(rxq, wdata, pkts, qmask);
244
245         while (packets < nb_pkts) {
246                 /* Prefetch N desc ahead */
247                 rte_prefetch_non_temporal(
248                         (void *)(desc + (CQE_SZ((head + 2) & qmask))));
249                 cq = (struct nix_cqe_hdr_s *)(desc + CQE_SZ(head));
250
251                 mbuf = nix_get_mbuf_from_cqe(cq, data_off);
252
253                 cn10k_nix_cqe_to_mbuf(cq, cq->tag, mbuf, lookup_mem, mbuf_init,
254                                       flags);
255                 cnxk_nix_mbuf_to_tstamp(mbuf, rxq->tstamp,
256                                         (flags & NIX_RX_OFFLOAD_TSTAMP_F),
257                                         (uint64_t *)((uint8_t *)mbuf + data_off)
258                                         );
259                 rx_pkts[packets++] = mbuf;
260                 roc_prefetch_store_keep(mbuf);
261                 head++;
262                 head &= qmask;
263         }
264
265         rxq->head = head;
266         rxq->available -= nb_pkts;
267
268         /* Free all the CQs that we've processed */
269         plt_write64((wdata | nb_pkts), rxq->cq_door);
270
271         return nb_pkts;
272 }
273
274 #if defined(RTE_ARCH_ARM64)
275
276 static __rte_always_inline uint16_t
277 cn10k_nix_recv_pkts_vector(void *rx_queue, struct rte_mbuf **rx_pkts,
278                            uint16_t pkts, const uint16_t flags)
279 {
280         struct cn10k_eth_rxq *rxq = rx_queue;
281         uint16_t packets = 0;
282         uint64x2_t cq0_w8, cq1_w8, cq2_w8, cq3_w8, mbuf01, mbuf23;
283         const uint64_t mbuf_initializer = rxq->mbuf_initializer;
284         const uint64x2_t data_off = vdupq_n_u64(rxq->data_off);
285         uint64_t ol_flags0, ol_flags1, ol_flags2, ol_flags3;
286         uint64x2_t rearm0 = vdupq_n_u64(mbuf_initializer);
287         uint64x2_t rearm1 = vdupq_n_u64(mbuf_initializer);
288         uint64x2_t rearm2 = vdupq_n_u64(mbuf_initializer);
289         uint64x2_t rearm3 = vdupq_n_u64(mbuf_initializer);
290         struct rte_mbuf *mbuf0, *mbuf1, *mbuf2, *mbuf3;
291         const uint16_t *lookup_mem = rxq->lookup_mem;
292         const uint32_t qmask = rxq->qmask;
293         const uint64_t wdata = rxq->wdata;
294         const uintptr_t desc = rxq->desc;
295         uint8x16_t f0, f1, f2, f3;
296         uint32_t head = rxq->head;
297         uint16_t pkts_left;
298
299         pkts = nix_rx_nb_pkts(rxq, wdata, pkts, qmask);
300         pkts_left = pkts & (NIX_DESCS_PER_LOOP - 1);
301
302         /* Packets has to be floor-aligned to NIX_DESCS_PER_LOOP */
303         pkts = RTE_ALIGN_FLOOR(pkts, NIX_DESCS_PER_LOOP);
304
305         while (packets < pkts) {
306                 /* Exit loop if head is about to wrap and become unaligned */
307                 if (((head + NIX_DESCS_PER_LOOP - 1) & qmask) <
308                     NIX_DESCS_PER_LOOP) {
309                         pkts_left += (pkts - packets);
310                         break;
311                 }
312
313                 const uintptr_t cq0 = desc + CQE_SZ(head);
314
315                 /* Prefetch N desc ahead */
316                 rte_prefetch_non_temporal((void *)(cq0 + CQE_SZ(8)));
317                 rte_prefetch_non_temporal((void *)(cq0 + CQE_SZ(9)));
318                 rte_prefetch_non_temporal((void *)(cq0 + CQE_SZ(10)));
319                 rte_prefetch_non_temporal((void *)(cq0 + CQE_SZ(11)));
320
321                 /* Get NIX_RX_SG_S for size and buffer pointer */
322                 cq0_w8 = vld1q_u64((uint64_t *)(cq0 + CQE_SZ(0) + 64));
323                 cq1_w8 = vld1q_u64((uint64_t *)(cq0 + CQE_SZ(1) + 64));
324                 cq2_w8 = vld1q_u64((uint64_t *)(cq0 + CQE_SZ(2) + 64));
325                 cq3_w8 = vld1q_u64((uint64_t *)(cq0 + CQE_SZ(3) + 64));
326
327                 /* Extract mbuf from NIX_RX_SG_S */
328                 mbuf01 = vzip2q_u64(cq0_w8, cq1_w8);
329                 mbuf23 = vzip2q_u64(cq2_w8, cq3_w8);
330                 mbuf01 = vqsubq_u64(mbuf01, data_off);
331                 mbuf23 = vqsubq_u64(mbuf23, data_off);
332
333                 /* Move mbufs to scalar registers for future use */
334                 mbuf0 = (struct rte_mbuf *)vgetq_lane_u64(mbuf01, 0);
335                 mbuf1 = (struct rte_mbuf *)vgetq_lane_u64(mbuf01, 1);
336                 mbuf2 = (struct rte_mbuf *)vgetq_lane_u64(mbuf23, 0);
337                 mbuf3 = (struct rte_mbuf *)vgetq_lane_u64(mbuf23, 1);
338
339                 /* Mask to get packet len from NIX_RX_SG_S */
340                 const uint8x16_t shuf_msk = {
341                         0xFF, 0xFF, /* pkt_type set as unknown */
342                         0xFF, 0xFF, /* pkt_type set as unknown */
343                         0,    1,    /* octet 1~0, low 16 bits pkt_len */
344                         0xFF, 0xFF, /* skip high 16 bits pkt_len, zero out */
345                         0,    1,    /* octet 1~0, 16 bits data_len */
346                         0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF};
347
348                 /* Form the rx_descriptor_fields1 with pkt_len and data_len */
349                 f0 = vqtbl1q_u8(cq0_w8, shuf_msk);
350                 f1 = vqtbl1q_u8(cq1_w8, shuf_msk);
351                 f2 = vqtbl1q_u8(cq2_w8, shuf_msk);
352                 f3 = vqtbl1q_u8(cq3_w8, shuf_msk);
353
354                 /* Load CQE word0 and word 1 */
355                 uint64_t cq0_w0 = ((uint64_t *)(cq0 + CQE_SZ(0)))[0];
356                 uint64_t cq0_w1 = ((uint64_t *)(cq0 + CQE_SZ(0)))[1];
357                 uint64_t cq1_w0 = ((uint64_t *)(cq0 + CQE_SZ(1)))[0];
358                 uint64_t cq1_w1 = ((uint64_t *)(cq0 + CQE_SZ(1)))[1];
359                 uint64_t cq2_w0 = ((uint64_t *)(cq0 + CQE_SZ(2)))[0];
360                 uint64_t cq2_w1 = ((uint64_t *)(cq0 + CQE_SZ(2)))[1];
361                 uint64_t cq3_w0 = ((uint64_t *)(cq0 + CQE_SZ(3)))[0];
362                 uint64_t cq3_w1 = ((uint64_t *)(cq0 + CQE_SZ(3)))[1];
363
364                 if (flags & NIX_RX_OFFLOAD_RSS_F) {
365                         /* Fill rss in the rx_descriptor_fields1 */
366                         f0 = vsetq_lane_u32(cq0_w0, f0, 3);
367                         f1 = vsetq_lane_u32(cq1_w0, f1, 3);
368                         f2 = vsetq_lane_u32(cq2_w0, f2, 3);
369                         f3 = vsetq_lane_u32(cq3_w0, f3, 3);
370                         ol_flags0 = PKT_RX_RSS_HASH;
371                         ol_flags1 = PKT_RX_RSS_HASH;
372                         ol_flags2 = PKT_RX_RSS_HASH;
373                         ol_flags3 = PKT_RX_RSS_HASH;
374                 } else {
375                         ol_flags0 = 0;
376                         ol_flags1 = 0;
377                         ol_flags2 = 0;
378                         ol_flags3 = 0;
379                 }
380
381                 if (flags & NIX_RX_OFFLOAD_PTYPE_F) {
382                         /* Fill packet_type in the rx_descriptor_fields1 */
383                         f0 = vsetq_lane_u32(nix_ptype_get(lookup_mem, cq0_w1),
384                                             f0, 0);
385                         f1 = vsetq_lane_u32(nix_ptype_get(lookup_mem, cq1_w1),
386                                             f1, 0);
387                         f2 = vsetq_lane_u32(nix_ptype_get(lookup_mem, cq2_w1),
388                                             f2, 0);
389                         f3 = vsetq_lane_u32(nix_ptype_get(lookup_mem, cq3_w1),
390                                             f3, 0);
391                 }
392
393                 if (flags & NIX_RX_OFFLOAD_CHECKSUM_F) {
394                         ol_flags0 |= nix_rx_olflags_get(lookup_mem, cq0_w1);
395                         ol_flags1 |= nix_rx_olflags_get(lookup_mem, cq1_w1);
396                         ol_flags2 |= nix_rx_olflags_get(lookup_mem, cq2_w1);
397                         ol_flags3 |= nix_rx_olflags_get(lookup_mem, cq3_w1);
398                 }
399
400                 if (flags & NIX_RX_OFFLOAD_MARK_UPDATE_F) {
401                         ol_flags0 = nix_update_match_id(
402                                 *(uint16_t *)(cq0 + CQE_SZ(0) + 38), ol_flags0,
403                                 mbuf0);
404                         ol_flags1 = nix_update_match_id(
405                                 *(uint16_t *)(cq0 + CQE_SZ(1) + 38), ol_flags1,
406                                 mbuf1);
407                         ol_flags2 = nix_update_match_id(
408                                 *(uint16_t *)(cq0 + CQE_SZ(2) + 38), ol_flags2,
409                                 mbuf2);
410                         ol_flags3 = nix_update_match_id(
411                                 *(uint16_t *)(cq0 + CQE_SZ(3) + 38), ol_flags3,
412                                 mbuf3);
413                 }
414
415                 /* Form rearm_data with ol_flags */
416                 rearm0 = vsetq_lane_u64(ol_flags0, rearm0, 1);
417                 rearm1 = vsetq_lane_u64(ol_flags1, rearm1, 1);
418                 rearm2 = vsetq_lane_u64(ol_flags2, rearm2, 1);
419                 rearm3 = vsetq_lane_u64(ol_flags3, rearm3, 1);
420
421                 /* Update rx_descriptor_fields1 */
422                 vst1q_u64((uint64_t *)mbuf0->rx_descriptor_fields1, f0);
423                 vst1q_u64((uint64_t *)mbuf1->rx_descriptor_fields1, f1);
424                 vst1q_u64((uint64_t *)mbuf2->rx_descriptor_fields1, f2);
425                 vst1q_u64((uint64_t *)mbuf3->rx_descriptor_fields1, f3);
426
427                 /* Update rearm_data */
428                 vst1q_u64((uint64_t *)mbuf0->rearm_data, rearm0);
429                 vst1q_u64((uint64_t *)mbuf1->rearm_data, rearm1);
430                 vst1q_u64((uint64_t *)mbuf2->rearm_data, rearm2);
431                 vst1q_u64((uint64_t *)mbuf3->rearm_data, rearm3);
432
433                 /* Update that no more segments */
434                 mbuf0->next = NULL;
435                 mbuf1->next = NULL;
436                 mbuf2->next = NULL;
437                 mbuf3->next = NULL;
438
439                 /* Store the mbufs to rx_pkts */
440                 vst1q_u64((uint64_t *)&rx_pkts[packets], mbuf01);
441                 vst1q_u64((uint64_t *)&rx_pkts[packets + 2], mbuf23);
442
443                 /* Prefetch mbufs */
444                 roc_prefetch_store_keep(mbuf0);
445                 roc_prefetch_store_keep(mbuf1);
446                 roc_prefetch_store_keep(mbuf2);
447                 roc_prefetch_store_keep(mbuf3);
448
449                 /* Mark mempool obj as "get" as it is alloc'ed by NIX */
450                 __mempool_check_cookies(mbuf0->pool, (void **)&mbuf0, 1, 1);
451                 __mempool_check_cookies(mbuf1->pool, (void **)&mbuf1, 1, 1);
452                 __mempool_check_cookies(mbuf2->pool, (void **)&mbuf2, 1, 1);
453                 __mempool_check_cookies(mbuf3->pool, (void **)&mbuf3, 1, 1);
454
455                 /* Advance head pointer and packets */
456                 head += NIX_DESCS_PER_LOOP;
457                 head &= qmask;
458                 packets += NIX_DESCS_PER_LOOP;
459         }
460
461         rxq->head = head;
462         rxq->available -= packets;
463
464         rte_io_wmb();
465         /* Free all the CQs that we've processed */
466         plt_write64((rxq->wdata | packets), rxq->cq_door);
467
468         if (unlikely(pkts_left))
469                 packets += cn10k_nix_recv_pkts(rx_queue, &rx_pkts[packets],
470                                                pkts_left, flags);
471
472         return packets;
473 }
474
475 #else
476
477 static inline uint16_t
478 cn10k_nix_recv_pkts_vector(void *rx_queue, struct rte_mbuf **rx_pkts,
479                            uint16_t pkts, const uint16_t flags)
480 {
481         RTE_SET_USED(rx_queue);
482         RTE_SET_USED(rx_pkts);
483         RTE_SET_USED(pkts);
484         RTE_SET_USED(flags);
485
486         return 0;
487 }
488
489 #endif
490
491
492 #define RSS_F     NIX_RX_OFFLOAD_RSS_F
493 #define PTYPE_F   NIX_RX_OFFLOAD_PTYPE_F
494 #define CKSUM_F   NIX_RX_OFFLOAD_CHECKSUM_F
495 #define MARK_F    NIX_RX_OFFLOAD_MARK_UPDATE_F
496 #define TS_F      NIX_RX_OFFLOAD_TSTAMP_F
497
498 /* [TS] [MARK] [CKSUM] [PTYPE] [RSS] */
499 #define NIX_RX_FASTPATH_MODES                                                  \
500 R(no_offload,                   0, 0, 0, 0, 0, NIX_RX_OFFLOAD_NONE)            \
501 R(rss,                          0, 0, 0, 0, 1, RSS_F)                          \
502 R(ptype,                        0, 0, 0, 1, 0, PTYPE_F)                        \
503 R(ptype_rss,                    0, 0, 0, 1, 1, PTYPE_F | RSS_F)                \
504 R(cksum,                        0, 0, 1, 0, 0, CKSUM_F)                        \
505 R(cksum_rss,                    0, 0, 1, 0, 1, CKSUM_F | RSS_F)                \
506 R(cksum_ptype,                  0, 0, 1, 1, 0, CKSUM_F | PTYPE_F)              \
507 R(cksum_ptype_rss,              0, 0, 1, 1, 1, CKSUM_F | PTYPE_F | RSS_F)      \
508 R(mark,                         0, 1, 0, 0, 0, MARK_F)                         \
509 R(mark_rss,                     0, 1, 0, 0, 1, MARK_F | RSS_F)                 \
510 R(mark_ptype,                   0, 1, 0, 1, 0, MARK_F | PTYPE_F)               \
511 R(mark_ptype_rss,               0, 1, 0, 1, 1, MARK_F | PTYPE_F | RSS_F)       \
512 R(mark_cksum,                   0, 1, 1, 0, 0, MARK_F | CKSUM_F)               \
513 R(mark_cksum_rss,               0, 1, 1, 0, 1, MARK_F | CKSUM_F | RSS_F)       \
514 R(mark_cksum_ptype,             0, 1, 1, 1, 0, MARK_F | CKSUM_F | PTYPE_F)     \
515 R(mark_cksum_ptype_rss,         0, 1, 1, 1, 1, MARK_F | CKSUM_F | PTYPE_F | RSS_F)\
516 R(ts,                           1, 0, 0, 0, 0, TS_F)                           \
517 R(ts_rss,                       1, 0, 0, 0, 1, TS_F | RSS_F)                   \
518 R(ts_ptype,                     1, 0, 0, 1, 0, TS_F | PTYPE_F)                 \
519 R(ts_ptype_rss,                 1, 0, 0, 1, 1, TS_F | PTYPE_F | RSS_F)         \
520 R(ts_cksum,                     1, 0, 1, 0, 0, TS_F | CKSUM_F)                 \
521 R(ts_cksum_rss,                 1, 0, 1, 0, 1, TS_F | CKSUM_F | RSS_F)         \
522 R(ts_cksum_ptype,               1, 0, 1, 1, 0, TS_F | CKSUM_F | PTYPE_F)       \
523 R(ts_cksum_ptype_rss,           1, 0, 1, 1, 1, TS_F | CKSUM_F | PTYPE_F | RSS_F)\
524 R(ts_mark,                      1, 1, 0, 0, 0, TS_F | MARK_F)                  \
525 R(ts_mark_rss,                  1, 1, 0, 0, 1, TS_F | MARK_F | RSS_F)          \
526 R(ts_mark_ptype,                1, 1, 0, 1, 0, TS_F | MARK_F | PTYPE_F)        \
527 R(ts_mark_ptype_rss,            1, 1, 0, 1, 1, TS_F | MARK_F | PTYPE_F | RSS_F)\
528 R(ts_mark_cksum,                1, 1, 1, 0, 0, TS_F | MARK_F | CKSUM_F)        \
529 R(ts_mark_cksum_rss,            1, 1, 1, 0, 1, TS_F | MARK_F | CKSUM_F | RSS_F)\
530 R(ts_mark_cksum_ptype,          1, 1, 1, 1, 0, TS_F | MARK_F | CKSUM_F | PTYPE_F)\
531 R(ts_mark_cksum_ptype_rss,      1, 1, 1, 1, 1, TS_F | MARK_F | CKSUM_F | PTYPE_F | RSS_F)
532
533 #define R(name, f4, f3, f2, f1, f0, flags)                                     \
534         uint16_t __rte_noinline __rte_hot cn10k_nix_recv_pkts_##name(          \
535                 void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t pkts);     \
536                                                                                \
537         uint16_t __rte_noinline __rte_hot cn10k_nix_recv_pkts_mseg_##name(     \
538                 void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t pkts);     \
539                                                                                \
540         uint16_t __rte_noinline __rte_hot cn10k_nix_recv_pkts_vec_##name(      \
541                 void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t pkts);
542
543 NIX_RX_FASTPATH_MODES
544 #undef R
545
546 #endif /* __CN10K_RX_H__ */