Lines Matching refs:rtwusb

29 static void rtw_usb_fill_tx_checksum(struct rtw_usb *rtwusb,  in rtw_usb_fill_tx_checksum()  argument
33 struct rtw_dev *rtwdev = rtwusb->rtwdev; in rtw_usb_fill_tx_checksum()
43 struct rtw_usb *rtwusb = rtw_get_usb_priv(rtwdev); in rtw_usb_reg_sec() local
44 struct usb_device *udev = rtwusb->udev; in rtw_usb_reg_sec()
73 struct rtw_usb *rtwusb = rtw_get_usb_priv(rtwdev); in rtw_usb_read() local
74 struct usb_device *udev = rtwusb->udev; in rtw_usb_read()
80 spin_lock_irqsave(&rtwusb->usb_lock, flags); in rtw_usb_read()
82 idx = rtwusb->usb_data_index; in rtw_usb_read()
83 rtwusb->usb_data_index = (idx + 1) & (RTW_USB_MAX_RXTX_COUNT - 1); in rtw_usb_read()
85 spin_unlock_irqrestore(&rtwusb->usb_lock, flags); in rtw_usb_read()
87 data = &rtwusb->usb_data[idx]; in rtw_usb_read()
121 struct rtw_usb *rtwusb = (struct rtw_usb *)rtwdev->priv; in rtw_usb_write() local
122 struct usb_device *udev = rtwusb->udev; in rtw_usb_write()
128 spin_lock_irqsave(&rtwusb->usb_lock, flags); in rtw_usb_write()
130 idx = rtwusb->usb_data_index; in rtw_usb_write()
131 rtwusb->usb_data_index = (idx + 1) & (RTW_USB_MAX_RXTX_COUNT - 1); in rtw_usb_write()
133 spin_unlock_irqrestore(&rtwusb->usb_lock, flags); in rtw_usb_write()
135 data = &rtwusb->usb_data[idx]; in rtw_usb_write()
186 struct rtw_usb *rtwusb = rtw_get_usb_priv(rtwdev); in rtw_usb_parse() local
202 if (rtwusb->pipe_in) { in rtw_usb_parse()
207 rtwusb->pipe_in = num; in rtw_usb_parse()
212 if (rtwusb->pipe_interrupt) { in rtw_usb_parse()
217 rtwusb->pipe_interrupt = num; in rtw_usb_parse()
222 if (num_out_pipes >= ARRAY_SIZE(rtwusb->out_ep)) { in rtw_usb_parse()
227 rtwusb->out_ep[num_out_pipes++] = num; in rtw_usb_parse()
240 rtwusb->qsel_to_ep[TX_DESC_QSEL_TID0] = dma_mapping_to_ep(rqpn->dma_map_be); in rtw_usb_parse()
241 rtwusb->qsel_to_ep[TX_DESC_QSEL_TID1] = dma_mapping_to_ep(rqpn->dma_map_bk); in rtw_usb_parse()
242 rtwusb->qsel_to_ep[TX_DESC_QSEL_TID2] = dma_mapping_to_ep(rqpn->dma_map_bk); in rtw_usb_parse()
243 rtwusb->qsel_to_ep[TX_DESC_QSEL_TID3] = dma_mapping_to_ep(rqpn->dma_map_be); in rtw_usb_parse()
244 rtwusb->qsel_to_ep[TX_DESC_QSEL_TID4] = dma_mapping_to_ep(rqpn->dma_map_vi); in rtw_usb_parse()
245 rtwusb->qsel_to_ep[TX_DESC_QSEL_TID5] = dma_mapping_to_ep(rqpn->dma_map_vi); in rtw_usb_parse()
246 rtwusb->qsel_to_ep[TX_DESC_QSEL_TID6] = dma_mapping_to_ep(rqpn->dma_map_vo); in rtw_usb_parse()
247 rtwusb->qsel_to_ep[TX_DESC_QSEL_TID7] = dma_mapping_to_ep(rqpn->dma_map_vo); in rtw_usb_parse()
248 rtwusb->qsel_to_ep[TX_DESC_QSEL_TID8] = -EINVAL; in rtw_usb_parse()
249 rtwusb->qsel_to_ep[TX_DESC_QSEL_TID9] = -EINVAL; in rtw_usb_parse()
250 rtwusb->qsel_to_ep[TX_DESC_QSEL_TID10] = -EINVAL; in rtw_usb_parse()
251 rtwusb->qsel_to_ep[TX_DESC_QSEL_TID11] = -EINVAL; in rtw_usb_parse()
252 rtwusb->qsel_to_ep[TX_DESC_QSEL_TID12] = -EINVAL; in rtw_usb_parse()
253 rtwusb->qsel_to_ep[TX_DESC_QSEL_TID13] = -EINVAL; in rtw_usb_parse()
254 rtwusb->qsel_to_ep[TX_DESC_QSEL_TID14] = -EINVAL; in rtw_usb_parse()
255 rtwusb->qsel_to_ep[TX_DESC_QSEL_TID15] = -EINVAL; in rtw_usb_parse()
256 rtwusb->qsel_to_ep[TX_DESC_QSEL_BEACON] = dma_mapping_to_ep(rqpn->dma_map_hi); in rtw_usb_parse()
257 rtwusb->qsel_to_ep[TX_DESC_QSEL_HIGH] = dma_mapping_to_ep(rqpn->dma_map_hi); in rtw_usb_parse()
258 rtwusb->qsel_to_ep[TX_DESC_QSEL_MGMT] = dma_mapping_to_ep(rqpn->dma_map_mg); in rtw_usb_parse()
259 rtwusb->qsel_to_ep[TX_DESC_QSEL_H2C] = dma_mapping_to_ep(rqpn->dma_map_hi); in rtw_usb_parse()
302 static int qsel_to_ep(struct rtw_usb *rtwusb, unsigned int qsel) in qsel_to_ep() argument
304 if (qsel >= ARRAY_SIZE(rtwusb->qsel_to_ep)) in qsel_to_ep()
307 return rtwusb->qsel_to_ep[qsel]; in qsel_to_ep()
313 struct rtw_usb *rtwusb = rtw_get_usb_priv(rtwdev); in rtw_usb_write_port() local
314 struct usb_device *usbd = rtwusb->udev; in rtw_usb_write_port()
318 int ep = qsel_to_ep(rtwusb, qsel); in rtw_usb_write_port()
323 pipe = usb_sndbulkpipe(usbd, rtwusb->out_ep[ep]); in rtw_usb_write_port()
337 static bool rtw_usb_tx_agg_skb(struct rtw_usb *rtwusb, struct sk_buff_head *list) in rtw_usb_tx_agg_skb() argument
339 struct rtw_dev *rtwdev = rtwusb->rtwdev; in rtw_usb_tx_agg_skb()
397 rtw_usb_fill_tx_checksum(rtwusb, skb_head, agg_num); in rtw_usb_tx_agg_skb()
411 struct rtw_usb *rtwusb = container_of(work, struct rtw_usb, tx_work); in rtw_usb_tx_handler() local
414 for (i = ARRAY_SIZE(rtwusb->tx_queue) - 1; i >= 0; i--) { in rtw_usb_tx_handler()
416 struct sk_buff_head *list = &rtwusb->tx_queue[i]; in rtw_usb_tx_handler()
418 if (!rtw_usb_tx_agg_skb(rtwusb, list)) in rtw_usb_tx_handler()
424 static void rtw_usb_tx_queue_purge(struct rtw_usb *rtwusb) in rtw_usb_tx_queue_purge() argument
428 for (i = 0; i < ARRAY_SIZE(rtwusb->tx_queue); i++) in rtw_usb_tx_queue_purge()
429 skb_queue_purge(&rtwusb->tx_queue[i]); in rtw_usb_tx_queue_purge()
517 struct rtw_usb *rtwusb = rtw_get_usb_priv(rtwdev); in rtw_usb_tx_write() local
526 ep = qsel_to_ep(rtwusb, pkt_info->qsel); in rtw_usb_tx_write()
532 skb_queue_tail(&rtwusb->tx_queue[ep], skb); in rtw_usb_tx_write()
539 struct rtw_usb *rtwusb = rtw_get_usb_priv(rtwdev); in rtw_usb_tx_kick_off() local
541 queue_work(rtwusb->txwq, &rtwusb->tx_work); in rtw_usb_tx_kick_off()
546 struct rtw_usb *rtwusb = container_of(work, struct rtw_usb, rx_work); in rtw_usb_rx_handler() local
547 struct rtw_dev *rtwdev = rtwusb->rtwdev; in rtw_usb_rx_handler()
559 skb = skb_dequeue(&rtwusb->rx_queue); in rtw_usb_rx_handler()
563 if (skb_queue_len(&rtwusb->rx_queue) >= RTW_USB_MAX_RXQ_LEN) { in rtw_usb_rx_handler()
610 static void rtw_usb_rx_resubmit(struct rtw_usb *rtwusb, struct rx_usb_ctrl_block *rxcb) in rtw_usb_rx_resubmit() argument
612 struct rtw_dev *rtwdev = rtwusb->rtwdev; in rtw_usb_rx_resubmit()
619 usb_fill_bulk_urb(rxcb->rx_urb, rtwusb->udev, in rtw_usb_rx_resubmit()
620 usb_rcvbulkpipe(rtwusb->udev, rtwusb->pipe_in), in rtw_usb_rx_resubmit()
637 struct rtw_usb *rtwusb = rtw_get_usb_priv(rtwdev); in rtw_usb_read_port_complete() local
649 skb_queue_tail(&rtwusb->rx_queue, skb); in rtw_usb_read_port_complete()
650 queue_work(rtwusb->rxwq, &rtwusb->rx_work); in rtw_usb_read_port_complete()
652 rtw_usb_rx_resubmit(rtwusb, rxcb); in rtw_usb_read_port_complete()
676 static void rtw_usb_cancel_rx_bufs(struct rtw_usb *rtwusb) in rtw_usb_cancel_rx_bufs() argument
682 rxcb = &rtwusb->rx_cb[i]; in rtw_usb_cancel_rx_bufs()
687 static void rtw_usb_free_rx_bufs(struct rtw_usb *rtwusb) in rtw_usb_free_rx_bufs() argument
693 rxcb = &rtwusb->rx_cb[i]; in rtw_usb_free_rx_bufs()
699 static int rtw_usb_alloc_rx_bufs(struct rtw_usb *rtwusb) in rtw_usb_alloc_rx_bufs() argument
704 struct rx_usb_ctrl_block *rxcb = &rtwusb->rx_cb[i]; in rtw_usb_alloc_rx_bufs()
706 rxcb->rtwdev = rtwusb->rtwdev; in rtw_usb_alloc_rx_bufs()
714 rtw_usb_free_rx_bufs(rtwusb); in rtw_usb_alloc_rx_bufs()
745 struct rtw_usb *rtwusb = rtw_get_usb_priv(rtwdev); in rtw_usb_init_burst_pkt_len() local
746 enum usb_device_speed speed = rtwusb->udev->speed; in rtw_usb_init_burst_pkt_len()
831 struct rtw_usb *rtwusb = rtw_get_usb_priv(rtwdev); in rtw_usb_init_rx() local
833 rtwusb->rxwq = create_singlethread_workqueue("rtw88_usb: rx wq"); in rtw_usb_init_rx()
834 if (!rtwusb->rxwq) { in rtw_usb_init_rx()
839 skb_queue_head_init(&rtwusb->rx_queue); in rtw_usb_init_rx()
841 INIT_WORK(&rtwusb->rx_work, rtw_usb_rx_handler); in rtw_usb_init_rx()
848 struct rtw_usb *rtwusb = rtw_get_usb_priv(rtwdev); in rtw_usb_setup_rx() local
852 struct rx_usb_ctrl_block *rxcb = &rtwusb->rx_cb[i]; in rtw_usb_setup_rx()
854 rtw_usb_rx_resubmit(rtwusb, rxcb); in rtw_usb_setup_rx()
860 struct rtw_usb *rtwusb = rtw_get_usb_priv(rtwdev); in rtw_usb_deinit_rx() local
862 skb_queue_purge(&rtwusb->rx_queue); in rtw_usb_deinit_rx()
864 flush_workqueue(rtwusb->rxwq); in rtw_usb_deinit_rx()
865 destroy_workqueue(rtwusb->rxwq); in rtw_usb_deinit_rx()
870 struct rtw_usb *rtwusb = rtw_get_usb_priv(rtwdev); in rtw_usb_init_tx() local
873 rtwusb->txwq = create_singlethread_workqueue("rtw88_usb: tx wq"); in rtw_usb_init_tx()
874 if (!rtwusb->txwq) { in rtw_usb_init_tx()
879 for (i = 0; i < ARRAY_SIZE(rtwusb->tx_queue); i++) in rtw_usb_init_tx()
880 skb_queue_head_init(&rtwusb->tx_queue[i]); in rtw_usb_init_tx()
882 INIT_WORK(&rtwusb->tx_work, rtw_usb_tx_handler); in rtw_usb_init_tx()
889 struct rtw_usb *rtwusb = rtw_get_usb_priv(rtwdev); in rtw_usb_deinit_tx() local
891 rtw_usb_tx_queue_purge(rtwusb); in rtw_usb_deinit_tx()
892 flush_workqueue(rtwusb->txwq); in rtw_usb_deinit_tx()
893 destroy_workqueue(rtwusb->txwq); in rtw_usb_deinit_tx()
899 struct rtw_usb *rtwusb = rtw_get_usb_priv(rtwdev); in rtw_usb_intf_init() local
903 rtwusb->udev = udev; in rtw_usb_intf_init()
908 rtwusb->usb_data = kcalloc(RTW_USB_MAX_RXTX_COUNT, sizeof(u32), in rtw_usb_intf_init()
910 if (!rtwusb->usb_data) in rtw_usb_intf_init()
916 spin_lock_init(&rtwusb->usb_lock); in rtw_usb_intf_init()
924 struct rtw_usb *rtwusb = rtw_get_usb_priv(rtwdev); in rtw_usb_intf_deinit() local
926 usb_put_dev(rtwusb->udev); in rtw_usb_intf_deinit()
927 kfree(rtwusb->usb_data); in rtw_usb_intf_deinit()
1006 struct rtw_usb *rtwusb; in rtw_usb_probe() local
1022 rtwusb = rtw_get_usb_priv(rtwdev); in rtw_usb_probe()
1023 rtwusb->rtwdev = rtwdev; in rtw_usb_probe()
1025 ret = rtw_usb_alloc_rx_bufs(rtwusb); in rtw_usb_probe()
1088 rtw_usb_free_rx_bufs(rtwusb); in rtw_usb_probe()
1101 struct rtw_usb *rtwusb; in rtw_usb_disconnect() local
1107 rtwusb = rtw_get_usb_priv(rtwdev); in rtw_usb_disconnect()
1109 rtw_usb_cancel_rx_bufs(rtwusb); in rtw_usb_disconnect()
1115 if (rtwusb->udev->state != USB_STATE_NOTATTACHED) in rtw_usb_disconnect()
1116 usb_reset_device(rtwusb->udev); in rtw_usb_disconnect()
1118 rtw_usb_free_rx_bufs(rtwusb); in rtw_usb_disconnect()