util.h 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  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. #ifndef QTNFMAC_UTIL_H
  17. #define QTNFMAC_UTIL_H
  18. #include <linux/kernel.h>
  19. #include "core.h"
  20. void qtnf_sta_list_init(struct qtnf_sta_list *list);
  21. struct qtnf_sta_node *qtnf_sta_list_lookup(struct qtnf_sta_list *list,
  22. const u8 *mac);
  23. struct qtnf_sta_node *qtnf_sta_list_lookup_index(struct qtnf_sta_list *list,
  24. size_t index);
  25. struct qtnf_sta_node *qtnf_sta_list_add(struct qtnf_vif *vif,
  26. const u8 *mac);
  27. bool qtnf_sta_list_del(struct qtnf_vif *vif, const u8 *mac);
  28. void qtnf_sta_list_free(struct qtnf_sta_list *list);
  29. static inline size_t qtnf_sta_list_size(const struct qtnf_sta_list *list)
  30. {
  31. return atomic_read(&list->size);
  32. }
  33. static inline bool qtnf_sta_list_empty(const struct qtnf_sta_list *list)
  34. {
  35. return list_empty(&list->head);
  36. }
  37. #endif /* QTNFMAC_UTIL_H */