Re: [RFC] MUSB: Workaround for Ethernet data alignment issue

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

Patra, Nilkesh a écrit :
> On the latest version of MUSB, DMA is not working properly if the Data in the packet doesn't start at 32bit aligned address. This issue was found while using MUSB as g_ether. The basic ping does not work, if the data in the Ethernet  packet does not start at 32bit aligned address.
> 
> To overcome this issue, we found one solution mentioned in the below patch. This patch moves data (skb->data) by 2 bytes backwards in ethernet packet, which is nothing but skb->head.
> 
> I want to know, if there are any better approaches to fix this issue.
>
What dma_mask are you using ?

>From what I understand, dma_map_single will use it to know if the dma
buffer need to be aligned [1].
So you need to set the last 2 bits to 0 and it should do everything for you.


Matthieu

[1]
       /*
         * Figure out if we need to bounce from the DMA mask.
         */
        needs_bounce = (dma_addr | (dma_addr + size - 1)) & ~mask;
    }

    if (device_info && (needs_bounce || dma_needs_bounce(dev, dma_addr,
size))) {
        struct safe_buffer *buf;

        buf = alloc_safe_buffer(device_info, ptr, size, dir);
--
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

[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux