get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 21004,
    "url": "http://patches.dpdk.org/api/patches/21004/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/1488354455-142764-8-git-send-email-david.hunt@intel.com/",
    "project": {
        "id": 1,
        "url": "http://patches.dpdk.org/api/projects/1/?format=api",
        "name": "DPDK",
        "link_name": "dpdk",
        "list_id": "dev.dpdk.org",
        "list_email": "dev@dpdk.org",
        "web_url": "http://core.dpdk.org",
        "scm_url": "git://dpdk.org/dpdk",
        "webscm_url": "http://git.dpdk.org/dpdk",
        "list_archive_url": "https://inbox.dpdk.org/dev",
        "list_archive_url_format": "https://inbox.dpdk.org/dev/{}",
        "commit_url_format": ""
    },
    "msgid": "<1488354455-142764-8-git-send-email-david.hunt@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1488354455-142764-8-git-send-email-david.hunt@intel.com",
    "date": "2017-03-01T07:47:24",
    "name": "[dpdk-dev,v8,07/18] lib: switch distributor over to new API",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "0a0c9515b012e24c4e49c1a8bd975174e6457501",
    "submitter": {
        "id": 342,
        "url": "http://patches.dpdk.org/api/people/342/?format=api",
        "name": "Hunt, David",
        "email": "david.hunt@intel.com"
    },
    "delegate": null,
    "mbox": "http://patches.dpdk.org/project/dpdk/patch/1488354455-142764-8-git-send-email-david.hunt@intel.com/mbox/",
    "series": [],
    "comments": "http://patches.dpdk.org/api/patches/21004/comments/",
    "check": "success",
    "checks": "http://patches.dpdk.org/api/patches/21004/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 4CDD1F952;\n\tWed,  1 Mar 2017 15:47:47 +0100 (CET)",
            "from mga09.intel.com (mga09.intel.com [134.134.136.24])\n\tby dpdk.org (Postfix) with ESMTP id A060B2BDF\n\tfor <dev@dpdk.org>; Wed,  1 Mar 2017 15:47:16 +0100 (CET)",
            "from fmsmga001.fm.intel.com ([10.253.24.23])\n\tby orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t01 Mar 2017 06:47:16 -0800",
            "from silpixa00397515.ir.intel.com (HELO\n\tsilpixa00397515.ger.corp.intel.com) ([10.237.223.14])\n\tby fmsmga001.fm.intel.com with ESMTP; 01 Mar 2017 06:47:13 -0800"
        ],
        "X-ExtLoop1": "1",
        "X-IronPort-AV": "E=Sophos; i=\"5.35,226,1484035200\"; d=\"scan'208\";\n\ta=\"1117076528\"",
        "From": "David Hunt <david.hunt@intel.com>",
        "To": "dev@dpdk.org",
        "Cc": "bruce.richardson@intel.com,\n\tDavid Hunt <david.hunt@intel.com>",
        "Date": "Wed,  1 Mar 2017 07:47:24 +0000",
        "Message-Id": "<1488354455-142764-8-git-send-email-david.hunt@intel.com>",
        "X-Mailer": "git-send-email 2.7.4",
        "In-Reply-To": "<1488354455-142764-1-git-send-email-david.hunt@intel.com>",
        "References": "<1487647073-129064-2-git-send-email-david.hunt@intel.com>\n\t<1488354455-142764-1-git-send-email-david.hunt@intel.com>",
        "Subject": "[dpdk-dev] [PATCH v8 07/18] lib: switch distributor over to new API",
        "X-BeenThere": "dev@dpdk.org",
        "X-Mailman-Version": "2.1.15",
        "Precedence": "list",
        "List-Id": "DPDK patches and discussions <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 the main switch over between the legacy API and the new\nburst API. We rename all the functions in rte_distributor.c to remove\nthe _v1705, and we add in _v20 in the rte_distributor_v20.c\n\nAt the same time, we need the autotests and sample app to compile\nproperly, hence thosie changes are in there as well.\n\nSigned-off-by: David Hunt <david.hunt@intel.com>\n---\n examples/distributor/main.c                        |  22 +-\n lib/librte_distributor/rte_distributor.c           |  76 +++---\n lib/librte_distributor/rte_distributor.h           | 240 +++++++++++++++++-\n lib/librte_distributor/rte_distributor_match_sse.c |   2 +-\n lib/librte_distributor/rte_distributor_private.h   |  22 +-\n lib/librte_distributor/rte_distributor_v1705.h     | 269 ---------------------\n lib/librte_distributor/rte_distributor_v20.c       |  46 ++--\n lib/librte_distributor/rte_distributor_v20.h       |  24 +-\n test/test/test_distributor.c                       | 235 ++++++++++++------\n test/test/test_distributor_perf.c                  |  26 +-\n 10 files changed, 511 insertions(+), 451 deletions(-)\n delete mode 100644 lib/librte_distributor/rte_distributor_v1705.h",
    "diff": "diff --git a/examples/distributor/main.c b/examples/distributor/main.c\nindex e7641d2..cc3bdb0 100644\n--- a/examples/distributor/main.c\n+++ b/examples/distributor/main.c\n@@ -405,17 +405,30 @@ lcore_worker(struct lcore_params *p)\n {\n \tstruct rte_distributor *d = p->d;\n \tconst unsigned id = p->worker_id;\n+\tunsigned int num = 0;\n+\tunsigned int i;\n+\n \t/*\n \t * for single port, xor_val will be zero so we won't modify the output\n \t * port, otherwise we send traffic from 0 to 1, 2 to 3, and vice versa\n \t */\n \tconst unsigned xor_val = (rte_eth_dev_count() > 1);\n-\tstruct rte_mbuf *buf = NULL;\n+\tstruct rte_mbuf *buf[8] __rte_cache_aligned;\n+\n+\tfor (i = 0; i < 8; i++)\n+\t\tbuf[i] = NULL;\n \n \tprintf(\"\\nCore %u acting as worker core.\\n\", rte_lcore_id());\n \twhile (!quit_signal) {\n-\t\tbuf = rte_distributor_get_pkt(d, id, buf);\n-\t\tbuf->port ^= xor_val;\n+\t\tnum = rte_distributor_get_pkt(d, id, buf, buf, num);\n+\t\t/* Do a little bit of work for each packet */\n+\t\tfor (i = 0; i < num; i++) {\n+\t\t\tuint64_t t = rte_rdtsc()+100;\n+\n+\t\t\twhile (rte_rdtsc() < t)\n+\t\t\t\trte_pause();\n+\t\t\tbuf[i]->port ^= xor_val;\n+\t\t}\n \t}\n \treturn 0;\n }\n@@ -561,7 +574,8 @@ main(int argc, char *argv[])\n \t}\n \n \td = rte_distributor_create(\"PKT_DIST\", rte_socket_id(),\n-\t\t\trte_lcore_count() - 2);\n+\t\t\trte_lcore_count() - 2,\n+\t\t\tRTE_DIST_ALG_BURST);\n \tif (d == NULL)\n \t\trte_exit(EXIT_FAILURE, \"Cannot create distributor\\n\");\n \ndiff --git a/lib/librte_distributor/rte_distributor.c b/lib/librte_distributor/rte_distributor.c\nindex 51c9ad9..6e1debf 100644\n--- a/lib/librte_distributor/rte_distributor.c\n+++ b/lib/librte_distributor/rte_distributor.c\n@@ -42,10 +42,10 @@\n #include <rte_eal_memconfig.h>\n #include <rte_compat.h>\n #include \"rte_distributor_private.h\"\n-#include \"rte_distributor_v1705.h\"\n+#include \"rte_distributor.h\"\n #include \"rte_distributor_v20.h\"\n \n-TAILQ_HEAD(rte_dist_burst_list, rte_distributor_v1705);\n+TAILQ_HEAD(rte_dist_burst_list, rte_distributor);\n \n static struct rte_tailq_elem rte_dist_burst_tailq = {\n \t.name = \"RTE_DIST_BURST\",\n@@ -57,17 +57,17 @@ EAL_REGISTER_TAILQ(rte_dist_burst_tailq)\n /**** Burst Packet APIs called by workers ****/\n \n void\n-rte_distributor_request_pkt_v1705(struct rte_distributor_v1705 *d,\n+rte_distributor_request_pkt(struct rte_distributor *d,\n \t\tunsigned int worker_id, struct rte_mbuf **oldpkt,\n \t\tunsigned int count)\n {\n-\tstruct rte_distributor_buffer_v1705 *buf = &(d->bufs[worker_id]);\n+\tstruct rte_distributor_buffer *buf = &(d->bufs[worker_id]);\n \tunsigned int i;\n \n \tvolatile int64_t *retptr64;\n \n \tif (unlikely(d->alg_type == RTE_DIST_ALG_SINGLE)) {\n-\t\trte_distributor_request_pkt(d->d_v20,\n+\t\trte_distributor_request_pkt_v20(d->d_v20,\n \t\t\tworker_id, oldpkt[0]);\n \t\treturn;\n \t}\n@@ -104,16 +104,16 @@ rte_distributor_request_pkt_v1705(struct rte_distributor_v1705 *d,\n }\n \n int\n-rte_distributor_poll_pkt_v1705(struct rte_distributor_v1705 *d,\n+rte_distributor_poll_pkt(struct rte_distributor *d,\n \t\tunsigned int worker_id, struct rte_mbuf **pkts)\n {\n-\tstruct rte_distributor_buffer_v1705 *buf = &d->bufs[worker_id];\n+\tstruct rte_distributor_buffer *buf = &d->bufs[worker_id];\n \tuint64_t ret;\n \tint count = 0;\n \tunsigned int i;\n \n \tif (unlikely(d->alg_type == RTE_DIST_ALG_SINGLE)) {\n-\t\tpkts[0] = rte_distributor_poll_pkt(d->d_v20, worker_id);\n+\t\tpkts[0] = rte_distributor_poll_pkt_v20(d->d_v20, worker_id);\n \t\treturn (pkts[0]) ? 1 : 0;\n \t}\n \n@@ -140,7 +140,7 @@ rte_distributor_poll_pkt_v1705(struct rte_distributor_v1705 *d,\n }\n \n int\n-rte_distributor_get_pkt_v1705(struct rte_distributor_v1705 *d,\n+rte_distributor_get_pkt(struct rte_distributor *d,\n \t\tunsigned int worker_id, struct rte_mbuf **pkts,\n \t\tstruct rte_mbuf **oldpkt, unsigned int return_count)\n {\n@@ -148,37 +148,37 @@ rte_distributor_get_pkt_v1705(struct rte_distributor_v1705 *d,\n \n \tif (unlikely(d->alg_type == RTE_DIST_ALG_SINGLE)) {\n \t\tif (return_count <= 1) {\n-\t\t\tpkts[0] = rte_distributor_get_pkt(d->d_v20,\n+\t\t\tpkts[0] = rte_distributor_get_pkt_v20(d->d_v20,\n \t\t\t\tworker_id, oldpkt[0]);\n \t\t\treturn (pkts[0]) ? 1 : 0;\n \t\t} else\n \t\t\treturn -EINVAL;\n \t}\n \n-\trte_distributor_request_pkt_v1705(d, worker_id, oldpkt, return_count);\n+\trte_distributor_request_pkt(d, worker_id, oldpkt, return_count);\n \n-\tcount = rte_distributor_poll_pkt_v1705(d, worker_id, pkts);\n+\tcount = rte_distributor_poll_pkt(d, worker_id, pkts);\n \twhile (count == -1) {\n \t\tuint64_t t = rte_rdtsc() + 100;\n \n \t\twhile (rte_rdtsc() < t)\n \t\t\trte_pause();\n \n-\t\tcount = rte_distributor_poll_pkt_v1705(d, worker_id, pkts);\n+\t\tcount = rte_distributor_poll_pkt(d, worker_id, pkts);\n \t}\n \treturn count;\n }\n \n int\n-rte_distributor_return_pkt_v1705(struct rte_distributor_v1705 *d,\n+rte_distributor_return_pkt(struct rte_distributor *d,\n \t\tunsigned int worker_id, struct rte_mbuf **oldpkt, int num)\n {\n-\tstruct rte_distributor_buffer_v1705 *buf = &d->bufs[worker_id];\n+\tstruct rte_distributor_buffer *buf = &d->bufs[worker_id];\n \tunsigned int i;\n \n \tif (unlikely(d->alg_type == RTE_DIST_ALG_SINGLE)) {\n \t\tif (num == 1)\n-\t\t\treturn rte_distributor_return_pkt(d->d_v20,\n+\t\t\treturn rte_distributor_return_pkt_v20(d->d_v20,\n \t\t\t\tworker_id, oldpkt[0]);\n \t\telse\n \t\t\treturn -EINVAL;\n@@ -202,7 +202,7 @@ rte_distributor_return_pkt_v1705(struct rte_distributor_v1705 *d,\n \n /* stores a packet returned from a worker inside the returns array */\n static inline void\n-store_return(uintptr_t oldbuf, struct rte_distributor_v1705 *d,\n+store_return(uintptr_t oldbuf, struct rte_distributor *d,\n \t\tunsigned int *ret_start, unsigned int *ret_count)\n {\n \tif (!oldbuf)\n@@ -221,7 +221,7 @@ store_return(uintptr_t oldbuf, struct rte_distributor_v1705 *d,\n  * workers to give us our atomic flow pinning.\n  */\n void\n-find_match_scalar(struct rte_distributor_v1705 *d,\n+find_match_scalar(struct rte_distributor *d,\n \t\t\tuint16_t *data_ptr,\n \t\t\tuint16_t *output_ptr)\n {\n@@ -270,9 +270,9 @@ find_match_scalar(struct rte_distributor_v1705 *d,\n  * the valid returned pointers (store_return).\n  */\n static unsigned int\n-handle_returns(struct rte_distributor_v1705 *d, unsigned int wkr)\n+handle_returns(struct rte_distributor *d, unsigned int wkr)\n {\n-\tstruct rte_distributor_buffer_v1705 *buf = &(d->bufs[wkr]);\n+\tstruct rte_distributor_buffer *buf = &(d->bufs[wkr]);\n \tuintptr_t oldbuf;\n \tunsigned int ret_start = d->returns.start,\n \t\t\tret_count = d->returns.count;\n@@ -308,9 +308,9 @@ handle_returns(struct rte_distributor_v1705 *d, unsigned int wkr)\n  * before sending out new packets.\n  */\n static unsigned int\n-release(struct rte_distributor_v1705 *d, unsigned int wkr)\n+release(struct rte_distributor *d, unsigned int wkr)\n {\n-\tstruct rte_distributor_buffer_v1705 *buf = &(d->bufs[wkr]);\n+\tstruct rte_distributor_buffer *buf = &(d->bufs[wkr]);\n \tunsigned int i;\n \n \twhile (!(d->bufs[wkr].bufptr64[0] & RTE_DISTRIB_GET_BUF))\n@@ -342,7 +342,7 @@ release(struct rte_distributor_v1705 *d, unsigned int wkr)\n \n /* process a set of packets to distribute them to workers */\n int\n-rte_distributor_process_v1705(struct rte_distributor_v1705 *d,\n+rte_distributor_process(struct rte_distributor *d,\n \t\tstruct rte_mbuf **mbufs, unsigned int num_mbufs)\n {\n \tunsigned int next_idx = 0;\n@@ -355,7 +355,7 @@ rte_distributor_process_v1705(struct rte_distributor_v1705 *d,\n \n \tif (d->alg_type == RTE_DIST_ALG_SINGLE) {\n \t\t/* Call the old API */\n-\t\treturn rte_distributor_process(d->d_v20, mbufs, num_mbufs);\n+\t\treturn rte_distributor_process_v20(d->d_v20, mbufs, num_mbufs);\n \t}\n \n \tif (unlikely(num_mbufs == 0)) {\n@@ -479,7 +479,7 @@ rte_distributor_process_v1705(struct rte_distributor_v1705 *d,\n \n /* return to the caller, packets returned from workers */\n int\n-rte_distributor_returned_pkts_v1705(struct rte_distributor_v1705 *d,\n+rte_distributor_returned_pkts(struct rte_distributor *d,\n \t\tstruct rte_mbuf **mbufs, unsigned int max_mbufs)\n {\n \tstruct rte_distributor_returned_pkts *returns = &d->returns;\n@@ -489,7 +489,7 @@ rte_distributor_returned_pkts_v1705(struct rte_distributor_v1705 *d,\n \n \tif (d->alg_type == RTE_DIST_ALG_SINGLE) {\n \t\t/* Call the old API */\n-\t\treturn rte_distributor_returned_pkts(d->d_v20,\n+\t\treturn rte_distributor_returned_pkts_v20(d->d_v20,\n \t\t\t\tmbufs, max_mbufs);\n \t}\n \n@@ -510,7 +510,7 @@ rte_distributor_returned_pkts_v1705(struct rte_distributor_v1705 *d,\n  * being workered on or queued up in a backlog.\n  */\n static inline unsigned int\n-total_outstanding(const struct rte_distributor_v1705 *d)\n+total_outstanding(const struct rte_distributor *d)\n {\n \tunsigned int wkr, total_outstanding = 0;\n \n@@ -525,24 +525,24 @@ total_outstanding(const struct rte_distributor_v1705 *d)\n  * queued up.\n  */\n int\n-rte_distributor_flush_v1705(struct rte_distributor_v1705 *d)\n+rte_distributor_flush(struct rte_distributor *d)\n {\n \tconst unsigned int flushed = total_outstanding(d);\n \tunsigned int wkr;\n \n \tif (d->alg_type == RTE_DIST_ALG_SINGLE) {\n \t\t/* Call the old API */\n-\t\treturn rte_distributor_flush(d->d_v20);\n+\t\treturn rte_distributor_flush_v20(d->d_v20);\n \t}\n \n \twhile (total_outstanding(d) > 0)\n-\t\trte_distributor_process_v1705(d, NULL, 0);\n+\t\trte_distributor_process(d, NULL, 0);\n \n \t/*\n \t * Send empty burst to all workers to allow them to exit\n \t * gracefully, should they need to.\n \t */\n-\trte_distributor_process_v1705(d, NULL, 0);\n+\trte_distributor_process(d, NULL, 0);\n \n \tfor (wkr = 0; wkr < d->num_workers; wkr++)\n \t\thandle_returns(d, wkr);\n@@ -552,13 +552,13 @@ rte_distributor_flush_v1705(struct rte_distributor_v1705 *d)\n \n /* clears the internal returns array in the distributor */\n void\n-rte_distributor_clear_returns_v1705(struct rte_distributor_v1705 *d)\n+rte_distributor_clear_returns(struct rte_distributor *d)\n {\n \tunsigned int wkr;\n \n \tif (d->alg_type == RTE_DIST_ALG_SINGLE) {\n \t\t/* Call the old API */\n-\t\trte_distributor_clear_returns(d->d_v20);\n+\t\trte_distributor_clear_returns_v20(d->d_v20);\n \t}\n \n \t/* throw away returns, so workers can exit */\n@@ -567,13 +567,13 @@ rte_distributor_clear_returns_v1705(struct rte_distributor_v1705 *d)\n }\n \n /* creates a distributor instance */\n-struct rte_distributor_v1705 *\n-rte_distributor_create_v1705(const char *name,\n+struct rte_distributor *\n+rte_distributor_create(const char *name,\n \t\tunsigned int socket_id,\n \t\tunsigned int num_workers,\n \t\tunsigned int alg_type)\n {\n-\tstruct rte_distributor_v1705 *d;\n+\tstruct rte_distributor *d;\n \tstruct rte_dist_burst_list *dist_burst_list;\n \tchar mz_name[RTE_MEMZONE_NAMESIZE];\n \tconst struct rte_memzone *mz;\n@@ -586,8 +586,8 @@ rte_distributor_create_v1705(const char *name,\n \tRTE_BUILD_BUG_ON((RTE_DISTRIB_MAX_WORKERS & 7) != 0);\n \n \tif (alg_type == RTE_DIST_ALG_SINGLE) {\n-\t\td = malloc(sizeof(struct rte_distributor_v1705));\n-\t\td->d_v20 = rte_distributor_create(name,\n+\t\td = malloc(sizeof(struct rte_distributor));\n+\t\td->d_v20 = rte_distributor_create_v20(name,\n \t\t\t\tsocket_id, num_workers);\n \t\tif (d->d_v20 == NULL) {\n \t\t\t/* rte_errno will have been set */\ndiff --git a/lib/librte_distributor/rte_distributor.h b/lib/librte_distributor/rte_distributor.h\nindex e41d522..9b9efdb 100644\n--- a/lib/librte_distributor/rte_distributor.h\n+++ b/lib/librte_distributor/rte_distributor.h\n@@ -1,8 +1,7 @@\n /*-\n  *   BSD LICENSE\n  *\n- *   Copyright(c) 2010-2014 Intel Corporation. All rights reserved.\n- *   All rights reserved.\n+ *   Copyright(c) 2017 Intel Corporation. All rights reserved.\n  *\n  *   Redistribution and use in source and binary forms, with or without\n  *   modification, are permitted provided that the following conditions\n@@ -31,9 +30,240 @@\n  *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n  */\n \n-#ifndef _RTE_DISTRIBUTE_H_\n-#define _RTE_DISTRIBUTE_H_\n+#ifndef _RTE_DISTRIBUTOR_H_\n+#define _RTE_DISTRIBUTOR_H_\n \n-#include <rte_distributor_v20.h>\n+/**\n+ * @file\n+ * RTE distributor\n+ *\n+ * The distributor is a component which is designed to pass packets\n+ * one-at-a-time to workers, with dynamic load balancing.\n+ */\n+\n+#ifdef __cplusplus\n+extern \"C\" {\n+#endif\n+\n+/* Type of distribution (burst/single) */\n+enum rte_distributor_alg_type {\n+\tRTE_DIST_ALG_BURST = 0,\n+\tRTE_DIST_ALG_SINGLE,\n+\tRTE_DIST_NUM_ALG_TYPES\n+};\n+\n+struct rte_distributor;\n+struct rte_mbuf;\n+\n+/**\n+ * Function to create a new distributor instance\n+ *\n+ * Reserves the memory needed for the distributor operation and\n+ * initializes the distributor to work with the configured number of workers.\n+ *\n+ * @param name\n+ *   The name to be given to the distributor instance.\n+ * @param socket_id\n+ *   The NUMA node on which the memory is to be allocated\n+ * @param num_workers\n+ *   The maximum number of workers that will request packets from this\n+ *   distributor\n+ * @param alg_type\n+ *   Call the legacy API, or use the new burst API. legacy uses 32-bit\n+ *   flow ID, and works on a single packet at a time. Latest uses 15-\n+ *   bit flow ID and works on up to 8 packets at a time to worers.\n+ * @return\n+ *   The newly created distributor instance\n+ */\n+struct rte_distributor *\n+rte_distributor_create(const char *name, unsigned int socket_id,\n+\t\tunsigned int num_workers,\n+\t\tunsigned int alg_type);\n+\n+/*  *** APIS to be called on the distributor lcore ***  */\n+/*\n+ * The following APIs are the public APIs which are designed for use on a\n+ * single lcore which acts as the distributor lcore for a given distributor\n+ * instance. These functions cannot be called on multiple cores simultaneously\n+ * without using locking to protect access to the internals of the distributor.\n+ *\n+ * NOTE: a given lcore cannot act as both a distributor lcore and a worker lcore\n+ * for the same distributor instance, otherwise deadlock will result.\n+ */\n+\n+/**\n+ * Process a set of packets by distributing them among workers that request\n+ * packets. The distributor will ensure that no two packets that have the\n+ * same flow id, or tag, in the mbuf will be processed on different cores at\n+ * the same time.\n+ *\n+ * The user is advocated to set tag for each mbuf before calling this function.\n+ * If user doesn't set the tag, the tag value can be various values depending on\n+ * driver implementation and configuration.\n+ *\n+ * This is not multi-thread safe and should only be called on a single lcore.\n+ *\n+ * @param d\n+ *   The distributor instance to be used\n+ * @param mbufs\n+ *   The mbufs to be distributed\n+ * @param num_mbufs\n+ *   The number of mbufs in the mbufs array\n+ * @return\n+ *   The number of mbufs processed.\n+ */\n+int\n+rte_distributor_process(struct rte_distributor *d,\n+\t\tstruct rte_mbuf **mbufs, unsigned int num_mbufs);\n+\n+/**\n+ * Get a set of mbufs that have been returned to the distributor by workers\n+ *\n+ * This should only be called on the same lcore as rte_distributor_process()\n+ *\n+ * @param d\n+ *   The distributor instance to be used\n+ * @param mbufs\n+ *   The mbufs pointer array to be filled in\n+ * @param max_mbufs\n+ *   The size of the mbufs array\n+ * @return\n+ *   The number of mbufs returned in the mbufs array.\n+ */\n+int\n+rte_distributor_returned_pkts(struct rte_distributor *d,\n+\t\tstruct rte_mbuf **mbufs, unsigned int max_mbufs);\n+\n+/**\n+ * Flush the distributor component, so that there are no in-flight or\n+ * backlogged packets awaiting processing\n+ *\n+ * This should only be called on the same lcore as rte_distributor_process()\n+ *\n+ * @param d\n+ *   The distributor instance to be used\n+ * @return\n+ *   The number of queued/in-flight packets that were completed by this call.\n+ */\n+int\n+rte_distributor_flush(struct rte_distributor *d);\n+\n+/**\n+ * Clears the array of returned packets used as the source for the\n+ * rte_distributor_returned_pkts() API call.\n+ *\n+ * This should only be called on the same lcore as rte_distributor_process()\n+ *\n+ * @param d\n+ *   The distributor instance to be used\n+ */\n+void\n+rte_distributor_clear_returns(struct rte_distributor *d);\n+\n+/*  *** APIS to be called on the worker lcores ***  */\n+/*\n+ * The following APIs are the public APIs which are designed for use on\n+ * multiple lcores which act as workers for a distributor. Each lcore should use\n+ * a unique worker id when requesting packets.\n+ *\n+ * NOTE: a given lcore cannot act as both a distributor lcore and a worker lcore\n+ * for the same distributor instance, otherwise deadlock will result.\n+ */\n+\n+/**\n+ * API called by a worker to get new packets to process. Any previous packets\n+ * given to the worker is assumed to have completed processing, and may be\n+ * optionally returned to the distributor via the oldpkt parameter.\n+ *\n+ * @param d\n+ *   The distributor instance to be used\n+ * @param worker_id\n+ *   The worker instance number to use - must be less that num_workers passed\n+ *   at distributor creation time.\n+ * @param pkts\n+ *   The mbufs pointer array to be filled in (up to 8 packets)\n+ * @param oldpkt\n+ *   The previous packet, if any, being processed by the worker\n+ * @param retcount\n+ *   The number of packets being returned\n+ *\n+ * @return\n+ *   The number of packets in the pkts array\n+ */\n+int\n+rte_distributor_get_pkt(struct rte_distributor *d,\n+\tunsigned int worker_id, struct rte_mbuf **pkts,\n+\tstruct rte_mbuf **oldpkt, unsigned int retcount);\n+\n+/**\n+ * API called by a worker to return a completed packet without requesting a\n+ * new packet, for example, because a worker thread is shutting down\n+ *\n+ * @param d\n+ *   The distributor instance to be used\n+ * @param worker_id\n+ *   The worker instance number to use - must be less that num_workers passed\n+ *   at distributor creation time.\n+ * @param oldpkt\n+ *   The previous packets being processed by the worker\n+ * @param num\n+ *   The number of packets in the oldpkt array\n+ */\n+int\n+rte_distributor_return_pkt(struct rte_distributor *d,\n+\tunsigned int worker_id, struct rte_mbuf **oldpkt, int num);\n+\n+/**\n+ * API called by a worker to request a new packet to process.\n+ * Any previous packet given to the worker is assumed to have completed\n+ * processing, and may be optionally returned to the distributor via\n+ * the oldpkt parameter.\n+ * Unlike rte_distributor_get_pkt_burst(), this function does not wait for a\n+ * new packet to be provided by the distributor.\n+ *\n+ * NOTE: after calling this function, rte_distributor_poll_pkt_burst() should\n+ * be used to poll for the packet requested. The rte_distributor_get_pkt_burst()\n+ * API should *not* be used to try and retrieve the new packet.\n+ *\n+ * @param d\n+ *   The distributor instance to be used\n+ * @param worker_id\n+ *   The worker instance number to use - must be less that num_workers passed\n+ *   at distributor creation time.\n+ * @param oldpkt\n+ *   The returning packets, if any, processed by the worker\n+ * @param count\n+ *   The number of returning packets\n+ */\n+void\n+rte_distributor_request_pkt(struct rte_distributor *d,\n+\t\tunsigned int worker_id, struct rte_mbuf **oldpkt,\n+\t\tunsigned int count);\n+\n+/**\n+ * API called by a worker to check for a new packet that was previously\n+ * requested by a call to rte_distributor_request_pkt(). It does not wait\n+ * for the new packet to be available, but returns NULL if the request has\n+ * not yet been fulfilled by the distributor.\n+ *\n+ * @param d\n+ *   The distributor instance to be used\n+ * @param worker_id\n+ *   The worker instance number to use - must be less that num_workers passed\n+ *   at distributor creation time.\n+ * @param mbufs\n+ *   The array of mbufs being given to the worker\n+ *\n+ * @return\n+ *   The number of packets being given to the worker thread, zero if no\n+ *   packet is yet available.\n+ */\n+int\n+rte_distributor_poll_pkt(struct rte_distributor *d,\n+\t\tunsigned int worker_id, struct rte_mbuf **mbufs);\n+\n+#ifdef __cplusplus\n+}\n+#endif\n \n #endif\ndiff --git a/lib/librte_distributor/rte_distributor_match_sse.c b/lib/librte_distributor/rte_distributor_match_sse.c\nindex b9f9bb0..44935a6 100644\n--- a/lib/librte_distributor/rte_distributor_match_sse.c\n+++ b/lib/librte_distributor/rte_distributor_match_sse.c\n@@ -38,7 +38,7 @@\n \n \n void\n-find_match_vec(struct rte_distributor_v1705 *d,\n+find_match_vec(struct rte_distributor *d,\n \t\t\tuint16_t *data_ptr,\n \t\t\tuint16_t *output_ptr)\n {\ndiff --git a/lib/librte_distributor/rte_distributor_private.h b/lib/librte_distributor/rte_distributor_private.h\nindex 92052b1..fb5a43a 100644\n--- a/lib/librte_distributor/rte_distributor_private.h\n+++ b/lib/librte_distributor/rte_distributor_private.h\n@@ -83,7 +83,7 @@ extern \"C\" {\n  * the next cache line to worker 0, we pad this out to three cache lines.\n  * Only 64-bits of the memory is actually used though.\n  */\n-union rte_distributor_buffer {\n+union rte_distributor_buffer_v20 {\n \tvolatile int64_t bufptr64;\n \tchar pad[RTE_CACHE_LINE_SIZE*3];\n } __rte_cache_aligned;\n@@ -108,8 +108,8 @@ struct rte_distributor_returned_pkts {\n \tstruct rte_mbuf *mbufs[RTE_DISTRIB_MAX_RETURNS];\n };\n \n-struct rte_distributor {\n-\tTAILQ_ENTRY(rte_distributor) next;    /**< Next in list. */\n+struct rte_distributor_v20 {\n+\tTAILQ_ENTRY(rte_distributor_v20) next;    /**< Next in list. */\n \n \tchar name[RTE_DISTRIBUTOR_NAMESIZE];  /**< Name of the ring. */\n \tunsigned int num_workers;             /**< Number of workers polling */\n@@ -124,7 +124,7 @@ struct rte_distributor {\n \n \tstruct rte_distributor_backlog backlog[RTE_DISTRIB_MAX_WORKERS];\n \n-\tunion rte_distributor_buffer bufs[RTE_DISTRIB_MAX_WORKERS];\n+\tunion rte_distributor_buffer_v20 bufs[RTE_DISTRIB_MAX_WORKERS];\n \n \tstruct rte_distributor_returned_pkts returns;\n };\n@@ -144,7 +144,7 @@ enum rte_distributor_match_function {\n  * We can pass up to 8 mbufs at a time in one cacheline.\n  * There is a separate cacheline for returns in the burst API.\n  */\n-struct rte_distributor_buffer_v1705 {\n+struct rte_distributor_buffer {\n \tvolatile int64_t bufptr64[RTE_DIST_BURST_SIZE]\n \t\t__rte_cache_aligned; /* <= outgoing to worker */\n \n@@ -158,8 +158,8 @@ struct rte_distributor_buffer_v1705 {\n \tint count __rte_cache_aligned;       /* <= number of current mbufs */\n };\n \n-struct rte_distributor_v1705 {\n-\tTAILQ_ENTRY(rte_distributor_v1705) next;    /**< Next in list. */\n+struct rte_distributor {\n+\tTAILQ_ENTRY(rte_distributor) next;    /**< Next in list. */\n \n \tchar name[RTE_DISTRIBUTOR_NAMESIZE];  /**< Name of the ring. */\n \tunsigned int num_workers;             /**< Number of workers polling */\n@@ -176,22 +176,22 @@ struct rte_distributor_v1705 {\n \tstruct rte_distributor_backlog backlog[RTE_DISTRIB_MAX_WORKERS]\n \t\t\t__rte_cache_aligned;\n \n-\tstruct rte_distributor_buffer_v1705 bufs[RTE_DISTRIB_MAX_WORKERS];\n+\tstruct rte_distributor_buffer bufs[RTE_DISTRIB_MAX_WORKERS];\n \n \tstruct rte_distributor_returned_pkts returns;\n \n \tenum rte_distributor_match_function dist_match_fn;\n \n-\tstruct rte_distributor *d_v20;\n+\tstruct rte_distributor_v20 *d_v20;\n };\n \n void\n-find_match_scalar(struct rte_distributor_v1705 *d,\n+find_match_scalar(struct rte_distributor *d,\n \t\t\tuint16_t *data_ptr,\n \t\t\tuint16_t *output_ptr);\n \n void\n-find_match_vec(struct rte_distributor_v1705 *d,\n+find_match_vec(struct rte_distributor *d,\n \t\t\tuint16_t *data_ptr,\n \t\t\tuint16_t *output_ptr);\n \ndiff --git a/lib/librte_distributor/rte_distributor_v1705.h b/lib/librte_distributor/rte_distributor_v1705.h\ndeleted file mode 100644\nindex 0034020..0000000\n--- a/lib/librte_distributor/rte_distributor_v1705.h\n+++ /dev/null\n@@ -1,269 +0,0 @@\n-/*-\n- *   BSD LICENSE\n- *\n- *   Copyright(c) 2017 Intel Corporation. All rights reserved.\n- *\n- *   Redistribution and use in source and binary forms, with or without\n- *   modification, are permitted provided that the following conditions\n- *   are met:\n- *\n- *     * Redistributions of source code must retain the above copyright\n- *       notice, this list of conditions and the following disclaimer.\n- *     * Redistributions in binary form must reproduce the above copyright\n- *       notice, this list of conditions and the following disclaimer in\n- *       the documentation and/or other materials provided with the\n- *       distribution.\n- *     * Neither the name of Intel Corporation nor the names of its\n- *       contributors may be used to endorse or promote products derived\n- *       from this software without specific prior written permission.\n- *\n- *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n- *   \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n- *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n- *   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n- *   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n- *   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n- *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n- *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n- *   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n- *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n- *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n- */\n-\n-#ifndef _RTE_DISTRIBUTOR_H_\n-#define _RTE_DISTRIBUTOR_H_\n-\n-/**\n- * @file\n- * RTE distributor\n- *\n- * The distributor is a component which is designed to pass packets\n- * one-at-a-time to workers, with dynamic load balancing.\n- */\n-\n-#ifdef __cplusplus\n-extern \"C\" {\n-#endif\n-\n-/* Type of distribution (burst/single) */\n-enum rte_distributor_alg_type {\n-\tRTE_DIST_ALG_BURST = 0,\n-\tRTE_DIST_ALG_SINGLE,\n-\tRTE_DIST_NUM_ALG_TYPES\n-};\n-\n-struct rte_distributor_v1705;\n-struct rte_mbuf;\n-\n-/**\n- * Function to create a new distributor instance\n- *\n- * Reserves the memory needed for the distributor operation and\n- * initializes the distributor to work with the configured number of workers.\n- *\n- * @param name\n- *   The name to be given to the distributor instance.\n- * @param socket_id\n- *   The NUMA node on which the memory is to be allocated\n- * @param num_workers\n- *   The maximum number of workers that will request packets from this\n- *   distributor\n- * @param alg_type\n- *   Call the legacy API, or use the new burst API. legacy uses 32-bit\n- *   flow ID, and works on a single packet at a time. Latest uses 15-\n- *   bit flow ID and works on up to 8 packets at a time to worers.\n- * @return\n- *   The newly created distributor instance\n- */\n-struct rte_distributor_v1705 *\n-rte_distributor_create_v1705(const char *name, unsigned int socket_id,\n-\t\tunsigned int num_workers,\n-\t\tunsigned int alg_type);\n-\n-/*  *** APIS to be called on the distributor lcore ***  */\n-/*\n- * The following APIs are the public APIs which are designed for use on a\n- * single lcore which acts as the distributor lcore for a given distributor\n- * instance. These functions cannot be called on multiple cores simultaneously\n- * without using locking to protect access to the internals of the distributor.\n- *\n- * NOTE: a given lcore cannot act as both a distributor lcore and a worker lcore\n- * for the same distributor instance, otherwise deadlock will result.\n- */\n-\n-/**\n- * Process a set of packets by distributing them among workers that request\n- * packets. The distributor will ensure that no two packets that have the\n- * same flow id, or tag, in the mbuf will be processed on different cores at\n- * the same time.\n- *\n- * The user is advocated to set tag for each mbuf before calling this function.\n- * If user doesn't set the tag, the tag value can be various values depending on\n- * driver implementation and configuration.\n- *\n- * This is not multi-thread safe and should only be called on a single lcore.\n- *\n- * @param d\n- *   The distributor instance to be used\n- * @param mbufs\n- *   The mbufs to be distributed\n- * @param num_mbufs\n- *   The number of mbufs in the mbufs array\n- * @return\n- *   The number of mbufs processed.\n- */\n-int\n-rte_distributor_process_v1705(struct rte_distributor_v1705 *d,\n-\t\tstruct rte_mbuf **mbufs, unsigned int num_mbufs);\n-\n-/**\n- * Get a set of mbufs that have been returned to the distributor by workers\n- *\n- * This should only be called on the same lcore as rte_distributor_process()\n- *\n- * @param d\n- *   The distributor instance to be used\n- * @param mbufs\n- *   The mbufs pointer array to be filled in\n- * @param max_mbufs\n- *   The size of the mbufs array\n- * @return\n- *   The number of mbufs returned in the mbufs array.\n- */\n-int\n-rte_distributor_returned_pkts_v1705(struct rte_distributor_v1705 *d,\n-\t\tstruct rte_mbuf **mbufs, unsigned int max_mbufs);\n-\n-/**\n- * Flush the distributor component, so that there are no in-flight or\n- * backlogged packets awaiting processing\n- *\n- * This should only be called on the same lcore as rte_distributor_process()\n- *\n- * @param d\n- *   The distributor instance to be used\n- * @return\n- *   The number of queued/in-flight packets that were completed by this call.\n- */\n-int\n-rte_distributor_flush_v1705(struct rte_distributor_v1705 *d);\n-\n-/**\n- * Clears the array of returned packets used as the source for the\n- * rte_distributor_returned_pkts() API call.\n- *\n- * This should only be called on the same lcore as rte_distributor_process()\n- *\n- * @param d\n- *   The distributor instance to be used\n- */\n-void\n-rte_distributor_clear_returns_v1705(struct rte_distributor_v1705 *d);\n-\n-/*  *** APIS to be called on the worker lcores ***  */\n-/*\n- * The following APIs are the public APIs which are designed for use on\n- * multiple lcores which act as workers for a distributor. Each lcore should use\n- * a unique worker id when requesting packets.\n- *\n- * NOTE: a given lcore cannot act as both a distributor lcore and a worker lcore\n- * for the same distributor instance, otherwise deadlock will result.\n- */\n-\n-/**\n- * API called by a worker to get new packets to process. Any previous packets\n- * given to the worker is assumed to have completed processing, and may be\n- * optionally returned to the distributor via the oldpkt parameter.\n- *\n- * @param d\n- *   The distributor instance to be used\n- * @param worker_id\n- *   The worker instance number to use - must be less that num_workers passed\n- *   at distributor creation time.\n- * @param pkts\n- *   The mbufs pointer array to be filled in (up to 8 packets)\n- * @param oldpkt\n- *   The previous packet, if any, being processed by the worker\n- * @param retcount\n- *   The number of packets being returned\n- *\n- * @return\n- *   The number of packets in the pkts array\n- */\n-int\n-rte_distributor_get_pkt_v1705(struct rte_distributor_v1705 *d,\n-\tunsigned int worker_id, struct rte_mbuf **pkts,\n-\tstruct rte_mbuf **oldpkt, unsigned int retcount);\n-\n-/**\n- * API called by a worker to return a completed packet without requesting a\n- * new packet, for example, because a worker thread is shutting down\n- *\n- * @param d\n- *   The distributor instance to be used\n- * @param worker_id\n- *   The worker instance number to use - must be less that num_workers passed\n- *   at distributor creation time.\n- * @param oldpkt\n- *   The previous packets being processed by the worker\n- * @param num\n- *   The number of packets in the oldpkt array\n- */\n-int\n-rte_distributor_return_pkt_v1705(struct rte_distributor_v1705 *d,\n-\tunsigned int worker_id, struct rte_mbuf **oldpkt, int num);\n-\n-/**\n- * API called by a worker to request a new packet to process.\n- * Any previous packet given to the worker is assumed to have completed\n- * processing, and may be optionally returned to the distributor via\n- * the oldpkt parameter.\n- * Unlike rte_distributor_get_pkt_burst(), this function does not wait for a\n- * new packet to be provided by the distributor.\n- *\n- * NOTE: after calling this function, rte_distributor_poll_pkt_burst() should\n- * be used to poll for the packet requested. The rte_distributor_get_pkt_burst()\n- * API should *not* be used to try and retrieve the new packet.\n- *\n- * @param d\n- *   The distributor instance to be used\n- * @param worker_id\n- *   The worker instance number to use - must be less that num_workers passed\n- *   at distributor creation time.\n- * @param oldpkt\n- *   The returning packets, if any, processed by the worker\n- * @param count\n- *   The number of returning packets\n- */\n-void\n-rte_distributor_request_pkt_v1705(struct rte_distributor_v1705 *d,\n-\t\tunsigned int worker_id, struct rte_mbuf **oldpkt,\n-\t\tunsigned int count);\n-\n-/**\n- * API called by a worker to check for a new packet that was previously\n- * requested by a call to rte_distributor_request_pkt(). It does not wait\n- * for the new packet to be available, but returns NULL if the request has\n- * not yet been fulfilled by the distributor.\n- *\n- * @param d\n- *   The distributor instance to be used\n- * @param worker_id\n- *   The worker instance number to use - must be less that num_workers passed\n- *   at distributor creation time.\n- * @param mbufs\n- *   The array of mbufs being given to the worker\n- *\n- * @return\n- *   The number of packets being given to the worker thread, zero if no\n- *   packet is yet available.\n- */\n-int\n-rte_distributor_poll_pkt_v1705(struct rte_distributor_v1705 *d,\n-\t\tunsigned int worker_id, struct rte_mbuf **mbufs);\n-\n-#ifdef __cplusplus\n-}\n-#endif\n-\n-#endif\ndiff --git a/lib/librte_distributor/rte_distributor_v20.c b/lib/librte_distributor/rte_distributor_v20.c\nindex be297ec..1f406c5 100644\n--- a/lib/librte_distributor/rte_distributor_v20.c\n+++ b/lib/librte_distributor/rte_distributor_v20.c\n@@ -43,7 +43,7 @@\n #include \"rte_distributor_v20.h\"\n #include \"rte_distributor_private.h\"\n \n-TAILQ_HEAD(rte_distributor_list, rte_distributor);\n+TAILQ_HEAD(rte_distributor_list, rte_distributor_v20);\n \n static struct rte_tailq_elem rte_distributor_tailq = {\n \t.name = \"RTE_DISTRIBUTOR\",\n@@ -53,10 +53,10 @@ EAL_REGISTER_TAILQ(rte_distributor_tailq)\n /**** APIs called by workers ****/\n \n void\n-rte_distributor_request_pkt(struct rte_distributor *d,\n+rte_distributor_request_pkt_v20(struct rte_distributor_v20 *d,\n \t\tunsigned worker_id, struct rte_mbuf *oldpkt)\n {\n-\tunion rte_distributor_buffer *buf = &d->bufs[worker_id];\n+\tunion rte_distributor_buffer_v20 *buf = &d->bufs[worker_id];\n \tint64_t req = (((int64_t)(uintptr_t)oldpkt) << RTE_DISTRIB_FLAG_BITS)\n \t\t\t| RTE_DISTRIB_GET_BUF;\n \twhile (unlikely(buf->bufptr64 & RTE_DISTRIB_FLAGS_MASK))\n@@ -65,10 +65,10 @@ rte_distributor_request_pkt(struct rte_distributor *d,\n }\n \n struct rte_mbuf *\n-rte_distributor_poll_pkt(struct rte_distributor *d,\n+rte_distributor_poll_pkt_v20(struct rte_distributor_v20 *d,\n \t\tunsigned worker_id)\n {\n-\tunion rte_distributor_buffer *buf = &d->bufs[worker_id];\n+\tunion rte_distributor_buffer_v20 *buf = &d->bufs[worker_id];\n \tif (buf->bufptr64 & RTE_DISTRIB_GET_BUF)\n \t\treturn NULL;\n \n@@ -78,21 +78,21 @@ rte_distributor_poll_pkt(struct rte_distributor *d,\n }\n \n struct rte_mbuf *\n-rte_distributor_get_pkt(struct rte_distributor *d,\n+rte_distributor_get_pkt_v20(struct rte_distributor_v20 *d,\n \t\tunsigned worker_id, struct rte_mbuf *oldpkt)\n {\n \tstruct rte_mbuf *ret;\n-\trte_distributor_request_pkt(d, worker_id, oldpkt);\n-\twhile ((ret = rte_distributor_poll_pkt(d, worker_id)) == NULL)\n+\trte_distributor_request_pkt_v20(d, worker_id, oldpkt);\n+\twhile ((ret = rte_distributor_poll_pkt_v20(d, worker_id)) == NULL)\n \t\trte_pause();\n \treturn ret;\n }\n \n int\n-rte_distributor_return_pkt(struct rte_distributor *d,\n+rte_distributor_return_pkt_v20(struct rte_distributor_v20 *d,\n \t\tunsigned worker_id, struct rte_mbuf *oldpkt)\n {\n-\tunion rte_distributor_buffer *buf = &d->bufs[worker_id];\n+\tunion rte_distributor_buffer_v20 *buf = &d->bufs[worker_id];\n \tuint64_t req = (((int64_t)(uintptr_t)oldpkt) << RTE_DISTRIB_FLAG_BITS)\n \t\t\t| RTE_DISTRIB_RETURN_BUF;\n \tbuf->bufptr64 = req;\n@@ -123,7 +123,7 @@ backlog_pop(struct rte_distributor_backlog *bl)\n \n /* stores a packet returned from a worker inside the returns array */\n static inline void\n-store_return(uintptr_t oldbuf, struct rte_distributor *d,\n+store_return(uintptr_t oldbuf, struct rte_distributor_v20 *d,\n \t\tunsigned *ret_start, unsigned *ret_count)\n {\n \t/* store returns in a circular buffer - code is branch-free */\n@@ -134,7 +134,7 @@ store_return(uintptr_t oldbuf, struct rte_distributor *d,\n }\n \n static inline void\n-handle_worker_shutdown(struct rte_distributor *d, unsigned wkr)\n+handle_worker_shutdown(struct rte_distributor_v20 *d, unsigned int wkr)\n {\n \td->in_flight_tags[wkr] = 0;\n \td->in_flight_bitmask &= ~(1UL << wkr);\n@@ -164,7 +164,7 @@ handle_worker_shutdown(struct rte_distributor *d, unsigned wkr)\n \t\t * Note that the tags were set before first level call\n \t\t * to rte_distributor_process.\n \t\t */\n-\t\trte_distributor_process(d, pkts, i);\n+\t\trte_distributor_process_v20(d, pkts, i);\n \t\tbl->count = bl->start = 0;\n \t}\n }\n@@ -174,7 +174,7 @@ handle_worker_shutdown(struct rte_distributor *d, unsigned wkr)\n  * to do a partial flush.\n  */\n static int\n-process_returns(struct rte_distributor *d)\n+process_returns(struct rte_distributor_v20 *d)\n {\n \tunsigned wkr;\n \tunsigned flushed = 0;\n@@ -213,7 +213,7 @@ process_returns(struct rte_distributor *d)\n \n /* process a set of packets to distribute them to workers */\n int\n-rte_distributor_process(struct rte_distributor *d,\n+rte_distributor_process_v20(struct rte_distributor_v20 *d,\n \t\tstruct rte_mbuf **mbufs, unsigned num_mbufs)\n {\n \tunsigned next_idx = 0;\n@@ -317,7 +317,7 @@ rte_distributor_process(struct rte_distributor *d,\n \n /* return to the caller, packets returned from workers */\n int\n-rte_distributor_returned_pkts(struct rte_distributor *d,\n+rte_distributor_returned_pkts_v20(struct rte_distributor_v20 *d,\n \t\tstruct rte_mbuf **mbufs, unsigned max_mbufs)\n {\n \tstruct rte_distributor_returned_pkts *returns = &d->returns;\n@@ -338,7 +338,7 @@ rte_distributor_returned_pkts(struct rte_distributor *d,\n /* return the number of packets in-flight in a distributor, i.e. packets\n  * being workered on or queued up in a backlog. */\n static inline unsigned\n-total_outstanding(const struct rte_distributor *d)\n+total_outstanding(const struct rte_distributor_v20 *d)\n {\n \tunsigned wkr, total_outstanding;\n \n@@ -353,19 +353,19 @@ total_outstanding(const struct rte_distributor *d)\n /* flush the distributor, so that there are no outstanding packets in flight or\n  * queued up. */\n int\n-rte_distributor_flush(struct rte_distributor *d)\n+rte_distributor_flush_v20(struct rte_distributor_v20 *d)\n {\n \tconst unsigned flushed = total_outstanding(d);\n \n \twhile (total_outstanding(d) > 0)\n-\t\trte_distributor_process(d, NULL, 0);\n+\t\trte_distributor_process_v20(d, NULL, 0);\n \n \treturn flushed;\n }\n \n /* clears the internal returns array in the distributor */\n void\n-rte_distributor_clear_returns(struct rte_distributor *d)\n+rte_distributor_clear_returns_v20(struct rte_distributor_v20 *d)\n {\n \td->returns.start = d->returns.count = 0;\n #ifndef __OPTIMIZE__\n@@ -374,12 +374,12 @@ rte_distributor_clear_returns(struct rte_distributor *d)\n }\n \n /* creates a distributor instance */\n-struct rte_distributor *\n-rte_distributor_create(const char *name,\n+struct rte_distributor_v20 *\n+rte_distributor_create_v20(const char *name,\n \t\tunsigned socket_id,\n \t\tunsigned num_workers)\n {\n-\tstruct rte_distributor *d;\n+\tstruct rte_distributor_v20 *d;\n \tstruct rte_distributor_list *distributor_list;\n \tchar mz_name[RTE_MEMZONE_NAMESIZE];\n \tconst struct rte_memzone *mz;\ndiff --git a/lib/librte_distributor/rte_distributor_v20.h b/lib/librte_distributor/rte_distributor_v20.h\nindex b69aa27..f02e6aa 100644\n--- a/lib/librte_distributor/rte_distributor_v20.h\n+++ b/lib/librte_distributor/rte_distributor_v20.h\n@@ -48,7 +48,7 @@ extern \"C\" {\n \n #define RTE_DISTRIBUTOR_NAMESIZE 32 /**< Length of name for instance */\n \n-struct rte_distributor;\n+struct rte_distributor_v20;\n struct rte_mbuf;\n \n /**\n@@ -67,8 +67,8 @@ struct rte_mbuf;\n  * @return\n  *   The newly created distributor instance\n  */\n-struct rte_distributor *\n-rte_distributor_create(const char *name, unsigned int socket_id,\n+struct rte_distributor_v20 *\n+rte_distributor_create_v20(const char *name, unsigned int socket_id,\n \t\tunsigned int num_workers);\n \n /*  *** APIS to be called on the distributor lcore ***  */\n@@ -103,7 +103,7 @@ rte_distributor_create(const char *name, unsigned int socket_id,\n  *   The number of mbufs processed.\n  */\n int\n-rte_distributor_process(struct rte_distributor *d,\n+rte_distributor_process_v20(struct rte_distributor_v20 *d,\n \t\tstruct rte_mbuf **mbufs, unsigned int num_mbufs);\n \n /**\n@@ -121,7 +121,7 @@ rte_distributor_process(struct rte_distributor *d,\n  *   The number of mbufs returned in the mbufs array.\n  */\n int\n-rte_distributor_returned_pkts(struct rte_distributor *d,\n+rte_distributor_returned_pkts_v20(struct rte_distributor_v20 *d,\n \t\tstruct rte_mbuf **mbufs, unsigned int max_mbufs);\n \n /**\n@@ -136,7 +136,7 @@ rte_distributor_returned_pkts(struct rte_distributor *d,\n  *   The number of queued/in-flight packets that were completed by this call.\n  */\n int\n-rte_distributor_flush(struct rte_distributor *d);\n+rte_distributor_flush_v20(struct rte_distributor_v20 *d);\n \n /**\n  * Clears the array of returned packets used as the source for the\n@@ -148,7 +148,7 @@ rte_distributor_flush(struct rte_distributor *d);\n  *   The distributor instance to be used\n  */\n void\n-rte_distributor_clear_returns(struct rte_distributor *d);\n+rte_distributor_clear_returns_v20(struct rte_distributor_v20 *d);\n \n /*  *** APIS to be called on the worker lcores ***  */\n /*\n@@ -177,7 +177,7 @@ rte_distributor_clear_returns(struct rte_distributor *d);\n  *   A new packet to be processed by the worker thread.\n  */\n struct rte_mbuf *\n-rte_distributor_get_pkt(struct rte_distributor *d,\n+rte_distributor_get_pkt_v20(struct rte_distributor_v20 *d,\n \t\tunsigned int worker_id, struct rte_mbuf *oldpkt);\n \n /**\n@@ -193,8 +193,8 @@ rte_distributor_get_pkt(struct rte_distributor *d,\n  *   The previous packet being processed by the worker\n  */\n int\n-rte_distributor_return_pkt(struct rte_distributor *d, unsigned int worker_id,\n-\t\tstruct rte_mbuf *mbuf);\n+rte_distributor_return_pkt_v20(struct rte_distributor_v20 *d,\n+\t\tunsigned int worker_id, struct rte_mbuf *mbuf);\n \n /**\n  * API called by a worker to request a new packet to process.\n@@ -217,7 +217,7 @@ rte_distributor_return_pkt(struct rte_distributor *d, unsigned int worker_id,\n  *   The previous packet, if any, being processed by the worker\n  */\n void\n-rte_distributor_request_pkt(struct rte_distributor *d,\n+rte_distributor_request_pkt_v20(struct rte_distributor_v20 *d,\n \t\tunsigned int worker_id, struct rte_mbuf *oldpkt);\n \n /**\n@@ -237,7 +237,7 @@ rte_distributor_request_pkt(struct rte_distributor *d,\n  *   packet is yet available.\n  */\n struct rte_mbuf *\n-rte_distributor_poll_pkt(struct rte_distributor *d,\n+rte_distributor_poll_pkt_v20(struct rte_distributor_v20 *d,\n \t\tunsigned int worker_id);\n \n #ifdef __cplusplus\ndiff --git a/test/test/test_distributor.c b/test/test/test_distributor.c\nindex 6059a0c..7a30513 100644\n--- a/test/test/test_distributor.c\n+++ b/test/test/test_distributor.c\n@@ -1,7 +1,7 @@\n /*-\n  *   BSD LICENSE\n  *\n- *   Copyright(c) 2010-2014 Intel Corporation. All rights reserved.\n+ *   Copyright(c) 2010-2017 Intel Corporation. All rights reserved.\n  *   All rights reserved.\n  *\n  *   Redistribution and use in source and binary forms, with or without\n@@ -87,20 +87,25 @@ clear_packet_count(void)\n static int\n handle_work(void *arg)\n {\n-\tstruct rte_mbuf *pkt = NULL;\n+\tstruct rte_mbuf *buf[8] __rte_cache_aligned;\n \tstruct worker_params *wp = arg;\n-\tstruct rte_distributor *d = wp->dist;\n-\n-\tunsigned count = 0;\n-\tunsigned id = __sync_fetch_and_add(&worker_idx, 1);\n-\n-\tpkt = rte_distributor_get_pkt(d, id, NULL);\n+\tstruct rte_distributor *db = wp->dist;\n+\tunsigned int count = 0, num = 0;\n+\tunsigned int id = __sync_fetch_and_add(&worker_idx, 1);\n+\tint i;\n+\n+\tfor (i = 0; i < 8; i++)\n+\t\tbuf[i] = NULL;\n+\tnum = rte_distributor_get_pkt(db, id, buf, buf, num);\n \twhile (!quit) {\n-\t\tworker_stats[id].handled_packets++, count++;\n-\t\tpkt = rte_distributor_get_pkt(d, id, pkt);\n+\t\tworker_stats[id].handled_packets += num;\n+\t\tcount += num;\n+\t\tnum = rte_distributor_get_pkt(db, id,\n+\t\t\t\tbuf, buf, num);\n \t}\n-\tworker_stats[id].handled_packets++, count++;\n-\trte_distributor_return_pkt(d, id, pkt);\n+\tworker_stats[id].handled_packets += num;\n+\tcount += num;\n+\trte_distributor_return_pkt(db, id, buf, num);\n \treturn 0;\n }\n \n@@ -118,9 +123,11 @@ handle_work(void *arg)\n static int\n sanity_test(struct worker_params *wp, struct rte_mempool *p)\n {\n-\tstruct rte_distributor *d = wp->dist;\n+\tstruct rte_distributor *db = wp->dist;\n \tstruct rte_mbuf *bufs[BURST];\n-\tunsigned i;\n+\tstruct rte_mbuf *returns[BURST*2];\n+\tunsigned int i, count;\n+\tunsigned int retries;\n \n \tprintf(\"=== Basic distributor sanity tests ===\\n\");\n \tclear_packet_count();\n@@ -134,8 +141,15 @@ sanity_test(struct worker_params *wp, struct rte_mempool *p)\n \tfor (i = 0; i < BURST; i++)\n \t\tbufs[i]->hash.usr = 0;\n \n-\trte_distributor_process(d, bufs, BURST);\n-\trte_distributor_flush(d);\n+\trte_distributor_process(db, bufs, BURST);\n+\tcount = 0;\n+\tdo {\n+\n+\t\trte_distributor_flush(db);\n+\t\tcount += rte_distributor_returned_pkts(db,\n+\t\t\t\treturns, BURST*2);\n+\t} while (count < BURST);\n+\n \tif (total_packet_count() != BURST) {\n \t\tprintf(\"Line %d: Error, not all packets flushed. \"\n \t\t\t\t\"Expected %u, got %u\\n\",\n@@ -147,8 +161,6 @@ sanity_test(struct worker_params *wp, struct rte_mempool *p)\n \t\tprintf(\"Worker %u handled %u packets\\n\", i,\n \t\t\t\tworker_stats[i].handled_packets);\n \tprintf(\"Sanity test with all zero hashes done.\\n\");\n-\tif (worker_stats[0].handled_packets != BURST)\n-\t\treturn -1;\n \n \t/* pick two flows and check they go correctly */\n \tif (rte_lcore_count() >= 3) {\n@@ -156,8 +168,13 @@ sanity_test(struct worker_params *wp, struct rte_mempool *p)\n \t\tfor (i = 0; i < BURST; i++)\n \t\t\tbufs[i]->hash.usr = (i & 1) << 8;\n \n-\t\trte_distributor_process(d, bufs, BURST);\n-\t\trte_distributor_flush(d);\n+\t\trte_distributor_process(db, bufs, BURST);\n+\t\tcount = 0;\n+\t\tdo {\n+\t\t\trte_distributor_flush(db);\n+\t\t\tcount += rte_distributor_returned_pkts(db,\n+\t\t\t\t\treturns, BURST*2);\n+\t\t} while (count < BURST);\n \t\tif (total_packet_count() != BURST) {\n \t\t\tprintf(\"Line %d: Error, not all packets flushed. \"\n \t\t\t\t\t\"Expected %u, got %u\\n\",\n@@ -169,20 +186,21 @@ sanity_test(struct worker_params *wp, struct rte_mempool *p)\n \t\t\tprintf(\"Worker %u handled %u packets\\n\", i,\n \t\t\t\t\tworker_stats[i].handled_packets);\n \t\tprintf(\"Sanity test with two hash values done\\n\");\n-\n-\t\tif (worker_stats[0].handled_packets != 16 ||\n-\t\t\t\tworker_stats[1].handled_packets != 16)\n-\t\t\treturn -1;\n \t}\n \n \t/* give a different hash value to each packet,\n \t * so load gets distributed */\n \tclear_packet_count();\n \tfor (i = 0; i < BURST; i++)\n-\t\tbufs[i]->hash.usr = i;\n-\n-\trte_distributor_process(d, bufs, BURST);\n-\trte_distributor_flush(d);\n+\t\tbufs[i]->hash.usr = i+1;\n+\n+\trte_distributor_process(db, bufs, BURST);\n+\tcount = 0;\n+\tdo {\n+\t\trte_distributor_flush(db);\n+\t\tcount += rte_distributor_returned_pkts(db,\n+\t\t\t\treturns, BURST*2);\n+\t} while (count < BURST);\n \tif (total_packet_count() != BURST) {\n \t\tprintf(\"Line %d: Error, not all packets flushed. \"\n \t\t\t\t\"Expected %u, got %u\\n\",\n@@ -204,8 +222,9 @@ sanity_test(struct worker_params *wp, struct rte_mempool *p)\n \tunsigned num_returned = 0;\n \n \t/* flush out any remaining packets */\n-\trte_distributor_flush(d);\n-\trte_distributor_clear_returns(d);\n+\trte_distributor_flush(db);\n+\trte_distributor_clear_returns(db);\n+\n \tif (rte_mempool_get_bulk(p, (void *)many_bufs, BIG_BATCH) != 0) {\n \t\tprintf(\"line %d: Error getting mbufs from pool\\n\", __LINE__);\n \t\treturn -1;\n@@ -213,28 +232,44 @@ sanity_test(struct worker_params *wp, struct rte_mempool *p)\n \tfor (i = 0; i < BIG_BATCH; i++)\n \t\tmany_bufs[i]->hash.usr = i << 2;\n \n+\tprintf(\"=== testing big burst (%s) ===\\n\", wp->name);\n \tfor (i = 0; i < BIG_BATCH/BURST; i++) {\n-\t\trte_distributor_process(d, &many_bufs[i*BURST], BURST);\n-\t\tnum_returned += rte_distributor_returned_pkts(d,\n+\t\trte_distributor_process(db,\n+\t\t\t\t&many_bufs[i*BURST], BURST);\n+\t\tcount = rte_distributor_returned_pkts(db,\n \t\t\t\t&return_bufs[num_returned],\n \t\t\t\tBIG_BATCH - num_returned);\n+\t\tnum_returned += count;\n \t}\n-\trte_distributor_flush(d);\n-\tnum_returned += rte_distributor_returned_pkts(d,\n-\t\t\t&return_bufs[num_returned], BIG_BATCH - num_returned);\n+\trte_distributor_flush(db);\n+\tcount = rte_distributor_returned_pkts(db,\n+\t\t&return_bufs[num_returned],\n+\t\t\tBIG_BATCH - num_returned);\n+\tnum_returned += count;\n+\tretries = 0;\n+\tdo {\n+\t\trte_distributor_flush(db);\n+\t\tcount = rte_distributor_returned_pkts(db,\n+\t\t\t\t&return_bufs[num_returned],\n+\t\t\t\tBIG_BATCH - num_returned);\n+\t\tnum_returned += count;\n+\t\tretries++;\n+\t} while ((num_returned < BIG_BATCH) && (retries < 100));\n \n \tif (num_returned != BIG_BATCH) {\n-\t\tprintf(\"line %d: Number returned is not the same as \"\n-\t\t\t\t\"number sent\\n\", __LINE__);\n+\t\tprintf(\"line %d: Missing packets, expected %d\\n\",\n+\t\t\t\t__LINE__, num_returned);\n \t\treturn -1;\n \t}\n+\n \t/* big check -  make sure all packets made it back!! */\n \tfor (i = 0; i < BIG_BATCH; i++) {\n \t\tunsigned j;\n \t\tstruct rte_mbuf *src = many_bufs[i];\n-\t\tfor (j = 0; j < BIG_BATCH; j++)\n+\t\tfor (j = 0; j < BIG_BATCH; j++) {\n \t\t\tif (return_bufs[j] == src)\n \t\t\t\tbreak;\n+\t\t}\n \n \t\tif (j == BIG_BATCH) {\n \t\t\tprintf(\"Error: could not find source packet #%u\\n\", i);\n@@ -258,20 +293,28 @@ sanity_test(struct worker_params *wp, struct rte_mempool *p)\n static int\n handle_work_with_free_mbufs(void *arg)\n {\n-\tstruct rte_mbuf *pkt = NULL;\n+\tstruct rte_mbuf *buf[8] __rte_cache_aligned;\n \tstruct worker_params *wp = arg;\n \tstruct rte_distributor *d = wp->dist;\n-\tunsigned count = 0;\n-\tunsigned id = __sync_fetch_and_add(&worker_idx, 1);\n-\n-\tpkt = rte_distributor_get_pkt(d, id, NULL);\n+\tunsigned int count = 0;\n+\tunsigned int i;\n+\tunsigned int num = 0;\n+\tunsigned int id = __sync_fetch_and_add(&worker_idx, 1);\n+\n+\tfor (i = 0; i < 8; i++)\n+\t\tbuf[i] = NULL;\n+\tnum = rte_distributor_get_pkt(d, id, buf, buf, num);\n \twhile (!quit) {\n-\t\tworker_stats[id].handled_packets++, count++;\n-\t\trte_pktmbuf_free(pkt);\n-\t\tpkt = rte_distributor_get_pkt(d, id, pkt);\n+\t\tworker_stats[id].handled_packets += num;\n+\t\tcount += num;\n+\t\tfor (i = 0; i < num; i++)\n+\t\t\trte_pktmbuf_free(buf[i]);\n+\t\tnum = rte_distributor_get_pkt(d,\n+\t\t\t\tid, buf, buf, num);\n \t}\n-\tworker_stats[id].handled_packets++, count++;\n-\trte_distributor_return_pkt(d, id, pkt);\n+\tworker_stats[id].handled_packets += num;\n+\tcount += num;\n+\trte_distributor_return_pkt(d, id, buf, num);\n \treturn 0;\n }\n \n@@ -287,7 +330,8 @@ sanity_test_with_mbuf_alloc(struct worker_params *wp, struct rte_mempool *p)\n \tunsigned i;\n \tstruct rte_mbuf *bufs[BURST];\n \n-\tprintf(\"=== Sanity test with mbuf alloc/free  ===\\n\");\n+\tprintf(\"=== Sanity test with mbuf alloc/free (%s) ===\\n\", wp->name);\n+\n \tclear_packet_count();\n \tfor (i = 0; i < ((1<<ITER_POWER)); i += BURST) {\n \t\tunsigned j;\n@@ -302,6 +346,9 @@ sanity_test_with_mbuf_alloc(struct worker_params *wp, struct rte_mempool *p)\n \t}\n \n \trte_distributor_flush(d);\n+\n+\trte_delay_us(10000);\n+\n \tif (total_packet_count() < (1<<ITER_POWER)) {\n \t\tprintf(\"Line %u: Packet count is incorrect, %u, expected %u\\n\",\n \t\t\t\t__LINE__, total_packet_count(),\n@@ -317,21 +364,32 @@ static int\n handle_work_for_shutdown_test(void *arg)\n {\n \tstruct rte_mbuf *pkt = NULL;\n+\tstruct rte_mbuf *buf[8] __rte_cache_aligned;\n \tstruct worker_params *wp = arg;\n \tstruct rte_distributor *d = wp->dist;\n-\tunsigned count = 0;\n-\tconst unsigned id = __sync_fetch_and_add(&worker_idx, 1);\n+\tunsigned int count = 0;\n+\tunsigned int num = 0;\n+\tunsigned int total = 0;\n+\tunsigned int i;\n+\tunsigned int returned = 0;\n+\tconst unsigned int id = __sync_fetch_and_add(&worker_idx, 1);\n+\n+\tnum = rte_distributor_get_pkt(d, id, buf, buf, num);\n \n-\tpkt = rte_distributor_get_pkt(d, id, NULL);\n \t/* wait for quit single globally, or for worker zero, wait\n \t * for zero_quit */\n \twhile (!quit && !(id == 0 && zero_quit)) {\n-\t\tworker_stats[id].handled_packets++, count++;\n-\t\trte_pktmbuf_free(pkt);\n-\t\tpkt = rte_distributor_get_pkt(d, id, NULL);\n+\t\tworker_stats[id].handled_packets += num;\n+\t\tcount += num;\n+\t\tfor (i = 0; i < num; i++)\n+\t\t\trte_pktmbuf_free(buf[i]);\n+\t\tnum = rte_distributor_get_pkt(d,\n+\t\t\t\tid, buf, buf, num);\n+\t\ttotal += num;\n \t}\n-\tworker_stats[id].handled_packets++, count++;\n-\trte_distributor_return_pkt(d, id, pkt);\n+\tworker_stats[id].handled_packets += num;\n+\tcount += num;\n+\treturned = rte_distributor_return_pkt(d, id, buf, num);\n \n \tif (id == 0) {\n \t\t/* for worker zero, allow it to restart to pick up last packet\n@@ -339,13 +397,18 @@ handle_work_for_shutdown_test(void *arg)\n \t\t */\n \t\twhile (zero_quit)\n \t\t\tusleep(100);\n-\t\tpkt = rte_distributor_get_pkt(d, id, NULL);\n+\n+\t\tnum = rte_distributor_get_pkt(d,\n+\t\t\t\tid, buf, buf, num);\n+\n \t\twhile (!quit) {\n \t\t\tworker_stats[id].handled_packets++, count++;\n \t\t\trte_pktmbuf_free(pkt);\n-\t\t\tpkt = rte_distributor_get_pkt(d, id, NULL);\n+\t\t\tnum = rte_distributor_get_pkt(d, id, buf, buf, num);\n \t\t}\n-\t\trte_distributor_return_pkt(d, id, pkt);\n+\t\treturned = rte_distributor_return_pkt(d,\n+\t\t\t\tid, buf, num);\n+\t\tprintf(\"Num returned = %d\\n\", returned);\n \t}\n \treturn 0;\n }\n@@ -367,17 +430,22 @@ sanity_test_with_worker_shutdown(struct worker_params *wp,\n \tprintf(\"=== Sanity test of worker shutdown ===\\n\");\n \n \tclear_packet_count();\n+\n \tif (rte_mempool_get_bulk(p, (void *)bufs, BURST) != 0) {\n \t\tprintf(\"line %d: Error getting mbufs from pool\\n\", __LINE__);\n \t\treturn -1;\n \t}\n \n-\t/* now set all hash values in all buffers to zero, so all pkts go to the\n-\t * one worker thread */\n+\t/*\n+\t * Now set all hash values in all buffers to same value so all\n+\t * pkts go to the one worker thread\n+\t */\n \tfor (i = 0; i < BURST; i++)\n-\t\tbufs[i]->hash.usr = 0;\n+\t\tbufs[i]->hash.usr = 1;\n \n \trte_distributor_process(d, bufs, BURST);\n+\trte_distributor_flush(d);\n+\n \t/* at this point, we will have processed some packets and have a full\n \t * backlog for the other ones at worker 0.\n \t */\n@@ -388,7 +456,7 @@ sanity_test_with_worker_shutdown(struct worker_params *wp,\n \t\treturn -1;\n \t}\n \tfor (i = 0; i < BURST; i++)\n-\t\tbufs[i]->hash.usr = 0;\n+\t\tbufs[i]->hash.usr = 1;\n \n \t/* get worker zero to quit */\n \tzero_quit = 1;\n@@ -396,6 +464,12 @@ sanity_test_with_worker_shutdown(struct worker_params *wp,\n \n \t/* flush the distributor */\n \trte_distributor_flush(d);\n+\trte_delay_us(10000);\n+\n+\tfor (i = 0; i < rte_lcore_count() - 1; i++)\n+\t\tprintf(\"Worker %u handled %u packets\\n\", i,\n+\t\t\t\tworker_stats[i].handled_packets);\n+\n \tif (total_packet_count() != BURST * 2) {\n \t\tprintf(\"Line %d: Error, not all packets flushed. \"\n \t\t\t\t\"Expected %u, got %u\\n\",\n@@ -403,10 +477,6 @@ sanity_test_with_worker_shutdown(struct worker_params *wp,\n \t\treturn -1;\n \t}\n \n-\tfor (i = 0; i < rte_lcore_count() - 1; i++)\n-\t\tprintf(\"Worker %u handled %u packets\\n\", i,\n-\t\t\t\tworker_stats[i].handled_packets);\n-\n \tprintf(\"Sanity test with worker shutdown passed\\n\\n\");\n \treturn 0;\n }\n@@ -422,7 +492,7 @@ test_flush_with_worker_shutdown(struct worker_params *wp,\n \tstruct rte_mbuf *bufs[BURST];\n \tunsigned i;\n \n-\tprintf(\"=== Test flush fn with worker shutdown ===\\n\");\n+\tprintf(\"=== Test flush fn with worker shutdown (%s) ===\\n\", wp->name);\n \n \tclear_packet_count();\n \tif (rte_mempool_get_bulk(p, (void *)bufs, BURST) != 0) {\n@@ -446,7 +516,13 @@ test_flush_with_worker_shutdown(struct worker_params *wp,\n \t/* flush the distributor */\n \trte_distributor_flush(d);\n \n+\trte_delay_us(10000);\n+\n \tzero_quit = 0;\n+\tfor (i = 0; i < rte_lcore_count() - 1; i++)\n+\t\tprintf(\"Worker %u handled %u packets\\n\", i,\n+\t\t\t\tworker_stats[i].handled_packets);\n+\n \tif (total_packet_count() != BURST) {\n \t\tprintf(\"Line %d: Error, not all packets flushed. \"\n \t\t\t\t\"Expected %u, got %u\\n\",\n@@ -454,10 +530,6 @@ test_flush_with_worker_shutdown(struct worker_params *wp,\n \t\treturn -1;\n \t}\n \n-\tfor (i = 0; i < rte_lcore_count() - 1; i++)\n-\t\tprintf(\"Worker %u handled %u packets\\n\", i,\n-\t\t\t\tworker_stats[i].handled_packets);\n-\n \tprintf(\"Flush test with worker shutdown passed\\n\\n\");\n \treturn 0;\n }\n@@ -469,7 +541,9 @@ int test_error_distributor_create_name(void)\n \tchar *name = NULL;\n \n \td = rte_distributor_create(name, rte_socket_id(),\n-\t\t\trte_lcore_count() - 1);\n+\t\t\trte_lcore_count() - 1,\n+\t\t\tRTE_DIST_ALG_BURST);\n+\n \tif (d != NULL || rte_errno != EINVAL) {\n \t\tprintf(\"ERROR: No error on create() with NULL name param\\n\");\n \t\treturn -1;\n@@ -483,8 +557,10 @@ static\n int test_error_distributor_create_numworkers(void)\n {\n \tstruct rte_distributor *d = NULL;\n+\n \td = rte_distributor_create(\"test_numworkers\", rte_socket_id(),\n-\t\t\tRTE_MAX_LCORE + 10);\n+\t\t\tRTE_MAX_LCORE + 10,\n+\t\t\tRTE_DIST_ALG_BURST);\n \tif (d != NULL || rte_errno != EINVAL) {\n \t\tprintf(\"ERROR: No error on create() with num_workers > MAX\\n\");\n \t\treturn -1;\n@@ -530,10 +606,11 @@ test_distributor(void)\n \t}\n \n \tif (d == NULL) {\n-\t\td = rte_distributor_create(\"Test_distributor\", rte_socket_id(),\n-\t\t\t\trte_lcore_count() - 1);\n+\t\td = rte_distributor_create(\"Test_dist_burst\", rte_socket_id(),\n+\t\t\t\trte_lcore_count() - 1,\n+\t\t\t\tRTE_DIST_ALG_BURST);\n \t\tif (d == NULL) {\n-\t\t\tprintf(\"Error creating distributor\\n\");\n+\t\t\tprintf(\"Error creating burst distributor\\n\");\n \t\t\treturn -1;\n \t\t}\n \t} else {\n@@ -553,7 +630,7 @@ test_distributor(void)\n \t}\n \n \tworker_params.dist = d;\n-\tsprintf(worker_params.name, \"single\");\n+\tsprintf(worker_params.name, \"burst\");\n \n \trte_eal_mp_remote_launch(handle_work, &worker_params, SKIP_MASTER);\n \tif (sanity_test(&worker_params, p) < 0)\ndiff --git a/test/test/test_distributor_perf.c b/test/test/test_distributor_perf.c\nindex 7947fe9..1dd326b 100644\n--- a/test/test/test_distributor_perf.c\n+++ b/test/test/test_distributor_perf.c\n@@ -129,18 +129,25 @@ clear_packet_count(void)\n static int\n handle_work(void *arg)\n {\n-\tstruct rte_mbuf *pkt = NULL;\n \tstruct rte_distributor *d = arg;\n-\tunsigned count = 0;\n-\tunsigned id = __sync_fetch_and_add(&worker_idx, 1);\n+\tunsigned int count = 0;\n+\tunsigned int num = 0;\n+\tint i;\n+\tunsigned int id = __sync_fetch_and_add(&worker_idx, 1);\n+\tstruct rte_mbuf *buf[8] __rte_cache_aligned;\n \n-\tpkt = rte_distributor_get_pkt(d, id, NULL);\n+\tfor (i = 0; i < 8; i++)\n+\t\tbuf[i] = NULL;\n+\n+\tnum = rte_distributor_get_pkt(d, id, buf, buf, num);\n \twhile (!quit) {\n-\t\tworker_stats[id].handled_packets++, count++;\n-\t\tpkt = rte_distributor_get_pkt(d, id, pkt);\n+\t\tworker_stats[id].handled_packets += num;\n+\t\tcount += num;\n+\t\tnum = rte_distributor_get_pkt(d, id, buf, buf, num);\n \t}\n-\tworker_stats[id].handled_packets++, count++;\n-\trte_distributor_return_pkt(d, id, pkt);\n+\tworker_stats[id].handled_packets += num;\n+\tcount += num;\n+\trte_distributor_return_pkt(d, id, buf, num);\n \treturn 0;\n }\n \n@@ -228,7 +235,8 @@ test_distributor_perf(void)\n \n \tif (d == NULL) {\n \t\td = rte_distributor_create(\"Test_perf\", rte_socket_id(),\n-\t\t\t\trte_lcore_count() - 1);\n+\t\t\t\trte_lcore_count() - 1,\n+\t\t\t\tRTE_DIST_ALG_SINGLE);\n \t\tif (d == NULL) {\n \t\t\tprintf(\"Error creating distributor\\n\");\n \t\t\treturn -1;\n",
    "prefixes": [
        "dpdk-dev",
        "v8",
        "07/18"
    ]
}