Merge tag 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rdma/rdma
authorLinus Torvalds <torvalds@linux-foundation.org>
Fri, 26 Oct 2018 14:38:19 +0000 (07:38 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Fri, 26 Oct 2018 14:38:19 +0000 (07:38 -0700)
Pull rdma updates from Jason Gunthorpe:
 "This has been a smaller cycle with many of the commits being smallish
  code fixes and improvements across the drivers.

   - Driver updates for bnxt_re, cxgb4, hfi1, hns, mlx5, nes, qedr, and
     rxe

   - Memory window support in hns

   - mlx5 user API 'flow mutate/steering' allows accessing the full
     packet mangling and matching machinery from user space

   - Support inter-working with verbs API calls in the 'devx' mlx5 user
     API, and provide options to use devx with less privilege

   - Modernize the use of syfs and the device interface to use attribute
     groups and cdev properly for uverbs, and clean up some of the core
     code's device list management

   - More progress on net namespaces for RDMA devices

   - Consolidate driver BAR mmapping support into core code helpers and
     rework how RDMA holds poitners to mm_struct for get_user_pages
     cases

   - First pass to use 'dev_name' instead of ib_device->name

   - Device renaming for RDMA devices"

* tag 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rdma/rdma: (242 commits)
  IB/mlx5: Add support for extended atomic operations
  RDMA/core: Fix comment for hw stats init for port == 0
  RDMA/core: Refactor ib_register_device() function
  RDMA/core: Fix unwinding flow in case of error to register device
  ib_srp: Remove WARN_ON in srp_terminate_io()
  IB/mlx5: Allow scatter to CQE without global signaled WRs
  IB/mlx5: Verify that driver supports user flags
  IB/mlx5: Support scatter to CQE for DC transport type
  RDMA/drivers: Use core provided API for registering device attributes
  RDMA/core: Allow existing drivers to set one sysfs group per device
  IB/rxe: Remove unnecessary enum values
  RDMA/umad: Use kernel API to allocate umad indexes
  RDMA/uverbs: Use kernel API to allocate uverbs indexes
  RDMA/core: Increase total number of RDMA ports across all devices
  IB/mlx4: Add port and TID to MAD debug print
  IB/mlx4: Enable debug print of SMPs
  RDMA/core: Rename ports_parent to ports_kobj
  RDMA/core: Do not expose unsupported counters
  IB/mlx4: Refer to the device kobject instead of ports_parent
  RDMA/nldev: Allow IB device rename through RDMA netlink
  ...

1  2 
Documentation/ABI/testing/sysfs-class-net
drivers/infiniband/core/verbs.c
drivers/infiniband/hw/cxgb4/qp.c
drivers/infiniband/hw/hfi1/pcie.c
drivers/infiniband/hw/mlx5/cq.c
drivers/infiniband/hw/mlx5/flow.c
drivers/infiniband/hw/mlx5/main.c
drivers/infiniband/hw/mlx5/mlx5_ib.h
drivers/infiniband/ulp/ipoib/ipoib_main.c
include/linux/mlx5/driver.h
include/rdma/ib_verbs.h

Simple merge
index 62d6f197ec0b9ded3e7f1a037fbc189a99c7fb32,74eb70300fdfe585685546a69f25d46827b306e9..13478f3b70570e9e265a476b8302a35339459e3a
@@@ -2570,9 -2571,9 +2571,9 @@@ static int alloc_srq_queue(struct c4iw_
                goto err_free_rqtpool;
  
        memset(wq->queue, 0, wq->memsize);
 -      pci_unmap_addr_set(wq, mapping, wq->dma_addr);
 +      dma_unmap_addr_set(wq, mapping, wq->dma_addr);
  
-       wq->bar2_va = c4iw_bar2_addrs(rdev, wq->qid, T4_BAR2_QTYPE_EGRESS,
+       wq->bar2_va = c4iw_bar2_addrs(rdev, wq->qid, CXGB4_BAR2_QTYPE_EGRESS,
                                      &wq->bar2_qid,
                        user ? &wq->bar2_pa : NULL);
  
Simple merge
Simple merge
index 1a29f47f836e5abb076aa30ae388fb13f457cc04,e57435cb6d9666ee38f559f01df5cdf4789ab347..f86cdcafdafc7cd8cda69671e9c63a611eae58be
@@@ -101,16 -135,48 +135,48 @@@ static int UVERBS_HANDLER(MLX5_IB_METHO
                attrs, MLX5_IB_ATTR_CREATE_FLOW_MATCH_VALUE);
        inlen = uverbs_attr_get_len(attrs,
                                    MLX5_IB_ATTR_CREATE_FLOW_MATCH_VALUE);
-       fs_matcher = uverbs_attr_get_obj(attrs,
-                                        MLX5_IB_ATTR_CREATE_FLOW_MATCHER);
-       flow_handler = mlx5_ib_raw_fs_rule_add(dev, fs_matcher, cmd_in, inlen,
+       uflow_res = flow_resources_alloc(MLX5_IB_CREATE_FLOW_MAX_FLOW_ACTIONS);
+       if (!uflow_res)
+               return -ENOMEM;
+       len = uverbs_attr_get_uobjs_arr(attrs,
+               MLX5_IB_ATTR_CREATE_FLOW_ARR_FLOW_ACTIONS, &arr_flow_actions);
+       for (i = 0; i < len; i++) {
+               struct mlx5_ib_flow_action *maction =
+                       to_mflow_act(arr_flow_actions[i]->object);
+               ret = parse_flow_flow_action(maction, false, &flow_act);
+               if (ret)
+                       goto err_out;
+               flow_resources_add(uflow_res, IB_FLOW_SPEC_ACTION_HANDLE,
+                                  arr_flow_actions[i]->object);
+       }
+       ret = uverbs_copy_from(&flow_act.flow_tag, attrs,
+                              MLX5_IB_ATTR_CREATE_FLOW_TAG);
+       if (!ret) {
+               if (flow_act.flow_tag >= BIT(24)) {
+                       ret = -EINVAL;
+                       goto err_out;
+               }
 -              flow_act.has_flow_tag = true;
++              flow_act.flags |= FLOW_ACT_HAS_TAG;
+       }
+       flow_handler = mlx5_ib_raw_fs_rule_add(dev, fs_matcher, &flow_act,
+                                              cmd_in, inlen,
                                               dest_id, dest_type);
-       if (IS_ERR(flow_handler))
-               return PTR_ERR(flow_handler);
+       if (IS_ERR(flow_handler)) {
+               ret = PTR_ERR(flow_handler);
+               goto err_out;
+       }
  
-       ib_set_flow(uobj, &flow_handler->ibflow, qp, &dev->ib_dev);
+       ib_set_flow(uobj, &flow_handler->ibflow, qp, &dev->ib_dev, uflow_res);
  
        return 0;
+ err_out:
+       ib_uverbs_flow_resources_free(uflow_res);
+       return ret;
  }
  
  static int flow_matcher_cleanup(struct ib_uobject *uobject,
index af32899bb72a7c00f882b386de49f391b1e0bf6d,be701d40289ed6ad3aabba02469005e82884bfa1..e9c428071df3140685071f458abf72512381ae55
@@@ -2883,10 -2857,10 +2857,10 @@@ is_valid_esp_aes_gcm(struct mlx5_core_d
         * rules would be supported, always return VALID_SPEC_NA.
         */
        if (!is_crypto)
-               return egress ? VALID_SPEC_INVALID : VALID_SPEC_NA;
+               return VALID_SPEC_NA;
  
        return is_crypto && is_ipsec &&
 -              (!egress || (!is_drop && !flow_act->has_flow_tag)) ?
 +              (!egress || (!is_drop && !(flow_act->flags & FLOW_ACT_HAS_TAG))) ?
                VALID_SPEC_VALID : VALID_SPEC_INVALID;
  }
  
Simple merge
Simple merge
index 0ed5d913a492383466d64b39d07f6c0a0548355f,b17eea0373cb8dbc76cd34df354db370ba9969e3..9c0c2132a2d68a012ce3c7f3f12c2f966c040e43
@@@ -2544,13 -2537,15 +2547,19 @@@ struct ib_device 
                                        unsigned char name_assign_type,
                                        void (*setup)(struct net_device *));
  
 +      int (*rdma_netdev_get_params)(struct ib_device *device, u8 port_num,
 +                                    enum rdma_netdev_t type,
 +                                    struct rdma_netdev_alloc_params *params);
 +
        struct module               *owner;
        struct device                dev;
-       struct kobject               *ports_parent;
+       /* First group for device attributes,
+        * Second group for driver provided attributes (optional).
+        * It is NULL terminated array.
+        */
+       const struct attribute_group    *groups[3];
+       struct kobject                  *ports_kobj;
        struct list_head             port_list;
  
        enum {
@@@ -4194,15 -4195,26 +4209,37 @@@ struct ib_ucontext *ib_uverbs_get_ucont
  int uverbs_destroy_def_handler(struct ib_uverbs_file *file,
                               struct uverbs_attr_bundle *attrs);
  
 +struct net_device *rdma_alloc_netdev(struct ib_device *device, u8 port_num,
 +                                   enum rdma_netdev_t type, const char *name,
 +                                   unsigned char name_assign_type,
 +                                   void (*setup)(struct net_device *));
 +
 +int rdma_init_netdev(struct ib_device *device, u8 port_num,
 +                   enum rdma_netdev_t type, const char *name,
 +                   unsigned char name_assign_type,
 +                   void (*setup)(struct net_device *),
 +                   struct net_device *netdev);
 +
+ /**
+  * rdma_set_device_sysfs_group - Set device attributes group to have
+  *                             driver specific sysfs entries at
+  *                             for infiniband class.
+  *
+  * @device:   device pointer for which attributes to be created
+  * @group:    Pointer to group which should be added when device
+  *            is registered with sysfs.
+  * rdma_set_device_sysfs_group() allows existing drivers to expose one
+  * group per device to have sysfs attributes.
+  *
+  * NOTE: New drivers should not make use of this API; instead new device
+  * parameter should be exposed via netlink command. This API and mechanism
+  * exist only for existing drivers.
+  */
+ static inline void
+ rdma_set_device_sysfs_group(struct ib_device *dev,
+                           const struct attribute_group *group)
+ {
+       dev->groups[1] = group;
+ }
  #endif /* IB_VERBS_H */