Skip to content
Closed
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 orchagent/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ else
DBGFLAGS = -g
endif

orchagent_SOURCES = main.cpp orchdaemon.cpp orch.cpp routeorch.cpp neighorch.cpp intfsorch.cpp portsorch.cpp
orchagent_SOURCES = main.cpp orchdaemon.cpp orch.cpp routeorch.cpp neighorch.cpp intfsorch.cpp portsorch.cpp qosorch.cpp bufferorch.cpp

orchagent_CFLAGS = $(DBGFLAGS) $(AM_CFLAGS) $(CFLAGS_COMMON) $(CFLAGS_SAI)
orchagent_CPPFLAGS = $(DBGFLAGS) $(AM_CFLAGS) $(CFLAGS_COMMON) $(CFLAGS_SAI)
Expand Down
626 changes: 626 additions & 0 deletions orchagent/bufferorch.cpp

Large diffs are not rendered by default.

46 changes: 46 additions & 0 deletions orchagent/bufferorch.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
#ifndef SWSS_BUFFORCH_H
#define SWSS_BUFFORCH_H

#include <map>
#include "orch.h"
#include "portsorch.h"

const std::string buffer_size_field_name = "size";
const std::string buffer_pool_type_field_name = "type";
const std::string buffer_pool_mode_field_name = "mode";
const std::string buffer_pool_field_name = "pool";
const std::string buffer_xon_field_name = "xon";
const std::string buffer_xoff_field_name = "xoff";
const std::string buffer_dynamic_th_field_name = "dynamic_th";
const std::string buffer_static_th_field_name = "static_th";
const std::string buffer_profile_field_name = "profile";
const std::string buffer_value_ingress = "ingress";
const std::string buffer_value_egress = "egress";
const std::string buffer_pool_mode_dynamic_value = "dynamic";
const std::string buffer_pool_mode_static_value = "static";
const std::string buffer_profile_list_field_name = "profile_list";

class BufferOrch : public Orch
{
public:
BufferOrch(DBConnector *db, vector<string> &tableNames, PortsOrch *portsOrch);
static type_map m_buffer_type_maps;
private:
typedef task_process_status (BufferOrch::*buffer_table_handler)(Consumer& consumer);
typedef std::map<std::string, buffer_table_handler> buffer_table_handler_map;
typedef std::pair<string, buffer_table_handler> buffer_handler_pair;

virtual void doTask(Consumer& consumer);
void initTableHandlers();
task_process_status processBufferPool(Consumer &consumer);
task_process_status processBufferProfile(Consumer &consumer);
task_process_status processQueue(Consumer &consumer);
task_process_status processPriorityGroup(Consumer &consumer);
task_process_status processIngressBufferProfileList(Consumer &consumer);
task_process_status processEgressBufferProfileList(Consumer &consumer);
private:
PortsOrch *m_portsOrch;
buffer_table_handler_map m_bufferHandlerMap;
};
#endif /* SWSS_BUFFORCH_H */

18 changes: 18 additions & 0 deletions orchagent/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,12 @@ sai_next_hop_api_t* sai_next_hop_api;
sai_next_hop_group_api_t* sai_next_hop_group_api;
sai_route_api_t* sai_route_api;
sai_lag_api_t* sai_lag_api;
sai_queue_api_t* sai_queue_api;
sai_scheduler_api_t* sai_scheduler_api;
sai_scheduler_group_api_t* sai_scheduler_group_api;
sai_wred_api_t* sai_wred_api;
sai_qos_map_api_t* sai_qos_map_api;
sai_buffer_api_t* sai_buffer_api;

map<string, string> gProfileMap;
sai_object_id_t gVirtualRouterId;
Expand Down Expand Up @@ -84,6 +90,12 @@ void initSaiApi()
sai_api_query(SAI_API_NEXT_HOP_GROUP, (void **)&sai_next_hop_group_api);
sai_api_query(SAI_API_ROUTE, (void **)&sai_route_api);
sai_api_query(SAI_API_LAG, (void **)&sai_lag_api);
sai_api_query(SAI_API_QUEUE, (void **)&sai_queue_api);
sai_api_query(SAI_API_SCHEDULER, (void **)&sai_scheduler_api);
sai_api_query(SAI_API_WRED, (void **)&sai_wred_api);
sai_api_query(SAI_API_QOS_MAPS, (void **)&sai_qos_map_api);
sai_api_query(SAI_API_BUFFERS, (void **)&sai_buffer_api);
sai_api_query(SAI_API_SCHEDULER_GROUP, (void **)&sai_scheduler_group_api);

sai_log_set(SAI_API_SWITCH, SAI_LOG_NOTICE);
sai_log_set(SAI_API_VIRTUAL_ROUTER, SAI_LOG_NOTICE);
Expand All @@ -96,6 +108,12 @@ void initSaiApi()
sai_log_set(SAI_API_NEXT_HOP_GROUP, SAI_LOG_NOTICE);
sai_log_set(SAI_API_ROUTE, SAI_LOG_NOTICE);
sai_log_set(SAI_API_LAG, SAI_LOG_NOTICE);
sai_log_set(SAI_API_QUEUE, SAI_LOG_NOTICE);
sai_log_set(SAI_API_SCHEDULER, SAI_LOG_NOTICE);
sai_log_set(SAI_API_WRED, SAI_LOG_NOTICE);
sai_log_set(SAI_API_QOS_MAPS, SAI_LOG_NOTICE);
sai_log_set(SAI_API_BUFFERS, SAI_LOG_NOTICE);
sai_log_set(SAI_API_SCHEDULER_GROUP, SAI_LOG_NOTICE);
}

void initDiagShell()
Expand Down
Loading