identifier: The PCI address of the port on a node. os_driver: The driver used by this port when the OS is controlling it. Example: i40e os_driver_for_dpdk: The driver the device must be bound to for DPDK to use it, Example: vfio-pci. Note: os_driver and os_driver_f
| 15 | |
| 16 | @dataclass(slots=True) |
| 17 | class Port: |
| 18 | """ |
| 19 | identifier: The PCI address of the port on a node. |
| 20 | |
| 21 | os_driver: The driver used by this port when the OS is controlling it. |
| 22 | Example: i40e |
| 23 | os_driver_for_dpdk: The driver the device must be bound to for DPDK to use it, |
| 24 | Example: vfio-pci. |
| 25 | |
| 26 | Note: os_driver and os_driver_for_dpdk may be the same thing. |
| 27 | Example: mlx5_core |
| 28 | |
| 29 | peer: The identifier of a port this port is connected with. |
| 30 | """ |
| 31 | |
| 32 | identifier: PortIdentifier |
| 33 | os_driver: str |
| 34 | os_driver_for_dpdk: str |
| 35 | peer: PortIdentifier |
| 36 | mac_address: str = "" |
| 37 | logical_name: str = "" |
| 38 | |
| 39 | def __init__(self, node_name: str, config: PortConfig): |
| 40 | self.identifier = PortIdentifier( |
| 41 | node=node_name, |
| 42 | pci=config.pci, |
| 43 | ) |
| 44 | self.os_driver = config.os_driver |
| 45 | self.os_driver_for_dpdk = config.os_driver_for_dpdk |
| 46 | self.peer = PortIdentifier(node=config.peer_node, pci=config.peer_pci) |
| 47 | |
| 48 | @property |
| 49 | def node(self) -> str: |
| 50 | return self.identifier.node |
| 51 | |
| 52 | @property |
| 53 | def pci(self) -> str: |
| 54 | return self.identifier.pci |
| 55 | |
| 56 | |
| 57 | @dataclass(slots=True, frozen=True) |