get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 2248,
    "url": "https://patches.dpdk.org/api/patches/2248/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/1421080446-19249-7-git-send-email-sergio.gonzalez.monroy@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": "<1421080446-19249-7-git-send-email-sergio.gonzalez.monroy@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1421080446-19249-7-git-send-email-sergio.gonzalez.monroy@intel.com",
    "date": "2015-01-12T16:33:59",
    "name": "[dpdk-dev,RFC,06/13] core: move librte_mbuf to core subdir",
    "commit_ref": null,
    "pull_url": null,
    "state": "rfc",
    "archived": true,
    "hash": "e98e8259640da7cc7fcb4830d4265a1d00e145d6",
    "submitter": {
        "id": 73,
        "url": "https://patches.dpdk.org/api/people/73/?format=api",
        "name": "Sergio Gonzalez Monroy",
        "email": "sergio.gonzalez.monroy@intel.com"
    },
    "delegate": null,
    "mbox": "https://patches.dpdk.org/project/dpdk/patch/1421080446-19249-7-git-send-email-sergio.gonzalez.monroy@intel.com/mbox/",
    "series": [],
    "comments": "https://patches.dpdk.org/api/patches/2248/comments/",
    "check": "pending",
    "checks": "https://patches.dpdk.org/api/patches/2248/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 1AE7D5B00;\n\tMon, 12 Jan 2015 17:35:11 +0100 (CET)",
            "from mga09.intel.com (mga09.intel.com [134.134.136.24])\n\tby dpdk.org (Postfix) with ESMTP id 83CD35AC1\n\tfor <dev@dpdk.org>; Mon, 12 Jan 2015 17:34:16 +0100 (CET)",
            "from fmsmga003.fm.intel.com ([10.253.24.29])\n\tby orsmga102.jf.intel.com with ESMTP; 12 Jan 2015 08:31:32 -0800",
            "from irvmail001.ir.intel.com ([163.33.26.43])\n\tby FMSMGA003.fm.intel.com with ESMTP; 12 Jan 2015 08:21:22 -0800",
            "from sivswdev02.ir.intel.com (sivswdev02.ir.intel.com\n\t[10.237.217.46])\n\tby irvmail001.ir.intel.com (8.14.3/8.13.6/MailSET/Hub) with ESMTP id\n\tt0CGY7Cg022024 for <dev@dpdk.org>; Mon, 12 Jan 2015 16:34:07 GMT",
            "from sivswdev02.ir.intel.com (localhost [127.0.0.1])\n\tby sivswdev02.ir.intel.com with ESMTP id t0CGY7jq019330\n\tfor <dev@dpdk.org>; Mon, 12 Jan 2015 16:34:07 GMT",
            "(from smonroy@localhost)\n\tby sivswdev02.ir.intel.com with  id t0CGY7ks019326\n\tfor dev@dpdk.org; Mon, 12 Jan 2015 16:34:07 GMT"
        ],
        "X-ExtLoop1": "1",
        "X-IronPort-AV": "E=Sophos;i=\"4.97,862,1389772800\"; d=\"scan'208\";a=\"439523179\"",
        "From": "Sergio Gonzalez Monroy <sergio.gonzalez.monroy@intel.com>",
        "To": "dev@dpdk.org",
        "Date": "Mon, 12 Jan 2015 16:33:59 +0000",
        "Message-Id": "<1421080446-19249-7-git-send-email-sergio.gonzalez.monroy@intel.com>",
        "X-Mailer": "git-send-email 1.8.5.4",
        "In-Reply-To": "<1421080446-19249-1-git-send-email-sergio.gonzalez.monroy@intel.com>",
        "References": "<1421080446-19249-1-git-send-email-sergio.gonzalez.monroy@intel.com>",
        "Subject": "[dpdk-dev] [PATCH RFC 06/13] core: move librte_mbuf to core subdir",
        "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 is equivalent to:\n\ngit mv lib/librte_mbuf lib/core\n\nSigned-off-by: Sergio Gonzalez Monroy <sergio.gonzalez.monroy@intel.com>\n---\n lib/core/librte_mbuf/Makefile   |   48 ++\n lib/core/librte_mbuf/rte_mbuf.c |  252 +++++++++\n lib/core/librte_mbuf/rte_mbuf.h | 1133 +++++++++++++++++++++++++++++++++++++++\n lib/librte_mbuf/Makefile        |   48 --\n lib/librte_mbuf/rte_mbuf.c      |  252 ---------\n lib/librte_mbuf/rte_mbuf.h      | 1133 ---------------------------------------\n 6 files changed, 1433 insertions(+), 1433 deletions(-)\n create mode 100644 lib/core/librte_mbuf/Makefile\n create mode 100644 lib/core/librte_mbuf/rte_mbuf.c\n create mode 100644 lib/core/librte_mbuf/rte_mbuf.h\n delete mode 100644 lib/librte_mbuf/Makefile\n delete mode 100644 lib/librte_mbuf/rte_mbuf.c\n delete mode 100644 lib/librte_mbuf/rte_mbuf.h",
    "diff": "diff --git a/lib/core/librte_mbuf/Makefile b/lib/core/librte_mbuf/Makefile\nnew file mode 100644\nindex 0000000..9b45ba4\n--- /dev/null\n+++ b/lib/core/librte_mbuf/Makefile\n@@ -0,0 +1,48 @@\n+#   BSD LICENSE\n+#\n+#   Copyright(c) 2010-2014 Intel Corporation. All rights reserved.\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+include $(RTE_SDK)/mk/rte.vars.mk\n+\n+# library name\n+LIB = librte_mbuf.a\n+\n+CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR) -O3\n+\n+# all source are stored in SRCS-y\n+SRCS-$(CONFIG_RTE_LIBRTE_MBUF) := rte_mbuf.c\n+\n+# install includes\n+SYMLINK-$(CONFIG_RTE_LIBRTE_MBUF)-include := rte_mbuf.h\n+\n+# this lib needs eal\n+DEPDIRS-$(CONFIG_RTE_LIBRTE_MBUF) += lib/librte_eal lib/librte_mempool\n+\n+include $(RTE_SDK)/mk/rte.lib.mk\ndiff --git a/lib/core/librte_mbuf/rte_mbuf.c b/lib/core/librte_mbuf/rte_mbuf.c\nnew file mode 100644\nindex 0000000..1b14e02\n--- /dev/null\n+++ b/lib/core/librte_mbuf/rte_mbuf.c\n@@ -0,0 +1,252 @@\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+#include <string.h>\n+#include <stdio.h>\n+#include <stdlib.h>\n+#include <stdint.h>\n+#include <stdarg.h>\n+#include <inttypes.h>\n+#include <errno.h>\n+#include <ctype.h>\n+#include <sys/queue.h>\n+\n+#include <rte_debug.h>\n+#include <rte_common.h>\n+#include <rte_log.h>\n+#include <rte_memory.h>\n+#include <rte_memzone.h>\n+#include <rte_launch.h>\n+#include <rte_tailq.h>\n+#include <rte_eal.h>\n+#include <rte_per_lcore.h>\n+#include <rte_lcore.h>\n+#include <rte_atomic.h>\n+#include <rte_branch_prediction.h>\n+#include <rte_ring.h>\n+#include <rte_mempool.h>\n+#include <rte_mbuf.h>\n+#include <rte_string_fns.h>\n+#include <rte_hexdump.h>\n+\n+/*\n+ * ctrlmbuf constructor, given as a callback function to\n+ * rte_mempool_create()\n+ */\n+void\n+rte_ctrlmbuf_init(struct rte_mempool *mp,\n+\t\t__attribute__((unused)) void *opaque_arg,\n+\t\tvoid *_m,\n+\t\t__attribute__((unused)) unsigned i)\n+{\n+\tstruct rte_mbuf *m = _m;\n+\trte_pktmbuf_init(mp, opaque_arg, _m, i);\n+\tm->ol_flags |= CTRL_MBUF_FLAG;\n+}\n+\n+/*\n+ * pktmbuf pool constructor, given as a callback function to\n+ * rte_mempool_create()\n+ */\n+void\n+rte_pktmbuf_pool_init(struct rte_mempool *mp, void *opaque_arg)\n+{\n+\tstruct rte_pktmbuf_pool_private *mbp_priv;\n+\tuint16_t roomsz;\n+\n+\tmbp_priv = rte_mempool_get_priv(mp);\n+\troomsz = (uint16_t)(uintptr_t)opaque_arg;\n+\n+\t/* Use default data room size. */\n+\tif (0 == roomsz)\n+\t\troomsz = 2048 + RTE_PKTMBUF_HEADROOM;\n+\n+\tmbp_priv->mbuf_data_room_size = roomsz;\n+}\n+\n+/*\n+ * pktmbuf constructor, given as a callback function to\n+ * rte_mempool_create().\n+ * Set the fields of a packet mbuf to their default values.\n+ */\n+void\n+rte_pktmbuf_init(struct rte_mempool *mp,\n+\t\t __attribute__((unused)) void *opaque_arg,\n+\t\t void *_m,\n+\t\t __attribute__((unused)) unsigned i)\n+{\n+\tstruct rte_mbuf *m = _m;\n+\tuint32_t buf_len = mp->elt_size - sizeof(struct rte_mbuf);\n+\n+\tRTE_MBUF_ASSERT(mp->elt_size >= sizeof(struct rte_mbuf));\n+\n+\tmemset(m, 0, mp->elt_size);\n+\n+\t/* start of buffer is just after mbuf structure */\n+\tm->buf_addr = (char *)m + sizeof(struct rte_mbuf);\n+\tm->buf_physaddr = rte_mempool_virt2phy(mp, m) +\n+\t\t\tsizeof(struct rte_mbuf);\n+\tm->buf_len = (uint16_t)buf_len;\n+\n+\t/* keep some headroom between start of buffer and data */\n+\tm->data_off = RTE_MIN(RTE_PKTMBUF_HEADROOM, (uint16_t)m->buf_len);\n+\n+\t/* init some constant fields */\n+\tm->pool = mp;\n+\tm->nb_segs = 1;\n+\tm->port = 0xff;\n+}\n+\n+/* do some sanity checks on a mbuf: panic if it fails */\n+void\n+rte_mbuf_sanity_check(const struct rte_mbuf *m, int is_header)\n+{\n+\tconst struct rte_mbuf *m_seg;\n+\tunsigned nb_segs;\n+\n+\tif (m == NULL)\n+\t\trte_panic(\"mbuf is NULL\\n\");\n+\n+\t/* generic checks */\n+\tif (m->pool == NULL)\n+\t\trte_panic(\"bad mbuf pool\\n\");\n+\tif (m->buf_physaddr == 0)\n+\t\trte_panic(\"bad phys addr\\n\");\n+\tif (m->buf_addr == NULL)\n+\t\trte_panic(\"bad virt addr\\n\");\n+\n+#ifdef RTE_MBUF_REFCNT\n+\tuint16_t cnt = rte_mbuf_refcnt_read(m);\n+\tif ((cnt == 0) || (cnt == UINT16_MAX))\n+\t\trte_panic(\"bad ref cnt\\n\");\n+#endif\n+\n+\t/* nothing to check for sub-segments */\n+\tif (is_header == 0)\n+\t\treturn;\n+\n+\tnb_segs = m->nb_segs;\n+\tm_seg = m;\n+\twhile (m_seg && nb_segs != 0) {\n+\t\tm_seg = m_seg->next;\n+\t\tnb_segs--;\n+\t}\n+\tif (nb_segs != 0)\n+\t\trte_panic(\"bad nb_segs\\n\");\n+}\n+\n+/* dump a mbuf on console */\n+void\n+rte_pktmbuf_dump(FILE *f, const struct rte_mbuf *m, unsigned dump_len)\n+{\n+\tunsigned int len;\n+\tunsigned nb_segs;\n+\n+\t__rte_mbuf_sanity_check(m, 1);\n+\n+\tfprintf(f, \"dump mbuf at 0x%p, phys=%\"PRIx64\", buf_len=%u\\n\",\n+\t       m, (uint64_t)m->buf_physaddr, (unsigned)m->buf_len);\n+\tfprintf(f, \"  pkt_len=%\"PRIu32\", ol_flags=%\"PRIx64\", nb_segs=%u, \"\n+\t       \"in_port=%u\\n\", m->pkt_len, m->ol_flags,\n+\t       (unsigned)m->nb_segs, (unsigned)m->port);\n+\tnb_segs = m->nb_segs;\n+\n+\twhile (m && nb_segs != 0) {\n+\t\t__rte_mbuf_sanity_check(m, 0);\n+\n+\t\tfprintf(f, \"  segment at 0x%p, data=0x%p, data_len=%u\\n\",\n+\t\t\tm, rte_pktmbuf_mtod(m, void *), (unsigned)m->data_len);\n+\t\tlen = dump_len;\n+\t\tif (len > m->data_len)\n+\t\t\tlen = m->data_len;\n+\t\tif (len != 0)\n+\t\t\trte_hexdump(f, NULL, rte_pktmbuf_mtod(m, void *), len);\n+\t\tdump_len -= len;\n+\t\tm = m->next;\n+\t\tnb_segs --;\n+\t}\n+}\n+\n+/*\n+ * Get the name of a RX offload flag. Must be kept synchronized with flag\n+ * definitions in rte_mbuf.h.\n+ */\n+const char *rte_get_rx_ol_flag_name(uint64_t mask)\n+{\n+\tswitch (mask) {\n+\tcase PKT_RX_VLAN_PKT: return \"PKT_RX_VLAN_PKT\";\n+\tcase PKT_RX_RSS_HASH: return \"PKT_RX_RSS_HASH\";\n+\tcase PKT_RX_FDIR: return \"PKT_RX_FDIR\";\n+\tcase PKT_RX_L4_CKSUM_BAD: return \"PKT_RX_L4_CKSUM_BAD\";\n+\tcase PKT_RX_IP_CKSUM_BAD: return \"PKT_RX_IP_CKSUM_BAD\";\n+\t/* case PKT_RX_EIP_CKSUM_BAD: return \"PKT_RX_EIP_CKSUM_BAD\"; */\n+\t/* case PKT_RX_OVERSIZE: return \"PKT_RX_OVERSIZE\"; */\n+\t/* case PKT_RX_HBUF_OVERFLOW: return \"PKT_RX_HBUF_OVERFLOW\"; */\n+\t/* case PKT_RX_RECIP_ERR: return \"PKT_RX_RECIP_ERR\"; */\n+\t/* case PKT_RX_MAC_ERR: return \"PKT_RX_MAC_ERR\"; */\n+\tcase PKT_RX_IPV4_HDR: return \"PKT_RX_IPV4_HDR\";\n+\tcase PKT_RX_IPV4_HDR_EXT: return \"PKT_RX_IPV4_HDR_EXT\";\n+\tcase PKT_RX_IPV6_HDR: return \"PKT_RX_IPV6_HDR\";\n+\tcase PKT_RX_IPV6_HDR_EXT: return \"PKT_RX_IPV6_HDR_EXT\";\n+\tcase PKT_RX_IEEE1588_PTP: return \"PKT_RX_IEEE1588_PTP\";\n+\tcase PKT_RX_IEEE1588_TMST: return \"PKT_RX_IEEE1588_TMST\";\n+\tcase PKT_RX_TUNNEL_IPV4_HDR: return \"PKT_RX_TUNNEL_IPV4_HDR\";\n+\tcase PKT_RX_TUNNEL_IPV6_HDR: return \"PKT_RX_TUNNEL_IPV6_HDR\";\n+\tdefault: return NULL;\n+\t}\n+}\n+\n+/*\n+ * Get the name of a TX offload flag. Must be kept synchronized with flag\n+ * definitions in rte_mbuf.h.\n+ */\n+const char *rte_get_tx_ol_flag_name(uint64_t mask)\n+{\n+\tswitch (mask) {\n+\tcase PKT_TX_VLAN_PKT: return \"PKT_TX_VLAN_PKT\";\n+\tcase PKT_TX_IP_CKSUM: return \"PKT_TX_IP_CKSUM\";\n+\tcase PKT_TX_TCP_CKSUM: return \"PKT_TX_TCP_CKSUM\";\n+\tcase PKT_TX_SCTP_CKSUM: return \"PKT_TX_SCTP_CKSUM\";\n+\tcase PKT_TX_UDP_CKSUM: return \"PKT_TX_UDP_CKSUM\";\n+\tcase PKT_TX_IEEE1588_TMST: return \"PKT_TX_IEEE1588_TMST\";\n+\tcase PKT_TX_UDP_TUNNEL_PKT: return \"PKT_TX_UDP_TUNNEL_PKT\";\n+\tcase PKT_TX_TCP_SEG: return \"PKT_TX_TCP_SEG\";\n+\tcase PKT_TX_IPV4: return \"PKT_TX_IPV4\";\n+\tcase PKT_TX_IPV6: return \"PKT_TX_IPV6\";\n+\tcase PKT_TX_OUTER_IP_CKSUM: return \"PKT_TX_OUTER_IP_CKSUM\";\n+\tcase PKT_TX_OUTER_IPV4: return \"PKT_TX_OUTER_IPV4\";\n+\tcase PKT_TX_OUTER_IPV6: return \"PKT_TX_OUTER_IPV6\";\n+\tdefault: return NULL;\n+\t}\n+}\ndiff --git a/lib/core/librte_mbuf/rte_mbuf.h b/lib/core/librte_mbuf/rte_mbuf.h\nnew file mode 100644\nindex 0000000..16059c6\n--- /dev/null\n+++ b/lib/core/librte_mbuf/rte_mbuf.h\n@@ -0,0 +1,1133 @@\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_H_\n+#define _RTE_MBUF_H_\n+\n+/**\n+ * @file\n+ * RTE Mbuf\n+ *\n+ * The mbuf library provides the ability to create and destroy buffers\n+ * that may be used by the RTE application to store message\n+ * buffers. The message buffers are stored in a mempool, using the\n+ * RTE mempool library.\n+ *\n+ * This library provide an API to allocate/free packet mbufs, which are\n+ * used to carry network packets.\n+ *\n+ * To understand the concepts of packet buffers or mbufs, you\n+ * should read \"TCP/IP Illustrated, Volume 2: The Implementation,\n+ * Addison-Wesley, 1995, ISBN 0-201-63354-X from Richard Stevens\"\n+ * http://www.kohala.com/start/tcpipiv2.html\n+ */\n+\n+#include <stdint.h>\n+#include <rte_mempool.h>\n+#include <rte_memory.h>\n+#include <rte_atomic.h>\n+#include <rte_prefetch.h>\n+#include <rte_branch_prediction.h>\n+\n+#ifdef __cplusplus\n+extern \"C\" {\n+#endif\n+\n+/* deprecated feature, renamed in RTE_MBUF_REFCNT */\n+#pragma GCC poison RTE_MBUF_SCATTER_GATHER\n+\n+/*\n+ * Packet Offload Features Flags. It also carry packet type information.\n+ * Critical resources. Both rx/tx shared these bits. Be cautious on any change\n+ *\n+ * - RX flags start at bit position zero, and get added to the left of previous\n+ *   flags.\n+ * - The most-significant 8 bits are reserved for generic mbuf flags\n+ * - TX flags therefore start at bit position 55 (i.e. 63-8), and new flags get\n+ *   added to the right of the previously defined flags\n+ *\n+ * Keep these flags synchronized with rte_get_rx_ol_flag_name() and\n+ * rte_get_tx_ol_flag_name().\n+ */\n+#define PKT_RX_VLAN_PKT      (1ULL << 0)  /**< RX packet is a 802.1q VLAN packet. */\n+#define PKT_RX_RSS_HASH      (1ULL << 1)  /**< RX packet with RSS hash result. */\n+#define PKT_RX_FDIR          (1ULL << 2)  /**< RX packet with FDIR match indicate. */\n+#define PKT_RX_L4_CKSUM_BAD  (1ULL << 3)  /**< L4 cksum of RX pkt. is not OK. */\n+#define PKT_RX_IP_CKSUM_BAD  (1ULL << 4)  /**< IP cksum of RX pkt. is not OK. */\n+#define PKT_RX_EIP_CKSUM_BAD (0ULL << 0)  /**< External IP header checksum error. */\n+#define PKT_RX_OVERSIZE      (0ULL << 0)  /**< Num of desc of an RX pkt oversize. */\n+#define PKT_RX_HBUF_OVERFLOW (0ULL << 0)  /**< Header buffer overflow. */\n+#define PKT_RX_RECIP_ERR     (0ULL << 0)  /**< Hardware processing error. */\n+#define PKT_RX_MAC_ERR       (0ULL << 0)  /**< MAC error. */\n+#define PKT_RX_IPV4_HDR      (1ULL << 5)  /**< RX packet with IPv4 header. */\n+#define PKT_RX_IPV4_HDR_EXT  (1ULL << 6)  /**< RX packet with extended IPv4 header. */\n+#define PKT_RX_IPV6_HDR      (1ULL << 7)  /**< RX packet with IPv6 header. */\n+#define PKT_RX_IPV6_HDR_EXT  (1ULL << 8)  /**< RX packet with extended IPv6 header. */\n+#define PKT_RX_IEEE1588_PTP  (1ULL << 9)  /**< RX IEEE1588 L2 Ethernet PT Packet. */\n+#define PKT_RX_IEEE1588_TMST (1ULL << 10) /**< RX IEEE1588 L2/L4 timestamped packet.*/\n+#define PKT_RX_TUNNEL_IPV4_HDR (1ULL << 11) /**< RX tunnel packet with IPv4 header.*/\n+#define PKT_RX_TUNNEL_IPV6_HDR (1ULL << 12) /**< RX tunnel packet with IPv6 header. */\n+#define PKT_RX_FDIR_ID       (1ULL << 13) /**< FD id reported if FDIR match. */\n+#define PKT_RX_FDIR_FLX      (1ULL << 14) /**< Flexible bytes reported if FDIR match. */\n+/* add new RX flags here */\n+\n+/* add new TX flags here */\n+\n+/**\n+ * TCP segmentation offload. To enable this offload feature for a\n+ * packet to be transmitted on hardware supporting TSO:\n+ *  - set the PKT_TX_TCP_SEG flag in mbuf->ol_flags (this flag implies\n+ *    PKT_TX_TCP_CKSUM)\n+ *  - set the flag PKT_TX_IPV4 or PKT_TX_IPV6\n+ *  - if it's IPv4, set the PKT_TX_IP_CKSUM flag and write the IP checksum\n+ *    to 0 in the packet\n+ *  - fill the mbuf offload information: l2_len, l3_len, l4_len, tso_segsz\n+ *  - calculate the pseudo header checksum without taking ip_len in account,\n+ *    and set it in the TCP header. Refer to rte_ipv4_phdr_cksum() and\n+ *    rte_ipv6_phdr_cksum() that can be used as helpers.\n+ */\n+#define PKT_TX_TCP_SEG       (1ULL << 49)\n+\n+/** TX packet is an UDP tunneled packet. It must be specified when using\n+ *  outer checksum offload (PKT_TX_OUTER_IP_CKSUM) */\n+#define PKT_TX_UDP_TUNNEL_PKT (1ULL << 50) /**< TX packet is an UDP tunneled packet */\n+#define PKT_TX_IEEE1588_TMST (1ULL << 51) /**< TX IEEE1588 packet to timestamp. */\n+\n+/**\n+ * Bits 52+53 used for L4 packet type with checksum enabled: 00: Reserved,\n+ * 01: TCP checksum, 10: SCTP checksum, 11: UDP checksum. To use hardware\n+ * L4 checksum offload, the user needs to:\n+ *  - fill l2_len and l3_len in mbuf\n+ *  - set the flags PKT_TX_TCP_CKSUM, PKT_TX_SCTP_CKSUM or PKT_TX_UDP_CKSUM\n+ *  - set the flag PKT_TX_IPV4 or PKT_TX_IPV6\n+ *  - calculate the pseudo header checksum and set it in the L4 header (only\n+ *    for TCP or UDP). See rte_ipv4_phdr_cksum() and rte_ipv6_phdr_cksum().\n+ *    For SCTP, set the crc field to 0.\n+ */\n+#define PKT_TX_L4_NO_CKSUM   (0ULL << 52) /**< Disable L4 cksum of TX pkt. */\n+#define PKT_TX_TCP_CKSUM     (1ULL << 52) /**< TCP cksum of TX pkt. computed by NIC. */\n+#define PKT_TX_SCTP_CKSUM    (2ULL << 52) /**< SCTP cksum of TX pkt. computed by NIC. */\n+#define PKT_TX_UDP_CKSUM     (3ULL << 52) /**< UDP cksum of TX pkt. computed by NIC. */\n+#define PKT_TX_L4_MASK       (3ULL << 52) /**< Mask for L4 cksum offload request. */\n+\n+#define PKT_TX_IP_CKSUM      (1ULL << 54) /**< IP cksum of TX pkt. computed by NIC. */\n+#define PKT_TX_IPV4_CSUM     PKT_TX_IP_CKSUM /**< Alias of PKT_TX_IP_CKSUM. */\n+\n+/** Packet is IPv4 without requiring IP checksum offload. */\n+#define PKT_TX_IPV4          (1ULL << 55)\n+\n+/** Tell the NIC it's an IPv6 packet.*/\n+#define PKT_TX_IPV6          (1ULL << 56)\n+\n+#define PKT_TX_VLAN_PKT      (1ULL << 57) /**< TX packet is a 802.1q VLAN packet. */\n+\n+/** Outer IP checksum of TX packet, computed by NIC for tunneling packet.\n+ *  The tunnel type must also be specified, ex: PKT_TX_UDP_TUNNEL_PKT. */\n+#define PKT_TX_OUTER_IP_CKSUM   (1ULL << 58)\n+\n+/** Packet is outer IPv4 without requiring IP checksum offload for tunneling packet. */\n+#define PKT_TX_OUTER_IPV4   (1ULL << 59)\n+\n+/** Tell the NIC it's an outer IPv6 packet for tunneling packet */\n+#define PKT_TX_OUTER_IPV6    (1ULL << 60)\n+\n+/* Use final bit of flags to indicate a control mbuf */\n+#define CTRL_MBUF_FLAG       (1ULL << 63) /**< Mbuf contains control data */\n+\n+/**\n+ * Get the name of a RX offload flag\n+ *\n+ * @param mask\n+ *   The mask describing the flag.\n+ * @return\n+ *   The name of this flag, or NULL if it's not a valid RX flag.\n+ */\n+const char *rte_get_rx_ol_flag_name(uint64_t mask);\n+\n+/**\n+ * Get the name of a TX offload flag\n+ *\n+ * @param mask\n+ *   The mask describing the flag. Usually only one bit must be set.\n+ *   Several bits can be given if they belong to the same mask.\n+ *   Ex: PKT_TX_L4_MASK.\n+ * @return\n+ *   The name of this flag, or NULL if it's not a valid TX flag.\n+ */\n+const char *rte_get_tx_ol_flag_name(uint64_t mask);\n+\n+/* define a set of marker types that can be used to refer to set points in the\n+ * mbuf */\n+typedef void    *MARKER[0];   /**< generic marker for a point in a structure */\n+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+/**\n+ * The generic rte_mbuf, containing a packet mbuf.\n+ */\n+struct rte_mbuf {\n+\tMARKER cacheline0;\n+\n+\tvoid *buf_addr;           /**< Virtual address of segment buffer. */\n+\tphys_addr_t buf_physaddr; /**< Physical address of segment buffer. */\n+\n+\tuint16_t buf_len;         /**< Length of segment buffer. */\n+\n+\t/* next 6 bytes are initialised on RX descriptor rearm */\n+\tMARKER8 rearm_data;\n+\tuint16_t data_off;\n+\n+\t/**\n+\t * 16-bit Reference counter.\n+\t * It should only be accessed using the following functions:\n+\t * rte_mbuf_refcnt_update(), rte_mbuf_refcnt_read(), and\n+\t * rte_mbuf_refcnt_set(). The functionality of these functions (atomic,\n+\t * or non-atomic) is controlled by the CONFIG_RTE_MBUF_REFCNT_ATOMIC\n+\t * config option.\n+\t */\n+\tunion {\n+#ifdef RTE_MBUF_REFCNT\n+\t\trte_atomic16_t refcnt_atomic; /**< Atomically accessed refcnt */\n+\t\tuint16_t refcnt;              /**< Non-atomically accessed refcnt */\n+#endif\n+\t\tuint16_t refcnt_reserved;     /**< Do not use this field */\n+\t};\n+\tuint8_t nb_segs;          /**< Number of segments. */\n+\tuint8_t port;             /**< Input port. */\n+\n+\tuint64_t ol_flags;        /**< Offload features. */\n+\n+\t/* remaining bytes are set on RX when pulling packet from descriptor */\n+\tMARKER rx_descriptor_fields1;\n+\n+\t/**\n+\t * The packet type, which is used to indicate ordinary packet and also\n+\t * tunneled packet format, i.e. each number is represented a type of\n+\t * packet.\n+\t */\n+\tuint16_t packet_type;\n+\n+\tuint16_t data_len;        /**< Amount of data in segment buffer. */\n+\tuint32_t pkt_len;         /**< Total pkt len: sum of all segments. */\n+\tuint16_t vlan_tci;        /**< VLAN Tag Control Identifier (CPU order) */\n+\tuint16_t reserved;\n+\tunion {\n+\t\tuint32_t rss;     /**< RSS hash result if RSS enabled */\n+\t\tstruct {\n+\t\t\tunion {\n+\t\t\t\tstruct {\n+\t\t\t\t\tuint16_t hash;\n+\t\t\t\t\tuint16_t id;\n+\t\t\t\t};\n+\t\t\t\tuint32_t lo;\n+\t\t\t\t/**< Second 4 flexible bytes */\n+\t\t\t};\n+\t\t\tuint32_t hi;\n+\t\t\t/**< First 4 flexible bytes or FD ID, dependent on\n+\t\t\t     PKT_RX_FDIR_* flag in ol_flags. */\n+\t\t} fdir;           /**< Filter identifier if FDIR enabled */\n+\t\tuint32_t sched;   /**< Hierarchical scheduler */\n+\t\tuint32_t usr;\t  /**< User defined tags. See @rte_distributor_process */\n+\t} hash;                   /**< hash information */\n+\n+\t/* second cache line - fields only used in slow path or on TX */\n+\tMARKER cacheline1 __rte_cache_aligned;\n+\n+\tunion {\n+\t\tvoid *userdata;   /**< Can be used for external metadata */\n+\t\tuint64_t udata64; /**< Allow 8-byte userdata on 32-bit */\n+\t};\n+\n+\tstruct rte_mempool *pool; /**< Pool from which mbuf was allocated. */\n+\tstruct rte_mbuf *next;    /**< Next segment of scattered packet. */\n+\n+\t/* fields to support TX offloads */\n+\tunion {\n+\t\tuint64_t tx_offload;       /**< combined for easy fetch */\n+\t\tstruct {\n+\t\t\tuint64_t l2_len:7; /**< L2 (MAC) Header Length. */\n+\t\t\tuint64_t l3_len:9; /**< L3 (IP) Header Length. */\n+\t\t\tuint64_t l4_len:8; /**< L4 (TCP/UDP) Header Length. */\n+\t\t\tuint64_t tso_segsz:16; /**< TCP TSO segment size */\n+\n+\t\t\t/* fields for TX offloading of tunnels */\n+\t\t\tuint64_t outer_l3_len:9; /**< Outer L3 (IP) Hdr Length. */\n+\t\t\tuint64_t outer_l2_len:7; /**< Outer L2 (MAC) Hdr Length. */\n+\n+\t\t\t/* uint64_t unused:8; */\n+\t\t};\n+\t};\n+} __rte_cache_aligned;\n+\n+/**\n+ * Given the buf_addr returns the pointer to corresponding mbuf.\n+ */\n+#define RTE_MBUF_FROM_BADDR(ba)     (((struct rte_mbuf *)(ba)) - 1)\n+\n+/**\n+ * Given the pointer to mbuf returns an address where it's  buf_addr\n+ * should point to.\n+ */\n+#define RTE_MBUF_TO_BADDR(mb)       (((struct rte_mbuf *)(mb)) + 1)\n+\n+/**\n+ * Returns TRUE if given mbuf is indirect, or FALSE otherwise.\n+ */\n+#define RTE_MBUF_INDIRECT(mb)   (RTE_MBUF_FROM_BADDR((mb)->buf_addr) != (mb))\n+\n+/**\n+ * Returns TRUE if given mbuf is direct, or FALSE otherwise.\n+ */\n+#define RTE_MBUF_DIRECT(mb)     (RTE_MBUF_FROM_BADDR((mb)->buf_addr) == (mb))\n+\n+\n+/**\n+ * Private data in case of pktmbuf pool.\n+ *\n+ * A structure that contains some pktmbuf_pool-specific data that are\n+ * appended after the mempool structure (in private data).\n+ */\n+struct rte_pktmbuf_pool_private {\n+\tuint16_t mbuf_data_room_size; /**< Size of data space in each mbuf.*/\n+};\n+\n+#ifdef RTE_LIBRTE_MBUF_DEBUG\n+\n+/**  check mbuf type in debug mode */\n+#define __rte_mbuf_sanity_check(m, is_h) rte_mbuf_sanity_check(m, is_h)\n+\n+/**  check mbuf type in debug mode if mbuf pointer is not null */\n+#define __rte_mbuf_sanity_check_raw(m, is_h)\tdo {       \\\n+\tif ((m) != NULL)                                   \\\n+\t\trte_mbuf_sanity_check(m, is_h);          \\\n+} while (0)\n+\n+/**  MBUF asserts in debug mode */\n+#define RTE_MBUF_ASSERT(exp)                                         \\\n+if (!(exp)) {                                                        \\\n+\trte_panic(\"line%d\\tassert \\\"\" #exp \"\\\" failed\\n\", __LINE__); \\\n+}\n+\n+#else /*  RTE_LIBRTE_MBUF_DEBUG */\n+\n+/**  check mbuf type in debug mode */\n+#define __rte_mbuf_sanity_check(m, is_h) do { } while (0)\n+\n+/**  check mbuf type in debug mode if mbuf pointer is not null */\n+#define __rte_mbuf_sanity_check_raw(m, is_h) do { } while (0)\n+\n+/**  MBUF asserts in debug mode */\n+#define RTE_MBUF_ASSERT(exp)                do { } while (0)\n+\n+#endif /*  RTE_LIBRTE_MBUF_DEBUG */\n+\n+#ifdef RTE_MBUF_REFCNT\n+#ifdef RTE_MBUF_REFCNT_ATOMIC\n+\n+/**\n+ * Adds given value to an mbuf's refcnt and returns its new value.\n+ * @param m\n+ *   Mbuf to update\n+ * @param value\n+ *   Value to add/subtract\n+ * @return\n+ *   Updated value\n+ */\n+static inline uint16_t\n+rte_mbuf_refcnt_update(struct rte_mbuf *m, int16_t value)\n+{\n+\treturn (uint16_t)(rte_atomic16_add_return(&m->refcnt_atomic, value));\n+}\n+\n+/**\n+ * Reads the value of an mbuf's refcnt.\n+ * @param m\n+ *   Mbuf to read\n+ * @return\n+ *   Reference count number.\n+ */\n+static inline uint16_t\n+rte_mbuf_refcnt_read(const struct rte_mbuf *m)\n+{\n+\treturn (uint16_t)(rte_atomic16_read(&m->refcnt_atomic));\n+}\n+\n+/**\n+ * Sets an mbuf's refcnt to a defined value.\n+ * @param m\n+ *   Mbuf to update\n+ * @param new_value\n+ *   Value set\n+ */\n+static inline void\n+rte_mbuf_refcnt_set(struct rte_mbuf *m, uint16_t new_value)\n+{\n+\trte_atomic16_set(&m->refcnt_atomic, new_value);\n+}\n+\n+#else /* ! RTE_MBUF_REFCNT_ATOMIC */\n+\n+/**\n+ * Adds given value to an mbuf's refcnt and returns its new value.\n+ */\n+static inline uint16_t\n+rte_mbuf_refcnt_update(struct rte_mbuf *m, int16_t value)\n+{\n+\tm->refcnt = (uint16_t)(m->refcnt + value);\n+\treturn m->refcnt;\n+}\n+\n+/**\n+ * Reads the value of an mbuf's refcnt.\n+ */\n+static inline uint16_t\n+rte_mbuf_refcnt_read(const struct rte_mbuf *m)\n+{\n+\treturn m->refcnt;\n+}\n+\n+/**\n+ * Sets an mbuf's refcnt to the defined value.\n+ */\n+static inline void\n+rte_mbuf_refcnt_set(struct rte_mbuf *m, uint16_t new_value)\n+{\n+\tm->refcnt = new_value;\n+}\n+\n+#endif /* RTE_MBUF_REFCNT_ATOMIC */\n+\n+/** Mbuf prefetch */\n+#define RTE_MBUF_PREFETCH_TO_FREE(m) do {       \\\n+\tif ((m) != NULL)                        \\\n+\t\trte_prefetch0(m);               \\\n+} while (0)\n+\n+#else /* ! RTE_MBUF_REFCNT */\n+\n+/** Mbuf prefetch */\n+#define RTE_MBUF_PREFETCH_TO_FREE(m) do { } while(0)\n+\n+#define rte_mbuf_refcnt_set(m,v) do { } while(0)\n+\n+#endif /* RTE_MBUF_REFCNT */\n+\n+\n+/**\n+ * Sanity checks on an mbuf.\n+ *\n+ * Check the consistency of the given mbuf. The function will cause a\n+ * panic if corruption is detected.\n+ *\n+ * @param m\n+ *   The mbuf to be checked.\n+ * @param is_header\n+ *   True if the mbuf is a packet header, false if it is a sub-segment\n+ *   of a packet (in this case, some fields like nb_segs are not checked)\n+ */\n+void\n+rte_mbuf_sanity_check(const struct rte_mbuf *m, int is_header);\n+\n+/**\n+ * @internal Allocate a new mbuf from mempool *mp*.\n+ * The use of that function is reserved for RTE internal needs.\n+ * Please use rte_pktmbuf_alloc().\n+ *\n+ * @param mp\n+ *   The mempool from which mbuf is allocated.\n+ * @return\n+ *   - The pointer to the new mbuf on success.\n+ *   - NULL if allocation failed.\n+ */\n+static inline struct rte_mbuf *__rte_mbuf_raw_alloc(struct rte_mempool *mp)\n+{\n+\tstruct rte_mbuf *m;\n+\tvoid *mb = NULL;\n+\tif (rte_mempool_get(mp, &mb) < 0)\n+\t\treturn NULL;\n+\tm = (struct rte_mbuf *)mb;\n+#ifdef RTE_MBUF_REFCNT\n+\tRTE_MBUF_ASSERT(rte_mbuf_refcnt_read(m) == 0);\n+\trte_mbuf_refcnt_set(m, 1);\n+#endif /* RTE_MBUF_REFCNT */\n+\treturn (m);\n+}\n+\n+/**\n+ * @internal Put mbuf back into its original mempool.\n+ * The use of that function is reserved for RTE internal needs.\n+ * Please use rte_pktmbuf_free().\n+ *\n+ * @param m\n+ *   The mbuf to be freed.\n+ */\n+static inline void __attribute__((always_inline))\n+__rte_mbuf_raw_free(struct rte_mbuf *m)\n+{\n+#ifdef RTE_MBUF_REFCNT\n+\tRTE_MBUF_ASSERT(rte_mbuf_refcnt_read(m) == 0);\n+#endif /* RTE_MBUF_REFCNT */\n+\trte_mempool_put(m->pool, m);\n+}\n+\n+/* Operations on ctrl mbuf */\n+\n+/**\n+ * The control mbuf constructor.\n+ *\n+ * This function initializes some fields in an mbuf structure that are\n+ * not modified by the user once created (mbuf type, origin pool, buffer\n+ * start address, and so on). This function is given as a callback function\n+ * to rte_mempool_create() at pool creation time.\n+ *\n+ * @param mp\n+ *   The mempool from which the mbuf is allocated.\n+ * @param opaque_arg\n+ *   A pointer that can be used by the user to retrieve useful information\n+ *   for mbuf initialization. This pointer comes from the ``init_arg``\n+ *   parameter of rte_mempool_create().\n+ * @param m\n+ *   The mbuf to initialize.\n+ * @param i\n+ *   The index of the mbuf in the pool table.\n+ */\n+void rte_ctrlmbuf_init(struct rte_mempool *mp, void *opaque_arg,\n+\t\tvoid *m, unsigned i);\n+\n+/**\n+ * Allocate a new mbuf (type is ctrl) from mempool *mp*.\n+ *\n+ * This new mbuf is initialized with data pointing to the beginning of\n+ * buffer, and with a length of zero.\n+ *\n+ * @param mp\n+ *   The mempool from which the mbuf is allocated.\n+ * @return\n+ *   - The pointer to the new mbuf on success.\n+ *   - NULL if allocation failed.\n+ */\n+#define rte_ctrlmbuf_alloc(mp) rte_pktmbuf_alloc(mp)\n+\n+/**\n+ * Free a control mbuf back into its original mempool.\n+ *\n+ * @param m\n+ *   The control mbuf to be freed.\n+ */\n+#define rte_ctrlmbuf_free(m) rte_pktmbuf_free(m)\n+\n+/**\n+ * A macro that returns the pointer to the carried data.\n+ *\n+ * The value that can be read or assigned.\n+ *\n+ * @param m\n+ *   The control mbuf.\n+ */\n+#define rte_ctrlmbuf_data(m) ((char *)((m)->buf_addr) + (m)->data_off)\n+\n+/**\n+ * A macro that returns the length of the carried data.\n+ *\n+ * The value that can be read or assigned.\n+ *\n+ * @param m\n+ *   The control mbuf.\n+ */\n+#define rte_ctrlmbuf_len(m) rte_pktmbuf_data_len(m)\n+\n+/**\n+ * Tests if an mbuf is a control mbuf\n+ *\n+ * @param m\n+ *   The mbuf to be tested\n+ * @return\n+ *   - True (1) if the mbuf is a control mbuf\n+ *   - False(0) otherwise\n+ */\n+static inline int\n+rte_is_ctrlmbuf(struct rte_mbuf *m)\n+{\n+\treturn (!!(m->ol_flags & CTRL_MBUF_FLAG));\n+}\n+\n+/* Operations on pkt mbuf */\n+\n+/**\n+ * The packet mbuf constructor.\n+ *\n+ * This function initializes some fields in the mbuf structure that are\n+ * not modified by the user once created (origin pool, buffer start\n+ * address, and so on). This function is given as a callback function to\n+ * rte_mempool_create() at pool creation time.\n+ *\n+ * @param mp\n+ *   The mempool from which mbufs originate.\n+ * @param opaque_arg\n+ *   A pointer that can be used by the user to retrieve useful information\n+ *   for mbuf initialization. This pointer comes from the ``init_arg``\n+ *   parameter of rte_mempool_create().\n+ * @param m\n+ *   The mbuf to initialize.\n+ * @param i\n+ *   The index of the mbuf in the pool table.\n+ */\n+void rte_pktmbuf_init(struct rte_mempool *mp, void *opaque_arg,\n+\t\t      void *m, unsigned i);\n+\n+\n+/**\n+ * A  packet mbuf pool constructor.\n+ *\n+ * This function initializes the mempool private data in the case of a\n+ * pktmbuf pool. This private data is needed by the driver. The\n+ * function is given as a callback function to rte_mempool_create() at\n+ * pool creation. It can be extended by the user, for example, to\n+ * provide another packet size.\n+ *\n+ * @param mp\n+ *   The mempool from which mbufs originate.\n+ * @param opaque_arg\n+ *   A pointer that can be used by the user to retrieve useful information\n+ *   for mbuf initialization. This pointer comes from the ``init_arg``\n+ *   parameter of rte_mempool_create().\n+ */\n+void rte_pktmbuf_pool_init(struct rte_mempool *mp, void *opaque_arg);\n+\n+/**\n+ * Reset the fields of a packet mbuf to their default values.\n+ *\n+ * The given mbuf must have only one segment.\n+ *\n+ * @param m\n+ *   The packet mbuf to be resetted.\n+ */\n+static inline void rte_pktmbuf_reset(struct rte_mbuf *m)\n+{\n+\tm->next = NULL;\n+\tm->pkt_len = 0;\n+\tm->tx_offload = 0;\n+\tm->vlan_tci = 0;\n+\tm->nb_segs = 1;\n+\tm->port = 0xff;\n+\n+\tm->ol_flags = 0;\n+\tm->packet_type = 0;\n+\tm->data_off = (RTE_PKTMBUF_HEADROOM <= m->buf_len) ?\n+\t\t\tRTE_PKTMBUF_HEADROOM : m->buf_len;\n+\n+\tm->data_len = 0;\n+\t__rte_mbuf_sanity_check(m, 1);\n+}\n+\n+/**\n+ * Allocate a new mbuf from a mempool.\n+ *\n+ * This new mbuf contains one segment, which has a length of 0. The pointer\n+ * to data is initialized to have some bytes of headroom in the buffer\n+ * (if buffer size allows).\n+ *\n+ * @param mp\n+ *   The mempool from which the mbuf is allocated.\n+ * @return\n+ *   - The pointer to the new mbuf on success.\n+ *   - NULL if allocation failed.\n+ */\n+static inline struct rte_mbuf *rte_pktmbuf_alloc(struct rte_mempool *mp)\n+{\n+\tstruct rte_mbuf *m;\n+\tif ((m = __rte_mbuf_raw_alloc(mp)) != NULL)\n+\t\trte_pktmbuf_reset(m);\n+\treturn (m);\n+}\n+\n+#ifdef RTE_MBUF_REFCNT\n+\n+/**\n+ * Attach packet mbuf to another packet mbuf.\n+ * After attachment we refer the mbuf we attached as 'indirect',\n+ * while mbuf we attached to as 'direct'.\n+ * Right now, not supported:\n+ *  - attachment to indirect mbuf (e.g. - md  has to be direct).\n+ *  - attachment for already indirect mbuf (e.g. - mi has to be direct).\n+ *  - mbuf we trying to attach (mi) is used by someone else\n+ *    e.g. it's reference counter is greater then 1.\n+ *\n+ * @param mi\n+ *   The indirect packet mbuf.\n+ * @param md\n+ *   The direct packet mbuf.\n+ */\n+\n+static inline void rte_pktmbuf_attach(struct rte_mbuf *mi, struct rte_mbuf *md)\n+{\n+\tRTE_MBUF_ASSERT(RTE_MBUF_DIRECT(md) &&\n+\t    RTE_MBUF_DIRECT(mi) &&\n+\t    rte_mbuf_refcnt_read(mi) == 1);\n+\n+\trte_mbuf_refcnt_update(md, 1);\n+\tmi->buf_physaddr = md->buf_physaddr;\n+\tmi->buf_addr = md->buf_addr;\n+\tmi->buf_len = md->buf_len;\n+\n+\tmi->next = md->next;\n+\tmi->data_off = md->data_off;\n+\tmi->data_len = md->data_len;\n+\tmi->port = md->port;\n+\tmi->vlan_tci = md->vlan_tci;\n+\tmi->tx_offload = md->tx_offload;\n+\tmi->hash = md->hash;\n+\n+\tmi->next = NULL;\n+\tmi->pkt_len = mi->data_len;\n+\tmi->nb_segs = 1;\n+\tmi->ol_flags = md->ol_flags;\n+\tmi->packet_type = md->packet_type;\n+\n+\t__rte_mbuf_sanity_check(mi, 1);\n+\t__rte_mbuf_sanity_check(md, 0);\n+}\n+\n+/**\n+ * Detach an indirect packet mbuf -\n+ *  - restore original mbuf address and length values.\n+ *  - reset pktmbuf data and data_len to their default values.\n+ *  All other fields of the given packet mbuf will be left intact.\n+ *\n+ * @param m\n+ *   The indirect attached packet mbuf.\n+ */\n+\n+static inline void rte_pktmbuf_detach(struct rte_mbuf *m)\n+{\n+\tconst struct rte_mempool *mp = m->pool;\n+\tvoid *buf = RTE_MBUF_TO_BADDR(m);\n+\tuint32_t buf_len = mp->elt_size - sizeof(*m);\n+\tm->buf_physaddr = rte_mempool_virt2phy(mp, m) + sizeof (*m);\n+\n+\tm->buf_addr = buf;\n+\tm->buf_len = (uint16_t)buf_len;\n+\n+\tm->data_off = (RTE_PKTMBUF_HEADROOM <= m->buf_len) ?\n+\t\t\tRTE_PKTMBUF_HEADROOM : m->buf_len;\n+\n+\tm->data_len = 0;\n+}\n+\n+#endif /* RTE_MBUF_REFCNT */\n+\n+\n+static inline struct rte_mbuf* __attribute__((always_inline))\n+__rte_pktmbuf_prefree_seg(struct rte_mbuf *m)\n+{\n+\t__rte_mbuf_sanity_check(m, 0);\n+\n+#ifdef RTE_MBUF_REFCNT\n+\tif (likely (rte_mbuf_refcnt_read(m) == 1) ||\n+\t\t\tlikely (rte_mbuf_refcnt_update(m, -1) == 0)) {\n+\t\tstruct rte_mbuf *md = RTE_MBUF_FROM_BADDR(m->buf_addr);\n+\n+\t\trte_mbuf_refcnt_set(m, 0);\n+\n+\t\t/* if this is an indirect mbuf, then\n+\t\t *  - detach mbuf\n+\t\t *  - free attached mbuf segment\n+\t\t */\n+\t\tif (unlikely (md != m)) {\n+\t\t\trte_pktmbuf_detach(m);\n+\t\t\tif (rte_mbuf_refcnt_update(md, -1) == 0)\n+\t\t\t\t__rte_mbuf_raw_free(md);\n+\t\t}\n+#endif\n+\t\treturn(m);\n+#ifdef RTE_MBUF_REFCNT\n+\t}\n+\treturn (NULL);\n+#endif\n+}\n+\n+/**\n+ * Free a segment of a packet mbuf into its original mempool.\n+ *\n+ * Free an mbuf, without parsing other segments in case of chained\n+ * buffers.\n+ *\n+ * @param m\n+ *   The packet mbuf segment to be freed.\n+ */\n+static inline void __attribute__((always_inline))\n+rte_pktmbuf_free_seg(struct rte_mbuf *m)\n+{\n+\tif (likely(NULL != (m = __rte_pktmbuf_prefree_seg(m)))) {\n+\t\tm->next = NULL;\n+\t\t__rte_mbuf_raw_free(m);\n+\t}\n+}\n+\n+/**\n+ * Free a packet mbuf back into its original mempool.\n+ *\n+ * Free an mbuf, and all its segments in case of chained buffers. Each\n+ * segment is added back into its original mempool.\n+ *\n+ * @param m\n+ *   The packet mbuf to be freed.\n+ */\n+static inline void rte_pktmbuf_free(struct rte_mbuf *m)\n+{\n+\tstruct rte_mbuf *m_next;\n+\n+\t__rte_mbuf_sanity_check(m, 1);\n+\n+\twhile (m != NULL) {\n+\t\tm_next = m->next;\n+\t\trte_pktmbuf_free_seg(m);\n+\t\tm = m_next;\n+\t}\n+}\n+\n+#ifdef RTE_MBUF_REFCNT\n+\n+/**\n+ * Creates a \"clone\" of the given packet mbuf.\n+ *\n+ * Walks through all segments of the given packet mbuf, and for each of them:\n+ *  - Creates a new packet mbuf from the given pool.\n+ *  - Attaches newly created mbuf to the segment.\n+ * Then updates pkt_len and nb_segs of the \"clone\" packet mbuf to match values\n+ * from the original packet mbuf.\n+ *\n+ * @param md\n+ *   The packet mbuf to be cloned.\n+ * @param mp\n+ *   The mempool from which the \"clone\" mbufs are allocated.\n+ * @return\n+ *   - The pointer to the new \"clone\" mbuf on success.\n+ *   - NULL if allocation fails.\n+ */\n+static inline struct rte_mbuf *rte_pktmbuf_clone(struct rte_mbuf *md,\n+\t\tstruct rte_mempool *mp)\n+{\n+\tstruct rte_mbuf *mc, *mi, **prev;\n+\tuint32_t pktlen;\n+\tuint8_t nseg;\n+\n+\tif (unlikely ((mc = rte_pktmbuf_alloc(mp)) == NULL))\n+\t\treturn (NULL);\n+\n+\tmi = mc;\n+\tprev = &mi->next;\n+\tpktlen = md->pkt_len;\n+\tnseg = 0;\n+\n+\tdo {\n+\t\tnseg++;\n+\t\trte_pktmbuf_attach(mi, md);\n+\t\t*prev = mi;\n+\t\tprev = &mi->next;\n+\t} while ((md = md->next) != NULL &&\n+\t    (mi = rte_pktmbuf_alloc(mp)) != NULL);\n+\n+\t*prev = NULL;\n+\tmc->nb_segs = nseg;\n+\tmc->pkt_len = pktlen;\n+\n+\t/* Allocation of new indirect segment failed */\n+\tif (unlikely (mi == NULL)) {\n+\t\trte_pktmbuf_free(mc);\n+\t\treturn (NULL);\n+\t}\n+\n+\t__rte_mbuf_sanity_check(mc, 1);\n+\treturn (mc);\n+}\n+\n+/**\n+ * Adds given value to the refcnt of all packet mbuf segments.\n+ *\n+ * Walks through all segments of given packet mbuf and for each of them\n+ * invokes rte_mbuf_refcnt_update().\n+ *\n+ * @param m\n+ *   The packet mbuf whose refcnt to be updated.\n+ * @param v\n+ *   The value to add to the mbuf's segments refcnt.\n+ */\n+static inline void rte_pktmbuf_refcnt_update(struct rte_mbuf *m, int16_t v)\n+{\n+\t__rte_mbuf_sanity_check(m, 1);\n+\n+\tdo {\n+\t\trte_mbuf_refcnt_update(m, v);\n+\t} while ((m = m->next) != NULL);\n+}\n+\n+#endif /* RTE_MBUF_REFCNT */\n+\n+/**\n+ * Get the headroom in a packet mbuf.\n+ *\n+ * @param m\n+ *   The packet mbuf.\n+ * @return\n+ *   The length of the headroom.\n+ */\n+static inline uint16_t rte_pktmbuf_headroom(const struct rte_mbuf *m)\n+{\n+\t__rte_mbuf_sanity_check(m, 1);\n+\treturn m->data_off;\n+}\n+\n+/**\n+ * Get the tailroom of a packet mbuf.\n+ *\n+ * @param m\n+ *   The packet mbuf.\n+ * @return\n+ *   The length of the tailroom.\n+ */\n+static inline uint16_t rte_pktmbuf_tailroom(const struct rte_mbuf *m)\n+{\n+\t__rte_mbuf_sanity_check(m, 1);\n+\treturn (uint16_t)(m->buf_len - rte_pktmbuf_headroom(m) -\n+\t\t\t  m->data_len);\n+}\n+\n+/**\n+ * Get the last segment of the packet.\n+ *\n+ * @param m\n+ *   The packet mbuf.\n+ * @return\n+ *   The last segment of the given mbuf.\n+ */\n+static inline struct rte_mbuf *rte_pktmbuf_lastseg(struct rte_mbuf *m)\n+{\n+\tstruct rte_mbuf *m2 = (struct rte_mbuf *)m;\n+\n+\t__rte_mbuf_sanity_check(m, 1);\n+\twhile (m2->next != NULL)\n+\t\tm2 = m2->next;\n+\treturn m2;\n+}\n+\n+/**\n+ * A macro that points to the start of the data in the mbuf.\n+ *\n+ * The returned pointer is cast to type t. Before using this\n+ * function, the user must ensure that m_headlen(m) is large enough to\n+ * read its data.\n+ *\n+ * @param m\n+ *   The packet mbuf.\n+ * @param t\n+ *   The type to cast the result into.\n+ */\n+#define rte_pktmbuf_mtod(m, t) ((t)((char *)(m)->buf_addr + (m)->data_off))\n+\n+/**\n+ * A macro that returns the length of the packet.\n+ *\n+ * The value can be read or assigned.\n+ *\n+ * @param m\n+ *   The packet mbuf.\n+ */\n+#define rte_pktmbuf_pkt_len(m) ((m)->pkt_len)\n+\n+/**\n+ * A macro that returns the length of the segment.\n+ *\n+ * The value can be read or assigned.\n+ *\n+ * @param m\n+ *   The packet mbuf.\n+ */\n+#define rte_pktmbuf_data_len(m) ((m)->data_len)\n+\n+/**\n+ * Prepend len bytes to an mbuf data area.\n+ *\n+ * Returns a pointer to the new\n+ * data start address. If there is not enough headroom in the first\n+ * segment, the function will return NULL, without modifying the mbuf.\n+ *\n+ * @param m\n+ *   The pkt mbuf.\n+ * @param len\n+ *   The amount of data to prepend (in bytes).\n+ * @return\n+ *   A pointer to the start of the newly prepended data, or\n+ *   NULL if there is not enough headroom space in the first segment\n+ */\n+static inline char *rte_pktmbuf_prepend(struct rte_mbuf *m,\n+\t\t\t\t\tuint16_t len)\n+{\n+\t__rte_mbuf_sanity_check(m, 1);\n+\n+\tif (unlikely(len > rte_pktmbuf_headroom(m)))\n+\t\treturn NULL;\n+\n+\tm->data_off -= len;\n+\tm->data_len = (uint16_t)(m->data_len + len);\n+\tm->pkt_len  = (m->pkt_len + len);\n+\n+\treturn (char *)m->buf_addr + m->data_off;\n+}\n+\n+/**\n+ * Append len bytes to an mbuf.\n+ *\n+ * Append len bytes to an mbuf and return a pointer to the start address\n+ * of the added data. If there is not enough tailroom in the last\n+ * segment, the function will return NULL, without modifying the mbuf.\n+ *\n+ * @param m\n+ *   The packet mbuf.\n+ * @param len\n+ *   The amount of data to append (in bytes).\n+ * @return\n+ *   A pointer to the start of the newly appended data, or\n+ *   NULL if there is not enough tailroom space in the last segment\n+ */\n+static inline char *rte_pktmbuf_append(struct rte_mbuf *m, uint16_t len)\n+{\n+\tvoid *tail;\n+\tstruct rte_mbuf *m_last;\n+\n+\t__rte_mbuf_sanity_check(m, 1);\n+\n+\tm_last = rte_pktmbuf_lastseg(m);\n+\tif (unlikely(len > rte_pktmbuf_tailroom(m_last)))\n+\t\treturn NULL;\n+\n+\ttail = (char *)m_last->buf_addr + m_last->data_off + m_last->data_len;\n+\tm_last->data_len = (uint16_t)(m_last->data_len + len);\n+\tm->pkt_len  = (m->pkt_len + len);\n+\treturn (char*) tail;\n+}\n+\n+/**\n+ * Remove len bytes at the beginning of an mbuf.\n+ *\n+ * Returns a pointer to the start address of the new data area. If the\n+ * length is greater than the length of the first segment, then the\n+ * function will fail and return NULL, without modifying the mbuf.\n+ *\n+ * @param m\n+ *   The packet mbuf.\n+ * @param len\n+ *   The amount of data to remove (in bytes).\n+ * @return\n+ *   A pointer to the new start of the data.\n+ */\n+static inline char *rte_pktmbuf_adj(struct rte_mbuf *m, uint16_t len)\n+{\n+\t__rte_mbuf_sanity_check(m, 1);\n+\n+\tif (unlikely(len > m->data_len))\n+\t\treturn NULL;\n+\n+\tm->data_len = (uint16_t)(m->data_len - len);\n+\tm->data_off += len;\n+\tm->pkt_len  = (m->pkt_len - len);\n+\treturn (char *)m->buf_addr + m->data_off;\n+}\n+\n+/**\n+ * Remove len bytes of data at the end of the mbuf.\n+ *\n+ * If the length is greater than the length of the last segment, the\n+ * function will fail and return -1 without modifying the mbuf.\n+ *\n+ * @param m\n+ *   The packet mbuf.\n+ * @param len\n+ *   The amount of data to remove (in bytes).\n+ * @return\n+ *   - 0: On success.\n+ *   - -1: On error.\n+ */\n+static inline int rte_pktmbuf_trim(struct rte_mbuf *m, uint16_t len)\n+{\n+\tstruct rte_mbuf *m_last;\n+\n+\t__rte_mbuf_sanity_check(m, 1);\n+\n+\tm_last = rte_pktmbuf_lastseg(m);\n+\tif (unlikely(len > m_last->data_len))\n+\t\treturn -1;\n+\n+\tm_last->data_len = (uint16_t)(m_last->data_len - len);\n+\tm->pkt_len  = (m->pkt_len - len);\n+\treturn 0;\n+}\n+\n+/**\n+ * Test if mbuf data is contiguous.\n+ *\n+ * @param m\n+ *   The packet mbuf.\n+ * @return\n+ *   - 1, if all data is contiguous (one segment).\n+ *   - 0, if there is several segments.\n+ */\n+static inline int rte_pktmbuf_is_contiguous(const struct rte_mbuf *m)\n+{\n+\t__rte_mbuf_sanity_check(m, 1);\n+\treturn !!(m->nb_segs == 1);\n+}\n+\n+/**\n+ * Dump an mbuf structure to the console.\n+ *\n+ * Dump all fields for the given packet mbuf and all its associated\n+ * segments (in the case of a chained buffer).\n+ *\n+ * @param f\n+ *   A pointer to a file for output\n+ * @param m\n+ *   The packet mbuf.\n+ * @param dump_len\n+ *   If dump_len != 0, also dump the \"dump_len\" first data bytes of\n+ *   the packet.\n+ */\n+void rte_pktmbuf_dump(FILE *f, const struct rte_mbuf *m, unsigned dump_len);\n+\n+#ifdef __cplusplus\n+}\n+#endif\n+\n+#endif /* _RTE_MBUF_H_ */\ndiff --git a/lib/librte_mbuf/Makefile b/lib/librte_mbuf/Makefile\ndeleted file mode 100644\nindex 9b45ba4..0000000\n--- a/lib/librte_mbuf/Makefile\n+++ /dev/null\n@@ -1,48 +0,0 @@\n-#   BSD LICENSE\n-#\n-#   Copyright(c) 2010-2014 Intel Corporation. All rights reserved.\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-include $(RTE_SDK)/mk/rte.vars.mk\n-\n-# library name\n-LIB = librte_mbuf.a\n-\n-CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR) -O3\n-\n-# all source are stored in SRCS-y\n-SRCS-$(CONFIG_RTE_LIBRTE_MBUF) := rte_mbuf.c\n-\n-# install includes\n-SYMLINK-$(CONFIG_RTE_LIBRTE_MBUF)-include := rte_mbuf.h\n-\n-# this lib needs eal\n-DEPDIRS-$(CONFIG_RTE_LIBRTE_MBUF) += lib/librte_eal lib/librte_mempool\n-\n-include $(RTE_SDK)/mk/rte.lib.mk\ndiff --git a/lib/librte_mbuf/rte_mbuf.c b/lib/librte_mbuf/rte_mbuf.c\ndeleted file mode 100644\nindex 1b14e02..0000000\n--- a/lib/librte_mbuf/rte_mbuf.c\n+++ /dev/null\n@@ -1,252 +0,0 @@\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-#include <string.h>\n-#include <stdio.h>\n-#include <stdlib.h>\n-#include <stdint.h>\n-#include <stdarg.h>\n-#include <inttypes.h>\n-#include <errno.h>\n-#include <ctype.h>\n-#include <sys/queue.h>\n-\n-#include <rte_debug.h>\n-#include <rte_common.h>\n-#include <rte_log.h>\n-#include <rte_memory.h>\n-#include <rte_memzone.h>\n-#include <rte_launch.h>\n-#include <rte_tailq.h>\n-#include <rte_eal.h>\n-#include <rte_per_lcore.h>\n-#include <rte_lcore.h>\n-#include <rte_atomic.h>\n-#include <rte_branch_prediction.h>\n-#include <rte_ring.h>\n-#include <rte_mempool.h>\n-#include <rte_mbuf.h>\n-#include <rte_string_fns.h>\n-#include <rte_hexdump.h>\n-\n-/*\n- * ctrlmbuf constructor, given as a callback function to\n- * rte_mempool_create()\n- */\n-void\n-rte_ctrlmbuf_init(struct rte_mempool *mp,\n-\t\t__attribute__((unused)) void *opaque_arg,\n-\t\tvoid *_m,\n-\t\t__attribute__((unused)) unsigned i)\n-{\n-\tstruct rte_mbuf *m = _m;\n-\trte_pktmbuf_init(mp, opaque_arg, _m, i);\n-\tm->ol_flags |= CTRL_MBUF_FLAG;\n-}\n-\n-/*\n- * pktmbuf pool constructor, given as a callback function to\n- * rte_mempool_create()\n- */\n-void\n-rte_pktmbuf_pool_init(struct rte_mempool *mp, void *opaque_arg)\n-{\n-\tstruct rte_pktmbuf_pool_private *mbp_priv;\n-\tuint16_t roomsz;\n-\n-\tmbp_priv = rte_mempool_get_priv(mp);\n-\troomsz = (uint16_t)(uintptr_t)opaque_arg;\n-\n-\t/* Use default data room size. */\n-\tif (0 == roomsz)\n-\t\troomsz = 2048 + RTE_PKTMBUF_HEADROOM;\n-\n-\tmbp_priv->mbuf_data_room_size = roomsz;\n-}\n-\n-/*\n- * pktmbuf constructor, given as a callback function to\n- * rte_mempool_create().\n- * Set the fields of a packet mbuf to their default values.\n- */\n-void\n-rte_pktmbuf_init(struct rte_mempool *mp,\n-\t\t __attribute__((unused)) void *opaque_arg,\n-\t\t void *_m,\n-\t\t __attribute__((unused)) unsigned i)\n-{\n-\tstruct rte_mbuf *m = _m;\n-\tuint32_t buf_len = mp->elt_size - sizeof(struct rte_mbuf);\n-\n-\tRTE_MBUF_ASSERT(mp->elt_size >= sizeof(struct rte_mbuf));\n-\n-\tmemset(m, 0, mp->elt_size);\n-\n-\t/* start of buffer is just after mbuf structure */\n-\tm->buf_addr = (char *)m + sizeof(struct rte_mbuf);\n-\tm->buf_physaddr = rte_mempool_virt2phy(mp, m) +\n-\t\t\tsizeof(struct rte_mbuf);\n-\tm->buf_len = (uint16_t)buf_len;\n-\n-\t/* keep some headroom between start of buffer and data */\n-\tm->data_off = RTE_MIN(RTE_PKTMBUF_HEADROOM, (uint16_t)m->buf_len);\n-\n-\t/* init some constant fields */\n-\tm->pool = mp;\n-\tm->nb_segs = 1;\n-\tm->port = 0xff;\n-}\n-\n-/* do some sanity checks on a mbuf: panic if it fails */\n-void\n-rte_mbuf_sanity_check(const struct rte_mbuf *m, int is_header)\n-{\n-\tconst struct rte_mbuf *m_seg;\n-\tunsigned nb_segs;\n-\n-\tif (m == NULL)\n-\t\trte_panic(\"mbuf is NULL\\n\");\n-\n-\t/* generic checks */\n-\tif (m->pool == NULL)\n-\t\trte_panic(\"bad mbuf pool\\n\");\n-\tif (m->buf_physaddr == 0)\n-\t\trte_panic(\"bad phys addr\\n\");\n-\tif (m->buf_addr == NULL)\n-\t\trte_panic(\"bad virt addr\\n\");\n-\n-#ifdef RTE_MBUF_REFCNT\n-\tuint16_t cnt = rte_mbuf_refcnt_read(m);\n-\tif ((cnt == 0) || (cnt == UINT16_MAX))\n-\t\trte_panic(\"bad ref cnt\\n\");\n-#endif\n-\n-\t/* nothing to check for sub-segments */\n-\tif (is_header == 0)\n-\t\treturn;\n-\n-\tnb_segs = m->nb_segs;\n-\tm_seg = m;\n-\twhile (m_seg && nb_segs != 0) {\n-\t\tm_seg = m_seg->next;\n-\t\tnb_segs--;\n-\t}\n-\tif (nb_segs != 0)\n-\t\trte_panic(\"bad nb_segs\\n\");\n-}\n-\n-/* dump a mbuf on console */\n-void\n-rte_pktmbuf_dump(FILE *f, const struct rte_mbuf *m, unsigned dump_len)\n-{\n-\tunsigned int len;\n-\tunsigned nb_segs;\n-\n-\t__rte_mbuf_sanity_check(m, 1);\n-\n-\tfprintf(f, \"dump mbuf at 0x%p, phys=%\"PRIx64\", buf_len=%u\\n\",\n-\t       m, (uint64_t)m->buf_physaddr, (unsigned)m->buf_len);\n-\tfprintf(f, \"  pkt_len=%\"PRIu32\", ol_flags=%\"PRIx64\", nb_segs=%u, \"\n-\t       \"in_port=%u\\n\", m->pkt_len, m->ol_flags,\n-\t       (unsigned)m->nb_segs, (unsigned)m->port);\n-\tnb_segs = m->nb_segs;\n-\n-\twhile (m && nb_segs != 0) {\n-\t\t__rte_mbuf_sanity_check(m, 0);\n-\n-\t\tfprintf(f, \"  segment at 0x%p, data=0x%p, data_len=%u\\n\",\n-\t\t\tm, rte_pktmbuf_mtod(m, void *), (unsigned)m->data_len);\n-\t\tlen = dump_len;\n-\t\tif (len > m->data_len)\n-\t\t\tlen = m->data_len;\n-\t\tif (len != 0)\n-\t\t\trte_hexdump(f, NULL, rte_pktmbuf_mtod(m, void *), len);\n-\t\tdump_len -= len;\n-\t\tm = m->next;\n-\t\tnb_segs --;\n-\t}\n-}\n-\n-/*\n- * Get the name of a RX offload flag. Must be kept synchronized with flag\n- * definitions in rte_mbuf.h.\n- */\n-const char *rte_get_rx_ol_flag_name(uint64_t mask)\n-{\n-\tswitch (mask) {\n-\tcase PKT_RX_VLAN_PKT: return \"PKT_RX_VLAN_PKT\";\n-\tcase PKT_RX_RSS_HASH: return \"PKT_RX_RSS_HASH\";\n-\tcase PKT_RX_FDIR: return \"PKT_RX_FDIR\";\n-\tcase PKT_RX_L4_CKSUM_BAD: return \"PKT_RX_L4_CKSUM_BAD\";\n-\tcase PKT_RX_IP_CKSUM_BAD: return \"PKT_RX_IP_CKSUM_BAD\";\n-\t/* case PKT_RX_EIP_CKSUM_BAD: return \"PKT_RX_EIP_CKSUM_BAD\"; */\n-\t/* case PKT_RX_OVERSIZE: return \"PKT_RX_OVERSIZE\"; */\n-\t/* case PKT_RX_HBUF_OVERFLOW: return \"PKT_RX_HBUF_OVERFLOW\"; */\n-\t/* case PKT_RX_RECIP_ERR: return \"PKT_RX_RECIP_ERR\"; */\n-\t/* case PKT_RX_MAC_ERR: return \"PKT_RX_MAC_ERR\"; */\n-\tcase PKT_RX_IPV4_HDR: return \"PKT_RX_IPV4_HDR\";\n-\tcase PKT_RX_IPV4_HDR_EXT: return \"PKT_RX_IPV4_HDR_EXT\";\n-\tcase PKT_RX_IPV6_HDR: return \"PKT_RX_IPV6_HDR\";\n-\tcase PKT_RX_IPV6_HDR_EXT: return \"PKT_RX_IPV6_HDR_EXT\";\n-\tcase PKT_RX_IEEE1588_PTP: return \"PKT_RX_IEEE1588_PTP\";\n-\tcase PKT_RX_IEEE1588_TMST: return \"PKT_RX_IEEE1588_TMST\";\n-\tcase PKT_RX_TUNNEL_IPV4_HDR: return \"PKT_RX_TUNNEL_IPV4_HDR\";\n-\tcase PKT_RX_TUNNEL_IPV6_HDR: return \"PKT_RX_TUNNEL_IPV6_HDR\";\n-\tdefault: return NULL;\n-\t}\n-}\n-\n-/*\n- * Get the name of a TX offload flag. Must be kept synchronized with flag\n- * definitions in rte_mbuf.h.\n- */\n-const char *rte_get_tx_ol_flag_name(uint64_t mask)\n-{\n-\tswitch (mask) {\n-\tcase PKT_TX_VLAN_PKT: return \"PKT_TX_VLAN_PKT\";\n-\tcase PKT_TX_IP_CKSUM: return \"PKT_TX_IP_CKSUM\";\n-\tcase PKT_TX_TCP_CKSUM: return \"PKT_TX_TCP_CKSUM\";\n-\tcase PKT_TX_SCTP_CKSUM: return \"PKT_TX_SCTP_CKSUM\";\n-\tcase PKT_TX_UDP_CKSUM: return \"PKT_TX_UDP_CKSUM\";\n-\tcase PKT_TX_IEEE1588_TMST: return \"PKT_TX_IEEE1588_TMST\";\n-\tcase PKT_TX_UDP_TUNNEL_PKT: return \"PKT_TX_UDP_TUNNEL_PKT\";\n-\tcase PKT_TX_TCP_SEG: return \"PKT_TX_TCP_SEG\";\n-\tcase PKT_TX_IPV4: return \"PKT_TX_IPV4\";\n-\tcase PKT_TX_IPV6: return \"PKT_TX_IPV6\";\n-\tcase PKT_TX_OUTER_IP_CKSUM: return \"PKT_TX_OUTER_IP_CKSUM\";\n-\tcase PKT_TX_OUTER_IPV4: return \"PKT_TX_OUTER_IPV4\";\n-\tcase PKT_TX_OUTER_IPV6: return \"PKT_TX_OUTER_IPV6\";\n-\tdefault: return NULL;\n-\t}\n-}\ndiff --git a/lib/librte_mbuf/rte_mbuf.h b/lib/librte_mbuf/rte_mbuf.h\ndeleted file mode 100644\nindex 16059c6..0000000\n--- a/lib/librte_mbuf/rte_mbuf.h\n+++ /dev/null\n@@ -1,1133 +0,0 @@\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_H_\n-#define _RTE_MBUF_H_\n-\n-/**\n- * @file\n- * RTE Mbuf\n- *\n- * The mbuf library provides the ability to create and destroy buffers\n- * that may be used by the RTE application to store message\n- * buffers. The message buffers are stored in a mempool, using the\n- * RTE mempool library.\n- *\n- * This library provide an API to allocate/free packet mbufs, which are\n- * used to carry network packets.\n- *\n- * To understand the concepts of packet buffers or mbufs, you\n- * should read \"TCP/IP Illustrated, Volume 2: The Implementation,\n- * Addison-Wesley, 1995, ISBN 0-201-63354-X from Richard Stevens\"\n- * http://www.kohala.com/start/tcpipiv2.html\n- */\n-\n-#include <stdint.h>\n-#include <rte_mempool.h>\n-#include <rte_memory.h>\n-#include <rte_atomic.h>\n-#include <rte_prefetch.h>\n-#include <rte_branch_prediction.h>\n-\n-#ifdef __cplusplus\n-extern \"C\" {\n-#endif\n-\n-/* deprecated feature, renamed in RTE_MBUF_REFCNT */\n-#pragma GCC poison RTE_MBUF_SCATTER_GATHER\n-\n-/*\n- * Packet Offload Features Flags. It also carry packet type information.\n- * Critical resources. Both rx/tx shared these bits. Be cautious on any change\n- *\n- * - RX flags start at bit position zero, and get added to the left of previous\n- *   flags.\n- * - The most-significant 8 bits are reserved for generic mbuf flags\n- * - TX flags therefore start at bit position 55 (i.e. 63-8), and new flags get\n- *   added to the right of the previously defined flags\n- *\n- * Keep these flags synchronized with rte_get_rx_ol_flag_name() and\n- * rte_get_tx_ol_flag_name().\n- */\n-#define PKT_RX_VLAN_PKT      (1ULL << 0)  /**< RX packet is a 802.1q VLAN packet. */\n-#define PKT_RX_RSS_HASH      (1ULL << 1)  /**< RX packet with RSS hash result. */\n-#define PKT_RX_FDIR          (1ULL << 2)  /**< RX packet with FDIR match indicate. */\n-#define PKT_RX_L4_CKSUM_BAD  (1ULL << 3)  /**< L4 cksum of RX pkt. is not OK. */\n-#define PKT_RX_IP_CKSUM_BAD  (1ULL << 4)  /**< IP cksum of RX pkt. is not OK. */\n-#define PKT_RX_EIP_CKSUM_BAD (0ULL << 0)  /**< External IP header checksum error. */\n-#define PKT_RX_OVERSIZE      (0ULL << 0)  /**< Num of desc of an RX pkt oversize. */\n-#define PKT_RX_HBUF_OVERFLOW (0ULL << 0)  /**< Header buffer overflow. */\n-#define PKT_RX_RECIP_ERR     (0ULL << 0)  /**< Hardware processing error. */\n-#define PKT_RX_MAC_ERR       (0ULL << 0)  /**< MAC error. */\n-#define PKT_RX_IPV4_HDR      (1ULL << 5)  /**< RX packet with IPv4 header. */\n-#define PKT_RX_IPV4_HDR_EXT  (1ULL << 6)  /**< RX packet with extended IPv4 header. */\n-#define PKT_RX_IPV6_HDR      (1ULL << 7)  /**< RX packet with IPv6 header. */\n-#define PKT_RX_IPV6_HDR_EXT  (1ULL << 8)  /**< RX packet with extended IPv6 header. */\n-#define PKT_RX_IEEE1588_PTP  (1ULL << 9)  /**< RX IEEE1588 L2 Ethernet PT Packet. */\n-#define PKT_RX_IEEE1588_TMST (1ULL << 10) /**< RX IEEE1588 L2/L4 timestamped packet.*/\n-#define PKT_RX_TUNNEL_IPV4_HDR (1ULL << 11) /**< RX tunnel packet with IPv4 header.*/\n-#define PKT_RX_TUNNEL_IPV6_HDR (1ULL << 12) /**< RX tunnel packet with IPv6 header. */\n-#define PKT_RX_FDIR_ID       (1ULL << 13) /**< FD id reported if FDIR match. */\n-#define PKT_RX_FDIR_FLX      (1ULL << 14) /**< Flexible bytes reported if FDIR match. */\n-/* add new RX flags here */\n-\n-/* add new TX flags here */\n-\n-/**\n- * TCP segmentation offload. To enable this offload feature for a\n- * packet to be transmitted on hardware supporting TSO:\n- *  - set the PKT_TX_TCP_SEG flag in mbuf->ol_flags (this flag implies\n- *    PKT_TX_TCP_CKSUM)\n- *  - set the flag PKT_TX_IPV4 or PKT_TX_IPV6\n- *  - if it's IPv4, set the PKT_TX_IP_CKSUM flag and write the IP checksum\n- *    to 0 in the packet\n- *  - fill the mbuf offload information: l2_len, l3_len, l4_len, tso_segsz\n- *  - calculate the pseudo header checksum without taking ip_len in account,\n- *    and set it in the TCP header. Refer to rte_ipv4_phdr_cksum() and\n- *    rte_ipv6_phdr_cksum() that can be used as helpers.\n- */\n-#define PKT_TX_TCP_SEG       (1ULL << 49)\n-\n-/** TX packet is an UDP tunneled packet. It must be specified when using\n- *  outer checksum offload (PKT_TX_OUTER_IP_CKSUM) */\n-#define PKT_TX_UDP_TUNNEL_PKT (1ULL << 50) /**< TX packet is an UDP tunneled packet */\n-#define PKT_TX_IEEE1588_TMST (1ULL << 51) /**< TX IEEE1588 packet to timestamp. */\n-\n-/**\n- * Bits 52+53 used for L4 packet type with checksum enabled: 00: Reserved,\n- * 01: TCP checksum, 10: SCTP checksum, 11: UDP checksum. To use hardware\n- * L4 checksum offload, the user needs to:\n- *  - fill l2_len and l3_len in mbuf\n- *  - set the flags PKT_TX_TCP_CKSUM, PKT_TX_SCTP_CKSUM or PKT_TX_UDP_CKSUM\n- *  - set the flag PKT_TX_IPV4 or PKT_TX_IPV6\n- *  - calculate the pseudo header checksum and set it in the L4 header (only\n- *    for TCP or UDP). See rte_ipv4_phdr_cksum() and rte_ipv6_phdr_cksum().\n- *    For SCTP, set the crc field to 0.\n- */\n-#define PKT_TX_L4_NO_CKSUM   (0ULL << 52) /**< Disable L4 cksum of TX pkt. */\n-#define PKT_TX_TCP_CKSUM     (1ULL << 52) /**< TCP cksum of TX pkt. computed by NIC. */\n-#define PKT_TX_SCTP_CKSUM    (2ULL << 52) /**< SCTP cksum of TX pkt. computed by NIC. */\n-#define PKT_TX_UDP_CKSUM     (3ULL << 52) /**< UDP cksum of TX pkt. computed by NIC. */\n-#define PKT_TX_L4_MASK       (3ULL << 52) /**< Mask for L4 cksum offload request. */\n-\n-#define PKT_TX_IP_CKSUM      (1ULL << 54) /**< IP cksum of TX pkt. computed by NIC. */\n-#define PKT_TX_IPV4_CSUM     PKT_TX_IP_CKSUM /**< Alias of PKT_TX_IP_CKSUM. */\n-\n-/** Packet is IPv4 without requiring IP checksum offload. */\n-#define PKT_TX_IPV4          (1ULL << 55)\n-\n-/** Tell the NIC it's an IPv6 packet.*/\n-#define PKT_TX_IPV6          (1ULL << 56)\n-\n-#define PKT_TX_VLAN_PKT      (1ULL << 57) /**< TX packet is a 802.1q VLAN packet. */\n-\n-/** Outer IP checksum of TX packet, computed by NIC for tunneling packet.\n- *  The tunnel type must also be specified, ex: PKT_TX_UDP_TUNNEL_PKT. */\n-#define PKT_TX_OUTER_IP_CKSUM   (1ULL << 58)\n-\n-/** Packet is outer IPv4 without requiring IP checksum offload for tunneling packet. */\n-#define PKT_TX_OUTER_IPV4   (1ULL << 59)\n-\n-/** Tell the NIC it's an outer IPv6 packet for tunneling packet */\n-#define PKT_TX_OUTER_IPV6    (1ULL << 60)\n-\n-/* Use final bit of flags to indicate a control mbuf */\n-#define CTRL_MBUF_FLAG       (1ULL << 63) /**< Mbuf contains control data */\n-\n-/**\n- * Get the name of a RX offload flag\n- *\n- * @param mask\n- *   The mask describing the flag.\n- * @return\n- *   The name of this flag, or NULL if it's not a valid RX flag.\n- */\n-const char *rte_get_rx_ol_flag_name(uint64_t mask);\n-\n-/**\n- * Get the name of a TX offload flag\n- *\n- * @param mask\n- *   The mask describing the flag. Usually only one bit must be set.\n- *   Several bits can be given if they belong to the same mask.\n- *   Ex: PKT_TX_L4_MASK.\n- * @return\n- *   The name of this flag, or NULL if it's not a valid TX flag.\n- */\n-const char *rte_get_tx_ol_flag_name(uint64_t mask);\n-\n-/* define a set of marker types that can be used to refer to set points in the\n- * mbuf */\n-typedef void    *MARKER[0];   /**< generic marker for a point in a structure */\n-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-/**\n- * The generic rte_mbuf, containing a packet mbuf.\n- */\n-struct rte_mbuf {\n-\tMARKER cacheline0;\n-\n-\tvoid *buf_addr;           /**< Virtual address of segment buffer. */\n-\tphys_addr_t buf_physaddr; /**< Physical address of segment buffer. */\n-\n-\tuint16_t buf_len;         /**< Length of segment buffer. */\n-\n-\t/* next 6 bytes are initialised on RX descriptor rearm */\n-\tMARKER8 rearm_data;\n-\tuint16_t data_off;\n-\n-\t/**\n-\t * 16-bit Reference counter.\n-\t * It should only be accessed using the following functions:\n-\t * rte_mbuf_refcnt_update(), rte_mbuf_refcnt_read(), and\n-\t * rte_mbuf_refcnt_set(). The functionality of these functions (atomic,\n-\t * or non-atomic) is controlled by the CONFIG_RTE_MBUF_REFCNT_ATOMIC\n-\t * config option.\n-\t */\n-\tunion {\n-#ifdef RTE_MBUF_REFCNT\n-\t\trte_atomic16_t refcnt_atomic; /**< Atomically accessed refcnt */\n-\t\tuint16_t refcnt;              /**< Non-atomically accessed refcnt */\n-#endif\n-\t\tuint16_t refcnt_reserved;     /**< Do not use this field */\n-\t};\n-\tuint8_t nb_segs;          /**< Number of segments. */\n-\tuint8_t port;             /**< Input port. */\n-\n-\tuint64_t ol_flags;        /**< Offload features. */\n-\n-\t/* remaining bytes are set on RX when pulling packet from descriptor */\n-\tMARKER rx_descriptor_fields1;\n-\n-\t/**\n-\t * The packet type, which is used to indicate ordinary packet and also\n-\t * tunneled packet format, i.e. each number is represented a type of\n-\t * packet.\n-\t */\n-\tuint16_t packet_type;\n-\n-\tuint16_t data_len;        /**< Amount of data in segment buffer. */\n-\tuint32_t pkt_len;         /**< Total pkt len: sum of all segments. */\n-\tuint16_t vlan_tci;        /**< VLAN Tag Control Identifier (CPU order) */\n-\tuint16_t reserved;\n-\tunion {\n-\t\tuint32_t rss;     /**< RSS hash result if RSS enabled */\n-\t\tstruct {\n-\t\t\tunion {\n-\t\t\t\tstruct {\n-\t\t\t\t\tuint16_t hash;\n-\t\t\t\t\tuint16_t id;\n-\t\t\t\t};\n-\t\t\t\tuint32_t lo;\n-\t\t\t\t/**< Second 4 flexible bytes */\n-\t\t\t};\n-\t\t\tuint32_t hi;\n-\t\t\t/**< First 4 flexible bytes or FD ID, dependent on\n-\t\t\t     PKT_RX_FDIR_* flag in ol_flags. */\n-\t\t} fdir;           /**< Filter identifier if FDIR enabled */\n-\t\tuint32_t sched;   /**< Hierarchical scheduler */\n-\t\tuint32_t usr;\t  /**< User defined tags. See @rte_distributor_process */\n-\t} hash;                   /**< hash information */\n-\n-\t/* second cache line - fields only used in slow path or on TX */\n-\tMARKER cacheline1 __rte_cache_aligned;\n-\n-\tunion {\n-\t\tvoid *userdata;   /**< Can be used for external metadata */\n-\t\tuint64_t udata64; /**< Allow 8-byte userdata on 32-bit */\n-\t};\n-\n-\tstruct rte_mempool *pool; /**< Pool from which mbuf was allocated. */\n-\tstruct rte_mbuf *next;    /**< Next segment of scattered packet. */\n-\n-\t/* fields to support TX offloads */\n-\tunion {\n-\t\tuint64_t tx_offload;       /**< combined for easy fetch */\n-\t\tstruct {\n-\t\t\tuint64_t l2_len:7; /**< L2 (MAC) Header Length. */\n-\t\t\tuint64_t l3_len:9; /**< L3 (IP) Header Length. */\n-\t\t\tuint64_t l4_len:8; /**< L4 (TCP/UDP) Header Length. */\n-\t\t\tuint64_t tso_segsz:16; /**< TCP TSO segment size */\n-\n-\t\t\t/* fields for TX offloading of tunnels */\n-\t\t\tuint64_t outer_l3_len:9; /**< Outer L3 (IP) Hdr Length. */\n-\t\t\tuint64_t outer_l2_len:7; /**< Outer L2 (MAC) Hdr Length. */\n-\n-\t\t\t/* uint64_t unused:8; */\n-\t\t};\n-\t};\n-} __rte_cache_aligned;\n-\n-/**\n- * Given the buf_addr returns the pointer to corresponding mbuf.\n- */\n-#define RTE_MBUF_FROM_BADDR(ba)     (((struct rte_mbuf *)(ba)) - 1)\n-\n-/**\n- * Given the pointer to mbuf returns an address where it's  buf_addr\n- * should point to.\n- */\n-#define RTE_MBUF_TO_BADDR(mb)       (((struct rte_mbuf *)(mb)) + 1)\n-\n-/**\n- * Returns TRUE if given mbuf is indirect, or FALSE otherwise.\n- */\n-#define RTE_MBUF_INDIRECT(mb)   (RTE_MBUF_FROM_BADDR((mb)->buf_addr) != (mb))\n-\n-/**\n- * Returns TRUE if given mbuf is direct, or FALSE otherwise.\n- */\n-#define RTE_MBUF_DIRECT(mb)     (RTE_MBUF_FROM_BADDR((mb)->buf_addr) == (mb))\n-\n-\n-/**\n- * Private data in case of pktmbuf pool.\n- *\n- * A structure that contains some pktmbuf_pool-specific data that are\n- * appended after the mempool structure (in private data).\n- */\n-struct rte_pktmbuf_pool_private {\n-\tuint16_t mbuf_data_room_size; /**< Size of data space in each mbuf.*/\n-};\n-\n-#ifdef RTE_LIBRTE_MBUF_DEBUG\n-\n-/**  check mbuf type in debug mode */\n-#define __rte_mbuf_sanity_check(m, is_h) rte_mbuf_sanity_check(m, is_h)\n-\n-/**  check mbuf type in debug mode if mbuf pointer is not null */\n-#define __rte_mbuf_sanity_check_raw(m, is_h)\tdo {       \\\n-\tif ((m) != NULL)                                   \\\n-\t\trte_mbuf_sanity_check(m, is_h);          \\\n-} while (0)\n-\n-/**  MBUF asserts in debug mode */\n-#define RTE_MBUF_ASSERT(exp)                                         \\\n-if (!(exp)) {                                                        \\\n-\trte_panic(\"line%d\\tassert \\\"\" #exp \"\\\" failed\\n\", __LINE__); \\\n-}\n-\n-#else /*  RTE_LIBRTE_MBUF_DEBUG */\n-\n-/**  check mbuf type in debug mode */\n-#define __rte_mbuf_sanity_check(m, is_h) do { } while (0)\n-\n-/**  check mbuf type in debug mode if mbuf pointer is not null */\n-#define __rte_mbuf_sanity_check_raw(m, is_h) do { } while (0)\n-\n-/**  MBUF asserts in debug mode */\n-#define RTE_MBUF_ASSERT(exp)                do { } while (0)\n-\n-#endif /*  RTE_LIBRTE_MBUF_DEBUG */\n-\n-#ifdef RTE_MBUF_REFCNT\n-#ifdef RTE_MBUF_REFCNT_ATOMIC\n-\n-/**\n- * Adds given value to an mbuf's refcnt and returns its new value.\n- * @param m\n- *   Mbuf to update\n- * @param value\n- *   Value to add/subtract\n- * @return\n- *   Updated value\n- */\n-static inline uint16_t\n-rte_mbuf_refcnt_update(struct rte_mbuf *m, int16_t value)\n-{\n-\treturn (uint16_t)(rte_atomic16_add_return(&m->refcnt_atomic, value));\n-}\n-\n-/**\n- * Reads the value of an mbuf's refcnt.\n- * @param m\n- *   Mbuf to read\n- * @return\n- *   Reference count number.\n- */\n-static inline uint16_t\n-rte_mbuf_refcnt_read(const struct rte_mbuf *m)\n-{\n-\treturn (uint16_t)(rte_atomic16_read(&m->refcnt_atomic));\n-}\n-\n-/**\n- * Sets an mbuf's refcnt to a defined value.\n- * @param m\n- *   Mbuf to update\n- * @param new_value\n- *   Value set\n- */\n-static inline void\n-rte_mbuf_refcnt_set(struct rte_mbuf *m, uint16_t new_value)\n-{\n-\trte_atomic16_set(&m->refcnt_atomic, new_value);\n-}\n-\n-#else /* ! RTE_MBUF_REFCNT_ATOMIC */\n-\n-/**\n- * Adds given value to an mbuf's refcnt and returns its new value.\n- */\n-static inline uint16_t\n-rte_mbuf_refcnt_update(struct rte_mbuf *m, int16_t value)\n-{\n-\tm->refcnt = (uint16_t)(m->refcnt + value);\n-\treturn m->refcnt;\n-}\n-\n-/**\n- * Reads the value of an mbuf's refcnt.\n- */\n-static inline uint16_t\n-rte_mbuf_refcnt_read(const struct rte_mbuf *m)\n-{\n-\treturn m->refcnt;\n-}\n-\n-/**\n- * Sets an mbuf's refcnt to the defined value.\n- */\n-static inline void\n-rte_mbuf_refcnt_set(struct rte_mbuf *m, uint16_t new_value)\n-{\n-\tm->refcnt = new_value;\n-}\n-\n-#endif /* RTE_MBUF_REFCNT_ATOMIC */\n-\n-/** Mbuf prefetch */\n-#define RTE_MBUF_PREFETCH_TO_FREE(m) do {       \\\n-\tif ((m) != NULL)                        \\\n-\t\trte_prefetch0(m);               \\\n-} while (0)\n-\n-#else /* ! RTE_MBUF_REFCNT */\n-\n-/** Mbuf prefetch */\n-#define RTE_MBUF_PREFETCH_TO_FREE(m) do { } while(0)\n-\n-#define rte_mbuf_refcnt_set(m,v) do { } while(0)\n-\n-#endif /* RTE_MBUF_REFCNT */\n-\n-\n-/**\n- * Sanity checks on an mbuf.\n- *\n- * Check the consistency of the given mbuf. The function will cause a\n- * panic if corruption is detected.\n- *\n- * @param m\n- *   The mbuf to be checked.\n- * @param is_header\n- *   True if the mbuf is a packet header, false if it is a sub-segment\n- *   of a packet (in this case, some fields like nb_segs are not checked)\n- */\n-void\n-rte_mbuf_sanity_check(const struct rte_mbuf *m, int is_header);\n-\n-/**\n- * @internal Allocate a new mbuf from mempool *mp*.\n- * The use of that function is reserved for RTE internal needs.\n- * Please use rte_pktmbuf_alloc().\n- *\n- * @param mp\n- *   The mempool from which mbuf is allocated.\n- * @return\n- *   - The pointer to the new mbuf on success.\n- *   - NULL if allocation failed.\n- */\n-static inline struct rte_mbuf *__rte_mbuf_raw_alloc(struct rte_mempool *mp)\n-{\n-\tstruct rte_mbuf *m;\n-\tvoid *mb = NULL;\n-\tif (rte_mempool_get(mp, &mb) < 0)\n-\t\treturn NULL;\n-\tm = (struct rte_mbuf *)mb;\n-#ifdef RTE_MBUF_REFCNT\n-\tRTE_MBUF_ASSERT(rte_mbuf_refcnt_read(m) == 0);\n-\trte_mbuf_refcnt_set(m, 1);\n-#endif /* RTE_MBUF_REFCNT */\n-\treturn (m);\n-}\n-\n-/**\n- * @internal Put mbuf back into its original mempool.\n- * The use of that function is reserved for RTE internal needs.\n- * Please use rte_pktmbuf_free().\n- *\n- * @param m\n- *   The mbuf to be freed.\n- */\n-static inline void __attribute__((always_inline))\n-__rte_mbuf_raw_free(struct rte_mbuf *m)\n-{\n-#ifdef RTE_MBUF_REFCNT\n-\tRTE_MBUF_ASSERT(rte_mbuf_refcnt_read(m) == 0);\n-#endif /* RTE_MBUF_REFCNT */\n-\trte_mempool_put(m->pool, m);\n-}\n-\n-/* Operations on ctrl mbuf */\n-\n-/**\n- * The control mbuf constructor.\n- *\n- * This function initializes some fields in an mbuf structure that are\n- * not modified by the user once created (mbuf type, origin pool, buffer\n- * start address, and so on). This function is given as a callback function\n- * to rte_mempool_create() at pool creation time.\n- *\n- * @param mp\n- *   The mempool from which the mbuf is allocated.\n- * @param opaque_arg\n- *   A pointer that can be used by the user to retrieve useful information\n- *   for mbuf initialization. This pointer comes from the ``init_arg``\n- *   parameter of rte_mempool_create().\n- * @param m\n- *   The mbuf to initialize.\n- * @param i\n- *   The index of the mbuf in the pool table.\n- */\n-void rte_ctrlmbuf_init(struct rte_mempool *mp, void *opaque_arg,\n-\t\tvoid *m, unsigned i);\n-\n-/**\n- * Allocate a new mbuf (type is ctrl) from mempool *mp*.\n- *\n- * This new mbuf is initialized with data pointing to the beginning of\n- * buffer, and with a length of zero.\n- *\n- * @param mp\n- *   The mempool from which the mbuf is allocated.\n- * @return\n- *   - The pointer to the new mbuf on success.\n- *   - NULL if allocation failed.\n- */\n-#define rte_ctrlmbuf_alloc(mp) rte_pktmbuf_alloc(mp)\n-\n-/**\n- * Free a control mbuf back into its original mempool.\n- *\n- * @param m\n- *   The control mbuf to be freed.\n- */\n-#define rte_ctrlmbuf_free(m) rte_pktmbuf_free(m)\n-\n-/**\n- * A macro that returns the pointer to the carried data.\n- *\n- * The value that can be read or assigned.\n- *\n- * @param m\n- *   The control mbuf.\n- */\n-#define rte_ctrlmbuf_data(m) ((char *)((m)->buf_addr) + (m)->data_off)\n-\n-/**\n- * A macro that returns the length of the carried data.\n- *\n- * The value that can be read or assigned.\n- *\n- * @param m\n- *   The control mbuf.\n- */\n-#define rte_ctrlmbuf_len(m) rte_pktmbuf_data_len(m)\n-\n-/**\n- * Tests if an mbuf is a control mbuf\n- *\n- * @param m\n- *   The mbuf to be tested\n- * @return\n- *   - True (1) if the mbuf is a control mbuf\n- *   - False(0) otherwise\n- */\n-static inline int\n-rte_is_ctrlmbuf(struct rte_mbuf *m)\n-{\n-\treturn (!!(m->ol_flags & CTRL_MBUF_FLAG));\n-}\n-\n-/* Operations on pkt mbuf */\n-\n-/**\n- * The packet mbuf constructor.\n- *\n- * This function initializes some fields in the mbuf structure that are\n- * not modified by the user once created (origin pool, buffer start\n- * address, and so on). This function is given as a callback function to\n- * rte_mempool_create() at pool creation time.\n- *\n- * @param mp\n- *   The mempool from which mbufs originate.\n- * @param opaque_arg\n- *   A pointer that can be used by the user to retrieve useful information\n- *   for mbuf initialization. This pointer comes from the ``init_arg``\n- *   parameter of rte_mempool_create().\n- * @param m\n- *   The mbuf to initialize.\n- * @param i\n- *   The index of the mbuf in the pool table.\n- */\n-void rte_pktmbuf_init(struct rte_mempool *mp, void *opaque_arg,\n-\t\t      void *m, unsigned i);\n-\n-\n-/**\n- * A  packet mbuf pool constructor.\n- *\n- * This function initializes the mempool private data in the case of a\n- * pktmbuf pool. This private data is needed by the driver. The\n- * function is given as a callback function to rte_mempool_create() at\n- * pool creation. It can be extended by the user, for example, to\n- * provide another packet size.\n- *\n- * @param mp\n- *   The mempool from which mbufs originate.\n- * @param opaque_arg\n- *   A pointer that can be used by the user to retrieve useful information\n- *   for mbuf initialization. This pointer comes from the ``init_arg``\n- *   parameter of rte_mempool_create().\n- */\n-void rte_pktmbuf_pool_init(struct rte_mempool *mp, void *opaque_arg);\n-\n-/**\n- * Reset the fields of a packet mbuf to their default values.\n- *\n- * The given mbuf must have only one segment.\n- *\n- * @param m\n- *   The packet mbuf to be resetted.\n- */\n-static inline void rte_pktmbuf_reset(struct rte_mbuf *m)\n-{\n-\tm->next = NULL;\n-\tm->pkt_len = 0;\n-\tm->tx_offload = 0;\n-\tm->vlan_tci = 0;\n-\tm->nb_segs = 1;\n-\tm->port = 0xff;\n-\n-\tm->ol_flags = 0;\n-\tm->packet_type = 0;\n-\tm->data_off = (RTE_PKTMBUF_HEADROOM <= m->buf_len) ?\n-\t\t\tRTE_PKTMBUF_HEADROOM : m->buf_len;\n-\n-\tm->data_len = 0;\n-\t__rte_mbuf_sanity_check(m, 1);\n-}\n-\n-/**\n- * Allocate a new mbuf from a mempool.\n- *\n- * This new mbuf contains one segment, which has a length of 0. The pointer\n- * to data is initialized to have some bytes of headroom in the buffer\n- * (if buffer size allows).\n- *\n- * @param mp\n- *   The mempool from which the mbuf is allocated.\n- * @return\n- *   - The pointer to the new mbuf on success.\n- *   - NULL if allocation failed.\n- */\n-static inline struct rte_mbuf *rte_pktmbuf_alloc(struct rte_mempool *mp)\n-{\n-\tstruct rte_mbuf *m;\n-\tif ((m = __rte_mbuf_raw_alloc(mp)) != NULL)\n-\t\trte_pktmbuf_reset(m);\n-\treturn (m);\n-}\n-\n-#ifdef RTE_MBUF_REFCNT\n-\n-/**\n- * Attach packet mbuf to another packet mbuf.\n- * After attachment we refer the mbuf we attached as 'indirect',\n- * while mbuf we attached to as 'direct'.\n- * Right now, not supported:\n- *  - attachment to indirect mbuf (e.g. - md  has to be direct).\n- *  - attachment for already indirect mbuf (e.g. - mi has to be direct).\n- *  - mbuf we trying to attach (mi) is used by someone else\n- *    e.g. it's reference counter is greater then 1.\n- *\n- * @param mi\n- *   The indirect packet mbuf.\n- * @param md\n- *   The direct packet mbuf.\n- */\n-\n-static inline void rte_pktmbuf_attach(struct rte_mbuf *mi, struct rte_mbuf *md)\n-{\n-\tRTE_MBUF_ASSERT(RTE_MBUF_DIRECT(md) &&\n-\t    RTE_MBUF_DIRECT(mi) &&\n-\t    rte_mbuf_refcnt_read(mi) == 1);\n-\n-\trte_mbuf_refcnt_update(md, 1);\n-\tmi->buf_physaddr = md->buf_physaddr;\n-\tmi->buf_addr = md->buf_addr;\n-\tmi->buf_len = md->buf_len;\n-\n-\tmi->next = md->next;\n-\tmi->data_off = md->data_off;\n-\tmi->data_len = md->data_len;\n-\tmi->port = md->port;\n-\tmi->vlan_tci = md->vlan_tci;\n-\tmi->tx_offload = md->tx_offload;\n-\tmi->hash = md->hash;\n-\n-\tmi->next = NULL;\n-\tmi->pkt_len = mi->data_len;\n-\tmi->nb_segs = 1;\n-\tmi->ol_flags = md->ol_flags;\n-\tmi->packet_type = md->packet_type;\n-\n-\t__rte_mbuf_sanity_check(mi, 1);\n-\t__rte_mbuf_sanity_check(md, 0);\n-}\n-\n-/**\n- * Detach an indirect packet mbuf -\n- *  - restore original mbuf address and length values.\n- *  - reset pktmbuf data and data_len to their default values.\n- *  All other fields of the given packet mbuf will be left intact.\n- *\n- * @param m\n- *   The indirect attached packet mbuf.\n- */\n-\n-static inline void rte_pktmbuf_detach(struct rte_mbuf *m)\n-{\n-\tconst struct rte_mempool *mp = m->pool;\n-\tvoid *buf = RTE_MBUF_TO_BADDR(m);\n-\tuint32_t buf_len = mp->elt_size - sizeof(*m);\n-\tm->buf_physaddr = rte_mempool_virt2phy(mp, m) + sizeof (*m);\n-\n-\tm->buf_addr = buf;\n-\tm->buf_len = (uint16_t)buf_len;\n-\n-\tm->data_off = (RTE_PKTMBUF_HEADROOM <= m->buf_len) ?\n-\t\t\tRTE_PKTMBUF_HEADROOM : m->buf_len;\n-\n-\tm->data_len = 0;\n-}\n-\n-#endif /* RTE_MBUF_REFCNT */\n-\n-\n-static inline struct rte_mbuf* __attribute__((always_inline))\n-__rte_pktmbuf_prefree_seg(struct rte_mbuf *m)\n-{\n-\t__rte_mbuf_sanity_check(m, 0);\n-\n-#ifdef RTE_MBUF_REFCNT\n-\tif (likely (rte_mbuf_refcnt_read(m) == 1) ||\n-\t\t\tlikely (rte_mbuf_refcnt_update(m, -1) == 0)) {\n-\t\tstruct rte_mbuf *md = RTE_MBUF_FROM_BADDR(m->buf_addr);\n-\n-\t\trte_mbuf_refcnt_set(m, 0);\n-\n-\t\t/* if this is an indirect mbuf, then\n-\t\t *  - detach mbuf\n-\t\t *  - free attached mbuf segment\n-\t\t */\n-\t\tif (unlikely (md != m)) {\n-\t\t\trte_pktmbuf_detach(m);\n-\t\t\tif (rte_mbuf_refcnt_update(md, -1) == 0)\n-\t\t\t\t__rte_mbuf_raw_free(md);\n-\t\t}\n-#endif\n-\t\treturn(m);\n-#ifdef RTE_MBUF_REFCNT\n-\t}\n-\treturn (NULL);\n-#endif\n-}\n-\n-/**\n- * Free a segment of a packet mbuf into its original mempool.\n- *\n- * Free an mbuf, without parsing other segments in case of chained\n- * buffers.\n- *\n- * @param m\n- *   The packet mbuf segment to be freed.\n- */\n-static inline void __attribute__((always_inline))\n-rte_pktmbuf_free_seg(struct rte_mbuf *m)\n-{\n-\tif (likely(NULL != (m = __rte_pktmbuf_prefree_seg(m)))) {\n-\t\tm->next = NULL;\n-\t\t__rte_mbuf_raw_free(m);\n-\t}\n-}\n-\n-/**\n- * Free a packet mbuf back into its original mempool.\n- *\n- * Free an mbuf, and all its segments in case of chained buffers. Each\n- * segment is added back into its original mempool.\n- *\n- * @param m\n- *   The packet mbuf to be freed.\n- */\n-static inline void rte_pktmbuf_free(struct rte_mbuf *m)\n-{\n-\tstruct rte_mbuf *m_next;\n-\n-\t__rte_mbuf_sanity_check(m, 1);\n-\n-\twhile (m != NULL) {\n-\t\tm_next = m->next;\n-\t\trte_pktmbuf_free_seg(m);\n-\t\tm = m_next;\n-\t}\n-}\n-\n-#ifdef RTE_MBUF_REFCNT\n-\n-/**\n- * Creates a \"clone\" of the given packet mbuf.\n- *\n- * Walks through all segments of the given packet mbuf, and for each of them:\n- *  - Creates a new packet mbuf from the given pool.\n- *  - Attaches newly created mbuf to the segment.\n- * Then updates pkt_len and nb_segs of the \"clone\" packet mbuf to match values\n- * from the original packet mbuf.\n- *\n- * @param md\n- *   The packet mbuf to be cloned.\n- * @param mp\n- *   The mempool from which the \"clone\" mbufs are allocated.\n- * @return\n- *   - The pointer to the new \"clone\" mbuf on success.\n- *   - NULL if allocation fails.\n- */\n-static inline struct rte_mbuf *rte_pktmbuf_clone(struct rte_mbuf *md,\n-\t\tstruct rte_mempool *mp)\n-{\n-\tstruct rte_mbuf *mc, *mi, **prev;\n-\tuint32_t pktlen;\n-\tuint8_t nseg;\n-\n-\tif (unlikely ((mc = rte_pktmbuf_alloc(mp)) == NULL))\n-\t\treturn (NULL);\n-\n-\tmi = mc;\n-\tprev = &mi->next;\n-\tpktlen = md->pkt_len;\n-\tnseg = 0;\n-\n-\tdo {\n-\t\tnseg++;\n-\t\trte_pktmbuf_attach(mi, md);\n-\t\t*prev = mi;\n-\t\tprev = &mi->next;\n-\t} while ((md = md->next) != NULL &&\n-\t    (mi = rte_pktmbuf_alloc(mp)) != NULL);\n-\n-\t*prev = NULL;\n-\tmc->nb_segs = nseg;\n-\tmc->pkt_len = pktlen;\n-\n-\t/* Allocation of new indirect segment failed */\n-\tif (unlikely (mi == NULL)) {\n-\t\trte_pktmbuf_free(mc);\n-\t\treturn (NULL);\n-\t}\n-\n-\t__rte_mbuf_sanity_check(mc, 1);\n-\treturn (mc);\n-}\n-\n-/**\n- * Adds given value to the refcnt of all packet mbuf segments.\n- *\n- * Walks through all segments of given packet mbuf and for each of them\n- * invokes rte_mbuf_refcnt_update().\n- *\n- * @param m\n- *   The packet mbuf whose refcnt to be updated.\n- * @param v\n- *   The value to add to the mbuf's segments refcnt.\n- */\n-static inline void rte_pktmbuf_refcnt_update(struct rte_mbuf *m, int16_t v)\n-{\n-\t__rte_mbuf_sanity_check(m, 1);\n-\n-\tdo {\n-\t\trte_mbuf_refcnt_update(m, v);\n-\t} while ((m = m->next) != NULL);\n-}\n-\n-#endif /* RTE_MBUF_REFCNT */\n-\n-/**\n- * Get the headroom in a packet mbuf.\n- *\n- * @param m\n- *   The packet mbuf.\n- * @return\n- *   The length of the headroom.\n- */\n-static inline uint16_t rte_pktmbuf_headroom(const struct rte_mbuf *m)\n-{\n-\t__rte_mbuf_sanity_check(m, 1);\n-\treturn m->data_off;\n-}\n-\n-/**\n- * Get the tailroom of a packet mbuf.\n- *\n- * @param m\n- *   The packet mbuf.\n- * @return\n- *   The length of the tailroom.\n- */\n-static inline uint16_t rte_pktmbuf_tailroom(const struct rte_mbuf *m)\n-{\n-\t__rte_mbuf_sanity_check(m, 1);\n-\treturn (uint16_t)(m->buf_len - rte_pktmbuf_headroom(m) -\n-\t\t\t  m->data_len);\n-}\n-\n-/**\n- * Get the last segment of the packet.\n- *\n- * @param m\n- *   The packet mbuf.\n- * @return\n- *   The last segment of the given mbuf.\n- */\n-static inline struct rte_mbuf *rte_pktmbuf_lastseg(struct rte_mbuf *m)\n-{\n-\tstruct rte_mbuf *m2 = (struct rte_mbuf *)m;\n-\n-\t__rte_mbuf_sanity_check(m, 1);\n-\twhile (m2->next != NULL)\n-\t\tm2 = m2->next;\n-\treturn m2;\n-}\n-\n-/**\n- * A macro that points to the start of the data in the mbuf.\n- *\n- * The returned pointer is cast to type t. Before using this\n- * function, the user must ensure that m_headlen(m) is large enough to\n- * read its data.\n- *\n- * @param m\n- *   The packet mbuf.\n- * @param t\n- *   The type to cast the result into.\n- */\n-#define rte_pktmbuf_mtod(m, t) ((t)((char *)(m)->buf_addr + (m)->data_off))\n-\n-/**\n- * A macro that returns the length of the packet.\n- *\n- * The value can be read or assigned.\n- *\n- * @param m\n- *   The packet mbuf.\n- */\n-#define rte_pktmbuf_pkt_len(m) ((m)->pkt_len)\n-\n-/**\n- * A macro that returns the length of the segment.\n- *\n- * The value can be read or assigned.\n- *\n- * @param m\n- *   The packet mbuf.\n- */\n-#define rte_pktmbuf_data_len(m) ((m)->data_len)\n-\n-/**\n- * Prepend len bytes to an mbuf data area.\n- *\n- * Returns a pointer to the new\n- * data start address. If there is not enough headroom in the first\n- * segment, the function will return NULL, without modifying the mbuf.\n- *\n- * @param m\n- *   The pkt mbuf.\n- * @param len\n- *   The amount of data to prepend (in bytes).\n- * @return\n- *   A pointer to the start of the newly prepended data, or\n- *   NULL if there is not enough headroom space in the first segment\n- */\n-static inline char *rte_pktmbuf_prepend(struct rte_mbuf *m,\n-\t\t\t\t\tuint16_t len)\n-{\n-\t__rte_mbuf_sanity_check(m, 1);\n-\n-\tif (unlikely(len > rte_pktmbuf_headroom(m)))\n-\t\treturn NULL;\n-\n-\tm->data_off -= len;\n-\tm->data_len = (uint16_t)(m->data_len + len);\n-\tm->pkt_len  = (m->pkt_len + len);\n-\n-\treturn (char *)m->buf_addr + m->data_off;\n-}\n-\n-/**\n- * Append len bytes to an mbuf.\n- *\n- * Append len bytes to an mbuf and return a pointer to the start address\n- * of the added data. If there is not enough tailroom in the last\n- * segment, the function will return NULL, without modifying the mbuf.\n- *\n- * @param m\n- *   The packet mbuf.\n- * @param len\n- *   The amount of data to append (in bytes).\n- * @return\n- *   A pointer to the start of the newly appended data, or\n- *   NULL if there is not enough tailroom space in the last segment\n- */\n-static inline char *rte_pktmbuf_append(struct rte_mbuf *m, uint16_t len)\n-{\n-\tvoid *tail;\n-\tstruct rte_mbuf *m_last;\n-\n-\t__rte_mbuf_sanity_check(m, 1);\n-\n-\tm_last = rte_pktmbuf_lastseg(m);\n-\tif (unlikely(len > rte_pktmbuf_tailroom(m_last)))\n-\t\treturn NULL;\n-\n-\ttail = (char *)m_last->buf_addr + m_last->data_off + m_last->data_len;\n-\tm_last->data_len = (uint16_t)(m_last->data_len + len);\n-\tm->pkt_len  = (m->pkt_len + len);\n-\treturn (char*) tail;\n-}\n-\n-/**\n- * Remove len bytes at the beginning of an mbuf.\n- *\n- * Returns a pointer to the start address of the new data area. If the\n- * length is greater than the length of the first segment, then the\n- * function will fail and return NULL, without modifying the mbuf.\n- *\n- * @param m\n- *   The packet mbuf.\n- * @param len\n- *   The amount of data to remove (in bytes).\n- * @return\n- *   A pointer to the new start of the data.\n- */\n-static inline char *rte_pktmbuf_adj(struct rte_mbuf *m, uint16_t len)\n-{\n-\t__rte_mbuf_sanity_check(m, 1);\n-\n-\tif (unlikely(len > m->data_len))\n-\t\treturn NULL;\n-\n-\tm->data_len = (uint16_t)(m->data_len - len);\n-\tm->data_off += len;\n-\tm->pkt_len  = (m->pkt_len - len);\n-\treturn (char *)m->buf_addr + m->data_off;\n-}\n-\n-/**\n- * Remove len bytes of data at the end of the mbuf.\n- *\n- * If the length is greater than the length of the last segment, the\n- * function will fail and return -1 without modifying the mbuf.\n- *\n- * @param m\n- *   The packet mbuf.\n- * @param len\n- *   The amount of data to remove (in bytes).\n- * @return\n- *   - 0: On success.\n- *   - -1: On error.\n- */\n-static inline int rte_pktmbuf_trim(struct rte_mbuf *m, uint16_t len)\n-{\n-\tstruct rte_mbuf *m_last;\n-\n-\t__rte_mbuf_sanity_check(m, 1);\n-\n-\tm_last = rte_pktmbuf_lastseg(m);\n-\tif (unlikely(len > m_last->data_len))\n-\t\treturn -1;\n-\n-\tm_last->data_len = (uint16_t)(m_last->data_len - len);\n-\tm->pkt_len  = (m->pkt_len - len);\n-\treturn 0;\n-}\n-\n-/**\n- * Test if mbuf data is contiguous.\n- *\n- * @param m\n- *   The packet mbuf.\n- * @return\n- *   - 1, if all data is contiguous (one segment).\n- *   - 0, if there is several segments.\n- */\n-static inline int rte_pktmbuf_is_contiguous(const struct rte_mbuf *m)\n-{\n-\t__rte_mbuf_sanity_check(m, 1);\n-\treturn !!(m->nb_segs == 1);\n-}\n-\n-/**\n- * Dump an mbuf structure to the console.\n- *\n- * Dump all fields for the given packet mbuf and all its associated\n- * segments (in the case of a chained buffer).\n- *\n- * @param f\n- *   A pointer to a file for output\n- * @param m\n- *   The packet mbuf.\n- * @param dump_len\n- *   If dump_len != 0, also dump the \"dump_len\" first data bytes of\n- *   the packet.\n- */\n-void rte_pktmbuf_dump(FILE *f, const struct rte_mbuf *m, unsigned dump_len);\n-\n-#ifdef __cplusplus\n-}\n-#endif\n-\n-#endif /* _RTE_MBUF_H_ */\n",
    "prefixes": [
        "dpdk-dev",
        "RFC",
        "06/13"
    ]
}