From patchwork Tue Sep 29 11:00:01 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 262998 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.5 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E3174C4741F for ; Tue, 29 Sep 2020 12:24:49 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 907622076B for ; Tue, 29 Sep 2020 12:24:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1601382289; bh=hyfbLpE+MJF+XhVMmG9grOk4tySb8I3OuUyv+6NdWIs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=Ekfgo1IDFrKBsruCjzuwdBzT2mE8onbYmbtLUl9HtCxMHE3SOMfeQvLlmU2YOMpaX YBXXMrHzQusaJPMtSYzNt29c/UiEvll1fzsY+S8EhFspuilRau/aTNh/GPG4Fw2f/H MucJtW/LP3TjS5ViTM3/khVxp0Rj4z4JgM7Xas5o= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729742AbgI2LfF (ORCPT ); Tue, 29 Sep 2020 07:35:05 -0400 Received: from mail.kernel.org ([198.145.29.99]:45278 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729634AbgI2Ldb (ORCPT ); Tue, 29 Sep 2020 07:33:31 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 38ABA23BA7; Tue, 29 Sep 2020 11:26:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1601378817; bh=hyfbLpE+MJF+XhVMmG9grOk4tySb8I3OuUyv+6NdWIs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EVNQ/ZengawDhg0o5hK0k0mk2+QLuT/RMTTToUqBMYJv59B5OcYlc8fosJzGDIiDE E0ciTiq9XpRcQm/Xrm+rAeHQEEepi7rvM6q9Fv3Xwz9jfNkvowSzrJCYiZjgoRA7d/ f3/Q41pnMfegaSCIp1P2p+4nDnLBZUyl7zFsRuO0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Pravin B Shelar , Andy Zhou , Tonghao Zhang , "David S. Miller" , Sasha Levin Subject: [PATCH 4.19 150/245] net: openvswitch: use u64 for meter bucket Date: Tue, 29 Sep 2020 13:00:01 +0200 Message-Id: <20200929105954.280070788@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200929105946.978650816@linuxfoundation.org> References: <20200929105946.978650816@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Tonghao Zhang [ Upstream commit e57358873bb5d6caa882b9684f59140912b37dde ] 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 Acked-by: Pravin B Shelar Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- 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 c038e021a5916..6f5131d1074b0 100644 --- a/net/openvswitch/meter.c +++ b/net/openvswitch/meter.c @@ -255,7 +255,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 964ace2650f89..970557ed5b5b6 100644 --- a/net/openvswitch/meter.h +++ b/net/openvswitch/meter.h @@ -26,7 +26,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; };