get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

GET /api/patches/37529/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 37529,
    "url": "https://patches.dpdk.org/api/patches/37529/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/20180408125821.20330-6-pablo.de.lara.guarch@intel.com/",
    "project": {
        "id": 1,
        "url": "https://patches.dpdk.org/api/projects/1/?format=api",
        "name": "DPDK",
        "link_name": "dpdk",
        "list_id": "dev.dpdk.org",
        "list_email": "dev@dpdk.org",
        "web_url": "http://core.dpdk.org",
        "scm_url": "git://dpdk.org/dpdk",
        "webscm_url": "http://git.dpdk.org/dpdk",
        "list_archive_url": "https://inbox.dpdk.org/dev",
        "list_archive_url_format": "https://inbox.dpdk.org/dev/{}",
        "commit_url_format": ""
    },
    "msgid": "<20180408125821.20330-6-pablo.de.lara.guarch@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20180408125821.20330-6-pablo.de.lara.guarch@intel.com",
    "date": "2018-04-08T12:58:13",
    "name": "[dpdk-dev,v4,05/13] compressdev: add operation management",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "abc38ec8d76e77016316c26be2b8dfb391243601",
    "submitter": {
        "id": 9,
        "url": "https://patches.dpdk.org/api/people/9/?format=api",
        "name": "De Lara Guarch, Pablo",
        "email": "pablo.de.lara.guarch@intel.com"
    },
    "delegate": {
        "id": 22,
        "url": "https://patches.dpdk.org/api/users/22/?format=api",
        "username": "pdelarag",
        "first_name": "Pablo",
        "last_name": "de Lara Guarch",
        "email": "pablo.de.lara.guarch@intel.com"
    },
    "mbox": "https://patches.dpdk.org/project/dpdk/patch/20180408125821.20330-6-pablo.de.lara.guarch@intel.com/mbox/",
    "series": [],
    "comments": "https://patches.dpdk.org/api/patches/37529/comments/",
    "check": "fail",
    "checks": "https://patches.dpdk.org/api/patches/37529/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<dev-bounces@dpdk.org>",
        "X-Original-To": "patchwork@dpdk.org",
        "Delivered-To": "patchwork@dpdk.org",
        "Received": [
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id 76C2B1B6AD;\n\tSun,  8 Apr 2018 14:58:25 +0200 (CEST)",
            "from mga09.intel.com (mga09.intel.com [134.134.136.24])\n\tby dpdk.org (Postfix) with ESMTP id ACA831B689\n\tfor <dev@dpdk.org>; Sun,  8 Apr 2018 14:58:21 +0200 (CEST)",
            "from orsmga002.jf.intel.com ([10.7.209.21])\n\tby orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t08 Apr 2018 05:58:21 -0700",
            "from silpixa00399464.ir.intel.com (HELO\n\tsilpixa00399464.ger.corp.intel.com) ([10.237.222.157])\n\tby orsmga002.jf.intel.com with ESMTP; 08 Apr 2018 05:58:19 -0700"
        ],
        "X-Amp-Result": "SKIPPED(no attachment in message)",
        "X-Amp-File-Uploaded": "False",
        "X-ExtLoop1": "1",
        "X-IronPort-AV": "E=Sophos;i=\"5.48,423,1517904000\"; d=\"scan'208\";a=\"48992547\"",
        "From": "Pablo de Lara <pablo.de.lara.guarch@intel.com>",
        "To": "dev@dpdk.org",
        "Cc": "fiona.trahe@intel.com, shally.verma@cavium.com, ahmed.mansour@nxp.com,\n\tAshish.Gupta@cavium.com, Pablo de Lara <pablo.de.lara.guarch@intel.com>, \n\tShally Verma <shally.verma@caviumnetworks.com>,\n\tAshish Gupta <ashish.gupta@caviumnetworks.com>",
        "Date": "Sun,  8 Apr 2018 13:58:13 +0100",
        "Message-Id": "<20180408125821.20330-6-pablo.de.lara.guarch@intel.com>",
        "X-Mailer": "git-send-email 2.14.3",
        "In-Reply-To": "<20180408125821.20330-1-pablo.de.lara.guarch@intel.com>",
        "References": "<20180406180512.40154-1-pablo.de.lara.guarch@intel.com>\n\t<20180408125821.20330-1-pablo.de.lara.guarch@intel.com>",
        "Subject": "[dpdk-dev] [PATCH v4 05/13] compressdev: add operation management",
        "X-BeenThere": "dev@dpdk.org",
        "X-Mailman-Version": "2.1.15",
        "Precedence": "list",
        "List-Id": "DPDK patches and discussions <dev.dpdk.org>",
        "List-Unsubscribe": "<https://dpdk.org/ml/options/dev>,\n\t<mailto:dev-request@dpdk.org?subject=unsubscribe>",
        "List-Archive": "<http://dpdk.org/ml/archives/dev/>",
        "List-Post": "<mailto:dev@dpdk.org>",
        "List-Help": "<mailto:dev-request@dpdk.org?subject=help>",
        "List-Subscribe": "<https://dpdk.org/ml/listinfo/dev>,\n\t<mailto:dev-request@dpdk.org?subject=subscribe>",
        "Errors-To": "dev-bounces@dpdk.org",
        "Sender": "\"dev\" <dev-bounces@dpdk.org>"
    },
    "content": "From: Fiona Trahe <fiona.trahe@intel.com>\n\nAdded functions to allocate and free compression operations.\n\nSigned-off-by: Fiona Trahe <fiona.trahe@intel.com>\nSigned-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>\nSigned-off-by: Shally Verma <shally.verma@caviumnetworks.com>\nSigned-off-by: Ashish Gupta <ashish.gupta@caviumnetworks.com>\n---\n lib/librte_compressdev/rte_comp.h                  | 195 +++++++++++++++++++++\n lib/librte_compressdev/rte_compressdev.c           |  72 ++++++++\n lib/librte_compressdev/rte_compressdev_version.map |   1 +\n 3 files changed, 268 insertions(+)",
    "diff": "diff --git a/lib/librte_compressdev/rte_comp.h b/lib/librte_compressdev/rte_comp.h\nindex cf0f3c999..4cf84c5db 100644\n--- a/lib/librte_compressdev/rte_comp.h\n+++ b/lib/librte_compressdev/rte_comp.h\n@@ -305,6 +305,201 @@ struct rte_comp_op {\n \t */\n } __rte_cache_aligned;\n \n+\n+/**\n+ * Reset the fields of an operation to their default values.\n+ *\n+ * @note The private data associated with the operation is not zeroed.\n+ *\n+ * @param op\n+ *   The operation to be reset\n+ */\n+static inline void\n+__rte_comp_op_reset(struct rte_comp_op *op)\n+{\n+\tstruct rte_mempool *tmp_mp = op->mempool;\n+\trte_iova_t tmp_iova_addr = op->iova_addr;\n+\n+\tmemset(op, 0, sizeof(struct rte_comp_op));\n+\top->status = RTE_COMP_OP_STATUS_NOT_PROCESSED;\n+\top->iova_addr = tmp_iova_addr;\n+\top->mempool = tmp_mp;\n+}\n+\n+/**\n+ * Private data structure belonging to an operation pool.\n+ */\n+struct rte_comp_op_pool_private {\n+\tuint16_t user_size;\n+\t/**< Size of private user data with each operation. */\n+};\n+\n+\n+/**\n+ * Returns the size of private user data allocated with each object in\n+ * the mempool\n+ *\n+ * @param mempool\n+ *   Mempool for operations\n+ * @return\n+ *   user data size\n+ */\n+static inline uint16_t\n+__rte_comp_op_get_user_data_size(struct rte_mempool *mempool)\n+{\n+\tstruct rte_comp_op_pool_private *priv =\n+\t    (struct rte_comp_op_pool_private *)rte_mempool_get_priv(mempool);\n+\n+\treturn priv->user_size;\n+}\n+\n+\n+/**\n+ * Creates an operation pool\n+ *\n+ * @param name\n+ *   Compress pool name\n+ * @param nb_elts\n+ *   Number of elements in pool\n+ * @param cache_size\n+ *   Number of elements to cache on lcore, see\n+ *   *rte_mempool_create* for further details about cache size\n+ * @param user_size\n+ *   Size of private data to allocate for user with each operation\n+ * @param socket_id\n+ *   Socket to identifier allocate memory on\n+ * @return\n+ *  - On success pointer to mempool\n+ *  - On failure NULL\n+ */\n+struct rte_mempool *\n+rte_comp_op_pool_create(const char *name,\n+\t\tunsigned int nb_elts, unsigned int cache_size,\n+\t\tuint16_t user_size, int socket_id);\n+\n+/**\n+ * Bulk allocate raw element from mempool and return as comp operations\n+ *\n+ * @param mempool\n+ *   Compress operation mempool\n+ * @param ops\n+ *   Array to place allocated operations\n+ * @param nb_ops\n+ *   Number of operations to allocate\n+ * @return\n+ * - On success returns  number of ops allocated\n+ */\n+static inline int\n+__rte_comp_op_raw_bulk_alloc(struct rte_mempool *mempool,\n+\t\tstruct rte_comp_op **ops, uint16_t nb_ops)\n+{\n+\tif (rte_mempool_get_bulk(mempool, (void **)ops, nb_ops) == 0)\n+\t\treturn nb_ops;\n+\n+\treturn 0;\n+}\n+\n+/**\n+ * Allocate an operation from a mempool with default parameters set\n+ *\n+ * @param mempool\n+ *   Compress operation mempool\n+ *\n+ * @return\n+ * - On success returns a valid rte_comp_op structure\n+ * - On failure returns NULL\n+ */\n+static inline struct rte_comp_op *\n+rte_comp_op_alloc(struct rte_mempool *mempool)\n+{\n+\tstruct rte_comp_op *op = NULL;\n+\tint retval;\n+\n+\tretval = __rte_comp_op_raw_bulk_alloc(mempool, &op, 1);\n+\tif (unlikely(retval != 1))\n+\t\treturn NULL;\n+\n+\t__rte_comp_op_reset(op);\n+\n+\treturn op;\n+}\n+\n+\n+/**\n+ * Bulk allocate operations from a mempool with default parameters set\n+ *\n+ * @param mempool\n+ *   Compress operation mempool\n+ * @param ops\n+ *   Array to place allocated operations\n+ * @param nb_ops\n+ *   Number of operations to allocate\n+ * @return\n+ * - nb_ops if the number of operations requested were allocated.\n+ * - 0 if the requested number of ops are not available.\n+ *   None are allocated in this case.\n+ */\n+static inline unsigned\n+rte_comp_op_bulk_alloc(struct rte_mempool *mempool,\n+\t\tstruct rte_comp_op **ops, uint16_t nb_ops)\n+{\n+\tint i;\n+\n+\tif (unlikely(__rte_comp_op_raw_bulk_alloc(mempool, ops, nb_ops)\n+\t\t\t!= nb_ops))\n+\t\treturn 0;\n+\n+\tfor (i = 0; i < nb_ops; i++)\n+\t\t__rte_comp_op_reset(ops[i]);\n+\n+\treturn nb_ops;\n+}\n+\n+\n+\n+/**\n+ * Returns a pointer to the private user data of an operation if\n+ * that operation has enough capacity for requested size.\n+ *\n+ * @param op\n+ *   Compress operation\n+ * @param size\n+ *   Size of space requested in private data\n+ * @return\n+ * - if sufficient space available returns pointer to start of user data\n+ * - if insufficient space returns NULL\n+ */\n+static inline void *\n+__rte_comp_op_get_user_data(struct rte_comp_op *op, uint32_t size)\n+{\n+\tuint32_t user_size;\n+\n+\tif (likely(op->mempool != NULL)) {\n+\t\tuser_size = __rte_comp_op_get_user_data_size(op->mempool);\n+\n+\t\tif (likely(user_size >= size))\n+\t\t\treturn (void *)(op + 1);\n+\n+\t}\n+\n+\treturn NULL;\n+}\n+\n+/**\n+ * free operation structure\n+ * If operation has been allocate from a rte_mempool, then the operation will\n+ * be returned to the mempool.\n+ *\n+ * @param op\n+ *   Compress operation\n+ */\n+static inline void\n+rte_comp_op_free(struct rte_comp_op *op)\n+{\n+\tif (op != NULL && op->mempool != NULL)\n+\t\trte_mempool_put(op->mempool, op);\n+}\n+\n #ifdef __cplusplus\n }\n #endif\ndiff --git a/lib/librte_compressdev/rte_compressdev.c b/lib/librte_compressdev/rte_compressdev.c\nindex c90e4beaf..0dab92650 100644\n--- a/lib/librte_compressdev/rte_compressdev.c\n+++ b/lib/librte_compressdev/rte_compressdev.c\n@@ -530,6 +530,78 @@ rte_compressdev_info_get(uint8_t dev_id, struct rte_compressdev_info *dev_info)\n \tdev_info->driver_name = dev->device->driver->name;\n }\n \n+/** Initialise rte_comp_op mempool element */\n+static void\n+rte_comp_op_init(struct rte_mempool *mempool,\n+\t\t__rte_unused void *opaque_arg,\n+\t\tvoid *_op_data,\n+\t\t__rte_unused unsigned int i)\n+{\n+\tstruct rte_comp_op *op = _op_data;\n+\n+\tmemset(_op_data, 0, mempool->elt_size);\n+\n+\top->status = RTE_COMP_OP_STATUS_NOT_PROCESSED;\n+\top->iova_addr = rte_mem_virt2iova(_op_data);\n+\top->mempool = mempool;\n+}\n+\n+\n+struct rte_mempool * __rte_experimental\n+rte_comp_op_pool_create(const char *name,\n+\t\tunsigned int nb_elts, unsigned int cache_size,\n+\t\tuint16_t user_size, int socket_id)\n+{\n+\tstruct rte_comp_op_pool_private *priv;\n+\n+\tunsigned int elt_size = sizeof(struct rte_comp_op) + user_size;\n+\n+\t/* lookup mempool in case already allocated */\n+\tstruct rte_mempool *mp = rte_mempool_lookup(name);\n+\n+\tif (mp != NULL) {\n+\t\tpriv = (struct rte_comp_op_pool_private *)\n+\t\t\t\trte_mempool_get_priv(mp);\n+\n+\t\tif (mp->elt_size != elt_size ||\n+\t\t\t\tmp->cache_size < cache_size ||\n+\t\t\t\tmp->size < nb_elts ||\n+\t\t\t\tpriv->user_size <  user_size) {\n+\t\t\tmp = NULL;\n+\t\t\tCOMPRESSDEV_LOG(ERR,\n+\t\t\"Mempool %s already exists but with incompatible parameters\",\n+\t\t\t\t\tname);\n+\t\t\treturn NULL;\n+\t\t}\n+\t\treturn mp;\n+\t}\n+\n+\tmp = rte_mempool_create(\n+\t\t\tname,\n+\t\t\tnb_elts,\n+\t\t\telt_size,\n+\t\t\tcache_size,\n+\t\t\tsizeof(struct rte_comp_op_pool_private),\n+\t\t\tNULL,\n+\t\t\tNULL,\n+\t\t\trte_comp_op_init,\n+\t\t\tNULL,\n+\t\t\tsocket_id,\n+\t\t\t0);\n+\n+\tif (mp == NULL) {\n+\t\tCOMPRESSDEV_LOG(ERR, \"Failed to create mempool %s\", name);\n+\t\treturn NULL;\n+\t}\n+\n+\tpriv = (struct rte_comp_op_pool_private *)\n+\t\t\trte_mempool_get_priv(mp);\n+\n+\tpriv->user_size = user_size;\n+\n+\treturn mp;\n+}\n+\n TAILQ_HEAD(compressdev_driver_list, compressdev_driver);\n \n static struct compressdev_driver_list compressdev_driver_list =\ndiff --git a/lib/librte_compressdev/rte_compressdev_version.map b/lib/librte_compressdev/rte_compressdev_version.map\nindex 78ac8d904..6a3596429 100644\n--- a/lib/librte_compressdev/rte_compressdev_version.map\n+++ b/lib/librte_compressdev/rte_compressdev_version.map\n@@ -28,6 +28,7 @@ EXPERIMENTAL {\n \trte_compressdev_socket_id;\n \trte_compressdev_start;\n \trte_compressdev_stop;\n+\trte_comp_op_pool_create;\n \n         local: *;\n };\n",
    "prefixes": [
        "dpdk-dev",
        "v4",
        "05/13"
    ]
}