xref: /wlan-driver/qcacld-3.0/core/dp/txrx/ol_tx_classify.h (revision 5113495b16420b49004c444715d2daae2066e7dc)
1 /*
2  * Copyright (c) 2012, 2014, 2016 The Linux Foundation. All rights reserved.
3  *
4  * Permission to use, copy, modify, and/or distribute this software for
5  * any purpose with or without fee is hereby granted, provided that the
6  * above copyright notice and this permission notice appear in all
7  * copies.
8  *
9  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
10  * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
11  * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
12  * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
13  * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
14  * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
15  * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
16  * PERFORMANCE OF THIS SOFTWARE.
17  */
18 
19 /**
20  * @file ol_tx_classify.h
21  * @brief API definitions for the tx classify module within the data SW.
22  */
23 #ifndef _OL_TX_CLASSIFY__H_
24 #define _OL_TX_CLASSIFY__H_
25 
26 #include <qdf_nbuf.h>      /* qdf_nbuf_t */
27 #include <ol_txrx_types.h> /* ol_txrx_vdev_t, etc. */
28 
29 static inline u_int8_t *
ol_tx_dest_addr_find(struct ol_txrx_pdev_t * pdev,qdf_nbuf_t tx_nbuf)30 ol_tx_dest_addr_find(
31 	struct ol_txrx_pdev_t *pdev,
32 	qdf_nbuf_t tx_nbuf)
33 {
34 	u_int8_t *hdr_ptr;
35 	void *datap = qdf_nbuf_data(tx_nbuf);
36 
37 	if (pdev->frame_format == wlan_frm_fmt_raw) {
38 		/* adjust hdr_ptr to RA */
39 		struct ieee80211_frame *wh =
40 			(struct ieee80211_frame *)datap;
41 		hdr_ptr = wh->i_addr1;
42 	} else if (pdev->frame_format ==
43 			wlan_frm_fmt_native_wifi) {
44 		/* adjust hdr_ptr to RA */
45 		struct ieee80211_frame *wh = (
46 			struct ieee80211_frame *)datap;
47 		hdr_ptr = wh->i_addr1;
48 	} else if (pdev->frame_format == wlan_frm_fmt_802_3) {
49 		hdr_ptr = datap;
50 	} else {
51 		QDF_TRACE(QDF_MODULE_ID_TXRX,
52 			  QDF_TRACE_LEVEL_ERROR,
53 			"Invalid standard frame type: %d\n",
54 			pdev->frame_format);
55 		qdf_assert(0);
56 		hdr_ptr = NULL;
57 	}
58 	return hdr_ptr;
59 }
60 
61 #if defined(CONFIG_HL_SUPPORT)
62 
63 /**
64  * @brief Classify a tx frame to which tid queue.
65  *
66  * @param vdev - the virtual device sending the data
67  *      (for specifying the transmitter address for multicast / broadcast data)
68  * @param tx_desc - descriptor object with meta-data about the tx frame
69  * @param netbuf - the tx frame
70  * @param tx_msdu_info - characteristics of the tx frame
71  */
72 struct ol_tx_frms_queue_t *
73 ol_tx_classify(
74 	struct ol_txrx_vdev_t *vdev,
75 	struct ol_tx_desc_t *tx_desc,
76 	qdf_nbuf_t netbuf,
77 	struct ol_txrx_msdu_info_t *tx_msdu_info);
78 
79 struct ol_tx_frms_queue_t *
80 ol_tx_classify_mgmt(
81 	struct ol_txrx_vdev_t *vdev,
82 	struct ol_tx_desc_t *tx_desc,
83 	qdf_nbuf_t netbuf,
84 	struct ol_txrx_msdu_info_t *tx_msdu_info);
85 
86 #else
87 
88 #define ol_tx_classify(vdev, tx_desc, netbuf, tx_msdu_info) NULL
89 #define ol_tx_classify_mgmt(vdev, tx_desc, netbuf, tx_msdu_info) NULL
90 
91 #endif /* defined(CONFIG_HL_SUPPORT) */
92 
93 
94 #endif /* _OL_TX_CLASSIFY__H_ */
95