Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[saisubmodule] Update SAI submodule #1409

Merged
merged 4 commits into from
Sep 6, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions meta/MetaKeyHasher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ static bool operator==(
{
// SWSS_LOG_ENTER(); // disabled for performance reasons

return a.switch_id == b.switch_id && a.eni_id == b.eni_id && a.destination == b.destination;
return a.switch_id == b.switch_id && a.destination == b.destination && a.outbound_routing_group_id == b.outbound_routing_group_id;
}

static bool operator==(
Expand Down Expand Up @@ -673,8 +673,8 @@ static inline std::size_t sai_get_hash(
// SWSS_LOG_ENTER(); // disabled for performance reasons

std::size_t hash = 0;
boost::hash_combine(hash, oe.eni_id);
boost::hash_combine(hash, sai_get_hash(oe.destination));
boost::hash_combine(hash, oe.outbound_routing_group_id);

return hash;
}
Expand Down
4 changes: 2 additions & 2 deletions meta/SaiSerialize.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1822,8 +1822,8 @@ std::string sai_serialize_outbound_routing_entry(
json j;

j["switch_id"] = sai_serialize_object_id(outbound_routing_entry.switch_id);
j["eni_id"] = sai_serialize_object_id(outbound_routing_entry.eni_id);
j["destination"] = sai_serialize_ip_prefix(outbound_routing_entry.destination);
j["outbound_routing_group_id"] = sai_serialize_object_id(outbound_routing_entry.outbound_routing_group_id);

return j.dump();
}
Expand Down Expand Up @@ -4703,8 +4703,8 @@ void sai_deserialize_outbound_routing_entry(
json j = json::parse(s);

sai_deserialize_object_id(j["switch_id"], outbound_routing_entry.switch_id);
sai_deserialize_object_id(j["eni_id"], outbound_routing_entry.eni_id);
sai_deserialize_ip_prefix(j["destination"], outbound_routing_entry.destination);
sai_deserialize_object_id(j["outbound_routing_group_id"], outbound_routing_entry.outbound_routing_group_id);
}

void sai_deserialize_outbound_ca_to_pa_entry(
Expand Down
8 changes: 4 additions & 4 deletions saiplayer/SaiPlayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -880,7 +880,7 @@ sai_status_t SaiPlayer::handle_dash_outbound_routing(
sai_deserialize_outbound_routing_entry(str_object_id, entry);

entry.switch_id = translate_local_to_redis(entry.switch_id);
entry.eni_id = translate_local_to_redis(entry.eni_id);
entry.outbound_routing_group_id = translate_local_to_redis(entry.outbound_routing_group_id);

switch (api)
{
Expand Down Expand Up @@ -1796,7 +1796,7 @@ sai_status_t SaiPlayer::handle_bulk_entry(
sai_deserialize_outbound_routing_entry(object_ids[it], entries[it]);

entries[it].switch_id = translate_local_to_redis(entries[it].switch_id);
entries[it].eni_id = translate_local_to_redis(entries[it].eni_id);
entries[it].outbound_routing_group_id = translate_local_to_redis(entries[it].outbound_routing_group_id);
}

CALL_BULK_CREATE_API_WITH_TIMER("outbound_routing_entry");
Expand Down Expand Up @@ -1991,7 +1991,7 @@ sai_status_t SaiPlayer::handle_bulk_entry(
sai_deserialize_outbound_routing_entry(object_ids[it], entries[it]);

entries[it].switch_id = translate_local_to_redis(entries[it].switch_id);
entries[it].eni_id = translate_local_to_redis(entries[it].eni_id);
entries[it].outbound_routing_group_id = translate_local_to_redis(entries[it].outbound_routing_group_id);
}

CALL_BULK_REMOVE_API_WITH_TIMER("outbound_routing_entry");
Expand Down Expand Up @@ -2193,7 +2193,7 @@ sai_status_t SaiPlayer::handle_bulk_entry(
sai_deserialize_outbound_routing_entry(object_ids[it], entries[it]);

entries[it].switch_id = translate_local_to_redis(entries[it].switch_id);
entries[it].eni_id = translate_local_to_redis(entries[it].eni_id);
entries[it].outbound_routing_group_id = translate_local_to_redis(entries[it].outbound_routing_group_id);
}

CALL_BULK_SET_API_WITH_TIMER("outbound_routing_entry");
Expand Down
1 change: 1 addition & 0 deletions syncd/SwitchNotifications.h
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ namespace syncd
.on_switch_asic_sdk_health_event = &Slot<context>::onSwitchAsicSdkHealthEvent,
.on_port_host_tx_ready = &Slot<context>::onPortHostTxReady,
.on_twamp_session_event = &Slot<context>::onTwampSessionEvent,
.on_icmp_echo_session_state_change = nullptr,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any other changes required due to SAI refpoint update?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any other changes required due to SAI refpoint update?

No. Later let icmp echo feature owner implement its detail notification callback.

.on_ha_set_event = nullptr,
.on_ha_scope_event = nullptr,
}) { }
Expand Down
4 changes: 2 additions & 2 deletions syncd/Syncd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1239,7 +1239,7 @@ sai_status_t Syncd::processBulkCreateEntry(
sai_deserialize_outbound_routing_entry(objectIds[it], entries[it]);

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

status = m_vendorSai->bulkCreate(
Expand Down Expand Up @@ -1525,7 +1525,7 @@ sai_status_t Syncd::processBulkRemoveEntry(
sai_deserialize_outbound_routing_entry(objectIds[it], entries[it]);

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

status = m_vendorSai->bulkRemove(
Expand Down
40 changes: 31 additions & 9 deletions syncd/tests/TestSyncdNvdaBf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,28 @@ void SyncdNvdaBfTest::RemoveEni(sai_object_id_t eni)
EXPECT_EQ(SAI_STATUS_SUCCESS, m_sairedis->remove((sai_object_type_t)SAI_OBJECT_TYPE_ENI, eni));
}

sai_object_id_t SyncdNvdaBfTest::CreateOutboundRoutingGroup(bool disabled)
{
SWSS_LOG_ENTER();

sai_object_id_t oid;
sai_attribute_t attr;

attr.id = SAI_OUTBOUND_ROUTING_GROUP_ATTR_DISABLED;
attr.value.booldata = disabled;

EXPECT_EQ(SAI_STATUS_SUCCESS, m_sairedis->create((sai_object_type_t)SAI_OBJECT_TYPE_OUTBOUND_ROUTING_GROUP, &oid, m_switchId, 1, &attr));

return oid;
}

void SyncdNvdaBfTest::RemoveOutboundRoutingGroup(sai_object_id_t outbound_routing_group)
{
SWSS_LOG_ENTER();

EXPECT_EQ(SAI_STATUS_SUCCESS, m_sairedis->remove((sai_object_type_t)SAI_OBJECT_TYPE_OUTBOUND_ROUTING_GROUP, outbound_routing_group));
}

TEST_F(SyncdNvdaBfTest, dashDirectionLookup)
{
sai_attribute_t attr;
Expand Down Expand Up @@ -1100,15 +1122,15 @@ TEST_F(SyncdNvdaBfTest, dashOutboundRoutingEntry)

sai_object_id_t counter = CreateCounter();
sai_object_id_t vnet = CreateVnet(101);
sai_object_id_t eni = CreateEni(vnet);
sai_object_id_t outbound_routing_group = CreateOutboundRoutingGroup(false);

sai_ip_address_t oip6;
oip6.addr_family = SAI_IP_ADDR_FAMILY_IPV6;
inet_pton(AF_INET6, "ffff::", &oip6.addr);

sai_outbound_routing_entry_t entry0;
entry0.switch_id = m_switchId;
entry0.eni_id = eni;
entry0.outbound_routing_group_id = outbound_routing_group;
entry0.destination.addr_family = SAI_IP_ADDR_FAMILY_IPV4;
inet_pton(AF_INET, "192.168.1.0", &entry0.destination.addr.ip4);
inet_pton(AF_INET, "255.255.255.0", &entry0.destination.mask.ip4);
Expand Down Expand Up @@ -1140,7 +1162,7 @@ TEST_F(SyncdNvdaBfTest, dashOutboundRoutingEntry)

EXPECT_EQ(SAI_STATUS_SUCCESS, m_sairedis->remove(&entry0));

RemoveEni(eni);
RemoveOutboundRoutingGroup(outbound_routing_group);
RemoveVnet(vnet);
RemoveCounter(counter);
}
Expand All @@ -1161,8 +1183,8 @@ TEST_F(SyncdNvdaBfTest, dashOutboundRoutingEntryBulk)

sai_object_id_t vnet0 = CreateVnet(101);
sai_object_id_t vnet1 = CreateVnet(102);
sai_object_id_t eni0 = CreateEni(vnet0);
sai_object_id_t eni1 = CreateEni(vnet1);
sai_object_id_t outbound_routing_group0 = CreateOutboundRoutingGroup(false);
sai_object_id_t outbound_routing_group1 = CreateOutboundRoutingGroup(false);

sai_ip_prefix_t dst0 = {};
sai_ip_prefix_t dst1 = {};
Expand Down Expand Up @@ -1196,8 +1218,8 @@ TEST_F(SyncdNvdaBfTest, dashOutboundRoutingEntryBulk)
sai_status_t statuses[entries_count] = {};

sai_outbound_routing_entry_t entries[entries_count] = {
{ .switch_id = m_switchId, .eni_id = eni0, .destination = dst0},
{ .switch_id = m_switchId, .eni_id = eni1, .destination = dst1},
{ .switch_id = m_switchId, .destination = dst0, .outbound_routing_group_id = outbound_routing_group0},
{ .switch_id = m_switchId, .destination = dst1, .outbound_routing_group_id = outbound_routing_group1},
};

EXPECT_EQ(SAI_STATUS_SUCCESS, m_sairedis->bulkCreate(entries_count, entries, attr_count, attr_list, SAI_BULK_OP_ERROR_MODE_STOP_ON_ERROR, statuses));
Expand All @@ -1210,8 +1232,8 @@ TEST_F(SyncdNvdaBfTest, dashOutboundRoutingEntryBulk)
EXPECT_EQ(SAI_STATUS_SUCCESS, statuses[i]);
}

RemoveEni(eni0);
RemoveEni(eni1);
RemoveOutboundRoutingGroup(outbound_routing_group0);
RemoveOutboundRoutingGroup(outbound_routing_group1);
RemoveVnet(vnet0);
RemoveVnet(vnet1);
RemoveCounter(counter0);
Expand Down
3 changes: 3 additions & 0 deletions syncd/tests/TestSyncdNvdaBf.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ class SyncdNvdaBfTest : public ::testing::Test
sai_object_id_t CreateEni(sai_object_id_t vnet);
void RemoveEni(sai_object_id_t eni);

sai_object_id_t CreateOutboundRoutingGroup(bool disabled);
void RemoveOutboundRoutingGroup(sai_object_id_t outbound_routing_group);

protected:
std::shared_ptr<std::thread> m_worker;
std::shared_ptr<sairedis::Sai> m_sairedis;
Expand Down
Loading
Loading