On Mon, Jul 27, 2015 at 01:46:41PM +0200, Lars-Peter Clausen wrote: > On 07/24/2015 09:12 PM, Robert Jarzmik wrote: > >Vinod Koul <vinod.koul@xxxxxxxxx> writes: > > > >>On Fri, Jul 24, 2015 at 10:28:45AM +0200, Lars-Peter Clausen wrote: > >>>I don' think we need set set and clear functions. We need them for > >>>the ACK flag because the ACK flag can be set later on. But the REUSE > >>>flag should be specified when the descriptor is created so the > >>>driver can make the necessary preparations it might need to support > >>>re-usable descriptors. Maybe we should call the flag > >>>DMA_PREP_REUSABLE (like the other DMA_PREP_*) flag to reflect this. > >>The flow I have depicted is that descriptor prepare should not be linked to > >>it's reuse. The submit operation specifies if a descriptor can be reused or > >>not, so driver knows what to do after txn completion > >>While reusing if client wants to stop reusing it can clear reuse flag and > >>submit so that descriptor is freed up > > > >I think the same way as Vinod. > > > >Giving the dmaengine user the flexibility to reuse or not the descriptor is > >great. Moreover, this flexibility will extend to userspace, as some dmaengine > >users, such as v4l2, don't know if a descriptor will be reused : it's a > >userspace decision whever to requeue the transmission or not, up to the driver. > > Yeah, but typically you don't know whether the descriptor is going > to be re-used or not when submitting it. > > E.g. v4l2. The application will allocate the buffer and then call > QBUF ioctl which will submit the buffer. The DMA fills the buffer > and once it finishes the application uses the DQBUF ioctl to dequeue > it. Now the application might stop capturing, or it might continue. > In the later case it will use the QBUF ioctl again and the > previously allocated descriptor will be re-used. When the initial > QBUF is performed it is not known whether the buffer will be queued > a second time and whether it should have the re-usable flag set. > > So the re-usable flag should an indicator the DMAengine driver that > the client might re-use the descriptor, not that it will definitely > re-use it. For some drivers/controllers a re-usable descriptors > might have special requirements and the DMAengine driver needs to > know this during allocation of the descriptor to meet those > requirements. > > Which is why I think that re-usability should be a preparation flag. > If it was set during allocation the client is allowed to submit the > descriptor multiple times (But does not have to), otherwise not. So in this case you will always set the descriptor as reuse as you dont know while submitting. Such users can always set the flag, while we get benfit from the cases which know about this. -- ~Vinod -- To unsubscribe from this list: send the line "unsubscribe dmaengine" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html