Lines Matching full:intent
56 * struct glink_core_rx_intent - RX intent
57 * RX intent
60 * @id: remote or local intent ID
61 * @size: size of the original intent (do not modify)
62 * @reuse: To mark if the intent can be reused after first use
63 * @in_use: To mark if intent is already in use for the channel
94 * @intentless: flag to indicate that there is no intent
152 * @intent_req_lock: Synchronises multiple intent requests
153 * @intent_req_result: Result of intent request
246 struct glink_core_rx_intent *intent; in qcom_glink_channel_release() local
256 list_for_each_entry_safe(intent, tmp, &channel->done_intents, node) { in qcom_glink_channel_release()
257 if (!intent->reuse) { in qcom_glink_channel_release()
258 kfree(intent->data); in qcom_glink_channel_release()
259 kfree(intent); in qcom_glink_channel_release()
503 struct glink_core_rx_intent *intent, *tmp; in qcom_glink_rx_done_work() local
516 list_for_each_entry_safe(intent, tmp, &channel->done_intents, node) { in qcom_glink_rx_done_work()
517 list_del(&intent->node); in qcom_glink_rx_done_work()
519 iid = intent->id; in qcom_glink_rx_done_work()
520 reuse = intent->reuse; in qcom_glink_rx_done_work()
528 kfree(intent->data); in qcom_glink_rx_done_work()
529 kfree(intent); in qcom_glink_rx_done_work()
538 struct glink_core_rx_intent *intent) in qcom_glink_rx_done() argument
542 kfree(intent->data); in qcom_glink_rx_done()
543 kfree(intent); in qcom_glink_rx_done()
548 if (!intent->reuse) { in qcom_glink_rx_done()
550 idr_remove(&channel->liids, intent->id); in qcom_glink_rx_done()
556 list_add_tail(&intent->node, &channel->done_intents); in qcom_glink_rx_done()
620 * qcom_glink_send_intent_req_ack() - convert an rx intent request ack cmd to
644 * qcom_glink_advertise_intent - convert an rx intent cmd to wire format and
648 * @intent: The intent to pass on to remote.
654 struct glink_core_rx_intent *intent) in qcom_glink_advertise_intent() argument
668 cmd.size = cpu_to_le32(intent->size); in qcom_glink_advertise_intent()
669 cmd.liid = cpu_to_le32(intent->id); in qcom_glink_advertise_intent()
682 struct glink_core_rx_intent *intent; in qcom_glink_alloc_intent() local
686 intent = kzalloc(sizeof(*intent), GFP_KERNEL); in qcom_glink_alloc_intent()
687 if (!intent) in qcom_glink_alloc_intent()
690 intent->data = kzalloc(size, GFP_KERNEL); in qcom_glink_alloc_intent()
691 if (!intent->data) in qcom_glink_alloc_intent()
695 ret = idr_alloc_cyclic(&channel->liids, intent, 1, -1, GFP_ATOMIC); in qcom_glink_alloc_intent()
702 intent->id = ret; in qcom_glink_alloc_intent()
703 intent->size = size; in qcom_glink_alloc_intent()
704 intent->reuse = reuseable; in qcom_glink_alloc_intent()
706 return intent; in qcom_glink_alloc_intent()
709 kfree(intent->data); in qcom_glink_alloc_intent()
711 kfree(intent); in qcom_glink_alloc_intent()
719 struct glink_core_rx_intent *intent; in qcom_glink_handle_rx_done() local
732 intent = idr_find(&channel->riids, iid); in qcom_glink_handle_rx_done()
734 if (!intent) { in qcom_glink_handle_rx_done()
736 dev_err(glink->dev, "invalid intent id received\n"); in qcom_glink_handle_rx_done()
740 intent->in_use = false; in qcom_glink_handle_rx_done()
743 idr_remove(&channel->riids, intent->id); in qcom_glink_handle_rx_done()
744 kfree(intent); in qcom_glink_handle_rx_done()
754 * @size: size of the intent
762 struct glink_core_rx_intent *intent; in qcom_glink_handle_intent_req() local
775 intent = qcom_glink_alloc_intent(glink, channel, size, false); in qcom_glink_handle_intent_req()
776 if (intent) in qcom_glink_handle_intent_req()
777 qcom_glink_advertise_intent(glink, channel, intent); in qcom_glink_handle_intent_req()
779 qcom_glink_send_intent_req_ack(glink, channel, !!intent); in qcom_glink_handle_intent_req()
813 struct glink_core_rx_intent *intent; in qcom_glink_rx_data() local
855 intent = kzalloc(sizeof(*intent), GFP_ATOMIC); in qcom_glink_rx_data()
856 if (!intent) in qcom_glink_rx_data()
859 intent->data = kmalloc(chunk_size + left_size, in qcom_glink_rx_data()
861 if (!intent->data) { in qcom_glink_rx_data()
862 kfree(intent); in qcom_glink_rx_data()
866 intent->id = 0xbabababa; in qcom_glink_rx_data()
867 intent->size = chunk_size + left_size; in qcom_glink_rx_data()
868 intent->offset = 0; in qcom_glink_rx_data()
870 channel->buf = intent; in qcom_glink_rx_data()
872 intent = channel->buf; in qcom_glink_rx_data()
878 intent = idr_find(&channel->liids, liid); in qcom_glink_rx_data()
881 if (!intent) { in qcom_glink_rx_data()
883 "no intent found for channel %s intent %d", in qcom_glink_rx_data()
890 if (intent->size - intent->offset < chunk_size) { in qcom_glink_rx_data()
891 dev_err(glink->dev, "Insufficient space in intent\n"); in qcom_glink_rx_data()
897 qcom_glink_rx_peak(glink, intent->data + intent->offset, in qcom_glink_rx_data()
899 intent->offset += chunk_size; in qcom_glink_rx_data()
906 intent->data, in qcom_glink_rx_data()
907 intent->offset, in qcom_glink_rx_data()
913 intent->offset = 0; in qcom_glink_rx_data()
916 qcom_glink_rx_done(glink, channel, intent); in qcom_glink_rx_data()
930 struct glink_core_rx_intent *intent; in qcom_glink_handle_intent() local
967 intent = kzalloc(sizeof(*intent), GFP_ATOMIC); in qcom_glink_handle_intent()
968 if (!intent) in qcom_glink_handle_intent()
971 intent->id = le32_to_cpu(msg->intents[i].iid); in qcom_glink_handle_intent()
972 intent->size = le32_to_cpu(msg->intents[i].size); in qcom_glink_handle_intent()
975 ret = idr_alloc(&channel->riids, intent, in qcom_glink_handle_intent()
976 intent->id, intent->id + 1, GFP_ATOMIC); in qcom_glink_handle_intent()
980 dev_err(glink->dev, "failed to store remote intent\n"); in qcom_glink_handle_intent()
1202 struct glink_core_rx_intent *intent; in qcom_glink_announce_create() local
1224 intent = qcom_glink_alloc_intent(glink, channel, size, in qcom_glink_announce_create()
1226 if (!intent) in qcom_glink_announce_create()
1229 qcom_glink_advertise_intent(glink, channel, intent); in qcom_glink_announce_create()
1277 dev_err(glink->dev, "intent request timed out\n"); in qcom_glink_request_intent()
1292 struct glink_core_rx_intent *intent = NULL; in __qcom_glink_send() local
1306 while (!intent) { in __qcom_glink_send()
1310 if (!intent) in __qcom_glink_send()
1311 intent = tmp; in __qcom_glink_send()
1312 else if (intent->size > tmp->size) in __qcom_glink_send()
1313 intent = tmp; in __qcom_glink_send()
1314 if (intent->size == len) in __qcom_glink_send()
1318 if (intent) in __qcom_glink_send()
1319 intent->in_use = true; in __qcom_glink_send()
1322 /* We found an available intent */ in __qcom_glink_send()
1323 if (intent) in __qcom_glink_send()
1334 iid = intent->id; in __qcom_glink_send()
1349 /* Mark intent available if we failed */ in __qcom_glink_send()
1350 if (ret && intent) { in __qcom_glink_send()
1351 intent->in_use = false; in __qcom_glink_send()
1371 /* Mark intent available if we failed */ in __qcom_glink_send()
1372 if (ret && intent) { in __qcom_glink_send()
1373 intent->in_use = false; in __qcom_glink_send()