[PATCH] bearer-mbim: ensure session is disconnected before trying to connect

Tore Anderson tore at fud.no
Sat Aug 26 08:24:32 UTC 2017


* Aleksander Morgado

> If a suspend/resume cycle happens or ModemManager is restarted (e.g.
> after a crash) the modem may be left with a given session id 
> connected. With this change we're forcing a session disconnection 
> before we attempt a session connection.
> 
> https://bugs.freedesktop.org/show_bug.cgi?id=102231 ---
> 
> Hey Tore, Ben and Dan,
> 
> The following patch makes sure the MBIM session id that we're trying 
> to connect is disconnected before the connection attempt. A more 
> complex solution would have involved checking whether the new 
> connection parameters are the same as the ones in the connected 
> session, and if so just assume we're connected. This solution is
> just a quick way to solve this issue.
> 
> Comments/tests/review welcome!

Hi Aleksander, and thanks for looking at this!

I tested it on top of git master (76c1a111) and it does seem to work as
intended - I've not seen any more bearer activation failures due to
MaxActivatedContexts after resuming from suspend.

I also tried applying it to MM-1.6.4 (the version in Fedora 26). While
the patch itself applies (with some fuzz), the build fails as follows:

  CC       ModemManager-mm-bearer-mbim.o
mm-bearer-mbim.c: In function ‘ensure_disconnected_ready’:
mm-bearer-mbim.c:657:27: error: passing argument 1 of ‘connect_context_step’ from incompatible pointer type [-Werror=incompatible-pointer-types]
     connect_context_step (task);
                           ^~~~
mm-bearer-mbim.c:267:13: note: expected ‘ConnectContext * {aka struct <anonymous> *}’ but argument is of type ‘GTask * {aka struct _GTask *}’
 static void connect_context_step (ConnectContext *ctx);
             ^~~~~~~~~~~~~~~~~~~~
mm-bearer-mbim.c: In function ‘connect_context_step’:
mm-bearer-mbim.c:843:24: error: ‘self’ undeclared (first use in this function); did you mean ‘send’?
                        self->priv->session_id,
                        ^~~~
                        send
mm-bearer-mbim.c:843:24: note: each undeclared identifier is reported only once for each function it appears in
mm-bearer-mbim.c:854:34: error: ‘task’ undeclared (first use in this function); did you mean ‘GTask’?
             g_task_return_error (task, error);
                                  ^~~~
                                  GTask
cc1: all warnings being treated as errors
make[4]: *** [Makefile:1555: ModemManager-mm-bearer-mbim.o] Error 1

So I didn't get to test that.

Tore


More information about the ModemManager-devel mailing list