get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 35085,
    "url": "http://patches.dpdk.org/api/patches/35085/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/1518172019-7040-1-git-send-email-alanrobertsonatt@gmail.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": "<1518172019-7040-1-git-send-email-alanrobertsonatt@gmail.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1518172019-7040-1-git-send-email-alanrobertsonatt@gmail.com",
    "date": "2018-02-09T10:26:59",
    "name": "[dpdk-dev] Improve the shaper accuracy for large packets",
    "commit_ref": null,
    "pull_url": null,
    "state": "not-applicable",
    "archived": true,
    "hash": "65671a47ee137a8fef11071318b7d602e5cd6c9e",
    "submitter": {
        "id": 941,
        "url": "http://patches.dpdk.org/api/people/941/?format=api",
        "name": "Alan Robertson",
        "email": "alanrobertsonatt@gmail.com"
    },
    "delegate": null,
    "mbox": "http://patches.dpdk.org/project/dpdk/patch/1518172019-7040-1-git-send-email-alanrobertsonatt@gmail.com/mbox/",
    "series": [],
    "comments": "http://patches.dpdk.org/api/patches/35085/comments/",
    "check": "warning",
    "checks": "http://patches.dpdk.org/api/patches/35085/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 [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id 63E791B811;\n\tFri,  9 Feb 2018 11:27:11 +0100 (CET)",
            "from mail-wm0-f65.google.com (mail-wm0-f65.google.com\n\t[74.125.82.65]) by dpdk.org (Postfix) with ESMTP id EDFDE1B80E\n\tfor <dev@dpdk.org>; Fri,  9 Feb 2018 11:27:09 +0100 (CET)",
            "by mail-wm0-f65.google.com with SMTP id v71so15309908wmv.2\n\tfor <dev@dpdk.org>; Fri, 09 Feb 2018 02:27:09 -0800 (PST)",
            "from ar771e-Precision-7520.vyatta.net ([137.221.143.78])\n\tby smtp.gmail.com with ESMTPSA id\n\td125sm1439610wmc.47.2018.02.09.02.27.08\n\t(version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128);\n\tFri, 09 Feb 2018 02:27:09 -0800 (PST)"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;\n\th=from:to:cc:subject:date:message-id;\n\tbh=2wjSLI5HBA26ruju4uhlJVwjwcGrImn5MHYl5PNZH2U=;\n\tb=Yov06vsonC+Gkkb4zFCwRmV7zjs3C4y7FWVelUhch3o39WXOXeWQr0U/1ltxUX5+wZ\n\tlm7socppFvaDNaTps0M5zeDeTd1HppgqeiFyfD9zmRV9KzYqQ9b7MtvQxLf4hrgYn66s\n\tg0q1VniY5jiHM9RGsbVIeBfU3cFIOr8rLTtJQ8AVa4OvDiw0qJPoYHHnJ+y+5lE25N1u\n\tmrOzSsE/8oZkBRpU65hOYoLqiEx9G1UebEHiLMPM0X4AAOm5BcI0g4ZR6BZrsM5QvLpj\n\t5tCQNvYTLbXkuVjR+rjR268OPnsqXS/tFDIuaROyiqmUS69bg9fqmoWUhYmegkWr9thO\n\tHaFw==",
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:from:to:cc:subject:date:message-id;\n\tbh=2wjSLI5HBA26ruju4uhlJVwjwcGrImn5MHYl5PNZH2U=;\n\tb=WfXHwG2fUojORdPhELyyl5w/P1m/PJncYaAmInwJPGuT73uXOWGE72fOlEgJZp4zP4\n\teWSqhoYGr1h0QpM756rOrImJw8BdQzyxn44xjsJoyzN0PzoFVJf5He3FWoV0x1f0dFtb\n\tyJNAAwCDN/biMBV0w1LvBVz3r5chaWg1s8Hr9PxevL/3wLgZQ+kFM97Ta6ip8FCQNlGK\n\tlHVOeEoCRhf7c0PqF3v8Qn44PIVRbhfv2vWtwC2Tu9PMTBBDQcFegEuaBiXVwhzoxecp\n\tvjz51fNdo8zYgUjYTSoFddu2On6RvFWR9GntYEHXEAje5j9n89AB7qmjTotPhJBLNLNp\n\t7hLQ==",
        "X-Gm-Message-State": "APf1xPBJRexTBI/4maiFvZULr0OJn5mMHL2s+cu5QXXLO5EaLG6DMk4L\n\tfyiogsYXiasZs4yW44DBzKgUsDEh",
        "X-Google-Smtp-Source": "AH8x226HxZh4jM3TNA+xnwvqDAObj22iK0MPsRYsoSo7f3UY+pPVKBBLk7LdI3IG18kTpTUsg26EXw==",
        "X-Received": "by 10.28.156.67 with SMTP id f64mr1708275wme.11.1518172029686;\n\tFri, 09 Feb 2018 02:27:09 -0800 (PST)",
        "From": "alanrobertsonatt@gmail.com",
        "To": "cristian.dumitrescu@intel.com",
        "Cc": "dev@dpdk.org,\n\tAlan Robertson <ar771e@att.com>",
        "Date": "Fri,  9 Feb 2018 10:26:59 +0000",
        "Message-Id": "<1518172019-7040-1-git-send-email-alanrobertsonatt@gmail.com>",
        "X-Mailer": "git-send-email 2.7.4",
        "Subject": "[dpdk-dev] [PATCH] Improve the shaper accuracy for large packets",
        "X-BeenThere": "dev@dpdk.org",
        "X-Mailman-Version": "2.1.15",
        "Precedence": "list",
        "List-Id": "DPDK patches and discussions <dev.dpdk.org>",
        "List-Unsubscribe": "<https://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": "<https://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": "From: Alan Robertson <ar771e@att.com>\n\nThere were 2 issues, the first was time could be lost whilst updating\nthe traffic-class period, the second was a frame could be delayed if\nnot enough tokens were available for the full frame.  By allowing the\nshaper to borrow credit from the next period the throughput is improved.\n---\n lib/librte_sched/rte_sched.c | 58 +++++++++++++++++++++++++++++++-------------\n 1 file changed, 41 insertions(+), 17 deletions(-)",
    "diff": "diff --git a/lib/librte_sched/rte_sched.c b/lib/librte_sched/rte_sched.c\nindex 634486c..e53a424 100644\n--- a/lib/librte_sched/rte_sched.c\n+++ b/lib/librte_sched/rte_sched.c\n@@ -57,7 +57,7 @@ struct rte_sched_subport {\n \t/* Traffic classes (TCs) */\n \tuint64_t tc_time; /* time of next update */\n \tuint32_t tc_credits_per_period[RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE];\n-\tuint32_t tc_credits[RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE];\n+\tint32_t tc_credits[RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE];\n \tuint32_t tc_period;\n \n \t/* TC oversubscription */\n@@ -98,7 +98,7 @@ struct rte_sched_pipe {\n \n \t/* Traffic classes (TCs) */\n \tuint64_t tc_time; /* time of next update */\n-\tuint32_t tc_credits[RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE];\n+\tint32_t tc_credits[RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE];\n \n \t/* Weighted Round Robin (WRR) */\n \tuint8_t wrr_tokens[RTE_SCHED_QUEUES_PER_PIPE];\n@@ -1451,6 +1451,8 @@ grinder_credits_update(struct rte_sched_port *port, uint32_t pos)\n \tstruct rte_sched_pipe *pipe = grinder->pipe;\n \tstruct rte_sched_pipe_profile *params = grinder->pipe_params;\n \tuint64_t n_periods;\n+\tuint32_t tc;\n+\tuint64_t lapsed;\n \n \t/* Subport TB */\n \tn_periods = (port->time - subport->tb_time) / subport->tb_period;\n@@ -1466,20 +1468,42 @@ grinder_credits_update(struct rte_sched_port *port, uint32_t pos)\n \n \t/* Subport TCs */\n \tif (unlikely(port->time >= subport->tc_time)) {\n-\t\tsubport->tc_credits[0] = subport->tc_credits_per_period[0];\n-\t\tsubport->tc_credits[1] = subport->tc_credits_per_period[1];\n-\t\tsubport->tc_credits[2] = subport->tc_credits_per_period[2];\n-\t\tsubport->tc_credits[3] = subport->tc_credits_per_period[3];\n-\t\tsubport->tc_time = port->time + subport->tc_period;\n+\t\tfor (tc = 0; tc < RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE; tc++) {\n+\t\t\tif (subport->tc_credits[tc] < 0)\n+\t\t\t\tsubport->tc_credits[tc] +=\n+\t\t\t\t\tsubport->tc_credits_per_period[tc];\n+\t\t\telse\n+\t\t\t\tsubport->tc_credits[tc] =\n+\t\t\t\t\tsubport->tc_credits_per_period[tc];\n+\t\t}\n+\t\t/* If we've run into the next period only update the clock to\n+\t\t * the time + tc_period so we'll replenish the tc tokens early\n+\t\t * in the next tc_period to compensate. */\n+\t\tlapsed = port->time - subport->tc_time;\n+\t\tif (lapsed < subport->tc_period)\n+\t\t\tsubport->tc_time += subport->tc_period;\n+\t\telse\n+\t\t\tsubport->tc_time = port->time + subport->tc_period;\n \t}\n \n \t/* Pipe TCs */\n \tif (unlikely(port->time >= pipe->tc_time)) {\n-\t\tpipe->tc_credits[0] = params->tc_credits_per_period[0];\n-\t\tpipe->tc_credits[1] = params->tc_credits_per_period[1];\n-\t\tpipe->tc_credits[2] = params->tc_credits_per_period[2];\n-\t\tpipe->tc_credits[3] = params->tc_credits_per_period[3];\n-\t\tpipe->tc_time = port->time + params->tc_period;\n+\t\tfor (tc = 0; tc < RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE; tc++) {\n+\t\t\tif (pipe->tc_credits[tc] < 0)\n+\t\t\t\tpipe->tc_credits[tc] +=\n+\t\t\t\t\tparams->tc_credits_per_period[tc];\n+\t\t\telse\n+\t\t\t\tpipe->tc_credits[tc] =\n+\t\t\t\t\tparams->tc_credits_per_period[tc];\n+\t\t}\n+\t\t/* If we've run into the next period only update the clock to\n+\t\t * the time + tc_period so we'll replenish the tc tokens early\n+\t\t * in the next tc_period to compensate. */\n+\t\tlapsed = port->time - pipe->tc_time;\n+\t\tif (lapsed < params->tc_period)\n+\t\t\tpipe->tc_time += params->tc_period;\n+\t\telse\n+\t\t\tpipe->tc_time = port->time + params->tc_period;\n \t}\n }\n \n@@ -1586,16 +1610,16 @@ grinder_credits_check(struct rte_sched_port *port, uint32_t pos)\n \tuint32_t tc_index = grinder->tc_index;\n \tuint32_t pkt_len = pkt->pkt_len + port->frame_overhead;\n \tuint32_t subport_tb_credits = subport->tb_credits;\n-\tuint32_t subport_tc_credits = subport->tc_credits[tc_index];\n+\tint32_t subport_tc_credits = subport->tc_credits[tc_index];\n \tuint32_t pipe_tb_credits = pipe->tb_credits;\n-\tuint32_t pipe_tc_credits = pipe->tc_credits[tc_index];\n+\tint32_t pipe_tc_credits = pipe->tc_credits[tc_index];\n \tint enough_credits;\n \n \t/* Check queue credits */\n \tenough_credits = (pkt_len <= subport_tb_credits) &&\n-\t\t(pkt_len <= subport_tc_credits) &&\n+\t\t(subport_tc_credits > 0) &&\n \t\t(pkt_len <= pipe_tb_credits) &&\n-\t\t(pkt_len <= pipe_tc_credits);\n+\t\t(pipe_tc_credits > 0);\n \n \tif (!enough_credits)\n \t\treturn 0;\n@@ -1603,8 +1627,8 @@ grinder_credits_check(struct rte_sched_port *port, uint32_t pos)\n \t/* Update port credits */\n \tsubport->tb_credits -= pkt_len;\n \tsubport->tc_credits[tc_index] -= pkt_len;\n-\tpipe->tb_credits -= pkt_len;\n \tpipe->tc_credits[tc_index] -= pkt_len;\n+\tpipe->tb_credits -= pkt_len;\n \n \treturn 1;\n }\n",
    "prefixes": [
        "dpdk-dev"
    ]
}