Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 370933
b: refs/heads/master
c: 3beee86
h: refs/heads/master
i:
  370931: d84fded
v: v3
  • Loading branch information
Sjur Brændeland authored and Rusty Russell committed Mar 20, 2013
1 parent d92c10b commit ad6ae96
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 1515c5ce26ae45a8ecea4e68a484562ca4356442
refs/heads/master: 3beee86a4b9374e38dba36b44e81f1423a0d6b54
3 changes: 3 additions & 0 deletions trunk/include/linux/virtio.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include <linux/device.h>
#include <linux/mod_devicetable.h>
#include <linux/gfp.h>
#include <linux/vringh.h>

/**
* virtqueue - a queue to register buffers for sending or receiving.
Expand Down Expand Up @@ -70,6 +71,7 @@ static inline unsigned int virtqueue_get_queue_index(struct virtqueue *vq)
* @dev: underlying device.
* @id: the device type identification (used to match it with a driver).
* @config: the configuration ops for this device.
* @vringh_config: configuration ops for host vrings.
* @vqs: the list of virtqueues for this device.
* @features: the features supported by both driver and device.
* @priv: private pointer for the driver's use.
Expand All @@ -79,6 +81,7 @@ struct virtio_device {
struct device dev;
struct virtio_device_id id;
const struct virtio_config_ops *config;
const struct vringh_config_ops *vringh_config;
struct list_head vqs;
/* Note that this is a Linux set_bit-style bitmap. */
unsigned long features[1];
Expand Down
29 changes: 29 additions & 0 deletions trunk/include/linux/vringh.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,28 @@ struct vringh {

/* The vring (note: it may contain user pointers!) */
struct vring vring;

/* The function to call to notify the guest about added buffers */
void (*notify)(struct vringh *);
};

/**
* struct vringh_config_ops - ops for creating a host vring from a virtio driver
* @find_vrhs: find the host vrings and instantiate them
* vdev: the virtio_device
* nhvrs: the number of host vrings to find
* hvrs: on success, includes new host vrings
* callbacks: array of driver callbacks, for each host vring
* include a NULL entry for vqs that do not need a callback
* Returns 0 on success or error status
* @del_vrhs: free the host vrings found by find_vrhs().
*/
struct virtio_device;
typedef void vrh_callback_t(struct virtio_device *, struct vringh *);
struct vringh_config_ops {
int (*find_vrhs)(struct virtio_device *vdev, unsigned nhvrs,
struct vringh *vrhs[], vrh_callback_t *callbacks[]);
void (*del_vrhs)(struct virtio_device *vdev);
};

/* The memory the vring can access, and what offset to apply. */
Expand Down Expand Up @@ -193,4 +215,11 @@ void vringh_notify_disable_kern(struct vringh *vrh);

int vringh_need_notify_kern(struct vringh *vrh);

/* Notify the guest about buffers added to the used ring */
static inline void vringh_notify(struct vringh *vrh)
{
if (vrh->notify)
vrh->notify(vrh);
}

#endif /* _LINUX_VRINGH_H */

0 comments on commit ad6ae96

Please sign in to comment.