summaryrefslogtreecommitdiffstats
path: root/tapset/LKET/netdev.stp
blob: 2b8acee0578b12fe2e553498bbb41b4009d6c528 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
// Copyright (C) 2005, 2006 IBM Corp.
//
// This file is part of systemtap, and is free software.  You can
// redistribute it and/or modify it under the terms of the GNU General
// Public License (GPL); either version 2, or (at your option) any
// later version

%{
#include <linux/netdevice.h>
%}

probe addevent.netdev
	= addevent.netdev.receive,
	addevent.netdev.transmit
{}

/* Main device receive routine, be called when packet arrives on network device */
probe addevent.netdev.receive
	+= _addevent.netdev.receive
{
	update_record()
}

probe _addevent.netdev.receive
	=  netdev.receive
{
	/* no need to filter by pid */
	log_netdev_extra(HOOKID_NETDEV_RECEIVE,$skb)
}

/* Queue a buffer for transmission to a network device */
probe addevent.netdev.transmit
	+= _addevent.netdev.transmit
{
	update_record()
}

probe _addevent.netdev.transmit
	=  netdev.transmit
{
	log_netdev_extra(HOOKID_NETDEV_TRANSMIT, $skb)
}

function log_netdev_extra(var_id:long, var:long)
%{
	struct sk_buff *skb = (struct sk_buff *)((long)THIS->var);

	/* dev_name | Length of actual data | protocol | Buffer size 

	    skb->protocol is:
		0800    IP
		8100    802.1Q VLAN
		0001    802.3
		0002    AX.25
		0004    802.2
		8035    RARP
		0005    SNAP
		0805    X.25
		0806    ARP
		8137    IPX
		0009    Localtalk
		86DD    IPv6
	*/

	_lket_trace(_GROUP_NETDEV, THIS->var_id, "%0s%4b%2b%4b", skb->dev->name, 
		(_FMT_)skb->len, (_FMT_)skb->protocol, (_FMT_)skb->truesize);
%}