huawei_cdc_ncm introduction
Subsystems (5)
cover huawei_cdc_ncm introduction
These patches are all related to the new huawei_cdc_ncm driver, supporting devices that use the NCM protocol as a transport layer for other protocols. this is the case of the Huawei E3131 3G modem.
Thanks should go to bjorn and others who helped me with patience.
Enrico Mioso (3):
net: cdc_ncm: Export cdc_ncm_{tx,rx}_fixup functions for re-use
net: huawei_cdc_ncm: Introduce the
net: cdc_ncm: remove non-standard NCM device IDs
drivers/net/usb/Kconfig | 11 +++++++++++ drivers/net/usb/Makefile | 1 + drivers/net/usb/cdc_ncm.c | 17 ++++------------- include/linux/usb/cdc_ncm.h | 3 +++ 4 files changed, 19 insertions(+), 13 deletions(-)
Signature · 1 line
1.7.10.4
PATCH RESEND 1/3 net: cdc_ncm: Export cdc_ncm_{tx,rx}_fixup functions for re-use
Some drivers implementing NCM-like protocols, may re-use those functions, as is the case in the huawei_cdc_ncm driver.
Export them via EXPORT_SYMBOL_GPL, in accordance with how other functions have been exported.
--- drivers/net/usb/cdc_ncm.c | 6 ++++-- include/linux/usb/cdc_ncm.h | 3 +++ 2 files changed, 7 insertions(+), 2 deletions(-)
drivers/net/usb/cdc_ncm.c +4 -2
@@ -858,7 +858,7 @@ static void cdc_ncm_txpath_bh(unsigned long param) } } -static struct sk_buff * +struct sk_buff *cdc_ncm_tx_fixup (struct usbnet *dev,struct sk_buff *skb,gfp_t flags) {struct sk_buff *skb_out;
@@ -885,6 +885,7 @@ error:return NULL ; } +EXPORT_SYMBOL_GPL (cdc_ncm_tx_fixup);/* verify NTB header and return offset of first NDP, or negative error */ int cdc_ncm_rx_verify_nth16 (struct cdc_ncm_ctx *ctx,struct sk_buff *skb_in)
@@ -965,7 +966,7 @@ error: }EXPORT_SYMBOL_GPL (cdc_ncm_rx_verify_ndp16); -static int cdc_ncm_rx_fixup (struct usbnet *dev,struct sk_buff *skb_in) +int cdc_ncm_rx_fixup (struct usbnet *dev,struct sk_buff *skb_in) {struct sk_buff *skb;struct cdc_ncm_ctx *ctx = (struct cdc_ncm_ctx *)dev->data[0 ];
@@ -1040,6 +1041,7 @@ err_ndp: error:return 0 ; } +EXPORT_SYMBOL_GPL (cdc_ncm_rx_fixup); static void cdc_ncm_speed_change(struct cdc_ncm_ctx *ctx,
include/linux/usb/cdc_ncm.h +3 -0
@@ -133,3 +133,6 @@ extern void cdc_ncm_unbind(struct usbnet *dev, struct usb_interface *intf);extern struct sk_buff *cdc_ncm_fill_tx_frame (struct cdc_ncm_ctx *ctx,struct sk_buff *skb,__le32 sign);extern int cdc_ncm_rx_verify_nth16 (struct cdc_ncm_ctx *ctx,struct sk_buff *skb_in);extern int cdc_ncm_rx_verify_ndp16 (struct sk_buff *skb_in,int ndpoffset); +struct sk_buff * +cdc_ncm_tx_fixup (struct usbnet *dev,struct sk_buff *skb,gfp_t flags); +int cdc_ncm_rx_fixup (struct usbnet *dev,struct sk_buff *skb_in);
Signature · 1 line
1.7.10.4
PATCH RESEND 2/3 net: huawei_cdc_ncm: Introduce the
In reply to Enrico Miosohuawei_cdc_ncm driver
This driver supports devices using the NCM protocol as an encapsulation layer
for other protocols, like the E3131 Huawei 3G modem. This driver was heavily inspired by the qmi_wwan approach & code model.
--- drivers/net/usb/Kconfig | 11 +++++++++++ drivers/net/usb/Makefile | 1 + 2 files changed, 12 insertions(+)
drivers/net/usb/Kconfig +11 -0
@@ -242,6 +242,17 @@ config USB_NET_CDC_NCM * ST-Ericsson M343 HSPA Mobile Broadband Modem (reference design) * Ericsson F5521gw Mobile Broadband Module +config USB_NET_HUAWEI_CDC_NCM + tristate "Huawei-style CDC NCM support" + depends on USB_USBNET + select USB_WDM + select USB_NET_CDC_NCM + help + This driver aims to support huawei-style NCM devices, that use ncm as a + transport for other protocols. + To compile this driver as a module, choose M here: the module will be + called huawei_cdc_ncm. + config USB_NET_CDC_MBIM tristate "CDC MBIM support" depends on USB_USBNET
drivers/net/usb/Makefile +1 -0
@@ -31,6 +31,7 @@ obj-$(CONFIG_USB_IPHETH) += ipheth.o obj-$(CONFIG_USB_SIERRA_NET) += sierra_net.o obj-$(CONFIG_USB_NET_CX82310_ETH) += cx82310_eth.o obj-$(CONFIG_USB_NET_CDC_NCM) += cdc_ncm.o +obj-$(CONFIG_USB_NET_HUAWEI_CDC_NCM) += huawei_cdc_ncm.o obj-$(CONFIG_USB_VL600) += lg-vl600.o obj-$(CONFIG_USB_NET_QMI_WWAN) += qmi_wwan.o obj-$(CONFIG_USB_NET_CDC_MBIM) += cdc_mbim.o
Signature · 1 line
1.7.10.4
PATCH RESEND 3/3 net: cdc_ncm: remove non-standard NCM device IDs
In reply to Enrico MiosoRemove device IDs of NCM-like (but not NCM-conformant) devices, that are handled by the huawwei_cdc_ncm driver now.
--- drivers/net/usb/cdc_ncm.c | 11 ----------- 1 file changed, 11 deletions(-)
drivers/net/usb/cdc_ncm.c +0 -11
@@ -1236,17 +1236,6 @@ static const struct usb_device_id cdc_devs[] = { .driver_info = (unsigned long)&wwan_info, }, -/* Huawei NCM devices disguised as vendor specific */ - { USB_VENDOR_AND_INTERFACE_INFO(0x12d1, 0xff, 0x02, 0x16), - .driver_info = (unsigned long )&wwan_info, - }, - { USB_VENDOR_AND_INTERFACE_INFO(0x12d1, 0xff, 0x02, 0x46), - .driver_info = (unsigned long)&wwan_info, - }, - { USB_VENDOR_AND_INTERFACE_INFO(0x12d1, 0xff, 0x02, 0x76), - .driver_info = (unsigned long)&wwan_info, - }, -/* Infineon(now Intel) HSPA Modem platform */ { USB_DEVICE_AND_INTERFACE_INFO(0x1519, 0x0443, USB_CLASS_COMM,
Signature · 1 line
1.7.10.4
Quoted 13 lines · Enrico Mioso
These patches are all related to the new
huawei_cdc_ncmdriver, supporting
devices that use the NCM protocol as a transport layer for other protocols.
this is the case of the Huawei E3131 3G modem.
Thanks should go to bjorn and others who helped me with patience.Enrico Mioso (3):
net:cdc_ncm: Export cdc_ncm_{tx,rx}_fixup functions for re-use
net:huawei_cdc_ncm: Introduce the
net:cdc_ncm: remove non-standard NCM device IDs
Quoted 5 lines
drivers/net/usb/Kconfig | 11 +++++++++++ drivers/net/usb/Makefile | 1 + drivers/net/usb/cdc_ncm.c | 17 ++++------------- include/linux/usb/cdc_ncm.h | 3 +++ 4 files changed, 19 insertions(+), 13 deletions(-)
Just for the record: I strongly support this.
The Huawei devices were added to the cdc_ncm driver without any understanding of the embedded management protocol. We initially believed that the devices could be managed through an associated serial port. Now that Enrico has found that this isn't necessarily true, and that the embedded protocol is simply AT commands, it is clear that we should expose the embedded protocol to userspace. The absolutely best way to do that is by creating a new driver for these devices, reusing the parts of cdc-wdm and cdc-ncm which are common. Just like Enrico has done here.
Thanks for doing this!
Bjørn