Skip to content

Commit 8730bd8

Browse files
author
vedganes
committed
[neighorch] VOQ Inband interface port code review comments fix 4
- Changes to avoid calling function to add encap index attribute for inband interface host neighbor. Since encap index attribute is supplied only for the remote neighbors and since the inband interface neighbor is local encap index will not added even if this function is called. So removed calling the api addVoqEncapIndex() while constructing neighbor add message for inband interface host. - Added changes to handle encap index change for the remote neighbors. During config re-load, there is a chance that SAI may allocate a different encap index than the index allocated before config-reload for the same neighbor. Since the mac addresss and ip address are same, neighorch, while processing this synced remote neighbors, considers this as duplicate and ignores it. This is fixed by making neighorch consider encap index received from CHASSIS_APP_DB in addition to mac and ip address to check for duplicate neighbor. Signed-off-by: vedganes <vedavinayagam.ganesan@nokia.com>
1 parent 8248ed1 commit 8730bd8

File tree

2 files changed

+24
-21
lines changed

2 files changed

+24
-21
lines changed

orchagent/neighorch.cpp

+23-21
Original file line numberDiff line numberDiff line change
@@ -1105,7 +1105,8 @@ void NeighOrch::doVoqSystemNeighTask(Consumer &consumer)
11051105
}
11061106

11071107
if (m_syncdNeighbors.find(neighbor_entry) == m_syncdNeighbors.end() ||
1108-
m_syncdNeighbors[neighbor_entry].mac != mac_address)
1108+
m_syncdNeighbors[neighbor_entry].mac != mac_address ||
1109+
m_syncdNeighbors[neighbor_entry].voq_encap_index != encap_index)
11091110
{
11101111
//Add neigh to SAI
11111112
if (addNeighbor(neighbor_entry, mac_address))
@@ -1199,11 +1200,6 @@ bool NeighOrch::addInbandNeighbor(string alias, IpAddress ip_address)
11991200
memcpy(attr.value.mac, inband_mac.getMac(), 6);
12001201
neighbor_attrs.push_back(attr);
12011202

1202-
if(!addVoqEncapIndex(alias, ip_address, neighbor_attrs))
1203-
{
1204-
return false;
1205-
}
1206-
12071203
//No host route for neighbor of the Inband IP address
12081204
attr.id = SAI_NEIGHBOR_ENTRY_ATTR_NO_HOST_ROUTE;
12091205
attr.value.booldata = true;
@@ -1347,6 +1343,27 @@ void NeighOrch::voqSyncAddNeigh(string &alias, IpAddress &ip_address, const MacA
13471343
sai_attribute_t attr;
13481344
sai_status_t status;
13491345

1346+
// Get the encap index and store it for handling change of
1347+
// encap index for remote neighbors synced via CHASSIS_APP_DB
1348+
1349+
attr.id = SAI_NEIGHBOR_ENTRY_ATTR_ENCAP_INDEX;
1350+
1351+
status = sai_neighbor_api->get_neighbor_entry_attribute(&neighbor_entry, 1, &attr);
1352+
if (status != SAI_STATUS_SUCCESS)
1353+
{
1354+
SWSS_LOG_ERROR("Failed to get neighbor attribute for %s on %s, rv:%d", ip_address.to_string().c_str(), alias.c_str(), status);
1355+
return;
1356+
}
1357+
1358+
if (!attr.value.u32)
1359+
{
1360+
SWSS_LOG_ERROR("Invalid neighbor encap_index for %s on %s", ip_address.to_string().c_str(), alias.c_str());
1361+
return;
1362+
}
1363+
1364+
NeighborEntry nbrEntry = {ip_address, alias};
1365+
m_syncdNeighbors[nbrEntry].voq_encap_index = attr.value.u32;
1366+
13501367
//Sync only local neigh. Confirm for the local neigh and
13511368
//get the system port alias for key for syncing to CHASSIS_APP_DB
13521369
Port port;
@@ -1375,21 +1392,6 @@ void NeighOrch::voqSyncAddNeigh(string &alias, IpAddress &ip_address, const MacA
13751392
return;
13761393
}
13771394

1378-
attr.id = SAI_NEIGHBOR_ENTRY_ATTR_ENCAP_INDEX;
1379-
1380-
status = sai_neighbor_api->get_neighbor_entry_attribute(&neighbor_entry, 1, &attr);
1381-
if (status != SAI_STATUS_SUCCESS)
1382-
{
1383-
SWSS_LOG_ERROR("Failed to get neighbor attribute for %s on %s, rv:%d", ip_address.to_string().c_str(), alias.c_str(), status);
1384-
return;
1385-
}
1386-
1387-
if (!attr.value.u32)
1388-
{
1389-
SWSS_LOG_ERROR("Invalid neighbor encap_index for %s on %s", ip_address.to_string().c_str(), alias.c_str());
1390-
return;
1391-
}
1392-
13931395
vector<FieldValueTuple> attrs;
13941396

13951397
FieldValueTuple eiFv ("encap_index", to_string(attr.value.u32));

orchagent/neighorch.h

+1
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ struct NeighborData
2727
{
2828
MacAddress mac;
2929
bool hw_configured = false; // False means, entry is not written to HW
30+
uint32_t voq_encap_index = 0;
3031
};
3132

3233
/* NeighborTable: NeighborEntry, neighbor MAC address */

0 commit comments

Comments
 (0)