get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 1239,
    "url": "https://patches.dpdk.org/api/patches/1239/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/1415630642-3905-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": "<1415630642-3905-1-git-send-email-jigsaw@gmail.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1415630642-3905-1-git-send-email-jigsaw@gmail.com",
    "date": "2014-11-10T14:44:02",
    "name": "[dpdk-dev,v3] Add in_flight_bitmask so as to use full 32 bits of tag.",
    "commit_ref": null,
    "pull_url": null,
    "state": "rfc",
    "archived": true,
    "hash": "d1fbc5db7ba6dbd25d1af10bef4e4014511ff204",
    "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/1415630642-3905-1-git-send-email-jigsaw@gmail.com/mbox/",
    "series": [],
    "comments": "https://patches.dpdk.org/api/patches/1239/comments/",
    "check": "pending",
    "checks": "https://patches.dpdk.org/api/patches/1239/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 0333A7F2C;\n\tMon, 10 Nov 2014 15:34:23 +0100 (CET)",
            "from mail-la0-f50.google.com (mail-la0-f50.google.com\n\t[209.85.215.50]) by dpdk.org (Postfix) with ESMTP id 9E1EE7E9D\n\tfor <dev@dpdk.org>; Mon, 10 Nov 2014 15:34:20 +0100 (CET)",
            "by mail-la0-f50.google.com with SMTP id hs14so1521596lab.23\n\tfor <dev@dpdk.org>; Mon, 10 Nov 2014 06:44:06 -0800 (PST)",
            "from localhost.localdomain ([194.251.119.201])\n\tby mx.google.com with ESMTPSA id\n\tb4sm5326894lak.28.2014.11.10.06.44.05 for <multiple recipients>\n\t(version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);\n\tMon, 10 Nov 2014 06:44:05 -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=DXw73YKmuWn+Us+THRPRvGwO6LJIvHskPxl8vm109UY=;\n\tb=kDmi7B/ZTmWeoS7zYTDYPX3jjOS0wEgIASEwMFe9e+50jewaVVpXEo0x5+p6JhbXE7\n\thKIQ8UYXRjvopOQW2CjeEO9hrwLuR9jY1TYZtstxz91mDOgif9QgLMOp/9b9nI6eKW/e\n\tO9IMTq3o+1sn6jbPB7GVLmFM9yue6R/GHSorq4EVM1hqKZNKyW2fWpC556zJ3mgY26t/\n\tacdBUcOsKL0f+nMlSOPoV1gAVY8MYIOsG5z7OXYD0rgK1q8rW1Jvf33+PHYmH9KgM1R5\n\tgXh/9Eclc6PGBl4u2axalVKEtEE1pucmraGBBC3QuDqCJdgll4tz8y4gdKbDtLsD8+Ic\n\t5YCQ==",
        "X-Received": "by 10.112.63.133 with SMTP id g5mr28256986lbs.33.1415630645996; \n\tMon, 10 Nov 2014 06:44:05 -0800 (PST)",
        "From": "Qinglai Xiao <jigsaw@gmail.com>",
        "To": "dev@dpdk.org",
        "Date": "Mon, 10 Nov 2014 16:44:02 +0200",
        "Message-Id": "<1415630642-3905-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 v3] Add in_flight_bitmask so as to use full 32\n\tbits of tag.",
        "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": "With introduction of in_flight_bitmask, the whole 32 bits of tag can be\nused. Further more, this patch fixed the integer overflow when finding\nthe matched tags.\nThe maximum number workers is now defined as 64, which is length of\ndouble-word. The link between number of workers and RTE_MAX_LCORE is\nnow removed. Compile time check is added to ensure the\nRTE_DISTRIB_MAX_WORKERS is less than or equal to size of double-word.\n\nSigned-off-by: Qinglai Xiao <jigsaw@gmail.com>\n---\n lib/librte_distributor/rte_distributor.c |   64 ++++++++++++++++++++++--------\n lib/librte_distributor/rte_distributor.h |    4 ++\n 2 files changed, 51 insertions(+), 17 deletions(-)",
    "diff": "diff --git a/lib/librte_distributor/rte_distributor.c b/lib/librte_distributor/rte_distributor.c\nindex 3dfec4a..2c5d61c 100644\n--- a/lib/librte_distributor/rte_distributor.c\n+++ b/lib/librte_distributor/rte_distributor.c\n@@ -62,6 +62,13 @@\n #define RTE_DISTRIB_RETURNS_MASK (RTE_DISTRIB_MAX_RETURNS - 1)\n \n /**\n+ * Maximum number of workers allowed.\n+ * Be aware of increasing the limit, becaus it is limited by how we track\n+ * in-flight tags. See @in_flight_bitmask and @rte_distributor_process\n+ */\n+#define RTE_DISTRIB_MAX_WORKERS\t64\n+\n+/**\n  * Buffer structure used to pass the pointer data between cores. This is cache\n  * line aligned, but to improve performance and prevent adjacent cache-line\n  * prefetches of buffers for other workers, e.g. when worker 1's buffer is on\n@@ -91,11 +98,17 @@ struct rte_distributor {\n \tchar name[RTE_DISTRIBUTOR_NAMESIZE];  /**< Name of the ring. */\n \tunsigned num_workers;                 /**< Number of workers polling */\n \n-\tuint32_t in_flight_tags[RTE_MAX_LCORE];\n-\t\t/**< Tracks the tag being processed per core, 0 == no pkt */\n-\tstruct rte_distributor_backlog backlog[RTE_MAX_LCORE];\n+\tuint32_t in_flight_tags[RTE_DISTRIB_MAX_WORKERS];\n+\t\t/**< Tracks the tag being processed per core */\n+\tuint64_t in_flight_bitmask;\n+\t\t/**< on/off bits for in-flight tags.\n+\t\t * Note that if RTE_DISTRIB_MAX_WORKERS is larger than 64 then\n+\t\t * the bitmask has to expand.\n+\t\t */\n+\n+\tstruct rte_distributor_backlog backlog[RTE_DISTRIB_MAX_WORKERS];\n \n-\tunion rte_distributor_buffer bufs[RTE_MAX_LCORE];\n+\tunion rte_distributor_buffer bufs[RTE_DISTRIB_MAX_WORKERS];\n \n \tstruct rte_distributor_returned_pkts returns;\n };\n@@ -189,6 +202,7 @@ static inline void\n handle_worker_shutdown(struct rte_distributor *d, unsigned wkr)\n {\n \td->in_flight_tags[wkr] = 0;\n+\td->in_flight_bitmask &= ~(1UL << wkr);\n \td->bufs[wkr].bufptr64 = 0;\n \tif (unlikely(d->backlog[wkr].count != 0)) {\n \t\t/* On return of a packet, we need to move the\n@@ -211,7 +225,10 @@ handle_worker_shutdown(struct rte_distributor *d, unsigned wkr)\n \t\t\tpkts[i] = (void *)((uintptr_t)(bl->pkts[idx] >>\n \t\t\t\t\tRTE_DISTRIB_FLAG_BITS));\n \t\t}\n-\t\t/* recursive call */\n+\t\t/* recursive call.\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\tbl->count = bl->start = 0;\n \t}\n@@ -242,6 +259,7 @@ process_returns(struct rte_distributor *d)\n \t\t\telse {\n \t\t\t\td->bufs[wkr].bufptr64 = RTE_DISTRIB_GET_BUF;\n \t\t\t\td->in_flight_tags[wkr] = 0;\n+\t\t\t\td->in_flight_bitmask &= ~(1UL << wkr);\n \t\t\t}\n \t\t\toldbuf = data >> RTE_DISTRIB_FLAG_BITS;\n \t\t} else if (data & RTE_DISTRIB_RETURN_BUF) {\n@@ -284,14 +302,18 @@ rte_distributor_process(struct rte_distributor *d,\n \t\t\tnext_value = (((int64_t)(uintptr_t)next_mb)\n \t\t\t\t\t<< RTE_DISTRIB_FLAG_BITS);\n \t\t\t/*\n-\t\t\t * Set the low bit on the tag, so we can guarantee that\n-\t\t\t * we never store a tag value of zero. That means we can\n-\t\t\t * use the zero-value to indicate that no packet is\n-\t\t\t * being processed by a worker.\n+\t\t\t * User is advocated to set tag vaue for each\n+\t\t\t * mbuf before calling rte_distributor_process.\n+\t\t\t * User defined tags are used to identify flows,\n+\t\t\t * or sessions.\n \t\t\t */\n-\t\t\tnew_tag = (next_mb->hash.usr | 1);\n+\t\t\tnew_tag = next_mb->hash.usr;\n \n-\t\t\tuint32_t match = 0;\n+\t\t\t/*\n+\t\t\t * Note that if RTE_DISTRIB_MAX_WORKERS is larger than 64\n+\t\t\t * then the size of match has to be expanded.\n+\t\t\t */\n+\t\t\tuint64_t match = 0;\n \t\t\tunsigned i;\n \t\t\t/*\n \t\t\t * to scan for a match use \"xor\" and \"not\" to get a 0/1\n@@ -303,9 +325,12 @@ rte_distributor_process(struct rte_distributor *d,\n \t\t\t\tmatch |= (!(d->in_flight_tags[i] ^ new_tag)\n \t\t\t\t\t<< i);\n \n+\t\t\t/* Only turned-on bits are considered as match */\n+\t\t\tmatch &= d->in_flight_bitmask;\n+\n \t\t\tif (match) {\n \t\t\t\tnext_mb = NULL;\n-\t\t\t\tunsigned worker = __builtin_ctz(match);\n+\t\t\t\tunsigned worker = __builtin_ctzl(match);\n \t\t\t\tif (add_to_backlog(&d->backlog[worker],\n \t\t\t\t\t\tnext_value) < 0)\n \t\t\t\t\tnext_idx--;\n@@ -322,6 +347,7 @@ rte_distributor_process(struct rte_distributor *d,\n \t\t\telse {\n \t\t\t\td->bufs[wkr].bufptr64 = next_value;\n \t\t\t\td->in_flight_tags[wkr] = new_tag;\n+\t\t\t\td->in_flight_bitmask |= (1UL << wkr);\n \t\t\t\tnext_mb = NULL;\n \t\t\t}\n \t\t\toldbuf = data >> RTE_DISTRIB_FLAG_BITS;\n@@ -379,11 +405,13 @@ rte_distributor_returned_pkts(struct rte_distributor *d,\n static inline unsigned\n total_outstanding(const struct rte_distributor *d)\n {\n-\tunsigned wkr, total_outstanding = 0;\n+\tunsigned wkr, total_outstanding;\n+\n+\ttotal_outstanding = __builtin_popcountl(d->in_flight_bitmask);\n \n \tfor (wkr = 0; wkr < d->num_workers; wkr++)\n-\t\ttotal_outstanding += d->backlog[wkr].count +\n-\t\t\t\t!!(d->in_flight_tags[wkr]);\n+\t\ttotal_outstanding += d->backlog[wkr].count;\n+\n \treturn total_outstanding;\n }\n \n@@ -423,9 +451,11 @@ rte_distributor_create(const char *name,\n \n \t/* compilation-time checks */\n \tRTE_BUILD_BUG_ON((sizeof(*d) & CACHE_LINE_MASK) != 0);\n-\tRTE_BUILD_BUG_ON((RTE_MAX_LCORE & 7) != 0);\n+\tRTE_BUILD_BUG_ON((RTE_DISTRIB_MAX_WORKERS & 7) != 0);\n+\tRTE_BUILD_BUG_ON(RTE_DISTRIB_MAX_WORKERS >\n+\t\t\t\tsizeof(d->in_flight_bitmask) * CHAR_BIT);\n \n-\tif (name == NULL || num_workers >= RTE_MAX_LCORE) {\n+\tif (name == NULL || num_workers >= RTE_DISTRIB_MAX_WORKERS) {\n \t\trte_errno = EINVAL;\n \t\treturn NULL;\n \t}\ndiff --git a/lib/librte_distributor/rte_distributor.h b/lib/librte_distributor/rte_distributor.h\nindex ec0d74a..cc1d559 100644\n--- a/lib/librte_distributor/rte_distributor.h\n+++ b/lib/librte_distributor/rte_distributor.h\n@@ -88,6 +88,10 @@ rte_distributor_create(const char *name, unsigned socket_id,\n  * packets. The distributor will ensure that no two packets that have the\n  * same flow id, or tag, in the mbuf will be procesed at 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",
    "prefixes": [
        "dpdk-dev",
        "v3"
    ]
}