get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 8373,
    "url": "http://patches.dpdk.org/api/patches/8373/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/1446209986-29137-3-git-send-email-declan.doherty@intel.com/",
    "project": {
        "id": 1,
        "url": "http://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": "<1446209986-29137-3-git-send-email-declan.doherty@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1446209986-29137-3-git-send-email-declan.doherty@intel.com",
    "date": "2015-10-30T12:59:42",
    "name": "[dpdk-dev,v2,2/6] mbuf_offload: library to support attaching offloads to a mbuf",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "db8ce0341606984c436d28afb2bd4678a3886136",
    "submitter": {
        "id": 11,
        "url": "http://patches.dpdk.org/api/people/11/?format=api",
        "name": "Doherty, Declan",
        "email": "declan.doherty@intel.com"
    },
    "delegate": null,
    "mbox": "http://patches.dpdk.org/project/dpdk/patch/1446209986-29137-3-git-send-email-declan.doherty@intel.com/mbox/",
    "series": [],
    "comments": "http://patches.dpdk.org/api/patches/8373/comments/",
    "check": "pending",
    "checks": "http://patches.dpdk.org/api/patches/8373/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 [IPv6:::1])\n\tby dpdk.org (Postfix) with ESMTP id 393248E7B;\n\tFri, 30 Oct 2015 13:55:18 +0100 (CET)",
            "from mga14.intel.com (mga14.intel.com [192.55.52.115])\n\tby dpdk.org (Postfix) with ESMTP id C11C28E71\n\tfor <dev@dpdk.org>; Fri, 30 Oct 2015 13:55:13 +0100 (CET)",
            "from fmsmga003.fm.intel.com ([10.253.24.29])\n\tby fmsmga103.fm.intel.com with ESMTP; 30 Oct 2015 05:55:13 -0700",
            "from dwdohert-dpdk-fedora-20.ir.intel.com ([163.33.213.96])\n\tby FMSMGA003.fm.intel.com with ESMTP; 30 Oct 2015 05:55:12 -0700"
        ],
        "X-ExtLoop1": "1",
        "X-IronPort-AV": "E=Sophos;i=\"5.20,218,1444719600\"; d=\"scan'208\";a=\"590996761\"",
        "From": "Declan Doherty <declan.doherty@intel.com>",
        "To": "dev@dpdk.org",
        "Date": "Fri, 30 Oct 2015 12:59:42 +0000",
        "Message-Id": "<1446209986-29137-3-git-send-email-declan.doherty@intel.com>",
        "X-Mailer": "git-send-email 2.4.3",
        "In-Reply-To": "<1446209986-29137-1-git-send-email-declan.doherty@intel.com>",
        "References": "<1443826867-21004-1-git-send-email-declan.doherty@intel.com>\n\t<1446209986-29137-1-git-send-email-declan.doherty@intel.com>",
        "Subject": "[dpdk-dev] [PATCH v2 2/6] mbuf_offload: library to support\n\tattaching offloads to a mbuf",
        "X-BeenThere": "dev@dpdk.org",
        "X-Mailman-Version": "2.1.15",
        "Precedence": "list",
        "List-Id": "patches and discussions about DPDK <dev.dpdk.org>",
        "List-Unsubscribe": "<http://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": "<http://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": "This library add support for adding a chain of offload operations to a\nmbuf. It contains the definition of the rte_mbuf_offload structure as\nwell as helper funtions for attaching  offloads to mbufs and a mempool\nmanagement functions.\n\nThis initial implementation supports attaching multiple offload\noperations to a single mbuf, but only a single offload operation of a\nspecific type can be attach to that mbuf.\n\nSigned-off-by: Declan Doherty <declan.doherty@intel.com>\n---\n config/common_bsdapp                               |   6 +\n config/common_linuxapp                             |   6 +\n lib/Makefile                                       |   1 +\n lib/librte_mbuf/rte_mbuf.h                         |   6 +\n lib/librte_mbuf_offload/Makefile                   |  52 ++++\n lib/librte_mbuf_offload/rte_mbuf_offload.c         | 100 +++++++\n lib/librte_mbuf_offload/rte_mbuf_offload.h         | 289 +++++++++++++++++++++\n .../rte_mbuf_offload_version.map                   |   7 +\n mk/rte.app.mk                                      |   1 +\n 9 files changed, 468 insertions(+)\n create mode 100644 lib/librte_mbuf_offload/Makefile\n create mode 100644 lib/librte_mbuf_offload/rte_mbuf_offload.c\n create mode 100644 lib/librte_mbuf_offload/rte_mbuf_offload.h\n create mode 100644 lib/librte_mbuf_offload/rte_mbuf_offload_version.map",
    "diff": "diff --git a/config/common_bsdapp b/config/common_bsdapp\nindex 8ce6af5..96d9d26 100644\n--- a/config/common_bsdapp\n+++ b/config/common_bsdapp\n@@ -320,6 +320,12 @@ CONFIG_RTE_MBUF_REFCNT_ATOMIC=y\n CONFIG_RTE_PKTMBUF_HEADROOM=128\n \n #\n+# Compile librte_mbuf_offload\n+#\n+CONFIG_RTE_LIBRTE_MBUF_OFFLOAD=y\n+CONFIG_RTE_LIBRTE_MBUF_OFFLOAD_DEBUG=n\n+\n+#\n # Compile librte_timer\n #\n CONFIG_RTE_LIBRTE_TIMER=y\ndiff --git a/config/common_linuxapp b/config/common_linuxapp\nindex e7b9b25..c113c88 100644\n--- a/config/common_linuxapp\n+++ b/config/common_linuxapp\n@@ -328,6 +328,12 @@ CONFIG_RTE_MBUF_REFCNT_ATOMIC=y\n CONFIG_RTE_PKTMBUF_HEADROOM=128\n \n #\n+# Compile librte_mbuf_offload\n+#\n+CONFIG_RTE_LIBRTE_MBUF_OFFLOAD=y\n+CONFIG_RTE_LIBRTE_MBUF_OFFLOAD_DEBUG=n\n+\n+#\n # Compile librte_timer\n #\n CONFIG_RTE_LIBRTE_TIMER=y\ndiff --git a/lib/Makefile b/lib/Makefile\nindex 4c5c1b4..ef172ea 100644\n--- a/lib/Makefile\n+++ b/lib/Makefile\n@@ -36,6 +36,7 @@ DIRS-$(CONFIG_RTE_LIBRTE_EAL) += librte_eal\n DIRS-$(CONFIG_RTE_LIBRTE_RING) += librte_ring\n DIRS-$(CONFIG_RTE_LIBRTE_MEMPOOL) += librte_mempool\n DIRS-$(CONFIG_RTE_LIBRTE_MBUF) += librte_mbuf\n+DIRS-$(CONFIG_RTE_LIBRTE_MBUF_OFFLOAD) += librte_mbuf_offload\n DIRS-$(CONFIG_RTE_LIBRTE_TIMER) += librte_timer\n DIRS-$(CONFIG_RTE_LIBRTE_CFGFILE) += librte_cfgfile\n DIRS-$(CONFIG_RTE_LIBRTE_CMDLINE) += librte_cmdline\ndiff --git a/lib/librte_mbuf/rte_mbuf.h b/lib/librte_mbuf/rte_mbuf.h\nindex 710086a..aa578e3 100644\n--- a/lib/librte_mbuf/rte_mbuf.h\n+++ b/lib/librte_mbuf/rte_mbuf.h\n@@ -729,6 +729,9 @@ typedef uint8_t  MARKER8[0];  /**< generic marker with 1B alignment */\n typedef uint64_t MARKER64[0]; /**< marker that allows us to overwrite 8 bytes\n                                * with a single assignment */\n \n+/** Opaque rte_mbuf_offload  structure declarations */\n+struct rte_mbuf_offload;\n+\n /**\n  * The generic rte_mbuf, containing a packet mbuf.\n  */\n@@ -842,6 +845,9 @@ struct rte_mbuf {\n \n \t/** Timesync flags for use with IEEE1588. */\n \tuint16_t timesync;\n+\n+\t/* Chain of off-load operations to perform on mbuf */\n+\tstruct rte_mbuf_offload *offload_ops;\n } __rte_cache_aligned;\n \n static inline uint16_t rte_pktmbuf_priv_size(struct rte_mempool *mp);\ndiff --git a/lib/librte_mbuf_offload/Makefile b/lib/librte_mbuf_offload/Makefile\nnew file mode 100644\nindex 0000000..acdb449\n--- /dev/null\n+++ b/lib/librte_mbuf_offload/Makefile\n@@ -0,0 +1,52 @@\n+#   BSD LICENSE\n+#\n+#   Copyright(c) 2015 Intel Corporation. All rights reserved.\n+#\n+#   Redistribution and use in source and binary forms, with or without\n+#   modification, are permitted provided that the following conditions\n+#   are met:\n+#\n+#     * Redistributions of source code must retain the above copyright\n+#       notice, this list of conditions and the following disclaimer.\n+#     * Redistributions in binary form must reproduce the above copyright\n+#       notice, this list of conditions and the following disclaimer in\n+#       the documentation and/or other materials provided with the\n+#       distribution.\n+#     * Neither the name of Intel Corporation nor the names of its\n+#       contributors may be used to endorse or promote products derived\n+#       from this software without specific prior written permission.\n+#\n+#   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n+#   \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n+#   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n+#   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n+#   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n+#   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n+#   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n+#   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n+#   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n+#   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n+#   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n+\n+include $(RTE_SDK)/mk/rte.vars.mk\n+\n+# library name\n+LIB = librte_mbuf_offload.a\n+\n+CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR) -O3\n+\n+EXPORT_MAP := rte_mbuf_offload_version.map\n+\n+LIBABIVER := 1\n+\n+# all source are stored in SRCS-y\n+SRCS-$(CONFIG_RTE_LIBRTE_MBUF_OFFLOAD) := rte_mbuf_offload.c\n+\n+# install includes\n+SYMLINK-$(CONFIG_RTE_LIBRTE_MBUF_OFFLOAD)-include := rte_mbuf_offload.h\n+\n+# this lib needs eal\n+DEPDIRS-$(CONFIG_RTE_LIBRTE_MBUF_OFFLOAD) += lib/librte_mbuf\n+DEPDIRS-$(CONFIG_RTE_LIBRTE_MBUF_OFFLOAD) += lib/librte_cryptodev\n+\n+include $(RTE_SDK)/mk/rte.lib.mk\ndiff --git a/lib/librte_mbuf_offload/rte_mbuf_offload.c b/lib/librte_mbuf_offload/rte_mbuf_offload.c\nnew file mode 100644\nindex 0000000..5c0c9dd\n--- /dev/null\n+++ b/lib/librte_mbuf_offload/rte_mbuf_offload.c\n@@ -0,0 +1,100 @@\n+/*-\n+ *   BSD LICENSE\n+ *\n+ *   Copyright(c) 2015 Intel Corporation. All rights reserved.\n+ *\n+ *   Redistribution and use in source and binary forms, with or without\n+ *   modification, are permitted provided that the following conditions\n+ *   are met:\n+ *\n+ *     * Redistributions of source code must retain the above copyright\n+ *       notice, this list of conditions and the following disclaimer.\n+ *     * Redistributions in binary form must reproduce the above copyright\n+ *       notice, this list of conditions and the following disclaimer in\n+ *       the documentation and/or other materials provided with the\n+ *       distribution.\n+ *     * Neither the name of Intel Corporation nor the names of its\n+ *       contributors may be used to endorse or promote products derived\n+ *       from this software without specific prior written permission.\n+ *\n+ *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n+ *   \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n+ *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n+ *   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n+ *   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n+ *   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n+ *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n+ *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n+ *   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n+ *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n+ *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n+ */\n+\n+#include <string.h>\n+#include <rte_common.h>\n+\n+#include \"rte_mbuf_offload.h\"\n+\n+/** Initialize rte_mbuf_offload structure */\n+static void\n+rte_pktmbuf_offload_init(struct rte_mempool *mp,\n+\t\t__rte_unused void *opaque_arg,\n+\t\tvoid *_op_data,\n+\t\t__rte_unused unsigned i)\n+{\n+\tstruct rte_mbuf_offload *ol = _op_data;\n+\n+\tmemset(_op_data, 0, mp->elt_size);\n+\n+\tol->type = RTE_PKTMBUF_OL_NOT_SPECIFIED;\n+\tol->mp = mp;\n+}\n+\n+\n+struct rte_mempool *\n+rte_pktmbuf_offload_pool_create(const char *name, unsigned size,\n+\t\tunsigned cache_size, uint16_t priv_size, int socket_id)\n+{\n+\tstruct rte_pktmbuf_offload_pool_private *priv;\n+\tunsigned elt_size = sizeof(struct rte_mbuf_offload) + priv_size;\n+\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_pktmbuf_offload_pool_private *)\n+\t\t\t\trte_mempool_get_priv(mp);\n+\n+\t\tif (priv->offload_priv_size <  priv_size ||\n+\t\t\t\tmp->elt_size != elt_size ||\n+\t\t\t\tmp->cache_size < cache_size ||\n+\t\t\t\tmp->size < size) {\n+\t\t\tmp = NULL;\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\tsize,\n+\t\t\telt_size,\n+\t\t\tcache_size,\n+\t\t\tsizeof(struct rte_pktmbuf_offload_pool_private),\n+\t\t\tNULL,\n+\t\t\tNULL,\n+\t\t\trte_pktmbuf_offload_init,\n+\t\t\tNULL,\n+\t\t\tsocket_id,\n+\t\t\t0);\n+\n+\tif (mp == NULL)\n+\t\treturn NULL;\n+\n+\tpriv = (struct rte_pktmbuf_offload_pool_private *)\n+\t\t\trte_mempool_get_priv(mp);\n+\n+\tpriv->offload_priv_size = priv_size;\n+\treturn mp;\n+}\ndiff --git a/lib/librte_mbuf_offload/rte_mbuf_offload.h b/lib/librte_mbuf_offload/rte_mbuf_offload.h\nnew file mode 100644\nindex 0000000..0a59667\n--- /dev/null\n+++ b/lib/librte_mbuf_offload/rte_mbuf_offload.h\n@@ -0,0 +1,289 @@\n+/*-\n+ *   BSD LICENSE\n+ *\n+ *   Copyright(c) 2010-2014 Intel Corporation. All rights reserved.\n+ *   Copyright 2014 6WIND S.A.\n+ *   All rights reserved.\n+ *\n+ *   Redistribution and use in source and binary forms, with or without\n+ *   modification, are permitted provided that the following conditions\n+ *   are met:\n+ *\n+ *     * Redistributions of source code must retain the above copyright\n+ *       notice, this list of conditions and the following disclaimer.\n+ *     * Redistributions in binary form must reproduce the above copyright\n+ *       notice, this list of conditions and the following disclaimer in\n+ *       the documentation and/or other materials provided with the\n+ *       distribution.\n+ *     * Neither the name of Intel Corporation nor the names of its\n+ *       contributors may be used to endorse or promote products derived\n+ *       from this software without specific prior written permission.\n+ *\n+ *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n+ *   \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n+ *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n+ *   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n+ *   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n+ *   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n+ *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n+ *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n+ *   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n+ *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n+ *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n+ */\n+\n+#ifndef _RTE_MBUF_OFFLOAD_H_\n+#define _RTE_MBUF_OFFLOAD_H_\n+\n+#include <rte_mbuf.h>\n+#include <rte_crypto.h>\n+\n+\n+/** packet mbuf offload operation types */\n+enum rte_mbuf_ol_op_type {\n+\tRTE_PKTMBUF_OL_NOT_SPECIFIED = 0,\n+\t/**< Off-load not specified */\n+\tRTE_PKTMBUF_OL_CRYPTO\n+\t/**< Crypto offload operation */\n+};\n+\n+/**\n+ * Generic packet mbuf offload\n+ * This is used to specify a offload operation to be performed on a rte_mbuf.\n+ * Multiple offload operations can be chained to the same mbuf, but only a\n+ * single offload operation of a particular type can be in the chain */\n+struct rte_mbuf_offload {\n+\tstruct rte_mbuf_offload *next;\t/**< next offload in chain */\n+\tstruct rte_mbuf *m;\t\t/**< mbuf offload is attached to */\n+\tstruct rte_mempool *mp;\t\t/**< mempool offload allocated from */\n+\n+\tenum rte_mbuf_ol_op_type type;\t/**< offload type */\n+\tunion {\n+\t\tstruct rte_crypto_op crypto;\t/**< Crypto operation */\n+\t} op;\n+};\n+\n+/**< private data structure belonging to packet mbug offload mempool */\n+struct rte_pktmbuf_offload_pool_private {\n+\tuint16_t offload_priv_size;\n+\t/**< Size of private area in each mbuf_offload. */\n+};\n+\n+\n+/**\n+ * Creates a mempool of rte_mbuf_offload objects\n+ *\n+ * @param\tname\t\tmempool name\n+ * @param\tsize\t\tnumber of objects in mempool\n+ * @param\tcache_size\tcache size of objects for each core\n+ * @param\tpriv_size\tsize of private data to be allocated with each\n+ *\t\t\t\trte_mbuf_offload object\n+ * @param\tsocket_id\tSocket on which to allocate mempool objects\n+ *\n+ * @return\n+ * - On success returns a valid mempool of rte_mbuf_offload objects\n+ * - On failure return NULL\n+ */\n+extern struct rte_mempool *\n+rte_pktmbuf_offload_pool_create(const char *name, unsigned size,\n+\t\tunsigned cache_size, uint16_t priv_size, int socket_id);\n+\n+\n+/**\n+ * Returns private data size allocated with each rte_mbuf_offload object by\n+ * the mempool\n+ *\n+ * @param\tmpool\trte_mbuf_offload mempool\n+ *\n+ * @return\tprivate data size\n+ */\n+static inline uint16_t\n+__rte_pktmbuf_offload_priv_size(struct rte_mempool *mpool)\n+{\n+\tstruct rte_pktmbuf_offload_pool_private *priv =\n+\t\t\trte_mempool_get_priv(mpool);\n+\n+\treturn priv->offload_priv_size;\n+}\n+\n+/**\n+ * Get specified off-load operation type from mbuf.\n+ *\n+ * @param\tm\t\tpacket mbuf.\n+ * @param\ttype\t\toffload operation type requested.\n+ *\n+ * @return\n+ * - On success retruns rte_mbuf_offload pointer\n+ * - On failure returns NULL\n+ *\n+ */\n+static inline struct rte_mbuf_offload *\n+rte_pktmbuf_offload_get(struct rte_mbuf *m, enum rte_mbuf_ol_op_type type)\n+{\n+\tstruct rte_mbuf_offload *ol = m->offload_ops;\n+\n+\tif (m->offload_ops != NULL && m->offload_ops->type == type)\n+\t\treturn ol;\n+\n+\tol = m->offload_ops;\n+\twhile (ol != NULL) {\n+\t\tif (ol->type == type)\n+\t\t\treturn ol;\n+\n+\t\tol = ol->next;\n+\t}\n+\n+\treturn ol;\n+}\n+\n+/**\n+ * Attach a rte_mbuf_offload to a mbuf. We only support a single offload of any\n+ * one type in our chain of offloads.\n+ *\n+ * @param\tm\tpacket mbuf.\n+ * @param\tol\trte_mbuf_offload strucutre to be attached\n+ *\n+ * @returns\n+ * - On success returns the pointer to the offload we just added\n+ * - On failure returns NULL\n+ */\n+static inline struct rte_mbuf_offload *\n+rte_pktmbuf_offload_attach(struct rte_mbuf *m, struct rte_mbuf_offload *ol)\n+{\n+\tstruct rte_mbuf_offload **ol_last;\n+\n+\tfor (ol_last = &m->offload_ops;\tol_last[0] != NULL;\n+\t\t\tol_last = &ol_last[0]->next)\n+\t\tif (ol_last[0]->type == ol->type)\n+\t\t\treturn NULL;\n+\n+\tol_last[0] = ol;\n+\tol_last[0]->m = m;\n+\tol_last[0]->next = NULL;\n+\n+\treturn ol_last[0];\n+}\n+\n+\n+/** Rearms rte_mbuf_offload default parameters */\n+static inline void\n+__rte_pktmbuf_offload_reset(struct rte_mbuf_offload *ol,\n+\t\tenum rte_mbuf_ol_op_type type)\n+{\n+\tol->m = NULL;\n+\tol->type = type;\n+\n+\tswitch (type) {\n+\tcase RTE_PKTMBUF_OL_CRYPTO:\n+\t\t__rte_crypto_op_reset(&ol->op.crypto); break;\n+\tdefault:\n+\t\tbreak;\n+\t}\n+}\n+\n+/** Allocate rte_mbuf_offload from mempool */\n+static inline struct rte_mbuf_offload *\n+__rte_pktmbuf_offload_raw_alloc(struct rte_mempool *mp)\n+{\n+\tvoid *buf = NULL;\n+\n+\tif (rte_mempool_get(mp, &buf) < 0)\n+\t\treturn NULL;\n+\n+\treturn (struct rte_mbuf_offload *)buf;\n+}\n+\n+/**\n+ * Allocate a rte_mbuf_offload with a specified operation type from\n+ * rte_mbuf_offload mempool\n+ *\n+ * @param\tmpool\t\trte_mbuf_offload mempool\n+ * @param\ttype\t\toffload operation type\n+ *\n+ * @returns\n+ * - On success returns a valid rte_mbuf_offload structure\n+ * - On failure returns NULL\n+ */\n+static inline struct rte_mbuf_offload *\n+rte_pktmbuf_offload_alloc(struct rte_mempool *mpool,\n+\t\tenum rte_mbuf_ol_op_type type)\n+{\n+\tstruct rte_mbuf_offload *ol = __rte_pktmbuf_offload_raw_alloc(mpool);\n+\n+\tif (ol != NULL)\n+\t\t__rte_pktmbuf_offload_reset(ol, type);\n+\n+\treturn ol;\n+}\n+\n+/**\n+ * free rte_mbuf_offload structure\n+ */\n+static inline void\n+rte_pktmbuf_offload_free(struct rte_mbuf_offload *ol)\n+{\n+\tif (ol->mp != NULL)\n+\t\trte_mempool_put(ol->mp, ol);\n+}\n+\n+/**\n+ * Checks if the private data of a rte_mbuf_offload has enough capacity for\n+ * requested size\n+ *\n+ * @returns\n+ * - if sufficient space available returns pointer to start of private data\n+ * - if insufficient space returns NULL\n+ */\n+static inline void *\n+__rte_pktmbuf_offload_check_priv_data_size(struct rte_mbuf_offload *ol,\n+\t\tuint16_t size)\n+{\n+\tuint16_t priv_size;\n+\n+\tif (likely(ol->mp != NULL)) {\n+\t\tpriv_size = __rte_pktmbuf_offload_priv_size(ol->mp);\n+\n+\t\tif (likely(priv_size >= size))\n+\t\t\treturn (void *)(ol + 1);\n+\t}\n+\treturn NULL;\n+}\n+\n+/**\n+ * Allocate space for crypto xforms in the private data space of the\n+ * rte_mbuf_offload. This also defaults the crypto xform type and configures\n+ * the chaining of the xform in the crypto operation\n+ *\n+ * @return\n+ * - On success returns pointer to first crypto xform in crypto operations chain\n+ * - On failure returns NULL */\n+static inline struct rte_crypto_xform *\n+rte_pktmbuf_offload_alloc_crypto_xforms(struct rte_mbuf_offload *ol,\n+\t\tunsigned nb_xforms)\n+{\n+\tstruct rte_crypto_xform *xform;\n+\tvoid *priv_data;\n+\tuint16_t size;\n+\n+\tsize = sizeof(struct rte_crypto_xform) * nb_xforms;\n+\tpriv_data = __rte_pktmbuf_offload_check_priv_data_size(ol, size);\n+\n+\tif (priv_data == NULL)\n+\t\treturn NULL;\n+\n+\tol->op.crypto.xform = xform = (struct rte_crypto_xform *)priv_data;\n+\n+\tdo {\n+\t\txform->type = RTE_CRYPTO_XFORM_NOT_SPECIFIED;\n+\t\txform = xform->next = --nb_xforms > 0 ? xform + 1 : NULL;\n+\t} while (xform);\n+\n+\treturn ol->op.crypto.xform;\n+}\n+\n+\n+#ifdef __cplusplus\n+}\n+#endif\n+\n+#endif /* _RTE_MBUF_OFFLOAD_H_ */\ndiff --git a/lib/librte_mbuf_offload/rte_mbuf_offload_version.map b/lib/librte_mbuf_offload/rte_mbuf_offload_version.map\nnew file mode 100644\nindex 0000000..3d3b06a\n--- /dev/null\n+++ b/lib/librte_mbuf_offload/rte_mbuf_offload_version.map\n@@ -0,0 +1,7 @@\n+DPDK_2.2 {\n+\tglobal:\n+\n+\trte_pktmbuf_offload_pool_create;\n+\n+\tlocal: *;\n+};\ndiff --git a/mk/rte.app.mk b/mk/rte.app.mk\nindex 80f68bb..9b4aed3 100644\n--- a/mk/rte.app.mk\n+++ b/mk/rte.app.mk\n@@ -112,6 +112,7 @@ ifeq ($(CONFIG_RTE_BUILD_COMBINE_LIBS),n)\n \n _LDLIBS-$(CONFIG_RTE_LIBRTE_KVARGS)         += -lrte_kvargs\n _LDLIBS-$(CONFIG_RTE_LIBRTE_MBUF)           += -lrte_mbuf\n+_LDLIBS-$(CONFIG_RTE_LIBRTE_MBUF_OFFLOAD)   += -lrte_mbuf_offload\n _LDLIBS-$(CONFIG_RTE_LIBRTE_IP_FRAG)        += -lrte_ip_frag\n _LDLIBS-$(CONFIG_RTE_LIBRTE_ETHER)          += -lethdev\n _LDLIBS-$(CONFIG_RTE_LIBRTE_CRYPTODEV)      += -lrte_cryptodev\n",
    "prefixes": [
        "dpdk-dev",
        "v2",
        "2/6"
    ]
}