-
Notifications
You must be signed in to change notification settings - Fork 274
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
Add support of mdio access using sai switch api and unix socket IPC s… #1071
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,6 +15,10 @@ sai_object_id_t gSwitchId = SAI_NULL_OBJECT_ID; | |
|
||
#endif | ||
|
||
#ifdef MDIO_ACCESS_USE_NPU | ||
sai_object_id_t mdioSwitchId = SAI_NULL_OBJECT_ID; | ||
#endif | ||
|
||
void GlobalSwitchId::setSwitchId( | ||
_In_ sai_object_id_t switchRid) | ||
{ | ||
|
@@ -33,4 +37,10 @@ void GlobalSwitchId::setSwitchId( | |
sai_serialize_object_id(gSwitchId).c_str()); | ||
#endif | ||
|
||
#ifdef MDIO_ACCESS_USE_NPU | ||
if (mdioSwitchId == SAI_NULL_OBJECT_ID) | ||
{ | ||
mdioSwitchId = switchRid; | ||
} | ||
#endif | ||
Comment on lines
+40
to
+45
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this mdioSwitchId needs to be passed to this class that you will create in the constructor, then remove global definition |
||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4472,6 +4472,11 @@ static void timerWatchdogCallback( | |
SWSS_LOG_ERROR("main loop execution exceeded %ld ms", span/1000); | ||
} | ||
|
||
#ifdef MDIO_ACCESS_USE_NPU | ||
extern int startIpcMdioProcessingThread(sai_switch_api_t *sai_switch_api); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. don'y pass sai_switch_api, since this suggest that you may call some create functions and it will get out of sync with redisdb There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. those functions needs to be object methods There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. you can pass std::shared_ptr as api |
||
extern void stopIpcMdioProcessingThread(void); | ||
#endif | ||
|
||
Comment on lines
+4475
to
+4479
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. move this to separate file |
||
void Syncd::run() | ||
{ | ||
SWSS_LOG_ENTER(); | ||
|
@@ -4494,6 +4499,13 @@ void Syncd::run() | |
// notification queue is created before we create switch | ||
m_processor->startNotificationsProcessingThread(); | ||
|
||
#ifdef MDIO_ACCESS_USE_NPU | ||
if (m_commandLineOptions->m_globalContext == 0) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. do you need explicit context context zero here? |
||
{ | ||
startIpcMdioProcessingThread(sai_metadata_sai_switch_api); | ||
} | ||
#endif | ||
|
||
SWSS_LOG_NOTICE("syncd listening for events"); | ||
|
||
s->addSelectable(m_selectableChannel.get()); | ||
|
@@ -4678,6 +4690,13 @@ void Syncd::run() | |
|
||
m_manager->removeAllCounters(); | ||
|
||
#ifdef MDIO_ACCESS_USE_NPU | ||
if (m_commandLineOptions->m_globalContext == 0) | ||
{ | ||
stopIpcMdioProcessingThread(); | ||
} | ||
#endif | ||
|
||
sai_status_t status = removeAllSwitches(); | ||
|
||
// Stop notification thread after removing switch | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why you suddenly need this instead of gSwitchId? also i strongly advise to not use global objects, this file is added only for thrift support
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
current logic in syncd is able to handle multiple switches and it should be treated as such
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this mdioSwitchId needs to be passed to this class that you will create in the constructor, then remove global definition