From b9cf34715cb9370d52ca33db8e4d13aa4e3e3e66 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maciej=20=C5=BBenczykowski?= Date: Wed, 13 Sep 2023 21:59:46 +0000 Subject: [PATCH] netd.c - nettrace - add 'wakeup' boolean MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is based on network driver populated skb->mark magic bit. This is the bit used by netd's WakeupController. We mandated the location of this bit in U, though we haven't (yet??) mandated it being supported by all network drivers. If the driver doesn't support it, it could always be false (skb->mark should default to 0), or potentially (this is very very unlikely) be garbage. IFIRC nettrace isn't enabled on pre-U devices anyway. Test: TreeHugger Signed-off-by: Maciej Żenczykowski Change-Id: I2b3b91315d77c08c022396253b26954593dd3f5a --- bpf_progs/netd.c | 1 + bpf_progs/netd.h | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/bpf_progs/netd.c b/bpf_progs/netd.c index 368cfca058..c3258e9e89 100644 --- a/bpf_progs/netd.c +++ b/bpf_progs/netd.c @@ -319,6 +319,7 @@ static __always_inline inline void do_packet_tracing( pkt->dport = dport; pkt->egress = egress; + pkt->wakeup = !egress && (skb->mark & 0x80000000); // Fwmark.ingress_cpu_wakeup pkt->ipProto = proto; pkt->tcpFlags = flags; pkt->ipVersion = ipVersion; diff --git a/bpf_progs/netd.h b/bpf_progs/netd.h index 836e99833f..6e9acaa380 100644 --- a/bpf_progs/netd.h +++ b/bpf_progs/netd.h @@ -81,7 +81,8 @@ typedef struct { __be16 sport; __be16 dport; - bool egress; + bool egress:1, + wakeup:1; uint8_t ipProto; uint8_t tcpFlags; uint8_t ipVersion; // 4=IPv4, 6=IPv6, 0=unknown