host-drivers/base-driver/vca/vop/vop_common.c
static int
transfer(void *data)
{
	struct buffer_dma_item *item = (struct buffer_dma_item *)data;
	int err = 0;
	struct vop_device *vdev;
	struct buffers_dma_ring *ring;
	BUG_ON(!item);

	ring = item->ring;
	vdev = ring->vdev;
	dev_dbg(&vdev->dev, "%s item %p\n", __func__, item);

	err = transfer_read(item, vdev);
	if (err) {
		transfer_done(item);
		goto end;
	}

	do {
		err = transfer_wait(item, vdev);
	} while (-EBUSY == err);

	if (err) {
		dev_err(&vdev->dev,"%s transfer_wait error %i , item->id %u\n",
			__func__, err, item->id);
		goto end;
	}

	if (!ring->cdev->write_in_thread) {
		err = transfer_write(item, vdev);
		if (err) {
			transfer_done(item);
		}
	} else {
		dev_dbg(&vdev->dev, "DMA send task item->id %u, "
			"uuid_dma_send %u\n", item->id, ring->counter_dma_send);
		BUG_ON(item->id != (ring->counter_dma_send & VOP_RING_SIZE_MASK));
		BUILD_BUG_ON(VOP_RING_SIZE > (1ULL<<(sizeof(ring->counter_dma_send)*8)));
		ring->counter_dma_send++;
		complete(&ring->wait_dma_send);
	}

end:
	if (err)
		dev_err(&vdev->dev,"%s global error %i , item->id %u\n", __func__,
			err, item->id);

	return err;
}
/* move data from one vring to another */
move data from one vring to another
move data from one vring to another
static int
transfer(void *data)
{
	struct buffer_dma_item *item = (struct buffer_dma_item *)data;
	int err = 0;
	struct vop_device *vdev;
	struct buffers_dma_ring *ring;
	BUG_ON(!item);
	ring = item->ring;
	vdev = ring->vdev;
	dev_dbg(&vdev->dev, "%s item %p\n", __func__, item);
	err = transfer_read(item, vdev);
	if (err) {
		transfer_done(item);
		goto end;
	}
	do {
		err = transfer_wait(item, vdev);
	} while (-EBUSY == err);
	if (err) {
		dev_err(&vdev->dev,"%s transfer_wait error %i , item->id %u\n",
			__func__, err, item->id);
		goto end;
	}
	if (!ring->cdev->write_in_thread) {
		err = transfer_write(item, vdev);
		if (err) {
			transfer_done(item);
		}
	} else {
		dev_dbg(&vdev->dev, "DMA send task item->id %u, "
			"uuid_dma_send %u\n", item->id, ring->counter_dma_send);
		BUG_ON(item->id != (ring->counter_dma_send & VOP_RING_SIZE_MASK));
		BUILD_BUG_ON(VOP_RING_SIZE > (1ULL<<(sizeof(ring->counter_dma_send)*8)));
		ring->counter_dma_send++;
		complete(&ring->wait_dma_send);
	}
end:
	if (err)
		dev_err(&vdev->dev,"%s global error %i , item->id %u\n", __func__,
			err, item->id);
	return err;
}
static int transfer ( void * data ) { struct buffer_dma_item * item = ( struct buffer_dma_item * ) data ; int err = 0 ; struct vop_device * vdev ; struct buffers_dma_ring * ring ; BUG_ON ( ! item ) ; ring = item -> ring ; vdev = ring -> vdev ; dev_dbg ( & vdev -> dev , " \n " , __func__ , item ) ; err = transfer_read ( item , vdev ) ; if ( err ) { transfer_done ( item ) ; goto end ; } do { err = transfer_wait ( item , vdev ) ; } while ( - EBUSY == err ) ; if ( err ) { dev_err ( & vdev -> dev , " \n " , __func__ , err , item -> id ) ; goto end ; } if ( ! ring -> cdev -> write_in_thread ) { err = transfer_write ( item , vdev ) ; if ( err ) { transfer_done ( item ) ; } } else { dev_dbg ( & vdev -> dev , " " " \n " , item -> id , ring -> counter_dma_send ) ; BUG_ON ( item -> id != ( ring -> counter_dma_send & VOP_RING_SIZE_MASK ) ) ; BUILD_BUG_ON ( VOP_RING_SIZE > ( 1ULL << ( sizeof ( ring -> counter_dma_send ) * 8 ) ) ) ; ring -> counter_dma_send ++ ; complete ( & ring -> wait_dma_send ) ; } end : if ( err ) dev_err ( & vdev -> dev , " \n " , __func__ , err , item -> id ) ; return err ; }
move data from one vring to another
move data from one vring to another