mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-23 20:24:12 +08:00
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/20241107183527.676877-1-tariqt@nvidia.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
commit
76d71eee1b
@ -866,7 +866,7 @@ mlx5_tc_ct_entry_add_rule(struct mlx5_tc_ct_priv *ct_priv,
|
||||
return 0;
|
||||
|
||||
err_rule:
|
||||
mlx5_tc_ct_entry_destroy_mod_hdr(ct_priv, zone_rule->attr, zone_rule->mh);
|
||||
mlx5_tc_ct_entry_destroy_mod_hdr(ct_priv, attr, zone_rule->mh);
|
||||
mlx5_put_label_mapping(ct_priv, attr->ct_attr.ct_labels_id);
|
||||
err_mod_hdr:
|
||||
kfree(attr);
|
||||
|
@ -660,7 +660,7 @@ tx_sync_info_get(struct mlx5e_ktls_offload_context_tx *priv_tx,
|
||||
while (remaining > 0) {
|
||||
skb_frag_t *frag = &record->frags[i];
|
||||
|
||||
get_page(skb_frag_page(frag));
|
||||
page_ref_inc(skb_frag_page(frag));
|
||||
remaining -= skb_frag_size(frag);
|
||||
info->frags[i++] = *frag;
|
||||
}
|
||||
@ -763,7 +763,7 @@ void mlx5e_ktls_tx_handle_resync_dump_comp(struct mlx5e_txqsq *sq,
|
||||
stats = sq->stats;
|
||||
|
||||
mlx5e_tx_dma_unmap(sq->pdev, dma);
|
||||
put_page(wi->resync_dump_frag_page);
|
||||
page_ref_dec(wi->resync_dump_frag_page);
|
||||
stats->tls_dump_packets++;
|
||||
stats->tls_dump_bytes += wi->num_bytes;
|
||||
}
|
||||
@ -816,12 +816,12 @@ mlx5e_ktls_tx_handle_ooo(struct mlx5e_ktls_offload_context_tx *priv_tx,
|
||||
|
||||
err_out:
|
||||
for (; i < info.nr_frags; i++)
|
||||
/* The put_page() here undoes the page ref obtained in tx_sync_info_get().
|
||||
/* The page_ref_dec() here undoes the page ref obtained in tx_sync_info_get().
|
||||
* Page refs obtained for the DUMP WQEs above (by page_ref_add) will be
|
||||
* released only upon their completions (or in mlx5e_free_txqsq_descs,
|
||||
* if channel closes).
|
||||
*/
|
||||
put_page(skb_frag_page(&info.frags[i]));
|
||||
page_ref_dec(skb_frag_page(&info.frags[i]));
|
||||
|
||||
return MLX5E_KTLS_SYNC_FAIL;
|
||||
}
|
||||
|
@ -4267,7 +4267,8 @@ void mlx5e_set_xdp_feature(struct net_device *netdev)
|
||||
struct mlx5e_params *params = &priv->channels.params;
|
||||
xdp_features_t val;
|
||||
|
||||
if (params->packet_merge.type != MLX5E_PACKET_MERGE_NONE) {
|
||||
if (!netdev->netdev_ops->ndo_bpf ||
|
||||
params->packet_merge.type != MLX5E_PACKET_MERGE_NONE) {
|
||||
xdp_clear_features_flag(netdev);
|
||||
return;
|
||||
}
|
||||
|
@ -36,6 +36,7 @@
|
||||
#include "en.h"
|
||||
#include "en/port.h"
|
||||
#include "eswitch.h"
|
||||
#include "lib/mlx5.h"
|
||||
|
||||
static int mlx5e_test_health_info(struct mlx5e_priv *priv)
|
||||
{
|
||||
@ -247,6 +248,9 @@ static int mlx5e_cond_loopback(struct mlx5e_priv *priv)
|
||||
if (is_mdev_switchdev_mode(priv->mdev))
|
||||
return -EOPNOTSUPP;
|
||||
|
||||
if (mlx5_get_sd(priv->mdev))
|
||||
return -EOPNOTSUPP;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -2527,8 +2527,11 @@ static void __esw_offloads_unload_rep(struct mlx5_eswitch *esw,
|
||||
struct mlx5_eswitch_rep *rep, u8 rep_type)
|
||||
{
|
||||
if (atomic_cmpxchg(&rep->rep_data[rep_type].state,
|
||||
REP_LOADED, REP_REGISTERED) == REP_LOADED)
|
||||
REP_LOADED, REP_REGISTERED) == REP_LOADED) {
|
||||
if (rep_type == REP_ETH)
|
||||
__esw_offloads_unload_rep(esw, rep, REP_IB);
|
||||
esw->offloads.rep_ops[rep_type]->unload(rep);
|
||||
}
|
||||
}
|
||||
|
||||
static void __unload_reps_all_vport(struct mlx5_eswitch *esw, u8 rep_type)
|
||||
|
@ -2105,13 +2105,22 @@ lookup_fte_locked(struct mlx5_flow_group *g,
|
||||
fte_tmp = NULL;
|
||||
goto out;
|
||||
}
|
||||
if (!fte_tmp->node.active) {
|
||||
tree_put_node(&fte_tmp->node, false);
|
||||
fte_tmp = NULL;
|
||||
goto out;
|
||||
}
|
||||
|
||||
nested_down_write_ref_node(&fte_tmp->node, FS_LOCK_CHILD);
|
||||
|
||||
if (!fte_tmp->node.active) {
|
||||
up_write_ref_node(&fte_tmp->node, false);
|
||||
|
||||
if (take_write)
|
||||
up_write_ref_node(&g->node, false);
|
||||
else
|
||||
up_read_ref_node(&g->node);
|
||||
|
||||
tree_put_node(&fte_tmp->node, false);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
out:
|
||||
if (take_write)
|
||||
up_write_ref_node(&g->node, false);
|
||||
|
@ -593,9 +593,11 @@ static void irq_pool_free(struct mlx5_irq_pool *pool)
|
||||
kvfree(pool);
|
||||
}
|
||||
|
||||
static int irq_pools_init(struct mlx5_core_dev *dev, int sf_vec, int pcif_vec)
|
||||
static int irq_pools_init(struct mlx5_core_dev *dev, int sf_vec, int pcif_vec,
|
||||
bool dynamic_vec)
|
||||
{
|
||||
struct mlx5_irq_table *table = dev->priv.irq_table;
|
||||
int sf_vec_available = sf_vec;
|
||||
int num_sf_ctrl;
|
||||
int err;
|
||||
|
||||
@ -616,6 +618,13 @@ static int irq_pools_init(struct mlx5_core_dev *dev, int sf_vec, int pcif_vec)
|
||||
num_sf_ctrl = DIV_ROUND_UP(mlx5_sf_max_functions(dev),
|
||||
MLX5_SFS_PER_CTRL_IRQ);
|
||||
num_sf_ctrl = min_t(int, MLX5_IRQ_CTRL_SF_MAX, num_sf_ctrl);
|
||||
if (!dynamic_vec && (num_sf_ctrl + 1) > sf_vec_available) {
|
||||
mlx5_core_dbg(dev,
|
||||
"Not enough IRQs for SFs control and completion pool, required=%d avail=%d\n",
|
||||
num_sf_ctrl + 1, sf_vec_available);
|
||||
return 0;
|
||||
}
|
||||
|
||||
table->sf_ctrl_pool = irq_pool_alloc(dev, pcif_vec, num_sf_ctrl,
|
||||
"mlx5_sf_ctrl",
|
||||
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)
|
||||
err = PTR_ERR(table->sf_ctrl_pool);
|
||||
goto err_pf;
|
||||
}
|
||||
/* init sf_comp_pool */
|
||||
sf_vec_available -= num_sf_ctrl;
|
||||
|
||||
/* init sf_comp_pool, remaining vectors are for the SF completions */
|
||||
table->sf_comp_pool = irq_pool_alloc(dev, pcif_vec + num_sf_ctrl,
|
||||
sf_vec - num_sf_ctrl, "mlx5_sf_comp",
|
||||
sf_vec_available, "mlx5_sf_comp",
|
||||
MLX5_EQ_SHARE_IRQ_MIN_COMP,
|
||||
MLX5_EQ_SHARE_IRQ_MAX_COMP);
|
||||
if (IS_ERR(table->sf_comp_pool)) {
|
||||
@ -715,6 +726,7 @@ int mlx5_irq_table_get_num_comp(struct mlx5_irq_table *table)
|
||||
int mlx5_irq_table_create(struct mlx5_core_dev *dev)
|
||||
{
|
||||
int num_eqs = mlx5_max_eq_cap_get(dev);
|
||||
bool dynamic_vec;
|
||||
int total_vec;
|
||||
int pcif_vec;
|
||||
int req_vec;
|
||||
@ -724,21 +736,31 @@ int mlx5_irq_table_create(struct mlx5_core_dev *dev)
|
||||
if (mlx5_core_is_sf(dev))
|
||||
return 0;
|
||||
|
||||
/* PCI PF vectors usage is limited by online cpus, device EQs and
|
||||
* PCI MSI-X capability.
|
||||
*/
|
||||
pcif_vec = MLX5_CAP_GEN(dev, num_ports) * num_online_cpus() + 1;
|
||||
pcif_vec = min_t(int, pcif_vec, num_eqs);
|
||||
pcif_vec = min_t(int, pcif_vec, pci_msix_vec_count(dev->pdev));
|
||||
|
||||
total_vec = pcif_vec;
|
||||
if (mlx5_sf_max_functions(dev))
|
||||
total_vec += MLX5_MAX_MSIX_PER_SF * mlx5_sf_max_functions(dev);
|
||||
total_vec = min_t(int, total_vec, pci_msix_vec_count(dev->pdev));
|
||||
pcif_vec = min_t(int, pcif_vec, pci_msix_vec_count(dev->pdev));
|
||||
|
||||
req_vec = pci_msix_can_alloc_dyn(dev->pdev) ? 1 : total_vec;
|
||||
n = pci_alloc_irq_vectors(dev->pdev, 1, req_vec, PCI_IRQ_MSIX);
|
||||
if (n < 0)
|
||||
return n;
|
||||
|
||||
err = irq_pools_init(dev, total_vec - pcif_vec, pcif_vec);
|
||||
/* Further limit vectors of the pools based on platform for non dynamic case */
|
||||
dynamic_vec = pci_msix_can_alloc_dyn(dev->pdev);
|
||||
if (!dynamic_vec) {
|
||||
pcif_vec = min_t(int, n, pcif_vec);
|
||||
total_vec = min_t(int, n, total_vec);
|
||||
}
|
||||
|
||||
err = irq_pools_init(dev, total_vec - pcif_vec, pcif_vec, dynamic_vec);
|
||||
if (err)
|
||||
pci_free_irq_vectors(dev->pdev);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user