1. 16 Dec, 2011 5 commits
  2. 15 Dec, 2011 7 commits
  3. 14 Dec, 2011 7 commits
  4. 13 Dec, 2011 21 commits
    • David S. Miller's avatar
      ipv6: Check dest prefix length on original route not copied one in rt6_alloc_cow(). · bb3c3686
      David S. Miller authored
      After commit 8e2ec639 ("ipv6: don't
      use inetpeer to store metrics for routes.") the test in rt6_alloc_cow()
      for setting the ANYCAST flag is now wrong.
      
      'rt' will always now have a plen of 128, because it is set explicitly
      to 128 by ip6_rt_copy.
      
      So to restore the semantics of the test, check the destination prefix
      length of 'ort'.
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      bb3c3686
    • David S. Miller's avatar
      ipv6: If neigh lookup fails during icmp6 dst allocation, propagate error. · b43faac6
      David S. Miller authored
      Don't just succeed with a route that has a NULL neighbour attached.
      This follows the behavior of addrconf_dst_alloc().
      
      Allowing this kind of route to end up with a NULL neigh attached will
      result in packet drops on output until the route is somehow
      invalidated, since nothing will meanwhile try to lookup the neigh
      again.
      
      A statistic is bumped for the case where we see a neigh-less route on
      output, but the resulting packet drop is otherwise silent in nature,
      and frankly it's a hard error for this to happen and ipv6 should do
      what ipv4 does which is say something in the kernel logs.
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      b43faac6
    • David S. Miller's avatar
      net: Remove unused neighbour layer ops. · 5c3ddec7
      David S. Miller authored
      It's simpler to just keep these things out until there is a real user
      of them, so we can see what the needs actually are, rather than keep
      these things around as useless overhead.
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      5c3ddec7
    • Yevgeny Petrilin's avatar
    • Yevgeny Petrilin's avatar
    • Jack Morgenstein's avatar
      mlx4_core: Modify driver initialization flow to accommodate SRIOV for Ethernet · ab9c17a0
      Jack Morgenstein authored
      1. Added module parameters sr_iov and probe_vf for controlling enablement of
         SRIOV mode.
      2. Increased default max num-qps, num-mpts and log_num_macs to accomodate
         SRIOV mode
      3. Added port_type_array as a module parameter to allow driver startup with
         ports configured as desired.
         In SRIOV mode, only ETH is supported, and this array is ignored; otherwise,
         for the case where the FW supports both port types (ETH and IB), the
         port_type_array parameter is used.
         By default, the port_type_array is set to configure both ports as IB.
      4. When running in sriov mode, the master needs to initialize the ICM eq table
         to hold the eq's for itself and also for all the slaves.
      5. mlx4_set_port_mask() now invoked from mlx4_init_hca, instead of in mlx4_dev_cap.
      6. Introduced sriov VF (slave) device startup/teardown logic (mainly procedures
         mlx4_init_slave, mlx4_slave_exit, mlx4_slave_cap, mlx4_slave_exit and flow
         modifications in __mlx4_init_one, mlx4_init_hca, and mlx4_setup_hca).
         VFs obtain their startup information from the PF (master) device via the
         comm channel.
      7. In SRIOV mode (both PF and VF), MSI_X must be enabled, or the driver
         aborts loading the device.
      8. Do not allow setting port type via sysfs when running in SRIOV mode.
      9. mlx4_get_ownership:  Currently, only one PF is supported by the driver.
         If the HCA is burned with FW which enables more than one PF, only one
         of the PFs is allowed to run.  The first one up grabs a FW ownership
         semaphone -- all other PFs will find that semaphore taken, and the
         driver will not allow them to run.
      Signed-off-by: default avatarJack Morgenstein <jackm@dev.mellanox.co.il>
      Signed-off-by: default avatarYevgeny Petrilin <yevgenyp@mellanox.co.il>
      Signed-off-by: default avatarLiran Liss <liranl@mellanox.co.il>
      Signed-off-by: default avatarMarcel Apfelbaum <marcela@mellanox.co.il>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      ab9c17a0
    • Jack Morgenstein's avatar
      mlx4_core: adjust catas operation for SRIOV mode · d81c7186
      Jack Morgenstein authored
      When running in SRIOV mode, driver should not automatically start/stop
      the mlx4_core upon sensing an HCA internal error -- doing this disables/enables
      sriov, which will cause the hypervisor to hang if there are running VMs with
      attached VFs.
      
      In addition, on VMs the catas process should not run at all, since the HCA
      error buffer is not available to VMs in the BARs.
      Signed-off-by: default avatarJack Morgenstein <jackm@dev.mellanox.co.il>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      d81c7186
    • Marcel Apfelbaum's avatar
      mlx4_core: mtts resources units changed to offset · 2b8fb286
      Marcel Apfelbaum authored
      In the previous implementation mtts are managed by:
      1. order     - log(mtt segments), 'mtt segment' groups several mtts together.
      2. first_seg - segment location relative to mtt table.
      In the current implementation:
      1. order     - log(mtts) rather than segments
      2. offset    - mtt index in mtt table
      
      Note: The actual mtt allocation is made in segments but it is
            transparent to callers.
      
      Rational: The mtt resource holders are not interested on how the allocation
                of mtt is done, but rather on how they will use it.
      Signed-off-by: default avatarMarcel Apfelbaum <marcela@dev.mellanox.co.il>
      Reviewed-by: default avatarJack Morgenstein <jackm@dev.mellanox.co.il>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      2b8fb286
    • Eugenia Emantayev's avatar
      mlx4_en: Allow communication between functions on same host · 5b4c4d36
      Eugenia Emantayev authored
      To enable internal loopback, always fill DMAC in control segment
      when transmitting the packet, once this is done, the packet is subject
      for loopback for if the DMAC mathces one of the multicast/unicast addresses
      registered on the physical port.
      In receive path if source MAC is our own MAC and we are not in selftest,
      or not in force LB mode - drop this packet.
      Signed-off-by: default avatarEugenia Emantayev <eugenia@mellanox.co.il>
      Signed-off-by: default avatarYevgeny Petrilin <yevgenyp@mellanox.co.il>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      5b4c4d36
    • Eugenia Emantayev's avatar
      mlx4: Ethernet port management modifications · ffe455ad
      Eugenia Emantayev authored
      The physical port is now common to the PF and VFs.
      The port resources and configuration is managed by the PF, VFs can
      only influence the MTU of the port, it is set as max among all functions,
      Each function allocates RX buffers of required size to meet it's MTU enforcement.
      Port management code was moved to mlx4_core, as the mlx4_en module is
      virtualization unaware
      
      Move handling qp functionality to mlx4_get_eth_qp/mlx4_put_eth_qp
      including reserve/release range and add/release unicast steering.
      Let mlx4_register/unregister_mac deal only with MAC (un)registration.
      Signed-off-by: default avatarEugenia Emantayev <eugenia@mellanox.co.il>
      Signed-off-by: default avatarYevgeny Petrilin <yevgenyp@mellanox.co.il>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      ffe455ad
    • Eugenia Emantayev's avatar
      mlx4: Traffic steering management support for SRIOV · 0ec2c0f8
      Eugenia Emantayev authored
      Let multicast/unicast attaching flow go through resource tracker.
      The PF is the one responsible for managing all the steering entries.
      Define and use module parameter that determines the number of qps
      per multicast group.
      Minor changes in function calls according to changed prototype.
      Signed-off-by: default avatarEugenia Emantayev <eugenia@mellanox.co.il>
      Signed-off-by: default avatarYevgeny Petrilin <yevgenyp@mellanox.co.il>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      0ec2c0f8
    • Jack Morgenstein's avatar
    • Eli Cohen's avatar
      mlx4_core: resource tracking for HCA resources used by guests · c82e9aa0
      Eli Cohen authored
      The resource tracker is used to track usage of HCA resources by the different
      guests.
      
      Virtual functions (VFs) are attached to guest operating systems but
      resources are allocated from the same pool and are assigned to VFs. It is
      essential that hostile/buggy guests not be able to affect the operation of
      other VFs, possibly attached to other guest OSs since ConnectX firmware is not
      tolerant to misuse of resources.
      
      The resource tracker module associates each resource with a VF and maintains
      state information for the allocated object. It also defines allowed state
      transitions and enforces them.
      
      Relationships between resources are also referred to. For example, CQs are
      pointed to by QPs, so it is forbidden to destroy a CQ if a QP refers to it.
      
      ICM memory is always accessible through the primary function and hence it is
      allocated by the owner of the primary function.
      
      When a guest dies, an FLR is generated for all the VFs it owns and all the
      resources it used are freed.
      
      The tracked resource types are: QPs, CQs, SRQs, MPTs, MTTs, MACs, RES_EQs,
      and XRCDNs.
      Signed-off-by: default avatarEli Cohen <eli@mellanox.co.il>
      Signed-off-by: default avatarJack Morgenstein <jackm@dev.mellanox.co.il>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      c82e9aa0
    • Jack Morgenstein's avatar
      mlx4_core: Add wrapper functions and comm channel and slave event support to EQs · acba2420
      Jack Morgenstein authored
      Passing async events to slaves:
      In SRIOV mode, each slave creates its own async EQ, but only the master can
      register directly with the FW to receive async events.  Async events which
      should be passed to slaves (such as a WQ_ACCESS_ERROR for a QP owned by a slave)
      are generated at the slave by the master using the GEN_EQE FW command.
      
      Wrapper functions: mlx4_MAP_EQ_wrapper
      Only the master can map an EQ. The slave commands to map their EQs arrive
      at the master via the comm channel.  The master then invokes the wrapper
      function to do the work (and enter the resource in the tracking database).
      
      New events: COMM_CHANNEL and FLR
      The COMM_CHANNEL event arrives only at the master, and signals that
      a slave has posted a command on the comm channel.
      The FLR event is generated by the FW when a guest operating a VF
      unexpectedly goes down.
      Signed-off-by: default avatarJack Morgenstein <jackm@dev.mellanox.co.il>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      acba2420
    • Jack Morgenstein's avatar
      mlx4_core: mtt modifications for SRIOV · ea51b377
      Jack Morgenstein authored
      MTTs are resources which are allocated and tracked by the PF driver.
      In multifunction mode, the allocation and icm mapping is done in
      the resource tracker (later patch in this sequence).
      
      To accomplish this, we have "work" functions whose names start with
      "__", and "request" functions (same name, no __). If we are operating
      in multifunction mode, the request function actually results in
      comm-channel commands being sent (ALLOC_RES or FREE_RES).
      The PF-driver comm-channel handler will ultimately invoke the
      "work" (__) function and return the result.
      
      If we are not in multifunction mode, the "work" handler is invoked
      immediately.
      Signed-off-by: default avatarJack Morgenstein <jackm@dev.mellanox.co.il>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      ea51b377
    • Jack Morgenstein's avatar
      mlx4_core: cq modifications for SRIOV · d7233386
      Jack Morgenstein authored
      CQs are resources which are allocated and tracked by the PF driver.
      In multifunction mode, the allocation and icm mapping is done in
      the resource tracker (later patch in this sequence).
      
      To accomplish this, we have "work" functions whose names start with
      "__", and "request" functions (same name, no __). If we are operating
      in multifunction mode, the request function actually results in
      comm-channel commands being sent (ALLOC_RES or FREE_RES).
      The PF-driver comm-channel handler will ultimately invoke the
      "work" (__) function and return the result.
      
      If we are not in multifunction mode, the "work" handler is invoked
      immediately.
      Signed-off-by: default avatarJack Morgenstein <jackm@dev.mellanox.co.il>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      d7233386
    • Jack Morgenstein's avatar
      mlx4_core: qp modifications for SRIOV · fe9a2603
      Jack Morgenstein authored
      QPs are resources which are allocated and tracked by the PF driver.
      In multifunction mode, the allocation and icm mapping is done in
      the resource tracker (later patch in this sequence).
      
      To accomplish this, we have "work" functions whose names start with
      "__", and "request" functions (same name, no __). If we are operating
      in multifunction mode, the request function actually results in
      comm-channel commands being sent (ALLOC_RES or FREE_RES).
      The PF-driver comm-channel handler will ultimately invoke the
      "work" (__) function and return the result.
      
      If we are not in multifunction mode, the "work" handler is invoked
      immediately.
      Signed-off-by: default avatarJack Morgenstein <jackm@dev.mellanox.co.il>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      fe9a2603
    • Jack Morgenstein's avatar
      mlx4_core: srq modifications for SRIOV · 3ec65b2b
      Jack Morgenstein authored
      SRQs are resources which are allocated and tracked by the PF driver.
      In multifunction mode, the allocation and icm mapping is done in
      the resource tracker (later patch in this sequence).
      
      To accomplish this, we have "work" functions whose names start with
      "__", and "request" functions (same name, no __). If we are operating
      in multifunction mode, the request function actually results in
      comm-channel commands being sent (ALLOC_RES or FREE_RES).
      The PF-driver comm-channel handler will ultimately invoke the
      "work" (__) function and return the result.
      
      If we are not in multifunction mode, the "work" handler is invoked
      immediately.
      Signed-off-by: default avatarJack Morgenstein <jackm@dev.mellanox.co.il>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      3ec65b2b
    • Marcel Apfelbaum's avatar
      mlx4_core: Added FW commands and their wrappers for supporting SRIOV · 5cc914f1
      Marcel Apfelbaum authored
      The following commands are added here:
      1. QUERY_FUNC_CAP and its wrapper.  This function is used by VFs when
         they start up to receive configuration information from the PF, such
         as resource quotas for this VF, which ports should be used (currently
         two), what protocol is running on the port (currently Ethernet ONLY,
         or port not active).
      
      2. QUERY_PORT and its wrapper. Previously, this FW command was invoked directly
         by the ETH driver (en_port.c) using mlx4_cmd_box. Virtualization is now
         required here (the VF's MAC address must be substituted for the PFs
         MAC address returned by the FW). We changed the invocation
         in the ETH driver to use mlx4_QUERY_PORT, and added the wrapper.
      
      3. QUERY_HCA. Used by the VF to determine how the HCA was initialized.
         For now, we need only the multicast table member entry size
         (log2_mc_table_entry_sz, in the ConnectX PRM).  No wrapper is needed
         here, because the data may be passed as is to the VF without modification).
      
         In this command, we have added a GLOBAL_CAPS field for passing required
         configuration information from FW to a VF (this field is to allow safely
                         adding new SRIOV capabilities which require support in VF drivers, too).
         Bits will set here by FW in response to PF-driver configuration commands which
         will activate as yet undefined new SRIOV features. The VF will test to see that
         all required capabilities indicated by this field are supported (i.e., if a bit
         is set and the VF driver does not recognize that bit, it must abort
         its initialization).  Currently, no bits are set.
      
      4. Added a CLOSE_PORT wrapper.  The PF context needs to keep track of how many VF contexts
         have the port open.  The PF context will not actually issue the FW close port command
         until the last port user issues a CLOSE_PORT request.
      Signed-off-by: default avatarJack Morgenstein <jackm@dev.mellanox.co.il>
      Signed-off-by: default avatarYevgeny Petrilin <yevgenyp@mellanox.co.il>
      Signed-off-by: default avatarMarcel Apfelbaum <marcela@mellanox.co.il>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      5cc914f1
    • Yevgeny Petrilin's avatar
      net/mlx4_core: Implement the master-slave communication channel · e8f081aa
      Yevgeny Petrilin authored
      When SRIOV is enabled, pf and vfs communicate via shared comm channel.
      The vf gets its side of the comm channel via a VF BAR.
      Each VF (slave) creates its vHCR (virtual HCA Command Register),
      Its DMA address is passed to the PF (master) using Communication Channel Register.
      The same Register is used to notify the master of commands posted by the
      slaves and for the master to pass events to the slaves, such as command completions
      and asynchronous events.
      
      The vHCR format is identical to the HCR format, except for the 'go' and 't' bits,
      which are reserved in the vHCR. Posting commands to the vHCR is identical to
      the way it is done with the HCR, albeit that the function/PF token fields are
      used instead of the HCR go bit.
      Specifically:
      - When the function prepares a new command in the vHCR, it issues the Post_vHCR_cmd
        communication channel command and toggles the value of the function token;
        when PF token has an equal value, the command has been accepted and a new command may be posted.
      - When the PF detects a Post_vHCR_cmd command, it concludes that a new command is available in the vHCR;
        after processing the command, the PF toggles the PF token to match the function token.
      
      When the 'e' bit is not set, the completion of a Post_vHCR_cmd command also indicates
      the completion the vHCR command. If, however, the 'e' bit is set, the completion of a
      Post_vHCR_cmd command only indicates that the vHCR command has been accepted for execution by the PF.
      
      Function commands are processed by the PF as follows:
      -DMA (using the ACCESS_MEM command) the vHCR image into a shadow buffer.
      -Validate that the opcode is non-privileged, and that the opcode- and input-modifiers are legal.
      -DMA the in-box (if required) into a shadow buffer.
      -Validate the command:
      	o Resource ranges (e.g., QP ranges).
      	o Partition key.
      	o Ranges of referenced resources (e.g., CQs within QP contexts).
      -If the 'e' bit is set
      	o complete the Post_vHCR_cmd command
      -Execute the command on the HCR.
      -DMA the results to the vHCR out-box (if required).
      -If the 'e' bit is set
      	o Indicate command completion by generating a completion event using the GEN_EQE command
      -Otherwise
      	o DMA the command status to the vHCR
      	o Complete the Post_vHCR_cmd command
      Signed-off-by: default avatarJack Morgenstein <jackm@dev.mellanox.co.il>
      Signed-off-by: default avatarYevgeny Petrillin <yevgenyp@mellanox.com>
      Signed-off-by: default avatarLiran Liss <liranl@mellanox.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      e8f081aa
    • Jack Morgenstein's avatar
      mlx4_core: Reduce number of PD bits to 17 · f5311ac1
      Jack Morgenstein authored
      When SRIOV is enabled on the chip (at FW burning time),
      the HCA uses only 17 bits for the PD. The remaining 7 high-order bits
      are ignored.
      
      Change the allocator to return only 17 bits for the PD.  The MSB 7
      bits will be used to encode the slave number for consistency
      checking later on in the resource tracker.
      Signed-off-by: default avatarJack Morgenstein <jackm@dev.mellanox.co.il>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      f5311ac1