From patchwork Thu Feb 13 00:33: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: 13972623 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 38BED1DFDE for ; Thu, 13 Feb 2025 00:33: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=1739406841; cv=none; b=hY5xXsOCVqqYa6i6QHnSRl4vD0pLJTijLfmyGm+EYR3XoiaN5hcQadF2+gAq6MKl8UsDoztpJWIc7V42iiR/VEgfp1AXPsOtnVk0j4NpVbs+L5pyF/Lzc3pRBoXaIe2Nk2PKZrLCKEcT8Sf9hgbqT5UpQyi6J9zo2dyHKgXwJJ4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739406841; c=relaxed/simple; bh=Zv4RA/sY6txtwuaBhWqF/sIrPbIIQMK3UhHs9h1Vs0M=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=BmvYzGfPt0nOSDH0/STGc0Ul1vD9M9QwWO5/dYTCCkKHcuKlg4STBirNb8FZqoZ+64ELruVtqice+Jd+gkZZEU9vjLlWrOxAx5BFQTDaSEIYuIFW7sXFv1JVztOhdMuK39UWUvNdt64WCMqs/tDLJ9J3LCqeRs6ZybqJE3JaRjE= 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=ai8hXpXT; 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="ai8hXpXT" Received: from mail5.g24.pair.com (localhost [127.0.0.1]) by mail5.g24.pair.com (Postfix) with ESMTP id 4090B164922 for ; Wed, 12 Feb 2025 19:33:58 -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 EB9A4125167 for ; Wed, 12 Feb 2025 19:33:57 -0500 (EST) From: Grant Erickson To: ofono@lists.linux.dev Subject: [PATCH v2 1/7] qmi: Added enumeration for device quirk flags. Date: Wed, 12 Feb 2025 16:33:50 -0800 Message-ID: <59c8f32bc48808da9223a192cfa180a04c711402.1739406657.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=ai8hXpXTQ4ahBMjn/D4jJeG4WSG2ZyRliTbF9WNccrvuDFB4xo8EYE3paCjZqKCY2e2/bGs3R07BkI2Viz6ggtBzxgSP+6+4H6KbVX9py/VrOprvGsMrZgePW6jdYk/O4x/5TlLW4oVJ0YdOvXhFnc7gHlKXq1hoeowXmMx2N2XIGJlWnfc6RofM0GmwLt0Fzdc7fQNcR8JIk7PQJzf8fqi2cAArrkihhuf2bn0fjvPPqfZhacGlTeKmGxzld5qetl8vRZ9I2hWI/8DJYUGvW86wf1VLOiL63zGRmil0QZGft2C24bt6wKwjJE4W2OeSd6+3sFIAO8DnQaVpkT6zHQ== 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 Thu Feb 13 00:33:51 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Grant Erickson X-Patchwork-Id: 13972622 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 7679B282F1 for ; Thu, 13 Feb 2025 00:33: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=1739406841; cv=none; b=Dvpq3jP7/35YtkWEtNIc7UTMbn2gAtoEzcy8QQTP1HEd636a8jbxqear2hwsnYg/upaAWgX+qgd2a+P4j7Jw6yo8CSumTKtO3i8v1Wdm/CK+3NGQdnjxJ3U2aVzYO3VxSgHJamnJvJiSrUD36YWnIvpiMN7ABtDo48S2GJOmeHM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739406841; c=relaxed/simple; bh=M5Yt+XgkEhwDsBif7PeTj7L8IDaWFyPdeokkm14HJmE=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ahxYflEuErQeJ3gL9J2BkI9cphEKTykxrJsCLNv/7OtgAf9a8rXe7UwGjE0fBeWQtnTZzwdDsA2Gw3WLVnAcG/7z8E1WIqcihMqcHN7HboY0qz0QqqPFokwuo0dQGsOooNysv5W6vbWPCSf2jOOfuIFuw+6e0Gt9ZLAmuwPcmcI= 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=Wgnq3dTH; 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="Wgnq3dTH" Received: from mail5.g24.pair.com (localhost [127.0.0.1]) by mail5.g24.pair.com (Postfix) with ESMTP id AC83A1649B8 for ; Wed, 12 Feb 2025 19:33:58 -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 642F8125167 for ; Wed, 12 Feb 2025 19:33:58 -0500 (EST) From: Grant Erickson To: ofono@lists.linux.dev Subject: [PATCH v2 2/7] qmi: Added structure for device options. Date: Wed, 12 Feb 2025 16:33:51 -0800 Message-ID: <520a4879b3157a715299d4874c4091a170d84638.1739406657.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=Wgnq3dTHcE4mIWphjdXF4rdpVnYE1Dm1yXWhUVX0t7IUQ/SeyayTY6+3II19dr4MkFaBaAAiW/dlOEo7FMg9cobkfnEMrVrw7MAlCmKCTW3EsX1J+Etu6HU35qF7otdd8FZdm/TiIvy9v/nVpNZiZZDmLAtpueC1PakgC71AjJot7htQ7i5BR/oTF/xuP78jNn6Rmpz0jhZmpfxCkKFlYl/6zxRXCLF0R89uhSuMluJpTIHTeUlQz5tdQwRFI8LzyzEryJiqOeV614t89nfeBFumqbFvUTnjmtR50V04/S1QHk4SRMCv9H5da2AFFfqzJsu3EMhsAl8LiB99dbl+bg== 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 Thu Feb 13 00:33:52 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Grant Erickson X-Patchwork-Id: 13972624 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 2E66A2D613 for ; Thu, 13 Feb 2025 00:33: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=1739406841; cv=none; b=S0RaF1IXVY5kGPVW5YU1ZxaFjtuD9yDweagYbBJWtcsIWFaigH2q+mdgkINKNwJQfTUlLMhWWCTVF0/OkODWw5mzAn8efGjOiKCVz0154UkvyRm3Pe0oVsKalwE0wdXvCMIZOt8IEGGv2m7v9UE2oAUH9pRa5NTtCFhfdAwAsnQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739406841; c=relaxed/simple; bh=BOjh6BbY3gmEz2aVzixjVsKqCAX013D8zE0gTMLRqds=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=YdNUKXqTuc3GwCXD83tpMWv+gLZ1v0NgWXO7OVYPrZNLY32RlyosPyKD123GV/45o5H8VXLYjWF5ZVRJay85qpC/2pm2B1qCRpgp9zCVrLcb3sawguzQ3n5Hwmtn46o4VhExArcHmyDzaxYVG4NSauoRx9K1LjZPv7ZhjKDPyUk= 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=iPsZpV2n; 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="iPsZpV2n" Received: from mail5.g24.pair.com (localhost [127.0.0.1]) by mail5.g24.pair.com (Postfix) with ESMTP id 2505C1649C6 for ; Wed, 12 Feb 2025 19:33:59 -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 D06A6125167 for ; Wed, 12 Feb 2025 19:33:58 -0500 (EST) From: Grant Erickson To: ofono@lists.linux.dev Subject: [PATCH v2 3/7] qmi: Added device options parameter to 'qmi_qmux_device_new'. Date: Wed, 12 Feb 2025 16:33:52 -0800 Message-ID: <0e9adb66276124d2bebf2f54c6138959dc8068fa.1739406657.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=iPsZpV2noO+InylSxQKuSr0fB0uaDyDio/OCP+mB16ngKdjPhUUf/JtbsieNnFu5JSfICzms82R5FNnAb9yN6RHfacuQoNDi0MIBSwKmS62g9p676tmY6Acgiq1s7Zfb+n1+/nlgwddbhxIwFovxOLkwg2q3CWTS6LTReSqw8ogbsKCDGfkwKccJNT3ktud0rZ7pYj8uFuM0qBNULM6Tj1X1gf7Yh+ximV6ZhfeqnSN5Ws1gJ506kYRVvKHVzPV/r8pzr1ZUypVrfx26eML7aHe642gwYi36GT6pbVQdyIvN+/ijhx+d7sWwABFaxGsyJ7/Opcp4VSgdtDo7wzbfBg== 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 Thu Feb 13 00:33:53 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Grant Erickson X-Patchwork-Id: 13972625 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 6908C2E40E for ; Thu, 13 Feb 2025 00:34: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=1739406842; cv=none; b=ndWbNtTpE5GrhcPKfRrmmkwUXfIGTbCmxHzBqNkcNhJMy/TWmmRg9Lf4EtNwjQrXrCTrJv9AhRYxmWxoU4T91ab/SYHVxKIu4kRu7fdNloNMMjkcynZMxH4GaMVFs618WWe8+3JKfmp9scUdR9/Svn68ReN7JUElhooiG8OlJUc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739406842; c=relaxed/simple; bh=scdN6rz+5Lc4Dsgc+rEScFi/JxNPO9iwoKN9xeN44Zg=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=qsCcxOpuUp9pQv104ZWHXITf5pJXy6iBgs5+Iug3i8QkhGl/20YCPeBe5VXLTrJ3kiGXFyH3IrU+HrJOupv6vesvGTI12gWncftdR9TY7Q92uJTYVC2gS/1sDd1i1uVgXE31BpFV7Pd/d/ldFzWrUSLvK3heiGrmibuaxu/l1Ic= 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=jwfAOweY; 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="jwfAOweY" Received: from mail5.g24.pair.com (localhost [127.0.0.1]) by mail5.g24.pair.com (Postfix) with ESMTP id 930C01649D5 for ; Wed, 12 Feb 2025 19:33:59 -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 49FA4125167 for ; Wed, 12 Feb 2025 19:33:59 -0500 (EST) From: Grant Erickson To: ofono@lists.linux.dev Subject: [PATCH v2 4/7] qmi: Implement QMI service request rate limiting in 'can_write_data'. Date: Wed, 12 Feb 2025 16:33:53 -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=wBZ4+HlxopPH02YQcuqfpZdJs7NwflyDJrcCjmdfH8w=; b=jwfAOweYktA+H/UmrRbyBlLl9+eoIDmozToldMwVoC3aDoOuaEaGmfqyCpa7fsUm1jjlpF0bj5E08zqsBjeVfIdr45RuX1h2CNQLo2WB2t+oQRbPFuJQqs2djMG93ezbEel314zl7Q5e60zhY+DLUA4ddsby3lUgT10dEFYCtT1H3gyyBRj0vrYtUIPw++cutPlyg32Q9CVAKCTLcSBuvk4JwnRe3zb+IcPjZa8pSYkYD3+yU6eifiS3UiShlKQ8384dioISVH9MCFzsQ6NC/pQgokP7OmxpLKiWwdsAIn45HprzmJmsxSv/9aiQlYqbiVtKTjAidBoOYlnfqx5xtA== 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 | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/drivers/qmimodem/qmi.c b/drivers/qmimodem/qmi.c index bbe6440abe0f..ace83044138a 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,25 @@ 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; + uint64_t delta; 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 && transport->last_req_sent_time_us != 0) { + now = l_time_now(); + 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 +694,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 Thu Feb 13 00:33:54 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Grant Erickson X-Patchwork-Id: 13972627 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 A4D991DFDE for ; Thu, 13 Feb 2025 00:34: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=1739406843; cv=none; b=f+wKMbdYmtbguU6vyFtgfoCkLpPSWOhMkhLMLajcnPZn0sEKHjjfhO/gqbNF2IteDtyJUCvNWdxX1vVhSNiI7PwOadqrFL+O366DmWtCrOZ2CEC6nuMKikPYvepwsbiSFtX54tUJS1dhUP0ztfWBT+RCMYKclc8D8E140xmzk98= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739406843; c=relaxed/simple; bh=TH4AL8AgMt6mDYouRQecEvgrdJ81ruHb/vWZsr6RJ6M=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=tW1ui85BxncZ708sP8saWlDHRJdveERSC3XhGgr74Ura+IuEkO8HiCasCzDo51tNWMDuM7HMVjGmQFOwZrLeduuwUp0QDWfo2jmL4u5j9RFSad1z+tzlmQDhIbgk/Zwa+iZzD8dt6a7wANoIxDjzy6URlE7DnqFW5UwH+nSISgU= 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=OuFMLdpw; 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="OuFMLdpw" Received: from mail5.g24.pair.com (localhost [127.0.0.1]) by mail5.g24.pair.com (Postfix) with ESMTP id 0C34B164A45 for ; Wed, 12 Feb 2025 19:34:00 -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 B8472125167 for ; Wed, 12 Feb 2025 19:33:59 -0500 (EST) From: Grant Erickson To: ofono@lists.linux.dev Subject: [PATCH v2 5/7] qmi: Handle request rate limit option in 'qmi_qmux_device_new'. Date: Wed, 12 Feb 2025 16:33:54 -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=KBOLCGS18RHm1XFV+RoryPkVTLAukDTN/MPB8Dm2Z1c=; b=OuFMLdpwXz8DASt4QA2C8dtc4lN/wFcj09ZfK0ZwCSNexqpSohH9m++y/DpL/iBaNbYJJta9kjefJl+d6UAcNNHy2JFeseK73pGmkZmFXQSKIsxlvNfXUqzx4UgchZoy82dTdhanWeOmETm2UuL2HKtIaH2D80Y9T2s/2rCxb2GctRmwwVWYzbFfnRfubTxD9KneByZJtin0Bf6hnjkgvGFxkZO77HNpFjbW5XPH5j071LktUePsBW7LRvPf/ChVlNCfd4n5TBnakz4Nua4pssT/UNrzw4H3SyuT5ycn/IF82lzqEkuA8gcQbPz8R/yKl8uUAPSYpab9qE71M47vtg== 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 ace83044138a..f544894ad4d5 100644 --- a/drivers/qmimodem/qmi.c +++ b/drivers/qmimodem/qmi.c @@ -1611,6 +1611,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 Thu Feb 13 00:33:55 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Grant Erickson X-Patchwork-Id: 13972626 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 42FFA38FAD for ; Thu, 13 Feb 2025 00:34: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=1739406843; cv=none; b=Tgc3P/ydr1vvKvfgrIn74J7TC/x9DrawTWpR5UAyQEwehWQARQgrMVcfy7wY25yKaYIY3pgV56+7CJeEXvJQUJitKObsq66ns1udZ670pkjPOho7G/drEGqz+GjJieLg/ehP64724Q7uPf7pGhxTqS1eKqonUr0rJHubNdz1XuE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739406843; c=relaxed/simple; bh=4r8w3BB1akA9ViycLhH6r9nNTeF+K4NnxLI7QZhqfeU=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=JHDlNy92ZmXPUHj5HjGXWyTNMtYpRaTPvWWlF9sERY/nmIEv+QXsfF36Y6ypXEMGakyBi37EmuwquyDjBMLRljWUTslj0khk1xPz8pKMnN1R+aCoHiNygN+sQWLI6+HQDjrwZadx15t/At58wFYm0bTnrz5AMOJbOeeQJZyDsx0= 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=AROofcK/; 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="AROofcK/" Received: from mail5.g24.pair.com (localhost [127.0.0.1]) by mail5.g24.pair.com (Postfix) with ESMTP id 78BF5164A4D for ; Wed, 12 Feb 2025 19:34:00 -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 2FE4E125167 for ; Wed, 12 Feb 2025 19:34:00 -0500 (EST) From: Grant Erickson To: ofono@lists.linux.dev Subject: [PATCH v2 6/7] udevng: Set the QMI minimum service request period for Quectel BG96 modems. Date: Wed, 12 Feb 2025 16:33:55 -0800 Message-ID: <66c3c2270abebb17d7083969519abf8dc59a2b16.1739406657.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=AROofcK/nWxt3J36DAzFz0YZm3T1f13+04uMkDSDwuo11yKiJcW28n7UGLI5MpZFQWe+6w2TzzNRhoCkK59X7oB2SxsE0AjJFaAuZ0sAdjVKEhH/cPz2YnRvwECP991jY7DHyFy2RvjGXc7emuf8aXPDjg7swj72DLwNti7WTc3djWdJnuZV9SYNdtPXaOBBtTagtbY2n+IBRTlK8JWlZdIUx65gawgRkyxyS/P/JfDf7B85aEa4uTiTRLIBAeaGbgPmxP51JL2fDhZfU2ZdsbpSNz79xKMxUy3B2upA2ZgaMkxTdr9vPbbucAR2cJLSSoozCJb4+WznDM+0WiS8LA== 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 Thu Feb 13 00:33:56 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Grant Erickson X-Patchwork-Id: 13972628 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 E1683282F1 for ; Thu, 13 Feb 2025 00:34: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=1739406843; cv=none; b=uyupQGMuX/qVruC1f5eMXMO3pfo0G8s3sF9Kysv6/p7QOjQ9wjEZQcjMjSxt0K0UUWRhp3RW60TGCB5/C1IAHABDo4TZ06VuBS5qDflUZj30AuaIv4pN08Vy9bDz/ffnW9+9Sqefcc7e+A0WYDCFwjvfnGjasukjk/NS1JIhv+g= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739406843; c=relaxed/simple; bh=/zRBuxHb1YZadUGBY2Vcl0+bBcgHqG51e5rh5Q3mXrI=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=CfQ7ogx81z2AwtwLer+TKN1dQR+Noyw611NXm4VSjCLCYBuNKwQqOyD0PpfFzF5hoU7pLRsDePvJZE8z4PufjkW/0voOykalKehXShq+jdq/1gSild5BQ8FuWLbKNtTn4JWKDz3rgcfZ2m8e5bJwUdl3zW8ieQzi53G/LlYcVc4= 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=MIuTmyts; 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="MIuTmyts" Received: from mail5.g24.pair.com (localhost [127.0.0.1]) by mail5.g24.pair.com (Postfix) with ESMTP id E6F4D1648AC for ; Wed, 12 Feb 2025 19:34:00 -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 9C826125167 for ; Wed, 12 Feb 2025 19:34:00 -0500 (EST) From: Grant Erickson To: ofono@lists.linux.dev Subject: [PATCH v2 7/7] gobi: Pass QMI qmux device options to 'qmi_qmux_device_new'. Date: Wed, 12 Feb 2025 16:33:56 -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=MIuTmyts7JBI3VSqQZBZsXObmbCH3Un2ojfNecnvH93vpHZQxrIl5y3QO+YNleRF21YiEICuMouvBlTJj/8c9nTpcFgyvT5a296P0ZyiuYcBGRk6Bl8my4SXHVY1/9x505Zp9/yk5Uw4OAZ9y3vLJ6qVSh4gFolfEKGZmxWo7VJzGEiPWd4DhJIaLItbNwIdplOw+H02HYl2s+f7uVGAZMGraHWFhag7lemQLzoPi3Fzkd7uydOtp7aNY3kPxf55z1n15lw/BsIL6cg7vSqWBO4f1ZYL/TSkWKRy7XLy9n+5zHGqfEwRLDBlsRYa5eltQIN4UjLIVg9I4c3kdRRNlA== 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;