mlx5 fixes 2023-03-15
Subsystems (5)
From: Saeed Mahameed <[email protected]>
This series provides bug fixes to mlx5 driver. Please pull and let me know if there is any problem.
v1->v2:
- Remove blank line around "Fixes:" tag
- Use mlx5 prefix for static functions
Thanks,
Saeed.
The following changes since commit 75014826d0826d175aa9e36cd8e118793263e3f4:
Merge branch 'mtk_eth_soc-SGMII-fixes' (2023-03-15 08:58:13 +0000)
are available in the Git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/saeed/linux.git tags/mlx5-fixes-2023-03-15
for you to fetch changes up to c7b7c64ab5821352db0b3fbaa92773e5a60bfaa7:
net/mlx5e: TC, Remove error message log print (2023-03-15 15:50:18 -0700)
----------------------------------------------------------------
mlx5-fixes-2023-03-15
----------------------------------------------------------------
Adham Faris (1):
net/mlx5e: Lower maximum allowed MTU in XSK to match XDP prerequisites
Daniel Jurgens (1):
net/mlx5: Disable eswitch before waiting for VF pages
Emeel Hakim (1):
net/mlx5e: Fix macsec ASO context alignment
Gal Pressman (1):
net/mlx5e: kTLS, Fix missing error unwind on unsupported cipher type
Maor Dickman (2):
net/mlx5: E-switch, Fix wrong usage of source port rewrite in split rules net/mlx5: E-switch, Fix missing set of split_count when forward to ovs internal port
Oz Shlomo (4):
net/sched: TC, fix raw counter initialization net/mlx5e: TC, fix missing error code net/mlx5e: TC, fix cloned flow attribute net/mlx5e: TC, Remove error message log print
Parav Pandit (2):
net/mlx5e: Don't cache tunnel offloads capability net/mlx5: Fix setting ec_function bit in MANAGE_PAGES
Paul Blakey (1):
net/mlx5e: Fix cleanup null-ptr deref on encap lock
Shay Drory (1):
net/mlx5: Set BREAK_FW_WAIT flag first when removing driver
drivers/net/ethernet/mellanox/mlx5/core/en.h | 1 - .../ethernet/mellanox/mlx5/core/en/tc/act/police.c | 1 - .../ethernet/mellanox/mlx5/core/en/tc/act_stats.c | 5 +++++ .../ethernet/mellanox/mlx5/core/en_accel/ktls_rx.c | 24 ++++++++++++---------- .../ethernet/mellanox/mlx5/core/en_accel/ktls_tx.c | 22 +++++++++++--------- .../ethernet/mellanox/mlx5/core/en_accel/macsec.c | 2 +- drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 14 +++++++------ drivers/net/ethernet/mellanox/mlx5/core/en_rep.c | 1 - drivers/net/ethernet/mellanox/mlx5/core/en_tc.c | 21 ++++++++++++++++--- .../ethernet/mellanox/mlx5/core/eswitch_offloads.c | 10 ++++----- .../net/ethernet/mellanox/mlx5/core/ipoib/ipoib.c | 1 - drivers/net/ethernet/mellanox/mlx5/core/main.c | 4 ++-- .../net/ethernet/mellanox/mlx5/core/pagealloc.c | 22 +++++++++++++++----- 13 files changed, 81 insertions(+), 47 deletions(-)
PATCH v2 1/14 net/mlx5e: Fix macsec ASO context alignment
From: Emeel Hakim <[email protected]>
Currently mlx5e_macsec_umr struct does not satisfy hardware memory alignment requirement. Hence the result of querying advanced steering operation (ASO) is not copied to the memory region as expected.
Fix by satisfying hardware memory alignment requirement and move context to be first field in struct for better readability.
--- drivers/net/ethernet/mellanox/mlx5/core/en_accel/macsec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/mellanox/mlx5/core/en_accel/macsec.c +1 -1
@@ -89,8 +89,8 @@ struct mlx5e_macsec_rx_sc { };struct mlx5e_macsec_umr { +u8 __aligned(64) ctx[MLX5_ST_SZ_BYTES (macsec_aso)];dma_addr_t dma_addr; -u8 ctx[MLX5_ST_SZ_BYTES (macsec_aso)];u32 mkey; };
Signature · 1 line
2.39.2
Re: [net V2 01/14] net/mlx5e: Fix macsec ASO context alignment
This series was applied to netdev/net.git (main) by Saeed Mahameed <[email protected]>:
Hello:
This series was applied to netdev/net.git (main)
by Saeed Mahameed <[email protected]>:
Quoted 10 lines · On Wed, 15 Mar 2023 15:58:34 -0700 you wrote:
From: Emeel Hakim <[email protected]>
Currently
mlx5e_macsec_umrstruct does not satisfy hardware memory alignment requirement. Hence the result of querying advanced steering operation (ASO) is not copied to the memory region as expected.Fix by satisfying hardware memory alignment requirement and move context to be first field in struct for better readability.
[...]
Here is the summary with links:
- [net,V2,01/14] net/mlx5e: Fix macsec ASO context alignment
https://git.kernel.org/netdev/net/c/37beabe9a891 - [net,V2,02/14] net/mlx5e: Don't cache tunnel offloads capability https://git.kernel.org/netdev/net/c/9a92fe1db9e5 - [net,V2,03/14] net/mlx5: Fix setting ec_function bit in MANAGE_PAGES https://git.kernel.org/netdev/net/c/ba5d8f72b82c - [net,V2,04/14] net/mlx5: Disable eswitch before waiting for VF pages https://git.kernel.org/netdev/net/c/7ba930fc25de - [net,V2,05/14] net/mlx5: E-switch, Fix wrong usage of source port rewrite in split rules https://git.kernel.org/netdev/net/c/1313d78ac0c1 - [net,V2,06/14] net/mlx5: E-switch, Fix missing set of split_count when forward to ovs internal port https://git.kernel.org/netdev/net/c/28d3815a629c - [net,V2,07/14] net/mlx5e: Fix cleanup null-ptr deref on encap lock https://git.kernel.org/netdev/net/c/c9668f0b1d28 - [net,V2,08/14] net/mlx5e: kTLS, Fix missing error unwind on unsupported cipher type https://git.kernel.org/netdev/net/c/dd64572490c3 - [net,V2,09/14] net/mlx5: Set BREAK_FW_WAIT flag first when removing driver https://git.kernel.org/netdev/net/c/031a163f2c47 - [net,V2,10/14] net/mlx5e: Lower maximum allowed MTU in XSK to match XDP prerequisites https://git.kernel.org/netdev/net/c/78dee7befd56 - [net,V2,11/14] net/sched: TC, fix raw counter initialization https://git.kernel.org/netdev/net/c/d1a0075ad6b6 - [net,V2,12/14] net/mlx5e: TC, fix missing error code https://git.kernel.org/netdev/net/c/1166add424da - [net,V2,13/14] net/mlx5e: TC, fix cloned flow attribute https://git.kernel.org/netdev/net/c/b23bf10cca59 - [net,V2,14/14] net/mlx5e: TC, Remove error message log print https://git.kernel.org/netdev/net/c/c7b7c64ab582
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html
PATCH v2 2/14 net/mlx5e: Don't cache tunnel offloads capability
In reply to Saeed MahameedFrom: Parav Pandit <[email protected]>
When mlx5e attaches again after device health recovery, the device capabilities might have changed by the eswitch manager.
For example in one flow when ECPF changes the eswitch mode between legacy and switchdev, it updates the flow table tunnel capability.
The cached value is only used in one place, so just check the capability there instead.
--- drivers/net/ethernet/mellanox/mlx5/core/en.h | 1 - drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 4 +--- drivers/net/ethernet/mellanox/mlx5/core/en_rep.c | 1 - drivers/net/ethernet/mellanox/mlx5/core/ipoib/ipoib.c | 1 - 4 files changed, 1 insertion(+), 6 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/en.h +0 -1
@@ -313,7 +313,6 @@ struct mlx5e_params { } channel; } mqprio;bool rx_cqe_compress_def; -bool tunneled_offload_en;struct dim_cq_moder rx_cq_moderation;struct dim_cq_moder tx_cq_moderation;struct mlx5e_packet_merge_param packet_merge;
drivers/net/ethernet/mellanox/mlx5/core/en_main.c +1 -3
@@ -4979,8 +4979,6 @@ void mlx5e_build_nic_params(struct mlx5e_priv *priv, struct mlx5e_xsk *xsk, u16/* TX inline */ mlx5_query_min_inline (mdev, ¶ms->tx_min_inline_mode); - params->tunneled_offload_en =mlx5_tunnel_inner_ft_supported (mdev); -/* AF_XDP */ params->xsk = xsk;
@@ -5285,7 +5283,7 @@ static int mlx5e_init_nic_rx(struct mlx5e_priv *priv) } features =MLX5E_RX_RES_FEATURE_PTP ; -if (priv->channels.params.tunneled_offload_en) +if (mlx5_tunnel_inner_ft_supported (mdev)) features |=MLX5E_RX_RES_FEATURE_INNER_FT ; err = mlx5e_rx_res_init(priv->rx_res, priv->mdev, features, priv->max_nch, priv->drop_rq.rqn,
drivers/net/ethernet/mellanox/mlx5/core/en_rep.c +0 -1
@@ -755,7 +755,6 @@ static void mlx5e_build_rep_params(struct net_device *netdev)mlx5e_set_rx_cq_mode_params (params, cq_period_mode); params->mqprio.num_tc =1 ; - params->tunneled_offload_en = false;if (rep->vport !=MLX5_VPORT_UPLINK ) params->vlan_strip_disable = true;
drivers/net/ethernet/mellanox/mlx5/core/ipoib/ipoib.c +0 -1
@@ -70,7 +70,6 @@ static void mlx5i_build_nic_params(struct mlx5_core_dev *mdev, params->packet_merge.type =MLX5E_PACKET_MERGE_NONE ; params->hard_mtu =MLX5_IB_GRH_BYTES +MLX5_IPOIB_HARD_LEN ; - params->tunneled_offload_en = false;/* CQE compression is not supported for IPoIB */ params->rx_cqe_compress_def = false;
Signature · 1 line
2.39.2
PATCH v2 3/14 net/mlx5: Fix setting ec_function bit in MANAGE_PAGES
In reply to Saeed MahameedFrom: Parav Pandit <[email protected]>
When ECPF is a page supplier, reclaim pages missed to honor the ec_function bit provided by the firmware. It always used the ec_function to true during driver unload flow for ECPF. This is incorrect.
Honor the ec_function bit provided by device during page allocation request event.
--- .../ethernet/mellanox/mlx5/core/pagealloc.c | 22 ++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/pagealloc.c +17 -5
@@ -82,6 +82,16 @@ static u16 func_id_to_type(struct mlx5_core_dev *dev, u16 func_id, bool ec_functreturn func_id <=mlx5_core_max_vfs (dev) ?MLX5_VF :MLX5_SF ; } +static u32 mlx5_get_ec_function (u32 function) +{ +return function >>16 ; +} + +static u32 mlx5_get_func_id (u32 function) +{ +return function &0xffff ; +} +static struct rb_root *page_root_per_function (struct mlx5_core_dev *dev,u32 function) {struct rb_root *root;
@@ -665,20 +675,22 @@ static int optimal_reclaimed_pages(void) }static int mlx5_reclaim_root_pages (struct mlx5_core_dev *dev, -struct rb_root *root,u16 func_id) +struct rb_root *root,u32 function) {u64 recl_pages_to_jiffies =msecs_to_jiffies (mlx5_tout_ms (dev,RECLAIM_PAGES ));unsigned long end = jiffies + recl_pages_to_jiffies;while (!RB_EMPTY_ROOT (root)) { +u32 ec_function =mlx5_get_ec_function (function); +u32 function_id =mlx5_get_func_id (function);int nclaimed;int err; - err =reclaim_pages (dev, func_id,optimal_reclaimed_pages (), - &nclaimed, false,mlx5_core_is_ecpf (dev)); + err =reclaim_pages (dev, function_id,optimal_reclaimed_pages (), + &nclaimed, false, ec_function);if (err) { -mlx5_core_warn (dev,"failed reclaiming pages (%d) for func id 0x%x\n" , - err, func_id); +mlx5_core_warn (dev,"reclaim_pages err (%d) func_id=0x%x ec_func=0x%x\n" , + err, function_id, ec_function);return err; }
Signature · 1 line
2.39.2
PATCH v2 4/14 net/mlx5: Disable eswitch before waiting for VF pages
In reply to Saeed MahameedFrom: Daniel Jurgens <[email protected]>
The offending commit changed the ordering of moving to legacy mode and waiting for the VF pages. Moving to legacy mode is important in bluefield, because it sends the host driver into error state, and frees its pages. Without this transition we end up waiting 2 minutes for pages that aren't coming before carrying on with the unload process.
--- drivers/net/ethernet/mellanox/mlx5/core/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/mellanox/mlx5/core/main.c +1 -1
@@ -1364,8 +1364,8 @@ static void mlx5_unload(struct mlx5_core_dev *dev) {mlx5_devlink_traps_unregister (priv_to_devlink (dev));mlx5_sf_dev_table_destroy (dev); -mlx5_sriov_detach (dev);mlx5_eswitch_disable (dev->priv.eswitch); +mlx5_sriov_detach (dev);mlx5_lag_remove_mdev (dev);mlx5_ec_cleanup (dev);mlx5_sf_hw_table_destroy (dev);
Signature · 1 line
2.39.2
PATCH v2 5/14 net/mlx5: E-switch, Fix wrong usage of source port rewrite in split rules
In reply to Saeed MahameedFrom: Maor Dickman <[email protected]>
In few cases, rules with mirror use case are split to two FTEs, one which do the mirror action and forward to second FTE which do the rest of the rule actions and the second redirect action.
In case of mirror rules which do split and forward to ovs internal port or VF stack devices, source port rewrite should be used in the second FTE but it is wrongly also set in the first FTE which break the offload.
Fix this issue by removing the wrong check if source port rewrite is needed to be used on the first FTE of the split and instead return EOPNOTSUPP which will block offload of rules which mirror to ovs internal port or VF stack devices which isn't supported.
--- .../net/ethernet/mellanox/mlx5/core/eswitch_offloads.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c +5 -5
@@ -723,11 +723,11 @@ mlx5_eswitch_add_fwd_rule(struct mlx5_eswitch *esw, flow_act.action =MLX5_FLOW_CONTEXT_ACTION_FWD_DEST ;for (i =0 ; i < esw_attr->split_count; i++) { -if (esw_is_indir_table (esw, attr)) - err =esw_setup_indir_table (dest, &flow_act, esw, attr, false, &i); -else if (esw_is_chain_src_port_rewrite (esw, esw_attr)) - err =esw_setup_chain_src_port_rewrite (dest, &flow_act, esw, chains, attr, - &i); +if (esw_attr->dests[i].flags &MLX5_ESW_DEST_CHAIN_WITH_SRC_PORT_CHANGE ) +/* Source port rewrite (forward to ovs internal port or statck device) isn't +* supported in the rule of split action. +*/ + err = -EOPNOTSUPP ;else esw_setup_vport_dest (dest, &flow_act, esw, esw_attr, i, i, false);
Signature · 1 line
2.39.2
PATCH v2 6/14 net/mlx5: E-switch, Fix missing set of split_count when forward to ovs internal port
In reply to Saeed MahameedFrom: Maor Dickman <[email protected]>
Rules with mirror actions are split to two FTEs when the actions after the mirror action contains pedit, vlan push/pop or ct. Forward to ovs internal port adds implicit header rewrite (pedit) but missing trigger to do split.
Fix by setting split_count when forwarding to ovs internal port which will trigger split in mirror rules.
--- drivers/net/ethernet/mellanox/mlx5/core/en_tc.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/ethernet/mellanox/mlx5/core/en_tc.c +1 -0
@@ -4304,6 +4304,7 @@ int mlx5e_set_fwd_to_int_port_actions(struct mlx5e_priv *priv, esw_attr->dest_int_port = dest_int_port; esw_attr->dests[out_index].flags |=MLX5_ESW_DEST_CHAIN_WITH_SRC_PORT_CHANGE ; + esw_attr->split_count = out_index;/* Forward to root fdb for matching against the new source vport */ attr->dest_chain =0 ;
Signature · 1 line
2.39.2
PATCH v2 7/14 net/mlx5e: Fix cleanup null-ptr deref on encap lock
In reply to Saeed MahameedFrom: Paul Blakey <[email protected]>
During module is unloaded while a peer tc flow is still offloaded, first the peer uplink rep profile is changed to a nic profile, and so neigh encap lock is destroyed. Next during unload, the VF reps netdevs are unregistered which causes the original non-peer tc flow to be deleted, which deletes the peer flow. The peer flow deletion detaches the encap entry and try to take the already destroyed encap lock, causing the below trace.
Fix this by clearing peer flows during tc eswitch cleanup (mlx5e_tc_esw_cleanup()).
Relevant trace:
[ 4316.837128] BUG: kernel NULL pointer dereference, address: 00000000000001d8 [ 4316.842239] RIP: 0010:__mutex_lock+0xb5/0xc40 [ 4316.851897] Call Trace: [ 4316.852481] <TASK> [ 4316.857214] mlx5e_rep_neigh_entry_release+0x93/0x790 [mlx5_core] [ 4316.858258] mlx5e_rep_encap_entry_detach+0xa7/0xf0 [mlx5_core] [ 4316.859134] mlx5e_encap_dealloc+0xa3/0xf0 [mlx5_core] [ 4316.859867] clean_encap_dests.part.0+0x5c/0xe0 [mlx5_core] [ 4316.860605] mlx5e_tc_del_fdb_flow+0x32a/0x810 [mlx5_core] [ 4316.862609] __mlx5e_tc_del_fdb_peer_flow+0x1a2/0x250 [mlx5_core] [ 4316.863394] mlx5e_tc_del_flow+0x(/0x630 [mlx5_core] [ 4316.864090] mlx5e_flow_put+0x5f/0x100 [mlx5_core] [ 4316.864771] mlx5e_delete_flower+0x4de/0xa40 [mlx5_core] [ 4316.865486] tc_setup_cb_reoffload+0x20/0x80 [ 4316.865905] fl_reoffload+0x47c/0x510 [cls_flower] [ 4316.869181] tcf_block_playback_offloads+0x91/0x1d0 [ 4316.869649] tcf_block_unbind+0xe7/0x1b0 [ 4316.870049] tcf_block_offload_cmd.isra.0+0x1ee/0x270 [ 4316.879266] tcf_block_offload_unbind+0x61/0xa0 [ 4316.879711] __tcf_block_put+0xa4/0x310
--- drivers/net/ethernet/mellanox/mlx5/core/en_tc.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
drivers/net/ethernet/mellanox/mlx5/core/en_tc.c +10 -0
@@ -5464,6 +5464,16 @@ int mlx5e_tc_esw_init(struct mlx5_rep_uplink_priv *uplink_priv)void mlx5e_tc_esw_cleanup (struct mlx5_rep_uplink_priv *uplink_priv) { +struct mlx5e_rep_priv *rpriv; +struct mlx5_eswitch *esw; +struct mlx5e_priv *priv; + + rpriv = container_of(uplink_priv, struct mlx5e_rep_priv, uplink_priv); + priv =netdev_priv (rpriv->netdev); + esw = priv->mdev->priv.eswitch; + +mlx5e_tc_clean_fdb_peer_flows (esw); +mlx5e_tc_tun_cleanup (uplink_priv->encap);mapping_destroy (uplink_priv->tunnel_enc_opts_mapping);
Signature · 1 line
2.39.2
PATCH v2 8/14 net/mlx5e: kTLS, Fix missing error unwind on unsupported cipher type
In reply to Saeed MahameedFrom: Gal Pressman <[email protected]>
Do proper error unwinding when adding an unsupported TX/RX cipher type. Move the switch case prior to key creation so there's less to unwind, and change the goto label name to describe the action performed instead of what failed.
--- .../mellanox/mlx5/core/en_accel/ktls_rx.c | 24 ++++++++++--------- .../mellanox/mlx5/core/en_accel/ktls_tx.c | 22 +++++++++-------- 2 files changed, 25 insertions(+), 21 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls_rx.c +13 -11
@@ -621,15 +621,6 @@ int mlx5e_ktls_add_rx(struct net_device *netdev, struct sock *sk,if (unlikely (!priv_rx))return -ENOMEM ; - dek =mlx5_ktls_create_key (priv->tls->dek_pool, crypto_info); -if (IS_ERR (dek)) { - err =PTR_ERR (dek); - goto err_create_key; - } - priv_rx->dek = dek; - -INIT_LIST_HEAD (&priv_rx->list); -spin_lock_init (&priv_rx->lock);switch (crypto_info->cipher_type) {case TLS_CIPHER_AES_GCM_128 : priv_rx->crypto_info.crypto_info_128 =
@@ -642,9 +633,20 @@ int mlx5e_ktls_add_rx(struct net_device *netdev, struct sock *sk,default :WARN_ONCE (1 ,"Unsupported cipher type %u\n" , crypto_info->cipher_type); -return -EOPNOTSUPP ; + err = -EOPNOTSUPP ; + goto err_cipher_type; } + dek =mlx5_ktls_create_key (priv->tls->dek_pool, crypto_info); +if (IS_ERR (dek)) { + err =PTR_ERR (dek); + goto err_cipher_type; + } + priv_rx->dek = dek; + +INIT_LIST_HEAD (&priv_rx->list); +spin_lock_init (&priv_rx->lock); + rxq =mlx5e_ktls_sk_get_rxq (sk); priv_rx->rxq = rxq; priv_rx->sk = sk;
@@ -677,7 +679,7 @@ int mlx5e_ktls_add_rx(struct net_device *netdev, struct sock *sk,mlx5e_tir_destroy (&priv_rx->tir); err_create_tir:mlx5_ktls_destroy_key (priv->tls->dek_pool, priv_rx->dek); -err_create_key: +err_cipher_type:kfree (priv_rx);return err; }
drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls_tx.c +12 -10
@@ -469,14 +469,6 @@ int mlx5e_ktls_add_tx(struct net_device *netdev, struct sock *sk,if (IS_ERR (priv_tx))return PTR_ERR (priv_tx); - dek =mlx5_ktls_create_key (priv->tls->dek_pool, crypto_info); -if (IS_ERR (dek)) { - err =PTR_ERR (dek); - goto err_create_key; - } - priv_tx->dek = dek; - - priv_tx->expected_seq = start_offload_tcp_sn;switch (crypto_info->cipher_type) {case TLS_CIPHER_AES_GCM_128 : priv_tx->crypto_info.crypto_info_128 =
@@ -489,8 +481,18 @@ int mlx5e_ktls_add_tx(struct net_device *netdev, struct sock *sk,default :WARN_ONCE (1 ,"Unsupported cipher type %u\n" , crypto_info->cipher_type); -return -EOPNOTSUPP ; + err = -EOPNOTSUPP ; + goto err_pool_push; } + + dek =mlx5_ktls_create_key (priv->tls->dek_pool, crypto_info); +if (IS_ERR (dek)) { + err =PTR_ERR (dek); + goto err_pool_push; + } + + priv_tx->dek = dek; + priv_tx->expected_seq = start_offload_tcp_sn; priv_tx->tx_ctx =tls_offload_ctx_tx (tls_ctx);mlx5e_set_ktls_tx_priv_ctx (tls_ctx, priv_tx);
@@ -500,7 +502,7 @@ int mlx5e_ktls_add_tx(struct net_device *netdev, struct sock *sk,return 0 ; -err_create_key: +err_pool_push:pool_push (pool, priv_tx);return err; }
Signature · 1 line
2.39.2
PATCH v2 9/14 net/mlx5: Set BREAK_FW_WAIT flag first when removing driver
In reply to Saeed MahameedFrom: Shay Drory <[email protected]>
Currently, BREAK_FW_WAIT flag is set after syncing with fw_reset. However, fw_reset can call mlx5_load_one() which is waiting for fw init bit and BREAK_FW_WAIT flag is intended to stop. e.g.: the driver might wait on a loop it should exit.
Fix it by setting the flag before syncing with fw_reset.
--- drivers/net/ethernet/mellanox/mlx5/core/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/mellanox/mlx5/core/main.c +1 -1
@@ -1789,11 +1789,11 @@ static void remove_one(struct pci_dev *pdev)struct mlx5_core_dev *dev =pci_get_drvdata (pdev);struct devlink *devlink =priv_to_devlink (dev); +set_bit (MLX5_BREAK_FW_WAIT , &dev->intf_state);/* mlx5_drain_fw_reset() is using devlink APIs. Hence, we must drain * fw_reset before unregistering the devlink. */ mlx5_drain_fw_reset (dev); -set_bit (MLX5_BREAK_FW_WAIT , &dev->intf_state);devlink_unregister (devlink);mlx5_sriov_disable (pdev);mlx5_crdump_disable (dev);
Signature · 1 line
2.39.2
PATCH v2 10/14 net/mlx5e: Lower maximum allowed MTU in XSK to match XDP prerequisites
In reply to Saeed MahameedFrom: Adham Faris <[email protected]>
XSK redirecting XDP programs require linearity, hence applies restrictions on the MTU. For PAGE_SIZE=4K, MTU shouldn't exceed 3498.
Features that contradict with XDP such HW-LRO and HW-GRO are enforced by the driver in advance, during XSK params validation, except for MTU, which was not enforced before this patch.
This has been spotted during test scenario described below:
Attaching xdpsock program (PAGE_SIZE=4K), with MTU < 3498, detaching XDP program, changing the MTU to arbitrary value in the range [3499, 3754], attaching XDP program again, which ended up with failure since MTU is > 3498.
This commit lowers the XSK MTU limitation to be aligned with XDP MTU limitation, since XSK socket is meaningless without XDP program.
--- drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/en_main.c +7 -3
@@ -4169,13 +4169,17 @@ static bool mlx5e_xsk_validate_mtu(struct net_device *netdev,struct xsk_buff_pool *xsk_pool =mlx5e_xsk_get_pool (&chs->params, chs->params.xsk, ix);struct mlx5e_xsk_param xsk; +int max_xdp_mtu;if (!xsk_pool)continue ;mlx5e_build_xsk_param (xsk_pool, &xsk); + max_xdp_mtu =mlx5e_xdp_max_mtu (new_params, &xsk); -if (!mlx5e_validate_xsk_param (new_params, &xsk, mdev)) { +/* Validate XSK params and XDP MTU in advance */ +if (!mlx5e_validate_xsk_param (new_params, &xsk, mdev) || + new_params->sw_mtu > max_xdp_mtu) {u32 hr =mlx5e_get_linear_rq_headroom (new_params, &xsk);int max_mtu_frame, max_mtu_page, max_mtu;
@@ -4185,9 +4189,9 @@ static bool mlx5e_xsk_validate_mtu(struct net_device *netdev,*/ max_mtu_frame =MLX5E_HW2SW_MTU (new_params, xsk.chunk_size - hr); max_mtu_page =MLX5E_HW2SW_MTU (new_params,SKB_MAX_HEAD (0 )); - max_mtu =min (max_mtu_frame, max_mtu_page); + max_mtu =min3 (max_mtu_frame, max_mtu_page, max_xdp_mtu); -netdev_err (netdev,"MTU %d is too big for an XSK running on channel %u. Try MTU <= %d\n" , +netdev_err (netdev,"MTU %d is too big for an XSK running on channel %u or its redirection XDP program. Try MTU <= %d\n" , new_params->sw_mtu, ix, max_mtu);return false; }
Signature · 1 line
2.39.2
PATCH v2 11/14 net/sched: TC, fix raw counter initialization
In reply to Saeed MahameedFrom: Oz Shlomo <[email protected]>
Freed counters may be reused by fs core.
As such, raw counters may not be initialized to zero.
Cache the counter values when the action stats object is initialized to have a proper base value for calculating the difference from the previous query.
--- drivers/net/ethernet/mellanox/mlx5/core/en/tc/act_stats.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/net/ethernet/mellanox/mlx5/core/en/tc/act_stats.c +5 -0
@@ -64,6 +64,7 @@ mlx5e_tc_act_stats_add(struct mlx5e_tc_act_stats_handle *handle, {struct mlx5e_tc_act_stats *act_stats, *old_act_stats;struct rhashtable *ht = &handle->ht; +u64 lastused;int err =0 ; act_stats =kvzalloc (sizeof (*act_stats),GFP_KERNEL );
@@ -73,6 +74,10 @@ mlx5e_tc_act_stats_add(struct mlx5e_tc_act_stats_handle *handle, act_stats->tc_act_cookie = act_cookie; act_stats->counter = counter; +mlx5_fc_query_cached_raw (counter, + &act_stats->lastbytes, + &act_stats->lastpackets, &lastused); +rcu_read_lock (); old_act_stats = rhashtable_lookup_get_insert_fast(ht, &act_stats->hash,
Signature · 1 line
2.39.2
PATCH v2 12/14 net/mlx5e: TC, fix missing error code
In reply to Saeed MahameedFrom: Oz Shlomo <[email protected]>
Missing error code when mlx5e_tc_act_stats_create fails
--- drivers/net/ethernet/mellanox/mlx5/core/en_tc.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/en_tc.c +6 -2
@@ -5305,8 +5305,10 @@ int mlx5e_tc_nic_init(struct mlx5e_priv *priv)mlx5e_tc_debugfs_init (tc,mlx5e_fs_get_debugfs_root (priv->fs)); tc->action_stats_handle =mlx5e_tc_act_stats_create (); -if (IS_ERR (tc->action_stats_handle)) +if (IS_ERR (tc->action_stats_handle)) { + err =PTR_ERR (tc->action_stats_handle); goto err_act_stats; + }return 0 ;
@@ -5441,8 +5443,10 @@ int mlx5e_tc_esw_init(struct mlx5_rep_uplink_priv *uplink_priv) } uplink_priv->action_stats_handle =mlx5e_tc_act_stats_create (); -if (IS_ERR (uplink_priv->action_stats_handle)) +if (IS_ERR (uplink_priv->action_stats_handle)) { + err =PTR_ERR (uplink_priv->action_stats_handle); goto err_action_counter; + }return 0 ;
Signature · 1 line
2.39.2
PATCH v2 13/14 net/mlx5e: TC, fix cloned flow attribute
In reply to Saeed MahameedFrom: Oz Shlomo <[email protected]>
Currently the cloned flow attr resets the original tc action cookies count.
Fix that by resetting the cloned flow attribute.
--- drivers/net/ethernet/mellanox/mlx5/core/en_tc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/mellanox/mlx5/core/en_tc.c +1 -1
@@ -3752,7 +3752,7 @@ mlx5e_clone_flow_attr_for_post_act(struct mlx5_flow_attr *attr, parse_attr->filter_dev = attr->parse_attr->filter_dev; attr2->action =0 ; attr2->counter =NULL ; - attr->tc_act_cookies_count =0 ; + attr2->tc_act_cookies_count =0 ; attr2->flags =0 ; attr2->parse_attr = parse_attr; attr2->dest_chain =0 ;
Signature · 1 line
2.39.2
PATCH v2 14/14 net/mlx5e: TC, Remove error message log print
In reply to Saeed MahameedFrom: Oz Shlomo <[email protected]>
The cited commit attempts to update the hw stats when dumping tc actions. However, the driver may be called to update the stats of a police action that may not be in hardware. In such cases the driver will fail to lookup the police action object and will output an error message both to extack and dmesg. The dmesg error is confusing as it may not indicate an actual error.
Remove the dmesg error.
--- drivers/net/ethernet/mellanox/mlx5/core/en/tc/act/police.c | 1 - 1 file changed, 1 deletion(-)
drivers/net/ethernet/mellanox/mlx5/core/en/tc/act/police.c +0 -1
@@ -178,7 +178,6 @@ tc_act_police_stats(struct mlx5e_priv *priv, meter =mlx5e_tc_meter_get (priv->mdev, ¶ms);if (IS_ERR (meter)) {NL_SET_ERR_MSG_MOD (fl_act->extack,"Failed to get flow meter" ); -mlx5_core_err (priv->mdev,"Failed to get flow meter %d\n" , params.index);return PTR_ERR (meter); }
Signature · 1 line
2.39.2