Skip to content

Commit 76d71ee

Browse files
committed
Merge branch 'mlx5-misc-fixes-2024-11-07'
Tariq Toukan says: ==================== mlx5 misc fixes 2024-11-07 This patchset provides misc bug fixes from the team to the mlx5 core and Eth drivers. ==================== Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
2 parents cf8fbc6 + d1ac339 commit 76d71ee

File tree

7 files changed

+54
-15
lines changed

7 files changed

+54
-15
lines changed

drivers/net/ethernet/mellanox/mlx5/core/en/tc_ct.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -866,7 +866,7 @@ mlx5_tc_ct_entry_add_rule(struct mlx5_tc_ct_priv *ct_priv,
866866
return 0;
867867

868868
err_rule:
869-
mlx5_tc_ct_entry_destroy_mod_hdr(ct_priv, zone_rule->attr, zone_rule->mh);
869+
mlx5_tc_ct_entry_destroy_mod_hdr(ct_priv, attr, zone_rule->mh);
870870
mlx5_put_label_mapping(ct_priv, attr->ct_attr.ct_labels_id);
871871
err_mod_hdr:
872872
kfree(attr);

drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls_tx.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -660,7 +660,7 @@ tx_sync_info_get(struct mlx5e_ktls_offload_context_tx *priv_tx,
660660
while (remaining > 0) {
661661
skb_frag_t *frag = &record->frags[i];
662662

663-
get_page(skb_frag_page(frag));
663+
page_ref_inc(skb_frag_page(frag));
664664
remaining -= skb_frag_size(frag);
665665
info->frags[i++] = *frag;
666666
}
@@ -763,7 +763,7 @@ void mlx5e_ktls_tx_handle_resync_dump_comp(struct mlx5e_txqsq *sq,
763763
stats = sq->stats;
764764

765765
mlx5e_tx_dma_unmap(sq->pdev, dma);
766-
put_page(wi->resync_dump_frag_page);
766+
page_ref_dec(wi->resync_dump_frag_page);
767767
stats->tls_dump_packets++;
768768
stats->tls_dump_bytes += wi->num_bytes;
769769
}
@@ -816,12 +816,12 @@ mlx5e_ktls_tx_handle_ooo(struct mlx5e_ktls_offload_context_tx *priv_tx,
816816

817817
err_out:
818818
for (; i < info.nr_frags; i++)
819-
/* The put_page() here undoes the page ref obtained in tx_sync_info_get().
819+
/* The page_ref_dec() here undoes the page ref obtained in tx_sync_info_get().
820820
* Page refs obtained for the DUMP WQEs above (by page_ref_add) will be
821821
* released only upon their completions (or in mlx5e_free_txqsq_descs,
822822
* if channel closes).
823823
*/
824-
put_page(skb_frag_page(&info.frags[i]));
824+
page_ref_dec(skb_frag_page(&info.frags[i]));
825825

826826
return MLX5E_KTLS_SYNC_FAIL;
827827
}

drivers/net/ethernet/mellanox/mlx5/core/en_main.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4267,7 +4267,8 @@ void mlx5e_set_xdp_feature(struct net_device *netdev)
42674267
struct mlx5e_params *params = &priv->channels.params;
42684268
xdp_features_t val;
42694269

4270-
if (params->packet_merge.type != MLX5E_PACKET_MERGE_NONE) {
4270+
if (!netdev->netdev_ops->ndo_bpf ||
4271+
params->packet_merge.type != MLX5E_PACKET_MERGE_NONE) {
42714272
xdp_clear_features_flag(netdev);
42724273
return;
42734274
}

drivers/net/ethernet/mellanox/mlx5/core/en_selftest.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
#include "en.h"
3737
#include "en/port.h"
3838
#include "eswitch.h"
39+
#include "lib/mlx5.h"
3940

4041
static int mlx5e_test_health_info(struct mlx5e_priv *priv)
4142
{
@@ -247,6 +248,9 @@ static int mlx5e_cond_loopback(struct mlx5e_priv *priv)
247248
if (is_mdev_switchdev_mode(priv->mdev))
248249
return -EOPNOTSUPP;
249250

251+
if (mlx5_get_sd(priv->mdev))
252+
return -EOPNOTSUPP;
253+
250254
return 0;
251255
}
252256

drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2527,8 +2527,11 @@ static void __esw_offloads_unload_rep(struct mlx5_eswitch *esw,
25272527
struct mlx5_eswitch_rep *rep, u8 rep_type)
25282528
{
25292529
if (atomic_cmpxchg(&rep->rep_data[rep_type].state,
2530-
REP_LOADED, REP_REGISTERED) == REP_LOADED)
2530+
REP_LOADED, REP_REGISTERED) == REP_LOADED) {
2531+
if (rep_type == REP_ETH)
2532+
__esw_offloads_unload_rep(esw, rep, REP_IB);
25312533
esw->offloads.rep_ops[rep_type]->unload(rep);
2534+
}
25322535
}
25332536

25342537
static void __unload_reps_all_vport(struct mlx5_eswitch *esw, u8 rep_type)

drivers/net/ethernet/mellanox/mlx5/core/fs_core.c

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2105,13 +2105,22 @@ lookup_fte_locked(struct mlx5_flow_group *g,
21052105
fte_tmp = NULL;
21062106
goto out;
21072107
}
2108+
2109+
nested_down_write_ref_node(&fte_tmp->node, FS_LOCK_CHILD);
2110+
21082111
if (!fte_tmp->node.active) {
2112+
up_write_ref_node(&fte_tmp->node, false);
2113+
2114+
if (take_write)
2115+
up_write_ref_node(&g->node, false);
2116+
else
2117+
up_read_ref_node(&g->node);
2118+
21092119
tree_put_node(&fte_tmp->node, false);
2110-
fte_tmp = NULL;
2111-
goto out;
2120+
2121+
return NULL;
21122122
}
21132123

2114-
nested_down_write_ref_node(&fte_tmp->node, FS_LOCK_CHILD);
21152124
out:
21162125
if (take_write)
21172126
up_write_ref_node(&g->node, false);

drivers/net/ethernet/mellanox/mlx5/core/pci_irq.c

Lines changed: 27 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -593,9 +593,11 @@ static void irq_pool_free(struct mlx5_irq_pool *pool)
593593
kvfree(pool);
594594
}
595595

596-
static int irq_pools_init(struct mlx5_core_dev *dev, int sf_vec, int pcif_vec)
596+
static int irq_pools_init(struct mlx5_core_dev *dev, int sf_vec, int pcif_vec,
597+
bool dynamic_vec)
597598
{
598599
struct mlx5_irq_table *table = dev->priv.irq_table;
600+
int sf_vec_available = sf_vec;
599601
int num_sf_ctrl;
600602
int err;
601603

@@ -616,6 +618,13 @@ static int irq_pools_init(struct mlx5_core_dev *dev, int sf_vec, int pcif_vec)
616618
num_sf_ctrl = DIV_ROUND_UP(mlx5_sf_max_functions(dev),
617619
MLX5_SFS_PER_CTRL_IRQ);
618620
num_sf_ctrl = min_t(int, MLX5_IRQ_CTRL_SF_MAX, num_sf_ctrl);
621+
if (!dynamic_vec && (num_sf_ctrl + 1) > sf_vec_available) {
622+
mlx5_core_dbg(dev,
623+
"Not enough IRQs for SFs control and completion pool, required=%d avail=%d\n",
624+
num_sf_ctrl + 1, sf_vec_available);
625+
return 0;
626+
}
627+
619628
table->sf_ctrl_pool = irq_pool_alloc(dev, pcif_vec, num_sf_ctrl,
620629
"mlx5_sf_ctrl",
621630
MLX5_EQ_SHARE_IRQ_MIN_CTRL,
@@ -624,9 +633,11 @@ static int irq_pools_init(struct mlx5_core_dev *dev, int sf_vec, int pcif_vec)
624633
err = PTR_ERR(table->sf_ctrl_pool);
625634
goto err_pf;
626635
}
627-
/* init sf_comp_pool */
636+
sf_vec_available -= num_sf_ctrl;
637+
638+
/* init sf_comp_pool, remaining vectors are for the SF completions */
628639
table->sf_comp_pool = irq_pool_alloc(dev, pcif_vec + num_sf_ctrl,
629-
sf_vec - num_sf_ctrl, "mlx5_sf_comp",
640+
sf_vec_available, "mlx5_sf_comp",
630641
MLX5_EQ_SHARE_IRQ_MIN_COMP,
631642
MLX5_EQ_SHARE_IRQ_MAX_COMP);
632643
if (IS_ERR(table->sf_comp_pool)) {
@@ -715,6 +726,7 @@ int mlx5_irq_table_get_num_comp(struct mlx5_irq_table *table)
715726
int mlx5_irq_table_create(struct mlx5_core_dev *dev)
716727
{
717728
int num_eqs = mlx5_max_eq_cap_get(dev);
729+
bool dynamic_vec;
718730
int total_vec;
719731
int pcif_vec;
720732
int req_vec;
@@ -724,21 +736,31 @@ int mlx5_irq_table_create(struct mlx5_core_dev *dev)
724736
if (mlx5_core_is_sf(dev))
725737
return 0;
726738

739+
/* PCI PF vectors usage is limited by online cpus, device EQs and
740+
* PCI MSI-X capability.
741+
*/
727742
pcif_vec = MLX5_CAP_GEN(dev, num_ports) * num_online_cpus() + 1;
728743
pcif_vec = min_t(int, pcif_vec, num_eqs);
744+
pcif_vec = min_t(int, pcif_vec, pci_msix_vec_count(dev->pdev));
729745

730746
total_vec = pcif_vec;
731747
if (mlx5_sf_max_functions(dev))
732748
total_vec += MLX5_MAX_MSIX_PER_SF * mlx5_sf_max_functions(dev);
733749
total_vec = min_t(int, total_vec, pci_msix_vec_count(dev->pdev));
734-
pcif_vec = min_t(int, pcif_vec, pci_msix_vec_count(dev->pdev));
735750

736751
req_vec = pci_msix_can_alloc_dyn(dev->pdev) ? 1 : total_vec;
737752
n = pci_alloc_irq_vectors(dev->pdev, 1, req_vec, PCI_IRQ_MSIX);
738753
if (n < 0)
739754
return n;
740755

741-
err = irq_pools_init(dev, total_vec - pcif_vec, pcif_vec);
756+
/* Further limit vectors of the pools based on platform for non dynamic case */
757+
dynamic_vec = pci_msix_can_alloc_dyn(dev->pdev);
758+
if (!dynamic_vec) {
759+
pcif_vec = min_t(int, n, pcif_vec);
760+
total_vec = min_t(int, n, total_vec);
761+
}
762+
763+
err = irq_pools_init(dev, total_vec - pcif_vec, pcif_vec, dynamic_vec);
742764
if (err)
743765
pci_free_irq_vectors(dev->pdev);
744766

0 commit comments

Comments
 (0)