Commit f8c0cfa5 authored by Bjørn Mork's avatar Bjørn Mork Committed by David S. Miller
Browse files

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 <>
Reported-by: default avatarSami Farin <>
Signed-off-by: default avatarBjørn Mork <>
Acked-By: default avatarEnrico Mioso <>
Signed-off-by: default avatarDavid S. Miller <>
parent a90099d9
......@@ -158,7 +158,7 @@ static int cdc_mbim_bind(struct usbnet *dev, struct usb_interface *intf)
if (!cdc_ncm_comm_intf_is_mbim(intf->cur_altsetting))
goto err;
ret = cdc_ncm_bind_common(dev, intf, data_altsetting, 0);
ret = cdc_ncm_bind_common(dev, intf, data_altsetting, dev->driver_info->data);
if (ret)
goto err;
......@@ -582,6 +582,26 @@ static const struct driver_info cdc_mbim_info_zlp = {
.tx_fixup = cdc_mbim_tx_fixup,
/* The spefication explicitly allows NDPs to be placed anywhere in the
* frame, but some devices fail unless the NDP is placed after the IP
* packets. Using the CDC_NCM_FLAG_NDP_TO_END flags to force this
* behaviour.
* Note: The current implementation of this feature restricts each NTB
* to a single NDP, implying that multiplexed sessions cannot share an
* NTB. This might affect performace for multiplexed sessions.
static const struct driver_info cdc_mbim_info_ndp_to_end = {
.description = "CDC MBIM",
.bind = cdc_mbim_bind,
.unbind = cdc_mbim_unbind,
.manage_power = cdc_mbim_manage_power,
.rx_fixup = cdc_mbim_rx_fixup,
.tx_fixup = cdc_mbim_tx_fixup,
static const struct usb_device_id mbim_devs[] = {
/* This duplicate NCM entry is intentional. MBIM devices can
* be disguised as NCM by default, and this is necessary to
......@@ -597,6 +617,10 @@ static const struct usb_device_id mbim_devs[] = {
.driver_info = (unsigned long)&cdc_mbim_info,
/* Huawei E3372 fails unless NDP comes after the IP packets */
.driver_info = (unsigned long)&cdc_mbim_info_ndp_to_end,
/* default entry */
.driver_info = (unsigned long)&cdc_mbim_info_zlp,
......@@ -955,10 +955,18 @@ static struct usb_cdc_ncm_ndp16 *cdc_ncm_ndp(struct cdc_ncm_ctx *ctx, struct sk_
* NTH16 header as we would normally do. NDP isn't written to the SKB yet, and
* the wNdpIndex field in the header is actually not consistent with reality. It will be later.
if (ctx->drvflags & CDC_NCM_FLAG_NDP_TO_END)
if (ctx->drvflags & CDC_NCM_FLAG_NDP_TO_END) {
if (ctx->delayed_ndp16->dwSignature == sign)
return ctx->delayed_ndp16;
/* We can only push a single NDP to the end. Return
* NULL to send what we've already got and queue this
* skb for later.
else if (ctx->delayed_ndp16->dwSignature)
return NULL;
/* follow the chain of NDPs, looking for a match */
while (ndpoffset) {
ndp16 = (struct usb_cdc_ncm_ndp16 *)(skb->data + ndpoffset);
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment