Skip to content

Commit f8e510c

Browse files
authored
Merge pull request #1 from scottlaird/push-uumokqtkosru
mlxsw: T8878: Add basic support for Mellanox SN2* switches
2 parents 08542c0 + d43ba87 commit f8e510c

10 files changed

Lines changed: 23 additions & 12 deletions

File tree

interface-definitions/interfaces_ethernet.xml.in

100644100755
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
<description>Ethernet interface name</description>
1515
</valueHelp>
1616
<constraint>
17-
<regex>((eth|lan)[0-9]+|(eno|ens|enp|enx).+)</regex>
17+
<regex>((eth|lan)[0-9]+|(eno|ens|enp|enx).+|sw[0-9]*p[0-9]+(s[0-9]+)?)</regex>
1818
</constraint>
1919
<constraintErrorMessage>Invalid Ethernet interface name</constraintErrorMessage>
2020
</properties>

interface-definitions/interfaces_vxlan.xml.in

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,12 @@
8787
<valueless/>
8888
</properties>
8989
</leafNode>
90+
<leafNode name="noudpcsum">
91+
<properties>
92+
<help>Do not require UDP checksums. Required for mellanox switch support</help>
93+
<valueless/>
94+
</properties>
95+
</leafNode>
9096
<leafNode name="neighbor-suppress">
9197
<properties>
9298
<help>Enable neighbor discovery (ARP and ND) suppression</help>

python/vyos/ifconfig/ethernet.py

100644100755
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,11 @@ class EthernetIf(Interface):
3838
**Interface.definition,
3939
**{
4040
'section': 'ethernet',
41-
'prefixes': ['lan', 'eth', 'eno', 'ens', 'enp', 'enx'],
41+
'prefixes': ['lan', 'eth', 'eno', 'ens', 'enp', 'enx', 'sw', 'swp'],
4242
'bondable': True,
4343
'broadcast': True,
4444
'bridgeable': True,
45-
'eternal': '(lan|eth|eno|ens|enp|enx)[0-9]+$',
45+
'eternal': '(lan|eth|eno|ens|enp|enx)[0-9]+|sw[0-9]*p[0-9]+(s[0-9]+)?$',
4646
},
4747
}
4848

python/vyos/ifconfig/vxlan.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ def _create(self):
7575
'parameters.ip.ttl' : 'ttl',
7676
'parameters.ipv6.flowlabel' : 'flowlabel',
7777
'parameters.nolearning' : 'nolearning',
78+
'parameters.noudpcsum' : 'noudpcsum',
7879
'parameters.vni_filter' : 'vnifilter',
7980
'remote' : 'remote',
8081
'source_address' : 'local',

src/etc/udev/rules.d/65-vyos-net.rules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44
ACTION!="add", GOTO="vyos_net_end"
55
SUBSYSTEM!="net", GOTO="vyos_net_end"
66

7+
# Use switchport names for Mellanox switches, so interface names match the front-panel labels
8+
DRIVERS=="mlxsw_spectrum*", NAME="sw$attr{phys_port_name}", GOTO="vyos_net_end"
9+
710
# Do name change for ethernet and wireless devices only
811
KERNEL!="eth*|wlan*|e*", GOTO="vyos_net_end"
912

src/helpers/vyos-interface-rescan.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ def get_wireless_physical_device(intf: str) -> str:
8787
return phy
8888

8989
def get_interface_type(intf: str) -> str:
90-
if 'eth' in intf:
90+
if 'eth' in intf or 'sw' in intf:
9191
intf_type = 'ethernet'
9292
elif 'wlan' in intf:
9393
intf_type = 'wireless'

src/ocaml/completion/list_interfaces/list_interfaces.ml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ let type_to_prefix it =
2323
| "bonding" -> "bond"
2424
| "bridge" -> "br"
2525
| "dummy" -> "dum"
26-
| "ethernet" -> "eth"
26+
| "ethernet" -> "eth|sw|swp"
2727
| "geneve" -> "gnv"
2828
| "input" -> "ifb"
2929
| "l2tpeth" -> "l2tpeth"
@@ -44,13 +44,13 @@ let type_to_prefix it =
4444

4545
(* filter_section to match the constraint of python.vyos.ifconfig.section
4646
*)
47-
let rx = Pcre2.regexp {|\d(\d|v|\.)*$|}
47+
let rx = Pcre2.regexp {|\d(\d|[psv]|\.)*$|}
4848

4949
let filter_section s =
5050
let r = Pcre2.qreplace_first ~rex:rx ~templ:"" s in
5151
match r with
5252
|"bond"|"br"|"dum"|"eth"|"gnv"|"ifb"|"l2tpeth"|"lo"|"macsec" -> true
53-
|"peth"|"pppoe"|"sstpc"|"tun"|"veth"|"vti"|"vtun"|"vxlan"|"wg"|"wlan"|"wwan" -> true
53+
|"peth"|"pppoe"|"sstpc"|"sw"|"swp"|"tun"|"veth"|"vti"|"vtun"|"vxlan"|"wg"|"wlan"|"wwan" -> true
5454
| _ -> false
5555

5656
let filter_from_prefix p s =
@@ -76,15 +76,15 @@ let filter_broadcast s =
7676
with Not_found -> false
7777

7878
let filter_bridgeable s =
79-
let pattern = {|^(bond|eth|gnv|l2tpeth|lo|tun|veth|vtun|vxlan|wlan)(.*)$|}
79+
let pattern = {|^(bond|eth|gnv|l2tpeth|lo|sw|tun|veth|vtun|vxlan|wlan)(.*)$|}
8080
in
8181
try
8282
let _ = Pcre2.exec ~pat:pattern s in
8383
true
8484
with Not_found -> false
8585

8686
let filter_bondable s =
87-
let pattern = {|^(eth|lan|eno|ens)[A-Za-z0-9_-]*$|}
87+
let pattern = {|^(eth|lan|eno|ens|sw)[A-Za-z0-9_-]*$|}
8888
in
8989
try
9090
let _ = Pcre2.exec ~pat:pattern s in

src/services/vyos-netlinkd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ from vyos.utils.process import stop_systemd_unit
3838
running = True
3939

4040
# compile regex once during startup for fast match
41-
IFACE_RE = re.compile(r"^(?:eth|br|bond|wlan)")
41+
IFACE_RE = re.compile(r"^(?:eth|lan|eno|ens|enp|enx|br|bond|sw|wlan)")
4242

4343
def match_iface(ifname: str) -> bool:
4444
""" Helper function returning true if interface name is a match for further

src/validators/ethernet-interface

100644100755
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/sh
22

3-
if ! [[ "$1" =~ ^(lan|eth|eno|ens|enp|enx)[0-9]+$ ]]; then
3+
if ! [[ "$1" =~ ^(lan|eth|eno|ens|enp|enx)[0-9]+|sw[0-9]*p[0-9]+(s[0-9]+)? $ ]]; then
44
echo "Error: $1 is not an ethernet interface"
55
exit 1
66
fi

src/validators/vrf-name

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,9 @@ if __name__ == '__main__':
4141

4242
# VRF name must not conflict with local interface type prefix
4343
pattern = r'^(?!(bond|br|dum|eth|lan|eno|ens|enp|enx|gnv|ipoe|l2tp|l2tpeth|\
44-
vtun|ppp|pppoe|peth|tun|vti|vxlan|wg|wlan|wwan|\d)\d*(\.\d+)?(v.+)?).*$'
44+
vtun|ppp|pppoe|peth|sw|tun|vti|vxlan|wg|wlan|wwan|\d)\d*(\.\d+)?(v.+)?).*$'
4545
if not re.match(pattern, vrf):
4646
exit(1)
4747

4848
exit(0)
49+

0 commit comments

Comments
 (0)