SR-IOV: Fix API logic and add I350 NIC support #5604
SR-IOV: Fix API logic and add I350 NIC support #5604uncleDecart wants to merge 5 commits intolf-edge:masterfrom
Conversation
instead log error nad move on, that helps to avoid infinite boot cycle if something is not working. Signed-off-by: Pavel Abramov <uncle.decart@gmail.com>
files under /sys are not files, those are calls, so we shouldn't try to create files if they are not explicitly present, that can cause us trouble Signed-off-by: Pavel Abramov <uncle.decart@gmail.com>
currently we create Virtual Function VF only to pass it through to the VM we are not initializing interface on the host side, thus we shoudn't try to test VF or probe it for last resort. Former obstructs EVE from passing through VFs due to race condition, i.e. we start to test at some point and only some part of VFs is actually passed since we're not considering VFs Network devices (isNet is false) we pass them through and won't try them for last resort. Signed-off-by: Pavel Abramov <uncle.decart@gmail.com>
if controller does not send configuration for Virtual Functions (even empty ones) we ignore it and create bundles based on information from the system it also includes expansion of debug messages Signed-off-by: Pavel Abramov <uncle.decart@gmail.com>
certain drivers (like igb on Intel I350 NIC) put Physical Function (PF) interface in DOWN state, which doesn't work for us, since Virtual Functions (VF) need PF to be in UP state. We handle this in SR-IOV package, specifically after creating VFs. This is done intentionally not in nim. We don't want to make nim that robust, because some EVE users want to change configuration manually and that might trip them. Signed-off-by: Pavel Abramov <uncle.decart@gmail.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #5604 +/- ##
==========================================
+ Coverage 19.52% 28.08% +8.55%
==========================================
Files 19 19
Lines 3021 2314 -707
==========================================
+ Hits 590 650 +60
+ Misses 2310 1520 -790
- Partials 121 144 +23 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
|
||
| if _, err := os.Stat(autoprobePath); err == nil { | ||
| if err := os.WriteFile(autoprobePath, []byte("0"), 0); err != nil { | ||
| // log Warn ("Warning: could not disable autoprobe on %s: %w\n", device, err) |
There was a problem hiding this comment.
Remove commented code, if this warning is too much here, you can just log it as a function debug message.....
| return fmt.Errorf("netlink: failed to bring %s up: %w", device, err) | ||
| } | ||
|
|
||
| if err := pollLinkUp(device, 3*time.Minute, 100*time.Millisecond); err != nil { |
There was a problem hiding this comment.
Is 3 min reasonable for any device? I think is better to parametrize this and maybe the other timeouts (as variables)...
There was a problem hiding this comment.
@rene I think polling for it is not a good idea at all but rework would take too much. Yes, 3 min is reasonable for any kernel driver to start, I think we can leave it as-is for now and revisit the whole strategy later
Description
This PR contains various fixes to SR-IOV package and how we create Virtual Functions:
At last this PR improves some error messages in whole, to make debugging easier for the next person to look into it.
How to test and validate this PR
One need a SR-IOV enabled NIC card. Currently SR-IOV tested with Intel X710 and Intel I350 NICs.
Then we should create device model, with multiple Virtual Functions (VFs) (at least 2, but better 4, check with Docs on how many VFs you can create on your specific NIC). That is specified in Physical Function under Vfs.count (your ordinary network interface %IFACE% like eth8 linked to SR-IOV enabled NIC becomes Physical Function).
Then those Virtual functions should be passed through to EdgeApps (for simplicity, use Ubuntu), one function to one EdgeApp.
Then after booting on EVE
ls -la /sys/class/net/%IFACE%/devicesshould show you N virtual functions you specified and their respective PCI addresses. And each of this virtual functions should have vfio_pci driver to check that runreadlink /sys/bus/pci/device/%PCI_ADDRESS%/driver. Screenshot below shows my setup.After you confirm this, enter your Edge Apps and inside you should see interface which belongs to PCI device which is Virtual Function (use ethtool to check that out) . Then bring those interfaces up using
sudo ip link set dev %VF_IFACE% up, set their IP address (I for example had PF physically connected to network which had DHCP, so I used dhclient to obtain IP address) then run iperf3 server on one EdgeApp using %VF_FACE%, i.esudo iperf3 -s --bind-dev %VF_IFACE%and in another Edge App run iperf3 client, pointing to that interface IP address using %VF_IFACE% of the second EdgeApp. In my example my server got IP 10.208.13.173 for VF iface so on the client EdgeApp I ran the followingsudo iperf3 -c 10.208.13.173 --bind-dev enp4s0 -t 30You should see packets going through. You can also test North-South traffic running client (or server) inside the network to which your PF has access to, North-South traffic should has more bandwidth than East-West one (between two EdgeApps). For example that's what I've got on Dell XR11 with Intel I350 NIC . Results may vary.Changelog notes
SR-IOV now tested on Intel I350, fixed bug with controller EVE API behaviour mismatch
PR Backports
Checklist
And the last but not least:
check them.
Please, check the boxes above after submitting the PR in interactive mode.