xref: /linux/drivers/net/wireless/quantenna/qtnfmac/util.h (revision 597473720f4dc69749542bfcfed4a927a43d935e)
1 /* SPDX-License-Identifier: GPL-2.0+ */
2 /* Copyright (c) 2015 Quantenna Communications. All rights reserved. */
3 
4 #ifndef QTNFMAC_UTIL_H
5 #define QTNFMAC_UTIL_H
6 
7 #include <linux/kernel.h>
8 #include "core.h"
9 
10 const char *qtnf_chipid_to_string(unsigned long chip_id);
11 
12 void qtnf_sta_list_init(struct qtnf_sta_list *list);
13 
14 struct qtnf_sta_node *qtnf_sta_list_lookup(struct qtnf_sta_list *list,
15 					   const u8 *mac);
16 struct qtnf_sta_node *qtnf_sta_list_lookup_index(struct qtnf_sta_list *list,
17 						 size_t index);
18 struct qtnf_sta_node *qtnf_sta_list_add(struct qtnf_vif *vif,
19 					const u8 *mac);
20 bool qtnf_sta_list_del(struct qtnf_vif *vif, const u8 *mac);
21 
22 void qtnf_sta_list_free(struct qtnf_sta_list *list);
23 
qtnf_sta_list_size(const struct qtnf_sta_list * list)24 static inline size_t qtnf_sta_list_size(const struct qtnf_sta_list *list)
25 {
26 	return atomic_read(&list->size);
27 }
28 
qtnf_sta_list_empty(const struct qtnf_sta_list * list)29 static inline bool qtnf_sta_list_empty(const struct qtnf_sta_list *list)
30 {
31 	return list_empty(&list->head);
32 }
33 
34 #endif /* QTNFMAC_UTIL_H */
35