OSDN Git Service

Merge branch 'k.o/wip/dl-for-rc' into k.o/wip/dl-for-next
authorDoug Ledford <dledford@redhat.com>
Wed, 14 Mar 2018 22:49:12 +0000 (18:49 -0400)
committerDoug Ledford <dledford@redhat.com>
Wed, 14 Mar 2018 23:28:58 +0000 (19:28 -0400)
Due to bug fixes found by the syzkaller bot and taken into the for-rc
branch after development for the 4.17 merge window had already started
being taken into the for-next branch, there were fairly non-trivial
merge issues that would need to be resolved between the for-rc branch
and the for-next branch.  This merge resolves those conflicts and
provides a unified base upon which ongoing development for 4.17 can
be based.

Conflicts:
drivers/infiniband/hw/mlx5/main.c - Commit 42cea83f9524
(IB/mlx5: Fix cleanup order on unload) added to for-rc and
commit b5ca15ad7e61 (IB/mlx5: Add proper representors support)
add as part of the devel cycle both needed to modify the
init/de-init functions used by mlx5.  To support the new
representors, the new functions added by the cleanup patch
needed to be made non-static, and the init/de-init list
added by the representors patch needed to be modified to
match the init/de-init list changes made by the cleanup
patch.
Updates:
drivers/infiniband/hw/mlx5/mlx5_ib.h - Update function
prototypes added by representors patch to reflect new function
names as changed by cleanup patch
drivers/infiniband/hw/mlx5/ib_rep.c - Update init/de-init
stage list to match new order from cleanup patch

Signed-off-by: Doug Ledford <dledford@redhat.com>
12 files changed:
1  2 
drivers/infiniband/core/cma.c
drivers/infiniband/core/ucma.c
drivers/infiniband/hw/bnxt_re/ib_verbs.c
drivers/infiniband/hw/bnxt_re/qplib_sp.c
drivers/infiniband/hw/mlx4/main.c
drivers/infiniband/hw/mlx5/cq.c
drivers/infiniband/hw/mlx5/ib_rep.c
drivers/infiniband/hw/mlx5/main.c
drivers/infiniband/hw/mlx5/mlx5_ib.h
drivers/infiniband/hw/mlx5/mr.c
drivers/infiniband/hw/mlx5/qp.c
include/linux/mlx5/driver.h

@@@ -3356,15 -3387,10 +3361,12 @@@ int rdma_bind_addr(struct rdma_cm_id *i
        if (ret)
                goto err2;
  
-       daddr = cma_dst_addr(id_priv);
-       daddr->sa_family = addr->sa_family;
        return 0;
  err2:
 -      if (id_priv->cma_dev)
 +      if (id_priv->cma_dev) {
 +              rdma_restrack_del(&id_priv->res);
                cma_release_dev(id_priv);
 +      }
  err1:
        cma_comp_exch(id_priv, RDMA_CM_ADDR_BOUND, RDMA_CM_IDLE);
        return ret;
Simple merge
Simple merge
Simple merge
index 61cc3d7,0000000..0e04fdd
mode 100644,000000..100644
--- /dev/null
@@@ -1,189 -1,0 +1,192 @@@
-       STAGE_CREATE(MLX5_IB_STAGE_UMR_RESOURCES,
-                    mlx5_ib_stage_umr_res_init,
-                    mlx5_ib_stage_umr_res_cleanup),
 +/* SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause) */
 +/*
 + * Copyright (c) 2018 Mellanox Technologies. All rights reserved.
 + */
 +
 +#include "ib_rep.h"
 +
 +static const struct mlx5_ib_profile rep_profile = {
 +      STAGE_CREATE(MLX5_IB_STAGE_INIT,
 +                   mlx5_ib_stage_init_init,
 +                   mlx5_ib_stage_init_cleanup),
 +      STAGE_CREATE(MLX5_IB_STAGE_FLOW_DB,
 +                   mlx5_ib_stage_rep_flow_db_init,
 +                   NULL),
 +      STAGE_CREATE(MLX5_IB_STAGE_CAPS,
 +                   mlx5_ib_stage_caps_init,
 +                   NULL),
 +      STAGE_CREATE(MLX5_IB_STAGE_NON_DEFAULT_CB,
 +                   mlx5_ib_stage_rep_non_default_cb,
 +                   NULL),
 +      STAGE_CREATE(MLX5_IB_STAGE_ROCE,
 +                   mlx5_ib_stage_rep_roce_init,
 +                   mlx5_ib_stage_rep_roce_cleanup),
 +      STAGE_CREATE(MLX5_IB_STAGE_DEVICE_RESOURCES,
 +                   mlx5_ib_stage_dev_res_init,
 +                   mlx5_ib_stage_dev_res_cleanup),
 +      STAGE_CREATE(MLX5_IB_STAGE_COUNTERS,
 +                   mlx5_ib_stage_counters_init,
 +                   mlx5_ib_stage_counters_cleanup),
 +      STAGE_CREATE(MLX5_IB_STAGE_BFREG,
 +                   mlx5_ib_stage_bfrag_init,
 +                   mlx5_ib_stage_bfrag_cleanup),
++      STAGE_CREATE(MLX5_IB_STAGE_PRE_IB_REG_UMR,
++                   NULL,
++                   mlx5_ib_stage_pre_ib_reg_umr_cleanup),
 +      STAGE_CREATE(MLX5_IB_STAGE_IB_REG,
 +                   mlx5_ib_stage_ib_reg_init,
 +                   mlx5_ib_stage_ib_reg_cleanup),
++      STAGE_CREATE(MLX5_IB_STAGE_POST_IB_REG_UMR,
++                   mlx5_ib_stage_post_ib_reg_umr_init,
++                   NULL),
 +      STAGE_CREATE(MLX5_IB_STAGE_CLASS_ATTR,
 +                   mlx5_ib_stage_class_attr_init,
 +                   NULL),
 +};
 +
 +static int
 +mlx5_ib_nic_rep_load(struct mlx5_core_dev *dev, struct mlx5_eswitch_rep *rep)
 +{
 +      return 0;
 +}
 +
 +static void
 +mlx5_ib_nic_rep_unload(struct mlx5_eswitch_rep *rep)
 +{
 +      rep->rep_if[REP_IB].priv = NULL;
 +}
 +
 +static int
 +mlx5_ib_vport_rep_load(struct mlx5_core_dev *dev, struct mlx5_eswitch_rep *rep)
 +{
 +      struct mlx5_ib_dev *ibdev;
 +
 +      ibdev = (struct mlx5_ib_dev *)ib_alloc_device(sizeof(*ibdev));
 +      if (!ibdev)
 +              return -ENOMEM;
 +
 +      ibdev->rep = rep;
 +      ibdev->mdev = dev;
 +      ibdev->num_ports = max(MLX5_CAP_GEN(dev, num_ports),
 +                             MLX5_CAP_GEN(dev, num_vhca_ports));
 +      if (!__mlx5_ib_add(ibdev, &rep_profile))
 +              return -EINVAL;
 +
 +      rep->rep_if[REP_IB].priv = ibdev;
 +
 +      return 0;
 +}
 +
 +static void
 +mlx5_ib_vport_rep_unload(struct mlx5_eswitch_rep *rep)
 +{
 +      struct mlx5_ib_dev *dev;
 +
 +      if (!rep->rep_if[REP_IB].priv)
 +              return;
 +
 +      dev = mlx5_ib_rep_to_dev(rep);
 +      __mlx5_ib_remove(dev, dev->profile, MLX5_IB_STAGE_MAX);
 +      rep->rep_if[REP_IB].priv = NULL;
 +}
 +
 +static void *mlx5_ib_vport_get_proto_dev(struct mlx5_eswitch_rep *rep)
 +{
 +      return mlx5_ib_rep_to_dev(rep);
 +}
 +
 +static void mlx5_ib_rep_register_vf_vports(struct mlx5_ib_dev *dev)
 +{
 +      struct mlx5_eswitch *esw   = dev->mdev->priv.eswitch;
 +      int total_vfs = MLX5_TOTAL_VPORTS(dev->mdev);
 +      int vport;
 +
 +      for (vport = 1; vport < total_vfs; vport++) {
 +              struct mlx5_eswitch_rep_if rep_if = {};
 +
 +              rep_if.load = mlx5_ib_vport_rep_load;
 +              rep_if.unload = mlx5_ib_vport_rep_unload;
 +              rep_if.get_proto_dev = mlx5_ib_vport_get_proto_dev;
 +              mlx5_eswitch_register_vport_rep(esw, vport, &rep_if, REP_IB);
 +      }
 +}
 +
 +static void mlx5_ib_rep_unregister_vf_vports(struct mlx5_ib_dev *dev)
 +{
 +      struct mlx5_eswitch *esw   = dev->mdev->priv.eswitch;
 +      int total_vfs = MLX5_TOTAL_VPORTS(dev->mdev);
 +      int vport;
 +
 +      for (vport = 1; vport < total_vfs; vport++)
 +              mlx5_eswitch_unregister_vport_rep(esw, vport, REP_IB);
 +}
 +
 +void mlx5_ib_register_vport_reps(struct mlx5_ib_dev *dev)
 +{
 +      struct mlx5_eswitch *esw = dev->mdev->priv.eswitch;
 +      struct mlx5_eswitch_rep_if rep_if = {};
 +
 +      rep_if.load = mlx5_ib_nic_rep_load;
 +      rep_if.unload = mlx5_ib_nic_rep_unload;
 +      rep_if.get_proto_dev = mlx5_ib_vport_get_proto_dev;
 +      rep_if.priv = dev;
 +
 +      mlx5_eswitch_register_vport_rep(esw, 0, &rep_if, REP_IB);
 +
 +      mlx5_ib_rep_register_vf_vports(dev);
 +}
 +
 +void mlx5_ib_unregister_vport_reps(struct mlx5_ib_dev *dev)
 +{
 +      struct mlx5_eswitch *esw   = dev->mdev->priv.eswitch;
 +
 +      mlx5_ib_rep_unregister_vf_vports(dev); /* VFs vports */
 +      mlx5_eswitch_unregister_vport_rep(esw, 0, REP_IB); /* UPLINK PF*/
 +}
 +
 +u8 mlx5_ib_eswitch_mode(struct mlx5_eswitch *esw)
 +{
 +      return mlx5_eswitch_mode(esw);
 +}
 +
 +struct mlx5_ib_dev *mlx5_ib_get_rep_ibdev(struct mlx5_eswitch *esw,
 +                                        int vport_index)
 +{
 +      return mlx5_eswitch_get_proto_dev(esw, vport_index, REP_IB);
 +}
 +
 +struct net_device *mlx5_ib_get_rep_netdev(struct mlx5_eswitch *esw,
 +                                        int vport_index)
 +{
 +      return mlx5_eswitch_get_proto_dev(esw, vport_index, REP_ETH);
 +}
 +
 +struct mlx5_ib_dev *mlx5_ib_get_uplink_ibdev(struct mlx5_eswitch *esw)
 +{
 +      return mlx5_eswitch_uplink_get_proto_dev(esw, REP_IB);
 +}
 +
 +struct mlx5_eswitch_rep *mlx5_ib_vport_rep(struct mlx5_eswitch *esw, int vport)
 +{
 +      return mlx5_eswitch_vport_rep(esw, vport);
 +}
 +
 +int create_flow_rule_vport_sq(struct mlx5_ib_dev *dev,
 +                            struct mlx5_ib_sq *sq)
 +{
 +      struct mlx5_flow_handle *flow_rule;
 +      struct mlx5_eswitch *esw = dev->mdev->priv.eswitch;
 +
 +      if (!dev->rep)
 +              return 0;
 +
 +      flow_rule =
 +              mlx5_eswitch_add_send_to_vport_rule(esw,
 +                                                  dev->rep->vport,
 +                                                  sq->base.mqp.qpn);
 +      if (IS_ERR(flow_rule))
 +              return PTR_ERR(flow_rule);
 +      sq->flow_rule = flow_rule;
 +
 +      return 0;
 +}
@@@ -4994,19 -4860,19 +4991,19 @@@ int mlx5_ib_stage_ib_reg_init(struct ml
        return ib_register_device(&dev->ib_dev, NULL);
  }
  
- void mlx5_ib_stage_ib_reg_cleanup(struct mlx5_ib_dev *dev)
 -static void mlx5_ib_stage_pre_ib_reg_umr_cleanup(struct mlx5_ib_dev *dev)
++void mlx5_ib_stage_pre_ib_reg_umr_cleanup(struct mlx5_ib_dev *dev)
  {
-       ib_unregister_device(&dev->ib_dev);
+       destroy_umrc_res(dev);
  }
  
- int mlx5_ib_stage_umr_res_init(struct mlx5_ib_dev *dev)
 -static void mlx5_ib_stage_ib_reg_cleanup(struct mlx5_ib_dev *dev)
++void mlx5_ib_stage_ib_reg_cleanup(struct mlx5_ib_dev *dev)
  {
-       return create_umr_res(dev);
+       ib_unregister_device(&dev->ib_dev);
  }
  
- void mlx5_ib_stage_umr_res_cleanup(struct mlx5_ib_dev *dev)
 -static int mlx5_ib_stage_post_ib_reg_umr_init(struct mlx5_ib_dev *dev)
++int mlx5_ib_stage_post_ib_reg_umr_init(struct mlx5_ib_dev *dev)
  {
-       destroy_umrc_res(dev);
+       return create_umr_res(dev);
  }
  
  static int mlx5_ib_stage_delay_drop_init(struct mlx5_ib_dev *dev)
@@@ -5139,48 -4999,6 +5139,51 @@@ static const struct mlx5_ib_profile pf_
                     NULL),
  };
  
-       STAGE_CREATE(MLX5_IB_STAGE_UMR_RESOURCES,
-                    mlx5_ib_stage_umr_res_init,
-                    mlx5_ib_stage_umr_res_cleanup),
 +static const struct mlx5_ib_profile nic_rep_profile = {
 +      STAGE_CREATE(MLX5_IB_STAGE_INIT,
 +                   mlx5_ib_stage_init_init,
 +                   mlx5_ib_stage_init_cleanup),
 +      STAGE_CREATE(MLX5_IB_STAGE_FLOW_DB,
 +                   mlx5_ib_stage_flow_db_init,
 +                   mlx5_ib_stage_flow_db_cleanup),
 +      STAGE_CREATE(MLX5_IB_STAGE_CAPS,
 +                   mlx5_ib_stage_caps_init,
 +                   NULL),
 +      STAGE_CREATE(MLX5_IB_STAGE_NON_DEFAULT_CB,
 +                   mlx5_ib_stage_rep_non_default_cb,
 +                   NULL),
 +      STAGE_CREATE(MLX5_IB_STAGE_ROCE,
 +                   mlx5_ib_stage_rep_roce_init,
 +                   mlx5_ib_stage_rep_roce_cleanup),
 +      STAGE_CREATE(MLX5_IB_STAGE_DEVICE_RESOURCES,
 +                   mlx5_ib_stage_dev_res_init,
 +                   mlx5_ib_stage_dev_res_cleanup),
 +      STAGE_CREATE(MLX5_IB_STAGE_COUNTERS,
 +                   mlx5_ib_stage_counters_init,
 +                   mlx5_ib_stage_counters_cleanup),
 +      STAGE_CREATE(MLX5_IB_STAGE_UAR,
 +                   mlx5_ib_stage_uar_init,
 +                   mlx5_ib_stage_uar_cleanup),
 +      STAGE_CREATE(MLX5_IB_STAGE_BFREG,
 +                   mlx5_ib_stage_bfrag_init,
 +                   mlx5_ib_stage_bfrag_cleanup),
++      STAGE_CREATE(MLX5_IB_STAGE_PRE_IB_REG_UMR,
++                   NULL,
++                   mlx5_ib_stage_pre_ib_reg_umr_cleanup),
 +      STAGE_CREATE(MLX5_IB_STAGE_IB_REG,
 +                   mlx5_ib_stage_ib_reg_init,
 +                   mlx5_ib_stage_ib_reg_cleanup),
++      STAGE_CREATE(MLX5_IB_STAGE_POST_IB_REG_UMR,
++                   mlx5_ib_stage_post_ib_reg_umr_init,
++                   NULL),
 +      STAGE_CREATE(MLX5_IB_STAGE_CLASS_ATTR,
 +                   mlx5_ib_stage_class_attr_init,
 +                   NULL),
 +      STAGE_CREATE(MLX5_IB_STAGE_REP_REG,
 +                   mlx5_ib_stage_rep_reg_init,
 +                   mlx5_ib_stage_rep_reg_cleanup),
 +};
 +
  static void *mlx5_ib_add_slave_port(struct mlx5_core_dev *mdev, u8 port_num)
  {
        struct mlx5_ib_multiport_info *mpi;
@@@ -739,11 -739,11 +739,12 @@@ enum mlx5_ib_stages 
        MLX5_IB_STAGE_CONG_DEBUGFS,
        MLX5_IB_STAGE_UAR,
        MLX5_IB_STAGE_BFREG,
+       MLX5_IB_STAGE_PRE_IB_REG_UMR,
        MLX5_IB_STAGE_IB_REG,
-       MLX5_IB_STAGE_UMR_RESOURCES,
+       MLX5_IB_STAGE_POST_IB_REG_UMR,
        MLX5_IB_STAGE_DELAY_DROP,
        MLX5_IB_STAGE_CLASS_ATTR,
 +      MLX5_IB_STAGE_REP_REG,
        MLX5_IB_STAGE_MAX,
  };
  
@@@ -1051,31 -1050,6 +1052,31 @@@ static inline void mlx5_odp_populate_kl
  
  #endif /* CONFIG_INFINIBAND_ON_DEMAND_PAGING */
  
- int mlx5_ib_stage_umr_res_init(struct mlx5_ib_dev *dev);
- void mlx5_ib_stage_umr_res_cleanup(struct mlx5_ib_dev *dev);
 +/* Needed for rep profile */
 +int mlx5_ib_stage_init_init(struct mlx5_ib_dev *dev);
 +void mlx5_ib_stage_init_cleanup(struct mlx5_ib_dev *dev);
 +int mlx5_ib_stage_rep_flow_db_init(struct mlx5_ib_dev *dev);
 +int mlx5_ib_stage_caps_init(struct mlx5_ib_dev *dev);
 +int mlx5_ib_stage_rep_non_default_cb(struct mlx5_ib_dev *dev);
 +int mlx5_ib_stage_rep_roce_init(struct mlx5_ib_dev *dev);
 +void mlx5_ib_stage_rep_roce_cleanup(struct mlx5_ib_dev *dev);
 +int mlx5_ib_stage_dev_res_init(struct mlx5_ib_dev *dev);
 +void mlx5_ib_stage_dev_res_cleanup(struct mlx5_ib_dev *dev);
 +int mlx5_ib_stage_counters_init(struct mlx5_ib_dev *dev);
 +void mlx5_ib_stage_counters_cleanup(struct mlx5_ib_dev *dev);
 +int mlx5_ib_stage_bfrag_init(struct mlx5_ib_dev *dev);
 +void mlx5_ib_stage_bfrag_cleanup(struct mlx5_ib_dev *dev);
++void mlx5_ib_stage_pre_ib_reg_umr_cleanup(struct mlx5_ib_dev *dev);
 +int mlx5_ib_stage_ib_reg_init(struct mlx5_ib_dev *dev);
 +void mlx5_ib_stage_ib_reg_cleanup(struct mlx5_ib_dev *dev);
++int mlx5_ib_stage_post_ib_reg_umr_init(struct mlx5_ib_dev *dev);
 +int mlx5_ib_stage_class_attr_init(struct mlx5_ib_dev *dev);
 +void __mlx5_ib_remove(struct mlx5_ib_dev *dev,
 +                    const struct mlx5_ib_profile *profile,
 +                    int stage);
 +void *__mlx5_ib_add(struct mlx5_ib_dev *dev,
 +                  const struct mlx5_ib_profile *profile);
 +
  int mlx5_ib_get_vf_config(struct ib_device *device, int vf,
                          u8 port, struct ifla_vf_info *info);
  int mlx5_ib_set_vf_link_state(struct ib_device *device, int vf,
Simple merge
@@@ -3108,10 -3103,16 +3122,12 @@@ static int __mlx5_ib_modify_qp(struct i
  
        mlx5_cur = to_mlx5_state(cur_state);
        mlx5_new = to_mlx5_state(new_state);
 -      mlx5_st = to_mlx5_st(ibqp->qp_type == IB_QPT_DRIVER ?
 -                           qp->qp_sub_type : ibqp->qp_type);
 -      if (mlx5_st < 0)
 -              goto out;
  
        if (mlx5_cur >= MLX5_QP_NUM_STATE || mlx5_new >= MLX5_QP_NUM_STATE ||
-           !optab[mlx5_cur][mlx5_new])
+           !optab[mlx5_cur][mlx5_new]) {
+               err = -EINVAL;
                goto out;
+       }
  
        op = optab[mlx5_cur][mlx5_new];
        optpar = ib_mask_to_mlx5_opt(attr_mask);
Simple merge