xref: /linux/drivers/net/wireless/quantenna/qtnfmac/util.h (revision ff233cb515031d95550958c5797a70222749e9a3)
1*ff233cb5SSergey Matyukevich /* SPDX-License-Identifier: GPL-2.0+ */
2*ff233cb5SSergey Matyukevich /* Copyright (c) 2015 Quantenna Communications. All rights reserved. */
398f44cb0SIgor Mitsyanko 
498f44cb0SIgor Mitsyanko #ifndef QTNFMAC_UTIL_H
598f44cb0SIgor Mitsyanko #define QTNFMAC_UTIL_H
698f44cb0SIgor Mitsyanko 
798f44cb0SIgor Mitsyanko #include <linux/kernel.h>
898f44cb0SIgor Mitsyanko #include "core.h"
998f44cb0SIgor Mitsyanko 
10b7da53cdSIgor Mitsyanko const char *qtnf_chipid_to_string(unsigned long chip_id);
11b7da53cdSIgor Mitsyanko 
1298f44cb0SIgor Mitsyanko void qtnf_sta_list_init(struct qtnf_sta_list *list);
1398f44cb0SIgor Mitsyanko 
1498f44cb0SIgor Mitsyanko struct qtnf_sta_node *qtnf_sta_list_lookup(struct qtnf_sta_list *list,
1598f44cb0SIgor Mitsyanko 					   const u8 *mac);
1698f44cb0SIgor Mitsyanko struct qtnf_sta_node *qtnf_sta_list_lookup_index(struct qtnf_sta_list *list,
1798f44cb0SIgor Mitsyanko 						 size_t index);
187a4d3a3bSIgor Mitsyanko struct qtnf_sta_node *qtnf_sta_list_add(struct qtnf_vif *vif,
1998f44cb0SIgor Mitsyanko 					const u8 *mac);
207a4d3a3bSIgor Mitsyanko bool qtnf_sta_list_del(struct qtnf_vif *vif, const u8 *mac);
2198f44cb0SIgor Mitsyanko 
2298f44cb0SIgor Mitsyanko void qtnf_sta_list_free(struct qtnf_sta_list *list);
2398f44cb0SIgor Mitsyanko 
2498f44cb0SIgor Mitsyanko static inline size_t qtnf_sta_list_size(const struct qtnf_sta_list *list)
2598f44cb0SIgor Mitsyanko {
2698f44cb0SIgor Mitsyanko 	return atomic_read(&list->size);
2798f44cb0SIgor Mitsyanko }
2898f44cb0SIgor Mitsyanko 
2998f44cb0SIgor Mitsyanko static inline bool qtnf_sta_list_empty(const struct qtnf_sta_list *list)
3098f44cb0SIgor Mitsyanko {
3198f44cb0SIgor Mitsyanko 	return list_empty(&list->head);
3298f44cb0SIgor Mitsyanko }
3398f44cb0SIgor Mitsyanko 
3498f44cb0SIgor Mitsyanko #endif /* QTNFMAC_UTIL_H */
35