Lines Matching refs:fws
551 static int brcmf_fws_get_tlv_len(struct brcmf_fws_info *fws, in brcmf_fws_get_tlv_len() argument
557 fws->stats.tlv_invalid_type++; in brcmf_fws_get_tlv_len()
564 static void brcmf_fws_lock(struct brcmf_fws_info *fws) in brcmf_fws_lock() argument
565 __acquires(&fws->spinlock) in brcmf_fws_lock()
567 spin_lock_irqsave(&fws->spinlock, fws->flags); in brcmf_fws_lock()
570 static void brcmf_fws_unlock(struct brcmf_fws_info *fws) in brcmf_fws_unlock() argument
571 __releases(&fws->spinlock) in brcmf_fws_unlock()
573 spin_unlock_irqrestore(&fws->spinlock, fws->flags); in brcmf_fws_unlock()
582 static void brcmf_fws_psq_flush(struct brcmf_fws_info *fws, struct pktq *q, in brcmf_fws_psq_flush() argument
686 static void brcmf_fws_hanger_cleanup(struct brcmf_fws_info *fws, in brcmf_fws_hanger_cleanup() argument
690 struct brcmf_fws_hanger *h = &fws->hanger; in brcmf_fws_hanger_cleanup()
711 static void brcmf_fws_macdesc_set_name(struct brcmf_fws_info *fws, in brcmf_fws_macdesc_set_name() argument
714 if (desc == &fws->desc.other) in brcmf_fws_macdesc_set_name()
752 brcmf_fws_macdesc_lookup(struct brcmf_fws_info *fws, u8 *ea) in brcmf_fws_macdesc_lookup() argument
760 entry = &fws->desc.nodes[0]; in brcmf_fws_macdesc_lookup()
761 for (i = 0; i < ARRAY_SIZE(fws->desc.nodes); i++) { in brcmf_fws_macdesc_lookup()
771 brcmf_fws_macdesc_find(struct brcmf_fws_info *fws, struct brcmf_if *ifp, u8 *da) in brcmf_fws_macdesc_find() argument
773 struct brcmf_fws_mac_descriptor *entry = &fws->desc.other; in brcmf_fws_macdesc_find()
787 entry = brcmf_fws_macdesc_lookup(fws, da); in brcmf_fws_macdesc_find()
795 static bool brcmf_fws_macdesc_closed(struct brcmf_fws_info *fws, in brcmf_fws_macdesc_closed() argument
806 if_entry = &fws->desc.iface[entry->interface_id]; in brcmf_fws_macdesc_closed()
820 static void brcmf_fws_macdesc_cleanup(struct brcmf_fws_info *fws, in brcmf_fws_macdesc_cleanup() argument
825 brcmf_fws_psq_flush(fws, &entry->psq, ifidx); in brcmf_fws_macdesc_cleanup()
830 static void brcmf_fws_bus_txq_cleanup(struct brcmf_fws_info *fws, in brcmf_fws_bus_txq_cleanup() argument
840 txq = brcmf_bus_gettxq(fws->drvr->bus_if); in brcmf_fws_bus_txq_cleanup()
850 hi = &fws->hanger.items[hslot]; in brcmf_fws_bus_txq_cleanup()
859 static void brcmf_fws_cleanup(struct brcmf_fws_info *fws, int ifidx) in brcmf_fws_cleanup() argument
865 if (fws == NULL) in brcmf_fws_cleanup()
872 table = &fws->desc.nodes[0]; in brcmf_fws_cleanup()
873 for (i = 0; i < ARRAY_SIZE(fws->desc.nodes); i++) in brcmf_fws_cleanup()
874 brcmf_fws_macdesc_cleanup(fws, &table[i], ifidx); in brcmf_fws_cleanup()
876 brcmf_fws_macdesc_cleanup(fws, &fws->desc.other, ifidx); in brcmf_fws_cleanup()
877 brcmf_fws_bus_txq_cleanup(fws, matchfn, ifidx); in brcmf_fws_cleanup()
878 brcmf_fws_hanger_cleanup(fws, matchfn, ifidx); in brcmf_fws_cleanup()
881 static u8 brcmf_fws_hdrpush(struct brcmf_fws_info *fws, struct sk_buff *skb) in brcmf_fws_hdrpush() argument
896 if (BRCMF_FWS_MODE_GET_REUSESEQ(fws->mode)) in brcmf_fws_hdrpush()
909 if (BRCMF_FWS_MODE_GET_REUSESEQ(fws->mode)) { in brcmf_fws_hdrpush()
933 static bool brcmf_fws_tim_update(struct brcmf_fws_info *fws, in brcmf_fws_tim_update() argument
960 4 + fws->drvr->hdrlen; in brcmf_fws_tim_update()
970 data_offset = brcmf_fws_hdrpush(fws, skb); in brcmf_fws_tim_update()
972 brcmf_fws_unlock(fws); in brcmf_fws_tim_update()
973 err = brcmf_proto_txdata(fws->drvr, ifidx, data_offset, skb); in brcmf_fws_tim_update()
974 brcmf_fws_lock(fws); in brcmf_fws_tim_update()
983 brcmf_fws_flow_control_check(struct brcmf_fws_info *fws, struct pktq *pq, in brcmf_fws_flow_control_check() argument
986 struct brcmf_if *ifp = brcmf_get_ifp(fws->drvr, if_id); in brcmf_fws_flow_control_check()
997 fws->stats.fws_flow_block++; in brcmf_fws_flow_control_check()
1003 static int brcmf_fws_rssi_indicate(struct brcmf_fws_info *fws, s8 rssi) in brcmf_fws_rssi_indicate() argument
1010 int brcmf_fws_macdesc_indicate(struct brcmf_fws_info *fws, u8 type, u8 *data) in brcmf_fws_macdesc_indicate() argument
1021 entry = &fws->desc.nodes[mac_handle & 0x1F]; in brcmf_fws_macdesc_indicate()
1026 brcmf_fws_lock(fws); in brcmf_fws_macdesc_indicate()
1027 brcmf_fws_macdesc_cleanup(fws, entry, -1); in brcmf_fws_macdesc_indicate()
1029 brcmf_fws_unlock(fws); in brcmf_fws_macdesc_indicate()
1031 fws->stats.mac_update_failed++; in brcmf_fws_macdesc_indicate()
1035 existing = brcmf_fws_macdesc_lookup(fws, addr); in brcmf_fws_macdesc_indicate()
1038 brcmf_fws_lock(fws); in brcmf_fws_macdesc_indicate()
1041 brcmf_fws_macdesc_set_name(fws, entry); in brcmf_fws_macdesc_indicate()
1044 brcmf_fws_unlock(fws); in brcmf_fws_macdesc_indicate()
1047 fws->stats.mac_update_failed++; in brcmf_fws_macdesc_indicate()
1052 brcmf_fws_lock(fws); in brcmf_fws_macdesc_indicate()
1057 brcmf_fws_macdesc_set_name(fws, entry); in brcmf_fws_macdesc_indicate()
1058 brcmf_fws_unlock(fws); in brcmf_fws_macdesc_indicate()
1070 static int brcmf_fws_macdesc_state_indicate(struct brcmf_fws_info *fws, in brcmf_fws_macdesc_state_indicate() argument
1078 entry = &fws->desc.nodes[mac_handle & 0x1F]; in brcmf_fws_macdesc_state_indicate()
1080 fws->stats.mac_ps_update_failed++; in brcmf_fws_macdesc_state_indicate()
1083 brcmf_fws_lock(fws); in brcmf_fws_macdesc_state_indicate()
1092 brcmf_fws_tim_update(fws, entry, BRCMF_FWS_FIFO_AC_BK, false); in brcmf_fws_macdesc_state_indicate()
1093 brcmf_fws_tim_update(fws, entry, BRCMF_FWS_FIFO_AC_BE, false); in brcmf_fws_macdesc_state_indicate()
1094 brcmf_fws_tim_update(fws, entry, BRCMF_FWS_FIFO_AC_VI, false); in brcmf_fws_macdesc_state_indicate()
1095 brcmf_fws_tim_update(fws, entry, BRCMF_FWS_FIFO_AC_VO, true); in brcmf_fws_macdesc_state_indicate()
1098 brcmf_fws_unlock(fws); in brcmf_fws_macdesc_state_indicate()
1102 static int brcmf_fws_interface_state_indicate(struct brcmf_fws_info *fws, in brcmf_fws_interface_state_indicate() argument
1116 entry = &fws->desc.iface[ifidx]; in brcmf_fws_interface_state_indicate()
1124 brcmf_fws_lock(fws); in brcmf_fws_interface_state_indicate()
1136 brcmf_fws_unlock(fws); in brcmf_fws_interface_state_indicate()
1139 brcmf_fws_unlock(fws); in brcmf_fws_interface_state_indicate()
1143 fws->stats.if_update_failed++; in brcmf_fws_interface_state_indicate()
1147 static int brcmf_fws_request_indicate(struct brcmf_fws_info *fws, u8 type, in brcmf_fws_request_indicate() argument
1152 entry = &fws->desc.nodes[data[1] & 0x1F]; in brcmf_fws_request_indicate()
1155 fws->stats.credit_request_failed++; in brcmf_fws_request_indicate()
1157 fws->stats.packet_request_failed++; in brcmf_fws_request_indicate()
1164 brcmf_fws_lock(fws); in brcmf_fws_request_indicate()
1171 brcmf_fws_unlock(fws); in brcmf_fws_request_indicate()
1206 static void brcmf_fws_return_credits(struct brcmf_fws_info *fws, in brcmf_fws_return_credits() argument
1216 fws->fifo_credit_map |= 1 << fifo; in brcmf_fws_return_credits()
1219 (fws->credits_borrowed[0])) { in brcmf_fws_return_credits()
1222 borrowed = &fws->credits_borrowed[lender_ac]; in brcmf_fws_return_credits()
1224 fws->fifo_credit_map |= (1 << lender_ac); in brcmf_fws_return_credits()
1225 fifo_credit = &fws->fifo_credit[lender_ac]; in brcmf_fws_return_credits()
1239 fws->fifo_credit[fifo] += credits; in brcmf_fws_return_credits()
1242 static void brcmf_fws_schedule_deq(struct brcmf_fws_info *fws) in brcmf_fws_schedule_deq() argument
1245 if ((fws->fifo_credit_map & fws->fifo_delay_map) || in brcmf_fws_schedule_deq()
1246 (!brcmf_fws_fc_active(fws) && fws->fifo_delay_map)) in brcmf_fws_schedule_deq()
1247 queue_work(fws->fws_wq, &fws->fws_dequeue_work); in brcmf_fws_schedule_deq()
1250 static int brcmf_fws_enq(struct brcmf_fws_info *fws, in brcmf_fws_enq() argument
1255 u32 *qfull_stat = &fws->stats.delayq_full_error; in brcmf_fws_enq()
1273 qfull_stat = &fws->stats.supprq_full_error; in brcmf_fws_enq()
1328 fws->fifo_delay_map |= 1 << fifo; in brcmf_fws_enq()
1329 fws->fifo_enqpkt[fifo]++; in brcmf_fws_enq()
1338 brcmf_fws_tim_update(fws, entry, fifo, true); in brcmf_fws_enq()
1339 brcmf_fws_flow_control_check(fws, &entry->psq, in brcmf_fws_enq()
1344 static struct sk_buff *brcmf_fws_deq(struct brcmf_fws_info *fws, int fifo) in brcmf_fws_deq() argument
1355 table = (struct brcmf_fws_mac_descriptor *)&fws->desc; in brcmf_fws_deq()
1356 num_nodes = sizeof(fws->desc) / sizeof(struct brcmf_fws_mac_descriptor); in brcmf_fws_deq()
1357 node_pos = fws->deq_node_pos[fifo]; in brcmf_fws_deq()
1362 brcmf_fws_macdesc_closed(fws, entry, fifo)) in brcmf_fws_deq()
1385 fws->deq_node_pos[fifo] = (node_pos + i + 1) % num_nodes; in brcmf_fws_deq()
1386 brcmf_fws_flow_control_check(fws, &entry->psq, in brcmf_fws_deq()
1394 brcmf_fws_tim_update(fws, entry, fifo, false); in brcmf_fws_deq()
1400 fws->fifo_enqpkt[fifo]--; in brcmf_fws_deq()
1401 if (fws->fifo_enqpkt[fifo] == 0) in brcmf_fws_deq()
1402 fws->fifo_delay_map &= ~(1 << fifo); in brcmf_fws_deq()
1411 static int brcmf_fws_txstatus_suppressed(struct brcmf_fws_info *fws, int fifo, in brcmf_fws_txstatus_suppressed() argument
1439 ret = brcmf_fws_enq(fws, BRCMF_FWS_SKBSTATE_SUPPRESSED, fifo, skb); in brcmf_fws_txstatus_suppressed()
1443 brcmf_fws_hanger_poppkt(&fws->hanger, hslot, &skb, true); in brcmf_fws_txstatus_suppressed()
1446 brcmf_fws_hanger_mark_suppressed(&fws->hanger, hslot); in brcmf_fws_txstatus_suppressed()
1453 brcmf_fws_txs_process(struct brcmf_fws_info *fws, u8 flags, u32 hslot, in brcmf_fws_txs_process() argument
1467 fws->stats.txs_discard++; in brcmf_fws_txs_process()
1469 fws->stats.txs_supp_core++; in brcmf_fws_txs_process()
1472 fws->stats.txs_supp_ps++; in brcmf_fws_txs_process()
1475 fws->stats.txs_tossed++; in brcmf_fws_txs_process()
1477 fws->stats.txs_host_tossed++; in brcmf_fws_txs_process()
1481 ret = brcmf_fws_hanger_poppkt(&fws->hanger, hslot, &skb, in brcmf_fws_txs_process()
1503 if ((fws->fcmode == BRCMF_FWS_FCMODE_IMPLIED_CREDIT) || in brcmf_fws_txs_process()
1506 brcmf_fws_return_credits(fws, fifo, 1); in brcmf_fws_txs_process()
1507 brcmf_fws_schedule_deq(fws); in brcmf_fws_txs_process()
1511 ret = brcmf_proto_hdrpull(fws->drvr, false, skb, &ifp); in brcmf_fws_txs_process()
1517 ret = brcmf_fws_txstatus_suppressed(fws, fifo, skb, in brcmf_fws_txs_process()
1525 static int brcmf_fws_fifocreditback_indicate(struct brcmf_fws_info *fws, in brcmf_fws_fifocreditback_indicate() argument
1530 if (fws->fcmode != BRCMF_FWS_FCMODE_EXPLICIT_CREDIT) { in brcmf_fws_fifocreditback_indicate()
1536 brcmf_fws_lock(fws); in brcmf_fws_fifocreditback_indicate()
1538 brcmf_fws_return_credits(fws, i, data[i]); in brcmf_fws_fifocreditback_indicate()
1540 brcmf_dbg(DATA, "map: credit %x delay %x\n", fws->fifo_credit_map, in brcmf_fws_fifocreditback_indicate()
1541 fws->fifo_delay_map); in brcmf_fws_fifocreditback_indicate()
1542 brcmf_fws_unlock(fws); in brcmf_fws_fifocreditback_indicate()
1546 static int brcmf_fws_txstatus_indicate(struct brcmf_fws_info *fws, u8 *data) in brcmf_fws_txstatus_indicate() argument
1556 fws->stats.txs_indicate++; in brcmf_fws_txstatus_indicate()
1562 if (BRCMF_FWS_MODE_GET_REUSESEQ(fws->mode)) { in brcmf_fws_txstatus_indicate()
1570 brcmf_fws_lock(fws); in brcmf_fws_txstatus_indicate()
1571 brcmf_fws_txs_process(fws, flags, hslot, genbit, seq); in brcmf_fws_txstatus_indicate()
1572 brcmf_fws_unlock(fws); in brcmf_fws_txstatus_indicate()
1576 static int brcmf_fws_dbg_seqnum_check(struct brcmf_fws_info *fws, u8 *data) in brcmf_fws_dbg_seqnum_check() argument
1590 struct brcmf_fws_info *fws = drvr_to_fws(ifp->drvr); in brcmf_fws_notify_credit_map() local
1598 if (fws->creditmap_received) in brcmf_fws_notify_credit_map()
1601 fws->creditmap_received = true; in brcmf_fws_notify_credit_map()
1604 brcmf_fws_lock(fws); in brcmf_fws_notify_credit_map()
1605 for (i = 0; i < ARRAY_SIZE(fws->fifo_credit); i++) { in brcmf_fws_notify_credit_map()
1607 fws->fifo_credit_map |= 1 << i; in brcmf_fws_notify_credit_map()
1609 fws->fifo_credit_map &= ~(1 << i); in brcmf_fws_notify_credit_map()
1610 fws->fifo_credit[i] = *credits++; in brcmf_fws_notify_credit_map()
1612 brcmf_fws_schedule_deq(fws); in brcmf_fws_notify_credit_map()
1613 brcmf_fws_unlock(fws); in brcmf_fws_notify_credit_map()
1621 struct brcmf_fws_info *fws = drvr_to_fws(ifp->drvr); in brcmf_fws_notify_bcmc_credit_support() local
1623 if (fws) { in brcmf_fws_notify_bcmc_credit_support()
1624 brcmf_fws_lock(fws); in brcmf_fws_notify_bcmc_credit_support()
1625 fws->bcmc_credit_check = true; in brcmf_fws_notify_bcmc_credit_support()
1626 brcmf_fws_unlock(fws); in brcmf_fws_notify_bcmc_credit_support()
1830 struct brcmf_fws_info *fws = drvr_to_fws(ifp->drvr); in brcmf_fws_hdrpull() local
1847 if ((!fws) || (!fws->fw_signals)) { in brcmf_fws_hdrpull()
1852 fws->stats.header_pulls++; in brcmf_fws_hdrpull()
1874 brcmf_fws_get_tlv_len(fws, type)); in brcmf_fws_hdrpull()
1880 if (len < brcmf_fws_get_tlv_len(fws, type)) in brcmf_fws_hdrpull()
1893 brcmf_fws_macdesc_indicate(fws, type, data); in brcmf_fws_hdrpull()
1897 err = brcmf_fws_macdesc_state_indicate(fws, type, data); in brcmf_fws_hdrpull()
1901 err = brcmf_fws_interface_state_indicate(fws, type, in brcmf_fws_hdrpull()
1906 err = brcmf_fws_request_indicate(fws, type, data); in brcmf_fws_hdrpull()
1909 brcmf_fws_txstatus_indicate(fws, data); in brcmf_fws_hdrpull()
1912 err = brcmf_fws_fifocreditback_indicate(fws, data); in brcmf_fws_hdrpull()
1915 brcmf_fws_rssi_indicate(fws, *data); in brcmf_fws_hdrpull()
1918 brcmf_fws_dbg_seqnum_check(fws, data); in brcmf_fws_hdrpull()
1923 fws->stats.tlv_invalid_type++; in brcmf_fws_hdrpull()
1933 fws->stats.tlv_parse_failed++; in brcmf_fws_hdrpull()
1936 brcmf_fws_schedule_deq(fws); in brcmf_fws_hdrpull()
1946 fws->stats.header_only_pkt++; in brcmf_fws_hdrpull()
1949 static u8 brcmf_fws_precommit_skb(struct brcmf_fws_info *fws, int fifo, in brcmf_fws_precommit_skb() argument
1967 return brcmf_fws_hdrpush(fws, p); in brcmf_fws_precommit_skb()
1970 static void brcmf_fws_rollback_toq(struct brcmf_fws_info *fws, in brcmf_fws_rollback_toq() argument
1995 fws->stats.rollback_failed++; in brcmf_fws_rollback_toq()
1997 brcmf_fws_txs_process(fws, BRCMF_FWS_TXSTATUS_HOST_TOSSED, in brcmf_fws_rollback_toq()
2000 fws->stats.rollback_success++; in brcmf_fws_rollback_toq()
2001 brcmf_fws_return_credits(fws, fifo, 1); in brcmf_fws_rollback_toq()
2006 static int brcmf_fws_borrow_credit(struct brcmf_fws_info *fws) in brcmf_fws_borrow_credit() argument
2010 if (time_after(fws->borrow_defer_timestamp, jiffies)) { in brcmf_fws_borrow_credit()
2011 fws->fifo_credit_map &= ~(1 << BRCMF_FWS_FIFO_AC_BE); in brcmf_fws_borrow_credit()
2016 if (fws->fifo_credit[lender_ac]) { in brcmf_fws_borrow_credit()
2017 fws->credits_borrowed[lender_ac]++; in brcmf_fws_borrow_credit()
2018 fws->fifo_credit[lender_ac]--; in brcmf_fws_borrow_credit()
2019 if (fws->fifo_credit[lender_ac] == 0) in brcmf_fws_borrow_credit()
2020 fws->fifo_credit_map &= ~(1 << lender_ac); in brcmf_fws_borrow_credit()
2021 fws->fifo_credit_map |= (1 << BRCMF_FWS_FIFO_AC_BE); in brcmf_fws_borrow_credit()
2026 fws->fifo_credit_map &= ~(1 << BRCMF_FWS_FIFO_AC_BE); in brcmf_fws_borrow_credit()
2030 static int brcmf_fws_commit_skb(struct brcmf_fws_info *fws, int fifo, in brcmf_fws_commit_skb() argument
2043 data_offset = brcmf_fws_precommit_skb(fws, fifo, skb); in brcmf_fws_commit_skb()
2048 brcmf_fws_unlock(fws); in brcmf_fws_commit_skb()
2049 rc = brcmf_proto_txdata(fws->drvr, ifidx, data_offset, skb); in brcmf_fws_commit_skb()
2050 brcmf_fws_lock(fws); in brcmf_fws_commit_skb()
2057 (void)brcmf_proto_hdrpull(fws->drvr, false, skb, NULL); in brcmf_fws_commit_skb()
2061 fws->stats.pkt2bus++; in brcmf_fws_commit_skb()
2062 fws->stats.send_pkts[fifo]++; in brcmf_fws_commit_skb()
2064 fws->stats.requested_sent[fifo]++; in brcmf_fws_commit_skb()
2069 brcmf_fws_rollback_toq(fws, skb, fifo); in brcmf_fws_commit_skb()
2073 static int brcmf_fws_assign_htod(struct brcmf_fws_info *fws, struct sk_buff *p, in brcmf_fws_assign_htod() argument
2081 hslot = brcmf_fws_hanger_get_free_slot(&fws->hanger); in brcmf_fws_assign_htod()
2085 rc = brcmf_fws_hanger_pushpkt(&fws->hanger, p, hslot); in brcmf_fws_assign_htod()
2089 fws->stats.generic_error++; in brcmf_fws_assign_htod()
2095 struct brcmf_fws_info *fws = drvr_to_fws(ifp->drvr); in brcmf_fws_process_skb() local
2111 brcmf_fws_lock(fws); in brcmf_fws_process_skb()
2113 fws->borrow_defer_timestamp = jiffies + in brcmf_fws_process_skb()
2116 skcb->mac = brcmf_fws_macdesc_find(fws, ifp, eh->h_dest); in brcmf_fws_process_skb()
2119 if (!brcmf_fws_assign_htod(fws, skb, fifo)) { in brcmf_fws_process_skb()
2120 brcmf_fws_enq(fws, BRCMF_FWS_SKBSTATE_DELAYED, fifo, skb); in brcmf_fws_process_skb()
2121 brcmf_fws_schedule_deq(fws); in brcmf_fws_process_skb()
2127 brcmf_fws_unlock(fws); in brcmf_fws_process_skb()
2145 struct brcmf_fws_info *fws = drvr_to_fws(ifp->drvr); in brcmf_fws_add_interface() local
2148 if (!ifp->ndev || !brcmf_fws_queue_skbs(fws)) in brcmf_fws_add_interface()
2151 entry = &fws->desc.iface[ifp->ifidx]; in brcmf_fws_add_interface()
2154 brcmf_fws_macdesc_set_name(fws, entry); in brcmf_fws_add_interface()
2163 struct brcmf_fws_info *fws = drvr_to_fws(ifp->drvr); in brcmf_fws_del_interface() local
2168 brcmf_fws_lock(fws); in brcmf_fws_del_interface()
2172 brcmf_fws_cleanup(fws, ifp->ifidx); in brcmf_fws_del_interface()
2173 brcmf_fws_unlock(fws); in brcmf_fws_del_interface()
2178 struct brcmf_fws_info *fws; in brcmf_fws_dequeue_worker() local
2186 fws = container_of(worker, struct brcmf_fws_info, fws_dequeue_work); in brcmf_fws_dequeue_worker()
2187 drvr = fws->drvr; in brcmf_fws_dequeue_worker()
2189 brcmf_fws_lock(fws); in brcmf_fws_dequeue_worker()
2190 for (fifo = BRCMF_FWS_FIFO_BCMC; fifo >= 0 && !fws->bus_flow_blocked; in brcmf_fws_dequeue_worker()
2192 if (!brcmf_fws_fc_active(fws)) { in brcmf_fws_dequeue_worker()
2193 while ((skb = brcmf_fws_deq(fws, fifo)) != NULL) { in brcmf_fws_dequeue_worker()
2196 brcmf_fws_hanger_poppkt(&fws->hanger, hslot, in brcmf_fws_dequeue_worker()
2201 brcmf_fws_unlock(fws); in brcmf_fws_dequeue_worker()
2203 brcmf_fws_lock(fws); in brcmf_fws_dequeue_worker()
2208 if (fws->bus_flow_blocked) in brcmf_fws_dequeue_worker()
2213 while ((fws->fifo_credit[fifo]) || ((!fws->bcmc_credit_check) && in brcmf_fws_dequeue_worker()
2215 skb = brcmf_fws_deq(fws, fifo); in brcmf_fws_dequeue_worker()
2218 fws->fifo_credit[fifo]--; in brcmf_fws_dequeue_worker()
2219 if (brcmf_fws_commit_skb(fws, fifo, skb)) in brcmf_fws_dequeue_worker()
2221 if (fws->bus_flow_blocked) in brcmf_fws_dequeue_worker()
2225 (fws->fifo_credit[fifo] == 0) && in brcmf_fws_dequeue_worker()
2226 (!fws->bus_flow_blocked)) { in brcmf_fws_dequeue_worker()
2227 while (brcmf_fws_borrow_credit(fws) == 0) { in brcmf_fws_dequeue_worker()
2228 skb = brcmf_fws_deq(fws, fifo); in brcmf_fws_dequeue_worker()
2230 brcmf_fws_return_credits(fws, fifo, 1); in brcmf_fws_dequeue_worker()
2233 if (brcmf_fws_commit_skb(fws, fifo, skb)) in brcmf_fws_dequeue_worker()
2235 if (fws->bus_flow_blocked) in brcmf_fws_dequeue_worker()
2240 brcmf_fws_unlock(fws); in brcmf_fws_dequeue_worker()
2314 struct brcmf_fws_info *fws; in brcmf_fws_attach() local
2320 fws = kzalloc(sizeof(*fws), GFP_KERNEL); in brcmf_fws_attach()
2321 if (!fws) { in brcmf_fws_attach()
2326 spin_lock_init(&fws->spinlock); in brcmf_fws_attach()
2329 fws->drvr = drvr; in brcmf_fws_attach()
2330 fws->fcmode = drvr->settings->fcmode; in brcmf_fws_attach()
2333 (fws->fcmode == BRCMF_FWS_FCMODE_NONE)) { in brcmf_fws_attach()
2334 fws->avoid_queueing = true; in brcmf_fws_attach()
2336 return fws; in brcmf_fws_attach()
2339 fws->fws_wq = create_singlethread_workqueue("brcmf_fws_wq"); in brcmf_fws_attach()
2340 if (fws->fws_wq == NULL) { in brcmf_fws_attach()
2345 INIT_WORK(&fws->fws_dequeue_work, brcmf_fws_dequeue_worker); in brcmf_fws_attach()
2348 if (fws->fcmode != BRCMF_FWS_FCMODE_NONE) in brcmf_fws_attach()
2372 fws->fw_signals = true; in brcmf_fws_attach()
2376 fws->fcmode = BRCMF_FWS_FCMODE_NONE; in brcmf_fws_attach()
2377 fws->fw_signals = false; in brcmf_fws_attach()
2390 BRCMF_FWS_MODE_SET_REUSESEQ(fws->mode, 1); in brcmf_fws_attach()
2395 brcmf_fws_hanger_init(&fws->hanger); in brcmf_fws_attach()
2396 brcmf_fws_macdesc_init(&fws->desc.other, NULL, 0); in brcmf_fws_attach()
2397 brcmf_fws_macdesc_set_name(fws, &fws->desc.other); in brcmf_fws_attach()
2398 brcmf_dbg(INFO, "added %s\n", fws->desc.other.name); in brcmf_fws_attach()
2399 brcmu_pktq_init(&fws->desc.other.psq, BRCMF_FWS_PSQ_PREC_COUNT, in brcmf_fws_attach()
2403 fws->fw_signals ? "enabled" : "disabled", tlv); in brcmf_fws_attach()
2404 return fws; in brcmf_fws_attach()
2407 brcmf_fws_detach(fws); in brcmf_fws_attach()
2411 void brcmf_fws_detach(struct brcmf_fws_info *fws) in brcmf_fws_detach() argument
2413 if (!fws) in brcmf_fws_detach()
2416 if (fws->fws_wq) in brcmf_fws_detach()
2417 destroy_workqueue(fws->fws_wq); in brcmf_fws_detach()
2420 brcmf_fws_lock(fws); in brcmf_fws_detach()
2421 brcmf_fws_cleanup(fws, -1); in brcmf_fws_detach()
2422 brcmf_fws_unlock(fws); in brcmf_fws_detach()
2425 kfree(fws); in brcmf_fws_detach()
2435 bool brcmf_fws_queue_skbs(struct brcmf_fws_info *fws) in brcmf_fws_queue_skbs() argument
2437 return !fws->avoid_queueing; in brcmf_fws_queue_skbs()
2440 bool brcmf_fws_fc_active(struct brcmf_fws_info *fws) in brcmf_fws_fc_active() argument
2442 if (!fws->creditmap_received) in brcmf_fws_fc_active()
2445 return fws->fcmode != BRCMF_FWS_FCMODE_NONE; in brcmf_fws_fc_active()
2448 void brcmf_fws_bustxfail(struct brcmf_fws_info *fws, struct sk_buff *skb) in brcmf_fws_bustxfail() argument
2456 brcmf_fws_lock(fws); in brcmf_fws_bustxfail()
2458 brcmf_fws_txs_process(fws, BRCMF_FWS_TXSTATUS_HOST_TOSSED, hslot, 0, 0); in brcmf_fws_bustxfail()
2459 brcmf_fws_unlock(fws); in brcmf_fws_bustxfail()
2464 struct brcmf_fws_info *fws = drvr_to_fws(drvr); in brcmf_fws_bus_blocked() local
2468 if (fws->avoid_queueing) { in brcmf_fws_bus_blocked()
2477 fws->bus_flow_blocked = flow_blocked; in brcmf_fws_bus_blocked()
2479 brcmf_fws_schedule_deq(fws); in brcmf_fws_bus_blocked()
2481 fws->stats.bus_flow_block++; in brcmf_fws_bus_blocked()