- 10 4月, 2019 1 次提交
-
-
由 Peter Krempa 提交于
'viralloc.h' does not provide any type or macro which would be necessary in headers. Prevent leakage of the inclusion. Signed-off-by: NPeter Krempa <pkrempa@redhat.com> Reviewed-by: NJán Tomko <jtomko@redhat.com>
-
- 08 3月, 2019 1 次提交
-
-
由 Pavel Hrdina 提交于
Only PCI devices have '/sys/class/net/<ifname>/device/resource' so we need to skip this check for all other network devices. Without this patch and RDMA enabled libvirt will not detect any network device that doesn't have the path above which includes 'lo', 'virbr', 'tun', etc. Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1639258Reviewed-by: NAndrea Bolognani <abologna@redhat.com> Signed-off-by: NPavel Hrdina <phrdina@redhat.com>
-
- 08 2月, 2019 1 次提交
-
-
由 John Ferlan 提交于
For consistency, let's use the semicolon for all definitions. Signed-off-by: NJohn Ferlan <jferlan@redhat.com> Reviewed-by: NErik Skultety <eskultet@redhat.com>
-
- 04 2月, 2019 1 次提交
-
-
由 Cole Robinson 提交于
Missing semicolon at the end of macros can confuse some analyzers (like cppcheck <filename>), and we have a mix of semicolon and non-semicolon usage through the code. Let's standardize on using a semicolon for VIR_ENUM_IMPL calls. Move the verify() statement to the end of the macro and drop the semicolon, so the compiler will require callers to add a semicolon. While we are touching these call sites, standardize on putting the closing parenth on its own line, as discussed here: https://www.redhat.com/archives/libvir-list/2019-January/msg00750.htmlReviewed-by: NJohn Ferlan <jferlan@redhat.com> Signed-off-by: NCole Robinson <crobinso@redhat.com>
-
- 24 1月, 2019 1 次提交
-
-
由 Michal Privoznik 提交于
This is a return argument that is to be compared against NULL on successful return. However, it is not initialized and therefore relies on callers setting it to NULL prior calling the function. Signed-off-by: NMichal Privoznik <mprivozn@redhat.com> Reviewed-by: NErik Skultety <eskultet@redhat.com>
-
- 23 1月, 2019 2 次提交
-
-
由 Radoslaw Biernacki 提交于
Removing redundant sections of the code Signed-off-by: NRadoslaw Biernacki <radoslaw.biernacki@linaro.org> Signed-off-by: Ndann frazier <dann.frazier@canonical.com> Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
-
由 Radoslaw Biernacki 提交于
libvirt wrongly assumes that VF netdev has to have the netdev assigned to PF. There is no such requirement in SRIOV standard. This patch change the virNetDevSwitchdevFeature() function to deal with SRIOV devices which does not have netdev on PF. Also corrects one comment about PF netdev assumption. One example of such devices is ThunderX VNIC. By applying this change, VF device is used for virNetlinkCommand() as it is the only netdev assigned to VNIC. Signed-off-by: NRadoslaw Biernacki <radoslaw.biernacki@linaro.org> Signed-off-by: Ndann frazier <dann.frazier@canonical.com> Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
-
- 14 12月, 2018 1 次提交
-
-
由 Daniel P. Berrangé 提交于
In many files there are header comments that contain an Author: statement, supposedly reflecting who originally wrote the code. In a large collaborative project like libvirt, any non-trivial file will have been modified by a large number of different contributors. IOW, the Author: comments are quickly out of date, omitting people who have made significant contribitions. In some places Author: lines have been added despite the person merely being responsible for creating the file by moving existing code out of another file. IOW, the Author: lines give an incorrect record of authorship. With this all in mind, the comments are useless as a means to identify who to talk to about code in a particular file. Contributors will always be better off using 'git log' and 'git blame' if they need to find the author of a particular bit of code. This commit thus deletes all Author: comments from the source and adds a rule to prevent them reappearing. The Copyright headers are similarly misleading and inaccurate, however, we cannot delete these as they have legal meaning, despite being largely inaccurate. In addition only the copyright holder is permitted to change their respective copyright statement. Reviewed-by: NErik Skultety <eskultet@redhat.com> Signed-off-by: NDaniel P. Berrangé <berrange@redhat.com>
-
- 24 9月, 2018 1 次提交
-
-
由 Shi Lei 提交于
This patch just fixes misaligned arguments and misaligned conditions of src/util/*.c. Signed-off-by: NShi Lei <shi_lei@massclouds.com>
-
- 21 9月, 2018 1 次提交
-
-
由 John Ferlan 提交于
There seems to be no need to add the ignore_value wrapper or caste with (void) to the unlink() calls, so let's just remove them. I assume at one point in time Coverity complained. So, let's just be consistent - those that care to check the return status can and those that don't can just have the naked unlink. Signed-off-by: NJohn Ferlan <jferlan@redhat.com> Reviewed-by: NErik Skultety <eskultet@redhat.com>
-
- 17 9月, 2018 2 次提交
-
-
由 Shi Lei 提交于
Signed-off-by: NShi Lei <shi_lei@massclouds.com>
-
由 Shi Lei 提交于
Signed-off-by: NShi Lei <shi_lei@massclouds.com>
-
- 12 9月, 2018 1 次提交
-
-
由 Shi Lei 提交于
Signed-off-by: NShi Lei <shi_lei@massclouds.com>
-
- 07 9月, 2018 1 次提交
-
-
由 Shi Lei 提交于
nlmsg_append from the libnl library provides exactly the same functionality, so we should rely on that instead. This also allows us to drop the aforementioned function completely. Signed-off-by: NShi Lei <shi_lei@massclouds.com> Reviewed-by: NErik Skultety <eskultet@redhat.com>
-
- 05 9月, 2018 1 次提交
-
-
由 Andrea Bolognani 提交于
There's a single user for it which takes an existing virPCIDeviceAddress, passes its various bits to the function which in turn constructs a virPCIDevice and then copies the string representation for the caller to use: we can use virPCIDeviceAddressAsString() instead and avoid creating the virPCIDevice in the first place. Since the function ends up having no users after the change, we can just drop it. Signed-off-by: NAndrea Bolognani <abologna@redhat.com> Reviewed-by: NMartin Kletzander <mkletzan@redhat.com>
-
- 08 8月, 2018 1 次提交
-
-
由 Erik Skultety 提交于
Commits 7b706f33 and 4acb7887 introduced some compound type *Free wrappers in order to use them with VIR_DEFINE_AUTOPTR_FUNC. However, since those were not used in the code right away, Clang complained about unused functions (static ones that are defined by the macro above). This patch puts the defined functions in use. Signed-off-by: NErik Skultety <eskultet@redhat.com> Reviewed-by: NJán Tomko <jtomko@redhat.com>
-
- 07 8月, 2018 1 次提交
-
-
由 Sukrit Bhatnagar 提交于
Using the new VIR_DEFINE_AUTOPTR_FUNC macro defined in src/util/viralloc.h, define a new wrapper around an existing cleanup function which will be called when a variable declared with VIR_AUTOPTR macro goes out of scope. Also, drop the redundant viralloc.h include, since that has moved from the source module into the header. When variables of type virNetDevRxFilterPtr and virNetDevMcastEntryPtr are declared using VIR_AUTOPTR, the functions virNetDevRxFilterFree and virNetDevMcastEntryFree, respectively, will be run automatically on them when they go out of scope. Signed-off-by: NSukrit Bhatnagar <skrtbhtngr@gmail.com> Reviewed-by: NErik Skultety <eskultet@redhat.com>
-
- 23 7月, 2018 3 次提交
-
-
由 Andrea Bolognani 提交于
Currently, the functions return a pointer to the destination buffer on success or NULL on failure. Not only does this kind of error handling look quite alien in the context of libvirt, where most functions return zero on success and a negative int on failure, but it's also somewhat pointless because unless there's been a failure the returned pointer will be the same one passed in by the user, thus offering no additional value. Change the functions so that they return an int instead. Signed-off-by: NAndrea Bolognani <abologna@redhat.com>
-
由 Andrea Bolognani 提交于
virStrncpy() allows us to copy a substring, but if we're going to copy the entire thing it's much more convenient to use virStrcpy() instead. Signed-off-by: NAndrea Bolognani <abologna@redhat.com>
-
由 Andrea Bolognani 提交于
This convenience macro was created for the simple cases where the length of the source string and the size of the destination buffer can be figued out with strlen() and sizeof() respectively, so we should use it wherever possible instead of open-coding parts of it. Signed-off-by: NAndrea Bolognani <abologna@redhat.com>
-
- 03 7月, 2018 1 次提交
-
-
由 Laine Stump 提交于
This makes it easier to see why libvirt has decided it must re-attach a tap device to its bridge. Signed-off-by: NLaine Stump <laine@laine.org> ACKed-by: NMichal Privoznik <mprivozn@redhat.com>
-
- 20 1月, 2018 1 次提交
-
-
由 Jim Fehlig 提交于
Commit 8708ca01 added virNetDevSwitchdevFeature() to check if a network device has Switchdev capabilities. virNetDevSwitchdevFeature() attempts to retrieve the PCI device associated with the network device, ignoring non-PCI devices. It does so via the following call chain virNetDevSwitchdevFeature()->virNetDevGetPCIDevice()-> virPCIGetDeviceAddressFromSysfsLink() For non-PCI network devices (qeth, Xen vif, etc), virPCIGetDeviceAddressFromSysfsLink() will report an error when virPCIDeviceAddressParse() fails. virPCIDeviceAddressParse() also logs an error. After commit 8708ca01 there are now two errors reported for each non-PCI network device even though the errors are harmless. To avoid the errors, introduce virNetDevIsPCIDevice() and use it in virNetDevGetPCIDevice() before attempting to retrieve the associated PCI device. virNetDevIsPCIDevice() uses the 'subsystem' property of the device to determine if it is PCI. See the sysfs rules in kernel documentation for more details https://www.kernel.org/doc/html/latest/admin-guide/sysfs-rules.html
-
- 03 11月, 2017 1 次提交
-
-
由 Andrea Bolognani 提交于
Right-aligning backslashes when defining macros or using complex commands in Makefiles looks cute, but as soon as any changes is required to the code you end up with either distractingly broken alignment or unnecessarily big diffs where most of the changes are just pushing all backslashes a few characters to one side. Generated using $ git grep -El '[[:blank:]][[:blank:]]\\$' | \ grep -E '*\.([chx]|am|mk)$$' | \ while read f; do \ sed -Ei 's/[[:blank:]]*[[:blank:]]\\$/ \\/g' "$f"; \ done Signed-off-by: NAndrea Bolognani <abologna@redhat.com>
-
- 14 10月, 2017 1 次提交
-
-
由 John Ferlan 提交于
Commit id '8708ca01' added a check to determine whether the NIC had Switchdev capabilities; however, in doing so inadvertently would cause network devices without a PCI device to not be added to the node device database. Thus, network devices having a "computer" as a parent, such as "net_lo*", "net_virbr*", "net_tun*", "net_vnet*", etc. were not added. Alter the check to not even check for Switchdev bits if no PCI device found.
-
- 22 9月, 2017 1 次提交
-
-
由 Laine Stump 提交于
After commit 8708ca01 libvirtd consistently aborts with "stack smashing detected" when nodedev driver is initialized. This is caused by nlmsg_parse() being told that its array of nlattr* has CTRL_CMD_MAX (10) entries, when in fact it is declared to have CTRL_ATTR_MAX (8) entries. Since all the entries are initialized to NULL, the result is that nlmsg_parse is overwriting 2*(sizof(nlattr*)) bytes outside the array. Signed-off-by: NLaine Stump <laine@laine.org> Reviewed-by: NJohn Ferlan <jferlan@redhat.com> Signed-off-by: NJiri Denemark <jdenemar@redhat.com>
-
- 19 9月, 2017 1 次提交
-
-
由 Ján Tomko 提交于
Instead of checking for all possible constants that every kernel header with devlink support should have (and defining HAVE_DECL_DEVLINK as 1 if any of them is present due to the way AC_CHECK_DECLS works), only check for DEVLINK_CMD_ESWITCH_GET. This is the name of the constant since kernel 4.11. Between 4.8 and 4.11, the now deprecated spelling DEVLINK_CMD_ESWITCH_MODE_GET was used. Assume DEVLINK_ESWITCH_MODE_SWITCHDEV is available, since it was introduced along with the deprecated spelling.
-
- 18 9月, 2017 1 次提交
-
-
由 Edan David 提交于
Adding functionality to libvirt that will allow querying the interface for the availability of switchdev Offloading NIC capabilities. The switchdev mode was introduced in kernel 4.8, the iproute2-devlink command to retrieve the switchdev NIC feature with command example: devlink dev eswitch show pci/0000:03:00.0 This feature is needed for Openstack so we can do a scheduling decision if the NIC is in Hardware Offload (switchdev) or regular SR-IOV (legacy) mode. And select the appropriate hypervisors with the requested capability see [1]. [1] - https://specs.openstack.org/openstack/nova-specs/specs/pike/approved/enable-sriov-nic-features.htmlReviewed-by: NLaine Stump <laine@laine.org> Reviewed-by: NJohn Ferlan <jferlan@redhat.com>
-
- 14 8月, 2017 1 次提交
-
-
由 Laine Stump 提交于
Commit 81fb440b further qualified an if statement by adding the boolean saveVlan to the condition. Coverity pointed out that this change in the logic eliminated the need to check saveVlan in an argument to virAsprintf().
-
- 12 8月, 2017 5 次提交
-
-
由 Laine Stump 提交于
When using a VF from an SRIOV-capable network card in a guest (either in macvtap passthrough mode, or via VFIO PCI device assignment), The associated PF netdev must be online in order for the VF to be usable by the guest. The guest, however, is not able to change the state of the PF. And libvirt *could* set the PF online as needed, but that could lead to the host receiving unexpected IPv6 traffic (since the default for an unconfigured interface is to participate in IPv6 autoconf). For this reason, before assigning a VF to a guest, libvirt verifies that the related PF netdev is online - if it isn't, then we log an error and don't allow the guest startup to continue. Until now, this check was done during virNetDevSetNetConfig(). This works nicely because the same function is called both for macvtap passthrough and for VFIO device assignment. But in the case of VFIO, the VF has already been unbound from its netdev driver by the time we get to virNetDevSetNetConfig(), and in the case of dual port Mellanox NICs that have their VFs setup in single port mode, the *only* way to determine the proper PF netdev to query for online status is via the "phys_port_id" file that is in the VF netdev's sysfs directory. *BUT* if we've unbound the VF from the netdev driver, then it doesn't *have* a netdev sysfs directory. So, in order to check the correct PF netdev for online status, this patch moved the check earlier in the setup, into virNetDevSaveNetConfig(), which is called *before* unbinding the VF from its netdev driver. (Note that this implies that if you are using VFIO device assignment for the VFs of a Mellanox NIC that has the VFs programmed in single port mode, you must let the VFs be bound to their net driver and use "managed='yes'" in the device definition. To be more specific, this is only true if the VFs in single port mode are using port *2* of the PF - if the VFs are using only port 1, then the correct PF netdev will be arrived at by default/chance)) This resolves: https://bugzilla.redhat.com/267191
-
由 Laine Stump 提交于
virHostdevRestoreNetConfig() calls virNetDevReadNetConfig() to try and read the "original config" of a netdev, and if that fails, it tries again with a different directory/netdev name. This achieves the desired effect (we end up finding the config wherever it may be), but for each failure, virNetDevReadNetConfig() places a nice error message in the system logs. Experience has shown that false-positive error logs like this lead to erroneous bug reports, and can often mislead those searching for *real* bugs. This patch changes virNetDevReadNetConfig() to explicitly check if the file exists before calling virFileReadAll(); if it doesn't exist, virNetDevReadNetConfig() returns a success, but leaves all the variables holding the results as NULL. (This makes sense if you define the purpose of the function as "read a netdev's config from its config file *if that file exists*). To take advantage of that change, the caller, virHostdevRestoreNetConfig() is modified to fail immediately if virNetDevReadNetConfig() returns an error, and otherwise to try the different directory/netdev name if adminMAC & vlan & MAC are all NULL after the preceding attempt.
-
由 Laine Stump 提交于
This patch updates functions in netdev.c to pay attention to phys_port_id. It uses the new function virNetDevGetPhysPortID() to learn the phys_port_id of a VF or PF, then sends that info to virPCIGetNetName(), which has newly been modified to take an optional phys_port_id.
-
由 Laine Stump 提交于
A single PCI device may have multiple netdevs associated with it. Each of those netdevs will have a different phys_port_id entry in sysfs. This patch modifies virPCIGetNetName() to allow selecting one of the potential many netdevs in two different ways: 1) by setting the "idx" argument, the caller can select the 1st (0), 2nd (1), etc. netdev from the PCI device's net subdirectory. 2) If the physPortID arg is set (to a null-terminated string) then virPCIGetNetName() returns the netdev that has that phys_port_id in the sysfs file of the same name in the netdev's directory.
-
由 Laine Stump 提交于
On Linux each network device *can* (but not necessarily *does*) have an attribute called phys_port_id which can be read from the file of that name in the netdev's sysfs directory. The examples I've seen have been a many-digit hexadecimal number (as an ASCII string). This value can be useful when a single PCI device is associated with multiple netdevs (e.g a dual port Mellanox SR-IOV NIC - this card has a single PCI Physical Function (PF), and that PF has two netdevs associated with it (the "net" subdirectory of the PF in sysfs has two links rather than the usual single link to a netdev directory). Each of the PF netdevs has a different phys_port_id. The Virtual Functions (VF) are similar - the PF (a PCI device) has "n" VFs (also each of these is a PCI device), each VF has two netdevs, and each of the VF netdevs points back to the VF PCI device (with the "device" entry in its sysfs directory) as well as having a phys_port_id matching the PF netdev it is associated with. virNetDevGetPhysPortID() simply attempts to read the phys_port_id for the given netdev and return it to the caller. If this particular netdev driver doesn't support phys_port_id, it returns NULL (*not* a NULL-terminated string, but a NULL pointer) but still counts it as a success.
-
- 16 6月, 2017 1 次提交
-
-
由 Martin Kletzander 提交于
Change the settings from qemuDomainUpdateDeviceLive() as otherwise the call would succeed even though nothing has changed. Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1414627Signed-off-by: NMartin Kletzander <mkletzan@redhat.com>
-
- 24 4月, 2017 1 次提交
-
-
由 Roman Bogorodskiy 提交于
Currently, virNetDevSetCoalesce() stub is always returning error. As it's used by virNetDevTapCreateInBridgePort(), it essentially breaks bridged networking if coalesce is not supported. To make it work, relax the stub to trigger error only when its coalesce argument is not NULL, otherwise report success.
-
- 21 4月, 2017 3 次提交
-
-
由 Laine Stump 提交于
Commit f4ef3a71 made a variation of virNetDevSetMAC that would return without logging an error message if errno was set to EADDRNOTAVAIL. This errno is set by some SRIOV VF drivers (in particular igbvf) when they fail to set the device's MAC address due to the PF driver refusing the request. This is useful if we want to try a different method of setting the VF MAC address before giving up (Commit 86556e16 actually does this, setting the desired MAC address to the "admin MAC in the PF, then detaching and reattaching the VF netdev driver to force a reinit of the MAC address). During testing of Bug 1442040 t was discovered that the ixgbe driver returns EPERM in this situation, so this patch changes the exception case for silent+non-terminal failure to account for this difference. Completes resolution to: https://bugzilla.redhat.com/1415609 (RHEL 7.4) https://bugzilla.redhat.com/1442040 (RHEL 7.3.z)
-
由 Daniel P. Berrange 提交于
The current fallback stub for virNetDevSetCoalesce is inside an earlier conditional block. This deals with the feature being missing on older Linux platforms. We need a second fallback stub though, outside the top level conditional, to ensure builds work on Win32/FreeBSD platforms too. Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
-
由 Martin Kletzander 提交于
That function is able to configure coalesce settings for an interface, similarly to 'ethtool -C'. This function also updates back the structure so that it contains actual data on the device (if the device doesn't support some settings kernel might just return 0 and not set whatever is not supported), so this way we'll have up-to-date information in the live domain XML. Signed-off-by: NMartin Kletzander <mkletzan@redhat.com>
-
- 28 3月, 2017 2 次提交
-
-
由 Martin Kletzander 提交于
If if_indextoname is not defined, the whole function using it should not be defined either. Add stub to fix build on mingw. Caused by 5dd60705Signed-off-by: NMartin Kletzander <mkletzan@redhat.com>
-
由 Roman Bogorodskiy 提交于
Fix typo: virNetDevVLanPtr -> virNetDevVlanPtr.
-