From patchwork Fri Feb 14 05:04:42 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Grant Erickson X-Patchwork-Id: 13974491 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 A6E6513C918 for ; Fri, 14 Feb 2025 05:04:51 +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=1739509493; cv=none; b=hKY32dr3c25Pbxx4s9qdkauEJ4EkTH1B0Fyk/o/dr7AF9uf0gx5K83NCoaxWIYNo45Lq78xliQjZlJX7sz4yYEzFsB3acAfhvzZqA7/wIc+f4Rth/TAgMogTHHc2OwTNtiAdAASmLqNmCDDeaVlr+U0BmkgB4O8Cov9s7/ZJD4s= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739509493; c=relaxed/simple; bh=Zv4RA/sY6txtwuaBhWqF/sIrPbIIQMK3UhHs9h1Vs0M=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=RvrRNs0rvNf6PG2IVZ41ymp2H5QLylzwbhFgAldVQHTkB89gKYQ6Mb0negZlg6N+OZCOFa/hrVqGRLpOWTnX5GglCpC4P7iGkm9h3jx2A53218oaU+mSlYV3d/rIYKnClmuX+iHuw9PZMU2vu4IviWXDlF7U2jU2l19dFV15Tc4= 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=MfcK1Baj; 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="MfcK1Baj" Received: from mail5.g24.pair.com (localhost [127.0.0.1]) by mail5.g24.pair.com (Postfix) with ESMTP id C258B164A75 for ; Fri, 14 Feb 2025 00:04:50 -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 7902A125167 for ; Fri, 14 Feb 2025 00:04:50 -0500 (EST) From: Grant Erickson To: ofono@lists.linux.dev Subject: [PATCH v3 1/7] qmi: Added enumeration for device quirk flags. Date: Thu, 13 Feb 2025 21:04:42 -0800 Message-ID: <59c8f32bc48808da9223a192cfa180a04c711402.1739509438.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=MfcK1BajhPWVEmG5BMiqE8FT+v6LNmxPFTHX8YZX1Cov6OCM79XPapHjVQ0K2rqC4sRwgiFp34gHJ6PvJeNlwqth4vSN9ShCcf4tgYmiPjo8+qY8fscNImvV3RxTqdz9IgT1U3ALDQYMKPS/Bv8cqpH1hBJ/kQO4pz5tK6jtFX2Tnzm5wKQwI9+yJf8CzSjxNDymvYX4KnTYqKPnE+oqyC6RAKJPcFGzBNp7kA7mDJGmN3Jsed2yVQYKCO/uCSR+qV2iFt38GmJ0ARo4FrS46F918F6vVDfhf8cVqY9dfC5WLF3E+diNrxqIusJys6jgU5+fDIEHhzp9QRDvhPNQew== 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 05:04:43 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Grant Erickson X-Patchwork-Id: 13974492 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 251C414658D for ; Fri, 14 Feb 2025 05:04:51 +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=1739509494; cv=none; b=EqJAE0Wbdz/lGOdgzr2DMPbHiibETnPPxeoSMgZsQTI853RNhArJVtcBMq0stwH1zrJ1Ud8mlINskupjCTv1IYBS7ydRRmvi/dpC25m7xmFhn7bj0Z1EmRLrmWucAQ43oxaWwlkKqrpRZG4ZI7Z1Aq4gYEgGAQyJsfCgpy/osAY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739509494; c=relaxed/simple; bh=M5Yt+XgkEhwDsBif7PeTj7L8IDaWFyPdeokkm14HJmE=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=gcffQTGdN41sbJlhVh1LRk47MuYPMczT5Lq5ztCadt+z34klFYDwISSDMcH1LBgbUfKLjYob+F9pdb+5+/jihmWqu9GzFnhSxmCGsDmFK2G2utQa4npiZrshQ4EvGq1SP/gCiaW2Lim3fbqbK8lv+gHS++kiGE6nG/cJ0dsDwvA= 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=N3P0hNqS; 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="N3P0hNqS" Received: from mail5.g24.pair.com (localhost [127.0.0.1]) by mail5.g24.pair.com (Postfix) with ESMTP id 3BA28164A79 for ; Fri, 14 Feb 2025 00:04:51 -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 E6280125167 for ; Fri, 14 Feb 2025 00:04:50 -0500 (EST) From: Grant Erickson To: ofono@lists.linux.dev Subject: [PATCH v3 2/7] qmi: Added structure for device options. Date: Thu, 13 Feb 2025 21:04:43 -0800 Message-ID: <520a4879b3157a715299d4874c4091a170d84638.1739509438.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=N3P0hNqSZG8uhftwHdULHTuA9/+2BcRQV92NhxuUNDd4O8tcnSrzEE0J9gCWqGhyUICpwSkB1AijWBPE4B68VweP9u1gJIQZS/poYA8Td6SLMx7WFuP5ggyCyPs+m05ghMtKHapfo2Jp2JYgYIFuntVsp8WCf2u6yeOI3Mp3Hn2Fi7NosyqKAJnftnAsQfME5mkHwiLM4uYV4ud6Q0ghnUCE1HSN4ZE5YeMcptiE21ssHN4S/nN/wXx6ys6dWYGznEBCl5fSIWIGd31k8rQtql+3gaOEy7ClLwZb5DfJiJlvs6P6Vh+NLE6fsO571A1WyymaFLQWlHnXB38CVin90Q== 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 05:04: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: 13974493 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 8D82F1487FA for ; Fri, 14 Feb 2025 05:04:52 +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=1739509494; cv=none; b=ddEd8LSDcgkX+uZ6BdQeyyRJn44Sp1MsHGDLauXqGzEgCxQrqEv2sa4Pdu6vc8Y2d7kAkD30vMVjRy47UR3HoOBqDcADTDeyhojKx8EMcr1XXWPQq2LkjDkFe9zkFBZ+t2bWu3GIt724Sdke9J7Yey6WROfIx7VNS9gio6w5UCg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739509494; c=relaxed/simple; bh=BOjh6BbY3gmEz2aVzixjVsKqCAX013D8zE0gTMLRqds=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=TYzQiYgHCrnpSDOp3ZhNDIJ4nLd5p103ftqufKeqJ2Tv1/aVCraZCOOxy5fAgUjgUjfeAfcfJ3cI0pnIbkuR5Yr7o0KnZ1l9Vd+SjxnEjKbM1+ySx1Wl95VZIcOZhJAJnSaRPPSwRnkTRHxmhFgVkHLgel1aD85cSvSysMOTwU8= 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=aJdZ9jPd; 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="aJdZ9jPd" Received: from mail5.g24.pair.com (localhost [127.0.0.1]) by mail5.g24.pair.com (Postfix) with ESMTP id A918C164A7B for ; Fri, 14 Feb 2025 00:04:51 -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 5F890125167 for ; Fri, 14 Feb 2025 00:04:51 -0500 (EST) From: Grant Erickson To: ofono@lists.linux.dev Subject: [PATCH v3 3/7] qmi: Added device options parameter to 'qmi_qmux_device_new'. Date: Thu, 13 Feb 2025 21:04:44 -0800 Message-ID: <0e9adb66276124d2bebf2f54c6138959dc8068fa.1739509438.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=aJdZ9jPdzC47EviSu6L0lE7Zy+uJmrgF924EGA7fb/bszySKQN1B10i8MAnQu4gPzVPNafGWApSUWUaz+0LNQuymx7G4GpF1MRmsQRAKFvU5UubP5qyfBI9bEkxvkPi4FmDmnL1VrODcDm/Uuud/mpuFS508a3mZcFzX36hbsZ7pZSPFqNYRSpiJ3tHfbUkBHo0ZDmpHaL4/2ZgPh6Psf9c14ZQRRchemm3QvkGP9gUARp6dGNehvTXkSIlROfp5WRCpAf287Wh1NTEdC95jktz8Q+GDrePNJsHr8xqG99jsbUlgijw/3VQGVePmyVbvJBjj53xgO0UqaF54tcvmWw== 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 05:04: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: 13974494 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 F1C96152E02 for ; Fri, 14 Feb 2025 05:04:52 +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=1739509494; cv=none; b=Muc1b5PMv+WwQmAZb1Zvp9KnHhAcC+3ijSyNaHEZO7VKkyTLv8nti2Vvii0E65D90C5MbHxH4BNjCmr/dVGyWVWr+9XBeBavvBwytyXhSQc1kNtfmV0LoGuzfEFOYm6JsN1gxQXLDOfsuH49Mxu4ns43iTzn9pAeRZeEsZv1pn0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739509494; c=relaxed/simple; bh=PyYbFE0YeT1OUiReqcfILe2xmfo+Nlx4QEM22HFNUsc=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=K/d9m6ezp2uEwBVNtIvOzETtOAwtzX6kCW1P4GwfxKRMENviq8rHRh/KRzP1d+OQVgLWIbC1abFsHsxzWO0xbYYIsgOlGud1879kGB8X7M5AuD/BaL7NDD9FSDIvmGeCyCYrfG6YhIm820MobGYhnLGFUUoi2RCN1UqJ1ArfLds= 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=RoHeSceX; 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="RoHeSceX" Received: from mail5.g24.pair.com (localhost [127.0.0.1]) by mail5.g24.pair.com (Postfix) with ESMTP id 24359164A83 for ; Fri, 14 Feb 2025 00:04: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 CD2B3125167 for ; Fri, 14 Feb 2025 00:04:51 -0500 (EST) From: Grant Erickson To: ofono@lists.linux.dev Subject: [PATCH v3 4/7] qmi: Implement QMI service request rate limiting in 'can_write_data'. Date: Thu, 13 Feb 2025 21:04:45 -0800 Message-ID: <31c04f926af6ddfe0e244c2d6b0999ee9442659a.1739509438.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=scoC26SEZPw9somyZlxltMd0AUfRHn+aP9H34pSobqQ=; b=RoHeSceX94dUiC/LVTyzMY1SXCHAoTwCJpLp21RTVHxRmZLJpmgZzAdYBf5RKW+hUEM2wgABBWl8ihvfIB8gTGV+vd6E71CUkdA9vP4nAUyAcsE0uBTwIkowOozlbIL5qlV6o4tHOXve+YvxAPpKui7ptP83ks+F5RrbPjBrRPrrJt+x54rLBHGvthPqn3G1oJb3b8TGRr96WfKODejCXxFuOr9H1O4pwBQc5i9ohnEmRwCIQ6PrrCCgN/O9jlqHLe05CznfSFZHBw/6zw7TY/t3tsK0Hq6SzsoYFxvIWReYdqVMbQYveETjdqjvVljNwK7jPEBLDHLz2GoHBuqPqQ== 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..f26a9816c71c 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 = 0; + 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 Fri Feb 14 05:04: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: 13974496 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 803161487FA for ; Fri, 14 Feb 2025 05:04:54 +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=1739509496; cv=none; b=eZ0vfuXaasQrnJ2ZVYcXY2GtLubvw+RSvn+e7/eypDMfpM9i4YmICVIHFWJNEpy8BtWTUntOOrU2Tae+/H1XFedF4zAR1gbefzmESCP8eZOjgNdOLJSNEUb89FNnYjKpIGlggYy2RPp3U6zxFIwBAjzkxTjAP6RlyzMqRYrIpOQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739509496; c=relaxed/simple; bh=t/O+W+HsqXu03ft95Ypi7Ty/dXu8XqtU7DHBKFW3Qms=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=SUiSU8hSor/uoxdi9chyuFj/e023O113aKiA7xV1a/aHWuPNfad2cfeiG2WauTI8gdLpiRT4QRlgLHX9Y9dwoBK0APbCQyegwc+tY7P1v17JA6/mLu1/kla4CtbhxHtAEWnJ6oVooiUoIAbkGFnAUIA9R/20WxUpTJ/Q31QDLCE= 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=buokyXLO; 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="buokyXLO" Received: from mail5.g24.pair.com (localhost [127.0.0.1]) by mail5.g24.pair.com (Postfix) with ESMTP id 92F54164A8B for ; Fri, 14 Feb 2025 00:04: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 490FE125167 for ; Fri, 14 Feb 2025 00:04:52 -0500 (EST) From: Grant Erickson To: ofono@lists.linux.dev Subject: [PATCH v3 5/7] qmi: Handle request rate limit option in 'qmi_qmux_device_new'. Date: Thu, 13 Feb 2025 21:04:46 -0800 Message-ID: <86bd06fada4034df3daab5141a45c01182d89cec.1739509438.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=ISIlikyP2ZOodTD7Qlv/1RxUMgq52+SDwWMcrVclQC8=; b=buokyXLOVTnfClybHnHbHUQwmWZruKoVYLP/RjW90xey7vGNEL8JVn3iQ+HgBpjED1Ert5Ze8Tsi5ruKEiwfjPh6UyE+SZ6nc3vjfYl6h3GkI/iRbc/ASmUG+6bm4/Wpm5jTCEqMlj3kgojR9KM627WCQ7O+Zj0Q3JaUEGV710Y9ODwq4jwU5q+hG84z9XdwZBLqLrvnegPe3FZZ3aKC9UzUSmYE0ARQSPH068T7DQkj7FSAS0d+gpCRPbkTubthDaqYbz1YF7J9Pp9WqwFrpNM6y3TqMPb7S7YzquBj4GCOfczjBegm9ShWtyuGygML5X05ePYnHK/BqgveiFs34g== 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 f26a9816c71c..6063ed1d8634 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 Fri Feb 14 05:04: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: 13974497 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 8036315748F for ; Fri, 14 Feb 2025 05:04:54 +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=1739509496; cv=none; b=DyMFqUQmaDuePCWnob2QGE6gGIcW+NyKLXj6I9oblHPUE4AMrWqdnWXttpp9PK+JXjBEKPVfTHvSI3YSe6khC5ii/f8VWmIrh6Y82EaeIvY47d1JKQHd5urZ5EHC+95FnAmQyzeq9yR4ibVsEVwV7DRtg3qb/szpyCld2Ci3gJA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739509496; c=relaxed/simple; bh=4r8w3BB1akA9ViycLhH6r9nNTeF+K4NnxLI7QZhqfeU=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=qmtzaXDtJfLCtpzotSrPhYqwROnLJLUllEV4cp6Ex0LYwC7yhWi4k1FT9RWq3syGCyvQ3wxDHHIeTfvYsgubCM9cK8Vu+0hBYy0d4IBuT7/hdTkw7e8rlwxkgj4zVmg9yss1PK7uneyim1IwOsArRavu4ifJXHhhZ1kiN172pvw= 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=A8ABgXBS; 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="A8ABgXBS" Received: from mail5.g24.pair.com (localhost [127.0.0.1]) by mail5.g24.pair.com (Postfix) with ESMTP id 0BA2D164A8D for ; Fri, 14 Feb 2025 00:04: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 B6C43125167 for ; Fri, 14 Feb 2025 00:04:52 -0500 (EST) From: Grant Erickson To: ofono@lists.linux.dev Subject: [PATCH v3 6/7] udevng: Set the QMI minimum service request period for Quectel BG96 modems. Date: Thu, 13 Feb 2025 21:04:47 -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=HY5EY2ISZixz3Mr7Wq0vZ6BjK6Xua0OSEwuqX7gyeJ8=; b=A8ABgXBSgZClldSFoCYm9l5ziiN8hDAVNMRksLyvyMlHQeKQpP0vtVgHDu7CjpvSL2JBYKEI32AwNvPWoSicRCzD04Uj7Vwc49p/u4lJZj34gC248+JU3PrSEtdaU2ZxlaotQGjde7I2LeJZd+k8Cwxodf424Zb2Who1JSjz4ttOGQpw9+TPVd0Ykmsv2v4T243m34JfrStNT7YA+ybNlxXTEyFqYHDiJxcEvQXlSjqfk2NV5W9r9cMa8C2aSCrBLdj+fCuF0eB0P0Cc3eEYsul9sXCx8zPRpbxwRVHZlPD1/jv6oqH4jIIt1I69w3NrXG9n4O0XgOFd9CnAAqXVAw== 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 05:04: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: 13974495 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 803D215A86B for ; Fri, 14 Feb 2025 05:04:54 +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=1739509496; cv=none; b=Xs/ckf7Ddy4czU1AefpMrJFQxV3XJfcTmZhNoyPXW+oOqj/gHwVaaRJiFNnSWSuobEOYgdWzKJeFDcd9vdvRPvaWipj8bjaQ+NbRCLQYauf62Ggm24gH4uOTtmwetQLgR6/GmOsPoNKARcPFts2nTTwFDrhj+/bjIDQ42FiuIrU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739509496; c=relaxed/simple; bh=/zRBuxHb1YZadUGBY2Vcl0+bBcgHqG51e5rh5Q3mXrI=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=koNMT6Es2UswG8pMz9qlgSfbGBpsBULZCL62/ljpLN1da/iltGr1DG6FKRcOEs8cZuzFt12kQK/sojOFy+OEKg8FCAZYggfgzrySApy1WCaJkawOz1xKsuKidOFK0hOEwzk0WkJDFxdSHAUEh8xP7Yw//KltW6PMMuY7aOmZFno= 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=X6rW0Dpr; 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="X6rW0Dpr" Received: from mail5.g24.pair.com (localhost [127.0.0.1]) by mail5.g24.pair.com (Postfix) with ESMTP id 79A5F164A8F for ; Fri, 14 Feb 2025 00:04: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 2F75C125167 for ; Fri, 14 Feb 2025 00:04:53 -0500 (EST) From: Grant Erickson To: ofono@lists.linux.dev Subject: [PATCH v3 7/7] gobi: Pass QMI qmux device options to 'qmi_qmux_device_new'. Date: Thu, 13 Feb 2025 21:04:48 -0800 Message-ID: <58b94cf70d2e52eac6d27f98e28c5b7113ac4b8b.1739509438.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=Vxp+G+wWuhPQL8Dt96ps2vexl5kKWAzJ+wzPwtwjdmc=; b=X6rW0DprHr6nfkd8SVBKqtS8t45jOCSw2mYtje/VGEhgIeQblrFODdfASpFyTYh3AF/MEb5Ro65RE52CamOKnGcfO4rSh8Gs1kQvKe/0UiE4NRNJ5y5oc+Tg0RW3WGlpWud7SkULDvVTKpM70Rxw9d8imkVmuMehBOwnZ4sTCc4nUKQH82Xdhl7SwDyZaDbqBOppRMQHzUgMvP6BY8bIgOXXGvpCydZyJQaB2ZDoLpWjdrADVDvv7Qdqn0rYu2sWIt6O3DntlyuYlTz5ZHSval0mgQ9JEc1bxH6Z3S2pgnzaQnRKCRdzI0PsvEAvGfPB82y3PzQrtERRZ8st0GJ6fQ== 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;