net/cnxk: add multi-segment Tx for CN9K
[dpdk.git] / drivers / net / cnxk / cn9k_tx.h
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright(C) 2021 Marvell.
3  */
4 #ifndef __CN9K_TX_H__
5 #define __CN9K_TX_H__
6
7 #define NIX_TX_OFFLOAD_NONE           (0)
8 #define NIX_TX_OFFLOAD_L3_L4_CSUM_F   BIT(0)
9 #define NIX_TX_OFFLOAD_OL3_OL4_CSUM_F BIT(1)
10 #define NIX_TX_OFFLOAD_VLAN_QINQ_F    BIT(2)
11 #define NIX_TX_OFFLOAD_MBUF_NOFF_F    BIT(3)
12 #define NIX_TX_OFFLOAD_TSO_F          BIT(4)
13
14 /* Flags to control xmit_prepare function.
15  * Defining it from backwards to denote its been
16  * not used as offload flags to pick function
17  */
18 #define NIX_TX_MULTI_SEG_F BIT(15)
19
20 #define NIX_TX_NEED_SEND_HDR_W1                                                \
21         (NIX_TX_OFFLOAD_L3_L4_CSUM_F | NIX_TX_OFFLOAD_OL3_OL4_CSUM_F |         \
22          NIX_TX_OFFLOAD_VLAN_QINQ_F | NIX_TX_OFFLOAD_TSO_F)
23
24 #define NIX_TX_NEED_EXT_HDR                                                    \
25         (NIX_TX_OFFLOAD_VLAN_QINQ_F | NIX_TX_OFFLOAD_TSO_F)
26
27 #define NIX_XMIT_FC_OR_RETURN(txq, pkts)                                       \
28         do {                                                                   \
29                 /* Cached value is low, Update the fc_cache_pkts */            \
30                 if (unlikely((txq)->fc_cache_pkts < (pkts))) {                 \
31                         /* Multiply with sqe_per_sqb to express in pkts */     \
32                         (txq)->fc_cache_pkts =                                 \
33                                 ((txq)->nb_sqb_bufs_adj - *(txq)->fc_mem)      \
34                                 << (txq)->sqes_per_sqb_log2;                   \
35                         /* Check it again for the room */                      \
36                         if (unlikely((txq)->fc_cache_pkts < (pkts)))           \
37                                 return 0;                                      \
38                 }                                                              \
39         } while (0)
40
41 /* Function to determine no of tx subdesc required in case ext
42  * sub desc is enabled.
43  */
44 static __rte_always_inline int
45 cn9k_nix_tx_ext_subs(const uint16_t flags)
46 {
47         return (flags &
48                 (NIX_TX_OFFLOAD_VLAN_QINQ_F | NIX_TX_OFFLOAD_TSO_F)) ? 1 : 0;
49 }
50
51 static __rte_always_inline void
52 cn9k_nix_xmit_prepare_tso(struct rte_mbuf *m, const uint64_t flags)
53 {
54         uint64_t mask, ol_flags = m->ol_flags;
55
56         if (flags & NIX_TX_OFFLOAD_TSO_F && (ol_flags & PKT_TX_TCP_SEG)) {
57                 uintptr_t mdata = rte_pktmbuf_mtod(m, uintptr_t);
58                 uint16_t *iplen, *oiplen, *oudplen;
59                 uint16_t lso_sb, paylen;
60
61                 mask = -!!(ol_flags & (PKT_TX_OUTER_IPV4 | PKT_TX_OUTER_IPV6));
62                 lso_sb = (mask & (m->outer_l2_len + m->outer_l3_len)) +
63                          m->l2_len + m->l3_len + m->l4_len;
64
65                 /* Reduce payload len from base headers */
66                 paylen = m->pkt_len - lso_sb;
67
68                 /* Get iplen position assuming no tunnel hdr */
69                 iplen = (uint16_t *)(mdata + m->l2_len +
70                                      (2 << !!(ol_flags & PKT_TX_IPV6)));
71                 /* Handle tunnel tso */
72                 if ((flags & NIX_TX_OFFLOAD_OL3_OL4_CSUM_F) &&
73                     (ol_flags & PKT_TX_TUNNEL_MASK)) {
74                         const uint8_t is_udp_tun =
75                                 (CNXK_NIX_UDP_TUN_BITMASK >>
76                                  ((ol_flags & PKT_TX_TUNNEL_MASK) >> 45)) &
77                                 0x1;
78
79                         oiplen = (uint16_t *)(mdata + m->outer_l2_len +
80                                               (2 << !!(ol_flags &
81                                                        PKT_TX_OUTER_IPV6)));
82                         *oiplen = rte_cpu_to_be_16(rte_be_to_cpu_16(*oiplen) -
83                                                    paylen);
84
85                         /* Update format for UDP tunneled packet */
86                         if (is_udp_tun) {
87                                 oudplen = (uint16_t *)(mdata + m->outer_l2_len +
88                                                        m->outer_l3_len + 4);
89                                 *oudplen = rte_cpu_to_be_16(
90                                         rte_be_to_cpu_16(*oudplen) - paylen);
91                         }
92
93                         /* Update iplen position to inner ip hdr */
94                         iplen = (uint16_t *)(mdata + lso_sb - m->l3_len -
95                                              m->l4_len +
96                                              (2 << !!(ol_flags & PKT_TX_IPV6)));
97                 }
98
99                 *iplen = rte_cpu_to_be_16(rte_be_to_cpu_16(*iplen) - paylen);
100         }
101 }
102
103 static __rte_always_inline void
104 cn9k_nix_xmit_prepare(struct rte_mbuf *m, uint64_t *cmd, const uint16_t flags,
105                       const uint64_t lso_tun_fmt)
106 {
107         struct nix_send_ext_s *send_hdr_ext;
108         struct nix_send_hdr_s *send_hdr;
109         uint64_t ol_flags = 0, mask;
110         union nix_send_hdr_w1_u w1;
111         union nix_send_sg_s *sg;
112
113         send_hdr = (struct nix_send_hdr_s *)cmd;
114         if (flags & NIX_TX_NEED_EXT_HDR) {
115                 send_hdr_ext = (struct nix_send_ext_s *)(cmd + 2);
116                 sg = (union nix_send_sg_s *)(cmd + 4);
117                 /* Clear previous markings */
118                 send_hdr_ext->w0.lso = 0;
119                 send_hdr_ext->w1.u = 0;
120         } else {
121                 sg = (union nix_send_sg_s *)(cmd + 2);
122         }
123
124         if (flags & NIX_TX_NEED_SEND_HDR_W1) {
125                 ol_flags = m->ol_flags;
126                 w1.u = 0;
127         }
128
129         if (!(flags & NIX_TX_MULTI_SEG_F)) {
130                 send_hdr->w0.total = m->data_len;
131                 send_hdr->w0.aura =
132                         roc_npa_aura_handle_to_aura(m->pool->pool_id);
133         }
134
135         /*
136          * L3type:  2 => IPV4
137          *          3 => IPV4 with csum
138          *          4 => IPV6
139          * L3type and L3ptr needs to be set for either
140          * L3 csum or L4 csum or LSO
141          *
142          */
143
144         if ((flags & NIX_TX_OFFLOAD_OL3_OL4_CSUM_F) &&
145             (flags & NIX_TX_OFFLOAD_L3_L4_CSUM_F)) {
146                 const uint8_t csum = !!(ol_flags & PKT_TX_OUTER_UDP_CKSUM);
147                 const uint8_t ol3type =
148                         ((!!(ol_flags & PKT_TX_OUTER_IPV4)) << 1) +
149                         ((!!(ol_flags & PKT_TX_OUTER_IPV6)) << 2) +
150                         !!(ol_flags & PKT_TX_OUTER_IP_CKSUM);
151
152                 /* Outer L3 */
153                 w1.ol3type = ol3type;
154                 mask = 0xffffull << ((!!ol3type) << 4);
155                 w1.ol3ptr = ~mask & m->outer_l2_len;
156                 w1.ol4ptr = ~mask & (w1.ol3ptr + m->outer_l3_len);
157
158                 /* Outer L4 */
159                 w1.ol4type = csum + (csum << 1);
160
161                 /* Inner L3 */
162                 w1.il3type = ((!!(ol_flags & PKT_TX_IPV4)) << 1) +
163                              ((!!(ol_flags & PKT_TX_IPV6)) << 2);
164                 w1.il3ptr = w1.ol4ptr + m->l2_len;
165                 w1.il4ptr = w1.il3ptr + m->l3_len;
166                 /* Increment it by 1 if it is IPV4 as 3 is with csum */
167                 w1.il3type = w1.il3type + !!(ol_flags & PKT_TX_IP_CKSUM);
168
169                 /* Inner L4 */
170                 w1.il4type = (ol_flags & PKT_TX_L4_MASK) >> 52;
171
172                 /* In case of no tunnel header use only
173                  * shift IL3/IL4 fields a bit to use
174                  * OL3/OL4 for header checksum
175                  */
176                 mask = !ol3type;
177                 w1.u = ((w1.u & 0xFFFFFFFF00000000) >> (mask << 3)) |
178                        ((w1.u & 0X00000000FFFFFFFF) >> (mask << 4));
179
180         } else if (flags & NIX_TX_OFFLOAD_OL3_OL4_CSUM_F) {
181                 const uint8_t csum = !!(ol_flags & PKT_TX_OUTER_UDP_CKSUM);
182                 const uint8_t outer_l2_len = m->outer_l2_len;
183
184                 /* Outer L3 */
185                 w1.ol3ptr = outer_l2_len;
186                 w1.ol4ptr = outer_l2_len + m->outer_l3_len;
187                 /* Increment it by 1 if it is IPV4 as 3 is with csum */
188                 w1.ol3type = ((!!(ol_flags & PKT_TX_OUTER_IPV4)) << 1) +
189                              ((!!(ol_flags & PKT_TX_OUTER_IPV6)) << 2) +
190                              !!(ol_flags & PKT_TX_OUTER_IP_CKSUM);
191
192                 /* Outer L4 */
193                 w1.ol4type = csum + (csum << 1);
194
195         } else if (flags & NIX_TX_OFFLOAD_L3_L4_CSUM_F) {
196                 const uint8_t l2_len = m->l2_len;
197
198                 /* Always use OLXPTR and OLXTYPE when only
199                  * when one header is present
200                  */
201
202                 /* Inner L3 */
203                 w1.ol3ptr = l2_len;
204                 w1.ol4ptr = l2_len + m->l3_len;
205                 /* Increment it by 1 if it is IPV4 as 3 is with csum */
206                 w1.ol3type = ((!!(ol_flags & PKT_TX_IPV4)) << 1) +
207                              ((!!(ol_flags & PKT_TX_IPV6)) << 2) +
208                              !!(ol_flags & PKT_TX_IP_CKSUM);
209
210                 /* Inner L4 */
211                 w1.ol4type = (ol_flags & PKT_TX_L4_MASK) >> 52;
212         }
213
214         if (flags & NIX_TX_NEED_EXT_HDR && flags & NIX_TX_OFFLOAD_VLAN_QINQ_F) {
215                 send_hdr_ext->w1.vlan1_ins_ena = !!(ol_flags & PKT_TX_VLAN);
216                 /* HW will update ptr after vlan0 update */
217                 send_hdr_ext->w1.vlan1_ins_ptr = 12;
218                 send_hdr_ext->w1.vlan1_ins_tci = m->vlan_tci;
219
220                 send_hdr_ext->w1.vlan0_ins_ena = !!(ol_flags & PKT_TX_QINQ);
221                 /* 2B before end of l2 header */
222                 send_hdr_ext->w1.vlan0_ins_ptr = 12;
223                 send_hdr_ext->w1.vlan0_ins_tci = m->vlan_tci_outer;
224         }
225
226         if (flags & NIX_TX_OFFLOAD_TSO_F && (ol_flags & PKT_TX_TCP_SEG)) {
227                 uint16_t lso_sb;
228                 uint64_t mask;
229
230                 mask = -(!w1.il3type);
231                 lso_sb = (mask & w1.ol4ptr) + (~mask & w1.il4ptr) + m->l4_len;
232
233                 send_hdr_ext->w0.lso_sb = lso_sb;
234                 send_hdr_ext->w0.lso = 1;
235                 send_hdr_ext->w0.lso_mps = m->tso_segsz;
236                 send_hdr_ext->w0.lso_format =
237                         NIX_LSO_FORMAT_IDX_TSOV4 + !!(ol_flags & PKT_TX_IPV6);
238                 w1.ol4type = NIX_SENDL4TYPE_TCP_CKSUM;
239
240                 /* Handle tunnel tso */
241                 if ((flags & NIX_TX_OFFLOAD_OL3_OL4_CSUM_F) &&
242                     (ol_flags & PKT_TX_TUNNEL_MASK)) {
243                         const uint8_t is_udp_tun =
244                                 (CNXK_NIX_UDP_TUN_BITMASK >>
245                                  ((ol_flags & PKT_TX_TUNNEL_MASK) >> 45)) &
246                                 0x1;
247                         uint8_t shift = is_udp_tun ? 32 : 0;
248
249                         shift += (!!(ol_flags & PKT_TX_OUTER_IPV6) << 4);
250                         shift += (!!(ol_flags & PKT_TX_IPV6) << 3);
251
252                         w1.il4type = NIX_SENDL4TYPE_TCP_CKSUM;
253                         w1.ol4type = is_udp_tun ? NIX_SENDL4TYPE_UDP_CKSUM : 0;
254                         /* Update format for UDP tunneled packet */
255                         send_hdr_ext->w0.lso_format = (lso_tun_fmt >> shift);
256                 }
257         }
258
259         if (flags & NIX_TX_NEED_SEND_HDR_W1)
260                 send_hdr->w1.u = w1.u;
261
262         if (!(flags & NIX_TX_MULTI_SEG_F)) {
263                 sg->seg1_size = m->data_len;
264                 *(rte_iova_t *)(++sg) = rte_mbuf_data_iova(m);
265
266                 if (flags & NIX_TX_OFFLOAD_MBUF_NOFF_F) {
267                         /* DF bit = 1 if refcount of current mbuf or parent mbuf
268                          *              is greater than 1
269                          * DF bit = 0 otherwise
270                          */
271                         send_hdr->w0.df = cnxk_nix_prefree_seg(m);
272                         /* Ensuring mbuf fields which got updated in
273                          * cnxk_nix_prefree_seg are written before LMTST.
274                          */
275                         rte_io_wmb();
276                 }
277                 /* Mark mempool object as "put" since it is freed by NIX */
278                 if (!send_hdr->w0.df)
279                         __mempool_check_cookies(m->pool, (void **)&m, 1, 0);
280         }
281 }
282
283 static __rte_always_inline void
284 cn9k_nix_xmit_one(uint64_t *cmd, void *lmt_addr, const rte_iova_t io_addr,
285                   const uint32_t flags)
286 {
287         uint64_t lmt_status;
288
289         do {
290                 roc_lmt_mov(lmt_addr, cmd, cn9k_nix_tx_ext_subs(flags));
291                 lmt_status = roc_lmt_submit_ldeor(io_addr);
292         } while (lmt_status == 0);
293 }
294
295 static __rte_always_inline void
296 cn9k_nix_xmit_prep_lmt(uint64_t *cmd, void *lmt_addr, const uint32_t flags)
297 {
298         roc_lmt_mov(lmt_addr, cmd, cn9k_nix_tx_ext_subs(flags));
299 }
300
301 static __rte_always_inline uint64_t
302 cn9k_nix_xmit_submit_lmt(const rte_iova_t io_addr)
303 {
304         return roc_lmt_submit_ldeor(io_addr);
305 }
306
307 static __rte_always_inline uint64_t
308 cn9k_nix_xmit_submit_lmt_release(const rte_iova_t io_addr)
309 {
310         return roc_lmt_submit_ldeorl(io_addr);
311 }
312
313 static __rte_always_inline uint16_t
314 cn9k_nix_prepare_mseg(struct rte_mbuf *m, uint64_t *cmd, const uint16_t flags)
315 {
316         struct nix_send_hdr_s *send_hdr;
317         union nix_send_sg_s *sg;
318         struct rte_mbuf *m_next;
319         uint64_t *slist, sg_u;
320         uint64_t nb_segs;
321         uint64_t segdw;
322         uint8_t off, i;
323
324         send_hdr = (struct nix_send_hdr_s *)cmd;
325         send_hdr->w0.total = m->pkt_len;
326         send_hdr->w0.aura = roc_npa_aura_handle_to_aura(m->pool->pool_id);
327
328         if (flags & NIX_TX_NEED_EXT_HDR)
329                 off = 2;
330         else
331                 off = 0;
332
333         sg = (union nix_send_sg_s *)&cmd[2 + off];
334         /* Clear sg->u header before use */
335         sg->u &= 0xFC00000000000000;
336         sg_u = sg->u;
337         slist = &cmd[3 + off];
338
339         i = 0;
340         nb_segs = m->nb_segs;
341
342         /* Fill mbuf segments */
343         do {
344                 m_next = m->next;
345                 sg_u = sg_u | ((uint64_t)m->data_len << (i << 4));
346                 *slist = rte_mbuf_data_iova(m);
347                 /* Set invert df if buffer is not to be freed by H/W */
348                 if (flags & NIX_TX_OFFLOAD_MBUF_NOFF_F) {
349                         sg_u |= (cnxk_nix_prefree_seg(m) << (i + 55));
350                         /* Commit changes to mbuf */
351                         rte_io_wmb();
352                 }
353                 /* Mark mempool object as "put" since it is freed by NIX */
354 #ifdef RTE_LIBRTE_MEMPOOL_DEBUG
355                 if (!(sg_u & (1ULL << (i + 55))))
356                         __mempool_check_cookies(m->pool, (void **)&m, 1, 0);
357                 rte_io_wmb();
358 #endif
359                 slist++;
360                 i++;
361                 nb_segs--;
362                 if (i > 2 && nb_segs) {
363                         i = 0;
364                         /* Next SG subdesc */
365                         *(uint64_t *)slist = sg_u & 0xFC00000000000000;
366                         sg->u = sg_u;
367                         sg->segs = 3;
368                         sg = (union nix_send_sg_s *)slist;
369                         sg_u = sg->u;
370                         slist++;
371                 }
372                 m = m_next;
373         } while (nb_segs);
374
375         sg->u = sg_u;
376         sg->segs = i;
377         segdw = (uint64_t *)slist - (uint64_t *)&cmd[2 + off];
378         /* Roundup extra dwords to multiple of 2 */
379         segdw = (segdw >> 1) + (segdw & 0x1);
380         /* Default dwords */
381         segdw += (off >> 1) + 1;
382         send_hdr->w0.sizem1 = segdw - 1;
383
384         return segdw;
385 }
386
387 static __rte_always_inline void
388 cn9k_nix_xmit_mseg_prep_lmt(uint64_t *cmd, void *lmt_addr, uint16_t segdw)
389 {
390         roc_lmt_mov_seg(lmt_addr, (const void *)cmd, segdw);
391 }
392
393 static __rte_always_inline void
394 cn9k_nix_xmit_mseg_one(uint64_t *cmd, void *lmt_addr, rte_iova_t io_addr,
395                        uint16_t segdw)
396 {
397         uint64_t lmt_status;
398
399         do {
400                 roc_lmt_mov_seg(lmt_addr, (const void *)cmd, segdw);
401                 lmt_status = roc_lmt_submit_ldeor(io_addr);
402         } while (lmt_status == 0);
403 }
404
405 static __rte_always_inline void
406 cn9k_nix_xmit_mseg_one_release(uint64_t *cmd, void *lmt_addr,
407                                rte_iova_t io_addr, uint16_t segdw)
408 {
409         uint64_t lmt_status;
410
411         rte_io_wmb();
412         do {
413                 roc_lmt_mov_seg(lmt_addr, (const void *)cmd, segdw);
414                 lmt_status = roc_lmt_submit_ldeor(io_addr);
415         } while (lmt_status == 0);
416 }
417
418 static __rte_always_inline uint16_t
419 cn9k_nix_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t pkts,
420                    uint64_t *cmd, const uint16_t flags)
421 {
422         struct cn9k_eth_txq *txq = tx_queue;
423         const rte_iova_t io_addr = txq->io_addr;
424         void *lmt_addr = txq->lmt_addr;
425         uint64_t lso_tun_fmt;
426         uint16_t i;
427
428         NIX_XMIT_FC_OR_RETURN(txq, pkts);
429
430         roc_lmt_mov(cmd, &txq->cmd[0], cn9k_nix_tx_ext_subs(flags));
431
432         /* Perform header writes before barrier for TSO */
433         if (flags & NIX_TX_OFFLOAD_TSO_F) {
434                 lso_tun_fmt = txq->lso_tun_fmt;
435
436                 for (i = 0; i < pkts; i++)
437                         cn9k_nix_xmit_prepare_tso(tx_pkts[i], flags);
438         }
439
440         /* Lets commit any changes in the packet here as no further changes
441          * to the packet will be done unless no fast free is enabled.
442          */
443         if (!(flags & NIX_TX_OFFLOAD_MBUF_NOFF_F))
444                 rte_io_wmb();
445
446         for (i = 0; i < pkts; i++) {
447                 cn9k_nix_xmit_prepare(tx_pkts[i], cmd, flags, lso_tun_fmt);
448                 cn9k_nix_xmit_one(cmd, lmt_addr, io_addr, flags);
449         }
450
451         /* Reduce the cached count */
452         txq->fc_cache_pkts -= pkts;
453
454         return pkts;
455 }
456
457 static __rte_always_inline uint16_t
458 cn9k_nix_xmit_pkts_mseg(void *tx_queue, struct rte_mbuf **tx_pkts,
459                         uint16_t pkts, uint64_t *cmd, const uint16_t flags)
460 {
461         struct cn9k_eth_txq *txq = tx_queue;
462         const rte_iova_t io_addr = txq->io_addr;
463         void *lmt_addr = txq->lmt_addr;
464         uint64_t lso_tun_fmt;
465         uint16_t segdw;
466         uint64_t i;
467
468         NIX_XMIT_FC_OR_RETURN(txq, pkts);
469
470         roc_lmt_mov(cmd, &txq->cmd[0], cn9k_nix_tx_ext_subs(flags));
471
472         /* Perform header writes before barrier for TSO */
473         if (flags & NIX_TX_OFFLOAD_TSO_F) {
474                 lso_tun_fmt = txq->lso_tun_fmt;
475
476                 for (i = 0; i < pkts; i++)
477                         cn9k_nix_xmit_prepare_tso(tx_pkts[i], flags);
478         }
479
480         /* Lets commit any changes in the packet here as no further changes
481          * to the packet will be done unless no fast free is enabled.
482          */
483         if (!(flags & NIX_TX_OFFLOAD_MBUF_NOFF_F))
484                 rte_io_wmb();
485
486         for (i = 0; i < pkts; i++) {
487                 cn9k_nix_xmit_prepare(tx_pkts[i], cmd, flags, lso_tun_fmt);
488                 segdw = cn9k_nix_prepare_mseg(tx_pkts[i], cmd, flags);
489                 cn9k_nix_xmit_mseg_one(cmd, lmt_addr, io_addr, segdw);
490         }
491
492         /* Reduce the cached count */
493         txq->fc_cache_pkts -= pkts;
494
495         return pkts;
496 }
497
498
499 #define L3L4CSUM_F   NIX_TX_OFFLOAD_L3_L4_CSUM_F
500 #define OL3OL4CSUM_F NIX_TX_OFFLOAD_OL3_OL4_CSUM_F
501 #define VLAN_F       NIX_TX_OFFLOAD_VLAN_QINQ_F
502 #define NOFF_F       NIX_TX_OFFLOAD_MBUF_NOFF_F
503 #define TSO_F        NIX_TX_OFFLOAD_TSO_F
504
505 /* [TSO] [NOFF] [VLAN] [OL3OL4CSUM] [L3L4CSUM] */
506 #define NIX_TX_FASTPATH_MODES                                           \
507 T(no_offload,                           0, 0, 0, 0, 0,  4,              \
508                 NIX_TX_OFFLOAD_NONE)                                    \
509 T(l3l4csum,                             0, 0, 0, 0, 1,  4,              \
510                 L3L4CSUM_F)                                             \
511 T(ol3ol4csum,                           0, 0, 0, 1, 0,  4,              \
512                 OL3OL4CSUM_F)                                           \
513 T(ol3ol4csum_l3l4csum,                  0, 0, 0, 1, 1,  4,              \
514                 OL3OL4CSUM_F | L3L4CSUM_F)                              \
515 T(vlan,                                 0, 0, 1, 0, 0,  6,              \
516                 VLAN_F)                                                 \
517 T(vlan_l3l4csum,                        0, 0, 1, 0, 1,  6,              \
518                 VLAN_F | L3L4CSUM_F)                                    \
519 T(vlan_ol3ol4csum,                      0, 0, 1, 1, 0,  6,              \
520                 VLAN_F | OL3OL4CSUM_F)                                  \
521 T(vlan_ol3ol4csum_l3l4csum,             0, 0, 1, 1, 1,  6,              \
522                 VLAN_F | OL3OL4CSUM_F | L3L4CSUM_F)                     \
523 T(noff,                                 0, 1, 0, 0, 0,  4,              \
524                 NOFF_F)                                                 \
525 T(noff_l3l4csum,                        0, 1, 0, 0, 1,  4,              \
526                 NOFF_F | L3L4CSUM_F)                                    \
527 T(noff_ol3ol4csum,                      0, 1, 0, 1, 0,  4,              \
528                 NOFF_F | OL3OL4CSUM_F)                                  \
529 T(noff_ol3ol4csum_l3l4csum,             0, 1, 0, 1, 1,  4,              \
530                 NOFF_F | OL3OL4CSUM_F | L3L4CSUM_F)                     \
531 T(noff_vlan,                            0, 1, 1, 0, 0,  6,              \
532                 NOFF_F | VLAN_F)                                        \
533 T(noff_vlan_l3l4csum,                   0, 1, 1, 0, 1,  6,              \
534                 NOFF_F | VLAN_F | L3L4CSUM_F)                           \
535 T(noff_vlan_ol3ol4csum,                 0, 1, 1, 1, 0,  6,              \
536                 NOFF_F | VLAN_F | OL3OL4CSUM_F)                         \
537 T(noff_vlan_ol3ol4csum_l3l4csum,        0, 1, 1, 1, 1,  6,              \
538                 NOFF_F | VLAN_F | OL3OL4CSUM_F | L3L4CSUM_F)            \
539 T(tso,                                  1, 0, 0, 0, 0,  6,              \
540                 TSO_F)                                                  \
541 T(tso_l3l4csum,                         1, 0, 0, 0, 1,  6,              \
542                 TSO_F | L3L4CSUM_F)                                     \
543 T(tso_ol3ol4csum,                       1, 0, 0, 1, 0,  6,              \
544                 TSO_F | OL3OL4CSUM_F)                                   \
545 T(tso_ol3ol4csum_l3l4csum,              1, 0, 0, 1, 1,  6,              \
546                 TSO_F | OL3OL4CSUM_F | L3L4CSUM_F)                      \
547 T(tso_vlan,                             1, 0, 1, 0, 0,  6,              \
548                 TSO_F | VLAN_F)                                         \
549 T(tso_vlan_l3l4csum,                    1, 0, 1, 0, 1,  6,              \
550                 TSO_F | VLAN_F | L3L4CSUM_F)                            \
551 T(tso_vlan_ol3ol4csum,                  1, 0, 1, 1, 0,  6,              \
552                 TSO_F | VLAN_F | OL3OL4CSUM_F)                          \
553 T(tso_vlan_ol3ol4csum_l3l4csum,         1, 0, 1, 1, 1,  6,              \
554                 TSO_F | VLAN_F | OL3OL4CSUM_F | L3L4CSUM_F)             \
555 T(tso_noff,                             1, 1, 0, 0, 0,  6,              \
556                 TSO_F | NOFF_F)                                         \
557 T(tso_noff_l3l4csum,                    1, 1, 0, 0, 1,  6,              \
558                 TSO_F | NOFF_F | L3L4CSUM_F)                            \
559 T(tso_noff_ol3ol4csum,                  1, 1, 0, 1, 0,  6,              \
560                 TSO_F | NOFF_F | OL3OL4CSUM_F)                          \
561 T(tso_noff_ol3ol4csum_l3l4csum,         1, 1, 0, 1, 1,  6,              \
562                 TSO_F | NOFF_F | OL3OL4CSUM_F | L3L4CSUM_F)             \
563 T(tso_noff_vlan,                        1, 1, 1, 0, 0,  6,              \
564                 TSO_F | NOFF_F | VLAN_F)                                \
565 T(tso_noff_vlan_l3l4csum,               1, 1, 1, 0, 1,  6,              \
566                 TSO_F | NOFF_F | VLAN_F | L3L4CSUM_F)                   \
567 T(tso_noff_vlan_ol3ol4csum,             1, 1, 1, 1, 0,  6,              \
568                 TSO_F | NOFF_F | VLAN_F | OL3OL4CSUM_F)                 \
569 T(tso_noff_vlan_ol3ol4csum_l3l4csum,    1, 1, 1, 1, 1,  6,              \
570                 TSO_F | NOFF_F | VLAN_F | OL3OL4CSUM_F | L3L4CSUM_F)
571
572 #define T(name, f4, f3, f2, f1, f0, sz, flags)                                 \
573         uint16_t __rte_noinline __rte_hot cn9k_nix_xmit_pkts_##name(           \
574                 void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t pkts);     \
575                                                                                \
576         uint16_t __rte_noinline __rte_hot cn9k_nix_xmit_pkts_mseg_##name(      \
577                 void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t pkts);
578
579 NIX_TX_FASTPATH_MODES
580 #undef T
581
582 #endif /* __CN9K_TX_H__ */