Skip to content

Conversation

@gvrangan-nvidia
Copy link

@gvrangan-nvidia gvrangan-nvidia commented May 30, 2025

Patch fixes the GetPfName method to collect the PfName from sysfs when

  • SF is created
  • plugin used in non-priv mode

fix #645

Patch fixes the GetPfName method to collect the PfName from sysfs when
- SF is created
- plugin used in non-priv mode

Signed-off-by: gvrangan-nvidia <[email protected]>
@gvrangan-nvidia gvrangan-nvidia changed the title Fix for GetPfName in non-priv mode #645 Fix for GetPfName in non-priv mode May 30, 2025
@gvrangan-nvidia
Copy link
Author

@adrianchiris Can you please review this PR. This issue occurs everytime when working with Scalable functions.

@gvrangan-nvidia gvrangan-nvidia changed the title Fix for GetPfName in non-priv mode Fix #645 for GetPfName in non-priv mode Jun 2, 2025
@gvrangan-nvidia gvrangan-nvidia changed the title Fix #645 for GetPfName in non-priv mode fix #645 for GetPfName in non-priv mode Jun 2, 2025
@gvrangan-nvidia gvrangan-nvidia changed the title fix #645 for GetPfName in non-priv mode fix or GetPfName in non-priv mode Jun 2, 2025
return "", err
} else if len(files) > 0 {
return files[0].Name(), nil
name, err := getPfNameSysFs(pciAddr)
Copy link
Contributor

@adrianchiris adrianchiris Jun 10, 2025

Choose a reason for hiding this comment

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

according to the description, SFs are used. so id expect the device is in switchdev mode in this case.
then we should hit L#91 and get the correct netdevice name.

the logic implemented in this PR (getPfNameSysFs) is very similar to GetUplinkRepresentor[1]

[1] https://github.com/k8snetworkplumbingwg/sriovnet/blob/f71b8cb53530e8d51213739e1c24d8551dd497c9/sriovnet_switchdev.go#L116

Copy link
Contributor

Choose a reason for hiding this comment

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

does it fail to identify the correct PF because you are running this in non privileged mode ? (and devlink command fails ?)

Copy link
Author

Choose a reason for hiding this comment

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

@adrianchiris Yes, we are running in non-priv mode. Our deployment does not allow priv-mode.

Copy link
Author

Choose a reason for hiding this comment

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

according to the description, SFs are used. so id expect the device is in switchdev mode in this case. then we should hit L#91 and get the correct netdevice name.

the logic implemented in this PR (getPfNameSysFs) is very similar to GetUplinkRepresentor[1]

[1] https://github.com/k8snetworkplumbingwg/sriovnet/blob/f71b8cb53530e8d51213739e1c24d8551dd497c9/sriovnet_switchdev.go#L116

yes, the logic is similar. in our deployement using non-priv mode is not able to determine if switchdev mode is enabled or not.

Copy link
Contributor

Choose a reason for hiding this comment

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

we rely on the ability to invoke devlink and query devices (here and in other places in code, such as getting DDP profile for intel nic)

generally device plugin requires access to system resources to properly advertise devices.

can you try to add NET_ADMIN capability to your device plugin deployment ?
i think this should do it for your usecase.

    securityContext:
      privileged: false
      capabilities:
        add: ["NET_ADMIN"]

Copy link
Author

Choose a reason for hiding this comment

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

@adrianchiris no, currently the usage of NET_ADMIN capabilities is not allowed.

Copy link
Author

Choose a reason for hiding this comment

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

@adrianchiris Also the bug is that, If executed in non-priv mode. wrong device name
is picked as PfName.

Copy link
Author

Choose a reason for hiding this comment

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

@adrianchiris Please let me know if there aare any other queries or any actio ns to be taken?

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.

GetPfName picks wrong PF Name for SFS

2 participants