Lines Matching refs:prot

432 #define DHD_RING_IN_FLOWRINGS_POOL(prot, flowid) \  argument
433 (msgbuf_ring_t*)((prot)->h2d_flowrings_pool) + \
437 #define FOREACH_RING_IN_FLOWRINGS_POOL(prot, ring, flowid, total_flowrings) \ argument
439 (ring) = DHD_RING_IN_FLOWRINGS_POOL(prot, flowid); \
792 static int dhd_prot_allocate_bufs(dhd_pub_t *dhd, dhd_prot_t *prot);
868 static void dhd_prot_ioctl_dump(dhd_prot_t *prot, struct bcmstrbuf *strbuf);
1042 return &dhd->prot->fw_trap_buf; in dhd_prot_get_minidump_buf()
1049 return dhd->prot->rxbufpost_sz; in dhd_prot_get_rxbufpost_sz()
1055 dhd_prot_t *prot = dhd->prot; in dhd_prot_get_h2d_rx_post_active() local
1056 msgbuf_ring_t *flow_ring = &prot->h2dring_rxp_subn; in dhd_prot_get_h2d_rx_post_active()
1073 dhd_prot_t *prot = dhd->prot; in dhd_prot_get_d2h_rx_cpln_active() local
1074 msgbuf_ring_t *flow_ring = &prot->d2hring_rx_cpln; in dhd_prot_get_d2h_rx_cpln_active()
1186 dhd->prot->d2h_sync_wait_max, dhd->prot->d2h_sync_wait_tot, in dhd_prot_d2h_sync_livelock()
1242 dhd_prot_t *prot = dhd->prot; in BCMFASTPATH() local
1286 if (total_tries > prot->d2h_sync_wait_max) in BCMFASTPATH()
1287 prot->d2h_sync_wait_max = total_tries; in BCMFASTPATH()
1304 prot->d2h_sync_wait_tot += tries; in BCMFASTPATH()
1321 dhd_prot_t *prot = dhd->prot; in BCMFASTPATH() local
1373 if (total_tries > prot->d2h_sync_wait_max) in BCMFASTPATH()
1374 prot->d2h_sync_wait_max = total_tries; in BCMFASTPATH()
1392 prot->d2h_sync_wait_tot += tries; in BCMFASTPATH()
1438 dhd_prot_t *prot = dhd->prot; in BCMFASTPATH() local
1515 if (total_tries > prot->d2h_sync_wait_max) in BCMFASTPATH()
1516 prot->d2h_sync_wait_max = total_tries; in BCMFASTPATH()
1560 prot->d2h_sync_wait_tot += tries; in BCMFASTPATH()
1594 dhd->prot->ioctl_received = reason; in dhd_wakeup_ioctl_event()
1607 dhd_prot_t *prot = dhd->prot; in dhd_prot_d2h_sync_init() local
1608 prot->d2h_sync_wait_max = 0UL; in dhd_prot_d2h_sync_init()
1609 prot->d2h_sync_wait_tot = 0UL; in dhd_prot_d2h_sync_init()
1611 prot->d2hring_ctrl_cpln.seqnum = D2H_EPOCH_INIT_VAL; in dhd_prot_d2h_sync_init()
1612 prot->d2hring_ctrl_cpln.current_phase = BCMPCIE_CMNHDR_PHASE_BIT_INIT; in dhd_prot_d2h_sync_init()
1614 prot->d2hring_tx_cpln.seqnum = D2H_EPOCH_INIT_VAL; in dhd_prot_d2h_sync_init()
1615 prot->d2hring_tx_cpln.current_phase = BCMPCIE_CMNHDR_PHASE_BIT_INIT; in dhd_prot_d2h_sync_init()
1617 prot->d2hring_rx_cpln.seqnum = D2H_EPOCH_INIT_VAL; in dhd_prot_d2h_sync_init()
1618 prot->d2hring_rx_cpln.current_phase = BCMPCIE_CMNHDR_PHASE_BIT_INIT; in dhd_prot_d2h_sync_init()
1621 prot->d2h_sync_cb = dhd_prot_d2h_sync_seqnum; in dhd_prot_d2h_sync_init()
1623 prot->d2h_edl_sync_cb = dhd_prot_d2h_sync_edl; in dhd_prot_d2h_sync_init()
1627 prot->d2h_sync_cb = dhd_prot_d2h_sync_xorcsum; in dhd_prot_d2h_sync_init()
1629 prot->d2h_edl_sync_cb = dhd_prot_d2h_sync_edl; in dhd_prot_d2h_sync_init()
1633 prot->d2h_sync_cb = dhd_prot_d2h_sync_none; in dhd_prot_d2h_sync_init()
1635 prot->d2h_edl_sync_cb = dhd_prot_d2h_sync_edl_none; in dhd_prot_d2h_sync_init()
1647 dhd_prot_t *prot = dhd->prot; in dhd_prot_h2d_sync_init() local
1648 prot->h2dring_rxp_subn.seqnum = H2D_EPOCH_INIT_VAL; in dhd_prot_h2d_sync_init()
1650 prot->h2dring_rxp_subn.current_phase = 0; in dhd_prot_h2d_sync_init()
1652 prot->h2dring_ctrl_subn.seqnum = H2D_EPOCH_INIT_VAL; in dhd_prot_h2d_sync_init()
1653 prot->h2dring_ctrl_subn.current_phase = 0; in dhd_prot_h2d_sync_init()
1909 dhd_prot_t *prot = dhd->prot; in dhd_pktid_logging_dump() local
1913 if (prot == NULL) { in dhd_pktid_logging_dump()
1918 map_log = (dhd_pktid_log_t *)(prot->pktid_dma_map); in dhd_pktid_logging_dump()
1919 unmap_log = (dhd_pktid_log_t *)(prot->pktid_dma_unmap); in dhd_pktid_logging_dump()
2226 dhd_prot_t *prot = dhd->prot; in dhd_get_pktid_map_type() local
2229 if (pktid_map == prot->pktid_ctrl_map) { in dhd_get_pktid_map_type()
2231 } else if (pktid_map == prot->pktid_tx_map) { in dhd_get_pktid_map_type()
2233 } else if (pktid_map == prot->pktid_rx_map) { in dhd_get_pktid_map_type()
2531 OSL_ATOMIC_DEC(dhd->osh, &dhd->prot->active_tx_count); in dhd_pktid_map_reset()
2538 DHD_PKTID_LOG(dhd, dhd->prot->pktid_dma_unmap, in dhd_pktid_map_reset()
2852 DHD_PKTID_LOG(dhd, dhd->prot->pktid_dma_map, pa, nkey, len, pkttype); in dhd_pktid_map_save()
3035 DHD_PKTID_LOG(dhd, dhd->prot->pktid_dma_unmap, locker->pa, nkey, in BCMFASTPATH()
3266 dhd_prot_allocate_bufs(dhd_pub_t *dhd, dhd_prot_t *prot) in dhd_prot_allocate_bufs() argument
3272 if (dhd_prot_ring_attach(dhd, &prot->h2dring_ctrl_subn, "h2dctrl", in dhd_prot_allocate_bufs()
3281 if (dhd_prot_ring_attach(dhd, &prot->h2dring_rxp_subn, "h2drxp", in dhd_prot_allocate_bufs()
3290 if (dhd_prot_ring_attach(dhd, &prot->d2hring_ctrl_cpln, "d2hctrl", in dhd_prot_allocate_bufs()
3299 if (dhd_prot_ring_attach(dhd, &prot->d2hring_tx_cpln, "d2htxcpl", in dhd_prot_allocate_bufs()
3309 if (dhd_prot_ring_attach(dhd, &prot->d2hring_rx_cpln, "d2hrxcpl", in dhd_prot_allocate_bufs()
3324 if (dhd_dma_buf_alloc(dhd, &prot->retbuf, IOCT_RETBUF_SIZE)) { in dhd_prot_allocate_bufs()
3329 if (dhd_dma_buf_alloc(dhd, &prot->ioctbuf, IOCT_RETBUF_SIZE)) { in dhd_prot_allocate_bufs()
3334 if (dhd_dma_buf_alloc(dhd, &prot->hostts_req_buf, CTRLSUB_HOSTTS_MEESAGE_SIZE)) { in dhd_prot_allocate_bufs()
3337 prot->hostts_req_buf_inuse = FALSE; in dhd_prot_allocate_bufs()
3341 if (dhd_dma_buf_alloc(dhd, &prot->d2h_dma_scratch_buf, in dhd_prot_allocate_bufs()
3344 if (dhd_dma_buf_alloc(dhd, &prot->d2h_dma_scratch_buf, DMA_D2H_SCRATCH_BUF_LEN)) in dhd_prot_allocate_bufs()
3354 if (dhd_dma_buf_alloc(dhd, &prot->hmaptest.mem, HMAP_SANDBOX_BUFFER_LEN)) { in dhd_prot_allocate_bufs()
3362 scratch_pa = prot->hmaptest.mem.pa; in dhd_prot_allocate_bufs()
3363 scratch_len = prot->hmaptest.mem.len; in dhd_prot_allocate_bufs()
3373 if (dhd_dma_buf_alloc(dhd, &prot->host_bus_throughput_buf, DHD_BUS_TPUT_BUF_LEN)) { in dhd_prot_allocate_bufs()
3379 if (dhd_dma_buf_alloc(dhd, &prot->snapshot_upload_buf, SNAPSHOT_UPLOAD_BUF_SIZE)) { in dhd_prot_allocate_bufs()
3415 dhd_prot_t *prot; in dhd_prot_attach() local
3419 if (!(prot = (dhd_prot_t *)DHD_OS_PREALLOC(dhd, DHD_PREALLOC_PROT, in dhd_prot_attach()
3424 memset(prot, 0, sizeof(*prot)); in dhd_prot_attach()
3426 prot->osh = osh; in dhd_prot_attach()
3427 dhd->prot = prot; in dhd_prot_attach()
3438 if (dhd_prot_allocate_bufs(dhd, prot) != BCME_OK) { in dhd_prot_attach()
3443 dhd_rxchain_reset(&prot->rxchain); in dhd_prot_attach()
3446 prot->pktid_ctrl_map = DHD_NATIVE_TO_PKTID_INIT(dhd, MAX_PKTID_CTRL); in dhd_prot_attach()
3447 if (prot->pktid_ctrl_map == NULL) { in dhd_prot_attach()
3451 prot->pktid_rx_map = DHD_NATIVE_TO_PKTID_INIT(dhd, MAX_PKTID_RX); in dhd_prot_attach()
3452 if (prot->pktid_rx_map == NULL) in dhd_prot_attach()
3455 prot->pktid_tx_map = DHD_NATIVE_TO_PKTID_INIT(dhd, MAX_PKTID_TX); in dhd_prot_attach()
3456 if (prot->pktid_rx_map == NULL) in dhd_prot_attach()
3460 prot->pktid_map_handle_ioctl = DHD_NATIVE_TO_PKTID_INIT(dhd, in dhd_prot_attach()
3462 if (prot->pktid_map_handle_ioctl == NULL) { in dhd_prot_attach()
3468 prot->pktid_dma_map = DHD_PKTID_LOG_INIT(dhd, MAX_PKTID_LOG); in dhd_prot_attach()
3469 if (prot->pktid_dma_map == NULL) { in dhd_prot_attach()
3474 prot->pktid_dma_unmap = DHD_PKTID_LOG_INIT(dhd, MAX_PKTID_LOG); in dhd_prot_attach()
3475 if (prot->pktid_dma_unmap == NULL) { in dhd_prot_attach()
3496 if (dhd_dma_buf_alloc(dhd, &dhd->prot->fw_trap_buf, trap_buf_len)) { in dhd_prot_attach()
3505 if (prot) { in dhd_prot_attach()
3518 dhd_prot_t *prot = dhd->prot; in dhd_alloc_host_scbs() local
3529 if (prot->host_scb_buf.va) { in dhd_alloc_host_scbs()
3530 if (prot->host_scb_buf.len >= host_scb_size) { in dhd_alloc_host_scbs()
3531 prot->host_scb_buf.len = host_scb_size; in dhd_alloc_host_scbs()
3533 dhd_dma_buf_free(dhd, &prot->host_scb_buf); in dhd_alloc_host_scbs()
3537 if (prot->host_scb_buf.va == NULL) { in dhd_alloc_host_scbs()
3538 ret = dhd_dma_buf_alloc(dhd, &prot->host_scb_buf, host_scb_size); in dhd_alloc_host_scbs()
3542 dhd_base_addr_htolpa(&base_addr, prot->host_scb_buf.pa); in dhd_alloc_host_scbs()
3562 dhd_prot_t *prot = dhd->prot; in dhd_set_host_cap() local
3573 if (prot->host_ipc_version > prot->device_ipc_version) in dhd_set_host_cap()
3574 prot->active_ipc_version = prot->device_ipc_version; in dhd_set_host_cap()
3576 prot->active_ipc_version = prot->host_ipc_version; in dhd_set_host_cap()
3578 data |= prot->active_ipc_version; in dhd_set_host_cap()
3724 prot->active_ipc_version, prot->host_ipc_version, in dhd_set_host_cap()
3725 prot->device_ipc_version)); in dhd_set_host_cap()
3728 dhd_bus_cmn_writeshared(dhd->bus, &prot->fw_trap_buf.pa, in dhd_set_host_cap()
3729 sizeof(prot->fw_trap_buf.pa), DNGL_TO_HOST_TRAP_ADDR, 0); in dhd_set_host_cap()
3733 host_trap_addr_len = prot->fw_trap_buf.len / 4; in dhd_set_host_cap()
3741 dhd_timesync_notify_ipc_rev(dhd->ts, prot->active_ipc_version); in dhd_set_host_cap()
3748 uint64 *inflight_histo = dhd->prot->agg_h2d_db_info.inflight_histo; in dhd_agg_inflight_stats_dump()
3762 uint64 *bin = dhd->prot->agg_h2d_db_info.inflight_histo; in dhd_agg_inflights_stats_update()
3801 dhd_prot_t *prot; in dhd_msgbuf_agg_h2d_db_timer_fn() local
3810 prot = dhd->prot; in dhd_msgbuf_agg_h2d_db_timer_fn()
3812 prot->agg_h2d_db_info.timer_db_cnt++; in dhd_msgbuf_agg_h2d_db_timer_fn()
3821 prot->mb_2_ring_fn(dhd->bus, db_index, TRUE); in dhd_msgbuf_agg_h2d_db_timer_fn()
3823 prot->mb_ring_fn(dhd->bus, DHD_AGGR_H2D_DB_MAGIC); in dhd_msgbuf_agg_h2d_db_timer_fn()
3830 dhd_msgbuf_agg_h2d_db_timer_start(dhd_prot_t *prot) in dhd_msgbuf_agg_h2d_db_timer_start() argument
3832 agg_h2d_db_info_t *agg_db_info = &prot->agg_h2d_db_info; in dhd_msgbuf_agg_h2d_db_timer_start()
3844 dhd_prot_t *prot = dhd->prot; in dhd_msgbuf_agg_h2d_db_timer_init() local
3845 agg_h2d_db_info_t *agg_db_info = &prot->agg_h2d_db_info; in dhd_msgbuf_agg_h2d_db_timer_init()
3860 dhd_prot_t *prot = dhd->prot; in dhd_msgbuf_agg_h2d_db_timer_reset() local
3861 agg_h2d_db_info_t *agg_db_info = &prot->agg_h2d_db_info; in dhd_msgbuf_agg_h2d_db_timer_reset()
3874 dhd_prot_t *prot = dhd->prot; in dhd_msgbuf_agg_h2d_db_timer_cancel() local
3875 agg_h2d_db_info_t *agg_db_info = &prot->agg_h2d_db_info; in dhd_msgbuf_agg_h2d_db_timer_cancel()
3883 dhd_prot_t *prot = dhd->prot; in dhd_prot_clearcounts() local
3885 agg_h2d_db_info_t *agg_db_info = &prot->agg_h2d_db_info; in dhd_prot_clearcounts()
3892 prot->txcpl_db_cnt = 0; in dhd_prot_clearcounts()
3893 prot->tx_h2d_db_cnt = 0; in dhd_prot_clearcounts()
3907 dhd_prot_t *prot = dhd->prot; in dhd_prot_init() local
3920 prot->h2d_max_txpost = (uint16)h2d_max_txpost; in dhd_prot_init()
3921 DHD_ERROR(("%s:%d: h2d_max_txpost = %d\n", __FUNCTION__, __LINE__, prot->h2d_max_txpost)); in dhd_prot_init()
3924 prot->h2d_htput_max_txpost = (uint16)h2d_htput_max_txpost; in dhd_prot_init()
3926 __FUNCTION__, __LINE__, prot->h2d_htput_max_txpost)); in dhd_prot_init()
3930 dhd_bus_cmn_readshared(dhd->bus, &prot->max_rxbufpost, MAX_HOST_RXBUFS, 0); in dhd_prot_init()
3931 if (prot->max_rxbufpost == 0) { in dhd_prot_init()
3934 prot->max_rxbufpost = DEFAULT_RX_BUFFERS_TO_POST; in dhd_prot_init()
3936 DHD_ERROR(("%s:%d: MAX_RXBUFPOST = %d\n", __FUNCTION__, __LINE__, prot->max_rxbufpost)); in dhd_prot_init()
3940 prot->max_eventbufpost = (((max_eventbufpost + DHD_FLOWRING_MAX_IOCTLRESPBUF_POST)) >= in dhd_prot_init()
3942 prot->max_ioctlrespbufpost = DHD_FLOWRING_MAX_IOCTLRESPBUF_POST; in dhd_prot_init()
3943 prot->max_infobufpost = DHD_H2D_INFORING_MAX_BUF_POST; in dhd_prot_init()
3945 prot->max_btlogbufpost = DHD_H2D_BTLOGRING_MAX_BUF_POST; in dhd_prot_init()
3947 prot->max_tsbufpost = DHD_MAX_TSBUF_POST; in dhd_prot_init()
3949 prot->cur_ioctlresp_bufs_posted = 0; in dhd_prot_init()
3950 OSL_ATOMIC_INIT(dhd->osh, &prot->active_tx_count); in dhd_prot_init()
3951 prot->data_seq_no = 0; in dhd_prot_init()
3952 prot->ioctl_seq_no = 0; in dhd_prot_init()
3953 prot->rxbufpost = 0; in dhd_prot_init()
3954 prot->tot_rxbufpost = 0; in dhd_prot_init()
3955 prot->tot_rxcpl = 0; in dhd_prot_init()
3956 prot->cur_event_bufs_posted = 0; in dhd_prot_init()
3957 prot->ioctl_state = 0; in dhd_prot_init()
3958 prot->curr_ioctl_cmd = 0; in dhd_prot_init()
3959 prot->cur_ts_bufs_posted = 0; in dhd_prot_init()
3960 prot->infobufpost = 0; in dhd_prot_init()
3962 prot->btlogbufpost = 0; in dhd_prot_init()
3965 prot->dmaxfer.srcmem.va = NULL; in dhd_prot_init()
3966 prot->dmaxfer.dstmem.va = NULL; in dhd_prot_init()
3967 prot->dmaxfer.in_progress = FALSE; in dhd_prot_init()
3970 prot->hmaptest.in_progress = FALSE; in dhd_prot_init()
3972 prot->metadata_dbg = FALSE; in dhd_prot_init()
3973 prot->rx_metadata_offset = 0; in dhd_prot_init()
3974 prot->tx_metadata_offset = 0; in dhd_prot_init()
3975 prot->txp_threshold = TXP_FLUSH_MAX_ITEMS_FLUSH_CNT; in dhd_prot_init()
3978 prot->ioctl_trans_id = MAXBITVAL(NBITS(prot->ioctl_trans_id)) - BUFFER_BEFORE_ROLLOVER; in dhd_prot_init()
3979 prot->ioctl_state = 0; in dhd_prot_init()
3980 prot->ioctl_status = 0; in dhd_prot_init()
3981 prot->ioctl_resplen = 0; in dhd_prot_init()
3982 prot->ioctl_received = IOCTL_WAIT; in dhd_prot_init()
3986 prot->device_ipc_version = dhd->bus->api.fw_rev; in dhd_prot_init()
3987 prot->host_ipc_version = PCIE_SHARED_VERSION; in dhd_prot_init()
3988 prot->no_tx_resource = FALSE; in dhd_prot_init()
4001 prot->mb_ring_fn = dhd_bus_get_mbintr_fn(dhd->bus); in dhd_prot_init()
4002 prot->mb_2_ring_fn = dhd_bus_get_mbintr_2_fn(dhd->bus); in dhd_prot_init()
4004 prot->tx_h2d_db_cnt = 0; in dhd_prot_init()
4015 dhd_base_addr_htolpa(&base_addr, prot->d2h_dma_indx_wr_buf.pa); in dhd_prot_init()
4018 dhd_base_addr_htolpa(&base_addr, prot->h2d_dma_indx_rd_buf.pa); in dhd_prot_init()
4024 dhd_base_addr_htolpa(&base_addr, prot->h2d_dma_indx_wr_buf.pa); in dhd_prot_init()
4027 dhd_base_addr_htolpa(&base_addr, prot->d2h_dma_indx_rd_buf.pa); in dhd_prot_init()
4032 dhd_prot_ring_init(dhd, &prot->h2dring_ctrl_subn); in dhd_prot_init()
4033 dhd_prot_ring_init(dhd, &prot->h2dring_rxp_subn); in dhd_prot_init()
4034 dhd_prot_ring_init(dhd, &prot->d2hring_ctrl_cpln); in dhd_prot_init()
4037 if (prot->active_ipc_version < PCIE_SHARED_VERSION_7) { in dhd_prot_init()
4038 prot->d2hring_tx_cpln.item_len = in dhd_prot_init()
4040 prot->d2hring_rx_cpln.item_len = in dhd_prot_init()
4043 dhd_prot_ring_init(dhd, &prot->d2hring_tx_cpln); in dhd_prot_init()
4044 dhd_prot_ring_init(dhd, &prot->d2hring_rx_cpln); in dhd_prot_init()
4059 dhd_base_addr_htolpa(&base_addr, prot->d2h_dma_scratch_buf.pa); in dhd_prot_init()
4062 dhd_bus_cmn_writeshared(dhd->bus, &prot->d2h_dma_scratch_buf.len, in dhd_prot_init()
4063 sizeof(prot->d2h_dma_scratch_buf.len), D2H_DMA_SCRATCH_BUF_LEN, 0); in dhd_prot_init()
4065 prot->host_seqnum = D2H_EPOCH_INIT_VAL % D2H_EPOCH_MODULO; in dhd_prot_init()
4087 dhd_base_addr_htolpa(&base_addr, prot->h2d_ifrm_indx_wr_buf.pa); in dhd_prot_init()
4135 prot->no_retry = FALSE; in dhd_prot_init()
4136 prot->no_aggr = FALSE; in dhd_prot_init()
4137 prot->fixed_rate = FALSE; in dhd_prot_init()
4220 dhd_prot_t *prot = dhd->prot; in dhd_prot_detach() local
4223 if (prot) { in dhd_prot_detach()
4231 dhd_dma_buf_free(dhd, &prot->d2h_dma_scratch_buf); in dhd_prot_detach()
4233 dhd_dma_buf_free(dhd, &prot->hmaptest.mem); in dhd_prot_detach()
4235 dhd_dma_buf_free(dhd, &prot->retbuf); in dhd_prot_detach()
4236 dhd_dma_buf_free(dhd, &prot->ioctbuf); in dhd_prot_detach()
4237 dhd_dma_buf_free(dhd, &prot->host_bus_throughput_buf); in dhd_prot_detach()
4238 dhd_dma_buf_free(dhd, &prot->hostts_req_buf); in dhd_prot_detach()
4239 dhd_dma_buf_free(dhd, &prot->fw_trap_buf); in dhd_prot_detach()
4240 dhd_dma_buf_free(dhd, &prot->host_scb_buf); in dhd_prot_detach()
4242 dhd_dma_buf_free(dhd, &prot->snapshot_upload_buf); in dhd_prot_detach()
4246 dhd_dma_buf_free(dhd, &prot->h2d_dma_indx_wr_buf); in dhd_prot_detach()
4247 dhd_dma_buf_free(dhd, &prot->h2d_dma_indx_rd_buf); in dhd_prot_detach()
4248 dhd_dma_buf_free(dhd, &prot->d2h_dma_indx_wr_buf); in dhd_prot_detach()
4249 dhd_dma_buf_free(dhd, &prot->d2h_dma_indx_rd_buf); in dhd_prot_detach()
4251 dhd_dma_buf_free(dhd, &prot->h2d_ifrm_indx_wr_buf); in dhd_prot_detach()
4254 dhd_prot_ring_detach(dhd, &prot->h2dring_ctrl_subn); in dhd_prot_detach()
4255 dhd_prot_ring_detach(dhd, &prot->h2dring_rxp_subn); in dhd_prot_detach()
4256 dhd_prot_ring_detach(dhd, &prot->d2hring_ctrl_cpln); in dhd_prot_detach()
4257 dhd_prot_ring_detach(dhd, &prot->d2hring_tx_cpln); in dhd_prot_detach()
4258 dhd_prot_ring_detach(dhd, &prot->d2hring_rx_cpln); in dhd_prot_detach()
4288 DHD_NATIVE_TO_PKTID_FINI(dhd, prot->pktid_ctrl_map); in dhd_prot_detach()
4289 DHD_NATIVE_TO_PKTID_FINI(dhd, prot->pktid_rx_map); in dhd_prot_detach()
4290 DHD_NATIVE_TO_PKTID_FINI(dhd, prot->pktid_tx_map); in dhd_prot_detach()
4292 DHD_NATIVE_TO_PKTID_FINI_IOCTL(dhd, prot->pktid_map_handle_ioctl); in dhd_prot_detach()
4295 DHD_PKTID_LOG_FINI(dhd, prot->pktid_dma_map); in dhd_prot_detach()
4296 DHD_PKTID_LOG_FINI(dhd, prot->pktid_dma_unmap); in dhd_prot_detach()
4299 if (prot->h2d_dma_indx_rd_copy_buf) { in dhd_prot_detach()
4300 MFREE(dhd->osh, prot->h2d_dma_indx_rd_copy_buf, in dhd_prot_detach()
4301 prot->h2d_dma_indx_rd_copy_bufsz); in dhd_prot_detach()
4303 if (prot->d2h_dma_indx_wr_copy_buf) { in dhd_prot_detach()
4304 MFREE(dhd->osh, prot->d2h_dma_indx_wr_copy_buf, in dhd_prot_detach()
4305 prot->d2h_dma_indx_wr_copy_bufsz); in dhd_prot_detach()
4308 DHD_OS_PREFREE(dhd, dhd->prot, sizeof(dhd_prot_t)); in dhd_prot_detach()
4310 dhd->prot = NULL; in dhd_prot_detach()
4325 struct dhd_prot *prot = dhd->prot; in dhd_prot_reset() local
4329 if (prot == NULL) { in dhd_prot_reset()
4338 dhd_prot_ring_reset(dhd, &prot->h2dring_ctrl_subn); in dhd_prot_reset()
4339 dhd_prot_ring_reset(dhd, &prot->h2dring_rxp_subn); in dhd_prot_reset()
4340 dhd_prot_ring_reset(dhd, &prot->d2hring_ctrl_cpln); in dhd_prot_reset()
4341 dhd_prot_ring_reset(dhd, &prot->d2hring_tx_cpln); in dhd_prot_reset()
4342 dhd_prot_ring_reset(dhd, &prot->d2hring_rx_cpln); in dhd_prot_reset()
4345 if (prot->h2dring_info_subn) { in dhd_prot_reset()
4346 dhd_prot_ring_reset(dhd, prot->h2dring_info_subn); in dhd_prot_reset()
4349 if (prot->d2hring_info_cpln) { in dhd_prot_reset()
4350 dhd_prot_ring_reset(dhd, prot->d2hring_info_cpln); in dhd_prot_reset()
4354 if (prot->d2hring_edl) { in dhd_prot_reset()
4355 dhd_prot_ring_reset(dhd, prot->d2hring_edl); in dhd_prot_reset()
4360 dhd_dma_buf_reset(dhd, &prot->d2h_dma_scratch_buf); in dhd_prot_reset()
4362 dhd_dma_buf_reset(dhd, &prot->hmaptest.mem); in dhd_prot_reset()
4364 dhd_dma_buf_reset(dhd, &prot->retbuf); in dhd_prot_reset()
4365 dhd_dma_buf_reset(dhd, &prot->ioctbuf); in dhd_prot_reset()
4366 dhd_dma_buf_reset(dhd, &prot->host_bus_throughput_buf); in dhd_prot_reset()
4367 dhd_dma_buf_reset(dhd, &prot->hostts_req_buf); in dhd_prot_reset()
4368 dhd_dma_buf_reset(dhd, &prot->fw_trap_buf); in dhd_prot_reset()
4369 dhd_dma_buf_reset(dhd, &prot->host_scb_buf); in dhd_prot_reset()
4371 dhd_dma_buf_reset(dhd, &prot->snapshot_upload_buf); in dhd_prot_reset()
4374 dhd_dma_buf_reset(dhd, &prot->h2d_ifrm_indx_wr_buf); in dhd_prot_reset()
4377 dhd_dma_buf_reset(dhd, &prot->h2d_dma_indx_rd_buf); in dhd_prot_reset()
4378 dhd_dma_buf_reset(dhd, &prot->h2d_dma_indx_wr_buf); in dhd_prot_reset()
4379 dhd_dma_buf_reset(dhd, &prot->d2h_dma_indx_rd_buf); in dhd_prot_reset()
4380 dhd_dma_buf_reset(dhd, &prot->d2h_dma_indx_wr_buf); in dhd_prot_reset()
4383 if (prot->d2h_dma_indx_wr_copy_buf) { in dhd_prot_reset()
4384 dhd_local_buf_reset(prot->h2d_dma_indx_rd_copy_buf, in dhd_prot_reset()
4385 prot->h2d_dma_indx_rd_copy_bufsz); in dhd_prot_reset()
4386 dhd_local_buf_reset(prot->d2h_dma_indx_wr_copy_buf, in dhd_prot_reset()
4387 prot->d2h_dma_indx_wr_copy_bufsz); in dhd_prot_reset()
4393 prot->rx_metadata_offset = 0; in dhd_prot_reset()
4394 prot->tx_metadata_offset = 0; in dhd_prot_reset()
4396 prot->rxbufpost = 0; in dhd_prot_reset()
4397 prot->cur_event_bufs_posted = 0; in dhd_prot_reset()
4398 prot->cur_ioctlresp_bufs_posted = 0; in dhd_prot_reset()
4400 OSL_ATOMIC_INIT(dhd->osh, &prot->active_tx_count); in dhd_prot_reset()
4401 prot->data_seq_no = 0; in dhd_prot_reset()
4402 prot->ioctl_seq_no = 0; in dhd_prot_reset()
4403 prot->ioctl_state = 0; in dhd_prot_reset()
4404 prot->curr_ioctl_cmd = 0; in dhd_prot_reset()
4405 prot->ioctl_received = IOCTL_WAIT; in dhd_prot_reset()
4407 prot->ioctl_trans_id = MAXBITVAL(NBITS(prot->ioctl_trans_id)) - BUFFER_BEFORE_ROLLOVER; in dhd_prot_reset()
4408 prot->txcpl_db_cnt = 0; in dhd_prot_reset()
4419 if (prot->h2dring_btlog_subn) { in dhd_prot_reset()
4420 dhd_prot_ring_reset(dhd, prot->h2dring_btlog_subn); in dhd_prot_reset()
4423 if (prot->d2hring_btlog_cpln) { in dhd_prot_reset()
4424 dhd_prot_ring_reset(dhd, prot->d2hring_btlog_cpln); in dhd_prot_reset()
4428 if (prot->d2hring_hp2p_txcpl) { in dhd_prot_reset()
4429 dhd_prot_ring_reset(dhd, prot->d2hring_hp2p_txcpl); in dhd_prot_reset()
4431 if (prot->d2hring_hp2p_rxcpl) { in dhd_prot_reset()
4432 dhd_prot_ring_reset(dhd, prot->d2hring_hp2p_rxcpl); in dhd_prot_reset()
4437 DHD_NATIVE_TO_PKTID_RESET(dhd, prot->pktid_ctrl_map); in dhd_prot_reset()
4438 DHD_NATIVE_TO_PKTID_RESET(dhd, prot->pktid_rx_map); in dhd_prot_reset()
4439 DHD_NATIVE_TO_PKTID_RESET(dhd, prot->pktid_tx_map); in dhd_prot_reset()
4441 DHD_NATIVE_TO_PKTID_RESET_IOCTL(dhd, prot->pktid_map_handle_ioctl); in dhd_prot_reset()
4489 dhd_prot_t *prot = dhd->prot; in dhd_prot_rx_dataoffset() local
4490 prot->rx_dataoffset = rx_offset; in dhd_prot_rx_dataoffset()
4496 dhd_prot_t *prot = dhd->prot; in dhd_check_create_info_rings() local
4514 if (prot->d2hring_info_cpln) { in dhd_check_create_info_rings()
4516 prot->d2hring_info_cpln->inited = FALSE; in dhd_check_create_info_rings()
4519 if (prot->h2dring_info_subn && prot->d2hring_info_cpln) { in dhd_check_create_info_rings()
4523 if (prot->h2dring_info_subn == NULL) { in dhd_check_create_info_rings()
4524 prot->h2dring_info_subn = MALLOCZ(prot->osh, sizeof(msgbuf_ring_t)); in dhd_check_create_info_rings()
4526 if (prot->h2dring_info_subn == NULL) { in dhd_check_create_info_rings()
4533 ret = dhd_prot_ring_attach(dhd, prot->h2dring_info_subn, "h2dinfo", in dhd_check_create_info_rings()
4543 if (prot->d2hring_info_cpln == NULL) { in dhd_check_create_info_rings()
4544 prot->d2hring_info_cpln = MALLOCZ(prot->osh, sizeof(msgbuf_ring_t)); in dhd_check_create_info_rings()
4546 if (prot->d2hring_info_cpln == NULL) { in dhd_check_create_info_rings()
4558 ret = dhd_prot_ring_attach(dhd, prot->d2hring_info_cpln, "d2hinfo", in dhd_check_create_info_rings()
4564 dhd_prot_ring_detach(dhd, prot->h2dring_info_subn); in dhd_check_create_info_rings()
4571 MFREE(prot->osh, prot->h2dring_info_subn, sizeof(msgbuf_ring_t)); in dhd_check_create_info_rings()
4573 if (prot->d2hring_info_cpln) { in dhd_check_create_info_rings()
4574 MFREE(prot->osh, prot->d2hring_info_cpln, sizeof(msgbuf_ring_t)); in dhd_check_create_info_rings()
4582 dhd_prot_t *prot = dhd->prot; in dhd_prot_init_info_rings() local
4591 if ((prot->d2hring_info_cpln->inited) || (prot->d2hring_info_cpln->create_pending)) { in dhd_prot_init_info_rings()
4596 DHD_TRACE(("trying to send create d2h info ring: id %d\n", prot->d2hring_info_cpln->idx)); in dhd_prot_init_info_rings()
4597 ret = dhd_send_d2h_ringcreate(dhd, prot->d2hring_info_cpln, in dhd_prot_init_info_rings()
4602 prot->h2dring_info_subn->seqnum = H2D_EPOCH_INIT_VAL; in dhd_prot_init_info_rings()
4603 prot->h2dring_info_subn->current_phase = 0; in dhd_prot_init_info_rings()
4604 prot->d2hring_info_cpln->seqnum = D2H_EPOCH_INIT_VAL; in dhd_prot_init_info_rings()
4605 prot->d2hring_info_cpln->current_phase = BCMPCIE_CMNHDR_PHASE_BIT_INIT; in dhd_prot_init_info_rings()
4607 DHD_TRACE(("trying to send create h2d info ring id %d\n", prot->h2dring_info_subn->idx)); in dhd_prot_init_info_rings()
4608 prot->h2dring_info_subn->n_completion_ids = 1; in dhd_prot_init_info_rings()
4609 prot->h2dring_info_subn->compeltion_ring_ids[0] = prot->d2hring_info_cpln->idx; in dhd_prot_init_info_rings()
4611 ret = dhd_send_h2d_ringcreate(dhd, prot->h2dring_info_subn, in dhd_prot_init_info_rings()
4623 if (dhd->prot->h2dring_info_subn) { in dhd_prot_detach_info_rings()
4624 dhd_prot_ring_detach(dhd, dhd->prot->h2dring_info_subn); in dhd_prot_detach_info_rings()
4625 MFREE(dhd->prot->osh, dhd->prot->h2dring_info_subn, sizeof(msgbuf_ring_t)); in dhd_prot_detach_info_rings()
4627 if (dhd->prot->d2hring_info_cpln) { in dhd_prot_detach_info_rings()
4628 dhd_prot_ring_detach(dhd, dhd->prot->d2hring_info_cpln); in dhd_prot_detach_info_rings()
4629 MFREE(dhd->prot->osh, dhd->prot->d2hring_info_cpln, sizeof(msgbuf_ring_t)); in dhd_prot_detach_info_rings()
4637 dhd_prot_t *prot = dhd->prot; in dhd_check_create_hp2p_rings() local
4644 if (prot->d2hring_hp2p_txcpl == NULL) { in dhd_check_create_hp2p_rings()
4645 prot->d2hring_hp2p_txcpl = MALLOCZ(prot->osh, sizeof(msgbuf_ring_t)); in dhd_check_create_hp2p_rings()
4647 if (prot->d2hring_hp2p_txcpl == NULL) { in dhd_check_create_hp2p_rings()
4654 ret = dhd_prot_ring_attach(dhd, prot->d2hring_hp2p_txcpl, "d2hhp2p_txcpl", in dhd_check_create_hp2p_rings()
4664 prot->d2hring_hp2p_txcpl->inited = FALSE; in dhd_check_create_hp2p_rings()
4666 if (prot->d2hring_hp2p_rxcpl == NULL) { in dhd_check_create_hp2p_rings()
4667 prot->d2hring_hp2p_rxcpl = MALLOCZ(prot->osh, sizeof(msgbuf_ring_t)); in dhd_check_create_hp2p_rings()
4669 if (prot->d2hring_hp2p_rxcpl == NULL) { in dhd_check_create_hp2p_rings()
4681 ret = dhd_prot_ring_attach(dhd, prot->d2hring_hp2p_rxcpl, "d2hhp2p_rxcpl", in dhd_check_create_hp2p_rings()
4691 prot->d2hring_hp2p_rxcpl->inited = FALSE; in dhd_check_create_hp2p_rings()
4694 if (prot->d2hring_hp2p_rxcpl != NULL && in dhd_check_create_hp2p_rings()
4695 prot->d2hring_hp2p_txcpl != NULL) { in dhd_check_create_hp2p_rings()
4702 MFREE(prot->osh, prot->d2hring_hp2p_rxcpl, sizeof(msgbuf_ring_t)); in dhd_check_create_hp2p_rings()
4703 prot->d2hring_hp2p_rxcpl = NULL; in dhd_check_create_hp2p_rings()
4706 MFREE(prot->osh, prot->d2hring_hp2p_txcpl, sizeof(msgbuf_ring_t)); in dhd_check_create_hp2p_rings()
4707 prot->d2hring_hp2p_txcpl = NULL; in dhd_check_create_hp2p_rings()
4714 dhd_prot_t *prot = dhd->prot; in dhd_prot_init_hp2p_rings() local
4727 if ((prot->d2hring_hp2p_txcpl->inited) || (prot->d2hring_hp2p_txcpl->create_pending)) { in dhd_prot_init_hp2p_rings()
4733 prot->d2hring_hp2p_txcpl->idx)); in dhd_prot_init_hp2p_rings()
4734 ret = dhd_send_d2h_ringcreate(dhd, prot->d2hring_hp2p_txcpl, in dhd_prot_init_hp2p_rings()
4739 prot->d2hring_hp2p_txcpl->seqnum = D2H_EPOCH_INIT_VAL; in dhd_prot_init_hp2p_rings()
4740 prot->d2hring_hp2p_txcpl->current_phase = BCMPCIE_CMNHDR_PHASE_BIT_INIT; in dhd_prot_init_hp2p_rings()
4742 if ((prot->d2hring_hp2p_rxcpl->inited) || (prot->d2hring_hp2p_rxcpl->create_pending)) { in dhd_prot_init_hp2p_rings()
4748 prot->d2hring_hp2p_rxcpl->idx)); in dhd_prot_init_hp2p_rings()
4749 ret = dhd_send_d2h_ringcreate(dhd, prot->d2hring_hp2p_rxcpl, in dhd_prot_init_hp2p_rings()
4754 prot->d2hring_hp2p_rxcpl->seqnum = D2H_EPOCH_INIT_VAL; in dhd_prot_init_hp2p_rings()
4755 prot->d2hring_hp2p_rxcpl->current_phase = BCMPCIE_CMNHDR_PHASE_BIT_INIT; in dhd_prot_init_hp2p_rings()
4766 if (dhd->prot->d2hring_hp2p_txcpl) { in dhd_prot_detach_hp2p_rings()
4767 dhd_prot_ring_detach(dhd, dhd->prot->d2hring_hp2p_txcpl); in dhd_prot_detach_hp2p_rings()
4768 MFREE(dhd->prot->osh, dhd->prot->d2hring_hp2p_txcpl, sizeof(msgbuf_ring_t)); in dhd_prot_detach_hp2p_rings()
4769 dhd->prot->d2hring_hp2p_txcpl = NULL; in dhd_prot_detach_hp2p_rings()
4771 if (dhd->prot->d2hring_hp2p_rxcpl) { in dhd_prot_detach_hp2p_rings()
4772 dhd_prot_ring_detach(dhd, dhd->prot->d2hring_hp2p_rxcpl); in dhd_prot_detach_hp2p_rings()
4773 MFREE(dhd->prot->osh, dhd->prot->d2hring_hp2p_rxcpl, sizeof(msgbuf_ring_t)); in dhd_prot_detach_hp2p_rings()
4774 dhd->prot->d2hring_hp2p_rxcpl = NULL; in dhd_prot_detach_hp2p_rings()
4783 dhd_prot_t *prot = dhd->prot; in dhd_check_create_btlog_rings() local
4796 if (prot->d2hring_btlog_cpln) { in dhd_check_create_btlog_rings()
4798 prot->d2hring_btlog_cpln->inited = FALSE; in dhd_check_create_btlog_rings()
4801 if (prot->h2dring_btlog_subn && prot->d2hring_btlog_cpln) { in dhd_check_create_btlog_rings()
4805 if (prot->h2dring_btlog_subn == NULL) { in dhd_check_create_btlog_rings()
4806 prot->h2dring_btlog_subn = MALLOCZ(prot->osh, sizeof(msgbuf_ring_t)); in dhd_check_create_btlog_rings()
4808 if (prot->h2dring_btlog_subn == NULL) { in dhd_check_create_btlog_rings()
4815 ret = dhd_prot_ring_attach(dhd, prot->h2dring_btlog_subn, "h2dbtlog", in dhd_check_create_btlog_rings()
4825 if (prot->d2hring_btlog_cpln == NULL) { in dhd_check_create_btlog_rings()
4826 prot->d2hring_btlog_cpln = MALLOCZ(prot->osh, sizeof(msgbuf_ring_t)); in dhd_check_create_btlog_rings()
4828 if (prot->d2hring_btlog_cpln == NULL) { in dhd_check_create_btlog_rings()
4842 ret = dhd_prot_ring_attach(dhd, prot->d2hring_btlog_cpln, "d2hbtlog", in dhd_check_create_btlog_rings()
4848 dhd_prot_ring_detach(dhd, prot->h2dring_btlog_subn); in dhd_check_create_btlog_rings()
4855 MFREE(prot->osh, prot->h2dring_btlog_subn, sizeof(msgbuf_ring_t)); in dhd_check_create_btlog_rings()
4857 if (prot->d2hring_btlog_cpln) { in dhd_check_create_btlog_rings()
4858 MFREE(prot->osh, prot->d2hring_btlog_cpln, sizeof(msgbuf_ring_t)); in dhd_check_create_btlog_rings()
4866 dhd_prot_t *prot = dhd->prot; in dhd_prot_init_btlog_rings() local
4875 if ((prot->d2hring_btlog_cpln->inited) || (prot->d2hring_btlog_cpln->create_pending)) { in dhd_prot_init_btlog_rings()
4880 DHD_ERROR(("trying to send create d2h btlog ring: id %d\n", prot->d2hring_btlog_cpln->idx)); in dhd_prot_init_btlog_rings()
4881 ret = dhd_send_d2h_ringcreate(dhd, prot->d2hring_btlog_cpln, in dhd_prot_init_btlog_rings()
4886 prot->h2dring_btlog_subn->seqnum = H2D_EPOCH_INIT_VAL; in dhd_prot_init_btlog_rings()
4887 prot->h2dring_btlog_subn->current_phase = 0; in dhd_prot_init_btlog_rings()
4888 prot->d2hring_btlog_cpln->seqnum = D2H_EPOCH_INIT_VAL; in dhd_prot_init_btlog_rings()
4889 prot->d2hring_btlog_cpln->current_phase = BCMPCIE_CMNHDR_PHASE_BIT_INIT; in dhd_prot_init_btlog_rings()
4891 DHD_ERROR(("trying to send create h2d btlog ring id %d\n", prot->h2dring_btlog_subn->idx)); in dhd_prot_init_btlog_rings()
4892 prot->h2dring_btlog_subn->n_completion_ids = 1; in dhd_prot_init_btlog_rings()
4893 prot->h2dring_btlog_subn->compeltion_ring_ids[0] = prot->d2hring_btlog_cpln->idx; in dhd_prot_init_btlog_rings()
4895 ret = dhd_send_h2d_ringcreate(dhd, prot->h2dring_btlog_subn, in dhd_prot_init_btlog_rings()
4907 if (dhd->prot->h2dring_btlog_subn) { in dhd_prot_detach_btlog_rings()
4908 dhd_prot_ring_detach(dhd, dhd->prot->h2dring_btlog_subn); in dhd_prot_detach_btlog_rings()
4909 MFREE(dhd->prot->osh, dhd->prot->h2dring_btlog_subn, sizeof(msgbuf_ring_t)); in dhd_prot_detach_btlog_rings()
4911 if (dhd->prot->d2hring_btlog_cpln) { in dhd_prot_detach_btlog_rings()
4912 dhd_prot_ring_detach(dhd, dhd->prot->d2hring_btlog_cpln); in dhd_prot_detach_btlog_rings()
4913 MFREE(dhd->prot->osh, dhd->prot->d2hring_btlog_cpln, sizeof(msgbuf_ring_t)); in dhd_prot_detach_btlog_rings()
4922 dhd_prot_t *prot = dhd->prot; in dhd_check_create_edl_rings() local
4940 if (prot->d2hring_edl) { in dhd_check_create_edl_rings()
4941 prot->d2hring_edl->inited = FALSE; in dhd_check_create_edl_rings()
4945 if (prot->d2hring_edl == NULL) { in dhd_check_create_edl_rings()
4946 prot->d2hring_edl = MALLOCZ(prot->osh, sizeof(msgbuf_ring_t)); in dhd_check_create_edl_rings()
4948 if (prot->d2hring_edl == NULL) { in dhd_check_create_edl_rings()
4956 ret = dhd_prot_ring_attach(dhd, prot->d2hring_edl, "d2hring_edl", in dhd_check_create_edl_rings()
4968 MFREE(prot->osh, prot->d2hring_edl, sizeof(msgbuf_ring_t)); in dhd_check_create_edl_rings()
4969 prot->d2hring_edl = NULL; in dhd_check_create_edl_rings()
4977 dhd_prot_t *prot = dhd->prot; in dhd_prot_init_edl_rings() local
4986 if ((prot->d2hring_edl->inited) || (prot->d2hring_edl->create_pending)) { in dhd_prot_init_edl_rings()
4991 DHD_ERROR(("trying to send create d2h edl ring: idx %d\n", prot->d2hring_edl->idx)); in dhd_prot_init_edl_rings()
4992 ret = dhd_send_d2h_ringcreate(dhd, prot->d2hring_edl, in dhd_prot_init_edl_rings()
4997 prot->d2hring_edl->seqnum = D2H_EPOCH_INIT_VAL; in dhd_prot_init_edl_rings()
4998 prot->d2hring_edl->current_phase = BCMPCIE_CMNHDR_PHASE_BIT_INIT; in dhd_prot_init_edl_rings()
5006 if (dhd->prot->d2hring_edl) { in dhd_prot_detach_edl_rings()
5007 dhd_prot_ring_detach(dhd, dhd->prot->d2hring_edl); in dhd_prot_detach_edl_rings()
5008 MFREE(dhd->prot->osh, dhd->prot->d2hring_edl, sizeof(msgbuf_ring_t)); in dhd_prot_detach_edl_rings()
5009 dhd->prot->d2hring_edl = NULL; in dhd_prot_detach_edl_rings()
5024 dhd_prot_t *prot = dhd->prot; in dhd_sync_with_dongle() local
5086 prot->rxbufpost_sz = DHD_FLOWRING_RX_BUFPOST_PKTSZ; in dhd_sync_with_dongle()
5097 if (memcpy_s(&(prot->rxbufpost_sz), sizeof(prot->rxbufpost_sz), in dhd_sync_with_dongle()
5102 if (prot->rxbufpost_sz > DHD_FLOWRING_RX_BUFPOST_PKTSZ_MAX) { in dhd_sync_with_dongle()
5104 __FUNCTION__, prot->rxbufpost_sz, in dhd_sync_with_dongle()
5106 prot->rxbufpost_sz = DHD_FLOWRING_RX_BUFPOST_PKTSZ; in dhd_sync_with_dongle()
5109 __FUNCTION__, prot->rxbufpost_sz)); in dhd_sync_with_dongle()
5291 PKTBUF = DHD_PKTID_TO_NATIVE(dhd, dhd->prot->pktid_ctrl_map, in BCMFASTPATH()
5294 PKTBUF = DHD_PKTID_TO_NATIVE_RSV(dhd, dhd->prot->pktid_ctrl_map, in BCMFASTPATH()
5298 PKTBUF = DHD_PKTID_TO_NATIVE(dhd, dhd->prot->pktid_ctrl_map, pktid, pa, in BCMFASTPATH()
5335 retbuf->va = DHD_PKTID_TO_NATIVE(dhd, dhd->prot->pktid_map_handle_ioctl, pktid, in BCMFASTPATH()
5380 dhd_prot_t *prot = dhd->prot; in BCMFASTPATH() local
5384 fillbufs = prot->max_rxbufpost - prot->rxbufpost; in BCMFASTPATH()
5393 prot->rxbufpost += (uint16)retcount; in BCMFASTPATH()
5395 fillbufs = prot->max_rxbufpost - prot->rxbufpost; in BCMFASTPATH()
5416 dhd_prot_t *prot = dhd->prot; in BCMFASTPATH() local
5417 msgbuf_ring_t *ring = &prot->h2dring_rxp_subn; in BCMFASTPATH()
5423 uint16 pktsz = prot->rxbufpost_sz; in BCMFASTPATH()
5470 PKTPULL(dhd->osh, p, prot->rx_metadata_offset); in BCMFASTPATH()
5500 pktid = DHD_NATIVE_TO_PKTID(dhd, dhd->prot->pktid_rx_map, p, pa, in BCMFASTPATH()
5509 if (dhd->prot->hmaptest_rx_active == HMAPTEST_D11_RX_ACTIVE) { in BCMFASTPATH()
5511 dhd->prot->hmap_rx_buf_va = (char *)dhd->prot->hmaptest.mem.va in BCMFASTPATH()
5512 + dhd->prot->hmaptest.offset; in BCMFASTPATH()
5514 dhd->prot->hmap_rx_buf_len = pktlen[i] + prot->rx_metadata_offset; in BCMFASTPATH()
5515 if ((dhd->prot->hmap_rx_buf_va + dhd->prot->hmap_rx_buf_len) > in BCMFASTPATH()
5516 ((char *)dhd->prot->hmaptest.mem.va + dhd->prot->hmaptest.mem.len)) { in BCMFASTPATH()
5519 dhd->prot->hmaptest_rx_active = HMAPTEST_D11_RX_INACTIVE; in BCMFASTPATH()
5520 dhd->prot->hmaptest.in_progress = FALSE; in BCMFASTPATH()
5522 pa = DMA_MAP(dhd->osh, dhd->prot->hmap_rx_buf_va, in BCMFASTPATH()
5523 dhd->prot->hmap_rx_buf_len, DMA_RX, p, 0); in BCMFASTPATH()
5525 dhd->prot->hmap_rx_buf_pa = pa; in BCMFASTPATH()
5526 dhd->prot->hmaptest_rx_pktid = pktid; in BCMFASTPATH()
5527 dhd->prot->hmaptest_rx_active = HMAPTEST_D11_RX_POSTED; in BCMFASTPATH()
5531 dhd->prot->hmap_rx_buf_va, (uint32)PHYSADDRLO(pa))); in BCMFASTPATH()
5537 dhd->prot->tot_rxbufpost++; in BCMFASTPATH()
5547 htol32(PHYSADDRLO(pa) + prot->rx_metadata_offset); in BCMFASTPATH()
5549 if (prot->rx_metadata_offset) { in BCMFASTPATH()
5550 rxbuf_post->metadata_buf_len = prot->rx_metadata_offset; in BCMFASTPATH()
5560 DHD_PKTID_AUDIT(dhd, prot->pktid_rx_map, pktid, DHD_DUPLICATE_ALLOC); in BCMFASTPATH()
5617 dhd_prot_t *prot = dhd->prot; in dhd_prot_infobufpost() local
5634 if (ring == dhd->prot->h2dring_info_subn) { in dhd_prot_infobufpost()
5635 if (prot->max_infobufpost == 0) in dhd_prot_infobufpost()
5638 count = prot->max_infobufpost - prot->infobufpost; in dhd_prot_infobufpost()
5641 else if (ring == dhd->prot->h2dring_btlog_subn) { in dhd_prot_infobufpost()
5642 if (prot->max_btlogbufpost == 0) in dhd_prot_infobufpost()
5646 count = prot->max_btlogbufpost - prot->btlogbufpost; in dhd_prot_infobufpost()
5725 pktid = DHD_NATIVE_TO_PKTID(dhd, dhd->prot->pktid_ctrl_map, p, pa, in dhd_prot_infobufpost()
5747 DHD_PKTID_AUDIT(dhd, prot->pktid_ctrl_map, pktid, DHD_DUPLICATE_ALLOC); in dhd_prot_infobufpost()
5778 if (ring == dhd->prot->h2dring_info_subn) { in dhd_prot_infobufpost()
5779 prot->infobufpost += alloced; in dhd_prot_infobufpost()
5782 if (ring == dhd->prot->h2dring_btlog_subn) { in dhd_prot_infobufpost()
5783 prot->btlogbufpost += alloced; in dhd_prot_infobufpost()
5838 dhd_prot_t *prot = dhd->prot; in dhd_prot_rxbufpost_ctrl() local
5845 msgbuf_ring_t *ring = &prot->h2dring_ctrl_subn; in dhd_prot_rxbufpost_ctrl()
5969 map_handle = dhd->prot->pktid_map_handle_ioctl; in dhd_prot_rxbufpost_ctrl()
5975 map_handle = dhd->prot->pktid_ctrl_map; in dhd_prot_rxbufpost_ctrl()
6093 dhd_prot_t *prot = dhd->prot; in dhd_msgbuf_rxbuf_post_ioctlresp_bufs() local
6097 max_to_post = prot->max_ioctlrespbufpost - prot->cur_ioctlresp_bufs_posted; in dhd_msgbuf_rxbuf_post_ioctlresp_bufs()
6103 prot->cur_ioctlresp_bufs_posted += dhd_msgbuf_rxbuf_post_ctrlpath(dhd, in dhd_msgbuf_rxbuf_post_ioctlresp_bufs()
6110 dhd_prot_t *prot = dhd->prot; in dhd_msgbuf_rxbuf_post_event_bufs() local
6113 max_to_post = prot->max_eventbufpost - prot->cur_event_bufs_posted; in dhd_msgbuf_rxbuf_post_event_bufs()
6119 prot->cur_event_bufs_posted += dhd_msgbuf_rxbuf_post_ctrlpath(dhd, in dhd_msgbuf_rxbuf_post_event_bufs()
6127 dhd_prot_t *prot = dhd->prot; in dhd_msgbuf_rxbuf_post_ts_bufs() local
6130 if (prot->active_ipc_version < 7) { in dhd_msgbuf_rxbuf_post_ts_bufs()
6132 prot->active_ipc_version)); in dhd_msgbuf_rxbuf_post_ts_bufs()
6136 max_to_post = prot->max_tsbufpost - prot->cur_ts_bufs_posted; in dhd_msgbuf_rxbuf_post_ts_bufs()
6143 prot->cur_ts_bufs_posted += dhd_msgbuf_rxbuf_post_ctrlpath(dhd, in dhd_msgbuf_rxbuf_post_ts_bufs()
6152 dhd_prot_t *prot = dhd->prot; in BCMFASTPATH() local
6155 msgbuf_ring_t *ring = prot->d2hring_info_cpln; in BCMFASTPATH()
6212 dhd_prot_t *prot = dhd->prot; in BCMFASTPATH() local
6215 msgbuf_ring_t *ring = prot->d2hring_btlog_cpln; in BCMFASTPATH()
6275 dhd_prot_t *prot = dhd->prot; in dhd_prot_process_msgbuf_edl() local
6276 msgbuf_ring_t *ring = prot->d2hring_edl; in dhd_prot_process_msgbuf_edl()
6369 dhd_prot_t *prot = NULL; in dhd_prot_process_edl_complete() local
6380 if (!dhd || !dhd->prot) in dhd_prot_process_edl_complete()
6383 prot = dhd->prot; in dhd_prot_process_edl_complete()
6384 ring = prot->d2hring_edl; in dhd_prot_process_edl_complete()
6432 if ((err = dhd->prot->d2h_edl_sync_cb(dhd, ring, msg)) != BCME_OK) { in dhd_prot_process_edl_complete()
6529 dhd_prot_t *prot = NULL; in dhd_prot_edl_ring_tcm_rd_update() local
6536 prot = dhd->prot; in dhd_prot_edl_ring_tcm_rd_update()
6537 if (!prot || !prot->d2hring_edl) in dhd_prot_edl_ring_tcm_rd_update()
6540 ring = prot->d2hring_edl; in dhd_prot_edl_ring_tcm_rd_update()
6600 dhd_prot_t *prot = dhd->prot; in BCMFASTPATH() local
6637 if (ringtype == DHD_HP2P_RING && prot->d2hring_hp2p_rxcpl) in BCMFASTPATH()
6638 ring = prot->d2hring_hp2p_rxcpl; in BCMFASTPATH()
6641 ring = &prot->d2hring_rx_cpln; in BCMFASTPATH()
6674 sync = prot->d2h_sync_cb(dhd, ring, &msg->cmn_hdr, item_len); in BCMFASTPATH()
6696 DHD_PKTID_AUDIT_RING_DEBUG(dhd, dhd->prot->pktid_rx_map, pktid, in BCMFASTPATH()
6700 pkt = DHD_PKTID_TO_NATIVE(dhd, prot->pktid_rx_map, pktid, pa, in BCMFASTPATH()
6708 dhd->prot->tot_rxcpl++; in BCMFASTPATH()
6717 if ((dhd->prot->hmaptest_rx_active == HMAPTEST_D11_RX_POSTED) && in BCMFASTPATH()
6718 (pktid == dhd->prot->hmaptest_rx_pktid)) { in BCMFASTPATH()
6721 ptr = PKTDATA(dhd->osh, pkt) - (prot->rx_metadata_offset); in BCMFASTPATH()
6722 DMA_UNMAP(dhd->osh, dhd->prot->hmap_rx_buf_pa, in BCMFASTPATH()
6723 (uint)dhd->prot->hmap_rx_buf_len, DMA_RX, 0, dmah); in BCMFASTPATH()
6729 dhd->prot->hmap_rx_buf_va, in BCMFASTPATH()
6730 (uint32)PHYSADDRLO(dhd->prot->hmap_rx_buf_pa))); in BCMFASTPATH()
6733 memcpy(ptr, dhd->prot->hmap_rx_buf_va, dhd->prot->hmap_rx_buf_len); in BCMFASTPATH()
6734 dhd->prot->hmaptest_rx_active = HMAPTEST_D11_RX_INACTIVE; in BCMFASTPATH()
6735 dhd->prot->hmap_rx_buf_va = NULL; in BCMFASTPATH()
6736 dhd->prot->hmap_rx_buf_len = 0; in BCMFASTPATH()
6737 PHYSADDRHISET(dhd->prot->hmap_rx_buf_pa, 0); in BCMFASTPATH()
6738 PHYSADDRLOSET(dhd->prot->hmap_rx_buf_pa, 0); in BCMFASTPATH()
6739 prot->hmaptest.in_progress = FALSE; in BCMFASTPATH()
6756 if (prot->metadata_dbg && prot->rx_metadata_offset && in BCMFASTPATH()
6759 ptr = PKTDATA(dhd->osh, pkt) - (prot->rx_metadata_offset); in BCMFASTPATH()
6772 else if (prot->rx_dataoffset) { in BCMFASTPATH()
6774 PKTPULL(dhd->osh, pkt, prot->rx_dataoffset); in BCMFASTPATH()
6826 if (dhd->hp2p_capable && ring == prot->d2hring_hp2p_rxcpl) { in BCMFASTPATH()
6835 if (dhd->prot->rx_ts_log_enabled) { in BCMFASTPATH()
6949 if (ringtype == DHD_HP2P_RING && dhd->prot->d2hring_hp2p_txcpl) in BCMFASTPATH()
6950 ring = dhd->prot->d2hring_hp2p_txcpl; in BCMFASTPATH()
6953 ring = &dhd->prot->d2hring_tx_cpln; in BCMFASTPATH()
7009 dhd->prot->txcpl_db_cnt++; in BCMFASTPATH()
7019 dhd_dma_buf_t *trap_addr = &dhd->prot->fw_trap_buf; in BCMFASTPATH()
7066 dhd_prot_t *prot = dhd->prot; in BCMFASTPATH() local
7067 msgbuf_ring_t *ring = &prot->d2hring_ctrl_cpln; in BCMFASTPATH()
7146 msg_type = dhd->prot->d2h_sync_cb(dhd, ring, msg, item_len); in BCMFASTPATH()
7181 if (ring == dhd->prot->d2hring_info_cpln) { in BCMFASTPATH()
7182 if (!dhd->prot->infobufpost) { in BCMFASTPATH()
7187 dhd->prot->infobufpost--; in BCMFASTPATH()
7188 dhd_prot_infobufpost(dhd, dhd->prot->h2dring_info_subn); in BCMFASTPATH()
7192 else if (ring == dhd->prot->d2hring_btlog_cpln) { in BCMFASTPATH()
7195 if (!dhd->prot->btlogbufpost) { in BCMFASTPATH()
7201 dhd->prot->btlogbufpost--; in BCMFASTPATH()
7203 dhd_prot_infobufpost(dhd, dhd->prot->h2dring_btlog_subn); in BCMFASTPATH()
7261 if (dhd->prot->h2dring_info_subn != NULL) { in dhd_prot_ringstatus_process()
7262 if (dhd->prot->h2dring_info_subn->create_pending == TRUE) { in dhd_prot_ringstatus_process()
7264 dhd->prot->h2dring_info_subn->create_pending = FALSE; in dhd_prot_ringstatus_process()
7274 if (dhd->prot->d2hring_info_cpln != NULL) { in dhd_prot_ringstatus_process()
7275 if (dhd->prot->d2hring_info_cpln->create_pending == TRUE) { in dhd_prot_ringstatus_process()
7277 dhd->prot->d2hring_info_cpln->create_pending = FALSE; in dhd_prot_ringstatus_process()
7288 if (dhd->prot->h2dring_btlog_subn != NULL) { in dhd_prot_ringstatus_process()
7289 if (dhd->prot->h2dring_btlog_subn->create_pending == TRUE) { in dhd_prot_ringstatus_process()
7291 dhd->prot->h2dring_btlog_subn->create_pending = FALSE; in dhd_prot_ringstatus_process()
7301 if (dhd->prot->d2hring_btlog_cpln != NULL) { in dhd_prot_ringstatus_process()
7302 if (dhd->prot->d2hring_btlog_cpln->create_pending == TRUE) { in dhd_prot_ringstatus_process()
7304 dhd->prot->d2hring_btlog_cpln->create_pending = FALSE; in dhd_prot_ringstatus_process()
7316 if (dhd->prot->d2hring_hp2p_txcpl != NULL) { in dhd_prot_ringstatus_process()
7317 if (dhd->prot->d2hring_hp2p_txcpl->create_pending == TRUE) { in dhd_prot_ringstatus_process()
7319 dhd->prot->d2hring_hp2p_txcpl->create_pending = FALSE; in dhd_prot_ringstatus_process()
7329 if (dhd->prot->d2hring_hp2p_rxcpl != NULL) { in dhd_prot_ringstatus_process()
7330 if (dhd->prot->d2hring_hp2p_rxcpl->create_pending == TRUE) { in dhd_prot_ringstatus_process()
7332 dhd->prot->d2hring_hp2p_rxcpl->create_pending = FALSE; in dhd_prot_ringstatus_process()
7378 DHD_PKTID_AUDIT_RING_DEBUG(dhd, dhd->prot->pktid_ctrl_map, pktid, in dhd_prot_ioctack_process()
7381 DHD_PKTID_AUDIT_RING_DEBUG(dhd, dhd->prot->pktid_map_handle_ioctl, pktid, in dhd_prot_ioctack_process()
7387 dhd->prot->ioctl_ack_time = OSL_LOCALTIME_NS(); in dhd_prot_ioctack_process()
7390 if ((dhd->prot->ioctl_state & MSGBUF_IOCTL_ACK_PENDING) && in dhd_prot_ioctack_process()
7391 (dhd->prot->ioctl_state & MSGBUF_IOCTL_RESP_PENDING)) { in dhd_prot_ioctack_process()
7392 dhd->prot->ioctl_state &= ~MSGBUF_IOCTL_ACK_PENDING; in dhd_prot_ioctack_process()
7395 __FUNCTION__, dhd->prot->ioctl_state, dhd->prot->ioctl_trans_id)); in dhd_prot_ioctack_process()
7419 dhd_prot_t *prot = dhd->prot; in dhd_prot_ioctcmplt_process() local
7444 DHD_PKTID_AUDIT_RING_DEBUG(dhd, prot->pktid_ctrl_map, pkt_id, in dhd_prot_ioctcmplt_process()
7447 DHD_PKTID_AUDIT_RING_DEBUG(dhd, prot->pktid_map_handle_ioctl, pkt_id, in dhd_prot_ioctcmplt_process()
7453 if ((prot->ioctl_state & MSGBUF_IOCTL_ACK_PENDING) || in dhd_prot_ioctcmplt_process()
7454 !(prot->ioctl_state & MSGBUF_IOCTL_RESP_PENDING)) { in dhd_prot_ioctcmplt_process()
7456 __FUNCTION__, dhd->prot->ioctl_state, dhd->prot->ioctl_trans_id)); in dhd_prot_ioctcmplt_process()
7463 dhd->prot->ioctl_cmplt_time = OSL_LOCALTIME_NS(); in dhd_prot_ioctcmplt_process()
7466 prot->ioctl_state &= ~MSGBUF_IOCTL_RESP_PENDING; in dhd_prot_ioctcmplt_process()
7482 prot->ioctl_resplen = ltoh16(ioct_resp->resp_len); in dhd_prot_ioctcmplt_process()
7483 prot->ioctl_status = ltoh16(ioct_resp->compl_hdr.status); in dhd_prot_ioctcmplt_process()
7486 if (xt_id != prot->ioctl_trans_id || prot->curr_ioctl_cmd != ioct_resp->cmd) { in dhd_prot_ioctcmplt_process()
7488 __FUNCTION__, xt_id, prot->ioctl_trans_id, in dhd_prot_ioctcmplt_process()
7489 prot->curr_ioctl_cmd, ioct_resp->cmd)); in dhd_prot_ioctcmplt_process()
7517 pkt_id, xt_id, prot->ioctl_status, prot->ioctl_resplen)); in dhd_prot_ioctcmplt_process()
7519 if (prot->ioctl_resplen > 0) { in dhd_prot_ioctcmplt_process()
7521 bcopy(PKTDATA(dhd->osh, pkt), prot->retbuf.va, prot->ioctl_resplen); in dhd_prot_ioctcmplt_process()
7523 bcopy(pkt, prot->retbuf.va, prot->ioctl_resplen); in dhd_prot_ioctcmplt_process()
7539 if (prot->cur_ioctlresp_bufs_posted > 0) { in dhd_prot_ioctcmplt_process()
7540 prot->cur_ioctlresp_bufs_posted--; in dhd_prot_ioctcmplt_process()
7549 return dhd->prot->no_tx_resource; in dhd_prot_check_tx_resource()
7852 dhd_prot_t *prot = dhd->prot; in BCMFASTPATH() local
7862 msgbuf_ring_t *ring = &dhd->prot->d2hring_tx_cpln; in BCMFASTPATH()
7905 flow_ring = DHD_RING_IN_FLOWRINGS_POOL(prot, flowid); in BCMFASTPATH()
7919 if (dhd->prot->d2hring_hp2p_txcpl && in BCMFASTPATH()
7921 ring = dhd->prot->d2hring_hp2p_txcpl; in BCMFASTPATH()
7955 DHD_PKTID_AUDIT_RING_DEBUG(dhd, dhd->prot->pktid_tx_map, pktid, in BCMFASTPATH()
7960 if (OSL_ATOMIC_DEC_RETURN(dhd->osh, &prot->active_tx_count) < 0) { in BCMFASTPATH()
7967 if ((dhd->prot->hmaptest_tx_active == HMAPTEST_D11_TX_POSTED) && in BCMFASTPATH()
7968 (pktid == dhd->prot->hmaptest_tx_pktid)) { in BCMFASTPATH()
7972 dhd->prot->hmap_tx_buf_va, (uint32)PHYSADDRLO(dhd->prot->hmap_tx_buf_pa))); in BCMFASTPATH()
7973 dhd->prot->hmaptest_tx_active = HMAPTEST_D11_TX_INACTIVE; in BCMFASTPATH()
7974 dhd->prot->hmap_tx_buf_va = NULL; in BCMFASTPATH()
7975 dhd->prot->hmap_tx_buf_len = 0; in BCMFASTPATH()
7976 PHYSADDRHISET(dhd->prot->hmap_tx_buf_pa, 0); in BCMFASTPATH()
7977 PHYSADDRLOSET(dhd->prot->hmap_tx_buf_pa, 0); in BCMFASTPATH()
7978 prot->hmaptest.in_progress = FALSE; in BCMFASTPATH()
7987 meta_data_buf.va = DHD_PKTID_RETREIVE_METADATA(dhd, dhd->prot->pktid_tx_map, in BCMFASTPATH()
8004 pkt = DHD_PKTID_TO_NATIVE(dhd, dhd->prot->pktid_tx_map, pktid, in BCMFASTPATH()
8033 if (DHD_PKTID_AVAIL(dhd->prot->pktid_tx_map) == DHD_PKTID_MIN_AVAIL_COUNT) { in BCMFASTPATH()
8036 prot->pktid_txq_stop_cnt--; in BCMFASTPATH()
8037 dhd->prot->no_tx_resource = FALSE; in BCMFASTPATH()
8196 if (dhd->prot->metadata_dbg && in BCMFASTPATH()
8197 dhd->prot->tx_metadata_offset && txstatus->metadata_len) { in BCMFASTPATH()
8203 ptr = PKTDATA(dhd->osh, pkt) - (dhd->prot->tx_metadata_offset); in BCMFASTPATH()
8219 if (dhd->prot->tx_ts_log_enabled) { in BCMFASTPATH()
8268 dhd_prot_t *prot = dhd->prot; in dhd_prot_event_process() local
8275 DHD_PKTID_AUDIT_RING_DEBUG(dhd, dhd->prot->pktid_ctrl_map, bufid, in dhd_prot_event_process()
8285 if (prot->cur_event_bufs_posted) in dhd_prot_event_process()
8286 prot->cur_event_bufs_posted--; in dhd_prot_event_process()
8299 if (dhd->prot->rx_dataoffset) in dhd_prot_event_process()
8300 PKTPULL(dhd->osh, pkt, dhd->prot->rx_dataoffset); in dhd_prot_event_process()
8325 DHD_PKTID_AUDIT_RING_DEBUG(dhd, dhd->prot->pktid_ctrl_map, pktid, in BCMFASTPATH()
8331 dhd->prot->rx_dataoffset)); in BCMFASTPATH()
8346 if (dhd->prot->rx_dataoffset) in BCMFASTPATH()
8347 PKTPULL(dhd->osh, pkt, dhd->prot->rx_dataoffset); in BCMFASTPATH()
8367 dhd_prot_t *prot = dhd->prot; in BCMFASTPATH() local
8390 prot->snapshot_upload_len = ltoh32(resp->resp_len); in BCMFASTPATH()
8391 prot->snapshot_type = resp->type; in BCMFASTPATH()
8392 prot->snapshot_cmpl_pending = FALSE; in BCMFASTPATH()
8397 prot->snapshot_upload_len, prot->snapshot_type)); in BCMFASTPATH()
8423 DHD_PKTID_AUDIT_RING_DEBUG(dhd, dhd->prot->pktid_ctrl_map, pktid, in BCMFASTPATH()
8429 dhd->prot->rx_dataoffset)); in BCMFASTPATH()
8439 if (dhd->prot->rx_dataoffset) in BCMFASTPATH()
8440 PKTPULL(dhd->osh, pkt, dhd->prot->rx_dataoffset); in BCMFASTPATH()
8457 if (dhd->prot) { in dhd_prot_stop()
8458 DHD_NATIVE_TO_PKTID_RESET(dhd, dhd->prot->pktid_ctrl_map); in dhd_prot_stop()
8459 DHD_NATIVE_TO_PKTID_RESET(dhd, dhd->prot->pktid_rx_map); in dhd_prot_stop()
8460 DHD_NATIVE_TO_PKTID_RESET(dhd, dhd->prot->pktid_tx_map); in dhd_prot_stop()
8462 DHD_NATIVE_TO_PKTID_RESET_IOCTL(dhd, dhd->prot->pktid_map_handle_ioctl); in dhd_prot_stop()
8493 dhd_prot_t *prot = dhd->prot; local
8533 if (!DHD_PKTID_AVAIL(dhd->prot->pktid_tx_map)) {
8534 if (dhd->prot->pktid_depleted_cnt == DHD_PKTID_DEPLETED_MAX_COUNT) {
8537 prot->pktid_txq_stop_cnt++;
8539 dhd->prot->no_tx_resource = TRUE;
8541 dhd->prot->pktid_depleted_cnt++;
8544 dhd->prot->pktid_depleted_cnt = 0;
8621 pktid = DHD_NATIVE_TO_PKTID_RSV(dhd, dhd->prot->pktid_tx_map,
8641 __FUNCTION__, __LINE__, OSL_ATOMIC_READ(dhd->osh, &prot->active_tx_count)));
8744 DHD_NATIVE_TO_PKTID_SAVE(dhd, dhd->prot->pktid_tx_map, PKTBUF, pktid,
8753 if (dhd->prot->hmaptest_tx_active == HMAPTEST_D11_TX_ACTIVE) {
8755 dhd->prot->hmap_tx_buf_va = (char *)dhd->prot->hmaptest.mem.va
8756 + dhd->prot->hmaptest.offset;
8758 dhd->prot->hmap_tx_buf_len = pktlen;
8759 if ((dhd->prot->hmap_tx_buf_va + dhd->prot->hmap_tx_buf_len) >
8760 ((char *)dhd->prot->hmaptest.mem.va + dhd->prot->hmaptest.mem.len)) {
8763 dhd->prot->hmaptest_tx_active = HMAPTEST_D11_TX_INACTIVE;
8764 dhd->prot->hmaptest.in_progress = FALSE;
8767 memcpy(dhd->prot->hmap_tx_buf_va, PKTDATA(dhd->osh, PKTBUF), pktlen);
8768 pa = DMA_MAP(dhd->osh, dhd->prot->hmap_tx_buf_va,
8769 dhd->prot->hmap_tx_buf_len, DMA_TX, PKTBUF, 0);
8771 dhd->prot->hmap_tx_buf_pa = pa;
8773 dhd->prot->hmaptest_tx_pktid = pktid;
8774 dhd->prot->hmaptest_tx_active = HMAPTEST_D11_TX_POSTED;
8777 dhd->prot->hmap_tx_buf_va, (uint32)PHYSADDRLO(pa), pktlen));
8795 DHD_PKTID_SAVE_METADATA(dhd, dhd->prot->pktid_tx_map,
8848 if (!llc_inserted && dhd->prot->tx_ts_log_enabled) {
8854 if (dhd->prot->no_retry)
8856 if (dhd->prot->no_aggr)
8858 if (dhd->prot->fixed_rate)
8896 if (prot->tx_metadata_offset && (headroom < prot->tx_metadata_offset))
8898 prot->tx_metadata_offset, headroom));
8900 if (prot->tx_metadata_offset && (headroom >= prot->tx_metadata_offset)) {
8901 DHD_TRACE(("Metadata in tx %d\n", prot->tx_metadata_offset));
8904 PKTPUSH(dhd->osh, PKTBUF, prot->tx_metadata_offset);
8907 prot->tx_metadata_offset, DMA_RX, PKTBUF, 0);
8927 PKTPULL(dhd->osh, PKTBUF, prot->tx_metadata_offset);
8929 txdesc->metadata_buf_len = prot->tx_metadata_offset;
8954 DHD_PKTID_AUDIT(dhd, prot->pktid_tx_map, pktid, DHD_DUPLICATE_ALLOC);
8974 if ((ring->pend_items_count == prot->txp_threshold) ||
9007 OSL_ATOMIC_INC(dhd->osh, &prot->active_tx_count);
9042 DHD_PKTID_TO_NATIVE(dhd, dhd->prot->pktid_tx_map, pktid,
9113 dhd->prot->tx_h2d_db_cnt++;
9132 dhd_prot_t *prot = dhd->prot; local
9134 if (prot->rxbufpost >= rxcnt) {
9135 prot->rxbufpost -= (uint16)rxcnt;
9141 prot->rxbufpost = 0;
9144 if (prot->rxbufpost <= (prot->max_rxbufpost - RXBUFPOST_THRESHOLD)) {
9161 dhd_prot_t *prot = dhd->prot; local
9164 uint32 len = dhd->prot->hmaptest.len;
9168 end_usec -= prot->hmaptest.start_usec;
9172 prot->hmaptest.in_progress = FALSE;
9173 if (prot->hmaptest.accesstype == HMAPTEST_ACCESS_M2M) {
9175 } else if (prot->hmaptest.accesstype == HMAPTEST_ACCESS_ARM) {
9180 readbuf = (char *)dhd->prot->hmaptest.mem.va + dhd->prot->hmaptest.offset;
9181 OSL_CACHE_FLUSH(dhd->prot->hmaptest.mem.va,
9182 dhd->prot->hmaptest.mem.len);
9183 if (prot->hmaptest.is_write) {
9208 dhd_prot_t *prot = dhd->prot; local
9211 scratch_pa = prot->hmaptest.mem.pa;
9212 scratch_len = prot->hmaptest.mem.len;
9291 dhd->prot->hmaptest.in_progress = FALSE;
9328 dhd_prot_t *prot = dhd->prot; local
9331 scratch_pa = prot->hmaptest.mem.pa;
9332 scratch_len = prot->hmaptest.mem.len;
9350 OSL_CACHE_FLUSH(dhd->prot->hmaptest.mem.va,
9351 dhd->prot->hmaptest.mem.len);
9356 prot->hmap_enabled = nwindows ? TRUE : FALSE;
9360 DHD_ERROR(("hmap: hmap status = %s\n", (prot->hmap_enabled ? "Enabled" : "Disabled")));
9404 dhd_prot_t *prot = dhd->prot; local
9411 if (prot->hmaptest.in_progress) {
9416 prot->hmaptest.in_progress = TRUE;
9422 prot->hmaptest.accesstype = hmaptest_params->accesstype;
9423 prot->hmaptest.is_write = hmaptest_params->is_write;
9424 prot->hmaptest.len = hmaptest_params->xfer_len;
9425 prot->hmaptest.offset = hmaptest_params->host_offset;
9426 offset = prot->hmaptest.offset;
9429 prot->hmaptest.is_write, prot->hmaptest.accesstype,
9430 offset, prot->hmaptest.len, hmaptest_params->value));
9433 (uint32)PHYSADDRLO(prot->hmaptest.mem.pa),
9434 (uint32)PHYSADDRHI(prot->hmaptest.mem.pa)));
9436 if (prot->hmaptest.accesstype == HMAPTEST_ACCESS_D11) {
9437 if (prot->hmaptest.is_write) {
9439 dhd->prot->hmaptest_rx_active = HMAPTEST_D11_RX_ACTIVE;
9442 dhd->prot->hmaptest_tx_active = HMAPTEST_D11_TX_ACTIVE;
9448 uint32 maxbuflen = MIN(prot->hmaptest.len, (PKTBUFSZ));
9449 char *fillbuf = (char *)dhd->prot->hmaptest.mem.va
9452 ((char *)dhd->prot->hmaptest.mem.va + dhd->prot->hmaptest.mem.len)) {
9454 dhd->prot->hmaptest.in_progress = FALSE;
9458 if (prot->hmaptest.accesstype == HMAPTEST_ACCESS_M2M) {
9460 } else if (prot->hmaptest.accesstype == HMAPTEST_ACCESS_ARM) {
9463 prot->hmaptest.in_progress = FALSE;
9478 OSL_CACHE_FLUSH(dhd->prot->hmaptest.mem.va,
9479 dhd->prot->hmaptest.mem.len);
9489 if (prot->hmaptest.accesstype == HMAPTEST_ACCESS_D11) {
9494 scratch_lin = (uint64)(PHYSADDRLO(prot->hmaptest.mem.pa) & 0xffffffff)
9495 | (((uint64)PHYSADDRHI(prot->hmaptest.mem.pa) & 0xffffffff) << 32);
9502 prot->hmaptest.start_usec = OSL_SYSUPTIME_US();
9513 dhd_prot_t *prot = dhd->prot; local
9521 bcopy(&prot->host_bus_throughput_buf.pa, &tput_params->host_buf_addr,
9749 dhd_prot_t *prot = dhd->prot; local
9756 msgbuf_ring_t *ring = &prot->h2dring_ctrl_subn;
9825 dhd_prot_t *prot = dhdp->prot; local
9826 dhd_dmaxfer_t *dmaxfer = &prot->dmaxfer;
9912 dhd_prot_t *prot = dhd->prot; local
9927 prot->dmaxfer.status = cmplt->compl_hdr.status;
9928 OSL_CACHE_INV(prot->dmaxfer.dstmem.va, prot->dmaxfer.len);
9929 if (prot->dmaxfer.d11_lpbk != M2M_WRITE_TO_RAM &&
9930 prot->dmaxfer.d11_lpbk != M2M_READ_FROM_RAM &&
9931 prot->dmaxfer.d11_lpbk != D11_WRITE_TO_RAM &&
9932 prot->dmaxfer.d11_lpbk != D11_READ_FROM_RAM) {
9933 err = memcmp(prot->dmaxfer.srcmem.va,
9934 prot->dmaxfer.dstmem.va, prot->dmaxfer.len);
9936 if (prot->dmaxfer.srcmem.va && prot->dmaxfer.dstmem.va) {
9945 prot->dmaxfer.status = BCME_ERROR;
9947 prot->dmaxfer.srcmem.va, prot->dmaxfer.len);
9949 prot->dmaxfer.dstmem.va, prot->dmaxfer.len);
9952 switch (prot->dmaxfer.d11_lpbk) {
9977 prot->dmaxfer.dstmem.va, prot->dmaxfer.len);
9985 prot->dmaxfer.dstmem.va, prot->dmaxfer.len);
9994 dhd_prhex("XFER SRC: ", prot->dmaxfer.srcmem.va,
9995 prot->dmaxfer.len, DHD_INFO_VAL);
9996 dhd_prhex("XFER DST: ", prot->dmaxfer.dstmem.va,
9997 prot->dmaxfer.len, DHD_INFO_VAL);
10003 end_usec -= prot->dmaxfer.start_usec;
10005 prot->dmaxfer.time_taken = end_usec;
10007 prot->dmaxfer.len, (unsigned long)end_usec,
10008 (prot->dmaxfer.len * (1000 * 1000 / 1024) / (uint32)end_usec)));
10010 dhd->prot->dmaxfer.in_progress = FALSE;
10029 dhd_prot_t *prot = dhd->prot; local
10033 msgbuf_ring_t *ring = &prot->h2dring_ctrl_subn;
10036 if (prot->dmaxfer.in_progress) {
10053 prot->dmaxfer.in_progress = TRUE;
10055 &prot->dmaxfer)) != BCME_OK) {
10056 prot->dmaxfer.in_progress = FALSE;
10067 dmaxfer_free_dmaaddr(dhd, &prot->dmaxfer);
10068 prot->dmaxfer.in_progress = FALSE;
10083 dmap->host_input_buf_addr.high = htol32(PHYSADDRHI(prot->dmaxfer.srcmem.pa));
10084 dmap->host_input_buf_addr.low = htol32(PHYSADDRLO(prot->dmaxfer.srcmem.pa));
10085 dmap->host_ouput_buf_addr.high = htol32(PHYSADDRHI(prot->dmaxfer.dstmem.pa));
10086 dmap->host_ouput_buf_addr.low = htol32(PHYSADDRLO(prot->dmaxfer.dstmem.pa));
10087 dmap->xfer_len = htol32(prot->dmaxfer.len);
10088 dmap->srcdelay = htol32(prot->dmaxfer.srcdelay);
10089 dmap->destdelay = htol32(prot->dmaxfer.destdelay);
10090 prot->dmaxfer.d11_lpbk = d11_lpbk;
10106 ((prot->dmaxfer.d11_lpbk & PCIE_DMA_XFER_FLG_D11_LPBK_MASK)
10108 prot->dmaxfer.start_usec = OSL_SYSUPTIME_US();
10126 dhd_prot_t *prot = dhd->prot; local
10128 if (prot->dmaxfer.in_progress)
10130 else if (prot->dmaxfer.status == 0)
10135 result->type = prot->dmaxfer.d11_lpbk;
10136 result->error_code = prot->dmaxfer.status;
10137 result->num_bytes = prot->dmaxfer.len;
10138 result->time_taken = prot->dmaxfer.time_taken;
10139 if (prot->dmaxfer.time_taken) {
10142 (prot->dmaxfer.len * (1000 * 1000 / 1024)) /
10143 (uint32)prot->dmaxfer.time_taken;
10212 dhd_set_request_id(dhd, dhd->prot->ioctl_trans_id+1, cmd);
10247 dhd_prot_t *prot = dhd->prot; local
10253 dhd->rxcnt_timeout, prot->curr_ioctl_cmd, prot->ioctl_trans_id,
10254 prot->ioctl_state, dhd->busstate, prot->ioctl_received));
10273 if (prot->curr_ioctl_cmd == WLC_SET_VAR ||
10274 prot->curr_ioctl_cmd == WLC_GET_VAR) {
10277 uint8 *ioctl_buf = (uint8 *)prot->ioctbuf.va;
10282 prot->curr_ioctl_cmd == WLC_SET_VAR ?
10308 dhd_prot_t *prot = dhd->prot; local
10326 timeleft = dhd_os_ioctl_resp_wait(dhd, (uint *)&prot->ioctl_received);
10331 timeleft = dhd_os_ioctl_resp_wait(dhd, (uint *)&prot->ioctl_received);
10335 if (prot->ioctl_received == 0) {
10347 timeleft = dhd_os_ioctl_resp_wait(dhd, (uint *)&prot->ioctl_received);
10368 timeleft = dhd_os_ioctl_resp_wait(dhd, &prot->ioctl_received);
10424 if (prot->ioctl_received != IOCTL_RETURN_ON_SUCCESS) {
10426 __FUNCTION__, prot->ioctl_received));
10433 __FUNCTION__, prot->ioctl_resplen));
10436 if (dhd->prot->ioctl_resplen > len)
10437 dhd->prot->ioctl_resplen = (uint16)len;
10439 bcopy(dhd->prot->retbuf.va, buf, dhd->prot->ioctl_resplen);
10441 ret = (int)(dhd->prot->ioctl_status);
10445 dhd->prot->ioctl_state = 0;
10446 dhd->prot->ioctl_resplen = 0;
10447 dhd->prot->ioctl_received = IOCTL_WAIT;
10448 dhd->prot->curr_ioctl_cmd = 0;
10494 dhd_set_request_id(dhd, dhd->prot->ioctl_trans_id+1, cmd);
10543 dhd_prot_t *prot; local
10549 if (!(dhd) || !(dhd->prot)) {
10552 prot = dhd->prot;
10555 ring = &prot->h2dring_ctrl_subn;
10559 ring = &prot->h2dring_rxp_subn;
10563 ring = &prot->d2hring_ctrl_cpln;
10567 ring = &prot->d2hring_tx_cpln;
10571 ring = &prot->d2hring_rx_cpln;
10576 FOREACH_RING_IN_FLOWRINGS_POOL(prot, ring, flowid, h2d_flowrings_total) {
10584 ring = prot->d2hring_edl;
10593 ring = prot->h2dring_info_subn;
10597 ring = prot->d2hring_info_cpln;
10699 dhd->prot->d2h_sync_wait_max, dhd->prot->d2h_sync_wait_tot);
10704 dhd->prot->rw_index_sz);
10706 h2d_max_txpost, dhd->prot->h2d_max_txpost);
10709 h2d_htput_max_txpost, dhd->prot->h2d_htput_max_txpost);
10711 bcm_bprintf(b, "pktid_txq_start_cnt: %d\n", dhd->prot->pktid_txq_start_cnt);
10712 bcm_bprintf(b, "pktid_txq_stop_cnt: %d\n", dhd->prot->pktid_txq_stop_cnt);
10713 bcm_bprintf(b, "pktid_depleted_cnt: %d\n", dhd->prot->pktid_depleted_cnt);
10714 bcm_bprintf(b, "txcpl_db_cnt: %d\n", dhd->prot->txcpl_db_cnt);
10719 bcm_bprintf(b, "tx_h2d_db_cnt:%llu\n", dhd->prot->tx_h2d_db_cnt);
10724 dhd->prot->agg_h2d_db_info.timer_db_cnt, dhd->prot->agg_h2d_db_info.direct_db_cnt);
10750 dhd_prot_t *prot = dhd->prot; local
10751 msgbuf_ring_t *ring = &prot->h2dring_ctrl_subn;
10855 dhd_prot_t *prot = dhd->prot; local
10861 msgbuf_ring_t *ring = &prot->h2dring_ctrl_subn;
10902 if (prot->ioctl_state) {
10903 DHD_ERROR(("%s: pending ioctl %02x\n", __FUNCTION__, prot->ioctl_state));
10910 prot->ioctl_state = MSGBUF_IOCTL_ACK_PENDING | MSGBUF_IOCTL_RESP_PENDING;
10918 prot->ioctl_state = 0;
10919 prot->curr_ioctl_cmd = 0;
10920 prot->ioctl_received = IOCTL_WAIT;
10937 prot->curr_ioctl_cmd = cmd;
10939 prot->ioctl_trans_id++;
10940 ioct_rqst->trans_id = prot->ioctl_trans_id;
10944 ioct_rqst->host_input_buf_addr.high = htol32(PHYSADDRHI(prot->ioctbuf.pa));
10945 ioct_rqst->host_input_buf_addr.low = htol32(PHYSADDRLO(prot->ioctbuf.pa));
10947 ioct_buf = (void *) prot->ioctbuf.va;
10949 prot->ioctl_fillup_time = OSL_LOCALTIME_NS();
10954 OSL_CACHE_FLUSH((void *) prot->ioctbuf.va, len);
10996 dhd_prot_t *prot = dhd->prot; local
11013 max_items = prot->h2d_htput_max_txpost;
11023 if (DHD_IS_FLOWRING(ringid, max_flowrings) && (prot->flowrings_dma_buf.va)) {
11027 dhd_dma_buf_t *rsv_buf = &prot->flowrings_dma_buf;
11050 if (ring == dhd->prot->d2hring_edl) {
11142 dhd_prot_t *prot = dhd->prot; local
11152 if (DHD_IS_FLOWRING(ring->idx, max_flowrings) && (prot->flowrings_dma_buf.va)) {
11157 if (ring == dhd->prot->d2hring_edl) {
11206 dhd_prot_t *prot = dhd->prot; local
11209 if (prot->h2d_flowrings_pool != NULL)
11212 ASSERT(prot->h2d_rings_total == 0);
11215 prot->h2d_rings_total = (uint16)dhd_bus_max_h2d_queues(dhd->bus);
11217 if (prot->h2d_rings_total < BCMPCIE_H2D_COMMON_MSGRINGS) {
11219 __FUNCTION__, prot->h2d_rings_total));
11229 prot->h2d_flowrings_pool = (msgbuf_ring_t *)MALLOCZ(prot->osh,
11232 if (prot->h2d_flowrings_pool == NULL) {
11239 FOREACH_RING_IN_FLOWRINGS_POOL(prot, ring, flowid, h2d_flowrings_total) {
11243 prot->h2d_max_txpost, H2DRING_TXPOST_ITEMSIZE,
11258 prot->h2d_rings_total = 0;
11283 dhd_prot_t *prot = dhd->prot; local
11285 if (prot->h2d_flowrings_pool == NULL) {
11286 ASSERT(prot->h2d_rings_total == 0);
11291 FOREACH_RING_IN_FLOWRINGS_POOL(prot, ring, flowid, h2d_flowrings_total) {
11311 dhd_prot_t *prot = dhd->prot; local
11313 if (prot->h2d_flowrings_pool == NULL) {
11314 ASSERT(prot->h2d_rings_total == 0);
11320 FOREACH_RING_IN_FLOWRINGS_POOL(prot, ring, flowid, h2d_flowrings_total) {
11324 MFREE(prot->osh, prot->h2d_flowrings_pool,
11327 prot->h2d_rings_total = 0;
11345 dhd_prot_t *prot = dhd->prot; local
11348 ASSERT(flowid < prot->h2d_rings_total);
11349 ASSERT(prot->h2d_flowrings_pool != NULL);
11351 ring = DHD_RING_IN_FLOWRINGS_POOL(prot, flowid);
11375 dhd_prot_t *prot = dhd->prot; local
11378 ASSERT(flowid < prot->h2d_rings_total);
11379 ASSERT(prot->h2d_flowrings_pool != NULL);
11381 ring = DHD_RING_IN_FLOWRINGS_POOL(prot, flowid);
11399 dhd_prot_t *prot = dhd->prot; local
11405 ring = DHD_RING_IN_FLOWRINGS_POOL(prot, flowid);
11503 dhd_prot_t *prot = dhd->prot; local
11512 prot->agg_h2d_db_info.direct_db_cnt++;
11526 prot->mb_2_ring_fn(dhd->bus, db_index, TRUE);
11528 prot->mb_ring_fn(dhd->bus, DHD_WRPTR_UPDATE_H2D_DB_MAGIC(ring));
11531 dhd_msgbuf_agg_h2d_db_timer_start(prot);
11550 dhd_prot_t *prot = dhd->prot; local
11581 prot->mb_2_ring_fn(dhd->bus, db_index, TRUE);
11583 prot->mb_ring_fn(dhd->bus, DHD_WRPTR_UPDATE_H2D_DB_MAGIC(ring));
11602 dhd->prot->mb_ring_fn(dhd->bus, value);
11637 dhd_prot_t *prot = dhd->prot; local
11657 prot->mb_2_ring_fn(dhd->bus, db_index, FALSE);
11676 msgbuf_ring_t *ctrl_ring = &dhd->prot->h2dring_ctrl_subn;
11766 msgbuf_ring_t *ctrl_ring = &dhd->prot->h2dring_ctrl_subn;
11847 dhd_prot_t *prot = dhd->prot; local
11852 ptr = (uint8 *)(prot->h2d_dma_indx_wr_buf.va);
11857 ptr = (uint8 *)(prot->d2h_dma_indx_rd_buf.va);
11862 ptr = (uint8 *)(prot->h2d_ifrm_indx_wr_buf.va);
11872 ASSERT(prot->rw_index_sz != 0);
11873 ptr += offset * prot->rw_index_sz;
11878 OSL_CACHE_FLUSH((void *)ptr, prot->rw_index_sz);
11897 dhd_prot_t *prot = dhd->prot; local
11902 ptr = (uint8 *)(prot->h2d_dma_indx_wr_buf.va);
11908 if (prot->h2d_dma_indx_rd_copy_buf) {
11909 ptr = (uint8 *)(prot->h2d_dma_indx_rd_copy_buf);
11913 ptr = (uint8 *)(prot->h2d_dma_indx_rd_buf.va);
11920 if (prot->d2h_dma_indx_wr_copy_buf) {
11921 ptr = (uint8 *)(prot->d2h_dma_indx_wr_copy_buf);
11925 ptr = (uint8 *)(prot->d2h_dma_indx_wr_buf.va);
11931 ptr = (uint8 *)(prot->d2h_dma_indx_rd_buf.va);
11941 ASSERT(prot->rw_index_sz != 0);
11942 ptr += offset * prot->rw_index_sz;
11944 OSL_CACHE_INV((void *)ptr, prot->rw_index_sz);
11961 dhd_prot_t *prot = dhd->prot; local
11964 ptr = (uint8 *)(prot->d2h_dma_scratch_buf.va);
11966 OSL_CACHE_FLUSH((void *)ptr, prot->d2h_dma_scratch_buf.len);
11976 dhd_prot_t *prot = dhd->prot; local
11985 ptr = (uint8 *)(prot->d2h_dma_scratch_buf.va);
11988 ptr = ((uint8 *)(prot->d2h_dma_scratch_buf.va) + sizeof(uint32));
11998 dhd_prot_t *prot = dhd->prot; local
12004 prot->host_seqnum, dngl_seqnum));
12005 if (prot->d2h_dma_indx_wr_copy_buf && prot->h2d_dma_indx_rd_copy_buf) {
12006 if (prot->host_seqnum == dngl_seqnum) {
12007 memcpy_s(prot->d2h_dma_indx_wr_copy_buf, prot->d2h_dma_indx_wr_copy_bufsz,
12008 prot->d2h_dma_indx_wr_buf.va, prot->d2h_dma_indx_wr_copy_bufsz);
12009 memcpy_s(prot->h2d_dma_indx_rd_copy_buf, prot->h2d_dma_indx_rd_copy_bufsz,
12010 prot->h2d_dma_indx_rd_buf.va, prot->h2d_dma_indx_rd_copy_bufsz);
12011 dhd_prot_write_host_seqnum(dhd, prot->host_seqnum);
12014 prot->host_seqnum++;
12015 prot->host_seqnum %= D2H_EPOCH_MODULO;
12023 dhd_prot_t *prot = dhd->prot; local
12027 prot->d2h_dma_indx_wr_copy_buf = MALLOCZ(dhd->osh, buf_sz);
12028 if (prot->d2h_dma_indx_wr_copy_buf == NULL) {
12033 prot->d2h_dma_indx_wr_copy_bufsz = buf_sz;
12037 prot->h2d_dma_indx_rd_copy_buf = MALLOCZ(dhd->osh, buf_sz);
12038 if (prot->h2d_dma_indx_rd_copy_buf == NULL) {
12043 prot->h2d_dma_indx_rd_copy_bufsz = buf_sz;
12083 dhd_prot_t *prot = dhd->prot; local
12086 if (prot == NULL) {
12093 prot->rw_index_sz = rw_index_sz;
12099 dma_buf = &prot->h2d_dma_indx_wr_buf;
12107 dma_buf = &prot->h2d_dma_indx_rd_buf;
12115 dma_buf = &prot->d2h_dma_indx_wr_buf;
12123 dma_buf = &prot->d2h_dma_indx_rd_buf;
12131 dma_buf = &prot->h2d_ifrm_indx_wr_buf;
12167 __FUNCTION__, (uint32 *)(dhd->prot->d2h_dma_indx_rd_buf.va),
12168 (uint32 *)(dhd->prot->d2h_dma_indx_wr_buf.va)));
12260 msgbuf_ring_t *ctrl_ring = &dhd->prot->h2dring_ctrl_subn;
12342 dhd_prot_t *prot = dhd->prot; local
12345 msgbuf_ring_t *ctrl_ring = &prot->h2dring_ctrl_subn;
12484 if (dhd->prot->h2dring_info_subn->create_req_id == ltoh32(resp->cmn_hdr.request_id) &&
12485 !dhd->prot->h2dring_info_subn->create_pending) {
12489 if (dhd->prot->h2dring_btlog_subn &&
12490 dhd->prot->h2dring_btlog_subn->create_req_id == ltoh32(resp->cmn_hdr.request_id) &&
12491 !dhd->prot->h2dring_btlog_subn->create_pending) {
12501 if (dhd->prot->h2dring_info_subn->create_req_id == ltoh32(resp->cmn_hdr.request_id)) {
12502 dhd->prot->h2dring_info_subn->create_pending = FALSE;
12503 dhd->prot->h2dring_info_subn->inited = TRUE;
12505 dhd_prot_infobufpost(dhd, dhd->prot->h2dring_info_subn);
12508 if (dhd->prot->h2dring_btlog_subn &&
12509 dhd->prot->h2dring_btlog_subn->create_req_id == ltoh32(resp->cmn_hdr.request_id)) {
12510 dhd->prot->h2dring_btlog_subn->create_pending = FALSE;
12511 dhd->prot->h2dring_btlog_subn->inited = TRUE;
12513 dhd_prot_infobufpost(dhd, dhd->prot->h2dring_btlog_subn);
12543 if (!dhd->prot->d2hring_info_cpln->create_pending) {
12553 dhd->prot->d2hring_info_cpln->create_pending = FALSE;
12554 dhd->prot->d2hring_info_cpln->inited = TRUE;
12558 if (!dhd->prot->d2hring_edl->create_pending) {
12568 dhd->prot->d2hring_edl->create_pending = FALSE;
12569 dhd->prot->d2hring_edl->inited = TRUE;
12576 if (!dhd->prot->d2hring_btlog_cpln->create_pending) {
12586 dhd->prot->d2hring_btlog_cpln->create_pending = FALSE;
12587 dhd->prot->d2hring_btlog_cpln->inited = TRUE;
12591 if (dhd->prot->d2hring_hp2p_txcpl &&
12593 if (!dhd->prot->d2hring_hp2p_txcpl->create_pending) {
12603 dhd->prot->d2hring_hp2p_txcpl->create_pending = FALSE;
12604 dhd->prot->d2hring_hp2p_txcpl->inited = TRUE;
12606 if (dhd->prot->d2hring_hp2p_rxcpl &&
12608 if (!dhd->prot->d2hring_hp2p_rxcpl->create_pending) {
12618 dhd->prot->d2hring_hp2p_rxcpl->create_pending = FALSE;
12619 dhd->prot->d2hring_hp2p_rxcpl->inited = TRUE;
12641 dhd_prot_t *prot = dhd->prot; local
12648 if (prot->hostts_req_buf_inuse == FALSE) {
12652 prot->hostts_req_buf_inuse = FALSE;
12714 dhd_prot_t *prot = dhd->prot; local
12716 dhd->prot->device_ipc_version,
12717 dhd->prot->host_ipc_version,
12718 dhd->prot->active_ipc_version);
12721 dhd->prot->max_tsbufpost, dhd->prot->cur_ts_bufs_posted);
12723 dhd->prot->max_infobufpost, dhd->prot->infobufpost);
12726 dhd->prot->max_btlogbufpost, dhd->prot->btlogbufpost);
12729 dhd->prot->max_eventbufpost, dhd->prot->cur_event_bufs_posted);
12731 dhd->prot->max_ioctlrespbufpost, dhd->prot->cur_ioctlresp_bufs_posted);
12733 dhd->prot->max_rxbufpost, dhd->prot->rxbufpost);
12736 dhd->prot->tot_rxbufpost, dhd->prot->tot_rxcpl);
12746 dhd_prot_print_flow_ring(dhd, &prot->h2dring_ctrl_subn, TRUE, strbuf,
12749 dhd_prot_print_flow_ring(dhd, &prot->d2hring_ctrl_cpln, FALSE, strbuf,
12752 dhd_prot_print_flow_ring(dhd, &prot->h2dring_rxp_subn, TRUE, strbuf,
12755 dhd_prot_print_flow_ring(dhd, &prot->d2hring_rx_cpln, FALSE, strbuf,
12758 dhd_prot_print_flow_ring(dhd, &prot->d2hring_tx_cpln, FALSE, strbuf,
12760 if (dhd->prot->h2dring_info_subn != NULL && dhd->prot->d2hring_info_cpln != NULL) {
12762 dhd_prot_print_flow_ring(dhd, prot->h2dring_info_subn, TRUE, strbuf,
12765 dhd_prot_print_flow_ring(dhd, prot->d2hring_info_cpln, FALSE, strbuf,
12768 if (dhd->prot->d2hring_edl != NULL) {
12770 dhd_prot_print_flow_ring(dhd, prot->d2hring_edl, FALSE, strbuf,
12775 OSL_ATOMIC_READ(dhd->osh, &dhd->prot->active_tx_count),
12776 DHD_PKTID_AVAIL(dhd->prot->pktid_ctrl_map),
12777 DHD_PKTID_AVAIL(dhd->prot->pktid_rx_map),
12778 DHD_PKTID_AVAIL(dhd->prot->pktid_tx_map));
12781 dhd_prot_ioctl_dump(dhd->prot, strbuf);
12797 dhd_prot_t *prot = dhd->prot; local
12800 msgbuf_ring_t *ring = &prot->h2dring_ctrl_subn;
12937 dhd_prot_t *prot = dhd->prot; local
12940 msgbuf_ring_t *ring = &prot->h2dring_ctrl_subn;
13011 dhd_prot_t *prot = dhd->prot; local
13014 msgbuf_ring_t *ctrl_ring = &prot->h2dring_ctrl_subn;
13057 soft_doorbell = &prot->soft_doorbell[ring_idx];
13628 dhd_prot_t *prot = dhd->prot; local
13647 prot->device_ipc_version,
13648 prot->host_ipc_version,
13649 prot->active_ipc_version));
13654 prot->max_tsbufpost, prot->cur_ts_bufs_posted));
13656 prot->max_infobufpost, prot->infobufpost));
13658 prot->max_eventbufpost, prot->cur_event_bufs_posted));
13660 prot->max_ioctlrespbufpost, prot->cur_ioctlresp_bufs_posted));
13662 prot->max_rxbufpost, prot->rxbufpost));
13664 h2d_max_txpost, prot->h2d_max_txpost));
13667 h2d_htput_max_txpost, prot->h2d_htput_max_txpost));
13675 GET_SEC_USEC(prot->ioctl_fillup_time),
13676 GET_SEC_USEC(prot->ioctl_ack_time),
13677 GET_SEC_USEC(prot->ioctl_cmplt_time)));
13687 ring = &prot->h2dring_ctrl_subn;
13711 ring = &prot->d2hring_ctrl_cpln;
13735 ring = prot->h2dring_info_subn;
13761 ring = prot->d2hring_info_cpln;
13788 ring = prot->d2hring_edl;
13817 ring = &prot->d2hring_tx_cpln;
13844 ring = &prot->d2hring_rx_cpln;
13871 ring = &prot->h2dring_rxp_subn;
13899 __FUNCTION__, prot->cur_ioctlresp_bufs_posted, prot->cur_event_bufs_posted));
13905 DHD_ERROR(("pktid_txq_start_cnt: %d\n", prot->pktid_txq_start_cnt));
13906 DHD_ERROR(("pktid_txq_stop_cnt: %d\n", prot->pktid_txq_stop_cnt));
13907 DHD_ERROR(("pktid_depleted_cnt: %d\n", prot->pktid_depleted_cnt));
13927 if (dhd->prot->d2h_dma_indx_wr_buf.va) {
13931 OSL_CACHE_INV((void *)dhd->prot->d2h_dma_indx_wr_buf.va,
13932 dhd->prot->d2h_dma_indx_wr_buf.len);
13934 ptr = (uint32 *)(dhd->prot->d2h_dma_indx_wr_buf.va);
13954 if (dhd->prot->h2d_dma_indx_rd_buf.va) {
13955 OSL_CACHE_INV((void *)dhd->prot->h2d_dma_indx_rd_buf.va,
13956 dhd->prot->h2d_dma_indx_rd_buf.len);
13958 ptr = (uint32 *)(dhd->prot->h2d_dma_indx_rd_buf.va);
13977 dhd_prot_t *prot = dhd->prot; local
13979 prot->metadata_dbg = val;
13981 return (uint32)prot->metadata_dbg;
13987 dhd_prot_t *prot = dhd->prot; local
13988 return (uint32)prot->metadata_dbg;
13995 dhd_prot_t *prot = dhd->prot; local
13997 prot->rx_metadata_offset = (uint16)val;
13999 prot->tx_metadata_offset = (uint16)val;
14007 dhd_prot_t *prot = dhd->prot; local
14009 return prot->rx_metadata_offset;
14011 return prot->tx_metadata_offset;
14018 dhd_prot_t *prot = dhd->prot; local
14020 prot->txp_threshold = (uint16)val;
14021 val = prot->txp_threshold;
14038 dhd_prot_t *prot = dhd->prot; local
14039 rxchain_info_t *rxchain = &prot->rxchain;
14093 dhd_prot_t *prot = dhd->prot; local
14094 rxchain_info_t *rxchain = &prot->rxchain;
14114 dhd_prot_t *prot = dhd->prot; local
14117 msgbuf_ring_t *ctrl_ring = &prot->h2dring_ctrl_subn;
14191 dhd_prot_t *prot = dhd->prot; local
14195 msgbuf_ring_t *ring = &prot->h2dring_ctrl_subn;
14251 struct dhd_prot *prot = dhd->prot; local
14252 uint32 cnt = prot->ioctl_trace_count % MAX_IOCTL_TRACE_SIZE;
14254 prot->ioctl_trace[cnt].cmd = ioct_rqst->cmd;
14255 prot->ioctl_trace[cnt].transid = ioct_rqst->trans_id;
14257 memcpy(prot->ioctl_trace[cnt].ioctl_buf, buf,
14260 memset(prot->ioctl_trace[cnt].ioctl_buf, 0, MAX_IOCTL_BUF_SIZE);
14261 prot->ioctl_trace[cnt].timestamp = OSL_SYSUPTIME_US();
14262 prot->ioctl_trace_count ++;
14266 dhd_prot_ioctl_dump(dhd_prot_t *prot, struct bcmstrbuf *strbuf) argument
14271 dumpsz = prot->ioctl_trace_count < MAX_IOCTL_TRACE_SIZE ?
14272 prot->ioctl_trace_count : MAX_IOCTL_TRACE_SIZE;
14281 prot->ioctl_trace[i].timestamp,
14282 prot->ioctl_trace[i].cmd,
14283 prot->ioctl_trace[i].transid,
14284 prot->ioctl_trace[i].ioctl_buf);
14752 dhd_prot_t *prot = dhdp->prot; local
14757 msgbuf_ring_t *ctrl_ring = &prot->h2dring_ctrl_subn;
14773 if (prot->hostts_req_buf_inuse == TRUE) {
14807 ts_req->host_buf_addr.high = htol32(PHYSADDRHI(prot->hostts_req_buf.pa));
14808 ts_req->host_buf_addr.low = htol32(PHYSADDRLO(prot->hostts_req_buf.pa));
14810 ts_tlv_buf = (void *) prot->hostts_req_buf.va;
14811 prot->hostts_req_buf_inuse = TRUE;
14814 OSL_CACHE_FLUSH((void *) prot->hostts_req_buf.va, tlv_len);
14840 dhd->prot->tx_ts_log_enabled = enable;
14842 return dhd->prot->tx_ts_log_enabled;
14849 dhd->prot->rx_ts_log_enabled = enable;
14851 return dhd->prot->rx_ts_log_enabled;
14858 dhd->prot->no_retry = enable;
14860 return dhd->prot->no_retry;
14867 dhd->prot->no_aggr = enable;
14869 return dhd->prot->no_aggr;
14876 dhd->prot->fixed_rate = enable;
14878 return dhd->prot->fixed_rate;
14885 dhd_prot_t *prot = dhd->prot; local
14887 dhd_dma_buf_free(dhd, &prot->h2d_dma_indx_wr_buf);
14888 dhd_dma_buf_free(dhd, &prot->d2h_dma_indx_rd_buf);
14894 if (dhd->prot->max_tsbufpost > 0)
14913 DHD_PKTID_AUDIT(dhd, dhd->prot->pktid_ctrl_map, pktid,
14920 if (!dhd->prot->cur_ts_bufs_posted) {
14925 dhd->prot->cur_ts_bufs_posted--;
14928 if (dhd->prot->max_tsbufpost > 0) {
14956 return dhdp->prot->ioctl_trans_id;
14964 dhd_prot_t *prot = dhdp->prot; local
14965 dhd_dma_buf_t *dma_buf = &prot->snapshot_upload_buf;
14969 msgbuf_ring_t *ctrl_ring = &prot->h2dring_ctrl_subn;
15012 prot->snapshot_upload_len = 0;
15013 prot->snapshot_type = snapshot_type;
15014 prot->snapshot_cmpl_pending = TRUE;
15038 dhd_prot_t *prot = dhdp->prot; local
15039 uint8 *buf = prot->snapshot_upload_buf.va;
15040 uint8 *buf_end = buf + prot->snapshot_upload_len;
15044 if (prot->snapshot_type != snapshot_type) {
15049 if (prot->snapshot_cmpl_pending) {
15064 *is_more = (offset + copy_size < prot->snapshot_upload_len) ?
15083 *va = dhd->prot->host_scb_buf.va;
15086 *len = dhd->prot->host_scb_buf.len;
15099 if (dhd->prot->host_scb_buf.va == NULL ||
15100 ((uint64)offset + length > (uint64)dhd->prot->host_scb_buf.len)) {
15104 memcpy(buff, (char*)dhd->prot->host_scb_buf.va + offset, length);
15334 dhd_prot_t *prot = bus->dhd->prot; local
15343 if (prot->h2dring_info_subn != NULL && prot->d2hring_info_cpln != NULL) {
15346 if (prot->d2hring_edl != NULL) {
15363 if (prot->h2dring_info_subn != NULL && prot->d2hring_info_cpln != NULL) {
15370 if (prot->d2hring_edl != NULL) {
15413 dhd_prot_t *prot = dhd->prot; local
15416 ring = &prot->h2dring_ctrl_subn;
15422 ring = &prot->d2hring_ctrl_cpln;
15428 ring = &prot->h2dring_rxp_subn;
15434 ring = &prot->d2hring_rx_cpln;
15440 ring = &prot->d2hring_tx_cpln;
15446 if (dhd->prot->h2dring_info_subn != NULL && dhd->prot->d2hring_info_cpln != NULL) {
15447 ring = prot->h2dring_info_subn;
15453 ring = prot->d2hring_info_cpln;
15459 if (prot->d2hring_edl != NULL) {
15460 ring = prot->d2hring_edl;