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

[cherry-pick]Align 202211 with master for 202211 release (#1129)(#1116)(#1141) (#1136) (#1140) #1151

Merged
merged 5 commits into from
Nov 16, 2022
Merged
Show file tree
Hide file tree
Changes from all 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
2 changes: 1 addition & 1 deletion SAI
Submodule SAI updated 104 files
44 changes: 44 additions & 0 deletions lib/ClientSai.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1260,6 +1260,23 @@ sai_status_t ClientSai::bulkCreate(
object_statuses);
}

sai_status_t ClientSai::bulkCreate(
_In_ uint32_t object_count,
_In_ const sai_neighbor_entry_t* neighbor_entry,
_In_ const uint32_t *attr_count,
_In_ const sai_attribute_t **attr_list,
_In_ sai_bulk_op_error_mode_t mode,
_Out_ sai_status_t *object_statuses)
{
MUTEX();
SWSS_LOG_ENTER();
REDIS_CHECK_API_INITIALIZED();

// TODO support mode

return SAI_STATUS_NOT_IMPLEMENTED;
}

// BULK CREATE HELPERS

sai_status_t ClientSai::bulkCreate(
Expand Down Expand Up @@ -1436,6 +1453,19 @@ sai_status_t ClientSai::bulkRemove(
return bulkRemove(SAI_OBJECT_TYPE_MY_SID_ENTRY, serializedObjectIds, mode, object_statuses);
}

sai_status_t ClientSai::bulkRemove(
_In_ uint32_t object_count,
_In_ const _sai_neighbor_entry_t *neighbor_entry,
_In_ sai_bulk_op_error_mode_t mode,
_Out_ sai_status_t *object_statuses)
{
MUTEX();
SWSS_LOG_ENTER();
REDIS_CHECK_API_INITIALIZED();

return SAI_STATUS_NOT_IMPLEMENTED;
}

// BULK REMOVE HELPERS

sai_status_t ClientSai::bulkRemove(
Expand Down Expand Up @@ -1607,6 +1637,20 @@ sai_status_t ClientSai::bulkSet(
return bulkSet(SAI_OBJECT_TYPE_MY_SID_ENTRY, serializedObjectIds, attr_list, mode, object_statuses);
}

sai_status_t ClientSai::bulkSet(
_In_ uint32_t object_count,
_In_ const sai_neighbor_entry_t *neighbor_entry,
_In_ const sai_attribute_t *attr_list,
_In_ sai_bulk_op_error_mode_t mode,
_Out_ sai_status_t *object_statuses)
{
MUTEX();
SWSS_LOG_ENTER();
REDIS_CHECK_API_INITIALIZED();

return SAI_STATUS_NOT_IMPLEMENTED;
}

// BULK SET HELPERS

sai_status_t ClientSai::bulkSet(
Expand Down
1 change: 1 addition & 0 deletions lib/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ libsairedis_la_SOURCES = \
sai_redis_debug_counter.cpp \
sai_redis_dtel.cpp \
sai_redis_fdb.cpp \
sai_redis_genericprogrammable.cpp \
sai_redis_hash.cpp \
sai_redis_hostif.cpp \
sai_redis_interfacequery.cpp \
Expand Down
2 changes: 1 addition & 1 deletion lib/RedisChannel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ RedisChannel::RedisChannel(
m_getConsumer = std::make_shared<swss::ConsumerTable>(m_db.get(), REDIS_TABLE_GETRESPONSE);

m_dbNtf = std::make_shared<swss::DBConnector>(dbAsic, 0);
m_notificationConsumer = std::make_shared<swss::NotificationConsumer>(m_dbNtf.get(), REDIS_TABLE_NOTIFICATIONS);
m_notificationConsumer = std::make_shared<swss::NotificationConsumer>(m_dbNtf.get(), REDIS_TABLE_NOTIFICATIONS_PER_DB(dbAsic));

m_runNotificationThread = true;

Expand Down
67 changes: 67 additions & 0 deletions lib/RedisRemoteSaiInterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1453,6 +1453,24 @@ sai_status_t RedisRemoteSaiInterface::bulkRemove(
return bulkRemove(SAI_OBJECT_TYPE_MY_SID_ENTRY, serializedObjectIds, mode, object_statuses);
}

sai_status_t RedisRemoteSaiInterface::bulkRemove(
_In_ uint32_t object_count,
_In_ const sai_neighbor_entry_t *neighbor_entry,
_In_ sai_bulk_op_error_mode_t mode,
_Out_ sai_status_t *object_statuses)
{
SWSS_LOG_ENTER();

std::vector<std::string> serializedObjectIds;

for (uint32_t idx = 0; idx < object_count; idx++)
{
serializedObjectIds.emplace_back(sai_serialize_neighbor_entry(neighbor_entry[idx]));
}

return bulkRemove(SAI_OBJECT_TYPE_NEIGHBOR_ENTRY, serializedObjectIds, mode, object_statuses);
}

sai_status_t RedisRemoteSaiInterface::bulkSet(
_In_ sai_object_type_t object_type,
_In_ uint32_t object_count,
Expand Down Expand Up @@ -1568,6 +1586,25 @@ sai_status_t RedisRemoteSaiInterface::bulkSet(
return bulkSet(SAI_OBJECT_TYPE_MY_SID_ENTRY, serializedObjectIds, attr_list, mode, object_statuses);
}

sai_status_t RedisRemoteSaiInterface::bulkSet(
_In_ uint32_t object_count,
_In_ const sai_neighbor_entry_t *neighbor_entry,
_In_ const sai_attribute_t *attr_list,
_In_ sai_bulk_op_error_mode_t mode,
_Out_ sai_status_t *object_statuses)
{
SWSS_LOG_ENTER();

std::vector<std::string> serializedObjectIds;

for (uint32_t idx = 0; idx < object_count; idx++)
{
serializedObjectIds.emplace_back(sai_serialize_neighbor_entry(neighbor_entry[idx]));
}

return bulkSet(SAI_OBJECT_TYPE_NEIGHBOR_ENTRY, serializedObjectIds, attr_list, mode, object_statuses);
}

sai_status_t RedisRemoteSaiInterface::bulkSet(
_In_ sai_object_type_t object_type,
_In_ const std::vector<std::string> &serialized_object_ids,
Expand Down Expand Up @@ -1877,6 +1914,36 @@ sai_status_t RedisRemoteSaiInterface::bulkCreate(
object_statuses);
}

sai_status_t RedisRemoteSaiInterface::bulkCreate(
_In_ uint32_t object_count,
_In_ const sai_neighbor_entry_t* neighbor_entry,
_In_ const uint32_t *attr_count,
_In_ const sai_attribute_t **attr_list,
_In_ sai_bulk_op_error_mode_t mode,
_Out_ sai_status_t *object_statuses)
{
SWSS_LOG_ENTER();

// TODO support mode

std::vector<std::string> serialized_object_ids;

// on create vid is put in db by syncd
for (uint32_t idx = 0; idx < object_count; idx++)
{
std::string str_object_id = sai_serialize_neighbor_entry(neighbor_entry[idx]);
serialized_object_ids.push_back(str_object_id);
}

return bulkCreate(
SAI_OBJECT_TYPE_NEIGHBOR_ENTRY,
serialized_object_ids,
attr_count,
attr_list,
mode,
object_statuses);
}

sai_status_t RedisRemoteSaiInterface::notifySyncd(
_In_ sai_object_id_t switchId,
_In_ sai_redis_notify_syncd_t redisNotifySyncd)
Expand Down
95 changes: 48 additions & 47 deletions lib/sai_redis.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,53 +13,54 @@ extern "C" {

#define PRIVATE __attribute__((visibility("hidden")))

PRIVATE extern const sai_acl_api_t redis_acl_api;
PRIVATE extern const sai_bfd_api_t redis_bfd_api;
PRIVATE extern const sai_bmtor_api_t redis_bmtor_api;
PRIVATE extern const sai_bridge_api_t redis_bridge_api;
PRIVATE extern const sai_buffer_api_t redis_buffer_api;
PRIVATE extern const sai_counter_api_t redis_counter_api;
PRIVATE extern const sai_debug_counter_api_t redis_debug_counter_api;
PRIVATE extern const sai_dtel_api_t redis_dtel_api;
PRIVATE extern const sai_fdb_api_t redis_fdb_api;
PRIVATE extern const sai_hash_api_t redis_hash_api;
PRIVATE extern const sai_hostif_api_t redis_hostif_api;
PRIVATE extern const sai_ipmc_api_t redis_ipmc_api;
PRIVATE extern const sai_ipmc_group_api_t redis_ipmc_group_api;
PRIVATE extern const sai_isolation_group_api_t redis_isolation_group_api;
PRIVATE extern const sai_l2mc_api_t redis_l2mc_api;
PRIVATE extern const sai_l2mc_group_api_t redis_l2mc_group_api;
PRIVATE extern const sai_lag_api_t redis_lag_api;
PRIVATE extern const sai_macsec_api_t redis_macsec_api;
PRIVATE extern const sai_mcast_fdb_api_t redis_mcast_fdb_api;
PRIVATE extern const sai_mirror_api_t redis_mirror_api;
PRIVATE extern const sai_mpls_api_t redis_mpls_api;
PRIVATE extern const sai_nat_api_t redis_nat_api;
PRIVATE extern const sai_neighbor_api_t redis_neighbor_api;
PRIVATE extern const sai_next_hop_api_t redis_next_hop_api;
PRIVATE extern const sai_next_hop_group_api_t redis_next_hop_group_api;
PRIVATE extern const sai_policer_api_t redis_policer_api;
PRIVATE extern const sai_port_api_t redis_port_api;
PRIVATE extern const sai_qos_map_api_t redis_qos_map_api;
PRIVATE extern const sai_queue_api_t redis_queue_api;
PRIVATE extern const sai_route_api_t redis_route_api;
PRIVATE extern const sai_router_interface_api_t redis_router_interface_api;
PRIVATE extern const sai_rpf_group_api_t redis_rpf_group_api;
PRIVATE extern const sai_samplepacket_api_t redis_samplepacket_api;
PRIVATE extern const sai_scheduler_api_t redis_scheduler_api;
PRIVATE extern const sai_scheduler_group_api_t redis_scheduler_group_api;
PRIVATE extern const sai_srv6_api_t redis_srv6_api;
PRIVATE extern const sai_stp_api_t redis_stp_api;
PRIVATE extern const sai_switch_api_t redis_switch_api;
PRIVATE extern const sai_system_port_api_t redis_system_port_api;
PRIVATE extern const sai_tam_api_t redis_tam_api;
PRIVATE extern const sai_tunnel_api_t redis_tunnel_api;
PRIVATE extern const sai_udf_api_t redis_udf_api;
PRIVATE extern const sai_virtual_router_api_t redis_virtual_router_api;
PRIVATE extern const sai_vlan_api_t redis_vlan_api;
PRIVATE extern const sai_wred_api_t redis_wred_api;
PRIVATE extern const sai_my_mac_api_t redis_my_mac_api;
PRIVATE extern const sai_ipsec_api_t redis_ipsec_api;
PRIVATE extern const sai_acl_api_t redis_acl_api;
PRIVATE extern const sai_bfd_api_t redis_bfd_api;
PRIVATE extern const sai_bmtor_api_t redis_bmtor_api;
PRIVATE extern const sai_generic_programmable_api_t redis_generic_programmable_api;
PRIVATE extern const sai_bridge_api_t redis_bridge_api;
PRIVATE extern const sai_buffer_api_t redis_buffer_api;
PRIVATE extern const sai_counter_api_t redis_counter_api;
PRIVATE extern const sai_debug_counter_api_t redis_debug_counter_api;
PRIVATE extern const sai_dtel_api_t redis_dtel_api;
PRIVATE extern const sai_fdb_api_t redis_fdb_api;
PRIVATE extern const sai_hash_api_t redis_hash_api;
PRIVATE extern const sai_hostif_api_t redis_hostif_api;
PRIVATE extern const sai_ipmc_api_t redis_ipmc_api;
PRIVATE extern const sai_ipmc_group_api_t redis_ipmc_group_api;
PRIVATE extern const sai_isolation_group_api_t redis_isolation_group_api;
PRIVATE extern const sai_l2mc_api_t redis_l2mc_api;
PRIVATE extern const sai_l2mc_group_api_t redis_l2mc_group_api;
PRIVATE extern const sai_lag_api_t redis_lag_api;
PRIVATE extern const sai_macsec_api_t redis_macsec_api;
PRIVATE extern const sai_mcast_fdb_api_t redis_mcast_fdb_api;
PRIVATE extern const sai_mirror_api_t redis_mirror_api;
PRIVATE extern const sai_mpls_api_t redis_mpls_api;
PRIVATE extern const sai_nat_api_t redis_nat_api;
PRIVATE extern const sai_neighbor_api_t redis_neighbor_api;
PRIVATE extern const sai_next_hop_api_t redis_next_hop_api;
PRIVATE extern const sai_next_hop_group_api_t redis_next_hop_group_api;
PRIVATE extern const sai_policer_api_t redis_policer_api;
PRIVATE extern const sai_port_api_t redis_port_api;
PRIVATE extern const sai_qos_map_api_t redis_qos_map_api;
PRIVATE extern const sai_queue_api_t redis_queue_api;
PRIVATE extern const sai_route_api_t redis_route_api;
PRIVATE extern const sai_router_interface_api_t redis_router_interface_api;
PRIVATE extern const sai_rpf_group_api_t redis_rpf_group_api;
PRIVATE extern const sai_samplepacket_api_t redis_samplepacket_api;
PRIVATE extern const sai_scheduler_api_t redis_scheduler_api;
PRIVATE extern const sai_scheduler_group_api_t redis_scheduler_group_api;
PRIVATE extern const sai_srv6_api_t redis_srv6_api;
PRIVATE extern const sai_stp_api_t redis_stp_api;
PRIVATE extern const sai_switch_api_t redis_switch_api;
PRIVATE extern const sai_system_port_api_t redis_system_port_api;
PRIVATE extern const sai_tam_api_t redis_tam_api;
PRIVATE extern const sai_tunnel_api_t redis_tunnel_api;
PRIVATE extern const sai_udf_api_t redis_udf_api;
PRIVATE extern const sai_virtual_router_api_t redis_virtual_router_api;
PRIVATE extern const sai_vlan_api_t redis_vlan_api;
PRIVATE extern const sai_wred_api_t redis_wred_api;
PRIVATE extern const sai_my_mac_api_t redis_my_mac_api;
PRIVATE extern const sai_ipsec_api_t redis_ipsec_api;

PRIVATE extern std::shared_ptr<sairedis::SaiInterface> redis_sai;

Expand Down
7 changes: 7 additions & 0 deletions lib/sai_redis_genericprogrammable.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#include "sai_redis.h"

REDIS_GENERIC_QUAD(GENERIC_PROGRAMMABLE,generic_programmable);

const sai_generic_programmable_api_t redis_generic_programmable_api = {
REDIS_GENERIC_QUAD_API(generic_programmable)
};
1 change: 1 addition & 0 deletions lib/sai_redis_interfacequery.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ static sai_apis_t redis_apis = {
API(system_port),
API(my_mac),
API(ipsec),
API(generic_programmable),
API(bmtor),
};

Expand Down
4 changes: 3 additions & 1 deletion lib/sai_redis_neighbor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,13 @@ static sai_status_t redis_remove_all_neighbor_entries(
return SAI_STATUS_NOT_IMPLEMENTED;
}

REDIS_BULK_QUAD_ENTRY(NEIGHBOR_ENTRY,neighbor_entry);
REDIS_GENERIC_QUAD_ENTRY(NEIGHBOR_ENTRY,neighbor_entry);

const sai_neighbor_api_t redis_neighbor_api = {

REDIS_GENERIC_QUAD_API(neighbor_entry)

redis_remove_all_neighbor_entries,

REDIS_BULK_QUAD_API(neighbor_entry)
};
4 changes: 2 additions & 2 deletions lib/sai_redis_nexthopgroup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@ const sai_next_hop_group_api_t redis_next_hop_group_api = {
redis_bulk_create_next_hop_group_members,
redis_bulk_remove_next_hop_group_members,
REDIS_GENERIC_QUAD_API(next_hop_group_map)
redis_bulk_get_next_hop_group_members,
redis_bulk_set_next_hop_group_members
redis_bulk_set_next_hop_group_members,
redis_bulk_get_next_hop_group_members
};
26 changes: 26 additions & 0 deletions lib/sai_redis_switch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,30 @@ static sai_status_t redis_switch_mdio_write(
return SAI_STATUS_NOT_IMPLEMENTED;
}

static sai_status_t redis_switch_mdio_cl22_read(
_In_ sai_object_id_t switch_id,
_In_ uint32_t device_addr,
_In_ uint32_t start_reg_addr,
_In_ uint32_t number_of_registers,
_Out_ uint32_t *reg_val)
{
SWSS_LOG_ENTER();

return SAI_STATUS_NOT_IMPLEMENTED;
}

static sai_status_t redis_switch_mdio_cl22_write(
_In_ sai_object_id_t switch_id,
_In_ uint32_t device_addr,
_In_ uint32_t start_reg_addr,
_In_ uint32_t number_of_registers,
_In_ const uint32_t *reg_val)
{
SWSS_LOG_ENTER();

return SAI_STATUS_NOT_IMPLEMENTED;
}

REDIS_GENERIC_QUAD(SWITCH,switch);
REDIS_GENERIC_STATS(SWITCH,switch);
REDIS_GENERIC_QUAD(SWITCH_TUNNEL,switch_tunnel);
Expand Down Expand Up @@ -55,4 +79,6 @@ const sai_switch_api_t redis_switch_api = {
redis_switch_mdio_write,

REDIS_GENERIC_QUAD_API(switch_tunnel)
redis_switch_mdio_cl22_read,
redis_switch_mdio_cl22_write
};
4 changes: 2 additions & 2 deletions lib/sai_redis_tunnel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ REDIS_GENERIC_QUAD(TUNNEL,tunnel);
REDIS_GENERIC_QUAD(TUNNEL_TERM_TABLE_ENTRY,tunnel_term_table_entry);
REDIS_GENERIC_QUAD(TUNNEL_MAP_ENTRY,tunnel_map_entry);
REDIS_GENERIC_STATS(TUNNEL,tunnel);
REDIS_BULK_GET_SET(TUNNEL,tunnels);
REDIS_BULK_QUAD(TUNNEL,tunnels);

const sai_tunnel_api_t redis_tunnel_api = {

Expand All @@ -14,5 +14,5 @@ const sai_tunnel_api_t redis_tunnel_api = {
REDIS_GENERIC_STATS_API(tunnel)
REDIS_GENERIC_QUAD_API(tunnel_term_table_entry)
REDIS_GENERIC_QUAD_API(tunnel_map_entry)
REDIS_BULK_GET_SET_API(tunnels)
REDIS_BULK_QUAD_API(tunnels)
};
12 changes: 12 additions & 0 deletions lib/sairediscommon.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,18 @@
*/
#define REDIS_TABLE_NOTIFICATIONS "NOTIFICATIONS"

/**
* @brief Table which will be used to forward notifications per DB scope
*
* In https://redis.io/docs/manual/pubsub/, it says:
* "Pub/Sub has no relation to the key space. It was made to not interfere with
* it on any level, including database numbers."
*/
#define REDIS_TABLE_NOTIFICATIONS_PER_DB(dbName) \
((dbName) == "ASIC_DB" ? \
REDIS_TABLE_NOTIFICATIONS : \
(dbName) + "_" + REDIS_TABLE_NOTIFICATIONS)

/**
* @brief Table which will be used to send API response from syncd.
*/
Expand Down
Loading