[PATCH 1/5] [net/9p] Add capability() to p9_trans_module

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Every transport layer may have unique capabilities. This function is employed
to query and make use of those special/unique cabailities.
To start with we will be defining P9_CAP_GET_MAX_SG_PAGES.
If capability(P9_CAP_GET_MAX_SG_PAGES) exists AND returns a value greater
than 0, it means that the transport can support the transportation
of that many mapped pages between the client and server.

Signed-off-by: Venkateswararao Jujjuri <jvrao@xxxxxxxxxxxxxxxxxx>
Signed-off-by: Badari Pulavarty <pbadari@xxxxxxxxxx>
---
 include/net/9p/transport.h |    2 ++
 net/9p/trans_virtio.c      |   13 +++++++++++++
 2 files changed, 15 insertions(+), 0 deletions(-)

diff --git a/include/net/9p/transport.h b/include/net/9p/transport.h
index 6d5886e..495a118 100644
--- a/include/net/9p/transport.h
+++ b/include/net/9p/transport.h
@@ -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);
diff --git a/net/9p/trans_virtio.c b/net/9p/trans_virtio.c
index dcfbe99..762c19f 100644
--- a/net/9p/trans_virtio.c
+++ b/net/9p/trans_virtio.c
@@ -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,
-- 
1.6.5.2

--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]
  Powered by Linux