Ethernet.py revision 3116
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 67 68class IGbE(PciDevice): 69 type = 'IGbE' 70 hardware_address = Param.EthernetAddr(NextEthernetAddr, "Ethernet Hardware Address") 71 72class IGbEPciData(PciConfigData): 73 VendorID = 0x8086 74 DeviceID = 0x1026 75 SubsystemID = 0x1008 76 SubsystemVendorID = 0x8086 77 Status = 0x0000 78 SubClassCode = 0x00 79 ClassCode = 0x02 80 ProgIF = 0x00 81 BAR0 = 0x00000000 82 BAR1 = 0x00000000 83 BAR2 = 0x00000000 84 BAR3 = 0x00000000 85 BAR4 = 0x00000000 86 BAR5 = 0x00000000 87 MaximumLatency = 0x00 88 MinimumGrant = 0xff 89 InterruptLine = 0x1e 90 InterruptPin = 0x01 91 BAR0Size = '128kB' 92 93class IGbEInt(EtherInt): 94 type = 'IGbEInt' 95 device = Param.IGbE("Ethernet device of this interface") 96 97 98 99class EtherDevBase(PciDevice): 100 hardware_address = Param.EthernetAddr(NextEthernetAddr, 101 "Ethernet Hardware Address") 102 103 clock = Param.Clock('0ns', "State machine processor frequency") 104 105 dma_read_delay = Param.Latency('0us', "fixed delay for dma reads") 106 dma_read_factor = Param.Latency('0us', "multiplier for dma reads") 107 dma_write_delay = Param.Latency('0us', "fixed delay for dma writes") 108 dma_write_factor = Param.Latency('0us', "multiplier for dma writes") 109 110 rx_delay = Param.Latency('1us', "Receive Delay") 111 tx_delay = Param.Latency('1us', "Transmit Delay") 112 rx_fifo_size = Param.MemorySize('512kB', "max size of rx fifo") 113 tx_fifo_size = Param.MemorySize('512kB', "max size of tx fifo") 114 115 rx_filter = Param.Bool(True, "Enable Receive Filter") 116 intr_delay = Param.Latency('10us', "Interrupt propagation delay") 117 rx_thread = Param.Bool(False, "dedicated kernel thread for transmit") 118 tx_thread = Param.Bool(False, "dedicated kernel threads for receive") 119 rss = Param.Bool(False, "Receive Side Scaling") 120 121class NSGigEPciData(PciConfigData): 122 VendorID = 0x100B 123 DeviceID = 0x0022 124 Status = 0x0290 125 SubClassCode = 0x00 126 ClassCode = 0x02 127 ProgIF = 0x00 128 BAR0 = 0x00000001 129 BAR1 = 0x00000000 130 BAR2 = 0x00000000 131 BAR3 = 0x00000000 132 BAR4 = 0x00000000 133 BAR5 = 0x00000000 134 MaximumLatency = 0x34 135 MinimumGrant = 0xb0 136 InterruptLine = 0x1e 137 InterruptPin = 0x01 138 BAR0Size = '256B' 139 BAR1Size = '4kB' 140 141class NSGigE(EtherDevBase): 142 type = 'NSGigE' 143 144 dma_data_free = Param.Bool(False, "DMA of Data is free") 145 dma_desc_free = Param.Bool(False, "DMA of Descriptors is free") 146 dma_no_allocate = Param.Bool(True, "Should we allocate cache on read") 147 148 configdata = NSGigEPciData() 149 150 151class NSGigEInt(EtherInt): 152 type = 'NSGigEInt' 153 device = Param.NSGigE("Ethernet device of this interface") 154 155class SinicPciData(PciConfigData): 156 VendorID = 0x1291 157 DeviceID = 0x1293 158 Status = 0x0290 159 SubClassCode = 0x00 160 ClassCode = 0x02 161 ProgIF = 0x00 162 BAR0 = 0x00000000 163 BAR1 = 0x00000000 164 BAR2 = 0x00000000 165 BAR3 = 0x00000000 166 BAR4 = 0x00000000 167 BAR5 = 0x00000000 168 MaximumLatency = 0x34 169 MinimumGrant = 0xb0 170 InterruptLine = 0x1e 171 InterruptPin = 0x01 172 BAR0Size = '64kB' 173 174class Sinic(EtherDevBase): 175 type = 'Sinic' 176 177 rx_max_copy = Param.MemorySize('1514B', "rx max copy") 178 tx_max_copy = Param.MemorySize('16kB', "tx max copy") 179 rx_max_intr = Param.UInt32(10, "max rx packets per interrupt") 180 rx_fifo_threshold = Param.MemorySize('384kB', "rx fifo high threshold") 181 rx_fifo_low_mark = Param.MemorySize('128kB', "rx fifo low threshold") 182 tx_fifo_high_mark = Param.MemorySize('384kB', "tx fifo high threshold") 183 tx_fifo_threshold = Param.MemorySize('128kB', "tx fifo low threshold") 184 virtual_count = Param.UInt32(1, "Virtualized SINIC") 185 zero_copy = Param.Bool(False, "Zero copy receive") 186 delay_copy = Param.Bool(False, "Delayed copy transmit") 187 virtual_addr = Param.Bool(False, "Virtual addressing") 188 189 configdata = SinicPciData() 190 191class SinicInt(EtherInt): 192 type = 'SinicInt' 193 device = Param.Sinic("Ethernet device of this interface") 194