get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 808508,
    "url": "http://patchwork.ozlabs.org/api/patches/808508/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/netdev/patch/20170901012625.14838-6-vinicius.gomes@intel.com/",
    "project": {
        "id": 7,
        "url": "http://patchwork.ozlabs.org/api/projects/7/?format=api",
        "name": "Linux network development",
        "link_name": "netdev",
        "list_id": "netdev.vger.kernel.org",
        "list_email": "netdev@vger.kernel.org",
        "web_url": null,
        "scm_url": null,
        "webscm_url": null,
        "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": true,
    "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": {
        "id": 34,
        "url": "http://patchwork.ozlabs.org/api/users/34/?format=api",
        "username": "davem",
        "first_name": "David",
        "last_name": "Miller",
        "email": "davem@davemloft.net"
    },
    "mbox": "http://patchwork.ozlabs.org/project/netdev/patch/20170901012625.14838-6-vinicius.gomes@intel.com/mbox/",
    "series": [
        {
            "id": 935,
            "url": "http://patchwork.ozlabs.org/api/series/935/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/netdev/list/?series=935",
            "date": "2017-09-01T01:26:20",
            "name": "TSN: Add qdisc-based config interfaces for traffic shapers",
            "version": 1,
            "mbox": "http://patchwork.ozlabs.org/series/935/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/808508/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/808508/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<netdev-owner@vger.kernel.org>",
        "X-Original-To": "patchwork-incoming@ozlabs.org",
        "Delivered-To": "patchwork-incoming@ozlabs.org",
        "Authentication-Results": "ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=vger.kernel.org\n\t(client-ip=209.132.180.67; helo=vger.kernel.org;\n\tenvelope-from=netdev-owner@vger.kernel.org;\n\treceiver=<UNKNOWN>)",
        "Received": [
            "from vger.kernel.org (vger.kernel.org [209.132.180.67])\n\tby ozlabs.org (Postfix) with ESMTP id 3xk1mn3sC6z9s7M\n\tfor <patchwork-incoming@ozlabs.org>;\n\tFri,  1 Sep 2017 11:26:49 +1000 (AEST)",
            "(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S1751392AbdIAB0n (ORCPT <rfc822;patchwork-incoming@ozlabs.org>);\n\tThu, 31 Aug 2017 21:26:43 -0400",
            "from mga02.intel.com ([134.134.136.20]:20239 \"EHLO mga02.intel.com\"\n\trhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP\n\tid S1751264AbdIAB0b (ORCPT <rfc822;netdev@vger.kernel.org>);\n\tThu, 31 Aug 2017 21:26:31 -0400",
            "from fmsmga006.fm.intel.com ([10.253.24.20])\n\tby orsmga101.jf.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-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",
        "Cc": "Andre Guedes <andre.guedes@intel.com>, jhs@mojatatu.com,\n\txiyou.wangcong@gmail.com, jiri@resnulli.us,\n\tintel-wired-lan@lists.osuosl.org, ivan.briano@intel.com,\n\tjesus.sanchez-palencia@intel.com, boon.leong.ong@intel.com,\n\trichardcochran@gmail.com",
        "Subject": "[RFC net-next 5/5] samples/tsn: Add script for calculating CBS\n\tconfig",
        "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>",
        "Sender": "netdev-owner@vger.kernel.org",
        "Precedence": "bulk",
        "List-ID": "<netdev.vger.kernel.org>",
        "X-Mailing-List": "netdev@vger.kernel.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"
    ]
}