From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Venkateswararao Jujjuri (JV)" Subject: [PATCH 1/5] [net/9p] Add capability() to p9_trans_module Date: Tue, 17 Aug 2010 10:27:21 -0700 Message-ID: <1282066045-3945-2-git-send-email-jvrao@linux.vnet.ibm.com> References: <1282066045-3945-1-git-send-email-jvrao@linux.vnet.ibm.com> Cc: linux-fsdevel@vger.kernel.org, "Venkateswararao Jujjuri (JV)" , Badari Pulavarty To: v9fs-developer@lists.sourceforge.net Return-path: Received: from e36.co.us.ibm.com ([32.97.110.154]:50405 "EHLO e36.co.us.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753905Ab0HQRTm (ORCPT ); Tue, 17 Aug 2010 13:19:42 -0400 Received: from d03relay03.boulder.ibm.com (d03relay03.boulder.ibm.com [9.17.195.228]) by e36.co.us.ibm.com (8.14.4/8.13.1) with ESMTP id o7HHFt6K003178 for ; Tue, 17 Aug 2010 11:15:55 -0600 Received: from d03av02.boulder.ibm.com (d03av02.boulder.ibm.com [9.17.195.168]) by d03relay03.boulder.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id o7HHJbHB176800 for ; Tue, 17 Aug 2010 11:19:38 -0600 Received: from d03av02.boulder.ibm.com (loopback [127.0.0.1]) by d03av02.boulder.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id o7HHJYC0002119 for ; Tue, 17 Aug 2010 11:19:37 -0600 In-Reply-To: <1282066045-3945-1-git-send-email-jvrao@linux.vnet.ibm.com> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: 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 Signed-off-by: Badari Pulavarty --- 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