Skip to contentSkip to conversation

atmodem: fix to populate activated gprs context ip settings

PATCH In review Antara Borwankar 3 participants 3 messages Sep 26, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 atmodem: fix to populate activated gprs context ip settings

Function to get ipv4 and ipv6 settings for first default activated context in LTE was not getting called after pdp activation. Calling ofono_gprs_cid_activated function for last_auto_context_id.

---
 drivers/atmodem/gprs.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/atmodem/gprs.c +3 -1
index 16f4927..71a8631 100644
@@ -194,6 +194,7 @@ static void at_cgdcont_parse(struct ofono_gprs *gprs, GAtResult *result,
 				struct l_uintset *cids)
 {
 	GAtResultIter iter;
+	struct gprs_data *gd = ofono_gprs_get_data(gprs);
 
 	g_at_result_iter_init(&iter, result);
 
@@ -204,7 +205,8 @@ static void at_cgdcont_parse(struct ofono_gprs *gprs, GAtResult *result,
 		if (!g_at_result_iter_next_number(&iter, &read_cid))
 			break;
 
-		if (!l_uintset_contains(cids, read_cid))
+		if (!l_uintset_contains(cids, read_cid) &&
+			read_cid != gd->last_auto_context_id)
 			continue;
 
 		/* ignore protocol */
Signature · 1 line
1.9.1
#1 lore raw

Hi Dennis,

I am facing this issue because for xmm7mode we get default cid as 0. In at_cgdcont_read_cb when cids = l_uintset_new(activated_cid); is called It will create a set with size zero hence the check in at_cgdcont_parse is failing.

Do you think this fix is fine?
Should I put handling for cid 0 under vendor flag check.

Regards
Antara

-----Original Message-----
From: Borwankar, Antara
Sent: Thursday, September 26, 2019 4:53 PM
To: ofono(a)ofono.org
Cc: Borwankar, Antara <[email protected]>; denkenz(a)gmail.com
Subject: [PATCH] atmodem: fix to populate activated gprs context ip settings

Function to get ipv4 and ipv6 settings for first default activated context in LTE was not getting called after pdp activation. Calling ofono_gprs_cid_activated function for last_auto_context_id.

---
 drivers/atmodem/gprs.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/atmodem/gprs.c +3 -1
@@ -194,6 +194,7 @@ static void at_cgdcont_parse(struct ofono_gprs *gprs, GAtResult *result,
 				struct l_uintset *cids)
 {
 	GAtResultIter iter;
+	struct gprs_data *gd = ofono_gprs_get_data(gprs);
 
 	g_at_result_iter_init(&iter, result);
 
@@ -204,7 +205,8 @@ static void at_cgdcont_parse(struct ofono_gprs *gprs, GAtResult *result,
 		if (!g_at_result_iter_next_number(&iter, &read_cid))
 			break;
 
-		if (!l_uintset_contains(cids, read_cid))
+		if (!l_uintset_contains(cids, read_cid) &&
+			read_cid != gd->last_auto_context_id)
 			continue;
 
 		/* ignore protocol */

--
1.9.1

#2 lore raw

Hi Antara,

Quoted 5 lines · Antara

Hi Dennis,

I am facing this issue because for xmm7mode we get default cid as 0. In at_cgdcont_read_cb when cids = l_uintset_new(activated_cid); is called It will create a set with size zero hence the check in at_cgdcont_parse is failing.

Ah the infamous cid 0...

So the intent of that code was to create a uintset large enough to hold the last activated cid, which I guess was always > 0 for the modems tried.

With cid 0, I think what should be done is to always create the uinset using the new_from_range function. So either always create one using new_from_range(0, 255) or if cid == 0, use new_from_range(0, 0);

Quoted 3 lines

Do you think this fix is fine?
Should I put handling for cid 0 under vendor flag check.

No, cid 0 is essentially standardized now. It would be nice to be able to check whether cid 0 is supported or not up front though.

Regards,
-Denis