1. 20 Feb, 2019 6 commits
    • 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
  2. 19 Feb, 2019 13 commits
  3. 16 Feb, 2019 5 commits
  4. 15 Feb, 2019 5 commits
  5. 14 Feb, 2019 7 commits
  6. 13 Feb, 2019 4 commits