Skip to content

Commit

Permalink
Align default MTU value as SAI default (#705)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
prsunny authored and qiluo-msft committed Nov 27, 2018
1 parent bffa01f commit 836a58c
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
7 changes: 6 additions & 1 deletion orchagent/port.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,12 @@ extern "C" {
#include <map>

#define DEFAULT_PORT_VLAN_ID 1
#define DEFAULT_MTU 9100
/*
* Default MTU is derived from SAI_PORT_ATTR_MTU (1514)
* Orchagent adds extra 22 bytes for Ethernet header and FCS,
* hence setting to 1492 (1514 - 22)
*/
#define DEFAULT_MTU 1492

namespace swss {

Expand Down
8 changes: 4 additions & 4 deletions tests/test_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def test_InterfaceAddRemoveIpv6Address(self, dvs, testlog):
for fv in fvs:
if fv[0] == "SAI_ROUTER_INTERFACE_ATTR_TYPE":
assert fv[1] == "SAI_ROUTER_INTERFACE_TYPE_PORT"
# the default MTU without any configuration is 9100
# the default MTU without any configuration is 9100, set by portmgr
if fv[0] == "SAI_ROUTER_INTERFACE_ATTR_MTU":
assert fv[1] == "9100"

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

Expand Down Expand Up @@ -296,9 +296,9 @@ def test_InterfaceAddRemoveIpv4Address(self, dvs, testlog):
for fv in fvs:
if fv[0] == "SAI_ROUTER_INTERFACE_ATTR_TYPE":
assert fv[1] == "SAI_ROUTER_INTERFACE_TYPE_PORT"
# the default MTU without any configuration is 9100
# the default MTU without any configuration is 1492
if fv[0] == "SAI_ROUTER_INTERFACE_ATTR_MTU":
assert fv[1] == "9100"
assert fv[1] == "1492"

# check ASIC route database
tbl = swsscommon.Table(self.adb, "ASIC_STATE:SAI_OBJECT_TYPE_ROUTE_ENTRY")
Expand Down
3 changes: 2 additions & 1 deletion tests/test_vnet.py
Original file line number Diff line number Diff line change
Expand Up @@ -477,14 +477,15 @@ def check_router_interface(self, dvs, name, vlan_oid=0):
expected_attr = {
"SAI_ROUTER_INTERFACE_ATTR_VIRTUAL_ROUTER_ID": self.vr_map[name].get('ing'),
"SAI_ROUTER_INTERFACE_ATTR_SRC_MAC_ADDRESS": switch_mac,
"SAI_ROUTER_INTERFACE_ATTR_MTU": "9100",
"SAI_ROUTER_INTERFACE_ATTR_MTU": "1492",
}

if vlan_oid:
expected_attr.update({'SAI_ROUTER_INTERFACE_ATTR_TYPE': 'SAI_ROUTER_INTERFACE_TYPE_VLAN'})
expected_attr.update({'SAI_ROUTER_INTERFACE_ATTR_VLAN_ID': vlan_oid})
else:
expected_attr.update({'SAI_ROUTER_INTERFACE_ATTR_TYPE': 'SAI_ROUTER_INTERFACE_TYPE_PORT'})
expected_attr.update({'SAI_ROUTER_INTERFACE_ATTR_MTU': '9100'})

new_rif = get_created_entry(asic_db, self.ASIC_RIF_TABLE, self.rifs)
check_object(asic_db, self.ASIC_RIF_TABLE, new_rif, expected_attr)
Expand Down

0 comments on commit 836a58c

Please sign in to comment.