get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 1141,
    "url": "https://patches.dpdk.org/api/patches/1141/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/1415194237-1219-1-git-send-email-jigsaw@gmail.com/",
    "project": {
        "id": 1,
        "url": "https://patches.dpdk.org/api/projects/1/?format=api",
        "name": "DPDK",
        "link_name": "dpdk",
        "list_id": "dev.dpdk.org",
        "list_email": "dev@dpdk.org",
        "web_url": "http://core.dpdk.org",
        "scm_url": "git://dpdk.org/dpdk",
        "webscm_url": "http://git.dpdk.org/dpdk",
        "list_archive_url": "https://inbox.dpdk.org/dev",
        "list_archive_url_format": "https://inbox.dpdk.org/dev/{}",
        "commit_url_format": ""
    },
    "msgid": "<1415194237-1219-1-git-send-email-jigsaw@gmail.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1415194237-1219-1-git-send-email-jigsaw@gmail.com",
    "date": "2014-11-05T13:30:37",
    "name": "[dpdk-dev] Add user defined tag calculation callback to librte_distributor.",
    "commit_ref": null,
    "pull_url": null,
    "state": "rfc",
    "archived": true,
    "hash": "367fc95458c21102c75ff78b4d305b35985875f9",
    "submitter": {
        "id": 105,
        "url": "https://patches.dpdk.org/api/people/105/?format=api",
        "name": "Qinglai Xiao",
        "email": "jigsaw@gmail.com"
    },
    "delegate": null,
    "mbox": "https://patches.dpdk.org/project/dpdk/patch/1415194237-1219-1-git-send-email-jigsaw@gmail.com/mbox/",
    "series": [],
    "comments": "https://patches.dpdk.org/api/patches/1141/comments/",
    "check": "pending",
    "checks": "https://patches.dpdk.org/api/patches/1141/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 2CA5B5944;\n\tWed,  5 Nov 2014 14:21:20 +0100 (CET)",
            "from mail-la0-f42.google.com (mail-la0-f42.google.com\n\t[209.85.215.42]) by dpdk.org (Postfix) with ESMTP id B3F813989\n\tfor <dev@dpdk.org>; Wed,  5 Nov 2014 14:21:18 +0100 (CET)",
            "by mail-la0-f42.google.com with SMTP id gq15so680461lab.1\n\tfor <dev@dpdk.org>; Wed, 05 Nov 2014 05:30:41 -0800 (PST)",
            "from localhost.localdomain ([194.251.119.201])\n\tby mx.google.com with ESMTPSA id\n\tq7sm1308329laq.32.2014.11.05.05.30.40 for <multiple recipients>\n\t(version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);\n\tWed, 05 Nov 2014 05:30:40 -0800 (PST)"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;\n\th=from:to:cc:subject:date:message-id;\n\tbh=lUd127NxDx66zu+nTt46RFhFm5O/klyZ4hcaXHEt5qc=;\n\tb=N+brjgO/LWWr4Dnsny5grfhc0gBjkG1x9XixQLAaZIKoy+3Osum+wdkhfelBpe7eM+\n\tBH19EA13eSWRPNcoJnsWQ4Joweu8F4dhed3bGZCnGQwcf8IpU1mWs2S21MEoR+Toa8Sc\n\tna2eLShr51gMuXQD0Mik34XKEjwTrsCOXoW/sbv//IWItq+9valXwvawp8JVaXDYcKSC\n\tcqre5ItV194Kh43cxiB/VWmheh5I1I5RuPeqxirU/cfJnXd1U53nHH7F+0HCH2I7vKSB\n\tARdqxeAhZpebvQxWd5xEoSPmQck2M2TEnDvSFFKJY+ghS4Xgm714Gc9Uy5FuV8T39aye\n\tgZYg==",
        "X-Received": "by 10.152.5.100 with SMTP id r4mr68012364lar.26.1415194241515;\n\tWed, 05 Nov 2014 05:30:41 -0800 (PST)",
        "From": "Qinglai Xiao <jigsaw@gmail.com>",
        "To": "dev@dpdk.org",
        "Date": "Wed,  5 Nov 2014 15:30:37 +0200",
        "Message-Id": "<1415194237-1219-1-git-send-email-jigsaw@gmail.com>",
        "X-Mailer": "git-send-email 1.7.1",
        "Cc": "Qinglai Xiao <jigsaw@gmail.com>",
        "Subject": "[dpdk-dev] [PATCH] Add user defined tag calculation callback to\n\tlibrte_distributor.",
        "X-BeenThere": "dev@dpdk.org",
        "X-Mailman-Version": "2.1.15",
        "Precedence": "list",
        "List-Id": "patches and discussions about DPDK <dev.dpdk.org>",
        "List-Unsubscribe": "<http://dpdk.org/ml/options/dev>,\n\t<mailto:dev-request@dpdk.org?subject=unsubscribe>",
        "List-Archive": "<http://dpdk.org/ml/archives/dev/>",
        "List-Post": "<mailto:dev@dpdk.org>",
        "List-Help": "<mailto:dev-request@dpdk.org?subject=help>",
        "List-Subscribe": "<http://dpdk.org/ml/listinfo/dev>,\n\t<mailto:dev-request@dpdk.org?subject=subscribe>",
        "Errors-To": "dev-bounces@dpdk.org",
        "Sender": "\"dev\" <dev-bounces@dpdk.org>"
    },
    "content": "User defined tag calculation has access to mbuf.\nDefault tag is RSS hash result.\n\nSigned-off-by: Qinglai Xiao <jigsaw@gmail.com>\n---\n app/test/test_distributor.c              |    6 +++---\n app/test/test_distributor_perf.c         |    2 +-\n lib/librte_distributor/rte_distributor.c |   12 ++++++++++--\n lib/librte_distributor/rte_distributor.h |    7 ++++++-\n 4 files changed, 20 insertions(+), 7 deletions(-)",
    "diff": "diff --git a/app/test/test_distributor.c b/app/test/test_distributor.c\nindex ce06436..6ea4943 100644\n--- a/app/test/test_distributor.c\n+++ b/app/test/test_distributor.c\n@@ -452,7 +452,7 @@ 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, NULL);\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@@ -467,7 +467,7 @@ int test_error_distributor_create_numworkers(void)\n {\n \tstruct rte_distributor *d = NULL;\n \td = rte_distributor_create(\"test_numworkers\", rte_socket_id(),\n-\t\t\tRTE_MAX_LCORE + 10);\n+\t\t\tRTE_MAX_LCORE + 10, NULL);\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@@ -515,7 +515,7 @@ test_distributor(void)\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\t\t\trte_lcore_count() - 1, NULL);\n \t\tif (d == NULL) {\n \t\t\tprintf(\"Error creating distributor\\n\");\n \t\t\treturn -1;\ndiff --git a/app/test/test_distributor_perf.c b/app/test/test_distributor_perf.c\nindex b04864c..507e446 100644\n--- a/app/test/test_distributor_perf.c\n+++ b/app/test/test_distributor_perf.c\n@@ -227,7 +227,7 @@ 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, NULL);\n \t\tif (d == NULL) {\n \t\t\tprintf(\"Error creating distributor\\n\");\n \t\t\treturn -1;\ndiff --git a/lib/librte_distributor/rte_distributor.c b/lib/librte_distributor/rte_distributor.c\nindex 585ff88..78c92bd 100644\n--- a/lib/librte_distributor/rte_distributor.c\n+++ b/lib/librte_distributor/rte_distributor.c\n@@ -97,6 +97,7 @@ struct rte_distributor {\n \tunion rte_distributor_buffer bufs[RTE_MAX_LCORE];\n \n \tstruct rte_distributor_returned_pkts returns;\n+\trte_distributor_tag_fn tag_cb;\n };\n \n TAILQ_HEAD(rte_distributor_list, rte_distributor);\n@@ -267,6 +268,7 @@ rte_distributor_process(struct rte_distributor *d,\n \tstruct rte_mbuf *next_mb = NULL;\n \tint64_t next_value = 0;\n \tuint32_t new_tag = 0;\n+\trte_distributor_tag_fn tag_cb = d->tag_cb;\n \tunsigned ret_start = d->returns.start,\n \t\t\tret_count = d->returns.count;\n \n@@ -282,7 +284,11 @@ rte_distributor_process(struct rte_distributor *d,\n \t\t\tnext_mb = mbufs[next_idx++];\n \t\t\tnext_value = (((int64_t)(uintptr_t)next_mb)\n \t\t\t\t\t<< RTE_DISTRIB_FLAG_BITS);\n-\t\t\tnew_tag = (next_mb->hash.rss | 1);\n+\t\t\tif (tag_cb) {\n+\t\t\t\tnew_tag = tag_cb(next_mb);\n+\t\t\t} else {\n+\t\t\t\tnew_tag = (next_mb->hash.rss | 1);\n+\t\t\t}\n \n \t\t\tuint32_t match = 0;\n \t\t\tunsigned i;\n@@ -401,7 +407,8 @@ rte_distributor_clear_returns(struct rte_distributor *d)\n struct rte_distributor *\n rte_distributor_create(const char *name,\n \t\tunsigned socket_id,\n-\t\tunsigned num_workers)\n+\t\tunsigned num_workers,\n+\t\trte_distributor_tag_fn tag_cb)\n {\n \tstruct rte_distributor *d;\n \tstruct rte_distributor_list *distributor_list;\n@@ -435,6 +442,7 @@ rte_distributor_create(const char *name,\n \td = mz->addr;\n \tsnprintf(d->name, sizeof(d->name), \"%s\", name);\n \td->num_workers = num_workers;\n+\td->tag_cb = tag_cb;\n \n \trte_rwlock_write_lock(RTE_EAL_TAILQ_RWLOCK);\n \tTAILQ_INSERT_TAIL(distributor_list, d, next);\ndiff --git a/lib/librte_distributor/rte_distributor.h b/lib/librte_distributor/rte_distributor.h\nindex ec0d74a..844d325 100644\n--- a/lib/librte_distributor/rte_distributor.h\n+++ b/lib/librte_distributor/rte_distributor.h\n@@ -52,6 +52,9 @@ extern \"C\" {\n \n struct rte_distributor;\n \n+typedef uint32_t (*rte_distributor_tag_fn)(struct rte_mbuf *);\n+/**< User defined tag calculation function */\n+\n /**\n  * Function to create a new distributor instance\n  *\n@@ -65,12 +68,14 @@ struct rte_distributor;\n  * @param num_workers\n  *   The maximum number of workers that will request packets from this\n  *   distributor\n+ * @param tag_cb\n+ *   The callback function for calculation of user defined tag.\n  * @return\n  *   The newly created distributor instance\n  */\n struct rte_distributor *\n rte_distributor_create(const char *name, unsigned socket_id,\n-\t\tunsigned num_workers);\n+\t\tunsigned num_workers, rte_distributor_tag_fn tag_cb);\n \n /*  *** APIS to be called on the distributor lcore ***  */\n /*\n",
    "prefixes": [
        "dpdk-dev"
    ]
}