- 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 2 次提交
-
-
由 Michal Privoznik 提交于
This partially reverts 00dc991c. 2,030 (1,456 direct, 574 indirect) bytes in 14 blocks are definitely lost in loss record 77 of 80 at 0x4C30E96: calloc (vg_replace_malloc.c:711) by 0x50F83AA: virAlloc (viralloc.c:143) by 0x5178DFA: virPCIDeviceNew (virpci.c:1753) by 0x51753E9: virPCIDeviceIterDevices (virpci.c:468) by 0x5175EB5: virPCIDeviceGetParent (virpci.c:759) by 0x517AB55: virPCIDeviceIsBehindSwitchLackingACS (virpci.c:2476) by 0x517AC24: virPCIDeviceIsAssignable (virpci.c:2494) by 0x10BF27: testVirPCIDeviceIsAssignable (virpcitest.c:229) by 0x10D14C: virTestRun (testutils.c:174) by 0x10C535: mymain (virpcitest.c:422) by 0x10F1B6: virTestMain (testutils.c:1112) by 0x10CF93: main (virpcitest.c:455) Signed-off-by: NMichal Privoznik <mprivozn@redhat.com> Reviewed-by: NErik Skultety <eskultet@redhat.com>
-
由 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>
-
- 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>
-
- 15 11月, 2018 2 次提交
-
-
由 Andrea Bolognani 提交于
We were mistakenly skipping virZPCIDeviceAddressIsEmpty() and virZPCIDeviceAddressIsValid() when compiling on non-Linux, which unsurprisingly ended up causing linking failures later in the build process. Clue-stick-by: NPeter Krempa <pkrempa@redhat.com> Signed-off-by: NAndrea Bolognani <abologna@redhat.com>
-
由 Yi Min Zhao 提交于
This patch introduces new XML parser/formatter functions. Uid is 16-bit and non-zero. Fid is 32-bit. They are the two attributes of zpci which is introduced as PCI address element. Zpci element is parsed and formatted along with PCI address. And add the related test cases. Signed-off-by: NYi Min Zhao <zyimin@linux.ibm.com> Reviewed-by: NBoris Fiuczynski <fiuczy@linux.ibm.com> Reviewed-by: NStefan Zimmermann <stzi@linux.ibm.com> Reviewed-by: NBjoern Walk <bwalk@linux.ibm.com> Reviewed-by: NJán Tomko <jtomko@redhat.com> Reviewed-by: NAndrea Bolognani <abologna@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>
-
- 20 9月, 2018 2 次提交
-
-
由 Erik Skultety 提交于
All of the ones being removed are pulled in by internal.h. The only exception is sanlock which expects the application to include <stdint.h> before sanlock's headers, because sanlock prototypes use fixed width int, but they don't include stdint.h themselves, so we have to leave that one in place. Signed-off-by: NErik Skultety <eskultet@redhat.com> Acked-by: NMichal Privoznik <mprivozn@redhat.com>
-
由 Erik Skultety 提交于
It doesn't really make sense for us to have stdlib.h and string.h but not stdio.h in the internal.h header. Signed-off-by: NErik Skultety <eskultet@redhat.com> Acked-by: NMichal Privoznik <mprivozn@redhat.com>
-
- 17 9月, 2018 1 次提交
-
-
由 Andrea Bolognani 提交于
Functions that deal with virPCIDeviceAddress exclusively belong to util/virpci. Signed-off-by: NAndrea Bolognani <abologna@redhat.com> Reviewed-by: NFabiano Fidêncio <fidencio@redhat.com> Reviewed-by: NJán Tomko <jtomko@redhat.com>
-
- 05 9月, 2018 3 次提交
-
-
由 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>
-
由 Andrea Bolognani 提交于
The struct is called virPCIDeviceAddress and the functions operating on it should be named accordingly. Signed-off-by: NAndrea Bolognani <abologna@redhat.com> Reviewed-by: NMartin Kletzander <mkletzan@redhat.com>
-
由 Andrea Bolognani 提交于
It's a better fit than conf/domain_conf. Signed-off-by: NAndrea Bolognani <abologna@redhat.com> Reviewed-by: NMartin Kletzander <mkletzan@redhat.com>
-
- 28 7月, 2018 1 次提交
-
-
由 Michal Privoznik 提交于
So after 00dc991c the function is one line long and the line is declaring a variable which is never used in fact. Replace it with actual free() call instead of autofree. Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
-
- 27 7月, 2018 3 次提交
-
-
由 Sukrit Bhatnagar 提交于
By making use of GNU C's cleanup attribute handled by the VIR_AUTOPTR macro for declaring aggregate pointer variables, majority of the calls to *Free functions can be dropped, which in turn leads to getting rid of most of our cleanup sections. Signed-off-by: NSukrit Bhatnagar <skrtbhtngr@gmail.com> Reviewed-by: NErik Skultety <eskultet@redhat.com>
-
由 Sukrit Bhatnagar 提交于
By making use of GNU C's cleanup attribute handled by the VIR_AUTOFREE macro for declaring scalar variables, majority of the VIR_FREE calls can be dropped, which in turn leads to getting rid of most of our cleanup sections. Signed-off-by: NSukrit Bhatnagar <skrtbhtngr@gmail.com> Reviewed-by: NErik Skultety <eskultet@redhat.com>
-
由 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 types virPCIDevicePtr, virPCIDeviceAddressPtr and virPCIEDeviceInfoPtr are declared using VIR_AUTOPTR, the functions virPCIDeviceFree, virPCIDeviceAddressFree and virPCIEDeviceInfoFree, 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>
-
- 04 5月, 2018 1 次提交
-
-
由 Andrea Bolognani 提交于
The latter is impossible to mock on platforms that use the gnulib implementation, such as FreeBSD, while the former doesn't suffer from this limitation. Signed-off-by: NAndrea Bolognani <abologna@redhat.com> Reviewed-by: NDaniel P. Berrangé <berrange@redhat.com>
-
- 18 4月, 2018 1 次提交
-
-
由 Michal Privoznik 提交于
So far we are repeating the following lines over and over: if (!(virSomeObjectClass = virClassNew(virClassForObject(), "virSomeObject", sizeof(virSomeObject), virSomeObjectDispose))) return -1; While this works, it is impossible to do some checking. Firstly, the class name (the 2nd argument) doesn't match the name in the code in all cases (the 3rd argument). Secondly, the current style is needlessly verbose. This commit turns example into following: if (!(VIR_CLASS_NEW(virSomeObject, virClassForObject))) return -1; Signed-off-by: NMichal Privoznik <mprivozn@redhat.com> Reviewed-by: NDaniel P. Berrangé <berrange@redhat.com>
-
- 30 1月, 2018 1 次提交
-
-
由 Erik Skultety 提交于
Commits f83c7c88 and 6eb1f2b9 broke the build on FreeBSD and OSX because of symbols being undefined for those platforms. Signed-off-by: NErik Skultety <eskultet@redhat.com>
-
- 29 1月, 2018 1 次提交
-
-
由 Erik Skultety 提交于
This is a replacement for the existing udevPCIGetMdevTypesCap which is static to the udev backend. This simple helper constructs the sysfs path from the device's base path for each mdev type and queries the corresponding attributes of that type. Signed-off-by: NErik Skultety <eskultet@redhat.com>
-
- 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>
-
- 20 9月, 2017 1 次提交
-
-
由 Laine Stump 提交于
The mlx4 (Mellanox) netdev driver implements the sysfs phys_port_id file for both VFs and PFs, so you can find the VF netdev plugged into the same physical port as any given PF netdev by comparing the contents of phys_port_id of the respective netdevs. That's what libvirt does when attempting to find the PF netdev for a given VF netdev (or vice versa). Most other netdev's drivers don't implement phys_port_id, so the file is visible in sysfs directory listing, but attempts to read it result in ENOTSUPP. In these cases, libvirt is unable to read phys_port_id of either the PF or the VF, so it just returns the first entry in the PF/VF's list of netdevs. But we've found that the i40e driver is in between those two situations - it implements phys_port_id for PF netdevs, but doesn't implement it for VF netdevs. So libvirt would successfully read the phys_port_id of the PF netdev, then try to find a VF netdev with matching phys_port_id, but would fail because phys_port_id is NULL for all VFs. This would result in a message like the following: Could not find network device with phys_port_id '3cfdfe9edc39' under PCI device at /sys/class/net/ens4f1/device/virtfn0 To solve this problem in a way that won't break functionality for anyone else, this patch saves the first netdev name we find for the device, and returns that if we fail to find a netdev with the desired phys_port_id.
-
- 12 8月, 2017 3 次提交
-
-
由 Laine Stump 提交于
Mellanox ConnectX-3 dual port SRIOV NICs present a bit of a challenge when assigning one of their VFs to a guest using VFIO device assignment. These NICs have only a single PCI PF device, and that single PF has two netdevs sharing the single PCI address - one for port 1 and one for port 2. When a VF is created it can also have 2 netdevs, or it can be setup in "single port" mode, where the VF has only a single netdev, and that netdev is connected either to port 1 or to port 2. When the VF is created in dual port mode, you get/set the MAC address/vlan tag for the port 1 VF by sending a netlink message to the PF's port1 netdev, and you get/set the MAC address/vlan tag for the port 2 VF by sending a netlink message to the PF's port 2 netdev. (Of course libvirt doesn't have any way to describe MAC/vlan info for 2 ports in a single hostdev interface, so that's a bit of a moot point) When the VF is created in single port mode, you can *set* the MAC/vlan info by sending a netlink message to *either* PF netdev - the driver is smart enough to understand that there's only a single netdev, and set the MAC/vlan for that netdev. When you want to *get* it, however, the driver is more accurate - it will return 00:00:00:00:00:00 for the MAC if you request it from the port 1 PF netdev when the VF was configured to be single port on port 2, or if you request if from the port 2 PF netdev when the VF was configured to be single port on port 1. Based on this information, when *getting* the MAC/vlan info (to save the original setting prior to assignment), we determine the correct PF netdev by matching phys_port_id between VF and PF. (IMPORTANT NOTE: this implies that to do PCI device assignment of the VFs on dual port Mellanox cards using <interface type='hostdev'> (i.e. if you want the MAC address/vlan tag to be set), not only must the VFs be configured in single port mode, but also the VFs *must* be bound to the host VF net driver, and libvirt must use managed='yes') By the time libvirt is ready to set the new MAC/vlan tag, the VF has already been unbound from the host net driver and bound to vfio-pci. This isn't problematic though because, as stated earlier, when a VF is created in single port mode, commands to configure it can be sent to either the port 1 PF netdev or the port 2 PF netdev. When it is time to restore the original MAC/vlan tag, again the VF will *not* be bound to a host net driver, so it won't be possible to learn from sysfs whether to use the port 1 or port 2 PF netdev for the netlink commands. And again, it doesn't matter which netdev you use. However, we must keep in mind that we saved the original settings to a file called "${PF}_${VFNUM}". To solve this problem, we just check for the existence of ${PF1}_${VFNUM} and ${PF2}_${VFNUM}, and use whichever one we find (since we know that only one can be there)
-
由 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 提交于
The first arg isn't modified in the function, so it should be const.
-
- 18 5月, 2017 1 次提交
-
-
Commit 8e09663f "pci: recognize/report GEN4 (PCIe 4.0) card 16GT/s Link speed" introduced another speed into enum, but mistakenly also altered field width, so one bit of link width was included there. Signed-off-by: NMarek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
-
- 27 4月, 2017 1 次提交
-
-
由 Wang King 提交于
Commit @a7035662 forgot to remove it when doing a refactor. Signed-off-by: NErik Skultety <eskultet@redhat.com>
-
- 14 4月, 2017 1 次提交
-
-
由 Shivaprasad G Bhat 提交于
Without this added enum value, nodedev-dumpxml of a GEN4 (PCIe 4.0) card will fail (due to the unrecognized link speed), and since nodedev-detach and nodedev-reattach internally do a dumpxml+parse, they will also fail. With this patch, all those operations succeed. Signed-off-by: NShivaprasad G Bhat <sbhat@linux.vnet.ibm.com>
-
- 26 3月, 2017 1 次提交
-
-
由 Roman Bogorodskiy 提交于
virPCIGetDeviceAddressFromSysfsLink() should return virPCIDeviceAddressPtr, so return NULL in the stub instead of "-1".
-
- 24 3月, 2017 3 次提交
-
-
由 Laine Stump 提交于
This function unbinds a device from its driver, then immediately rebinds it to its driver again. The code for this new function is just the 2nd half of virPCIDeviceBindWithDriverOverride(), so that function's 2nd half is replaced with a call to virPCIDeviceRebind().
-
由 Laine Stump 提交于
This function will be useful in virnetdev.c, so promote it from static.
-
由 Laine Stump 提交于
...and cleanup the callers to report it when it *is* an error. In many cases It's useful for virPCIGetNetName() to not log an error and simply return a NULL pointer when the given device isn't bound to a net driver (e.g. we're looking at a VF that is permanently bound to vfio-pci). The existing code would silently return an error in this case, which could eventually lead to the dreaded "An error occurred but the cause is unknown" log message. This patch changes virPCIGetNetName() to still return success if the device simply isn't bound to a net driver, and adjusts all the callers that require a non-null netname to check for that condition and log an error when it happens.
-
- 24 1月, 2017 1 次提交
-
-
由 Shivaprasad G Bhat 提交于
It is destructive to attempt reset on a pci- or cardbus-bridge, the host can crash. The bridges won't contain any guest data and neither they can be passed through using vfio/stub. So, no point in allowing a reset on them. Signed-off-by: NShivaprasad G Bhat <sbhat@linux.vnet.ibm.com>
-
- 01 12月, 2016 1 次提交
-
-
由 Laine Stump 提交于
The path to the config file for a PCI device is conventiently stored in a virPCIDevice object, but that object's contents aren't directly visible outside of virpci.c, so we need to have an accessor function for it if anyone needs to look at it.
-
- 03 9月, 2016 1 次提交
-
-
由 Jim Fehlig 提交于
libvirt uses the new_id PCI sysfs interface to bind a PCI stub driver to a PCI device. The new_id interface is known to be buggy and racey, hence a more deterministic interface was introduced in the 3.12 kernel: driver_override. For more details see https://www.redhat.com/archives/libvir-list/2016-June/msg02124.html For more details about the driver_override interface and examples of its usage, see https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/drivers/pci/pci-driver.c?h=v3.12&id=782a985d7af26db39e86070d28f987cad21313c0 This patch adds support for the driver_override interface by - adding new virPCIDevice{BindTo,UnbindFrom}StubWithOverride functions that use the driver_override interface - renames the existing virPCIDevice{BindTo,UnbindFrom}Stub functions to virPCIDevice{BindTo,UnbindFrom}StubWithNewid to perserve existing behavior on new_id interface - changes virPCIDevice{BindTo,UnbindFrom}Stub function to call one of the above depending on availability of driver_override The patch includes a bit of duplicate code, but allows for easily dropping the new_id code once support for older kernels is no longer desired. Signed-off-by: NJim Fehlig <jfehlig@suse.com>
-
- 24 6月, 2016 4 次提交
-
-
由 Ján Tomko 提交于
Remove all the remaining usage of opendir.
-
由 Ján Tomko 提交于
Switch from opendir to virDirOpen everywhere we need to report an error.
-
由 Ján Tomko 提交于
The directories we iterate over are unlikely to contain any entries starting with a dot, other than '.' and '..' which is already skipped by virDirRead.
-
由 Ján Tomko 提交于
It skips those directory entries.
-