Skip to content

Commit 836a58c

Browse files
prsunnyqiluo-msft
authored andcommitted
Align default MTU value as SAI default (sonic-net#705)
* Align default MTU value as SAI default * Added comments, updated VS test * Corrected the values for physical interfaces, set by portmgr * Fixed vnet VS test for RIF mtu
1 parent bffa01f commit 836a58c

File tree

3 files changed

+12
-6
lines changed

3 files changed

+12
-6
lines changed

orchagent/port.h

+6-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,12 @@ extern "C" {
1111
#include <map>
1212

1313
#define DEFAULT_PORT_VLAN_ID 1
14-
#define DEFAULT_MTU 9100
14+
/*
15+
* Default MTU is derived from SAI_PORT_ATTR_MTU (1514)
16+
* Orchagent adds extra 22 bytes for Ethernet header and FCS,
17+
* hence setting to 1492 (1514 - 22)
18+
*/
19+
#define DEFAULT_MTU 1492
1520

1621
namespace swss {
1722

tests/test_interface.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ def test_InterfaceAddRemoveIpv6Address(self, dvs, testlog):
7474
for fv in fvs:
7575
if fv[0] == "SAI_ROUTER_INTERFACE_ATTR_TYPE":
7676
assert fv[1] == "SAI_ROUTER_INTERFACE_TYPE_PORT"
77-
# the default MTU without any configuration is 9100
77+
# the default MTU without any configuration is 9100, set by portmgr
7878
if fv[0] == "SAI_ROUTER_INTERFACE_ATTR_MTU":
7979
assert fv[1] == "9100"
8080

@@ -146,7 +146,7 @@ def test_InterfaceAddRemoveIpv4Address(self, dvs, testlog):
146146
for fv in fvs:
147147
if fv[0] == "SAI_ROUTER_INTERFACE_ATTR_TYPE":
148148
assert fv[1] == "SAI_ROUTER_INTERFACE_TYPE_PORT"
149-
# the default MTU without any configuration is 9100
149+
# the default MTU without any configuration is 9100, set by portmgr
150150
if fv[0] == "SAI_ROUTER_INTERFACE_ATTR_MTU":
151151
assert fv[1] == "9100"
152152

@@ -296,9 +296,9 @@ def test_InterfaceAddRemoveIpv4Address(self, dvs, testlog):
296296
for fv in fvs:
297297
if fv[0] == "SAI_ROUTER_INTERFACE_ATTR_TYPE":
298298
assert fv[1] == "SAI_ROUTER_INTERFACE_TYPE_PORT"
299-
# the default MTU without any configuration is 9100
299+
# the default MTU without any configuration is 1492
300300
if fv[0] == "SAI_ROUTER_INTERFACE_ATTR_MTU":
301-
assert fv[1] == "9100"
301+
assert fv[1] == "1492"
302302

303303
# check ASIC route database
304304
tbl = swsscommon.Table(self.adb, "ASIC_STATE:SAI_OBJECT_TYPE_ROUTE_ENTRY")

tests/test_vnet.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -477,14 +477,15 @@ def check_router_interface(self, dvs, name, vlan_oid=0):
477477
expected_attr = {
478478
"SAI_ROUTER_INTERFACE_ATTR_VIRTUAL_ROUTER_ID": self.vr_map[name].get('ing'),
479479
"SAI_ROUTER_INTERFACE_ATTR_SRC_MAC_ADDRESS": switch_mac,
480-
"SAI_ROUTER_INTERFACE_ATTR_MTU": "9100",
480+
"SAI_ROUTER_INTERFACE_ATTR_MTU": "1492",
481481
}
482482

483483
if vlan_oid:
484484
expected_attr.update({'SAI_ROUTER_INTERFACE_ATTR_TYPE': 'SAI_ROUTER_INTERFACE_TYPE_VLAN'})
485485
expected_attr.update({'SAI_ROUTER_INTERFACE_ATTR_VLAN_ID': vlan_oid})
486486
else:
487487
expected_attr.update({'SAI_ROUTER_INTERFACE_ATTR_TYPE': 'SAI_ROUTER_INTERFACE_TYPE_PORT'})
488+
expected_attr.update({'SAI_ROUTER_INTERFACE_ATTR_MTU': '9100'})
488489

489490
new_rif = get_created_entry(asic_db, self.ASIC_RIF_TABLE, self.rifs)
490491
check_object(asic_db, self.ASIC_RIF_TABLE, new_rif, expected_attr)

0 commit comments

Comments
 (0)