[PATCH 02/11] gobi: Request dedicated WDS services for contexts

Denis Kenzior <[email protected]>
Newsgroups dev.linux.lists.ofono
Message-ID <[email protected]>
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.