From patchwork Tue Dec 5 10:12:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jean Thomas X-Patchwork-Id: 1872035 X-Patchwork-Delegate: daniel@makrotopia.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=WxL4I8l4; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.openwrt.org (client-ip=2607:7c80:54:3::133; helo=bombadil.infradead.org; envelope-from=openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org; receiver=patchwork.ozlabs.org) Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4SkxJY1Xxmz1ySd for ; Tue, 5 Dec 2023 21:16:10 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=x7wVva1usf0xeg/jVrZBZYvoW6kRb6SpS5Y5PHvGGVg=; b=WxL4I8l42a+U04 u/y26R05FeLldMqgSCaeXyKpUutmA5Ri1eLjDONZeYCx1gAgTINiW+klCbpl0UoFfvqG5Kv2Eh/J+ RuBgnK9a7yo9DPfX2k5bjYc1lhSukD7c457itcGmMW8zV9T6A1Fjtq47Pz5E1DR0e/0slArtikC6P RNLBf+Nj8VGjCjG3XcxjTE4FEIJrQLGpGY+6JGlcD0E7lWqrvN6XFeV09CISJJb2+6bM2YQiabbfR vK0BEFQIbVPw2rADUkre7FoSWiQEhhVyNXY2Njy2VMBuT/p/NQLYw5zqLBlxSCi+zhb59MD9/sisW 063fuyx2g7xOYPRM11oA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1rASQO-006vtF-2y; Tue, 05 Dec 2023 10:13:08 +0000 Received: from smtp6-g21.free.fr ([2a01:e0c:1:1599::15]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1rASQM-006vso-1K for openwrt-devel@lists.openwrt.org; Tue, 05 Dec 2023 10:13:07 +0000 Received: from localhost.localdomain (unknown [IPv6:2a01:e0a:aa1:d2f0:f6b3:db6:44c:eeef]) (Authenticated sender: isaias57@free.fr) by smtp6-g21.free.fr (Postfix) with ESMTPSA id 129FB78035E; Tue, 5 Dec 2023 11:13:03 +0100 (CET) From: Jean Thomas To: openwrt-devel@lists.openwrt.org Cc: Jean Thomas Subject: [PATCH 2/2] uqmi: cancel all requests on SYNC indication reception Date: Tue, 5 Dec 2023 11:12:38 +0100 Message-Id: <20231205101238.1770995-2-jean.thomas@wifirst.fr> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231205101238.1770995-1-jean.thomas@wifirst.fr> References: <20231205101238.1770995-1-jean.thomas@wifirst.fr> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231205_021306_594761_976C7647 X-CRM114-Status: GOOD ( 11.16 ) X-Spam-Score: 0.7 (/) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: A SYNC indication might be sent by the modem on boot as a first response, in order to indicate that all Client IDs have been deallocated. Upon reception of this indication, cancel all current requests [...] Content analysis details: (0.7 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2a01:e0c:1:1599:0:0:0:15 listed in] [list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.7 SPF_NEUTRAL SPF: sender does not match SPF record (neutral) X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: OpenWrt Development List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "openwrt-devel" Errors-To: openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org A SYNC indication might be sent by the modem on boot as a first response, in order to indicate that all Client IDs have been deallocated. Upon reception of this indication, cancel all current requests, as they will never be answered. Signed-off-by: Jean Thomas --- dev.c | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/dev.c b/dev.c index 2d1597c..031b0c0 100644 --- a/dev.c +++ b/dev.c @@ -76,6 +76,20 @@ static bool qmi_message_is_response(struct qmi_msg *msg) return false; } +static bool qmi_message_is_indication(struct qmi_msg *msg) +{ + if (msg->qmux.service == QMI_SERVICE_CTL) { + if (msg->flags & QMI_CTL_FLAG_INDICATION) + return true; + } + else { + if (msg->flags & QMI_SERVICE_FLAG_INDICATION) + return true; + } + + return false; +} + static void __qmi_request_complete(struct qmi_dev *qmi, struct qmi_request *req, struct qmi_msg *msg) { void *tlv_buf; @@ -110,6 +124,24 @@ static void qmi_process_msg(struct qmi_dev *qmi, struct qmi_msg *msg) struct qmi_request *req; uint16_t tid; + if (qmi_message_is_indication(msg)) { + if (msg->qmux.service == QMI_SERVICE_CTL) { + struct qmi_msg sync_msg = {0}; + qmi_set_ctl_sync_request(&sync_msg); + /* A SYNC indication might be sent on boot in order to indicate + * that all Client IDs have been deallocated by the modem: + * cancel all requests, as they will not be answered. */ + if (msg->ctl.message == sync_msg.ctl.message) { + while (!list_empty(&qmi->req)) { + req = list_first_entry(&qmi->req, struct qmi_request, list); + qmi_request_cancel(qmi, req); + } + } + } + + return; + } + if (!qmi_message_is_response(msg)) return;