Skip to content

Netvsp remove VF_ASSOCIATION_COMPLETION no-op packet #1494

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

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

Conversation

erfrimod
Copy link
Contributor

@erfrimod erfrimod commented Jun 9, 2025

Ideally every Guest would send a VF_ASSOCIATION_COMPLETION packet and netvsp could use that to know when to explose the AccelNet device to the client. Some Linux Guests do not support inline completions, they don't send the completion packet. Since not all guests send the packet, the code is a no-op.

  • Removing PacketData::SendVfAssociationCompletion
  • Modify parse_packet() to stop creating a SendVfAssociationCompletion Packet
  • Remove SendVfAssociationCompletion from process_ring_buffer()
  • Create a new error IgnoreVfAssociationCompletion for parse_packet() to return.
  • Modify try_next_packet() and next_packet() to handle the new Error and no-op.

@erfrimod erfrimod requested a review from a team as a code owner June 9, 2025 20:35
Copy link
Member

@chris-oo chris-oo left a comment

Choose a reason for hiding this comment

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

how was this tested? Can we onboard a unittest/vmm_test to test this behavior in any way?

@@ -1971,7 +1972,11 @@ fn parse_packet<'a, T: RingMem>(
IncomingPacket::Data(data) => data,
IncomingPacket::Completion(completion) => {
let data = if completion.transaction_id() == VF_ASSOCIATION_TRANSACTION_ID {
Copy link
Member

Choose a reason for hiding this comment

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

This block seems pretty complicated now and has a lot of rightward drift - is there any reasonable way to make this a subfunction, that maybe wouldn't have early returns? Something like parse_incoming_packet(...) -> Result<PacketData, Err>?

@erfrimod
Copy link
Contributor Author

erfrimod commented Jun 9, 2025

how was this tested? Can we onboard a unittest/vmm_test to test this behavior in any way?

Tested manually on my lab machine, but let me look into a unit test.

Update: Almost every netvsp unit test sends the VF Association Completion Message. (With the expectation that it's a no-op).

@chris-oo
Copy link
Member

chris-oo commented Jun 9, 2025

Should there be a new test that does not send the packet to match the behavior this bug fixes?

// that it is safe to expose the AccelNet device to the guest.
// Some Linux guests lack support for inline completions; they do not send the packet.
// Since the completion packet is not sent by all guests, it gets ignored.
Err(PacketError::IgnoreVfAssociationCompletion)
Copy link
Member

Choose a reason for hiding this comment

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

I do not think it's a good idea to report expected behavior as an error that you then have to filter back out.

@jstarks
Copy link
Member

jstarks commented Jun 9, 2025

What problem are you trying to solve here?

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.

3 participants