-
Notifications
You must be signed in to change notification settings - Fork 484
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
Get vendor specific version information from SAI #1972
Comments
i think SAI was designed to be generic interface and not vendor specific, currently there is no specific interface to query underlying vendoer, and we should not specifically design any macros for that |
what is your motivation to have workaroudns for specific vendor ? if some apis are not implemented you will get not implemented or not supported error code and this should be your information |
Happy to hear! I agree that not relying on the vendor is a good stance to take and try to hold on to. In my case it is only for debugging, so having something like Right now I have to resort to vendor-specific ways to get that information for my test logs, which ironically requires me to care about what module I load so I can query its non-SAI API to get the data. That said, I based some debugging code on E.g.: SAI/test/saithrift/src/saiserver.cpp Lines 457 to 460 in e2a3d44
In my case I just removed that particular |
SAI headers are generic, and there will be no vendor specific macro here, that will let you decide which SAI vendor is internally, and at SAI headers this is even impossible, since there are no vendor specific headers here. investigate SAI_SWITCH_ATTR_SWITCH_SHELL_ENABLE attribute. We could discuss to introduce vendor string api or something like this that will return something like that, or have an enum in which will return actual vendor as unique integer, but this is broader discussion at SAI community meeting @rlhui |
For reference, this is how I currently get the data I want in my logs if anyone wants something similar: typedef struct {
const char* sai_api_version;
const char* bcm_sai_version;
const char* build_release;
/* these are only populated after create_switch */
const char* cancun_version;
const char* npl_version;
} brcm_sai_version_t;
extern "C" {
extern brcm_sai_version_t* brcm_sai_version_get(brcm_sai_version_t*) __attribute__((weak));
extern void ifcs_get_version(int* major, int* minor, int* rev) __attribute__((weak));
}
/* ... */
{
sai_api_version_t version;
if (sai_query_api_version(&version) == SAI_STATUS_SUCCESS) {
int major = version / 10000;
int minor = (version - major * 10000) / 100;
int rev = version - major * 10000 - minor * 100;
printf("================================\n");
printf(" Loaded SAI version %d.%d.%d\n", major, minor, rev);
}
if (brcm_sai_version_get != NULL) {
brcm_sai_version_t brcm_version;
brcm_sai_version_get(&brcm_version);
printf(
"\n Broadcom SAI detected\n SAI API version: %s\n BRCM SAI version: %s\n Build release: %s\n",
brcm_version.sai_api_version,
brcm_version.bcm_sai_version,
brcm_version.build_release);
}
if (ifcs_get_version != NULL) {
int major = 0;
int minor = 0;
int rev = 0;
ifcs_get_version(&major, &minor, &rev);
printf(
"\n Innovium SAI detected\n IFCS version: %d.%d.%d\n",
major, minor, rev);
}
printf("================================\n");
} Output:
|
Hello,
I would like to be able to drop constructs like
#ifdef BRCMSAI
and be able to deduce from the SAI library what vendor workarounds to apply. I did not find anysai_query_api_vendor
or similar.Are there any current ways of doing this, and if not, are you open to the idea of adding one?
The text was updated successfully, but these errors were encountered: