xref: /wlan-driver/qca-wifi-host-cmn/qdf/inc/qdf_status.h (revision 5113495b16420b49004c444715d2daae2066e7dc)
1 /*
2  * Copyright (c) 2014-2020 The Linux Foundation. All rights reserved.
3  * Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved.
4  *
5  * Permission to use, copy, modify, and/or distribute this software for
6  * any purpose with or without fee is hereby granted, provided that the
7  * above copyright notice and this permission notice appear in all
8  * copies.
9  *
10  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
11  * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
12  * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
13  * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
14  * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
15  * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
16  * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
17  * PERFORMANCE OF THIS SOFTWARE.
18  */
19 
20 /**
21  * DOC: qdf_status
22  * QCA driver framework (QDF) status codes
23  * Basic status codes/definitions used by QDF
24  */
25 
26 #ifndef __QDF_STATUS_H
27 #define __QDF_STATUS_H
28 
29 /**
30  * typedef QDF_STATUS - QDF error codes
31  * @QDF_STATUS_SUCCESS: success
32  * @QDF_STATUS_E_RESOURCES: system resource(other than memory) not available
33  * @QDF_STATUS_E_NOMEM: not enough memory
34  * @QDF_STATUS_E_AGAIN: try again
35  * @QDF_STATUS_E_INVAL: invalid request
36  * @QDF_STATUS_E_FAULT: system fault
37  * @QDF_STATUS_E_ALREADY: another request already in progress
38  * @QDF_STATUS_E_BADMSG: bad message
39  * @QDF_STATUS_E_BUSY: device or resource busy
40  * @QDF_STATUS_E_CANCELED: request cancelled
41  * @QDF_STATUS_E_ABORTED: request aborted
42  * @QDF_STATUS_E_NOSUPPORT: request not supported
43  * @QDF_STATUS_E_PERM: operation not permitted
44  * @QDF_STATUS_E_EMPTY: empty condition
45  * @QDF_STATUS_E_EXISTS: existence failure
46  * @QDF_STATUS_E_TIMEOUT: operation timeout
47  * @QDF_STATUS_E_FAILURE: unknown reason do not use unless nothing else applies
48  * @QDF_STATUS_E_NOENT: No such file or directory
49  * @QDF_STATUS_E_E2BIG: Arg list too long
50  * @QDF_STATUS_E_NOSPC: no space left on device
51  * @QDF_STATUS_E_ADDRNOTAVAIL: Cannot assign requested address
52  * @QDF_STATUS_E_ENXIO: No such device or address
53  * @QDF_STATUS_E_NETDOWN: network is down
54  * @QDF_STATUS_E_IO: I/O Error
55  * @QDF_STATUS_E_PENDING: pending status
56  * @QDF_STATUS_E_NETRESET: Network dropped connection because of reset
57  * @QDF_STATUS_E_SIG: Exit due to received SIGINT
58  * @QDF_STATUS_E_PROTO: protocol error
59  * @QDF_STATUS_NOT_INITIALIZED: resource not initialized
60  * @QDF_STATUS_E_NULL_VALUE: request is null
61  * @QDF_STATUS_HEARTBEAT_TMOUT: heartbeat timeout error
62  * @QDF_STATUS_NTH_BEACON_DELIVERY: Nth beacon delivery
63  * @QDF_STATUS_CSR_WRONG_STATE: csr in wrong state
64  * @QDF_STATUS_FT_PREAUTH_KEY_SUCCESS: ft preauth key success
65  * @QDF_STATUS_FT_PREAUTH_KEY_FAILED: ft preauth key failed
66  * @QDF_STATUS_CMD_NOT_QUEUED: command not queued
67  * @QDF_STATUS_FW_MSG_TIMEDOUT: target message timeout
68  * @QDF_STATUS_E_USB_ERROR: USB transaction error
69  * @QDF_STATUS_MAXCOMP_FAIL: Component id is more than MAX UMAC components
70  * @QDF_STATUS_COMP_DISABLED: UMAC Component is disabled
71  * @QDF_STATUS_COMP_ASYNC: UMAC component runs in asynchronous communication
72  * @QDF_STATUS_CRYPTO_PN_ERROR: PN ERROR in received frame
73  * @QDF_STATUS_CRYPTO_MIC_FAILURE: MIC failure in received frame
74  * @QDF_STATUS_CRYPTO_ENCRYPT_FAILED: encryption failed
75  * @QDF_STATUS_CRYPTO_DECRYPT_FAILED: decryption failed
76  * @QDF_STATUS_E_RANGE: result/parameter/operation was out of range
77  * @QDF_STATUS_E_GRO_DROP: return code for GRO drop
78  * @QDF_STATUS_E_RESTART: return error code for wait_event_interruptible
79  * @QDF_STATUS_FILT_REQ_ERROR: return error code cee filter rule request
80  * @QDF_STATUS_TDLS_MLO_SYNC: tdls mlo sync
81  * @QDF_STATUS_CRYPTO_INVALID_KEYLEN: return code for invalid key length
82  * @QDF_STATUS_CRYPTO_INVALID_KEYID: return code for invalid key index
83  * @QDF_STATUS_CRYPTO_INVALID_CIPHERTYPE: return code for invalid cipher type
84  * @QDF_STATUS_INVALID_ASSOCID: return code for invalid assoc id
85  * @QDF_STATUS_MAX_VHT_STREAMS: Max VHT streams
86  * @QDF_STATUS_NO_OVERLAP_LEGACY_RATES: no overlap legacy rate with assoc-req
87  * @QDF_STATUS_MAX: not a real value just a place holder for max
88  */
89 typedef enum {
90 	QDF_STATUS_SUCCESS,
91 	QDF_STATUS_E_RESOURCES,
92 	QDF_STATUS_E_NOMEM,
93 	QDF_STATUS_E_AGAIN,
94 	QDF_STATUS_E_INVAL,
95 	QDF_STATUS_E_FAULT,
96 	QDF_STATUS_E_ALREADY,
97 	QDF_STATUS_E_BADMSG,
98 	QDF_STATUS_E_BUSY,
99 	QDF_STATUS_E_CANCELED,
100 	QDF_STATUS_E_ABORTED,
101 	QDF_STATUS_E_NOSUPPORT,
102 	QDF_STATUS_E_PERM,
103 	QDF_STATUS_E_EMPTY,
104 	QDF_STATUS_E_EXISTS,
105 	QDF_STATUS_E_TIMEOUT,
106 	QDF_STATUS_E_FAILURE,
107 	QDF_STATUS_E_NOENT,
108 	QDF_STATUS_E_E2BIG,
109 	QDF_STATUS_E_NOSPC,
110 	QDF_STATUS_E_ADDRNOTAVAIL,
111 	QDF_STATUS_E_ENXIO,
112 	QDF_STATUS_E_NETDOWN,
113 	QDF_STATUS_E_IO,
114 	QDF_STATUS_E_PENDING,
115 	QDF_STATUS_E_NETRESET,
116 	QDF_STATUS_E_SIG,
117 	QDF_STATUS_E_PROTO,
118 	QDF_STATUS_NOT_INITIALIZED,
119 	QDF_STATUS_E_NULL_VALUE,
120 	QDF_STATUS_HEARTBEAT_TMOUT,
121 	QDF_STATUS_NTH_BEACON_DELIVERY,
122 	QDF_STATUS_CSR_WRONG_STATE,
123 	QDF_STATUS_FT_PREAUTH_KEY_SUCCESS,
124 	QDF_STATUS_FT_PREAUTH_KEY_FAILED,
125 	QDF_STATUS_CMD_NOT_QUEUED,
126 	QDF_STATUS_FW_MSG_TIMEDOUT,
127 	QDF_STATUS_E_USB_ERROR,
128 	QDF_STATUS_MAXCOMP_FAIL,
129 	QDF_STATUS_COMP_DISABLED,
130 	QDF_STATUS_COMP_ASYNC,
131 	QDF_STATUS_CRYPTO_PN_ERROR,
132 	QDF_STATUS_CRYPTO_MIC_FAILURE,
133 	QDF_STATUS_CRYPTO_ENCRYPT_FAILED,
134 	QDF_STATUS_CRYPTO_DECRYPT_FAILED,
135 	QDF_STATUS_E_DEFRAG_ERROR,
136 	QDF_STATUS_E_RANGE,
137 	QDF_STATUS_E_GRO_DROP,
138 	QDF_STATUS_E_RESTART,
139 	QDF_STATUS_FILT_REQ_ERROR,
140 	QDF_STATUS_TDLS_MLO_SYNC,
141 	QDF_STATUS_CRYPTO_INVALID_KEYLEN,
142 	QDF_STATUS_CRYPTO_INVALID_KEYID,
143 	QDF_STATUS_CRYPTO_INVALID_CIPHERTYPE,
144 	QDF_STATUS_INVALID_ASSOCID,
145 	QDF_STATUS_MAX_VHT_STREAMS,
146 	QDF_STATUS_NO_OVERLAP_LEGACY_RATES,
147 	QDF_STATUS_MAX
148 } QDF_STATUS;
149 
150 #define QDF_IS_STATUS_SUCCESS(status) (QDF_STATUS_SUCCESS == (status))
151 #define QDF_IS_STATUS_ERROR(status) (QDF_STATUS_SUCCESS != (status))
152 
153 /**
154  * qdf_status_to_os_return() - map a QDF_STATUS into an OS specific return code
155  * @status: QDF_STATUS to map
156  *
157  * Return: an OS specific error code
158  */
159 int qdf_status_to_os_return(QDF_STATUS status);
160 
161 /**
162  * qdf_status_from_os_return() - map an OS specific return code to a QDF_STATUS
163  * @rc: the input return code to map
164  *
165  * Return: QDF_STATUS
166  */
167 QDF_STATUS qdf_status_from_os_return(int rc);
168 
169 #endif /* __QDF_STATUS_H */
170 
171