NetBSD Problem Report #58396

From www@netbsd.org  Wed Jul  3 21:17:27 2024
Return-Path: <www@netbsd.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (2048 bits)
	 client-signature RSA-PSS (2048 bits))
	(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
	by mollari.NetBSD.org (Postfix) with ESMTPS id D043B1A923A
	for <gnats-bugs@gnats.NetBSD.org>; Wed,  3 Jul 2024 21:17:27 +0000 (UTC)
Message-Id: <20240703211726.1DE6A1A923C@mollari.NetBSD.org>
Date: Wed,  3 Jul 2024 21:17:26 +0000 (UTC)
From: rspmn@arcor.de
Reply-To: rspmn@arcor.de
To: gnats-bugs@NetBSD.org
Subject: u3g(4): add support for Sierra Wireless MC7304 devices
X-Send-Pr-Version: www-1.0

>Number:         58396
>Notify-List:    riastradh@NetBSD.org
>Category:       kern
>Synopsis:       u3g(4): add support for Sierra Wireless MC7304 devices
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    christos
>State:          needs-pullups
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Wed Jul 03 21:20:00 +0000 2024
>Closed-Date:    
>Last-Modified:  Sun Oct 13 13:43:09 +0000 2024
>Originator:     Reinhard Speyerer
>Release:        10.0
>Organization:
>Environment:
NetBSD nena 10.0 NetBSD 10.0 (GENERIC) #0: Thu Mar 28 08:33:33 UTC 2024  mkrepro@mkrepro.NetBSD.org:/usr/src/sys/arch/i386/compile/GENERIC i386
>Description:
u3g(4) does not handle the serial ports of Sierra Wireless MC7304 devices.
>How-To-Repeat:
Connect a Sierra Wireless MC7304 to a USB port and check dmesg(8) output:
[   290.934905] ugen0 at uhub4 port 1
[   290.934905] ugen0: Sierra Wireless, Incorporated (0x1199) MC7304 (0x68c0), rev 2.00/0.06, addr 6

>Fix:
Apply the patch below, rebuild the kernel and reboot:
[   225.410048] u3g0 at uhub5 port 1 configuration 1 interface 0
[   225.410048] ucom4 at u3g0 portno 0: 3G Modem
[   225.410048] u3g1 at uhub5 port 1 configuration 1 interface 2
[   225.410048] ucom5 at u3g1 portno 0: 3G Modem
[   225.410048] u3g1 at uhub5 port 1 configuration 1 interface 3
[   225.410048] ucom6 at u3g2 portno 0: 3G Modem

Sierra Wireless later reused the USB id of the MC7304 for their WP76xx devices
which provide an ADB interface which should not be handled by u3g(4).

# diff -U1 dev/usb/u3g.c.orig dev/usb/u3g.c 
--- dev/usb/u3g.c.orig  2023-02-14 17:33:43.000000000 +0100
+++ dev/usb/u3g.c       2024-07-01 23:00:20.000000000 +0200
@@ -246,2 +246,3 @@
        { USB_VENDOR_SIERRA, USB_PRODUCT_SIERRA_250U },
+       { USB_VENDOR_SIERRA, USB_PRODUCT_SIERRA_MC7304 },
        /* Toshiba */
@@ -303,4 +304,14 @@
            id->bInterfaceClass == UICLASS_VENDOR &&
-           uiaa->uiaa_product == USB_PRODUCT_SIERRA_USB305 &&
-            uiaa->uiaa_ifaceno >= 7)
+           (uiaa->uiaa_product == USB_PRODUCT_SIERRA_USB305 ||
+            uiaa->uiaa_product == USB_PRODUCT_SIERRA_MC7304) &&
+           uiaa->uiaa_ifaceno >= 7)
+               return UMATCH_NONE;
+       /*
+        * Some modems use the vendor-specific class also for
+        * ADB/Fastboot interfaces, which we should avoid attaching to.
+        */
+       if (uiaa->uiaa_vendor == USB_VENDOR_SIERRA &&
+           uiaa->uiaa_product == USB_PRODUCT_SIERRA_MC7304 &&
+           id->bInterfaceClass == UICLASS_VENDOR &&
+           id->bInterfaceSubClass == 0x42)
                return UMATCH_NONE;

>Release-Note:

>Audit-Trail:
From: "Christos Zoulas" <christos@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/58396 CVS commit: src/sys/dev/usb
Date: Wed, 3 Jul 2024 20:23:48 -0400

 Module Name:	src
 Committed By:	christos
 Date:		Thu Jul  4 00:23:48 UTC 2024

 Modified Files:
 	src/sys/dev/usb: u3g.c

 Log Message:
 PR/58396: Reinhard Speyerer: u3g(4): add support for Sierra Wireless MC7304
 devices


 To generate a diff of this commit:
 cvs rdiff -u -r1.44 -r1.45 src/sys/dev/usb/u3g.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

State-Changed-From-To: open->feedback
State-Changed-By: riastradh@NetBSD.org
State-Changed-When: Tue, 23 Jul 2024 20:48:16 +0000
State-Changed-Why:
Thanks for the patch!  Does this work better now in HEAD?

If so, we should probably do pullup-10 and pullup-9 -- seems like a
reasonably low risk.


From: Reinhard Speyerer <rspmn@arcor.de>
To: gnats-bugs@netbsd.org
Cc: kern-bug-people@netbsd.org, netbsd-bugs@netbsd.org,
	gnats-admin@netbsd.org, riastradh@netbsd.org, khorben@netbsd.org
Subject: Re: kern/58396 (u3g(4): add support for Sierra Wireless MC7304
 devices)
Date: Wed, 24 Jul 2024 22:37:47 +0200

 On Tue, Jul 23, 2024 at 08:48:17PM +0000, riastradh@NetBSD.org wrote:
 > Synopsis: u3g(4): add support for Sierra Wireless MC7304 devices
 > 
 > State-Changed-From-To: open->feedback
 > State-Changed-By: riastradh@NetBSD.org
 > State-Changed-When: Tue, 23 Jul 2024 20:48:16 +0000
 > State-Changed-Why:
 > Thanks for the patch!  Does this work better now in HEAD?
 > 
 > If so, we should probably do pullup-10 and pullup-9 -- seems like a
 > reasonably low risk.

 When doing pullups it might make sense to apply this part of the diff
 from PR 56145 to if_umb.c 1.26

 --- if_umb.c.orig	2024-07-24 22:14:17.939793557 +0200
 +++ if_umb.c	2024-07-24 22:16:17.935789331 +0200
 @@ -407,5 +407,8 @@
  	for (i = 0; i < uiaa->uiaa_nifaces; i++) {
 -		id = usbd_get_interface_descriptor(uiaa->uiaa_ifaces[i]);
 -		if (id != NULL && id->bInterfaceNumber == data_ifaceno) {
 -			sc->sc_data_iface = uiaa->uiaa_ifaces[i];
 +		if (uiaa->uiaa_ifaces[i] != NULL) {
 +			id = usbd_get_interface_descriptor(uiaa->uiaa_ifaces[i]);
 +			if (id != NULL && id->bInterfaceNumber == data_ifaceno) {
 +				sc->sc_data_iface = uiaa->uiaa_ifaces[i];
 +				uiaa->uiaa_ifaces[i] = NULL;
 +			}
  		}

 and then do pullups for that too.

 Otherwise NetBSD users who build their kernel with umb(4) enabled will see
 a kernel panic after they switch their MC7304 to MBIM mode and powercycle
 or reset it.

 Not sure if the other parts of the diff are still relevant since there have
 been several updates to if_umb.c and the NetBSD networking stack in the
 meantime. Please consider closing PR 56145 after applying the patch above.

 Thanks,
 Reinhard

From: Reinhard Speyerer <rspmn@arcor.de>
To: gnats-bugs@netbsd.org
Cc: khorben@netbsd.org
Subject: Re: kern/58396 (u3g(4): add support for Sierra Wireless MC7304
 devices)
Date: Sun, 25 Aug 2024 18:38:13 +0200

 Update as requested by GNATS:

 As I have updated the system with the MC7304 to NetBSD 10.0 a pullup-10 of
 the u3g(4) changes from this ticket would be sufficient for me.

 The limitation mentioned in this forum thread
 https://forum.sierrawireless.com/t/mc7430-receiving-reading-sms-while-connected-with-ppp-under-freebsd-pfsense/31543
 also applies to MC7304 devices on NetBSD.

 While umb(4) could help to solve the above limitation it unfortunately puts
 the device in low power mode after a ifconfig umb0 down which is incompatible
 with my use case. Please feel free to close PR 56145 as a result.

 To reduce potential side effects for further umb(4) development on NetBSD
 it might help to apply the Aug 9 diff to if_umb.c before closing PR 56145.

 Thanks,
 Reinhard

State-Changed-From-To: feedback->needs-pullups
State-Changed-By: riastradh@NetBSD.org
State-Changed-When: Sun, 13 Oct 2024 02:09:52 +0000
State-Changed-Why:
feedback received, fixed in HEAD, needs pullup-10, maybe pullup-9


Responsible-Changed-From-To: kern-bug-people->christos
Responsible-Changed-By: riastradh@NetBSD.org
Responsible-Changed-When: Sun, 13 Oct 2024 13:43:09 +0000
Responsible-Changed-Why:
Can you take a look at the pullup?  The change is a little more than
what was posted here, and I don't have any u3g(4) devices to test.

(Also the change that was committed could use some KNF, we don't use
camelCase around these parts!)


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.47 2022/09/11 19:34:41 kim Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2024 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.