Ethernet.py revision 2916
14483Sgblack@eecs.umich.edufrom m5 import build_env
24483Sgblack@eecs.umich.edufrom m5.config import *
34483Sgblack@eecs.umich.edufrom Device import DmaDevice
44483Sgblack@eecs.umich.edufrom Pci import PciDevice, PciConfigData
54483Sgblack@eecs.umich.edu
64483Sgblack@eecs.umich.educlass EtherInt(SimObject):
74483Sgblack@eecs.umich.edu    type = 'EtherInt'
84483Sgblack@eecs.umich.edu    abstract = True
94483Sgblack@eecs.umich.edu    peer = Param.EtherInt(NULL, "peer interface")
104483Sgblack@eecs.umich.edu
114483Sgblack@eecs.umich.educlass EtherLink(SimObject):
124483Sgblack@eecs.umich.edu    type = 'EtherLink'
134483Sgblack@eecs.umich.edu    int1 = Param.EtherInt("interface 1")
144483Sgblack@eecs.umich.edu    int2 = Param.EtherInt("interface 2")
154483Sgblack@eecs.umich.edu    delay = Param.Latency('0us', "packet transmit delay")
164483Sgblack@eecs.umich.edu    delay_var = Param.Latency('0ns', "packet transmit delay variability")
174483Sgblack@eecs.umich.edu    speed = Param.NetworkBandwidth('1Gbps', "link speed")
184483Sgblack@eecs.umich.edu    dump = Param.EtherDump(NULL, "dump object")
194483Sgblack@eecs.umich.edu
204483Sgblack@eecs.umich.educlass EtherBus(SimObject):
214483Sgblack@eecs.umich.edu    type = 'EtherBus'
224483Sgblack@eecs.umich.edu    loopback = Param.Bool(True, "send packet back to the sending interface")
234483Sgblack@eecs.umich.edu    dump = Param.EtherDump(NULL, "dump object")
244483Sgblack@eecs.umich.edu    speed = Param.NetworkBandwidth('100Mbps', "bus speed in bits per second")
254483Sgblack@eecs.umich.edu
264483Sgblack@eecs.umich.educlass EtherTap(EtherInt):
274483Sgblack@eecs.umich.edu    type = 'EtherTap'
284483Sgblack@eecs.umich.edu    bufsz = Param.Int(10000, "tap buffer size")
294483Sgblack@eecs.umich.edu    dump = Param.EtherDump(NULL, "dump object")
304483Sgblack@eecs.umich.edu    port = Param.UInt16(3500, "tap port")
314483Sgblack@eecs.umich.edu
324483Sgblack@eecs.umich.educlass EtherDump(SimObject):
334483Sgblack@eecs.umich.edu    type = 'EtherDump'
344483Sgblack@eecs.umich.edu    file = Param.String("dump file")
354483Sgblack@eecs.umich.edu    maxlen = Param.Int(96, "max portion of packet data to dump")
364483Sgblack@eecs.umich.edu
374483Sgblack@eecs.umich.eduif build_env['ALPHA_TLASER']:
384483Sgblack@eecs.umich.edu
394483Sgblack@eecs.umich.edu    class EtherDev(DmaDevice):
404483Sgblack@eecs.umich.edu        type = 'EtherDev'
414483Sgblack@eecs.umich.edu        hardware_address = Param.EthernetAddr(NextEthernetAddr,
424483Sgblack@eecs.umich.edu            "Ethernet Hardware Address")
434483Sgblack@eecs.umich.edu
444483Sgblack@eecs.umich.edu        dma_data_free = Param.Bool(False, "DMA of Data is free")
454483Sgblack@eecs.umich.edu        dma_desc_free = Param.Bool(False, "DMA of Descriptors is free")
464483Sgblack@eecs.umich.edu        dma_read_delay = Param.Latency('0us', "fixed delay for dma reads")
474483Sgblack@eecs.umich.edu        dma_read_factor = Param.Latency('0us', "multiplier for dma reads")
484483Sgblack@eecs.umich.edu        dma_write_delay = Param.Latency('0us', "fixed delay for dma writes")
494483Sgblack@eecs.umich.edu        dma_write_factor = Param.Latency('0us', "multiplier for dma writes")
504483Sgblack@eecs.umich.edu        dma_no_allocate = Param.Bool(True, "Should we allocate cache on read")
514483Sgblack@eecs.umich.edu
524483Sgblack@eecs.umich.edu        rx_filter = Param.Bool(True, "Enable Receive Filter")
534483Sgblack@eecs.umich.edu        rx_delay = Param.Latency('1us', "Receive Delay")
544483Sgblack@eecs.umich.edu        tx_delay = Param.Latency('1us', "Transmit Delay")
554483Sgblack@eecs.umich.edu
564483Sgblack@eecs.umich.edu        intr_delay = Param.Latency('0us', "Interrupt Delay")
574483Sgblack@eecs.umich.edu        payload_bus = Param.Bus(NULL, "The IO Bus to attach to for payload")
584483Sgblack@eecs.umich.edu        physmem = Param.PhysicalMemory(Parent.any, "Physical Memory")
594483Sgblack@eecs.umich.edu        tlaser = Param.Turbolaser(Parent.any, "Turbolaser")
604483Sgblack@eecs.umich.edu
614483Sgblack@eecs.umich.edu    class EtherDevInt(EtherInt):
624483Sgblack@eecs.umich.edu        type = 'EtherDevInt'
634483Sgblack@eecs.umich.edu        device = Param.EtherDev("Ethernet device of this interface")
644483Sgblack@eecs.umich.edu
654483Sgblack@eecs.umich.educlass EtherDevBase(PciDevice):
664483Sgblack@eecs.umich.edu    hardware_address = Param.EthernetAddr(NextEthernetAddr,
674483Sgblack@eecs.umich.edu        "Ethernet Hardware Address")
684483Sgblack@eecs.umich.edu
694483Sgblack@eecs.umich.edu    clock = Param.Clock('0ns', "State machine processor frequency")
704483Sgblack@eecs.umich.edu
714502Sgblack@eecs.umich.edu    dma_read_delay = Param.Latency('0us', "fixed delay for dma reads")
724502Sgblack@eecs.umich.edu    dma_read_factor = Param.Latency('0us', "multiplier for dma reads")
734483Sgblack@eecs.umich.edu    dma_write_delay = Param.Latency('0us', "fixed delay for dma writes")
744483Sgblack@eecs.umich.edu    dma_write_factor = Param.Latency('0us', "multiplier for dma writes")
754483Sgblack@eecs.umich.edu
764502Sgblack@eecs.umich.edu    rx_delay = Param.Latency('1us', "Receive Delay")
774502Sgblack@eecs.umich.edu    tx_delay = Param.Latency('1us', "Transmit Delay")
784502Sgblack@eecs.umich.edu    rx_fifo_size = Param.MemorySize('512kB', "max size of rx fifo")
794502Sgblack@eecs.umich.edu    tx_fifo_size = Param.MemorySize('512kB', "max size of tx fifo")
804483Sgblack@eecs.umich.edu
814483Sgblack@eecs.umich.edu    rx_filter = Param.Bool(True, "Enable Receive Filter")
824483Sgblack@eecs.umich.edu    intr_delay = Param.Latency('10us', "Interrupt propagation delay")
834483Sgblack@eecs.umich.edu    rx_thread = Param.Bool(False, "dedicated kernel thread for transmit")
844483Sgblack@eecs.umich.edu    tx_thread = Param.Bool(False, "dedicated kernel threads for receive")
854483Sgblack@eecs.umich.edu    rss = Param.Bool(False, "Receive Side Scaling")
864502Sgblack@eecs.umich.edu
874483Sgblack@eecs.umich.educlass NSGigEPciData(PciConfigData):
884483Sgblack@eecs.umich.edu    VendorID = 0x100B
894483Sgblack@eecs.umich.edu    DeviceID = 0x0022
904483Sgblack@eecs.umich.edu    Status = 0x0290
914483Sgblack@eecs.umich.edu    SubClassCode = 0x00
924483Sgblack@eecs.umich.edu    ClassCode = 0x02
934483Sgblack@eecs.umich.edu    ProgIF = 0x00
944502Sgblack@eecs.umich.edu    BAR0 = 0x00000001
954483Sgblack@eecs.umich.edu    BAR1 = 0x00000000
964483Sgblack@eecs.umich.edu    BAR2 = 0x00000000
97    BAR3 = 0x00000000
98    BAR4 = 0x00000000
99    BAR5 = 0x00000000
100    MaximumLatency = 0x34
101    MinimumGrant = 0xb0
102    InterruptLine = 0x1e
103    InterruptPin = 0x01
104    BAR0Size = '256B'
105    BAR1Size = '4kB'
106
107class NSGigE(EtherDevBase):
108    type = 'NSGigE'
109
110    dma_data_free = Param.Bool(False, "DMA of Data is free")
111    dma_desc_free = Param.Bool(False, "DMA of Descriptors is free")
112    dma_no_allocate = Param.Bool(True, "Should we allocate cache on read")
113
114    configdata = NSGigEPciData()
115
116
117class NSGigEInt(EtherInt):
118    type = 'NSGigEInt'
119    device = Param.NSGigE("Ethernet device of this interface")
120
121class SinicPciData(PciConfigData):
122    VendorID = 0x1291
123    DeviceID = 0x1293
124    Status = 0x0290
125    SubClassCode = 0x00
126    ClassCode = 0x02
127    ProgIF = 0x00
128    BAR0 = 0x00000000
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 = '64kB'
139
140class Sinic(EtherDevBase):
141    type = 'Sinic'
142
143    rx_max_copy = Param.MemorySize('1514B', "rx max copy")
144    tx_max_copy = Param.MemorySize('16kB', "tx max copy")
145    rx_max_intr = Param.UInt32(10, "max rx packets per interrupt")
146    rx_fifo_threshold = Param.MemorySize('384kB', "rx fifo high threshold")
147    rx_fifo_low_mark = Param.MemorySize('128kB', "rx fifo low threshold")
148    tx_fifo_high_mark = Param.MemorySize('384kB', "tx fifo high threshold")
149    tx_fifo_threshold = Param.MemorySize('128kB', "tx fifo low threshold")
150    virtual_count = Param.UInt32(1, "Virtualized SINIC")
151    zero_copy = Param.Bool(False, "Zero copy receive")
152    delay_copy = Param.Bool(False, "Delayed copy transmit")
153    virtual_addr = Param.Bool(False, "Virtual addressing")
154
155    configdata = SinicPciData()
156
157class SinicInt(EtherInt):
158    type = 'SinicInt'
159    device = Param.Sinic("Ethernet device of this interface")
160