Guillaume Zajac | 31 May 2012 11:59
Picon

[RFC 0/3] Fix crash when network is lost

Hi,

Problem description:
Some Huawei modems are trying to keep PPP session with the network alive even if the network is lost.
Thus oFono PPP session with the modem is never ended. Currently when network is lost, oFono will release the
active contexts into the core however the context is still active at driver level. If the connection with
the network is established again and we try to enable a data call, we have a crash.

This issue is very tricky there might be multiple solutions, here is one I discussed with Denis yesterday.
A new driver entry is added to release context into the driver in shutting down the PPP session between oFono
and the modem.
Then ofono_context_deactivated() is called to signal the context is inactive at driver level.
In the case we lost the network and we are reattaching to the network but the PPP session had no time to be
released, there is a mechanism to wait for the previous context to be released and then signal modem is
reattached to the network. ConnMan can do again a data call.

Guillaume Zajac (3):
  gprs-context: Add new driver entry
  gprs-context: Add new driver entry definition
  gprs: Release context in driver and core when network is lost

 drivers/atmodem/gprs-context.c |   11 +++++
 include/gprs-context.h         |    2 +
 src/gprs.c                     |   84 ++++++++++++++++++++++++++++++----------
 3 files changed, 76 insertions(+), 21 deletions(-)

--

-- 
1.7.5.4

(Continue reading)

Guillaume Zajac | 31 May 2012 11:59
Picon

[RFC 1/3] gprs-context: Add new driver entry

---
 include/gprs-context.h |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/include/gprs-context.h b/include/gprs-context.h
index 6cae9a2..165792f 100644
--- a/include/gprs-context.h
+++ b/include/gprs-context.h
 <at>  <at>  -71,6 +71,8  <at>  <at>  struct ofono_gprs_context_driver {
 	void (*deactivate_primary)(struct ofono_gprs_context *gc,
 					unsigned int id,
 					ofono_gprs_context_cb_t cb, void *data);
+	void (*release_primary)(struct ofono_gprs_context *gc,
+					unsigned int id);
 };

 void ofono_gprs_context_deactivated(struct ofono_gprs_context *gc,
--

-- 
1.7.5.4

Denis Kenzior | 1 Jun 2012 00:46
Picon

Re: [RFC 1/3] gprs-context: Add new driver entry

Hi Guillaume,

On 05/31/2012 04:59 AM, Guillaume Zajac wrote:
> ---
>   include/gprs-context.h |    2 ++
>   1 files changed, 2 insertions(+), 0 deletions(-)
>
> diff --git a/include/gprs-context.h b/include/gprs-context.h
> index 6cae9a2..165792f 100644
> --- a/include/gprs-context.h
> +++ b/include/gprs-context.h
>  <at>  <at>  -71,6 +71,8  <at>  <at>  struct ofono_gprs_context_driver {
>   	void (*deactivate_primary)(struct ofono_gprs_context *gc,
>   					unsigned int id,
>   					ofono_gprs_context_cb_t cb, void *data);
> +	void (*release_primary)(struct ofono_gprs_context *gc,
> +					unsigned int id);

Please just call it detach_shutdown for now.

>   };
>
>   void ofono_gprs_context_deactivated(struct ofono_gprs_context *gc,

Regards,
-Denis
Guillaume Zajac | 31 May 2012 11:59
Picon

[RFC 2/3] gprs-context: Add new driver entry definition

---
 drivers/atmodem/gprs-context.c |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/drivers/atmodem/gprs-context.c b/drivers/atmodem/gprs-context.c
index 16893ce..2c70bf3 100644
--- a/drivers/atmodem/gprs-context.c
+++ b/drivers/atmodem/gprs-context.c
 <at>  <at>  -291,6 +291,16  <at>  <at>  static void at_gprs_deactivate_primary(struct ofono_gprs_context *gc,
 	g_at_ppp_shutdown(gcd->ppp);
 }

+static void at_gprs_release_primary(struct ofono_gprs_context *gc,
+					unsigned int cid)
+{
+	struct gprs_context_data *gcd = ofono_gprs_context_get_data(gc);
+
+	DBG("cid %u", cid);
+
+	g_at_ppp_shutdown(gcd->ppp);
+}
+
 static void cgev_notify(GAtResult *result, gpointer user_data)
 {
 	struct ofono_gprs_context *gc = user_data;
 <at>  <at>  -380,6 +390,7  <at>  <at>  static struct ofono_gprs_context_driver driver = {
 	.remove			= at_gprs_context_remove,
 	.activate_primary	= at_gprs_activate_primary,
 	.deactivate_primary	= at_gprs_deactivate_primary,
+	.release_primary	= at_gprs_release_primary,
(Continue reading)

Guillaume Zajac | 31 May 2012 11:59
Picon

[RFC 3/3] gprs: Release context in driver and core when network is lost

---
 src/gprs.c |   84 +++++++++++++++++++++++++++++++++++++++++++++---------------
 1 files changed, 63 insertions(+), 21 deletions(-)

diff --git a/src/gprs.c b/src/gprs.c
index 994607d..9ec0ca1 100644
--- a/src/gprs.c
+++ b/src/gprs.c
 <at>  <at>  -48,6 +48,7  <at>  <at> 

 #define GPRS_FLAG_ATTACHING 0x1
 #define GPRS_FLAG_RECHECK 0x2
+#define GPRS_FLAG_ATTACHED_UPDATE 0x4

 #define SETTINGS_STORE "gprs"
 #define SETTINGS_GROUP "Settings"
 <at>  <at>  -1440,6 +1441,44  <at>  <at>  void ofono_gprs_resume_notify(struct ofono_gprs *gprs)
 	update_suspended_property(gprs, FALSE);
 }

+static gboolean check_active_contexts(struct ofono_gprs *gprs)
+{
+	GSList *l;
+	struct pri_context *ctx;
+
+	for (l = gprs->contexts; l; l = l->next) {
+		ctx = l->data;
+
+		if (ctx->active == TRUE)
+			return TRUE;
(Continue reading)

Denis Kenzior | 1 Jun 2012 00:45
Picon

Re: [RFC 3/3] gprs: Release context in driver and core when network is lost

Hi Guillaume,

On 05/31/2012 04:59 AM, Guillaume Zajac wrote:
> ---
>   src/gprs.c |   84 +++++++++++++++++++++++++++++++++++++++++++++---------------
>   1 files changed, 63 insertions(+), 21 deletions(-)
>
> diff --git a/src/gprs.c b/src/gprs.c
> index 994607d..9ec0ca1 100644
> --- a/src/gprs.c
> +++ b/src/gprs.c
>  <at>  <at>  -48,6 +48,7  <at>  <at> 
>
>   #define GPRS_FLAG_ATTACHING 0x1
>   #define GPRS_FLAG_RECHECK 0x2
> +#define GPRS_FLAG_ATTACHED_UPDATE 0x4
>
>   #define SETTINGS_STORE "gprs"
>   #define SETTINGS_GROUP "Settings"
>  <at>  <at>  -1440,6 +1441,44  <at>  <at>  void ofono_gprs_resume_notify(struct ofono_gprs *gprs)
>   	update_suspended_property(gprs, FALSE);
>   }
>
> +static gboolean check_active_contexts(struct ofono_gprs *gprs)

Name this have_active_contexts

> +{
> +	GSList *l;
> +	struct pri_context *ctx;
(Continue reading)

Guillaume Zajac | 1 Jun 2012 09:59
Picon

Re: [RFC 3/3] gprs: Release context in driver and core when network is lost

Hi Denis,

On 01/06/2012 00:45, Denis Kenzior wrote:
> Hi Guillaume,
>
> On 05/31/2012 04:59 AM, Guillaume Zajac wrote:
>> ---
>>   src/gprs.c |   84 
>> +++++++++++++++++++++++++++++++++++++++++++++---------------
>>   1 files changed, 63 insertions(+), 21 deletions(-)
>>
>> diff --git a/src/gprs.c b/src/gprs.c
>> index 994607d..9ec0ca1 100644
>> --- a/src/gprs.c
>> +++ b/src/gprs.c
>>  <at>  <at>  -48,6 +48,7  <at>  <at> 
>>
>>   #define GPRS_FLAG_ATTACHING 0x1
>>   #define GPRS_FLAG_RECHECK 0x2
>> +#define GPRS_FLAG_ATTACHED_UPDATE 0x4
>>
>>   #define SETTINGS_STORE "gprs"
>>   #define SETTINGS_GROUP "Settings"
>>  <at>  <at>  -1440,6 +1441,44  <at>  <at>  void ofono_gprs_resume_notify(struct 
>> ofono_gprs *gprs)
>>       update_suspended_property(gprs, FALSE);
>>   }
>>
>> +static gboolean check_active_contexts(struct ofono_gprs *gprs)
>
(Continue reading)


Gmane