From: Saeed Mahameed <saeed@kernel.org>
To: "David S. Miller" <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Eric Dumazet <edumazet@google.com>
Cc: Saeed Mahameed <saeedm@nvidia.com>,
netdev@vger.kernel.org, Tariq Toukan <tariqt@nvidia.com>,
Gal Pressman <gal@nvidia.com>
Subject: [net-next 06/15] net/mlx5e: Use clamp operation instead of open coding it
Date: Sat, 12 Nov 2022 02:21:38 -0800 [thread overview]
Message-ID: <20221112102147.496378-7-saeed@kernel.org> (raw)
In-Reply-To: <20221112102147.496378-1-saeed@kernel.org>
From: Gal Pressman <gal@nvidia.com>
Replace the min/max operations with a single clamp.
Signed-off-by: Gal Pressman <gal@nvidia.com>
Reviewed-by: Tariq Toukan <tariqt@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
---
drivers/net/ethernet/mellanox/mlx5/core/en_tc.c | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
index 5a6aa61ec82a..3782f0097292 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
@@ -1060,12 +1060,9 @@ static int mlx5e_hairpin_flow_add(struct mlx5e_priv *priv,
hash_hairpin_info(peer_id, match_prio));
mutex_unlock(&tc->hairpin_tbl_lock);
- params.log_data_size = 16;
- params.log_data_size = min_t(u8, params.log_data_size,
- MLX5_CAP_GEN(priv->mdev, log_max_hairpin_wq_data_sz));
- params.log_data_size = max_t(u8, params.log_data_size,
- MLX5_CAP_GEN(priv->mdev, log_min_hairpin_wq_data_sz));
-
+ params.log_data_size = clamp_t(u8, 16,
+ MLX5_CAP_GEN(priv->mdev, log_min_hairpin_wq_data_sz),
+ MLX5_CAP_GEN(priv->mdev, log_max_hairpin_wq_data_sz));
params.log_num_packets = params.log_data_size -
MLX5_MPWRQ_MIN_LOG_STRIDE_SZ(priv->mdev);
params.log_num_packets = min_t(u8, params.log_num_packets,
--
2.38.1
next prev parent reply other threads:[~2022-11-12 10:22 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-12 10:21 [pull request][net-next 00/15] mlx5 updates 2022-11-12 Saeed Mahameed
2022-11-12 10:21 ` [net-next 01/15] net/mlx5: Bridge, Use debug instead of warn if entry doesn't exists Saeed Mahameed
2022-11-14 11:40 ` patchwork-bot+netdevbpf
2022-11-12 10:21 ` [net-next 02/15] net/mlx5: Fix spelling mistake "destoy" -> "destroy" Saeed Mahameed
2022-11-12 10:21 ` [net-next 03/15] net/mlx5: Unregister traps on driver unload flow Saeed Mahameed
2022-11-12 10:21 ` [net-next 04/15] net/mlx5: Expose vhca_id to debugfs Saeed Mahameed
2022-11-12 10:21 ` [net-next 05/15] net/mlx5e: remove unused list in arfs Saeed Mahameed
2022-11-12 10:21 ` Saeed Mahameed [this message]
2022-11-12 10:21 ` [net-next 07/15] net/mlx5e: Support enhanced CQE compression Saeed Mahameed
2022-11-12 10:21 ` [net-next 08/15] net/mlx5e: Move params kernel log print to probe function Saeed Mahameed
2022-11-12 10:21 ` [net-next 09/15] net/mlx5e: Add error flow when failing update_rx Saeed Mahameed
2022-11-12 10:21 ` [net-next 10/15] net/mlx5e: TC, Remove redundant WARN_ON() Saeed Mahameed
2022-11-12 10:21 ` [net-next 11/15] net/mlx5e: kTLS, Remove unused work field Saeed Mahameed
2022-11-12 10:21 ` [net-next 12/15] net/mlx5e: kTLS, Remove unnecessary per-callback completion Saeed Mahameed
2022-11-12 10:21 ` [net-next 13/15] net/mlx5e: kTLS, Use a single async context object per a callback bulk Saeed Mahameed
2022-11-12 10:21 ` [net-next 14/15] net/mlx5e: CT, optimize pre_ct table lookup Saeed Mahameed
2022-11-12 10:21 ` [net-next 15/15] net/mlx5e: ethtool: get_link_ext_stats for PHY down events 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=20221112102147.496378-7-saeed@kernel.org \
--to=saeed@kernel.org \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=gal@nvidia.com \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=saeedm@nvidia.com \
--cc=tariqt@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).