mlx5 updates 2023-02-07
Subsystems (6)
From: Saeed Mahameed <[email protected]>
This series adds minor misc updates to mlx5.
For more information please see tag log below.
Please pull and let me know if there is any problem.
Thanks,
Saeed.
The following changes since commit 383d9f87a06dd923c4fd0fdcb65b58258851f545:
Merge branch 'net-core-use-a-dedicated-kmem_cache-for-skb-head-allocs' (2023-02-07 11:00:03 -0800)
are available in the Git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/saeed/linux.git tags/mlx5-updates-2023-02-07
for you to fetch changes up to f7133135235dbd11e7cb5fe62fe5d05ce5e82eeb:
net/mlx5: fw_tracer, Add support for unrecognized string (2023-02-07 16:29:56 -0800)
----------------------------------------------------------------
mlx5-updates-2023-02-07
Minor updates to mlx5 driver:
1) Minor and trivial code Cleanups
2) Minor fixes for net-next
3) From Shay: dynamic FW trace strings update.
----------------------------------------------------------------
Arnd Bergmann (1):
mlx5: reduce stack usage in mlx5_setup_tc
Gal Pressman (2):
net/mlx5e: Remove incorrect debugfs_create_dir NULL check in hairpin net/mlx5e: Remove incorrect debugfs_create_dir NULL check in TLS
Leon Romanovsky (1):
net/mlx5e: Don't listen to remove flows event
Maher Sanalla (1):
net/mlx5: Fix memory leak in error flow of port set buffer
Maor Dickman (1):
net/mlx5: fs_core, Remove redundant variable err
Moshe Shemesh (1):
net/mlx5: fw reset: Skip device ID check if PCI link up failed
Roi Dayan (3):
net/mlx5e: Remove redundant code for handling vlan actions net/mlx5: fs, Remove redundant vport_number assignment net/mlx5: fs, Remove redundant assignment of size
Shay Drory (5):
net/mlx5: Remove redundant health work lock net/mlx5: fw_tracer: Fix debug print
net/mlx5: fw_tracer, allow 0 size string DBs net/mlx5: fw_tracer, Add support for strings DB update event net/mlx5: fw_tracer, Add support for unrecognized string
.../ethernet/mellanox/mlx5/core/diag/fw_tracer.c | 79 +++++++- .../ethernet/mellanox/mlx5/core/diag/fw_tracer.h | 9 + .../ethernet/mellanox/mlx5/core/en/port_buffer.c | 4 +- .../ethernet/mellanox/mlx5/core/en/tc/act/vlan.c | 35 +--- .../mellanox/mlx5/core/en_accel/ipsec_offload.c | 4 +- .../ethernet/mellanox/mlx5/core/en_accel/ktls_tx.c | 2 - drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 17 +- drivers/net/ethernet/mellanox/mlx5/core/en_tc.c | 11 -- drivers/net/ethernet/mellanox/mlx5/core/eswitch.h | 5 - .../ethernet/mellanox/mlx5/core/eswitch_offloads.c | 208 +-------------------- drivers/net/ethernet/mellanox/mlx5/core/fs_cmd.c | 7 - drivers/net/ethernet/mellanox/mlx5/core/fs_core.c | 3 +- drivers/net/ethernet/mellanox/mlx5/core/fw_reset.c | 1 + drivers/net/ethernet/mellanox/mlx5/core/health.c | 28 +-- include/linux/mlx5/device.h | 1 + include/linux/mlx5/driver.h | 2 - 16 files changed, 117 insertions(+), 299 deletions(-)
PATCH 1/15 mlx5: reduce stack usage in mlx5_setup_tc
From: Arnd Bergmann <[email protected]>
Clang warns about excessive stack usage on 32-bit targets:
drivers/net/ethernet/mellanox/mlx5/core/en_main.c:3597:12: error: stack frame size (1184) exceeds limit (1024) in 'mlx5e_setup_tc' [-Werror,-Wframe-larger-than] static int mlx5e_setup_tc(struct net_device *dev, enum tc_setup_type type,
It turns out that both the mlx5e_setup_tc_mqprio_dcb() function and the mlx5e_safe_switch_params() function it calls have a copy of 'struct mlx5e_params' on the stack, and this structure is fairly large.
Use dynamic allocation for the inner one.
--- .../net/ethernet/mellanox/mlx5/core/en_main.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/en_main.c +11 -6
@@ -3002,32 +3002,37 @@ int mlx5e_safe_switch_params(struct mlx5e_priv *priv,mlx5e_fp_preactivate preactivate, void *context, bool reset) { - struct mlx5e_channels new_chs = {}; + struct mlx5e_channels *new_chs;int err; reset &=test_bit (MLX5E_STATE_OPENED , &priv->state);if (!reset)return mlx5e_switch_priv_params (priv, params, preactivate, context); - new_chs.params = *params; + new_chs =kzalloc (sizeof (*new_chs),GFP_KERNEL ); +if (!new_chs) +return -ENOMEM ; + new_chs->params = *params; -mlx5e_selq_prepare_params (&priv->selq, &new_chs.params); +mlx5e_selq_prepare_params (&priv->selq, &new_chs->params); - err =mlx5e_open_channels (priv, &new_chs); + err =mlx5e_open_channels (priv, new_chs);if (err) goto err_cancel_selq; - err =mlx5e_switch_priv_channels (priv, &new_chs, preactivate, context); + err =mlx5e_switch_priv_channels (priv, new_chs, preactivate, context);if (err) goto err_close; +kfree (new_chs);return 0 ; err_close: -mlx5e_close_channels (&new_chs); +mlx5e_close_channels (new_chs); err_cancel_selq:mlx5e_selq_cancel (&priv->selq); +kfree (new_chs);return err; }
Signature · 1 line
2.39.1
Re: [net-next 01/15] mlx5: reduce stack usage in mlx5_setup_tc
This series was applied to netdev/net-next.git (master) by Saeed Mahameed <[email protected]>:
Hello:
This series was applied to netdev/net-next.git (master) by Saeed Mahameed <[email protected]>:
Quoted 8 lines · On Tue, 7 Feb 2023 16:36:58 -0800 you wrote:
From: Arnd Bergmann <[email protected]>
Clang warns about excessive stack usage on 32-bit targets:
drivers/net/ethernet/mellanox/mlx5/core/en_main.c:3597:12: error: stack frame size (1184) exceeds limit (1024) in 'mlx5e_setup_tc' [-Werror,-Wframe-larger-than] static int mlx5e_setup_tc(structnet_device*dev, enumtc_setup_typetype,[...]
Here is the summary with links:
- [net-next,01/15] mlx5: reduce stack usage in mlx5_setup_tc
https://git.kernel.org/netdev/net-next/c/7802886274cc - [net-next,02/15] net/mlx5: Remove redundant health work lock https://git.kernel.org/netdev/net-next/c/67257cba905d - [net-next,03/15] net/mlx5: fw reset: Skip device ID check if PCI link up failed https://git.kernel.org/netdev/net-next/c/114b295470e7 - [net-next,04/15] net/mlx5e: Don't listen to remove flows event https://git.kernel.org/netdev/net-next/c/a2a73ea14b1a - [net-next,05/15] net/mlx5e: Remove redundant code for handling vlan actions https://git.kernel.org/netdev/net-next/c/633ad4b29c21 - [net-next,06/15] net/mlx5: fs, Remove redundant vport_number assignment https://git.kernel.org/netdev/net-next/c/2e762e65998e - [net-next,07/15] net/mlx5e: Remove incorrect debugfs_create_dir NULL check in hairpin https://git.kernel.org/netdev/net-next/c/afae6254c5ea - [net-next,08/15] net/mlx5e: Remove incorrect debugfs_create_dir NULL check in TLS https://git.kernel.org/netdev/net-next/c/1e985a8d887c - [net-next,09/15] net/mlx5: Fix memory leak in error flow of port set buffer https://git.kernel.org/netdev/net-next/c/e3e01c1c1598 - [net-next,10/15] net/mlx5: fs_core, Remove redundant variable err https://git.kernel.org/netdev/net-next/c/08929f32da0f - [net-next,11/15] net/mlx5: fs, Remove redundant assignment of size https://git.kernel.org/netdev/net-next/c/beeebdc52caf - [net-next,12/15] net/mlx5: fw_tracer: Fix debug print https://git.kernel.org/netdev/net-next/c/988c23522739 - [net-next,13/15] net/mlx5: fw_tracer, allow 0 size string DBs https://git.kernel.org/netdev/net-next/c/b0118ced6b2e - [net-next,14/15] net/mlx5: fw_tracer, Add support for strings DB update event https://git.kernel.org/netdev/net-next/c/7dfcd110a458 - [net-next,15/15] net/mlx5: fw_tracer, Add support for unrecognized string https://git.kernel.org/netdev/net-next/c/f7133135235d
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html
PATCH 2/15 net/mlx5: Remove redundant health work lock
In reply to Saeed MahameedFrom: Shay Drory <[email protected]>
Commit 90e7cb78b815 ("net/mlx5: fix missing mutex_unlock in mlx5_fw_fatal_reporter_err_work()") introduced another checking of MLX5_DROP_HEALTH_NEW_WORK. At this point, the first check of MLX5_DROP_HEALTH_NEW_WORK is redundant and so is the lock that protects it.
Remove the lock and rename MLX5_DROP_HEALTH_NEW_WORK to reflect these changes.
--- .../net/ethernet/mellanox/mlx5/core/health.c | 28 +++++-------------- include/linux/mlx5/driver.h | 2 -- 2 files changed, 7 insertions(+), 23 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/health.c +7 -21
@@ -62,7 +62,7 @@ enum { };enum { -MLX5_DROP_NEW_HEALTH_WORK , +MLX5_DROP_HEALTH_WORK , };enum {
@@ -675,7 +675,7 @@ static void mlx5_fw_fatal_reporter_err_work(struct work_struct *work) devlink =priv_to_devlink (dev);mutex_lock (&dev->intf_state_mutex); -if (test_bit (MLX5_DROP_NEW_HEALTH_WORK , &health->flags)) { +if (test_bit (MLX5_DROP_HEALTH_WORK , &health->flags)) {mlx5_core_err (dev,"health works are not permitted at this stage\n" );mutex_unlock (&dev->intf_state_mutex);return ;
@@ -771,14 +771,8 @@ static unsigned long get_next_poll_jiffies(struct mlx5_core_dev *dev)void mlx5_trigger_health_work (struct mlx5_core_dev *dev) {struct mlx5_core_health *health = &dev->priv.health; -unsigned long flags; -spin_lock_irqsave (&health->wq_lock, flags); -if (!test_bit (MLX5_DROP_NEW_HEALTH_WORK , &health->flags)) -queue_work (health->wq, &health->fatal_report_work); -else -mlx5_core_err (dev,"new health works are not permitted at this stage\n" ); -spin_unlock_irqrestore (&health->wq_lock, flags); +queue_work (health->wq, &health->fatal_report_work); }#define MLX5_MSEC_PER_HOUR (MSEC_PER_SEC * 60 * 60)
@@ -858,7 +852,7 @@ void mlx5_start_health_poll(struct mlx5_core_dev *dev)timer_setup (&health->timer, poll_health,0 ); health->fatal_error =MLX5_SENSOR_NO_ERR ; -clear_bit (MLX5_DROP_NEW_HEALTH_WORK , &health->flags); +clear_bit (MLX5_DROP_HEALTH_WORK , &health->flags); health->health = &dev->iseg->health; health->health_counter = &dev->iseg->health_counter;
@@ -869,13 +863,9 @@ void mlx5_start_health_poll(struct mlx5_core_dev *dev)void mlx5_stop_health_poll (struct mlx5_core_dev *dev,bool disable_health) {struct mlx5_core_health *health = &dev->priv.health; -unsigned long flags; -if (disable_health) { -spin_lock_irqsave (&health->wq_lock, flags); -set_bit (MLX5_DROP_NEW_HEALTH_WORK , &health->flags); -spin_unlock_irqrestore (&health->wq_lock, flags); - } +if (disable_health) +set_bit (MLX5_DROP_HEALTH_WORK , &health->flags);del_timer_sync (&health->timer); }
@@ -891,11 +881,8 @@ void mlx5_start_health_fw_log_up(struct mlx5_core_dev *dev)void mlx5_drain_health_wq (struct mlx5_core_dev *dev) {struct mlx5_core_health *health = &dev->priv.health; -unsigned long flags; -spin_lock_irqsave (&health->wq_lock, flags); -set_bit (MLX5_DROP_NEW_HEALTH_WORK , &health->flags); -spin_unlock_irqrestore (&health->wq_lock, flags); +set_bit (MLX5_DROP_HEALTH_WORK , &health->flags);cancel_delayed_work_sync (&health->update_fw_log_ts_work);cancel_work_sync (&health->report_work);cancel_work_sync (&health->fatal_report_work);
@@ -928,7 +915,6 @@ int mlx5_health_init(struct mlx5_core_dev *dev)kfree (name);if (!health->wq) goto out_err; -spin_lock_init (&health->wq_lock);INIT_WORK (&health->fatal_report_work, mlx5_fw_fatal_reporter_err_work);INIT_WORK (&health->report_work, mlx5_fw_reporter_err_work);INIT_DELAYED_WORK (&health->update_fw_log_ts_work, mlx5_health_log_ts_update);
include/linux/mlx5/driver.h +0 -2
@@ -430,8 +430,6 @@ struct mlx5_core_health {u8 synd;u32 fatal_error;u32 crdump_size; -/* wq spinlock to synchronize draining */ -spinlock_t wq_lock;struct workqueue_struct *wq;unsigned long flags;struct work_struct fatal_report_work;
Signature · 1 line
2.39.1
PATCH 3/15 net/mlx5: fw reset: Skip device ID check if PCI link up failed
In reply to Saeed MahameedFrom: Moshe Shemesh <[email protected]>
In case where after reset the PCI link is not ready within timeout, skip reading device ID as if there is no PCI link up we can't have FW response to pci config cycles either.
This also fixes err value not used and overwritten in such flow.
--- drivers/net/ethernet/mellanox/mlx5/core/fw_reset.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/ethernet/mellanox/mlx5/core/fw_reset.c +1 -0
@@ -371,6 +371,7 @@ static int mlx5_pci_link_toggle(struct mlx5_core_dev *dev)mlx5_core_err (dev,"PCI link not ready (0x%04x) after %llu ms\n" , reg16,mlx5_tout_ms (dev,PCI_TOGGLE )); err = -ETIMEDOUT ; + goto restore; } do {
Signature · 1 line
2.39.1
PATCH 4/15 net/mlx5e: Don't listen to remove flows event
In reply to Saeed MahameedFrom: Leon Romanovsky <[email protected]>
remove_flow_enable event isn't really needed as it will be triggered once user and/or XFRM core explicitly asked to delete state. In such situation, we won't be interested in any event at all.
So don't trigger and listen to remove_flow_enable event.
--- .../net/ethernet/mellanox/mlx5/core/en_accel/ipsec_offload.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec_offload.c +1 -3
@@ -92,7 +92,6 @@ static void mlx5e_ipsec_packet_setup(void *obj, u32 pdn,MLX5_SET (ipsec_aso, aso_ctx, remove_flow_pkt_cnt,lower_32_bits (attrs->hard_packet_limit));MLX5_SET (ipsec_aso, aso_ctx, hard_lft_arm,1 ); -MLX5_SET (ipsec_aso, aso_ctx, remove_flow_enable,1 ); }if (attrs->soft_packet_limit !=XFRM_INF ) {
@@ -329,8 +328,7 @@ static void mlx5e_ipsec_handle_event(struct work_struct *_work)if (attrs->soft_packet_limit !=XFRM_INF )if (!MLX5_GET (ipsec_aso, aso->ctx, soft_lft_arm) || - !MLX5_GET (ipsec_aso, aso->ctx, hard_lft_arm) || - !MLX5_GET (ipsec_aso, aso->ctx, remove_flow_enable)) + !MLX5_GET (ipsec_aso, aso->ctx, hard_lft_arm))xfrm_state_check_expire (sa_entry->x); unlock:
Signature · 1 line
2.39.1
PATCH 5/15 net/mlx5e: Remove redundant code for handling vlan actions
In reply to Saeed MahameedFrom: Roi Dayan <[email protected]>
Remove unused code which was used only with deprecated HW which didn't support vlan actions.
--- .../mellanox/mlx5/core/en/tc/act/vlan.c | 35 +-- .../net/ethernet/mellanox/mlx5/core/en_tc.c | 9 - .../net/ethernet/mellanox/mlx5/core/eswitch.h | 5 - .../mellanox/mlx5/core/eswitch_offloads.c | 208 +----------------- 4 files changed, 14 insertions(+), 243 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/en/tc/act/vlan.c +9 -26
@@ -44,19 +44,17 @@ parse_tc_vlan_action(struct mlx5e_priv *priv,return -EOPNOTSUPP ; } +if (!mlx5_eswitch_vlan_actions_supported (priv->mdev, vlan_idx)) { +NL_SET_ERR_MSG_MOD (extack,"firmware vlan actions is not supported" ); +return -EOPNOTSUPP ; + } +switch (act->id) {case FLOW_ACTION_VLAN_POP : -if (vlan_idx) { -if (!mlx5_eswitch_vlan_actions_supported (priv->mdev, -MLX5_FS_VLAN_DEPTH )) { -NL_SET_ERR_MSG_MOD (extack,"vlan pop action is not supported" ); -return -EOPNOTSUPP ; - } - +if (vlan_idx) *action |=MLX5_FLOW_CONTEXT_ACTION_VLAN_POP_2 ; - }else { +else *action |=MLX5_FLOW_CONTEXT_ACTION_VLAN_POP ; - }break ;case FLOW_ACTION_VLAN_PUSH : attr->vlan_vid[vlan_idx] = act->vlan.vid;
@@ -65,25 +63,10 @@ parse_tc_vlan_action(struct mlx5e_priv *priv,if (!attr->vlan_proto[vlan_idx]) attr->vlan_proto[vlan_idx] =htons (ETH_P_8021Q ); -if (vlan_idx) { -if (!mlx5_eswitch_vlan_actions_supported (priv->mdev, -MLX5_FS_VLAN_DEPTH )) { -NL_SET_ERR_MSG_MOD (extack, -"vlan push action is not supported for vlan depth > 1" ); -return -EOPNOTSUPP ; - } - +if (vlan_idx) *action |=MLX5_FLOW_CONTEXT_ACTION_VLAN_PUSH_2 ; - }else { -if (!mlx5_eswitch_vlan_actions_supported (priv->mdev,1 ) && - (act->vlan.proto !=htons (ETH_P_8021Q ) || - act->vlan.prio)) { -NL_SET_ERR_MSG_MOD (extack,"vlan push action is not supported" ); -return -EOPNOTSUPP ; - } - +else *action |=MLX5_FLOW_CONTEXT_ACTION_VLAN_PUSH ; - }break ;case FLOW_ACTION_VLAN_POP_ETH : parse_state->eth_pop = true;
drivers/net/ethernet/mellanox/mlx5/core/en_tc.c +0 -9
@@ -1884,7 +1884,6 @@ post_process_attr(struct mlx5e_tc_flow *flow,struct mlx5_flow_attr *attr, struct netlink_ext_ack *extack) { - struct mlx5_eswitch *esw = flow->priv->mdev->priv.eswitch; bool vf_tun;int err =0 ;
@@ -1896,12 +1895,6 @@ post_process_attr(struct mlx5e_tc_flow *flow,if (err) goto err_out; -if (mlx5e_is_eswitch_flow (flow)) { - err =mlx5_eswitch_add_vlan_action (esw, attr); -if (err) - goto err_out; - } -if (attr->action &MLX5_FLOW_CONTEXT_ACTION_MOD_HDR ) { err =mlx5e_tc_attach_mod_hdr (flow->priv, flow, attr);if (err)
@@ -2105,8 +2098,6 @@ static void mlx5e_tc_del_fdb_flow(struct mlx5e_priv *priv,if (mlx5_flow_has_geneve_opt (flow))mlx5_geneve_tlv_option_del (priv->mdev->geneve); -mlx5_eswitch_del_vlan_action (esw, attr); -if (flow->decap_route)mlx5e_detach_decap_route (priv, flow);
drivers/net/ethernet/mellanox/mlx5/core/eswitch.h +0 -5
@@ -222,7 +222,6 @@ struct mlx5_eswitch_fdb {struct mlx5_flow_handle **send_to_vport_meta_rules;struct mlx5_flow_handle *miss_rule_uni;struct mlx5_flow_handle *miss_rule_multi; -int vlan_push_pop_refcount;struct mlx5_fs_chains *esw_chains_priv;struct {
@@ -520,10 +519,6 @@ int mlx5_devlink_port_fn_migratable_set(struct devlink_port *port, bool enable, struct netlink_ext_ack *extack);void *mlx5_eswitch_get_uplink_priv (struct mlx5_eswitch *esw,u8 rep_type); -int mlx5_eswitch_add_vlan_action (struct mlx5_eswitch *esw, -struct mlx5_flow_attr *attr); -int mlx5_eswitch_del_vlan_action (struct mlx5_eswitch *esw, -struct mlx5_flow_attr *attr);int __mlx5_eswitch_set_vport_vlan (struct mlx5_eswitch *esw,u16 vport,u16 vlan,u8 qos,u8 set_flags);
drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c +5 -203
225 lines not on this page · raw message
Signature · 1 line
2.39.1
PATCH 6/15 net/mlx5: fs, Remove redundant vport_number assignment
In reply to Saeed MahameedFrom: Roi Dayan <[email protected]>
vport_number and other_vport being reassigned outside the if clause anyway. remove the redundant assignment.
--- drivers/net/ethernet/mellanox/mlx5/core/fs_cmd.c | 5 ----- 1 file changed, 5 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/fs_cmd.c +0 -5
@@ -412,11 +412,6 @@ static int mlx5_cmd_create_flow_group(struct mlx5_flow_root_namespace *ns, MLX5_CMD_OP_CREATE_FLOW_GROUP);MLX5_SET (create_flow_group_in, in, table_type, ft->type);MLX5_SET (create_flow_group_in, in, table_id, ft->id); -if (ft->vport) { -MLX5_SET (create_flow_group_in, in, vport_number, ft->vport); -MLX5_SET (create_flow_group_in, in, other_vport,1 ); - } -MLX5_SET (create_flow_group_in, in, vport_number, ft->vport);MLX5_SET (create_flow_group_in, in, other_vport, !!(ft->flags &MLX5_FLOW_TABLE_OTHER_VPORT ));
Signature · 1 line
2.39.1
PATCH 7/15 net/mlx5e: Remove incorrect debugfs_create_dir NULL check in hairpin
In reply to Saeed MahameedFrom: Gal Pressman <[email protected]>
Remove the NULL check on debugfs_create_dir() return value as the function returns an ERR pointer on failure, not NULL.
The check is not replaced with a IS_ERR_OR_NULL() as debugfs_create_file(), and debugfs functions in general don't need error checking.
--- drivers/net/ethernet/mellanox/mlx5/core/en_tc.c | 2 -- 1 file changed, 2 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/en_tc.c +0 -2
@@ -1124,8 +1124,6 @@ static void mlx5e_tc_debugfs_init(struct mlx5e_tc_table *tc,return ; tc->dfs_root =debugfs_create_dir ("tc" , dfs_root); -if (!tc->dfs_root) -return ;debugfs_create_file ("hairpin_num_queues" ,0644 , tc->dfs_root, &tc->hairpin_params, &fops_hairpin_queues);
Signature · 1 line
2.39.1
PATCH 8/15 net/mlx5e: Remove incorrect debugfs_create_dir NULL check in TLS
In reply to Saeed MahameedFrom: Gal Pressman <[email protected]>
Remove the NULL check on debugfs_create_dir() return value as the function returns an ERR pointer on failure, not NULL.
The check is not replaced with a IS_ERR_OR_NULL() as debugfs_create_file(), and debugfs functions in general don't need error checking.
--- drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls_tx.c | 2 -- 1 file changed, 2 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls_tx.c +0 -2
@@ -899,8 +899,6 @@ static void mlx5e_tls_tx_debugfs_init(struct mlx5e_tls *tls,return ; tls->debugfs.dfs_tx =debugfs_create_dir ("tx" , dfs_root); -if (!tls->debugfs.dfs_tx) -return ;debugfs_create_size_t ("pool_size" ,0400 , tls->debugfs.dfs_tx, &tls->tx_pool->size);
Signature · 1 line
2.39.1
PATCH 9/15 net/mlx5: Fix memory leak in error flow of port set buffer
In reply to Saeed MahameedFrom: Maher Sanalla <[email protected]>
In the cited commit, shared buffer updates were added whenever port buffer gets updated.
However, in case the shared buffer update fails, exiting early from port_set_buffer() is performed without freeing previously-allocated memory.
Fix it by jumping to out label where memory is freed before returning with error.
--- drivers/net/ethernet/mellanox/mlx5/core/en/port_buffer.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/en/port_buffer.c +2 -2
@@ -314,11 +314,11 @@ static int port_set_buffer(struct mlx5e_priv *priv, err =port_update_shared_buffer (priv->mdev, current_headroom_size, new_headroom_size);if (err) -return err; + goto out; err =port_update_pool_cfg (priv->mdev, port_buffer);if (err) -return err; + goto out; err =mlx5e_port_set_pbmc (mdev, in); out:
Signature · 1 line
2.39.1
PATCH 10/15 net/mlx5: fs_core, Remove redundant variable err
In reply to Saeed MahameedFrom: Maor Dickman <[email protected]>
Local variable "err" is not used so it is safe to remove.
--- drivers/net/ethernet/mellanox/mlx5/core/fs_core.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/fs_core.c +1 -2
@@ -1776,7 +1776,6 @@ static int build_match_list(struct match_list *match_head, {struct rhlist_head *tmp, *list;struct mlx5_flow_group *g; -int err =0 ;rcu_read_lock ();INIT_LIST_HEAD (&match_head->list);
@@ -1802,7 +1801,7 @@ static int build_match_list(struct match_list *match_head,list_add_tail (&curr_match->list, &match_head->list); }rcu_read_unlock (); -return err; +return 0 ; }static u64 matched_fgs_get_version (struct list_head *match_head)
Signature · 1 line
2.39.1
PATCH 11/15 net/mlx5: fs, Remove redundant assignment of size
In reply to Saeed MahameedFrom: Roi Dayan <[email protected]>
size is being reassigned in the line after. remove the redundant assignment.
--- drivers/net/ethernet/mellanox/mlx5/core/fs_cmd.c | 2 -- 1 file changed, 2 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/fs_cmd.c +0 -2
@@ -272,8 +272,6 @@ static int mlx5_cmd_create_flow_table(struct mlx5_flow_root_namespace *ns,unsigned int size;int err; -if (ft_attr->max_fte !=POOL_NEXT_SIZE ) - size =roundup_pow_of_two (ft_attr->max_fte); size =mlx5_ft_pool_get_avail_sz (dev, ft->type, ft_attr->max_fte);if (!size)return -ENOSPC ;
Signature · 1 line
2.39.1
PATCH 12/15 net/mlx5: fw_tracer: Fix debug print
In reply to Saeed MahameedFrom: Shay Drory <[email protected]>
The debug message specify tdsn, but takes as an argument the tmsn. The correct argument is tmsn, hence, fix the print.
--- drivers/net/ethernet/mellanox/mlx5/core/diag/fw_tracer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/mellanox/mlx5/core/diag/fw_tracer.c +1 -1
@@ -602,7 +602,7 @@ static int mlx5_tracer_handle_string_trace(struct mlx5_fw_tracer *tracer, }else { cur_string =mlx5_tracer_message_get (tracer, tracer_event);if (!cur_string) { -pr_debug ("%s Got string event for unknown string tdsm: %d\n" , +pr_debug ("%s Got string event for unknown string tmsn: %d\n" , __func__, tracer_event->string_event.tmsn);return -1 ; }
Signature · 1 line
2.39.1
PATCH 13/15 net/mlx5: fw_tracer, allow 0 size string DBs
In reply to Saeed MahameedFrom: Shay Drory <[email protected]>
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.
--- drivers/net/ethernet/mellanox/mlx5/core/diag/fw_tracer.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/net/ethernet/mellanox/mlx5/core/diag/fw_tracer.c +6 -0
@@ -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]) {
Signature · 1 line
2.39.1
PATCH 14/15 net/mlx5: fw_tracer, Add support for strings DB update event
In reply to Saeed MahameedFrom: Shay Drory <[email protected]>
In case a new string DB is added to the FW, the FW publishes an event notifying the strings DB have updated.
Add support in driver for handling this event.
--- .../mellanox/mlx5/core/diag/fw_tracer.c | 46 ++++++++++++++++--- .../mellanox/mlx5/core/diag/fw_tracer.h | 8 ++++ include/linux/mlx5/device.h | 1 + 3 files changed, 49 insertions(+), 6 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/diag/fw_tracer.c +40 -6
@@ -936,6 +936,14 @@ int mlx5_fw_tracer_get_saved_traces_objects(struct mlx5_fw_tracer *tracer,return err; } +static void mlx5_fw_tracer_update_db (struct work_struct *work) +{ +struct mlx5_fw_tracer *tracer = + container_of(work, struct mlx5_fw_tracer, update_db_work); + +mlx5_fw_tracer_reload (tracer); +} +/* Create software resources (Buffers, etc ..) */ struct mlx5_fw_tracer *mlx5_fw_tracer_create (struct mlx5_core_dev *dev) {
@@ -963,6 +971,8 @@ struct mlx5_fw_tracer *mlx5_fw_tracer_create(struct mlx5_core_dev *dev)INIT_WORK (&tracer->ownership_change_work, mlx5_fw_tracer_ownership_change);INIT_WORK (&tracer->read_fw_strings_work, mlx5_tracer_read_strings_db);INIT_WORK (&tracer->handle_traces_work, mlx5_fw_tracer_handle_traces); +INIT_WORK (&tracer->update_db_work, mlx5_fw_tracer_update_db); +mutex_init (&tracer->state_lock); err =mlx5_query_mtrc_caps (tracer);
@@ -1009,11 +1019,15 @@ int mlx5_fw_tracer_init(struct mlx5_fw_tracer *tracer)if (IS_ERR_OR_NULL (tracer))return 0 ; - dev = tracer->dev; -if (!tracer->str_db.loaded)queue_work (tracer->work_queue, &tracer->read_fw_strings_work); +mutex_lock (&tracer->state_lock); +if (test_and_set_bit (MLX5_TRACER_STATE_UP , &tracer->state)) + goto unlock; + + dev = tracer->dev; + err =mlx5_core_alloc_pd (dev, &tracer->buff.pdn);if (err) {mlx5_core_warn (dev,"FWTracer: Failed to allocate PD %d\n" , err);
@@ -1034,6 +1048,8 @@ int mlx5_fw_tracer_init(struct mlx5_fw_tracer *tracer)mlx5_core_warn (dev,"FWTracer: Failed to start tracer %d\n" , err); goto err_notifier_unregister; } +unlock: +mutex_unlock (&tracer->state_lock);return 0 ; err_notifier_unregister:
@@ -1043,6 +1059,7 @@ int mlx5_fw_tracer_init(struct mlx5_fw_tracer *tracer)mlx5_core_dealloc_pd (dev, tracer->buff.pdn); err_cancel_work:cancel_work_sync (&tracer->read_fw_strings_work); +mutex_unlock (&tracer->state_lock);return err; }
@@ -1052,17 +1069,27 @@ void mlx5_fw_tracer_cleanup(struct mlx5_fw_tracer *tracer)if (IS_ERR_OR_NULL (tracer))return ; +mutex_lock (&tracer->state_lock); +if (!test_and_clear_bit (MLX5_TRACER_STATE_UP , &tracer->state)) + goto unlock; +mlx5_core_dbg (tracer->dev,"FWTracer: Cleanup, is owner ? (%d)\n" , tracer->owner);mlx5_eq_notifier_unregister (tracer->dev, &tracer->nb);cancel_work_sync (&tracer->ownership_change_work);cancel_work_sync (&tracer->handle_traces_work); +/* It is valid to get here from update_db_work. Hence, don't wait for +* update_db_work to finished. +*/ +cancel_work (&tracer->update_db_work);if (tracer->owner)mlx5_fw_tracer_ownership_release (tracer);mlx5_core_destroy_mkey (tracer->dev, tracer->buff.mkey);mlx5_core_dealloc_pd (tracer->dev, tracer->buff.pdn); +unlock: +mutex_unlock (&tracer->state_lock); }/* Free software resources (Buffers, etc ..) */
@@ -1079,6 +1106,7 @@ void mlx5_fw_tracer_destroy(struct mlx5_fw_tracer *tracer)mlx5_fw_tracer_clean_saved_traces_array (tracer);mlx5_fw_tracer_free_strings_db (tracer);mlx5_fw_tracer_destroy_log_buf (tracer); +mutex_destroy (&tracer->state_lock);destroy_workqueue (tracer->work_queue);kvfree (tracer); }
@@ -1088,6 +1116,8 @@ static int mlx5_fw_tracer_recreate_strings_db(struct mlx5_fw_tracer *tracer)struct mlx5_core_dev *dev;int err; +if (test_and_set_bit (MLX5_TRACER_RECREATE_DB , &tracer->state)) +return 0 ;cancel_work_sync (&tracer->read_fw_strings_work);mlx5_fw_tracer_clean_ready_list (tracer);mlx5_fw_tracer_clean_print_hash (tracer);
@@ -1098,17 +1128,18 @@ static int mlx5_fw_tracer_recreate_strings_db(struct mlx5_fw_tracer *tracer) err =mlx5_query_mtrc_caps (tracer);if (err) {mlx5_core_dbg (dev,"FWTracer: Failed to query capabilities %d\n" , err); -return err; + goto out; } err =mlx5_fw_tracer_allocate_strings_db (tracer);if (err) {mlx5_core_warn (dev,"FWTracer: Allocate strings DB failed %d\n" , err); -return err; + goto out; }mlx5_fw_tracer_init_saved_traces_array (tracer); - -return 0 ; +out: +clear_bit (MLX5_TRACER_RECREATE_DB , &tracer->state); +return err; }int mlx5_fw_tracer_reload (struct mlx5_fw_tracer *tracer)
@@ -1148,6 +1179,9 @@ static int fw_tracer_event(struct notifier_block *nb, unsigned long action, voidcase MLX5_TRACER_SUBTYPE_TRACES_AVAILABLE :queue_work (tracer->work_queue, &tracer->handle_traces_work);break ; +case MLX5_TRACER_SUBTYPE_STRINGS_DB_UPDATE : +queue_work (tracer->work_queue, &tracer->update_db_work); +break ;default :mlx5_core_dbg (dev,"FWTracer: Event with unrecognized subtype: sub_type %d\n" , eqe->sub_type);
drivers/net/ethernet/mellanox/mlx5/core/diag/fw_tracer.h +8 -0
@@ -63,6 +63,11 @@ struct mlx5_fw_trace_data {char msg[TRACE_STR_MSG ]; }; +enum mlx5_fw_tracer_state { +MLX5_TRACER_STATE_UP =BIT (0 ), +MLX5_TRACER_RECREATE_DB =BIT (1 ), +}; +struct mlx5_fw_tracer {struct mlx5_core_dev *dev;struct mlx5_nb nb;
@@ -104,6 +109,9 @@ struct mlx5_fw_tracer {struct work_struct handle_traces_work;struct hlist_head hash[MESSAGE_HASH_SIZE ];struct list_head ready_strings_list; +struct work_struct update_db_work; +struct mutex state_lock;/* Synchronize update work with reload flows */ +unsigned long state; };struct tracer_string_format {
include/linux/mlx5/device.h +1 -0
@@ -367,6 +367,7 @@ enum mlx5_driver_event {enum {MLX5_TRACER_SUBTYPE_OWNERSHIP_CHANGE =0x0 ,MLX5_TRACER_SUBTYPE_TRACES_AVAILABLE =0x1 , +MLX5_TRACER_SUBTYPE_STRINGS_DB_UPDATE =0x2 , };enum {
Signature · 1 line
2.39.1
PATCH 15/15 net/mlx5: fw_tracer, Add support for unrecognized string
In reply to Saeed MahameedFrom: Shay Drory <[email protected]>
In case FW is publishing a string which isn't found in the driver's string DBs, keep the string as raw data.
--- .../mellanox/mlx5/core/diag/fw_tracer.c | 25 +++++++++++++++++-- .../mellanox/mlx5/core/diag/fw_tracer.h | 1 + 2 files changed, 24 insertions(+), 2 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/diag/fw_tracer.c +23 -2
@@ -465,6 +465,7 @@ static void poll_trace(struct mlx5_fw_tracer *tracer, tracer_event->event_id =MLX5_GET (tracer_event, trace, event_id); tracer_event->lost_event =MLX5_GET (tracer_event, trace, lost); + tracer_event->out = trace;switch (tracer_event->event_id) {case TRACER_EVENT_TYPE_TIMESTAMP :
@@ -587,6 +588,26 @@ void mlx5_tracer_print_trace(struct tracer_string_format *str_frmt,mlx5_tracer_clean_message (str_frmt); } +static int mlx5_tracer_handle_raw_string (struct mlx5_fw_tracer *tracer, +struct tracer_event *tracer_event) +{ +struct tracer_string_format *cur_string; + + cur_string =mlx5_tracer_message_insert (tracer, tracer_event); +if (!cur_string) +return -1 ; + + cur_string->event_id = tracer_event->event_id; + cur_string->timestamp = tracer_event->string_event.timestamp; + cur_string->lost = tracer_event->lost_event; + cur_string->string ="0x%08x%08x" ; + cur_string->num_of_params =2 ; + cur_string->params[0 ] =upper_32_bits (*tracer_event->out); + cur_string->params[1 ] =lower_32_bits (*tracer_event->out); +list_add_tail (&cur_string->list, &tracer->ready_strings_list); +return 0 ; +} +static int mlx5_tracer_handle_string_trace (struct mlx5_fw_tracer *tracer,struct tracer_event *tracer_event) {
@@ -595,7 +616,7 @@ static int mlx5_tracer_handle_string_trace(struct mlx5_fw_tracer *tracer,if (tracer_event->string_event.tdsn ==0 ) { cur_string =mlx5_tracer_get_string (tracer, tracer_event);if (!cur_string) -return -1 ; +return mlx5_tracer_handle_raw_string (tracer, tracer_event); cur_string->num_of_params =mlx5_tracer_get_num_of_params (cur_string->string); cur_string->last_param_num =0 ;
@@ -610,7 +631,7 @@ static int mlx5_tracer_handle_string_trace(struct mlx5_fw_tracer *tracer,if (!cur_string) {pr_debug ("%s Got string event for unknown string tmsn: %d\n" , __func__, tracer_event->string_event.tmsn); -return -1 ; +return mlx5_tracer_handle_raw_string (tracer, tracer_event); } cur_string->last_param_num +=1 ;if (cur_string->last_param_num >TRACER_MAX_PARAMS ) {
drivers/net/ethernet/mellanox/mlx5/core/diag/fw_tracer.h +1 -0
@@ -166,6 +166,7 @@ struct tracer_event {struct tracer_string_event string_event;struct tracer_timestamp_event timestamp_event; }; +u64 *out; };struct mlx5_ifc_tracer_event_bits {
Signature · 1 line
2.39.1