xref: /wlan-dirver/qca-wifi-host-cmn/dp/inc/cdp_txrx_mlo.h (revision b6ef4fe306b6abd9485ff7d6ca12da80552e7caf)
1 /*
2  * Copyright (c) 2021 Qualcomm Innovation Center, Inc. All rights reserved.
3  *
4  * Permission to use, copy, modify, and/or distribute this software for any
5  * purpose with or without fee is hereby granted, provided that the above
6  * copyright notice and this permission notice appear in all copies.
7  *
8  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15  */
16 #ifndef _CDP_TXRX_MLO_H_
17 #define _CDP_TXRX_MLO_H_
18 #include "cdp_txrx_ops.h"
19 
20 struct cdp_mlo_ctxt;
21 
22 /**
23  * cdp_ctrl_mlo_mgr - opaque handle for mlo manager context
24  */
25 struct cdp_ctrl_mlo_mgr;
26 
27 struct
28 cdp_mlo_ctxt *dp_mlo_ctxt_attach_wifi3(struct cdp_ctrl_mlo_mgr *ctrl_ctxt);
29 void dp_mlo_ctxt_detach_wifi3(struct cdp_mlo_ctxt *ml_ctxt);
30 
31 static inline
32 struct cdp_mlo_ctxt *cdp_mlo_ctxt_attach(struct cdp_ctrl_mlo_mgr *ctrl_ctxt)
33 {
34 	return dp_mlo_ctxt_attach_wifi3(ctrl_ctxt);
35 }
36 
37 static inline
38 void cdp_mlo_ctxt_detach(struct cdp_mlo_ctxt *ml_ctxt)
39 {
40 	dp_mlo_ctxt_detach_wifi3(ml_ctxt);
41 }
42 
43 static inline void cdp_soc_mlo_soc_setup(ol_txrx_soc_handle soc,
44 					 struct cdp_mlo_ctxt *mlo_ctx)
45 {
46 	if (!soc || !soc->ops) {
47 		QDF_BUG(0);
48 		return;
49 	}
50 
51 	if (!soc->ops->mlo_ops ||
52 	    !soc->ops->mlo_ops->mlo_soc_setup)
53 		return;
54 
55 	soc->ops->mlo_ops->mlo_soc_setup(soc, mlo_ctx);
56 }
57 
58 static inline void cdp_soc_mlo_soc_teardown(ol_txrx_soc_handle soc,
59 					    struct cdp_mlo_ctxt *mlo_ctx)
60 {
61 	if (!soc || !soc->ops) {
62 		QDF_BUG(0);
63 		return;
64 	}
65 
66 	if (!soc->ops->mlo_ops ||
67 	    !soc->ops->mlo_ops->mlo_soc_teardown)
68 		return;
69 
70 	soc->ops->mlo_ops->mlo_soc_teardown(soc, mlo_ctx);
71 }
72 
73 /*
74  * cdp_update_mlo_ptnr_list - Add vdev to MLO partner list
75  * @soc: soc handle
76  * @vdev_ids: list of partner vdevs
77  * @num_vdevs: number of items in list
78  * @vdev_id: caller's vdev id
79  *
80  * return: QDF_STATUS
81  */
82 static inline QDF_STATUS
83 cdp_update_mlo_ptnr_list(ol_txrx_soc_handle soc, int8_t vdev_ids[],
84 			 uint8_t num_vdevs, uint8_t vdev_id)
85 {
86 	if (!soc || !soc->ops || !soc->ops->mlo_ops)
87 		return QDF_STATUS_E_INVAL;
88 
89 	if (soc->ops->mlo_ops->update_mlo_ptnr_list)
90 		return soc->ops->mlo_ops->update_mlo_ptnr_list(soc, vdev_ids,
91 						num_vdevs, vdev_id);
92 
93 	return QDF_STATUS_SUCCESS;
94 }
95 
96 static inline void cdp_mlo_setup_complete(ol_txrx_soc_handle soc,
97 					  struct cdp_mlo_ctxt *mlo_ctx)
98 {
99 	if (!soc || !soc->ops) {
100 		QDF_BUG(0);
101 		return;
102 	}
103 
104 	if (!soc->ops->mlo_ops ||
105 	    !soc->ops->mlo_ops->mlo_setup_complete)
106 		return;
107 
108 	soc->ops->mlo_ops->mlo_setup_complete(mlo_ctx);
109 }
110 #endif /*_CDP_TXRX_MLO_H_*/
111