Skip to content

Commit

Permalink
orchagent: Moving portsOrch to global and refactoring intfsOrch (soni…
Browse files Browse the repository at this point in the history
…c-net#71)

- Moving portsOrch to global
- Adding intfsOrch dependency check
  - Adding struct IntfsEntry
  - Adding increase/decrease reference count functions
  - Multiple IPs support
- Removing trailing \n in logs
  • Loading branch information
stcheng authored Sep 19, 2016
1 parent 21dffc6 commit 4ae09c7
Show file tree
Hide file tree
Showing 18 changed files with 388 additions and 331 deletions.
17 changes: 7 additions & 10 deletions orchagent/bufferorch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ extern sai_queue_api_t *sai_queue_api;
extern sai_switch_api_t *sai_switch_api;
extern sai_buffer_api_t *sai_buffer_api;

extern PortsOrch *gPortsOrch;

using namespace std;

type_map BufferOrch::m_buffer_type_maps = {
Expand All @@ -22,8 +24,7 @@ type_map BufferOrch::m_buffer_type_maps = {
{APP_BUFFER_PORT_EGRESS_PROFILE_LIST_NAME, new object_map()}
};

BufferOrch::BufferOrch(DBConnector *db, vector<string> &tableNames, PortsOrch *portsOrch) :
Orch(db, tableNames), m_portsOrch(portsOrch)
BufferOrch::BufferOrch(DBConnector *db, vector<string> &tableNames) : Orch(db, tableNames)
{
SWSS_LOG_ENTER();
initTableHandlers();
Expand Down Expand Up @@ -323,7 +324,7 @@ task_process_status BufferOrch::processQueue(Consumer &consumer)
{
Port port;
SWSS_LOG_DEBUG("processing port:%s", port_name.c_str());
if (!m_portsOrch->getPort(port_name, port))
if (!gPortsOrch->getPort(port_name, port))
{
SWSS_LOG_ERROR("Port with alias:%s not found\n", port_name.c_str());
return task_process_status::task_invalid_entry;
Expand Down Expand Up @@ -395,7 +396,7 @@ task_process_status BufferOrch::processPriorityGroup(Consumer &consumer)
{
Port port;
SWSS_LOG_DEBUG("processing port:%s", port_name.c_str());
if (!m_portsOrch->getPort(port_name, port))
if (!gPortsOrch->getPort(port_name, port))
{
SWSS_LOG_ERROR("Port with alias:%s not found\n", port_name.c_str());
return task_process_status::task_invalid_entry;
Expand Down Expand Up @@ -459,7 +460,7 @@ task_process_status BufferOrch::processIngressBufferProfileList(Consumer &consum
attr.value.objlist.list = profile_list.data();
for (string port_name : port_names)
{
if (!m_portsOrch->getPort(port_name, port))
if (!gPortsOrch->getPort(port_name, port))
{
SWSS_LOG_ERROR("Port with alias:%s not found\n", port_name.c_str());
return task_process_status::task_invalid_entry;
Expand Down Expand Up @@ -505,7 +506,7 @@ task_process_status BufferOrch::processEgressBufferProfileList(Consumer &consume
attr.value.objlist.list = profile_list.data();
for (string port_name : port_names)
{
if (!m_portsOrch->getPort(port_name, port))
if (!gPortsOrch->getPort(port_name, port))
{
SWSS_LOG_ERROR("Port with alias:%s not found\n", port_name.c_str());
return task_process_status::task_invalid_entry;
Expand All @@ -523,10 +524,6 @@ task_process_status BufferOrch::processEgressBufferProfileList(Consumer &consume
void BufferOrch::doTask(Consumer &consumer)
{
SWSS_LOG_ENTER();
if (!m_portsOrch->isInitDone())
{
return;
}
auto it = consumer.m_toSync.begin();
while (it != consumer.m_toSync.end())
{
Expand Down
3 changes: 1 addition & 2 deletions orchagent/bufferorch.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const string buffer_profile_list_field_name = "profile_list";
class BufferOrch : public Orch
{
public:
BufferOrch(DBConnector *db, vector<string> &tableNames, PortsOrch *portsOrch);
BufferOrch(DBConnector *db, vector<string> &tableNames);
static type_map m_buffer_type_maps;
private:
typedef task_process_status (BufferOrch::*buffer_table_handler)(Consumer& consumer);
Expand All @@ -39,7 +39,6 @@ class BufferOrch : public Orch
task_process_status processIngressBufferProfileList(Consumer &consumer);
task_process_status processEgressBufferProfileList(Consumer &consumer);

PortsOrch *m_portsOrch;
buffer_table_handler_map m_bufferHandlerMap;
};
#endif /* SWSS_BUFFORCH_H */
Expand Down
Loading

0 comments on commit 4ae09c7

Please sign in to comment.