diff options
author | Avik Sil <avik.sil@linaro.org> | 2011-03-31 11:06:38 +0000 |
---|---|---|
committer | Avik Sil <avik.sil@linaro.org> | 2011-03-31 11:06:38 +0000 |
commit | ebb688e3183bd5891312bdb8f4e2f520d70b36b6 (patch) | |
tree | c30d1abefaccc8cd1baa4944aae3348668e13bde /net | |
parent | 8061f3a885ec3538bf405ff3957c205b1ab2aae4 (diff) | |
parent | b2afcd30fff4c24290a63a2497de301864d9726d (diff) |
Merge remote branch 'lttng/2.6.38-lttng-0.247'
Conflicts:
arch/arm/kernel/traps.c
arch/arm/mach-omap2/clock34xx.c
arch/arm/mach-omap2/pm34xx.c
Diffstat (limited to 'net')
-rw-r--r-- | net/core/dev.c | 18 | ||||
-rw-r--r-- | net/ipv4/devinet.c | 6 | ||||
-rw-r--r-- | net/ipv4/tcp_ipv4.c | 6 | ||||
-rw-r--r-- | net/ipv4/udp.c | 5 | ||||
-rw-r--r-- | net/ipv6/addrconf.c | 7 | ||||
-rw-r--r-- | net/socket.c | 77 |
6 files changed, 102 insertions, 17 deletions
diff --git a/net/core/dev.c b/net/core/dev.c index 6561021d22d..0da7f14823c 100644 --- a/net/core/dev.c +++ b/net/core/dev.c @@ -132,6 +132,7 @@ #include <trace/events/skb.h> #include <linux/pci.h> #include <linux/inetdevice.h> +#include <trace/net.h> #include "net-sysfs.h" @@ -198,6 +199,13 @@ static struct list_head ptype_all __read_mostly; /* Taps */ DEFINE_RWLOCK(dev_base_lock); EXPORT_SYMBOL(dev_base_lock); +DEFINE_TRACE(lttng_net_dev_xmit); +DEFINE_TRACE(lttng_net_dev_receive); +DEFINE_TRACE(net_napi_schedule); +DEFINE_TRACE(net_napi_poll); +DEFINE_TRACE(net_napi_complete); +EXPORT_TRACEPOINT_SYMBOL_GPL(net_napi_complete); + static inline struct hlist_head *dev_name_hash(struct net *net, const char *name) { unsigned hash = full_name_hash(name, strnlen(name, IFNAMSIZ)); @@ -2119,6 +2127,7 @@ int dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev, } } + trace_lttng_net_dev_xmit(skb); rc = ops->ndo_start_xmit(skb, dev); trace_net_dev_xmit(skb, rc); if (rc == NETDEV_TX_OK) @@ -2140,6 +2149,7 @@ gso: if (dev->priv_flags & IFF_XMIT_DST_RELEASE) skb_dst_drop(nskb); + trace_lttng_net_dev_xmit(nskb); rc = ops->ndo_start_xmit(nskb, dev); trace_net_dev_xmit(nskb, rc); if (unlikely(rc != NETDEV_TX_OK)) { @@ -2741,6 +2751,8 @@ int netif_rx(struct sk_buff *skb) if (netpoll_rx(skb)) return NET_RX_DROP; + trace_lttng_net_dev_receive(skb); + if (netdev_tstamp_prequeue) net_timestamp_check(skb); @@ -3174,6 +3186,8 @@ int netif_receive_skb(struct sk_buff *skb) if (skb_defer_rx_timestamp(skb)) return NET_RX_SUCCESS; + trace_lttng_net_dev_receive(skb); + #ifdef CONFIG_RPS { struct rps_dev_flow voidflow, *rflow = &voidflow; @@ -3625,6 +3639,8 @@ void __napi_schedule(struct napi_struct *n) { unsigned long flags; + trace_net_napi_schedule(n); + local_irq_save(flags); ____napi_schedule(&__get_cpu_var(softnet_data), n); local_irq_restore(flags); @@ -3639,6 +3655,7 @@ void __napi_complete(struct napi_struct *n) list_del(&n->poll_list); smp_mb__before_clear_bit(); clear_bit(NAPI_STATE_SCHED, &n->state); + trace_net_napi_complete(n); } EXPORT_SYMBOL(__napi_complete); @@ -3738,6 +3755,7 @@ static void net_rx_action(struct softirq_action *h) */ work = 0; if (test_bit(NAPI_STATE_SCHED, &n->state)) { + trace_net_napi_poll(n); work = n->poll(n, weight); trace_napi_poll(n); } diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c index 036652c8166..1917417ccbf 100644 --- a/net/ipv4/devinet.c +++ b/net/ipv4/devinet.c @@ -62,6 +62,7 @@ #include <net/ip_fib.h> #include <net/rtnetlink.h> #include <net/net_namespace.h> +#include <trace/ipv4.h> static struct ipv4_devconf ipv4_devconf = { .data = { @@ -92,6 +93,9 @@ static const struct nla_policy ifa_ipv4_policy[IFA_MAX+1] = { [IFA_LABEL] = { .type = NLA_STRING, .len = IFNAMSIZ - 1 }, }; +DEFINE_TRACE(ipv4_addr_add); +DEFINE_TRACE(ipv4_addr_del); + static void rtmsg_ifa(int event, struct in_ifaddr *, struct nlmsghdr *, u32); static BLOCKING_NOTIFIER_HEAD(inetaddr_chain); @@ -252,6 +256,7 @@ static void __inet_del_ifa(struct in_device *in_dev, struct in_ifaddr **ifap, struct in_ifaddr **ifap1 = &ifa1->ifa_next; while ((ifa = *ifap1) != NULL) { + trace_ipv4_addr_del(ifa); if (!(ifa->ifa_flags & IFA_F_SECONDARY) && ifa1->ifa_scope <= ifa->ifa_scope) last_prim = ifa; @@ -358,6 +363,7 @@ static int __inet_insert_ifa(struct in_ifaddr *ifa, struct nlmsghdr *nlh, } ifa->ifa_flags |= IFA_F_SECONDARY; } + trace_ipv4_addr_add(ifa); } if (!(ifa->ifa_flags & IFA_F_SECONDARY)) { diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c index 02f583b3744..61f72b24e7e 100644 --- a/net/ipv4/tcp_ipv4.c +++ b/net/ipv4/tcp_ipv4.c @@ -81,6 +81,9 @@ #include <linux/crypto.h> #include <linux/scatterlist.h> +#include <trace/net.h> + +DEFINE_TRACE(net_tcpv4_rcv); int sysctl_tcp_tw_reuse __read_mostly; int sysctl_tcp_low_latency __read_mostly; @@ -1543,6 +1546,9 @@ static __sum16 tcp_v4_checksum_init(struct sk_buff *skb) int tcp_v4_do_rcv(struct sock *sk, struct sk_buff *skb) { struct sock *rsk; + + trace_net_tcpv4_rcv(skb); + #ifdef CONFIG_TCP_MD5SIG /* * We really want to reject the packet as early as possible diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c index 8157b17959e..21f5aac48d3 100644 --- a/net/ipv4/udp.c +++ b/net/ipv4/udp.c @@ -105,6 +105,7 @@ #include <net/route.h> #include <net/checksum.h> #include <net/xfrm.h> +#include <trace/net.h> #include "udp_impl.h" struct udp_table udp_table __read_mostly; @@ -125,6 +126,8 @@ EXPORT_SYMBOL(udp_memory_allocated); #define MAX_UDP_PORTS 65536 #define PORTS_PER_CHAIN (MAX_UDP_PORTS / UDP_HTABLE_SIZE_MIN) +DEFINE_TRACE(net_udpv4_rcv); + static int udp_lib_lport_inuse(struct net *net, __u16 num, const struct udp_hslot *hslot, unsigned long *bitmap, @@ -1596,6 +1599,8 @@ int __udp4_lib_rcv(struct sk_buff *skb, struct udp_table *udptable, if (udp4_csum_init(skb, uh, proto)) goto csum_error; + trace_net_udpv4_rcv(skb); + if (rt->rt_flags & (RTCF_BROADCAST|RTCF_MULTICAST)) return __udp4_lib_mcast_deliver(net, skb, uh, saddr, daddr, udptable); diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c index fd6782e3a03..62c96253c36 100644 --- a/net/ipv6/addrconf.c +++ b/net/ipv6/addrconf.c @@ -87,6 +87,7 @@ #include <linux/proc_fs.h> #include <linux/seq_file.h> +#include <trace/ipv6.h> /* Set to 3 to get tracing... */ #define ACONF_DEBUG 2 @@ -108,6 +109,9 @@ static inline u32 cstamp_delta(unsigned long cstamp) #define ADDRCONF_TIMER_FUZZ (HZ / 4) #define ADDRCONF_TIMER_FUZZ_MAX (HZ) +DEFINE_TRACE(ipv6_addr_add); +DEFINE_TRACE(ipv6_addr_del); + #ifdef CONFIG_SYSCTL static void addrconf_sysctl_register(struct inet6_dev *idev); static void addrconf_sysctl_unregister(struct inet6_dev *idev); @@ -676,6 +680,8 @@ ipv6_add_addr(struct inet6_dev *idev, const struct in6_addr *addr, int pfxlen, /* For caller */ in6_ifa_hold(ifa); + trace_ipv6_addr_add(ifa); + /* Add to big hash table */ hash = ipv6_addr_hash(addr); @@ -2212,6 +2218,7 @@ static int inet6_addr_del(struct net *net, int ifindex, struct in6_addr *pfx, in6_ifa_hold(ifp); read_unlock_bh(&idev->lock); + trace_ipv6_addr_del(ifp); ipv6_del_addr(ifp); /* If the last address is deleted administratively, diff --git a/net/socket.c b/net/socket.c index 29c7df0ed3f..a25c0e52c64 100644 --- a/net/socket.c +++ b/net/socket.c @@ -98,6 +98,7 @@ #include <net/sock.h> #include <linux/netfilter.h> +#include <trace/socket.h> #include <linux/if_tun.h> #include <linux/ipv6_route.h> @@ -164,6 +165,21 @@ static const struct net_proto_family __rcu *net_families[NPROTO] __read_mostly; static DEFINE_PER_CPU(int, sockets_in_use); +DEFINE_TRACE(socket_create); +DEFINE_TRACE(socket_bind); +DEFINE_TRACE(socket_connect); +DEFINE_TRACE(socket_listen); +DEFINE_TRACE(socket_accept); +DEFINE_TRACE(socket_getsockname); +DEFINE_TRACE(socket_getpeername); +DEFINE_TRACE(socket_socketpair); +DEFINE_TRACE(socket_sendmsg); +DEFINE_TRACE(socket_recvmsg); +DEFINE_TRACE(socket_setsockopt); +DEFINE_TRACE(socket_getsockopt); +DEFINE_TRACE(socket_shutdown); +DEFINE_TRACE(socket_call); + /* * Support routines. * Move socket addresses back and forth across the kernel/user @@ -564,7 +580,9 @@ static inline int __sock_sendmsg(struct kiocb *iocb, struct socket *sock, if (err) return err; - return sock->ops->sendmsg(iocb, sock, msg, size); + err = sock->ops->sendmsg(iocb, sock, msg, size); + trace_socket_sendmsg(sock, msg, size, err); + return err; } int sock_sendmsg(struct socket *sock, struct msghdr *msg, size_t size) @@ -682,6 +700,7 @@ static inline int __sock_recvmsg_nosec(struct kiocb *iocb, struct socket *sock, struct msghdr *msg, size_t size, int flags) { struct sock_iocb *si = kiocb_to_siocb(iocb); + int err; sock_update_classid(sock->sk); @@ -691,7 +710,9 @@ static inline int __sock_recvmsg_nosec(struct kiocb *iocb, struct socket *sock, si->size = size; si->flags = flags; - return sock->ops->recvmsg(iocb, sock, msg, size, flags); + err = sock->ops->recvmsg(iocb, sock, msg, size, flags); + trace_socket_recvmsg(sock, msg, size, flags, err); + return err; } static inline int __sock_recvmsg(struct kiocb *iocb, struct socket *sock, @@ -1299,8 +1320,10 @@ SYSCALL_DEFINE3(socket, int, family, int, type, int, protocol) BUILD_BUG_ON(SOCK_NONBLOCK & SOCK_TYPE_MASK); flags = type & ~SOCK_TYPE_MASK; - if (flags & ~(SOCK_CLOEXEC | SOCK_NONBLOCK)) - return -EINVAL; + if (flags & ~(SOCK_CLOEXEC | SOCK_NONBLOCK)) { + retval = -EINVAL; + goto out; + } type &= SOCK_TYPE_MASK; if (SOCK_NONBLOCK != O_NONBLOCK && (flags & SOCK_NONBLOCK)) @@ -1314,12 +1337,12 @@ SYSCALL_DEFINE3(socket, int, family, int, type, int, protocol) if (retval < 0) goto out_release; -out: - /* It may be already another descriptor 8) Not kernel problem. */ - return retval; - + goto out; out_release: sock_release(sock); +out: + trace_socket_create(family, type, protocol, sock, retval); + /* It may be already another descriptor 8) Not kernel problem. */ return retval; } @@ -1336,8 +1359,10 @@ SYSCALL_DEFINE4(socketpair, int, family, int, type, int, protocol, int flags; flags = type & ~SOCK_TYPE_MASK; - if (flags & ~(SOCK_CLOEXEC | SOCK_NONBLOCK)) - return -EINVAL; + if (flags & ~(SOCK_CLOEXEC | SOCK_NONBLOCK)) { + err = -EINVAL; + goto out; + } type &= SOCK_TYPE_MASK; if (SOCK_NONBLOCK != O_NONBLOCK && (flags & SOCK_NONBLOCK)) @@ -1386,17 +1411,18 @@ SYSCALL_DEFINE4(socketpair, int, family, int, type, int, protocol, if (!err) err = put_user(fd2, &usockvec[1]); if (!err) - return 0; + goto out; sys_close(fd2); sys_close(fd1); - return err; + goto out; out_release_both: sock_release(sock2); out_release_1: sock_release(sock1); out: + trace_socket_socketpair(family, type, protocol, usockvec, err); return err; } @@ -1428,6 +1454,7 @@ SYSCALL_DEFINE3(bind, int, fd, struct sockaddr __user *, umyaddr, int, addrlen) } fput_light(sock->file, fput_needed); } + trace_socket_bind(fd, umyaddr, addrlen, err); return err; } @@ -1455,6 +1482,7 @@ SYSCALL_DEFINE2(listen, int, fd, int, backlog) fput_light(sock->file, fput_needed); } + trace_socket_listen(fd, backlog, err); return err; } @@ -1478,8 +1506,10 @@ SYSCALL_DEFINE4(accept4, int, fd, struct sockaddr __user *, upeer_sockaddr, int err, len, newfd, fput_needed; struct sockaddr_storage address; - if (flags & ~(SOCK_CLOEXEC | SOCK_NONBLOCK)) - return -EINVAL; + if (flags & ~(SOCK_CLOEXEC | SOCK_NONBLOCK)) { + err = -EINVAL; + goto out; + } if (SOCK_NONBLOCK != O_NONBLOCK && (flags & SOCK_NONBLOCK)) flags = (flags & ~SOCK_NONBLOCK) | O_NONBLOCK; @@ -1537,6 +1567,7 @@ SYSCALL_DEFINE4(accept4, int, fd, struct sockaddr __user *, upeer_sockaddr, out_put: fput_light(sock->file, fput_needed); out: + trace_socket_accept(fd, upeer_sockaddr, upeer_addrlen, flags, err); return err; out_fd: fput(newfile); @@ -1586,6 +1617,7 @@ SYSCALL_DEFINE3(connect, int, fd, struct sockaddr __user *, uservaddr, out_put: fput_light(sock->file, fput_needed); out: + trace_socket_connect(fd, uservaddr, addrlen, err); return err; } @@ -1617,6 +1649,7 @@ SYSCALL_DEFINE3(getsockname, int, fd, struct sockaddr __user *, usockaddr, out_put: fput_light(sock->file, fput_needed); out: + trace_socket_getsockname(fd, usockaddr, usockaddr_len, err); return err; } @@ -1637,7 +1670,7 @@ SYSCALL_DEFINE3(getpeername, int, fd, struct sockaddr __user *, usockaddr, err = security_socket_getpeername(sock); if (err) { fput_light(sock->file, fput_needed); - return err; + goto out; } err = @@ -1648,6 +1681,8 @@ SYSCALL_DEFINE3(getpeername, int, fd, struct sockaddr __user *, usockaddr, usockaddr_len); fput_light(sock->file, fput_needed); } +out: + trace_socket_getpeername(fd, usockaddr, usockaddr_len, err); return err; } @@ -1778,8 +1813,10 @@ SYSCALL_DEFINE5(setsockopt, int, fd, int, level, int, optname, int err, fput_needed; struct socket *sock; - if (optlen < 0) - return -EINVAL; + if (optlen < 0) { + err = -EINVAL; + goto out; + } sock = sockfd_lookup_light(fd, &err, &fput_needed); if (sock != NULL) { @@ -1798,6 +1835,8 @@ SYSCALL_DEFINE5(setsockopt, int, fd, int, level, int, optname, out_put: fput_light(sock->file, fput_needed); } +out: + trace_socket_setsockopt(fd, level, optname, optval, optlen, err); return err; } @@ -1829,6 +1868,7 @@ SYSCALL_DEFINE5(getsockopt, int, fd, int, level, int, optname, out_put: fput_light(sock->file, fput_needed); } + trace_socket_getsockopt(fd, level, optname, optval, optlen, err); return err; } @@ -1848,6 +1888,7 @@ SYSCALL_DEFINE2(shutdown, int, fd, int, how) err = sock->ops->shutdown(sock, how); fput_light(sock->file, fput_needed); } + trace_socket_shutdown(fd, how, err); return err; } @@ -2249,6 +2290,8 @@ SYSCALL_DEFINE2(socketcall, int, call, unsigned long __user *, args) a0 = a[0]; a1 = a[1]; + trace_socket_call(call, a0); + switch (call) { case SYS_SOCKET: err = sys_socket(a0, a1, a[2]); |