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
Update SAI pointer to latest master #408
Conversation
Signed-off-by: Marian Pritsak <marianp@mellanox.com>
Depends on opencomputeproject/SAI#909 |
overall those changes looks good, please corect the error: |
Signed-off-by: Marian Pritsak <marianp@mellanox.com>
MUTEX(); \ | ||
SWSS_LOG_ENTER(); \ | ||
return meta_sai_create_oid( \ | ||
(sai_object_type_t)SAI_OBJECT_TYPE_ ## OBJECT_TYPE, \ |
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.
is cast needed because extensions object types?
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.
Yes, it is
@@ -184,7 +184,7 @@ | |||
sai_status_t redis_clear_ ## object_type ## _stats( \ | |||
_In_ sai_object_id_t object_type ## _id, \ | |||
_In_ uint32_t number_of_counters, \ | |||
_In_ const sai_ ## object_type ## _stat_t *counter_ids) \ | |||
_In_ const sai_stat_id_t *counter_ids) \ |
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.
i preffered to have separate type for each stats, this gave extra check for type, so user would not pass different stats for given objects at compile time
is there any reason you are changing this ?
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.
I'm afraid it's not possible to keep the old type, because this function then cannot be casted to a function pointer of the SAI API, that is using sai_stat_id_t.
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.
yes, each new function pointer needs to be created for each stat, and this is how it was so far
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.
Now in SAI stat functions look like this:
typedef sai_status_t (*sai_clear_bfd_session_stats_fn)(
_In_ sai_object_id_t bfd_session_id,
_In_ uint32_t number_of_counters,
_In_ const **sai_stat_id_t** *counter_ids);
So if I leave macros as is, it will fail to compile with following error:
error: invalid conversion from 'sai_status_t (*)(sai_object_id_t, uint32_t, const sai_bfd_session_stat_t*) {aka int (*)(long unsigned int, unsigned int, const _sai_bfd_session_stat_t*)}' to 'sai_clear_bfd_session_stats_fn {aka int (*)(long unsigned int, unsigned int, const unsigned int*)}' [-fpermissive]
Maybe I'm missing your point, but doesn't redis SAI API have to look exactly like SAI api?
These changes to sairedis are done with an assumption that SAI API is taken as is.
@@ -799,13 +799,13 @@ void FlexCounter::collectCounters( | |||
status = sai_metadata_sai_buffer_api->get_ingress_priority_group_stats( | |||
priorityGroupId, | |||
static_cast<uint32_t>(priorityGroupCounterIds.size()), | |||
priorityGroupCounterIds.data(), | |||
(const sai_stat_id_t *)priorityGroupCounterIds.data(), |
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.
from my perspective it would be better to have each stats accepting separate stat's enum but i guess this is already changed on the SAI api's
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.
Yes, SAI APIs were changed, so I had to do this cast.
@@ -297,7 +297,7 @@ void test_set_stats_via_redis() | |||
sai_port_stat_t ids[1] = { SAI_PORT_STAT_IF_IN_ERRORS }; | |||
uint64_t counters[1] = { 0 } ; | |||
|
|||
SUCCESS(sai_metadata_sai_port_api->get_port_stats(ports.at(0), 1, ids, counters)); | |||
SUCCESS(sai_metadata_sai_port_api->get_port_stats(ports.at(0), 1, (const sai_stat_id_t *)ids, counters)); |
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.
previously we had each type for each stats, and cast was not necessary
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.
Yes, but I'm adapting to the new SAI APIs.
I don't know what was the reason behind changing all of them to the same type, but now this is a necessary change.
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.
overall looks good, can you respond on comments i gave ?
@kcudnik I agree with you that changes related to sai_stat_id_t seem odd, but they are necessary because sairedis compilation is constrained by SAI heders definition. I would suggest revisiting this uniform declaration of stat functions using sai_stat_id_t because it breaks a lot of code. |
yes, agree |
* Update SAI pointer to latest master Signed-off-by: Marian Pritsak <marianp@mellanox.com> * Use SAI_EXTENSIONS_TYPE_MAX Signed-off-by: Marian Pritsak <marianp@mellanox.com> Conflicts: SAI
* Update SAI pointer to latest master Signed-off-by: Marian Pritsak <marianp@mellanox.com> * Use SAI_EXTENSIONS_TYPE_MAX Signed-off-by: Marian Pritsak <marianp@mellanox.com> Conflicts: SAI
* Update SAI pointer to latest master Signed-off-by: Marian Pritsak <marianp@mellanox.com> * Use SAI_EXTENSIONS_TYPE_MAX Signed-off-by: Marian Pritsak <marianp@mellanox.com>
* Update SAI pointer to latest master Signed-off-by: Marian Pritsak <marianp@mellanox.com> * Use SAI_EXTENSIONS_TYPE_MAX Signed-off-by: Marian Pritsak <marianp@mellanox.com>
* Update SAI pointer to latest master Signed-off-by: Marian Pritsak <marianp@mellanox.com> * Use SAI_EXTENSIONS_TYPE_MAX Signed-off-by: Marian Pritsak <marianp@mellanox.com>
* Update SAI pointer to latest master Signed-off-by: Marian Pritsak <marianp@mellanox.com> * Use SAI_EXTENSIONS_TYPE_MAX Signed-off-by: Marian Pritsak <marianp@mellanox.com>
* Update SAI pointer to latest master Signed-off-by: Marian Pritsak <marianp@mellanox.com> * Use SAI_EXTENSIONS_TYPE_MAX Signed-off-by: Marian Pritsak <marianp@mellanox.com>
Signed-off-by: Marian Pritsak marianp@mellanox.com