1. 21 Feb, 2019 1 commit
    • Jason Gunthorpe's avatar
      Merge branch 'mlx5-next' into rdma.git for-next · 815f7480
      Jason Gunthorpe authored
      From
      git://git.kernel.org/pub/scm/linux/kernel/git/mellanox/linux
      
      To resolve conflicts with net-next and pick up the first patch.
      
      * branch 'mlx5-next':
        net/mlx5: Factor out HCA capabilities functions
        IB/mlx5: Add support for 50Gbps per lane link modes
        net/mlx5: Add support to ext_* fields introduced in Port Type and Speed register
        net/mlx5: Add new fields to Port Type and Speed register
        net/mlx5: Refactor queries to speed fields in Port Type and Speed register
        net/mlx5: E-Switch, Avoid magic numbers when initializing offloads mode
        net/mlx5: Relocate vport macros to the vport header file
        net/mlx5: E-Switch, Normalize the name of uplink vport number
        net/mlx5: Provide an alternative VF upper bound for ECPF
        net/mlx5: Add host params change event
        net/mlx5: Add query host params command
        net/mlx5: Update enable HCA dependency
        net/mlx5: Introduce Mellanox SmartNIC and modify page management logic
        IB/mlx5: Use unified register/load function for uplink and VF vports
        net/mlx5: Use consistent vport num argument type
        net/mlx5: Use void pointer as the type in address_of macro
        net/mlx5: Align ODP capability function with netdev coding style
        mlx5: use RCU lock in mlx5_eq_cq_get()
      Signed-off-by: default avatarJason Gunthorpe <jgg@mellanox.com>
      815f7480
  2. 20 Feb, 2019 18 commits
    • Davidlohr Bueso's avatar
      drivers/IB,qib: Fix pinned/locked limit check in qib_get_user_pages() · ec95e0fa
      Davidlohr Bueso authored
      The current check does not take into account the previous value of
      pinned_vm; thus it is quite bogus as is. Fix this by checking the
      new value after the (optimistic) atomic inc.
      Signed-off-by: default avatarDavidlohr Bueso <dbueso@suse.de>
      Signed-off-by: default avatarJason Gunthorpe <jgg@mellanox.com>
      ec95e0fa
    • Noa Osherovich's avatar
      RDMA/core: Verify that memory window type is legal · d0e02bf6
      Noa Osherovich authored
      Before calling the provider's alloc_mw function, verify that the
      given memory type is either IB_MW_TYPE_1 or IB_MW_TYPE_2.
      Signed-off-by: default avatarNoa Osherovich <noaos@mellanox.com>
      Signed-off-by: default avatarLeon Romanovsky <leonro@mellanox.com>
      Signed-off-by: default avatarJason Gunthorpe <jgg@mellanox.com>
      d0e02bf6
    • Leon Romanovsky's avatar
      RDMA/iwcm: Fix string truncation error · 1882ab86
      Leon Romanovsky authored
      The strlen() check at the beginning of iw_cm_map() ensures that devname
      and ifname strings are less than destinations to which they are supposed
      to be copied. Change strncpy() call to be strcpy(), because we are
      protected from overflow. Zero the entire string buffer to avoid copying
      uninitialized kernel stack memory to userspace.
      
      This fixes the compilation warning below:
      
      In file included from ./include/linux/dma-mapping.h:6,
                       from drivers/infiniband/core/iwcm.c:38:
      In function _strncpy_,
          inlined from _iw_cm_map_ at drivers/infiniband/core/iwcm.c:519:2:
      ./include/linux/string.h:253:9: warning: ___builtin_strncpy_ specified
      bound 32 equals destination size [-Wstringop-truncation]
        return __builtin_strncpy(p, q, size);
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      
      Fixes: d53ec8af ("RDMA/iwcm: Don't copy past the end of dev_name() string")
      Signed-off-by: default avatarLeon Romanovsky <leonro@mellanox.com>
      Signed-off-by: default avatarJason Gunthorpe <jgg@mellanox.com>
      1882ab86
    • Yuval Shaia's avatar
      RDMA/core: Cosmetic change - move member initialization to correct block · e278173f
      Yuval Shaia authored
      old_pd is used only if IB_MR_REREG_PD flags is set.
      For readability move it's initialization to where it is used.
      
      While there rewrite the whole 'if-else' block so on error jump directly
      to label and no need for 'else'
      Signed-off-by: default avatarYuval Shaia <yuval.shaia@oracle.com>
      Reviewed-by: default avatarLeon Romanovsky <leonro@mellanox.com>
      Signed-off-by: default avatarJason Gunthorpe <jgg@mellanox.com>
      e278173f
    • Wei Yongjun's avatar
      iw_cxgb4: Make function read_tcb() static · 3b8f8b95
      Wei Yongjun authored
      Fixes the following sparse warning:
      
      drivers/infiniband/hw/cxgb4/cm.c:658:6: warning:
       symbol 'read_tcb' was not declared. Should it be static?
      
      Fixes: 11a27e21 ("iw_cxgb4: complete the cached SRQ buffers")
      Signed-off-by: default avatarWei Yongjun <weiyongjun1@huawei.com>
      Acked-by: default avatarRaju Rangoju <rajur@chelsio.com>
      Signed-off-by: default avatarJason Gunthorpe <jgg@mellanox.com>
      3b8f8b95
    • Yangyang Li's avatar
      RDMA/hns: Bugfix for set hem of SCC · 6ac16e40
      Yangyang Li authored
      The method of set hem for scc context is different from other contexts. It
      should notify the hardware with the detailed idx in bt0 for scc, while for
      other contexts, it only need to notify the bt step and the hardware will
      calculate the idx.
      
      Here fixes the following error when unloading the hip08 driver:
      
      [  123.570768] {1}[Hardware Error]: Hardware error from APEI Generic Hardware Error Source: 0
      [  123.579023] {1}[Hardware Error]: event severity: recoverable
      [  123.584670] {1}[Hardware Error]:  Error 0, type: recoverable
      [  123.590317] {1}[Hardware Error]:   section_type: PCIe error
      [  123.595877] {1}[Hardware Error]:   version: 4.0
      [  123.600395] {1}[Hardware Error]:   command: 0x0006, status: 0x0010
      [  123.606562] {1}[Hardware Error]:   device_id: 0000:7d:00.0
      [  123.612034] {1}[Hardware Error]:   slot: 0
      [  123.616120] {1}[Hardware Error]:   secondary_bus: 0x00
      [  123.621245] {1}[Hardware Error]:   vendor_id: 0x19e5, device_id: 0xa222
      [  123.627847] {1}[Hardware Error]:   class_code: 000002
      [  123.632977] hns3 0000:7d:00.0: aer_status: 0x00000000, aer_mask: 0x00000000
      [  123.639928] hns3 0000:7d:00.0: aer_layer=Transaction Layer, aer_agent=Receiver ID
      [  123.647400] hns3 0000:7d:00.0: aer_uncor_severity: 0x00000000
      [  123.653136] hns3 0000:7d:00.0: PCI error detected, state(=1)!!
      [  123.658959] hns3 0000:7d:00.0: ROCEE uncorrected RAS error identified
      [  123.665395] hns3 0000:7d:00.0: ROCEE RAS AXI rresp error
      [  123.670713] hns3 0000:7d:00.0: requesting reset due to PCI error
      [  123.676715] hns3 0000:7d:00.0: received reset event , reset type is 5
      [  123.683147] hns3 0000:7d:00.0: AER: Device recovery successful
      [  123.688978] hns3 0000:7d:00.0: PF Reset requested
      [  123.693684] hns3 0000:7d:00.0: PF failed(=-5) to send mailbox message to VF
      [  123.700633] hns3 0000:7d:00.0: inform reset to vf(1) failded -5!
      
      Fixes: 6a157f7d ("RDMA/hns: Add SCC context allocation support for hip08")
      Signed-off-by: default avatarYangyang Li <liyangyang20@huawei.com>
      Reviewed-by: default avatarYixian Liu <liuyixian@huawei.com>
      Reviewed-by: default avatarLijun Ou <oulijun@huawei.com>
      Signed-off-by: default avatarJason Gunthorpe <jgg@mellanox.com>
      6ac16e40
    • Lijun Ou's avatar
      RDMA/hns: Modify qp&cq&pd specification according to UM · 3e394f94
      Lijun Ou authored
      Accroding to hip08's limitation, qp&cq specification is 1M, mtpt
      specification 1M in kernel space.
      Signed-off-by: default avatarYangyang Li <liyangyang20@huawei.com>
      Signed-off-by: default avatarLijun Ou <oulijun@huawei.com>
      Signed-off-by: default avatarJason Gunthorpe <jgg@mellanox.com>
      3e394f94
    • Steve Wise's avatar
      lib/irq_poll: Support schedules in non-interrupt contexts · 4133b013
      Steve Wise authored
      Do not assume irq_poll_sched() is called from an interrupt context only.
      So use raise_softirq_irqoff() instead of __raise_softirq_irqoff() so it
      will kick the ksoftirqd if the schedule is from a non-interrupt context.
      
      This is required for RDMA drivers, like soft iwarp, that generate cq
      completion notifications in a workqueue or kthread context.  Without this
      change, siw completion notifications to the ULP can take several hundred
      usecs, depending on the system load.
      Signed-off-by: default avatarSteve Wise <swise@opengridcomputing.com>
      Reviewed-by: default avatarSagi Grimberg <sagi@grimberg.me>
      Signed-off-by: default avatarJason Gunthorpe <jgg@mellanox.com>
      4133b013
    • Steve Wise's avatar
      rdma_rxe: Use netlink messages to add/delete links · 66920e1b
      Steve Wise authored
      Add support for the RDMA_NLDEV_CMD_NEWLINK/DELLINK messages which allow
      dynamically adding new RXE links.  Deprecate the old module options for
      now.
      
      Cc: Moni Shoua <monis@mellanox.com>
      Reviewed-by: default avatarYanjun Zhu <yanjun.zhu@oracle.com>
      Signed-off-by: default avatarSteve Wise <swise@opengridcomputing.com>
      Signed-off-by: default avatarJason Gunthorpe <jgg@mellanox.com>
      66920e1b
    • Steve Wise's avatar
      RDMA/core: Add RDMA_NLDEV_CMD_NEWLINK/DELLINK support · 3856ec4b
      Steve Wise authored
      Add support for new LINK messages to allow adding and deleting rdma
      interfaces.  This will be used initially for soft rdma drivers which
      instantiate device instances dynamically by the admin specifying a netdev
      device to use.  The rdma_rxe module will be the first user of these
      messages.
      
      The design is modeled after RTNL_NEWLINK/DELLINK: rdma drivers register
      with the rdma core if they provide link add/delete functions.  Each driver
      registers with a unique "type" string, that is used to dispatch messages
      coming from user space.  A new RDMA_NLDEV_ATTR is defined for the "type"
      string.  User mode will pass 3 attributes in a NEWLINK message:
      RDMA_NLDEV_ATTR_DEV_NAME for the desired rdma device name to be created,
      RDMA_NLDEV_ATTR_LINK_TYPE for the "type" of link being added, and
      RDMA_NLDEV_ATTR_NDEV_NAME for the net_device interface to use for this
      link.  The DELLINK message will contain the RDMA_NLDEV_ATTR_DEV_INDEX of
      the device to delete.
      Signed-off-by: default avatarSteve Wise <swise@opengridcomputing.com>
      Reviewed-by: default avatarLeon Romanovsky <leonro@mellanox.com>
      Reviewed-by: default avatarMichael J. Ruhl <michael.j.ruhl@intel.com>
      Signed-off-by: default avatarJason Gunthorpe <jgg@mellanox.com>
      3856ec4b
    • Parvi Kaustubhi's avatar
      IB/usnic: Fix deadlock · 5bb3c1e9
      Parvi Kaustubhi authored
      There is a dead lock in usnic ib_register and netdev_notify path.
      
      	usnic_ib_discover_pf()
      	| mutex_lock(&usnic_ib_ibdev_list_lock);
      	 | usnic_ib_device_add();
      	  | ib_register_device()
      	   | usnic_ib_query_port()
      	    | mutex_lock(&us_ibdev->usdev_lock);
      	     | ib_get_eth_speed()
      	      | rtnl_lock()
      
      order of lock: &usnic_ib_ibdev_list_lock -> usdev_lock -> rtnl_lock
      
      	rtnl_lock()
      	 | usnic_ib_netdevice_event()
      	  | mutex_lock(&usnic_ib_ibdev_list_lock);
      
      order of lock: rtnl_lock -> &usnic_ib_ibdev_list_lock
      
      Solution is to use the core's lock-free ib_device_get_by_netdev() scheme
      to lookup ib_dev while handling netdev & inet events.
      Signed-off-by: default avatarParvi Kaustubhi <pkaustub@cisco.com>
      Reviewed-by: default avatarGovindarajulu Varadarajan <gvaradar@cisco.com>
      Reviewed-by: default avatarTanmay Inamdar <tinamdar@cisco.com>
      Signed-off-by: default avatarJason Gunthorpe <jgg@mellanox.com>
      5bb3c1e9
    • Jason Gunthorpe's avatar
      RDMA/rxe: Close a race after ib_register_device · ca22354b
      Jason Gunthorpe authored
      Since rxe allows unregistration from other threads the rxe pointer can
      become invalid any moment after ib_register_driver returns. This could
      cause a user triggered use after free.
      
      Add another driver callback to be called right after the device becomes
      registered to complete any device setup required post-registration.  This
      callback has enough core locking to prevent the device from becoming
      unregistered.
      Signed-off-by: default avatarJason Gunthorpe <jgg@mellanox.com>
      ca22354b
    • Jason Gunthorpe's avatar
      RDMA/rxe: Add ib_device_get_by_name() and use it in rxe · 6cc2c8e5
      Jason Gunthorpe authored
      rxe has an open coded version of this that is not as safe as the core
      version. This lets us eliminate the internal device list entirely from
      rxe.
      Signed-off-by: default avatarJason Gunthorpe <jgg@mellanox.com>
      6cc2c8e5
    • Jason Gunthorpe's avatar
      RDMA/rxe: Use driver_unregister and new unregistration API · c367074b
      Jason Gunthorpe authored
      rxe does not have correct locking for its registration/unregistration
      paths, use the core code to handle it instead. In this mode
      ib_unregister_device will also do the dealloc, so rxe is required to do
      clean up from a callback.
      
      The core code ensures that unregistration is done only once, and generally
      takes care of locking and concurrency problems for rxe.
      Signed-off-by: default avatarJason Gunthorpe <jgg@mellanox.com>
      c367074b
    • Jason Gunthorpe's avatar
      RDMA/device: Provide APIs from the core code to help unregistration · d0899892
      Jason Gunthorpe authored
      These APIs are intended to support drivers that exist outside the usual
      driver core probe()/remove() callbacks. Normally the driver core will
      prevent remove() from running concurrently with probe(), once this safety
      is lost drivers need more support to get the locking and lifetimes right.
      
      ib_unregister_driver() is intended to be used during module_exit of a
      driver using these APIs. It unregisters all the associated ib_devices.
      
      ib_unregister_device_and_put() is to be used by a driver-specific removal
      function (ie removal by name, removal from a netdev notifier, removal from
      netlink)
      
      ib_unregister_queued() is to be used from netdev notifier chains where
      RTNL is held.
      
      The locking is tricky here since once things become async it is possible
      to race unregister with registration. This is largely solved by relying on
      the registration refcount, unregistration will only ever work on something
      that has a positive registration refcount - and then an unregistration
      mutex serializes all competing unregistrations of the same device.
      Signed-off-by: default avatarJason Gunthorpe <jgg@mellanox.com>
      d0899892
    • Jason Gunthorpe's avatar
      RDMA/rxe: Use ib_device_get_by_netdev() instead of open coding · 4c173f59
      Jason Gunthorpe authored
      The core API handles the locking correctly and is faster if there are
      multiple devices.
      Signed-off-by: default avatarJason Gunthorpe <jgg@mellanox.com>
      4c173f59
    • Jason Gunthorpe's avatar
      RDMA/device: Add ib_device_get_by_netdev() · 324e227e
      Jason Gunthorpe authored
      Several drivers need to find the ib_device from a given netdev. rxe needs
      this at speed in an unsleepable context, so choose to implement the
      translation using a RCU safe hash table.
      
      The hash table can have a many to one mapping. This is intended to support
      some future case where multiple IB drivers (ie iWarp and RoCE) connect to
      the same netdevs. driver_ids will need to be different to support this.
      
      In the process this makes the struct ib_device and ib_port_data RCU safe
      by deferring their kfrees.
      Signed-off-by: default avatarJason Gunthorpe <jgg@mellanox.com>
      324e227e
    • Jason Gunthorpe's avatar
      RDMA/device: Add ib_device_set_netdev() as an alternative to get_netdev · c2261dd7
      Jason Gunthorpe authored
      The associated netdev should not actually be very dynamic, so for most
      drivers there is no reason for a callback like this. Provide an API to
      inform the core code about the net dev affiliation and use a core
      maintained data structure instead.
      
      This allows the core code to be more aware of the ndev relationship which
      will allow some new APIs based around this.
      
      This also uses locking that makes some kind of sense, many drivers had a
      confusing RCU lock, or missing locking which isn't right.
      Signed-off-by: default avatarJason Gunthorpe <jgg@mellanox.com>
      c2261dd7
  3. 19 Feb, 2019 14 commits
  4. 16 Feb, 2019 5 commits
  5. 15 Feb, 2019 2 commits