@@ -25,6 +25,7 @@
#ifndef NET_9P_TRANSPORT_H
#define NET_9P_TRANSPORT_H
+#define P9_CAP_GET_MAX_SG_PAGES 0x01
/**
* struct p9_trans_module - transport module interface
@@ -53,6 +54,7 @@ struct p9_trans_module {
void (*close) (struct p9_client *);
int (*request) (struct p9_client *, struct p9_req_t *req);
int (*cancel) (struct p9_client *, struct p9_req_t *req);
+ int (*capability) (int req);
};
void v9fs_register_trans(struct p9_trans_module *m);
@@ -374,6 +374,18 @@ static void p9_virtio_remove(struct virtio_device *vdev)
}
+/**
+ * p9_virtio_capability - Return the queried capability related information.
+ *
+ */
+static int p9_virtio_capability(int req)
+{
+ int ret = 0;
+ if (req == P9_CAP_GET_MAX_SG_PAGES)
+ ret = VIRTQUEUE_NUM - 8; /* Keep 8 for in/out headers */
+ return ret;
+}
+
static struct virtio_device_id id_table[] = {
{ VIRTIO_ID_9P, VIRTIO_DEV_ANY_ID },
{ 0 },
@@ -400,6 +412,7 @@ static struct p9_trans_module p9_virtio_trans = {
.close = p9_virtio_close,
.request = p9_virtio_request,
.cancel = p9_virtio_cancel,
+ .capability = p9_virtio_capability,
.maxsize = PAGE_SIZE*16,
.def = 0,
.owner = THIS_MODULE,