Re: Dynamic VF mac address manipulation / Bhyve

From: Michael Yan Ka Chiu <nyan_at_myuji.xyz>
Date: Thu, 14 Jul 2022 20:46:25 UTC
On Thu, Jul 14, 2022, at 10:05 PM, John wrote:
> Hi -
> 
> I am slowly converting a Linux based qemu/kvm solution to FreeBSD
> Bhyve where VMs have mac addresses assigned to them.

> I have tried the following steps.
> # ifconfig ccv3 ether 02:22:33:44:55:66

AFAIK for SR-IOV, the PF driver is actually the one responsible to configure the VF, so setting the mac address via the VF interface cannot create a persistent mac address.
> devctl set driver -f pci0:65:0:20 ppt
> 
> The VF device can now be passed into bhyve (65/0/20) but the new
> value 02:22:33:44:55:66 is lost and the prior value 02:00:00:00:00:00
> is seen by the vm - but we want 02:22:33:44:55:66. So the new mac is
> a property of the driver, not the VF.
> 
> 
> At this point I'm wondering if adding a -U (update) option to iovctl
> or a new standalone program to target an individual iface/vf pair
> for update might be the answer.
> 
> 
> Comments welcome.
> 
> Thanks,
> John
I’m just thinking out loud here. I have work on similar tools and have some thoughts on how to make  VF more manageable. For example currently there’s no way to really tell the pf of the vf actually belonging to, this is especially an issue with Sriov enabled nic as you can’t keep track of the physical port number.

I think maybe a different ppt like driver (let’s just call it iov for now) can be useful. Maybe with this  iov device, we can have the PF driver to register some hooks to reconfigure specific VF, show the topology between PFs and VFs and even allow dynamic creation of VF if the PF driver can somehow support it?

Best,
Michael