diff --git a/data/system/data/firmware/idualwifi7260/iwm-9000-ucode-34.tgz b/data/system/data/firmware/idualwifi7260/iwm-9000-ucode-34.tgz new file mode 100644 index 0000000000..37e22bc61d Binary files /dev/null and b/data/system/data/firmware/idualwifi7260/iwm-9000-ucode-34.tgz differ diff --git a/data/system/data/firmware/idualwifi7260/iwm-9260-ucode-34.tgz b/data/system/data/firmware/idualwifi7260/iwm-9260-ucode-34.tgz new file mode 100644 index 0000000000..4b79b59ce9 Binary files /dev/null and b/data/system/data/firmware/idualwifi7260/iwm-9260-ucode-34.tgz differ diff --git a/src/add-ons/kernel/drivers/network/wlan/idualwifi7260/Jamfile b/src/add-ons/kernel/drivers/network/wlan/idualwifi7260/Jamfile index 37e35f043c..7a83caba1d 100644 --- a/src/add-ons/kernel/drivers/network/wlan/idualwifi7260/Jamfile +++ b/src/add-ons/kernel/drivers/network/wlan/idualwifi7260/Jamfile @@ -18,6 +18,8 @@ SEARCH_SOURCE += [ FDirName $(SUBDIR) dev iwm ] ; KernelAddon idualwifi7260 : if_iwm_7000.c if_iwm_8000.c + if_iwm_9000.c + if_iwm_9260.c if_iwm_binding.c if_iwm_fw.c if_iwm_led.c @@ -42,9 +44,11 @@ KernelAddon idualwifi7260 : HAIKU_WIFI_FIRMWARE_PACKAGES on idualwifi7260 = iwm-3160-ucode-17 iwm-3168-ucode-22 iwm-7260-ucode-17 iwm-7265-ucode-17 iwm-7265D-ucode-22 - iwm-8000C-ucode-22 iwm-8265-ucode-22 ; + iwm-8000C-ucode-22 iwm-8265-ucode-22 + iwm-9000-ucode-34 iwm-9260-ucode-34 ; HAIKU_WIFI_FIRMWARE_ARCHIVES on idualwifi7260 = iwm-3160-ucode-17.tgz iwm-3168-ucode-22.tgz iwm-7260-ucode-17.tgz iwm-7265-ucode-17.tgz iwm-7265D-ucode-22.tgz - iwm-8000C-ucode-22.tgz iwm-8265-ucode-22.tgz ; + iwm-8000C-ucode-22.tgz iwm-8265-ucode-22.tgz + iwm-9000-ucode-34.tgz iwm-9260-ucode-34.tgz ; HAIKU_WIFI_FIRMWARE_DO_EXTRACT on idualwifi7260 = true ; diff --git a/src/add-ons/kernel/drivers/network/wlan/idualwifi7260/dev/iwm/if_iwm.c b/src/add-ons/kernel/drivers/network/wlan/idualwifi7260/dev/iwm/if_iwm.c index e39e772001..9b826216ff 100644 --- a/src/add-ons/kernel/drivers/network/wlan/idualwifi7260/dev/iwm/if_iwm.c +++ b/src/add-ons/kernel/drivers/network/wlan/idualwifi7260/dev/iwm/if_iwm.c @@ -103,7 +103,7 @@ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ #include -__FBSDID("$FreeBSD: releng/12.0/sys/dev/iwm/if_iwm.c 339038 2018-10-01 10:44:33Z bz $"); +__FBSDID("$FreeBSD$"); #include "opt_wlan.h" #include "opt_iwm.h" @@ -231,10 +231,10 @@ struct iwm_nvm_section { uint8_t *data; }; -#define IWM_MVM_UCODE_ALIVE_TIMEOUT (5*hz) -#define IWM_MVM_UCODE_CALIB_TIMEOUT (10*hz) +#define IWM_UCODE_ALIVE_TIMEOUT hz +#define IWM_UCODE_CALIB_TIMEOUT (2*hz) -struct iwm_mvm_alive_data { +struct iwm_alive_data { int valid; uint32_t scd_base_addr; }; @@ -263,7 +263,7 @@ static void iwm_disable_interrupts(struct iwm_softc *); static void iwm_ict_reset(struct iwm_softc *); static int iwm_allow_mcast(struct ieee80211vap *, struct iwm_softc *); static void iwm_stop_device(struct iwm_softc *); -static void iwm_mvm_nic_config(struct iwm_softc *); +static void iwm_nic_config(struct iwm_softc *); static int iwm_nic_rx_init(struct iwm_softc *); static int iwm_nic_tx_init(struct iwm_softc *); static int iwm_nic_init(struct iwm_softc *); @@ -317,25 +317,23 @@ static int iwm_pcie_load_given_ucode(struct iwm_softc *, static int iwm_start_fw(struct iwm_softc *, const struct iwm_fw_img *); static int iwm_send_tx_ant_cfg(struct iwm_softc *, uint8_t); static int iwm_send_phy_cfg_cmd(struct iwm_softc *); -static int iwm_mvm_load_ucode_wait_alive(struct iwm_softc *, +static int iwm_load_ucode_wait_alive(struct iwm_softc *, enum iwm_ucode_type); -static int iwm_run_init_mvm_ucode(struct iwm_softc *, int); -static int iwm_mvm_config_ltr(struct iwm_softc *sc); +static int iwm_run_init_ucode(struct iwm_softc *, int); +static int iwm_config_ltr(struct iwm_softc *sc); static int iwm_rx_addbuf(struct iwm_softc *, int, int); -static int iwm_mvm_get_signal_strength(struct iwm_softc *, - struct iwm_rx_phy_info *); -static void iwm_mvm_rx_rx_phy_cmd(struct iwm_softc *, +static void iwm_rx_rx_phy_cmd(struct iwm_softc *, struct iwm_rx_packet *); static int iwm_get_noise(struct iwm_softc *, - const struct iwm_mvm_statistics_rx_non_phy *); -static void iwm_mvm_handle_rx_statistics(struct iwm_softc *, + const struct iwm_statistics_rx_non_phy *); +static void iwm_handle_rx_statistics(struct iwm_softc *, struct iwm_rx_packet *); -static boolean_t iwm_mvm_rx_rx_mpdu(struct iwm_softc *, struct mbuf *, - uint32_t, boolean_t); -static int iwm_mvm_rx_tx_cmd_single(struct iwm_softc *, +static bool iwm_rx_mpdu(struct iwm_softc *, struct mbuf *, + uint32_t, bool); +static int iwm_rx_tx_cmd_single(struct iwm_softc *, struct iwm_rx_packet *, struct iwm_node *); -static void iwm_mvm_rx_tx_cmd(struct iwm_softc *, struct iwm_rx_packet *); +static void iwm_rx_tx_cmd(struct iwm_softc *, struct iwm_rx_packet *); static void iwm_cmd_done(struct iwm_softc *, struct iwm_rx_packet *); #if 0 static void iwm_update_sched(struct iwm_softc *, int, int, uint8_t, @@ -348,7 +346,7 @@ static int iwm_tx(struct iwm_softc *, struct mbuf *, struct ieee80211_node *, int); static int iwm_raw_xmit(struct ieee80211_node *, struct mbuf *, const struct ieee80211_bpf_params *); -static int iwm_mvm_update_quotas(struct iwm_softc *, struct iwm_vap *); +static int iwm_update_quotas(struct iwm_softc *, struct iwm_vap *); static int iwm_auth(struct ieee80211vap *, struct iwm_softc *); static struct ieee80211_node * iwm_node_alloc(struct ieee80211vap *, @@ -360,10 +358,10 @@ static int iwm_media_change(struct ifnet *); static int iwm_newstate(struct ieee80211vap *, enum ieee80211_state, int); static void iwm_endscan_cb(void *, int); static int iwm_send_bt_init_conf(struct iwm_softc *); -static boolean_t iwm_mvm_is_lar_supported(struct iwm_softc *); -static boolean_t iwm_mvm_is_wifi_mcc_supported(struct iwm_softc *); +static boolean_t iwm_is_lar_supported(struct iwm_softc *); +static boolean_t iwm_is_wifi_mcc_supported(struct iwm_softc *); static int iwm_send_update_mcc_cmd(struct iwm_softc *, const char *); -static void iwm_mvm_tt_tx_backoff(struct iwm_softc *, uint32_t); +static void iwm_tt_tx_backoff(struct iwm_softc *, uint32_t); static int iwm_init_hw(struct iwm_softc *); static void iwm_init(struct iwm_softc *); static void iwm_start(struct iwm_softc *); @@ -793,7 +791,7 @@ iwm_read_firmware(struct iwm_softc *sc) break; } - case 48: /* undocumented TLV */ + case IWM_UCODE_TLV_CMD_VERSIONS: case IWM_UCODE_TLV_SDIO_ADMA_ADDR: case IWM_UCODE_TLV_FW_GSCAN_CAPA: /* ignore, not used by current driver */ @@ -853,7 +851,7 @@ iwm_read_firmware(struct iwm_softc *sc) goto parse_out; } snprintf(sc->sc_fwver, sizeof(sc->sc_fwver), - "%d.%d.%d", + "%u.%u.%u", le32toh(((const uint32_t *)tlv_data)[0]), le32toh(((const uint32_t *)tlv_data)[1]), le32toh(((const uint32_t *)tlv_data)[2])); @@ -929,19 +927,28 @@ static int iwm_alloc_rx_ring(struct iwm_softc *sc, struct iwm_rx_ring *ring) { bus_size_t size; - int i, error; + size_t descsz; + int count, i, error; ring->cur = 0; + if (sc->cfg->mqrx_supported) { + count = IWM_RX_MQ_RING_COUNT; + descsz = sizeof(uint64_t); + } else { + count = IWM_RX_LEGACY_RING_COUNT; + descsz = sizeof(uint32_t); + } /* Allocate RX descriptors (256-byte aligned). */ - size = IWM_RX_RING_COUNT * sizeof(uint32_t); - error = iwm_dma_contig_alloc(sc->sc_dmat, &ring->desc_dma, size, 256); + size = count * descsz; + error = iwm_dma_contig_alloc(sc->sc_dmat, &ring->free_desc_dma, size, + 256); if (error != 0) { device_printf(sc->sc_dev, "could not allocate RX ring DMA memory\n"); goto fail; } - ring->desc = ring->desc_dma.vaddr; + ring->desc = ring->free_desc_dma.vaddr; /* Allocate RX status area (16-byte aligned). */ error = iwm_dma_contig_alloc(sc->sc_dmat, &ring->stat_dma, @@ -953,6 +960,17 @@ iwm_alloc_rx_ring(struct iwm_softc *sc, struct iwm_rx_ring *ring) } ring->stat = ring->stat_dma.vaddr; + if (sc->cfg->mqrx_supported) { + size = count * sizeof(uint32_t); + error = iwm_dma_contig_alloc(sc->sc_dmat, &ring->used_desc_dma, + size, 256); + if (error != 0) { + device_printf(sc->sc_dev, + "could not allocate RX ring DMA memory\n"); + goto fail; + } + } + /* Create RX buffer DMA tag. */ error = bus_dma_tag_create(sc->sc_dmat, 1, 0, BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL, @@ -972,10 +990,11 @@ iwm_alloc_rx_ring(struct iwm_softc *sc, struct iwm_rx_ring *ring) __func__, error); goto fail; } + /* * Allocate and map RX buffers. */ - for (i = 0; i < IWM_RX_RING_COUNT; i++) { + for (i = 0; i < count; i++) { struct iwm_rx_data *data = &ring->data[i]; error = bus_dmamap_create(ring->data_dmat, 0, &data->map); if (error != 0) { @@ -1013,12 +1032,16 @@ iwm_reset_rx_ring(struct iwm_softc *sc, struct iwm_rx_ring *ring) static void iwm_free_rx_ring(struct iwm_softc *sc, struct iwm_rx_ring *ring) { - int i; + int count, i; - iwm_dma_contig_free(&ring->desc_dma); + iwm_dma_contig_free(&ring->free_desc_dma); iwm_dma_contig_free(&ring->stat_dma); + iwm_dma_contig_free(&ring->used_desc_dma); - for (i = 0; i < IWM_RX_RING_COUNT; i++) { + count = sc->cfg->mqrx_supported ? IWM_RX_MQ_RING_COUNT : + IWM_RX_LEGACY_RING_COUNT; + + for (i = 0; i < count; i++) { struct iwm_rx_data *data = &ring->data[i]; if (data->m != NULL) { @@ -1070,7 +1093,7 @@ iwm_alloc_tx_ring(struct iwm_softc *sc, struct iwm_tx_ring *ring, int qid) * We only use rings 0 through 9 (4 EDCA + cmd) so there is no need * to allocate commands space for other rings. */ - if (qid > IWM_MVM_CMD_QUEUE) + if (qid > IWM_CMD_QUEUE) return 0; size = IWM_TX_RING_COUNT * sizeof(struct iwm_device_cmd); @@ -1083,7 +1106,7 @@ iwm_alloc_tx_ring(struct iwm_softc *sc, struct iwm_tx_ring *ring, int qid) ring->cmd = ring->cmd_dma.vaddr; /* FW commands may require more mapped space than packets. */ - if (qid == IWM_MVM_CMD_QUEUE) { + if (qid == IWM_CMD_QUEUE) { maxsize = IWM_RBUF_SIZE; nsegments = 1; } else { @@ -1140,15 +1163,14 @@ iwm_reset_tx_ring(struct iwm_softc *sc, struct iwm_tx_ring *ring) } } /* Clear TX descriptors. */ - if (ring->desc) - memset(ring->desc, 0, ring->desc_dma.size); + memset(ring->desc, 0, ring->desc_dma.size); bus_dmamap_sync(ring->desc_dma.tag, ring->desc_dma.map, BUS_DMASYNC_PREWRITE); sc->qfullmsk &= ~(1 << ring->qid); ring->queued = 0; ring->cur = 0; - if (ring->qid == IWM_MVM_CMD_QUEUE && sc->cmd_hold_nic_awake) + if (ring->qid == IWM_CMD_QUEUE && sc->cmd_hold_nic_awake) iwm_pcie_clear_cmd_in_flight(sc); } @@ -1316,12 +1338,14 @@ iwm_stop_device(struct iwm_softc *sc) /* Stop the device, and put it in low power state */ iwm_apm_stop(sc); - /* Upon stop, the APM issues an interrupt if HW RF kill is set. - * Clean again the interrupt here + /* stop and reset the on-board processor */ + IWM_SETBITS(sc, IWM_CSR_RESET, IWM_CSR_RESET_REG_FLAG_SW_RESET); + DELAY(5000); + + /* + * Upon stop, the APM issues an interrupt if HW RF kill is set. */ iwm_disable_interrupts(sc); - /* stop and reset the on-board processor */ - IWM_WRITE(sc, IWM_CSR_RESET, IWM_CSR_RESET_REG_FLAG_SW_RESET); /* * Even if we stop the HW, we still want the RF kill @@ -1329,15 +1353,17 @@ iwm_stop_device(struct iwm_softc *sc) */ iwm_enable_rfkill_int(sc); iwm_check_rfkill(sc); + + iwm_prepare_card_hw(sc); } /* iwlwifi: mvm/ops.c */ static void -iwm_mvm_nic_config(struct iwm_softc *sc) +iwm_nic_config(struct iwm_softc *sc) { uint8_t radio_cfg_type, radio_cfg_step, radio_cfg_dash; uint32_t reg_val = 0; - uint32_t phy_config = iwm_mvm_get_phy_config(sc); + uint32_t phy_config = iwm_get_phy_config(sc); radio_cfg_type = (phy_config & IWM_FW_PHY_CFG_RADIO_TYPE) >> IWM_FW_PHY_CFG_RADIO_TYPE_POS; @@ -1357,7 +1383,15 @@ iwm_mvm_nic_config(struct iwm_softc *sc) reg_val |= radio_cfg_step << IWM_CSR_HW_IF_CONFIG_REG_POS_PHY_STEP; reg_val |= radio_cfg_dash << IWM_CSR_HW_IF_CONFIG_REG_POS_PHY_DASH; - IWM_WRITE(sc, IWM_CSR_HW_IF_CONFIG_REG, reg_val); + IWM_WRITE(sc, IWM_CSR_HW_IF_CONFIG_REG, + IWM_CSR_HW_IF_CONFIG_REG_MSK_MAC_DASH | + IWM_CSR_HW_IF_CONFIG_REG_MSK_MAC_STEP | + IWM_CSR_HW_IF_CONFIG_REG_MSK_PHY_STEP | + IWM_CSR_HW_IF_CONFIG_REG_MSK_PHY_DASH | + IWM_CSR_HW_IF_CONFIG_REG_MSK_PHY_TYPE | + IWM_CSR_HW_IF_CONFIG_REG_BIT_RADIO_SI | + IWM_CSR_HW_IF_CONFIG_REG_BIT_MAC_SI | + reg_val); IWM_DPRINTF(sc, IWM_DEBUG_RESET, "Radio type=0x%x-0x%x-0x%x\n", radio_cfg_type, @@ -1376,12 +1410,61 @@ iwm_mvm_nic_config(struct iwm_softc *sc) } static int -iwm_nic_rx_init(struct iwm_softc *sc) +iwm_nic_rx_mq_init(struct iwm_softc *sc) +{ + int enabled; + + if (!iwm_nic_lock(sc)) + return EBUSY; + + /* Stop RX DMA. */ + iwm_write_prph(sc, IWM_RFH_RXF_DMA_CFG, 0); + /* Disable RX used and free queue operation. */ + iwm_write_prph(sc, IWM_RFH_RXF_RXQ_ACTIVE, 0); + + iwm_write_prph64(sc, IWM_RFH_Q0_FRBDCB_BA_LSB, + sc->rxq.free_desc_dma.paddr); + iwm_write_prph64(sc, IWM_RFH_Q0_URBDCB_BA_LSB, + sc->rxq.used_desc_dma.paddr); + iwm_write_prph64(sc, IWM_RFH_Q0_URBD_STTS_WPTR_LSB, + sc->rxq.stat_dma.paddr); + iwm_write_prph(sc, IWM_RFH_Q0_FRBDCB_WIDX, 0); + iwm_write_prph(sc, IWM_RFH_Q0_FRBDCB_RIDX, 0); + iwm_write_prph(sc, IWM_RFH_Q0_URBDCB_WIDX, 0); + + /* We configure only queue 0 for now. */ + enabled = ((1 << 0) << 16) | (1 << 0); + + /* Enable RX DMA, 4KB buffer size. */ + iwm_write_prph(sc, IWM_RFH_RXF_DMA_CFG, + IWM_RFH_DMA_EN_ENABLE_VAL | + IWM_RFH_RXF_DMA_RB_SIZE_4K | + IWM_RFH_RXF_DMA_MIN_RB_4_8 | + IWM_RFH_RXF_DMA_DROP_TOO_LARGE_MASK | + IWM_RFH_RXF_DMA_RBDCB_SIZE_512); + + /* Enable RX DMA snooping. */ + iwm_write_prph(sc, IWM_RFH_GEN_CFG, + IWM_RFH_GEN_CFG_RFH_DMA_SNOOP | + IWM_RFH_GEN_CFG_SERVICE_DMA_SNOOP | + (sc->cfg->integrated ? IWM_RFH_GEN_CFG_RB_CHUNK_SIZE_64 : + IWM_RFH_GEN_CFG_RB_CHUNK_SIZE_128)); + + /* Enable the configured queue(s). */ + iwm_write_prph(sc, IWM_RFH_RXF_RXQ_ACTIVE, enabled); + + iwm_nic_unlock(sc); + + IWM_WRITE_1(sc, IWM_CSR_INT_COALESCING, IWM_HOST_INT_TIMEOUT_DEF); + + IWM_WRITE(sc, IWM_RFH_Q0_FRBDCB_WIDX_TRG, 8); + + return (0); +} + +static int +iwm_nic_rx_legacy_init(struct iwm_softc *sc) { - /* - * Initialize RX ring. This is from the iwn driver. - */ - memset(sc->rxq.stat, 0, sizeof(*sc->rxq.stat)); /* Stop Rx DMA */ iwm_pcie_rx_stop(sc); @@ -1397,7 +1480,8 @@ iwm_nic_rx_init(struct iwm_softc *sc) /* Set physical address of RX ring (256-byte aligned). */ IWM_WRITE(sc, - IWM_FH_RSCSR_CHNL0_RBDCB_BASE_REG, sc->rxq.desc_dma.paddr >> 8); + IWM_FH_RSCSR_CHNL0_RBDCB_BASE_REG, + sc->rxq.free_desc_dma.paddr >> 8); /* Set physical address of RX status (16-byte aligned). */ IWM_WRITE(sc, @@ -1430,19 +1514,22 @@ iwm_nic_rx_init(struct iwm_softc *sc) if (sc->cfg->host_interrupt_operation_mode) IWM_SETBITS(sc, IWM_CSR_INT_COALESCING, IWM_HOST_INT_OPER_MODE); - /* - * Thus sayeth el jefe (iwlwifi) via a comment: - * - * This value should initially be 0 (before preparing any - * RBs), should be 8 after preparing the first 8 RBs (for example) - */ - IWM_WRITE(sc, IWM_FH_RSCSR_CHNL0_WPTR, 8); - iwm_nic_unlock(sc); + IWM_WRITE(sc, IWM_FH_RSCSR_CHNL0_WPTR, 8); + return 0; } +static int +iwm_nic_rx_init(struct iwm_softc *sc) +{ + if (sc->cfg->mqrx_supported) + return iwm_nic_rx_mq_init(sc); + else + return iwm_nic_rx_legacy_init(sc); +} + static int iwm_nic_tx_init(struct iwm_softc *sc) { @@ -1471,7 +1558,9 @@ iwm_nic_tx_init(struct iwm_softc *sc) (unsigned long) (txq->desc_dma.paddr >> 8)); } - iwm_write_prph(sc, IWM_SCD_GP_CTRL, IWM_SCD_GP_CTRL_AUTO_ACTIVE_MODE); + iwm_set_bits_prph(sc, IWM_SCD_GP_CTRL, + IWM_SCD_GP_CTRL_AUTO_ACTIVE_MODE | + IWM_SCD_GP_CTRL_ENABLE_31_QUEUES); iwm_nic_unlock(sc); @@ -1487,7 +1576,7 @@ iwm_nic_init(struct iwm_softc *sc) if (sc->cfg->device_family == IWM_DEVICE_FAMILY_7000) iwm_set_pwr(sc); - iwm_mvm_nic_config(sc); + iwm_nic_config(sc); if ((error = iwm_nic_rx_init(sc)) != 0) return error; @@ -1508,25 +1597,31 @@ iwm_nic_init(struct iwm_softc *sc) int iwm_enable_txq(struct iwm_softc *sc, int sta_id, int qid, int fifo) { + int qmsk; + + qmsk = 1 << qid; + if (!iwm_nic_lock(sc)) { - device_printf(sc->sc_dev, - "%s: cannot enable txq %d\n", - __func__, - qid); + device_printf(sc->sc_dev, "%s: cannot enable txq %d\n", + __func__, qid); return EBUSY; } IWM_WRITE(sc, IWM_HBUS_TARG_WRPTR, qid << 8 | 0); - if (qid == IWM_MVM_CMD_QUEUE) { - /* unactivate before configuration */ + if (qid == IWM_CMD_QUEUE) { + /* Disable the scheduler. */ + iwm_write_prph(sc, IWM_SCD_EN_CTRL, 0); + + /* Stop the TX queue prior to configuration. */ iwm_write_prph(sc, IWM_SCD_QUEUE_STATUS_BITS(qid), - (0 << IWM_SCD_QUEUE_STTS_REG_POS_ACTIVE) - | (1 << IWM_SCD_QUEUE_STTS_REG_POS_SCD_ACT_EN)); + (0 << IWM_SCD_QUEUE_STTS_REG_POS_ACTIVE) | + (1 << IWM_SCD_QUEUE_STTS_REG_POS_SCD_ACT_EN)); iwm_nic_unlock(sc); - iwm_clear_bits_prph(sc, IWM_SCD_AGGR_SEL, (1 << qid)); + /* Disable aggregations for this queue. */ + iwm_clear_bits_prph(sc, IWM_SCD_AGGR_SEL, qmsk); if (!iwm_nic_lock(sc)) { device_printf(sc->sc_dev, @@ -1536,7 +1631,8 @@ iwm_enable_txq(struct iwm_softc *sc, int sta_id, int qid, int fifo) iwm_write_prph(sc, IWM_SCD_QUEUE_RDPTR(qid), 0); iwm_nic_unlock(sc); - iwm_write_mem32(sc, sc->scd_base_addr + IWM_SCD_CONTEXT_QUEUE_OFFSET(qid), 0); + iwm_write_mem32(sc, + sc->scd_base_addr + IWM_SCD_CONTEXT_QUEUE_OFFSET(qid), 0); /* Set scheduler window size and frame limit. */ iwm_write_mem32(sc, sc->scd_base_addr + IWM_SCD_CONTEXT_QUEUE_OFFSET(qid) + @@ -1556,6 +1652,9 @@ iwm_enable_txq(struct iwm_softc *sc, int sta_id, int qid, int fifo) (fifo << IWM_SCD_QUEUE_STTS_REG_POS_TXF) | (1 << IWM_SCD_QUEUE_STTS_REG_POS_WSL) | IWM_SCD_QUEUE_STTS_REG_MSK); + + /* Enable the scheduler for this queue. */ + iwm_write_prph(sc, IWM_SCD_EN_CTRL, qmsk); } else { struct iwm_scd_txq_cfg_cmd cmd; int error; @@ -1570,7 +1669,7 @@ iwm_enable_txq(struct iwm_softc *sc, int sta_id, int qid, int fifo) cmd.aggregate = 0; cmd.window = IWM_FRAME_LIMIT; - error = iwm_mvm_send_cmd_pdu(sc, IWM_SCD_QUEUE_CFG, IWM_CMD_SYNC, + error = iwm_send_cmd_pdu(sc, IWM_SCD_QUEUE_CFG, IWM_CMD_SYNC, sizeof(cmd), &cmd); if (error) { device_printf(sc->sc_dev, @@ -1582,9 +1681,6 @@ iwm_enable_txq(struct iwm_softc *sc, int sta_id, int qid, int fifo) return EBUSY; } - iwm_write_prph(sc, IWM_SCD_EN_CTRL, - iwm_read_prph(sc, IWM_SCD_EN_CTRL) | qid); - iwm_nic_unlock(sc); IWM_DPRINTF(sc, IWM_DEBUG_XMIT, "%s: enabled txq %d FIFO %d\n", @@ -1636,7 +1732,7 @@ iwm_trans_pcie_fw_alive(struct iwm_softc *sc, uint32_t scd_base_addr) iwm_nic_unlock(sc); /* enable command channel */ - error = iwm_enable_txq(sc, 0 /* unused */, IWM_MVM_CMD_QUEUE, 7); + error = iwm_enable_txq(sc, 0 /* unused */, IWM_CMD_QUEUE, 7); if (error) return error; @@ -1658,7 +1754,7 @@ iwm_trans_pcie_fw_alive(struct iwm_softc *sc, uint32_t scd_base_addr) iwm_nic_unlock(sc); /* Enable L1-Active */ - if (sc->cfg->device_family != IWM_DEVICE_FAMILY_8000) { + if (sc->cfg->device_family < IWM_DEVICE_FAMILY_8000) { iwm_clear_bits_prph(sc, IWM_APMG_PCIDEV_STT_REG, IWM_APMG_PCIDEV_STT_VAL_L1_ACT_DIS); } @@ -2076,7 +2172,7 @@ static int iwm_get_sku(const struct iwm_softc *sc, const uint16_t *nvm_sw, const uint16_t *phy_sku) { - if (sc->cfg->device_family != IWM_DEVICE_FAMILY_8000) + if (sc->cfg->device_family < IWM_DEVICE_FAMILY_8000) return le16_to_cpup(nvm_sw + IWM_SKU); return le32_to_cpup((const uint32_t *)(phy_sku + IWM_SKU_8000)); @@ -2085,7 +2181,7 @@ iwm_get_sku(const struct iwm_softc *sc, const uint16_t *nvm_sw, static int iwm_get_nvm_version(const struct iwm_softc *sc, const uint16_t *nvm_sw) { - if (sc->cfg->device_family != IWM_DEVICE_FAMILY_8000) + if (sc->cfg->device_family < IWM_DEVICE_FAMILY_8000) return le16_to_cpup(nvm_sw + IWM_NVM_VERSION); else return le32_to_cpup((const uint32_t *)(nvm_sw + @@ -2096,7 +2192,7 @@ static int iwm_get_radio_cfg(const struct iwm_softc *sc, const uint16_t *nvm_sw, const uint16_t *phy_sku) { - if (sc->cfg->device_family != IWM_DEVICE_FAMILY_8000) + if (sc->cfg->device_family < IWM_DEVICE_FAMILY_8000) return le16_to_cpup(nvm_sw + IWM_RADIO_CFG); return le32_to_cpup((const uint32_t *)(phy_sku + IWM_RADIO_CFG_8000)); @@ -2107,7 +2203,7 @@ iwm_get_n_hw_addrs(const struct iwm_softc *sc, const uint16_t *nvm_sw) { int n_hw_addr; - if (sc->cfg->device_family != IWM_DEVICE_FAMILY_8000) + if (sc->cfg->device_family < IWM_DEVICE_FAMILY_8000) return le16_to_cpup(nvm_sw + IWM_N_HW_ADDRS); n_hw_addr = le32_to_cpup((const uint32_t *)(nvm_sw + IWM_N_HW_ADDRS_8000)); @@ -2119,7 +2215,7 @@ static void iwm_set_radio_cfg(const struct iwm_softc *sc, struct iwm_nvm_data *data, uint32_t radio_cfg) { - if (sc->cfg->device_family != IWM_DEVICE_FAMILY_8000) { + if (sc->cfg->device_family < IWM_DEVICE_FAMILY_8000) { data->radio_cfg_type = IWM_NVM_RF_CFG_TYPE_MSK(radio_cfg); data->radio_cfg_step = IWM_NVM_RF_CFG_STEP_MSK(radio_cfg); data->radio_cfg_dash = IWM_NVM_RF_CFG_DASH_MSK(radio_cfg); @@ -2145,7 +2241,7 @@ iwm_set_hw_address(struct iwm_softc *sc, struct iwm_nvm_data *data, iwm_set_hw_address_from_csr(sc, data); } else #endif - if (sc->cfg->device_family != IWM_DEVICE_FAMILY_8000) { + if (sc->cfg->device_family < IWM_DEVICE_FAMILY_8000) { const uint8_t *hw_addr = (const uint8_t *)(nvm_hw + IWM_HW_ADDR); /* The byte order is little endian 16 bit, meaning 214365 */ @@ -2177,7 +2273,7 @@ iwm_parse_nvm_data(struct iwm_softc *sc, uint32_t sku, radio_cfg; uint16_t lar_config; - if (sc->cfg->device_family != IWM_DEVICE_FAMILY_8000) { + if (sc->cfg->device_family < IWM_DEVICE_FAMILY_8000) { data = malloc(sizeof(*data) + IWM_NUM_CHANNELS * sizeof(uint16_t), M_DEVBUF, M_NOWAIT | M_ZERO); @@ -2201,7 +2297,8 @@ iwm_parse_nvm_data(struct iwm_softc *sc, data->n_hw_addrs = iwm_get_n_hw_addrs(sc, nvm_sw); - if (sc->cfg->device_family == IWM_DEVICE_FAMILY_8000) { + if (sc->cfg->device_family >= IWM_DEVICE_FAMILY_8000) { + /* TODO: use IWL_NVM_EXT */ uint16_t lar_offset = data->nvm_version < 0xE39 ? IWM_NVM_LAR_OFFSET_8000_OLD : IWM_NVM_LAR_OFFSET_8000; @@ -2218,7 +2315,8 @@ iwm_parse_nvm_data(struct iwm_softc *sc, } if (sc->cfg->device_family == IWM_DEVICE_FAMILY_7000) { - memcpy(data->nvm_ch_flags, &nvm_sw[IWM_NVM_CHANNELS], + memcpy(data->nvm_ch_flags, sc->cfg->nvm_type == IWM_NVM_SDP ? + ®ulatory[0] : &nvm_sw[IWM_NVM_CHANNELS], IWM_NUM_CHANNELS * sizeof(uint16_t)); } else { memcpy(data->nvm_ch_flags, ®ulatory[IWM_NVM_CHANNELS_8000], @@ -2248,7 +2346,7 @@ iwm_parse_nvm_sections(struct iwm_softc *sc, struct iwm_nvm_section *sections) "Can't parse empty OTP/NVM sections\n"); return NULL; } - } else if (sc->cfg->device_family == IWM_DEVICE_FAMILY_8000) { + } else if (sc->cfg->device_family >= IWM_DEVICE_FAMILY_8000) { /* SW and REGULATORY sections are mandatory */ if (!sections[IWM_NVM_SECTION_TYPE_SW].data || !sections[IWM_NVM_SECTION_TYPE_REGULATORY].data) { @@ -2278,8 +2376,9 @@ iwm_parse_nvm_sections(struct iwm_softc *sc, struct iwm_nvm_section *sections) sw = (const uint16_t *)sections[IWM_NVM_SECTION_TYPE_SW].data; calib = (const uint16_t *) sections[IWM_NVM_SECTION_TYPE_CALIBRATION].data; - regulatory = (const uint16_t *) - sections[IWM_NVM_SECTION_TYPE_REGULATORY].data; + regulatory = sc->cfg->nvm_type == IWM_NVM_SDP ? + (const uint16_t *)sections[IWM_NVM_SECTION_TYPE_REGULATORY_SDP].data : + (const uint16_t *)sections[IWM_NVM_SECTION_TYPE_REGULATORY].data; mac_override = (const uint16_t *) sections[IWM_NVM_SECTION_TYPE_MAC_OVERRIDE].data; phy_sku = (const uint16_t *)sections[IWM_NVM_SECTION_TYPE_PHY_SKU].data; @@ -2677,7 +2776,7 @@ iwm_start_fw(struct iwm_softc *sc, const struct iwm_fw_img *fw) IWM_WRITE(sc, IWM_CSR_UCODE_DRV_GP1_CLR, IWM_CSR_UCODE_SW_BIT_RFKILL); /* Load the given image to the HW */ - if (sc->cfg->device_family == IWM_DEVICE_FAMILY_8000) + if (sc->cfg->device_family >= IWM_DEVICE_FAMILY_8000) ret = iwm_pcie_load_given_ucode_8000(sc, fw); else ret = iwm_pcie_load_given_ucode(sc, fw); @@ -2695,7 +2794,7 @@ iwm_send_tx_ant_cfg(struct iwm_softc *sc, uint8_t valid_tx_ant) .valid = htole32(valid_tx_ant), }; - return iwm_mvm_send_cmd_pdu(sc, IWM_TX_ANT_CONFIGURATION_CMD, + return iwm_send_cmd_pdu(sc, IWM_TX_ANT_CONFIGURATION_CMD, IWM_CMD_SYNC, sizeof(tx_ant_cmd), &tx_ant_cmd); } @@ -2707,7 +2806,7 @@ iwm_send_phy_cfg_cmd(struct iwm_softc *sc) enum iwm_ucode_type ucode_type = sc->cur_ucode; /* Set parameters */ - phy_cfg_cmd.phy_cfg = htole32(iwm_mvm_get_phy_config(sc)); + phy_cfg_cmd.phy_cfg = htole32(iwm_get_phy_config(sc)); phy_cfg_cmd.calib_control.event_trigger = sc->sc_default_calib[ucode_type].event_trigger; phy_cfg_cmd.calib_control.flow_trigger = @@ -2715,16 +2814,16 @@ iwm_send_phy_cfg_cmd(struct iwm_softc *sc) IWM_DPRINTF(sc, IWM_DEBUG_CMD | IWM_DEBUG_RESET, "Sending Phy CFG command: 0x%x\n", phy_cfg_cmd.phy_cfg); - return iwm_mvm_send_cmd_pdu(sc, IWM_PHY_CONFIGURATION_CMD, IWM_CMD_SYNC, + return iwm_send_cmd_pdu(sc, IWM_PHY_CONFIGURATION_CMD, IWM_CMD_SYNC, sizeof(phy_cfg_cmd), &phy_cfg_cmd); } static int iwm_alive_fn(struct iwm_softc *sc, struct iwm_rx_packet *pkt, void *data) { - struct iwm_mvm_alive_data *alive_data = data; - struct iwm_mvm_alive_resp_v3 *palive3; - struct iwm_mvm_alive_resp *palive; + struct iwm_alive_data *alive_data = data; + struct iwm_alive_resp_v3 *palive3; + struct iwm_alive_resp *palive; struct iwm_umac_alive *umac; struct iwm_lmac_alive *lmac1; struct iwm_lmac_alive *lmac2 = NULL; @@ -2792,15 +2891,15 @@ iwm_wait_phy_db_entry(struct iwm_softc *sc, } static int -iwm_mvm_load_ucode_wait_alive(struct iwm_softc *sc, +iwm_load_ucode_wait_alive(struct iwm_softc *sc, enum iwm_ucode_type ucode_type) { struct iwm_notification_wait alive_wait; - struct iwm_mvm_alive_data alive_data; + struct iwm_alive_data alive_data; const struct iwm_fw_img *fw; enum iwm_ucode_type old_type = sc->cur_ucode; int error; - static const uint16_t alive_cmd[] = { IWM_MVM_ALIVE }; + static const uint16_t alive_cmd[] = { IWM_ALIVE }; fw = &sc->sc_fw.img[ucode_type]; sc->cur_ucode = ucode_type; @@ -2825,10 +2924,10 @@ iwm_mvm_load_ucode_wait_alive(struct iwm_softc *sc, */ IWM_UNLOCK(sc); error = iwm_wait_notification(sc->sc_notif_wait, &alive_wait, - IWM_MVM_UCODE_ALIVE_TIMEOUT); + IWM_UCODE_ALIVE_TIMEOUT); IWM_LOCK(sc); if (error) { - if (sc->cfg->device_family == IWM_DEVICE_FAMILY_8000) { + if (sc->cfg->device_family >= IWM_DEVICE_FAMILY_8000) { uint32_t a = 0x5a5a5a5a, b = 0x5a5a5a5a; if (iwm_nic_lock(sc)) { a = iwm_read_prph(sc, IWM_SB_CPU_1_STATUS); @@ -2888,7 +2987,7 @@ iwm_mvm_load_ucode_wait_alive(struct iwm_softc *sc, * follows iwlwifi/fw.c */ static int -iwm_run_init_mvm_ucode(struct iwm_softc *sc, int justnvm) +iwm_run_init_ucode(struct iwm_softc *sc, int justnvm) { struct iwm_notification_wait calib_wait; static const uint16_t init_complete[] = { @@ -2912,13 +3011,22 @@ iwm_run_init_mvm_ucode(struct iwm_softc *sc, int justnvm) sc->sc_phy_db); /* Will also start the device */ - ret = iwm_mvm_load_ucode_wait_alive(sc, IWM_UCODE_INIT); + ret = iwm_load_ucode_wait_alive(sc, IWM_UCODE_INIT); if (ret) { device_printf(sc->sc_dev, "Failed to start INIT ucode: %d\n", ret); goto error; } + if (sc->cfg->device_family < IWM_DEVICE_FAMILY_8000) { + ret = iwm_send_bt_init_conf(sc); + if (ret) { + device_printf(sc->sc_dev, + "failed to send bt coex configuration: %d\n", ret); + goto error; + } + } + if (justnvm) { /* Read nvm */ ret = iwm_nvm_init(sc); @@ -2930,15 +3038,8 @@ iwm_run_init_mvm_ucode(struct iwm_softc *sc, int justnvm) goto error; } - ret = iwm_send_bt_init_conf(sc); - if (ret) { - device_printf(sc->sc_dev, - "failed to send bt coex configuration: %d\n", ret); - goto error; - } - /* Send TX valid antennas before triggering calibrations */ - ret = iwm_send_tx_ant_cfg(sc, iwm_mvm_get_valid_tx_ant(sc)); + ret = iwm_send_tx_ant_cfg(sc, iwm_get_valid_tx_ant(sc)); if (ret) { device_printf(sc->sc_dev, "failed to send antennas before calibration: %d\n", ret); @@ -2963,7 +3064,7 @@ iwm_run_init_mvm_ucode(struct iwm_softc *sc, int justnvm) */ IWM_UNLOCK(sc); ret = iwm_wait_notification(sc->sc_notif_wait, &calib_wait, - IWM_MVM_UCODE_CALIB_TIMEOUT); + IWM_UCODE_CALIB_TIMEOUT); IWM_LOCK(sc); @@ -2976,7 +3077,7 @@ out: } static int -iwm_mvm_config_ltr(struct iwm_softc *sc) +iwm_config_ltr(struct iwm_softc *sc) { struct iwm_ltr_config_cmd cmd = { .flags = htole32(IWM_LTR_CFG_FLAG_FEATURE_ENABLE), @@ -2985,7 +3086,7 @@ iwm_mvm_config_ltr(struct iwm_softc *sc) if (!sc->sc_ltr_enabled) return 0; - return iwm_mvm_send_cmd_pdu(sc, IWM_LTR_CONFIG, 0, sizeof(cmd), &cmd); + return iwm_send_cmd_pdu(sc, IWM_LTR_CONFIG, 0, sizeof(cmd), &cmd); } /* @@ -3030,48 +3131,18 @@ iwm_rx_addbuf(struct iwm_softc *sc, int size, int idx) /* Update RX descriptor. */ KASSERT((seg.ds_addr & 255) == 0, ("seg.ds_addr not aligned")); - ring->desc[idx] = htole32(seg.ds_addr >> 8); - bus_dmamap_sync(ring->desc_dma.tag, ring->desc_dma.map, + if (sc->cfg->mqrx_supported) + ((uint64_t *)ring->desc)[idx] = htole64(seg.ds_addr); + else + ((uint32_t *)ring->desc)[idx] = htole32(seg.ds_addr >> 8); + bus_dmamap_sync(ring->free_desc_dma.tag, ring->free_desc_dma.map, BUS_DMASYNC_PREWRITE); return 0; } -/* iwlwifi: mvm/rx.c */ -/* - * iwm_mvm_get_signal_strength - use new rx PHY INFO API - * values are reported by the fw as positive values - need to negate - * to obtain their dBM. Account for missing antennas by replacing 0 - * values by -256dBm: practically 0 power and a non-feasible 8 bit value. - */ -static int -iwm_mvm_get_signal_strength(struct iwm_softc *sc, struct iwm_rx_phy_info *phy_info) -{ - int energy_a, energy_b, energy_c, max_energy; - uint32_t val; - - val = le32toh(phy_info->non_cfg_phy[IWM_RX_INFO_ENERGY_ANT_ABC_IDX]); - energy_a = (val & IWM_RX_INFO_ENERGY_ANT_A_MSK) >> - IWM_RX_INFO_ENERGY_ANT_A_POS; - energy_a = energy_a ? -energy_a : -256; - energy_b = (val & IWM_RX_INFO_ENERGY_ANT_B_MSK) >> - IWM_RX_INFO_ENERGY_ANT_B_POS; - energy_b = energy_b ? -energy_b : -256; - energy_c = (val & IWM_RX_INFO_ENERGY_ANT_C_MSK) >> - IWM_RX_INFO_ENERGY_ANT_C_POS; - energy_c = energy_c ? -energy_c : -256; - max_energy = MAX(energy_a, energy_b); - max_energy = MAX(max_energy, energy_c); - - IWM_DPRINTF(sc, IWM_DEBUG_RECV, - "energy In A %d B %d C %d , and max %d\n", - energy_a, energy_b, energy_c, max_energy); - - return max_energy; -} - static void -iwm_mvm_rx_rx_phy_cmd(struct iwm_softc *sc, struct iwm_rx_packet *pkt) +iwm_rx_rx_phy_cmd(struct iwm_softc *sc, struct iwm_rx_packet *pkt) { struct iwm_rx_phy_info *phy_info = (void *)pkt->data; @@ -3085,7 +3156,7 @@ iwm_mvm_rx_rx_phy_cmd(struct iwm_softc *sc, struct iwm_rx_packet *pkt) */ static int iwm_get_noise(struct iwm_softc *sc, - const struct iwm_mvm_statistics_rx_non_phy *stats) + const struct iwm_statistics_rx_non_phy *stats) { int i, total, nbant, noise; @@ -3115,7 +3186,7 @@ iwm_get_noise(struct iwm_softc *sc, } static void -iwm_mvm_handle_rx_statistics(struct iwm_softc *sc, struct iwm_rx_packet *pkt) +iwm_handle_rx_statistics(struct iwm_softc *sc, struct iwm_rx_packet *pkt) { struct iwm_notif_statistics_v10 *stats = (void *)&pkt->data; @@ -3123,19 +3194,65 @@ iwm_mvm_handle_rx_statistics(struct iwm_softc *sc, struct iwm_rx_packet *pkt) sc->sc_noise = iwm_get_noise(sc, &stats->rx.general); } +/* iwlwifi: mvm/rx.c */ /* - * iwm_mvm_rx_rx_mpdu - IWM_REPLY_RX_MPDU_CMD handler + * iwm_get_signal_strength - use new rx PHY INFO API + * values are reported by the fw as positive values - need to negate + * to obtain their dBM. Account for missing antennas by replacing 0 + * values by -256dBm: practically 0 power and a non-feasible 8 bit value. + */ +static int +iwm_rx_get_signal_strength(struct iwm_softc *sc, + struct iwm_rx_phy_info *phy_info) +{ + int energy_a, energy_b, energy_c, max_energy; + uint32_t val; + + val = le32toh(phy_info->non_cfg_phy[IWM_RX_INFO_ENERGY_ANT_ABC_IDX]); + energy_a = (val & IWM_RX_INFO_ENERGY_ANT_A_MSK) >> + IWM_RX_INFO_ENERGY_ANT_A_POS; + energy_a = energy_a ? -energy_a : -256; + energy_b = (val & IWM_RX_INFO_ENERGY_ANT_B_MSK) >> + IWM_RX_INFO_ENERGY_ANT_B_POS; + energy_b = energy_b ? -energy_b : -256; + energy_c = (val & IWM_RX_INFO_ENERGY_ANT_C_MSK) >> + IWM_RX_INFO_ENERGY_ANT_C_POS; + energy_c = energy_c ? -energy_c : -256; + max_energy = MAX(energy_a, energy_b); + max_energy = MAX(max_energy, energy_c); + + IWM_DPRINTF(sc, IWM_DEBUG_RECV, + "energy In A %d B %d C %d , and max %d\n", + energy_a, energy_b, energy_c, max_energy); + + return max_energy; +} + +static int +iwm_rxmq_get_signal_strength(struct iwm_softc *sc, + struct iwm_rx_mpdu_desc *desc) +{ + int energy_a, energy_b; + + energy_a = desc->v1.energy_a; + energy_b = desc->v1.energy_b; + energy_a = energy_a ? -energy_a : -256; + energy_b = energy_b ? -energy_b : -256; + return MAX(energy_a, energy_b); +} + +/* + * iwm_rx_rx_mpdu - IWM_REPLY_RX_MPDU_CMD handler * * Handles the actual data of the Rx packet from the fw */ -static boolean_t -iwm_mvm_rx_rx_mpdu(struct iwm_softc *sc, struct mbuf *m, uint32_t offset, - boolean_t stolen) +static bool +iwm_rx_rx_mpdu(struct iwm_softc *sc, struct mbuf *m, uint32_t offset, + bool stolen) { struct ieee80211com *ic = &sc->sc_ic; struct ieee80211vap *vap = TAILQ_FIRST(&ic->ic_vaps); struct ieee80211_frame *wh; - struct ieee80211_node *ni; struct ieee80211_rx_stats rxs; struct iwm_rx_phy_info *phy_info; struct iwm_rx_mpdu_res_start *rx_res; @@ -3154,17 +3271,17 @@ iwm_mvm_rx_rx_mpdu(struct iwm_softc *sc, struct mbuf *m, uint32_t offset, device_printf(sc->sc_dev, "dsp size out of range [0,20]: %d\n", phy_info->cfg_phy_cnt); - goto fail; + return false; } if (!(rx_pkt_status & IWM_RX_MPDU_RES_STATUS_CRC_OK) || !(rx_pkt_status & IWM_RX_MPDU_RES_STATUS_OVERRUN_OK)) { IWM_DPRINTF(sc, IWM_DEBUG_RECV, "Bad CRC or FIFO: 0x%08X.\n", rx_pkt_status); - goto fail; + return false; } - rssi = iwm_mvm_get_signal_strength(sc, phy_info); + rssi = iwm_rx_get_signal_strength(sc, phy_info); /* Map it to relative value */ rssi = rssi - sc->sc_noise; @@ -3173,7 +3290,7 @@ iwm_mvm_rx_rx_mpdu(struct iwm_softc *sc, struct mbuf *m, uint32_t offset, if (!stolen && iwm_rx_addbuf(sc, IWM_RBUF_SIZE, sc->rxq.cur) != 0) { device_printf(sc->sc_dev, "%s: unable to add more buffers\n", __func__); - goto fail; + return false; } m->m_data = pkt->data + sizeof(*rx_res); @@ -3182,8 +3299,6 @@ iwm_mvm_rx_rx_mpdu(struct iwm_softc *sc, struct mbuf *m, uint32_t offset, IWM_DPRINTF(sc, IWM_DEBUG_RECV, "%s: rssi=%d, noise=%d\n", __func__, rssi, sc->sc_noise); - ni = ieee80211_find_rxnode(ic, (struct ieee80211_frame_min *)wh); - IWM_DPRINTF(sc, IWM_DEBUG_RECV, "%s: phy_info: channel=%d, flags=0x%08x\n", __func__, @@ -3206,11 +3321,8 @@ iwm_mvm_rx_rx_mpdu(struct iwm_softc *sc, struct mbuf *m, uint32_t offset, /* rssi is in 1/2db units */ rxs.c_rssi = rssi * 2; rxs.c_nf = sc->sc_noise; - if (ieee80211_add_rx_params(m, &rxs) == 0) { - if (ni) - ieee80211_free_node(ni); - goto fail; - } + if (ieee80211_add_rx_params(m, &rxs) == 0) + return false; if (ieee80211_radiotap_active_vap(vap)) { struct iwm_rx_radiotap_header *tap = &sc->sc_rxtap; @@ -3244,7 +3356,141 @@ iwm_mvm_rx_rx_mpdu(struct iwm_softc *sc, struct mbuf *m, uint32_t offset, } } + return true; +} + +static bool +iwm_rx_mpdu_mq(struct iwm_softc *sc, struct mbuf *m, uint32_t offset, + bool stolen) +{ + struct ieee80211com *ic = &sc->sc_ic; + struct ieee80211vap *vap = TAILQ_FIRST(&ic->ic_vaps); + struct ieee80211_frame *wh; + struct ieee80211_rx_stats rxs; + struct iwm_rx_mpdu_desc *desc; + struct iwm_rx_packet *pkt; + int rssi; + uint32_t hdrlen, len, rate_n_flags; + uint16_t phy_info; + uint8_t channel; + + pkt = mtodo(m, offset); + desc = (void *)pkt->data; + + if (!(desc->status & htole16(IWM_RX_MPDU_RES_STATUS_CRC_OK)) || + !(desc->status & htole16(IWM_RX_MPDU_RES_STATUS_OVERRUN_OK))) { + IWM_DPRINTF(sc, IWM_DEBUG_RECV, + "Bad CRC or FIFO: 0x%08X.\n", desc->status); + return false; + } + + channel = desc->v1.channel; + len = le16toh(desc->mpdu_len); + phy_info = le16toh(desc->phy_info); + rate_n_flags = desc->v1.rate_n_flags; + + wh = mtodo(m, sizeof(*desc)); + m->m_data = pkt->data + sizeof(*desc); + m->m_pkthdr.len = m->m_len = len; + m->m_len = len; + + /* Account for padding following the frame header. */ + if ((desc->mac_flags2 & IWM_RX_MPDU_MFLG2_PAD)) { + hdrlen = ieee80211_anyhdrsize(wh); + memmove(mtodo(m, 2), mtodo(m, 0), hdrlen); + m->m_data = mtodo(m, 2); + wh = mtod(m, struct ieee80211_frame *); + } + + /* Map it to relative value */ + rssi = iwm_rxmq_get_signal_strength(sc, desc); + rssi = rssi - sc->sc_noise; + + /* replenish ring for the buffer we're going to feed to the sharks */ + if (!stolen && iwm_rx_addbuf(sc, IWM_RBUF_SIZE, sc->rxq.cur) != 0) { + device_printf(sc->sc_dev, "%s: unable to add more buffers\n", + __func__); + return false; + } + + IWM_DPRINTF(sc, IWM_DEBUG_RECV, + "%s: rssi=%d, noise=%d\n", __func__, rssi, sc->sc_noise); + + /* + * Populate an RX state struct with the provided information. + */ + bzero(&rxs, sizeof(rxs)); + rxs.r_flags |= IEEE80211_R_IEEE | IEEE80211_R_FREQ; + rxs.r_flags |= IEEE80211_R_NF | IEEE80211_R_RSSI; + rxs.c_ieee = channel; + rxs.c_freq = ieee80211_ieee2mhz(rxs.c_ieee, + channel <= 14 ? IEEE80211_CHAN_2GHZ : IEEE80211_CHAN_5GHZ); + + /* rssi is in 1/2db units */ + rxs.c_rssi = rssi * 2; + rxs.c_nf = sc->sc_noise; + if (ieee80211_add_rx_params(m, &rxs) == 0) + return false; + + if (ieee80211_radiotap_active_vap(vap)) { + struct iwm_rx_radiotap_header *tap = &sc->sc_rxtap; + + tap->wr_flags = 0; + if ((phy_info & IWM_RX_MPDU_PHY_SHORT_PREAMBLE) != 0) + tap->wr_flags |= IEEE80211_RADIOTAP_F_SHORTPRE; + tap->wr_chan_freq = htole16(rxs.c_freq); + /* XXX only if ic->ic_curchan->ic_ieee == rxs.c_ieee */ + tap->wr_chan_flags = htole16(ic->ic_curchan->ic_flags); + tap->wr_dbm_antsignal = (int8_t)rssi; + tap->wr_dbm_antnoise = (int8_t)sc->sc_noise; + tap->wr_tsft = desc->v1.gp2_on_air_rise; + switch ((rate_n_flags & 0xff)) { + /* CCK rates. */ + case 10: tap->wr_rate = 2; break; + case 20: tap->wr_rate = 4; break; + case 55: tap->wr_rate = 11; break; + case 110: tap->wr_rate = 22; break; + /* OFDM rates. */ + case 0xd: tap->wr_rate = 12; break; + case 0xf: tap->wr_rate = 18; break; + case 0x5: tap->wr_rate = 24; break; + case 0x7: tap->wr_rate = 36; break; + case 0x9: tap->wr_rate = 48; break; + case 0xb: tap->wr_rate = 72; break; + case 0x1: tap->wr_rate = 96; break; + case 0x3: tap->wr_rate = 108; break; + /* Unknown rate: should not happen. */ + default: tap->wr_rate = 0; + } + } + + return true; +} + +static bool +iwm_rx_mpdu(struct iwm_softc *sc, struct mbuf *m, uint32_t offset, + bool stolen) +{ + struct ieee80211com *ic; + struct ieee80211_frame *wh; + struct ieee80211_node *ni; + bool ret; + + ic = &sc->sc_ic; + + ret = sc->cfg->mqrx_supported ? + iwm_rx_mpdu_mq(sc, m, offset, stolen) : + iwm_rx_rx_mpdu(sc, m, offset, stolen); + if (!ret) { + counter_u64_add(ic->ic_ierrors, 1); + return (ret); + } + + wh = mtod(m, struct ieee80211_frame *); + ni = ieee80211_find_rxnode(ic, (struct ieee80211_frame_min *)wh); + IWM_UNLOCK(sc); + if (ni != NULL) { IWM_DPRINTF(sc, IWM_DEBUG_RECV, "input m %p\n", m); ieee80211_input_mimo(ni, m); @@ -3253,20 +3499,17 @@ iwm_mvm_rx_rx_mpdu(struct iwm_softc *sc, struct mbuf *m, uint32_t offset, IWM_DPRINTF(sc, IWM_DEBUG_RECV, "inputall m %p\n", m); ieee80211_input_mimo_all(ic, m); } + IWM_LOCK(sc); - return TRUE; - -fail: - counter_u64_add(ic->ic_ierrors, 1); - return FALSE; + return true; } static int -iwm_mvm_rx_tx_cmd_single(struct iwm_softc *sc, struct iwm_rx_packet *pkt, +iwm_rx_tx_cmd_single(struct iwm_softc *sc, struct iwm_rx_packet *pkt, struct iwm_node *in) { - struct iwm_mvm_tx_resp *tx_resp = (void *)pkt->data; + struct iwm_tx_resp *tx_resp = (void *)pkt->data; struct ieee80211_ratectl_tx_status *txs = &sc->sc_txs; struct ieee80211_node *ni = &in->in_ni; struct ieee80211vap *vap = ni->ni_vap; @@ -3325,15 +3568,14 @@ iwm_mvm_rx_tx_cmd_single(struct iwm_softc *sc, struct iwm_rx_packet *pkt, } if (rate_matched) { - int rix; ieee80211_ratectl_tx_complete(ni, txs); - rix = ieee80211_ratectl_rate(vap->iv_bss, NULL, 0); + int rix = ieee80211_ratectl_rate(vap->iv_bss, NULL, 0); new_rate = vap->iv_bss->ni_txrate; if (new_rate != 0 && new_rate != cur_rate) { struct iwm_node *in = IWM_NODE(vap->iv_bss); iwm_setrates(sc, in, rix); - iwm_mvm_send_lq_cmd(sc, &in->in_lq, FALSE); + iwm_send_lq_cmd(sc, &in->in_lq, FALSE); } } @@ -3341,16 +3583,23 @@ iwm_mvm_rx_tx_cmd_single(struct iwm_softc *sc, struct iwm_rx_packet *pkt, } static void -iwm_mvm_rx_tx_cmd(struct iwm_softc *sc, struct iwm_rx_packet *pkt) +iwm_rx_tx_cmd(struct iwm_softc *sc, struct iwm_rx_packet *pkt) { - struct iwm_cmd_header *cmd_hdr = &pkt->hdr; - int idx = cmd_hdr->idx; - int qid = cmd_hdr->qid; - struct iwm_tx_ring *ring = &sc->txq[qid]; - struct iwm_tx_data *txd = &ring->data[idx]; - struct iwm_node *in = txd->in; - struct mbuf *m = txd->m; - int status; + struct iwm_cmd_header *cmd_hdr; + struct iwm_tx_ring *ring; + struct iwm_tx_data *txd; + struct iwm_node *in; + struct mbuf *m; + int idx, qid, qmsk, status; + + cmd_hdr = &pkt->hdr; + idx = cmd_hdr->idx; + qid = cmd_hdr->qid; + + ring = &sc->txq[qid]; + txd = &ring->data[idx]; + in = txd->in; + m = txd->m; KASSERT(txd->done == 0, ("txd not done")); KASSERT(txd->in != NULL, ("txd without node")); @@ -3358,7 +3607,7 @@ iwm_mvm_rx_tx_cmd(struct iwm_softc *sc, struct iwm_rx_packet *pkt) sc->sc_tx_timer = 0; - status = iwm_mvm_rx_tx_cmd_single(sc, pkt, in); + status = iwm_rx_tx_cmd_single(sc, pkt, in); /* Unmap and free mbuf. */ bus_dmamap_sync(ring->data_dmat, txd->map, BUS_DMASYNC_POSTWRITE); @@ -3372,11 +3621,11 @@ iwm_mvm_rx_tx_cmd(struct iwm_softc *sc, struct iwm_rx_packet *pkt) ieee80211_tx_complete(&in->in_ni, m, status); - if (--ring->queued < IWM_TX_RING_LOMARK) { - sc->qfullmsk &= ~(1 << ring->qid); - if (sc->qfullmsk == 0) { + qmsk = 1 << qid; + if (--ring->queued < IWM_TX_RING_LOMARK && (sc->qfullmsk & qmsk) != 0) { + sc->qfullmsk &= ~qmsk; + if (sc->qfullmsk == 0) iwm_start(sc); - } } } @@ -3392,10 +3641,10 @@ iwm_mvm_rx_tx_cmd(struct iwm_softc *sc, struct iwm_rx_packet *pkt) static void iwm_cmd_done(struct iwm_softc *sc, struct iwm_rx_packet *pkt) { - struct iwm_tx_ring *ring = &sc->txq[IWM_MVM_CMD_QUEUE]; + struct iwm_tx_ring *ring = &sc->txq[IWM_CMD_QUEUE]; struct iwm_tx_data *data; - if (pkt->hdr.qid != IWM_MVM_CMD_QUEUE) { + if (pkt->hdr.qid != IWM_CMD_QUEUE) { return; /* Not a command ack. */ } @@ -3537,7 +3786,10 @@ iwm_tx_fill_cmd(struct iwm_softc *sc, struct iwm_node *in, ); /* XXX TODO: hard-coded TX antenna? */ - rate_flags = 1 << IWM_RATE_MCS_ANT_POS; + if (sc->cfg->device_family == IWM_DEVICE_FAMILY_9000) + rate_flags = IWM_RATE_MCS_ANT_B_MSK; + else + rate_flags = IWM_RATE_MCS_ANT_A_MSK; if (IWM_RIDX_IS_CCK(ridx)) rate_flags |= IWM_RATE_MCS_CCK_MSK; tx->rate_n_flags = htole32(rate_flags | rinfo->plcp); @@ -3574,7 +3826,6 @@ iwm_tx(struct iwm_softc *sc, struct mbuf *m, struct ieee80211_node *ni, int ac) tid = 0; ring = &sc->txq[ac]; desc = &ring->desc[ring->cur]; - memset(desc, 0, sizeof(*desc)); data = &ring->data[ring->cur]; /* Fill out iwm_tx_cmd to send to the firmware */ @@ -3613,25 +3864,19 @@ iwm_tx(struct iwm_softc *sc, struct mbuf *m, struct ieee80211_node *ni, int ac) ieee80211_radiotap_tx(vap, m); } - - totlen = m->m_pkthdr.len; - flags = 0; + totlen = m->m_pkthdr.len; if (!IEEE80211_IS_MULTICAST(wh->i_addr1)) { flags |= IWM_TX_CMD_FLG_ACK; } - if (type == IEEE80211_FC0_TYPE_DATA - && (totlen + IEEE80211_CRC_LEN > vap->iv_rtsthreshold) - && !IEEE80211_IS_MULTICAST(wh->i_addr1)) { + if (type == IEEE80211_FC0_TYPE_DATA && + totlen + IEEE80211_CRC_LEN > vap->iv_rtsthreshold && + !IEEE80211_IS_MULTICAST(wh->i_addr1)) { flags |= IWM_TX_CMD_FLG_PROT_REQUIRE; } - if (IEEE80211_IS_MULTICAST(wh->i_addr1) || - type != IEEE80211_FC0_TYPE_DATA) - tx->sta_id = sc->sc_aux_sta.sta_id; - else - tx->sta_id = IWM_STATION_ID; + tx->sta_id = IWM_STATION_ID; if (type == IEEE80211_FC0_TYPE_MGT) { uint8_t subtype = wh->i_fc[0] & IEEE80211_FC0_SUBTYPE_MASK; @@ -3651,12 +3896,12 @@ iwm_tx(struct iwm_softc *sc, struct mbuf *m, struct ieee80211_node *ni, int ac) if (hdrlen & 3) { /* First segment length must be a multiple of 4. */ flags |= IWM_TX_CMD_FLG_MH_PAD; + tx->offload_assist |= htole16(1 << IWM_TX_CMD_OFFLD_PAD); pad = 4 - (hdrlen & 3); - } else + } else { + tx->offload_assist = 0; pad = 0; - - tx->driver_txop = 0; - tx->next_frame_len = 0; + } tx->len = htole16(totlen); tx->tid_tspec = tid; @@ -3667,7 +3912,7 @@ iwm_tx(struct iwm_softc *sc, struct mbuf *m, struct ieee80211_node *ni, int ac) tx->dram_msb_ptr = iwm_get_dma_hi_addr(data->scratch_paddr); /* Copy 802.11 header in TX command. */ - memcpy(((uint8_t *)tx) + sizeof(*tx), wh, hdrlen); + memcpy((uint8_t *)tx + sizeof(*tx), wh, hdrlen); flags |= IWM_TX_CMD_FLG_BT_DIS | IWM_TX_CMD_FLG_SEQ_CTL; @@ -3721,23 +3966,24 @@ iwm_tx(struct iwm_softc *sc, struct mbuf *m, struct ieee80211_node *ni, int ac) ); /* Fill TX descriptor. */ + memset(desc, 0, sizeof(*desc)); desc->num_tbs = 2 + nsegs; desc->tbs[0].lo = htole32(data->cmd_paddr); - desc->tbs[0].hi_n_len = htole16(iwm_get_dma_hi_addr(data->cmd_paddr)) | - (TB0_SIZE << 4); + desc->tbs[0].hi_n_len = htole16(iwm_get_dma_hi_addr(data->cmd_paddr) | + (TB0_SIZE << 4)); desc->tbs[1].lo = htole32(data->cmd_paddr + TB0_SIZE); - desc->tbs[1].hi_n_len = htole16(iwm_get_dma_hi_addr(data->cmd_paddr)) | - ((sizeof(struct iwm_cmd_header) + sizeof(*tx) - + hdrlen + pad - TB0_SIZE) << 4); + desc->tbs[1].hi_n_len = htole16(iwm_get_dma_hi_addr(data->cmd_paddr) | + ((sizeof(struct iwm_cmd_header) + sizeof(*tx) + + hdrlen + pad - TB0_SIZE) << 4)); /* Other DMA segments are for data payload. */ for (i = 0; i < nsegs; i++) { seg = &segs[i]; - desc->tbs[i+2].lo = htole32(seg->ds_addr); - desc->tbs[i+2].hi_n_len = \ - htole16(iwm_get_dma_hi_addr(seg->ds_addr)) - | ((seg->ds_len) << 4); + desc->tbs[i + 2].lo = htole32(seg->ds_addr); + desc->tbs[i + 2].hi_n_len = + htole16(iwm_get_dma_hi_addr(seg->ds_addr)) | + (seg->ds_len << 4); } bus_dmamap_sync(ring->data_dmat, data->map, @@ -3809,7 +4055,7 @@ iwm_raw_xmit(struct ieee80211_node *ni, struct mbuf *m, * 3) wait for the transport queues to be empty */ int -iwm_mvm_flush_tx_path(struct iwm_softc *sc, uint32_t tfd_msk, uint32_t flags) +iwm_flush_tx_path(struct iwm_softc *sc, uint32_t tfd_msk, uint32_t flags) { int ret; struct iwm_tx_path_flush_cmd flush_cmd = { @@ -3817,7 +4063,7 @@ iwm_mvm_flush_tx_path(struct iwm_softc *sc, uint32_t tfd_msk, uint32_t flags) .flush_ctl = htole16(IWM_DUMP_TX_FIFO_FLUSH), }; - ret = iwm_mvm_send_cmd_pdu(sc, IWM_TXPATH_FLUSH, flags, + ret = iwm_send_cmd_pdu(sc, IWM_TXPATH_FLUSH, flags, sizeof(flush_cmd), &flush_cmd); if (ret) device_printf(sc->sc_dev, @@ -3830,7 +4076,7 @@ iwm_mvm_flush_tx_path(struct iwm_softc *sc, uint32_t tfd_msk, uint32_t flags) */ static int -iwm_mvm_update_quotas(struct iwm_softc *sc, struct iwm_vap *ivp) +iwm_update_quotas(struct iwm_softc *sc, struct iwm_vap *ivp) { struct iwm_time_quota_cmd cmd; int i, idx, ret, num_active_macs, quota, quota_rem; @@ -3852,7 +4098,7 @@ iwm_mvm_update_quotas(struct iwm_softc *sc, struct iwm_vap *ivp) /* * The FW's scheduling session consists of - * IWM_MVM_MAX_QUOTA fragments. Divide these fragments + * IWM_MAX_QUOTA fragments. Divide these fragments * equally between all the bindings that require quota */ num_active_macs = 0; @@ -3864,8 +4110,8 @@ iwm_mvm_update_quotas(struct iwm_softc *sc, struct iwm_vap *ivp) quota = 0; quota_rem = 0; if (num_active_macs) { - quota = IWM_MVM_MAX_QUOTA / num_active_macs; - quota_rem = IWM_MVM_MAX_QUOTA % num_active_macs; + quota = IWM_MAX_QUOTA / num_active_macs; + quota_rem = IWM_MAX_QUOTA % num_active_macs; } for (idx = 0, i = 0; i < IWM_MAX_BINDINGS; i++) { @@ -3888,7 +4134,7 @@ iwm_mvm_update_quotas(struct iwm_softc *sc, struct iwm_vap *ivp) /* Give the remainder of the session to the first binding */ cmd.quotas[0].quota = htole32(le32toh(cmd.quotas[0].quota) + quota_rem); - ret = iwm_mvm_send_cmd_pdu(sc, IWM_TIME_QUOTA_CMD, IWM_CMD_SYNC, + ret = iwm_send_cmd_pdu(sc, IWM_TIME_QUOTA_CMD, IWM_CMD_SYNC, sizeof(cmd), &cmd); if (ret) device_printf(sc->sc_dev, @@ -3972,13 +4218,13 @@ iwm_auth(struct ieee80211vap *vap, struct iwm_softc *sc) * contexts that are required), let's do a dirty hack here. */ if (iv->is_uploaded) { - if ((error = iwm_mvm_mac_ctxt_changed(sc, vap)) != 0) { + if ((error = iwm_mac_ctxt_changed(sc, vap)) != 0) { device_printf(sc->sc_dev, "%s: failed to update MAC\n", __func__); goto out; } } else { - if ((error = iwm_mvm_mac_ctxt_add(sc, vap)) != 0) { + if ((error = iwm_mac_ctxt_add(sc, vap)) != 0) { device_printf(sc->sc_dev, "%s: failed to add MAC\n", __func__); goto out; @@ -3986,7 +4232,7 @@ iwm_auth(struct ieee80211vap *vap, struct iwm_softc *sc) } sc->sc_firmware_state = 1; - if ((error = iwm_mvm_phy_ctxt_changed(sc, &sc->sc_phyctxt[0], + if ((error = iwm_phy_ctxt_changed(sc, &sc->sc_phyctxt[0], in->in_ni.ni_chan, 1, 1)) != 0) { device_printf(sc->sc_dev, "%s: failed update phy ctxt\n", __func__); @@ -3994,7 +4240,7 @@ iwm_auth(struct ieee80211vap *vap, struct iwm_softc *sc) } iv->phy_ctxt = &sc->sc_phyctxt[0]; - if ((error = iwm_mvm_binding_add_vif(sc, iv)) != 0) { + if ((error = iwm_binding_add_vif(sc, iv)) != 0) { device_printf(sc->sc_dev, "%s: binding update cmd\n", __func__); goto out; @@ -4006,7 +4252,7 @@ iwm_auth(struct ieee80211vap *vap, struct iwm_softc *sc) * finished or is aborted. */ iv->ps_disabled = TRUE; - error = iwm_mvm_power_update_mac(sc); + error = iwm_power_update_mac(sc); iv->ps_disabled = FALSE; if (error != 0) { device_printf(sc->sc_dev, @@ -4014,7 +4260,7 @@ iwm_auth(struct ieee80211vap *vap, struct iwm_softc *sc) __func__); goto out; } - if ((error = iwm_mvm_add_sta(sc, in)) != 0) { + if ((error = iwm_add_sta(sc, in)) != 0) { device_printf(sc->sc_dev, "%s: failed to add sta\n", __func__); goto out; @@ -4026,8 +4272,8 @@ iwm_auth(struct ieee80211vap *vap, struct iwm_softc *sc) * by "protecting" the session with a time event. */ /* XXX duration is in units of TU, not MS */ - duration = IWM_MVM_TE_SESSION_PROTECTION_MAX_TIME_MS; - iwm_mvm_protect_session(sc, iv, duration, 500 /* XXX magic number */, TRUE); + duration = IWM_TE_SESSION_PROTECTION_MAX_TIME_MS; + iwm_protect_session(sc, iv, duration, 500 /* XXX magic number */, TRUE); error = 0; out: @@ -4152,11 +4398,11 @@ iwm_setrates(struct iwm_softc *sc, struct iwm_node *in, int rix) #if 0 if (txant == 0) - txant = iwm_mvm_get_valid_tx_ant(sc); + txant = iwm_get_valid_tx_ant(sc); nextant = 1<<(ffs(txant)-1); txant &= ~nextant; #else - nextant = iwm_mvm_get_valid_tx_ant(sc); + nextant = iwm_get_valid_tx_ant(sc); #endif tab = iwm_rates[ridx].plcp; tab |= nextant << IWM_RATE_MCS_ANT_POS; @@ -4207,8 +4453,8 @@ iwm_bring_down_firmware(struct iwm_softc *sc, struct ieee80211vap *vap) ivp->iv_auth = 0; if (sc->sc_firmware_state == 3) { iwm_xmit_queue_drain(sc); -// iwm_mvm_flush_tx_path(sc, 0xf, IWM_CMD_SYNC); - error = iwm_mvm_rm_sta(sc, vap, TRUE); +// iwm_flush_tx_path(sc, 0xf, IWM_CMD_SYNC); + error = iwm_rm_sta(sc, vap, TRUE); if (error) { device_printf(sc->sc_dev, "%s: Failed to remove station: %d\n", @@ -4216,7 +4462,7 @@ iwm_bring_down_firmware(struct iwm_softc *sc, struct ieee80211vap *vap) } } if (sc->sc_firmware_state == 3) { - error = iwm_mvm_mac_ctxt_changed(sc, vap); + error = iwm_mac_ctxt_changed(sc, vap); if (error) { device_printf(sc->sc_dev, "%s: Failed to change mac context: %d\n", @@ -4224,7 +4470,7 @@ iwm_bring_down_firmware(struct iwm_softc *sc, struct ieee80211vap *vap) } } if (sc->sc_firmware_state == 3) { - error = iwm_mvm_sf_update(sc, vap, FALSE); + error = iwm_sf_update(sc, vap, FALSE); if (error) { device_printf(sc->sc_dev, "%s: Failed to update smart FIFO: %d\n", @@ -4232,7 +4478,7 @@ iwm_bring_down_firmware(struct iwm_softc *sc, struct ieee80211vap *vap) } } if (sc->sc_firmware_state == 3) { - error = iwm_mvm_rm_sta_id(sc, vap); + error = iwm_rm_sta_id(sc, vap); if (error) { device_printf(sc->sc_dev, "%s: Failed to remove station id: %d\n", @@ -4240,7 +4486,7 @@ iwm_bring_down_firmware(struct iwm_softc *sc, struct ieee80211vap *vap) } } if (sc->sc_firmware_state == 3) { - error = iwm_mvm_update_quotas(sc, NULL); + error = iwm_update_quotas(sc, NULL); if (error) { device_printf(sc->sc_dev, "%s: Failed to update PHY quota: %d\n", @@ -4249,7 +4495,7 @@ iwm_bring_down_firmware(struct iwm_softc *sc, struct ieee80211vap *vap) } if (sc->sc_firmware_state == 3) { /* XXX Might need to specify bssid correctly. */ - error = iwm_mvm_mac_ctxt_changed(sc, vap); + error = iwm_mac_ctxt_changed(sc, vap); if (error) { device_printf(sc->sc_dev, "%s: Failed to change mac context: %d\n", @@ -4260,7 +4506,7 @@ iwm_bring_down_firmware(struct iwm_softc *sc, struct ieee80211vap *vap) sc->sc_firmware_state = 2; } if (sc->sc_firmware_state > 1) { - error = iwm_mvm_binding_remove_vif(sc, ivp); + error = iwm_binding_remove_vif(sc, ivp); if (error) { device_printf(sc->sc_dev, "%s: Failed to remove channel ctx: %d\n", @@ -4272,7 +4518,7 @@ iwm_bring_down_firmware(struct iwm_softc *sc, struct ieee80211vap *vap) } ivp->phy_ctxt = NULL; if (sc->sc_firmware_state > 0) { - error = iwm_mvm_mac_ctxt_changed(sc, vap); + error = iwm_mac_ctxt_changed(sc, vap); if (error) { device_printf(sc->sc_dev, "%s: Failed to change mac context: %d\n", @@ -4280,7 +4526,7 @@ iwm_bring_down_firmware(struct iwm_softc *sc, struct ieee80211vap *vap) } } if (sc->sc_firmware_state > 0) { - error = iwm_mvm_power_update_mac(sc); + error = iwm_power_update_mac(sc); if (error != 0) { device_printf(sc->sc_dev, "%s: failed to update power management\n", @@ -4317,9 +4563,9 @@ iwm_newstate(struct ieee80211vap *vap, enum ieee80211_state nstate, int arg) } if (vap->iv_state == IEEE80211_S_RUN && nstate != IEEE80211_S_RUN) { - iwm_mvm_led_disable(sc); + iwm_led_disable(sc); /* disable beacon filtering if we're hopping out of RUN */ - iwm_mvm_disable_beacon_filter(sc); + iwm_disable_beacon_filter(sc); if (((in = IWM_NODE(vap->iv_bss)) != NULL)) in->in_assoc = 0; } @@ -4330,7 +4576,7 @@ iwm_newstate(struct ieee80211vap *vap, enum ieee80211_state nstate, int arg) (nstate == IEEE80211_S_INIT || nstate == IEEE80211_S_SCAN || nstate == IEEE80211_S_AUTH)) { - iwm_mvm_stop_session_protection(sc, ivp); + iwm_stop_session_protection(sc, ivp); } if ((vap->iv_state == IEEE80211_S_RUN || @@ -4382,7 +4628,7 @@ iwm_newstate(struct ieee80211vap *vap, enum ieee80211_state nstate, int arg) in = IWM_NODE(vap->iv_bss); /* Update the association state, now we have it all */ /* (eg associd comes in at this point */ - error = iwm_mvm_update_sta(sc, in); + error = iwm_update_sta(sc, in); if (error != 0) { device_printf(sc->sc_dev, "%s: failed to update STA\n", __func__); @@ -4391,27 +4637,25 @@ iwm_newstate(struct ieee80211vap *vap, enum ieee80211_state nstate, int arg) return error; } in->in_assoc = 1; - error = iwm_mvm_mac_ctxt_changed(sc, vap); + error = iwm_mac_ctxt_changed(sc, vap); if (error != 0) { device_printf(sc->sc_dev, "%s: failed to update MAC: %d\n", __func__, error); } - iwm_mvm_sf_update(sc, vap, FALSE); - iwm_mvm_enable_beacon_filter(sc, ivp); - iwm_mvm_power_update_mac(sc); - iwm_mvm_update_quotas(sc, ivp); - { + iwm_sf_update(sc, vap, FALSE); + iwm_enable_beacon_filter(sc, ivp); + iwm_power_update_mac(sc); + iwm_update_quotas(sc, ivp); int rix = ieee80211_ratectl_rate(&in->in_ni, NULL, 0); iwm_setrates(sc, in, rix); - if ((error = iwm_mvm_send_lq_cmd(sc, &in->in_lq, TRUE)) != 0) { + if ((error = iwm_send_lq_cmd(sc, &in->in_lq, TRUE)) != 0) { device_printf(sc->sc_dev, "%s: IWM_LQ_CMD failed: %d\n", __func__, error); } - iwm_mvm_led_enable(sc); - } + iwm_led_enable(sc); break; default: @@ -4444,16 +4688,15 @@ iwm_send_bt_init_conf(struct iwm_softc *sc) bt_cmd.mode = htole32(IWM_BT_COEX_WIFI); bt_cmd.enabled_modules = htole32(IWM_BT_COEX_HIGH_BAND_RET); - return iwm_mvm_send_cmd_pdu(sc, IWM_BT_CONFIG, 0, sizeof(bt_cmd), + return iwm_send_cmd_pdu(sc, IWM_BT_CONFIG, 0, sizeof(bt_cmd), &bt_cmd); } static boolean_t -iwm_mvm_is_lar_supported(struct iwm_softc *sc) +iwm_is_lar_supported(struct iwm_softc *sc) { boolean_t nvm_lar = sc->nvm_data->lar_enabled; - boolean_t tlv_lar = fw_has_capa(&sc->sc_fw.ucode_capa, - IWM_UCODE_TLV_CAPA_LAR_SUPPORT); + boolean_t tlv_lar = iwm_fw_has_capa(sc, IWM_UCODE_TLV_CAPA_LAR_SUPPORT); if (iwm_lar_disable) return FALSE; @@ -4462,19 +4705,17 @@ iwm_mvm_is_lar_supported(struct iwm_softc *sc) * Enable LAR only if it is supported by the FW (TLV) && * enabled in the NVM */ - if (sc->cfg->device_family == IWM_DEVICE_FAMILY_8000) + if (sc->cfg->device_family >= IWM_DEVICE_FAMILY_8000) return nvm_lar && tlv_lar; else return tlv_lar; } static boolean_t -iwm_mvm_is_wifi_mcc_supported(struct iwm_softc *sc) +iwm_is_wifi_mcc_supported(struct iwm_softc *sc) { - return fw_has_api(&sc->sc_fw.ucode_capa, - IWM_UCODE_TLV_API_WIFI_MCC_UPDATE) || - fw_has_capa(&sc->sc_fw.ucode_capa, - IWM_UCODE_TLV_CAPA_LAR_MULTI_MCC); + return iwm_fw_has_api(sc, IWM_UCODE_TLV_API_WIFI_MCC_UPDATE) || + iwm_fw_has_capa(sc, IWM_UCODE_TLV_CAPA_LAR_MULTI_MCC); } static int @@ -4494,10 +4735,9 @@ iwm_send_update_mcc_cmd(struct iwm_softc *sc, const char *alpha2) int n_channels; uint16_t mcc; #endif - int resp_v2 = fw_has_capa(&sc->sc_fw.ucode_capa, - IWM_UCODE_TLV_CAPA_LAR_SUPPORT_V2); + int resp_v2 = iwm_fw_has_capa(sc, IWM_UCODE_TLV_CAPA_LAR_SUPPORT_V2); - if (!iwm_mvm_is_lar_supported(sc)) { + if (!iwm_is_lar_supported(sc)) { IWM_DPRINTF(sc, IWM_DEBUG_LAR, "%s: no LAR support\n", __func__); return 0; @@ -4505,7 +4745,7 @@ iwm_send_update_mcc_cmd(struct iwm_softc *sc, const char *alpha2) memset(&mcc_cmd, 0, sizeof(mcc_cmd)); mcc_cmd.mcc = htole16(alpha2[0] << 8 | alpha2[1]); - if (iwm_mvm_is_wifi_mcc_supported(sc)) + if (iwm_is_wifi_mcc_supported(sc)) mcc_cmd.source_id = IWM_MCC_SOURCE_GET_CURRENT; else mcc_cmd.source_id = IWM_MCC_SOURCE_OLD_FW; @@ -4551,7 +4791,7 @@ iwm_send_update_mcc_cmd(struct iwm_softc *sc, const char *alpha2) } static void -iwm_mvm_tt_tx_backoff(struct iwm_softc *sc, uint32_t backoff) +iwm_tt_tx_backoff(struct iwm_softc *sc, uint32_t backoff) { struct iwm_host_cmd cmd = { .id = IWM_REPLY_THERMAL_MNG_BACKOFF, @@ -4578,8 +4818,8 @@ iwm_init_hw(struct iwm_softc *sc) return error; } - if ((error = iwm_run_init_mvm_ucode(sc, 0)) != 0) { - printf("iwm_run_init_mvm_ucode: failed %d\n", error); + if ((error = iwm_run_init_ucode(sc, 0)) != 0) { + printf("iwm_run_init_ucode: failed %d\n", error); return error; } @@ -4595,13 +4835,13 @@ iwm_init_hw(struct iwm_softc *sc) } /* omstart, this time with the regular firmware */ - error = iwm_mvm_load_ucode_wait_alive(sc, IWM_UCODE_REGULAR); + error = iwm_load_ucode_wait_alive(sc, IWM_UCODE_REGULAR); if (error) { device_printf(sc->sc_dev, "could not load firmware\n"); goto error; } - error = iwm_mvm_sf_update(sc, NULL, FALSE); + error = iwm_sf_update(sc, NULL, FALSE); if (error) device_printf(sc->sc_dev, "Failed to initialize Smart Fifo\n"); @@ -4610,7 +4850,7 @@ iwm_init_hw(struct iwm_softc *sc) goto error; } - error = iwm_send_tx_ant_cfg(sc, iwm_mvm_get_valid_tx_ant(sc)); + error = iwm_send_tx_ant_cfg(sc, iwm_get_valid_tx_ant(sc)); if (error != 0) { device_printf(sc->sc_dev, "antenna config failed\n"); goto error; @@ -4626,7 +4866,7 @@ iwm_init_hw(struct iwm_softc *sc) } /* Add auxiliary station for scanning */ - if ((error = iwm_mvm_add_aux_sta(sc)) != 0) { + if ((error = iwm_add_aux_sta(sc)) != 0) { device_printf(sc->sc_dev, "add_aux_sta failed\n"); goto error; } @@ -4637,39 +4877,39 @@ iwm_init_hw(struct iwm_softc *sc) * going to be overwritten in the other flows. * For now use the first channel we have. */ - if ((error = iwm_mvm_phy_ctxt_add(sc, + if ((error = iwm_phy_ctxt_add(sc, &sc->sc_phyctxt[i], &ic->ic_channels[1], 1, 1)) != 0) goto error; } /* Initialize tx backoffs to the minimum. */ if (sc->cfg->device_family == IWM_DEVICE_FAMILY_7000) - iwm_mvm_tt_tx_backoff(sc, 0); + iwm_tt_tx_backoff(sc, 0); - if (iwm_mvm_config_ltr(sc) != 0) + if (iwm_config_ltr(sc) != 0) device_printf(sc->sc_dev, "PCIe LTR configuration failed\n"); - error = iwm_mvm_power_update_device(sc); + error = iwm_power_update_device(sc); if (error) goto error; if ((error = iwm_send_update_mcc_cmd(sc, "ZZ")) != 0) goto error; - if (fw_has_capa(&sc->sc_fw.ucode_capa, IWM_UCODE_TLV_CAPA_UMAC_SCAN)) { - if ((error = iwm_mvm_config_umac_scan(sc)) != 0) + if (iwm_fw_has_capa(sc, IWM_UCODE_TLV_CAPA_UMAC_SCAN)) { + if ((error = iwm_config_umac_scan(sc)) != 0) goto error; } /* Enable Tx queues. */ for (ac = 0; ac < WME_NUM_AC; ac++) { error = iwm_enable_txq(sc, IWM_STATION_ID, ac, - iwm_mvm_ac_to_tx_fifo[ac]); + iwm_ac_to_tx_fifo[ac]); if (error) goto error; } - if ((error = iwm_mvm_disable_beacon_filter(sc)) != 0) { + if ((error = iwm_disable_beacon_filter(sc)) != 0) { device_printf(sc->sc_dev, "failed to disable beacon filter\n"); goto error; } @@ -4700,7 +4940,7 @@ iwm_allow_mcast(struct ieee80211vap *vap, struct iwm_softc *sc) cmd->pass_all = 1; IEEE80211_ADDR_COPY(cmd->bssid, ni->ni_bssid); - error = iwm_mvm_send_cmd_pdu(sc, IWM_MCAST_FILTER_CMD, + error = iwm_send_cmd_pdu(sc, IWM_MCAST_FILTER_CMD, IWM_CMD_SYNC, size, cmd); free(cmd, M_DEVBUF); @@ -5140,7 +5380,7 @@ iwm_handle_rxb(struct iwm_softc *sc, struct mbuf *m) switch (code) { case IWM_REPLY_RX_PHY_CMD: - iwm_mvm_rx_rx_phy_cmd(sc, pkt); + iwm_rx_rx_phy_cmd(sc, pkt); break; case IWM_REPLY_RX_MPDU_CMD: { @@ -5156,7 +5396,7 @@ iwm_handle_rxb(struct iwm_softc *sc, struct mbuf *m) nextpkt->hdr.idx == 0) || (nextpkt->len_n_flags == htole32(IWM_FH_RSCSR_FRAME_INVALID))) { - if (iwm_mvm_rx_rx_mpdu(sc, m, offset, stolen)) { + if (iwm_rx_mpdu(sc, m, offset, stolen)) { stolen = FALSE; /* Make sure we abort the loop */ nextoff = maxoff; @@ -5167,14 +5407,14 @@ iwm_handle_rxb(struct iwm_softc *sc, struct mbuf *m) /* * Use m_copym instead of m_split, because that * makes it easier to keep a valid rx buffer in - * the ring, when iwm_mvm_rx_rx_mpdu() fails. + * the ring, when iwm_rx_mpdu() fails. * * We need to start m_copym() at offset 0, to get the * M_PKTHDR flag preserved. */ m1 = m_copym(m, 0, M_COPYALL, M_NOWAIT); if (m1) { - if (iwm_mvm_rx_rx_mpdu(sc, m1, offset, stolen)) + if (iwm_rx_mpdu(sc, m1, offset, stolen)) stolen = TRUE; else m_freem(m1); @@ -5183,7 +5423,7 @@ iwm_handle_rxb(struct iwm_softc *sc, struct mbuf *m) } case IWM_TX_CMD: - iwm_mvm_rx_tx_cmd(sc, pkt); + iwm_rx_tx_cmd(sc, pkt); break; case IWM_MISSED_BEACONS_NOTIFICATION: { @@ -5228,14 +5468,14 @@ iwm_handle_rxb(struct iwm_softc *sc, struct mbuf *m) case IWM_MFUART_LOAD_NOTIFICATION: break; - case IWM_MVM_ALIVE: + case IWM_ALIVE: break; case IWM_CALIB_RES_NOTIF_PHY_DB: break; case IWM_STATISTICS_NOTIFICATION: - iwm_mvm_handle_rx_statistics(sc, pkt); + iwm_handle_rx_statistics(sc, pkt); break; case IWM_NVM_ACCESS_CMD: @@ -5316,7 +5556,7 @@ iwm_handle_rxb(struct iwm_softc *sc, struct mbuf *m) break; case IWM_SCAN_OFFLOAD_COMPLETE: - iwm_mvm_rx_lmac_scan_complete_notif(sc, pkt); + iwm_rx_lmac_scan_complete_notif(sc, pkt); if (sc->sc_flags & IWM_FLAG_SCAN_RUNNING) { sc->sc_flags &= ~IWM_FLAG_SCAN_RUNNING; ieee80211_runtask(ic, &sc->sc_es_task); @@ -5330,7 +5570,7 @@ iwm_handle_rxb(struct iwm_softc *sc, struct mbuf *m) } case IWM_SCAN_COMPLETE_UMAC: - iwm_mvm_rx_umac_scan_complete_notif(sc, pkt); + iwm_rx_umac_scan_complete_notif(sc, pkt); if (sc->sc_flags & IWM_FLAG_SCAN_RUNNING) { sc->sc_flags &= ~IWM_FLAG_SCAN_RUNNING; ieee80211_runtask(ic, &sc->sc_es_task); @@ -5359,7 +5599,7 @@ iwm_handle_rxb(struct iwm_softc *sc, struct mbuf *m) } case IWM_TIME_EVENT_NOTIFICATION: - iwm_mvm_rx_time_event_notif(sc, pkt); + iwm_rx_time_event_notif(sc, pkt); break; /* @@ -5386,9 +5626,8 @@ iwm_handle_rxb(struct iwm_softc *sc, struct mbuf *m) default: device_printf(sc->sc_dev, - "frame %d/%d %x UNHANDLED (this should " - "not happen)\n", qid & ~0x80, idx, - pkt->len_n_flags); + "code %x, frame %d/%d %x unhandled\n", + code, qid & ~0x80, idx, pkt->len_n_flags); break; } @@ -5423,11 +5662,21 @@ iwm_handle_rxb(struct iwm_softc *sc, struct mbuf *m) static void iwm_notif_intr(struct iwm_softc *sc) { + int count; + uint32_t wreg; uint16_t hw; bus_dmamap_sync(sc->rxq.stat_dma.tag, sc->rxq.stat_dma.map, BUS_DMASYNC_POSTREAD); + if (sc->cfg->mqrx_supported) { + count = IWM_RX_MQ_RING_COUNT; + wreg = IWM_RFH_Q0_FRBDCB_WIDX_TRG; + } else { + count = IWM_RX_LEGACY_RING_COUNT; + wreg = IWM_FH_RSCSR_CHNL0_WPTR; + } + hw = le16toh(sc->rxq.stat->closed_rb_num) & 0xfff; /* @@ -5444,7 +5693,7 @@ iwm_notif_intr(struct iwm_softc *sc) "%s: hw = %d cur = %d\n", __func__, hw, ring->cur); iwm_handle_rxb(sc, data->m); - ring->cur = (ring->cur + 1) % IWM_RX_RING_COUNT; + ring->cur = (ring->cur + 1) % count; } /* @@ -5453,8 +5702,8 @@ iwm_notif_intr(struct iwm_softc *sc) * Seems like the hardware gets upset unless we align * the write by 8?? */ - hw = (hw == 0) ? IWM_RX_RING_COUNT - 1 : hw - 1; - IWM_WRITE(sc, IWM_FH_RSCSR_CHNL0_WPTR, rounddown2(hw, 8)); + hw = (hw == 0) ? count - 1 : hw - 1; + IWM_WRITE(sc, wreg, rounddown2(hw, 8)); } static void @@ -5526,7 +5775,7 @@ iwm_intr(void *arg) #endif /* Dump driver status (TX and RX rings) while we're here. */ device_printf(sc->sc_dev, "driver status:\n"); - for (i = 0; i < IWM_MVM_MAX_QUEUES; i++) { + for (i = 0; i < IWM_MAX_QUEUES; i++) { struct iwm_tx_ring *ring = &sc->txq[i]; device_printf(sc->sc_dev, " tx ring %2d: qid=%-2d cur=%-3d " @@ -5634,6 +5883,9 @@ iwm_intr(void *arg) #define PCI_PRODUCT_INTEL_WL_8260_1 0x24f3 #define PCI_PRODUCT_INTEL_WL_8260_2 0x24f4 #define PCI_PRODUCT_INTEL_WL_8265_1 0x24fd +#define PCI_PRODUCT_INTEL_WL_9560_1 0x9df0 +#define PCI_PRODUCT_INTEL_WL_9560_2 0xa370 +#define PCI_PRODUCT_INTEL_WL_9260_1 0x2526 static const struct iwm_devices { uint16_t device; @@ -5651,6 +5903,9 @@ static const struct iwm_devices { { PCI_PRODUCT_INTEL_WL_8260_1, &iwm8260_cfg }, { PCI_PRODUCT_INTEL_WL_8260_2, &iwm8260_cfg }, { PCI_PRODUCT_INTEL_WL_8265_1, &iwm8265_cfg }, + { PCI_PRODUCT_INTEL_WL_9560_1, &iwm9560_cfg }, + { PCI_PRODUCT_INTEL_WL_9560_2, &iwm9560_cfg }, + { PCI_PRODUCT_INTEL_WL_9260_1, &iwm9260_cfg }, }; static int @@ -5762,8 +6017,6 @@ iwm_pci_detach(device_t dev) rman_get_rid(sc->sc_mem), sc->sc_mem); } - - static int iwm_attach(device_t dev) { @@ -5780,6 +6033,10 @@ iwm_attach(device_t dev) callout_init_mtx(&sc->sc_led_blink_to, &sc->sc_mtx, 0); TASK_INIT(&sc->sc_es_task, 0, iwm_endscan_cb, sc); + error = iwm_dev_check(dev); + if (error != 0) + goto fail; + sc->sc_notif_wait = iwm_notification_wait_init(sc); if (sc->sc_notif_wait == NULL) { device_printf(dev, "failed to init notification wait struct\n"); @@ -5805,11 +6062,6 @@ iwm_attach(device_t dev) sc->sc_wantresp = -1; - /* Match device id */ - error = iwm_dev_check(dev); - if (error != 0) - goto fail; - sc->sc_hw_rev = IWM_READ(sc, IWM_CSR_HW_REV); /* * In the 8000 HW family the format of the 4 bytes of CSR_HW_REV have @@ -5817,7 +6069,7 @@ iwm_attach(device_t dev) * "dash" value). To keep hw_rev backwards compatible - we'll store it * in the old format. */ - if (sc->cfg->device_family == IWM_DEVICE_FAMILY_8000) { + if (sc->cfg->device_family >= IWM_DEVICE_FAMILY_8000) { int ret; uint32_t hw_step; @@ -6026,7 +6278,7 @@ iwm_wme_update(struct ieee80211com *ic) if (ivp->is_uploaded && vap->iv_bss != NULL) { in = IWM_NODE(vap->iv_bss); if (in->in_assoc) { - if ((error = iwm_mvm_mac_ctxt_changed(sc, vap)) != 0) { + if ((error = iwm_mac_ctxt_changed(sc, vap)) != 0) { device_printf(sc->sc_dev, "%s: failed to update MAC\n", __func__); } @@ -6056,7 +6308,7 @@ iwm_preinit(void *arg) goto fail; } - error = iwm_run_init_mvm_ucode(sc, 1); + error = iwm_run_init_ucode(sc, 1); iwm_stop_device(sc); if (error) { IWM_UNLOCK(sc); @@ -6200,10 +6452,10 @@ iwm_scan_start(struct ieee80211com *ic) device_printf(sc->sc_dev, "%s: Previous scan not completed yet\n", __func__); } - if (fw_has_capa(&sc->sc_fw.ucode_capa, IWM_UCODE_TLV_CAPA_UMAC_SCAN)) - error = iwm_mvm_umac_scan(sc); + if (iwm_fw_has_capa(sc, IWM_UCODE_TLV_CAPA_UMAC_SCAN)) + error = iwm_umac_scan(sc); else - error = iwm_mvm_lmac_scan(sc); + error = iwm_lmac_scan(sc); if (error != 0) { device_printf(sc->sc_dev, "could not initiate scan\n"); IWM_UNLOCK(sc); @@ -6224,7 +6476,7 @@ iwm_scan_end(struct ieee80211com *ic) IWM_LOCK(sc); iwm_led_blink_stop(sc); if (vap->iv_state == IEEE80211_S_RUN) - iwm_mvm_led_enable(sc); + iwm_led_enable(sc); if (sc->sc_flags & IWM_FLAG_SCAN_RUNNING) { /* * Removing IWM_FLAG_SCAN_RUNNING now, is fine because @@ -6232,7 +6484,7 @@ iwm_scan_end(struct ieee80211com *ic) * taskqueue. */ sc->sc_flags &= ~IWM_FLAG_SCAN_RUNNING; - iwm_mvm_scan_stop_wait(sc); + iwm_scan_stop_wait(sc); } IWM_UNLOCK(sc); @@ -6262,7 +6514,6 @@ iwm_scan_curchan(struct ieee80211_scan_state *ss, unsigned long maxdwell) static void iwm_scan_mindwell(struct ieee80211_scan_state *ss) { - return; } void @@ -6345,12 +6596,9 @@ iwm_detach_local(struct iwm_softc *sc, int do_net80211) if (!sc->sc_attached) return 0; sc->sc_attached = 0; - - if (do_net80211) + if (do_net80211) { ieee80211_draintask(&sc->sc_ic, &sc->sc_es_task); - - callout_drain(&sc->sc_led_blink_to); - callout_drain(&sc->sc_watchdog_to); + } iwm_stop_device(sc); if (do_net80211) { IWM_LOCK(sc); @@ -6358,6 +6606,8 @@ iwm_detach_local(struct iwm_softc *sc, int do_net80211) IWM_UNLOCK(sc); ieee80211_ifdetach(&sc->sc_ic); } + callout_drain(&sc->sc_led_blink_to); + callout_drain(&sc->sc_watchdog_to); iwm_phy_db_free(sc->sc_phy_db); sc->sc_phy_db = NULL; diff --git a/src/add-ons/kernel/drivers/network/wlan/idualwifi7260/dev/iwm/if_iwm_7000.c b/src/add-ons/kernel/drivers/network/wlan/idualwifi7260/dev/iwm/if_iwm_7000.c index b70809ba06..3da0cac2b4 100644 --- a/src/add-ons/kernel/drivers/network/wlan/idualwifi7260/dev/iwm/if_iwm_7000.c +++ b/src/add-ons/kernel/drivers/network/wlan/idualwifi7260/dev/iwm/if_iwm_7000.c @@ -70,7 +70,7 @@ *****************************************************************************/ #include -__FBSDID("$FreeBSD: releng/12.0/sys/dev/iwm/if_iwm_7000.c 331665 2018-03-28 07:59:16Z eadler $"); +__FBSDID("$FreeBSD$"); #include "opt_wlan.h" #include "opt_iwm.h" @@ -119,6 +119,7 @@ const struct iwm_cfg iwm3168_cfg = { .fw_name = IWM3168_FW, IWM_DEVICE_7000_COMMON, .host_interrupt_operation_mode = 0, + .nvm_type = IWM_NVM_SDP, }; const struct iwm_cfg iwm7265_cfg = { diff --git a/src/add-ons/kernel/drivers/network/wlan/idualwifi7260/dev/iwm/if_iwm_8000.c b/src/add-ons/kernel/drivers/network/wlan/idualwifi7260/dev/iwm/if_iwm_8000.c index b648770fd6..59df625288 100644 --- a/src/add-ons/kernel/drivers/network/wlan/idualwifi7260/dev/iwm/if_iwm_8000.c +++ b/src/add-ons/kernel/drivers/network/wlan/idualwifi7260/dev/iwm/if_iwm_8000.c @@ -69,7 +69,7 @@ *****************************************************************************/ #include -__FBSDID("$FreeBSD: releng/12.0/sys/dev/iwm/if_iwm_8000.c 324434 2017-10-09 15:48:56Z gnn $"); +__FBSDID("$FreeBSD$"); #include "opt_wlan.h" #include "opt_iwm.h" diff --git a/src/add-ons/kernel/drivers/network/wlan/idualwifi7260/dev/iwm/if_iwm_9000.c b/src/add-ons/kernel/drivers/network/wlan/idualwifi7260/dev/iwm/if_iwm_9000.c new file mode 100644 index 0000000000..fe7898c5b4 --- /dev/null +++ b/src/add-ons/kernel/drivers/network/wlan/idualwifi7260/dev/iwm/if_iwm_9000.c @@ -0,0 +1,97 @@ +/*- + * Based on BSD-licensed source modules in the Linux iwlwifi driver, + * which were used as the reference documentation for this implementation. + * + ****************************************************************************** + * + * This file is provided under a dual BSD/GPLv2 license. When using or + * redistributing this file, you may do so under either license. + * + * GPL LICENSE SUMMARY + * + * Copyright(c) 2014 Intel Corporation. All rights reserved. + * Copyright(c) 2014 - 2015 Intel Mobile Communications GmbH + * Copyright(c) 2016 Intel Deutschland GmbH + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of version 2 of the GNU General Public License as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, + * USA + * + * The full GNU General Public License is included in this distribution + * in the file called COPYING. + * + * Contact Information: + * Intel Linux Wireless + * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 + * + * BSD LICENSE + * + * Copyright(c) 2014 Intel Corporation. All rights reserved. + * Copyright(c) 2014 - 2015 Intel Mobile Communications GmbH + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + *****************************************************************************/ + +#include +__FBSDID("$FreeBSD$"); + +#include "opt_wlan.h" +#include "opt_iwm.h" + +#include + +#include "if_iwm_config.h" + +#define IWM9000_FW "iwm9000fw" + +#define IWM_NVM_HW_SECTION_NUM_FAMILY_9000 10 + +#define IWM_DEVICE_9000_COMMON \ + .device_family = IWM_DEVICE_FAMILY_9000, \ + .eeprom_size = IWM_OTP_LOW_IMAGE_SIZE_FAMILY_9000, \ + .nvm_hw_section_num = IWM_NVM_HW_SECTION_NUM_FAMILY_9000 + +const struct iwm_cfg iwm9560_cfg = { + .name = "Intel(R) Dual Band Wireless AC 9560", + .fw_name = IWM9000_FW, + IWM_DEVICE_9000_COMMON, + .host_interrupt_operation_mode = 0, + .mqrx_supported = 1, + .integrated = 1, +}; diff --git a/src/add-ons/kernel/drivers/network/wlan/idualwifi7260/dev/iwm/if_iwm_9260.c b/src/add-ons/kernel/drivers/network/wlan/idualwifi7260/dev/iwm/if_iwm_9260.c new file mode 100644 index 0000000000..a92ba9ebbe --- /dev/null +++ b/src/add-ons/kernel/drivers/network/wlan/idualwifi7260/dev/iwm/if_iwm_9260.c @@ -0,0 +1,96 @@ +/*- + * Based on BSD-licensed source modules in the Linux iwlwifi driver, + * which were used as the reference documentation for this implementation. + * + ****************************************************************************** + * + * This file is provided under a dual BSD/GPLv2 license. When using or + * redistributing this file, you may do so under either license. + * + * GPL LICENSE SUMMARY + * + * Copyright(c) 2014 Intel Corporation. All rights reserved. + * Copyright(c) 2014 - 2015 Intel Mobile Communications GmbH + * Copyright(c) 2016 Intel Deutschland GmbH + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of version 2 of the GNU General Public License as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, + * USA + * + * The full GNU General Public License is included in this distribution + * in the file called COPYING. + * + * Contact Information: + * Intel Linux Wireless + * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 + * + * BSD LICENSE + * + * Copyright(c) 2014 Intel Corporation. All rights reserved. + * Copyright(c) 2014 - 2015 Intel Mobile Communications GmbH + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + *****************************************************************************/ + +#include +__FBSDID("$FreeBSD$"); + +#include "opt_wlan.h" +#include "opt_iwm.h" + +#include + +#include "if_iwm_config.h" + +#define IWM9260_FW "iwm9260fw" + +#define IWM_NVM_HW_SECTION_NUM_FAMILY_9260 10 + +#define IWM_DEVICE_9260_COMMON \ + .device_family = IWM_DEVICE_FAMILY_9000, \ + .eeprom_size = IWM_OTP_LOW_IMAGE_SIZE_FAMILY_9000, \ + .nvm_hw_section_num = IWM_NVM_HW_SECTION_NUM_FAMILY_9260 + +const struct iwm_cfg iwm9260_cfg = { + .name = "Intel(R) Dual Band Wireless AC 9260", + .fw_name = IWM9260_FW, + IWM_DEVICE_9260_COMMON, + .host_interrupt_operation_mode = 0, + .mqrx_supported = 1, +}; diff --git a/src/add-ons/kernel/drivers/network/wlan/idualwifi7260/dev/iwm/if_iwm_binding.c b/src/add-ons/kernel/drivers/network/wlan/idualwifi7260/dev/iwm/if_iwm_binding.c index 48ad9d1196..28207c998d 100644 --- a/src/add-ons/kernel/drivers/network/wlan/idualwifi7260/dev/iwm/if_iwm_binding.c +++ b/src/add-ons/kernel/drivers/network/wlan/idualwifi7260/dev/iwm/if_iwm_binding.c @@ -87,7 +87,7 @@ */ #include -__FBSDID("$FreeBSD: releng/12.0/sys/dev/iwm/if_iwm_binding.c 319577 2017-06-04 21:05:58Z adrian $"); +__FBSDID("$FreeBSD$"); #include "opt_wlan.h" #include "opt_iwm.h" @@ -146,21 +146,21 @@ __FBSDID("$FreeBSD: releng/12.0/sys/dev/iwm/if_iwm_binding.c 319577 2017-06-04 2 * BEGIN iwlwifi/mvm/binding.c */ -struct iwm_mvm_iface_iterator_data { +struct iwm_iface_iterator_data { int idx; - struct iwm_mvm_phy_ctxt *phyctxt; + struct iwm_phy_ctxt *phyctxt; uint16_t ids[IWM_MAX_MACS_IN_BINDING]; int16_t colors[IWM_MAX_MACS_IN_BINDING]; }; static int -iwm_mvm_binding_cmd(struct iwm_softc *sc, uint32_t action, - struct iwm_mvm_iface_iterator_data *data) +iwm_binding_cmd(struct iwm_softc *sc, uint32_t action, + struct iwm_iface_iterator_data *data) { struct iwm_binding_cmd cmd; - struct iwm_mvm_phy_ctxt *phyctxt = data->phyctxt; + struct iwm_phy_ctxt *phyctxt = data->phyctxt; int i, ret; uint32_t status; @@ -178,7 +178,7 @@ iwm_mvm_binding_cmd(struct iwm_softc *sc, uint32_t action, data->colors[i])); status = 0; - ret = iwm_mvm_send_cmd_pdu_status(sc, IWM_BINDING_CONTEXT_CMD, + ret = iwm_send_cmd_pdu_status(sc, IWM_BINDING_CONTEXT_CMD, sizeof(cmd), &cmd, &status); if (ret) { device_printf(sc->sc_dev, @@ -196,10 +196,10 @@ iwm_mvm_binding_cmd(struct iwm_softc *sc, uint32_t action, } static int -iwm_mvm_binding_update(struct iwm_softc *sc, struct iwm_vap *ivp, - struct iwm_mvm_phy_ctxt *phyctxt, boolean_t add) +iwm_binding_update(struct iwm_softc *sc, struct iwm_vap *ivp, + struct iwm_phy_ctxt *phyctxt, boolean_t add) { - struct iwm_mvm_iface_iterator_data data = { + struct iwm_iface_iterator_data data = { .phyctxt = phyctxt, }; uint32_t action; @@ -215,11 +215,11 @@ iwm_mvm_binding_update(struct iwm_softc *sc, struct iwm_vap *ivp, data.idx++; } - return iwm_mvm_binding_cmd(sc, action, &data); + return iwm_binding_cmd(sc, action, &data); } int -iwm_mvm_binding_add_vif(struct iwm_softc *sc, struct iwm_vap *ivp) +iwm_binding_add_vif(struct iwm_softc *sc, struct iwm_vap *ivp) { if (!ivp->phy_ctxt) return EINVAL; @@ -228,24 +228,24 @@ iwm_mvm_binding_add_vif(struct iwm_softc *sc, struct iwm_vap *ivp) * Update SF - Disable if needed. if this fails, SF might still be on * while many macs are bound, which is forbidden - so fail the binding. */ - if (iwm_mvm_sf_update(sc, &ivp->iv_vap, FALSE)) + if (iwm_sf_update(sc, &ivp->iv_vap, FALSE)) return EINVAL; - return iwm_mvm_binding_update(sc, ivp, ivp->phy_ctxt, TRUE); + return iwm_binding_update(sc, ivp, ivp->phy_ctxt, TRUE); } int -iwm_mvm_binding_remove_vif(struct iwm_softc *sc, struct iwm_vap *ivp) +iwm_binding_remove_vif(struct iwm_softc *sc, struct iwm_vap *ivp) { int ret; if (!ivp->phy_ctxt) return EINVAL; - ret = iwm_mvm_binding_update(sc, ivp, ivp->phy_ctxt, FALSE); + ret = iwm_binding_update(sc, ivp, ivp->phy_ctxt, FALSE); if (!ret) { - if (iwm_mvm_sf_update(sc, &ivp->iv_vap, TRUE)) + if (iwm_sf_update(sc, &ivp->iv_vap, TRUE)) device_printf(sc->sc_dev, "Failed to update SF state\n"); } diff --git a/src/add-ons/kernel/drivers/network/wlan/idualwifi7260/dev/iwm/if_iwm_binding.h b/src/add-ons/kernel/drivers/network/wlan/idualwifi7260/dev/iwm/if_iwm_binding.h index 41514238c8..c3e20ed53d 100644 --- a/src/add-ons/kernel/drivers/network/wlan/idualwifi7260/dev/iwm/if_iwm_binding.h +++ b/src/add-ons/kernel/drivers/network/wlan/idualwifi7260/dev/iwm/if_iwm_binding.h @@ -1,5 +1,5 @@ /* $OpenBSD: if_iwm.c,v 1.39 2015/03/23 00:35:19 jsg Exp $ */ -/* $FreeBSD: releng/12.0/sys/dev/iwm/if_iwm_binding.h 318212 2017-05-12 05:19:08Z adrian $ */ +/* $FreeBSD$ */ /* * Copyright (c) 2014 genua mbh * Copyright (c) 2014 Fixup Software Ltd. @@ -105,7 +105,7 @@ #ifndef __IF_IWM_BINDING_H__ #define __IF_IWM_BINDING_H__ -extern int iwm_mvm_binding_add_vif(struct iwm_softc *sc, struct iwm_vap *ivp); -extern int iwm_mvm_binding_remove_vif(struct iwm_softc *sc, struct iwm_vap *ivp); +extern int iwm_binding_add_vif(struct iwm_softc *sc, struct iwm_vap *ivp); +extern int iwm_binding_remove_vif(struct iwm_softc *sc, struct iwm_vap *ivp); #endif /* __IF_IWM_BINDING_H__ */ diff --git a/src/add-ons/kernel/drivers/network/wlan/idualwifi7260/dev/iwm/if_iwm_config.h b/src/add-ons/kernel/drivers/network/wlan/idualwifi7260/dev/iwm/if_iwm_config.h index de537760e5..fabcfaa751 100644 --- a/src/add-ons/kernel/drivers/network/wlan/idualwifi7260/dev/iwm/if_iwm_config.h +++ b/src/add-ons/kernel/drivers/network/wlan/idualwifi7260/dev/iwm/if_iwm_config.h @@ -68,7 +68,7 @@ *****************************************************************************/ /* - * $FreeBSD: releng/12.0/sys/dev/iwm/if_iwm_config.h 331665 2018-03-28 07:59:16Z eadler $ + * $FreeBSD$ */ #ifndef __IWM_CONFIG_H__ @@ -78,6 +78,7 @@ enum iwm_device_family { IWM_DEVICE_FAMILY_UNDEFINED, IWM_DEVICE_FAMILY_7000, IWM_DEVICE_FAMILY_8000, + IWM_DEVICE_FAMILY_9000, }; #define IWM_DEFAULT_MAX_TX_POWER 22 @@ -104,6 +105,19 @@ static inline uint8_t num_of_ant(uint8_t mask) #define IWM_OTP_LOW_IMAGE_SIZE_FAMILY_8000 (32 * 512 * sizeof(uint16_t)) /* 32 KB */ #define IWM_OTP_LOW_IMAGE_SIZE_FAMILY_9000 IWM_OTP_LOW_IMAGE_SIZE_FAMILY_8000 + +/** + * enum iwl_nvm_type - nvm formats + * @IWM_NVM: the regular format + * @IWM_NVM_EXT: extended NVM format + * @IWM_NVM_SDP: NVM format used by 3168 series + */ +enum iwm_nvm_type { + IWM_NVM, + IWM_NVM_EXT, + IWM_NVM_SDP, +}; + /** * struct iwm_cfg * @name: Official name of the device @@ -113,15 +127,19 @@ static inline uint8_t num_of_ant(uint8_t mask) * @nvm_hw_section_num: the ID of the HW NVM section * @apmg_wake_up_wa: should the MAC access REQ be asserted when a command * is in flight. This is due to a HW bug in 7260, 3160 and 7265. + * @nvm_type: see &enum iwl_nvm_type */ struct iwm_cfg { const char *name; - const char *fw_name; - uint16_t eeprom_size; - enum iwm_device_family device_family; - int host_interrupt_operation_mode; - uint8_t nvm_hw_section_num; - int apmg_wake_up_wa; + const char *fw_name; + uint16_t eeprom_size; + enum iwm_device_family device_family; + int host_interrupt_operation_mode; + int mqrx_supported; + int integrated; + uint8_t nvm_hw_section_num; + int apmg_wake_up_wa; + enum iwm_nvm_type nvm_type; }; /* @@ -135,5 +153,7 @@ extern const struct iwm_cfg iwm7265_cfg; extern const struct iwm_cfg iwm7265d_cfg; extern const struct iwm_cfg iwm8260_cfg; extern const struct iwm_cfg iwm8265_cfg; +extern const struct iwm_cfg iwm9560_cfg; +extern const struct iwm_cfg iwm9260_cfg; #endif /* __IWM_CONFIG_H__ */ diff --git a/src/add-ons/kernel/drivers/network/wlan/idualwifi7260/dev/iwm/if_iwm_constants.h b/src/add-ons/kernel/drivers/network/wlan/idualwifi7260/dev/iwm/if_iwm_constants.h index acb6323e91..b686fc58fd 100644 --- a/src/add-ons/kernel/drivers/network/wlan/idualwifi7260/dev/iwm/if_iwm_constants.h +++ b/src/add-ons/kernel/drivers/network/wlan/idualwifi7260/dev/iwm/if_iwm_constants.h @@ -69,86 +69,86 @@ * *****************************************************************************/ -/* $FreeBSD: releng/12.0/sys/dev/iwm/if_iwm_constants.h 318005 2017-05-09 04:15:07Z adrian $ */ +/* $FreeBSD$ */ #ifndef __IF_IWM_CONSTANTS_H #define __IF_IWM_CONSTANTS_H /* */ -#define IWM_MVM_DEFAULT_PS_TX_DATA_TIMEOUT (100 * 1000) -#define IWM_MVM_DEFAULT_PS_RX_DATA_TIMEOUT (100 * 1000) -#define IWM_MVM_WOWLAN_PS_TX_DATA_TIMEOUT (10 * 1000) -#define IWM_MVM_WOWLAN_PS_RX_DATA_TIMEOUT (10 * 1000) -#define IWM_MVM_SHORT_PS_TX_DATA_TIMEOUT (2 * 1024) /* defined in TU */ -#define IWM_MVM_SHORT_PS_RX_DATA_TIMEOUT (40 * 1024) /* defined in TU */ -#define IWM_MVM_P2P_LOWLATENCY_PS_ENABLE 0 -#define IWM_MVM_UAPSD_RX_DATA_TIMEOUT (50 * 1000) -#define IWM_MVM_UAPSD_TX_DATA_TIMEOUT (50 * 1000) +#define IWM_DEFAULT_PS_TX_DATA_TIMEOUT (100 * 1000) +#define IWM_DEFAULT_PS_RX_DATA_TIMEOUT (100 * 1000) +#define IWM_WOWLAN_PS_TX_DATA_TIMEOUT (10 * 1000) +#define IWM_WOWLAN_PS_RX_DATA_TIMEOUT (10 * 1000) +#define IWM_SHORT_PS_TX_DATA_TIMEOUT (2 * 1024) /* defined in TU */ +#define IWM_SHORT_PS_RX_DATA_TIMEOUT (40 * 1024) /* defined in TU */ +#define IWM_P2P_LOWLATENCY_PS_ENABLE 0 +#define IWM_UAPSD_RX_DATA_TIMEOUT (50 * 1000) +#define IWM_UAPSD_TX_DATA_TIMEOUT (50 * 1000) #ifdef notyet /* XXX Find corresponding values from net80211 */ -#define IWM_MVM_UAPSD_QUEUES (IEEE80211_WMM_IE_STA_QOSINFO_AC_VO |\ +#define IWM_UAPSD_QUEUES (IEEE80211_WMM_IE_STA_QOSINFO_AC_VO |\ IEEE80211_WMM_IE_STA_QOSINFO_AC_VI |\ IEEE80211_WMM_IE_STA_QOSINFO_AC_BK |\ IEEE80211_WMM_IE_STA_QOSINFO_AC_BE) #endif -#define IWM_MVM_PS_HEAVY_TX_THLD_PACKETS 20 -#define IWM_MVM_PS_HEAVY_RX_THLD_PACKETS 8 -#define IWM_MVM_PS_SNOOZE_HEAVY_TX_THLD_PACKETS 30 -#define IWM_MVM_PS_SNOOZE_HEAVY_RX_THLD_PACKETS 20 -#define IWM_MVM_PS_HEAVY_TX_THLD_PERCENT 50 -#define IWM_MVM_PS_HEAVY_RX_THLD_PERCENT 50 -#define IWM_MVM_PS_SNOOZE_INTERVAL 25 -#define IWM_MVM_PS_SNOOZE_WINDOW 50 -#define IWM_MVM_WOWLAN_PS_SNOOZE_WINDOW 25 -#define IWM_MVM_LOWLAT_QUOTA_MIN_PERCENT 64 -#define IWM_MVM_BT_COEX_EN_RED_TXP_THRESH 62 -#define IWM_MVM_BT_COEX_DIS_RED_TXP_THRESH 65 -#define IWM_MVM_BT_COEX_SYNC2SCO 1 -#define IWM_MVM_BT_COEX_CORUNNING 0 -#define IWM_MVM_BT_COEX_MPLUT 1 -#define IWM_MVM_BT_COEX_RRC 1 -#define IWM_MVM_BT_COEX_TTC 1 -#define IWM_MVM_BT_COEX_MPLUT_REG0 0x22002200 -#define IWM_MVM_BT_COEX_MPLUT_REG1 0x11118451 -#define IWM_MVM_BT_COEX_ANTENNA_COUPLING_THRS 30 -#define IWM_MVM_FW_MCAST_FILTER_PASS_ALL 0 -#define IWM_MVM_FW_BCAST_FILTER_PASS_ALL 0 -#define IWM_MVM_QUOTA_THRESHOLD 4 -#define IWM_MVM_RS_RSSI_BASED_INIT_RATE 0 -#define IWM_MVM_RS_80_20_FAR_RANGE_TWEAK 1 -#define IWM_MVM_TOF_IS_RESPONDER 0 -#define IWM_MVM_SW_TX_CSUM_OFFLOAD 0 -#define IWM_MVM_HW_CSUM_DISABLE 0 -#define IWM_MVM_COLLECT_FW_ERR_DUMP 1 -#define IWM_MVM_RS_NUM_TRY_BEFORE_ANT_TOGGLE 1 -#define IWM_MVM_RS_HT_VHT_RETRIES_PER_RATE 2 -#define IWM_MVM_RS_HT_VHT_RETRIES_PER_RATE_TW 1 -#define IWM_MVM_RS_INITIAL_MIMO_NUM_RATES 3 -#define IWM_MVM_RS_INITIAL_SISO_NUM_RATES 3 -#define IWM_MVM_RS_INITIAL_LEGACY_NUM_RATES 2 -#define IWM_MVM_RS_INITIAL_LEGACY_RETRIES 2 -#define IWM_MVM_RS_SECONDARY_LEGACY_RETRIES 1 -#define IWM_MVM_RS_SECONDARY_LEGACY_NUM_RATES 16 -#define IWM_MVM_RS_SECONDARY_SISO_NUM_RATES 3 -#define IWM_MVM_RS_SECONDARY_SISO_RETRIES 1 -#define IWM_MVM_RS_RATE_MIN_FAILURE_TH 3 -#define IWM_MVM_RS_RATE_MIN_SUCCESS_TH 8 -#define IWM_MVM_RS_STAY_IN_COLUMN_TIMEOUT 5 /* Seconds */ -#define IWM_MVM_RS_IDLE_TIMEOUT 5 /* Seconds */ -#define IWM_MVM_RS_MISSED_RATE_MAX 15 -#define IWM_MVM_RS_LEGACY_FAILURE_LIMIT 160 -#define IWM_MVM_RS_LEGACY_SUCCESS_LIMIT 480 -#define IWM_MVM_RS_LEGACY_TABLE_COUNT 160 -#define IWM_MVM_RS_NON_LEGACY_FAILURE_LIMIT 400 -#define IWM_MVM_RS_NON_LEGACY_SUCCESS_LIMIT 4500 -#define IWM_MVM_RS_NON_LEGACY_TABLE_COUNT 1500 -#define IWM_MVM_RS_SR_FORCE_DECREASE 15 /* percent */ -#define IWM_MVM_RS_SR_NO_DECREASE 85 /* percent */ -#define IWM_MVM_RS_AGG_TIME_LIMIT 4000 /* 4 msecs. valid 100-8000 */ -#define IWM_MVM_RS_AGG_DISABLE_START 3 -#define IWM_MVM_RS_TPC_SR_FORCE_INCREASE 75 /* percent */ -#define IWM_MVM_RS_TPC_SR_NO_INCREASE 85 /* percent */ -#define IWM_MVM_RS_TPC_TX_POWER_STEP 3 +#define IWM_PS_HEAVY_TX_THLD_PACKETS 20 +#define IWM_PS_HEAVY_RX_THLD_PACKETS 8 +#define IWM_PS_SNOOZE_HEAVY_TX_THLD_PACKETS 30 +#define IWM_PS_SNOOZE_HEAVY_RX_THLD_PACKETS 20 +#define IWM_PS_HEAVY_TX_THLD_PERCENT 50 +#define IWM_PS_HEAVY_RX_THLD_PERCENT 50 +#define IWM_PS_SNOOZE_INTERVAL 25 +#define IWM_PS_SNOOZE_WINDOW 50 +#define IWM_WOWLAN_PS_SNOOZE_WINDOW 25 +#define IWM_LOWLAT_QUOTA_MIN_PERCENT 64 +#define IWM_BT_COEX_EN_RED_TXP_THRESH 62 +#define IWM_BT_COEX_DIS_RED_TXP_THRESH 65 +#define IWM_BT_COEX_SYNC2SCO 1 +#define IWM_BT_COEX_CORUNNING 0 +#define IWM_BT_COEX_MPLUT 1 +#define IWM_BT_COEX_RRC 1 +#define IWM_BT_COEX_TTC 1 +#define IWM_BT_COEX_MPLUT_REG0 0x22002200 +#define IWM_BT_COEX_MPLUT_REG1 0x11118451 +#define IWM_BT_COEX_ANTENNA_COUPLING_THRS 30 +#define IWM_FW_MCAST_FILTER_PASS_ALL 0 +#define IWM_FW_BCAST_FILTER_PASS_ALL 0 +#define IWM_QUOTA_THRESHOLD 4 +#define IWM_RS_RSSI_BASED_INIT_RATE 0 +#define IWM_RS_80_20_FAR_RANGE_TWEAK 1 +#define IWM_TOF_IS_RESPONDER 0 +#define IWM_SW_TX_CSUM_OFFLOAD 0 +#define IWM_HW_CSUM_DISABLE 0 +#define IWM_COLLECT_FW_ERR_DUMP 1 +#define IWM_RS_NUM_TRY_BEFORE_ANT_TOGGLE 1 +#define IWM_RS_HT_VHT_RETRIES_PER_RATE 2 +#define IWM_RS_HT_VHT_RETRIES_PER_RATE_TW 1 +#define IWM_RS_INITIAL_MIMO_NUM_RATES 3 +#define IWM_RS_INITIAL_SISO_NUM_RATES 3 +#define IWM_RS_INITIAL_LEGACY_NUM_RATES 2 +#define IWM_RS_INITIAL_LEGACY_RETRIES 2 +#define IWM_RS_SECONDARY_LEGACY_RETRIES 1 +#define IWM_RS_SECONDARY_LEGACY_NUM_RATES 16 +#define IWM_RS_SECONDARY_SISO_NUM_RATES 3 +#define IWM_RS_SECONDARY_SISO_RETRIES 1 +#define IWM_RS_RATE_MIN_FAILURE_TH 3 +#define IWM_RS_RATE_MIN_SUCCESS_TH 8 +#define IWM_RS_STAY_IN_COLUMN_TIMEOUT 5 /* Seconds */ +#define IWM_RS_IDLE_TIMEOUT 5 /* Seconds */ +#define IWM_RS_MISSED_RATE_MAX 15 +#define IWM_RS_LEGACY_FAILURE_LIMIT 160 +#define IWM_RS_LEGACY_SUCCESS_LIMIT 480 +#define IWM_RS_LEGACY_TABLE_COUNT 160 +#define IWM_RS_NON_LEGACY_FAILURE_LIMIT 400 +#define IWM_RS_NON_LEGACY_SUCCESS_LIMIT 4500 +#define IWM_RS_NON_LEGACY_TABLE_COUNT 1500 +#define IWM_RS_SR_FORCE_DECREASE 15 /* percent */ +#define IWM_RS_SR_NO_DECREASE 85 /* percent */ +#define IWM_RS_AGG_TIME_LIMIT 4000 /* 4 msecs. valid 100-8000 */ +#define IWM_RS_AGG_DISABLE_START 3 +#define IWM_RS_TPC_SR_FORCE_INCREASE 75 /* percent */ +#define IWM_RS_TPC_SR_NO_INCREASE 85 /* percent */ +#define IWM_RS_TPC_TX_POWER_STEP 3 #endif /* __IF_IWM_CONSTANTS_H */ diff --git a/src/add-ons/kernel/drivers/network/wlan/idualwifi7260/dev/iwm/if_iwm_debug.h b/src/add-ons/kernel/drivers/network/wlan/idualwifi7260/dev/iwm/if_iwm_debug.h index 7bda743d0b..35d624436e 100644 --- a/src/add-ons/kernel/drivers/network/wlan/idualwifi7260/dev/iwm/if_iwm_debug.h +++ b/src/add-ons/kernel/drivers/network/wlan/idualwifi7260/dev/iwm/if_iwm_debug.h @@ -13,7 +13,7 @@ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * - * $FreeBSD: releng/12.0/sys/dev/iwm/if_iwm_debug.h 319578 2017-06-04 21:10:14Z adrian $ + * $FreeBSD$ */ #ifndef __IF_IWM_DEBUG_H__ diff --git a/src/add-ons/kernel/drivers/network/wlan/idualwifi7260/dev/iwm/if_iwm_fw.c b/src/add-ons/kernel/drivers/network/wlan/idualwifi7260/dev/iwm/if_iwm_fw.c index 3a691bf200..9383fe9dab 100644 --- a/src/add-ons/kernel/drivers/network/wlan/idualwifi7260/dev/iwm/if_iwm_fw.c +++ b/src/add-ons/kernel/drivers/network/wlan/idualwifi7260/dev/iwm/if_iwm_fw.c @@ -71,7 +71,7 @@ */ #include -__FBSDID("$FreeBSD: releng/12.0/sys/dev/iwm/if_iwm_fw.c 318001 2017-05-09 02:38:23Z adrian $"); +__FBSDID("$FreeBSD$"); #include "opt_wlan.h" #include "opt_iwm.h" @@ -336,7 +336,7 @@ iwm_send_paging_cmd(struct iwm_softc *sc, const struct iwm_fw_img *fw) BUS_DMASYNC_PREWRITE | BUS_DMASYNC_PREREAD); } - return iwm_mvm_send_cmd_pdu(sc, iwm_cmd_id(IWM_FW_PAGING_BLOCK_CMD, + return iwm_send_cmd_pdu(sc, iwm_cmd_id(IWM_FW_PAGING_BLOCK_CMD, IWM_ALWAYS_LONG_GROUP, 0), 0, sizeof(fw_paging_cmd), &fw_paging_cmd); } diff --git a/src/add-ons/kernel/drivers/network/wlan/idualwifi7260/dev/iwm/if_iwm_fw.h b/src/add-ons/kernel/drivers/network/wlan/idualwifi7260/dev/iwm/if_iwm_fw.h index 20c27db2f8..66b3d840a5 100644 --- a/src/add-ons/kernel/drivers/network/wlan/idualwifi7260/dev/iwm/if_iwm_fw.h +++ b/src/add-ons/kernel/drivers/network/wlan/idualwifi7260/dev/iwm/if_iwm_fw.h @@ -71,7 +71,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /* - * $FreeBSD: releng/12.0/sys/dev/iwm/if_iwm_fw.h 314209 2017-02-24 15:17:43Z adrian $ + * $FreeBSD$ */ #ifndef __IF_IWM_FW_H__ #define __IF_IWM_FW_H__ diff --git a/src/add-ons/kernel/drivers/network/wlan/idualwifi7260/dev/iwm/if_iwm_led.c b/src/add-ons/kernel/drivers/network/wlan/idualwifi7260/dev/iwm/if_iwm_led.c index 2e95516959..f376bd1cb6 100644 --- a/src/add-ons/kernel/drivers/network/wlan/idualwifi7260/dev/iwm/if_iwm_led.c +++ b/src/add-ons/kernel/drivers/network/wlan/idualwifi7260/dev/iwm/if_iwm_led.c @@ -87,7 +87,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include -__FBSDID("$FreeBSD: releng/12.0/sys/dev/iwm/if_iwm_led.c 318001 2017-05-09 02:38:23Z adrian $"); +__FBSDID("$FreeBSD$"); #include "opt_wlan.h" #include "opt_iwm.h" @@ -139,20 +139,20 @@ __FBSDID("$FreeBSD: releng/12.0/sys/dev/iwm/if_iwm_led.c 318001 2017-05-09 02:38 /* Set led register on */ void -iwm_mvm_led_enable(struct iwm_softc *sc) +iwm_led_enable(struct iwm_softc *sc) { IWM_WRITE(sc, IWM_CSR_LED_REG, IWM_CSR_LED_REG_TURN_ON); } /* Set led register off */ void -iwm_mvm_led_disable(struct iwm_softc *sc) +iwm_led_disable(struct iwm_softc *sc) { IWM_WRITE(sc, IWM_CSR_LED_REG, IWM_CSR_LED_REG_TURN_OFF); } static int -iwm_mvm_led_is_enabled(struct iwm_softc *sc) +iwm_led_is_enabled(struct iwm_softc *sc) { return (IWM_READ(sc, IWM_CSR_LED_REG) == IWM_CSR_LED_REG_TURN_ON); } @@ -165,10 +165,10 @@ iwm_led_blink_timeout(void *arg) if (sc->sc_attached == 0) return; - if (iwm_mvm_led_is_enabled(sc)) - iwm_mvm_led_disable(sc); + if (iwm_led_is_enabled(sc)) + iwm_led_disable(sc); else - iwm_mvm_led_enable(sc); + iwm_led_enable(sc); callout_reset(&sc->sc_led_blink_to, (200 * hz) / 1000, iwm_led_blink_timeout, sc); @@ -184,5 +184,5 @@ void iwm_led_blink_stop(struct iwm_softc *sc) { callout_stop(&sc->sc_led_blink_to); - iwm_mvm_led_disable(sc); + iwm_led_disable(sc); } diff --git a/src/add-ons/kernel/drivers/network/wlan/idualwifi7260/dev/iwm/if_iwm_led.h b/src/add-ons/kernel/drivers/network/wlan/idualwifi7260/dev/iwm/if_iwm_led.h index acf0a152be..df7afb022c 100644 --- a/src/add-ons/kernel/drivers/network/wlan/idualwifi7260/dev/iwm/if_iwm_led.h +++ b/src/add-ons/kernel/drivers/network/wlan/idualwifi7260/dev/iwm/if_iwm_led.h @@ -86,13 +86,13 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $FreeBSD: releng/12.0/sys/dev/iwm/if_iwm_led.h 303327 2016-07-26 00:02:17Z sbruno $ + * $FreeBSD$ */ #ifndef __IF_IWM_LED_H__ #define __IF_IWM_LED_H__ -extern void iwm_mvm_led_enable(struct iwm_softc *); -extern void iwm_mvm_led_disable(struct iwm_softc *); +extern void iwm_led_enable(struct iwm_softc *); +extern void iwm_led_disable(struct iwm_softc *); extern void iwm_led_blink_start(struct iwm_softc *); extern void iwm_led_blink_stop(struct iwm_softc *); diff --git a/src/add-ons/kernel/drivers/network/wlan/idualwifi7260/dev/iwm/if_iwm_mac_ctxt.c b/src/add-ons/kernel/drivers/network/wlan/idualwifi7260/dev/iwm/if_iwm_mac_ctxt.c index 2777a75c37..7e0d3d8153 100644 --- a/src/add-ons/kernel/drivers/network/wlan/idualwifi7260/dev/iwm/if_iwm_mac_ctxt.c +++ b/src/add-ons/kernel/drivers/network/wlan/idualwifi7260/dev/iwm/if_iwm_mac_ctxt.c @@ -103,7 +103,7 @@ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ #include -__FBSDID("$FreeBSD: releng/12.0/sys/dev/iwm/if_iwm_mac_ctxt.c 318219 2017-05-12 05:50:38Z adrian $"); +__FBSDID("$FreeBSD$"); #include "opt_wlan.h" #include "opt_iwm.h" @@ -161,15 +161,15 @@ __FBSDID("$FreeBSD: releng/12.0/sys/dev/iwm/if_iwm_mac_ctxt.c 318219 2017-05-12 * BEGIN mvm/mac-ctxt.c */ -const uint8_t iwm_mvm_ac_to_tx_fifo[] = { - IWM_MVM_TX_FIFO_BE, - IWM_MVM_TX_FIFO_BK, - IWM_MVM_TX_FIFO_VI, - IWM_MVM_TX_FIFO_VO, +const uint8_t iwm_ac_to_tx_fifo[] = { + IWM_TX_FIFO_BE, + IWM_TX_FIFO_BK, + IWM_TX_FIFO_VI, + IWM_TX_FIFO_VO, }; static void -iwm_mvm_ack_rates(struct iwm_softc *sc, int is2ghz, +iwm_ack_rates(struct iwm_softc *sc, int is2ghz, int *cck_rates, int *ofdm_rates, struct iwm_node *in) { int lowest_present_ofdm = 100; @@ -253,7 +253,7 @@ iwm_mvm_ack_rates(struct iwm_softc *sc, int is2ghz, } static void -iwm_mvm_mac_ctxt_cmd_common(struct iwm_softc *sc, struct iwm_node *in, +iwm_mac_ctxt_cmd_common(struct iwm_softc *sc, struct iwm_node *in, struct iwm_mac_ctx_cmd *cmd, uint32_t action) { struct ieee80211com *ic = &sc->sc_ic; @@ -305,8 +305,8 @@ iwm_mvm_mac_ctxt_cmd_common(struct iwm_softc *sc, struct iwm_node *in, * XXX This workaround makes the firmware behave more correctly once * we are associated, regularly giving us statistics notifications, * as well as signaling missed beacons to us. - * Since we only call iwm_mvm_mac_ctxt_add() and - * iwm_mvm_mac_ctxt_changed() when already authenticating or + * Since we only call iwm_mac_ctxt_add() and + * iwm_mac_ctxt_changed() when already authenticating or * associating, ni->ni_bssid should always make sense here. */ if (ivp->iv_auth) { @@ -325,7 +325,7 @@ iwm_mvm_mac_ctxt_cmd_common(struct iwm_softc *sc, struct iwm_node *in, } else { is2ghz = 1; } - iwm_mvm_ack_rates(sc, is2ghz, &cck_ack_rates, &ofdm_ack_rates, in); + iwm_ack_rates(sc, is2ghz, &cck_ack_rates, &ofdm_ack_rates, in); cmd->cck_rates = htole32(cck_ack_rates); cmd->ofdm_rates = htole32(ofdm_ack_rates); @@ -342,7 +342,7 @@ iwm_mvm_mac_ctxt_cmd_common(struct iwm_softc *sc, struct iwm_node *in, */ for (i = 0; i < WME_NUM_AC; i++) { - uint8_t txf = iwm_mvm_ac_to_tx_fifo[i]; + uint8_t txf = iwm_ac_to_tx_fifo[i]; cmd->ac[txf].cw_min = htole16(ivp->queue_params[i].cw_min); cmd->ac[txf].cw_max = htole16(ivp->queue_params[i].cw_max); @@ -362,9 +362,9 @@ iwm_mvm_mac_ctxt_cmd_common(struct iwm_softc *sc, struct iwm_node *in, } static int -iwm_mvm_mac_ctxt_send_cmd(struct iwm_softc *sc, struct iwm_mac_ctx_cmd *cmd) +iwm_mac_ctxt_send_cmd(struct iwm_softc *sc, struct iwm_mac_ctx_cmd *cmd) { - int ret = iwm_mvm_send_cmd_pdu(sc, IWM_MAC_CONTEXT_CMD, IWM_CMD_SYNC, + int ret = iwm_send_cmd_pdu(sc, IWM_MAC_CONTEXT_CMD, IWM_CMD_SYNC, sizeof(*cmd), cmd); if (ret) device_printf(sc->sc_dev, @@ -377,7 +377,7 @@ iwm_mvm_mac_ctxt_send_cmd(struct iwm_softc *sc, struct iwm_mac_ctx_cmd *cmd) * Fill the specific data for mac context of type station or p2p client */ static void -iwm_mvm_mac_ctxt_cmd_fill_sta(struct iwm_softc *sc, struct iwm_node *in, +iwm_mac_ctxt_cmd_fill_sta(struct iwm_softc *sc, struct iwm_node *in, struct iwm_mac_data_sta *ctxt_sta, int force_assoc_off) { struct ieee80211_node *ni = &in->in_ni; @@ -444,15 +444,15 @@ iwm_mvm_mac_ctxt_cmd_fill_sta(struct iwm_softc *sc, struct iwm_node *in, "%s: ni_intval: %d, bi_reciprocal: %d, dtim_interval: %d, dtim_reciprocal: %d\n", __func__, ni->ni_intval, - iwm_mvm_reciprocal(ni->ni_intval), + iwm_reciprocal(ni->ni_intval), ni->ni_intval * dtim_period, - iwm_mvm_reciprocal(ni->ni_intval * dtim_period)); + iwm_reciprocal(ni->ni_intval * dtim_period)); ctxt_sta->bi = htole32(ni->ni_intval); - ctxt_sta->bi_reciprocal = htole32(iwm_mvm_reciprocal(ni->ni_intval)); + ctxt_sta->bi_reciprocal = htole32(iwm_reciprocal(ni->ni_intval)); ctxt_sta->dtim_interval = htole32(ni->ni_intval * dtim_period); ctxt_sta->dtim_reciprocal = - htole32(iwm_mvm_reciprocal(ni->ni_intval * dtim_period)); + htole32(iwm_reciprocal(ni->ni_intval * dtim_period)); /* 10 = CONN_MAX_LISTEN_INTERVAL */ ctxt_sta->listen_interval = htole32(10); @@ -462,7 +462,7 @@ iwm_mvm_mac_ctxt_cmd_fill_sta(struct iwm_softc *sc, struct iwm_node *in, } static int -iwm_mvm_mac_ctxt_cmd_station(struct iwm_softc *sc, struct ieee80211vap *vap, +iwm_mac_ctxt_cmd_station(struct iwm_softc *sc, struct ieee80211vap *vap, uint32_t action) { struct ieee80211_node *ni = vap->iv_bss; @@ -473,7 +473,7 @@ iwm_mvm_mac_ctxt_cmd_station(struct iwm_softc *sc, struct ieee80211vap *vap, "%s: called; action=%d\n", __func__, action); /* Fill the common data for all mac context types */ - iwm_mvm_mac_ctxt_cmd_common(sc, in, &cmd, action); + iwm_mac_ctxt_cmd_common(sc, in, &cmd, action); /* Allow beacons to pass through as long as we are not associated,or we * do not have dtim period information */ @@ -483,21 +483,21 @@ iwm_mvm_mac_ctxt_cmd_station(struct iwm_softc *sc, struct ieee80211vap *vap, cmd.filter_flags &= ~htole32(IWM_MAC_FILTER_IN_BEACON); /* Fill the data specific for station mode */ - iwm_mvm_mac_ctxt_cmd_fill_sta(sc, in, + iwm_mac_ctxt_cmd_fill_sta(sc, in, &cmd.sta, action == IWM_FW_CTXT_ACTION_ADD); - return iwm_mvm_mac_ctxt_send_cmd(sc, &cmd); + return iwm_mac_ctxt_send_cmd(sc, &cmd); } static int -iwm_mvm_mac_ctx_send(struct iwm_softc *sc, struct ieee80211vap *vap, +iwm_mac_ctx_send(struct iwm_softc *sc, struct ieee80211vap *vap, uint32_t action) { - return iwm_mvm_mac_ctxt_cmd_station(sc, vap, action); + return iwm_mac_ctxt_cmd_station(sc, vap, action); } int -iwm_mvm_mac_ctxt_add(struct iwm_softc *sc, struct ieee80211vap *vap) +iwm_mac_ctxt_add(struct iwm_softc *sc, struct ieee80211vap *vap) { struct iwm_vap *iv = IWM_VAP(vap); int ret; @@ -508,7 +508,7 @@ iwm_mvm_mac_ctxt_add(struct iwm_softc *sc, struct ieee80211vap *vap) return (EIO); } - ret = iwm_mvm_mac_ctx_send(sc, vap, IWM_FW_CTXT_ACTION_ADD); + ret = iwm_mac_ctx_send(sc, vap, IWM_FW_CTXT_ACTION_ADD); if (ret) return (ret); iv->is_uploaded = 1; @@ -516,7 +516,7 @@ iwm_mvm_mac_ctxt_add(struct iwm_softc *sc, struct ieee80211vap *vap) } int -iwm_mvm_mac_ctxt_changed(struct iwm_softc *sc, struct ieee80211vap *vap) +iwm_mac_ctxt_changed(struct iwm_softc *sc, struct ieee80211vap *vap) { struct iwm_vap *iv = IWM_VAP(vap); @@ -525,12 +525,12 @@ iwm_mvm_mac_ctxt_changed(struct iwm_softc *sc, struct ieee80211vap *vap) __func__); return (EIO); } - return iwm_mvm_mac_ctx_send(sc, vap, IWM_FW_CTXT_ACTION_MODIFY); + return iwm_mac_ctx_send(sc, vap, IWM_FW_CTXT_ACTION_MODIFY); } #if 0 static int -iwm_mvm_mac_ctxt_remove(struct iwm_softc *sc, struct iwm_node *in) +iwm_mac_ctxt_remove(struct iwm_softc *sc, struct iwm_node *in) { struct iwm_mac_ctx_cmd cmd; int ret; @@ -547,7 +547,7 @@ iwm_mvm_mac_ctxt_remove(struct iwm_softc *sc, struct iwm_node *in) IWM_DEFAULT_COLOR)); cmd.action = htole32(IWM_FW_CTXT_ACTION_REMOVE); - ret = iwm_mvm_send_cmd_pdu(sc, + ret = iwm_send_cmd_pdu(sc, IWM_MAC_CONTEXT_CMD, IWM_CMD_SYNC, sizeof(cmd), &cmd); if (ret) { device_printf(sc->sc_dev, diff --git a/src/add-ons/kernel/drivers/network/wlan/idualwifi7260/dev/iwm/if_iwm_mac_ctxt.h b/src/add-ons/kernel/drivers/network/wlan/idualwifi7260/dev/iwm/if_iwm_mac_ctxt.h index b0d0c19fd9..e23f91e99f 100644 --- a/src/add-ons/kernel/drivers/network/wlan/idualwifi7260/dev/iwm/if_iwm_mac_ctxt.h +++ b/src/add-ons/kernel/drivers/network/wlan/idualwifi7260/dev/iwm/if_iwm_mac_ctxt.h @@ -1,5 +1,5 @@ /* $OpenBSD: if_iwm.c,v 1.39 2015/03/23 00:35:19 jsg Exp $ */ -/* $FreeBSD: releng/12.0/sys/dev/iwm/if_iwm_mac_ctxt.h 318219 2017-05-12 05:50:38Z adrian $ */ +/* $FreeBSD$ */ /* * Copyright (c) 2014 genua mbh @@ -106,10 +106,10 @@ #ifndef __IF_IWM_MAC_CTXT_H__ #define __IF_IWM_MAC_CTXT_H__ -extern const uint8_t iwm_mvm_ac_to_tx_fifo[]; +extern const uint8_t iwm_ac_to_tx_fifo[]; -extern int iwm_mvm_mac_ctxt_add(struct iwm_softc *sc, struct ieee80211vap *vap); -extern int iwm_mvm_mac_ctxt_changed(struct iwm_softc *sc, struct ieee80211vap *vap); -extern int iwm_mvm_mac_ctxt_remove(struct iwm_softc *sc, struct ieee80211vap *vap); +extern int iwm_mac_ctxt_add(struct iwm_softc *sc, struct ieee80211vap *vap); +extern int iwm_mac_ctxt_changed(struct iwm_softc *sc, struct ieee80211vap *vap); +extern int iwm_mac_ctxt_remove(struct iwm_softc *sc, struct ieee80211vap *vap); #endif /* __IF_IWM_MAC_CTXT_H__ */ diff --git a/src/add-ons/kernel/drivers/network/wlan/idualwifi7260/dev/iwm/if_iwm_notif_wait.c b/src/add-ons/kernel/drivers/network/wlan/idualwifi7260/dev/iwm/if_iwm_notif_wait.c index 67ae03b329..47f02a6cfe 100644 --- a/src/add-ons/kernel/drivers/network/wlan/idualwifi7260/dev/iwm/if_iwm_notif_wait.c +++ b/src/add-ons/kernel/drivers/network/wlan/idualwifi7260/dev/iwm/if_iwm_notif_wait.c @@ -67,7 +67,7 @@ *****************************************************************************/ #include -__FBSDID("$FreeBSD: releng/12.0/sys/dev/iwm/if_iwm_notif_wait.c 318001 2017-05-09 02:38:23Z adrian $"); +__FBSDID("$FreeBSD$"); #include "opt_wlan.h" #include "opt_iwm.h" @@ -76,9 +76,9 @@ __FBSDID("$FreeBSD: releng/12.0/sys/dev/iwm/if_iwm_notif_wait.c 318001 2017-05-0 #include #include #include +#include #include #include -#include #include #include diff --git a/src/add-ons/kernel/drivers/network/wlan/idualwifi7260/dev/iwm/if_iwm_notif_wait.h b/src/add-ons/kernel/drivers/network/wlan/idualwifi7260/dev/iwm/if_iwm_notif_wait.h index 7608fe5151..aa77023c45 100644 --- a/src/add-ons/kernel/drivers/network/wlan/idualwifi7260/dev/iwm/if_iwm_notif_wait.h +++ b/src/add-ons/kernel/drivers/network/wlan/idualwifi7260/dev/iwm/if_iwm_notif_wait.h @@ -66,7 +66,7 @@ * *****************************************************************************/ -/* $FreeBSD: releng/12.0/sys/dev/iwm/if_iwm_notif_wait.h 313322 2017-02-06 05:27:07Z adrian $ */ +/* $FreeBSD$ */ #ifndef __IF_IWN_NOTIF_WAIT_H__ #define __IF_IWN_NOTIF_WAIT_H__ diff --git a/src/add-ons/kernel/drivers/network/wlan/idualwifi7260/dev/iwm/if_iwm_pcie_trans.c b/src/add-ons/kernel/drivers/network/wlan/idualwifi7260/dev/iwm/if_iwm_pcie_trans.c index 30c58de3ed..9178a1d298 100644 --- a/src/add-ons/kernel/drivers/network/wlan/idualwifi7260/dev/iwm/if_iwm_pcie_trans.c +++ b/src/add-ons/kernel/drivers/network/wlan/idualwifi7260/dev/iwm/if_iwm_pcie_trans.c @@ -103,7 +103,7 @@ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ #include -__FBSDID("$FreeBSD: releng/12.0/sys/dev/iwm/if_iwm_pcie_trans.c 318003 2017-05-09 02:42:53Z adrian $"); +__FBSDID("$FreeBSD$"); #include "opt_wlan.h" #include "opt_iwm.h" @@ -185,6 +185,27 @@ iwm_write_prph(struct iwm_softc *sc, uint32_t addr, uint32_t val) IWM_WRITE(sc, IWM_HBUS_TARG_PRPH_WDAT, val); } +void +iwm_write_prph64(struct iwm_softc *sc, uint64_t addr, uint64_t val) +{ + iwm_write_prph(sc, (uint32_t)addr, val & 0xffffffff); + iwm_write_prph(sc, (uint32_t)addr + 4, val >> 32); +} + +int +iwm_poll_prph(struct iwm_softc *sc, uint32_t addr, uint32_t bits, uint32_t mask, + int timeout) +{ + do { + if ((iwm_read_prph(sc, addr) & mask) == (bits & mask)) + return (0); + DELAY(10); + timeout -= 10; + } while (timeout > 0); + + return (ETIMEDOUT); +} + #ifdef IWM_DEBUG /* iwlwifi: pcie/trans.c */ int @@ -261,7 +282,7 @@ iwm_nic_lock(struct iwm_softc *sc) IWM_SETBITS(sc, IWM_CSR_GP_CNTRL, IWM_CSR_GP_CNTRL_REG_FLAG_MAC_ACCESS_REQ); - if (sc->cfg->device_family == IWM_DEVICE_FAMILY_8000) + if (sc->cfg->device_family >= IWM_DEVICE_FAMILY_8000) DELAY(2); if (iwm_poll_bit(sc, IWM_CSR_GP_CNTRL, @@ -325,6 +346,8 @@ iwm_enable_rfkill_int(struct iwm_softc *sc) { sc->sc_intmask = IWM_CSR_INT_BIT_RF_KILL; IWM_WRITE(sc, IWM_CSR_INT_MASK, sc->sc_intmask); + IWM_SETBITS(sc, IWM_CSR_GP_CNTRL, + IWM_CSR_GP_CNTRL_REG_FLAG_RFKILL_WAKE_L1A_EN); } int @@ -383,7 +406,9 @@ iwm_prepare_card_hw(struct iwm_softc *sc) if (iwm_set_hw_ready(sc)) goto out; - DELAY(100); + IWM_SETBITS(sc, IWM_CSR_DBG_LINK_PWR_MGMT_REG, + IWM_CSR_RESET_LINK_PWR_MGMT_DISABLED); + DELAY(1000); /* If HW is not ready, prepare the conditions to check again */ IWM_SETBITS(sc, IWM_CSR_HW_IF_CONFIG_REG, @@ -454,7 +479,7 @@ iwm_apm_init(struct iwm_softc *sc) IWM_DPRINTF(sc, IWM_DEBUG_RESET, "iwm apm start\n"); /* Disable L0S exit timer (platform NMI Work/Around) */ - if (sc->cfg->device_family != IWM_DEVICE_FAMILY_8000) { + if (sc->cfg->device_family < IWM_DEVICE_FAMILY_8000) { IWM_SETBITS(sc, IWM_CSR_GIO_CHICKEN_BITS, IWM_CSR_GIO_CHICKEN_BITS_REG_BIT_DIS_L0S_EXIT_TIMER); } @@ -569,6 +594,16 @@ iwm_apm_init(struct iwm_softc *sc) void iwm_apm_stop(struct iwm_softc *sc) { + IWM_SETBITS(sc, IWM_CSR_DBG_LINK_PWR_MGMT_REG, + IWM_CSR_RESET_LINK_PWR_MGMT_DISABLED); + IWM_SETBITS(sc, IWM_CSR_HW_IF_CONFIG_REG, + IWM_CSR_HW_IF_CONFIG_REG_PREPARE | + IWM_CSR_HW_IF_CONFIG_REG_ENABLE_PME); + DELAY(1000); + IWM_CLRBITS(sc, IWM_CSR_DBG_LINK_PWR_MGMT_REG, + IWM_CSR_RESET_LINK_PWR_MGMT_DISABLED); + DELAY(5000); + /* stop device's busmaster DMA activity */ IWM_SETBITS(sc, IWM_CSR_RESET, IWM_CSR_RESET_REG_FLAG_STOP_MASTER); @@ -576,6 +611,14 @@ iwm_apm_stop(struct iwm_softc *sc) IWM_CSR_RESET_REG_FLAG_MASTER_DISABLED, IWM_CSR_RESET_REG_FLAG_MASTER_DISABLED, 100)) device_printf(sc->sc_dev, "timeout waiting for master\n"); + + /* + * Clear "initialization complete" bit to move adapter from + * D0A* (powered-up Active) --> D0U* (Uninitialized) state. + */ + IWM_CLRBITS(sc, IWM_CSR_GP_CNTRL, + IWM_CSR_GP_CNTRL_REG_FLAG_INIT_DONE); + IWM_DPRINTF(sc, IWM_DEBUG_TRANS, "%s: iwm apm stop\n", __func__); } @@ -590,11 +633,15 @@ iwm_start_hw(struct iwm_softc *sc) /* Reset the entire device */ IWM_WRITE(sc, IWM_CSR_RESET, IWM_CSR_RESET_REG_FLAG_SW_RESET); - DELAY(10); + DELAY(5000); if ((error = iwm_apm_init(sc)) != 0) return error; + /* On newer chipsets MSI is disabled by default. */ + if (sc->cfg->mqrx_supported) + iwm_write_prph(sc, IWM_UREG_CHICK, IWM_UREG_CHICK_MSI_ENABLE); + iwm_enable_rfkill_int(sc); iwm_check_rfkill(sc); @@ -613,13 +660,21 @@ iwm_set_pwr(struct iwm_softc *sc) int iwm_pcie_rx_stop(struct iwm_softc *sc) { - int ret = 0; + int ret; + + ret = 0; if (iwm_nic_lock(sc)) { - IWM_WRITE(sc, IWM_FH_MEM_RCSR_CHNL0_CONFIG_REG, 0); - ret = iwm_poll_bit(sc, IWM_FH_MEM_RSSR_RX_STATUS_REG, - IWM_FH_RSSR_CHNL0_RX_STATUS_CHNL_IDLE, - IWM_FH_RSSR_CHNL0_RX_STATUS_CHNL_IDLE, - 1000); + if (sc->cfg->mqrx_supported) { + iwm_write_prph(sc, IWM_RFH_RXF_DMA_CFG, 0); + ret = iwm_poll_prph(sc, IWM_RFH_GEN_STATUS, + IWM_RXF_DMA_IDLE, IWM_RXF_DMA_IDLE, 1000); + } else { + IWM_WRITE(sc, IWM_FH_MEM_RCSR_CHNL0_CONFIG_REG, 0); + ret = iwm_poll_bit(sc, IWM_FH_MEM_RSSR_RX_STATUS_REG, + IWM_FH_RSSR_CHNL0_RX_STATUS_CHNL_IDLE, + IWM_FH_RSSR_CHNL0_RX_STATUS_CHNL_IDLE, + 1000); + } iwm_nic_unlock(sc); } return ret; diff --git a/src/add-ons/kernel/drivers/network/wlan/idualwifi7260/dev/iwm/if_iwm_pcie_trans.h b/src/add-ons/kernel/drivers/network/wlan/idualwifi7260/dev/iwm/if_iwm_pcie_trans.h index 8fef440e53..bdbd85476a 100644 --- a/src/add-ons/kernel/drivers/network/wlan/idualwifi7260/dev/iwm/if_iwm_pcie_trans.h +++ b/src/add-ons/kernel/drivers/network/wlan/idualwifi7260/dev/iwm/if_iwm_pcie_trans.h @@ -1,4 +1,4 @@ -/* $FreeBSD: releng/12.0/sys/dev/iwm/if_iwm_pcie_trans.h 313415 2017-02-08 06:53:23Z adrian $ */ +/* $FreeBSD$ */ /* * Copyright (c) 2014 genua mbh * Copyright (c) 2014 Fixup Software Ltd. @@ -106,6 +106,10 @@ extern uint32_t iwm_read_prph(struct iwm_softc *sc, uint32_t addr); extern void iwm_write_prph(struct iwm_softc *sc, uint32_t addr, uint32_t val); +extern void iwm_write_prph64(struct iwm_softc *sc, uint64_t addr, + uint64_t val); +extern int iwm_poll_prph(struct iwm_softc *sc, uint32_t addr, uint32_t bits, + uint32_t mask, int timeout); extern int iwm_read_mem(struct iwm_softc *sc, uint32_t addr, void *buf, int dwords); extern int iwm_write_mem(struct iwm_softc *sc, uint32_t addr, const void *buf, int dwords); diff --git a/src/add-ons/kernel/drivers/network/wlan/idualwifi7260/dev/iwm/if_iwm_phy_ctxt.c b/src/add-ons/kernel/drivers/network/wlan/idualwifi7260/dev/iwm/if_iwm_phy_ctxt.c index b3caac60a1..3815d1385f 100644 --- a/src/add-ons/kernel/drivers/network/wlan/idualwifi7260/dev/iwm/if_iwm_phy_ctxt.c +++ b/src/add-ons/kernel/drivers/network/wlan/idualwifi7260/dev/iwm/if_iwm_phy_ctxt.c @@ -103,7 +103,7 @@ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ #include -__FBSDID("$FreeBSD: releng/12.0/sys/dev/iwm/if_iwm_phy_ctxt.c 318012 2017-05-09 05:31:38Z adrian $"); +__FBSDID("$FreeBSD$"); #include "opt_wlan.h" #include "opt_iwm.h" @@ -165,7 +165,7 @@ __FBSDID("$FreeBSD: releng/12.0/sys/dev/iwm/if_iwm_phy_ctxt.c 318012 2017-05-09 * Construct the generic fields of the PHY context command */ static void -iwm_mvm_phy_ctxt_cmd_hdr(struct iwm_softc *sc, struct iwm_mvm_phy_ctxt *ctxt, +iwm_phy_ctxt_cmd_hdr(struct iwm_softc *sc, struct iwm_phy_ctxt *ctxt, struct iwm_phy_context_cmd *cmd, uint32_t action, uint32_t apply_time) { memset(cmd, 0, sizeof(struct iwm_phy_context_cmd)); @@ -188,7 +188,7 @@ iwm_mvm_phy_ctxt_cmd_hdr(struct iwm_softc *sc, struct iwm_mvm_phy_ctxt *ctxt, * Add the phy configuration to the PHY context command */ static void -iwm_mvm_phy_ctxt_cmd_data(struct iwm_softc *sc, +iwm_phy_ctxt_cmd_data(struct iwm_softc *sc, struct iwm_phy_context_cmd *cmd, struct ieee80211_channel *chan, uint8_t chains_static, uint8_t chains_dynamic) { @@ -203,8 +203,8 @@ iwm_mvm_phy_ctxt_cmd_data(struct iwm_softc *sc, ieee80211_chan2ieee(ic, chan), chains_static, chains_dynamic, - iwm_mvm_get_valid_rx_ant(sc), - iwm_mvm_get_valid_tx_ant(sc)); + iwm_get_valid_rx_ant(sc), + iwm_get_valid_tx_ant(sc)); cmd->ci.band = IEEE80211_IS_CHAN_2GHZ(chan) ? @@ -225,18 +225,18 @@ iwm_mvm_phy_ctxt_cmd_data(struct iwm_softc *sc, * between the two antennas is sufficiently different to impact * performance. */ - if (active_cnt == 1 && iwm_mvm_rx_diversity_allowed(sc)) { + if (active_cnt == 1 && iwm_rx_diversity_allowed(sc)) { idle_cnt = 2; active_cnt = 2; } - cmd->rxchain_info = htole32(iwm_mvm_get_valid_rx_ant(sc) << + cmd->rxchain_info = htole32(iwm_get_valid_rx_ant(sc) << IWM_PHY_RX_CHAIN_VALID_POS); cmd->rxchain_info |= htole32(idle_cnt << IWM_PHY_RX_CHAIN_CNT_POS); cmd->rxchain_info |= htole32(active_cnt << IWM_PHY_RX_CHAIN_MIMO_CNT_POS); - cmd->txchain_info = htole32(iwm_mvm_get_valid_tx_ant(sc)); + cmd->txchain_info = htole32(iwm_get_valid_tx_ant(sc)); } /* @@ -246,8 +246,8 @@ iwm_mvm_phy_ctxt_cmd_data(struct iwm_softc *sc, * configuration changed from the previous apply. */ static int -iwm_mvm_phy_ctxt_apply(struct iwm_softc *sc, - struct iwm_mvm_phy_ctxt *ctxt, +iwm_phy_ctxt_apply(struct iwm_softc *sc, + struct iwm_phy_ctxt *ctxt, uint8_t chains_static, uint8_t chains_dynamic, uint32_t action, uint32_t apply_time) { @@ -260,13 +260,13 @@ iwm_mvm_phy_ctxt_apply(struct iwm_softc *sc, ctxt->channel); /* Set the command header fields */ - iwm_mvm_phy_ctxt_cmd_hdr(sc, ctxt, &cmd, action, apply_time); + iwm_phy_ctxt_cmd_hdr(sc, ctxt, &cmd, action, apply_time); /* Set the command data */ - iwm_mvm_phy_ctxt_cmd_data(sc, &cmd, ctxt->channel, + iwm_phy_ctxt_cmd_data(sc, &cmd, ctxt->channel, chains_static, chains_dynamic); - ret = iwm_mvm_send_cmd_pdu(sc, IWM_PHY_CONTEXT_CMD, IWM_CMD_SYNC, + ret = iwm_send_cmd_pdu(sc, IWM_PHY_CONTEXT_CMD, IWM_CMD_SYNC, sizeof(struct iwm_phy_context_cmd), &cmd); if (ret) { device_printf(sc->sc_dev, @@ -279,7 +279,7 @@ iwm_mvm_phy_ctxt_apply(struct iwm_softc *sc, * Send a command to add a PHY context based on the current HW configuration. */ int -iwm_mvm_phy_ctxt_add(struct iwm_softc *sc, struct iwm_mvm_phy_ctxt *ctxt, +iwm_phy_ctxt_add(struct iwm_softc *sc, struct iwm_phy_ctxt *ctxt, struct ieee80211_channel *chan, uint8_t chains_static, uint8_t chains_dynamic) { @@ -290,7 +290,7 @@ iwm_mvm_phy_ctxt_add(struct iwm_softc *sc, struct iwm_mvm_phy_ctxt *ctxt, __func__, ieee80211_chan2ieee(&sc->sc_ic, chan)); - return iwm_mvm_phy_ctxt_apply(sc, ctxt, + return iwm_phy_ctxt_apply(sc, ctxt, chains_static, chains_dynamic, IWM_FW_CTXT_ACTION_ADD, 0); } @@ -300,8 +300,8 @@ iwm_mvm_phy_ctxt_add(struct iwm_softc *sc, struct iwm_mvm_phy_ctxt *ctxt, * changed. */ int -iwm_mvm_phy_ctxt_changed(struct iwm_softc *sc, - struct iwm_mvm_phy_ctxt *ctxt, struct ieee80211_channel *chan, +iwm_phy_ctxt_changed(struct iwm_softc *sc, + struct iwm_phy_ctxt *ctxt, struct ieee80211_channel *chan, uint8_t chains_static, uint8_t chains_dynamic) { ctxt->channel = chan; @@ -311,7 +311,7 @@ iwm_mvm_phy_ctxt_changed(struct iwm_softc *sc, __func__, ieee80211_chan2ieee(&sc->sc_ic, chan)); - return iwm_mvm_phy_ctxt_apply(sc, ctxt, + return iwm_phy_ctxt_apply(sc, ctxt, chains_static, chains_dynamic, IWM_FW_CTXT_ACTION_MODIFY, 0); } diff --git a/src/add-ons/kernel/drivers/network/wlan/idualwifi7260/dev/iwm/if_iwm_phy_ctxt.h b/src/add-ons/kernel/drivers/network/wlan/idualwifi7260/dev/iwm/if_iwm_phy_ctxt.h index 92b828e8b0..f3cf28239f 100644 --- a/src/add-ons/kernel/drivers/network/wlan/idualwifi7260/dev/iwm/if_iwm_phy_ctxt.h +++ b/src/add-ons/kernel/drivers/network/wlan/idualwifi7260/dev/iwm/if_iwm_phy_ctxt.h @@ -1,5 +1,5 @@ /* $OpenBSD: if_iwm.c,v 1.39 2015/03/23 00:35:19 jsg Exp $ */ -/* $FreeBSD: releng/12.0/sys/dev/iwm/if_iwm_phy_ctxt.h 286441 2015-08-08 06:06:48Z rpaulo $ */ +/* $FreeBSD$ */ /* * Copyright (c) 2014 genua mbh @@ -106,12 +106,12 @@ #ifndef __IF_IWM_PHY_CTXT_H__ #define __IF_IWM_PHY_CTXT_H__ -extern int iwm_mvm_phy_ctxt_add(struct iwm_softc *sc, - struct iwm_mvm_phy_ctxt *ctxt, +extern int iwm_phy_ctxt_add(struct iwm_softc *sc, + struct iwm_phy_ctxt *ctxt, struct ieee80211_channel *chan, uint8_t chains_static, uint8_t chains_dynamic); -extern int iwm_mvm_phy_ctxt_changed(struct iwm_softc *sc, - struct iwm_mvm_phy_ctxt *ctxt, struct ieee80211_channel *chan, +extern int iwm_phy_ctxt_changed(struct iwm_softc *sc, + struct iwm_phy_ctxt *ctxt, struct ieee80211_channel *chan, uint8_t chains_static, uint8_t chains_dynamic); #endif /* __IF_IWM_PHY_CTXT_H__ */ diff --git a/src/add-ons/kernel/drivers/network/wlan/idualwifi7260/dev/iwm/if_iwm_phy_db.c b/src/add-ons/kernel/drivers/network/wlan/idualwifi7260/dev/iwm/if_iwm_phy_db.c index 3471e7d8de..40a0a05adb 100644 --- a/src/add-ons/kernel/drivers/network/wlan/idualwifi7260/dev/iwm/if_iwm_phy_db.c +++ b/src/add-ons/kernel/drivers/network/wlan/idualwifi7260/dev/iwm/if_iwm_phy_db.c @@ -103,7 +103,7 @@ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ #include -__FBSDID("$FreeBSD: releng/12.0/sys/dev/iwm/if_iwm_phy_db.c 319581 2017-06-04 21:13:13Z adrian $"); +__FBSDID("$FreeBSD$"); #include "opt_wlan.h" #include "opt_iwm.h" @@ -203,7 +203,7 @@ enum iwm_phy_db_section_type { struct iwm_phy_db_cmd { uint16_t type; uint16_t length; - uint8_t data[0]; + uint8_t data[]; } __packed; /* for parsing of tx power channel group data that comes from the firmware*/ @@ -218,7 +218,7 @@ struct iwm_phy_db_chg_txp { struct iwm_calib_res_notif_phy_db { uint16_t type; uint16_t length; - uint8_t data[0]; + uint8_t data[]; } __packed; struct iwm_phy_db * diff --git a/src/add-ons/kernel/drivers/network/wlan/idualwifi7260/dev/iwm/if_iwm_phy_db.h b/src/add-ons/kernel/drivers/network/wlan/idualwifi7260/dev/iwm/if_iwm_phy_db.h index 90dc904708..7cab8a3d1d 100644 --- a/src/add-ons/kernel/drivers/network/wlan/idualwifi7260/dev/iwm/if_iwm_phy_db.h +++ b/src/add-ons/kernel/drivers/network/wlan/idualwifi7260/dev/iwm/if_iwm_phy_db.h @@ -1,5 +1,5 @@ /* $OpenBSD: if_iwm.c,v 1.39 2015/03/23 00:35:19 jsg Exp $ */ -/* $FreeBSD: releng/12.0/sys/dev/iwm/if_iwm_phy_db.h 313317 2017-02-06 05:09:42Z adrian $ */ +/* $FreeBSD$ */ /* * Copyright (c) 2014 genua mbh diff --git a/src/add-ons/kernel/drivers/network/wlan/idualwifi7260/dev/iwm/if_iwm_power.c b/src/add-ons/kernel/drivers/network/wlan/idualwifi7260/dev/iwm/if_iwm_power.c index 1a2773fa36..5507d6b4e9 100644 --- a/src/add-ons/kernel/drivers/network/wlan/idualwifi7260/dev/iwm/if_iwm_power.c +++ b/src/add-ons/kernel/drivers/network/wlan/idualwifi7260/dev/iwm/if_iwm_power.c @@ -87,7 +87,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include -__FBSDID("$FreeBSD: releng/12.0/sys/dev/iwm/if_iwm_power.c 318228 2017-05-12 06:31:57Z adrian $"); +__FBSDID("$FreeBSD$"); #include "opt_wlan.h" #include "opt_iwm.h" @@ -153,12 +153,12 @@ TUNABLE_INT("hw.iwm.power_scheme", &iwm_power_scheme); #define IWM_POWER_KEEP_ALIVE_PERIOD_SEC 25 static int -iwm_mvm_beacon_filter_send_cmd(struct iwm_softc *sc, +iwm_beacon_filter_send_cmd(struct iwm_softc *sc, struct iwm_beacon_filter_cmd *cmd) { int ret; - ret = iwm_mvm_send_cmd_pdu(sc, IWM_REPLY_BEACON_FILTERING_CMD, + ret = iwm_send_cmd_pdu(sc, IWM_REPLY_BEACON_FILTERING_CMD, 0, sizeof(struct iwm_beacon_filter_cmd), cmd); if (!ret) { @@ -200,14 +200,14 @@ iwm_mvm_beacon_filter_send_cmd(struct iwm_softc *sc, } static void -iwm_mvm_beacon_filter_set_cqm_params(struct iwm_softc *sc, +iwm_beacon_filter_set_cqm_params(struct iwm_softc *sc, struct iwm_vap *ivp, struct iwm_beacon_filter_cmd *cmd) { cmd->ba_enable_beacon_abort = htole32(sc->sc_bf.ba_enabled); } static void -iwm_mvm_power_log(struct iwm_softc *sc, struct iwm_mac_power_cmd *cmd) +iwm_power_log(struct iwm_softc *sc, struct iwm_mac_power_cmd *cmd) { IWM_DPRINTF(sc, IWM_DEBUG_PWRSAVE | IWM_DEBUG_CMD, "Sending power table command on mac id 0x%X for " @@ -232,7 +232,7 @@ iwm_mvm_power_log(struct iwm_softc *sc, struct iwm_mac_power_cmd *cmd) } static boolean_t -iwm_mvm_power_is_radar(struct iwm_softc *sc) +iwm_power_is_radar(struct iwm_softc *sc) { struct ieee80211com *ic = &sc->sc_ic; struct ieee80211_channel *chan; @@ -248,7 +248,7 @@ iwm_mvm_power_is_radar(struct iwm_softc *sc) } static void -iwm_mvm_power_config_skip_dtim(struct iwm_softc *sc, +iwm_power_config_skip_dtim(struct iwm_softc *sc, struct iwm_mac_power_cmd *cmd) { struct ieee80211com *ic = &sc->sc_ic; @@ -260,7 +260,7 @@ iwm_mvm_power_config_skip_dtim(struct iwm_softc *sc, cmd->skip_dtim_periods = 0; cmd->flags &= ~htole16(IWM_POWER_FLAGS_SKIP_OVER_DTIM_MSK); - if (iwm_mvm_power_is_radar(sc)) + if (iwm_power_is_radar(sc)) return; if (dtimper >= 10) @@ -278,7 +278,7 @@ iwm_mvm_power_config_skip_dtim(struct iwm_softc *sc, } static void -iwm_mvm_power_build_cmd(struct iwm_softc *sc, struct iwm_vap *ivp, +iwm_power_build_cmd(struct iwm_softc *sc, struct iwm_vap *ivp, struct iwm_mac_power_cmd *cmd) { struct ieee80211vap *vap = &ivp->iv_vap; @@ -317,34 +317,34 @@ iwm_mvm_power_build_cmd(struct iwm_softc *sc, struct iwm_vap *ivp, cmd->flags |= htole16(IWM_POWER_FLAGS_POWER_MANAGEMENT_ENA_MSK); - iwm_mvm_power_config_skip_dtim(sc, cmd); + iwm_power_config_skip_dtim(sc, cmd); cmd->rx_data_timeout = - htole32(IWM_MVM_DEFAULT_PS_RX_DATA_TIMEOUT); + htole32(IWM_DEFAULT_PS_RX_DATA_TIMEOUT); cmd->tx_data_timeout = - htole32(IWM_MVM_DEFAULT_PS_TX_DATA_TIMEOUT); + htole32(IWM_DEFAULT_PS_TX_DATA_TIMEOUT); } static int -iwm_mvm_power_send_cmd(struct iwm_softc *sc, struct iwm_vap *ivp) +iwm_power_send_cmd(struct iwm_softc *sc, struct iwm_vap *ivp) { struct iwm_mac_power_cmd cmd = {}; - iwm_mvm_power_build_cmd(sc, ivp, &cmd); - iwm_mvm_power_log(sc, &cmd); + iwm_power_build_cmd(sc, ivp, &cmd); + iwm_power_log(sc, &cmd); - return iwm_mvm_send_cmd_pdu(sc, IWM_MAC_PM_POWER_TABLE, 0, + return iwm_send_cmd_pdu(sc, IWM_MAC_PM_POWER_TABLE, 0, sizeof(cmd), &cmd); } static int -_iwm_mvm_enable_beacon_filter(struct iwm_softc *sc, struct iwm_vap *ivp, +_iwm_enable_beacon_filter(struct iwm_softc *sc, struct iwm_vap *ivp, struct iwm_beacon_filter_cmd *cmd) { int ret; - iwm_mvm_beacon_filter_set_cqm_params(sc, ivp, cmd); - ret = iwm_mvm_beacon_filter_send_cmd(sc, cmd); + iwm_beacon_filter_set_cqm_params(sc, ivp, cmd); + ret = iwm_beacon_filter_send_cmd(sc, cmd); if (!ret) sc->sc_bf.bf_enabled = 1; @@ -353,23 +353,23 @@ _iwm_mvm_enable_beacon_filter(struct iwm_softc *sc, struct iwm_vap *ivp, } int -iwm_mvm_enable_beacon_filter(struct iwm_softc *sc, struct iwm_vap *ivp) +iwm_enable_beacon_filter(struct iwm_softc *sc, struct iwm_vap *ivp) { struct iwm_beacon_filter_cmd cmd = { IWM_BF_CMD_CONFIG_DEFAULTS, .bf_enable_beacon_filter = htole32(1), }; - return _iwm_mvm_enable_beacon_filter(sc, ivp, &cmd); + return _iwm_enable_beacon_filter(sc, ivp, &cmd); } int -iwm_mvm_disable_beacon_filter(struct iwm_softc *sc) +iwm_disable_beacon_filter(struct iwm_softc *sc) { struct iwm_beacon_filter_cmd cmd = {}; int ret; - ret = iwm_mvm_beacon_filter_send_cmd(sc, &cmd); + ret = iwm_beacon_filter_send_cmd(sc, &cmd); if (ret == 0) sc->sc_bf.bf_enabled = 0; @@ -377,7 +377,7 @@ iwm_mvm_disable_beacon_filter(struct iwm_softc *sc) } static int -iwm_mvm_power_set_ps(struct iwm_softc *sc) +iwm_power_set_ps(struct iwm_softc *sc) { struct ieee80211vap *vap; boolean_t disable_ps; @@ -397,7 +397,7 @@ iwm_mvm_power_set_ps(struct iwm_softc *sc) boolean_t old_ps_disabled = sc->sc_ps_disabled; sc->sc_ps_disabled = disable_ps; - ret = iwm_mvm_power_update_device(sc); + ret = iwm_power_update_device(sc); if (ret) { sc->sc_ps_disabled = old_ps_disabled; return ret; @@ -408,7 +408,7 @@ iwm_mvm_power_set_ps(struct iwm_softc *sc) } static int -iwm_mvm_power_set_ba(struct iwm_softc *sc, struct iwm_vap *ivp) +iwm_power_set_ba(struct iwm_softc *sc, struct iwm_vap *ivp) { struct iwm_beacon_filter_cmd cmd = { IWM_BF_CMD_CONFIG_DEFAULTS, @@ -427,49 +427,49 @@ iwm_mvm_power_set_ba(struct iwm_softc *sc, struct iwm_vap *ivp) } sc->sc_bf.ba_enabled = !sc->sc_ps_disabled && bss_conf_ps; - return _iwm_mvm_enable_beacon_filter(sc, ivp, &cmd); + return _iwm_enable_beacon_filter(sc, ivp, &cmd); } int -iwm_mvm_power_update_ps(struct iwm_softc *sc) +iwm_power_update_ps(struct iwm_softc *sc) { struct ieee80211vap *vap = TAILQ_FIRST(&sc->sc_ic.ic_vaps); int ret; - ret = iwm_mvm_power_set_ps(sc); + ret = iwm_power_set_ps(sc); if (ret) return ret; if (vap != NULL) - return iwm_mvm_power_set_ba(sc, IWM_VAP(vap)); + return iwm_power_set_ba(sc, IWM_VAP(vap)); return 0; } int -iwm_mvm_power_update_mac(struct iwm_softc *sc) +iwm_power_update_mac(struct iwm_softc *sc) { struct ieee80211vap *vap = TAILQ_FIRST(&sc->sc_ic.ic_vaps); int ret; - ret = iwm_mvm_power_set_ps(sc); + ret = iwm_power_set_ps(sc); if (ret) return ret; if (vap != NULL) { - ret = iwm_mvm_power_send_cmd(sc, IWM_VAP(vap)); + ret = iwm_power_send_cmd(sc, IWM_VAP(vap)); if (ret) return ret; } if (vap != NULL) - return iwm_mvm_power_set_ba(sc, IWM_VAP(vap)); + return iwm_power_set_ba(sc, IWM_VAP(vap)); return 0; } int -iwm_mvm_power_update_device(struct iwm_softc *sc) +iwm_power_update_device(struct iwm_softc *sc) { struct iwm_device_power_cmd cmd = { .flags = 0, @@ -484,6 +484,6 @@ iwm_mvm_power_update_device(struct iwm_softc *sc) IWM_DPRINTF(sc, IWM_DEBUG_PWRSAVE | IWM_DEBUG_CMD, "Sending device power command with flags = 0x%X\n", cmd.flags); - return iwm_mvm_send_cmd_pdu(sc, + return iwm_send_cmd_pdu(sc, IWM_POWER_TABLE_CMD, 0, sizeof(cmd), &cmd); } diff --git a/src/add-ons/kernel/drivers/network/wlan/idualwifi7260/dev/iwm/if_iwm_power.h b/src/add-ons/kernel/drivers/network/wlan/idualwifi7260/dev/iwm/if_iwm_power.h index 95883eba3e..0e7eeaaae5 100644 --- a/src/add-ons/kernel/drivers/network/wlan/idualwifi7260/dev/iwm/if_iwm_power.h +++ b/src/add-ons/kernel/drivers/network/wlan/idualwifi7260/dev/iwm/if_iwm_power.h @@ -1,5 +1,5 @@ /* $OpenBSD: if_iwm.c,v 1.39 2015/03/23 00:35:19 jsg Exp $ */ -/* $FreeBSD: releng/12.0/sys/dev/iwm/if_iwm_power.h 318226 2017-05-12 06:30:06Z adrian $ */ +/* $FreeBSD$ */ /* * Copyright (c) 2014 genua mbh @@ -90,11 +90,11 @@ #ifndef __IF_IWM_POWER_H__ #define __IF_IWM_POWER_H__ -extern int iwm_mvm_power_update_device(struct iwm_softc *sc); -extern int iwm_mvm_power_update_mac(struct iwm_softc *sc); -extern int iwm_mvm_power_update_ps(struct iwm_softc *sc); -extern int iwm_mvm_enable_beacon_filter(struct iwm_softc *sc, +extern int iwm_power_update_device(struct iwm_softc *sc); +extern int iwm_power_update_mac(struct iwm_softc *sc); +extern int iwm_power_update_ps(struct iwm_softc *sc); +extern int iwm_enable_beacon_filter(struct iwm_softc *sc, struct iwm_vap *ivp); -extern int iwm_mvm_disable_beacon_filter(struct iwm_softc *sc); +extern int iwm_disable_beacon_filter(struct iwm_softc *sc); #endif /* __IF_IWM_POWER_H__ */ diff --git a/src/add-ons/kernel/drivers/network/wlan/idualwifi7260/dev/iwm/if_iwm_scan.c b/src/add-ons/kernel/drivers/network/wlan/idualwifi7260/dev/iwm/if_iwm_scan.c index ae410ca5be..cdf7985d9a 100644 --- a/src/add-ons/kernel/drivers/network/wlan/idualwifi7260/dev/iwm/if_iwm_scan.c +++ b/src/add-ons/kernel/drivers/network/wlan/idualwifi7260/dev/iwm/if_iwm_scan.c @@ -103,7 +103,7 @@ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ #include -__FBSDID("$FreeBSD: releng/12.0/sys/dev/iwm/if_iwm_scan.c 321507 2017-07-26 05:26:01Z adrian $"); +__FBSDID("$FreeBSD$"); #include "opt_wlan.h" #include "opt_iwm.h" @@ -166,12 +166,12 @@ __FBSDID("$FreeBSD: releng/12.0/sys/dev/iwm/if_iwm_scan.c 321507 2017-07-26 05:2 #define IWM_SPARSE_EBS_SCAN_RATIO 1 static uint16_t -iwm_mvm_scan_rx_chain(struct iwm_softc *sc) +iwm_scan_rx_chain(struct iwm_softc *sc) { uint16_t rx_chain; uint8_t rx_ant; - rx_ant = iwm_mvm_get_valid_rx_ant(sc); + rx_ant = iwm_get_valid_rx_ant(sc); rx_chain = rx_ant << IWM_PHY_RX_CHAIN_VALID_POS; rx_chain |= rx_ant << IWM_PHY_RX_CHAIN_FORCE_MIMO_SEL_POS; rx_chain |= rx_ant << IWM_PHY_RX_CHAIN_FORCE_SEL_POS; @@ -180,7 +180,7 @@ iwm_mvm_scan_rx_chain(struct iwm_softc *sc) } static uint32_t -iwm_mvm_scan_rxon_flags(struct ieee80211_channel *c) +iwm_scan_rxon_flags(struct ieee80211_channel *c) { if (IEEE80211_IS_CHAN_2GHZ(c)) return htole32(IWM_PHY_BAND_24); @@ -189,7 +189,7 @@ iwm_mvm_scan_rxon_flags(struct ieee80211_channel *c) } static uint32_t -iwm_mvm_scan_rate_n_flags(struct iwm_softc *sc, int flags, int no_cck) +iwm_scan_rate_n_flags(struct iwm_softc *sc, int flags, int no_cck) { uint32_t tx_ant; int i, ind; @@ -197,7 +197,7 @@ iwm_mvm_scan_rate_n_flags(struct iwm_softc *sc, int flags, int no_cck) for (i = 0, ind = sc->sc_scan_last_antenna; i < IWM_RATE_MCS_ANT_NUM; i++) { ind = (ind + 1) % IWM_RATE_MCS_ANT_NUM; - if (iwm_mvm_get_valid_tx_ant(sc) & (1 << ind)) { + if (iwm_get_valid_tx_ant(sc) & (1 << ind)) { sc->sc_scan_last_antenna = ind; break; } @@ -212,16 +212,15 @@ iwm_mvm_scan_rate_n_flags(struct iwm_softc *sc, int flags, int no_cck) } static inline boolean_t -iwm_mvm_rrm_scan_needed(struct iwm_softc *sc) +iwm_rrm_scan_needed(struct iwm_softc *sc) { /* require rrm scan whenever the fw supports it */ - return fw_has_capa(&sc->sc_fw.ucode_capa, - IWM_UCODE_TLV_CAPA_DS_PARAM_SET_IE_SUPPORT); + return iwm_fw_has_capa(sc, IWM_UCODE_TLV_CAPA_DS_PARAM_SET_IE_SUPPORT); } #ifdef IWM_DEBUG static const char * -iwm_mvm_ebs_status_str(enum iwm_scan_ebs_status status) +iwm_ebs_status_str(enum iwm_scan_ebs_status status) { switch (status) { case IWM_SCAN_EBS_SUCCESS: @@ -236,14 +235,14 @@ iwm_mvm_ebs_status_str(enum iwm_scan_ebs_status status) } static const char * -iwm_mvm_offload_status_str(enum iwm_scan_offload_complete_status status) +iwm_offload_status_str(enum iwm_scan_offload_complete_status status) { return (status == IWM_SCAN_OFFLOAD_ABORTED) ? "aborted" : "completed"; } #endif void -iwm_mvm_rx_lmac_scan_complete_notif(struct iwm_softc *sc, +iwm_rx_lmac_scan_complete_notif(struct iwm_softc *sc, struct iwm_rx_packet *pkt) { struct iwm_periodic_scan_complete *scan_notif = (void *)pkt->data; @@ -251,7 +250,7 @@ iwm_mvm_rx_lmac_scan_complete_notif(struct iwm_softc *sc, /* If this happens, the firmware has mistakenly sent an LMAC * notification during UMAC scans -- warn and ignore it. */ - if (fw_has_capa(&sc->sc_fw.ucode_capa, IWM_UCODE_TLV_CAPA_UMAC_SCAN)) { + if (iwm_fw_has_capa(sc, IWM_UCODE_TLV_CAPA_UMAC_SCAN)) { device_printf(sc->sc_dev, "%s: Mistakenly got LMAC notification during UMAC scan\n", __func__); @@ -259,8 +258,8 @@ iwm_mvm_rx_lmac_scan_complete_notif(struct iwm_softc *sc, } IWM_DPRINTF(sc, IWM_DEBUG_SCAN, "Regular scan %s, EBS status %s (FW)\n", - iwm_mvm_offload_status_str(scan_notif->status), - iwm_mvm_ebs_status_str(scan_notif->ebs_status)); + iwm_offload_status_str(scan_notif->status), + iwm_ebs_status_str(scan_notif->ebs_status)); sc->last_ebs_successful = scan_notif->ebs_status == IWM_SCAN_EBS_SUCCESS || @@ -269,7 +268,7 @@ iwm_mvm_rx_lmac_scan_complete_notif(struct iwm_softc *sc, } void -iwm_mvm_rx_umac_scan_complete_notif(struct iwm_softc *sc, +iwm_rx_umac_scan_complete_notif(struct iwm_softc *sc, struct iwm_rx_packet *pkt) { struct iwm_umac_scan_complete *notif = (void *)pkt->data; @@ -277,8 +276,8 @@ iwm_mvm_rx_umac_scan_complete_notif(struct iwm_softc *sc, IWM_DPRINTF(sc, IWM_DEBUG_SCAN, "Scan completed, uid %u, status %s, EBS status %s\n", le32toh(notif->uid), - iwm_mvm_offload_status_str(notif->status), - iwm_mvm_ebs_status_str(notif->ebs_status)); + iwm_offload_status_str(notif->status), + iwm_ebs_status_str(notif->ebs_status)); if (notif->ebs_status != IWM_SCAN_EBS_SUCCESS && notif->ebs_status != IWM_SCAN_EBS_INACTIVE) @@ -286,7 +285,7 @@ iwm_mvm_rx_umac_scan_complete_notif(struct iwm_softc *sc, } static int -iwm_mvm_scan_skip_channel(struct ieee80211_channel *c) +iwm_scan_skip_channel(struct ieee80211_channel *c) { if (IEEE80211_IS_CHAN_2GHZ(c) && IEEE80211_IS_CHAN_B(c)) return 0; @@ -297,7 +296,7 @@ iwm_mvm_scan_skip_channel(struct ieee80211_channel *c) } static uint8_t -iwm_mvm_lmac_scan_fill_channels(struct iwm_softc *sc, +iwm_lmac_scan_fill_channels(struct iwm_softc *sc, struct iwm_scan_channel_cfg_lmac *chan, int n_ssids) { struct ieee80211com *ic = &sc->sc_ic; @@ -341,7 +340,7 @@ iwm_mvm_lmac_scan_fill_channels(struct iwm_softc *sc, } static uint8_t -iwm_mvm_umac_scan_fill_channels(struct iwm_softc *sc, +iwm_umac_scan_fill_channels(struct iwm_softc *sc, struct iwm_scan_channel_cfg_umac *chan, int n_ssids) { struct ieee80211com *ic = &sc->sc_ic; @@ -380,7 +379,7 @@ iwm_mvm_umac_scan_fill_channels(struct iwm_softc *sc, } static int -iwm_mvm_fill_probe_req(struct iwm_softc *sc, struct iwm_scan_probe_req *preq) +iwm_fill_probe_req(struct iwm_softc *sc, struct iwm_scan_probe_req *preq) { struct ieee80211com *ic = &sc->sc_ic; struct ieee80211vap *vap = TAILQ_FIRST(&ic->ic_vaps); @@ -432,7 +431,7 @@ iwm_mvm_fill_probe_req(struct iwm_softc *sc, struct iwm_scan_probe_req *preq) preq->band_data[0].len = htole16(frm - pos); remain -= frm - pos; - if (iwm_mvm_rrm_scan_needed(sc)) { + if (iwm_rrm_scan_needed(sc)) { if (remain < 3) return ENOBUFS; *frm++ = IEEE80211_ELEMID_DSPARMS; @@ -476,7 +475,7 @@ iwm_mvm_fill_probe_req(struct iwm_softc *sc, struct iwm_scan_probe_req *preq) } int -iwm_mvm_config_umac_scan(struct iwm_softc *sc) +iwm_config_umac_scan(struct iwm_softc *sc) { struct ieee80211com *ic = &sc->sc_ic; struct ieee80211vap *vap = TAILQ_FIRST(&ic->ic_vaps); @@ -503,8 +502,8 @@ iwm_mvm_config_umac_scan(struct iwm_softc *sc) if (scan_config == NULL) return ENOMEM; - scan_config->tx_chains = htole32(iwm_mvm_get_valid_tx_ant(sc)); - scan_config->rx_chains = htole32(iwm_mvm_get_valid_rx_ant(sc)); + scan_config->tx_chains = htole32(iwm_get_valid_tx_ant(sc)); + scan_config->rx_chains = htole32(iwm_get_valid_rx_ant(sc)); scan_config->legacy_rates = htole32(rates | IWM_SCAN_CONFIG_SUPPORTED_RATE(rates)); @@ -534,7 +533,7 @@ iwm_mvm_config_umac_scan(struct iwm_softc *sc) * Catch other channels, in case we have 900MHz channels or * something in the chanlist. */ - if (iwm_mvm_scan_skip_channel(c)) + if (iwm_scan_skip_channel(c)) continue; scan_config->channel_array[nchan++] = ieee80211_mhz2ieee(c->ic_freq, 0); @@ -567,7 +566,7 @@ iwm_mvm_config_umac_scan(struct iwm_softc *sc) } static boolean_t -iwm_mvm_scan_use_ebs(struct iwm_softc *sc) +iwm_scan_use_ebs(struct iwm_softc *sc) { const struct iwm_ucode_capabilities *capa = &sc->sc_fw.ucode_capa; @@ -581,8 +580,31 @@ iwm_mvm_scan_use_ebs(struct iwm_softc *sc) sc->last_ebs_successful); } +static int +iwm_scan_size(struct iwm_softc *sc) +{ + int base_size; + + if (iwm_fw_has_capa(sc, IWM_UCODE_TLV_CAPA_UMAC_SCAN)) { + if (iwm_fw_has_api(sc, IWM_UCODE_TLV_API_ADAPTIVE_DWELL)) + base_size = IWM_SCAN_REQ_UMAC_SIZE_V7; + else + base_size = IWM_SCAN_REQ_UMAC_SIZE_V1; + + return base_size + + sizeof(struct iwm_scan_channel_cfg_umac) * + sc->sc_fw.ucode_capa.n_scan_channels + + sizeof(struct iwm_scan_req_umac_tail); + } else { + return sizeof(struct iwm_scan_req_lmac) + + sizeof(struct iwm_scan_channel_cfg_lmac) * + sc->sc_fw.ucode_capa.n_scan_channels + + sizeof(struct iwm_scan_probe_req); + } +} + int -iwm_mvm_umac_scan(struct iwm_softc *sc) +iwm_umac_scan(struct iwm_softc *sc) { struct iwm_host_cmd hcmd = { .id = iwm_cmd_id(IWM_SCAN_REQ_UMAC, IWM_ALWAYS_LONG_GROUP, 0), @@ -594,13 +616,11 @@ iwm_mvm_umac_scan(struct iwm_softc *sc) struct iwm_scan_req_umac *req; struct iwm_scan_req_umac_tail *tail; size_t req_len; - uint8_t i, nssid; + uint16_t general_flags; + uint8_t channel_flags, i, nssid; int ret; - req_len = sizeof(struct iwm_scan_req_umac) + - (sizeof(struct iwm_scan_channel_cfg_umac) * - sc->sc_fw.ucode_capa.n_scan_channels) + - sizeof(struct iwm_scan_req_umac_tail); + req_len = iwm_scan_size(sc); if (req_len > IWM_MAX_CMD_PAYLOAD_SIZE) return ENOMEM; req = malloc(req_len, M_DEVBUF, M_NOWAIT | M_ZERO); @@ -612,28 +632,58 @@ iwm_mvm_umac_scan(struct iwm_softc *sc) IWM_DPRINTF(sc, IWM_DEBUG_SCAN, "Handling ieee80211 scan request\n"); - /* These timings correspond to iwlwifi's UNASSOC scan. */ - req->active_dwell = 10; - req->passive_dwell = 110; - req->fragmented_dwell = 44; - req->extended_dwell = 90; - req->max_out_time = 0; - req->suspend_time = 0; + nssid = MIN(ss->ss_nssid, IWM_PROBE_OPTION_MAX); - req->scan_priority = htole32(IWM_SCAN_PRIORITY_HIGH); + general_flags = IWM_UMAC_SCAN_GEN_FLAGS_PASS_ALL | + IWM_UMAC_SCAN_GEN_FLAGS_ITER_COMPLETE; + if (!iwm_fw_has_api(sc, IWM_UCODE_TLV_API_ADAPTIVE_DWELL)) + general_flags |= IWM_UMAC_SCAN_GEN_FLAGS_EXTENDED_DWELL; + if (iwm_rrm_scan_needed(sc)) + general_flags |= IWM_UMAC_SCAN_GEN_FLAGS_RRM_ENABLED; + if (nssid != 0) + general_flags |= IWM_UMAC_SCAN_GEN_FLAGS_PRE_CONNECT; + else + general_flags |= IWM_UMAC_SCAN_GEN_FLAGS_PASSIVE; + + channel_flags = 0; + if (iwm_scan_use_ebs(sc)) + channel_flags = IWM_SCAN_CHANNEL_FLAG_EBS | + IWM_SCAN_CHANNEL_FLAG_EBS_ACCURATE | + IWM_SCAN_CHANNEL_FLAG_CACHE_ADD; + + req->general_flags = htole16(general_flags); req->ooc_priority = htole32(IWM_SCAN_PRIORITY_HIGH); - nssid = MIN(ss->ss_nssid, IWM_PROBE_OPTION_MAX); - req->n_channels = iwm_mvm_umac_scan_fill_channels(sc, - (struct iwm_scan_channel_cfg_umac *)req->data, nssid); + /* These timings correspond to iwlwifi's UNASSOC scan. */ + if (iwm_fw_has_api(sc, IWM_UCODE_TLV_API_ADAPTIVE_DWELL)) { + req->v7.active_dwell = 10; + req->v7.passive_dwell = 110; + req->v7.fragmented_dwell = 44; + req->v7.adwell_default_n_aps_social = 10; + req->v7.adwell_default_n_aps = 2; + req->v7.adwell_max_budget = htole16(300); + req->v7.scan_priority = htole32(IWM_SCAN_PRIORITY_HIGH); + req->v7.channel.flags = channel_flags; + req->v7.channel.count = iwm_umac_scan_fill_channels(sc, + (struct iwm_scan_channel_cfg_umac *)req->v7.data, nssid); - req->general_flags = htole32(IWM_UMAC_SCAN_GEN_FLAGS_PASS_ALL | - IWM_UMAC_SCAN_GEN_FLAGS_ITER_COMPLETE | - IWM_UMAC_SCAN_GEN_FLAGS_EXTENDED_DWELL); + tail = (void *)((char *)&req->v7.data + + sizeof(struct iwm_scan_channel_cfg_umac) * + sc->sc_fw.ucode_capa.n_scan_channels); + } else { + req->v1.active_dwell = 10; + req->v1.passive_dwell = 110; + req->v1.fragmented_dwell = 44; + req->v1.extended_dwell = 90; + req->v1.scan_priority = htole32(IWM_SCAN_PRIORITY_HIGH); + req->v1.channel.flags = channel_flags; + req->v1.channel.count = iwm_umac_scan_fill_channels(sc, + (struct iwm_scan_channel_cfg_umac *)req->v1.data, nssid); - tail = (void *)((char *)&req->data + - sizeof(struct iwm_scan_channel_cfg_umac) * - sc->sc_fw.ucode_capa.n_scan_channels); + tail = (void *)((char *)&req->v1.data + + sizeof(struct iwm_scan_channel_cfg_umac) * + sc->sc_fw.ucode_capa.n_scan_channels); + } /* Check if we're doing an active directed scan. */ for (i = 0; i < nssid; i++) { @@ -644,22 +694,8 @@ iwm_mvm_umac_scan(struct iwm_softc *sc) tail->direct_scan[i].len); /* XXX debug */ } - if (nssid != 0) { - req->general_flags |= - htole32(IWM_UMAC_SCAN_GEN_FLAGS_PRE_CONNECT); - } else - req->general_flags |= htole32(IWM_UMAC_SCAN_GEN_FLAGS_PASSIVE); - if (iwm_mvm_scan_use_ebs(sc)) - req->channel_flags = IWM_SCAN_CHANNEL_FLAG_EBS | - IWM_SCAN_CHANNEL_FLAG_EBS_ACCURATE | - IWM_SCAN_CHANNEL_FLAG_CACHE_ADD; - - if (iwm_mvm_rrm_scan_needed(sc)) - req->general_flags |= - htole32(IWM_UMAC_SCAN_GEN_FLAGS_RRM_ENABLED); - - ret = iwm_mvm_fill_probe_req(sc, &tail->preq); + ret = iwm_fill_probe_req(sc, &tail->preq); if (ret) { free(req, M_DEVBUF); return ret; @@ -678,7 +714,7 @@ iwm_mvm_umac_scan(struct iwm_softc *sc) } int -iwm_mvm_lmac_scan(struct iwm_softc *sc) +iwm_lmac_scan(struct iwm_softc *sc) { struct iwm_host_cmd hcmd = { .id = IWM_SCAN_OFFLOAD_REQUEST_CMD, @@ -695,9 +731,7 @@ iwm_mvm_lmac_scan(struct iwm_softc *sc) IWM_DPRINTF(sc, IWM_DEBUG_SCAN, "Handling ieee80211 scan request\n"); - req_len = sizeof(struct iwm_scan_req_lmac) + - (sizeof(struct iwm_scan_channel_cfg_lmac) * - sc->sc_fw.ucode_capa.n_scan_channels) + sizeof(struct iwm_scan_probe_req); + req_len = iwm_scan_size(sc); if (req_len > IWM_MAX_CMD_PAYLOAD_SIZE) return ENOMEM; req = malloc(req_len, M_DEVBUF, M_NOWAIT | M_ZERO); @@ -716,17 +750,17 @@ iwm_mvm_lmac_scan(struct iwm_softc *sc) req->suspend_time = 0; req->scan_prio = htole32(IWM_SCAN_PRIORITY_HIGH); - req->rx_chain_select = iwm_mvm_scan_rx_chain(sc); + req->rx_chain_select = iwm_scan_rx_chain(sc); req->iter_num = htole32(1); req->delay = 0; - req->scan_flags = htole32(IWM_MVM_LMAC_SCAN_FLAG_PASS_ALL | - IWM_MVM_LMAC_SCAN_FLAG_ITER_COMPLETE | - IWM_MVM_LMAC_SCAN_FLAG_EXTENDED_DWELL); - if (iwm_mvm_rrm_scan_needed(sc)) - req->scan_flags |= htole32(IWM_MVM_LMAC_SCAN_FLAGS_RRM_ENABLED); + req->scan_flags = htole32(IWM_LMAC_SCAN_FLAG_PASS_ALL | + IWM_LMAC_SCAN_FLAG_ITER_COMPLETE | + IWM_LMAC_SCAN_FLAG_EXTENDED_DWELL); + if (iwm_rrm_scan_needed(sc)) + req->scan_flags |= htole32(IWM_LMAC_SCAN_FLAGS_RRM_ENABLED); - req->flags = iwm_mvm_scan_rxon_flags(sc->sc_ic.ic_scan->ss_chans[0]); + req->flags = iwm_scan_rxon_flags(sc->sc_ic.ic_scan->ss_chans[0]); req->filter_flags = htole32(IWM_MAC_FILTER_ACCEPT_GRP | IWM_MAC_FILTER_IN_BEACON); @@ -735,14 +769,14 @@ iwm_mvm_lmac_scan(struct iwm_softc *sc) req->tx_cmd[0].tx_flags = htole32(IWM_TX_CMD_FLG_SEQ_CTL | IWM_TX_CMD_FLG_BT_DIS); req->tx_cmd[0].rate_n_flags = - iwm_mvm_scan_rate_n_flags(sc, IEEE80211_CHAN_2GHZ, 1/*XXX*/); + iwm_scan_rate_n_flags(sc, IEEE80211_CHAN_2GHZ, 1/*XXX*/); req->tx_cmd[0].sta_id = sc->sc_aux_sta.sta_id; /* Tx flags 5 GHz. */ req->tx_cmd[1].tx_flags = htole32(IWM_TX_CMD_FLG_SEQ_CTL | IWM_TX_CMD_FLG_BT_DIS); req->tx_cmd[1].rate_n_flags = - iwm_mvm_scan_rate_n_flags(sc, IEEE80211_CHAN_5GHZ, 1/*XXX*/); + iwm_scan_rate_n_flags(sc, IEEE80211_CHAN_5GHZ, 1/*XXX*/); req->tx_cmd[1].sta_id = sc->sc_aux_sta.sta_id; /* Check if we're doing an active directed scan. */ @@ -757,14 +791,14 @@ iwm_mvm_lmac_scan(struct iwm_softc *sc) } if (nssid != 0) { req->scan_flags |= - htole32(IWM_MVM_LMAC_SCAN_FLAG_PRE_CONNECTION); + htole32(IWM_LMAC_SCAN_FLAG_PRE_CONNECTION); } else - req->scan_flags |= htole32(IWM_MVM_LMAC_SCAN_FLAG_PASSIVE); + req->scan_flags |= htole32(IWM_LMAC_SCAN_FLAG_PASSIVE); - req->n_channels = iwm_mvm_lmac_scan_fill_channels(sc, + req->n_channels = iwm_lmac_scan_fill_channels(sc, (struct iwm_scan_channel_cfg_lmac *)req->data, nssid); - ret = iwm_mvm_fill_probe_req(sc, + ret = iwm_fill_probe_req(sc, (struct iwm_scan_probe_req *)(req->data + (sizeof(struct iwm_scan_channel_cfg_lmac) * sc->sc_fw.ucode_capa.n_scan_channels))); @@ -777,7 +811,7 @@ iwm_mvm_lmac_scan(struct iwm_softc *sc) req->schedule[0].iterations = 1; req->schedule[0].full_scan_mul = 1; - if (iwm_mvm_scan_use_ebs(sc)) { + if (iwm_scan_use_ebs(sc)) { req->channel_opt[0].flags = htole16(IWM_SCAN_CHANNEL_FLAG_EBS | IWM_SCAN_CHANNEL_FLAG_EBS_ACCURATE | @@ -802,7 +836,7 @@ iwm_mvm_lmac_scan(struct iwm_softc *sc) } static int -iwm_mvm_lmac_scan_abort(struct iwm_softc *sc) +iwm_lmac_scan_abort(struct iwm_softc *sc) { int ret; struct iwm_host_cmd hcmd = { @@ -813,7 +847,7 @@ iwm_mvm_lmac_scan_abort(struct iwm_softc *sc) }; uint32_t status; - ret = iwm_mvm_send_cmd_status(sc, &hcmd, &status); + ret = iwm_send_cmd_status(sc, &hcmd, &status); if (ret) return ret; @@ -834,7 +868,7 @@ iwm_mvm_lmac_scan_abort(struct iwm_softc *sc) } static int -iwm_mvm_umac_scan_abort(struct iwm_softc *sc) +iwm_umac_scan_abort(struct iwm_softc *sc) { struct iwm_umac_scan_abort cmd = {}; int uid, ret; @@ -844,7 +878,7 @@ iwm_mvm_umac_scan_abort(struct iwm_softc *sc) IWM_DPRINTF(sc, IWM_DEBUG_SCAN, "Sending scan abort, uid %u\n", uid); - ret = iwm_mvm_send_cmd_pdu(sc, + ret = iwm_send_cmd_pdu(sc, iwm_cmd_id(IWM_SCAN_ABORT_UMAC, IWM_ALWAYS_LONG_GROUP, 0), 0, sizeof(cmd), &cmd); @@ -853,7 +887,7 @@ iwm_mvm_umac_scan_abort(struct iwm_softc *sc) } int -iwm_mvm_scan_stop_wait(struct iwm_softc *sc) +iwm_scan_stop_wait(struct iwm_softc *sc) { struct iwm_notification_wait wait_scan_done; static const uint16_t scan_done_notif[] = { IWM_SCAN_COMPLETE_UMAC, @@ -866,10 +900,10 @@ iwm_mvm_scan_stop_wait(struct iwm_softc *sc) IWM_DPRINTF(sc, IWM_DEBUG_SCAN, "Preparing to stop scan\n"); - if (fw_has_capa(&sc->sc_fw.ucode_capa, IWM_UCODE_TLV_CAPA_UMAC_SCAN)) - ret = iwm_mvm_umac_scan_abort(sc); + if (iwm_fw_has_capa(sc, IWM_UCODE_TLV_CAPA_UMAC_SCAN)) + ret = iwm_umac_scan_abort(sc); else - ret = iwm_mvm_lmac_scan_abort(sc); + ret = iwm_lmac_scan_abort(sc); if (ret) { IWM_DPRINTF(sc, IWM_DEBUG_SCAN, "couldn't stop scan\n"); diff --git a/src/add-ons/kernel/drivers/network/wlan/idualwifi7260/dev/iwm/if_iwm_scan.h b/src/add-ons/kernel/drivers/network/wlan/idualwifi7260/dev/iwm/if_iwm_scan.h index 586e3f2f6f..7859a75ec6 100644 --- a/src/add-ons/kernel/drivers/network/wlan/idualwifi7260/dev/iwm/if_iwm_scan.h +++ b/src/add-ons/kernel/drivers/network/wlan/idualwifi7260/dev/iwm/if_iwm_scan.h @@ -1,5 +1,5 @@ /* $OpenBSD: if_iwm.c,v 1.39 2015/03/23 00:35:19 jsg Exp $ */ -/* $FreeBSD: releng/12.0/sys/dev/iwm/if_iwm_scan.h 315925 2017-03-25 02:49:20Z adrian $ */ +/* $FreeBSD$ */ /* * Copyright (c) 2014 genua mbh @@ -106,13 +106,13 @@ #ifndef __IF_IWN_SCAN_H__ #define __IF_IWN_SCAN_H__ -extern int iwm_mvm_lmac_scan(struct iwm_softc *); -extern int iwm_mvm_config_umac_scan(struct iwm_softc *); -extern int iwm_mvm_umac_scan(struct iwm_softc *); -extern int iwm_mvm_scan_stop_wait(struct iwm_softc *); -extern void iwm_mvm_rx_lmac_scan_complete_notif(struct iwm_softc *, +extern int iwm_lmac_scan(struct iwm_softc *); +extern int iwm_config_umac_scan(struct iwm_softc *); +extern int iwm_umac_scan(struct iwm_softc *); +extern int iwm_scan_stop_wait(struct iwm_softc *); +extern void iwm_rx_lmac_scan_complete_notif(struct iwm_softc *, struct iwm_rx_packet *); -extern void iwm_mvm_rx_umac_scan_complete_notif(struct iwm_softc *, +extern void iwm_rx_umac_scan_complete_notif(struct iwm_softc *, struct iwm_rx_packet *); #endif /* __IF_IWN_SCAN_H__ */ diff --git a/src/add-ons/kernel/drivers/network/wlan/idualwifi7260/dev/iwm/if_iwm_sf.c b/src/add-ons/kernel/drivers/network/wlan/idualwifi7260/dev/iwm/if_iwm_sf.c index 9183535e8f..9ba92b6609 100644 --- a/src/add-ons/kernel/drivers/network/wlan/idualwifi7260/dev/iwm/if_iwm_sf.c +++ b/src/add-ons/kernel/drivers/network/wlan/idualwifi7260/dev/iwm/if_iwm_sf.c @@ -88,7 +88,7 @@ *****************************************************************************/ #include -__FBSDID("$FreeBSD: releng/12.0/sys/dev/iwm/if_iwm_sf.c 319580 2017-06-04 21:12:11Z adrian $"); +__FBSDID("$FreeBSD$"); #include "opt_wlan.h" #include "opt_iwm.h" @@ -196,7 +196,7 @@ sf_full_timeout[IWM_SF_NUM_SCENARIO][IWM_SF_NUM_TIMEOUT_TYPES] = { }; static void -iwm_mvm_fill_sf_command(struct iwm_softc *sc, struct iwm_sf_cfg_cmd *sf_cmd, +iwm_fill_sf_command(struct iwm_softc *sc, struct iwm_sf_cfg_cmd *sf_cmd, struct ieee80211_node *ni) { int i, j, watermark; @@ -244,7 +244,7 @@ iwm_mvm_fill_sf_command(struct iwm_softc *sc, struct iwm_sf_cfg_cmd *sf_cmd, } static int -iwm_mvm_sf_config(struct iwm_softc *sc, struct ieee80211_node *ni, +iwm_sf_config(struct iwm_softc *sc, struct ieee80211_node *ni, enum iwm_sf_state new_state) { struct iwm_sf_cfg_cmd sf_cmd = { @@ -266,13 +266,13 @@ iwm_mvm_sf_config(struct iwm_softc *sc, struct ieee80211_node *ni, switch (new_state) { case IWM_SF_UNINIT: - iwm_mvm_fill_sf_command(sc, &sf_cmd, NULL); + iwm_fill_sf_command(sc, &sf_cmd, NULL); break; case IWM_SF_FULL_ON: - iwm_mvm_fill_sf_command(sc, &sf_cmd, ni); + iwm_fill_sf_command(sc, &sf_cmd, ni); break; case IWM_SF_INIT_OFF: - iwm_mvm_fill_sf_command(sc, &sf_cmd, NULL); + iwm_fill_sf_command(sc, &sf_cmd, NULL); break; default: device_printf(sc->sc_dev, @@ -281,7 +281,7 @@ iwm_mvm_sf_config(struct iwm_softc *sc, struct ieee80211_node *ni, return EINVAL; } - ret = iwm_mvm_send_cmd_pdu(sc, IWM_REPLY_SF_CFG_CMD, IWM_CMD_ASYNC, + ret = iwm_send_cmd_pdu(sc, IWM_REPLY_SF_CFG_CMD, IWM_CMD_ASYNC, sizeof(sf_cmd), &sf_cmd); if (!ret) sc->sf_state = new_state; @@ -295,7 +295,7 @@ iwm_mvm_sf_config(struct iwm_softc *sc, struct ieee80211_node *ni, * and set new state accordingly. */ int -iwm_mvm_sf_update(struct iwm_softc *sc, struct ieee80211vap *changed_vif, +iwm_sf_update(struct iwm_softc *sc, struct ieee80211vap *changed_vif, boolean_t remove_vif) { enum iwm_sf_state new_state; @@ -326,5 +326,5 @@ iwm_mvm_sf_update(struct iwm_softc *sc, struct ieee80211vap *changed_vif, /* If there are multiple active macs - change to SF_UNINIT */ new_state = IWM_SF_UNINIT; } - return iwm_mvm_sf_config(sc, ni, new_state); + return iwm_sf_config(sc, ni, new_state); } diff --git a/src/add-ons/kernel/drivers/network/wlan/idualwifi7260/dev/iwm/if_iwm_sf.h b/src/add-ons/kernel/drivers/network/wlan/idualwifi7260/dev/iwm/if_iwm_sf.h index 78cfa80cbd..82af99947c 100644 --- a/src/add-ons/kernel/drivers/network/wlan/idualwifi7260/dev/iwm/if_iwm_sf.h +++ b/src/add-ons/kernel/drivers/network/wlan/idualwifi7260/dev/iwm/if_iwm_sf.h @@ -70,12 +70,12 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $FreeBSD: releng/12.0/sys/dev/iwm/if_iwm_sf.h 319577 2017-06-04 21:05:58Z adrian $ + * $FreeBSD$ */ #ifndef __IF_IWM_SF_H__ #define __IF_IWM_SF_H__ -extern int iwm_mvm_sf_update(struct iwm_softc *sc, +extern int iwm_sf_update(struct iwm_softc *sc, struct ieee80211vap *changed_vif, boolean_t remove_vif); diff --git a/src/add-ons/kernel/drivers/network/wlan/idualwifi7260/dev/iwm/if_iwm_sta.c b/src/add-ons/kernel/drivers/network/wlan/idualwifi7260/dev/iwm/if_iwm_sta.c index 1eb30aa139..3d9ff102ac 100644 --- a/src/add-ons/kernel/drivers/network/wlan/idualwifi7260/dev/iwm/if_iwm_sta.c +++ b/src/add-ons/kernel/drivers/network/wlan/idualwifi7260/dev/iwm/if_iwm_sta.c @@ -73,7 +73,7 @@ *****************************************************************************/ #include -__FBSDID("$FreeBSD: releng/12.0/sys/dev/iwm/if_iwm_sta.c 321508 2017-07-26 05:29:08Z adrian $"); +__FBSDID("$FreeBSD$"); #include "opt_wlan.h" #include "opt_iwm.h" @@ -136,24 +136,19 @@ __FBSDID("$FreeBSD: releng/12.0/sys/dev/iwm/if_iwm_sta.c 321508 2017-07-26 05:29 * support both API versions. */ static inline int -iwm_mvm_add_sta_cmd_size(struct iwm_softc *sc) +iwm_add_sta_cmd_size(struct iwm_softc *sc) { -#ifdef notyet - return iwm_mvm_has_new_rx_api(mvm) ? - sizeof(struct iwm_mvm_add_sta_cmd) : - sizeof(struct iwm_mvm_add_sta_cmd_v7); -#else - return sizeof(struct iwm_mvm_add_sta_cmd); -#endif + return sc->cfg->mqrx_supported ? sizeof(struct iwm_add_sta_cmd) : + sizeof(struct iwm_add_sta_cmd_v7); } /* send station add/update command to firmware */ int -iwm_mvm_sta_send_to_fw(struct iwm_softc *sc, struct iwm_node *in, +iwm_sta_send_to_fw(struct iwm_softc *sc, struct iwm_node *in, boolean_t update) { struct iwm_vap *ivp = IWM_VAP(in->in_ni.ni_vap); - struct iwm_mvm_add_sta_cmd add_sta_cmd = { + struct iwm_add_sta_cmd add_sta_cmd = { .sta_id = IWM_STATION_ID, .mac_id_n_color = htole32(IWM_FW_CMD_ID_AND_COLOR(ivp->id, ivp->color)), @@ -170,7 +165,7 @@ iwm_mvm_sta_send_to_fw(struct iwm_softc *sc, struct iwm_node *in, int ac; for (ac = 0; ac < WME_NUM_AC; ac++) { add_sta_cmd.tfd_queue_msk |= - htole32(1 << iwm_mvm_ac_to_tx_fifo[ac]); + htole32(1 << iwm_ac_to_tx_fifo[ac]); } IEEE80211_ADDR_COPY(&add_sta_cmd.addr, in->in_ni.ni_bssid); } @@ -181,8 +176,8 @@ iwm_mvm_sta_send_to_fw(struct iwm_softc *sc, struct iwm_node *in, htole32(mpdu_dens << IWM_STA_FLG_AGG_MPDU_DENS_SHIFT); status = IWM_ADD_STA_SUCCESS; - ret = iwm_mvm_send_cmd_pdu_status(sc, IWM_ADD_STA, - iwm_mvm_add_sta_cmd_size(sc), + ret = iwm_send_cmd_pdu_status(sc, IWM_ADD_STA, + iwm_add_sta_cmd_size(sc), &add_sta_cmd, &status); if (ret) return ret; @@ -201,21 +196,21 @@ iwm_mvm_sta_send_to_fw(struct iwm_softc *sc, struct iwm_node *in, } int -iwm_mvm_add_sta(struct iwm_softc *sc, struct iwm_node *in) +iwm_add_sta(struct iwm_softc *sc, struct iwm_node *in) { - return iwm_mvm_sta_send_to_fw(sc, in, FALSE); + return iwm_sta_send_to_fw(sc, in, FALSE); } int -iwm_mvm_update_sta(struct iwm_softc *sc, struct iwm_node *in) +iwm_update_sta(struct iwm_softc *sc, struct iwm_node *in) { - return iwm_mvm_sta_send_to_fw(sc, in, TRUE); + return iwm_sta_send_to_fw(sc, in, TRUE); } int -iwm_mvm_drain_sta(struct iwm_softc *sc, struct iwm_vap *ivp, boolean_t drain) +iwm_drain_sta(struct iwm_softc *sc, struct iwm_vap *ivp, boolean_t drain) { - struct iwm_mvm_add_sta_cmd cmd = {}; + struct iwm_add_sta_cmd cmd = {}; int ret; uint32_t status; @@ -227,8 +222,8 @@ iwm_mvm_drain_sta(struct iwm_softc *sc, struct iwm_vap *ivp, boolean_t drain) cmd.station_flags_msk = htole32(IWM_STA_FLG_DRAIN_FLOW); status = IWM_ADD_STA_SUCCESS; - ret = iwm_mvm_send_cmd_pdu_status(sc, IWM_ADD_STA, - iwm_mvm_add_sta_cmd_size(sc), + ret = iwm_send_cmd_pdu_status(sc, IWM_ADD_STA, + iwm_add_sta_cmd_size(sc), &cmd, &status); if (ret) return ret; @@ -254,14 +249,14 @@ iwm_mvm_drain_sta(struct iwm_softc *sc, struct iwm_vap *ivp, boolean_t drain) * only). */ static int -iwm_mvm_rm_sta_common(struct iwm_softc *sc) +iwm_rm_sta_common(struct iwm_softc *sc) { - struct iwm_mvm_rm_sta_cmd rm_sta_cmd = { + struct iwm_rm_sta_cmd rm_sta_cmd = { .sta_id = IWM_STATION_ID, }; int ret; - ret = iwm_mvm_send_cmd_pdu(sc, IWM_REMOVE_STA, 0, + ret = iwm_send_cmd_pdu(sc, IWM_REMOVE_STA, 0, sizeof(rm_sta_cmd), &rm_sta_cmd); if (ret) { device_printf(sc->sc_dev, @@ -273,20 +268,20 @@ iwm_mvm_rm_sta_common(struct iwm_softc *sc) } int -iwm_mvm_rm_sta(struct iwm_softc *sc, struct ieee80211vap *vap, +iwm_rm_sta(struct iwm_softc *sc, struct ieee80211vap *vap, boolean_t is_assoc) { uint32_t tfd_queue_msk = 0; int ret; int ac; - ret = iwm_mvm_drain_sta(sc, IWM_VAP(vap), TRUE); + ret = iwm_drain_sta(sc, IWM_VAP(vap), TRUE); if (ret) return ret; for (ac = 0; ac < WME_NUM_AC; ac++) { - tfd_queue_msk |= htole32(1 << iwm_mvm_ac_to_tx_fifo[ac]); + tfd_queue_msk |= htole32(1 << iwm_ac_to_tx_fifo[ac]); } - ret = iwm_mvm_flush_tx_path(sc, tfd_queue_msk, IWM_CMD_SYNC); + ret = iwm_flush_tx_path(sc, tfd_queue_msk, IWM_CMD_SYNC); if (ret) return ret; #ifdef notyet /* function not yet implemented */ @@ -295,7 +290,7 @@ iwm_mvm_rm_sta(struct iwm_softc *sc, struct ieee80211vap *vap, if (ret) return ret; #endif - ret = iwm_mvm_drain_sta(sc, IWM_VAP(vap), FALSE); + ret = iwm_drain_sta(sc, IWM_VAP(vap), FALSE); /* if we are associated - we can't remove the AP STA now */ if (is_assoc) @@ -303,30 +298,32 @@ iwm_mvm_rm_sta(struct iwm_softc *sc, struct ieee80211vap *vap, /* XXX wait until STA is drained */ - ret = iwm_mvm_rm_sta_common(sc); + ret = iwm_rm_sta_common(sc); return ret; } int -iwm_mvm_rm_sta_id(struct iwm_softc *sc, struct ieee80211vap *vap) +iwm_rm_sta_id(struct iwm_softc *sc, struct ieee80211vap *vap) { /* XXX wait until STA is drained */ - return iwm_mvm_rm_sta_common(sc); + return iwm_rm_sta_common(sc); } static int -iwm_mvm_add_int_sta_common(struct iwm_softc *sc, struct iwm_int_sta *sta, - const uint8_t *addr, uint16_t mac_id, uint16_t color) +iwm_add_int_sta_common(struct iwm_softc *sc, struct iwm_int_sta *sta, + const uint8_t *addr, uint16_t mac_id, uint16_t color) { - struct iwm_mvm_add_sta_cmd cmd; + struct iwm_add_sta_cmd cmd; int ret; uint32_t status; memset(&cmd, 0, sizeof(cmd)); cmd.sta_id = sta->sta_id; cmd.mac_id_n_color = htole32(IWM_FW_CMD_ID_AND_COLOR(mac_id, color)); + if (sta->sta_id == IWM_AUX_STA_ID && sc->cfg->mqrx_supported) + cmd.station_type = IWM_STA_AUX_ACTIVITY; cmd.tfd_queue_msk = htole32(sta->tfd_queue_msk); cmd.tid_disable_tx = htole16(0xffff); @@ -334,8 +331,8 @@ iwm_mvm_add_int_sta_common(struct iwm_softc *sc, struct iwm_int_sta *sta, if (addr) IEEE80211_ADDR_COPY(cmd.addr, addr); - ret = iwm_mvm_send_cmd_pdu_status(sc, IWM_ADD_STA, - iwm_mvm_add_sta_cmd_size(sc), + ret = iwm_send_cmd_pdu_status(sc, IWM_ADD_STA, + iwm_add_sta_cmd_size(sc), &cmd, &status); if (ret) return ret; @@ -354,30 +351,31 @@ iwm_mvm_add_int_sta_common(struct iwm_softc *sc, struct iwm_int_sta *sta, } int -iwm_mvm_add_aux_sta(struct iwm_softc *sc) +iwm_add_aux_sta(struct iwm_softc *sc) { int ret; sc->sc_aux_sta.sta_id = IWM_AUX_STA_ID; - sc->sc_aux_sta.tfd_queue_msk = (1 << IWM_MVM_AUX_QUEUE); + sc->sc_aux_sta.tfd_queue_msk = (1 << IWM_AUX_QUEUE); /* Map Aux queue to fifo - needs to happen before adding Aux station */ - ret = iwm_enable_txq(sc, 0, IWM_MVM_AUX_QUEUE, IWM_MVM_TX_FIFO_MCAST); + ret = iwm_enable_txq(sc, IWM_AUX_STA_ID, IWM_AUX_QUEUE, + IWM_TX_FIFO_MCAST); if (ret) return ret; - ret = iwm_mvm_add_int_sta_common(sc, &sc->sc_aux_sta, NULL, + ret = iwm_add_int_sta_common(sc, &sc->sc_aux_sta, NULL, IWM_MAC_INDEX_AUX, 0); if (ret) { memset(&sc->sc_aux_sta, 0, sizeof(sc->sc_aux_sta)); - sc->sc_aux_sta.sta_id = IWM_MVM_STATION_COUNT; + sc->sc_aux_sta.sta_id = IWM_STATION_COUNT; } return ret; } -void iwm_mvm_del_aux_sta(struct iwm_softc *sc) +void iwm_del_aux_sta(struct iwm_softc *sc) { memset(&sc->sc_aux_sta, 0, sizeof(sc->sc_aux_sta)); - sc->sc_aux_sta.sta_id = IWM_MVM_STATION_COUNT; + sc->sc_aux_sta.sta_id = IWM_STATION_COUNT; } diff --git a/src/add-ons/kernel/drivers/network/wlan/idualwifi7260/dev/iwm/if_iwm_sta.h b/src/add-ons/kernel/drivers/network/wlan/idualwifi7260/dev/iwm/if_iwm_sta.h index 225d6927a9..51b697e370 100644 --- a/src/add-ons/kernel/drivers/network/wlan/idualwifi7260/dev/iwm/if_iwm_sta.h +++ b/src/add-ons/kernel/drivers/network/wlan/idualwifi7260/dev/iwm/if_iwm_sta.h @@ -73,7 +73,7 @@ * *****************************************************************************/ -/* $FreeBSD: releng/12.0/sys/dev/iwm/if_iwm_sta.h 318229 2017-05-12 06:33:07Z adrian $ */ +/* $FreeBSD$ */ #ifndef __IF_IWM_STA_H__ #define __IF_IWM_STA_H__ @@ -88,14 +88,14 @@ * keeps the fw's station table up to date with the ADD_STA command. Stations * can be removed by the REMOVE_STA command. * - * All the data related to a station is held in the structure %iwl_mvm_sta + * All the data related to a station is held in the structure %iwl_sta * which is embed in the mac80211's %ieee80211_sta (in the drv_priv) area. * This data includes the index of the station in the fw, per tid information * (sequence numbers, Block-ack state machine, etc...). The stations are * created and deleted by the %sta_state callback from %ieee80211_ops. * * The driver holds a map: %fw_id_to_mac_id that allows to fetch a - * %ieee80211_sta (and the %iwl_mvm_sta embedded into it) based on a fw + * %ieee80211_sta (and the %iwl_sta embedded into it) based on a fw * station index. That way, the driver is able to get the tid related data in * O(1) in time sensitive paths (Tx / Tx response / BA notification). These * paths are triggered by the fw, and the driver needs to get a pointer to the @@ -133,8 +133,8 @@ * The FW needs a few internal stations that are not reflected in * mac80211, such as broadcast station in AP / GO mode, or AUX sta for * scanning and P2P device (during the GO negotiation). - * For these kind of stations we have %iwl_mvm_int_sta struct which holds the - * data relevant for them from both %iwl_mvm_sta and %ieee80211_sta. + * For these kind of stations we have %iwl_int_sta struct which holds the + * data relevant for them from both %iwl_sta and %ieee80211_sta. * Usually the data for these stations is static, so no locking is required, * and no TID data as this is also not needed. * One thing to note, is that these stations have an ID in the fw, but not @@ -150,7 +150,7 @@ /** * DOC: station table - AP Station in STA mode * - * %iwl_mvm_vif includes the index of the AP station in the fw's STA table: + * %iwl_vif includes the index of the AP station in the fw's STA table: * %ap_sta_id. To get the point to the corresponding %ieee80211_sta, * &fw_id_to_mac_id can be used. Due to the way the fw works, we must not remove * the AP station from the fw before setting the MAC context as unassociated. @@ -173,10 +173,10 @@ * the fw. In order to do so, we track the non-AMPDU packets for each station. * If mac80211 removes a STA and if it still has non-AMPDU packets pending in * the queues, we mark this station as %EBUSY in %fw_id_to_mac_id, and drop all - * the frames for this STA (%iwl_mvm_rm_sta). When the last frame is dropped + * the frames for this STA (%iwl_rm_sta). When the last frame is dropped * (we know about it with its Tx response), we remove the station in fw and set * it as %NULL in %fw_id_to_mac_id: this is the purpose of - * %iwl_mvm_sta_drained_wk. + * %iwl_sta_drained_wk. */ /** @@ -186,14 +186,14 @@ * driver, we require mac80211 to reconfigure the driver. Since the private * data of the stations is embed in mac80211's %ieee80211_sta, that data will * not be zeroed and needs to be reinitialized manually. - * %IWL_MVM_STATUS_IN_HW_RESTART is set during restart and that will hint us + * %IWL_STATUS_IN_HW_RESTART is set during restart and that will hint us * that we must not allocate a new sta_id but reuse the previous one. This * means that the stations being re-added after the reset will have the same * place in the fw as before the reset. We do need to zero the %fw_id_to_mac_id * map, since the stations aren't in the fw any more. Internal stations that * are not added by mac80211 will be re-added in the init flow that is called - * after the restart: mac80211 call's %iwl_mvm_mac_start which calls to - * %iwl_mvm_up. + * after the restart: mac80211 call's %iwl_mac_start which calls to + * %iwl_up. */ /** @@ -206,18 +206,18 @@ * @flags: if update==true, this marks what is being changed via ORs of values * from enum iwm_sta_modify_flag. Otherwise, this is ignored. */ -extern int iwm_mvm_sta_send_to_fw(struct iwm_softc *sc, struct iwm_node *in, +extern int iwm_sta_send_to_fw(struct iwm_softc *sc, struct iwm_node *in, boolean_t update); -extern int iwm_mvm_add_sta(struct iwm_softc *sc, struct iwm_node *in); -extern int iwm_mvm_update_sta(struct iwm_softc *sc, struct iwm_node *in); -extern int iwm_mvm_rm_sta(struct iwm_softc *sc, struct ieee80211vap *vap, +extern int iwm_add_sta(struct iwm_softc *sc, struct iwm_node *in); +extern int iwm_update_sta(struct iwm_softc *sc, struct iwm_node *in); +extern int iwm_rm_sta(struct iwm_softc *sc, struct ieee80211vap *vap, boolean_t is_assoc); -extern int iwm_mvm_rm_sta_id(struct iwm_softc *sc, struct ieee80211vap *vap); +extern int iwm_rm_sta_id(struct iwm_softc *sc, struct ieee80211vap *vap); -extern int iwm_mvm_add_aux_sta(struct iwm_softc *sc); -extern void iwm_mvm_del_aux_sta(struct iwm_softc *sc); +extern int iwm_add_aux_sta(struct iwm_softc *sc); +extern void iwm_del_aux_sta(struct iwm_softc *sc); -extern int iwm_mvm_drain_sta(struct iwm_softc *sc, struct iwm_vap *ivp, +extern int iwm_drain_sta(struct iwm_softc *sc, struct iwm_vap *ivp, boolean_t drain); #endif /* __IF_IWM_STA_H__ */ diff --git a/src/add-ons/kernel/drivers/network/wlan/idualwifi7260/dev/iwm/if_iwm_time_event.c b/src/add-ons/kernel/drivers/network/wlan/idualwifi7260/dev/iwm/if_iwm_time_event.c index d9a9b520ba..03aefb11b0 100644 --- a/src/add-ons/kernel/drivers/network/wlan/idualwifi7260/dev/iwm/if_iwm_time_event.c +++ b/src/add-ons/kernel/drivers/network/wlan/idualwifi7260/dev/iwm/if_iwm_time_event.c @@ -103,7 +103,7 @@ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ #include -__FBSDID("$FreeBSD: releng/12.0/sys/dev/iwm/if_iwm_time_event.c 318212 2017-05-12 05:19:08Z adrian $"); +__FBSDID("$FreeBSD$"); #include "opt_wlan.h" #include "opt_iwm.h" @@ -162,7 +162,7 @@ __FBSDID("$FreeBSD: releng/12.0/sys/dev/iwm/if_iwm_time_event.c 318212 2017-05-1 #define TU_TO_HZ(tu) (((uint64_t)(tu) * 1024 * hz) / 1000000) static void -iwm_mvm_te_clear_data(struct iwm_softc *sc) +iwm_te_clear_data(struct iwm_softc *sc) { sc->sc_time_event_uid = 0; sc->sc_time_event_duration = 0; @@ -178,7 +178,7 @@ iwm_mvm_te_clear_data(struct iwm_softc *sc) * @notif: the notification data corresponding the time event data. */ static void -iwm_mvm_te_handle_notif(struct iwm_softc *sc, +iwm_te_handle_notif(struct iwm_softc *sc, struct iwm_time_event_notif *notif) { IWM_DPRINTF(sc, IWM_DEBUG_TE, @@ -202,7 +202,7 @@ iwm_mvm_te_handle_notif(struct iwm_softc *sc, "TE ended - current time %d, estimated end %d\n", ticks, sc->sc_time_event_end_ticks); - iwm_mvm_te_clear_data(sc); + iwm_te_clear_data(sc); } else if (le32toh(notif->action) & IWM_TE_V2_NOTIF_HOST_EVENT_START) { sc->sc_time_event_end_ticks = ticks + TU_TO_HZ(sc->sc_time_event_duration); @@ -215,7 +215,7 @@ iwm_mvm_te_handle_notif(struct iwm_softc *sc, * The Rx handler for time event notifications */ void -iwm_mvm_rx_time_event_notif(struct iwm_softc *sc, struct iwm_rx_packet *pkt) +iwm_rx_time_event_notif(struct iwm_softc *sc, struct iwm_rx_packet *pkt) { struct iwm_time_event_notif *notif = (void *)pkt->data; @@ -224,11 +224,11 @@ iwm_mvm_rx_time_event_notif(struct iwm_softc *sc, struct iwm_rx_packet *pkt) le32toh(notif->unique_id), le32toh(notif->action)); - iwm_mvm_te_handle_notif(sc, notif); + iwm_te_handle_notif(sc, notif); } static int -iwm_mvm_te_notif(struct iwm_softc *sc, struct iwm_rx_packet *pkt, +iwm_te_notif(struct iwm_softc *sc, struct iwm_rx_packet *pkt, void *data) { struct iwm_time_event_notif *resp; @@ -259,7 +259,7 @@ iwm_mvm_te_notif(struct iwm_softc *sc, struct iwm_rx_packet *pkt, } static int -iwm_mvm_time_event_response(struct iwm_softc *sc, struct iwm_rx_packet *pkt, +iwm_time_event_response(struct iwm_softc *sc, struct iwm_rx_packet *pkt, void *data) { struct iwm_time_event_resp *resp; @@ -292,7 +292,7 @@ iwm_mvm_time_event_response(struct iwm_softc *sc, struct iwm_rx_packet *pkt, /* XXX Use the te_data function argument properly, like in iwlwifi's code. */ static int -iwm_mvm_time_event_send_add(struct iwm_softc *sc, struct iwm_vap *ivp, +iwm_time_event_send_add(struct iwm_softc *sc, struct iwm_vap *ivp, void *te_data, struct iwm_time_event_cmd *te_cmd) { static const uint16_t time_event_response[] = { IWM_TIME_EVENT_CMD }; @@ -316,9 +316,9 @@ iwm_mvm_time_event_send_add(struct iwm_softc *sc, struct iwm_vap *ivp, iwm_init_notification_wait(sc->sc_notif_wait, &wait_time_event, time_event_response, nitems(time_event_response), - iwm_mvm_time_event_response, /*te_data*/NULL); + iwm_time_event_response, /*te_data*/NULL); - ret = iwm_mvm_send_cmd_pdu(sc, IWM_TIME_EVENT_CMD, 0, sizeof(*te_cmd), + ret = iwm_send_cmd_pdu(sc, IWM_TIME_EVENT_CMD, 0, sizeof(*te_cmd), te_cmd); if (ret) { IWM_DPRINTF(sc, IWM_DEBUG_TE, @@ -343,7 +343,7 @@ iwm_mvm_time_event_send_add(struct iwm_softc *sc, struct iwm_vap *ivp, } void -iwm_mvm_protect_session(struct iwm_softc *sc, struct iwm_vap *ivp, +iwm_protect_session(struct iwm_softc *sc, struct iwm_vap *ivp, uint32_t duration, uint32_t max_delay, boolean_t wait_for_notif) { const uint16_t te_notif_response[] = { IWM_TIME_EVENT_NOTIFICATION }; @@ -373,7 +373,7 @@ iwm_mvm_protect_session(struct iwm_softc *sc, struct iwm_vap *ivp, IWM_T2_V2_START_IMMEDIATELY); if (!wait_for_notif) { - iwm_mvm_time_event_send_add(sc, ivp, /*te_data*/NULL, &time_cmd); + iwm_time_event_send_add(sc, ivp, /*te_data*/NULL, &time_cmd); DELAY(100); sc->sc_flags |= IWM_FLAG_TE_ACTIVE; return; @@ -385,10 +385,10 @@ iwm_mvm_protect_session(struct iwm_softc *sc, struct iwm_vap *ivp, */ iwm_init_notification_wait(sc->sc_notif_wait, &wait_te_notif, te_notif_response, nitems(te_notif_response), - iwm_mvm_te_notif, /*te_data*/NULL); + iwm_te_notif, /*te_data*/NULL); /* If TE was sent OK - wait for the notification that started */ - if (iwm_mvm_time_event_send_add(sc, ivp, /*te_data*/NULL, &time_cmd)) { + if (iwm_time_event_send_add(sc, ivp, /*te_data*/NULL, &time_cmd)) { IWM_DPRINTF(sc, IWM_DEBUG_TE, "%s: Failed to add TE to protect session\n", __func__); iwm_remove_notification(sc->sc_notif_wait, &wait_te_notif); @@ -406,7 +406,7 @@ iwm_mvm_protect_session(struct iwm_softc *sc, struct iwm_vap *ivp, } void -iwm_mvm_stop_session_protection(struct iwm_softc *sc, struct iwm_vap *ivp) +iwm_stop_session_protection(struct iwm_softc *sc, struct iwm_vap *ivp) { struct iwm_time_event_cmd time_cmd = {}; @@ -421,9 +421,9 @@ iwm_mvm_stop_session_protection(struct iwm_softc *sc, struct iwm_vap *ivp) IWM_DPRINTF(sc, IWM_DEBUG_TE, "%s: Removing TE 0x%x\n", __func__, le32toh(time_cmd.id)); - if (iwm_mvm_send_cmd_pdu(sc, IWM_TIME_EVENT_CMD, 0, sizeof(time_cmd), + if (iwm_send_cmd_pdu(sc, IWM_TIME_EVENT_CMD, 0, sizeof(time_cmd), &time_cmd) == 0) - iwm_mvm_te_clear_data(sc); + iwm_te_clear_data(sc); DELAY(100); } diff --git a/src/add-ons/kernel/drivers/network/wlan/idualwifi7260/dev/iwm/if_iwm_time_event.h b/src/add-ons/kernel/drivers/network/wlan/idualwifi7260/dev/iwm/if_iwm_time_event.h index 43ac2fb526..aae3baf07b 100644 --- a/src/add-ons/kernel/drivers/network/wlan/idualwifi7260/dev/iwm/if_iwm_time_event.h +++ b/src/add-ons/kernel/drivers/network/wlan/idualwifi7260/dev/iwm/if_iwm_time_event.h @@ -1,5 +1,5 @@ /* $OpenBSD: if_iwm.c,v 1.39 2015/03/23 00:35:19 jsg Exp $ */ -/* $FreeBSD: releng/12.0/sys/dev/iwm/if_iwm_time_event.h 318212 2017-05-12 05:19:08Z adrian $ */ +/* $FreeBSD$ */ /* * Copyright (c) 2014 genua mbh @@ -107,11 +107,11 @@ #ifndef __IF_IWM_TIME_EVENT_H__ #define __IF_IWM_TIME_EVENT_H__ -extern void iwm_mvm_rx_time_event_notif(struct iwm_softc *sc, +extern void iwm_rx_time_event_notif(struct iwm_softc *sc, struct iwm_rx_packet *pkt); -extern void iwm_mvm_protect_session(struct iwm_softc *sc, struct iwm_vap *ivp, +extern void iwm_protect_session(struct iwm_softc *sc, struct iwm_vap *ivp, uint32_t duration, uint32_t max_delay, boolean_t wait_for_notif); -extern void iwm_mvm_stop_session_protection(struct iwm_softc *sc, +extern void iwm_stop_session_protection(struct iwm_softc *sc, struct iwm_vap *ivp); #endif /* __IF_IWM_TIME_EVENT_H__ */ diff --git a/src/add-ons/kernel/drivers/network/wlan/idualwifi7260/dev/iwm/if_iwm_util.c b/src/add-ons/kernel/drivers/network/wlan/idualwifi7260/dev/iwm/if_iwm_util.c index d7bc4aa09e..4783b335f1 100644 --- a/src/add-ons/kernel/drivers/network/wlan/idualwifi7260/dev/iwm/if_iwm_util.c +++ b/src/add-ons/kernel/drivers/network/wlan/idualwifi7260/dev/iwm/if_iwm_util.c @@ -103,7 +103,7 @@ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ #include -__FBSDID("$FreeBSD: releng/12.0/sys/dev/iwm/if_iwm_util.c 321510 2017-07-26 05:51:31Z adrian $"); +__FBSDID("$FreeBSD$"); #include "opt_wlan.h" #include "opt_iwm.h" @@ -169,7 +169,7 @@ __FBSDID("$FreeBSD: releng/12.0/sys/dev/iwm/if_iwm_util.c 321510 2017-07-26 05:5 int iwm_send_cmd(struct iwm_softc *sc, struct iwm_host_cmd *hcmd) { - struct iwm_tx_ring *ring = &sc->txq[IWM_MVM_CMD_QUEUE]; + struct iwm_tx_ring *ring = &sc->txq[IWM_CMD_QUEUE]; struct iwm_tfd *desc; struct iwm_tx_data *txdata = NULL; struct iwm_device_cmd *cmd; @@ -225,12 +225,11 @@ iwm_send_cmd(struct iwm_softc *sc, struct iwm_host_cmd *hcmd) } if (paylen > datasz) { - size_t totlen; IWM_DPRINTF(sc, IWM_DEBUG_CMD, "large command paylen=%u len0=%u\n", paylen, hcmd->len[0]); /* Command is too large */ - totlen = hdrlen + paylen; + size_t totlen = hdrlen + paylen; if (paylen > IWM_MAX_CMD_PAYLOAD_SIZE) { device_printf(sc->sc_dev, "firmware command too long (%zd bytes)\n", @@ -347,7 +346,7 @@ iwm_send_cmd(struct iwm_softc *sc, struct iwm_host_cmd *hcmd) /* iwlwifi: mvm/utils.c */ int -iwm_mvm_send_cmd_pdu(struct iwm_softc *sc, uint32_t id, +iwm_send_cmd_pdu(struct iwm_softc *sc, uint32_t id, uint32_t flags, uint16_t len, const void *data) { struct iwm_host_cmd cmd = { @@ -362,7 +361,7 @@ iwm_mvm_send_cmd_pdu(struct iwm_softc *sc, uint32_t id, /* iwlwifi: mvm/utils.c */ int -iwm_mvm_send_cmd_status(struct iwm_softc *sc, +iwm_send_cmd_status(struct iwm_softc *sc, struct iwm_host_cmd *cmd, uint32_t *status) { struct iwm_rx_packet *pkt; @@ -403,7 +402,7 @@ iwm_mvm_send_cmd_status(struct iwm_softc *sc, /* iwlwifi/mvm/utils.c */ int -iwm_mvm_send_cmd_pdu_status(struct iwm_softc *sc, uint32_t id, +iwm_send_cmd_pdu_status(struct iwm_softc *sc, uint32_t id, uint16_t len, const void *data, uint32_t *status) { struct iwm_host_cmd cmd = { @@ -412,7 +411,7 @@ iwm_mvm_send_cmd_pdu_status(struct iwm_softc *sc, uint32_t id, .data = { data, }, }; - return iwm_mvm_send_cmd_status(sc, &cmd, status); + return iwm_send_cmd_status(sc, &cmd, status); } void @@ -491,7 +490,7 @@ iwm_dma_contig_free(struct iwm_dma_info *dma) } /** - * iwm_mvm_send_lq_cmd() - Send link quality command + * iwm_send_lq_cmd() - Send link quality command * @init: This command is sent as part of station initialization right * after station has been added. * @@ -501,7 +500,7 @@ iwm_dma_contig_free(struct iwm_dma_info *dma) * progress. */ int -iwm_mvm_send_lq_cmd(struct iwm_softc *sc, struct iwm_lq_cmd *lq, boolean_t init) +iwm_send_lq_cmd(struct iwm_softc *sc, struct iwm_lq_cmd *lq, boolean_t init) { struct iwm_host_cmd cmd = { .id = IWM_LQ_CMD, @@ -510,16 +509,16 @@ iwm_mvm_send_lq_cmd(struct iwm_softc *sc, struct iwm_lq_cmd *lq, boolean_t init) .data = { lq, }, }; - if (lq->sta_id == IWM_MVM_STATION_COUNT) + if (lq->sta_id == IWM_STATION_COUNT) return EINVAL; return iwm_send_cmd(sc, &cmd); } boolean_t -iwm_mvm_rx_diversity_allowed(struct iwm_softc *sc) +iwm_rx_diversity_allowed(struct iwm_softc *sc) { - if (num_of_ant(iwm_mvm_get_valid_rx_ant(sc)) == 1) + if (num_of_ant(iwm_get_valid_rx_ant(sc)) == 1) return FALSE; /* diff --git a/src/add-ons/kernel/drivers/network/wlan/idualwifi7260/dev/iwm/if_iwm_util.h b/src/add-ons/kernel/drivers/network/wlan/idualwifi7260/dev/iwm/if_iwm_util.h index 60eb8e7afe..1ac304c0d9 100644 --- a/src/add-ons/kernel/drivers/network/wlan/idualwifi7260/dev/iwm/if_iwm_util.h +++ b/src/add-ons/kernel/drivers/network/wlan/idualwifi7260/dev/iwm/if_iwm_util.h @@ -1,5 +1,5 @@ /* $OpenBSD: if_iwm.c,v 1.39 2015/03/23 00:35:19 jsg Exp $ */ -/* $FreeBSD: releng/12.0/sys/dev/iwm/if_iwm_util.h 321510 2017-07-26 05:51:31Z adrian $ */ +/* $FreeBSD$ */ /* * Copyright (c) 2014 genua mbh @@ -107,12 +107,12 @@ #define __IF_IWM_UTIL_H__ extern int iwm_send_cmd(struct iwm_softc *sc, struct iwm_host_cmd *hcmd); -extern int iwm_mvm_send_cmd_pdu(struct iwm_softc *sc, uint32_t id, +extern int iwm_send_cmd_pdu(struct iwm_softc *sc, uint32_t id, uint32_t flags, uint16_t len, const void *data); -extern int iwm_mvm_send_cmd_status(struct iwm_softc *sc, +extern int iwm_send_cmd_status(struct iwm_softc *sc, struct iwm_host_cmd *cmd, uint32_t *status); -extern int iwm_mvm_send_cmd_pdu_status(struct iwm_softc *sc, uint32_t id, +extern int iwm_send_cmd_pdu_status(struct iwm_softc *sc, uint32_t id, uint16_t len, const void *data, uint32_t *status); extern void iwm_free_resp(struct iwm_softc *sc, struct iwm_host_cmd *hcmd); @@ -120,18 +120,18 @@ extern int iwm_dma_contig_alloc(bus_dma_tag_t tag, struct iwm_dma_info *dma, bus_size_t size, bus_size_t alignment); extern void iwm_dma_contig_free(struct iwm_dma_info *); -extern int iwm_mvm_send_lq_cmd(struct iwm_softc *sc, struct iwm_lq_cmd *lq, +extern int iwm_send_lq_cmd(struct iwm_softc *sc, struct iwm_lq_cmd *lq, boolean_t init); -extern boolean_t iwm_mvm_rx_diversity_allowed(struct iwm_softc *sc); +extern boolean_t iwm_rx_diversity_allowed(struct iwm_softc *sc); extern uint8_t iwm_ridx2rate(struct ieee80211_rateset *rs, int ridx); extern int iwm_enable_txq(struct iwm_softc *sc, int sta_id, int qid, int fifo); -extern int iwm_mvm_flush_tx_path(struct iwm_softc *sc, uint32_t tfd_msk, +extern int iwm_flush_tx_path(struct iwm_softc *sc, uint32_t tfd_msk, uint32_t flags); static inline uint8_t -iwm_mvm_get_valid_tx_ant(struct iwm_softc *sc) +iwm_get_valid_tx_ant(struct iwm_softc *sc) { return sc->nvm_data && sc->nvm_data->valid_tx_ant ? sc->sc_fw.valid_tx_ant & sc->nvm_data->valid_tx_ant : @@ -139,7 +139,7 @@ iwm_mvm_get_valid_tx_ant(struct iwm_softc *sc) } static inline uint8_t -iwm_mvm_get_valid_rx_ant(struct iwm_softc *sc) +iwm_get_valid_rx_ant(struct iwm_softc *sc) { return sc->nvm_data && sc->nvm_data->valid_rx_ant ? sc->sc_fw.valid_rx_ant & sc->nvm_data->valid_rx_ant : @@ -147,12 +147,12 @@ iwm_mvm_get_valid_rx_ant(struct iwm_softc *sc) } static inline uint32_t -iwm_mvm_get_phy_config(struct iwm_softc *sc) +iwm_get_phy_config(struct iwm_softc *sc) { uint32_t phy_config = ~(IWM_FW_PHY_CFG_TX_CHAIN | IWM_FW_PHY_CFG_RX_CHAIN); - uint32_t valid_rx_ant = iwm_mvm_get_valid_rx_ant(sc); - uint32_t valid_tx_ant = iwm_mvm_get_valid_tx_ant(sc); + uint32_t valid_rx_ant = iwm_get_valid_rx_ant(sc); + uint32_t valid_tx_ant = iwm_get_valid_tx_ant(sc); phy_config |= valid_tx_ant << IWM_FW_PHY_CFG_TX_CHAIN_POS | valid_rx_ant << IWM_FW_PHY_CFG_RX_CHAIN_POS; diff --git a/src/add-ons/kernel/drivers/network/wlan/idualwifi7260/dev/iwm/if_iwmreg.h b/src/add-ons/kernel/drivers/network/wlan/idualwifi7260/dev/iwm/if_iwmreg.h index 82581467fc..310b2d53a8 100644 --- a/src/add-ons/kernel/drivers/network/wlan/idualwifi7260/dev/iwm/if_iwmreg.h +++ b/src/add-ons/kernel/drivers/network/wlan/idualwifi7260/dev/iwm/if_iwmreg.h @@ -1,5 +1,5 @@ /* $OpenBSD: if_iwmreg.h,v 1.4 2015/06/15 08:06:11 stsp Exp $ */ -/* $FreeBSD: releng/12.0/sys/dev/iwm/if_iwmreg.h 327231 2017-12-27 03:23:21Z eadler $ */ +/* $FreeBSD$ */ /****************************************************************************** * @@ -289,7 +289,7 @@ #define IWM_CSR_GP_CNTRL_REG_VAL_MAC_ACCESS_EN (0x00000001) #define IWM_CSR_GP_CNTRL_REG_MSK_POWER_SAVE_TYPE (0x07000000) -#define IWM_CSR_GP_CNTRL_REG_FLAG_MAC_POWER_SAVE (0x04000000) +#define IWM_CSR_GP_CNTRL_REG_FLAG_RFKILL_WAKE_L1A_EN (0x04000000) #define IWM_CSR_GP_CNTRL_REG_FLAG_HW_RF_KILL_SW (0x08000000) @@ -457,6 +457,10 @@ enum iwm_secure_boot_status_reg { #define IWM_LMPM_CHICK 0xa01ff8 #define IWM_LMPM_CHICK_EXTENDED_ADDR_SPACE 0x01 +#define IWM_UREG_CHICK 0xa05c00 +#define IWM_UREG_CHICK_MSI_ENABLE 0x01000000 +#define IWM_UREG_CHICK_MSIX_ENABLE 0x02000000 + #define IWM_FH_TCSR_0_REG0 (0x1D00) /* @@ -635,6 +639,40 @@ P2P_PS_SCM\31UAPSD_SUPPORT\32EBS\33P2P_PS_UAPSD\36BCAST_FILTERING\37GO_UAPSD\40L * longer than the passive one, which is essential for fragmented scan. * @IWM_UCODE_TLV_API_WIFI_MCC_UPDATE: ucode supports MCC updates with source. * @IWM_UCODE_TLV_API_LQ_SS_PARAMS: Configure STBC/BFER via LQ CMD ss_params + * @IWM_UCODE_TLV_API_NEW_VERSION: new versioning format + * @IWM_UCODE_TLV_API_SCAN_TSF_REPORT: Scan start time reported in scan + * iteration complete notification, and the timestamp reported for RX + * received during scan, are reported in TSF of the mac specified in the + * scan request. + * @IWM_UCODE_TLV_API_TKIP_MIC_KEYS: This ucode supports version 2 of + * ADD_MODIFY_STA_KEY_API_S_VER_2. + * @IWM_UCODE_TLV_API_STA_TYPE: This ucode supports station type assignement. + * @IWM_UCODE_TLV_API_NAN2_VER2: This ucode supports NAN API version 2 + * @IWM_UCODE_TLV_API_NEW_RX_STATS: should new RX STATISTICS API be used + * @IWM_UCODE_TLV_API_QUOTA_LOW_LATENCY: Quota command includes a field + * indicating low latency direction. + * @IWM_UCODE_TLV_API_DEPRECATE_TTAK: RX status flag TTAK ok (bit 7) is + * deprecated. + * @IWM_UCODE_TLV_API_ADAPTIVE_DWELL_V2: This ucode supports version 8 + * of scan request: SCAN_REQUEST_CMD_UMAC_API_S_VER_8 + * @IWM_UCODE_TLV_API_FRAG_EBS: This ucode supports fragmented EBS + * @IWM_UCODE_TLV_API_REDUCE_TX_POWER: This ucode supports v5 of + * the REDUCE_TX_POWER_CMD. + * @IWM_UCODE_TLV_API_SHORT_BEACON_NOTIF: This ucode supports the short + * version of the beacon notification. + * @IWM_UCODE_TLV_API_BEACON_FILTER_V4: This ucode supports v4 of + * BEACON_FILTER_CONFIG_API_S_VER_4. + * @IWM_UCODE_TLV_API_REGULATORY_NVM_INFO: This ucode supports v4 of + * REGULATORY_NVM_GET_INFO_RSP_API_S. + * @IWM_UCODE_TLV_API_FTM_NEW_RANGE_REQ: This ucode supports v7 of + * LOCATION_RANGE_REQ_CMD_API_S and v6 of LOCATION_RANGE_RESP_NTFY_API_S. + * @IWM_UCODE_TLV_API_SCAN_OFFLOAD_CHANS: This ucode supports v2 of + * SCAN_OFFLOAD_PROFILE_MATCH_RESULTS_S and v3 of + * SCAN_OFFLOAD_PROFILES_QUERY_RSP_S. + * @IWM_UCODE_TLV_API_MBSSID_HE: This ucode supports v2 of + * STA_CONTEXT_DOT11AX_API_S + * @IWM_UCODE_TLV_CAPA_SAR_TABLE_VER: This ucode supports different sar + * version tables. * * @IWM_NUM_UCODE_TLV_API: number of bits used */ @@ -642,13 +680,36 @@ enum iwm_ucode_tlv_api { IWM_UCODE_TLV_API_FRAGMENTED_SCAN = 8, IWM_UCODE_TLV_API_WIFI_MCC_UPDATE = 9, IWM_UCODE_TLV_API_LQ_SS_PARAMS = 18, + IWM_UCODE_TLV_API_NEW_VERSION = 20, + IWM_UCODE_TLV_API_SCAN_TSF_REPORT = 28, + IWM_UCODE_TLV_API_TKIP_MIC_KEYS = 29, + IWM_UCODE_TLV_API_STA_TYPE = 30, + IWM_UCODE_TLV_API_NAN2_VER2 = 31, + IWM_UCODE_TLV_API_ADAPTIVE_DWELL = 32, + IWM_UCODE_TLV_API_OCE = 33, + IWM_UCODE_TLV_API_NEW_BEACON_TEMPLATE = 34, + IWM_UCODE_TLV_API_NEW_RX_STATS = 35, + IWM_UCODE_TLV_API_WOWLAN_KEY_MATERIAL = 36, + IWM_UCODE_TLV_API_QUOTA_LOW_LATENCY = 38, + IWM_UCODE_TLV_API_DEPRECATE_TTAK = 41, + IWM_UCODE_TLV_API_ADAPTIVE_DWELL_V2 = 42, + IWM_UCODE_TLV_API_FRAG_EBS = 44, + IWM_UCODE_TLV_API_REDUCE_TX_POWER = 45, + IWM_UCODE_TLV_API_SHORT_BEACON_NOTIF = 46, + IWM_UCODE_TLV_API_BEACON_FILTER_V4 = 47, + IWM_UCODE_TLV_API_REGULATORY_NVM_INFO = 48, + IWM_UCODE_TLV_API_FTM_NEW_RANGE_REQ = 49, + IWM_UCODE_TLV_API_SCAN_OFFLOAD_CHANS = 50, + IWM_UCODE_TLV_API_MBSSID_HE = 52, + IWM_UCODE_TLV_API_WOWLAN_TCP_SYN_WAKE = 53, + IWM_UCODE_TLV_API_FTM_RTT_ACCURACY = 54, + IWM_UCODE_TLV_API_SAR_TABLE_VER = 55, + IWM_UCODE_TLV_API_ADWELL_HB_DEF_N_AP = 57, + IWM_UCODE_TLV_API_SCAN_EXT_CHAN_VER = 58, - IWM_NUM_UCODE_TLV_API = 32 + IWM_NUM_UCODE_TLV_API = 128, }; -#define IWM_UCODE_TLV_API_BITS \ - "\020\10FRAGMENTED_SCAN\11WIFI_MCC_UPDATE\16WIDE_CMD_HDR\22LQ_SS_PARAMS\30EXT_SCAN_PRIO\33TX_POWER_CHAIN" - /** * enum iwm_ucode_tlv_capa - ucode capabilities * @IWM_UCODE_TLV_CAPA_D0I3_SUPPORT: supports D0i3 @@ -845,7 +906,7 @@ struct iwm_fw_cipher_scheme { */ struct iwm_fw_cscheme_list { uint8_t size; - struct iwm_fw_cipher_scheme cs[0]; + struct iwm_fw_cipher_scheme cs[]; } __packed; /* @@ -933,6 +994,7 @@ enum iwm_ucode_tlv_type { IWM_UCODE_TLV_FW_DBG_DEST = 38, IWM_UCODE_TLV_FW_DBG_CONF = 39, IWM_UCODE_TLV_FW_DBG_TRIGGER = 40, + IWM_UCODE_TLV_CMD_VERSIONS = 48, IWM_UCODE_TLV_FW_GSCAN_CAPA = 50, IWM_UCODE_TLV_FW_MEM_SEG = 51, }; @@ -1469,6 +1531,52 @@ static inline unsigned int IWM_FH_MEM_CBBC_QUEUE(unsigned int chnl) #define IWM_FH_MEM_TFDIB_REG1_ADDR_BITSHIFT 28 +/* 9000 rx series registers */ + +#define IWM_RFH_Q0_FRBDCB_BA_LSB 0xa08000 +#define IWM_RFH_Q_FRBDCB_BA_LSB (IWM_RFH_Q0_FRBDCB_BA_LSB + (q) * 8) +/* Write index table */ +#define IWM_RFH_Q0_FRBDCB_WIDX 0xa08080 +#define IWM_RFH_Q_FRBDCB_WIDX (IWM_RFH_Q0_FRBDCB_WIDX + (q) * 4) +/* Write index table - shadow registers */ +#define IWM_RFH_Q0_FRBDCB_WIDX_TRG 0x1c80 +#define IWM_RFH_Q_FRBDCB_WIDX_TRG (IWM_RFH_Q0_FRBDCB_WIDX_TRG + (q) * 4) +/* Read index table */ +#define IWM_RFH_Q0_FRBDCB_RIDX 0xa080c0 +#define IWM_RFH_Q_FRBDCB_RIDX (IWM_RFH_Q0_FRBDCB_RIDX + (q) * 4) +/* Used list table */ +#define IWM_RFH_Q0_URBDCB_BA_LSB 0xa08100 +#define IWM_RFH_Q_URBDCB_BA_LSB (IWM_RFH_Q0_URBDCB_BA_LSB + (q) * 8) +/* Write index table */ +#define IWM_RFH_Q0_URBDCB_WIDX 0xa08180 +#define IWM_RFH_Q_URBDCB_WIDX (IWM_RFH_Q0_URBDCB_WIDX + (q) * 4) +/* stts */ +#define IWM_RFH_Q0_URBD_STTS_WPTR_LSB 0xa08200 +#define IWM_RFH_Q_URBD_STTS_WPTR_LSB (IWM_RFH_Q0_URBD_STTS_WPTR_LSB + (q) * 8) + +#define IWM_RFH_GEN_STATUS 0xa09808 +#define IWM_RXF_DMA_IDLE 0x80000000 + +/* DMA configuration */ +#define IWM_RFH_RXF_DMA_CFG 0xa09820 +#define IWM_RFH_RXF_DMA_RB_SIZE_1K 0x00010000 +#define IWM_RFH_RXF_DMA_RB_SIZE_2K 0x00020000 +#define IWM_RFH_RXF_DMA_RB_SIZE_4K 0x00040000 +#define IWM_RFH_RXF_DMA_RBDCB_SIZE_512 0x00900000 +#define IWM_RFH_RXF_DMA_MIN_RB_4_8 0x03000000 +#define IWM_RFH_RXF_DMA_DROP_TOO_LARGE_MASK 0x04000000 +#define IWM_RFH_DMA_EN_ENABLE_VAL 0x80000000 + +#define IWM_RFH_GEN_CFG 0xa09800 +#define IWM_RFH_GEN_CFG_SERVICE_DMA_SNOOP 0x00000001 +#define IWM_RFH_GEN_CFG_RFH_DMA_SNOOP 0x00000002 +#define IWM_RFH_GEN_CFG_RB_CHUNK_SIZE_128 0x00000010 +#define IWM_RFH_GEN_CFG_RB_CHUNK_SIZE_64 0x00000000 + +#define IWM_RFH_RXF_RXQ_ACTIVE 0xa0980c + +/* end of 9000 rx series registers */ + /* TFDB Area - TFDs buffer table */ #define IWM_FH_MEM_TFDIB_DRAM_ADDR_LSB_MSK (0xFFFFFFFF) #define IWM_FH_TFDIB_LOWER_BOUND (IWM_FH_MEM_LOWER_BOUND + 0x900) @@ -1706,29 +1814,29 @@ struct iwm_agn_scd_bc_tbl { */ /* Maximum number of Tx queues. */ -#define IWM_MVM_MAX_QUEUES 31 +#define IWM_MAX_QUEUES 31 /* Tx queue numbers */ enum { - IWM_MVM_OFFCHANNEL_QUEUE = 8, - IWM_MVM_CMD_QUEUE = 9, - IWM_MVM_AUX_QUEUE = 15, + IWM_OFFCHANNEL_QUEUE = 8, + IWM_CMD_QUEUE = 9, + IWM_AUX_QUEUE = 15, }; -enum iwm_mvm_tx_fifo { - IWM_MVM_TX_FIFO_BK = 0, - IWM_MVM_TX_FIFO_BE, - IWM_MVM_TX_FIFO_VI, - IWM_MVM_TX_FIFO_VO, - IWM_MVM_TX_FIFO_MCAST = 5, - IWM_MVM_TX_FIFO_CMD = 7, +enum iwm_tx_fifo { + IWM_TX_FIFO_BK = 0, + IWM_TX_FIFO_BE, + IWM_TX_FIFO_VI, + IWM_TX_FIFO_VO, + IWM_TX_FIFO_MCAST = 5, + IWM_TX_FIFO_CMD = 7, }; -#define IWM_MVM_STATION_COUNT 16 +#define IWM_STATION_COUNT 16 /* commands */ enum { - IWM_MVM_ALIVE = 0x1, + IWM_ALIVE = 0x1, IWM_REPLY_ERROR = 0x2, IWM_INIT_COMPLETE_NOTIF = 0x4, @@ -2032,6 +2140,7 @@ enum { IWM_NVM_SECTION_TYPE_REGULATORY = 3, IWM_NVM_SECTION_TYPE_CALIBRATION = 4, IWM_NVM_SECTION_TYPE_PRODUCTION = 5, + IWM_NVM_SECTION_TYPE_REGULATORY_SDP = 8, IWM_NVM_SECTION_TYPE_MAC_OVERRIDE = 11, IWM_NVM_SECTION_TYPE_PHY_SKU = 12, IWM_NVM_MAX_NUM_SECTIONS = 13, @@ -2052,7 +2161,7 @@ struct iwm_nvm_access_cmd { uint16_t type; uint16_t offset; uint16_t length; - uint8_t data[0]; + uint8_t data[]; } __packed; /* IWM_NVM_ACCESS_CMD_API_S_VER_2 */ #define IWM_NUM_OF_FW_PAGING_BLOCKS 33 /* 32 for data and 1 block for CSS */ @@ -2106,10 +2215,10 @@ struct iwm_nvm_access_resp { uint16_t length; uint16_t type; uint16_t status; - uint8_t data[0]; + uint8_t data[]; } __packed; /* IWM_NVM_ACCESS_CMD_RESP_API_S_VER_2 */ -/* IWM_MVM_ALIVE 0x1 */ +/* IWM_ALIVE 0x1 */ /* alive response is_valid values */ #define IWM_ALIVE_RESP_UCODE_OK (1 << 0) @@ -2167,14 +2276,14 @@ struct iwm_umac_alive { uint32_t dbg_print_buff_addr; } __packed; /* UMAC_ALIVE_DATA_API_S_VER_2 */ -struct iwm_mvm_alive_resp_v3 { +struct iwm_alive_resp_v3 { uint16_t status; uint16_t flags; struct iwm_lmac_alive lmac_data; struct iwm_umac_alive umac_data; } __packed; /* ALIVE_RES_API_S_VER_3 */ -struct iwm_mvm_alive_resp { +struct iwm_alive_resp { uint16_t status; uint16_t flags; struct iwm_lmac_alive lmac_data[2]; @@ -2513,7 +2622,7 @@ struct iwm_binding_cmd { } __packed; /* IWM_BINDING_CMD_API_S_VER_1 */ /* The maximal number of fragments in the FW's schedule session */ -#define IWM_MVM_MAX_QUOTA 128 +#define IWM_MAX_QUOTA 128 /** * struct iwm_time_quota_data - configuration of time quota per binding @@ -2737,7 +2846,7 @@ enum iwm_rx_phy_flags { }; /** - * enum iwm_mvm_rx_status - written by fw for each Rx packet + * enum iwm_rx_status - written by fw for each Rx packet * @IWM_RX_MPDU_RES_STATUS_CRC_OK: CRC is fine * @IWM_RX_MPDU_RES_STATUS_OVERRUN_OK: there was no RXE overflow * @IWM_RX_MPDU_RES_STATUS_SRC_STA_FOUND: @@ -2768,7 +2877,7 @@ enum iwm_rx_phy_flags { * @IWM_RX_MPDU_RES_STATUS_FILTERING_MSK: * @IWM_RX_MPDU_RES_STATUS2_FILTERING_MSK: */ -enum iwm_mvm_rx_status { +enum iwm_rx_status { IWM_RX_MPDU_RES_STATUS_CRC_OK = (1 << 0), IWM_RX_MPDU_RES_STATUS_OVERRUN_OK = (1 << 1), IWM_RX_MPDU_RES_STATUS_SRC_STA_FOUND = (1 << 2), @@ -2798,6 +2907,69 @@ enum iwm_mvm_rx_status { IWM_RX_MPDU_RES_STATUS2_FILTERING_MSK = (0xc0000000), }; +enum iwm_rx_mpdu_mac_flags1 { + IWM_RX_MPDU_MFLG1_ADDRTYPE_MASK = 0x03, + IWM_RX_MPDU_MFLG1_MIC_CRC_LEN_MASK = 0xf0, + IWM_RX_MPDU_MFLG1_MIC_CRC_LEN_SHIFT = 3, +}; + +enum iwm_rx_mpdu_mac_flags2 { + IWM_RX_MPDU_MFLG2_HDR_LEN_MASK = 0x1f, + IWM_RX_MPDU_MFLG2_PAD = 0x20, + IWM_RX_MPDU_MFLG2_AMSDU = 0x40, +}; + +enum iwm_rx_mpdu_phy_info { + IWM_RX_MPDU_PHY_AMPDU = (1 << 5), + IWM_RX_MPDU_PHY_AMPDU_TOGGLE = (1 << 6), + IWM_RX_MPDU_PHY_SHORT_PREAMBLE = (1 << 7), + IWM_RX_MPDU_PHY_NCCK_ADDTL_NTFY = (1 << 7), + IWM_RX_MPDU_PHY_TSF_OVERLOAD = (1 << 8), +}; + +struct iwm_rx_mpdu_desc_v1 { + union { + uint32_t rss_hash; + uint32_t phy_data2; + }; + union { + uint32_t filter_match; + uint32_t phy_data3; + }; + uint32_t rate_n_flags; + uint8_t energy_a; + uint8_t energy_b; + uint8_t channel; + uint8_t mac_context; + uint32_t gp2_on_air_rise; + union { + uint64_t tsf_on_air_rise; + struct { + uint32_t phy_data0; + uint32_t phy_data1; + }; + }; +} __packed; + +struct iwm_rx_mpdu_desc { + uint16_t mpdu_len; + uint8_t mac_flags1; + uint8_t mac_flags2; + uint8_t amsdu_info; + uint16_t phy_info; + uint8_t mac_phy_idx; + uint16_t raw_csum; + union { + uint16_t l3l4_flags; + uint16_t phy_data4; + }; + uint16_t status; + uint8_t hash_filter; + uint8_t sta_id_flags; + uint32_t reorder_data; + struct iwm_rx_mpdu_desc_v1 v1; +} __packed; + /** * struct iwm_radio_version_notif - information on the radio version * ( IWM_RADIO_VERSION_NOTIFICATION = 0x68 ) @@ -2914,14 +3086,14 @@ struct iwm_mcast_filter_cmd { /*********************************** * Statistics API ***********************************/ -struct iwm_mvm_statistics_dbg { +struct iwm_statistics_dbg { uint32_t burst_check; uint32_t burst_count; uint32_t wait_for_silence_timeout_cnt; uint32_t reserved[3]; } __packed; /* IWM_STATISTICS_DEBUG_API_S_VER_2 */ -struct iwm_mvm_statistics_div { +struct iwm_statistics_div { uint32_t tx_on_a; uint32_t tx_on_b; uint32_t exec_time; @@ -2930,7 +3102,7 @@ struct iwm_mvm_statistics_div { uint32_t reserved2; } __packed; /* IWM_STATISTICS_SLOW_DIV_API_S_VER_2 */ -struct iwm_mvm_statistics_rx_non_phy { +struct iwm_statistics_rx_non_phy { uint32_t bogus_cts; /* CTS received when not expecting CTS */ uint32_t bogus_ack; /* ACK received when not expecting ACK */ uint32_t non_bssid_frames; /* number of frames with BSSID that @@ -2964,7 +3136,7 @@ struct iwm_mvm_statistics_rx_non_phy { uint32_t directed_data_mpdu; } __packed; /* IWM_STATISTICS_RX_NON_PHY_API_S_VER_3 */ -struct iwm_mvm_statistics_rx_phy { +struct iwm_statistics_rx_phy { uint32_t ina_cnt; uint32_t fina_cnt; uint32_t plcp_err; @@ -2987,7 +3159,7 @@ struct iwm_mvm_statistics_rx_phy { uint32_t reserved; } __packed; /* IWM_STATISTICS_RX_PHY_API_S_VER_2 */ -struct iwm_mvm_statistics_rx_ht_phy { +struct iwm_statistics_rx_ht_phy { uint32_t plcp_err; uint32_t overrun_err; uint32_t early_overrun_err; @@ -3000,7 +3172,7 @@ struct iwm_mvm_statistics_rx_ht_phy { uint32_t unsupport_mcs; } __packed; /* IWM_STATISTICS_HT_RX_PHY_API_S_VER_1 */ -struct iwm_mvm_statistics_tx_non_phy { +struct iwm_statistics_tx_non_phy { uint32_t preamble_cnt; uint32_t rx_detected_cnt; uint32_t bt_prio_defer_cnt; @@ -3019,7 +3191,7 @@ struct iwm_mvm_statistics_tx_non_phy { #define IWM_MAX_CHAINS 3 -struct iwm_mvm_statistics_tx_non_phy_agg { +struct iwm_statistics_tx_non_phy_agg { uint32_t ba_timeout; uint32_t ba_reschedule_frames; uint32_t scd_query_agg_frame_cnt; @@ -3035,7 +3207,7 @@ struct iwm_mvm_statistics_tx_non_phy_agg { uint32_t reserved2; } __packed; /* IWM_STATISTICS_TX_NON_PHY_AGG_API_S_VER_1 */ -struct iwm_mvm_statistics_tx_channel_width { +struct iwm_statistics_tx_channel_width { uint32_t ext_cca_narrow_ch20[1]; uint32_t ext_cca_narrow_ch40[2]; uint32_t ext_cca_narrow_ch80[3]; @@ -3046,14 +3218,14 @@ struct iwm_mvm_statistics_tx_channel_width { uint32_t fail_per_ch_width[4]; }; /* IWM_STATISTICS_TX_CHANNEL_WIDTH_API_S_VER_1 */ -struct iwm_mvm_statistics_tx { - struct iwm_mvm_statistics_tx_non_phy general; - struct iwm_mvm_statistics_tx_non_phy_agg agg; - struct iwm_mvm_statistics_tx_channel_width channel_width; +struct iwm_statistics_tx { + struct iwm_statistics_tx_non_phy general; + struct iwm_statistics_tx_non_phy_agg agg; + struct iwm_statistics_tx_channel_width channel_width; } __packed; /* IWM_STATISTICS_TX_API_S_VER_4 */ -struct iwm_mvm_statistics_bt_activity { +struct iwm_statistics_bt_activity { uint32_t hi_priority_tx_req_cnt; uint32_t hi_priority_tx_denied_cnt; uint32_t lo_priority_tx_req_cnt; @@ -3064,15 +3236,15 @@ struct iwm_mvm_statistics_bt_activity { uint32_t lo_priority_rx_denied_cnt; } __packed; /* IWM_STATISTICS_BT_ACTIVITY_API_S_VER_1 */ -struct iwm_mvm_statistics_general_v8 { +struct iwm_statistics_general_v8 { uint32_t radio_temperature; uint32_t radio_voltage; - struct iwm_mvm_statistics_dbg dbg; + struct iwm_statistics_dbg dbg; uint32_t sleep_time; uint32_t slots_out; uint32_t slots_idle; uint32_t ttl_timestamp; - struct iwm_mvm_statistics_div slow_div; + struct iwm_statistics_div slow_div; uint32_t rx_enable_counter; /* * num_of_sos_states: @@ -3087,7 +3259,7 @@ struct iwm_mvm_statistics_general_v8 { uint8_t beacon_filter_current_energy; uint8_t beacon_filter_reserved; uint32_t beacon_filter_delta_time; - struct iwm_mvm_statistics_bt_activity bt_activity; + struct iwm_statistics_bt_activity bt_activity; uint64_t rx_time; uint64_t on_time_rf; uint64_t on_time_scan; @@ -3097,11 +3269,11 @@ struct iwm_mvm_statistics_general_v8 { uint8_t reserved[4 - (IWM_NUM_MAC_INDEX % 4)]; } __packed; /* IWM_STATISTICS_GENERAL_API_S_VER_8 */ -struct iwm_mvm_statistics_rx { - struct iwm_mvm_statistics_rx_phy ofdm; - struct iwm_mvm_statistics_rx_phy cck; - struct iwm_mvm_statistics_rx_non_phy general; - struct iwm_mvm_statistics_rx_ht_phy ofdm_ht; +struct iwm_statistics_rx { + struct iwm_statistics_rx_phy ofdm; + struct iwm_statistics_rx_phy cck; + struct iwm_statistics_rx_non_phy general; + struct iwm_statistics_rx_ht_phy ofdm_ht; } __packed; /* IWM_STATISTICS_RX_API_S_VER_3 */ /* @@ -3114,9 +3286,9 @@ struct iwm_mvm_statistics_rx { struct iwm_notif_statistics_v10 { uint32_t flag; - struct iwm_mvm_statistics_rx rx; - struct iwm_mvm_statistics_tx tx; - struct iwm_mvm_statistics_general_v8 general; + struct iwm_statistics_rx rx; + struct iwm_statistics_tx tx; + struct iwm_statistics_general_v8 general; } __packed; /* IWM_STATISTICS_NTFY_API_S_VER_10 */ #define IWM_STATISTICS_FLG_CLEAR 0x1 @@ -3505,7 +3677,7 @@ struct iwm_mac_ctx_cmd { }; } __packed; /* IWM_MAC_CONTEXT_CMD_API_S_VER_1 */ -static inline uint32_t iwm_mvm_reciprocal(uint32_t v) +static inline uint32_t iwm_reciprocal(uint32_t v) { if (!v) return 0; @@ -4305,13 +4477,41 @@ enum iwm_tx_pm_timeouts { #define IWM_BAR_DFAULT_RETRY_LIMIT 60 #define IWM_LOW_RETRY_LIMIT 7 +/** + * enum iwm_tx_offload_assist_flags_pos - set %iwm_tx_cmd offload_assist values + * @IWM_TX_CMD_OFFLD_IP_HDR: offset to start of IP header (in words) + * from mac header end. For normal case it is 4 words for SNAP. + * note: tx_cmd, mac header and pad are not counted in the offset. + * This is used to help the offload in case there is tunneling such as + * IPv6 in IPv4, in such case the ip header offset should point to the + * inner ip header and IPv4 checksum of the external header should be + * calculated by driver. + * @IWM_TX_CMD_OFFLD_L4_EN: enable TCP/UDP checksum + * @IWM_TX_CMD_OFFLD_L3_EN: enable IP header checksum + * @IWM_TX_CMD_OFFLD_MH_SIZE: size of the mac header in words. Includes the IV + * field. Doesn't include the pad. + * @IWM_TX_CMD_OFFLD_PAD: mark 2-byte pad was inserted after the mac header for + * alignment + * @IWM_TX_CMD_OFFLD_AMSDU: mark TX command is A-MSDU + */ +enum iwm_tx_offload_assist_flags_pos { + IWM_TX_CMD_OFFLD_IP_HDR = 0, + IWM_TX_CMD_OFFLD_L4_EN = 6, + IWM_TX_CMD_OFFLD_L3_EN = 7, + IWM_TX_CMD_OFFLD_MH_SIZE = 8, + IWM_TX_CMD_OFFLD_PAD = 13, + IWM_TX_CMD_OFFLD_AMSDU = 14, +}; + +#define IWM_TX_CMD_OFFLD_MH_MASK 0x1f +#define IWM_TX_CMD_OFFLD_IP_HDR_MASK 0x3f + /* TODO: complete documentation for try_cnt and btkill_cnt */ /** * struct iwm_tx_cmd - TX command struct to FW * ( IWM_TX_CMD = 0x1c ) * @len: in bytes of the payload, see below for details - * @next_frame_len: same as len, but for next frame (0 if not applicable) - * Used for fragmentation and bursting, but not in 11n aggregation. + * @offload_assist: TX offload configuration * @tx_flags: combination of IWM_TX_CMD_FLG_* * @rate_n_flags: rate for *all* Tx attempts, if IWM_TX_CMD_FLG_STA_RATE_MSK is * cleared. Combination of IWM_RATE_MCS_* @@ -4347,7 +4547,7 @@ enum iwm_tx_pm_timeouts { */ struct iwm_tx_cmd { uint16_t len; - uint16_t next_frame_len; + uint16_t offload_assist; uint32_t tx_flags; struct { uint8_t try_cnt; @@ -4360,8 +4560,7 @@ struct iwm_tx_cmd { uint8_t initial_rate_index; uint8_t reserved2; uint8_t key[16]; - uint16_t next_frame_flags; - uint16_t reserved3; + uint32_t reserved3; uint32_t life_time; uint32_t dram_lsb_ptr; uint8_t dram_msb_ptr; @@ -4369,7 +4568,7 @@ struct iwm_tx_cmd { uint8_t data_retry_limit; uint8_t tid_tspec; uint16_t pm_frame_timeout; - uint16_t driver_txop; + uint16_t reserved4; uint8_t payload[0]; struct ieee80211_frame hdr[0]; } __packed; /* IWM_TX_CMD_API_S_VER_3 */ @@ -4555,11 +4754,11 @@ struct iwm_agg_tx_status { #define IWM_TX_RES_RATE_TABLE_COLOR_MSK 0x70 #define IWM_TX_RES_INV_RATE_INDEX_MSK 0x80 -#define IWM_MVM_TX_RES_GET_TID(_ra_tid) ((_ra_tid) & 0x0f) -#define IWM_MVM_TX_RES_GET_RA(_ra_tid) ((_ra_tid) >> 4) +#define IWM_TX_RES_GET_TID(_ra_tid) ((_ra_tid) & 0x0f) +#define IWM_TX_RES_GET_RA(_ra_tid) ((_ra_tid) >> 4) /** - * struct iwm_mvm_tx_resp - notifies that fw is TXing a packet + * struct iwm_tx_resp - notifies that fw is TXing a packet * ( IWM_REPLY_TX = 0x1c ) * @frame_count: 1 no aggregation, >1 aggregation * @bt_kill_count: num of times blocked by bluetooth (unused for agg) @@ -4586,9 +4785,9 @@ struct iwm_agg_tx_status { * follow this one, up to frame_count. * * After the array of statuses comes the SSN of the SCD. Look at - * %iwm_mvm_get_scd_ssn for more details. + * %iwm_get_scd_ssn for more details. */ -struct iwm_mvm_tx_resp { +struct iwm_tx_resp { uint8_t frame_count; uint8_t bt_kill_count; uint8_t failure_rts; @@ -4615,7 +4814,7 @@ struct iwm_mvm_tx_resp { } __packed; /* IWM_TX_RSP_API_S_VER_3 */ /** - * struct iwm_mvm_ba_notif - notifies about reception of BA + * struct iwm_ba_notif - notifies about reception of BA * ( IWM_BA_NOTIF = 0xc5 ) * @sta_addr_lo32: lower 32 bits of the MAC address * @sta_addr_hi16: upper 16 bits of the MAC address @@ -4628,7 +4827,7 @@ struct iwm_mvm_tx_resp { * @txed: number of Txed frames in this batch * @txed_2_done: number of Acked frames in this batch */ -struct iwm_mvm_ba_notif { +struct iwm_ba_notif { uint32_t sta_addr_lo32; uint16_t sta_addr_hi16; uint16_t reserved; @@ -4662,7 +4861,7 @@ struct iwm_mac_beacon_cmd { } __packed; struct iwm_beacon_notif { - struct iwm_mvm_tx_resp beacon_notify_hdr; + struct iwm_tx_resp beacon_notify_hdr; uint64_t tsf; uint32_t ibss_mgr_status; } __packed; @@ -4689,7 +4888,7 @@ struct iwm_tx_path_flush_cmd { } __packed; /* IWM_TX_PATH_FLUSH_CMD_API_S_VER_1 */ /** - * iwm_mvm_get_scd_ssn - returns the SSN of the SCD + * iwm_get_scd_ssn - returns the SSN of the SCD * @tx_resp: the Tx response from the fw (agg or non-agg) * * When the fw sends an AMPDU, it fetches the MPDUs one after the other. Since @@ -4701,7 +4900,7 @@ struct iwm_tx_path_flush_cmd { * whole struct at a variable offset. This function knows how to cope with the * variable offset and returns the SSN of the SCD. */ -static inline uint32_t iwm_mvm_get_scd_ssn(struct iwm_mvm_tx_resp *tx_resp) +static inline uint32_t iwm_get_scd_ssn(struct iwm_tx_resp *tx_resp) { return le32_to_cpup((uint32_t *)&tx_resp->status + tx_resp->frame_count) & 0xfff; @@ -4723,7 +4922,7 @@ static inline uint32_t iwm_mvm_get_scd_ssn(struct iwm_mvm_tx_resp *tx_resp) * @scd_queue: scheduler queue to confiug * @enable: 1 queue enable, 0 queue disable * @aggregate: 1 aggregated queue, 0 otherwise - * @tx_fifo: %enum iwm_mvm_tx_fifo + * @tx_fifo: %enum iwm_tx_fifo * @window: BA window size * @ssn: SSN for the BA agreement */ @@ -4883,30 +5082,30 @@ struct iwm_scan_channel_opt { } __packed; /** - * iwm_mvm_lmac_scan_flags - * @IWM_MVM_LMAC_SCAN_FLAG_PASS_ALL: pass all beacons and probe responses + * iwm_lmac_scan_flags + * @IWM_LMAC_SCAN_FLAG_PASS_ALL: pass all beacons and probe responses * without filtering. - * @IWM_MVM_LMAC_SCAN_FLAG_PASSIVE: force passive scan on all channels - * @IWM_MVM_LMAC_SCAN_FLAG_PRE_CONNECTION: single channel scan - * @IWM_MVM_LMAC_SCAN_FLAG_ITER_COMPLETE: send iteration complete notification - * @IWM_MVM_LMAC_SCAN_FLAG_MULTIPLE_SSIDS multiple SSID matching - * @IWM_MVM_LMAC_SCAN_FLAG_FRAGMENTED: all passive scans will be fragmented - * @IWM_MVM_LMAC_SCAN_FLAGS_RRM_ENABLED: insert WFA vendor-specific TPC report + * @IWM_LMAC_SCAN_FLAG_PASSIVE: force passive scan on all channels + * @IWM_LMAC_SCAN_FLAG_PRE_CONNECTION: single channel scan + * @IWM_LMAC_SCAN_FLAG_ITER_COMPLETE: send iteration complete notification + * @IWM_LMAC_SCAN_FLAG_MULTIPLE_SSIDS multiple SSID matching + * @IWM_LMAC_SCAN_FLAG_FRAGMENTED: all passive scans will be fragmented + * @IWM_LMAC_SCAN_FLAGS_RRM_ENABLED: insert WFA vendor-specific TPC report * and DS parameter set IEs into probe requests. - * @IWM_MVM_LMAC_SCAN_FLAG_EXTENDED_DWELL: use extended dwell time on channels + * @IWM_LMAC_SCAN_FLAG_EXTENDED_DWELL: use extended dwell time on channels * 1, 6 and 11. - * @IWM_MVM_LMAC_SCAN_FLAG_MATCH: Send match found notification on matches + * @IWM_LMAC_SCAN_FLAG_MATCH: Send match found notification on matches */ -enum iwm_mvm_lmac_scan_flags { - IWM_MVM_LMAC_SCAN_FLAG_PASS_ALL = (1 << 0), - IWM_MVM_LMAC_SCAN_FLAG_PASSIVE = (1 << 1), - IWM_MVM_LMAC_SCAN_FLAG_PRE_CONNECTION = (1 << 2), - IWM_MVM_LMAC_SCAN_FLAG_ITER_COMPLETE = (1 << 3), - IWM_MVM_LMAC_SCAN_FLAG_MULTIPLE_SSIDS = (1 << 4), - IWM_MVM_LMAC_SCAN_FLAG_FRAGMENTED = (1 << 5), - IWM_MVM_LMAC_SCAN_FLAGS_RRM_ENABLED = (1 << 6), - IWM_MVM_LMAC_SCAN_FLAG_EXTENDED_DWELL = (1 << 7), - IWM_MVM_LMAC_SCAN_FLAG_MATCH = (1 << 9), +enum iwm_lmac_scan_flags { + IWM_LMAC_SCAN_FLAG_PASS_ALL = (1 << 0), + IWM_LMAC_SCAN_FLAG_PASSIVE = (1 << 1), + IWM_LMAC_SCAN_FLAG_PRE_CONNECTION = (1 << 2), + IWM_LMAC_SCAN_FLAG_ITER_COMPLETE = (1 << 3), + IWM_LMAC_SCAN_FLAG_MULTIPLE_SSIDS = (1 << 4), + IWM_LMAC_SCAN_FLAG_FRAGMENTED = (1 << 5), + IWM_LMAC_SCAN_FLAGS_RRM_ENABLED = (1 << 6), + IWM_LMAC_SCAN_FLAG_EXTENDED_DWELL = (1 << 7), + IWM_LMAC_SCAN_FLAG_MATCH = (1 << 9), }; enum iwm_scan_priority { @@ -4925,7 +5124,7 @@ enum iwm_scan_priority { * @extended_dwell: dwell time for channels 1, 6 and 11 (in certain cases) * @reserved2: for alignment and future use * @rx_chain_selct: PHY_RX_CHAIN_* flags - * @scan_flags: &enum iwm_mvm_lmac_scan_flags + * @scan_flags: &enum iwm_lmac_scan_flags * @max_out_time: max time (in TU) to be out of associated channel * @suspend_time: pause scan this long (TUs) when returning to service channel * @flags: RXON flags @@ -4964,7 +5163,7 @@ struct iwm_scan_req_lmac { uint32_t delay; struct iwm_scan_schedule_lmac schedule[IWM_MAX_SCHED_SCAN_PLANS]; struct iwm_scan_channel_opt channel_opt[2]; - uint8_t data[0]; + uint8_t data[]; } __packed; /** @@ -5102,7 +5301,7 @@ struct iwm_lmac_scan_complete_notif { uint8_t last_channel; uint32_t tsf_low; uint32_t tsf_high; - struct iwm_scan_results_notif results[0]; + struct iwm_scan_results_notif results[]; } __packed; @@ -5117,10 +5316,10 @@ struct iwm_lmac_scan_complete_notif { /* UMAC Scan API */ /* The maximum of either of these cannot exceed 8, because we use an - * 8-bit mask (see IWM_MVM_SCAN_MASK). + * 8-bit mask (see IWM_SCAN_MASK). */ -#define IWM_MVM_MAX_UMAC_SCANS 8 -#define IWM_MVM_MAX_LMAC_SCANS 1 +#define IWM_MAX_UMAC_SCANS 8 +#define IWM_MAX_LMAC_SCANS 1 enum iwm_scan_config_flags { IWM_SCAN_CONFIG_FLAG_ACTIVATE = (1 << 0), @@ -5205,7 +5404,7 @@ struct iwm_scan_config { uint8_t mac_addr[IEEE80211_ADDR_LEN]; uint8_t bcast_sta_id; uint8_t channel_flags; - uint8_t channel_array[0]; + uint8_t channel_array[]; } __packed; /* SCAN_CONFIG_DB_CMD_API_S */ /** @@ -5288,22 +5487,45 @@ struct iwm_scan_req_umac_tail { struct iwm_ssid_ie direct_scan[IWM_PROBE_OPTION_MAX]; } __packed; +/** + * struct iwm_scan_uma_chan_param + * @flags: channel flags &enum iwm_scan_channel_flags + * @count: num of channels in scan request + * @reserved: for future use and alignment + */ +struct iwm_scan_umac_chan_param { + uint8_t flags; + uint8_t count; + uint16_t reserved; +} __packed; + /** * struct iwm_scan_req_umac * @flags: &enum iwm_umac_scan_flags * @uid: scan id, &enum iwm_umac_scan_uid_offsets * @ooc_priority: out of channel priority - &enum iwm_scan_priority * @general_flags: &enum iwm_umac_scan_general_flags + * @scan_start_mac_id: report the scan start TSF time according to this mac TSF * @extended_dwell: dwell time for channels 1, 6 and 11 - * @active_dwell: dwell time for active scan - * @passive_dwell: dwell time for passive scan + * @active_dwell: dwell time for active scan per LMAC + * @passive_dwell: dwell time for passive scan per LMAC * @fragmented_dwell: dwell time for fragmented passive scan - * @max_out_time: max out of serving channel time - * @suspend_time: max suspend time - * @scan_priority: scan internal prioritization &enum iwm_scan_priority - * @channel_flags: &enum iwm_scan_channel_flags - * @n_channels: num of channels in scan request + * @adwell_default_n_aps: for adaptive dwell the default number of APs + * per channel + * @adwell_default_n_aps_social: for adaptive dwell the default + * number of APs per social (1,6,11) channel + * @general_flags2: &enum iwl_umac_scan_general_flags2 + * @adwell_max_budget: for adaptive dwell the maximal budget of TU to be added + * to total scan time + * @max_out_time: max out of serving channel time, per LMAC - for CDB there + * are 2 LMACs + * @suspend_time: max suspend time, per LMAC - for CDB there are 2 LMACs + * @scan_priority: scan internal prioritization &enum iwl_scan_priority + * @num_of_fragments: Number of fragments needed for full coverage per band. + * Relevant only for fragmented scan. + * @channel: &struct iwl_scan_umac_chan_param * @reserved: for future use and alignment + * @reserved3: for future use and alignment * @data: &struct iwm_scan_channel_cfg_umac and * &struct iwm_scan_req_umac_tail */ @@ -5311,21 +5533,40 @@ struct iwm_scan_req_umac { uint32_t flags; uint32_t uid; uint32_t ooc_priority; - /* SCAN_GENERAL_PARAMS_API_S_VER_1 */ - uint32_t general_flags; - uint8_t extended_dwell; - uint8_t active_dwell; - uint8_t passive_dwell; - uint8_t fragmented_dwell; - uint32_t max_out_time; - uint32_t suspend_time; - uint32_t scan_priority; - /* SCAN_CHANNEL_PARAMS_API_S_VER_1 */ - uint8_t channel_flags; - uint8_t n_channels; - uint16_t reserved; - uint8_t data[0]; -} __packed; /* SCAN_REQUEST_CMD_UMAC_API_S_VER_1 */ + uint16_t general_flags; + uint8_t reserved; + uint8_t scan_start_mac_id; + union { + struct { + uint8_t extended_dwell; + uint8_t active_dwell; + uint8_t passive_dwell; + uint8_t fragmented_dwell; + uint32_t max_out_time; + uint32_t suspend_time; + uint32_t scan_priority; + struct iwm_scan_umac_chan_param channel; + uint8_t data[]; + } v1; + struct { + uint8_t active_dwell; + uint8_t passive_dwell; + uint8_t fragmented_dwell; + uint8_t adwell_default_n_aps; + uint8_t adwell_default_n_aps_social; + uint8_t reserved3; + uint16_t adwell_max_budget; + uint32_t max_out_time[2]; + uint32_t suspend_time[2]; + uint32_t scan_priority; + struct iwm_scan_umac_chan_param channel; + uint8_t data[]; + } v7; + }; +} __packed; + +#define IWM_SCAN_REQ_UMAC_SIZE_V7 48 +#define IWM_SCAN_REQ_UMAC_SIZE_V1 36 /** * struct iwm_umac_scan_abort @@ -5421,7 +5662,7 @@ struct iwm_umac_scan_iter_complete_notif { uint8_t last_channel; uint32_t tsf_low; uint32_t tsf_high; - struct iwm_scan_results_notif results[0]; + struct iwm_scan_results_notif results[]; } __packed; /* SCAN_ITER_COMPLETE_NTF_UMAC_API_S_VER_1 */ /* Please keep this enum *SORTED* by hex value. @@ -5606,7 +5847,7 @@ enum iwm_sta_sleep_flag { #define IWM_STA_KEY_LEN_WEP104 (13) /** - * struct iwm_mvm_keyinfo - key information + * struct iwm_keyinfo - key information * @key_flags: type %iwm_sta_key_flag * @tkip_rx_tsc_byte2: TSC[2] for key mix ph1 detection * @tkip_rx_ttak: 10-byte unicast TKIP TTAK for Rx @@ -5616,7 +5857,7 @@ enum iwm_sta_sleep_flag { * @hw_tkip_mic_rx_key: byte: MIC Rx Key - used for TKIP only * @hw_tkip_mic_tx_key: byte: MIC Tx Key - used for TKIP only */ -struct iwm_mvm_keyinfo { +struct iwm_keyinfo { uint16_t key_flags; uint8_t tkip_rx_tsc_byte2; uint8_t reserved1; @@ -5635,30 +5876,34 @@ struct iwm_mvm_keyinfo { #define IWM_ADD_STA_BAID_SHIFT 8 /** - * struct iwm_mvm_add_sta_cmd - Add/modify a station in the fw's sta table. + * struct iwl_add_sta_cmd_v7 - Add/modify a station in the fw's sta table. * ( REPLY_ADD_STA = 0x18 ) - * @add_modify: 1: modify existing, 0: add new station - * @awake_acs: + * @add_modify: see &enum iwl_sta_mode + * @awake_acs: ACs to transmit data on while station is sleeping (for U-APSD) * @tid_disable_tx: is tid BIT(tid) enabled for Tx. Clear BIT(x) to enable - * AMPDU for tid x. Set %IWM_STA_MODIFY_TID_DISABLE_TX to change this field. - * @mac_id_n_color: the Mac context this station belongs to - * @addr[IEEE80211_ADDR_LEN]: station's MAC address + * AMPDU for tid x. Set %STA_MODIFY_TID_DISABLE_TX to change this field. + * @mac_id_n_color: the Mac context this station belongs to, + * see &enum iwl_ctxt_id_and_color + * @addr: station's MAC address + * @reserved2: reserved * @sta_id: index of station in uCode's station table - * @modify_mask: IWM_STA_MODIFY_*, selects which parameters to modify vs. leave + * @modify_mask: STA_MODIFY_*, selects which parameters to modify vs. leave * alone. 1 - modify, 0 - don't change. - * @station_flags: look at %iwm_sta_flags - * @station_flags_msk: what of %station_flags have changed + * @reserved3: reserved + * @station_flags: look at &enum iwl_sta_flags + * @station_flags_msk: what of %station_flags have changed, + * also &enum iwl_sta_flags * @add_immediate_ba_tid: tid for which to add block-ack support (Rx) - * Set %IWM_STA_MODIFY_ADD_BA_TID to use this field, and also set + * Set %STA_MODIFY_ADD_BA_TID to use this field, and also set * add_immediate_ba_ssn. * @remove_immediate_ba_tid: tid for which to remove block-ack support (Rx) - * Set %IWM_STA_MODIFY_REMOVE_BA_TID to use this field + * Set %STA_MODIFY_REMOVE_BA_TID to use this field * @add_immediate_ba_ssn: ssn for the Rx block-ack session. Used together with * add_immediate_ba_tid. * @sleep_tx_count: number of packets to transmit to station even though it is * asleep. Used to synchronise PS-poll and u-APSD responses while ucode * keeps track of STA sleep state. - * @sleep_state_flags: Look at %iwm_sta_sleep_flag. + * @sleep_state_flags: Look at &enum iwl_sta_sleep_flag. * @assoc_id: assoc_id to be sent in VHT PLCP (9-bit), for grp use 0, for AP * mac-addr. * @beamform_flags: beam forming controls @@ -5666,12 +5911,12 @@ struct iwm_mvm_keyinfo { * * The device contains an internal table of per-station information, with info * on security keys, aggregation parameters, and Tx rates for initial Tx - * attempt and any retries (set by IWM_REPLY_TX_LINK_QUALITY_CMD). + * attempt and any retries (set by REPLY_TX_LINK_QUALITY_CMD). * * ADD_STA sets up the table entry for one station, either creating a new * entry, or modifying a pre-existing one. */ -struct iwm_mvm_add_sta_cmd { +struct iwm_add_sta_cmd_v7 { uint8_t add_modify; uint8_t awake_acs; uint16_t tid_disable_tx; @@ -5694,7 +5939,98 @@ struct iwm_mvm_add_sta_cmd { } __packed; /* ADD_STA_CMD_API_S_VER_7 */ /** - * struct iwm_mvm_add_sta_key_cmd - add/modify sta key + * enum iwm_sta_type - FW station types + * ( REPLY_ADD_STA = 0x18 ) + * @IWM_STA_LINK: Link station - normal RX and TX traffic. + * @IWM_STA_GENERAL_PURPOSE: General purpose. In AP mode used for beacons + * and probe responses. + * @IWM_STA_MULTICAST: multicast traffic, + * @IWM_STA_TDLS_LINK: TDLS link station + * @IWM_STA_AUX_ACTIVITY: auxilary station (scan, ROC and so on). + */ +enum iwm_sta_type { + IWM_STA_LINK, + IWM_STA_GENERAL_PURPOSE, + IWM_STA_MULTICAST, + IWM_STA_TDLS_LINK, + IWM_STA_AUX_ACTIVITY, +}; + +/** + * struct iwm_add_sta_cmd - Add/modify a station in the fw's sta table. + * ( REPLY_ADD_STA = 0x18 ) + * @add_modify: see &enum iwm_sta_mode + * @awake_acs: ACs to transmit data on while station is sleeping (for U-APSD) + * @tid_disable_tx: is tid BIT(tid) enabled for Tx. Clear BIT(x) to enable + * AMPDU for tid x. Set %STA_MODIFY_TID_DISABLE_TX to change this field. + * @mac_id_n_color: the Mac context this station belongs to, + * see &enum iwl_ctxt_id_and_color + * @addr: station's MAC address + * @reserved2: reserved + * @sta_id: index of station in uCode's station table + * @modify_mask: STA_MODIFY_*, selects which parameters to modify vs. leave + * alone. 1 - modify, 0 - don't change. + * @reserved3: reserved + * @station_flags: look at &enum iwm_sta_flags + * @station_flags_msk: what of %station_flags have changed, + * also &enum iwm_sta_flags + * @add_immediate_ba_tid: tid for which to add block-ack support (Rx) + * Set %STA_MODIFY_ADD_BA_TID to use this field, and also set + * add_immediate_ba_ssn. + * @remove_immediate_ba_tid: tid for which to remove block-ack support (Rx) + * Set %STA_MODIFY_REMOVE_BA_TID to use this field + * @add_immediate_ba_ssn: ssn for the Rx block-ack session. Used together with + * add_immediate_ba_tid. + * @sleep_tx_count: number of packets to transmit to station even though it is + * asleep. Used to synchronise PS-poll and u-APSD responses while ucode + * keeps track of STA sleep state. + * @station_type: type of this station. See &enum iwl_sta_type. + * @sleep_state_flags: Look at &enum iwl_sta_sleep_flag. + * @assoc_id: assoc_id to be sent in VHT PLCP (9-bit), for grp use 0, for AP + * mac-addr. + * @beamform_flags: beam forming controls + * @tfd_queue_msk: tfd queues used by this station. + * Obselete for new TX API (9 and above). + * @rx_ba_window: aggregation window size + * @sp_length: the size of the SP in actual number of frames + * @uapsd_acs: 4 LS bits are trigger enabled ACs, 4 MS bits are the deliver + * enabled ACs. + * + * The device contains an internal table of per-station information, with info + * on security keys, aggregation parameters, and Tx rates for initial Tx + * attempt and any retries (set by REPLY_TX_LINK_QUALITY_CMD). + * + * ADD_STA sets up the table entry for one station, either creating a new + * entry, or modifying a pre-existing one. + */ +struct iwm_add_sta_cmd { + uint8_t add_modify; + uint8_t awake_acs; + uint16_t tid_disable_tx; + uint32_t mac_id_n_color; + uint8_t addr[IEEE80211_ADDR_LEN]; /* _STA_ID_MODIFY_INFO_API_S_VER_1 */ + uint16_t reserved2; + uint8_t sta_id; + uint8_t modify_mask; + uint16_t reserved3; + uint32_t station_flags; + uint32_t station_flags_msk; + uint8_t add_immediate_ba_tid; + uint8_t remove_immediate_ba_tid; + uint16_t add_immediate_ba_ssn; + uint16_t sleep_tx_count; + uint8_t sleep_state_flags; + uint8_t station_type; + uint16_t assoc_id; + uint16_t beamform_flags; + uint32_t tfd_queue_msk; + uint16_t rx_ba_window; + uint8_t sp_length; + uint8_t uapsd_acs; +} __packed; /* ADD_STA_CMD_API_S_VER_10 */ + +/** + * struct iwm_add_sta_key_cmd - add/modify sta key * ( IWM_REPLY_ADD_STA_KEY = 0x17 ) * @sta_id: index of station in uCode's station table * @key_offset: key offset in key storage @@ -5705,7 +6041,7 @@ struct iwm_mvm_add_sta_cmd { * @tkip_rx_tsc_byte2: TSC[2] for key mix ph1 detection * @tkip_rx_ttak: 10-byte unicast TKIP TTAK for Rx */ -struct iwm_mvm_add_sta_key_cmd { +struct iwm_add_sta_key_cmd { uint8_t sta_id; uint8_t key_offset; uint16_t key_flags; @@ -5718,14 +6054,14 @@ struct iwm_mvm_add_sta_key_cmd { } __packed; /* IWM_ADD_MODIFY_STA_KEY_API_S_VER_1 */ /** - * enum iwm_mvm_add_sta_rsp_status - status in the response to ADD_STA command + * enum iwm_add_sta_rsp_status - status in the response to ADD_STA command * @IWM_ADD_STA_SUCCESS: operation was executed successfully * @IWM_ADD_STA_STATIONS_OVERLOAD: no room left in the fw's station table * @IWM_ADD_STA_IMMEDIATE_BA_FAILURE: can't add Rx block ack session * @IWM_ADD_STA_MODIFY_NON_EXISTING_STA: driver requested to modify a station * that doesn't exist. */ -enum iwm_mvm_add_sta_rsp_status { +enum iwm_add_sta_rsp_status { IWM_ADD_STA_SUCCESS = 0x1, IWM_ADD_STA_STATIONS_OVERLOAD = 0x2, IWM_ADD_STA_IMMEDIATE_BA_FAILURE = 0x4, @@ -5733,17 +6069,17 @@ enum iwm_mvm_add_sta_rsp_status { }; /** - * struct iwm_mvm_rm_sta_cmd - Add / modify a station in the fw's station table + * struct iwm_rm_sta_cmd - Add / modify a station in the fw's station table * ( IWM_REMOVE_STA = 0x19 ) * @sta_id: the station id of the station to be removed */ -struct iwm_mvm_rm_sta_cmd { +struct iwm_rm_sta_cmd { uint8_t sta_id; uint8_t reserved[3]; } __packed; /* IWM_REMOVE_STA_CMD_API_S_VER_2 */ /** - * struct iwm_mvm_mgmt_mcast_key_cmd + * struct iwm_mgmt_mcast_key_cmd * ( IWM_MGMT_MCAST_KEY = 0x1f ) * @ctrl_flags: %iwm_sta_key_flag * @IGTK: @@ -5753,7 +6089,7 @@ struct iwm_mvm_rm_sta_cmd { * @key_id: * @receive_seq_cnt: initial RSC/PN needed for replay check */ -struct iwm_mvm_mgmt_mcast_key_cmd { +struct iwm_mgmt_mcast_key_cmd { uint32_t ctrl_flags; uint8_t IGTK[16]; uint8_t K1[16]; @@ -5763,7 +6099,7 @@ struct iwm_mvm_mgmt_mcast_key_cmd { uint64_t receive_seq_cnt; } __packed; /* SEC_MGMT_MULTICAST_KEY_CMD_API_S_VER_1 */ -struct iwm_mvm_wep_key { +struct iwm_wep_key { uint8_t key_index; uint8_t key_offset; uint16_t reserved1; @@ -5772,13 +6108,13 @@ struct iwm_mvm_wep_key { uint8_t key[16]; } __packed; -struct iwm_mvm_wep_key_cmd { +struct iwm_wep_key_cmd { uint32_t mac_id_n_color; uint8_t num_keys; uint8_t decryption_type; uint8_t flags; uint8_t reserved; - struct iwm_mvm_wep_key wep_key[0]; + struct iwm_wep_key wep_key[0]; } __packed; /* SEC_CURR_WEP_KEY_CMD_API_S_VER_2 */ /* @@ -6088,7 +6424,7 @@ struct iwm_rx_packet { */ uint32_t len_n_flags; struct iwm_cmd_header hdr; - uint8_t data[0]; + uint8_t data[]; } __packed; #define IWM_FH_RSCSR_FRAME_SIZE_MSK 0x00003fff diff --git a/src/add-ons/kernel/drivers/network/wlan/idualwifi7260/dev/iwm/if_iwmvar.h b/src/add-ons/kernel/drivers/network/wlan/idualwifi7260/dev/iwm/if_iwmvar.h index c660a07565..a2452b1e46 100644 --- a/src/add-ons/kernel/drivers/network/wlan/idualwifi7260/dev/iwm/if_iwmvar.h +++ b/src/add-ons/kernel/drivers/network/wlan/idualwifi7260/dev/iwm/if_iwmvar.h @@ -1,5 +1,5 @@ /* $OpenBSD: if_iwmvar.h,v 1.7 2015/03/02 13:51:10 jsg Exp $ */ -/* $FreeBSD: releng/12.0/sys/dev/iwm/if_iwmvar.h 321509 2017-07-26 05:40:52Z adrian $ */ +/* $FreeBSD$ */ /* * Copyright (c) 2014 genua mbh @@ -113,7 +113,7 @@ struct iwm_rx_radiotap_header { uint16_t wr_chan_flags; int8_t wr_dbm_antsignal; int8_t wr_dbm_antnoise; -} __packed; +} __packed __aligned(8); #define IWM_RX_RADIOTAP_PRESENT \ ((1 << IEEE80211_RADIOTAP_TSFT) | \ @@ -165,20 +165,6 @@ struct iwm_ucode_capabilities { uint8_t enabled_capa[howmany(IWM_NUM_UCODE_TLV_CAPA, NBBY)]; }; -static inline int -fw_has_api(const struct iwm_ucode_capabilities *capabilities, - unsigned int api) -{ - return isset(capabilities->enabled_api, api); -} - -static inline int -fw_has_capa(const struct iwm_ucode_capabilities *capabilities, - unsigned int capa) -{ - return isset(capabilities->enabled_capa, capa); -} - /* one for each uCode image (inst/data, init/runtime/wowlan) */ struct iwm_fw_desc { const void *data; /* vmalloc'ed data */ @@ -299,11 +285,12 @@ struct iwm_tx_ring { int cur; }; -#define IWM_RX_RING_COUNT 256 -/* Linux driver optionally uses 8k buffer */ +#define IWM_RX_LEGACY_RING_COUNT 256 +#define IWM_RX_MQ_RING_COUNT 512 + #define IWM_RBUF_SIZE 4096 -#define IWM_MAX_SCATTER 20 +#define IWM_MAX_SCATTER 20 struct iwm_rx_data { struct mbuf *m; @@ -311,12 +298,13 @@ struct iwm_rx_data { }; struct iwm_rx_ring { - struct iwm_dma_info desc_dma; + struct iwm_dma_info free_desc_dma; + struct iwm_dma_info used_desc_dma; struct iwm_dma_info stat_dma; struct iwm_dma_info buf_dma; - uint32_t *desc; + void *desc; struct iwm_rb_status *stat; - struct iwm_rx_data data[IWM_RX_RING_COUNT]; + struct iwm_rx_data data[512]; bus_dmamap_t spare_map; /* for iwm_rx_addbuf() */ bus_dma_tag_t data_dmat; int cur; @@ -324,8 +312,8 @@ struct iwm_rx_ring { #define IWM_CMD_RESP_MAX PAGE_SIZE -#define IWM_MVM_TE_SESSION_PROTECTION_MAX_TIME_MS 500 -#define IWM_MVM_TE_SESSION_PROTECTION_MIN_TIME_MS 400 +#define IWM_TE_SESSION_PROTECTION_MAX_TIME_MS 500 +#define IWM_TE_SESSION_PROTECTION_MIN_TIME_MS 400 /* * Command headers are in iwl-trans.h, which is full of all @@ -348,7 +336,7 @@ struct iwm_int_sta { uint32_t tfd_queue_msk; }; -struct iwm_mvm_phy_ctxt { +struct iwm_phy_ctxt { uint16_t id; uint16_t color; uint32_t ref; @@ -370,7 +358,7 @@ struct iwm_vap { int (*iv_newstate)(struct ieee80211vap *, enum ieee80211_state, int); - struct iwm_mvm_phy_ctxt *phy_ctxt; + struct iwm_phy_ctxt *phy_ctxt; uint16_t id; uint16_t color; @@ -455,12 +443,10 @@ struct iwm_softc { uint32_t scd_base_addr; /* TX/RX rings. */ - struct iwm_tx_ring txq[IWM_MVM_MAX_QUEUES]; + struct iwm_tx_ring txq[IWM_MAX_QUEUES]; struct iwm_rx_ring rxq; int qfullmsk; - int sc_sf_state; - /* ICT table. */ struct iwm_dma_info ict_dma; int ict_cur; @@ -521,13 +507,11 @@ struct iwm_softc { struct iwm_int_sta sc_aux_sta; /* phy contexts. we only use the first one */ - struct iwm_mvm_phy_ctxt sc_phyctxt[IWM_NUM_PHY_CTX]; + struct iwm_phy_ctxt sc_phyctxt[IWM_NUM_PHY_CTX]; struct iwm_notif_statistics_v10 sc_stats; int sc_noise; - caddr_t sc_drvbpf; - struct iwm_rx_radiotap_header sc_rxtap; struct iwm_tx_radiotap_header sc_txtap; @@ -585,3 +569,15 @@ struct iwm_softc { #define IWM_LOCK(_sc) mtx_lock(&(_sc)->sc_mtx) #define IWM_UNLOCK(_sc) mtx_unlock(&(_sc)->sc_mtx) #define IWM_LOCK_DESTROY(_sc) mtx_destroy(&(_sc)->sc_mtx) + +static inline bool +iwm_fw_has_api(struct iwm_softc *sc, unsigned int api) +{ + return isset(sc->sc_fw.ucode_capa.enabled_api, api); +} + +static inline bool +iwm_fw_has_capa(struct iwm_softc *sc, unsigned int capa) +{ + return isset(sc->sc_fw.ucode_capa.enabled_capa, capa); +} diff --git a/src/add-ons/kernel/drivers/network/wlan/idualwifi7260/glue.c b/src/add-ons/kernel/drivers/network/wlan/idualwifi7260/glue.c index a221c129a1..258f226c5b 100644 --- a/src/add-ons/kernel/drivers/network/wlan/idualwifi7260/glue.c +++ b/src/add-ons/kernel/drivers/network/wlan/idualwifi7260/glue.c @@ -34,6 +34,8 @@ HAIKU_FIRMWARE_NAME_MAP({ {"iwm7265Dfw", "iwm-7265D-22.ucode"}, {"iwm8000Cfw", "iwm-8000C-22.ucode"}, {"iwm8265fw", "iwm-8265-22.ucode"}, + {"iwm9000fw", "iwm-9000-34.ucode"}, + {"iwm9260fw", "iwm-9260-34.ucode"}, });