From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id DAD2D45D6B; Thu, 21 Nov 2024 19:25:50 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id EB22643252; Thu, 21 Nov 2024 19:25:09 +0100 (CET) Received: from mail-pf1-f175.google.com (mail-pf1-f175.google.com [209.85.210.175]) by mails.dpdk.org (Postfix) with ESMTP id 0F4D942FE3 for ; Thu, 21 Nov 2024 19:25:02 +0100 (CET) Received: by mail-pf1-f175.google.com with SMTP id d2e1a72fcca58-72410cc7be9so1212212b3a.0 for ; Thu, 21 Nov 2024 10:25:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1732213501; x=1732818301; darn=dpdk.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=yHsmuZsZ8R7pe5rAOviTFjfYfr+3Jb/5Gr/GA0yETpg=; b=b9FlCGyHG0nApHsU4P0oPyW75Q1S4QVH9mBZasQHEKwra+rfnNqU6bLcWzc8Dtgos3 NwwSNr0sS1v7IOpjx+SpievzBFekM+pzU3SxpeUjSE3RBUNgRp7Y2B4UqMfivdMp410X AzeXFE2mQAQcLFdW07KfBiB75TW7CZYIMc5U3M7WGz8Olqv9DwoveF8OvRFoelYCTPVB +HnjG5i+45ckemCMiPKDFYPuL7y2hIB485/HHIjh7fRqtI6hIuk46flwN++0mu0W2oGa r+VdhwDq4/Nh8T/0xxgP7QR6XWlZwCN5lMCcIVUjx6HwWQHPR1oNpAD9NTYQJ4SDG2F6 FvGA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732213501; x=1732818301; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=yHsmuZsZ8R7pe5rAOviTFjfYfr+3Jb/5Gr/GA0yETpg=; b=I4rfsnrSpY/y+MV2yD/WrxGg4E7QmZXDa4nXDP4zG35SKcziGmjCscxlvB8+ljJ1qI v0+FcHbA2+JbwzdwPjTFTzeZIbpe7B8mjUp3xSAWy6cREBllhXG4cN5I3aQLL/QyNCoB MLgsnqjcBwFz6ZmIlcY65SzNX2xJQFgL101rTxIEPKg3u4H7svgeMw9gYBkmBPIMfmSX WhIR1nd5I0z/+H5fVN0RlLoFOcXuqS7rO5D9fcbg9j+lqFScu0CyMsHs1TxrsNejXUtg llMnWMx7eDjMLfuHGhFJ9CwGpPXatAXA0MmZx5JiHei7+wS2o0OcXbhxs2574J1eZmEE y0mw== X-Gm-Message-State: AOJu0YwQJWpxwf3Xtgpkrul0lK5cQ1TePMWauShBHIbwbav7pTzF5vR+ IxaKVOx73DKUi9hBps/uyYExVpEX+3OBTBX3RyQS+Plg8Xesa3cywIbauhgNnOLPj6bx4jMYoQo Lg6E= X-Gm-Gg: ASbGncuB69foQKnEzTOUMOqEiiqps/ilI+4cY/oXtrmw5svuQldLM5HEQ+cxTdybYJv OWzzUyAcQMc5oKHOMq79XWA+wGXScUrYDFCaQ9N7rm9yJZPg5JZPHxlbYEgh6pPJ/67SwsjwnvW X/5uqX7mxSSXdfMRJpX9b5wPykDDwZ2Q5jx5OmUjSiEx+Ps9bTiWDEQ+TitPPHHqP3WXeI21fqs BZz501Z0Yt2nH3oJyVFStmRhfTBmxFV+ax8UAVnIi4Xznpqe8XUtHvE8j6BTAKXKCGl0M0VYtGX +z5Kj/vreiPs6s3Ho9lJQXKCK24= X-Google-Smtp-Source: AGHT+IHoBCshxBRM79jg85fJgEO+Zx9iyxyK4f2pkkzNG293RCqEsRhNGsxLXF6Sz+0LC3CgVUMyLw== X-Received: by 2002:a05:6a00:3cd5:b0:724:6cd2:cdcf with SMTP id d2e1a72fcca58-724bed8e41dmr10714402b3a.24.1732213501266; Thu, 21 Nov 2024 10:25:01 -0800 (PST) Received: from hermes.local (204-195-96-226.wavecable.com. [204.195.96.226]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-724de454aa1sm70201b3a.4.2024.11.21.10.25.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Nov 2024 10:25:00 -0800 (PST) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , haifeil@nvidia.com, Bruce Richardson , Ajit Khaparde , Aman Singh , Matan Azrad Subject: [PATCH v4 8/9] app/test-pmd: remove redundant condition Date: Thu, 21 Nov 2024 10:23:29 -0800 Message-ID: <20241121182443.68025-9-stephen@networkplumber.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241121182443.68025-1-stephen@networkplumber.org> References: <20241114001403.147609-1-stephen@networkplumber.org> <20241121182443.68025-1-stephen@networkplumber.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org The loop over policy actions will always exit when it sees the flow end action, so the next check is redundant. Link: https://pvs-studio.com/en/blog/posts/cpp/1179/ Fixes: f29fa2c59b85 ("app/testpmd: support policy actions per color") Cc: haifeil@nvidia.com Signed-off-by: Stephen Hemminger Acked-by: Bruce Richardson Acked-by: Ajit Khaparde --- app/test-pmd/config.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c index 28d45568ac..4e7fb69183 100644 --- a/app/test-pmd/config.c +++ b/app/test-pmd/config.c @@ -2288,7 +2288,7 @@ port_meter_policy_add(portid_t port_id, uint32_t policy_id, for (act_n = 0, start = act; act->type != RTE_FLOW_ACTION_TYPE_END; act++) act_n++; - if (act_n && act->type == RTE_FLOW_ACTION_TYPE_END) + if (act_n > 0) policy.actions[i] = start; else policy.actions[i] = NULL; @@ -7338,4 +7338,3 @@ show_mcast_macs(portid_t port_id) printf(" %s\n", buf); } } - -- 2.45.2