1. 25 Apr, 2017 21 commits
  2. 21 Apr, 2017 19 commits
    • Noa Osherovich's avatar
      IB/mlx5: Add support for active_width and active_speed in RoCE · f1b65df5
      Noa Osherovich authored
      Add missing calculation and translation of active_width and
      active_speed for RoCE.
      
      Fixes: 3f89a643 ('IB/mlx5: Extend query_device/port to ...')
      Signed-off-by: default avatarNoa Osherovich <noaos@mellanox.com>
      Signed-off-by: default avatarEran Ben Elisha <eranbe@mellanox.com>
      Signed-off-by: default avatarLeon Romanovsky <leon@kernel.org>
      Signed-off-by: default avatarDoug Ledford <dledford@redhat.com>
      f1b65df5
    • Noa Osherovich's avatar
      IB/mlx5: Set mlx5_query_roce_port's return value to void · 50f22fd8
      Noa Osherovich authored
      In case of an error, the properties reported to user
      are zeroed out, so no need for a return value.
      Signed-off-by: default avatarNoa Osherovich <noaos@mellanox.com>
      Signed-off-by: default avatarLeon Romanovsky <leon@kernel.org>
      Signed-off-by: default avatarDoug Ledford <dledford@redhat.com>
      50f22fd8
    • Noa Osherovich's avatar
      IB/core: Add HDR speed enum · 12113a35
      Noa Osherovich authored
      Add high data rate speed to the ib_port_speed enumeration.
      Signed-off-by: default avatarNoa Osherovich <noaos@mellanox.com>
      Signed-off-by: default avatarEran Ben Elisha <eranbe@mellanox.com>
      Signed-off-by: default avatarLeon Romanovsky <leon@kernel.org>
      Signed-off-by: default avatarDoug Ledford <dledford@redhat.com>
      12113a35
    • Moni Shoua's avatar
      IB/mlx5: Set correct SL in completion for RoCE · 12f8fede
      Moni Shoua authored
      There is a difference when parsing a completion entry between Ethernet
      and IB ports. When link layer is Ethernet the bits describe the type of
      L3 header in the packet. In the case when link layer is Ethernet and VLAN
      header is present the value of SL is equal to the 3 UP bits in the VLAN
      header. If VLAN header is not present then the SL is undefined and consumer
      of the completion should check if IB_WC_WITH_VLAN is set.
      
      While that, this patch also fills the vlan_id field in the completion if
      present.
      Signed-off-by: default avatarMoni Shoua <monis@mellanox.com>
      Reviewed-by: default avatarMajd Dibbiny <majd@mellanox.com>
      Signed-off-by: default avatarLeon Romanovsky <leon@kernel.org>
      Signed-off-by: default avatarDoug Ledford <dledford@redhat.com>
      12f8fede
    • Moni Shoua's avatar
      IB/cma: Send MRA for reply messages · 61c0ddbe
      Moni Shoua authored
      Current implementation of RDMA_CM sends MRA (Message Receipt
      Acknowledgment) only for request messages but not for response messages.
      
      As a result, a slow active side of the connection may send a ready-to-use
      message to the passive side in a delay that is too long for the passive
      side to wait for.
      
      This patch adds a call to ib_send_cm_mra() upon receiving a response
      message and by this tells the other side to modify the service timeout
      to a bigger value, 16 times than before. As in the request case, MRA
      for reply will be sent only if a duplicate response has arrived.
      Signed-off-by: default avatarMoni Shoua <monis@mellanox.com>
      Reviewed-by: default avatarMatan Barak <matan@mellanox.com>
      Signed-off-by: default avatarLeon Romanovsky <leon@kernel.org>
      Signed-off-by: default avatarDoug Ledford <dledford@redhat.com>
      61c0ddbe
    • Parav Pandit's avatar
      IB/mlx5: Support congestion related counters · e1f24a79
      Parav Pandit authored
      This patch adds support to query the congestion related hardware counters
      through new command and links them with other hw counters being available
      in hw_counters sysfs location.
      
      In order to reuse existing infrastructure it renames related q_counter
      data structures to more generic counters to reflect q_counters and
      congestion counters and maybe some other counters in the future.
      
      New hardware counters:
       * rp_cnp_handled - CNP packets handled by the reaction point
       * rp_cnp_ignored - CNP packets ignored by the reaction point
       * np_cnp_sent    - CNP packets sent by notification point to respond to
                           CE marked RoCE packets
       * np_ecn_marked_roce_packets - CE marked RoCE packets received by
                                      notification point
      
      It also avoids returning ENOSYS which is specific for invalid
      system call and produces the following checkpatch.pl warning.
      
      WARNING: ENOSYS means 'invalid syscall nr' and nothing else
      +		return -ENOSYS;
      Signed-off-by: default avatarParav Pandit <parav@mellanox.com>
      Reviewed-by: default avatarEli Cohen <eli@mellanox.com>
      Reviewed-by: default avatarDaniel Jurgens <danielj@mellanox.com>
      Signed-off-by: default avatarLeon Romanovsky <leon@kernel.org>
      Signed-off-by: default avatarDoug Ledford <dledford@redhat.com>
      e1f24a79
    • Leon Romanovsky's avatar
      IB/mthca: Check validity of output parameter pointer · a43402af
      Leon Romanovsky authored
      The mthca driver didn't check supplied pointer to functions
      mthca_cmd_poll() and mthca_cmd_wait(). This caused to the following
      smatch errors:
      
      drivers/infiniband/hw/mthca/mthca_cmd.c:371 mthca_cmd_poll() error: we previously assumed 'out_param' could be null (see line 353)
      drivers/infiniband/hw/mthca/mthca_cmd.c:454 mthca_cmd_wait() error: we previously assumed 'out_param' could be null (see line 432)
      
      In reality all callers of these functions are setting out_is_imm
      flag are providing pointer too. However it is better to check
      again to remove smatch errors to achieve warning free subsystem.
      Signed-off-by: default avatarLeon Romanovsky <leon@kernel.org>
      Signed-off-by: default avatarDoug Ledford <dledford@redhat.com>
      a43402af
    • Slava Shwartsman's avatar
      IB/mlx5: Add drop flow steering rule support · a22ed86c
      Slava Shwartsman authored
      A drop rule is described by an action drop and no destination.
      If a user specified IB_FLOW_SPEC_ACTION_DROP then set the action
      to MLX5_FLOW_CONTEXT_ACTION_DROP and clear the destination.
      Signed-off-by: default avatarSlava Shwartsman <slavash@mellanox.com>
      Reviewed-by: default avatarMaor Gottlieb <maorg@mellanox.com>
      Signed-off-by: default avatarLeon Romanovsky <leon@kernel.org>
      Signed-off-by: default avatarDoug Ledford <dledford@redhat.com>
      a22ed86c
    • Slava Shwartsman's avatar
      IB/core: Introduce drop flow specification · 483a3966
      Slava Shwartsman authored
      This flow steering specification identifies flow for drop by the HW.
      If user create a flow only with the drop specification,
      then all the packets that hit this flow will be dropped, otherwise the HW
      will drop only the packets that match the other L2/L3/L4 specifications.
      Signed-off-by: default avatarSlava Shwartsman <slavash@mellanox.com>
      Reviewed-by: default avatarMaor Gottlieb <maorg@mellanox.com>
      Signed-off-by: default avatarLeon Romanovsky <leon@kernel.org>
      Signed-off-by: default avatarDoug Ledford <dledford@redhat.com>
      483a3966
    • Ariel Levkovich's avatar
      IB/mlx5: Use IP version matching to classify IP traffic · 19cc7524
      Ariel Levkovich authored
      This change adds the ability for flow steering to classify IPv4/6
      packets with MPLS tag (Ethertype 0x8847 and 0x8848) as standard IP
      packets and hit IPv4/6 classifed steering rules.
      
      When user added a flow rule with IP classification, driver was
      implicitly adding ethertype matching to the created rule in order
      to distinguish between IPv4 and IPv6 protocols.
      Since IP packets with MPLS tag header have MPLS ethertype, they missed
      the rule and ended up hitting the default filters.
      Such behavior prevented from MPLS packets to undergo inbound traffic
      load balancing flows (if such were defined by configuring RSS) to
      achieve higher throughput - the way that non-MPLS IP packets performed.
      
      Since our device is able to look past the MPLS tag and identify the
      next protocol we introduce this solution which replaces Ethertype
      matching by the device's capability to perform IP version parsing
      and matching in order to distinguish between IPv4 and IPv6.
      Therefore, whenever a flow with IP spec is added and device support IP
      version matching, driver will implicitly add IP version matching to the
      rule (Based on the IP spec type) without Ethertype matching which will
      cause relevant MPLS tagged packets to hit this rule as well.
      Otherwise (device doesn't support IP version matching), we fall back to
      setting Ethertype matching.
      
      If the user's filters specify an L2 ethertype and an IP spec
      the rule will then match both the ethertype and the IP version.
      
      The device's support for IP version matching is reported by the
      device via dedicated capability bit in query_device_cap and named
      outer/inner_ip_version.
      Signed-off-by: default avatarAriel Levkovich <lariel@mellanox.com>
      Signed-off-by: default avatarLeon Romanovsky <leon@kernel.org>
      Signed-off-by: default avatarDoug Ledford <dledford@redhat.com>
      19cc7524
    • Ariel Levkovich's avatar
      IB/mlx5: Add inner spec and IPv6 validation in user's flow attribute list · 0f750966
      Ariel Levkovich authored
      This change fixes an incomplete validation of the user's
      flow attributes list.
      
      Previous implementation validated only matching of IPv4 Ethertype
      to IPv4 spec of outer headers (in case both Ethernet with specified
      Ethertype and IP specs were present) and lacked the validation of:
      1. Matching of IPv6 Ethertype in Ethernet spec (if such exists) to an
         IPv6 protocol spec (if such exists).
      2. Validation of Ethertype to IP protocol matching on inner headers specs.
      Which could cause some combinations of unmatching Ethernet and IP
      protocols to pass validation and apply on the device.
      
      The fix adds validation of IPv6 Ethertype and IP spec as well as
      performing the scan on both outer and inner attributes.
      
      Fixes: 038d2ef8 ("Add flow steering support")
      Signed-off-by: default avatarAriel Levkovich <lariel@mellanox.com>
      Signed-off-by: default avatarLeon Romanovsky <leon@kernel.org>
      Signed-off-by: default avatarDoug Ledford <dledford@redhat.com>
      0f750966
    • Bodong Wang's avatar
      IB/mlx5: Fix wrong use of kfree at bad flow in create_cq_user · 44f2e99e
      Bodong Wang authored
      The kfree was called to free cqb, while it should free *cqb.
      
      Fixes: 1cbe6fc8 ("IB/mlx5: Add support for CQE compressing")
      Signed-off-by: default avatarBodong Wang <bodong@mellanox.com>
      Signed-off-by: default avatarLeon Romanovsky <leon@kernel.org>
      Signed-off-by: default avatarDoug Ledford <dledford@redhat.com>
      44f2e99e
    • Maor Gottlieb's avatar
      IB/mlx5: Enlarge autogroup flow table · 00b7c2ab
      Maor Gottlieb authored
      In order to enlarge the flow group size to 8k, we decrease
      the number of flow group types to 6 and increase the flow
      table size to 64k.
      
      Flow group size is calculated as follow:
        group_size = table_size / (#group_types + 1)
      
      Fixes: 038d2ef8 ('IB/mlx5: Add flow steering support')
      Signed-off-by: default avatarMaor Gottlieb <maorg@mellanox.com>
      Signed-off-by: default avatarLeon Romanovsky <leon@kernel.org>
      Signed-off-by: default avatarDoug Ledford <dledford@redhat.com>
      00b7c2ab
    • Maor Gottlieb's avatar
      IB/mlx5: Check supported flow table size · dac388ef
      Maor Gottlieb authored
      Check that the required flow table size is supported
      by device. Return ENOMEM error if no space left.
      
      In addition change the create flow table routine
      to return ENOMEM instead of ENOSPC.
      
      Fixes: 038d2ef8 ('IB/mlx5: Add flow steering support')
      Signed-off-by: default avatarMaor Gottlieb <maorg@mellanox.com>
      Signed-off-by: default avatarLeon Romanovsky <leon@kernel.org>
      Signed-off-by: default avatarDoug Ledford <dledford@redhat.com>
      dac388ef
    • Maor Gottlieb's avatar
      IB/mlx5: Change vma from shared to private · 13776612
      Maor Gottlieb authored
      Anonymous VMA (->vm_ops == NULL) cannot be shared, otherwise
      it would lead to SIGBUS.
      
      Remove the shared flags from the vma after we change it to be
      anonymous.
      
      This is easily reproduced by doing modprobe -r while running a
      user-space application such as raw_ethernet_bw.
      
      Fixes: 7c2344c3 ('IB/mlx5: Implements disassociate_ucontext API')
      Signed-off-by: default avatarMaor Gottlieb <maorg@mellanox.com>
      Signed-off-by: default avatarLeon Romanovsky <leon@kernel.org>
      Signed-off-by: default avatarDoug Ledford <dledford@redhat.com>
      13776612
    • Maor Gottlieb's avatar
      IB/mlx5: Take write semaphore when changing the vma struct · ecc7d83b
      Maor Gottlieb authored
      When the driver disassociate user context, it changes the vma to
      anonymous by setting the vm_ops to null and zap the vma ptes.
      
      In order to avoid race in the kernel, we need to take write lock
      before we change the vma entries.
      
      Fixes: 7c2344c3 ('IB/mlx5: Implements disassociate_ucontext API')
      Signed-off-by: default avatarMaor Gottlieb <maorg@mellanox.com>
      Signed-off-by: default avatarLeon Romanovsky <leon@kernel.org>
      Signed-off-by: default avatarDoug Ledford <dledford@redhat.com>
      ecc7d83b
    • Maor Gottlieb's avatar
      IB/mlx4: Change vma from shared to private · ca37a664
      Maor Gottlieb authored
      Anonymous VMA (->vm_ops == NULL) cannot be shared, otherwise
      it would lead to SIGBUS.
      
      Remove the shared flags from the vma after we change it to be
      anonymous.
      
      This is easily reproduced by doing modprobe -r while running a
      user-space application such as raw_ethernet_bw.
      
      Fixes: ae184dde ('IB/mlx4_ib: Disassociate support')
      Signed-off-by: default avatarMaor Gottlieb <maorg@mellanox.com>
      Signed-off-by: default avatarLeon Romanovsky <leon@kernel.org>
      Signed-off-by: default avatarDoug Ledford <dledford@redhat.com>
      ca37a664
    • Maor Gottlieb's avatar
      IB/mlx4: Take write semaphore when changing the vma struct · 22c3653d
      Maor Gottlieb authored
      When the driver disassociate user context, it changes the vma to
      anonymous by setting the vm_ops to null and zap the vma ptes.
      
      In order to avoid race in the kernel, we need to take write lock
      before we change the vma entries.
      
      Fixes: ae184dde ('IB/mlx4_ib: Disassociate support')
      Signed-off-by: default avatarMaor Gottlieb <maorg@mellanox.com>
      Signed-off-by: default avatarLeon Romanovsky <leon@kernel.org>
      Signed-off-by: default avatarDoug Ledford <dledford@redhat.com>
      22c3653d
    • Jack Morgenstein's avatar
      IB/mlx4: Reduce SRIOV multicast cleanup warning message to debug level · fb7a9174
      Jack Morgenstein authored
      A warning message during SRIOV multicast cleanup should have actually been
      a debug level message. The condition generating the warning does no harm
      and can fill the message log.
      
      In some cases, during testing, some tests were so intense as to swamp the
      message log with these warning messages, causing a stall in the console
      message log output task. This stall caused an NMI to be sent to all CPUs
      (so that they all dumped their stacks into the message log).
      Aside from the message flood causing an NMI, the tests all passed.
      
      Once the message flood which caused the NMI is removed (by reducing the
      warning message to debug level), the NMI no longer occurs.
      
      Sample message log (console log) output illustrating the flood and
      resultant NMI (snippets with comments and modified with ... instead
      of hex digits, to satisfy checkpatch.pl):
      
       <mlx4_ib> _mlx4_ib_mcg_port_cleanup: ... WARNING: group refcount 1!!!...
       *** About 4000 almost identical lines in less than one second ***
       <mlx4_ib> _mlx4_ib_mcg_port_cleanup: ... WARNING: group refcount 1!!!...
       INFO: rcu_sched detected stalls on CPUs/tasks: { 17} (...)
       *** { 17} above indicates that CPU 17 was the one that stalled ***
       sending NMI to all CPUs:
       ...
       NMI backtrace for cpu 17
       CPU: 17 PID: 45909 Comm: kworker/17:2
       Hardware name: HP ProLiant DL360p Gen8, BIOS P71 09/08/2013
       Workqueue: events fb_flashcursor
       task: ffff880478...... ti: ffff88064e...... task.ti: ffff88064e......
       RIP: 0010:[ffffffff81......]  [ffffffff81......] io_serial_in+0x15/0x20
       RSP: 0018:ffff88064e257cb0  EFLAGS: 00000002
       RAX: 0000000000...... RBX: ffffffff81...... RCX: 0000000000......
       RDX: 0000000000...... RSI: 0000000000...... RDI: ffffffff81......
       RBP: ffff88064e...... R08: ffffffff81...... R09: 0000000000......
       R10: 0000000000...... R11: ffff88064e...... R12: 0000000000......
       R13: 0000000000...... R14: ffffffff81...... R15: 0000000000......
       FS:  0000000000......(0000) GS:ffff8804af......(0000) knlGS:000000000000
       CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080......
       CR2: 00007f2a2f...... CR3: 0000000001...... CR4: 0000000000......
       DR0: 0000000000...... DR1: 0000000000...... DR2: 0000000000......
       DR3: 0000000000...... DR6: 00000000ff...... DR7: 0000000000......
       Stack:
       ffff88064e...... ffffffff81...... ffffffff81...... 0000000000......
       ffffffff81...... ffff88064e...... ffffffff81...... ffffffff81......
       ffffffff81...... ffff88064e...... ffffffff81...... 0000000000......
       Call Trace:
      [<ffffffff813d099b>] wait_for_xmitr+0x3b/0xa0
      [<ffffffff813d0b5c>] serial8250_console_putchar+0x1c/0x30
      [<ffffffff813d0b40>] ? serial8250_console_write+0x140/0x140
      [<ffffffff813cb5fa>] uart_console_write+0x3a/0x80
      [<ffffffff813d0aae>] serial8250_console_write+0xae/0x140
      [<ffffffff8107c4d1>] call_console_drivers.constprop.15+0x91/0xf0
      [<ffffffff8107d6cf>] console_unlock+0x3bf/0x400
      [<ffffffff813503cd>] fb_flashcursor+0x5d/0x140
      [<ffffffff81355c30>] ? bit_clear+0x120/0x120
      [<ffffffff8109d5fb>] process_one_work+0x17b/0x470
      [<ffffffff8109e3cb>] worker_thread+0x11b/0x400
      [<ffffffff8109e2b0>] ? rescuer_thread+0x400/0x400
      [<ffffffff810a5aef>] kthread+0xcf/0xe0
      [<ffffffff810a5a20>] ? kthread_create_on_node+0x140/0x140
      [<ffffffff81645858>] ret_from_fork+0x58/0x90
      [<ffffffff810a5a20>] ? kthread_create_on_node+0x140/0x140
      Code: 48 89 e5 d3 e6 48 63 f6 48 03 77 10 8b 06 5d c3 66 0f 1f 44 00 00 66 66 66 6
      
      As indicated in the stack trace above, the console output task got swamped.
      
      Fixes: b9c5d6a6 ("IB/mlx4: Add multicast group (MCG) paravirtualization for SR-IOV")
      Cc: <stable@vger.kernel.org> # v3.6+
      Signed-off-by: default avatarJack Morgenstein <jackm@dev.mellanox.co.il>
      Signed-off-by: default avatarLeon Romanovsky <leon@kernel.org>
      Signed-off-by: default avatarDoug Ledford <dledford@redhat.com>
      fb7a9174