Open Source Telephony
 help / color / mirror / Atom feed
* [PATCH v2 1/6] qmi: gprs: register to NAS indications earlier
@ 2024-05-01 23:21 Denis Kenzior
  2024-05-01 23:21 ` [PATCH v2 2/6] qmi: gprs: Split out GET_DEFAULT_PROFILE_NUMBER request Denis Kenzior
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: Denis Kenzior @ 2024-05-01 23:21 UTC (permalink / raw)
  To: ofono; +Cc: Denis Kenzior

We can register to NAS indications much earlier, as soon as the NAS
service handle is created.  Since the handle is now a 'lightweight'
handle, all service registrations are automatically unregistered when
the handle is destroyed.  There's no need to track the registered
indication id and to remove it separately.
---
 drivers/qmimodem/gprs.c | 14 ++------------
 1 file changed, 2 insertions(+), 12 deletions(-)

diff --git a/drivers/qmimodem/gprs.c b/drivers/qmimodem/gprs.c
index 738271905848..bca1897ea02f 100644
--- a/drivers/qmimodem/gprs.c
+++ b/drivers/qmimodem/gprs.c
@@ -39,7 +39,6 @@ struct gprs_data {
 	struct qmi_service *nas;
 	struct qmi_service *wds;
 	unsigned int default_profile;
-	uint16_t serving_system_indication_id;
 };
 
 static bool extract_ss_info(struct qmi_result *result, int *status, int *tech)
@@ -306,10 +305,6 @@ static void get_default_profile_cb(struct qmi_result *result, void *user_data)
 	 */
 	qmi_service_send(data->nas, QMI_NAS_GET_SERVING_SYSTEM, NULL,
 					ss_info_notify, gprs, NULL);
-	data->serving_system_indication_id =
-		qmi_service_register(data->nas,
-					QMI_NAS_SERVING_SYSTEM_INDICATION,
-					ss_info_notify, gprs, NULL);
 
 	ofono_gprs_register(gprs);
 	return;
@@ -369,6 +364,8 @@ static void create_nas_cb(struct qmi_service *service, void *user_data)
 	}
 
 	data->nas = service;
+	qmi_service_register(data->nas, QMI_NAS_SERVING_SYSTEM_INDICATION,
+					ss_info_notify, gprs, NULL);
 
 	qmi_service_create_shared(data->dev, QMI_SERVICE_WDS,
 						create_wds_cb, gprs, NULL);
@@ -403,13 +400,6 @@ static void qmi_gprs_remove(struct ofono_gprs *gprs)
 	ofono_gprs_set_data(gprs, NULL);
 
 	qmi_service_free(data->wds);
-
-	if (data->serving_system_indication_id) {
-		qmi_service_unregister(data->nas,
-					data->serving_system_indication_id);
-		data->serving_system_indication_id = 0;
-	}
-
 	qmi_service_free(data->nas);
 
 	l_free(data);
-- 
2.44.0


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

* [PATCH v2 2/6] qmi: gprs: Split out GET_DEFAULT_PROFILE_NUMBER request
  2024-05-01 23:21 [PATCH v2 1/6] qmi: gprs: register to NAS indications earlier Denis Kenzior
@ 2024-05-01 23:21 ` Denis Kenzior
  2024-05-01 23:21 ` [PATCH v2 3/6] qmi: gprs: register and listen to event reports Denis Kenzior
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Denis Kenzior @ 2024-05-01 23:21 UTC (permalink / raw)
  To: ofono; +Cc: Denis Kenzior

This will allow request to be re-arranged into a new sequence
easier in the future.
---
 drivers/qmimodem/gprs.c | 42 +++++++++++++++++++++++++----------------
 1 file changed, 26 insertions(+), 16 deletions(-)

diff --git a/drivers/qmimodem/gprs.c b/drivers/qmimodem/gprs.c
index bca1897ea02f..dbd461731d94 100644
--- a/drivers/qmimodem/gprs.c
+++ b/drivers/qmimodem/gprs.c
@@ -101,7 +101,7 @@ static void get_lte_attach_param_cb(struct qmi_result *result, void *user_data)
 	DBG("");
 
 	if (qmi_result_set_error(result, &error)) {
-		ofono_error("Failed to query LTE attach params: %hd", error);
+		ofono_error("get_lte_attach_param_cb: %hd", error);
 		goto noapn;
 	}
 
@@ -275,7 +275,8 @@ static void qmi_attached_status(struct ofono_gprs *gprs,
 	l_free(cbd);
 }
 
-static void get_default_profile_cb(struct qmi_result *result, void *user_data)
+static void get_default_profile_number_cb(struct qmi_result *result,
+								void *user_data)
 {
 	static const uint8_t RESULT_DEFAULT_PROFILE_NUMBER = 0x1;
 	struct ofono_gprs *gprs = user_data;
@@ -312,9 +313,8 @@ error:
 	ofono_gprs_remove(gprs);
 }
 
-static void create_wds_cb(struct qmi_service *service, void *user_data)
+static int get_default_profile_number_request(struct ofono_gprs *gprs)
 {
-	struct ofono_gprs *gprs = user_data;
 	struct gprs_data *data = ofono_gprs_get_data(gprs);
 	struct {
 		uint8_t type;
@@ -323,7 +323,27 @@ static void create_wds_cb(struct qmi_service *service, void *user_data)
 		.type = QMI_WDS_PROFILE_TYPE_3GPP,
 		.family = QMI_WDS_PROFILE_FAMILY_EMBEDDED,
 	};
-	struct qmi_param *param;
+	struct qmi_param *param = qmi_param_new();
+
+	/*
+	 * Query the default profile.  We never change the default profile
+	 * number, so querying it once should be sufficient
+	 */
+	qmi_param_append(param, QMI_WDS_PARAM_PROFILE_TYPE, sizeof(p), &p);
+
+	if (qmi_service_send(data->wds, QMI_WDS_GET_DEFAULT_PROFILE_NUMBER,
+				param, get_default_profile_number_cb,
+				gprs, NULL) > 0)
+		return 0;
+
+	qmi_param_free(param);
+	return -EIO;
+}
+
+static void create_wds_cb(struct qmi_service *service, void *user_data)
+{
+	struct ofono_gprs *gprs = user_data;
+	struct gprs_data *data = ofono_gprs_get_data(gprs);
 
 	DBG("");
 
@@ -334,18 +354,8 @@ static void create_wds_cb(struct qmi_service *service, void *user_data)
 
 	data->wds = service;
 
-	/*
-	 * Query the default profile.  We never change the default profile
-	 * number, so querying it once should be sufficient
-	 */
-	param = qmi_param_new();
-	qmi_param_append(param, QMI_WDS_PARAM_PROFILE_TYPE, sizeof(p), &p);
-
-	if (qmi_service_send(data->wds, QMI_WDS_GET_DEFAULT_PROFILE_NUMBER,
-				param, get_default_profile_cb, gprs, NULL) > 0)
+	if (get_default_profile_number_request(gprs) >= 0)
 		return;
-
-	qmi_param_free(param);
 error:
 	ofono_gprs_remove(gprs);
 }
-- 
2.44.0


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

* [PATCH v2 3/6] qmi: gprs: register and listen to event reports
  2024-05-01 23:21 [PATCH v2 1/6] qmi: gprs: register to NAS indications earlier Denis Kenzior
  2024-05-01 23:21 ` [PATCH v2 2/6] qmi: gprs: Split out GET_DEFAULT_PROFILE_NUMBER request Denis Kenzior
@ 2024-05-01 23:21 ` Denis Kenzior
  2024-05-01 23:21 ` [PATCH v2 4/6] qmi: gprs: Register for other notifications Denis Kenzior
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Denis Kenzior @ 2024-05-01 23:21 UTC (permalink / raw)
  To: ofono; +Cc: Denis Kenzior

This is mostly useful to obtain inter and intra RAT changes, data bearer
changes, data transfer statistics, etc.
---
 drivers/qmimodem/gprs.c | 88 ++++++++++++++++++++++++++++++++++++-----
 1 file changed, 79 insertions(+), 9 deletions(-)

diff --git a/drivers/qmimodem/gprs.c b/drivers/qmimodem/gprs.c
index dbd461731d94..ebbef4475120 100644
--- a/drivers/qmimodem/gprs.c
+++ b/drivers/qmimodem/gprs.c
@@ -184,6 +184,13 @@ static void ss_info_notify(struct qmi_result *result, void *user_data)
 		ofono_gprs_status_notify(gprs, status);
 }
 
+static void event_report_notify(struct qmi_result *result, void *user_data)
+{
+	DBG("");
+
+	qmi_result_print_tlvs(result);
+}
+
 static void attach_detach_cb(struct qmi_result *result, void *user_data)
 {
 	struct cb_data *cbd = user_data;
@@ -275,6 +282,74 @@ static void qmi_attached_status(struct ofono_gprs *gprs,
 	l_free(cbd);
 }
 
+static void set_event_report_cb(struct qmi_result *result, void *user_data)
+{
+	struct ofono_gprs *gprs = user_data;
+	struct gprs_data *data = ofono_gprs_get_data(gprs);
+	uint16_t error;
+
+	DBG("");
+
+	if (qmi_result_set_error(result, &error)) {
+		ofono_error("set_event_report_cb: %hd", error);
+		goto error;
+	}
+
+	/*
+	 * First get the SS info - the modem may already be connected,
+	 * and the state-change notification may never arrive
+	 */
+	qmi_service_send(data->nas, QMI_NAS_GET_SERVING_SYSTEM, NULL,
+					ss_info_notify, gprs, NULL);
+
+	ofono_gprs_register(gprs);
+	return;
+error:
+	ofono_gprs_remove(gprs);
+}
+
+static int set_event_report_request(struct ofono_gprs *gprs)
+{
+	static const uint8_t PARAM_CHANNEL_RATE = 0x10;
+	static const uint8_t PARAM_TRANSFER_STATISTICS = 0x11;
+	static const uint8_t PARAM_DATA_BEARER_TECHNOLOGY = 0x12;
+	static const uint8_t PARAM_DORMANCY_STATUS = 0x13;
+	static const uint8_t PARAM_CURRENT_DATA_BEARER_TECHNOLOGY = 0x15;
+	static const uint8_t PARAM_PREFERRED_DATA_SYSTEM = 0x18;
+	static const uint8_t PARAM_DATA_SYSTEM_STATUS = 0x1A;
+	static const uint8_t PARAM_LIMITED_DATA_SYSTEM_STATUS = 0x1C;
+	static const uint8_t PARAM_PDN_FILTER_REMOVALS = 0x1D;
+	static const uint8_t PARAM_DATA_BEARER_TECHNOLOGY_EXTENDED = 0x1E;
+
+	struct gprs_data *data = ofono_gprs_get_data(gprs);
+	struct {
+		uint8_t interval;
+		uint32_t indicators;
+	} __attribute((packed)) ts = {
+		.interval = 5,
+		.indicators = ~0, /* register for everything */
+	};
+	struct qmi_param *param = qmi_param_new();
+
+	qmi_param_append_uint8(param, PARAM_CHANNEL_RATE, 1);
+	qmi_param_append(param, PARAM_TRANSFER_STATISTICS, sizeof(ts), &ts);
+	qmi_param_append_uint8(param, PARAM_DATA_BEARER_TECHNOLOGY, 1);
+	qmi_param_append_uint8(param, PARAM_DORMANCY_STATUS, 1);
+	qmi_param_append_uint8(param, PARAM_CURRENT_DATA_BEARER_TECHNOLOGY, 1);
+	qmi_param_append_uint8(param, PARAM_PREFERRED_DATA_SYSTEM, 1);
+	qmi_param_append_uint8(param, PARAM_DATA_SYSTEM_STATUS, 1);
+	qmi_param_append_uint8(param, PARAM_LIMITED_DATA_SYSTEM_STATUS, 1);
+	qmi_param_append_uint8(param, PARAM_PDN_FILTER_REMOVALS, 1);
+	qmi_param_append_uint8(param, PARAM_DATA_BEARER_TECHNOLOGY_EXTENDED, 1);
+
+	if (qmi_service_send(data->wds, QMI_WDS_EVENT_REPORT,
+				param, set_event_report_cb, gprs, NULL) > 0)
+		return 0;
+
+	qmi_param_free(param);
+	return -EIO;
+}
+
 static void get_default_profile_number_cb(struct qmi_result *result,
 								void *user_data)
 {
@@ -300,15 +375,8 @@ static void get_default_profile_number_cb(struct qmi_result *result,
 	data->default_profile = index;
 	ofono_gprs_set_cid_range(gprs, index, index);
 
-	/*
-	 * First get the SS info - the modem may already be connected,
-	 * and the state-change notification may never arrive
-	 */
-	qmi_service_send(data->nas, QMI_NAS_GET_SERVING_SYSTEM, NULL,
-					ss_info_notify, gprs, NULL);
-
-	ofono_gprs_register(gprs);
-	return;
+	if (set_event_report_request(gprs) >= 0)
+		return;
 error:
 	ofono_gprs_remove(gprs);
 }
@@ -353,6 +421,8 @@ static void create_wds_cb(struct qmi_service *service, void *user_data)
 	}
 
 	data->wds = service;
+	qmi_service_register(data->wds, QMI_WDS_EVENT_REPORT,
+				event_report_notify, gprs, NULL);
 
 	if (get_default_profile_number_request(gprs) >= 0)
 		return;
-- 
2.44.0


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

* [PATCH v2 4/6] qmi: gprs: Register for other notifications
  2024-05-01 23:21 [PATCH v2 1/6] qmi: gprs: register to NAS indications earlier Denis Kenzior
  2024-05-01 23:21 ` [PATCH v2 2/6] qmi: gprs: Split out GET_DEFAULT_PROFILE_NUMBER request Denis Kenzior
  2024-05-01 23:21 ` [PATCH v2 3/6] qmi: gprs: register and listen to event reports Denis Kenzior
@ 2024-05-01 23:21 ` Denis Kenzior
  2024-05-01 23:21 ` [PATCH v2 5/6] qmi: wds: add utility to parse Data System Status tlv Denis Kenzior
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Denis Kenzior @ 2024-05-01 23:21 UTC (permalink / raw)
  To: ofono; +Cc: Denis Kenzior

Register for additional notifications via Indication Register command.
---
 drivers/qmimodem/gprs.c | 48 +++++++++++++++++++++++++++++++++++++++--
 1 file changed, 46 insertions(+), 2 deletions(-)

diff --git a/drivers/qmimodem/gprs.c b/drivers/qmimodem/gprs.c
index ebbef4475120..6bb5879199e6 100644
--- a/drivers/qmimodem/gprs.c
+++ b/drivers/qmimodem/gprs.c
@@ -191,6 +191,13 @@ static void event_report_notify(struct qmi_result *result, void *user_data)
 	qmi_result_print_tlvs(result);
 }
 
+static void profile_changed_notify(struct qmi_result *result, void *user_data)
+{
+	DBG("");
+
+	qmi_result_print_tlvs(result);
+}
+
 static void attach_detach_cb(struct qmi_result *result, void *user_data)
 {
 	struct cb_data *cbd = user_data;
@@ -282,7 +289,7 @@ static void qmi_attached_status(struct ofono_gprs *gprs,
 	l_free(cbd);
 }
 
-static void set_event_report_cb(struct qmi_result *result, void *user_data)
+static void indication_register_cb(struct qmi_result *result, void *user_data)
 {
 	struct ofono_gprs *gprs = user_data;
 	struct gprs_data *data = ofono_gprs_get_data(gprs);
@@ -291,7 +298,7 @@ static void set_event_report_cb(struct qmi_result *result, void *user_data)
 	DBG("");
 
 	if (qmi_result_set_error(result, &error)) {
-		ofono_error("set_event_report_cb: %hd", error);
+		ofono_error("indication_register_cb: %hd", error);
 		goto error;
 	}
 
@@ -308,6 +315,41 @@ error:
 	ofono_gprs_remove(gprs);
 }
 
+static int indication_register_request(struct ofono_gprs *gprs)
+{
+	static const uint8_t PARAM_PROFILE_CHANGES = 0x19;
+
+	struct gprs_data *data = ofono_gprs_get_data(gprs);
+	struct qmi_param *param = qmi_param_new();
+
+	qmi_param_append_uint8(param, PARAM_PROFILE_CHANGES, 1);
+
+	if (qmi_service_send(data->wds, QMI_WDS_INDICATION_REGISTER,
+				param, indication_register_cb, gprs, NULL) > 0)
+		return 0;
+
+	qmi_param_free(param);
+	return -EIO;
+}
+
+static void set_event_report_cb(struct qmi_result *result, void *user_data)
+{
+	struct ofono_gprs *gprs = user_data;
+	uint16_t error;
+
+	DBG("");
+
+	if (qmi_result_set_error(result, &error)) {
+		ofono_error("set_event_report_cb: %hd", error);
+		goto error;
+	}
+
+	if (indication_register_request(gprs) >= 0)
+		return;
+error:
+	ofono_gprs_remove(gprs);
+}
+
 static int set_event_report_request(struct ofono_gprs *gprs)
 {
 	static const uint8_t PARAM_CHANNEL_RATE = 0x10;
@@ -423,6 +465,8 @@ static void create_wds_cb(struct qmi_service *service, void *user_data)
 	data->wds = service;
 	qmi_service_register(data->wds, QMI_WDS_EVENT_REPORT,
 				event_report_notify, gprs, NULL);
+	qmi_service_register(data->wds, QMI_WDS_PROFILE_CHANGED,
+				profile_changed_notify, gprs, NULL);
 
 	if (get_default_profile_number_request(gprs) >= 0)
 		return;
-- 
2.44.0


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

* [PATCH v2 5/6] qmi: wds: add utility to parse Data System Status tlv
  2024-05-01 23:21 [PATCH v2 1/6] qmi: gprs: register to NAS indications earlier Denis Kenzior
                   ` (2 preceding siblings ...)
  2024-05-01 23:21 ` [PATCH v2 4/6] qmi: gprs: Register for other notifications Denis Kenzior
@ 2024-05-01 23:21 ` Denis Kenzior
  2024-05-01 23:21 ` [PATCH v2 6/6] qmi: gprs: Obtain LTE attach parameters after indication Denis Kenzior
  2024-05-02 13:50 ` [PATCH v2 1/6] qmi: gprs: register to NAS indications earlier patchwork-bot+ofono
  5 siblings, 0 replies; 7+ messages in thread
From: Denis Kenzior @ 2024-05-01 23:21 UTC (permalink / raw)
  To: ofono; +Cc: Denis Kenzior

---
 drivers/qmimodem/wds.c | 38 ++++++++++++++++++++++++++++++++++++++
 drivers/qmimodem/wds.h | 17 +++++++++++++++++
 2 files changed, 55 insertions(+)

diff --git a/drivers/qmimodem/wds.c b/drivers/qmimodem/wds.c
index d126f4712921..77e22f443db0 100644
--- a/drivers/qmimodem/wds.c
+++ b/drivers/qmimodem/wds.c
@@ -5,6 +5,11 @@
  * SPDX-License-Identifier: LGPL-2.1-or-later
  */
 
+#include <stdint.h>
+#include <stddef.h>
+
+#include <ell/ell.h>
+
 #include "src/common.h"
 
 #include "wds.h"
@@ -37,3 +42,36 @@ int qmi_wds_pdp_type_from_ofono(enum ofono_gprs_proto proto)
 
 	return -ENOENT;
 }
+
+int qmi_wds_parse_data_system_status(const void *dss, uint16_t len)
+{
+	const size_t network_info_size = sizeof(uint8_t) + 2 * sizeof(uint32_t);
+	uint8_t num_networks;
+	uint8_t network;
+	uint32_t rat_mask;
+
+	if (len < 2 * sizeof(uint8_t))
+		return -EBADMSG;
+
+	/* uint8_t preferred network type followed by number of network infos */
+	num_networks = l_get_u8(dss + 1);
+
+	len -= 2 * sizeof(uint8_t);
+	dss += 2 * sizeof(uint8_t);
+
+	if (len != num_networks * network_info_size)
+		return -EBADMSG;
+
+	while (len >= network_info_size) {
+		network = l_get_u8(dss);
+		rat_mask = l_get_le32(dss + 1);
+
+		if (network == QMI_WDS_PROFILE_TYPE_3GPP)
+			return rat_mask;
+
+		len -= network_info_size;
+		dss += network_info_size;
+	}
+
+	return -ENOENT;
+}
diff --git a/drivers/qmimodem/wds.h b/drivers/qmimodem/wds.h
index d896fd8cc535..94f1c028bd81 100644
--- a/drivers/qmimodem/wds.h
+++ b/drivers/qmimodem/wds.h
@@ -68,6 +68,21 @@ enum qmi_wds_profile_family {
 	QMI_WDS_PROFILE_FAMILY_TETHERED =	0x01,
 };
 
+enum qmi_wds_3gpp_rat {
+	QMI_WDS_3GPP_RAT_WCDMA			= 0x01,
+	QMI_WDS_RAT_3GPP_GPRS			= 0x02,
+	QMI_WDS_RAT_3GPP_HSDPA			= 0x04,
+	QMI_WDS_RAT_3GPP_HSUPA			= 0x08,
+	QMI_WDS_RAT_3GPP_EDGE			= 0x10,
+	QMI_WDS_RAT_3GPP_LTE			= 0x20,
+	QMI_WDS_RAT_3GPP_HSDPAPLUS		= 0x40,
+	QMI_WDS_RAT_3GPP_DCHSDPAPLUS		= 0x80,
+	QMI_WDS_RAT_3GPP_64QAM			= 0x100,
+	QMI_WDS_RAT_3GPP_TDSCDMA		= 0x200,
+	QMI_WDS_RAT_3GPP_5GNR			= 0x400,
+	QMI_WDS_RAT_3GPP_NULL_BEARER		= 0x8000,
+};
+
 enum qmi_wds_command {
 	QMI_WDS_RESET					= 0x00,
 	QMI_WDS_EVENT_REPORT				= 0x01,
@@ -111,3 +126,5 @@ enum qmi_wds_command {
 
 int qmi_wds_auth_from_ofono(enum ofono_gprs_auth_method method);
 int qmi_wds_pdp_type_from_ofono(enum ofono_gprs_proto proto);
+
+int qmi_wds_parse_data_system_status(const void *dss, uint16_t len);
-- 
2.44.0


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

* [PATCH v2 6/6] qmi: gprs: Obtain LTE attach parameters after indication
  2024-05-01 23:21 [PATCH v2 1/6] qmi: gprs: register to NAS indications earlier Denis Kenzior
                   ` (3 preceding siblings ...)
  2024-05-01 23:21 ` [PATCH v2 5/6] qmi: wds: add utility to parse Data System Status tlv Denis Kenzior
@ 2024-05-01 23:21 ` Denis Kenzior
  2024-05-02 13:50 ` [PATCH v2 1/6] qmi: gprs: register to NAS indications earlier patchwork-bot+ofono
  5 siblings, 0 replies; 7+ messages in thread
From: Denis Kenzior @ 2024-05-01 23:21 UTC (permalink / raw)
  To: ofono; +Cc: Denis Kenzior

It seems this TLV/Indication combination is needed in order for the
GET_LTE_ATTACH_PARAMETERS command to succeed:
ofonod[3257238]: Failed to query LTE attach params: 74
ofonod[3257238]: LTE bearer established but APN not set
---
 drivers/qmimodem/gprs.c | 36 +++++++++++++++++++++++-------------
 1 file changed, 23 insertions(+), 13 deletions(-)

diff --git a/drivers/qmimodem/gprs.c b/drivers/qmimodem/gprs.c
index 6bb5879199e6..ebb235545e21 100644
--- a/drivers/qmimodem/gprs.c
+++ b/drivers/qmimodem/gprs.c
@@ -151,19 +151,6 @@ static int handle_ss_info(struct qmi_result *result, struct ofono_gprs *gprs)
 	if (!extract_ss_info(result, &status, &tech))
 		return -1;
 
-	if (status == NETWORK_REGISTRATION_STATUS_REGISTERED) {
-		if (tech == ACCESS_TECHNOLOGY_EUTRAN) {
-			/* On LTE we are effectively always attached; and
-			 * the default bearer is established as soon as the
-			 * network is joined.  We just need to query the
-			 * parameters in effect on the default bearer and
-			 * let the ofono core know about the activated
-			 * context.
-			 */
-			get_lte_attach_params(gprs);
-		}
-	}
-
 	/* DC is optional so only notify on successful extraction */
 	if (extract_dc_info(result, &bearer_tech))
 		ofono_gprs_bearer_notify(gprs, bearer_tech);
@@ -186,8 +173,31 @@ static void ss_info_notify(struct qmi_result *result, void *user_data)
 
 static void event_report_notify(struct qmi_result *result, void *user_data)
 {
+	static const uint8_t RESULT_DATA_SYSTEM_STATUS = 0x24;
+	struct ofono_gprs *gprs = user_data;
+	const void *tlv;
+	uint16_t len;
+
 	DBG("");
 
+	/*
+	 * On LTE we are effectively always attached; and the default bearer is
+	 * established as soon as the network is joined.  We just need to query
+	 * the parameters in effect on the default bearer and let the ofono core
+	 * know about the activated context.
+	 */
+	tlv = qmi_result_get(result, RESULT_DATA_SYSTEM_STATUS, &len);
+	if (tlv) {
+		int r = qmi_wds_parse_data_system_status(tlv, len);
+		static const uint32_t lte_5g = QMI_WDS_RAT_3GPP_LTE |
+						QMI_WDS_RAT_3GPP_5GNR;
+
+		if (r >= 0 && (r & lte_5g))
+			get_lte_attach_params(gprs);
+
+		return;
+	}
+
 	qmi_result_print_tlvs(result);
 }
 
-- 
2.44.0


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

* Re: [PATCH v2 1/6] qmi: gprs: register to NAS indications earlier
  2024-05-01 23:21 [PATCH v2 1/6] qmi: gprs: register to NAS indications earlier Denis Kenzior
                   ` (4 preceding siblings ...)
  2024-05-01 23:21 ` [PATCH v2 6/6] qmi: gprs: Obtain LTE attach parameters after indication Denis Kenzior
@ 2024-05-02 13:50 ` patchwork-bot+ofono
  5 siblings, 0 replies; 7+ messages in thread
From: patchwork-bot+ofono @ 2024-05-02 13:50 UTC (permalink / raw)
  To: Denis Kenzior; +Cc: ofono

Hello:

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

On Wed,  1 May 2024 18:21:28 -0500 you wrote:
> We can register to NAS indications much earlier, as soon as the NAS
> service handle is created.  Since the handle is now a 'lightweight'
> handle, all service registrations are automatically unregistered when
> the handle is destroyed.  There's no need to track the registered
> indication id and to remove it separately.
> ---
>  drivers/qmimodem/gprs.c | 14 ++------------
>  1 file changed, 2 insertions(+), 12 deletions(-)

Here is the summary with links:
  - [v2,1/6] qmi: gprs: register to NAS indications earlier
    https://git.kernel.org/pub/scm/network/ofono/ofono.git/?id=d61fe2752b1f
  - [v2,2/6] qmi: gprs: Split out GET_DEFAULT_PROFILE_NUMBER request
    https://git.kernel.org/pub/scm/network/ofono/ofono.git/?id=5c6fc832ce25
  - [v2,3/6] qmi: gprs: register and listen to event reports
    https://git.kernel.org/pub/scm/network/ofono/ofono.git/?id=9a0deedcdefb
  - [v2,4/6] qmi: gprs: Register for other notifications
    https://git.kernel.org/pub/scm/network/ofono/ofono.git/?id=92a122de4a05
  - [v2,5/6] qmi: wds: add utility to parse Data System Status tlv
    https://git.kernel.org/pub/scm/network/ofono/ofono.git/?id=e075175baff2
  - [v2,6/6] qmi: gprs: Obtain LTE attach parameters after indication
    https://git.kernel.org/pub/scm/network/ofono/ofono.git/?id=c12a6251b1fb

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] 7+ messages in thread

end of thread, other threads:[~2024-05-02 13:50 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-05-01 23:21 [PATCH v2 1/6] qmi: gprs: register to NAS indications earlier Denis Kenzior
2024-05-01 23:21 ` [PATCH v2 2/6] qmi: gprs: Split out GET_DEFAULT_PROFILE_NUMBER request Denis Kenzior
2024-05-01 23:21 ` [PATCH v2 3/6] qmi: gprs: register and listen to event reports Denis Kenzior
2024-05-01 23:21 ` [PATCH v2 4/6] qmi: gprs: Register for other notifications Denis Kenzior
2024-05-01 23:21 ` [PATCH v2 5/6] qmi: wds: add utility to parse Data System Status tlv Denis Kenzior
2024-05-01 23:21 ` [PATCH v2 6/6] qmi: gprs: Obtain LTE attach parameters after indication Denis Kenzior
2024-05-02 13:50 ` [PATCH v2 1/6] qmi: gprs: register to NAS indications earlier patchwork-bot+ofono

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox