Skip to content

Commit

Permalink
[inbandif]VOQ Inband intf support - code review comments fix - 1
Browse files Browse the repository at this point in the history
Signed-off-by: vedganes <[email protected]>

Fixed code review comments:
- Added comment to delInbandNeighbor() to indicate this is for local
inband interface
- Used hardcoded "Inband" prefix
- Reverted to net dev link up event detection using IFF_LOWER_UP flag
- Renamed "oper_status" of net dev to "netdev_oper_status" in the state
db PORT_TABLE.
  • Loading branch information
vedganes committed Mar 31, 2021
1 parent bf63c7f commit 7e14891
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
4 changes: 2 additions & 2 deletions cfgmgr/nbrmgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -444,11 +444,11 @@ bool NbrMgr::isIntfOperUp(const string &alias)
{
string oper;

if (m_statePortTable.hget(alias, "oper_status", oper))
if (m_statePortTable.hget(alias, "netdev_oper_status", oper))
{
if (oper == "up")
{
SWSS_LOG_DEBUG("Intf %s is oper up", alias.c_str());
SWSS_LOG_DEBUG("NetDev %s is oper up", alias.c_str());
return true;
}
}
Expand Down
3 changes: 2 additions & 1 deletion orchagent/neighorch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1245,7 +1245,8 @@ bool NeighOrch::addInbandNeighbor(string alias, IpAddress ip_address)

bool NeighOrch::delInbandNeighbor(string alias, IpAddress ip_address)
{
//Remove neighbor from SAI
// Remove local inband neighbor from SAI

if(gIntfsOrch->isRemoteSystemPortIntf(alias))
{
//Remote Inband interface. Skip
Expand Down
9 changes: 5 additions & 4 deletions portsyncd/linksync.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ using namespace swss;
const string MGMT_PREFIX = "eth";
const string INTFS_PREFIX = "Ethernet";
const string LAG_PREFIX = "PortChannel";
const string INBAND_PREFIX = "Inband";

extern set<string> g_portSet;
extern bool g_init;
Expand Down Expand Up @@ -165,18 +166,17 @@ void LinkSync::onMsg(int nlmsg_type, struct nl_object *obj)
struct rtnl_link *link = (struct rtnl_link *)obj;
string key = rtnl_link_get_name(link);

vector<FieldValueTuple> temp;
if (key.compare(0, INTFS_PREFIX.length(), INTFS_PREFIX) &&
key.compare(0, LAG_PREFIX.length(), LAG_PREFIX) &&
key.compare(0, MGMT_PREFIX.length(), MGMT_PREFIX) &&
!m_portTable.get(key, temp))
key.compare(0, INBAND_PREFIX.length(), INBAND_PREFIX))
{
return;
}

unsigned int flags = rtnl_link_get_flags(link);
bool admin = flags & IFF_UP;
bool oper = flags & IFF_RUNNING;
bool oper = flags & IFF_LOWER_UP;

char addrStr[MAX_ADDR_SIZE+1] = {0};
nl_addr2str(rtnl_link_get_addr(link), addrStr, MAX_ADDR_SIZE);
Expand Down Expand Up @@ -248,13 +248,14 @@ void LinkSync::onMsg(int nlmsg_type, struct nl_object *obj)
/* front panel interfaces: Check if the port is in the PORT_TABLE
* non-front panel interfaces such as eth0, lo which are not in the
* PORT_TABLE are ignored. */
vector<FieldValueTuple> temp;
if (m_portTable.get(key, temp))
{
g_portSet.erase(key);
FieldValueTuple tuple("state", "ok");
vector<FieldValueTuple> vector;
vector.push_back(tuple);
FieldValueTuple op("oper_status", oper ? "up" : "down");
FieldValueTuple op("netdev_oper_status", oper ? "up" : "down");
vector.push_back(op);
m_statePortTable.set(key, vector);
SWSS_LOG_NOTICE("Publish %s(ok:%s) to state db", key.c_str(), oper ? "up" : "down");
Expand Down

0 comments on commit 7e14891

Please sign in to comment.