1. 04 12月, 2018 11 次提交
    • H
      net: phy: improve generic EEE ethtool functions · d1420bb9
      Heiner Kallweit 提交于
      So far the two functions consider neither member eee_enabled nor
      eee_active. Therefore network drivers have to do this in some kind
      of glue code. I think this can be avoided.
      
      Getting EEE parameters:
      When not advertising any EEE mode, we can't consider EEE to be enabled.
      Therefore interpret "EEE enabled" as "we advertise at least one EEE
      mode". It's similar with "EEE active": interpret it as "EEE modes
      advertised by both link partner have at least one mode in common".
      
      Setting EEE parameters:
      If eee_enabled isn't set, don't advertise any EEE mode and restart
      aneg if needed to switch off EEE. If eee_enabled is set and
      data->advertised is empty (e.g. because EEE was disabled), advertise
      everything we support as default. This way EEE can easily switched
      on/off by doing ethtool --set-eee <if> eee on/off, w/o any additional
      parameters.
      
      The changes to both functions shouldn't break any existing user.
      Once the changes have been applied, at least some users can be
      simplified.
      Signed-off-by: NHeiner Kallweit <hkallweit1@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      d1420bb9
    • D
      Merge branch 'VXLAN-underlay-VRF' · 79dfab43
      David S. Miller 提交于
      Alexis Bauvin says:
      
      ====================
      net: Add VRF support for VXLAN underlay
      
      v6 -> v7:
      - proper locking for device in udp_tunnel following Sabrina Dubroca's advice
      
      v5 -> v6:
      - remove automatic rebinding patch following Roopa Prabhu's advice
      
      v4 -> v5:
      - move test script to its own patch (6/6)
      - add schematic for test script
      - apply David Ahern comments to the test script
      
      v3 -> v4:
      - rename vxlan_is_in_l3mdev_chain to netdev_is_upper master
      - move it to net/core/dev.c
      - make it return bool instead of int
      - check if remote_ifindex is zero before resolving the l3mdev
      - add testing script
      
      v2 -> v3:
      - fix build when CONFIG_NET_IPV6 is off
      - fix build "unused l3mdev_master_upper_ifindex_by_index" build error with some
        configs
      
      v1 -> v2:
      - move vxlan_get_l3mdev from vxlan driver to l3mdev driver as
        l3mdev_master_upper_ifindex_by_index
      - vxlan: rename variables named l3mdev_ifindex to ifindex
      
      v0 -> v1:
      - fix typos
      
      We are trying to isolate the VXLAN traffic from different VMs with VRF as shown
      in the schemas below:
      
      +-------------------------+   +----------------------------+
      | +----------+            |   |     +------------+         |
      | |          |            |   |     |            |         |
      | | tap-red  |            |   |     |  tap-blue  |         |
      | |          |            |   |     |            |         |
      | +----+-----+            |   |     +-----+------+         |
      |      |                  |   |           |                |
      |      |                  |   |           |                |
      | +----+---+              |   |      +----+----+           |
      | |        |              |   |      |         |           |
      | | br-red |              |   |      | br-blue |           |
      | |        |              |   |      |         |           |
      | +----+---+              |   |      +----+----+           |
      |      |                  |   |           |                |
      |      |                  |   |           |                |
      |      |                  |   |           |                |
      | +----+--------+         |   |     +--------------+       |
      | |             |         |   |     |              |       |
      | |  vxlan-red  |         |   |     |  vxlan-blue  |       |
      | |             |         |   |     |              |       |
      | +------+------+         |   |     +-------+------+       |
      |        |                |   |             |              |
      |        |           VRF  |   |             |          VRF |
      |        |           red  |   |             |         blue |
      +-------------------------+   +----------------------------+
               |                                  |
               |                                  |
       +---------------------------------------------------------+
       |       |                                  |              |
       |       |                                  |              |
       |       |         +--------------+         |              |
       |       |         |              |         |              |
       |       +---------+  eth0.2030   +---------+              |
       |                 |  10.0.0.1/24 |                        |
       |                 +-----+--------+                    VRF |
       |                       |                            green|
       +---------------------------------------------------------+
                               |
                               |
                          +----+---+
                          |        |
                          |  eth0  |
                          |        |
                          +--------+
      
      iproute2 commands to reproduce the setup:
      
      ip link add green type vrf table 1
      ip link set green up
      ip link add eth0.2030 link eth0 type vlan id 2030
      ip link set eth0.2030 master green
      ip addr add 10.0.0.1/24 dev eth0.2030
      ip link set eth0.2030 up
      
      ip link add blue type vrf table 2
      ip link set blue up
      ip link add br-blue type bridge
      ip link set br-blue master blue
      ip link set br-blue up
      ip link add vxlan-blue type vxlan id 2 local 10.0.0.1 dev eth0.2030 \
       port 4789
      ip link set vxlan-blue master br-blue
      ip link set vxlan-blue up
      ip link set tap-blue master br-blue
      ip link set tap-blue up
      
      ip link add red type vrf table 3
      ip link set red up
      ip link add br-red type bridge
      ip link set br-red master red
      ip link set br-red up
      ip link add vxlan-red type vxlan id 3 local 10.0.0.1 dev eth0.2030 \
       port 4789
      ip link set vxlan-red master br-red
      ip link set vxlan-red up
      ip link set tap-red master br-red
      ip link set tap-red up
      
      We faced some issue in the datapath, here are the details:
      
      * Egress traffic:
      The vxlan packets are sent directly to the default VRF because it's where the
      socket is bound, therefore the traffic has a default route via eth0. the
      workaround is to force this traffic to VRF green with ip rules.
      
      * Ingress traffic:
      When receiving the traffic on eth0.2030 the vxlan socket is unreachable from
      VRF green. The workaround is to enable *udp_l3mdev_accept* sysctl, but
      this breaks isolation between overlay and underlay: packets sent from
      blue or red by e.g. a guest VM will be accepted by the socket, allowing
      injection of VXLAN packets from the overlay.
      
      This patch series fixes the issues describe above by allowing VXLAN socket to be
      bound to a specific VRF device therefore looking up in the correct table.
      ====================
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      79dfab43
    • A
      test/net: Add script for VXLAN underlay in a VRF · 03f1c26b
      Alexis Bauvin 提交于
      This script tests the support of a VXLAN underlay in a non-default VRF.
      
      It does so by simulating two hypervisors and two VMs, an extended L2
      between the VMs with the hypervisors as VTEPs with the underlay in a
      VRF, and finally by pinging the two VMs.
      
      It also tests that moving the underlay from a VRF to another works when
      down/up the VXLAN interface.
      Signed-off-by: NAlexis Bauvin <abauvin@scaleway.com>
      Reviewed-by: NAmine Kherbouche <akherbouche@scaleway.com>
      Reviewed-by: NDavid Ahern <dsahern@gmail.com>
      Tested-by: NAmine Kherbouche <akherbouche@scaleway.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      03f1c26b
    • A
      vxlan: add support for underlay in non-default VRF · aab8cc36
      Alexis Bauvin 提交于
      Creating a VXLAN device with is underlay in the non-default VRF makes
      egress route lookup fail or incorrect since it will resolve in the
      default VRF, and ingress fail because the socket listens in the default
      VRF.
      
      This patch binds the underlying UDP tunnel socket to the l3mdev of the
      lower device of the VXLAN device. This will listen in the proper VRF and
      output traffic from said l3mdev, matching l3mdev routing rules and
      looking up the correct routing table.
      
      When the VXLAN device does not have a lower device, or the lower device
      is in the default VRF, the socket will not be bound to any interface,
      keeping the previous behaviour.
      
      The underlay l3mdev is deduced from the VXLAN lower device
      (IFLA_VXLAN_LINK).
      
      +----------+                         +---------+
      |          |                         |         |
      | vrf-blue |                         | vrf-red |
      |          |                         |         |
      +----+-----+                         +----+----+
           |                                    |
           |                                    |
      +----+-----+                         +----+----+
      |          |                         |         |
      | br-blue  |                         | br-red  |
      |          |                         |         |
      +----+-----+                         +---+-+---+
           |                                   | |
           |                             +-----+ +-----+
           |                             |             |
      +----+-----+                +------+----+   +----+----+
      |          |  lower device  |           |   |         |
      |   eth0   | <- - - - - - - | vxlan-red |   | tap-red | (... more taps)
      |          |                |           |   |         |
      +----------+                +-----------+   +---------+
      Signed-off-by: NAlexis Bauvin <abauvin@scaleway.com>
      Reviewed-by: NAmine Kherbouche <akherbouche@scaleway.com>
      Reviewed-by: NDavid Ahern <dsahern@gmail.com>
      Tested-by: NAmine Kherbouche <akherbouche@scaleway.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      aab8cc36
    • A
      l3mdev: add function to retreive upper master · 6a6d6681
      Alexis Bauvin 提交于
      Existing functions to retreive the l3mdev of a device did not walk the
      master chain to find the upper master. This patch adds a function to
      find the l3mdev, even indirect through e.g. a bridge:
      
      +----------+
      |          |
      | vrf-blue |
      |          |
      +----+-----+
           |
           |
      +----+-----+
      |          |
      | br-blue  |
      |          |
      +----+-----+
           |
           |
      +----+-----+
      |          |
      |   eth0   |
      |          |
      +----------+
      
      This will properly resolve the l3mdev of eth0 to vrf-blue.
      Signed-off-by: NAlexis Bauvin <abauvin@scaleway.com>
      Reviewed-by: NAmine Kherbouche <akherbouche@scaleway.com>
      Reviewed-by: NDavid Ahern <dsahern@gmail.com>
      Tested-by: NAmine Kherbouche <akherbouche@scaleway.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      6a6d6681
    • A
      udp_tunnel: add config option to bind to a device · da5095d0
      Alexis Bauvin 提交于
      UDP tunnel sockets are always opened unbound to a specific device. This
      patch allow the socket to be bound on a custom device, which
      incidentally makes UDP tunnels VRF-aware if binding to an l3mdev.
      Signed-off-by: NAlexis Bauvin <abauvin@scaleway.com>
      Reviewed-by: NAmine Kherbouche <akherbouche@scaleway.com>
      Tested-by: NAmine Kherbouche <akherbouche@scaleway.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      da5095d0
    • D
      Merge branch 'mlxsw-fw_load_policy' · e3dd7627
      David S. Miller 提交于
      Ido Schimmel says:
      
      ====================
      mlxsw: Add 'fw_load_policy' devlink parameter
      
      Shalom says:
      
      Currently, drivers do not have the ability to control the firmware
      loading policy and they always use their own fixed policy. This prevents
      drivers from running the device with a different firmware version for
      testing and/or debugging purposes. For example, testing a firmware bug
      fix.
      
      For these situations, the new devlink generic parameter,
      'fw_load_policy', gives the ability to control this option and allows
      drivers to run with a different firmware version than required by the
      driver.
      
      Patch #1 adds the new parameter to devlink. The other two patches, #2
      and #3, add support for this parameter in the mlxsw driver.
      
      Example:
        # Query the devlink parameters supported by the device
          $ devlink dev param show
          pci/0000:03:00.0:
            name fw_load_policy type generic
              values:
                cmode driverinit value driver
      
        # Flash new firmware using ethtool
          $ ethtool -f swp1 mellanox/mlxsw_spectrum-13.1703.4.mfa2
      
        # Toggle parameter
          $ devlink dev param set pci/0000:03:00.0 name fw_load_policy value flash cmode driverinit
      
        # devlink reset
          $ devlink dev reload pci/0000:03:00.0
      
        # Query firmware version to show changes took affect
          $ ethtool -i swp1
          driver: mlxsw_spectrum
          version: 1.0
          firmware-version: 13.1703.4
          expansion-rom-version:
          bus-info: 0000:03:00.0
          supports-statistics: yes
          supports-test: no
          supports-eeprom-access: no
          supports-register-dump: no
          supports-priv-flags: no
      
      iproute2 patches available here:
      https://github.com/tshalom/iproute2-next
      
      v2:
      * Change 'fw_version_check' to 'fw_load_policy' with values 'driver' and
        'flash' (Jakub)
      ====================
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      e3dd7627
    • S
      mlxsw: spectrum: Load firmware version based on devlink parameter · 064501c5
      Shalom Toledo 提交于
      Load firmware version based on 'fw_load_policy' devlink parameter. The
      driver supports these two options:
          * DEVLINK_PARAM_FW_LOAD_POLICY_VALUE_DRIVER (0)
            Default, load firmware version preferred by the driver
          * DEVLINK_PARAM_FW_LOAD_POLICY_VALUE_FLASH (1)
            Load firmware currently stored in flash
      
      The second option, 'flash', allow the device to run with different firmware
      version than preferred by the driver for testing and/or debugging purposes.
      For example, testing a firmware bug fix.
      Signed-off-by: NShalom Toledo <shalomt@mellanox.com>
      Reviewed-by: NJiri Pirko <jiri@mellanox.com>
      Signed-off-by: NIdo Schimmel <idosch@mellanox.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      064501c5
    • S
      mlxsw: core: Reset firmware after flash during driver initialization · 03bffcad
      Shalom Toledo 提交于
      After flashing new firmware during the driver initialization flow (reload
      or not), the driver should do a firmware reset when it gets -EAGAIN in
      order to load the new one.
      Signed-off-by: NShalom Toledo <shalomt@mellanox.com>
      Reviewed-by: NJiri Pirko <jiri@mellanox.com>
      Signed-off-by: NIdo Schimmel <idosch@mellanox.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      03bffcad
    • S
      devlink: Add 'fw_load_policy' generic parameter · 846e980a
      Shalom Toledo 提交于
      Many drivers load the device's firmware image during the initialization
      flow either from the flash or from the disk. Currently this option is not
      controlled by the user and the driver decides from where to load the
      firmware image.
      
      'fw_load_policy' gives the ability to control this option which allows the
      user to choose between different loading policies supported by the driver.
      
      This parameter can be useful while testing and/or debugging the device. For
      example, testing a firmware bug fix.
      Signed-off-by: NShalom Toledo <shalomt@mellanox.com>
      Reviewed-by: NJiri Pirko <jiri@mellanox.com>
      Signed-off-by: NIdo Schimmel <idosch@mellanox.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      846e980a
    • H
      net: phy: don't allow __set_phy_supported to add unsupported modes · 6915bf3b
      Heiner Kallweit 提交于
      Currently __set_phy_supported allows to add modes w/o checking whether
      the PHY supports them. This is wrong, it should never add modes but
      only remove modes we don't want to support.
      Signed-off-by: NHeiner Kallweit <hkallweit1@gmail.com>
      Reviewed-by: NAndrew Lunn <andrew@lunn.ch>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      6915bf3b
  2. 01 12月, 2018 29 次提交