From: Denis Kenzior <denkenz@gmail.com>
To: ofono@lists.linux.dev
Cc: Denis Kenzior <denkenz@gmail.com>
Subject: [PATCH v2 5/6] qmi: wds: add utility to parse Data System Status tlv
Date: Wed, 1 May 2024 18:21:32 -0500 [thread overview]
Message-ID: <20240501232144.14025-5-denkenz@gmail.com> (raw)
In-Reply-To: <20240501232144.14025-1-denkenz@gmail.com>
---
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
next prev parent reply other threads:[~2024-05-01 23:21 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
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 ` Denis Kenzior [this message]
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
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=20240501232144.14025-5-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