Lines Matching refs:td
22 struct mt76_testmode_data *td = &dev->test; in mt76_testmode_tx_pending() local
24 struct sk_buff *skb = td->tx_skb; in mt76_testmode_tx_pending()
28 if (!skb || !td->tx_pending) in mt76_testmode_tx_pending()
36 while (td->tx_pending > 0 && td->tx_queued - td->tx_done < 1000 && in mt76_testmode_tx_pending()
44 td->tx_pending--; in mt76_testmode_tx_pending()
45 td->tx_queued++; in mt76_testmode_tx_pending()
57 struct mt76_testmode_data *td = &dev->test; in mt76_testmode_tx_init() local
66 if (td->tx_antenna_mask) in mt76_testmode_tx_init()
67 max_nss = min_t(u8, max_nss, hweight8(td->tx_antenna_mask)); in mt76_testmode_tx_init()
69 skb = alloc_skb(td->tx_msdu_len, GFP_KERNEL); in mt76_testmode_tx_init()
73 dev_kfree_skb(td->tx_skb); in mt76_testmode_tx_init()
74 td->tx_skb = skb; in mt76_testmode_tx_init()
75 hdr = __skb_put_zero(skb, td->tx_msdu_len); in mt76_testmode_tx_init()
87 rate->idx = td->tx_rate_idx; in mt76_testmode_tx_init()
89 switch (td->tx_rate_mode) { in mt76_testmode_tx_init()
118 if (td->tx_rate_nss > max_nss) in mt76_testmode_tx_init()
121 ieee80211_rate_set_vht(rate, td->tx_rate_idx, td->tx_rate_nss); in mt76_testmode_tx_init()
128 if (td->tx_rate_sgi) in mt76_testmode_tx_init()
131 if (td->tx_rate_ldpc) in mt76_testmode_tx_init()
134 if (td->tx_rate_mode >= MT76_TM_TX_MODE_HT) { in mt76_testmode_tx_init()
159 struct mt76_testmode_data *td = &dev->test; in mt76_testmode_tx_start() local
161 td->tx_queued = 0; in mt76_testmode_tx_start()
162 td->tx_done = 0; in mt76_testmode_tx_start()
163 td->tx_pending = td->tx_count; in mt76_testmode_tx_start()
170 struct mt76_testmode_data *td = &dev->test; in mt76_testmode_tx_stop() local
174 td->tx_pending = 0; in mt76_testmode_tx_stop()
178 wait_event_timeout(dev->tx_wait, td->tx_done == td->tx_queued, 10 * HZ); in mt76_testmode_tx_stop()
180 dev_kfree_skb(td->tx_skb); in mt76_testmode_tx_stop()
181 td->tx_skb = NULL; in mt76_testmode_tx_stop()
185 mt76_testmode_param_set(struct mt76_testmode_data *td, u16 idx) in mt76_testmode_param_set() argument
187 td->param_set[idx / 32] |= BIT(idx % 32); in mt76_testmode_param_set()
191 mt76_testmode_param_present(struct mt76_testmode_data *td, u16 idx) in mt76_testmode_param_present() argument
193 return td->param_set[idx / 32] & BIT(idx % 32); in mt76_testmode_param_present()
199 struct mt76_testmode_data *td = &dev->test; in mt76_testmode_init_defaults() local
201 if (td->tx_msdu_len > 0) in mt76_testmode_init_defaults()
204 td->tx_msdu_len = 1024; in mt76_testmode_init_defaults()
205 td->tx_count = 1; in mt76_testmode_init_defaults()
206 td->tx_rate_mode = MT76_TM_TX_MODE_OFDM; in mt76_testmode_init_defaults()
207 td->tx_rate_nss = 1; in mt76_testmode_init_defaults()
246 struct mt76_testmode_data *td = &dev->test; in mt76_testmode_set_state() local
249 if (state == td->state && state == MT76_TM_STATE_OFF) in mt76_testmode_set_state()
258 td->state != MT76_TM_STATE_IDLE) { in mt76_testmode_set_state()
292 struct mt76_testmode_data *td = &dev->test; in mt76_testmode_cmd() local
312 memset(td, 0, sizeof(*td)); in mt76_testmode_cmd()
318 td->tx_count = nla_get_u32(tb[MT76_TM_ATTR_TX_COUNT]); in mt76_testmode_cmd()
327 td->tx_msdu_len = val; in mt76_testmode_cmd()
331 td->tx_rate_idx = nla_get_u8(tb[MT76_TM_ATTR_TX_RATE_IDX]); in mt76_testmode_cmd()
333 if (mt76_tm_get_u8(tb[MT76_TM_ATTR_TX_RATE_MODE], &td->tx_rate_mode, in mt76_testmode_cmd()
335 mt76_tm_get_u8(tb[MT76_TM_ATTR_TX_RATE_NSS], &td->tx_rate_nss, in mt76_testmode_cmd()
337 mt76_tm_get_u8(tb[MT76_TM_ATTR_TX_RATE_SGI], &td->tx_rate_sgi, 0, 1) || in mt76_testmode_cmd()
338 mt76_tm_get_u8(tb[MT76_TM_ATTR_TX_RATE_LDPC], &td->tx_rate_ldpc, 0, 1) || in mt76_testmode_cmd()
339 mt76_tm_get_u8(tb[MT76_TM_ATTR_TX_ANTENNA], &td->tx_antenna_mask, 1, in mt76_testmode_cmd()
342 &td->tx_power_control, 0, 1)) in mt76_testmode_cmd()
346 td->freq_offset = nla_get_u32(tb[MT76_TM_ATTR_FREQ_OFFSET]); in mt76_testmode_cmd()
353 state = td->state; in mt76_testmode_cmd()
363 idx >= ARRAY_SIZE(td->tx_power)) in mt76_testmode_cmd()
366 td->tx_power[idx++] = nla_get_u8(cur); in mt76_testmode_cmd()
378 mt76_testmode_param_set(td, i); in mt76_testmode_cmd()
394 struct mt76_testmode_data *td = &dev->test; in mt76_testmode_dump_stats() local
399 for (i = 0; i < ARRAY_SIZE(td->rx_stats.packets); i++) { in mt76_testmode_dump_stats()
400 rx_packets += td->rx_stats.packets[i]; in mt76_testmode_dump_stats()
401 rx_fcs_error += td->rx_stats.fcs_error[i]; in mt76_testmode_dump_stats()
404 if (nla_put_u32(msg, MT76_TM_STATS_ATTR_TX_PENDING, td->tx_pending) || in mt76_testmode_dump_stats()
405 nla_put_u32(msg, MT76_TM_STATS_ATTR_TX_QUEUED, td->tx_queued) || in mt76_testmode_dump_stats()
406 nla_put_u32(msg, MT76_TM_STATS_ATTR_TX_DONE, td->tx_done) || in mt76_testmode_dump_stats()
424 struct mt76_testmode_data *td = &dev->test; in mt76_testmode_dump() local
460 if (nla_put_u32(msg, MT76_TM_ATTR_STATE, td->state)) in mt76_testmode_dump()
463 if (td->mtd_name && in mt76_testmode_dump()
464 (nla_put_string(msg, MT76_TM_ATTR_MTD_PART, td->mtd_name) || in mt76_testmode_dump()
465 nla_put_u32(msg, MT76_TM_ATTR_MTD_OFFSET, td->mtd_offset))) in mt76_testmode_dump()
468 if (nla_put_u32(msg, MT76_TM_ATTR_TX_COUNT, td->tx_count) || in mt76_testmode_dump()
469 nla_put_u32(msg, MT76_TM_ATTR_TX_LENGTH, td->tx_msdu_len) || in mt76_testmode_dump()
470 nla_put_u8(msg, MT76_TM_ATTR_TX_RATE_MODE, td->tx_rate_mode) || in mt76_testmode_dump()
471 nla_put_u8(msg, MT76_TM_ATTR_TX_RATE_NSS, td->tx_rate_nss) || in mt76_testmode_dump()
472 nla_put_u8(msg, MT76_TM_ATTR_TX_RATE_IDX, td->tx_rate_idx) || in mt76_testmode_dump()
473 nla_put_u8(msg, MT76_TM_ATTR_TX_RATE_SGI, td->tx_rate_sgi) || in mt76_testmode_dump()
474 nla_put_u8(msg, MT76_TM_ATTR_TX_RATE_LDPC, td->tx_rate_ldpc) || in mt76_testmode_dump()
475 (mt76_testmode_param_present(td, MT76_TM_ATTR_TX_ANTENNA) && in mt76_testmode_dump()
476 nla_put_u8(msg, MT76_TM_ATTR_TX_ANTENNA, td->tx_antenna_mask)) || in mt76_testmode_dump()
477 (mt76_testmode_param_present(td, MT76_TM_ATTR_TX_POWER_CONTROL) && in mt76_testmode_dump()
478 nla_put_u8(msg, MT76_TM_ATTR_TX_POWER_CONTROL, td->tx_power_control)) || in mt76_testmode_dump()
479 (mt76_testmode_param_present(td, MT76_TM_ATTR_FREQ_OFFSET) && in mt76_testmode_dump()
480 nla_put_u8(msg, MT76_TM_ATTR_FREQ_OFFSET, td->freq_offset))) in mt76_testmode_dump()
483 if (mt76_testmode_param_present(td, MT76_TM_ATTR_TX_POWER)) { in mt76_testmode_dump()
488 for (i = 0; i < ARRAY_SIZE(td->tx_power); i++) in mt76_testmode_dump()
489 if (nla_put_u8(msg, i, td->tx_power[i])) in mt76_testmode_dump()