Update README and add contrib dir

This commit is contained in:
2025-12-01 15:56:02 +01:00
parent 1b80de2153
commit cd9ba93d58
150 changed files with 25563 additions and 0 deletions

View File

@@ -0,0 +1,220 @@
#ifndef EVB_LAN9668_H
#define EVB_LAN9668_H
#include "ns3/object.h"
#include "ns3/tsn-node.h"
#include "ns3/tsn-net-device.h"
#include "ns3/stream-identification-function-null.h"
namespace ns3
{
/**
* \ingroup real-device
*
* \brief A object to simulate EVB-LAN9668 switch.
*/
class EvbLan9668: public Object
{
public:
/**
* \brief Get the TypeId
*
* \return The TypeId for this class
*/
static TypeId GetTypeId();
/**
* \brief Create a EvbLan9668
*/
EvbLan9668();
/**
* \brief Create a EvbLan9668
*/
EvbLan9668(std::string name);
/**
* Destroy a EvbLan9668
*
* This is the destructor for the TsnNode.
*/
~EvbLan9668();
// Delete copy constructor and assignment operator to avoid misuse
EvbLan9668& operator=(const EvbLan9668&) = delete;
EvbLan9668(const EvbLan9668&) = delete;
/**
* \brief Set most of the hardware limits
*/
void SetHardwareLimits();
/**
* \brief Get a TsnNetDevice from its port id
* \param id the port id
* \return The TsnNetDevice
*/
Ptr<TsnNetDevice> GetPort(int id);
/**
* \brief Add a entry in the forwarding database
* \param dest the mac address destination
* \param vlan_id the vlan id
* \param output_port_ids a vector of output port id
*/
void AddForwardingTableEntry(
Mac48Address dest,
uint16_t vlan_id,
std::vector<uint32_t> output_port_ids);
/**
* \brief Set the datarate of a port
* \param id the port id
* \param d the datarate
*/
void SetPortDatarate(int id, DataRate d);
/**
* \brief Add a CBS instance to a port and queue
* \para the port id
* \param the queue id
* \param the iddle_slope
* \param the port_transmit_rate
*/
void AddCbs(uint32_t port_id, uint32_t queue_id, DataRate iddle_slope, DataRate port_transmit_rate);
/**
* \brief Add a GCL entry to a port
* \para the port id
* \param the GCL entry duration
* \param the GCL entry state
*/
void AddGclEntry(uint32_t port_id, Time interval, uint8_t state);
/**
* \brief Start TAS operation
*/
void StartTas();
/**
* \brief Add a null stream identification function
* \para streamHandle
* \param stream Identification Function
* \param out-facing input port ids
* \param in-facing input port ids
* \param in-facing output port ids
* \param out-facing output port ids
*/
void
AddNullStreamIdentificationFunction(
uint32_t streamHandle,
Ptr<NullStreamIdentificationFunction> streamIdentificationFunction,
std::vector<uint32_t> outFacInputPortIds,
std::vector<uint32_t> inFacInputPortIds,
std::vector<uint32_t> inFacOutputPortIds,
std::vector<uint32_t> outFacOutputPortIds);
/**
* \brief Add a stream filter to the node
* \param the stream filter instance
*/
void
AddStreamFilter(Ptr<StreamFilterInstance> streamFilterInstance);
/**
* \brief Add a flow meter to the node
* \param the flow meter instance
*/
uint16_t
AddFlowMeter(Ptr<FlowMeterInstance> flowMeterInstance);
/**
* \brief Add generation function to the node
* \param the genertation function
*/
void
AddSequenceGenerationFunction(Ptr<SequenceGenerationFunction> entry);
/**
* \brief Add recovery function to the node
* \param the recovery function
* \param the recovery algo (match or vector)
* \param the latent error detection function
* \param the port ids
*/
void
AddSequenceRecoveryFunction(Ptr<SequenceRecoveryFunction> rcvy, Ptr<BaseRecoveryFunction> algo, Ptr<LatentErrorDetectionFunction> lat, std::vector<uint32_t> port_ids);
/**
* \brief Add encode/decode function to the node
* \param the encode/decode function
* \param the port id
*/
void
AddSequenceEncodeDecodeFunction(Ptr<SequenceEncodeDecodeFunction> entry, uint32_t port_id);
protected:
private:
Ptr<TsnNode> m_node;
std::vector<Ptr<TsnNetDevice>> m_net_devices;
Ptr<SwitchNetDevice> m_switch_net_device;
//Hardware limits
uint16_t m_portNumber = 8;
uint16_t m_queuesPerPort = 8;
uint16_t m_maxFdbEntryNumber = 64;
QueueSize m_fifoSize = QueueSize("102p");
Time m_minForwardingLatency = NanoSeconds(2660); //2660
Time m_maxForwardingLatency = NanoSeconds(2370); //2370
//CBS
DataRate m_maxIddleSlope = DataRate("3.282Gb/s");
Time m_minCBSLatencyOverhead = NanoSeconds(0); //-25ns
Time m_maxCBSLatencyOverhead = NanoSeconds(0); //-9ns
//Tas
uint32_t m_maxGclEntryNumber = 256;
Time m_maxGclCycleDuration = NanoSeconds(999999999);
Time m_maxGclTimeInterval = NanoSeconds(999999999);
Time m_minTASLatencyOverhead = NanoSeconds(0);
Time m_maxTASLatencyOverhead = NanoSeconds(0);
//Stream identification
uint32_t m_maxSidEntryNumber = 127;
Time m_minNullSIDLatencyOverhead = NanoSeconds(0); //-9ns
Time m_maxNullSIDLatencyOverhead = NanoSeconds(0); //-13ns
Time m_minSourceMacSIDLatencyOverhead = NanoSeconds(0);
Time m_maxSourceMacSIDLatencyOverhead = NanoSeconds(0);
//PSFP
uint32_t m_maxPsfpFilterEntryNumber = 176;
uint32_t m_maxPsfpStreamGateEntryNumber = 176;
uint32_t m_maxPsfpFlowMeterEntryNumber = 240;
//FRER
uint32_t m_maxFrerSeqGenEntryNumber = 99;
uint32_t m_maxFrerSeqRcvyEntryNumber = 99;
uint32_t m_maxFrerSeqEncEntryNumber = 99;
Time m_minFrerSeqRcvyResetDuration = MilliSeconds(1);
Time m_maxFrerSeqRcvyResetDuration = Seconds(4.095);
Time m_minFrerLatErrorTestDuration = Seconds(1);
Time m_maxFrerLatErrorTestDuration = Seconds(86400);
Time m_minFrerLatErrorResetDuration = Seconds(1);
Time m_maxFrerLatErrorResetDuration = Seconds(86400);
Time m_minFrerRcvyLatencyOverhead = NanoSeconds(40); //40ns
Time m_maxFrerRcvyLatencyOverhead = NanoSeconds(40); //40ns
};
}
#endif /* EVB_LAN9668_H */