Skip to content

Commit

Permalink
Add host_tx_ready enhancements
Browse files Browse the repository at this point in the history
  • Loading branch information
noaOrMlnx committed Oct 11, 2023
1 parent 3599635 commit 7ea6a2d
Show file tree
Hide file tree
Showing 7 changed files with 261 additions and 9 deletions.
4 changes: 4 additions & 0 deletions orchagent/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -505,6 +505,10 @@ int main(int argc, char **argv)
attr.value.ptr = (void *)on_switch_shutdown_request;
attrs.push_back(attr);

attr.id = SAI_SWITCH_ATTR_PORT_HOST_TX_READY_NOTIFY;
attr.value.ptr = (void *)on_port_host_tx_ready;
attrs.push_back(attr);

if (gMySwitchType != "fabric" && gMacAddress)
{
attr.id = SAI_SWITCH_ATTR_SRC_MAC_ADDRESS;
Expand Down
6 changes: 6 additions & 0 deletions orchagent/notifications.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,9 @@ void on_switch_shutdown_request(sai_object_id_t switch_id)

exit(EXIT_FAILURE);
}

void on_port_host_tx_ready(sai_object_id_t switch_id, sai_object_id_t port_id, sai_port_host_tx_ready_status_t m_portHostTxReadyStatus)
{
// don't use this event handler, because it runs by libsairedis in a separate thread
// which causes concurrency access to the DB
}
1 change: 1 addition & 0 deletions orchagent/notifications.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ void on_bfd_session_state_change(uint32_t count, sai_bfd_session_state_notificat
// The function prototype information can be found here:
// https://github.com/sonic-net/sonic-sairedis/blob/master/meta/NotificationSwitchShutdownRequest.cpp#L49
void on_switch_shutdown_request(sai_object_id_t switch_id);
void on_port_host_tx_ready(sai_object_id_t switch_id, sai_object_id_t port_id, sai_port_host_tx_ready_status_t m_portHostTxReadyStatus);
3 changes: 3 additions & 0 deletions orchagent/orch.h
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,7 @@ typedef enum

typedef std::pair<swss::DBConnector *, std::string> TableConnector;
typedef std::pair<swss::DBConnector *, std::vector<std::string>> TablesConnector;
typedef std::pair<swss::DBConnector *, const std::vector<table_name_with_pri_t> &> PriTablesConnector;

class Orch
{
Expand All @@ -222,6 +223,8 @@ class Orch
Orch(swss::DBConnector *db, const std::vector<std::string> &tableNames);
Orch(swss::DBConnector *db, const std::vector<table_name_with_pri_t> &tableNameWithPri);
Orch(const std::vector<TableConnector>& tables);
Orch(const std::vector<PriTablesConnector> &dbsTablesWithPri);

virtual ~Orch() = default;

std::vector<swss::Selectable*> getSelectables();
Expand Down
18 changes: 16 additions & 2 deletions orchagent/orchdaemon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -134,13 +134,27 @@ bool OrchDaemon::init()
{ APP_LAG_MEMBER_TABLE_NAME, portsorch_base_pri }
};

vector<table_name_with_pri_t> state_transceiver_tables = {
{STATE_TRANSCEIVER_INFO_TABLE_NAME, portsorch_base_pri}
};

// PriTablesConnector appPriTables(m_applDb, ports_tables);
// PriTablesConnector statePriTables(m_stateDb, state_transceiver_tables);

// vector<PriTablesConnector> portsOrchTables = {
// appPriTables,
// statePriTables
// };

gPortsOrch = new PortsOrch(m_applDb, m_stateDb, ports_tables, m_chassisAppDb);
// gPortsOrch = new PortsOrch(m_applDb, m_stateDb, portsOrchTables, m_chassisAppDb);

vector<table_name_with_pri_t> app_fdb_tables = {
{ APP_FDB_TABLE_NAME, FdbOrch::fdborch_pri},
{ APP_VXLAN_FDB_TABLE_NAME, FdbOrch::fdborch_pri},
{ APP_MCLAG_FDB_TABLE_NAME, FdbOrch::fdborch_pri}
};

gPortsOrch = new PortsOrch(m_applDb, m_stateDb, ports_tables, m_chassisAppDb);
TableConnector stateDbFdb(m_stateDb, STATE_FDB_TABLE_NAME);
TableConnector stateMclagDbFdb(m_stateDb, STATE_MCLAG_REMOTE_FDB_TABLE_NAME);
gFdbOrch = new FdbOrch(m_applDb, app_fdb_tables, stateDbFdb, stateMclagDbFdb, gPortsOrch);
Expand Down Expand Up @@ -173,7 +187,7 @@ bool OrchDaemon::init()
gDirectory.set(vnet_rt_orch);
VRFOrch *vrf_orch = new VRFOrch(m_applDb, APP_VRF_TABLE_NAME, m_stateDb, STATE_VRF_OBJECT_TABLE_NAME);
gDirectory.set(vrf_orch);
gMonitorOrch = new MonitorOrch(m_stateDb, STATE_VNET_MONITOR_TABLE_NAME);
gMonitorOrch = new MonitorOrch(m_stateDb, STATE_VNET_MONITOR_TABLE_NAME);
gDirectory.set(gMonitorOrch);

const vector<string> chassis_frontend_tables = {
Expand Down
Loading

0 comments on commit 7ea6a2d

Please sign in to comment.