Ethernet.py revision 2008
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    delay_var = Param.Latency('0ns', "packet transmit delay variability")
16    speed = Param.NetworkBandwidth('1Gbps', "link speed")
17    dump = Param.EtherDump(NULL, "dump object")
18
19class EtherBus(SimObject):
20    type = 'EtherBus'
21    loopback = Param.Bool(True, "send packet back to the sending interface")
22    dump = Param.EtherDump(NULL, "dump object")
23    speed = Param.NetworkBandwidth('100Mbps', "bus speed in bits per second")
24
25class EtherTap(EtherInt):
26    type = 'EtherTap'
27    bufsz = Param.Int(10000, "tap buffer size")
28    dump = Param.EtherDump(NULL, "dump object")
29    port = Param.UInt16(3500, "tap port")
30
31class EtherDump(SimObject):
32    type = 'EtherDump'
33    file = Param.String("dump file")
34    maxlen = Param.Int(96, "max portion of packet data to dump")
35
36if build_env['ALPHA_TLASER']:
37
38    class EtherDev(DmaDevice):
39        type = 'EtherDev'
40        hardware_address = Param.EthernetAddr(NextEthernetAddr,
41            "Ethernet Hardware Address")
42
43        dma_data_free = Param.Bool(False, "DMA of Data is free")
44        dma_desc_free = Param.Bool(False, "DMA of Descriptors is free")
45        dma_read_delay = Param.Latency('0us', "fixed delay for dma reads")
46        dma_read_factor = Param.Latency('0us', "multiplier for dma reads")
47        dma_write_delay = Param.Latency('0us', "fixed delay for dma writes")
48        dma_write_factor = Param.Latency('0us', "multiplier for dma writes")
49        dma_no_allocate = Param.Bool(True, "Should we allocate cache on read")
50
51        rx_filter = Param.Bool(True, "Enable Receive Filter")
52        rx_delay = Param.Latency('1us', "Receive Delay")
53        tx_delay = Param.Latency('1us', "Transmit Delay")
54
55        intr_delay = Param.Latency('0us', "Interrupt Delay")
56        payload_bus = Param.Bus(NULL, "The IO Bus to attach to for payload")
57        physmem = Param.PhysicalMemory(Parent.any, "Physical Memory")
58        tlaser = Param.Turbolaser(Parent.any, "Turbolaser")
59
60    class EtherDevInt(EtherInt):
61        type = 'EtherDevInt'
62        device = Param.EtherDev("Ethernet device of this interface")
63
64class EtherDevBase(PciDevice):
65    hardware_address = Param.EthernetAddr(NextEthernetAddr,
66        "Ethernet Hardware Address")
67
68    clock = Param.Clock('0ns', "State machine processor frequency")
69
70    physmem = Param.PhysicalMemory(Parent.any, "Physical Memory")
71
72    hier = Param.HierParams(Parent.any, "Hierarchy global variables")
73    payload_bus = Param.Bus(NULL, "The IO Bus to attach to for payload")
74    dma_read_delay = Param.Latency('0us', "fixed delay for dma reads")
75    dma_read_factor = Param.Latency('0us', "multiplier for dma reads")
76    dma_write_delay = Param.Latency('0us', "fixed delay for dma writes")
77    dma_write_factor = Param.Latency('0us', "multiplier for dma writes")
78    dma_no_allocate = Param.Bool(True, "Should we allocate cache on read")
79    pio_delay_write = Param.Bool(False, "Delay pio writes until timing occurs")
80
81    rx_delay = Param.Latency('1us', "Receive Delay")
82    tx_delay = Param.Latency('1us', "Transmit Delay")
83    rx_fifo_size = Param.MemorySize('512kB', "max size of rx fifo")
84    tx_fifo_size = Param.MemorySize('512kB', "max size of tx fifo")
85
86    rx_filter = Param.Bool(True, "Enable Receive Filter")
87    intr_delay = Param.Latency('10us', "Interrupt propagation delay")
88    rx_thread = Param.Bool(False, "dedicated kernel thread for transmit")
89    tx_thread = Param.Bool(False, "dedicated kernel threads for receive")
90
91class NSGigE(EtherDevBase):
92    type = 'NSGigE'
93
94    dma_data_free = Param.Bool(False, "DMA of Data is free")
95    dma_desc_free = Param.Bool(False, "DMA of Descriptors is free")
96
97
98class NSGigEInt(EtherInt):
99    type = 'NSGigEInt'
100    device = Param.NSGigE("Ethernet device of this interface")
101
102class Sinic(EtherDevBase):
103    type = 'Sinic'
104
105    rx_max_copy = Param.MemorySize('1514B', "rx max copy")
106    tx_max_copy = Param.MemorySize('16kB', "tx max copy")
107    rx_max_intr = Param.UInt32(10, "max rx packets per interrupt")
108    rx_fifo_threshold = Param.MemorySize('48kB', "rx fifo high threshold")
109    tx_fifo_threshold = Param.MemorySize('16kB', "tx fifo low threshold")
110
111class SinicInt(EtherInt):
112    type = 'SinicInt'
113    device = Param.Sinic("Ethernet device of this interface")
114