From patchwork Wed May 13 13:31:33 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tonghao Zhang X-Patchwork-Id: 1289296 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=silver.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=lFC49Hh1; dkim-atps=neutral Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 49MbFS2lZ6z9sSW for ; Wed, 13 May 2020 23:32:28 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 905DB20495; Wed, 13 May 2020 13:32:23 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Q6gaEDclXsh6; Wed, 13 May 2020 13:32:11 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by silver.osuosl.org (Postfix) with ESMTP id 2976B221D9; Wed, 13 May 2020 13:32:11 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 0633EC0890; Wed, 13 May 2020 13:32:11 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) by lists.linuxfoundation.org (Postfix) with ESMTP id 64207C016F for ; Wed, 13 May 2020 13:32:09 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 400DF20427 for ; Wed, 13 May 2020 13:32:09 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id i2sDRQgOEw+W for ; Wed, 13 May 2020 13:32:05 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-pf1-f195.google.com (mail-pf1-f195.google.com [209.85.210.195]) by silver.osuosl.org (Postfix) with ESMTPS id 9093D2049E for ; Wed, 13 May 2020 13:32:05 +0000 (UTC) Received: by mail-pf1-f195.google.com with SMTP id y18so1201985pfl.9 for ; Wed, 13 May 2020 06:32:05 -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=u/D6BgyBjbnMRDeGYUvKGl1NDCUo2ExShl2q7NyaY7E=; b=lFC49Hh1Danxq6U+Afr5pLrsdDLQeGAmdZqd+ANO/gRlZRcT0gXRW2zzSDtCDxBAz3 vj9ItE9dP9i821SQD2lvus2x4s5QP+0BNx1Re2TmKY0W+3tWotKR9tG3JUCBhLRHKcPS qeYw275oO4aTyJNM2TAG2YgEcIq50sRv6fAZqfaTddUKZxC3sbXTAEcHbEMaoYgAKw7H jGUTTz15vtU2Av2h5sWvw48PoKULYxGy4s4Zn4B5LZQJQ8DugWCotXFg1Dy/1w+0xIU2 tgJE8BpxK5TPx5PWYdyZ5XfhuHcYc5kIMx5vIDYqr4McX/ctYFeB3btQAxWS1Txb02/I 4/GA== 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=u/D6BgyBjbnMRDeGYUvKGl1NDCUo2ExShl2q7NyaY7E=; b=po3iX6vpv87yBR0h9UvaAWy8v7bSpns58pOYUDZad6bLix1s4oUIr+QRenGtFpCTSz aqFkFC1K7Uuma4NSBRABSsEVIfiZ8qDWTAnZKcR6fUaQ3wdsf/3DCGGUFMcESny9Gn/O OEYtKnoaFeG1qoRiTwVYbxfj190cJYHTVcLzu3HuV4UxgCZHv7eVtqnilpuizuFmlfub UIr+eSbp+gScs4wVHbx5cl4z5H7aE+SUQKB+e4UZtSvecAbD0dDDtLlEMqUr3AaGOzoz Ab+AYrqKomZJG0lzm6wl2iBA3kD0ILtG9pQPMiYYzStxaPQ22pBoffLhiU+uDVQFPo34 OrpA== X-Gm-Message-State: AGi0PuaOL1Jrwq4u4G/SC7bxFQ0XSpp/FaMWHOqzirjP9P0pCnez4hgc /MCEvuK3kuve9JO4lJV+IpgpEPN5SbM= X-Google-Smtp-Source: APiQypJioq5iXAm+pdFrXZpSJ+G0pqiUO77rlyCpG1OJTIskYfB59KvQ3W46MGMgZ7E/ypQkUUyUCQ== X-Received: by 2002:a63:7519:: with SMTP id q25mr18079114pgc.224.1589376724781; Wed, 13 May 2020 06:32:04 -0700 (PDT) Received: from localhost.localdomain ([203.100.54.194]) by smtp.gmail.com with ESMTPSA id h11sm14488745pfo.120.2020.05.13.06.32.01 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 13 May 2020 06:32:04 -0700 (PDT) From: xiangxia.m.yue@gmail.com To: dev@openvswitch.org, i.maximets@ovn.org, u9012063@gmail.com, jarno@ovn.org, blp@ovn.org, azhou@ovn.org, pshelar@ovn.org Date: Wed, 13 May 2020 21:31:33 +0800 Message-Id: <20200513133135.48474-3-xiangxia.m.yue@gmail.com> X-Mailer: git-send-email 2.15.0 In-Reply-To: <20200513133135.48474-1-xiangxia.m.yue@gmail.com> References: <1584180230-89020-1-git-send-email-xiangxia.m.yue@gmail.com> <20200513133135.48474-1-xiangxia.m.yue@gmail.com> Subject: [ovs-dev] [PATCH ovs v2 2/4] dpif-netdev: Add burst size to buckets 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 For now, the meter of the userspace datapath, don't include the bucket burst size to buckets. This patch includes it now. $ ovs-ofctl -O OpenFlow13 add-meter br0 \ 'meter=1 pktps burst stats bands=type=drop rate=10000 burst_size=2000' Cc: Ilya Maximets Cc: William Tu Cc: Jarno Rajahalme Cc: Ben Pfaff Cc: Andy Zhou Cc: Pravin Shelar Signed-off-by: Tonghao Zhang --- v2: * burst size unit is kilobits. should x1000. --- lib/dpif-netdev.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/lib/dpif-netdev.c b/lib/dpif-netdev.c index b5deaab31eb0..36ecbfc728a9 100644 --- a/lib/dpif-netdev.c +++ b/lib/dpif-netdev.c @@ -6093,15 +6093,11 @@ dpif_netdev_meter_set(struct dpif *dpif, ofproto_meter_id meter_id, for (i = 0; i < config->n_bands; ++i) { uint32_t band_max_delta_t; - /* Set burst size to a workable value if none specified. */ - if (config->bands[i].burst_size == 0) { - config->bands[i].burst_size = config->bands[i].rate; - } - meter->bands[i].up = config->bands[i]; /* Convert burst size to the bucket units: */ /* pkts => 1/1000 packets, kilobits => bits. */ - meter->bands[i].up.burst_size *= 1000; + meter->bands[i].up.burst_size += config->bands[i].rate; + meter->bands[i].up.burst_size *= 1000ULL; /* Initialize bucket to empty. */ meter->bands[i].bucket = 0;