aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorztong <ztong@cs.unc.edu>2021-02-03 18:15:37 -0500
committerztong <ztong@cs.unc.edu>2021-02-03 18:15:37 -0500
commitffcea58b914c7febd2d3126552dee41216d3a203 (patch)
tree2e63e893807fb908cfd398c9a63d0412b019ea12 /net
parent8b3b8657637b5a03b2f12f260516be964e6fc228 (diff)
Added KUTrace Support
Moved sched_litmus back to the top scheduling class
Diffstat (limited to 'net')
-rw-r--r--net/ipv4/tcp_input.c15
-rw-r--r--net/ipv4/tcp_output.c10
-rw-r--r--net/ipv4/udp.c20
3 files changed, 45 insertions, 0 deletions
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
index a2e52ad7cdab..87641ed2c172 100644
--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
@@ -80,6 +80,8 @@
80#include <linux/jump_label_ratelimit.h> 80#include <linux/jump_label_ratelimit.h>
81#include <net/busy_poll.h> 81#include <net/busy_poll.h>
82 82
83#include <linux/kutrace.h>
84
83int sysctl_tcp_max_orphans __read_mostly = NR_FILE; 85int sysctl_tcp_max_orphans __read_mostly = NR_FILE;
84 86
85#define FLAG_DATA 0x01 /* Incoming frame contained data. */ 87#define FLAG_DATA 0x01 /* Incoming frame contained data. */
@@ -5547,6 +5549,19 @@ void tcp_rcv_established(struct sock *sk, struct sk_buff *skb)
5547 struct tcp_sock *tp = tcp_sk(sk); 5549 struct tcp_sock *tp = tcp_sk(sk);
5548 unsigned int len = skb->len; 5550 unsigned int len = skb->len;
5549 5551
5552 /* dsites 2020.10.28 */
5553 /* Apply quick filter and if it passes, make a KUtrace entry for */
5554 /* rx packet. Use XOR of first 32 bytes as the recorded argument value */
5555 if (kutrace_tracing && ((20 + 32) <= len)) {
5556 int ku_hdr_len = th->doff << 2;
5557 const u64 *ku_payload = (u64*)(skb->data + ku_hdr_len);
5558 int ku_payloadlen = len - ku_hdr_len;
5559 if (32 <= ku_payloadlen) {
5560 kutrace_pkttrace(KUTRACE_RX_PKT, ku_payload);
5561 }
5562 }
5563
5564
5550 /* TCP congestion window tracking */ 5565 /* TCP congestion window tracking */
5551 trace_tcp_probe(sk, skb); 5566 trace_tcp_probe(sk, skb);
5552 5567
diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c
index 0488607c5cd3..1a1df10a99b9 100644
--- a/net/ipv4/tcp_output.c
+++ b/net/ipv4/tcp_output.c
@@ -46,6 +46,8 @@
46 46
47#include <trace/events/tcp.h> 47#include <trace/events/tcp.h>
48 48
49#include <linux/kutrace.h>
50
49/* Refresh clocks of a TCP socket, 51/* Refresh clocks of a TCP socket,
50 * ensuring monotically increasing values. 52 * ensuring monotically increasing values.
51 */ 53 */
@@ -1166,6 +1168,14 @@ static int __tcp_transmit_skb(struct sock *sk, struct sk_buff *skb,
1166 1168
1167 tcp_add_tx_delay(skb, tp); 1169 tcp_add_tx_delay(skb, tp);
1168 1170
1171 /* dsites 2020.11.11 */
1172 /* Apply quick filter and if it passes, make a KUtrace entry for tx packet. */
1173 /* Use XOR of first 32 bytes as the recorded argument value */
1174 if (kutrace_tracing && ((tcp_header_size + 32) <= skb->len)) {
1175 const u64 *ku_payload = (u64*)(skb->data + tcp_header_size);
1176 kutrace_pkttrace(KUTRACE_TX_PKT, ku_payload);
1177 }
1178
1169 err = icsk->icsk_af_ops->queue_xmit(sk, skb, &inet->cork.fl); 1179 err = icsk->icsk_af_ops->queue_xmit(sk, skb, &inet->cork.fl);
1170 1180
1171 if (unlikely(err > 0)) { 1181 if (unlikely(err > 0)) {
diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c
index 1d58ce829dca..da6e0b21b339 100644
--- a/net/ipv4/udp.c
+++ b/net/ipv4/udp.c
@@ -113,6 +113,8 @@
113#include <net/addrconf.h> 113#include <net/addrconf.h>
114#include <net/udp_tunnel.h> 114#include <net/udp_tunnel.h>
115 115
116#include <linux/kutrace.h>
117
116struct udp_table udp_table __read_mostly; 118struct udp_table udp_table __read_mostly;
117EXPORT_SYMBOL(udp_table); 119EXPORT_SYMBOL(udp_table);
118 120
@@ -888,6 +890,15 @@ csum_partial:
888 uh->check = CSUM_MANGLED_0; 890 uh->check = CSUM_MANGLED_0;
889 891
890send: 892send:
893
894 /* dsites 2020.11.11 */
895 /* Apply quick filter and if it passes, make a KUtrace entry for tx packet. */
896 /* Use XOR of first 32 bytes as the recorded argument value */
897 if (kutrace_tracing && ((8 + 32) <= len)) {
898 const u64 *ku_payload = (u64*)(skb->data);
899 kutrace_pkttrace(KUTRACE_TX_PKT, ku_payload);
900 }
901
891 err = ip_send_skb(sock_net(sk), skb); 902 err = ip_send_skb(sock_net(sk), skb);
892 if (err) { 903 if (err) {
893 if (err == -ENOBUFS && !inet->recverr) { 904 if (err == -ENOBUFS && !inet->recverr) {
@@ -2289,6 +2300,15 @@ int __udp4_lib_rcv(struct sk_buff *skb, struct udp_table *udptable,
2289 if (udp4_csum_init(skb, uh, proto)) 2300 if (udp4_csum_init(skb, uh, proto))
2290 goto csum_error; 2301 goto csum_error;
2291 2302
2303 /* dsites 2020.11.02 */
2304 /* Apply quick filter and if it passes, make a KUtrace entry for rx packet. */
2305 /* Use XOR of first 32 bytes as the recorded argument value */
2306 if (kutrace_tracing && ((8 + 32) <= ulen)) {
2307 int ku_hdr_len = 8;
2308 const u64 *ku_payload = (u64*)((u8*)(uh) + ku_hdr_len);
2309 kutrace_pkttrace(KUTRACE_RX_PKT, ku_payload);
2310 }
2311
2292 sk = skb_steal_sock(skb); 2312 sk = skb_steal_sock(skb);
2293 if (sk) { 2313 if (sk) {
2294 struct dst_entry *dst = skb_dst(skb); 2314 struct dst_entry *dst = skb_dst(skb);