Commit b9077ef4 authored by Jakub Kicinski's avatar Jakub Kicinski

Merge tag 'mlx5-fixes-2023-08-07' of git://git.kernel.org/pub/scm/linux/kernel/git/saeed/linux

Saeed Mahameed says:

====================
mlx5 fixes 2023-08-07

This series provides bug fixes to mlx5 driver.

* tag 'mlx5-fixes-2023-08-07' of git://git.kernel.org/pub/scm/linux/kernel/git/saeed/linux:
  net/mlx5e: Add capability check for vnic counters
  net/mlx5: Reload auxiliary devices in pci error handlers
  net/mlx5: Skip clock update work when device is in error state
  net/mlx5: LAG, Check correct bucket when modifying LAG
  net/mlx5e: Unoffload post act rule when handling FIB events
  net/mlx5: Fix devlink controller number for ECVF
  net/mlx5: Allow 0 for total host VFs
  net/mlx5: Return correct EC_VF function ID
  net/mlx5: DR, Fix wrong allocation of modify hdr pattern
  net/mlx5e: TC, Fix internal port memory leak
  net/mlx5e: Take RTNL lock when needed before calling xdp_set_features()
====================

Link: https://lore.kernel.org/r/20230807212607.50883-1-saeed@kernel.orgSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parents 81f3768d 548ee049
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
/* Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES. */ /* Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES. */
#include "reporter_vnic.h" #include "reporter_vnic.h"
#include "en_stats.h"
#include "devlink.h" #include "devlink.h"
#define VNIC_ENV_GET64(vnic_env_stats, c) \ #define VNIC_ENV_GET64(vnic_env_stats, c) \
...@@ -36,55 +37,72 @@ int mlx5_reporter_vnic_diagnose_counters(struct mlx5_core_dev *dev, ...@@ -36,55 +37,72 @@ int mlx5_reporter_vnic_diagnose_counters(struct mlx5_core_dev *dev,
if (err) if (err)
return err; return err;
err = devlink_fmsg_u64_pair_put(fmsg, "total_error_queues", if (MLX5_CAP_GEN(dev, vnic_env_queue_counters)) {
VNIC_ENV_GET64(&vnic, total_error_queues)); err = devlink_fmsg_u32_pair_put(fmsg, "total_error_queues",
if (err) VNIC_ENV_GET(&vnic, total_error_queues));
return err; if (err)
return err;
err = devlink_fmsg_u64_pair_put(fmsg, "send_queue_priority_update_flow",
VNIC_ENV_GET64(&vnic, send_queue_priority_update_flow)); err = devlink_fmsg_u32_pair_put(fmsg, "send_queue_priority_update_flow",
if (err) VNIC_ENV_GET(&vnic,
return err; send_queue_priority_update_flow));
if (err)
err = devlink_fmsg_u64_pair_put(fmsg, "comp_eq_overrun", return err;
VNIC_ENV_GET64(&vnic, comp_eq_overrun)); }
if (err)
return err; if (MLX5_CAP_GEN(dev, eq_overrun_count)) {
err = devlink_fmsg_u32_pair_put(fmsg, "comp_eq_overrun",
err = devlink_fmsg_u64_pair_put(fmsg, "async_eq_overrun", VNIC_ENV_GET(&vnic, comp_eq_overrun));
VNIC_ENV_GET64(&vnic, async_eq_overrun)); if (err)
if (err) return err;
return err;
err = devlink_fmsg_u32_pair_put(fmsg, "async_eq_overrun",
err = devlink_fmsg_u64_pair_put(fmsg, "cq_overrun", VNIC_ENV_GET(&vnic, async_eq_overrun));
VNIC_ENV_GET64(&vnic, cq_overrun)); if (err)
if (err) return err;
return err; }
err = devlink_fmsg_u64_pair_put(fmsg, "invalid_command", if (MLX5_CAP_GEN(dev, vnic_env_cq_overrun)) {
VNIC_ENV_GET64(&vnic, invalid_command)); err = devlink_fmsg_u32_pair_put(fmsg, "cq_overrun",
if (err) VNIC_ENV_GET(&vnic, cq_overrun));
return err; if (err)
return err;
err = devlink_fmsg_u64_pair_put(fmsg, "quota_exceeded_command", }
VNIC_ENV_GET64(&vnic, quota_exceeded_command));
if (err) if (MLX5_CAP_GEN(dev, invalid_command_count)) {
return err; err = devlink_fmsg_u32_pair_put(fmsg, "invalid_command",
VNIC_ENV_GET(&vnic, invalid_command));
err = devlink_fmsg_u64_pair_put(fmsg, "nic_receive_steering_discard", if (err)
VNIC_ENV_GET64(&vnic, nic_receive_steering_discard)); return err;
if (err) }
return err;
if (MLX5_CAP_GEN(dev, quota_exceeded_count)) {
err = devlink_fmsg_u64_pair_put(fmsg, "generated_pkt_steering_fail", err = devlink_fmsg_u32_pair_put(fmsg, "quota_exceeded_command",
VNIC_ENV_GET64(&vnic, generated_pkt_steering_fail)); VNIC_ENV_GET(&vnic, quota_exceeded_command));
if (err) if (err)
return err; return err;
}
err = devlink_fmsg_u64_pair_put(fmsg, "handled_pkt_steering_fail",
VNIC_ENV_GET64(&vnic, handled_pkt_steering_fail)); if (MLX5_CAP_GEN(dev, nic_receive_steering_discard)) {
if (err) err = devlink_fmsg_u64_pair_put(fmsg, "nic_receive_steering_discard",
return err; VNIC_ENV_GET64(&vnic,
nic_receive_steering_discard));
if (err)
return err;
}
if (MLX5_CAP_GEN(dev, vnic_env_cnt_steering_fail)) {
err = devlink_fmsg_u64_pair_put(fmsg, "generated_pkt_steering_fail",
VNIC_ENV_GET64(&vnic,
generated_pkt_steering_fail));
if (err)
return err;
err = devlink_fmsg_u64_pair_put(fmsg, "handled_pkt_steering_fail",
VNIC_ENV_GET64(&vnic, handled_pkt_steering_fail));
if (err)
return err;
}
err = devlink_fmsg_obj_nest_end(fmsg); err = devlink_fmsg_obj_nest_end(fmsg);
if (err) if (err)
......
...@@ -1461,10 +1461,12 @@ static void mlx5e_invalidate_encap(struct mlx5e_priv *priv, ...@@ -1461,10 +1461,12 @@ static void mlx5e_invalidate_encap(struct mlx5e_priv *priv,
attr = mlx5e_tc_get_encap_attr(flow); attr = mlx5e_tc_get_encap_attr(flow);
esw_attr = attr->esw_attr; esw_attr = attr->esw_attr;
if (flow_flag_test(flow, SLOW)) if (flow_flag_test(flow, SLOW)) {
mlx5e_tc_unoffload_from_slow_path(esw, flow); mlx5e_tc_unoffload_from_slow_path(esw, flow);
else } else {
mlx5e_tc_unoffload_fdb_rules(esw, flow, flow->attr); mlx5e_tc_unoffload_fdb_rules(esw, flow, flow->attr);
mlx5e_tc_unoffload_flow_post_acts(flow);
}
mlx5e_tc_detach_mod_hdr(priv, flow, attr); mlx5e_tc_detach_mod_hdr(priv, flow, attr);
attr->modify_hdr = NULL; attr->modify_hdr = NULL;
......
...@@ -5266,6 +5266,7 @@ void mlx5e_destroy_q_counters(struct mlx5e_priv *priv) ...@@ -5266,6 +5266,7 @@ void mlx5e_destroy_q_counters(struct mlx5e_priv *priv)
static int mlx5e_nic_init(struct mlx5_core_dev *mdev, static int mlx5e_nic_init(struct mlx5_core_dev *mdev,
struct net_device *netdev) struct net_device *netdev)
{ {
const bool take_rtnl = netdev->reg_state == NETREG_REGISTERED;
struct mlx5e_priv *priv = netdev_priv(netdev); struct mlx5e_priv *priv = netdev_priv(netdev);
struct mlx5e_flow_steering *fs; struct mlx5e_flow_steering *fs;
int err; int err;
...@@ -5294,9 +5295,19 @@ static int mlx5e_nic_init(struct mlx5_core_dev *mdev, ...@@ -5294,9 +5295,19 @@ static int mlx5e_nic_init(struct mlx5_core_dev *mdev,
mlx5_core_err(mdev, "TLS initialization failed, %d\n", err); mlx5_core_err(mdev, "TLS initialization failed, %d\n", err);
mlx5e_health_create_reporters(priv); mlx5e_health_create_reporters(priv);
/* If netdev is already registered (e.g. move from uplink to nic profile),
* RTNL lock must be held before triggering netdev notifiers.
*/
if (take_rtnl)
rtnl_lock();
/* update XDP supported features */ /* update XDP supported features */
mlx5e_set_xdp_feature(netdev); mlx5e_set_xdp_feature(netdev);
if (take_rtnl)
rtnl_unlock();
return 0; return 0;
} }
......
...@@ -1943,9 +1943,7 @@ static void mlx5e_tc_del_fdb_flow(struct mlx5e_priv *priv, ...@@ -1943,9 +1943,7 @@ static void mlx5e_tc_del_fdb_flow(struct mlx5e_priv *priv,
{ {
struct mlx5_eswitch *esw = priv->mdev->priv.eswitch; struct mlx5_eswitch *esw = priv->mdev->priv.eswitch;
struct mlx5_flow_attr *attr = flow->attr; struct mlx5_flow_attr *attr = flow->attr;
struct mlx5_esw_flow_attr *esw_attr;
esw_attr = attr->esw_attr;
mlx5e_put_flow_tunnel_id(flow); mlx5e_put_flow_tunnel_id(flow);
remove_unready_flow(flow); remove_unready_flow(flow);
...@@ -1966,12 +1964,6 @@ static void mlx5e_tc_del_fdb_flow(struct mlx5e_priv *priv, ...@@ -1966,12 +1964,6 @@ static void mlx5e_tc_del_fdb_flow(struct mlx5e_priv *priv,
mlx5_tc_ct_match_del(get_ct_priv(priv), &flow->attr->ct_attr); mlx5_tc_ct_match_del(get_ct_priv(priv), &flow->attr->ct_attr);
if (esw_attr->int_port)
mlx5e_tc_int_port_put(mlx5e_get_int_port_priv(priv), esw_attr->int_port);
if (esw_attr->dest_int_port)
mlx5e_tc_int_port_put(mlx5e_get_int_port_priv(priv), esw_attr->dest_int_port);
if (flow_flag_test(flow, L3_TO_L2_DECAP)) if (flow_flag_test(flow, L3_TO_L2_DECAP))
mlx5e_detach_decap(priv, flow); mlx5e_detach_decap(priv, flow);
...@@ -4268,6 +4260,7 @@ static void ...@@ -4268,6 +4260,7 @@ static void
mlx5_free_flow_attr_actions(struct mlx5e_tc_flow *flow, struct mlx5_flow_attr *attr) mlx5_free_flow_attr_actions(struct mlx5e_tc_flow *flow, struct mlx5_flow_attr *attr)
{ {
struct mlx5_core_dev *counter_dev = get_flow_counter_dev(flow); struct mlx5_core_dev *counter_dev = get_flow_counter_dev(flow);
struct mlx5_esw_flow_attr *esw_attr;
if (!attr) if (!attr)
return; return;
...@@ -4285,6 +4278,18 @@ mlx5_free_flow_attr_actions(struct mlx5e_tc_flow *flow, struct mlx5_flow_attr *a ...@@ -4285,6 +4278,18 @@ mlx5_free_flow_attr_actions(struct mlx5e_tc_flow *flow, struct mlx5_flow_attr *a
mlx5e_tc_detach_mod_hdr(flow->priv, flow, attr); mlx5e_tc_detach_mod_hdr(flow->priv, flow, attr);
} }
if (mlx5e_is_eswitch_flow(flow)) {
esw_attr = attr->esw_attr;
if (esw_attr->int_port)
mlx5e_tc_int_port_put(mlx5e_get_int_port_priv(flow->priv),
esw_attr->int_port);
if (esw_attr->dest_int_port)
mlx5e_tc_int_port_put(mlx5e_get_int_port_priv(flow->priv),
esw_attr->dest_int_port);
}
mlx5_tc_ct_delete_flow(get_ct_priv(flow->priv), attr); mlx5_tc_ct_delete_flow(get_ct_priv(flow->priv), attr);
free_branch_attr(flow, attr->branch_true); free_branch_attr(flow, attr->branch_true);
......
...@@ -60,7 +60,7 @@ static struct devlink_port *mlx5_esw_dl_port_alloc(struct mlx5_eswitch *esw, u16 ...@@ -60,7 +60,7 @@ static struct devlink_port *mlx5_esw_dl_port_alloc(struct mlx5_eswitch *esw, u16
} else if (mlx5_core_is_ec_vf_vport(esw->dev, vport_num)) { } else if (mlx5_core_is_ec_vf_vport(esw->dev, vport_num)) {
memcpy(dl_port->attrs.switch_id.id, ppid.id, ppid.id_len); memcpy(dl_port->attrs.switch_id.id, ppid.id, ppid.id_len);
dl_port->attrs.switch_id.id_len = ppid.id_len; dl_port->attrs.switch_id.id_len = ppid.id_len;
devlink_port_attrs_pci_vf_set(dl_port, controller_num, pfnum, devlink_port_attrs_pci_vf_set(dl_port, 0, pfnum,
vport_num - 1, false); vport_num - 1, false);
} }
return dl_port; return dl_port;
......
...@@ -574,7 +574,7 @@ static int __mlx5_lag_modify_definers_destinations(struct mlx5_lag *ldev, ...@@ -574,7 +574,7 @@ static int __mlx5_lag_modify_definers_destinations(struct mlx5_lag *ldev,
for (i = 0; i < ldev->ports; i++) { for (i = 0; i < ldev->ports; i++) {
for (j = 0; j < ldev->buckets; j++) { for (j = 0; j < ldev->buckets; j++) {
idx = i * ldev->buckets + j; idx = i * ldev->buckets + j;
if (ldev->v2p_map[i] == ports[i]) if (ldev->v2p_map[idx] == ports[idx])
continue; continue;
dest.vport.vhca_id = MLX5_CAP_GEN(ldev->pf[ports[idx] - 1].dev, dest.vport.vhca_id = MLX5_CAP_GEN(ldev->pf[ports[idx] - 1].dev,
......
...@@ -227,10 +227,15 @@ static void mlx5_timestamp_overflow(struct work_struct *work) ...@@ -227,10 +227,15 @@ static void mlx5_timestamp_overflow(struct work_struct *work)
clock = container_of(timer, struct mlx5_clock, timer); clock = container_of(timer, struct mlx5_clock, timer);
mdev = container_of(clock, struct mlx5_core_dev, clock); mdev = container_of(clock, struct mlx5_core_dev, clock);
if (mdev->state == MLX5_DEVICE_STATE_INTERNAL_ERROR)
goto out;
write_seqlock_irqsave(&clock->lock, flags); write_seqlock_irqsave(&clock->lock, flags);
timecounter_read(&timer->tc); timecounter_read(&timer->tc);
mlx5_update_clock_info_page(mdev); mlx5_update_clock_info_page(mdev);
write_sequnlock_irqrestore(&clock->lock, flags); write_sequnlock_irqrestore(&clock->lock, flags);
out:
schedule_delayed_work(&timer->overflow_work, timer->overflow_period); schedule_delayed_work(&timer->overflow_work, timer->overflow_period);
} }
......
...@@ -1989,7 +1989,7 @@ static pci_ers_result_t mlx5_pci_err_detected(struct pci_dev *pdev, ...@@ -1989,7 +1989,7 @@ static pci_ers_result_t mlx5_pci_err_detected(struct pci_dev *pdev,
mlx5_enter_error_state(dev, false); mlx5_enter_error_state(dev, false);
mlx5_error_sw_reset(dev); mlx5_error_sw_reset(dev);
mlx5_unload_one(dev, true); mlx5_unload_one(dev, false);
mlx5_drain_health_wq(dev); mlx5_drain_health_wq(dev);
mlx5_pci_disable_device(dev); mlx5_pci_disable_device(dev);
......
...@@ -361,7 +361,7 @@ static inline bool mlx5_core_is_ec_vf_vport(const struct mlx5_core_dev *dev, u16 ...@@ -361,7 +361,7 @@ static inline bool mlx5_core_is_ec_vf_vport(const struct mlx5_core_dev *dev, u16
static inline int mlx5_vport_to_func_id(const struct mlx5_core_dev *dev, u16 vport, bool ec_vf_func) static inline int mlx5_vport_to_func_id(const struct mlx5_core_dev *dev, u16 vport, bool ec_vf_func)
{ {
return ec_vf_func ? vport - mlx5_core_ec_vf_vport_base(dev) return ec_vf_func ? vport - mlx5_core_ec_vf_vport_base(dev) + 1
: vport; : vport;
} }
......
...@@ -285,8 +285,7 @@ static u16 mlx5_get_max_vfs(struct mlx5_core_dev *dev) ...@@ -285,8 +285,7 @@ static u16 mlx5_get_max_vfs(struct mlx5_core_dev *dev)
host_total_vfs = MLX5_GET(query_esw_functions_out, out, host_total_vfs = MLX5_GET(query_esw_functions_out, out,
host_params_context.host_total_vfs); host_params_context.host_total_vfs);
kvfree(out); kvfree(out);
if (host_total_vfs) return host_total_vfs;
return host_total_vfs;
} }
done: done:
......
...@@ -82,7 +82,7 @@ dr_ptrn_alloc_pattern(struct mlx5dr_ptrn_mgr *mgr, ...@@ -82,7 +82,7 @@ dr_ptrn_alloc_pattern(struct mlx5dr_ptrn_mgr *mgr,
u32 chunk_size; u32 chunk_size;
u32 index; u32 index;
chunk_size = ilog2(num_of_actions); chunk_size = ilog2(roundup_pow_of_two(num_of_actions));
/* HW modify action index granularity is at least 64B */ /* HW modify action index granularity is at least 64B */
chunk_size = max_t(u32, chunk_size, DR_CHUNK_SIZE_8); chunk_size = max_t(u32, chunk_size, DR_CHUNK_SIZE_8);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment