net: qmsgq: Retry to send when ERESTARTSYS returned

ERESTARTSYS will be returned if a signal is queued for the
process while it is waiting, it means the related system call
was interrupted and needs to be restarted.

For the msgq data sending, this case(ERESTARTSYS) should be
handled by qmsgq transport layer due the packet will be
fragmented if its size is larger than the maximum transfer
size (MTU).

Change-Id: If9bdf0a73bce04cd9c963122011e8621ed675bf3
Signed-off-by: Tao Zhang <quic_taozhan@quicinc.com>
This commit is contained in:
Tao Zhang 2023-06-20 14:02:48 +08:00 committed by Gerrit - the friendly Code Review server
parent c9e89eb9c1
commit 7993a368b8

View File

@ -234,9 +234,13 @@ static int qmsgq_gh_send(struct qmsgq_gh_device *qdev, void *buf, size_t len)
chunk = (left > GH_MSGQ_MAX_MSG_SIZE_BYTES) ? GH_MSGQ_MAX_MSG_SIZE_BYTES : left; chunk = (left > GH_MSGQ_MAX_MSG_SIZE_BYTES) ? GH_MSGQ_MAX_MSG_SIZE_BYTES : left;
rc = gh_msgq_send(qdev->msgq_hdl, buf + offset, chunk, GH_MSGQ_TX_PUSH); rc = gh_msgq_send(qdev->msgq_hdl, buf + offset, chunk, GH_MSGQ_TX_PUSH);
if (rc) { if (rc) {
pr_err("%s: gh_msgq_send failed: %d\n", __func__, rc); if (rc == -ERESTARTSYS) {
mutex_unlock(&qdev->tx_lock); continue;
goto err; } else {
pr_err("%s: gh_msgq_send failed: %d\n", __func__, rc);
mutex_unlock(&qdev->tx_lock);
goto err;
}
} }
left -= chunk; left -= chunk;
offset += chunk; offset += chunk;