aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/iwlwifi/iwl-trans.h
diff options
context:
space:
mode:
authorEmmanuel Grumbach <emmanuel.grumbach@intel.com>2011-07-11 01:51:04 -0400
committerWey-Yi Guy <wey-yi.w.guy@intel.com>2011-07-21 10:29:48 -0400
commit41c50542669cd7aec45ad708f5120ff8fdaa1194 (patch)
treefb0d02e7a0047e4ea480cb6cea64b09c7838b845 /drivers/net/wireless/iwlwifi/iwl-trans.h
parent0286cee0d2b6357e8e30d817bbce8ff166f358b5 (diff)
iwlagn: transport layer receives struct iwl_trans*
It still holds a pointer to iwl_priv. But hopefully this will disappear at some point. Also add the multiple inclusion protection to iwl-trans.h that was forgotten. Move iwl-trans structures to iwl-trans.h Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com> Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
Diffstat (limited to 'drivers/net/wireless/iwlwifi/iwl-trans.h')
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-trans.h133
1 files changed, 102 insertions, 31 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-trans.h b/drivers/net/wireless/iwlwifi/iwl-trans.h
index fca01819f10c..7993aa7ae668 100644
--- a/drivers/net/wireless/iwlwifi/iwl-trans.h
+++ b/drivers/net/wireless/iwlwifi/iwl-trans.h
@@ -60,95 +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 *****************************************************************************/
63#ifndef __iwl_trans_h__
64#define __iwl_trans_h__
63 65
64 /*This file includes the declaration that are exported from the transport 66 /*This file includes the declaration that are exported from the transport
65 * layer */ 67 * layer */
66 68
67static inline int trans_start_device(struct iwl_priv *priv) 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)
68{ 134{
69 return priv->trans.ops->start_device(priv); 135 return trans->ops->start_device(trans->priv);
70} 136}
71 137
72static inline int trans_prepare_card_hw(struct iwl_priv *priv) 138static inline int trans_prepare_card_hw(struct iwl_trans *trans)
73{ 139{
74 return priv->trans.ops->prepare_card_hw(priv); 140 return trans->ops->prepare_card_hw(trans->priv);
75} 141}
76 142
77static inline void trans_stop_device(struct iwl_priv *priv) 143static inline void trans_stop_device(struct iwl_trans *trans)
78{ 144{
79 priv->trans.ops->stop_device(priv); 145 trans->ops->stop_device(trans->priv);
80} 146}
81 147
82static inline void trans_tx_start(struct iwl_priv *priv) 148static inline void trans_tx_start(struct iwl_trans *trans)
83{ 149{
84 priv->trans.ops->tx_start(priv); 150 trans->ops->tx_start(trans->priv);
85} 151}
86 152
87static inline void trans_rx_free(struct iwl_priv *priv) 153static inline void trans_rx_free(struct iwl_trans *trans)
88{ 154{
89 priv->trans.ops->rx_free(priv); 155 trans->ops->rx_free(trans->priv);
90} 156}
91 157
92static inline void trans_tx_free(struct iwl_priv *priv) 158static inline void trans_tx_free(struct iwl_trans *trans)
93{ 159{
94 priv->trans.ops->tx_free(priv); 160 trans->ops->tx_free(trans->priv);
95} 161}
96 162
97static inline int trans_send_cmd(struct iwl_priv *priv, 163static inline int trans_send_cmd(struct iwl_trans *trans,
98 struct iwl_host_cmd *cmd) 164 struct iwl_host_cmd *cmd)
99{ 165{
100 return priv->trans.ops->send_cmd(priv, cmd); 166 return trans->ops->send_cmd(trans->priv, cmd);
101} 167}
102 168
103static 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,
104 u16 len, const void *data) 170 u16 len, const void *data)
105{ 171{
106 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);
107} 173}
108 174
109static inline struct iwl_tx_cmd *trans_get_tx_cmd(struct iwl_priv *priv, 175static inline struct iwl_tx_cmd *trans_get_tx_cmd(struct iwl_trans *trans,
110 int txq_id) 176 int txq_id)
111{ 177{
112 return priv->trans.ops->get_tx_cmd(priv, txq_id); 178 return trans->ops->get_tx_cmd(trans->priv, txq_id);
113} 179}
114 180
115static inline int trans_tx(struct iwl_priv *priv, struct sk_buff *skb, 181static inline int trans_tx(struct iwl_trans *trans, struct sk_buff *skb,
116 struct iwl_tx_cmd *tx_cmd, int txq_id, __le16 fc, bool ampdu, 182 struct iwl_tx_cmd *tx_cmd, int txq_id, __le16 fc, bool ampdu,
117 struct iwl_rxon_context *ctx) 183 struct iwl_rxon_context *ctx)
118{ 184{
119 return priv->trans.ops->tx(priv, skb, tx_cmd, txq_id, fc, ampdu, ctx); 185 return trans->ops->tx(trans->priv, skb, tx_cmd, txq_id, fc, ampdu, ctx);
120} 186}
121 187
122static inline int trans_txq_agg_disable(struct iwl_priv *priv, u16 txq_id, 188static inline int trans_txq_agg_disable(struct iwl_trans *trans, u16 txq_id,
123 u16 ssn_idx, u8 tx_fifo) 189 u16 ssn_idx, u8 tx_fifo)
124{ 190{
125 return priv->trans.ops->txq_agg_disable(priv, txq_id, ssn_idx, tx_fifo); 191 return trans->ops->txq_agg_disable(trans->priv, txq_id,
192 ssn_idx, tx_fifo);
126} 193}
127 194
128static inline void trans_txq_agg_setup(struct iwl_priv *priv, int sta_id, 195static inline void trans_txq_agg_setup(struct iwl_trans *trans, int sta_id,
129 int tid, int frame_limit) 196 int tid, int frame_limit)
130{ 197{
131 priv->trans.ops->txq_agg_setup(priv, sta_id, tid, frame_limit); 198 trans->ops->txq_agg_setup(trans->priv, sta_id, tid, frame_limit);
132} 199}
133 200
134static inline void trans_kick_nic(struct iwl_priv *priv) 201static inline void trans_kick_nic(struct iwl_trans *trans)
135{ 202{
136 priv->trans.ops->kick_nic(priv); 203 trans->ops->kick_nic(trans->priv);
137} 204}
138 205
139static inline void trans_sync_irq(struct iwl_priv *priv) 206static inline void trans_sync_irq(struct iwl_trans *trans)
140{ 207{
141 priv->trans.ops->sync_irq(priv); 208 trans->ops->sync_irq(trans->priv);
142} 209}
143 210
144static inline void trans_free(struct iwl_priv *priv) 211static inline void trans_free(struct iwl_trans *trans)
145{ 212{
146 priv->trans.ops->free(priv); 213 trans->ops->free(trans->priv);
147} 214}
148 215
149int iwl_trans_register(struct iwl_priv *priv); 216int iwl_trans_register(struct iwl_trans *trans, struct iwl_priv *priv);
150 217
151/*TODO: this functions should NOT be exported from trans module - export it 218/*TODO: this functions should NOT be exported from trans module - export it
152 * until the reclaim flow will be brought to the transport module too */ 219 * until the reclaim flow will be brought to the transport module too */
220
221struct iwl_tx_queue;
153void iwlagn_txq_inval_byte_cnt_tbl(struct iwl_priv *priv, 222void iwlagn_txq_inval_byte_cnt_tbl(struct iwl_priv *priv,
154 struct iwl_tx_queue *txq); 223 struct iwl_tx_queue *txq);
224
225#endif /* __iwl_trans_h__ */