All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] usbnet: fix alignment for frames with no ethernet header
@ 2017-12-06 19:21 ` Bjørn Mork
  0 siblings, 0 replies; 8+ messages in thread
From: Bjørn Mork @ 2017-12-06 19:21 UTC (permalink / raw)
  To: netdev; +Cc: Jay Foster, linux-usb, Oliver Neukum, Bjørn Mork

The qmi_wwan minidriver support a 'raw-ip' mode where frames are
received without any ethernet header. This causes alignment issues
because the skbs allocated by usbnet are "IP aligned".

Fix by allowing minidrivers to disable the additional alignment
offset. This is implemented using a per-device flag, since the same
minidriver also supports 'ethernet' mode.

Fixes: 32f7adf633b9 ("net: qmi_wwan: support "raw IP" mode")
Reported-and-tested-by: Jay Foster <jay@systech.com>
Signed-off-by: Bjørn Mork <bjorn@mork.no>
---
 drivers/net/usb/qmi_wwan.c | 2 ++
 drivers/net/usb/usbnet.c   | 5 ++++-
 include/linux/usb/usbnet.h | 1 +
 3 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/net/usb/qmi_wwan.c b/drivers/net/usb/qmi_wwan.c
index c750cf7c042b..304ec6555cd8 100644
--- a/drivers/net/usb/qmi_wwan.c
+++ b/drivers/net/usb/qmi_wwan.c
@@ -261,9 +261,11 @@ static void qmi_wwan_netdev_setup(struct net_device *net)
 		net->hard_header_len = 0;
 		net->addr_len        = 0;
 		net->flags           = IFF_POINTOPOINT | IFF_NOARP | IFF_MULTICAST;
+		set_bit(EVENT_NO_IP_ALIGN, &dev->flags);
 		netdev_dbg(net, "mode: raw IP\n");
 	} else if (!net->header_ops) { /* don't bother if already set */
 		ether_setup(net);
+		clear_bit(EVENT_NO_IP_ALIGN, &dev->flags);
 		netdev_dbg(net, "mode: Ethernet\n");
 	}
 
diff --git a/drivers/net/usb/usbnet.c b/drivers/net/usb/usbnet.c
index 80348b6a8646..d56fe32bf48d 100644
--- a/drivers/net/usb/usbnet.c
+++ b/drivers/net/usb/usbnet.c
@@ -484,7 +484,10 @@ static int rx_submit (struct usbnet *dev, struct urb *urb, gfp_t flags)
 		return -ENOLINK;
 	}
 
-	skb = __netdev_alloc_skb_ip_align(dev->net, size, flags);
+	if (test_bit(EVENT_NO_IP_ALIGN, &dev->flags))
+		skb = __netdev_alloc_skb(dev->net, size, flags);
+	else
+		skb = __netdev_alloc_skb_ip_align(dev->net, size, flags);
 	if (!skb) {
 		netif_dbg(dev, rx_err, dev->net, "no rx skb\n");
 		usbnet_defer_kevent (dev, EVENT_RX_MEMORY);
diff --git a/include/linux/usb/usbnet.h b/include/linux/usb/usbnet.h
index a69877734c4e..e2ec3582e549 100644
--- a/include/linux/usb/usbnet.h
+++ b/include/linux/usb/usbnet.h
@@ -82,6 +82,7 @@ struct usbnet {
 #		define EVENT_RX_KILL	10
 #		define EVENT_LINK_CHANGE	11
 #		define EVENT_SET_RX_MODE	12
+#		define EVENT_NO_IP_ALIGN	13
 };
 
 static inline struct usb_driver *driver_of(struct usb_interface *intf)
-- 
2.11.0

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

* usbnet: fix alignment for frames with no ethernet header
@ 2017-12-06 19:21 ` Bjørn Mork
  0 siblings, 0 replies; 8+ messages in thread
From: Bjørn Mork @ 2017-12-06 19:21 UTC (permalink / raw)
  To: netdev; +Cc: Jay Foster, linux-usb, Oliver Neukum, Bjørn Mork

The qmi_wwan minidriver support a 'raw-ip' mode where frames are
received without any ethernet header. This causes alignment issues
because the skbs allocated by usbnet are "IP aligned".

Fix by allowing minidrivers to disable the additional alignment
offset. This is implemented using a per-device flag, since the same
minidriver also supports 'ethernet' mode.

Fixes: 32f7adf633b9 ("net: qmi_wwan: support "raw IP" mode")
Reported-and-tested-by: Jay Foster <jay@systech.com>
Signed-off-by: Bjørn Mork <bjorn@mork.no>
---
 drivers/net/usb/qmi_wwan.c | 2 ++
 drivers/net/usb/usbnet.c   | 5 ++++-
 include/linux/usb/usbnet.h | 1 +
 3 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/net/usb/qmi_wwan.c b/drivers/net/usb/qmi_wwan.c
index c750cf7c042b..304ec6555cd8 100644
--- a/drivers/net/usb/qmi_wwan.c
+++ b/drivers/net/usb/qmi_wwan.c
@@ -261,9 +261,11 @@ static void qmi_wwan_netdev_setup(struct net_device *net)
 		net->hard_header_len = 0;
 		net->addr_len        = 0;
 		net->flags           = IFF_POINTOPOINT | IFF_NOARP | IFF_MULTICAST;
+		set_bit(EVENT_NO_IP_ALIGN, &dev->flags);
 		netdev_dbg(net, "mode: raw IP\n");
 	} else if (!net->header_ops) { /* don't bother if already set */
 		ether_setup(net);
+		clear_bit(EVENT_NO_IP_ALIGN, &dev->flags);
 		netdev_dbg(net, "mode: Ethernet\n");
 	}
 
diff --git a/drivers/net/usb/usbnet.c b/drivers/net/usb/usbnet.c
index 80348b6a8646..d56fe32bf48d 100644
--- a/drivers/net/usb/usbnet.c
+++ b/drivers/net/usb/usbnet.c
@@ -484,7 +484,10 @@ static int rx_submit (struct usbnet *dev, struct urb *urb, gfp_t flags)
 		return -ENOLINK;
 	}
 
-	skb = __netdev_alloc_skb_ip_align(dev->net, size, flags);
+	if (test_bit(EVENT_NO_IP_ALIGN, &dev->flags))
+		skb = __netdev_alloc_skb(dev->net, size, flags);
+	else
+		skb = __netdev_alloc_skb_ip_align(dev->net, size, flags);
 	if (!skb) {
 		netif_dbg(dev, rx_err, dev->net, "no rx skb\n");
 		usbnet_defer_kevent (dev, EVENT_RX_MEMORY);
diff --git a/include/linux/usb/usbnet.h b/include/linux/usb/usbnet.h
index a69877734c4e..e2ec3582e549 100644
--- a/include/linux/usb/usbnet.h
+++ b/include/linux/usb/usbnet.h
@@ -82,6 +82,7 @@ struct usbnet {
 #		define EVENT_RX_KILL	10
 #		define EVENT_LINK_CHANGE	11
 #		define EVENT_SET_RX_MODE	12
+#		define EVENT_NO_IP_ALIGN	13
 };
 
 static inline struct usb_driver *driver_of(struct usb_interface *intf)

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

* Re: [PATCH] usbnet: fix alignment for frames with no ethernet header
@ 2017-12-06 20:56   ` David Miller
  0 siblings, 0 replies; 8+ messages in thread
From: David Miller @ 2017-12-06 20:56 UTC (permalink / raw)
  To: bjorn; +Cc: netdev, jay, linux-usb, oneukum

From: Bjørn Mork <bjorn@mork.no>
Date: Wed,  6 Dec 2017 20:21:24 +0100

> The qmi_wwan minidriver support a 'raw-ip' mode where frames are
> received without any ethernet header. This causes alignment issues
> because the skbs allocated by usbnet are "IP aligned".
> 
> Fix by allowing minidrivers to disable the additional alignment
> offset. This is implemented using a per-device flag, since the same
> minidriver also supports 'ethernet' mode.
> 
> Fixes: 32f7adf633b9 ("net: qmi_wwan: support "raw IP" mode")
> Reported-and-tested-by: Jay Foster <jay@systech.com>
> Signed-off-by: Bjørn Mork <bjorn@mork.no>

Looks good, applied and queued up for -stable.

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

* usbnet: fix alignment for frames with no ethernet header
@ 2017-12-06 20:56   ` David Miller
  0 siblings, 0 replies; 8+ messages in thread
From: David Miller @ 2017-12-06 20:56 UTC (permalink / raw)
  To: bjorn; +Cc: netdev, jay, linux-usb, oneukum

From: Bjørn Mork <bjorn@mork.no>
Date: Wed,  6 Dec 2017 20:21:24 +0100

> The qmi_wwan minidriver support a 'raw-ip' mode where frames are
> received without any ethernet header. This causes alignment issues
> because the skbs allocated by usbnet are "IP aligned".
> 
> Fix by allowing minidrivers to disable the additional alignment
> offset. This is implemented using a per-device flag, since the same
> minidriver also supports 'ethernet' mode.
> 
> Fixes: 32f7adf633b9 ("net: qmi_wwan: support "raw IP" mode")
> Reported-and-tested-by: Jay Foster <jay@systech.com>
> Signed-off-by: Bjørn Mork <bjorn@mork.no>

Looks good, applied and queued up for -stable.
---
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH] usbnet: fix alignment for frames with no ethernet header
@ 2017-12-07 19:01       ` Bjørn Mork
  0 siblings, 0 replies; 8+ messages in thread
From: Bjørn Mork @ 2017-12-07 19:01 UTC (permalink / raw)
  To: David Miller
  Cc: netdev-u79uwXL29TY76Z2rM5mHXA, jay-9P3XyMtXGM1BDgjK7y7TUQ,
	linux-usb-u79uwXL29TY76Z2rM5mHXA, oneukum-IBi9RG/b67k

David Miller <davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org> writes:

> From: Bjørn Mork <bjorn-yOkvZcmFvRU@public.gmane.org>
> Date: Wed,  6 Dec 2017 20:21:24 +0100
>
>> The qmi_wwan minidriver support a 'raw-ip' mode where frames are
>> received without any ethernet header. This causes alignment issues
>> because the skbs allocated by usbnet are "IP aligned".
>> 
>> Fix by allowing minidrivers to disable the additional alignment
>> offset. This is implemented using a per-device flag, since the same
>> minidriver also supports 'ethernet' mode.
>> 
>> Fixes: 32f7adf633b9 ("net: qmi_wwan: support "raw IP" mode")
>> Reported-and-tested-by: Jay Foster <jay-9P3XyMtXGM1BDgjK7y7TUQ@public.gmane.org>
>> Signed-off-by: Bjørn Mork <bjorn-yOkvZcmFvRU@public.gmane.org>
>
> Looks good, applied and queued up for -stable.


Thanks. I can see it in the -stable queue, but it didn't show up here
yet: https://git.kernel.org/pub/scm/linux/kernel/git/davem/net.git

Did it get stuck somewhere?


Bjørn
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* usbnet: fix alignment for frames with no ethernet header
@ 2017-12-07 19:01       ` Bjørn Mork
  0 siblings, 0 replies; 8+ messages in thread
From: Bjørn Mork @ 2017-12-07 19:01 UTC (permalink / raw)
  To: David Miller; +Cc: netdev, jay, linux-usb, oneukum

David Miller <davem@davemloft.net> writes:

> From: Bjørn Mork <bjorn@mork.no>
> Date: Wed,  6 Dec 2017 20:21:24 +0100
>
>> The qmi_wwan minidriver support a 'raw-ip' mode where frames are
>> received without any ethernet header. This causes alignment issues
>> because the skbs allocated by usbnet are "IP aligned".
>> 
>> Fix by allowing minidrivers to disable the additional alignment
>> offset. This is implemented using a per-device flag, since the same
>> minidriver also supports 'ethernet' mode.
>> 
>> Fixes: 32f7adf633b9 ("net: qmi_wwan: support "raw IP" mode")
>> Reported-and-tested-by: Jay Foster <jay@systech.com>
>> Signed-off-by: Bjørn Mork <bjorn@mork.no>
>
> Looks good, applied and queued up for -stable.


Thanks. I can see it in the -stable queue, but it didn't show up here
yet: https://git.kernel.org/pub/scm/linux/kernel/git/davem/net.git

Did it get stuck somewhere?


Bjørn
---
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH] usbnet: fix alignment for frames with no ethernet header
@ 2017-12-07 19:33         ` David Miller
  0 siblings, 0 replies; 8+ messages in thread
From: David Miller @ 2017-12-07 19:33 UTC (permalink / raw)
  To: bjorn; +Cc: netdev, jay, linux-usb, oneukum

From: Bjørn Mork <bjorn@mork.no>
Date: Thu, 07 Dec 2017 20:01:16 +0100

> David Miller <davem@davemloft.net> writes:
> 
>> From: Bjørn Mork <bjorn@mork.no>
>> Date: Wed,  6 Dec 2017 20:21:24 +0100
>>
>>> The qmi_wwan minidriver support a 'raw-ip' mode where frames are
>>> received without any ethernet header. This causes alignment issues
>>> because the skbs allocated by usbnet are "IP aligned".
>>> 
>>> Fix by allowing minidrivers to disable the additional alignment
>>> offset. This is implemented using a per-device flag, since the same
>>> minidriver also supports 'ethernet' mode.
>>> 
>>> Fixes: 32f7adf633b9 ("net: qmi_wwan: support "raw IP" mode")
>>> Reported-and-tested-by: Jay Foster <jay@systech.com>
>>> Signed-off-by: Bjørn Mork <bjorn@mork.no>
>>
>> Looks good, applied and queued up for -stable.
> 
> 
> Thanks. I can see it in the -stable queue, but it didn't show up here
> yet: https://git.kernel.org/pub/scm/linux/kernel/git/davem/net.git
> 
> Did it get stuck somewhere?

Caught again :-)

I do GIT work on two different machines (one at home and one at the
office) and sometimes I head to the office before pushing everything
out on the machine at home :-/

I've pushed this specific patch out to 'net'.

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

* usbnet: fix alignment for frames with no ethernet header
@ 2017-12-07 19:33         ` David Miller
  0 siblings, 0 replies; 8+ messages in thread
From: David Miller @ 2017-12-07 19:33 UTC (permalink / raw)
  To: bjorn; +Cc: netdev, jay, linux-usb, oneukum

From: Bjørn Mork <bjorn@mork.no>
Date: Thu, 07 Dec 2017 20:01:16 +0100

> David Miller <davem@davemloft.net> writes:
> 
>> From: Bjørn Mork <bjorn@mork.no>
>> Date: Wed,  6 Dec 2017 20:21:24 +0100
>>
>>> The qmi_wwan minidriver support a 'raw-ip' mode where frames are
>>> received without any ethernet header. This causes alignment issues
>>> because the skbs allocated by usbnet are "IP aligned".
>>> 
>>> Fix by allowing minidrivers to disable the additional alignment
>>> offset. This is implemented using a per-device flag, since the same
>>> minidriver also supports 'ethernet' mode.
>>> 
>>> Fixes: 32f7adf633b9 ("net: qmi_wwan: support "raw IP" mode")
>>> Reported-and-tested-by: Jay Foster <jay@systech.com>
>>> Signed-off-by: Bjørn Mork <bjorn@mork.no>
>>
>> Looks good, applied and queued up for -stable.
> 
> 
> Thanks. I can see it in the -stable queue, but it didn't show up here
> yet: https://git.kernel.org/pub/scm/linux/kernel/git/davem/net.git
> 
> Did it get stuck somewhere?

Caught again :-)

I do GIT work on two different machines (one at home and one at the
office) and sometimes I head to the office before pushing everything
out on the machine at home :-/

I've pushed this specific patch out to 'net'.
---
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

end of thread, other threads:[~2017-12-07 19:33 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-12-06 19:21 [PATCH] usbnet: fix alignment for frames with no ethernet header Bjørn Mork
2017-12-06 19:21 ` Bjørn Mork
2017-12-06 20:56 ` [PATCH] " David Miller
2017-12-06 20:56   ` David Miller
     [not found]   ` <20171206.155611.1757498962538253791.davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>
2017-12-07 19:01     ` [PATCH] " Bjørn Mork
2017-12-07 19:01       ` Bjørn Mork
2017-12-07 19:33       ` [PATCH] " David Miller
2017-12-07 19:33         ` David Miller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.