blob: f3a87d3e645cc4bc48c67b4ddac1ac43a54ff5cf [file] [log] [blame]
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001/*
2 * Copyright (c) 2014-2015 The Linux Foundation. All rights reserved.
3 *
4 * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
5 *
6 *
7 * Permission to use, copy, modify, and/or distribute this software for
8 * any purpose with or without fee is hereby granted, provided that the
9 * above copyright notice and this permission notice appear in all
10 * copies.
11 *
12 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
13 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
14 * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
15 * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
16 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
17 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
18 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
19 * PERFORMANCE OF THIS SOFTWARE.
20 */
21
22/*
23 * This file was originally distributed by Qualcomm Atheros, Inc.
24 * under proprietary terms before Copyright ownership was assigned
25 * to the Linux Foundation.
26 */
27
28#if !defined( __CDS_PKT_H )
29#define __CDS_PKT_H
30
31/**=========================================================================
32
33 \file cds_packet.h
34
35 \brief Connectivity driver services (CDS) network Packet APIs
36
37 Network Protocol packet/buffer support interfaces
38
39 ========================================================================*/
40
41/*--------------------------------------------------------------------------
42 Include Files
43 ------------------------------------------------------------------------*/
44#include <cdf_types.h>
45#include <cdf_status.h>
46
47/*--------------------------------------------------------------------------
48 Preprocessor definitions and constants
49 ------------------------------------------------------------------------*/
50
51/*--------------------------------------------------------------------------
52 Type declarations
53 ------------------------------------------------------------------------*/
54struct cds_pkt_t;
55typedef struct cds_pkt_t cds_pkt_t;
56
57#include "cdf_nbuf.h"
58
59#define CDS_PKT_TRAC_TYPE_EAPOL NBUF_PKT_TRAC_TYPE_EAPOL
60#define CDS_PKT_TRAC_TYPE_DHCP NBUF_PKT_TRAC_TYPE_DHCP
61#define CDS_PKT_TRAC_TYPE_MGMT_ACTION NBUF_PKT_TRAC_TYPE_MGMT_ACTION /* Managment action frame */
62
63#define CDS_PKT_TRAC_DUMP_CMD 9999
64
65/*---------------------------------------------------------------------------
66
67* brief cds_pkt_get_proto_type() -
68 Find protoco type from packet contents
69
70* skb Packet Pointer
71* tracking_map packet type want to track
72* dot11_type, frame type when the frame is in dot11 format
73
74 ---------------------------------------------------------------------------*/
75uint8_t cds_pkt_get_proto_type
76 (struct sk_buff *skb, uint8_t tracking_map, uint8_t dot11_type);
77
78#ifdef QCA_PKT_PROTO_TRACE
79/*---------------------------------------------------------------------------
80
81* brief cds_pkt_trace_buf_update() -
82 Update storage buffer with interest event string
83
84* event_string Event String may packet type or outstanding event
85
86 ---------------------------------------------------------------------------*/
87void cds_pkt_trace_buf_update(char *event_string);
88
89/*---------------------------------------------------------------------------
90
91* brief cds_pkt_trace_buf_dump() -
92 Dump stored information into kernel log
93
94 ---------------------------------------------------------------------------*/
95void cds_pkt_trace_buf_dump(void);
96
97/*---------------------------------------------------------------------------
98
99* brief cds_pkt_proto_trace_init() -
100 Initialize protocol trace functionality, allocate required resource
101
102 ---------------------------------------------------------------------------*/
103void cds_pkt_proto_trace_init(void);
104
105/*---------------------------------------------------------------------------
106
107* brief cds_pkt_proto_trace_close() -
108 Free required resource
109
110 ---------------------------------------------------------------------------*/
111void cds_pkt_proto_trace_close(void);
112#endif /* QCA_PKT_PROTO_TRACE */
113
114/**
115 * cds_pkt_return_packet Free the cds Packet
116 * @ cds Packet
117 */
118CDF_STATUS cds_pkt_return_packet(cds_pkt_t *packet);
119
120/**
121 * cds_pkt_get_packet_length Returns the packet length
122 * @ cds Packet
123 */
124CDF_STATUS cds_pkt_get_packet_length(cds_pkt_t *pPacket,
125 uint16_t *pPacketSize);
126
127/*
128 * TODO: Remove later
129 * All the below difinitions are not
130 * required for Host Driver 2.0
131 * once corresponding references are removed
132 * from HDD and other layers
133 * below code will be removed
134 */
135/* The size of AMSDU frame per spec can be a max of 3839 bytes
136 in BD/PDUs that means 30 (one BD = 128 bytes)
137 we must add the size of the 802.11 header to that */
138#define CDS_PKT_SIZE_BUFFER ((30 * 128) + 32)
139
140/* cds Packet Types */
141typedef enum {
142 /* cds Packet is used to transmit 802.11 Management frames. */
143 CDS_PKT_TYPE_TX_802_11_MGMT,
144
145 /* cds Packet is used to transmit 802.11 Data frames. */
146 CDS_PKT_TYPE_TX_802_11_DATA,
147
148 /* cds Packet is used to transmit 802.3 Data frames. */
149 CDS_PKT_TYPE_TX_802_3_DATA,
150
151 /* cds Packet contains Received data of an unknown frame type */
152 CDS_PKT_TYPE_RX_RAW,
153
154 /* Invalid sentinel value */
155 CDS_PKT_TYPE_MAXIMUM
156} CDS_PKT_TYPE;
157
158/* user IDs. These IDs are needed on the cds_pkt_get/set_user_data_ptr()
159 to identify the user area in the cds Packet. */
160typedef enum {
161 CDS_PKT_USER_DATA_ID_TL = 0,
162 CDS_PKT_USER_DATA_ID_BAL,
163 CDS_PKT_USER_DATA_ID_WMA,
164 CDS_PKT_USER_DATA_ID_HDD,
165 CDS_PKT_USER_DATA_ID_BSL,
166
167 CDS_PKT_USER_DATA_ID_MAX
168} CDS_PKT_USER_DATA_ID;
169
170#ifdef MEMORY_DEBUG
171#define cds_packet_alloc(s, d, p) \
172 cds_packet_alloc_debug(s, d, p, __FILE__, __LINE__)
173
174CDF_STATUS cds_packet_alloc_debug(uint16_t size, void **data, void **ppPacket,
175 uint8_t *file_name, uint32_t line_num);
176#else
177CDF_STATUS cds_packet_alloc(uint16_t size, void **data, void **ppPacket);
178#endif
179
180void cds_packet_free(void *pPacket);
181
182typedef CDF_STATUS (*cds_pkt_get_packet_callback)(cds_pkt_t *pPacket,
183 void *userData);
184
185#endif /* !defined( __CDS_PKT_H ) */