1 # Copyright (c) 2015 ARM Limited
4 # The license below extends only to copyright in the software and shall
5 # not be construed as granting a license to any other intellectual
6 # property including but not limited to intellectual property relating
7 # to a hardware implementation of the functionality of the software
8 # licensed hereunder. You may use the software subject to the license
9 # terms below provided that you ensure that this notice is replicated
10 # unmodified and in its entirety in all distributions of the software,
11 # modified or unmodified, in source code or in binary form.
13 # Copyright (c) 2005-2007 The Regents of The University of Michigan
14 # All rights reserved.
16 # Redistribution and use in source and binary forms, with or without
17 # modification, are permitted provided that the following conditions are
18 # met: redistributions of source code must retain the above copyright
19 # notice, this list of conditions and the following disclaimer;
20 # redistributions in binary form must reproduce the above copyright
21 # notice, this list of conditions and the following disclaimer in the
22 # documentation and/or other materials provided with the distribution;
23 # neither the name of the copyright holders nor the names of its
24 # contributors may be used to endorse or promote products derived from
25 # this software without specific prior written permission.
27 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
28 # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
29 # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
30 # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
31 # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
32 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
33 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
34 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
35 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
36 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
37 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
39 # Authors: Nathan Binkert
41 from m5
.defines
import buildEnv
42 from m5
.SimObject
import SimObject
43 from m5
.params
import *
44 from m5
.proxy
import *
45 from m5
.objects
.PciDevice
import PciDevice
47 ETHERNET_ROLE
= 'ETHERNET'
48 Port
.compat(ETHERNET_ROLE
, ETHERNET_ROLE
)
51 def __init__(self
, desc
):
52 super(EtherInt
, self
).__init
__(ETHERNET_ROLE
, desc
)
54 class VectorEtherInt(VectorPort
):
55 def __init__(self
, desc
):
56 super(VectorEtherInt
, self
).__init
__(ETHERNET_ROLE
, desc
)
58 class EtherLink(SimObject
):
60 cxx_header
= "dev/net/etherlink.hh"
61 int0
= EtherInt("interface 0")
62 int1
= EtherInt("interface 1")
63 delay
= Param
.Latency('0us', "packet transmit delay")
64 delay_var
= Param
.Latency('0ns', "packet transmit delay variability")
65 speed
= Param
.NetworkBandwidth('1Gbps', "link speed")
66 dump
= Param
.EtherDump(NULL
, "dump object")
68 class DistEtherLink(SimObject
):
69 type = 'DistEtherLink'
70 cxx_header
= "dev/net/dist_etherlink.hh"
71 int0
= EtherInt("interface 0")
72 delay
= Param
.Latency('0us', "packet transmit delay")
73 delay_var
= Param
.Latency('0ns', "packet transmit delay variability")
74 speed
= Param
.NetworkBandwidth('1Gbps', "link speed")
75 dump
= Param
.EtherDump(NULL
, "dump object")
76 dist_rank
= Param
.UInt32('0', "Rank of this gem5 process (dist run)")
77 dist_size
= Param
.UInt32('1', "Number of gem5 processes (dist run)")
78 sync_start
= Param
.Latency('5200000000000t', "first dist sync barrier")
79 sync_repeat
= Param
.Latency('10us', "dist sync barrier repeat")
80 server_name
= Param
.String('localhost', "Message server name")
81 server_port
= Param
.UInt32('2200', "Message server port")
82 is_switch
= Param
.Bool(False, "true if this a link in etherswitch")
83 dist_sync_on_pseudo_op
= Param
.Bool(False, "Start sync with pseudo_op")
84 num_nodes
= Param
.UInt32('2', "Number of simulate nodes")
86 class EtherBus(SimObject
):
88 cxx_header
= "dev/net/etherbus.hh"
89 loopback
= Param
.Bool(True, "send packet back to the sending interface")
90 dump
= Param
.EtherDump(NULL
, "dump object")
91 speed
= Param
.NetworkBandwidth('100Mbps', "bus speed in bits per second")
93 class EtherSwitch(SimObject
):
95 cxx_header
= "dev/net/etherswitch.hh"
96 dump
= Param
.EtherDump(NULL
, "dump object")
97 fabric_speed
= Param
.NetworkBandwidth('10Gbps', "switch fabric speed in bits "
99 interface
= VectorEtherInt("Ethernet Interface")
100 output_buffer_size
= Param
.MemorySize('1MB', "size of output port buffers")
101 delay
= Param
.Latency('0us', "packet transmit delay")
102 delay_var
= Param
.Latency('0ns', "packet transmit delay variability")
103 time_to_live
= Param
.Latency('10ms', "time to live of MAC address maping")
105 class EtherTapBase(SimObject
):
106 type = 'EtherTapBase'
108 cxx_header
= "dev/net/ethertap.hh"
109 bufsz
= Param
.Int(10000, "tap buffer size")
110 dump
= Param
.EtherDump(NULL
, "dump object")
111 tap
= EtherInt("Ethernet interface to connect to gem5's network")
113 if buildEnv
['USE_TUNTAP']:
114 class EtherTap(EtherTapBase
):
116 cxx_header
= "dev/net/ethertap.hh"
117 tun_clone_device
= Param
.String('/dev/net/tun',
118 "Path to the tun clone device node")
119 tap_device_name
= Param
.String('gem5-tap', "Tap device name")
121 class EtherTapStub(EtherTapBase
):
122 type = 'EtherTapStub'
123 cxx_header
= "dev/net/ethertap.hh"
124 port
= Param
.UInt16(3500, "Port helper should send packets to")
126 class EtherDump(SimObject
):
128 cxx_header
= "dev/net/etherdump.hh"
129 file = Param
.String("dump file")
130 maxlen
= Param
.Int(96, "max portion of packet data to dump")
132 class EtherDevice(PciDevice
):
135 cxx_header
= "dev/net/etherdevice.hh"
136 interface
= EtherInt("Ethernet Interface")
138 class IGbE(EtherDevice
):
139 # Base class for two IGbE adapters listed above
141 cxx_header
= "dev/net/i8254xGBe.hh"
142 hardware_address
= Param
.EthernetAddr(NextEthernetAddr
,
143 "Ethernet Hardware Address")
144 rx_fifo_size
= Param
.MemorySize('384kB', "Size of the rx FIFO")
145 tx_fifo_size
= Param
.MemorySize('384kB', "Size of the tx FIFO")
146 rx_desc_cache_size
= Param
.Int(64,
147 "Number of enteries in the rx descriptor cache")
148 tx_desc_cache_size
= Param
.Int(64,
149 "Number of enteries in the rx descriptor cache")
152 SubsystemVendorID
= 0x8086
163 MaximumLatency
= 0x00
168 wb_delay
= Param
.Latency('10ns', "delay before desc writeback occurs")
169 fetch_delay
= Param
.Latency('10ns', "delay before desc fetch occurs")
170 fetch_comp_delay
= Param
.Latency('10ns', "delay after desc fetch occurs")
171 wb_comp_delay
= Param
.Latency('10ns', "delay after desc wb occurs")
172 tx_read_delay
= Param
.Latency('0ns', "delay after tx dma read")
173 rx_write_delay
= Param
.Latency('0ns', "delay after rx dma read")
174 phy_pid
= Param
.UInt16("Phy PID that corresponds to device ID")
175 phy_epid
= Param
.UInt16("Phy EPID that corresponds to device ID")
177 class IGbE_e1000(IGbE
):
178 # Older Intel 8254x based gigabit ethernet adapter
179 # Uses Intel e1000 driver
184 class IGbE_igb(IGbE
):
185 # Newer Intel 8257x based gigabit ethernet adapter
186 # Uses Intel igb driver and in theory supports packet splitting and LRO
191 class EtherDevBase(EtherDevice
):
192 type = 'EtherDevBase'
194 cxx_header
= "dev/net/etherdevice.hh"
196 hardware_address
= Param
.EthernetAddr(NextEthernetAddr
,
197 "Ethernet Hardware Address")
199 dma_read_delay
= Param
.Latency('0us', "fixed delay for dma reads")
200 dma_read_factor
= Param
.Latency('0us', "multiplier for dma reads")
201 dma_write_delay
= Param
.Latency('0us', "fixed delay for dma writes")
202 dma_write_factor
= Param
.Latency('0us', "multiplier for dma writes")
204 rx_delay
= Param
.Latency('1us', "Receive Delay")
205 tx_delay
= Param
.Latency('1us', "Transmit Delay")
206 rx_fifo_size
= Param
.MemorySize('512kB', "max size of rx fifo")
207 tx_fifo_size
= Param
.MemorySize('512kB', "max size of tx fifo")
209 rx_filter
= Param
.Bool(True, "Enable Receive Filter")
210 intr_delay
= Param
.Latency('10us', "Interrupt propagation delay")
211 rx_thread
= Param
.Bool(False, "dedicated kernel thread for transmit")
212 tx_thread
= Param
.Bool(False, "dedicated kernel threads for receive")
213 rss
= Param
.Bool(False, "Receive Side Scaling")
215 class NSGigE(EtherDevBase
):
217 cxx_header
= "dev/net/ns_gige.hh"
219 dma_data_free
= Param
.Bool(False, "DMA of Data is free")
220 dma_desc_free
= Param
.Bool(False, "DMA of Descriptors is free")
221 dma_no_allocate
= Param
.Bool(True, "Should we allocate cache on read")
235 MaximumLatency
= 0x34
244 class Sinic(EtherDevBase
):
246 cxx_class
= 'Sinic::Device'
247 cxx_header
= "dev/net/sinic.hh"
249 rx_max_copy
= Param
.MemorySize('1514B', "rx max copy")
250 tx_max_copy
= Param
.MemorySize('16kB', "tx max copy")
251 rx_max_intr
= Param
.UInt32(10, "max rx packets per interrupt")
252 rx_fifo_threshold
= Param
.MemorySize('384kB', "rx fifo high threshold")
253 rx_fifo_low_mark
= Param
.MemorySize('128kB', "rx fifo low threshold")
254 tx_fifo_high_mark
= Param
.MemorySize('384kB', "tx fifo high threshold")
255 tx_fifo_threshold
= Param
.MemorySize('128kB', "tx fifo low threshold")
256 virtual_count
= Param
.UInt32(1, "Virtualized SINIC")
257 zero_copy_size
= Param
.UInt32(64, "Bytes to copy if below threshold")
258 zero_copy_threshold
= Param
.UInt32(256,
259 "Only zero copy above this threshold")
260 zero_copy
= Param
.Bool(False, "Zero copy receive")
261 delay_copy
= Param
.Bool(False, "Delayed copy transmit")
262 virtual_addr
= Param
.Bool(False, "Virtual addressing")
276 MaximumLatency
= 0x34