get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 809012,
    "url": "http://patchwork.ozlabs.org/api/patches/809012/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/patch/20170901012625.14838-6-vinicius.gomes@intel.com/",
    "project": {
        "id": 46,
        "url": "http://patchwork.ozlabs.org/api/projects/46/?format=api",
        "name": "Intel Wired Ethernet development",
        "link_name": "intel-wired-lan",
        "list_id": "intel-wired-lan.osuosl.org",
        "list_email": "intel-wired-lan@osuosl.org",
        "web_url": "",
        "scm_url": "",
        "webscm_url": "",
        "list_archive_url": "",
        "list_archive_url_format": "",
        "commit_url_format": ""
    },
    "msgid": "<20170901012625.14838-6-vinicius.gomes@intel.com>",
    "list_archive_url": null,
    "date": "2017-09-01T01:26:25",
    "name": "[RFC,net-next,5/5] samples/tsn: Add script for calculating CBS config",
    "commit_ref": null,
    "pull_url": null,
    "state": "rfc",
    "archived": false,
    "hash": "eea5a4e77612d674dbf77eb431e9eb324ad974f0",
    "submitter": {
        "id": 72272,
        "url": "http://patchwork.ozlabs.org/api/people/72272/?format=api",
        "name": "Vinicius Costa Gomes",
        "email": "vinicius.gomes@intel.com"
    },
    "delegate": null,
    "mbox": "http://patchwork.ozlabs.org/project/intel-wired-lan/patch/20170901012625.14838-6-vinicius.gomes@intel.com/mbox/",
    "series": [
        {
            "id": 1120,
            "url": "http://patchwork.ozlabs.org/api/series/1120/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/list/?series=1120",
            "date": "2017-09-01T01:26:21",
            "name": "TSN: Add qdisc-based config interfaces for traffic shapers",
            "version": 1,
            "mbox": "http://patchwork.ozlabs.org/series/1120/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/809012/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/809012/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<intel-wired-lan-bounces@osuosl.org>",
        "X-Original-To": [
            "incoming@patchwork.ozlabs.org",
            "intel-wired-lan@lists.osuosl.org"
        ],
        "Delivered-To": [
            "patchwork-incoming@bilbo.ozlabs.org",
            "intel-wired-lan@lists.osuosl.org"
        ],
        "Authentication-Results": "ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=osuosl.org\n\t(client-ip=140.211.166.138; helo=whitealder.osuosl.org;\n\tenvelope-from=intel-wired-lan-bounces@osuosl.org;\n\treceiver=<UNKNOWN>)",
        "Received": [
            "from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138])\n\t(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3xkXM75xGQz9sPm\n\tfor <incoming@patchwork.ozlabs.org>;\n\tSat,  2 Sep 2017 07:24:51 +1000 (AEST)",
            "from localhost (localhost [127.0.0.1])\n\tby whitealder.osuosl.org (Postfix) with ESMTP id 1502388FEC;\n\tFri,  1 Sep 2017 21:24:50 +0000 (UTC)",
            "from whitealder.osuosl.org ([127.0.0.1])\n\tby localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024)\n\twith ESMTP id IL8C+qfxGHTE; Fri,  1 Sep 2017 21:24:47 +0000 (UTC)",
            "from ash.osuosl.org (ash.osuosl.org [140.211.166.34])\n\tby whitealder.osuosl.org (Postfix) with ESMTP id 83CB988FE0;\n\tFri,  1 Sep 2017 21:24:47 +0000 (UTC)",
            "from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133])\n\tby ash.osuosl.org (Postfix) with ESMTP id E7FD11CEAE4\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tFri,  1 Sep 2017 01:26:31 +0000 (UTC)",
            "from localhost (localhost [127.0.0.1])\n\tby hemlock.osuosl.org (Postfix) with ESMTP id E25698A115\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tFri,  1 Sep 2017 01:26:31 +0000 (UTC)",
            "from hemlock.osuosl.org ([127.0.0.1])\n\tby localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024)\n\twith ESMTP id K+IUEYtv44rk for <intel-wired-lan@lists.osuosl.org>;\n\tFri,  1 Sep 2017 01:26:31 +0000 (UTC)",
            "from mga04.intel.com (mga04.intel.com [192.55.52.120])\n\tby hemlock.osuosl.org (Postfix) with ESMTPS id 26E3C8A11D\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tFri,  1 Sep 2017 01:26:31 +0000 (UTC)",
            "from fmsmga006.fm.intel.com ([10.253.24.20])\n\tby fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t31 Aug 2017 18:26:29 -0700",
            "from ellie.jf.intel.com (HELO localhost.localdomain)\n\t([10.24.8.207])\n\tby fmsmga006.fm.intel.com with ESMTP; 31 Aug 2017 18:26:29 -0700"
        ],
        "X-Virus-Scanned": [
            "amavisd-new at osuosl.org",
            "amavisd-new at osuosl.org"
        ],
        "X-Greylist": "domain auto-whitelisted by SQLgrey-1.7.6",
        "X-ExtLoop1": "1",
        "X-IronPort-AV": "E=Sophos;i=\"5.41,456,1498546800\"; d=\"scan'208\";a=\"146934287\"",
        "From": "Vinicius Costa Gomes <vinicius.gomes@intel.com>",
        "To": "netdev@vger.kernel.org",
        "Date": "Thu, 31 Aug 2017 18:26:25 -0700",
        "Message-Id": "<20170901012625.14838-6-vinicius.gomes@intel.com>",
        "X-Mailer": "git-send-email 2.14.1",
        "In-Reply-To": "<20170901012625.14838-1-vinicius.gomes@intel.com>",
        "References": "<20170901012625.14838-1-vinicius.gomes@intel.com>",
        "X-Mailman-Approved-At": "Fri, 01 Sep 2017 21:24:43 +0000",
        "Cc": "Andre Guedes <andre.guedes@intel.com>, jiri@resnulli.us,\n\tivan.briano@intel.com, richardcochran@gmail.com, jhs@mojatatu.com,\n\tintel-wired-lan@lists.osuosl.org, boon.leong.ong@intel.com,\n\txiyou.wangcong@gmail.com, jesus.sanchez-palencia@intel.com",
        "Subject": "[Intel-wired-lan] [RFC net-next 5/5] samples/tsn: Add script for\n\tcalculating CBS config",
        "X-BeenThere": "intel-wired-lan@osuosl.org",
        "X-Mailman-Version": "2.1.18-1",
        "Precedence": "list",
        "List-Id": "Intel Wired Ethernet Linux Kernel Driver Development\n\t<intel-wired-lan.osuosl.org>",
        "List-Unsubscribe": "<https://lists.osuosl.org/mailman/options/intel-wired-lan>, \n\t<mailto:intel-wired-lan-request@osuosl.org?subject=unsubscribe>",
        "List-Archive": "<http://lists.osuosl.org/pipermail/intel-wired-lan/>",
        "List-Post": "<mailto:intel-wired-lan@osuosl.org>",
        "List-Help": "<mailto:intel-wired-lan-request@osuosl.org?subject=help>",
        "List-Subscribe": "<https://lists.osuosl.org/mailman/listinfo/intel-wired-lan>, \n\t<mailto:intel-wired-lan-request@osuosl.org?subject=subscribe>",
        "MIME-Version": "1.0",
        "Content-Type": "text/plain; charset=\"us-ascii\"",
        "Content-Transfer-Encoding": "7bit",
        "Errors-To": "intel-wired-lan-bounces@osuosl.org",
        "Sender": "\"Intel-wired-lan\" <intel-wired-lan-bounces@osuosl.org>"
    },
    "content": "From: Andre Guedes <andre.guedes@intel.com>\n\nAdd a script that takes as input the parameters of the Credit-based\nshaper used on FQTSS - link rate, max frame size of best effort\ntraffic, idleslope and maximum frame size of the time-sensitive\ntraffic class - for SR classes A and B, and calculates how the CBS\nqdisc must be configured for each traffic class.\n\nFor example, if you want to have Class A with a bandwidth of 300 Mbps\nand Class B of 200 Mbps, and the max frame size of both classes'\ntraffic is 1500 bytes:\n\n$ ./calculate_cbs_params.py -A 300000 -a 1500 -B 200000 -b 1500\n\nwould give you the correct cbs qdisc config command lines to be used.\n\nThis script is just a helper to ease testing of the TSN samples -\ntalker and listener - and shouldn't be taken as highly accurate.\n\nSigned-off-by: Andre Guedes <andre.guedes@intel.com>\nSigned-off-by: Jesus Sanchez-Palencia <jesus.sanchez-palencia@intel.com>\n---\n samples/tsn/calculate_cbs_params.py | 112 ++++++++++++++++++++++++++++++++++++\n 1 file changed, 112 insertions(+)\n create mode 100755 samples/tsn/calculate_cbs_params.py",
    "diff": "diff --git a/samples/tsn/calculate_cbs_params.py b/samples/tsn/calculate_cbs_params.py\nnew file mode 100755\nindex 000000000000..9c46210b699f\n--- /dev/null\n+++ b/samples/tsn/calculate_cbs_params.py\n@@ -0,0 +1,112 @@\n+#!/usr/bin/env python3\n+#\n+# Copyright (c) 2017, Intel Corporation\n+#\n+# Redistribution and use in source and binary forms, with or without\n+# modification, are permitted provided that the following conditions are met:\n+#\n+#     * Redistributions of source code must retain the above copyright notice,\n+#       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 the\n+#       documentation and/or other materials provided with the distribution.\n+#     * Neither the name of Intel Corporation nor the names of its contributors\n+#       may be used to endorse or promote products derived from this software\n+#       without specific prior written permission.\n+#\n+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\n+# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\n+# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE\n+# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n+# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR\n+# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,\n+# OR TORT (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+import argparse\n+import math\n+import sys\n+\n+def print_cbs_params_for_class_a(args):\n+    idleslope = args.idleslope_a\n+    sendslope = idleslope - args.link_speed\n+\n+    # According to 802.1Q-2014 spec, Annex L, hiCredit and\n+    # loCredit for SR class A are calculated following the\n+    # equations L-10 and L-12, respectively.\n+    hicredit = math.ceil(idleslope * args.frame_non_sr / args.link_speed)\n+    locredit = math.ceil(sendslope * args.frame_a / args.link_speed)\n+\n+    print(\"Class A --> # tc qdisc replace dev IFACE parent ID cbs \" \\\n+          \"locredit %d hicredit %d sendslope %d idleslope %d\" % \\\n+          (locredit, hicredit, sendslope, idleslope))\n+\n+def print_cbs_params_for_class_b(args):\n+    idleslope = args.idleslope_b\n+    sendslope = idleslope - args.link_speed\n+\n+    # Annex L doesn't present a straightforward equation to\n+    # calculate hiCredit for Class B so we have to derive it\n+    # based on generic equations presented in that Annex.\n+    #\n+    # L-3 is the primary equation to calculate hiCredit. Section\n+    # L.2 states that the 'maxInterferenceSize' for SR class B\n+    # is the maximum burst size for SR class A plus the\n+    # maxInterferenceSize from SR class A (which is equal to the\n+    # maximum frame from non-SR traffic).\n+    #\n+    # The maximum burst size for SR class A equation is shown in\n+    # L-16. Merging L-16 into L-3 we get the resulting equation\n+    # which calculates hiCredit B (refer to section L.3 in case\n+    # you're not familiar with the legend):\n+    #\n+    # hiCredit B = Rb * (     Mo         Ma   )\n+    #                     ---------- + ------\n+    #                      Ro - Ra       Ro\n+    #\n+    hicredit = math.ceil(idleslope * \\\n+               ((args.frame_non_sr / (args.link_speed - args.idleslope_a)) + \\\n+               (args.frame_a / args.link_speed)))\n+\n+    # loCredit B is calculated following equation L-2.\n+    locredit = math.ceil(sendslope * args.frame_b / args.link_speed)\n+\n+    print(\"Class B --> # tc qdisc replace dev IFACE parent ID cbs \" \\\n+          \"locredit %d hicredit %d sendslope %d idleslope %d\" % \\\n+          (locredit, hicredit, sendslope, idleslope))\n+\n+def main():\n+    parser = argparse.ArgumentParser()\n+\n+    parser.add_argument('-S', dest='link_speed', default=1000000.0, type=float,\n+                        help='Link speed in kbps (default=1000000)')\n+    parser.add_argument('-s', dest='frame_non_sr', default=1500.0, type=float,\n+                        help='Maximum frame size from non-SR traffic (MTU size'\n+                        ' usually, default=1500)')\n+    parser.add_argument('-A', dest='idleslope_a', default=0, type=float,\n+                        help='Idleslope for SR class A in kbps')\n+    parser.add_argument('-a', dest='frame_a', default=0, type=float,\n+                        help='Maximum frame size for SR class A traffic')\n+    parser.add_argument('-B', dest='idleslope_b', default=0, type=float,\n+                        help='Idleslope for SR class B in kbps')\n+    parser.add_argument('-b', dest='frame_b', default=0, type=float,\n+                        help='Maximum frame size for SR class B traffic')\n+\n+    args = parser.parse_args()\n+\n+    if not len(sys.argv) > 1:\n+        parser.print_help()\n+    else:\n+        print(\"\\nConfiguration lines to be used are:\")\n+\n+    if args.idleslope_a > 0:\n+        print_cbs_params_for_class_a(args)\n+\n+    if args.idleslope_b > 0:\n+        print_cbs_params_for_class_b(args)\n+\n+\n+if __name__ == \"__main__\":\n+    main()\n",
    "prefixes": [
        "RFC",
        "net-next",
        "5/5"
    ]
}