netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH]  fix sierra_net endianess bug
@ 2012-03-14 14:09 Maris Paupe
  2012-03-14 15:26 ` Andreas Schwab
  0 siblings, 1 reply; 4+ messages in thread
From: Maris Paupe @ 2012-03-14 14:09 UTC (permalink / raw)
  To: epasheva, rfiler; +Cc: netdev

Hello,
I have found that sierra_net does not work properly on big-endian
systems, it works if bytes are flipped in this particular location.

Signed-off-by: Maris Paupe <marisp@mt.lv>
---
diff --git a/drivers/net/usb/sierra_net.c b/drivers/net/usb/sierra_net.c
index b59cf20..cf11924 100644
--- a/drivers/net/usb/sierra_net.c
+++ b/drivers/net/usb/sierra_net.c
@@ -779,7 +779,7 @@ static int sierra_net_bind(struct usbnet *dev, struct usb_interface *intf)
  	dev_dbg(&dev->udev->dev, "Fw attr: %x\n", fwattr);
  
  	/* test whether firmware supports DHCP */
-	if (!(status == sizeof(fwattr) && (fwattr & SWI_GET_FW_ATTR_MASK))) {
+	if (!(status == sizeof(fwattr) && (le16_to_cpu(fwattr) & SWI_GET_FW_ATTR_MASK))) {
  		/* found incompatible firmware version */
  		dev_err(&dev->udev->dev, "Incompatible driver and firmware"
  			" versions\n");
---

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

* Re: [PATCH]  fix sierra_net endianess bug
  2012-03-14 14:09 [PATCH] fix sierra_net endianess bug Maris Paupe
@ 2012-03-14 15:26 ` Andreas Schwab
  2012-03-14 19:24   ` Ben Hutchings
  0 siblings, 1 reply; 4+ messages in thread
From: Andreas Schwab @ 2012-03-14 15:26 UTC (permalink / raw)
  To: Maris Paupe; +Cc: epasheva, rfiler, netdev

Maris Paupe <marisp@mt.lv> writes:

> I have found that sierra_net does not work properly on big-endian
> systems, it works if bytes are flipped in this particular location.

That should probably be fixed in sierra_net_get_fw_attr (and the author
of sierra_net_get_fw_attr should be hit with a cluestick to not use
kmalloc for allocating a single u16).

Andreas.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

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

* Re: [PATCH]  fix sierra_net endianess bug
  2012-03-14 15:26 ` Andreas Schwab
@ 2012-03-14 19:24   ` Ben Hutchings
  2012-03-14 21:10     ` Andreas Schwab
  0 siblings, 1 reply; 4+ messages in thread
From: Ben Hutchings @ 2012-03-14 19:24 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: Maris Paupe, epasheva, rfiler, netdev

On Wed, 2012-03-14 at 16:26 +0100, Andreas Schwab wrote:
> Maris Paupe <marisp@mt.lv> writes:
> 
> > I have found that sierra_net does not work properly on big-endian
> > systems, it works if bytes are flipped in this particular location.
> 
> That should probably be fixed in sierra_net_get_fw_attr (and the author
> of sierra_net_get_fw_attr should be hit with a cluestick to not use
> kmalloc for allocating a single u16).

You cannot use stack buffers for DMA, which includes all USB I/O.

Ben.

-- 
Ben Hutchings, Staff Engineer, Solarflare
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.

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

* Re: [PATCH]  fix sierra_net endianess bug
  2012-03-14 19:24   ` Ben Hutchings
@ 2012-03-14 21:10     ` Andreas Schwab
  0 siblings, 0 replies; 4+ messages in thread
From: Andreas Schwab @ 2012-03-14 21:10 UTC (permalink / raw)
  To: Ben Hutchings; +Cc: Maris Paupe, epasheva, rfiler, netdev

Ben Hutchings <bhutchings@solarflare.com> writes:

> On Wed, 2012-03-14 at 16:26 +0100, Andreas Schwab wrote:
>> Maris Paupe <marisp@mt.lv> writes:
>> 
>> > I have found that sierra_net does not work properly on big-endian
>> > systems, it works if bytes are flipped in this particular location.
>> 
>> That should probably be fixed in sierra_net_get_fw_attr (and the author
>> of sierra_net_get_fw_attr should be hit with a cluestick to not use
>> kmalloc for allocating a single u16).
>
> You cannot use stack buffers for DMA, which includes all USB I/O.

Ok, sorry, I didn't know that.

Andreas.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

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

end of thread, other threads:[~2012-03-14 21:10 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-03-14 14:09 [PATCH] fix sierra_net endianess bug Maris Paupe
2012-03-14 15:26 ` Andreas Schwab
2012-03-14 19:24   ` Ben Hutchings
2012-03-14 21:10     ` Andreas Schwab

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