Blame SOURCES/0039-netdrv-net-mlx5e-Add-trace-point-for-neigh-used-valu.patch

d8f823
From e2600e33bb83fcfb5ee3505f069d5c469e1633ef Mon Sep 17 00:00:00 2001
d8f823
From: Alaa Hleihel <ahleihel@redhat.com>
d8f823
Date: Sun, 10 May 2020 14:52:05 -0400
d8f823
Subject: [PATCH 039/312] [netdrv] net/mlx5e: Add trace point for neigh used
d8f823
 value update
d8f823
d8f823
Message-id: <20200510145245.10054-43-ahleihel@redhat.com>
d8f823
Patchwork-id: 306583
d8f823
Patchwork-instance: patchwork
d8f823
O-Subject: [RHEL8.3 BZ 1789378 v2 42/82] net/mlx5e: Add trace point for neigh used value 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 c786fe596bede275f887f212eebee74490043b84
d8f823
Author: Vlad Buslov <vladbu@mellanox.com>
d8f823
Date:   Tue Jun 25 22:33:15 2019 +0300
d8f823
d8f823
    net/mlx5e: Add trace point for neigh used value update
d8f823
d8f823
    Allow tracing result of neigh used value update task that is executed
d8f823
    periodically on workqueue.
d8f823
d8f823
    Usage example:
d8f823
     ># cd /sys/kernel/debug/tracing
d8f823
     ># echo mlx5:mlx5e_tc_update_neigh_used_value >> set_event
d8f823
     ># cat trace
d8f823
        ...
d8f823
        kworker/u48:4-8806  [009] ...1 55117.882428: mlx5e_tc_update_neigh_used_value:
d8f823
    netdev: ens1f0 IPv4: 1.1.1.10 IPv6: ::ffff:1.1.1.10 neigh_used=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_tc_tracepoint.h     | 31 ++++++++++++++++++++++
d8f823
 drivers/net/ethernet/mellanox/mlx5/core/en_tc.c    |  2 ++
d8f823
 2 files changed, 33 insertions(+)
d8f823
d8f823
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/diag/en_tc_tracepoint.h b/drivers/net/ethernet/mellanox/mlx5/core/diag/en_tc_tracepoint.h
d8f823
index a362100fe6d3..d4e6cfaaade3 100644
d8f823
--- a/drivers/net/ethernet/mellanox/mlx5/core/diag/en_tc_tracepoint.h
d8f823
+++ b/drivers/net/ethernet/mellanox/mlx5/core/diag/en_tc_tracepoint.h
d8f823
@@ -10,6 +10,7 @@
d8f823
 #include <linux/tracepoint.h>
d8f823
 #include <linux/trace_seq.h>
d8f823
 #include <net/flow_offload.h>
d8f823
+#include "en_rep.h"
d8f823
 
d8f823
 #define __parse_action(ids, num) parse_action(p, ids, num)
d8f823
 
d8f823
@@ -73,6 +74,36 @@ TRACE_EVENT(mlx5e_stats_flower,
d8f823
 		      )
d8f823
 );
d8f823
 
d8f823
+TRACE_EVENT(mlx5e_tc_update_neigh_used_value,
d8f823
+	    TP_PROTO(const struct mlx5e_neigh_hash_entry *nhe, bool neigh_used),
d8f823
+	    TP_ARGS(nhe, neigh_used),
d8f823
+	    TP_STRUCT__entry(__string(devname, nhe->m_neigh.dev->name)
d8f823
+			     __array(u8, v4, 4)
d8f823
+			     __array(u8, v6, 16)
d8f823
+			     __field(bool, neigh_used)
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_used = neigh_used;
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 IPv4: %pI4 IPv6: %pI6c neigh_used=%d\n",
d8f823
+		      __get_str(devname), __entry->v4, __entry->v6,
d8f823
+		      __entry->neigh_used
d8f823
+		      )
d8f823
+);
d8f823
+
d8f823
 #endif /* _MLX5_TC_TP_ */
d8f823
 
d8f823
 /* This part must be outside protection */
d8f823
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
d8f823
index 8d0cf434d16c..31d71e1f0545 100644
d8f823
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
d8f823
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
d8f823
@@ -1536,6 +1536,8 @@ void mlx5e_tc_update_neigh_used_value(struct mlx5e_neigh_hash_entry *nhe)
d8f823
 		}
d8f823
 	}
d8f823
 
d8f823
+	trace_mlx5e_tc_update_neigh_used_value(nhe, neigh_used);
d8f823
+
d8f823
 	if (neigh_used) {
d8f823
 		nhe->reported_lastuse = jiffies;
d8f823
 
d8f823
-- 
d8f823
2.13.6
d8f823