Skip to content
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

Fix signed/unsigned comparison for subsystem ID #77

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from

Conversation

jwstolk
Copy link

@jwstolk jwstolk commented Dec 5, 2024

The PHY table used a signed device "subdev". My subdev is 0x8103 (MSB set) which failed the table lookup despite 0x8103 being in the table.
This changes the table type from "short" to "__u16" to make the comparison work correctly.
Tested with my Edimax EN-9320SFP+, Intel HP620 workstation, Ubuntu 24.04, kernel 6.8.0-49-generic.
I can only test bandwidth upto 1 Gbit through my switch since I only have one 10 Gbit device, but the reported link speed to the switch is 10 Gbit.
fixes #76

Comment on lines 2860 to 2863
return bdx_dev_tbl[i].phy_type;
}
return 0;
return PHY_TYPE_NA;
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change return type of the function to enum PHY_TYPE. (minor, doesn't hinder merge)

Copy link
Author

@jwstolk jwstolk Dec 5, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the feedback. I did a commit to the same branch and it looks like that included it in the same pull request automatically. (still finding my way around git and github) Please let me know if there are other issues or comments.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, it looks good now. Another minor code style issue is a space before the first { in the if body.

I don't have merge rights, so we'll have to wait until someone that has, comes around.

tn40.c Outdated
Comment on lines 439 to 441
return PHY_TYPE_NA; /* NIC definition has no PHY. */

}
bdx_mdio_set_speed(priv->pBdxRegs, MDIO_SPEED_1MHZ);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indent with a hard tab to follow the codestyle in the rest of the file. Also one more occurance below. (minor, doesn't hinder merge)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

VID, PID and Subdev comparison cause unintended sign extension
2 participants