Lines Matching refs:dhd

198 typedef uint8 (* d2h_sync_cb_t)(dhd_pub_t *dhd, struct msgbuf_ring *ring,
209 typedef int (* d2h_edl_sync_cb_t)(dhd_pub_t *dhd, struct msgbuf_ring *ring,
582 int dhd_ring_write(dhd_pub_t *dhd, msgbuf_ring_t *ring, void *file,
586 int dhd_edl_ring_hdr_write(dhd_pub_t *dhd, msgbuf_ring_t *ring, void *file, const void *user_buf,
597 static int dhd_dma_buf_audit(dhd_pub_t *dhd, dhd_dma_buf_t *dma_buf);
598 static void dhd_dma_buf_reset(dhd_pub_t *dhd, dhd_dma_buf_t *dma_buf);
601 static int dhd_prot_ring_attach(dhd_pub_t *dhd, msgbuf_ring_t *ring,
603 static void dhd_prot_ring_init(dhd_pub_t *dhd, msgbuf_ring_t *ring);
604 static void dhd_prot_ring_reset(dhd_pub_t *dhd, msgbuf_ring_t *ring);
605 static void dhd_prot_ring_detach(dhd_pub_t *dhd, msgbuf_ring_t *ring);
606 static void dhd_prot_process_fw_timestamp(dhd_pub_t *dhd, void* buf);
609 static int dhd_prot_flowrings_pool_attach(dhd_pub_t *dhd);
610 static void dhd_prot_flowrings_pool_reset(dhd_pub_t *dhd);
611 static void dhd_prot_flowrings_pool_detach(dhd_pub_t *dhd);
614 static msgbuf_ring_t *dhd_prot_flowrings_pool_fetch(dhd_pub_t *dhd,
619 static void* dhd_prot_alloc_ring_space(dhd_pub_t *dhd, msgbuf_ring_t *ring,
625 static uint8* dhd_prot_get_read_addr(dhd_pub_t *dhd, msgbuf_ring_t *ring,
629 static void dhd_prot_ring_write_complete(dhd_pub_t *dhd, msgbuf_ring_t *ring,
631 static void dhd_prot_upd_read_idx(dhd_pub_t *dhd, msgbuf_ring_t *ring);
633 static INLINE int dhd_prot_dma_indx_alloc(dhd_pub_t *dhd, uint8 type,
638 void dhd_prot_dma_indx_set(dhd_pub_t *dhd, uint16 new_index, uint8 type,
640 static uint16 dhd_prot_dma_indx_get(dhd_pub_t *dhd, uint8 type, uint16 ringid);
643 static INLINE void *dhd_prot_packet_get(dhd_pub_t *dhd, uint32 pktid, uint8 pkttype,
646 static INLINE void dhd_prot_packet_free(dhd_pub_t *dhd, void *pkt, uint8 pkttype, bool send);
648 static int dhd_msgbuf_query_ioctl(dhd_pub_t *dhd, int ifidx, uint cmd,
650 static int dhd_msgbuf_set_ioctl(dhd_pub_t *dhd, int ifidx, uint cmd,
652 static int dhd_msgbuf_wait_ioctl_cmplt(dhd_pub_t *dhd, uint32 len, void *buf);
653 static int dhd_fillup_ioct_reqst(dhd_pub_t *dhd, uint16 len, uint cmd,
657 static uint16 dhd_msgbuf_rxbuf_post_ctrlpath(dhd_pub_t *dhd, uint8 msgid, uint32 max_to_post);
660 static void dhd_msgbuf_rxbuf_post(dhd_pub_t *dhd, bool use_rsv_pktid);
661 static int dhd_prot_rxbuf_post(dhd_pub_t *dhd, uint16 count, bool use_rsv_pktid);
664 static void dhd_prot_return_rxbuf(dhd_pub_t *dhd, uint32 pktid, uint32 rxcnt);
667 static int dhd_prot_process_msgtype(dhd_pub_t *dhd, msgbuf_ring_t *ring, uint8 *buf, uint32 len);
670 static void dhd_prot_noop(dhd_pub_t *dhd, void *msg);
671 static void dhd_prot_txstatus_process(dhd_pub_t *dhd, void *msg);
672 static void dhd_prot_ioctcmplt_process(dhd_pub_t *dhd, void *msg);
673 static void dhd_prot_ioctack_process(dhd_pub_t *dhd, void *msg);
674 static void dhd_prot_ringstatus_process(dhd_pub_t *dhd, void *msg);
675 static void dhd_prot_genstatus_process(dhd_pub_t *dhd, void *msg);
676 static void dhd_prot_event_process(dhd_pub_t *dhd, void *msg);
679 static void dmaxfer_free_dmaaddr(dhd_pub_t *dhd, dhd_dmaxfer_t *dma);
680 static int dmaxfer_prepare_dmaaddr(dhd_pub_t *dhd, uint len, uint srcdelay,
682 static void dhd_msgbuf_dmaxfer_process(dhd_pub_t *dhd, void *msg);
685 static void dhd_prot_flow_ring_create_response_process(dhd_pub_t *dhd, void *msg);
686 static void dhd_prot_flow_ring_delete_response_process(dhd_pub_t *dhd, void *msg);
687 static void dhd_prot_flow_ring_flush_response_process(dhd_pub_t *dhd, void *msg);
688 static void dhd_prot_process_flow_ring_resume_response(dhd_pub_t *dhd, void* msg);
689 static void dhd_prot_process_flow_ring_suspend_response(dhd_pub_t *dhd, void* msg);
693 extern bool dhd_monitor_enabled(dhd_pub_t *dhd, int ifidx);
698 static void dhd_msgbuf_ring_config_d2h_soft_doorbell(dhd_pub_t *dhd);
699 static void dhd_prot_process_d2h_ring_config_complete(dhd_pub_t *dhd, void *msg);
700 static void dhd_prot_process_d2h_ring_create_complete(dhd_pub_t *dhd, void *buf);
701 static void dhd_prot_process_h2d_ring_create_complete(dhd_pub_t *dhd, void *buf);
702 static void dhd_prot_process_infobuf_complete(dhd_pub_t *dhd, void* buf);
703 static void dhd_prot_process_d2h_mb_data(dhd_pub_t *dhd, void* buf);
704 static void dhd_prot_detach_info_rings(dhd_pub_t *dhd);
706 static void dhd_prot_detach_hp2p_rings(dhd_pub_t *dhd);
709 static void dhd_prot_detach_edl_rings(dhd_pub_t *dhd);
711 static void dhd_prot_process_d2h_host_ts_complete(dhd_pub_t *dhd, void* buf);
712 static void dhd_prot_process_snapshot_complete(dhd_pub_t *dhd, void *buf);
715 static void dhd_update_hp2p_rxstats(dhd_pub_t *dhd, host_rxbuf_cmpl_t *rxstatus);
716 static void dhd_update_hp2p_txstats(dhd_pub_t *dhd, host_txbuf_cmpl_t *txstatus);
717 static void dhd_calc_hp2p_burst(dhd_pub_t *dhd, msgbuf_ring_t *ring, uint16 flowid);
718 static void dhd_update_hp2p_txdesc(dhd_pub_t *dhd, host_txbuf_post_t *txdesc);
720 typedef void (*dhd_msgbuf_func_t)(dhd_pub_t *dhd, void *msg);
773 #define PKT_CTF_CHAINABLE(dhd, ifidx, evh, prio, h_sa, h_da, h_prio) \ argument
774 (dhd_wet_chainable(dhd) && \
775 dhd_rx_pkt_chainable((dhd), (ifidx)) && \
780 ((h_prio) == (prio)) && (dhd_ctf_hotbrc_check((dhd), (evh), (ifidx))) && \
785 static void BCMFASTPATH dhd_rxchain_frame(dhd_pub_t *dhd, void *pkt, uint ifidx);
786 static void BCMFASTPATH dhd_rxchain_commit(dhd_pub_t *dhd);
794 static void dhd_prot_h2d_sync_init(dhd_pub_t *dhd);
797 dhd_prot_is_cmpl_ring_empty(dhd_pub_t *dhd, void *prot_info) in dhd_prot_is_cmpl_ring_empty() argument
803 if (dhd->dma_d2h_ring_upd_support) { in dhd_prot_is_cmpl_ring_empty()
806 dhd_bus_cmn_readshared(dhd->bus, &wr, RING_WR_UPD, flow_ring->idx); in dhd_prot_is_cmpl_ring_empty()
808 if (dhd->dma_h2d_ring_upd_support) { in dhd_prot_is_cmpl_ring_empty()
811 dhd_bus_cmn_readshared(dhd->bus, &rd, RING_RD_UPD, flow_ring->idx); in dhd_prot_is_cmpl_ring_empty()
826 dhd_prot_get_h2d_max_txpost(dhd_pub_t *dhd) in dhd_prot_get_h2d_max_txpost() argument
831 dhd_prot_set_h2d_max_txpost(dhd_pub_t *dhd, uint16 max_txpost) in dhd_prot_set_h2d_max_txpost() argument
843 static void dhd_prot_d2h_sync_livelock(dhd_pub_t *dhd, uint32 msg_seqnum, msgbuf_ring_t *ring,
845 static uint8 dhd_prot_d2h_sync_seqnum(dhd_pub_t *dhd, msgbuf_ring_t *ring,
847 static uint8 dhd_prot_d2h_sync_xorcsum(dhd_pub_t *dhd, msgbuf_ring_t *ring,
849 static uint8 dhd_prot_d2h_sync_none(dhd_pub_t *dhd, msgbuf_ring_t *ring,
851 static void dhd_prot_d2h_sync_init(dhd_pub_t *dhd);
852 static int dhd_send_d2h_ringcreate(dhd_pub_t *dhd, msgbuf_ring_t *ring_to_create,
854 static int dhd_send_h2d_ringcreate(dhd_pub_t *dhd, msgbuf_ring_t *ring_to_create,
867 dhd_prot_d2h_sync_livelock(dhd_pub_t *dhd, uint32 msg_seqnum, msgbuf_ring_t *ring, uint32 tries, in dhd_prot_d2h_sync_livelock() argument
872 if (dhd_query_bus_erros(dhd)) { in dhd_prot_d2h_sync_livelock()
879 dhd, ring->name, msg_seqnum, ring_seqnum, ring_seqnum% D2H_EPOCH_MODULO, tries, in dhd_prot_d2h_sync_livelock()
880 dhd->prot->d2h_sync_wait_max, dhd->prot->d2h_sync_wait_tot, in dhd_prot_d2h_sync_livelock()
887 dhdpcie_runtime_bus_wake(dhd, CAN_SLEEP(), __builtin_return_address(0)); in dhd_prot_d2h_sync_livelock()
891 if (DHD_BUS_CHECK_SUSPEND_OR_ANY_SUSPEND_IN_PROGRESS(dhd)) { in dhd_prot_d2h_sync_livelock()
893 __FUNCTION__, dhd->busstate, dhd->dhd_bus_busy_state)); in dhd_prot_d2h_sync_livelock()
897 dhd_bus_dump_console_buffer(dhd->bus); in dhd_prot_d2h_sync_livelock()
898 dhd_prot_debug_info_print(dhd); in dhd_prot_d2h_sync_livelock()
901 if (dhd->memdump_enabled) { in dhd_prot_d2h_sync_livelock()
903 dhd->memdump_type = DUMP_TYPE_BY_LIVELOCK; in dhd_prot_d2h_sync_livelock()
904 dhd_bus_mem_dump(dhd); in dhd_prot_d2h_sync_livelock()
909 dhd_schedule_reset(dhd); in dhd_prot_d2h_sync_livelock()
914 dhd->bus->no_cfg_restore = 1; in dhd_prot_d2h_sync_livelock()
916 dhd->hang_reason = HANG_REASON_MSGBUF_LIVELOCK; in dhd_prot_d2h_sync_livelock()
917 dhd_os_send_hang_message(dhd); in dhd_prot_d2h_sync_livelock()
920 dhd->livelock_occured = TRUE; in dhd_prot_d2h_sync_livelock()
928 dhd_prot_d2h_sync_seqnum(dhd_pub_t *dhd, msgbuf_ring_t *ring, in dhd_prot_d2h_sync_seqnum() argument
935 dhd_prot_t *prot = dhd->prot; in dhd_prot_d2h_sync_seqnum()
972 if (dhd->dhd_induce_error != DHD_INDUCE_LIVELOCK) { in dhd_prot_d2h_sync_seqnum()
989 dhd_prot_d2h_sync_livelock(dhd, msg_seqnum, ring, total_tries, in dhd_prot_d2h_sync_seqnum()
1007 dhd_prot_d2h_sync_xorcsum(dhd_pub_t *dhd, msgbuf_ring_t *ring, in dhd_prot_d2h_sync_xorcsum() argument
1014 dhd_prot_t *prot = dhd->prot; in dhd_prot_d2h_sync_xorcsum()
1058 if (dhd->dhd_induce_error != DHD_INDUCE_LIVELOCK) { in dhd_prot_d2h_sync_xorcsum()
1077 dhd_prot_d2h_sync_livelock(dhd, msg->epoch, ring, total_tries, in dhd_prot_d2h_sync_xorcsum()
1095 dhd_prot_d2h_sync_none(dhd_pub_t *dhd, msgbuf_ring_t *ring, in dhd_prot_d2h_sync_none() argument
1102 if (dhd->dhd_induce_error == DHD_INDUCE_LIVELOCK) { in dhd_prot_d2h_sync_none()
1125 BCMFASTPATH(dhd_prot_d2h_sync_edl)(dhd_pub_t *dhd, msgbuf_ring_t *ring, in BCMFASTPATH()
1131 dhd_prot_t *prot = dhd->prot; in BCMFASTPATH()
1194 if (dhd->dhd_induce_error != DHD_INDUCE_LIVELOCK) { in BCMFASTPATH()
1241 dhd_prot_d2h_sync_livelock(dhd, msg->epoch, ring, total_tries, in BCMFASTPATH()
1261 dhd_prot_d2h_sync_edl_none(dhd_pub_t *dhd, msgbuf_ring_t *ring, in dhd_prot_d2h_sync_edl_none() argument
1268 if (dhd->dhd_induce_error == DHD_INDUCE_LIVELOCK) { in dhd_prot_d2h_sync_edl_none()
1281 dhd_wakeup_ioctl_event(dhd_pub_t *dhd, dhd_ioctl_recieved_status_t reason) in dhd_wakeup_ioctl_event() argument
1285 dhd->prot->ioctl_received = reason; in dhd_wakeup_ioctl_event()
1288 dhd_os_ioctl_resp_wake(dhd); in dhd_wakeup_ioctl_event()
1296 dhd_prot_d2h_sync_init(dhd_pub_t *dhd) in dhd_prot_d2h_sync_init() argument
1298 dhd_prot_t *prot = dhd->prot; in dhd_prot_d2h_sync_init()
1311 if (HWA_ACTIVE(dhd)) { in dhd_prot_d2h_sync_init()
1313 (dhd->bus->hwa_enab_bmap & HWA_ENAB_BITMAP_TXCPLT) ? HWA_DB_TYPE_TXCPLT : 0; in dhd_prot_d2h_sync_init()
1315 (dhd->bus->hwa_enab_bmap & HWA_ENAB_BITMAP_RXCPLT) ? HWA_DB_TYPE_RXCPLT : 0; in dhd_prot_d2h_sync_init()
1321 if (dhd->d2h_sync_mode & PCIE_SHARED_D2H_SYNC_SEQNUM) { in dhd_prot_d2h_sync_init()
1327 } else if (dhd->d2h_sync_mode & PCIE_SHARED_D2H_SYNC_XORCSUM) { in dhd_prot_d2h_sync_init()
1346 dhd_prot_h2d_sync_init(dhd_pub_t *dhd) in dhd_prot_h2d_sync_init() argument
1348 dhd_prot_t *prot = dhd->prot; in dhd_prot_h2d_sync_init()
1351 if (HWA_ACTIVE(dhd)) { in dhd_prot_h2d_sync_init()
1353 (dhd->bus->hwa_enab_bmap & HWA_ENAB_BITMAP_RXPOST) ? HWA_DB_TYPE_RXPOST : 0; in dhd_prot_h2d_sync_init()
1385 dhd_dma_buf_audit(dhd_pub_t *dhd, dhd_dma_buf_t *dma_buf) in dhd_dma_buf_audit() argument
1412 dhd_dma_buf_alloc(dhd_pub_t *dhd, dhd_dma_buf_t *dma_buf, uint32 buf_len) in dhd_dma_buf_alloc() argument
1415 osl_t *osh = dhd->osh; in dhd_dma_buf_alloc()
1438 if (dhd_dma_buf_audit(dhd, dma_buf) != BCME_OK) { /* audit dma buf */ in dhd_dma_buf_alloc()
1439 dhd_dma_buf_free(dhd, dma_buf); in dhd_dma_buf_alloc()
1443 dhd_dma_buf_reset(dhd, dma_buf); /* zero out and cache flush */ in dhd_dma_buf_alloc()
1452 dhd_dma_buf_reset(dhd_pub_t *dhd, dhd_dma_buf_t *dma_buf) in dhd_dma_buf_reset() argument
1457 (void)dhd_dma_buf_audit(dhd, dma_buf); in dhd_dma_buf_reset()
1469 dhd_dma_buf_free(dhd_pub_t *dhd, dhd_dma_buf_t *dma_buf) in dhd_dma_buf_free() argument
1471 osl_t *osh = dhd->osh; in dhd_dma_buf_free()
1479 (void)dhd_dma_buf_audit(dhd, dma_buf); in dhd_dma_buf_free()
1493 dhd_dma_buf_init(dhd_pub_t *dhd, void *dhd_dma_buf, in dhd_dma_buf_init() argument
1506 (void)dhd_dma_buf_audit(dhd, dma_buf); in dhd_dma_buf_init()
1542 #define DHD_PKTID_LOG_INIT(dhd, hdl) dhd_pktid_logging_init((dhd), (hdl)) argument
1543 #define DHD_PKTID_LOG_FINI(dhd, hdl) dhd_pktid_logging_fini((dhd), (hdl)) argument
1544 #define DHD_PKTID_LOG(dhd, hdl, pa, pktid, len, pkttype) \ argument
1545 dhd_pktid_logging((dhd), (hdl), (pa), (pktid), (len), (pkttype))
1546 #define DHD_PKTID_LOG_DUMP(dhd) dhd_pktid_logging_dump((dhd)) argument
1549 dhd_pktid_logging_init(dhd_pub_t *dhd, uint32 num_items) in dhd_pktid_logging_init() argument
1555 log = (dhd_pktid_log_t *)MALLOCZ(dhd->osh, log_size); in dhd_pktid_logging_init()
1569 dhd_pktid_logging_fini(dhd_pub_t *dhd, dhd_pktid_log_handle_t *handle) in dhd_pktid_logging_fini() argument
1581 MFREE(dhd->osh, handle, log_size); in dhd_pktid_logging_fini()
1585 dhd_pktid_logging(dhd_pub_t *dhd, dhd_pktid_log_handle_t *handle, dmaaddr_t pa, in dhd_pktid_logging() argument
1607 dhd_pktid_logging_dump(dhd_pub_t *dhd) in dhd_pktid_logging_dump() argument
1609 dhd_prot_t *prot = dhd->prot; in dhd_pktid_logging_dump()
1693 static dhd_pktid_map_handle_t *dhd_pktid_map_init(dhd_pub_t *dhd, uint32 num_items);
1696 static void dhd_pktid_map_fini(dhd_pub_t *dhd, dhd_pktid_map_handle_t *map);
1698 #define DHD_NATIVE_TO_PKTID_INIT(dhd, items) dhd_pktid_map_init((dhd), (items)) argument
1699 #define DHD_NATIVE_TO_PKTID_RESET(dhd, map) dhd_pktid_map_reset((dhd), (map)) argument
1700 #define DHD_NATIVE_TO_PKTID_FINI(dhd, map) dhd_pktid_map_fini((dhd), (map)) argument
1711 static void free_ioctl_return_buffer(dhd_pub_t *dhd, dhd_dma_buf_t *retbuf);
1712 static int alloc_ioctl_return_buffer(dhd_pub_t *dhd, dhd_dma_buf_t *retbuf);
1719 static INLINE uint32 dhd_pktid_map_reserve(dhd_pub_t *dhd, dhd_pktid_map_handle_t *handle,
1721 static INLINE void dhd_pktid_map_save(dhd_pub_t *dhd, dhd_pktid_map_handle_t *handle,
1724 static uint32 dhd_pktid_map_alloc(dhd_pub_t *dhd, dhd_pktid_map_handle_t *map,
1728 static void *dhd_pktid_map_free(dhd_pub_t *dhd, dhd_pktid_map_handle_t *map,
1855 #define DHD_NATIVE_TO_PKTID_RESET_IOCTL(dhd, map) dhd_pktid_map_reset_ioctl((dhd), (map)) argument
1858 #define DHD_NATIVE_TO_PKTID_RSV(dhd, map, pkt, pkttype) \ argument
1859 dhd_pktid_map_reserve((dhd), (map), (pkt), (pkttype))
1861 #define DHD_NATIVE_TO_PKTID_SAVE(dhd, map, pkt, nkey, pa, len, dir, dmah, secdma, pkttype) \ argument
1862 dhd_pktid_map_save((dhd), (map), (void *)(pkt), (nkey), (pa), (uint32)(len), \
1866 #define DHD_NATIVE_TO_PKTID(dhd, map, pkt, pa, len, dir, dmah, secdma, pkttype) \ argument
1867 dhd_pktid_map_alloc((dhd), (map), (void *)(pkt), (pa), (uint32)(len), \
1872 #define DHD_PKTID_TO_NATIVE(dhd, map, pktid, pa, len, dmah, secdma, pkttype) \ argument
1873 dhd_pktid_map_free((dhd), (map), (uint32)(pktid), \
1878 #define DHD_PKTID_TO_NATIVE_RSV(dhd, map, pktid, pa, len, dmah, secdma, pkttype) \ argument
1879 dhd_pktid_map_free((dhd), (map), (uint32)(pktid), \
1888 dhd_get_pktid_map_type(dhd_pub_t *dhd, dhd_pktid_map_t *pktid_map) in dhd_get_pktid_map_type() argument
1890 dhd_prot_t *prot = dhd->prot; in dhd_get_pktid_map_type()
1910 __dhd_pktid_audit(dhd_pub_t *dhd, dhd_pktid_map_t *pktid_map, uint32 pktid, in __dhd_pktid_audit() argument
1992 dhd->pktid_audit_failed = TRUE; in __dhd_pktid_audit()
1999 dhd_pktid_audit(dhd_pub_t *dhd, dhd_pktid_map_t *pktid_map, uint32 pktid, in dhd_pktid_audit() argument
2003 ret = __dhd_pktid_audit(dhd, pktid_map, pktid, test_for, errmsg); in dhd_pktid_audit()
2006 __FUNCTION__, pktid, dhd_get_pktid_map_type(dhd, pktid_map))); in dhd_pktid_audit()
2007 dhd_pktid_error_handler(dhd); in dhd_pktid_audit()
2064 dhd_pktid_map_init(dhd_pub_t *dhd, uint32 num_items) in dhd_pktid_map_init() argument
2072 osh = dhd->osh; in dhd_pktid_map_init()
2166 dhd_pktid_map_reset(dhd_pub_t *dhd, dhd_pktid_map_handle_t *handle) in dhd_pktid_map_reset() argument
2178 osh = dhd->osh; in dhd_pktid_map_reset()
2189 OSL_ATOMIC_DEC(dhd->osh, &dhd->prot->active_tx_count); in dhd_pktid_map_reset()
2193 DHD_PKTID_AUDIT(dhd, map, nkey, DHD_DUPLICATE_FREE); /* duplicate frees */ in dhd_pktid_map_reset()
2196 DHD_PKTID_LOG(dhd, dhd->prot->pktid_dma_unmap, in dhd_pktid_map_reset()
2202 if (SECURE_DMA_ENAB(dhd->osh)) in dhd_pktid_map_reset()
2210 dhd_prot_packet_free(dhd, (ulong*)locker->pkt, in dhd_pktid_map_reset()
2215 DHD_PKTID_AUDIT(dhd, map, nkey, DHD_TEST_IS_FREE); in dhd_pktid_map_reset()
2229 dhd_pktid_map_reset_ioctl(dhd_pub_t *dhd, dhd_pktid_map_handle_t *handle) in dhd_pktid_map_reset_ioctl() argument
2247 DHD_PKTID_AUDIT(dhd, map, nkey, DHD_DUPLICATE_FREE); /* duplicate frees */ in dhd_pktid_map_reset_ioctl()
2257 free_ioctl_return_buffer(dhd, &retbuf); in dhd_pktid_map_reset_ioctl()
2261 DHD_PKTID_AUDIT(dhd, map, nkey, DHD_TEST_IS_FREE); in dhd_pktid_map_reset_ioctl()
2277 dhd_pktid_map_fini(dhd_pub_t *dhd, dhd_pktid_map_handle_t *handle) in dhd_pktid_map_fini() argument
2287 dhd_pktid_map_reset(dhd, handle); in dhd_pktid_map_fini()
2293 DHD_PKTID_LOCK_DEINIT(dhd->osh, map->pktid_lock); in dhd_pktid_map_fini()
2297 bcm_mwbmap_fini(dhd->osh, map->pktid_audit); /* Destruct pktid_audit */ in dhd_pktid_map_fini()
2300 DHD_PKTID_AUDIT_LOCK_DEINIT(dhd->osh, map->pktid_audit_lock); in dhd_pktid_map_fini()
2304 MFREE(dhd->osh, map->keys, map_keys_sz); in dhd_pktid_map_fini()
2305 VMFREE(dhd->osh, handle, dhd_pktid_map_sz); in dhd_pktid_map_fini()
2309 dhd_pktid_map_fini_ioctl(dhd_pub_t *dhd, dhd_pktid_map_handle_t *handle) in dhd_pktid_map_fini_ioctl() argument
2319 dhd_pktid_map_reset_ioctl(dhd, handle); in dhd_pktid_map_fini_ioctl()
2325 DHD_PKTID_LOCK_DEINIT(dhd->osh, map->pktid_lock); in dhd_pktid_map_fini_ioctl()
2329 bcm_mwbmap_fini(dhd->osh, map->pktid_audit); /* Destruct pktid_audit */ in dhd_pktid_map_fini_ioctl()
2332 DHD_PKTID_AUDIT_LOCK_DEINIT(dhd->osh, map->pktid_audit_lock); in dhd_pktid_map_fini_ioctl()
2337 MFREE(dhd->osh, map->keys, map_keys_sz); in dhd_pktid_map_fini_ioctl()
2338 VMFREE(dhd->osh, handle, dhd_pktid_map_sz); in dhd_pktid_map_fini_ioctl()
2368 dhd_pktid_map_reserve(dhd_pub_t *dhd, dhd_pktid_map_handle_t *handle, in dhd_pktid_map_reserve() argument
2419 dhd_pktid_map_save(dhd_pub_t *dhd, dhd_pktid_map_handle_t *handle, void *pkt, in dhd_pktid_map_save() argument
2437 if (dhd->memdump_enabled) { in dhd_pktid_map_save()
2439 dhd->memdump_type = DUMP_TYPE_PKTID_INVALID; in dhd_pktid_map_save()
2440 dhd_bus_mem_dump(dhd); in dhd_pktid_map_save()
2463 DHD_PKTID_LOG(dhd, dhd->prot->pktid_dma_map, pa, nkey, len, pkttype); in dhd_pktid_map_save()
2473 dhd_pktid_map_alloc(dhd_pub_t *dhd, dhd_pktid_map_handle_t *handle, void *pkt, in dhd_pktid_map_alloc() argument
2479 nkey = dhd_pktid_map_reserve(dhd, handle, pkt, pkttype); in dhd_pktid_map_alloc()
2481 dhd_pktid_map_save(dhd, handle, pkt, nkey, pa, in dhd_pktid_map_alloc()
2495 dhd_pktid_map_free(dhd_pub_t *dhd, dhd_pktid_map_handle_t *handle, uint32 nkey, in dhd_pktid_map_free() argument
2516 if (dhd->memdump_enabled) { in dhd_pktid_map_free()
2518 dhd->memdump_type = DUMP_TYPE_PKTID_INVALID; in dhd_pktid_map_free()
2519 dhd_bus_mem_dump(dhd); in dhd_pktid_map_free()
2530 DHD_PKTID_AUDIT(dhd, map, nkey, DHD_DUPLICATE_FREE); /* Audit duplicate FREE */ in dhd_pktid_map_free()
2539 if (dhd->memdump_enabled) { in dhd_pktid_map_free()
2541 dhd->memdump_type = DUMP_TYPE_PKTID_INVALID; in dhd_pktid_map_free()
2542 dhd_bus_mem_dump(dhd); in dhd_pktid_map_free()
2569 if (dhd->memdump_enabled) { in dhd_pktid_map_free()
2571 dhd->memdump_type = DUMP_TYPE_PKTID_INVALID; in dhd_pktid_map_free()
2572 dhd_bus_mem_dump(dhd); in dhd_pktid_map_free()
2590 DHD_PKTID_AUDIT(dhd, map, nkey, DHD_TEST_IS_FREE); in dhd_pktid_map_free()
2593 DHD_PKTID_LOG(dhd, dhd->prot->pktid_dma_unmap, locker->pa, nkey, in dhd_pktid_map_free()
2639 dhd_pktid_map_init(dhd_pub_t *dhd, uint32 num_items) in dhd_pktid_map_init() argument
2641 osl_t *osh = dhd->osh; in dhd_pktid_map_init()
2696 dhd_pktid_map_reset(dhd_pub_t *dhd, pktlists_t *handle) in dhd_pktid_map_reset() argument
2698 osl_t *osh = dhd->osh; in dhd_pktid_map_reset()
2717 dhd_pktid_map_fini(dhd_pub_t *dhd, dhd_pktid_map_handle_t *map) in dhd_pktid_map_fini() argument
2719 osl_t *osh = dhd->osh; in dhd_pktid_map_fini()
2727 dhd_pktid_map_reset(dhd, handle); in dhd_pktid_map_fini()
2785 #define DHD_NATIVE_TO_PKTID_RSV(dhd, map, pkt, pkttype) DHD_PKTID32(pkt) argument
2787 #define DHD_NATIVE_TO_PKTID_SAVE(dhd, map, pkt, nkey, pa, len, dma_dir, dmah, secdma, pkttype) \ argument
2788 ({ BCM_REFERENCE(dhd); BCM_REFERENCE(nkey); BCM_REFERENCE(dma_dir); \
2793 #define DHD_NATIVE_TO_PKTID(dhd, map, pkt, pa, len, dma_dir, dmah, secdma, pkttype) \ argument
2794 ({ BCM_REFERENCE(dhd); BCM_REFERENCE(dma_dir); \
2799 #define DHD_PKTID_TO_NATIVE(dhd, map, pktid, pa, len, dmah, secdma, pkttype) \ argument
2800 ({ BCM_REFERENCE(dhd); BCM_REFERENCE(pkttype); \
2834 dhd_prot_attach(dhd_pub_t *dhd) argument
2836 osl_t *osh = dhd->osh;
2845 if (!(prot = (dhd_prot_t *)DHD_OS_PREALLOC(dhd, DHD_PREALLOC_PROT,
2853 dhd->prot = prot;
2856 dhd->dma_d2h_ring_upd_support = FALSE;
2857 dhd->dma_h2d_ring_upd_support = FALSE;
2858 dhd->dma_ring_upd_overwrite = FALSE;
2860 dhd->hwa_inited = 0;
2861 dhd->idma_inited = 0;
2862 dhd->ifrm_inited = 0;
2863 dhd->dar_inited = 0;
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)) {
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)) {
2956 prot->pktid_ctrl_map = DHD_NATIVE_TO_PKTID_INIT(dhd, MAX_CTRL_PKTID);
2961 prot->pktid_rx_map = DHD_NATIVE_TO_PKTID_INIT(dhd, MAX_RX_PKTID);
2965 prot->pktid_tx_map = DHD_NATIVE_TO_PKTID_INIT(dhd, MAX_TX_PKTID);
2970 prot->pktid_map_handle_ioctl = DHD_NATIVE_TO_PKTID_INIT(dhd,
2978 prot->pktid_dma_map = DHD_PKTID_LOG_INIT(dhd, MAX_PKTID_LOG);
2984 prot->pktid_dma_unmap = DHD_PKTID_LOG_INIT(dhd, MAX_PKTID_LOG);
2995 buffer = MALLOC(dhd->osh, sizeof(void*) * DHD_LB_WORKQ_SZ);
3011 buffer = MALLOC(dhd->osh, sizeof(void*) * DHD_LB_WORKQ_SZ);
3025 if (dhd_dma_buf_alloc(dhd, &dhd->prot->fw_trap_buf, trap_buf_len)) {
3036 dhd_prot_detach(dhd);
3043 dhd_alloc_host_scbs(dhd_pub_t *dhd) argument
3047 dhd_prot_t *prot = dhd->prot;
3050 if (dhd->hscb_enable) {
3052 dhd_bus_cmn_readshared(dhd->bus, &host_scb_size, HOST_SCB_ADDR, 0);
3055 ret = dhd_dma_buf_alloc(dhd, &prot->host_scb_buf, host_scb_size);
3059 dhd_bus_cmn_writeshared(dhd->bus, &base_addr, sizeof(base_addr),
3075 dhd_set_host_cap(dhd_pub_t *dhd) argument
3078 dhd_prot_t *prot = dhd->prot;
3080 if (dhd->bus->api.fw_rev >= PCIE_SHARED_VERSION_6) {
3081 if (dhd->h2d_phase_supported) {
3083 if (dhd->force_dongletrap_on_bad_h2d_phase)
3093 if (dhdpcie_bus_get_pcie_hostready_supported(dhd->bus)) {
3100 dhdpcie_bus_enab_pcie_dw(dhd->bus, DEVICE_WAKE_NONE);
3107 if (dhd->pcie_txs_metadata_enable != 0)
3111 if (dhd->fast_delete_ring_support) {
3115 if (dhdpcie_bus_get_pcie_hwa_supported(dhd->bus)) {
3118 dhd->hwa_inited = TRUE;
3121 if (dhdpcie_bus_get_pcie_idma_supported(dhd->bus)) {
3124 dhd->idma_inited = TRUE;
3127 if (dhdpcie_bus_get_pcie_ifrm_supported(dhd->bus)) {
3130 dhd->ifrm_inited = TRUE;
3131 dhd->dma_h2d_ring_upd_support = FALSE;
3132 dhd_prot_dma_indx_free(dhd);
3135 if (dhdpcie_bus_get_pcie_dar_supported(dhd->bus)) {
3138 dhd->dar_inited = TRUE;
3143 if (dhd->hscb_enable) {
3148 if (dhd->dongle_edl_support) {
3157 if (dhd->hp2p_capable) {
3167 if (dhd->db0ts_capable) {
3174 if (dhd->extdtxs_in_txcpl) {
3187 dhd_bus_cmn_writeshared(dhd->bus, &data, sizeof(uint32), HOST_API_VERSION, 0);
3188 dhd_bus_cmn_writeshared(dhd->bus, &prot->fw_trap_buf.pa,
3202 dhd_prot_init(dhd_pub_t *dhd) argument
3205 dhd_prot_t *prot = dhd->prot;
3211 dhd->monitor_enable = FALSE;
3226 dhd_bus_cmn_readshared(dhd->bus, &prot->max_rxbufpost, MAX_HOST_RXBUFS, 0);
3241 OSL_ATOMIC_INIT(dhd->osh, &prot->active_tx_count);
3269 prot->device_ipc_version = dhd->bus->api.fw_rev;
3274 dhd_set_host_cap(dhd);
3277 if ((ret = dhd_alloc_host_scbs(dhd))) {
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);
3287 dhd->bus->_dar_war = (dhd->bus->sih->buscorerev < 64) ? TRUE : FALSE;
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);
3300 dhd_prot_ring_init(dhd, &prot->d2hring_tx_cpln);
3301 dhd_prot_ring_init(dhd, &prot->d2hring_rx_cpln);
3303 dhd_prot_d2h_sync_init(dhd);
3305 dhd_prot_h2d_sync_init(dhd);
3309 dhd_bus_cmn_writeshared(dhd->bus, &base_addr, sizeof(base_addr),
3311 dhd_bus_cmn_writeshared(dhd->bus, &prot->d2h_dma_scratch_buf.len,
3317 if (dhd->dma_d2h_ring_upd_support) {
3319 dhd_bus_cmn_writeshared(dhd->bus, &base_addr, sizeof(base_addr),
3322 dhd_bus_cmn_writeshared(dhd->bus, &base_addr, sizeof(base_addr),
3326 if (dhd->dma_h2d_ring_upd_support || IDMA_ENAB(dhd)) {
3328 dhd_bus_cmn_writeshared(dhd->bus, &base_addr, sizeof(base_addr),
3331 dhd_bus_cmn_writeshared(dhd->bus, &base_addr, sizeof(base_addr),
3335 if (dhd->hostrdy_after_init)
3336 dhd_bus_hostready(dhd->bus);
3346 if (dhd_prot_flowrings_pool_attach(dhd) != BCME_OK) {
3351 if (IFRM_ENAB(dhd)) {
3353 dhd_bus_cmn_writeshared(dhd->bus, &base_addr, sizeof(base_addr),
3365 if (IDMA_ACTIVE(dhd)) {
3368 uint buscorerev = dhd->bus->sih->buscorerev;
3369 idmacontrol = si_corereg(dhd->bus->sih, dhd->bus->sih->buscoreidx,
3381 idmacontrol = si_corereg(dhd->bus->sih, dhd->bus->sih->buscoreidx,
3397 dhd_msgbuf_ring_config_d2h_soft_doorbell(dhd);
3399 dhd_msgbuf_rxbuf_post_ioctlresp_bufs(dhd);
3400 dhd_msgbuf_rxbuf_post_event_bufs(dhd);
3422 if (dhd->bus->api.fw_rev >= PCIE_SHARED_VERSION_6 && !dhd->dongle_edl_support)
3424 if (dhd->bus->api.fw_rev >= PCIE_SHARED_VERSION_6)
3427 if ((ret = dhd_prot_init_info_rings(dhd)) != BCME_OK) {
3438 if (dhd->dongle_edl_support) {
3439 if ((ret = dhd_prot_init_edl_rings(dhd)) != BCME_OK) {
3448 if (dhd->bus->api.fw_rev >= PCIE_SHARED_VERSION_7 && dhd->hp2p_capable) {
3449 if ((ret = dhd_prot_init_hp2p_rings(dhd)) != BCME_OK) {
3466 void dhd_prot_detach(dhd_pub_t *dhd) argument
3468 dhd_prot_t *prot = dhd->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);
3499 dhd_prot_flowrings_pool_detach(dhd);
3502 dhd_prot_detach_info_rings(dhd);
3505 dhd_prot_detach_edl_rings(dhd);
3509 dhd_prot_detach_hp2p_rings(dhd);
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);
3534 MFREE(dhd->osh, prot->tx_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;
3558 dhd_prot_reset(dhd_pub_t *dhd) argument
3560 struct dhd_prot *prot = dhd->prot;
3568 dhd_prot_flowrings_pool_reset(dhd);
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);
3579 dhd_prot_ring_reset(dhd, prot->h2dring_info_subn);
3583 dhd_prot_ring_reset(dhd, prot->d2hring_info_cpln);
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);
3615 OSL_ATOMIC_INIT(dhd->osh, &prot->active_tx_count);
3627 if (dhd->flow_rings_inited) {
3628 dhd_flow_rings_deinit(dhd);
3633 dhd_prot_ring_reset(dhd, prot->d2hring_hp2p_txcpl);
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);
3648 dhd->dma_stats.txdata = dhd->dma_stats.txdata_sz = 0;
3649 dhd->dma_stats.rxdata = dhd->dma_stats.rxdata_sz = 0;
3651 dhd->dma_stats.ioctl_rx = dhd->dma_stats.ioctl_rx_sz = 0;
3653 dhd->dma_stats.event_rx = dhd->dma_stats.event_rx_sz = 0;
3654 dhd->dma_stats.info_rx = dhd->dma_stats.info_rx_sz = 0;
3655 dhd->dma_stats.tsbuf_rx = dhd->dma_stats.tsbuf_rx_sz = 0;
3721 dhd_pub_t *dhd = (dhd_pub_t *)data; local
3722 dhd_prot_t *prot = dhd->prot;
3730 DHD_LB_STATS_TXC_PERCPU_CNT_INCR(dhd);
3750 DMA_UNMAP(dhd->osh, pa, pa_len, DMA_RX, 0, 0);
3752 dhd_txcomplete(dhd, pkt, true);
3754 dhd_eap_txcomplete(dhd, pkt, TRUE, txstatus->cmn_hdr.if_id);
3758 PKTFREE(dhd->osh, pkt, TRUE);
3764 DHD_LB_STATS_UPDATE_TXC_HISTO(dhd, count);
3789 dhd_pub_t *dhd = (dhd_pub_t *)data; local
3790 bcm_workq_t *workq = &dhd->prot->rx_compl_cons;
3792 DHD_LB_STATS_RXC_PERCPU_CNT_INCR(dhd);
3794 dhd_msgbuf_rxbuf_post(dhd, TRUE); /* re-use pktids */
3801 dhd_prot_rx_dataoffset(dhd_pub_t *dhd, uint32 rx_offset) argument
3803 dhd_prot_t *prot = dhd->prot;
3808 dhd_check_create_info_rings(dhd_pub_t *dhd) argument
3810 dhd_prot_t *prot = dhd->prot;
3818 ringid = dhd->bus->max_tx_flowrings +
3819 (dhd->bus->max_submission_rings - dhd->bus->max_tx_flowrings) +
3842 ret = dhd_prot_ring_attach(dhd, prot->h2dring_info_subn, "h2dinfo",
3867 ret = dhd_prot_ring_attach(dhd, prot->d2hring_info_cpln, "d2hinfo",
3873 dhd_prot_ring_detach(dhd, prot->h2dring_info_subn);
3891 dhd_prot_init_info_rings(dhd_pub_t *dhd) argument
3893 dhd_prot_t *prot = dhd->prot;
3896 if ((ret = dhd_check_create_info_rings(dhd)) != BCME_OK) {
3908 ret = dhd_send_d2h_ringcreate(dhd, prot->d2hring_info_cpln,
3922 ret = dhd_send_h2d_ringcreate(dhd, prot->h2dring_info_subn,
3932 dhd_prot_detach_info_rings(dhd_pub_t *dhd) argument
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;
3948 dhd_check_create_hp2p_rings(dhd_pub_t *dhd) argument
3950 dhd_prot_t *prot = dhd->prot;
3955 ringid = dhd->bus->max_submission_rings + dhd->bus->max_completion_rings - 2;
3967 ret = dhd_prot_ring_attach(dhd, prot->d2hring_hp2p_txcpl, "d2hhp2p_txcpl",
3968 dhd_bus_get_hp2p_ring_max_size(dhd->bus, TRUE), D2HRING_TXCMPLT_ITEMSIZE,
3994 ret = dhd_prot_ring_attach(dhd, prot->d2hring_hp2p_rxcpl, "d2hhp2p_rxcpl",
3995 dhd_bus_get_hp2p_ring_max_size(dhd->bus, FALSE), D2HRING_RXCMPLT_ITEMSIZE,
4019 dhd_prot_init_hp2p_rings(dhd_pub_t *dhd) argument
4021 dhd_prot_t *prot = dhd->prot;
4024 dhd->hp2p_ring_active = FALSE;
4026 if ((ret = dhd_check_create_hp2p_rings(dhd)) != BCME_OK) {
4039 ret = dhd_send_d2h_ringcreate(dhd, prot->d2hring_hp2p_txcpl,
4054 ret = dhd_send_d2h_ringcreate(dhd, prot->d2hring_hp2p_rxcpl,
4069 dhd_prot_detach_hp2p_rings(dhd_pub_t *dhd) argument
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;
4086 dhd_check_create_edl_rings(dhd_pub_t *dhd) argument
4088 dhd_prot_t *prot = dhd->prot;
4096 ringid = dhd->bus->max_tx_flowrings +
4097 (dhd->bus->max_submission_rings - dhd->bus->max_tx_flowrings) +
4117 ret = dhd_prot_ring_attach(dhd, prot->d2hring_edl, "d2hring_edl",
4136 dhd_prot_init_edl_rings(dhd_pub_t *dhd) argument
4138 dhd_prot_t *prot = dhd->prot;
4141 if ((ret = dhd_check_create_edl_rings(dhd)) != BCME_OK) {
4153 ret = dhd_send_d2h_ringcreate(dhd, prot->d2hring_edl,
4165 dhd_prot_detach_edl_rings(dhd_pub_t *dhd) argument
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;
4179 int dhd_sync_with_dongle(dhd_pub_t *dhd) argument
4184 dhd_prot_t *prot = dhd->prot;
4191 ret = dhd_msgbuf_rxbuf_post_ts_bufs(dhd);
4197 ret = dhd_wl_ioctl_cmd(dhd, WLC_GET_VAR, buf, sizeof(buf), FALSE, 0);
4202 memcpy(dhd->mac.octet, buf, ETHER_ADDR_LEN);
4210 dhd_get_memdump_info(dhd);
4213 dhd_get_assert_info(dhd);
4218 ret = dhd_wl_ioctl_cmd(dhd, WLC_GET_REVINFO, &revinfo, sizeof(revinfo), FALSE, 0);
4229 ret = dhd_wl_ioctl_cmd(dhd, WLC_GET_VAR, buf, sizeof(buf), FALSE, 0);
4246 dhd_msgbuf_rxbuf_post(dhd, FALSE); /* alloc pkt ids */
4248 DHD_SSSR_DUMP_INIT(dhd);
4250 dhd_process_cid_mac(dhd, TRUE);
4251 ret = dhd_preinit_ioctls(dhd);
4252 dhd_process_cid_mac(dhd, FALSE);
4256 if (FW_SUPPORTED(dhd, h2dlogts) || dhd->hp2p_capable) {
4257 if (dhd->hp2p_enable) {
4258 dhd->dhd_rte_time_sync_ms = DHD_H2D_LOG_TIME_STAMP_MATCH / 40;
4260 dhd->dhd_rte_time_sync_ms = DHD_H2D_LOG_TIME_STAMP_MATCH;
4263 if (FW_SUPPORTED(dhd, h2dlogts)) {
4264 dhd->dhd_rte_time_sync_ms = DHD_H2D_LOG_TIME_STAMP_MATCH;
4266 dhd->bus->dhd_rte_time_sync_count = OSL_SYSUPTIME_US();
4268 dhd_h2d_log_time_sync(dhd);
4270 dhd->dhd_rte_time_sync_ms = 0;
4274 dhd->iswl = TRUE;
4283 dhd_prot_print_metadata(dhd_pub_t *dhd, void *ptr, int len) argument
4373 dhd_prot_packet_free(dhd_pub_t *dhd, void *pkt, uint8 pkttype, bool send) argument
4381 PKTFREE_STATIC(dhd->osh, pkt, send);
4383 PKTFREE(dhd->osh, pkt, send);
4386 PKTFREE(dhd->osh, pkt, send);
4397 dhd_prot_packet_get(dhd_pub_t *dhd, uint32 pktid, uint8 pkttype, bool free_pktid) argument
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,
4419 if (SECURE_DMA_ENAB(dhd->osh))
4420 SECURE_DMA_UNMAP(dhd->osh, pa, (uint) len, DMA_RX, 0, dmah,
4423 DMA_UNMAP(dhd->osh, pa, (uint) len, DMA_RX, 0, dmah);
4428 dhd->dma_stats.ioctl_rx--;
4429 dhd->dma_stats.ioctl_rx_sz -= len;
4433 dhd->dma_stats.event_rx--;
4434 dhd->dma_stats.event_rx_sz -= len;
4437 dhd->dma_stats.info_rx--;
4438 dhd->dma_stats.info_rx_sz -= len;
4441 dhd->dma_stats.tsbuf_rx--;
4442 dhd->dma_stats.tsbuf_rx_sz -= len;
4454 dhd_prot_ioctl_ret_buffer_get(dhd_pub_t *dhd, uint32 pktid, dhd_dma_buf_t *retbuf) argument
4457 retbuf->va = DHD_PKTID_TO_NATIVE(dhd, dhd->prot->pktid_map_handle_ioctl, pktid,
4465 dhd_msgbuf_rxbuf_post(dhd_pub_t *dhd, bool use_rsv_pktid) argument
4467 dhd_prot_t *prot = dhd->prot;
4486 retcount = dhd_prot_rxbuf_post(dhd, fillbufs, use_rsv_pktid);
4492 DHD_LB_STATS_UPDATE_RXC_HISTO(dhd, retcount);
4505 dhd_prot_rxbuf_post(dhd_pub_t *dhd, uint16 count, bool use_rsv_pktid) argument
4516 dhd_prot_t *prot = dhd->prot;
4525 lcl_buf = MALLOC(dhd->osh, lcl_buf_size);
4535 if ((p = PKTGET(dhd->osh, pktsz, FALSE)) == NULL) {
4537 dhd->rx_pktgetfail++;
4541 pktlen[i] = PKTLEN(dhd->osh, p);
4542 if (SECURE_DMA_ENAB(dhd->osh)) {
4543 pa = SECURE_DMA_MAP(dhd->osh, PKTDATA(dhd->osh, p), pktlen[i],
4548 pa = DMA_MAP(dhd->osh, PKTDATA(dhd->osh, p), pktlen[i], DMA_RX, p, 0);
4552 PKTFREE(dhd->osh, p, FALSE);
4558 dhd->dma_stats.rxdata++;
4559 dhd->dma_stats.rxdata_sz += pktlen[i];
4562 PKTPULL(dhd->osh, p, prot->rx_metadata_offset);
4563 pktlen[i] = PKTLEN(dhd->osh, p);
4576 dhd_prot_alloc_ring_space(dhd, ring, count, &alloced, TRUE);
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,
4651 DHD_PKTID_AUDIT(dhd, prot->pktid_rx_map, pktid, DHD_DUPLICATE_ALLOC);
4660 PKTAUDIT(dhd->osh, p);
4681 dhd_prot_ring_write_complete(dhd, ring, msg_start, alloced);
4691 if (SECURE_DMA_ENAB(dhd->osh))
4692 SECURE_DMA_UNMAP(dhd->osh, pa, pktlen[i], DMA_RX, 0,
4695 DMA_UNMAP(dhd->osh, pa, pktlen[i], DMA_RX, 0, DHD_DMAH_NULL);
4696 PKTFREE(dhd->osh, p, FALSE);
4699 MFREE(dhd->osh, lcl_buf, lcl_buf_size);
4705 dhd_prot_infobufpost(dhd_pub_t *dhd, msgbuf_ring_t *ring) argument
4709 dhd_prot_t *prot = dhd->prot;
4726 if (ring == dhd->prot->h2dring_info_subn) {
4747 msg_start = (void *) dhd_prot_alloc_ring_space(dhd, ring, count, &alloced, FALSE);
4765 p = PKTGET_STATIC(dhd->osh, pktsz, FALSE);
4767 p = PKTGET(dhd->osh, pktsz, FALSE);
4771 dhd->rx_pktgetfail++;
4774 pktlen = PKTLEN(dhd->osh, p);
4775 if (SECURE_DMA_ENAB(dhd->osh)) {
4776 pa = SECURE_DMA_MAP(dhd->osh, PKTDATA(dhd->osh, p), pktlen,
4781 pa = DMA_MAP(dhd->osh, PKTDATA(dhd->osh, p), pktlen, DMA_RX, p, 0);
4784 if (SECURE_DMA_ENAB(dhd->osh)) {
4785 SECURE_DMA_UNMAP(dhd->osh, pa, pktlen, DMA_RX, 0, DHD_DMAH_NULL,
4789 DMA_UNMAP(dhd->osh, pa, pktlen, DMA_RX, 0, DHD_DMAH_NULL);
4791 PKTFREE_STATIC(dhd->osh, p, FALSE);
4793 PKTFREE(dhd->osh, p, FALSE);
4800 dhd->dma_stats.info_rx++;
4801 dhd->dma_stats.info_rx_sz += pktlen;
4803 pktlen = PKTLEN(dhd->osh, p);
4812 pktid = DHD_NATIVE_TO_PKTID(dhd, dhd->prot->pktid_ctrl_map, p, pa,
4817 if (SECURE_DMA_ENAB(dhd->osh)) {
4818 SECURE_DMA_UNMAP(dhd->osh, pa, pktlen, DMA_RX, 0, 0,
4821 DMA_UNMAP(dhd->osh, pa, pktlen, DMA_RX, 0, 0);
4824 PKTFREE_STATIC(dhd->osh, p, FALSE);
4826 PKTFREE(dhd->osh, p, FALSE);
4838 DHD_PKTID_AUDIT(dhd, prot->pktid_ctrl_map, pktid, DHD_DUPLICATE_ALLOC);
4849 PKTAUDIT(dhd->osh, p);
4869 if (ring == dhd->prot->h2dring_info_subn) {
4872 dhd_prot_ring_write_complete(dhd, ring, msg_start, alloced);
4882 alloc_ioctl_return_buffer(dhd_pub_t *dhd, dhd_dma_buf_t *retbuf) argument
4887 if ((err = dhd_dma_buf_alloc(dhd, retbuf, IOCT_RETBUF_SIZE)) != BCME_OK) {
4897 free_ioctl_return_buffer(dhd_pub_t *dhd, dhd_dma_buf_t *retbuf) argument
4907 dhd_dma_buf_free(dhd, retbuf);
4913 dhd_prot_rxbufpost_ctrl(dhd_pub_t *dhd, uint8 msg_type) argument
4920 dhd_prot_t *prot = dhd->prot;
4931 if (dhd->busstate == DHD_BUS_DOWN) {
4963 if (alloc_ioctl_return_buffer(dhd, &retbuf) != BCME_OK) {
4976 p = PKTGET_STATIC(dhd->osh, pktsz, FALSE);
4978 p = PKTGET(dhd->osh, pktsz, FALSE);
4984 dhd->rx_pktgetfail++;
4988 pktlen = PKTLEN(dhd->osh, p);
4990 if (SECURE_DMA_ENAB(dhd->osh)) {
4991 pa = SECURE_DMA_MAP(dhd->osh, PKTDATA(dhd->osh, p), pktlen,
4996 pa = DMA_MAP(dhd->osh, PKTDATA(dhd->osh, p), pktlen, DMA_RX, p, 0);
5009 dhd->dma_stats.ioctl_rx++;
5010 dhd->dma_stats.ioctl_rx_sz += pktlen;
5014 dhd->dma_stats.event_rx++;
5015 dhd->dma_stats.event_rx_sz += pktlen;
5018 dhd->dma_stats.tsbuf_rx++;
5019 dhd->dma_stats.tsbuf_rx_sz += pktlen;
5032 dhd_prot_alloc_ring_space(dhd, ring, 1, &alloced, FALSE);
5043 if (SECURE_DMA_ENAB(dhd->osh)) {
5044 SECURE_DMA_UNMAP(dhd->osh, pa, pktlen, DMA_RX, 0, DHD_DMAH_NULL,
5047 DMA_UNMAP(dhd->osh, pa, pktlen, DMA_RX, 0, DHD_DMAH_NULL);
5058 map_handle = dhd->prot->pktid_map_handle_ioctl;
5059 pktid = DHD_NATIVE_TO_PKTID(dhd, map_handle, p, pa, pktlen, DMA_RX, dmah,
5064 map_handle = dhd->prot->pktid_ctrl_map;
5065 pktid = DHD_NATIVE_TO_PKTID(dhd, map_handle,
5081 DMA_UNMAP(dhd->osh, pa, pktlen, DMA_RX, 0, DHD_DMAH_NULL);
5087 DHD_PKTID_AUDIT(dhd, map_handle, pktid, DHD_DUPLICATE_ALLOC);
5111 if (SECURE_DMA_ENAB(dhd->osh)) {
5112 SECURE_DMA_UNMAP(dhd->osh, pa, pktlen, DMA_RX, 0, DHD_DMAH_NULL,
5115 DMA_UNMAP(dhd->osh, pa, pktlen, DMA_RX, 0, DHD_DMAH_NULL);
5122 rxbuf_post->host_buf_len = htol16((uint16)PKTLEN(dhd->osh, p));
5131 PKTAUDIT(dhd->osh, p);
5135 dhd_prot_ring_write_complete(dhd, ring, rxbuf_post, 1);
5144 free_ioctl_return_buffer(dhd, &retbuf);
5146 dhd_prot_packet_free(dhd, p, buf_type, FALSE);
5149 dhd_prot_packet_free(dhd, p, buf_type, FALSE);
5156 dhd_msgbuf_rxbuf_post_ctrlpath(dhd_pub_t *dhd, uint8 msg_type, uint32 max_to_post) argument
5163 if (dhd->busstate == DHD_BUS_DOWN) {
5169 ret_val = dhd_prot_rxbufpost_ctrl(dhd, msg_type);
5179 dhd_msgbuf_rxbuf_post_ioctlresp_bufs(dhd_pub_t *dhd) argument
5181 dhd_prot_t *prot = dhd->prot;
5191 prot->cur_ioctlresp_bufs_posted += dhd_msgbuf_rxbuf_post_ctrlpath(dhd,
5196 dhd_msgbuf_rxbuf_post_event_bufs(dhd_pub_t *dhd) argument
5198 dhd_prot_t *prot = dhd->prot;
5207 prot->cur_event_bufs_posted += dhd_msgbuf_rxbuf_post_ctrlpath(dhd,
5212 dhd_msgbuf_rxbuf_post_ts_bufs(dhd_pub_t *dhd) argument
5218 dhd_prot_process_msgbuf_infocpl(dhd_pub_t *dhd, uint bound) argument
5220 dhd_prot_t *prot = dhd->prot;
5232 while (!dhd_is_device_removed(dhd)) {
5236 if (dhd_query_bus_erros(dhd)) {
5241 if (dhd->hang_was_sent) {
5246 if (dhd->smmu_fault_occurred) {
5253 msg_addr = dhd_prot_get_read_addr(dhd, ring, &msg_len);
5263 if (dhd_prot_process_msgtype(dhd, ring, msg_addr, msg_len) != BCME_OK) {
5269 dhd_prot_upd_read_idx(dhd, ring);
5283 dhd_prot_process_msgbuf_edl(dhd_pub_t *dhd) argument
5285 dhd_prot_t *prot = dhd->prot;
5302 if (dhd_query_bus_erros(dhd)) {
5306 if (dhd->hang_was_sent) {
5316 if (dhd->dma_d2h_ring_upd_support) {
5318 ring->wr = dhd_prot_dma_indx_get(dhd, D2H_DMA_INDX_WR_UPD, ring->idx);
5320 dhd_bus_cmn_readshared(dhd->bus, &ring->wr, RING_WR_UPD, ring->idx);
5339 dhd->busstate, dhd->bus->wait_for_d3_ack));
5343 dhd->bus->read_shm_fail = TRUE;
5347 if (dhd->memdump_enabled) {
5349 dhd->memdump_type = DUMP_TYPE_RESUMED_ON_INVALID_RING_RDWR;
5350 dhd_bus_mem_dump(dhd);
5355 dhd_schedule_reset(dhd);
5366 dhd_schedule_logtrace(dhd->info);
5375 dhd_prot_process_edl_complete(dhd_pub_t *dhd, void *evt_decode_data) argument
5388 if (!dhd || !dhd->prot)
5391 prot = dhd->prot;
5397 if (dhd->hang_was_sent) {
5439 if ((err = prot->d2h_edl_sync_cb(dhd, ring, msg)) != BCME_OK) {
5461 err = dhd_event_logtrace_process_edl(dhd, msg_addr, evt_decode_data);
5486 DHD_GENERAL_LOCK(dhd, flags);
5487 if (DHD_BUS_CHECK_SUSPEND_OR_ANY_SUSPEND_IN_PROGRESS(dhd)) {
5489 __FUNCTION__, dhd->busstate, dhd->dhd_bus_busy_state));
5490 DHD_GENERAL_UNLOCK(dhd, flags);
5492 DHD_GENERAL_UNLOCK(dhd, flags);
5493 DHD_EDL_RING_TCM_RD_UPDATE(dhd);
5535 dhd_prot_edl_ring_tcm_rd_update(dhd_pub_t *dhd) argument
5541 if (!dhd)
5544 prot = dhd->prot;
5550 dhd_prot_upd_read_idx(dhd, ring);
5557 dhd_prot_process_msgbuf_rxcpl(dhd_pub_t *dhd, uint bound, int ringtype) argument
5561 dhd_prot_t *prot = dhd->prot;
5589 if (dhd_is_device_removed(dhd))
5592 if (dhd_query_bus_erros(dhd))
5595 if (dhd->hang_was_sent)
5598 if (dhd->smmu_fault_occurred) {
5609 msg_addr = dhd_prot_get_read_addr(dhd, ring, &msg_len);
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,
5653 if (SECURE_DMA_ENAB(dhd->osh))
5654 SECURE_DMA_UNMAP(dhd->osh, pa, (uint) len, DMA_RX, 0,
5657 DMA_UNMAP(dhd->osh, pa, (uint) len, DMA_RX, 0, dmah);
5660 dhd->dma_stats.rxdata--;
5661 dhd->dma_stats.rxdata_sz -= len;
5668 msg->cmn_hdr.flags, PKTDATA(dhd->osh, pkt),
5679 ptr = PKTDATA(dhd->osh, pkt) - (prot->rx_metadata_offset);
5682 dhd_prot_print_metadata(dhd, ptr, msg->metadata_len);
5689 PKTPULL(dhd->osh, pkt, ltoh16(msg->data_offset));
5693 PKTPULL(dhd->osh, pkt, prot->rx_dataoffset);
5696 PKTSETLEN(dhd->osh, pkt, ltoh16(msg->data_len));
5699 if (dhd_monitor_enabled(dhd, ifidx)) {
5701 dhd_rx_mon_pkt(dhd, msg, pkt, ifidx);
5725 PKTSETNEXT(dhd->osh, prevpkt, pkt);
5731 if (dhd->hp2p_capable && ring == prot->d2hring_hp2p_rxcpl) {
5735 dhd_update_hp2p_rxstats(dhd, msg);
5740 PKTAUDIT(dhd->osh, pkt);
5753 dhd_prot_upd_read_idx(dhd, ring);
5759 nextpkt = PKTNEXT(dhd->osh, pkt);
5760 PKTSETNEXT(dhd->osh, pkt, NULL);
5762 dhd_lb_rx_pkt_enqueue(dhd, pkt, ifidx);
5764 dhd_rxchain_frame(dhd, pkt, ifidx);
5766 dhd_bus_rx_frame(dhd->bus, pkt, ifidx, 1);
5772 dhd_lb_rx_pkt_enqueue(dhd, pkt_newidx, if_newidx);
5774 dhd_rxchain_frame(dhd, pkt_newidx, if_newidx);
5776 dhd_bus_rx_frame(dhd->bus, pkt_newidx, if_newidx, 1);
5783 dhd_prot_return_rxbuf(dhd, 0, pkt_cnt);
5786 dhd_rxchain_commit(dhd);
5800 !(dhd_monitor_enabled(dhd, ifidx)) &&
5803 DHD_LB_DISPATCH_RX_COMPL(dhd);
5804 DHD_LB_DISPATCH_RX_PROCESS(dhd);
5815 dhd_prot_update_txflowring(dhd_pub_t *dhd, uint16 flowid, void *msgring) argument
5824 if (dhd->dma_d2h_ring_upd_support) {
5825 ring->rd = dhd_prot_dma_indx_get(dhd, H2D_DMA_INDX_RD_UPD, ring->idx);
5832 dhd_bus_schedule_queue(dhd->bus, flowid, TRUE); /* from queue to flowring */
5837 dhd_prot_process_msgbuf_txcpl(dhd_pub_t *dhd, uint bound, int ringtype) argument
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;
5852 while (!dhd_is_device_removed(dhd)) {
5856 if (dhd_query_bus_erros(dhd)) {
5861 if (dhd->hang_was_sent) {
5866 if (dhd->smmu_fault_occurred) {
5873 msg_addr = dhd_prot_get_read_addr(dhd, ring, &msg_len);
5884 if (dhd_prot_process_msgtype(dhd, ring, msg_addr, msg_len) != BCME_OK) {
5890 dhd_prot_upd_read_idx(dhd, ring);
5899 DHD_LB_DISPATCH_TX_COMPL(dhd);
5905 dhd_prot_process_trapbuf(dhd_pub_t *dhd) argument
5908 dhd_dma_buf_t *trap_addr = &dhd->prot->fw_trap_buf;
5926 if (dhd->extended_trap_data) {
5929 memcpy(dhd->extended_trap_data, (uint32 *)trap_addr->va,
5941 dhd_prot_process_ctrlbuf(dhd_pub_t *dhd) argument
5943 dhd_prot_t *prot = dhd->prot;
5948 while (!dhd_is_device_removed(dhd)) {
5952 if (dhd_query_bus_erros(dhd)) {
5956 if (dhd->hang_was_sent) {
5960 if (dhd->smmu_fault_occurred) {
5966 msg_addr = dhd_prot_get_read_addr(dhd, ring, &msg_len);
5975 if (dhd_prot_process_msgtype(dhd, ring, msg_addr, msg_len) != BCME_OK) {
5981 dhd_prot_upd_read_idx(dhd, ring);
5993 dhd_prot_process_msgtype(dhd_pub_t *dhd, msgbuf_ring_t *ring, uint8 *buf, uint32 len) argument
6010 if (dhd->hang_was_sent) {
6015 if (dhd->smmu_fault_occurred) {
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);
6065 dhd_prot_process_infobuf_complete(dhd, buf);
6069 table_lookup[msg_type](dhd, buf);
6083 dhd_rxchain_commit(dhd);
6090 dhd_prot_noop(dhd_pub_t *dhd, void *msg) argument
6097 dhd_prot_ringstatus_process(dhd_pub_t *dhd, void *msg) argument
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;
6175 dhd_prot_genstatus_process(dhd_pub_t *dhd, void *msg) argument
6191 dhd_prot_ioctack_process(dhd_pub_t *dhd, void *msg) argument
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();
6214 DHD_GENERAL_LOCK(dhd, flags);
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));
6224 DHD_GENERAL_UNLOCK(dhd, flags);
6236 dhd_prot_ioctcmplt_process(dhd_pub_t *dhd, void *msg) argument
6238 dhd_prot_t *prot = dhd->prot;
6249 if (dhd->dhd_induce_error == DHD_INDUCE_IOCTL_TIMEOUT) {
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,
6268 DHD_GENERAL_LOCK(dhd, flags);
6272 __FUNCTION__, dhd->prot->ioctl_state, dhd->prot->ioctl_trans_id));
6275 DHD_GENERAL_UNLOCK(dhd, flags);
6279 dhd->prot->ioctl_cmplt_time = OSL_LOCALTIME_NS();
6283 DHD_GENERAL_UNLOCK(dhd, flags);
6286 pkt = dhd_prot_packet_get(dhd, pkt_id, PKTTYPE_IOCTL_RX, TRUE);
6288 dhd_prot_ioctl_ret_buffer_get(dhd, pkt_id, &retbuf);
6306 dhd_wakeup_ioctl_event(dhd, IOCTL_RETURN_ON_ERROR);
6307 dhd_prot_debug_info_print(dhd);
6309 if (dhd->memdump_enabled) {
6311 dhd->memdump_type = DUMP_TYPE_TRANS_ID_MISMATCH;
6312 dhd_bus_mem_dump(dhd);
6317 dhd_schedule_reset(dhd);
6325 bcopy(PKTDATA(dhd->osh, pkt), prot->retbuf.va, prot->ioctl_resplen);
6332 dhd_wakeup_ioctl_event(dhd, IOCTL_RETURN_ON_SUCCESS);
6336 dhd_prot_packet_free(dhd, pkt,
6339 free_ioctl_return_buffer(dhd, &retbuf);
6347 dhd_msgbuf_rxbuf_post_ioctlresp_bufs(dhd);
6351 dhd_prot_check_tx_resource(dhd_pub_t *dhd) argument
6353 return dhd->prot->no_tx_resource;
6357 dhd_prot_update_pktid_txq_stop_cnt(dhd_pub_t *dhd) argument
6359 dhd->prot->pktid_txq_stop_cnt++;
6363 dhd_prot_update_pktid_txq_start_cnt(dhd_pub_t *dhd) argument
6365 dhd->prot->pktid_txq_start_cnt++;
6370 dhd_prot_txstatus_process(dhd_pub_t *dhd, void *msg) argument
6372 dhd_prot_t *prot = dhd->prot;
6382 msgbuf_ring_t *ring = &dhd->prot->d2hring_tx_cpln;
6397 flow_ring_node = DHD_FLOW_RING(dhd, flowid);
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,
6423 if (dhd->memdump_enabled) {
6425 dhd->memdump_type = DUMP_TYPE_PKTID_INVALID;
6426 dhd_bus_mem_dump(dhd);
6434 if (DHD_PKTID_AVAIL(dhd->prot->pktid_tx_map) == DHD_PKTID_MIN_AVAIL_COUNT) {
6435 dhd->prot->no_tx_resource = FALSE;
6436 dhd_bus_start_queue(dhd->bus);
6439 if (SECURE_DMA_ENAB(dhd->osh)) {
6443 if (dhd->prot->tx_metadata_offset)
6444 offset = dhd->prot->tx_metadata_offset + ETHER_HDR_LEN;
6445 SECURE_DMA_UNMAP(dhd->osh, (uint) pa,
6446 (uint) dhd->prot->tx_metadata_offset, DMA_RX, 0, dmah,
6449 DMA_UNMAP(dhd->osh, pa, (uint) len, DMA_RX, 0, dmah);
6506 dhd->dma_stats.txdata--;
6507 dhd->dma_stats.txdata_sz -= len;
6509 pkt_fate = dhd_dbg_process_tx_status(dhd, pkt, pktid,
6512 if (dhd->d11_tx_status) {
6516 DHD_PKTLOG_TXS(dhd, pkt, pktid, status);
6517 dhd_dump_pkt(dhd, ltoh32(txstatus->cmn_hdr.if_id),
6518 (uint8 *)PKTDATA(dhd->osh, pkt), len, TRUE,
6524 dhd_txcomplete(dhd, pkt, pkt_fate);
6526 dhd_eap_txcomplete(dhd, pkt, pkt_fate, txstatus->cmn_hdr.if_id);
6531 if (dhd->prot->metadata_dbg &&
6532 dhd->prot->tx_metadata_offset && txstatus->metadata_len) {
6537 PKTPULL(dhd->osh, pkt, ETHER_HDR_LEN);
6538 ptr = PKTDATA(dhd->osh, pkt) - (dhd->prot->tx_metadata_offset);
6540 dhd_prot_print_metadata(dhd, ptr, txstatus->metadata_len);
6545 if (dhd->hp2p_capable && flow_ring_node->flow_info.tid == HP2P_PRIO) {
6549 dhd_update_hp2p_txstats(dhd, txstatus);
6554 PKTAUDIT(dhd->osh, pkt);
6557 DHD_FLOWRING_TXSTATUS_CNT_UPDATE(dhd->bus, txstatus->compl_hdr.flow_ring_id,
6560 PKTFREE(dhd->osh, pkt, TRUE);
6566 dhd_prot_event_process(dhd_pub_t *dhd, void *msg) argument
6573 dhd_prot_t *prot = dhd->prot;
6580 DHD_PKTID_AUDIT_RING_DEBUG(dhd, dhd->prot->pktid_ctrl_map, bufid,
6591 dhd_msgbuf_rxbuf_post_event_bufs(dhd);
6593 pkt = dhd_prot_packet_get(dhd, bufid, PKTTYPE_EVENT_RX, TRUE);
6601 if (dhd->prot->rx_dataoffset)
6602 PKTPULL(dhd->osh, pkt, dhd->prot->rx_dataoffset);
6604 PKTSETLEN(dhd->osh, pkt, buflen);
6606 PKTAUDIT(dhd->osh, pkt);
6608 dhd_bus_rx_frame(dhd->bus, pkt, ifidx, 1);
6613 dhd_prot_process_infobuf_complete(dhd_pub_t *dhd, void* buf) argument
6625 DHD_PKTID_AUDIT_RING_DEBUG(dhd, dhd->prot->pktid_ctrl_map, pktid,
6631 dhd->prot->rx_dataoffset));
6633 if (dhd->debug_buf_dest_support) {
6635 dhd->debug_buf_dest_stat[resp->dest]++;
6639 pkt = dhd_prot_packet_get(dhd, pktid, PKTTYPE_INFO_RX, TRUE);
6644 if (dhd->prot->rx_dataoffset)
6645 PKTPULL(dhd->osh, pkt, dhd->prot->rx_dataoffset);
6647 PKTSETLEN(dhd->osh, pkt, buflen);
6650 PKTAUDIT(dhd->osh, pkt);
6657 dhd_bus_rx_frame(dhd->bus, pkt, DHD_DUMMY_INFO_IF /* ifidx HACK */, 1);
6662 dhd_prot_process_snapshot_complete(dhd_pub_t *dhd, void *buf) argument
6667 void dhd_prot_stop(dhd_pub_t *dhd) argument
6669 ASSERT(dhd);
6678 dhd_prot_hdrpush(dhd_pub_t *dhd, int ifidx, void *PKTBUF) argument
6684 dhd_prot_hdrlen(dhd_pub_t *dhd, void *PKTBUF) argument
6698 dhd_prot_txdata(dhd_pub_t *dhd, void *PKTBUF, uint8 ifidx) argument
6701 dhd_prot_t *prot = dhd->prot;
6718 if (dhd->flow_ring_table == NULL) {
6723 if (!DHD_PKTID_AVAIL(dhd->prot->pktid_tx_map)) {
6724 if (dhd->prot->pktid_depleted_cnt == DHD_PKTID_DEPLETED_MAX_COUNT) {
6725 dhd_bus_stop_queue(dhd->bus);
6726 dhd->prot->no_tx_resource = TRUE;
6728 dhd->prot->pktid_depleted_cnt++;
6731 dhd->prot->pktid_depleted_cnt = 0;
6736 flow_ring_table = (flow_ring_table_t *)dhd->flow_ring_table;
6744 pktid = DHD_NATIVE_TO_PKTID_RSV(dhd, dhd->prot->pktid_tx_map,
6761 dhd_prot_alloc_ring_space(dhd, ring, 1, &alloced, FALSE);
6764 __FUNCTION__, __LINE__, OSL_ATOMIC_READ(dhd->osh, &prot->active_tx_count)));
6769 pktdata = PKTDATA(dhd->osh, PKTBUF);
6770 pktlen = PKTLEN(dhd->osh, PKTBUF);
6772 DHD_DBG_PKT_MON_TX(dhd, PKTBUF, pktid);
6774 DHD_PKTLOG_TX(dhd, PKTBUF, pktid);
6777 dhd_dump_pkt(dhd, ifidx, pktdata, pktlen, TRUE, &pkthash, NULL);
6784 pktdata = PKTPULL(dhd->osh, PKTBUF, ETHER_HDR_LEN);
6788 if (SECURE_DMA_ENAB(dhd->osh)) {
6795 pa = SECURE_DMA_MAP(dhd->osh, PKTDATA(dhd->osh, PKTBUF), pktlen,
6800 pa = DMA_MAP(dhd->osh, PKTDATA(dhd->osh, PKTBUF), pktlen, DMA_TX, PKTBUF, 0);
6811 dhd->dma_stats.txdata++;
6812 dhd->dma_stats.txdata_sz += pktlen;
6815 DHD_NATIVE_TO_PKTID_SAVE(dhd, dhd->prot->pktid_tx_map, PKTBUF, pktid,
6842 PKTPUSH(dhd->osh, PKTBUF, ETHER_HDR_LEN);
6845 headroom = (uint16)PKTHEADROOM(dhd->osh, PKTBUF);
6854 PKTPUSH(dhd->osh, PKTBUF, prot->tx_metadata_offset);
6856 if (SECURE_DMA_ENAB(dhd->osh)) {
6857 meta_pa = SECURE_DMA_MAP_TXMETA(dhd->osh, PKTDATA(dhd->osh, PKTBUF),
6863 meta_pa = DMA_MAP(dhd->osh, PKTDATA(dhd->osh, PKTBUF),
6869 if (SECURE_DMA_ENAB(dhd->osh)) {
6877 SECURE_DMA_UNMAP(dhd->osh, pa, pktlen,
6882 DMA_UNMAP(dhd->osh, pa, pktlen, DMA_TX, 0, DHD_DMAH_NULL);
6897 PKTPULL(dhd->osh, PKTBUF, prot->tx_metadata_offset);
6904 if (dhd->hp2p_capable && flow_ring_node->flow_info.tid == HP2P_PRIO) {
6905 dhd_update_hp2p_txdesc(dhd, txdesc);
6917 DHD_PKTID_AUDIT(dhd, prot->pktid_tx_map, pktid, DHD_DUPLICATE_ALLOC);
6926 PKTAUDIT(dhd->osh, PKTBUF);
6938 if (dhd->hp2p_capable && flow_ring_node->flow_info.tid == HP2P_PRIO) {
6939 dhd_calc_hp2p_burst(dhd, ring, flowid);
6943 dhd_prot_txdata_write_flush(dhd, flowid);
6951 dhd_prot_txdata_write_flush(dhd, flowid);
6955 dhd_prot_ring_write_complete(dhd, ring, txdesc, 1);
6963 OSL_ATOMIC_INC(dhd->osh, &prot->active_tx_count);
6968 DHD_TXFL_WAKE_LOCK_TIMEOUT(dhd, MAX_TX_TIMEOUT);
6996 DHD_PKTID_TO_NATIVE(dhd, dhd->prot->pktid_tx_map, pktid,
7011 dhd_prot_txdata_write_flush(dhd_pub_t *dhd, uint16 flowid) argument
7018 if (dhd->flow_ring_table == NULL) {
7022 flow_ring_table = (flow_ring_table_t *)dhd->flow_ring_table;
7028 dhd_prot_ring_write_complete(dhd, ring, ring->start_addr,
7039 dhd_prot_hdrpull(dhd_pub_t *dhd, int *ifidx, void *pkt, uchar *buf, uint *len) argument
7046 dhd_prot_return_rxbuf(dhd_pub_t *dhd, uint32 pktid, uint32 rxcnt) argument
7048 dhd_prot_t *prot = dhd->prot;
7089 dhd_msgbuf_rxbuf_post(dhd, FALSE); /* alloc pkt ids */
7096 dhd_prot_wlioctl_intercept(dhd_pub_t *dhd, wl_ioctl_t * ioc, void * buf) argument
7098 dhd_prot_t *prot = dhd->prot;
7115 dhd_prot_wl_ioctl_ret_intercept(dhd_pub_t *dhd, wl_ioctl_t * ioc, void * buf, argument
7127 dhd->wme_dp = (uint8) ltoh32(val);
7139 int dhd_prot_ioctl(dhd_pub_t *dhd, int ifidx, wl_ioctl_t * ioc, void * buf, int len) argument
7144 if (dhd->bus->is_linkdown) {
7149 if (dhd_query_bus_erros(dhd)) {
7154 if ((dhd->busstate == DHD_BUS_DOWN) || dhd->hang_was_sent) {
7157 dhd->busstate, dhd->hang_was_sent));
7161 if (dhd->busstate == DHD_BUS_SUSPEND) {
7186 dhd_prot_wlioctl_intercept(dhd, ioc, buf);
7189 ret = dhd_msgbuf_set_ioctl(dhd, ifidx, ioc->cmd, buf, len, action);
7191 ret = dhd_msgbuf_query_ioctl(dhd, ifidx, ioc->cmd, buf, len, action);
7201 dhd->dongle_error = ret;
7204 dhd_prot_wl_ioctl_ret_intercept(dhd, ioc, buf, ifidx, ret, len);
7214 dhdmsgbuf_lpbk_req(dhd_pub_t *dhd, uint len) argument
7217 dhd_prot_t *prot = dhd->prot;
7232 dhd_prot_alloc_ring_space(dhd, ring, 1, &alloced, FALSE);
7260 dhd_prot_ring_write_complete(dhd, ring, ioct_rqst, 1);
7268 void dmaxfer_free_dmaaddr(dhd_pub_t *dhd, dhd_dmaxfer_t *dmaxfer) argument
7273 dhd_dma_buf_free(dhd, &dmaxfer->srcmem);
7274 dhd_dma_buf_free(dhd, &dmaxfer->dstmem);
7322 int dmaxfer_prepare_dmaaddr(dhd_pub_t *dhd, uint len, argument
7330 dmaxfer_free_dmaaddr(dhd, dmaxfer);
7332 if (dhd_dma_buf_alloc(dhd, &dmaxfer->srcmem, len)) {
7336 if (dhd_dma_buf_alloc(dhd, &dmaxfer->dstmem, len + 8)) {
7337 dhd_dma_buf_free(dhd, &dmaxfer->srcmem);
7370 dhd_msgbuf_dmaxfer_process(dhd_pub_t *dhd, void *msg) argument
7372 dhd_prot_t *prot = dhd->prot;
7434 buf_free_scheduled = dhd_prepare_schedule_dmaxfer_free(dhd);
7442 dhd->prot->dmaxfer.in_progress = FALSE;
7445 dhd->bus->dmaxfer_complete = TRUE;
7446 dhd_os_dmaxfer_wake(dhd);
7456 dhdmsgbuf_dmaxfer_req(dhd_pub_t *dhd, uint len, uint srcdelay, uint destdelay, argument
7461 dhd_prot_t *prot = dhd->prot;
7481 if ((ret = dmaxfer_prepare_dmaaddr(dhd, xferlen, srcdelay, destdelay,
7489 dhd_prot_alloc_ring_space(dhd, ring, 1, &alloced, FALSE);
7492 dmaxfer_free_dmaaddr(dhd, &prot->dmaxfer);
7520 dhd_prot_ring_write_complete(dhd, ring, dmap, 1);
7530 dhdmsgbuf_dmaxfer_status(dhd_pub_t *dhd, dma_xfer_info_t *result) argument
7532 dhd_prot_t *prot = dhd->prot;
7557 dhd_msgbuf_query_ioctl(dhd_pub_t *dhd, int ifidx, uint cmd, void *buf, uint len, uint8 action) argument
7564 if (dhd->bus->is_linkdown) {
7570 if (dhd->busstate == DHD_BUS_DOWN) {
7576 if (dhd->hang_was_sent) {
7595 strncpy((char *)buf, bcmerrorstr(dhd->dongle_error), copylen);
7600 *(uint32 *)(uint32 *)buf = dhd->dongle_error;
7608 ret = dhd_fillup_ioct_reqst(dhd, (uint16)len, cmd, buf, ifidx);
7616 ret = dhd_msgbuf_wait_ioctl_cmplt(dhd, len, buf);
7623 dhd_msgbuf_iovar_timeout_dump(dhd_pub_t *dhd) argument
7626 dhd_prot_t *prot = dhd->prot;
7627 dhd->rxcnt_timeout++;
7628 dhd->rx_ctlerrs++;
7629 dhd->iovar_timeout_occured = TRUE;
7632 dhd->is_sched_error ? " due to scheduling problem" : "",
7633 dhd->rxcnt_timeout, prot->curr_ioctl_cmd, prot->ioctl_trans_id,
7634 prot->ioctl_state, dhd->busstate, prot->ioctl_received));
7636 if (dhd->is_sched_error && dhd->memdump_enabled == DUMP_MEMFILE_BUGON) {
7667 intstatus = si_corereg(dhd->bus->sih,
7668 dhd->bus->sih->buscoreidx, dhd->bus->pcie_mailbox_int, 0, 0);
7671 dhd->bus->is_linkdown = TRUE;
7674 dhd_bus_dump_console_buffer(dhd->bus);
7675 dhd_prot_debug_info_print(dhd);
7683 dhd_msgbuf_wait_ioctl_cmplt(dhd_pub_t *dhd, uint32 len, void *buf) argument
7685 dhd_prot_t *prot = dhd->prot;
7692 if (dhd_query_bus_erros(dhd)) {
7697 timeleft = dhd_os_ioctl_resp_wait(dhd, (uint *)&prot->ioctl_received);
7701 uint32 intstatus = si_corereg(dhd->bus->sih,
7702 dhd->bus->sih->buscoreidx, dhd->bus->pcie_mailbox_int, 0, 0);
7703 int host_irq_disbled = dhdpcie_irq_disabled(dhd->bus);
7705 (timeleft == 0) && (!dhd_query_bus_erros(dhd))) {
7709 dhd_pcie_intr_count_dump(dhd);
7710 dhd_print_tasklet_status(dhd);
7711 dhd_prot_process_ctrlbuf(dhd);
7712 timeleft = dhd_os_ioctl_resp_wait(dhd, (uint *)&prot->ioctl_received);
7714 dhdpcie_bus_clear_intstatus(dhd->bus);
7719 if (timeleft == 0 && (!dhd_query_bus_erros(dhd))) {
7721 dhd->is_sched_error = FALSE;
7722 if (dhd->bus->isr_entry_time > prot->ioctl_fillup_time) {
7723 dhd->is_sched_error = dhd_bus_query_dpc_sched_errors(dhd);
7726 dhd_msgbuf_iovar_timeout_dump(dhd);
7730 if (dhd->memdump_enabled) {
7732 dhd->memdump_type = DUMP_TYPE_RESUMED_ON_TIMEOUT;
7733 dhd_bus_mem_dump(dhd);
7739 dhd->bus->no_cfg_restore = 1;
7751 dhd->rxcnt_timeout = 0;
7752 dhd->rx_ctlpkts++;
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);
7765 DHD_GENERAL_LOCK(dhd, flags);
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;
7770 DHD_GENERAL_UNLOCK(dhd, flags);
7776 dhd_msgbuf_set_ioctl(dhd_pub_t *dhd, int ifidx, uint cmd, void *buf, uint len, uint8 action) argument
7782 if (dhd->bus->is_linkdown) {
7788 if (dhd->busstate == DHD_BUS_DOWN) {
7794 if (dhd->hang_was_sent) {
7804 ret = dhd_fillup_ioct_reqst(dhd, (uint16)len, cmd, buf, ifidx);
7811 ret = dhd_msgbuf_wait_ioctl_cmplt(dhd, len, buf);
7818 int dhd_prot_ctl_complete(dhd_pub_t *dhd) argument
7824 int dhd_prot_iovar_op(dhd_pub_t *dhd, const char *name, argument
7831 int dhd_d2h_h2d_ring_dump(dhd_pub_t *dhd, void *file, const void *user_buf, argument
7840 if (!(dhd) || !(dhd->prot)) {
7843 prot = dhd->prot;
7847 if ((ret = dhd_ring_write(dhd, ring, file, user_buf, file_posn)) < 0)
7851 if ((ret = dhd_ring_write(dhd, ring, file, user_buf, file_posn)) < 0)
7855 if ((ret = dhd_ring_write(dhd, ring, file, user_buf, file_posn)) < 0)
7859 if ((ret = dhd_ring_write(dhd, ring, file, user_buf, file_posn)) < 0)
7863 if ((ret = dhd_ring_write(dhd, ring, file, user_buf, file_posn)) < 0)
7866 h2d_flowrings_total = dhd_get_max_flow_rings(dhd);
7868 if ((ret = dhd_ring_write(dhd, ring, file, user_buf, file_posn)) < 0) {
7874 if (dhd->dongle_edl_support) {
7876 if ((ret = dhd_edl_ring_hdr_write(dhd, ring, file, user_buf, file_posn)) < 0)
7879 else if (dhd->bus->api.fw_rev >= PCIE_SHARED_VERSION_6 && !dhd->dongle_edl_support)
7881 if (dhd->bus->api.fw_rev >= PCIE_SHARED_VERSION_6)
7885 if ((ret = dhd_ring_write(dhd, ring, file, user_buf, file_posn)) < 0)
7889 if ((ret = dhd_ring_write(dhd, ring, file, user_buf, file_posn)) < 0)
7899 int dhd_ring_write(dhd_pub_t *dhd, msgbuf_ring_t *ring, void *file, argument
7927 int dhd_edl_ring_hdr_write(dhd_pub_t *dhd, msgbuf_ring_t *ring, void *file, const void *user_buf, argument
7942 buf = MALLOCZ(dhd->osh, (D2HRING_EDL_MAX_ITEM * D2HRING_EDL_HDR_SIZE));
7970 MFREE(dhd->osh, buf, (D2HRING_EDL_MAX_ITEM * D2HRING_EDL_HDR_SIZE));
7977 void dhd_prot_dump(dhd_pub_t *dhd, struct bcmstrbuf *b) argument
7980 if (dhd->d2h_sync_mode & PCIE_SHARED_D2H_SYNC_SEQNUM)
7982 else if (dhd->d2h_sync_mode & PCIE_SHARED_D2H_SYNC_XORCSUM)
7987 dhd->prot->d2h_sync_wait_max, dhd->prot->d2h_sync_wait_tot);
7990 dhd->dma_h2d_ring_upd_support,
7991 dhd->dma_d2h_ring_upd_support,
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);
8001 void dhd_prot_dstats(dhd_pub_t *dhd) argument
8007 int dhd_process_pkt_reorder_info(dhd_pub_t *dhd, uchar *reorder_info_buf, argument
8015 dhd_post_dummy_msg(dhd_pub_t *dhd) argument
8021 dhd_prot_t *prot = dhd->prot;
8027 dhd_prot_alloc_ring_space(dhd, ring, 1, &alloced, FALSE);
8047 dhd_prot_ring_write_complete(dhd, ring, hevent, 1);
8059 dhd_prot_alloc_ring_space(dhd_pub_t *dhd, msgbuf_ring_t *ring, argument
8072 if (dhd->dma_d2h_ring_upd_support) {
8073 ring->rd = dhd_prot_dma_indx_get(dhd, H2D_DMA_INDX_RD_UPD, ring->idx);
8075 dhd_bus_cmn_readshared(dhd->bus, &(ring->rd), RING_RD_UPD, ring->idx);
8080 dhd->bus->read_shm_fail = TRUE;
8111 dhd_fillup_ioct_reqst(dhd_pub_t *dhd, uint16 len, uint cmd, void* buf, int ifidx) argument
8113 dhd_prot_t *prot = dhd->prot;
8121 if (dhd_query_bus_erros(dhd)) {
8146 dhd_prot_alloc_ring_space(dhd, ring, 1, &alloced, FALSE);
8192 dhd_prot_ring_write_complete(dhd, ring, ioct_rqst, 1);
8211 dhd_prot_ring_attach(dhd_pub_t *dhd, msgbuf_ring_t *ring, const char *name, argument
8216 dhd_prot_t *prot = dhd->prot;
8217 uint16 max_flowrings = dhd->bus->max_tx_flowrings;
8258 (void)dhd_dma_buf_audit(dhd, &ring->dma_buf);
8261 if (ring == dhd->prot->d2hring_edl) {
8265 memcpy(&ring->dma_buf, &dhd->edl_ring_mem, sizeof(ring->dma_buf));
8274 dma_buf_alloced = dhd_dma_buf_alloc(dhd, &ring->dma_buf, dma_buf_len);
8293 ring->ring_lock = dhd_os_spin_lock_init(dhd->osh);
8306 dhd_dma_buf_free(dhd, &ring->dma_buf);
8324 dhd_prot_ring_init(dhd_pub_t *dhd, msgbuf_ring_t *ring) argument
8336 dhd_bus_cmn_writeshared(dhd->bus, &ring->base_addr,
8338 dhd_bus_cmn_writeshared(dhd->bus, &ring->max_items,
8340 dhd_bus_cmn_writeshared(dhd->bus, &ring->item_len,
8343 dhd_bus_cmn_writeshared(dhd->bus, &(ring->wr),
8345 dhd_bus_cmn_writeshared(dhd->bus, &(ring->rd),
8358 dhd_prot_ring_reset(dhd_pub_t *dhd, msgbuf_ring_t *ring) argument
8362 dhd_dma_buf_reset(dhd, &ring->dma_buf);
8375 dhd_prot_ring_detach(dhd_pub_t *dhd, msgbuf_ring_t *ring) argument
8377 dhd_prot_t *prot = dhd->prot;
8378 uint16 max_flowrings = dhd->bus->max_tx_flowrings;
8398 (void)dhd_dma_buf_audit(dhd, &ring->dma_buf);
8401 dhd_dma_buf_free(dhd, &ring->dma_buf);
8404 dhd_os_spin_lock_deinit(dhd->osh, ring->ring_lock);
8410 dhd_get_max_flow_rings(dhd_pub_t *dhd) argument
8412 if (dhd->bus->api.fw_rev >= PCIE_SHARED_VERSION_6)
8413 return dhd->bus->max_tx_flowrings;
8415 return (dhd->bus->max_tx_flowrings - BCMPCIE_H2D_COMMON_MSGRINGS);
8436 dhd_prot_flowrings_pool_attach(dhd_pub_t *dhd) argument
8441 dhd_prot_t *prot = dhd->prot;
8450 prot->h2d_rings_total = (uint16)dhd_bus_max_h2d_queues(dhd->bus);
8459 h2d_flowrings_total = dhd_get_max_flow_rings(dhd);
8476 if (dhd_prot_ring_attach(dhd, ring, ring_name,
8491 dhd_prot_flowrings_pool_detach(dhd); /* Free entire pool of flowrings */
8515 dhd_prot_flowrings_pool_reset(dhd_pub_t *dhd) argument
8519 dhd_prot_t *prot = dhd->prot;
8525 h2d_flowrings_total = dhd_get_max_flow_rings(dhd);
8528 dhd_prot_ring_reset(dhd, ring);
8542 dhd_prot_flowrings_pool_detach(dhd_pub_t *dhd) argument
8547 dhd_prot_t *prot = dhd->prot;
8554 h2d_flowrings_total = dhd_get_max_flow_rings(dhd);
8557 dhd_prot_ring_detach(dhd, ring);
8579 dhd_prot_flowrings_pool_fetch(dhd_pub_t *dhd, uint16 flowid) argument
8582 dhd_prot_t *prot = dhd->prot;
8609 dhd_prot_flowrings_pool_release(dhd_pub_t *dhd, uint16 flowid, void *flow_ring) argument
8612 dhd_prot_t *prot = dhd->prot;
8623 (void)dhd_dma_buf_audit(dhd, &ring->dma_buf);
8683 __dhd_prot_ring_write_complete(dhd_pub_t *dhd, msgbuf_ring_t * ring, void* p, argument
8686 dhd_prot_t *prot = dhd->prot;
8688 uint16 max_flowrings = dhd->bus->max_tx_flowrings;
8695 if (HWA_ACTIVE(dhd) && ring->hwa_db_type) {
8699 prot->mb_2_ring_fn(dhd->bus, db_index, TRUE);
8703 if (IDMA_ACTIVE(dhd) || dhd->dma_h2d_ring_upd_support) {
8704 dhd_prot_dma_indx_set(dhd, ring->wr,
8706 } else if (IFRM_ACTIVE(dhd) && DHD_IS_FLOWRING(ring->idx, max_flowrings)) {
8707 dhd_prot_dma_indx_set(dhd, ring->wr,
8710 dhd_bus_cmn_writeshared(dhd->bus, &(ring->wr),
8715 if (IDMA_ACTIVE(dhd) ||
8716 (IFRM_ACTIVE(dhd) && DHD_IS_FLOWRING(ring->idx, max_flowrings))) {
8719 if (dhd->bus->sih) {
8720 corerev = dhd->bus->sih->buscorerev;
8726 prot->mb_2_ring_fn(dhd->bus, db_index, TRUE);
8728 prot->mb_ring_fn(dhd->bus, ring->wr);
8733 dhd_prot_ring_write_complete(dhd_pub_t *dhd, msgbuf_ring_t * ring, void* p, argument
8737 DHD_BUS_LOCK(dhd->bus->bus_lock, flags_bus);
8738 __dhd_prot_ring_write_complete(dhd, ring, p, nitems);
8739 DHD_BUS_UNLOCK(dhd->bus->bus_lock, flags_bus);
8748 dhd_prot_ring_write_complete_mbdata(dhd_pub_t *dhd, msgbuf_ring_t * ring, void *p, argument
8753 DHD_BUS_LOCK(dhd->bus->bus_lock, flags_bus);
8755 __dhd_prot_ring_write_complete(dhd, ring, p, nitems);
8759 dhd->bus->bus_low_power_state = DHD_BUS_D3_INFORM_SENT;
8762 DHD_BUS_UNLOCK(dhd->bus->bus_lock, flags_bus);
8771 dhd_prot_upd_read_idx(dhd_pub_t *dhd, msgbuf_ring_t * ring) argument
8773 dhd_prot_t *prot = dhd->prot;
8778 if (HWA_ACTIVE(dhd) && ring->hwa_db_type) {
8782 prot->mb_2_ring_fn(dhd->bus, db_index, FALSE);
8791 if (IDMA_ACTIVE(dhd)) {
8792 dhd_prot_dma_indx_set(dhd, ring->rd,
8795 if (dhd->bus->sih) {
8796 corerev = dhd->bus->sih->buscorerev;
8802 prot->mb_2_ring_fn(dhd->bus, db_index, FALSE);
8803 } else if (dhd->dma_h2d_ring_upd_support) {
8804 dhd_prot_dma_indx_set(dhd, ring->rd,
8807 dhd_bus_cmn_writeshared(dhd->bus, &(ring->rd),
8813 dhd_send_d2h_ringcreate(dhd_pub_t *dhd, msgbuf_ring_t *ring_to_create, argument
8820 uint16 max_h2d_rings = dhd->bus->max_submission_rings;
8821 msgbuf_ring_t *ctrl_ring = &dhd->prot->h2dring_ctrl_subn;
8834 d2h_ring = (d2h_ring_create_req_t *) dhd_prot_alloc_ring_space(dhd,
8879 dhd_prot_ring_write_complete(dhd, ctrl_ring, d2h_ring,
8892 dhd_send_h2d_ringcreate(dhd_pub_t *dhd, msgbuf_ring_t *ring_to_create, uint8 ring_type, uint32 id) argument
8899 msgbuf_ring_t *ctrl_ring = &dhd->prot->h2dring_ctrl_subn;
8912 h2d_ring = (h2d_ring_create_req_t *)dhd_prot_alloc_ring_space(dhd,
8948 dhd_prot_ring_write_complete(dhd, ctrl_ring, h2d_ring,
8966 dhd_prot_dma_indx_set(dhd_pub_t *dhd, uint16 new_index, uint8 type, uint16 ringid) argument
8970 dhd_prot_t *prot = dhd->prot;
8971 uint16 max_h2d_rings = dhd->bus->max_submission_rings;
9014 dhd_prot_dma_indx_get(dhd_pub_t *dhd, uint8 type, uint16 ringid) argument
9019 dhd_prot_t *prot = dhd->prot;
9020 uint16 max_h2d_rings = dhd->bus->max_submission_rings;
9073 dhd_prot_dma_indx_alloc(dhd_pub_t *dhd, uint8 type, argument
9081 rc = dhd_dma_buf_alloc(dhd, dma_buf, bufsz);
9087 dhd_prot_dma_indx_init(dhd_pub_t *dhd, uint32 rw_index_sz, uint8 type, uint32 length) argument
9090 dhd_prot_t *prot = dhd->prot;
9107 if (dhd_prot_dma_indx_alloc(dhd, type, dma_buf, bufsz))
9115 if (dhd_prot_dma_indx_alloc(dhd, type, dma_buf, bufsz))
9123 if (dhd_prot_dma_indx_alloc(dhd, type, dma_buf, bufsz))
9131 if (dhd_prot_dma_indx_alloc(dhd, type, dma_buf, bufsz))
9139 if (dhd_prot_dma_indx_alloc(dhd, type, dma_buf, bufsz))
9164 dhd_prot_get_read_addr(dhd_pub_t *dhd, msgbuf_ring_t *ring, uint32 *available_len) argument
9174 __FUNCTION__, (uint32 *)(dhd->prot->d2h_dma_indx_rd_buf.va),
9175 (uint32 *)(dhd->prot->d2h_dma_indx_wr_buf.va)));
9185 if (dhd->dma_d2h_ring_upd_support) {
9187 d2h_wr = dhd_prot_dma_indx_get(dhd, D2H_DMA_INDX_WR_UPD, ring->idx);
9190 dhd_bus_cmn_readshared(dhd->bus, &(ring->wr), RING_WR_UPD, ring->idx);
9214 dhd->busstate, dhd->bus->wait_for_d3_ack));
9218 dhd->bus->read_shm_fail = TRUE;
9222 if (dhd->memdump_enabled) {
9224 dhd->memdump_type = DUMP_TYPE_RESUMED_ON_INVALID_RING_RDWR;
9225 dhd_bus_mem_dump(dhd);
9232 dhd_schedule_reset(dhd);
9262 int dhd_prot_h2d_mbdata_send_ctrlmsg(dhd_pub_t *dhd, uint32 mb_data) argument
9266 msgbuf_ring_t *ctrl_ring = &dhd->prot->h2dring_ctrl_subn;
9281 h2d_mb_data = (h2d_mailbox_data_t *)dhd_prot_alloc_ring_space(dhd,
9310 dhd_prot_ring_write_complete_mbdata(dhd, ctrl_ring, h2d_mb_data,
9321 dhd_prot_flow_ring_create(dhd_pub_t *dhd, flow_ring_node_t *flow_ring_node) argument
9325 dhd_prot_t *prot = dhd->prot;
9329 uint16 max_flowrings = dhd->bus->max_tx_flowrings;
9332 flow_ring = dhd_prot_flowrings_pool_fetch(dhd, flow_ring_node->flowid);
9343 dhd_prot_alloc_ring_space(dhd, ctrl_ring, 1, &alloced, FALSE);
9346 dhd_prot_flowrings_pool_release(dhd, flow_ring_node->flowid, flow_ring);
9381 if (dhd->hp2p_capable && !dhd->hp2p_ring_active &&
9383 (dhd->hp2p_infra_enable || flow_create_rqst->msg.if_id) &&
9387 dhd->hp2p_ring_active = TRUE;
9398 if (IFRM_ACTIVE(dhd))
9407 if (IDMA_ACTIVE(dhd) || dhd->dma_h2d_ring_upd_support) {
9408 dhd_prot_dma_indx_set(dhd, flow_ring->wr,
9410 } else if (IFRM_ACTIVE(dhd) && DHD_IS_FLOWRING(flow_ring->idx, max_flowrings)) {
9411 dhd_prot_dma_indx_set(dhd, flow_ring->wr,
9414 dhd_bus_cmn_writeshared(dhd->bus, &(flow_ring->wr),
9419 dhd_prot_ring_write_complete(dhd, ctrl_ring, flow_create_rqst, 1);
9428 dhd_prot_flow_ring_create_response_process(dhd_pub_t *dhd, void *msg) argument
9436 dhd_bus_flow_ring_create_response(dhd->bus,
9442 dhd_prot_process_h2d_ring_create_complete(dhd_pub_t *dhd, void *buf) argument
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);
9473 dhd_prot_process_d2h_ring_create_complete(dhd_pub_t *dhd, void *buf) argument
9492 if (!dhd->dongle_edl_support)
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;
9561 dhd_prot_process_d2h_mb_data(dhd_pub_t *dhd, void* buf) argument
9568 dhd_bus_handle_mb_data(dhd->bus, d2h_data->d2h_mailbox_data);
9572 dhd_prot_process_d2h_host_ts_complete(dhd_pub_t *dhd, void* buf) argument
9579 void dhd_prot_clean_flow_ring(dhd_pub_t *dhd, void *msgbuf_flow_info) argument
9582 dhd_prot_ring_detach(dhd, flow_ring);
9586 void dhd_prot_print_flow_ring(dhd_pub_t *dhd, void *msgbuf_flow_info, argument
9600 if (dhd->bus->is_linkdown) {
9605 dhd_bus_cmn_readshared(dhd->bus, &rd, RING_RD_UPD, flow_ring->idx);
9606 dhd_bus_cmn_readshared(dhd->bus, &wr, RING_WR_UPD, flow_ring->idx);
9614 void dhd_prot_print_info(dhd_pub_t *dhd, struct bcmstrbuf *strbuf) argument
9616 dhd_prot_t *prot = dhd->prot;
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,
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));
9675 dhd_prot_flow_ring_delete(dhd_pub_t *dhd, flow_ring_node_t *flow_ring_node) argument
9678 dhd_prot_t *prot = dhd->prot;
9687 dhd_prot_alloc_ring_space(dhd, ring, 1, &alloced, FALSE);
9714 dhd_prot_ring_write_complete(dhd, ring, flow_delete_rqst, 1);
9722 dhd_prot_flow_ring_fastdelete(dhd_pub_t *dhd, uint16 flowid, uint16 rd_idx) argument
9724 flow_ring_node_t *flow_ring_node = DHD_FLOW_RING(dhd, flowid);
9746 dhd_prot_txstatus_process(dhd, &txstatus);
9751 dhd_prot_flow_ring_delete_response_process(dhd_pub_t *dhd, void *msg) argument
9758 if (dhd->fast_delete_ring_support) {
9759 dhd_prot_flow_ring_fastdelete(dhd, flow_delete_resp->cmplt.flow_ring_id,
9762 dhd_bus_flow_ring_delete_response(dhd->bus, flow_delete_resp->cmplt.flow_ring_id,
9767 dhd_prot_process_flow_ring_resume_response(dhd_pub_t *dhd, void* msg) argument
9776 dhd_bus_flow_ring_resume_response(dhd->bus, flow_resume_resp->cmplt.flow_ring_id,
9782 dhd_prot_process_flow_ring_suspend_response(dhd_pub_t *dhd, void* msg) argument
9804 dhd_prot_flow_ring_flush(dhd_pub_t *dhd, flow_ring_node_t *flow_ring_node) argument
9807 dhd_prot_t *prot = dhd->prot;
9816 dhd_prot_alloc_ring_space(dhd, ring, 1, &alloced, FALSE);
9837 dhd_prot_ring_write_complete(dhd, ring, flow_flush_rqst, 1);
9845 dhd_prot_flow_ring_flush_response_process(dhd_pub_t *dhd, void *msg) argument
9852 dhd_bus_flow_ring_flush_response(dhd->bus, flow_flush_resp->cmplt.flow_ring_id,
9862 dhd_msgbuf_ring_config_d2h_soft_doorbell(dhd_pub_t *dhd) argument
9870 dhd_prot_t *prot = dhd->prot;
9878 msg_start = dhd_prot_alloc_ring_space(dhd, ctrl_ring, d2h_rings, &alloced, TRUE);
9928 dhd_prot_ring_write_complete(dhd, ctrl_ring, msg_start, d2h_rings);
9936 dhd_prot_process_d2h_ring_config_complete(dhd_pub_t *dhd, void *msg) argument
9945 copy_ext_trap_sig(dhd_pub_t *dhd, trap_t *tr) argument
9947 uint32 *ext_data = dhd->extended_trap_data;
10137 copy_hang_info_stack(dhd_pub_t *dhd, char *dest, int *bytes_written, int *cnt) argument
10142 uint32 *ext_data = dhd->extended_trap_data;
10202 copy_hang_info_specific(dhd_pub_t *dhd, char *dest, int *bytes_written, int *cnt) argument
10207 uint32 *ext_data = dhd->extended_trap_data;
10272 get_hang_info_trap_subtype(dhd_pub_t *dhd, uint32 *subtype) argument
10275 uint32 *ext_data = dhd->extended_trap_data;
10298 copy_hang_info_etd_base64(dhd_pub_t *dhd, char *dest, int *bytes_written, int *cnt) argument
10301 uint32 *ext_data = dhd->extended_trap_data;
10329 base64_out = MALLOCZ(dhd->osh, HANG_INFO_BASE64_BUFFER_SIZE);
10346 MFREE(dhd->osh, base64_out, HANG_INFO_BASE64_BUFFER_SIZE);
10355 copy_hang_info_trap(dhd_pub_t *dhd) argument
10361 if (!dhd || !dhd->hang_info) {
10363 dhd, (dhd ? dhd->hang_info : NULL)));
10367 if (!dhd->dongle_trap_occured) {
10374 copy_ext_trap_sig(dhd, &tr);
10375 get_hang_info_trap_subtype(dhd, &trap_subtype);
10381 dhd->hang_info_cnt = 0;
10382 get_debug_dump_time(dhd->debug_dump_time_hang_str);
10383 copy_debug_dump_time(dhd->debug_dump_time_str, dhd->debug_dump_time_hang_str);
10385 copy_hang_info_head(dhd->hang_info, &tr, VENDOR_SEND_HANG_EXT_INFO_LEN, FALSE,
10386 &bytes_written, &dhd->hang_info_cnt, dhd->debug_dump_time_hang_str);
10389 dhd->hang_info_cnt, (int)strlen(dhd->hang_info), dhd->hang_info));
10391 clear_debug_dump_time(dhd->debug_dump_time_hang_str);
10397 if (dhd->hang_info_cnt < HANG_FIELD_CNT_MAX) {
10398 copy_hang_info_etd_base64(dhd, dhd->hang_info, &bytes_written, &dhd->hang_info_cnt);
10400 dhd->hang_info_cnt, (int)strlen(dhd->hang_info), dhd->hang_info));
10403 if (dhd->hang_info_cnt < HANG_FIELD_CNT_MAX) {
10404 copy_hang_info_stack(dhd, dhd->hang_info, &bytes_written, &dhd->hang_info_cnt);
10406 dhd->hang_info_cnt, (int)strlen(dhd->hang_info), dhd->hang_info));
10409 if (dhd->hang_info_cnt < HANG_FIELD_CNT_MAX) {
10410 copy_hang_info_trap_t(dhd->hang_info, &tr, VENDOR_SEND_HANG_EXT_INFO_LEN, FALSE,
10411 &bytes_written, &dhd->hang_info_cnt, dhd->debug_dump_time_hang_str);
10413 dhd->hang_info_cnt, (int)strlen(dhd->hang_info), dhd->hang_info));
10416 if (dhd->hang_info_cnt < HANG_FIELD_CNT_MAX) {
10417 copy_hang_info_specific(dhd, dhd->hang_info, &bytes_written, &dhd->hang_info_cnt);
10419 dhd->hang_info_cnt, (int)strlen(dhd->hang_info), dhd->hang_info));
10426 dhd_prot_debug_info_print(dhd_pub_t *dhd) argument
10428 dhd_prot_t *prot = dhd->prot;
10446 dhd->bus->d2h_intr_method ? "PCIE_MSI" : "PCIE_INTX"));
10470 if (!dhd_pcie_dump_int_regs(dhd)) {
10472 dhd->bus->is_linkdown = TRUE;
10479 ring_tcm_rd_addr = dhd->bus->ring_sh[ring->idx].ring_state_r;
10480 ring_tcm_wr_addr = dhd->bus->ring_sh[ring->idx].ring_state_w;
10486 if (dhd->bus->is_linkdown) {
10490 dhd_bus_cmn_readshared(dhd->bus, &rd, RING_RD_UPD, ring->idx);
10491 dhd_bus_cmn_readshared(dhd->bus, &wr, RING_WR_UPD, ring->idx);
10498 ring_tcm_rd_addr = dhd->bus->ring_sh[ring->idx].ring_state_r;
10499 ring_tcm_wr_addr = dhd->bus->ring_sh[ring->idx].ring_state_w;
10505 if (dhd->bus->is_linkdown) {
10509 dhd_bus_cmn_readshared(dhd->bus, &rd, RING_RD_UPD, ring->idx);
10510 dhd_bus_cmn_readshared(dhd->bus, &wr, RING_WR_UPD, ring->idx);
10518 ring_tcm_rd_addr = dhd->bus->ring_sh[ring->idx].ring_state_r;
10519 ring_tcm_wr_addr = dhd->bus->ring_sh[ring->idx].ring_state_w;
10526 if (dhd->bus->is_linkdown) {
10530 dhd_bus_cmn_readshared(dhd->bus, &rd, RING_RD_UPD, ring->idx);
10531 dhd_bus_cmn_readshared(dhd->bus, &wr, RING_WR_UPD, ring->idx);
10539 ring_tcm_rd_addr = dhd->bus->ring_sh[ring->idx].ring_state_r;
10540 ring_tcm_wr_addr = dhd->bus->ring_sh[ring->idx].ring_state_w;
10547 if (dhd->bus->is_linkdown) {
10551 dhd_bus_cmn_readshared(dhd->bus, &rd, RING_RD_UPD, ring->idx);
10552 dhd_bus_cmn_readshared(dhd->bus, &wr, RING_WR_UPD, ring->idx);
10560 ring_tcm_rd_addr = dhd->bus->ring_sh[ring->idx].ring_state_r;
10561 ring_tcm_wr_addr = dhd->bus->ring_sh[ring->idx].ring_state_w;
10569 if (dhd->bus->is_linkdown) {
10573 dhd_bus_cmn_readshared(dhd->bus, &rd, RING_RD_UPD, ring->idx);
10574 dhd_bus_cmn_readshared(dhd->bus, &wr, RING_WR_UPD, ring->idx);
10582 ring_tcm_rd_addr = dhd->bus->ring_sh[ring->idx].ring_state_r;
10583 ring_tcm_wr_addr = dhd->bus->ring_sh[ring->idx].ring_state_w;
10591 if (dhd->bus->is_linkdown) {
10595 dhd_bus_cmn_readshared(dhd->bus, &rd, RING_RD_UPD, ring->idx);
10596 dhd_bus_cmn_readshared(dhd->bus, &wr, RING_WR_UPD, ring->idx);
10604 ring_tcm_rd_addr = dhd->bus->ring_sh[ring->idx].ring_state_r;
10605 ring_tcm_wr_addr = dhd->bus->ring_sh[ring->idx].ring_state_w;
10613 if (dhd->bus->is_linkdown) {
10617 dhd_bus_cmn_readshared(dhd->bus, &rd, RING_RD_UPD, ring->idx);
10618 dhd_bus_cmn_readshared(dhd->bus, &wr, RING_WR_UPD, ring->idx);
10630 __FUNCTION__, dhd->multi_client_flow_rings, dhd->max_multi_client_flow_rings));
10637 dhd_pcie_debug_info_dump(dhd);
10643 dhd_prot_ringupd_dump(dhd_pub_t *dhd, struct bcmstrbuf *b) argument
10648 if (dhd->prot->d2h_dma_indx_wr_buf.va) {
10650 uint32 max_h2d_queues = dhd_bus_max_h2d_queues(dhd->bus);
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);
10696 dhd_prot_metadata_dbg_set(dhd_pub_t *dhd, bool val) argument
10698 dhd_prot_t *prot = dhd->prot;
10706 dhd_prot_metadata_dbg_get(dhd_pub_t *dhd) argument
10708 dhd_prot_t *prot = dhd->prot;
10713 dhd_prot_metadatalen_set(dhd_pub_t *dhd, uint32 val, bool rx) argument
10715 dhd_prot_t *prot = dhd->prot;
10720 return dhd_prot_metadatalen_get(dhd, rx);
10724 dhd_prot_metadatalen_get(dhd_pub_t *dhd, bool rx) argument
10726 dhd_prot_t *prot = dhd->prot;
10735 dhd_prot_txp_threshold(dhd_pub_t *dhd, bool set, uint32 val) argument
10737 dhd_prot_t *prot = dhd->prot;
10753 dhd_rxchain_frame(dhd_pub_t *dhd, void *pkt, uint ifidx) argument
10757 dhd_prot_t *prot = dhd->prot;
10764 eh = PKTDATA(dhd->osh, pkt);
10767 if (rxchain->pkt_count && !(PKT_CTF_CHAINABLE(dhd, ifidx, eh, prio, rxchain->h_sa,
10770 dhd_rxchain_commit(dhd);
10792 if ((dhd_rx_pkt_chainable(dhd, ifidx)) && (!ETHER_ISMULTI(rxchain->h_da)) &&
10795 PKTSETCHAINED(dhd->osh, pkt);
10797 PKTCADDLEN(rxchain->pkthead, PKTLEN(dhd->osh, pkt));
10799 dhd_rxchain_commit(dhd);
10805 dhd_rxchain_commit(dhd);
10810 dhd_rxchain_commit(dhd_pub_t *dhd) argument
10812 dhd_prot_t *prot = dhd->prot;
10819 dhd_bus_rx_frame(dhd->bus, rxchain->pkthead, rxchain->ifidx, rxchain->pkt_count);
10829 dhd_prot_flow_ring_resume(dhd_pub_t *dhd, flow_ring_node_t *flow_ring_node) argument
10833 dhd_prot_t *prot = dhd->prot;
10839 flow_ring = dhd_prot_flowrings_pool_fetch(dhd, flow_ring_node->flowid);
10850 dhd_prot_alloc_ring_space(dhd, ctrl_ring, 1, &alloced, FALSE);
10853 dhd_prot_flowrings_pool_release(dhd, flow_ring_node->flowid, flow_ring);
10875 if (IDMA_ACTIVE(dhd) || dhd->dma_h2d_ring_upd_support) {
10876 dhd_prot_dma_indx_set(dhd, flow_ring->wr,
10878 } else if (IFRM_ACTIVE(dhd) && (flow_ring->idx >= BCMPCIE_H2D_MSGRING_TXFLOW_IDX_START)) {
10879 dhd_prot_dma_indx_set(dhd, flow_ring->wr,
10883 dhd_bus_cmn_writeshared(dhd->bus, &(flow_ring->wr),
10888 dhd_prot_ring_write_complete(dhd, ctrl_ring, flow_resume_rqst, 1);
10896 dhd_prot_flow_ring_batch_suspend_request(dhd_pub_t *dhd, uint16 *ringid, uint16 count) argument
10899 dhd_prot_t *prot = dhd->prot;
10909 dhd_prot_alloc_ring_space(dhd, ring, 1, &alloced, FALSE);
10935 dhd_prot_ring_write_complete(dhd, ring, flow_suspend_rqst, 1);
11388 dhd_prot_data_path_tx_timestamp_logging(dhd_pub_t *dhd, bool enable, bool set) argument
11391 dhd->prot->tx_ts_log_enabled = enable;
11393 return dhd->prot->tx_ts_log_enabled;
11397 dhd_prot_data_path_rx_timestamp_logging(dhd_pub_t *dhd, bool enable, bool set) argument
11400 dhd->prot->rx_ts_log_enabled = enable;
11402 return dhd->prot->rx_ts_log_enabled;
11406 dhd_prot_pkt_noretry(dhd_pub_t *dhd, bool enable, bool set) argument
11409 dhd->prot->no_retry = enable;
11411 return dhd->prot->no_retry;
11415 dhd_prot_pkt_noaggr(dhd_pub_t *dhd, bool enable, bool set) argument
11418 dhd->prot->no_aggr = enable;
11420 return dhd->prot->no_aggr;
11424 dhd_prot_pkt_fixed_rate(dhd_pub_t *dhd, bool enable, bool set) argument
11427 dhd->prot->fixed_rate = enable;
11429 return dhd->prot->fixed_rate;
11434 dhd_prot_dma_indx_free(dhd_pub_t *dhd) argument
11436 dhd_prot_t *prot = dhd->prot;
11438 dhd_dma_buf_free(dhd, &prot->h2d_dma_indx_wr_buf);
11439 dhd_dma_buf_free(dhd, &prot->d2h_dma_indx_rd_buf);
11443 dhd_msgbuf_delay_post_ts_bufs(dhd_pub_t *dhd) argument
11445 if (dhd->prot->max_tsbufpost > 0)
11446 dhd_msgbuf_rxbuf_post_ts_bufs(dhd);
11450 dhd_prot_process_fw_timestamp(dhd_pub_t *dhd, void* buf) argument
11462 int dhd_get_hscb_info(dhd_pub_t *dhd, void ** va, uint32 *len) argument
11464 if (!dhd->hscb_enable) {
11474 *va = dhd->prot->host_scb_buf.va;
11477 *len = dhd->prot->host_scb_buf.len;
11484 int dhd_get_hscb_buff(dhd_pub_t *dhd, uint32 offset, uint32 length, void * buff) argument
11486 if (!dhd->hscb_enable) {
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);
11503 dhd_prot_pkt_threshold(dhd_pub_t *dhd, bool set, uint32 val) argument
11506 dhd->pkt_thresh = (uint16)val;
11508 val = dhd->pkt_thresh;
11514 dhd_prot_time_threshold(dhd_pub_t *dhd, bool set, uint32 val) argument
11517 dhd->time_thresh = (uint16)val;
11519 val = dhd->time_thresh;
11525 dhd_prot_pkt_expiry(dhd_pub_t *dhd, bool set, uint32 val) argument
11528 dhd->pkt_expiry = (uint16)val;
11530 val = dhd->pkt_expiry;
11536 dhd_prot_hp2p_enable(dhd_pub_t *dhd, bool set, int enable) argument
11540 dhd->hp2p_enable = (enable & 0xf) ? TRUE : FALSE;
11541 dhd->hp2p_infra_enable = ((enable >> 4) & 0xf) ? TRUE : FALSE;
11544 dhd_update_flow_prio_map(dhd, DHD_FLOW_PRIO_TID_MAP);
11546 dhd_update_flow_prio_map(dhd, DHD_FLOW_PRIO_AC_MAP);
11549 ret = dhd->hp2p_infra_enable ? 0x1:0x0;
11551 ret |= dhd->hp2p_enable ? 0x1:0x0;
11557 dhd_update_hp2p_rxstats(dhd_pub_t *dhd, host_rxbuf_cmpl_t *rxstatus) argument
11563 hp2p_info = &dhd->hp2p_info[0];
11577 dhd_update_hp2p_txstats(dhd_pub_t *dhd, host_txbuf_cmpl_t *txstatus) argument
11584 hp2p_flowid = dhd->bus->max_submission_rings -
11585 dhd->bus->max_cmn_rings - flowid + 1;
11586 hp2p_info = &dhd->hp2p_info[hp2p_flowid];
11645 dhd_calc_hp2p_burst(dhd_pub_t *dhd, msgbuf_ring_t *ring, uint16 flowid) argument
11650 hp2p_flowid = dhd->bus->max_submission_rings -
11651 dhd->bus->max_cmn_rings - flowid + 1;
11652 hp2p_info = &dhd->hp2p_info[hp2p_flowid];
11654 if (ring->pend_items_count == dhd->pkt_thresh) {
11655 dhd_prot_txdata_write_flush(dhd, flowid);
11667 __FUNCTION__, flowid, hp2p_flowid, dhd->pkt_thresh));
11672 hp2p_info->dhd_pub = dhd;
11677 ktime_set(0, dhd->time_thresh * 1000), HRTIMER_MODE_REL);
11680 ktime_set(0, dhd->time_thresh * 1000), HRTIMER_MODE_REL_SOFT);
11691 dhd_update_hp2p_txdesc(dhd_pub_t *dhd, host_txbuf_post_t *txdesc) argument
11701 txdesc->exp_time = dhd->pkt_expiry;