diff --git a/src/rust/lqos_sys/src/bpf/common/palantir.h b/src/rust/lqos_sys/src/bpf/common/heimdall.h similarity index 76% rename from src/rust/lqos_sys/src/bpf/common/palantir.h rename to src/rust/lqos_sys/src/bpf/common/heimdall.h index 49339551..f6066d37 100644 --- a/src/rust/lqos_sys/src/bpf/common/palantir.h +++ b/src/rust/lqos_sys/src/bpf/common/heimdall.h @@ -7,7 +7,7 @@ #include "debug.h" #include "dissector.h" -struct palantir_key { +struct heimdall_key { struct in6_addr src; struct in6_addr dst; __u8 ip_protocol; @@ -15,7 +15,7 @@ struct palantir_key { __u16 dst_port; }; -struct palantir_data { +struct heimdall_data { __u64 last_seen; __u64 bytes; __u64 packets; @@ -26,21 +26,21 @@ struct palantir_data { struct { __uint(type, BPF_MAP_TYPE_LRU_PERCPU_HASH); - __type(key, struct palantir_key); - __type(value, struct palantir_data); + __type(key, struct heimdall_key); + __type(value, struct heimdall_data); __uint(max_entries, MAX_FLOWS); __uint(pinning, LIBBPF_PIN_BY_NAME); -} palantir SEC(".maps"); +} heimdall SEC(".maps"); -static __always_inline void update_palantir(struct dissector_t * dissector, __u32 size, int dir) { +static __always_inline void update_heimdall(struct dissector_t * dissector, __u32 size, int dir) { if (dissector->src_port == 0 || dissector->dst_port == 0) return; - struct palantir_key key = {0}; + struct heimdall_key key = {0}; key.src = dissector->src_ip; key.dst = dissector->dst_ip; key.ip_protocol = dissector->ip_protocol; key.src_port = bpf_ntohs(dissector->src_port); key.dst_port = bpf_ntohs(dissector->dst_port); - struct palantir_data * counter = (struct palantir_data *)bpf_map_lookup_elem(&palantir, &key); + struct heimdall_data * counter = (struct heimdall_data *)bpf_map_lookup_elem(&heimdall, &key); if (counter) { counter->last_seen = bpf_ktime_get_boot_ns(); counter->packets += 1; @@ -49,7 +49,7 @@ static __always_inline void update_palantir(struct dissector_t * dissector, __u3 counter->tos = dissector->tos; } } else { - struct palantir_data counter = {0}; + struct heimdall_data counter = {0}; counter.last_seen = bpf_ktime_get_boot_ns(); counter.bytes = size; counter.packets = 1; @@ -57,7 +57,7 @@ static __always_inline void update_palantir(struct dissector_t * dissector, __u3 counter.reserved[0] = 0; counter.reserved[1] = 0; counter.reserved[2] = 0; - if (bpf_map_update_elem(&palantir, &key, &counter, BPF_NOEXIST) != 0) { + if (bpf_map_update_elem(&heimdall, &key, &counter, BPF_NOEXIST) != 0) { bpf_debug("Failed to insert tracking"); } } diff --git a/src/rust/lqos_sys/src/bpf/lqos_kern.c b/src/rust/lqos_sys/src/bpf/lqos_kern.c index 26efa7e0..807d110c 100644 --- a/src/rust/lqos_sys/src/bpf/lqos_kern.c +++ b/src/rust/lqos_sys/src/bpf/lqos_kern.c @@ -17,7 +17,7 @@ #include "common/cpu_map.h" #include "common/tcp_rtt.h" #include "common/bifrost.h" -#include "common/palantir.h" +#include "common/heimdall.h" //#define VERBOSE 1 @@ -134,11 +134,11 @@ int xdp_prog(struct xdp_md *ctx) // Send on its way if (tc_handle != 0) { - // Send data to Palantir + // Send data to Heimdall #ifdef VERBOSE - bpf_debug("(XDP) Storing Palantir Data"); + bpf_debug("(XDP) Storing Heimdall Data"); #endif - update_palantir(&dissector, ctx->data_end - ctx->data, effective_direction); + update_heimdall(&dissector, ctx->data_end - ctx->data, effective_direction); // Handle CPU redirection if there is one specified __u32 *cpu_lookup; diff --git a/src/rust/lqos_sys/src/palantir_map.rs b/src/rust/lqos_sys/src/heimdall_map.rs similarity index 68% rename from src/rust/lqos_sys/src/palantir_map.rs rename to src/rust/lqos_sys/src/heimdall_map.rs index 4c295298..46fe1c8b 100644 --- a/src/rust/lqos_sys/src/palantir_map.rs +++ b/src/rust/lqos_sys/src/heimdall_map.rs @@ -2,7 +2,7 @@ use crate::{bpf_per_cpu_map::BpfPerCpuMap, XdpIpAddress}; #[derive(Debug, Clone, Default, PartialEq, Eq, Hash)] #[repr(C)] -pub struct PalantirKey { +pub struct HeimdallKey { pub src_ip: XdpIpAddress, pub dst_ip: XdpIpAddress, pub ip_protocol: u8, @@ -12,7 +12,7 @@ pub struct PalantirKey { #[derive(Debug, Clone, Default)] #[repr(C)] -pub struct PalantirData { +pub struct HeimdallData { pub last_seen: u64, pub bytes: u64, pub packets: u64, @@ -22,12 +22,12 @@ pub struct PalantirData { /// Iterates through all throughput entries, and sends them in turn to `callback`. /// This elides the need to clone or copy data. -pub fn palantir_for_each( - callback: &mut dyn FnMut(&PalantirKey, &[PalantirData]), +pub fn heimdall_for_each( + callback: &mut dyn FnMut(&HeimdallKey, &[HeimdallData]), ) { - if let Ok(palantir) = BpfPerCpuMap::::from_path( - "/sys/fs/bpf/palantir", + if let Ok(heimdall) = BpfPerCpuMap::::from_path( + "/sys/fs/bpf/heimdall", ) { - palantir.for_each(callback); + heimdall.for_each(callback); } } diff --git a/src/rust/lqos_sys/src/lib.rs b/src/rust/lqos_sys/src/lib.rs index 2b149781..54335a5e 100644 --- a/src/rust/lqos_sys/src/lib.rs +++ b/src/rust/lqos_sys/src/lib.rs @@ -11,7 +11,7 @@ mod bpf_map; mod bpf_per_cpu_map; mod cpu_map; mod ip_mapping; -mod palantir_map; +mod heimdall_map; mod kernel_wrapper; mod lqos_kernel; mod tcp_rtt; @@ -27,4 +27,4 @@ pub use lqos_kernel::max_tracked_ips; pub use tcp_rtt::{rtt_for_each, RttTrackingEntry}; pub use throughput::{throughput_for_each, HostCounter}; pub use xdp_ip_address::XdpIpAddress; -pub use palantir_map::{palantir_for_each, PalantirKey, PalantirData}; +pub use heimdall_map::{heimdall_for_each, HeimdallKey, HeimdallData}; diff --git a/src/rust/lqosd/src/throughput_tracker/palantir_data.rs b/src/rust/lqosd/src/throughput_tracker/heimdall_data.rs similarity index 89% rename from src/rust/lqosd/src/throughput_tracker/palantir_data.rs rename to src/rust/lqosd/src/throughput_tracker/heimdall_data.rs index 57ec7550..f3915d67 100644 --- a/src/rust/lqosd/src/throughput_tracker/palantir_data.rs +++ b/src/rust/lqosd/src/throughput_tracker/heimdall_data.rs @@ -2,17 +2,17 @@ use std::{time::Duration, net::IpAddr}; use dashmap::DashMap; use lqos_bus::{BusResponse, FlowTransport}; -use lqos_sys::{PalantirData, PalantirKey, XdpIpAddress}; +use lqos_sys::{HeimdallData, HeimdallKey, XdpIpAddress}; use lqos_utils::unix_time::time_since_boot; use once_cell::sync::Lazy; use crate::stats::FLOWS_TRACKED; -pub(crate) static PALANTIR: Lazy = +pub(crate) static HEIMDALL: Lazy = Lazy::new(PalantirMonitor::new); pub(crate) struct PalantirMonitor { - pub(crate) data: DashMap, + pub(crate) data: DashMap, } #[derive(Default)] @@ -28,7 +28,7 @@ impl PalantirMonitor { Self { data: DashMap::new() } } - fn combine_flows(values: &[PalantirData]) -> FlowData { + fn combine_flows(values: &[HeimdallData]) -> FlowData { let mut result = FlowData::default(); let mut ls = 0; values.iter().for_each(|v| { @@ -43,7 +43,7 @@ impl PalantirMonitor { result } - pub(crate) fn ingest(&self, key: &PalantirKey, values: &[PalantirData]) { + pub(crate) fn ingest(&self, key: &HeimdallKey, values: &[HeimdallData]) { //println!("{key:?}"); //println!("{values:?}"); if let Some(expire_ns) = Self::get_expire_time() { @@ -92,7 +92,7 @@ pub fn get_flow_stats(ip: &str) -> BusResponse { let ip = XdpIpAddress::from_ip(ip); let mut result = Vec::new(); - for value in PALANTIR.data.iter() { + for value in HEIMDALL.data.iter() { let key = value.key(); if key.src_ip == ip || key.dst_ip == ip { result.push(FlowTransport{ diff --git a/src/rust/lqosd/src/throughput_tracker/mod.rs b/src/rust/lqosd/src/throughput_tracker/mod.rs index 0ce5da72..d4475760 100644 --- a/src/rust/lqosd/src/throughput_tracker/mod.rs +++ b/src/rust/lqosd/src/throughput_tracker/mod.rs @@ -1,7 +1,7 @@ mod throughput_entry; mod tracking_data; -mod palantir_data; -pub use palantir_data::get_flow_stats; +mod heimdall_data; +pub use heimdall_data::get_flow_stats; use crate::{ shaped_devices_tracker::NETWORK_JSON, throughput_tracker::tracking_data::ThroughputTracker, stats::TIME_TO_POLL_HOSTS, diff --git a/src/rust/lqosd/src/throughput_tracker/tracking_data.rs b/src/rust/lqosd/src/throughput_tracker/tracking_data.rs index ca5b335a..9ad38880 100644 --- a/src/rust/lqosd/src/throughput_tracker/tracking_data.rs +++ b/src/rust/lqosd/src/throughput_tracker/tracking_data.rs @@ -1,9 +1,9 @@ use std::sync::atomic::AtomicU64; use crate::{shaped_devices_tracker::{SHAPED_DEVICES, NETWORK_JSON}, stats::{HIGH_WATERMARK_DOWN, HIGH_WATERMARK_UP}}; -use super::{throughput_entry::ThroughputEntry, RETIRE_AFTER_SECONDS, palantir_data::PALANTIR}; +use super::{throughput_entry::ThroughputEntry, RETIRE_AFTER_SECONDS, heimdall_data::HEIMDALL}; use dashmap::DashMap; use lqos_bus::TcHandle; -use lqos_sys::{rtt_for_each, throughput_for_each, XdpIpAddress, palantir_for_each}; +use lqos_sys::{rtt_for_each, throughput_for_each, XdpIpAddress, heimdall_for_each}; pub struct ThroughputTracker { pub(crate) cycle: AtomicU64, @@ -102,11 +102,11 @@ impl ThroughputTracker { } pub(crate) fn pantir_tracking(&self) { - PALANTIR.expire(); - palantir_for_each(&mut |key, values| { - PALANTIR.ingest(key, values); + HEIMDALL.expire(); + heimdall_for_each(&mut |key, values| { + HEIMDALL.ingest(key, values); }); - //println!("Tracking {} flows", PALANTIR.data.len()); + //println!("Tracking {} flows", HEIMDALL.data.len()); } pub(crate) fn apply_new_throughput_counters( diff --git a/src/rust/remove_pinned_maps.sh b/src/rust/remove_pinned_maps.sh index 0bd26cf2..c484a670 100755 --- a/src/rust/remove_pinned_maps.sh +++ b/src/rust/remove_pinned_maps.sh @@ -10,5 +10,5 @@ rm -v /sys/fs/bpf/map_ip_to_cpu_and_tc_recip rm -v /sys/fs/bpf/map_txq_config rm -v /sys/fs/bpf/bifrost_interface_map rm -v /sys/fs/bpf/bifrost_vlan_map -rm -v /sys/fs/bpf/palantir +rm -v /sys/fs/bpf/heimdall