From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4660715EA8 for ; Wed, 11 Oct 2023 06:12:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="sjT8OI+k" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0D51EC433CA; Wed, 11 Oct 2023 06:12:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1697004763; bh=MYHtN/b6jy9FXE9gfYCbOZ8VlLWid2hpiac/gm413RQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sjT8OI+kgN/glTSafjQnQBT1I/GWslnz+294Tah7halYk540HMvMEK1t++i3PdEoG Pf4D6DOcevW1VyFnG7FIxjWL1zTtTPQBMYimE8FlG5nnLZcRwcg+nLAIn6sXufxYnV yTGVmGZaau3r88wP4Ea/HrYWfhMf4GZ56xe/1fAvGgL40dbszlb9HpI8kn+LX5kOQy UfGetMAzx213XhaazQPu0A97jv3CuUhJSzlyUQUvZ5yuV6uVCvkI+LrQ9MupkbD7C5 kZ4BIOBD/kHA4JFC5M956hqerOOVCyOE2q6R2x5+dPU28XaCgkXxPbeyJTonT8unUU N88ZHyk9wqkLQ== From: Saeed Mahameed To: "David S. Miller" , Jakub Kicinski , Paolo Abeni , Eric Dumazet Cc: Saeed Mahameed , netdev@vger.kernel.org, Tariq Toukan , Adham Faris Subject: [net-next 11/15] net/mlx5e: Refactor mlx5e_rss_set_rxfh() and mlx5e_rss_get_rxfh() Date: Tue, 10 Oct 2023 23:12:26 -0700 Message-ID: <20231011061230.11530-12-saeed@kernel.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231011061230.11530-1-saeed@kernel.org> References: <20231011061230.11530-1-saeed@kernel.org> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: Adham Faris Initialize indirect table array with memcpy rather than for loop. This change has made for two reasons: 1) To be consistent with the indirect table array init in mlx5e_rss_set_rxfh(). 2) In general, prefer to use memcpy for array initializing rather than for loop. Signed-off-by: Adham Faris Reviewed-by: Tariq Toukan Signed-off-by: Saeed Mahameed --- drivers/net/ethernet/mellanox/mlx5/core/en/rss.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/rss.c b/drivers/net/ethernet/mellanox/mlx5/core/en/rss.c index 7f93426b88b3..fd52541e5508 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en/rss.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en/rss.c @@ -470,11 +470,9 @@ int mlx5e_rss_packet_merge_set_param(struct mlx5e_rss *rss, int mlx5e_rss_get_rxfh(struct mlx5e_rss *rss, u32 *indir, u8 *key, u8 *hfunc) { - unsigned int i; - if (indir) - for (i = 0; i < MLX5E_INDIR_RQT_SIZE; i++) - indir[i] = rss->indir.table[i]; + memcpy(indir, rss->indir.table, + MLX5E_INDIR_RQT_SIZE * sizeof(*rss->indir.table)); if (key) memcpy(key, rss->hash.toeplitz_hash_key, @@ -523,12 +521,10 @@ int mlx5e_rss_set_rxfh(struct mlx5e_rss *rss, const u32 *indir, } if (indir) { - unsigned int i; - changed_indir = true; - for (i = 0; i < MLX5E_INDIR_RQT_SIZE; i++) - rss->indir.table[i] = indir[i]; + memcpy(rss->indir.table, indir, + MLX5E_INDIR_RQT_SIZE * sizeof(*rss->indir.table)); } if (changed_indir && rss->enabled) { -- 2.41.0