From patchwork Wed Apr 22 17:08:58 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tonghao Zhang X-Patchwork-Id: 1275319 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=hXAVwJCa; 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 496n4t6S4Yz9sSq for ; Thu, 23 Apr 2020 03:10:38 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id B3E15228EC; Wed, 22 Apr 2020 17:10:36 +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 y5P7e6v97mxE; Wed, 22 Apr 2020 17:10:32 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by silver.osuosl.org (Postfix) with ESMTP id 2B9CD2286F; Wed, 22 Apr 2020 17:10:32 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 2455FC1797; Wed, 22 Apr 2020 17:10:32 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by lists.linuxfoundation.org (Postfix) with ESMTP id DDE7CC0175 for ; Wed, 22 Apr 2020 17:10:29 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id C845F877D3 for ; Wed, 22 Apr 2020 17:10:29 +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 ksVwOI-8DeRc for ; Wed, 22 Apr 2020 17:10:28 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-pl1-f194.google.com (mail-pl1-f194.google.com [209.85.214.194]) by whitealder.osuosl.org (Postfix) with ESMTPS id 106928776A for ; Wed, 22 Apr 2020 17:10:27 +0000 (UTC) Received: by mail-pl1-f194.google.com with SMTP id ay1so1197647plb.0 for ; Wed, 22 Apr 2020 10:10:27 -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=eluv4zezmL1gel6eSKXMUm1lI9AKk8jn8T+U8AfBUPw=; b=hXAVwJCaoD64Mbjsf6Uh4Y5+jvPcN8GDbaJmCTQVNS15pTATVeN0AyfLx7iM/BtnKo e04pG7SOUCVQWhHwzkCcV6wG2+NJ8A1KMM94hsCKWohSDtdLuEf0ViWajob4YJEAsAni mMxCkTAZXIHXwiUbOQJU5iG1URu1I7aeq9kdvSy5+Oa92djHC5R7QuLfCzRWu8+FyyOF 4KCQ6o1k/Ugy7mPzUav3N+ZG5WqbAYOpUhBAQPh9DeM22H7kqu+mpqTOUCFICLYpOio/ 4d9KGAxw+2n8bCWM3yY3f/b1xiESyRYub47Lh5IXfh5oGdpfb6iZsAqU+Svt9UoCGVjf nn+A== 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=eluv4zezmL1gel6eSKXMUm1lI9AKk8jn8T+U8AfBUPw=; b=PNPN6xChB4LsErOJUR6cdGKA/m9R/9IP68dgtgDi+u5O617U+LAWgrOEJMatcKPkX5 LRzilipmV/ioYmT1EcFuB43WR/IaHjsIlJqBsp2HoXJkCn6o0YwEhFlgTvnTlXFStqEb drhz/7l7RiSZ9ABeMZaGNfiwTFU2rK1wtmSPacm4/s+Y2RB4hCtblwCaWNURViVgKbO4 zSAnjVRqx/p51dz9Z/1gNw1CpIxQWBAlMDLzdfuDt2vKQcGR9Y8TxmqcvSoGjKvrjB2U SdFT/KB4XqspX9X9MhP1Bb2z3iuFV+KaanJ+j5SI3YnpGFSi+qUrh+vQWdqrjzzZYmAg ZGWA== X-Gm-Message-State: AGi0PuYP+oxaspXdEHxAzFpNTZuVQuPjktupUEWmgQoWl/w/uMVjid+J WOVH9H8d7yHpvqx6UuQzREMrdj8s2NQ= X-Google-Smtp-Source: APiQypLXqI32CtLQRwaNMLeqUnnxJpMXi/Apqq3vQkNlpVRtWxz+9ATg9TyyiyLAPdIcnZt4N9x14w== X-Received: by 2002:a17:902:b592:: with SMTP id a18mr28370566pls.147.1587575426717; Wed, 22 Apr 2020 10:10:26 -0700 (PDT) Received: from local.opencloud.tech.localdomain ([219.142.146.4]) by smtp.gmail.com with ESMTPSA id n16sm28549pfq.61.2020.04.22.10.10.23 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 22 Apr 2020 10:10:26 -0700 (PDT) From: xiangxia.m.yue@gmail.com To: pshelar@ovn.org, azhou@ovn.org, blp@ovn.org, u9012063@gmail.com Date: Thu, 23 Apr 2020 01:08:58 +0800 Message-Id: <1587575340-6790-4-git-send-email-xiangxia.m.yue@gmail.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1587575340-6790-1-git-send-email-xiangxia.m.yue@gmail.com> References: <1584969039-74113-1-git-send-email-xiangxia.m.yue@gmail.com> <1587575340-6790-1-git-send-email-xiangxia.m.yue@gmail.com> Cc: dev@openvswitch.org, netdev@vger.kernel.org Subject: [ovs-dev] [PATCH net-next v3 3/5] net: openvswitch: remove the unnecessary check 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 Before invoking the ovs_meter_cmd_reply_stats, "meter" was checked, so don't check it agin in that function. Cc: Pravin B Shelar Cc: Andy Zhou Signed-off-by: Tonghao Zhang Acked-by: Pravin B Shelar --- net/openvswitch/meter.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/net/openvswitch/meter.c b/net/openvswitch/meter.c index 372f4565872d..b7893b0d6423 100644 --- a/net/openvswitch/meter.c +++ b/net/openvswitch/meter.c @@ -242,12 +242,11 @@ static int ovs_meter_cmd_reply_stats(struct sk_buff *reply, u32 meter_id, if (nla_put_u32(reply, OVS_METER_ATTR_ID, meter_id)) goto error; - if (!meter) - return 0; - if (nla_put(reply, OVS_METER_ATTR_STATS, - sizeof(struct ovs_flow_stats), &meter->stats) || - nla_put_u64_64bit(reply, OVS_METER_ATTR_USED, meter->used, + sizeof(struct ovs_flow_stats), &meter->stats)) + goto error; + + if (nla_put_u64_64bit(reply, OVS_METER_ATTR_USED, meter->used, OVS_METER_ATTR_PAD)) goto error;