Skip to contentSkip to conversation

huawei_cdc_ncm introduction

PATCH RESEND Superseded Enrico Mioso 2 participants 5 messages Aug 22, 2013

Subsystems (5)

v2 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

v2 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 · 2 lines
This version includes mainly cosmetic fixes related to patches.
1.7.10.4
#1 lore raw

PATCH RESEND v2 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
index 43afde8..62686be 100644
@@ -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
index cc25b70..163244b 100644
@@ -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
#2 lore raw

PATCH RESEND v2 2/3 net: huawei_cdc_ncm: Introduce the huawei_cdc_ncm driver

In reply to Enrico Mioso

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
index d84bfd4..6e56751 100644
@@ -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
index e817178..fd0e6a7 100644
@@ -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
maintainer
#3 lore raw

Re: [PATCH RESEND net-next V2 2/3] net: huawei_cdc_ncm: Introduce the huawei_cdc_ncm driver

Quoted 2 lines · Enrico Mioso

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.

Line-wrap your changelog lines?

Quoted 7 lines
---
 drivers/net/usb/Kconfig  |   11 +++++++++++
 drivers/net/usb/Makefile |    1 +
 2 files changed, 12 insertions(+)

I think you forgot to add the driver to the patch :(

greg k-h

#4 lore raw

PATCH RESEND v2 3/3 net: cdc_ncm: remove non-standard NCM device IDs

In reply to Enrico Mioso

Remove 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
index 62686be..31f43f7 100644
@@ -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