1. 10 5月, 2015 25 次提交
    • S
      sfc: Bind the sfc driver to any available VF's · 6f7f8aa6
      Shradha Shah 提交于
      Add the device ID of the VF to the PCI device ID table.
      
      Added a boolean flag is_vf in efx_nic_type to differentiate
      between a VF and PF at probe time. This flag is useful in later
      patches while setting MAC address specially in the
      PCI-passthrough case.
      Signed-off-by: NShradha Shah <sshah@solarflare.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      6f7f8aa6
    • J
      sfc: Add use of shared RSS contexts. · 267c0157
      Jon Cooper 提交于
      Allow PFs to allocate shared RSS contexts if we exhaust our
      exclusive RSS contexts. Make VFs use shared RSS contexts in
      all cases.
      Spruce up error handling so that the shadow copy of the RSS
      table is updated after successful update, rather than in all
      cases, so that we report the actual contents of the RSS table
      after a failure to set it, rather than what we'd like it to be.
      
      Populate context_size parameter when vacuously allocating RSS
      context of size 1.
      Signed-off-by: NShradha Shah <sshah@solarflare.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      267c0157
    • E
      sfc: Cope with permissions enforcement added to firmware for SR-IOV · 267d9d73
      Edward Cree 提交于
      * Accept EPERM in some simple cases, the following cases are handled:
      1) efx_mcdi_read_assertion()
      Unprivileged PCI functions aren't allowed to GET_ASSERTS.
      We return success as it's up to the primary PF to deal with asserts.
      2) efx_mcdi_mon_probe() in efx_ef10_probe()
      Unprivileged PCI functions aren't allowed to read sensor info, and
      worrying about sensor data is the primary PF's job.
      3) phy_op->reconfigure() in efx_init_port() and efx_reset_up()
      Unprivileged functions aren't allowed to MC_CMD_SET_LINK, they just have
      to accept the settings (including flow-control, which is what
      efx_init_port() is worried about) they've been given.
      4) Fallback to GET_WORKAROUNDS in efx_ef10_probe()
      Unprivileged PCI functions aren't allowed to set workarounds. So if
      efx_mcdi_set_workaround() fails EPERM, use efx_mcdi_get_workarounds()
      to find out if workaround_35388 is enabled.
      5) If DRV_ATTACH gets EPERM, try without specifying fw-variant
      Unprivileged PCI functions have to use a FIRMWARE_ID of 0xffffffff
      (MC_CMD_FW_DONT_CARE).
      6) Don't try to exit_assertion unless one had fired
      Previously we called efx_mcdi_exit_assertion even if
      efx_mcdi_read_assertion had received MC_CMD_GET_ASSERTS_FLAGS_NO_FAILS.
      This is unnecessary, and the resulting MC_CMD_REBOOT, even if the
      AFTER_ASSERTION flag made it a no-op, would fail EPERM for unprivileged
      PCI functions.
      So make efx_mcdi_read_assertion return whether an assert happened, and only
      call efx_mcdi_exit_assertion if it has.
      Signed-off-by: NShradha Shah <sshah@solarflare.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      267d9d73
    • S
      sfc: manually allocate and free vadaptors · 7b8c7b54
      Shradha Shah 提交于
      To be able to use MC_CMD_VADAPTOR_SET_MAC, vadaptors must be
      manually allocated and freed as automatic vadaptors will disappear
      when their reference_count reaches zero, which must happen before
      the MAC address is changed.
      
      Vadaptors are allocated and freed in the vswitching_probe/remove
      functions for PFs and VFs, and this means that vadaptors are restored
      correctly following an MC reboot or other reset when required.
      Signed-off-by: NShradha Shah <sshah@solarflare.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      7b8c7b54
    • S
      sfc: create vports for VFs and assign random MAC addresses · 3c5eb876
      Shradha Shah 提交于
      The parent PF creates vports for all its child VFs and adds MAC
      addresses to these.  When the VF driver loads, it can make an MCDI
      call to get the MAC address that the parent PF assigned it.
      
      The parent PF also assigns a mac address to its own vport because
      implicit creation of a vAdaptor will only work on evb ports with
      MAC addresses assigned.
      
      The vport MAC address needs to be stored in the PF's nic_data
      struct as it can later be changed on the vadaptor (and its net_dev
      struct). When removing a vport the original MAC address must be
      deleted.
      
      A new flag is needed in the VF data structure to identify whether
      a vport has been assigned to the VF.  This is to determine whether
      it needs to be un-assigned before freeing the vport.  Also,
      attempting to un-assign a vport which is not assigned will result
      in an EALREADY error.
      Signed-off-by: NShradha Shah <sshah@solarflare.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      3c5eb876
    • S
      sfc: Prepare to bind the sfc driver to the VF. · 02246a7f
      Shradha Shah 提交于
      Added efx_nic_type structure for VF.
      Mapped a different BAR for VF as it uses BAR 0 for memory.
      Added functions sriov_init and sriov_fini.
      Signed-off-by: NShradha Shah <sshah@solarflare.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      02246a7f
    • D
      sfc: get the PF number and record in nic_data · 1cd9ecbb
      Daniel Pieczko 提交于
      Use MC_CMD_GET_FUNCTION_INFO to record the PF number in nic_data.
      This will be needed when assigned vports to VFs.
      Signed-off-by: NShradha Shah <sshah@solarflare.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      1cd9ecbb
    • D
      sfc: create VEB vswitch and vport above default firmware setup · 6d8aaaf6
      Daniel Pieczko 提交于
      Adds functions to allocate and free vswitches and vports; vadaptors
      are automatically allocated and freed when TX/RX queues are
      initialised and finalised.  This vswitching structure is only created
      if the firmware supports it, so a check that full-featured firmware
      is running is performed first.
      
      If the MC resets, the vswitching infrastructure will need to be
      recreated, so mark the "must_probe_vswitching" flag when an MC reboot
      is detected.
      
      Don't try to create a vswitch if vf-count=0
      
      This allocation of vswitches and vports does not currently support
      configuring VLAN tags, but that can be added in a future change.
      Signed-off-by: NShradha Shah <sshah@solarflare.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      6d8aaaf6
    • D
      sfc: record the PF's vport ID in nic_data · 45b2449e
      Daniel Pieczko 提交于
      The default port ID of EVB_PORT_ID_ASSIGNED is a "magic" number
      for the MCFW to select the physical port of the PF.  If other
      vswitches and vports are created on top of the default firmware
      configuration, the ID of the newly created vport is then required
      when passed to MCDI commands.  Currently, this doesn't happen so
      the vport_id is never changed, but a subsequent patch will change
      this behaviour so that other vswitches and vports are created.
      
      The vport_id recorded in nic_data is only relevant for PFs.
      VFs will have their vports created by their parent PF, and in
      that case the parent PF will record the vport ID of each VF.
      For a VF, nic_data->vport_id is expected to remain at the default
      value.
      Signed-off-by: NShradha Shah <sshah@solarflare.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      45b2449e
    • D
      sfc: Record [rt]x_dpcpu_fw_id in EF10 nic_data · 8d9f9dd4
      Daniel Pieczko 提交于
      The (future) code to add/remove vswitches and vports will be
      dependent on the firmware variant.
      To simplify the checking of the firmware variant, record
      values for rx_dpcpu_fw_id and tx_dpcpu_fw_id in EF10 nic_data.
      
      There was only one place where this was previously used:
      efx_mcdi_print_fwver() in ethtool.c.
      The MC_CMD_GET_CAPABILITIES can be replaced and the values from
      nic_data used instead.
      
      Note that the printing of "?" if the MC command fails or if the
      outlength is incorrect no longer apply, because errors are returned
      in efx_ef10_init_datapath_caps() in both of these cases.
      Signed-off-by: NShradha Shah <sshah@solarflare.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      8d9f9dd4
    • S
      sfc: Use MCDI to set FILTER_OP_IN_TX_DOMAIN · e3d36293
      Shradha Shah 提交于
      The TX_DOMAIN field is currently reserved but its safer to set
      it to 0 for future compatibility.
      Signed-off-by: NShradha Shah <sshah@solarflare.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      e3d36293
    • S
      sfc: Enable VF's via a write to the sysfs file sriov_numvfs · 834e23dd
      Shradha Shah 提交于
      This patch adds support for the use of sriov_configure on EF10
      to enable Virtual Functions while the driver is loaded.
      Signed-off-by: NShradha Shah <sshah@solarflare.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      834e23dd
    • D
      sfc: Move and rename efx_vf struct to siena_vf · bf3d0156
      Daniel Pieczko 提交于
      The efx_vf struct contains Siena-specific fields for VFs,
      so rename to siena_vf.
      Also move it into the siena_nic_data struct, as EF10 will
      track its VFs in its own ef10_nic_data, storing much less
      information about them since VFDI is no longer used.
      Signed-off-by: NShradha Shah <sshah@solarflare.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      bf3d0156
    • S
      sfc: Own header for nic-specific sriov functions, single instance of... · 7fa8d547
      Shradha Shah 提交于
      sfc: Own header for nic-specific sriov functions, single instance of netdev_ops and sriov removed from Falcon code
      
      By putting all the efx_{siena,ef10}_sriov_* declarations in
      {siena,ef10}_sriov.h, ensure they cannot be called from nic-generic code.
      Also fixes up an instance of this, where mcdi.c was calling
      efx_siena_sriov_flr.
      
      The single instance of netdev_ops should call general high level
      functions that can then call something adapter specific in efx_nic_type.
      We should only do adapter specialisation via efx_nic_type.
      
      Removal of sriov functionality from the Falcon code means that tests
      are needed for the presence of some callbacks.
      Signed-off-by: NShradha Shah <sshah@solarflare.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      7fa8d547
    • D
      Merge branch 'dsa-next' · f926204b
      David S. Miller 提交于
      Andrew Lunn says:
      
      ====================
      More Marvell DSA refactring and fixup
      
      This patch setup continues the refactoring and cleanup of the Marvell
      DSA drivers.
      
      Patch #1 Centralizes the duplicated parts of port setup and global
      setup into the shared mv88e6xxx.
      
      Patch #2 Centralizes looping over the ports setting them up
      
      Patch #3 Uses mnemonics for the remaining register access in the
      drivers.
      
      Patch #4 The 6172 is actually a member of the 6352 family. This moves
      the probe code into the correct driver.
      
      Patch #5 Adds more members of the 6171 family to the 6171 driver. The
      new devices are untested.
      
      Patch #6 The 6185 is a member of the 6131 family. Add it to the probe
      code of the 6131 driver.
      
      Patch #7 and Patch #8 Simply the mutex's in mv88e6xxx.c. The SMI bus
      is the bottleneck, not the granularity of the mutex's so simply the
      code down to a single mutex.
      
      Patch #8 Fixes a false positive lockdep splat, due to nested uses of
      MDIO busses.
      
      Patch #9 Fixes another false positive lockdep splat with the transmit
      queue because of stacked Ethernet devices.
      ====================
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      f926204b
    • A
      net: dsa: Add lockdep class to tx queues to avoid lockdep splat · 448b4482
      Andrew Lunn 提交于
      DSA stacks an Ethernet device on top of an Ethernet device. This can
      cause false positive lockdep splats for the transmit queue:
      Acked-by: NFlorian Fainelli <f.fainelli@gmail.com>
      
      =============================================
      [ INFO: possible recursive locking detected ]
      4.0.0-rc7-01838-g70621a215fc7 #386 Not tainted
      ---------------------------------------------
      kworker/0:0/4 is trying to acquire lock:
       (_xmit_ETHER#2){+.-...}, at: [<c040e95c>] sch_direct_xmit+0xa8/0x1fc
      
      but task is already holding lock:
       (_xmit_ETHER#2){+.-...}, at: [<c03f4208>] __dev_queue_xmit+0x4d4/0x56c
      
      other info that might help us debug this:
       Possible unsafe locking scenario:
      
             CPU0
             ----
        lock(_xmit_ETHER#2);
        lock(_xmit_ETHER#2);
      
      To avoid this, walk the tq queues of the dsa slaves and set a lockdep
      class.
      Signed-off-by: NAndrew Lunn <andrew@lunn.ch>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      448b4482
    • A
      net: dsa: mv88e6xxx: Fix false positive lockdep splat · 16fe24fc
      Andrew Lunn 提交于
      DSA can have nested MDIO busses, where the Ethernet MDIO bus is used
      to access an MDIO bus within the switch which has the PHYs connected
      to it. This nesting causes lockdep to give false positives. Use
      mutex_lock_nested() to avoid this.
      Signed-off-by: NAndrew Lunn <andrew@lunn.ch>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      16fe24fc
    • A
      net: dsa: mv88e6xxx: Replace stats mutex with SMI mutex · 31888234
      Andrew Lunn 提交于
      The SMI bus is the bottleneck in all switch operations, not the
      granularity of locks. Replace the stats mutex by the SMI mutex to make
      the locking concept simpler.
      
      The REG_READ/REG_WRITE macros cannot be used while holding the SMI
      mutex, since they try to acquire it. Replace with calls to the
      appropriate function which does not try to get the mutex.
      Signed-off-by: NAndrew Lunn <andrew@lunn.ch>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      31888234
    • A
      net: dsa: mv88e6xxx: Replace PHY mutex by SMI mutex · 3898c148
      Andrew Lunn 提交于
      The SMI bus is the bottleneck in all switch operations, not the
      granularity of locks. Replace the PHY mutex by the SMI mutex to make
      the locking concept simpler.
      
      The REG_READ/REG_WRITE macros cannot be used while holding the SMI
      mutex, since they try to acquire it. Replace with calls to the
      appropriate function which does not try to get the mutex.
      Signed-off-by: NAndrew Lunn <andrew@lunn.ch>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      3898c148
    • A
      net: dsa: mv88e6131: Add support for mv88e6185 · 1441f4e5
      Andrew Lunn 提交于
      The mv88e6185 is part of the family that the mv88e6131 driver
      supports. Add it to the probe function, and set the number of ports.
      Signed-off-by: NAndrew Lunn <andrew@lunn.ch>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      1441f4e5
    • A
      net: dsa: mv88e6171: Add other members of the family · eee7483e
      Andrew Lunn 提交于
      The 6171 is one member of the family 6171/6175/6350/6351. Add the
      other family members to the driver.
      
      Not tested on these new devices.
      Signed-off-by: NAndrew Lunn <andrew@lunn.ch>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      eee7483e
    • A
      net: dsa: Move mv88e6172 support into mv88e6352 family driver · 1636d883
      Andrew Lunn 提交于
      The mv88e6172 is part of the mv88e6352 family of devices. Move support
      for it out of the mv88e6171 driver into the mv88e6352, which results
      in some simplifications to the code.
      Signed-off-by: NAndrew Lunn <andrew@lunn.ch>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      1636d883
    • A
      net: dsa: Converting remaining registers to mnemonics · 15966a2a
      Andrew Lunn 提交于
      Use defines for registers, shifts and bits in the remaining register
      accesses in the individual drivers, in order to aid readability.
      Signed-off-by: NAndrew Lunn <andrew@lunn.ch>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      15966a2a
    • A
      net: dsa: Centralize setting up ports · dbde9e66
      Andrew Lunn 提交于
      Now that setting up a port is identical for all switches, centralisers
      the code looping over all the ports to set them up.
      Signed-off-by: NAndrew Lunn <andrew@lunn.ch>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      dbde9e66
    • A
      net: dsa: Centralise global and port setup code into mv88e6xxx. · 54d792f2
      Andrew Lunn 提交于
      The port setup code in the individual drivers is identical for 6123,
      6171, and 6352, and very similar in 6131. Move it all into mv88e6xxx,
      using the chip families to differentiate on features.
      
      Similarly, the global setup is also very similar. Move the majority
      into mv8e6xxx.
      
      The chips themselves fall into families. Add helpers which uses the
      device IDs to determine if a device is a member of a family or not.
      Add some additional device IDs to the existing list, to make these
      helper functions more complete. However these IDs are not yet added to
      the probe functions.
      Signed-off-by: NAndrew Lunn <andrew@lunn.ch>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      54d792f2
  2. 06 5月, 2015 15 次提交