Skip to contentSkip to conversation

gprs: Do not detach when running LTE and GPRS is unavailable.

PATCH Superseded [email protected] 2 participants 8 messages Aug 11, 2019 – Aug 12, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 gprs: Do not detach when running LTE and GPRS is unavailable.

From: Richard Röjfors <[email protected]>

There are cases where the gprs status might updated to for instance "unknown" while LTE is the bearer.
In that case we should not set the attach state to FALSE, since then running LTE the conext activation reflects the attached state.

---
 src/gprs.c | 19 ++++++++++++++++---
 1 file changed, 16 insertions(+), 3 deletions(-)
src/gprs.c +16 -3
index 9cb69d14..1a9b234d 100644
@@ -1660,6 +1660,15 @@ static void gprs_netreg_removed(struct ofono_gprs *gprs)
 	gprs_attached_update(gprs);
 }
 
+static gboolean expect_lte_context_auto_activation(struct ofono_gprs *gprs)
+{
+	if (ofono_netreg_get_technology(gprs->netreg) ==
+			ACCESS_TECHNOLOGY_EUTRAN && have_read_settings(gprs))
+		return TRUE;
+
+	return FALSE;
+}
+
 static void gprs_netreg_update(struct ofono_gprs *gprs)
 {
 	ofono_bool_t attach;
@@ -1682,8 +1691,7 @@ static void gprs_netreg_update(struct ofono_gprs *gprs)
 
 	DBG("attach: %u, driver_attached: %u", attach, gprs->driver_attached);
 
-	if (ofono_netreg_get_technology(gprs->netreg) ==
-			ACCESS_TECHNOLOGY_EUTRAN && have_read_settings(gprs))
+	if (expect_lte_context_auto_activation(gprs))
 		/*
 		 * For LTE we set attached status only on successful
 		 * context activation.
@@ -2560,7 +2568,12 @@ void ofono_gprs_status_notify(struct ofono_gprs *gprs, int status)
 
 	if (status != NETWORK_REGISTRATION_STATUS_REGISTERED &&
 			status != NETWORK_REGISTRATION_STATUS_ROAMING) {
-		gprs_attached_update(gprs);
+		/*
+		 * For LTE we attached status reflects successful context
+		 * activation.
+		 */
+		if (!expect_lte_context_auto_activation(gprs))
+			gprs_attached_update(gprs);
 		return;
 	}
 
Signature · 1 line
2.20.1
#1 lore raw

Hi Richard,

Quoted 7 lines · richard.rojfors(a)gmail.com

From: Richard Röjfors <[email protected]>

There are cases where the gprs status might updated to for instance "unknown" while LTE is the bearer.
In that case we should not set the attach state to FALSE, since then running LTE the conext activation reflects the attached state.

It might be nice to include a log snippet of how the current behavior fails...

src/gprs.c static void gprs_netreg_removed(struct ofono_gprs *gprs) · line 1663

Quoted 13 lines
---
  src/gprs.c | 19 ++++++++++++++++---
  1 file changed, 16 insertions(+), 3 deletions(-)
src/gprs.c +1 -0
index 9cb69d14..1a9b234d 100644
@@ -1660,6 +1660,15 @@ static void gprs_netreg_removed(struct ofono_gprs *gprs)
  	gprs_attached_update(gprs);
  }
 
+static gboolean expect_lte_context_auto_activation(struct ofono_gprs *gprs)

I'm not thrilled about the name? Isn't this just 'on_lte?' or something like that?

Quoted 22 lines
src/gprs.c +9 -2
+{
+	if (ofono_netreg_get_technology(gprs->netreg) ==
+			ACCESS_TECHNOLOGY_EUTRAN && have_read_settings(gprs))
+		return TRUE;
+
+	return FALSE;
+}
+
  static void gprs_netreg_update(struct ofono_gprs *gprs)
  {
  	ofono_bool_t attach;
@@ -1682,8 +1691,7 @@ static void gprs_netreg_update(struct ofono_gprs *gprs)
 
  	DBG("attach: %u, driver_attached: %u", attach, gprs->driver_attached);
 
-	if (ofono_netreg_get_technology(gprs->netreg) ==
-			ACCESS_TECHNOLOGY_EUTRAN && have_read_settings(gprs))
+	if (expect_lte_context_auto_activation(gprs))
  		/*
  		 * For LTE we set attached status only on successful
  		 * context activation.

src/gprs.c void ofono_gprs_status_notify(struct ofono_gprs *gprs, int status) · line 2574

Quoted 8 lines
src/gprs.c +4 -1
@@ -2560,7 +2568,12 @@ void ofono_gprs_status_notify(struct ofono_gprs *gprs, int status)
 
  	if (status != NETWORK_REGISTRATION_STATUS_REGISTERED &&
  			status != NETWORK_REGISTRATION_STATUS_ROAMING) {
-		gprs_attached_update(gprs);
+		/*
+		 * For LTE we attached status reflects successful context
+		 * activation.
+		 */

So I don't get this. We have CREG telling us: "we're on LTE" and CGREG telling us "Oh we don't know what our status is". Why do you trust one and not the other? Are you sure this doesn't belong in a driver quirk somewhere?

src/gprs.c void ofono_gprs_status_notify(struct ofono_gprs *gprs, int status) · line 2579

Quoted 6 lines
src/gprs.c +2 -0
+		if (!expect_lte_context_auto_activation(gprs))
+			gprs_attached_update(gprs);
  		return;
  	}
 

Regards,
-Denis

#2 lore raw

Hi Denis,

Den mån 12 aug. 2019 kl 18:58 skrev Denis Kenzior <[email protected]>:

Quoted 5 lines

Hi Richard,

Quoted 2 lines · richard.rojfors(a)gmail.com

From: Richard Röjfors <[email protected]>

Quoted 9 lines
Quoted 5 lines

There are cases where the gprs status might updated to for instance "unknown" while LTE is the bearer.
In that case we should not set the attach state to FALSE, since then running LTE the conext activation reflects the attached state.

It might be nice to include a log snippet of how the current behavior fails...

I'm not sure I can dig one up right now.

The case is that we are running LTE a context gets auto activated, we don't bother to attach to GPRS (since we are on LTE), we get notified that the
status is unknown -> BAM, we get detached, eventhough we are on LTE and the context is up.

Quoted 11 lines

src/gprs.c static void gprs_netreg_removed(struct ofono_gprs

Quoted 10 lines
---
  src/gprs.c | 19 ++++++++++++++++---
  1 file changed, 16 insertions(+), 3 deletions(-)
src/gprs.c +0 -0
index 9cb69d14..1a9b234d 100644
@@ -1660,6 +1660,15 @@ static void gprs_netreg_removed(struct ofono_gprs

*gprs)

Quoted 9 lines

src/gprs.c static void gprs_netreg_removed(struct ofono_gprs *gprs)

Quoted 4 lines
src/gprs.c +1 -0
      gprs_attached_update(gprs);
  }
 
+static gboolean expect_lte_context_auto_activation(struct ofono_gprs

*gprs)

I'm not thrilled about the name? Isn't this just 'on_lte?' or something like that?

Sounds better.

Quoted 37 lines

src/gprs.c static void gprs_netreg_removed(struct ofono_gprs *gprs)

Quoted 4 lines
src/gprs.c +3 -0
+{
+     if (ofono_netreg_get_technology(gprs->netreg) ==
+                     ACCESS_TECHNOLOGY_EUTRAN &&

have_read_settings(gprs))

src/gprs.c static void gprs_netreg_update(struct ofono_gprs

Quoted 9 lines
src/gprs.c +5 -0
+             return TRUE;
+
+     return FALSE;
+}
+
  static void gprs_netreg_update(struct ofono_gprs *gprs)
  {
      ofono_bool_t attach;
@@ -1682,8 +1691,7 @@ static void gprs_netreg_update(struct ofono_gprs

*gprs)

src/gprs.c static void gprs_netreg_update(struct ofono_gprs · line 1691

Quoted 2 lines
src/gprs.c +0 -0
      DBG("attach: %u, driver_attached: %u", attach,

gprs->driver_attached);

src/gprs.c static void gprs_netreg_update(struct ofono_gprs · line 1684

Quoted 3 lines
src/gprs.c +0 -2
-     if (ofono_netreg_get_technology(gprs->netreg) ==
-                     ACCESS_TECHNOLOGY_EUTRAN &&

have_read_settings(gprs))

src/gprs.c void ofono_gprs_status_notify(struct ofono_gprs

Quoted 5 lines
src/gprs.c +1 -0
+     if (expect_lte_context_auto_activation(gprs))
              /*
               * For LTE we set attached status only on successful
               * context activation.
@@ -2560,7 +2568,12 @@ void ofono_gprs_status_notify(struct ofono_gprs

*gprs, int status)

src/gprs.c void ofono_gprs_status_notify(struct ofono_gprs *gprs, int status) · line 2574

Quoted 8 lines
src/gprs.c +4 -1
      if (status != NETWORK_REGISTRATION_STATUS_REGISTERED &&
                      status != NETWORK_REGISTRATION_STATUS_ROAMING) {
-             gprs_attached_update(gprs);
+             /*
+              * For LTE we attached status reflects successful context
+              * activation.
+              */
Quoted 5 lines

So I don't get this. We have CREG telling us: "we're on LTE" and CGREG telling us "Oh we don't know what our status is". Why do you trust one and not the other? Are you sure this doesn't belong in a driver quirk somewhere?

When CREG tells us we are on LTE, we will probably not even try attach to gprs (CGATT),
refer to gprs_netreg_update.
In my understanding that means that its natural that CGREG reports unknown or similar.
CEREG would be the interesting one... but since the code is built around using activated context as condition when running on LTE I think we should use the same condition here.

Quoted 11 lines

src/gprs.c void ofono_gprs_status_notify(struct ofono_gprs *gprs, int status)

Quoted 7 lines
src/gprs.c +2 -0
+             if (!expect_lte_context_auto_activation(gprs))
+                     gprs_attached_update(gprs);
              return;
      }
 
 

Regards,
-Denis

#3 lore raw

Hi Richard,

Quoted 6 lines

So I don't get this.  We have CREG telling us: "we're on LTE" and CGREG telling us "Oh we don't know what our status is".  Why do you trust one and not the other?  Are you sure this doesn't belong in a driver quirk somewhere?

Quoted 8 lines

When CREG tells us we are on LTE, we will probably not even try attach to gprs (CGATT),
refer to gprs_netreg_update.
In my understanding that means that its natural that CGREG reports unknown or similar.
CEREG would be the interesting one... but since the code is built around using activated context as condition when running on LTE I think we should use the same condition here.

Ah, so you're on one of those modems that started using CEREG instead of CGREG for reporting LTE. So in that case I'm fine with this (maybe add a more clarifying comment). But I suspect that we also need to consider adding ofono_gprs_lte_status as well and taking both into account.

Regards,
-Denis

#4 lore raw

Hi Denis,

Den mån 12 aug. 2019 kl 21:57 skrev Denis Kenzior <[email protected]>:

Quoted 18 lines

Hi Richard,

Quoted 1 line

So I don't get this. We have CREG telling us: "we're on LTE" and

CGREG

Quoted 1 line

telling us "Oh we don't know what our status is". Why do you trust

one

Quoted 1 line

and not the other? Are you sure this doesn't belong in a driver

quirk

Quoted 10 lines

somewhere?

When CREG tells us we are on LTE, we will probably not even try attach to gprs (CGATT),
refer to gprs_netreg_update.
In my understanding that means that its natural that CGREG reports unknown or similar.
CEREG would be the interesting one... but since the code is built around using activated context as condition when running on LTE I think we

Quoted 8 lines

should

Quoted 1 line

use the same condition here.

Ah, so you're on one of those modems that started using CEREG instead of CGREG for reporting LTE. So in that case I'm fine with this (maybe add a more clarifying comment). But I suspect that we also need to consider adding ofono_gprs_lte_status as well and taking both into account.

I will refine the comment, and yes I think we need lte_status at some point. There might be a chance we can do it without, but only when LTE is the "other case", when more techologies are introduced we definitely need a status per tech.

I have more in the pipeline regarding this, I'm kind of working step by step to get LTE to work properly and with hand over to come.

--Richard

#5 lore raw

Hi Richard,

Quoted 4 lines

I have more in the pipeline regarding this, I'm kind of working step by step to get LTE to work properly and with hand over to come.

Nice! About time someone looked into this :)

Regards,
-Denis

#6 lore raw

PATCH v2 1/1 gprs: Do not detach when running LTE and GPRS is unavailable.

In reply to [email protected]

From: Richard Röjfors <[email protected]>

There are cases where the gprs status might updated to for instance "unknown" while LTE is the bearer.
In that case we should not set the attach state to FALSE, since then running LTE the conext activation reflects the attached state.

---
 src/gprs.c | 23 ++++++++++++++++++++---
 1 file changed, 20 insertions(+), 3 deletions(-)
src/gprs.c +20 -3
index 9cb69d14..f7a2b739 100644
@@ -1660,6 +1660,15 @@ static void gprs_netreg_removed(struct ofono_gprs *gprs)
 	gprs_attached_update(gprs);
 }
 
+static gboolean on_lte(struct ofono_gprs *gprs)
+{
+	if (ofono_netreg_get_technology(gprs->netreg) ==
+			ACCESS_TECHNOLOGY_EUTRAN && have_read_settings(gprs))
+		return TRUE;
+
+	return FALSE;
+}
+
 static void gprs_netreg_update(struct ofono_gprs *gprs)
 {
 	ofono_bool_t attach;
@@ -1682,8 +1691,7 @@ static void gprs_netreg_update(struct ofono_gprs *gprs)
 
 	DBG("attach: %u, driver_attached: %u", attach, gprs->driver_attached);
 
-	if (ofono_netreg_get_technology(gprs->netreg) ==
-			ACCESS_TECHNOLOGY_EUTRAN && have_read_settings(gprs))
+	if (on_lte(gprs))
 		/*
 		 * For LTE we set attached status only on successful
 		 * context activation.
@@ -2560,7 +2568,16 @@ void ofono_gprs_status_notify(struct ofono_gprs *gprs, int status)
 
 	if (status != NETWORK_REGISTRATION_STATUS_REGISTERED &&
 			status != NETWORK_REGISTRATION_STATUS_ROAMING) {
-		gprs_attached_update(gprs);
+		/*
+		 * For LTE we attached status reflects successful context
+		 * activation.
+		 * Since we in gprs_netreg_update not even try to attach
+		 * to GPRS if we are running on LTE, we can on some modems
+		 * expect the gprs status to be unknown. That must not
+		 * result in detaching...
+		 */
+		if (!on_lte(gprs))
+			gprs_attached_update(gprs);
 		return;
 	}
 
Signature · 1 line
2.20.1
#7 lore raw

Hi Richard,

Quoted 11 lines · richard.rojfors(a)gmail.com

From: Richard Röjfors <[email protected]>

There are cases where the gprs status might updated to for instance "unknown" while LTE is the bearer.
In that case we should not set the attach state to FALSE, since then running LTE the conext activation reflects the attached state.

---
  src/gprs.c | 23 ++++++++++++++++++++---
  1 file changed, 20 insertions(+), 3 deletions(-)

Applied, thanks.

Regards,
-Denis