Lines Matching refs:prot
367 #define DHD_RING_IN_FLOWRINGS_POOL(prot, flowid) \ argument
368 (msgbuf_ring_t*)((prot)->h2d_flowrings_pool) + \
372 #define FOREACH_RING_IN_FLOWRINGS_POOL(prot, ring, flowid, total_flowrings) \ argument
374 (ring) = DHD_RING_IN_FLOWRINGS_POOL(prot, flowid); \
880 dhd->prot->d2h_sync_wait_max, dhd->prot->d2h_sync_wait_tot, in dhd_prot_d2h_sync_livelock()
935 dhd_prot_t *prot = dhd->prot; in dhd_prot_d2h_sync_seqnum() local
979 if (total_tries > prot->d2h_sync_wait_max) in dhd_prot_d2h_sync_seqnum()
980 prot->d2h_sync_wait_max = total_tries; in dhd_prot_d2h_sync_seqnum()
997 prot->d2h_sync_wait_tot += tries; in dhd_prot_d2h_sync_seqnum()
1014 dhd_prot_t *prot = dhd->prot; in dhd_prot_d2h_sync_xorcsum() local
1066 if (total_tries > prot->d2h_sync_wait_max) in dhd_prot_d2h_sync_xorcsum()
1067 prot->d2h_sync_wait_max = total_tries; in dhd_prot_d2h_sync_xorcsum()
1085 prot->d2h_sync_wait_tot += tries; in dhd_prot_d2h_sync_xorcsum()
1131 dhd_prot_t *prot = dhd->prot; in BCMFASTPATH() local
1208 if (total_tries > prot->d2h_sync_wait_max) in BCMFASTPATH()
1209 prot->d2h_sync_wait_max = total_tries; in BCMFASTPATH()
1251 prot->d2h_sync_wait_tot += tries; in BCMFASTPATH()
1285 dhd->prot->ioctl_received = reason; in dhd_wakeup_ioctl_event()
1298 dhd_prot_t *prot = dhd->prot; in dhd_prot_d2h_sync_init() local
1299 prot->d2h_sync_wait_max = 0UL; in dhd_prot_d2h_sync_init()
1300 prot->d2h_sync_wait_tot = 0UL; in dhd_prot_d2h_sync_init()
1302 prot->d2hring_ctrl_cpln.seqnum = D2H_EPOCH_INIT_VAL; in dhd_prot_d2h_sync_init()
1303 prot->d2hring_ctrl_cpln.current_phase = BCMPCIE_CMNHDR_PHASE_BIT_INIT; in dhd_prot_d2h_sync_init()
1305 prot->d2hring_tx_cpln.seqnum = D2H_EPOCH_INIT_VAL; in dhd_prot_d2h_sync_init()
1306 prot->d2hring_tx_cpln.current_phase = BCMPCIE_CMNHDR_PHASE_BIT_INIT; in dhd_prot_d2h_sync_init()
1308 prot->d2hring_rx_cpln.seqnum = D2H_EPOCH_INIT_VAL; in dhd_prot_d2h_sync_init()
1309 prot->d2hring_rx_cpln.current_phase = BCMPCIE_CMNHDR_PHASE_BIT_INIT; in dhd_prot_d2h_sync_init()
1312 prot->d2hring_tx_cpln.hwa_db_type = in dhd_prot_d2h_sync_init()
1314 prot->d2hring_rx_cpln.hwa_db_type = in dhd_prot_d2h_sync_init()
1317 __FUNCTION__, prot->d2hring_tx_cpln.hwa_db_type, in dhd_prot_d2h_sync_init()
1318 prot->d2hring_rx_cpln.hwa_db_type)); in dhd_prot_d2h_sync_init()
1322 prot->d2h_sync_cb = dhd_prot_d2h_sync_seqnum; in dhd_prot_d2h_sync_init()
1324 prot->d2h_edl_sync_cb = dhd_prot_d2h_sync_edl; in dhd_prot_d2h_sync_init()
1328 prot->d2h_sync_cb = dhd_prot_d2h_sync_xorcsum; in dhd_prot_d2h_sync_init()
1330 prot->d2h_edl_sync_cb = dhd_prot_d2h_sync_edl; in dhd_prot_d2h_sync_init()
1334 prot->d2h_sync_cb = dhd_prot_d2h_sync_none; in dhd_prot_d2h_sync_init()
1336 prot->d2h_edl_sync_cb = dhd_prot_d2h_sync_edl_none; in dhd_prot_d2h_sync_init()
1348 dhd_prot_t *prot = dhd->prot; in dhd_prot_h2d_sync_init() local
1349 prot->h2dring_rxp_subn.seqnum = H2D_EPOCH_INIT_VAL; in dhd_prot_h2d_sync_init()
1352 prot->h2dring_rxp_subn.hwa_db_type = in dhd_prot_h2d_sync_init()
1355 __FUNCTION__, prot->d2hring_tx_cpln.hwa_db_type)); in dhd_prot_h2d_sync_init()
1358 prot->h2dring_rxp_subn.current_phase = 0; in dhd_prot_h2d_sync_init()
1360 prot->h2dring_ctrl_subn.seqnum = H2D_EPOCH_INIT_VAL; in dhd_prot_h2d_sync_init()
1361 prot->h2dring_ctrl_subn.current_phase = 0; in dhd_prot_h2d_sync_init()
1609 dhd_prot_t *prot = dhd->prot; in dhd_pktid_logging_dump() local
1613 if (prot == NULL) { in dhd_pktid_logging_dump()
1618 map_log = (dhd_pktid_log_t *)(prot->pktid_dma_map); in dhd_pktid_logging_dump()
1619 unmap_log = (dhd_pktid_log_t *)(prot->pktid_dma_unmap); in dhd_pktid_logging_dump()
1890 dhd_prot_t *prot = dhd->prot; in dhd_get_pktid_map_type() local
1893 if (pktid_map == prot->pktid_ctrl_map) { in dhd_get_pktid_map_type()
1895 } else if (pktid_map == prot->pktid_tx_map) { in dhd_get_pktid_map_type()
1897 } else if (pktid_map == prot->pktid_rx_map) { in dhd_get_pktid_map_type()
2189 OSL_ATOMIC_DEC(dhd->osh, &dhd->prot->active_tx_count); in dhd_pktid_map_reset()
2196 DHD_PKTID_LOG(dhd, dhd->prot->pktid_dma_unmap, in dhd_pktid_map_reset()
2463 DHD_PKTID_LOG(dhd, dhd->prot->pktid_dma_map, pa, nkey, len, pkttype); in dhd_pktid_map_save()
2593 DHD_PKTID_LOG(dhd, dhd->prot->pktid_dma_unmap, locker->pa, nkey, in dhd_pktid_map_free()
2837 dhd_prot_t *prot; local
2845 if (!(prot = (dhd_prot_t *)DHD_OS_PREALLOC(dhd, DHD_PREALLOC_PROT,
2850 memset(prot, 0, sizeof(*prot));
2852 prot->osh = osh;
2853 dhd->prot = prot;
2868 if (dhd_prot_ring_attach(dhd, &prot->h2dring_ctrl_subn, "h2dctrl",
2877 if (dhd_prot_ring_attach(dhd, &prot->h2dring_rxp_subn, "h2drxp",
2886 if (dhd_prot_ring_attach(dhd, &prot->d2hring_ctrl_cpln, "d2hctrl",
2895 if (dhd_prot_ring_attach(dhd, &prot->d2hring_tx_cpln, "d2htxcpl",
2905 if (dhd_prot_ring_attach(dhd, &prot->d2hring_rx_cpln, "d2hrxcpl",
2920 if (dhd_dma_buf_alloc(dhd, &prot->retbuf, IOCT_RETBUF_SIZE)) {
2925 if (dhd_dma_buf_alloc(dhd, &prot->ioctbuf, IOCT_RETBUF_SIZE)) {
2930 if (dhd_dma_buf_alloc(dhd, &prot->hostts_req_buf, CTRLSUB_HOSTTS_MEESAGE_SIZE)) {
2933 prot->hostts_req_buf_inuse = FALSE;
2937 if (dhd_dma_buf_alloc(dhd, &prot->d2h_dma_scratch_buf,
2940 if (dhd_dma_buf_alloc(dhd, &prot->d2h_dma_scratch_buf, DMA_D2H_SCRATCH_BUF_LEN)) {
2948 if (dhd_dma_buf_alloc(dhd, &prot->host_bus_throughput_buf, DHD_BUS_TPUT_BUF_LEN)) {
2953 dhd_rxchain_reset(&prot->rxchain);
2956 prot->pktid_ctrl_map = DHD_NATIVE_TO_PKTID_INIT(dhd, MAX_CTRL_PKTID);
2957 if (prot->pktid_ctrl_map == NULL) {
2961 prot->pktid_rx_map = DHD_NATIVE_TO_PKTID_INIT(dhd, MAX_RX_PKTID);
2962 if (prot->pktid_rx_map == NULL)
2965 prot->pktid_tx_map = DHD_NATIVE_TO_PKTID_INIT(dhd, MAX_TX_PKTID);
2966 if (prot->pktid_tx_map == NULL)
2970 prot->pktid_map_handle_ioctl = DHD_NATIVE_TO_PKTID_INIT(dhd,
2972 if (prot->pktid_map_handle_ioctl == NULL) {
2978 prot->pktid_dma_map = DHD_PKTID_LOG_INIT(dhd, MAX_PKTID_LOG);
2979 if (prot->pktid_dma_map == NULL) {
2984 prot->pktid_dma_unmap = DHD_PKTID_LOG_INIT(dhd, MAX_PKTID_LOG);
2985 if (prot->pktid_dma_unmap == NULL) {
3000 bcm_workq_init(&prot->tx_compl_prod, &prot->tx_compl_cons,
3002 prot->tx_compl_prod_sync = 0;
3016 bcm_workq_init(&prot->rx_compl_prod, &prot->rx_compl_cons,
3018 prot->rx_compl_prod_sync = 0;
3025 if (dhd_dma_buf_alloc(dhd, &dhd->prot->fw_trap_buf, trap_buf_len)) {
3034 if (prot) {
3047 dhd_prot_t *prot = dhd->prot; local
3055 ret = dhd_dma_buf_alloc(dhd, &prot->host_scb_buf, host_scb_size);
3058 dhd_base_addr_htolpa(&base_addr, prot->host_scb_buf.pa);
3078 dhd_prot_t *prot = dhd->prot; local
3086 if (prot->host_ipc_version > prot->device_ipc_version)
3087 prot->active_ipc_version = prot->device_ipc_version;
3089 prot->active_ipc_version = prot->host_ipc_version;
3091 data |= prot->active_ipc_version;
3184 prot->active_ipc_version, prot->host_ipc_version,
3185 prot->device_ipc_version));
3188 dhd_bus_cmn_writeshared(dhd->bus, &prot->fw_trap_buf.pa,
3189 sizeof(prot->fw_trap_buf.pa), DNGL_TO_HOST_TRAP_ADDR, 0);
3205 dhd_prot_t *prot = dhd->prot; local
3221 prot->h2d_max_txpost = (uint16)h2d_max_txpost;
3223 DHD_ERROR(("%s:%d: h2d_max_txpost = %d\n", __FUNCTION__, __LINE__, prot->h2d_max_txpost));
3226 dhd_bus_cmn_readshared(dhd->bus, &prot->max_rxbufpost, MAX_HOST_RXBUFS, 0);
3227 if (prot->max_rxbufpost == 0) {
3230 prot->max_rxbufpost = DEFAULT_RX_BUFFERS_TO_POST;
3232 DHD_ERROR(("%s:%d: MAX_RXBUFPOST = %d\n", __FUNCTION__, __LINE__, prot->max_rxbufpost));
3235 prot->max_eventbufpost = DHD_FLOWRING_MAX_EVENTBUF_POST;
3236 prot->max_ioctlrespbufpost = DHD_FLOWRING_MAX_IOCTLRESPBUF_POST;
3237 prot->max_infobufpost = DHD_H2D_INFORING_MAX_BUF_POST;
3238 prot->max_tsbufpost = DHD_MAX_TSBUF_POST;
3240 prot->cur_ioctlresp_bufs_posted = 0;
3241 OSL_ATOMIC_INIT(dhd->osh, &prot->active_tx_count);
3242 prot->data_seq_no = 0;
3243 prot->ioctl_seq_no = 0;
3244 prot->rxbufpost = 0;
3245 prot->cur_event_bufs_posted = 0;
3246 prot->ioctl_state = 0;
3247 prot->curr_ioctl_cmd = 0;
3248 prot->cur_ts_bufs_posted = 0;
3249 prot->infobufpost = 0;
3251 prot->dmaxfer.srcmem.va = NULL;
3252 prot->dmaxfer.dstmem.va = NULL;
3253 prot->dmaxfer.in_progress = FALSE;
3255 prot->metadata_dbg = FALSE;
3256 prot->rx_metadata_offset = 0;
3257 prot->tx_metadata_offset = 0;
3258 prot->txp_threshold = TXP_FLUSH_MAX_ITEMS_FLUSH_CNT;
3261 prot->ioctl_trans_id = MAXBITVAL(NBITS(prot->ioctl_trans_id)) - BUFFER_BEFORE_ROLLOVER;
3262 prot->ioctl_state = 0;
3263 prot->ioctl_status = 0;
3264 prot->ioctl_resplen = 0;
3265 prot->ioctl_received = IOCTL_WAIT;
3269 prot->device_ipc_version = dhd->bus->api.fw_rev;
3270 prot->host_ipc_version = PCIE_SHARED_VERSION;
3271 prot->no_tx_resource = FALSE;
3284 prot->mb_ring_fn = dhd_bus_get_mbintr_fn(dhd->bus);
3285 prot->mb_2_ring_fn = dhd_bus_get_mbintr_2_fn(dhd->bus);
3289 dhd_prot_ring_init(dhd, &prot->h2dring_ctrl_subn);
3290 dhd_prot_ring_init(dhd, &prot->h2dring_rxp_subn);
3291 dhd_prot_ring_init(dhd, &prot->d2hring_ctrl_cpln);
3294 if (prot->active_ipc_version < PCIE_SHARED_VERSION_7) {
3295 prot->d2hring_tx_cpln.item_len =
3297 prot->d2hring_rx_cpln.item_len =
3300 dhd_prot_ring_init(dhd, &prot->d2hring_tx_cpln);
3301 dhd_prot_ring_init(dhd, &prot->d2hring_rx_cpln);
3308 dhd_base_addr_htolpa(&base_addr, prot->d2h_dma_scratch_buf.pa);
3311 dhd_bus_cmn_writeshared(dhd->bus, &prot->d2h_dma_scratch_buf.len,
3312 sizeof(prot->d2h_dma_scratch_buf.len), D2H_DMA_SCRATCH_BUF_LEN, 0);
3318 dhd_base_addr_htolpa(&base_addr, prot->d2h_dma_indx_wr_buf.pa);
3321 dhd_base_addr_htolpa(&base_addr, prot->h2d_dma_indx_rd_buf.pa);
3327 dhd_base_addr_htolpa(&base_addr, prot->h2d_dma_indx_wr_buf.pa);
3330 dhd_base_addr_htolpa(&base_addr, prot->d2h_dma_indx_rd_buf.pa);
3352 dhd_base_addr_htolpa(&base_addr, prot->h2d_ifrm_indx_wr_buf.pa);
3402 prot->no_retry = FALSE;
3403 prot->no_aggr = FALSE;
3404 prot->fixed_rate = FALSE;
3468 dhd_prot_t *prot = dhd->prot; local
3471 if (prot) {
3475 dhd_dma_buf_free(dhd, &prot->d2h_dma_scratch_buf);
3476 dhd_dma_buf_free(dhd, &prot->retbuf);
3477 dhd_dma_buf_free(dhd, &prot->ioctbuf);
3478 dhd_dma_buf_free(dhd, &prot->host_bus_throughput_buf);
3479 dhd_dma_buf_free(dhd, &prot->hostts_req_buf);
3480 dhd_dma_buf_free(dhd, &prot->fw_trap_buf);
3481 dhd_dma_buf_free(dhd, &prot->host_scb_buf);
3484 dhd_dma_buf_free(dhd, &prot->h2d_dma_indx_wr_buf);
3485 dhd_dma_buf_free(dhd, &prot->h2d_dma_indx_rd_buf);
3486 dhd_dma_buf_free(dhd, &prot->d2h_dma_indx_wr_buf);
3487 dhd_dma_buf_free(dhd, &prot->d2h_dma_indx_rd_buf);
3489 dhd_dma_buf_free(dhd, &prot->h2d_ifrm_indx_wr_buf);
3492 dhd_prot_ring_detach(dhd, &prot->h2dring_ctrl_subn);
3493 dhd_prot_ring_detach(dhd, &prot->h2dring_rxp_subn);
3494 dhd_prot_ring_detach(dhd, &prot->d2hring_ctrl_cpln);
3495 dhd_prot_ring_detach(dhd, &prot->d2hring_tx_cpln);
3496 dhd_prot_ring_detach(dhd, &prot->d2hring_rx_cpln);
3521 DHD_NATIVE_TO_PKTID_FINI(dhd, prot->pktid_ctrl_map);
3522 DHD_NATIVE_TO_PKTID_FINI(dhd, prot->pktid_rx_map);
3523 DHD_NATIVE_TO_PKTID_FINI(dhd, prot->pktid_tx_map);
3525 DHD_NATIVE_TO_PKTID_FINI_IOCTL(dhd, prot->pktid_map_handle_ioctl);
3528 DHD_PKTID_LOG_FINI(dhd, prot->pktid_dma_map);
3529 DHD_PKTID_LOG_FINI(dhd, prot->pktid_dma_unmap);
3533 if (prot->tx_compl_prod.buffer)
3534 MFREE(dhd->osh, prot->tx_compl_prod.buffer,
3538 if (prot->rx_compl_prod.buffer)
3539 MFREE(dhd->osh, prot->rx_compl_prod.buffer,
3543 DHD_OS_PREFREE(dhd, dhd->prot, sizeof(dhd_prot_t));
3545 dhd->prot = NULL;
3560 struct dhd_prot *prot = dhd->prot; local
3564 if (prot == NULL) {
3571 dhd_prot_ring_reset(dhd, &prot->h2dring_ctrl_subn);
3572 dhd_prot_ring_reset(dhd, &prot->h2dring_rxp_subn);
3573 dhd_prot_ring_reset(dhd, &prot->d2hring_ctrl_cpln);
3574 dhd_prot_ring_reset(dhd, &prot->d2hring_tx_cpln);
3575 dhd_prot_ring_reset(dhd, &prot->d2hring_rx_cpln);
3578 if (prot->h2dring_info_subn) {
3579 dhd_prot_ring_reset(dhd, prot->h2dring_info_subn);
3582 if (prot->d2hring_info_cpln) {
3583 dhd_prot_ring_reset(dhd, prot->d2hring_info_cpln);
3586 if (prot->d2hring_edl) {
3587 dhd_prot_ring_reset(dhd, prot->d2hring_edl);
3592 dhd_dma_buf_reset(dhd, &prot->d2h_dma_scratch_buf);
3593 dhd_dma_buf_reset(dhd, &prot->retbuf);
3594 dhd_dma_buf_reset(dhd, &prot->ioctbuf);
3595 dhd_dma_buf_reset(dhd, &prot->host_bus_throughput_buf);
3596 dhd_dma_buf_reset(dhd, &prot->hostts_req_buf);
3597 dhd_dma_buf_reset(dhd, &prot->fw_trap_buf);
3598 dhd_dma_buf_reset(dhd, &prot->host_scb_buf);
3600 dhd_dma_buf_reset(dhd, &prot->h2d_ifrm_indx_wr_buf);
3603 dhd_dma_buf_reset(dhd, &prot->h2d_dma_indx_rd_buf);
3604 dhd_dma_buf_reset(dhd, &prot->h2d_dma_indx_wr_buf);
3605 dhd_dma_buf_reset(dhd, &prot->d2h_dma_indx_rd_buf);
3606 dhd_dma_buf_reset(dhd, &prot->d2h_dma_indx_wr_buf);
3608 prot->rx_metadata_offset = 0;
3609 prot->tx_metadata_offset = 0;
3611 prot->rxbufpost = 0;
3612 prot->cur_event_bufs_posted = 0;
3613 prot->cur_ioctlresp_bufs_posted = 0;
3615 OSL_ATOMIC_INIT(dhd->osh, &prot->active_tx_count);
3616 prot->data_seq_no = 0;
3617 prot->ioctl_seq_no = 0;
3618 prot->ioctl_state = 0;
3619 prot->curr_ioctl_cmd = 0;
3620 prot->ioctl_received = IOCTL_WAIT;
3622 prot->ioctl_trans_id = MAXBITVAL(NBITS(prot->ioctl_trans_id)) - BUFFER_BEFORE_ROLLOVER;
3632 if (prot->d2hring_hp2p_txcpl) {
3633 dhd_prot_ring_reset(dhd, prot->d2hring_hp2p_txcpl);
3635 if (prot->d2hring_hp2p_rxcpl) {
3636 dhd_prot_ring_reset(dhd, prot->d2hring_hp2p_rxcpl);
3641 DHD_NATIVE_TO_PKTID_RESET(dhd, prot->pktid_ctrl_map);
3642 DHD_NATIVE_TO_PKTID_RESET(dhd, prot->pktid_rx_map);
3643 DHD_NATIVE_TO_PKTID_RESET(dhd, prot->pktid_tx_map);
3645 DHD_NATIVE_TO_PKTID_RESET_IOCTL(dhd, prot->pktid_map_handle_ioctl);
3705 bcm_workq_prod_sync(&dhdp->prot->tx_compl_prod); /* flush WR index */
3722 dhd_prot_t *prot = dhd->prot; local
3723 bcm_workq_t *workq = &prot->tx_compl_cons;
3777 dhd_prot_t *prot = dhdp->prot; local
3779 if (prot->rxbufpost <= (prot->max_rxbufpost - RXBUFPOST_THRESHOLD)) {
3781 bcm_workq_prod_sync(&dhdp->prot->rx_compl_prod);
3790 bcm_workq_t *workq = &dhd->prot->rx_compl_cons;
3803 dhd_prot_t *prot = dhd->prot; local
3804 prot->rx_dataoffset = rx_offset;
3810 dhd_prot_t *prot = dhd->prot; local
3823 if (prot->d2hring_info_cpln) {
3825 prot->d2hring_info_cpln->inited = FALSE;
3828 if (prot->h2dring_info_subn && prot->d2hring_info_cpln) {
3832 if (prot->h2dring_info_subn == NULL) {
3833 prot->h2dring_info_subn = MALLOCZ(prot->osh, sizeof(msgbuf_ring_t));
3835 if (prot->h2dring_info_subn == NULL) {
3842 ret = dhd_prot_ring_attach(dhd, prot->h2dring_info_subn, "h2dinfo",
3852 if (prot->d2hring_info_cpln == NULL) {
3853 prot->d2hring_info_cpln = MALLOCZ(prot->osh, sizeof(msgbuf_ring_t));
3855 if (prot->d2hring_info_cpln == NULL) {
3867 ret = dhd_prot_ring_attach(dhd, prot->d2hring_info_cpln, "d2hinfo",
3873 dhd_prot_ring_detach(dhd, prot->h2dring_info_subn);
3880 MFREE(prot->osh, prot->h2dring_info_subn, sizeof(msgbuf_ring_t));
3881 prot->h2dring_info_subn = NULL;
3883 if (prot->d2hring_info_cpln) {
3884 MFREE(prot->osh, prot->d2hring_info_cpln, sizeof(msgbuf_ring_t));
3885 prot->d2hring_info_cpln = NULL;
3893 dhd_prot_t *prot = dhd->prot; local
3902 if ((prot->d2hring_info_cpln->inited) || (prot->d2hring_info_cpln->create_pending)) {
3907 DHD_TRACE(("trying to send create d2h info ring: id %d\n", prot->d2hring_info_cpln->idx));
3908 ret = dhd_send_d2h_ringcreate(dhd, prot->d2hring_info_cpln,
3913 prot->h2dring_info_subn->seqnum = H2D_EPOCH_INIT_VAL;
3914 prot->h2dring_info_subn->current_phase = 0;
3915 prot->d2hring_info_cpln->seqnum = D2H_EPOCH_INIT_VAL;
3916 prot->d2hring_info_cpln->current_phase = BCMPCIE_CMNHDR_PHASE_BIT_INIT;
3918 DHD_TRACE(("trying to send create h2d info ring id %d\n", prot->h2dring_info_subn->idx));
3919 prot->h2dring_info_subn->n_completion_ids = 1;
3920 prot->h2dring_info_subn->compeltion_ring_ids[0] = prot->d2hring_info_cpln->idx;
3922 ret = dhd_send_h2d_ringcreate(dhd, prot->h2dring_info_subn,
3934 if (dhd->prot->h2dring_info_subn) {
3935 dhd_prot_ring_detach(dhd, dhd->prot->h2dring_info_subn);
3936 MFREE(dhd->prot->osh, dhd->prot->h2dring_info_subn, sizeof(msgbuf_ring_t));
3937 dhd->prot->h2dring_info_subn = NULL;
3939 if (dhd->prot->d2hring_info_cpln) {
3940 dhd_prot_ring_detach(dhd, dhd->prot->d2hring_info_cpln);
3941 MFREE(dhd->prot->osh, dhd->prot->d2hring_info_cpln, sizeof(msgbuf_ring_t));
3942 dhd->prot->d2hring_info_cpln = NULL;
3950 dhd_prot_t *prot = dhd->prot; local
3957 if (prot->d2hring_hp2p_txcpl == NULL) {
3958 prot->d2hring_hp2p_txcpl = MALLOCZ(prot->osh, sizeof(msgbuf_ring_t));
3960 if (prot->d2hring_hp2p_txcpl == NULL) {
3967 ret = dhd_prot_ring_attach(dhd, prot->d2hring_hp2p_txcpl, "d2hhp2p_txcpl",
3977 prot->d2hring_hp2p_txcpl->inited = FALSE;
3979 if (prot->d2hring_hp2p_rxcpl == NULL) {
3980 prot->d2hring_hp2p_rxcpl = MALLOCZ(prot->osh, sizeof(msgbuf_ring_t));
3982 if (prot->d2hring_hp2p_rxcpl == NULL) {
3994 ret = dhd_prot_ring_attach(dhd, prot->d2hring_hp2p_rxcpl, "d2hhp2p_rxcpl",
4004 prot->d2hring_hp2p_rxcpl->inited = FALSE;
4009 MFREE(prot->osh, prot->d2hring_hp2p_rxcpl, sizeof(msgbuf_ring_t));
4010 prot->d2hring_hp2p_rxcpl = NULL;
4013 MFREE(prot->osh, prot->d2hring_hp2p_txcpl, sizeof(msgbuf_ring_t));
4014 prot->d2hring_hp2p_txcpl = NULL;
4021 dhd_prot_t *prot = dhd->prot; local
4032 if ((prot->d2hring_hp2p_txcpl->inited) || (prot->d2hring_hp2p_txcpl->create_pending)) {
4038 prot->d2hring_hp2p_txcpl->idx));
4039 ret = dhd_send_d2h_ringcreate(dhd, prot->d2hring_hp2p_txcpl,
4044 prot->d2hring_hp2p_txcpl->seqnum = D2H_EPOCH_INIT_VAL;
4045 prot->d2hring_hp2p_txcpl->current_phase = BCMPCIE_CMNHDR_PHASE_BIT_INIT;
4047 if ((prot->d2hring_hp2p_rxcpl->inited) || (prot->d2hring_hp2p_rxcpl->create_pending)) {
4053 prot->d2hring_hp2p_rxcpl->idx));
4054 ret = dhd_send_d2h_ringcreate(dhd, prot->d2hring_hp2p_rxcpl,
4059 prot->d2hring_hp2p_rxcpl->seqnum = D2H_EPOCH_INIT_VAL;
4060 prot->d2hring_hp2p_rxcpl->current_phase = BCMPCIE_CMNHDR_PHASE_BIT_INIT;
4071 if (dhd->prot->d2hring_hp2p_txcpl) {
4072 dhd_prot_ring_detach(dhd, dhd->prot->d2hring_hp2p_txcpl);
4073 MFREE(dhd->prot->osh, dhd->prot->d2hring_hp2p_txcpl, sizeof(msgbuf_ring_t));
4074 dhd->prot->d2hring_hp2p_txcpl = NULL;
4076 if (dhd->prot->d2hring_hp2p_rxcpl) {
4077 dhd_prot_ring_detach(dhd, dhd->prot->d2hring_hp2p_rxcpl);
4078 MFREE(dhd->prot->osh, dhd->prot->d2hring_hp2p_rxcpl, sizeof(msgbuf_ring_t));
4079 dhd->prot->d2hring_hp2p_rxcpl = NULL;
4088 dhd_prot_t *prot = dhd->prot; local
4101 if (prot->d2hring_edl) {
4102 prot->d2hring_edl->inited = FALSE;
4106 if (prot->d2hring_edl == NULL) {
4107 prot->d2hring_edl = MALLOCZ(prot->osh, sizeof(msgbuf_ring_t));
4109 if (prot->d2hring_edl == NULL) {
4117 ret = dhd_prot_ring_attach(dhd, prot->d2hring_edl, "d2hring_edl",
4129 MFREE(prot->osh, prot->d2hring_edl, sizeof(msgbuf_ring_t));
4130 prot->d2hring_edl = NULL;
4138 dhd_prot_t *prot = dhd->prot; local
4147 if ((prot->d2hring_edl->inited) || (prot->d2hring_edl->create_pending)) {
4152 DHD_ERROR(("trying to send create d2h edl ring: idx %d\n", prot->d2hring_edl->idx));
4153 ret = dhd_send_d2h_ringcreate(dhd, prot->d2hring_edl,
4158 prot->d2hring_edl->seqnum = D2H_EPOCH_INIT_VAL;
4159 prot->d2hring_edl->current_phase = BCMPCIE_CMNHDR_PHASE_BIT_INIT;
4167 if (dhd->prot->d2hring_edl) {
4168 dhd_prot_ring_detach(dhd, dhd->prot->d2hring_edl);
4169 MFREE(dhd->prot->osh, dhd->prot->d2hring_edl, sizeof(msgbuf_ring_t));
4170 dhd->prot->d2hring_edl = NULL;
4184 dhd_prot_t *prot = dhd->prot; local
4233 prot->rxbufpost_sz = DHD_FLOWRING_RX_BUFPOST_PKTSZ;
4235 memcpy_s(&(prot->rxbufpost_sz), sizeof(prot->rxbufpost_sz), buf, sizeof(uint16));
4236 if (prot->rxbufpost_sz > DHD_FLOWRING_RX_BUFPOST_PKTSZ_MAX) {
4238 __FUNCTION__, prot->rxbufpost_sz, DHD_FLOWRING_RX_BUFPOST_PKTSZ));
4239 prot->rxbufpost_sz = DHD_FLOWRING_RX_BUFPOST_PKTSZ;
4241 DHD_ERROR(("%s: RxBuf Post : %d\n", __FUNCTION__, prot->rxbufpost_sz));
4407 PKTBUF = DHD_PKTID_TO_NATIVE(dhd, dhd->prot->pktid_ctrl_map,
4410 PKTBUF = DHD_PKTID_TO_NATIVE_RSV(dhd, dhd->prot->pktid_ctrl_map,
4414 PKTBUF = DHD_PKTID_TO_NATIVE(dhd, dhd->prot->pktid_ctrl_map, pktid, pa,
4457 retbuf->va = DHD_PKTID_TO_NATIVE(dhd, dhd->prot->pktid_map_handle_ioctl, pktid,
4467 dhd_prot_t *prot = dhd->prot; local
4472 fillbufs = prot->max_rxbufpost - prot->rxbufpost;
4478 DHD_ERROR(("Current posted host buf count %d \n", prot->rxbufpost));
4489 prot->rxbufpost += (uint16)retcount;
4495 fillbufs = prot->max_rxbufpost - prot->rxbufpost;
4516 dhd_prot_t *prot = dhd->prot; local
4517 msgbuf_ring_t *ring = &prot->h2dring_rxp_subn;
4520 uint16 pktsz = prot->rxbufpost_sz;
4562 PKTPULL(dhd->osh, p, prot->rx_metadata_offset);
4594 bcm_workq_t *workq = &prot->rx_compl_cons;
4610 DHD_NATIVE_TO_PKTID_SAVE(dhd, dhd->prot->pktid_rx_map,
4620 pktid = DHD_NATIVE_TO_PKTID(dhd, dhd->prot->pktid_rx_map, p, pa,
4638 htol32(PHYSADDRLO(pa) + prot->rx_metadata_offset);
4640 if (prot->rx_metadata_offset) {
4641 rxbuf_post->metadata_buf_len = prot->rx_metadata_offset;
4651 DHD_PKTID_AUDIT(dhd, prot->pktid_rx_map, pktid, DHD_DUPLICATE_ALLOC);
4709 dhd_prot_t *prot = dhd->prot; local
4726 if (ring == dhd->prot->h2dring_info_subn) {
4727 if (prot->max_infobufpost == 0)
4730 count = prot->max_infobufpost - prot->infobufpost;
4812 pktid = DHD_NATIVE_TO_PKTID(dhd, dhd->prot->pktid_ctrl_map, p, pa,
4838 DHD_PKTID_AUDIT(dhd, prot->pktid_ctrl_map, pktid, DHD_DUPLICATE_ALLOC);
4869 if (ring == dhd->prot->h2dring_info_subn) {
4870 prot->infobufpost += alloced;
4920 dhd_prot_t *prot = dhd->prot; local
4927 msgbuf_ring_t *ring = &prot->h2dring_ctrl_subn;
5058 map_handle = dhd->prot->pktid_map_handle_ioctl;
5064 map_handle = dhd->prot->pktid_ctrl_map;
5181 dhd_prot_t *prot = dhd->prot; local
5185 max_to_post = prot->max_ioctlrespbufpost - prot->cur_ioctlresp_bufs_posted;
5191 prot->cur_ioctlresp_bufs_posted += dhd_msgbuf_rxbuf_post_ctrlpath(dhd,
5198 dhd_prot_t *prot = dhd->prot; local
5201 max_to_post = prot->max_eventbufpost - prot->cur_event_bufs_posted;
5207 prot->cur_event_bufs_posted += dhd_msgbuf_rxbuf_post_ctrlpath(dhd,
5220 dhd_prot_t *prot = dhd->prot; local
5223 msgbuf_ring_t *ring = prot->d2hring_info_cpln;
5285 dhd_prot_t *prot = dhd->prot; local
5286 msgbuf_ring_t *ring = prot->d2hring_edl;
5377 dhd_prot_t *prot = NULL; local
5388 if (!dhd || !dhd->prot)
5391 prot = dhd->prot;
5392 ring = prot->d2hring_edl;
5439 if ((err = prot->d2h_edl_sync_cb(dhd, ring, msg)) != BCME_OK) {
5537 dhd_prot_t *prot = NULL; local
5544 prot = dhd->prot;
5545 if (!prot || !prot->d2hring_edl)
5548 ring = prot->d2hring_edl;
5561 dhd_prot_t *prot = dhd->prot; local
5582 if (ringtype == DHD_HP2P_RING && prot->d2hring_hp2p_rxcpl)
5583 ring = prot->d2hring_hp2p_rxcpl;
5586 ring = &prot->d2hring_rx_cpln;
5619 sync = prot->d2h_sync_cb(dhd, ring, &msg->cmn_hdr, item_len);
5641 DHD_PKTID_AUDIT_RING_DEBUG(dhd, dhd->prot->pktid_rx_map, pktid,
5645 pkt = DHD_PKTID_TO_NATIVE(dhd, prot->pktid_rx_map, pktid, pa,
5676 if (prot->metadata_dbg && prot->rx_metadata_offset &&
5679 ptr = PKTDATA(dhd->osh, pkt) - (prot->rx_metadata_offset);
5691 else if (prot->rx_dataoffset) {
5693 PKTPULL(dhd->osh, pkt, prot->rx_dataoffset);
5731 if (dhd->hp2p_capable && ring == prot->d2hring_hp2p_rxcpl) {
5845 if (ringtype == DHD_HP2P_RING && dhd->prot->d2hring_hp2p_txcpl)
5846 ring = dhd->prot->d2hring_hp2p_txcpl;
5849 ring = &dhd->prot->d2hring_tx_cpln;
5908 dhd_dma_buf_t *trap_addr = &dhd->prot->fw_trap_buf;
5943 dhd_prot_t *prot = dhd->prot; local
5944 msgbuf_ring_t *ring = &prot->d2hring_ctrl_cpln;
6023 msg_type = dhd->prot->d2h_sync_cb(dhd, ring, msg, item_len);
6057 if (ring == dhd->prot->d2hring_info_cpln) {
6058 if (!dhd->prot->infobufpost) {
6063 dhd->prot->infobufpost--;
6064 dhd_prot_infobufpost(dhd, dhd->prot->h2dring_info_subn);
6117 if (dhd->prot->h2dring_info_subn != NULL) {
6118 if (dhd->prot->h2dring_info_subn->create_pending == TRUE) {
6120 dhd->prot->h2dring_info_subn->create_pending = FALSE;
6129 if (dhd->prot->d2hring_info_cpln != NULL) {
6130 if (dhd->prot->d2hring_info_cpln->create_pending == TRUE) {
6132 dhd->prot->d2hring_info_cpln->create_pending = FALSE;
6142 if (dhd->prot->d2hring_hp2p_txcpl != NULL) {
6143 if (dhd->prot->d2hring_hp2p_txcpl->create_pending == TRUE) {
6145 dhd->prot->d2hring_hp2p_txcpl->create_pending = FALSE;
6154 if (dhd->prot->d2hring_hp2p_rxcpl != NULL) {
6155 if (dhd->prot->d2hring_hp2p_rxcpl->create_pending == TRUE) {
6157 dhd->prot->d2hring_hp2p_rxcpl->create_pending = FALSE;
6203 DHD_PKTID_AUDIT_RING_DEBUG(dhd, dhd->prot->pktid_ctrl_map, pktid,
6206 DHD_PKTID_AUDIT_RING_DEBUG(dhd, dhd->prot->pktid_map_handle_ioctl, pktid,
6212 dhd->prot->ioctl_ack_time = OSL_LOCALTIME_NS();
6215 if ((dhd->prot->ioctl_state & MSGBUF_IOCTL_ACK_PENDING) &&
6216 (dhd->prot->ioctl_state & MSGBUF_IOCTL_RESP_PENDING)) {
6217 dhd->prot->ioctl_state &= ~MSGBUF_IOCTL_ACK_PENDING;
6220 __FUNCTION__, dhd->prot->ioctl_state, dhd->prot->ioctl_trans_id));
6238 dhd_prot_t *prot = dhd->prot; local
6260 DHD_PKTID_AUDIT_RING_DEBUG(dhd, prot->pktid_ctrl_map, pkt_id,
6263 DHD_PKTID_AUDIT_RING_DEBUG(dhd, prot->pktid_map_handle_ioctl, pkt_id,
6269 if ((prot->ioctl_state & MSGBUF_IOCTL_ACK_PENDING) ||
6270 !(prot->ioctl_state & MSGBUF_IOCTL_RESP_PENDING)) {
6272 __FUNCTION__, dhd->prot->ioctl_state, dhd->prot->ioctl_trans_id));
6279 dhd->prot->ioctl_cmplt_time = OSL_LOCALTIME_NS();
6282 prot->ioctl_state &= ~MSGBUF_IOCTL_RESP_PENDING;
6298 prot->ioctl_resplen = ltoh16(ioct_resp->resp_len);
6299 prot->ioctl_status = ltoh16(ioct_resp->compl_hdr.status);
6302 if (xt_id != prot->ioctl_trans_id || prot->curr_ioctl_cmd != ioct_resp->cmd) {
6304 __FUNCTION__, xt_id, prot->ioctl_trans_id,
6305 prot->curr_ioctl_cmd, ioct_resp->cmd));
6321 pkt_id, xt_id, prot->ioctl_status, prot->ioctl_resplen));
6323 if (prot->ioctl_resplen > 0) {
6325 bcopy(PKTDATA(dhd->osh, pkt), prot->retbuf.va, prot->ioctl_resplen);
6327 bcopy(pkt, prot->retbuf.va, prot->ioctl_resplen);
6343 if (prot->cur_ioctlresp_bufs_posted > 0) {
6344 prot->cur_ioctlresp_bufs_posted--;
6353 return dhd->prot->no_tx_resource;
6359 dhd->prot->pktid_txq_stop_cnt++;
6365 dhd->prot->pktid_txq_start_cnt++;
6372 dhd_prot_t *prot = dhd->prot; local
6382 msgbuf_ring_t *ring = &dhd->prot->d2hring_tx_cpln;
6406 DHD_PKTID_AUDIT_RING_DEBUG(dhd, dhd->prot->pktid_tx_map, pktid,
6411 if (OSL_ATOMIC_DEC_RETURN(dhd->osh, &prot->active_tx_count) < 0) {
6416 pkt = DHD_PKTID_TO_NATIVE(dhd, dhd->prot->pktid_tx_map, pktid,
6434 if (DHD_PKTID_AVAIL(dhd->prot->pktid_tx_map) == DHD_PKTID_MIN_AVAIL_COUNT) {
6435 dhd->prot->no_tx_resource = FALSE;
6443 if (dhd->prot->tx_metadata_offset)
6444 offset = dhd->prot->tx_metadata_offset + ETHER_HDR_LEN;
6446 (uint) dhd->prot->tx_metadata_offset, DMA_RX, 0, dmah,
6465 workq = &prot->tx_compl_prod;
6483 elem = WORKQ_ELEMENT(void *, &prot->tx_compl_prod, elem_ix);
6489 if (++prot->tx_compl_prod_sync >= DHD_LB_WORKQ_SYNC) {
6491 prot->tx_compl_prod_sync = 0;
6495 __FUNCTION__, pkt, prot->tx_compl_prod_sync));
6531 if (dhd->prot->metadata_dbg &&
6532 dhd->prot->tx_metadata_offset && txstatus->metadata_len) {
6538 ptr = PKTDATA(dhd->osh, pkt) - (dhd->prot->tx_metadata_offset);
6573 dhd_prot_t *prot = dhd->prot; local
6580 DHD_PKTID_AUDIT_RING_DEBUG(dhd, dhd->prot->pktid_ctrl_map, bufid,
6589 if (prot->cur_event_bufs_posted)
6590 prot->cur_event_bufs_posted--;
6601 if (dhd->prot->rx_dataoffset)
6602 PKTPULL(dhd->osh, pkt, dhd->prot->rx_dataoffset);
6625 DHD_PKTID_AUDIT_RING_DEBUG(dhd, dhd->prot->pktid_ctrl_map, pktid,
6631 dhd->prot->rx_dataoffset));
6644 if (dhd->prot->rx_dataoffset)
6645 PKTPULL(dhd->osh, pkt, dhd->prot->rx_dataoffset);
6701 dhd_prot_t *prot = dhd->prot; local
6723 if (!DHD_PKTID_AVAIL(dhd->prot->pktid_tx_map)) {
6724 if (dhd->prot->pktid_depleted_cnt == DHD_PKTID_DEPLETED_MAX_COUNT) {
6726 dhd->prot->no_tx_resource = TRUE;
6728 dhd->prot->pktid_depleted_cnt++;
6731 dhd->prot->pktid_depleted_cnt = 0;
6744 pktid = DHD_NATIVE_TO_PKTID_RSV(dhd, dhd->prot->pktid_tx_map,
6764 __FUNCTION__, __LINE__, OSL_ATOMIC_READ(dhd->osh, &prot->active_tx_count)));
6792 if (prot->tx_metadata_offset)
6793 offset = prot->tx_metadata_offset + ETHER_HDR_LEN;
6815 DHD_NATIVE_TO_PKTID_SAVE(dhd, dhd->prot->pktid_tx_map, PKTBUF, pktid,
6846 if (prot->tx_metadata_offset && (headroom < prot->tx_metadata_offset))
6848 prot->tx_metadata_offset, headroom));
6850 if (prot->tx_metadata_offset && (headroom >= prot->tx_metadata_offset)) {
6851 DHD_TRACE(("Metadata in tx %d\n", prot->tx_metadata_offset));
6854 PKTPUSH(dhd->osh, PKTBUF, prot->tx_metadata_offset);
6858 prot->tx_metadata_offset + ETHER_HDR_LEN, DMA_RX, PKTBUF,
6864 prot->tx_metadata_offset, DMA_RX, PKTBUF, 0);
6873 if (prot->tx_metadata_offset) {
6874 offset = prot->tx_metadata_offset + ETHER_HDR_LEN;
6897 PKTPULL(dhd->osh, PKTBUF, prot->tx_metadata_offset);
6899 txdesc->metadata_buf_len = prot->tx_metadata_offset;
6917 DHD_PKTID_AUDIT(dhd, prot->pktid_tx_map, pktid, DHD_DUPLICATE_ALLOC);
6941 if ((ring->pend_items_count == prot->txp_threshold) ||
6949 if ((ring->pend_items_count == prot->txp_threshold) ||
6963 OSL_ATOMIC_INC(dhd->osh, &prot->active_tx_count);
6996 DHD_PKTID_TO_NATIVE(dhd, dhd->prot->pktid_tx_map, pktid,
7048 dhd_prot_t *prot = dhd->prot; local
7054 workq = &prot->rx_compl_prod;
7070 if (++prot->rx_compl_prod_sync >= DHD_LB_WORKQ_SYNC) {
7072 prot->rx_compl_prod_sync = 0;
7076 __FUNCTION__, pktid, prot->rx_compl_prod_sync));
7080 if (prot->rxbufpost >= rxcnt) {
7081 prot->rxbufpost -= (uint16)rxcnt;
7084 prot->rxbufpost = 0;
7088 if (prot->rxbufpost <= (prot->max_rxbufpost - RXBUFPOST_THRESHOLD))
7098 dhd_prot_t *prot = dhd->prot; local
7106 bcopy(&prot->host_bus_throughput_buf.pa, &tput_params->host_buf_addr,
7217 dhd_prot_t *prot = dhd->prot; local
7224 msgbuf_ring_t *ring = &prot->h2dring_ctrl_subn;
7281 dhd_prot_t *prot = dhdp->prot; local
7282 dhd_dmaxfer_t *dmaxfer = &prot->dmaxfer;
7372 dhd_prot_t *prot = dhd->prot; local
7381 prot->dmaxfer.status = cmplt->compl_hdr.status;
7382 OSL_CACHE_INV(prot->dmaxfer.dstmem.va, prot->dmaxfer.len);
7383 if (prot->dmaxfer.srcmem.va && prot->dmaxfer.dstmem.va) {
7384 if (memcmp(prot->dmaxfer.srcmem.va,
7385 prot->dmaxfer.dstmem.va, prot->dmaxfer.len) ||
7393 prot->dmaxfer.status = BCME_ERROR;
7395 prot->dmaxfer.srcmem.va, prot->dmaxfer.len);
7397 prot->dmaxfer.dstmem.va, prot->dmaxfer.len);
7400 switch (prot->dmaxfer.d11_lpbk) {
7426 dhd_prhex("XFER SRC: ", prot->dmaxfer.srcmem.va,
7427 prot->dmaxfer.len, DHD_INFO_VAL);
7428 dhd_prhex("XFER DST: ", prot->dmaxfer.dstmem.va,
7429 prot->dmaxfer.len, DHD_INFO_VAL);
7435 end_usec -= prot->dmaxfer.start_usec;
7437 prot->dmaxfer.time_taken = end_usec;
7439 prot->dmaxfer.len, (unsigned long)end_usec,
7440 (prot->dmaxfer.len * (1000 * 1000 / 1024) / (uint32)end_usec)));
7442 dhd->prot->dmaxfer.in_progress = FALSE;
7461 dhd_prot_t *prot = dhd->prot; local
7465 msgbuf_ring_t *ring = &prot->h2dring_ctrl_subn;
7467 if (prot->dmaxfer.in_progress) {
7480 prot->dmaxfer.in_progress = TRUE;
7482 &prot->dmaxfer)) != BCME_OK) {
7483 prot->dmaxfer.in_progress = FALSE;
7492 dmaxfer_free_dmaaddr(dhd, &prot->dmaxfer);
7493 prot->dmaxfer.in_progress = FALSE;
7505 dmap->host_input_buf_addr.high = htol32(PHYSADDRHI(prot->dmaxfer.srcmem.pa));
7506 dmap->host_input_buf_addr.low = htol32(PHYSADDRLO(prot->dmaxfer.srcmem.pa));
7507 dmap->host_ouput_buf_addr.high = htol32(PHYSADDRHI(prot->dmaxfer.dstmem.pa));
7508 dmap->host_ouput_buf_addr.low = htol32(PHYSADDRLO(prot->dmaxfer.dstmem.pa));
7509 dmap->xfer_len = htol32(prot->dmaxfer.len);
7510 dmap->srcdelay = htol32(prot->dmaxfer.srcdelay);
7511 dmap->destdelay = htol32(prot->dmaxfer.destdelay);
7512 prot->dmaxfer.d11_lpbk = d11_lpbk;
7515 ((prot->dmaxfer.d11_lpbk & PCIE_DMA_XFER_FLG_D11_LPBK_MASK)
7517 prot->dmaxfer.start_usec = OSL_SYSUPTIME_US();
7532 dhd_prot_t *prot = dhd->prot; local
7534 if (prot->dmaxfer.in_progress)
7536 else if (prot->dmaxfer.status == 0)
7541 result->type = prot->dmaxfer.d11_lpbk;
7542 result->error_code = prot->dmaxfer.status;
7543 result->num_bytes = prot->dmaxfer.len;
7544 result->time_taken = prot->dmaxfer.time_taken;
7545 if (prot->dmaxfer.time_taken) {
7548 (prot->dmaxfer.len * (1000 * 1000 / 1024)) /
7549 (uint32)prot->dmaxfer.time_taken;
7626 dhd_prot_t *prot = dhd->prot; local
7633 dhd->rxcnt_timeout, prot->curr_ioctl_cmd, prot->ioctl_trans_id,
7634 prot->ioctl_state, dhd->busstate, prot->ioctl_received));
7644 if (prot->curr_ioctl_cmd == WLC_SET_VAR ||
7645 prot->curr_ioctl_cmd == WLC_GET_VAR) {
7649 uint8 *ioctl_buf = (uint8 *)prot->ioctbuf.va;
7654 prot->curr_ioctl_cmd == WLC_SET_VAR ?
7685 dhd_prot_t *prot = dhd->prot; local
7697 timeleft = dhd_os_ioctl_resp_wait(dhd, (uint *)&prot->ioctl_received);
7700 if (prot->ioctl_received == 0) {
7712 timeleft = dhd_os_ioctl_resp_wait(dhd, (uint *)&prot->ioctl_received);
7722 if (dhd->bus->isr_entry_time > prot->ioctl_fillup_time) {
7745 if (prot->ioctl_received != IOCTL_RETURN_ON_SUCCESS) {
7747 __FUNCTION__, prot->ioctl_received));
7754 __FUNCTION__, prot->ioctl_resplen));
7757 if (dhd->prot->ioctl_resplen > len)
7758 dhd->prot->ioctl_resplen = (uint16)len;
7760 bcopy(dhd->prot->retbuf.va, buf, dhd->prot->ioctl_resplen);
7762 ret = (int)(dhd->prot->ioctl_status);
7766 dhd->prot->ioctl_state = 0;
7767 dhd->prot->ioctl_resplen = 0;
7768 dhd->prot->ioctl_received = IOCTL_WAIT;
7769 dhd->prot->curr_ioctl_cmd = 0;
7834 dhd_prot_t *prot; local
7840 if (!(dhd) || !(dhd->prot)) {
7843 prot = dhd->prot;
7846 ring = &prot->h2dring_ctrl_subn;
7850 ring = &prot->h2dring_rxp_subn;
7854 ring = &prot->d2hring_ctrl_cpln;
7858 ring = &prot->d2hring_tx_cpln;
7862 ring = &prot->d2hring_rx_cpln;
7867 FOREACH_RING_IN_FLOWRINGS_POOL(prot, ring, flowid, h2d_flowrings_total) {
7875 ring = prot->d2hring_edl;
7884 ring = prot->h2dring_info_subn;
7888 ring = prot->d2hring_info_cpln;
7987 dhd->prot->d2h_sync_wait_max, dhd->prot->d2h_sync_wait_tot);
7992 dhd->prot->rw_index_sz);
7994 h2d_max_txpost, dhd->prot->h2d_max_txpost);
7995 bcm_bprintf(b, "pktid_txq_start_cnt: %d\n", dhd->prot->pktid_txq_start_cnt);
7996 bcm_bprintf(b, "pktid_txq_stop_cnt: %d\n", dhd->prot->pktid_txq_stop_cnt);
7997 bcm_bprintf(b, "pktid_depleted_cnt: %d\n", dhd->prot->pktid_depleted_cnt);
8021 dhd_prot_t *prot = dhd->prot; local
8022 msgbuf_ring_t *ring = &prot->h2dring_ctrl_subn;
8113 dhd_prot_t *prot = dhd->prot; local
8119 msgbuf_ring_t *ring = &prot->h2dring_ctrl_subn;
8136 if (prot->ioctl_state) {
8137 DHD_ERROR(("%s: pending ioctl %02x\n", __FUNCTION__, prot->ioctl_state));
8141 prot->ioctl_state = MSGBUF_IOCTL_ACK_PENDING | MSGBUF_IOCTL_RESP_PENDING;
8149 prot->ioctl_state = 0;
8150 prot->curr_ioctl_cmd = 0;
8151 prot->ioctl_received = IOCTL_WAIT;
8165 prot->curr_ioctl_cmd = cmd;
8167 prot->ioctl_trans_id++;
8168 ioct_rqst->trans_id = prot->ioctl_trans_id;
8172 ioct_rqst->host_input_buf_addr.high = htol32(PHYSADDRHI(prot->ioctbuf.pa));
8173 ioct_rqst->host_input_buf_addr.low = htol32(PHYSADDRLO(prot->ioctbuf.pa));
8175 ioct_buf = (void *) prot->ioctbuf.va;
8177 prot->ioctl_fillup_time = OSL_LOCALTIME_NS();
8182 OSL_CACHE_FLUSH((void *) prot->ioctbuf.va, len);
8216 dhd_prot_t *prot = dhd->prot; local
8234 if (DHD_IS_FLOWRING(ringid, max_flowrings) && (prot->flowrings_dma_buf.va)) {
8239 dhd_dma_buf_t *rsv_buf = &prot->flowrings_dma_buf;
8261 if (ring == dhd->prot->d2hring_edl) {
8285 if (SECURE_DMA_ENAB(prot->osh)) {
8286 ring->dma_buf.secdma = MALLOCZ(prot->osh, sizeof(sec_cma_info_t));
8377 dhd_prot_t *prot = dhd->prot; local
8385 if (SECURE_DMA_ENAB(prot->osh)) {
8387 SECURE_DMA_UNMAP_ALL(prot->osh, ring->dma_buf.secdma);
8388 MFREE(prot->osh, ring->dma_buf.secdma, sizeof(sec_cma_info_t));
8397 if (DHD_IS_FLOWRING(ring->idx, max_flowrings) && (prot->flowrings_dma_buf.va)) {
8441 dhd_prot_t *prot = dhd->prot; local
8444 if (prot->h2d_flowrings_pool != NULL)
8447 ASSERT(prot->h2d_rings_total == 0);
8450 prot->h2d_rings_total = (uint16)dhd_bus_max_h2d_queues(dhd->bus);
8452 if (prot->h2d_rings_total < BCMPCIE_H2D_COMMON_MSGRINGS) {
8454 __FUNCTION__, prot->h2d_rings_total));
8464 prot->h2d_flowrings_pool = (msgbuf_ring_t *)MALLOCZ(prot->osh,
8467 if (prot->h2d_flowrings_pool == NULL) {
8474 FOREACH_RING_IN_FLOWRINGS_POOL(prot, ring, flowid, h2d_flowrings_total) {
8477 prot->h2d_max_txpost, H2DRING_TXPOST_ITEMSIZE,
8494 prot->h2d_rings_total = 0;
8519 dhd_prot_t *prot = dhd->prot; local
8521 if (prot->h2d_flowrings_pool == NULL) {
8522 ASSERT(prot->h2d_rings_total == 0);
8527 FOREACH_RING_IN_FLOWRINGS_POOL(prot, ring, flowid, h2d_flowrings_total) {
8547 dhd_prot_t *prot = dhd->prot; local
8549 if (prot->h2d_flowrings_pool == NULL) {
8550 ASSERT(prot->h2d_rings_total == 0);
8556 FOREACH_RING_IN_FLOWRINGS_POOL(prot, ring, flowid, h2d_flowrings_total) {
8560 MFREE(prot->osh, prot->h2d_flowrings_pool,
8563 prot->h2d_flowrings_pool = (msgbuf_ring_t*)NULL;
8564 prot->h2d_rings_total = 0;
8582 dhd_prot_t *prot = dhd->prot; local
8585 ASSERT(flowid < prot->h2d_rings_total);
8586 ASSERT(prot->h2d_flowrings_pool != NULL);
8588 ring = DHD_RING_IN_FLOWRINGS_POOL(prot, flowid);
8612 dhd_prot_t *prot = dhd->prot; local
8615 ASSERT(flowid < prot->h2d_rings_total);
8616 ASSERT(prot->h2d_flowrings_pool != NULL);
8618 ring = DHD_RING_IN_FLOWRINGS_POOL(prot, flowid);
8686 dhd_prot_t *prot = dhd->prot; local
8699 prot->mb_2_ring_fn(dhd->bus, db_index, TRUE);
8726 prot->mb_2_ring_fn(dhd->bus, db_index, TRUE);
8728 prot->mb_ring_fn(dhd->bus, ring->wr);
8773 dhd_prot_t *prot = dhd->prot; local
8782 prot->mb_2_ring_fn(dhd->bus, db_index, FALSE);
8802 prot->mb_2_ring_fn(dhd->bus, db_index, FALSE);
8821 msgbuf_ring_t *ctrl_ring = &dhd->prot->h2dring_ctrl_subn;
8899 msgbuf_ring_t *ctrl_ring = &dhd->prot->h2dring_ctrl_subn;
8970 dhd_prot_t *prot = dhd->prot; local
8975 ptr = (uint8 *)(prot->h2d_dma_indx_wr_buf.va);
8980 ptr = (uint8 *)(prot->d2h_dma_indx_rd_buf.va);
8985 ptr = (uint8 *)(prot->h2d_ifrm_indx_wr_buf.va);
8995 ASSERT(prot->rw_index_sz != 0);
8996 ptr += offset * prot->rw_index_sz;
9000 OSL_CACHE_FLUSH((void *)ptr, prot->rw_index_sz);
9019 dhd_prot_t *prot = dhd->prot; local
9024 ptr = (uint8 *)(prot->h2d_dma_indx_wr_buf.va);
9029 ptr = (uint8 *)(prot->h2d_dma_indx_rd_buf.va);
9034 ptr = (uint8 *)(prot->d2h_dma_indx_wr_buf.va);
9039 ptr = (uint8 *)(prot->d2h_dma_indx_rd_buf.va);
9049 ASSERT(prot->rw_index_sz != 0);
9050 ptr += offset * prot->rw_index_sz;
9052 OSL_CACHE_INV((void *)ptr, prot->rw_index_sz);
9090 dhd_prot_t *prot = dhd->prot; local
9093 if (prot == NULL) {
9100 prot->rw_index_sz = rw_index_sz;
9106 dma_buf = &prot->h2d_dma_indx_wr_buf;
9114 dma_buf = &prot->h2d_dma_indx_rd_buf;
9122 dma_buf = &prot->d2h_dma_indx_wr_buf;
9130 dma_buf = &prot->d2h_dma_indx_rd_buf;
9138 dma_buf = &prot->h2d_ifrm_indx_wr_buf;
9174 __FUNCTION__, (uint32 *)(dhd->prot->d2h_dma_indx_rd_buf.va),
9175 (uint32 *)(dhd->prot->d2h_dma_indx_wr_buf.va)));
9266 msgbuf_ring_t *ctrl_ring = &dhd->prot->h2dring_ctrl_subn;
9325 dhd_prot_t *prot = dhd->prot; local
9328 msgbuf_ring_t *ctrl_ring = &prot->h2dring_ctrl_subn;
9372 flow_create_rqst->max_items = htol16(prot->h2d_max_txpost);
9454 if (dhd->prot->h2dring_info_subn->create_req_id == ltoh32(resp->cmn_hdr.request_id) &&
9455 !dhd->prot->h2dring_info_subn->create_pending) {
9464 if (dhd->prot->h2dring_info_subn->create_req_id == ltoh32(resp->cmn_hdr.request_id)) {
9465 dhd->prot->h2dring_info_subn->create_pending = FALSE;
9466 dhd->prot->h2dring_info_subn->inited = TRUE;
9468 dhd_prot_infobufpost(dhd, dhd->prot->h2dring_info_subn);
9495 if (!dhd->prot->d2hring_info_cpln->create_pending) {
9505 dhd->prot->d2hring_info_cpln->create_pending = FALSE;
9506 dhd->prot->d2hring_info_cpln->inited = TRUE;
9510 if (!dhd->prot->d2hring_edl->create_pending) {
9520 dhd->prot->d2hring_edl->create_pending = FALSE;
9521 dhd->prot->d2hring_edl->inited = TRUE;
9527 if (dhd->prot->d2hring_hp2p_txcpl &&
9529 if (!dhd->prot->d2hring_hp2p_txcpl->create_pending) {
9539 dhd->prot->d2hring_hp2p_txcpl->create_pending = FALSE;
9540 dhd->prot->d2hring_hp2p_txcpl->inited = TRUE;
9542 if (dhd->prot->d2hring_hp2p_rxcpl &&
9544 if (!dhd->prot->d2hring_hp2p_rxcpl->create_pending) {
9554 dhd->prot->d2hring_hp2p_rxcpl->create_pending = FALSE;
9555 dhd->prot->d2hring_hp2p_rxcpl->inited = TRUE;
9616 dhd_prot_t *prot = dhd->prot; local
9618 dhd->prot->device_ipc_version,
9619 dhd->prot->host_ipc_version,
9620 dhd->prot->active_ipc_version);
9623 dhd->prot->max_tsbufpost, dhd->prot->cur_ts_bufs_posted);
9625 dhd->prot->max_infobufpost, dhd->prot->infobufpost);
9627 dhd->prot->max_eventbufpost, dhd->prot->cur_event_bufs_posted);
9629 dhd->prot->max_ioctlrespbufpost, dhd->prot->cur_ioctlresp_bufs_posted);
9631 dhd->prot->max_rxbufpost, dhd->prot->rxbufpost);
9638 dhd_prot_print_flow_ring(dhd, &prot->h2dring_ctrl_subn, strbuf,
9641 dhd_prot_print_flow_ring(dhd, &prot->d2hring_ctrl_cpln, strbuf,
9643 bcm_bprintf(strbuf, "%14s", "H2DRxPost", prot->rxbufpost);
9644 dhd_prot_print_flow_ring(dhd, &prot->h2dring_rxp_subn, strbuf,
9647 dhd_prot_print_flow_ring(dhd, &prot->d2hring_rx_cpln, strbuf,
9650 dhd_prot_print_flow_ring(dhd, &prot->d2hring_tx_cpln, strbuf,
9652 if (dhd->prot->h2dring_info_subn != NULL && dhd->prot->d2hring_info_cpln != NULL) {
9654 dhd_prot_print_flow_ring(dhd, prot->h2dring_info_subn, strbuf,
9657 dhd_prot_print_flow_ring(dhd, prot->d2hring_info_cpln, strbuf,
9660 if (dhd->prot->d2hring_edl != NULL) {
9662 dhd_prot_print_flow_ring(dhd, prot->d2hring_edl, strbuf,
9667 OSL_ATOMIC_READ(dhd->osh, &dhd->prot->active_tx_count),
9668 DHD_PKTID_AVAIL(dhd->prot->pktid_ctrl_map),
9669 DHD_PKTID_AVAIL(dhd->prot->pktid_rx_map),
9670 DHD_PKTID_AVAIL(dhd->prot->pktid_tx_map));
9678 dhd_prot_t *prot = dhd->prot; local
9681 msgbuf_ring_t *ring = &prot->h2dring_ctrl_subn;
9807 dhd_prot_t *prot = dhd->prot; local
9810 msgbuf_ring_t *ring = &prot->h2dring_ctrl_subn;
9870 dhd_prot_t *prot = dhd->prot; local
9873 msgbuf_ring_t *ctrl_ring = &prot->h2dring_ctrl_subn;
9909 soft_doorbell = &prot->soft_doorbell[ring_idx];
10428 dhd_prot_t *prot = dhd->prot; local
10442 prot->device_ipc_version,
10443 prot->host_ipc_version,
10444 prot->active_ipc_version));
10448 prot->max_tsbufpost, prot->cur_ts_bufs_posted));
10450 prot->max_infobufpost, prot->infobufpost));
10452 prot->max_eventbufpost, prot->cur_event_bufs_posted));
10454 prot->max_ioctlrespbufpost, prot->cur_ioctlresp_bufs_posted));
10456 prot->max_rxbufpost, prot->rxbufpost));
10458 h2d_max_txpost, prot->h2d_max_txpost));
10465 GET_SEC_USEC(prot->ioctl_fillup_time),
10466 GET_SEC_USEC(prot->ioctl_ack_time),
10467 GET_SEC_USEC(prot->ioctl_cmplt_time)));
10477 ring = &prot->h2dring_ctrl_subn;
10496 ring = &prot->d2hring_ctrl_cpln;
10515 ring = prot->h2dring_info_subn;
10536 ring = prot->d2hring_info_cpln;
10558 ring = &prot->d2hring_tx_cpln;
10580 ring = &prot->d2hring_rx_cpln;
10602 ring = prot->d2hring_edl;
10627 __FUNCTION__, prot->cur_ioctlresp_bufs_posted, prot->cur_event_bufs_posted));
10633 DHD_ERROR(("pktid_txq_start_cnt: %d\n", prot->pktid_txq_start_cnt));
10634 DHD_ERROR(("pktid_txq_stop_cnt: %d\n", prot->pktid_txq_stop_cnt));
10635 DHD_ERROR(("pktid_depleted_cnt: %d\n", prot->pktid_depleted_cnt));
10648 if (dhd->prot->d2h_dma_indx_wr_buf.va) {
10652 OSL_CACHE_INV((void *)dhd->prot->d2h_dma_indx_wr_buf.va,
10653 dhd->prot->d2h_dma_indx_wr_buf.len);
10655 ptr = (uint32 *)(dhd->prot->d2h_dma_indx_wr_buf.va);
10675 if (dhd->prot->h2d_dma_indx_rd_buf.va) {
10676 OSL_CACHE_INV((void *)dhd->prot->h2d_dma_indx_rd_buf.va,
10677 dhd->prot->h2d_dma_indx_rd_buf.len);
10679 ptr = (uint32 *)(dhd->prot->h2d_dma_indx_rd_buf.va);
10698 dhd_prot_t *prot = dhd->prot; local
10700 prot->metadata_dbg = val;
10702 return (uint32)prot->metadata_dbg;
10708 dhd_prot_t *prot = dhd->prot; local
10709 return (uint32)prot->metadata_dbg;
10715 dhd_prot_t *prot = dhd->prot; local
10717 prot->rx_metadata_offset = (uint16)val;
10719 prot->tx_metadata_offset = (uint16)val;
10726 dhd_prot_t *prot = dhd->prot; local
10728 return prot->rx_metadata_offset;
10730 return prot->tx_metadata_offset;
10737 dhd_prot_t *prot = dhd->prot; local
10739 prot->txp_threshold = (uint16)val;
10740 val = prot->txp_threshold;
10757 dhd_prot_t *prot = dhd->prot; local
10758 rxchain_info_t *rxchain = &prot->rxchain;
10812 dhd_prot_t *prot = dhd->prot; local
10813 rxchain_info_t *rxchain = &prot->rxchain;
10833 dhd_prot_t *prot = dhd->prot; local
10836 msgbuf_ring_t *ctrl_ring = &prot->h2dring_ctrl_subn;
10899 dhd_prot_t *prot = dhd->prot; local
10903 msgbuf_ring_t *ring = &prot->h2dring_ctrl_subn;
11317 dhd_prot_t *prot = dhdp->prot; local
11322 msgbuf_ring_t *ctrl_ring = &prot->h2dring_ctrl_subn;
11333 if (prot->hostts_req_buf_inuse == TRUE) {
11361 ts_req->host_buf_addr.high = htol32(PHYSADDRHI(prot->hostts_req_buf.pa));
11362 ts_req->host_buf_addr.low = htol32(PHYSADDRLO(prot->hostts_req_buf.pa));
11364 ts_tlv_buf = (void *) prot->hostts_req_buf.va;
11365 prot->hostts_req_buf_inuse = TRUE;
11368 OSL_CACHE_FLUSH((void *) prot->hostts_req_buf.va, tlv_len);
11391 dhd->prot->tx_ts_log_enabled = enable;
11393 return dhd->prot->tx_ts_log_enabled;
11400 dhd->prot->rx_ts_log_enabled = enable;
11402 return dhd->prot->rx_ts_log_enabled;
11409 dhd->prot->no_retry = enable;
11411 return dhd->prot->no_retry;
11418 dhd->prot->no_aggr = enable;
11420 return dhd->prot->no_aggr;
11427 dhd->prot->fixed_rate = enable;
11429 return dhd->prot->fixed_rate;
11436 dhd_prot_t *prot = dhd->prot; local
11438 dhd_dma_buf_free(dhd, &prot->h2d_dma_indx_wr_buf);
11439 dhd_dma_buf_free(dhd, &prot->d2h_dma_indx_rd_buf);
11445 if (dhd->prot->max_tsbufpost > 0)
11459 return dhdp->prot->ioctl_trans_id;
11474 *va = dhd->prot->host_scb_buf.va;
11477 *len = dhd->prot->host_scb_buf.len;
11490 if (dhd->prot->host_scb_buf.va == NULL ||
11491 ((uint64)offset + length > (uint64)dhd->prot->host_scb_buf.len)) {
11495 memcpy(buff, (char*)dhd->prot->host_scb_buf.va + offset, length);