Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move underlay NICs back into H/W Classification #504

Merged
merged 33 commits into from
Aug 20, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
173f5d3
WIP: Deliver packets via DLS client to escape S/W
FelixMcFelix Apr 24, 2024
94c5264
WIP: Put the promisc callback on the right mac client.
FelixMcFelix Apr 24, 2024
8ffd7c3
Merge branch 'master' into goodbye-all-of-classification
FelixMcFelix Jun 14, 2024
c34e257
Fixup for real!
FelixMcFelix Jun 14, 2024
b542fac
Found the bug.
FelixMcFelix Jun 17, 2024
dff4a58
Reorganisation, cleanup.
FelixMcFelix Jun 17, 2024
360955c
Clippy.
FelixMcFelix Jun 17, 2024
1da884e
Refactoring, newtype for DLS Link IDs
FelixMcFelix Jun 17, 2024
54182c9
Comment tweaks etc.
FelixMcFelix Jun 17, 2024
bb25fde
More commentary.
FelixMcFelix Jun 17, 2024
3dc09de
Should now have the correct attach/detach refs
FelixMcFelix Jun 19, 2024
c84ec5a
Simplify creation/cleanup.
FelixMcFelix Jun 19, 2024
7a4b068
Hmm.
FelixMcFelix Jun 19, 2024
0434f15
Dls, not Dld.
FelixMcFelix Jun 19, 2024
d7d416a
Cleanup.
FelixMcFelix Jun 19, 2024
303057b
Finalist tweaks
FelixMcFelix Jun 19, 2024
94819d5
Accidentally the wrong type.
FelixMcFelix Jun 20, 2024
bf35bf2
Review feedback: nits.
FelixMcFelix Jul 10, 2024
2e4d9c3
Merge branch 'master' into goodbye-all-of-classification
FelixMcFelix Jul 10, 2024
95a213d
Alloc/free dld_str_t from the kmem cache.
FelixMcFelix Aug 1, 2024
bb3cb41
Initial CTF reading from within opteadm.
FelixMcFelix Aug 1, 2024
d0d3986
Live verification of dld_str_s against runtime CTF
FelixMcFelix Aug 1, 2024
4fbcb4b
Remove some debug-fmt.
FelixMcFelix Aug 1, 2024
b682a16
Use live-running DLD (/system) rather than drv
FelixMcFelix Aug 2, 2024
984da1a
Update in tandem with stlouis#577.
FelixMcFelix Aug 6, 2024
dfb6ef4
Swap to upstreamed ctf-bindgen.
FelixMcFelix Aug 8, 2024
35b0187
Help CI along a little bit.
FelixMcFelix Aug 8, 2024
4074b11
Merge branch 'master' into goodbye-all-of-classification
FelixMcFelix Aug 8, 2024
b7e96a2
Back to `main` for ctf-bindgen
FelixMcFelix Aug 8, 2024
942a56e
Undo private access workarounds for ctf-bindgen
FelixMcFelix Aug 8, 2024
77ea7c8
Comment fixups.
FelixMcFelix Aug 8, 2024
ced9d52
No more reliance on `dld_str_t` internals
FelixMcFelix Aug 15, 2024
d3e5867
Uncork opte#532 while we're here.
FelixMcFelix Aug 15, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions crates/ctf/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -231,8 +231,6 @@ impl Ctf {
type_id.checked_sub(1)
}? as usize;

println!("idx {type_id} -> {true_idx}");

self.sections.types.get(true_idx)
}

Expand Down Expand Up @@ -400,7 +398,7 @@ impl TypeEncoding {

/// Length of the associated type data.
pub fn vlen(&self) -> u16 {
(self.0 & 0x3ff) as u16
self.0 & 0x3ff
}
}

Expand Down
2 changes: 1 addition & 1 deletion crates/opte-api/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ pub struct StructField {
// for, which is reading four pointers from a struct defn.
}

#[derive(Clone, Debug, Serialize, Deserialize)]
#[derive(Clone, Debug, Serialize, Deserialize, Eq, PartialEq)]
pub enum FieldType {
Pointer,
Other(Option<String>),
Expand Down
2 changes: 1 addition & 1 deletion lib/opte-ioctl/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,7 @@ where
}

pub fn fetch_fragile_types() -> Result<FragileInternals, Error> {
let dld_ctf = Ctf::from_file("/kernel/drv/amd64/dld")
let dld_ctf = Ctf::from_file("/system/object/dld/object")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😮 TIL objfs

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I learned that trick from Robert! I think it'll be short-lived if we use your below suggestion. I'll preserve a copy of this branch since we could end up needing these tricks again (although I hope we do not).

.map_err(|e| Error::CtfError(e.to_string()))?;

let Some(dld) = dld_ctf.find_type_by_name("dld_str_s") else {
Expand Down
39 changes: 32 additions & 7 deletions xde/src/dls/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ use crate::mac::MacClient;
use crate::mac::MacPerimeterHandle;
use crate::mac::MacTxFlags;
use crate::mac::MAC_DROP_ON_NO_DESC;
use crate::warn;
use alloc::string::String;
use core::ffi::CStr;
use core::fmt::Display;
Expand All @@ -26,6 +25,7 @@ use illumos_sys_hdrs::datalink_id_t;
use illumos_sys_hdrs::uintptr_t;
use illumos_sys_hdrs::ENOENT;
use illumos_sys_hdrs::KM_SLEEP;
use opte::api::FieldType;
use opte::api::StructDef;
use opte::engine::packet::Packet;
use opte::engine::packet::PacketState;
Expand Down Expand Up @@ -187,20 +187,45 @@ struct DlsStreamInner {
impl DlsStream {
pub fn verify_bindings(bindings: &StructDef) -> Result<(), String> {
let expt = [
("ds_ddh", core::mem::offset_of!(dld_str_s, ds_ddh)),
("ds_mch", core::mem::offset_of!(dld_str_s, ds_mch)),
("ds_mh", core::mem::offset_of!(dld_str_s, ds_mh)),
("ds_mip", core::mem::offset_of!(dld_str_s, ds_mip)),
(
"ds_ddh",
core::mem::offset_of!(dld_str_s, ds_ddh),
FieldType::Pointer,
),
(
"ds_mch",
core::mem::offset_of!(dld_str_s, ds_mch),
FieldType::Pointer,
),
(
"ds_mip",
core::mem::offset_of!(dld_str_s, ds_mip),
FieldType::Pointer,
),
// This is a pointer, but uniquification puts its def in the parent (genunix).
// We don't yet support resolution via parents.
(
"ds_mh",
core::mem::offset_of!(dld_str_s, ds_mh),
FieldType::Other(None),
),
];

let mut errs = vec![];
for (field_name, byte_offset) in expt {
for (field_name, byte_offset, ty) in expt {
let bit_offset = 8 * byte_offset;
let Some(field) = bindings.fields.get(field_name) else {
errs.push(format!("missing field {field_name}"));
continue;
};

if field.ty != ty {
errs.push(format!(
"field {field_name} has type {:?} (wanted {:?})",
field.ty, ty,
));
}

if field.bit_offset != bit_offset as u64 {
errs.push(format!(
"field {field_name} at bit {} (wanted {})",
Expand All @@ -212,7 +237,7 @@ impl DlsStream {
if errs.is_empty() {
Ok(())
} else {
Err(errs.join(", "))
Err(format!("dls_str_s: [{}]", errs.join(", ")))
}
}

Expand Down