File tree Expand file tree Collapse file tree 2 files changed +35
-0
lines changed Expand file tree Collapse file tree 2 files changed +35
-0
lines changed Original file line number Diff line number Diff line change @@ -2812,6 +2812,39 @@ int virtqueue_set_dma_premapped(struct virtqueue *_vq)
2812
2812
}
2813
2813
EXPORT_SYMBOL_GPL (virtqueue_set_dma_premapped );
2814
2814
2815
+ /**
2816
+ * virtqueue_reset - detach and recycle all unused buffers
2817
+ * @_vq: the struct virtqueue we're talking about.
2818
+ * @recycle: callback to recycle unused buffers
2819
+ *
2820
+ * Caller must ensure we don't call this with other virtqueue operations
2821
+ * at the same time (except where noted).
2822
+ *
2823
+ * Returns zero or a negative error.
2824
+ * 0: success.
2825
+ * -EBUSY: Failed to sync with device, vq may not work properly
2826
+ * -ENOENT: Transport or device not supported
2827
+ * -EPERM: Operation not permitted
2828
+ */
2829
+ int virtqueue_reset (struct virtqueue * _vq ,
2830
+ void (* recycle )(struct virtqueue * vq , void * buf ))
2831
+ {
2832
+ struct vring_virtqueue * vq = to_vvq (_vq );
2833
+ int err ;
2834
+
2835
+ err = virtqueue_disable_and_recycle (_vq , recycle );
2836
+ if (err )
2837
+ return err ;
2838
+
2839
+ if (vq -> packed_ring )
2840
+ virtqueue_reinit_packed (vq );
2841
+ else
2842
+ virtqueue_reinit_split (vq );
2843
+
2844
+ return virtqueue_enable_after_reset (_vq );
2845
+ }
2846
+ EXPORT_SYMBOL_GPL (virtqueue_reset );
2847
+
2815
2848
/* Only available for split ring */
2816
2849
struct virtqueue * vring_new_virtqueue (unsigned int index ,
2817
2850
unsigned int num ,
Original file line number Diff line number Diff line change @@ -99,6 +99,8 @@ dma_addr_t virtqueue_get_used_addr(const struct virtqueue *vq);
99
99
100
100
int virtqueue_resize (struct virtqueue * vq , u32 num ,
101
101
void (* recycle )(struct virtqueue * vq , void * buf ));
102
+ int virtqueue_reset (struct virtqueue * vq ,
103
+ void (* recycle )(struct virtqueue * vq , void * buf ));
102
104
103
105
/**
104
106
* struct virtio_device - representation of a device using virtio
You can’t perform that action at this time.
0 commit comments