--- /dev/null
+From b626d9f088cd64a1e4d89fa03eb4019ab93c9582 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Sat, 20 Feb 2016 18:49:40 +0100
+Subject: Add Dell Wireless 5809e Gobi 4G HSPA+ Mobile Broadband Card (rev3) to
+ qmi_wwan
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Patrik Halfar <patrik_halfar@halfarit.cz>
+
+[ Upstream commit fb5eb24cdd5cdb83be77d3e4b2f16e92e06bd9e9 ]
+
+New revison of Dell Wireless 5809e Gobi 4G HSPA+ Mobile Broadband Card has new idProduct
+
+Bus 002 Device 006: ID 413c:81b3 Dell Computer Corp.
+Device Descriptor:
+ bLength 18
+ bDescriptorType 1
+ bcdUSB 2.00
+ bDeviceClass 0
+ bDeviceSubClass 0
+ bDeviceProtocol 0
+ bMaxPacketSize0 64
+ idVendor 0x413c Dell Computer Corp.
+ idProduct 0x81b3
+ bcdDevice 0.06
+ iManufacturer 1 Sierra Wireless, Incorporated
+ iProduct 2 Dell Wireless 5809e Gobi™ 4G HSPA+ Mobile Broadband Card
+ iSerial 3
+ bNumConfigurations 2
+
+Signed-off-by: Patrik Halfar <patrik_halfar@halfarit.cz>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/net/usb/qmi_wwan.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/drivers/net/usb/qmi_wwan.c b/drivers/net/usb/qmi_wwan.c
+index f8d00846b4a59..977df611164a6 100644
+--- a/drivers/net/usb/qmi_wwan.c
++++ b/drivers/net/usb/qmi_wwan.c
+@@ -913,6 +913,7 @@ static const struct usb_device_id products[] = {
+ {QMI_FIXED_INTF(0x413c, 0x81a8, 8)}, /* Dell Wireless 5808 Gobi(TM) 4G LTE Mobile Broadband Card */
+ {QMI_FIXED_INTF(0x413c, 0x81a9, 8)}, /* Dell Wireless 5808e Gobi(TM) 4G LTE Mobile Broadband Card */
+ {QMI_FIXED_INTF(0x413c, 0x81b1, 8)}, /* Dell Wireless 5809e Gobi(TM) 4G LTE Mobile Broadband Card */
++ {QMI_FIXED_INTF(0x413c, 0x81b3, 8)}, /* Dell Wireless 5809e Gobi(TM) 4G LTE Mobile Broadband Card (rev3) */
+ {QMI_FIXED_INTF(0x03f0, 0x4e1d, 8)}, /* HP lt4111 LTE/EV-DO/HSPA+ Gobi 4G Module */
+ {QMI_FIXED_INTF(0x03f0, 0x9d1d, 1)}, /* HP lt4120 Snapdragon X5 LTE */
+ {QMI_FIXED_INTF(0x22de, 0x9061, 3)}, /* WeTelecom WPD-600N */
+--
+2.25.1
+
--- /dev/null
+From cb764f6db097d0db53b7a8927350d9b60c62a13d Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 10 Apr 2017 17:34:23 +0200
+Subject: drivers: net: usb: qmi_wwan: add QMI_QUIRK_SET_DTR for Telit PID
+ 0x1201
+
+From: Daniele Palmas <dnlplm@gmail.com>
+
+[ Upstream commit 14cf4a771b3098e431d2677e3533bdd962e478d8 ]
+
+Telit LE920A4 uses the same pid 0x1201 of LE920, but modem
+implementation is different, since it requires DTR to be set for
+answering to qmi messages.
+
+This patch replaces QMI_FIXED_INTF with QMI_QUIRK_SET_DTR: tests on
+LE920 have been performed in order to verify backward compatibility.
+
+Signed-off-by: Daniele Palmas <dnlplm@gmail.com>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/net/usb/qmi_wwan.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/drivers/net/usb/qmi_wwan.c b/drivers/net/usb/qmi_wwan.c
+index d48639cfec370..36aadc89175f8 100644
+--- a/drivers/net/usb/qmi_wwan.c
++++ b/drivers/net/usb/qmi_wwan.c
+@@ -921,7 +921,7 @@ static const struct usb_device_id products[] = {
+ {QMI_FIXED_INTF(0x2357, 0x9000, 4)}, /* TP-LINK MA260 */
+ {QMI_QUIRK_SET_DTR(0x1bc7, 0x1040, 2)}, /* Telit LE922A */
+ {QMI_FIXED_INTF(0x1bc7, 0x1200, 5)}, /* Telit LE920 */
+- {QMI_FIXED_INTF(0x1bc7, 0x1201, 2)}, /* Telit LE920 */
++ {QMI_QUIRK_SET_DTR(0x1bc7, 0x1201, 2)}, /* Telit LE920, LE920A4 */
+ {QMI_FIXED_INTF(0x1c9e, 0x9b01, 3)}, /* XS Stick W100-2 from 4G Systems */
+ {QMI_FIXED_INTF(0x0b3c, 0xc000, 4)}, /* Olivetti Olicard 100 */
+ {QMI_FIXED_INTF(0x0b3c, 0xc001, 4)}, /* Olivetti Olicard 120 */
+--
+2.25.1
+
--- /dev/null
+From 34f74586f72b6dcbc09b74cddfe75a01cebee8f5 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 17 Dec 2015 12:44:04 +0100
+Subject: net: qmi_wwan: ignore bogus CDC Union descriptors
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Bjørn Mork <bjorn@mork.no>
+
+[ Upstream commit 34a55d5e858e81a20d33fd9490149d6a1058be0c ]
+
+The CDC descriptors found on these vendor specific functions should
+not be considered authoritative. They seem to be ignored by drivers
+for other systems, and the quality is therefore low.
+
+One device (1e0e:9001) has been reported to have such a bogus union
+descriptor on the QMI function, making it fail probing even if the
+device id was dynamically added. The report was not complete enough
+to allow adding a device entry for this modem. But this should at
+least fix the dynamic id probing problem.
+
+Reported-by: Kanerva Topi <Topi.Kanerva@cinia.fi>
+Signed-off-by: Bjørn Mork <bjorn@mork.no>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/net/usb/qmi_wwan.c | 5 ++++-
+ 1 file changed, 4 insertions(+), 1 deletion(-)
+
+diff --git a/drivers/net/usb/qmi_wwan.c b/drivers/net/usb/qmi_wwan.c
+index e75e984483bc5..f8d00846b4a59 100644
+--- a/drivers/net/usb/qmi_wwan.c
++++ b/drivers/net/usb/qmi_wwan.c
+@@ -374,7 +374,10 @@ static int qmi_wwan_bind(struct usbnet *dev, struct usb_interface *intf)
+ "bogus CDC Union: master=%u, slave=%u\n",
+ cdc_union->bMasterInterface0,
+ cdc_union->bSlaveInterface0);
+- goto err;
++
++ /* ignore and continue... */
++ cdc_union = NULL;
++ info->data = intf;
+ }
+ }
+
+--
+2.25.1
+
--- /dev/null
+From 0924a2ec947c42f09e38c5665cc1c4bf796f11e6 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 3 Dec 2015 19:24:18 +0100
+Subject: net: qmi_wwan: MDM9x30 specific power management
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Bjørn Mork <bjorn@mork.no>
+
+[ Upstream commit 93725149794d3d418cf1eddcae60c7b536c5faa1 ]
+
+MDM9x30 based modems appear to go into a deeper sleep when
+suspended without "Remote Wakeup" enabled. The QMI interface
+will not respond unless a "set DTR" control request is sent
+on resume. The effect is similar to a QMI_CTL SYNC request,
+resetting (some of) the firmware state.
+
+We allow userspace sessions to span multiple character device
+open/close sequences. This means that userspace can depend
+on firmware state while both the netdev and the character
+device are closed. We have disabled "needs_remote_wakeup" at
+this point to allow devices without remote wakeup support to
+be auto-suspended.
+
+To make sure the MDM9x30 keeps firmware state, we need to
+keep "needs_remote_wakeup" always set. We also need to
+issue a "set DTR" request to enable the QMI interface.
+
+Signed-off-by: Bjørn Mork <bjorn@mork.no>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/net/usb/qmi_wwan.c | 38 ++++++++++++++++++++++++++++++++++++++
+ 1 file changed, 38 insertions(+)
+
+diff --git a/drivers/net/usb/qmi_wwan.c b/drivers/net/usb/qmi_wwan.c
+index 4391430e25273..b8b15deb94bdb 100644
+--- a/drivers/net/usb/qmi_wwan.c
++++ b/drivers/net/usb/qmi_wwan.c
+@@ -223,6 +223,20 @@ err:
+ return rv;
+ }
+
++/* Send CDC SetControlLineState request, setting or clearing the DTR.
++ * "Required for Autoconnect and 9x30 to wake up" according to the
++ * GobiNet driver. The requirement has been verified on an MDM9230
++ * based Sierra Wireless MC7455
++ */
++static int qmi_wwan_change_dtr(struct usbnet *dev, bool on)
++{
++ u8 intf = dev->intf->cur_altsetting->desc.bInterfaceNumber;
++
++ return usbnet_write_cmd(dev, USB_CDC_REQ_SET_CONTROL_LINE_STATE,
++ USB_DIR_OUT | USB_TYPE_CLASS | USB_RECIP_INTERFACE,
++ on ? 0x01 : 0x00, intf, NULL, 0);
++}
++
+ static int qmi_wwan_bind(struct usbnet *dev, struct usb_interface *intf)
+ {
+ int status = -1;
+@@ -280,6 +294,24 @@ static int qmi_wwan_bind(struct usbnet *dev, struct usb_interface *intf)
+ usb_driver_release_interface(driver, info->data);
+ }
+
++ /* disabling remote wakeup on MDM9x30 devices has the same
++ * effect as clearing DTR. The device will not respond to QMI
++ * requests until we set DTR again. This is similar to a
++ * QMI_CTL SYNC request, clearing a lot of firmware state
++ * including the client ID allocations.
++ *
++ * Our usage model allows a session to span multiple
++ * open/close events, so we must prevent the firmware from
++ * clearing out state the clients might need.
++ *
++ * MDM9x30 is the first QMI chipset with USB3 support. Abuse
++ * this fact to enable the quirk.
++ */
++ if (le16_to_cpu(dev->udev->descriptor.bcdUSB) >= 0x0201) {
++ qmi_wwan_manage_power(dev, 1);
++ qmi_wwan_change_dtr(dev, true);
++ }
++
+ /* Never use the same address on both ends of the link, even if the
+ * buggy firmware told us to. Or, if device is assigned the well-known
+ * buggy firmware MAC address, replace it with a random address,
+@@ -307,6 +339,12 @@ static void qmi_wwan_unbind(struct usbnet *dev, struct usb_interface *intf)
+ if (info->subdriver && info->subdriver->disconnect)
+ info->subdriver->disconnect(info->control);
+
++ /* disable MDM9x30 quirk */
++ if (le16_to_cpu(dev->udev->descriptor.bcdUSB) >= 0x0201) {
++ qmi_wwan_change_dtr(dev, false);
++ qmi_wwan_manage_power(dev, 0);
++ }
++
+ /* allow user to unbind using either control or data */
+ if (intf == info->control)
+ other = info->data;
+--
+2.25.1
+
--- /dev/null
+From 4910176990624ed82adb9513ad234c1316ecaa53 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Sun, 6 Dec 2015 21:25:50 +0100
+Subject: net: qmi_wwan: should hold RTNL while changing netdev type
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Bjørn Mork <bjorn@mork.no>
+
+[ Upstream commit 6c730080e663b1d629f8aa89348291fbcdc46cd9 ]
+
+The notifier calls were thrown in as a last-minute fix for an
+imagined "this device could be part of a bridge" problem. That
+revealed a certain lack of locking. Not to mention testing...
+
+Avoid this splat:
+
+RTNL: assertion failed at net/core/dev.c (1639)
+CPU: 0 PID: 4293 Comm: bash Not tainted 4.4.0-rc3+ #358
+Hardware name: LENOVO 2776LEG/2776LEG, BIOS 6EET55WW (3.15 ) 12/19/2011
+ 0000000000000000 ffff8800ad253d60 ffffffff8122f7cf ffff8800ad253d98
+ ffff8800ad253d88 ffffffff813833ab 0000000000000002 ffff880230f48560
+ ffff880230a12900 ffff8800ad253da0 ffffffff813833da 0000000000000002
+Call Trace:
+ [<ffffffff8122f7cf>] dump_stack+0x4b/0x63
+ [<ffffffff813833ab>] call_netdevice_notifiers_info+0x3d/0x59
+ [<ffffffff813833da>] call_netdevice_notifiers+0x13/0x15
+ [<ffffffffa09be227>] raw_ip_store+0x81/0x193 [qmi_wwan]
+ [<ffffffff8131e149>] dev_attr_store+0x20/0x22
+ [<ffffffff811d858b>] sysfs_kf_write+0x49/0x50
+ [<ffffffff811d8027>] kernfs_fop_write+0x10a/0x151
+ [<ffffffff8117249a>] __vfs_write+0x26/0xa5
+ [<ffffffff81085ed4>] ? percpu_down_read+0x53/0x7f
+ [<ffffffff81174c9e>] ? __sb_start_write+0x5f/0xb0
+ [<ffffffff81174c9e>] ? __sb_start_write+0x5f/0xb0
+ [<ffffffff81172c37>] vfs_write+0xa3/0xe7
+ [<ffffffff811734ad>] SyS_write+0x50/0x7e
+ [<ffffffff8145c517>] entry_SYSCALL_64_fastpath+0x12/0x6f
+
+Fixes: 32f7adf633b9 ("net: qmi_wwan: support "raw IP" mode")
+Signed-off-by: Bjørn Mork <bjorn@mork.no>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/net/usb/qmi_wwan.c | 22 +++++++++++++++-------
+ 1 file changed, 15 insertions(+), 7 deletions(-)
+
+diff --git a/drivers/net/usb/qmi_wwan.c b/drivers/net/usb/qmi_wwan.c
+index d6ecb3ac25b6c..e75e984483bc5 100644
+--- a/drivers/net/usb/qmi_wwan.c
++++ b/drivers/net/usb/qmi_wwan.c
+@@ -16,6 +16,7 @@
+ #include <linux/etherdevice.h>
+ #include <linux/if_arp.h>
+ #include <linux/mii.h>
++#include <linux/rtnetlink.h>
+ #include <linux/usb.h>
+ #include <linux/usb/cdc.h>
+ #include <linux/usb/usbnet.h>
+@@ -92,7 +93,7 @@ static ssize_t raw_ip_store(struct device *d, struct device_attribute *attr, co
+ struct usbnet *dev = netdev_priv(to_net_dev(d));
+ struct qmi_wwan_state *info = (void *)&dev->data;
+ bool enable;
+- int err;
++ int ret;
+
+ if (strtobool(buf, &enable))
+ return -EINVAL;
+@@ -101,18 +102,22 @@ static ssize_t raw_ip_store(struct device *d, struct device_attribute *attr, co
+ if (enable == (info->flags & QMI_WWAN_FLAG_RAWIP))
+ return len;
+
++ if (!rtnl_trylock())
++ return restart_syscall();
++
+ /* we don't want to modify a running netdev */
+ if (netif_running(dev->net)) {
+ netdev_err(dev->net, "Cannot change a running device\n");
+- return -EBUSY;
++ ret = -EBUSY;
++ goto err;
+ }
+
+ /* let other drivers deny the change */
+- err = call_netdevice_notifiers(NETDEV_PRE_TYPE_CHANGE, dev->net);
+- err = notifier_to_errno(err);
+- if (err) {
++ ret = call_netdevice_notifiers(NETDEV_PRE_TYPE_CHANGE, dev->net);
++ ret = notifier_to_errno(ret);
++ if (ret) {
+ netdev_err(dev->net, "Type change was refused\n");
+- return err;
++ goto err;
+ }
+
+ if (enable)
+@@ -121,7 +126,10 @@ static ssize_t raw_ip_store(struct device *d, struct device_attribute *attr, co
+ info->flags &= ~QMI_WWAN_FLAG_RAWIP;
+ qmi_wwan_netdev_setup(dev->net);
+ call_netdevice_notifiers(NETDEV_POST_TYPE_CHANGE, dev->net);
+- return len;
++ ret = len;
++err:
++ rtnl_unlock();
++ return ret;
+ }
+
+ static DEVICE_ATTR_RW(raw_ip);
+--
+2.25.1
+
--- /dev/null
+From d90c5a4da414af1a71087409b13c283861e75d7d Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 3 Dec 2015 19:24:21 +0100
+Subject: net: qmi_wwan: support "raw IP" mode
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Bjørn Mork <bjorn@mork.no>
+
+[ Upstream commit 32f7adf633b9f99ad5089901bc7ebff57704aaa9 ]
+
+QMI wwan devices have traditionally emulated ethernet devices
+by default. But they have always had the capability of operating
+without any L2 header at all, transmitting and receiving "raw"
+IP packets over the USB link. This firmware feature used to be
+configurable through the QMI management protocol.
+
+Traditionally there was no way to verify the firmware mode
+without attempting to change it. And the firmware would often
+disallow changes anyway, i.e. due to a session already being
+established. In some cases, this could be a hidden firmware
+internal session, completely outside host control. For these
+reasons, sticking with the "well known" default mode was safest.
+
+But newer generations of QMI hardware and firmware have moved
+towards defaulting to "raw IP" mode instead, followed by an
+increasing number of bugs in the already buggy "802.3" firmware
+implementation. At the same time, the QMI management protocol
+gained the ability to detect the current mode. This has enabled
+the userspace QMI management application to verify the current
+firmware mode without trying to modify it.
+
+Following this development, the latest QMI hardware and firmware
+(the MDM9x30 generation) has dropped support for "802.3" mode
+entirely. Support for "raw IP" framing in the driver is therefore
+necessary for these devices, and to a certain degree to work
+around problems with the previous generation,
+
+This patch adds support for "raw IP" framing for QMI devices,
+changing the netdev from an ethernet device to an ARPHRD_NONE
+p-t-p device when "raw IP" framing is enabled.
+
+The firmware setup is fully delegated to the QMI userspace
+management application, through simple tunneling of the QMI
+protocol. The driver will therefore not know which mode has been
+"negotiated" between firmware and userspace. Allowing userspace
+to inform the driver of the result through a sysfs switch is
+considered a better alternative than to change the well established
+clean delegation of firmware management to userspace.
+
+Signed-off-by: Bjørn Mork <bjorn@mork.no>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/net/usb/qmi_wwan.c | 98 +++++++++++++++++++++++++++++++++++++-
+ 1 file changed, 97 insertions(+), 1 deletion(-)
+
+diff --git a/drivers/net/usb/qmi_wwan.c b/drivers/net/usb/qmi_wwan.c
+index b8b15deb94bdb..d6ecb3ac25b6c 100644
+--- a/drivers/net/usb/qmi_wwan.c
++++ b/drivers/net/usb/qmi_wwan.c
+@@ -14,6 +14,7 @@
+ #include <linux/netdevice.h>
+ #include <linux/ethtool.h>
+ #include <linux/etherdevice.h>
++#include <linux/if_arp.h>
+ #include <linux/mii.h>
+ #include <linux/usb.h>
+ #include <linux/usb/cdc.h>
+@@ -48,11 +49,93 @@
+ struct qmi_wwan_state {
+ struct usb_driver *subdriver;
+ atomic_t pmcount;
+- unsigned long unused;
++ unsigned long flags;
+ struct usb_interface *control;
+ struct usb_interface *data;
+ };
+
++enum qmi_wwan_flags {
++ QMI_WWAN_FLAG_RAWIP = 1 << 0,
++};
++
++static void qmi_wwan_netdev_setup(struct net_device *net)
++{
++ struct usbnet *dev = netdev_priv(net);
++ struct qmi_wwan_state *info = (void *)&dev->data;
++
++ if (info->flags & QMI_WWAN_FLAG_RAWIP) {
++ net->header_ops = NULL; /* No header */
++ net->type = ARPHRD_NONE;
++ net->hard_header_len = 0;
++ net->addr_len = 0;
++ net->flags = IFF_POINTOPOINT | IFF_NOARP | IFF_MULTICAST;
++ netdev_dbg(net, "mode: raw IP\n");
++ } else if (!net->header_ops) { /* don't bother if already set */
++ ether_setup(net);
++ netdev_dbg(net, "mode: Ethernet\n");
++ }
++
++ /* recalculate buffers after changing hard_header_len */
++ usbnet_change_mtu(net, net->mtu);
++}
++
++static ssize_t raw_ip_show(struct device *d, struct device_attribute *attr, char *buf)
++{
++ struct usbnet *dev = netdev_priv(to_net_dev(d));
++ struct qmi_wwan_state *info = (void *)&dev->data;
++
++ return sprintf(buf, "%c\n", info->flags & QMI_WWAN_FLAG_RAWIP ? 'Y' : 'N');
++}
++
++static ssize_t raw_ip_store(struct device *d, struct device_attribute *attr, const char *buf, size_t len)
++{
++ struct usbnet *dev = netdev_priv(to_net_dev(d));
++ struct qmi_wwan_state *info = (void *)&dev->data;
++ bool enable;
++ int err;
++
++ if (strtobool(buf, &enable))
++ return -EINVAL;
++
++ /* no change? */
++ if (enable == (info->flags & QMI_WWAN_FLAG_RAWIP))
++ return len;
++
++ /* we don't want to modify a running netdev */
++ if (netif_running(dev->net)) {
++ netdev_err(dev->net, "Cannot change a running device\n");
++ return -EBUSY;
++ }
++
++ /* let other drivers deny the change */
++ err = call_netdevice_notifiers(NETDEV_PRE_TYPE_CHANGE, dev->net);
++ err = notifier_to_errno(err);
++ if (err) {
++ netdev_err(dev->net, "Type change was refused\n");
++ return err;
++ }
++
++ if (enable)
++ info->flags |= QMI_WWAN_FLAG_RAWIP;
++ else
++ info->flags &= ~QMI_WWAN_FLAG_RAWIP;
++ qmi_wwan_netdev_setup(dev->net);
++ call_netdevice_notifiers(NETDEV_POST_TYPE_CHANGE, dev->net);
++ return len;
++}
++
++static DEVICE_ATTR_RW(raw_ip);
++
++static struct attribute *qmi_wwan_sysfs_attrs[] = {
++ &dev_attr_raw_ip.attr,
++ NULL,
++};
++
++static struct attribute_group qmi_wwan_sysfs_attr_group = {
++ .name = "qmi",
++ .attrs = qmi_wwan_sysfs_attrs,
++};
++
+ /* default ethernet address used by the modem */
+ static const u8 default_modem_addr[ETH_ALEN] = {0x02, 0x50, 0xf3};
+
+@@ -80,6 +163,8 @@ static const u8 buggy_fw_addr[ETH_ALEN] = {0x00, 0xa0, 0xc6, 0x00, 0x00, 0x00};
+ */
+ static int qmi_wwan_rx_fixup(struct usbnet *dev, struct sk_buff *skb)
+ {
++ struct qmi_wwan_state *info = (void *)&dev->data;
++ bool rawip = info->flags & QMI_WWAN_FLAG_RAWIP;
+ __be16 proto;
+
+ /* This check is no longer done by usbnet */
+@@ -94,15 +179,25 @@ static int qmi_wwan_rx_fixup(struct usbnet *dev, struct sk_buff *skb)
+ proto = htons(ETH_P_IPV6);
+ break;
+ case 0x00:
++ if (rawip)
++ return 0;
+ if (is_multicast_ether_addr(skb->data))
+ return 1;
+ /* possibly bogus destination - rewrite just in case */
+ skb_reset_mac_header(skb);
+ goto fix_dest;
+ default:
++ if (rawip)
++ return 0;
+ /* pass along other packets without modifications */
+ return 1;
+ }
++ if (rawip) {
++ skb->dev = dev->net; /* normally set by eth_type_trans */
++ skb->protocol = proto;
++ return 1;
++ }
++
+ if (skb_headroom(skb) < ETH_HLEN)
+ return 0;
+ skb_push(skb, ETH_HLEN);
+@@ -326,6 +421,7 @@ static int qmi_wwan_bind(struct usbnet *dev, struct usb_interface *intf)
+ dev->net->dev_addr[0] &= 0xbf; /* clear "IP" bit */
+ }
+ dev->net->netdev_ops = &qmi_wwan_netdev_ops;
++ dev->net->sysfs_groups[0] = &qmi_wwan_sysfs_attr_group;
+ err:
+ return status;
+ }
+--
+2.25.1
+
--- /dev/null
+From 620ee301cfd74a53d9b09910b978baf048cbd8b4 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 1 Dec 2016 16:52:05 +0100
+Subject: NET: usb: qmi_wwan: add support for Telit LE922A PID 0x1040
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Daniele Palmas <dnlplm@gmail.com>
+
+[ Upstream commit 9bd813da24cd49d749911d7fdc0e9ae9a673d746 ]
+
+This patch adds support for PID 0x1040 of Telit LE922A.
+
+The qmi adapter requires to have DTR set for proper working,
+so QMI_WWAN_QUIRK_DTR has been enabled.
+
+Signed-off-by: Daniele Palmas <dnlplm@gmail.com>
+Acked-by: Bjørn Mork <bjorn@mork.no>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/net/usb/qmi_wwan.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/drivers/net/usb/qmi_wwan.c b/drivers/net/usb/qmi_wwan.c
+index ffb2499a222da..d48639cfec370 100644
+--- a/drivers/net/usb/qmi_wwan.c
++++ b/drivers/net/usb/qmi_wwan.c
+@@ -919,6 +919,7 @@ static const struct usb_device_id products[] = {
+ {QMI_FIXED_INTF(0x1bbb, 0x0203, 2)}, /* Alcatel L800MA */
+ {QMI_FIXED_INTF(0x2357, 0x0201, 4)}, /* TP-LINK HSUPA Modem MA180 */
+ {QMI_FIXED_INTF(0x2357, 0x9000, 4)}, /* TP-LINK MA260 */
++ {QMI_QUIRK_SET_DTR(0x1bc7, 0x1040, 2)}, /* Telit LE922A */
+ {QMI_FIXED_INTF(0x1bc7, 0x1200, 5)}, /* Telit LE920 */
+ {QMI_FIXED_INTF(0x1bc7, 0x1201, 2)}, /* Telit LE920 */
+ {QMI_FIXED_INTF(0x1c9e, 0x9b01, 3)}, /* XS Stick W100-2 from 4G Systems */
+--
+2.25.1
+
--- /dev/null
+From 3a66ce614808b1e8ef02d8bf1dc755c4219c78be Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 9 Oct 2019 11:07:18 +0200
+Subject: net: usb: qmi_wwan: add Telit 0x1050 composition
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Daniele Palmas <dnlplm@gmail.com>
+
+[ Upstream commit e0ae2c578d3909e60e9448207f5d83f785f1129f ]
+
+This patch adds support for Telit FN980 0x1050 composition
+
+0x1050: tty, adb, rmnet, tty, tty, tty, tty
+
+Signed-off-by: Daniele Palmas <dnlplm@gmail.com>
+Acked-by: Bjørn Mork <bjorn@mork.no>
+Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/net/usb/qmi_wwan.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/drivers/net/usb/qmi_wwan.c b/drivers/net/usb/qmi_wwan.c
+index c5c8224fc8cb3..14eca1f80ce36 100644
+--- a/drivers/net/usb/qmi_wwan.c
++++ b/drivers/net/usb/qmi_wwan.c
+@@ -921,6 +921,7 @@ static const struct usb_device_id products[] = {
+ {QMI_FIXED_INTF(0x2357, 0x0201, 4)}, /* TP-LINK HSUPA Modem MA180 */
+ {QMI_FIXED_INTF(0x2357, 0x9000, 4)}, /* TP-LINK MA260 */
+ {QMI_QUIRK_SET_DTR(0x1bc7, 0x1040, 2)}, /* Telit LE922A */
++ {QMI_QUIRK_SET_DTR(0x1bc7, 0x1050, 2)}, /* Telit FN980 */
+ {QMI_FIXED_INTF(0x1bc7, 0x1100, 3)}, /* Telit ME910 */
+ {QMI_FIXED_INTF(0x1bc7, 0x1200, 5)}, /* Telit LE920 */
+ {QMI_QUIRK_SET_DTR(0x1bc7, 0x1201, 2)}, /* Telit LE920, LE920A4 */
+--
+2.25.1
+
--- /dev/null
+From 20200989468985a30ced0a352ea30aa1b622ead5 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 3 May 2017 10:30:11 +0200
+Subject: net: usb: qmi_wwan: add Telit ME910 support
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Daniele Palmas <dnlplm@gmail.com>
+
+[ Upstream commit 4c54dc0277d0d55a9248c43aebd31858f926a056 ]
+
+This patch adds support for Telit ME910 PID 0x1100.
+
+Signed-off-by: Daniele Palmas <dnlplm@gmail.com>
+Acked-by: Bjørn Mork <bjorn@mork.no>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/net/usb/qmi_wwan.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/drivers/net/usb/qmi_wwan.c b/drivers/net/usb/qmi_wwan.c
+index ce3b810395224..c5c8224fc8cb3 100644
+--- a/drivers/net/usb/qmi_wwan.c
++++ b/drivers/net/usb/qmi_wwan.c
+@@ -921,6 +921,7 @@ static const struct usb_device_id products[] = {
+ {QMI_FIXED_INTF(0x2357, 0x0201, 4)}, /* TP-LINK HSUPA Modem MA180 */
+ {QMI_FIXED_INTF(0x2357, 0x9000, 4)}, /* TP-LINK MA260 */
+ {QMI_QUIRK_SET_DTR(0x1bc7, 0x1040, 2)}, /* Telit LE922A */
++ {QMI_FIXED_INTF(0x1bc7, 0x1100, 3)}, /* Telit ME910 */
+ {QMI_FIXED_INTF(0x1bc7, 0x1200, 5)}, /* Telit LE920 */
+ {QMI_QUIRK_SET_DTR(0x1bc7, 0x1201, 2)}, /* Telit LE920, LE920A4 */
+ {QMI_FIXED_INTF(0x1c9e, 0x9b01, 3)}, /* XS Stick W100-2 from 4G Systems */
+--
+2.25.1
+
--- /dev/null
+From ec77d921ae1885c24e689382a555f00425027a6f Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 10 Oct 2016 21:12:49 +0200
+Subject: qmi_wwan: add support for Quectel EC21 and EC25
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Bjørn Mork <bjorn@mork.no>
+
+[ Upstream commit 9a765881bf3dcd32847d7108cf48cb04a4ed993f ]
+
+The Quectel EC21 and EC25 need the same "set DTR" request as devices
+based on the MDM9230 chipset, but has no USB3 support. Our best guess
+is that the "set DTR" functionality depends on chipset and/or
+baseband firmware generation. But USB3 is still an optional feature.
+
+Since we cannot enable this unconditionally for all older devices, and
+there doesn't appear to be anything we can use in the USB descriptors
+to identify these chips, we are forced to use a device specific quirk
+flag.
+
+Reported-and-tested-by: Sebastian Sjoholm <sebastian.sjoholm@gmail.com>
+Signed-off-by: Bjørn Mork <bjorn@mork.no>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/net/usb/qmi_wwan.c | 30 ++++++++++++++++++++++++++++--
+ 1 file changed, 28 insertions(+), 2 deletions(-)
+
+diff --git a/drivers/net/usb/qmi_wwan.c b/drivers/net/usb/qmi_wwan.c
+index ec03cf1f107bc..ffb2499a222da 100644
+--- a/drivers/net/usb/qmi_wwan.c
++++ b/drivers/net/usb/qmi_wwan.c
+@@ -59,6 +59,10 @@ enum qmi_wwan_flags {
+ QMI_WWAN_FLAG_RAWIP = 1 << 0,
+ };
+
++enum qmi_wwan_quirks {
++ QMI_WWAN_QUIRK_DTR = 1 << 0, /* needs "set DTR" request */
++};
++
+ static void qmi_wwan_netdev_setup(struct net_device *net)
+ {
+ struct usbnet *dev = netdev_priv(net);
+@@ -411,9 +415,14 @@ static int qmi_wwan_bind(struct usbnet *dev, struct usb_interface *intf)
+ * clearing out state the clients might need.
+ *
+ * MDM9x30 is the first QMI chipset with USB3 support. Abuse
+- * this fact to enable the quirk.
++ * this fact to enable the quirk for all USB3 devices.
++ *
++ * There are also chipsets with the same "set DTR" requirement
++ * but without USB3 support. Devices based on these chips
++ * need a quirk flag in the device ID table.
+ */
+- if (le16_to_cpu(dev->udev->descriptor.bcdUSB) >= 0x0201) {
++ if (dev->driver_info->data & QMI_WWAN_QUIRK_DTR ||
++ le16_to_cpu(dev->udev->descriptor.bcdUSB) >= 0x0201) {
+ qmi_wwan_manage_power(dev, 1);
+ qmi_wwan_change_dtr(dev, true);
+ }
+@@ -526,6 +535,16 @@ static const struct driver_info qmi_wwan_info = {
+ .rx_fixup = qmi_wwan_rx_fixup,
+ };
+
++static const struct driver_info qmi_wwan_info_quirk_dtr = {
++ .description = "WWAN/QMI device",
++ .flags = FLAG_WWAN,
++ .bind = qmi_wwan_bind,
++ .unbind = qmi_wwan_unbind,
++ .manage_power = qmi_wwan_manage_power,
++ .rx_fixup = qmi_wwan_rx_fixup,
++ .data = QMI_WWAN_QUIRK_DTR,
++};
++
+ #define HUAWEI_VENDOR_ID 0x12D1
+
+ /* map QMI/wwan function by a fixed interface number */
+@@ -533,6 +552,11 @@ static const struct driver_info qmi_wwan_info = {
+ USB_DEVICE_INTERFACE_NUMBER(vend, prod, num), \
+ .driver_info = (unsigned long)&qmi_wwan_info
+
++/* devices requiring "set DTR" quirk */
++#define QMI_QUIRK_SET_DTR(vend, prod, num) \
++ USB_DEVICE_INTERFACE_NUMBER(vend, prod, num), \
++ .driver_info = (unsigned long)&qmi_wwan_info_quirk_dtr
++
+ /* Gobi 1000 QMI/wwan interface number is 3 according to qcserial */
+ #define QMI_GOBI1K_DEVICE(vend, prod) \
+ QMI_FIXED_INTF(vend, prod, 3)
+@@ -921,6 +945,8 @@ static const struct usb_device_id products[] = {
+ {QMI_FIXED_INTF(0x03f0, 0x9d1d, 1)}, /* HP lt4120 Snapdragon X5 LTE */
+ {QMI_FIXED_INTF(0x22de, 0x9061, 3)}, /* WeTelecom WPD-600N */
+ {QMI_FIXED_INTF(0x1e0e, 0x9001, 5)}, /* SIMCom 7230E */
++ {QMI_QUIRK_SET_DTR(0x2c7c, 0x0125, 4)}, /* Quectel EC25, EC20 R2.0 Mini PCIe */
++ {QMI_QUIRK_SET_DTR(0x2c7c, 0x0121, 4)}, /* Quectel EC21 Mini PCIe */
+
+ /* 4. Gobi 1000 devices */
+ {QMI_GOBI1K_DEVICE(0x05c6, 0x9212)}, /* Acer Gobi Modem Device */
+--
+2.25.1
+
--- /dev/null
+From ad0e9841a887bdb08b752c9e4c09d32891878bbf Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 17 Mar 2016 10:07:56 +0000
+Subject: qmi_wwan: Added support for Gemalto's Cinterion PHxx WWAN interface
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Schemmel Hans-Christoph <Hans-Christoph.Schemmel@gemalto.com>
+
+[ Upstream commit bd9e33508c5e1eb5d807d11d7bfc52125fcdb04e ]
+
+Added support for Gemalto's Cinterion PHxx WWAN interfaces
+by adding QMI_FIXED_INTF with Cinterion's VID and PID.
+
+PHxx can have:
+2 RmNet Interfaces (PID 0x0082) or
+1 RmNet + 1 USB Audio interface (PID 0x0083).
+
+Signed-off-by: Hans-Christoph Schemmel <hans-christoph.schemmel@gemalto.com>
+Acked-by: Bjørn Mork <bjorn@mork.no>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/net/usb/qmi_wwan.c | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/drivers/net/usb/qmi_wwan.c b/drivers/net/usb/qmi_wwan.c
+index 977df611164a6..ec03cf1f107bc 100644
+--- a/drivers/net/usb/qmi_wwan.c
++++ b/drivers/net/usb/qmi_wwan.c
+@@ -907,6 +907,9 @@ static const struct usb_device_id products[] = {
+ {QMI_FIXED_INTF(0x0b3c, 0xc00b, 4)}, /* Olivetti Olicard 500 */
+ {QMI_FIXED_INTF(0x1e2d, 0x0060, 4)}, /* Cinterion PLxx */
+ {QMI_FIXED_INTF(0x1e2d, 0x0053, 4)}, /* Cinterion PHxx,PXxx */
++ {QMI_FIXED_INTF(0x1e2d, 0x0082, 4)}, /* Cinterion PHxx,PXxx (2 RmNet) */
++ {QMI_FIXED_INTF(0x1e2d, 0x0082, 5)}, /* Cinterion PHxx,PXxx (2 RmNet) */
++ {QMI_FIXED_INTF(0x1e2d, 0x0083, 4)}, /* Cinterion PHxx,PXxx (1 RmNet + USB Audio)*/
+ {QMI_FIXED_INTF(0x413c, 0x81a2, 8)}, /* Dell Wireless 5806 Gobi(TM) 4G LTE Mobile Broadband Card */
+ {QMI_FIXED_INTF(0x413c, 0x81a3, 8)}, /* Dell Wireless 5570 HSPA+ (42Mbps) Mobile Broadband Card */
+ {QMI_FIXED_INTF(0x413c, 0x81a4, 8)}, /* Dell Wireless 5570e HSPA+ (42Mbps) Mobile Broadband Card */
+--
+2.25.1
+
uaccess-add-non-pagefault-user-space-read-functions.patch
uaccess-add-non-pagefault-user-space-write-function.patch
btrfs-fix-potential-deadlock-in-the-search-ioctl.patch
+net-qmi_wwan-mdm9x30-specific-power-management.patch
+net-qmi_wwan-support-raw-ip-mode.patch
+net-qmi_wwan-should-hold-rtnl-while-changing-netdev-.patch
+net-qmi_wwan-ignore-bogus-cdc-union-descriptors.patch
+add-dell-wireless-5809e-gobi-4g-hspa-mobile-broadban.patch
+qmi_wwan-added-support-for-gemalto-s-cinterion-phxx-.patch
+qmi_wwan-add-support-for-quectel-ec21-and-ec25.patch
+net-usb-qmi_wwan-add-support-for-telit-le922a-pid-0x.patch
+drivers-net-usb-qmi_wwan-add-qmi_quirk_set_dtr-for-t.patch
+usb-qmi_wwan-add-d-link-dwm-222-a2-device-id.patch
+net-usb-qmi_wwan-add-telit-me910-support.patch
+net-usb-qmi_wwan-add-telit-0x1050-composition.patch
--- /dev/null
+From 21f4c44ff5b8ab0fbc1e3b607f1724a40783c4fc Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 17 Jul 2019 11:14:33 +0200
+Subject: usb: qmi_wwan: add D-Link DWM-222 A2 device ID
+
+From: Rogan Dawes <rogan@dawes.za.net>
+
+[ Upstream commit 7d6053097311643545a8118100175a39bd6fa637 ]
+
+Signed-off-by: Rogan Dawes <rogan@dawes.za.net>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/net/usb/qmi_wwan.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/drivers/net/usb/qmi_wwan.c b/drivers/net/usb/qmi_wwan.c
+index 36aadc89175f8..ce3b810395224 100644
+--- a/drivers/net/usb/qmi_wwan.c
++++ b/drivers/net/usb/qmi_wwan.c
+@@ -886,6 +886,7 @@ static const struct usb_device_id products[] = {
+ {QMI_FIXED_INTF(0x19d2, 0x2002, 4)}, /* ZTE (Vodafone) K3765-Z */
+ {QMI_FIXED_INTF(0x2001, 0x7e19, 4)}, /* D-Link DWM-221 B1 */
+ {QMI_FIXED_INTF(0x2001, 0x7e35, 4)}, /* D-Link DWM-222 */
++ {QMI_FIXED_INTF(0x2001, 0x7e3d, 4)}, /* D-Link DWM-222 A2 */
+ {QMI_FIXED_INTF(0x2020, 0x2031, 4)}, /* Olicard 600 */
+ {QMI_FIXED_INTF(0x2020, 0x2033, 4)}, /* BroadMobi BM806U */
+ {QMI_FIXED_INTF(0x2020, 0x2060, 4)}, /* BroadMobi BM818 */
+--
+2.25.1
+