Blame SOURCES/0040-netdrv-net-mlx5e-Add-trace-point-for-neigh-update.patch

d8f823
From 94744255e69bab4bcd94627d5255f75bc71f09e0 Mon Sep 17 00:00:00 2001
d8f823
From: Alaa Hleihel <ahleihel@redhat.com>
d8f823
Date: Sun, 10 May 2020 14:52:06 -0400
d8f823
Subject: [PATCH 040/312] [netdrv] net/mlx5e: Add trace point for neigh update
d8f823
d8f823
Message-id: <20200510145245.10054-44-ahleihel@redhat.com>
d8f823
Patchwork-id: 306584
d8f823
Patchwork-instance: patchwork
d8f823
O-Subject: [RHEL8.3 BZ 1789378 v2 43/82] net/mlx5e: Add trace point for neigh update
d8f823
Bugzilla: 1789378
d8f823
RH-Acked-by: Kamal Heib <kheib@redhat.com>
d8f823
RH-Acked-by: Jarod Wilson <jarod@redhat.com>
d8f823
RH-Acked-by: Tony Camuso <tcamuso@redhat.com>
d8f823
RH-Acked-by: Jonathan Toppins <jtoppins@redhat.com>
d8f823
d8f823
Bugzilla: http://bugzilla.redhat.com/1789378
d8f823
Upstream: v5.4-rc1
d8f823
Conflicts:
d8f823
 - Documentation/networking/device_drivers/mellanox/mlx5.rst
d8f823
   Drop changes to doc file that doesn't exist.
d8f823
d8f823
commit 5970882a2510e8bffaef518a82ea207798187a93
d8f823
Author: Vlad Buslov <vladbu@mellanox.com>
d8f823
Date:   Tue Jun 25 22:40:20 2019 +0300
d8f823
d8f823
    net/mlx5e: Add trace point for neigh update
d8f823
d8f823
    Allow tracing neigh state during neigh update task that is executed on
d8f823
    workqueue and is scheduled by neigh state change event.
d8f823
d8f823
    Usage example:
d8f823
     ># cd /sys/kernel/debug/tracing
d8f823
     ># echo mlx5:mlx5e_rep_neigh_update >> set_event
d8f823
     ># cat trace
d8f823
        ...
d8f823
        kworker/u48:7-2221  [009] ...1  1475.387435: mlx5e_rep_neigh_update:
d8f823
    netdev: ens1f0 MAC: 24:8a:07:9a:17:9a IPv4: 1.1.1.10 IPv6: ::ffff:1.1.1.10 neigh_connected=1
d8f823
d8f823
    Added corresponding documentation in
d8f823
        Documentation/networking/device-driver/mellanox/mlx5.rst
d8f823
d8f823
    Signed-off-by: Vlad Buslov <vladbu@mellanox.com>
d8f823
    Reviewed-by: Dmytro Linkin <dmitrolin@mellanox.com>
d8f823
    Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
d8f823
d8f823
Signed-off-by: Alaa Hleihel <ahleihel@redhat.com>
d8f823
Signed-off-by: Frantisek Hrbata <fhrbata@redhat.com>
d8f823
---
d8f823
 .../mellanox/mlx5/core/diag/en_rep_tracepoint.h    | 54 ++++++++++++++++++++++
d8f823
 drivers/net/ethernet/mellanox/mlx5/core/en_rep.c   |  4 ++
d8f823
 2 files changed, 58 insertions(+)
d8f823
 create mode 100644 drivers/net/ethernet/mellanox/mlx5/core/diag/en_rep_tracepoint.h
d8f823
d8f823
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/diag/en_rep_tracepoint.h b/drivers/net/ethernet/mellanox/mlx5/core/diag/en_rep_tracepoint.h
d8f823
new file mode 100644
d8f823
index 000000000000..1177860a2ee4
d8f823
--- /dev/null
d8f823
+++ b/drivers/net/ethernet/mellanox/mlx5/core/diag/en_rep_tracepoint.h
d8f823
@@ -0,0 +1,54 @@
d8f823
+/* SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB */
d8f823
+/* Copyright (c) 2019 Mellanox Technologies. */
d8f823
+
d8f823
+#undef TRACE_SYSTEM
d8f823
+#define TRACE_SYSTEM mlx5
d8f823
+
d8f823
+#if !defined(_MLX5_EN_REP_TP_) || defined(TRACE_HEADER_MULTI_READ)
d8f823
+#define _MLX5_EN_REP_TP_
d8f823
+
d8f823
+#include <linux/tracepoint.h>
d8f823
+#include <linux/trace_seq.h>
d8f823
+#include "en_rep.h"
d8f823
+
d8f823
+TRACE_EVENT(mlx5e_rep_neigh_update,
d8f823
+	    TP_PROTO(const struct mlx5e_neigh_hash_entry *nhe, const u8 *ha,
d8f823
+		     bool neigh_connected),
d8f823
+	    TP_ARGS(nhe, ha, neigh_connected),
d8f823
+	    TP_STRUCT__entry(__string(devname, nhe->m_neigh.dev->name)
d8f823
+			     __array(u8, ha, ETH_ALEN)
d8f823
+			     __array(u8, v4, 4)
d8f823
+			     __array(u8, v6, 16)
d8f823
+			     __field(bool, neigh_connected)
d8f823
+			     ),
d8f823
+	    TP_fast_assign(const struct mlx5e_neigh *mn = &nhe->m_neigh;
d8f823
+			struct in6_addr *pin6;
d8f823
+			__be32 *p32;
d8f823
+
d8f823
+			__assign_str(devname, mn->dev->name);
d8f823
+			__entry->neigh_connected = neigh_connected;
d8f823
+			memcpy(__entry->ha, ha, ETH_ALEN);
d8f823
+
d8f823
+			p32 = (__be32 *)__entry->v4;
d8f823
+			pin6 = (struct in6_addr *)__entry->v6;
d8f823
+			if (mn->family == AF_INET) {
d8f823
+				*p32 = mn->dst_ip.v4;
d8f823
+				ipv6_addr_set_v4mapped(*p32, pin6);
d8f823
+			} else if (mn->family == AF_INET6) {
d8f823
+				*pin6 = mn->dst_ip.v6;
d8f823
+			}
d8f823
+			),
d8f823
+	    TP_printk("netdev: %s MAC: %pM IPv4: %pI4 IPv6: %pI6c neigh_connected=%d\n",
d8f823
+		      __get_str(devname), __entry->ha,
d8f823
+		      __entry->v4, __entry->v6, __entry->neigh_connected
d8f823
+		      )
d8f823
+);
d8f823
+
d8f823
+#endif /* _MLX5_EN_REP_TP_ */
d8f823
+
d8f823
+/* This part must be outside protection */
d8f823
+#undef TRACE_INCLUDE_PATH
d8f823
+#define TRACE_INCLUDE_PATH ./diag
d8f823
+#undef TRACE_INCLUDE_FILE
d8f823
+#define TRACE_INCLUDE_FILE en_rep_tracepoint
d8f823
+#include <trace/define_trace.h>
d8f823
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c b/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c
d8f823
index 66c8c2ace4b9..037983a8f149 100644
d8f823
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c
d8f823
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c
d8f823
@@ -46,6 +46,8 @@
d8f823
 #include "en/tc_tun.h"
d8f823
 #include "fs_core.h"
d8f823
 #include "lib/port_tun.h"
d8f823
+#define CREATE_TRACE_POINTS
d8f823
+#include "diag/en_rep_tracepoint.h"
d8f823
 
d8f823
 #define MLX5E_REP_PARAMS_DEF_LOG_SQ_SIZE \
d8f823
 	max(0x7, MLX5E_PARAMS_MINIMUM_LOG_SQ_SIZE)
d8f823
@@ -633,6 +635,8 @@ static void mlx5e_rep_neigh_update(struct work_struct *work)
d8f823
 
d8f823
 	neigh_connected = (nud_state & NUD_VALID) && !dead;
d8f823
 
d8f823
+	trace_mlx5e_rep_neigh_update(nhe, ha, neigh_connected);
d8f823
+
d8f823
 	list_for_each_entry(e, &nhe->encap_list, encap_list) {
d8f823
 		if (!mlx5e_encap_take(e))
d8f823
 			continue;
d8f823
-- 
d8f823
2.13.6
d8f823