Skip to content

Commit

Permalink
add IP mtu support for port and lag (sonic-net#402)
Browse files Browse the repository at this point in the history
* [mtu] Update the mtu on host interfaces if config DB changes

* [mtu] Get ip mtu val from port while create router interfaces

* Portsorch updates port.m_mtu whenever PORT/LAG mtu changes
* Intfsorch applies port.m_mtu as SAI_ROUTER_INTERFACE_ATTR_MTU
  while creating the router interfaces over the PORT/LAG

Signed-off-by: Haiyang Zheng <haiyang.z@alibaba-inc.com>
  • Loading branch information
hzheng5 authored and lguohan committed Dec 17, 2017
1 parent a46eaf7 commit fab3cea
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
6 changes: 5 additions & 1 deletion orchagent/intfsorch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,10 @@ bool IntfsOrch::addRouterIntfs(Port &port)
}
attrs.push_back(attr);

attr.id = SAI_ROUTER_INTERFACE_ATTR_MTU;
attr.value.u32 = port.m_mtu;
attrs.push_back(attr);

sai_status_t status = sai_router_intfs_api->create_router_interface(&port.m_rif_id, gSwitchId, (uint32_t)attrs.size(), attrs.data());
if (status != SAI_STATUS_SUCCESS)
{
Expand All @@ -268,7 +272,7 @@ bool IntfsOrch::addRouterIntfs(Port &port)

gPortsOrch->setPort(port.m_alias, port);

SWSS_LOG_NOTICE("Create router interface for port %s", port.m_alias.c_str());
SWSS_LOG_NOTICE("Create router interface for port %s mtu %u", port.m_alias.c_str(), port.m_mtu);

return true;
}
Expand Down
2 changes: 2 additions & 0 deletions orchagent/port.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ extern "C" {
#include <map>

#define DEFAULT_PORT_VLAN_ID 1
#define DEFAULT_MTU 9100

namespace swss {

Expand Down Expand Up @@ -64,6 +65,7 @@ class Port
Type m_type;
int m_index = 0; // PHY_PORT: index
int m_ifindex = 0;
uint32_t m_mtu = DEFAULT_MTU;
sai_object_id_t m_port_id = 0;
sai_port_fec_mode_t m_fec_mode = SAI_PORT_FEC_MODE_NONE;
VlanInfo m_vlan_info;
Expand Down
1 change: 1 addition & 0 deletions orchagent/portsorch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1127,6 +1127,7 @@ void PortsOrch::doPortTask(Consumer &consumer)
{
if (setPortMtu(p.m_port_id, mtu))
{
p.m_mtu = mtu;
SWSS_LOG_NOTICE("Set port %s MTU to %u", alias.c_str(), mtu);
}
else
Expand Down

0 comments on commit fab3cea

Please sign in to comment.