Ethernet.py revision 10923
12330SN/A# Copyright (c) 2015 ARM Limited 22330SN/A# All rights reserved. 32330SN/A# 42330SN/A# The license below extends only to copyright in the software and shall 52330SN/A# not be construed as granting a license to any other intellectual 62330SN/A# property including but not limited to intellectual property relating 72330SN/A# to a hardware implementation of the functionality of the software 82330SN/A# licensed hereunder. You may use the software subject to the license 92330SN/A# terms below provided that you ensure that this notice is replicated 102330SN/A# unmodified and in its entirety in all distributions of the software, 112330SN/A# modified or unmodified, in source code or in binary form. 122330SN/A# 132330SN/A# Copyright (c) 2005-2007 The Regents of The University of Michigan 142330SN/A# All rights reserved. 152330SN/A# 162330SN/A# Redistribution and use in source and binary forms, with or without 172330SN/A# modification, are permitted provided that the following conditions are 182330SN/A# met: redistributions of source code must retain the above copyright 192330SN/A# notice, this list of conditions and the following disclaimer; 202330SN/A# redistributions in binary form must reproduce the above copyright 212330SN/A# notice, this list of conditions and the following disclaimer in the 222330SN/A# documentation and/or other materials provided with the distribution; 232330SN/A# neither the name of the copyright holders nor the names of its 242330SN/A# contributors may be used to endorse or promote products derived from 252330SN/A# this software without specific prior written permission. 262330SN/A# 272689Sktlim@umich.edu# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 282689Sktlim@umich.edu# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 292330SN/A# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 302292SN/A# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 312292SN/A# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 322292SN/A# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 332292SN/A# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 342980Sgblack@eecs.umich.edu# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 356658Snate@binkert.org# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 368229Snate@binkert.org# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 372362SN/A# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 382680Sktlim@umich.edu# 392683Sktlim@umich.edu# Authors: Nathan Binkert 402683Sktlim@umich.edu 412678Sktlim@umich.edufrom m5.SimObject import SimObject 422292SN/Afrom m5.params import * 432292SN/Afrom m5.proxy import * 442292SN/Afrom Pci import PciDevice 453548Sgblack@eecs.umich.edu 463548Sgblack@eecs.umich.educlass EtherObject(SimObject): 473548Sgblack@eecs.umich.edu type = 'EtherObject' 483548Sgblack@eecs.umich.edu abstract = True 492330SN/A cxx_header = "dev/etherobject.hh" 502292SN/A 512862Sktlim@umich.educlass EtherLink(EtherObject): 522862Sktlim@umich.edu type = 'EtherLink' 532330SN/A cxx_header = "dev/etherlink.hh" 542330SN/A int0 = SlavePort("interface 0") 552330SN/A int1 = SlavePort("interface 1") 562330SN/A delay = Param.Latency('0us', "packet transmit delay") 572330SN/A delay_var = Param.Latency('0ns', "packet transmit delay variability") 582330SN/A speed = Param.NetworkBandwidth('1Gbps', "link speed") 592292SN/A dump = Param.EtherDump(NULL, "dump object") 602683Sktlim@umich.edu 612683Sktlim@umich.educlass MultiEtherLink(EtherObject): 626331Sgblack@eecs.umich.edu type = 'MultiEtherLink' 632683Sktlim@umich.edu cxx_header = "dev/multi_etherlink.hh" 648735Sandreas.hanson@arm.com int0 = SlavePort("interface 0") 653486Sktlim@umich.edu delay = Param.Latency('0us', "packet transmit delay") 662862Sktlim@umich.edu delay_var = Param.Latency('0ns', "packet transmit delay variability") 672862Sktlim@umich.edu speed = Param.NetworkBandwidth('1Gbps', "link speed") 682862Sktlim@umich.edu dump = Param.EtherDump(NULL, "dump object") 692862Sktlim@umich.edu multi_rank = Param.UInt32('0', "Rank of the this gem5 process (multi run)") 705712Shsul@eecs.umich.edu sync_start = Param.Latency('5200000000000t', "first multi sync barrier") 712683Sktlim@umich.edu sync_repeat = Param.Latency('10us', "multi sync barrier repeat") 725714Shsul@eecs.umich.edu server_name = Param.String('localhost', "Message server name") 735714Shsul@eecs.umich.edu server_port = Param.UInt32('2200', "Message server port") 745714Shsul@eecs.umich.edu 755714Shsul@eecs.umich.educlass EtherBus(EtherObject): 766221Snate@binkert.org type = 'EtherBus' 772683Sktlim@umich.edu cxx_header = "dev/etherbus.hh" 786221Snate@binkert.org loopback = Param.Bool(True, "send packet back to the sending interface") 792683Sktlim@umich.edu dump = Param.EtherDump(NULL, "dump object") 802683Sktlim@umich.edu speed = Param.NetworkBandwidth('100Mbps', "bus speed in bits per second") 812683Sktlim@umich.edu 822683Sktlim@umich.educlass EtherTap(EtherObject): 832683Sktlim@umich.edu type = 'EtherTap' 848706Sandreas.hansson@arm.com cxx_header = "dev/ethertap.hh" 858706Sandreas.hansson@arm.com bufsz = Param.Int(10000, "tap buffer size") 868706Sandreas.hansson@arm.com dump = Param.EtherDump(NULL, "dump object") 878706Sandreas.hansson@arm.com port = Param.UInt16(3500, "tap port") 888706Sandreas.hansson@arm.com 898706Sandreas.hansson@arm.comclass EtherDump(SimObject): 908706Sandreas.hansson@arm.com type = 'EtherDump' 913675Sktlim@umich.edu cxx_header = "dev/etherdump.hh" 922683Sktlim@umich.edu file = Param.String("dump file") 932683Sktlim@umich.edu maxlen = Param.Int(96, "max portion of packet data to dump") 942683Sktlim@umich.edu 952683Sktlim@umich.educlass EtherDevice(PciDevice): 962683Sktlim@umich.edu type = 'EtherDevice' 972683Sktlim@umich.edu abstract = True 982683Sktlim@umich.edu cxx_header = "dev/etherdevice.hh" 992683Sktlim@umich.edu interface = MasterPort("Ethernet Interface") 1003548Sgblack@eecs.umich.edu 1012683Sktlim@umich.educlass IGbE(EtherDevice): 1028852Sandreas.hansson@arm.com # Base class for two IGbE adapters listed above 1032690Sktlim@umich.edu type = 'IGbE' 1048852Sandreas.hansson@arm.com cxx_header = "dev/i8254xGBe.hh" 1058799Sgblack@eecs.umich.edu hardware_address = Param.EthernetAddr(NextEthernetAddr, 1062683Sktlim@umich.edu "Ethernet Hardware Address") 1072683Sktlim@umich.edu rx_fifo_size = Param.MemorySize('384kB', "Size of the rx FIFO") 1088852Sandreas.hansson@arm.com tx_fifo_size = Param.MemorySize('384kB', "Size of the tx FIFO") 1092292SN/A rx_desc_cache_size = Param.Int(64, 1102683Sktlim@umich.edu "Number of enteries in the rx descriptor cache") 1112683Sktlim@umich.edu tx_desc_cache_size = Param.Int(64, 1122683Sktlim@umich.edu "Number of enteries in the rx descriptor cache") 1132683Sktlim@umich.edu VendorID = 0x8086 1142683Sktlim@umich.edu SubsystemID = 0x1008 1152683Sktlim@umich.edu SubsystemVendorID = 0x8086 1162683Sktlim@umich.edu Status = 0x0000 1172683Sktlim@umich.edu SubClassCode = 0x00 1182683Sktlim@umich.edu ClassCode = 0x02 1192683Sktlim@umich.edu ProgIF = 0x00 1202683Sktlim@umich.edu BAR0 = 0x00000000 1212683Sktlim@umich.edu BAR1 = 0x00000000 1222683Sktlim@umich.edu BAR2 = 0x00000000 1232683Sktlim@umich.edu BAR3 = 0x00000000 1242683Sktlim@umich.edu BAR4 = 0x00000000 1252683Sktlim@umich.edu BAR5 = 0x00000000 1263673Srdreslin@umich.edu MaximumLatency = 0x00 1273486Sktlim@umich.edu MinimumGrant = 0xff 1282683Sktlim@umich.edu InterruptLine = 0x1e 1292683Sktlim@umich.edu InterruptPin = 0x01 1302683Sktlim@umich.edu BAR0Size = '128kB' 1315999Snate@binkert.org wb_delay = Param.Latency('10ns', "delay before desc writeback occurs") 1328834Satgutier@umich.edu fetch_delay = Param.Latency('10ns', "delay before desc fetch occurs") 1338834Satgutier@umich.edu fetch_comp_delay = Param.Latency('10ns', "delay after desc fetch occurs") 1348834Satgutier@umich.edu wb_comp_delay = Param.Latency('10ns', "delay after desc wb occurs") 1358834Satgutier@umich.edu tx_read_delay = Param.Latency('0ns', "delay after tx dma read") 1362683Sktlim@umich.edu rx_write_delay = Param.Latency('0ns', "delay after rx dma read") 1375999Snate@binkert.org phy_pid = Param.UInt16("Phy PID that corresponds to device ID") 1382683Sktlim@umich.edu phy_epid = Param.UInt16("Phy EPID that corresponds to device ID") 1392683Sktlim@umich.edu 1402683Sktlim@umich.educlass IGbE_e1000(IGbE): 1412683Sktlim@umich.edu # Older Intel 8254x based gigabit ethernet adapter 1422683Sktlim@umich.edu # Uses Intel e1000 driver 1432683Sktlim@umich.edu DeviceID = 0x1075 1442683Sktlim@umich.edu phy_pid = 0x02A8 1452683Sktlim@umich.edu phy_epid = 0x0380 1462683Sktlim@umich.edu 1472683Sktlim@umich.educlass IGbE_igb(IGbE): 1482683Sktlim@umich.edu # Newer Intel 8257x based gigabit ethernet adapter 1492683Sktlim@umich.edu # Uses Intel igb driver and in theory supports packet splitting and LRO 1503402Sktlim@umich.edu DeviceID = 0x10C9 1513402Sktlim@umich.edu phy_pid = 0x0141 1523402Sktlim@umich.edu phy_epid = 0x0CC0 1535714Shsul@eecs.umich.edu 1545714Shsul@eecs.umich.educlass EtherDevBase(EtherDevice): 1555714Shsul@eecs.umich.edu type = 'EtherDevBase' 1562292SN/A abstract = True 1576221Snate@binkert.org cxx_header = "dev/etherdevice.hh" 1582292SN/A 1592690Sktlim@umich.edu hardware_address = Param.EthernetAddr(NextEthernetAddr, 1602683Sktlim@umich.edu "Ethernet Hardware Address") 1612683Sktlim@umich.edu 1622292SN/A dma_read_delay = Param.Latency('0us', "fixed delay for dma reads") 1632683Sktlim@umich.edu dma_read_factor = Param.Latency('0us', "multiplier for dma reads") 1642683Sktlim@umich.edu dma_write_delay = Param.Latency('0us', "fixed delay for dma writes") 1652292SN/A dma_write_factor = Param.Latency('0us', "multiplier for dma writes") 1662683Sktlim@umich.edu 1672292SN/A rx_delay = Param.Latency('1us', "Receive Delay") 1682292SN/A tx_delay = Param.Latency('1us', "Transmit Delay") 1692292SN/A rx_fifo_size = Param.MemorySize('512kB', "max size of rx fifo") 1702292SN/A tx_fifo_size = Param.MemorySize('512kB', "max size of tx fifo") 1712292SN/A 1723548Sgblack@eecs.umich.edu rx_filter = Param.Bool(True, "Enable Receive Filter") 1738777Sgblack@eecs.umich.edu intr_delay = Param.Latency('10us', "Interrupt propagation delay") 1742683Sktlim@umich.edu rx_thread = Param.Bool(False, "dedicated kernel thread for transmit") 1758229Snate@binkert.org tx_thread = Param.Bool(False, "dedicated kernel threads for receive") 1768229Snate@binkert.org rss = Param.Bool(False, "Receive Side Scaling") 1778706Sandreas.hansson@arm.com 1782683Sktlim@umich.educlass NSGigE(EtherDevBase): 1798706Sandreas.hansson@arm.com type = 'NSGigE' 1802683Sktlim@umich.edu cxx_header = "dev/ns_gige.hh" 1818706Sandreas.hansson@arm.com 1828706Sandreas.hansson@arm.com dma_data_free = Param.Bool(False, "DMA of Data is free") 1838852Sandreas.hansson@arm.com dma_desc_free = Param.Bool(False, "DMA of Descriptors is free") 1848852Sandreas.hansson@arm.com dma_no_allocate = Param.Bool(True, "Should we allocate cache on read") 1852678Sktlim@umich.edu 1862690Sktlim@umich.edu VendorID = 0x100B 1872292SN/A DeviceID = 0x0022 1882292SN/A Status = 0x0290 1892292SN/A SubClassCode = 0x00 1902292SN/A ClassCode = 0x02 1912292SN/A ProgIF = 0x00 1922292SN/A BAR0 = 0x00000001 1932292SN/A BAR1 = 0x00000000 1942292SN/A BAR2 = 0x00000000 1952292SN/A BAR3 = 0x00000000 1962292SN/A BAR4 = 0x00000000 1972292SN/A BAR5 = 0x00000000 1982292SN/A MaximumLatency = 0x34 1992292SN/A MinimumGrant = 0xb0 200 InterruptLine = 0x1e 201 InterruptPin = 0x01 202 BAR0Size = '256B' 203 BAR1Size = '4kB' 204 205 206 207class Sinic(EtherDevBase): 208 type = 'Sinic' 209 cxx_class = 'Sinic::Device' 210 cxx_header = "dev/sinic.hh" 211 212 rx_max_copy = Param.MemorySize('1514B', "rx max copy") 213 tx_max_copy = Param.MemorySize('16kB', "tx max copy") 214 rx_max_intr = Param.UInt32(10, "max rx packets per interrupt") 215 rx_fifo_threshold = Param.MemorySize('384kB', "rx fifo high threshold") 216 rx_fifo_low_mark = Param.MemorySize('128kB', "rx fifo low threshold") 217 tx_fifo_high_mark = Param.MemorySize('384kB', "tx fifo high threshold") 218 tx_fifo_threshold = Param.MemorySize('128kB', "tx fifo low threshold") 219 virtual_count = Param.UInt32(1, "Virtualized SINIC") 220 zero_copy_size = Param.UInt32(64, "Bytes to copy if below threshold") 221 zero_copy_threshold = Param.UInt32(256, 222 "Only zero copy above this threshold") 223 zero_copy = Param.Bool(False, "Zero copy receive") 224 delay_copy = Param.Bool(False, "Delayed copy transmit") 225 virtual_addr = Param.Bool(False, "Virtual addressing") 226 227 VendorID = 0x1291 228 DeviceID = 0x1293 229 Status = 0x0290 230 SubClassCode = 0x00 231 ClassCode = 0x02 232 ProgIF = 0x00 233 BAR0 = 0x00000000 234 BAR1 = 0x00000000 235 BAR2 = 0x00000000 236 BAR3 = 0x00000000 237 BAR4 = 0x00000000 238 BAR5 = 0x00000000 239 MaximumLatency = 0x34 240 MinimumGrant = 0xb0 241 InterruptLine = 0x1e 242 InterruptPin = 0x01 243 BAR0Size = '64kB' 244 245 246