-
Notifications
You must be signed in to change notification settings - Fork 529
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Routed subinterface enhancements #1907
Conversation
Handling Routed subinterface ADMIN status dependency with parent interface Handling Routed subinterface MTU dependency with parent interface
/azpw run |
/AzurePipelines run |
Commenter does not have sufficient privileges for PR 1907 in repo Azure/sonic-swss |
/AzurePipelines run |
Azure Pipelines successfully started running 1 pipeline(s). |
orchagent/portsorch.cpp
Outdated
string parentAlias = alias.substr(0, found); | ||
string vlanId = alias.substr(found + 1); | ||
subIntf subIf(alias); | ||
string subport = subIf.longName(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where do we use this subport?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed as part of next commit
auto appConsumer = new Consumer(subscriberAppTable, this, APP_LAG_TABLE_NAME); | ||
Orch::addExecutor(appConsumer); | ||
|
||
auto subscriberStateTable = new swss::SubscriberStateTable(stateDb, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why do we need the lines 43 to 52?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
APPL_DB & STATE_DB tables in orch is not subscribed for runtime table change events rather only consumer object(only for get operations). Hence creating intfmgrd(from Orch) object with APPL_DB & STATE_DB tables, intfmgrd does not get events at runtime for APPL_DB table changes.
Hence we need to explicitly register with subscriberStateTable in constructor for APPL_DB and STATE_DB tables to get runtime table add/del/update events.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@preetham-singh, APPL_DB object is intended only for one consumer. There are other implications if there are multiple subscribers. We can discuss if you want more info. It cannot be subscribed here as orchagent is the consumer for this table. As I mentioned, this is a config change that you are interested in. So suggest to subscribe for config_db table rather than any other tables.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@prsunny, this is not config change instead the event when portmgr actually sets the mtu and admin state on the interface in kernel. Otherwise, intfmgr tries to set the mtu or admin state on subinterface netdev in kernel and it fails if parent netdev is having lower mtu or is admin-down, respectively. The fix is that portmgr populates mtu/admin fields in the port table in state db, and intfmgr updates the kernel subintf netdevice afterwards. Similar fix is required for LAG.
I agree it will be better to discuss and conclude.
cfgmgr/intfmgr.cpp
Outdated
@@ -287,22 +301,149 @@ void IntfMgr::addHostSubIntf(const string&intf, const string &subIntf, const str | |||
EXEC_WITH_ERROR_THROW(cmd.str(), res); | |||
} | |||
|
|||
void IntfMgr::setHostSubIntfMtu(const string &subIntf, const string &mtu) | |||
|
|||
std::string IntfMgr::getPortAdminStatus(const string &alias) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/getPortAdminStatus/getIntfAdminStatus?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure
cfgmgr/intfmgr.cpp
Outdated
return admin; | ||
} | ||
|
||
std::string IntfMgr::getPortMtu(const string &alias) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Replace port with intf here as well in the func. name.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sure
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add VS tests to cover the short name as well
cfgmgr/intfmgr.cpp
Outdated
@@ -22,6 +24,7 @@ using namespace swss; | |||
#define VRF_MGMT "mgmt" | |||
|
|||
#define LOOPBACK_DEFAULT_MTU_STR "65536" | |||
#define PORT_MTU_DEFAULT 9100 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use this as being used in other mgr files - #define DEFAULT_MTU_STR "9100"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure. Changed as part of next commit.
mtu = value; | ||
} | ||
} | ||
if (mtu.empty()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use {
and at other places added in PR
cfgmgr/intfmgr.cpp
Outdated
if (subIf.parentIntf() == alias) | ||
{ | ||
/*Avoid duplicate parent admin UP event when parent goes down | ||
* This avoids intfmgrd carsh due to duplicate port up event when parent is actually going admin down*/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please rephrase the comments and fix typos. Also, align the comments.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed as part of next commit.
cfgmgr/intfmgr.h
Outdated
void setHostSubIntfMtu(const std::string &subIntf, const std::string &mtu); | ||
void setHostSubIntfAdminStatus(const std::string &subIntf, const std::string &admin_status); | ||
std::string setHostSubIntfMtu(const std::string &alias, const std::string &configMtu, const std::string &parentMtu); | ||
std::string setHostSubIntfAdminStatus(const std::string &alias, const std::string &configAdmin, const std::string &parentAdmin); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggest retain the names of existing parameters.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
subIntf is a class name provided by subinterface library updating subIntf arg to alias. Having class name as argument creates confusion. Reverting other argument names as part of next commit.
cfgmgr/intfmgr.cpp
Outdated
@@ -782,7 +960,12 @@ void IntfMgr::doTask(Consumer &consumer) | |||
while (it != consumer.m_toSync.end()) | |||
{ | |||
KeyOpFieldsValuesTuple t = it->second; | |||
|
|||
if ((table_name == STATE_PORT_TABLE_NAME) || (table_name == APP_LAG_TABLE_NAME)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do not subscribe for events from APP_DB here for a table which is already subscribed by Orchagent. I think what you want here is the config_db entry for both Port and LAG
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As per offline discussion, moving to STATE_PORT_TABLE and STATE_LAG_TABLE for parent interface and and mtu change events. Updated same as part of next commit.
@@ -749,6 +749,10 @@ void IntfsOrch::doTask(Consumer &consumer) | |||
{ | |||
inband_type = value; | |||
} | |||
else if (field == "vlan") | |||
{ | |||
vlan = value; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see vlan
defined
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed as part of next commit. It was missed in local merge.
cfgmgr/portmgr.cpp
Outdated
@@ -35,6 +35,7 @@ bool PortMgr::setPortMtu(const string &alias, const string &mtu) | |||
fvs.push_back(fv); | |||
m_appPortTable.set(alias, fvs); | |||
|
|||
m_statePortTable.set(alias, fvs); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed as part of next commit.
cfgmgr/portmgr.cpp
Outdated
@@ -67,6 +68,7 @@ bool PortMgr::setPortAdminStatus(const string &alias, const bool up) | |||
fvs.push_back(fv); | |||
m_appPortTable.set(alias, fvs); | |||
|
|||
m_statePortTable.set(alias, fvs); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed as part of next commit.
cfgmgr/intfmgr.cpp
Outdated
@@ -827,6 +1010,7 @@ void IntfMgr::doTask(Consumer &consumer) | |||
{ | |||
SWSS_LOG_ERROR("Invalid key %s", kfvKey(t).c_str()); | |||
} | |||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix alignment
Table *portTable; | ||
if (!alias.compare(0, strlen("Eth"), "Eth")) | ||
{ | ||
portTable = &m_statePortTable; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure if its a good idea to read this each time from the DBs for parent mtu/admin_status. Do you think its better to cache? @venkatmahalingam , @preetham-singh , any thoughts?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree, we can get admin status from cache.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are we planning to get the admin_status from cache?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Plan to do the caching as another PR
1. use statedb PORT_TABLE and statedb LAG_TABLE to get admin and mtu on front panel and port channel interfaces. Portsyncd and teamsyncd now updates admin and MTU status of corresponding netdev to statedb PORT_TABLE and LAG_TABLE. 2. Subinterface library moved to swss/lib as part of PR sonic-net#2017. Makefile and header inclusion changes updates accordingly.
/azp run |
Commenter does not have sufficient privileges for PR 1907 in repo Azure/sonic-swss |
/azp run |
Commenter does not have sufficient privileges for PR 1907 in repo Azure/sonic-swss |
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
This pull request introduces 9 alerts when merging e38a62c into b91d8ba - view on LGTM.com new alerts:
|
@venkatmahalingam , could you please review/sign-off? |
cfgmgr/intfmgr.cpp
Outdated
return "down"; | ||
} | ||
|
||
string admin = "down"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please have this as the beginning of the function and return admin variable instead of repeating "down" key word
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed as part of next commit
cfgmgr/intfmgr.cpp
Outdated
} | ||
vector<FieldValueTuple> temp; | ||
portTable->get(alias, temp); | ||
string mtu = "0"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same as above.. please assign at the beginning.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed as part of next commit
/* Avoid duplicate interface admin UP event. */ | ||
string curr_admin = m_subIntfList[intf].currAdminStatus; | ||
if (curr_admin == "up" && curr_admin == admin) | ||
continue; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please have this in braces
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed as part of next commit
cfgmgr/intfmgr.cpp
Outdated
@@ -459,13 +600,26 @@ bool IntfMgr::doIntfGeneralTask(const vector<string>& keys, | |||
string vlanId; | |||
string parentAlias; | |||
size_t found = alias.find(VLAN_SUB_INTERFACE_SEPARATOR); | |||
subIntf subIf(alias); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
seems this comment is not addressed
This pull request introduces 9 alerts when merging a851adc into bb0733a - view on LGTM.com new alerts:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm. @venkatmahalingam to sign-off before merge
Table *portTable; | ||
if (!alias.compare(0, strlen("Eth"), "Eth")) | ||
{ | ||
portTable = &m_statePortTable; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Plan to do the caching as another PR
691c37b [Route bulk] Fix bugs in case a SET operation follows a DEL operation in the same bulk (sonic-net/sonic-swss#2086) a4c80c3 patch for issue sonic-net/sonic-swss#1971 - enable Rx Drop handling for cisco-8000 (sonic-net/sonic-swss#2041) 71751d1 [macsec] Support setting IPG by gearbox_config.json (sonic-net/sonic-swss#2051) 5d5c169 [bulk mode] Fix bulk conflict when in case there are both remove and set operations (sonic-net/sonic-swss#2071) 8bbdbd2 Fix SRV6 NHOP CRM object type (sonic-net/sonic-swss#2072) ef5b35f [vstest] VS test failure fix after fabric port orch PR merge (sonic-net/sonic-swss#1811) 89ea538 Supply the missing ingress/egress port profile list in document (sonic-net/sonic-swss#2064) 8123437 [pfc_detect] fix RedisReply errors (sonic-net/sonic-swss#2040) b38f527 [swss][CRM][MPLS] MPLS CRM Nexthop - switch back to using SAI OBJECT rather than SWITCH OBJECT ae061e5 create debug_shell_enable config to enable debug shell (sonic-net/sonic-swss#2060) 45e446d [cbf] Fix max FC value (sonic-net/sonic-swss#2049) b1b5b29 Initial p4orch pytest code. (sonic-net/sonic-swss#2054) d352d5a Update default route status to state DB (sonic-net/sonic-swss#2009) 24a64d6 Orchagent: Integrate P4Orch (sonic-net/sonic-swss#2029) 15a3b6c Delete the IPv6 link-local Neighbor when ipv6 link-local mode is disabled (sonic-net/sonic-swss#1897) ed783e1 [orchagent] Add trap flow counter support (sonic-net/sonic-swss#1951) e9b05a3 [vnetorch] ECMP for vnet tunnel routes with endpoint health monitor (sonic-net/sonic-swss#1955) bcb7d61 P4Orch: inital add of source (sonic-net/sonic-swss#1997) f6f6f86 [mclaglink] fix acl out ports (sonic-net/sonic-swss#2026) fd887bf [Reclaim buffer] Reclaim unused buffer for dynamic buffer model (sonic-net/sonic-swss#1910) 9258978 [orchagent, cfgmgr] Add response publisher and state recording (sonic-net/sonic-swss#1992) 3d862a7 Fixing subport vs test script for subport under VNET (sonic-net/sonic-swss#2048) fb0a5fd Don't handle buffer pool watermark during warm reboot reconciling (sonic-net/sonic-swss#1987) 16d4bcd Routed subinterface enhancements (sonic-net/sonic-swss#1907) 9639db7 [vstest/subintf] Add vs test to validate sub interface ingress to a vnet (sonic-net/sonic-swss#1642) Signed-off-by: Stephen Sun stephens@nvidia.com
691c37b [Route bulk] Fix bugs in case a SET operation follows a DEL operation in the same bulk (sonic-net/sonic-swss#2086) a4c80c3 patch for issue sonic-net/sonic-swss#1971 - enable Rx Drop handling for cisco-8000 (sonic-net/sonic-swss#2041) 71751d1 [macsec] Support setting IPG by gearbox_config.json (sonic-net/sonic-swss#2051) 5d5c169 [bulk mode] Fix bulk conflict when in case there are both remove and set operations (sonic-net/sonic-swss#2071) 8bbdbd2 Fix SRV6 NHOP CRM object type (sonic-net/sonic-swss#2072) ef5b35f [vstest] VS test failure fix after fabric port orch PR merge (sonic-net/sonic-swss#1811) 89ea538 Supply the missing ingress/egress port profile list in document (sonic-net/sonic-swss#2064) 8123437 [pfc_detect] fix RedisReply errors (sonic-net/sonic-swss#2040) b38f527 [swss][CRM][MPLS] MPLS CRM Nexthop - switch back to using SAI OBJECT rather than SWITCH OBJECT ae061e5 create debug_shell_enable config to enable debug shell (sonic-net/sonic-swss#2060) 45e446d [cbf] Fix max FC value (sonic-net/sonic-swss#2049) b1b5b29 Initial p4orch pytest code. (sonic-net/sonic-swss#2054) d352d5a Update default route status to state DB (sonic-net/sonic-swss#2009) 24a64d6 Orchagent: Integrate P4Orch (sonic-net/sonic-swss#2029) 15a3b6c Delete the IPv6 link-local Neighbor when ipv6 link-local mode is disabled (sonic-net/sonic-swss#1897) ed783e1 [orchagent] Add trap flow counter support (sonic-net/sonic-swss#1951) e9b05a3 [vnetorch] ECMP for vnet tunnel routes with endpoint health monitor (sonic-net/sonic-swss#1955) bcb7d61 P4Orch: inital add of source (sonic-net/sonic-swss#1997) f6f6f86 [mclaglink] fix acl out ports (sonic-net/sonic-swss#2026) fd887bf [Reclaim buffer] Reclaim unused buffer for dynamic buffer model (sonic-net/sonic-swss#1910) 9258978 [orchagent, cfgmgr] Add response publisher and state recording (sonic-net/sonic-swss#1992) 3d862a7 Fixing subport vs test script for subport under VNET (sonic-net/sonic-swss#2048) fb0a5fd Don't handle buffer pool watermark during warm reboot reconciling (sonic-net/sonic-swss#1987) 16d4bcd Routed subinterface enhancements (sonic-net/sonic-swss#1907) 9639db7 [vstest/subintf] Add vs test to validate sub interface ingress to a vnet (sonic-net/sonic-swss#1642) Signed-off-by: Stephen Sun stephens@nvidia.com
691c37b [Route bulk] Fix bugs in case a SET operation follows a DEL operation in the same bulk (sonic-net/sonic-swss#2086) a4c80c3 patch for issue sonic-net/sonic-swss#1971 - enable Rx Drop handling for cisco-8000 (sonic-net/sonic-swss#2041) 71751d1 [macsec] Support setting IPG by gearbox_config.json (sonic-net/sonic-swss#2051) 5d5c169 [bulk mode] Fix bulk conflict when in case there are both remove and set operations (sonic-net/sonic-swss#2071) 8bbdbd2 Fix SRV6 NHOP CRM object type (sonic-net/sonic-swss#2072) ef5b35f [vstest] VS test failure fix after fabric port orch PR merge (sonic-net/sonic-swss#1811) 89ea538 Supply the missing ingress/egress port profile list in document (sonic-net/sonic-swss#2064) 8123437 [pfc_detect] fix RedisReply errors (sonic-net/sonic-swss#2040) b38f527 [swss][CRM][MPLS] MPLS CRM Nexthop - switch back to using SAI OBJECT rather than SWITCH OBJECT ae061e5 create debug_shell_enable config to enable debug shell (sonic-net/sonic-swss#2060) 45e446d [cbf] Fix max FC value (sonic-net/sonic-swss#2049) b1b5b29 Initial p4orch pytest code. (sonic-net/sonic-swss#2054) d352d5a Update default route status to state DB (sonic-net/sonic-swss#2009) 24a64d6 Orchagent: Integrate P4Orch (sonic-net/sonic-swss#2029) 15a3b6c Delete the IPv6 link-local Neighbor when ipv6 link-local mode is disabled (sonic-net/sonic-swss#1897) ed783e1 [orchagent] Add trap flow counter support (sonic-net/sonic-swss#1951) e9b05a3 [vnetorch] ECMP for vnet tunnel routes with endpoint health monitor (sonic-net/sonic-swss#1955) bcb7d61 P4Orch: inital add of source (sonic-net/sonic-swss#1997) f6f6f86 [mclaglink] fix acl out ports (sonic-net/sonic-swss#2026) fd887bf [Reclaim buffer] Reclaim unused buffer for dynamic buffer model (sonic-net/sonic-swss#1910) 9258978 [orchagent, cfgmgr] Add response publisher and state recording (sonic-net/sonic-swss#1992) 3d862a7 Fixing subport vs test script for subport under VNET (sonic-net/sonic-swss#2048) fb0a5fd Don't handle buffer pool watermark during warm reboot reconciling (sonic-net/sonic-swss#1987) 16d4bcd Routed subinterface enhancements (sonic-net/sonic-swss#1907) 9639db7 [vstest/subintf] Add vs test to validate sub interface ingress to a vnet (sonic-net/sonic-swss#1642) Signed-off-by: Stephen Sun stephens@nvidia.com
What I did
Routed subinterfae enhancements HLD #833
Add support for long name and short name routed subinterfaces.
Handling Routed subinterface ADMIN status dependency with parent interface.
Handling Routed subinterface MTU dependency with parent interface.
Why I did it
Routed subinterface feature was broken for physical and portchannel subinterfaces for subinterface name exceeding 15 characters due to kernel limitation of netdev name length of 15.
How I verified it
Routed subinterface Unit tests
Details if related
This PR is dependent on swss-common PR 529.