Lines Matching refs:cl
19 int ishtp_cl_alloc_rx_ring(struct ishtp_cl *cl) in ishtp_cl_alloc_rx_ring() argument
21 size_t len = cl->device->fw_client->props.max_msg_length; in ishtp_cl_alloc_rx_ring()
27 for (j = 0; j < cl->rx_ring_size; ++j) { in ishtp_cl_alloc_rx_ring()
28 rb = ishtp_io_rb_init(cl); in ishtp_cl_alloc_rx_ring()
36 spin_lock_irqsave(&cl->free_list_spinlock, flags); in ishtp_cl_alloc_rx_ring()
37 list_add_tail(&rb->list, &cl->free_rb_list.list); in ishtp_cl_alloc_rx_ring()
38 spin_unlock_irqrestore(&cl->free_list_spinlock, flags); in ishtp_cl_alloc_rx_ring()
44 dev_err(&cl->device->dev, "error in allocating Rx buffers\n"); in ishtp_cl_alloc_rx_ring()
45 ishtp_cl_free_rx_ring(cl); in ishtp_cl_alloc_rx_ring()
57 int ishtp_cl_alloc_tx_ring(struct ishtp_cl *cl) in ishtp_cl_alloc_tx_ring() argument
59 size_t len = cl->device->fw_client->props.max_msg_length; in ishtp_cl_alloc_tx_ring()
63 cl->tx_ring_free_size = 0; in ishtp_cl_alloc_tx_ring()
66 for (j = 0; j < cl->tx_ring_size; ++j) { in ishtp_cl_alloc_tx_ring()
79 spin_lock_irqsave(&cl->tx_free_list_spinlock, flags); in ishtp_cl_alloc_tx_ring()
80 list_add_tail(&tx_buf->list, &cl->tx_free_list.list); in ishtp_cl_alloc_tx_ring()
81 ++cl->tx_ring_free_size; in ishtp_cl_alloc_tx_ring()
82 spin_unlock_irqrestore(&cl->tx_free_list_spinlock, flags); in ishtp_cl_alloc_tx_ring()
86 dev_err(&cl->device->dev, "error in allocating Tx pool\n"); in ishtp_cl_alloc_tx_ring()
87 ishtp_cl_free_tx_ring(cl); in ishtp_cl_alloc_tx_ring()
97 void ishtp_cl_free_rx_ring(struct ishtp_cl *cl) in ishtp_cl_free_rx_ring() argument
103 spin_lock_irqsave(&cl->free_list_spinlock, flags); in ishtp_cl_free_rx_ring()
104 while (!list_empty(&cl->free_rb_list.list)) { in ishtp_cl_free_rx_ring()
105 rb = list_entry(cl->free_rb_list.list.next, struct ishtp_cl_rb, in ishtp_cl_free_rx_ring()
111 spin_unlock_irqrestore(&cl->free_list_spinlock, flags); in ishtp_cl_free_rx_ring()
113 spin_lock_irqsave(&cl->in_process_spinlock, flags); in ishtp_cl_free_rx_ring()
114 while (!list_empty(&cl->in_process_list.list)) { in ishtp_cl_free_rx_ring()
115 rb = list_entry(cl->in_process_list.list.next, in ishtp_cl_free_rx_ring()
121 spin_unlock_irqrestore(&cl->in_process_spinlock, flags); in ishtp_cl_free_rx_ring()
130 void ishtp_cl_free_tx_ring(struct ishtp_cl *cl) in ishtp_cl_free_tx_ring() argument
135 spin_lock_irqsave(&cl->tx_free_list_spinlock, flags); in ishtp_cl_free_tx_ring()
137 while (!list_empty(&cl->tx_free_list.list)) { in ishtp_cl_free_tx_ring()
138 tx_buf = list_entry(cl->tx_free_list.list.next, in ishtp_cl_free_tx_ring()
141 --cl->tx_ring_free_size; in ishtp_cl_free_tx_ring()
145 spin_unlock_irqrestore(&cl->tx_free_list_spinlock, flags); in ishtp_cl_free_tx_ring()
147 spin_lock_irqsave(&cl->tx_list_spinlock, flags); in ishtp_cl_free_tx_ring()
149 while (!list_empty(&cl->tx_list.list)) { in ishtp_cl_free_tx_ring()
150 tx_buf = list_entry(cl->tx_list.list.next, in ishtp_cl_free_tx_ring()
156 spin_unlock_irqrestore(&cl->tx_list_spinlock, flags); in ishtp_cl_free_tx_ring()
182 struct ishtp_cl_rb *ishtp_io_rb_init(struct ishtp_cl *cl) in ishtp_io_rb_init() argument
191 rb->cl = cl; in ishtp_io_rb_init()
231 struct ishtp_cl *cl; in ishtp_cl_io_rb_recycle() local
235 if (!rb || !rb->cl) in ishtp_cl_io_rb_recycle()
238 cl = rb->cl; in ishtp_cl_io_rb_recycle()
239 spin_lock_irqsave(&cl->free_list_spinlock, flags); in ishtp_cl_io_rb_recycle()
240 list_add_tail(&rb->list, &cl->free_rb_list.list); in ishtp_cl_io_rb_recycle()
241 spin_unlock_irqrestore(&cl->free_list_spinlock, flags); in ishtp_cl_io_rb_recycle()
247 if (!cl->out_flow_ctrl_creds) in ishtp_cl_io_rb_recycle()
248 rets = ishtp_cl_read_start(cl); in ishtp_cl_io_rb_recycle()
262 bool ishtp_cl_tx_empty(struct ishtp_cl *cl) in ishtp_cl_tx_empty() argument
267 spin_lock_irqsave(&cl->tx_list_spinlock, tx_flags); in ishtp_cl_tx_empty()
268 tx_list_empty = list_empty(&cl->tx_list.list); in ishtp_cl_tx_empty()
269 spin_unlock_irqrestore(&cl->tx_list_spinlock, tx_flags); in ishtp_cl_tx_empty()
283 struct ishtp_cl_rb *ishtp_cl_rx_get_rb(struct ishtp_cl *cl) in ishtp_cl_rx_get_rb() argument
288 spin_lock_irqsave(&cl->in_process_spinlock, rx_flags); in ishtp_cl_rx_get_rb()
289 rb = list_first_entry_or_null(&cl->in_process_list.list, in ishtp_cl_rx_get_rb()
293 spin_unlock_irqrestore(&cl->in_process_spinlock, rx_flags); in ishtp_cl_rx_get_rb()