aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/iwlwifi/iwl-trans.h
diff options
context:
space:
mode:
authorEmmanuel Grumbach <emmanuel.grumbach@intel.com>2011-07-11 08:51:04 +0300
committerWey-Yi Guy <wey-yi.w.guy@intel.com>2011-07-21 07:29:48 -0700
commit41c50542669cd7aec45ad708f5120ff8fdaa1194 (patch)
treefb0d02e7a0047e4ea480cb6cea64b09c7838b845 /drivers/net/wireless/iwlwifi/iwl-trans.h
parentiwlagn: move iwl_prepare_card_hw to the transport layer (diff)
downloadlinux-dev-41c50542669cd7aec45ad708f5120ff8fdaa1194.tar.xz
linux-dev-41c50542669cd7aec45ad708f5120ff8fdaa1194.zip
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 '')
-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 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*****************************************************************************/
+#ifndef __iwl_trans_h__
+#define __iwl_trans_h__
/*This file includes the declaration that are exported from the transport
* layer */
-static inline int trans_start_device(struct iwl_priv *priv)
+struct iwl_priv;
+struct iwl_rxon_context;
+struct iwl_host_cmd;
+
+/**
+ * struct iwl_trans_ops - transport specific operations
+ * @start_device: allocates and inits all the resources for the transport
+ * layer.
+ * @prepare_card_hw: claim the ownership on the HW. Will be called during
+ * probe.
+ * @tx_start: starts and configures all the Tx fifo - usually done once the fw
+ * is alive.
+ * @stop_device:stops the whole device (embedded CPU put to reset)
+ * @rx_free: frees the rx memory
+ * @tx_free: frees the tx memory
+ * @send_cmd:send a host command
+ * @send_cmd_pdu:send a host command: flags can be CMD_*
+ * @get_tx_cmd: returns a pointer to a new Tx cmd for the upper layer use
+ * @tx: send an skb
+ * @txq_agg_setup: setup a tx queue for AMPDU - will be called once the HW is
+ * ready and a successful ADDBA response has been received.
+ * @txq_agg_disable: de-configure a Tx queue to send AMPDUs
+ * @kick_nic: remove the RESET from the embedded CPU and let it run
+ * @sync_irq: the upper layer will typically disable interrupt and call this
+ * handler. After this handler returns, it is guaranteed that all
+ * the ISR / tasklet etc... have finished running and the transport
+ * layer shall not pass any Rx.
+ * @free: release all the ressource for the transport layer itself such as
+ * irq, tasklet etc...
+ */
+struct iwl_trans_ops {
+
+ int (*start_device)(struct iwl_priv *priv);
+ int (*prepare_card_hw)(struct iwl_priv *priv);
+ void (*stop_device)(struct iwl_priv *priv);
+ void (*tx_start)(struct iwl_priv *priv);
+ void (*tx_free)(struct iwl_priv *priv);
+ void (*rx_free)(struct iwl_priv *priv);
+
+ int (*send_cmd)(struct iwl_priv *priv, struct iwl_host_cmd *cmd);
+
+ int (*send_cmd_pdu)(struct iwl_priv *priv, u8 id, u32 flags, u16 len,
+ const void *data);
+ struct iwl_tx_cmd * (*get_tx_cmd)(struct iwl_priv *priv, int txq_id);
+ int (*tx)(struct iwl_priv *priv, struct sk_buff *skb,
+ struct iwl_tx_cmd *tx_cmd, int txq_id, __le16 fc, bool ampdu,
+ struct iwl_rxon_context *ctx);
+
+ int (*txq_agg_disable)(struct iwl_priv *priv, u16 txq_id,
+ u16 ssn_idx, u8 tx_fifo);
+ void (*txq_agg_setup)(struct iwl_priv *priv, int sta_id, int tid,
+ int frame_limit);
+
+ void (*kick_nic)(struct iwl_priv *priv);
+
+ void (*sync_irq)(struct iwl_priv *priv);
+ void (*free)(struct iwl_priv *priv);
+};
+
+struct iwl_trans {
+ const struct iwl_trans_ops *ops;
+ struct iwl_priv *priv;
+};
+
+static inline int trans_start_device(struct iwl_trans *trans)
{
- return priv->trans.ops->start_device(priv);
+ return trans->ops->start_device(trans->priv);
}
-static inline int trans_prepare_card_hw(struct iwl_priv *priv)
+static inline int trans_prepare_card_hw(struct iwl_trans *trans)
{
- return priv->trans.ops->prepare_card_hw(priv);
+ return trans->ops->prepare_card_hw(trans->priv);
}
-static inline void trans_stop_device(struct iwl_priv *priv)
+static inline void trans_stop_device(struct iwl_trans *trans)
{
- priv->trans.ops->stop_device(priv);
+ trans->ops->stop_device(trans->priv);
}
-static inline void trans_tx_start(struct iwl_priv *priv)
+static inline void trans_tx_start(struct iwl_trans *trans)
{
- priv->trans.ops->tx_start(priv);
+ trans->ops->tx_start(trans->priv);
}
-static inline void trans_rx_free(struct iwl_priv *priv)
+static inline void trans_rx_free(struct iwl_trans *trans)
{
- priv->trans.ops->rx_free(priv);
+ trans->ops->rx_free(trans->priv);
}
-static inline void trans_tx_free(struct iwl_priv *priv)
+static inline void trans_tx_free(struct iwl_trans *trans)
{
- priv->trans.ops->tx_free(priv);
+ trans->ops->tx_free(trans->priv);
}
-static inline int trans_send_cmd(struct iwl_priv *priv,
+static inline int trans_send_cmd(struct iwl_trans *trans,
struct iwl_host_cmd *cmd)
{
- return priv->trans.ops->send_cmd(priv, cmd);
+ return trans->ops->send_cmd(trans->priv, cmd);
}
-static inline int trans_send_cmd_pdu(struct iwl_priv *priv, u8 id, u32 flags,
+static inline int trans_send_cmd_pdu(struct iwl_trans *trans, u8 id, u32 flags,
u16 len, const void *data)
{
- return priv->trans.ops->send_cmd_pdu(priv, id, flags, len, data);
+ return trans->ops->send_cmd_pdu(trans->priv, id, flags, len, data);
}
-static inline struct iwl_tx_cmd *trans_get_tx_cmd(struct iwl_priv *priv,
+static inline struct iwl_tx_cmd *trans_get_tx_cmd(struct iwl_trans *trans,
int txq_id)
{
- return priv->trans.ops->get_tx_cmd(priv, txq_id);
+ return trans->ops->get_tx_cmd(trans->priv, txq_id);
}
-static inline int trans_tx(struct iwl_priv *priv, struct sk_buff *skb,
+static inline int trans_tx(struct iwl_trans *trans, struct sk_buff *skb,
struct iwl_tx_cmd *tx_cmd, int txq_id, __le16 fc, bool ampdu,
struct iwl_rxon_context *ctx)
{
- return priv->trans.ops->tx(priv, skb, tx_cmd, txq_id, fc, ampdu, ctx);
+ return trans->ops->tx(trans->priv, skb, tx_cmd, txq_id, fc, ampdu, ctx);
}
-static inline int trans_txq_agg_disable(struct iwl_priv *priv, u16 txq_id,
+static inline int trans_txq_agg_disable(struct iwl_trans *trans, u16 txq_id,
u16 ssn_idx, u8 tx_fifo)
{
- return priv->trans.ops->txq_agg_disable(priv, txq_id, ssn_idx, tx_fifo);
+ return trans->ops->txq_agg_disable(trans->priv, txq_id,
+ ssn_idx, tx_fifo);
}
-static inline void trans_txq_agg_setup(struct iwl_priv *priv, int sta_id,
+static inline void trans_txq_agg_setup(struct iwl_trans *trans, int sta_id,
int tid, int frame_limit)
{
- priv->trans.ops->txq_agg_setup(priv, sta_id, tid, frame_limit);
+ trans->ops->txq_agg_setup(trans->priv, sta_id, tid, frame_limit);
}
-static inline void trans_kick_nic(struct iwl_priv *priv)
+static inline void trans_kick_nic(struct iwl_trans *trans)
{
- priv->trans.ops->kick_nic(priv);
+ trans->ops->kick_nic(trans->priv);
}
-static inline void trans_sync_irq(struct iwl_priv *priv)
+static inline void trans_sync_irq(struct iwl_trans *trans)
{
- priv->trans.ops->sync_irq(priv);
+ trans->ops->sync_irq(trans->priv);
}
-static inline void trans_free(struct iwl_priv *priv)
+static inline void trans_free(struct iwl_trans *trans)
{
- priv->trans.ops->free(priv);
+ trans->ops->free(trans->priv);
}
-int iwl_trans_register(struct iwl_priv *priv);
+int iwl_trans_register(struct iwl_trans *trans, struct iwl_priv *priv);
/*TODO: this functions should NOT be exported from trans module - export it
* until the reclaim flow will be brought to the transport module too */
+
+struct iwl_tx_queue;
void iwlagn_txq_inval_byte_cnt_tbl(struct iwl_priv *priv,
struct iwl_tx_queue *txq);
+
+#endif /* __iwl_trans_h__ */