From patchwork Fri Feb 14 17:22:35 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Grant Erickson X-Patchwork-Id: 13975367 Received: from mail5.g24.pair.com (mail5.g24.pair.com [66.39.139.36]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 22C8D2690C2 for ; Fri, 14 Feb 2025 17:22:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=66.39.139.36 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739553766; cv=none; b=hd6kXAXLJOrbJ3YQSzWPDGiTP5TF6lnwmr5qzQOQa4sooqlDqkkMjorpXc3iM9mTCeyYEGMUSi1w+IfFqrVFA9C+C7m3wMON2vI2cYXwV6fr8XgYO9jzxKOqnivzwfd0fBNp92FkGGo151epG0gxr31AcH/vYisA/9pKtBryYJo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739553766; c=relaxed/simple; bh=Zv4RA/sY6txtwuaBhWqF/sIrPbIIQMK3UhHs9h1Vs0M=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=GgienNw4VjHAvM2ZqJGbuE0sMRMA0TiRf7dErl1JK+BKlEX34ee/LGCHuUUk9EYAWX8Djmjfr9T/Ylg1OTB9PLTpNLOgy+iRtEa3UEe6s/IiWBJqLNtkPA/nXAhAJeYsUe6GU+BciPVKY0HZa4PtTYtHlJ/A1W4CmAfUIN2Qhxc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=nuovations.com; spf=pass smtp.mailfrom=nuovations.com; dkim=pass (2048-bit key) header.d=nuovations.com header.i=@nuovations.com header.b=duWZndmF; arc=none smtp.client-ip=66.39.139.36 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=nuovations.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nuovations.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=nuovations.com header.i=@nuovations.com header.b="duWZndmF" Received: from mail5.g24.pair.com (localhost [127.0.0.1]) by mail5.g24.pair.com (Postfix) with ESMTP id 40889164A83 for ; Fri, 14 Feb 2025 12:22:43 -0500 (EST) Received: from localhost.localdomain (c-24-6-12-99.hsd1.ca.comcast.net [24.6.12.99]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mail5.g24.pair.com (Postfix) with ESMTPSA id E63BF124F0D for ; Fri, 14 Feb 2025 12:22:42 -0500 (EST) From: Grant Erickson To: ofono@lists.linux.dev Subject: [PATCH v4 1/7] qmi: Added enumeration for device quirk flags. Date: Fri, 14 Feb 2025 09:22:35 -0800 Message-ID: <59c8f32bc48808da9223a192cfa180a04c711402.1739553712.git.gerickson@nuovations.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: ofono@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nuovations.com; h=from:to:subject:date:message-id:in-reply-to:references:mime-version:content-transfer-encoding; s=pair-202401062137; bh=5RkJRnoVHnJwZCzxHGA2QOPk/DensYYgENGrNo82m/E=; b=duWZndmFsvqfFTJW/5enaW2C74hsdDDUFbQNMBsBT/B6E+tlXONkwo4G+GUkDU8jc2FsRuPs9mkbivgVxI1bQfKZCZ4taxq+adiQz3KnHz4SFP6zUltbE+b9WkjQUjQYY1lEV3YE15mtLQZacsF4dwVwQuJY9P7Bgi8Y9AKJhx45yXrla++Oi/zF5rjOt8cmdAm42KUoa7nfzmu5b+Gnbrpbmsd/QlFVoJMSYodHLDjXTWweiNpM1jBPGWIfcE8WDp17xP01sAD3tFTt7R4jP5ORxchDuLLbdIjKswEWfo30HhHAieXVMXvvFvB13/WkPSILXrRW8tNPjjmn5HJddw== X-Scanned-By: mailmunge 3.10 on 66.39.139.36 Defines device-specific "quirks" that may alter the default behavior of the QMI driver for a specific, instantiated device. --- drivers/qmimodem/qmi.h | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/drivers/qmimodem/qmi.h b/drivers/qmimodem/qmi.h index 69698ee049c6..e74ff3feaeec 100644 --- a/drivers/qmimodem/qmi.h +++ b/drivers/qmimodem/qmi.h @@ -56,6 +56,24 @@ enum qmi_error { QMI_ERROR_INVALID_QMI_COMMAND = 71, }; +/** + * This defines device-specific "quirks" that may alter the default + * behavior of the QMI driver for a specific, instantiated device. + */ +enum qmi_qmux_device_quirk { + /** + * The device has no "quirks". + */ + QMI_QMUX_DEVICE_QUIRK_NONE = 0x00, + + /** + * The device has a "quirk" where it can lock up and hang (not + * responding to subsequent commands) due to high QMI service + * request arrival rates. + */ + QMI_QMUX_DEVICE_QUIRK_REQ_RATE_LIMIT = 0x01 +}; + typedef void (*qmi_destroy_func_t)(void *user_data); struct qmi_service; From patchwork Fri Feb 14 17:22:36 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Grant Erickson X-Patchwork-Id: 13975368 Received: from mail5.g24.pair.com (mail5.g24.pair.com [66.39.139.36]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AB32B2686B3 for ; Fri, 14 Feb 2025 17:22:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=66.39.139.36 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739553766; cv=none; b=sgrf4JMl12RCd/oIdKet4oU4yqhSLLOsBGux+6znM+P3/sqIro4XY6zybr14XZ3BEUATANe+Krm7iMhv/AoAarsHz5xKOBibPKbBLfzt7wWHQhTYUdnefS5fYY6kLtf20g24awt5naTTA43KfSOr/8JexUavQBFS5AI1UDz3jcA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739553766; c=relaxed/simple; bh=M5Yt+XgkEhwDsBif7PeTj7L8IDaWFyPdeokkm14HJmE=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=TR6mBW3Sh1hB3mkF0gmoI/aTG4zT1xR2JxuzJuLrEANkdPLAqAeqpvpajh9yqVfbNJTYgU0VNt8mJjBRMrCynCm7RzQsBhheOZjQiwoyrKjjtGaX352gScehlFANyYoRl5L+V9Jsz+16MfJ2J3VDpb0xAKu14uBo4RrLzHecgGY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=nuovations.com; spf=pass smtp.mailfrom=nuovations.com; dkim=pass (2048-bit key) header.d=nuovations.com header.i=@nuovations.com header.b=QUl2ZlO1; arc=none smtp.client-ip=66.39.139.36 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=nuovations.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nuovations.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=nuovations.com header.i=@nuovations.com header.b="QUl2ZlO1" Received: from mail5.g24.pair.com (localhost [127.0.0.1]) by mail5.g24.pair.com (Postfix) with ESMTP id AFA4A164A8B for ; Fri, 14 Feb 2025 12:22:43 -0500 (EST) Received: from localhost.localdomain (c-24-6-12-99.hsd1.ca.comcast.net [24.6.12.99]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mail5.g24.pair.com (Postfix) with ESMTPSA id 653A0124F0D for ; Fri, 14 Feb 2025 12:22:43 -0500 (EST) From: Grant Erickson To: ofono@lists.linux.dev Subject: [PATCH v4 2/7] qmi: Added structure for device options. Date: Fri, 14 Feb 2025 09:22:36 -0800 Message-ID: <520a4879b3157a715299d4874c4091a170d84638.1739553712.git.gerickson@nuovations.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: ofono@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nuovations.com; h=from:to:subject:date:message-id:in-reply-to:references:mime-version:content-transfer-encoding; s=pair-202401062137; bh=fHma6eg08g0rSRzjb2Szp8dq8ebKa/ez0Aq5JPdNAGU=; b=QUl2ZlO1ewhzEYoN6jGgTGemsMkAmHdJ+KS6xZFQd5brgvSSGGPX0gHT+978FG0t3UAi+E9+UcsRphmn/mwzhZF4spr1baJ+XVVjUCQcUNoSczC1is4pp5tN/hyAu0My/nhpJBfnjRyDfN2kD1LvwWOtV7fWbXCMCfy4NCwvGOkuqRDgPvaaVq3IBS/2AA/cATgvG0nypgAhdPrMvcOIekTG04CPs+9i9unlzEnRIGXz+Q8X2oSmHqwVyU9dgz09/KHdIAnPqzZtjr1OkpscfkWs2kcpj0h5bLlGp2nMmxY3By4xC9EYob6UelhOEM/yx4HV5Z3CDLjaGqkP8lxanQ== X-Scanned-By: mailmunge 3.10 on 66.39.139.36 Defines options that may alter the default behavior of the QMI driver for a specific, instantiated device. --- drivers/qmimodem/qmi.h | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/drivers/qmimodem/qmi.h b/drivers/qmimodem/qmi.h index e74ff3feaeec..4ba27847176f 100644 --- a/drivers/qmimodem/qmi.h +++ b/drivers/qmimodem/qmi.h @@ -74,6 +74,25 @@ enum qmi_qmux_device_quirk { QMI_QMUX_DEVICE_QUIRK_REQ_RATE_LIMIT = 0x01 }; +/** + * Defines options that may alter the default behavior of the QMI + * driver for a specific, instantiated device. + */ +struct qmi_qmux_device_options { + /** + * Device-specific "quirk". + */ + enum qmi_qmux_device_quirk quirks; + + /** + * If quirks has #QMI_QMUX_DEVICE_QUIRK_REQ_RATE_LIMIT set, this + * is the minimum period, in microseconds, in which back-to-back + * QMI service requests may be sent to avoid triggering a + * firmware lock up and hang. + */ + unsigned int min_req_period_us; +}; + typedef void (*qmi_destroy_func_t)(void *user_data); struct qmi_service; From patchwork Fri Feb 14 17:22:37 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Grant Erickson X-Patchwork-Id: 13975369 Received: from mail5.g24.pair.com (mail5.g24.pair.com [66.39.139.36]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2D7F62690CA for ; Fri, 14 Feb 2025 17:22:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=66.39.139.36 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739553767; cv=none; b=bGZZQnVB2yK/Yxi6ZT4WMXlsIv4Zg6vWEcM+OFxJNXqBk7UCcNNAxl/OZ+/0lvY6YYhjTO4iew6iBoWDVnYmsqysO82hWFFCeb2iDKvW4bV9vqPlJORc1oSijjIAUKwkJYuGzK/G3NKgKADm7ThNyH7QpWsgsuFwG1AG7NXuLUM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739553767; c=relaxed/simple; bh=BOjh6BbY3gmEz2aVzixjVsKqCAX013D8zE0gTMLRqds=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=DgNyyAnSIosdADQF7k+Z89P/9btKpY7CYpMiY9zjNq3AeUEkX18DC8xnZZsv91u/rqTeVrNdY7/eGM30d2/KuPawc4iWquQNII2kWw/MijwP4hTUV2WrXHFwU9j2+/udyoWh5NQLLnsNCSwcI2Czj0NZffhG8GdVVUOsiQqPxpM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=nuovations.com; spf=pass smtp.mailfrom=nuovations.com; dkim=pass (2048-bit key) header.d=nuovations.com header.i=@nuovations.com header.b=DKR/btta; arc=none smtp.client-ip=66.39.139.36 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=nuovations.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nuovations.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=nuovations.com header.i=@nuovations.com header.b="DKR/btta" Received: from mail5.g24.pair.com (localhost [127.0.0.1]) by mail5.g24.pair.com (Postfix) with ESMTP id 27DAA164A8D for ; Fri, 14 Feb 2025 12:22:44 -0500 (EST) Received: from localhost.localdomain (c-24-6-12-99.hsd1.ca.comcast.net [24.6.12.99]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mail5.g24.pair.com (Postfix) with ESMTPSA id D3504124F0D for ; Fri, 14 Feb 2025 12:22:43 -0500 (EST) From: Grant Erickson To: ofono@lists.linux.dev Subject: [PATCH v4 3/7] qmi: Added device options parameter to 'qmi_qmux_device_new'. Date: Fri, 14 Feb 2025 09:22:37 -0800 Message-ID: <0e9adb66276124d2bebf2f54c6138959dc8068fa.1739553712.git.gerickson@nuovations.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: ofono@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nuovations.com; h=from:to:subject:date:message-id:in-reply-to:references:mime-version:content-transfer-encoding; s=pair-202401062137; bh=BzRC/MPEuWrn1WIK740cPG2Pr1K+5r5gWLIEtdkDGqY=; b=DKR/bttadtEYOdNOXssUNmzAuIvQNRXrwVarl83LpJfWMBcwpQ4zJmYI9VIIjzFviZzLHk8vxbNg/mf63y5bgq1RbjqDtk31bJvy/8Gsm87vQJNhj5S26LKl0mg4DDuqnX6gPHZsR7lH+w7CB4PC0jlewy+6CZCu22uX5drESeXnlRxx0w5iNZKt/lwbf238xbSdVHaCSMAneOcl18D5xK1aaRjHjDyX1ADHPYDYdtF7v2dj2n0lwfEupM+Bz8ZCNfGyI2IQt4Zno0AxpPO4iKMKTBA0h0xaOTVJwzf57TIziAH11+15bOPEc4FZyqEwz3eBUGmF3+khFqs+oW3y2g== X-Scanned-By: mailmunge 3.10 on 66.39.139.36 An optional pointer to immutable device options that may alter the default behavior of the QMI driver for the instantiated device. --- drivers/qmimodem/qmi.c | 3 ++- drivers/qmimodem/qmi.h | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/qmimodem/qmi.c b/drivers/qmimodem/qmi.c index 10dbdaac8bf6..bbe6440abe0f 100644 --- a/drivers/qmimodem/qmi.c +++ b/drivers/qmimodem/qmi.c @@ -1567,7 +1567,8 @@ static const struct qmi_transport_ops qmux_ops = { .write = qmi_qmux_device_write, }; -struct qmi_qmux_device *qmi_qmux_device_new(const char *device) +struct qmi_qmux_device *qmi_qmux_device_new(const char *device, + const struct qmi_qmux_device_options *options) { struct qmi_qmux_device *qmux; int fd; diff --git a/drivers/qmimodem/qmi.h b/drivers/qmimodem/qmi.h index 4ba27847176f..09b551d74823 100644 --- a/drivers/qmimodem/qmi.h +++ b/drivers/qmimodem/qmi.h @@ -107,7 +107,8 @@ typedef void (*qmi_qrtr_node_lookup_done_func_t)(void *); typedef void (*qmi_service_result_func_t)(struct qmi_result *, void *); -struct qmi_qmux_device *qmi_qmux_device_new(const char *device); +struct qmi_qmux_device *qmi_qmux_device_new(const char *device, + const struct qmi_qmux_device_options *options); void qmi_qmux_device_free(struct qmi_qmux_device *qmux); void qmi_qmux_device_set_debug(struct qmi_qmux_device *qmux, qmi_debug_func_t func, void *user_data); From patchwork Fri Feb 14 17:22:38 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Grant Erickson X-Patchwork-Id: 13975370 Received: from mail5.g24.pair.com (mail5.g24.pair.com [66.39.139.36]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B30CD2686A5 for ; Fri, 14 Feb 2025 17:22:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=66.39.139.36 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739553767; cv=none; b=hC2n3Q7cElLDxaeJd+xS2kIVAbKoicXu4ZBoBWiEybBdJRJeOBEE95AKuXRxb4sGWO7CaWhObxmg2XaDHkkg9zNGQ0qNKQaIswNP7mQl+PsAB+Ov+HEOr6Yipw2mDO3hk1kVOPuyXU4KYPodqPNTcnAImMLOV3Ar2nYo8mZegSE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739553767; c=relaxed/simple; bh=0bCcH2HXW6KvEsx6HAW6GXOmybWW6YKSc7TQAJqMID0=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=mskKgri6mbMZpPBDwRU4aB2WsEWj9LPAE0LLdoujWV3/VuxvMJu8SlqHXSEIqwVVagIb9NC9JO0U2QVAQDVYR1PnHSJBCKJK8YvayjdF1nx2y9pgqz7loScLvVFXujtVwGjYYh39WBxw9iQymBXMHAb26pN96DROrnLhzlDV2d0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=nuovations.com; spf=pass smtp.mailfrom=nuovations.com; dkim=pass (2048-bit key) header.d=nuovations.com header.i=@nuovations.com header.b=XGbdzF7H; arc=none smtp.client-ip=66.39.139.36 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=nuovations.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nuovations.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=nuovations.com header.i=@nuovations.com header.b="XGbdzF7H" Received: from mail5.g24.pair.com (localhost [127.0.0.1]) by mail5.g24.pair.com (Postfix) with ESMTP id 96777164A8F for ; Fri, 14 Feb 2025 12:22:44 -0500 (EST) Received: from localhost.localdomain (c-24-6-12-99.hsd1.ca.comcast.net [24.6.12.99]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mail5.g24.pair.com (Postfix) with ESMTPSA id 4BBED124F0D for ; Fri, 14 Feb 2025 12:22:44 -0500 (EST) From: Grant Erickson To: ofono@lists.linux.dev Subject: [PATCH v4 4/7] qmi: Implement QMI service request rate limiting in 'can_write_data'. Date: Fri, 14 Feb 2025 09:22:38 -0800 Message-ID: <35556cf3af8ce161ab6e178bdf4615ee94407bc6.1739553712.git.gerickson@nuovations.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: ofono@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nuovations.com; h=from:to:subject:date:message-id:in-reply-to:references:mime-version:content-transfer-encoding; s=pair-202401062137; bh=lFYvsI57/a7zeWOBW/LqDkoahzsvZXnr3vFbMIr6TJU=; b=XGbdzF7HuNXeMa/6Y1xY069obZOOP4VbHDGdlm6znoWPN5hK/Mu1NL6VpAFg3sYNe6M+zj5ZR+k60C5rGC7YaaZQvJMbxraFwQYtOwXoNX0Xkq9zb6+rmkRGFYFItY8KhMwIbY2B104KOrdxR1leCMtmw0jy8JDjEIenYnUraUBoxfF2Fw6wItkBb/HOAnwkldrRhixnkmjsWv/DpHPw0K1TUyN7qFdistqfIMAvAcSkGcXMx/DZirr6ZOrNoM99UF9PE0BTjmu8yMJcytb5C4g4qgTh1a3XKgfonlZCYtBSn6AVBtAHFO4/1b3cDOdtCoY4PgaLb1aZ7ycF5DMOPw== X-Scanned-By: mailmunge 3.10 on 66.39.139.36 Determine if we need to rate-limit QMI services requests to a transport-specific minimum request period. If so, return true so that the queue can be retried again later. Adds the following data members to 'qmi_transport': * Minimum request period - The minimum period, in microseconds, for back-to-back QMI service requests. * Last request time - Time, in microseconds, when the last QMI service request was sent. to support the implementation. --- drivers/qmimodem/qmi.c | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/drivers/qmimodem/qmi.c b/drivers/qmimodem/qmi.c index bbe6440abe0f..7b20dc3f85dd 100644 --- a/drivers/qmimodem/qmi.c +++ b/drivers/qmimodem/qmi.c @@ -92,6 +92,18 @@ struct qmi_transport { const struct qmi_transport_ops *ops; struct debug_data debug; bool writer_active : 1; + + /** + * If specified via qmi_qmux_device_options, the minimum period + * for back-to-back QMI service requests. + */ + unsigned int min_req_period_us; + + /** + * The time, in microseconds, when the last QMI service request + * was sent. + */ + uint64_t last_req_sent_time_us; }; struct qmi_qmux_device { @@ -653,8 +665,28 @@ static bool can_write_data(struct l_io *io, void *user_data) { struct qmi_transport *transport = user_data; struct qmi_request *req; + const bool throttle_enabled = transport->min_req_period_us > 0; + uint64_t now; int r; + /* + * Determine if we need to rate-limit commands to a + * transport-specific minimum request period. If so, + * return true so that the queue can be retried again + * later. + */ + if (throttle_enabled) { + now = l_time_now(); + + if (transport->last_req_sent_time_us != 0) { + const uint64_t delta = l_time_diff(now, + transport->last_req_sent_time_us); + + if (delta < transport->min_req_period_us) + return true; + } + } + req = l_queue_pop_head(transport->req_queue); if (!req) return false; @@ -665,6 +697,9 @@ static bool can_write_data(struct l_io *io, void *user_data) return false; } + if (throttle_enabled) + transport->last_req_sent_time_us = now; + if (l_queue_length(transport->req_queue) > 0) return true; From patchwork Fri Feb 14 17:22:39 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Grant Erickson X-Patchwork-Id: 13975373 Received: from mail5.g24.pair.com (mail5.g24.pair.com [66.39.139.36]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1D8DF2686B3 for ; Fri, 14 Feb 2025 17:22:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=66.39.139.36 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739553770; cv=none; b=fMa62uMgas2cmiSk9sFwv+qpe+rVRsQjxKPlQlCtN1YHcSses5x55vYBnlgeUalZsohEtc6orj88552ITZo+rgdpkr6HHDkDWhB39f4mbR0aogrYqIat1pRGjjEkS+Cop9r1Y3dyp/94nFtJ4jm0Y+vhLWZsMg0xKBGW3eiXvuI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739553770; c=relaxed/simple; bh=6ZOCUwTNZTyfyFNvdruZ4bNsiD0meoa93gVPTJuiIy4=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=iCuGcQltCxGmoHcrkAyAVs3broogyGfhI07jSfK/zpSjM6hSNyVYooapEXTkM6svfCuMJ08j1/Q+MoQHnt5autClVSnnfIs8C0/1oz5RTQHeJ9YCVMwfI0NJNJgjGB9Mfy84wQjaU3yxUYwX/H6pmKhOZKXRLzNEc4tiKd8brPs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=nuovations.com; spf=pass smtp.mailfrom=nuovations.com; dkim=pass (2048-bit key) header.d=nuovations.com header.i=@nuovations.com header.b=Uq4rHN3a; arc=none smtp.client-ip=66.39.139.36 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=nuovations.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nuovations.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=nuovations.com header.i=@nuovations.com header.b="Uq4rHN3a" Received: from mail5.g24.pair.com (localhost [127.0.0.1]) by mail5.g24.pair.com (Postfix) with ESMTP id 0E9A6164A90 for ; Fri, 14 Feb 2025 12:22:45 -0500 (EST) Received: from localhost.localdomain (c-24-6-12-99.hsd1.ca.comcast.net [24.6.12.99]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mail5.g24.pair.com (Postfix) with ESMTPSA id BAAC3124F0D for ; Fri, 14 Feb 2025 12:22:44 -0500 (EST) From: Grant Erickson To: ofono@lists.linux.dev Subject: [PATCH v4 5/7] qmi: Handle request rate limit option in 'qmi_qmux_device_new'. Date: Fri, 14 Feb 2025 09:22:39 -0800 Message-ID: <2e5a4d1a9a6bf9aa8651367f3e2da92bb86a5407.1739553712.git.gerickson@nuovations.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: ofono@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nuovations.com; h=from:to:subject:date:message-id:in-reply-to:references:mime-version:content-transfer-encoding; s=pair-202401062137; bh=EAKTIc2jXJq4PegzPeVRjAHo1DNrrRyLjOE3VGG1yQQ=; b=Uq4rHN3amFcbIMoXlSyqBdY8R103SsYHi3NNdUm3N8MXrq7CK01Bv0hfrhASzwATnAkp72XoumWh/ySI3ZQqlBse7Sar45FR3jWrEFExpdpIiDtJmCV4OJop90RP8eg1tJsozBX1CaRCNJyM1DqJHp0fJMH9WOdQ/nfnwRaHE1vPsXLO2NAx1PQflWOV918jYrEW20nQFJ+BtiXMu/1BkmSG0BBPlFpzqB2JvPhmuIfUEgf3XWXpsgY8JI0VYtacYun7Hfei5tDfHTc5ZqXnCRgqcmQFpn2ryOjVOe3/I9432NR050EQ1MnyJ3SNk2zY93AaByhYI7CuNWcEYwkRkg== X-Scanned-By: mailmunge 3.10 on 66.39.139.36 If options are specified and QMI_QMUX_DEVICE_QUIRK_REQ_RATE_LIMIT is asserted, set the qmux transport minimum service request period from the specified options. --- drivers/qmimodem/qmi.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/drivers/qmimodem/qmi.c b/drivers/qmimodem/qmi.c index 7b20dc3f85dd..b50076b08a0c 100644 --- a/drivers/qmimodem/qmi.c +++ b/drivers/qmimodem/qmi.c @@ -1614,6 +1614,16 @@ struct qmi_qmux_device *qmi_qmux_device_new(const char *device, qmux = l_new(struct qmi_qmux_device, 1); + if (options != NULL) { + if ((options->quirks & QMI_QMUX_DEVICE_QUIRK_REQ_RATE_LIMIT) + == QMI_QMUX_DEVICE_QUIRK_REQ_RATE_LIMIT) { + qmux->transport.min_req_period_us = options->min_req_period_us; + + ofono_info("QMI minimum service request period %u us", + qmux->transport.min_req_period_us); + } + } + if (qmi_transport_open(&qmux->transport, fd, &qmux_ops) < 0) { close(fd); l_free(qmux); From patchwork Fri Feb 14 17:22:40 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Grant Erickson X-Patchwork-Id: 13975372 Received: from mail5.g24.pair.com (mail5.g24.pair.com [66.39.139.36]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1D9472690C2 for ; Fri, 14 Feb 2025 17:22:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=66.39.139.36 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739553768; cv=none; b=H4cHqDvC3jNTfsKUCoGkGDrqi5czZQrKVQIwtYEvhMjHevnrAvWWa1uYxh/Ya/FcTrGbnE3hTLXrPao8kLKXeU3Vn16+5Izw711nKWmFnKAeNks1mmoYEPP5AWxYC01GrFTtinWKBFJCokDKoY/0sjuwyOt7MzVydmu5GrdEGls= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739553768; c=relaxed/simple; bh=4r8w3BB1akA9ViycLhH6r9nNTeF+K4NnxLI7QZhqfeU=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=UFXxTejTDvA/hJUo+aTlvEWDr3VuDG8nLiqmeq/KNMSUdvxU3TSJa41E3hK64kG5u8m8sEZlq2+brYcJDunWcQCEnZF+D+YEmHP8jJYHLI2UiT5kSbMHoenyYI1gKDI+c+dJiOiNtzy1AXCOO962XAEOWX3gl4XPnmNekUOTsSI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=nuovations.com; spf=pass smtp.mailfrom=nuovations.com; dkim=pass (2048-bit key) header.d=nuovations.com header.i=@nuovations.com header.b=AMIA/W/U; arc=none smtp.client-ip=66.39.139.36 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=nuovations.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nuovations.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=nuovations.com header.i=@nuovations.com header.b="AMIA/W/U" Received: from mail5.g24.pair.com (localhost [127.0.0.1]) by mail5.g24.pair.com (Postfix) with ESMTP id 7CB80164A91 for ; Fri, 14 Feb 2025 12:22:45 -0500 (EST) Received: from localhost.localdomain (c-24-6-12-99.hsd1.ca.comcast.net [24.6.12.99]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mail5.g24.pair.com (Postfix) with ESMTPSA id 33426124F0D for ; Fri, 14 Feb 2025 12:22:45 -0500 (EST) From: Grant Erickson To: ofono@lists.linux.dev Subject: [PATCH v4 6/7] udevng: Set the QMI minimum service request period for Quectel BG96 modems. Date: Fri, 14 Feb 2025 09:22:40 -0800 Message-ID: <6a4c7884769af30a032cca23388c0a044833d836.1739553712.git.gerickson@nuovations.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: ofono@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nuovations.com; h=from:to:subject:date:message-id:in-reply-to:references:mime-version:content-transfer-encoding; s=pair-202401062137; bh=HY5EY2ISZixz3Mr7Wq0vZ6BjK6Xua0OSEwuqX7gyeJ8=; b=AMIA/W/UmVxc87yWOxAbvOYpaAnPPloKnJB31hrnoHOCvwtCRf/bCULrSbwfA/sBbZyw2VwSZZzpGG6NG6g+IJj3ihuxE5aYpR+38u1iDeVBmQwgGEBbifQ9eG/cyjS5t7ev3HpQtyU2tIyq7DRHnSZyI6NIFPRNR0QRlhRNGAr0s3gC6O2J9LfC3fUnxgq0gunDL4NDMLcTTy4LpUURNtiwmVTbQm7UCTskgm/DdAF9MBxMRFysmwnr/rj1ph1eq6ETnGHO6Lki+ta7xXZg6eN8ltvcBwS8LatwQ+NyON7lapK3Xj7ZsXcdgcjqYV5YWogQER/JiS6vznkZMdIVkQ== X-Scanned-By: mailmunge 3.10 on 66.39.139.36 The Quectel Wireless Solutions Co., Ltd. (2c7c) BG96 CAT-M1/NB-IoT modem (0296) has a firmware issue where it can lock up and hang (not responding to subsequent commands) due to high QMI service request arrival rates. If the vendor and model match those, then rate limit QMI service requests to no more than one every 2,000 us. --- plugins/udevng.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/plugins/udevng.c b/plugins/udevng.c index 64875a47752b..b8df66de5c71 100644 --- a/plugins/udevng.c +++ b/plugins/udevng.c @@ -1118,6 +1118,20 @@ static gboolean setup_quectelqmi(struct modem_info *modem) DBG("%s", modem->syspath); + /* + * The Quectel Wireless Solutions Co., Ltd. (2c7c) BG96 + * CAT-M1/NB-IoT modem (0296) has a firmware issue where it can + * lock up and hang (not responding to subsequent commands) due to + * high QMI service request arrival rates. If the vendor and model + * match those, then rate limit QMI service requests to no more + * than one every 2,000 us. + */ + if (l_streq0(modem->vendor, "2c7c")) { + if (l_streq0(modem->model, "0296")) + ofono_modem_set_integer(modem->modem, + "RequestThrottleTimeUs", 2000); + } + for (list = modem->devices; list; list = g_slist_next(list)) { const struct device_info *info = list->data; const char *subsystem = From patchwork Fri Feb 14 17:22:41 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Grant Erickson X-Patchwork-Id: 13975371 Received: from mail5.g24.pair.com (mail5.g24.pair.com [66.39.139.36]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DA0D0268FDE for ; Fri, 14 Feb 2025 17:22:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=66.39.139.36 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739553768; cv=none; b=eIsQReIJv6xysFDlwozveF1teds6nlmy63s0VMiMGQkvWGo3jUITArbpmEjVcdlcWnS+X7FXWGk+HHz1wt3sJTKS4c3zO+/0e1ykqZSOn9UsSHzjX+91zNmT9o/4OEFHXdRUHhMAGz4n36l763zxsZqASLlOS9YfrGVPAffbWMc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739553768; c=relaxed/simple; bh=/zRBuxHb1YZadUGBY2Vcl0+bBcgHqG51e5rh5Q3mXrI=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=JxpSoCgUimtO9rvtE2Oul6LMBm1Twog9CQn2Ilc/kQKt5KgKwhPgB9bCjuqFheW7EMIarT3sSw5D4rgRByzkynUdC3CHVuwRiiPhUH4rpCEMkgRdYy8tCmXfZ+Mluk4mXCQ9cJ7gLVHgWc4ir20MPStQp246oBJuUvT6UUbTkOw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=nuovations.com; spf=pass smtp.mailfrom=nuovations.com; dkim=pass (2048-bit key) header.d=nuovations.com header.i=@nuovations.com header.b=PRq3hej+; arc=none smtp.client-ip=66.39.139.36 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=nuovations.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nuovations.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=nuovations.com header.i=@nuovations.com header.b="PRq3hej+" Received: from mail5.g24.pair.com (localhost [127.0.0.1]) by mail5.g24.pair.com (Postfix) with ESMTP id E85FF164A92 for ; Fri, 14 Feb 2025 12:22:45 -0500 (EST) Received: from localhost.localdomain (c-24-6-12-99.hsd1.ca.comcast.net [24.6.12.99]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mail5.g24.pair.com (Postfix) with ESMTPSA id A055E124F0D for ; Fri, 14 Feb 2025 12:22:45 -0500 (EST) From: Grant Erickson To: ofono@lists.linux.dev Subject: [PATCH v4 7/7] gobi: Pass QMI qmux device options to 'qmi_qmux_device_new'. Date: Fri, 14 Feb 2025 09:22:41 -0800 Message-ID: X-Mailer: git-send-email 2.45.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: ofono@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nuovations.com; h=from:to:subject:date:message-id:in-reply-to:references:mime-version:content-transfer-encoding; s=pair-202401062137; bh=Vxp+G+wWuhPQL8Dt96ps2vexl5kKWAzJ+wzPwtwjdmc=; b=PRq3hej+1tVeHKxcO9ONfBEa1DN4caHLfV9QTLD6ZEmwwni8XC8MsNqCdA7mgeLXgTAMtDpoLORtsorJE3jBSWf7PgWsy8Fbq5XY48keYmKaNal7m4JXbhkblAWVD89/dw1HVKFcSUyfhCnhozd6Pkgy0uPofyRxjKy87MVWKFwaWD6A27iG/JFF0LWUOwprmPSTikk+u1tH9GJaDWDKyzVyxHAWQJAry8lGqe7MTJo/6utFmHkjwPYh3vSrVdmzs43U9IXbumWkgS3hqCwElOZsNaNb1YDN9cX/1TuFjY/4qE5HswPIM18hJfAMCuubKqglj1itLzvxxgaGIH+JnA== X-Scanned-By: mailmunge 3.10 on 66.39.139.36 If the QMI minimum service request period property is set on the modem object, then set the appropriate QMI QMUX device option quirk and value. --- plugins/gobi.c | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/plugins/gobi.c b/plugins/gobi.c index 027aa91d6ade..dfc7402e36aa 100644 --- a/plugins/gobi.c +++ b/plugins/gobi.c @@ -842,9 +842,19 @@ error: __shutdown_device(modem); } +/* + * Enable the modem. The following modem properties are optionally set: + * + * RequestThrottleTimeUs + * The minimum period, in microseconds, in which back-to-back * + * modem service requests may be sent. + * + */ static int gobi_enable(struct ofono_modem *modem) { struct gobi_data *data = ofono_modem_get_data(modem); + struct qmi_qmux_device_options options = { QMI_QMUX_DEVICE_QUIRK_NONE, 0 }; + int min_req_period_us; const char *device; DBG("%p", modem); @@ -853,7 +863,17 @@ static int gobi_enable(struct ofono_modem *modem) if (!device) return -EINVAL; - data->device = qmi_qmux_device_new(device); + /* + * If the QMI minimum service request period property is set, then + * set the appropriate QMI QMUX device quirk and value. + */ + min_req_period_us = ofono_modem_get_integer(modem, "RequestThrottleTimeUs"); + if (min_req_period_us > 0) { + options.quirks |= QMI_QMUX_DEVICE_QUIRK_REQ_RATE_LIMIT; + options.min_req_period_us = min_req_period_us; + } + + data->device = qmi_qmux_device_new(device, &options); if (!data->device) return -EIO;