From patchwork Tue Apr 18 16:30:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Andersson X-Patchwork-Id: 84967 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp2994902vqo; Tue, 18 Apr 2023 09:55:01 -0700 (PDT) X-Google-Smtp-Source: AKy350YTL2/CzI6hXUaqb3xrqe2oCpE39xt/f/9EJt4MT0ICgJ6D/rgG0zoQhiJ91fPEkwC0ObP+ X-Received: by 2002:a05:6a00:14c6:b0:63b:8423:9e31 with SMTP id w6-20020a056a0014c600b0063b84239e31mr452643pfu.11.1681836901307; Tue, 18 Apr 2023 09:55:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681836901; cv=none; d=google.com; s=arc-20160816; b=BrCQvH6psVPSE75E5T2JKnV7VM6oYmPTFYUf228juhnkyX66aC6Mk9PypFxg/ge3FR vQsW2b/py19UlpWRQi+OeuDD5hdmIJmdqFbRfjmJy8hWa8752xHQh4oq+XEbNdcQRv0R MSQEyvCPr7fcvxybfSx4h+zBoAWt8rphP1DwpHxfxbaZ6iLm0DvkvPo7G8Oq6ATT0huI zMa/PiNFi7GB7ciKkRfFdTwJTnt4900w2/cykQ6zLKMK59sloSDBjZE/PojSl9iWLDTH Y0SHmwkjlkjSueOcqqIGyu7gXk/aCnP8hGPb5he48b37NxEy1HYgmMoMEHMTiRwEexzR UqIQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=ax9Qp5WIkTCqs0jQ/m2UVDmnzSC5x5toDbw05//u7zI=; b=uFalXuMu6Uk/Ma+yWYruqxfzj/U/kdds3w9oS1cAh78zJHRBVsQ5KfI8HDcn8xatze Z8L3437dBohHmICB9ozttGMwC0DIcWsfHHwRlZ0/DoELwnM/04AOmW7i8gMaarc1uvC1 4eZAhBW+UO+Gr46/R1+TyyS/484/B4vpZjs+IT69oDkZLoKPRE+ZXhvlzhNkAFvVkLGs MxC/As4wUpBrzu0eCripeQmqtodyb55LE7wgqrenv3m1dkgpYOnQ5F4fGIxuOzE3+4go CqsqIr1eafds7/r4DP7LKI9szgbnBYVrK/7iog8NT/DQDO+m6kXtVXYaJwWw+17V1rDN I3eQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=B+LPDNnR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d137-20020a621d8f000000b0062dd1d1c48csi13966069pfd.377.2023.04.18.09.54.46; Tue, 18 Apr 2023 09:55:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=B+LPDNnR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232511AbjDRQad (ORCPT + 99 others); Tue, 18 Apr 2023 12:30:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44426 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232432AbjDRQac (ORCPT ); Tue, 18 Apr 2023 12:30:32 -0400 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9606C72A8; Tue, 18 Apr 2023 09:30:28 -0700 (PDT) Received: from pps.filterd (m0279866.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 33IEmZlt002565; Tue, 18 Apr 2023 16:30:24 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=qcppdkim1; bh=ax9Qp5WIkTCqs0jQ/m2UVDmnzSC5x5toDbw05//u7zI=; b=B+LPDNnRBNvqNO6+6C/ZXLpOvLwmC0BMIup0lWHb0ZO49ljwAaHoP2FMb2+V0CtOnLtE 6xF5tG8esJ4SSJMTeAQrZQGkWek27Ocsrfox2rBrM7if5Nof3t/HkjoTu83GRLorScRa EpuJQcK4BO+SkQapuJgQY7LgIyMtldYyBqP7aRbNkiWZwK+VLAuA0W1xk6bFvVR8lyfh O4nlof+JjqiRjPNvJLMUQ7UVqh1aIpIjH8mYHyWaAq+ff8PNre+TgUHWEhYGlCa1FE9c QyeXiKPLq7sIIEg2stHisMVwHrZWyyV5y09ZSWiHM1vwsrrCJGziz9RrEMPmoTN/wd3S 7Q== Received: from nalasppmta02.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3q1nr5hf2j-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 18 Apr 2023 16:30:24 +0000 Received: from nalasex01c.na.qualcomm.com (nalasex01c.na.qualcomm.com [10.47.97.35]) by NALASPPMTA02.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 33IGUO6L013560 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 18 Apr 2023 16:30:24 GMT Received: from hu-bjorande-lv.qualcomm.com (10.49.16.6) by nalasex01c.na.qualcomm.com (10.47.97.35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.42; Tue, 18 Apr 2023 09:30:23 -0700 From: Bjorn Andersson To: Bjorn Andersson , Mathieu Poirier , Chris Lew CC: , , Subject: [PATCH v2 1/2] rpmsg: glink: Propagate TX failures in intentless mode as well Date: Tue, 18 Apr 2023 09:30:17 -0700 Message-ID: <20230418163018.785524-2-quic_bjorande@quicinc.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230418163018.785524-1-quic_bjorande@quicinc.com> References: <20230418163018.785524-1-quic_bjorande@quicinc.com> MIME-Version: 1.0 X-Originating-IP: [10.49.16.6] X-ClientProxiedBy: nalasex01a.na.qualcomm.com (10.47.209.196) To nalasex01c.na.qualcomm.com (10.47.97.35) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-GUID: RUFQwkd6oDNnoaR1kNHCdmULZO3vbUo_ X-Proofpoint-ORIG-GUID: RUFQwkd6oDNnoaR1kNHCdmULZO3vbUo_ X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-04-18_11,2023-04-18_01,2023-02-09_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 adultscore=0 spamscore=0 suspectscore=0 impostorscore=0 phishscore=0 mlxlogscore=999 clxscore=1011 priorityscore=1501 mlxscore=0 bulkscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2303200000 definitions=main-2304180137 X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1763533810643876133?= X-GMAIL-MSGID: =?utf-8?q?1763533810643876133?= As support for splitting transmission over several messages using TX_DATA_CONT was introduced it does not immediately return the return value of qcom_glink_tx(). The result is that in the intentless case (i.e. intent == NULL), the code will continue to send all additional chunks. This is wasteful, and it's possible that the send operation could incorrectly indicate success, if the last chunk fits in the TX fifo. Fix the condition. Fixes: 8956927faed3 ("rpmsg: glink: Add TX_DATA_CONT command while sending") Reviewed-by: Chris Lew Signed-off-by: Bjorn Andersson --- Changes since v1: - Picked up Chris - Added another 's' in transmission drivers/rpmsg/qcom_glink_native.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/rpmsg/qcom_glink_native.c b/drivers/rpmsg/qcom_glink_native.c index 01d2805fe30f..62634d020d13 100644 --- a/drivers/rpmsg/qcom_glink_native.c +++ b/drivers/rpmsg/qcom_glink_native.c @@ -1356,8 +1356,9 @@ static int __qcom_glink_send(struct glink_channel *channel, ret = qcom_glink_tx(glink, &req, sizeof(req), data, chunk_size, wait); /* Mark intent available if we failed */ - if (ret && intent) { - intent->in_use = false; + if (ret) { + if (intent) + intent->in_use = false; return ret; } @@ -1378,8 +1379,9 @@ static int __qcom_glink_send(struct glink_channel *channel, chunk_size, wait); /* Mark intent available if we failed */ - if (ret && intent) { - intent->in_use = false; + if (ret) { + if (intent) + intent->in_use = false; break; } } From patchwork Tue Apr 18 16:30:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Andersson X-Patchwork-Id: 84966 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp2994276vqo; Tue, 18 Apr 2023 09:53:50 -0700 (PDT) X-Google-Smtp-Source: AKy350ZNkZIw51PyuvhEg294/xFUB7YwsUIlf2nBgcrvyPDmIOwUxpTnXdwCJyZ5CHKAEJTBsG5A X-Received: by 2002:a05:6a21:6806:b0:d7:5f98:d2a3 with SMTP id wr6-20020a056a21680600b000d75f98d2a3mr248697pzb.54.1681836829912; Tue, 18 Apr 2023 09:53:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681836829; cv=none; d=google.com; s=arc-20160816; b=ApJJOiToPyqFMhsl4Dp2Fkt+TEKSJWjS/w3xzN0frQEGd0ZkiP+ISNq2Gfid2MSjlK gG4WPRaFXX9FOdm6/ScFQG2jThn+nG9lDG+ty7K2DqRQt09Y8RYhBouYCQoCvzbUknNo wGoeYHxUqKZi8GUZCpzOtKqcVZSinsESvm+GHxLTXOe4fsbPiX6CfCadF+vYCJt7b89Z 8b7VDlHabHmoKQu9JTwYWv92XPsAKqk3vVv25MqdA1pMx6M4jUjCsjIZK6w7/EfcAe6B H730xvyiP6gmPc3mli4qoF119Fgoi4dtQ32aQS/oZ1FvFThxCDTqu9miHLCHSP7WWn9T 60aw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=wZ0rGPFPTFGz8DAl++2R27HZq3ugJ227uzKZXB7lr2s=; b=FkJrVDl6pj0rjdy14AyTjNX6jz0TFRxPv/NiVTfj8T9XfvyYWvetmO/YPHkwS2C7Av OH9q3+gIJFKAvt6FKc85FvuW0CtCTh6QEynu1Jlr6lgN3JRIHG//Ei/XG2kRfvwhxyk5 k+MczJuMkZMNnT30nKqbMOiQpfR2yLkDjDRcT3A6KmUv/gnFykgejwZojq9ew5F5Reut N2/0ECP+dUdxhk6S1KM2Te+YwaBoeh0YHl97d8PVPb8QVkZxcVNaDOAeKq57sOR2MmKn FL36qLf6vKx/vXfs/PtnpGcMvzQm77RI7uRSFmVvOKer+oPL74hcRYGaBhpa/yZ7Vmsr Xf4w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=oAgEKkam; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w4-20020a656944000000b0051a24ba4d74si14088992pgq.837.2023.04.18.09.53.35; Tue, 18 Apr 2023 09:53:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=oAgEKkam; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232530AbjDRQaj (ORCPT + 99 others); Tue, 18 Apr 2023 12:30:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44444 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232509AbjDRQad (ORCPT ); Tue, 18 Apr 2023 12:30:33 -0400 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B51BDBB8A; Tue, 18 Apr 2023 09:30:30 -0700 (PDT) Received: from pps.filterd (m0279870.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 33IFWfCS000444; Tue, 18 Apr 2023 16:30:25 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=qcppdkim1; bh=wZ0rGPFPTFGz8DAl++2R27HZq3ugJ227uzKZXB7lr2s=; b=oAgEKkam8iIy0SBLTCCqi/g4cGCx/5Pd7zkOJS0lEdT1N8gLg8OWJKMtEM+y2oNjJcsg kJyIL1v1e/uwxYPT828KImPfJq/cfsNLU8VkA+LZDNXpHj6FWckQt5oVwaaDas/HaHGa v0Nwbc8O4to/lgPJNfyqAuQaDYU1p1i2829F8pi8VofQEoSuGgG9OT1B9/cYJPWS0HT8 SQMY4tRJeo8OyAf9mdHaeY0cZal0eR1OIV89J3fRVyWqwKxC3Y9Zo1oQyCIgRmnG8qk5 n8gN81qZ3ZKKYJmpAbxorxdeEAxqszJTC7UdShnLkN4nWMsiHgFKMtIkTokkmZZ3ueJm iA== Received: from nalasppmta04.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3q1wxk053d-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 18 Apr 2023 16:30:25 +0000 Received: from nalasex01c.na.qualcomm.com (nalasex01c.na.qualcomm.com [10.47.97.35]) by NALASPPMTA04.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 33IGUOSa029617 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 18 Apr 2023 16:30:24 GMT Received: from hu-bjorande-lv.qualcomm.com (10.49.16.6) by nalasex01c.na.qualcomm.com (10.47.97.35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.42; Tue, 18 Apr 2023 09:30:23 -0700 From: Bjorn Andersson To: Bjorn Andersson , Mathieu Poirier , Chris Lew CC: , , Subject: [PATCH v2 2/2] rpmsg: glink: Consolidate TX_DATA and TX_DATA_CONT Date: Tue, 18 Apr 2023 09:30:18 -0700 Message-ID: <20230418163018.785524-3-quic_bjorande@quicinc.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230418163018.785524-1-quic_bjorande@quicinc.com> References: <20230418163018.785524-1-quic_bjorande@quicinc.com> MIME-Version: 1.0 X-Originating-IP: [10.49.16.6] X-ClientProxiedBy: nalasex01a.na.qualcomm.com (10.47.209.196) To nalasex01c.na.qualcomm.com (10.47.97.35) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-GUID: o7YpuMgtmsAqu8SSaZrygnUkZGomf_7T X-Proofpoint-ORIG-GUID: o7YpuMgtmsAqu8SSaZrygnUkZGomf_7T X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-04-18_11,2023-04-18_01,2023-02-09_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 phishscore=0 adultscore=0 mlxlogscore=999 bulkscore=0 impostorscore=0 lowpriorityscore=0 spamscore=0 priorityscore=1501 clxscore=1015 suspectscore=0 mlxscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2303200000 definitions=main-2304180137 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1763533735644190489?= X-GMAIL-MSGID: =?utf-8?q?1763533735644190489?= Rather than duplicating most of the code for constructing the initial TX_DATA and subsequent TX_DATA_CONT packets, roll them into a single loop. Signed-off-by: Bjorn Andersson Reviewed-by: Chris Lew --- Changes since v1: - Reduced unnecessary complexity in the chunking condition drivers/rpmsg/qcom_glink_native.c | 46 +++++++++---------------------- 1 file changed, 13 insertions(+), 33 deletions(-) diff --git a/drivers/rpmsg/qcom_glink_native.c b/drivers/rpmsg/qcom_glink_native.c index 62634d020d13..7e6fad4e02f8 100644 --- a/drivers/rpmsg/qcom_glink_native.c +++ b/drivers/rpmsg/qcom_glink_native.c @@ -1309,7 +1309,7 @@ static int __qcom_glink_send(struct glink_channel *channel, int ret; unsigned long flags; int chunk_size = len; - int left_size = 0; + size_t offset = 0; if (!glink->intentless) { while (!intent) { @@ -1343,49 +1343,29 @@ static int __qcom_glink_send(struct glink_channel *channel, iid = intent->id; } - if (wait && chunk_size > SZ_8K) { - chunk_size = SZ_8K; - left_size = len - chunk_size; - } - req.msg.cmd = cpu_to_le16(GLINK_CMD_TX_DATA); - req.msg.param1 = cpu_to_le16(channel->lcid); - req.msg.param2 = cpu_to_le32(iid); - req.chunk_size = cpu_to_le32(chunk_size); - req.left_size = cpu_to_le32(left_size); - - ret = qcom_glink_tx(glink, &req, sizeof(req), data, chunk_size, wait); - - /* Mark intent available if we failed */ - if (ret) { - if (intent) - intent->in_use = false; - return ret; - } - - while (left_size > 0) { - data = (void *)((char *)data + chunk_size); - chunk_size = left_size; - if (chunk_size > SZ_8K) + while (offset < len) { + chunk_size = len - offset; + if (chunk_size > SZ_8K && wait) chunk_size = SZ_8K; - left_size -= chunk_size; - req.msg.cmd = cpu_to_le16(GLINK_CMD_TX_DATA_CONT); + req.msg.cmd = cpu_to_le16(offset == 0 ? GLINK_CMD_TX_DATA : GLINK_CMD_TX_DATA_CONT); req.msg.param1 = cpu_to_le16(channel->lcid); req.msg.param2 = cpu_to_le32(iid); req.chunk_size = cpu_to_le32(chunk_size); - req.left_size = cpu_to_le32(left_size); + req.left_size = cpu_to_le32(len - offset - chunk_size); - ret = qcom_glink_tx(glink, &req, sizeof(req), data, - chunk_size, wait); - - /* Mark intent available if we failed */ + ret = qcom_glink_tx(glink, &req, sizeof(req), data + offset, chunk_size, wait); if (ret) { + /* Mark intent available if we failed */ if (intent) intent->in_use = false; - break; + return ret; } + + offset += chunk_size; } - return ret; + + return 0; } static int qcom_glink_send(struct rpmsg_endpoint *ept, void *data, int len)