Lines Matching refs:rqst
86 static u16 ssh_request_get_rqid(struct ssh_request *rqst) in ssh_request_get_rqid() argument
88 return get_unaligned_le16(rqst->packet.data.ptr in ssh_request_get_rqid()
92 static u32 ssh_request_get_rqid_safe(struct ssh_request *rqst) in ssh_request_get_rqid_safe() argument
94 if (!rqst->packet.data.ptr) in ssh_request_get_rqid_safe()
97 return ssh_request_get_rqid(rqst); in ssh_request_get_rqid_safe()
100 static void ssh_rtl_queue_remove(struct ssh_request *rqst) in ssh_rtl_queue_remove() argument
102 struct ssh_rtl *rtl = ssh_request_rtl(rqst); in ssh_rtl_queue_remove()
106 if (!test_and_clear_bit(SSH_REQUEST_SF_QUEUED_BIT, &rqst->state)) { in ssh_rtl_queue_remove()
111 list_del(&rqst->node); in ssh_rtl_queue_remove()
114 ssh_request_put(rqst); in ssh_rtl_queue_remove()
128 static void ssh_rtl_pending_remove(struct ssh_request *rqst) in ssh_rtl_pending_remove() argument
130 struct ssh_rtl *rtl = ssh_request_rtl(rqst); in ssh_rtl_pending_remove()
134 if (!test_and_clear_bit(SSH_REQUEST_SF_PENDING_BIT, &rqst->state)) { in ssh_rtl_pending_remove()
140 list_del(&rqst->node); in ssh_rtl_pending_remove()
144 ssh_request_put(rqst); in ssh_rtl_pending_remove()
147 static int ssh_rtl_tx_pending_push(struct ssh_request *rqst) in ssh_rtl_tx_pending_push() argument
149 struct ssh_rtl *rtl = ssh_request_rtl(rqst); in ssh_rtl_tx_pending_push()
153 if (test_bit(SSH_REQUEST_SF_LOCKED_BIT, &rqst->state)) { in ssh_rtl_tx_pending_push()
158 if (test_and_set_bit(SSH_REQUEST_SF_PENDING_BIT, &rqst->state)) { in ssh_rtl_tx_pending_push()
164 list_add_tail(&ssh_request_get(rqst)->node, &rtl->pending.head); in ssh_rtl_tx_pending_push()
170 static void ssh_rtl_complete_with_status(struct ssh_request *rqst, int status) in ssh_rtl_complete_with_status() argument
172 struct ssh_rtl *rtl = ssh_request_rtl(rqst); in ssh_rtl_complete_with_status()
174 trace_ssam_request_complete(rqst, status); in ssh_rtl_complete_with_status()
178 ssh_request_get_rqid_safe(rqst), status); in ssh_rtl_complete_with_status()
180 rqst->ops->complete(rqst, NULL, NULL, status); in ssh_rtl_complete_with_status()
183 static void ssh_rtl_complete_with_rsp(struct ssh_request *rqst, in ssh_rtl_complete_with_rsp() argument
187 struct ssh_rtl *rtl = ssh_request_rtl(rqst); in ssh_rtl_complete_with_rsp()
189 trace_ssam_request_complete(rqst, 0); in ssh_rtl_complete_with_rsp()
192 ssh_request_get_rqid(rqst)); in ssh_rtl_complete_with_rsp()
194 rqst->ops->complete(rqst, cmd, data, 0); in ssh_rtl_complete_with_rsp()
197 static bool ssh_rtl_tx_can_process(struct ssh_request *rqst) in ssh_rtl_tx_can_process() argument
199 struct ssh_rtl *rtl = ssh_request_rtl(rqst); in ssh_rtl_tx_can_process()
201 if (test_bit(SSH_REQUEST_TY_FLUSH_BIT, &rqst->state)) in ssh_rtl_tx_can_process()
209 struct ssh_request *rqst = ERR_PTR(-ENOENT); in ssh_rtl_tx_next() local
220 rqst = ERR_PTR(-EBUSY); in ssh_rtl_tx_next()
232 rqst = p; in ssh_rtl_tx_next()
237 return rqst; in ssh_rtl_tx_next()
242 struct ssh_request *rqst; in ssh_rtl_tx_try_process_one() local
246 rqst = ssh_rtl_tx_next(rtl); in ssh_rtl_tx_try_process_one()
247 if (IS_ERR(rqst)) in ssh_rtl_tx_try_process_one()
248 return PTR_ERR(rqst); in ssh_rtl_tx_try_process_one()
251 status = ssh_rtl_tx_pending_push(rqst); in ssh_rtl_tx_try_process_one()
253 ssh_request_put(rqst); in ssh_rtl_tx_try_process_one()
258 status = ssh_ptl_submit(&rtl->ptl, &rqst->packet); in ssh_rtl_tx_try_process_one()
264 set_bit(SSH_REQUEST_SF_LOCKED_BIT, &rqst->state); in ssh_rtl_tx_try_process_one()
276 ssh_rtl_pending_remove(rqst); in ssh_rtl_tx_try_process_one()
277 ssh_rtl_complete_with_status(rqst, -ESHUTDOWN); in ssh_rtl_tx_try_process_one()
279 ssh_request_put(rqst); in ssh_rtl_tx_try_process_one()
297 ssh_request_put(rqst); in ssh_rtl_tx_try_process_one()
301 ssh_request_put(rqst); in ssh_rtl_tx_try_process_one()
361 int ssh_rtl_submit(struct ssh_rtl *rtl, struct ssh_request *rqst) in ssh_rtl_submit() argument
363 trace_ssam_request_submit(rqst); in ssh_rtl_submit()
370 if (test_bit(SSH_REQUEST_TY_HAS_RESPONSE_BIT, &rqst->state)) in ssh_rtl_submit()
371 if (!test_bit(SSH_PACKET_TY_SEQUENCED_BIT, &rqst->packet.state)) in ssh_rtl_submit()
391 if (cmpxchg(&rqst->packet.ptl, NULL, &rtl->ptl)) { in ssh_rtl_submit()
412 if (test_bit(SSH_REQUEST_SF_LOCKED_BIT, &rqst->state)) { in ssh_rtl_submit()
417 set_bit(SSH_REQUEST_SF_QUEUED_BIT, &rqst->state); in ssh_rtl_submit()
418 list_add_tail(&ssh_request_get(rqst)->node, &rtl->queue.head); in ssh_rtl_submit()
443 static void ssh_rtl_timeout_start(struct ssh_request *rqst) in ssh_rtl_timeout_start() argument
445 struct ssh_rtl *rtl = ssh_request_rtl(rqst); in ssh_rtl_timeout_start()
449 if (test_bit(SSH_REQUEST_SF_LOCKED_BIT, &rqst->state)) in ssh_rtl_timeout_start()
456 WRITE_ONCE(rqst->timestamp, timestamp); in ssh_rtl_timeout_start()
728 bool ssh_rtl_cancel(struct ssh_request *rqst, bool pending) in ssh_rtl_cancel() argument
733 if (test_and_set_bit(SSH_REQUEST_SF_CANCELED_BIT, &rqst->state)) in ssh_rtl_cancel()
736 trace_ssam_request_cancel(rqst); in ssh_rtl_cancel()
739 canceled = ssh_rtl_cancel_pending(rqst); in ssh_rtl_cancel()
741 canceled = ssh_rtl_cancel_nonpending(rqst); in ssh_rtl_cancel()
744 rtl = ssh_request_rtl(rqst); in ssh_rtl_cancel()
960 struct ssh_request *rqst; in ssh_rtl_packet_release() local
962 rqst = to_ssh_request(p); in ssh_rtl_packet_release()
963 rqst->ops->release(rqst); in ssh_rtl_packet_release()
984 int ssh_request_init(struct ssh_request *rqst, enum ssam_request_flags flags, in ssh_request_init() argument
996 ssh_packet_init(&rqst->packet, type, SSH_PACKET_PRIORITY(DATA, 0), in ssh_request_init()
999 INIT_LIST_HEAD(&rqst->node); in ssh_request_init()
1001 rqst->state = 0; in ssh_request_init()
1003 rqst->state |= BIT(SSH_REQUEST_TY_HAS_RESPONSE_BIT); in ssh_request_init()
1005 rqst->timestamp = KTIME_MAX; in ssh_request_init()
1006 rqst->ops = ops; in ssh_request_init()
1106 struct ssh_flush_request *rqst; in ssh_rtl_flush_request_complete() local
1108 rqst = container_of(r, struct ssh_flush_request, base); in ssh_rtl_flush_request_complete()
1109 rqst->status = status; in ssh_rtl_flush_request_complete()
1114 struct ssh_flush_request *rqst; in ssh_rtl_flush_request_release() local
1116 rqst = container_of(r, struct ssh_flush_request, base); in ssh_rtl_flush_request_release()
1117 complete_all(&rqst->completion); in ssh_rtl_flush_request_release()
1156 struct ssh_flush_request rqst; in ssh_rtl_flush() local
1159 ssh_request_init(&rqst.base, init_flags, &ssh_rtl_flush_request_ops); in ssh_rtl_flush()
1160 rqst.base.packet.state |= BIT(SSH_PACKET_TY_FLUSH_BIT); in ssh_rtl_flush()
1161 rqst.base.packet.priority = SSH_PACKET_PRIORITY(FLUSH, 0); in ssh_rtl_flush()
1162 rqst.base.state |= BIT(SSH_REQUEST_TY_FLUSH_BIT); in ssh_rtl_flush()
1164 init_completion(&rqst.completion); in ssh_rtl_flush()
1166 status = ssh_rtl_submit(rtl, &rqst.base); in ssh_rtl_flush()
1170 ssh_request_put(&rqst.base); in ssh_rtl_flush()
1172 if (!wait_for_completion_timeout(&rqst.completion, timeout)) { in ssh_rtl_flush()
1173 ssh_rtl_cancel(&rqst.base, true); in ssh_rtl_flush()
1174 wait_for_completion(&rqst.completion); in ssh_rtl_flush()
1177 WARN_ON(rqst.status != 0 && rqst.status != -ECANCELED && in ssh_rtl_flush()
1178 rqst.status != -ESHUTDOWN && rqst.status != -EINTR); in ssh_rtl_flush()
1180 return rqst.status == -ECANCELED ? -ETIMEDOUT : rqst.status; in ssh_rtl_flush()