fixed sfputil error#3579
Conversation
Signed-off-by: johnson <[email protected]>
platform/broadcom/sonic-platform-modules-delta/ag9032v2a/modules/delta_ag9032v2a_platform.c
Show resolved
Hide resolved
platform/broadcom/sonic-platform-modules-delta/ag9032v2a/modules/delta_ag9032v2a_platform.c
Show resolved
Hide resolved
| /*QSFP1~8*/ | ||
| ret = i2c_smbus_read_byte_data(pdata1[swpld1].client, QSFP_PRESENCE_1); | ||
| data = (u32)(reverse_8bits(ret) & 0xff); | ||
| /*QSFP9~16*/ | ||
| ret = i2c_smbus_read_byte_data(pdata1[swpld1].client, QSFP_PRESENCE_2); | ||
| data |= (u32)(reverse_8bits(ret) & 0xff) << 8; | ||
| /*QSFP17~24*/ | ||
| ret = i2c_smbus_read_byte_data(pdata1[swpld1].client, QSFP_PRESENCE_3); | ||
| data |= (u32)(reverse_8bits(ret) & 0xff) << 16; | ||
| /*QSFP25~32*/ | ||
| ret = i2c_smbus_read_byte_data(pdata1[swpld1].client, QSFP_PRESENCE_4); | ||
| data |= (u32)(reverse_8bits(ret) & 0xff) << 24; | ||
| data = (u32)ret & 0xff; | ||
| /*QSFP17~24*/ | ||
| ret = i2c_smbus_read_byte_data(pdata1[swpld1].client, QSFP_PRESENCE_3); | ||
| data |= ((u32)ret & 0xff) << 8; | ||
| /*QSFP9~16*/ | ||
| ret = i2c_smbus_read_byte_data(pdata1[swpld1].client, QSFP_PRESENCE_2); | ||
| data |= (u32)(ret & 0xff) << 16; | ||
| /*QSFP1~8*/ | ||
| ret = i2c_smbus_read_byte_data(pdata1[swpld1].client, QSFP_PRESENCE_1); | ||
| data |= (u32)(ret & 0xff) << 24; |
There was a problem hiding this comment.
How about reading from _1 to _4 but shift the data position first and | with return value for each reading, something like below?
data = (data<<8)|((u32)(ret&0xff))
There was a problem hiding this comment.
Attribute is show all present result like 0xFFFF from port1 to port 32.
There was a problem hiding this comment.
instead of moving ret value with different shifting value, shifting the data 8bit to the left each time before or-ing the ret value will give same shifting for each ret value. then only 8bit shifter not three different shifter (8bit, 16bit, and 24bit).
'''
data=0;
ret = i2c_smbus_read_byte_data(pdata1[swpld1].client, QSFP_PRESENCE_1);
data <<8;
data |= (u32)ret&0xff;
ret = i2c_smbus_read_byte_data(pdata1[swpld1].client, QSFP_PRESENCE_2);
data <<8;
data |= (u32)ret&0xff;
ret = i2c_smbus_read_byte_data(pdata1[swpld1].client, QSFP_PRESENCE_3);
data <<8;
data |= (u32)ret&0xff;
ret = i2c_smbus_read_byte_data(pdata1[swpld1].client, QSFP_PRESENCE_4);
data <<8;
data |= (u32)ret&0xff;
'''
you can make it more simpler with macro definition too.
There was a problem hiding this comment.
but this is recommendation not blocking
Signed-off-by: johnson <[email protected]>
…atically (#20546) #### Why I did it src/sonic-utilities ``` * 4a6d121 - (HEAD -> master, origin/master, origin/HEAD) [doc] correct the fec histogram output for show int counters fec-histogram (#3579) (9 hours ago) [vdahiya12] ``` #### How I did it #### How to verify it #### Description for the changelog
modify module and python file