aboutsummaryrefslogtreecommitdiffstats
path: root/net/dccp/probe.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/dccp/probe.c')
-rw-r--r--net/dccp/probe.c75
1 files changed, 27 insertions, 48 deletions
diff --git a/net/dccp/probe.c b/net/dccp/probe.c
index 81368a7f5379..eaa59d82ab0f 100644
--- a/net/dccp/probe.c
+++ b/net/dccp/probe.c
@@ -46,75 +46,54 @@ static struct {
46 struct kfifo *fifo; 46 struct kfifo *fifo;
47 spinlock_t lock; 47 spinlock_t lock;
48 wait_queue_head_t wait; 48 wait_queue_head_t wait;
49 struct timespec tstart; 49 ktime_t start;
50} dccpw; 50} dccpw;
51 51
52static void printl(const char *fmt, ...) 52static void jdccp_write_xmit(struct sock *sk)
53{ 53{
54 va_list args;
55 int len;
56 struct timespec now;
57 char tbuf[256];
58
59 va_start(args, fmt);
60 getnstimeofday(&now);
61
62 now = timespec_sub(now, dccpw.tstart);
63
64 len = sprintf(tbuf, "%lu.%06lu ",
65 (unsigned long) now.tv_sec,
66 (unsigned long) now.tv_nsec / NSEC_PER_USEC);
67 len += vscnprintf(tbuf+len, sizeof(tbuf)-len, fmt, args);
68 va_end(args);
69
70 kfifo_put(dccpw.fifo, tbuf, len);
71 wake_up(&dccpw.wait);
72}
73
74static int jdccp_sendmsg(struct kiocb *iocb, struct sock *sk,
75 struct msghdr *msg, size_t size)
76{
77 const struct dccp_minisock *dmsk = dccp_msk(sk);
78 const struct inet_sock *inet = inet_sk(sk); 54 const struct inet_sock *inet = inet_sk(sk);
79 const struct ccid3_hc_tx_sock *hctx; 55 struct ccid3_hc_tx_sock *hctx = NULL;
56 struct timespec tv;
57 char buf[256];
58 int len, ccid = ccid_get_current_tx_ccid(dccp_sk(sk));
80 59
81 if (dmsk->dccpms_tx_ccid == DCCPC_CCID3) 60 if (ccid == DCCPC_CCID3)
82 hctx = ccid3_hc_tx_sk(sk); 61 hctx = ccid3_hc_tx_sk(sk);
83 else
84 hctx = NULL;
85 62
86 if (port == 0 || ntohs(inet->dport) == port || 63 if (!port || ntohs(inet->dport) == port || ntohs(inet->sport) == port) {
87 ntohs(inet->sport) == port) { 64
88 if (hctx) 65 tv = ktime_to_timespec(ktime_sub(ktime_get(), dccpw.start));
89 printl("%d.%d.%d.%d:%u %d.%d.%d.%d:%u %d %d %d %d %u " 66 len = sprintf(buf, "%lu.%09lu %d.%d.%d.%d:%u %d.%d.%d.%d:%u %d",
90 "%llu %llu %d\n", 67 (unsigned long)tv.tv_sec,
91 NIPQUAD(inet->saddr), ntohs(inet->sport), 68 (unsigned long)tv.tv_nsec,
92 NIPQUAD(inet->daddr), ntohs(inet->dport), size,
93 hctx->ccid3hctx_s, hctx->ccid3hctx_rtt,
94 hctx->ccid3hctx_p, hctx->ccid3hctx_x_calc,
95 hctx->ccid3hctx_x_recv >> 6,
96 hctx->ccid3hctx_x >> 6, hctx->ccid3hctx_t_ipi);
97 else
98 printl("%d.%d.%d.%d:%u %d.%d.%d.%d:%u %d\n",
99 NIPQUAD(inet->saddr), ntohs(inet->sport), 69 NIPQUAD(inet->saddr), ntohs(inet->sport),
100 NIPQUAD(inet->daddr), ntohs(inet->dport), size); 70 NIPQUAD(inet->daddr), ntohs(inet->dport), ccid);
71
72 if (hctx)
73 len += sprintf(buf + len, " %d %d %d %u %u %u %d",
74 hctx->s, hctx->rtt, hctx->p, hctx->x_calc,
75 (unsigned)(hctx->x_recv >> 6),
76 (unsigned)(hctx->x >> 6), hctx->t_ipi);
77
78 len += sprintf(buf + len, "\n");
79 kfifo_put(dccpw.fifo, buf, len);
80 wake_up(&dccpw.wait);
101 } 81 }
102 82
103 jprobe_return(); 83 jprobe_return();
104 return 0;
105} 84}
106 85
107static struct jprobe dccp_send_probe = { 86static struct jprobe dccp_send_probe = {
108 .kp = { 87 .kp = {
109 .symbol_name = "dccp_sendmsg", 88 .symbol_name = "dccp_write_xmit",
110 }, 89 },
111 .entry = jdccp_sendmsg, 90 .entry = jdccp_write_xmit,
112}; 91};
113 92
114static int dccpprobe_open(struct inode *inode, struct file *file) 93static int dccpprobe_open(struct inode *inode, struct file *file)
115{ 94{
116 kfifo_reset(dccpw.fifo); 95 kfifo_reset(dccpw.fifo);
117 getnstimeofday(&dccpw.tstart); 96 dccpw.start = ktime_get();
118 return 0; 97 return 0;
119} 98}
120 99