diff options
author | Chris Lew <clew@codeaurora.org> | 2017-10-26 18:28:56 -0400 |
---|---|---|
committer | Bjorn Andersson <bjorn.andersson@linaro.org> | 2017-10-31 00:25:11 -0400 |
commit | 290318702bb2e7d74c24fbe52d8184fc79a17e93 (patch) | |
tree | 31423b6a9ae72a72196411bab846abc122e5bbd8 | |
parent | 073893778dc2f68e41d65d79925ca89db526b4ab (diff) |
rpmsg: glink: Use best fit intent during tx
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 <clew@codeaurora.org>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
-rw-r--r-- | drivers/rpmsg/qcom_glink_native.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/drivers/rpmsg/qcom_glink_native.c b/drivers/rpmsg/qcom_glink_native.c index 2dff77882ced..80d9af307b40 100644 --- a/drivers/rpmsg/qcom_glink_native.c +++ b/drivers/rpmsg/qcom_glink_native.c | |||
@@ -1257,11 +1257,16 @@ static int __qcom_glink_send(struct glink_channel *channel, | |||
1257 | spin_lock_irqsave(&channel->intent_lock, flags); | 1257 | spin_lock_irqsave(&channel->intent_lock, flags); |
1258 | idr_for_each_entry(&channel->riids, tmp, iid) { | 1258 | idr_for_each_entry(&channel->riids, tmp, iid) { |
1259 | if (tmp->size >= len && !tmp->in_use) { | 1259 | if (tmp->size >= len && !tmp->in_use) { |
1260 | tmp->in_use = true; | 1260 | if (!intent) |
1261 | intent = tmp; | 1261 | intent = tmp; |
1262 | break; | 1262 | else if (intent->size > tmp->size) |
1263 | intent = tmp; | ||
1264 | if (intent->size == len) | ||
1265 | break; | ||
1263 | } | 1266 | } |
1264 | } | 1267 | } |
1268 | if (intent) | ||
1269 | intent->in_use = true; | ||
1265 | spin_unlock_irqrestore(&channel->intent_lock, flags); | 1270 | spin_unlock_irqrestore(&channel->intent_lock, flags); |
1266 | 1271 | ||
1267 | /* We found an available intent */ | 1272 | /* We found an available intent */ |