From patchwork Wed Feb 24 14:38:15 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Horman X-Patchwork-Id: 1443902 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=140.211.166.136; helo=smtp3.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=netronome-com.20150623.gappssmtp.com header.i=@netronome-com.20150623.gappssmtp.com header.a=rsa-sha256 header.s=20150623 header.b=g39Yw2nT; dkim-atps=neutral Received: from smtp3.osuosl.org (smtp3.osuosl.org [140.211.166.136]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4Dlz7L5zmzz9sRN for ; Thu, 25 Feb 2021 01:38:38 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id C72E46F662; Wed, 24 Feb 2021 14:38:36 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id FARnXs5aG2xq; Wed, 24 Feb 2021 14:38:35 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by smtp3.osuosl.org (Postfix) with ESMTP id 0A4E26F651; Wed, 24 Feb 2021 14:38:35 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id CB047C000A; Wed, 24 Feb 2021 14:38:34 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from smtp4.osuosl.org (smtp4.osuosl.org [140.211.166.137]) by lists.linuxfoundation.org (Postfix) with ESMTP id 1EAEAC0001 for ; Wed, 24 Feb 2021 14:38:34 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id 188ED4EC7B for ; Wed, 24 Feb 2021 14:38:34 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Authentication-Results: smtp4.osuosl.org (amavisd-new); dkim=pass (2048-bit key) header.d=netronome-com.20150623.gappssmtp.com Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 0yozJgOelNMt for ; Wed, 24 Feb 2021 14:38:33 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.8.0 Received: from mail-ej1-f46.google.com (mail-ej1-f46.google.com [209.85.218.46]) by smtp4.osuosl.org (Postfix) with ESMTPS id 019C14EC7C for ; Wed, 24 Feb 2021 14:38:32 +0000 (UTC) Received: by mail-ej1-f46.google.com with SMTP id w1so3428926ejf.11 for ; Wed, 24 Feb 2021 06:38:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=netronome-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=WISNp8F4ludalp4X7/JvHEa/4dIZqu3h//xIBHxZLIo=; b=g39Yw2nTYr77daojMSKx3/IoK+tkAZm4r+Xb1jIZOfNfFxozWaxiP4MnuiWfHnWccy ZhhlGUHzW8FV/7DLHj4L+qiK+ZUExGOTYwofsqCEpR3b140OUT9q46IcVB+f0ME6f3EK v62yUO7rjrqCq4ldUfzK3+T6q3qh+cYoKiFDC5hq4QMoVaZ6O2c+r50ZG3Lez6eM6AK2 cZRT/TQmNaiazwZewqh/xZQDe7aUh/Q+U6RnwcQ2ZE85Kn4mvLpU1nqAlT+eS5HQpLW7 HylOdlA23YEqocS6PwqyiCQj5BmV207QlPypJyOBQYoyA9om3xzZUImEtP3Adzu7sc7l k5sg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=WISNp8F4ludalp4X7/JvHEa/4dIZqu3h//xIBHxZLIo=; b=Tdd2+ZPgeDQhjLigtyYXhI7dVUIFonR/RfJnrAbbVOOzTQ+NzavhimLCgJ71sa1SxH /YroTINMMN8XwdeX1XlmsCTa3avxRwXfX5Uv4wzKQs6KFF5vLSWEkA79QaqHO8yHGS3+ SYj2U4HmV8AqJw8Wwt+oI7xM/ZPYJQ9xQlqS1G7fVDfXVQTAtSB67La0JRWLUM0VUkAg luTuBiORkXjb/x9UEJAdQUu0LG9PqpS/Q9zkkH/JZ9hTqyNYxoOveQy6r44btDWs7Gnc Mhgch+jJySc1+G7sGd70ZIqYTjNrFutAi9p6+dfJW2f2GXNISOJ/tGxSica5NnLowsYD ntHA== X-Gm-Message-State: AOAM530byiLqIEUHTdylxTK9VOqy1iW0LMovcfrZ3rVs0UpTT6zeNVdR 1rFL3fSH2OwU99hSISrEKlw+tecNcjsiljz75sIsf4lxUAFGnbtJ/735nzOgoJVCrx5aSFf8RQr sjWhnC10yJP6zMeUuWdyx3WhLUtc7gRs6Bps+WBTbh29SGVb7RY7xTXpc+kX8uU+tLGSeHZqAsA == X-Google-Smtp-Source: ABdhPJygURFEMSx9LshD4wTk3zn0PztQqFVv6x6ZqAKLlToFUhJ5qmuOaegnaGDL+iibWWivSioh2g== X-Received: by 2002:a17:907:3e8d:: with SMTP id hs13mr5484355ejc.36.1614177510618; Wed, 24 Feb 2021 06:38:30 -0800 (PST) Received: from madeliefje.horms.nl ([2001:982:7ed1:403:9eeb:e8ff:fe0d:5b6a]) by smtp.gmail.com with ESMTPSA id r10sm1509543edd.49.2021.02.24.06.38.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Feb 2021 06:38:29 -0800 (PST) From: Simon Horman To: dev@openvswitch.org Date: Wed, 24 Feb 2021 15:38:15 +0100 Message-Id: <20210224143815.11615-1-simon.horman@netronome.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Cc: oss-drivers@netronome.com, Simon Horman , Baowen Zheng , Yong Xu Subject: [ovs-dev] [PATCH] netdev-linux: correct unit of burst parameter X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ovs-dev-bounces@openvswitch.org Sender: "dev" From: Yong Xu Correct calculation of burst parameter used when configuring TC policer action for ingress port-based policing in the case where TC offload is in use. This now matches the value calculated for the case where TC offload is not in use. The division by 8 is to convert from bits to bytes. Its unclear why 64 was previously used. Fixes: e7f6ba220 ("lib/tc: add ingress ratelimiting support for tc-offload") Signed-off-by: Yong Xu [simon: reworked changelog] Signed-off-by: Simon Horman Signed-off-by: Louis Peens Acked-by: Yi-Hung Wei --- lib/netdev-linux.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/netdev-linux.c b/lib/netdev-linux.c index 6be23dbee..eb28777f9 100644 --- a/lib/netdev-linux.c +++ b/lib/netdev-linux.c @@ -2572,7 +2572,7 @@ exit: static struct tc_police tc_matchall_fill_police(uint32_t kbits_rate, uint32_t kbits_burst) { - unsigned int bsize = MIN(UINT32_MAX / 1024, kbits_burst) * 1024 / 64; + unsigned int bsize = MIN(UINT32_MAX / 1024, kbits_burst) * 1024 / 8; unsigned int bps = ((uint64_t) kbits_rate * 1000) / 8; struct tc_police police; struct tc_ratespec rate;