Skip to content
This repository has been archived by the owner on Jan 3, 2023. It is now read-only.

Azure merge #7

Merged
merged 16 commits into from
Jul 10, 2018
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 lib/src/sai_redis_bridge.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ sai_status_t redis_get_bridge_port_stats_ext(
_In_ sai_object_id_t bridge_port_id,
_In_ uint32_t number_of_counters,
_In_ const sai_bridge_port_stat_t *counter_ids,
_In_ sai_stats_mode_t mode,
_In_ sai_stats_mode_t mode,
_Out_ uint64_t *counters)
{
MUTEX();
Expand Down
20 changes: 10 additions & 10 deletions lib/src/sai_redis_buffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ sai_status_t redis_clear_ingress_priority_group_stats(
}

sai_status_t redis_get_ingress_priority_group_stats_ext(
_In_ sai_object_id_t ingress_pg_id,
_In_ sai_object_id_t ingress_priority_group_id,
_In_ uint32_t number_of_counters,
_In_ const sai_ingress_priority_group_stat_t *counter_ids,
_In_ sai_stats_mode_t mode,
_Out_ uint64_t *counters)
_In_ sai_stats_mode_t mode,
_Out_ uint64_t *counters)
{
MUTEX();

Expand All @@ -39,10 +39,12 @@ sai_status_t redis_get_buffer_pool_stats(
return SAI_STATUS_NOT_IMPLEMENTED;
}

sai_status_t redis_clear_buffer_pool_stats(
_In_ sai_object_id_t pool_id,
sai_status_t redis_get_buffer_pool_stats_ext(
_In_ sai_object_id_t buffer_pool_id,
_In_ uint32_t number_of_counters,
_In_ const sai_buffer_pool_stat_t *counter_ids)
_In_ const sai_buffer_pool_stat_t *counter_ids,
_In_ sai_stats_mode_t mode,
_Out_ uint64_t *counters)
{
MUTEX();

Expand All @@ -51,12 +53,10 @@ sai_status_t redis_clear_buffer_pool_stats(
return SAI_STATUS_NOT_IMPLEMENTED;
}

sai_status_t redis_get_buffer_pool_stats_ext(
sai_status_t redis_clear_buffer_pool_stats(
_In_ sai_object_id_t pool_id,
_In_ uint32_t number_of_counters,
_In_ const sai_buffer_pool_stat_t *counter_ids,
_In_ sai_stats_mode_t mode,
_Out_ uint64_t *counters)
_In_ const sai_buffer_pool_stat_t *counter_ids)
{
MUTEX();

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

sai_status_t redis_recv_hostif_packet(
_In_ sai_object_id_t hif_id,
_In_ sai_object_id_t hostif_id,
_Inout_ sai_size_t *buffer_size,
_Out_ void *buffer,
_Inout_ uint32_t *attr_count,
Expand All @@ -15,7 +15,7 @@ sai_status_t redis_recv_hostif_packet(
}

sai_status_t redis_send_hostif_packet(
_In_ sai_object_id_t hif_id,
_In_ sai_object_id_t hostif_id,
_In_ sai_size_t buffer_size,
_In_ const void *buffer,
_In_ uint32_t attr_count,
Expand Down
6 changes: 3 additions & 3 deletions lib/src/sai_redis_policer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ sai_status_t redis_get_policer_stats(
return SAI_STATUS_NOT_IMPLEMENTED;
}

sai_status_t redis_get_policer_stats_ext(
sai_status_t redis_sai_get_policer_stats_ext(
_In_ sai_object_id_t policer_id,
_In_ uint32_t number_of_counters,
_In_ const sai_policer_stat_t *counter_ids,
_In_ sai_stats_mode_t mode,
_In_ sai_stats_mode_t mode,
_Out_ uint64_t *counters)
{
MUTEX();
Expand Down Expand Up @@ -46,6 +46,6 @@ const sai_policer_api_t redis_policer_api = {
REDIS_GENERIC_QUAD_API(policer)

redis_get_policer_stats,
redis_get_policer_stats_ext,
redis_sai_get_policer_stats_ext,
redis_clear_policer_stats,
};
17 changes: 8 additions & 9 deletions lib/src/sai_redis_port.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ sai_status_t redis_get_port_stats_ext(
_In_ sai_object_id_t port_id,
_In_ uint32_t number_of_counters,
_In_ const sai_port_stat_t *counter_ids,
_In_ sai_stats_mode_t mode,
_Out_ uint64_t *counters)
_In_ sai_stats_mode_t mode,
_Out_ uint64_t *counters)
{
MUTEX();

Expand All @@ -36,10 +36,12 @@ sai_status_t redis_clear_port_all_stats(
return SAI_STATUS_NOT_IMPLEMENTED;
}

sai_status_t redis_clear_port_pool_stats(
sai_status_t redis_get_port_pool_stats_ext(
_In_ sai_object_id_t port_pool_id,
_In_ uint32_t number_of_counters,
_In_ const sai_port_pool_stat_t *counter_ids)
_In_ const sai_port_pool_stat_t *counter_ids,
_In_ sai_stats_mode_t mode,
_Out_ uint64_t *counters)
{
MUTEX();

Expand All @@ -48,12 +50,10 @@ sai_status_t redis_clear_port_pool_stats(
return SAI_STATUS_NOT_IMPLEMENTED;
}

sai_status_t redis_get_port_pool_stats_ext(
sai_status_t redis_clear_port_pool_stats(
_In_ sai_object_id_t port_pool_id,
_In_ uint32_t number_of_counters,
_In_ const sai_port_pool_stat_t *counter_ids,
_In_ sai_stats_mode_t mode,
_Out_ uint64_t *counters)
_In_ const sai_port_pool_stat_t *counter_ids)
{
MUTEX();

Expand All @@ -62,7 +62,6 @@ sai_status_t redis_get_port_pool_stats_ext(
return SAI_STATUS_NOT_IMPLEMENTED;
}


REDIS_GENERIC_QUAD(PORT,port);
REDIS_GENERIC_QUAD(PORT_POOL,port_pool);

Expand Down
4 changes: 2 additions & 2 deletions lib/src/sai_redis_queue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ sai_status_t redis_get_queue_stats_ext(
_In_ sai_object_id_t queue_id,
_In_ uint32_t number_of_counters,
_In_ const sai_queue_stat_t *counter_ids,
_In_ sai_stats_mode_t mode,
_Out_ uint64_t *counters)
_In_ sai_stats_mode_t mode,
_Out_ uint64_t *counters)
{
MUTEX();

Expand Down
5 changes: 2 additions & 3 deletions lib/src/sai_redis_tunnel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ sai_status_t redis_get_tunnel_stats_ext(
_In_ sai_object_id_t tunnel_id,
_In_ uint32_t number_of_counters,
_In_ const sai_tunnel_stat_t *counter_ids,
_In_ sai_stats_mode_t mode,
_Out_ uint64_t *counters)
_In_ sai_stats_mode_t mode,
_Out_ uint64_t *counters)
{
MUTEX();

Expand All @@ -26,7 +26,6 @@ sai_status_t redis_get_tunnel_stats_ext(
return SAI_STATUS_NOT_IMPLEMENTED;
}


REDIS_GENERIC_QUAD(TUNNEL_MAP,tunnel_map);
REDIS_GENERIC_QUAD(TUNNEL,tunnel);
REDIS_GENERIC_QUAD(TUNNEL_TERM_TABLE_ENTRY,tunnel_term_table_entry);
Expand Down
2 changes: 1 addition & 1 deletion lib/src/sai_redis_vlan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ sai_status_t redis_get_vlan_stats_ext(
_In_ sai_object_id_t vlan_id,
_In_ uint32_t number_of_counters,
_In_ const sai_vlan_stat_t *counter_ids,
_In_ sai_stats_mode_t mode,
_In_ sai_stats_mode_t mode,
_Out_ uint64_t *counters)
{
MUTEX();
Expand Down
8 changes: 6 additions & 2 deletions meta/sai_meta.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3666,7 +3666,9 @@ sai_status_t meta_sai_set_fdb_entry(
#define META_LOG_STATUS(s)\
if (s == SAI_STATUS_SUCCESS) \
SWSS_LOG_DEBUG("get status: %s", sai_serialize_status(s).c_str()); \
else if (s == SAI_STATUS_BUFFER_OVERFLOW) \
else if (s == SAI_STATUS_BUFFER_OVERFLOW \
|| SAI_STATUS_IS_ATTR_NOT_IMPLEMENTED(s) \
|| SAI_STATUS_IS_ATTR_NOT_SUPPORTED(s)) \
SWSS_LOG_INFO("get status: %s", sai_serialize_status(s).c_str()); \
else \
SWSS_LOG_ERROR("get status: %s", sai_serialize_status(s).c_str());
Expand Down Expand Up @@ -4701,7 +4703,9 @@ void meta_sai_on_fdb_flush_event_consolidated(
continue;
}

if (bpid != NULL)
// only consider bridge port id if it's defined and value is not NULL
// since vendor can add this attribute to fdb_entry with NULL value
if (bpid != NULL && bpid->value.oid != SAI_NULL_OBJECT_ID)
{
if (it->second.find(SAI_FDB_ENTRY_ATTR_BRIDGE_PORT_ID) == it->second.end())
{
Expand Down
24 changes: 11 additions & 13 deletions syncd/scripts/syncd_init_common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ config_syncd_mlnx()
[ -e /dev/sxdevs/sxcdev ] || ( mkdir -p /dev/sxdevs && mknod /dev/sxdevs/sxcdev c 231 193 )

# Read MAC address and align the last 6 bits.
MAC_ADDRESS=$(ip link show eth0 | grep ether | awk '{print $2}')
MAC_ADDRESS=$(sonic-cfggen -d -v DEVICE_METADATA.localhost.mac)
last_byte=$(python -c "print '$MAC_ADDRESS'[-2:]")
aligned_last_byte=$(python -c "print format(int(int('$last_byte', 16) & 0b11000000), '02x')") # put mask and take away the 0x prefix
ALIGNED_MAC_ADDRESS=$(python -c "print '$MAC_ADDRESS'[:-2] + '$aligned_last_byte'") # put aligned byte into the end of MAC
Expand All @@ -70,32 +70,30 @@ config_syncd_mlnx()

config_syncd_centec()
{
CMD_ARGS+=" -p /tmp/sai.profile"
CMD_ARGS+=" -p $HWSKU_DIR/sai.profile"

[ -e /dev/linux_dal ] || mknod /dev/linux_dal c 198 0
[ -e /dev/net/tun ] || ( mkdir -p /dev/net && mknod /dev/net/tun c 10 200 )

# Read MAC address and align the last 6 bits.
MAC_ADDRESS=$(ip link show eth0 | grep ether | awk '{print $2}')
last_byte=$(python -c "print '$MAC_ADDRESS'[-2:]")
aligned_last_byte=$(python -c "print format(int(int('$last_byte', 16) & 0b11000000), '02x')") # put mask and take away the 0x prefix
ALIGNED_MAC_ADDRESS=$(python -c "print '$MAC_ADDRESS'[:-2] + '$aligned_last_byte'") # put aligned byte into the end of MAC

# Write MAC address into /tmp/profile file.
cat $HWSKU_DIR/sai.profile > /tmp/sai.profile
echo "DEVICE_MAC_ADDRESS=$ALIGNED_MAC_ADDRESS" >> /tmp/sai.profile

if [ $FAST_REBOOT == "yes" ]; then
CMD_ARGS+=" -t fast"
fi
}

config_syncd_cavium()
{
CMD_ARGS+=" -p /etc/ssw/AS7512/profile.ini"
CMD_ARGS+=" -p $HWSKU_DIR/sai.profile -d"

export XP_ROOT=/usr/bin/

# Wait until redis-server starts
until [ $(redis-cli ping | grep -c PONG) -gt 0 ]; do
sleep 1
done

if [ $FAST_REBOOT == "yes" ]; then
CMD_ARGS+=" -t fast"
fi
}

config_syncd_marvell()
Expand Down
28 changes: 25 additions & 3 deletions syncd/syncd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2491,7 +2491,7 @@ sai_status_t processEvent(
{
if (status != SAI_STATUS_SUCCESS)
{
SWSS_LOG_WARN("get API for key: %s op: %s returned status: %s",
SWSS_LOG_DEBUG("get API for key: %s op: %s returned status: %s",
key.c_str(),
op.c_str(),
sai_serialize_status(status).c_str());
Expand Down Expand Up @@ -2580,6 +2580,10 @@ void processFlexCounterGroupEvent(
FlexCounter::addPortCounterPlugin(sha, groupName);
}
}
else if (field == FLEX_COUNTER_STATUS_FIELD)
{
FlexCounter::updateFlexCounterStatus(value, groupName);
}
else
{
SWSS_LOG_ERROR("Field is not supported %s", field.c_str());
Expand Down Expand Up @@ -3054,6 +3058,21 @@ void set_sai_api_loglevel()
}
}

void set_sai_api_log_min_prio(const std::string &prioStr)
{
SWSS_LOG_ENTER();

/*
* We start from 1 since 0 is SAI_API_UNSPECIFIED.
*/

for (uint32_t idx = 1; idx < sai_metadata_enum_sai_api_t.valuescount; ++idx)
{
const auto& api_name = sai_metadata_enum_sai_api_t.valuesnames[idx];
saiLoglevelNotify(api_name, prioStr);
}
}

void performWarmRestart()
{
SWSS_LOG_ENTER();
Expand Down Expand Up @@ -3434,6 +3453,11 @@ int syncd_main(int argc, char **argv)

#endif

FlexCounter::removeAllCounters();

// Stop notification thread before removing switch
stopNotificationsProcessingThread();

status = sai_switch_api->remove_switch(gSwitchId);
if (status != SAI_STATUS_SUCCESS)
{
Expand All @@ -3450,8 +3474,6 @@ int syncd_main(int argc, char **argv)
SWSS_LOG_ERROR("failed to uninitialize api: %s", sai_serialize_status(status).c_str());
}

stopNotificationsProcessingThread();

SWSS_LOG_NOTICE("uninitialize finished");

return EXIT_SUCCESS;
Expand Down
3 changes: 3 additions & 0 deletions syncd/syncd.h
Original file line number Diff line number Diff line change
Expand Up @@ -113,4 +113,7 @@ sai_status_t processBulkEvent(
_In_ sai_common_api_t api,
_In_ const swss::KeyOpFieldsValuesTuple &kco);

void set_sai_api_log_min_prio(
_In_ const std::string &prio);

#endif // __SYNCD_H__
Loading