get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 1523589,
    "url": "http://patchwork.ozlabs.org/api/patches/1523589/",
    "web_url": "http://patchwork.ozlabs.org/project/openvswitch/patch/20210902101823.3403153-2-roid@nvidia.com/",
    "project": {
        "id": 47,
        "url": "http://patchwork.ozlabs.org/api/projects/47/",
        "name": "Open vSwitch",
        "link_name": "openvswitch",
        "list_id": "ovs-dev.openvswitch.org",
        "list_email": "ovs-dev@openvswitch.org",
        "web_url": "http://openvswitch.org/",
        "scm_url": "git@github.com:openvswitch/ovs.git",
        "webscm_url": "https://github.com/openvswitch/ovs",
        "list_archive_url": "",
        "list_archive_url_format": "",
        "commit_url_format": ""
    },
    "msgid": "<20210902101823.3403153-2-roid@nvidia.com>",
    "list_archive_url": null,
    "date": "2021-09-02T10:18:18",
    "name": "[ovs-dev,1/6] netdev-linux: Refactor put police action netlink message",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "d06303bc5a148e1ba70eeefa5f144a6b7b0d08fe",
    "submitter": {
        "id": 80349,
        "url": "http://patchwork.ozlabs.org/api/people/80349/",
        "name": "Roi Dayan",
        "email": "roid@nvidia.com"
    },
    "delegate": null,
    "mbox": "http://patchwork.ozlabs.org/project/openvswitch/patch/20210902101823.3403153-2-roid@nvidia.com/mbox/",
    "series": [
        {
            "id": 260708,
            "url": "http://patchwork.ozlabs.org/api/series/260708/",
            "web_url": "http://patchwork.ozlabs.org/project/openvswitch/list/?series=260708",
            "date": "2021-09-02T10:18:17",
            "name": "Add support for ovs metering with tc offload",
            "version": 1,
            "mbox": "http://patchwork.ozlabs.org/series/260708/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/1523589/comments/",
    "check": "success",
    "checks": "http://patchwork.ozlabs.org/api/patches/1523589/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<ovs-dev-bounces@openvswitch.org>",
        "X-Original-To": [
            "incoming@patchwork.ozlabs.org",
            "dev@openvswitch.org"
        ],
        "Delivered-To": [
            "patchwork-incoming@bilbo.ozlabs.org",
            "ovs-dev@lists.linuxfoundation.org"
        ],
        "Authentication-Results": [
            "ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n unprotected) header.d=Nvidia.com header.i=@Nvidia.com header.a=rsa-sha256\n header.s=selector2 header.b=CqWHmJ5s;\n\tdkim-atps=neutral",
            "ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org\n (client-ip=140.211.166.133; helo=smtp2.osuosl.org;\n envelope-from=ovs-dev-bounces@openvswitch.org; receiver=<UNKNOWN>)"
        ],
        "Received": [
            "from smtp2.osuosl.org (smtp2.osuosl.org [140.211.166.133])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest\n SHA256)\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 4H0cMv6c9Mz9sCD\n\tfor <incoming@patchwork.ozlabs.org>; Thu,  2 Sep 2021 20:18:51 +1000 (AEST)",
            "from localhost (localhost [127.0.0.1])\n\tby smtp2.osuosl.org (Postfix) with ESMTP id D6D1940712;\n\tThu,  2 Sep 2021 10:18:48 +0000 (UTC)",
            "from smtp2.osuosl.org ([127.0.0.1])\n\tby localhost (smtp2.osuosl.org [127.0.0.1]) (amavisd-new, port 10024)\n\twith ESMTP id TzzxoqsZTFzP; Thu,  2 Sep 2021 10:18:45 +0000 (UTC)",
            "from lists.linuxfoundation.org (lf-lists.osuosl.org\n [IPv6:2605:bc80:3010:104::8cd3:938])\n\tby smtp2.osuosl.org (Postfix) with ESMTPS id CB7E4406EA;\n\tThu,  2 Sep 2021 10:18:42 +0000 (UTC)",
            "from lf-lists.osuosl.org (localhost [127.0.0.1])\n\tby lists.linuxfoundation.org (Postfix) with ESMTP id 9C6DFC001B;\n\tThu,  2 Sep 2021 10:18:42 +0000 (UTC)",
            "from smtp2.osuosl.org (smtp2.osuosl.org [IPv6:2605:bc80:3010::133])\n by lists.linuxfoundation.org (Postfix) with ESMTP id 522DEC001A\n for <dev@openvswitch.org>; Thu,  2 Sep 2021 10:18:41 +0000 (UTC)",
            "from localhost (localhost [127.0.0.1])\n by smtp2.osuosl.org (Postfix) with ESMTP id 33C09406D8\n for <dev@openvswitch.org>; Thu,  2 Sep 2021 10:18:41 +0000 (UTC)",
            "from smtp2.osuosl.org ([127.0.0.1])\n by localhost (smtp2.osuosl.org [127.0.0.1]) (amavisd-new, port 10024)\n with ESMTP id Q0QH8mkFaPNJ for <dev@openvswitch.org>;\n Thu,  2 Sep 2021 10:18:37 +0000 (UTC)",
            "from NAM12-BN8-obe.outbound.protection.outlook.com\n (mail-bn8nam12on2080.outbound.protection.outlook.com [40.107.237.80])\n by smtp2.osuosl.org (Postfix) with ESMTPS id 0FB6C406D0\n for <dev@openvswitch.org>; Thu,  2 Sep 2021 10:18:36 +0000 (UTC)",
            "from MW4PR03CA0251.namprd03.prod.outlook.com (2603:10b6:303:b4::16)\n by CO6PR12MB5409.namprd12.prod.outlook.com (2603:10b6:5:357::7) with\n Microsoft SMTP Server (version=TLS1_2,\n cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4478.19; Thu, 2 Sep\n 2021 10:18:34 +0000",
            "from CO1NAM11FT013.eop-nam11.prod.protection.outlook.com\n (2603:10b6:303:b4:cafe::c3) by MW4PR03CA0251.outlook.office365.com\n (2603:10b6:303:b4::16) with Microsoft SMTP Server (version=TLS1_2,\n cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4478.17 via Frontend\n Transport; Thu, 2 Sep 2021 10:18:32 +0000",
            "from mail.nvidia.com (216.228.112.35) by\n CO1NAM11FT013.mail.protection.outlook.com (10.13.174.227) with Microsoft SMTP\n Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id\n 15.20.4478.19 via Frontend Transport; Thu, 2 Sep 2021 10:18:31 +0000",
            "from HQMAIL109.nvidia.com (172.20.187.15) by HQMAIL111.nvidia.com\n (172.20.187.18) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Thu, 2 Sep\n 2021 10:18:31 +0000",
            "from dev-r-vrt-138.mtr.labs.mlnx (172.20.187.5) by mail.nvidia.com\n (172.20.187.15) with Microsoft SMTP Server id 15.0.1497.2 via Frontend\n Transport; Thu, 2 Sep 2021 03:18:30 -0700"
        ],
        "X-Virus-Scanned": [
            "amavisd-new at osuosl.org",
            "amavisd-new at osuosl.org"
        ],
        "X-Greylist": "whitelisted by SQLgrey-1.8.0",
        "ARC-Seal": "i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none;\n b=YbRA3/Us08ujCkrRTiN56/yfj3FF6yVD2hOXvpBnVkLEqtXQk8qw0s5oaDeF56rxvJK0SBhpJFU7Jbyv50WDgO45fduQTPBM3D9+m4Q3w5l4n8IXp+9vphoXRTkzm2ftjwuHWYfrOnUmv1G0V0YWw/tK48QcqkB4R1aS6HhEvK5nIQhuisuDyNAmlDbUfkB0jClXKmuTn0JK7U/1wZ4PGd8qO0A5/wPaX4jCbzEhsVHr+OxU7NT00apCEWb63rm9g/rvF0HWOgKWPj2auM+rRCrihJq8p+BENqf9y/ornHIu7iY3f8Zmq98mJH9xae98BcuLBgMO273gZDguQa5GaQ==",
        "ARC-Message-Signature": "i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com;\n s=arcselector9901;\n h=From:Date:Subject:Message-ID:Content-Type:MIME-Version;\n bh=3lwRT7NpqwxqlJ1CzLHP18aP8OoXbzUEfGPp12vKXRg=;\n b=ZDbPG8R8VOIzISyDkbpmmeW9kU/yAXYlro++HHMSxMySYyg9kFCl4XRwTHIuQ4KsHsmmzURU/RoB9GFtupp9LZPRbKabI6FOIRG+VolcbrXzYICBgk0smrSiH+K6QKVM8rbKcVnr9LfPOdhm5vaW9TnbBQzMgNJ9Xdj1fVVM9b14svctPMY1od63/7sJ/I2r/WyUmdGkZv40M8Yu4Uj5z/Bbbca3TJM8t+ujHZwS/Vp7x3u1jKmG87+2lHRbFirZK4HK9OesNbWlYy/RqLOAnPk03c9p6v+5IaSpVyPxNCelGvxrIh5dc3XE7hAir9ONDrQyHukqUTTyJ5wCGy+WCA==",
        "ARC-Authentication-Results": "i=1; mx.microsoft.com 1; spf=pass (sender ip is\n 216.228.112.35) smtp.rcpttodomain=ovn.org smtp.mailfrom=nvidia.com;\n dmarc=pass (p=quarantine sp=none pct=100) action=none header.from=nvidia.com;\n dkim=none (message not signed); arc=none",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com;\n s=selector2;\n h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck;\n bh=3lwRT7NpqwxqlJ1CzLHP18aP8OoXbzUEfGPp12vKXRg=;\n b=CqWHmJ5sBBvT0ZkN2yKI5EOXwLenmK7zOMCYCk5/xabRSfUMmOdN0fGxXVuP3sw/+pEFMCRd0uaQKJklxbBOfSNrytmtIZP7jhVAybOwfybxADG0WFv7BT2m8lMIMvDC332Few7jzGaDqQXLYkFe+2LckApEvSis9lPkjGg/PYN1O+O1pwNg2pKCjurNFjQtY61qbIwbqMldnb/PvnIXC3lnvZoPoqWhwiblliEEbHTclY5wx5jLu/vM6apvK85XK4u3rurdJvHHsUFxL+ePh0ARbPAyLtsY3m7bBJxEA+rL2OLIcW69usw4SE2HNQcY/XfVchjGlPYNi1M2C5O26A==",
        "X-MS-Exchange-Authentication-Results": "spf=pass (sender IP is 216.228.112.35)\n smtp.mailfrom=nvidia.com; ovn.org; dkim=none (message not signed)\n header.d=none;ovn.org; dmarc=pass action=none header.from=nvidia.com;",
        "Received-SPF": "Pass (protection.outlook.com: domain of nvidia.com designates\n 216.228.112.35 as permitted sender) receiver=protection.outlook.com;\n client-ip=216.228.112.35; helo=mail.nvidia.com;",
        "To": "<dev@openvswitch.org>, Ilya Maximets <i.maximets@ovn.org>",
        "Date": "Thu, 2 Sep 2021 13:18:18 +0300",
        "Message-ID": "<20210902101823.3403153-2-roid@nvidia.com>",
        "X-Mailer": "git-send-email 2.26.3",
        "In-Reply-To": "<20210902101823.3403153-1-roid@nvidia.com>",
        "References": "<20210902101823.3403153-1-roid@nvidia.com>",
        "MIME-Version": "1.0",
        "X-EOPAttributedMessage": "0",
        "X-MS-PublicTrafficType": "Email",
        "X-MS-Office365-Filtering-Correlation-Id": "def9c856-57c6-40fd-3c6a-08d96dfb03f4",
        "X-MS-TrafficTypeDiagnostic": "CO6PR12MB5409:",
        "X-Microsoft-Antispam-PRVS": "\n <CO6PR12MB5409D8BA4EC4B60A35F94098B8CE9@CO6PR12MB5409.namprd12.prod.outlook.com>",
        "X-MS-Oob-TLC-OOBClassifiers": "OLM:10000;",
        "X-MS-Exchange-SenderADCheck": "1",
        "X-MS-Exchange-AntiSpam-Relay": "0",
        "X-Microsoft-Antispam": "BCL:0;",
        "X-Microsoft-Antispam-Message-Info": "\n J44c7cejAKVAQIZz80retrCPGNmjvF7k+NyQYmjUxkWrv2uGoZcMxYMbFKTNocx25xXwpx5dQfKKd26OzeAMSkBrzC9veuOhdOqzDLBVhRH6g1FbLnqAin7AkomZ4KIiK5mVWtdQNcLJiEY1BJvOdesRVvLPMFFgmd6mF/Nype5BofEKa5PJoBIGQxtJ9p4kbUwUMqV60UOFQUq8Z9IrdPDmHsrBixdPzO0P6Xufre9V4YC98dpEBf1NcoTLm48hjtGTxJyJcYXsL4HHP56ZpNlNbq+wjDzfoJ7uOTTx2edtyyB08BJtSax3qgU0eVzGYDej/C9CGTVt2MGZlDpTHxacoN0dgp62qXf6ATJbH+biWYKnXAXkCdy3P5VlBCn98lsGtul9r3WCnlajcgBSF1dXLPxFV91Ir29SIDRLTjpzmZ1q+6cEJOShS0canM0gJztNWnCD/f7Xhpl/nlixpWfaAVC5gX8cJ3UmE3DtK1CRsygh1Mk1Z074upPM7V2pXUu47dwcN6vZIfbJNmpsEzhDbiy4opzTcS6ei1tzrvkQ9wNAmUfkMiQ5C1rCDU4cVJ16D5/Ohd8vt2IJSmmdOehdHMPPUnMDhBIEJhsgIQVK24nOqU1caMcFHQcbnttYuHhhXZ5HReHJwcJ4zOIO/IQRLHstir524/G7oiwzZHYWxWxZwEiEY7xijvgaSuMN9ErxmRlFNXc9D1Gfdt1HIA==",
        "X-Forefront-Antispam-Report": "CIP:216.228.112.35; CTRY:US; LANG:en; SCL:1;\n SRV:;\n IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:schybrid04.nvidia.com; CAT:NONE;\n SFS:(4636009)(136003)(39860400002)(396003)(376002)(346002)(36840700001)(46966006)(4326008)(1076003)(47076005)(107886003)(36906005)(5660300002)(54906003)(478600001)(356005)(26005)(110136005)(6666004)(316002)(7636003)(82740400003)(15650500001)(83380400001)(70586007)(70206006)(36756003)(86362001)(2906002)(82310400003)(36860700001)(8936002)(336012)(2616005)(186003)(8676002)(426003);\n DIR:OUT; SFP:1101;",
        "X-OriginatorOrg": "Nvidia.com",
        "X-MS-Exchange-CrossTenant-OriginalArrivalTime": "02 Sep 2021 10:18:31.9083 (UTC)",
        "X-MS-Exchange-CrossTenant-Network-Message-Id": "\n def9c856-57c6-40fd-3c6a-08d96dfb03f4",
        "X-MS-Exchange-CrossTenant-Id": "43083d15-7273-40c1-b7db-39efd9ccc17a",
        "X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp": "\n TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.112.35];\n Helo=[mail.nvidia.com]",
        "X-MS-Exchange-CrossTenant-AuthSource": "\n CO1NAM11FT013.eop-nam11.prod.protection.outlook.com",
        "X-MS-Exchange-CrossTenant-AuthAs": "Anonymous",
        "X-MS-Exchange-CrossTenant-FromEntityHeader": "HybridOnPrem",
        "X-MS-Exchange-Transport-CrossTenantHeadersStamped": "CO6PR12MB5409",
        "Cc": "Jianbo Liu <jianbol@nvidia.com>",
        "Subject": "[ovs-dev] [PATCH 1/6] netdev-linux: Refactor put police action\n\tnetlink message",
        "X-BeenThere": "ovs-dev@openvswitch.org",
        "X-Mailman-Version": "2.1.15",
        "Precedence": "list",
        "List-Id": "<ovs-dev.openvswitch.org>",
        "List-Unsubscribe": "<https://mail.openvswitch.org/mailman/options/ovs-dev>,\n <mailto:ovs-dev-request@openvswitch.org?subject=unsubscribe>",
        "List-Archive": "<http://mail.openvswitch.org/pipermail/ovs-dev/>",
        "List-Post": "<mailto:ovs-dev@openvswitch.org>",
        "List-Help": "<mailto:ovs-dev-request@openvswitch.org?subject=help>",
        "List-Subscribe": "<https://mail.openvswitch.org/mailman/listinfo/ovs-dev>,\n <mailto:ovs-dev-request@openvswitch.org?subject=subscribe>",
        "From": "Roi Dayan via dev <ovs-dev@openvswitch.org>",
        "Reply-To": "Roi Dayan <roid@nvidia.com>",
        "Content-Type": "text/plain; charset=\"us-ascii\"",
        "Content-Transfer-Encoding": "7bit",
        "Errors-To": "ovs-dev-bounces@openvswitch.org",
        "Sender": "\"dev\" <ovs-dev-bounces@openvswitch.org>"
    },
    "content": "From: Jianbo Liu <jianbol@nvidia.com>\n\nTo reuse the code for manipulating police action, move the common\ninitialization code to a function, and change PPS parameters as meter\npktps is in unit of packet per second.\n\nnull_police is redundant because either BPS or PPS, not both, can be\nconfigured in one message. So the police passed in to\nnl_msg_put_act_police can be reused as its rate is zero for PPS, and\nit also provides the index for police action to be created.\n\nSigned-off-by: Jianbo Liu <jianbol@nvidia.com>\nReviewed-by: Roi Dayan <roid@nvidia.com>\n---\n lib/netdev-linux.c | 82 ++++++++++++++++++++++++++++--------------------------\n 1 file changed, 42 insertions(+), 40 deletions(-)",
    "diff": "diff --git a/lib/netdev-linux.c b/lib/netdev-linux.c\nindex 60dd138914a2..ca730a15fede 100644\n--- a/lib/netdev-linux.c\n+++ b/lib/netdev-linux.c\n@@ -2629,37 +2629,27 @@ nl_msg_act_police_end_nest(struct ofpbuf *request, size_t offset,\n }\n \n static void\n-nl_msg_put_act_police(struct ofpbuf *request, struct tc_police police,\n-                      uint32_t kpkts_rate, uint32_t kpkts_burst)\n+nl_msg_put_act_police(struct ofpbuf *request, struct tc_police *police,\n+                      uint32_t pkts_rate, uint32_t pkts_burst)\n {\n     size_t offset, act_offset;\n     uint32_t prio = 0;\n-    /* used for PPS, set rate as 0 to act as a single action */\n-    struct tc_police null_police;\n-\n-    memset(&null_police, 0, sizeof null_police);\n-\n-    if (police.rate.rate) {\n-        nl_msg_act_police_start_nest(request, ++prio, &offset, &act_offset);\n-        tc_put_rtab(request, TCA_POLICE_RATE, &police.rate);\n-        nl_msg_put_unspec(request, TCA_POLICE_TBF, &police, sizeof police);\n-        nl_msg_act_police_end_nest(request, offset, act_offset);\n-    }\n-    if (kpkts_rate) {\n-        unsigned int pkt_burst_ticks, pps_rate, size;\n-        nl_msg_act_police_start_nest(request, ++prio, &offset, &act_offset);\n-        pps_rate = kpkts_rate * 1000;\n-        size = MIN(UINT32_MAX / 1000, kpkts_burst) * 1000;\n+\n+    nl_msg_act_police_start_nest(request, ++prio, &offset, &act_offset);\n+    if (police->rate.rate) {\n+        tc_put_rtab(request, TCA_POLICE_RATE, &police->rate);\n+    }\n+    if (pkts_rate) {\n+        unsigned int pkt_burst_ticks;\n         /* Here tc_bytes_to_ticks is used to convert packets rather than bytes\n            to ticks. */\n-        pkt_burst_ticks = tc_bytes_to_ticks(pps_rate, size);\n-        nl_msg_put_u64(request, TCA_POLICE_PKTRATE64, (uint64_t) pps_rate);\n+        pkt_burst_ticks = tc_bytes_to_ticks(pkts_rate, pkts_burst);\n+        nl_msg_put_u64(request, TCA_POLICE_PKTRATE64, (uint64_t) pkts_rate);\n         nl_msg_put_u64(request, TCA_POLICE_PKTBURST64,\n                        (uint64_t) pkt_burst_ticks);\n-        nl_msg_put_unspec(request, TCA_POLICE_TBF, &null_police,\n-                          sizeof null_police);\n-        nl_msg_act_police_end_nest(request, offset, act_offset);\n     }\n+    nl_msg_put_unspec(request, TCA_POLICE_TBF, police, sizeof *police);\n+    nl_msg_act_police_end_nest(request, offset, act_offset);\n }\n \n static int\n@@ -2692,7 +2682,8 @@ tc_add_matchall_policer(struct netdev *netdev, uint32_t kbits_rate,\n     nl_msg_put_string(&request, TCA_KIND, \"matchall\");\n     basic_offset = nl_msg_start_nested(&request, TCA_OPTIONS);\n     action_offset = nl_msg_start_nested(&request, TCA_MATCHALL_ACT);\n-    nl_msg_put_act_police(&request, pol_act, kpkts_rate, kpkts_burst);\n+    nl_msg_put_act_police(&request, &pol_act, kpkts_rate * 1000,\n+                          kpkts_burst * 1000);\n     nl_msg_end_nested(&request, action_offset);\n     nl_msg_end_nested(&request, basic_offset);\n \n@@ -5589,6 +5580,29 @@ netdev_linux_tc_make_request(const struct netdev *netdev, int type,\n     return tc_make_request(ifindex, type, flags, request);\n }\n \n+static void\n+tc_policer_init(struct tc_police *tc_police, uint32_t kbits_rate,\n+                uint32_t kbits_burst)\n+{\n+    int mtu = 65535;\n+\n+    memset(tc_police, 0, sizeof *tc_police);\n+\n+    tc_police->action = TC_POLICE_SHOT;\n+    tc_police->mtu = mtu;\n+    tc_fill_rate(&tc_police->rate, ((uint64_t) kbits_rate * 1000) / 8, mtu);\n+\n+    /* The following appears wrong in one way: In networking a kilobit is\n+     * usually 1000 bits but this uses 1024 bits.\n+     *\n+     * However if you \"fix\" those problems then \"tc filter show ...\" shows\n+     * \"125000b\", meaning 125,000 bits, when OVS configures it for 1000 kbit ==\n+     * 1,000,000 bits, whereas this actually ends up doing the right thing from\n+     * tc's point of view.  Whatever. */\n+    tc_police->burst = tc_bytes_to_ticks(\n+        tc_police->rate.rate, MIN(UINT32_MAX / 1024, kbits_burst) * 1024 / 8);\n+}\n+\n /* Adds a policer to 'netdev' with a rate of 'kbits_rate' and a burst size\n  * of 'kbits_burst', with a rate of 'kpkts_rate' and a burst size of\n  * 'kpkts_burst'.\n@@ -5613,22 +5627,8 @@ tc_add_policer(struct netdev *netdev, uint32_t kbits_rate,\n     struct ofpbuf request;\n     struct tcmsg *tcmsg;\n     int error;\n-    int mtu = 65535;\n \n-    memset(&tc_police, 0, sizeof tc_police);\n-    tc_police.action = TC_POLICE_SHOT;\n-    tc_police.mtu = mtu;\n-    tc_fill_rate(&tc_police.rate, ((uint64_t) kbits_rate * 1000)/8, mtu);\n-\n-    /* The following appears wrong in one way: In networking a kilobit is\n-     * usually 1000 bits but this uses 1024 bits.\n-     *\n-     * However if you \"fix\" those problems then \"tc filter show ...\" shows\n-     * \"125000b\", meaning 125,000 bits, when OVS configures it for 1000 kbit ==\n-     * 1,000,000 bits, whereas this actually ends up doing the right thing from\n-     * tc's point of view.  Whatever. */\n-    tc_police.burst = tc_bytes_to_ticks(\n-        tc_police.rate.rate, MIN(UINT32_MAX / 1024, kbits_burst) * 1024 / 8);\n+    tc_policer_init(&tc_police, kbits_rate, kbits_burst);\n     tcmsg = netdev_linux_tc_make_request(netdev, RTM_NEWTFILTER,\n                                          NLM_F_EXCL | NLM_F_CREATE, &request);\n     if (!tcmsg) {\n@@ -5638,9 +5638,11 @@ tc_add_policer(struct netdev *netdev, uint32_t kbits_rate,\n     tcmsg->tcm_info = tc_make_handle(49,\n                                      (OVS_FORCE uint16_t) htons(ETH_P_ALL));\n     nl_msg_put_string(&request, TCA_KIND, \"basic\");\n+\n     basic_offset = nl_msg_start_nested(&request, TCA_OPTIONS);\n     police_offset = nl_msg_start_nested(&request, TCA_BASIC_ACT);\n-    nl_msg_put_act_police(&request, tc_police, kpkts_rate, kpkts_burst);\n+    nl_msg_put_act_police(&request, &tc_police, kpkts_rate * 1000,\n+                          kpkts_burst * 1000);\n     nl_msg_end_nested(&request, police_offset);\n     nl_msg_end_nested(&request, basic_offset);\n \n",
    "prefixes": [
        "ovs-dev",
        "1/6"
    ]
}