Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp854006pxk; Thu, 17 Sep 2020 19:09:49 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwYHvHUO75zgtBPcKyrbJNskLSTzNtXetHvASg8H/2qTv+YhVF0KypsoU9uawmuCgIJ/saY X-Received: by 2002:a17:906:2c44:: with SMTP id f4mr33741266ejh.52.1600394989216; Thu, 17 Sep 2020 19:09:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600394989; cv=none; d=google.com; s=arc-20160816; b=L7m7gqNRXoSaWAYiUMArsn2odmCykZKLnRmcb+n7jFUxB4jqwMfti8wuXhDSP+dLx7 9ksLRoq+toJyFuObzViOjZaxMPHPBuhNGkZDpYatl8GODdaxrbk0EEflZrSLSBKexF9V mBwioMkOXXDdbkCQetkz8PvugDB9l83BX19T1aBAy6U6hW8LiC/lAeGVq6ShzqWDgWoj 25EtO00fGbN7cVfbgdNfQbwV2ufsGJPcl18/CB9VuHmixKgVqO4LYY4A/jVuYx8lMa/Q S1hMvUsOSCx7Q6br3xFZP11lwucC2E0VV543ZcIgVObXr5SeYR419irarp6XzUVwpySM W6lQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=sKONhxXBvWU141V7h8/mIDebBFHr1cqbm57PRSfv0rM=; b=Pu7pQrC78SAZDgZC14MN6HzdtbE8OYkta+hWC59R+W9ICvlvxHU2p+LCdKZYZ8ZK1F 77kqWim7kiTH/zj0W1/hk1cajEf2GKlqsstRI6fEjWsaMR34luLCTJKBwfFdvbVtXVu4 8kPXdrVu1eWec/vwok+N4IwON0DDkn/RjIl0cH72WvoaRL/LVdVtBu2Zl6ZKYrE/2FGV TPRIgQV2cfTSTD59VYS9aRiw4rGyq8Y5nER9hUWIVJ9ld9BLYJxCgc6HQPR09VRLmz8z zJcrxoUgALdAzsQqP+H+8AXUwXzOy7d5VG0zAtfATgX2vvIS0JFjZuS3poUi4FRvLnhx yHuA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Yv2UDUQd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id lo4si1196287ejb.190.2020.09.17.19.09.25; Thu, 17 Sep 2020 19:09:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Yv2UDUQd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727746AbgIRCGV (ORCPT + 99 others); Thu, 17 Sep 2020 22:06:21 -0400 Received: from mail.kernel.org ([198.145.29.99]:55274 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727718AbgIRCGK (ORCPT ); Thu, 17 Sep 2020 22:06:10 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id A7EE92388E; Fri, 18 Sep 2020 02:06:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1600394769; bh=jIhQZwXP3VavhttXfmnocOIZi+wRX7HUe9ayE5xeqI0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Yv2UDUQdcx7xNcptd18lFp7J/vPn4uV29i2hIpcOoh4vQnGRc/h8VCSvHguJYQ1DV iYkK7GTFfvmh6W1wgh3z7i5smUHbiK+yUCO6/LbzLeU60lr56GwwFlOAfCRhTU2hNr TbmZBC3uunLesvV+tzF+3KJjvityDSZ8wAOXCYkQ= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Tonghao Zhang , Pravin B Shelar , Andy Zhou , "David S . Miller" , Sasha Levin , netdev@vger.kernel.org, dev@openvswitch.org Subject: [PATCH AUTOSEL 5.4 244/330] net: openvswitch: use u64 for meter bucket Date: Thu, 17 Sep 2020 21:59:44 -0400 Message-Id: <20200918020110.2063155-244-sashal@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200918020110.2063155-1-sashal@kernel.org> References: <20200918020110.2063155-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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 3323b79ff548d..b10734f18bbd6 100644 --- a/net/openvswitch/meter.c +++ b/net/openvswitch/meter.c @@ -251,7 +251,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 f645913870bd2..2e3fd6f1d7ebe 100644 --- a/net/openvswitch/meter.h +++ b/net/openvswitch/meter.h @@ -23,7 +23,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; }; -- 2.25.1