Page MenuHomeFreeBSD

mlx5en: Report SR-IOV VF status
Needs ReviewPublic

Authored by kbowling on Aug 9 2026, 6:58 AM.
Tags
None
Referenced Files
Unknown Object (File)
Mon, Sep 21, 8:45 AM
Unknown Object (File)
Mon, Sep 21, 8:18 AM
Unknown Object (File)
Sun, Sep 20, 4:18 AM
Unknown Object (File)
Sat, Sep 19, 7:13 PM
Unknown Object (File)
Sat, Sep 19, 6:42 PM
Unknown Object (File)
Sat, Sep 19, 6:35 PM
Unknown Object (File)
Tue, Sep 15, 5:19 AM
Unknown Object (File)
Mon, Sep 14, 3:21 PM
Subscribers

Details

Summary
Query each enabled eswitch vport to report its effective MAC and VLAN
configuration and administrative link-state policy.  Serialize the
query with vport enable and disable, and hold the interface state lock
so teardown joins an in-progress report.

Propagate firmware errors from MAC, administrative link-state, and
supported VLAN queries instead of returning a partially initialized
configuration.  When the hardware lacks CVLAN enforcement, report the
remaining status with no imposed access VLAN.
Test Plan

Not sure who to route this to at Nvidia these days

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

kbowling edited the summary of this revision. (Show Details)

This is a basic implementation, someone more familiar with the driver may look at the nvlist schema and https://reviews.freebsd.org/D58739 which demonstrates driver extensions.

I will ask for the internal testing.

How is the VF status accessed?

Create some VFs with iovctl (can be attached, unattached, passhthru)

On recent main (as of yesterday) run 'ifconfig -v'

Things to watch out for: performance with 0, 1, many VFs. This implementation does some live firmware work, which is different than cached state in my other implementations. The linked ice(4) review above contains an extension syntax example if there is any additional eswitch info that doesn't fit into the schema that should be exposed.

sys/dev/mlx5/mlx5_en/mlx5_en_main.c
3742

I think that you should take the state_lock (AKA PRIV_LOCK) around the call.

kbowling edited the summary of this revision. (Show Details)

Update against committed netlink API, propagate firmware query failures, tolerate absent CVLAN support, synchronize teardown.

kbowling added inline comments.
sys/dev/mlx5/mlx5_en/mlx5_en_main.c
3742

Addressed by holding PRIV_LOCK across validation and firmware snapshot construction

sys/dev/mlx5/mlx5_en/mlx5_en_main.c
3611

Why do you claim that trunk cannot have pcp != 0?

3633

Why do you 'continue' there instead of filling something into link_state_policy? It is strange as is.

kbowling added inline comments.
sys/dev/mlx5/mlx5_en/mlx5_en_main.c
3611

Keep in mind I know next to nothing about this hw and driver.. think I was seeing the if (!vport-> vlan && !vport->qos) pattern in mlx5_eswitch.c,

Should I just drop the second condition?

3633

How to handle better? the 3 case cover the current enum, invariant or?

sys/dev/mlx5/mlx5_en/mlx5_en_main.c
3611

I think yes, drop it. It is not a driver thing BTW, we do support setting pcp on trunks. In this case the non-vlan packets are encapsulated as vlan with vlanid==0 AFAIR, and pcp set.

3633

Well, it is already set to zero. But you continue instead of break, so it will be some surprise for naive developer adding a statement aftter the switch(). If zero is good enough for link_state_policy, then just replace continue with break. Otherwise you would need some value like IFVF_LINK_UNKNOWN_STATE.

allow trunks to carry pcp, spell out IFVF_LINK_UNKNOWN for code clarity

Please wait for the approval from the NVIDIA verification team for the patch.

This revision is now accepted and ready to land.Thu, Sep 10, 6:59 AM
kbowling edited the summary of this revision. (Show Details)

Chase 429fbc7c35a6 - allow trunks to display configured PCP. Also distinguish PCP enable so a fixed 0 can be reported in either trunk or access.

This revision now requires review to proceed.Thu, Sep 10, 7:43 AM