.. | .. |
---|
| 1 | +// SPDX-License-Identifier: ISC |
---|
1 | 2 | /* |
---|
2 | 3 | * Copyright (C) 2016 Felix Fietkau <nbd@nbd.name> |
---|
3 | | - * |
---|
4 | | - * Permission to use, copy, modify, and/or distribute this software for any |
---|
5 | | - * purpose with or without fee is hereby granted, provided that the above |
---|
6 | | - * copyright notice and this permission notice appear in all copies. |
---|
7 | | - * |
---|
8 | | - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES |
---|
9 | | - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF |
---|
10 | | - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR |
---|
11 | | - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES |
---|
12 | | - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN |
---|
13 | | - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
---|
14 | | - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
---|
15 | 4 | */ |
---|
16 | 5 | #include "mt76.h" |
---|
17 | 6 | |
---|
.. | .. |
---|
20 | 9 | { |
---|
21 | 10 | struct mt76_dev *dev = data; |
---|
22 | 11 | |
---|
23 | | - dev->bus->wr(dev, dev->debugfs_reg, val); |
---|
| 12 | + __mt76_wr(dev, dev->debugfs_reg, val); |
---|
24 | 13 | return 0; |
---|
25 | 14 | } |
---|
26 | 15 | |
---|
.. | .. |
---|
29 | 18 | { |
---|
30 | 19 | struct mt76_dev *dev = data; |
---|
31 | 20 | |
---|
32 | | - *val = dev->bus->rr(dev, dev->debugfs_reg); |
---|
| 21 | + *val = __mt76_rr(dev, dev->debugfs_reg); |
---|
33 | 22 | return 0; |
---|
34 | 23 | } |
---|
35 | 24 | |
---|
36 | 25 | DEFINE_DEBUGFS_ATTRIBUTE(fops_regval, mt76_reg_get, mt76_reg_set, |
---|
37 | 26 | "0x%08llx\n"); |
---|
38 | 27 | |
---|
39 | | -static int |
---|
40 | | -mt76_queues_read(struct seq_file *s, void *data) |
---|
| 28 | +int mt76_queues_read(struct seq_file *s, void *data) |
---|
41 | 29 | { |
---|
42 | 30 | struct mt76_dev *dev = dev_get_drvdata(s->private); |
---|
43 | 31 | int i; |
---|
44 | 32 | |
---|
45 | 33 | for (i = 0; i < ARRAY_SIZE(dev->q_tx); i++) { |
---|
46 | | - struct mt76_queue *q = &dev->q_tx[i]; |
---|
| 34 | + struct mt76_queue *q = dev->q_tx[i]; |
---|
47 | 35 | |
---|
48 | | - if (!q->ndesc) |
---|
| 36 | + if (!q) |
---|
49 | 37 | continue; |
---|
50 | 38 | |
---|
51 | 39 | seq_printf(s, |
---|
52 | | - "%d: queued=%d head=%d tail=%d swq_queued=%d\n", |
---|
53 | | - i, q->queued, q->head, q->tail, q->swq_queued); |
---|
| 40 | + "%d: queued=%d head=%d tail=%d\n", |
---|
| 41 | + i, q->queued, q->head, q->tail); |
---|
54 | 42 | } |
---|
55 | 43 | |
---|
| 44 | + return 0; |
---|
| 45 | +} |
---|
| 46 | +EXPORT_SYMBOL_GPL(mt76_queues_read); |
---|
| 47 | + |
---|
| 48 | +static int mt76_rx_queues_read(struct seq_file *s, void *data) |
---|
| 49 | +{ |
---|
| 50 | + struct mt76_dev *dev = dev_get_drvdata(s->private); |
---|
| 51 | + int i, queued; |
---|
| 52 | + |
---|
| 53 | + mt76_for_each_q_rx(dev, i) { |
---|
| 54 | + struct mt76_queue *q = &dev->q_rx[i]; |
---|
| 55 | + |
---|
| 56 | + queued = mt76_is_usb(dev) ? q->ndesc - q->queued : q->queued; |
---|
| 57 | + seq_printf(s, "%d: queued=%d head=%d tail=%d\n", |
---|
| 58 | + i, queued, q->head, q->tail); |
---|
| 59 | + } |
---|
| 60 | + |
---|
| 61 | + return 0; |
---|
| 62 | +} |
---|
| 63 | + |
---|
| 64 | +void mt76_seq_puts_array(struct seq_file *file, const char *str, |
---|
| 65 | + s8 *val, int len) |
---|
| 66 | +{ |
---|
| 67 | + int i; |
---|
| 68 | + |
---|
| 69 | + seq_printf(file, "%10s:", str); |
---|
| 70 | + for (i = 0; i < len; i++) |
---|
| 71 | + seq_printf(file, " %2d", val[i]); |
---|
| 72 | + seq_puts(file, "\n"); |
---|
| 73 | +} |
---|
| 74 | +EXPORT_SYMBOL_GPL(mt76_seq_puts_array); |
---|
| 75 | + |
---|
| 76 | +static int mt76_read_rate_txpower(struct seq_file *s, void *data) |
---|
| 77 | +{ |
---|
| 78 | + struct mt76_dev *dev = dev_get_drvdata(s->private); |
---|
| 79 | + |
---|
| 80 | + mt76_seq_puts_array(s, "CCK", dev->rate_power.cck, |
---|
| 81 | + ARRAY_SIZE(dev->rate_power.cck)); |
---|
| 82 | + mt76_seq_puts_array(s, "OFDM", dev->rate_power.ofdm, |
---|
| 83 | + ARRAY_SIZE(dev->rate_power.ofdm)); |
---|
| 84 | + mt76_seq_puts_array(s, "STBC", dev->rate_power.stbc, |
---|
| 85 | + ARRAY_SIZE(dev->rate_power.stbc)); |
---|
| 86 | + mt76_seq_puts_array(s, "HT", dev->rate_power.ht, |
---|
| 87 | + ARRAY_SIZE(dev->rate_power.ht)); |
---|
| 88 | + mt76_seq_puts_array(s, "VHT", dev->rate_power.vht, |
---|
| 89 | + ARRAY_SIZE(dev->rate_power.vht)); |
---|
56 | 90 | return 0; |
---|
57 | 91 | } |
---|
58 | 92 | |
---|
.. | .. |
---|
71 | 105 | debugfs_create_blob("eeprom", 0400, dir, &dev->eeprom); |
---|
72 | 106 | if (dev->otp.data) |
---|
73 | 107 | debugfs_create_blob("otp", 0400, dir, &dev->otp); |
---|
74 | | - debugfs_create_devm_seqfile(dev->dev, "queues", dir, mt76_queues_read); |
---|
| 108 | + debugfs_create_devm_seqfile(dev->dev, "rate_txpower", dir, |
---|
| 109 | + mt76_read_rate_txpower); |
---|
| 110 | + debugfs_create_devm_seqfile(dev->dev, "rx-queues", dir, |
---|
| 111 | + mt76_rx_queues_read); |
---|
75 | 112 | |
---|
76 | 113 | return dir; |
---|
77 | 114 | } |
---|