From patchwork Fri Sep 1 14:50:57 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joao Martins X-Patchwork-Id: 9934423 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 92F656016C for ; Fri, 1 Sep 2017 14:53:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 81CC01FEB1 for ; Fri, 1 Sep 2017 14:53:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 758FB1FF61; Fri, 1 Sep 2017 14:53:59 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 5E0921FF60 for ; Fri, 1 Sep 2017 14:53:56 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dnnI4-0002vK-75; Fri, 01 Sep 2017 14:51:24 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dnnI3-0002ue-8G for xen-devel@lists.xen.org; Fri, 01 Sep 2017 14:51:23 +0000 Received: from [85.158.139.211] by server-15.bemta-5.messagelabs.com id 15/09-01777-AE379A95; Fri, 01 Sep 2017 14:51:22 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFmpjkeJIrShJLcpLzFFi42LpnVTnqvuyeGW kwboGC4slHxezODB6HN39mymAMYo1My8pvyKBNePm2TVMBQt0Krpe9TI3MD5R7GLk5BASmMAk 0fNKvouRC8j+wyjxbMpPZghnA6NE79wXjBBOI6PEi475bCAtbAJ6Eq3nPzOD2CIC6hKnOy6yg hQxC2xmlJh7vAnI4eAQFvCReLbOCaSGRUBV4nnrZmaQMK+AncS0CbEgYQkBeYldbSCtnBycAv YSs/fdZIG4yE6i8es1ZogaQ4nTD7cxTmDkW8DIsIpRvTi1qCy1SNdIL6koMz2jJDcxM0fX0MB ULze1uDgxPTUnMalYLzk/dxMjMEwYgGAH4/c/TocYJTmYlER5q/1XRArxJeWnVGYkFmfEF5Xm pBYfYpTh4FCS4O0vWhkpJFiUmp5akZaZAwxYmLQEB4+SCO9RkDRvcUFibnFmOkTqFKMux4bV6 78wCbHk5eelSonzXgEpEgApyijNgxsBi55LjLJSwryMQEcJ8RSkFuVmlqDKv2IU52BUEuaNBZ nCk5lXArfpFdARTEBH/Pu8AuSIkkSElFQDo3SehH0CZ/LxwCcVkW8+THSrTV+rtFvY+M/jgl2 fjugxtb84cezKNtND6dJJ9ut1siIlNQqeiFR+ClcpN//xdtKtOvNPs1e/CVsw4e69fQ+D2WNi pyzY0N3SUf1+Uaaoh81stw39q4tCQ621mKc6y27ex54Tfb3w7/6yiJYddekX5myTtdNap8RSn JFoqMVcVJwIAFeGCXiZAgAA X-Env-Sender: joao.m.martins@oracle.com X-Msg-Ref: server-10.tower-206.messagelabs.com!1504277479!81532131!1 X-Originating-IP: [141.146.126.69] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogMTQxLjE0Ni4xMjYuNjkgPT4gMjc3MjE4\n X-StarScan-Received: X-StarScan-Version: 9.4.45; banners=-,-,- X-VirusChecked: Checked Received: (qmail 44209 invoked from network); 1 Sep 2017 14:51:21 -0000 Received: from aserp1040.oracle.com (HELO aserp1040.oracle.com) (141.146.126.69) by server-10.tower-206.messagelabs.com with DHE-RSA-AES256-GCM-SHA384 encrypted SMTP; 1 Sep 2017 14:51:21 -0000 Received: from userv0021.oracle.com (userv0021.oracle.com [156.151.31.71]) by aserp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id v81EpHpG029536 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 1 Sep 2017 14:51:17 GMT Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by userv0021.oracle.com (8.14.4/8.14.4) with ESMTP id v81EpGNI020935 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 1 Sep 2017 14:51:17 GMT Received: from abhmp0007.oracle.com (abhmp0007.oracle.com [141.146.116.13]) by aserv0121.oracle.com (8.14.4/8.13.8) with ESMTP id v81EpGfY000474; Fri, 1 Sep 2017 14:51:16 GMT Received: from paddy.lan (/94.61.137.133) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Fri, 01 Sep 2017 07:51:16 -0700 From: Joao Martins To: Xen-devel Date: Fri, 1 Sep 2017 15:50:57 +0100 Message-Id: <20170901145057.17414-2-joao.m.martins@oracle.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170901145057.17414-1-joao.m.martins@oracle.com> References: <20170901145057.17414-1-joao.m.martins@oracle.com> X-Source-IP: userv0021.oracle.com [156.151.31.71] Cc: Joao Martins , Paul Durrant , Wei Liu Subject: [Xen-devel] [PATCH v2 1/1] public/io/netif.h: add gref mapping control messages X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP Adds 3 messages to allow guest to let backend keep grants mapped, such that 1) guests allowing fast recycling of pages can avoid doing grant ops for those cases, or otherwise 2) preferring copies over grants and 3) always using a fixed set of pages for network I/O. The three control ring messages added are: - Add grefs to be mapped by backend - Remove grefs mappings (If they are not in use) - Get maximum amount of grefs kept mapped. Signed-off-by: Joao Martins --- xen/include/public/io/netif.h | 114 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 114 insertions(+) diff --git a/xen/include/public/io/netif.h b/xen/include/public/io/netif.h index ca0061410d..264c317471 100644 --- a/xen/include/public/io/netif.h +++ b/xen/include/public/io/netif.h @@ -353,6 +353,9 @@ struct xen_netif_ctrl_request { #define XEN_NETIF_CTRL_TYPE_SET_HASH_MAPPING_SIZE 5 #define XEN_NETIF_CTRL_TYPE_SET_HASH_MAPPING 6 #define XEN_NETIF_CTRL_TYPE_SET_HASH_ALGORITHM 7 +#define XEN_NETIF_CTRL_TYPE_GET_GREF_MAPPING_SIZE 8 +#define XEN_NETIF_CTRL_TYPE_ADD_GREF_MAPPING 9 +#define XEN_NETIF_CTRL_TYPE_PUT_GREF_MAPPING 10 uint32_t data[3]; }; @@ -391,6 +394,41 @@ struct xen_netif_ctrl_response { }; /* + * Static Grants (struct xen_netif_gref_alloc) + * =========================================== + * + * A frontend may provide a fixed set of grant references to be mapped on + * the backend. The message of type XEN_NETIF_CTRL_TYPE_ADD_GREF_MAPPING + * prior its usage in the command ring allows for creation of these mappings. + * The backend will maintain a fixed amount of these mappings. + * + * XEN_NETIF_CTRL_TYPE_GET_GREF_MAPPING_SIZE lets a frontend query how many + * of these mappings can be kept. + * + * Each entry in the XEN_NETIF_CTRL_TYPE_{ADD,PUT}_GREF_MAPPING input table has + * the following format: + * + * 0 1 2 3 4 5 6 7 octet + * +-----+-----+-----+-----+-----+-----+-----+-----+ + * | grant ref | flags | padding | + * +-----+-----+-----+-----+-----+-----+-----+-----+ + * + * grant ref: grant reference + * flags: flags describing the control operation + * + */ + +struct xen_netif_gref_alloc { + grant_ref_t ref; + uint16_t flags; + +#define _XEN_NETIF_CTRLF_GREF_readonly 0 +#define XEN_NETIF_CTRLF_GREF_readonly (1U<<_XEN_NETIF_CTRLF_GREF_readonly) + + uint8_t pad[2]; +}; + +/* * Control messages * ================ * @@ -609,6 +647,82 @@ struct xen_netif_ctrl_response { * invalidate any table data outside that range. * The grant reference may be read-only and must remain valid until * the response has been processed. + * + * XEN_NETIF_CTRL_TYPE_GET_GREF_MAPPING_SIZE + * ----------------------------------------- + * + * This is sent by the frontend to fetch the number of grefs that can be kept + * mapped in the backend. + * + * Request: + * + * type = XEN_NETIF_CTRL_TYPE_GET_GREF_MAPPING_SIZE + * data[0] = queue index (assumed 0 for single queue) + * data[1] = 0 + * data[2] = 0 + * + * Response: + * + * status = XEN_NETIF_CTRL_STATUS_NOT_SUPPORTED - Operation not + * supported + * XEN_NETIF_CTRL_STATUS_INVALID_PARAMETER - The queue index is + * out of range + * XEN_NETIF_CTRL_STATUS_SUCCESS - Operation successful + * data = maximum number of entries allowed in the gref mapping table + * (if operation was successful) or zero if a mapping table is + * not supported (i.e. hash mapping is done only by modular + * arithmetic). + * + * XEN_NETIF_CTRL_TYPE_ADD_GREF_MAPPING + * ------------------------------------ + * + * This is sent by the frontend for backend to map a list of grant + * references. + * + * Request: + * + * type = XEN_NETIF_CTRL_TYPE_ADD_GREF_MAPPING + * data[0] = queue index + * data[1] = grant reference of page containing the mapping list + * (assumed to start at beginning of grant) + * data[2] = size of list in entries + * + * Response: + * + * status = XEN_NETIF_CTRL_STATUS_NOT_SUPPORTED - Operation not + * supported + * XEN_NETIF_CTRL_STATUS_INVALID_PARAMETER - Operation failed + * XEN_NETIF_CTRL_STATUS_SUCCESS - Operation successful + * + * NOTE: Each entry in the input table has the format outlined + * in struct xen_netif_gref_alloc. + * + * XEN_NETIF_CTRL_TYPE_PUT_GREF_MAPPING + * ------------------------------------ + * + * This is sent by the frontend for backend to unmap a list of grant + * references. + * + * Request: + * + * type = XEN_NETIF_CTRL_TYPE_PUT_GREF_MAPPING + * data[0] = queue index + * data[1] = grant reference of page containing the mapping list + * (assumed to start at beginning of page) + * data[2] = size of list in entries + * + * Response: + * + * status = XEN_NETIF_CTRL_STATUS_NOT_SUPPORTED - Operation not + * supported + * XEN_NETIF_CTRL_STATUS_INVALID_PARAMETER - Operation failed + * XEN_NETIF_CTRL_STATUS_SUCCESS - Operation successful + * + * NOTE: Each entry in the input table has the format outlined in + * struct xen_netif_gref_alloc. The only valid entries are those + * previously added with message XEN_NETIF_CTRL_TYPE_ADD_GREF_MAPPING + * are valid. Additionally, entries in inflight will deliver an error. + * */ DEFINE_RING_TYPES(xen_netif_ctrl,