Skip to content

Commit 8956927

Browse files
Arun Kumar Neelakantamandersson
authored andcommitted
rpmsg: glink: Add TX_DATA_CONT command while sending
With current design the transport can send packets of size upto FIFO_SIZE which is 16k and return failure for all packets above 16k. Add TX_DATA_CONT command to send packets greater than 16k by splitting into 8K chunks. Signed-off-by: Arun Kumar Neelakantam <[email protected]> Signed-off-by: Deepak Kumar Singh <[email protected]> Signed-off-by: Bjorn Andersson <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 63b8d79 commit 8956927

File tree

1 file changed

+34
-4
lines changed

1 file changed

+34
-4
lines changed

drivers/rpmsg/qcom_glink_native.c

Lines changed: 34 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1271,6 +1271,8 @@ static int __qcom_glink_send(struct glink_channel *channel,
12711271
} __packed req;
12721272
int ret;
12731273
unsigned long flags;
1274+
int chunk_size = len;
1275+
int left_size = 0;
12741276

12751277
if (!glink->intentless) {
12761278
while (!intent) {
@@ -1304,18 +1306,46 @@ static int __qcom_glink_send(struct glink_channel *channel,
13041306
iid = intent->id;
13051307
}
13061308

1309+
if (wait && chunk_size > SZ_8K) {
1310+
chunk_size = SZ_8K;
1311+
left_size = len - chunk_size;
1312+
}
13071313
req.msg.cmd = cpu_to_le16(RPM_CMD_TX_DATA);
13081314
req.msg.param1 = cpu_to_le16(channel->lcid);
13091315
req.msg.param2 = cpu_to_le32(iid);
1310-
req.chunk_size = cpu_to_le32(len);
1311-
req.left_size = cpu_to_le32(0);
1316+
req.chunk_size = cpu_to_le32(chunk_size);
1317+
req.left_size = cpu_to_le32(left_size);
13121318

1313-
ret = qcom_glink_tx(glink, &req, sizeof(req), data, len, wait);
1319+
ret = qcom_glink_tx(glink, &req, sizeof(req), data, chunk_size, wait);
13141320

13151321
/* Mark intent available if we failed */
1316-
if (ret && intent)
1322+
if (ret && intent) {
13171323
intent->in_use = false;
1324+
return ret;
1325+
}
13181326

1327+
while (left_size > 0) {
1328+
data = (void *)((char *)data + chunk_size);
1329+
chunk_size = left_size;
1330+
if (chunk_size > SZ_8K)
1331+
chunk_size = SZ_8K;
1332+
left_size -= chunk_size;
1333+
1334+
req.msg.cmd = cpu_to_le16(RPM_CMD_TX_DATA_CONT);
1335+
req.msg.param1 = cpu_to_le16(channel->lcid);
1336+
req.msg.param2 = cpu_to_le32(iid);
1337+
req.chunk_size = cpu_to_le32(chunk_size);
1338+
req.left_size = cpu_to_le32(left_size);
1339+
1340+
ret = qcom_glink_tx(glink, &req, sizeof(req), data,
1341+
chunk_size, wait);
1342+
1343+
/* Mark intent available if we failed */
1344+
if (ret && intent) {
1345+
intent->in_use = false;
1346+
break;
1347+
}
1348+
}
13191349
return ret;
13201350
}
13211351

0 commit comments

Comments
 (0)