Skip to content

Commit

Permalink
[syncd] Enable bulk api for neighbor entries
Browse files Browse the repository at this point in the history
SAI 1.11.0 added support for bulk neighbor entries. Adding support for
neighbor bulk operations to syncd.

Signed-off-by: Nikola Dancejic <ndancejic@microsoft.com>
  • Loading branch information
Ndancejic committed Apr 19, 2024
1 parent 73ada8d commit ef8a98e
Showing 1 changed file with 67 additions and 0 deletions.
67 changes: 67 additions & 0 deletions syncd/Syncd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1014,6 +1014,28 @@ sai_status_t Syncd::processBulkCreateEntry(
}
break;

case SAI_OBJECT_TYPE_NEIGHBOR_ENTRY:
{
std::vector<sai_neighbor_entry_t> entries(object_count);
for (uint32_t it = 0; it < object_count; it++)
{
sai_deserialize_neighbor_entry(objectIds[it], entries[it]);

entries[it].switch_id = m_translator->translateVidToRid(entries[it].switch_id);
entries[it].vr_id = m_translator->translateVidToRid(entries[it].vr_id);
}

status = m_vendorSai->bulkCreate(
object_count,
entries.data(),
attr_counts.data(),
attr_lists.data(),
mode,
statuses.data());

}
break;

case SAI_OBJECT_TYPE_FDB_ENTRY:
{
std::vector<sai_fdb_entry_t> entries(object_count);
Expand Down Expand Up @@ -1300,6 +1322,26 @@ sai_status_t Syncd::processBulkRemoveEntry(
}
break;

case SAI_OBJECT_TYPE_NEIGHBOR_ENTRY:
{
std::vector<sai_neighbor_entry_t> entries(object_count);
for (uint32_t it = 0; it < object_count; it++)
{
sai_deserialize_neighbor_entry(objectIds[it], entries[it]);

entries[it].switch_id = m_translator->translateVidToRid(entries[it].switch_id);
entries[it].vr_id = m_translator->translateVidToRid(entries[it].vr_id);
}

status = m_vendorSai->bulkRemove(
object_count,
entries.data(),
mode,
statuses.data());

}
break;

case SAI_OBJECT_TYPE_FDB_ENTRY:
{
std::vector<sai_fdb_entry_t> entries(object_count);
Expand Down Expand Up @@ -1573,6 +1615,27 @@ sai_status_t Syncd::processBulkSetEntry(
}
break;

case SAI_OBJECT_TYPE_NEIGHBOR_ENTRY:
{
std::vector<sai_neighbor_entry_t> entries(object_count);
for (uint32_t it = 0; it < object_count; it++)
{
sai_deserialize_neighbor_entry(objectIds[it], entries[it]);

entries[it].switch_id = m_translator->translateVidToRid(entries[it].switch_id);
entries[it].vr_id = m_translator->translateVidToRid(entries[it].vr_id);
}

status = m_vendorSai->bulkSet(
object_count,
entries.data(),
attr_lists.data(),
mode,
statuses.data());

}
break;

case SAI_OBJECT_TYPE_FDB_ENTRY:
{
std::vector<sai_fdb_entry_t> entries(object_count);
Expand Down Expand Up @@ -1729,6 +1792,10 @@ sai_status_t Syncd::processBulkEntry(
sai_deserialize_route_entry(objectIds[idx], metaKey.objectkey.key.route_entry);
break;

case SAI_OBJECT_TYPE_NEIGHBOR_ENTRY:
sai_deserialize_neighbor_entry(objectIds[idx], metaKey.objectkey.key.neighbor_entry);
break;

case SAI_OBJECT_TYPE_NAT_ENTRY:
sai_deserialize_nat_entry(objectIds[idx], metaKey.objectkey.key.nat_entry);
break;
Expand Down

0 comments on commit ef8a98e

Please sign in to comment.