Blob Blame History Raw
From e2600e33bb83fcfb5ee3505f069d5c469e1633ef Mon Sep 17 00:00:00 2001
From: Alaa Hleihel <ahleihel@redhat.com>
Date: Sun, 10 May 2020 14:52:05 -0400
Subject: [PATCH 039/312] [netdrv] net/mlx5e: Add trace point for neigh used
 value update

Message-id: <20200510145245.10054-43-ahleihel@redhat.com>
Patchwork-id: 306583
Patchwork-instance: patchwork
O-Subject: [RHEL8.3 BZ 1789378 v2 42/82] net/mlx5e: Add trace point for neigh used value update
Bugzilla: 1789378
RH-Acked-by: Kamal Heib <kheib@redhat.com>
RH-Acked-by: Jarod Wilson <jarod@redhat.com>
RH-Acked-by: Tony Camuso <tcamuso@redhat.com>
RH-Acked-by: Jonathan Toppins <jtoppins@redhat.com>

Bugzilla: http://bugzilla.redhat.com/1789378
Upstream: v5.4-rc1
Conflicts:
 - Documentation/networking/device_drivers/mellanox/mlx5.rst
   Drop changes to doc file that doesn't exist.

commit c786fe596bede275f887f212eebee74490043b84
Author: Vlad Buslov <vladbu@mellanox.com>
Date:   Tue Jun 25 22:33:15 2019 +0300

    net/mlx5e: Add trace point for neigh used value update

    Allow tracing result of neigh used value update task that is executed
    periodically on workqueue.

    Usage example:
     ># cd /sys/kernel/debug/tracing
     ># echo mlx5:mlx5e_tc_update_neigh_used_value >> set_event
     ># cat trace
        ...
        kworker/u48:4-8806  [009] ...1 55117.882428: mlx5e_tc_update_neigh_used_value:
    netdev: ens1f0 IPv4: 1.1.1.10 IPv6: ::ffff:1.1.1.10 neigh_used=1

    Added corresponding documentation in
        Documentation/networking/device-driver/mellanox/mlx5.rst

    Signed-off-by: Vlad Buslov <vladbu@mellanox.com>
    Reviewed-by: Dmytro Linkin <dmitrolin@mellanox.com>
    Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>

Signed-off-by: Alaa Hleihel <ahleihel@redhat.com>
Signed-off-by: Frantisek Hrbata <fhrbata@redhat.com>
---
 .../mellanox/mlx5/core/diag/en_tc_tracepoint.h     | 31 ++++++++++++++++++++++
 drivers/net/ethernet/mellanox/mlx5/core/en_tc.c    |  2 ++
 2 files changed, 33 insertions(+)

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
index a362100fe6d3..d4e6cfaaade3 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/diag/en_tc_tracepoint.h
+++ b/drivers/net/ethernet/mellanox/mlx5/core/diag/en_tc_tracepoint.h
@@ -10,6 +10,7 @@
 #include <linux/tracepoint.h>
 #include <linux/trace_seq.h>
 #include <net/flow_offload.h>
+#include "en_rep.h"
 
 #define __parse_action(ids, num) parse_action(p, ids, num)
 
@@ -73,6 +74,36 @@ TRACE_EVENT(mlx5e_stats_flower,
 		      )
 );
 
+TRACE_EVENT(mlx5e_tc_update_neigh_used_value,
+	    TP_PROTO(const struct mlx5e_neigh_hash_entry *nhe, bool neigh_used),
+	    TP_ARGS(nhe, neigh_used),
+	    TP_STRUCT__entry(__string(devname, nhe->m_neigh.dev->name)
+			     __array(u8, v4, 4)
+			     __array(u8, v6, 16)
+			     __field(bool, neigh_used)
+			     ),
+	    TP_fast_assign(const struct mlx5e_neigh *mn = &nhe->m_neigh;
+			struct in6_addr *pin6;
+			__be32 *p32;
+
+			__assign_str(devname, mn->dev->name);
+			__entry->neigh_used = neigh_used;
+
+			p32 = (__be32 *)__entry->v4;
+			pin6 = (struct in6_addr *)__entry->v6;
+			if (mn->family == AF_INET) {
+				*p32 = mn->dst_ip.v4;
+				ipv6_addr_set_v4mapped(*p32, pin6);
+			} else if (mn->family == AF_INET6) {
+				*pin6 = mn->dst_ip.v6;
+			}
+			),
+	    TP_printk("netdev: %s IPv4: %pI4 IPv6: %pI6c neigh_used=%d\n",
+		      __get_str(devname), __entry->v4, __entry->v6,
+		      __entry->neigh_used
+		      )
+);
+
 #endif /* _MLX5_TC_TP_ */
 
 /* This part must be outside protection */
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
index 8d0cf434d16c..31d71e1f0545 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
@@ -1536,6 +1536,8 @@ void mlx5e_tc_update_neigh_used_value(struct mlx5e_neigh_hash_entry *nhe)
 		}
 	}
 
+	trace_mlx5e_tc_update_neigh_used_value(nhe, neigh_used);
+
 	if (neigh_used) {
 		nhe->reported_lastuse = jiffies;
 
-- 
2.13.6