Impersistent ifaces using raw-ip mode on Sierra MC7455 modems

Hello,

I'm trying to use multiple sierra MC7455 modems on a device that runs OpenWrt 4.4.0
I've applied some patches to add the raw-ip support in the qmi_wwan driver.
Now I manage to get an ip address but the modems are not getting the same interface (wwanX) after a reboot, therefore i'm unable to identify the modems.
I have worked with Telit modems on the same device before and the interfaces where persistent there.

How can I make the modems get same wwan interface number after a reboot?

@bmork, it would be great if you could have a look at this...

Thanks,
Almog.

Is that the linux version ?
what is the output of
cat /etc/os-release
cat /etc/board.json | grep -i '"id":'

Use the HWAddress ( link)
ip address show

That won't work. There is no L2 address in raw-ip mode. Although you could use the address from ethernet mode, since it's the same interface. But that address is a generated one. And also the same for all qmi_wwan interfaces (as well as a number of other usbnet based drivers).

I would suggest using either the USB port topology. or the modem serial number to create a static interface name.

Not sure I understand why it changes on boot though. The probing order is completely arbitrary, but it doesn't normally change over a reboot unless you change something.

1 Like

to be exact, i'm using a flavor of openwrt thats called "Gateworks 16.02 OpenWrt Release", it's kernel version is 4.4.0 (patched as i said)

os-release file does not exist

root@OpenWrt:/# cat /etc/board.json | grep -i '"id":'
"id": "gw,imx6q-gw54xx",

i'm not sure what you mean by that.

i'm not familiar with this method, would you explain more?

i'll try to use "comgt -d /dev/ttyUSB#X info" to find the serial and order the interfaces somehow. thanks.

in my device i define the apn by the iface number. it worked fine by now with the telit modems, but now when i change the apn and restart the device the order is changed so it makes a mess...
why should the order change when i configure another apn?
also, i think i've seen it changes even if no setting is changed. i'll check it again and update.

thank you.

This won't work directly as it is using udev on a Linux desktop system, but describes the basic idea:

I have a similar issue with the pl2303 usb ttl adapters I use for console. I have 3 such connected to the same host, and they look identical in every aspect. Here even the serial number is useless. But I need to know which OpenWrt device each one is connected to for the conserver config. So what I do is:

  1. look at the usb bus topology and which ports the adapters are connected to (simple here with only one bus in use):
bjorn@canardo:~$ lsusb -t
/:  Bus 02.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/10p, 5000M
/:  Bus 01.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/16p, 480M
    |__ Port 1: Dev 2, If 0, Class=Vendor Specific Class, Driver=pl2303, 12M
    |__ Port 2: Dev 7, If 0, Class=Vendor Specific Class, Driver=pl2303, 12M
    |__ Port 5: Dev 4, If 1, Class=Vendor Specific Class, Driver=, 480M
    |__ Port 5: Dev 4, If 0, Class=Vendor Specific Class, Driver=usbfs, 480M
    |__ Port 11: Dev 5, If 0, Class=Human Interface Device, Driver=usbhid, 1.5M
    |__ Port 11: Dev 5, If 1, Class=Human Interface Device, Driver=usbhid, 1.5M
    |__ Port 12: Dev 6, If 0, Class=Vendor Specific Class, Driver=pl2303, 12M
  1. configure udev rules to set up device specific symlinks based on the significant differences:
ATTRS{idVendor}=="067b", ATTRS{idProduct}=="2303", ATTRS{devpath}=="1" SYMLINK+="p8702n"
ATTRS{idVendor}=="067b", ATTRS{idProduct}=="2303", ATTRS{devpath}=="2" SYMLINK+="wrt1900ac"
ATTRS{idVendor}=="067b", ATTRS{idProduct}=="2303", ATTRS{devpath}=="12" SYMLINK+="wap6805"
  1. Then I simply use these symlinks in my config instead of the arbitrary ttyUSBx names:

bjorn@canardo:~$ ls -l /dev/{p8702n,wrt1900ac,wap6805}
lrwxrwxrwx 1 root root 7 Aug 20 20:07 /dev/p8702n -> ttyUSB0
lrwxrwxrwx 1 root root 7 Aug 20 20:07 /dev/wap6805 -> ttyUSB2
lrwxrwxrwx 1 root root 7 Sep 16 14:18 /dev/wrt1900ac -> ttyUSB1

EDIT: Just to avoid misunderstandings - I meant this only as an example of the bus topology rule matching. Symlinks will of course not work for netdevs. You need to rename those instead. With udev you would do that with a NAME="foo" action.

No, it shouldn't. I meant changes like adding new USB devices or some other hardware which might cause variable probing delays.

In this case, I'm using a bind to the usb bus and simple hotplug.d script.
For example, we have two usb ports. Everyone in the system has his own dev path.
\

# cat /etc/hotplug.d/usb/88-modems
case "$ACTION" in
add)
if [ "$PRODUCT" = "1e2d/58/1730" -a "$DEVPATH" = "/devices/blahblah/blahblah/usb1/1-1/1-1.1/1-1.1/1-1.1:1.5" ]; then
iface=$(ls /sys/$DEVPATH/net/)
uci set network.$iface.apn=internet1
uci commit
fi
if [ "$PRODUCT" = "1e2d/58/1730" -a "$DEVPATH" = "/devices/blahblah/blahblah/usb2/2-1/2-1.1/2-1.1/2-1.1:1.5" ]; then
iface=$(ls /sys/$DEVPATH/net/)
uci set network.$iface.apn=internet2
uci commit
fi
;;