1 /*
2  * Copyright (c) 2019, The Linux Foundation. All rights reserved.
3  *
4  * Permission to use, copy, modify, and/or distribute this software for any
5  * purpose with or without fee is hereby granted, provided that the above
6  * copyright notice and this permission notice appear in all copies.
7  *
8  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15  */
16 
17 #ifndef _TCL_DATA_CMD_H_
18 #define _TCL_DATA_CMD_H_
19 #if !defined(__ASSEMBLER__)
20 #endif
21 
22 #include "buffer_addr_info.h"
23 
24 // ################ START SUMMARY #################
25 //
26 //	Dword	Fields
27 //	0-1	struct buffer_addr_info buf_addr_info;
28 //	2	buf_or_ext_desc_type[0], epd[1], encap_type[3:2], encrypt_type[7:4], src_buffer_swap[8], link_meta_swap[9], tqm_no_drop[10], reserved_2a[11], search_type[13:12], addrx_en[14], addry_en[15], tcl_cmd_number[31:16]
29 //	3	data_length[15:0], ipv4_checksum_en[16], udp_over_ipv4_checksum_en[17], udp_over_ipv6_checksum_en[18], tcp_over_ipv4_checksum_en[19], tcp_over_ipv6_checksum_en[20], to_fw[21], reserved_3a[22], packet_offset[31:23]
30 //	4	buffer_timestamp[18:0], buffer_timestamp_valid[19], reserved_4a[20], hlos_tid_overwrite[21], hlos_tid[25:22], lmac_id[27:26], reserved_4b[31:28]
31 //	5	dscp_tid_table_num[5:0], search_index[25:6], cache_set_num[29:26], mesh_enable[31:30]
32 //	6	reserved_6a[19:0], ring_id[27:20], looping_count[31:28]
33 //
34 // ################ END SUMMARY #################
35 
36 #define NUM_OF_DWORDS_TCL_DATA_CMD 7
37 
38 struct tcl_data_cmd {
39     struct            buffer_addr_info                       buf_addr_info;
40              uint32_t buf_or_ext_desc_type            :  1, //[0]
41                       epd                             :  1, //[1]
42                       encap_type                      :  2, //[3:2]
43                       encrypt_type                    :  4, //[7:4]
44                       src_buffer_swap                 :  1, //[8]
45                       link_meta_swap                  :  1, //[9]
46                       tqm_no_drop                     :  1, //[10]
47                       reserved_2a                     :  1, //[11]
48                       search_type                     :  2, //[13:12]
49                       addrx_en                        :  1, //[14]
50                       addry_en                        :  1, //[15]
51                       tcl_cmd_number                  : 16; //[31:16]
52              uint32_t data_length                     : 16, //[15:0]
53                       ipv4_checksum_en                :  1, //[16]
54                       udp_over_ipv4_checksum_en       :  1, //[17]
55                       udp_over_ipv6_checksum_en       :  1, //[18]
56                       tcp_over_ipv4_checksum_en       :  1, //[19]
57                       tcp_over_ipv6_checksum_en       :  1, //[20]
58                       to_fw                           :  1, //[21]
59                       reserved_3a                     :  1, //[22]
60                       packet_offset                   :  9; //[31:23]
61              uint32_t buffer_timestamp                : 19, //[18:0]
62                       buffer_timestamp_valid          :  1, //[19]
63                       reserved_4a                     :  1, //[20]
64                       hlos_tid_overwrite              :  1, //[21]
65                       hlos_tid                        :  4, //[25:22]
66                       lmac_id                         :  2, //[27:26]
67                       reserved_4b                     :  4; //[31:28]
68              uint32_t dscp_tid_table_num              :  6, //[5:0]
69                       search_index                    : 20, //[25:6]
70                       cache_set_num                   :  4, //[29:26]
71                       mesh_enable                     :  2; //[31:30]
72              uint32_t reserved_6a                     : 20, //[19:0]
73                       ring_id                         :  8, //[27:20]
74                       looping_count                   :  4; //[31:28]
75 };
76 
77 /*
78 
79 struct buffer_addr_info buf_addr_info
80 
81 			Details of the physical address for a single buffer
82 
83 			It also contains return ownership info as well as some
84 			meta data for SW related to this buffer.
85 
86 
87 
88 			In case of Buf_or_ext_desc_type indicating
89 			'MSDU_buffer', this address indicates the start of the meta
90 			data that is preceding the actual packet data.
91 
92 			The start of the actual packet data is provided by
93 			field: Packet_offset
94 
95 buf_or_ext_desc_type
96 
97 			<enum 0 MSDU_buffer> The address points to an MSDU
98 			buffer.
99 
100 			<enum 1 extension_descriptor> The address points to an
101 			MSDU link extension descriptor
102 
103 			< legal all>
104 
105 epd
106 
107 			When this bit is set then input packet is an EPD type
108 
109 			<legal all>
110 
111 encap_type
112 
113 			Indicates the encapsulation that HW will perform:
114 
115 			<enum 0 RAW> No encapsulation
116 
117 			<enum 1 Native_WiFi>
118 
119 			<enum 2 Ethernet> Ethernet 2 (DIX)  or 802.3 (uses
120 			SNAP/LLC)
121 
122 			<enum 3 802_3> DO NOT USE. Indicate Ethernet
123 
124 
125 
126 			Used by the OLE during encapsulation.
127 
128 			<legal all>
129 
130 encrypt_type
131 
132 			Field only valid for encap_type: RAW
133 
134 
135 
136 			Indicates type of decrypt cipher used (as defined in the
137 			peer entry)
138 
139 			<enum 0 wep_40> WEP 40-bit
140 
141 			<enum 1 wep_104> WEP 104-bit
142 
143 			<enum 2 tkip_no_mic> TKIP without MIC
144 
145 			<enum 3 wep_128> WEP 128-bit
146 
147 			<enum 4 tkip_with_mic> TKIP with MIC
148 
149 			<enum 5 wapi> WAPI
150 
151 			<enum 6 aes_ccmp_128> AES CCMP 128
152 
153 			<enum 7 no_cipher> No crypto
154 
155 			<enum 8 aes_ccmp_256> AES CCMP 256
156 
157 			<enum 9 aes_gcmp_128> AES CCMP 128
158 
159 			<enum 10 aes_gcmp_256> AES CCMP 256
160 
161 			<enum 11 wapi_gcm_sm4> WAPI GCM SM4
162 
163 
164 
165 			<enum 12 wep_varied_width> DO not use... Only for higher
166 			layer modules..
167 
168 			<legal 0-12>
169 
170 src_buffer_swap
171 
172 			Treats source memory (packet buffer) organization as
173 			big-endian. The packets are read and byte swapped.
174 
175 			1'b0: Source memory is little endian
176 
177 			1'b1: Source memory is big endian
178 
179 			<legal all>
180 
181 link_meta_swap
182 
183 			Treats link descriptor and Metadata as big-endian. The
184 			link descriptor/Metadata is read and byte swapped.
185 
186 			1'b0: Memory is little endian
187 
188 			1'b1: Memory is big endian
189 
190 			<legal all>
191 
192 tqm_no_drop
193 
194 			This bit is used to stop TQM from dropping MSDUs while
195 			adding them to MSDU flows1'b1: Do not drop MSDU when any of
196 			the threshold value is met while adding MSDU in a flow1'b1:
197 			Drop MSDU when any of the threshold value is met while
198 			adding MSDU in a flow
199 
200 			<legal all>
201 
202 reserved_2a
203 
204 			<legal 0>
205 
206 search_type
207 
208 			Search type select
209 
210 
211 
212 			<enum 0 Normal_search> Address and flow search will use
213 			packet contents
214 
215 			<enum 1 Index_based_address_search> Address search will
216 
217 			<enum 2 Index_based_flow_search> Flow search will use
218 			'search_index', and address search will use packet contents
219 
220 			<legal 0-2>
221 
222 addrx_en
223 
224 			Address X search enable in ASE
225 
226 			1'b0: Search disable
227 
228 			1'b1: Search Enable
229 
230 			<legal all>
231 
232 addry_en
233 
234 			Address Y search enable in ASE
235 
236 			1'b0: Search disable
237 
238 			1'b1: Search Enable
239 
240 			<legal all>
241 
242 tcl_cmd_number
243 
244 			This number can be used by SW to track, identify and
245 			link the created commands with the command statuses
246 
247 
248 
249 			Is set to the value 'TCL_CMD_Number' of the related
250 			TCL_DATA command
251 
252 			<legal all>
253 
254 data_length
255 
256 			Valid Data length in bytes.
257 
258 
259 
260 			MSDU length in case of direct descriptor.
261 
262 			Length of link extension descriptor in case of Link
263 			extension descriptor. This is used to know the size of
264 			Metadata.
265 
266 			<legal all>
267 
268 ipv4_checksum_en
269 
270 			OLE related control
271 
272 			Enable IPv4 checksum replacement
273 
274 udp_over_ipv4_checksum_en
275 
276 			OLE related control
277 
278 			Enable UDP over IPv4 checksum replacement.  UDP checksum
279 			over IPv4 is optional for TCP/IP stacks.
280 
281 udp_over_ipv6_checksum_en
282 
283 			OLE related control
284 
285 			Enable UDP over IPv6 checksum replacement.  UDP checksum
286 			over IPv6 is mandatory for TCP/IP stacks.
287 
288 tcp_over_ipv4_checksum_en
289 
290 			OLE related control
291 
292 			Enable TCP checksum over IPv4 replacement
293 
294 tcp_over_ipv6_checksum_en
295 
296 			OLE related control
297 
298 			Enable TCP checksum over IPv6 replacement
299 
300 to_fw
301 
302 			Forward packet to FW along with classification result.
303 			The packet will not be forward to TQM when this bit is set
304 
305 
306 
307 			1'b0: Use classification result to forward the packet.
308 
309 			1'b1: Override classification result and forward packet
310 			only to FW.
311 
312 			<legal all>
313 
314 reserved_3a
315 
316 			<legal 0>
317 
318 packet_offset
319 
320 			Packet offset from Metadata in case of direct buffer
321 			descriptor. This field is valid when Buf_or_ext_desc_type is
322 			reset(= 0).
323 
324 			<legal all>
325 
326 buffer_timestamp
327 
328 			Field only valid when 'Buffer_timestamp_valid ' is set.
329 
330 
331 
332 			Frame system entrance timestamp. The timestamp is
333 			related to the global system timer
334 
335 
336 
337 			Generally the first module (SW, TCL or TQM). that sees
338 			this frame and this timestamp field is not valid, shall fill
339 			in this field.
340 
341 
342 
343 			Timestamp in units of 1024 us
344 
345 buffer_timestamp_valid
346 
347 			When set, the Buffer_timestamp field contains valid
348 			info.
349 
350 reserved_4a
351 
352 			<legal 0>
353 
354 hlos_tid_overwrite
355 
356 			When set, TCL shall ignore the IP DSCP and VLAN PCP
357 			fields and use HLOS_TID as the final TID. Otherwise TCL
358 			shall consider the DSCP and PCP fields as well as HLOS_TID
359 			and choose a final TID based on the configured priority
360 
361 			<legal all>
362 
363 hlos_tid
364 
365 			HLOS MSDU priority
366 
367 
368 
369 			Field is used when HLOS_TID_overwrite is set.
370 
371 
372 
373 			Field is also used when HLOS_TID_overwrite is not set
374 			and DSCP/PCP is not available in the packet
375 
376 			<legal all>
377 
378 lmac_id
379 
380 			TCL uses this LMAC_ID in address search, i.e, while
381 			finding matching entry for the packet in AST corresponding
382 			to given LMAC_ID
383 
384 			If LMAC ID is all 1s (=> value 3), it indicates wildcard
385 			match for any MAC
386 
387 			<legal 0-3>
388 
389 reserved_4b
390 
391 			<legal 0>
392 
393 dscp_tid_table_num
394 
395 			DSCP to TID mapping table number that need to be used
396 			for the MSDU, should be specified using this field
397 
398 			<legal all>
399 
400 search_index
401 
402 			The index that will be used for index based address or
403 			flow search. The field is valid when 'search_type' is  1 or
404 			2.
405 
406 			<legal all>
407 
408 cache_set_num
409 
410 			Cache set number that should be used to cache the index
411 			based search results, for address and flow search. This
412 			value should be equal to LSB four bits of the hash value of
413 			match data, in case of search index points to an entry which
414 			may be used in content based search also. The value can be
415 			anything when the entry pointed by search index will not be
416 			used for content based search.
417 
418 			<legal all>
419 
420 mesh_enable
421 
422 			If set to a non-zero value:
423 
424 			* For raw WiFi frames, this indicates transmission to a
425 			mesh STA, enabling the interpretation of the 'Mesh Control
426 			Present' bit (bit 8) of QoS Control (otherwise this bit is
427 			ignored). The interpretation of the A-MSDU 'Length' field is
428 			decided by the e-numerations below.
429 
430 			* For native WiFi frames, this indicates that a 'Mesh
431 			Control' field is present between the header and the LLC.
432 			The three non-zero values are interchangeable.
433 
434 
435 
436 			<enum 0 MESH_DISABLE>
437 
438 			<enum 1 MESH_Q2Q> A-MSDU 'Length' is big endian and
439 			includes the length of Mesh Control.
440 
441 			<enum 2 MESH_11S_BE> A-MSDU 'Length' is big endian and
442 			excludes the length of Mesh Control.
443 
444 			<enum 3 MESH_11S_LE> A-MSDU 'Length' is little endian
445 			and excludes the length of Mesh Control. This is
446 			802.11s-compliant.
447 
448 reserved_6a
449 
450 			<legal 0>
451 
452 ring_id
453 
454 			The buffer pointer ring ID.
455 
456 			0 refers to the IDLE ring
457 
458 			1 - N refers to other rings
459 
460 
461 
462 			Helps with debugging when dumping ring contents.
463 
464 			<legal all>
465 
466 looping_count
467 
468 			A count value that indicates the number of times the
469 			producer of entries into the Ring has looped around the
470 			ring.
471 
472 			At initialization time, this value is set to 0. On the
473 			first loop, this value is set to 1. After the max value is
474 			reached allowed by the number of bits for this field, the
475 			count value continues with 0 again.
476 
477 
478 
479 			In case SW is the consumer of the ring entries, it can
480 			use this field to figure out up to where the producer of
481 			entries has created new entries. This eliminates the need to
482 			check where the head pointer' of the ring is located once
483 			the SW starts processing an interrupt indicating that new
484 			entries have been put into this ring...
485 
486 
487 
488 			Also note that SW if it wants only needs to look at the
489 			LSB bit of this count value.
490 
491 			<legal all>
492 */
493 
494 
495  /* EXTERNAL REFERENCE : struct buffer_addr_info buf_addr_info */
496 
497 
498 /* Description		TCL_DATA_CMD_0_BUF_ADDR_INFO_BUFFER_ADDR_31_0
499 
500 			Address (lower 32 bits) of the MSDU buffer OR
501 			MSDU_EXTENSION descriptor OR Link Descriptor
502 
503 
504 
505 			In case of 'NULL' pointer, this field is set to 0
506 
507 			<legal all>
508 */
509 #define TCL_DATA_CMD_0_BUF_ADDR_INFO_BUFFER_ADDR_31_0_OFFSET         0x00000000
510 #define TCL_DATA_CMD_0_BUF_ADDR_INFO_BUFFER_ADDR_31_0_LSB            0
511 #define TCL_DATA_CMD_0_BUF_ADDR_INFO_BUFFER_ADDR_31_0_MASK           0xffffffff
512 
513 /* Description		TCL_DATA_CMD_1_BUF_ADDR_INFO_BUFFER_ADDR_39_32
514 
515 			Address (upper 8 bits) of the MSDU buffer OR
516 			MSDU_EXTENSION descriptor OR Link Descriptor
517 
518 
519 
520 			In case of 'NULL' pointer, this field is set to 0
521 
522 			<legal all>
523 */
524 #define TCL_DATA_CMD_1_BUF_ADDR_INFO_BUFFER_ADDR_39_32_OFFSET        0x00000004
525 #define TCL_DATA_CMD_1_BUF_ADDR_INFO_BUFFER_ADDR_39_32_LSB           0
526 #define TCL_DATA_CMD_1_BUF_ADDR_INFO_BUFFER_ADDR_39_32_MASK          0x000000ff
527 
528 /* Description		TCL_DATA_CMD_1_BUF_ADDR_INFO_RETURN_BUFFER_MANAGER
529 
530 			Consumer: WBM
531 
532 			Producer: SW/FW
533 
534 
535 
536 			In case of 'NULL' pointer, this field is set to 0
537 
538 
539 
540 			Indicates to which buffer manager the buffer OR
541 			MSDU_EXTENSION descriptor OR link descriptor that is being
542 			pointed to shall be returned after the frame has been
543 			processed. It is used by WBM for routing purposes.
544 
545 
546 
547 			<enum 0 WBM_IDLE_BUF_LIST> This buffer shall be returned
548 			to the WMB buffer idle list
549 
550 			<enum 1 WBM_IDLE_DESC_LIST> This buffer shall be
551 			returned to the WMB idle link descriptor idle list
552 
553 			<enum 2 FW_BM> This buffer shall be returned to the FW
554 
555 			<enum 3 SW0_BM> This buffer shall be returned to the SW,
556 			ring 0
557 
558 			<enum 4 SW1_BM> This buffer shall be returned to the SW,
559 			ring 1
560 
561 			<enum 5 SW2_BM> This buffer shall be returned to the SW,
562 			ring 2
563 
564 			<enum 6 SW3_BM> This buffer shall be returned to the SW,
565 			ring 3
566 
567 			<enum 7 SW4_BM> This buffer shall be returned to the SW,
568 			ring 4
569 
570 
571 
572 			<legal all>
573 */
574 #define TCL_DATA_CMD_1_BUF_ADDR_INFO_RETURN_BUFFER_MANAGER_OFFSET    0x00000004
575 #define TCL_DATA_CMD_1_BUF_ADDR_INFO_RETURN_BUFFER_MANAGER_LSB       8
576 #define TCL_DATA_CMD_1_BUF_ADDR_INFO_RETURN_BUFFER_MANAGER_MASK      0x00000700
577 
578 /* Description		TCL_DATA_CMD_1_BUF_ADDR_INFO_SW_BUFFER_COOKIE
579 
580 			Cookie field exclusively used by SW.
581 
582 
583 
584 			In case of 'NULL' pointer, this field is set to 0
585 
586 
587 
588 			HW ignores the contents, accept that it passes the
589 			programmed value on to other descriptors together with the
590 			physical address
591 
592 
593 
594 			Field can be used by SW to for example associate the
595 			buffers physical address with the virtual address
596 
597 			The bit definitions as used by SW are within SW HLD
598 			specification
599 
600 
601 
602 			NOTE:
603 
604 			The three most significant bits can have a special
605 			meaning in case this struct is embedded in a TX_MPDU_DETAILS
606 			STRUCT, and field transmit_bw_restriction is set
607 
608 
609 
610 			In case of NON punctured transmission:
611 
612 			Sw_buffer_cookie[20:19] = 2'b00: 20 MHz TX only
613 
614 			Sw_buffer_cookie[20:19] = 2'b01: 40 MHz TX only
615 
616 			Sw_buffer_cookie[20:19] = 2'b10: 80 MHz TX only
617 
618 			Sw_buffer_cookie[20:19] = 2'b11: 160 MHz TX only
619 
620 
621 
622 			In case of punctured transmission:
623 
624 			Sw_buffer_cookie[20:18] = 3'b000: pattern 0 only
625 
626 			Sw_buffer_cookie[20:18] = 3'b001: pattern 1 only
627 
628 			Sw_buffer_cookie[20:18] = 3'b010: pattern 2 only
629 
630 			Sw_buffer_cookie[20:18] = 3'b011: pattern 3 only
631 
632 			Sw_buffer_cookie[20:18] = 3'b100: pattern 4 only
633 
634 			Sw_buffer_cookie[20:18] = 3'b101: pattern 5 only
635 
636 			Sw_buffer_cookie[20:18] = 3'b110: pattern 6 only
637 
638 			Sw_buffer_cookie[20:18] = 3'b111: pattern 7 only
639 
640 
641 
642 			Note: a punctured transmission is indicated by the
643 			presence of TLV TX_PUNCTURE_SETUP embedded in the scheduler
644 			TLV
645 
646 
647 
648 			<legal all>
649 */
650 #define TCL_DATA_CMD_1_BUF_ADDR_INFO_SW_BUFFER_COOKIE_OFFSET         0x00000004
651 #define TCL_DATA_CMD_1_BUF_ADDR_INFO_SW_BUFFER_COOKIE_LSB            11
652 #define TCL_DATA_CMD_1_BUF_ADDR_INFO_SW_BUFFER_COOKIE_MASK           0xfffff800
653 
654 /* Description		TCL_DATA_CMD_2_BUF_OR_EXT_DESC_TYPE
655 
656 			<enum 0 MSDU_buffer> The address points to an MSDU
657 			buffer.
658 
659 			<enum 1 extension_descriptor> The address points to an
660 			MSDU link extension descriptor
661 
662 			< legal all>
663 */
664 #define TCL_DATA_CMD_2_BUF_OR_EXT_DESC_TYPE_OFFSET                   0x00000008
665 #define TCL_DATA_CMD_2_BUF_OR_EXT_DESC_TYPE_LSB                      0
666 #define TCL_DATA_CMD_2_BUF_OR_EXT_DESC_TYPE_MASK                     0x00000001
667 
668 /* Description		TCL_DATA_CMD_2_EPD
669 
670 			When this bit is set then input packet is an EPD type
671 
672 			<legal all>
673 */
674 #define TCL_DATA_CMD_2_EPD_OFFSET                                    0x00000008
675 #define TCL_DATA_CMD_2_EPD_LSB                                       1
676 #define TCL_DATA_CMD_2_EPD_MASK                                      0x00000002
677 
678 /* Description		TCL_DATA_CMD_2_ENCAP_TYPE
679 
680 			Indicates the encapsulation that HW will perform:
681 
682 			<enum 0 RAW> No encapsulation
683 
684 			<enum 1 Native_WiFi>
685 
686 			<enum 2 Ethernet> Ethernet 2 (DIX)  or 802.3 (uses
687 			SNAP/LLC)
688 
689 			<enum 3 802_3> DO NOT USE. Indicate Ethernet
690 
691 
692 
693 			Used by the OLE during encapsulation.
694 
695 			<legal all>
696 */
697 #define TCL_DATA_CMD_2_ENCAP_TYPE_OFFSET                             0x00000008
698 #define TCL_DATA_CMD_2_ENCAP_TYPE_LSB                                2
699 #define TCL_DATA_CMD_2_ENCAP_TYPE_MASK                               0x0000000c
700 
701 /* Description		TCL_DATA_CMD_2_ENCRYPT_TYPE
702 
703 			Field only valid for encap_type: RAW
704 
705 
706 
707 			Indicates type of decrypt cipher used (as defined in the
708 			peer entry)
709 
710 			<enum 0 wep_40> WEP 40-bit
711 
712 			<enum 1 wep_104> WEP 104-bit
713 
714 			<enum 2 tkip_no_mic> TKIP without MIC
715 
716 			<enum 3 wep_128> WEP 128-bit
717 
718 			<enum 4 tkip_with_mic> TKIP with MIC
719 
720 			<enum 5 wapi> WAPI
721 
722 			<enum 6 aes_ccmp_128> AES CCMP 128
723 
724 			<enum 7 no_cipher> No crypto
725 
726 			<enum 8 aes_ccmp_256> AES CCMP 256
727 
728 			<enum 9 aes_gcmp_128> AES CCMP 128
729 
730 			<enum 10 aes_gcmp_256> AES CCMP 256
731 
732 			<enum 11 wapi_gcm_sm4> WAPI GCM SM4
733 
734 
735 
736 			<enum 12 wep_varied_width> DO not use... Only for higher
737 			layer modules..
738 
739 			<legal 0-12>
740 */
741 #define TCL_DATA_CMD_2_ENCRYPT_TYPE_OFFSET                           0x00000008
742 #define TCL_DATA_CMD_2_ENCRYPT_TYPE_LSB                              4
743 #define TCL_DATA_CMD_2_ENCRYPT_TYPE_MASK                             0x000000f0
744 
745 /* Description		TCL_DATA_CMD_2_SRC_BUFFER_SWAP
746 
747 			Treats source memory (packet buffer) organization as
748 			big-endian. The packets are read and byte swapped.
749 
750 			1'b0: Source memory is little endian
751 
752 			1'b1: Source memory is big endian
753 
754 			<legal all>
755 */
756 #define TCL_DATA_CMD_2_SRC_BUFFER_SWAP_OFFSET                        0x00000008
757 #define TCL_DATA_CMD_2_SRC_BUFFER_SWAP_LSB                           8
758 #define TCL_DATA_CMD_2_SRC_BUFFER_SWAP_MASK                          0x00000100
759 
760 /* Description		TCL_DATA_CMD_2_LINK_META_SWAP
761 
762 			Treats link descriptor and Metadata as big-endian. The
763 			link descriptor/Metadata is read and byte swapped.
764 
765 			1'b0: Memory is little endian
766 
767 			1'b1: Memory is big endian
768 
769 			<legal all>
770 */
771 #define TCL_DATA_CMD_2_LINK_META_SWAP_OFFSET                         0x00000008
772 #define TCL_DATA_CMD_2_LINK_META_SWAP_LSB                            9
773 #define TCL_DATA_CMD_2_LINK_META_SWAP_MASK                           0x00000200
774 
775 /* Description		TCL_DATA_CMD_2_TQM_NO_DROP
776 
777 			This bit is used to stop TQM from dropping MSDUs while
778 			adding them to MSDU flows1'b1: Do not drop MSDU when any of
779 			the threshold value is met while adding MSDU in a flow1'b1:
780 			Drop MSDU when any of the threshold value is met while
781 			adding MSDU in a flow
782 
783 			<legal all>
784 */
785 #define TCL_DATA_CMD_2_TQM_NO_DROP_OFFSET                            0x00000008
786 #define TCL_DATA_CMD_2_TQM_NO_DROP_LSB                               10
787 #define TCL_DATA_CMD_2_TQM_NO_DROP_MASK                              0x00000400
788 
789 /* Description		TCL_DATA_CMD_2_RESERVED_2A
790 
791 			<legal 0>
792 */
793 #define TCL_DATA_CMD_2_RESERVED_2A_OFFSET                            0x00000008
794 #define TCL_DATA_CMD_2_RESERVED_2A_LSB                               11
795 #define TCL_DATA_CMD_2_RESERVED_2A_MASK                              0x00000800
796 
797 /* Description		TCL_DATA_CMD_2_SEARCH_TYPE
798 
799 			Search type select
800 
801 
802 
803 			<enum 0 Normal_search> Address and flow search will use
804 			packet contents
805 
806 			<enum 1 Index_based_address_search> Address search will
807 
808 			<enum 2 Index_based_flow_search> Flow search will use
809 			'search_index', and address search will use packet contents
810 
811 			<legal 0-2>
812 */
813 #define TCL_DATA_CMD_2_SEARCH_TYPE_OFFSET                            0x00000008
814 #define TCL_DATA_CMD_2_SEARCH_TYPE_LSB                               12
815 #define TCL_DATA_CMD_2_SEARCH_TYPE_MASK                              0x00003000
816 
817 /* Description		TCL_DATA_CMD_2_ADDRX_EN
818 
819 			Address X search enable in ASE
820 
821 			1'b0: Search disable
822 
823 			1'b1: Search Enable
824 
825 			<legal all>
826 */
827 #define TCL_DATA_CMD_2_ADDRX_EN_OFFSET                               0x00000008
828 #define TCL_DATA_CMD_2_ADDRX_EN_LSB                                  14
829 #define TCL_DATA_CMD_2_ADDRX_EN_MASK                                 0x00004000
830 
831 /* Description		TCL_DATA_CMD_2_ADDRY_EN
832 
833 			Address Y search enable in ASE
834 
835 			1'b0: Search disable
836 
837 			1'b1: Search Enable
838 
839 			<legal all>
840 */
841 #define TCL_DATA_CMD_2_ADDRY_EN_OFFSET                               0x00000008
842 #define TCL_DATA_CMD_2_ADDRY_EN_LSB                                  15
843 #define TCL_DATA_CMD_2_ADDRY_EN_MASK                                 0x00008000
844 
845 /* Description		TCL_DATA_CMD_2_TCL_CMD_NUMBER
846 
847 			This number can be used by SW to track, identify and
848 			link the created commands with the command statuses
849 
850 
851 
852 			Is set to the value 'TCL_CMD_Number' of the related
853 			TCL_DATA command
854 
855 			<legal all>
856 */
857 #define TCL_DATA_CMD_2_TCL_CMD_NUMBER_OFFSET                         0x00000008
858 #define TCL_DATA_CMD_2_TCL_CMD_NUMBER_LSB                            16
859 #define TCL_DATA_CMD_2_TCL_CMD_NUMBER_MASK                           0xffff0000
860 
861 /* Description		TCL_DATA_CMD_3_DATA_LENGTH
862 
863 			Valid Data length in bytes.
864 
865 
866 
867 			MSDU length in case of direct descriptor.
868 
869 			Length of link extension descriptor in case of Link
870 			extension descriptor. This is used to know the size of
871 			Metadata.
872 
873 			<legal all>
874 */
875 #define TCL_DATA_CMD_3_DATA_LENGTH_OFFSET                            0x0000000c
876 #define TCL_DATA_CMD_3_DATA_LENGTH_LSB                               0
877 #define TCL_DATA_CMD_3_DATA_LENGTH_MASK                              0x0000ffff
878 
879 /* Description		TCL_DATA_CMD_3_IPV4_CHECKSUM_EN
880 
881 			OLE related control
882 
883 			Enable IPv4 checksum replacement
884 */
885 #define TCL_DATA_CMD_3_IPV4_CHECKSUM_EN_OFFSET                       0x0000000c
886 #define TCL_DATA_CMD_3_IPV4_CHECKSUM_EN_LSB                          16
887 #define TCL_DATA_CMD_3_IPV4_CHECKSUM_EN_MASK                         0x00010000
888 
889 /* Description		TCL_DATA_CMD_3_UDP_OVER_IPV4_CHECKSUM_EN
890 
891 			OLE related control
892 
893 			Enable UDP over IPv4 checksum replacement.  UDP checksum
894 			over IPv4 is optional for TCP/IP stacks.
895 */
896 #define TCL_DATA_CMD_3_UDP_OVER_IPV4_CHECKSUM_EN_OFFSET              0x0000000c
897 #define TCL_DATA_CMD_3_UDP_OVER_IPV4_CHECKSUM_EN_LSB                 17
898 #define TCL_DATA_CMD_3_UDP_OVER_IPV4_CHECKSUM_EN_MASK                0x00020000
899 
900 /* Description		TCL_DATA_CMD_3_UDP_OVER_IPV6_CHECKSUM_EN
901 
902 			OLE related control
903 
904 			Enable UDP over IPv6 checksum replacement.  UDP checksum
905 			over IPv6 is mandatory for TCP/IP stacks.
906 */
907 #define TCL_DATA_CMD_3_UDP_OVER_IPV6_CHECKSUM_EN_OFFSET              0x0000000c
908 #define TCL_DATA_CMD_3_UDP_OVER_IPV6_CHECKSUM_EN_LSB                 18
909 #define TCL_DATA_CMD_3_UDP_OVER_IPV6_CHECKSUM_EN_MASK                0x00040000
910 
911 /* Description		TCL_DATA_CMD_3_TCP_OVER_IPV4_CHECKSUM_EN
912 
913 			OLE related control
914 
915 			Enable TCP checksum over IPv4 replacement
916 */
917 #define TCL_DATA_CMD_3_TCP_OVER_IPV4_CHECKSUM_EN_OFFSET              0x0000000c
918 #define TCL_DATA_CMD_3_TCP_OVER_IPV4_CHECKSUM_EN_LSB                 19
919 #define TCL_DATA_CMD_3_TCP_OVER_IPV4_CHECKSUM_EN_MASK                0x00080000
920 
921 /* Description		TCL_DATA_CMD_3_TCP_OVER_IPV6_CHECKSUM_EN
922 
923 			OLE related control
924 
925 			Enable TCP checksum over IPv6 replacement
926 */
927 #define TCL_DATA_CMD_3_TCP_OVER_IPV6_CHECKSUM_EN_OFFSET              0x0000000c
928 #define TCL_DATA_CMD_3_TCP_OVER_IPV6_CHECKSUM_EN_LSB                 20
929 #define TCL_DATA_CMD_3_TCP_OVER_IPV6_CHECKSUM_EN_MASK                0x00100000
930 
931 /* Description		TCL_DATA_CMD_3_TO_FW
932 
933 			Forward packet to FW along with classification result.
934 			The packet will not be forward to TQM when this bit is set
935 
936 
937 
938 			1'b0: Use classification result to forward the packet.
939 
940 			1'b1: Override classification result and forward packet
941 			only to FW.
942 
943 			<legal all>
944 */
945 #define TCL_DATA_CMD_3_TO_FW_OFFSET                                  0x0000000c
946 #define TCL_DATA_CMD_3_TO_FW_LSB                                     21
947 #define TCL_DATA_CMD_3_TO_FW_MASK                                    0x00200000
948 
949 /* Description		TCL_DATA_CMD_3_RESERVED_3A
950 
951 			<legal 0>
952 */
953 #define TCL_DATA_CMD_3_RESERVED_3A_OFFSET                            0x0000000c
954 #define TCL_DATA_CMD_3_RESERVED_3A_LSB                               22
955 #define TCL_DATA_CMD_3_RESERVED_3A_MASK                              0x00400000
956 
957 /* Description		TCL_DATA_CMD_3_PACKET_OFFSET
958 
959 			Packet offset from Metadata in case of direct buffer
960 			descriptor. This field is valid when Buf_or_ext_desc_type is
961 			reset(= 0).
962 
963 			<legal all>
964 */
965 #define TCL_DATA_CMD_3_PACKET_OFFSET_OFFSET                          0x0000000c
966 #define TCL_DATA_CMD_3_PACKET_OFFSET_LSB                             23
967 #define TCL_DATA_CMD_3_PACKET_OFFSET_MASK                            0xff800000
968 
969 /* Description		TCL_DATA_CMD_4_BUFFER_TIMESTAMP
970 
971 			Field only valid when 'Buffer_timestamp_valid ' is set.
972 
973 
974 
975 			Frame system entrance timestamp. The timestamp is
976 			related to the global system timer
977 
978 
979 
980 			Generally the first module (SW, TCL or TQM). that sees
981 			this frame and this timestamp field is not valid, shall fill
982 			in this field.
983 
984 
985 
986 			Timestamp in units of 1024 us
987 */
988 #define TCL_DATA_CMD_4_BUFFER_TIMESTAMP_OFFSET                       0x00000010
989 #define TCL_DATA_CMD_4_BUFFER_TIMESTAMP_LSB                          0
990 #define TCL_DATA_CMD_4_BUFFER_TIMESTAMP_MASK                         0x0007ffff
991 
992 /* Description		TCL_DATA_CMD_4_BUFFER_TIMESTAMP_VALID
993 
994 			When set, the Buffer_timestamp field contains valid
995 			info.
996 */
997 #define TCL_DATA_CMD_4_BUFFER_TIMESTAMP_VALID_OFFSET                 0x00000010
998 #define TCL_DATA_CMD_4_BUFFER_TIMESTAMP_VALID_LSB                    19
999 #define TCL_DATA_CMD_4_BUFFER_TIMESTAMP_VALID_MASK                   0x00080000
1000 
1001 /* Description		TCL_DATA_CMD_4_RESERVED_4A
1002 
1003 			<legal 0>
1004 */
1005 #define TCL_DATA_CMD_4_RESERVED_4A_OFFSET                            0x00000010
1006 #define TCL_DATA_CMD_4_RESERVED_4A_LSB                               20
1007 #define TCL_DATA_CMD_4_RESERVED_4A_MASK                              0x00100000
1008 
1009 /* Description		TCL_DATA_CMD_4_HLOS_TID_OVERWRITE
1010 
1011 			When set, TCL shall ignore the IP DSCP and VLAN PCP
1012 			fields and use HLOS_TID as the final TID. Otherwise TCL
1013 			shall consider the DSCP and PCP fields as well as HLOS_TID
1014 			and choose a final TID based on the configured priority
1015 
1016 			<legal all>
1017 */
1018 #define TCL_DATA_CMD_4_HLOS_TID_OVERWRITE_OFFSET                     0x00000010
1019 #define TCL_DATA_CMD_4_HLOS_TID_OVERWRITE_LSB                        21
1020 #define TCL_DATA_CMD_4_HLOS_TID_OVERWRITE_MASK                       0x00200000
1021 
1022 /* Description		TCL_DATA_CMD_4_HLOS_TID
1023 
1024 			HLOS MSDU priority
1025 
1026 
1027 
1028 			Field is used when HLOS_TID_overwrite is set.
1029 
1030 
1031 
1032 			Field is also used when HLOS_TID_overwrite is not set
1033 			and DSCP/PCP is not available in the packet
1034 
1035 			<legal all>
1036 */
1037 #define TCL_DATA_CMD_4_HLOS_TID_OFFSET                               0x00000010
1038 #define TCL_DATA_CMD_4_HLOS_TID_LSB                                  22
1039 #define TCL_DATA_CMD_4_HLOS_TID_MASK                                 0x03c00000
1040 
1041 /* Description		TCL_DATA_CMD_4_LMAC_ID
1042 
1043 			TCL uses this LMAC_ID in address search, i.e, while
1044 			finding matching entry for the packet in AST corresponding
1045 			to given LMAC_ID
1046 
1047 			If LMAC ID is all 1s (=> value 3), it indicates wildcard
1048 			match for any MAC
1049 
1050 			<legal 0-3>
1051 */
1052 #define TCL_DATA_CMD_4_LMAC_ID_OFFSET                                0x00000010
1053 #define TCL_DATA_CMD_4_LMAC_ID_LSB                                   26
1054 #define TCL_DATA_CMD_4_LMAC_ID_MASK                                  0x0c000000
1055 
1056 /* Description		TCL_DATA_CMD_4_RESERVED_4B
1057 
1058 			<legal 0>
1059 */
1060 #define TCL_DATA_CMD_4_RESERVED_4B_OFFSET                            0x00000010
1061 #define TCL_DATA_CMD_4_RESERVED_4B_LSB                               28
1062 #define TCL_DATA_CMD_4_RESERVED_4B_MASK                              0xf0000000
1063 
1064 /* Description		TCL_DATA_CMD_5_DSCP_TID_TABLE_NUM
1065 
1066 			DSCP to TID mapping table number that need to be used
1067 			for the MSDU, should be specified using this field
1068 
1069 			<legal all>
1070 */
1071 #define TCL_DATA_CMD_5_DSCP_TID_TABLE_NUM_OFFSET                     0x00000014
1072 #define TCL_DATA_CMD_5_DSCP_TID_TABLE_NUM_LSB                        0
1073 #define TCL_DATA_CMD_5_DSCP_TID_TABLE_NUM_MASK                       0x0000003f
1074 
1075 /* Description		TCL_DATA_CMD_5_SEARCH_INDEX
1076 
1077 			The index that will be used for index based address or
1078 			flow search. The field is valid when 'search_type' is  1 or
1079 			2.
1080 
1081 			<legal all>
1082 */
1083 #define TCL_DATA_CMD_5_SEARCH_INDEX_OFFSET                           0x00000014
1084 #define TCL_DATA_CMD_5_SEARCH_INDEX_LSB                              6
1085 #define TCL_DATA_CMD_5_SEARCH_INDEX_MASK                             0x03ffffc0
1086 
1087 /* Description		TCL_DATA_CMD_5_CACHE_SET_NUM
1088 
1089 			Cache set number that should be used to cache the index
1090 			based search results, for address and flow search. This
1091 			value should be equal to LSB four bits of the hash value of
1092 			match data, in case of search index points to an entry which
1093 			may be used in content based search also. The value can be
1094 			anything when the entry pointed by search index will not be
1095 			used for content based search.
1096 
1097 			<legal all>
1098 */
1099 #define TCL_DATA_CMD_5_CACHE_SET_NUM_OFFSET                          0x00000014
1100 #define TCL_DATA_CMD_5_CACHE_SET_NUM_LSB                             26
1101 #define TCL_DATA_CMD_5_CACHE_SET_NUM_MASK                            0x3c000000
1102 
1103 /* Description		TCL_DATA_CMD_5_MESH_ENABLE
1104 
1105 			If set to a non-zero value:
1106 
1107 			* For raw WiFi frames, this indicates transmission to a
1108 			mesh STA, enabling the interpretation of the 'Mesh Control
1109 			Present' bit (bit 8) of QoS Control (otherwise this bit is
1110 			ignored). The interpretation of the A-MSDU 'Length' field is
1111 			decided by the e-numerations below.
1112 
1113 			* For native WiFi frames, this indicates that a 'Mesh
1114 			Control' field is present between the header and the LLC.
1115 			The three non-zero values are interchangeable.
1116 
1117 
1118 
1119 			<enum 0 MESH_DISABLE>
1120 
1121 			<enum 1 MESH_Q2Q> A-MSDU 'Length' is big endian and
1122 			includes the length of Mesh Control.
1123 
1124 			<enum 2 MESH_11S_BE> A-MSDU 'Length' is big endian and
1125 			excludes the length of Mesh Control.
1126 
1127 			<enum 3 MESH_11S_LE> A-MSDU 'Length' is little endian
1128 			and excludes the length of Mesh Control. This is
1129 			802.11s-compliant.
1130 */
1131 #define TCL_DATA_CMD_5_MESH_ENABLE_OFFSET                            0x00000014
1132 #define TCL_DATA_CMD_5_MESH_ENABLE_LSB                               30
1133 #define TCL_DATA_CMD_5_MESH_ENABLE_MASK                              0xc0000000
1134 
1135 /* Description		TCL_DATA_CMD_6_RESERVED_6A
1136 
1137 			<legal 0>
1138 */
1139 #define TCL_DATA_CMD_6_RESERVED_6A_OFFSET                            0x00000018
1140 #define TCL_DATA_CMD_6_RESERVED_6A_LSB                               0
1141 #define TCL_DATA_CMD_6_RESERVED_6A_MASK                              0x000fffff
1142 
1143 /* Description		TCL_DATA_CMD_6_RING_ID
1144 
1145 			The buffer pointer ring ID.
1146 
1147 			0 refers to the IDLE ring
1148 
1149 			1 - N refers to other rings
1150 
1151 
1152 
1153 			Helps with debugging when dumping ring contents.
1154 
1155 			<legal all>
1156 */
1157 #define TCL_DATA_CMD_6_RING_ID_OFFSET                                0x00000018
1158 #define TCL_DATA_CMD_6_RING_ID_LSB                                   20
1159 #define TCL_DATA_CMD_6_RING_ID_MASK                                  0x0ff00000
1160 
1161 /* Description		TCL_DATA_CMD_6_LOOPING_COUNT
1162 
1163 			A count value that indicates the number of times the
1164 			producer of entries into the Ring has looped around the
1165 			ring.
1166 
1167 			At initialization time, this value is set to 0. On the
1168 			first loop, this value is set to 1. After the max value is
1169 			reached allowed by the number of bits for this field, the
1170 			count value continues with 0 again.
1171 
1172 
1173 
1174 			In case SW is the consumer of the ring entries, it can
1175 			use this field to figure out up to where the producer of
1176 			entries has created new entries. This eliminates the need to
1177 			check where the head pointer' of the ring is located once
1178 			the SW starts processing an interrupt indicating that new
1179 			entries have been put into this ring...
1180 
1181 
1182 
1183 			Also note that SW if it wants only needs to look at the
1184 			LSB bit of this count value.
1185 
1186 			<legal all>
1187 */
1188 #define TCL_DATA_CMD_6_LOOPING_COUNT_OFFSET                          0x00000018
1189 #define TCL_DATA_CMD_6_LOOPING_COUNT_LSB                             28
1190 #define TCL_DATA_CMD_6_LOOPING_COUNT_MASK                            0xf0000000
1191 
1192 
1193 #endif // _TCL_DATA_CMD_H_
1194