Skip to content

Commit

Permalink
Enable FEC statistics collection for Ethernet ports (sonic-net#1994)
Browse files Browse the repository at this point in the history
  • Loading branch information
prgeor committed Nov 2, 2021
1 parent 9f30ca1 commit e92c1df
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions orchagent/portsorch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,10 @@ const vector<sai_port_stat_t> port_stat_ids =
SAI_PORT_STAT_ETHER_STATS_JABBERS,
SAI_PORT_STAT_ETHER_STATS_FRAGMENTS,
SAI_PORT_STAT_ETHER_STATS_UNDERSIZE_PKTS,
SAI_PORT_STAT_IP_IN_RECEIVES
SAI_PORT_STAT_IP_IN_RECEIVES,
SAI_PORT_STAT_IF_IN_FEC_CORRECTABLE_FRAMES,
SAI_PORT_STAT_IF_IN_FEC_NOT_CORRECTABLE_FRAMES,
SAI_PORT_STAT_IF_IN_FEC_SYMBOL_ERRORS
};

const vector<sai_port_stat_t> port_buffer_drop_stat_ids =
Expand Down Expand Up @@ -4655,7 +4658,7 @@ bool PortsOrch::addVlanFloodGroups(Port &vlan, Port &port, string end_point_ip)
if (vlan.m_vlan_info.l2mc_group_id == SAI_NULL_OBJECT_ID)
{
status = sai_l2mc_group_api->create_l2mc_group(&l2mc_group_id, gSwitchId, 0, NULL);
if (status != SAI_STATUS_SUCCESS)
if (status != SAI_STATUS_SUCCESS)
{
SWSS_LOG_ERROR("Failed to create l2mc flood group");
return false;
Expand All @@ -4669,7 +4672,7 @@ bool PortsOrch::addVlanFloodGroups(Port &vlan, Port &port, string end_point_ip)
status = sai_vlan_api->set_vlan_attribute(vlan.m_vlan_info.vlan_oid, &attr);
if (status != SAI_STATUS_SUCCESS)
{
SWSS_LOG_ERROR("Failed to set l2mc group %" PRIx64
SWSS_LOG_ERROR("Failed to set l2mc group %" PRIx64
" to vlan %hu for unknown unicast flooding",
l2mc_group_id, vlan.m_vlan_info.vlan_id);
return false;
Expand All @@ -4684,15 +4687,15 @@ bool PortsOrch::addVlanFloodGroups(Port &vlan, Port &port, string end_point_ip)
if (status != SAI_STATUS_SUCCESS)
{
SWSS_LOG_ERROR("Failed to set l2mc group %" PRIx64
" to vlan %hu for broadcast flooding",
" to vlan %hu for broadcast flooding",
l2mc_group_id, vlan.m_vlan_info.vlan_id);
return false;
}
}
vlan.m_vlan_info.l2mc_group_id = l2mc_group_id;
m_portList[vlan.m_alias] = vlan;
}

vector<sai_attribute_t> attrs;
attr.id = SAI_L2MC_GROUP_MEMBER_ATTR_L2MC_GROUP_ID;
attr.value.oid = vlan.m_vlan_info.l2mc_group_id;
Expand Down Expand Up @@ -4740,10 +4743,10 @@ bool PortsOrch::removeVlanEndPointIp(Port &vlan, Port &port, string end_point_ip
SWSS_LOG_ENTER();

sai_status_t status;

if(vlan.m_vlan_info.l2mc_members.find(end_point_ip) == vlan.m_vlan_info.l2mc_members.end())
{
SWSS_LOG_NOTICE("End point ip %s is not part of vlan %hu",
SWSS_LOG_NOTICE("End point ip %s is not part of vlan %hu",
end_point_ip.c_str(), vlan.m_vlan_info.vlan_id);
return true;
}
Expand All @@ -4759,7 +4762,7 @@ bool PortsOrch::removeVlanEndPointIp(Port &vlan, Port &port, string end_point_ip
vlan.m_vlan_info.l2mc_members.erase(end_point_ip);
sai_object_id_t l2mc_group_id = SAI_NULL_OBJECT_ID;
sai_attribute_t attr;

if (vlan.m_vlan_info.l2mc_members.empty())
{
if (vlan.m_vlan_info.uuc_flood_type == SAI_VLAN_FLOOD_CONTROL_TYPE_COMBINED)
Expand All @@ -4770,7 +4773,7 @@ bool PortsOrch::removeVlanEndPointIp(Port &vlan, Port &port, string end_point_ip
status = sai_vlan_api->set_vlan_attribute(vlan.m_vlan_info.vlan_oid, &attr);
if (status != SAI_STATUS_SUCCESS)
{
SWSS_LOG_ERROR("Failed to set null l2mc group "
SWSS_LOG_ERROR("Failed to set null l2mc group "
" to vlan %hu for unknown unicast flooding",
vlan.m_vlan_info.vlan_id);
return false;
Expand All @@ -4796,7 +4799,7 @@ bool PortsOrch::removeVlanEndPointIp(Port &vlan, Port &port, string end_point_ip
if (status != SAI_STATUS_SUCCESS)
{
SWSS_LOG_ERROR("Failed to set null l2mc group "
" to vlan %hu for broadcast flooding",
" to vlan %hu for broadcast flooding",
vlan.m_vlan_info.vlan_id);
return false;
}
Expand Down

0 comments on commit e92c1df

Please sign in to comment.