netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Przemek Kitszel <przemyslaw.kitszel@intel.com>
To: Jiapeng Chong <jiapeng.chong@linux.alibaba.com>, <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>,
	Abaci Robot <abaci@linux.alibaba.com>
Subject: Re: [PATCH] net/mlx5: DR, Use swap() instead of open coding it
Date: Fri, 17 Nov 2023 10:18:35 +0100	[thread overview]
Message-ID: <5165bc9f-4e57-bdda-0640-d6cdcd08f031@intel.com> (raw)
In-Reply-To: <20231117071947.112856-1-jiapeng.chong@linux.alibaba.com>

On 11/17/23 08:19, Jiapeng Chong wrote:
> 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 <abaci@linux.alibaba.com>
> Closes: https://bugzilla.openanolis.cn/show_bug.cgi?id=7580
> Signed-off-by: Jiapeng Chong <jiapeng.chong@linux.alibaba.com>
> ---
>   .../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)

Reviewed-by: Przemek Kitszel <przemyslaw.kitszel@intel.com>

For future non-bugfix contributions please target patches to net-next

  reply	other threads:[~2023-11-17  9:18 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-17  7:19 [PATCH] net/mlx5: DR, Use swap() instead of open coding it Jiapeng Chong
2023-11-17  9:18 ` Przemek Kitszel [this message]
2023-12-06 22:37 ` Saeed Mahameed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5165bc9f-4e57-bdda-0640-d6cdcd08f031@intel.com \
    --to=przemyslaw.kitszel@intel.com \
    --cc=abaci@linux.alibaba.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=jiapeng.chong@linux.alibaba.com \
    --cc=kuba@kernel.org \
    --cc=leon@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=saeedm@nvidia.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).