summaryrefslogtreecommitdiffstats
path: root/src/spdk/dpdk/drivers/net/octeontx2/otx2_tx.h
blob: 3c43170920e371db3ab5283756a76b6fc4f487b6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
/* SPDX-License-Identifier: BSD-3-Clause
 * Copyright(C) 2019 Marvell International Ltd.
 */

#ifndef __OTX2_TX_H__
#define __OTX2_TX_H__

#define NIX_TX_OFFLOAD_NONE		(0)
#define NIX_TX_OFFLOAD_L3_L4_CSUM_F	BIT(0)
#define NIX_TX_OFFLOAD_OL3_OL4_CSUM_F	BIT(1)
#define NIX_TX_OFFLOAD_VLAN_QINQ_F	BIT(2)
#define NIX_TX_OFFLOAD_MBUF_NOFF_F	BIT(3)
#define NIX_TX_OFFLOAD_TSTAMP_F		BIT(4)
#define NIX_TX_OFFLOAD_TSO_F		BIT(5)
#define NIX_TX_OFFLOAD_SECURITY_F	BIT(6)

/* Flags to control xmit_prepare function.
 * Defining it from backwards to denote its been
 * not used as offload flags to pick function
 */
#define NIX_TX_MULTI_SEG_F		BIT(15)

#define NIX_TX_NEED_SEND_HDR_W1	\
	(NIX_TX_OFFLOAD_L3_L4_CSUM_F | NIX_TX_OFFLOAD_OL3_OL4_CSUM_F |	\
	 NIX_TX_OFFLOAD_VLAN_QINQ_F | NIX_TX_OFFLOAD_TSO_F)

#define NIX_TX_NEED_EXT_HDR \
	(NIX_TX_OFFLOAD_VLAN_QINQ_F | NIX_TX_OFFLOAD_TSTAMP_F | \
	 NIX_TX_OFFLOAD_TSO_F)

#define NIX_UDP_TUN_BITMASK \
	((1ull << (PKT_TX_TUNNEL_VXLAN >> 45)) | \
	 (1ull << (PKT_TX_TUNNEL_GENEVE >> 45)))

#define NIX_LSO_FORMAT_IDX_TSOV4	(0)
#define NIX_LSO_FORMAT_IDX_TSOV6	(1)

/* Function to determine no of tx subdesc required in case ext
 * sub desc is enabled.
 */
static __rte_always_inline int
otx2_nix_tx_ext_subs(const uint16_t flags)
{
	return (flags & NIX_TX_OFFLOAD_TSTAMP_F) ? 2 :
		((flags & (NIX_TX_OFFLOAD_VLAN_QINQ_F | NIX_TX_OFFLOAD_TSO_F)) ?
		 1 : 0);
}

static __rte_always_inline void
otx2_nix_xmit_prepare_tstamp(uint64_t *cmd,  const uint64_t *send_mem_desc,
			     const uint64_t ol_flags, const uint16_t no_segdw,
			     const uint16_t flags)
{
	if (flags & NIX_TX_OFFLOAD_TSTAMP_F) {
		struct nix_send_mem_s *send_mem;
		uint16_t off = (no_segdw - 1) << 1;
		const uint8_t is_ol_tstamp = !(ol_flags & PKT_TX_IEEE1588_TMST);

		send_mem = (struct nix_send_mem_s *)(cmd + off);
		if (flags & NIX_TX_MULTI_SEG_F) {
			/* Retrieving the default desc values */
			cmd[off] = send_mem_desc[6];

			/* Using compiler barier to avoid voilation of C
			 * aliasing rules.
			 */
			rte_compiler_barrier();
		}

		/* Packets for which PKT_TX_IEEE1588_TMST is not set, tx tstamp
		 * should not be recorded, hence changing the alg type to
		 * NIX_SENDMEMALG_SET and also changing send mem addr field to
		 * next 8 bytes as it corrpt the actual tx tstamp registered
		 * address.
		 */
		send_mem->alg = NIX_SENDMEMALG_SETTSTMP - (is_ol_tstamp);

		send_mem->addr = (rte_iova_t)((uint64_t *)send_mem_desc[7] +
					      (is_ol_tstamp));
	}
}

static __rte_always_inline uint64_t
otx2_pktmbuf_detach(struct rte_mbuf *m)
{
	struct rte_mempool *mp = m->pool;
	uint32_t mbuf_size, buf_len;
	struct rte_mbuf *md;
	uint16_t priv_size;
	uint16_t refcount;

	/* Update refcount of direct mbuf */
	md = rte_mbuf_from_indirect(m);
	refcount = rte_mbuf_refcnt_update(md, -1);

	priv_size = rte_pktmbuf_priv_size(mp);
	mbuf_size = (uint32_t)(sizeof(struct rte_mbuf) + priv_size);
	buf_len = rte_pktmbuf_data_room_size(mp);

	m->priv_size = priv_size;
	m->buf_addr = (char *)m + mbuf_size;
	m->buf_iova = rte_mempool_virt2iova(m) + mbuf_size;
	m->buf_len = (uint16_t)buf_len;
	rte_pktmbuf_reset_headroom(m);
	m->data_len = 0;
	m->ol_flags = 0;
	m->next = NULL;
	m->nb_segs = 1;

	/* Now indirect mbuf is safe to free */
	rte_pktmbuf_free(m);

	if (refcount == 0) {
		rte_mbuf_refcnt_set(md, 1);
		md->data_len = 0;
		md->ol_flags = 0;
		md->next = NULL;
		md->nb_segs = 1;
		return 0;
	} else {
		return 1;
	}
}

static __rte_always_inline uint64_t
otx2_nix_prefree_seg(struct rte_mbuf *m)
{
	if (likely(rte_mbuf_refcnt_read(m) == 1)) {
		if (!RTE_MBUF_DIRECT(m))
			return otx2_pktmbuf_detach(m);

		m->next = NULL;
		m->nb_segs = 1;
		return 0;
	} else if (rte_mbuf_refcnt_update(m, -1) == 0) {
		if (!RTE_MBUF_DIRECT(m))
			return otx2_pktmbuf_detach(m);

		rte_mbuf_refcnt_set(m, 1);
		m->next = NULL;
		m->nb_segs = 1;
		return 0;
	}

	/* Mbuf is having refcount more than 1 so need not to be freed */
	return 1;
}

static __rte_always_inline void
otx2_nix_xmit_prepare_tso(struct rte_mbuf *m, const uint64_t flags)
{
	uint64_t mask, ol_flags = m->ol_flags;

	if (flags & NIX_TX_OFFLOAD_TSO_F &&
	    (ol_flags & PKT_TX_TCP_SEG)) {
		uintptr_t mdata = rte_pktmbuf_mtod(m, uintptr_t);
		uint16_t *iplen, *oiplen, *oudplen;
		uint16_t lso_sb, paylen;

		mask = -!!(ol_flags & (PKT_TX_OUTER_IPV4 | PKT_TX_OUTER_IPV6));
		lso_sb = (mask & (m->outer_l2_len + m->outer_l3_len)) +
			m->l2_len + m->l3_len + m->l4_len;

		/* Reduce payload len from base headers */
		paylen = m->pkt_len - lso_sb;

		/* Get iplen position assuming no tunnel hdr */
		iplen = (uint16_t *)(mdata + m->l2_len +
				     (2 << !!(ol_flags & PKT_TX_IPV6)));
		/* Handle tunnel tso */
		if ((flags & NIX_TX_OFFLOAD_OL3_OL4_CSUM_F) &&
		    (ol_flags & PKT_TX_TUNNEL_MASK)) {
			const uint8_t is_udp_tun = (NIX_UDP_TUN_BITMASK >>
				((ol_flags & PKT_TX_TUNNEL_MASK) >> 45)) & 0x1;

			oiplen = (uint16_t *)(mdata + m->outer_l2_len +
				(2 << !!(ol_flags & PKT_TX_OUTER_IPV6)));
			*oiplen = rte_cpu_to_be_16(rte_be_to_cpu_16(*oiplen) -
						   paylen);

			/* Update format for UDP tunneled packet */
			if (is_udp_tun) {
				oudplen = (uint16_t *)(mdata + m->outer_l2_len +
						       m->outer_l3_len + 4);
				*oudplen =
				rte_cpu_to_be_16(rte_be_to_cpu_16(*oudplen) -
						 paylen);
			}

			/* Update iplen position to inner ip hdr */
			iplen = (uint16_t *)(mdata + lso_sb - m->l3_len -
				m->l4_len + (2 << !!(ol_flags & PKT_TX_IPV6)));
		}

		*iplen = rte_cpu_to_be_16(rte_be_to_cpu_16(*iplen) - paylen);
	}
}

static __rte_always_inline void
otx2_nix_xmit_prepare(struct rte_mbuf *m, uint64_t *cmd, const uint16_t flags)
{
	struct nix_send_ext_s *send_hdr_ext;
	struct nix_send_hdr_s *send_hdr;
	uint64_t ol_flags = 0, mask;
	union nix_send_hdr_w1_u w1;
	union nix_send_sg_s *sg;

	send_hdr = (struct nix_send_hdr_s *)cmd;
	if (flags & NIX_TX_NEED_EXT_HDR) {
		send_hdr_ext = (struct nix_send_ext_s *)(cmd + 2);
		sg = (union nix_send_sg_s *)(cmd + 4);
		/* Clear previous markings */
		send_hdr_ext->w0.lso = 0;
		send_hdr_ext->w1.u = 0;
	} else {
		sg = (union nix_send_sg_s *)(cmd + 2);
	}

	if (flags & NIX_TX_NEED_SEND_HDR_W1) {
		ol_flags = m->ol_flags;
		w1.u = 0;
	}

	if (!(flags & NIX_TX_MULTI_SEG_F)) {
		send_hdr->w0.total = m->data_len;
		send_hdr->w0.aura =
			npa_lf_aura_handle_to_aura(m->pool->pool_id);
	}

	/*
	 * L3type:  2 => IPV4
	 *          3 => IPV4 with csum
	 *          4 => IPV6
	 * L3type and L3ptr needs to be set for either
	 * L3 csum or L4 csum or LSO
	 *
	 */

	if ((flags & NIX_TX_OFFLOAD_OL3_OL4_CSUM_F) &&
	    (flags & NIX_TX_OFFLOAD_L3_L4_CSUM_F)) {
		const uint8_t csum = !!(ol_flags & PKT_TX_OUTER_UDP_CKSUM);
		const uint8_t ol3type =
			((!!(ol_flags & PKT_TX_OUTER_IPV4)) << 1) +
			((!!(ol_flags & PKT_TX_OUTER_IPV6)) << 2) +
			!!(ol_flags & PKT_TX_OUTER_IP_CKSUM);

		/* Outer L3 */
		w1.ol3type = ol3type;
		mask = 0xffffull << ((!!ol3type) << 4);
		w1.ol3ptr = ~mask & m->outer_l2_len;
		w1.ol4ptr = ~mask & (w1.ol3ptr + m->outer_l3_len);

		/* Outer L4 */
		w1.ol4type = csum + (csum << 1);

		/* Inner L3 */
		w1.il3type = ((!!(ol_flags & PKT_TX_IPV4)) << 1) +
			((!!(ol_flags & PKT_TX_IPV6)) << 2);
		w1.il3ptr = w1.ol4ptr + m->l2_len;
		w1.il4ptr = w1.il3ptr + m->l3_len;
		/* Increment it by 1 if it is IPV4 as 3 is with csum */
		w1.il3type = w1.il3type + !!(ol_flags & PKT_TX_IP_CKSUM);

		/* Inner L4 */
		w1.il4type =  (ol_flags & PKT_TX_L4_MASK) >> 52;

		/* In case of no tunnel header use only
		 * shift IL3/IL4 fields a bit to use
		 * OL3/OL4 for header checksum
		 */
		mask = !ol3type;
		w1.u = ((w1.u & 0xFFFFFFFF00000000) >> (mask << 3)) |
			((w1.u & 0X00000000FFFFFFFF) >> (mask << 4));

	} else if (flags & NIX_TX_OFFLOAD_OL3_OL4_CSUM_F) {
		const uint8_t csum = !!(ol_flags & PKT_TX_OUTER_UDP_CKSUM);
		const uint8_t outer_l2_len = m->outer_l2_len;

		/* Outer L3 */
		w1.ol3ptr = outer_l2_len;
		w1.ol4ptr = outer_l2_len + m->outer_l3_len;
		/* Increment it by 1 if it is IPV4 as 3 is with csum */
		w1.ol3type = ((!!(ol_flags & PKT_TX_OUTER_IPV4)) << 1) +
			((!!(ol_flags & PKT_TX_OUTER_IPV6)) << 2) +
			!!(ol_flags & PKT_TX_OUTER_IP_CKSUM);

		/* Outer L4 */
		w1.ol4type = csum + (csum << 1);

	} else if (flags & NIX_TX_OFFLOAD_L3_L4_CSUM_F) {
		const uint8_t l2_len = m->l2_len;

		/* Always use OLXPTR and OLXTYPE when only
		 * when one header is present
		 */

		/* Inner L3 */
		w1.ol3ptr = l2_len;
		w1.ol4ptr = l2_len + m->l3_len;
		/* Increment it by 1 if it is IPV4 as 3 is with csum */
		w1.ol3type = ((!!(ol_flags & PKT_TX_IPV4)) << 1) +
			((!!(ol_flags & PKT_TX_IPV6)) << 2) +
			!!(ol_flags & PKT_TX_IP_CKSUM);

		/* Inner L4 */
		w1.ol4type =  (ol_flags & PKT_TX_L4_MASK) >> 52;
	}

	if (flags & NIX_TX_NEED_EXT_HDR &&
	    flags & NIX_TX_OFFLOAD_VLAN_QINQ_F) {
		send_hdr_ext->w1.vlan1_ins_ena = !!(ol_flags & PKT_TX_VLAN);
		/* HW will update ptr after vlan0 update */
		send_hdr_ext->w1.vlan1_ins_ptr = 12;
		send_hdr_ext->w1.vlan1_ins_tci = m->vlan_tci;

		send_hdr_ext->w1.vlan0_ins_ena = !!(ol_flags & PKT_TX_QINQ);
		/* 2B before end of l2 header */
		send_hdr_ext->w1.vlan0_ins_ptr = 12;
		send_hdr_ext->w1.vlan0_ins_tci = m->vlan_tci_outer;
	}

	if (flags & NIX_TX_OFFLOAD_TSO_F &&
	    (ol_flags & PKT_TX_TCP_SEG)) {
		uint16_t lso_sb;
		uint64_t mask;

		mask = -(!w1.il3type);
		lso_sb = (mask & w1.ol4ptr) + (~mask & w1.il4ptr) + m->l4_len;

		send_hdr_ext->w0.lso_sb = lso_sb;
		send_hdr_ext->w0.lso = 1;
		send_hdr_ext->w0.lso_mps = m->tso_segsz;
		send_hdr_ext->w0.lso_format =
			NIX_LSO_FORMAT_IDX_TSOV4 + !!(ol_flags & PKT_TX_IPV6);
		w1.ol4type = NIX_SENDL4TYPE_TCP_CKSUM;

		/* Handle tunnel tso */
		if ((flags & NIX_TX_OFFLOAD_OL3_OL4_CSUM_F) &&
		    (ol_flags & PKT_TX_TUNNEL_MASK)) {
			const uint8_t is_udp_tun = (NIX_UDP_TUN_BITMASK >>
				((ol_flags & PKT_TX_TUNNEL_MASK) >> 45)) & 0x1;

			w1.il4type = NIX_SENDL4TYPE_TCP_CKSUM;
			w1.ol4type = is_udp_tun ? NIX_SENDL4TYPE_UDP_CKSUM : 0;
			/* Update format for UDP tunneled packet */
			send_hdr_ext->w0.lso_format += is_udp_tun ? 2 : 6;

			send_hdr_ext->w0.lso_format +=
				!!(ol_flags & PKT_TX_OUTER_IPV6) << 1;
		}
	}

	if (flags & NIX_TX_NEED_SEND_HDR_W1)
		send_hdr->w1.u = w1.u;

	if (!(flags & NIX_TX_MULTI_SEG_F)) {
		sg->seg1_size = m->data_len;
		*(rte_iova_t *)(++sg) = rte_mbuf_data_iova(m);

		if (flags & NIX_TX_OFFLOAD_MBUF_NOFF_F) {
			/* DF bit = 1 if refcount of current mbuf or parent mbuf
			 *		is greater than 1
			 * DF bit = 0 otherwise
			 */
			send_hdr->w0.df = otx2_nix_prefree_seg(m);
		}
		/* Mark mempool object as "put" since it is freed by NIX */
		if (!send_hdr->w0.df)
			__mempool_check_cookies(m->pool, (void **)&m, 1, 0);
	}
}


static __rte_always_inline void
otx2_nix_xmit_one(uint64_t *cmd, void *lmt_addr,
		  const rte_iova_t io_addr, const uint32_t flags)
{
	uint64_t lmt_status;

	do {
		otx2_lmt_mov(lmt_addr, cmd, otx2_nix_tx_ext_subs(flags));
		lmt_status = otx2_lmt_submit(io_addr);
	} while (lmt_status == 0);
}

static __rte_always_inline uint16_t
otx2_nix_prepare_mseg(struct rte_mbuf *m, uint64_t *cmd, const uint16_t flags)
{
	struct nix_send_hdr_s *send_hdr;
	union nix_send_sg_s *sg;
	struct rte_mbuf *m_next;
	uint64_t *slist, sg_u;
	uint64_t nb_segs;
	uint64_t segdw;
	uint8_t off, i;

	send_hdr = (struct nix_send_hdr_s *)cmd;
	send_hdr->w0.total = m->pkt_len;
	send_hdr->w0.aura = npa_lf_aura_handle_to_aura(m->pool->pool_id);

	if (flags & NIX_TX_NEED_EXT_HDR)
		off = 2;
	else
		off = 0;

	sg = (union nix_send_sg_s *)&cmd[2 + off];
	/* Clear sg->u header before use */
	sg->u &= 0xFC00000000000000;
	sg_u = sg->u;
	slist = &cmd[3 + off];

	i = 0;
	nb_segs = m->nb_segs;

	/* Fill mbuf segments */
	do {
		m_next = m->next;
		sg_u = sg_u | ((uint64_t)m->data_len << (i << 4));
		*slist = rte_mbuf_data_iova(m);
		/* Set invert df if buffer is not to be freed by H/W */
		if (flags & NIX_TX_OFFLOAD_MBUF_NOFF_F)
			sg_u |=	(otx2_nix_prefree_seg(m) << (i + 55));
		/* Mark mempool object as "put" since it is freed by NIX */
		if (!(sg_u & (1ULL << (i + 55)))) {
			m->next = NULL;
			__mempool_check_cookies(m->pool, (void **)&m, 1, 0);
		}
		slist++;
		i++;
		nb_segs--;
		if (i > 2 && nb_segs) {
			i = 0;
			/* Next SG subdesc */
			*(uint64_t *)slist = sg_u & 0xFC00000000000000;
			sg->u = sg_u;
			sg->segs = 3;
			sg = (union nix_send_sg_s *)slist;
			sg_u = sg->u;
			slist++;
		}
		m = m_next;
	} while (nb_segs);

	sg->u = sg_u;
	sg->segs = i;
	segdw = (uint64_t *)slist - (uint64_t *)&cmd[2 + off];
	/* Roundup extra dwords to multiple of 2 */
	segdw = (segdw >> 1) + (segdw & 0x1);
	/* Default dwords */
	segdw += (off >> 1) + 1 + !!(flags & NIX_TX_OFFLOAD_TSTAMP_F);
	send_hdr->w0.sizem1 = segdw - 1;

	return segdw;
}

static __rte_always_inline void
otx2_nix_xmit_mseg_one(uint64_t *cmd, void *lmt_addr,
		       rte_iova_t io_addr, uint16_t segdw)
{
	uint64_t lmt_status;

	do {
		otx2_lmt_mov_seg(lmt_addr, (const void *)cmd, segdw);
		lmt_status = otx2_lmt_submit(io_addr);
	} while (lmt_status == 0);
}

#define L3L4CSUM_F   NIX_TX_OFFLOAD_L3_L4_CSUM_F
#define OL3OL4CSUM_F NIX_TX_OFFLOAD_OL3_OL4_CSUM_F
#define VLAN_F       NIX_TX_OFFLOAD_VLAN_QINQ_F
#define NOFF_F       NIX_TX_OFFLOAD_MBUF_NOFF_F
#define TSP_F        NIX_TX_OFFLOAD_TSTAMP_F
#define TSO_F        NIX_TX_OFFLOAD_TSO_F
#define TX_SEC_F     NIX_TX_OFFLOAD_SECURITY_F

/* [SEC] [TSO] [TSTMP] [NOFF] [VLAN] [OL3OL4CSUM] [L3L4CSUM] */
#define NIX_TX_FASTPATH_MODES						\
T(no_offload,				0, 0, 0, 0, 0, 0, 0,	4,	\
		NIX_TX_OFFLOAD_NONE)					\
T(l3l4csum,				0, 0, 0, 0, 0, 0, 1,	4,	\
		L3L4CSUM_F)						\
T(ol3ol4csum,				0, 0, 0, 0, 0, 1, 0,	4,	\
		OL3OL4CSUM_F)						\
T(ol3ol4csum_l3l4csum,			0, 0, 0, 0, 0, 1, 1,	4,	\
		OL3OL4CSUM_F | L3L4CSUM_F)				\
T(vlan,					0, 0, 0, 0, 1, 0, 0,	6,	\
		VLAN_F)							\
T(vlan_l3l4csum,			0, 0, 0, 0, 1, 0, 1,	6,	\
		VLAN_F | L3L4CSUM_F)					\
T(vlan_ol3ol4csum,			0, 0, 0, 0, 1, 1, 0,	6,	\
		VLAN_F | OL3OL4CSUM_F)					\
T(vlan_ol3ol4csum_l3l4csum,		0, 0, 0, 0, 1, 1, 1,	6,	\
		VLAN_F | OL3OL4CSUM_F |	L3L4CSUM_F)			\
T(noff,					0, 0, 0, 1, 0, 0, 0,	4,	\
		NOFF_F)							\
T(noff_l3l4csum,			0, 0, 0, 1, 0, 0, 1,	4,	\
		NOFF_F | L3L4CSUM_F)					\
T(noff_ol3ol4csum,			0, 0, 0, 1, 0, 1, 0,	4,	\
		NOFF_F | OL3OL4CSUM_F)					\
T(noff_ol3ol4csum_l3l4csum,		0, 0, 0, 1, 0, 1, 1,	4,	\
		NOFF_F | OL3OL4CSUM_F |	L3L4CSUM_F)			\
T(noff_vlan,				0, 0, 0, 1, 1, 0, 0,	6,	\
		NOFF_F | VLAN_F)					\
T(noff_vlan_l3l4csum,			0, 0, 0, 1, 1, 0, 1,	6,	\
		NOFF_F | VLAN_F | L3L4CSUM_F)				\
T(noff_vlan_ol3ol4csum,			0, 0, 0, 1, 1, 1, 0,	6,	\
		NOFF_F | VLAN_F | OL3OL4CSUM_F)				\
T(noff_vlan_ol3ol4csum_l3l4csum,	0, 0, 0, 1, 1, 1, 1,	6,	\
		NOFF_F | VLAN_F | OL3OL4CSUM_F | L3L4CSUM_F)		\
T(ts,					0, 0, 1, 0, 0, 0, 0,	8,	\
		TSP_F)							\
T(ts_l3l4csum,				0, 0, 1, 0, 0, 0, 1,	8,	\
		TSP_F | L3L4CSUM_F)					\
T(ts_ol3ol4csum,			0, 0, 1, 0, 0, 1, 0,	8,	\
		TSP_F | OL3OL4CSUM_F)					\
T(ts_ol3ol4csum_l3l4csum,		0, 0, 1, 0, 0, 1, 1,	8,	\
		TSP_F | OL3OL4CSUM_F | L3L4CSUM_F)			\
T(ts_vlan,				0, 0, 1, 0, 1, 0, 0,	8,	\
		TSP_F | VLAN_F)						\
T(ts_vlan_l3l4csum,			0, 0, 1, 0, 1, 0, 1,	8,	\
		TSP_F | VLAN_F | L3L4CSUM_F)				\
T(ts_vlan_ol3ol4csum,			0, 0, 1, 0, 1, 1, 0,	8,	\
		TSP_F | VLAN_F | OL3OL4CSUM_F)				\
T(ts_vlan_ol3ol4csum_l3l4csum,		0, 0, 1, 0, 1, 1, 1,	8,	\
		TSP_F | VLAN_F | OL3OL4CSUM_F | L3L4CSUM_F)		\
T(ts_noff,				0, 0, 1, 1, 0, 0, 0,	8,	\
		TSP_F | NOFF_F)						\
T(ts_noff_l3l4csum,			0, 0, 1, 1, 0, 0, 1,	8,	\
		TSP_F | NOFF_F | L3L4CSUM_F)				\
T(ts_noff_ol3ol4csum,			0, 0, 1, 1, 0, 1, 0,	8,	\
		TSP_F | NOFF_F | OL3OL4CSUM_F)				\
T(ts_noff_ol3ol4csum_l3l4csum,		0, 0, 1, 1, 0, 1, 1,	8,	\
		TSP_F | NOFF_F | OL3OL4CSUM_F | L3L4CSUM_F)		\
T(ts_noff_vlan,				0, 0, 1, 1, 1, 0, 0,	8,	\
		TSP_F | NOFF_F | VLAN_F)				\
T(ts_noff_vlan_l3l4csum,		0, 0, 1, 1, 1, 0, 1,	8,	\
		TSP_F | NOFF_F | VLAN_F | L3L4CSUM_F)			\
T(ts_noff_vlan_ol3ol4csum,		0, 0, 1, 1, 1, 1, 0,	8,	\
		TSP_F | NOFF_F | VLAN_F | OL3OL4CSUM_F)			\
T(ts_noff_vlan_ol3ol4csum_l3l4csum,	0, 0, 1, 1, 1, 1, 1,	8,	\
		TSP_F | NOFF_F | VLAN_F | OL3OL4CSUM_F | L3L4CSUM_F)	\
									\
T(tso,					0, 1, 0, 0, 0, 0, 0,	6,	\
		TSO_F)							\
T(tso_l3l4csum,				0, 1, 0, 0, 0, 0, 1,	6,	\
		TSO_F | L3L4CSUM_F)					\
T(tso_ol3ol4csum,			0, 1, 0, 0, 0, 1, 0,	6,	\
		TSO_F | OL3OL4CSUM_F)					\
T(tso_ol3ol4csum_l3l4csum,		0, 1, 0, 0, 0, 1, 1,	6,	\
		TSO_F | OL3OL4CSUM_F | L3L4CSUM_F)			\
T(tso_vlan,				0, 1, 0, 0, 1, 0, 0,	6,	\
		TSO_F | VLAN_F)						\
T(tso_vlan_l3l4csum,			0, 1, 0, 0, 1, 0, 1,	6,	\
		TSO_F | VLAN_F | L3L4CSUM_F)				\
T(tso_vlan_ol3ol4csum,			0, 1, 0, 0, 1, 1, 0,	6,	\
		TSO_F | VLAN_F | OL3OL4CSUM_F)				\
T(tso_vlan_ol3ol4csum_l3l4csum,		0, 1, 0, 0, 1, 1, 1,	6,	\
		TSO_F | VLAN_F | OL3OL4CSUM_F |	L3L4CSUM_F)		\
T(tso_noff,				0, 1, 0, 1, 0, 0, 0,	6,	\
		TSO_F | NOFF_F)						\
T(tso_noff_l3l4csum,			0, 1, 0, 1, 0, 0, 1,	6,	\
		TSO_F | NOFF_F | L3L4CSUM_F)				\
T(tso_noff_ol3ol4csum,			0, 1, 0, 1, 0, 1, 0,	6,	\
		TSO_F | NOFF_F | OL3OL4CSUM_F)				\
T(tso_noff_ol3ol4csum_l3l4csum,		0, 1, 0, 1, 0, 1, 1,	6,	\
		TSO_F | NOFF_F | OL3OL4CSUM_F |	L3L4CSUM_F)		\
T(tso_noff_vlan,			0, 1, 0, 1, 1, 0, 0,	6,	\
		TSO_F | NOFF_F | VLAN_F)				\
T(tso_noff_vlan_l3l4csum,		0, 1, 0, 1, 1, 0, 1,	6,	\
		TSO_F | NOFF_F | VLAN_F | L3L4CSUM_F)			\
T(tso_noff_vlan_ol3ol4csum,		0, 1, 0, 1, 1, 1, 0,	6,	\
		TSO_F | NOFF_F | VLAN_F | OL3OL4CSUM_F)			\
T(tso_noff_vlan_ol3ol4csum_l3l4csum,	0, 1, 0, 1, 1, 1, 1,	6,	\
		TSO_F | NOFF_F | VLAN_F | OL3OL4CSUM_F | L3L4CSUM_F)	\
T(tso_ts,				0, 1, 1, 0, 0, 0, 0,	8,	\
		TSO_F | TSP_F)						\
T(tso_ts_l3l4csum,			0, 1, 1, 0, 0, 0, 1,	8,	\
		TSO_F | TSP_F | L3L4CSUM_F)				\
T(tso_ts_ol3ol4csum,			0, 1, 1, 0, 0, 1, 0,	8,	\
		TSO_F | TSP_F | OL3OL4CSUM_F)				\
T(tso_ts_ol3ol4csum_l3l4csum,		0, 1, 1, 0, 0, 1, 1,	8,	\
		TSO_F | TSP_F | OL3OL4CSUM_F | L3L4CSUM_F)		\
T(tso_ts_vlan,				0, 1, 1, 0, 1, 0, 0,	8,	\
		TSO_F | TSP_F | VLAN_F)					\
T(tso_ts_vlan_l3l4csum,			0, 1, 1, 0, 1, 0, 1,	8,	\
		TSO_F | TSP_F | VLAN_F | L3L4CSUM_F)			\
T(tso_ts_vlan_ol3ol4csum,		0, 1, 1, 0, 1, 1, 0,	8,	\
		TSO_F | TSP_F | VLAN_F | OL3OL4CSUM_F)			\
T(tso_ts_vlan_ol3ol4csum_l3l4csum,	0, 1, 1, 0, 1, 1, 1,	8,	\
		TSO_F | TSP_F | VLAN_F | OL3OL4CSUM_F | L3L4CSUM_F)	\
T(tso_ts_noff,				0, 1, 1, 1, 0, 0, 0,	8,	\
		TSO_F | TSP_F | NOFF_F)					\
T(tso_ts_noff_l3l4csum,			0, 1, 1, 1, 0, 0, 1,	8,	\
		TSO_F | TSP_F | NOFF_F | L3L4CSUM_F)			\
T(tso_ts_noff_ol3ol4csum,		0, 1, 1, 1, 0, 1, 0,	8,	\
		TSO_F | TSP_F | NOFF_F | OL3OL4CSUM_F)			\
T(tso_ts_noff_ol3ol4csum_l3l4csum,	0, 1, 1, 1, 0, 1, 1,	8,	\
		TSO_F | TSP_F | NOFF_F | OL3OL4CSUM_F | L3L4CSUM_F)	\
T(tso_ts_noff_vlan,			0, 1, 1, 1, 1, 0, 0,	8,	\
		TSO_F | TSP_F | NOFF_F | VLAN_F)			\
T(tso_ts_noff_vlan_l3l4csum,		0, 1, 1, 1, 1, 0, 1,	8,	\
		TSO_F | TSP_F | NOFF_F | VLAN_F | L3L4CSUM_F)		\
T(tso_ts_noff_vlan_ol3ol4csum,		0, 1, 1, 1, 1, 1, 0,	8,	\
		TSO_F | TSP_F | NOFF_F | VLAN_F | OL3OL4CSUM_F)		\
T(tso_ts_noff_vlan_ol3ol4csum_l3l4csum,	0, 1, 1, 1, 1, 1, 1,	8,	\
		TSO_F | TSP_F | NOFF_F | VLAN_F | OL3OL4CSUM_F |	\
		L3L4CSUM_F)						\
T(sec,					1, 0, 0, 0, 0, 0, 0,	8,	\
		TX_SEC_F)						\
T(sec_l3l4csum,				1, 0, 0, 0, 0, 0, 1,	8,	\
		TX_SEC_F | L3L4CSUM_F)					\
T(sec_ol3ol4csum,			1, 0, 0, 0, 0, 1, 0,	8,	\
		TX_SEC_F | OL3OL4CSUM_F)				\
T(sec_ol3ol4csum_l3l4csum,		1, 0, 0, 0, 0, 1, 1,	8,	\
		TX_SEC_F | OL3OL4CSUM_F | L3L4CSUM_F)			\
T(sec_vlan,				1, 0, 0, 0, 1, 0, 0,	8,	\
		TX_SEC_F | VLAN_F)					\
T(sec_vlan_l3l4csum,			1, 0, 0, 0, 1, 0, 1,	8,	\
		TX_SEC_F | VLAN_F | L3L4CSUM_F)				\
T(sec_vlan_ol3ol4csum,			1, 0, 0, 0, 1, 1, 0,	8,	\
		TX_SEC_F | VLAN_F | OL3OL4CSUM_F)			\
T(sec_vlan_ol3ol4csum_l3l4csum,		1, 0, 0, 0, 1, 1, 1,	8,	\
		TX_SEC_F | VLAN_F | OL3OL4CSUM_F | L3L4CSUM_F)		\
T(sec_noff,				1, 0, 0, 1, 0, 0, 0,	8,	\
		TX_SEC_F | NOFF_F)					\
T(sec_noff_l3l4csum,			1, 0, 0, 1, 0, 0, 1,	8,	\
		TX_SEC_F | NOFF_F | L3L4CSUM_F)				\
T(sec_noff_ol3ol4csum,			1, 0, 0, 1, 0, 1, 0,	8,	\
		TX_SEC_F | NOFF_F | OL3OL4CSUM_F)			\
T(sec_noff_ol3ol4csum_l3l4csum,		1, 0, 0, 1, 0, 1, 1,	8,	\
		TX_SEC_F | NOFF_F | OL3OL4CSUM_F | L3L4CSUM_F)		\
T(sec_noff_vlan,			1, 0, 0, 1, 1, 0, 0,	8,	\
		TX_SEC_F | NOFF_F | VLAN_F)				\
T(sec_noff_vlan_l3l4csum,		1, 0, 0, 1, 1, 0, 1,	8,	\
		TX_SEC_F | NOFF_F | VLAN_F | L3L4CSUM_F)		\
T(sec_noff_vlan_ol3ol4csum,		1, 0, 0, 1, 1, 1, 0,	8,	\
		TX_SEC_F | NOFF_F | VLAN_F | OL3OL4CSUM_F)		\
T(sec_noff_vlan_ol3ol4csum_l3l4csum,	1, 0, 0, 1, 1, 1, 1,	8,	\
		TX_SEC_F | NOFF_F | VLAN_F | OL3OL4CSUM_F | L3L4CSUM_F)	\
T(sec_ts,				1, 0, 1, 0, 0, 0, 0,	8,	\
		TX_SEC_F | TSP_F)					\
T(sec_ts_l3l4csum,			1, 0, 1, 0, 0, 0, 1,	8,	\
		TX_SEC_F | TSP_F | L3L4CSUM_F)				\
T(sec_ts_ol3ol4csum,			1, 0, 1, 0, 0, 1, 0,	8,	\
		TX_SEC_F | TSP_F | OL3OL4CSUM_F)			\
T(sec_ts_ol3ol4csum_l3l4csum,		1, 0, 1, 0, 0, 1, 1,	8,	\
		TX_SEC_F | TSP_F | OL3OL4CSUM_F | L3L4CSUM_F)		\
T(sec_ts_vlan,				1, 0, 1, 0, 1, 0, 0,	8,	\
		TX_SEC_F | TSP_F | VLAN_F)				\
T(sec_ts_vlan_l3l4csum,			1, 0, 1, 0, 1, 0, 1,	8,	\
		TX_SEC_F | TSP_F | VLAN_F | L3L4CSUM_F)			\
T(sec_ts_vlan_ol3ol4csum,		1, 0, 1, 0, 1, 1, 0,	8,	\
		TX_SEC_F | TSP_F | VLAN_F | OL3OL4CSUM_F)		\
T(sec_ts_vlan_ol3ol4csum_l3l4csum,	1, 0, 1, 0, 1, 1, 1,	8,	\
		TX_SEC_F | TSP_F | VLAN_F | OL3OL4CSUM_F | L3L4CSUM_F)	\
T(sec_ts_noff,				1, 0, 1, 1, 0, 0, 0,	8,	\
		TX_SEC_F | TSP_F | NOFF_F)				\
T(sec_ts_noff_l3l4csum,			1, 0, 1, 1, 0, 0, 1,	8,	\
		TX_SEC_F | TSP_F | NOFF_F | L3L4CSUM_F)			\
T(sec_ts_noff_ol3ol4csum,		1, 0, 1, 1, 0, 1, 0,	8,	\
		TX_SEC_F | TSP_F | NOFF_F | OL3OL4CSUM_F)		\
T(sec_ts_noff_ol3ol4csum_l3l4csum,	1, 0, 1, 1, 0, 1, 1,	8,	\
		TX_SEC_F | TSP_F | NOFF_F | OL3OL4CSUM_F | L3L4CSUM_F)	\
T(sec_ts_noff_vlan,			1, 0, 1, 1, 1, 0, 0,	8,	\
		TX_SEC_F | TSP_F | NOFF_F | VLAN_F)			\
T(sec_ts_noff_vlan_l3l4csum,		1, 0, 1, 1, 1, 0, 1,	8,	\
		TX_SEC_F | TSP_F | NOFF_F | VLAN_F | L3L4CSUM_F)	\
T(sec_ts_noff_vlan_ol3ol4csum,		1, 0, 1, 1, 1, 1, 0,	8,	\
		TX_SEC_F | TSP_F | NOFF_F | VLAN_F | OL3OL4CSUM_F)	\
T(sec_ts_noff_vlan_ol3ol4csum_l3l4csum,	1, 0, 1, 1, 1, 1, 1,	8,	\
		TX_SEC_F | TSP_F | NOFF_F | VLAN_F | OL3OL4CSUM_F |	\
		L3L4CSUM_F)						\
T(sec_tso,				1, 1, 0, 0, 0, 0, 0,	8,	\
		TX_SEC_F | TSO_F)					\
T(sec_tso_l3l4csum,			1, 1, 0, 0, 0, 0, 1,	8,	\
		TX_SEC_F | TSO_F | L3L4CSUM_F)				\
T(sec_tso_ol3ol4csum,			1, 1, 0, 0, 0, 1, 0,	8,	\
		TX_SEC_F | TSO_F | OL3OL4CSUM_F)			\
T(sec_tso_ol3ol4csum_l3l4csum,		1, 1, 0, 0, 0, 1, 1,	8,	\
		TX_SEC_F | TSO_F | OL3OL4CSUM_F | L3L4CSUM_F)		\
T(sec_tso_vlan,				1, 1, 0, 0, 1, 0, 0,	8,	\
		TX_SEC_F | TSO_F | VLAN_F)				\
T(sec_tso_vlan_l3l4csum,		1, 1, 0, 0, 1, 0, 1,	8,	\
		TX_SEC_F | TSO_F | VLAN_F | L3L4CSUM_F)			\
T(sec_tso_vlan_ol3ol4csum,		1, 1, 0, 0, 1, 1, 0,	8,	\
		TX_SEC_F | TSO_F | VLAN_F | OL3OL4CSUM_F)		\
T(sec_tso_vlan_ol3ol4csum_l3l4csum,	1, 1, 0, 0, 1, 1, 1,	8,	\
		TX_SEC_F | TSO_F | VLAN_F | OL3OL4CSUM_F | L3L4CSUM_F)	\
T(sec_tso_noff,				1, 1, 0, 1, 0, 0, 0,	8,	\
		TX_SEC_F | TSO_F | NOFF_F)				\
T(sec_tso_noff_l3l4csum,		1, 1, 0, 1, 0, 0, 1,	8,	\
		TX_SEC_F | TSO_F | NOFF_F | L3L4CSUM_F)			\
T(sec_tso_noff_ol3ol4csum,		1, 1, 0, 1, 0, 1, 0,	8,	\
		TX_SEC_F | TSO_F | NOFF_F | OL3OL4CSUM_F)		\
T(sec_tso_noff_ol3ol4csum_l3l4csum,	1, 1, 0, 1, 0, 1, 1,	8,	\
		TX_SEC_F | TSO_F | NOFF_F | OL3OL4CSUM_F | L3L4CSUM_F)	\
T(sec_tso_noff_vlan,			1, 1, 0, 1, 1, 0, 0,	8,	\
		TX_SEC_F | TSO_F | NOFF_F | VLAN_F)			\
T(sec_tso_noff_vlan_l3l4csum,		1, 1, 0, 1, 1, 0, 1,	8,	\
		TX_SEC_F | TSO_F | NOFF_F | VLAN_F | L3L4CSUM_F)	\
T(sec_tso_noff_vlan_ol3ol4csum,		1, 1, 0, 1, 1, 1, 0,	8,	\
		TX_SEC_F | TSO_F | NOFF_F | VLAN_F | OL3OL4CSUM_F)	\
T(sec_tso_noff_vlan_ol3ol4csum_l3l4csum,				\
					1, 1, 0, 1, 1, 1, 1,	8,	\
		TX_SEC_F | TSO_F | NOFF_F | VLAN_F | OL3OL4CSUM_F |	\
		L3L4CSUM_F)						\
T(sec_tso_ts,				1, 1, 1, 0, 0, 0, 0,	8,	\
		TX_SEC_F | TSO_F | TSP_F)				\
T(sec_tso_ts_l3l4csum,			1, 1, 1, 0, 0, 0, 1,	8,	\
		TX_SEC_F | TSO_F | TSP_F | L3L4CSUM_F)			\
T(sec_tso_ts_ol3ol4csum,		1, 1, 1, 0, 0, 1, 0,	8,	\
		TX_SEC_F | TSO_F | TSP_F | OL3OL4CSUM_F)		\
T(sec_tso_ts_ol3ol4csum_l3l4csum,	1, 1, 1, 0, 0, 1, 1,	8,	\
		TX_SEC_F | TSO_F | TSP_F | OL3OL4CSUM_F | L3L4CSUM_F)	\
T(sec_tso_ts_vlan,			1, 1, 1, 0, 1, 0, 0,	8,	\
		TX_SEC_F | TSO_F | TSP_F | VLAN_F)			\
T(sec_tso_ts_vlan_l3l4csum,		1, 1, 1, 0, 1, 0, 1,	8,	\
		TX_SEC_F | TSO_F | TSP_F | VLAN_F | L3L4CSUM_F)		\
T(sec_tso_ts_vlan_ol3ol4csum,		1, 1, 1, 0, 1, 1, 0,	8,	\
		TX_SEC_F | TSO_F | TSP_F | VLAN_F | OL3OL4CSUM_F)	\
T(sec_tso_ts_vlan_ol3ol4csum_l3l4csum,	1, 1, 1, 0, 1, 1, 1,	8,	\
		TX_SEC_F | TSO_F | TSP_F | VLAN_F | OL3OL4CSUM_F |	\
		L3L4CSUM_F)						\
T(sec_tso_ts_noff,			1, 1, 1, 1, 0, 0, 0,	8,	\
		TX_SEC_F | TSO_F | TSP_F | NOFF_F)			\
T(sec_tso_ts_noff_l3l4csum,		1, 1, 1, 1, 0, 0, 1,	8,	\
		TX_SEC_F | TSO_F | TSP_F | NOFF_F | L3L4CSUM_F)		\
T(sec_tso_ts_noff_ol3ol4csum,		1, 1, 1, 1, 0, 1, 0,	8,	\
		TX_SEC_F | TSO_F | TSP_F | NOFF_F | OL3OL4CSUM_F)	\
T(sec_tso_ts_noff_ol3ol4csum_l3l4csum,	1, 1, 1, 1, 0, 1, 1,	8,	\
		TX_SEC_F | TSO_F | TSP_F | NOFF_F | OL3OL4CSUM_F |	\
		L3L4CSUM_F)						\
T(sec_tso_ts_noff_vlan,			1, 1, 1, 1, 1, 0, 0,	8,	\
		TX_SEC_F | TSO_F | TSP_F | NOFF_F | VLAN_F)		\
T(sec_tso_ts_noff_vlan_l3l4csum,	1, 1, 1, 1, 1, 0, 1,	8,	\
		TX_SEC_F | TSO_F | TSP_F | NOFF_F | VLAN_F | L3L4CSUM_F)\
T(sec_tso_ts_noff_vlan_ol3ol4csum,	1, 1, 1, 1, 1, 1, 0,	8,	\
		TX_SEC_F | TSO_F | TSP_F | NOFF_F | VLAN_F |		\
		OL3OL4CSUM_F)						\
T(sec_tso_ts_noff_vlan_ol3ol4csum_l3l4csum,				\
					1, 1, 1, 1, 1, 1, 1,	8,	\
		TX_SEC_F | TSO_F | TSP_F | NOFF_F | VLAN_F |		\
		OL3OL4CSUM_F | L3L4CSUM_F)
#endif /* __OTX2_TX_H__ */