Lines Matching defs:pipe
65 /* protects pipe->urb_list_head and pipe->urb_cnt */
80 struct ath6kl_usb_pipe *pipe;
129 /* pipe/urb operations */
131 ath6kl_usb_alloc_urb_from_pipe(struct ath6kl_usb_pipe *pipe)
136 /* bail if this pipe is not initialized */
137 if (!pipe->ar_usb)
140 spin_lock_irqsave(&pipe->ar_usb->cs_lock, flags);
141 if (!list_empty(&pipe->urb_list_head)) {
143 list_first_entry(&pipe->urb_list_head,
146 pipe->urb_cnt--;
148 spin_unlock_irqrestore(&pipe->ar_usb->cs_lock, flags);
153 static void ath6kl_usb_free_urb_to_pipe(struct ath6kl_usb_pipe *pipe,
158 /* bail if this pipe is not initialized */
159 if (!pipe->ar_usb)
162 spin_lock_irqsave(&pipe->ar_usb->cs_lock, flags);
163 pipe->urb_cnt++;
165 list_add(&urb_context->link, &pipe->urb_list_head);
166 spin_unlock_irqrestore(&pipe->ar_usb->cs_lock, flags);
174 ath6kl_usb_free_urb_to_pipe(urb_context->pipe, urb_context);
182 /* pipe resource allocation/cleanup */
183 static int ath6kl_usb_alloc_pipe_resources(struct ath6kl_usb_pipe *pipe,
189 INIT_LIST_HEAD(&pipe->urb_list_head);
190 init_usb_anchor(&pipe->urb_submitted);
200 urb_context->pipe = pipe;
206 pipe->urb_alloc++;
207 ath6kl_usb_free_urb_to_pipe(pipe, urb_context);
212 pipe->logical_pipe_num, pipe->usb_pipe_handle,
213 pipe->urb_alloc);
219 static void ath6kl_usb_free_pipe_resources(struct ath6kl_usb_pipe *pipe)
223 if (pipe->ar_usb == NULL) {
224 /* nothing allocated for this pipe */
231 pipe->logical_pipe_num, pipe->usb_pipe_handle,
232 pipe->urb_alloc, pipe->urb_cnt);
234 if (pipe->urb_alloc != pipe->urb_cnt) {
238 pipe->logical_pipe_num, pipe->usb_pipe_handle,
239 pipe->urb_alloc, pipe->urb_cnt);
243 urb_context = ath6kl_usb_alloc_urb_from_pipe(pipe);
309 struct ath6kl_usb_pipe *pipe;
358 pipe = &ar_usb->pipes[pipe_num];
359 if (pipe->ar_usb != NULL) {
360 /* hmmm..pipe was already setup */
364 pipe->ar_usb = ar_usb;
365 pipe->logical_pipe_num = pipe_num;
366 pipe->ep_address = endpoint->bEndpointAddress;
367 pipe->max_packet_size = le16_to_cpu(endpoint->wMaxPacketSize);
370 if (ATH6KL_USB_IS_DIR_IN(pipe->ep_address)) {
371 pipe->usb_pipe_handle =
373 pipe->ep_address);
375 pipe->usb_pipe_handle =
377 pipe->ep_address);
380 if (ATH6KL_USB_IS_DIR_IN(pipe->ep_address)) {
381 pipe->usb_pipe_handle =
383 pipe->ep_address);
385 pipe->usb_pipe_handle =
387 pipe->ep_address);
391 if (ATH6KL_USB_IS_DIR_IN(pipe->ep_address)) {
392 pipe->usb_pipe_handle =
394 pipe->ep_address);
396 pipe->usb_pipe_handle =
398 pipe->ep_address);
402 pipe->ep_desc = endpoint;
404 if (!ATH6KL_USB_IS_DIR_IN(pipe->ep_address))
405 pipe->flags |= ATH6KL_USB_PIPE_FLAG_TX;
407 status = ath6kl_usb_alloc_pipe_resources(pipe, urbcount);
415 /* pipe operations */
488 * note: control pipe is no longer used
506 struct ath6kl_usb_pipe *pipe = urb_context->pipe;
511 "%s: recv pipe: %d, stat:%d, len:%d urb:0x%p\n", __func__,
512 pipe->logical_pipe_num, urb->status, urb->actual_length,
529 "%s recv pipe: %d (ep:0x%2.2X), failed:%d\n",
530 __func__, pipe->logical_pipe_num,
531 pipe->ep_address, urb->status);
547 skb_queue_tail(&pipe->io_comp_queue, skb);
548 queue_work(pipe->ar_usb->wq, &pipe->io_complete_work);
554 pipe->urb_cnt >= pipe->urb_cnt_thresh) {
556 ath6kl_usb_post_recv_transfers(pipe, ATH6KL_USB_RX_BUFFER_SIZE);
563 struct ath6kl_usb_pipe *pipe = urb_context->pipe;
567 "%s: pipe: %d, stat:%d, len:%d\n",
568 __func__, pipe->logical_pipe_num, urb->status,
573 "%s: pipe: %d, failed:%d\n",
574 __func__, pipe->logical_pipe_num, urb->status);
579 ath6kl_usb_free_urb_to_pipe(urb_context->pipe, urb_context);
582 skb_queue_tail(&pipe->io_comp_queue, skb);
583 queue_work(pipe->ar_usb->wq, &pipe->io_complete_work);
588 struct ath6kl_usb_pipe *pipe = container_of(work,
594 ar_usb = pipe->ar_usb;
596 while ((skb = skb_dequeue(&pipe->io_comp_queue))) {
597 if (pipe->flags & ATH6KL_USB_PIPE_FLAG_TX) {
605 pipe->logical_pipe_num);
632 struct ath6kl_usb_pipe *pipe;
652 pipe = &ar_usb->pipes[i];
653 INIT_WORK(&pipe->io_complete_work,
655 skb_queue_head_init(&pipe->io_comp_queue);
697 /* exported hif usb APIs for htc pipe */
705 /* set the TX resource avail threshold for each TX pipe */
717 struct ath6kl_usb_pipe *pipe = &device->pipes[PipeID];
724 ath6kl_dbg(ATH6KL_DBG_USB_BULK, "+%s pipe : %d, buf:0x%p\n",
727 urb_context = ath6kl_usb_alloc_urb_from_pipe(pipe);
732 * 2 endpoints map to the same pipe ID
735 "%s pipe:%d no urbs left. URB Cnt : %d\n",
736 __func__, PipeID, pipe->urb_cnt);
749 ath6kl_usb_free_urb_to_pipe(urb_context->pipe,
756 pipe->usb_pipe_handle,
761 if ((len % pipe->max_packet_size) == 0) {
762 /* hit a max packet boundary on this pipe */
768 pipe->logical_pipe_num, pipe->usb_pipe_handle,
769 pipe->ep_address, len);
771 usb_anchor_urb(urb, &pipe->urb_submitted);
779 ath6kl_usb_free_urb_to_pipe(urb_context->pipe,
812 /* due to large control packets, shift to data pipe */