data_tx.h 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * Datapath implementation.
  4. *
  5. * Copyright (c) 2017-2020, Silicon Laboratories, Inc.
  6. * Copyright (c) 2010, ST-Ericsson
  7. */
  8. #ifndef WFX_DATA_TX_H
  9. #define WFX_DATA_TX_H
  10. #include <linux/list.h>
  11. #include <net/mac80211.h>
  12. #include "hif_api_cmd.h"
  13. #include "hif_api_mib.h"
  14. struct wfx_tx_priv;
  15. struct wfx_dev;
  16. struct wfx_vif;
  17. struct tx_policy {
  18. struct list_head link;
  19. int usage_count;
  20. u8 rates[12];
  21. bool uploaded;
  22. };
  23. struct tx_policy_cache {
  24. struct tx_policy cache[HIF_TX_RETRY_POLICY_MAX];
  25. // FIXME: use a trees and drop hash from tx_policy
  26. struct list_head used;
  27. struct list_head free;
  28. spinlock_t lock;
  29. };
  30. struct wfx_tx_priv {
  31. ktime_t xmit_timestamp;
  32. unsigned char icv_size;
  33. };
  34. void wfx_tx_policy_init(struct wfx_vif *wvif);
  35. void wfx_tx_policy_upload_work(struct work_struct *work);
  36. void wfx_tx(struct ieee80211_hw *hw, struct ieee80211_tx_control *control,
  37. struct sk_buff *skb);
  38. void wfx_tx_confirm_cb(struct wfx_dev *wdev, const struct hif_cnf_tx *arg);
  39. void wfx_flush(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
  40. u32 queues, bool drop);
  41. static inline struct wfx_tx_priv *wfx_skb_tx_priv(struct sk_buff *skb)
  42. {
  43. struct ieee80211_tx_info *tx_info;
  44. if (!skb)
  45. return NULL;
  46. tx_info = IEEE80211_SKB_CB(skb);
  47. return (struct wfx_tx_priv *)tx_info->rate_driver_data;
  48. }
  49. static inline struct hif_req_tx *wfx_skb_txreq(struct sk_buff *skb)
  50. {
  51. struct hif_msg *hif = (struct hif_msg *)skb->data;
  52. struct hif_req_tx *req = (struct hif_req_tx *)hif->body;
  53. return req;
  54. }
  55. #endif /* WFX_DATA_TX_H */