From: Denis Kenzior <denkenz@gmail.com>
To: ofono@lists.linux.dev
Cc: Denis Kenzior <denkenz@gmail.com>
Subject: [PATCH v2 33/33] qmi: non-premultiplexed MHI devices
Date: Tue, 18 Jun 2024 15:02:15 -0500 [thread overview]
Message-ID: <20240618200231.1129282-33-denkenz@gmail.com> (raw)
In-Reply-To: <20240618200231.1129282-1-denkenz@gmail.com>
MHI devices by default create a single main interface and support a
single bearer over it. However, this requires a WDS Bind Data Mux
command to be issued with 'mux_id' 0. Update the qmi gprs_context
atom driver to support multiple arguments, one of them being the mux_id
and the other being the WDS service lightweight handle. If mux_id is
-1, then the WDS Bind Data Mux command is skipped. Update gobi and
qrtrqmi drivers to the new API.
---
drivers/qmimodem/gprs-context.c | 15 ++++++++-------
plugins/gobi.c | 4 ++--
plugins/qrtrqmi.c | 9 ++++++++-
3 files changed, 18 insertions(+), 10 deletions(-)
diff --git a/drivers/qmimodem/gprs-context.c b/drivers/qmimodem/gprs-context.c
index aae058f35a9b..3c18476142ea 100644
--- a/drivers/qmimodem/gprs-context.c
+++ b/drivers/qmimodem/gprs-context.c
@@ -550,16 +550,17 @@ static int qmi_gprs_context_bind_mux(struct ofono_gprs_context *gc,
return -EIO;
}
-static int qmi_gprs_context_probe(struct ofono_gprs_context *gc,
- unsigned int vendor, void *user_data)
+static int qmi_gprs_context_probev(struct ofono_gprs_context *gc,
+ unsigned int vendor, va_list args)
{
- struct qmi_service *wds = user_data;
+ int mux_id = va_arg(args, int);
+ struct qmi_service *wds = va_arg(args, struct qmi_service *);
struct gprs_context_data *data;
DBG("");
- if (vendor) {
- int r = qmi_gprs_context_bind_mux(gc, wds, vendor);
+ if (mux_id != -1) {
+ int r = qmi_gprs_context_bind_mux(gc, wds, mux_id);
if (r < 0) {
qmi_service_free(wds);
@@ -569,7 +570,7 @@ static int qmi_gprs_context_probe(struct ofono_gprs_context *gc,
data = l_new(struct gprs_context_data, 1);
data->wds = wds;
- data->mux_id = vendor;
+ data->mux_id = mux_id;
qmi_service_register(data->wds, QMI_WDS_PACKET_SERVICE_STATUS,
pkt_status_notify, gc, NULL);
@@ -593,7 +594,7 @@ static void qmi_gprs_context_remove(struct ofono_gprs_context *gc)
static const struct ofono_gprs_context_driver driver = {
.flags = OFONO_ATOM_DRIVER_FLAG_REGISTER_ON_PROBE,
- .probe = qmi_gprs_context_probe,
+ .probev = qmi_gprs_context_probev,
.remove = qmi_gprs_context_remove,
.activate_primary = qmi_activate_primary,
.deactivate_primary = qmi_deactivate_primary,
diff --git a/plugins/gobi.c b/plugins/gobi.c
index d24b95fffc91..7cdab3dda5f5 100644
--- a/plugins/gobi.c
+++ b/plugins/gobi.c
@@ -762,7 +762,7 @@ static void gobi_setup_gprs(struct ofono_modem *modem)
if (n_premux == 0) {
interface = ofono_modem_get_string(modem, "NetworkInterface");
- gc = ofono_gprs_context_create(modem, 0, "qmimodem",
+ gc = ofono_gprs_context_create(modem, 0, "qmimodem", -1,
qmi_service_clone(data->wds));
if (!gc) {
ofono_warn("Unable to create gprs-context for: %s",
@@ -788,7 +788,7 @@ static void gobi_setup_gprs(struct ofono_modem *modem)
sprintf(buf, "PremuxInterface%dMuxId", i + 1);
mux_id = ofono_modem_get_integer(modem, buf);
- gc = ofono_gprs_context_create(modem, mux_id, "qmimodem",
+ gc = ofono_gprs_context_create(modem, 0, "qmimodem", mux_id,
qmi_service_clone(data->wds));
if (!gc) {
diff --git a/plugins/qrtrqmi.c b/plugins/qrtrqmi.c
index 51e682f7e87c..cc335546caff 100644
--- a/plugins/qrtrqmi.c
+++ b/plugins/qrtrqmi.c
@@ -315,7 +315,7 @@ static int setup_gprs_context(uint8_t mux_id, const char *interface,
struct qmi_qrtr_node *node = data->node;
struct ofono_gprs_context *gc;
- gc = ofono_gprs_context_create(modem, 0, "qmimodem",
+ gc = ofono_gprs_context_create(modem, 0, "qmimodem", mux_id,
qmi_qrtr_node_get_service(node, QMI_SERVICE_WDS));
if (!gc) {
ofono_warn("Unable to create gprs-context for: %s, %s[%hhu]",
@@ -347,6 +347,13 @@ static void setup_gprs(struct ofono_modem *modem)
return;
}
+ /* Upstream driver default, single interface, single context */
+ if (!n_premux) {
+ interface = ofono_modem_get_string(modem, "NetworkInterface");
+ setup_gprs_context(0, interface, gprs);
+ return;
+ }
+
for (i = 0; i < n_premux; i++) {
int mux_id;
--
2.45.0
prev parent reply other threads:[~2024-06-18 20:02 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-18 20:01 [PATCH v2 01/33] qmi: Remove qmi_free() Denis Kenzior
2024-06-18 20:01 ` [PATCH v2 02/33] qmi: Rename qmi_result_func_t Denis Kenzior
2024-06-18 20:01 ` [PATCH v2 03/33] qmi: Drop unused major/minor information Denis Kenzior
2024-06-18 20:01 ` [PATCH v2 04/33] qmi: Add qmi_qrtr_node_get_service Denis Kenzior
2024-06-18 20:01 ` [PATCH v2 05/33] plugins: Add new qrtrqmi modem driver Denis Kenzior
2024-06-18 20:01 ` [PATCH v2 06/33] gobi: Use correct attribute name in docs Denis Kenzior
2024-06-18 20:01 ` [PATCH v2 07/33] udevng: Use new qrtrqmi driver for MHI and SoC modems Denis Kenzior
2024-06-18 20:01 ` [PATCH v2 08/33] gobi: Remove qrtr support Denis Kenzior
2024-06-18 20:01 ` [PATCH v2 09/33] udevng: Do not set DeviceProtocol Denis Kenzior
2024-06-18 20:01 ` [PATCH v2 10/33] unit: Rename device to node Denis Kenzior
2024-06-18 20:01 ` [PATCH v2 11/33] qmi: Rename qmi_device_new_qrtr to qmi_qrtr_node_new Denis Kenzior
2024-06-18 20:01 ` [PATCH v2 12/33] qmi: Rename qmi_device_new_qmux to qmi_qmux_device_new Denis Kenzior
2024-06-18 20:01 ` [PATCH v2 13/33] unit: Drop use of qmi_service_create_shared Denis Kenzior
2024-06-18 20:01 ` [PATCH v2 14/33] qmi: qmux: Make shared service creation generic Denis Kenzior
2024-06-18 20:01 ` [PATCH v2 15/33] qmi: Rename qmi_device_get_service_version Denis Kenzior
2024-06-18 20:01 ` [PATCH v2 16/33] qmi: sms: Require at WMS version 1.2+ Denis Kenzior
2024-06-18 20:01 ` [PATCH v2 17/33] qmi: Rework qmi_service_get_version Denis Kenzior
2024-06-18 20:02 ` [PATCH v2 18/33] qmi: break up qmi_device_free into qrtr & qmux variants Denis Kenzior
2024-06-18 20:02 ` [PATCH v2 19/33] qmi: Convert DBG statements to __debug_device Denis Kenzior
2024-06-18 20:02 ` [PATCH v2 20/33] qmi: introduce qmi_qrtr_node_lookup Denis Kenzior
2024-06-18 20:02 ` [PATCH v2 21/33] qmi: split qmi_device_has_service into QRTR and QMUX version Denis Kenzior
2024-06-18 20:02 ` [PATCH v2 22/33] qmi: split qmi_device_set_debug into QRTR and QMUX versions Denis Kenzior
2024-06-18 20:02 ` [PATCH v2 23/33] qmi: Make qmi_qrtr_node methods take struct qmi_qrtr_node Denis Kenzior
2024-06-18 20:02 ` [PATCH v2 24/33] qmi: Move expected data format handling into gobi Denis Kenzior
2024-06-18 20:02 ` [PATCH v2 25/33] qmi: Rename and refactor qmi_device_discover Denis Kenzior
2024-06-18 20:02 ` [PATCH v2 26/33] qmi: Rename qmi_device_shutdown Denis Kenzior
2024-06-18 20:02 ` [PATCH v2 27/33] qmi: Rename qmi_device_qmux to qmi_qmux_device Denis Kenzior
2024-06-18 20:02 ` [PATCH v2 28/33] qmi: Make qmux methods operate on 'qmi_qmux_device' Denis Kenzior
2024-06-18 20:02 ` [PATCH v2 29/33] qmi: combine service_send_data into qmi_request Denis Kenzior
2024-06-18 20:02 ` [PATCH v2 30/33] qmi: combine qmux_client_create_data " Denis Kenzior
2024-06-18 20:02 ` [PATCH v2 31/33] gprs: Fix memory leak Denis Kenzior
2024-06-18 20:02 ` [PATCH v2 32/33] qmi:gprs: Don't fail on unsupported INDICATION_REGISTER Denis Kenzior
2024-06-18 20:02 ` Denis Kenzior [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240618200231.1129282-33-denkenz@gmail.com \
--to=denkenz@gmail.com \
--cc=ofono@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox