Lines Matching refs:td
28 struct mt76_testmode_data *td = &phy->test; in mt76_testmode_tx_pending() local
31 struct sk_buff *skb = td->tx_skb; in mt76_testmode_tx_pending()
36 if (!skb || !td->tx_pending) in mt76_testmode_tx_pending()
42 tx_queued_limit = td->tx_queued_limit ? td->tx_queued_limit : 1000; in mt76_testmode_tx_pending()
46 while (td->tx_pending > 0 && in mt76_testmode_tx_pending()
47 td->tx_queued - td->tx_done < tx_queued_limit && in mt76_testmode_tx_pending()
56 td->tx_pending--; in mt76_testmode_tx_pending()
57 td->tx_queued++; in mt76_testmode_tx_pending()
90 struct mt76_testmode_data *td = &phy->test; in mt76_testmode_free_skb() local
92 dev_kfree_skb(td->tx_skb); in mt76_testmode_free_skb()
93 td->tx_skb = NULL; in mt76_testmode_free_skb()
101 struct mt76_testmode_data *td = &phy->test; in mt76_testmode_alloc_skb() local
109 max_len = mt76_testmode_max_mpdu_len(phy, td->tx_rate_mode); in mt76_testmode_alloc_skb()
167 td->tx_skb = head; in mt76_testmode_alloc_skb()
176 struct mt76_testmode_data *td = &phy->test; in mt76_testmode_tx_init() local
182 ret = mt76_testmode_alloc_skb(phy, td->tx_mpdu_len); in mt76_testmode_tx_init()
186 if (td->tx_rate_mode > MT76_TM_TX_MODE_VHT) in mt76_testmode_tx_init()
189 if (td->tx_antenna_mask) in mt76_testmode_tx_init()
190 max_nss = min_t(u8, max_nss, hweight8(td->tx_antenna_mask)); in mt76_testmode_tx_init()
192 info = IEEE80211_SKB_CB(td->tx_skb); in mt76_testmode_tx_init()
195 rate->idx = td->tx_rate_idx; in mt76_testmode_tx_init()
197 switch (td->tx_rate_mode) { in mt76_testmode_tx_init()
226 if (td->tx_rate_nss > max_nss) in mt76_testmode_tx_init()
229 ieee80211_rate_set_vht(rate, td->tx_rate_idx, td->tx_rate_nss); in mt76_testmode_tx_init()
236 if (td->tx_rate_sgi) in mt76_testmode_tx_init()
239 if (td->tx_rate_ldpc) in mt76_testmode_tx_init()
242 if (td->tx_rate_stbc) in mt76_testmode_tx_init()
245 if (td->tx_rate_mode >= MT76_TM_TX_MODE_HT) { in mt76_testmode_tx_init()
268 struct mt76_testmode_data *td = &phy->test; in mt76_testmode_tx_start() local
271 td->tx_queued = 0; in mt76_testmode_tx_start()
272 td->tx_done = 0; in mt76_testmode_tx_start()
273 td->tx_pending = td->tx_count; in mt76_testmode_tx_start()
280 struct mt76_testmode_data *td = &phy->test; in mt76_testmode_tx_stop() local
285 td->tx_pending = 0; in mt76_testmode_tx_stop()
289 wait_event_timeout(dev->tx_wait, td->tx_done == td->tx_queued, in mt76_testmode_tx_stop()
296 mt76_testmode_param_set(struct mt76_testmode_data *td, u16 idx) in mt76_testmode_param_set() argument
298 td->param_set[idx / 32] |= BIT(idx % 32); in mt76_testmode_param_set()
302 mt76_testmode_param_present(struct mt76_testmode_data *td, u16 idx) in mt76_testmode_param_present() argument
304 return td->param_set[idx / 32] & BIT(idx % 32); in mt76_testmode_param_present()
310 struct mt76_testmode_data *td = &phy->test; in mt76_testmode_init_defaults() local
312 if (td->tx_mpdu_len > 0) in mt76_testmode_init_defaults()
315 td->tx_mpdu_len = 1024; in mt76_testmode_init_defaults()
316 td->tx_count = 1; in mt76_testmode_init_defaults()
317 td->tx_rate_mode = MT76_TM_TX_MODE_OFDM; in mt76_testmode_init_defaults()
318 td->tx_rate_nss = 1; in mt76_testmode_init_defaults()
358 struct mt76_testmode_data *td = &phy->test; in mt76_testmode_set_state() local
361 if (state == td->state && state == MT76_TM_STATE_OFF) in mt76_testmode_set_state()
370 td->state != MT76_TM_STATE_IDLE) { in mt76_testmode_set_state()
404 struct mt76_testmode_data *td = &phy->test; in mt76_testmode_cmd() local
425 memset(td, 0, sizeof(*td)); in mt76_testmode_cmd()
431 td->tx_count = nla_get_u32(tb[MT76_TM_ATTR_TX_COUNT]); in mt76_testmode_cmd()
434 td->tx_rate_idx = nla_get_u8(tb[MT76_TM_ATTR_TX_RATE_IDX]); in mt76_testmode_cmd()
436 if (mt76_tm_get_u8(tb[MT76_TM_ATTR_TX_RATE_MODE], &td->tx_rate_mode, in mt76_testmode_cmd()
438 mt76_tm_get_u8(tb[MT76_TM_ATTR_TX_RATE_NSS], &td->tx_rate_nss, in mt76_testmode_cmd()
440 mt76_tm_get_u8(tb[MT76_TM_ATTR_TX_RATE_SGI], &td->tx_rate_sgi, 0, 2) || in mt76_testmode_cmd()
441 mt76_tm_get_u8(tb[MT76_TM_ATTR_TX_RATE_LDPC], &td->tx_rate_ldpc, 0, 1) || in mt76_testmode_cmd()
442 mt76_tm_get_u8(tb[MT76_TM_ATTR_TX_RATE_STBC], &td->tx_rate_stbc, 0, 1) || in mt76_testmode_cmd()
443 mt76_tm_get_u8(tb[MT76_TM_ATTR_TX_LTF], &td->tx_ltf, 0, 2) || in mt76_testmode_cmd()
444 mt76_tm_get_u8(tb[MT76_TM_ATTR_TX_ANTENNA], &td->tx_antenna_mask, in mt76_testmode_cmd()
446 mt76_tm_get_u8(tb[MT76_TM_ATTR_TX_SPE_IDX], &td->tx_spe_idx, 0, 27) || in mt76_testmode_cmd()
448 &td->tx_duty_cycle, 0, 99) || in mt76_testmode_cmd()
450 &td->tx_power_control, 0, 1)) in mt76_testmode_cmd()
456 if (val > mt76_testmode_max_mpdu_len(phy, td->tx_rate_mode) || in mt76_testmode_cmd()
460 td->tx_mpdu_len = val; in mt76_testmode_cmd()
464 td->tx_ipg = nla_get_u32(tb[MT76_TM_ATTR_TX_IPG]); in mt76_testmode_cmd()
467 td->tx_time = nla_get_u32(tb[MT76_TM_ATTR_TX_TIME]); in mt76_testmode_cmd()
470 td->freq_offset = nla_get_u32(tb[MT76_TM_ATTR_FREQ_OFFSET]); in mt76_testmode_cmd()
477 state = td->state; in mt76_testmode_cmd()
487 idx >= ARRAY_SIZE(td->tx_power)) in mt76_testmode_cmd()
490 td->tx_power[idx++] = nla_get_u8(cur); in mt76_testmode_cmd()
502 mt76_testmode_param_set(td, i); in mt76_testmode_cmd()
518 struct mt76_testmode_data *td = &phy->test; in mt76_testmode_dump_stats() local
532 for (i = 0; i < ARRAY_SIZE(td->rx_stats.packets); i++) { in mt76_testmode_dump_stats()
533 rx_packets += td->rx_stats.packets[i]; in mt76_testmode_dump_stats()
534 rx_fcs_error += td->rx_stats.fcs_error[i]; in mt76_testmode_dump_stats()
537 if (nla_put_u32(msg, MT76_TM_STATS_ATTR_TX_PENDING, td->tx_pending) || in mt76_testmode_dump_stats()
538 nla_put_u32(msg, MT76_TM_STATS_ATTR_TX_QUEUED, td->tx_queued) || in mt76_testmode_dump_stats()
539 nla_put_u32(msg, MT76_TM_STATS_ATTR_TX_DONE, td->tx_done) || in mt76_testmode_dump_stats()
554 struct mt76_testmode_data *td = &phy->test; in mt76_testmode_dump() local
590 if (nla_put_u32(msg, MT76_TM_ATTR_STATE, td->state)) in mt76_testmode_dump()
598 if (nla_put_u32(msg, MT76_TM_ATTR_TX_COUNT, td->tx_count) || in mt76_testmode_dump()
599 nla_put_u32(msg, MT76_TM_ATTR_TX_LENGTH, td->tx_mpdu_len) || in mt76_testmode_dump()
600 nla_put_u8(msg, MT76_TM_ATTR_TX_RATE_MODE, td->tx_rate_mode) || in mt76_testmode_dump()
601 nla_put_u8(msg, MT76_TM_ATTR_TX_RATE_NSS, td->tx_rate_nss) || in mt76_testmode_dump()
602 nla_put_u8(msg, MT76_TM_ATTR_TX_RATE_IDX, td->tx_rate_idx) || in mt76_testmode_dump()
603 nla_put_u8(msg, MT76_TM_ATTR_TX_RATE_SGI, td->tx_rate_sgi) || in mt76_testmode_dump()
604 nla_put_u8(msg, MT76_TM_ATTR_TX_RATE_LDPC, td->tx_rate_ldpc) || in mt76_testmode_dump()
605 nla_put_u8(msg, MT76_TM_ATTR_TX_RATE_STBC, td->tx_rate_stbc) || in mt76_testmode_dump()
606 (mt76_testmode_param_present(td, MT76_TM_ATTR_TX_LTF) && in mt76_testmode_dump()
607 nla_put_u8(msg, MT76_TM_ATTR_TX_LTF, td->tx_ltf)) || in mt76_testmode_dump()
608 (mt76_testmode_param_present(td, MT76_TM_ATTR_TX_ANTENNA) && in mt76_testmode_dump()
609 nla_put_u8(msg, MT76_TM_ATTR_TX_ANTENNA, td->tx_antenna_mask)) || in mt76_testmode_dump()
610 (mt76_testmode_param_present(td, MT76_TM_ATTR_TX_SPE_IDX) && in mt76_testmode_dump()
611 nla_put_u8(msg, MT76_TM_ATTR_TX_SPE_IDX, td->tx_spe_idx)) || in mt76_testmode_dump()
612 (mt76_testmode_param_present(td, MT76_TM_ATTR_TX_DUTY_CYCLE) && in mt76_testmode_dump()
613 nla_put_u8(msg, MT76_TM_ATTR_TX_DUTY_CYCLE, td->tx_duty_cycle)) || in mt76_testmode_dump()
614 (mt76_testmode_param_present(td, MT76_TM_ATTR_TX_IPG) && in mt76_testmode_dump()
615 nla_put_u32(msg, MT76_TM_ATTR_TX_IPG, td->tx_ipg)) || in mt76_testmode_dump()
616 (mt76_testmode_param_present(td, MT76_TM_ATTR_TX_TIME) && in mt76_testmode_dump()
617 nla_put_u32(msg, MT76_TM_ATTR_TX_TIME, td->tx_time)) || in mt76_testmode_dump()
618 (mt76_testmode_param_present(td, MT76_TM_ATTR_TX_POWER_CONTROL) && in mt76_testmode_dump()
619 nla_put_u8(msg, MT76_TM_ATTR_TX_POWER_CONTROL, td->tx_power_control)) || in mt76_testmode_dump()
620 (mt76_testmode_param_present(td, MT76_TM_ATTR_FREQ_OFFSET) && in mt76_testmode_dump()
621 nla_put_u8(msg, MT76_TM_ATTR_FREQ_OFFSET, td->freq_offset))) in mt76_testmode_dump()
624 if (mt76_testmode_param_present(td, MT76_TM_ATTR_TX_POWER)) { in mt76_testmode_dump()
629 for (i = 0; i < ARRAY_SIZE(td->tx_power); i++) in mt76_testmode_dump()
630 if (nla_put_u8(msg, i, td->tx_power[i])) in mt76_testmode_dump()