From ef8a98e6973383b0ba0655d251c93917b5aef61f Mon Sep 17 00:00:00 2001 From: Nikola Dancejic Date: Thu, 18 Apr 2024 19:54:07 +0000 Subject: [PATCH] [syncd] Enable bulk api for neighbor entries SAI 1.11.0 added support for bulk neighbor entries. Adding support for neighbor bulk operations to syncd. Signed-off-by: Nikola Dancejic --- syncd/Syncd.cpp | 67 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) diff --git a/syncd/Syncd.cpp b/syncd/Syncd.cpp index 2eada41c8..dabad0584 100644 --- a/syncd/Syncd.cpp +++ b/syncd/Syncd.cpp @@ -1014,6 +1014,28 @@ sai_status_t Syncd::processBulkCreateEntry( } break; + case SAI_OBJECT_TYPE_NEIGHBOR_ENTRY: + { + std::vector 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 entries(object_count); @@ -1300,6 +1322,26 @@ sai_status_t Syncd::processBulkRemoveEntry( } break; + case SAI_OBJECT_TYPE_NEIGHBOR_ENTRY: + { + std::vector 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 entries(object_count); @@ -1573,6 +1615,27 @@ sai_status_t Syncd::processBulkSetEntry( } break; + case SAI_OBJECT_TYPE_NEIGHBOR_ENTRY: + { + std::vector 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 entries(object_count); @@ -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;