Skip to content

Commit

Permalink
Merge branch 'mlx5-misc-fixes-2024-12-03'
Browse files Browse the repository at this point in the history
Tariq Toukan says:

====================
mlx5 misc fixes 2024-12-03

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]>
  • Loading branch information
kuba-moo committed Dec 5, 2024
2 parents 5f4d035 + 5085f86 commit 1831729
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 19 deletions.
13 changes: 11 additions & 2 deletions drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun_encap.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include <net/nexthop.h>
#include <net/ip_tunnels.h>
#include "tc_tun_encap.h"
#include "fs_core.h"
#include "en_tc.h"
#include "tc_tun.h"
#include "rep/tc.h"
Expand All @@ -24,10 +25,18 @@ static int mlx5e_set_int_port_tunnel(struct mlx5e_priv *priv,

route_dev = dev_get_by_index(dev_net(e->out_dev), e->route_dev_ifindex);

if (!route_dev || !netif_is_ovs_master(route_dev) ||
attr->parse_attr->filter_dev == e->out_dev)
if (!route_dev || !netif_is_ovs_master(route_dev))
goto out;

if (priv->mdev->priv.steering->mode == MLX5_FLOW_STEERING_MODE_DMFS &&
mlx5e_eswitch_uplink_rep(attr->parse_attr->filter_dev) &&
(attr->esw_attr->dests[out_index].flags & MLX5_ESW_DEST_ENCAP)) {
mlx5_core_warn(priv->mdev,
"Matching on external port with encap + fwd to table actions is not allowed for firmware steering\n");
err = -EINVAL;
goto out;
}

err = mlx5e_set_fwd_to_int_port_actions(priv, attr, e->route_dev_ifindex,
MLX5E_TC_INT_PORT_EGRESS,
&attr->action, out_index);
Expand Down
32 changes: 17 additions & 15 deletions drivers/net/ethernet/mellanox/mlx5/core/en_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -2680,11 +2680,11 @@ void mlx5e_trigger_napi_sched(struct napi_struct *napi)

static int mlx5e_open_channel(struct mlx5e_priv *priv, int ix,
struct mlx5e_params *params,
struct mlx5e_channel_param *cparam,
struct xsk_buff_pool *xsk_pool,
struct mlx5e_channel **cp)
{
struct net_device *netdev = priv->netdev;
struct mlx5e_channel_param *cparam;
struct mlx5_core_dev *mdev;
struct mlx5e_xsk_param xsk;
struct mlx5e_channel *c;
Expand All @@ -2706,8 +2706,15 @@ static int mlx5e_open_channel(struct mlx5e_priv *priv, int ix,
return err;

c = kvzalloc_node(sizeof(*c), GFP_KERNEL, cpu_to_node(cpu));
if (!c)
return -ENOMEM;
cparam = kvzalloc(sizeof(*cparam), GFP_KERNEL);
if (!c || !cparam) {
err = -ENOMEM;
goto err_free;
}

err = mlx5e_build_channel_param(mdev, params, cparam);
if (err)
goto err_free;

c->priv = priv;
c->mdev = mdev;
Expand Down Expand Up @@ -2741,6 +2748,7 @@ static int mlx5e_open_channel(struct mlx5e_priv *priv, int ix,

*cp = c;

kvfree(cparam);
return 0;

err_close_queues:
Expand All @@ -2749,6 +2757,8 @@ static int mlx5e_open_channel(struct mlx5e_priv *priv, int ix,
err_napi_del:
netif_napi_del(&c->napi);

err_free:
kvfree(cparam);
kvfree(c);

return err;
Expand Down Expand Up @@ -2807,28 +2817,22 @@ static void mlx5e_close_channel(struct mlx5e_channel *c)
int mlx5e_open_channels(struct mlx5e_priv *priv,
struct mlx5e_channels *chs)
{
struct mlx5e_channel_param *cparam;
int err = -ENOMEM;
int i;

chs->num = chs->params.num_channels;

chs->c = kcalloc(chs->num, sizeof(struct mlx5e_channel *), GFP_KERNEL);
cparam = kvzalloc(sizeof(struct mlx5e_channel_param), GFP_KERNEL);
if (!chs->c || !cparam)
goto err_free;

err = mlx5e_build_channel_param(priv->mdev, &chs->params, cparam);
if (err)
goto err_free;
if (!chs->c)
goto err_out;

for (i = 0; i < chs->num; i++) {
struct xsk_buff_pool *xsk_pool = NULL;

if (chs->params.xdp_prog)
xsk_pool = mlx5e_xsk_get_pool(&chs->params, chs->params.xsk, i);

err = mlx5e_open_channel(priv, i, &chs->params, cparam, xsk_pool, &chs->c[i]);
err = mlx5e_open_channel(priv, i, &chs->params, xsk_pool, &chs->c[i]);
if (err)
goto err_close_channels;
}
Expand All @@ -2846,7 +2850,6 @@ int mlx5e_open_channels(struct mlx5e_priv *priv,
}

mlx5e_health_channels_update(priv);
kvfree(cparam);
return 0;

err_close_ptp:
Expand All @@ -2857,9 +2860,8 @@ int mlx5e_open_channels(struct mlx5e_priv *priv,
for (i--; i >= 0; i--)
mlx5e_close_channel(chs->c[i]);

err_free:
kfree(chs->c);
kvfree(cparam);
err_out:
chs->num = 0;
return err;
}
Expand Down
5 changes: 3 additions & 2 deletions drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c
Original file line number Diff line number Diff line change
Expand Up @@ -2335,9 +2335,10 @@ static int esw_create_restore_table(struct mlx5_eswitch *esw)
static void esw_mode_change(struct mlx5_eswitch *esw, u16 mode)
{
mlx5_devcom_comp_lock(esw->dev->priv.hca_devcom_comp);

if (esw->dev->priv.flags & MLX5_PRIV_FLAGS_DISABLE_IB_ADEV) {
if (esw->dev->priv.flags & MLX5_PRIV_FLAGS_DISABLE_IB_ADEV ||
mlx5_core_mp_enabled(esw->dev)) {
esw->mode = mode;
mlx5_rescan_drivers_locked(esw->dev);
mlx5_devcom_comp_unlock(esw->dev->priv.hca_devcom_comp);
return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ bool mlx5hws_bwc_match_params_is_complex(struct mlx5hws_context *ctx,
} else {
mlx5hws_err(ctx, "Failed to calculate matcher definer layout\n");
}
} else {
kfree(mt->fc);
}

mlx5hws_match_template_destroy(mt);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -990,6 +990,7 @@ static int hws_bwc_send_queues_init(struct mlx5hws_context *ctx)
for (i = 0; i < bwc_queues; i++) {
mutex_init(&ctx->bwc_send_queue_locks[i]);
lockdep_register_key(ctx->bwc_lock_class_keys + i);
lockdep_set_class(ctx->bwc_send_queue_locks + i, ctx->bwc_lock_class_keys + i);
}

return 0;
Expand Down

0 comments on commit 1831729

Please sign in to comment.