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

Aleksander Morgado aleksander at aleksander.es
Sat Aug 26 14:04:20 UTC 2017


On Aug 26, 2017 10:24, "Tore Anderson" <tore at fud.no> wrote:

* 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.



Yep, that is expected, git master was ported to GTask, while 1.6 isn't.
I'll prepare a 1.6 backport if this is the solution we want for now.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/modemmanager-devel/attachments/20170826/2ffc91a4/attachment.html>


More information about the ModemManager-devel mailing list