From patchwork Thu Apr 16 10:17:03 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tonghao Zhang X-Patchwork-Id: 1272696 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.138; helo=whitealder.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=ciDrcUtb; dkim-atps=neutral Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 494Kc405Yhz9sPF for ; Sun, 19 Apr 2020 03:25:39 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 9502087858; Sat, 18 Apr 2020 17:25:37 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id t0XXnARJ6U9J; Sat, 18 Apr 2020 17:25:33 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by whitealder.osuosl.org (Postfix) with ESMTP id 66E4587880; Sat, 18 Apr 2020 17:25:27 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 483D2C1D91; Sat, 18 Apr 2020 17:25:27 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137]) by lists.linuxfoundation.org (Postfix) with ESMTP id 74FF6C089F for ; Sat, 18 Apr 2020 17:25:25 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id 5E371868E6 for ; Sat, 18 Apr 2020 17:25:25 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from fraxinus.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id HPd0fG5DXpcX for ; Sat, 18 Apr 2020 17:25:24 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-pl1-f195.google.com (mail-pl1-f195.google.com [209.85.214.195]) by fraxinus.osuosl.org (Postfix) with ESMTPS id 8EC178691E for ; Sat, 18 Apr 2020 17:25:24 +0000 (UTC) Received: by mail-pl1-f195.google.com with SMTP id f8so2267624plt.2 for ; Sat, 18 Apr 2020 10:25:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=WNcZccmCQBPkTnugJ9tCHONY29qm/KtuqMXhsDw6FZo=; b=ciDrcUtbtR3lIv31N2AKe13hftAZKYBOjPo/FevQIgefXXJjVhdH/I1NmpKDr4FUIq CER+vjyVTi1jZOIuTAR1jgftXHvSFXKNry28tbbH46bqKkGaAPUKqDOE9OFzEX//nS4l pR3s4827PieMEgCqeBj/9g8Iz0lr6ANvpZzCkP/HwZTVlQQOq2SL/1Zd+lALoE0LXg7y 7Z7IfeekJuLwhUzh/JzlXphV4206KUlU6qUVZ0PL7wBOmOtLph2TtbTp8DYUnROy8RGE DqWSTFyjjMsviLJGUdtuEEuLzIfu0x9lvUh9m6HYicWleNeJXH5wUPZPEtYdxsjMICjP Wx8g== 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:in-reply-to :references; bh=WNcZccmCQBPkTnugJ9tCHONY29qm/KtuqMXhsDw6FZo=; b=dinSYslVrAnc03wKFdGh7BSc4q9rStF5na7f7oMaYMifZ1fcSLolVXFZRoIB7KOE9m Wh3iRVK7bw812y3boG7nRoEZ0+h63BErpg+Y5eM1Zzop7JpkvHtz0kR5tExApv4pfYhD 9Yn0Vm9p3P3qvk79t+HkDFw+LUmTAtUUYq9ZBmMOlx5HpVwKL+TsHFQzvO4Sp2R3V34u tXAL9+/UE5cgKEQOEZ076vYhckqhzg2vhkSNTLjPU45P0Nk0NBEEySbif2DpzNPbvO2I VlNLJVxzucCYHNQ+hbB6qRNkyR30PlmFy0O4FDdvI3s85MN3tdpifyXTkOA86ToWY2y+ MAKw== X-Gm-Message-State: AGi0PuZvnMCZSTZFvNonIudD97lOI6CjlI9v/jqHjHouMzutPnfVwXsf wQrpiBHX+PIBoHaeNdWSaMc= X-Google-Smtp-Source: APiQypIhTVD9yTw22L4NrAR3lKHrIBMOtPzkxc+dy1A3+3xUnHClO+8wtMf4opXynpRevT/R1Fg8+A== X-Received: by 2002:a17:90a:2ac7:: with SMTP id i7mr11513109pjg.130.1587230724248; Sat, 18 Apr 2020 10:25:24 -0700 (PDT) Received: from local.opencloud.tech.localdomain ([115.171.63.184]) by smtp.gmail.com with ESMTPSA id s44sm9329251pjc.28.2020.04.18.10.25.20 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 18 Apr 2020 10:25:23 -0700 (PDT) From: xiangxia.m.yue@gmail.com To: pshelar@ovn.org, azhou@ovn.org, blp@ovn.org, u9012063@gmail.com Date: Thu, 16 Apr 2020 18:17:03 +0800 Message-Id: <1587032223-49460-6-git-send-email-xiangxia.m.yue@gmail.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1587032223-49460-1-git-send-email-xiangxia.m.yue@gmail.com> References: <1584969039-74113-1-git-send-email-xiangxia.m.yue@gmail.com> <1587032223-49460-1-git-send-email-xiangxia.m.yue@gmail.com> Cc: dev@openvswitch.org, netdev@vger.kernel.org Subject: [ovs-dev] [PATCH net-next v2 5/5] net: openvswitch: use u64 for meter bucket 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: , MIME-Version: 1.0 Errors-To: ovs-dev-bounces@openvswitch.org Sender: "dev" From: Tonghao Zhang When setting the meter rate to 4+Gbps, there is an overflow, the meters don't work as expected. Cc: Pravin B Shelar Cc: Andy Zhou Signed-off-by: Tonghao Zhang --- net/openvswitch/meter.c | 2 +- net/openvswitch/meter.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/net/openvswitch/meter.c b/net/openvswitch/meter.c index 77fe39cf4f18..51cfe8a52b5a 100644 --- a/net/openvswitch/meter.c +++ b/net/openvswitch/meter.c @@ -364,7 +364,7 @@ static struct dp_meter *dp_meter_create(struct nlattr **a) * * Start with a full bucket. */ - band->bucket = (band->burst_size + band->rate) * 1000; + band->bucket = (band->burst_size + band->rate) * 1000ULL; band_max_delta_t = band->bucket / band->rate; if (band_max_delta_t > meter->max_delta_t) meter->max_delta_t = band_max_delta_t; diff --git a/net/openvswitch/meter.h b/net/openvswitch/meter.h index cdfc6b9dbd42..b1a50d988e59 100644 --- a/net/openvswitch/meter.h +++ b/net/openvswitch/meter.h @@ -25,7 +25,7 @@ struct dp_meter_band { u32 type; u32 rate; u32 burst_size; - u32 bucket; /* 1/1000 packets, or in bits */ + u64 bucket; /* 1/1000 packets, or in bits */ struct ovs_flow_stats stats; };