fixed bug in attaching nics to hosts, changed documentation format and generator (buggy but usable)

This commit is contained in:
2025-09-14 00:40:53 -04:00
parent 9ab64e18a4
commit c4141cd683
40 changed files with 5223 additions and 577 deletions

View File

@@ -1,5 +1,7 @@
# network/switch/dedicated_buffer.h
## class DedicatedBuffer — public interface
### `bool drain_one(PortId port) override;`
## `DedicatedBuffer::DedicatedBuffer`
`DedicatedBuffer(Simulator *const sim, NetworkSwitch *const owner, Bytes total_bytes, uint16_t ports)`
## `DedicatedBuffer::drain_one`
`bool drain_one(PortId port) override`
## `DedicatedBuffer::enqueue_packet`
`bool enqueue_packet(const Packet &pkt, PortId egress, FlowPriority prio) override`

View File

@@ -1,5 +1,7 @@
# network/switch/ecn_dedicated_red.h
## class DedicatedREDEngine — public interface
### `_rng(rng) { ... }`
## `DedicatedREDEngine::DedicatedREDEngine`
`DedicatedREDEngine(Bytes min_th, Bytes max_th, double p_max, bool back_to_sender, Rng *const rng) noexcept : _min_th(min_th), _max_th(max_th), _p_max(p_max), _back_to_sender(back_to_sender), _rng(rng)`
## `DedicatedREDEngine::process_packet`
`virtual Packet &process_packet(Packet &pkt, SwitchBuffer *buf) noexcept override`
## `dofs::ensure_size`
`private: void ensure_size(uint16_t port_cnt){`

View File

@@ -1,5 +1,7 @@
# network/switch/ecn_engine.h
## class SwitchBuffer — public interface
### `virtual ~ECNEngine() = default;`
## `ECNEngine::process_packet`
`virtual Packet &process_packet(Packet &pkt, SwitchBuffer *buf) noexcept = 0`
## `ECNEngine::~ECNEngine`
`virtual ~ECNEngine() = default`
## `dofs::header_trim`
`static inline void header_trim(Packet &pkt, bool back_to_sender) noexcept{`

View File

@@ -1,5 +1,13 @@
# network/switch/ecn_shared_red.h
## class SharedREDEngine — public interface
### `_avg_port_bytes() { ... }`
## `SharedREDEngine::SharedREDEngine`
`explicit SharedREDEngine(Rng *const rng = nullptr) noexcept : _rng(rng), _avg_total_bytes(0.0), _avg_port_bytes()`
## `SharedREDEngine::process_packet`
`virtual Packet &process_packet(Packet &pkt, SwitchBuffer *buf) noexcept override`
## `dofs::ensure_size`
`private: void ensure_size(uint16_t port_cnt){`
## `is_ctrl`
`static inline bool is_ctrl(const Packet &p) noexcept{`
## `is_ele`
`static inline bool is_ele (const Packet &p) noexcept{`
## `is_mice`
`static inline bool is_mice(const Packet &p) noexcept{`

View File

@@ -1,15 +1,23 @@
# network/switch/multicast_table.h
## class MulticastTable — public interface
### `MulticastTable();`
### `bool add_tree(std::size_t group_id, uint16_t tree_id);`
### `bool delete_tree(std::size_t group_id, uint16_t tree_id);`
### `bool add_child_port(std::size_t group_id, uint16_t tree_id, PortId out_port);`
### `bool delete_child_port(std::size_t group_id, uint16_t tree_id, PortId out_port);`
### `bool set_parent(std::size_t group_id, uint16_t tree_id, PortId parent);`
### `bool set_weight(std::size_t group_id, uint16_t tree_id, uint8_t w);`
### `bool set_epoch(std::size_t group_id, uint16_t tree_id, uint8_t epoch);`
### `const std::vector<McTree> *trees_of(std::size_t group_id) const;`
### `std::size_t group_count() const noexcept;`
### `std::vector<PortId> get_port_list(PacketGroups groups) const;`
## `McTree::MulticastTable::MulticastTable`
`MulticastTable()`
## `McTree::MulticastTable::add_child_port`
`bool add_child_port(std::size_t group_id, uint16_t tree_id, PortId out_port)`
## `McTree::MulticastTable::add_tree`
`bool add_tree(std::size_t group_id, uint16_t tree_id)`
## `McTree::MulticastTable::delete_child_port`
`bool delete_child_port(std::size_t group_id, uint16_t tree_id, PortId out_port)`
## `McTree::MulticastTable::delete_tree`
`bool delete_tree(std::size_t group_id, uint16_t tree_id)`
## `McTree::MulticastTable::get_port_list`
`std::vector<PortId> get_port_list(PacketGroups groups) const`
## `McTree::MulticastTable::group_count`
`std::size_t group_count() const noexcept`
## `McTree::MulticastTable::set_epoch`
`bool set_epoch(std::size_t group_id, uint16_t tree_id, uint8_t epoch)`
## `McTree::MulticastTable::set_parent`
`bool set_parent(std::size_t group_id, uint16_t tree_id, PortId parent)`
## `McTree::MulticastTable::set_weight`
`bool set_weight(std::size_t group_id, uint16_t tree_id, uint8_t w)`
## `McTree::MulticastTable::trees_of`
`const std::vector<McTree> *trees_of(std::size_t group_id) const`

View File

@@ -0,0 +1,7 @@
# network/switch/routing_alg.h
## `dofs::hash_ecmp`
`PortId hash_ecmp(NodeId src_node, PortId src_port, NodeId dst_node, PortId dst_port, uint32_t differentiator, uint16_t port_count) noexcept;`
## `dofs::hash_ecmp`
`inline PortId hash_ecmp(NodeId src_node, NodeId dst_node, uint32_t differentiator, uint16_t port_count) noexcept{`
## `dofs::hash_ecmp`
`return hash_ecmp(src_node, static_cast<PortId>(0), dst_node, static_cast<PortId>(0), differentiator, port_count);`

View File

@@ -0,0 +1,2 @@
# network/switch/routing_tables.h
_No public API symbols found in this header._

View File

@@ -1,5 +1,7 @@
# network/switch/shared_buffer.h
## class SharedBuffer — public interface
### `virtual bool drain_one(PortId port) override;`
## `SharedBuffer::SharedBuffer`
`SharedBuffer(Simulator *const sim, NetworkSwitch *const owner, Bytes total_bytes, uint16_t ports)`
## `SharedBuffer::drain_one`
`virtual bool drain_one(PortId port) override`
## `SharedBuffer::enqueue_packet`
`virtual bool enqueue_packet(const Packet &pkt, PortId egress, FlowPriority prio) override`

View File

@@ -1,19 +1,65 @@
# network/switch/switch_buffer.h
## class NetworkSwitch — public interface
### `virtual ~SwitchBuffer() = default;`
### `Bytes buffer_size() const noexcept;`
### `SwitchBufferType type() const noexcept;`
### `uint16_t port_cnt() const noexcept;`
### `Bytes port_buffered(PortId p) const noexcept;`
### `const std::vector<Bytes> &ports_buffered() const noexcept;`
### `uint8_t share_ctrl() const noexcept;`
### `uint8_t share_mice() const noexcept;`
### `uint8_t share_elephant() const noexcept;`
### `void set_share_ctrl(uint8_t pct) noexcept;`
### `void set_share_mice(uint8_t pct) noexcept;`
### `void set_share_elephant(uint8_t pct) noexcept;`
### `const Simulator *simulator() const noexcept;`
### `const NetworkSwitch *owner() const noexcept;`
### `void set_egress_links(const std::vector<Link*> &links);`
## `SwitchBuffer::PerPortSched::drain_once`
`void drain_once(PortId port)`
## `SwitchBuffer::PerPortSched::drain_one_common`
`bool drain_one_common(PortId port)`
## `SwitchBuffer::PerPortSched::on_dequeue_commit`
`virtual void on_dequeue_commit(PortId port, Bytes sz) = 0`
## `SwitchBuffer::PerPortSched::on_enqueue_cap_check`
`virtual bool on_enqueue_cap_check(PortId port, Bytes sz) = 0`
## `SwitchBuffer::PerPortSched::on_enqueue_commit`
`virtual void on_enqueue_commit(PortId port, Bytes sz) = 0`
## `SwitchBuffer::PerPortSched::queued_bytes_port`
`Bytes queued_bytes_port(PortId p) const noexcept`
## `SwitchBuffer::PerPortSched::queued_bytes_total`
`Bytes queued_bytes_total() const noexcept`
## `SwitchBuffer::PerPortSched::queues_for`
`virtual const std::array<std::deque<Queued>, PRI_COUNT> &queues_for( PortId p) const = 0`
## `SwitchBuffer::PerPortSched::queues_for`
`virtual std::array<std::deque<Queued>, PRI_COUNT> &queues_for(PortId p) = 0`
## `SwitchBuffer::PerPortSched::schedule_drain_if_needed`
`void schedule_drain_if_needed(PortId port)`
## `SwitchBuffer::PerPortSched::try_reserve_and_send`
`std::optional<Time> try_reserve_and_send(PortId port, Queued &q)`
## `SwitchBuffer::buffer_size`
`Bytes buffer_size() const noexcept`
## `SwitchBuffer::drain_one`
`virtual bool drain_one(PortId port) = 0`
## `SwitchBuffer::enqueue_packet`
`virtual bool enqueue_packet(const Packet &pkt, PortId egress, FlowPriority prio) = 0`
## `SwitchBuffer::owner`
`const NetworkSwitch *owner() const noexcept`
## `SwitchBuffer::port_buffered`
`Bytes port_buffered(PortId p) const noexcept`
## `SwitchBuffer::port_cnt`
`uint16_t port_cnt() const noexcept`
## `SwitchBuffer::ports_buffered`
`const std::vector<Bytes> &ports_buffered() const noexcept`
## `SwitchBuffer::set_egress_links`
`void set_egress_links(const std::vector<Link*> &links)`
## `SwitchBuffer::set_share_ctrl`
`void set_share_ctrl(uint8_t pct) noexcept`
## `SwitchBuffer::set_share_elephant`
`void set_share_elephant(uint8_t pct) noexcept`
## `SwitchBuffer::set_share_mice`
`void set_share_mice(uint8_t pct) noexcept`
## `SwitchBuffer::share_ctrl`
`uint8_t share_ctrl() const noexcept`
## `SwitchBuffer::share_elephant`
`uint8_t share_elephant() const noexcept`
## `SwitchBuffer::share_mice`
`uint8_t share_mice() const noexcept`
## `SwitchBuffer::simulator`
`const Simulator *simulator() const noexcept`
## `SwitchBuffer::type`
`SwitchBufferType type() const noexcept`
## `SwitchBuffer::~SwitchBuffer`
`virtual ~SwitchBuffer() = default`
## `drain_once`
`void drain_once(PortId port);`
## `drain_one_common`
`bool drain_one_common(PortId port);`
## `schedule_drain_if_needed`
`void schedule_drain_if_needed(PortId port);`
## `try_reserve_and_send`
`std::optional<Time> try_reserve_and_send(PortId port, Queued &q);`

View File

@@ -1,8 +1,9 @@
# network/switch/unicast_table.h
## class UnicastTable — public interface
### `UnicastTable() = default;`
### `std::vector<PortId> get_port_list(NodeId dst_node, PortId dst_port) const;`
### `bool add_entry(NodeId dst_node, PortId dst_port, PortId out_port);`
### `bool delete_entry(NodeId dst_node, PortId dst_port, PortId out_port);`
## `UnicastTable::UnicastTable`
`UnicastTable() = default`
## `UnicastTable::add_entry`
`bool add_entry(NodeId dst_node, PortId dst_port, PortId out_port)`
## `UnicastTable::delete_entry`
`bool delete_entry(NodeId dst_node, PortId dst_port, PortId out_port)`
## `UnicastTable::get_port_list`
`std::vector<PortId> get_port_list(NodeId dst_node, PortId dst_port) const`