1 /* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */
2 /*
3 * Copyright (C) 2024 Intel Corporation
4 */
5 #ifndef __iwl_mld_tx_h__
6 #define __iwl_mld_tx_h__
7
8 #include "mld.h"
9
10 #define IWL_MLD_INVALID_QUEUE 0xFFFF
11 #define IWL_MLD_INVALID_DROP_TX 0xFFFE
12
13 /**
14 * struct iwl_mld_txq - TX Queue data
15 *
16 * @fw_id: the fw id of this txq. Only valid when &status.allocated is true.
17 * @status: bitmap of the txq status
18 * @status.allocated: Indicates that the queue was allocated.
19 * @status.stop_full: Indicates that the queue is full and should stop TXing.
20 * @list: list pointer, for &mld::txqs_to_add
21 * @tx_request: makes sure that if there are multiple threads that want to tx
22 * from this txq, only one of them will do all the TXing.
23 * This is needed to avoid spinning the trans txq lock, which is expensive
24 */
25 struct iwl_mld_txq {
26 /* Add here fields that need clean up on restart */
27 struct_group(zeroed_on_hw_restart,
28 u16 fw_id;
29 struct {
30 u8 allocated:1;
31 u8 stop_full:1;
32 } status;
33 );
34 struct list_head list;
35 atomic_t tx_request;
36 /* And here fields that survive a fw restart */
37 };
38
iwl_mld_init_txq(struct iwl_mld_txq * mld_txq)39 static inline void iwl_mld_init_txq(struct iwl_mld_txq *mld_txq)
40 {
41 INIT_LIST_HEAD(&mld_txq->list);
42 atomic_set(&mld_txq->tx_request, 0);
43 }
44
45 static inline struct iwl_mld_txq *
iwl_mld_txq_from_mac80211(struct ieee80211_txq * txq)46 iwl_mld_txq_from_mac80211(struct ieee80211_txq *txq)
47 {
48 return (void *)txq->drv_priv;
49 }
50
51 void iwl_mld_add_txqs_wk(struct wiphy *wiphy, struct wiphy_work *wk);
52 void iwl_mld_remove_txq(struct iwl_mld *mld, struct ieee80211_txq *txq);
53 void iwl_mld_add_txq_list(struct iwl_mld *mld);
54 void
55 iwl_mld_free_txq(struct iwl_mld *mld, u32 fw_sta_mask, u32 tid, u32 queue_id);
56 void iwl_mld_tx_from_txq(struct iwl_mld *mld, struct ieee80211_txq *txq);
57 void iwl_mld_handle_tx_resp_notif(struct iwl_mld *mld,
58 struct iwl_rx_packet *pkt);
59 int iwl_mld_flush_link_sta_txqs(struct iwl_mld *mld, u32 fw_sta_id);
60 int iwl_mld_ensure_queue(struct iwl_mld *mld, struct ieee80211_txq *txq);
61
62 int iwl_mld_update_sta_txqs(struct iwl_mld *mld,
63 struct ieee80211_sta *sta,
64 u32 old_sta_mask, u32 new_sta_mask);
65
66 void iwl_mld_handle_compressed_ba_notif(struct iwl_mld *mld,
67 struct iwl_rx_packet *pkt);
68 void iwl_mld_toggle_tx_ant(struct iwl_mld *mld, u8 *ant);
69
70 u8 iwl_mld_get_lowest_rate(struct iwl_mld *mld,
71 struct ieee80211_tx_info *info,
72 struct ieee80211_vif *vif);
73
74 void iwl_mld_tx_skb(struct iwl_mld *mld, struct sk_buff *skb,
75 struct ieee80211_txq *txq);
76
77 #endif /* __iwl_mld_tx_h__ */
78