Lines Matching defs:txn

210 	struct relay_transaction *txn;
226 txn = mempool_alloc(&relay->pool, incoming ? GFP_ATOMIC : GFP_KERNEL);
227 if (!txn)
230 txn->incoming = incoming;
231 txn->remote = remote;
232 txn->rid = rid;
233 txn->offset = remote ?
234 prepare_pf2guc(incoming ? txn->response_buf : txn->request_buf, remote, rid) :
235 prepare_vf2guc(incoming ? txn->response_buf : txn->request_buf, rid);
237 relay_assert(relay, txn->offset);
238 relay_assert(relay, txn->offset + GUC_RELAY_MSG_MAX_LEN <= ARRAY_SIZE(txn->request_buf));
239 relay_assert(relay, txn->offset + GUC_RELAY_MSG_MAX_LEN <= ARRAY_SIZE(txn->response_buf));
241 txn->request = txn->request_buf + txn->offset;
242 memcpy(&txn->request_buf[txn->offset], action, sizeof(u32) * action_len);
243 txn->request_len = action_len;
245 txn->response = resp ?: txn->response_buf + txn->offset;
246 txn->response_len = resp_size ?: GUC_RELAY_MSG_MAX_LEN;
247 txn->reply = -ENOMSG;
248 INIT_LIST_HEAD(&txn->link);
249 init_completion(&txn->done);
251 return txn;
270 static void relay_release_transaction(struct xe_guc_relay *relay, struct relay_transaction *txn)
272 relay_assert(relay, list_empty(&txn->link));
274 txn->offset = 0;
275 txn->response = NULL;
276 txn->reply = -ESTALE;
277 mempool_free(txn, &relay->pool);
280 static int relay_send_transaction(struct xe_guc_relay *relay, struct relay_transaction *txn)
282 u32 len = txn->incoming ? txn->response_len : txn->request_len;
283 u32 *buf = txn->incoming ? txn->response_buf : txn->request_buf;
284 u32 *msg = buf + txn->offset;
287 relay_assert(relay, txn->offset);
288 relay_assert(relay, txn->offset + len <= GUC_CTB_MAX_DWORDS);
294 txn->rid, txn->remote, (int)sizeof(u32) * len, msg);
296 ret = xe_guc_ct_send_block(relay_to_ct(relay), buf, len + txn->offset);
306 ERR_PTR(ret), (int)sizeof(u32) * txn->offset, buf);
309 txn->rid, txn->remote, ERR_PTR(ret), (int)sizeof(u32) * len, msg);
405 struct relay_transaction *txn,
409 u32 *msg = &txn->request_buf[txn->offset];
410 u32 len = txn->request_len;
421 txn->rid, txn->remote, action, data0);
425 list_add_tail(&txn->link, &relay->pending_relays);
429 ret = relay_send_transaction(relay, txn);
434 n = wait_for_completion_timeout(&txn->done, timeout);
435 if (unlikely(n == 0 && txn->reply)) {
441 txn->remote, txn->rid, txn->reply, jiffies_to_msecs(timeout - n));
442 if (unlikely(txn->reply)) {
443 reinit_completion(&txn->done);
444 if (txn->reply == -EAGAIN)
446 if (txn->reply == -EBUSY) {
450 if (txn->reply > 0)
451 ret = from_relay_error(txn->reply);
453 ret = txn->reply;
457 relay_debug(relay, "%u.%u response %*ph\n", txn->remote, txn->rid,
458 (int)sizeof(u32) * txn->response_len, txn->response);
459 relay_assert(relay, txn->response_len >= GUC_RELAY_MSG_MIN_LEN);
460 ret = txn->response_len;
464 list_del_init(&txn->link);
469 guc_hxg_type_to_string(type), txn->rid,
470 action, data0, txn->remote, ERR_PTR(ret),
480 struct relay_transaction *txn;
491 txn = relay_new_transaction(relay, target, msg, len, buf, buf_size);
492 if (IS_ERR(txn))
493 return PTR_ERR(txn);
497 ret = relay_send_message_and_wait(relay, txn, buf, buf_size);
503 ret = relay_send_transaction(relay, txn);
510 relay_release_transaction(relay, txn);
688 struct relay_transaction *txn;
691 txn = list_first_entry_or_null(&relay->incoming_actions, struct relay_transaction, link);
692 if (txn)
693 list_del_init(&txn->link);
696 return txn;
701 struct relay_transaction *txn;
706 txn = relay_dequeue_transaction(relay);
707 if (!txn)
710 type = FIELD_GET(GUC_HXG_MSG_0_TYPE, txn->request_buf[txn->offset]);
712 ret = relay_action_handler(relay, txn->remote,
713 txn->request_buf + txn->offset, txn->request_len,
714 txn->response_buf + txn->offset,
715 ARRAY_SIZE(txn->response_buf) - txn->offset);
719 ret = guc_hxg_msg_encode_busy(txn->response_buf + txn->offset, 0);
723 txn->response_len = ret;
724 ret = relay_send_transaction(relay, txn);
731 guc_hxg_type_to_string(type), txn->rid, txn->remote,
732 ERR_PTR(ret), 4 * txn->request_len, txn->request_buf + txn->offset);
734 txn->response_len = prepare_error_reply(txn->response_buf + txn->offset,
735 txn->remote ?
737 txn->remote ?
739 ret = relay_send_transaction(relay, txn);
745 list_add(&txn->link, &relay->incoming_actions);
752 txn->rid, ERR_PTR(ret), 4 * txn->request_len,
753 txn->request_buf + txn->offset);
755 relay_release_transaction(relay, txn);
782 struct relay_transaction *txn;
784 txn = relay_new_incoming_transaction(relay, origin, rid, msg, len);
785 if (IS_ERR(txn))
786 return PTR_ERR(txn);
789 list_add_tail(&txn->link, &relay->incoming_actions);