root/include/trace/events/fib.h

/* [<][>][^][v][top][bottom][index][help] */

INCLUDED FROM


   1 /* SPDX-License-Identifier: GPL-2.0 */
   2 #undef TRACE_SYSTEM
   3 #define TRACE_SYSTEM fib
   4 
   5 #if !defined(_TRACE_FIB_H) || defined(TRACE_HEADER_MULTI_READ)
   6 #define _TRACE_FIB_H
   7 
   8 #include <linux/skbuff.h>
   9 #include <linux/netdevice.h>
  10 #include <net/ip_fib.h>
  11 #include <linux/tracepoint.h>
  12 
  13 TRACE_EVENT(fib_table_lookup,
  14 
  15         TP_PROTO(u32 tb_id, const struct flowi4 *flp,
  16                  const struct fib_nh_common *nhc, int err),
  17 
  18         TP_ARGS(tb_id, flp, nhc, err),
  19 
  20         TP_STRUCT__entry(
  21                 __field(        u32,    tb_id           )
  22                 __field(        int,    err             )
  23                 __field(        int,    oif             )
  24                 __field(        int,    iif             )
  25                 __field(        u8,     proto           )
  26                 __field(        __u8,   tos             )
  27                 __field(        __u8,   scope           )
  28                 __field(        __u8,   flags           )
  29                 __array(        __u8,   src,    4       )
  30                 __array(        __u8,   dst,    4       )
  31                 __array(        __u8,   gw4,    4       )
  32                 __array(        __u8,   gw6,    16      )
  33                 __field(        u16,    sport           )
  34                 __field(        u16,    dport           )
  35                 __dynamic_array(char,  name,   IFNAMSIZ )
  36         ),
  37 
  38         TP_fast_assign(
  39                 struct in6_addr in6_zero = {};
  40                 struct net_device *dev;
  41                 struct in6_addr *in6;
  42                 __be32 *p32;
  43 
  44                 __entry->tb_id = tb_id;
  45                 __entry->err = err;
  46                 __entry->oif = flp->flowi4_oif;
  47                 __entry->iif = flp->flowi4_iif;
  48                 __entry->tos = flp->flowi4_tos;
  49                 __entry->scope = flp->flowi4_scope;
  50                 __entry->flags = flp->flowi4_flags;
  51 
  52                 p32 = (__be32 *) __entry->src;
  53                 *p32 = flp->saddr;
  54 
  55                 p32 = (__be32 *) __entry->dst;
  56                 *p32 = flp->daddr;
  57 
  58                 __entry->proto = flp->flowi4_proto;
  59                 if (__entry->proto == IPPROTO_TCP ||
  60                     __entry->proto == IPPROTO_UDP) {
  61                         __entry->sport = ntohs(flp->fl4_sport);
  62                         __entry->dport = ntohs(flp->fl4_dport);
  63                 } else {
  64                         __entry->sport = 0;
  65                         __entry->dport = 0;
  66                 }
  67 
  68                 dev = nhc ? nhc->nhc_dev : NULL;
  69                 __assign_str(name, dev ? dev->name : "-");
  70 
  71                 if (nhc) {
  72                         if (nhc->nhc_gw_family == AF_INET) {
  73                                 p32 = (__be32 *) __entry->gw4;
  74                                 *p32 = nhc->nhc_gw.ipv4;
  75 
  76                                 in6 = (struct in6_addr *)__entry->gw6;
  77                                 *in6 = in6_zero;
  78                         } else if (nhc->nhc_gw_family == AF_INET6) {
  79                                 p32 = (__be32 *) __entry->gw4;
  80                                 *p32 = 0;
  81 
  82                                 in6 = (struct in6_addr *)__entry->gw6;
  83                                 *in6 = nhc->nhc_gw.ipv6;
  84                         }
  85                 } else {
  86                         p32 = (__be32 *) __entry->gw4;
  87                         *p32 = 0;
  88 
  89                         in6 = (struct in6_addr *)__entry->gw6;
  90                         *in6 = in6_zero;
  91                 }
  92         ),
  93 
  94         TP_printk("table %u oif %d iif %d proto %u %pI4/%u -> %pI4/%u tos %d scope %d flags %x ==> dev %s gw %pI4/%pI6c err %d",
  95                   __entry->tb_id, __entry->oif, __entry->iif, __entry->proto,
  96                   __entry->src, __entry->sport, __entry->dst, __entry->dport,
  97                   __entry->tos, __entry->scope, __entry->flags,
  98                   __get_str(name), __entry->gw4, __entry->gw6, __entry->err)
  99 );
 100 #endif /* _TRACE_FIB_H */
 101 
 102 /* This part must be outside protection */
 103 #include <trace/define_trace.h>

/* [<][>][^][v][top][bottom][index][help] */