aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/usb/cdc_mbim.c
diff options
context:
space:
mode:
authorBjørn Mork <bjorn@mork.no>2015-12-05 07:01:50 -0500
committerDavid S. Miller <davem@davemloft.net>2015-12-05 23:35:34 -0500
commitf8c0cfa5eca902d388c0b57c7ca29a1ff2e6d8c6 (patch)
treed717fcc9f38e6c4b1d2b996fd17f7c20e95abf05 /drivers/net/usb/cdc_mbim.c
parenta90099d9fabd2458084b9c2b79f1a62d9b76a61a (diff)
net: cdc_mbim: add "NDP to end" quirk for Huawei E3372
The Huawei E3372 (12d1:157d) needs this quirk in MBIM mode as well. Allow this by forcing the NTB to contain only a single NDP, and add a device specific entry for this ID. Due to the way Huawei use device IDs, this might be applied to other modems as well. It is assumed that those modems will be based on the same firmware and will need this quirk too. If not, it will still not harm normal usage, although multiplexing performance could be impacted. Cc: Enrico Mioso <mrkiko.rs@gmail.com> Reported-by: Sami Farin <hvtaifwkbgefbaei@gmail.com> Signed-off-by: Bjørn Mork <bjorn@mork.no> Acked-By: Enrico Mioso <mrkiko.rs@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/usb/cdc_mbim.c')
-rw-r--r--drivers/net/usb/cdc_mbim.c26
1 files changed, 25 insertions, 1 deletions
diff --git a/drivers/net/usb/cdc_mbim.c b/drivers/net/usb/cdc_mbim.c
index bbde9884ab8a..8973abdec9f6 100644
--- a/drivers/net/usb/cdc_mbim.c
+++ b/drivers/net/usb/cdc_mbim.c
@@ -158,7 +158,7 @@ static int cdc_mbim_bind(struct usbnet *dev, struct usb_interface *intf)
158 if (!cdc_ncm_comm_intf_is_mbim(intf->cur_altsetting)) 158 if (!cdc_ncm_comm_intf_is_mbim(intf->cur_altsetting))
159 goto err; 159 goto err;
160 160
161 ret = cdc_ncm_bind_common(dev, intf, data_altsetting, 0); 161 ret = cdc_ncm_bind_common(dev, intf, data_altsetting, dev->driver_info->data);
162 if (ret) 162 if (ret)
163 goto err; 163 goto err;
164 164
@@ -582,6 +582,26 @@ static const struct driver_info cdc_mbim_info_zlp = {
582 .tx_fixup = cdc_mbim_tx_fixup, 582 .tx_fixup = cdc_mbim_tx_fixup,
583}; 583};
584 584
585/* The spefication explicitly allows NDPs to be placed anywhere in the
586 * frame, but some devices fail unless the NDP is placed after the IP
587 * packets. Using the CDC_NCM_FLAG_NDP_TO_END flags to force this
588 * behaviour.
589 *
590 * Note: The current implementation of this feature restricts each NTB
591 * to a single NDP, implying that multiplexed sessions cannot share an
592 * NTB. This might affect performace for multiplexed sessions.
593 */
594static const struct driver_info cdc_mbim_info_ndp_to_end = {
595 .description = "CDC MBIM",
596 .flags = FLAG_NO_SETINT | FLAG_MULTI_PACKET | FLAG_WWAN,
597 .bind = cdc_mbim_bind,
598 .unbind = cdc_mbim_unbind,
599 .manage_power = cdc_mbim_manage_power,
600 .rx_fixup = cdc_mbim_rx_fixup,
601 .tx_fixup = cdc_mbim_tx_fixup,
602 .data = CDC_NCM_FLAG_NDP_TO_END,
603};
604
585static const struct usb_device_id mbim_devs[] = { 605static const struct usb_device_id mbim_devs[] = {
586 /* This duplicate NCM entry is intentional. MBIM devices can 606 /* This duplicate NCM entry is intentional. MBIM devices can
587 * be disguised as NCM by default, and this is necessary to 607 * be disguised as NCM by default, and this is necessary to
@@ -597,6 +617,10 @@ static const struct usb_device_id mbim_devs[] = {
597 { USB_VENDOR_AND_INTERFACE_INFO(0x0bdb, USB_CLASS_COMM, USB_CDC_SUBCLASS_MBIM, USB_CDC_PROTO_NONE), 617 { USB_VENDOR_AND_INTERFACE_INFO(0x0bdb, USB_CLASS_COMM, USB_CDC_SUBCLASS_MBIM, USB_CDC_PROTO_NONE),
598 .driver_info = (unsigned long)&cdc_mbim_info, 618 .driver_info = (unsigned long)&cdc_mbim_info,
599 }, 619 },
620 /* Huawei E3372 fails unless NDP comes after the IP packets */
621 { USB_DEVICE_AND_INTERFACE_INFO(0x12d1, 0x157d, USB_CLASS_COMM, USB_CDC_SUBCLASS_MBIM, USB_CDC_PROTO_NONE),
622 .driver_info = (unsigned long)&cdc_mbim_info_ndp_to_end,
623 },
600 /* default entry */ 624 /* default entry */
601 { USB_INTERFACE_INFO(USB_CLASS_COMM, USB_CDC_SUBCLASS_MBIM, USB_CDC_PROTO_NONE), 625 { USB_INTERFACE_INFO(USB_CLASS_COMM, USB_CDC_SUBCLASS_MBIM, USB_CDC_PROTO_NONE),
602 .driver_info = (unsigned long)&cdc_mbim_info_zlp, 626 .driver_info = (unsigned long)&cdc_mbim_info_zlp,