Ethernet.py revision 12055
14309Sgblack@eecs.umich.edu# Copyright (c) 2015 ARM Limited 24309Sgblack@eecs.umich.edu# All rights reserved. 35426Sgblack@eecs.umich.edu# 44309Sgblack@eecs.umich.edu# The license below extends only to copyright in the software and shall 54309Sgblack@eecs.umich.edu# not be construed as granting a license to any other intellectual 64309Sgblack@eecs.umich.edu# property including but not limited to intellectual property relating 74309Sgblack@eecs.umich.edu# to a hardware implementation of the functionality of the software 84309Sgblack@eecs.umich.edu# licensed hereunder. You may use the software subject to the license 94309Sgblack@eecs.umich.edu# terms below provided that you ensure that this notice is replicated 104309Sgblack@eecs.umich.edu# unmodified and in its entirety in all distributions of the software, 114309Sgblack@eecs.umich.edu# modified or unmodified, in source code or in binary form. 124309Sgblack@eecs.umich.edu# 134309Sgblack@eecs.umich.edu# Copyright (c) 2005-2007 The Regents of The University of Michigan 144309Sgblack@eecs.umich.edu# All rights reserved. 154309Sgblack@eecs.umich.edu# 164309Sgblack@eecs.umich.edu# Redistribution and use in source and binary forms, with or without 174309Sgblack@eecs.umich.edu# modification, are permitted provided that the following conditions are 184309Sgblack@eecs.umich.edu# met: redistributions of source code must retain the above copyright 194309Sgblack@eecs.umich.edu# notice, this list of conditions and the following disclaimer; 204309Sgblack@eecs.umich.edu# redistributions in binary form must reproduce the above copyright 214309Sgblack@eecs.umich.edu# notice, this list of conditions and the following disclaimer in the 224309Sgblack@eecs.umich.edu# documentation and/or other materials provided with the distribution; 234309Sgblack@eecs.umich.edu# neither the name of the copyright holders nor the names of its 244309Sgblack@eecs.umich.edu# contributors may be used to endorse or promote products derived from 254309Sgblack@eecs.umich.edu# this software without specific prior written permission. 264309Sgblack@eecs.umich.edu# 274309Sgblack@eecs.umich.edu# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 284309Sgblack@eecs.umich.edu# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 294309Sgblack@eecs.umich.edu# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 304309Sgblack@eecs.umich.edu# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 314309Sgblack@eecs.umich.edu# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 324309Sgblack@eecs.umich.edu# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 334309Sgblack@eecs.umich.edu# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 344309Sgblack@eecs.umich.edu# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 354309Sgblack@eecs.umich.edu# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 364309Sgblack@eecs.umich.edu# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 374309Sgblack@eecs.umich.edu# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 384309Sgblack@eecs.umich.edu# 394309Sgblack@eecs.umich.edu# Authors: Nathan Binkert 404309Sgblack@eecs.umich.edu 414309Sgblack@eecs.umich.edufrom m5.SimObject import SimObject 424309Sgblack@eecs.umich.edufrom m5.params import * 434309Sgblack@eecs.umich.edufrom m5.proxy import * 444309Sgblack@eecs.umich.edufrom PciDevice import PciDevice 454309Sgblack@eecs.umich.edu 464309Sgblack@eecs.umich.educlass EtherObject(SimObject): 474309Sgblack@eecs.umich.edu type = 'EtherObject' 484309Sgblack@eecs.umich.edu abstract = True 494309Sgblack@eecs.umich.edu cxx_header = "dev/net/etherobject.hh" 504309Sgblack@eecs.umich.edu 514309Sgblack@eecs.umich.educlass EtherLink(EtherObject): 524309Sgblack@eecs.umich.edu type = 'EtherLink' 534309Sgblack@eecs.umich.edu cxx_header = "dev/net/etherlink.hh" 544309Sgblack@eecs.umich.edu int0 = SlavePort("interface 0") 554309Sgblack@eecs.umich.edu int1 = SlavePort("interface 1") 564309Sgblack@eecs.umich.edu delay = Param.Latency('0us', "packet transmit delay") 574309Sgblack@eecs.umich.edu delay_var = Param.Latency('0ns', "packet transmit delay variability") 584533Sgblack@eecs.umich.edu speed = Param.NetworkBandwidth('1Gbps', "link speed") 594679Sgblack@eecs.umich.edu dump = Param.EtherDump(NULL, "dump object") 604679Sgblack@eecs.umich.edu 614679Sgblack@eecs.umich.educlass DistEtherLink(EtherObject): 624533Sgblack@eecs.umich.edu type = 'DistEtherLink' 634533Sgblack@eecs.umich.edu cxx_header = "dev/net/dist_etherlink.hh" 644537Sgblack@eecs.umich.edu int0 = SlavePort("interface 0") 654533Sgblack@eecs.umich.edu delay = Param.Latency('0us', "packet transmit delay") 664528Sgblack@eecs.umich.edu delay_var = Param.Latency('0ns', "packet transmit delay variability") 675666Sgblack@eecs.umich.edu speed = Param.NetworkBandwidth('1Gbps', "link speed") 685666Sgblack@eecs.umich.edu dump = Param.EtherDump(NULL, "dump object") 695666Sgblack@eecs.umich.edu dist_rank = Param.UInt32('0', "Rank of this gem5 process (dist run)") 704528Sgblack@eecs.umich.edu dist_size = Param.UInt32('1', "Number of gem5 processes (dist run)") 714528Sgblack@eecs.umich.edu sync_start = Param.Latency('5200000000000t', "first dist sync barrier") 724528Sgblack@eecs.umich.edu sync_repeat = Param.Latency('10us', "dist sync barrier repeat") 734528Sgblack@eecs.umich.edu server_name = Param.String('localhost', "Message server name") 744605Sgblack@eecs.umich.edu server_port = Param.UInt32('2200', "Message server port") 755666Sgblack@eecs.umich.edu is_switch = Param.Bool(False, "true if this a link in etherswitch") 765666Sgblack@eecs.umich.edu dist_sync_on_pseudo_op = Param.Bool(False, "Start sync with pseudo_op") 774528Sgblack@eecs.umich.edu num_nodes = Param.UInt32('2', "Number of simulate nodes") 784615Sgblack@eecs.umich.edu 795854Sgblack@eecs.umich.educlass EtherBus(EtherObject): 804615Sgblack@eecs.umich.edu type = 'EtherBus' 815854Sgblack@eecs.umich.edu cxx_header = "dev/net/etherbus.hh" 825045Sgblack@eecs.umich.edu loopback = Param.Bool(True, "send packet back to the sending interface") 834615Sgblack@eecs.umich.edu dump = Param.EtherDump(NULL, "dump object") 845671Sgblack@eecs.umich.edu speed = Param.NetworkBandwidth('100Mbps', "bus speed in bits per second") 854615Sgblack@eecs.umich.edu 865291Sgblack@eecs.umich.educlass EtherSwitch(EtherObject): 875428Sgblack@eecs.umich.edu type = 'EtherSwitch' 885674Sgblack@eecs.umich.edu cxx_header = "dev/net/etherswitch.hh" 895899Sgblack@eecs.umich.edu dump = Param.EtherDump(NULL, "dump object") 905900Sgblack@eecs.umich.edu fabric_speed = Param.NetworkBandwidth('10Gbps', "switch fabric speed in bits " 915428Sgblack@eecs.umich.edu "per second") 925428Sgblack@eecs.umich.edu interface = VectorMasterPort("Ethernet Interface") 935294Sgblack@eecs.umich.edu output_buffer_size = Param.MemorySize('1MB', "size of output port buffers") 945291Sgblack@eecs.umich.edu delay = Param.Latency('0us', "packet transmit delay") 955291Sgblack@eecs.umich.edu delay_var = Param.Latency('0ns', "packet transmit delay variability") 965294Sgblack@eecs.umich.edu time_to_live = Param.Latency('10ms', "time to live of MAC address maping") 975294Sgblack@eecs.umich.edu 985294Sgblack@eecs.umich.educlass EtherTapBase(EtherObject): 994615Sgblack@eecs.umich.edu type = 'EtherTapBase' 1004615Sgblack@eecs.umich.edu abstract = True 1014615Sgblack@eecs.umich.edu cxx_header = "dev/net/ethertap.hh" 1025029Sgblack@eecs.umich.edu bufsz = Param.Int(10000, "tap buffer size") 1035029Sgblack@eecs.umich.edu dump = Param.EtherDump(NULL, "dump object") 1044615Sgblack@eecs.umich.edu tap = SlavePort("Ethernet interface to connect to gem5's network") 1055029Sgblack@eecs.umich.edu 1065029Sgblack@eecs.umich.educlass EtherTapStub(EtherTapBase): 1075161Sgblack@eecs.umich.edu type = 'EtherTapStub' 1085161Sgblack@eecs.umich.edu cxx_header = "dev/net/ethertap.hh" 1094863Sgblack@eecs.umich.edu port = Param.UInt16(3500, "Port helper should send packets to") 1104615Sgblack@eecs.umich.edu 1114615Sgblack@eecs.umich.educlass EtherDump(SimObject): 1124615Sgblack@eecs.umich.edu type = 'EtherDump' 1134615Sgblack@eecs.umich.edu cxx_header = "dev/net/etherdump.hh" 1144953Sgblack@eecs.umich.edu file = Param.String("dump file") 1154615Sgblack@eecs.umich.edu maxlen = Param.Int(96, "max portion of packet data to dump") 1164615Sgblack@eecs.umich.edu 1174863Sgblack@eecs.umich.educlass EtherDevice(PciDevice): 1184863Sgblack@eecs.umich.edu type = 'EtherDevice' 1195326Sgblack@eecs.umich.edu abstract = True 1205326Sgblack@eecs.umich.edu cxx_header = "dev/net/etherdevice.hh" 1215326Sgblack@eecs.umich.edu interface = MasterPort("Ethernet Interface") 1225326Sgblack@eecs.umich.edu 1235326Sgblack@eecs.umich.educlass IGbE(EtherDevice): 1245326Sgblack@eecs.umich.edu # Base class for two IGbE adapters listed above 1255326Sgblack@eecs.umich.edu type = 'IGbE' 1265326Sgblack@eecs.umich.edu cxx_header = "dev/net/i8254xGBe.hh" 1275326Sgblack@eecs.umich.edu hardware_address = Param.EthernetAddr(NextEthernetAddr, 1284863Sgblack@eecs.umich.edu "Ethernet Hardware Address") 1294863Sgblack@eecs.umich.edu rx_fifo_size = Param.MemorySize('384kB', "Size of the rx FIFO") 1304863Sgblack@eecs.umich.edu tx_fifo_size = Param.MemorySize('384kB', "Size of the tx FIFO") 1314863Sgblack@eecs.umich.edu rx_desc_cache_size = Param.Int(64, 1324863Sgblack@eecs.umich.edu "Number of enteries in the rx descriptor cache") 1334620Sgblack@eecs.umich.edu tx_desc_cache_size = Param.Int(64, 1345149Sgblack@eecs.umich.edu "Number of enteries in the rx descriptor cache") 1355149Sgblack@eecs.umich.edu VendorID = 0x8086 1365294Sgblack@eecs.umich.edu SubsystemID = 0x1008 1375294Sgblack@eecs.umich.edu SubsystemVendorID = 0x8086 1385294Sgblack@eecs.umich.edu Status = 0x0000 1395294Sgblack@eecs.umich.edu SubClassCode = 0x00 1405149Sgblack@eecs.umich.edu ClassCode = 0x02 1415906Sgblack@eecs.umich.edu ProgIF = 0x00 1425906Sgblack@eecs.umich.edu BAR0 = 0x00000000 1434620Sgblack@eecs.umich.edu BAR1 = 0x00000000 1444615Sgblack@eecs.umich.edu BAR2 = 0x00000000 1455854Sgblack@eecs.umich.edu BAR3 = 0x00000000 1465241Sgblack@eecs.umich.edu BAR4 = 0x00000000 1475241Sgblack@eecs.umich.edu BAR5 = 0x00000000 1485426Sgblack@eecs.umich.edu MaximumLatency = 0x00 1495426Sgblack@eecs.umich.edu MinimumGrant = 0xff 1504686Sgblack@eecs.umich.edu InterruptLine = 0x1e 1514686Sgblack@eecs.umich.edu InterruptPin = 0x01 1524686Sgblack@eecs.umich.edu BAR0Size = '128kB' 1534953Sgblack@eecs.umich.edu wb_delay = Param.Latency('10ns', "delay before desc writeback occurs") 1544686Sgblack@eecs.umich.edu fetch_delay = Param.Latency('10ns', "delay before desc fetch occurs") 1554686Sgblack@eecs.umich.edu fetch_comp_delay = Param.Latency('10ns', "delay after desc fetch occurs") 1564686Sgblack@eecs.umich.edu wb_comp_delay = Param.Latency('10ns', "delay after desc wb occurs") 1574686Sgblack@eecs.umich.edu tx_read_delay = Param.Latency('0ns', "delay after tx dma read") 1584953Sgblack@eecs.umich.edu rx_write_delay = Param.Latency('0ns', "delay after rx dma read") 1594953Sgblack@eecs.umich.edu phy_pid = Param.UInt16("Phy PID that corresponds to device ID") 1604686Sgblack@eecs.umich.edu phy_epid = Param.UInt16("Phy EPID that corresponds to device ID") 1614686Sgblack@eecs.umich.edu 1624686Sgblack@eecs.umich.educlass IGbE_e1000(IGbE): 1634686Sgblack@eecs.umich.edu # Older Intel 8254x based gigabit ethernet adapter 1645682Sgblack@eecs.umich.edu # Uses Intel e1000 driver 1655682Sgblack@eecs.umich.edu DeviceID = 0x1075 1665682Sgblack@eecs.umich.edu phy_pid = 0x02A8 1675682Sgblack@eecs.umich.edu phy_epid = 0x0380 1685682Sgblack@eecs.umich.edu 1694615Sgblack@eecs.umich.educlass IGbE_igb(IGbE): 1704615Sgblack@eecs.umich.edu # Newer Intel 8257x based gigabit ethernet adapter 1714615Sgblack@eecs.umich.edu # Uses Intel igb driver and in theory supports packet splitting and LRO 1724615Sgblack@eecs.umich.edu DeviceID = 0x10C9 1734615Sgblack@eecs.umich.edu phy_pid = 0x0141 1744615Sgblack@eecs.umich.edu phy_epid = 0x0CC0 1754615Sgblack@eecs.umich.edu 1765930Sgblack@eecs.umich.educlass EtherDevBase(EtherDevice): 1775291Sgblack@eecs.umich.edu type = 'EtherDevBase' 1785291Sgblack@eecs.umich.edu abstract = True 1795291Sgblack@eecs.umich.edu cxx_header = "dev/net/etherdevice.hh" 1805291Sgblack@eecs.umich.edu 1815291Sgblack@eecs.umich.edu hardware_address = Param.EthernetAddr(NextEthernetAddr, 1825291Sgblack@eecs.umich.edu "Ethernet Hardware Address") 1835161Sgblack@eecs.umich.edu 1845161Sgblack@eecs.umich.edu dma_read_delay = Param.Latency('0us', "fixed delay for dma reads") 1855161Sgblack@eecs.umich.edu dma_read_factor = Param.Latency('0us', "multiplier for dma reads") 1865161Sgblack@eecs.umich.edu dma_write_delay = Param.Latency('0us', "fixed delay for dma writes") 1875161Sgblack@eecs.umich.edu dma_write_factor = Param.Latency('0us', "multiplier for dma writes") 1885008Sgblack@eecs.umich.edu 1895008Sgblack@eecs.umich.edu rx_delay = Param.Latency('1us', "Receive Delay") 1905008Sgblack@eecs.umich.edu tx_delay = Param.Latency('1us', "Transmit Delay") 1915008Sgblack@eecs.umich.edu rx_fifo_size = Param.MemorySize('512kB', "max size of rx fifo") 1925008Sgblack@eecs.umich.edu tx_fifo_size = Param.MemorySize('512kB', "max size of tx fifo") 1935667Sgblack@eecs.umich.edu 1945667Sgblack@eecs.umich.edu rx_filter = Param.Bool(True, "Enable Receive Filter") 1955667Sgblack@eecs.umich.edu intr_delay = Param.Latency('10us', "Interrupt propagation delay") 1965667Sgblack@eecs.umich.edu rx_thread = Param.Bool(False, "dedicated kernel thread for transmit") 1975667Sgblack@eecs.umich.edu tx_thread = Param.Bool(False, "dedicated kernel threads for receive") 1985676Sgblack@eecs.umich.edu rss = Param.Bool(False, "Receive Side Scaling") 1995676Sgblack@eecs.umich.edu 2005676Sgblack@eecs.umich.educlass NSGigE(EtherDevBase): 2015676Sgblack@eecs.umich.edu type = 'NSGigE' 2025676Sgblack@eecs.umich.edu cxx_header = "dev/net/ns_gige.hh" 2035082Sgblack@eecs.umich.edu 2045121Sgblack@eecs.umich.edu dma_data_free = Param.Bool(False, "DMA of Data is free") 2055082Sgblack@eecs.umich.edu dma_desc_free = Param.Bool(False, "DMA of Descriptors is free") 2065082Sgblack@eecs.umich.edu dma_no_allocate = Param.Bool(True, "Should we allocate cache on read") 2075082Sgblack@eecs.umich.edu 2084528Sgblack@eecs.umich.edu VendorID = 0x100B 2095666Sgblack@eecs.umich.edu DeviceID = 0x0022 2105666Sgblack@eecs.umich.edu Status = 0x0290 2115666Sgblack@eecs.umich.edu SubClassCode = 0x00 2124528Sgblack@eecs.umich.edu ClassCode = 0x02 213 ProgIF = 0x00 214 BAR0 = 0x00000001 215 BAR1 = 0x00000000 216 BAR2 = 0x00000000 217 BAR3 = 0x00000000 218 BAR4 = 0x00000000 219 BAR5 = 0x00000000 220 MaximumLatency = 0x34 221 MinimumGrant = 0xb0 222 InterruptLine = 0x1e 223 InterruptPin = 0x01 224 BAR0Size = '256B' 225 BAR1Size = '4kB' 226 227 228 229class Sinic(EtherDevBase): 230 type = 'Sinic' 231 cxx_class = 'Sinic::Device' 232 cxx_header = "dev/net/sinic.hh" 233 234 rx_max_copy = Param.MemorySize('1514B', "rx max copy") 235 tx_max_copy = Param.MemorySize('16kB', "tx max copy") 236 rx_max_intr = Param.UInt32(10, "max rx packets per interrupt") 237 rx_fifo_threshold = Param.MemorySize('384kB', "rx fifo high threshold") 238 rx_fifo_low_mark = Param.MemorySize('128kB', "rx fifo low threshold") 239 tx_fifo_high_mark = Param.MemorySize('384kB', "tx fifo high threshold") 240 tx_fifo_threshold = Param.MemorySize('128kB', "tx fifo low threshold") 241 virtual_count = Param.UInt32(1, "Virtualized SINIC") 242 zero_copy_size = Param.UInt32(64, "Bytes to copy if below threshold") 243 zero_copy_threshold = Param.UInt32(256, 244 "Only zero copy above this threshold") 245 zero_copy = Param.Bool(False, "Zero copy receive") 246 delay_copy = Param.Bool(False, "Delayed copy transmit") 247 virtual_addr = Param.Bool(False, "Virtual addressing") 248 249 VendorID = 0x1291 250 DeviceID = 0x1293 251 Status = 0x0290 252 SubClassCode = 0x00 253 ClassCode = 0x02 254 ProgIF = 0x00 255 BAR0 = 0x00000000 256 BAR1 = 0x00000000 257 BAR2 = 0x00000000 258 BAR3 = 0x00000000 259 BAR4 = 0x00000000 260 BAR5 = 0x00000000 261 MaximumLatency = 0x34 262 MinimumGrant = 0xb0 263 InterruptLine = 0x1e 264 InterruptPin = 0x01 265 BAR0Size = '64kB' 266 267 268