Skip to content

Commit

Permalink
mt76: testmode: switch ib and wb rssi to array type for per-antenna r…
Browse files Browse the repository at this point in the history
…eport

Change ib_rssi and wb_rssi into array type, since they could be reported
by per-antenna.

Reviewed-by: Ryder Lee <[email protected]>
Signed-off-by: Shayne Chen <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]> [update tools/]
  • Loading branch information
csyuanc authored and nbd168 committed Nov 10, 2020
1 parent b9f9c16 commit cdeb1b2
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 13 deletions.
4 changes: 2 additions & 2 deletions mt7615/mac.c
Original file line number Diff line number Diff line change
Expand Up @@ -215,8 +215,8 @@ static void mt7615_mac_fill_tm_rx(struct mt7615_dev *dev, __le32 *rxv)
dev->test.last_rcpi[1] = FIELD_GET(MT_RXV4_RCPI1, rxv4);
dev->test.last_rcpi[2] = FIELD_GET(MT_RXV4_RCPI2, rxv4);
dev->test.last_rcpi[3] = FIELD_GET(MT_RXV4_RCPI3, rxv4);
dev->test.last_ib_rssi = FIELD_GET(MT_RXV3_IB_RSSI, rxv3);
dev->test.last_wb_rssi = FIELD_GET(MT_RXV3_WB_RSSI, rxv3);
dev->test.last_ib_rssi[0] = FIELD_GET(MT_RXV3_IB_RSSI, rxv3);
dev->test.last_wb_rssi[0] = FIELD_GET(MT_RXV3_WB_RSSI, rxv3);
#endif
}

Expand Down
4 changes: 2 additions & 2 deletions mt7615/mt7615.h
Original file line number Diff line number Diff line change
Expand Up @@ -295,8 +295,8 @@ struct mt7615_dev {

s16 last_freq_offset;
u8 last_rcpi[4];
s8 last_ib_rssi;
s8 last_wb_rssi;
s8 last_ib_rssi[4];
s8 last_wb_rssi[4];
} test;
#endif

Expand Down
24 changes: 21 additions & 3 deletions mt7615/testmode.c
Original file line number Diff line number Diff line change
Expand Up @@ -335,9 +335,7 @@ mt7615_tm_dump_stats(struct mt76_dev *mdev, struct sk_buff *msg)
if (!rx)
return -ENOMEM;

if (nla_put_s32(msg, MT76_TM_RX_ATTR_FREQ_OFFSET, dev->test.last_freq_offset) ||
nla_put_s32(msg, MT76_TM_RX_ATTR_IB_RSSI, dev->test.last_ib_rssi) ||
nla_put_s32(msg, MT76_TM_RX_ATTR_WB_RSSI, dev->test.last_wb_rssi))
if (nla_put_s32(msg, MT76_TM_RX_ATTR_FREQ_OFFSET, dev->test.last_freq_offset))
return -ENOMEM;

rssi = nla_nest_start(msg, MT76_TM_RX_ATTR_RCPI);
Expand All @@ -350,6 +348,26 @@ mt7615_tm_dump_stats(struct mt76_dev *mdev, struct sk_buff *msg)

nla_nest_end(msg, rssi);

rssi = nla_nest_start(msg, MT76_TM_RX_ATTR_IB_RSSI);
if (!rssi)
return -ENOMEM;

for (i = 0; i < ARRAY_SIZE(dev->test.last_ib_rssi); i++)
if (nla_put_s8(msg, i, dev->test.last_ib_rssi[i]))
return -ENOMEM;

nla_nest_end(msg, rssi);

rssi = nla_nest_start(msg, MT76_TM_RX_ATTR_WB_RSSI);
if (!rssi)
return -ENOMEM;

for (i = 0; i < ARRAY_SIZE(dev->test.last_wb_rssi); i++)
if (nla_put_s8(msg, i, dev->test.last_wb_rssi[i]))
return -ENOMEM;

nla_nest_end(msg, rssi);

nla_nest_end(msg, rx);

return 0;
Expand Down
4 changes: 2 additions & 2 deletions testmode.h
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,8 @@ enum mt76_testmode_stats_attr {
*
* @MT76_TM_RX_ATTR_FREQ_OFFSET: frequency offset (s32)
* @MT76_TM_RX_ATTR_RCPI: received channel power indicator (array, u8)
* @MT76_TM_RX_ATTR_IB_RSSI: internal inband RSSI (s8)
* @MT76_TM_RX_ATTR_WB_RSSI: internal wideband RSSI (s8)
* @MT76_TM_RX_ATTR_IB_RSSI: internal inband RSSI (array, s8)
* @MT76_TM_RX_ATTR_WB_RSSI: internal wideband RSSI (array, s8)
*/
enum mt76_testmode_rx_attr {
MT76_TM_RX_ATTR_UNSPEC,
Expand Down
8 changes: 4 additions & 4 deletions tools/fields.c
Original file line number Diff line number Diff line change
Expand Up @@ -250,14 +250,14 @@ static void print_extra_stats(const struct tm_field *field, struct nlattr **tb)
static const struct tm_field rx_fields[NUM_MT76_TM_RX_ATTRS] = {
FIELD_RO(s32, FREQ_OFFSET, "freq_offset"),
FIELD_ARRAY_RO(u8, RCPI, "rcpi"),
FIELD_RO(s8, IB_RSSI, "ib_rssi"),
FIELD_RO(s8, WB_RSSI, "wb_rssi"),
FIELD_ARRAY_RO(s8, IB_RSSI, "ib_rssi"),
FIELD_ARRAY_RO(s8, WB_RSSI, "wb_rssi"),
};
static struct nla_policy rx_policy[NUM_MT76_TM_RX_ATTRS] = {
[MT76_TM_RX_ATTR_FREQ_OFFSET] = { .type = NLA_U32 },
[MT76_TM_RX_ATTR_RCPI] = { .type = NLA_NESTED },
[MT76_TM_RX_ATTR_IB_RSSI] = { .type = NLA_U8 },
[MT76_TM_RX_ATTR_WB_RSSI] = { .type = NLA_U8 },
[MT76_TM_RX_ATTR_IB_RSSI] = { .type = NLA_NESTED },
[MT76_TM_RX_ATTR_WB_RSSI] = { .type = NLA_NESTED },
};
#undef FIELD_NAME

Expand Down

0 comments on commit cdeb1b2

Please sign in to comment.