1*98f44cb0SIgor Mitsyanko /* 2*98f44cb0SIgor Mitsyanko * Copyright (c) 2015 Quantenna Communications 3*98f44cb0SIgor Mitsyanko * 4*98f44cb0SIgor Mitsyanko * Permission to use, copy, modify, and/or distribute this software for any 5*98f44cb0SIgor Mitsyanko * purpose with or without fee is hereby granted, provided that the above 6*98f44cb0SIgor Mitsyanko * copyright notice and this permission notice appear in all copies. 7*98f44cb0SIgor Mitsyanko * 8*98f44cb0SIgor Mitsyanko * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9*98f44cb0SIgor Mitsyanko * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10*98f44cb0SIgor Mitsyanko * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 11*98f44cb0SIgor Mitsyanko * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12*98f44cb0SIgor Mitsyanko * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION 13*98f44cb0SIgor Mitsyanko * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN 14*98f44cb0SIgor Mitsyanko * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15*98f44cb0SIgor Mitsyanko */ 16*98f44cb0SIgor Mitsyanko 17*98f44cb0SIgor Mitsyanko #ifndef QTNFMAC_UTIL_H 18*98f44cb0SIgor Mitsyanko #define QTNFMAC_UTIL_H 19*98f44cb0SIgor Mitsyanko 20*98f44cb0SIgor Mitsyanko #include <linux/kernel.h> 21*98f44cb0SIgor Mitsyanko #include "core.h" 22*98f44cb0SIgor Mitsyanko 23*98f44cb0SIgor Mitsyanko void qtnf_sta_list_init(struct qtnf_sta_list *list); 24*98f44cb0SIgor Mitsyanko 25*98f44cb0SIgor Mitsyanko struct qtnf_sta_node *qtnf_sta_list_lookup(struct qtnf_sta_list *list, 26*98f44cb0SIgor Mitsyanko const u8 *mac); 27*98f44cb0SIgor Mitsyanko struct qtnf_sta_node *qtnf_sta_list_lookup_index(struct qtnf_sta_list *list, 28*98f44cb0SIgor Mitsyanko size_t index); 29*98f44cb0SIgor Mitsyanko struct qtnf_sta_node *qtnf_sta_list_add(struct qtnf_sta_list *list, 30*98f44cb0SIgor Mitsyanko const u8 *mac); 31*98f44cb0SIgor Mitsyanko bool qtnf_sta_list_del(struct qtnf_sta_list *list, const u8 *mac); 32*98f44cb0SIgor Mitsyanko 33*98f44cb0SIgor Mitsyanko void qtnf_sta_list_free(struct qtnf_sta_list *list); 34*98f44cb0SIgor Mitsyanko 35*98f44cb0SIgor Mitsyanko static inline size_t qtnf_sta_list_size(const struct qtnf_sta_list *list) 36*98f44cb0SIgor Mitsyanko { 37*98f44cb0SIgor Mitsyanko return atomic_read(&list->size); 38*98f44cb0SIgor Mitsyanko } 39*98f44cb0SIgor Mitsyanko 40*98f44cb0SIgor Mitsyanko static inline bool qtnf_sta_list_empty(const struct qtnf_sta_list *list) 41*98f44cb0SIgor Mitsyanko { 42*98f44cb0SIgor Mitsyanko return list_empty(&list->head); 43*98f44cb0SIgor Mitsyanko } 44*98f44cb0SIgor Mitsyanko 45*98f44cb0SIgor Mitsyanko #endif /* QTNFMAC_UTIL_H */ 46