Lines Matching refs:req

40 static void ast_vhub_epn_kick(struct ast_vhub_ep *ep, struct ast_vhub_req *req)
42 unsigned int act = req->req.actual;
43 unsigned int len = req->req.length;
47 WARN_ON(req->active);
53 else if ((chunk < ep->ep.maxpacket) || !req->req.zero)
54 req->last_desc = 1;
56 EPVDBG(ep, "kick req %p act=%d/%d chunk=%d last=%d\n",
57 req, act, len, chunk, req->last_desc);
60 if (!req->req.dma) {
64 memcpy(ep->buf, req->req.buf + act, chunk);
70 vhub_dma_workaround(req->req.buf);
71 writel(req->req.dma + act, ep->epn.regs + AST_VHUB_EP_DESC_BASE);
75 req->active = true;
84 struct ast_vhub_req *req;
93 req = list_first_entry_or_null(&ep->queue, struct ast_vhub_req, queue);
95 EPVDBG(ep, "ACK status=%08x is_in=%d, req=%p (active=%d)\n",
96 stat, ep->epn.is_in, req, req ? req->active : 0);
99 if (!req)
106 if (!req->active)
116 req->active = false;
122 if (!req->req.dma && !ep->epn.is_in && len) {
123 if (req->req.actual + len > req->req.length) {
124 req->last_desc = 1;
128 memcpy(req->req.buf + req->req.actual, ep->buf, len);
132 req->req.actual += len;
136 req->last_desc = 1;
140 if (req->last_desc >= 0) {
141 ast_vhub_done(ep, req, status);
142 req = list_first_entry_or_null(&ep->queue, struct ast_vhub_req,
149 if (!req || req->active)
154 ast_vhub_epn_kick(ep, req);
169 struct ast_vhub_req *req)
172 unsigned int act = req->act_count;
173 unsigned int len = req->req.length;
177 req->active = true;
180 if (req->last_desc >= 0)
187 while (ast_vhub_count_free_descs(ep) && req->last_desc < 0) {
206 if (!chunk || !req->req.zero || (chunk % ep->ep.maxpacket) != 0)
207 req->last_desc = d_num;
213 act, len, chunk, req->last_desc, d_num,
217 desc->w0 = cpu_to_le32(req->req.dma + act);
230 if (req->last_desc >= 0 || !ast_vhub_count_free_descs(ep))
234 req->act_count = act = act + chunk;
250 struct ast_vhub_req *req;
264 req = list_first_entry_or_null(&ep->queue, struct ast_vhub_req, queue);
283 EPVDBG(ep, " desc %d len=%d req=%p (act=%d)\n",
284 d_num, len, req, req ? req->active : 0);
287 if (!req || !req->active)
291 req->req.actual += len;
294 is_last_desc = req->last_desc == d_num;
296 (req->req.actual >= req->req.length &&
297 !req->req.zero)),
300 is_last_desc, len, req->req.actual, req->req.length,
301 req->req.zero, ep->ep.maxpacket);
314 ast_vhub_done(ep, req, 0);
315 req = list_first_entry_or_null(&ep->queue,
323 if (req)
324 ast_vhub_epn_kick_desc(ep, req);
338 struct ast_vhub_req *req = to_ast_req(u_req);
350 u_req->complete, req->internal);
391 EPVDBG(ep, "enqueue req @%p\n", req);
400 req->act_count = 0;
401 req->active = false;
402 req->last_desc = -1;
407 list_add_tail(&req->queue, &ep->queue);
410 ast_vhub_epn_kick_desc(ep, req);
412 ast_vhub_epn_kick(ep, req);
476 struct ast_vhub_req *req = NULL, *iter;
484 if (&iter->req != u_req)
486 req = iter;
490 if (req) {
491 EPVDBG(ep, "dequeue req @%p active=%d\n",
492 req, req->active);
493 if (req->active)
495 ast_vhub_done(ep, req, -ECONNRESET);