1*5113495bSYour Name /*
2*5113495bSYour Name * Copyright (c) 2012, 2014-2016, 2018 The Linux Foundation. All rights reserved.
3*5113495bSYour Name *
4*5113495bSYour Name * Permission to use, copy, modify, and/or distribute this software for
5*5113495bSYour Name * any purpose with or without fee is hereby granted, provided that the
6*5113495bSYour Name * above copyright notice and this permission notice appear in all
7*5113495bSYour Name * copies.
8*5113495bSYour Name *
9*5113495bSYour Name * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
10*5113495bSYour Name * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
11*5113495bSYour Name * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
12*5113495bSYour Name * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
13*5113495bSYour Name * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
14*5113495bSYour Name * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
15*5113495bSYour Name * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
16*5113495bSYour Name * PERFORMANCE OF THIS SOFTWARE.
17*5113495bSYour Name */
18*5113495bSYour Name
19*5113495bSYour Name /**
20*5113495bSYour Name * @file ol_txrx_encap.h
21*5113495bSYour Name * @brief definitions for txrx encap/decap function and struct
22*5113495bSYour Name */
23*5113495bSYour Name #ifndef _OL_TXRX_ENCAP__H_
24*5113495bSYour Name #define _OL_TXRX_ENCAP__H_
25*5113495bSYour Name
26*5113495bSYour Name #ifdef QCA_SUPPORT_SW_TXRX_ENCAP
27*5113495bSYour Name
28*5113495bSYour Name #include <qdf_nbuf.h> /* qdf_nbuf_t */
29*5113495bSYour Name #include <cds_ieee80211_common.h> /* ieee80211_qosframe_htc_addr4 */
30*5113495bSYour Name #include <cdp_txrx_cmn.h> /* ol_txrx_vdev_t, etc. */
31*5113495bSYour Name
32*5113495bSYour Name /**
33*5113495bSYour Name * @brief Encap outgoing frm from OS dependent format to Target
34*5113495bSYour Name * acceptable frm format
35*5113495bSYour Name * @details
36*5113495bSYour Name * For native wifi format, the function will add Qos control field
37*5113495bSYour Name * based on peer's QOS capbabilities .
38*5113495bSYour Name * For 802.3 format, the function will transform to 802.11 format
39*5113495bSYour Name * with or without QOS control field based on peer's QOS capabilities.
40*5113495bSYour Name * @param vdev - handle to vdev object
41*5113495bSYour Name * @param tx_desc - tx desc struct,some fields will be updated.
42*5113495bSYour Name * @param msdu - qdf_nbuf_t
43*5113495bSYour Name * @param msdu_info - information from tx classification.
44*5113495bSYour Name * @return
45*5113495bSYour Name * A_OK: encap operation successful
46*5113495bSYour Name * other: operation failed,the msdu need be dropped.
47*5113495bSYour Name */
48*5113495bSYour Name A_STATUS
49*5113495bSYour Name ol_tx_encap(struct ol_txrx_vdev_t *vdev,
50*5113495bSYour Name struct ol_tx_desc_t *tx_desc,
51*5113495bSYour Name qdf_nbuf_t msdu, struct ol_txrx_msdu_info_t *msdu_info);
52*5113495bSYour Name
53*5113495bSYour Name struct ol_rx_decap_info_t {
54*5113495bSYour Name uint8_t hdr[sizeof(struct ieee80211_qosframe_htc_addr4)];
55*5113495bSYour Name int hdr_len;
56*5113495bSYour Name uint8_t is_subfrm:1, is_first_subfrm:1, is_msdu_cmpl_mpdu:1;
57*5113495bSYour Name };
58*5113495bSYour Name
59*5113495bSYour Name /**
60*5113495bSYour Name * @brief decap incoming frm from Target to Host OS
61*5113495bSYour Name * acceptable frm format
62*5113495bSYour Name * @details
63*5113495bSYour Name * For native wifi format, the function will remove Qos control field
64*5113495bSYour Name * and HT control field if any.
65*5113495bSYour Name * For 802.3 format, the function will will do llc snap header process
66*5113495bSYour Name * if Target haven't done that.
67*5113495bSYour Name * @param vdev - handle to vdev object
68*5113495bSYour Name * @param peer - the peer object.
69*5113495bSYour Name * @param msdu - qdf_nbuf_t
70*5113495bSYour Name * @param info - ol_rx_decap_info_t: context info for decap
71*5113495bSYour Name * @return
72*5113495bSYour Name * A_OK: decap operation successful
73*5113495bSYour Name * other: operation failed,the msdu need be dropped.
74*5113495bSYour Name */
75*5113495bSYour Name A_STATUS
76*5113495bSYour Name ol_rx_decap(struct ol_txrx_vdev_t *vdev,
77*5113495bSYour Name struct ol_txrx_peer_t *peer,
78*5113495bSYour Name qdf_nbuf_t msdu, struct ol_rx_decap_info_t *info);
79*5113495bSYour Name
80*5113495bSYour Name static inline A_STATUS
OL_TX_ENCAP(struct ol_txrx_vdev_t * vdev,struct ol_tx_desc_t * tx_desc,qdf_nbuf_t msdu,struct ol_txrx_msdu_info_t * msdu_info)81*5113495bSYour Name OL_TX_ENCAP(struct ol_txrx_vdev_t *vdev,
82*5113495bSYour Name struct ol_tx_desc_t *tx_desc,
83*5113495bSYour Name qdf_nbuf_t msdu, struct ol_txrx_msdu_info_t *msdu_info)
84*5113495bSYour Name {
85*5113495bSYour Name if (vdev->pdev->sw_tx_encap)
86*5113495bSYour Name return ol_tx_encap(vdev, tx_desc, msdu, msdu_info);
87*5113495bSYour Name return A_OK;
88*5113495bSYour Name }
89*5113495bSYour Name
90*5113495bSYour Name static inline A_STATUS
OL_RX_DECAP(struct ol_txrx_vdev_t * vdev,struct ol_txrx_peer_t * peer,qdf_nbuf_t msdu,struct ol_rx_decap_info_t * info)91*5113495bSYour Name OL_RX_DECAP(struct ol_txrx_vdev_t *vdev,
92*5113495bSYour Name struct ol_txrx_peer_t *peer,
93*5113495bSYour Name qdf_nbuf_t msdu, struct ol_rx_decap_info_t *info)
94*5113495bSYour Name {
95*5113495bSYour Name if (vdev->pdev->sw_rx_decap)
96*5113495bSYour Name return ol_rx_decap(vdev, peer, msdu, info);
97*5113495bSYour Name return A_OK;
98*5113495bSYour Name }
99*5113495bSYour Name
100*5113495bSYour Name #define OL_TX_RESTORE_HDR(__tx_desc, __msdu) \
101*5113495bSYour Name do { \
102*5113495bSYour Name if (__tx_desc->orig_l2_hdr_bytes != 0) \
103*5113495bSYour Name qdf_nbuf_push_head(__msdu, \
104*5113495bSYour Name __tx_desc->orig_l2_hdr_bytes); \
105*5113495bSYour Name } while (0)
106*5113495bSYour Name #else
107*5113495bSYour Name #define OL_TX_ENCAP(vdev, tx_desc, msdu, msdu_info) A_OK
108*5113495bSYour Name #define OL_RX_DECAP(vdev, peer, msdu, info) A_OK
109*5113495bSYour Name #define OL_TX_RESTORE_HDR(__tx_desc, __msdu)
110*5113495bSYour Name #endif
111*5113495bSYour Name #endif /* _OL_TXRX_ENCAP__H_ */
112