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>,
Shay Drory <shayd@nvidia.com>, Moshe Shemesh <moshe@nvidia.com>
Subject: [net-next 13/15] net/mlx5: fw_tracer, allow 0 size string DBs
Date: Tue, 7 Feb 2023 16:37:10 -0800 [thread overview]
Message-ID: <20230208003712.68386-14-saeed@kernel.org> (raw)
In-Reply-To: <20230208003712.68386-1-saeed@kernel.org>
From: Shay Drory <shayd@nvidia.com>
Device can expose string DB of size 0 which means this string DB is
currently not in use. Therefore, allow for 0 size string DBs.
Signed-off-by: Shay Drory <shayd@nvidia.com>
Reviewed-by: Moshe Shemesh <moshe@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
---
drivers/net/ethernet/mellanox/mlx5/core/diag/fw_tracer.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/diag/fw_tracer.c b/drivers/net/ethernet/mellanox/mlx5/core/diag/fw_tracer.c
index 4ce75cef46c8..de98357dfd14 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/diag/fw_tracer.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/diag/fw_tracer.c
@@ -233,6 +233,8 @@ static int mlx5_fw_tracer_allocate_strings_db(struct mlx5_fw_tracer *tracer)
int i;
for (i = 0; i < num_string_db; i++) {
+ if (!string_db_size_out[i])
+ continue;
tracer->str_db.buffer[i] = kzalloc(string_db_size_out[i], GFP_KERNEL);
if (!tracer->str_db.buffer[i])
goto free_strings_db;
@@ -278,6 +280,8 @@ static void mlx5_tracer_read_strings_db(struct work_struct *work)
}
for (i = 0; i < num_string_db; i++) {
+ if (!tracer->str_db.size_out[i])
+ continue;
offset = 0;
MLX5_SET(mtrc_stdb, in, string_db_index, i);
num_of_reads = tracer->str_db.size_out[i] /
@@ -384,6 +388,8 @@ static struct tracer_string_format *mlx5_tracer_get_string(struct mlx5_fw_tracer
str_ptr = tracer_event->string_event.string_param;
for (i = 0; i < tracer->str_db.num_string_db; i++) {
+ if (!tracer->str_db.size_out[i])
+ continue;
if (str_ptr > tracer->str_db.base_address_out[i] &&
str_ptr < tracer->str_db.base_address_out[i] +
tracer->str_db.size_out[i]) {
--
2.39.1
next prev parent reply other threads:[~2023-02-08 0:39 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-08 0:36 [pull request][net-next 00/15] mlx5 updates 2023-02-07 Saeed Mahameed
2023-02-08 0:36 ` [net-next 01/15] mlx5: reduce stack usage in mlx5_setup_tc Saeed Mahameed
2023-02-09 3:20 ` patchwork-bot+netdevbpf
2023-02-08 0:36 ` [net-next 02/15] net/mlx5: Remove redundant health work lock Saeed Mahameed
2023-02-08 0:37 ` [net-next 03/15] net/mlx5: fw reset: Skip device ID check if PCI link up failed Saeed Mahameed
2023-02-08 0:37 ` [net-next 04/15] net/mlx5e: Don't listen to remove flows event Saeed Mahameed
2023-02-08 0:37 ` [net-next 05/15] net/mlx5e: Remove redundant code for handling vlan actions Saeed Mahameed
2023-02-08 0:37 ` [net-next 06/15] net/mlx5: fs, Remove redundant vport_number assignment Saeed Mahameed
2023-02-08 0:37 ` [net-next 07/15] net/mlx5e: Remove incorrect debugfs_create_dir NULL check in hairpin Saeed Mahameed
2023-02-08 0:37 ` [net-next 08/15] net/mlx5e: Remove incorrect debugfs_create_dir NULL check in TLS Saeed Mahameed
2023-02-08 0:37 ` [net-next 09/15] net/mlx5: Fix memory leak in error flow of port set buffer Saeed Mahameed
2023-02-08 0:37 ` [net-next 10/15] net/mlx5: fs_core, Remove redundant variable err Saeed Mahameed
2023-02-08 0:37 ` [net-next 11/15] net/mlx5: fs, Remove redundant assignment of size Saeed Mahameed
2023-02-08 0:37 ` [net-next 12/15] net/mlx5: fw_tracer: Fix debug print Saeed Mahameed
2023-02-08 0:37 ` Saeed Mahameed [this message]
2023-02-08 0:37 ` [net-next 14/15] net/mlx5: fw_tracer, Add support for strings DB update event Saeed Mahameed
2023-02-08 0:37 ` [net-next 15/15] net/mlx5: fw_tracer, Add support for unrecognized string 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=20230208003712.68386-14-saeed@kernel.org \
--to=saeed@kernel.org \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=kuba@kernel.org \
--cc=moshe@nvidia.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=saeedm@nvidia.com \
--cc=shayd@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).