Ethernet.py revision 3102
1from m5.SimObject import SimObject 2from m5.params import * 3from m5.proxy import * 4from m5 import build_env 5from Device import DmaDevice 6from Pci import PciDevice, PciConfigData 7 8class EtherInt(SimObject): 9 type = 'EtherInt' 10 abstract = True 11 peer = Param.EtherInt(NULL, "peer interface") 12 13class EtherLink(SimObject): 14 type = 'EtherLink' 15 int1 = Param.EtherInt("interface 1") 16 int2 = Param.EtherInt("interface 2") 17 delay = Param.Latency('0us', "packet transmit delay") 18 delay_var = Param.Latency('0ns', "packet transmit delay variability") 19 speed = Param.NetworkBandwidth('1Gbps', "link speed") 20 dump = Param.EtherDump(NULL, "dump object") 21 22class EtherBus(SimObject): 23 type = 'EtherBus' 24 loopback = Param.Bool(True, "send packet back to the sending interface") 25 dump = Param.EtherDump(NULL, "dump object") 26 speed = Param.NetworkBandwidth('100Mbps', "bus speed in bits per second") 27 28class EtherTap(EtherInt): 29 type = 'EtherTap' 30 bufsz = Param.Int(10000, "tap buffer size") 31 dump = Param.EtherDump(NULL, "dump object") 32 port = Param.UInt16(3500, "tap port") 33 34class EtherDump(SimObject): 35 type = 'EtherDump' 36 file = Param.String("dump file") 37 maxlen = Param.Int(96, "max portion of packet data to dump") 38 39if build_env['ALPHA_TLASER']: 40 41 class EtherDev(DmaDevice): 42 type = 'EtherDev' 43 hardware_address = Param.EthernetAddr(NextEthernetAddr, 44 "Ethernet Hardware Address") 45 46 dma_data_free = Param.Bool(False, "DMA of Data is free") 47 dma_desc_free = Param.Bool(False, "DMA of Descriptors is free") 48 dma_read_delay = Param.Latency('0us', "fixed delay for dma reads") 49 dma_read_factor = Param.Latency('0us', "multiplier for dma reads") 50 dma_write_delay = Param.Latency('0us', "fixed delay for dma writes") 51 dma_write_factor = Param.Latency('0us', "multiplier for dma writes") 52 dma_no_allocate = Param.Bool(True, "Should we allocate cache on read") 53 54 rx_filter = Param.Bool(True, "Enable Receive Filter") 55 rx_delay = Param.Latency('1us', "Receive Delay") 56 tx_delay = Param.Latency('1us', "Transmit Delay") 57 58 intr_delay = Param.Latency('0us', "Interrupt Delay") 59 payload_bus = Param.Bus(NULL, "The IO Bus to attach to for payload") 60 physmem = Param.PhysicalMemory(Parent.any, "Physical Memory") 61 tlaser = Param.Turbolaser(Parent.any, "Turbolaser") 62 63 class EtherDevInt(EtherInt): 64 type = 'EtherDevInt' 65 device = Param.EtherDev("Ethernet device of this interface") 66 67class EtherDevBase(PciDevice): 68 hardware_address = Param.EthernetAddr(NextEthernetAddr, 69 "Ethernet Hardware Address") 70 71 clock = Param.Clock('0ns', "State machine processor frequency") 72 73 config_latency = Param.Latency('20ns', "Config read or write latency") 74 75 dma_read_delay = Param.Latency('0us', "fixed delay for dma reads") 76 dma_read_factor = Param.Latency('0us', "multiplier for dma reads") 77 dma_write_delay = Param.Latency('0us', "fixed delay for dma writes") 78 dma_write_factor = Param.Latency('0us', "multiplier for dma writes") 79 80 rx_delay = Param.Latency('1us', "Receive Delay") 81 tx_delay = Param.Latency('1us', "Transmit Delay") 82 rx_fifo_size = Param.MemorySize('512kB', "max size of rx fifo") 83 tx_fifo_size = Param.MemorySize('512kB', "max size of tx fifo") 84 85 rx_filter = Param.Bool(True, "Enable Receive Filter") 86 intr_delay = Param.Latency('10us', "Interrupt propagation delay") 87 rx_thread = Param.Bool(False, "dedicated kernel thread for transmit") 88 tx_thread = Param.Bool(False, "dedicated kernel threads for receive") 89 rss = Param.Bool(False, "Receive Side Scaling") 90 91class NSGigEPciData(PciConfigData): 92 VendorID = 0x100B 93 DeviceID = 0x0022 94 Status = 0x0290 95 SubClassCode = 0x00 96 ClassCode = 0x02 97 ProgIF = 0x00 98 BAR0 = 0x00000001 99 BAR1 = 0x00000000 100 BAR2 = 0x00000000 101 BAR3 = 0x00000000 102 BAR4 = 0x00000000 103 BAR5 = 0x00000000 104 MaximumLatency = 0x34 105 MinimumGrant = 0xb0 106 InterruptLine = 0x1e 107 InterruptPin = 0x01 108 BAR0Size = '256B' 109 BAR1Size = '4kB' 110 111class NSGigE(EtherDevBase): 112 type = 'NSGigE' 113 114 dma_data_free = Param.Bool(False, "DMA of Data is free") 115 dma_desc_free = Param.Bool(False, "DMA of Descriptors is free") 116 dma_no_allocate = Param.Bool(True, "Should we allocate cache on read") 117 118 configdata = NSGigEPciData() 119 120 121class NSGigEInt(EtherInt): 122 type = 'NSGigEInt' 123 device = Param.NSGigE("Ethernet device of this interface") 124 125class SinicPciData(PciConfigData): 126 VendorID = 0x1291 127 DeviceID = 0x1293 128 Status = 0x0290 129 SubClassCode = 0x00 130 ClassCode = 0x02 131 ProgIF = 0x00 132 BAR0 = 0x00000000 133 BAR1 = 0x00000000 134 BAR2 = 0x00000000 135 BAR3 = 0x00000000 136 BAR4 = 0x00000000 137 BAR5 = 0x00000000 138 MaximumLatency = 0x34 139 MinimumGrant = 0xb0 140 InterruptLine = 0x1e 141 InterruptPin = 0x01 142 BAR0Size = '64kB' 143 144class Sinic(EtherDevBase): 145 type = 'Sinic' 146 147 rx_max_copy = Param.MemorySize('1514B', "rx max copy") 148 tx_max_copy = Param.MemorySize('16kB', "tx max copy") 149 rx_max_intr = Param.UInt32(10, "max rx packets per interrupt") 150 rx_fifo_threshold = Param.MemorySize('384kB', "rx fifo high threshold") 151 rx_fifo_low_mark = Param.MemorySize('128kB', "rx fifo low threshold") 152 tx_fifo_high_mark = Param.MemorySize('384kB', "tx fifo high threshold") 153 tx_fifo_threshold = Param.MemorySize('128kB', "tx fifo low threshold") 154 virtual_count = Param.UInt32(1, "Virtualized SINIC") 155 zero_copy = Param.Bool(False, "Zero copy receive") 156 delay_copy = Param.Bool(False, "Delayed copy transmit") 157 virtual_addr = Param.Bool(False, "Virtual addressing") 158 159 configdata = SinicPciData() 160 161class SinicInt(EtherInt): 162 type = 'SinicInt' 163 device = Param.Sinic("Ethernet device of this interface") 164