Skip to contentSkip to conversation

usbnet: add flag FLAG_NOARP for usb net devices

PATCH In review Wei Shuai 3 participants 7 messages Jan 20, 2013 – Jan 21, 2013 2 messages not in the archive

Subsystems (6)
lore
Share & tools
lore

Wei Shuai

author
#0 lore raw

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

---
 drivers/net/usb/usbnet.c   |    4 ++++
 include/linux/usb/usbnet.h |    1 +
 2 files changed, 5 insertions(+), 0 deletions(-)
drivers/net/usb/usbnet.c +4 -0
index 3d4bf01..f34b2eb 100644
@@ -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;
include/linux/usb/usbnet.h +1 -0
index bd45eb7..5de7a22 100644
@@ -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.
Signature · 1 line
1.7.6.5
author
#1 lore raw

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

---
 drivers/net/usb/cdc_ncm.c |   21 +++++++++++++++++++++
 1 files changed, 21 insertions(+), 0 deletions(-)
drivers/net/usb/cdc_ncm.c +21 -0
index 71b6e92..2d699b6 100644
@@ -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),
Signature · 1 line
1.7.6.5
#3 lore raw

Re: [PATCH 2/2] CDC_NCM: adding support FLAG_NOARP for Infineon modem platform

In reply to a message not in the archive

Hello.

Quoted 1 line · Wei Shuai

Infineon(now Intel) HSPA Modem platform NCM cannot support ARP. we can define a new common structure wwan_noarp_info.

Wrap your lines at 76-80 columns maximum please.

Quoted 13 lines

Then more similiar NO ARP devices can be handled easily

---
  drivers/net/usb/cdc_ncm.c |   21 +++++++++++++++++++++
  1 files changed, 21 insertions(+), 0 deletions(-)
drivers/net/usb/cdc_ncm.c +0 -0
index 71b6e92..2d699b6 100644

drivers/net/usb/cdc_ncm.c static const struct driver_info wwan_info = { · line 1158

Quoted 4 lines
drivers/net/usb/cdc_ncm.c +1 -0
@@ -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  */

FLAG_NOARP, you mean?

drivers/net/usb/cdc_ncm.c static const struct driver_info wwan_info = { · line 1162

Quoted 4 lines
drivers/net/usb/cdc_ncm.c +4 -0
+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,

WBR, Sergei

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

author
#4 lore raw

Re: [PATCH 2/2] CDC_NCM: adding support FLAG_NOARP for Infineon modem platform

The main problem is that these devices don't support ethernet. They support IP (v4 and _maybe_ v6) with an ethernet header. Many of them will do ARP (and IPv6 ND) as well to complete the picture, but some of them don't and that's what these drivers try to deal with.

Note that most of the devices will run a DHCP server, so there is some sort of IP broadcast support. Whether that qualifies as proper ethernet broadcast support is another question...

These devices are attempting to bridge an IP-only point-to-point interface and an ethernet over USB interface, with the intention to make the point-to-point interface look like ethernet to applications and users. This is of course always going to be imperfect. But I believe that we should aim to help the firmware achive this goal when writing drivers instead of working against it. Setting IFF_NOARP and not IFF_POINTTOPOINT is one way to do that. ---- by Bjorn Mork <[email protected]>

2013/1/21, Sergei Shtylyov <[email protected]>:

Quoted 37 lines

Hello.

Quoted 2 lines · Wei Shuai

Infineon(now Intel) HSPA Modem platform NCM cannot support ARP. we can define a new common structure wwan_noarp_info.

Wrap your lines at 76-80 columns maximum please.

Quoted 13 lines

Then more similiar NO ARP devices can be handled easily

---
  drivers/net/usb/cdc_ncm.c |   21 +++++++++++++++++++++
  1 files changed, 21 insertions(+), 0 deletions(-)
drivers/net/usb/cdc_ncm.c +0 -0
index 71b6e92..2d699b6 100644

drivers/net/usb/cdc_ncm.c static const struct driver_info wwan_info = { · line 1158

Quoted 4 lines
drivers/net/usb/cdc_ncm.c +1 -0
@@ -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  */

FLAG_NOARP, you mean?

drivers/net/usb/cdc_ncm.c static const struct driver_info wwan_info = { · line 1162

Quoted 4 lines
drivers/net/usb/cdc_ncm.c +4 -0
+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,

WBR, Sergei

#6 lore raw

Re: [PATCH 2/2] CDC_NCM: adding support FLAG_NOARP for Infineon modem platform

In reply to a message not in the archive

From: Wei Shuai <[email protected]>
Date: Mon, 21 Jan 2013 10:20:22 +0800

Quoted 1 line

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:

Quoted 3 lines
Quoted 3 lines
Quoted 1 line

+/* 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 [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

author
#7 lore raw

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 <[email protected]>:

Quoted 20 lines

From: Wei Shuai <[email protected]>
Date: Mon, 21 Jan 2013 10:20:22 +0800

Quoted 1 line

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:

Quoted 3 lines
Quoted 3 lines
Quoted 1 line

+/* 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.

#8 lore raw

Re: [PATCH 2/2] CDC_NCM: adding support FLAG_NOARP for Infineon modem platform

In reply to a message not in the archive

Hello.

Quoted 9 lines · Wei Shuai

The main problem is that these devices don't support ethernet. They support IP (v4 and _maybe_ v6) with an ethernet header. Many of them will do ARP (and IPv6 ND) as well to complete the picture, but some of them don't and that's what these drivers try to deal with.

Note that most of the devices will run a DHCP server, so there is some sort of IP broadcast support. Whether that qualifies as proper ethernet broadcast support is another question...

Quoted 7 lines

These devices are attempting to bridge an IP-only point-to-point
interface and an ethernet over USB interface, with the intention to make
the point-to-point interface look like ethernet to applications and
users. This is of course always going to be imperfect. But I believe
that we should aim to help the firmware achive this goal when writing
drivers instead of working against it. Setting IFF_NOARP and not IFF_POINTTOPOINT is one way to do that. ---- by Bjorn Mork <[email protected]>

Why are you replying with this long story to my simple patch comments? :-)

Quoted 11 lines

2013/1/21, Sergei Shtylyov <[email protected]>:

Quoted 10 lines

Hello.

Quoted 2 lines · Wei Shuai

Infineon(now Intel) HSPA Modem platform NCM cannot support ARP. we can define a new common structure wwan_noarp_info.

Wrap your lines at 76-80 columns maximum please.

Quoted 1 line

Then more similiar NO ARP devices can be handled easily

s/NO/no/.

Quoted 13 lines
Quoted 13 lines
Quoted 13 lines
---
   drivers/net/usb/cdc_ncm.c |   21 +++++++++++++++++++++
   1 files changed, 21 insertions(+), 0 deletions(-)
drivers/net/usb/cdc_ncm.c +0 -0
index 71b6e92..2d699b6 100644
@@ -1155,6 +1155,20 @@ static const struct driver_info wwan_info = {
   	.tx_fixup = cdc_ncm_tx_fixup,
   };
 
Quoted 8 lines
Quoted 8 lines

drivers/net/usb/cdc_ncm.c static const struct driver_info wwan_info = { · line 1158

Quoted 1 line
drivers/net/usb/cdc_ncm.c +1 -0
+/* Same as wwan_info, but with IFF_NOARP  */

FLAG_NOARP, you mean?

drivers/net/usb/cdc_ncm.c static const struct driver_info wwan_info = { · line 1162

Quoted 4 lines
drivers/net/usb/cdc_ncm.c +4 -0
+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,

WBR, Sergei

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html