-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
fixed sfputil error #3579
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Attribute is show all present result like 0xFFFF from port1 to port 32.
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.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
but this is recommendation not blocking
Signed-off-by: johnson <[email protected]>
…atically (#20546) #### Why I did it src/sonic-utilities ``` * 4a6d1218 - (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
…atically (sonic-net#20546) #### Why I did it src/sonic-utilities ``` * 4a6d1218 - (HEAD -> master, origin/master, origin/HEAD) [doc] correct the fec histogram output for show int counters fec-histogram (sonic-net#3579) (9 hours ago) [vdahiya12] ``` #### How I did it #### How to verify it #### Description for the changelog
modify module and python file