txrx.h 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * Datapath interface for ST-Ericsson CW1200 mac80211 drivers
  4. *
  5. * Copyright (c) 2010, ST-Ericsson
  6. * Author: Dmitry Tarnyagin <[email protected]>
  7. */
  8. #ifndef CW1200_TXRX_H
  9. #define CW1200_TXRX_H
  10. #include <linux/list.h>
  11. /* extern */ struct ieee80211_hw;
  12. /* extern */ struct sk_buff;
  13. /* extern */ struct wsm_tx;
  14. /* extern */ struct wsm_rx;
  15. /* extern */ struct wsm_tx_confirm;
  16. /* extern */ struct cw1200_txpriv;
  17. struct tx_policy {
  18. union {
  19. __le32 tbl[3];
  20. u8 raw[12];
  21. };
  22. u8 defined;
  23. u8 usage_count;
  24. u8 retry_count;
  25. u8 uploaded;
  26. };
  27. struct tx_policy_cache_entry {
  28. struct tx_policy policy;
  29. struct list_head link;
  30. };
  31. #define TX_POLICY_CACHE_SIZE (8)
  32. struct tx_policy_cache {
  33. struct tx_policy_cache_entry cache[TX_POLICY_CACHE_SIZE];
  34. struct list_head used;
  35. struct list_head free;
  36. spinlock_t lock; /* Protect policy cache */
  37. };
  38. /* ******************************************************************** */
  39. /* TX policy cache */
  40. /* Intention of TX policy cache is an overcomplicated WSM API.
  41. * Device does not accept per-PDU tx retry sequence.
  42. * It uses "tx retry policy id" instead, so driver code has to sync
  43. * linux tx retry sequences with a retry policy table in the device.
  44. */
  45. void tx_policy_init(struct cw1200_common *priv);
  46. void tx_policy_upload_work(struct work_struct *work);
  47. void tx_policy_clean(struct cw1200_common *priv);
  48. /* ******************************************************************** */
  49. /* TX implementation */
  50. u32 cw1200_rate_mask_to_wsm(struct cw1200_common *priv,
  51. u32 rates);
  52. void cw1200_tx(struct ieee80211_hw *dev,
  53. struct ieee80211_tx_control *control,
  54. struct sk_buff *skb);
  55. void cw1200_skb_dtor(struct cw1200_common *priv,
  56. struct sk_buff *skb,
  57. const struct cw1200_txpriv *txpriv);
  58. /* ******************************************************************** */
  59. /* WSM callbacks */
  60. void cw1200_tx_confirm_cb(struct cw1200_common *priv,
  61. int link_id,
  62. struct wsm_tx_confirm *arg);
  63. void cw1200_rx_cb(struct cw1200_common *priv,
  64. struct wsm_rx *arg,
  65. int link_id,
  66. struct sk_buff **skb_p);
  67. /* ******************************************************************** */
  68. /* Timeout */
  69. void cw1200_tx_timeout(struct work_struct *work);
  70. /* ******************************************************************** */
  71. /* Security */
  72. int cw1200_alloc_key(struct cw1200_common *priv);
  73. void cw1200_free_key(struct cw1200_common *priv, int idx);
  74. void cw1200_free_keys(struct cw1200_common *priv);
  75. int cw1200_upload_keys(struct cw1200_common *priv);
  76. /* ******************************************************************** */
  77. /* Workaround for WFD test case 6.1.10 */
  78. void cw1200_link_id_reset(struct work_struct *work);
  79. #define CW1200_LINK_ID_GC_TIMEOUT ((unsigned long)(10 * HZ))
  80. int cw1200_find_link_id(struct cw1200_common *priv, const u8 *mac);
  81. int cw1200_alloc_link_id(struct cw1200_common *priv, const u8 *mac);
  82. void cw1200_link_id_work(struct work_struct *work);
  83. void cw1200_link_id_gc_work(struct work_struct *work);
  84. #endif /* CW1200_TXRX_H */