Lines Matching +full:rx +full:- +full:num +full:- +full:evt

1 // SPDX-License-Identifier: ISC
3 * Copyright (c) 2012-2017 Qualcomm Atheros, Inc.
4 * Copyright (c) 2018-2019, The Linux Foundation. All rights reserved.
21 static u32 dbg_ring_index; /* 24+ for Rx, 0..23 for Tx */
23 /* 0..wil->num_rx_status_rings-1 for Rx, wil->tx_sring_idx for Tx */
49 if (ring->is_rx) { in wil_print_desc_edma()
52 &ring->va[idx].rx.enhanced; in wil_print_desc_edma()
53 u16 buff_id = le16_to_cpu(rx_d->mac.buff_id); in wil_print_desc_edma()
55 if (wil->rx_buff_mgmt.buff_arr && in wil_print_desc_edma()
56 wil_val_in_range(buff_id, 0, wil->rx_buff_mgmt.size)) in wil_print_desc_edma()
57 has_skb = wil->rx_buff_mgmt.buff_arr[buff_id].skb; in wil_print_desc_edma()
62 &ring->va[idx].tx.enhanced; in wil_print_desc_edma()
64 num_of_descs = (u8)d->mac.d[2]; in wil_print_desc_edma()
65 has_skb = ring->ctx && ring->ctx[idx].skb; in wil_print_desc_edma()
82 seq_printf(s, " pa = %pad\n", &ring->pa); in wil_print_ring()
83 seq_printf(s, " va = 0x%p\n", ring->va); in wil_print_ring()
84 seq_printf(s, " size = %d\n", ring->size); in wil_print_ring()
85 if (wil->use_enhanced_dma_hw && ring->is_rx) in wil_print_ring()
86 seq_printf(s, " swtail = %u\n", *ring->edma_rx_swtail.va); in wil_print_ring()
88 seq_printf(s, " swtail = %d\n", ring->swtail); in wil_print_ring()
89 seq_printf(s, " swhead = %d\n", ring->swhead); in wil_print_ring()
90 if (wil->use_enhanced_dma_hw) { in wil_print_ring()
91 int ring_id = ring->is_rx ? in wil_print_ring()
92 WIL_RX_DESC_RING_ID : ring - wil->ring_tx; in wil_print_ring()
103 seq_printf(s, " hwtail = [0x%08x] -> ", ring->hwtail); in wil_print_ring()
104 x = wmi_addr(wil, ring->hwtail); in wil_print_ring()
112 if (ring->va && (ring->size <= (1 << WIL_RING_SIZE_ORDER_MAX))) { in wil_print_ring()
115 for (i = 0; i < ring->size; i++) { in wil_print_ring()
118 if (wil->use_enhanced_dma_hw) { in wil_print_ring()
122 &ring->va[i].tx.legacy; in wil_print_ring()
123 seq_printf(s, "%c", (d->dma.status & BIT(0)) ? in wil_print_ring()
124 _s : (ring->ctx[i].skb ? _h : 'h')); in wil_print_ring()
135 struct wil6210_priv *wil = s->private; in ring_show()
137 wil_print_ring(s, wil, "rx", &wil->ring_rx, 'S', '_'); in ring_show()
139 for (i = 0; i < ARRAY_SIZE(wil->ring_tx); i++) { in ring_show()
140 struct wil_ring *ring = &wil->ring_tx[i]; in ring_show()
141 struct wil_ring_tx_data *txdata = &wil->ring_tx_data[i]; in ring_show()
143 if (ring->va) { in ring_show()
144 int cid = wil->ring2cid_tid[i][0]; in ring_show()
145 int tid = wil->ring2cid_tid[i][1]; in ring_show()
146 u32 swhead = ring->swhead; in ring_show()
147 u32 swtail = ring->swtail; in ring_show()
148 int used = (ring->size + swhead - swtail) in ring_show()
149 % ring->size; in ring_show()
150 int avail = ring->size - used - 1; in ring_show()
155 uint64_t idle = txdata->idle * 100; in ring_show()
156 uint64_t total = now - txdata->begin; in ring_show()
165 txdata->begin = now; in ring_show()
166 txdata->idle = 0ULL; in ring_show()
170 if (cid < wil->max_assoc_sta) in ring_show()
173 wil->sta[cid].addr, cid, tid, in ring_show()
174 txdata->dot1x_open ? "+" : "-", in ring_show()
175 txdata->agg_wsize, in ring_show()
176 txdata->agg_timeout, in ring_show()
177 txdata->agg_amsdu ? "+" : "-", in ring_show()
182 txdata->dot1x_open ? "+" : "-", in ring_show()
197 int sring_idx = sring - wil->srings; in wil_print_sring()
201 sring->is_rx ? "RX" : "TX", sring_idx); in wil_print_sring()
202 seq_printf(s, " pa = %pad\n", &sring->pa); in wil_print_sring()
203 seq_printf(s, " va = 0x%pK\n", sring->va); in wil_print_sring()
204 seq_printf(s, " size = %d\n", sring->size); in wil_print_sring()
205 seq_printf(s, " elem_size = %zu\n", sring->elem_size); in wil_print_sring()
206 seq_printf(s, " swhead = %d\n", sring->swhead); in wil_print_sring()
207 if (wil->use_enhanced_dma_hw) { in wil_print_sring()
218 seq_printf(s, " hwtail = [0x%08x] -> ", sring->hwtail); in wil_print_sring()
219 x = wmi_addr(wil, sring->hwtail); in wil_print_sring()
226 seq_printf(s, " desc_rdy_pol = %d\n", sring->desc_rdy_pol); in wil_print_sring()
228 sring->invalid_buff_id_cnt); in wil_print_sring()
230 if (sring->va && (sring->size <= (1 << WIL_RING_SIZE_ORDER_MAX))) { in wil_print_sring()
233 for (i = 0; i < sring->size; i++) { in wil_print_sring()
235 (u32 *)(sring->va + (sring->elem_size * i)); in wil_print_sring()
239 if (i == sring->swhead) in wil_print_sring()
253 struct wil6210_priv *wil = s->private; in srings_show()
257 if (wil->srings[i].va) in srings_show()
258 wil_print_sring(s, wil, &wil->srings[i]); in srings_show()
273 struct wil6210_priv *wil = s->private; in wil_print_mbox_ring()
295 seq_printf(s, " size = 0x%04x bytes -> %d entries\n", r.size, rsize); in wil_print_mbox_ring()
317 void __iomem *x = wil->csr + HOSTADDR(r.base) + delta; in wil_print_mbox_ring()
323 (r.tail - r.base == delta) ? "t" : " ", in wil_print_mbox_ring()
324 (r.head - r.base == delta) ? "h" : " ", in wil_print_mbox_ring()
329 seq_printf(s, " -> %04x %04x %04x %02x\n", in wil_print_mbox_ring()
337 * No need to check @src for validity - in wil_print_mbox_ring()
356 struct wil6210_priv *wil = s->private; in mbox_show()
363 wil_print_mbox_ring(s, "tx", wil->csr + HOST_MBOX + in mbox_show()
365 wil_print_mbox_ring(s, "rx", wil->csr + HOST_MBOX + in mbox_show()
366 offsetof(struct wil6210_mbox_ctl, rx)); in mbox_show()
378 struct wil6210_priv *wil = d->wil; in wil_debugfs_iomem_x32_set()
385 writel_relaxed(val, (void __iomem *)d->offset); in wil_debugfs_iomem_x32_set()
398 struct wil6210_priv *wil = d->wil; in wil_debugfs_iomem_x32_get()
405 *val = readl((void __iomem *)d->offset); in wil_debugfs_iomem_x32_get()
419 struct wil_debugfs_iomem_data *data = &wil->dbg_data.data_arr[ in wil_debugfs_create_iomem_x32()
420 wil->dbg_data.iomem_data_count]; in wil_debugfs_create_iomem_x32()
422 data->wil = wil; in wil_debugfs_create_iomem_x32()
423 data->offset = value; in wil_debugfs_create_iomem_x32()
426 wil->dbg_data.iomem_data_count++; in wil_debugfs_create_iomem_x32()
445 * wil6210_debugfs_init_offset - create set of debugfs files
504 wil6210_debugfs_init_offset(wil, d, (void * __force)wil->csr + off, in wil6210_debugfs_create_ISR()
520 wil6210_debugfs_init_offset(wil, d, (void * __force)wil->csr, in wil6210_debugfs_create_pseudo_ISR()
571 drx = debugfs_create_dir("RX", d); in wil6210_debugfs_create_ITR_CNT()
573 wil6210_debugfs_init_offset(wil, d, (void * __force)wil->csr, in wil6210_debugfs_create_ITR_CNT()
576 wil6210_debugfs_init_offset(wil, dtx, (void * __force)wil->csr, in wil6210_debugfs_create_ITR_CNT()
579 wil6210_debugfs_init_offset(wil, drx, (void * __force)wil->csr, in wil6210_debugfs_create_ITR_CNT()
586 struct wil6210_priv *wil = s->private; in memread_show()
618 struct wil_blob_wrapper *wil_blob = file->private_data; in wil_read_file_ioblob()
619 struct wil6210_priv *wil = wil_blob->wil; in wil_read_file_ioblob()
621 size_t available = wil_blob->blob.size; in wil_read_file_ioblob()
627 return -EINVAL; in wil_read_file_ioblob()
632 if (count > available - pos) in wil_read_file_ioblob()
633 count = available - pos; in wil_read_file_ioblob()
639 aligned_pos = pos - unaligned_bytes; in wil_read_file_ioblob()
644 return -ENOMEM; in wil_read_file_ioblob()
660 wil_blob->blob.data + aligned_pos, aligned_count); in wil_read_file_ioblob()
669 return -EFAULT; in wil_read_file_ioblob()
671 count -= ret; in wil_read_file_ioblob()
692 /*---write channel 1..4 to rxon for it, 0 to rxoff---*/
696 struct wil6210_priv *wil = file->private_data; in wil_write_file_rxon()
712 return -EINVAL; in wil_write_file_rxon()
738 struct wil6210_priv *wil = file->private_data; in wil_write_file_rbufcap()
750 wil_info(wil, "%s RBUFCAP, descriptors threshold - %d\n", in wil_write_file_rbufcap()
753 if (!wil->ring_rx.va || val > wil->ring_rx.size) { in wil_write_file_rbufcap()
755 return -EINVAL; in wil_write_file_rbufcap()
773 * - "add <ringid> <agg_size> <timeout>" to trigger ADDBA
774 * - "del_tx <ringid> <reason>" to trigger DELBA for Tx side
775 * - "del_rx <CID> <TID> <reason>" to trigger DELBA for Rx side
780 struct wil6210_priv *wil = file->private_data; in wil_write_back()
787 return -ENOMEM; in wil_write_back()
792 return rc >= 0 ? -EIO : rc; in wil_write_back()
802 return -EINVAL; in wil_write_back()
810 return -EINVAL; in wil_write_back()
812 txdata = &wil->ring_tx_data[p1]; in wil_write_back()
816 return -EINVAL; in wil_write_back()
820 wmi_addba(wil, txdata->mid, p1, p2, p3); in wil_write_back()
824 wmi_delba_tx(wil, txdata->mid, p1, p2); in wil_write_back()
832 return -EINVAL; in wil_write_back()
834 if (p1 < 0 || p1 >= wil->max_assoc_sta) { in wil_write_back()
836 return -EINVAL; in wil_write_back()
840 sta = &wil->sta[p1]; in wil_write_back()
841 wmi_delba_rx(wil, sta->mid, p1, p2, p3); in wil_write_back()
844 return -EINVAL; in wil_write_back()
854 " - \"add <ringid> <agg_size> <timeout>\" to trigger ADDBA\n" in wil_read_back()
856 " - \"del_tx <ringid> <reason>\" to trigger DELBA for Tx side\n" in wil_read_back()
857 " - \"del_rx <CID> <TID> <reason>\" to trigger DELBA for Rx side\n" in wil_read_back()
871 * - "alloc <num descriptors> <descriptor_size>" to allocate PMC
872 * - "free" to release memory allocated for PMC
877 struct wil6210_priv *wil = file->private_data; in wil_write_pmccfg()
884 return -ENOMEM; in wil_write_pmccfg()
889 return rc >= 0 ? -EIO : rc; in wil_write_pmccfg()
901 return -EINVAL; in wil_write_pmccfg()
907 return -EINVAL; in wil_write_pmccfg()
913 return -EINVAL; in wil_write_pmccfg()
918 return -EINVAL; in wil_write_pmccfg()
927 struct wil6210_priv *wil = file->private_data; in wil_read_pmccfg()
930 " - \"alloc <num descriptors> <descriptor_size>\" to allocate pmc\n" in wil_read_pmccfg()
931 " - \"free\" to free memory allocated for pmc\n"; in wil_read_pmccfg()
954 return single_open(file, wil_pmcring_read, inode->i_private); in wil_pmcring_seq_open()
964 /*---tx_mgmt---*/
969 struct wil6210_priv *wil = file->private_data; in wil_write_file_txmgmt()
971 struct wireless_dev *wdev = wil->main_ndev->ieee80211_ptr; in wil_write_file_txmgmt()
979 return -EINVAL; in wil_write_file_txmgmt()
991 wil_info(wil, "-> %d\n", rc); in wil_write_file_txmgmt()
1007 struct wil6210_priv *wil = file->private_data; in wil_write_file_wmi()
1008 struct wil6210_vif *vif = ndev_to_vif(wil->main_ndev); in wil_write_file_wmi()
1011 int cmdlen = len - sizeof(struct wmi_cmd_hdr); in wil_write_file_wmi()
1016 return -EINVAL; in wil_write_file_wmi()
1023 cmdid = le16_to_cpu(wmi->command_id); in wil_write_file_wmi()
1025 rc1 = wmi_send(wil, cmdid, vif->mid, cmd, cmdlen); in wil_write_file_wmi()
1028 wil_info(wil, "0x%04x[%d] -> %d\n", cmdid, cmdlen, rc1); in wil_write_file_wmi()
1042 void *p = skb->data; in wil_seq_print_skb()
1043 int nr_frags = skb_shinfo(skb)->nr_frags; in wil_seq_print_skb()
1051 const skb_frag_t *frag = &skb_shinfo(skb)->frags[i]; in wil_seq_print_skb()
1061 /*---------Tx/Rx descriptor------------*/
1064 struct wil6210_priv *wil = s->private; in txdesc_show()
1073 if (wil->use_enhanced_dma_hw) { in txdesc_show()
1074 /* RX ring index == 0 */ in txdesc_show()
1079 tx = ring_idx > 0; /* desc ring 0 is reserved for RX */ in txdesc_show()
1081 /* RX ring index == WIL6210_MAX_TX_RINGS */ in txdesc_show()
1089 ring = tx ? &wil->ring_tx[ring_idx] : &wil->ring_rx; in txdesc_show()
1091 if (!ring->va) { in txdesc_show()
1095 seq_puts(s, "No Rx RING\n"); in txdesc_show()
1099 if (txdesc_idx >= ring->size) { in txdesc_show()
1102 ring_idx, txdesc_idx, ring->size); in txdesc_show()
1105 txdesc_idx, ring->size); in txdesc_show()
1109 /* use struct vring_tx_desc for Rx as well, in txdesc_show()
1112 d = &ring->va[txdesc_idx].tx.legacy; in txdesc_show()
1116 if (wil->use_enhanced_dma_hw) { in txdesc_show()
1118 skb = ring->ctx ? ring->ctx[txdesc_idx].skb : NULL; in txdesc_show()
1119 } else if (wil->rx_buff_mgmt.buff_arr) { in txdesc_show()
1122 &ring->va[txdesc_idx].rx.enhanced; in txdesc_show()
1123 u16 buff_id = le16_to_cpu(rx_d->mac.buff_id); in txdesc_show()
1126 wil->rx_buff_mgmt.size)) in txdesc_show()
1129 skb = wil->rx_buff_mgmt.buff_arr[buff_id].skb; in txdesc_show()
1132 skb = ring->ctx[txdesc_idx].skb; in txdesc_show()
1138 seq_printf(s, "Rx[%3d] = {\n", txdesc_idx); in txdesc_show()
1156 /*---------Tx/Rx status message------------*/
1159 struct wil6210_priv *wil = s->private; in status_msg_show()
1171 sring = &wil->srings[sring_idx]; in status_msg_show()
1172 tx = !sring->is_rx; in status_msg_show()
1174 if (!sring->va) { in status_msg_show()
1179 if (status_msg_idx >= sring->size) { in status_msg_show()
1181 tx ? 'T' : 'R', status_msg_idx, sring->size); in status_msg_show()
1185 u = sring->va + (sring->elem_size * status_msg_idx); in status_msg_show()
1192 if (!tx && !wil->use_compressed_rx_status) in status_msg_show()
1210 seq_printf(s, "[%4d] ", it->id); in wil_print_rx_buff()
1220 struct wil6210_priv *wil = s->private; in rx_buff_mgmt_show()
1221 struct wil_rx_buff_mgmt *rbm = &wil->rx_buff_mgmt; in rx_buff_mgmt_show()
1225 if (!rbm->buff_arr) in rx_buff_mgmt_show()
1226 return -EINVAL; in rx_buff_mgmt_show()
1228 seq_printf(s, " size = %zu\n", rbm->size); in rx_buff_mgmt_show()
1230 rbm->free_list_empty_cnt); in rx_buff_mgmt_show()
1234 num_active = wil_print_rx_buff(s, &rbm->active); in rx_buff_mgmt_show()
1236 num_free = wil_print_rx_buff(s, &rbm->free); in rx_buff_mgmt_show()
1245 /*---------beamforming------------*/
1262 /* if reply is all-0, ignore this CID */ in is_all_zeros()
1277 struct wil6210_priv *wil = s->private; in bf_show()
1278 struct wil6210_vif *vif = ndev_to_vif(wil->main_ndev); in bf_show()
1284 struct wmi_notify_req_done_event evt; in bf_show() member
1289 for (i = 0; i < wil->max_assoc_sta; i++) { in bf_show()
1294 rc = wmi_call(wil, WMI_NOTIFY_REQ_CMDID, vif->mid, in bf_show()
1298 /* if reply is all-0, ignore this CID */ in bf_show()
1299 if (rc || is_all_zeros(&reply.evt, sizeof(reply.evt))) in bf_show()
1302 status = le32_to_cpu(reply.evt.status); in bf_show()
1303 bf_mcs = le16_to_cpu(reply.evt.bf_mcs); in bf_show()
1310 " Sectors(rx:tx) my %2d:%2d peer %2d:%2d\n" in bf_show()
1311 " Goodput(rx:tx) %4d:%4d\n" in bf_show()
1314 le64_to_cpu(reply.evt.tsf), in bf_show()
1316 le32_to_cpu(reply.evt.tx_tpt), in bf_show()
1317 reply.evt.sqi, in bf_show()
1318 reply.evt.rssi, in bf_show()
1320 le16_to_cpu(reply.evt.my_rx_sector), in bf_show()
1321 le16_to_cpu(reply.evt.my_tx_sector), in bf_show()
1322 le16_to_cpu(reply.evt.other_rx_sector), in bf_show()
1323 le16_to_cpu(reply.evt.other_tx_sector), in bf_show()
1324 le32_to_cpu(reply.evt.rx_goodput), in bf_show()
1325 le32_to_cpu(reply.evt.tx_goodput)); in bf_show()
1331 /*---------temp------------*/
1340 seq_printf(s, "%s %s%d.%03d\n", prefix, (t < 0 ? "-" : ""), in print_temp()
1348 struct wil6210_priv *wil = s->private; in temp_show()
1352 wil->fw_capabilities)) { in temp_show()
1388 /*---------link------------*/
1391 struct wil6210_priv *wil = s->private; in link_show()
1397 return -ENOMEM; in link_show()
1399 for (i = 0; i < wil->max_assoc_sta; i++) { in link_show()
1400 struct wil_sta_info *p = &wil->sta[i]; in link_show()
1405 switch (p->status) { in link_show()
1416 mid = (p->status != wil_sta_unused) ? p->mid : U8_MAX; in link_show()
1418 i, mid, p->addr, status); in link_show()
1420 if (p->status != wil_sta_connected) in link_show()
1423 vif = (mid < GET_MAX_VIFS(wil)) ? wil->vifs[mid] : NULL; in link_show()
1430 WIL_EXTENDED_MCS_CHECK(sinfo->txrate.mcs)); in link_show()
1432 WIL_EXTENDED_MCS_CHECK(sinfo->rxrate.mcs)); in link_show()
1433 seq_printf(s, " SQ = %d\n", sinfo->signal); in link_show()
1445 /*---------info------------*/
1448 struct wil6210_priv *wil = s->private; in info_show()
1449 struct net_device *ndev = wil->main_ndev; in info_show()
1451 int rx = atomic_xchg(&wil->isr_count_rx, 0); in info_show() local
1452 int tx = atomic_xchg(&wil->isr_count_tx, 0); in info_show()
1454 ulong rxf = ndev->stats.rx_packets; in info_show()
1455 ulong txf = ndev->stats.tx_packets; in info_show()
1460 seq_printf(s, "Rx irqs:packets : %8d : %8ld\n", rx, rxf - rxf_old); in info_show()
1461 seq_printf(s, "Tx irqs:packets : %8d : %8ld\n", tx, txf - txf_old); in info_show()
1468 for (i = 0; i < ndev->num_tx_queues; i++) { in info_show()
1470 unsigned long state = txq->state; in info_show()
1483 /*---------recovery------------*/
1490 struct wil6210_priv *wil = file->private_data; in wil_read_file_recovery()
1497 sstate[wil->recovery_state]); in wil_read_file_recovery()
1509 struct wil6210_priv *wil = file->private_data; in wil_write_file_recovery()
1514 if (wil->recovery_state != fw_recovery_pending) { in wil_write_file_recovery()
1516 return -EINVAL; in wil_write_file_recovery()
1521 return -EINVAL; in wil_write_file_recovery()
1526 return -EINVAL; in wil_write_file_recovery()
1529 rc = simple_write_to_buffer(buf, sizeof(buf) - 1, ppos, buf_, count); in wil_write_file_recovery()
1548 /*---------Station matrix------------*/
1552 u16 index = ((r->head_seq_num - r->ssn) & 0xfff) % r->buf_size; in wil_print_rxtid()
1553 unsigned long long drop_dup = r->drop_dup, drop_old = r->drop_old; in wil_print_rxtid()
1554 unsigned long long drop_dup_mcast = r->drop_dup_mcast; in wil_print_rxtid()
1556 seq_printf(s, "([%2d]) 0x%03x [", r->buf_size, r->head_seq_num); in wil_print_rxtid()
1557 for (i = 0; i < r->buf_size; i++) { in wil_print_rxtid()
1559 seq_printf(s, "%c", r->reorder_buf[i] ? 'O' : '|'); in wil_print_rxtid()
1561 seq_printf(s, "%c", r->reorder_buf[i] ? '*' : '_'); in wil_print_rxtid()
1565 r->total, drop_dup + drop_old + drop_dup_mcast, drop_dup, in wil_print_rxtid()
1566 drop_old, drop_dup_mcast, r->ssn_last_drop); in wil_print_rxtid()
1575 struct wil_tid_crypto_rx_single *cc = &c->key_id[i]; in wil_print_rxtid_crypto()
1577 if (cc->key_set) in wil_print_rxtid_crypto()
1589 struct wil_tid_crypto_rx_single *cc = &c->key_id[i]; in wil_print_rxtid_crypto()
1591 seq_printf(s, " [%i%s]%6phN", i, cc->key_set ? "+" : "-", in wil_print_rxtid_crypto()
1592 cc->pn); in wil_print_rxtid_crypto()
1598 __acquires(&p->tid_rx_lock) __releases(&p->tid_rx_lock) in sta_show()
1600 struct wil6210_priv *wil = s->private; in sta_show()
1603 for (i = 0; i < wil->max_assoc_sta; i++) { in sta_show()
1604 struct wil_sta_info *p = &wil->sta[i]; in sta_show()
1610 switch (p->status) { in sta_show()
1619 aid = p->aid; in sta_show()
1622 mid = (p->status != wil_sta_unused) ? p->mid : U8_MAX; in sta_show()
1624 struct wil6210_vif *vif = wil->vifs[mid]; in sta_show()
1626 if (vif->wdev.iftype == NL80211_IFTYPE_STATION && in sta_show()
1627 p->status == wil_sta_connected) in sta_show()
1633 i, p->addr, p->stats.ft_roams, mid, aid); in sta_show()
1636 p->addr, status, mid, aid); in sta_show()
1638 if (p->status == wil_sta_connected) { in sta_show()
1639 spin_lock_bh(&p->tid_rx_lock); in sta_show()
1641 struct wil_tid_ampdu_rx *r = p->tid_rx[tid]; in sta_show()
1643 &p->tid_crypto_rx[tid]; in sta_show()
1653 &p->group_crypto_rx); in sta_show()
1654 spin_unlock_bh(&p->tid_rx_lock); in sta_show()
1656 "Rx invalid frame: non-data %lu, short %lu, large %lu, replay %lu\n", in sta_show()
1657 p->stats.rx_non_data_frame, in sta_show()
1658 p->stats.rx_short_frame, in sta_show()
1659 p->stats.rx_large_frame, in sta_show()
1660 p->stats.rx_replay); in sta_show()
1663 p->stats.rx_mic_error, in sta_show()
1664 p->stats.rx_key_error, in sta_show()
1665 p->stats.rx_amsdu_error, in sta_show()
1666 p->stats.rx_csum_err); in sta_show()
1668 seq_puts(s, "Rx/MCS:"); in sta_show()
1669 for (mcs = 0; mcs < ARRAY_SIZE(p->stats.rx_per_mcs); in sta_show()
1672 p->stats.rx_per_mcs[mcs]); in sta_show()
1683 struct wil6210_priv *wil = s->private; in mids_show()
1688 mutex_lock(&wil->vif_mutex); in mids_show()
1690 vif = wil->vifs[i]; in mids_show()
1694 seq_printf(s, "[%d] %pM %s\n", i, ndev->dev_addr, in mids_show()
1695 ndev->name); in mids_show()
1700 mutex_unlock(&wil->vif_mutex); in mids_show()
1707 __acquires(&p->tid_rx_lock) __releases(&p->tid_rx_lock) in wil_tx_latency_debugfs_show()
1709 struct wil6210_priv *wil = s->private; in wil_tx_latency_debugfs_show()
1712 for (i = 0; i < wil->max_assoc_sta; i++) { in wil_tx_latency_debugfs_show()
1713 struct wil_sta_info *p = &wil->sta[i]; in wil_tx_latency_debugfs_show()
1718 if (!p->tx_latency_bins) in wil_tx_latency_debugfs_show()
1721 switch (p->status) { in wil_tx_latency_debugfs_show()
1730 aid = p->aid; in wil_tx_latency_debugfs_show()
1733 mid = (p->status != wil_sta_unused) ? p->mid : U8_MAX; in wil_tx_latency_debugfs_show()
1734 seq_printf(s, "[%d] %pM %s MID %d AID %d\n", i, p->addr, status, in wil_tx_latency_debugfs_show()
1737 if (p->status == wil_sta_connected) { in wil_tx_latency_debugfs_show()
1739 u64 tx_latency_avg = p->stats.tx_latency_total_us; in wil_tx_latency_debugfs_show()
1744 p->tx_latency_bins[bin]); in wil_tx_latency_debugfs_show()
1745 num_packets += p->tx_latency_bins[bin]; in wil_tx_latency_debugfs_show()
1752 p->stats.tx_latency_min_us, in wil_tx_latency_debugfs_show()
1754 p->stats.tx_latency_max_us); in wil_tx_latency_debugfs_show()
1766 inode->i_private); in wil_tx_latency_seq_open()
1772 struct seq_file *s = file->private_data; in wil_tx_latency_write()
1773 struct wil6210_priv *wil = s->private; in wil_tx_latency_write()
1787 return -EINVAL; in wil_tx_latency_write()
1791 if (wil->tx_latency == enable) in wil_tx_latency_write()
1800 wil->tx_latency_res = val; in wil_tx_latency_write()
1801 for (i = 0; i < wil->max_assoc_sta; i++) { in wil_tx_latency_write()
1802 struct wil_sta_info *sta = &wil->sta[i]; in wil_tx_latency_write()
1804 kfree(sta->tx_latency_bins); in wil_tx_latency_write()
1805 sta->tx_latency_bins = kzalloc(sz, GFP_KERNEL); in wil_tx_latency_write()
1806 if (!sta->tx_latency_bins) in wil_tx_latency_write()
1807 return -ENOMEM; in wil_tx_latency_write()
1808 sta->stats.tx_latency_min_us = U32_MAX; in wil_tx_latency_write()
1809 sta->stats.tx_latency_max_us = 0; in wil_tx_latency_write()
1810 sta->stats.tx_latency_total_us = 0; in wil_tx_latency_write()
1813 wil->tx_latency = enable; in wil_tx_latency_write()
1832 if (basic->per_average != 0xff) in wil_link_stats_print_basic()
1833 snprintf(per, sizeof(per), "%d%%", basic->per_average); in wil_link_stats_print_basic()
1837 "\tGoodput(rx:tx) %d:%d\n" in wil_link_stats_print_basic()
1840 "\tRx RFC %d Ant num %d\n" in wil_link_stats_print_basic()
1841 "\tSectors(rx:tx) my %d:%d peer %d:%d\n" in wil_link_stats_print_basic()
1843 basic->cid, in wil_link_stats_print_basic()
1844 WIL_EXTENDED_MCS_CHECK(basic->bf_mcs), in wil_link_stats_print_basic()
1845 le32_to_cpu(basic->tx_tpt), in wil_link_stats_print_basic()
1846 le32_to_cpu(basic->rx_goodput), in wil_link_stats_print_basic()
1847 le32_to_cpu(basic->tx_goodput), in wil_link_stats_print_basic()
1848 le32_to_cpu(basic->rx_bcast_frames), in wil_link_stats_print_basic()
1849 basic->rssi, basic->sqi, basic->snr, per, in wil_link_stats_print_basic()
1850 basic->selected_rfc, basic->rx_effective_ant_num, in wil_link_stats_print_basic()
1851 basic->my_rx_sector, basic->my_tx_sector, in wil_link_stats_print_basic()
1852 basic->other_rx_sector, basic->other_tx_sector); in wil_link_stats_print_basic()
1859 seq_printf(s, "Frames(rx:tx) %d:%d\n" in wil_link_stats_print_global()
1860 "BA Frames(rx:tx) %d:%d\n" in wil_link_stats_print_global()
1862 "Rx Errors (MIC:CRC) %d:%d\n" in wil_link_stats_print_global()
1864 le32_to_cpu(global->rx_frames), in wil_link_stats_print_global()
1865 le32_to_cpu(global->tx_frames), in wil_link_stats_print_global()
1866 le32_to_cpu(global->rx_ba_frames), in wil_link_stats_print_global()
1867 le32_to_cpu(global->tx_ba_frames), in wil_link_stats_print_global()
1868 le32_to_cpu(global->tx_beacons), in wil_link_stats_print_global()
1869 le32_to_cpu(global->rx_mic_errors), in wil_link_stats_print_global()
1870 le32_to_cpu(global->rx_crc_errors), in wil_link_stats_print_global()
1871 le32_to_cpu(global->tx_fail_no_ack)); in wil_link_stats_print_global()
1881 if (!vif->fw_stats_ready) { in wil_link_stats_debugfs_show_vif()
1886 seq_printf(s, "TSF %lld\n", vif->fw_stats_tsf); in wil_link_stats_debugfs_show_vif()
1887 for (i = 0; i < wil->max_assoc_sta; i++) { in wil_link_stats_debugfs_show_vif()
1888 if (wil->sta[i].status == wil_sta_unused) in wil_link_stats_debugfs_show_vif()
1890 if (wil->sta[i].mid != vif->mid) in wil_link_stats_debugfs_show_vif()
1893 stats = &wil->sta[i].fw_stats_basic; in wil_link_stats_debugfs_show_vif()
1900 struct wil6210_priv *wil = s->private; in wil_link_stats_debugfs_show()
1904 rc = mutex_lock_interruptible(&wil->vif_mutex); in wil_link_stats_debugfs_show()
1908 /* iterate over all MIDs and show per-cid statistics. Then show the in wil_link_stats_debugfs_show()
1912 vif = wil->vifs[i]; in wil_link_stats_debugfs_show()
1923 mutex_unlock(&wil->vif_mutex); in wil_link_stats_debugfs_show()
1930 return single_open(file, wil_link_stats_debugfs_show, inode->i_private); in wil_link_stats_seq_open()
1936 struct seq_file *s = file->private_data; in wil_link_stats_write()
1937 struct wil6210_priv *wil = s->private; in wil_link_stats_write()
1943 return -ENOMEM; in wil_link_stats_write()
1948 return rc >= 0 ? -EIO : rc; in wil_link_stats_write()
1952 /* specify cid (use -1 for all cids) and snapshot interval in ms */ in wil_link_stats_write()
1958 return -EINVAL; in wil_link_stats_write()
1963 rc = mutex_lock_interruptible(&wil->vif_mutex); in wil_link_stats_write()
1968 vif = wil->vifs[i]; in wil_link_stats_write()
1973 (cid == -1 ? 0xff : cid), interval); in wil_link_stats_write()
1977 mutex_unlock(&wil->vif_mutex); in wil_link_stats_write()
1993 struct wil6210_priv *wil = s->private; in wil_link_stats_global_debugfs_show()
1995 if (!wil->fw_stats_global.ready) in wil_link_stats_global_debugfs_show()
1998 seq_printf(s, "TSF %lld\n", wil->fw_stats_global.tsf); in wil_link_stats_global_debugfs_show()
1999 wil_link_stats_print_global(wil, s, &wil->fw_stats_global.stats); in wil_link_stats_global_debugfs_show()
2008 inode->i_private); in wil_link_stats_global_seq_open()
2015 struct seq_file *s = file->private_data; in wil_link_stats_global_write()
2016 struct wil6210_priv *wil = s->private; in wil_link_stats_global_write()
2018 struct wil6210_vif *vif = ndev_to_vif(wil->main_ndev); in wil_link_stats_global_write()
2024 return -EINVAL; in wil_link_stats_global_write()
2064 struct wil6210_priv *wil = file->private_data; in wil_write_file_led_cfg()
2102 return -ENOMEM; in wil_write_led_blink_time()
2107 return rc >= 0 ? -EIO : rc; in wil_write_led_blink_time()
2123 return -EINVAL; in wil_write_led_blink_time()
2156 /*---------FW capabilities------------*/
2159 struct wil6210_priv *wil = s->private; in wil_fw_capabilities_debugfs_show()
2162 wil->fw_capabilities); in wil_fw_capabilities_debugfs_show()
2170 inode->i_private); in wil_fw_capabilities_seq_open()
2180 /*---------FW version------------*/
2183 struct wil6210_priv *wil = s->private; in wil_fw_version_debugfs_show()
2185 if (wil->fw_version[0]) in wil_fw_version_debugfs_show()
2186 seq_printf(s, "%s\n", wil->fw_version); in wil_fw_version_debugfs_show()
2196 inode->i_private); in wil_fw_version_seq_open()
2206 /*---------suspend_stats---------*/
2211 struct wil6210_priv *wil = file->private_data; in wil_write_suspend_stats()
2213 memset(&wil->suspend_stats, 0, sizeof(wil->suspend_stats)); in wil_write_suspend_stats()
2222 struct wil6210_priv *wil = file->private_data; in wil_read_suspend_stats()
2228 return -ENOMEM; in wil_read_suspend_stats()
2240 wil->suspend_stats.r_on.successful_suspends, in wil_read_suspend_stats()
2241 wil->suspend_stats.r_on.failed_suspends, in wil_read_suspend_stats()
2242 wil->suspend_stats.r_on.successful_resumes, in wil_read_suspend_stats()
2243 wil->suspend_stats.r_on.failed_resumes, in wil_read_suspend_stats()
2244 wil->suspend_stats.rejected_by_device, in wil_read_suspend_stats()
2245 wil->suspend_stats.r_off.successful_suspends, in wil_read_suspend_stats()
2246 wil->suspend_stats.r_off.failed_suspends, in wil_read_suspend_stats()
2247 wil->suspend_stats.r_off.successful_resumes, in wil_read_suspend_stats()
2248 wil->suspend_stats.r_off.failed_resumes, in wil_read_suspend_stats()
2249 wil->suspend_stats.rejected_by_host); in wil_read_suspend_stats()
2266 /*---------compressed_rx_status---------*/
2271 struct seq_file *s = file->private_data; in wil_compressed_rx_status_write()
2272 struct wil6210_priv *wil = s->private; in wil_compressed_rx_status_write()
2284 return -EPERM; in wil_compressed_rx_status_write()
2290 wil->use_compressed_rx_status = compressed_rx_status; in wil_compressed_rx_status_write()
2298 struct wil6210_priv *wil = s->private; in wil_compressed_rx_status_show()
2300 seq_printf(s, "%d\n", wil->use_compressed_rx_status); in wil_compressed_rx_status_show()
2309 inode->i_private); in wil_compressed_rx_status_seq_open()
2320 /*----------------*/
2328 struct wil_blob_wrapper *wil_blob = &wil->blobs[i]; in wil6210_debugfs_init_blobs()
2329 struct debugfs_blob_wrapper *blob = &wil_blob->blob; in wil6210_debugfs_init_blobs()
2332 if (!map->name) in wil6210_debugfs_init_blobs()
2335 wil_blob->wil = wil; in wil6210_debugfs_init_blobs()
2336 blob->data = (void * __force)wil->csr + HOSTADDR(map->host); in wil6210_debugfs_init_blobs()
2337 blob->size = map->to - map->from; in wil6210_debugfs_init_blobs()
2338 snprintf(name, sizeof(name), "blob_%s", map->name); in wil6210_debugfs_init_blobs()
2454 static const int dbg_off_count = 4 * (ARRAY_SIZE(isr_off) - 1) +
2455 ARRAY_SIZE(dbg_wil_regs) - 1 +
2456 ARRAY_SIZE(pseudo_isr_off) - 1 +
2457 ARRAY_SIZE(lgc_itr_cnt_off) - 1 +
2458 ARRAY_SIZE(tx_itr_cnt_off) - 1 +
2459 ARRAY_SIZE(rx_itr_cnt_off) - 1;
2463 struct dentry *dbg = wil->debug = debugfs_create_dir(WIL_NAME, in wil6210_debugfs_init()
2464 wil_to_wiphy(wil)->debugfsdir); in wil6210_debugfs_init()
2466 return -ENODEV; in wil6210_debugfs_init()
2468 wil->dbg_data.data_arr = kcalloc(dbg_off_count, in wil6210_debugfs_init()
2471 if (!wil->dbg_data.data_arr) { in wil6210_debugfs_init()
2473 wil->debug = NULL; in wil6210_debugfs_init()
2474 return -ENOMEM; in wil6210_debugfs_init()
2477 wil->dbg_data.iomem_data_count = 0; in wil6210_debugfs_init()
2485 wil6210_debugfs_init_offset(wil, dbg, (void * __force)wil->csr, in wil6210_debugfs_init()
2500 debugfs_remove_recursive(wil->debug); in wil6210_debugfs_remove()
2501 wil->debug = NULL; in wil6210_debugfs_remove()
2503 kfree(wil->dbg_data.data_arr); in wil6210_debugfs_remove()
2504 for (i = 0; i < wil->max_assoc_sta; i++) in wil6210_debugfs_remove()
2505 kfree(wil->sta[i].tx_latency_bins); in wil6210_debugfs_remove()