Skip to content

Commit

Permalink
rpmsg: glink: Use best fit intent during tx
Browse files Browse the repository at this point in the history
Intents can vary in size, try to find the best fitting remote intent
instead of first fit when sending a message to the remote proc.

Signed-off-by: Chris Lew <[email protected]>
Signed-off-by: Bjorn Andersson <[email protected]>
  • Loading branch information
Chris Lew authored and andersson committed Oct 31, 2017
1 parent 0738937 commit 2903187
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions drivers/rpmsg/qcom_glink_native.c
Original file line number Diff line number Diff line change
Expand Up @@ -1257,11 +1257,16 @@ static int __qcom_glink_send(struct glink_channel *channel,
spin_lock_irqsave(&channel->intent_lock, flags);
idr_for_each_entry(&channel->riids, tmp, iid) {
if (tmp->size >= len && !tmp->in_use) {
tmp->in_use = true;
intent = tmp;
break;
if (!intent)
intent = tmp;
else if (intent->size > tmp->size)
intent = tmp;
if (intent->size == len)
break;
}
}
if (intent)
intent->in_use = true;
spin_unlock_irqrestore(&channel->intent_lock, flags);

/* We found an available intent */
Expand Down

0 comments on commit 2903187

Please sign in to comment.