[sonic-swss] Add support for COPP#57
Conversation
orchagent/copporch.cpp
Outdated
| { | ||
| attr.id = SAI_HOSTIF_TRAP_GROUP_ATTR_POLICER; | ||
| attr.value.oid = SAI_NULL_OBJECT_ID; | ||
| if (SAI_STATUS_SUCCESS != (sai_status = sai_hostif_api->get_trap_group_attribute(m_trap_map[key], 1, &attr))) |
There was a problem hiding this comment.
It is not necessary to use get api to retrieve the trap group ID from the SAI as you know if you have created the trap group or not, and should cache the trap group ID. In the orchagent, we should not use get API unless we have to. For example, the hw_lane ID, number of ports, and etc. on. Everything else should be cached in the orchagent.
|
@hrachya-mellanox , @stcheng |
cd83e3e to
da52cc9
Compare
|
I've addressed Guohan's comments:
|
| SWSS_LOG_DEBUG("trap group name:%s:", key.c_str()); | ||
| if (m_trap_group_map.find(key) == m_trap_group_map.end()) | ||
| { | ||
| return SAI_NULL_OBJECT_ID; |
There was a problem hiding this comment.
SAI error codes shall only be returned in the SAI implementation not here.
There was a problem hiding this comment.
This is 'null' value, not error code. it's used by caller function to detect whether there is cached object.
There was a problem hiding this comment.
I see. So my suggestion is that similar to the neighorch.h, we will have a hasPolicer() function and getPolicerId() function, which seems to be clearer.
da52cc9 to
1650e0e
Compare
|
In portsOrch.cpp, line 42 - line 72, should be moved to in this copp orch |
orchagent/copporch.cpp
Outdated
| void CoppOrch::getTrapIdList(vector<string> &trap_id_name_list, vector<sai_hostif_trap_id_t> &trap_id_list) const | ||
| { | ||
| SWSS_LOG_ENTER(); | ||
| for(auto trap_id_str : trap_id_name_list) |
There was a problem hiding this comment.
leave a space between for and '(', make this consistent across the code.
Signed-off-by: hrachya@mellanox.com