xref: /wlan-driver/qca-wifi-host-cmn/qdf/inc/qdf_net_types.h (revision 5113495b16420b49004c444715d2daae2066e7dc) !
1 /*
2  * Copyright (c) 2014-2020 The Linux Foundation. All rights reserved.
3  * Copyright (c) 2022-2023 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  * DOC: qdf_net_types
22  * This file defines types used in the networking stack abstraction.
23  */
24 
25 #ifndef _QDF_NET_TYPES_H
26 #define _QDF_NET_TYPES_H
27 
28 #include <qdf_types.h>          /* uint8_t, etc. */
29 #include <i_qdf_net_types.h>
30 
31 /* Extended Traffic ID  passed to target if the TID is unknown */
32 #define QDF_NBUF_TX_EXT_TID_INVALID     0x1f
33 
34 /**
35  * enum qdf_nbuf_exemption_type - QDF net buf exemption types for encryption
36  * @QDF_NBUF_EXEMPT_NO_EXEMPTION: No exemption
37  * @QDF_NBUF_EXEMPT_ALWAYS: Exempt always
38  * @QDF_NBUF_EXEMPT_ON_KEY_MAPPING_KEY_UNAVAILABLE: Exempt on key mapping
39  */
40 enum qdf_nbuf_exemption_type {
41 	QDF_NBUF_EXEMPT_NO_EXEMPTION = 0,
42 	QDF_NBUF_EXEMPT_ALWAYS,
43 	QDF_NBUF_EXEMPT_ON_KEY_MAPPING_KEY_UNAVAILABLE
44 };
45 
46 typedef __wsum_t wsum_t;
47 typedef __in6_addr_t in6_addr_t;
48 
49 
50 #define QDF_NET_MAC_ADDR_MAX_LEN 6
51 #define QDF_NET_IF_NAME_SIZE     64
52 #define QDF_NET_ETH_LEN          QDF_NET_MAC_ADDR_MAX_LEN
53 #define QDF_NET_MAX_MCAST_ADDR   64
54 #define QDF_NET_IPV4_LEN         4
55 #define QDF_TID_VI 5
56 #define QDF_TID_VO 6
57 #define QDF_TID_BE 0
58 #define QDF_TID_BK 1
59 /* Extended Traffic ID  passed to target if the TID is unknown */
60 #define QDF_NBUF_TX_EXT_TID_INVALID    0x1f
61 
62 #define QDF_ETH_TYPE_IPV4              0x0800  /* IPV4 */
63 #define QDF_ETH_TYPE_IPV6              0x86dd  /* IPV6 */
64 #define QDF_ETH_TYPE_8021Q             0x8100  /* 802.1Q vlan protocol */
65 #define QDF_ETH_TYPE_8021AD            0x88a8  /* 802.1AD vlan protocol */
66 #define QDF_IEEE80211_4ADDR_HDR_LEN     30
67 #define QDF_IEEE80211_3ADDR_HDR_LEN     24
68 #define QDF_IEEE80211_FC0_SUBTYPE_QOS   0x80
69 #define QDF_IEEE80211_FC1_TODS          0x01
70 #define QDF_IEEE80211_FC1_FROMDS        0x02
71 #define QDF_IEEE80211_FC1_PM            0x10
72 
73 #define QDF_IEEE80211_FC0_VERSION_0     0x00
74 #define QDF_IEEE80211_FC0_VERSION_MASK  0x03
75 #define QDF_IEEE80211_FC0_TYPE_MASK     0x0c
76 #define QDF_IEEE80211_FC0_SUBTYPE_MASK  0xf0
77 
78 #define QDF_IEEE80211_FC0_TYPE_MGT      0x00
79 
80 #define QDF_IEEE80211_FC0_TYPE_DATA     0x08
81 #define QDF_IEEE80211_FC0_SUBTYPE_DATA  0x00
82 #define QDF_IEEE80211_FC0_SUBTYPE_QOS   0x80
83 
84 #define QDF_IEEE80211_FC0_SUBTYPE_QOS_NULL   0xC0
85 #define QDF_IEEE80211_FC0_SUBTYPE_NODATA   0x40
86 
87 #define QDF_IEEE80211_FC0_TYPE_CTL      0x04
88 #define QDF_IEEE80211_FC0_SUBTYPE_BEAM_REPORT_POLL 0x40
89 #define QDF_IEEE80211_FC0_SUBTYPE_VHT_NDP_AN 0x50
90 #define QDF_IEEE80211_FC0_SUBTYPE_CTL_FRAME_EXTN 0x60
91 #define QDF_IEEE80211_FC0_SUBTYPE_CTL_WRAPPER   0x70
92 #define QDF_IEEE80211_FC0_SUBTYPE_BAR   0x80
93 #define QDF_IEEE80211_FC0_SUBTYPE_BA    0x90
94 #define QDF_IEEE80211_FC0_SUBTYPE_PSPOLL  0xA0
95 #define QDF_IEEE80211_FC0_SUBTYPE_RTS   0xB0
96 #define QDF_IEEE80211_FC0_SUBTYPE_CTS   0xC0
97 #define QDF_IEEE80211_FC0_SUBTYPE_ACK   0xD0
98 #define QDF_IEEE80211_FC0_SUBTYPE_CF_END 0xE0
99 #define QDF_IEEE80211_FC0_SUBTYPE_CF_END_CF_ACK 0xF0
100 
101 #define QDF_NET_IS_MAC_MULTICAST(_a)   (*(_a) & 0x01)
102 
103 /*
104  * In LLC header individual LSAP address 0x42 in
105  * DSAP and SSAP signifies IEEE 802.1 Bridge
106  * Spanning Tree Protocol
107  */
108 #define QDF_LLC_STP 0x4242
109 
110 typedef struct qdf_net_ethaddr {
111 	uint8_t addr[QDF_NET_ETH_LEN];
112 } qdf_net_ethaddr_t;
113 
114 /**
115  * typedef qdf_net_arphdr_t - ARP header info
116  * @ar_hrd: hardware type
117  * @ar_pro: protocol type
118  * @ar_hln: hardware address length
119  * @ar_pln: protocol length
120  * @ar_op: arp operation code
121  * @ar_sha: sender hardware address
122  * @ar_sip: sender IP address
123  * @ar_tha: target hardware address
124  * @ar_tip: target IP address
125  */
126 typedef struct qdf_net_arphdr {
127 	uint16_t ar_hrd;
128 	uint16_t ar_pro;
129 	uint8_t  ar_hln;
130 	uint8_t  ar_pln;
131 	uint16_t ar_op;
132 	uint8_t  ar_sha[QDF_NET_ETH_LEN];
133 	uint8_t  ar_sip[QDF_NET_IPV4_LEN];
134 	uint8_t  ar_tha[QDF_NET_ETH_LEN];
135 	uint8_t  ar_tip[QDF_NET_IPV4_LEN];
136 } qdf_net_arphdr_t;
137 
138 /**
139  * typedef qdf_net_icmp6_11addr_t - ICMP6 header info
140  * @type: hardware type
141  * @len: hardware address length
142  * @addr: hardware address
143  */
144 typedef struct qdf_net_icmp6_11addr {
145 	uint8_t type;
146 	uint8_t len;
147 	uint8_t addr[QDF_NET_ETH_LEN];
148 } qdf_net_icmp6_11addr_t;
149 
150 #define QDF_TCPHDR_FIN __QDF_TCPHDR_FIN
151 #define QDF_TCPHDR_SYN __QDF_TCPHDR_SYN
152 #define QDF_TCPHDR_RST __QDF_TCPHDR_RST
153 #define QDF_TCPHDR_PSH __QDF_TCPHDR_PSH
154 #define QDF_TCPHDR_ACK __QDF_TCPHDR_ACK
155 #define QDF_TCPHDR_URG __QDF_TCPHDR_URG
156 #define QDF_TCPHDR_ECE __QDF_TCPHDR_ECE
157 #define QDF_TCPHDR_CWR __QDF_TCPHDR_CWR
158 
159 typedef struct {
160 	uint16_t  source;
161 	uint16_t  dest;
162 	uint32_t  seq;
163 	uint32_t  ack_seq;
164 #if defined(QDF_LITTLE_ENDIAN_MACHINE)
165 	uint16_t   res1:4,
166 		   doff:4,
167 		   fin:1,
168 		   syn:1,
169 		   rst:1,
170 		   psh:1,
171 		   ack:1,
172 		   urg:1,
173 		   ece:1,
174 		   cwr:1;
175 #elif defined(QDF_BIG_ENDIAN_MACHINE)
176 	uint16_t   doff:4,
177 		   res1:4,
178 		   cwr:1,
179 		   ece:1,
180 		   urg:1,
181 		   ack:1,
182 		   psh:1,
183 		   rst:1,
184 		   syn:1,
185 		   fin:1;
186 #else
187 #error  "Adjust your byte order"
188 #endif
189 	uint16_t  window;
190 	uint16_t  check;
191 	uint16_t  urg_ptr;
192 } qdf_net_tcphdr_t;
193 
194 typedef struct {
195 #if defined(QDF_LITTLE_ENDIAN_MACHINE)
196 	uint8_t	ip_hl:4,
197 		ip_version:4;
198 #elif defined(QDF_BIG_ENDIAN_MACHINE)
199 	uint8_t	ip_version:4,
200 		ip_hl:4;
201 #else
202 #error  "Please fix"
203 #endif
204 	uint8_t       ip_tos;
205 	uint16_t      ip_len;
206 	uint16_t      ip_id;
207 	uint16_t      ip_frag_off;
208 	uint8_t       ip_ttl;
209 	uint8_t       ip_proto;
210 	uint16_t      ip_check;
211 	uint32_t      ip_saddr;
212 	uint32_t      ip_daddr;
213     /*The options start here. */
214 } qdf_net_iphdr_t;
215 
216 /* V3 group record types [grec_type] */
217 #define IGMPV3_MODE_IS_INCLUDE     1
218 #define IGMPV3_MODE_IS_EXCLUDE     2
219 #define IGMPV3_CHANGE_TO_INCLUDE   3
220 #define IGMPV3_CHANGE_TO_EXCLUDE   4
221 #define IGMPV3_ALLOW_NEW_SOURCES   5
222 #define IGMPV3_BLOCK_OLD_SOURCES   6
223 
224 /**
225  * typedef qdf_net_cmd_vid_t - Command for set/unset vid
226  */
227 typedef uint16_t qdf_net_cmd_vid_t ;        /*get/set vlan id*/
228 
229 /**
230  * typedef qdf_nbuf_tx_cksum_t - transmit checksum offload types
231  * @QDF_NBUF_TX_CKSUM_NONE: No checksum offload
232  * @QDF_NBUF_TX_CKSUM_IP: IP header checksum offload
233  * @QDF_NBUF_TX_CKSUM_TCP_UDP: TCP/UDP checksum offload
234  * @QDF_NBUF_TX_CKSUM_TCP_UDP_IP: TCP/UDP and IP header checksum offload
235  */
236 
237 typedef enum {
238 	QDF_NBUF_TX_CKSUM_NONE,
239 	QDF_NBUF_TX_CKSUM_IP,
240 	QDF_NBUF_TX_CKSUM_TCP_UDP,
241 	QDF_NBUF_TX_CKSUM_TCP_UDP_IP,
242 
243 } qdf_nbuf_tx_cksum_t;
244 
245 /**
246  * typedef qdf_nbuf_l4_rx_cksum_type_t - receive checksum API types
247  * @QDF_NBUF_RX_CKSUM_ZERO: Rx checksum zero
248  * @QDF_NBUF_RX_CKSUM_TCP: Rx checksum TCP
249  * @QDF_NBUF_RX_CKSUM_UDP: Rx checksum UDP
250  * @QDF_NBUF_RX_CKSUM_TCPIPV6: Rx checksum TCP IPV6
251  * @QDF_NBUF_RX_CKSUM_UDPIPV6: Rx checksum UDP IPV6
252  * @QDF_NBUF_RX_CKSUM_TCP_NOPSEUDOHEADER: Rx checksum TCP no pseudo header
253  * @QDF_NBUF_RX_CKSUM_UDP_NOPSEUDOHEADER: Rx checksum UDP no pseudo header
254  * @QDF_NBUF_RX_CKSUM_TCPSUM16: Rx checksum TCP SUM16
255  */
256 typedef enum {
257 	QDF_NBUF_RX_CKSUM_ZERO = 0x0000,
258 	QDF_NBUF_RX_CKSUM_TCP = 0x0001,
259 	QDF_NBUF_RX_CKSUM_UDP = 0x0002,
260 	QDF_NBUF_RX_CKSUM_TCPIPV6 = 0x0010,
261 	QDF_NBUF_RX_CKSUM_UDPIPV6 = 0x0020,
262 	QDF_NBUF_RX_CKSUM_TCP_NOPSEUDOHEADER = 0x0100,
263 	QDF_NBUF_RX_CKSUM_UDP_NOPSEUDOHEADER = 0x0200,
264 	QDF_NBUF_RX_CKSUM_TCPSUM16 = 0x1000,
265 } qdf_nbuf_l4_rx_cksum_type_t;
266 
267 /**
268  * typedef qdf_nbuf_l4_rx_cksum_result_t - receive checksum status types
269  * @QDF_NBUF_RX_CKSUM_NONE: Device failed to checksum
270  * @QDF_NBUF_RX_CKSUM_TCP_UDP_HW: TCP/UDP cksum successful and value returned
271  * @QDF_NBUF_RX_CKSUM_TCP_UDP_UNNECESSARY: TCP/UDP cksum successful, no value
272  */
273 typedef enum {
274 	QDF_NBUF_RX_CKSUM_NONE = 0x0000,
275 	QDF_NBUF_RX_CKSUM_TCP_UDP_HW = 0x0010,
276 	QDF_NBUF_RX_CKSUM_TCP_UDP_UNNECESSARY = 0x0020,
277 } qdf_nbuf_l4_rx_cksum_result_t;
278 
279 /**
280  * typedef qdf_nbuf_rx_cksum_t - receive checksum type
281  * @l4_type: L4 type
282  * @l4_result: L4 result
283  * @csum_level: indicates number of checksum are calculated
284  */
285 typedef struct {
286 	qdf_nbuf_l4_rx_cksum_type_t l4_type;
287 	qdf_nbuf_l4_rx_cksum_result_t l4_result;
288 	uint32_t val;
289 	uint32_t csum_level;
290 } qdf_nbuf_rx_cksum_t;
291 
292 #define QDF_ARP_REQ       1 /* ARP request */
293 #define QDF_ARP_RSP       2 /* ARP response */
294 #define QDF_ARP_RREQ      3 /* RARP request */
295 #define QDF_ARP_RRSP      4 /* RARP response */
296 
297 #define QDF_NEXTHDR_ICMP  58 /* ICMP for IPv6. */
298 
299 /* Neighbor Discovery */
300 #define QDF_ND_RSOL       133 /* Router Solicitation */
301 #define QDF_ND_RADVT      134 /* Router Advertisement */
302 #define QDF_ND_NSOL       135 /* Neighbor Solicitation */
303 #define QDF_ND_NADVT      136 /* Neighbor Advertisement */
304 
305 /**
306  * typedef qdf_net_udphdr_t - UDP header info
307  * @src_port: source port
308  * @dst_port: destination port
309  * @udp_len: length
310  * @udp_cksum: checksum
311  */
312 typedef struct {
313 	uint16_t src_port;
314 	uint16_t dst_port;
315 	uint16_t udp_len;
316 	uint16_t udp_cksum;
317 } qdf_net_udphdr_t;
318 
319 /**
320  * typedef qdf_net_dhcphdr_t - DHCP header info
321  * @dhcp_msg_type: message type
322  * @dhcp_hw_type: hardware type
323  * @dhcp_hw_addr_len: hardware address length
324  * @dhcp_num_hops: number of hops
325  * @dhcp_transc_id: transaction id
326  * @dhcp_secs_elapsed: time elapsed
327  * @dhcp_flags: flags
328  * @dhcp_ciaddr: client IP
329  * @dhcp_yiaddr: device IP
330  * @dhcp_siaddr_nip: Server IP
331  * @dhcp_gateway_nip: relay agent IP
332  * @dhcp_chaddr: LLC hardware address
333  * @dhcp_sname: server host name
334  * @dhcp_file: boot file name
335  * @dhcp_cookie: cookie
336  */
337 typedef struct {
338 	uint8_t  dhcp_msg_type;
339 	uint8_t  dhcp_hw_type;
340 	uint8_t  dhcp_hw_addr_len;
341 	uint8_t  dhcp_num_hops;
342 	uint32_t dhcp_transc_id;
343 	uint16_t dhcp_secs_elapsed;
344 	uint16_t dhcp_flags;
345 	uint32_t dhcp_ciaddr;
346 	uint32_t dhcp_yiaddr;
347 	uint32_t dhcp_siaddr_nip;
348 	uint32_t dhcp_gateway_nip;
349 	uint8_t  dhcp_chaddr[16];
350 	uint8_t  dhcp_sname[64];
351 	uint8_t  dhcp_file[128];
352 	uint8_t  dhcp_cookie[4];
353 } qdf_net_dhcphdr_t;
354 
355 
356 /**
357  * typedef qdf_net_vlanhdr_t - Vlan header
358  * @tpid:
359  * @vid:
360  * @cfi:
361  * @prio:
362  */
363 typedef struct qdf_net_vlanhdr {
364 	uint16_t tpid;
365 #if defined(QDF_LITTLE_ENDIAN_MACHINE)
366 	uint16_t vid:12; /* Vlan id*/
367 	uint8_t  cfi:1; /* reserved for CFI, don't use*/
368 	uint8_t  prio:3; /* Priority*/
369 #elif defined(QDF_BIG_ENDIAN_MACHINE)
370 	uint8_t  prio:3; /* Priority*/
371 	uint8_t  cfi:1; /* reserved for CFI, don't use*/
372 	uint16_t vid:12; /* Vlan id*/
373 #else
374 #error  "Please fix"
375 #endif
376 } qdf_net_vlanhdr_t;
377 
378 typedef struct qdf_net_vid {
379 #if defined(QDF_LITTLE_ENDIAN_MACHINE)
380 	uint16_t val:12;
381 	uint8_t  res:4;
382 #elif defined(QDF_BIG_ENDIAN_MACHINE)
383 	uint8_t  res:4;
384 	uint16_t val:12;
385 #else
386 #error  "Please fix"
387 #endif
388 } qdf_net_vid_t;
389 
390 typedef enum {
391 	QDF_NET_TSO_NONE,
392 	QDF_NET_TSO_IPV4,     /**< for tsp ipv4 only*/
393 	QDF_NET_TSO_ALL,      /**< ip4 & ipv6*/
394 } qdf_net_tso_type_t;
395 
396 /**
397  * typedef qdf_net_dev_info_t - Basic device info
398  * @if_name:
399  * @dev_addr:
400  * @header_len:
401  * @mtu_size:
402  * @unit:
403  */
404 typedef struct {
405 	uint8_t  if_name[QDF_NET_IF_NAME_SIZE];
406 	uint8_t  dev_addr[QDF_NET_MAC_ADDR_MAX_LEN];
407 	uint16_t header_len;
408 	uint16_t mtu_size;
409 	uint32_t unit;
410 } qdf_net_dev_info_t;
411 
412 /**
413  * typedef qdf_nbuf_tso_t - For TCP large Segment Offload
414  * @type:
415  * @mss:
416  * @hdr_off:
417  */
418 typedef struct {
419 	qdf_net_tso_type_t  type;
420 	uint16_t mss;
421 	uint8_t  hdr_off;
422 } qdf_nbuf_tso_t;
423 
424 /**
425  * typedef qdf_net_wireless_event_t - Wireless events
426  * @QDF_IEEE80211_ASSOC: station associate (bss mode)
427  * @QDF_IEEE80211_REASSOC: station re-associate (bss mode)
428  * @QDF_IEEE80211_DISASSOC: station disassociate (bss mode)
429  * @QDF_IEEE80211_JOIN: station join (ap mode)
430  * @QDF_IEEE80211_LEAVE: station leave (ap mode)
431  * @QDF_IEEE80211_SCAN: scan complete, results available
432  * @QDF_IEEE80211_REPLAY: sequence counter replay detected
433  * @QDF_IEEE80211_MICHAEL: Michael MIC failure detected
434  * @QDF_IEEE80211_REJOIN: station re-associate (ap mode)
435  * @QDF_CUSTOM_PUSH_BUTTON: WPS push button
436  */
437 typedef enum qdf_net_wireless_events {
438 	QDF_IEEE80211_ASSOC = __QDF_IEEE80211_ASSOC,
439 	QDF_IEEE80211_REASSOC = __QDF_IEEE80211_REASSOC,
440 	QDF_IEEE80211_DISASSOC = __QDF_IEEE80211_DISASSOC,
441 	QDF_IEEE80211_JOIN = __QDF_IEEE80211_JOIN,
442 	QDF_IEEE80211_LEAVE = __QDF_IEEE80211_LEAVE,
443 	QDF_IEEE80211_SCAN = __QDF_IEEE80211_SCAN,
444 	QDF_IEEE80211_REPLAY = __QDF_IEEE80211_REPLAY,
445 	QDF_IEEE80211_MICHAEL = __QDF_IEEE80211_MICHAEL,
446 	QDF_IEEE80211_REJOIN = __QDF_IEEE80211_REJOIN,
447 	QDF_CUSTOM_PUSH_BUTTON = __QDF_CUSTOM_PUSH_BUTTON
448 } qdf_net_wireless_event_t;
449 
450 /**
451  * typedef qdf_net_ipv6_addr_t - IPv6 Address
452  * @in6_u: union of IPv6 address representations
453  */
454 typedef struct {
455 	union {
456 		uint8_t  u6_addr8[16];
457 		uint16_t u6_addr16[8];
458 		uint32_t u6_addr32[4];
459 	} in6_u;
460 #define s6_addr32   in6_u.u6_addr32
461 } qdf_net_ipv6_addr_t;
462 
463 /**
464  * struct qdf_net_ipv6hdr_t - IPv6 Header
465  * @ipv6_priority:
466  * @ipv6_version:
467  * @ipv6_flow_lbl:
468  * @ipv6_payload_len:
469  * @ipv6_nexthdr:
470  * @ipv6_hop_limit:
471  * @ipv6_saddr:
472  * @ipv6_daddr:
473  */
474 typedef struct {
475 #if defined(QDF_LITTLE_ENDIAN_MACHINE)
476 	uint8_t ipv6_priority:4,
477 		ipv6_version:4;
478 #elif defined(QDF_BIG_ENDIAN_MACHINE)
479 	uint8_t ipv6_version:4,
480 		ipv6_priority:4;
481 #else
482 #error  "Please fix"
483 #endif
484 	uint8_t ipv6_flow_lbl[3];
485 
486 	uint16_t ipv6_payload_len;
487 	uint8_t  ipv6_nexthdr,
488 		 ipv6_hop_limit;
489 
490 	qdf_net_ipv6_addr_t ipv6_saddr,
491 			    ipv6_daddr;
492 } qdf_net_ipv6hdr_t;
493 
494 /**
495  * typedef qdf_net_icmpv6hdr_t - ICMPv6 Header
496  * @icmp6_type: ICMPv6 message type
497  * @icmp6_code: ICMPv6 message code
498  * @icmp6_cksum: ICMPv6 message checksum
499  * @icmp6_dataun: Union of supported ICMPv6 message bodies
500  */
501 typedef struct {
502 	uint8_t	 icmp6_type;
503 	uint8_t	 icmp6_code;
504 	uint16_t icmp6_cksum;
505 
506 	union {
507 		uint32_t un_data32[1];
508 		uint16_t un_data16[2];
509 		uint8_t  un_data8[4];
510 
511 		struct {
512 			uint16_t identifier;
513 			uint16_t sequence;
514 		} u_echo;
515 
516 		struct {
517 #if defined(QDF_LITTLE_ENDIAN_MACHINE)
518 			uint32_t reserved:5,
519 				 override:1,
520 				 solicited:1,
521 				 router:1,
522 				 reserved2:24;
523 #elif defined(QDF_BIG_ENDIAN_MACHINE)
524 			uint32_t router:1,
525 				 solicited:1,
526 				 override:1,
527 				 reserved:29;
528 #else
529 #error  "Please fix"
530 #endif
531 		} u_nd_advt;
532 
533 		struct {
534 			uint8_t	hop_limit;
535 #if defined(QDF_LITTLE_ENDIAN_MACHINE)
536 			uint8_t	reserved:6,
537 				other:1,
538 				managed:1;
539 
540 #elif defined(QDF_BIG_ENDIAN_MACHINE)
541 			uint8_t	managed:1,
542 				other:1,
543 				reserved:6;
544 #else
545 #error  "Please fix"
546 #endif
547 			uint16_t rt_lifetime;
548 		} u_nd_ra;
549 
550 	} icmp6_dataun;
551 
552 } qdf_net_icmpv6hdr_t;
553 
554 /**
555  * typedef qdf_net_nd_msg_t - Neighbor Discovery Message
556  * @nd_icmph: ICMPv6 header
557  * @nd_target: Target IPv6 address
558  * @nd_opt: Neighbor Discovery options
559  */
560 typedef struct {
561 	qdf_net_icmpv6hdr_t nd_icmph;
562 	qdf_net_ipv6_addr_t nd_target;
563 	uint8_t	nd_opt[0];
564 } qdf_net_nd_msg_t;
565 
566 
567 static inline
qdf_csum_tcpudp_magic(uint32_t ip_saddr,uint32_t ip_daddr,uint16_t adj_ip_len,uint8_t ip_proto,uint32_t sum)568 __sum16 qdf_csum_tcpudp_magic(uint32_t ip_saddr, uint32_t ip_daddr,
569 			      uint16_t adj_ip_len, uint8_t ip_proto,
570 			      uint32_t sum)
571 {
572 	return __qdf_csum_tcpudp_magic(ip_saddr, ip_daddr,
573 				       adj_ip_len, ip_proto, sum);
574 }
575 
576 static inline
qdf_ip_fast_csum(qdf_net_iphdr_t * iph_head,uint8_t ip_hl)577 uint16_t qdf_ip_fast_csum(qdf_net_iphdr_t *iph_head, uint8_t ip_hl)
578 {
579 	return __qdf_ip_fast_csum(iph_head, ip_hl);
580 }
581 
qdf_csum_ipv6(const in6_addr_t * saddr,const in6_addr_t * daddr,__u32 len,unsigned short proto,wsum_t sum)582 static inline int32_t qdf_csum_ipv6(const in6_addr_t *saddr,
583 				    const in6_addr_t *daddr,
584 				    __u32 len, unsigned short proto,
585 				    wsum_t sum)
586 {
587 	return (int32_t)__qdf_csum_ipv6(saddr, daddr, len, proto, sum);
588 }
589 
qdf_netdev_get_devname(qdf_netdev_t dev)590 static inline char *qdf_netdev_get_devname(qdf_netdev_t dev)
591 {
592 	return __qdf_netdev_get_devname(dev);
593 }
594 
595 typedef struct {
596 	uint8_t i_fc[2];
597 	uint8_t i_dur[2];
598 	uint8_t i_addr1[QDF_NET_MAC_ADDR_MAX_LEN];
599 	uint8_t i_addr2[QDF_NET_MAC_ADDR_MAX_LEN];
600 	uint8_t i_addr3[QDF_NET_MAC_ADDR_MAX_LEN];
601 	uint8_t i_seq[2];
602 	uint8_t i_qos[2];
603 } qdf_dot3_qosframe_t;
604 
605 typedef struct {
606 	uint8_t ether_dhost[QDF_NET_MAC_ADDR_MAX_LEN];
607 	uint8_t ether_shost[QDF_NET_MAC_ADDR_MAX_LEN];
608 	uint16_t vlan_TCI;
609 	uint16_t vlan_encapsulated_proto;
610 	uint16_t ether_type;
611 } qdf_ethervlan_header_t;
612 
613 /**
614  * typedef qdf_ether_header_t - ethernet header info
615  * @ether_dhost: destination hardware address
616  * @ether_shost: source hardware address
617  * @ether_type: ethernet type
618  */
619 typedef struct {
620 	uint8_t  ether_dhost[QDF_NET_ETH_LEN];
621 	uint8_t  ether_shost[QDF_NET_ETH_LEN];
622 	uint16_t ether_type;
623 } qdf_ether_header_t;
624 
625 typedef struct {
626 	uint8_t llc_dsap;
627 	uint8_t llc_ssap;
628 	union {
629 		struct {
630 			uint8_t control;
631 			uint8_t format_id;
632 			uint8_t class;
633 			uint8_t window_x2;
634 		} __packed type_u;
635 		struct {
636 			uint8_t num_snd_x2;
637 			uint8_t num_rcv_x2;
638 		} __packed type_i;
639 		struct {
640 			uint8_t control;
641 			uint8_t num_rcv_x2;
642 		} __packed type_s;
643 		struct {
644 			uint8_t control;
645 			/*
646 			 * We cannot put the following fields in a structure
647 			 * because the structure rounding might cause padding.
648 			 */
649 			uint8_t frmr_rej_pdu0;
650 			uint8_t frmr_rej_pdu1;
651 			uint8_t frmr_control;
652 			uint8_t frmr_control_ext;
653 			uint8_t frmr_cause;
654 		} __packed type_frmr;
655 		struct {
656 			uint8_t  control;
657 			uint8_t  org_code[3];
658 			uint16_t ether_type;
659 		} __packed type_snap;
660 		struct {
661 			uint8_t control;
662 			uint8_t control_ext;
663 		} __packed type_raw;
664 	} llc_un /* XXX __packed ??? */;
665 } qdf_llc_t;
666 
667 #endif /*_QDF_NET_TYPES_H*/
668