1. 23 1月, 2019 2 次提交
  2. 14 12月, 2018 1 次提交
    • D
      Remove all Author(s): lines from source file headers · 60046283
      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>
      60046283
  3. 24 9月, 2018 1 次提交
  4. 21 9月, 2018 1 次提交
  5. 17 9月, 2018 2 次提交
  6. 12 9月, 2018 1 次提交
  7. 07 9月, 2018 1 次提交
  8. 05 9月, 2018 1 次提交
    • A
      util: Drop virPCIGetAddrString() · ca7ad978
      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>
      ca7ad978
  9. 08 8月, 2018 1 次提交
  10. 07 8月, 2018 1 次提交
    • S
      util: netdev: Define cleanup function using VIR_DEFINE_AUTOPTR_FUNC · 7b706f33
      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>
      7b706f33
  11. 23 7月, 2018 3 次提交
  12. 03 7月, 2018 1 次提交
  13. 20 1月, 2018 1 次提交
    • J
      nodedev: Fix failing to parse PCI address for non-PCI network devices · 71d56a39
      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
      71d56a39
  14. 03 11月, 2017 1 次提交
    • A
      Remove backslash alignment attempts · 3e7db8d3
      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>
      3e7db8d3
  15. 14 10月, 2017 1 次提交
    • J
      nodedev: Fix missing network devices · ac7cc624
      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.
      ac7cc624
  16. 22 9月, 2017 1 次提交
  17. 19 9月, 2017 1 次提交
    • J
      configure: fix check for DEVLINK_CMD_ESWITCH_GET · cdd6eb99
      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.
      cdd6eb99
  18. 18 9月, 2017 1 次提交
  19. 14 8月, 2017 1 次提交
  20. 12 8月, 2017 5 次提交
    • L
      util: check for PF online status earlier in guest startup · 489a937e
      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
      489a937e
    • L
      util: restructure virNetDevReadNetConfig() to eliminate false error logs · 9a081683
      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.
      9a081683
    • L
      util: match phys_port_id when converting PF-netdev to/from VF-netdev · 39d136b6
      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.
      39d136b6
    • L
      util: make virPCIGetNetName() more versatile · b3b5aa75
      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.
      b3b5aa75
    • L
      util: new function virNetDevGetPhysPortID() · 48f33bb5
      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.
      48f33bb5
  21. 16 6月, 2017 1 次提交
  22. 24 4月, 2017 1 次提交
    • R
      util: relax virNetDevSetCoalesce() stub · 5e010605
      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.
      5e010605
  23. 21 4月, 2017 3 次提交
    • L
      util: allow ignoring SIOCSIFHWADDR when errno is EPERM · 997134fb
      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)
      997134fb
    • D
      util: fix virNetDevSetCoalesce fallback on Win32/FreeBSD · e6625ed4
      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>
      e6625ed4
    • M
      util: Add virNetDevSetCoalesce function · 652ef9bc
      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>
      652ef9bc
  24. 28 3月, 2017 3 次提交
  25. 27 3月, 2017 4 次提交
    • L
      util: log all setting of MAC addresses and vlan tags · 6ec36b06
      Laine Stump 提交于
      Having this information available will make it easier to determine the
      culprit when MAC or vlan tag appear to not be set, eg.:
      
        https://bugzilla.redhat.com/1364073
      
      (This patch doesn't fix that bug, just makes it easier to diagnose)
      6ec36b06
    • L
      util: try *really* hard to set the MAC address of an SRIOV VF · 86556e16
      Laine Stump 提交于
      If an SRIOV VF has previously been used for VFIO device assignment,
      the "admin MAC" that is stored in the PF driver's table of VF info
      will have been set to the MAC address that the virtual machine wanted
      the device to have. Setting the admin MAC for a VF also sets a flag in
      the PF that is loosely called the "administratively set" flag. Once
      that flag is set, it is no longer possible for the net driver of the
      VF (either on the host or in a virtual machine) to directly set the
      VF's MAC again; this flag isn't reset until the *PF* driver is
      restarted, and that requires taking *all* VFs offline, so it's not
      really feasible to do.
      
      If the same SRIOV VF is later used for macvtap passthrough mode, the
      VF's MAC address must be set, but normally we don't unbind the VF from
      its host net driver (since we actually need the host net driver in
      this case). Since setting the VF MAC directly will fail, in the past
      "we" ("I") had tried to fix the problem by simply setting the admin MAC
      (via the PF) instead. This *appeared* to work (and might have at one
      time, due to promiscuous mode being turned on somewhere or something),
      but it currently creates a non-working interface because only the
      value for admin MAC is set to the desired value, *not* the actual MAC
      that the VF is using.
      
      Earlier patches in this series reverted that behavior, so that we once
      again set the MAC of the VF itself for macvtap passthrough operation,
      not the admin MAC. But that brings back the original bug - if the
      interface has been used for VFIO device assignment, you can no longer
      use it for macvtap passthrough.
      
      This patch solves that problem by noticing when virNetDevSetMAC()
      fails for a VF, and in that case it sets the desired MAC to the admin
      MAC via the PF, then "bounces" the VF driver (by unbinding and the
      immediately rebinding it to the VF). This causes the VF's MAC to be
      reinitialized from the admin MAC, and everybody is happy (until the
      *next* time someone wants to set the VF's MAC address, since the
      "administratively set" bit is still turned on).
      86556e16
    • L
      util: if setting admin MAC to 00:00:00:00:00:00 fails, try 02:00:00:00:00:00 · d5f4abef
      Laine Stump 提交于
      Some PF drivers allow setting the admin MAC (that is the MAC address
      that the VF will be initialized to the next time the VF's driver is
      loaded) to 00:00:00:00:00:00, and some don't. Multiple drivers
      initialize the admin MACs to all 0, but don't allow setting it to that
      very same value. It has been an uphill battle convincing the driver
      people that it's reasonable to expect The argument that's used is
      that an all 0 device MAC address on a device is invalid; however, from
      an outsider's point of view, when the admin MAC is set to 0 at the
      time the VF driver is loaded, the VF's MAC is *not* set to 0, but to a
      random non-0 value. But that's beside the point - even if I could
      convince one or two SRIOV driver maintainers to permit setting the
      admin MAC to 0, there are still several other drivers.
      
      So rather than fighting that losing battle, this patch checks for a
      failure to set the admin MAC due to an all 0 value, and retries it
      with 02:00:00:00:00:00. That won't result in a random value being set
      in the VF MAC at next VF driver init, but that's okay, because we
      always want to set a specific value anyway. Rather, the "almost 0"
      setting makes it easy to visually detect from the output of "ip link
      show" which VFs are currently in use and which are free.
      d5f4abef
    • L
      util: remove unused functions from virnetdev.c · bc4168f3
      Laine Stump 提交于
      The global functions virNetDevReplaceMacAddress(),
      virNetDevReplaceNetConfig(), virNetDevRestoreMacAddress(), and
      virNetDevRestoreNetConfig() are no longer used, as their functionality
      has been replaced by virNetDev(Save|Read|Set)NetConfig().
      
      The static functions virNetDevReplaceVfConfig() and
      virNetDevRestoreVfConfig() were only used by the above-named global
      functions that were removed.
      bc4168f3