198f44cb0SIgor Mitsyanko /* 298f44cb0SIgor Mitsyanko * Copyright (c) 2015 Quantenna Communications 398f44cb0SIgor Mitsyanko * 498f44cb0SIgor Mitsyanko * Permission to use, copy, modify, and/or distribute this software for any 598f44cb0SIgor Mitsyanko * purpose with or without fee is hereby granted, provided that the above 698f44cb0SIgor Mitsyanko * copyright notice and this permission notice appear in all copies. 798f44cb0SIgor Mitsyanko * 898f44cb0SIgor Mitsyanko * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 998f44cb0SIgor Mitsyanko * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 1098f44cb0SIgor Mitsyanko * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 1198f44cb0SIgor Mitsyanko * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 1298f44cb0SIgor Mitsyanko * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION 1398f44cb0SIgor Mitsyanko * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN 1498f44cb0SIgor Mitsyanko * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 1598f44cb0SIgor Mitsyanko */ 1698f44cb0SIgor Mitsyanko 1798f44cb0SIgor Mitsyanko #ifndef QTNFMAC_UTIL_H 1898f44cb0SIgor Mitsyanko #define QTNFMAC_UTIL_H 1998f44cb0SIgor Mitsyanko 2098f44cb0SIgor Mitsyanko #include <linux/kernel.h> 2198f44cb0SIgor Mitsyanko #include "core.h" 2298f44cb0SIgor Mitsyanko 2398f44cb0SIgor Mitsyanko void qtnf_sta_list_init(struct qtnf_sta_list *list); 2498f44cb0SIgor Mitsyanko 2598f44cb0SIgor Mitsyanko struct qtnf_sta_node *qtnf_sta_list_lookup(struct qtnf_sta_list *list, 2698f44cb0SIgor Mitsyanko const u8 *mac); 2798f44cb0SIgor Mitsyanko struct qtnf_sta_node *qtnf_sta_list_lookup_index(struct qtnf_sta_list *list, 2898f44cb0SIgor Mitsyanko size_t index); 29*7a4d3a3bSIgor Mitsyanko struct qtnf_sta_node *qtnf_sta_list_add(struct qtnf_vif *vif, 3098f44cb0SIgor Mitsyanko const u8 *mac); 31*7a4d3a3bSIgor Mitsyanko bool qtnf_sta_list_del(struct qtnf_vif *vif, const u8 *mac); 3298f44cb0SIgor Mitsyanko 3398f44cb0SIgor Mitsyanko void qtnf_sta_list_free(struct qtnf_sta_list *list); 3498f44cb0SIgor Mitsyanko 3598f44cb0SIgor Mitsyanko static inline size_t qtnf_sta_list_size(const struct qtnf_sta_list *list) 3698f44cb0SIgor Mitsyanko { 3798f44cb0SIgor Mitsyanko return atomic_read(&list->size); 3898f44cb0SIgor Mitsyanko } 3998f44cb0SIgor Mitsyanko 4098f44cb0SIgor Mitsyanko static inline bool qtnf_sta_list_empty(const struct qtnf_sta_list *list) 4198f44cb0SIgor Mitsyanko { 4298f44cb0SIgor Mitsyanko return list_empty(&list->head); 4398f44cb0SIgor Mitsyanko } 4498f44cb0SIgor Mitsyanko 4598f44cb0SIgor Mitsyanko #endif /* QTNFMAC_UTIL_H */ 46