The patch is ported from
https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=7ae0e400cd9396c41fe596d35dcc34feaa89a04f
This is OK, because the driver in Linux side is dual-licensed (GPL & BSD).
Without the patch, when trying to enable SR-IOV for the Mellanox
ConnectX-3 VF with Hyper-V, I get the below error
mlx4_core0: Failed to initialize event queue table (err=-22), aborting.
Note: I didn't port the chunks beween
"@@ -2345,6 +2381,7 @@" and "@@ -2631,6 +2736,7 @@", because in FreeBSD
mlx4_load_one() doesn't exist.
However, it looks the current code in FreeBSD can work, at least I didn't
find any issue in my test.
Note: with this patch, actually the VF driver still can't work in my test:
mlx4_en: mlx4_core0: Port 1: failed reserving qp for TX ring
mlx4_en: mlx4_core0: Port 1: Failed to allocate NIC resources
Another patch will have to be ported too.