return -EFAULT;
        }
 
-       return iwl_send_cmd_sync(priv, &hcmd);
+       return priv->trans.ops->send_cmd(priv, &hcmd);
 }
 
 static struct iwl_lib_ops iwl5000_lib = {
 
                return -EFAULT;
        }
 
-       return iwl_send_cmd_sync(priv, &hcmd);
+       return priv->trans.ops->send_cmd(priv, &hcmd);
 }
 
 static struct iwl_lib_ops iwl6000_lib = {
 
 
        struct iwl_host_cmd hcmd = {
                .id = REPLY_PHY_CALIBRATION_CMD,
+               .flags = CMD_SYNC,
        };
 
        for (i = 0; i < IWL_CALIB_MAX; i++) {
                        hcmd.len[0] = priv->calib_results[i].buf_len;
                        hcmd.data[0] = priv->calib_results[i].buf;
                        hcmd.dataflags[0] = IWL_HCMD_DFL_NOCOPY;
-                       ret = iwl_send_cmd_sync(priv, &hcmd);
+                       ret = priv->trans.ops->send_cmd(priv, &hcmd);
                        if (ret) {
                                IWL_ERR(priv, "Error %d iteration %d\n",
                                        ret, i);
        memcpy(&(priv->sensitivity_tbl[0]), &(cmd.table[0]),
               sizeof(u16)*HD_TABLE_SIZE);
 
-       return iwl_send_cmd(priv, &cmd_out);
+       return priv->trans.ops->send_cmd(priv, &cmd_out);
 }
 
 /* Prepare a SENSITIVITY_CMD, send to uCode if values have changed */
               &(cmd.enhance_table[HD_INA_NON_SQUARE_DET_OFDM_INDEX]),
               sizeof(u16)*ENHANCE_HD_TABLE_ENTRIES);
 
-       return iwl_send_cmd(priv, &cmd_out);
+       return priv->trans.ops->send_cmd(priv, &cmd_out);
 }
 
 void iwl_init_sensitivity(struct iwl_priv *priv)
 
 
        if (IWL_UCODE_API(priv->ucode_ver) > 1) {
                IWL_DEBUG_HC(priv, "select valid tx ant: %u\n", valid_tx_ant);
-               return iwl_send_cmd_pdu(priv, TX_ANT_CONFIGURATION_CMD,
+               return priv->trans.ops->send_cmd_pdu(priv,
+                                       TX_ANT_CONFIGURATION_CMD,
+                                       CMD_SYNC,
                                        sizeof(struct iwl_tx_ant_config_cmd),
                                        &tx_ant_cmd);
        } else {
                        priv->_agn.phy_calib_chain_noise_gain_cmd);
                cmd.delta_gain_1 = data->delta_gain_code[1];
                cmd.delta_gain_2 = data->delta_gain_code[2];
-               iwl_send_cmd_pdu_async(priv, REPLY_PHY_CALIBRATION_CMD,
-                       sizeof(cmd), &cmd, NULL);
+               priv->trans.ops->send_cmd_pdu(priv, REPLY_PHY_CALIBRATION_CMD,
+                       CMD_ASYNC, sizeof(cmd), &cmd);
 
                data->radio_write = 1;
                data->state = IWL_CHAIN_NOISE_CALIBRATED;
                memset(&cmd, 0, sizeof(cmd));
                iwl_set_calib_hdr(&cmd.hdr,
                        priv->_agn.phy_calib_chain_noise_reset_cmd);
-               ret = iwl_send_cmd_pdu(priv, REPLY_PHY_CALIBRATION_CMD,
-                                       sizeof(cmd), &cmd);
+               ret = priv->trans.ops->send_cmd_pdu(priv,
+                                       REPLY_PHY_CALIBRATION_CMD,
+                                       CMD_SYNC, sizeof(cmd), &cmd);
                if (ret)
                        IWL_ERR(priv,
                                "Could not send REPLY_PHY_CALIBRATION_CMD\n");
        cmd.slots[0].width = cpu_to_le16(slot0);
        cmd.slots[1].width = cpu_to_le16(slot1);
 
-       ret = iwl_send_cmd_pdu(priv, REPLY_WIPAN_PARAMS, sizeof(cmd), &cmd);
+       ret = priv->trans.ops->send_cmd_pdu(priv, REPLY_WIPAN_PARAMS, CMD_SYNC,
+                       sizeof(cmd), &cmd);
        if (ret)
                IWL_ERR(priv, "Error setting PAN parameters (%d)\n", ret);
 
 
        else
                tx_ant_cfg_cmd = REPLY_TX_POWER_DBM_CMD;
 
-       return iwl_send_cmd_pdu(priv, tx_ant_cfg_cmd, sizeof(tx_power_cmd),
-                               &tx_power_cmd);
+       return priv->trans.ops->send_cmd_pdu(priv, tx_ant_cfg_cmd, CMD_SYNC,
+                       sizeof(tx_power_cmd), &tx_power_cmd);
 }
 
 void iwlagn_temperature(struct iwl_priv *priv)
        struct iwl_host_cmd cmd = {
                .id = REPLY_SCAN_CMD,
                .len = { sizeof(struct iwl_scan_cmd), },
+               .flags = CMD_SYNC,
        };
        struct iwl_scan_cmd *scan;
        struct iwl_rxon_context *ctx = &priv->contexts[IWL_RXON_CTX_BSS];
        if (ret)
                return ret;
 
-       ret = iwl_send_cmd_sync(priv, &cmd);
+       ret = priv->trans.ops->send_cmd(priv, &cmd);
        if (ret) {
                clear_bit(STATUS_SCAN_HW, &priv->status);
                iwlagn_set_pan_params(priv);
                       flush_cmd.fifo_control);
        flush_cmd.flush_control = cpu_to_le16(flush_control);
 
-       return iwl_send_cmd(priv, &cmd);
+       return priv->trans.ops->send_cmd(priv, &cmd);
 }
 
 void iwlagn_dev_txfifo_flush(struct iwl_priv *priv, u16 flush_control)
        if (priv->cfg->bt_params->bt_session_2) {
                memcpy(&bt_cmd_2000.basic, &basic,
                        sizeof(basic));
-               ret = iwl_send_cmd_pdu(priv, REPLY_BT_CONFIG,
-                       sizeof(bt_cmd_2000), &bt_cmd_2000);
+               ret = priv->trans.ops->send_cmd_pdu(priv, REPLY_BT_CONFIG,
+                       CMD_SYNC, sizeof(bt_cmd_2000), &bt_cmd_2000);
        } else {
                memcpy(&bt_cmd_6000.basic, &basic,
                        sizeof(basic));
-               ret = iwl_send_cmd_pdu(priv, REPLY_BT_CONFIG,
-                       sizeof(bt_cmd_6000), &bt_cmd_6000);
+               ret = priv->trans.ops->send_cmd_pdu(priv, REPLY_BT_CONFIG,
+                       CMD_SYNC, sizeof(bt_cmd_6000), &bt_cmd_6000);
        }
        if (ret)
                IWL_ERR(priv, "failed to send BT Coex Config\n");
 
        int ret;
 
        send->filter_flags &= ~RXON_FILTER_ASSOC_MSK;
-       ret = iwl_send_cmd_pdu(priv, ctx->rxon_cmd, sizeof(*send), send);
+       ret = priv->trans.ops->send_cmd_pdu(priv, ctx->rxon_cmd,
+                               CMD_SYNC, sizeof(*send), send);
 
        send->filter_flags = old_filter;
 
 
        send->filter_flags &= ~RXON_FILTER_ASSOC_MSK;
        send->dev_type = RXON_DEV_TYPE_P2P;
-       ret = iwl_send_cmd_pdu(priv, ctx->rxon_cmd, sizeof(*send), send);
+       ret = priv->trans.ops->send_cmd_pdu(priv, ctx->rxon_cmd,
+                               CMD_SYNC, sizeof(*send), send);
 
        send->filter_flags = old_filter;
        send->dev_type = old_dev_type;
        int ret;
 
        send->filter_flags &= ~RXON_FILTER_ASSOC_MSK;
-       ret = iwl_send_cmd_pdu(priv, ctx->rxon_cmd, sizeof(*send), send);
+       ret = priv->trans.ops->send_cmd_pdu(priv, ctx->rxon_cmd, CMD_SYNC,
+                               sizeof(*send), send);
 
        send->filter_flags = old_filter;
 
                      ctx->qos_data.qos_active,
                      ctx->qos_data.def_qos_parm.qos_flags);
 
-       ret = iwl_send_cmd_pdu(priv, ctx->qos_cmd,
+       ret = priv->trans.ops->send_cmd_pdu(priv, ctx->qos_cmd, CMD_SYNC,
                               sizeof(struct iwl_qosparam_cmd),
                               &ctx->qos_data.def_qos_parm);
        if (ret)
                 ctx->staging.ofdm_ht_triple_stream_basic_rates;
        rxon_assoc.acquisition_data = ctx->staging.acquisition_data;
 
-       ret = iwl_send_cmd_pdu_async(priv, ctx->rxon_assoc_cmd,
-                                    sizeof(rxon_assoc), &rxon_assoc, NULL);
+       ret = priv->trans.ops->send_cmd_pdu(priv, ctx->rxon_assoc_cmd,
+                               CMD_ASYNC, sizeof(rxon_assoc), &rxon_assoc);
        return ret;
 }
 
         * Associated RXON doesn't clear the station table in uCode,
         * so we don't need to restore stations etc. after this.
         */
-       ret = iwl_send_cmd_pdu(priv, ctx->rxon_cmd,
+       ret = priv->trans.ops->send_cmd_pdu(priv, ctx->rxon_cmd, CMD_SYNC,
                      sizeof(struct iwl_rxon_cmd), &ctx->staging);
        if (ret) {
                IWL_ERR(priv, "Error setting new RXON (%d)\n", ret);
 
        cmd.len[0] = cmd_size;
 
        if (not_empty || send_if_empty)
-               return iwl_send_cmd(priv, &cmd);
+               return priv->trans.ops->send_cmd(priv, &cmd);
        else
                return 0;
 }
 
        calib_cfg_cmd.ucd_calib_cfg.once.send_res = IWL_CALIB_INIT_CFG_ALL;
        calib_cfg_cmd.ucd_calib_cfg.flags = IWL_CALIB_INIT_CFG_ALL;
 
-       return iwl_send_cmd(priv, &cmd);
+       return priv->trans.ops->send_cmd(priv, &cmd);
 }
 
 void iwlagn_rx_calib_result(struct iwl_priv *priv,
                /* coexistence is disabled */
                memset(&coex_cmd, 0, sizeof(coex_cmd));
        }
-       return iwl_send_cmd_pdu(priv, COEX_PRIORITY_TABLE_CMD,
+       return priv->trans.ops->send_cmd_pdu(priv,
+                               COEX_PRIORITY_TABLE_CMD, CMD_SYNC,
                                sizeof(coex_cmd), &coex_cmd);
 }
 
 
        memcpy(prio_tbl_cmd.prio_tbl, iwlagn_bt_prio_tbl,
                sizeof(iwlagn_bt_prio_tbl));
-       if (iwl_send_cmd_pdu(priv, REPLY_BT_COEX_PRIO_TABLE,
+       if (priv->trans.ops->send_cmd_pdu(priv,
+                               REPLY_BT_COEX_PRIO_TABLE, CMD_SYNC,
                                sizeof(prio_tbl_cmd), &prio_tbl_cmd))
                IWL_ERR(priv, "failed to send BT prio tbl command\n");
 }
 
        env_cmd.action = action;
        env_cmd.type = type;
-       ret = iwl_send_cmd_pdu(priv, REPLY_BT_COEX_PROT_ENV,
+       ret = priv->trans.ops->send_cmd_pdu(priv,
+                              REPLY_BT_COEX_PROT_ENV, CMD_SYNC,
                               sizeof(env_cmd), &env_cmd);
        if (ret)
                IWL_ERR(priv, "failed to send BT env command\n");
 
        struct iwl_tx_beacon_cmd *tx_beacon_cmd;
        struct iwl_host_cmd cmd = {
                .id = REPLY_TX_BEACON,
+               .flags = CMD_SYNC,
        };
        struct ieee80211_tx_info *info;
        u32 frame_size;
        cmd.data[1] = priv->beacon_skb->data;
        cmd.dataflags[1] = IWL_HCMD_DFL_NOCOPY;
 
-       return iwl_send_cmd_sync(priv, &cmd);
+       return priv->trans.ops->send_cmd(priv, &cmd);
 }
 
 static void iwl_bg_beacon_update(struct work_struct *work)
 
                if (reclaim) {
                        /* Invoke any callbacks, transfer the buffer to caller,
-                        * and fire off the (possibly) blocking iwl_send_cmd()
+                        * and fire off the (possibly) blocking
+                        * priv->trans.ops->send_cmd()
                         * as we reclaim the driver command queue */
                        if (rxb->page)
                                iwl_tx_cmd_complete(priv, rxb);
                adv_cmd.critical_temperature_exit =
                        cpu_to_le32(priv->hw_params.ct_kill_exit_threshold);
 
-               ret = iwl_send_cmd_pdu(priv, REPLY_CT_KILL_CONFIG_CMD,
-                                      sizeof(adv_cmd), &adv_cmd);
+               ret = priv->trans.ops->send_cmd_pdu(priv,
+                                      REPLY_CT_KILL_CONFIG_CMD,
+                                      CMD_SYNC, sizeof(adv_cmd), &adv_cmd);
                if (ret)
                        IWL_ERR(priv, "REPLY_CT_KILL_CONFIG_CMD failed\n");
                else
                cmd.critical_temperature_R =
                        cpu_to_le32(priv->hw_params.ct_kill_threshold);
 
-               ret = iwl_send_cmd_pdu(priv, REPLY_CT_KILL_CONFIG_CMD,
-                                      sizeof(cmd), &cmd);
+               ret = priv->trans.ops->send_cmd_pdu(priv,
+                                      REPLY_CT_KILL_CONFIG_CMD,
+                                      CMD_SYNC, sizeof(cmd), &cmd);
                if (ret)
                        IWL_ERR(priv, "REPLY_CT_KILL_CONFIG_CMD failed\n");
                else
        calib_cfg_cmd.ucd_calib_cfg.once.is_enable = IWL_CALIB_INIT_CFG_ALL;
        calib_cfg_cmd.ucd_calib_cfg.once.start = cpu_to_le32(cfg);
 
-       return iwl_send_cmd(priv, &cmd);
+       return priv->trans.ops->send_cmd(priv, &cmd);
 }
 
 
 
                        le32_to_cpu(ctx->timing.beacon_init_val),
                        le16_to_cpu(ctx->timing.atim_window));
 
-       return iwl_send_cmd_pdu(priv, ctx->rxon_timing_cmd,
-                               sizeof(ctx->timing), &ctx->timing);
+       return priv->trans.ops->send_cmd_pdu(priv, ctx->rxon_timing_cmd,
+                               CMD_SYNC, sizeof(ctx->timing), &ctx->timing);
 }
 
 void iwl_set_rxon_hwcrypto(struct iwl_priv *priv, struct iwl_rxon_context *ctx,
        IWL_DEBUG_INFO(priv, "BT coex %s\n",
                (bt_cmd.flags == BT_COEX_DISABLE) ? "disable" : "active");
 
-       if (iwl_send_cmd_pdu(priv, REPLY_BT_CONFIG,
-                            sizeof(struct iwl_bt_cmd), &bt_cmd))
+       if (priv->trans.ops->send_cmd_pdu(priv, REPLY_BT_CONFIG,
+                            CMD_SYNC, sizeof(struct iwl_bt_cmd), &bt_cmd))
                IWL_ERR(priv, "failed to send BT Coex Config\n");
 }
 
        };
 
        if (flags & CMD_ASYNC)
-               return iwl_send_cmd_pdu_async(priv, REPLY_STATISTICS_CMD,
+               return priv->trans.ops->send_cmd_pdu(priv, REPLY_STATISTICS_CMD,
+                                             CMD_ASYNC,
                                               sizeof(struct iwl_statistics_cmd),
-                                              &statistics_cmd, NULL);
+                                              &statistics_cmd);
        else
-               return iwl_send_cmd_pdu(priv, REPLY_STATISTICS_CMD,
+               return priv->trans.ops->send_cmd_pdu(priv, REPLY_STATISTICS_CMD,
+                                       CMD_SYNC,
                                        sizeof(struct iwl_statistics_cmd),
                                        &statistics_cmd);
 }
 
  *****************************************************/
 
 const char *get_cmd_string(u8 cmd);
-int __must_check iwl_send_cmd_sync(struct iwl_priv *priv,
-                                  struct iwl_host_cmd *cmd);
 int iwl_send_cmd(struct iwl_priv *priv, struct iwl_host_cmd *cmd);
-int __must_check iwl_send_cmd_pdu(struct iwl_priv *priv, u8 id,
+int __must_check iwl_send_cmd_pdu(struct iwl_priv *priv, u8 id, u32 flags,
                                  u16 len, const void *data);
-int iwl_send_cmd_pdu_async(struct iwl_priv *priv, u8 id, u16 len,
-                          const void *data,
-                          void (*callback)(struct iwl_priv *priv,
-                                           struct iwl_device_cmd *cmd,
-                                           struct iwl_rx_packet *pkt));
 
 int iwl_enqueue_hcmd(struct iwl_priv *priv, struct iwl_host_cmd *cmd);
 
 
 
 enum {
        CMD_SYNC = 0,
-       CMD_SIZE_NORMAL = 0,
-       CMD_NO_SKB = 0,
-       CMD_ASYNC = (1 << 1),
-       CMD_WANT_SKB = (1 << 2),
+       CMD_ASYNC = BIT(0),
+       CMD_WANT_SKB = BIT(1),
 };
 
 #define DEF_CMD_PAYLOAD_SIZE 320
        IWL_HCMD_DFL_NOCOPY     = BIT(0),
 };
 
+/**
+ * struct iwl_host_cmd - Host command to the uCode
+ * @data: array of chunks that composes the data of the host command
+ * @reply_page: pointer to the page that holds the response to the host command
+ * @callback:
+ * @flags: can be CMD_* note CMD_WANT_SKB is incompatible withe CMD_ASYNC
+ * @len: array of the lenths of the chunks in data
+ * @dataflags:
+ * @id: id of the host command
+ */
 struct iwl_host_cmd {
        const void *data[IWL_MAX_CMD_TFDS];
        unsigned long reply_page;
  * @tx_init:inits the tx memory, allocate if needed
  * @tx_stop: stop the tx
  * @tx_free: frees the tx memory
+ * @send_cmd:send a host command
+ * @send_cmd_pdu:send a host command: flags can be CMD_*
  */
 struct iwl_trans_ops {
        int (*rx_init)(struct iwl_priv *priv);
        int (*tx_init)(struct iwl_priv *priv);
        int (*tx_stop)(struct iwl_priv *priv);
        void (*tx_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_trans {
 
 {
        int ret;
 
-       if (WARN_ON(!(cmd->flags & CMD_ASYNC)))
-               return -EINVAL;
-
        /* An asynchronous command can not expect an SKB to be set. */
        if (WARN_ON(cmd->flags & CMD_WANT_SKB))
                return -EINVAL;
        return 0;
 }
 
-int iwl_send_cmd_sync(struct iwl_priv *priv, struct iwl_host_cmd *cmd)
+static int iwl_send_cmd_sync(struct iwl_priv *priv, struct iwl_host_cmd *cmd)
 {
        int cmd_idx;
        int ret;
 
        lockdep_assert_held(&priv->mutex);
 
-       if (WARN_ON(cmd->flags & CMD_ASYNC))
-               return -EINVAL;
-
         /* A synchronous command can not have a callback set. */
        if (WARN_ON(cmd->callback))
                return -EINVAL;
        return iwl_send_cmd_sync(priv, cmd);
 }
 
-int iwl_send_cmd_pdu(struct iwl_priv *priv, u8 id, u16 len, const void *data)
-{
-       struct iwl_host_cmd cmd = {
-               .id = id,
-               .len = { len, },
-               .data = { data, },
-       };
-
-       return iwl_send_cmd_sync(priv, &cmd);
-}
-
-int iwl_send_cmd_pdu_async(struct iwl_priv *priv,
-                          u8 id, u16 len, const void *data,
-                          void (*callback)(struct iwl_priv *priv,
-                                           struct iwl_device_cmd *cmd,
-                                           struct iwl_rx_packet *pkt))
+int iwl_send_cmd_pdu(struct iwl_priv *priv, u8 id, u32 flags, u16 len,
+                    const void *data)
 {
        struct iwl_host_cmd cmd = {
                .id = id,
                .len = { len, },
                .data = { data, },
+               .flags = flags,
        };
 
-       cmd.flags |= CMD_ASYNC;
-       cmd.callback = callback;
-
-       return iwl_send_cmd_async(priv, &cmd);
+       return iwl_send_cmd(priv, &cmd);
 }
 
        if (reg != (reg & CSR_LED_BSM_CTRL_MSK))
                iwl_write32(priv, CSR_LED_REG, reg & CSR_LED_BSM_CTRL_MSK);
 
-       return iwl_send_cmd(priv, &cmd);
+       return priv->trans.ops->send_cmd(priv, &cmd);
 }
 
 /* Set led pattern command */
 
                        le32_to_cpu(cmd->sleep_interval[3]),
                        le32_to_cpu(cmd->sleep_interval[4]));
 
-       return iwl_send_cmd_pdu(priv, POWER_TABLE_CMD,
+       return priv->trans.ops->send_cmd_pdu(priv, POWER_TABLE_CMD, CMD_SYNC,
                                sizeof(struct iwl_powertable_cmd), cmd);
 }
 
 
        struct iwl_rx_packet *pkt;
        struct iwl_host_cmd cmd = {
                .id = REPLY_SCAN_ABORT_CMD,
-               .flags = CMD_WANT_SKB,
+               .flags = CMD_SYNC | CMD_WANT_SKB,
        };
 
        /* Exit instantly with error when device is not ready
            test_bit(STATUS_EXIT_PENDING, &priv->status))
                return -EIO;
 
-       ret = iwl_send_cmd_sync(priv, &cmd);
+       ret = priv->trans.ops->send_cmd(priv, &cmd);
        if (ret)
                return ret;
 
 
        }
 
        cmd.len[0] = priv->cfg->ops->utils->build_addsta_hcmd(sta, data);
-       ret = iwl_send_cmd(priv, &cmd);
+       ret = priv->trans.ops->send_cmd(priv, &cmd);
 
        if (ret || (flags & CMD_ASYNC))
                return ret;
 
        cmd.flags |= CMD_WANT_SKB;
 
-       ret = iwl_send_cmd(priv, &cmd);
+       ret = priv->trans.ops->send_cmd(priv, &cmd);
 
        if (ret)
                return ret;
                return -EINVAL;
 
        if (is_lq_table_valid(priv, ctx, lq))
-               ret = iwl_send_cmd(priv, &cmd);
+               ret = priv->trans.ops->send_cmd(priv, &cmd);
        else
                ret = -EINVAL;
 
 
        IWL_INFO(priv, "testmode ucode command ID 0x%x, flags 0x%x,"
                                " len %d\n", cmd.id, cmd.flags, cmd.len[0]);
        /* ok, let's submit the command to ucode */
-       return iwl_send_cmd(priv, &cmd);
+       return priv->trans.ops->send_cmd(priv, &cmd);
 }
 
 
 
 #include "iwl-helpers.h"
 /*TODO remove uneeded includes when the transport layer tx_free will be here */
 #include "iwl-agn.h"
+#include "iwl-core.h"
 
 static int iwl_trans_rx_alloc(struct iwl_priv *priv)
 {
        .tx_init = iwl_trans_tx_init,
        .tx_stop = iwl_trans_tx_stop,
        .tx_free = iwl_trans_tx_free,
+
+       .send_cmd = iwl_send_cmd,
+       .send_cmd_pdu = iwl_send_cmd_pdu,
 };
 
 void iwl_trans_register(struct iwl_trans *trans)