txrx.h 3.2 KB

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