aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/iwlwifi/iwl-trans.h
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless/iwlwifi/iwl-trans.h')
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-trans.h154
1 files changed, 137 insertions, 17 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-trans.h b/drivers/net/wireless/iwlwifi/iwl-trans.h
index 111acca07d75..7993aa7ae668 100644
--- a/drivers/net/wireless/iwlwifi/iwl-trans.h
+++ b/drivers/net/wireless/iwlwifi/iwl-trans.h
@@ -60,46 +60,166 @@
60 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 60 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
61 * 61 *
62 *****************************************************************************/ 62 *****************************************************************************/
63static inline int trans_rx_init(struct iwl_priv *priv) 63#ifndef __iwl_trans_h__
64#define __iwl_trans_h__
65
66 /*This file includes the declaration that are exported from the transport
67 * layer */
68
69struct iwl_priv;
70struct iwl_rxon_context;
71struct iwl_host_cmd;
72
73/**
74 * struct iwl_trans_ops - transport specific operations
75 * @start_device: allocates and inits all the resources for the transport
76 * layer.
77 * @prepare_card_hw: claim the ownership on the HW. Will be called during
78 * probe.
79 * @tx_start: starts and configures all the Tx fifo - usually done once the fw
80 * is alive.
81 * @stop_device:stops the whole device (embedded CPU put to reset)
82 * @rx_free: frees the rx memory
83 * @tx_free: frees the tx memory
84 * @send_cmd:send a host command
85 * @send_cmd_pdu:send a host command: flags can be CMD_*
86 * @get_tx_cmd: returns a pointer to a new Tx cmd for the upper layer use
87 * @tx: send an skb
88 * @txq_agg_setup: setup a tx queue for AMPDU - will be called once the HW is
89 * ready and a successful ADDBA response has been received.
90 * @txq_agg_disable: de-configure a Tx queue to send AMPDUs
91 * @kick_nic: remove the RESET from the embedded CPU and let it run
92 * @sync_irq: the upper layer will typically disable interrupt and call this
93 * handler. After this handler returns, it is guaranteed that all
94 * the ISR / tasklet etc... have finished running and the transport
95 * layer shall not pass any Rx.
96 * @free: release all the ressource for the transport layer itself such as
97 * irq, tasklet etc...
98 */
99struct iwl_trans_ops {
100
101 int (*start_device)(struct iwl_priv *priv);
102 int (*prepare_card_hw)(struct iwl_priv *priv);
103 void (*stop_device)(struct iwl_priv *priv);
104 void (*tx_start)(struct iwl_priv *priv);
105 void (*tx_free)(struct iwl_priv *priv);
106 void (*rx_free)(struct iwl_priv *priv);
107
108 int (*send_cmd)(struct iwl_priv *priv, struct iwl_host_cmd *cmd);
109
110 int (*send_cmd_pdu)(struct iwl_priv *priv, u8 id, u32 flags, u16 len,
111 const void *data);
112 struct iwl_tx_cmd * (*get_tx_cmd)(struct iwl_priv *priv, int txq_id);
113 int (*tx)(struct iwl_priv *priv, struct sk_buff *skb,
114 struct iwl_tx_cmd *tx_cmd, int txq_id, __le16 fc, bool ampdu,
115 struct iwl_rxon_context *ctx);
116
117 int (*txq_agg_disable)(struct iwl_priv *priv, u16 txq_id,
118 u16 ssn_idx, u8 tx_fifo);
119 void (*txq_agg_setup)(struct iwl_priv *priv, int sta_id, int tid,
120 int frame_limit);
121
122 void (*kick_nic)(struct iwl_priv *priv);
123
124 void (*sync_irq)(struct iwl_priv *priv);
125 void (*free)(struct iwl_priv *priv);
126};
127
128struct iwl_trans {
129 const struct iwl_trans_ops *ops;
130 struct iwl_priv *priv;
131};
132
133static inline int trans_start_device(struct iwl_trans *trans)
64{ 134{
65 return priv->trans.ops->rx_init(priv); 135 return trans->ops->start_device(trans->priv);
66} 136}
67 137
68static inline int trans_rx_stop(struct iwl_priv *priv) 138static inline int trans_prepare_card_hw(struct iwl_trans *trans)
69{ 139{
70 return priv->trans.ops->rx_stop(priv); 140 return trans->ops->prepare_card_hw(trans->priv);
71} 141}
72 142
73static inline void trans_rx_free(struct iwl_priv *priv) 143static inline void trans_stop_device(struct iwl_trans *trans)
74{ 144{
75 priv->trans.ops->rx_free(priv); 145 trans->ops->stop_device(trans->priv);
76} 146}
77 147
78static inline int trans_tx_init(struct iwl_priv *priv) 148static inline void trans_tx_start(struct iwl_trans *trans)
79{ 149{
80 return priv->trans.ops->tx_init(priv); 150 trans->ops->tx_start(trans->priv);
81} 151}
82 152
83static inline int trans_tx_stop(struct iwl_priv *priv) 153static inline void trans_rx_free(struct iwl_trans *trans)
84{ 154{
85 return priv->trans.ops->tx_stop(priv); 155 trans->ops->rx_free(trans->priv);
86} 156}
87 157
88static inline void trans_tx_free(struct iwl_priv *priv) 158static inline void trans_tx_free(struct iwl_trans *trans)
89{ 159{
90 priv->trans.ops->tx_free(priv); 160 trans->ops->tx_free(trans->priv);
91} 161}
92 162
93static inline int trans_send_cmd(struct iwl_priv *priv, 163static inline int trans_send_cmd(struct iwl_trans *trans,
94 struct iwl_host_cmd *cmd) 164 struct iwl_host_cmd *cmd)
95{ 165{
96 return priv->trans.ops->send_cmd(priv, cmd); 166 return trans->ops->send_cmd(trans->priv, cmd);
97} 167}
98 168
99static inline int trans_send_cmd_pdu(struct iwl_priv *priv, u8 id, u32 flags, 169static inline int trans_send_cmd_pdu(struct iwl_trans *trans, u8 id, u32 flags,
100 u16 len, const void *data) 170 u16 len, const void *data)
101{ 171{
102 return priv->trans.ops->send_cmd_pdu(priv, id, flags, len, data); 172 return trans->ops->send_cmd_pdu(trans->priv, id, flags, len, data);
173}
174
175static inline struct iwl_tx_cmd *trans_get_tx_cmd(struct iwl_trans *trans,
176 int txq_id)
177{
178 return trans->ops->get_tx_cmd(trans->priv, txq_id);
103} 179}
104 180
105void iwl_trans_register(struct iwl_trans *trans); 181static inline int trans_tx(struct iwl_trans *trans, struct sk_buff *skb,
182 struct iwl_tx_cmd *tx_cmd, int txq_id, __le16 fc, bool ampdu,
183 struct iwl_rxon_context *ctx)
184{
185 return trans->ops->tx(trans->priv, skb, tx_cmd, txq_id, fc, ampdu, ctx);
186}
187
188static inline int trans_txq_agg_disable(struct iwl_trans *trans, u16 txq_id,
189 u16 ssn_idx, u8 tx_fifo)
190{
191 return trans->ops->txq_agg_disable(trans->priv, txq_id,
192 ssn_idx, tx_fifo);
193}
194
195static inline void trans_txq_agg_setup(struct iwl_trans *trans, int sta_id,
196 int tid, int frame_limit)
197{
198 trans->ops->txq_agg_setup(trans->priv, sta_id, tid, frame_limit);
199}
200
201static inline void trans_kick_nic(struct iwl_trans *trans)
202{
203 trans->ops->kick_nic(trans->priv);
204}
205
206static inline void trans_sync_irq(struct iwl_trans *trans)
207{
208 trans->ops->sync_irq(trans->priv);
209}
210
211static inline void trans_free(struct iwl_trans *trans)
212{
213 trans->ops->free(trans->priv);
214}
215
216int iwl_trans_register(struct iwl_trans *trans, struct iwl_priv *priv);
217
218/*TODO: this functions should NOT be exported from trans module - export it
219 * until the reclaim flow will be brought to the transport module too */
220
221struct iwl_tx_queue;
222void iwlagn_txq_inval_byte_cnt_tbl(struct iwl_priv *priv,
223 struct iwl_tx_queue *txq);
224
225#endif /* __iwl_trans_h__ */