Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[EVPN]Fix fpmsyncd exit when EVPN type5 is received with bgp fib suppression enabled #37

Closed
wants to merge 8 commits into from
35 changes: 17 additions & 18 deletions cfgmgr/buffermgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -549,24 +549,23 @@ void BufferMgr::doTask(Consumer &consumer)
task_status = doSpeedUpdateTask(port);
}
}

switch (task_status)
{
case task_process_status::task_failed:
SWSS_LOG_ERROR("Failed to process table update");
return;
case task_process_status::task_need_retry:
SWSS_LOG_INFO("Unable to process table update. Will retry...");
++it;
break;
case task_process_status::task_invalid_entry:
SWSS_LOG_ERROR("Failed to process invalid entry, drop it");
it = consumer.m_toSync.erase(it);
break;
default:
it = consumer.m_toSync.erase(it);
break;
}
}
switch (task_status)
{
case task_process_status::task_failed:
SWSS_LOG_ERROR("Failed to process table update");
return;
case task_process_status::task_need_retry:
SWSS_LOG_INFO("Unable to process table update. Will retry...");
++it;
break;
case task_process_status::task_invalid_entry:
SWSS_LOG_ERROR("Failed to process invalid entry, drop it");
it = consumer.m_toSync.erase(it);
break;
default:
it = consumer.m_toSync.erase(it);
break;
}
}
}
10 changes: 6 additions & 4 deletions cfgmgr/coppmgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,11 @@ static set<string> g_copp_init_set;

void CoppMgr::parseInitFile(void)
{
std::ifstream ifs(COPP_INIT_FILE);
std::ifstream ifs(m_coppCfgfile);

if (ifs.fail())
{
SWSS_LOG_ERROR("COPP init file %s not found", COPP_INIT_FILE);
SWSS_LOG_ERROR("COPP init file %s not found", m_coppCfgfile.c_str());
return;
}
json j = json::parse(ifs);
Expand Down Expand Up @@ -293,15 +294,16 @@ bool CoppMgr::isDupEntry(const std::string &key, std::vector<FieldValueTuple> &f
return true;
}

CoppMgr::CoppMgr(DBConnector *cfgDb, DBConnector *appDb, DBConnector *stateDb, const vector<string> &tableNames) :
CoppMgr::CoppMgr(DBConnector *cfgDb, DBConnector *appDb, DBConnector *stateDb, const vector<string> &tableNames, const string copp_init_file) :
Orch(cfgDb, tableNames),
m_cfgCoppTrapTable(cfgDb, CFG_COPP_TRAP_TABLE_NAME),
m_cfgCoppGroupTable(cfgDb, CFG_COPP_GROUP_TABLE_NAME),
m_cfgFeatureTable(cfgDb, CFG_FEATURE_TABLE_NAME),
m_appCoppTable(appDb, APP_COPP_TABLE_NAME),
m_stateCoppTrapTable(stateDb, STATE_COPP_TRAP_TABLE_NAME),
m_stateCoppGroupTable(stateDb, STATE_COPP_GROUP_TABLE_NAME),
m_coppTable(appDb, APP_COPP_TABLE_NAME)
m_coppTable(appDb, APP_COPP_TABLE_NAME),
m_coppCfgfile(copp_init_file)
{
SWSS_LOG_ENTER();
parseInitFile();
Expand Down
3 changes: 2 additions & 1 deletion cfgmgr/coppmgr.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ class CoppMgr : public Orch
{
public:
CoppMgr(DBConnector *cfgDb, DBConnector *appDb, DBConnector *stateDb,
const std::vector<std::string> &tableNames);
const std::vector<std::string> &tableNames, const std::string copp_init_file = COPP_INIT_FILE);

using Orch::doTask;
private:
Expand All @@ -75,6 +75,7 @@ class CoppMgr : public Orch
CoppCfg m_coppGroupInitCfg;
CoppCfg m_coppTrapInitCfg;
CoppCfg m_featuresCfgTable;
std::string m_coppCfgfile;


void doTask(Consumer &consumer);
Expand Down
8 changes: 6 additions & 2 deletions fpmsyncd/routesync.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -465,6 +465,7 @@ void RouteSync::onEvpnRouteMsg(struct nlmsghdr *h, int len)
inet_ntop(rtm->rtm_family, dstaddr, buf, MAX_ADDR_SIZE), dst_len);
}

auto proto_str = getProtocolString(rtm->rtm_protocol);
SWSS_LOG_INFO("Receive route message dest ip prefix: %s Op:%s",
destipprefix,
nlmsg_type == RTM_NEWROUTE ? "add":"del");
Expand Down Expand Up @@ -550,17 +551,20 @@ void RouteSync::onEvpnRouteMsg(struct nlmsghdr *h, int len)
FieldValueTuple intf("ifname", intf_list);
FieldValueTuple vni("vni_label", vni_list);
FieldValueTuple mac("router_mac", mac_list);
FieldValueTuple proto("protocol", proto_str);

fvVector.push_back(nh);
fvVector.push_back(intf);
fvVector.push_back(vni);
fvVector.push_back(mac);
fvVector.push_back(proto);

if (!warmRestartInProgress)
{
m_routeTable.set(destipprefix, fvVector);
SWSS_LOG_DEBUG("RouteTable set msg: %s vtep:%s vni:%s mac:%s intf:%s",
destipprefix, nexthops.c_str(), vni_list.c_str(), mac_list.c_str(), intf_list.c_str());
SWSS_LOG_DEBUG("RouteTable set msg: %s vtep:%s vni:%s mac:%s intf:%s protocol:%s",
destipprefix, nexthops.c_str(), vni_list.c_str(), mac_list.c_str(), intf_list.c_str(),
proto_str.c_str());
}

/*
Expand Down
2 changes: 1 addition & 1 deletion fpmsyncd/routesync.h
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ class RouteSync : public NetMsg
string& mac_list, string& intf_list,
string rmac, string vlan_id);

bool getEvpnNextHop(struct nlmsghdr *h, int received_bytes, struct rtattr *tb[],
virtual bool getEvpnNextHop(struct nlmsghdr *h, int received_bytes, struct rtattr *tb[],
string& nexthops, string& vni_list, string& mac_list,
string& intf_list);

Expand Down
3 changes: 2 additions & 1 deletion orchagent/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,8 @@ orchagent_SOURCES = \
dash/dashaclorch.cpp \
dash/dashaclgroupmgr.cpp \
dash/dashtagmgr.cpp \
dash/pbutils.cpp
dash/pbutils.cpp \
twamporch.cpp

orchagent_SOURCES += flex_counter/flex_counter_manager.cpp flex_counter/flex_counter_stat_manager.cpp flex_counter/flow_counter_handler.cpp flex_counter/flowcounterrouteorch.cpp
orchagent_SOURCES += debug_counter/debug_counter.cpp debug_counter/drop_counter.cpp
Expand Down
2 changes: 0 additions & 2 deletions orchagent/aclorch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3223,7 +3223,6 @@ void AclOrch::initDefaultTableTypes()
.withMatch(make_shared<AclTableMatch>(SAI_ACL_TABLE_ATTR_FIELD_L4_SRC_PORT))
.withMatch(make_shared<AclTableMatch>(SAI_ACL_TABLE_ATTR_FIELD_L4_DST_PORT))
.withMatch(make_shared<AclTableMatch>(SAI_ACL_TABLE_ATTR_FIELD_TCP_FLAGS))
.withMatch(make_shared<AclTableMatch>(SAI_ACL_TABLE_ATTR_FIELD_IN_PORTS))
.build()
);

Expand All @@ -3241,7 +3240,6 @@ void AclOrch::initDefaultTableTypes()
.withMatch(make_shared<AclTableMatch>(SAI_ACL_TABLE_ATTR_FIELD_L4_SRC_PORT))
.withMatch(make_shared<AclTableMatch>(SAI_ACL_TABLE_ATTR_FIELD_L4_DST_PORT))
.withMatch(make_shared<AclTableMatch>(SAI_ACL_TABLE_ATTR_FIELD_TCP_FLAGS))
.withMatch(make_shared<AclTableMatch>(SAI_ACL_TABLE_ATTR_FIELD_IN_PORTS))
.build()
);

Expand Down
19 changes: 14 additions & 5 deletions orchagent/crmorch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ const map<CrmResourceType, string> crmResTypeNameMap =
{ CrmResourceType::CRM_DASH_IPV6_ACL_GROUP, "DASH_IPV6_ACL_GROUP" },
{ CrmResourceType::CRM_DASH_IPV4_ACL_RULE, "DASH_IPV4_ACL_RULE" },
{ CrmResourceType::CRM_DASH_IPV6_ACL_RULE, "DASH_IPV6_ACL_RULE" },
{ CrmResourceType::CRM_TWAMP_ENTRY, "TWAMP_ENTRY" }
};

const map<CrmResourceType, uint32_t> crmResSaiAvailAttrMap =
Expand All @@ -84,6 +85,7 @@ const map<CrmResourceType, uint32_t> crmResSaiAvailAttrMap =
{ CrmResourceType::CRM_IPMC_ENTRY, SAI_SWITCH_ATTR_AVAILABLE_IPMC_ENTRY},
{ CrmResourceType::CRM_SNAT_ENTRY, SAI_SWITCH_ATTR_AVAILABLE_SNAT_ENTRY },
{ CrmResourceType::CRM_DNAT_ENTRY, SAI_SWITCH_ATTR_AVAILABLE_DNAT_ENTRY },
{ CrmResourceType::CRM_TWAMP_ENTRY, SAI_SWITCH_ATTR_AVAILABLE_TWAMP_SESSION }
};

const map<CrmResourceType, sai_object_type_t> crmResSaiObjAttrMap =
Expand Down Expand Up @@ -125,6 +127,7 @@ const map<CrmResourceType, sai_object_type_t> crmResSaiObjAttrMap =
{ CrmResourceType::CRM_DASH_IPV6_ACL_GROUP, (sai_object_type_t)SAI_OBJECT_TYPE_DASH_ACL_GROUP },
{ CrmResourceType::CRM_DASH_IPV4_ACL_RULE, (sai_object_type_t)SAI_OBJECT_TYPE_DASH_ACL_RULE },
{ CrmResourceType::CRM_DASH_IPV6_ACL_RULE, (sai_object_type_t)SAI_OBJECT_TYPE_DASH_ACL_RULE },
{ CrmResourceType::CRM_TWAMP_ENTRY, SAI_OBJECT_TYPE_NULL }
};

const map<CrmResourceType, sai_attr_id_t> crmResAddrFamilyAttrMap =
Expand Down Expand Up @@ -185,7 +188,8 @@ const map<string, CrmResourceType> crmThreshTypeResMap =
{ "dash_ipv4_acl_group_threshold_type", CrmResourceType::CRM_DASH_IPV4_ACL_GROUP },
{ "dash_ipv6_acl_group_threshold_type", CrmResourceType::CRM_DASH_IPV6_ACL_GROUP },
{ "dash_ipv4_acl_rule_threshold_type", CrmResourceType::CRM_DASH_IPV4_ACL_RULE },
{ "dash_ipv6_acl_rule_threshold_type", CrmResourceType::CRM_DASH_IPV6_ACL_RULE }
{ "dash_ipv6_acl_rule_threshold_type", CrmResourceType::CRM_DASH_IPV6_ACL_RULE },
{ "twamp_entry_threshold_type", CrmResourceType::CRM_TWAMP_ENTRY }
};

const map<string, CrmResourceType> crmThreshLowResMap =
Expand Down Expand Up @@ -226,7 +230,8 @@ const map<string, CrmResourceType> crmThreshLowResMap =
{ "dash_ipv4_acl_group_low_threshold", CrmResourceType::CRM_DASH_IPV4_ACL_GROUP },
{ "dash_ipv6_acl_group_low_threshold", CrmResourceType::CRM_DASH_IPV6_ACL_GROUP },
{ "dash_ipv4_acl_rule_low_threshold", CrmResourceType::CRM_DASH_IPV4_ACL_RULE },
{ "dash_ipv6_acl_rule_low_threshold", CrmResourceType::CRM_DASH_IPV6_ACL_RULE }
{ "dash_ipv6_acl_rule_low_threshold", CrmResourceType::CRM_DASH_IPV6_ACL_RULE },
{ "twamp_entry_low_threshold", CrmResourceType::CRM_TWAMP_ENTRY }
};

const map<string, CrmResourceType> crmThreshHighResMap =
Expand Down Expand Up @@ -267,7 +272,8 @@ const map<string, CrmResourceType> crmThreshHighResMap =
{ "dash_ipv4_acl_group_high_threshold", CrmResourceType::CRM_DASH_IPV4_ACL_GROUP },
{ "dash_ipv6_acl_group_high_threshold", CrmResourceType::CRM_DASH_IPV6_ACL_GROUP },
{ "dash_ipv4_acl_rule_high_threshold", CrmResourceType::CRM_DASH_IPV4_ACL_RULE },
{ "dash_ipv6_acl_rule_high_threshold", CrmResourceType::CRM_DASH_IPV6_ACL_RULE }
{ "dash_ipv6_acl_rule_high_threshold", CrmResourceType::CRM_DASH_IPV6_ACL_RULE },
{ "twamp_entry_high_threshold", CrmResourceType::CRM_TWAMP_ENTRY }
};

const map<string, CrmThresholdType> crmThreshTypeMap =
Expand Down Expand Up @@ -315,7 +321,8 @@ const map<string, CrmResourceType> crmAvailCntsTableMap =
{ "crm_stats_dash_ipv4_acl_group_available", CrmResourceType::CRM_DASH_IPV4_ACL_GROUP },
{ "crm_stats_dash_ipv6_acl_group_available", CrmResourceType::CRM_DASH_IPV6_ACL_GROUP },
{ "crm_stats_dash_ipv4_acl_rule_available", CrmResourceType::CRM_DASH_IPV4_ACL_RULE },
{ "crm_stats_dash_ipv6_acl_rule_available", CrmResourceType::CRM_DASH_IPV6_ACL_RULE }
{ "crm_stats_dash_ipv6_acl_rule_available", CrmResourceType::CRM_DASH_IPV6_ACL_RULE },
{ "crm_stats_twamp_entry_available", CrmResourceType::CRM_TWAMP_ENTRY }
};

const map<string, CrmResourceType> crmUsedCntsTableMap =
Expand Down Expand Up @@ -356,7 +363,8 @@ const map<string, CrmResourceType> crmUsedCntsTableMap =
{ "crm_stats_dash_ipv4_acl_group_used", CrmResourceType::CRM_DASH_IPV4_ACL_GROUP },
{ "crm_stats_dash_ipv6_acl_group_used", CrmResourceType::CRM_DASH_IPV6_ACL_GROUP },
{ "crm_stats_dash_ipv4_acl_rule_used", CrmResourceType::CRM_DASH_IPV4_ACL_RULE },
{ "crm_stats_dash_ipv6_acl_rule_used", CrmResourceType::CRM_DASH_IPV6_ACL_RULE }
{ "crm_stats_dash_ipv6_acl_rule_used", CrmResourceType::CRM_DASH_IPV6_ACL_RULE },
{ "crm_stats_twamp_entry_used", CrmResourceType::CRM_TWAMP_ENTRY },
};

CrmOrch::CrmOrch(DBConnector *db, string tableName):
Expand Down Expand Up @@ -877,6 +885,7 @@ void CrmOrch::getResAvailableCounters()
case CrmResourceType::CRM_DASH_IPV6_OUTBOUND_CA_TO_PA:
case CrmResourceType::CRM_DASH_IPV4_ACL_GROUP:
case CrmResourceType::CRM_DASH_IPV6_ACL_GROUP:
case CrmResourceType::CRM_TWAMP_ENTRY:
{
getResAvailability(res.first, res.second);
break;
Expand Down
3 changes: 2 additions & 1 deletion orchagent/crmorch.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ enum class CrmResourceType
CRM_DASH_IPV4_ACL_GROUP,
CRM_DASH_IPV6_ACL_GROUP,
CRM_DASH_IPV4_ACL_RULE,
CRM_DASH_IPV6_ACL_RULE
CRM_DASH_IPV6_ACL_RULE,
CRM_TWAMP_ENTRY
};

enum class CrmThresholdType
Expand Down
37 changes: 4 additions & 33 deletions orchagent/neighorch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1385,7 +1385,7 @@ void NeighOrch::doVoqSystemNeighTask(Consumer &consumer)
continue;
}

MacAddress mac_address;
MacAddress mac_address, original_mac_address;
uint32_t encap_index = 0;
for (auto i = kfvFieldsValues(t).begin();
i != kfvFieldsValues(t).end(); i++)
Expand Down Expand Up @@ -1465,42 +1465,13 @@ void NeighOrch::doVoqSystemNeighTask(Consumer &consumer)
//kernel programming.
if(ibif.m_type != Port::VLAN)
{
original_mac_address = mac_address;
mac_address = gMacAddress;

// For VS platforms, the mac of the static neigh should not be same as asic's own mac.
// This is because host originated packets will have same mac for both src and dst which
// will result in host NOT sending packet out. To address this problem which is specific
// to port type inband interfaces, set the mac to the neighbor's owner asic's mac. Since
// the owner asic's mac is not readily avaiable here, the owner asic mac is derived from
// the switch id and lower 5 bytes of asic mac which is assumed to be same for all asics
// in the VS system.
// Therefore to make VOQ chassis systems work in VS platform based setups like the setups
// using KVMs, it is required that all asics have same base mac in the format given below
// <lower 5 bytes of mac same for all asics>:<6th byte = switch_id>

string platform = getenv("ASIC_VENDOR") ? getenv("ASIC_VENDOR") : "";

// For VS platform, use the original MAC address
if (platform == VS_PLATFORM_SUBSTRING)
{
int8_t sw_id = -1;
uint8_t egress_asic_mac[ETHER_ADDR_LEN];

gMacAddress.getMac(egress_asic_mac);

if (p.m_type == Port::LAG)
{
sw_id = (int8_t) p.m_system_lag_info.switch_id;
}
else if (p.m_type == Port::PHY || p.m_type == Port::SYSTEM)
{
sw_id = (int8_t) p.m_system_port_info.switch_id;
}

if(sw_id != -1)
{
egress_asic_mac[5] = sw_id;
mac_address = MacAddress(egress_asic_mac);
}
mac_address = original_mac_address;
}
}
vector<FieldValueTuple> fvVector;
Expand Down
6 changes: 6 additions & 0 deletions orchagent/notifications.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,12 @@ void on_bfd_session_state_change(uint32_t count, sai_bfd_session_state_notificat
// which causes concurrency access to the DB
}

void on_twamp_session_event(uint32_t count, sai_twamp_session_event_notification_data_t *data)
{
// don't use this event handler, because it runs by libsairedis in a separate thread
// which causes concurrency access to the DB
}

void on_switch_shutdown_request(sai_object_id_t switch_id)
{
SWSS_LOG_ENTER();
Expand Down
1 change: 1 addition & 0 deletions orchagent/notifications.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ extern "C" {
void on_fdb_event(uint32_t count, sai_fdb_event_notification_data_t *data);
void on_port_state_change(uint32_t count, sai_port_oper_status_notification_t *data);
void on_bfd_session_state_change(uint32_t count, sai_bfd_session_state_notification_t *data);
void on_twamp_session_event(uint32_t count, sai_twamp_session_event_notification_data_t *data);

// The function prototype information can be found here:
// https://github.com/sonic-net/sonic-sairedis/blob/master/meta/NotificationSwitchShutdownRequest.cpp#L49
Expand Down
5 changes: 5 additions & 0 deletions orchagent/orchdaemon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -727,6 +727,11 @@ bool OrchDaemon::init()
gP4Orch = new P4Orch(m_applDb, p4rt_tables, vrf_orch, gCoppOrch);
m_orchList.push_back(gP4Orch);

TableConnector confDbTwampTable(m_configDb, CFG_TWAMP_SESSION_TABLE_NAME);
TableConnector stateDbTwampTable(m_stateDb, STATE_TWAMP_SESSION_TABLE_NAME);
TwampOrch *twamp_orch = new TwampOrch(confDbTwampTable, stateDbTwampTable, gSwitchOrch, gPortsOrch, vrf_orch);
m_orchList.push_back(twamp_orch);

if (WarmStart::isWarmStart())
{
bool suc = warmRestoreAndSyncUp();
Expand Down
1 change: 1 addition & 0 deletions orchagent/orchdaemon.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
#include "bfdorch.h"
#include "srv6orch.h"
#include "nvgreorch.h"
#include "twamporch.h"
#include "dash/dashaclorch.h"
#include "dash/dashorch.h"
#include "dash/dashrouteorch.h"
Expand Down
5 changes: 3 additions & 2 deletions orchagent/p4orch/acl_rule_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
#include "crmorch.h"
#include "dbconnector.h"
#include "intfsorch.h"
#include <nlohmann/json.hpp>
#include "logger.h"
#include "orch.h"
#include "p4orch.h"
Expand All @@ -18,6 +17,7 @@
#include "sai_serialize.h"
#include "table.h"
#include "tokenize.h"
#include <nlohmann/json.hpp>
extern "C"
{
#include "sai.h"
Expand Down Expand Up @@ -165,7 +165,8 @@ std::vector<sai_attribute_t> getMeterSaiAttrs(const P4AclMeter &p4_acl_meter)

} // namespace

ReturnCode AclRuleManager::getSaiObject(const std::string &json_key, sai_object_type_t &object_type, std::string &object_key)
ReturnCode AclRuleManager::getSaiObject(const std::string &json_key, sai_object_type_t &object_type,
std::string &object_key)
{
return StatusCode::SWSS_RC_UNIMPLEMENTED;
}
Expand Down
3 changes: 2 additions & 1 deletion orchagent/p4orch/acl_rule_manager.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ class AclRuleManager : public ObjectManagerInterface
void enqueue(const std::string &table_name, const swss::KeyOpFieldsValuesTuple &entry) override;
void drain() override;
std::string verifyState(const std::string &key, const std::vector<swss::FieldValueTuple> &tuple) override;
ReturnCode getSaiObject(const std::string &json_key, sai_object_type_t &object_type, std::string &object_key) override;
ReturnCode getSaiObject(const std::string &json_key, sai_object_type_t &object_type,
std::string &object_key) override;

// Update counters stats for every rule in each ACL table in COUNTERS_DB, if
// counters are enabled in rules.
Expand Down
Loading
Loading