Skip to content

Commit ef6b5d4

Browse files
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 [email protected] 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 operation
1 parent b592ad7 commit ef6b5d4

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

orchagent/pfcactionhandler.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -784,7 +784,7 @@ void PfcWdZeroBufferHandler::ZeroBufferProfile::createZeroBufferProfile(bool ing
784784
attribs.push_back(attr);
785785

786786
attr.id = SAI_BUFFER_PROFILE_ATTR_BUFFER_SIZE;
787-
attr.value.u32 = 0;
787+
attr.value.u64 = 0;
788788
attribs.push_back(attr);
789789

790790
attr.id = SAI_BUFFER_PROFILE_ATTR_SHARED_DYNAMIC_TH;

0 commit comments

Comments
 (0)