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,19 +1,37 @@
# network/link.h
## class Link — public interface
### `void send_pkt(Packet &pkt, NodeId caller);`
### `void schedule_delivery_after(Packet &pkt, NodeId caller, Time after);`
### `Time next_available(NodeId sender) const noexcept;`
### `std::optional<Reservation> reserve(Bytes bytes, NodeId sender) noexcept;`
### `Time serialization_time(Bytes bytes) const noexcept { ... }`
### `return serialization_time(bytes, _bandwidth_gbps_cur);`
### `Time propagation_latency() const noexcept { ... }`
### `LinkId id() const noexcept { ... }`
### `LinkStatus status() const noexcept { ... }`
### `double bandwidth_gbps() const noexcept { ... }`
### `NodeId src_id() const noexcept { ... }`
### `NodeId dst_id() const noexcept { ... }`
### `PortId src_port() const noexcept { ... }`
### `PortId dst_port() const noexcept { ... }`
### `static Time serialization_time(Bytes bytes, double gbps) noexcept;`
## `Link::Link`
`Link(Simulator *const sim, LinkId id, NetworkNode *a, PortId a_port, NetworkNode *b, PortId b_port, Time latency, double bandwidth_gbps) noexcept`
## `Link::bandwidth_gbps`
`double bandwidth_gbps() const noexcept`
## `Link::dst_id`
`NodeId dst_id() const noexcept`
## `Link::dst_port`
`PortId dst_port() const noexcept`
## `Link::id`
`LinkId id() const noexcept`
## `Link::next_available`
`Time next_available(NodeId sender) const noexcept`
## `Link::propagation_latency`
`Time propagation_latency() const noexcept`
## `Link::reserve`
`std::optional<Reservation> reserve(Bytes bytes, NodeId sender) noexcept`
## `Link::schedule_delivery_after`
`void schedule_delivery_after(Packet &pkt, NodeId caller, Time after)`
## `Link::send_pkt`
`void send_pkt(Packet &pkt, NodeId caller)`
## `Link::serialization_time`
`Time serialization_time(Bytes bytes) const noexcept`
## `Link::serialization_time`
`static Time serialization_time(Bytes bytes, double gbps) noexcept`
## `Link::set_status`
`void set_status(LinkStatus s, Time new_latency = Time(0), double new_bandwidth_gbps = 0.0)`
## `Link::src_id`
`NodeId src_id() const noexcept`
## `Link::src_port`
`PortId src_port() const noexcept`
## `Link::status`
`LinkStatus status() const noexcept`
## `serialization_time`
`static Time serialization_time(Bytes bytes, double gbps) noexcept;`
## `set_status`
`void set_status(LinkStatus s, Time new_latency = Time(0), double new_bandwidth_gbps = 0.0);`

View File

@@ -1,11 +1,95 @@
# network/network_nic.h
## class NetworkNic — public interface
### `virtual void recv_pkt(Packet &pkt, PortId ingress) override;`
### `void attach_host(Host* host) noexcept;`
### `void detach_host(Host* host) noexcept;`
### `void set_status(NodeStatus s, Time new_latency = Time(0)) noexcept;`
### `const NicTelemetry &telemetry() const noexcept { ... }`
### `void set_port_blacklisted(PortId port, bool blacklisted) noexcept;`
### `bool is_port_blacklisted(PortId port) const noexcept;`
## `NicSchedulingWeights::NetworkNic::NetworkNic`
`NetworkNic(Simulator *const sim, NodeId id, uint16_t total_ports, SwitchBuffer *const buf, Time nic_latency, Bytes mice_elephant_threshold, PacketSeq ooo_threshold, CCType cc_type, LBType lb_type, Bytes cc_init_cwnd, Bytes cc_max_cwnd, const NicSchedulingWeights &schedw) noexcept`
## `NicSchedulingWeights::NetworkNic::PortQueues::enqueue_packet`
`void enqueue_packet(PortId port, QClass cls, Packet pkt) noexcept`
## `NicSchedulingWeights::NetworkNic::PortQueues::is_elephant`
`bool is_elephant(Bytes sz) const noexcept`
## `NicSchedulingWeights::NetworkNic::PortQueues::lookup_rtt_and_erase`
`bool lookup_rtt_and_erase(const Packet &ack_like, Time now, Time &out_rtt) noexcept`
## `NicSchedulingWeights::NetworkNic::PortQueues::make_ack_packet`
`Packet make_ack_packet(const Packet &rx_data, PortId ingress) noexcept`
## `NicSchedulingWeights::NetworkNic::PortQueues::make_data_packet`
`Packet make_data_packet(NodeId dst, PortId out_port, FlowPriority prio, FlowId fid, PacketSeq seq, Bytes payload) noexcept`
## `NicSchedulingWeights::NetworkNic::PortQueues::make_nack_packet`
`Packet make_nack_packet(NodeId peer, FlowId flow, PacketSeq miss, FlowPriority prio, PortId ingress) noexcept`
## `NicSchedulingWeights::NetworkNic::PortQueues::make_trim_back_response`
`Packet make_trim_back_response(const Packet &trim, PortId ingress) noexcept`
## `NicSchedulingWeights::NetworkNic::PortQueues::pick_next_qclass`
`bool pick_next_qclass(const PortQueues &pq, QClass &out_cls) const noexcept`
## `NicSchedulingWeights::NetworkNic::PortQueues::pick_src_port_for_flow`
`PortId pick_src_port_for_flow(NodeId dst) noexcept`
## `NicSchedulingWeights::NetworkNic::PortQueues::port_drain_task`
`void port_drain_task(PortId port) noexcept`
## `NicSchedulingWeights::NetworkNic::PortQueues::record_tx_timestamp`
`void record_tx_timestamp(const Packet &pkt) noexcept`
## `NicSchedulingWeights::NetworkNic::PortQueues::schedule_ack`
`void schedule_ack(const Packet &rx_data, PortId ingress) noexcept`
## `NicSchedulingWeights::NetworkNic::PortQueues::schedule_nack`
`void schedule_nack(NodeId peer, FlowId flow, PacketSeq missing_seq, FlowPriority prio, PortId ingress) noexcept`
## `NicSchedulingWeights::NetworkNic::PortQueues::schedule_port_if_needed`
`void schedule_port_if_needed(PortId port) noexcept`
## `NicSchedulingWeights::NetworkNic::PortQueues::schedule_trim_back_response`
`void schedule_trim_back_response(const Packet &trim, PortId ingress) noexcept`
## `NicSchedulingWeights::NetworkNic::PortQueues::start_tx_multicast`
`void start_tx_multicast(PacketGroups gmask, Bytes size, FlowPriority prio)`
## `NicSchedulingWeights::NetworkNic::PortQueues::start_tx_unicast`
`void start_tx_unicast(NodeId dst, Bytes size, FlowPriority prio)`
## `NicSchedulingWeights::NetworkNic::PortQueues::try_send_one`
`bool try_send_one(PortId port, QClass cls) noexcept`
## `NicSchedulingWeights::NetworkNic::PortQueues::txkey`
`static inline std::uint64_t txkey(FlowId f, PacketSeq s) noexcept`
## `NicSchedulingWeights::NetworkNic::attach_host`
`void attach_host(Host *host) noexcept`
## `NicSchedulingWeights::NetworkNic::detach_host`
`void detach_host(Host *host) noexcept`
## `NicSchedulingWeights::NetworkNic::is_port_blacklisted`
`bool is_port_blacklisted(PortId port) const noexcept`
## `NicSchedulingWeights::NetworkNic::recv_pkt`
`virtual void recv_pkt(Packet &pkt, PortId ingress) override`
## `NicSchedulingWeights::NetworkNic::send_flow`
`void send_flow(NodeId dst, Bytes size, FlowPriority desired = FlowPriority::AUTO)`
## `NicSchedulingWeights::NetworkNic::send_flow`
`void send_flow(PacketGroups group_mask, Bytes size, FlowPriority desired = FlowPriority::AUTO)`
## `NicSchedulingWeights::NetworkNic::set_port_blacklisted`
`void set_port_blacklisted(PortId port, bool blacklisted) noexcept`
## `NicSchedulingWeights::NetworkNic::set_status`
`void set_status(NodeStatus s, Time new_latency = Time(0)) noexcept`
## `NicSchedulingWeights::NetworkNic::telemetry`
`const NicTelemetry &telemetry() const noexcept`
## `enqueue_packet`
`void enqueue_packet(PortId port, QClass cls, Packet pkt) noexcept;`
## `lookup_rtt_and_erase`
`bool lookup_rtt_and_erase(const Packet &ack_like, Time now, Time &out_rtt) noexcept;`
## `make_ack_packet`
`Packet make_ack_packet(const Packet &rx_data, PortId ingress) noexcept;`
## `make_data_packet`
`Packet make_data_packet(NodeId dst, PortId out_port, FlowPriority prio, FlowId fid, PacketSeq seq, Bytes payload) noexcept;`
## `make_nack_packet`
`Packet make_nack_packet(NodeId peer, FlowId flow, PacketSeq miss, FlowPriority prio, PortId ingress) noexcept;`
## `make_trim_back_response`
`Packet make_trim_back_response(const Packet &trim, PortId ingress) noexcept;`
## `pick_src_port_for_flow`
`PortId pick_src_port_for_flow(NodeId dst) noexcept;`
## `port_drain_task`
`void port_drain_task(PortId port) noexcept;`
## `record_tx_timestamp`
`void record_tx_timestamp(const Packet &pkt) noexcept;`
## `schedule_ack`
`void schedule_ack(const Packet &rx_data, PortId ingress) noexcept;`
## `schedule_nack`
`void schedule_nack(NodeId peer, FlowId flow, PacketSeq missing_seq, FlowPriority prio, PortId ingress) noexcept;`
## `schedule_port_if_needed`
`void schedule_port_if_needed(PortId port) noexcept;`
## `schedule_trim_back_response`
`void schedule_trim_back_response(const Packet &trim, PortId ingress) noexcept;`
## `set_port_blacklisted`
`void set_port_blacklisted(PortId port, bool blacklisted) noexcept;`
## `start_tx_multicast`
`void start_tx_multicast(PacketGroups gmask, Bytes size, FlowPriority prio);`
## `start_tx_unicast`
`void start_tx_unicast(NodeId dst, Bytes size, FlowPriority prio);`
## `try_send_one`
`bool try_send_one(PortId port, QClass cls) noexcept;`
## `txkey`
`static inline std::uint64_t txkey(FlowId f, PacketSeq s) noexcept;`

View File

@@ -1,6 +1,7 @@
# network/network_node.h
## class NetworkNode — public interface
### `explicit NetworkNode(Simulator *const sim, NodeId id, NodeType type) noexcept;`
### `virtual ~NetworkNode() = default;`
## `NetworkNode::NetworkNode`
`explicit NetworkNode(Simulator *const sim, NodeId id, NodeType type) noexcept`
## `NetworkNode::recv_pkt`
`virtual void recv_pkt(Packet &pkt, PortId ingress) = 0`
## `NetworkNode::~NetworkNode`
`virtual ~NetworkNode() = default`

View File

@@ -1,9 +1,19 @@
# network/network_switch.h
## class NetworkSwitch — public interface
### `virtual void recv_pkt(Packet &pkt, PortId ingress) override;`
### `void set_status(NodeStatus s, Time new_forward_latency = Time(0)) noexcept;`
### `NodeStatus get_status() const noexcept { ... }`
### `return status();`
### `uint16_t port_cnt() const noexcept { ... }`
## `NetworkSwitch::NetworkSwitch`
`NetworkSwitch(Simulator *const sim, NodeId id, uint16_t total_ports, ECNEngine *const ecn, SwitchBuffer *const buf, const RoutingTables *const rt, Time forwarding_latency, Time multicast_dup_delay) noexcept`
## `NetworkSwitch::get_status`
`NodeStatus get_status() const noexcept`
## `NetworkSwitch::port_cnt`
`uint16_t port_cnt() const noexcept`
## `NetworkSwitch::recv_pkt`
`virtual void recv_pkt(Packet &pkt, PortId ingress) override`
## `NetworkSwitch::set_status`
`void set_status(NodeStatus s, Time new_forward_latency = Time(0)) noexcept`
## `enqueue_one`
`void enqueue_one(Packet pkt, PortId egress, FlowPriority prio) noexcept;`
## `forward_after_delay`
`private: void forward_after_delay(Packet pkt, PortId ingress) noexcept;`
## `group_bit_set`
`static inline bool group_bit_set(PacketGroups mask, std::size_t gid) noexcept;`
## `merge_sorted_unique`
`static void merge_sorted_unique(std::vector<PortId> &base, const std::vector<PortId> &add);`

View File

@@ -1,18 +1,21 @@
# network/nic/congestion_control.h
## class CongestionControl — public interface
### `explicit CongestionControl(Bytes init_cwnd, Bytes max_cwnd) noexcept;`
### `virtual ~CongestionControl() = default;`
### `Bytes cwnd() const noexcept { ... }`
### `Bytes cwnd_max() const noexcept { ... }`
## class DCQCN — public interface
### `explicit DCQCN(Bytes init_cwnd, Bytes max_cwnd) noexcept;`
### `virtual void update(const Packet& pkt, Time rtt) noexcept override;`
## class NSCC — public interface
### `explicit NSCC(Bytes init_cwnd, Bytes max_cwnd) noexcept;`
### `virtual void update(const Packet& pkt, Time rtt) noexcept override;`
## `CongestionControl::CongestionControl`
`explicit CongestionControl(Bytes init_cwnd, Bytes max_cwnd) noexcept`
## `CongestionControl::cwnd`
`Bytes cwnd() const noexcept`
## `CongestionControl::cwnd_max`
`Bytes cwnd_max() const noexcept`
## `CongestionControl::is_allowed_to_send`
`virtual bool is_allowed_to_send(Bytes bytes_outstanding, Bytes next_bytes) const noexcept`
## `CongestionControl::update`
`virtual void update(const Packet &pkt, Time rtt) noexcept = 0`
## `CongestionControl::~CongestionControl`
`virtual ~CongestionControl() = default`
## `DCQCN::DCQCN`
`explicit DCQCN(Bytes init_cwnd, Bytes max_cwnd) noexcept`
## `DCQCN::update`
`virtual void update(const Packet &pkt, Time rtt) noexcept override`
## `NSCC::NSCC`
`explicit NSCC(Bytes init_cwnd, Bytes max_cwnd) noexcept`
## `NSCC::update`
`virtual void update(const Packet &pkt, Time rtt) noexcept override`

View File

@@ -1,12 +1,15 @@
# network/nic/load_balance.h
## class LoadBalance — public interface
### `explicit LoadBalance(Rng *const rng) noexcept : _rng(rng) { ... }`
### `virtual ~LoadBalance() = default;`
## class LBRandomPacketSpraying — public interface
### `explicit LBRandomPacketSpraying(Rng *const rng) noexcept : LoadBalance(rng) { ... }`
### `virtual void update(const Packet& pkt) noexcept override;`
### `virtual uint16_t get_entropy(const Packet& context) noexcept override;`
## `LBRandomPacketSpraying::LBRandomPacketSpraying`
`explicit LBRandomPacketSpraying(Rng *const rng) noexcept : LoadBalance(rng)`
## `LBRandomPacketSpraying::get_entropy`
`virtual uint16_t get_entropy(const Packet &context) noexcept override`
## `LBRandomPacketSpraying::update`
`virtual void update(const Packet &pkt) noexcept override`
## `LoadBalance::LoadBalance`
`explicit LoadBalance(Rng *const rng) noexcept : _rng(rng)`
## `LoadBalance::get_entropy`
`virtual uint16_t get_entropy(const Packet &context) noexcept = 0`
## `LoadBalance::update`
`virtual void update(const Packet &pkt) noexcept = 0`
## `LoadBalance::~LoadBalance`
`virtual ~LoadBalance() = default`

View File

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

View File

@@ -1,35 +1,65 @@
# network/packet.h
## class Packet — public interface
### `NodeId src_node() const noexcept;`
### `PortId src_port() const noexcept;`
### `NodeId dst_node() const noexcept;`
### `PortId dst_port() const noexcept;`
### `PacketProtocol protocol() const noexcept;`
### `PacketSeq seq() const noexcept;`
### `FlowId flow_id() const noexcept;`
### `uint32_t entropy() const noexcept;`
### `void set_src_node(NodeId n) noexcept;`
### `void set_src_port(PortId p) noexcept;`
### `void set_dst_node(NodeId n) noexcept;`
### `void set_dst_port(PortId p) noexcept;`
### `void set_seq(PacketSeq s) noexcept;`
### `void set_flow_id(FlowId f) noexcept;`
### `void set_entropy(uint32_t e) noexcept;`
### `void set_protocol(PacketProtocol p) noexcept;`
### `void set_payload_size(Bytes size) noexcept;`
### `void set_ecn_enabled(bool v) noexcept;`
### `void set_ecn_marked(bool v) noexcept;`
### `void set_eof(bool v) noexcept;`
### `bool is_ecn_enabled() const noexcept;`
### `bool is_ecn() const noexcept;`
### `bool is_eof() const noexcept;`
### `FlowPriority priority() const noexcept;`
### `uint8_t priority_raw() const noexcept;`
### `Bytes header_size() const noexcept;`
### `Bytes payload_size() const noexcept;`
### `Bytes total_size() const noexcept;`
### `PacketGroups groups() const noexcept;`
### `void set_groups(PacketGroups g) noexcept;`
### `void add_groups(PacketGroups gmask) noexcept;`
## `Packet::Packet`
`Packet(NodeId src_node, PortId src_port, NodeId dst_node, PortId dst_port, PacketProtocol proto, FlowPriority prio, PacketSeq seq = 0, FlowId flow = 0, uint16_t entropy = 0, uint8_t notifications = 0, Bytes payload_bytes = DEFAULT_MSS_BYTES) noexcept`
## `Packet::add_groups`
`void add_groups(PacketGroups gmask) noexcept`
## `Packet::dst_node`
`NodeId dst_node() const noexcept`
## `Packet::dst_port`
`PortId dst_port() const noexcept`
## `Packet::entropy`
`uint32_t entropy() const noexcept`
## `Packet::flow_id`
`FlowId flow_id() const noexcept`
## `Packet::groups`
`PacketGroups groups() const noexcept`
## `Packet::header_size`
`Bytes header_size() const noexcept`
## `Packet::is_ecn`
`bool is_ecn() const noexcept`
## `Packet::is_ecn_enabled`
`bool is_ecn_enabled() const noexcept`
## `Packet::is_eof`
`bool is_eof() const noexcept`
## `Packet::payload_size`
`Bytes payload_size() const noexcept`
## `Packet::priority`
`FlowPriority priority() const noexcept`
## `Packet::priority_raw`
`uint8_t priority_raw() const noexcept`
## `Packet::protocol`
`PacketProtocol protocol() const noexcept`
## `Packet::seq`
`PacketSeq seq() const noexcept`
## `Packet::set_dst_node`
`void set_dst_node(NodeId n) noexcept`
## `Packet::set_dst_port`
`void set_dst_port(PortId p) noexcept`
## `Packet::set_ecn_enabled`
`void set_ecn_enabled(bool v) noexcept`
## `Packet::set_ecn_marked`
`void set_ecn_marked(bool v) noexcept`
## `Packet::set_entropy`
`void set_entropy(uint32_t e) noexcept`
## `Packet::set_eof`
`void set_eof(bool v) noexcept`
## `Packet::set_flow_id`
`void set_flow_id(FlowId f) noexcept`
## `Packet::set_groups`
`void set_groups(PacketGroups g) noexcept`
## `Packet::set_payload_size`
`void set_payload_size(Bytes size) noexcept`
## `Packet::set_protocol`
`void set_protocol(PacketProtocol p) noexcept`
## `Packet::set_seq`
`void set_seq(PacketSeq s) noexcept`
## `Packet::set_src_node`
`void set_src_node(NodeId n) noexcept`
## `Packet::set_src_port`
`void set_src_port(PortId p) noexcept`
## `Packet::src_node`
`NodeId src_node() const noexcept`
## `Packet::src_port`
`PortId src_port() const noexcept`
## `Packet::total_size`
`Bytes total_size() const noexcept`

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`