Skip to contentSkip to conversation

gprs: update attached on netreg updates when running LTE

PATCH Applied [email protected] 2 participants 3 messages Oct 1, 2019 – Oct 11, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 gprs: update attached on netreg updates when running LTE

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

There was a race condition where a context might be registered before the netreg status updates to LTE.

The code took for granted the context is activated after the technology update. With this change, any order is is accepted.

---
 src/gprs.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
src/gprs.c +8 -2
index a8702958..a1e52572 100644
@@ -1721,12 +1721,18 @@ static void gprs_netreg_update(struct ofono_gprs *gprs)
 
 	DBG("attach: %u, driver_attached: %u", attach, gprs->driver_attached);
 
-	if (on_lte(gprs))
+	if (on_lte(gprs)) {
 		/*
 		 * For LTE we set attached status only on successful
 		 * context activation.
+		 *
+		 * The context could potentially be registered before the netreg
+		 * update is received.
 		 */
-                return;
+		gprs_attached_update(gprs);
+
+		return;
+	}
 
 	if (gprs->driver_attached == attach)
 		return;
Signature · 1 line
2.20.1
#1 lore raw

Hope this one applies ;-)

Here is a log showing when this issue happened, where a context was registered before we got signaled
LTE tech...

Oct  1 09:43:47 info : Aux: > AT+COPS=3,0\r
Oct  1 09:43:47 info : Aux: < \r\nOK\r\n
Oct  1 09:43:47 info : Aux: > AT+COPS?\r

We are running UTRAN + HSPA

Oct  1 09:43:48 info : Aux: < \r\n+COPS: 0,0,"XXX",6\r\n
Oct  1 09:43:48 info : Aux: < \r\nOK\r\n
Oct  1 09:43:48 debug :
../git/drivers/atmodem/network-registration.c:cops_cb() cops_cb: XXX, 240
07 6
Oct  1 09:43:48 debug : ../git/src/network.c:current_operator_callback()
0x10d1218, 0x10d6fb8
Oct  1 09:43:50 info : Aux: < \r\n+CIEV: 2,4\r\n

We are transitioning to E-UTRAN because context 4 gets activated

Oct  1 09:43:51 info : Aux: < \r\n+CGEV: ME PDN ACT 4\r\n
Oct  1 09:43:51 info : Aux: > AT+CGDCONT?\r
Oct  1 09:43:51 info : Aux: < \r\n+CGDCONT: 1,"IP","XXX","",0,0,0,0,0,0\r\n
Oct  1 09:43:51 info : Aux: < +CGDCONT:
4,"IP","XXX.mnc003.mcc248.gprs","100.98.237.128",0,0,0,0,0,0\r\n
Oct  1 09:43:51 info : Aux: < \r\nOK\r\n

gprs status goes to unknown(normal on ublox when on E-UTRAN) which will trigger a "detach"

Oct  1 09:43:51 info : Aux: < \r\n+CGREG: 4\r\n
Oct  1 09:43:51 info : Aux: < \r\n+UREG: 0\r\n
Oct  1 09:43:51 debug : ../git/drivers/atmodem/gprs.c:at_cgdcont_read_cb()
ok 1
Oct  1 09:43:51 debug : ../git/src/gprs.c:ofono_gprs_cid_activated() cid 4
Oct  1 09:43:51 debug :
../git/drivers/ubloxmodem/gprs-context.c:ublox_gprs_read_settings() cid 4
Oct  1 09:43:51 debug : ../git/src/modem.c:get_modem_property() modem
0x10ccaa0 property NetworkInterface
Oct  1 09:43:51 debug : ../git/src/gprs.c:pri_read_settings_callback()
0x10d6868
Oct  1 09:43:51 debug : ../git/src/gprs.c:ofono_gprs_status_notify()
/ublox_0 status unknown (4)
Oct  1 09:43:51 debug : ../git/src/gprs.c:ofono_gprs_detached_notify()
/ublox_0
Oct  1 09:43:51 info : Aux: > AT+CREG?\r
Oct  1 09:43:51 info : Aux: < \r\n+CIEV: 9,1\r\n\r\n+UREG: 7\r\n\r\n+CIEV:
9,2\r\n\r\n+CTZE: +08,1,"19/10/01,11:43:53"\r\n
Oct  1 09:43:51 debug :
../git/drivers/ubloxmodem/network-registration.c:ctze_notify() tz +08 dst 1
time 19/10/01,11:43:53
Oct  1 09:43:51 debug : ../git/src/network.c:ofono_netreg_time_notify() net

time 2019-10-01 11:43:53 utcoff 7200 dst 1

We are on E-UTRAN

Oct  1 09:43:51 info : Aux: < \r\n+CREG: 2,5,"2B02","01B57901",7\r\n
Oct  1 09:43:51 info : Aux: < \r\nOK\r\n
Oct  1 09:43:51 debug : ../git/src/network.c:ofono_netreg_status_notify()
/ublox_0 status 5 tech 7 lac 11010 ci 28670209
Oct  1 09:43:51 debug : ../git/src/gprs.c:netreg_status_changed() 5

(roaming)

gprs.c gets signaled about the change to E-UTRAN.
But since we now are on LTE, the code currently expect expect to change to attached state first
when a new context is registered...But that happened above, so we will wait for ever...

Oct  1 09:43:51 debug : ../git/src/gprs.c:gprs_netreg_update() attach: 1,
driver_attached: 0
Oct  1 09:43:51 info : Aux: > AT+COPS=3,2\r
Oct  1 09:43:51 info : Aux: < \r\nOK\r\n
Oct  1 09:43:51 info : Aux: > AT+COPS?\r

Den tis 1 okt. 2019 kl 22:11 skrev <[email protected]>:

Quoted 44 lines

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

There was a race condition where a context might be registered before the netreg status updates to LTE.

The code took for granted the context is activated after the technology update. With this change, any order is is accepted.

---
 src/gprs.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
src/gprs.c +3 -1
index a8702958..a1e52572 100644
@@ -1721,12 +1721,18 @@ static void gprs_netreg_update(struct ofono_gprs
 *gprs)
 
        DBG("attach: %u, driver_attached: %u", attach,
 gprs->driver_attached);
 
-       if (on_lte(gprs))
+       if (on_lte(gprs)) {
                /*
                 * For LTE we set attached status only on successful
                 * context activation.
+                *
+                * The context could potentially be registered before the

netreg

src/gprs.c +5 -2
+                * update is received.
                 */
-                return;
+               gprs_attached_update(gprs);
+
+               return;
+       }
 
        if (gprs->driver_attached == attach)
                return;
--

2.20.1

#2 lore raw
In reply to [email protected]

Hi Richard,

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

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

There was a race condition where a context might be registered before the netreg status updates to LTE.

Quoted 7 lines

The code took for granted the context is activated after the technology update. With this change, any order is is accepted.

---
  src/gprs.c | 10 ++++++++--
  1 file changed, 8 insertions(+), 2 deletions(-)

Applied, thanks.

Regards,
-Denis