Commit 1e60896f authored by John W. Linville's avatar John W. Linville

Merge branch 'for-john' of git://git.kernel.org/pub/scm/linux/kernel/git/iwlwifi/iwlwifi-next

Conflicts:
	drivers/net/wireless/iwlwifi/pcie/trans.c
parents ad667867 eea54c8e
...@@ -168,8 +168,13 @@ int iwlagn_mac_setup_register(struct iwl_priv *priv, ...@@ -168,8 +168,13 @@ int iwlagn_mac_setup_register(struct iwl_priv *priv,
hw->flags |= IEEE80211_HW_SUPPORTS_DYNAMIC_SMPS | hw->flags |= IEEE80211_HW_SUPPORTS_DYNAMIC_SMPS |
IEEE80211_HW_SUPPORTS_STATIC_SMPS; IEEE80211_HW_SUPPORTS_STATIC_SMPS;
/* enable 11w if the uCode advertise */ /*
if (capa->flags & IWL_UCODE_TLV_FLAGS_MFP) * Enable 11w if advertised by firmware and software crypto
* is not enabled (as the firmware will interpret some mgmt
* packets, so enabling it with software crypto isn't safe)
*/
if (priv->fw->ucode_capa.flags & IWL_UCODE_TLV_FLAGS_MFP &&
!iwlwifi_mod_params.sw_crypto)
hw->flags |= IEEE80211_HW_MFP_CAPABLE; hw->flags |= IEEE80211_HW_MFP_CAPABLE;
hw->sta_data_size = sizeof(struct iwl_station_priv); hw->sta_data_size = sizeof(struct iwl_station_priv);
......
...@@ -1191,8 +1191,6 @@ static void iwl_option_config(struct iwl_priv *priv) ...@@ -1191,8 +1191,6 @@ static void iwl_option_config(struct iwl_priv *priv)
static int iwl_eeprom_init_hw_params(struct iwl_priv *priv) static int iwl_eeprom_init_hw_params(struct iwl_priv *priv)
{ {
priv->eeprom_data->sku = priv->eeprom_data->sku;
if (priv->eeprom_data->sku & EEPROM_SKU_CAP_11N_ENABLE && if (priv->eeprom_data->sku & EEPROM_SKU_CAP_11N_ENABLE &&
!priv->cfg->ht_params) { !priv->cfg->ht_params) {
IWL_ERR(priv, "Invalid 11n configuration\n"); IWL_ERR(priv, "Invalid 11n configuration\n");
......
...@@ -150,7 +150,7 @@ enum iwl_led_mode { ...@@ -150,7 +150,7 @@ enum iwl_led_mode {
struct iwl_base_params { struct iwl_base_params {
int eeprom_size; int eeprom_size;
int num_of_queues; /* def: HW dependent */ int num_of_queues; /* def: HW dependent */
/* for iwl_apm_init() */ /* for iwl_pcie_apm_init() */
u32 pll_cfg_val; u32 pll_cfg_val;
const u16 max_ll_items; const u16 max_ll_items;
......
...@@ -267,7 +267,7 @@ static inline unsigned int FH_MEM_CBBC_QUEUE(unsigned int chnl) ...@@ -267,7 +267,7 @@ static inline unsigned int FH_MEM_CBBC_QUEUE(unsigned int chnl)
#define FH_RCSR_RX_CONFIG_RBDCB_SIZE_POS (20) #define FH_RCSR_RX_CONFIG_RBDCB_SIZE_POS (20)
#define FH_RCSR_RX_CONFIG_REG_IRQ_RBTH_POS (4) #define FH_RCSR_RX_CONFIG_REG_IRQ_RBTH_POS (4)
#define RX_RB_TIMEOUT (0x10) #define RX_RB_TIMEOUT (0x11)
#define FH_RCSR_RX_CONFIG_CHNL_EN_PAUSE_VAL (0x00000000) #define FH_RCSR_RX_CONFIG_CHNL_EN_PAUSE_VAL (0x00000000)
#define FH_RCSR_RX_CONFIG_CHNL_EN_PAUSE_EOF_VAL (0x40000000) #define FH_RCSR_RX_CONFIG_CHNL_EN_PAUSE_EOF_VAL (0x40000000)
......
...@@ -69,7 +69,6 @@ ...@@ -69,7 +69,6 @@
#include "iwl-trans.h" #include "iwl-trans.h"
#include "iwl-drv.h" #include "iwl-drv.h"
#include "iwl-trans.h"
#include "cfg.h" #include "cfg.h"
#include "internal.h" #include "internal.h"
......
...@@ -73,7 +73,7 @@ struct isr_statistics { ...@@ -73,7 +73,7 @@ struct isr_statistics {
}; };
/** /**
* struct iwl_rx_queue - Rx queue * struct iwl_rxq - Rx queue
* @bd: driver's pointer to buffer of receive buffer descriptors (rbd) * @bd: driver's pointer to buffer of receive buffer descriptors (rbd)
* @bd_dma: bus address of buffer of receive buffer descriptors (rbd) * @bd_dma: bus address of buffer of receive buffer descriptors (rbd)
* @pool: * @pool:
...@@ -91,7 +91,7 @@ struct isr_statistics { ...@@ -91,7 +91,7 @@ struct isr_statistics {
* *
* NOTE: rx_free and rx_used are used as a FIFO for iwl_rx_mem_buffers * NOTE: rx_free and rx_used are used as a FIFO for iwl_rx_mem_buffers
*/ */
struct iwl_rx_queue { struct iwl_rxq {
__le32 *bd; __le32 *bd;
dma_addr_t bd_dma; dma_addr_t bd_dma;
struct iwl_rx_mem_buffer pool[RX_QUEUE_SIZE + RX_FREE_BUFFERS]; struct iwl_rx_mem_buffer pool[RX_QUEUE_SIZE + RX_FREE_BUFFERS];
...@@ -157,8 +157,8 @@ struct iwl_cmd_meta { ...@@ -157,8 +157,8 @@ struct iwl_cmd_meta {
* 32 since we don't need so many commands pending. Since the HW * 32 since we don't need so many commands pending. Since the HW
* still uses 256 BDs for DMA though, n_bd stays 256. As a result, * still uses 256 BDs for DMA though, n_bd stays 256. As a result,
* the software buffers (in the variables @meta, @txb in struct * the software buffers (in the variables @meta, @txb in struct
* iwl_tx_queue) only have 32 entries, while the HW buffers (@tfds * iwl_txq) only have 32 entries, while the HW buffers (@tfds in
* in the same struct) have 256. * the same struct) have 256.
* This means that we end up with the following: * This means that we end up with the following:
* HW entries: | 0 | ... | N * 32 | ... | N * 32 + 31 | ... | 255 | * HW entries: | 0 | ... | N * 32 | ... | N * 32 + 31 | ... | 255 |
* SW entries: | 0 | ... | 31 | * SW entries: | 0 | ... | 31 |
...@@ -182,7 +182,7 @@ struct iwl_queue { ...@@ -182,7 +182,7 @@ struct iwl_queue {
#define TFD_TX_CMD_SLOTS 256 #define TFD_TX_CMD_SLOTS 256
#define TFD_CMD_SLOTS 32 #define TFD_CMD_SLOTS 32
struct iwl_pcie_tx_queue_entry { struct iwl_pcie_txq_entry {
struct iwl_device_cmd *cmd; struct iwl_device_cmd *cmd;
struct iwl_device_cmd *copy_cmd; struct iwl_device_cmd *copy_cmd;
struct sk_buff *skb; struct sk_buff *skb;
...@@ -192,7 +192,7 @@ struct iwl_pcie_tx_queue_entry { ...@@ -192,7 +192,7 @@ struct iwl_pcie_tx_queue_entry {
}; };
/** /**
* struct iwl_tx_queue - Tx Queue for DMA * struct iwl_txq - Tx Queue for DMA
* @q: generic Rx/Tx queue descriptor * @q: generic Rx/Tx queue descriptor
* @tfds: transmit frame descriptors (DMA memory) * @tfds: transmit frame descriptors (DMA memory)
* @entries: transmit entries (driver state) * @entries: transmit entries (driver state)
...@@ -205,10 +205,10 @@ struct iwl_pcie_tx_queue_entry { ...@@ -205,10 +205,10 @@ struct iwl_pcie_tx_queue_entry {
* A Tx queue consists of circular buffer of BDs (a.k.a. TFDs, transmit frame * A Tx queue consists of circular buffer of BDs (a.k.a. TFDs, transmit frame
* descriptors) and required locking structures. * descriptors) and required locking structures.
*/ */
struct iwl_tx_queue { struct iwl_txq {
struct iwl_queue q; struct iwl_queue q;
struct iwl_tfd *tfds; struct iwl_tfd *tfds;
struct iwl_pcie_tx_queue_entry *entries; struct iwl_pcie_txq_entry *entries;
spinlock_t lock; spinlock_t lock;
struct timer_list stuck_timer; struct timer_list stuck_timer;
struct iwl_trans_pcie *trans_pcie; struct iwl_trans_pcie *trans_pcie;
...@@ -238,7 +238,7 @@ struct iwl_tx_queue { ...@@ -238,7 +238,7 @@ struct iwl_tx_queue {
* @wd_timeout: queue watchdog timeout (jiffies) * @wd_timeout: queue watchdog timeout (jiffies)
*/ */
struct iwl_trans_pcie { struct iwl_trans_pcie {
struct iwl_rx_queue rxq; struct iwl_rxq rxq;
struct work_struct rx_replenish; struct work_struct rx_replenish;
struct iwl_trans *trans; struct iwl_trans *trans;
struct iwl_drv *drv; struct iwl_drv *drv;
...@@ -260,7 +260,7 @@ struct iwl_trans_pcie { ...@@ -260,7 +260,7 @@ struct iwl_trans_pcie {
struct iwl_dma_ptr scd_bc_tbls; struct iwl_dma_ptr scd_bc_tbls;
struct iwl_dma_ptr kw; struct iwl_dma_ptr kw;
struct iwl_tx_queue *txq; struct iwl_txq *txq;
unsigned long queue_used[BITS_TO_LONGS(IWL_MAX_HW_QUEUES)]; unsigned long queue_used[BITS_TO_LONGS(IWL_MAX_HW_QUEUES)];
unsigned long queue_stopped[BITS_TO_LONGS(IWL_MAX_HW_QUEUES)]; unsigned long queue_stopped[BITS_TO_LONGS(IWL_MAX_HW_QUEUES)];
...@@ -287,10 +287,16 @@ struct iwl_trans_pcie { ...@@ -287,10 +287,16 @@ struct iwl_trans_pcie {
unsigned long wd_timeout; unsigned long wd_timeout;
}; };
/***************************************************** /**
* DRIVER STATUS FUNCTIONS * enum iwl_pcie_status: status of the PCIe transport
******************************************************/ * @STATUS_HCMD_ACTIVE: a SYNC command is being processed
enum { * @STATUS_DEVICE_ENABLED: APM is enabled
* @STATUS_TPOWER_PMI: the device might be asleep (need to wake it up)
* @STATUS_INT_ENABLED: interrupts are enabled
* @STATUS_RFKILL: the HW RFkill switch is in KILL position
* @STATUS_FW_ERROR: the fw is in error state
*/
enum iwl_pcie_status {
STATUS_HCMD_ACTIVE, STATUS_HCMD_ACTIVE,
STATUS_DEVICE_ENABLED, STATUS_DEVICE_ENABLED,
STATUS_TPOWER_PMI, STATUS_TPOWER_PMI,
...@@ -309,6 +315,10 @@ iwl_trans_pcie_get_trans(struct iwl_trans_pcie *trans_pcie) ...@@ -309,6 +315,10 @@ iwl_trans_pcie_get_trans(struct iwl_trans_pcie *trans_pcie)
trans_specific); trans_specific);
} }
/*
* Convention: trans API functions: iwl_trans_pcie_XXX
* Other functions: iwl_pcie_XXX
*/
struct iwl_trans *iwl_trans_pcie_alloc(struct pci_dev *pdev, struct iwl_trans *iwl_trans_pcie_alloc(struct pci_dev *pdev,
const struct pci_device_id *ent, const struct pci_device_id *ent,
const struct iwl_cfg *cfg); const struct iwl_cfg *cfg);
...@@ -317,51 +327,43 @@ void iwl_trans_pcie_free(struct iwl_trans *trans); ...@@ -317,51 +327,43 @@ void iwl_trans_pcie_free(struct iwl_trans *trans);
/***************************************************** /*****************************************************
* RX * RX
******************************************************/ ******************************************************/
void iwl_bg_rx_replenish(struct work_struct *data); int iwl_pcie_rx_init(struct iwl_trans *trans);
void iwl_irq_tasklet(struct iwl_trans *trans); void iwl_pcie_tasklet(struct iwl_trans *trans);
void iwl_rx_replenish(struct iwl_trans *trans); int iwl_pcie_rx_stop(struct iwl_trans *trans);
void iwl_rx_queue_update_write_ptr(struct iwl_trans *trans, void iwl_pcie_rx_free(struct iwl_trans *trans);
struct iwl_rx_queue *q);
/***************************************************** /*****************************************************
* ICT * ICT - interrupt handling
******************************************************/ ******************************************************/
void iwl_reset_ict(struct iwl_trans *trans); irqreturn_t iwl_pcie_isr_ict(int irq, void *data);
void iwl_disable_ict(struct iwl_trans *trans); int iwl_pcie_alloc_ict(struct iwl_trans *trans);
int iwl_alloc_isr_ict(struct iwl_trans *trans); void iwl_pcie_free_ict(struct iwl_trans *trans);
void iwl_free_isr_ict(struct iwl_trans *trans); void iwl_pcie_reset_ict(struct iwl_trans *trans);
irqreturn_t iwl_isr_ict(int irq, void *data); void iwl_pcie_disable_ict(struct iwl_trans *trans);
/***************************************************** /*****************************************************
* TX / HCMD * TX / HCMD
******************************************************/ ******************************************************/
void iwl_txq_update_write_ptr(struct iwl_trans *trans, int iwl_pcie_tx_init(struct iwl_trans *trans);
struct iwl_tx_queue *txq); void iwl_pcie_tx_start(struct iwl_trans *trans, u32 scd_base_addr);
int iwlagn_txq_attach_buf_to_tfd(struct iwl_trans *trans, int iwl_pcie_tx_stop(struct iwl_trans *trans);
struct iwl_tx_queue *txq, void iwl_pcie_tx_free(struct iwl_trans *trans);
dma_addr_t addr, u16 len, u8 reset);
int iwl_queue_init(struct iwl_queue *q, int count, int slots_num, u32 id);
int iwl_trans_pcie_send_cmd(struct iwl_trans *trans, struct iwl_host_cmd *cmd);
void iwl_tx_cmd_complete(struct iwl_trans *trans,
struct iwl_rx_cmd_buffer *rxb, int handler_status);
void iwl_trans_txq_update_byte_cnt_tbl(struct iwl_trans *trans,
struct iwl_tx_queue *txq,
u16 byte_cnt);
void iwl_trans_pcie_txq_enable(struct iwl_trans *trans, int txq_id, int fifo, void iwl_trans_pcie_txq_enable(struct iwl_trans *trans, int txq_id, int fifo,
int sta_id, int tid, int frame_limit, u16 ssn); int sta_id, int tid, int frame_limit, u16 ssn);
void iwl_trans_pcie_txq_disable(struct iwl_trans *trans, int queue); void iwl_trans_pcie_txq_disable(struct iwl_trans *trans, int queue);
void iwl_txq_free_tfd(struct iwl_trans *trans, struct iwl_tx_queue *txq, int iwl_trans_pcie_tx(struct iwl_trans *trans, struct sk_buff *skb,
enum dma_data_direction dma_dir); struct iwl_device_cmd *dev_cmd, int txq_id);
int iwl_tx_queue_reclaim(struct iwl_trans *trans, int txq_id, int index, void iwl_pcie_txq_inc_wr_ptr(struct iwl_trans *trans, struct iwl_txq *txq);
struct sk_buff_head *skbs); int iwl_trans_pcie_send_hcmd(struct iwl_trans *trans, struct iwl_host_cmd *cmd);
void iwl_tx_queue_unmap(struct iwl_trans *trans, int txq_id); void iwl_pcie_hcmd_complete(struct iwl_trans *trans,
int iwl_queue_space(const struct iwl_queue *q); struct iwl_rx_cmd_buffer *rxb, int handler_status);
void iwl_trans_pcie_reclaim(struct iwl_trans *trans, int txq_id, int ssn,
struct sk_buff_head *skbs);
/***************************************************** /*****************************************************
* Error handling * Error handling
******************************************************/ ******************************************************/
int iwl_dump_fh(struct iwl_trans *trans, char **buf); int iwl_pcie_dump_fh(struct iwl_trans *trans, char **buf);
void iwl_dump_csr(struct iwl_trans *trans); void iwl_pcie_dump_csr(struct iwl_trans *trans);
/***************************************************** /*****************************************************
* Helpers * Helpers
...@@ -397,7 +399,7 @@ static inline void iwl_enable_rfkill_int(struct iwl_trans *trans) ...@@ -397,7 +399,7 @@ static inline void iwl_enable_rfkill_int(struct iwl_trans *trans)
} }
static inline void iwl_wake_queue(struct iwl_trans *trans, static inline void iwl_wake_queue(struct iwl_trans *trans,
struct iwl_tx_queue *txq) struct iwl_txq *txq)
{ {
struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
...@@ -408,7 +410,7 @@ static inline void iwl_wake_queue(struct iwl_trans *trans, ...@@ -408,7 +410,7 @@ static inline void iwl_wake_queue(struct iwl_trans *trans,
} }
static inline void iwl_stop_queue(struct iwl_trans *trans, static inline void iwl_stop_queue(struct iwl_trans *trans,
struct iwl_tx_queue *txq) struct iwl_txq *txq)
{ {
struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
...@@ -420,7 +422,7 @@ static inline void iwl_stop_queue(struct iwl_trans *trans, ...@@ -420,7 +422,7 @@ static inline void iwl_stop_queue(struct iwl_trans *trans,
txq->q.id); txq->q.id);
} }
static inline int iwl_queue_used(const struct iwl_queue *q, int i) static inline bool iwl_queue_used(const struct iwl_queue *q, int i)
{ {
return q->write_ptr >= q->read_ptr ? return q->write_ptr >= q->read_ptr ?
(i >= q->read_ptr && i < q->write_ptr) : (i >= q->read_ptr && i < q->write_ptr) :
...@@ -432,8 +434,8 @@ static inline u8 get_cmd_index(struct iwl_queue *q, u32 index) ...@@ -432,8 +434,8 @@ static inline u8 get_cmd_index(struct iwl_queue *q, u32 index)
return index & (q->n_window - 1); return index & (q->n_window - 1);
} }
static inline const char * static inline const char *get_cmd_string(struct iwl_trans_pcie *trans_pcie,
trans_pcie_get_cmd_string(struct iwl_trans_pcie *trans_pcie, u8 cmd) u8 cmd)
{ {
if (!trans_pcie->command_names || !trans_pcie->command_names[cmd]) if (!trans_pcie->command_names || !trans_pcie->command_names[cmd])
return "UNKNOWN"; return "UNKNOWN";
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment