netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH RESEND net-next 0/3] huawei_cdc_ncm introduction
@ 2013-08-20 14:50 Enrico Mioso
  2013-08-20 14:50 ` [PATCH RESEND net-next 1/3] net: cdc_ncm: Export cdc_ncm_{tx,rx}_fixup functions for re-use Enrico Mioso
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Enrico Mioso @ 2013-08-20 14:50 UTC (permalink / raw)
  To: netdev; +Cc: Enrico Mioso


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(-)

-- 
1.7.10.4

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH RESEND net-next 1/3] net: cdc_ncm: Export cdc_ncm_{tx,rx}_fixup functions for re-use
  2013-08-20 14:50 [PATCH RESEND net-next 0/3] huawei_cdc_ncm introduction Enrico Mioso
@ 2013-08-20 14:50 ` Enrico Mioso
  2013-08-20 14:50 ` [PATCH RESEND net-next 2/3] net: huawei_cdc_ncm: Introduce the Enrico Mioso
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Enrico Mioso @ 2013-08-20 14:50 UTC (permalink / raw)
  To: netdev; +Cc: Enrico Mioso

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.

Signed-off-by: Enrico Mioso <mrkiko.rs@gmail.com>
---
 drivers/net/usb/cdc_ncm.c   |    6 ++++--
 include/linux/usb/cdc_ncm.h |    3 +++
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/drivers/net/usb/cdc_ncm.c b/drivers/net/usb/cdc_ncm.c
index 43afde8..62686be 100644
--- a/drivers/net/usb/cdc_ncm.c
+++ b/drivers/net/usb/cdc_ncm.c
@@ -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,
diff --git a/include/linux/usb/cdc_ncm.h b/include/linux/usb/cdc_ncm.h
index cc25b70..163244b 100644
--- a/include/linux/usb/cdc_ncm.h
+++ b/include/linux/usb/cdc_ncm.h
@@ -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);
-- 
1.7.10.4

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH RESEND net-next 2/3] net: huawei_cdc_ncm: Introduce the
  2013-08-20 14:50 [PATCH RESEND net-next 0/3] huawei_cdc_ncm introduction Enrico Mioso
  2013-08-20 14:50 ` [PATCH RESEND net-next 1/3] net: cdc_ncm: Export cdc_ncm_{tx,rx}_fixup functions for re-use Enrico Mioso
@ 2013-08-20 14:50 ` Enrico Mioso
  2013-08-20 14:50 ` [PATCH RESEND net-next 3/3] net: cdc_ncm: remove non-standard NCM device IDs Enrico Mioso
  2013-08-21 20:26 ` [PATCH RESEND net-next 0/3] huawei_cdc_ncm introduction Bjørn Mork
  3 siblings, 0 replies; 5+ messages in thread
From: Enrico Mioso @ 2013-08-20 14:50 UTC (permalink / raw)
  To: netdev; +Cc: Enrico Mioso

huawei_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.

Suggested-by: Bjorn Mork <bjorn@mork.no>
Signed-off-by: Enrico Mioso <mrkiko.rs@gmail.com>
---
 drivers/net/usb/Kconfig  |   11 +++++++++++
 drivers/net/usb/Makefile |    1 +
 2 files changed, 12 insertions(+)

diff --git a/drivers/net/usb/Kconfig b/drivers/net/usb/Kconfig
index d84bfd4..6e56751 100644
--- a/drivers/net/usb/Kconfig
+++ b/drivers/net/usb/Kconfig
@@ -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
diff --git a/drivers/net/usb/Makefile b/drivers/net/usb/Makefile
index e817178..fd0e6a7 100644
--- a/drivers/net/usb/Makefile
+++ b/drivers/net/usb/Makefile
@@ -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
-- 
1.7.10.4

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH RESEND net-next 3/3] net: cdc_ncm: remove non-standard NCM device IDs
  2013-08-20 14:50 [PATCH RESEND net-next 0/3] huawei_cdc_ncm introduction Enrico Mioso
  2013-08-20 14:50 ` [PATCH RESEND net-next 1/3] net: cdc_ncm: Export cdc_ncm_{tx,rx}_fixup functions for re-use Enrico Mioso
  2013-08-20 14:50 ` [PATCH RESEND net-next 2/3] net: huawei_cdc_ncm: Introduce the Enrico Mioso
@ 2013-08-20 14:50 ` Enrico Mioso
  2013-08-21 20:26 ` [PATCH RESEND net-next 0/3] huawei_cdc_ncm introduction Bjørn Mork
  3 siblings, 0 replies; 5+ messages in thread
From: Enrico Mioso @ 2013-08-20 14:50 UTC (permalink / raw)
  To: netdev; +Cc: Enrico Mioso

Remove device IDs of NCM-like (but not NCM-conformant) devices, that are
handled by the huawwei_cdc_ncm driver now.

Signed-off-by: Enrico Mioso <mrkiko.rs@gmail.com>
---
 drivers/net/usb/cdc_ncm.c |   11 -----------
 1 file changed, 11 deletions(-)

diff --git a/drivers/net/usb/cdc_ncm.c b/drivers/net/usb/cdc_ncm.c
index 62686be..31f43f7 100644
--- a/drivers/net/usb/cdc_ncm.c
+++ b/drivers/net/usb/cdc_ncm.c
@@ -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,
-- 
1.7.10.4

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH RESEND net-next 0/3] huawei_cdc_ncm introduction
  2013-08-20 14:50 [PATCH RESEND net-next 0/3] huawei_cdc_ncm introduction Enrico Mioso
                   ` (2 preceding siblings ...)
  2013-08-20 14:50 ` [PATCH RESEND net-next 3/3] net: cdc_ncm: remove non-standard NCM device IDs Enrico Mioso
@ 2013-08-21 20:26 ` Bjørn Mork
  3 siblings, 0 replies; 5+ messages in thread
From: Bjørn Mork @ 2013-08-21 20:26 UTC (permalink / raw)
  To: Enrico Mioso, netdev

Enrico Mioso <mrkiko.rs@gmail.com> wrote:
>
>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(-)

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 

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2013-08-21 20:26 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-08-20 14:50 [PATCH RESEND net-next 0/3] huawei_cdc_ncm introduction Enrico Mioso
2013-08-20 14:50 ` [PATCH RESEND net-next 1/3] net: cdc_ncm: Export cdc_ncm_{tx,rx}_fixup functions for re-use Enrico Mioso
2013-08-20 14:50 ` [PATCH RESEND net-next 2/3] net: huawei_cdc_ncm: Introduce the Enrico Mioso
2013-08-20 14:50 ` [PATCH RESEND net-next 3/3] net: cdc_ncm: remove non-standard NCM device IDs Enrico Mioso
2013-08-21 20:26 ` [PATCH RESEND net-next 0/3] huawei_cdc_ncm introduction Bjørn Mork

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).