* [PATCH] CDC_NCM adding support IFF_NOARP for buggy device
@ 2013-01-10 13:59 Wei Shuai
2013-01-10 14:10 ` Oliver Neukum
2013-01-10 17:18 ` Sergei Shtylyov
0 siblings, 2 replies; 3+ messages in thread
From: Wei Shuai @ 2013-01-10 13:59 UTC (permalink / raw)
To: gregkh, alexey.orishko, hans.petter.selasky; +Cc: linux-usb, netdev, Wei Shuai
Signed-off-by: Wei Shuai <cpuwolf@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) == 0xAAAA) ) {
+ 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 = 0xAAAA,
+ .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
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] CDC_NCM adding support IFF_NOARP for buggy device
2013-01-10 13:59 [PATCH] CDC_NCM adding support IFF_NOARP for buggy device Wei Shuai
@ 2013-01-10 14:10 ` Oliver Neukum
2013-01-10 17:18 ` Sergei Shtylyov
1 sibling, 0 replies; 3+ messages in thread
From: Oliver Neukum @ 2013-01-10 14:10 UTC (permalink / raw)
To: Wei Shuai; +Cc: gregkh, alexey.orishko, hans.petter.selasky, linux-usb, netdev
On Thursday 10 January 2013 21:59:28 Wei Shuai wrote:
Hi,
I am afraid this is done in an unclean manner.
> 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) == 0xAAAA) ) {
> + dev->net->flags |= IFF_NOARP;
So either you do a check here ...
> + }
>
> /* 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 = 0xAAAA,
> + .bInterfaceClass = USB_CLASS_COMM,
> + .bInterfaceSubClass = USB_CDC_SUBCLASS_NCM,
> + .bInterfaceProtocol = USB_CDC_PROTO_NONE,
> + .driver_info = (unsigned long) &wwan_info,
... or you define a matching id here and give it a flag in driver_info
But not both.
Regards
Oliver
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] CDC_NCM adding support IFF_NOARP for buggy device
2013-01-10 13:59 [PATCH] CDC_NCM adding support IFF_NOARP for buggy device Wei Shuai
2013-01-10 14:10 ` Oliver Neukum
@ 2013-01-10 17:18 ` Sergei Shtylyov
1 sibling, 0 replies; 3+ messages in thread
From: Sergei Shtylyov @ 2013-01-10 17:18 UTC (permalink / raw)
To: Wei Shuai; +Cc: gregkh, alexey.orishko, hans.petter.selasky, linux-usb, netdev
Hello.
On 01/10/2013 04:59 PM, Wei Shuai wrote:
> Signed-off-by: Wei Shuai <cpuwolf@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
[...]
> @@ -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) == 0xAAAA) ) {
Please run the patch thru scripts/checkpatch.pl and resubmit.
WBR, Sergei
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2013-01-10 16:20 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-01-10 13:59 [PATCH] CDC_NCM adding support IFF_NOARP for buggy device Wei Shuai
2013-01-10 14:10 ` Oliver Neukum
2013-01-10 17:18 ` Sergei Shtylyov
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).