18f932d9fSChristian Brueffer.\" Copyright (c) 2011-2012 Stefan Bethke. 28f932d9fSChristian Brueffer.\" All rights reserved. 38f932d9fSChristian Brueffer.\" 48f932d9fSChristian Brueffer.\" Redistribution and use in source and binary forms, with or without 58f932d9fSChristian Brueffer.\" modification, are permitted provided that the following conditions 68f932d9fSChristian Brueffer.\" are met: 78f932d9fSChristian Brueffer.\" 1. Redistributions of source code must retain the above copyright 88f932d9fSChristian Brueffer.\" notice, this list of conditions and the following disclaimer. 98f932d9fSChristian Brueffer.\" 2. Redistributions in binary form must reproduce the above copyright 108f932d9fSChristian Brueffer.\" notice, this list of conditions and the following disclaimer in the 118f932d9fSChristian Brueffer.\" documentation and/or other materials provided with the distribution. 128f932d9fSChristian Brueffer.\" 138f932d9fSChristian Brueffer.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 148f932d9fSChristian Brueffer.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 158f932d9fSChristian Brueffer.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 168f932d9fSChristian Brueffer.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 178f932d9fSChristian Brueffer.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 188f932d9fSChristian Brueffer.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 198f932d9fSChristian Brueffer.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 208f932d9fSChristian Brueffer.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 218f932d9fSChristian Brueffer.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 228f932d9fSChristian Brueffer.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 238f932d9fSChristian Brueffer.\" SUCH DAMAGE. 248f932d9fSChristian Brueffer.\" 25*f5b29d0fSKornel Duleba.Dd June 23, 2021 26270069b7SAdrian Chadd.Dt ETHERSWITCHCFG 8 27270069b7SAdrian Chadd.Os 28270069b7SAdrian Chadd.Sh NAME 29270069b7SAdrian Chadd.Nm etherswitchcfg 30270069b7SAdrian Chadd.Nd configure a built-in Ethernet switch 31270069b7SAdrian Chadd.Sh SYNOPSIS 32270069b7SAdrian Chadd.Nm 33270069b7SAdrian Chadd.Op Fl "f control file" 341cec2c73SAdrian Chadd.Cm info 35270069b7SAdrian Chadd.Nm 36270069b7SAdrian Chadd.Op Fl "f control file" 371cec2c73SAdrian Chadd.Cm config 38e6e5db84SAdrian Chadd.Ar command parameter 39e6e5db84SAdrian Chadd.Nm 40e6e5db84SAdrian Chadd.Op Fl "f control file" 411cec2c73SAdrian Chadd.Cm phy 42270069b7SAdrian Chadd.Ar phy.register[=value] 43270069b7SAdrian Chadd.Nm 44270069b7SAdrian Chadd.Op Fl "f control file" 451cec2c73SAdrian Chadd.Cm port%d 46e6e5db84SAdrian Chadd.Ar [flags] command parameter 47270069b7SAdrian Chadd.Nm 48270069b7SAdrian Chadd.Op Fl "f control file" 491cec2c73SAdrian Chadd.Cm reg 50270069b7SAdrian Chadd.Ar register[=value] 51270069b7SAdrian Chadd.Nm 52270069b7SAdrian Chadd.Op Fl "f control file" 531cec2c73SAdrian Chadd.Cm vlangroup%d 54270069b7SAdrian Chadd.Ar command parameter 55270069b7SAdrian Chadd.Sh DESCRIPTION 56270069b7SAdrian ChaddThe 57270069b7SAdrian Chadd.Nm 58270069b7SAdrian Chaddutility is used to configure an Ethernet switch built into the system. 59270069b7SAdrian Chadd.Nm 60270069b7SAdrian Chaddaccepts a number of options: 618f932d9fSChristian Brueffer.Pp 62270069b7SAdrian Chadd.Bl -tag -width ".Fl f" -compact 63270069b7SAdrian Chadd.It Fl "f control file" 64270069b7SAdrian ChaddSpecifies the 65270069b7SAdrian Chadd.Xr etherswitch 4 66270069b7SAdrian Chaddcontrol file that represents the switch to be configured. 67270069b7SAdrian ChaddIt defaults to 688f932d9fSChristian Brueffer.Pa /dev/etherswitch0 . 69270069b7SAdrian Chadd.It Fl m 70270069b7SAdrian ChaddWhen reporting port information, also list available media options for 71270069b7SAdrian Chaddthat port. 72270069b7SAdrian Chadd.It Fl v 73270069b7SAdrian ChaddProduce more verbose output. 74270069b7SAdrian ChaddWithout this flag, lines that represent inactive or empty configuration 75270069b7SAdrian Chaddoptions are omitted. 76270069b7SAdrian Chadd.El 77e6e5db84SAdrian Chadd.Ss config 78e6e5db84SAdrian ChaddThe config command provides access to global switch configuration 79e6e5db84SAdrian Chaddparameters. 80e6e5db84SAdrian ChaddIt support the following commands: 818f932d9fSChristian Brueffer.Pp 821cec2c73SAdrian Chadd.Bl -tag -width ".Cm vlan_mode mode" -compact 831cec2c73SAdrian Chadd.It Cm vlan_mode Ar mode 84e6e5db84SAdrian ChaddSets the switch VLAN mode (depends on the hardware). 85e6e5db84SAdrian Chadd.El 86270069b7SAdrian Chadd.Ss phy 87270069b7SAdrian ChaddThe phy command provides access to the registers of the PHYs attached 88270069b7SAdrian Chaddto or integrated into the switch controller. 89270069b7SAdrian ChaddPHY registers are specified as phy.register, 90270069b7SAdrian Chaddwhere 91270069b7SAdrian Chadd.Ar phy 92270069b7SAdrian Chaddis usually the port number, and 93270069b7SAdrian Chadd.Ar register 94270069b7SAdrian Chaddis the register number. 95270069b7SAdrian ChaddBoth can be provided as decimal, octal or hexadecimal numbers in any of the formats 96270069b7SAdrian Chaddunderstood by 97d4e069e5SSergey Kandaurov.Xr strtol 3 . 98270069b7SAdrian ChaddTo set the register value, use the form instance.register=value. 99270069b7SAdrian Chadd.Ss port 100270069b7SAdrian ChaddThe port command selects one of the ports of the switch. 101270069b7SAdrian ChaddIt supports the following commands: 1028f932d9fSChristian Brueffer.Pp 103a3219359SAdrian Chadd.Bl -tag -width ".Ar pvid number" -compact 1041cec2c73SAdrian Chadd.It Cm pvid Ar number 105a3219359SAdrian ChaddSets the default port VID that is used to process incoming frames that are not tagged. 1061cec2c73SAdrian Chadd.It Cm media Ar mediaspec 107270069b7SAdrian ChaddSpecifies the physical media configuration to be configured for a port. 1081cec2c73SAdrian Chadd.It Cm mediaopt Ar mediaoption 1098495c3d9SJoel DahlSpecifies a list of media options for a port. 1108495c3d9SJoel DahlSee 111270069b7SAdrian Chadd.Xr ifconfig 8 112270069b7SAdrian Chaddfor details on 1131cec2c73SAdrian Chadd.Cm media 114344c81a1SWarren Blockand 1151cec2c73SAdrian Chadd.Cm mediaopt . 1161cec2c73SAdrian Chadd.It Cm led Ar number style 11705b831f6SSevan JaniyanSets the display style for a given LED. 11805b831f6SSevan JaniyanAvailable styles are: 1191cec2c73SAdrian Chadd.Cm default 1201cec2c73SAdrian Chadd(usually flash on activity), 1211cec2c73SAdrian Chadd.Cm on , 1221cec2c73SAdrian Chadd.Cm off , 1231cec2c73SAdrian Chaddand 1241cec2c73SAdrian Chadd.Cm blink . 1251cec2c73SAdrian ChaddNot all switches will support all styles. 126270069b7SAdrian Chadd.El 1278f932d9fSChristian Brueffer.Pp 128e6e5db84SAdrian ChaddAnd the following flags (please note that not all flags 1298f932d9fSChristian Bruefferare supported by all switch drivers): 1308f932d9fSChristian Brueffer.Pp 1311cec2c73SAdrian Chadd.Bl -tag -width ".Fl addtag" -compact 1321cec2c73SAdrian Chadd.It Cm addtag 133e6e5db84SAdrian ChaddAdd VLAN tag to each packet sent by the port. 1341cec2c73SAdrian Chadd.It Fl addtag 135e6e5db84SAdrian ChaddDisable the add VLAN tag option. 1361cec2c73SAdrian Chadd.It Cm striptag 137e6e5db84SAdrian ChaddStrip the VLAN tags from the packets sent by the port. 1381cec2c73SAdrian Chadd.It Fl striptag 139e6e5db84SAdrian ChaddDisable the strip VLAN tag option. 140*f5b29d0fSKornel Duleba.It Cm striptagingress 141*f5b29d0fSKornel DulebaStrip the VLAN tags from the packets received by the port. 142*f5b29d0fSKornel Duleba.It Fl striptagingress 143*f5b29d0fSKornel DulebaDisable the strip VLAN tag on ingress option. 1441cec2c73SAdrian Chadd.It Cm firstlock 1458f932d9fSChristian BruefferThis options makes the switch port lock on the first MAC address it sees. 146e6e5db84SAdrian ChaddAfter that, usually you need to reset the switch to learn different 147e6e5db84SAdrian ChaddMAC addresses. 1481cec2c73SAdrian Chadd.It Fl firstlock 1498495c3d9SJoel DahlDisable the first lock option. 1508495c3d9SJoel DahlNote that sometimes you need to reset the 151e6e5db84SAdrian Chaddswitch to really disable this option. 1524e4cedb0SLuiz Otavio O Souza.It Cm droptagged 1534e4cedb0SLuiz Otavio O SouzaDrop packets with a VLAN tag. 1544e4cedb0SLuiz Otavio O Souza.It Fl droptagged 1554e4cedb0SLuiz Otavio O SouzaDisable the drop tagged packets option. 1561cec2c73SAdrian Chadd.It Cm dropuntagged 157e6e5db84SAdrian ChaddDrop packets without a VLAN tag. 1581cec2c73SAdrian Chadd.It Fl dropuntagged 159e6e5db84SAdrian ChaddDisable the drop untagged packets option. 1601cec2c73SAdrian Chadd.It Cm doubletag 161e6e5db84SAdrian ChaddEnable QinQ for the port. 1621cec2c73SAdrian Chadd.It Fl doubletag 163e6e5db84SAdrian ChaddDisable QinQ for the port. 1641cec2c73SAdrian Chadd.It Cm ingress 165e6e5db84SAdrian ChaddEnable the ingress filter on the port. 1661cec2c73SAdrian Chadd.It Fl ingress 167e6e5db84SAdrian ChaddDisable the ingress filter. 168e6e5db84SAdrian Chadd.El 169270069b7SAdrian Chadd.Ss reg 170270069b7SAdrian ChaddThe reg command provides access to the registers of the switch controller. 171270069b7SAdrian Chadd.Ss vlangroup 172270069b7SAdrian ChaddThe vlangroup command selects one of the VLAN groups for configuration. 173270069b7SAdrian ChaddIt supports the following commands: 1748f932d9fSChristian Brueffer.Pp 1751cec2c73SAdrian Chadd.Bl -tag -width ".Cm members" -compact 1761cec2c73SAdrian Chadd.It Cm vlan Ar VID 177270069b7SAdrian ChaddSets the VLAN ID (802.1q VID) for this VLAN group. 178270069b7SAdrian ChaddFrames transmitted on tagged member ports of this group will be tagged 179270069b7SAdrian Chaddwith this VID. 180270069b7SAdrian ChaddIncoming frames carrying this tag will be forwarded according to the 181270069b7SAdrian Chaddconfiguration of this VLAN group. 1821cec2c73SAdrian Chadd.It Cm members Ar port,... 183270069b7SAdrian ChaddConfigures which ports are to be a member of this VLAN group. 184270069b7SAdrian ChaddThe port numbers are given as a comma-separated list. 185270069b7SAdrian ChaddEach port can optionally be followed by 186270069b7SAdrian Chadd.Dq t 187270069b7SAdrian Chaddto indicate that frames on this port are tagged. 188270069b7SAdrian Chadd.El 189270069b7SAdrian Chadd.Sh FILES 190270069b7SAdrian Chadd.Bl -tag -width /dev/etherswitch? -compact 191270069b7SAdrian Chadd.It Pa /dev/etherswitch? 1928f932d9fSChristian BruefferControl file for the Ethernet switch driver. 193270069b7SAdrian Chadd.El 194270069b7SAdrian Chadd.Sh EXAMPLES 195bf0834dfSHiren PanchasaraConfigure VLAN group 1 with a VID of 2 and make ports 0 and 5 its members 196270069b7SAdrian Chaddwhile excluding all other ports. 197bf0834dfSHiren PanchasaraPort 5 will send and receive tagged frames while port 0 will be untagged. 198270069b7SAdrian ChaddIncoming untagged frames on port 0 are assigned to vlangroup1. 1998f932d9fSChristian Brueffer.Pp 200a3219359SAdrian Chadd.Dl # etherswitchcfg vlangroup1 vlan 2 members 0,5t port0 pvid 2 201270069b7SAdrian Chadd.Sh SEE ALSO 202270069b7SAdrian Chadd.Xr etherswitch 4 203270069b7SAdrian Chadd.Sh HISTORY 204270069b7SAdrian Chadd.Nm 205270069b7SAdrian Chaddfirst appeared in 206270069b7SAdrian Chadd.Fx 10.0 . 207270069b7SAdrian Chadd.Sh AUTHORS 208270069b7SAdrian Chadd.An Stefan Bethke 209