diff --git a/xoa_driver/__init__.py b/xoa_driver/__init__.py index 4d969994..2b1ec24b 100644 --- a/xoa_driver/__init__.py +++ b/xoa_driver/__init__.py @@ -1,2 +1,2 @@ -__version__ = "2.1.1" +__version__ = "2.1.2" __short_version__ = "2.0" diff --git a/xoa_driver/enums.py b/xoa_driver/enums.py index d8ebd9d7..c5b45fcb 100644 --- a/xoa_driver/enums.py +++ b/xoa_driver/enums.py @@ -161,6 +161,11 @@ LinkTrainEncoding, LinkTrainPresets, AnLtLogControl, + RxEqExtCap, + RxEqExtCapStatus, + PreCodingStatus, + GrayCodingStatus, + Endianness, ) __all__ = ( @@ -324,4 +329,9 @@ "LinkTrainEncoding", "LinkTrainPresets", "AnLtLogControl", + "RxEqExtCap", + "RxEqExtCapStatus", + "PreCodingStatus", + "GrayCodingStatus", + "Endianness", ) diff --git a/xoa_driver/internals/commands/enums.py b/xoa_driver/internals/commands/enums.py index ca1c531f..f0b16e98 100644 --- a/xoa_driver/internals/commands/enums.py +++ b/xoa_driver/internals/commands/enums.py @@ -1192,10 +1192,27 @@ class MulticastHeaderFormat(IntEnum): class PFCMode(IntEnum): - """Priority Flow Control (PFC) Mode""" - + """The PFC CoS value of the stream""" + ZERO = 0 + """the PFC CoS value = 0""" + ONE = 1 + """the PFC CoS value = 1""" + TWO = 2 + """the PFC CoS value = 2""" + THREE = 3 + """the PFC CoS value = 3""" + FOUR = 4 + """the PFC CoS value = 4""" + FIVE = 5 + """the PFC CoS value = 5""" + SIX = 6 + """the PFC CoS value = 6""" + SEVEN = 7 + """the PFC CoS value = 7""" VLAN_PCP = 128 - """VLAN PCP""" + """PFC CoS value is automatically using the outer VLAN PCP value of the stream. If the VLAN field is missing, the stream won't have a PFC CoS.""" + OFF = 129 + """Remove PFC CoS value of the stream.""" class PRBSOnOff(IntEnum): @@ -2459,4 +2476,60 @@ class AnLtLogControl(IntEnum): """link training algorithm -1 state machine transitions""" +class RxEqExtCap(IntEnum): + """Rx Equalizer Advanced Capability type.""" + + CTLE_LOW = 0 + """CTLE low frequency.""" + + CTLE_HIGH = 1 + """CTLE high frequency.""" + + +class RxEqExtCapStatus(IntEnum): + """Status for Rx Equalizer Advanced Capability.""" + + STATUS_AUTO = 0 + """Auto.""" + + STATUS_MANUAL = 1 + """Manual.""" + + STATUS_FREEZE = 2 + """Freeze.""" + + +class PreCodingStatus(IntEnum): + """Rx/Tx Pre-Coding Status.""" + + OFF = 0 + """Off""" + + ON = 1 + """On""" + + AUTO = 2 + """Auto""" + + +class GrayCodingStatus(IntEnum): + """Rx/Tx Gray-Coding Status.""" + + OFF = 0 + """Off""" + + ON = 1 + """On""" + + +class Endianness(IntEnum): + """Endianness (Big/Little Endian).""" + + NORMAL = 0 + """Big Endian""" + + REVERTED = 1 + """Little Endian""" + + # endregion diff --git a/xoa_driver/internals/commands/pp_commands.py b/xoa_driver/internals/commands/pp_commands.py index ad518529..4cb34a9b 100644 --- a/xoa_driver/internals/commands/pp_commands.py +++ b/xoa_driver/internals/commands/pp_commands.py @@ -55,6 +55,11 @@ PRBSPattern, PHYSignalStatus, OnOffDefault, + RxEqExtCap, + RxEqExtCapStatus, + PreCodingStatus, + GrayCodingStatus, + Endianness, ) @@ -1803,7 +1808,7 @@ def set(self, link_training_on_off: OnOff, precode_on_off: OnOffDefault, graycod @dataclass class PP_PHYRXEQ: """ - RX EQ parameters. + RX EQ parameters (For non Freya Modules). """ code: typing.ClassVar[int] = 380 @@ -1853,6 +1858,56 @@ def set(self, auto: int, ctle: int, reserved: int) -> Token[None]: return Token(self._connection, build_set_request(self, module=self._module, port=self._port, indices=[self._serdes_xindex], auto=auto, ctle=ctle, reserved=reserved)) +@register_command +@dataclass +class PP_PHYRXEQ_EXT: + """ + GET/SET RX EQ Advanced parameters(Only for Freya Modules). + """ + + code: typing.ClassVar[int] = 397 + pushed: typing.ClassVar[bool] = True + + _connection: 'interfaces.IConnection' + _module: int + _port: int + _serdes_xindex: int + _capability_type: RxEqExtCap + + class GetDataAttr(ResponseBodyStruct): + status: RxEqExtCapStatus = field(XmpInt()) + """The status of the capability""" + value: int = field(XmpInt()) + """The value for the capability""" + + class SetDataAttr(RequestBodyStruct): + status: RxEqExtCapStatus = field(XmpInt()) + """The status of the capability Auto/Manual/Freeze""" + value: int = field(XmpInt()) + """The value for the capability""" + + def get(self) -> Token[GetDataAttr]: + """Get RX EQ Advanced parameters. + + :return: status Auto/Manual/Freeze, value. + :rtype: PP_PHYRXEQ_EXT.GetDataAttr + """ + + return Token(self._connection, build_get_request(self, module=self._module, port=self._port, indices=[self._serdes_xindex, self._capability_type])) + + def set(self, status: RxEqExtCapStatus, value: int) -> Token[None]: + """Set RX EQ Advanced parameters. + The type of the capability(RxEqExtCap) should be passed as the second index. + + :param status: Auto/Manual/Freeze + :type status: RxEqExtCapStatus + :param value: The value for the capability + :type value: int + """ + + return Token(self._connection, build_set_request(self, module=self._module, port=self._port, indices=[self._serdes_xindex, self._capability_type], status=status, value=value)) + + @register_command @dataclass class PP_AUTONEG: @@ -2088,3 +2143,191 @@ def get(self) -> Token[GetDataAttr]: """ return Token(self._connection, build_get_request(self, module=self._module, port=self._port, indices=[self._lane_xindex])) + +@register_command +@dataclass +class PP_RXPRECODING: + """ + GET/SET Rx Pre-Coding Configurations. + """ + + code: typing.ClassVar[int] = 420 + pushed: typing.ClassVar[bool] = True + + _connection: 'interfaces.IConnection' + _module: int + _port: int + _serdes_xindex: int + + class GetDataAttr(ResponseBodyStruct): + status: PreCodingStatus = field(XmpInt()) + """Status Off/On/Auto""" + endianness: Endianness = field(XmpInt()) + """Endianness Normal/Reverted(BigEndian/LittleEndian)) """ + + class SetDataAttr(RequestBodyStruct): + status: PreCodingStatus = field(XmpInt()) + """Status Off/On/Auto""" + endianness: Endianness = field(XmpInt()) + """Endianness Normal/Reverted(BigEndian/LittleEndian)) """ + + def get(self) -> Token[GetDataAttr]: + """Get the Rx Pre-Coding Configurations. + + :return: Rx Pre-Coding configurations including status, and endianness type. + :rtype: PP_RXPRECODING.GetDataAttr + """ + + return Token(self._connection, build_get_request(self, module=self._module, port=self._port, indices=[self._serdes_xindex])) + + def set(self, status: PreCodingStatus, endianness: Endianness) -> Token[None]: + """Set the Rx Pre-coding settings of the PHY. + + :param status: The status(Off/On/Auto) + :type status: PreCodingStatus + :param endianness: Endianness type + :type endianness: Endianness + """ + + return Token(self._connection, build_set_request(self, module=self._module, port=self._port, indices=[self._serdes_xindex], status=status, endianness=endianness)) + +@register_command +@dataclass +class PP_TXPRECODING: + """ + GET/SET Tx Pre-Coding Configurations. + """ + + code: typing.ClassVar[int] = 421 + pushed: typing.ClassVar[bool] = True + + _connection: 'interfaces.IConnection' + _module: int + _port: int + _serdes_xindex: int + + class GetDataAttr(ResponseBodyStruct): + status: PreCodingStatus = field(XmpInt()) + """Status Off/On/Auto""" + endianness: Endianness = field(XmpInt()) + """Endianness Normal/Reverted(BigEndian/LittleEndian)) """ + + class SetDataAttr(RequestBodyStruct): + status: PreCodingStatus = field(XmpInt()) + """Status Off/On/Auto""" + endianness: Endianness = field(XmpInt()) + """Endianness Normal/Reverted(BigEndian/LittleEndian)) """ + + def get(self) -> Token[GetDataAttr]: + """Get the Tx Pre-Coding Configurations. + + :return: Tx Pre-Coding configurations including status, and endianness type. + :rtype: PP_TXPRECODING.GetDataAttr + """ + + return Token(self._connection, build_get_request(self, module=self._module, port=self._port, indices=[self._serdes_xindex])) + + def set(self, status: PreCodingStatus, endianness: Endianness) -> Token[None]: + """Set the Tx Pre-coding settings of the PHY. + + :param status: The status(Off/On/Auto) + :type status: PreCodingStatus + :param endianness: Endianness type + :type endianness: Endianness + """ + + return Token(self._connection, build_set_request(self, module=self._module, port=self._port, indices=[self._serdes_xindex], status=status, endianness=endianness)) + +@register_command +@dataclass +class PP_RXGRAYCODING: + """ + GET/SET Rx Gray-Coding Configurations. + """ + + code: typing.ClassVar[int] = 422 + pushed: typing.ClassVar[bool] = True + + _connection: 'interfaces.IConnection' + _module: int + _port: int + _serdes_xindex: int + + class GetDataAttr(ResponseBodyStruct): + status: GrayCodingStatus = field(XmpInt()) + """Status Off/On""" + endianness: Endianness = field(XmpInt()) + """Endianness Normal/Reverted(BigEndian/LittleEndian)) """ + + class SetDataAttr(RequestBodyStruct): + status: GrayCodingStatus = field(XmpInt()) + """Status Off/On""" + endianness: Endianness = field(XmpInt()) + """Endianness Normal/Reverted(BigEndian/LittleEndian)) """ + + def get(self) -> Token[GetDataAttr]: + """Get the Rx Gray-Coding Configurations. + + :return: Rx Gray-Coding configurations including status, and endianness type. + :rtype: PP_RXGRAYCODING.GetDataAttr + """ + + return Token(self._connection, build_get_request(self, module=self._module, port=self._port, indices=[self._serdes_xindex])) + + def set(self, status: GrayCodingStatus, endianness: Endianness) -> Token[None]: + """Set the Rx Gray-coding settings of the PHY. + + :param status: The status(Off/On) + :type status: GrayCodingStatus + :param endianness: Endianness type + :type endianness: Endianness + """ + + return Token(self._connection, build_set_request(self, module=self._module, port=self._port, indices=[self._serdes_xindex], status=status, endianness=endianness)) + +@register_command +@dataclass +class PP_TXGRAYCODING: + """ + GET/SET Tx Gray-Coding Configurations. + """ + + code: typing.ClassVar[int] = 423 + pushed: typing.ClassVar[bool] = True + + _connection: 'interfaces.IConnection' + _module: int + _port: int + _serdes_xindex: int + + class GetDataAttr(ResponseBodyStruct): + status: GrayCodingStatus = field(XmpInt()) + """Status Off/On/Auto""" + endianness: Endianness = field(XmpInt()) + """Endianness Normal/Reverted(BigEndian/LittleEndian)) """ + + class SetDataAttr(RequestBodyStruct): + status: GrayCodingStatus = field(XmpInt()) + """Status Off/On/Auto""" + endianness: Endianness = field(XmpInt()) + """Endianness Normal/Reverted(BigEndian/LittleEndian)) """ + + def get(self) -> Token[GetDataAttr]: + """Get the Tx Gray-Coding Configurations. + + :return: Tx Gray-Coding configurations including status, and endianness type. + :rtype: PP_TXGRAYCODING.GetDataAttr + """ + + return Token(self._connection, build_get_request(self, module=self._module, port=self._port, indices=[self._serdes_xindex])) + + def set(self, status: GrayCodingStatus, endianness: Endianness) -> Token[None]: + """Set the Tx Gray-coding settings of the PHY. + + :param status: The status(Off/On/Auto) + :type status: GrayCodingStatus + :param endianness: Endianness type + :type endianness: Endianness + """ + + return Token(self._connection, build_set_request(self, module=self._module, port=self._port, indices=[self._serdes_xindex], status=status, endianness=endianness)) \ No newline at end of file diff --git a/xoa_driver/internals/commands/ps_commands.py b/xoa_driver/internals/commands/ps_commands.py index 579d4f87..55a20847 100644 --- a/xoa_driver/internals/commands/ps_commands.py +++ b/xoa_driver/internals/commands/ps_commands.py @@ -2078,7 +2078,7 @@ def set(self, hex_data: Hex) -> Token[None]: @dataclass class PS_PFCPRIORITY: """ - Set and get the Priority Flow Control (PFC) mode. + Set and get the Priority Flow Control (PFC) Cos value of a stream. """ code: typing.ClassVar[int] = 219 @@ -2090,27 +2090,27 @@ class PS_PFCPRIORITY: _stream_xindex: int class GetDataAttr(ResponseBodyStruct): - pcp: PFCMode = field(XmpByte()) - """coded byte, Priority Flow Control mode.""" + cos: PFCMode = field(XmpByte()) + """coded byte, the Priority Flow Control (PFC) Cos value of a stream.""" class SetDataAttr(RequestBodyStruct): - pcp: PFCMode = field(XmpByte()) - """coded byte, Priority Flow Control mode.""" + cos: PFCMode = field(XmpByte()) + """coded byte, the Priority Flow Control (PFC) Cos value of a stream.""" def get(self) -> Token[GetDataAttr]: - """Get the Priority Flow Control (PFC) mode of a stream. + """Get the the Priority Flow Control (PFC) Cos value of a stream. - :return: the Priority Flow Control mode of the stream + :return: the Priority Flow Control (PFC) Cos value of a stream. :rtype: PS_PFCPRIORITY.GetDataAttr """ return Token(self._connection, build_get_request(self, module=self._module, port=self._port, indices=[self._stream_xindex])) - def set(self, pcp: PFCMode) -> Token[None]: - """Set the Priority Flow Control (PFC) mode of a stream. + def set(self, cos: PFCMode) -> Token[None]: + """Set the Priority Flow Control (PFC) Cos value of a stream. - :param pcp: the Priority Flow Control mode of the stream - :type pcp: str + :param cos: the Priority Flow Control (PFC) Cos value of a stream. + :type cos: PFCMode """ - return Token(self._connection, build_set_request(self, module=self._module, port=self._port, indices=[self._stream_xindex], pcp=pcp)) + return Token(self._connection, build_set_request(self, module=self._module, port=self._port, indices=[self._stream_xindex], cos=cos)) diff --git a/xoa_driver/internals/hli_v1/ports/port_l23/bases/port_reception_statistics.py b/xoa_driver/internals/hli_v1/ports/port_l23/bases/port_reception_statistics.py index fa46d489..3c92222f 100644 --- a/xoa_driver/internals/hli_v1/ports/port_l23/bases/port_reception_statistics.py +++ b/xoa_driver/internals/hli_v1/ports/port_l23/bases/port_reception_statistics.py @@ -74,7 +74,7 @@ def __init__(self, conn: "itf.IConnection", module_id: int, port_id: int) -> Non self.__module_id = module_id self.__port_id = port_id - self.__tpld_ids = PR_TPLDS(conn, module_id, module_id) + self.__tpld_ids = PR_TPLDS(conn, module_id, port_id) self.total = PR_TOTAL(conn, module_id, port_id) """L23 port's total traffic statistics. diff --git a/xoa_driver/internals/hli_v1/ports/port_l23/family_i.py b/xoa_driver/internals/hli_v1/ports/port_l23/family_i.py index 01250142..e7c924ba 100644 --- a/xoa_driver/internals/hli_v1/ports/port_l23/family_i.py +++ b/xoa_driver/internals/hli_v1/ports/port_l23/family_i.py @@ -50,7 +50,7 @@ class FamilyI(BasePortL23Genuine): :type: PcsPma """ - ser_des: Tuple[SerDes, ...] + serdes: Tuple[SerDes, ...] """SerDes index :type: Tuple[SerDes, ...] diff --git a/xoa_driver/internals/hli_v1/ports/port_l23/family_j.py b/xoa_driver/internals/hli_v1/ports/port_l23/family_j.py index b8bc6f64..2b513193 100644 --- a/xoa_driver/internals/hli_v1/ports/port_l23/family_j.py +++ b/xoa_driver/internals/hli_v1/ports/port_l23/family_j.py @@ -33,7 +33,7 @@ class FamilyJ(BasePortL23Genuine): :type: PcsPma """ - ser_des: Tuple[SerDes, ...] + serdes: Tuple[SerDes, ...] """SerDes index :type: Tuple[SerDes, ...] diff --git a/xoa_driver/internals/hli_v1/ports/port_l23/family_k.py b/xoa_driver/internals/hli_v1/ports/port_l23/family_k.py index d49087c1..4c38e837 100644 --- a/xoa_driver/internals/hli_v1/ports/port_l23/family_k.py +++ b/xoa_driver/internals/hli_v1/ports/port_l23/family_k.py @@ -33,7 +33,7 @@ class FamilyK(BasePortL23Genuine): :type: PcsPma """ - ser_des: Tuple[SerDes, ...] + serdes: Tuple[SerDes, ...] """SerDes index :type: Tuple[SerDes, ...] diff --git a/xoa_driver/internals/hli_v1/ports/port_l23/family_l.py b/xoa_driver/internals/hli_v1/ports/port_l23/family_l.py index 3f4020c4..53819ab6 100644 --- a/xoa_driver/internals/hli_v1/ports/port_l23/family_l.py +++ b/xoa_driver/internals/hli_v1/ports/port_l23/family_l.py @@ -35,7 +35,7 @@ class FamilyL(BasePortL23Genuine): :type: PcsPma """ - ser_des: Tuple[SerDes, ...] + serdes: Tuple[SerDes, ...] """SerDes index :type: Tuple[SerDes, ...] diff --git a/xoa_driver/internals/hli_v1/ports/port_l23/family_l1.py b/xoa_driver/internals/hli_v1/ports/port_l23/family_l1.py index 5b0cd241..3fc78ae1 100644 --- a/xoa_driver/internals/hli_v1/ports/port_l23/family_l1.py +++ b/xoa_driver/internals/hli_v1/ports/port_l23/family_l1.py @@ -38,7 +38,7 @@ class FamilyL1(BasePortL23Genuine): :type: PcsPma """ - ser_des: Tuple[SerDes, ...] + serdes: Tuple[SerDes, ...] """SerDes index :type: Tuple[SerDes, ...] @@ -57,7 +57,7 @@ def __init__(self, conn: "itf.IConnection", module_id: int, port_id: int) -> Non async def _setup(self) -> Self: await super()._setup() self.pcs_pma = PcsPma(self._conn, self) - self.ser_des = tuple( + self.serdes = tuple( SerDes(self._conn, *self.kind, serdes_xindex=serdes_xindex) for serdes_xindex in range(self.info.capabilities.serdes_count) ) diff --git a/xoa_driver/internals/hli_v2/ports/port_l23/bases/port_reception_statistics.py b/xoa_driver/internals/hli_v2/ports/port_l23/bases/port_reception_statistics.py index 9d8743bf..e46b0333 100644 --- a/xoa_driver/internals/hli_v2/ports/port_l23/bases/port_reception_statistics.py +++ b/xoa_driver/internals/hli_v2/ports/port_l23/bases/port_reception_statistics.py @@ -60,7 +60,7 @@ def __init__(self, conn: "itf.IConnection", module_id: int, port_id: int) -> Non self.__module_id = module_id self.__port_id = port_id - self.__tpld_ids = PR_TPLDS(conn, module_id, module_id) + self.__tpld_ids = PR_TPLDS(conn, module_id, port_id) self.total = PR_TOTAL(conn, module_id, port_id) """L23 port's total traffic statistics. diff --git a/xoa_driver/internals/hli_v2/ports/port_l23/chimera/pe_custom_distribution.py b/xoa_driver/internals/hli_v2/ports/port_l23/chimera/pe_custom_distribution.py index eca79edc..0c212fd8 100644 --- a/xoa_driver/internals/hli_v2/ports/port_l23/chimera/pe_custom_distribution.py +++ b/xoa_driver/internals/hli_v2/ports/port_l23/chimera/pe_custom_distribution.py @@ -56,7 +56,7 @@ async def delete(self) -> None: self.__observer.notify(observer.IndexEvents.DEL, self) -class CustomDistributions(UserDict[int, "CustomDistribution"]): +class CustomDistributions(UserDict): """Custom distributions""" def __init__(self, conn: "itf.IConnection", module_id: int, port_id: int) -> None: diff --git a/xoa_driver/internals/hli_v2/ports/port_l23/family_l1.py b/xoa_driver/internals/hli_v2/ports/port_l23/family_l1.py index 3cddcc52..16c7f8a9 100644 --- a/xoa_driver/internals/hli_v2/ports/port_l23/family_l1.py +++ b/xoa_driver/internals/hli_v2/ports/port_l23/family_l1.py @@ -31,7 +31,7 @@ def __init__(self, conn: "itf.IConnection", port) -> None: class FamilyL1(BasePortL23Genuine): pcs_pma: PcsPma - ser_des: Tuple[SerDes, ...] + serdes: Tuple[SerDes, ...] def __init__(self, conn: "itf.IConnection", module_id: int, port_id: int) -> None: super().__init__(conn, module_id, port_id) @@ -45,7 +45,7 @@ def __init__(self, conn: "itf.IConnection", module_id: int, port_id: int) -> Non async def _setup(self) -> Self: await super()._setup() self.pcs_pma = PcsPma(self._conn, self) - self.ser_des = tuple( + self.serdes = tuple( SerDes(self._conn, *self.kind, serdes_xindex=serdes_xindex) for serdes_xindex in range(self.info.capabilities.serdes_count) )