1 /* 2 * Copyright (c) 2015 Quantenna Communications 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 ANY 11 * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION 13 * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN 14 * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 */ 16 17 #ifndef QTNFMAC_UTIL_H 18 #define QTNFMAC_UTIL_H 19 20 #include <linux/kernel.h> 21 #include "core.h" 22 23 void qtnf_sta_list_init(struct qtnf_sta_list *list); 24 25 struct qtnf_sta_node *qtnf_sta_list_lookup(struct qtnf_sta_list *list, 26 const u8 *mac); 27 struct qtnf_sta_node *qtnf_sta_list_lookup_index(struct qtnf_sta_list *list, 28 size_t index); 29 struct qtnf_sta_node *qtnf_sta_list_add(struct qtnf_sta_list *list, 30 const u8 *mac); 31 bool qtnf_sta_list_del(struct qtnf_sta_list *list, const u8 *mac); 32 33 void qtnf_sta_list_free(struct qtnf_sta_list *list); 34 35 static inline size_t qtnf_sta_list_size(const struct qtnf_sta_list *list) 36 { 37 return atomic_read(&list->size); 38 } 39 40 static inline bool qtnf_sta_list_empty(const struct qtnf_sta_list *list) 41 { 42 return list_empty(&list->head); 43 } 44 45 #endif /* QTNFMAC_UTIL_H */ 46