get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 9170,
    "url": "http://patchwork.dpdk.org/api/patches/9170/?format=api",
    "web_url": "http://patchwork.dpdk.org/project/dpdk/patch/1448822809-8350-4-git-send-email-stephen@networkplumber.org/",
    "project": {
        "id": 1,
        "url": "http://patchwork.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": "<1448822809-8350-4-git-send-email-stephen@networkplumber.org>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1448822809-8350-4-git-send-email-stephen@networkplumber.org",
    "date": "2015-11-29T18:46:49",
    "name": "[dpdk-dev,3/3] rte_sched: eliminate floating point in calculating byte clock",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": true,
    "hash": "295026beaee2efad03800b797829c291a7983a43",
    "submitter": {
        "id": 27,
        "url": "http://patchwork.dpdk.org/api/people/27/?format=api",
        "name": "Stephen Hemminger",
        "email": "stephen@networkplumber.org"
    },
    "delegate": null,
    "mbox": "http://patchwork.dpdk.org/project/dpdk/patch/1448822809-8350-4-git-send-email-stephen@networkplumber.org/mbox/",
    "series": [],
    "comments": "http://patchwork.dpdk.org/api/patches/9170/comments/",
    "check": "pending",
    "checks": "http://patchwork.dpdk.org/api/patches/9170/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 63B0F8D96;\n\tSun, 29 Nov 2015 19:46:53 +0100 (CET)",
            "from mail-pa0-f47.google.com (mail-pa0-f47.google.com\n\t[209.85.220.47]) by dpdk.org (Postfix) with ESMTP id BA4638D39\n\tfor <dev@dpdk.org>; Sun, 29 Nov 2015 19:46:49 +0100 (CET)",
            "by pacej9 with SMTP id ej9so160650547pac.2\n\tfor <dev@dpdk.org>; Sun, 29 Nov 2015 10:46:49 -0800 (PST)",
            "from xeon-e3.home.lan (static-50-53-82-155.bvtn.or.frontiernet.net.\n\t[50.53.82.155]) by smtp.gmail.com with ESMTPSA id\n\tqn5sm46905832pac.41.2015.11.29.10.46.48\n\t(version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128);\n\tSun, 29 Nov 2015 10:46:48 -0800 (PST)"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=networkplumber-org.20150623.gappssmtp.com; s=20150623;\n\th=from:to:cc:subject:date:message-id:in-reply-to:references;\n\tbh=+ukpvDXJOOO55KfTI0LQDe0UQUOYHKWg7iqYSNpGApI=;\n\tb=RFuYDwwGVHWALe2JRtTeXorkq9L/tJI3qZu8cunt5r5LKHhs75lPkSRcCHkn1EZTxs\n\tB3yTf9/L5o7zHt+zpIcABmX1xM+hp647nZ5tXO87MW6HUAE3lDO7nSq6TzYb0I8CuPUU\n\tcCQGT0JIsnFm5QhmHFuAPp/p5xrD2kDuS6IiVcBFs7/jINDcT1qegcp5XSEpniTdMrNp\n\t8c73nMcjtVda/ejBgTKNht8Jf1irFrbOgbrRh8SZZ1onm9p5F5vj3pHZgGaqMlG6kf8s\n\trqIJs9mv3zpdx72Qgt6emcIzlZCPGfC+1iZjtyYAYzYWn0/WIbnr67X8NT5UbxL3VrCH\n\tidLw==",
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20130820;\n\th=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to\n\t:references;\n\tbh=+ukpvDXJOOO55KfTI0LQDe0UQUOYHKWg7iqYSNpGApI=;\n\tb=LxVTAgv4EKlsPSgzF1h3Pvjpj9uU88rlKXpFkCMNsRZZqcr6kypntUGirikWj5nblP\n\t7/xoVB4AL5AmTI2XdcI91HKD0qwLNp7U7EinT16Kfr12IAFgpqSkXLN0HdlC2fec93So\n\trXR78FfRkDAI6Uikc/9Q5wb/kL63IQbuxsoZM0oMO5PEP4K4Duv0VG7RJQwZTgnzNwxv\n\tWQ0lwmoo3G3jl3IxhcQgR2qX9ZtBj3t7k3yhJXZoJc3wvdMSS4kARMhaZlPEIxaBPGYy\n\tpoGjLUXqr5+4/IJ0+uYooj8CyLOMsHI5fYzGTGd5okmWVM/QnCPmzvU4qARoyMevVMi+\n\tiEGQ==",
        "X-Gm-Message-State": "ALoCoQk+CZe8gtGfj4jUuxnyZqPIAbTm9xXtjCJsAz+K3/EWtnR//WaHXTLpyVvb/jx6nuSarMCt",
        "X-Received": "by 10.98.0.195 with SMTP id 186mr65106141pfa.130.1448822809184; \n\tSun, 29 Nov 2015 10:46:49 -0800 (PST)",
        "From": "Stephen Hemminger <stephen@networkplumber.org>",
        "To": "cristian.dumitrescu@intel.com",
        "Date": "Sun, 29 Nov 2015 10:46:49 -0800",
        "Message-Id": "<1448822809-8350-4-git-send-email-stephen@networkplumber.org>",
        "X-Mailer": "git-send-email 2.1.4",
        "In-Reply-To": "<1448822809-8350-1-git-send-email-stephen@networkplumber.org>",
        "References": "<1448822809-8350-1-git-send-email-stephen@networkplumber.org>",
        "Cc": "dev@dpdk.org",
        "Subject": "[dpdk-dev] [PATCH 3/3] rte_sched: eliminate floating point in\n\tcalculating byte clock",
        "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": "The old code was doing a floating point divide for each rte_dequeue()\nwhich is very expensive. Change to using fixed point scaled inverse\nmultiply. To maintain equivalent precision, scaled math is used.\nThe application ABI is the same.\n\nThis improved performance from 5Gbit/sec to 10 Gbit/sec when configured\nfor 10 Gbit/sec rate.\n\nThere was some feedback from Cristian that he wanted a better\nsolution and was going to give one, but none was provided.\nFor 2.2 this is a better solution than existing code, if someone\nhas a better version I would love to see it.\n\nSigned-off-by: Stephen Hemminger <stephen@networkplumber.org>\n---\n lib/librte_sched/rte_sched.c | 23 ++++++++++++++++++-----\n 1 file changed, 18 insertions(+), 5 deletions(-)",
    "diff": "diff --git a/lib/librte_sched/rte_sched.c b/lib/librte_sched/rte_sched.c\nindex 16acd6b..cfae136 100644\n--- a/lib/librte_sched/rte_sched.c\n+++ b/lib/librte_sched/rte_sched.c\n@@ -47,6 +47,7 @@\n #include \"rte_bitmap.h\"\n #include \"rte_sched_common.h\"\n #include \"rte_approx.h\"\n+#include \"rte_reciprocal.h\"\n \n #ifdef __INTEL_COMPILER\n #pragma warning(disable:2259) /* conversion may lose significant bits */\n@@ -62,6 +63,11 @@\n #define RTE_SCHED_PIPE_INVALID                UINT32_MAX\n #define RTE_SCHED_BMP_POS_INVALID             UINT32_MAX\n \n+/* Scaling for cycles_per_byte calculation\n+ * Chosen so that minimum rate is 480 bit/sec\n+ */\n+#define RTE_SCHED_TIME_SHIFT\t\t      8\n+\n struct rte_sched_subport {\n \t/* Token bucket (TB) */\n \tuint64_t tb_time; /* time of last update */\n@@ -215,7 +221,7 @@ struct rte_sched_port {\n \tuint64_t time_cpu_cycles;     /* Current CPU time measured in CPU cyles */\n \tuint64_t time_cpu_bytes;      /* Current CPU time measured in bytes */\n \tuint64_t time;                /* Current NIC TX time measured in bytes */\n-\tdouble cycles_per_byte;       /* CPU cycles per byte */\n+\tstruct rte_reciprocal inv_cycles_per_byte; /* CPU cycles per byte */\n \n \t/* Scheduling loop detection */\n \tuint32_t pipe_loop;\n@@ -610,7 +616,7 @@ struct rte_sched_port *\n rte_sched_port_config(struct rte_sched_port_params *params)\n {\n \tstruct rte_sched_port *port = NULL;\n-\tuint32_t mem_size, bmp_mem_size, n_queues_per_port, i;\n+\tuint32_t mem_size, bmp_mem_size, n_queues_per_port, i, cycles_per_byte;\n \n \t/* Check user parameters. Determine the amount of memory to allocate */\n \tmem_size = rte_sched_port_get_memory_footprint(params);\n@@ -661,7 +667,10 @@ rte_sched_port_config(struct rte_sched_port_params *params)\n \tport->time_cpu_cycles = rte_get_tsc_cycles();\n \tport->time_cpu_bytes = 0;\n \tport->time = 0;\n-\tport->cycles_per_byte = ((double) rte_get_tsc_hz()) / ((double) params->rate);\n+\n+\tcycles_per_byte = (rte_get_tsc_hz() << RTE_SCHED_TIME_SHIFT)\n+\t\t/ params->rate;\n+\tport->inv_cycles_per_byte = rte_reciprocal_value(cycles_per_byte);\n \n \t/* Scheduling loop detection */\n \tport->pipe_loop = RTE_SCHED_PIPE_INVALID;\n@@ -2088,11 +2097,15 @@ rte_sched_port_time_resync(struct rte_sched_port *port)\n {\n \tuint64_t cycles = rte_get_tsc_cycles();\n \tuint64_t cycles_diff = cycles - port->time_cpu_cycles;\n-\tdouble bytes_diff = ((double) cycles_diff) / port->cycles_per_byte;\n+\tuint64_t bytes_diff;\n+\n+\t/* Compute elapsed time in bytes */\n+\tbytes_diff = rte_reciprocal_divide(cycles_diff << RTE_SCHED_TIME_SHIFT,\n+\t\t\t\t\t   port->inv_cycles_per_byte);\n \n \t/* Advance port time */\n \tport->time_cpu_cycles = cycles;\n-\tport->time_cpu_bytes += (uint64_t) bytes_diff;\n+\tport->time_cpu_bytes += bytes_diff;\n \tif (port->time < port->time_cpu_bytes)\n \t\tport->time = port->time_cpu_bytes;\n \n",
    "prefixes": [
        "dpdk-dev",
        "3/3"
    ]
}