Ethernet.py revision 1925
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 EtherDevBase(PciDevice):
64    hardware_address = Param.EthernetAddr(NextEthernetAddr,
65        "Ethernet Hardware Address")
66
67    clock = Param.Clock('0ns', "State machine processor frequency")
68
69    physmem = Param.PhysicalMemory(Parent.any, "Physical Memory")
70
71    hier = Param.HierParams(Parent.any, "Hierarchy global variables")
72    payload_bus = Param.Bus(NULL, "The IO Bus to attach to for payload")
73    dma_read_delay = Param.Latency('0us', "fixed delay for dma reads")
74    dma_read_factor = Param.Latency('0us', "multiplier for dma reads")
75    dma_write_delay = Param.Latency('0us', "fixed delay for dma writes")
76    dma_write_factor = Param.Latency('0us', "multiplier for dma writes")
77    dma_no_allocate = Param.Bool(True, "Should we allocate cache on read")
78
79    rx_delay = Param.Latency('1us', "Receive Delay")
80    tx_delay = Param.Latency('1us', "Transmit Delay")
81    rx_fifo_size = Param.MemorySize('512kB', "max size of rx fifo")
82    tx_fifo_size = Param.MemorySize('512kB', "max size of tx fifo")
83
84    rx_filter = Param.Bool(True, "Enable Receive Filter")
85    intr_delay = Param.Latency('10us', "Interrupt Propagation Delay")
86
87class NSGigE(EtherDevBase):
88    type = 'NSGigE'
89
90    dma_data_free = Param.Bool(False, "DMA of Data is free")
91    dma_desc_free = Param.Bool(False, "DMA of Descriptors is free")
92
93    dedicated = Param.Bool(False, "dedicate a kernel thread to the driver")
94
95class NSGigEInt(EtherInt):
96    type = 'NSGigEInt'
97    device = Param.NSGigE("Ethernet device of this interface")
98
99class Sinic(EtherDevBase):
100    type = 'Sinic'
101
102    rx_max_copy = Param.MemorySize('1514B', "rx max copy")
103    tx_max_copy = Param.MemorySize('16kB', "tx max copy")
104    rx_fifo_threshold = Param.MemorySize('48kB', "rx fifo high threshold")
105    tx_fifo_threshold = Param.MemorySize('16kB', "tx fifo low threshold")
106
107class SinicInt(EtherInt):
108    type = 'SinicInt'
109    device = Param.Sinic("Ethernet device of this interface")
110