107 lines
2.8 KiB
C++
107 lines
2.8 KiB
C++
#pragma once
|
|
|
|
|
|
#include <cstdint>
|
|
#include <array>
|
|
|
|
class Port {
|
|
public:
|
|
Port(uint32_t index, uint32_t logicalPort, uint32_t physicalPort) : m_portIndex(index), m_logicalPort(logicalPort), m_physicalPort(physicalPort){
|
|
|
|
}
|
|
|
|
uint32_t getPortIndex() const{
|
|
return m_portIndex;
|
|
}
|
|
|
|
uint32_t getLogicalPort() const{
|
|
return m_logicalPort;
|
|
}
|
|
|
|
uint32_t getPhysicalPort() const{
|
|
return m_physicalPort;
|
|
}
|
|
|
|
enum class PortType {
|
|
None,
|
|
EPL,
|
|
PCIE,
|
|
TUNNEL,
|
|
LOOPBACK,
|
|
FIBM
|
|
};
|
|
|
|
enum class InterfaceType {
|
|
None = 0,
|
|
SFPP = 1,
|
|
QSFP_LANE0 = 2,
|
|
QSFP_LANE1 = 3,
|
|
QSFP_LANE2 = 4,
|
|
QSFP_LANE3 = 5,
|
|
QSFP_PCIE = 6,
|
|
};
|
|
|
|
enum class EthernetMode {
|
|
/** Port is disabled on the specified MAC. No lanes will be used.
|
|
* A port must be put in this state when another port sharing the
|
|
* same MAC is using a 4-lane mode. */
|
|
Disabled = 0,
|
|
|
|
/** AN-73: Auto-negotiation Clause 73. */
|
|
AN_73,
|
|
|
|
|
|
/** 10GBASE-CR (SFP+): 10G, 1 lane, 64b/66b encoding. */
|
|
ETH_10GBASE_CR,
|
|
/** 10GBASE-SR (SFP+, SFI): 10G, 1 lane, 64b/66b encoding. */
|
|
ETH_10GBASE_SR,
|
|
|
|
/** 25GBASE-SR (SFP+, SFI): 25G, 1 lane, 64/66b encoding. */
|
|
ETH_25GBASE_SR,
|
|
/** 25GBASE-CR: 25G, 1 lane, 64/66b encoding.
|
|
* This mode is read-only, i.e., it can be set only through Clause-73
|
|
* autonegotiation. */
|
|
ETH_25GBASE_CR,
|
|
|
|
/** 40GBASE-CR4 (QSFP 5M Direct Attach): 40G, 4 lane, 64b/66b encoding.
|
|
* This mode is read-only, i.e., it can be set only through Clause-73
|
|
* autonegotiation. */
|
|
ETH_40GBASE_CR4,
|
|
/** 40GBASE-SR4 (QSFP PMD Service Interface): 40G, 4 lane, 64b/66b
|
|
* encoding. */
|
|
ETH_40GBASE_SR4,
|
|
|
|
/** 100GBASE-SR4 (QSFP PMD Service Interface): 100G, 4 lane, 64b/66b
|
|
* encoding. */
|
|
ETH_100GBASE_SR4,
|
|
/** 40GBASE-CR4: 100G, 4 lanes, 64b/66b encoding. This mode is read-only,
|
|
* i.e., it can be set only through Clause-73 autonegotiation. */
|
|
ETH_100GBASE_CR4
|
|
|
|
};
|
|
|
|
EthernetMode m_ethernetMode = EthernetMode::Disabled;
|
|
|
|
|
|
PortType m_portType = PortType::None;
|
|
InterfaceType m_interfaceType = InterfaceType::None;
|
|
|
|
/* EPL number associated to this port */
|
|
uint32_t m_eplNumber;
|
|
/* PEP number associated to this port */
|
|
uint32_t m_pepNumber;
|
|
/* TUNNEL number associated to this port */
|
|
uint32_t m_tunnelNumber;
|
|
/* LOOPBACK number associated to this port */
|
|
uint32_t m_loopbackNumber;
|
|
/* LANE number associated to this port */
|
|
std::array<uint32_t, 4> m_lane;
|
|
|
|
private:
|
|
uint32_t m_portIndex;
|
|
uint32_t m_logicalPort;
|
|
uint32_t m_physicalPort;
|
|
};
|
|
|
|
|