Received: by 2002:a05:7412:b130:b0:e2:908c:2ebd with SMTP id az48csp335574rdb; Thu, 16 Nov 2023 23:20:18 -0800 (PST) X-Google-Smtp-Source: AGHT+IGOF0GyvuPtChjAIC2YCHjApyFj5lxFOvsj/CDorB2+3+qaR7eukfr3TXD3nSKsPTYdHE2T X-Received: by 2002:aa7:8e1a:0:b0:6bd:f760:6a9d with SMTP id c26-20020aa78e1a000000b006bdf7606a9dmr17444684pfr.14.1700205618112; Thu, 16 Nov 2023 23:20:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700205618; cv=none; d=google.com; s=arc-20160816; b=JhmE0fDSkm5qxXFo4O/sYWngyiUXontG+ZG4Ju4kizZTo/iNhgPOgMEqS/VOwbYvtr 7bE4TYbu8nKF6GgkyGMxz/ItYmtT0eawxfXs1+Doc6aI1bU8KsIlvlIus/QcEk90VuhM uKGXJvgqJLsdZK++Hgoc3G2L82/0+IONONq4PHSUr8DSh5rD90GTSpO6ZmQIS5RRfkmP fYhR5lWnhkId1FR5aa+Kxgo6tkeKMRxx/u6adeFs6KPep2Z5TzHh/GWgDYbOcWxmPpqb rSsgPIKqmGM5H/u6qOD9suN9fVmTKxhdwg51dm4pVsjSZX8Tr99YMGDztqYM97oSFyEm 28hg== 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 :message-id:date:subject:cc:to:from; bh=wsfJvfszlLoYZ+Xf2ONpV/Yf/zDoVSDfAbunYmXI314=; fh=4cX4bEE4LGRzww7FySUDJ9fMCy99cBUmKqCEcviFLw8=; b=sW16fxVsxsQSyaSdxGnQqV+vh1cLphbBqldXG3wmy8Se9FEPLFFCRGWN8ALnEDMElu zyfkGbXmNoGe9NOWdbDrhzxdi7abLi8ZmPDCv65KtRaXhTRi8NsgY86JfmkBpTy/FrEl 6yv3QuGBrLK7DubYYAnF9jO23SYwsv5rvGTBC8HwLmxdWkAptjBNMtN5JpwHmSKm5c/Z Td1ryBgxrbzsQxqMDWiynugqTcHlg951a8zuFmfShNM7jPh15mMoyB6nnHQXGpzEg2ci o+9+LUgXL/4/te1VClM2z+d5Wc1OsHxyqfDkopnFH8AbhvaJcDJNe5u+HcazrbG2PeXS NWOg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Return-Path: Received: from fry.vger.email (fry.vger.email. [2620:137:e000::3:8]) by mx.google.com with ESMTPS id t6-20020a056a0021c600b006910a45a234si1352603pfj.202.2023.11.16.23.20.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Nov 2023 23:20:18 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) client-ip=2620:137:e000::3:8; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id 2D34A8106788; Thu, 16 Nov 2023 23:20:15 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229995AbjKQHUF (ORCPT + 99 others); Fri, 17 Nov 2023 02:20:05 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38446 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229436AbjKQHUE (ORCPT ); Fri, 17 Nov 2023 02:20:04 -0500 Received: from out30-98.freemail.mail.aliyun.com (out30-98.freemail.mail.aliyun.com [115.124.30.98]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AE388194; Thu, 16 Nov 2023 23:20:00 -0800 (PST) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R141e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018046050;MF=jiapeng.chong@linux.alibaba.com;NM=1;PH=DS;RN=11;SR=0;TI=SMTPD_---0VwYll-M_1700205588; Received: from localhost(mailfrom:jiapeng.chong@linux.alibaba.com fp:SMTPD_---0VwYll-M_1700205588) by smtp.aliyun-inc.com; Fri, 17 Nov 2023 15:19:58 +0800 From: Jiapeng Chong To: saeedm@nvidia.com Cc: leon@kernel.org, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, netdev@vger.kernel.org, linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org, Jiapeng Chong , Abaci Robot Subject: [PATCH] net/mlx5: DR, Use swap() instead of open coding it Date: Fri, 17 Nov 2023 15:19:47 +0800 Message-Id: <20231117071947.112856-1-jiapeng.chong@linux.alibaba.com> X-Mailer: git-send-email 2.20.1.7.g153144c MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE, UNPARSEABLE_RELAY,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (fry.vger.email [0.0.0.0]); Thu, 16 Nov 2023 23:20:15 -0800 (PST) Swap is a function interface that provides exchange function. To avoid code duplication, we can use swap function. ./drivers/net/ethernet/mellanox/mlx5/core/steering/dr_action.c:1254:50-51: WARNING opportunity for swap(). Reported-by: Abaci Robot Closes: https://bugzilla.openanolis.cn/show_bug.cgi?id=7580 Signed-off-by: Jiapeng Chong --- .../net/ethernet/mellanox/mlx5/core/steering/dr_action.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_action.c b/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_action.c index e3ec559369fa..6f9790e97fed 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_action.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_action.c @@ -1170,7 +1170,6 @@ mlx5dr_action_create_mult_dest_tbl(struct mlx5dr_domain *dmn, bool ignore_flow_level, u32 flow_source) { - struct mlx5dr_cmd_flow_destination_hw_info tmp_hw_dest; struct mlx5dr_cmd_flow_destination_hw_info *hw_dests; struct mlx5dr_action **ref_actions; struct mlx5dr_action *action; @@ -1249,11 +1248,8 @@ mlx5dr_action_create_mult_dest_tbl(struct mlx5dr_domain *dmn, * one that done in the TX. * So, if one of the ft target is wire, put it at the end of the dest list. */ - if (is_ft_wire && num_dst_ft > 1) { - tmp_hw_dest = hw_dests[last_dest]; - hw_dests[last_dest] = hw_dests[num_of_dests - 1]; - hw_dests[num_of_dests - 1] = tmp_hw_dest; - } + if (is_ft_wire && num_dst_ft > 1) + swap(hw_dests[last_dest], hw_dests[num_of_dests - 1]); action = dr_action_create_generic(DR_ACTION_TYP_FT); if (!action) -- 2.20.1.7.g153144c