Show a patch.

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

{
    "id": 141,
    "url": "https://patches.dpdk.org/api/patches/141/",
    "web_url": "https://patches.dpdk.org/patch/141/",
    "project": {
        "id": 1,
        "url": "https://patches.dpdk.org/api/projects/1/",
        "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"
    },
    "msgid": "<1407789890-17355-5-git-send-email-bruce.richardson@intel.com>",
    "date": "2014-08-11T20:44:40",
    "name": "[dpdk-dev,RFC,04/14] mbuf: replace data pointer by an offset",
    "commit_ref": "",
    "pull_url": "",
    "state": "rfc",
    "archived": true,
    "hash": "3d1f19799a24c0137280a13c86a0085b10709983",
    "submitter": {
        "id": 20,
        "url": "https://patches.dpdk.org/api/people/20/",
        "name": "Bruce Richardson",
        "email": "bruce.richardson@intel.com"
    },
    "delegate": null,
    "mbox": "https://patches.dpdk.org/patch/141/mbox/",
    "series": [],
    "comments": "https://patches.dpdk.org/api/patches/141/comments/",
    "check": "pending",
    "checks": "https://patches.dpdk.org/api/patches/141/checks/",
    "tags": {},
    "headers": {
        "List-Subscribe": "<http://dpdk.org/ml/listinfo/dev>,\r\n\t<mailto:dev-request@dpdk.org?subject=subscribe>",
        "Date": "Mon, 11 Aug 2014 21:44:40 +0100",
        "In-Reply-To": "<1407789890-17355-1-git-send-email-bruce.richardson@intel.com>",
        "List-Help": "<mailto:dev-request@dpdk.org?subject=help>",
        "X-BeenThere": "dev@dpdk.org",
        "References": "<1407789890-17355-1-git-send-email-bruce.richardson@intel.com>",
        "X-Mailer": "git-send-email 1.7.0.7",
        "List-Archive": "<http://dpdk.org/ml/archives/dev/>",
        "To": "dev@dpdk.org",
        "Received": [
            "from mga09.intel.com (mga09.intel.com [134.134.136.24])\r\n\tby dpdk.org (Postfix) with ESMTP id C427AB392\r\n\tfor <dev@dpdk.org>; Mon, 11 Aug 2014 22:42:58 +0200 (CEST)",
            "from orsmga001.jf.intel.com ([10.7.209.18])\r\n\tby orsmga102.jf.intel.com with ESMTP; 11 Aug 2014 13:39:57 -0700",
            "from irvmail001.ir.intel.com ([163.33.26.43])\r\n\tby orsmga001.jf.intel.com with ESMTP; 11 Aug 2014 13:44:52 -0700",
            "from sivswdev02.ir.intel.com (sivswdev02.ir.intel.com\r\n\t[10.237.217.46])\r\n\tby irvmail001.ir.intel.com (8.14.3/8.13.6/MailSET/Hub) with ESMTP id\r\n\ts7BKiplO020943; Mon, 11 Aug 2014 21:44:51 +0100",
            "from sivswdev02.ir.intel.com (localhost [127.0.0.1])\r\n\tby sivswdev02.ir.intel.com with ESMTP id s7BKipUd017666;\r\n\tMon, 11 Aug 2014 21:44:51 +0100",
            "(from bricha3@localhost)\r\n\tby sivswdev02.ir.intel.com with  id s7BKip7Z017662;\r\n\tMon, 11 Aug 2014 21:44:51 +0100"
        ],
        "From": "Bruce Richardson <bruce.richardson@intel.com>",
        "Precedence": "list",
        "X-ExtLoop1": "1",
        "Message-Id": "<1407789890-17355-5-git-send-email-bruce.richardson@intel.com>",
        "List-Id": "patches and discussions about DPDK <dev.dpdk.org>",
        "Subject": "[dpdk-dev] [RFC PATCH 04/14] mbuf: replace data pointer by an offset",
        "X-List-Received-Date": "Mon, 11 Aug 2014 20:43:00 -0000",
        "List-Unsubscribe": "<http://dpdk.org/ml/options/dev>,\r\n\t<mailto:dev-request@dpdk.org?subject=unsubscribe>",
        "Return-Path": "<bricha3@ecsmtp.ir.intel.com>",
        "X-IronPort-AV": "E=Sophos;i=\"5.01,844,1400050800\"; d=\"scan'208\";a=\"557048797\"",
        "List-Post": "<mailto:dev@dpdk.org>",
        "X-Mailman-Version": "2.1.15"
    },
    "content": "From: Olivier Matz <olivier.matz@6wind.com>\n\nOriginal patch:\n The mbuf structure already contains a pointer to the beginning of the\n buffer (m->buf_addr). It is not needed to use 8 bytes again to store\n another pointer to the beginning of the data.\n\n Using a 16 bits unsigned integer is enough as we know that a mbuf is\n never longer than 64KB. We gain 6 bytes in the structure thanks to\n this modification.\n\n Signed-off-by: Olivier Matz <olivier.matz@6wind.com>\n\nThis version:\n* Updated original patch to apply to latest on mainline.\n* Disabled vector PMD in config as it relies heavily on the mbuf layout\n\nSigned-off-by: Bruce Richardson <bruce.richardson@intel.com>\n---\n app/test-pmd/csumonly.c                     |  2 +-\n app/test-pmd/flowgen.c                      |  2 +-\n app/test-pmd/icmpecho.c                     |  2 +-\n app/test-pmd/macfwd-retry.c                 |  2 +-\n app/test-pmd/macfwd.c                       |  2 +-\n app/test-pmd/macswap.c                      |  2 +-\n app/test-pmd/rxonly.c                       |  2 +-\n app/test-pmd/testpmd.c                      |  2 +-\n app/test-pmd/txonly.c                       |  7 +++--\n app/test/packet_burst_generator.c           |  7 +++--\n app/test/test_mbuf.c                        |  6 ++--\n app/test/test_table_acl.c                   |  7 +++--\n app/test/test_table_pipeline.c              |  8 ++----\n config/common_linuxapp                      |  2 +-\n examples/exception_path/main.c              |  3 +-\n examples/vhost/main.c                       | 39 ++++++++++++++-----------\n examples/vhost_xen/main.c                   |  2 +-\n lib/librte_ip_frag/rte_ipv4_fragmentation.c |  6 ++--\n lib/librte_ip_frag/rte_ipv6_fragmentation.c |  6 ++--\n lib/librte_mbuf/rte_mbuf.c                  |  6 ++--\n lib/librte_mbuf/rte_mbuf.h                  | 44 +++++++++++++----------------\n lib/librte_pmd_bond/rte_eth_bond_pmd.c      |  4 +--\n lib/librte_pmd_e1000/em_rxtx.c              | 12 ++++----\n lib/librte_pmd_e1000/igb_rxtx.c             | 13 ++++-----\n lib/librte_pmd_i40e/i40e_rxtx.c             | 17 ++++++-----\n lib/librte_pmd_ixgbe/ixgbe_rxtx.c           | 13 +++++----\n lib/librte_pmd_ixgbe/ixgbe_rxtx.h           |  3 +-\n lib/librte_pmd_ixgbe/ixgbe_rxtx_vec.c       |  1 -\n lib/librte_pmd_virtio/virtio_rxtx.c         |  4 +--\n lib/librte_pmd_virtio/virtqueue.h           |  3 +-\n lib/librte_pmd_vmxnet3/vmxnet3_rxtx.c       |  5 ++--\n 31 files changed, 115 insertions(+), 119 deletions(-)",
    "diff": "diff --git a/app/test-pmd/csumonly.c b/app/test-pmd/csumonly.c\r\nindex 655b6d8..6a3aaf0 100644\r\n--- a/app/test-pmd/csumonly.c\r\n+++ b/app/test-pmd/csumonly.c\r\n@@ -263,7 +263,7 @@ pkt_burst_checksum_forward(struct fwd_stream *fs)\r\n \t\tpkt_ol_flags = mb->ol_flags;\r\n \t\tol_flags = (uint16_t) (pkt_ol_flags & (~PKT_TX_L4_MASK));\r\n \r\n-\t\teth_hdr = (struct ether_hdr *) mb->data;\r\n+\t\teth_hdr = rte_pktmbuf_mtod(mb, struct ether_hdr *);\r\n \t\teth_type = rte_be_to_cpu_16(eth_hdr->ether_type);\r\n \t\tif (eth_type == ETHER_TYPE_VLAN) {\r\n \t\t\t/* Only allow single VLAN label here */\r\ndiff --git a/app/test-pmd/flowgen.c b/app/test-pmd/flowgen.c\r\nindex 17dbf83..d69b2b8 100644\r\n--- a/app/test-pmd/flowgen.c\r\n+++ b/app/test-pmd/flowgen.c\r\n@@ -175,7 +175,7 @@ pkt_burst_flow_gen(struct fwd_stream *fs)\r\n \t\tpkt->next = NULL;\r\n \r\n \t\t/* Initialize Ethernet header. */\r\n-\t\teth_hdr = (struct ether_hdr *)pkt->data;\r\n+\t\teth_hdr = rte_pktmbuf_mtod(pkt, struct ether_hdr *);\r\n \t\tether_addr_copy(&cfg_ether_dst, &eth_hdr->d_addr);\r\n \t\tether_addr_copy(&cfg_ether_src, &eth_hdr->s_addr);\r\n \t\teth_hdr->ether_type = rte_cpu_to_be_16(ETHER_TYPE_IPv4);\r\ndiff --git a/app/test-pmd/icmpecho.c b/app/test-pmd/icmpecho.c\r\nindex 4a277b8..7fd4b6d 100644\r\n--- a/app/test-pmd/icmpecho.c\r\n+++ b/app/test-pmd/icmpecho.c\r\n@@ -330,7 +330,7 @@ reply_to_icmp_echo_rqsts(struct fwd_stream *fs)\r\n \tnb_replies = 0;\r\n \tfor (i = 0; i < nb_rx; i++) {\r\n \t\tpkt = pkts_burst[i];\r\n-\t\teth_h = (struct ether_hdr *) pkt->data;\r\n+\t\teth_h = rte_pktmbuf_mtod(pkt, struct ether_hdr *);\r\n \t\teth_type = RTE_BE_TO_CPU_16(eth_h->ether_type);\r\n \t\tl2_len = sizeof(struct ether_hdr);\r\n \t\tif (verbose_level > 0) {\r\ndiff --git a/app/test-pmd/macfwd-retry.c b/app/test-pmd/macfwd-retry.c\r\nindex 5122983..83da26f 100644\r\n--- a/app/test-pmd/macfwd-retry.c\r\n+++ b/app/test-pmd/macfwd-retry.c\r\n@@ -119,7 +119,7 @@ pkt_burst_mac_retry_forward(struct fwd_stream *fs)\r\n \tfs->rx_packets += nb_rx;\r\n \tfor (i = 0; i < nb_rx; i++) {\r\n \t\tmb = pkts_burst[i];\r\n-\t\teth_hdr = (struct ether_hdr *) mb->data;\r\n+\t\teth_hdr = rte_pktmbuf_mtod(mb, struct ether_hdr *);\r\n \t\tether_addr_copy(&peer_eth_addrs[fs->peer_addr],\r\n \t\t\t\t&eth_hdr->d_addr);\r\n \t\tether_addr_copy(&ports[fs->tx_port].eth_addr,\r\ndiff --git a/app/test-pmd/macfwd.c b/app/test-pmd/macfwd.c\r\nindex 999c8e3..674c189 100644\r\n--- a/app/test-pmd/macfwd.c\r\n+++ b/app/test-pmd/macfwd.c\r\n@@ -110,7 +110,7 @@ pkt_burst_mac_forward(struct fwd_stream *fs)\r\n \ttxp = &ports[fs->tx_port];\r\n \tfor (i = 0; i < nb_rx; i++) {\r\n \t\tmb = pkts_burst[i];\r\n-\t\teth_hdr = (struct ether_hdr *) mb->data;\r\n+\t\teth_hdr = rte_pktmbuf_mtod(mb, struct ether_hdr *);\r\n \t\tether_addr_copy(&peer_eth_addrs[fs->peer_addr],\r\n \t\t\t\t&eth_hdr->d_addr);\r\n \t\tether_addr_copy(&ports[fs->tx_port].eth_addr,\r\ndiff --git a/app/test-pmd/macswap.c b/app/test-pmd/macswap.c\r\nindex 731f487..d274b36 100644\r\n--- a/app/test-pmd/macswap.c\r\n+++ b/app/test-pmd/macswap.c\r\n@@ -110,7 +110,7 @@ pkt_burst_mac_swap(struct fwd_stream *fs)\r\n \ttxp = &ports[fs->tx_port];\r\n \tfor (i = 0; i < nb_rx; i++) {\r\n \t\tmb = pkts_burst[i];\r\n-\t\teth_hdr = (struct ether_hdr *) mb->data;\r\n+\t\teth_hdr = rte_pktmbuf_mtod(mb, struct ether_hdr *);\r\n \r\n \t\t/* Swap dest and src mac addresses. */\r\n \t\tether_addr_copy(&eth_hdr->d_addr, &addr);\r\ndiff --git a/app/test-pmd/rxonly.c b/app/test-pmd/rxonly.c\r\nindex c34a5e1..b477076 100644\r\n--- a/app/test-pmd/rxonly.c\r\n+++ b/app/test-pmd/rxonly.c\r\n@@ -149,7 +149,7 @@ pkt_burst_receive(struct fwd_stream *fs)\r\n \t\t\trte_pktmbuf_free(mb);\r\n \t\t\tcontinue;\r\n \t\t}\r\n-\t\teth_hdr = (struct ether_hdr *) mb->data;\r\n+\t\teth_hdr = rte_pktmbuf_mtod(mb, struct ether_hdr *);\r\n \t\teth_type = RTE_BE_TO_CPU_16(eth_hdr->ether_type);\r\n \t\tol_flags = mb->ol_flags;\r\n \t\tprint_ether_addr(\"  src=\", &eth_hdr->s_addr);\r\ndiff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c\r\nindex 81272a0..16de06c 100644\r\n--- a/app/test-pmd/testpmd.c\r\n+++ b/app/test-pmd/testpmd.c\r\n@@ -404,7 +404,7 @@ testpmd_mbuf_ctor(struct rte_mempool *mp,\r\n \t\t\tmb_ctor_arg->seg_buf_offset);\r\n \tmb->buf_len      = mb_ctor_arg->seg_buf_size;\r\n \tmb->ol_flags     = 0;\r\n-\tmb->data         = (char *) mb->buf_addr + RTE_PKTMBUF_HEADROOM;\r\n+\tmb->data_off     = RTE_PKTMBUF_HEADROOM;\r\n \tmb->nb_segs      = 1;\r\n \tmb->vlan_macip.data = 0;\r\n \tmb->hash.rss     = 0;\r\ndiff --git a/app/test-pmd/txonly.c b/app/test-pmd/txonly.c\r\nindex 1b2f661..95e46a2 100644\r\n--- a/app/test-pmd/txonly.c\r\n+++ b/app/test-pmd/txonly.c\r\n@@ -111,13 +111,13 @@ copy_buf_to_pkt_segs(void* buf, unsigned len, struct rte_mbuf *pkt,\r\n \t\tseg = seg->next;\r\n \t}\r\n \tcopy_len = seg->data_len - offset;\r\n-\tseg_buf = ((char *) seg->data + offset);\r\n+\tseg_buf = (rte_pktmbuf_mtod(seg, char *) + offset);\r\n \twhile (len > copy_len) {\r\n \t\trte_memcpy(seg_buf, buf, (size_t) copy_len);\r\n \t\tlen -= copy_len;\r\n \t\tbuf = ((char*) buf + copy_len);\r\n \t\tseg = seg->next;\r\n-\t\tseg_buf = seg->data;\r\n+\t\tseg_buf = rte_pktmbuf_mtod(seg, char *);\r\n \t}\r\n \trte_memcpy(seg_buf, buf, (size_t) len);\r\n }\r\n@@ -126,7 +126,8 @@ static inline void\r\n copy_buf_to_pkt(void* buf, unsigned len, struct rte_mbuf *pkt, unsigned offset)\r\n {\r\n \tif (offset + len <= pkt->data_len) {\r\n-\t\trte_memcpy(((char *) pkt->data + offset), buf, (size_t) len);\r\n+\t\trte_memcpy((rte_pktmbuf_mtod(pkt, char *) + offset),\r\n+\t\t\tbuf, (size_t) len);\r\n \t\treturn;\r\n \t}\r\n \tcopy_buf_to_pkt_segs(buf, len, pkt, offset);\r\ndiff --git a/app/test/packet_burst_generator.c b/app/test/packet_burst_generator.c\r\nindex 8740348..c9e6c8b 100644\r\n--- a/app/test/packet_burst_generator.c\r\n+++ b/app/test/packet_burst_generator.c\r\n@@ -59,13 +59,13 @@ copy_buf_to_pkt_segs(void *buf, unsigned len, struct rte_mbuf *pkt,\r\n \t\tseg = seg->next;\r\n \t}\r\n \tcopy_len = seg->data_len - offset;\r\n-\tseg_buf = ((char *) seg->data + offset);\r\n+\tseg_buf = rte_pktmbuf_mtod(seg, char *) + offset;\r\n \twhile (len > copy_len) {\r\n \t\trte_memcpy(seg_buf, buf, (size_t) copy_len);\r\n \t\tlen -= copy_len;\r\n \t\tbuf = ((char *) buf + copy_len);\r\n \t\tseg = seg->next;\r\n-\t\tseg_buf = seg->data;\r\n+\t\tseg_buf = rte_pktmbuf_mtod(seg, void *);\r\n \t}\r\n \trte_memcpy(seg_buf, buf, (size_t) len);\r\n }\r\n@@ -74,7 +74,8 @@ static inline void\r\n copy_buf_to_pkt(void *buf, unsigned len, struct rte_mbuf *pkt, unsigned offset)\r\n {\r\n \tif (offset + len <= pkt->data_len) {\r\n-\t\trte_memcpy(((char *) pkt->data + offset), buf, (size_t) len);\r\n+\t\trte_memcpy(rte_pktmbuf_mtod(pkt, char *) + offset,\r\n+\t\t\t\tbuf, (size_t) len);\r\n \t\treturn;\r\n \t}\r\n \tcopy_buf_to_pkt_segs(buf, len, pkt, offset);\r\ndiff --git a/app/test/test_mbuf.c b/app/test/test_mbuf.c\r\nindex fd26d6f..31ef9fa 100644\r\n--- a/app/test/test_mbuf.c\r\n+++ b/app/test/test_mbuf.c\r\n@@ -432,7 +432,7 @@ test_pktmbuf_pool_ptr(void)\r\n \t\t\tprintf(\"rte_pktmbuf_alloc() failed (%u)\\n\", i);\r\n \t\t\tret = -1;\r\n \t\t}\r\n-\t\tm[i]->data = RTE_PTR_ADD(m[i]->data, 64);\r\n+\t\tm[i]->data_off += 64;\r\n \t}\r\n \r\n \t/* free them */\r\n@@ -451,8 +451,8 @@ test_pktmbuf_pool_ptr(void)\r\n \t\t\tprintf(\"rte_pktmbuf_alloc() failed (%u)\\n\", i);\r\n \t\t\tret = -1;\r\n \t\t}\r\n-\t\tif (m[i]->data != RTE_PTR_ADD(m[i]->buf_addr, RTE_PKTMBUF_HEADROOM)) {\r\n-\t\t\tprintf (\"data pointer not set properly\\n\");\r\n+\t\tif (m[i]->data_off != RTE_PKTMBUF_HEADROOM) {\r\n+\t\t\tprintf (\"invalid data_off\\n\");\r\n \t\t\tret = -1;\r\n \t\t}\r\n \t}\r\ndiff --git a/app/test/test_table_acl.c b/app/test/test_table_acl.c\r\nindex 70e2e68..e68585f 100644\r\n--- a/app/test/test_table_acl.c\r\n+++ b/app/test/test_table_acl.c\r\n@@ -515,7 +515,7 @@ test_pipeline_single_filter(int expected_count)\r\n \t\t\tstruct rte_mbuf *mbuf;\r\n \r\n \t\t\tmbuf = rte_pktmbuf_alloc(pool);\r\n-\t\t\tmemset(mbuf->data, 0x00,\r\n+\t\t\tmemset(rte_pktmbuf_mtod(mbuf, char *), 0x00,\r\n \t\t\t\tsizeof(struct ipv4_5tuple));\r\n \r\n \t\t\tfive_tuple.proto = j;\r\n@@ -524,7 +524,7 @@ test_pipeline_single_filter(int expected_count)\r\n \t\t\tfive_tuple.port_src = rte_bswap16(100 + j);\r\n \t\t\tfive_tuple.port_dst = rte_bswap16(200 + j);\r\n \r\n-\t\t\tmemcpy(mbuf->data, &five_tuple,\r\n+\t\t\tmemcpy(rte_pktmbuf_mtod(mbuf, char *), &five_tuple,\r\n \t\t\t\tsizeof(struct ipv4_5tuple));\r\n \t\t\tRTE_LOG(INFO, PIPELINE, \"%s: Enqueue onto ring %d\\n\",\r\n \t\t\t\t__func__, i);\r\n@@ -551,7 +551,8 @@ test_pipeline_single_filter(int expected_count)\r\n \t\t\tprintf(\"Got %d object(s) from ring %d!\\n\", ret, i);\r\n \t\t\tfor (j = 0; j < ret; j++) {\r\n \t\t\t\tmbuf = (struct rte_mbuf *)objs[j];\r\n-\t\t\t\trte_hexdump(stdout, \"mbuf\", mbuf->data, 64);\r\n+\t\t\t\trte_hexdump(stdout, \"mbuf\",\r\n+\t\t\t\t\trte_pktmbuf_mtod(mbuf, char *), 64);\r\n \t\t\t\trte_pktmbuf_free(mbuf);\r\n \t\t\t}\r\n \t\t\ttx_count += ret;\r\ndiff --git a/app/test/test_table_pipeline.c b/app/test/test_table_pipeline.c\r\nindex c5368ae..f6a5b6f 100644\r\n--- a/app/test/test_table_pipeline.c\r\n+++ b/app/test/test_table_pipeline.c\r\n@@ -45,11 +45,6 @@\r\n #include \"test_table.h\"\r\n #include \"test_table_pipeline.h\"\r\n \r\n-#define RTE_CBUF_UINT8_PTR(cbuf, offset)\t\t\t\\\r\n-\t(&cbuf->data[offset])\r\n-#define RTE_CBUF_UINT32_PTR(cbuf, offset)\t\t\t\\\r\n-\t(&cbuf->data32[offset/sizeof(uint32_t)])\r\n-\r\n #if 0\r\n \r\n static rte_pipeline_port_out_action_handler port_action_0x00\r\n@@ -504,7 +499,8 @@ test_pipeline_single_filter(int test_type, int expected_count)\r\n \t\t\tprintf(\"Got %d object(s) from ring %d!\\n\", ret, i);\r\n \t\t\tfor (j = 0; j < ret; j++) {\r\n \t\t\t\tmbuf = (struct rte_mbuf *)objs[j];\r\n-\t\t\t\trte_hexdump(stdout, \"Object:\", mbuf->data,\r\n+\t\t\t\trte_hexdump(stdout, \"Object:\",\r\n+\t\t\t\t\trte_pktmbuf_mtod(mbuf, char *),\r\n \t\t\t\t\tmbuf->data_len);\r\n \t\t\t\trte_pktmbuf_free(mbuf);\r\n \t\t\t}\r\ndiff --git a/config/common_linuxapp b/config/common_linuxapp\r\nindex 5bee910..b140af7 100644\r\n--- a/config/common_linuxapp\r\n+++ b/config/common_linuxapp\r\n@@ -191,7 +191,7 @@ CONFIG_RTE_LIBRTE_IXGBE_DEBUG_DRIVER=n\r\n CONFIG_RTE_LIBRTE_IXGBE_PF_DISABLE_STRIP_CRC=n\r\n CONFIG_RTE_LIBRTE_IXGBE_RX_ALLOW_BULK_ALLOC=y\r\n CONFIG_RTE_LIBRTE_IXGBE_ALLOW_UNSUPPORTED_SFP=n\r\n-CONFIG_RTE_IXGBE_INC_VECTOR=y\r\n+CONFIG_RTE_IXGBE_INC_VECTOR=n\r\n CONFIG_RTE_IXGBE_RX_OLFLAGS_ENABLE=y\r\n \r\n #\r\ndiff --git a/examples/exception_path/main.c b/examples/exception_path/main.c\r\nindex 5045ef8..f286bf2 100644\r\n--- a/examples/exception_path/main.c\r\n+++ b/examples/exception_path/main.c\r\n@@ -302,7 +302,8 @@ main_loop(__attribute__((unused)) void *arg)\r\n \t\t\tif (m == NULL)\r\n \t\t\t\tcontinue;\r\n \r\n-\t\t\tret = read(tap_fd, m->data, MAX_PACKET_SZ);\r\n+\t\t\tret = read(tap_fd, rte_pktmbuf_mtod(m, void *),\r\n+\t\t\t\tMAX_PACKET_SZ);\r\n \t\t\tlcore_stats[lcore_id].rx++;\r\n \t\t\tif (unlikely(ret < 0)) {\r\n \t\t\t\tFATAL_ERROR(\"Reading from %s interface failed\",\r\ndiff --git a/examples/vhost/main.c b/examples/vhost/main.c\r\nindex afbab31..6ccdc24 100644\r\n--- a/examples/vhost/main.c\r\n+++ b/examples/vhost/main.c\r\n@@ -1027,7 +1027,9 @@ virtio_dev_rx(struct virtio_net *dev, struct rte_mbuf **pkts, uint32_t count)\r\n \t\tvq->used->ring[res_cur_idx & (vq->size - 1)].len = packet_len;\r\n \r\n \t\t/* Copy mbuf data to buffer */\r\n-\t\trte_memcpy((void *)(uintptr_t)buff_addr, (const void*)buff->data, rte_pktmbuf_data_len(buff));\r\n+\t\trte_memcpy((void *)(uintptr_t)buff_addr,\r\n+\t\t\trte_pktmbuf_mtod(buff, const void *),\r\n+\t\t\trte_pktmbuf_data_len(buff));\r\n \r\n \t\tres_cur_idx++;\r\n \t\tpacket_success++;\r\n@@ -1089,7 +1091,7 @@ link_vmdq(struct virtio_net *dev, struct rte_mbuf *m)\r\n \tint i, ret;\r\n \r\n \t/* Learn MAC address of guest device from packet */\r\n-\tpkt_hdr = (struct ether_hdr *)m->data;\r\n+\tpkt_hdr = rte_pktmbuf_mtod(m, struct ether_hdr *);\r\n \r\n \tdev_ll = ll_root_used;\r\n \r\n@@ -1176,7 +1178,7 @@ virtio_tx_local(struct virtio_net *dev, struct rte_mbuf *m)\r\n \tstruct ether_hdr *pkt_hdr;\r\n \tuint64_t ret = 0;\r\n \r\n-\tpkt_hdr = (struct ether_hdr *)m->data;\r\n+\tpkt_hdr = rte_pktmbuf_mtod(m, struct ether_hdr *);\r\n \r\n \t/*get the used devices list*/\r\n \tdev_ll = ll_root_used;\r\n@@ -1235,7 +1237,7 @@ virtio_tx_route(struct virtio_net* dev, struct rte_mbuf *m, struct rte_mempool *\r\n \tunsigned len, ret, offset = 0;\r\n \tconst uint16_t lcore_id = rte_lcore_id();\r\n \tstruct virtio_net_data_ll *dev_ll = ll_root_used;\r\n-\tstruct ether_hdr *pkt_hdr = (struct ether_hdr *)m->data;\r\n+\tstruct ether_hdr *pkt_hdr = rte_pktmbuf_mtod(m, struct ether_hdr *);\r\n \r\n \t/*check if destination is local VM*/\r\n \tif ((vm2vm_mode == VM2VM_SOFTWARE) && (virtio_tx_local(dev, m) == 0))\r\n@@ -1292,18 +1294,21 @@ virtio_tx_route(struct virtio_net* dev, struct rte_mbuf *m, struct rte_mempool *\r\n \tmbuf->pkt_len = mbuf->data_len;\r\n \r\n \t/* Copy ethernet header to mbuf. */\r\n-\trte_memcpy((void*)mbuf->data, (const void*)m->data, ETH_HLEN);\r\n+\trte_memcpy(rte_pktmbuf_mtod(mbuf, void *),\r\n+\t\trte_pktmbuf_mtod(m, const void *),\r\n+\t\tETH_HLEN);\r\n \r\n \r\n \t/* Setup vlan header. Bytes need to be re-ordered for network with htons()*/\r\n-\tvlan_hdr = (struct vlan_ethhdr *) mbuf->data;\r\n+\tvlan_hdr = rte_pktmbuf_mtod(mbuf, struct vlan_ethhdr *);\r\n \tvlan_hdr->h_vlan_encapsulated_proto = vlan_hdr->h_vlan_proto;\r\n \tvlan_hdr->h_vlan_proto = htons(ETH_P_8021Q);\r\n \tvlan_hdr->h_vlan_TCI = htons(vlan_tag);\r\n \r\n \t/* Copy the remaining packet contents to the mbuf. */\r\n-\trte_memcpy((void*) ((uint8_t*)mbuf->data + VLAN_ETH_HLEN),\r\n-\t\t(const void*) ((uint8_t*)m->data + ETH_HLEN), (m->data_len - ETH_HLEN));\r\n+\trte_memcpy((void *)(rte_pktmbuf_mtod(mbuf, uint8_t *) + VLAN_ETH_HLEN),\r\n+\t\t(const void *)(rte_pktmbuf_mtod(m, uint8_t *) + ETH_HLEN),\r\n+\t\t(m->data_len - ETH_HLEN));\r\n \ttx_q->m_table[len] = mbuf;\r\n \tlen++;\r\n \tif (enable_stats) {\r\n@@ -1394,7 +1399,7 @@ virtio_dev_tx(struct virtio_net* dev, struct rte_mempool *mbuf_pool)\r\n \r\n \t\t/* Setup dummy mbuf. This is copied to a real mbuf if transmitted out the physical port. */\r\n \t\tm.data_len = desc->len;\r\n-\t\tm.data = (void*)(uintptr_t)buff_addr;\r\n+\t\tm.data_off = 0;\r\n \r\n \t\tPRINT_PACKET(dev, (uintptr_t)buff_addr, desc->len, 0);\r\n \r\n@@ -1713,7 +1718,7 @@ attach_rxmbuf_zcp(struct virtio_net *dev)\r\n \t}\r\n \r\n \tmbuf->buf_addr = (void *)(uintptr_t)(buff_addr - RTE_PKTMBUF_HEADROOM);\r\n-\tmbuf->data = (void *)(uintptr_t)(buff_addr);\r\n+\tmbuf->data_off = RTE_PKTMBUF_HEADROOM;\r\n \tmbuf->buf_physaddr = phys_addr - RTE_PKTMBUF_HEADROOM;\r\n \tmbuf->data_len = desc->len;\r\n \tMBUF_HEADROOM_UINT32(mbuf) = (uint32_t)desc_idx;\r\n@@ -1750,7 +1755,7 @@ static inline void pktmbuf_detach_zcp(struct rte_mbuf *m)\r\n \r\n \tbuf_ofs = (RTE_PKTMBUF_HEADROOM <= m->buf_len) ?\r\n \t\t\tRTE_PKTMBUF_HEADROOM : m->buf_len;\r\n-\tm->data = (char *) m->buf_addr + buf_ofs;\r\n+\tm->data_off = buf_ofs;\r\n \r\n \tm->data_len = 0;\r\n }\r\n@@ -1984,7 +1989,7 @@ virtio_tx_route_zcp(struct virtio_net *dev, struct rte_mbuf *m,\r\n \tunsigned len, ret, offset = 0;\r\n \tstruct vpool *vpool;\r\n \tstruct virtio_net_data_ll *dev_ll = ll_root_used;\r\n-\tstruct ether_hdr *pkt_hdr = (struct ether_hdr *)m->data;\r\n+\tstruct ether_hdr *pkt_hdr = rte_pktmbuf_mtod(m, struct ether_hdr *);\r\n \tuint16_t vlan_tag = (uint16_t)vlan_tags[(uint16_t)dev->device_fh];\r\n \r\n \t/*Add packet to the port tx queue*/\r\n@@ -2061,11 +2066,11 @@ virtio_tx_route_zcp(struct virtio_net *dev, struct rte_mbuf *m,\r\n \tmbuf->pkt_len = mbuf->data_len;\r\n \tif (unlikely(need_copy)) {\r\n \t\t/* Copy the packet contents to the mbuf. */\r\n-\t\trte_memcpy((void *)((uint8_t *)mbuf->data),\r\n-\t\t\t(const void *) ((uint8_t *)m->data),\r\n+\t\trte_memcpy(rte_pktmbuf_mtod(mbuf, void *),\r\n+\t\t\trte_pktmbuf_mtod(m, void *),\r\n \t\t\tm->data_len);\r\n \t} else {\r\n-\t\tmbuf->data = m->data;\r\n+\t\tmbuf->data_off = m->data_off;\r\n \t\tmbuf->buf_physaddr = m->buf_physaddr;\r\n \t\tmbuf->buf_addr = m->buf_addr;\r\n \t}\r\n@@ -2199,8 +2204,8 @@ virtio_dev_tx_zcp(struct virtio_net *dev)\r\n \t\tm.data_len = desc->len;\r\n \t\tm.nb_segs = 1;\r\n \t\tm.next = NULL;\r\n-\t\tm.data = (void *)(uintptr_t)buff_addr;\r\n-\t\tm.buf_addr = m.data;\r\n+\t\tm.data_off = 0;\r\n+\t\tm.buf_addr = (void *)(uintptr_t)buff_addr;\r\n \t\tm.buf_physaddr = phys_addr;\r\n \r\n \t\t/*\r\ndiff --git a/examples/vhost_xen/main.c b/examples/vhost_xen/main.c\r\nindex 8162cd8..9a4c7c0 100644\r\n--- a/examples/vhost_xen/main.c\r\n+++ b/examples/vhost_xen/main.c\r\n@@ -981,7 +981,7 @@ virtio_dev_tx(struct virtio_net* dev, struct rte_mempool *mbuf_pool)\r\n \r\n \t\t/* Setup dummy mbuf. This is copied to a real mbuf if transmitted out the physical port. */\r\n \t\tm.data_len = desc->len;\r\n-\t\tm.data = (void*)(uintptr_t)buff_addr;\r\n+\t\tm.data_off = 0;\r\n \t\tm.nb_segs = 1;\r\n \r\n \t\tvirtio_tx_route(dev, &m, mbuf_pool, 0);\r\ndiff --git a/lib/librte_ip_frag/rte_ipv4_fragmentation.c b/lib/librte_ip_frag/rte_ipv4_fragmentation.c\r\nindex 0b10310..cb09d92 100644\r\n--- a/lib/librte_ip_frag/rte_ipv4_fragmentation.c\r\n+++ b/lib/librte_ip_frag/rte_ipv4_fragmentation.c\r\n@@ -109,7 +109,7 @@ rte_ipv4_fragment_packet(struct rte_mbuf *pkt_in,\r\n \t/* Fragment size should be a multiply of 8. */\r\n \tIP_FRAG_ASSERT((frag_size & IPV4_HDR_FO_MASK) == 0);\r\n \r\n-\tin_hdr = (struct ipv4_hdr *) pkt_in->data;\r\n+\tin_hdr = rte_pktmbuf_mtod(pkt_in, struct ipv4_hdr *);\r\n \tflag_offset = rte_cpu_to_be_16(in_hdr->fragment_offset);\r\n \r\n \t/* If Don't Fragment flag is set */\r\n@@ -165,7 +165,7 @@ rte_ipv4_fragment_packet(struct rte_mbuf *pkt_in,\r\n \t\t\tif (len > (in_seg->data_len - in_seg_data_pos)) {\r\n \t\t\t\tlen = in_seg->data_len - in_seg_data_pos;\r\n \t\t\t}\r\n-\t\t\tout_seg->data = (char*) in_seg->data + (uint16_t)in_seg_data_pos;\r\n+\t\t\tout_seg->data_off = in_seg->data_off + in_seg_data_pos;\r\n \t\t\tout_seg->data_len = (uint16_t)len;\r\n \t\t\tout_pkt->pkt_len = (uint16_t)(len +\r\n \t\t\t    out_pkt->pkt_len);\r\n@@ -188,7 +188,7 @@ rte_ipv4_fragment_packet(struct rte_mbuf *pkt_in,\r\n \r\n \t\t/* Build the IP header */\r\n \r\n-\t\tout_hdr = (struct ipv4_hdr*) out_pkt->data;\r\n+\t\tout_hdr = rte_pktmbuf_mtod(out_pkt, struct ipv4_hdr *);\r\n \r\n \t\t__fill_ipv4hdr_frag(out_hdr, in_hdr,\r\n \t\t    (uint16_t)out_pkt->pkt_len,\r\ndiff --git a/lib/librte_ip_frag/rte_ipv6_fragmentation.c b/lib/librte_ip_frag/rte_ipv6_fragmentation.c\r\nindex e007662..4ffcc7c 100644\r\n--- a/lib/librte_ip_frag/rte_ipv6_fragmentation.c\r\n+++ b/lib/librte_ip_frag/rte_ipv6_fragmentation.c\r\n@@ -125,7 +125,7 @@ rte_ipv6_fragment_packet(struct rte_mbuf *pkt_in,\r\n \t    (uint16_t)(pkt_in->pkt_len - sizeof (struct ipv6_hdr))))\r\n \t\treturn (-EINVAL);\r\n \r\n-\tin_hdr = (struct ipv6_hdr *) pkt_in->data;\r\n+\tin_hdr = rte_pktmbuf_mtod(pkt_in, struct ipv6_hdr *);\r\n \r\n \tin_seg = pkt_in;\r\n \tin_seg_data_pos = sizeof(struct ipv6_hdr);\r\n@@ -171,7 +171,7 @@ rte_ipv6_fragment_packet(struct rte_mbuf *pkt_in,\r\n \t\t\tif (len > (in_seg->data_len - in_seg_data_pos)) {\r\n \t\t\t\tlen = in_seg->data_len - in_seg_data_pos;\r\n \t\t\t}\r\n-\t\t\tout_seg->data = (char *) in_seg->data + (uint16_t) in_seg_data_pos;\r\n+\t\t\tout_seg->data_off = in_seg->data_off + in_seg_data_pos;\r\n \t\t\tout_seg->data_len = (uint16_t)len;\r\n \t\t\tout_pkt->pkt_len = (uint16_t)(len +\r\n \t\t\t    out_pkt->pkt_len);\r\n@@ -196,7 +196,7 @@ rte_ipv6_fragment_packet(struct rte_mbuf *pkt_in,\r\n \r\n \t\t/* Build the IP header */\r\n \r\n-\t\tout_hdr = (struct ipv6_hdr *) out_pkt->data;\r\n+\t\tout_hdr = rte_pktmbuf_mtod(out_pkt, struct ipv6_hdr *);\r\n \r\n \t\t__fill_ipv6hdr_frag(out_hdr, in_hdr,\r\n \t\t    (uint16_t) out_pkt->pkt_len - sizeof(struct ipv6_hdr),\r\ndiff --git a/lib/librte_mbuf/rte_mbuf.c b/lib/librte_mbuf/rte_mbuf.c\r\nindex cc62401..2e1dbdf 100644\r\n--- a/lib/librte_mbuf/rte_mbuf.c\r\n+++ b/lib/librte_mbuf/rte_mbuf.c\r\n@@ -104,7 +104,7 @@ rte_pktmbuf_init(struct rte_mempool *mp,\r\n \tm->buf_len = (uint16_t)buf_len;\r\n \r\n \t/* keep some headroom between start of buffer and data */\r\n-\tm->data = (char*) m->buf_addr + RTE_MIN(RTE_PKTMBUF_HEADROOM, m->buf_len);\r\n+\tm->data_off = RTE_MIN(RTE_PKTMBUF_HEADROOM, (uint16_t)m->buf_len);\r\n \r\n \t/* init some constant fields */\r\n \tm->pool = mp;\r\n@@ -170,12 +170,12 @@ rte_pktmbuf_dump(FILE *f, const struct rte_mbuf *m, unsigned dump_len)\r\n \t\t__rte_mbuf_sanity_check(m, 0);\r\n \r\n \t\tfprintf(f, \"  segment at 0x%p, data=0x%p, data_len=%u\\n\",\r\n-\t\t       m, m->data, (unsigned)m->data_len);\r\n+\t\t\tm, rte_pktmbuf_mtod(m, void *), (unsigned)m->data_len);\r\n \t\tlen = dump_len;\r\n \t\tif (len > m->data_len)\r\n \t\t\tlen = m->data_len;\r\n \t\tif (len != 0)\r\n-\t\t\trte_hexdump(f, NULL, m->data, len);\r\n+\t\t\trte_hexdump(f, NULL, rte_pktmbuf_mtod(m, void *), len);\r\n \t\tdump_len -= len;\r\n \t\tm = m->next;\r\n \t\tnb_segs --;\r\ndiff --git a/lib/librte_mbuf/rte_mbuf.h b/lib/librte_mbuf/rte_mbuf.h\r\nindex a2127c1..0cd6928 100644\r\n--- a/lib/librte_mbuf/rte_mbuf.h\r\n+++ b/lib/librte_mbuf/rte_mbuf.h\r\n@@ -140,6 +140,13 @@ struct rte_mbuf {\r\n \tvoid *buf_addr;           /**< Virtual address of segment buffer. */\r\n \tphys_addr_t buf_physaddr; /**< Physical address of segment buffer. */\r\n \tuint16_t buf_len;         /**< Length of segment buffer. */\r\n+\r\n+\t/* valid for any segment */\r\n+\tstruct rte_mbuf *next;    /**< Next segment of scattered packet. */\r\n+\tuint16_t data_off;\r\n+\tuint16_t data_len;        /**< Amount of data in segment buffer. */\r\n+\tuint32_t pkt_len;         /**< Total pkt len: sum of all segments. */\r\n+\r\n #ifdef RTE_MBUF_REFCNT\r\n \t/**\r\n \t * 16-bit Reference counter.\r\n@@ -156,18 +163,12 @@ struct rte_mbuf {\r\n #else\r\n \tuint16_t refcnt_reserved;     /**< Do not use this field */\r\n #endif\r\n-\tuint16_t reserved;             /**< Unused field. Required for padding. */\r\n-\tuint16_t ol_flags;            /**< Offload features. */\r\n-\r\n-\t/* valid for any segment */\r\n-\tstruct rte_mbuf *next;  /**< Next segment of scattered packet. */\r\n-\tvoid* data;             /**< Start address of data in segment buffer. */\r\n-\tuint16_t data_len;      /**< Amount of data in segment buffer. */\r\n \r\n \t/* these fields are valid for first segment only */\r\n \tuint8_t nb_segs;        /**< Number of segments. */\r\n \tuint8_t in_port;        /**< Input port. */\r\n-\tuint32_t pkt_len;       /**< Total pkt len: sum of all segment data_len. */\r\n+\tuint16_t ol_flags;            /**< Offload features. */\r\n+\tuint16_t reserved;             /**< Unused field. Required for padding. */\r\n \r\n \t/* offload features, valid for first segment only */\r\n \tunion rte_vlan_macip vlan_macip;\r\n@@ -185,7 +186,7 @@ struct rte_mbuf {\r\n \t\tuint16_t metadata16[0];\r\n \t\tuint32_t metadata32[0];\r\n \t\tuint64_t metadata64[0];\r\n-\t};\r\n+\t} __rte_cache_aligned;\r\n } __rte_cache_aligned;\r\n \r\n #define RTE_MBUF_METADATA_UINT8(mbuf, offset)              \\\r\n@@ -468,8 +469,6 @@ void rte_pktmbuf_pool_init(struct rte_mempool *mp, void *opaque_arg);\r\n  */\r\n static inline void rte_pktmbuf_reset(struct rte_mbuf *m)\r\n {\r\n-\tuint32_t buf_ofs;\r\n-\r\n \tm->next = NULL;\r\n \tm->pkt_len = 0;\r\n \tm->vlan_macip.data = 0;\r\n@@ -477,9 +476,8 @@ static inline void rte_pktmbuf_reset(struct rte_mbuf *m)\r\n \tm->in_port = 0xff;\r\n \r\n \tm->ol_flags = 0;\r\n-\tbuf_ofs = (RTE_PKTMBUF_HEADROOM <= m->buf_len) ?\r\n+\tm->data_off = (RTE_PKTMBUF_HEADROOM <= m->buf_len) ?\r\n \t\t\tRTE_PKTMBUF_HEADROOM : m->buf_len;\r\n-\tm->data = (char*) m->buf_addr + buf_ofs;\r\n \r\n \tm->data_len = 0;\r\n \t__rte_mbuf_sanity_check(m, 1);\r\n@@ -536,7 +534,7 @@ static inline void rte_pktmbuf_attach(struct rte_mbuf *mi, struct rte_mbuf *md)\r\n \tmi->buf_len = md->buf_len;\r\n \r\n \tmi->next = md->next;\r\n-\tmi->data = md->data;\r\n+\tmi->data_off = md->data_off;\r\n \tmi->data_len = md->data_len;\r\n \tmi->in_port = md->in_port;\r\n \tmi->vlan_macip = md->vlan_macip;\r\n@@ -565,16 +563,14 @@ static inline void rte_pktmbuf_detach(struct rte_mbuf *m)\r\n {\r\n \tconst struct rte_mempool *mp = m->pool;\r\n \tvoid *buf = RTE_MBUF_TO_BADDR(m);\r\n-\tuint32_t buf_ofs;\r\n \tuint32_t buf_len = mp->elt_size - sizeof(*m);\r\n \tm->buf_physaddr = rte_mempool_virt2phy(mp, m) + sizeof (*m);\r\n \r\n \tm->buf_addr = buf;\r\n \tm->buf_len = (uint16_t)buf_len;\r\n \r\n-\tbuf_ofs = (RTE_PKTMBUF_HEADROOM <= m->buf_len) ?\r\n+\tm->data_off = (RTE_PKTMBUF_HEADROOM <= m->buf_len) ?\r\n \t\t\tRTE_PKTMBUF_HEADROOM : m->buf_len;\r\n-\tm->data = (char*) m->buf_addr + buf_ofs;\r\n \r\n \tm->data_len = 0;\r\n }\r\n@@ -738,7 +734,7 @@ static inline void rte_pktmbuf_refcnt_update(struct rte_mbuf *m, int16_t v)\r\n static inline uint16_t rte_pktmbuf_headroom(const struct rte_mbuf *m)\r\n {\r\n \t__rte_mbuf_sanity_check(m, 1);\r\n-\treturn (uint16_t) ((char*) m->data - (char*) m->buf_addr);\r\n+\treturn m->data_off;\r\n }\r\n \r\n /**\r\n@@ -786,7 +782,7 @@ static inline struct rte_mbuf *rte_pktmbuf_lastseg(struct rte_mbuf *m)\r\n  * @param t\r\n  *   The type to cast the result into.\r\n  */\r\n-#define rte_pktmbuf_mtod(m, t) ((t)((m)->data))\r\n+#define rte_pktmbuf_mtod(m, t) ((t)((char *)(m)->buf_addr + (m)->data_off))\r\n \r\n /**\r\n  * A macro that returns the length of the packet.\r\n@@ -831,11 +827,11 @@ static inline char *rte_pktmbuf_prepend(struct rte_mbuf *m,\r\n \tif (unlikely(len > rte_pktmbuf_headroom(m)))\r\n \t\treturn NULL;\r\n \r\n-\tm->data = (char*) m->data - len;\r\n+\tm->data_off -= len;\r\n \tm->data_len = (uint16_t)(m->data_len + len);\r\n \tm->pkt_len  = (m->pkt_len + len);\r\n \r\n-\treturn (char*) m->data;\r\n+\treturn (char*) m->buf_addr + m->data_off;\r\n }\r\n \r\n /**\r\n@@ -864,7 +860,7 @@ static inline char *rte_pktmbuf_append(struct rte_mbuf *m, uint16_t len)\r\n \tif (unlikely(len > rte_pktmbuf_tailroom(m_last)))\r\n \t\treturn NULL;\r\n \r\n-\ttail = (char*) m_last->data + m_last->data_len;\r\n+\ttail = (char*) m_last->buf_addr + m_last->data_off + m_last->data_len;\r\n \tm_last->data_len = (uint16_t)(m_last->data_len + len);\r\n \tm->pkt_len  = (m->pkt_len + len);\r\n \treturn (char*) tail;\r\n@@ -892,9 +888,9 @@ static inline char *rte_pktmbuf_adj(struct rte_mbuf *m, uint16_t len)\r\n \t\treturn NULL;\r\n \r\n \tm->data_len = (uint16_t)(m->data_len - len);\r\n-\tm->data = ((char*) m->data + len);\r\n+\tm->data_off += len;\r\n \tm->pkt_len  = (m->pkt_len - len);\r\n-\treturn (char*) m->data;\r\n+\treturn (char *)m->buf_addr + m->data_off;\r\n }\r\n \r\n /**\r\ndiff --git a/lib/librte_pmd_bond/rte_eth_bond_pmd.c b/lib/librte_pmd_bond/rte_eth_bond_pmd.c\r\nindex 5979ce5..506a448 100644\r\n--- a/lib/librte_pmd_bond/rte_eth_bond_pmd.c\r\n+++ b/lib/librte_pmd_bond/rte_eth_bond_pmd.c\r\n@@ -198,14 +198,14 @@ xmit_slave_hash(const struct rte_mbuf *buf, uint8_t slave_count, uint8_t policy)\r\n \r\n \tswitch (policy) {\r\n \tcase BALANCE_XMIT_POLICY_LAYER2:\r\n-\t\teth_hdr = (struct ether_hdr *)buf->data;\r\n+\t\teth_hdr = rte_pktmbuf_mtod(buf, struct ether_hdr *);\r\n \r\n \t\thash = ether_hash(eth_hdr);\r\n \t\thash ^= hash >> 8;\r\n \t\treturn hash % slave_count;\r\n \r\n \tcase BALANCE_XMIT_POLICY_LAYER23:\r\n-\t\teth_hdr = (struct ether_hdr *)buf->data;\r\n+\t\teth_hdr = rte_pktmbuf_mtod(buf, struct ether_hdr *);\r\n \r\n \t\tif (buf->ol_flags & PKT_RX_VLAN_PKT)\r\n \t\t\teth_offset = sizeof(struct ether_hdr) + sizeof(struct vlan_hdr);\r\ndiff --git a/lib/librte_pmd_e1000/em_rxtx.c b/lib/librte_pmd_e1000/em_rxtx.c\r\nindex 058e1bd..66e8544 100644\r\n--- a/lib/librte_pmd_e1000/em_rxtx.c\r\n+++ b/lib/librte_pmd_e1000/em_rxtx.c\r\n@@ -90,8 +90,7 @@ rte_rxmbuf_alloc(struct rte_mempool *mp)\r\n }\r\n \r\n #define RTE_MBUF_DATA_DMA_ADDR(mb)             \\\r\n-\t(uint64_t) ((mb)->buf_physaddr +       \\\r\n-\t(uint64_t) ((char *)((mb)->data) - (char *)(mb)->buf_addr))\r\n+\t(uint64_t) ((mb)->buf_physaddr + (mb)->data_off)\r\n \r\n #define RTE_MBUF_DATA_DMA_ADDR_DEFAULT(mb) \\\r\n \t(uint64_t) ((mb)->buf_physaddr + RTE_PKTMBUF_HEADROOM)\r\n@@ -771,8 +770,8 @@ eth_em_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,\r\n \t\t */\r\n \t\tpkt_len = (uint16_t) (rte_le_to_cpu_16(rxd.length) -\r\n \t\t\t\trxq->crc_len);\r\n-\t\trxm->data = (char*) rxm->buf_addr + RTE_PKTMBUF_HEADROOM;\r\n-\t\trte_packet_prefetch(rxm->data);\r\n+\t\trxm->data_off = RTE_PKTMBUF_HEADROOM;\r\n+\t\trte_packet_prefetch((char *)rxm->buf_addr + rxm->data_off);\r\n \t\trxm->nb_segs = 1;\r\n \t\trxm->next = NULL;\r\n \t\trxm->pkt_len = pkt_len;\r\n@@ -941,7 +940,7 @@ eth_em_recv_scattered_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,\r\n \t\t */\r\n \t\tdata_len = rte_le_to_cpu_16(rxd.length);\r\n \t\trxm->data_len = data_len;\r\n-\t\trxm->data = (char*) rxm->buf_addr + RTE_PKTMBUF_HEADROOM;\r\n+\t\trxm->data_off = RTE_PKTMBUF_HEADROOM;\r\n \r\n \t\t/*\r\n \t\t * If this is the first buffer of the received packet,\r\n@@ -1013,7 +1012,8 @@ eth_em_recv_scattered_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,\r\n \t\trxm->vlan_macip.f.vlan_tci = rte_le_to_cpu_16(rxd.special);\r\n \r\n \t\t/* Prefetch data of first segment, if configured to do so. */\r\n-\t\trte_packet_prefetch(first_seg->data);\r\n+\t\trte_packet_prefetch((char *)first_seg->buf_addr +\r\n+\t\t\tfirst_seg->data_off);\r\n \r\n \t\t/*\r\n \t\t * Store the mbuf address into the next entry of the array\r\ndiff --git a/lib/librte_pmd_e1000/igb_rxtx.c b/lib/librte_pmd_e1000/igb_rxtx.c\r\nindex 99bb9d9..e94eb8d 100644\r\n--- a/lib/librte_pmd_e1000/igb_rxtx.c\r\n+++ b/lib/librte_pmd_e1000/igb_rxtx.c\r\n@@ -95,9 +95,7 @@ rte_rxmbuf_alloc(struct rte_mempool *mp)\r\n }\r\n \r\n #define RTE_MBUF_DATA_DMA_ADDR(mb) \\\r\n-\t(uint64_t) ((mb)->buf_physaddr +\t\t   \\\r\n-\t\t\t(uint64_t) ((char *)((mb)->data) -     \\\r\n-\t\t\t\t(char *)(mb)->buf_addr))\r\n+\t(uint64_t) ((mb)->buf_physaddr + (mb)->data_off)\r\n \r\n #define RTE_MBUF_DATA_DMA_ADDR_DEFAULT(mb) \\\r\n \t(uint64_t) ((mb)->buf_physaddr + RTE_PKTMBUF_HEADROOM)\r\n@@ -753,8 +751,8 @@ eth_igb_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,\r\n \t\t */\r\n \t\tpkt_len = (uint16_t) (rte_le_to_cpu_16(rxd.wb.upper.length) -\r\n \t\t\t\t      rxq->crc_len);\r\n-\t\trxm->data = (char*) rxm->buf_addr + RTE_PKTMBUF_HEADROOM;\r\n-\t\trte_packet_prefetch(rxm->data);\r\n+\t\trxm->data_off = RTE_PKTMBUF_HEADROOM;\r\n+\t\trte_packet_prefetch((char *)rxm->buf_addr + rxm->data_off);\r\n \t\trxm->nb_segs = 1;\r\n \t\trxm->next = NULL;\r\n \t\trxm->pkt_len = pkt_len;\r\n@@ -930,7 +928,7 @@ eth_igb_recv_scattered_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,\r\n \t\t */\r\n \t\tdata_len = rte_le_to_cpu_16(rxd.wb.upper.length);\r\n \t\trxm->data_len = data_len;\r\n-\t\trxm->data = (char*) rxm->buf_addr + RTE_PKTMBUF_HEADROOM;\r\n+\t\trxm->data_off = RTE_PKTMBUF_HEADROOM;\r\n \r\n \t\t/*\r\n \t\t * If this is the first buffer of the received packet,\r\n@@ -1012,7 +1010,8 @@ eth_igb_recv_scattered_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,\r\n \t\tfirst_seg->ol_flags = pkt_flags;\r\n \r\n \t\t/* Prefetch data of first segment, if configured to do so. */\r\n-\t\trte_packet_prefetch(first_seg->data);\r\n+\t\trte_packet_prefetch((char *)first_seg->buf_addr +\r\n+\t\t\tfirst_seg->data_off);\r\n \r\n \t\t/*\r\n \t\t * Store the mbuf address into the next entry of the array\r\ndiff --git a/lib/librte_pmd_i40e/i40e_rxtx.c b/lib/librte_pmd_i40e/i40e_rxtx.c\r\nindex faf6095..fd5a784 100644\r\n--- a/lib/librte_pmd_i40e/i40e_rxtx.c\r\n+++ b/lib/librte_pmd_i40e/i40e_rxtx.c\r\n@@ -78,9 +78,7 @@\r\n \t(uint64_t) ((mb)->buf_physaddr + RTE_PKTMBUF_HEADROOM)\r\n \r\n #define RTE_MBUF_DATA_DMA_ADDR(mb) \\\r\n-\t((uint64_t)((mb)->buf_physaddr + \\\r\n-\t(uint64_t)((char *)((mb)->data) - \\\r\n-\t(char *)(mb)->buf_addr)))\r\n+\t((uint64_t)((mb)->buf_physaddr + (mb)->data_off))\r\n \r\n static const struct rte_memzone *\r\n i40e_ring_dma_zone_reserve(struct rte_eth_dev *dev,\r\n@@ -688,7 +686,7 @@ i40e_rx_alloc_bufs(struct i40e_rx_queue *rxq)\r\n \t\tmb = rxep[i].mbuf;\r\n \t\trte_mbuf_refcnt_set(mb, 1);\r\n \t\tmb->next = NULL;\r\n-\t\tmb->data = (char *)mb->buf_addr + RTE_PKTMBUF_HEADROOM;\r\n+\t\tmb->data_off = RTE_PKTMBUF_HEADROOM;\r\n \t\tmb->nb_segs = 1;\r\n \t\tmb->in_port = rxq->port_id;\r\n \t\tdma_addr = rte_cpu_to_le_64(\\\r\n@@ -845,8 +843,8 @@ i40e_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts)\r\n \t\trx_packet_len = ((qword1 & I40E_RXD_QW1_LENGTH_PBUF_MASK) >>\r\n \t\t\t\tI40E_RXD_QW1_LENGTH_PBUF_SHIFT) - rxq->crc_len;\r\n \r\n-\t\trxm->data = (char *)rxm->buf_addr + RTE_PKTMBUF_HEADROOM;\r\n-\t\trte_prefetch0(rxm->data);\r\n+\t\trxm->data_off = RTE_PKTMBUF_HEADROOM;\r\n+\t\trte_prefetch0(RTE_PTR_ADD(rxm->buf_addr, RTE_PKTMBUF_HEADROOM));\r\n \t\trxm->nb_segs = 1;\r\n \t\trxm->next = NULL;\r\n \t\trxm->pkt_len = rx_packet_len;\r\n@@ -949,7 +947,7 @@ i40e_recv_scattered_pkts(void *rx_queue,\r\n \t\trx_packet_len = (qword1 & I40E_RXD_QW1_LENGTH_PBUF_MASK) >>\r\n \t\t\t\t\tI40E_RXD_QW1_LENGTH_PBUF_SHIFT;\r\n \t\trxm->data_len = rx_packet_len;\r\n-\t\trxm->data = (char *)rxm->buf_addr + RTE_PKTMBUF_HEADROOM;\r\n+\t\trxm->data_off = RTE_PKTMBUF_HEADROOM;\r\n \r\n \t\t/**\r\n \t\t * If this is the first buffer of the received packet, set the\r\n@@ -1018,7 +1016,8 @@ i40e_recv_scattered_pkts(void *rx_queue,\r\n \t\t\t\trte_le_to_cpu_32(rxd.wb.qword0.hi_dword.rss);\r\n \r\n \t\t/* Prefetch data of first segment, if configured to do so. */\r\n-\t\trte_prefetch0(first_seg->data);\r\n+\t\trte_prefetch0(RTE_PTR_ADD(first_seg->buf_addr,\r\n+\t\t\tfirst_seg->data_off));\r\n \t\trx_pkts[nb_rx++] = first_seg;\r\n \t\tfirst_seg = NULL;\r\n \t}\r\n@@ -2020,7 +2019,7 @@ i40e_alloc_rx_queue_mbufs(struct i40e_rx_queue *rxq)\r\n \r\n \t\trte_mbuf_refcnt_set(mbuf, 1);\r\n \t\tmbuf->next = NULL;\r\n-\t\tmbuf->data = (char *)mbuf->buf_addr + RTE_PKTMBUF_HEADROOM;\r\n+\t\tmbuf->data_off = RTE_PKTMBUF_HEADROOM;\r\n \t\tmbuf->nb_segs = 1;\r\n \t\tmbuf->in_port = rxq->port_id;\r\n \r\ndiff --git a/lib/librte_pmd_ixgbe/ixgbe_rxtx.c b/lib/librte_pmd_ixgbe/ixgbe_rxtx.c\r\nindex c95e117..5d9451c 100644\r\n--- a/lib/librte_pmd_ixgbe/ixgbe_rxtx.c\r\n+++ b/lib/librte_pmd_ixgbe/ixgbe_rxtx.c\r\n@@ -996,7 +996,7 @@ ixgbe_rx_alloc_bufs(struct igb_rx_queue *rxq)\r\n \t\tmb = rxep[i].mbuf;\r\n \t\trte_mbuf_refcnt_set(mb, 1);\r\n \t\tmb->next = NULL;\r\n-\t\tmb->data = (char *)mb->buf_addr + RTE_PKTMBUF_HEADROOM;\r\n+\t\tmb->data_off = RTE_PKTMBUF_HEADROOM;\r\n \t\tmb->nb_segs = 1;\r\n \t\tmb->in_port = rxq->port_id;\r\n \r\n@@ -1247,8 +1247,8 @@ ixgbe_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,\r\n \t\t */\r\n \t\tpkt_len = (uint16_t) (rte_le_to_cpu_16(rxd.wb.upper.length) -\r\n \t\t\t\t      rxq->crc_len);\r\n-\t\trxm->data = (char*) rxm->buf_addr + RTE_PKTMBUF_HEADROOM;\r\n-\t\trte_packet_prefetch(rxm->data);\r\n+\t\trxm->data_off = RTE_PKTMBUF_HEADROOM;\r\n+\t\trte_packet_prefetch((char *)rxm->buf_addr + rxm->data_off);\r\n \t\trxm->nb_segs = 1;\r\n \t\trxm->next = NULL;\r\n \t\trxm->pkt_len = pkt_len;\r\n@@ -1431,7 +1431,7 @@ ixgbe_recv_scattered_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,\r\n \t\t */\r\n \t\tdata_len = rte_le_to_cpu_16(rxd.wb.upper.length);\r\n \t\trxm->data_len = data_len;\r\n-\t\trxm->data = (char*) rxm->buf_addr + RTE_PKTMBUF_HEADROOM;\r\n+\t\trxm->data_off = RTE_PKTMBUF_HEADROOM;\r\n \r\n \t\t/*\r\n \t\t * If this is the first buffer of the received packet,\r\n@@ -1523,7 +1523,8 @@ ixgbe_recv_scattered_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,\r\n \t\t}\r\n \r\n \t\t/* Prefetch data of first segment, if configured to do so. */\r\n-\t\trte_packet_prefetch(first_seg->data);\r\n+\t\trte_packet_prefetch((char *)first_seg->buf_addr + \r\n+\t\t\tfirst_seg->data_off);\r\n \r\n \t\t/*\r\n \t\t * Store the mbuf address into the next entry of the array\r\n@@ -3213,7 +3214,7 @@ ixgbe_alloc_rx_queue_mbufs(struct igb_rx_queue *rxq)\r\n \r\n \t\trte_mbuf_refcnt_set(mbuf, 1);\r\n \t\tmbuf->next = NULL;\r\n-\t\tmbuf->data = (char *)mbuf->buf_addr + RTE_PKTMBUF_HEADROOM;\r\n+\t\tmbuf->data_off = RTE_PKTMBUF_HEADROOM;\r\n \t\tmbuf->nb_segs = 1;\r\n \t\tmbuf->in_port = rxq->port_id;\r\n \r\ndiff --git a/lib/librte_pmd_ixgbe/ixgbe_rxtx.h b/lib/librte_pmd_ixgbe/ixgbe_rxtx.h\r\nindex 4c9cb74..8d9476d 100644\r\n--- a/lib/librte_pmd_ixgbe/ixgbe_rxtx.h\r\n+++ b/lib/librte_pmd_ixgbe/ixgbe_rxtx.h\r\n@@ -47,8 +47,7 @@\r\n #endif\r\n \r\n #define RTE_MBUF_DATA_DMA_ADDR(mb) \\\r\n-\t(uint64_t) ((mb)->buf_physaddr + (uint64_t)((char *)((mb)->data) - \\\r\n-\t(char *)(mb)->buf_addr))\r\n+\t(uint64_t) ((mb)->buf_physaddr + (mb)->data_off)\r\n \r\n #define RTE_MBUF_DATA_DMA_ADDR_DEFAULT(mb) \\\r\n \t(uint64_t) ((mb)->buf_physaddr + RTE_PKTMBUF_HEADROOM)\r\ndiff --git a/lib/librte_pmd_ixgbe/ixgbe_rxtx_vec.c b/lib/librte_pmd_ixgbe/ixgbe_rxtx_vec.c\r\nindex f9d29bf..dd02cf5 100644\r\n--- a/lib/librte_pmd_ixgbe/ixgbe_rxtx_vec.c\r\n+++ b/lib/librte_pmd_ixgbe/ixgbe_rxtx_vec.c\r\n@@ -61,7 +61,6 @@ static struct rte_mbuf mb_def = {\r\n \t.in_port = 0,\r\n \r\n \t.next = NULL,\r\n-\t.data = NULL,\r\n };\r\n \r\n static inline void\r\ndiff --git a/lib/librte_pmd_virtio/virtio_rxtx.c b/lib/librte_pmd_virtio/virtio_rxtx.c\r\nindex 07bc7b2..c154631 100644\r\n--- a/lib/librte_pmd_virtio/virtio_rxtx.c\r\n+++ b/lib/librte_pmd_virtio/virtio_rxtx.c\r\n@@ -118,7 +118,7 @@ virtqueue_dequeue_burst_rx(struct virtqueue *vq, struct rte_mbuf **rx_pkts,\r\n \t\t}\r\n \r\n \t\trte_prefetch0(cookie);\r\n-\t\trte_packet_prefetch(cookie->data);\r\n+\t\trte_packet_prefetch(rte_pktmbuf_mtod(cookie, void *));\r\n \t\trx_pkts[i]  = cookie;\r\n \t\tvq->vq_used_cons_idx++;\r\n \t\tvq_ring_free_chain(vq, desc_idx);\r\n@@ -470,7 +470,7 @@ virtio_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts)\r\n \t\t}\r\n \r\n \t\trxm->in_port = rxvq->port_id;\r\n-\t\trxm->data = (char *)rxm->buf_addr + RTE_PKTMBUF_HEADROOM;\r\n+\t\trxm->data_off = RTE_PKTMBUF_HEADROOM;\r\n \t\trxm->nb_segs = 1;\r\n \t\trxm->next = NULL;\r\n \t\trxm->pkt_len  = (uint32_t)(len[i]\r\ndiff --git a/lib/librte_pmd_virtio/virtqueue.h b/lib/librte_pmd_virtio/virtqueue.h\r\nindex d777feb..fdee054 100644\r\n--- a/lib/librte_pmd_virtio/virtqueue.h\r\n+++ b/lib/librte_pmd_virtio/virtqueue.h\r\n@@ -59,8 +59,7 @@\r\n #define VIRTQUEUE_MAX_NAME_SZ 32\r\n \r\n #define RTE_MBUF_DATA_DMA_ADDR(mb) \\\r\n-\t(uint64_t) ((mb)->buf_physaddr + (uint64_t)((char *)((mb)->data) - \\\r\n-\t(char *)(mb)->buf_addr))\r\n+\t(uint64_t) ((mb)->buf_physaddr + (mb)->data_off)\r\n \r\n #define VTNET_SQ_RQ_QUEUE_IDX 0\r\n #define VTNET_SQ_TQ_QUEUE_IDX 1\r\ndiff --git a/lib/librte_pmd_vmxnet3/vmxnet3_rxtx.c b/lib/librte_pmd_vmxnet3/vmxnet3_rxtx.c\r\nindex 7dd5a98..e033a1f 100644\r\n--- a/lib/librte_pmd_vmxnet3/vmxnet3_rxtx.c\r\n+++ b/lib/librte_pmd_vmxnet3/vmxnet3_rxtx.c\r\n@@ -79,8 +79,7 @@\r\n \r\n \r\n #define RTE_MBUF_DATA_DMA_ADDR(mb) \\\r\n-\t(uint64_t) ((mb)->buf_physaddr + (uint64_t)((char *)((mb)->data) - \\\r\n-\t(char *)(mb)->buf_addr))\r\n+\t(uint64_t) ((mb)->buf_physaddr + (mb)->data_off)\r\n \r\n #define RTE_MBUF_DATA_DMA_ADDR_DEFAULT(mb) \\\r\n \t(uint64_t) ((mb)->buf_physaddr + RTE_PKTMBUF_HEADROOM)\r\n@@ -564,7 +563,7 @@ vmxnet3_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts)\r\n \t\t\trxm->data_len = (uint16_t)rcd->len;\r\n \t\t\trxm->in_port = rxq->port_id;\r\n \t\t\trxm->vlan_macip.f.vlan_tci = 0;\r\n-\t\t\trxm->data = (char *)rxm->buf_addr + RTE_PKTMBUF_HEADROOM;\r\n+\t\t\trxm->data_off = RTE_PKTMBUF_HEADROOM;\r\n \r\n \t\t\trx_pkts[nb_rx++] = rxm;\r\n \r\n",
    "prefixes": [
        "dpdk-dev",
        "RFC",
        "04/14"
    ]
}