All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 01/11] udevng: Remove gps from setup_gobi
@ 2024-07-11 16:46 Denis Kenzior
  2024-07-11 16:46 ` [PATCH v2 02/11] build: Require at least version 0.67 when building with external ELL Denis Kenzior
                   ` (10 more replies)
  0 siblings, 11 replies; 13+ messages in thread
From: Denis Kenzior @ 2024-07-11 16:46 UTC (permalink / raw)
  To: ofono; +Cc: Steve Schrock

From: Steve Schrock <steve.schrock@getcruise.com>

Even when the gps variable was set, it was not actually used for
anything.
---
 plugins/udevng.c | 14 +-------------
 1 file changed, 1 insertion(+), 13 deletions(-)

diff --git a/plugins/udevng.c b/plugins/udevng.c
index 8e116c6605ea..1c56e2ea62d3 100644
--- a/plugins/udevng.c
+++ b/plugins/udevng.c
@@ -355,7 +355,6 @@ static gboolean setup_gobi(struct modem_info *modem)
 {
 	const struct device_info *qmi = NULL;
 	const struct device_info *net = NULL;
-	const char *gps = NULL;
 	GSList *list;
 
 	DBG("%s", modem->syspath);
@@ -373,23 +372,12 @@ static gboolean setup_gobi(struct modem_info *modem)
 			qmi = info;
 		else if (g_strcmp0(subsystem, "net") == 0) /* wwan */
 			net = info;
-		else if (g_strcmp0(subsystem, "tty") == 0) {
-			if (g_strcmp0(info->interface, "255/255/255") == 0) {
-				if (g_strcmp0(info->number, "03") == 0)
-					gps = info->devnode; /* gobi */
-			} else if (g_strcmp0(info->interface, "255/0/0") == 0) {
-				if (g_strcmp0(info->number, "01") == 0)
-					gps = info->devnode; /* ec20 */
-				/* ignore the 3rd device second AT/mdm iface */
-			}
-		}
 	}
 
 	if (qmi == NULL || net == NULL)
 		return FALSE;
 
-	DBG("qmi=%s net=%s gps=%s",
-			qmi->devnode, get_ifname(net), gps);
+	DBG("qmi=%s net=%s", qmi->devnode, get_ifname(net));
 
 	if (setup_qmi_qmux(modem, qmi, net) < 0)
 		return FALSE;
-- 
2.45.2


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH v2 02/11] build: Require at least version 0.67 when building with external ELL
  2024-07-11 16:46 [PATCH v2 01/11] udevng: Remove gps from setup_gobi Denis Kenzior
@ 2024-07-11 16:46 ` Denis Kenzior
  2024-07-11 16:46 ` [PATCH v2 03/11] Release 2.9 Denis Kenzior
                   ` (9 subsequent siblings)
  10 siblings, 0 replies; 13+ messages in thread
From: Denis Kenzior @ 2024-07-11 16:46 UTC (permalink / raw)
  To: ofono; +Cc: Marcel Holtmann

From: Marcel Holtmann <marcel@holtmann.org>

---
 configure.ac | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/configure.ac b/configure.ac
index b14ed9e99c56..c0053df840ae 100644
--- a/configure.ac
+++ b/configure.ac
@@ -247,8 +247,8 @@ AC_ARG_ENABLE([external_ell], AS_HELP_STRING([--enable-external-ell],
 				[enable external Embedded Linux library]),
 					[enable_external_ell=${enableval}])
 if (test "${enable_external_ell}" = "yes"); then
-	PKG_CHECK_MODULES(ELL, ell >= 0.66, dummy=yes,
-		AC_MSG_ERROR(Embedded Linux library >= 0.66 is required))
+	PKG_CHECK_MODULES(ELL, ell >= 0.67, dummy=yes,
+		AC_MSG_ERROR(Embedded Linux library >= 0.67 is required))
 	AC_SUBST(ELL_CFLAGS)
 	AC_SUBST(ELL_LIBS)
 fi
-- 
2.45.2


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH v2 03/11] Release 2.9
  2024-07-11 16:46 [PATCH v2 01/11] udevng: Remove gps from setup_gobi Denis Kenzior
  2024-07-11 16:46 ` [PATCH v2 02/11] build: Require at least version 0.67 when building with external ELL Denis Kenzior
@ 2024-07-11 16:46 ` Denis Kenzior
  2024-07-11 16:46 ` [PATCH v2 04/11] gobi: Limit number of premultiplexed contexts to 4 Denis Kenzior
                   ` (8 subsequent siblings)
  10 siblings, 0 replies; 13+ messages in thread
From: Denis Kenzior @ 2024-07-11 16:46 UTC (permalink / raw)
  To: ofono; +Cc: Marcel Holtmann

From: Marcel Holtmann <marcel@holtmann.org>

---
 ChangeLog    | 3 +++
 configure.ac | 2 +-
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/ChangeLog b/ChangeLog
index 5d4feff7d8ae..48c6bd39bca4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,6 @@
+ver 2.9:
+	Add support for QRTR based devices (MHI bus and SoC).
+
 ver 2.8:
 	Fix issue with handling USB TTY device detection.
 	Fix issue with handling GOBI versus QRTR detection.
diff --git a/configure.ac b/configure.ac
index c0053df840ae..3550b8a3d8e2 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,5 +1,5 @@
 AC_PREREQ([2.69])
-AC_INIT([ofono], [2.8])
+AC_INIT([ofono], [2.9])
 
 AC_CONFIG_HEADERS(config.h)
 AC_CONFIG_AUX_DIR(build-aux)
-- 
2.45.2


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH v2 04/11] gobi: Limit number of premultiplexed contexts to 4
  2024-07-11 16:46 [PATCH v2 01/11] udevng: Remove gps from setup_gobi Denis Kenzior
  2024-07-11 16:46 ` [PATCH v2 02/11] build: Require at least version 0.67 when building with external ELL Denis Kenzior
  2024-07-11 16:46 ` [PATCH v2 03/11] Release 2.9 Denis Kenzior
@ 2024-07-11 16:46 ` Denis Kenzior
  2024-07-11 16:50   ` Denis Kenzior
  2024-07-11 16:46 ` [PATCH v2 05/11] gobi: Request dedicated WDS services for contexts Denis Kenzior
                   ` (7 subsequent siblings)
  10 siblings, 1 reply; 13+ messages in thread
From: Denis Kenzior @ 2024-07-11 16:46 UTC (permalink / raw)
  To: ofono; +Cc: Denis Kenzior

4 was chosen somewhat arbitrarily, but it is the maximum that the
qmi_wwan_q driver can support out of the box.  The only limit is the
number of clients under QMI.  Two WDS clients are typically required for
each active context, one for IPv4 and one for IPv6.  The total number of
clients cannot exceed 255 (uint8).
---
 plugins/gobi.c | 19 +++++++++++++++----
 1 file changed, 15 insertions(+), 4 deletions(-)

diff --git a/plugins/gobi.c b/plugins/gobi.c
index 88e4c7fc4887..b6df849de47e 100644
--- a/plugins/gobi.c
+++ b/plugins/gobi.c
@@ -55,6 +55,8 @@
 #define GOBI_VOICE	(1 << 6)
 #define GOBI_WDA	(1 << 7)
 
+#define MAX_CONTEXTS 4
+
 struct service_request {
 	struct qmi_service **member;
 	uint32_t service_type;
@@ -75,6 +77,7 @@ struct gobi_data {
 	int num_service_requests;
 	unsigned long features;
 	unsigned int discover_attempts;
+	uint8_t n_premux;
 	uint8_t oper_mode;
 	int main_net_ifindex;
 	char main_net_name[IFNAMSIZ];
@@ -124,6 +127,7 @@ static int gobi_probe(struct ofono_modem *modem)
 	const char *ifname;
 	int ifindex;
 	const char *bus;
+	int n_premux;
 
 	DBG("%p", modem);
 
@@ -132,10 +136,11 @@ static int gobi_probe(struct ofono_modem *modem)
 	ifname = ofono_modem_get_string(modem, "NetworkInterface");
 	ifindex = ofono_modem_get_integer(modem, "NetworkInterfaceIndex");
 	bus = ofono_modem_get_string(modem, "Bus");
+	n_premux = ofono_modem_get_integer(modem, "NumPremuxInterfaces");
 
 	DBG("net: %s[%s](%d) %s", ifname, if_driver, ifindex, bus);
 
-	if (!if_driver || !ifname || !ifindex || !bus)
+	if (!if_driver || !ifname || !ifindex || !bus || n_premux < 0)
 		return -EPROTO;
 
 	data = l_new(struct gobi_data, 1);
@@ -145,6 +150,13 @@ static int gobi_probe(struct ofono_modem *modem)
 	else if (!strcmp(if_driver, "qmi_wwan"))
 		data->using_qmi_wwan = true;
 
+	if (n_premux > MAX_CONTEXTS) {
+		l_warn("NumPremuxInterfaces > %d, limiting to %d",
+				MAX_CONTEXTS, MAX_CONTEXTS);
+		n_premux = MAX_CONTEXTS;
+	}
+
+	data->n_premux = n_premux;
 	data->main_net_ifindex =
 		ofono_modem_get_integer(modem, "NetworkInterfaceIndex");
 	l_strlcpy(data->main_net_name,
@@ -753,7 +765,6 @@ static void gobi_pre_sim(struct ofono_modem *modem)
 static void gobi_setup_gprs(struct ofono_modem *modem)
 {
 	struct gobi_data *data = ofono_modem_get_data(modem);
-	int n_premux = ofono_modem_get_integer(modem, "NumPremuxInterfaces");
 	struct ofono_gprs *gprs;
 	struct ofono_gprs_context *gc;
 	const char *interface;
@@ -770,7 +781,7 @@ static void gobi_setup_gprs(struct ofono_modem *modem)
 	}
 
 	/* Simple case of 802.3 interface, no QMAP */
-	if (n_premux == 0) {
+	if (data->n_premux == 0) {
 		interface = ofono_modem_get_string(modem, "NetworkInterface");
 
 		gc = ofono_gprs_context_create(modem, 0, "qmimodem", -1,
@@ -793,7 +804,7 @@ static void gobi_setup_gprs(struct ofono_modem *modem)
 		ofono_modem_get_integer(modem, "MaxAggregationSize");
 	DBG("max_aggregation_size: %u", data->max_aggregation_size);
 
-	for (i = 0; i < n_premux; i++) {
+	for (i = 0; i < data->n_premux; i++) {
 		int mux_id;
 
 		sprintf(buf, "PremuxInterface%dMuxId", i + 1);
-- 
2.45.2


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH v2 05/11] gobi: Request dedicated WDS services for contexts
  2024-07-11 16:46 [PATCH v2 01/11] udevng: Remove gps from setup_gobi Denis Kenzior
                   ` (2 preceding siblings ...)
  2024-07-11 16:46 ` [PATCH v2 04/11] gobi: Limit number of premultiplexed contexts to 4 Denis Kenzior
@ 2024-07-11 16:46 ` Denis Kenzior
  2024-07-11 16:46 ` [PATCH v2 06/11] qmi: Enable _auto_ use for some classes Denis Kenzior
                   ` (6 subsequent siblings)
  10 siblings, 0 replies; 13+ messages in thread
From: Denis Kenzior @ 2024-07-11 16:46 UTC (permalink / raw)
  To: ofono; +Cc: Denis Kenzior

Each context the modem supports (up to MAX_CONTEXTS) will require two
dedicated WDS services.  One will manage the IPv4 configuration, the
other will manage IPv6 configuration.
---
 plugins/gobi.c | 23 ++++++++++++++++++++++-
 1 file changed, 22 insertions(+), 1 deletion(-)

diff --git a/plugins/gobi.c b/plugins/gobi.c
index b6df849de47e..76e1e133860d 100644
--- a/plugins/gobi.c
+++ b/plugins/gobi.c
@@ -72,7 +72,11 @@ struct gobi_data {
 	struct qmi_service *voice;
 	struct qmi_service *pds;
 	struct qmi_service *uim;
-	struct service_request service_requests[16];
+	struct {
+		struct qmi_service *wds_ipv4;
+		struct qmi_service *wds_ipv6;
+	} context_services[MAX_CONTEXTS];
+	struct service_request service_requests[8 + MAX_CONTEXTS * 2];
 	int cur_service_request;
 	int num_service_requests;
 	unsigned long features;
@@ -170,6 +174,8 @@ static int gobi_probe(struct ofono_modem *modem)
 
 static void cleanup_services(struct gobi_data *data)
 {
+	int i;
+
 	qmi_service_free(data->dms);
 	data->dms = NULL;
 
@@ -193,6 +199,13 @@ static void cleanup_services(struct gobi_data *data)
 
 	qmi_service_free(data->uim);
 	data->uim = NULL;
+
+	for (i = 0; i < MAX_CONTEXTS; i++) {
+		qmi_service_free(data->context_services[i].wds_ipv4);
+		qmi_service_free(data->context_services[i].wds_ipv6);
+	}
+
+	memset(&data->context_services, 0, sizeof(data->context_services));
 }
 
 static void gobi_remove(struct ofono_modem *modem)
@@ -489,6 +502,7 @@ static void discover_cb(void *user_data)
 	struct gobi_data *data = ofono_modem_get_data(modem);
 	uint16_t major;
 	uint16_t minor;
+	int i;
 
 	DBG("");
 
@@ -538,6 +552,13 @@ static void discover_cb(void *user_data)
 	if (data->features & GOBI_UIM)
 		add_service_request(data, &data->uim, QMI_SERVICE_UIM);
 
+	for (i = 0; i < (data->n_premux ? data->n_premux : 1); i++) {
+		add_service_request(data, &data->context_services[i].wds_ipv4,
+							QMI_SERVICE_WDS);
+		add_service_request(data, &data->context_services[i].wds_ipv6,
+							QMI_SERVICE_WDS);
+	}
+
 	if (qmi_qmux_device_create_client(data->device, QMI_SERVICE_DMS,
 					request_service_cb, modem, NULL) > 0)
 		return;
-- 
2.45.2


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH v2 06/11] qmi: Enable _auto_ use for some classes
  2024-07-11 16:46 [PATCH v2 01/11] udevng: Remove gps from setup_gobi Denis Kenzior
                   ` (3 preceding siblings ...)
  2024-07-11 16:46 ` [PATCH v2 05/11] gobi: Request dedicated WDS services for contexts Denis Kenzior
@ 2024-07-11 16:46 ` Denis Kenzior
  2024-07-11 16:46 ` [PATCH v2 07/11] qmi: gprs-context: Declare qmi_service objects using _auto_ Denis Kenzior
                   ` (5 subsequent siblings)
  10 siblings, 0 replies; 13+ messages in thread
From: Denis Kenzior @ 2024-07-11 16:46 UTC (permalink / raw)
  To: ofono; +Cc: Denis Kenzior

This enables ell _auto_ keyword use with qmi_service_free and
qmi_param_free.
---
 drivers/qmimodem/qmi.h | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/qmimodem/qmi.h b/drivers/qmimodem/qmi.h
index 0e48313ebb64..69698ee049c6 100644
--- a/drivers/qmimodem/qmi.h
+++ b/drivers/qmimodem/qmi.h
@@ -5,6 +5,8 @@
  * SPDX-License-Identifier: GPL-2.0-only
  */
 
+#include <ell/cleanup.h>
+
 #include <stdbool.h>
 #include <stdint.h>
 
@@ -110,6 +112,8 @@ struct qmi_param;
 struct qmi_param *qmi_param_new(void);
 void qmi_param_free(struct qmi_param *param);
 
+DEFINE_CLEANUP_FUNC(qmi_param_free)
+
 bool qmi_param_append(struct qmi_param *param, uint8_t type,
 					uint16_t length, const void *data);
 bool qmi_param_append_uint8(struct qmi_param *param, uint8_t type,
@@ -146,6 +150,8 @@ int qmi_error_to_ofono_cme(int qmi_error);
 struct qmi_service *qmi_service_clone(struct qmi_service *service);
 void qmi_service_free(struct qmi_service *service);
 
+DEFINE_CLEANUP_FUNC(qmi_service_free)
+
 const char *qmi_service_get_identifier(struct qmi_service *service);
 bool qmi_service_get_version(struct qmi_service *service, uint8_t *out_version);
 
-- 
2.45.2


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH v2 07/11] qmi: gprs-context: Declare qmi_service objects using _auto_
  2024-07-11 16:46 [PATCH v2 01/11] udevng: Remove gps from setup_gobi Denis Kenzior
                   ` (4 preceding siblings ...)
  2024-07-11 16:46 ` [PATCH v2 06/11] qmi: Enable _auto_ use for some classes Denis Kenzior
@ 2024-07-11 16:46 ` Denis Kenzior
  2024-07-11 16:46 ` [PATCH v2 08/11] qmi: Pass two dedicated WDS services to gprs-context Denis Kenzior
                   ` (4 subsequent siblings)
  10 siblings, 0 replies; 13+ messages in thread
From: Denis Kenzior @ 2024-07-11 16:46 UTC (permalink / raw)
  To: ofono; +Cc: Denis Kenzior

This simplifies the error paths slightly.
---
 drivers/qmimodem/gprs-context.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/drivers/qmimodem/gprs-context.c b/drivers/qmimodem/gprs-context.c
index 3c18476142ea..7d13889bf603 100644
--- a/drivers/qmimodem/gprs-context.c
+++ b/drivers/qmimodem/gprs-context.c
@@ -554,7 +554,8 @@ static int qmi_gprs_context_probev(struct ofono_gprs_context *gc,
 					unsigned int vendor, va_list args)
 {
 	int mux_id = va_arg(args, int);
-	struct qmi_service *wds = va_arg(args, struct qmi_service *);
+	_auto_(qmi_service_free) struct qmi_service *wds =
+					va_arg(args, struct qmi_service *);
 	struct gprs_context_data *data;
 
 	DBG("");
@@ -562,14 +563,12 @@ static int qmi_gprs_context_probev(struct ofono_gprs_context *gc,
 	if (mux_id != -1) {
 		int r = qmi_gprs_context_bind_mux(gc, wds, mux_id);
 
-		if (r < 0) {
-			qmi_service_free(wds);
+		if (r < 0)
 			return r;
-		}
 	}
 
 	data = l_new(struct gprs_context_data, 1);
-	data->wds = wds;
+	data->wds = l_steal_ptr(wds);
 	data->mux_id = mux_id;
 
 	qmi_service_register(data->wds, QMI_WDS_PACKET_SERVICE_STATUS,
-- 
2.45.2


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH v2 08/11] qmi: Pass two dedicated WDS services to gprs-context
  2024-07-11 16:46 [PATCH v2 01/11] udevng: Remove gps from setup_gobi Denis Kenzior
                   ` (5 preceding siblings ...)
  2024-07-11 16:46 ` [PATCH v2 07/11] qmi: gprs-context: Declare qmi_service objects using _auto_ Denis Kenzior
@ 2024-07-11 16:46 ` Denis Kenzior
  2024-07-11 16:46 ` [PATCH v2 09/11] qmi: gprs-context: Remove parsing of unused TLVs Denis Kenzior
                   ` (3 subsequent siblings)
  10 siblings, 0 replies; 13+ messages in thread
From: Denis Kenzior @ 2024-07-11 16:46 UTC (permalink / raw)
  To: ofono; +Cc: Denis Kenzior

gprs-context driver will not take two qmi_service objects, each with a
dedicated WDS service.  This will allow gprs-context to support dual
stack (ipv4 + ipv6) contexts (in future commits).  For now, the behavior
is left unchanged with the second qmi_service being destroyed.
---
 drivers/qmimodem/gprs-context.c |  8 +++++---
 plugins/gobi.c                  | 11 +++++++++--
 plugins/qrtrqmi.c               |  7 +++++--
 3 files changed, 19 insertions(+), 7 deletions(-)

diff --git a/drivers/qmimodem/gprs-context.c b/drivers/qmimodem/gprs-context.c
index 7d13889bf603..5582a8052c0b 100644
--- a/drivers/qmimodem/gprs-context.c
+++ b/drivers/qmimodem/gprs-context.c
@@ -554,21 +554,23 @@ static int qmi_gprs_context_probev(struct ofono_gprs_context *gc,
 					unsigned int vendor, va_list args)
 {
 	int mux_id = va_arg(args, int);
-	_auto_(qmi_service_free) struct qmi_service *wds =
+	_auto_(qmi_service_free) struct qmi_service *ipv4 =
+					va_arg(args, struct qmi_service *);
+	_auto_(qmi_service_free) struct qmi_service *ipv6 =
 					va_arg(args, struct qmi_service *);
 	struct gprs_context_data *data;
 
 	DBG("");
 
 	if (mux_id != -1) {
-		int r = qmi_gprs_context_bind_mux(gc, wds, mux_id);
+		int r = qmi_gprs_context_bind_mux(gc, ipv4, mux_id);
 
 		if (r < 0)
 			return r;
 	}
 
 	data = l_new(struct gprs_context_data, 1);
-	data->wds = l_steal_ptr(wds);
+	data->wds = l_steal_ptr(ipv4);
 	data->mux_id = mux_id;
 
 	qmi_service_register(data->wds, QMI_WDS_PACKET_SERVICE_STATUS,
diff --git a/plugins/gobi.c b/plugins/gobi.c
index 76e1e133860d..cb20824cc424 100644
--- a/plugins/gobi.c
+++ b/plugins/gobi.c
@@ -803,10 +803,14 @@ static void gobi_setup_gprs(struct ofono_modem *modem)
 
 	/* Simple case of 802.3 interface, no QMAP */
 	if (data->n_premux == 0) {
+		struct qmi_service *ipv4 = data->context_services[0].wds_ipv4;
+		struct qmi_service *ipv6 = data->context_services[0].wds_ipv6;
+
 		interface = ofono_modem_get_string(modem, "NetworkInterface");
 
 		gc = ofono_gprs_context_create(modem, 0, "qmimodem", -1,
-						qmi_service_clone(data->wds));
+						qmi_service_clone(ipv4),
+						qmi_service_clone(ipv6));
 		if (!gc) {
 			ofono_warn("Unable to create gprs-context for: %s",
 					ofono_modem_get_path(modem));
@@ -826,13 +830,16 @@ static void gobi_setup_gprs(struct ofono_modem *modem)
 	DBG("max_aggregation_size: %u", data->max_aggregation_size);
 
 	for (i = 0; i < data->n_premux; i++) {
+		struct qmi_service *ipv4 = data->context_services[i].wds_ipv4;
+		struct qmi_service *ipv6 = data->context_services[i].wds_ipv6;
 		int mux_id;
 
 		sprintf(buf, "PremuxInterface%dMuxId", i + 1);
 		mux_id = ofono_modem_get_integer(modem, buf);
 
 		gc = ofono_gprs_context_create(modem, 0, "qmimodem", mux_id,
-						qmi_service_clone(data->wds));
+						qmi_service_clone(ipv4),
+						qmi_service_clone(ipv6));
 
 		if (!gc) {
 			ofono_warn("gprs-context creation failed for [%d] %s",
diff --git a/plugins/qrtrqmi.c b/plugins/qrtrqmi.c
index b64ab355a2e8..21103371046a 100644
--- a/plugins/qrtrqmi.c
+++ b/plugins/qrtrqmi.c
@@ -324,10 +324,13 @@ static int setup_gprs_context(uint8_t mux_id, const char *interface,
 	struct ofono_modem *modem = ofono_gprs_get_modem(gprs);
 	struct qrtrqmi_data *data = ofono_modem_get_data(modem);
 	struct qmi_qrtr_node *node = data->node;
+	struct qmi_service *ipv4 = qmi_qrtr_node_get_dedicated_service(node,
+								QMI_SERVICE_WDS);
+	struct qmi_service *ipv6 = qmi_qrtr_node_get_dedicated_service(node,
+								QMI_SERVICE_WDS);
 	struct ofono_gprs_context *gc;
 
-	gc = ofono_gprs_context_create(modem, 0, "qmimodem", mux_id,
-			qmi_qrtr_node_get_service(node, QMI_SERVICE_WDS));
+	gc = ofono_gprs_context_create(modem, 0, "qmimodem", mux_id, ipv4, ipv6);
 	if (!gc) {
 		ofono_warn("Unable to create gprs-context for: %s, %s[%u]",
 				ofono_modem_get_path(modem), interface, mux_id);
-- 
2.45.2


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH v2 09/11] qmi: gprs-context: Remove parsing of unused TLVs
  2024-07-11 16:46 [PATCH v2 01/11] udevng: Remove gps from setup_gobi Denis Kenzior
                   ` (6 preceding siblings ...)
  2024-07-11 16:46 ` [PATCH v2 08/11] qmi: Pass two dedicated WDS services to gprs-context Denis Kenzior
@ 2024-07-11 16:46 ` Denis Kenzior
  2024-07-11 16:46 ` [PATCH v2 10/11] qmi: gprs-context: Treat IP family TLV as mandatory Denis Kenzior
                   ` (2 subsequent siblings)
  10 siblings, 0 replies; 13+ messages in thread
From: Denis Kenzior @ 2024-07-11 16:46 UTC (permalink / raw)
  To: ofono; +Cc: Denis Kenzior

The information from these TLVs is currently unused and only printed to
debug output.  Same can be accomplished using an external sniffer.
Remove this code until the information in these TLVs is needed for
something.
---
 drivers/qmimodem/gprs-context.c | 14 +-------------
 1 file changed, 1 insertion(+), 13 deletions(-)

diff --git a/drivers/qmimodem/gprs-context.c b/drivers/qmimodem/gprs-context.c
index 5582a8052c0b..f29f10720710 100644
--- a/drivers/qmimodem/gprs-context.c
+++ b/drivers/qmimodem/gprs-context.c
@@ -173,29 +173,17 @@ static void get_settings_ipv4(struct ofono_gprs_context *gc,
 
 static void get_settings_cb(struct qmi_result *result, void *user_data)
 {
-	static const uint8_t RESULT_PDP_TYPE = 0x11;	/* uint8 */
-	static const uint8_t RESULT_APN = 0x14;		/* string */
 	static const uint8_t RESULT_IP_FAMILY = 0x2b;	/* uint8 */
 	struct cb_data *cbd = user_data;
 	ofono_gprs_context_cb_t cb = cbd->cb;
 	struct ofono_gprs_context *gc = cbd->user;
-	uint8_t pdp_type, ip_family;
-	char *apn;
+	uint8_t ip_family;
 
 	DBG("");
 
 	if (qmi_result_set_error(result, NULL))
 		goto done;
 
-	apn = qmi_result_get_string(result, RESULT_APN);
-	if (apn) {
-		DBG("APN: %s", apn);
-		l_free(apn);
-	}
-
-	if (qmi_result_get_uint8(result, RESULT_PDP_TYPE, &pdp_type))
-		DBG("PDP type %d", pdp_type);
-
 	if (!qmi_result_get_uint8(result, RESULT_IP_FAMILY, &ip_family)) {
 		ofono_error("No IP family in results");
 		goto done;
-- 
2.45.2


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH v2 10/11] qmi: gprs-context: Treat IP family TLV as mandatory
  2024-07-11 16:46 [PATCH v2 01/11] udevng: Remove gps from setup_gobi Denis Kenzior
                   ` (7 preceding siblings ...)
  2024-07-11 16:46 ` [PATCH v2 09/11] qmi: gprs-context: Remove parsing of unused TLVs Denis Kenzior
@ 2024-07-11 16:46 ` Denis Kenzior
  2024-07-11 16:46 ` [PATCH v2 11/11] qmi: gprs-context: Set up WDS service for IPv6 Denis Kenzior
  2024-07-11 17:53 ` [PATCH v2 01/11] udevng: Remove gps from setup_gobi patchwork-bot+ofono
  10 siblings, 0 replies; 13+ messages in thread
From: Denis Kenzior @ 2024-07-11 16:46 UTC (permalink / raw)
  To: ofono; +Cc: Denis Kenzior

Also, while here, coalesce two debugging statements into one.
---
 drivers/qmimodem/gprs-context.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/qmimodem/gprs-context.c b/drivers/qmimodem/gprs-context.c
index f29f10720710..203a320a42af 100644
--- a/drivers/qmimodem/gprs-context.c
+++ b/drivers/qmimodem/gprs-context.c
@@ -46,10 +46,10 @@ static void pkt_status_notify(struct qmi_result *result, void *user_data)
 	if (!status)
 		return;
 
-	DBG("conn status %d", status->status);
+	if (!qmi_result_get_uint8(result, RESULT_IP_FAMILY, &ip_family))
+		return;
 
-	if (qmi_result_get_uint8(result, RESULT_IP_FAMILY, &ip_family))
-		DBG("ip family %d", ip_family);
+	DBG("conn status %d ip family %d", status->status, ip_family);
 
 	switch (status->status) {
 	case QMI_WDS_CONNECTION_STATUS_DISCONNECTED:
-- 
2.45.2


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH v2 11/11] qmi: gprs-context: Set up WDS service for IPv6
  2024-07-11 16:46 [PATCH v2 01/11] udevng: Remove gps from setup_gobi Denis Kenzior
                   ` (8 preceding siblings ...)
  2024-07-11 16:46 ` [PATCH v2 10/11] qmi: gprs-context: Treat IP family TLV as mandatory Denis Kenzior
@ 2024-07-11 16:46 ` Denis Kenzior
  2024-07-11 17:53 ` [PATCH v2 01/11] udevng: Remove gps from setup_gobi patchwork-bot+ofono
  10 siblings, 0 replies; 13+ messages in thread
From: Denis Kenzior @ 2024-07-11 16:46 UTC (permalink / raw)
  To: ofono; +Cc: Denis Kenzior

Track and take ownership of the passed in WDS service meant for IPv6
connectivity.  The WDS service should be bound to a particular
endpoint / mux_id and register to the same indication types as the
other WDS service being utilized.

Additionally, WDS services are created with IPv4 as the default family
preference.  To support dual-stack bearers, the WDS service managing
IPv6 requires 'Set IP Family Preference' command to be issued with the
IPv6 family preference set.
---
 drivers/qmimodem/gprs-context.c | 51 ++++++++++++++++++++++++++++++++-
 1 file changed, 50 insertions(+), 1 deletion(-)

diff --git a/drivers/qmimodem/gprs-context.c b/drivers/qmimodem/gprs-context.c
index 203a320a42af..456f46ead6d5 100644
--- a/drivers/qmimodem/gprs-context.c
+++ b/drivers/qmimodem/gprs-context.c
@@ -22,6 +22,7 @@
 
 struct gprs_context_data {
 	struct qmi_service *wds;
+	struct qmi_service *ipv6;
 	unsigned int active_context;
 	uint32_t pkt_handle;
 	uint8_t mux_id;
@@ -454,6 +455,37 @@ static void qmi_gprs_context_detach_shutdown(struct ofono_gprs_context *gc,
 	qmi_deactivate_primary(gc, cid, NULL, NULL);
 }
 
+static void set_ip_family_preference_cb(struct qmi_result *result,
+							void *user_data)
+{
+	struct ofono_gprs_context *gc = user_data;
+	uint16_t error;
+
+	if (!qmi_result_set_error(result, &error))
+		error = 0;
+
+	DBG("%u", error);
+
+	if (error)
+		ofono_gprs_context_remove(gc);
+}
+
+static int set_ip_family_preference(struct ofono_gprs_context *gc,
+						struct qmi_service *wds,
+						uint8_t family)
+{
+	static const uint8_t PARAM_IP_FAMILY_PREFERENCE = 0x01;
+	struct qmi_param *param =
+			qmi_param_new_uint8(PARAM_IP_FAMILY_PREFERENCE, family);
+
+	if (qmi_service_send(wds, QMI_WDS_SET_IP_FAMILY, param,
+				set_ip_family_preference_cb, gc, NULL) > 0)
+		return 0;
+
+	qmi_param_free(param);
+	return -EIO;
+}
+
 static void bind_mux_data_port_cb(struct qmi_result *result, void *user_data)
 {
 	struct ofono_gprs_context *gc = user_data;
@@ -547,22 +579,38 @@ static int qmi_gprs_context_probev(struct ofono_gprs_context *gc,
 	_auto_(qmi_service_free) struct qmi_service *ipv6 =
 					va_arg(args, struct qmi_service *);
 	struct gprs_context_data *data;
+	int r;
 
 	DBG("");
 
 	if (mux_id != -1) {
-		int r = qmi_gprs_context_bind_mux(gc, ipv4, mux_id);
+		r = qmi_gprs_context_bind_mux(gc, ipv4, mux_id);
+		if (r < 0)
+			return r;
 
+		r = qmi_gprs_context_bind_mux(gc, ipv6, mux_id);
 		if (r < 0)
 			return r;
 	}
 
+	/*
+	 * Default family preference for new WDS services is IPv4.  For the
+	 * service used for IPv6 contexts, issue a SET_IP_FAMILY_PREFERENCE
+	 * command
+	 */
+	r = set_ip_family_preference(gc, ipv6, QMI_WDS_IP_FAMILY_IPV6);
+	if (r < 0)
+		return r;
+
 	data = l_new(struct gprs_context_data, 1);
 	data->wds = l_steal_ptr(ipv4);
+	data->ipv6 = l_steal_ptr(ipv6);
 	data->mux_id = mux_id;
 
 	qmi_service_register(data->wds, QMI_WDS_PACKET_SERVICE_STATUS,
 					pkt_status_notify, gc, NULL);
+	qmi_service_register(data->ipv6, QMI_WDS_PACKET_SERVICE_STATUS,
+					pkt_status_notify, gc, NULL);
 
 	ofono_gprs_context_set_data(gc, data);
 
@@ -578,6 +626,7 @@ static void qmi_gprs_context_remove(struct ofono_gprs_context *gc)
 	ofono_gprs_context_set_data(gc, NULL);
 
 	qmi_service_free(data->wds);
+	qmi_service_free(data->ipv6);
 	l_free(data);
 }
 
-- 
2.45.2


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* Re: [PATCH v2 04/11] gobi: Limit number of premultiplexed contexts to 4
  2024-07-11 16:46 ` [PATCH v2 04/11] gobi: Limit number of premultiplexed contexts to 4 Denis Kenzior
@ 2024-07-11 16:50   ` Denis Kenzior
  0 siblings, 0 replies; 13+ messages in thread
From: Denis Kenzior @ 2024-07-11 16:50 UTC (permalink / raw)
  To: ofono

On 7/11/24 11:46 AM, Denis Kenzior wrote:
> 4 was chosen somewhat arbitrarily, but it is the maximum that the
> qmi_wwan_q driver can support out of the box.  The only limit is the
> number of clients under QMI.  Two WDS clients are typically required for
> each active context, one for IPv4 and one for IPv6.  The total number of
> clients cannot exceed 255 (uint8).
> ---
>   plugins/gobi.c | 19 +++++++++++++++----
>   1 file changed, 15 insertions(+), 4 deletions(-)
> 

This set should be ignored.  Sorry for the noise.


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v2 01/11] udevng: Remove gps from setup_gobi
  2024-07-11 16:46 [PATCH v2 01/11] udevng: Remove gps from setup_gobi Denis Kenzior
                   ` (9 preceding siblings ...)
  2024-07-11 16:46 ` [PATCH v2 11/11] qmi: gprs-context: Set up WDS service for IPv6 Denis Kenzior
@ 2024-07-11 17:53 ` patchwork-bot+ofono
  10 siblings, 0 replies; 13+ messages in thread
From: patchwork-bot+ofono @ 2024-07-11 17:53 UTC (permalink / raw)
  To: Denis Kenzior; +Cc: ofono, steve.schrock

Hello:

This series was applied to ofono.git (master)
by Denis Kenzior <denkenz@gmail.com>:

On Thu, 11 Jul 2024 11:46:18 -0500 you wrote:
> From: Steve Schrock <steve.schrock@getcruise.com>
> 
> Even when the gps variable was set, it was not actually used for
> anything.
> ---
>  plugins/udevng.c | 14 +-------------
>  1 file changed, 1 insertion(+), 13 deletions(-)

Here is the summary with links:
  - [v2,01/11] udevng: Remove gps from setup_gobi
    (no matching commit)
  - [v2,02/11] build: Require at least version 0.67 when building with external ELL
    (no matching commit)
  - [v2,03/11] Release 2.9
    (no matching commit)
  - [v2,04/11] gobi: Limit number of premultiplexed contexts to 4
    (no matching commit)
  - [v2,05/11] gobi: Request dedicated WDS services for contexts
    (no matching commit)
  - [v2,06/11] qmi: Enable _auto_ use for some classes
    (no matching commit)
  - [v2,07/11] qmi: gprs-context: Declare qmi_service objects using _auto_
    (no matching commit)
  - [v2,08/11] qmi: Pass two dedicated WDS services to gprs-context
    (no matching commit)
  - [v2,09/11] qmi: gprs-context: Remove parsing of unused TLVs
    (no matching commit)
  - [v2,10/11] qmi: gprs-context: Treat IP family TLV as mandatory
    (no matching commit)
  - [v2,11/11] qmi: gprs-context: Set up WDS service for IPv6
    https://git.kernel.org/pub/scm/network/ofono/ofono.git/?id=c09e6bebe703

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2024-07-11 17:53 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-07-11 16:46 [PATCH v2 01/11] udevng: Remove gps from setup_gobi Denis Kenzior
2024-07-11 16:46 ` [PATCH v2 02/11] build: Require at least version 0.67 when building with external ELL Denis Kenzior
2024-07-11 16:46 ` [PATCH v2 03/11] Release 2.9 Denis Kenzior
2024-07-11 16:46 ` [PATCH v2 04/11] gobi: Limit number of premultiplexed contexts to 4 Denis Kenzior
2024-07-11 16:50   ` Denis Kenzior
2024-07-11 16:46 ` [PATCH v2 05/11] gobi: Request dedicated WDS services for contexts Denis Kenzior
2024-07-11 16:46 ` [PATCH v2 06/11] qmi: Enable _auto_ use for some classes Denis Kenzior
2024-07-11 16:46 ` [PATCH v2 07/11] qmi: gprs-context: Declare qmi_service objects using _auto_ Denis Kenzior
2024-07-11 16:46 ` [PATCH v2 08/11] qmi: Pass two dedicated WDS services to gprs-context Denis Kenzior
2024-07-11 16:46 ` [PATCH v2 09/11] qmi: gprs-context: Remove parsing of unused TLVs Denis Kenzior
2024-07-11 16:46 ` [PATCH v2 10/11] qmi: gprs-context: Treat IP family TLV as mandatory Denis Kenzior
2024-07-11 16:46 ` [PATCH v2 11/11] qmi: gprs-context: Set up WDS service for IPv6 Denis Kenzior
2024-07-11 17:53 ` [PATCH v2 01/11] udevng: Remove gps from setup_gobi patchwork-bot+ofono

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.