Commit ef6b5d4
authored
fix the type for SAI_BUFFER_PROFILE_ATTR_BUFFER_SIZE (#1942)
Fixing the type for SAI_BUFFER_PROFILE_ATTR_BUFFER_SIZE
It is incorrectly set to u32 and is not clearing the higher 32 bits in the union
Sample code:
attr.id = SAI_BUFFER_PROFILE_ATTR_POOL_ID;
attr.value.oid = getPool(ingress); <<<<-- the higher order 32 bits were retrieved for BUFFER_PROFILE_ATTR_BUFFER_SIZE
attribs.push_back(attr);
attr.id = SAI_BUFFER_PROFILE_ATTR_THRESHOLD_MODE;
attr.value.u32 = SAI_BUFFER_PROFILE_THRESHOLD_MODE_DYNAMIC;
attribs.push_back(attr);
attr.id = SAI_BUFFER_PROFILE_ATTR_BUFFER_SIZE;
attr.value.u64 = 0; <<<<-------------------------------- This was u32 earlier
attribs.push_back(attr);
Signed-off-by: Alpesh S Patel alpesh@cisco.com
What I did
Change the attribute value type from u32 to u64 as in SAI header file - https://github.com/opencomputeproject/SAI/blob/v1.7/inc/saibuffer.h
/**
* @brief Reserved buffer size in bytes
*
* @type sai_uint64_t
* @flags MANDATORY_ON_CREATE | CREATE_AND_SET
*/
SAI_BUFFER_PROFILE_ATTR_RESERVED_BUFFER_SIZE,
/** @ignore - for backward compatibility */
SAI_BUFFER_PROFILE_ATTR_BUFFER_SIZE = SAI_BUFFER_PROFILE_ATTR_RESERVED_BUFFER_SIZE,
Why I did it
since u32 was getting set and the actual data type is u64, at SAI layer, when the value is retrieved as u64, the upper 32 bits are read from the previously written attribute value (pool oid)
How I verified it
Made this change in sonic and verified it on the hardware platform via debug and correct operation1 parent b592ad7 commit ef6b5d4
1 file changed
+1
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
784 | 784 | | |
785 | 785 | | |
786 | 786 | | |
787 | | - | |
| 787 | + | |
788 | 788 | | |
789 | 789 | | |
790 | 790 | | |
| |||
0 commit comments