Ethernet.py revision 1880
1from m5 import *
2from Device import DmaDevice
3from Pci import PciDevice
4
5class EtherInt(SimObject):
6    type = 'EtherInt'
7    abstract = True
8    peer = Param.EtherInt(NULL, "peer interface")
9
10class EtherLink(SimObject):
11    type = 'EtherLink'
12    int1 = Param.EtherInt("interface 1")
13    int2 = Param.EtherInt("interface 2")
14    delay = Param.Latency('0us', "packet transmit delay")
15    speed = Param.NetworkBandwidth('1Gbps', "link speed")
16    dump = Param.EtherDump(NULL, "dump object")
17
18class EtherBus(SimObject):
19    type = 'EtherBus'
20    loopback = Param.Bool(True, "send packet back to the sending interface")
21    dump = Param.EtherDump(NULL, "dump object")
22    speed = Param.NetworkBandwidth('100Mbps', "bus speed in bits per second")
23
24class EtherTap(EtherInt):
25    type = 'EtherTap'
26    bufsz = Param.Int(10000, "tap buffer size")
27    dump = Param.EtherDump(NULL, "dump object")
28    port = Param.UInt16(3500, "tap port")
29
30class EtherDump(SimObject):
31    type = 'EtherDump'
32    file = Param.String("dump file")
33    maxlen = Param.Int(96, "max portion of packet data to dump")
34
35if build_env['ALPHA_TLASER']:
36
37    class EtherDev(DmaDevice):
38        type = 'EtherDev'
39        hardware_address = Param.EthernetAddr(NextEthernetAddr,
40            "Ethernet Hardware Address")
41
42        dma_data_free = Param.Bool(False, "DMA of Data is free")
43        dma_desc_free = Param.Bool(False, "DMA of Descriptors is free")
44        dma_read_delay = Param.Latency('0us', "fixed delay for dma reads")
45        dma_read_factor = Param.Latency('0us', "multiplier for dma reads")
46        dma_write_delay = Param.Latency('0us', "fixed delay for dma writes")
47        dma_write_factor = Param.Latency('0us', "multiplier for dma writes")
48        dma_no_allocate = Param.Bool(True, "Should we allocate cache on read")
49
50        rx_filter = Param.Bool(True, "Enable Receive Filter")
51        rx_delay = Param.Latency('1us', "Receive Delay")
52        tx_delay = Param.Latency('1us', "Transmit Delay")
53
54        intr_delay = Param.Latency('0us', "Interrupt Delay")
55        payload_bus = Param.Bus(NULL, "The IO Bus to attach to for payload")
56        physmem = Param.PhysicalMemory(Parent.any, "Physical Memory")
57        tlaser = Param.Turbolaser(Parent.any, "Turbolaser")
58
59    class EtherDevInt(EtherInt):
60        type = 'EtherDevInt'
61        device = Param.EtherDev("Ethernet device of this interface")
62
63class NSGigE(PciDevice):
64    type = 'NSGigE'
65    hardware_address = Param.EthernetAddr(NextEthernetAddr,
66        "Ethernet Hardware Address")
67
68    clock = Param.Clock('0ns', "State machine processor frequency")
69
70    dma_data_free = Param.Bool(False, "DMA of Data is free")
71    dma_desc_free = Param.Bool(False, "DMA of Descriptors is free")
72    dma_read_delay = Param.Latency('0us', "fixed delay for dma reads")
73    dma_read_factor = Param.Latency('0us', "multiplier for dma reads")
74    dma_write_delay = Param.Latency('0us', "fixed delay for dma writes")
75    dma_write_factor = Param.Latency('0us', "multiplier for dma writes")
76    dma_no_allocate = Param.Bool(True, "Should we allocate cache on read")
77
78
79    rx_filter = Param.Bool(True, "Enable Receive Filter")
80    rx_delay = Param.Latency('1us', "Receive Delay")
81    tx_delay = Param.Latency('1us', "Transmit Delay")
82
83    rx_fifo_size = Param.MemorySize('128kB', "max size in bytes of rxFifo")
84    tx_fifo_size = Param.MemorySize('128kB', "max size in bytes of txFifo")
85
86    m5reg = Param.UInt32(0, "Register for m5 usage")
87
88    intr_delay = Param.Latency('0us', "Interrupt Delay in microseconds")
89    payload_bus = Param.Bus(NULL, "The IO Bus to attach to for payload")
90    physmem = Param.PhysicalMemory(Parent.any, "Physical Memory")
91
92class NSGigEInt(EtherInt):
93    type = 'NSGigEInt'
94    device = Param.NSGigE("Ethernet device of this interface")
95
96class Sinic(PciDevice):
97    type = 'Sinic'
98    hardware_address = Param.EthernetAddr(NextEthernetAddr,
99        "Ethernet Hardware Address")
100
101    clock = Param.Clock('100MHz', "State machine processor frequency")
102
103    dma_read_delay = Param.Latency('0us', "fixed delay for dma reads")
104    dma_read_factor = Param.Latency('0us', "multiplier for dma reads")
105    dma_write_delay = Param.Latency('0us', "fixed delay for dma writes")
106    dma_write_factor = Param.Latency('0us', "multiplier for dma writes")
107
108    rx_filter = Param.Bool(True, "Enable Receive Filter")
109    rx_delay = Param.Latency('1us', "Receive Delay")
110    tx_delay = Param.Latency('1us', "Transmit Delay")
111
112    rx_max_copy = Param.MemorySize('16kB', "rx max copy")
113    tx_max_copy = Param.MemorySize('16kB', "tx max copy")
114    rx_fifo_size = Param.MemorySize('64kB', "max size of rx fifo")
115    tx_fifo_size = Param.MemorySize('64kB', "max size of tx fifo")
116    rx_fifo_threshold = Param.MemorySize('48kB', "rx fifo high threshold")
117    tx_fifo_threshold = Param.MemorySize('16kB', "tx fifo low threshold")
118
119    intr_delay = Param.Latency('0us', "Interrupt Delay in microseconds")
120    payload_bus = Param.Bus(NULL, "The IO Bus to attach to for payload")
121    physmem = Param.PhysicalMemory(Parent.any, "Physical Memory")
122
123class SinicInt(EtherInt):
124    type = 'SinicInt'
125    device = Param.Sinic("Ethernet device of this interface")
126