diff mbox series

[09/10] qmimodem: wds: Add qmi_wds_ip_support_from_ofono

Message ID 20241121152949.56962-9-denkenz@gmail.com (mailing list archive)
State Under Review
Headers show
Series [01/10] qmi: wda: Add qmi_wda_set_data_format utility | expand

Commit Message

Denis Kenzior Nov. 21, 2024, 3:29 p.m. UTC
This is used to convert from ofono context type enumeration to
QMI IP support enumeration reported by Get LTE Attach Parameters.
---
 drivers/qmimodem/wds.c | 14 ++++++++++++++
 drivers/qmimodem/wds.h |  1 +
 2 files changed, 15 insertions(+)
diff mbox series

Patch

diff --git a/drivers/qmimodem/wds.c b/drivers/qmimodem/wds.c
index ced0c5e5308d..07c96d4fdc58 100644
--- a/drivers/qmimodem/wds.c
+++ b/drivers/qmimodem/wds.c
@@ -43,6 +43,20 @@  int qmi_wds_pdp_type_from_ofono(enum ofono_gprs_proto proto)
 	return -ENOENT;
 }
 
+int qmi_wds_ip_support_from_ofono(enum ofono_gprs_proto proto)
+{
+	switch (proto) {
+	case OFONO_GPRS_PROTO_IP:
+		return QMI_WDS_IP_SUPPORT_IPV4;
+	case OFONO_GPRS_PROTO_IPV6:
+		return QMI_WDS_IP_SUPPORT_IPV6;
+	case OFONO_GPRS_PROTO_IPV4V6:
+		return QMI_WDS_IP_SUPPORT_IPV4V6;
+	}
+
+	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);
diff --git a/drivers/qmimodem/wds.h b/drivers/qmimodem/wds.h
index 64a18aa6d86e..9343d1f83665 100644
--- a/drivers/qmimodem/wds.h
+++ b/drivers/qmimodem/wds.h
@@ -155,6 +155,7 @@  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_ip_support_from_ofono(enum ofono_gprs_proto proto);
 
 int qmi_wds_parse_data_system_status(const void *dss, uint16_t len);
 int qmi_wds_parse_extended_data_bearer_technology(const void *edbt,