1# SPDX-License-Identifier: BSD-3-Clause 2# Copyright(c) 2024 Arm Limited 3 4"""Module containing TypeDict-equivalents of Params classes for static typing and hinting. 5 6TypedDicts can be used in conjunction with Unpack and kwargs for type hinting on function calls. 7 8Example: 9 .. code:: python 10 11 def create_testpmd(**kwargs: Unpack[TestPmdParamsDict]): 12 params = TestPmdParams(**kwargs) 13""" 14 15from pathlib import PurePath 16from typing import TypedDict 17 18from framework.params import Switch, YesNoSwitch 19from framework.params.testpmd import ( 20 AnonMempoolAllocationMode, 21 EthPeer, 22 Event, 23 FlowGenForwardingMode, 24 HairpinMode, 25 NoisyForwardingMode, 26 Params, 27 PortNUMAConfig, 28 PortTopology, 29 RingNUMAConfig, 30 RSSSetting, 31 RXMultiQueueMode, 32 RXRingParams, 33 SimpleForwardingModes, 34 SimpleMempoolAllocationMode, 35 TxIPAddrPair, 36 TXOnlyForwardingMode, 37 TXRingParams, 38 TxUDPPortPair, 39) 40from framework.testbed_model.cpu import LogicalCoreList 41from framework.testbed_model.port import Port 42from framework.testbed_model.virtual_device import VirtualDevice 43 44 45class EalParamsDict(TypedDict, total=False): 46 """:class:`TypedDict` equivalent of :class:`~.eal.EalParams`.""" 47 48 lcore_list: LogicalCoreList | None 49 memory_channels: int | None 50 prefix: str 51 no_pci: Switch 52 vdevs: list[VirtualDevice] | None 53 allowed_ports: list[Port] | None 54 blocked_ports: list[Port] | None 55 other_eal_param: Params | None 56 57 58class TestPmdParamsDict(EalParamsDict, total=False): 59 """:class:`TypedDict` equivalent of :class:`~.testpmd.TestPmdParams`.""" 60 61 interactive_mode: Switch 62 auto_start: Switch 63 tx_first: Switch 64 stats_period: int | None 65 display_xstats: list[str] | None 66 nb_cores: int | None 67 coremask: int | None 68 nb_ports: int | None 69 port_topology: PortTopology | None 70 portmask: int | None 71 portlist: str | None 72 numa: YesNoSwitch 73 socket_num: int | None 74 port_numa_config: list[PortNUMAConfig] | None 75 ring_numa_config: list[RingNUMAConfig] | None 76 total_num_mbufs: int | None 77 mbuf_size: list[int] | None 78 mbcache: int | None 79 max_pkt_len: int | None 80 eth_peers_configfile: PurePath | None 81 eth_peer: list[EthPeer] | None 82 tx_ip: TxIPAddrPair | None 83 tx_udp: TxUDPPortPair | None 84 enable_lro: Switch 85 max_lro_pkt_size: int | None 86 disable_crc_strip: Switch 87 enable_scatter: Switch 88 enable_hw_vlan: Switch 89 enable_hw_vlan_filter: Switch 90 enable_hw_vlan_strip: Switch 91 enable_hw_vlan_extend: Switch 92 enable_hw_qinq_strip: Switch 93 pkt_drop_enabled: Switch 94 rss: RSSSetting | None 95 forward_mode: ( 96 SimpleForwardingModes 97 | FlowGenForwardingMode 98 | TXOnlyForwardingMode 99 | NoisyForwardingMode 100 | None 101 ) 102 hairpin_mode: HairpinMode | None 103 hairpin_queues: int | None 104 burst: int | None 105 enable_rx_cksum: Switch 106 rx_queues: int | None 107 rx_ring: RXRingParams | None 108 no_flush_rx: Switch 109 rx_segments_offsets: list[int] | None 110 rx_segments_length: list[int] | None 111 multi_rx_mempool: Switch 112 rx_shared_queue: Switch | int 113 rx_offloads: int | None 114 rx_mq_mode: RXMultiQueueMode | None 115 tx_queues: int | None 116 tx_ring: TXRingParams | None 117 tx_offloads: int | None 118 eth_link_speed: int | None 119 disable_link_check: Switch 120 disable_device_start: Switch 121 no_lsc_interrupt: Switch 122 no_rmv_interrupt: Switch 123 bitrate_stats: int | None 124 latencystats: int | None 125 print_events: list[Event] | None 126 mask_events: list[Event] | None 127 flow_isolate_all: Switch 128 disable_flow_flush: Switch 129 hot_plug: Switch 130 vxlan_gpe_port: int | None 131 geneve_parsed_port: int | None 132 lock_all_memory: YesNoSwitch 133 mempool_allocation_mode: SimpleMempoolAllocationMode | AnonMempoolAllocationMode | None 134 record_core_cycles: Switch 135 record_burst_status: Switch 136