Skip to content

Commit cf14af1

Browse files
msanallaSaeed Mahameed
authored andcommitted
net/mlx5e: Add vnic devlink health reporter to representors
Create a new devlink health reporter for representor interface, which reports the values of representor vnic diagnostic counters when diagnosed. This patch will allow admins to monitor VF diagnostic counters through the representor-interface vnic reporter. Example of usage: $ devlink health diagnose pci/0000:08:00.0/65537 reporter vnic vNIC env counters: total_error_queues: 0 send_queue_priority_update_flow: 0 comp_eq_overrun: 0 async_eq_overrun: 0 cq_overrun: 0 invalid_command: 0 quota_exceeded_command: 0 nic_receive_steering_discard: 0 Signed-off-by: Maher Sanalla <msanalla@nvidia.com> Reviewed-by: Moshe Shemesh <moshe@nvidia.com> Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
1 parent b0bc615 commit cf14af1

3 files changed

Lines changed: 55 additions & 3 deletions

File tree

Documentation/networking/device_drivers/ethernet/mellanox/mlx5/devlink.rst

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -285,5 +285,8 @@ steering but were discarded due to a mismatch in flow table.
285285
User commands examples:
286286
- Diagnose PF/VF vnic counters
287287
$ devlink health diagnose pci/0000:82:00.1 reporter vnic
288+
- Diagnose representor vnic counters (performed by supplying devlink port of the
289+
representor, which can be obtained via devlink port command)
290+
$ devlink health diagnose pci/0000:82:00.1/65537 reporter vnic
288291

289-
NOTE: This command can run only on PF/VF ports.
292+
NOTE: This command can run over all interfaces such as PF/VF and representor ports.

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

Lines changed: 50 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@
5353
#include "lib/vxlan.h"
5454
#define CREATE_TRACE_POINTS
5555
#include "diag/en_rep_tracepoint.h"
56+
#include "diag/reporter_vnic.h"
5657
#include "en_accel/ipsec.h"
5758
#include "en/tc/int_port.h"
5859
#include "en/ptp.h"
@@ -1294,6 +1295,50 @@ static unsigned int mlx5e_ul_rep_stats_grps_num(struct mlx5e_priv *priv)
12941295
return ARRAY_SIZE(mlx5e_ul_rep_stats_grps);
12951296
}
12961297

1298+
static int
1299+
mlx5e_rep_vnic_reporter_diagnose(struct devlink_health_reporter *reporter,
1300+
struct devlink_fmsg *fmsg,
1301+
struct netlink_ext_ack *extack)
1302+
{
1303+
struct mlx5e_rep_priv *rpriv = devlink_health_reporter_priv(reporter);
1304+
struct mlx5_eswitch_rep *rep = rpriv->rep;
1305+
1306+
return mlx5_reporter_vnic_diagnose_counters(rep->esw->dev, fmsg,
1307+
rep->vport, true);
1308+
}
1309+
1310+
static const struct devlink_health_reporter_ops mlx5_rep_vnic_reporter_ops = {
1311+
.name = "vnic",
1312+
.diagnose = mlx5e_rep_vnic_reporter_diagnose,
1313+
};
1314+
1315+
static void mlx5e_rep_vnic_reporter_create(struct mlx5e_priv *priv,
1316+
struct devlink_port *dl_port)
1317+
{
1318+
struct mlx5e_rep_priv *rpriv = priv->ppriv;
1319+
struct devlink_health_reporter *reporter;
1320+
1321+
reporter = devl_port_health_reporter_create(dl_port,
1322+
&mlx5_rep_vnic_reporter_ops,
1323+
0, rpriv);
1324+
if (IS_ERR(reporter)) {
1325+
mlx5_core_err(priv->mdev,
1326+
"Failed to create representor vnic reporter, err = %ld\n",
1327+
PTR_ERR(reporter));
1328+
return;
1329+
}
1330+
1331+
rpriv->rep_vnic_reporter = reporter;
1332+
}
1333+
1334+
static void mlx5e_rep_vnic_reporter_destroy(struct mlx5e_priv *priv)
1335+
{
1336+
struct mlx5e_rep_priv *rpriv = priv->ppriv;
1337+
1338+
if (!IS_ERR_OR_NULL(rpriv->rep_vnic_reporter))
1339+
devl_health_reporter_destroy(rpriv->rep_vnic_reporter);
1340+
}
1341+
12971342
static const struct mlx5e_profile mlx5e_rep_profile = {
12981343
.init = mlx5e_init_rep,
12991344
.cleanup = mlx5e_cleanup_rep,
@@ -1394,8 +1439,10 @@ mlx5e_vport_vf_rep_load(struct mlx5_core_dev *dev, struct mlx5_eswitch_rep *rep)
13941439

13951440
dl_port = mlx5_esw_offloads_devlink_port(dev->priv.eswitch,
13961441
rpriv->rep->vport);
1397-
if (dl_port)
1442+
if (dl_port) {
13981443
SET_NETDEV_DEVLINK_PORT(netdev, dl_port);
1444+
mlx5e_rep_vnic_reporter_create(priv, dl_port);
1445+
}
13991446

14001447
err = register_netdev(netdev);
14011448
if (err) {
@@ -1408,8 +1455,8 @@ mlx5e_vport_vf_rep_load(struct mlx5_core_dev *dev, struct mlx5_eswitch_rep *rep)
14081455
return 0;
14091456

14101457
err_detach_netdev:
1458+
mlx5e_rep_vnic_reporter_destroy(priv);
14111459
mlx5e_detach_netdev(netdev_priv(netdev));
1412-
14131460
err_cleanup_profile:
14141461
priv->profile->cleanup(priv);
14151462

@@ -1458,6 +1505,7 @@ mlx5e_vport_rep_unload(struct mlx5_eswitch_rep *rep)
14581505
}
14591506

14601507
unregister_netdev(netdev);
1508+
mlx5e_rep_vnic_reporter_destroy(priv);
14611509
mlx5e_detach_netdev(priv);
14621510
priv->profile->cleanup(priv);
14631511
mlx5e_destroy_netdev(priv);

drivers/net/ethernet/mellanox/mlx5/core/en_rep.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ struct mlx5e_rep_priv {
118118
struct rtnl_link_stats64 prev_vf_vport_stats;
119119
struct mlx5_flow_handle *send_to_vport_meta_rule;
120120
struct rhashtable tc_ht;
121+
struct devlink_health_reporter *rep_vnic_reporter;
121122
};
122123

123124
static inline

0 commit comments

Comments
 (0)