1*5113495bSYour Name /*
2*5113495bSYour Name * Copyright (c) 2011-2021 The Linux Foundation. All rights reserved.
3*5113495bSYour Name * Copyright (c) 2021-2023 Qualcomm Innovation Center, Inc. All rights reserved.
4*5113495bSYour Name *
5*5113495bSYour Name * Permission to use, copy, modify, and/or distribute this software for
6*5113495bSYour Name * any purpose with or without fee is hereby granted, provided that the
7*5113495bSYour Name * above copyright notice and this permission notice appear in all
8*5113495bSYour Name * copies.
9*5113495bSYour Name *
10*5113495bSYour Name * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
11*5113495bSYour Name * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
12*5113495bSYour Name * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
13*5113495bSYour Name * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
14*5113495bSYour Name * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
15*5113495bSYour Name * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
16*5113495bSYour Name * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
17*5113495bSYour Name * PERFORMANCE OF THIS SOFTWARE.
18*5113495bSYour Name */
19*5113495bSYour Name
20*5113495bSYour Name /**
21*5113495bSYour Name * @file htt_h2t.c
22*5113495bSYour Name * @brief Provide functions to send host->target HTT messages.
23*5113495bSYour Name * @details
24*5113495bSYour Name * This file contains functions related to host->target HTT messages.
25*5113495bSYour Name * There are a couple aspects of this host->target messaging:
26*5113495bSYour Name * 1. This file contains the function that is called by HTC when
27*5113495bSYour Name * a host->target send completes.
28*5113495bSYour Name * This send-completion callback is primarily relevant to HL,
29*5113495bSYour Name * to invoke the download scheduler to set up a new download,
30*5113495bSYour Name * and optionally free the tx frame whose download is completed.
31*5113495bSYour Name * For both HL and LL, this completion callback frees up the
32*5113495bSYour Name * HTC_PACKET object used to specify the download.
33*5113495bSYour Name * 2. This file contains functions for creating messages to send
34*5113495bSYour Name * from the host to the target.
35*5113495bSYour Name */
36*5113495bSYour Name
37*5113495bSYour Name #include <qdf_mem.h> /* qdf_mem_copy */
38*5113495bSYour Name #include <qdf_nbuf.h> /* qdf_nbuf_map_single */
39*5113495bSYour Name #include <htc_api.h> /* HTC_PACKET */
40*5113495bSYour Name #include <htc.h> /* HTC_HDR_ALIGNMENT_PADDING */
41*5113495bSYour Name #include <htt.h> /* HTT host->target msg defs */
42*5113495bSYour Name #include <wdi_ipa.h> /* HTT host->target WDI IPA msg defs */
43*5113495bSYour Name #include <ol_txrx_htt_api.h> /* ol_tx_completion_handler, htt_tx_status */
44*5113495bSYour Name #include <ol_htt_tx_api.h>
45*5113495bSYour Name #include <ol_txrx_types.h>
46*5113495bSYour Name #include <ol_tx_send.h>
47*5113495bSYour Name #include <ol_htt_rx_api.h>
48*5113495bSYour Name
49*5113495bSYour Name #include <htt_internal.h>
50*5113495bSYour Name #include <wlan_policy_mgr_api.h>
51*5113495bSYour Name
52*5113495bSYour Name #define HTT_MSG_BUF_SIZE(msg_bytes) \
53*5113495bSYour Name ((msg_bytes) + HTC_HEADER_LEN + HTC_HDR_ALIGNMENT_PADDING)
54*5113495bSYour Name
55*5113495bSYour Name #ifndef container_of
56*5113495bSYour Name #define container_of(ptr, type, member) \
57*5113495bSYour Name ((type *)((char *)(ptr) - (char *)(&((type *)0)->member)))
58*5113495bSYour Name #endif
59*5113495bSYour Name
60*5113495bSYour Name #ifdef ATH_11AC_TXCOMPACT
61*5113495bSYour Name #define HTT_SEND_HTC_PKT(pdev, pkt) \
62*5113495bSYour Name do { \
63*5113495bSYour Name if (htc_send_pkt(pdev->htc_pdev, &pkt->htc_pkt) == \
64*5113495bSYour Name QDF_STATUS_SUCCESS) { \
65*5113495bSYour Name htt_htc_misc_pkt_list_add(pdev, pkt); \
66*5113495bSYour Name } else { \
67*5113495bSYour Name qdf_nbuf_free((qdf_nbuf_t)(pkt->htc_pkt.pNetBufContext)); \
68*5113495bSYour Name htt_htc_pkt_free(pdev, pkt); \
69*5113495bSYour Name } \
70*5113495bSYour Name } while (0)
71*5113495bSYour Name #else
72*5113495bSYour Name #define HTT_SEND_HTC_PKT(pdev, ppkt) \
73*5113495bSYour Name htc_send_pkt(pdev->htc_pdev, &pkt->htc_pkt);
74*5113495bSYour Name #endif
75*5113495bSYour Name
76*5113495bSYour Name
77*5113495bSYour Name static void
htt_h2t_send_complete_free_netbuf(void * pdev,QDF_STATUS status,qdf_nbuf_t netbuf,uint16_t msdu_id)78*5113495bSYour Name htt_h2t_send_complete_free_netbuf(void *pdev, QDF_STATUS status,
79*5113495bSYour Name qdf_nbuf_t netbuf, uint16_t msdu_id)
80*5113495bSYour Name {
81*5113495bSYour Name qdf_nbuf_free(netbuf);
82*5113495bSYour Name }
83*5113495bSYour Name
84*5113495bSYour Name #ifndef QCN7605_SUPPORT
htt_t2h_adjust_bus_target_delta(struct htt_pdev_t * pdev)85*5113495bSYour Name static void htt_t2h_adjust_bus_target_delta(struct htt_pdev_t *pdev)
86*5113495bSYour Name {
87*5113495bSYour Name int32_t credit_delta;
88*5113495bSYour Name
89*5113495bSYour Name if (pdev->cfg.is_high_latency && !pdev->cfg.default_tx_comp_req) {
90*5113495bSYour Name HTT_TX_MUTEX_ACQUIRE(&pdev->credit_mutex);
91*5113495bSYour Name qdf_atomic_add(1, &pdev->htt_tx_credit.bus_delta);
92*5113495bSYour Name credit_delta = htt_tx_credit_update(pdev);
93*5113495bSYour Name HTT_TX_MUTEX_RELEASE(&pdev->credit_mutex);
94*5113495bSYour Name
95*5113495bSYour Name if (credit_delta)
96*5113495bSYour Name ol_tx_credit_completion_handler(pdev->txrx_pdev,
97*5113495bSYour Name credit_delta);
98*5113495bSYour Name }
99*5113495bSYour Name }
100*5113495bSYour Name #else
htt_t2h_adjust_bus_target_delta(struct htt_pdev_t * pdev)101*5113495bSYour Name static void htt_t2h_adjust_bus_target_delta(struct htt_pdev_t *pdev)
102*5113495bSYour Name {
103*5113495bSYour Name /* UNPAUSE OS Q */
104*5113495bSYour Name ol_tx_flow_ct_unpause_os_q(pdev->txrx_pdev);
105*5113495bSYour Name }
106*5113495bSYour Name #endif
107*5113495bSYour Name
htt_h2t_send_complete(void * context,HTC_PACKET * htc_pkt)108*5113495bSYour Name void htt_h2t_send_complete(void *context, HTC_PACKET *htc_pkt)
109*5113495bSYour Name {
110*5113495bSYour Name void (*send_complete_part2)(void *pdev, QDF_STATUS status,
111*5113495bSYour Name qdf_nbuf_t msdu, uint16_t msdu_id);
112*5113495bSYour Name struct htt_pdev_t *pdev = (struct htt_pdev_t *)context;
113*5113495bSYour Name struct htt_htc_pkt *htt_pkt;
114*5113495bSYour Name qdf_nbuf_t netbuf;
115*5113495bSYour Name
116*5113495bSYour Name send_complete_part2 = htc_pkt->pPktContext;
117*5113495bSYour Name
118*5113495bSYour Name htt_pkt = container_of(htc_pkt, struct htt_htc_pkt, htc_pkt);
119*5113495bSYour Name
120*5113495bSYour Name /* process (free or keep) the netbuf that held the message */
121*5113495bSYour Name netbuf = (qdf_nbuf_t) htc_pkt->pNetBufContext;
122*5113495bSYour Name if (send_complete_part2) {
123*5113495bSYour Name send_complete_part2(htt_pkt->pdev_ctxt, htc_pkt->Status, netbuf,
124*5113495bSYour Name htt_pkt->msdu_id);
125*5113495bSYour Name }
126*5113495bSYour Name
127*5113495bSYour Name htt_t2h_adjust_bus_target_delta(pdev);
128*5113495bSYour Name /* free the htt_htc_pkt / HTC_PACKET object */
129*5113495bSYour Name htt_htc_pkt_free(pdev, htt_pkt);
130*5113495bSYour Name }
131*5113495bSYour Name
htt_h2t_full(void * context,HTC_PACKET * pkt)132*5113495bSYour Name enum htc_send_full_action htt_h2t_full(void *context, HTC_PACKET *pkt)
133*5113495bSYour Name {
134*5113495bSYour Name /* FIX THIS */
135*5113495bSYour Name return HTC_SEND_FULL_KEEP;
136*5113495bSYour Name }
137*5113495bSYour Name
138*5113495bSYour Name #if defined(HELIUMPLUS)
htt_h2t_frag_desc_bank_cfg_msg(struct htt_pdev_t * pdev)139*5113495bSYour Name QDF_STATUS htt_h2t_frag_desc_bank_cfg_msg(struct htt_pdev_t *pdev)
140*5113495bSYour Name {
141*5113495bSYour Name QDF_STATUS rc = QDF_STATUS_SUCCESS;
142*5113495bSYour Name
143*5113495bSYour Name struct htt_htc_pkt *pkt;
144*5113495bSYour Name qdf_nbuf_t msg;
145*5113495bSYour Name u_int32_t *msg_word;
146*5113495bSYour Name struct htt_tx_frag_desc_bank_cfg_t *bank_cfg;
147*5113495bSYour Name
148*5113495bSYour Name pkt = htt_htc_pkt_alloc(pdev);
149*5113495bSYour Name if (!pkt)
150*5113495bSYour Name return QDF_STATUS_E_FAILURE; /* failure */
151*5113495bSYour Name
152*5113495bSYour Name /* show that this is not a tx frame download
153*5113495bSYour Name * (not required, but helpful)
154*5113495bSYour Name */
155*5113495bSYour Name pkt->msdu_id = HTT_TX_COMPL_INV_MSDU_ID;
156*5113495bSYour Name pkt->pdev_ctxt = NULL; /* not used during send-done callback */
157*5113495bSYour Name
158*5113495bSYour Name msg = qdf_nbuf_alloc(
159*5113495bSYour Name pdev->osdev,
160*5113495bSYour Name HTT_MSG_BUF_SIZE(sizeof(struct htt_tx_frag_desc_bank_cfg_t)),
161*5113495bSYour Name /* reserve room for the HTC header */
162*5113495bSYour Name HTC_HEADER_LEN + HTC_HDR_ALIGNMENT_PADDING, 4, true);
163*5113495bSYour Name if (!msg) {
164*5113495bSYour Name htt_htc_pkt_free(pdev, pkt);
165*5113495bSYour Name return QDF_STATUS_E_FAILURE; /* failure */
166*5113495bSYour Name }
167*5113495bSYour Name
168*5113495bSYour Name /*
169*5113495bSYour Name * Set the length of the message.
170*5113495bSYour Name * The contribution from the HTC_HDR_ALIGNMENT_PADDING is added
171*5113495bSYour Name * separately during the below call to adf_nbuf_push_head.
172*5113495bSYour Name * The contribution from the HTC header is added separately inside HTC.
173*5113495bSYour Name */
174*5113495bSYour Name qdf_nbuf_put_tail(msg, sizeof(struct htt_tx_frag_desc_bank_cfg_t));
175*5113495bSYour Name
176*5113495bSYour Name /* fill in the message contents */
177*5113495bSYour Name msg_word = (u_int32_t *) qdf_nbuf_data(msg);
178*5113495bSYour Name
179*5113495bSYour Name memset(msg_word, 0, sizeof(struct htt_tx_frag_desc_bank_cfg_t));
180*5113495bSYour Name /* rewind beyond alignment pad to get to the HTC header reserved area */
181*5113495bSYour Name qdf_nbuf_push_head(msg, HTC_HDR_ALIGNMENT_PADDING);
182*5113495bSYour Name
183*5113495bSYour Name *msg_word = 0;
184*5113495bSYour Name HTT_H2T_MSG_TYPE_SET(*msg_word, HTT_H2T_MSG_TYPE_FRAG_DESC_BANK_CFG);
185*5113495bSYour Name
186*5113495bSYour Name bank_cfg = (struct htt_tx_frag_desc_bank_cfg_t *)msg_word;
187*5113495bSYour Name
188*5113495bSYour Name /** @note @todo Hard coded to 0 Assuming just one pdev for now.*/
189*5113495bSYour Name HTT_H2T_FRAG_DESC_BANK_PDEVID_SET(*msg_word, 0);
190*5113495bSYour Name /** @note Hard coded to 1.*/
191*5113495bSYour Name HTT_H2T_FRAG_DESC_BANK_NUM_BANKS_SET(*msg_word, 1);
192*5113495bSYour Name HTT_H2T_FRAG_DESC_BANK_DESC_SIZE_SET(*msg_word, pdev->frag_descs.size);
193*5113495bSYour Name HTT_H2T_FRAG_DESC_BANK_SWAP_SET(*msg_word, 0);
194*5113495bSYour Name
195*5113495bSYour Name /** Bank specific data structure.*/
196*5113495bSYour Name #if HTT_PADDR64
197*5113495bSYour Name bank_cfg->bank_base_address[0].lo = qdf_get_lower_32_bits(
198*5113495bSYour Name pdev->frag_descs.desc_pages.dma_pages->page_p_addr);
199*5113495bSYour Name bank_cfg->bank_base_address[0].hi = qdf_get_upper_32_bits(
200*5113495bSYour Name pdev->frag_descs.desc_pages.dma_pages->page_p_addr);
201*5113495bSYour Name #else /* ! HTT_PADDR64 */
202*5113495bSYour Name bank_cfg->bank_base_address[0] =
203*5113495bSYour Name pdev->frag_descs.desc_pages.dma_pages->page_p_addr;
204*5113495bSYour Name #endif /* HTT_PADDR64 */
205*5113495bSYour Name /* Logical Min index */
206*5113495bSYour Name HTT_H2T_FRAG_DESC_BANK_MIN_IDX_SET(bank_cfg->bank_info[0], 0);
207*5113495bSYour Name /* Logical Max index */
208*5113495bSYour Name HTT_H2T_FRAG_DESC_BANK_MAX_IDX_SET(bank_cfg->bank_info[0],
209*5113495bSYour Name pdev->frag_descs.pool_elems-1);
210*5113495bSYour Name
211*5113495bSYour Name SET_HTC_PACKET_INFO_TX(
212*5113495bSYour Name &pkt->htc_pkt,
213*5113495bSYour Name htt_h2t_send_complete_free_netbuf,
214*5113495bSYour Name qdf_nbuf_data(msg),
215*5113495bSYour Name qdf_nbuf_len(msg),
216*5113495bSYour Name pdev->htc_tx_endpoint,
217*5113495bSYour Name HTC_TX_PACKET_TAG_RUNTIME_PUT);
218*5113495bSYour Name
219*5113495bSYour Name SET_HTC_PACKET_NET_BUF_CONTEXT(&pkt->htc_pkt, msg);
220*5113495bSYour Name
221*5113495bSYour Name rc = htc_send_pkt(pdev->htc_pdev, &pkt->htc_pkt);
222*5113495bSYour Name #ifdef ATH_11AC_TXCOMPACT
223*5113495bSYour Name if (rc == QDF_STATUS_SUCCESS) {
224*5113495bSYour Name htt_htc_misc_pkt_list_add(pdev, pkt);
225*5113495bSYour Name } else {
226*5113495bSYour Name qdf_nbuf_free(msg);
227*5113495bSYour Name htt_htc_pkt_free(pdev, pkt);
228*5113495bSYour Name }
229*5113495bSYour Name #endif
230*5113495bSYour Name
231*5113495bSYour Name return rc;
232*5113495bSYour Name }
233*5113495bSYour Name
234*5113495bSYour Name #endif /* defined(HELIUMPLUS) */
235*5113495bSYour Name
htt_h2t_ver_req_msg(struct htt_pdev_t * pdev)236*5113495bSYour Name QDF_STATUS htt_h2t_ver_req_msg(struct htt_pdev_t *pdev)
237*5113495bSYour Name {
238*5113495bSYour Name struct htt_htc_pkt *pkt;
239*5113495bSYour Name qdf_nbuf_t msg;
240*5113495bSYour Name uint32_t *msg_word;
241*5113495bSYour Name uint32_t msg_size;
242*5113495bSYour Name uint32_t max_tx_group;
243*5113495bSYour Name
244*5113495bSYour Name pkt = htt_htc_pkt_alloc(pdev);
245*5113495bSYour Name if (!pkt)
246*5113495bSYour Name return QDF_STATUS_E_FAILURE; /* failure */
247*5113495bSYour Name
248*5113495bSYour Name max_tx_group = ol_tx_get_max_tx_groups_supported(pdev->txrx_pdev);
249*5113495bSYour Name
250*5113495bSYour Name if (max_tx_group)
251*5113495bSYour Name msg_size = HTT_VER_REQ_BYTES +
252*5113495bSYour Name sizeof(struct htt_option_tlv_mac_tx_queue_groups_t);
253*5113495bSYour Name else
254*5113495bSYour Name msg_size = HTT_VER_REQ_BYTES;
255*5113495bSYour Name
256*5113495bSYour Name /* show that this is not a tx frame download
257*5113495bSYour Name * (not required, but helpful)
258*5113495bSYour Name */
259*5113495bSYour Name pkt->msdu_id = HTT_TX_COMPL_INV_MSDU_ID;
260*5113495bSYour Name pkt->pdev_ctxt = NULL; /* not used during send-done callback */
261*5113495bSYour Name
262*5113495bSYour Name /* reserve room for the HTC header */
263*5113495bSYour Name msg = qdf_nbuf_alloc(pdev->osdev, HTT_MSG_BUF_SIZE(msg_size),
264*5113495bSYour Name HTC_HEADER_LEN + HTC_HDR_ALIGNMENT_PADDING, 4,
265*5113495bSYour Name true);
266*5113495bSYour Name if (!msg) {
267*5113495bSYour Name htt_htc_pkt_free(pdev, pkt);
268*5113495bSYour Name return QDF_STATUS_E_FAILURE; /* failure */
269*5113495bSYour Name }
270*5113495bSYour Name
271*5113495bSYour Name /*
272*5113495bSYour Name * Set the length of the message.
273*5113495bSYour Name * The contribution from the HTC_HDR_ALIGNMENT_PADDING is added
274*5113495bSYour Name * separately during the below call to qdf_nbuf_push_head.
275*5113495bSYour Name * The contribution from the HTC header is added separately inside HTC.
276*5113495bSYour Name */
277*5113495bSYour Name qdf_nbuf_put_tail(msg, msg_size);
278*5113495bSYour Name
279*5113495bSYour Name /* fill in the message contents */
280*5113495bSYour Name msg_word = (uint32_t *) qdf_nbuf_data(msg);
281*5113495bSYour Name
282*5113495bSYour Name /* rewind beyond alignment pad to get to the HTC header reserved area */
283*5113495bSYour Name qdf_nbuf_push_head(msg, HTC_HDR_ALIGNMENT_PADDING);
284*5113495bSYour Name
285*5113495bSYour Name *msg_word = 0;
286*5113495bSYour Name HTT_H2T_MSG_TYPE_SET(*msg_word, HTT_H2T_MSG_TYPE_VERSION_REQ);
287*5113495bSYour Name
288*5113495bSYour Name if (max_tx_group) {
289*5113495bSYour Name *(msg_word + 1) = 0;
290*5113495bSYour Name
291*5113495bSYour Name /* Fill Group Info */
292*5113495bSYour Name HTT_OPTION_TLV_TAG_SET(*(msg_word+1),
293*5113495bSYour Name HTT_OPTION_TLV_TAG_MAX_TX_QUEUE_GROUPS);
294*5113495bSYour Name HTT_OPTION_TLV_LENGTH_SET(*(msg_word+1),
295*5113495bSYour Name (sizeof(struct htt_option_tlv_mac_tx_queue_groups_t)/
296*5113495bSYour Name sizeof(uint32_t)));
297*5113495bSYour Name HTT_OPTION_TLV_VALUE0_SET(*(msg_word+1), max_tx_group);
298*5113495bSYour Name }
299*5113495bSYour Name
300*5113495bSYour Name SET_HTC_PACKET_INFO_TX(&pkt->htc_pkt,
301*5113495bSYour Name htt_h2t_send_complete_free_netbuf,
302*5113495bSYour Name qdf_nbuf_data(msg), qdf_nbuf_len(msg),
303*5113495bSYour Name pdev->htc_tx_endpoint,
304*5113495bSYour Name HTC_TX_PACKET_TAG_RTPM_PUT_RC);
305*5113495bSYour Name
306*5113495bSYour Name SET_HTC_PACKET_NET_BUF_CONTEXT(&pkt->htc_pkt, msg);
307*5113495bSYour Name HTT_SEND_HTC_PKT(pdev, pkt);
308*5113495bSYour Name
309*5113495bSYour Name ol_tx_deduct_one_credit(pdev->txrx_pdev);
310*5113495bSYour Name
311*5113495bSYour Name return QDF_STATUS_SUCCESS;
312*5113495bSYour Name }
313*5113495bSYour Name
314*5113495bSYour Name #if defined(HELIUMPLUS)
315*5113495bSYour Name /**
316*5113495bSYour Name * htt_h2t_rx_ring_rfs_cfg_msg_ll() - Configure receive flow steering
317*5113495bSYour Name * @pdev: handle to the HTT instance
318*5113495bSYour Name *
319*5113495bSYour Name * Return: QDF_STATUS_SUCCESS on success
320*5113495bSYour Name * A_NO_MEMORY No memory fail
321*5113495bSYour Name */
htt_h2t_rx_ring_rfs_cfg_msg_ll(struct htt_pdev_t * pdev)322*5113495bSYour Name QDF_STATUS htt_h2t_rx_ring_rfs_cfg_msg_ll(struct htt_pdev_t *pdev)
323*5113495bSYour Name {
324*5113495bSYour Name struct htt_htc_pkt *pkt;
325*5113495bSYour Name qdf_nbuf_t msg;
326*5113495bSYour Name uint32_t *msg_word;
327*5113495bSYour Name uint32_t msg_local;
328*5113495bSYour Name struct cds_config_info *cds_cfg;
329*5113495bSYour Name
330*5113495bSYour Name QDF_TRACE(QDF_MODULE_ID_HTT, QDF_TRACE_LEVEL_INFO_LOW,
331*5113495bSYour Name "Receive flow steering configuration, disable gEnableFlowSteering(=0) in ini if FW does not support it\n");
332*5113495bSYour Name pkt = htt_htc_pkt_alloc(pdev);
333*5113495bSYour Name if (!pkt)
334*5113495bSYour Name return QDF_STATUS_E_NOMEM; /* failure */
335*5113495bSYour Name
336*5113495bSYour Name pkt->msdu_id = HTT_TX_COMPL_INV_MSDU_ID;
337*5113495bSYour Name pkt->pdev_ctxt = NULL; /* not used during send-done callback */
338*5113495bSYour Name
339*5113495bSYour Name /* reserve room for the HTC header */
340*5113495bSYour Name msg = qdf_nbuf_alloc(pdev->osdev,
341*5113495bSYour Name HTT_MSG_BUF_SIZE(HTT_RFS_CFG_REQ_BYTES),
342*5113495bSYour Name HTC_HEADER_LEN + HTC_HDR_ALIGNMENT_PADDING, 4,
343*5113495bSYour Name true);
344*5113495bSYour Name if (!msg) {
345*5113495bSYour Name htt_htc_pkt_free(pdev, pkt);
346*5113495bSYour Name return QDF_STATUS_E_NOMEM; /* failure */
347*5113495bSYour Name }
348*5113495bSYour Name /*
349*5113495bSYour Name * Set the length of the message.
350*5113495bSYour Name * The contribution from the HTC_HDR_ALIGNMENT_PADDING is added
351*5113495bSYour Name * separately during the below call to qdf_nbuf_push_head.
352*5113495bSYour Name * The contribution from the HTC header is added separately inside HTC.
353*5113495bSYour Name */
354*5113495bSYour Name qdf_nbuf_put_tail(msg, HTT_RFS_CFG_REQ_BYTES);
355*5113495bSYour Name
356*5113495bSYour Name /* fill in the message contents */
357*5113495bSYour Name msg_word = (uint32_t *) qdf_nbuf_data(msg);
358*5113495bSYour Name
359*5113495bSYour Name /* rewind beyond alignment pad to get to the HTC header reserved area */
360*5113495bSYour Name qdf_nbuf_push_head(msg, HTC_HDR_ALIGNMENT_PADDING);
361*5113495bSYour Name
362*5113495bSYour Name msg_local = 0;
363*5113495bSYour Name HTT_H2T_MSG_TYPE_SET(msg_local, HTT_H2T_MSG_TYPE_RFS_CONFIG);
364*5113495bSYour Name if (ol_cfg_is_flow_steering_enabled(pdev->ctrl_pdev)) {
365*5113495bSYour Name HTT_RX_RFS_CONFIG_SET(msg_local, 1);
366*5113495bSYour Name QDF_TRACE(QDF_MODULE_ID_HTT, QDF_TRACE_LEVEL_INFO_LOW,
367*5113495bSYour Name "Enable Rx flow steering");
368*5113495bSYour Name } else {
369*5113495bSYour Name QDF_TRACE(QDF_MODULE_ID_HTT, QDF_TRACE_LEVEL_INFO_LOW,
370*5113495bSYour Name "Disable Rx flow steering");
371*5113495bSYour Name }
372*5113495bSYour Name cds_cfg = cds_get_ini_config();
373*5113495bSYour Name if (cds_cfg) {
374*5113495bSYour Name msg_local |= ((cds_cfg->max_msdus_per_rxinorderind & 0xff)
375*5113495bSYour Name << 16);
376*5113495bSYour Name QDF_TRACE(QDF_MODULE_ID_HTT, QDF_TRACE_LEVEL_INFO_LOW,
377*5113495bSYour Name "Updated maxMSDUsPerRxInd");
378*5113495bSYour Name }
379*5113495bSYour Name
380*5113495bSYour Name *msg_word = msg_local;
381*5113495bSYour Name QDF_TRACE(QDF_MODULE_ID_HTT, QDF_TRACE_LEVEL_INFO_LOW,
382*5113495bSYour Name "%s: Sending msg_word: 0x%08x",
383*5113495bSYour Name __func__, *msg_word);
384*5113495bSYour Name
385*5113495bSYour Name SET_HTC_PACKET_INFO_TX(&pkt->htc_pkt,
386*5113495bSYour Name htt_h2t_send_complete_free_netbuf,
387*5113495bSYour Name qdf_nbuf_data(msg), qdf_nbuf_len(msg),
388*5113495bSYour Name pdev->htc_tx_endpoint,
389*5113495bSYour Name HTC_TX_PACKET_TAG_RUNTIME_PUT);
390*5113495bSYour Name
391*5113495bSYour Name SET_HTC_PACKET_NET_BUF_CONTEXT(&pkt->htc_pkt, msg);
392*5113495bSYour Name HTT_SEND_HTC_PKT(pdev, pkt);
393*5113495bSYour Name return QDF_STATUS_SUCCESS;
394*5113495bSYour Name }
395*5113495bSYour Name #else
396*5113495bSYour Name /**
397*5113495bSYour Name * htt_h2t_rx_ring_rfs_cfg_msg_ll() - Configure receive flow steering
398*5113495bSYour Name * @pdev: handle to the HTT instance
399*5113495bSYour Name *
400*5113495bSYour Name * Return: QDF_STATUS_SUCCESS on success
401*5113495bSYour Name * A_NO_MEMORY No memory fail
402*5113495bSYour Name */
htt_h2t_rx_ring_rfs_cfg_msg_ll(struct htt_pdev_t * pdev)403*5113495bSYour Name QDF_STATUS htt_h2t_rx_ring_rfs_cfg_msg_ll(struct htt_pdev_t *pdev)
404*5113495bSYour Name {
405*5113495bSYour Name QDF_TRACE(QDF_MODULE_ID_HTT, QDF_TRACE_LEVEL_INFO,
406*5113495bSYour Name "Does not support receive flow steering configuration\n");
407*5113495bSYour Name return QDF_STATUS_SUCCESS;
408*5113495bSYour Name }
409*5113495bSYour Name #endif /* HELIUMPLUS */
410*5113495bSYour Name
htt_h2t_rx_ring_cfg_msg_ll(struct htt_pdev_t * pdev)411*5113495bSYour Name QDF_STATUS htt_h2t_rx_ring_cfg_msg_ll(struct htt_pdev_t *pdev)
412*5113495bSYour Name {
413*5113495bSYour Name struct htt_htc_pkt *pkt;
414*5113495bSYour Name qdf_nbuf_t msg;
415*5113495bSYour Name uint32_t *msg_word;
416*5113495bSYour Name int enable_ctrl_data, enable_mgmt_data,
417*5113495bSYour Name enable_null_data, enable_phy_data, enable_hdr,
418*5113495bSYour Name enable_ppdu_start, enable_ppdu_end;
419*5113495bSYour Name
420*5113495bSYour Name pkt = htt_htc_pkt_alloc(pdev);
421*5113495bSYour Name if (!pkt)
422*5113495bSYour Name return QDF_STATUS_E_FAILURE; /* failure */
423*5113495bSYour Name
424*5113495bSYour Name /*
425*5113495bSYour Name * show that this is not a tx frame download
426*5113495bSYour Name * (not required, but helpful)
427*5113495bSYour Name */
428*5113495bSYour Name pkt->msdu_id = HTT_TX_COMPL_INV_MSDU_ID;
429*5113495bSYour Name pkt->pdev_ctxt = NULL; /* not used during send-done callback */
430*5113495bSYour Name
431*5113495bSYour Name /* reserve room for the HTC header */
432*5113495bSYour Name msg = qdf_nbuf_alloc(pdev->osdev,
433*5113495bSYour Name HTT_MSG_BUF_SIZE(HTT_RX_RING_CFG_BYTES(1)),
434*5113495bSYour Name HTC_HEADER_LEN + HTC_HDR_ALIGNMENT_PADDING, 4,
435*5113495bSYour Name true);
436*5113495bSYour Name if (!msg) {
437*5113495bSYour Name htt_htc_pkt_free(pdev, pkt);
438*5113495bSYour Name return QDF_STATUS_E_FAILURE; /* failure */
439*5113495bSYour Name }
440*5113495bSYour Name /*
441*5113495bSYour Name * Set the length of the message.
442*5113495bSYour Name * The contribution from the HTC_HDR_ALIGNMENT_PADDING is added
443*5113495bSYour Name * separately during the below call to qdf_nbuf_push_head.
444*5113495bSYour Name * The contribution from the HTC header is added separately inside HTC.
445*5113495bSYour Name */
446*5113495bSYour Name qdf_nbuf_put_tail(msg, HTT_RX_RING_CFG_BYTES(1));
447*5113495bSYour Name
448*5113495bSYour Name /* fill in the message contents */
449*5113495bSYour Name msg_word = (uint32_t *) qdf_nbuf_data(msg);
450*5113495bSYour Name
451*5113495bSYour Name /* rewind beyond alignment pad to get to the HTC header reserved area */
452*5113495bSYour Name qdf_nbuf_push_head(msg, HTC_HDR_ALIGNMENT_PADDING);
453*5113495bSYour Name
454*5113495bSYour Name *msg_word = 0;
455*5113495bSYour Name HTT_H2T_MSG_TYPE_SET(*msg_word, HTT_H2T_MSG_TYPE_RX_RING_CFG);
456*5113495bSYour Name HTT_RX_RING_CFG_NUM_RINGS_SET(*msg_word, 1);
457*5113495bSYour Name
458*5113495bSYour Name msg_word++;
459*5113495bSYour Name *msg_word = 0;
460*5113495bSYour Name #if HTT_PADDR64
461*5113495bSYour Name HTT_RX_RING_CFG_IDX_SHADOW_REG_PADDR_LO_SET(
462*5113495bSYour Name *msg_word,
463*5113495bSYour Name qdf_get_lower_32_bits(pdev->rx_ring.alloc_idx.paddr));
464*5113495bSYour Name msg_word++;
465*5113495bSYour Name HTT_RX_RING_CFG_IDX_SHADOW_REG_PADDR_HI_SET(
466*5113495bSYour Name *msg_word,
467*5113495bSYour Name qdf_get_upper_32_bits(pdev->rx_ring.alloc_idx.paddr));
468*5113495bSYour Name #else /* ! HTT_PADDR64 */
469*5113495bSYour Name HTT_RX_RING_CFG_IDX_SHADOW_REG_PADDR_SET(*msg_word,
470*5113495bSYour Name pdev->rx_ring.alloc_idx.paddr);
471*5113495bSYour Name #endif /* HTT_PADDR64 */
472*5113495bSYour Name
473*5113495bSYour Name msg_word++;
474*5113495bSYour Name *msg_word = 0;
475*5113495bSYour Name #if HTT_PADDR64
476*5113495bSYour Name HTT_RX_RING_CFG_BASE_PADDR_LO_SET(*msg_word,
477*5113495bSYour Name pdev->rx_ring.base_paddr);
478*5113495bSYour Name {
479*5113495bSYour Name uint32_t tmp;
480*5113495bSYour Name
481*5113495bSYour Name tmp = qdf_get_upper_32_bits(pdev->rx_ring.base_paddr);
482*5113495bSYour Name if (tmp & 0xfffffe0) {
483*5113495bSYour Name QDF_TRACE(QDF_MODULE_ID_HTT, QDF_TRACE_LEVEL_INFO,
484*5113495bSYour Name "%s:%d paddr > 37 bits!. Trimmed.",
485*5113495bSYour Name __func__, __LINE__);
486*5113495bSYour Name tmp &= 0x01f;
487*5113495bSYour Name }
488*5113495bSYour Name
489*5113495bSYour Name
490*5113495bSYour Name msg_word++;
491*5113495bSYour Name HTT_RX_RING_CFG_BASE_PADDR_HI_SET(*msg_word, tmp);
492*5113495bSYour Name }
493*5113495bSYour Name #else /* ! HTT_PADDR64 */
494*5113495bSYour Name HTT_RX_RING_CFG_BASE_PADDR_SET(*msg_word, pdev->rx_ring.base_paddr);
495*5113495bSYour Name #endif /* HTT_PADDR64 */
496*5113495bSYour Name
497*5113495bSYour Name msg_word++;
498*5113495bSYour Name *msg_word = 0;
499*5113495bSYour Name HTT_RX_RING_CFG_LEN_SET(*msg_word, pdev->rx_ring.size);
500*5113495bSYour Name HTT_RX_RING_CFG_BUF_SZ_SET(*msg_word, HTT_RX_BUF_SIZE);
501*5113495bSYour Name
502*5113495bSYour Name /* FIX THIS: if the FW creates a complete translated rx descriptor,
503*5113495bSYour Name * then the MAC DMA of the HW rx descriptor should be disabled.
504*5113495bSYour Name */
505*5113495bSYour Name msg_word++;
506*5113495bSYour Name *msg_word = 0;
507*5113495bSYour Name #ifndef REMOVE_PKT_LOG
508*5113495bSYour Name if (ol_cfg_is_packet_log_enabled(pdev->ctrl_pdev)) {
509*5113495bSYour Name enable_ctrl_data = 1;
510*5113495bSYour Name enable_mgmt_data = 1;
511*5113495bSYour Name enable_null_data = 1;
512*5113495bSYour Name enable_phy_data = 1;
513*5113495bSYour Name enable_hdr = 1;
514*5113495bSYour Name enable_ppdu_start = 1;
515*5113495bSYour Name enable_ppdu_end = 1;
516*5113495bSYour Name QDF_TRACE(QDF_MODULE_ID_HTT, QDF_TRACE_LEVEL_INFO_LOW,
517*5113495bSYour Name "%s : %d Pkt log is enabled\n", __func__, __LINE__);
518*5113495bSYour Name } else {
519*5113495bSYour Name QDF_TRACE(QDF_MODULE_ID_HTT, QDF_TRACE_LEVEL_INFO,
520*5113495bSYour Name "%s : %d Pkt log is disabled\n", __func__, __LINE__);
521*5113495bSYour Name enable_ctrl_data = 0;
522*5113495bSYour Name enable_mgmt_data = 0;
523*5113495bSYour Name enable_null_data = 0;
524*5113495bSYour Name enable_phy_data = 0;
525*5113495bSYour Name enable_hdr = 0;
526*5113495bSYour Name enable_ppdu_start = 0;
527*5113495bSYour Name enable_ppdu_end = 0;
528*5113495bSYour Name }
529*5113495bSYour Name #else
530*5113495bSYour Name enable_ctrl_data = 0;
531*5113495bSYour Name enable_mgmt_data = 0;
532*5113495bSYour Name enable_null_data = 0;
533*5113495bSYour Name enable_phy_data = 0;
534*5113495bSYour Name enable_hdr = 0;
535*5113495bSYour Name enable_ppdu_start = 0;
536*5113495bSYour Name enable_ppdu_end = 0;
537*5113495bSYour Name #endif
538*5113495bSYour Name if (QDF_GLOBAL_MONITOR_MODE == cds_get_conparam()) {
539*5113495bSYour Name enable_ctrl_data = 1;
540*5113495bSYour Name enable_mgmt_data = 1;
541*5113495bSYour Name enable_null_data = 1;
542*5113495bSYour Name enable_phy_data = 1;
543*5113495bSYour Name enable_hdr = 1;
544*5113495bSYour Name enable_ppdu_start = 1;
545*5113495bSYour Name enable_ppdu_end = 1;
546*5113495bSYour Name /* Disable ASPM for monitor mode */
547*5113495bSYour Name QDF_TRACE(QDF_MODULE_ID_HTT, QDF_TRACE_LEVEL_INFO,
548*5113495bSYour Name "%s : %d Monitor mode is enabled\n",
549*5113495bSYour Name __func__, __LINE__);
550*5113495bSYour Name }
551*5113495bSYour Name
552*5113495bSYour Name htt_rx_enable_ppdu_end(&enable_ppdu_end);
553*5113495bSYour Name HTT_RX_RING_CFG_ENABLED_802_11_HDR_SET(*msg_word, enable_hdr);
554*5113495bSYour Name HTT_RX_RING_CFG_ENABLED_MSDU_PAYLD_SET(*msg_word, 1);
555*5113495bSYour Name HTT_RX_RING_CFG_ENABLED_PPDU_START_SET(*msg_word, enable_ppdu_start);
556*5113495bSYour Name HTT_RX_RING_CFG_ENABLED_PPDU_END_SET(*msg_word, enable_ppdu_end);
557*5113495bSYour Name HTT_RX_RING_CFG_ENABLED_MPDU_START_SET(*msg_word, 1);
558*5113495bSYour Name HTT_RX_RING_CFG_ENABLED_MPDU_END_SET(*msg_word, 1);
559*5113495bSYour Name HTT_RX_RING_CFG_ENABLED_MSDU_START_SET(*msg_word, 1);
560*5113495bSYour Name HTT_RX_RING_CFG_ENABLED_MSDU_END_SET(*msg_word, 1);
561*5113495bSYour Name HTT_RX_RING_CFG_ENABLED_RX_ATTN_SET(*msg_word, 1);
562*5113495bSYour Name /* always present? */
563*5113495bSYour Name HTT_RX_RING_CFG_ENABLED_FRAG_INFO_SET(*msg_word, 1);
564*5113495bSYour Name HTT_RX_RING_CFG_ENABLED_UCAST_SET(*msg_word, 1);
565*5113495bSYour Name HTT_RX_RING_CFG_ENABLED_MCAST_SET(*msg_word, 1);
566*5113495bSYour Name /* Must change to dynamic enable at run time
567*5113495bSYour Name * rather than at compile time
568*5113495bSYour Name */
569*5113495bSYour Name HTT_RX_RING_CFG_ENABLED_CTRL_SET(*msg_word, enable_ctrl_data);
570*5113495bSYour Name HTT_RX_RING_CFG_ENABLED_MGMT_SET(*msg_word, enable_mgmt_data);
571*5113495bSYour Name HTT_RX_RING_CFG_ENABLED_NULL_SET(*msg_word, enable_null_data);
572*5113495bSYour Name HTT_RX_RING_CFG_ENABLED_PHY_SET(*msg_word, enable_phy_data);
573*5113495bSYour Name HTT_RX_RING_CFG_IDX_INIT_VAL_SET(*msg_word,
574*5113495bSYour Name *pdev->rx_ring.alloc_idx.vaddr);
575*5113495bSYour Name
576*5113495bSYour Name msg_word++;
577*5113495bSYour Name *msg_word = 0;
578*5113495bSYour Name HTT_RX_RING_CFG_OFFSET_802_11_HDR_SET(*msg_word,
579*5113495bSYour Name RX_DESC_HDR_STATUS_OFFSET32);
580*5113495bSYour Name HTT_RX_RING_CFG_OFFSET_MSDU_PAYLD_SET(*msg_word,
581*5113495bSYour Name HTT_RX_DESC_RESERVATION32);
582*5113495bSYour Name
583*5113495bSYour Name msg_word++;
584*5113495bSYour Name *msg_word = 0;
585*5113495bSYour Name HTT_RX_RING_CFG_OFFSET_PPDU_START_SET(*msg_word,
586*5113495bSYour Name RX_DESC_PPDU_START_OFFSET32);
587*5113495bSYour Name HTT_RX_RING_CFG_OFFSET_PPDU_END_SET(*msg_word,
588*5113495bSYour Name RX_DESC_PPDU_END_OFFSET32);
589*5113495bSYour Name
590*5113495bSYour Name msg_word++;
591*5113495bSYour Name *msg_word = 0;
592*5113495bSYour Name HTT_RX_RING_CFG_OFFSET_MPDU_START_SET(*msg_word,
593*5113495bSYour Name RX_DESC_MPDU_START_OFFSET32);
594*5113495bSYour Name HTT_RX_RING_CFG_OFFSET_MPDU_END_SET(*msg_word,
595*5113495bSYour Name RX_DESC_MPDU_END_OFFSET32);
596*5113495bSYour Name
597*5113495bSYour Name msg_word++;
598*5113495bSYour Name *msg_word = 0;
599*5113495bSYour Name HTT_RX_RING_CFG_OFFSET_MSDU_START_SET(*msg_word,
600*5113495bSYour Name RX_DESC_MSDU_START_OFFSET32);
601*5113495bSYour Name HTT_RX_RING_CFG_OFFSET_MSDU_END_SET(*msg_word,
602*5113495bSYour Name RX_DESC_MSDU_END_OFFSET32);
603*5113495bSYour Name
604*5113495bSYour Name msg_word++;
605*5113495bSYour Name *msg_word = 0;
606*5113495bSYour Name HTT_RX_RING_CFG_OFFSET_RX_ATTN_SET(*msg_word,
607*5113495bSYour Name RX_DESC_ATTN_OFFSET32);
608*5113495bSYour Name HTT_RX_RING_CFG_OFFSET_FRAG_INFO_SET(*msg_word,
609*5113495bSYour Name RX_DESC_FRAG_INFO_OFFSET32);
610*5113495bSYour Name
611*5113495bSYour Name SET_HTC_PACKET_INFO_TX(&pkt->htc_pkt,
612*5113495bSYour Name htt_h2t_send_complete_free_netbuf,
613*5113495bSYour Name qdf_nbuf_data(msg),
614*5113495bSYour Name qdf_nbuf_len(msg),
615*5113495bSYour Name pdev->htc_tx_endpoint,
616*5113495bSYour Name HTC_TX_PACKET_TAG_RUNTIME_PUT);
617*5113495bSYour Name
618*5113495bSYour Name SET_HTC_PACKET_NET_BUF_CONTEXT(&pkt->htc_pkt, msg);
619*5113495bSYour Name HTT_SEND_HTC_PKT(pdev, pkt);
620*5113495bSYour Name return QDF_STATUS_SUCCESS;
621*5113495bSYour Name }
622*5113495bSYour Name
623*5113495bSYour Name QDF_STATUS
htt_h2t_rx_ring_cfg_msg_hl(struct htt_pdev_t * pdev)624*5113495bSYour Name htt_h2t_rx_ring_cfg_msg_hl(struct htt_pdev_t *pdev)
625*5113495bSYour Name {
626*5113495bSYour Name struct htt_htc_pkt *pkt;
627*5113495bSYour Name qdf_nbuf_t msg;
628*5113495bSYour Name u_int32_t *msg_word;
629*5113495bSYour Name
630*5113495bSYour Name pkt = htt_htc_pkt_alloc(pdev);
631*5113495bSYour Name if (!pkt)
632*5113495bSYour Name return A_ERROR; /* failure */
633*5113495bSYour Name
634*5113495bSYour Name /*
635*5113495bSYour Name * show that this is not a tx frame download
636*5113495bSYour Name * (not required, but helpful)
637*5113495bSYour Name */
638*5113495bSYour Name pkt->msdu_id = HTT_TX_COMPL_INV_MSDU_ID;
639*5113495bSYour Name pkt->pdev_ctxt = NULL; /* not used during send-done callback */
640*5113495bSYour Name
641*5113495bSYour Name msg = qdf_nbuf_alloc(
642*5113495bSYour Name pdev->osdev,
643*5113495bSYour Name HTT_MSG_BUF_SIZE(HTT_RX_RING_CFG_BYTES(1)),
644*5113495bSYour Name /* reserve room for the HTC header */
645*5113495bSYour Name HTC_HEADER_LEN + HTC_HDR_ALIGNMENT_PADDING, 4, true);
646*5113495bSYour Name if (!msg) {
647*5113495bSYour Name htt_htc_pkt_free(pdev, pkt);
648*5113495bSYour Name return A_ERROR; /* failure */
649*5113495bSYour Name }
650*5113495bSYour Name /*
651*5113495bSYour Name * Set the length of the message.
652*5113495bSYour Name * The contribution from the HTC_HDR_ALIGNMENT_PADDING is added
653*5113495bSYour Name * separately during the below call to adf_nbuf_push_head.
654*5113495bSYour Name * The contribution from the HTC header is added separately inside HTC.
655*5113495bSYour Name */
656*5113495bSYour Name qdf_nbuf_put_tail(msg, HTT_RX_RING_CFG_BYTES(1));
657*5113495bSYour Name
658*5113495bSYour Name /* fill in the message contents */
659*5113495bSYour Name msg_word = (u_int32_t *)qdf_nbuf_data(msg);
660*5113495bSYour Name
661*5113495bSYour Name /* rewind beyond alignment pad to get to the HTC header reserved area */
662*5113495bSYour Name qdf_nbuf_push_head(msg, HTC_HDR_ALIGNMENT_PADDING);
663*5113495bSYour Name
664*5113495bSYour Name *msg_word = 0;
665*5113495bSYour Name HTT_H2T_MSG_TYPE_SET(*msg_word, HTT_H2T_MSG_TYPE_RX_RING_CFG);
666*5113495bSYour Name HTT_RX_RING_CFG_NUM_RINGS_SET(*msg_word, 1);
667*5113495bSYour Name
668*5113495bSYour Name msg_word++;
669*5113495bSYour Name *msg_word = 0;
670*5113495bSYour Name HTT_RX_RING_CFG_IDX_SHADOW_REG_PADDR_SET(
671*5113495bSYour Name *msg_word, pdev->rx_ring.alloc_idx.paddr);
672*5113495bSYour Name
673*5113495bSYour Name msg_word++;
674*5113495bSYour Name *msg_word = 0;
675*5113495bSYour Name HTT_RX_RING_CFG_BASE_PADDR_SET(*msg_word, pdev->rx_ring.base_paddr);
676*5113495bSYour Name
677*5113495bSYour Name msg_word++;
678*5113495bSYour Name *msg_word = 0;
679*5113495bSYour Name HTT_RX_RING_CFG_LEN_SET(*msg_word, pdev->rx_ring.size);
680*5113495bSYour Name HTT_RX_RING_CFG_BUF_SZ_SET(*msg_word, HTT_RX_BUF_SIZE);
681*5113495bSYour Name
682*5113495bSYour Name /* FIX THIS: if the FW creates a complete translated rx descriptor,
683*5113495bSYour Name * then the MAC DMA of the HW rx descriptor should be disabled. */
684*5113495bSYour Name msg_word++;
685*5113495bSYour Name *msg_word = 0;
686*5113495bSYour Name
687*5113495bSYour Name HTT_RX_RING_CFG_ENABLED_802_11_HDR_SET(*msg_word, 0);
688*5113495bSYour Name HTT_RX_RING_CFG_ENABLED_MSDU_PAYLD_SET(*msg_word, 1);
689*5113495bSYour Name HTT_RX_RING_CFG_ENABLED_PPDU_START_SET(*msg_word, 0);
690*5113495bSYour Name HTT_RX_RING_CFG_ENABLED_PPDU_END_SET(*msg_word, 0);
691*5113495bSYour Name HTT_RX_RING_CFG_ENABLED_MPDU_START_SET(*msg_word, 0);
692*5113495bSYour Name HTT_RX_RING_CFG_ENABLED_MPDU_END_SET(*msg_word, 0);
693*5113495bSYour Name HTT_RX_RING_CFG_ENABLED_MSDU_START_SET(*msg_word, 0);
694*5113495bSYour Name HTT_RX_RING_CFG_ENABLED_MSDU_END_SET(*msg_word, 0);
695*5113495bSYour Name HTT_RX_RING_CFG_ENABLED_RX_ATTN_SET(*msg_word, 0);
696*5113495bSYour Name /* always present? */
697*5113495bSYour Name HTT_RX_RING_CFG_ENABLED_FRAG_INFO_SET(*msg_word, 0);
698*5113495bSYour Name HTT_RX_RING_CFG_ENABLED_UCAST_SET(*msg_word, 1);
699*5113495bSYour Name HTT_RX_RING_CFG_ENABLED_MCAST_SET(*msg_word, 1);
700*5113495bSYour Name /* Must change to dynamic enable at run time
701*5113495bSYour Name * rather than at compile time
702*5113495bSYour Name */
703*5113495bSYour Name HTT_RX_RING_CFG_ENABLED_CTRL_SET(*msg_word, 0);
704*5113495bSYour Name HTT_RX_RING_CFG_ENABLED_MGMT_SET(*msg_word, 0);
705*5113495bSYour Name HTT_RX_RING_CFG_ENABLED_NULL_SET(*msg_word, 0);
706*5113495bSYour Name HTT_RX_RING_CFG_ENABLED_PHY_SET(*msg_word, 0);
707*5113495bSYour Name
708*5113495bSYour Name msg_word++;
709*5113495bSYour Name *msg_word = 0;
710*5113495bSYour Name HTT_RX_RING_CFG_OFFSET_802_11_HDR_SET(*msg_word,
711*5113495bSYour Name 0);
712*5113495bSYour Name HTT_RX_RING_CFG_OFFSET_MSDU_PAYLD_SET(*msg_word,
713*5113495bSYour Name 0);
714*5113495bSYour Name
715*5113495bSYour Name msg_word++;
716*5113495bSYour Name *msg_word = 0;
717*5113495bSYour Name HTT_RX_RING_CFG_OFFSET_PPDU_START_SET(*msg_word,
718*5113495bSYour Name 0);
719*5113495bSYour Name HTT_RX_RING_CFG_OFFSET_PPDU_END_SET(*msg_word,
720*5113495bSYour Name 0);
721*5113495bSYour Name
722*5113495bSYour Name msg_word++;
723*5113495bSYour Name *msg_word = 0;
724*5113495bSYour Name HTT_RX_RING_CFG_OFFSET_MPDU_START_SET(*msg_word,
725*5113495bSYour Name 0);
726*5113495bSYour Name HTT_RX_RING_CFG_OFFSET_MPDU_END_SET(*msg_word,
727*5113495bSYour Name 0);
728*5113495bSYour Name
729*5113495bSYour Name msg_word++;
730*5113495bSYour Name *msg_word = 0;
731*5113495bSYour Name HTT_RX_RING_CFG_OFFSET_MSDU_START_SET(*msg_word,
732*5113495bSYour Name 0);
733*5113495bSYour Name HTT_RX_RING_CFG_OFFSET_MSDU_END_SET(*msg_word,
734*5113495bSYour Name 0);
735*5113495bSYour Name
736*5113495bSYour Name msg_word++;
737*5113495bSYour Name *msg_word = 0;
738*5113495bSYour Name HTT_RX_RING_CFG_OFFSET_RX_ATTN_SET(*msg_word,
739*5113495bSYour Name 0);
740*5113495bSYour Name HTT_RX_RING_CFG_OFFSET_FRAG_INFO_SET(*msg_word,
741*5113495bSYour Name 0);
742*5113495bSYour Name
743*5113495bSYour Name SET_HTC_PACKET_INFO_TX(
744*5113495bSYour Name &pkt->htc_pkt,
745*5113495bSYour Name htt_h2t_send_complete_free_netbuf,
746*5113495bSYour Name qdf_nbuf_data(msg),
747*5113495bSYour Name qdf_nbuf_len(msg),
748*5113495bSYour Name pdev->htc_tx_endpoint,
749*5113495bSYour Name 1); /* tag - not relevant here */
750*5113495bSYour Name
751*5113495bSYour Name SET_HTC_PACKET_NET_BUF_CONTEXT(&pkt->htc_pkt, msg);
752*5113495bSYour Name
753*5113495bSYour Name #ifdef ATH_11AC_TXCOMPACT
754*5113495bSYour Name if (htc_send_pkt(pdev->htc_pdev, &pkt->htc_pkt) == QDF_STATUS_SUCCESS) {
755*5113495bSYour Name htt_htc_misc_pkt_list_add(pdev, pkt);
756*5113495bSYour Name } else {
757*5113495bSYour Name qdf_nbuf_free(msg);
758*5113495bSYour Name htt_htc_pkt_free(pdev, pkt);
759*5113495bSYour Name }
760*5113495bSYour Name #else
761*5113495bSYour Name htc_send_pkt(pdev->htc_pdev, &pkt->htc_pkt);
762*5113495bSYour Name #endif
763*5113495bSYour Name
764*5113495bSYour Name ol_tx_deduct_one_credit(pdev->txrx_pdev);
765*5113495bSYour Name
766*5113495bSYour Name return QDF_STATUS_SUCCESS;
767*5113495bSYour Name }
768*5113495bSYour Name
769*5113495bSYour Name /**
770*5113495bSYour Name * htt_h2t_rx_ring_rfs_cfg_msg_hl() - Configure receive flow steering
771*5113495bSYour Name * @pdev: handle to the HTT instance
772*5113495bSYour Name *
773*5113495bSYour Name * Return: QDF_STATUS_SUCCESS on success
774*5113495bSYour Name * A_NO_MEMORY No memory fail
775*5113495bSYour Name */
htt_h2t_rx_ring_rfs_cfg_msg_hl(struct htt_pdev_t * pdev)776*5113495bSYour Name QDF_STATUS htt_h2t_rx_ring_rfs_cfg_msg_hl(struct htt_pdev_t *pdev)
777*5113495bSYour Name {
778*5113495bSYour Name QDF_TRACE(QDF_MODULE_ID_HTT, QDF_TRACE_LEVEL_INFO,
779*5113495bSYour Name "Does not support Receive flow steering configuration\n");
780*5113495bSYour Name return QDF_STATUS_SUCCESS;
781*5113495bSYour Name }
782*5113495bSYour Name
783*5113495bSYour Name int
htt_h2t_dbg_stats_get(struct htt_pdev_t * pdev,uint32_t stats_type_upload_mask,uint32_t stats_type_reset_mask,uint8_t cfg_stat_type,uint32_t cfg_val,uint8_t cookie)784*5113495bSYour Name htt_h2t_dbg_stats_get(struct htt_pdev_t *pdev,
785*5113495bSYour Name uint32_t stats_type_upload_mask,
786*5113495bSYour Name uint32_t stats_type_reset_mask,
787*5113495bSYour Name uint8_t cfg_stat_type, uint32_t cfg_val, uint8_t cookie)
788*5113495bSYour Name {
789*5113495bSYour Name struct htt_htc_pkt *pkt;
790*5113495bSYour Name qdf_nbuf_t msg;
791*5113495bSYour Name uint32_t *msg_word;
792*5113495bSYour Name uint16_t htc_tag = 1;
793*5113495bSYour Name
794*5113495bSYour Name pkt = htt_htc_pkt_alloc(pdev);
795*5113495bSYour Name if (!pkt)
796*5113495bSYour Name return -EINVAL; /* failure */
797*5113495bSYour Name
798*5113495bSYour Name if (stats_type_upload_mask >= 1 << HTT_DBG_NUM_STATS ||
799*5113495bSYour Name stats_type_reset_mask >= 1 << HTT_DBG_NUM_STATS) {
800*5113495bSYour Name /* FIX THIS - add more details? */
801*5113495bSYour Name QDF_TRACE(QDF_MODULE_ID_HTT, QDF_TRACE_LEVEL_ERROR,
802*5113495bSYour Name "%#x %#x stats not supported\n",
803*5113495bSYour Name stats_type_upload_mask, stats_type_reset_mask);
804*5113495bSYour Name htt_htc_pkt_free(pdev, pkt);
805*5113495bSYour Name return -EINVAL; /* failure */
806*5113495bSYour Name }
807*5113495bSYour Name
808*5113495bSYour Name if (stats_type_reset_mask)
809*5113495bSYour Name htc_tag = HTC_TX_PACKET_TAG_RUNTIME_PUT;
810*5113495bSYour Name
811*5113495bSYour Name /* show that this is not a tx frame download
812*5113495bSYour Name * (not required, but helpful)
813*5113495bSYour Name */
814*5113495bSYour Name pkt->msdu_id = HTT_TX_COMPL_INV_MSDU_ID;
815*5113495bSYour Name pkt->pdev_ctxt = NULL; /* not used during send-done callback */
816*5113495bSYour Name
817*5113495bSYour Name
818*5113495bSYour Name msg = qdf_nbuf_alloc(pdev->osdev,
819*5113495bSYour Name HTT_MSG_BUF_SIZE(HTT_H2T_STATS_REQ_MSG_SZ),
820*5113495bSYour Name /* reserve room for HTC header */
821*5113495bSYour Name HTC_HEADER_LEN + HTC_HDR_ALIGNMENT_PADDING, 4,
822*5113495bSYour Name false);
823*5113495bSYour Name if (!msg) {
824*5113495bSYour Name htt_htc_pkt_free(pdev, pkt);
825*5113495bSYour Name return -EINVAL; /* failure */
826*5113495bSYour Name }
827*5113495bSYour Name /* set the length of the message */
828*5113495bSYour Name qdf_nbuf_put_tail(msg, HTT_H2T_STATS_REQ_MSG_SZ);
829*5113495bSYour Name
830*5113495bSYour Name /* fill in the message contents */
831*5113495bSYour Name msg_word = (uint32_t *) qdf_nbuf_data(msg);
832*5113495bSYour Name
833*5113495bSYour Name /* rewind beyond alignment pad to get to the HTC header reserved area */
834*5113495bSYour Name qdf_nbuf_push_head(msg, HTC_HDR_ALIGNMENT_PADDING);
835*5113495bSYour Name
836*5113495bSYour Name *msg_word = 0;
837*5113495bSYour Name HTT_H2T_MSG_TYPE_SET(*msg_word, HTT_H2T_MSG_TYPE_STATS_REQ);
838*5113495bSYour Name HTT_H2T_STATS_REQ_UPLOAD_TYPES_SET(*msg_word, stats_type_upload_mask);
839*5113495bSYour Name
840*5113495bSYour Name msg_word++;
841*5113495bSYour Name *msg_word = 0;
842*5113495bSYour Name HTT_H2T_STATS_REQ_RESET_TYPES_SET(*msg_word, stats_type_reset_mask);
843*5113495bSYour Name
844*5113495bSYour Name msg_word++;
845*5113495bSYour Name *msg_word = 0;
846*5113495bSYour Name HTT_H2T_STATS_REQ_CFG_VAL_SET(*msg_word, cfg_val);
847*5113495bSYour Name HTT_H2T_STATS_REQ_CFG_STAT_TYPE_SET(*msg_word, cfg_stat_type);
848*5113495bSYour Name
849*5113495bSYour Name /* cookie LSBs */
850*5113495bSYour Name msg_word++;
851*5113495bSYour Name *msg_word = cookie;
852*5113495bSYour Name
853*5113495bSYour Name /* cookie MSBs */
854*5113495bSYour Name msg_word++;
855*5113495bSYour Name *msg_word = 0;
856*5113495bSYour Name
857*5113495bSYour Name SET_HTC_PACKET_INFO_TX(&pkt->htc_pkt,
858*5113495bSYour Name htt_h2t_send_complete_free_netbuf,
859*5113495bSYour Name qdf_nbuf_data(msg),
860*5113495bSYour Name qdf_nbuf_len(msg),
861*5113495bSYour Name pdev->htc_tx_endpoint,
862*5113495bSYour Name htc_tag); /* tag - not relevant here */
863*5113495bSYour Name
864*5113495bSYour Name SET_HTC_PACKET_NET_BUF_CONTEXT(&pkt->htc_pkt, msg);
865*5113495bSYour Name
866*5113495bSYour Name #ifdef ATH_11AC_TXCOMPACT
867*5113495bSYour Name if (htc_send_pkt(pdev->htc_pdev, &pkt->htc_pkt) == QDF_STATUS_SUCCESS) {
868*5113495bSYour Name htt_htc_misc_pkt_list_add(pdev, pkt);
869*5113495bSYour Name } else {
870*5113495bSYour Name qdf_nbuf_free(msg);
871*5113495bSYour Name htt_htc_pkt_free(pdev, pkt);
872*5113495bSYour Name }
873*5113495bSYour Name #else
874*5113495bSYour Name htc_send_pkt(pdev->htc_pdev, &pkt->htc_pkt);
875*5113495bSYour Name #endif
876*5113495bSYour Name
877*5113495bSYour Name ol_tx_deduct_one_credit(pdev->txrx_pdev);
878*5113495bSYour Name
879*5113495bSYour Name return 0;
880*5113495bSYour Name }
881*5113495bSYour Name
htt_h2t_sync_msg(struct htt_pdev_t * pdev,uint8_t sync_cnt)882*5113495bSYour Name A_STATUS htt_h2t_sync_msg(struct htt_pdev_t *pdev, uint8_t sync_cnt)
883*5113495bSYour Name {
884*5113495bSYour Name struct htt_htc_pkt *pkt;
885*5113495bSYour Name qdf_nbuf_t msg;
886*5113495bSYour Name uint32_t *msg_word;
887*5113495bSYour Name
888*5113495bSYour Name pkt = htt_htc_pkt_alloc(pdev);
889*5113495bSYour Name if (!pkt)
890*5113495bSYour Name return A_NO_MEMORY;
891*5113495bSYour Name
892*5113495bSYour Name /* show that this is not a tx frame download
893*5113495bSYour Name (not required, but helpful)
894*5113495bSYour Name */
895*5113495bSYour Name pkt->msdu_id = HTT_TX_COMPL_INV_MSDU_ID;
896*5113495bSYour Name pkt->pdev_ctxt = NULL; /* not used during send-done callback */
897*5113495bSYour Name
898*5113495bSYour Name /* reserve room for HTC header */
899*5113495bSYour Name msg = qdf_nbuf_alloc(pdev->osdev, HTT_MSG_BUF_SIZE(HTT_H2T_SYNC_MSG_SZ),
900*5113495bSYour Name HTC_HEADER_LEN + HTC_HDR_ALIGNMENT_PADDING, 4,
901*5113495bSYour Name false);
902*5113495bSYour Name if (!msg) {
903*5113495bSYour Name htt_htc_pkt_free(pdev, pkt);
904*5113495bSYour Name return A_NO_MEMORY;
905*5113495bSYour Name }
906*5113495bSYour Name /* set the length of the message */
907*5113495bSYour Name qdf_nbuf_put_tail(msg, HTT_H2T_SYNC_MSG_SZ);
908*5113495bSYour Name
909*5113495bSYour Name /* fill in the message contents */
910*5113495bSYour Name msg_word = (uint32_t *) qdf_nbuf_data(msg);
911*5113495bSYour Name
912*5113495bSYour Name /* rewind beyond alignment pad to get to the HTC header reserved area */
913*5113495bSYour Name qdf_nbuf_push_head(msg, HTC_HDR_ALIGNMENT_PADDING);
914*5113495bSYour Name
915*5113495bSYour Name *msg_word = 0;
916*5113495bSYour Name HTT_H2T_MSG_TYPE_SET(*msg_word, HTT_H2T_MSG_TYPE_SYNC);
917*5113495bSYour Name HTT_H2T_SYNC_COUNT_SET(*msg_word, sync_cnt);
918*5113495bSYour Name
919*5113495bSYour Name SET_HTC_PACKET_INFO_TX(&pkt->htc_pkt,
920*5113495bSYour Name htt_h2t_send_complete_free_netbuf,
921*5113495bSYour Name qdf_nbuf_data(msg),
922*5113495bSYour Name qdf_nbuf_len(msg),
923*5113495bSYour Name pdev->htc_tx_endpoint,
924*5113495bSYour Name HTC_TX_PACKET_TAG_RUNTIME_PUT);
925*5113495bSYour Name
926*5113495bSYour Name SET_HTC_PACKET_NET_BUF_CONTEXT(&pkt->htc_pkt, msg);
927*5113495bSYour Name HTT_SEND_HTC_PKT(pdev, pkt);
928*5113495bSYour Name
929*5113495bSYour Name ol_tx_deduct_one_credit(pdev->txrx_pdev);
930*5113495bSYour Name
931*5113495bSYour Name return A_OK;
932*5113495bSYour Name }
933*5113495bSYour Name
934*5113495bSYour Name int
htt_h2t_aggr_cfg_msg(struct htt_pdev_t * pdev,int max_subfrms_ampdu,int max_subfrms_amsdu)935*5113495bSYour Name htt_h2t_aggr_cfg_msg(struct htt_pdev_t *pdev,
936*5113495bSYour Name int max_subfrms_ampdu, int max_subfrms_amsdu)
937*5113495bSYour Name {
938*5113495bSYour Name struct htt_htc_pkt *pkt;
939*5113495bSYour Name qdf_nbuf_t msg;
940*5113495bSYour Name uint32_t *msg_word;
941*5113495bSYour Name
942*5113495bSYour Name pkt = htt_htc_pkt_alloc(pdev);
943*5113495bSYour Name if (!pkt)
944*5113495bSYour Name return -EINVAL; /* failure */
945*5113495bSYour Name
946*5113495bSYour Name /* show that this is not a tx frame download
947*5113495bSYour Name * (not required, but helpful)
948*5113495bSYour Name */
949*5113495bSYour Name pkt->msdu_id = HTT_TX_COMPL_INV_MSDU_ID;
950*5113495bSYour Name pkt->pdev_ctxt = NULL; /* not used during send-done callback */
951*5113495bSYour Name
952*5113495bSYour Name /* reserve room for HTC header */
953*5113495bSYour Name msg = qdf_nbuf_alloc(pdev->osdev, HTT_MSG_BUF_SIZE(HTT_AGGR_CFG_MSG_SZ),
954*5113495bSYour Name HTC_HEADER_LEN + HTC_HDR_ALIGNMENT_PADDING, 4,
955*5113495bSYour Name false);
956*5113495bSYour Name if (!msg) {
957*5113495bSYour Name htt_htc_pkt_free(pdev, pkt);
958*5113495bSYour Name return -EINVAL; /* failure */
959*5113495bSYour Name }
960*5113495bSYour Name /* set the length of the message */
961*5113495bSYour Name qdf_nbuf_put_tail(msg, HTT_AGGR_CFG_MSG_SZ);
962*5113495bSYour Name
963*5113495bSYour Name /* fill in the message contents */
964*5113495bSYour Name msg_word = (uint32_t *) qdf_nbuf_data(msg);
965*5113495bSYour Name
966*5113495bSYour Name /* rewind beyond alignment pad to get to the HTC header reserved area */
967*5113495bSYour Name qdf_nbuf_push_head(msg, HTC_HDR_ALIGNMENT_PADDING);
968*5113495bSYour Name
969*5113495bSYour Name *msg_word = 0;
970*5113495bSYour Name HTT_H2T_MSG_TYPE_SET(*msg_word, HTT_H2T_MSG_TYPE_AGGR_CFG);
971*5113495bSYour Name
972*5113495bSYour Name if (max_subfrms_ampdu && (max_subfrms_ampdu <= 64)) {
973*5113495bSYour Name HTT_AGGR_CFG_MAX_NUM_AMPDU_SUBFRM_SET(*msg_word,
974*5113495bSYour Name max_subfrms_ampdu);
975*5113495bSYour Name }
976*5113495bSYour Name
977*5113495bSYour Name if (max_subfrms_amsdu && (max_subfrms_amsdu < 32)) {
978*5113495bSYour Name HTT_AGGR_CFG_MAX_NUM_AMSDU_SUBFRM_SET(*msg_word,
979*5113495bSYour Name max_subfrms_amsdu);
980*5113495bSYour Name }
981*5113495bSYour Name
982*5113495bSYour Name SET_HTC_PACKET_INFO_TX(&pkt->htc_pkt,
983*5113495bSYour Name htt_h2t_send_complete_free_netbuf,
984*5113495bSYour Name qdf_nbuf_data(msg),
985*5113495bSYour Name qdf_nbuf_len(msg),
986*5113495bSYour Name pdev->htc_tx_endpoint,
987*5113495bSYour Name HTC_TX_PACKET_TAG_RUNTIME_PUT);
988*5113495bSYour Name
989*5113495bSYour Name SET_HTC_PACKET_NET_BUF_CONTEXT(&pkt->htc_pkt, msg);
990*5113495bSYour Name
991*5113495bSYour Name #ifdef ATH_11AC_TXCOMPACT
992*5113495bSYour Name if (htc_send_pkt(pdev->htc_pdev, &pkt->htc_pkt) == QDF_STATUS_SUCCESS) {
993*5113495bSYour Name htt_htc_misc_pkt_list_add(pdev, pkt);
994*5113495bSYour Name } else {
995*5113495bSYour Name qdf_nbuf_free(msg);
996*5113495bSYour Name htt_htc_pkt_free(pdev, pkt);
997*5113495bSYour Name }
998*5113495bSYour Name #else
999*5113495bSYour Name htc_send_pkt(pdev->htc_pdev, &pkt->htc_pkt);
1000*5113495bSYour Name #endif
1001*5113495bSYour Name
1002*5113495bSYour Name ol_tx_deduct_one_credit(pdev->txrx_pdev);
1003*5113495bSYour Name
1004*5113495bSYour Name return 0;
1005*5113495bSYour Name }
1006*5113495bSYour Name
1007*5113495bSYour Name #ifdef IPA_OFFLOAD
1008*5113495bSYour Name /**
1009*5113495bSYour Name * htt_h2t_ipa_uc_rsc_cfg_msg() - Send WDI IPA config message to firmware
1010*5113495bSYour Name * @pdev: handle to the HTT instance
1011*5113495bSYour Name *
1012*5113495bSYour Name * Return: 0 success
1013*5113495bSYour Name * A_NO_MEMORY No memory fail
1014*5113495bSYour Name */
1015*5113495bSYour Name #ifdef QCA_WIFI_3_0
htt_h2t_ipa_uc_rsc_cfg_msg(struct htt_pdev_t * pdev)1016*5113495bSYour Name int htt_h2t_ipa_uc_rsc_cfg_msg(struct htt_pdev_t *pdev)
1017*5113495bSYour Name {
1018*5113495bSYour Name struct htt_htc_pkt *pkt;
1019*5113495bSYour Name qdf_nbuf_t msg;
1020*5113495bSYour Name uint32_t *msg_word;
1021*5113495bSYour Name unsigned int tx_count = 0;
1022*5113495bSYour Name uint32_t addr;
1023*5113495bSYour Name qdf_mem_info_t *mem_info_t;
1024*5113495bSYour Name
1025*5113495bSYour Name pkt = htt_htc_pkt_alloc(pdev);
1026*5113495bSYour Name if (!pkt)
1027*5113495bSYour Name return -A_NO_MEMORY;
1028*5113495bSYour Name
1029*5113495bSYour Name /* show that this is not a tx frame download
1030*5113495bSYour Name * (not required, but helpful)
1031*5113495bSYour Name */
1032*5113495bSYour Name pkt->msdu_id = HTT_TX_COMPL_INV_MSDU_ID;
1033*5113495bSYour Name pkt->pdev_ctxt = NULL; /* not used during send-done callback */
1034*5113495bSYour Name
1035*5113495bSYour Name /* reserve room for HTC header */
1036*5113495bSYour Name msg = qdf_nbuf_alloc(pdev->osdev, HTT_MSG_BUF_SIZE(HTT_WDI_IPA_CFG_SZ),
1037*5113495bSYour Name HTC_HEADER_LEN + HTC_HDR_ALIGNMENT_PADDING, 4,
1038*5113495bSYour Name false);
1039*5113495bSYour Name if (!msg) {
1040*5113495bSYour Name htt_htc_pkt_free(pdev, pkt);
1041*5113495bSYour Name return -A_NO_MEMORY;
1042*5113495bSYour Name }
1043*5113495bSYour Name /* set the length of the message */
1044*5113495bSYour Name qdf_nbuf_put_tail(msg, HTT_WDI_IPA_CFG_SZ);
1045*5113495bSYour Name
1046*5113495bSYour Name /* fill in the message contents */
1047*5113495bSYour Name msg_word = (uint32_t *) qdf_nbuf_data(msg);
1048*5113495bSYour Name
1049*5113495bSYour Name /* rewind beyond alignment pad to get to the HTC header reserved area */
1050*5113495bSYour Name qdf_nbuf_push_head(msg, HTC_HDR_ALIGNMENT_PADDING);
1051*5113495bSYour Name
1052*5113495bSYour Name *msg_word = 0;
1053*5113495bSYour Name HTT_WDI_IPA_CFG_TX_PKT_POOL_SIZE_SET(*msg_word,
1054*5113495bSYour Name pdev->ipa_uc_tx_rsc.alloc_tx_buf_cnt);
1055*5113495bSYour Name HTT_H2T_MSG_TYPE_SET(*msg_word, HTT_H2T_MSG_TYPE_WDI_IPA_CFG);
1056*5113495bSYour Name
1057*5113495bSYour Name msg_word++;
1058*5113495bSYour Name *msg_word = 0;
1059*5113495bSYour Name HTT_WDI_IPA_CFG_TX_COMP_RING_BASE_ADDR_LO_SET(*msg_word,
1060*5113495bSYour Name (unsigned int)qdf_mem_get_dma_addr(pdev->osdev,
1061*5113495bSYour Name &pdev->ipa_uc_tx_rsc.tx_comp_ring->mem_info));
1062*5113495bSYour Name msg_word++;
1063*5113495bSYour Name *msg_word = 0;
1064*5113495bSYour Name mem_info_t = &pdev->ipa_uc_tx_rsc.tx_comp_ring->mem_info;
1065*5113495bSYour Name addr = (uint64_t)qdf_mem_get_dma_addr(pdev->osdev, mem_info_t) >> 32;
1066*5113495bSYour Name HTT_WDI_IPA_CFG_TX_COMP_RING_BASE_ADDR_HI_SET(*msg_word, addr);
1067*5113495bSYour Name
1068*5113495bSYour Name msg_word++;
1069*5113495bSYour Name *msg_word = 0;
1070*5113495bSYour Name tx_count = qdf_get_pwr2(ol_cfg_ipa_uc_tx_max_buf_cnt(pdev->ctrl_pdev));
1071*5113495bSYour Name HTT_WDI_IPA_CFG_TX_COMP_RING_SIZE_SET(*msg_word, tx_count);
1072*5113495bSYour Name
1073*5113495bSYour Name msg_word++;
1074*5113495bSYour Name *msg_word = 0;
1075*5113495bSYour Name HTT_WDI_IPA_CFG_TX_COMP_WR_IDX_ADDR_LO_SET(*msg_word,
1076*5113495bSYour Name (unsigned int)pdev->ipa_uc_tx_rsc.tx_comp_idx_paddr);
1077*5113495bSYour Name msg_word++;
1078*5113495bSYour Name *msg_word = 0;
1079*5113495bSYour Name addr = (uint64_t)pdev->ipa_uc_tx_rsc.tx_comp_idx_paddr >> 32;
1080*5113495bSYour Name HTT_WDI_IPA_CFG_TX_COMP_WR_IDX_ADDR_HI_SET(*msg_word, addr);
1081*5113495bSYour Name
1082*5113495bSYour Name msg_word++;
1083*5113495bSYour Name *msg_word = 0;
1084*5113495bSYour Name HTT_WDI_IPA_CFG_TX_CE_WR_IDX_ADDR_LO_SET(*msg_word,
1085*5113495bSYour Name (unsigned int)qdf_mem_get_dma_addr(pdev->osdev,
1086*5113495bSYour Name &pdev->ipa_uc_tx_rsc.tx_ce_idx->mem_info));
1087*5113495bSYour Name msg_word++;
1088*5113495bSYour Name *msg_word = 0;
1089*5113495bSYour Name mem_info_t = &pdev->ipa_uc_tx_rsc.tx_ce_idx->mem_info;
1090*5113495bSYour Name addr = (uint64_t)qdf_mem_get_dma_addr(pdev->osdev, mem_info_t) >> 32;
1091*5113495bSYour Name HTT_WDI_IPA_CFG_TX_CE_WR_IDX_ADDR_HI_SET(*msg_word, addr);
1092*5113495bSYour Name
1093*5113495bSYour Name msg_word++;
1094*5113495bSYour Name *msg_word = 0;
1095*5113495bSYour Name HTT_WDI_IPA_CFG_RX_IND_RING_BASE_ADDR_LO_SET(*msg_word,
1096*5113495bSYour Name (unsigned int)qdf_mem_get_dma_addr(pdev->osdev,
1097*5113495bSYour Name &pdev->ipa_uc_rx_rsc.rx_ind_ring->mem_info));
1098*5113495bSYour Name msg_word++;
1099*5113495bSYour Name *msg_word = 0;
1100*5113495bSYour Name mem_info_t = &pdev->ipa_uc_rx_rsc.rx_ind_ring->mem_info;
1101*5113495bSYour Name addr = (uint64_t)qdf_mem_get_dma_addr(pdev->osdev, mem_info_t) >> 32;
1102*5113495bSYour Name HTT_WDI_IPA_CFG_RX_IND_RING_BASE_ADDR_HI_SET(*msg_word, addr);
1103*5113495bSYour Name
1104*5113495bSYour Name msg_word++;
1105*5113495bSYour Name *msg_word = 0;
1106*5113495bSYour Name HTT_WDI_IPA_CFG_RX_IND_RING_SIZE_SET(*msg_word,
1107*5113495bSYour Name (unsigned int)qdf_get_pwr2(pdev->rx_ring.fill_level));
1108*5113495bSYour Name
1109*5113495bSYour Name msg_word++;
1110*5113495bSYour Name *msg_word = 0;
1111*5113495bSYour Name HTT_WDI_IPA_CFG_RX_IND_RD_IDX_ADDR_LO_SET(*msg_word,
1112*5113495bSYour Name (unsigned int)qdf_mem_get_dma_addr(pdev->osdev,
1113*5113495bSYour Name &pdev->ipa_uc_rx_rsc.rx_ipa_prc_done_idx->mem_info));
1114*5113495bSYour Name msg_word++;
1115*5113495bSYour Name *msg_word = 0;
1116*5113495bSYour Name mem_info_t = &pdev->ipa_uc_rx_rsc.rx_ipa_prc_done_idx->mem_info;
1117*5113495bSYour Name addr = (uint64_t)qdf_mem_get_dma_addr(pdev->osdev, mem_info_t) >> 32;
1118*5113495bSYour Name HTT_WDI_IPA_CFG_RX_IND_RD_IDX_ADDR_HI_SET(*msg_word, addr);
1119*5113495bSYour Name
1120*5113495bSYour Name msg_word++;
1121*5113495bSYour Name *msg_word = 0;
1122*5113495bSYour Name HTT_WDI_IPA_CFG_RX_IND_WR_IDX_ADDR_LO_SET(*msg_word,
1123*5113495bSYour Name (unsigned int)pdev->ipa_uc_rx_rsc.rx_rdy_idx_paddr);
1124*5113495bSYour Name msg_word++;
1125*5113495bSYour Name *msg_word = 0;
1126*5113495bSYour Name addr = (uint64_t)pdev->ipa_uc_rx_rsc.rx_rdy_idx_paddr >> 32;
1127*5113495bSYour Name HTT_WDI_IPA_CFG_RX_IND_WR_IDX_ADDR_HI_SET(*msg_word, addr);
1128*5113495bSYour Name
1129*5113495bSYour Name msg_word++;
1130*5113495bSYour Name *msg_word = 0;
1131*5113495bSYour Name HTT_WDI_IPA_CFG_RX_RING2_BASE_ADDR_LO_SET(*msg_word,
1132*5113495bSYour Name (unsigned int)qdf_mem_get_dma_addr(pdev->osdev,
1133*5113495bSYour Name &pdev->ipa_uc_rx_rsc.rx2_ind_ring->mem_info));
1134*5113495bSYour Name msg_word++;
1135*5113495bSYour Name *msg_word = 0;
1136*5113495bSYour Name mem_info_t = &pdev->ipa_uc_rx_rsc.rx2_ind_ring->mem_info;
1137*5113495bSYour Name addr = (uint64_t)qdf_mem_get_dma_addr(pdev->osdev, mem_info_t) >> 32;
1138*5113495bSYour Name HTT_WDI_IPA_CFG_RX_RING2_BASE_ADDR_HI_SET(*msg_word, addr);
1139*5113495bSYour Name
1140*5113495bSYour Name msg_word++;
1141*5113495bSYour Name *msg_word = 0;
1142*5113495bSYour Name HTT_WDI_IPA_CFG_RX_RING2_SIZE_SET(*msg_word,
1143*5113495bSYour Name (unsigned int)qdf_get_pwr2(pdev->rx_ring.fill_level));
1144*5113495bSYour Name
1145*5113495bSYour Name msg_word++;
1146*5113495bSYour Name *msg_word = 0;
1147*5113495bSYour Name HTT_WDI_IPA_CFG_RX_RING2_RD_IDX_ADDR_LO_SET(*msg_word,
1148*5113495bSYour Name (unsigned int)qdf_mem_get_dma_addr(pdev->osdev,
1149*5113495bSYour Name &pdev->ipa_uc_rx_rsc.rx2_ipa_prc_done_idx->mem_info));
1150*5113495bSYour Name msg_word++;
1151*5113495bSYour Name *msg_word = 0;
1152*5113495bSYour Name mem_info_t = &pdev->ipa_uc_rx_rsc.rx2_ipa_prc_done_idx->mem_info;
1153*5113495bSYour Name addr = (uint64_t)qdf_mem_get_dma_addr(pdev->osdev, mem_info_t) >> 32;
1154*5113495bSYour Name HTT_WDI_IPA_CFG_RX_RING2_RD_IDX_ADDR_HI_SET(*msg_word, addr);
1155*5113495bSYour Name
1156*5113495bSYour Name msg_word++;
1157*5113495bSYour Name *msg_word = 0;
1158*5113495bSYour Name HTT_WDI_IPA_CFG_RX_RING2_WR_IDX_ADDR_LO_SET(*msg_word,
1159*5113495bSYour Name (unsigned int)qdf_mem_get_dma_addr(pdev->osdev,
1160*5113495bSYour Name &pdev->ipa_uc_rx_rsc.rx2_ipa_prc_done_idx->mem_info));
1161*5113495bSYour Name msg_word++;
1162*5113495bSYour Name *msg_word = 0;
1163*5113495bSYour Name mem_info_t = &pdev->ipa_uc_rx_rsc.rx2_ipa_prc_done_idx->mem_info;
1164*5113495bSYour Name addr = (uint64_t)qdf_mem_get_dma_addr(pdev->osdev, mem_info_t) >> 32;
1165*5113495bSYour Name HTT_WDI_IPA_CFG_RX_RING2_WR_IDX_ADDR_HI_SET(*msg_word, addr);
1166*5113495bSYour Name
1167*5113495bSYour Name SET_HTC_PACKET_INFO_TX(&pkt->htc_pkt,
1168*5113495bSYour Name htt_h2t_send_complete_free_netbuf,
1169*5113495bSYour Name qdf_nbuf_data(msg),
1170*5113495bSYour Name qdf_nbuf_len(msg),
1171*5113495bSYour Name pdev->htc_tx_endpoint,
1172*5113495bSYour Name HTC_TX_PACKET_TAG_RUNTIME_PUT);
1173*5113495bSYour Name
1174*5113495bSYour Name SET_HTC_PACKET_NET_BUF_CONTEXT(&pkt->htc_pkt, msg);
1175*5113495bSYour Name HTT_SEND_HTC_PKT(pdev, pkt);
1176*5113495bSYour Name return A_OK;
1177*5113495bSYour Name }
1178*5113495bSYour Name #else
1179*5113495bSYour Name /* Rome Support only WDI 1.0 */
htt_h2t_ipa_uc_rsc_cfg_msg(struct htt_pdev_t * pdev)1180*5113495bSYour Name int htt_h2t_ipa_uc_rsc_cfg_msg(struct htt_pdev_t *pdev)
1181*5113495bSYour Name {
1182*5113495bSYour Name struct htt_htc_pkt *pkt;
1183*5113495bSYour Name qdf_nbuf_t msg;
1184*5113495bSYour Name uint32_t *msg_word;
1185*5113495bSYour Name
1186*5113495bSYour Name pkt = htt_htc_pkt_alloc(pdev);
1187*5113495bSYour Name if (!pkt)
1188*5113495bSYour Name return A_NO_MEMORY;
1189*5113495bSYour Name
1190*5113495bSYour Name /* show that this is not a tx frame download
1191*5113495bSYour Name * (not required, but helpful)
1192*5113495bSYour Name */
1193*5113495bSYour Name pkt->msdu_id = HTT_TX_COMPL_INV_MSDU_ID;
1194*5113495bSYour Name pkt->pdev_ctxt = NULL; /* not used during send-done callback */
1195*5113495bSYour Name
1196*5113495bSYour Name /* reserve room for HTC header */
1197*5113495bSYour Name msg = qdf_nbuf_alloc(pdev->osdev, HTT_MSG_BUF_SIZE(HTT_WDI_IPA_CFG_SZ),
1198*5113495bSYour Name HTC_HEADER_LEN + HTC_HDR_ALIGNMENT_PADDING, 4,
1199*5113495bSYour Name false);
1200*5113495bSYour Name if (!msg) {
1201*5113495bSYour Name htt_htc_pkt_free(pdev, pkt);
1202*5113495bSYour Name return A_NO_MEMORY;
1203*5113495bSYour Name }
1204*5113495bSYour Name /* set the length of the message */
1205*5113495bSYour Name qdf_nbuf_put_tail(msg, HTT_WDI_IPA_CFG_SZ);
1206*5113495bSYour Name
1207*5113495bSYour Name /* fill in the message contents */
1208*5113495bSYour Name msg_word = (uint32_t *) qdf_nbuf_data(msg);
1209*5113495bSYour Name
1210*5113495bSYour Name /* rewind beyond alignment pad to get to the HTC header reserved area */
1211*5113495bSYour Name qdf_nbuf_push_head(msg, HTC_HDR_ALIGNMENT_PADDING);
1212*5113495bSYour Name
1213*5113495bSYour Name *msg_word = 0;
1214*5113495bSYour Name HTT_WDI_IPA_CFG_TX_PKT_POOL_SIZE_SET(*msg_word,
1215*5113495bSYour Name pdev->ipa_uc_tx_rsc.alloc_tx_buf_cnt);
1216*5113495bSYour Name HTT_H2T_MSG_TYPE_SET(*msg_word, HTT_H2T_MSG_TYPE_WDI_IPA_CFG);
1217*5113495bSYour Name
1218*5113495bSYour Name msg_word++;
1219*5113495bSYour Name *msg_word = 0;
1220*5113495bSYour Name HTT_WDI_IPA_CFG_TX_COMP_RING_BASE_ADDR_SET(*msg_word,
1221*5113495bSYour Name (unsigned int)qdf_mem_get_dma_addr(pdev->osdev,
1222*5113495bSYour Name &pdev->ipa_uc_tx_rsc.tx_comp_ring->mem_info));
1223*5113495bSYour Name
1224*5113495bSYour Name msg_word++;
1225*5113495bSYour Name *msg_word = 0;
1226*5113495bSYour Name HTT_WDI_IPA_CFG_TX_COMP_RING_SIZE_SET(
1227*5113495bSYour Name *msg_word,
1228*5113495bSYour Name (unsigned int)ol_cfg_ipa_uc_tx_max_buf_cnt(pdev->ctrl_pdev));
1229*5113495bSYour Name
1230*5113495bSYour Name msg_word++;
1231*5113495bSYour Name *msg_word = 0;
1232*5113495bSYour Name HTT_WDI_IPA_CFG_TX_COMP_WR_IDX_ADDR_SET(*msg_word,
1233*5113495bSYour Name (unsigned int)pdev->ipa_uc_tx_rsc.tx_comp_idx_paddr);
1234*5113495bSYour Name
1235*5113495bSYour Name msg_word++;
1236*5113495bSYour Name *msg_word = 0;
1237*5113495bSYour Name HTT_WDI_IPA_CFG_TX_CE_WR_IDX_ADDR_SET(*msg_word,
1238*5113495bSYour Name (unsigned int)qdf_mem_get_dma_addr(pdev->osdev,
1239*5113495bSYour Name &pdev->ipa_uc_tx_rsc.tx_ce_idx->mem_info));
1240*5113495bSYour Name
1241*5113495bSYour Name msg_word++;
1242*5113495bSYour Name *msg_word = 0;
1243*5113495bSYour Name HTT_WDI_IPA_CFG_RX_IND_RING_BASE_ADDR_SET(*msg_word,
1244*5113495bSYour Name (unsigned int)qdf_mem_get_dma_addr(pdev->osdev,
1245*5113495bSYour Name &pdev->ipa_uc_rx_rsc.rx_ind_ring->mem_info));
1246*5113495bSYour Name
1247*5113495bSYour Name msg_word++;
1248*5113495bSYour Name *msg_word = 0;
1249*5113495bSYour Name HTT_WDI_IPA_CFG_RX_IND_RING_SIZE_SET(*msg_word,
1250*5113495bSYour Name (unsigned int)qdf_get_pwr2(pdev->rx_ring.fill_level));
1251*5113495bSYour Name
1252*5113495bSYour Name msg_word++;
1253*5113495bSYour Name *msg_word = 0;
1254*5113495bSYour Name HTT_WDI_IPA_CFG_RX_IND_RD_IDX_ADDR_SET(*msg_word,
1255*5113495bSYour Name (unsigned int)qdf_mem_get_dma_addr(pdev->osdev,
1256*5113495bSYour Name &pdev->ipa_uc_rx_rsc.rx_ipa_prc_done_idx->mem_info));
1257*5113495bSYour Name
1258*5113495bSYour Name msg_word++;
1259*5113495bSYour Name *msg_word = 0;
1260*5113495bSYour Name HTT_WDI_IPA_CFG_RX_IND_WR_IDX_ADDR_SET(*msg_word,
1261*5113495bSYour Name (unsigned int)pdev->ipa_uc_rx_rsc.rx_rdy_idx_paddr);
1262*5113495bSYour Name
1263*5113495bSYour Name SET_HTC_PACKET_INFO_TX(&pkt->htc_pkt,
1264*5113495bSYour Name htt_h2t_send_complete_free_netbuf,
1265*5113495bSYour Name qdf_nbuf_data(msg),
1266*5113495bSYour Name qdf_nbuf_len(msg),
1267*5113495bSYour Name pdev->htc_tx_endpoint,
1268*5113495bSYour Name HTC_TX_PACKET_TAG_RUNTIME_PUT);
1269*5113495bSYour Name
1270*5113495bSYour Name SET_HTC_PACKET_NET_BUF_CONTEXT(&pkt->htc_pkt, msg);
1271*5113495bSYour Name HTT_SEND_HTC_PKT(pdev, pkt);
1272*5113495bSYour Name return A_OK;
1273*5113495bSYour Name }
1274*5113495bSYour Name #endif
1275*5113495bSYour Name
1276*5113495bSYour Name /**
1277*5113495bSYour Name * htt_h2t_ipa_uc_set_active() - Propagate WDI path enable/disable to firmware
1278*5113495bSYour Name * @pdev: handle to the HTT instance
1279*5113495bSYour Name * @uc_active: WDI UC path enable or not
1280*5113495bSYour Name * @is_tx: TX path or RX path
1281*5113495bSYour Name *
1282*5113495bSYour Name * Return: 0 success
1283*5113495bSYour Name * A_NO_MEMORY No memory fail
1284*5113495bSYour Name */
htt_h2t_ipa_uc_set_active(struct htt_pdev_t * pdev,bool uc_active,bool is_tx)1285*5113495bSYour Name int htt_h2t_ipa_uc_set_active(struct htt_pdev_t *pdev,
1286*5113495bSYour Name bool uc_active, bool is_tx)
1287*5113495bSYour Name {
1288*5113495bSYour Name struct htt_htc_pkt *pkt;
1289*5113495bSYour Name qdf_nbuf_t msg;
1290*5113495bSYour Name uint32_t *msg_word;
1291*5113495bSYour Name uint8_t active_target = 0;
1292*5113495bSYour Name
1293*5113495bSYour Name pkt = htt_htc_pkt_alloc(pdev);
1294*5113495bSYour Name if (!pkt)
1295*5113495bSYour Name return -A_NO_MEMORY;
1296*5113495bSYour Name
1297*5113495bSYour Name /* show that this is not a tx frame download
1298*5113495bSYour Name * (not required, but helpful)
1299*5113495bSYour Name */
1300*5113495bSYour Name pkt->msdu_id = HTT_TX_COMPL_INV_MSDU_ID;
1301*5113495bSYour Name pkt->pdev_ctxt = NULL; /* not used during send-done callback */
1302*5113495bSYour Name
1303*5113495bSYour Name /* reserve room for HTC header */
1304*5113495bSYour Name msg = qdf_nbuf_alloc(pdev->osdev,
1305*5113495bSYour Name HTT_MSG_BUF_SIZE(HTT_WDI_IPA_OP_REQUEST_SZ),
1306*5113495bSYour Name HTC_HEADER_LEN + HTC_HDR_ALIGNMENT_PADDING, 4,
1307*5113495bSYour Name false);
1308*5113495bSYour Name if (!msg) {
1309*5113495bSYour Name htt_htc_pkt_free(pdev, pkt);
1310*5113495bSYour Name return -A_NO_MEMORY;
1311*5113495bSYour Name }
1312*5113495bSYour Name /* set the length of the message */
1313*5113495bSYour Name qdf_nbuf_put_tail(msg, HTT_WDI_IPA_OP_REQUEST_SZ);
1314*5113495bSYour Name
1315*5113495bSYour Name /* fill in the message contents */
1316*5113495bSYour Name msg_word = (uint32_t *) qdf_nbuf_data(msg);
1317*5113495bSYour Name
1318*5113495bSYour Name /* rewind beyond alignment pad to get to the HTC header reserved area */
1319*5113495bSYour Name qdf_nbuf_push_head(msg, HTC_HDR_ALIGNMENT_PADDING);
1320*5113495bSYour Name
1321*5113495bSYour Name *msg_word = 0;
1322*5113495bSYour Name if (uc_active && is_tx)
1323*5113495bSYour Name active_target = HTT_WDI_IPA_OPCODE_TX_RESUME;
1324*5113495bSYour Name else if (!uc_active && is_tx)
1325*5113495bSYour Name active_target = HTT_WDI_IPA_OPCODE_TX_SUSPEND;
1326*5113495bSYour Name else if (uc_active && !is_tx)
1327*5113495bSYour Name active_target = HTT_WDI_IPA_OPCODE_RX_RESUME;
1328*5113495bSYour Name else if (!uc_active && !is_tx)
1329*5113495bSYour Name active_target = HTT_WDI_IPA_OPCODE_RX_SUSPEND;
1330*5113495bSYour Name
1331*5113495bSYour Name QDF_TRACE(QDF_MODULE_ID_HTT, QDF_TRACE_LEVEL_INFO,
1332*5113495bSYour Name "%s: HTT_H2T_MSG_TYPE_WDI_IPA_OP_REQ (%d)\n",
1333*5113495bSYour Name __func__, active_target);
1334*5113495bSYour Name
1335*5113495bSYour Name HTT_WDI_IPA_OP_REQUEST_OP_CODE_SET(*msg_word, active_target);
1336*5113495bSYour Name HTT_H2T_MSG_TYPE_SET(*msg_word, HTT_H2T_MSG_TYPE_WDI_IPA_OP_REQ);
1337*5113495bSYour Name
1338*5113495bSYour Name SET_HTC_PACKET_INFO_TX(&pkt->htc_pkt,
1339*5113495bSYour Name htt_h2t_send_complete_free_netbuf,
1340*5113495bSYour Name qdf_nbuf_data(msg),
1341*5113495bSYour Name qdf_nbuf_len(msg),
1342*5113495bSYour Name pdev->htc_tx_endpoint,
1343*5113495bSYour Name 1); /* tag - not relevant here */
1344*5113495bSYour Name
1345*5113495bSYour Name SET_HTC_PACKET_NET_BUF_CONTEXT(&pkt->htc_pkt, msg);
1346*5113495bSYour Name HTT_SEND_HTC_PKT(pdev, pkt);
1347*5113495bSYour Name return A_OK;
1348*5113495bSYour Name }
1349*5113495bSYour Name
1350*5113495bSYour Name /**
1351*5113495bSYour Name * htt_h2t_ipa_uc_get_stats() - WDI UC state query request to firmware
1352*5113495bSYour Name * @pdev: handle to the HTT instance
1353*5113495bSYour Name *
1354*5113495bSYour Name * Return: 0 success
1355*5113495bSYour Name * A_NO_MEMORY No memory fail
1356*5113495bSYour Name */
htt_h2t_ipa_uc_get_stats(struct htt_pdev_t * pdev)1357*5113495bSYour Name int htt_h2t_ipa_uc_get_stats(struct htt_pdev_t *pdev)
1358*5113495bSYour Name {
1359*5113495bSYour Name struct htt_htc_pkt *pkt;
1360*5113495bSYour Name qdf_nbuf_t msg;
1361*5113495bSYour Name uint32_t *msg_word;
1362*5113495bSYour Name
1363*5113495bSYour Name pkt = htt_htc_pkt_alloc(pdev);
1364*5113495bSYour Name if (!pkt)
1365*5113495bSYour Name return -A_NO_MEMORY;
1366*5113495bSYour Name
1367*5113495bSYour Name /* show that this is not a tx frame download
1368*5113495bSYour Name * (not required, but helpful)
1369*5113495bSYour Name */
1370*5113495bSYour Name pkt->msdu_id = HTT_TX_COMPL_INV_MSDU_ID;
1371*5113495bSYour Name pkt->pdev_ctxt = NULL; /* not used during send-done callback */
1372*5113495bSYour Name
1373*5113495bSYour Name /* reserve room for HTC header */
1374*5113495bSYour Name msg = qdf_nbuf_alloc(pdev->osdev,
1375*5113495bSYour Name HTT_MSG_BUF_SIZE(HTT_WDI_IPA_OP_REQUEST_SZ),
1376*5113495bSYour Name HTC_HEADER_LEN + HTC_HDR_ALIGNMENT_PADDING, 4,
1377*5113495bSYour Name false);
1378*5113495bSYour Name if (!msg) {
1379*5113495bSYour Name htt_htc_pkt_free(pdev, pkt);
1380*5113495bSYour Name return -A_NO_MEMORY;
1381*5113495bSYour Name }
1382*5113495bSYour Name /* set the length of the message */
1383*5113495bSYour Name qdf_nbuf_put_tail(msg, HTT_WDI_IPA_OP_REQUEST_SZ);
1384*5113495bSYour Name
1385*5113495bSYour Name /* fill in the message contents */
1386*5113495bSYour Name msg_word = (uint32_t *) qdf_nbuf_data(msg);
1387*5113495bSYour Name
1388*5113495bSYour Name /* rewind beyond alignment pad to get to the HTC header reserved area */
1389*5113495bSYour Name qdf_nbuf_push_head(msg, HTC_HDR_ALIGNMENT_PADDING);
1390*5113495bSYour Name
1391*5113495bSYour Name *msg_word = 0;
1392*5113495bSYour Name HTT_WDI_IPA_OP_REQUEST_OP_CODE_SET(*msg_word,
1393*5113495bSYour Name HTT_WDI_IPA_OPCODE_DBG_STATS);
1394*5113495bSYour Name HTT_H2T_MSG_TYPE_SET(*msg_word, HTT_H2T_MSG_TYPE_WDI_IPA_OP_REQ);
1395*5113495bSYour Name
1396*5113495bSYour Name SET_HTC_PACKET_INFO_TX(&pkt->htc_pkt,
1397*5113495bSYour Name htt_h2t_send_complete_free_netbuf,
1398*5113495bSYour Name qdf_nbuf_data(msg),
1399*5113495bSYour Name qdf_nbuf_len(msg),
1400*5113495bSYour Name pdev->htc_tx_endpoint,
1401*5113495bSYour Name 1); /* tag - not relevant here */
1402*5113495bSYour Name
1403*5113495bSYour Name SET_HTC_PACKET_NET_BUF_CONTEXT(&pkt->htc_pkt, msg);
1404*5113495bSYour Name HTT_SEND_HTC_PKT(pdev, pkt);
1405*5113495bSYour Name return A_OK;
1406*5113495bSYour Name }
1407*5113495bSYour Name
1408*5113495bSYour Name /**
1409*5113495bSYour Name * htt_h2t_ipa_uc_get_share_stats() - WDI UC wifi sharing state request to FW
1410*5113495bSYour Name * @pdev: handle to the HTT instance
1411*5113495bSYour Name *
1412*5113495bSYour Name * Return: A_OK success
1413*5113495bSYour Name * A_NO_MEMORY No memory fail
1414*5113495bSYour Name */
htt_h2t_ipa_uc_get_share_stats(struct htt_pdev_t * pdev,uint8_t reset_stats)1415*5113495bSYour Name int htt_h2t_ipa_uc_get_share_stats(struct htt_pdev_t *pdev, uint8_t reset_stats)
1416*5113495bSYour Name {
1417*5113495bSYour Name struct htt_htc_pkt *pkt;
1418*5113495bSYour Name qdf_nbuf_t msg;
1419*5113495bSYour Name uint32_t *msg_word;
1420*5113495bSYour Name
1421*5113495bSYour Name pkt = htt_htc_pkt_alloc(pdev);
1422*5113495bSYour Name if (!pkt)
1423*5113495bSYour Name return -A_NO_MEMORY;
1424*5113495bSYour Name
1425*5113495bSYour Name /* show that this is not a tx frame download
1426*5113495bSYour Name * (not required, but helpful)
1427*5113495bSYour Name */
1428*5113495bSYour Name pkt->msdu_id = HTT_TX_COMPL_INV_MSDU_ID;
1429*5113495bSYour Name pkt->pdev_ctxt = NULL; /* not used during send-done callback */
1430*5113495bSYour Name
1431*5113495bSYour Name /* reserve room for HTC header */
1432*5113495bSYour Name msg = qdf_nbuf_alloc(pdev->osdev,
1433*5113495bSYour Name HTT_MSG_BUF_SIZE(HTT_WDI_IPA_OP_REQUEST_SZ)+
1434*5113495bSYour Name HTT_MSG_BUF_SIZE(WLAN_WDI_IPA_GET_SHARING_STATS_REQ_SZ),
1435*5113495bSYour Name HTC_HEADER_LEN + HTC_HDR_ALIGNMENT_PADDING, 4, false);
1436*5113495bSYour Name if (!msg) {
1437*5113495bSYour Name htt_htc_pkt_free(pdev, pkt);
1438*5113495bSYour Name return -A_NO_MEMORY;
1439*5113495bSYour Name }
1440*5113495bSYour Name /* set the length of the message */
1441*5113495bSYour Name qdf_nbuf_put_tail(msg, HTT_WDI_IPA_OP_REQUEST_SZ+
1442*5113495bSYour Name WLAN_WDI_IPA_GET_SHARING_STATS_REQ_SZ);
1443*5113495bSYour Name
1444*5113495bSYour Name /* fill in the message contents */
1445*5113495bSYour Name msg_word = (uint32_t *) qdf_nbuf_data(msg);
1446*5113495bSYour Name
1447*5113495bSYour Name /* rewind beyond alignment pad to get to the HTC header reserved area */
1448*5113495bSYour Name qdf_nbuf_push_head(msg, HTC_HDR_ALIGNMENT_PADDING);
1449*5113495bSYour Name
1450*5113495bSYour Name *msg_word = 0;
1451*5113495bSYour Name HTT_WDI_IPA_OP_REQUEST_OP_CODE_SET(*msg_word,
1452*5113495bSYour Name HTT_WDI_IPA_OPCODE_GET_SHARING_STATS);
1453*5113495bSYour Name HTT_H2T_MSG_TYPE_SET(*msg_word, HTT_H2T_MSG_TYPE_WDI_IPA_OP_REQ);
1454*5113495bSYour Name
1455*5113495bSYour Name msg_word++;
1456*5113495bSYour Name *msg_word = 0;
1457*5113495bSYour Name WLAN_WDI_IPA_GET_SHARING_STATS_REQ_RESET_STATS_SET(*msg_word,
1458*5113495bSYour Name reset_stats);
1459*5113495bSYour Name
1460*5113495bSYour Name SET_HTC_PACKET_INFO_TX(&pkt->htc_pkt,
1461*5113495bSYour Name htt_h2t_send_complete_free_netbuf,
1462*5113495bSYour Name qdf_nbuf_data(msg),
1463*5113495bSYour Name qdf_nbuf_len(msg),
1464*5113495bSYour Name pdev->htc_tx_endpoint,
1465*5113495bSYour Name 1); /* tag - not relevant here */
1466*5113495bSYour Name
1467*5113495bSYour Name SET_HTC_PACKET_NET_BUF_CONTEXT(&pkt->htc_pkt, msg);
1468*5113495bSYour Name HTT_SEND_HTC_PKT(pdev, pkt);
1469*5113495bSYour Name return A_OK;
1470*5113495bSYour Name }
1471*5113495bSYour Name
1472*5113495bSYour Name /**
1473*5113495bSYour Name * htt_h2t_ipa_uc_set_quota() - WDI UC state query request to firmware
1474*5113495bSYour Name * @pdev: handle to the HTT instance
1475*5113495bSYour Name *
1476*5113495bSYour Name * Return: A_OK success
1477*5113495bSYour Name * A_NO_MEMORY No memory fail
1478*5113495bSYour Name */
htt_h2t_ipa_uc_set_quota(struct htt_pdev_t * pdev,uint64_t quota_bytes)1479*5113495bSYour Name int htt_h2t_ipa_uc_set_quota(struct htt_pdev_t *pdev, uint64_t quota_bytes)
1480*5113495bSYour Name {
1481*5113495bSYour Name struct htt_htc_pkt *pkt;
1482*5113495bSYour Name qdf_nbuf_t msg;
1483*5113495bSYour Name uint32_t *msg_word;
1484*5113495bSYour Name
1485*5113495bSYour Name pkt = htt_htc_pkt_alloc(pdev);
1486*5113495bSYour Name if (!pkt)
1487*5113495bSYour Name return -A_NO_MEMORY;
1488*5113495bSYour Name
1489*5113495bSYour Name /* show that this is not a tx frame download
1490*5113495bSYour Name * (not required, but helpful)
1491*5113495bSYour Name */
1492*5113495bSYour Name pkt->msdu_id = HTT_TX_COMPL_INV_MSDU_ID;
1493*5113495bSYour Name pkt->pdev_ctxt = NULL; /* not used during send-done callback */
1494*5113495bSYour Name
1495*5113495bSYour Name /* reserve room for HTC header */
1496*5113495bSYour Name msg = qdf_nbuf_alloc(pdev->osdev,
1497*5113495bSYour Name HTT_MSG_BUF_SIZE(HTT_WDI_IPA_OP_REQUEST_SZ)+
1498*5113495bSYour Name HTT_MSG_BUF_SIZE(WLAN_WDI_IPA_SET_QUOTA_REQ_SZ),
1499*5113495bSYour Name HTC_HEADER_LEN + HTC_HDR_ALIGNMENT_PADDING, 4, false);
1500*5113495bSYour Name if (!msg) {
1501*5113495bSYour Name htt_htc_pkt_free(pdev, pkt);
1502*5113495bSYour Name return -A_NO_MEMORY;
1503*5113495bSYour Name }
1504*5113495bSYour Name /* set the length of the message */
1505*5113495bSYour Name qdf_nbuf_put_tail(msg, HTT_WDI_IPA_OP_REQUEST_SZ+
1506*5113495bSYour Name WLAN_WDI_IPA_SET_QUOTA_REQ_SZ);
1507*5113495bSYour Name
1508*5113495bSYour Name /* fill in the message contents */
1509*5113495bSYour Name msg_word = (uint32_t *) qdf_nbuf_data(msg);
1510*5113495bSYour Name
1511*5113495bSYour Name /* rewind beyond alignment pad to get to the HTC header reserved area */
1512*5113495bSYour Name qdf_nbuf_push_head(msg, HTC_HDR_ALIGNMENT_PADDING);
1513*5113495bSYour Name
1514*5113495bSYour Name *msg_word = 0;
1515*5113495bSYour Name HTT_WDI_IPA_OP_REQUEST_OP_CODE_SET(*msg_word,
1516*5113495bSYour Name HTT_WDI_IPA_OPCODE_SET_QUOTA);
1517*5113495bSYour Name HTT_H2T_MSG_TYPE_SET(*msg_word, HTT_H2T_MSG_TYPE_WDI_IPA_OP_REQ);
1518*5113495bSYour Name
1519*5113495bSYour Name msg_word++;
1520*5113495bSYour Name *msg_word = 0;
1521*5113495bSYour Name WLAN_WDI_IPA_SET_QUOTA_REQ_SET_QUOTA_SET(*msg_word, quota_bytes > 0);
1522*5113495bSYour Name
1523*5113495bSYour Name msg_word++;
1524*5113495bSYour Name *msg_word = 0;
1525*5113495bSYour Name WLAN_WDI_IPA_SET_QUOTA_REQ_QUOTA_LO_SET(*msg_word,
1526*5113495bSYour Name (uint32_t)(quota_bytes &
1527*5113495bSYour Name WLAN_WDI_IPA_SET_QUOTA_REQ_QUOTA_LO_M));
1528*5113495bSYour Name
1529*5113495bSYour Name msg_word++;
1530*5113495bSYour Name *msg_word = 0;
1531*5113495bSYour Name WLAN_WDI_IPA_SET_QUOTA_REQ_QUOTA_HI_SET(*msg_word,
1532*5113495bSYour Name (uint32_t)(quota_bytes>>32 &
1533*5113495bSYour Name WLAN_WDI_IPA_SET_QUOTA_REQ_QUOTA_HI_M));
1534*5113495bSYour Name
1535*5113495bSYour Name SET_HTC_PACKET_INFO_TX(&pkt->htc_pkt,
1536*5113495bSYour Name htt_h2t_send_complete_free_netbuf,
1537*5113495bSYour Name qdf_nbuf_data(msg),
1538*5113495bSYour Name qdf_nbuf_len(msg),
1539*5113495bSYour Name pdev->htc_tx_endpoint,
1540*5113495bSYour Name 1); /* tag - not relevant here */
1541*5113495bSYour Name
1542*5113495bSYour Name SET_HTC_PACKET_NET_BUF_CONTEXT(&pkt->htc_pkt, msg);
1543*5113495bSYour Name HTT_SEND_HTC_PKT(pdev, pkt);
1544*5113495bSYour Name return A_OK;
1545*5113495bSYour Name }
1546*5113495bSYour Name #endif /* IPA_OFFLOAD */
1547