RE: [PATCH v9 5/6] usb:cdns3 Add Cadence USB3 DRD Driver

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

 



>
>>
>> Yes, driver frees not used buffers here.
>> I think that it's the safest place for this purpose.
>>
>> >
>> >>>> +				dma_free_coherent(priv_dev->sysdev, buf-
>> >size,
>> >>>> +						  buf->buf,
>> >>>> +						  buf->dma);
>> >>>> +				spin_lock_irqsave(&priv_dev->lock, flags);
>> >>>> +
>> >>>> +				kfree(buf);
>> >>>
>> >>>why do you even need this "garbage collector"?
>> >>
>> >> I need to free not used memory. The once allocated buffer will be
>> >> associated with request, but if request.length will be increased in
>> >> usb_request then driver will must allocate the  bigger buffer. As I
>> >> remember I couldn't call dma_free_coherent in interrupt context so I
>> >> had to move it to thread handled. This flag was used to avoid going through
>> whole  aligned_buf_list  every time.
>> >> In most cases this part will never called int this place
>> >
>> >Did you try, btw, setting the quirk flag which tells gadget drivers to
>> >always allocate buffers aligned to MaxPacketSize? Wouldn't that be enough?
>>
>> If found only  quirk_ep_out_aligned_size flag, but it align only buffer size.
>>
>> DMA used by this controller must have buffer address aligned to 8.
>> I think that on most architecture kmalloc should guarantee such aligned.
>> The problem was detected on NXP testing board.
>> On my board all buffer address are alignment at least to 8.
>>
>
>This un-aligned request buffer address for 8 occurs for Ethernet Gadget (eg, NCM),
>it allocates socket buffer with NET_IP_ALIGN, so the last byte of buffer address
>is always 2. Although this can be workaround by setting quirk_avoids_skb_reserve,
>but we are not sure if all gadget request buffers can be 8 or Max Packet Size aligned.
>

Thanks Peter for explanation. 
I will add quirk_avoids_skb_reserve to avoid using this extra buffers, but I leave this 
code for safety. 

--
Cheers,
Pawell





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

  Powered by Linux