Pandita, Vikram a écrit : > >> -----Original Message----- >> From: Matthieu CASTET [mailto:matthieu.castet@xxxxxxxxxx] >> Sent: Friday, January 08, 2010 10:15 AM >> To: Pandita, Vikram >> Cc: matthieu castet; linux-usb@xxxxxxxxxxxxxxx; Alan Stern >> Subject: Re: [RFC] gadget ethernet dma align fix >> >> Hi, >> >> Pandita, Vikram a écrit : >>> Matthieu >>> >>>> -----Original Message----- >>>> From: linux-usb-owner@xxxxxxxxxxxxxxx [mailto:linux-usb-owner@xxxxxxxxxxxxxxx] On Behalf Of >> matthieu >>>> castet >>>> Sent: Wednesday, December 23, 2009 2:11 PM >>>> To: linux-usb@xxxxxxxxxxxxxxx >>>> Cc: Alan Stern >>>> Subject: [RFC] gadget ethernet dma align fix >>>> >>>> Hi, >>>> >>>> I attach a patch that should allow to use gadget ethernet with driver >>>> not supporting dma on unaligned address. >>>> >>>> This is untested on real hardware. >>> Gave a first round of test on real hardware. >>> >>> 1) patch did not compile >>> a) missing ; >>> b) a typecast was needed like: ((unsigned long)skb->data & 3) >>> c) WARN_ON() getting hit multiple times, thereby generating un-managable amount of logs: so >> disable WARN_ON() >> That's not normal. We drop all these packets. That should explain why >> "Ping from device side hangs" is not working. >> >> What's the value of skb_headroom in this case. >> May be the check should be >> if ( (skb_headroom(skb) < ((unsigned long)skb->data & 3) )) > > Yes that’s the check that was needed. > So now I have working v3 of the patch(attached) with: > a) added more comments > b) tx alignment added a gadget_dma32() check > > This works perfectly fine for ping from both sides (host/device). > > Maybe we finally have a solution. > Can we get a round of review on usb list? > That's ok for me. I have a minor suggestion : > + > + /* > + * Align data to 32bit if the dma controller requires it > + */ > + if (gadget_dma32(dev->gadget)) { > + > + if (WARN_ON(skb_headroom(skb) < ((unsigned long)skb->data & 3))) { unsigned long align = (unsigned long)skb->data & 3; if (WARN_ON(skb_headroom(skb) < align) { > + dev_kfree_skb_any(skb); > + goto drop; > + } else { } else if (align) { > + u8 *data = skb->data; > + size_t len = skb_headlen(skb); > + skb->data -= ((unsigned long)skb->data & 3); skb->data -= align; > + memmove(skb->data, data, len); > + skb_set_tail_pointer(skb, len); > + } > + } > + -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html