From patchwork Fri Apr 24 00:08:04 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tonghao Zhang X-Patchwork-Id: 1276078 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.133; helo=hemlock.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=BPkJ1Boc; dkim-atps=neutral Received: from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 497ZKG0W6gz9sPF for ; Fri, 24 Apr 2020 10:09:06 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id C9B4988702; Fri, 24 Apr 2020 00:09:03 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from hemlock.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 4bxVZSBWUvMq; Fri, 24 Apr 2020 00:09:00 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by hemlock.osuosl.org (Postfix) with ESMTP id EE56288708; Fri, 24 Apr 2020 00:08:59 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id D953CC1D87; Fri, 24 Apr 2020 00:08:59 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133]) by lists.linuxfoundation.org (Postfix) with ESMTP id A9C48C1D7D for ; Fri, 24 Apr 2020 00:08:58 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id 98B59886EF for ; Fri, 24 Apr 2020 00:08:58 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from hemlock.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id o-Sx5WQlNDOR for ; Fri, 24 Apr 2020 00:08:57 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-pf1-f193.google.com (mail-pf1-f193.google.com [209.85.210.193]) by hemlock.osuosl.org (Postfix) with ESMTPS id 71E2D886D5 for ; Fri, 24 Apr 2020 00:08:57 +0000 (UTC) Received: by mail-pf1-f193.google.com with SMTP id v63so3879973pfb.10 for ; Thu, 23 Apr 2020 17:08:57 -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=IXe+9LopwWCD3B+slewPaY/Avt60n4lB3vL4raMN3g4=; b=BPkJ1Boc5TKfvePqYut2uhqmghqz/gX8v1SN8G+3TJM1JdPb2D++FIG55UxGUHdLgL aXcQuHAKAieTAPiqGBUvXCDQ/13TtTBU/m0ndtpotLmRHyo91VQlMOnKwv39QRuBfszM NhvrQERE1+ZxunfpyhG4tBO0DSytghleGpWGBF5I0mKY7R8kTpx/YCIj8WM040rx1lAm f8Dh19qETp6li/ybVsGZfPPad5xRn5cmmH6pWn1RBjIvy6Lh6GXdiH2+CS+r4NpPBU0L 7zA1vTWrd3YEk4trZzLE5xgu6y9hXSW1Df24ZaJn/gPf+g2DCIshuoU+GNnorK7SmxMh 1q8w== 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=IXe+9LopwWCD3B+slewPaY/Avt60n4lB3vL4raMN3g4=; b=dXsNVLkdCzeTh7YZnnqkb7LWmD56wFCTgl6nYMwIFZYUkYKazodKYAL5DG6A+IUbR5 u8rmHLvjHcLOzCr2HLJyG8mqXj+eNA4T95fWr+vK1TR/locc0PnV5yW3UoVAl+T23REU FK8WXkwZxSQpUZJz/ovM4bcqpJ20STUOMz6GMBMlffuPKdfnOeBXTEGmHzBENJhKmqpb a3hC9EIq6bE7BkbYWld6RbYF12qVFG8bwI/rhB34mthYJAAV9aiVMxABVXYmm8JTM0AR wgjkJWdiV+Xil++x5Ze735MNqq+uKvg5N8RjJ3N9h6f/Q+xXQiC5qiQPorujntMth74P FkWw== X-Gm-Message-State: AGi0PuaHJl6wZFv+mAVXV7XmRVdGC3DdP05zlyHXxjB/8EiVbjtSAJ4D y+hGnAfQ3tGDdI5Zk8o1fZw= X-Google-Smtp-Source: APiQypJpgnzafTiYiVmWREbokIBvL7HMZsDf9A1IzGOj2nT3QyHo5Gj/7ZQLdnu339Hmz+KI+cPN9g== X-Received: by 2002:a63:f30a:: with SMTP id l10mr6471865pgh.372.1587686937161; Thu, 23 Apr 2020 17:08:57 -0700 (PDT) Received: from local.opencloud.tech.localdomain ([219.142.146.4]) by smtp.gmail.com with ESMTPSA id p10sm3836100pff.210.2020.04.23.17.08.54 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 23 Apr 2020 17:08:56 -0700 (PDT) From: xiangxia.m.yue@gmail.com To: pshelar@ovn.org, azhou@ovn.org, blp@ovn.org, u9012063@gmail.com Date: Fri, 24 Apr 2020 08:08:04 +0800 Message-Id: <1587686886-16347-4-git-send-email-xiangxia.m.yue@gmail.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1587686886-16347-1-git-send-email-xiangxia.m.yue@gmail.com> References: <1584969039-74113-1-git-send-email-xiangxia.m.yue@gmail.com> <1587686886-16347-1-git-send-email-xiangxia.m.yue@gmail.com> Cc: dev@openvswitch.org, netdev@vger.kernel.org Subject: [ovs-dev] [PATCH net-next v4 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;