Lines Matching full:intent
64 * struct glink_core_rx_intent - RX intent
65 * RX intent
68 * @id: remote or local intent ID
69 * @size: size of the original intent (do not modify)
70 * @reuse: To mark if the intent can be reused after first use
71 * @in_use: To mark if intent is already in use for the channel
100 * @intentless: flag to indicate that there is no intent
158 * @intent_req_lock: Synchronises multiple intent requests
159 * @intent_req_result: Result of intent request
160 * @intent_received: flag indicating that an intent has been received
264 struct glink_core_rx_intent *intent; in qcom_glink_channel_release() local
274 list_for_each_entry_safe(intent, tmp, &channel->done_intents, node) { in qcom_glink_channel_release()
275 if (!intent->reuse) { in qcom_glink_channel_release()
276 kfree(intent->data); in qcom_glink_channel_release()
277 kfree(intent); in qcom_glink_channel_release()
559 struct glink_core_rx_intent *intent, *tmp; in qcom_glink_rx_done_work() local
572 list_for_each_entry_safe(intent, tmp, &channel->done_intents, node) { in qcom_glink_rx_done_work()
573 list_del(&intent->node); in qcom_glink_rx_done_work()
575 iid = intent->id; in qcom_glink_rx_done_work()
576 reuse = intent->reuse; in qcom_glink_rx_done_work()
587 kfree(intent->data); in qcom_glink_rx_done_work()
588 kfree(intent); in qcom_glink_rx_done_work()
597 struct glink_core_rx_intent *intent) in qcom_glink_rx_done() argument
601 kfree(intent->data); in qcom_glink_rx_done()
602 kfree(intent); in qcom_glink_rx_done()
607 if (!intent->reuse) { in qcom_glink_rx_done()
609 idr_remove(&channel->liids, intent->id); in qcom_glink_rx_done()
615 list_add_tail(&intent->node, &channel->done_intents); in qcom_glink_rx_done()
683 * qcom_glink_send_intent_req_ack() - convert an rx intent request ack cmd to
711 * qcom_glink_advertise_intent - convert an rx intent cmd to wire format and
715 * @intent: The intent to pass on to remote.
721 struct glink_core_rx_intent *intent) in qcom_glink_advertise_intent() argument
735 cmd.size = cpu_to_le32(intent->size); in qcom_glink_advertise_intent()
736 cmd.liid = cpu_to_le32(intent->id); in qcom_glink_advertise_intent()
753 struct glink_core_rx_intent *intent; in qcom_glink_alloc_intent() local
757 intent = kzalloc(sizeof(*intent), GFP_KERNEL); in qcom_glink_alloc_intent()
758 if (!intent) in qcom_glink_alloc_intent()
761 intent->data = kzalloc(size, GFP_KERNEL); in qcom_glink_alloc_intent()
762 if (!intent->data) in qcom_glink_alloc_intent()
766 ret = idr_alloc_cyclic(&channel->liids, intent, 1, -1, GFP_ATOMIC); in qcom_glink_alloc_intent()
773 intent->id = ret; in qcom_glink_alloc_intent()
774 intent->size = size; in qcom_glink_alloc_intent()
775 intent->reuse = reuseable; in qcom_glink_alloc_intent()
777 return intent; in qcom_glink_alloc_intent()
780 kfree(intent->data); in qcom_glink_alloc_intent()
782 kfree(intent); in qcom_glink_alloc_intent()
790 struct glink_core_rx_intent *intent; in qcom_glink_handle_rx_done() local
808 intent = idr_find(&channel->riids, iid); in qcom_glink_handle_rx_done()
810 if (!intent) { in qcom_glink_handle_rx_done()
812 dev_err(glink->dev, "invalid intent id received\n"); in qcom_glink_handle_rx_done()
816 intent->in_use = false; in qcom_glink_handle_rx_done()
819 idr_remove(&channel->riids, intent->id); in qcom_glink_handle_rx_done()
820 kfree(intent); in qcom_glink_handle_rx_done()
835 * @size: size of the intent
843 struct glink_core_rx_intent *intent; in qcom_glink_handle_intent_req() local
860 intent = qcom_glink_alloc_intent(glink, channel, size, false); in qcom_glink_handle_intent_req()
861 if (intent) in qcom_glink_handle_intent_req()
862 qcom_glink_advertise_intent(glink, channel, intent); in qcom_glink_handle_intent_req()
864 qcom_glink_send_intent_req_ack(glink, channel, !!intent); in qcom_glink_handle_intent_req()
900 struct glink_core_rx_intent *intent; in qcom_glink_rx_data() local
948 intent = kzalloc(sizeof(*intent), GFP_ATOMIC); in qcom_glink_rx_data()
949 if (!intent) in qcom_glink_rx_data()
952 intent->data = kmalloc(chunk_size + left_size, in qcom_glink_rx_data()
954 if (!intent->data) { in qcom_glink_rx_data()
955 kfree(intent); in qcom_glink_rx_data()
959 intent->id = 0xbabababa; in qcom_glink_rx_data()
960 intent->size = chunk_size + left_size; in qcom_glink_rx_data()
961 intent->offset = 0; in qcom_glink_rx_data()
963 channel->buf = intent; in qcom_glink_rx_data()
965 intent = channel->buf; in qcom_glink_rx_data()
969 intent = idr_find(&channel->liids, liid); in qcom_glink_rx_data()
972 if (!intent) { in qcom_glink_rx_data()
974 "no intent found for channel %s intent %d", in qcom_glink_rx_data()
981 if (intent->size - intent->offset < chunk_size) { in qcom_glink_rx_data()
982 dev_err(glink->dev, "Insufficient space in intent\n"); in qcom_glink_rx_data()
988 qcom_glink_rx_peek(glink, intent->data + intent->offset, in qcom_glink_rx_data()
990 intent->offset += chunk_size; in qcom_glink_rx_data()
997 intent->data, in qcom_glink_rx_data()
998 intent->offset, in qcom_glink_rx_data()
1004 intent->offset = 0; in qcom_glink_rx_data()
1007 qcom_glink_rx_done(glink, channel, intent); in qcom_glink_rx_data()
1029 struct glink_core_rx_intent *intent; in qcom_glink_handle_intent() local
1073 intent = kzalloc(sizeof(*intent), GFP_ATOMIC); in qcom_glink_handle_intent()
1074 if (!intent) in qcom_glink_handle_intent()
1077 intent->id = le32_to_cpu(msg->intents[i].iid); in qcom_glink_handle_intent()
1078 intent->size = le32_to_cpu(msg->intents[i].size); in qcom_glink_handle_intent()
1081 ret = idr_alloc(&channel->riids, intent, in qcom_glink_handle_intent()
1082 intent->id, intent->id + 1, GFP_ATOMIC); in qcom_glink_handle_intent()
1086 dev_err(glink->dev, "failed to store remote intent\n"); in qcom_glink_handle_intent()
1364 struct glink_core_rx_intent *intent; in qcom_glink_announce_create() local
1386 intent = qcom_glink_alloc_intent(glink, channel, size, in qcom_glink_announce_create()
1388 if (!intent) in qcom_glink_announce_create()
1391 qcom_glink_advertise_intent(glink, channel, intent); in qcom_glink_announce_create()
1449 dev_err(glink->dev, "intent request timed out\n"); in qcom_glink_request_intent()
1466 struct glink_core_rx_intent *intent = NULL; in __qcom_glink_send() local
1480 while (!intent) { in __qcom_glink_send()
1484 if (!intent) in __qcom_glink_send()
1485 intent = tmp; in __qcom_glink_send()
1486 else if (intent->size > tmp->size) in __qcom_glink_send()
1487 intent = tmp; in __qcom_glink_send()
1488 if (intent->size == len) in __qcom_glink_send()
1492 if (intent) in __qcom_glink_send()
1493 intent->in_use = true; in __qcom_glink_send()
1496 /* We found an available intent */ in __qcom_glink_send()
1497 if (intent) in __qcom_glink_send()
1508 iid = intent->id; in __qcom_glink_send()
1530 /* Mark intent available if we failed */ in __qcom_glink_send()
1531 if (intent) in __qcom_glink_send()
1532 intent->in_use = false; in __qcom_glink_send()
1966 /* Abort any senders waiting for intent requests */ in qcom_glink_native_remove()