Ethernet.py revision 11290
110923SN/A# Copyright (c) 2015 ARM Limited 210923SN/A# All rights reserved. 310923SN/A# 410923SN/A# The license below extends only to copyright in the software and shall 510923SN/A# not be construed as granting a license to any other intellectual 610923SN/A# property including but not limited to intellectual property relating 710923SN/A# to a hardware implementation of the functionality of the software 810923SN/A# licensed hereunder. You may use the software subject to the license 910923SN/A# terms below provided that you ensure that this notice is replicated 1010923SN/A# unmodified and in its entirety in all distributions of the software, 1110923SN/A# modified or unmodified, in source code or in binary form. 1210923SN/A# 134486SN/A# Copyright (c) 2005-2007 The Regents of The University of Michigan 144486SN/A# All rights reserved. 154486SN/A# 164486SN/A# Redistribution and use in source and binary forms, with or without 174486SN/A# modification, are permitted provided that the following conditions are 184486SN/A# met: redistributions of source code must retain the above copyright 194486SN/A# notice, this list of conditions and the following disclaimer; 204486SN/A# redistributions in binary form must reproduce the above copyright 214486SN/A# notice, this list of conditions and the following disclaimer in the 224486SN/A# documentation and/or other materials provided with the distribution; 234486SN/A# neither the name of the copyright holders nor the names of its 244486SN/A# contributors may be used to endorse or promote products derived from 254486SN/A# this software without specific prior written permission. 264486SN/A# 274486SN/A# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 284486SN/A# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 294486SN/A# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 304486SN/A# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 314486SN/A# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 324486SN/A# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 334486SN/A# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 344486SN/A# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 354486SN/A# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 364486SN/A# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 374486SN/A# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 384486SN/A# 394486SN/A# Authors: Nathan Binkert 404486SN/A 413102SN/Afrom m5.SimObject import SimObject 423102SN/Afrom m5.params import * 433102SN/Afrom m5.proxy import * 4411260SN/Afrom PciDevice import PciDevice 451310SN/A 464981SN/Aclass EtherObject(SimObject): 474981SN/A type = 'EtherObject' 481310SN/A abstract = True 4911263Sandreas.sandberg@arm.com cxx_header = "dev/net/etherobject.hh" 501310SN/A 514981SN/Aclass EtherLink(EtherObject): 521366SN/A type = 'EtherLink' 5311263Sandreas.sandberg@arm.com cxx_header = "dev/net/etherlink.hh" 548839SN/A int0 = SlavePort("interface 0") 558839SN/A int1 = SlavePort("interface 1") 561634SN/A delay = Param.Latency('0us', "packet transmit delay") 571952SN/A delay_var = Param.Latency('0ns', "packet transmit delay variability") 581702SN/A speed = Param.NetworkBandwidth('1Gbps', "link speed") 591310SN/A dump = Param.EtherDump(NULL, "dump object") 601310SN/A 6111290Sgabor.dozsa@arm.comclass DistEtherLink(EtherObject): 6211290Sgabor.dozsa@arm.com type = 'DistEtherLink' 6311290Sgabor.dozsa@arm.com cxx_header = "dev/net/dist_etherlink.hh" 6410923SN/A int0 = SlavePort("interface 0") 6510923SN/A delay = Param.Latency('0us', "packet transmit delay") 6610923SN/A delay_var = Param.Latency('0ns', "packet transmit delay variability") 6710923SN/A speed = Param.NetworkBandwidth('1Gbps', "link speed") 6810923SN/A dump = Param.EtherDump(NULL, "dump object") 6911290Sgabor.dozsa@arm.com dist_rank = Param.UInt32('0', "Rank of this gem5 process (dist run)") 7011290Sgabor.dozsa@arm.com dist_size = Param.UInt32('1', "Number of gem5 processes (dist run)") 7111290Sgabor.dozsa@arm.com sync_start = Param.Latency('5200000000000t', "first dist sync barrier") 7211290Sgabor.dozsa@arm.com sync_repeat = Param.Latency('10us', "dist sync barrier repeat") 7310923SN/A server_name = Param.String('localhost', "Message server name") 7410923SN/A server_port = Param.UInt32('2200', "Message server port") 7511290Sgabor.dozsa@arm.com is_switch = Param.Bool(False, "true if this a link in etherswitch") 7611290Sgabor.dozsa@arm.com num_nodes = Param.UInt32('2', "Number of simulate nodes") 7710923SN/A 784981SN/Aclass EtherBus(EtherObject): 791366SN/A type = 'EtherBus' 8011263Sandreas.sandberg@arm.com cxx_header = "dev/net/etherbus.hh" 811634SN/A loopback = Param.Bool(True, "send packet back to the sending interface") 821310SN/A dump = Param.EtherDump(NULL, "dump object") 831634SN/A speed = Param.NetworkBandwidth('100Mbps', "bus speed in bits per second") 841310SN/A 854981SN/Aclass EtherTap(EtherObject): 861366SN/A type = 'EtherTap' 8711263Sandreas.sandberg@arm.com cxx_header = "dev/net/ethertap.hh" 881310SN/A bufsz = Param.Int(10000, "tap buffer size") 891310SN/A dump = Param.EtherDump(NULL, "dump object") 901310SN/A port = Param.UInt16(3500, "tap port") 911310SN/A 921692SN/Aclass EtherDump(SimObject): 931366SN/A type = 'EtherDump' 9411263Sandreas.sandberg@arm.com cxx_header = "dev/net/etherdump.hh" 951310SN/A file = Param.String("dump file") 961880SN/A maxlen = Param.Int(96, "max portion of packet data to dump") 971310SN/A 984981SN/Aclass EtherDevice(PciDevice): 994981SN/A type = 'EtherDevice' 1004981SN/A abstract = True 10111263Sandreas.sandberg@arm.com cxx_header = "dev/net/etherdevice.hh" 1028839SN/A interface = MasterPort("Ethernet Interface") 1034981SN/A 1044981SN/Aclass IGbE(EtherDevice): 1055763SN/A # Base class for two IGbE adapters listed above 1063116SN/A type = 'IGbE' 10711263Sandreas.sandberg@arm.com cxx_header = "dev/net/i8254xGBe.hh" 1084597SN/A hardware_address = Param.EthernetAddr(NextEthernetAddr, 1094597SN/A "Ethernet Hardware Address") 1104283SN/A rx_fifo_size = Param.MemorySize('384kB', "Size of the rx FIFO") 1114283SN/A tx_fifo_size = Param.MemorySize('384kB', "Size of the tx FIFO") 1124486SN/A rx_desc_cache_size = Param.Int(64, 1134486SN/A "Number of enteries in the rx descriptor cache") 1144486SN/A tx_desc_cache_size = Param.Int(64, 1154486SN/A "Number of enteries in the rx descriptor cache") 1163116SN/A VendorID = 0x8086 1173116SN/A SubsystemID = 0x1008 1183116SN/A SubsystemVendorID = 0x8086 1193116SN/A Status = 0x0000 1203116SN/A SubClassCode = 0x00 1213116SN/A ClassCode = 0x02 1223116SN/A ProgIF = 0x00 1233116SN/A BAR0 = 0x00000000 1243116SN/A BAR1 = 0x00000000 1253116SN/A BAR2 = 0x00000000 1263116SN/A BAR3 = 0x00000000 1273116SN/A BAR4 = 0x00000000 1283116SN/A BAR5 = 0x00000000 1293116SN/A MaximumLatency = 0x00 1303116SN/A MinimumGrant = 0xff 1313116SN/A InterruptLine = 0x1e 1323116SN/A InterruptPin = 0x01 1333116SN/A BAR0Size = '128kB' 1345535SN/A wb_delay = Param.Latency('10ns', "delay before desc writeback occurs") 1355535SN/A fetch_delay = Param.Latency('10ns', "delay before desc fetch occurs") 1365535SN/A fetch_comp_delay = Param.Latency('10ns', "delay after desc fetch occurs") 1375535SN/A wb_comp_delay = Param.Latency('10ns', "delay after desc wb occurs") 1385535SN/A tx_read_delay = Param.Latency('0ns', "delay after tx dma read") 1395535SN/A rx_write_delay = Param.Latency('0ns', "delay after rx dma read") 1405781SN/A phy_pid = Param.UInt16("Phy PID that corresponds to device ID") 1415781SN/A phy_epid = Param.UInt16("Phy EPID that corresponds to device ID") 1423116SN/A 1435763SN/Aclass IGbE_e1000(IGbE): 1445763SN/A # Older Intel 8254x based gigabit ethernet adapter 1455763SN/A # Uses Intel e1000 driver 1465763SN/A DeviceID = 0x1075 1475781SN/A phy_pid = 0x02A8 1485781SN/A phy_epid = 0x0380 1495763SN/A 1505763SN/Aclass IGbE_igb(IGbE): 1515763SN/A # Newer Intel 8257x based gigabit ethernet adapter 1525763SN/A # Uses Intel igb driver and in theory supports packet splitting and LRO 1535763SN/A DeviceID = 0x10C9 1545781SN/A phy_pid = 0x0141 1555781SN/A phy_epid = 0x0CC0 1565763SN/A 1574981SN/Aclass EtherDevBase(EtherDevice): 1584597SN/A type = 'EtherDevBase' 1594597SN/A abstract = True 16011263Sandreas.sandberg@arm.com cxx_header = "dev/net/etherdevice.hh" 1619339SN/A 1621310SN/A hardware_address = Param.EthernetAddr(NextEthernetAddr, 1631310SN/A "Ethernet Hardware Address") 1641310SN/A 1651634SN/A dma_read_delay = Param.Latency('0us', "fixed delay for dma reads") 1661634SN/A dma_read_factor = Param.Latency('0us', "multiplier for dma reads") 1671634SN/A dma_write_delay = Param.Latency('0us', "fixed delay for dma writes") 1681634SN/A dma_write_factor = Param.Latency('0us', "multiplier for dma writes") 1691647SN/A 1701925SN/A rx_delay = Param.Latency('1us', "Receive Delay") 1711925SN/A tx_delay = Param.Latency('1us', "Transmit Delay") 1721925SN/A rx_fifo_size = Param.MemorySize('512kB', "max size of rx fifo") 1731925SN/A tx_fifo_size = Param.MemorySize('512kB', "max size of tx fifo") 1741310SN/A 1751369SN/A rx_filter = Param.Bool(True, "Enable Receive Filter") 1762008SN/A intr_delay = Param.Latency('10us', "Interrupt propagation delay") 1772008SN/A rx_thread = Param.Bool(False, "dedicated kernel thread for transmit") 1782008SN/A tx_thread = Param.Bool(False, "dedicated kernel threads for receive") 1792210SN/A rss = Param.Bool(False, "Receive Side Scaling") 1801310SN/A 1814982SN/Aclass NSGigE(EtherDevBase): 1824982SN/A type = 'NSGigE' 18311263Sandreas.sandberg@arm.com cxx_header = "dev/net/ns_gige.hh" 1844982SN/A 1854982SN/A dma_data_free = Param.Bool(False, "DMA of Data is free") 1864982SN/A dma_desc_free = Param.Bool(False, "DMA of Descriptors is free") 1874982SN/A dma_no_allocate = Param.Bool(True, "Should we allocate cache on read") 1884982SN/A 1892916SN/A VendorID = 0x100B 1902916SN/A DeviceID = 0x0022 1912916SN/A Status = 0x0290 1922916SN/A SubClassCode = 0x00 1932916SN/A ClassCode = 0x02 1942916SN/A ProgIF = 0x00 1952916SN/A BAR0 = 0x00000001 1962916SN/A BAR1 = 0x00000000 1972916SN/A BAR2 = 0x00000000 1982916SN/A BAR3 = 0x00000000 1992916SN/A BAR4 = 0x00000000 2002916SN/A BAR5 = 0x00000000 2012916SN/A MaximumLatency = 0x34 2022916SN/A MinimumGrant = 0xb0 2032916SN/A InterruptLine = 0x1e 2042916SN/A InterruptPin = 0x01 2052916SN/A BAR0Size = '256B' 2062916SN/A BAR1Size = '4kB' 2072916SN/A 2081310SN/A 2091644SN/A 2104982SN/Aclass Sinic(EtherDevBase): 2114982SN/A type = 'Sinic' 2125610SN/A cxx_class = 'Sinic::Device' 21311263Sandreas.sandberg@arm.com cxx_header = "dev/net/sinic.hh" 2142916SN/A 2154982SN/A rx_max_copy = Param.MemorySize('1514B', "rx max copy") 2164982SN/A tx_max_copy = Param.MemorySize('16kB', "tx max copy") 2174982SN/A rx_max_intr = Param.UInt32(10, "max rx packets per interrupt") 2184982SN/A rx_fifo_threshold = Param.MemorySize('384kB', "rx fifo high threshold") 2194982SN/A rx_fifo_low_mark = Param.MemorySize('128kB', "rx fifo low threshold") 2204982SN/A tx_fifo_high_mark = Param.MemorySize('384kB', "tx fifo high threshold") 2214982SN/A tx_fifo_threshold = Param.MemorySize('128kB', "tx fifo low threshold") 2224982SN/A virtual_count = Param.UInt32(1, "Virtualized SINIC") 2235603SN/A zero_copy_size = Param.UInt32(64, "Bytes to copy if below threshold") 2245603SN/A zero_copy_threshold = Param.UInt32(256, 2255603SN/A "Only zero copy above this threshold") 2264982SN/A zero_copy = Param.Bool(False, "Zero copy receive") 2274982SN/A delay_copy = Param.Bool(False, "Delayed copy transmit") 2284982SN/A virtual_addr = Param.Bool(False, "Virtual addressing") 2291310SN/A 2302916SN/A VendorID = 0x1291 2312916SN/A DeviceID = 0x1293 2322916SN/A Status = 0x0290 2332916SN/A SubClassCode = 0x00 2342916SN/A ClassCode = 0x02 2352916SN/A ProgIF = 0x00 2362916SN/A BAR0 = 0x00000000 2372916SN/A BAR1 = 0x00000000 2382916SN/A BAR2 = 0x00000000 2392916SN/A BAR3 = 0x00000000 2402916SN/A BAR4 = 0x00000000 2412916SN/A BAR5 = 0x00000000 2422916SN/A MaximumLatency = 0x34 2432916SN/A MinimumGrant = 0xb0 2442916SN/A InterruptLine = 0x1e 2452916SN/A InterruptPin = 0x01 2462916SN/A BAR0Size = '64kB' 2472916SN/A 2481310SN/A 249