[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220407001926.11252-3-lech.perczak@gmail.com>
Date: Thu, 7 Apr 2022 02:19:25 +0200
From: Lech Perczak <lech.perczak@...il.com>
To: netdev@...r.kernel.org, linux-usb@...r.kernel.org
Cc: Lech Perczak <lech.perczak@...il.com>,
Kristian Evensen <kristian.evensen@...il.com>,
Bjørn Mork <bjorn@...k.no>,
Oliver Neukum <oliver@...kum.org>
Subject: [PATCH 2/3] rndis_host: enable the bogus MAC fixup for ZTE devices from cdc_ether
Certain ZTE modems, namely: MF823. MF831, MF910, built-in modem from
MF286R, expose both CDC-ECM and RNDIS network interfaces.
They have a trait of ignoring the locally-administered MAC address
configured on the interface both in CDC-ECM and RNDIS part,
and this leads to dropping of incoming traffic by the host.
However, the workaround was only present in CDC-ECM, and MF286R
explicitly requires it in RNDIS mode.
Re-use the workaround in rndis_host as well, to fix operation of MF286R
module, some versions of which expose only the RNDIS interface.
Apply the workaround to both "flavors" of RNDIS interfaces, as older ZTE
modems, like MF823 found in the wild, report the USB_CLASS_COMM class
interfaces, while MF286R reports USB_CLASS_WIRELESS_CONTROLLER.
Cc: Kristian Evensen <kristian.evensen@...il.com>
Cc: Bjørn Mork <bjorn@...k.no>
Cc: Oliver Neukum <oliver@...kum.org>
Signed-off-by: Lech Perczak <lech.perczak@...il.com>
---
drivers/net/usb/rndis_host.c | 24 ++++++++++++++++++++++++
1 file changed, 24 insertions(+)
diff --git a/drivers/net/usb/rndis_host.c b/drivers/net/usb/rndis_host.c
index 247f58cb0f84..a7eb032115e8 100644
--- a/drivers/net/usb/rndis_host.c
+++ b/drivers/net/usb/rndis_host.c
@@ -578,6 +578,10 @@ rndis_tx_fixup(struct usbnet *dev, struct sk_buff *skb, gfp_t flags)
}
EXPORT_SYMBOL_GPL(rndis_tx_fixup);
+static int zte_rndis_rx_fixup(struct usbnet *dev, struct sk_buff *skb)
+{
+ return rndis_rx_fixup(dev, skb) && usbnet_cdc_zte_rx_fixup(dev, skb);
+}
static const struct driver_info rndis_info = {
.description = "RNDIS device",
@@ -600,6 +604,16 @@ static const struct driver_info rndis_poll_status_info = {
.tx_fixup = rndis_tx_fixup,
};
+static const struct driver_info zte_rndis_info = {
+ .description = "ZTE RNDIS device",
+ .flags = FLAG_ETHER | FLAG_POINTTOPOINT | FLAG_FRAMING_RN | FLAG_NO_SETINT,
+ .bind = rndis_bind,
+ .unbind = rndis_unbind,
+ .status = rndis_status,
+ .rx_fixup = zte_rndis_rx_fixup,
+ .tx_fixup = rndis_tx_fixup,
+};
+
/*-------------------------------------------------------------------------*/
static const struct usb_device_id products [] = {
@@ -613,6 +627,16 @@ static const struct usb_device_id products [] = {
USB_VENDOR_AND_INTERFACE_INFO(0x238b,
USB_CLASS_COMM, 2 /* ACM */, 0x0ff),
.driver_info = (unsigned long)&rndis_info,
+}, {
+ /* ZTE WWAN modules */
+ USB_VENDOR_AND_INTERFACE_INFO(0x19d2,
+ USB_CLASS_WIRELESS_CONTROLLER, 1, 3),
+ .driver_info = (unsigned long)&zte_rndis_info,
+}, {
+ /* ZTE WWAN modules, ACM flavour */
+ USB_VENDOR_AND_INTERFACE_INFO(0x19d2,
+ USB_CLASS_COMM, 2 /* ACM */, 0x0ff),
+ .driver_info = (unsigned long)&zte_rndis_info,
}, {
/* RNDIS is MSFT's un-official variant of CDC ACM */
USB_INTERFACE_INFO(USB_CLASS_COMM, 2 /* ACM */, 0x0ff),
--
2.30.2
Powered by blists - more mailing lists