1 
2 /*
3  * Copyright (c) 2021 Qualcomm Innovation Center, Inc. All rights reserved.
4  *
5  * Permission to use, copy, modify, and/or distribute this software for
6  * any purpose with or without fee is hereby granted, provided that the
7  * above copyright notice and this permission notice appear in all
8  * copies.
9  *
10  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
11  * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
12  * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
13  * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
14  * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
15  * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
16  * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
17  * PERFORMANCE OF THIS SOFTWARE.
18  */
19 
20 
21 
22 
23 
24 
25 
26 
27 #ifndef _TLV_HDR_H_
28 #define _TLV_HDR_H_
29 #if !defined(__ASSEMBLER__)
30 #endif
31 
32 #define _TLV_USERID_WIDTH_      6
33 #define _TLV_DATA_WIDTH_        32
34 #define _TLV_TAG_WIDTH_         9
35 
36 #define _TLV_MRV_EN_LEN_WIDTH_  9
37 #define _TLV_MRV_DIS_LEN_WIDTH_ 12
38 
39 #define _TLV_16_DATA_WIDTH_     16
40 #define _TLV_16_TAG_WIDTH_      5
41 #define _TLV_16_LEN_WIDTH_      4
42 #define _TLV_CTAG_WIDTH_        5
43 #define _TLV_44_DATA_WIDTH_     44
44 #define _TLV_64_DATA_WIDTH_     64
45 #define _TLV_76_DATA_WIDTH_     64
46 #define _TLV_CDATA_WIDTH_       32
47 #define _TLV_CDATA_76_WIDTH_    64
48 
49 struct tlv_usr_16_tlword_t {
50 	   uint16_t             tlv_cflg_reserved   :   1,
51 				tlv_tag             :   _TLV_16_TAG_WIDTH_,
52 				tlv_len             :   _TLV_16_LEN_WIDTH_,
53 				tlv_usrid           :   _TLV_USERID_WIDTH_;
54 };
55 
56 struct tlv_16_tlword_t {
57 	   uint16_t             tlv_cflg_reserved   :   1,
58 				tlv_len             :   _TLV_16_LEN_WIDTH_,
59 				tlv_tag             :   _TLV_16_TAG_WIDTH_,
60 				tlv_reserved        :   6;
61 };
62 
63 
64 
65 
66 
67 
68 
69 struct tlv_mlo_usr_32_tlword_t {
70 	   uint32_t             tlv_cflg_reserved   :   1,
71 				tlv_tag             :   _TLV_TAG_WIDTH_,
72 				tlv_len             :   _TLV_MRV_EN_LEN_WIDTH_,
73 				tlv_dst_linkid      :   3,
74 				tlv_src_linkid      :   3,
75 				tlv_mrv             :   1,
76 				tlv_usrid           :   _TLV_USERID_WIDTH_;
77 };
78 
79 struct tlv_mlo_32_tlword_t {
80 	   uint32_t             tlv_cflg_reserved   :   1,
81 				tlv_tag             :   _TLV_TAG_WIDTH_,
82 				tlv_len             :   _TLV_MRV_EN_LEN_WIDTH_,
83 				tlv_dst_linkid      :   3,
84 				tlv_src_linkid      :   3,
85 				tlv_mrv             :   1,
86 				tlv_reserved        :   6;
87 };
88 
89 struct tlv_mlo_usr_64_tlword_t {
90 	   uint64_t             tlv_cflg_reserved   :   1,
91 				tlv_tag             :   _TLV_TAG_WIDTH_,
92 				tlv_len             :   _TLV_MRV_EN_LEN_WIDTH_,
93 				tlv_dst_linkid      :   3,
94 				tlv_src_linkid      :   3,
95 				tlv_mrv             :   1,
96 				tlv_usrid           :   _TLV_USERID_WIDTH_,
97 				tlv_reserved        :   32;
98 };
99 
100 struct tlv_mlo_64_tlword_t {
101 	   uint64_t             tlv_cflg_reserved   :   1,
102 				tlv_tag             :   _TLV_TAG_WIDTH_,
103 				tlv_len             :   _TLV_MRV_EN_LEN_WIDTH_,
104 				tlv_dst_linkid      :   3,
105 				tlv_src_linkid      :   3,
106 				tlv_mrv             :   1,
107 				tlv_reserved        :   38;
108 };
109 
110 struct tlv_mlo_usr_44_tlword_t {
111 	   uint64_t             tlv_compression     :   1,
112 				tlv_tag             :   _TLV_TAG_WIDTH_,
113 				tlv_len             :   _TLV_MRV_EN_LEN_WIDTH_,
114 				tlv_dst_linkid      :   3,
115 				tlv_src_linkid      :   3,
116 				tlv_mrv             :   1,
117 				tlv_usrid           :   _TLV_USERID_WIDTH_,
118 				tlv_reserved        :   10,
119 				pad_44to64_bit      :   22;
120 };
121 
122 struct tlv_mlo_44_tlword_t {
123 	   uint64_t             tlv_compression     :   1,
124 				tlv_tag             :   _TLV_TAG_WIDTH_,
125 				tlv_len             :   _TLV_MRV_EN_LEN_WIDTH_,
126 				tlv_dst_linkid      :   3,
127 				tlv_src_linkid      :   3,
128 				tlv_mrv             :   1,
129 				tlv_reserved        :   16,
130 				pad_44to64_bit      :   22;
131 };
132 
133 struct tlv_mlo_usr_76_tlword_t {
134 	   uint64_t             tlv_compression     :   1,
135 				tlv_tag             :   _TLV_TAG_WIDTH_,
136 				tlv_len             :   _TLV_MRV_EN_LEN_WIDTH_,
137 				tlv_dst_linkid      :   3,
138 				tlv_src_linkid      :   3,
139 				tlv_mrv             :   1,
140 				tlv_usrid           :   _TLV_USERID_WIDTH_,
141 				tlv_reserved        :   32;
142 	   uint64_t             pad_64to128_bit     :   64;
143 };
144 
145 struct tlv_mlo_76_tlword_t {
146 	   uint64_t             tlv_compression     :   1,
147 				tlv_tag             :   _TLV_TAG_WIDTH_,
148 				tlv_len             :   _TLV_MRV_EN_LEN_WIDTH_,
149 				tlv_dst_linkid      :   3,
150 				tlv_src_linkid      :   3,
151 				tlv_mrv             :   1,
152 				tlv_reserved        :   38;
153 	   uint64_t             pad_64to128_bit     :   64;
154 };
155 
156 
157 
158 
159 
160 
161 struct tlv_mac_usr_32_tlword_t {
162 	   uint32_t             tlv_cflg_reserved   :   1,
163 				tlv_tag             :   _TLV_TAG_WIDTH_,
164 				tlv_len             :   _TLV_MRV_DIS_LEN_WIDTH_,
165 				tlv_src_linkid      :   3,
166 				tlv_mrv             :   1,
167 				tlv_usrid           :   _TLV_USERID_WIDTH_;
168 };
169 
170 struct tlv_mac_32_tlword_t {
171 	   uint32_t             tlv_cflg_reserved   :   1,
172 				tlv_tag             :   _TLV_TAG_WIDTH_,
173 				tlv_len             :   _TLV_MRV_DIS_LEN_WIDTH_,
174 				tlv_src_linkid      :   3,
175 				tlv_mrv             :   1,
176 				tlv_reserved        :   6;
177 };
178 
179 struct tlv_mac_usr_64_tlword_t {
180 	   uint64_t             tlv_cflg_reserved   :   1,
181 				tlv_tag             :   _TLV_TAG_WIDTH_,
182 				tlv_len             :   _TLV_MRV_DIS_LEN_WIDTH_,
183 				tlv_src_linkid      :   3,
184 				tlv_mrv             :   1,
185 				tlv_usrid           :   _TLV_USERID_WIDTH_,
186 				tlv_reserved        :   32;
187 };
188 
189 struct tlv_mac_64_tlword_t {
190 	   uint64_t             tlv_cflg_reserved   :   1,
191 				tlv_tag             :   _TLV_TAG_WIDTH_,
192 				tlv_len             :   _TLV_MRV_DIS_LEN_WIDTH_,
193 				tlv_src_linkid      :   3,
194 				tlv_mrv             :   1,
195 				tlv_reserved        :   38;
196 };
197 
198 struct tlv_mac_usr_44_tlword_t {
199 	   uint64_t             tlv_compression     :   1,
200 				tlv_tag             :   _TLV_TAG_WIDTH_,
201 				tlv_len             :   _TLV_MRV_DIS_LEN_WIDTH_,
202 				tlv_src_linkid      :   3,
203 				tlv_mrv             :   1,
204 				tlv_usrid           :   _TLV_USERID_WIDTH_,
205 				tlv_reserved        :   10,
206 				pad_44to64_bit      :   22;
207 };
208 
209 struct tlv_mac_44_tlword_t {
210 	   uint64_t             tlv_compression     :   1,
211 				tlv_tag             :   _TLV_TAG_WIDTH_,
212 				tlv_len             :   _TLV_MRV_DIS_LEN_WIDTH_,
213 				tlv_src_linkid      :   3,
214 				tlv_mrv             :   1,
215 				tlv_reserved        :   16,
216 				pad_44to64_bit      :   22;
217 };
218 
219 struct tlv_mac_usr_76_tlword_t {
220 	   uint64_t             tlv_compression     :   1,
221 				tlv_tag             :   _TLV_TAG_WIDTH_,
222 				tlv_len             :   _TLV_MRV_DIS_LEN_WIDTH_,
223 				tlv_src_linkid      :   3,
224 				tlv_mrv             :   1,
225 				tlv_usrid           :   _TLV_USERID_WIDTH_,
226 				tlv_reserved        :   32;
227 	   uint64_t             pad_64to128_bit     :   64;
228 };
229 
230 struct tlv_mac_76_tlword_t {
231 	   uint64_t             tlv_compression     :   1,
232 				tlv_tag             :   _TLV_TAG_WIDTH_,
233 				tlv_len             :   _TLV_MRV_DIS_LEN_WIDTH_,
234 				tlv_src_linkid      :   3,
235 				tlv_mrv             :   1,
236 				tlv_reserved        :   38;
237 	   uint64_t             pad_64to128_bit     :   64;
238 };
239 
240 
241 
242 
243 
244 struct tlv_usr_c_44_tlword_t {
245 	   uint64_t             tlv_compression     :   1,
246 				tlv_ctag            :   _TLV_CTAG_WIDTH_,
247 				tlv_usrid           :   _TLV_USERID_WIDTH_,
248 				tlv_cdata           :   _TLV_CDATA_WIDTH_,
249 				pad_44to64_bit      :   20;
250 };
251 
252 struct tlv_usr_c_76_tlword_t {
253 	   uint64_t             tlv_compression     :   1,
254 				tlv_ctag            :   _TLV_CTAG_WIDTH_,
255 				tlv_usrid           :   _TLV_USERID_WIDTH_,
256 				tlv_cdata_lower_52  :   52;
257 	   uint64_t             tlv_cdata_upper_12  :   12,
258 				pad_76to128_bit     :   52;
259 };
260 
261 
262 
263 
264 
265 
266 
267 struct tlv_usr_32_hdr {
268 	   uint64_t             tlv_cflg_reserved   :   1,
269 				tlv_tag             :   _TLV_TAG_WIDTH_,
270 				tlv_len             :   _TLV_MRV_DIS_LEN_WIDTH_,
271 				tlv_src_linkid      :   3,
272 				tlv_mrv             :   1,
273 				tlv_usrid           :   _TLV_USERID_WIDTH_,
274 				tlv_reserved        :   32;
275 };
276 
277 struct tlv_32_hdr {
278 	   uint64_t             tlv_cflg_reserved   :   1,
279 				tlv_tag             :   _TLV_TAG_WIDTH_,
280 				tlv_len             :   _TLV_MRV_DIS_LEN_WIDTH_,
281 				tlv_src_linkid      :   3,
282 				tlv_mrv             :   1,
283 				tlv_reserved        :   38;
284 };
285 
286 
287 
288 #endif
289