Bug 101046 - reduce time of internet disconnect time delay
Summary: reduce time of internet disconnect time delay
Status: RESOLVED NOTOURBUG
Alias: None
Product: ModemManager
Classification: Unclassified
Component: general (show other bugs)
Version: 1.6
Hardware: ARM other
: medium normal
Assignee: ModemManager bug user
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-05-15 09:29 UTC by Niraj Ram
Modified: 2017-05-16 10:32 UTC (History)
1 user (show)

See Also:
i915 platform:
i915 features:


Attachments
USB bus traces to describe time delta. (126.13 KB, application/x-rar)
2017-05-15 10:27 UTC, Niraj Ram
Details

Description Niraj Ram 2017-05-15 09:29:25 UTC
Hi,

We have as issue with Intel modem.
I am using modem manager gui tool.

The time difference between modem manager gui to send internet disconnect MBIM command(CONNECT) and last IN/OUT transfer of USB for data packets is always more than 200ms.

This is minimum time of disconnection as a result there are lots of data network packets accumulated in modem side.

The same modem is working seamlessly in windows OS as the maximum time taken by windows is 90ms. The usual time delay between last IN/OUT transfer of USB(network packets) and internet disconnect MBIM command to device is 2-10ms.

Can you please help reduce this time delay?
The cdc-mbim driver should send internet disconnect MBIM command immediately after stopping USB transfer communication for network packets.

Thanks,
Niraj Ram
Comment 1 Aleksander Morgado 2017-05-15 09:44:20 UTC
(In reply to Niraj Ram from comment #0)
> Hi,
> 
> We have as issue with Intel modem.
> I am using modem manager gui tool.
> 

Which GUI tool is this? We do not maintain any GUI tool ourselves.

> The time difference between modem manager gui to send internet disconnect
> MBIM command(CONNECT) and last IN/OUT transfer of USB for data packets is
> always more than 200ms.
> 
> This is minimum time of disconnection as a result there are lots of data
> network packets accumulated in modem side.
> 
> The same modem is working seamlessly in windows OS as the maximum time taken
> by windows is 90ms. The usual time delay between last IN/OUT transfer of
> USB(network packets) and internet disconnect MBIM command to device is
> 2-10ms.
> 
> Can you please help reduce this time delay?
> The cdc-mbim driver should send internet disconnect MBIM command immediately
> after stopping USB transfer communication for network packets.
> 

You either need to explain better where the issue is or I'm tempted to say this is not an issue in ModemManager.

ModemManager will send the MBIM disconnection through mbim-proxy and then through the cdc-wdm port as soon as it gets the disconnection request via DBus.

My question is, what does it matter for ModemManager how long it takes to send that message through its stack? Or is it that you're bringing down the network interface as soon as you send the disconnection request to ModemManager?
Comment 2 Niraj Ram 2017-05-15 10:27:09 UTC
Created attachment 131360 [details]
USB bus traces to describe time delta.

Time delta is shown at right corner of CommandMsg(Connect, Set).
This MBIM command is for MBIM internet disconnect.
Comment 3 Niraj Ram 2017-05-15 10:33:28 UTC
Thank You Aleksander for your quick reply.

However, I have attached Ellisys USB bus analyzer log snippet.

We can see the time delta between windows and ubuntu between MBIM internet disconnect and last packet transfer(log just above ConnectMsg).

My query is if we can reduce this time delta when internet is disconnected from ubuntu.

Internet disconnection and connection we are doing using dial up settings at top right corner(Mobile broadband interface module) after setting APN of network service provider.
Comment 4 Niraj Ram 2017-05-15 10:45:03 UTC
URL from where I downloaded the modem manager GUI.
https://apps.ubuntu.com/cat/applications/modem-manager-gui/
Comment 5 Aleksander Morgado 2017-05-15 10:58:49 UTC
(In reply to Niraj Ram from comment #4)
> URL from where I downloaded the modem manager GUI.
> https://apps.ubuntu.com/cat/applications/modem-manager-gui/

Note that that is not an application we develop; someone else developed that as a frontend for ModemManager.
Comment 6 Aleksander Morgado 2017-05-15 11:00:09 UTC
(In reply to Niraj Ram from comment #3)
> Thank You Aleksander for your quick reply.
> 
> However, I have attached Ellisys USB bus analyzer log snippet.
> 
> We can see the time delta between windows and ubuntu between MBIM internet
> disconnect and last packet transfer(log just above ConnectMsg).
> 
> My query is if we can reduce this time delta when internet is disconnected
> from ubuntu.
> 
> Internet disconnection and connection we are doing using dial up settings at
> top right corner(Mobile broadband interface module) after setting APN of
> network service provider.

Ok, so from what I can see, the problem is that the network traffic is not stopped as soon as we have sent the MBIM disconnect request.

The logic for disconnection using the Ubuntu network-manager-applet+NetworkManager+ModemManager looks like this (if I'm not mistaken about the NM steps):

 1) User clicks in network-manager-applet (or that other application you pointed out) to disconnect the modem.
 2) n-m-a tells NetworkManager to disconnect the modem via DBus.
 3) NetworkManager tells to ModemManager to disconnect the modem via DBus.
 4) ModemManager sends MBIM disconnection message to mbim-proxy via socket.
 5) mbim-proxy sends MBIM disconnection message to the kernel via cdc-wdm port.
 6) kernel sends MBIM disconnection message to device via USB.
 7) kernel receives MBIM disconnection response from device via USB.
 8) mbim-proxy receives MBIM disconnection response from kernel via cdc-wdm port.
 9) ModemManager receives MBIM disconnection response from mbim-proxy via socket.
 10) NetworkManager receives disconnection response from ModemManager via DBus.
 11) NetworkManager removes IP settings from the WWAN interface, no more packets may be sent/received to/from the interface.
 12) NetworkManager notifies n-m-a tha the disconnection has been done.

So, if I'm not mistaken, what you want to have is the 11th step from the previous list (removing IP settings from the WWAN interface) done just after step 2 or 3 (when we have requested the disconnection to ModemManager or even just before that), so that the IP traffic is stopped just as we request the disconnection, without waiting for the disconnection to be replied.

Is that right?
Comment 7 Niraj Ram 2017-05-15 13:05:51 UTC
Hi Aleksander,

If I want to relate the thing with your inputs, I can say it is point number 6 and before which is explained earlier.

6) kernel sends MBIM disconnection message to device via USB.
This point relate to USB bus trace log in attachment. ConnectMsg(CONNECT, Set).
So, this command is actually MBIM driver sends to device for internet disconnection.

But, last USB communication just before  ConnectMsg(CONNECT, Set) or point no.6 is important here.

So, the concern is which point is responsible for stopping packets communication(either 4 or 5). Point 6 is definitely MBIM command for dis-connect.

4) ModemManager sends MBIM disconnection message to mbim-proxy via socket.
5) mbim-proxy sends MBIM disconnection message to the kernel via cdc-wdm port.
6) kernel sends MBIM disconnection message to device via USB.

The concern is, modem manager should not stop data packet communication till it is ready to send MBIM command for dis-connect.

The time gap between stopping network packets(4 or 5) and sending MBIM command for internet disconnect(6) should be least, so that at high speed communication, device(modem here not host) should have least network packets accumulated from network as host PC stopped taking further packets.

I hope am trying to make you clear what is the actual query, please revert if not clear.
Comment 8 Aleksander Morgado 2017-05-15 15:03:12 UTC
> 
> The time gap between stopping network packets(4 or 5) and sending MBIM
> command for internet disconnect(6) should be least, so that at high speed
> communication, device(modem here not host) should have least network packets
> accumulated from network as host PC stopped taking further packets.
> 
> I hope am trying to make you clear what is the actual query, please revert
> if not clear.

ModemManager does nothing with the WWAN interface. The program responsible for doing the WWAN setup and teardown is NetworkManager, not ModemManager, which is why I included NetworkManager in the picture.

So which one of this is the one you think should be?

a) The WWAN network interface should stop IP traffic before the MBIM disconnect is sent to the device.
b) The WWAN network interface should stop IP traffic just after the MBIM disconnect is sent to the device, before even getting the reply from the device.
c) The WWAN network interface should stop IP traffic after the MBIM disconnect is sent to the device and the reply from the device received.
Comment 9 Niraj Ram 2017-05-16 07:00:26 UTC
Hi Aleksander,

From the current scenario of network disconnect in attachment, I assume that iteration (a) might be working.

a) The WWAN network interface should stop IP traffic before the MBIM disconnect is sent to the device.
b) The WWAN network interface should stop IP traffic just after the MBIM disconnect is sent to the device, before even getting the reply from the device.
c) The WWAN network interface should stop IP traffic after the MBIM disconnect is sent to the device and the reply from the device received.

If iteration(a) is current working scenario, can you help to provide any patch or temporary executable to check with iteration (b).

I can check with using USB analyzer what is the correct behavior.
Comment 10 Aleksander Morgado 2017-05-16 08:51:49 UTC
> If iteration(a) is current working scenario, can you help to provide any
> patch or temporary executable to check with iteration (b).
> 
> I can check with using USB analyzer what is the correct behavior.

The current scenario is (c), I believe, i.e. the IP settings from the WWAN iface aren't removed until the MBIM response is received back from the modem. My understanding is that (a) is what you want.

Anyway, we need to bring this issue to the NetworkManager developers, as ModemManager has really nothing to do with this sequence...  please open a new bugreport in the NM bugzilla here, "Mobile Broadband" component, and explain this issue and leave a reference to this discussion:
https://bugzilla.gnome.org/enter_bug.cgi?product=NetworkManager
Comment 11 Niraj Ram 2017-05-16 10:32:06 UTC
New ticket created for further discussion with networkmanager(mobile broadband).
https://bugzilla.gnome.org/show_bug.cgi?id=782682


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.