From patchwork Mon Feb 17 20:01:44 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Grant Erickson X-Patchwork-Id: 13978568 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 D5F90237702 for ; Mon, 17 Feb 2025 20:01:58 +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=1739822520; cv=none; b=qh+mF78InOy+0r+RPLhj/91xvQDLtAWWnH1i/SlF/QBK9aQ54TS33J9M1QMvWw7luXqTaDelCIVR6o3e5bSOqIvMUnzEBZ+El1CP5+Q3eWtElJfcXIpmJNedrNilNSCo2NeUw40DPul/u2Cj4H/t4YpELa5UbqSRG270iIVFqYQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739822520; c=relaxed/simple; bh=Zv4RA/sY6txtwuaBhWqF/sIrPbIIQMK3UhHs9h1Vs0M=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=FIESpYHHDOf7j2cKdZRpNmJhGALn2gZ/rjrq1iXC+zw8RvjAyySo0CItWMxaZU2ePpsESH0Ksy/v8X4FJ0eOtUHigsyjG9e7LF5ykvtCLIpV+GFCzfe727hDt/88GbNam2UHKywEA6G/g/BgRnVPX3FxJSekH6R4tnMvfRf/3Sg= 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=nmkOC0sf; 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="nmkOC0sf" Received: from mail5.g24.pair.com (localhost [127.0.0.1]) by mail5.g24.pair.com (Postfix) with ESMTP id 12A2A164A95 for ; Mon, 17 Feb 2025 15:01:52 -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 BC2461262BA for ; Mon, 17 Feb 2025 15:01:51 -0500 (EST) From: Grant Erickson To: ofono@lists.linux.dev Subject: [PATCH v5 1/7] qmi: Added enumeration for device quirk flags. Date: Mon, 17 Feb 2025 12:01:44 -0800 Message-ID: <59c8f32bc48808da9223a192cfa180a04c711402.1739822462.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=nmkOC0sfKAB8StEk5bRqksc9LDZpw5sj8SRRVvEJR8blULaHbRjpORQ/imMmeedHGoCLcmY0e9P4L7RmyfG26OI2LQ2mpf/GP46vTfEyd9LMNUeKYMak6r1terFgtJu5hiLdugC/6FFPGxqJ5YS/MlmMeNvAakR6m51QGtkWJgDt2x6I92TlU+QGRfd+OCYmU4G+RQk4jzNlejk6OMbRmsUSXIPfBY1SVwnWrVlHxnktnLk7d/y6QcFSXjCVJup36z29FLPx9vfYrSi9TBzcyUEW86WE8qfpn7zgZ6Y1ufVciTeX2RmerRHlxZ/z55gR6G3jOkoRuB9mSATWndGsGw== 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 Mon Feb 17 20:01:45 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Grant Erickson X-Patchwork-Id: 13978567 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 D5F1D237701 for ; Mon, 17 Feb 2025 20:01:58 +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=1739822520; cv=none; b=A6r6ryccZdBMl8xJq66iQxldsp93Rel4r6++iJkVswhx6uA0Pv+tgxEfHq9NwrMoZIQD8CBGqIw/GeV76savzK+mC7s1LlyQjOGr0pqX7m7wJtUQQTm9tjNkeMrk8r6XUhZJQZ8Md/jorb9H8DvJ9QXj23vZjCSkyQmP+MoZuk8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739822520; c=relaxed/simple; bh=M5Yt+XgkEhwDsBif7PeTj7L8IDaWFyPdeokkm14HJmE=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=BYwSPOWcneWbtS/Kgyle4OiLP9B17DZkBbQSN2+xl+Y2hk1Vjfkoef1kHuiMuoycgMwKAoKr6Hace4newEPkHgMDsD8Qp88sF3tM06XK4FGqlm3Q85qf0YUKrJfZnpJTp2js1gQefhuG6HI1egWsvWZHNo3hhIoiCFbo7/4FH4s= 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=Dgy0C3p4; 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="Dgy0C3p4" Received: from mail5.g24.pair.com (localhost [127.0.0.1]) by mail5.g24.pair.com (Postfix) with ESMTP id 815A6164A98 for ; Mon, 17 Feb 2025 15:01:52 -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 361E3124FC9 for ; Mon, 17 Feb 2025 15:01:52 -0500 (EST) From: Grant Erickson To: ofono@lists.linux.dev Subject: [PATCH v5 2/7] qmi: Added structure for device options. Date: Mon, 17 Feb 2025 12:01:45 -0800 Message-ID: <520a4879b3157a715299d4874c4091a170d84638.1739822462.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=Dgy0C3p4MEvT2uyp+wBvphlAS8XOD+zReO7IpCbCemLFXiPx/xqkBEq6ghWkqweugHksfFGX+VqogQWRj/uB8wcs5u2qX3Npo8BMqucGxSWskCdEzZTugEic3m5VqLAtlphkxrvChaO1nIFowLaofnF+46jRJkoXWPMde5SGGfi9s1xNJ0b6rQLh4pJQyMN1qdrFRZr0X/hM91uInUJzQ9YyJeqVmhU2g/JkA3mrlDEiVmRVmSF6NJ4ZAsCKb7cQfFyFGSZUcjGM6U9FDkcdOmoE4er+izRQzBmXseo8eYrUPxz/+aXKQqtmwLbIK/+YmR7rzt6GYtOchZK+9qCbAQ== 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 Mon Feb 17 20:01:46 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Grant Erickson X-Patchwork-Id: 13978569 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 BC297237713 for ; Mon, 17 Feb 2025 20:01:59 +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=1739822521; cv=none; b=amNFFCqy0rJdVX27tOoWbnZ9e5oSqPaWwdv36SDbSbw/qxcfwdnmgx9i0NFi8AjdhHYBwYLSX3aKxUjiNxeZkBVsMdo1OZ3aCqqUYXWbBfFAWHkFJo+n3R0f8je5jyoiODUTaHEAI92Gzq7Vsu2/D+U11PbWNGe9/lgY3Ifuwlo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739822521; c=relaxed/simple; bh=BOjh6BbY3gmEz2aVzixjVsKqCAX013D8zE0gTMLRqds=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=G6fAB0m5++KrPVNsnNFMx2XKuvjfRT/lPU6CMzUWJHeXVfSXtpSH/ZWfrdTA6reL5nc+8Ht5qcwtJaSpcY/FhhW6C5nzw5uyPqDlaTxrOcnXkgXPYS/RxGYQOXlzRfsvLoN7F95MPFVD/4kb4/GQdlBZtQsEtoePrpAcL7zYFyA= 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=dxD+Deye; 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="dxD+Deye" Received: from mail5.g24.pair.com (localhost [127.0.0.1]) by mail5.g24.pair.com (Postfix) with ESMTP id EE009164A99 for ; Mon, 17 Feb 2025 15:01:52 -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 A5215126369 for ; Mon, 17 Feb 2025 15:01:52 -0500 (EST) From: Grant Erickson To: ofono@lists.linux.dev Subject: [PATCH v5 3/7] qmi: Added device options parameter to 'qmi_qmux_device_new'. Date: Mon, 17 Feb 2025 12:01:46 -0800 Message-ID: <0e9adb66276124d2bebf2f54c6138959dc8068fa.1739822462.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=dxD+DeyeOlruvaAFW5g8kM/wmbzSQ0TJwgv0JOSM0ctqccaGgLtI8oR7kGmo0v5m5PwqmSaseRmZKjbeFEb9TI+D7e+lWlvHMewbyPt1tU3m9d8W3A4OHywPZLG6ib+HTPMN6mJ2U+kBIppf9otRjxNn/IsQ47LRsEYHRTh3uSD0SVENwujo1N92Xm57daL+zbdIXVjRu86vSyMJmUOHvjRmZPWtVGZGSaZL43+9u18krOBPtF/ITKgL+SWGF1Pue2K4mxTCIT14a8Sq6x+ZS3HFQsdZZFXMRSgBsweZcnNxNHlhsZkYm89dEAcYKWDp37ec7xrLZ7EClN+wb4yzzg== 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 Mon Feb 17 20:01:47 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Grant Erickson X-Patchwork-Id: 13978570 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 B996323770B for ; Mon, 17 Feb 2025 20:01:59 +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=1739822522; cv=none; b=aoIf3LsLKWwec9pTJVrC/qJX6ZeIlfCNz8MHWNAtdOrECe4ikurFxvOSOYw8JQMQLHp09Iii+ATSmmi3GObQ/HCxBqrXowikTafHDTMRvkIUCKXouOppLy1bkiLiNldeIA5a8p/8zShqFPCe2tpIwJc1j/1N5GZHPDFd9SAwP/k= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739822522; c=relaxed/simple; bh=BqGtxcEQ7ZOW68ToWAY0Q3/t6f0yzXBoRM2y8+3Ys/M=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=jWst/8CktBQln6EDgAOI3ofS45WP3eV5/QD+owhYVzdSVd5PKp9wutFM+e0jP6V52ycrpyPm2pyOtoS7qnw9q3o+PosPt7CJwGJgVEnF0XWqgfCFegDHh8LCsOKEAjJpRj/kb8yDXrY0Ry6/WIhBge2rSFuUN2j8Hs10DVwFcWs= 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=pOTI/1aA; 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="pOTI/1aA" Received: from mail5.g24.pair.com (localhost [127.0.0.1]) by mail5.g24.pair.com (Postfix) with ESMTP id 6A528164A9A for ; Mon, 17 Feb 2025 15:01:53 -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 1F4DE126369 for ; Mon, 17 Feb 2025 15:01:53 -0500 (EST) From: Grant Erickson To: ofono@lists.linux.dev Subject: [PATCH v5 4/7] qmi: Implement QMI service request rate limiting in 'can_write_data'. Date: Mon, 17 Feb 2025 12:01:47 -0800 Message-ID: <06f2aab8af4cfd8b660bb9b1c65897618ef0ad74.1739822462.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=19LVONsaqyrtgc0hdnY+CnoAHTfcEdl5YYgArp7rH6s=; b=pOTI/1aAGE+stSfhC6Rm4Yac9LUQYR/vp/otb7t1dn1NGYMhqPgBoNcG6nNdl6yEiDboD2sqDOY2dAARWT8PWBnPCWd2PAMYjaLzX5Y4pItapSA82tOawU9YbXCffdpVvrwHpQ7VVaXRB2gRo82ED5KeTyXIxel9aXNWGBFre46cwWafm0bf5x+oNuoxAL19WwWis77BQ3fC0d5779qPpOlTwfVlH7qrbKCYP2xWhJTeFhjX8SfloSMXKj3rMTAg5lZWKQ7HhEv0BrSvcVkgJ5WKHPHlg3kfZjqEzcO27wTIopg0g/CYJQr8J7MupCunisxIE3qWzQuqoVCLfMY1RQ== 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 | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/drivers/qmimodem/qmi.c b/drivers/qmimodem/qmi.c index bbe6440abe0f..a9ea88d31c36 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,12 @@ static bool can_write_data(struct l_io *io, void *user_data) return false; } +_Pragma("GCC diagnostic push") +_Pragma("GCC diagnostic ignored \"-Wconditional-uninitialized\"") + if (throttle_enabled) + transport->last_req_sent_time_us = now; +_Pragma("GCC diagnostic pop") + if (l_queue_length(transport->req_queue) > 0) return true; From patchwork Mon Feb 17 20:01:48 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Grant Erickson X-Patchwork-Id: 13978571 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 36684237702 for ; Mon, 17 Feb 2025 20:02:00 +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=1739822523; cv=none; b=llK0HmckXa7wAnH2yTiYpghzfBRBiGTHDEyYuscPPyqMQulf/poyoexpGi8I4lxscDXAyOEsJkO82cmnZEzAewc8iBtQiEi/3uA6IqgT9/sZ+9P3mnWOX8pF0mFegw7piDeklM6eGg5/TogJ34BvoJuDaZ0ensyjL+Gj0SfXUm4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739822523; c=relaxed/simple; bh=FIddyMiqDQ4SXLU7mGYwdnroR7JS4TpHpl436gYzOpw=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=oyrinn2wFiUG5iWIoRU/CpFrO30+5g8T9FM0xb/mDru6ua1wqQfojnDSt/cUVE6JsdOWkAp4u68HYzvQ54vMAwXO+R+zBzMj2i6Enn8OebLvVPi7j3DTrsqncYlUi8wVimV5C7m4mUB9CShsGq6gqzBrI1hhZUiAzuyjJ4R6nAU= 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=XnU5Plcu; 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="XnU5Plcu" Received: from mail5.g24.pair.com (localhost [127.0.0.1]) by mail5.g24.pair.com (Postfix) with ESMTP id D7CD5164A9C for ; Mon, 17 Feb 2025 15:01:53 -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 8DE54126369 for ; Mon, 17 Feb 2025 15:01:53 -0500 (EST) From: Grant Erickson To: ofono@lists.linux.dev Subject: [PATCH v5 5/7] qmi: Handle request rate limit option in 'qmi_qmux_device_new'. Date: Mon, 17 Feb 2025 12:01:48 -0800 Message-ID: <93d99436ed7edca6e4e2086d287446d308a3225f.1739822462.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=Q5rPOnnhU6QgeYqmwcfFQJMGFc+T1dSX3km0wC4zHEE=; b=XnU5PlcuXg9U9BayhktQpyemvbY3eKXO8nT1949E4Zx9N9PPxJ3MljF1SZnEAv5srwM9ZP5en4otRMU6xbRMO7a/TZpacJMN2U023qk1hJJnoBnBydFtQ34FxLKo2RKTW97AhMwhphpdSYJuKCDXWNoUQC5HnPb8lbzaR9gBxAnshkk24Wec5DIj1TKkeaK/BNFnQI6rlQ724F+r8Zii5oY69pCqKUXr8VVT+YZuYMIB0c8NaPxSpeFE7Qdf9cA4rxmq/brdbG2zZxRo6bU/HfMpX/yOvOGTSzPK+wRwRJe+4Ov9AnxHOR5yORij+Xl2X1mSoobDuGO1OcZ4cDnZ3Q== 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 a9ea88d31c36..438b98fbc7a0 100644 --- a/drivers/qmimodem/qmi.c +++ b/drivers/qmimodem/qmi.c @@ -1617,6 +1617,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 Mon Feb 17 20:01:49 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Grant Erickson X-Patchwork-Id: 13978573 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 366E7238D52 for ; Mon, 17 Feb 2025 20:02:00 +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=1739822523; cv=none; b=Zxs1nooUSLfLj4sk7V3E0ob3dDasyEX8pIegpqnV3iWqjuWteFDu7lhE+2HZFO4+UjEK40si3AbHwop6iETdHhfNodybAvUcYj4LkEDZib0MBmj/6LBWvtFvA6BlH3L49uHgQYQfsW6SItVq5WEnsSxOMG9rQyeQeChpbEh6DVI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739822523; c=relaxed/simple; bh=4r8w3BB1akA9ViycLhH6r9nNTeF+K4NnxLI7QZhqfeU=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=mVcGbJb78/IgOrds5jUg3iABsoEjCcuZJU9NWeduQ8C6eg0ZI76Wx86qKRuQps0QuIHkxFrwsFNnEswpe/jMWFkzG7gfl4As4sXJXC+Dbi3QfmBJc7+cKjQDNXaDXZuWz9abPfA267VbSQy/QT472EZ7cqZEfXdIKlgPnFPgoDY= 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=BtMc8DMy; 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="BtMc8DMy" Received: from mail5.g24.pair.com (localhost [127.0.0.1]) by mail5.g24.pair.com (Postfix) with ESMTP id 50E18164AA0 for ; Mon, 17 Feb 2025 15:01:54 -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 07E85126369 for ; Mon, 17 Feb 2025 15:01:53 -0500 (EST) From: Grant Erickson To: ofono@lists.linux.dev Subject: [PATCH v5 6/7] udevng: Set the QMI minimum service request period for Quectel BG96 modems. Date: Mon, 17 Feb 2025 12:01:49 -0800 Message-ID: <9f30423960cf36ce579e20c36c3570cc5e2f64d4.1739822462.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=BtMc8DMy0bDwwDCUCM0df9OjP6gZtdn0SlA85cxDAmrMYSpcqzyLv6u8t6VKSz5UYAf/CnFjsIvdyYwG1b5vl+R8c8PHTMgh85uYxptZK2lfdXsNxkyRuLDofZ/fcF5I8GpqQtaVk43H5tzvjNdvoFEZ4GF49njkztmcrt//4rC5tA1J2Jln8XLTIn/zdVQQlrDjF9rWXvzo/0YfxYX672btAeOIdQmpx/JBupdCwR+kJTedrju321ebXi1WOZB26tXJnM17RBSOgfeKsqNl0NiDjjs93/s26OfCNbk0OVj6719A0YI+SI3jN15Rtd5PcRbL8tLodO4bR4O9sCRVHw== 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 Mon Feb 17 20:01:50 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Grant Erickson X-Patchwork-Id: 13978572 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 A322F23770A for ; Mon, 17 Feb 2025 20:02:01 +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=1739822523; cv=none; b=WrE7StI5V6EfLlesivv19Ni9M9bnjOuUhb54KiNfT1LlBM7e8ZB85j/np7wLn/rMX1CUP7PiISriaAU01Svq2aRQP5SC8PxmNWtOu80SJbNvmw/9lxFF8MpPnGPv9vtNT5BTQttwfvgdBrpeiPln74exMBbdSxnayLF9HQLC2TE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739822523; c=relaxed/simple; bh=/zRBuxHb1YZadUGBY2Vcl0+bBcgHqG51e5rh5Q3mXrI=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Zdaf4XJXQT7W1DSi7LfuPssF/sGxlzk7DomrY14rHStw2B5evzUfkKzjjp6oUT9GnjvksctsV2LHIwc2B7nROkr1JBsQyy6K/DnR8qPrKmEEOHpNwsdVk7+tRKsMOs0ohWmCA9OlRP2jbkGe9ziVb8nJLRlVSQA0DMuIlm3UV1s= 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=daFywkiz; 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="daFywkiz" Received: from mail5.g24.pair.com (localhost [127.0.0.1]) by mail5.g24.pair.com (Postfix) with ESMTP id BD59E164AA2 for ; Mon, 17 Feb 2025 15:01:54 -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 747F2124F32 for ; Mon, 17 Feb 2025 15:01:54 -0500 (EST) From: Grant Erickson To: ofono@lists.linux.dev Subject: [PATCH v5 7/7] gobi: Pass QMI qmux device options to 'qmi_qmux_device_new'. Date: Mon, 17 Feb 2025 12:01:50 -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=daFywkizlMEW3WT2AfPR1Zv28jSSAXApH84Ux+PaRpYY2agySgIghpCMtTPi3tvaG5O5LphE19uVPftYlhT7AgebKC0WLupk1jnK6N+i4ZWNnK9RVCP6Evulk+pa4PJQdOa42AYc6lK+YlEdNm5WtTlcyULEVOQ2AkycWMOHQdjZv1SkN2pfUVtmOZIgNHGfz/pQxIvmhgOhQvQJdGE7a/bqQAZIHo3Vn4h4VDQGaoL8SpzBazSkWzML4ZseR9wKz4wMD0ljfoRILaZW8il7HVuozxQSXiRhW2Ekus9+Ztfw9ANoP7HHR5vZ+3oAeTsZ/wZnsSJQTa9pJLTLxDuCxA== 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;