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>
This commit is contained in:
Vlad Buslov 2019-06-25 22:33:15 +03:00 committed by Saeed Mahameed
parent 7a978759b4
commit c786fe596b
3 changed files with 40 additions and 0 deletions

View File

@ -251,3 +251,10 @@ tc and eswitch offloads tracepoints:
$ cat /sys/kernel/debug/tracing/trace
...
tc-6546 [010] ...1 2679.704889: mlx5e_stats_flower: cookie=0000000060eb3d6a bytes=0 packets=0 lastused=4295560217
- mlx5e_tc_update_neigh_used_value: trace tunnel rule neigh update value offloaded to mlx5::
$ echo mlx5:mlx5e_tc_update_neigh_used_value >> /sys/kernel/debug/tracing/set_event
$ cat /sys/kernel/debug/tracing/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

View File

@ -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 */

View File

@ -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;