From 8fa4032e7e41f10865a238f1c4c69f11e45080e3 Mon Sep 17 00:00:00 2001 From: Nikola Dancejic Date: Tue, 14 May 2024 18:23:55 +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 e29481c60..a732c1f72 100644 --- a/syncd/Syncd.cpp +++ b/syncd/Syncd.cpp @@ -1015,6 +1015,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].rif_id = m_translator->translateVidToRid(entries[it].rif_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); @@ -1301,6 +1323,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].rif_id = m_translator->translateVidToRid(entries[it].rif_id); + } + + status = m_vendorSai->bulkRemove( + object_count, + entries.data(), + mode, + statuses.data()); + + } + break; + case SAI_OBJECT_TYPE_FDB_ENTRY: { std::vector entries(object_count); @@ -1574,6 +1616,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].rif_id = m_translator->translateVidToRid(entries[it].rif_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); @@ -1730,6 +1793,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;