flowring.h 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. /* Copyright (c) 2014 Broadcom Corporation
  2. *
  3. * Permission to use, copy, modify, and/or distribute this software for any
  4. * purpose with or without fee is hereby granted, provided that the above
  5. * copyright notice and this permission notice appear in all copies.
  6. *
  7. * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
  8. * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
  9. * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
  10. * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
  11. * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
  12. * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
  13. * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  14. */
  15. #ifndef BRCMFMAC_FLOWRING_H
  16. #define BRCMFMAC_FLOWRING_H
  17. #define BRCMF_FLOWRING_HASHSIZE 512 /* has to be 2^x */
  18. #define BRCMF_FLOWRING_INVALID_ID 0xFFFFFFFF
  19. struct brcmf_flowring_hash {
  20. u8 mac[ETH_ALEN];
  21. u8 fifo;
  22. u8 ifidx;
  23. u16 flowid;
  24. };
  25. enum ring_status {
  26. RING_CLOSED,
  27. RING_CLOSING,
  28. RING_OPEN
  29. };
  30. struct brcmf_flowring_ring {
  31. u16 hash_id;
  32. bool blocked;
  33. enum ring_status status;
  34. struct sk_buff_head skblist;
  35. };
  36. struct brcmf_flowring_tdls_entry {
  37. u8 mac[ETH_ALEN];
  38. struct brcmf_flowring_tdls_entry *next;
  39. };
  40. struct brcmf_flowring {
  41. struct device *dev;
  42. struct brcmf_flowring_hash hash[BRCMF_FLOWRING_HASHSIZE];
  43. struct brcmf_flowring_ring **rings;
  44. spinlock_t block_lock;
  45. enum proto_addr_mode addr_mode[BRCMF_MAX_IFS];
  46. u16 nrofrings;
  47. bool tdls_active;
  48. struct brcmf_flowring_tdls_entry *tdls_entry;
  49. };
  50. u32 brcmf_flowring_lookup(struct brcmf_flowring *flow, u8 da[ETH_ALEN],
  51. u8 prio, u8 ifidx);
  52. u32 brcmf_flowring_create(struct brcmf_flowring *flow, u8 da[ETH_ALEN],
  53. u8 prio, u8 ifidx);
  54. void brcmf_flowring_delete(struct brcmf_flowring *flow, u16 flowid);
  55. void brcmf_flowring_open(struct brcmf_flowring *flow, u16 flowid);
  56. u8 brcmf_flowring_tid(struct brcmf_flowring *flow, u16 flowid);
  57. u32 brcmf_flowring_enqueue(struct brcmf_flowring *flow, u16 flowid,
  58. struct sk_buff *skb);
  59. struct sk_buff *brcmf_flowring_dequeue(struct brcmf_flowring *flow, u16 flowid);
  60. void brcmf_flowring_reinsert(struct brcmf_flowring *flow, u16 flowid,
  61. struct sk_buff *skb);
  62. u32 brcmf_flowring_qlen(struct brcmf_flowring *flow, u16 flowid);
  63. u8 brcmf_flowring_ifidx_get(struct brcmf_flowring *flow, u16 flowid);
  64. struct brcmf_flowring *brcmf_flowring_attach(struct device *dev, u16 nrofrings);
  65. void brcmf_flowring_detach(struct brcmf_flowring *flow);
  66. void brcmf_flowring_configure_addr_mode(struct brcmf_flowring *flow, int ifidx,
  67. enum proto_addr_mode addr_mode);
  68. void brcmf_flowring_delete_peer(struct brcmf_flowring *flow, int ifidx,
  69. u8 peer[ETH_ALEN]);
  70. void brcmf_flowring_add_tdls_peer(struct brcmf_flowring *flow, int ifidx,
  71. u8 peer[ETH_ALEN]);
  72. #endif /* BRCMFMAC_FLOWRING_H */