Re: [PATCH] USB: serial: move the simple drivers into usb-serial-simple.c
Flashloader looks good. I totally agree put all these kind of simple drivers into one 2013/8/5 Dan Williams d...@redhat.com: On Mon, 2013-08-05 at 19:41 +0800, Greg Kroah-Hartman wrote: From: Greg Kroah-Hartman gre...@linuxfoundation.org Instead of having to create a new driver for a simple usb to serial device, mush them all into one file, with a macro, so as to make it easy to add new ones. Cc: René Bürgel rene.buer...@sohard.de Cc: Wei Shuai cpuw...@gmail.com Cc: Josh Triplett j...@joshtriplett.org Cc: Frans Klaver frans.kla...@xsens.com Cc: Wesley W. Terpstra w.terps...@gsi.de Cc: Johan Hovold jhov...@gmail.com Signed-off-by: Greg Kroah-Hartman gre...@linuxfoundation.org --- Warning, compile tested only for now. drivers/usb/serial/Kconfig | 84 + drivers/usb/serial/Makefile|9 -- drivers/usb/serial/flashloader.c | 39 --- drivers/usb/serial/funsoft.c | 40 drivers/usb/serial/hp4x.c | 51 --- drivers/usb/serial/moto_modem.c| 48 -- drivers/usb/serial/siemens_mpi.c | 47 -- drivers/usb/serial/suunto.c| 41 drivers/usb/serial/usb-serial-simple.c | 110 + drivers/usb/serial/vivopay-serial.c| 43 drivers/usb/serial/zio.c | 39 --- 11 files changed, 129 insertions(+), 422 deletions(-) --- a/drivers/usb/serial/Kconfig +++ b/drivers/usb/serial/Kconfig @@ -51,6 +51,24 @@ config USB_SERIAL_GENERIC support be compiled as a module for this driver to be used properly. +config USB_SERIAL_SIMPLE + tristate USB Serial Simple Driver + help + Say Y here to use the USB serial simple driver. This driver + handles a wide range of very simple devices, all in one + driver. Specifically, it supports: + - Suunto ANT+ USB device. + - Fundamental Software dongle. + - HP4x calculators + - a number of Motoroloa phones + - Siemens USB/MPI adapter. + - ViVOtech ViVOpay USB device. + - Infineon Modem Flashloader USB interface + - ZIO Motherboard USB serial interface + + To compile this driver as a module, choose M here: the module + will be called usb-serial-simple. + config USB_SERIAL_AIRCABLE tristate USB AIRcable Bluetooth Dongle Driver help @@ -158,14 +176,6 @@ config USB_SERIAL_FTDI_SIO To compile this driver as a module, choose M here: the module will be called ftdi_sio. -config USB_SERIAL_FUNSOFT - tristate USB Fundamental Software Dongle Driver - ---help--- - Say Y here if you want to use the Fundamental Software dongle. - - To compile this driver as a module, choose M here: the - module will be called funsoft. - config USB_SERIAL_VISOR tristate USB Handspring Visor / Palm m50x / Sony Clie Driver help @@ -462,15 +472,6 @@ config USB_SERIAL_MOS7840 To compile this driver as a module, choose M here: the module will be called mos7840. If unsure, choose N. -config USB_SERIAL_MOTOROLA - tristate USB Motorola Phone modem driver - ---help--- - Say Y here if you want to use a Motorola phone with a USB - connector as a modem link. - - To compile this driver as a module, choose M here: the - module will be called moto_modem. If unsure, choose N. - config USB_SERIAL_NAVMAN tristate USB Navman GPS device help @@ -525,14 +526,6 @@ config USB_SERIAL_SPCP8X5 To compile this driver as a module, choose M here: the module will be called spcp8x5. -config USB_SERIAL_HP4X -tristate USB HP4x Calculators support -help - Say Y here if you want to use an Hewlett-Packard 4x Calculator. - - To compile this driver as a module, choose M here: the - module will be called hp4x. - config USB_SERIAL_SAFE tristate USB Safe Serial (Encapsulated) Driver @@ -540,14 +533,6 @@ config USB_SERIAL_SAFE_PADDED bool USB Secure Encapsulated Driver - Padded depends on USB_SERIAL_SAFE -config USB_SERIAL_SIEMENS_MPI - tristate USB Siemens MPI driver - help - Say M here if you want to use a Siemens USB/MPI adapter. - - To compile this driver as a module, choose M here: the - module will be called siemens_mpi. - config USB_SERIAL_SIERRAWIRELESS tristate USB Sierra Wireless Driver help @@ -639,14 +624,6 @@ config USB_SERIAL_OPTICON To compile this driver as a module, choose M here: the module will be called opticon. -config USB_SERIAL_VIVOPAY_SERIAL -tristate USB ViVOpay serial interface driver -help - Say Y here if you want to use a ViVOtech ViVOpay
[PATCH] USB: serial: add support Infineon modem USB flashloader driver
If you want to download Infineon modem via USB, this Infineon USB flashloader driver is required. Signed-off-by: Wei Shuai cpuw...@gmail.com --- drivers/usb/serial/Kconfig | 10 ++ drivers/usb/serial/Makefile |1 + drivers/usb/serial/flashloader.c | 39 ++ 3 files changed, 50 insertions(+) create mode 100644 drivers/usb/serial/flashloader.c diff --git a/drivers/usb/serial/Kconfig b/drivers/usb/serial/Kconfig index 17b7f9a..cccd495 100644 --- a/drivers/usb/serial/Kconfig +++ b/drivers/usb/serial/Kconfig @@ -693,6 +693,16 @@ config USB_SERIAL_QT2 To compile this driver as a module, choose M here: the module will be called quatech-serial. +config USB_SERIAL_FLASHLOADER + tristate Infineon Modem Flashloader USB interface driver + help + Say Y here if you want to download Infineon Modem + via USB Flashloader serial driver. + + To compile this driver as a module, choose M here: the + module will be called flashloader. + + config USB_SERIAL_DEBUG tristate USB Debugging Device help diff --git a/drivers/usb/serial/Makefile b/drivers/usb/serial/Makefile index eaf5ca1..0b2ce56 100644 --- a/drivers/usb/serial/Makefile +++ b/drivers/usb/serial/Makefile @@ -64,3 +64,4 @@ obj-$(CONFIG_USB_SERIAL_VIVOPAY_SERIAL) += vivopay-serial.o obj-$(CONFIG_USB_SERIAL_XSENS_MT) += xsens_mt.o obj-$(CONFIG_USB_SERIAL_ZIO) += zio.o obj-$(CONFIG_USB_SERIAL_ZTE) += zte_ev.o +obj-$(CONFIG_USB_SERIAL_FLASHLOADER) += flashloader.o diff --git a/drivers/usb/serial/flashloader.c b/drivers/usb/serial/flashloader.c new file mode 100644 index 000..e6f5c10 --- /dev/null +++ b/drivers/usb/serial/flashloader.c @@ -0,0 +1,39 @@ +/* + * Infineon Flashloader driver + * + * Copyright (C) 2013 Wei Shuai cpuw...@gmail.com + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License version + * 2 as published by the Free Software Foundation. + */ + +#include linux/kernel.h +#include linux/init.h +#include linux/tty.h +#include linux/module.h +#include linux/usb.h +#include linux/usb/serial.h +#include linux/uaccess.h + +static const struct usb_device_id id_table[] = { + { USB_DEVICE(0x8087, 0x0716) }, + { }, +}; +MODULE_DEVICE_TABLE(usb, id_table); + +static struct usb_serial_driver flashloader_device = { + .driver = { + .owner =THIS_MODULE, + .name = flashloader, + }, + .id_table = id_table, + .num_ports =1, +}; + +static struct usb_serial_driver * const serial_drivers[] = { + flashloader_device, NULL +}; + +module_usb_serial_driver(serial_drivers, id_table); +MODULE_LICENSE(GPL); -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 2/2] CDC_NCM: adding support FLAG_NOARP for Infineon modem platform
Thank you David. yes in the core driver, FLAG_NOARP will be translated to IFF_NOARP 2013/1/21, David Miller da...@davemloft.net: From: Wei Shuai cpuw...@gmail.com Date: Mon, 21 Jan 2013 10:20:22 +0800 The main problem is that these devices don't support ethernet. He's saying your comment is referring to the wrong thing, rather than saying anything against what your change is doing. Read his feedback carefully: +/* Same as wwan_info, but with IFF_NOARP */ FLAG_NOARP, you mean? He's saying your commnet is talking about FLAG_NOARP rather than what the core code does with this flag, which is translate into setting IFF_NOARP on the net device. -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 1/2] usbnet: add new flag FLAG_NOARP for usb net devices
We do have some USB net devices, which cannot do ARP. so we can introduce a new flag FLAG_NOARP, then client drivers can easily handle this kind of devices Signed-off-by: Wei Shuai cpuw...@gmail.com --- drivers/net/usb/usbnet.c |4 include/linux/usb/usbnet.h |1 + 2 files changed, 5 insertions(+), 0 deletions(-) diff --git a/drivers/net/usb/usbnet.c b/drivers/net/usb/usbnet.c index 3d4bf01..f34b2eb 100644 --- a/drivers/net/usb/usbnet.c +++ b/drivers/net/usb/usbnet.c @@ -1448,6 +1448,10 @@ usbnet_probe (struct usb_interface *udev, const struct usb_device_id *prod) if ((dev-driver_info-flags FLAG_WWAN) != 0) strcpy(net-name, wwan%d); + /* devices that cannot do ARP */ + if ((dev-driver_info-flags FLAG_NOARP) != 0) + net-flags |= IFF_NOARP; + /* maybe the remote can't receive an Ethernet MTU */ if (net-mtu (dev-hard_mtu - net-hard_header_len)) net-mtu = dev-hard_mtu - net-hard_header_len; diff --git a/include/linux/usb/usbnet.h b/include/linux/usb/usbnet.h index bd45eb7..5de7a22 100644 --- a/include/linux/usb/usbnet.h +++ b/include/linux/usb/usbnet.h @@ -100,6 +100,7 @@ struct driver_info { #define FLAG_LINK_INTR 0x0800 /* updates link (carrier) status */ #define FLAG_POINTTOPOINT 0x1000 /* possibly use usb%d names */ +#define FLAG_NOARP 0x2000 /* device can't do ARP */ /* * Indicates to usbnet, that USB driver accumulates multiple IP packets. -- 1.7.6.5 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 2/2] cdc_ncm: add support FLAG_NOARP for Infineon modem platform
Infineon(now Intel) HSPA Modem platform NCM cannot support ARP. we can define a new common structure wwan_noarp_info. Then more similiar NO ARP devices can be handled easily Signed-off-by: Wei Shuai cpuw...@gmail.com --- drivers/net/usb/cdc_ncm.c | 21 + 1 files changed, 21 insertions(+), 0 deletions(-) diff --git a/drivers/net/usb/cdc_ncm.c b/drivers/net/usb/cdc_ncm.c index 71b6e92..2d699b6 100644 --- a/drivers/net/usb/cdc_ncm.c +++ b/drivers/net/usb/cdc_ncm.c @@ -1155,6 +1155,20 @@ static const struct driver_info wwan_info = { .tx_fixup = cdc_ncm_tx_fixup, }; +/* Same as wwan_info, but with FLAG_NOARP */ +static const struct driver_info wwan_noarp_info = { + .description = Mobile Broadband Network Device (NO ARP), + .flags = FLAG_POINTTOPOINT | FLAG_NO_SETINT | FLAG_MULTI_PACKET + | FLAG_WWAN | FLAG_NOARP, + .bind = cdc_ncm_bind, + .unbind = cdc_ncm_unbind, + .check_connect = cdc_ncm_check_connect, + .manage_power = usbnet_manage_power, + .status = cdc_ncm_status, + .rx_fixup = cdc_ncm_rx_fixup, + .tx_fixup = cdc_ncm_tx_fixup, +}; + static const struct usb_device_id cdc_devs[] = { /* Ericsson MBM devices like F5521gw */ { .match_flags = USB_DEVICE_ID_MATCH_INT_INFO @@ -1194,6 +1208,13 @@ static const struct usb_device_id cdc_devs[] = { .driver_info = (unsigned long)wwan_info, }, + /* Infineon(now Intel) HSPA Modem platform */ + { USB_DEVICE_AND_INTERFACE_INFO(0x1519, 0x0443, + USB_CLASS_COMM, + USB_CDC_SUBCLASS_NCM, USB_CDC_PROTO_NONE), + .driver_info = (unsigned long)wwan_noarp_info, + }, + /* Generic CDC-NCM devices */ { USB_INTERFACE_INFO(USB_CLASS_COMM, USB_CDC_SUBCLASS_NCM, USB_CDC_PROTO_NONE), -- 1.7.6.5 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 1/2] introduce flag FLAG_NOARP for usb net devices which cannot do ARP
we do have some USB net devices, which cannot do ARP. so we can introduce a new flag FLAG_NOARP, then client drivers can easily handle these kind of devices Signed-off-by: Wei Shuai cpuw...@gmail.com --- drivers/net/usb/usbnet.c |4 include/linux/usb/usbnet.h |1 + 2 files changed, 5 insertions(+), 0 deletions(-) diff --git a/drivers/net/usb/usbnet.c b/drivers/net/usb/usbnet.c index 3d4bf01..f34b2eb 100644 --- a/drivers/net/usb/usbnet.c +++ b/drivers/net/usb/usbnet.c @@ -1448,6 +1448,10 @@ usbnet_probe (struct usb_interface *udev, const struct usb_device_id *prod) if ((dev-driver_info-flags FLAG_WWAN) != 0) strcpy(net-name, wwan%d); + /* devices that cannot do ARP */ + if ((dev-driver_info-flags FLAG_NOARP) != 0) + net-flags |= IFF_NOARP; + /* maybe the remote can't receive an Ethernet MTU */ if (net-mtu (dev-hard_mtu - net-hard_header_len)) net-mtu = dev-hard_mtu - net-hard_header_len; diff --git a/include/linux/usb/usbnet.h b/include/linux/usb/usbnet.h index bd45eb7..5de7a22 100644 --- a/include/linux/usb/usbnet.h +++ b/include/linux/usb/usbnet.h @@ -100,6 +100,7 @@ struct driver_info { #define FLAG_LINK_INTR 0x0800 /* updates link (carrier) status */ #define FLAG_POINTTOPOINT 0x1000 /* possibly use usb%d names */ +#define FLAG_NOARP 0x2000 /* device can't do ARP */ /* * Indicates to usbnet, that USB driver accumulates multiple IP packets. -- 1.7.6.5 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 1/2] introduce flag FLAG_NOARP for usb net devices which cannot do ARP
Signed-off-by: Wei Shuai cpuw...@gmail.com --- drivers/net/usb/usbnet.c |4 include/linux/usb/usbnet.h |1 + 2 files changed, 5 insertions(+), 0 deletions(-) diff --git a/drivers/net/usb/usbnet.c b/drivers/net/usb/usbnet.c index 3d4bf01..f34b2eb 100644 --- a/drivers/net/usb/usbnet.c +++ b/drivers/net/usb/usbnet.c @@ -1448,6 +1448,10 @@ usbnet_probe (struct usb_interface *udev, const struct usb_device_id *prod) if ((dev-driver_info-flags FLAG_WWAN) != 0) strcpy(net-name, wwan%d); + /* devices that cannot do ARP */ + if ((dev-driver_info-flags FLAG_NOARP) != 0) + net-flags |= IFF_NOARP; + /* maybe the remote can't receive an Ethernet MTU */ if (net-mtu (dev-hard_mtu - net-hard_header_len)) net-mtu = dev-hard_mtu - net-hard_header_len; diff --git a/include/linux/usb/usbnet.h b/include/linux/usb/usbnet.h index bd45eb7..5de7a22 100644 --- a/include/linux/usb/usbnet.h +++ b/include/linux/usb/usbnet.h @@ -100,6 +100,7 @@ struct driver_info { #define FLAG_LINK_INTR 0x0800 /* updates link (carrier) status */ #define FLAG_POINTTOPOINT 0x1000 /* possibly use usb%d names */ +#define FLAG_NOARP 0x2000 /* device can't do ARP */ /* * Indicates to usbnet, that USB driver accumulates multiple IP packets. -- 1.7.6.5 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 1/2] introduce flag FLAG_NOARP for usb net devices which cannot do ARP
we do have some USB net devices, which cannot do ARP. so we can introduce a new flag FLAG_NOARP, then client drivers can easily handle these kind of devices Signed-off-by: Wei Shuai cpuw...@gmail.com --- drivers/net/usb/usbnet.c |4 include/linux/usb/usbnet.h |1 + 2 files changed, 5 insertions(+), 0 deletions(-) diff --git a/drivers/net/usb/usbnet.c b/drivers/net/usb/usbnet.c index 3d4bf01..f34b2eb 100644 --- a/drivers/net/usb/usbnet.c +++ b/drivers/net/usb/usbnet.c @@ -1448,6 +1448,10 @@ usbnet_probe (struct usb_interface *udev, const struct usb_device_id *prod) if ((dev-driver_info-flags FLAG_WWAN) != 0) strcpy(net-name, wwan%d); + /* devices that cannot do ARP */ + if ((dev-driver_info-flags FLAG_NOARP) != 0) + net-flags |= IFF_NOARP; + /* maybe the remote can't receive an Ethernet MTU */ if (net-mtu (dev-hard_mtu - net-hard_header_len)) net-mtu = dev-hard_mtu - net-hard_header_len; diff --git a/include/linux/usb/usbnet.h b/include/linux/usb/usbnet.h index bd45eb7..5de7a22 100644 --- a/include/linux/usb/usbnet.h +++ b/include/linux/usb/usbnet.h @@ -100,6 +100,7 @@ struct driver_info { #define FLAG_LINK_INTR 0x0800 /* updates link (carrier) status */ #define FLAG_POINTTOPOINT 0x1000 /* possibly use usb%d names */ +#define FLAG_NOARP 0x2000 /* device can't do ARP */ /* * Indicates to usbnet, that USB driver accumulates multiple IP packets. -- 1.7.6.5 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 1/2] introduce flag FLAG_NOARP for usb net devices which cannot do ARP
Signed-off-by: Wei Shuai cpuw...@gmail.com --- drivers/net/usb/usbnet.c |4 include/linux/usb/usbnet.h |1 + 2 files changed, 5 insertions(+), 0 deletions(-) diff --git a/drivers/net/usb/usbnet.c b/drivers/net/usb/usbnet.c index 3d4bf01..f34b2eb 100644 --- a/drivers/net/usb/usbnet.c +++ b/drivers/net/usb/usbnet.c @@ -1448,6 +1448,10 @@ usbnet_probe (struct usb_interface *udev, const struct usb_device_id *prod) if ((dev-driver_info-flags FLAG_WWAN) != 0) strcpy(net-name, wwan%d); + /* devices that cannot do ARP */ + if ((dev-driver_info-flags FLAG_NOARP) != 0) + net-flags |= IFF_NOARP; + /* maybe the remote can't receive an Ethernet MTU */ if (net-mtu (dev-hard_mtu - net-hard_header_len)) net-mtu = dev-hard_mtu - net-hard_header_len; diff --git a/include/linux/usb/usbnet.h b/include/linux/usb/usbnet.h index bd45eb7..5de7a22 100644 --- a/include/linux/usb/usbnet.h +++ b/include/linux/usb/usbnet.h @@ -100,6 +100,7 @@ struct driver_info { #define FLAG_LINK_INTR 0x0800 /* updates link (carrier) status */ #define FLAG_POINTTOPOINT 0x1000 /* possibly use usb%d names */ +#define FLAG_NOARP 0x2000 /* device can't do ARP */ /* * Indicates to usbnet, that USB driver accumulates multiple IP packets. -- 1.7.6.5 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 2/2] CDC_NCM adding support FLAG_NOARP for Infineon modem platform
Infineon(now Intel) HSPA Modem platform NCM cannot support ARP. we can define a new common structure wwan_noarp_info. Then more similiar NO ARP devices can be handled easily Signed-off-by: Wei Shuai cpuw...@gmail.com --- drivers/net/usb/cdc_ncm.c | 21 + 1 files changed, 21 insertions(+), 0 deletions(-) diff --git a/drivers/net/usb/cdc_ncm.c b/drivers/net/usb/cdc_ncm.c index 71b6e92..2d699b6 100644 --- a/drivers/net/usb/cdc_ncm.c +++ b/drivers/net/usb/cdc_ncm.c @@ -1155,6 +1155,20 @@ static const struct driver_info wwan_info = { .tx_fixup = cdc_ncm_tx_fixup, }; +/* Same as wwan_info, but with IFF_NOARP */ +static const struct driver_info wwan_noarp_info = { + .description = Mobile Broadband Network Device (NO ARP), + .flags = FLAG_POINTTOPOINT | FLAG_NO_SETINT | FLAG_MULTI_PACKET + | FLAG_WWAN | FLAG_NOARP, + .bind = cdc_ncm_bind, + .unbind = cdc_ncm_unbind, + .check_connect = cdc_ncm_check_connect, + .manage_power = usbnet_manage_power, + .status = cdc_ncm_status, + .rx_fixup = cdc_ncm_rx_fixup, + .tx_fixup = cdc_ncm_tx_fixup, +}; + static const struct usb_device_id cdc_devs[] = { /* Ericsson MBM devices like F5521gw */ { .match_flags = USB_DEVICE_ID_MATCH_INT_INFO @@ -1194,6 +1208,13 @@ static const struct usb_device_id cdc_devs[] = { .driver_info = (unsigned long)wwan_info, }, + /* Infineon(now Intel) HSPA Modem platform */ + { USB_DEVICE_AND_INTERFACE_INFO(0x1519, 0x0443, + USB_CLASS_COMM, + USB_CDC_SUBCLASS_NCM, USB_CDC_PROTO_NONE), + .driver_info = (unsigned long)wwan_noarp_info, + }, + /* Generic CDC-NCM devices */ { USB_INTERFACE_INFO(USB_CLASS_COMM, USB_CDC_SUBCLASS_NCM, USB_CDC_PROTO_NONE), -- 1.7.6.5 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 1/2] introduce flag FLAG_NOARP for usb net devices which cannot do ARP
sorry for wrongly use git, I cannot recall them back. There is no different between them. Anything else I can fix this? Resubmit? 2013/1/19, David Miller da...@davemloft.net: Why did you submit this _4_ times? I'm deleteing everything, I'm not even going to try and guess why you submitted this so many times and what might be different between each copy. -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 1/2] usbnet: introduce flag FLAG_NOARP for usb net devices
we do have some USB net devices, which cannot do ARP. so we can introduce a new flag FLAG_NOARP, then client drivers can easily handle these kind of devices Signed-off-by: Wei Shuai cpuw...@gmail.com --- drivers/net/usb/usbnet.c |4 include/linux/usb/usbnet.h |1 + 2 files changed, 5 insertions(+), 0 deletions(-) diff --git a/drivers/net/usb/usbnet.c b/drivers/net/usb/usbnet.c index 3d4bf01..f34b2eb 100644 --- a/drivers/net/usb/usbnet.c +++ b/drivers/net/usb/usbnet.c @@ -1448,6 +1448,10 @@ usbnet_probe (struct usb_interface *udev, const struct usb_device_id *prod) if ((dev-driver_info-flags FLAG_WWAN) != 0) strcpy(net-name, wwan%d); + /* devices that cannot do ARP */ + if ((dev-driver_info-flags FLAG_NOARP) != 0) + net-flags |= IFF_NOARP; + /* maybe the remote can't receive an Ethernet MTU */ if (net-mtu (dev-hard_mtu - net-hard_header_len)) net-mtu = dev-hard_mtu - net-hard_header_len; diff --git a/include/linux/usb/usbnet.h b/include/linux/usb/usbnet.h index bd45eb7..5de7a22 100644 --- a/include/linux/usb/usbnet.h +++ b/include/linux/usb/usbnet.h @@ -100,6 +100,7 @@ struct driver_info { #define FLAG_LINK_INTR 0x0800 /* updates link (carrier) status */ #define FLAG_POINTTOPOINT 0x1000 /* possibly use usb%d names */ +#define FLAG_NOARP 0x2000 /* device can't do ARP */ /* * Indicates to usbnet, that USB driver accumulates multiple IP packets. -- 1.7.6.5 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 1/2] usbnet: add flag FLAG_NOARP for usb net devices
we do have some USB net devices, which cannot do ARP. so we can introduce a new flag FLAG_NOARP, then client drivers can easily handle these kind of devices Signed-off-by: Wei Shuai cpuw...@gmail.com --- drivers/net/usb/usbnet.c |4 include/linux/usb/usbnet.h |1 + 2 files changed, 5 insertions(+), 0 deletions(-) diff --git a/drivers/net/usb/usbnet.c b/drivers/net/usb/usbnet.c index 3d4bf01..f34b2eb 100644 --- a/drivers/net/usb/usbnet.c +++ b/drivers/net/usb/usbnet.c @@ -1448,6 +1448,10 @@ usbnet_probe (struct usb_interface *udev, const struct usb_device_id *prod) if ((dev-driver_info-flags FLAG_WWAN) != 0) strcpy(net-name, wwan%d); + /* devices that cannot do ARP */ + if ((dev-driver_info-flags FLAG_NOARP) != 0) + net-flags |= IFF_NOARP; + /* maybe the remote can't receive an Ethernet MTU */ if (net-mtu (dev-hard_mtu - net-hard_header_len)) net-mtu = dev-hard_mtu - net-hard_header_len; diff --git a/include/linux/usb/usbnet.h b/include/linux/usb/usbnet.h index bd45eb7..5de7a22 100644 --- a/include/linux/usb/usbnet.h +++ b/include/linux/usb/usbnet.h @@ -100,6 +100,7 @@ struct driver_info { #define FLAG_LINK_INTR 0x0800 /* updates link (carrier) status */ #define FLAG_POINTTOPOINT 0x1000 /* possibly use usb%d names */ +#define FLAG_NOARP 0x2000 /* device can't do ARP */ /* * Indicates to usbnet, that USB driver accumulates multiple IP packets. -- 1.7.6.5 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 2/2] CDC_NCM: adding support FLAG_NOARP for Infineon modem platform
Infineon(now Intel) HSPA Modem platform NCM cannot support ARP. we can define a new common structure wwan_noarp_info. Then more similiar NO ARP devices can be handled easily Signed-off-by: Wei Shuai cpuw...@gmail.com --- drivers/net/usb/cdc_ncm.c | 21 + 1 files changed, 21 insertions(+), 0 deletions(-) diff --git a/drivers/net/usb/cdc_ncm.c b/drivers/net/usb/cdc_ncm.c index 71b6e92..2d699b6 100644 --- a/drivers/net/usb/cdc_ncm.c +++ b/drivers/net/usb/cdc_ncm.c @@ -1155,6 +1155,20 @@ static const struct driver_info wwan_info = { .tx_fixup = cdc_ncm_tx_fixup, }; +/* Same as wwan_info, but with IFF_NOARP */ +static const struct driver_info wwan_noarp_info = { + .description = Mobile Broadband Network Device (NO ARP), + .flags = FLAG_POINTTOPOINT | FLAG_NO_SETINT | FLAG_MULTI_PACKET + | FLAG_WWAN | FLAG_NOARP, + .bind = cdc_ncm_bind, + .unbind = cdc_ncm_unbind, + .check_connect = cdc_ncm_check_connect, + .manage_power = usbnet_manage_power, + .status = cdc_ncm_status, + .rx_fixup = cdc_ncm_rx_fixup, + .tx_fixup = cdc_ncm_tx_fixup, +}; + static const struct usb_device_id cdc_devs[] = { /* Ericsson MBM devices like F5521gw */ { .match_flags = USB_DEVICE_ID_MATCH_INT_INFO @@ -1194,6 +1208,13 @@ static const struct usb_device_id cdc_devs[] = { .driver_info = (unsigned long)wwan_info, }, + /* Infineon(now Intel) HSPA Modem platform */ + { USB_DEVICE_AND_INTERFACE_INFO(0x1519, 0x0443, + USB_CLASS_COMM, + USB_CDC_SUBCLASS_NCM, USB_CDC_PROTO_NONE), + .driver_info = (unsigned long)wwan_noarp_info, + }, + /* Generic CDC-NCM devices */ { USB_INTERFACE_INFO(USB_CLASS_COMM, USB_CDC_SUBCLASS_NCM, USB_CDC_PROTO_NONE), -- 1.7.6.5 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] CDC_NCM adding support IFF_NOARP for infineon modem platform
OK, I will follow up. after add FLAG_NOARP, how should I handle IFF_NOARP? will I do it in cdc_ncm.c or usb_net.c? 2013/1/17 Dan Williams d...@redhat.com: On Sat, 2013-01-12 at 19:34 +0800, Wei Shuai wrote: Infineon(now Intel) HSPA Modem platform NCM cannot support ARP. so I introduce a flag CDC_NCM_DRIVER_DATA_NOARP which is defined in driver_info:data. so later on, if more such buggy devices are found, they could use same flag to handle. So given that Dave now approves of IFF_NOARP, let's change your original patch to add a FLAG_NOARP for the .flags structure instead of inventing another mechanism for .data. Dan Signed-off-by: Wei Shuai cpuw...@gmail.com --- drivers/net/usb/cdc_ncm.c | 29 + 1 files changed, 29 insertions(+), 0 deletions(-) diff --git a/drivers/net/usb/cdc_ncm.c b/drivers/net/usb/cdc_ncm.c index 71b6e92..6093e07 100644 --- a/drivers/net/usb/cdc_ncm.c +++ b/drivers/net/usb/cdc_ncm.c @@ -55,6 +55,9 @@ #define DRIVER_VERSION 14-Mar-2012 +/* Flags for driver_info::data */ +#define CDC_NCM_DRIVER_DATA_NOARP 1 + static void cdc_ncm_txpath_bh(unsigned long param); static void cdc_ncm_tx_timeout_start(struct cdc_ncm_ctx *ctx); static enum hrtimer_restart cdc_ncm_tx_timer_cb(struct hrtimer *hr_timer); @@ -573,6 +576,10 @@ static int cdc_ncm_bind(struct usbnet *dev, struct usb_interface *intf) return -ENODEV; #endif + if (dev-driver_info-data CDC_NCM_DRIVER_DATA_NOARP) { + /* some buggy device cannot do ARP*/ + dev-net-flags |= IFF_NOARP; + } /* NCM data altsetting is always 1 */ ret = cdc_ncm_bind_common(dev, intf, 1); @@ -1155,6 +1162,21 @@ static const struct driver_info wwan_info = { .tx_fixup = cdc_ncm_tx_fixup, }; +/* Same as wwan_info, but with IFF_NOARP */ +static const struct driver_info wwan_noarp_info = { + .description = Mobile Broadband Network Device (NO ARP), + .flags = FLAG_POINTTOPOINT | FLAG_NO_SETINT | FLAG_MULTI_PACKET + | FLAG_WWAN, + .data = CDC_NCM_DRIVER_DATA_NOARP, + .bind = cdc_ncm_bind, + .unbind = cdc_ncm_unbind, + .check_connect = cdc_ncm_check_connect, + .manage_power = usbnet_manage_power, + .status = cdc_ncm_status, + .rx_fixup = cdc_ncm_rx_fixup, + .tx_fixup = cdc_ncm_tx_fixup, +}; + static const struct usb_device_id cdc_devs[] = { /* Ericsson MBM devices like F5521gw */ { .match_flags = USB_DEVICE_ID_MATCH_INT_INFO @@ -1194,6 +1216,13 @@ static const struct usb_device_id cdc_devs[] = { .driver_info = (unsigned long)wwan_info, }, + /* Infineon(now Intel) HSPA Modem platform */ + { USB_DEVICE_AND_INTERFACE_INFO(0x1519, 0x0443, + USB_CLASS_COMM, + USB_CDC_SUBCLASS_NCM, USB_CDC_PROTO_NONE), + .driver_info = (unsigned long)wwan_noarp_info, + }, + /* Generic CDC-NCM devices */ { USB_INTERFACE_INFO(USB_CLASS_COMM, USB_CDC_SUBCLASS_NCM, USB_CDC_PROTO_NONE), -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] CDC_NCM adding support IFF_NOARP for infineon modem platform
yes. usbnet has FLAG_POINTTOPOINT, but that's nothing to do with IFF_POINTTOPOINT. At least we should do something to handle relationship of these flags rather than only have different names. or new flag FLAG_NOARP could be introduced to corresponding to IFF_NOARP. 2013/1/15 Dan Williams d...@redhat.com: On Sat, 2013-01-12 at 15:35 -0800, David Miller wrote: From: Wei Shuai cpuw...@gmail.com Date: Sat, 12 Jan 2013 19:34:39 +0800 Infineon(now Intel) HSPA Modem platform NCM cannot support ARP. so I introduce a flag CDC_NCM_DRIVER_DATA_NOARP which is defined in driver_info:data. so later on, if more such buggy devices are found, they could use same flag to handle. Is it no able to do ARP or, the more likely case, does broadcast not work at all? If it's the latter, IFF_NOARP is just making over the real problem. I'm not applying this, no hardware device should set IFF_NOARP. You probably really want IFF_POINTOPOINT or similar. IFF_NOARP is already done for other WWAN devices (sierra_net, hso, cdc-ether, cdc-phonet, lg-vl600, etc) so there is some precedent. Some drivers (phonet, hso) set *both* POINTTOPOINT and NOARP. Is that redundant, and should all WWAN drivers be moved to only POINTTOPOINT? (aside: usbnet has FLAG_POINTTOPOINT, but that's nothing to do with IFF_POINTTOPOINT, it only controls whether the interface is named usbX or ethX. Confusing.) Dan -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] CDC_NCM adding support IFF_NOARP for infineon modem platform
Infineon(now Intel) HSPA Modem platform NCM cannot support ARP. so I introduce a flag CDC_NCM_DRIVER_DATA_NOARP which is defined in driver_info:data. so later on, if more such buggy devices are found, they could use same flag to handle. Signed-off-by: Wei Shuai cpuw...@gmail.com --- drivers/net/usb/cdc_ncm.c | 29 + 1 files changed, 29 insertions(+), 0 deletions(-) diff --git a/drivers/net/usb/cdc_ncm.c b/drivers/net/usb/cdc_ncm.c index 71b6e92..6093e07 100644 --- a/drivers/net/usb/cdc_ncm.c +++ b/drivers/net/usb/cdc_ncm.c @@ -55,6 +55,9 @@ #defineDRIVER_VERSION 14-Mar-2012 +/* Flags for driver_info::data */ +#define CDC_NCM_DRIVER_DATA_NOARP 1 + static void cdc_ncm_txpath_bh(unsigned long param); static void cdc_ncm_tx_timeout_start(struct cdc_ncm_ctx *ctx); static enum hrtimer_restart cdc_ncm_tx_timer_cb(struct hrtimer *hr_timer); @@ -573,6 +576,10 @@ static int cdc_ncm_bind(struct usbnet *dev, struct usb_interface *intf) return -ENODEV; #endif + if (dev-driver_info-data CDC_NCM_DRIVER_DATA_NOARP) { + /* some buggy device cannot do ARP*/ + dev-net-flags |= IFF_NOARP; + } /* NCM data altsetting is always 1 */ ret = cdc_ncm_bind_common(dev, intf, 1); @@ -1155,6 +1162,21 @@ static const struct driver_info wwan_info = { .tx_fixup = cdc_ncm_tx_fixup, }; +/* Same as wwan_info, but with IFF_NOARP */ +static const struct driver_info wwan_noarp_info = { + .description = Mobile Broadband Network Device (NO ARP), + .flags = FLAG_POINTTOPOINT | FLAG_NO_SETINT | FLAG_MULTI_PACKET + | FLAG_WWAN, + .data = CDC_NCM_DRIVER_DATA_NOARP, + .bind = cdc_ncm_bind, + .unbind = cdc_ncm_unbind, + .check_connect = cdc_ncm_check_connect, + .manage_power = usbnet_manage_power, + .status = cdc_ncm_status, + .rx_fixup = cdc_ncm_rx_fixup, + .tx_fixup = cdc_ncm_tx_fixup, +}; + static const struct usb_device_id cdc_devs[] = { /* Ericsson MBM devices like F5521gw */ { .match_flags = USB_DEVICE_ID_MATCH_INT_INFO @@ -1194,6 +1216,13 @@ static const struct usb_device_id cdc_devs[] = { .driver_info = (unsigned long)wwan_info, }, + /* Infineon(now Intel) HSPA Modem platform */ + { USB_DEVICE_AND_INTERFACE_INFO(0x1519, 0x0443, + USB_CLASS_COMM, + USB_CDC_SUBCLASS_NCM, USB_CDC_PROTO_NONE), + .driver_info = (unsigned long)wwan_noarp_info, + }, + /* Generic CDC-NCM devices */ { USB_INTERFACE_INFO(USB_CLASS_COMM, USB_CDC_SUBCLASS_NCM, USB_CDC_PROTO_NONE), -- 1.7.6.5 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] CDC_NCM adding support IFF_NOARP for buggy device
Signed-off-by: Wei Shuai cpuw...@gmail.com --- drivers/net/usb/cdc_ncm.c | 15 +++ 1 files changed, 15 insertions(+), 0 deletions(-) diff --git a/drivers/net/usb/cdc_ncm.c b/drivers/net/usb/cdc_ncm.c index 71b6e92..9903f79 100644 --- a/drivers/net/usb/cdc_ncm.c +++ b/drivers/net/usb/cdc_ncm.c @@ -545,6 +545,7 @@ EXPORT_SYMBOL_GPL(cdc_ncm_unbind); static int cdc_ncm_bind(struct usbnet *dev, struct usb_interface *intf) { int ret; + struct usb_device *udev = interface_to_usbdev(intf); /* The MBIM spec defines a NCM compatible default altsetting, * which we may have matched: @@ -572,6 +573,10 @@ static int cdc_ncm_bind(struct usbnet *dev, struct usb_interface *intf) cdc_ncm_comm_intf_is_mbim(intf-cur_altsetting)) return -ENODEV; #endif + /* this buggy device cannot do ARP */ + if( (le16_to_cpu(udev-descriptor.idVendor) == 0x) ) { + dev-net-flags |= IFF_NOARP; + } /* NCM data altsetting is always 1 */ ret = cdc_ncm_bind_common(dev, intf, 1); @@ -1186,6 +1191,16 @@ static const struct usb_device_id cdc_devs[] = { .driver_info = (unsigned long) wwan_info, }, + /* buggy device cannot send ARP */ + { .match_flags = USB_DEVICE_ID_MATCH_INT_INFO + | USB_DEVICE_ID_MATCH_VENDOR, + .idVendor = 0x, + .bInterfaceClass = USB_CLASS_COMM, + .bInterfaceSubClass = USB_CDC_SUBCLASS_NCM, + .bInterfaceProtocol = USB_CDC_PROTO_NONE, + .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, -- 1.7.6.5 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
net: usb: cdc_ncm: add support IFF_NOARP
Hi Alexey, Recently I met a Modem which cannot do ARP. But I found our cdc_ncm_bind() function cannot handle this special case. Do you have any plan to handle it? static int cdc_ncm_bind(struct usbnet *dev, struct usb_interface *intf) { ... /* cannot do ARP */ dev-net-flags |= IFF_NOARP; ... } -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html