]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
Merge branch 'sg_nents' into rdma.git for-next
authorJason Gunthorpe <jgg@nvidia.com>
Mon, 30 Aug 2021 12:49:59 +0000 (09:49 -0300)
committerJason Gunthorpe <jgg@nvidia.com>
Mon, 30 Aug 2021 12:49:59 +0000 (09:49 -0300)
From Maor Gottlieb
====================

Fix the use of nents and orig_nents in the sg table append helpers. The
nents should be used by the DMA layer to store the number of DMA mapped
sges, the orig_nents is the number of CPU sges.

Since the sg append logic doesn't always create a SGL with exactly
orig_nents entries store a total_nents as well to allow the table to be
properly free'd and reorganize the freeing logic to share across all the
use cases.

====================

Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
* 'sg_nents':
  RDMA: Use the sg_table directly and remove the opencoded version from umem
  lib/scatterlist: Fix wrong update of orig_nents
  lib/scatterlist: Provide a dedicated function to support table append

231 files changed:
Documentation/admin-guide/devices.txt
MAINTAINERS
drivers/infiniband/core/cache.c
drivers/infiniband/core/cma.c
drivers/infiniband/core/core_priv.h
drivers/infiniband/core/device.c
drivers/infiniband/core/iwcm.c
drivers/infiniband/core/iwpm_msg.c
drivers/infiniband/core/iwpm_util.c
drivers/infiniband/core/iwpm_util.h
drivers/infiniband/core/restrack.c
drivers/infiniband/core/sa_query.c
drivers/infiniband/core/umem_odp.c
drivers/infiniband/core/uverbs_cmd.c
drivers/infiniband/core/uverbs_std_types_qp.c
drivers/infiniband/core/verbs.c
drivers/infiniband/hw/bnxt_re/ib_verbs.c
drivers/infiniband/hw/bnxt_re/ib_verbs.h
drivers/infiniband/hw/bnxt_re/main.c
drivers/infiniband/hw/cxgb4/iw_cxgb4.h
drivers/infiniband/hw/cxgb4/provider.c
drivers/infiniband/hw/cxgb4/qp.c
drivers/infiniband/hw/efa/efa.h
drivers/infiniband/hw/efa/efa_main.c
drivers/infiniband/hw/efa/efa_verbs.c
drivers/infiniband/hw/hfi1/affinity.c
drivers/infiniband/hw/hfi1/affinity.h
drivers/infiniband/hw/hfi1/aspm.h
drivers/infiniband/hw/hfi1/chip.c
drivers/infiniband/hw/hfi1/chip.h
drivers/infiniband/hw/hfi1/chip_registers.h
drivers/infiniband/hw/hfi1/common.h
drivers/infiniband/hw/hfi1/debugfs.c
drivers/infiniband/hw/hfi1/debugfs.h
drivers/infiniband/hw/hfi1/device.c
drivers/infiniband/hw/hfi1/device.h
drivers/infiniband/hw/hfi1/driver.c
drivers/infiniband/hw/hfi1/efivar.c
drivers/infiniband/hw/hfi1/efivar.h
drivers/infiniband/hw/hfi1/eprom.c
drivers/infiniband/hw/hfi1/eprom.h
drivers/infiniband/hw/hfi1/exp_rcv.c
drivers/infiniband/hw/hfi1/exp_rcv.h
drivers/infiniband/hw/hfi1/fault.c
drivers/infiniband/hw/hfi1/fault.h
drivers/infiniband/hw/hfi1/file_ops.c
drivers/infiniband/hw/hfi1/firmware.c
drivers/infiniband/hw/hfi1/hfi.h
drivers/infiniband/hw/hfi1/init.c
drivers/infiniband/hw/hfi1/intr.c
drivers/infiniband/hw/hfi1/iowait.h
drivers/infiniband/hw/hfi1/ipoib_tx.c
drivers/infiniband/hw/hfi1/mad.c
drivers/infiniband/hw/hfi1/mad.h
drivers/infiniband/hw/hfi1/mmu_rb.c
drivers/infiniband/hw/hfi1/mmu_rb.h
drivers/infiniband/hw/hfi1/msix.c
drivers/infiniband/hw/hfi1/msix.h
drivers/infiniband/hw/hfi1/opa_compat.h
drivers/infiniband/hw/hfi1/pcie.c
drivers/infiniband/hw/hfi1/pio.c
drivers/infiniband/hw/hfi1/pio.h
drivers/infiniband/hw/hfi1/pio_copy.c
drivers/infiniband/hw/hfi1/platform.c
drivers/infiniband/hw/hfi1/platform.h
drivers/infiniband/hw/hfi1/qp.c
drivers/infiniband/hw/hfi1/qp.h
drivers/infiniband/hw/hfi1/qsfp.c
drivers/infiniband/hw/hfi1/qsfp.h
drivers/infiniband/hw/hfi1/rc.c
drivers/infiniband/hw/hfi1/ruc.c
drivers/infiniband/hw/hfi1/sdma.c
drivers/infiniband/hw/hfi1/sdma.h
drivers/infiniband/hw/hfi1/sdma_txreq.h
drivers/infiniband/hw/hfi1/sysfs.c
drivers/infiniband/hw/hfi1/tid_rdma.c
drivers/infiniband/hw/hfi1/trace.c
drivers/infiniband/hw/hfi1/trace.h
drivers/infiniband/hw/hfi1/trace_ctxts.h
drivers/infiniband/hw/hfi1/trace_dbg.h
drivers/infiniband/hw/hfi1/trace_ibhdrs.h
drivers/infiniband/hw/hfi1/trace_misc.h
drivers/infiniband/hw/hfi1/trace_mmu.h
drivers/infiniband/hw/hfi1/trace_rc.h
drivers/infiniband/hw/hfi1/trace_rx.h
drivers/infiniband/hw/hfi1/trace_tx.h
drivers/infiniband/hw/hfi1/uc.c
drivers/infiniband/hw/hfi1/ud.c
drivers/infiniband/hw/hfi1/user_exp_rcv.c
drivers/infiniband/hw/hfi1/user_exp_rcv.h
drivers/infiniband/hw/hfi1/user_pages.c
drivers/infiniband/hw/hfi1/user_sdma.c
drivers/infiniband/hw/hfi1/user_sdma.h
drivers/infiniband/hw/hfi1/verbs.c
drivers/infiniband/hw/hfi1/verbs.h
drivers/infiniband/hw/hfi1/verbs_txreq.c
drivers/infiniband/hw/hfi1/verbs_txreq.h
drivers/infiniband/hw/hfi1/vnic.h
drivers/infiniband/hw/hfi1/vnic_main.c
drivers/infiniband/hw/hfi1/vnic_sdma.c
drivers/infiniband/hw/hns/hns_roce_alloc.c
drivers/infiniband/hw/hns/hns_roce_device.h
drivers/infiniband/hw/hns/hns_roce_hw_v1.c
drivers/infiniband/hw/hns/hns_roce_hw_v2.c
drivers/infiniband/hw/hns/hns_roce_hw_v2.h
drivers/infiniband/hw/hns/hns_roce_main.c
drivers/infiniband/hw/hns/hns_roce_mr.c
drivers/infiniband/hw/hns/hns_roce_pd.c
drivers/infiniband/hw/hns/hns_roce_qp.c
drivers/infiniband/hw/hns/hns_roce_srq.c
drivers/infiniband/hw/irdma/protos.h
drivers/infiniband/hw/irdma/utils.c
drivers/infiniband/hw/irdma/verbs.c
drivers/infiniband/hw/mlx4/main.c
drivers/infiniband/hw/mlx4/mlx4_ib.h
drivers/infiniband/hw/mlx4/qp.c
drivers/infiniband/hw/mlx5/cq.c
drivers/infiniband/hw/mlx5/devx.c
drivers/infiniband/hw/mlx5/gsi.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/qp.c
drivers/infiniband/hw/mlx5/std_types.c
drivers/infiniband/hw/mthca/mthca_eq.c
drivers/infiniband/hw/mthca/mthca_main.c
drivers/infiniband/hw/mthca/mthca_memfree.c
drivers/infiniband/hw/mthca/mthca_provider.c
drivers/infiniband/hw/ocrdma/ocrdma_main.c
drivers/infiniband/hw/ocrdma/ocrdma_verbs.c
drivers/infiniband/hw/ocrdma/ocrdma_verbs.h
drivers/infiniband/hw/qedr/main.c
drivers/infiniband/hw/qedr/qedr_roce_cm.c
drivers/infiniband/hw/qedr/qedr_roce_cm.h
drivers/infiniband/hw/qedr/verbs.c
drivers/infiniband/hw/qedr/verbs.h
drivers/infiniband/hw/qib/qib_file_ops.c
drivers/infiniband/hw/qib/qib_init.c
drivers/infiniband/hw/qib/qib_user_pages.c
drivers/infiniband/hw/usnic/usnic_ib_main.c
drivers/infiniband/hw/usnic/usnic_ib_qp_grp.c
drivers/infiniband/hw/usnic/usnic_ib_qp_grp.h
drivers/infiniband/hw/usnic/usnic_ib_verbs.c
drivers/infiniband/hw/usnic/usnic_ib_verbs.h
drivers/infiniband/hw/vmw_pvrdma/pvrdma_main.c
drivers/infiniband/hw/vmw_pvrdma/pvrdma_qp.c
drivers/infiniband/hw/vmw_pvrdma/pvrdma_verbs.h
drivers/infiniband/sw/rdmavt/ah.c
drivers/infiniband/sw/rdmavt/ah.h
drivers/infiniband/sw/rdmavt/cq.c
drivers/infiniband/sw/rdmavt/cq.h
drivers/infiniband/sw/rdmavt/mad.c
drivers/infiniband/sw/rdmavt/mad.h
drivers/infiniband/sw/rdmavt/mcast.c
drivers/infiniband/sw/rdmavt/mcast.h
drivers/infiniband/sw/rdmavt/mmap.c
drivers/infiniband/sw/rdmavt/mmap.h
drivers/infiniband/sw/rdmavt/mr.c
drivers/infiniband/sw/rdmavt/mr.h
drivers/infiniband/sw/rdmavt/pd.c
drivers/infiniband/sw/rdmavt/pd.h
drivers/infiniband/sw/rdmavt/qp.c
drivers/infiniband/sw/rdmavt/qp.h
drivers/infiniband/sw/rdmavt/rc.c
drivers/infiniband/sw/rdmavt/srq.c
drivers/infiniband/sw/rdmavt/srq.h
drivers/infiniband/sw/rdmavt/trace.c
drivers/infiniband/sw/rdmavt/trace.h
drivers/infiniband/sw/rdmavt/trace_cq.h
drivers/infiniband/sw/rdmavt/trace_mr.h
drivers/infiniband/sw/rdmavt/trace_qp.h
drivers/infiniband/sw/rdmavt/trace_rc.h
drivers/infiniband/sw/rdmavt/trace_rvt.h
drivers/infiniband/sw/rdmavt/trace_tx.h
drivers/infiniband/sw/rdmavt/vt.c
drivers/infiniband/sw/rdmavt/vt.h
drivers/infiniband/sw/rxe/rxe.h
drivers/infiniband/sw/rxe/rxe_comp.c
drivers/infiniband/sw/rxe/rxe_icrc.c
drivers/infiniband/sw/rxe/rxe_loc.h
drivers/infiniband/sw/rxe/rxe_mr.c
drivers/infiniband/sw/rxe/rxe_net.c
drivers/infiniband/sw/rxe/rxe_pool.c
drivers/infiniband/sw/rxe/rxe_recv.c
drivers/infiniband/sw/rxe/rxe_req.c
drivers/infiniband/sw/rxe/rxe_resp.c
drivers/infiniband/sw/rxe/rxe_verbs.c
drivers/infiniband/sw/rxe/rxe_verbs.h
drivers/infiniband/sw/siw/siw_main.c
drivers/infiniband/sw/siw/siw_qp.c
drivers/infiniband/sw/siw/siw_qp_tx.c
drivers/infiniband/sw/siw/siw_verbs.c
drivers/infiniband/sw/siw/siw_verbs.h
drivers/infiniband/ulp/rtrs/rtrs-clt-stats.c
drivers/infiniband/ulp/rtrs/rtrs-clt.c
drivers/infiniband/ulp/rtrs/rtrs-clt.h
drivers/infiniband/ulp/rtrs/rtrs-pri.h
drivers/infiniband/ulp/rtrs/rtrs-srv.c
drivers/infiniband/ulp/rtrs/rtrs-srv.h
drivers/infiniband/ulp/rtrs/rtrs.c
drivers/net/ethernet/mellanox/mlx5/core/cq.c
drivers/net/ethernet/mellanox/mlx5/core/en/mapping.c
drivers/net/ethernet/mellanox/mlx5/core/en/mapping.h
drivers/net/ethernet/mellanox/mlx5/core/en/tc_ct.c
drivers/net/ethernet/mellanox/mlx5/core/en_main.c
drivers/net/ethernet/mellanox/mlx5/core/en_rep.c
drivers/net/ethernet/mellanox/mlx5/core/en_rep.h
drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
drivers/net/ethernet/mellanox/mlx5/core/esw/acl/egress_ofld.c
drivers/net/ethernet/mellanox/mlx5/core/eswitch.c
drivers/net/ethernet/mellanox/mlx5/core/eswitch.h
drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c
drivers/net/ethernet/mellanox/mlx5/core/fpga/conn.c
drivers/net/ethernet/mellanox/mlx5/core/fs_cmd.c
drivers/net/ethernet/mellanox/mlx5/core/fs_core.c
drivers/net/ethernet/mellanox/mlx5/core/fs_core.h
drivers/net/ethernet/mellanox/mlx5/core/lag.c
drivers/net/ethernet/mellanox/mlx5/core/lag.h
drivers/net/ethernet/mellanox/mlx5/core/lag_mp.c
drivers/net/ethernet/mellanox/mlx5/core/main.c
drivers/net/ethernet/mellanox/mlx5/core/mlx5_core.h
drivers/net/ethernet/mellanox/mlx5/core/steering/dr_send.c
drivers/net/ethernet/qlogic/qed/qed_cxt.c
drivers/vdpa/mlx5/net/mlx5_vnet.c
include/linux/mlx5/driver.h
include/linux/mlx5/eswitch.h
include/linux/mlx5/mlx5_ifc.h
include/rdma/ib_sa.h
include/rdma/ib_verbs.h
include/rdma/rdmavt_qp.h
include/uapi/rdma/mlx5-abi.h

index 9c2be821c22547e13dc17f26cfa93ce5bfaa0e15..922c23bb4372a12855a9f815bf439d858ef1b5a4 100644 (file)
                65 = /dev/infiniband/issm1     Second InfiniBand IsSM device
                  ...
                127 = /dev/infiniband/issm63    63rd InfiniBand IsSM device
-               128 = /dev/infiniband/uverbs0   First InfiniBand verbs device
-               129 = /dev/infiniband/uverbs1   Second InfiniBand verbs device
+               192 = /dev/infiniband/uverbs0   First InfiniBand verbs device
+               193 = /dev/infiniband/uverbs1   Second InfiniBand verbs device
                  ...
-               159 = /dev/infiniband/uverbs31  31st InfiniBand verbs device
+               223 = /dev/infiniband/uverbs31  31st InfiniBand verbs device
 
  232 char      Biometric Devices
                0 = /dev/biometric/sensor0/fingerprint  first fingerprint sensor on first device
index fd25e4ecf0b924d42944aa0c43bf070d5cfe2999..b25f14a04917970e8daeaa2c9dcf8ac8323ca0b5 100644 (file)
@@ -8395,7 +8395,7 @@ F:        drivers/crypto/hisilicon/sgl.c
 F:     drivers/crypto/hisilicon/zip/
 
 HISILICON ROCE DRIVER
-M:     Lijun Ou <oulijun@huawei.com>
+M:     Wenpeng Liang <liangwenpeng@huawei.com>
 M:     Weihang Li <liweihang@huawei.com>
 L:     linux-rdma@vger.kernel.org
 S:     Maintained
index c9e9fc81447e897a9eb749cacf14c43509c8a606..0c98dd3dee67832b33383bf5782ada595643dbee 100644 (file)
@@ -1429,7 +1429,7 @@ int rdma_read_gid_l2_fields(const struct ib_gid_attr *attr,
 EXPORT_SYMBOL(rdma_read_gid_l2_fields);
 
 static int config_non_roce_gid_cache(struct ib_device *device,
-                                    u32 port, int gid_tbl_len)
+                                    u32 port, struct ib_port_attr *tprops)
 {
        struct ib_gid_attr gid_attr = {};
        struct ib_gid_table *table;
@@ -1441,7 +1441,7 @@ static int config_non_roce_gid_cache(struct ib_device *device,
        table = rdma_gid_table(device, port);
 
        mutex_lock(&table->lock);
-       for (i = 0; i < gid_tbl_len; ++i) {
+       for (i = 0; i < tprops->gid_tbl_len; ++i) {
                if (!device->ops.query_gid)
                        continue;
                ret = device->ops.query_gid(device, port, i, &gid_attr.gid);
@@ -1452,6 +1452,8 @@ static int config_non_roce_gid_cache(struct ib_device *device,
                        goto err;
                }
                gid_attr.index = i;
+               tprops->subnet_prefix =
+                       be64_to_cpu(gid_attr.gid.global.subnet_prefix);
                add_modify_gid(table, &gid_attr);
        }
 err:
@@ -1484,7 +1486,7 @@ ib_cache_update(struct ib_device *device, u32 port, bool update_gids,
 
        if (!rdma_protocol_roce(device, port) && update_gids) {
                ret = config_non_roce_gid_cache(device, port,
-                                               tprops->gid_tbl_len);
+                                               tprops);
                if (ret)
                        goto err;
        }
@@ -1619,8 +1621,6 @@ int ib_cache_setup_one(struct ib_device *device)
        u32 p;
        int err;
 
-       rwlock_init(&device->cache_lock);
-
        err = gid_table_setup_one(device);
        if (err)
                return err;
index 5d3b8b8d163d669ab062663123daf9d63610db4d..c40791baced58836ba6bd5711e565c1e7ffedca1 100644 (file)
@@ -3132,6 +3132,9 @@ int rdma_resolve_route(struct rdma_cm_id *id, unsigned long timeout_ms)
        struct rdma_id_private *id_priv;
        int ret;
 
+       if (!timeout_ms)
+               return -EINVAL;
+
        id_priv = container_of(id, struct rdma_id_private, id);
        if (!cma_comp_exch(id_priv, RDMA_CM_ADDR_RESOLVED, RDMA_CM_ROUTE_QUERY))
                return -EINVAL;
index 647cca4e024015d0b06e66b1426bb8db1a33ba3c..f66f48d860ec3817a7c64f954dae0e92eef6fd8c 100644 (file)
@@ -316,45 +316,13 @@ struct ib_device *ib_device_get_by_index(const struct net *net, u32 index);
 void nldev_init(void);
 void nldev_exit(void);
 
-static inline struct ib_qp *
-_ib_create_qp(struct ib_device *dev, struct ib_pd *pd,
-             struct ib_qp_init_attr *attr, struct ib_udata *udata,
-             struct ib_uqp_object *uobj, const char *caller)
-{
-       struct ib_qp *qp;
-
-       if (!dev->ops.create_qp)
-               return ERR_PTR(-EOPNOTSUPP);
-
-       qp = dev->ops.create_qp(pd, attr, udata);
-       if (IS_ERR(qp))
-               return qp;
-
-       qp->device = dev;
-       qp->pd = pd;
-       qp->uobject = uobj;
-       qp->real_qp = qp;
-
-       qp->qp_type = attr->qp_type;
-       qp->rwq_ind_tbl = attr->rwq_ind_tbl;
-       qp->send_cq = attr->send_cq;
-       qp->recv_cq = attr->recv_cq;
-       qp->srq = attr->srq;
-       qp->rwq_ind_tbl = attr->rwq_ind_tbl;
-       qp->event_handler = attr->event_handler;
-       qp->port = attr->port_num;
-
-       atomic_set(&qp->usecnt, 0);
-       spin_lock_init(&qp->mr_lock);
-       INIT_LIST_HEAD(&qp->rdma_mrs);
-       INIT_LIST_HEAD(&qp->sig_mrs);
-
-       rdma_restrack_new(&qp->res, RDMA_RESTRACK_QP);
-       WARN_ONCE(!udata && !caller, "Missing kernel QP owner");
-       rdma_restrack_set_name(&qp->res, udata ? NULL : caller);
-       rdma_restrack_add(&qp->res);
-       return qp;
-}
+struct ib_qp *ib_create_qp_user(struct ib_device *dev, struct ib_pd *pd,
+                               struct ib_qp_init_attr *attr,
+                               struct ib_udata *udata,
+                               struct ib_uqp_object *uobj, const char *caller);
+
+void ib_qp_usecnt_inc(struct ib_qp *qp);
+void ib_qp_usecnt_dec(struct ib_qp *qp);
 
 struct rdma_dev_addr;
 int rdma_resolve_ip_route(struct sockaddr *src_addr,
index fa20b1824fb823eed5b5f43e412a7ea8b3c7cb64..f4814bb7f082f16edb8484bfefaf70d6d7409231 100644 (file)
@@ -607,6 +607,8 @@ struct ib_device *_ib_alloc_device(size_t size)
        for (i = 0; i < ARRAY_SIZE(device->cq_pools); i++)
                INIT_LIST_HEAD(&device->cq_pools[i]);
 
+       rwlock_init(&device->cache_lock);
+
        device->uverbs_cmd_mask =
                BIT_ULL(IB_USER_VERBS_CMD_ALLOC_MW) |
                BIT_ULL(IB_USER_VERBS_CMD_ALLOC_PD) |
@@ -2050,7 +2052,6 @@ static int __ib_query_port(struct ib_device *device,
                           u32 port_num,
                           struct ib_port_attr *port_attr)
 {
-       union ib_gid gid = {};
        int err;
 
        memset(port_attr, 0, sizeof(*port_attr));
@@ -2063,11 +2064,8 @@ static int __ib_query_port(struct ib_device *device,
            IB_LINK_LAYER_INFINIBAND)
                return 0;
 
-       err = device->ops.query_gid(device, port_num, 0, &gid);
-       if (err)
-               return err;
-
-       port_attr->subnet_prefix = be64_to_cpu(gid.global.subnet_prefix);
+       ib_get_cached_subnet_prefix(device, port_num,
+                                   &port_attr->subnet_prefix);
        return 0;
 }
 
@@ -2656,6 +2654,7 @@ void ib_set_device_ops(struct ib_device *dev, const struct ib_device_ops *ops)
        SET_DEVICE_OP(dev_ops, get_hw_stats);
        SET_DEVICE_OP(dev_ops, get_link_layer);
        SET_DEVICE_OP(dev_ops, get_netdev);
+       SET_DEVICE_OP(dev_ops, get_numa_node);
        SET_DEVICE_OP(dev_ops, get_port_immutable);
        SET_DEVICE_OP(dev_ops, get_vector_affinity);
        SET_DEVICE_OP(dev_ops, get_vf_config);
@@ -2712,6 +2711,7 @@ void ib_set_device_ops(struct ib_device *dev, const struct ib_device_ops *ops)
        SET_OBJ_SIZE(dev_ops, ib_cq);
        SET_OBJ_SIZE(dev_ops, ib_mw);
        SET_OBJ_SIZE(dev_ops, ib_pd);
+       SET_OBJ_SIZE(dev_ops, ib_qp);
        SET_OBJ_SIZE(dev_ops, ib_rwq_ind_table);
        SET_OBJ_SIZE(dev_ops, ib_srq);
        SET_OBJ_SIZE(dev_ops, ib_ucontext);
index 42261152b48924e7141742c030144478b0f681e2..2b47073c61a65e538c9b3f6e59fdcebddad2927b 100644 (file)
@@ -1186,29 +1186,34 @@ static int __init iw_cm_init(void)
 
        ret = iwpm_init(RDMA_NL_IWCM);
        if (ret)
-               pr_err("iw_cm: couldn't init iwpm\n");
-       else
-               rdma_nl_register(RDMA_NL_IWCM, iwcm_nl_cb_table);
+               return ret;
+
        iwcm_wq = alloc_ordered_workqueue("iw_cm_wq", 0);
        if (!iwcm_wq)
-               return -ENOMEM;
+               goto err_alloc;
 
        iwcm_ctl_table_hdr = register_net_sysctl(&init_net, "net/iw_cm",
                                                 iwcm_ctl_table);
        if (!iwcm_ctl_table_hdr) {
                pr_err("iw_cm: couldn't register sysctl paths\n");
-               destroy_workqueue(iwcm_wq);
-               return -ENOMEM;
+               goto err_sysctl;
        }
 
+       rdma_nl_register(RDMA_NL_IWCM, iwcm_nl_cb_table);
        return 0;
+
+err_sysctl:
+       destroy_workqueue(iwcm_wq);
+err_alloc:
+       iwpm_exit(RDMA_NL_IWCM);
+       return -ENOMEM;
 }
 
 static void __exit iw_cm_cleanup(void)
 {
+       rdma_nl_unregister(RDMA_NL_IWCM);
        unregister_net_sysctl_table(iwcm_ctl_table_hdr);
        destroy_workqueue(iwcm_wq);
-       rdma_nl_unregister(RDMA_NL_IWCM);
        iwpm_exit(RDMA_NL_IWCM);
 }
 
index 12a9816fc0e23c1984fb9911e8acd231c26f4954..3c9a9869212bbe505bb071ae24ec5be5f1dd66b0 100644 (file)
@@ -69,10 +69,6 @@ int iwpm_register_pid(struct iwpm_dev_data *pm_msg, u8 nl_client)
        const char *err_str = "";
        int ret = -EINVAL;
 
-       if (!iwpm_valid_client(nl_client)) {
-               err_str = "Invalid port mapper client";
-               goto pid_query_error;
-       }
        if (iwpm_check_registration(nl_client, IWPM_REG_VALID) ||
                        iwpm_user_pid == IWPM_PID_UNAVAILABLE)
                return 0;
@@ -153,10 +149,6 @@ int iwpm_add_mapping(struct iwpm_sa_data *pm_msg, u8 nl_client)
        const char *err_str = "";
        int ret = -EINVAL;
 
-       if (!iwpm_valid_client(nl_client)) {
-               err_str = "Invalid port mapper client";
-               goto add_mapping_error;
-       }
        if (!iwpm_valid_pid())
                return 0;
        if (!iwpm_check_registration(nl_client, IWPM_REG_VALID)) {
@@ -240,10 +232,6 @@ int iwpm_add_and_query_mapping(struct iwpm_sa_data *pm_msg, u8 nl_client)
        const char *err_str = "";
        int ret = -EINVAL;
 
-       if (!iwpm_valid_client(nl_client)) {
-               err_str = "Invalid port mapper client";
-               goto query_mapping_error;
-       }
        if (!iwpm_valid_pid())
                return 0;
        if (!iwpm_check_registration(nl_client, IWPM_REG_VALID)) {
@@ -331,10 +319,6 @@ int iwpm_remove_mapping(struct sockaddr_storage *local_addr, u8 nl_client)
        const char *err_str = "";
        int ret = -EINVAL;
 
-       if (!iwpm_valid_client(nl_client)) {
-               err_str = "Invalid port mapper client";
-               goto remove_mapping_error;
-       }
        if (!iwpm_valid_pid())
                return 0;
        if (iwpm_check_registration(nl_client, IWPM_REG_UNDEF)) {
@@ -444,8 +428,7 @@ int iwpm_register_pid_cb(struct sk_buff *skb, struct netlink_callback *cb)
        atomic_set(&echo_nlmsg_seq, cb->nlh->nlmsg_seq);
        pr_debug("%s: iWarp Port Mapper (pid = %d) is available!\n",
                        __func__, iwpm_user_pid);
-       if (iwpm_valid_client(nl_client))
-               iwpm_set_registration(nl_client, IWPM_REG_VALID);
+       iwpm_set_registration(nl_client, IWPM_REG_VALID);
 register_pid_response_exit:
        nlmsg_request->request_done = 1;
        /* always for found nlmsg_request */
@@ -649,11 +632,6 @@ int iwpm_remote_info_cb(struct sk_buff *skb, struct netlink_callback *cb)
                return ret;
 
        nl_client = RDMA_NL_GET_CLIENT(cb->nlh->nlmsg_type);
-       if (!iwpm_valid_client(nl_client)) {
-               pr_info("%s: Invalid port mapper client = %u\n",
-                               __func__, nl_client);
-               return ret;
-       }
        atomic_set(&echo_nlmsg_seq, cb->nlh->nlmsg_seq);
 
        local_sockaddr = (struct sockaddr_storage *)
@@ -736,11 +714,6 @@ int iwpm_mapping_info_cb(struct sk_buff *skb, struct netlink_callback *cb)
                return ret;
        }
        nl_client = RDMA_NL_GET_CLIENT(cb->nlh->nlmsg_type);
-       if (!iwpm_valid_client(nl_client)) {
-               pr_info("%s: Invalid port mapper client = %u\n",
-                               __func__, nl_client);
-               return ret;
-       }
        iwpm_set_registration(nl_client, IWPM_REG_INCOMPL);
        atomic_set(&echo_nlmsg_seq, cb->nlh->nlmsg_seq);
        iwpm_user_pid = cb->nlh->nlmsg_pid;
@@ -863,11 +836,6 @@ int iwpm_hello_cb(struct sk_buff *skb, struct netlink_callback *cb)
        }
        abi_version = nla_get_u16(nltb[IWPM_NLA_HELLO_ABI_VERSION]);
        nl_client = RDMA_NL_GET_CLIENT(cb->nlh->nlmsg_type);
-       if (!iwpm_valid_client(nl_client)) {
-               pr_info("%s: Invalid port mapper client = %u\n",
-                               __func__, nl_client);
-               return ret;
-       }
        iwpm_set_registration(nl_client, IWPM_REG_INCOMPL);
        atomic_set(&echo_nlmsg_seq, cb->nlh->nlmsg_seq);
        iwpm_ulib_version = min_t(u16, IWPM_UABI_VERSION, abi_version);
index 3f8c019c7260274a3bea245edeb6f0941d703ba6..54f4feb604d858c5728dd59960cdf403df15b70f 100644 (file)
@@ -48,7 +48,6 @@ static DEFINE_SPINLOCK(iwpm_mapinfo_lock);
 static struct hlist_head *iwpm_reminfo_bucket;
 static DEFINE_SPINLOCK(iwpm_reminfo_lock);
 
-static DEFINE_MUTEX(iwpm_admin_lock);
 static struct iwpm_admin_data iwpm_admin;
 
 /**
@@ -59,39 +58,21 @@ static struct iwpm_admin_data iwpm_admin;
  */
 int iwpm_init(u8 nl_client)
 {
-       int ret = 0;
-       mutex_lock(&iwpm_admin_lock);
-       if (!refcount_read(&iwpm_admin.refcount)) {
-               iwpm_hash_bucket = kcalloc(IWPM_MAPINFO_HASH_SIZE,
-                                          sizeof(struct hlist_head),
-                                          GFP_KERNEL);
-               if (!iwpm_hash_bucket) {
-                       ret = -ENOMEM;
-                       goto init_exit;
-               }
-               iwpm_reminfo_bucket = kcalloc(IWPM_REMINFO_HASH_SIZE,
-                                             sizeof(struct hlist_head),
-                                             GFP_KERNEL);
-               if (!iwpm_reminfo_bucket) {
-                       kfree(iwpm_hash_bucket);
-                       ret = -ENOMEM;
-                       goto init_exit;
-               }
+       iwpm_hash_bucket = kcalloc(IWPM_MAPINFO_HASH_SIZE,
+                                  sizeof(struct hlist_head), GFP_KERNEL);
+       if (!iwpm_hash_bucket)
+               return -ENOMEM;
 
-               refcount_set(&iwpm_admin.refcount, 1);
-       } else {
-               refcount_inc(&iwpm_admin.refcount);
+       iwpm_reminfo_bucket = kcalloc(IWPM_REMINFO_HASH_SIZE,
+                                     sizeof(struct hlist_head), GFP_KERNEL);
+       if (!iwpm_reminfo_bucket) {
+               kfree(iwpm_hash_bucket);
+               return -ENOMEM;
        }
 
-init_exit:
-       mutex_unlock(&iwpm_admin_lock);
-       if (!ret) {
-               iwpm_set_valid(nl_client, 1);
-               iwpm_set_registration(nl_client, IWPM_REG_UNDEF);
-               pr_debug("%s: Mapinfo and reminfo tables are created\n",
-                               __func__);
-       }
-       return ret;
+       iwpm_set_registration(nl_client, IWPM_REG_UNDEF);
+       pr_debug("%s: Mapinfo and reminfo tables are created\n", __func__);
+       return 0;
 }
 
 static void free_hash_bucket(void);
@@ -105,22 +86,9 @@ static void free_reminfo_bucket(void);
  */
 int iwpm_exit(u8 nl_client)
 {
-
-       if (!iwpm_valid_client(nl_client))
-               return -EINVAL;
-       mutex_lock(&iwpm_admin_lock);
-       if (!refcount_read(&iwpm_admin.refcount)) {
-               mutex_unlock(&iwpm_admin_lock);
-               pr_err("%s Incorrect usage - negative refcount\n", __func__);
-               return -EINVAL;
-       }
-       if (refcount_dec_and_test(&iwpm_admin.refcount)) {
-               free_hash_bucket();
-               free_reminfo_bucket();
-               pr_debug("%s: Resources are destroyed\n", __func__);
-       }
-       mutex_unlock(&iwpm_admin_lock);
-       iwpm_set_valid(nl_client, 0);
+       free_hash_bucket();
+       free_reminfo_bucket();
+       pr_debug("%s: Resources are destroyed\n", __func__);
        iwpm_set_registration(nl_client, IWPM_REG_UNDEF);
        return 0;
 }
@@ -145,8 +113,6 @@ int iwpm_create_mapinfo(struct sockaddr_storage *local_sockaddr,
        unsigned long flags;
        int ret = -EINVAL;
 
-       if (!iwpm_valid_client(nl_client))
-               return ret;
        map_info = kzalloc(sizeof(struct iwpm_mapping_info), GFP_KERNEL);
        if (!map_info)
                return -ENOMEM;
@@ -306,10 +272,6 @@ int iwpm_get_remote_info(struct sockaddr_storage *mapped_loc_addr,
        unsigned long flags;
        int ret = -EINVAL;
 
-       if (!iwpm_valid_client(nl_client)) {
-               pr_info("%s: Invalid client = %u\n", __func__, nl_client);
-               return ret;
-       }
        spin_lock_irqsave(&iwpm_reminfo_lock, flags);
        if (iwpm_reminfo_bucket) {
                hash_bucket_head = get_reminfo_hash_bucket(
@@ -424,16 +386,6 @@ int iwpm_get_nlmsg_seq(void)
        return atomic_inc_return(&iwpm_admin.nlmsg_seq);
 }
 
-int iwpm_valid_client(u8 nl_client)
-{
-       return iwpm_admin.client_list[nl_client];
-}
-
-void iwpm_set_valid(u8 nl_client, int valid)
-{
-       iwpm_admin.client_list[nl_client] = valid;
-}
-
 /* valid client */
 u32 iwpm_get_registration(u8 nl_client)
 {
index e201835de7332c629e9907b1b511082e5709414d..3a42ad43056e7578b66e292a782f01d54cfd4332 100644 (file)
@@ -90,9 +90,7 @@ struct iwpm_remote_info {
 };
 
 struct iwpm_admin_data {
-       refcount_t refcount;
        atomic_t nlmsg_seq;
-       int      client_list[RDMA_NL_NUM_CLIENTS];
        u32      reg_list[RDMA_NL_NUM_CLIENTS];
 };
 
@@ -147,22 +145,6 @@ int iwpm_get_nlmsg_seq(void);
  */
 void iwpm_add_remote_info(struct iwpm_remote_info *reminfo);
 
-/**
- * iwpm_valid_client - Check if the port mapper client is valid
- * @nl_client: The index of the netlink client
- *
- * Valid clients need to call iwpm_init() before using
- * the port mapper
- */
-int iwpm_valid_client(u8 nl_client);
-
-/**
- * iwpm_set_valid - Set the port mapper client to valid or not
- * @nl_client: The index of the netlink client
- * @valid: 1 if valid or 0 if invalid
- */
-void iwpm_set_valid(u8 nl_client, int valid);
-
 /**
  * iwpm_check_registration - Check if the client registration
  *                           matches the given one
index 033207882c82ce6b269d1570f99f5a28c98d33eb..1f935d9f6178548548ddfe624d95b9e4ca76ecc7 100644 (file)
@@ -343,7 +343,7 @@ void rdma_restrack_del(struct rdma_restrack_entry *res)
        rt = &dev->res[res->type];
 
        old = xa_erase(&rt->xa, res->id);
-       if (res->type == RDMA_RESTRACK_MR || res->type == RDMA_RESTRACK_QP)
+       if (res->type == RDMA_RESTRACK_MR)
                return;
        WARN_ON(old != res);
 
index b61576f702b86023fdf8430e5c213355da8086e0..a20b8108e160c5f25c4fb9cd27dd0a0a216d0b5d 100644 (file)
@@ -123,12 +123,6 @@ struct ib_sa_query {
 #define IB_SA_CANCEL                   0x00000002
 #define IB_SA_QUERY_OPA                        0x00000004
 
-struct ib_sa_service_query {
-       void (*callback)(int, struct ib_sa_service_rec *, void *);
-       void *context;
-       struct ib_sa_query sa_query;
-};
-
 struct ib_sa_path_query {
        void (*callback)(int, struct sa_path_rec *, void *);
        void *context;
@@ -502,54 +496,6 @@ static const struct ib_field mcmember_rec_table[] = {
          .size_bits    = 23 },
 };
 
-#define SERVICE_REC_FIELD(field) \
-       .struct_offset_bytes = offsetof(struct ib_sa_service_rec, field),       \
-       .struct_size_bytes   = sizeof_field(struct ib_sa_service_rec, field),   \
-       .field_name          = "sa_service_rec:" #field
-
-static const struct ib_field service_rec_table[] = {
-       { SERVICE_REC_FIELD(id),
-         .offset_words = 0,
-         .offset_bits  = 0,
-         .size_bits    = 64 },
-       { SERVICE_REC_FIELD(gid),
-         .offset_words = 2,
-         .offset_bits  = 0,
-         .size_bits    = 128 },
-       { SERVICE_REC_FIELD(pkey),
-         .offset_words = 6,
-         .offset_bits  = 0,
-         .size_bits    = 16 },
-       { SERVICE_REC_FIELD(lease),
-         .offset_words = 7,
-         .offset_bits  = 0,
-         .size_bits    = 32 },
-       { SERVICE_REC_FIELD(key),
-         .offset_words = 8,
-         .offset_bits  = 0,
-         .size_bits    = 128 },
-       { SERVICE_REC_FIELD(name),
-         .offset_words = 12,
-         .offset_bits  = 0,
-         .size_bits    = 64*8 },
-       { SERVICE_REC_FIELD(data8),
-         .offset_words = 28,
-         .offset_bits  = 0,
-         .size_bits    = 16*8 },
-       { SERVICE_REC_FIELD(data16),
-         .offset_words = 32,
-         .offset_bits  = 0,
-         .size_bits    = 8*16 },
-       { SERVICE_REC_FIELD(data32),
-         .offset_words = 36,
-         .offset_bits  = 0,
-         .size_bits    = 4*32 },
-       { SERVICE_REC_FIELD(data64),
-         .offset_words = 40,
-         .offset_bits  = 0,
-         .size_bits    = 2*64 },
-};
-
 #define CLASSPORTINFO_REC_FIELD(field) \
        .struct_offset_bytes = offsetof(struct ib_class_port_info, field),      \
        .struct_size_bytes   = sizeof_field(struct ib_class_port_info, field),  \
@@ -1358,6 +1304,7 @@ static int send_mad(struct ib_sa_query *query, unsigned long timeout_ms,
 {
        unsigned long flags;
        int ret, id;
+       const int nmbr_sa_query_retries = 10;
 
        xa_lock_irqsave(&queries, flags);
        ret = __xa_alloc(&queries, &id, query, xa_limit_32b, gfp_mask);
@@ -1365,7 +1312,13 @@ static int send_mad(struct ib_sa_query *query, unsigned long timeout_ms,
        if (ret < 0)
                return ret;
 
-       query->mad_buf->timeout_ms  = timeout_ms;
+       query->mad_buf->timeout_ms  = timeout_ms / nmbr_sa_query_retries;
+       query->mad_buf->retries = nmbr_sa_query_retries;
+       if (!query->mad_buf->timeout_ms) {
+               /* Special case, very small timeout_ms */
+               query->mad_buf->timeout_ms = 1;
+               query->mad_buf->retries = timeout_ms;
+       }
        query->mad_buf->context[0] = query;
        query->id = id;
 
@@ -1634,129 +1587,6 @@ err1:
 }
 EXPORT_SYMBOL(ib_sa_path_rec_get);
 
-static void ib_sa_service_rec_callback(struct ib_sa_query *sa_query,
-                                   int status,
-                                   struct ib_sa_mad *mad)
-{
-       struct ib_sa_service_query *query =
-               container_of(sa_query, struct ib_sa_service_query, sa_query);
-
-       if (mad) {
-               struct ib_sa_service_rec rec;
-
-               ib_unpack(service_rec_table, ARRAY_SIZE(service_rec_table),
-                         mad->data, &rec);
-               query->callback(status, &rec, query->context);
-       } else
-               query->callback(status, NULL, query->context);
-}
-
-static void ib_sa_service_rec_release(struct ib_sa_query *sa_query)
-{
-       kfree(container_of(sa_query, struct ib_sa_service_query, sa_query));
-}
-
-/**
- * ib_sa_service_rec_query - Start Service Record operation
- * @client:SA client
- * @device:device to send request on
- * @port_num: port number to send request on
- * @method:SA method - should be get, set, or delete
- * @rec:Service Record to send in request
- * @comp_mask:component mask to send in request
- * @timeout_ms:time to wait for response
- * @gfp_mask:GFP mask to use for internal allocations
- * @callback:function called when request completes, times out or is
- * canceled
- * @context:opaque user context passed to callback
- * @sa_query:request context, used to cancel request
- *
- * Send a Service Record set/get/delete to the SA to register,
- * unregister or query a service record.
- * The callback function will be called when the request completes (or
- * fails); status is 0 for a successful response, -EINTR if the query
- * is canceled, -ETIMEDOUT is the query timed out, or -EIO if an error
- * occurred sending the query.  The resp parameter of the callback is
- * only valid if status is 0.
- *
- * If the return value of ib_sa_service_rec_query() is negative, it is an
- * error code.  Otherwise it is a request ID that can be used to cancel
- * the query.
- */
-int ib_sa_service_rec_query(struct ib_sa_client *client,
-                           struct ib_device *device, u32 port_num, u8 method,
-                           struct ib_sa_service_rec *rec,
-                           ib_sa_comp_mask comp_mask,
-                           unsigned long timeout_ms, gfp_t gfp_mask,
-                           void (*callback)(int status,
-                                            struct ib_sa_service_rec *resp,
-                                            void *context),
-                           void *context,
-                           struct ib_sa_query **sa_query)
-{
-       struct ib_sa_service_query *query;
-       struct ib_sa_device *sa_dev = ib_get_client_data(device, &sa_client);
-       struct ib_sa_port   *port;
-       struct ib_mad_agent *agent;
-       struct ib_sa_mad *mad;
-       int ret;
-
-       if (!sa_dev)
-               return -ENODEV;
-
-       port  = &sa_dev->port[port_num - sa_dev->start_port];
-       agent = port->agent;
-
-       if (method != IB_MGMT_METHOD_GET &&
-           method != IB_MGMT_METHOD_SET &&
-           method != IB_SA_METHOD_DELETE)
-               return -EINVAL;
-
-       query = kzalloc(sizeof(*query), gfp_mask);
-       if (!query)
-               return -ENOMEM;
-
-       query->sa_query.port     = port;
-       ret = alloc_mad(&query->sa_query, gfp_mask);
-       if (ret)
-               goto err1;
-
-       ib_sa_client_get(client);
-       query->sa_query.client = client;
-       query->callback        = callback;
-       query->context         = context;
-
-       mad = query->sa_query.mad_buf->mad;
-       init_mad(&query->sa_query, agent);
-
-       query->sa_query.callback = callback ? ib_sa_service_rec_callback : NULL;
-       query->sa_query.release  = ib_sa_service_rec_release;
-       mad->mad_hdr.method      = method;
-       mad->mad_hdr.attr_id     = cpu_to_be16(IB_SA_ATTR_SERVICE_REC);
-       mad->sa_hdr.comp_mask    = comp_mask;
-
-       ib_pack(service_rec_table, ARRAY_SIZE(service_rec_table),
-               rec, mad->data);
-
-       *sa_query = &query->sa_query;
-
-       ret = send_mad(&query->sa_query, timeout_ms, gfp_mask);
-       if (ret < 0)
-               goto err2;
-
-       return ret;
-
-err2:
-       *sa_query = NULL;
-       ib_sa_client_put(query->sa_query.client);
-       free_mad(&query->sa_query);
-
-err1:
-       kfree(query);
-       return ret;
-}
-EXPORT_SYMBOL(ib_sa_service_rec_query);
-
 static void ib_sa_mcmember_rec_callback(struct ib_sa_query *sa_query,
                                        int status,
                                        struct ib_sa_mad *mad)
index 9462dbe660149229560fc29372784c7d0d7763cf..7a47343d11f9fdb763e799709a9563b72970fa46 100644 (file)
@@ -292,9 +292,6 @@ EXPORT_SYMBOL(ib_umem_odp_release);
  * @dma_index: index in the umem to add the dma to.
  * @page: the page struct to map and add.
  * @access_mask: access permissions needed for this page.
- * @current_seq: sequence number for synchronization with invalidations.
- *               the sequence number is taken from
- *               umem_odp->notifiers_seq.
  *
  * The function returns -EFAULT if the DMA mapping operation fails.
  *
index 8c8ca7bce3caf6419d45198d73ba3a88271369f1..740e6b2efe0e77098baf22c57a88e3f1a4eabb9e 100644 (file)
@@ -1435,35 +1435,13 @@ static int create_qp(struct uverbs_attr_bundle *attrs,
                attr.source_qpn = cmd->source_qpn;
        }
 
-       if (cmd->qp_type == IB_QPT_XRC_TGT)
-               qp = ib_create_qp(pd, &attr);
-       else
-               qp = _ib_create_qp(device, pd, &attr, &attrs->driver_udata, obj,
-                                  NULL);
-
+       qp = ib_create_qp_user(device, pd, &attr, &attrs->driver_udata, obj,
+                              KBUILD_MODNAME);
        if (IS_ERR(qp)) {
                ret = PTR_ERR(qp);
                goto err_put;
        }
-
-       if (cmd->qp_type != IB_QPT_XRC_TGT) {
-               ret = ib_create_qp_security(qp, device);
-               if (ret)
-                       goto err_cb;
-
-               atomic_inc(&pd->usecnt);
-               if (attr.send_cq)
-                       atomic_inc(&attr.send_cq->usecnt);
-               if (attr.recv_cq)
-                       atomic_inc(&attr.recv_cq->usecnt);
-               if (attr.srq)
-                       atomic_inc(&attr.srq->usecnt);
-               if (ind_tbl)
-                       atomic_inc(&ind_tbl->usecnt);
-       } else {
-               /* It is done in _ib_create_qp for other QP types */
-               qp->uobject = obj;
-       }
+       ib_qp_usecnt_inc(qp);
 
        obj->uevent.uobject.object = qp;
        obj->uevent.event_file = READ_ONCE(attrs->ufile->default_async_file);
@@ -1502,9 +1480,6 @@ static int create_qp(struct uverbs_attr_bundle *attrs,
        resp.response_length = uverbs_response_length(attrs, sizeof(resp));
        return uverbs_response(attrs, &resp, sizeof(resp));
 
-err_cb:
-       ib_destroy_qp_user(qp, uverbs_get_cleared_udata(attrs));
-
 err_put:
        if (!IS_ERR(xrcd_uobj))
                uobj_put_read(xrcd_uobj);
index c00cfb5ed3879cbdfd3b2e636bdf7fa2da6aad3d..dd1075466f61be67006017192a7edaf901abe052 100644 (file)
@@ -248,44 +248,23 @@ static int UVERBS_HANDLER(UVERBS_METHOD_QP_CREATE)(
        set_caps(&attr, &cap, true);
        mutex_init(&obj->mcast_lock);
 
-       if (attr.qp_type == IB_QPT_XRC_TGT)
-               qp = ib_create_qp(pd, &attr);
-       else
-               qp = _ib_create_qp(device, pd, &attr, &attrs->driver_udata, obj,
-                                  NULL);
-
+       qp = ib_create_qp_user(device, pd, &attr, &attrs->driver_udata, obj,
+                              KBUILD_MODNAME);
        if (IS_ERR(qp)) {
                ret = PTR_ERR(qp);
                goto err_put;
        }
+       ib_qp_usecnt_inc(qp);
 
-       if (attr.qp_type != IB_QPT_XRC_TGT) {
-               atomic_inc(&pd->usecnt);
-               if (attr.send_cq)
-                       atomic_inc(&attr.send_cq->usecnt);
-               if (attr.recv_cq)
-                       atomic_inc(&attr.recv_cq->usecnt);
-               if (attr.srq)
-                       atomic_inc(&attr.srq->usecnt);
-               if (attr.rwq_ind_tbl)
-                       atomic_inc(&attr.rwq_ind_tbl->usecnt);
-       } else {
+       if (attr.qp_type == IB_QPT_XRC_TGT) {
                obj->uxrcd = container_of(xrcd_uobj, struct ib_uxrcd_object,
                                          uobject);
                atomic_inc(&obj->uxrcd->refcnt);
-               /* It is done in _ib_create_qp for other QP types */
-               qp->uobject = obj;
        }
 
        obj->uevent.uobject.object = qp;
        uverbs_finalize_uobj_create(attrs, UVERBS_ATTR_CREATE_QP_HANDLE);
 
-       if (attr.qp_type != IB_QPT_XRC_TGT) {
-               ret = ib_create_qp_security(qp, device);
-               if (ret)
-                       return ret;
-       }
-
        set_caps(&attr, &cap, false);
        ret = uverbs_copy_to_struct_or_zero(attrs,
                                        UVERBS_ATTR_CREATE_QP_RESP_CAP, &cap,
index 7036967e4c0b314df36a1e8fc8a09e5abf963673..89a2b21976d63dfc660f460d49acff15aa880df3 100644 (file)
@@ -1035,7 +1035,8 @@ struct ib_srq *ib_create_srq_user(struct ib_pd *pd,
        }
        if (srq->srq_type == IB_SRQT_XRC) {
                srq->ext.xrc.xrcd = srq_init_attr->ext.xrc.xrcd;
-               atomic_inc(&srq->ext.xrc.xrcd->usecnt);
+               if (srq->ext.xrc.xrcd)
+                       atomic_inc(&srq->ext.xrc.xrcd->usecnt);
        }
        atomic_inc(&pd->usecnt);
 
@@ -1046,7 +1047,7 @@ struct ib_srq *ib_create_srq_user(struct ib_pd *pd,
        if (ret) {
                rdma_restrack_put(&srq->res);
                atomic_dec(&srq->pd->usecnt);
-               if (srq->srq_type == IB_SRQT_XRC)
+               if (srq->srq_type == IB_SRQT_XRC && srq->ext.xrc.xrcd)
                        atomic_dec(&srq->ext.xrc.xrcd->usecnt);
                if (ib_srq_has_cq(srq->srq_type))
                        atomic_dec(&srq->ext.cq->usecnt);
@@ -1090,7 +1091,7 @@ int ib_destroy_srq_user(struct ib_srq *srq, struct ib_udata *udata)
                return ret;
 
        atomic_dec(&srq->pd->usecnt);
-       if (srq->srq_type == IB_SRQT_XRC)
+       if (srq->srq_type == IB_SRQT_XRC && srq->ext.xrc.xrcd)
                atomic_dec(&srq->ext.xrc.xrcd->usecnt);
        if (ib_srq_has_cq(srq->srq_type))
                atomic_dec(&srq->ext.cq->usecnt);
@@ -1199,34 +1200,142 @@ static struct ib_qp *create_xrc_qp_user(struct ib_qp *qp,
        return qp;
 }
 
+static struct ib_qp *create_qp(struct ib_device *dev, struct ib_pd *pd,
+                              struct ib_qp_init_attr *attr,
+                              struct ib_udata *udata,
+                              struct ib_uqp_object *uobj, const char *caller)
+{
+       struct ib_udata dummy = {};
+       struct ib_qp *qp;
+       int ret;
+
+       if (!dev->ops.create_qp)
+               return ERR_PTR(-EOPNOTSUPP);
+
+       qp = rdma_zalloc_drv_obj_numa(dev, ib_qp);
+       if (!qp)
+               return ERR_PTR(-ENOMEM);
+
+       qp->device = dev;
+       qp->pd = pd;
+       qp->uobject = uobj;
+       qp->real_qp = qp;
+
+       qp->qp_type = attr->qp_type;
+       qp->rwq_ind_tbl = attr->rwq_ind_tbl;
+       qp->srq = attr->srq;
+       qp->event_handler = attr->event_handler;
+       qp->port = attr->port_num;
+       qp->qp_context = attr->qp_context;
+
+       spin_lock_init(&qp->mr_lock);
+       INIT_LIST_HEAD(&qp->rdma_mrs);
+       INIT_LIST_HEAD(&qp->sig_mrs);
+
+       rdma_restrack_new(&qp->res, RDMA_RESTRACK_QP);
+       WARN_ONCE(!udata && !caller, "Missing kernel QP owner");
+       rdma_restrack_set_name(&qp->res, udata ? NULL : caller);
+       ret = dev->ops.create_qp(qp, attr, udata);
+       if (ret)
+               goto err_create;
+
+       /*
+        * TODO: The mlx4 internally overwrites send_cq and recv_cq.
+        * Unfortunately, it is not an easy task to fix that driver.
+        */
+       qp->send_cq = attr->send_cq;
+       qp->recv_cq = attr->recv_cq;
+
+       ret = ib_create_qp_security(qp, dev);
+       if (ret)
+               goto err_security;
+
+       rdma_restrack_add(&qp->res);
+       return qp;
+
+err_security:
+       qp->device->ops.destroy_qp(qp, udata ? &dummy : NULL);
+err_create:
+       rdma_restrack_put(&qp->res);
+       kfree(qp);
+       return ERR_PTR(ret);
+
+}
+
 /**
- * ib_create_named_qp - Creates a kernel QP associated with the specified protection
+ * ib_create_qp_user - Creates a QP associated with the specified protection
  *   domain.
+ * @dev: IB device
  * @pd: The protection domain associated with the QP.
- * @qp_init_attr: A list of initial attributes required to create the
+ * @attr: A list of initial attributes required to create the
  *   QP.  If QP creation succeeds, then the attributes are updated to
  *   the actual capabilities of the created QP.
+ * @udata: User data
+ * @uobj: uverbs obect
  * @caller: caller's build-time module name
- *
- * NOTE: for user qp use ib_create_qp_user with valid udata!
  */
-struct ib_qp *ib_create_named_qp(struct ib_pd *pd,
-                                struct ib_qp_init_attr *qp_init_attr,
-                                const char *caller)
+struct ib_qp *ib_create_qp_user(struct ib_device *dev, struct ib_pd *pd,
+                               struct ib_qp_init_attr *attr,
+                               struct ib_udata *udata,
+                               struct ib_uqp_object *uobj, const char *caller)
 {
-       struct ib_device *device = pd ? pd->device : qp_init_attr->xrcd->device;
-       struct ib_qp *qp;
-       int ret;
+       struct ib_qp *qp, *xrc_qp;
 
-       if (qp_init_attr->rwq_ind_tbl &&
-           (qp_init_attr->recv_cq ||
-           qp_init_attr->srq || qp_init_attr->cap.max_recv_wr ||
-           qp_init_attr->cap.max_recv_sge))
-               return ERR_PTR(-EINVAL);
+       if (attr->qp_type == IB_QPT_XRC_TGT)
+               qp = create_qp(dev, pd, attr, NULL, NULL, caller);
+       else
+               qp = create_qp(dev, pd, attr, udata, uobj, NULL);
+       if (attr->qp_type != IB_QPT_XRC_TGT || IS_ERR(qp))
+               return qp;
 
-       if ((qp_init_attr->create_flags & IB_QP_CREATE_INTEGRITY_EN) &&
-           !(device->attrs.device_cap_flags & IB_DEVICE_INTEGRITY_HANDOVER))
-               return ERR_PTR(-EINVAL);
+       xrc_qp = create_xrc_qp_user(qp, attr);
+       if (IS_ERR(xrc_qp)) {
+               ib_destroy_qp(qp);
+               return xrc_qp;
+       }
+
+       xrc_qp->uobject = uobj;
+       return xrc_qp;
+}
+EXPORT_SYMBOL(ib_create_qp_user);
+
+void ib_qp_usecnt_inc(struct ib_qp *qp)
+{
+       if (qp->pd)
+               atomic_inc(&qp->pd->usecnt);
+       if (qp->send_cq)
+               atomic_inc(&qp->send_cq->usecnt);
+       if (qp->recv_cq)
+               atomic_inc(&qp->recv_cq->usecnt);
+       if (qp->srq)
+               atomic_inc(&qp->srq->usecnt);
+       if (qp->rwq_ind_tbl)
+               atomic_inc(&qp->rwq_ind_tbl->usecnt);
+}
+EXPORT_SYMBOL(ib_qp_usecnt_inc);
+
+void ib_qp_usecnt_dec(struct ib_qp *qp)
+{
+       if (qp->rwq_ind_tbl)
+               atomic_dec(&qp->rwq_ind_tbl->usecnt);
+       if (qp->srq)
+               atomic_dec(&qp->srq->usecnt);
+       if (qp->recv_cq)
+               atomic_dec(&qp->recv_cq->usecnt);
+       if (qp->send_cq)
+               atomic_dec(&qp->send_cq->usecnt);
+       if (qp->pd)
+               atomic_dec(&qp->pd->usecnt);
+}
+EXPORT_SYMBOL(ib_qp_usecnt_dec);
+
+struct ib_qp *ib_create_qp_kernel(struct ib_pd *pd,
+                                 struct ib_qp_init_attr *qp_init_attr,
+                                 const char *caller)
+{
+       struct ib_device *device = pd->device;
+       struct ib_qp *qp;
+       int ret;
 
        /*
         * If the callers is using the RDMA API calculate the resources
@@ -1237,47 +1346,11 @@ struct ib_qp *ib_create_named_qp(struct ib_pd *pd,
        if (qp_init_attr->cap.max_rdma_ctxs)
                rdma_rw_init_qp(device, qp_init_attr);
 
-       qp = _ib_create_qp(device, pd, qp_init_attr, NULL, NULL, caller);
+       qp = create_qp(device, pd, qp_init_attr, NULL, NULL, caller);
        if (IS_ERR(qp))
                return qp;
 
-       ret = ib_create_qp_security(qp, device);
-       if (ret)
-               goto err;
-
-       if (qp_init_attr->qp_type == IB_QPT_XRC_TGT) {
-               struct ib_qp *xrc_qp =
-                       create_xrc_qp_user(qp, qp_init_attr);
-
-               if (IS_ERR(xrc_qp)) {
-                       ret = PTR_ERR(xrc_qp);
-                       goto err;
-               }
-               return xrc_qp;
-       }
-
-       qp->event_handler = qp_init_attr->event_handler;
-       qp->qp_context = qp_init_attr->qp_context;
-       if (qp_init_attr->qp_type == IB_QPT_XRC_INI) {
-               qp->recv_cq = NULL;
-               qp->srq = NULL;
-       } else {
-               qp->recv_cq = qp_init_attr->recv_cq;
-               if (qp_init_attr->recv_cq)
-                       atomic_inc(&qp_init_attr->recv_cq->usecnt);
-               qp->srq = qp_init_attr->srq;
-               if (qp->srq)
-                       atomic_inc(&qp_init_attr->srq->usecnt);
-       }
-
-       qp->send_cq = qp_init_attr->send_cq;
-       qp->xrcd    = NULL;
-
-       atomic_inc(&pd->usecnt);
-       if (qp_init_attr->send_cq)
-               atomic_inc(&qp_init_attr->send_cq->usecnt);
-       if (qp_init_attr->rwq_ind_tbl)
-               atomic_inc(&qp->rwq_ind_tbl->usecnt);
+       ib_qp_usecnt_inc(qp);
 
        if (qp_init_attr->cap.max_rdma_ctxs) {
                ret = rdma_rw_init_mrs(qp, qp_init_attr);
@@ -1303,7 +1376,7 @@ err:
        return ERR_PTR(ret);
 
 }
-EXPORT_SYMBOL(ib_create_named_qp);
+EXPORT_SYMBOL(ib_create_qp_kernel);
 
 static const struct {
        int                     valid;
@@ -1935,10 +2008,6 @@ int ib_destroy_qp_user(struct ib_qp *qp, struct ib_udata *udata)
 {
        const struct ib_gid_attr *alt_path_sgid_attr = qp->alt_path_sgid_attr;
        const struct ib_gid_attr *av_sgid_attr = qp->av_sgid_attr;
-       struct ib_pd *pd;
-       struct ib_cq *scq, *rcq;
-       struct ib_srq *srq;
-       struct ib_rwq_ind_table *ind_tbl;
        struct ib_qp_security *sec;
        int ret;
 
@@ -1950,11 +2019,6 @@ int ib_destroy_qp_user(struct ib_qp *qp, struct ib_udata *udata)
        if (qp->real_qp != qp)
                return __ib_destroy_shared_qp(qp);
 
-       pd   = qp->pd;
-       scq  = qp->send_cq;
-       rcq  = qp->recv_cq;
-       srq  = qp->srq;
-       ind_tbl = qp->rwq_ind_tbl;
        sec  = qp->qp_sec;
        if (sec)
                ib_destroy_qp_security_begin(sec);
@@ -1963,30 +2027,24 @@ int ib_destroy_qp_user(struct ib_qp *qp, struct ib_udata *udata)
                rdma_rw_cleanup_mrs(qp);
 
        rdma_counter_unbind_qp(qp, true);
-       rdma_restrack_del(&qp->res);
        ret = qp->device->ops.destroy_qp(qp, udata);
-       if (!ret) {
-               if (alt_path_sgid_attr)
-                       rdma_put_gid_attr(alt_path_sgid_attr);
-               if (av_sgid_attr)
-                       rdma_put_gid_attr(av_sgid_attr);
-               if (pd)
-                       atomic_dec(&pd->usecnt);
-               if (scq)
-                       atomic_dec(&scq->usecnt);
-               if (rcq)
-                       atomic_dec(&rcq->usecnt);
-               if (srq)
-                       atomic_dec(&srq->usecnt);
-               if (ind_tbl)
-                       atomic_dec(&ind_tbl->usecnt);
-               if (sec)
-                       ib_destroy_qp_security_end(sec);
-       } else {
+       if (ret) {
                if (sec)
                        ib_destroy_qp_security_abort(sec);
+               return ret;
        }
 
+       if (alt_path_sgid_attr)
+               rdma_put_gid_attr(alt_path_sgid_attr);
+       if (av_sgid_attr)
+               rdma_put_gid_attr(av_sgid_attr);
+
+       ib_qp_usecnt_dec(qp);
+       if (sec)
+               ib_destroy_qp_security_end(sec);
+
+       rdma_restrack_del(&qp->res);
+       kfree(qp);
        return ret;
 }
 EXPORT_SYMBOL(ib_destroy_qp_user);
index 283b6b81563cc438da1364766b7f891adaa900e4..634d1586a1fabe4856344749d5b883c298026e81 100644 (file)
@@ -815,7 +815,7 @@ int bnxt_re_destroy_qp(struct ib_qp *ib_qp, struct ib_udata *udata)
        if (ib_qp->qp_type == IB_QPT_GSI && rdev->gsi_ctx.gsi_sqp) {
                rc = bnxt_re_destroy_gsi_sqp(qp);
                if (rc)
-                       goto sh_fail;
+                       return rc;
        }
 
        mutex_lock(&rdev->qp_lock);
@@ -826,10 +826,7 @@ int bnxt_re_destroy_qp(struct ib_qp *ib_qp, struct ib_udata *udata)
        ib_umem_release(qp->rumem);
        ib_umem_release(qp->sumem);
 
-       kfree(qp);
        return 0;
-sh_fail:
-       return rc;
 }
 
 static u8 __from_ib_qp_type(enum ib_qp_type type)
@@ -1402,27 +1399,22 @@ static bool bnxt_re_test_qp_limits(struct bnxt_re_dev *rdev,
        return rc;
 }
 
-struct ib_qp *bnxt_re_create_qp(struct ib_pd *ib_pd,
-                               struct ib_qp_init_attr *qp_init_attr,
-                               struct ib_udata *udata)
+int bnxt_re_create_qp(struct ib_qp *ib_qp, struct ib_qp_init_attr *qp_init_attr,
+                     struct ib_udata *udata)
 {
+       struct ib_pd *ib_pd = ib_qp->pd;
        struct bnxt_re_pd *pd = container_of(ib_pd, struct bnxt_re_pd, ib_pd);
        struct bnxt_re_dev *rdev = pd->rdev;
        struct bnxt_qplib_dev_attr *dev_attr = &rdev->dev_attr;
-       struct bnxt_re_qp *qp;
+       struct bnxt_re_qp *qp = container_of(ib_qp, struct bnxt_re_qp, ib_qp);
        int rc;
 
        rc = bnxt_re_test_qp_limits(rdev, qp_init_attr, dev_attr);
        if (!rc) {
                rc = -EINVAL;
-               goto exit;
+               goto fail;
        }
 
-       qp = kzalloc(sizeof(*qp), GFP_KERNEL);
-       if (!qp) {
-               rc = -ENOMEM;
-               goto exit;
-       }
        qp->rdev = rdev;
        rc = bnxt_re_init_qp_attr(qp, pd, qp_init_attr, udata);
        if (rc)
@@ -1465,16 +1457,14 @@ struct ib_qp *bnxt_re_create_qp(struct ib_pd *ib_pd,
        mutex_unlock(&rdev->qp_lock);
        atomic_inc(&rdev->qp_count);
 
-       return &qp->ib_qp;
+       return 0;
 qp_destroy:
        bnxt_qplib_destroy_qp(&rdev->qplib_res, &qp->qplib_qp);
 free_umem:
        ib_umem_release(qp->rumem);
        ib_umem_release(qp->sumem);
 fail:
-       kfree(qp);
-exit:
-       return ERR_PTR(rc);
+       return rc;
 }
 
 static u8 __from_ib_qp_state(enum ib_qp_state state)
index d68671cc617382b114e6290ea1353ae48de0ec60..b5c6e0f4f877e6ac97bb5a237ba4979390858c1a 100644 (file)
@@ -78,9 +78,9 @@ struct bnxt_re_srq {
 };
 
 struct bnxt_re_qp {
+       struct ib_qp            ib_qp;
        struct list_head        list;
        struct bnxt_re_dev      *rdev;
-       struct ib_qp            ib_qp;
        spinlock_t              sq_lock;        /* protect sq */
        spinlock_t              rq_lock;        /* protect rq */
        struct bnxt_qplib_qp    qplib_qp;
@@ -179,9 +179,8 @@ int bnxt_re_query_srq(struct ib_srq *srq, struct ib_srq_attr *srq_attr);
 int bnxt_re_destroy_srq(struct ib_srq *srq, struct ib_udata *udata);
 int bnxt_re_post_srq_recv(struct ib_srq *srq, const struct ib_recv_wr *recv_wr,
                          const struct ib_recv_wr **bad_recv_wr);
-struct ib_qp *bnxt_re_create_qp(struct ib_pd *pd,
-                               struct ib_qp_init_attr *qp_init_attr,
-                               struct ib_udata *udata);
+int bnxt_re_create_qp(struct ib_qp *qp, struct ib_qp_init_attr *qp_init_attr,
+                     struct ib_udata *udata);
 int bnxt_re_modify_qp(struct ib_qp *qp, struct ib_qp_attr *qp_attr,
                      int qp_attr_mask, struct ib_udata *udata);
 int bnxt_re_query_qp(struct ib_qp *qp, struct ib_qp_attr *qp_attr,
index a8688a92c760281419eec67a9dd05de43354f39a..b3baffe861a6c04ceae6645b0824a6a1a4465a17 100644 (file)
@@ -711,6 +711,7 @@ static const struct ib_device_ops bnxt_re_dev_ops = {
        INIT_RDMA_OBJ_SIZE(ib_ah, bnxt_re_ah, ib_ah),
        INIT_RDMA_OBJ_SIZE(ib_cq, bnxt_re_cq, ib_cq),
        INIT_RDMA_OBJ_SIZE(ib_pd, bnxt_re_pd, ib_pd),
+       INIT_RDMA_OBJ_SIZE(ib_qp, bnxt_re_qp, ib_qp),
        INIT_RDMA_OBJ_SIZE(ib_srq, bnxt_re_srq, ib_srq),
        INIT_RDMA_OBJ_SIZE(ib_ucontext, bnxt_re_ucontext, ib_uctx),
 };
index ac5f581aff4ca426547bb6f7d881fe06efb5354a..12f33467c6728f1d1097cd1c47ac8189a73fd98e 100644 (file)
@@ -990,9 +990,8 @@ int c4iw_destroy_srq(struct ib_srq *ib_srq, struct ib_udata *udata);
 int c4iw_create_srq(struct ib_srq *srq, struct ib_srq_init_attr *attrs,
                    struct ib_udata *udata);
 int c4iw_destroy_qp(struct ib_qp *ib_qp, struct ib_udata *udata);
-struct ib_qp *c4iw_create_qp(struct ib_pd *pd,
-                            struct ib_qp_init_attr *attrs,
-                            struct ib_udata *udata);
+int c4iw_create_qp(struct ib_qp *qp, struct ib_qp_init_attr *attrs,
+                  struct ib_udata *udata);
 int c4iw_ib_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr,
                                 int attr_mask, struct ib_udata *udata);
 int c4iw_ib_query_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr,
index 881d515eb15af76379b1d1d7874d237ac2e4381b..e7337662aff87a9388c46c706b18b557a88d0550 100644 (file)
@@ -499,6 +499,7 @@ static const struct ib_device_ops c4iw_dev_ops = {
        INIT_RDMA_OBJ_SIZE(ib_cq, c4iw_cq, ibcq),
        INIT_RDMA_OBJ_SIZE(ib_mw, c4iw_mw, ibmw),
        INIT_RDMA_OBJ_SIZE(ib_pd, c4iw_pd, ibpd),
+       INIT_RDMA_OBJ_SIZE(ib_qp, c4iw_qp, ibqp),
        INIT_RDMA_OBJ_SIZE(ib_srq, c4iw_srq, ibsrq),
        INIT_RDMA_OBJ_SIZE(ib_ucontext, c4iw_ucontext, ibucontext),
 };
index a81fa7a56edb7dc5cec201b5961996cb65cedec4..d20b4ef2c853d8187f04a5e013c667c6cbdfc102 100644 (file)
@@ -2103,16 +2103,15 @@ int c4iw_destroy_qp(struct ib_qp *ib_qp, struct ib_udata *udata)
                   ucontext ? &ucontext->uctx : &rhp->rdev.uctx, !qhp->srq);
 
        c4iw_put_wr_wait(qhp->wr_waitp);
-
-       kfree(qhp);
        return 0;
 }
 
-struct ib_qp *c4iw_create_qp(struct ib_pd *pd, struct ib_qp_init_attr *attrs,
-                            struct ib_udata *udata)
+int c4iw_create_qp(struct ib_qp *qp, struct ib_qp_init_attr *attrs,
+                  struct ib_udata *udata)
 {
+       struct ib_pd *pd = qp->pd;
        struct c4iw_dev *rhp;
-       struct c4iw_qp *qhp;
+       struct c4iw_qp *qhp = to_c4iw_qp(qp);
        struct c4iw_pd *php;
        struct c4iw_cq *schp;
        struct c4iw_cq *rchp;
@@ -2124,44 +2123,36 @@ struct ib_qp *c4iw_create_qp(struct ib_pd *pd, struct ib_qp_init_attr *attrs,
        struct c4iw_mm_entry *sq_key_mm, *rq_key_mm = NULL, *sq_db_key_mm;
        struct c4iw_mm_entry *rq_db_key_mm = NULL, *ma_sync_key_mm = NULL;
 
-       pr_debug("ib_pd %p\n", pd);
-
        if (attrs->qp_type != IB_QPT_RC || attrs->create_flags)
-               return ERR_PTR(-EOPNOTSUPP);
+               return -EOPNOTSUPP;
 
        php = to_c4iw_pd(pd);
        rhp = php->rhp;
        schp = get_chp(rhp, ((struct c4iw_cq *)attrs->send_cq)->cq.cqid);
        rchp = get_chp(rhp, ((struct c4iw_cq *)attrs->recv_cq)->cq.cqid);
        if (!schp || !rchp)
-               return ERR_PTR(-EINVAL);
+               return -EINVAL;
 
        if (attrs->cap.max_inline_data > T4_MAX_SEND_INLINE)
-               return ERR_PTR(-EINVAL);
+               return -EINVAL;
 
        if (!attrs->srq) {
                if (attrs->cap.max_recv_wr > rhp->rdev.hw_queue.t4_max_rq_size)
-                       return ERR_PTR(-E2BIG);
+                       return -E2BIG;
                rqsize = attrs->cap.max_recv_wr + 1;
                if (rqsize < 8)
                        rqsize = 8;
        }
 
        if (attrs->cap.max_send_wr > rhp->rdev.hw_queue.t4_max_sq_size)
-               return ERR_PTR(-E2BIG);
+               return -E2BIG;
        sqsize = attrs->cap.max_send_wr + 1;
        if (sqsize < 8)
                sqsize = 8;
 
-       qhp = kzalloc(sizeof(*qhp), GFP_KERNEL);
-       if (!qhp)
-               return ERR_PTR(-ENOMEM);
-
        qhp->wr_waitp = c4iw_alloc_wr_wait(GFP_KERNEL);
-       if (!qhp->wr_waitp) {
-               ret = -ENOMEM;
-               goto err_free_qhp;
-       }
+       if (!qhp->wr_waitp)
+               return -ENOMEM;
 
        qhp->wq.sq.size = sqsize;
        qhp->wq.sq.memsize =
@@ -2339,7 +2330,7 @@ struct ib_qp *c4iw_create_qp(struct ib_pd *pd, struct ib_qp_init_attr *attrs,
                 qhp->wq.sq.qid, qhp->wq.sq.size, qhp->wq.sq.memsize,
                 attrs->cap.max_send_wr, qhp->wq.rq.qid, qhp->wq.rq.size,
                 qhp->wq.rq.memsize, attrs->cap.max_recv_wr);
-       return &qhp->ibqp;
+       return 0;
 err_free_ma_sync_key:
        kfree(ma_sync_key_mm);
 err_free_rq_db_key:
@@ -2359,9 +2350,7 @@ err_destroy_qp:
                   ucontext ? &ucontext->uctx : &rhp->rdev.uctx, !attrs->srq);
 err_free_wr_wait:
        c4iw_put_wr_wait(qhp->wr_waitp);
-err_free_qhp:
-       kfree(qhp);
-       return ERR_PTR(ret);
+       return ret;
 }
 
 int c4iw_ib_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr,
index 2b8ca099b3811551665ebe655a25ae17eddf6c82..87b1dadeb7fe61534748ca83e63b3a1ae501b10c 100644 (file)
@@ -1,6 +1,6 @@
 /* SPDX-License-Identifier: GPL-2.0 OR BSD-2-Clause */
 /*
- * Copyright 2018-2020 Amazon.com, Inc. or its affiliates. All rights reserved.
+ * Copyright 2018-2021 Amazon.com, Inc. or its affiliates. All rights reserved.
  */
 
 #ifndef _EFA_H_
@@ -27,8 +27,7 @@
 struct efa_irq {
        irq_handler_t handler;
        void *data;
-       int cpu;
-       u32 vector;
+       u32 irqn;
        cpumask_t affinity_hint_mask;
        char name[EFA_IRQNAME_SIZE];
 };
@@ -132,9 +131,8 @@ int efa_query_pkey(struct ib_device *ibdev, u32 port, u16 index,
 int efa_alloc_pd(struct ib_pd *ibpd, struct ib_udata *udata);
 int efa_dealloc_pd(struct ib_pd *ibpd, struct ib_udata *udata);
 int efa_destroy_qp(struct ib_qp *ibqp, struct ib_udata *udata);
-struct ib_qp *efa_create_qp(struct ib_pd *ibpd,
-                           struct ib_qp_init_attr *init_attr,
-                           struct ib_udata *udata);
+int efa_create_qp(struct ib_qp *ibqp, struct ib_qp_init_attr *init_attr,
+                 struct ib_udata *udata);
 int efa_destroy_cq(struct ib_cq *ibcq, struct ib_udata *udata);
 int efa_create_cq(struct ib_cq *ibcq, const struct ib_cq_init_attr *attr,
                  struct ib_udata *udata);
index 203e6ddcacbc9c87ca5222bb85503f188e287549..a27ff0c12e0a75a698b3d0d18a3d0c6833a5158d 100644 (file)
@@ -83,8 +83,7 @@ static int efa_request_mgmnt_irq(struct efa_dev *dev)
        int err;
 
        irq = &dev->admin_irq;
-       err = request_irq(irq->vector, irq->handler, 0, irq->name,
-                         irq->data);
+       err = request_irq(irq->irqn, irq->handler, 0, irq->name, irq->data);
        if (err) {
                dev_err(&dev->pdev->dev, "Failed to request admin irq (%d)\n",
                        err);
@@ -92,8 +91,8 @@ static int efa_request_mgmnt_irq(struct efa_dev *dev)
        }
 
        dev_dbg(&dev->pdev->dev, "Set affinity hint of mgmnt irq to %*pbl (irq vector: %d)\n",
-               nr_cpumask_bits, &irq->affinity_hint_mask, irq->vector);
-       irq_set_affinity_hint(irq->vector, &irq->affinity_hint_mask);
+               nr_cpumask_bits, &irq->affinity_hint_mask, irq->irqn);
+       irq_set_affinity_hint(irq->irqn, &irq->affinity_hint_mask);
 
        return 0;
 }
@@ -106,15 +105,13 @@ static void efa_setup_mgmnt_irq(struct efa_dev *dev)
                 "efa-mgmnt@pci:%s", pci_name(dev->pdev));
        dev->admin_irq.handler = efa_intr_msix_mgmnt;
        dev->admin_irq.data = dev;
-       dev->admin_irq.vector =
+       dev->admin_irq.irqn =
                pci_irq_vector(dev->pdev, dev->admin_msix_vector_idx);
        cpu = cpumask_first(cpu_online_mask);
-       dev->admin_irq.cpu = cpu;
        cpumask_set_cpu(cpu,
                        &dev->admin_irq.affinity_hint_mask);
-       dev_info(&dev->pdev->dev, "Setup irq:0x%p vector:%d name:%s\n",
-                &dev->admin_irq,
-                dev->admin_irq.vector,
+       dev_info(&dev->pdev->dev, "Setup irq:%d name:%s\n",
+                dev->admin_irq.irqn,
                 dev->admin_irq.name);
 }
 
@@ -123,8 +120,8 @@ static void efa_free_mgmnt_irq(struct efa_dev *dev)
        struct efa_irq *irq;
 
        irq = &dev->admin_irq;
-       irq_set_affinity_hint(irq->vector, NULL);
-       free_irq(irq->vector, irq->data);
+       irq_set_affinity_hint(irq->irqn, NULL);
+       free_irq(irq->irqn, irq->data);
 }
 
 static int efa_set_mgmnt_irq(struct efa_dev *dev)
@@ -271,6 +268,7 @@ static const struct ib_device_ops efa_dev_ops = {
        INIT_RDMA_OBJ_SIZE(ib_ah, efa_ah, ibah),
        INIT_RDMA_OBJ_SIZE(ib_cq, efa_cq, ibcq),
        INIT_RDMA_OBJ_SIZE(ib_pd, efa_pd, ibpd),
+       INIT_RDMA_OBJ_SIZE(ib_qp, efa_qp, ibqp),
        INIT_RDMA_OBJ_SIZE(ib_ucontext, efa_ucontext, ibucontext),
 };
 
index be6d3ff0f1be24d263c815ad0c8c1c537f2dec2d..e5f9d90aad5ee0e45c52bcdd1037948aa4da0cce 100644 (file)
@@ -1,6 +1,6 @@
 // SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB
 /*
- * Copyright 2018-2020 Amazon.com, Inc. or its affiliates. All rights reserved.
+ * Copyright 2018-2021 Amazon.com, Inc. or its affiliates. All rights reserved.
  */
 
 #include <linux/vmalloc.h>
@@ -30,7 +30,21 @@ struct efa_user_mmap_entry {
        u8 mmap_flag;
 };
 
-#define EFA_DEFINE_STATS(op) \
+#define EFA_DEFINE_DEVICE_STATS(op) \
+       op(EFA_SUBMITTED_CMDS, "submitted_cmds") \
+       op(EFA_COMPLETED_CMDS, "completed_cmds") \
+       op(EFA_CMDS_ERR, "cmds_err") \
+       op(EFA_NO_COMPLETION_CMDS, "no_completion_cmds") \
+       op(EFA_KEEP_ALIVE_RCVD, "keep_alive_rcvd") \
+       op(EFA_ALLOC_PD_ERR, "alloc_pd_err") \
+       op(EFA_CREATE_QP_ERR, "create_qp_err") \
+       op(EFA_CREATE_CQ_ERR, "create_cq_err") \
+       op(EFA_REG_MR_ERR, "reg_mr_err") \
+       op(EFA_ALLOC_UCONTEXT_ERR, "alloc_ucontext_err") \
+       op(EFA_CREATE_AH_ERR, "create_ah_err") \
+       op(EFA_MMAP_ERR, "mmap_err")
+
+#define EFA_DEFINE_PORT_STATS(op) \
        op(EFA_TX_BYTES, "tx_bytes") \
        op(EFA_TX_PKTS, "tx_pkts") \
        op(EFA_RX_BYTES, "rx_bytes") \
@@ -44,28 +58,24 @@ struct efa_user_mmap_entry {
        op(EFA_RDMA_READ_BYTES, "rdma_read_bytes") \
        op(EFA_RDMA_READ_WR_ERR, "rdma_read_wr_err") \
        op(EFA_RDMA_READ_RESP_BYTES, "rdma_read_resp_bytes") \
-       op(EFA_SUBMITTED_CMDS, "submitted_cmds") \
-       op(EFA_COMPLETED_CMDS, "completed_cmds") \
-       op(EFA_CMDS_ERR, "cmds_err") \
-       op(EFA_NO_COMPLETION_CMDS, "no_completion_cmds") \
-       op(EFA_KEEP_ALIVE_RCVD, "keep_alive_rcvd") \
-       op(EFA_ALLOC_PD_ERR, "alloc_pd_err") \
-       op(EFA_CREATE_QP_ERR, "create_qp_err") \
-       op(EFA_CREATE_CQ_ERR, "create_cq_err") \
-       op(EFA_REG_MR_ERR, "reg_mr_err") \
-       op(EFA_ALLOC_UCONTEXT_ERR, "alloc_ucontext_err") \
-       op(EFA_CREATE_AH_ERR, "create_ah_err") \
-       op(EFA_MMAP_ERR, "mmap_err")
 
 #define EFA_STATS_ENUM(ename, name) ename,
 #define EFA_STATS_STR(ename, name) [ename] = name,
 
-enum efa_hw_stats {
-       EFA_DEFINE_STATS(EFA_STATS_ENUM)
+enum efa_hw_device_stats {
+       EFA_DEFINE_DEVICE_STATS(EFA_STATS_ENUM)
 };
 
-static const char *const efa_stats_names[] = {
-       EFA_DEFINE_STATS(EFA_STATS_STR)
+static const char *const efa_device_stats_names[] = {
+       EFA_DEFINE_DEVICE_STATS(EFA_STATS_STR)
+};
+
+enum efa_hw_port_stats {
+       EFA_DEFINE_PORT_STATS(EFA_STATS_ENUM)
+};
+
+static const char *const efa_port_stats_names[] = {
+       EFA_DEFINE_PORT_STATS(EFA_STATS_STR)
 };
 
 #define EFA_CHUNK_PAYLOAD_SHIFT       12
@@ -440,7 +450,6 @@ int efa_destroy_qp(struct ib_qp *ibqp, struct ib_udata *udata)
                                qp->rq_size, DMA_TO_DEVICE);
        }
 
-       kfree(qp);
        return 0;
 }
 
@@ -599,17 +608,16 @@ static int efa_qp_validate_attr(struct efa_dev *dev,
        return 0;
 }
 
-struct ib_qp *efa_create_qp(struct ib_pd *ibpd,
-                           struct ib_qp_init_attr *init_attr,
-                           struct ib_udata *udata)
+int efa_create_qp(struct ib_qp *ibqp, struct ib_qp_init_attr *init_attr,
+                 struct ib_udata *udata)
 {
        struct efa_com_create_qp_params create_qp_params = {};
        struct efa_com_create_qp_result create_qp_resp;
-       struct efa_dev *dev = to_edev(ibpd->device);
+       struct efa_dev *dev = to_edev(ibqp->device);
        struct efa_ibv_create_qp_resp resp = {};
        struct efa_ibv_create_qp cmd = {};
+       struct efa_qp *qp = to_eqp(ibqp);
        struct efa_ucontext *ucontext;
-       struct efa_qp *qp;
        int err;
 
        ucontext = rdma_udata_to_drv_context(udata, struct efa_ucontext,
@@ -654,14 +662,8 @@ struct ib_qp *efa_create_qp(struct ib_pd *ibpd,
                goto err_out;
        }
 
-       qp = kzalloc(sizeof(*qp), GFP_KERNEL);
-       if (!qp) {
-               err = -ENOMEM;
-               goto err_out;
-       }
-
        create_qp_params.uarn = ucontext->uarn;
-       create_qp_params.pd = to_epd(ibpd)->pdn;
+       create_qp_params.pd = to_epd(ibqp->pd)->pdn;
 
        if (init_attr->qp_type == IB_QPT_UD) {
                create_qp_params.qp_type = EFA_ADMIN_QP_TYPE_UD;
@@ -672,7 +674,7 @@ struct ib_qp *efa_create_qp(struct ib_pd *ibpd,
                          "Unsupported qp type %d driver qp type %d\n",
                          init_attr->qp_type, cmd.driver_qp_type);
                err = -EOPNOTSUPP;
-               goto err_free_qp;
+               goto err_out;
        }
 
        ibdev_dbg(&dev->ibdev, "Create QP: qp type %d driver qp type %#x\n",
@@ -690,7 +692,7 @@ struct ib_qp *efa_create_qp(struct ib_pd *ibpd,
                                                    qp->rq_size, DMA_TO_DEVICE);
                if (!qp->rq_cpu_addr) {
                        err = -ENOMEM;
-                       goto err_free_qp;
+                       goto err_out;
                }
 
                ibdev_dbg(&dev->ibdev,
@@ -717,7 +719,6 @@ struct ib_qp *efa_create_qp(struct ib_pd *ibpd,
 
        qp->qp_handle = create_qp_resp.qp_handle;
        qp->ibqp.qp_num = create_qp_resp.qp_num;
-       qp->ibqp.qp_type = init_attr->qp_type;
        qp->max_send_wr = init_attr->cap.max_send_wr;
        qp->max_recv_wr = init_attr->cap.max_recv_wr;
        qp->max_send_sge = init_attr->cap.max_send_sge;
@@ -737,7 +738,7 @@ struct ib_qp *efa_create_qp(struct ib_pd *ibpd,
 
        ibdev_dbg(&dev->ibdev, "Created qp[%d]\n", qp->ibqp.qp_num);
 
-       return &qp->ibqp;
+       return 0;
 
 err_remove_mmap_entries:
        efa_qp_user_mmap_entries_remove(qp);
@@ -747,11 +748,9 @@ err_free_mapped:
        if (qp->rq_size)
                efa_free_mapped(dev, qp->rq_cpu_addr, qp->rq_dma_addr,
                                qp->rq_size, DMA_TO_DEVICE);
-err_free_qp:
-       kfree(qp);
 err_out:
        atomic64_inc(&dev->stats.create_qp_err);
-       return ERR_PTR(err);
+       return err;
 }
 
 static const struct {
@@ -1904,33 +1903,53 @@ int efa_destroy_ah(struct ib_ah *ibah, u32 flags)
        return 0;
 }
 
-struct rdma_hw_stats *efa_alloc_hw_port_stats(struct ib_device *ibdev, u32 port_num)
+struct rdma_hw_stats *efa_alloc_hw_port_stats(struct ib_device *ibdev,
+                                             u32 port_num)
 {
-       return rdma_alloc_hw_stats_struct(efa_stats_names,
-                                         ARRAY_SIZE(efa_stats_names),
+       return rdma_alloc_hw_stats_struct(efa_port_stats_names,
+                                         ARRAY_SIZE(efa_port_stats_names),
                                          RDMA_HW_STATS_DEFAULT_LIFESPAN);
 }
 
 struct rdma_hw_stats *efa_alloc_hw_device_stats(struct ib_device *ibdev)
 {
-       /*
-        * It is probably a bug that efa reports its port stats as device
-        * stats
-        */
-       return efa_alloc_hw_port_stats(ibdev, 0);
+       return rdma_alloc_hw_stats_struct(efa_device_stats_names,
+                                         ARRAY_SIZE(efa_device_stats_names),
+                                         RDMA_HW_STATS_DEFAULT_LIFESPAN);
 }
 
-int efa_get_hw_stats(struct ib_device *ibdev, struct rdma_hw_stats *stats,
-                    u32 port_num, int index)
+static int efa_fill_device_stats(struct efa_dev *dev,
+                                struct rdma_hw_stats *stats)
+{
+       struct efa_com_stats_admin *as = &dev->edev.aq.stats;
+       struct efa_stats *s = &dev->stats;
+
+       stats->value[EFA_SUBMITTED_CMDS] = atomic64_read(&as->submitted_cmd);
+       stats->value[EFA_COMPLETED_CMDS] = atomic64_read(&as->completed_cmd);
+       stats->value[EFA_CMDS_ERR] = atomic64_read(&as->cmd_err);
+       stats->value[EFA_NO_COMPLETION_CMDS] = atomic64_read(&as->no_completion);
+
+       stats->value[EFA_KEEP_ALIVE_RCVD] = atomic64_read(&s->keep_alive_rcvd);
+       stats->value[EFA_ALLOC_PD_ERR] = atomic64_read(&s->alloc_pd_err);
+       stats->value[EFA_CREATE_QP_ERR] = atomic64_read(&s->create_qp_err);
+       stats->value[EFA_CREATE_CQ_ERR] = atomic64_read(&s->create_cq_err);
+       stats->value[EFA_REG_MR_ERR] = atomic64_read(&s->reg_mr_err);
+       stats->value[EFA_ALLOC_UCONTEXT_ERR] =
+               atomic64_read(&s->alloc_ucontext_err);
+       stats->value[EFA_CREATE_AH_ERR] = atomic64_read(&s->create_ah_err);
+       stats->value[EFA_MMAP_ERR] = atomic64_read(&s->mmap_err);
+
+       return ARRAY_SIZE(efa_device_stats_names);
+}
+
+static int efa_fill_port_stats(struct efa_dev *dev, struct rdma_hw_stats *stats,
+                              u32 port_num)
 {
        struct efa_com_get_stats_params params = {};
        union efa_com_get_stats_result result;
-       struct efa_dev *dev = to_edev(ibdev);
        struct efa_com_rdma_read_stats *rrs;
        struct efa_com_messages_stats *ms;
        struct efa_com_basic_stats *bs;
-       struct efa_com_stats_admin *as;
-       struct efa_stats *s;
        int err;
 
        params.scope = EFA_ADMIN_GET_STATS_SCOPE_ALL;
@@ -1969,24 +1988,16 @@ int efa_get_hw_stats(struct ib_device *ibdev, struct rdma_hw_stats *stats,
        stats->value[EFA_RDMA_READ_WR_ERR] = rrs->read_wr_err;
        stats->value[EFA_RDMA_READ_RESP_BYTES] = rrs->read_resp_bytes;
 
-       as = &dev->edev.aq.stats;
-       stats->value[EFA_SUBMITTED_CMDS] = atomic64_read(&as->submitted_cmd);
-       stats->value[EFA_COMPLETED_CMDS] = atomic64_read(&as->completed_cmd);
-       stats->value[EFA_CMDS_ERR] = atomic64_read(&as->cmd_err);
-       stats->value[EFA_NO_COMPLETION_CMDS] = atomic64_read(&as->no_completion);
-
-       s = &dev->stats;
-       stats->value[EFA_KEEP_ALIVE_RCVD] = atomic64_read(&s->keep_alive_rcvd);
-       stats->value[EFA_ALLOC_PD_ERR] = atomic64_read(&s->alloc_pd_err);
-       stats->value[EFA_CREATE_QP_ERR] = atomic64_read(&s->create_qp_err);
-       stats->value[EFA_CREATE_CQ_ERR] = atomic64_read(&s->create_cq_err);
-       stats->value[EFA_REG_MR_ERR] = atomic64_read(&s->reg_mr_err);
-       stats->value[EFA_ALLOC_UCONTEXT_ERR] =
-               atomic64_read(&s->alloc_ucontext_err);
-       stats->value[EFA_CREATE_AH_ERR] = atomic64_read(&s->create_ah_err);
-       stats->value[EFA_MMAP_ERR] = atomic64_read(&s->mmap_err);
+       return ARRAY_SIZE(efa_port_stats_names);
+}
 
-       return ARRAY_SIZE(efa_stats_names);
+int efa_get_hw_stats(struct ib_device *ibdev, struct rdma_hw_stats *stats,
+                    u32 port_num, int index)
+{
+       if (port_num)
+               return efa_fill_port_stats(to_edev(ibdev), stats, port_num);
+       else
+               return efa_fill_device_stats(to_edev(ibdev), stats);
 }
 
 enum rdma_link_layer efa_port_link_layer(struct ib_device *ibdev,
index 16543f717527e40a26afd80ce7344a1356e3df37..98c813ba4304c2e5c5cb89abb9651965a9a797bd 100644 (file)
@@ -1,49 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0 or BSD-3-Clause
 /*
  * Copyright(c) 2015 - 2020 Intel Corporation.
- *
- * This file is provided under a dual BSD/GPLv2 license.  When using or
- * redistributing this file, you may do so under either license.
- *
- * GPL LICENSE SUMMARY
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * BSD LICENSE
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- *  - Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- *  - Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in
- *    the documentation and/or other materials provided with the
- *    distribution.
- *  - Neither the name of Intel Corporation nor the names of its
- *    contributors may be used to endorse or promote products derived
- *    from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
  */
+
 #include <linux/topology.h>
 #include <linux/cpumask.h>
 #include <linux/module.h>
index f94ed5d7c7a3f584445d5c15e7f0ca6e666558c4..00854f21787f502d0a2e93aad23fa9de1cf29b36 100644 (file)
@@ -1,49 +1,8 @@
+/* SPDX-License-Identifier: GPL-2.0 or BSD-3-Clause */
 /*
  * Copyright(c) 2015 - 2020 Intel Corporation.
- *
- * This file is provided under a dual BSD/GPLv2 license.  When using or
- * redistributing this file, you may do so under either license.
- *
- * GPL LICENSE SUMMARY
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * BSD LICENSE
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- *  - Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- *  - Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in
- *    the documentation and/or other materials provided with the
- *    distribution.
- *  - Neither the name of Intel Corporation nor the names of its
- *    contributors may be used to endorse or promote products derived
- *    from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
  */
+
 #ifndef _HFI1_AFFINITY_H
 #define _HFI1_AFFINITY_H
 
index 75d5d18da3da0db4a358d630285cf2395cd5d6f1..df295f47b31588112b8f0b5d2b1e2f43823b22f6 100644 (file)
@@ -1,49 +1,8 @@
+/* SPDX-License-Identifier: GPL-2.0 or BSD-3-Clause */
 /*
  * Copyright(c) 2015-2017 Intel Corporation.
- *
- * This file is provided under a dual BSD/GPLv2 license.  When using or
- * redistributing this file, you may do so under either license.
- *
- * GPL LICENSE SUMMARY
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * BSD LICENSE
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- *  - Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- *  - Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in
- *    the documentation and/or other materials provided with the
- *    distribution.
- *  - Neither the name of Intel Corporation nor the names of its
- *    contributors may be used to endorse or promote products derived
- *    from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
  */
+
 #ifndef _ASPM_H
 #define _ASPM_H
 
index c9754463836741fc832fc0570c35d78ba5262971..37273dc0c03cae6c182910e733ac6a485251485b 100644 (file)
@@ -1,48 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0 or BSD-3-Clause
 /*
  * Copyright(c) 2015 - 2020 Intel Corporation.
- *
- * This file is provided under a dual BSD/GPLv2 license.  When using or
- * redistributing this file, you may do so under either license.
- *
- * GPL LICENSE SUMMARY
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * BSD LICENSE
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- *  - Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- *  - Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in
- *    the documentation and/or other materials provided with the
- *    distribution.
- *  - Neither the name of Intel Corporation nor the names of its
- *    contributors may be used to endorse or promote products derived
- *    from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
  */
 
 /*
@@ -14414,7 +14372,7 @@ static void init_qos(struct hfi1_devdata *dd, struct rsm_map_table *rmt)
        if (rmt->used + rmt_entries >= NUM_MAP_ENTRIES)
                goto bail;
 
-       /* add qos entries to the the RSM map table */
+       /* add qos entries to the RSM map table */
        for (i = 0, ctxt = FIRST_KERNEL_KCTXT; i < num_vls; i++) {
                unsigned tctxt;
 
@@ -14893,7 +14851,7 @@ int hfi1_clear_ctxt_pkey(struct hfi1_devdata *dd, struct hfi1_ctxtdata *ctxt)
 }
 
 /*
- * Start doing the clean up the the chip. Our clean up happens in multiple
+ * Start doing the clean up the chip. Our clean up happens in multiple
  * stages and this is just the first.
  */
 void hfi1_start_cleanup(struct hfi1_devdata *dd)
@@ -15336,7 +15294,7 @@ int hfi1_init_dd(struct hfi1_devdata *dd)
        init_completion(&dd->user_comp);
 
        /* The user refcount starts with one to inidicate an active device */
-       atomic_set(&dd->user_refcount, 1);
+       refcount_set(&dd->user_refcount, 1);
 
        goto bail;
 
index ac26649d44636996dfb5c4858070ecb3ee66c33f..b2d53713da583f3345ea3d1dff78e1ee07168043 100644 (file)
@@ -1,52 +1,10 @@
-#ifndef _CHIP_H
-#define _CHIP_H
+/* SPDX-License-Identifier: GPL-2.0 or BSD-3-Clause */
 /*
  * Copyright(c) 2015 - 2020 Intel Corporation.
- *
- * This file is provided under a dual BSD/GPLv2 license.  When using or
- * redistributing this file, you may do so under either license.
- *
- * GPL LICENSE SUMMARY
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * BSD LICENSE
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- *  - Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- *  - Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in
- *    the documentation and/or other materials provided with the
- *    distribution.
- *  - Neither the name of Intel Corporation nor the names of its
- *    contributors may be used to endorse or promote products derived
- *    from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
  */
 
+#ifndef _CHIP_H
+#define _CHIP_H
 /*
  * This file contains all of the defines that is specific to the HFI chip
  */
index fb3ec9bff7a226f896075a889eb5b03bbfa23fe2..95a8d530d554bcabbaee777dbad6dc54f6e77380 100644 (file)
@@ -1,53 +1,11 @@
-#ifndef DEF_CHIP_REG
-#define DEF_CHIP_REG
-
+/* SPDX-License-Identifier: GPL-2.0 or BSD-3-Clause */
 /*
  * Copyright(c) 2015, 2016 Intel Corporation.
- *
- * This file is provided under a dual BSD/GPLv2 license.  When using or
- * redistributing this file, you may do so under either license.
- *
- * GPL LICENSE SUMMARY
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * BSD LICENSE
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- *  - Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- *  - Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in
- *    the documentation and/or other materials provided with the
- *    distribution.
- *  - Neither the name of Intel Corporation nor the names of its
- *    contributors may be used to endorse or promote products derived
- *    from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
  */
 
+#ifndef DEF_CHIP_REG
+#define DEF_CHIP_REG
+
 #define CORE           0x000000000000
 #define CCE                    (CORE + 0x000000000000)
 #define ASIC           (CORE + 0x000000400000)
index ff423e546b807cf2c474720dce6f3dfd67040ec9..995991d9709d0d1e4129e257d54c0356b108f10d 100644 (file)
@@ -1,48 +1,6 @@
+/* SPDX-License-Identifier: GPL-2.0 or BSD-3-Clause */
 /*
  * Copyright(c) 2015 - 2020 Intel Corporation.
- *
- * This file is provided under a dual BSD/GPLv2 license.  When using or
- * redistributing this file, you may do so under either license.
- *
- * GPL LICENSE SUMMARY
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * BSD LICENSE
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- *  - Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- *  - Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in
- *    the documentation and/or other materials provided with the
- *    distribution.
- *  - Neither the name of Intel Corporation nor the names of its
- *    contributors may be used to endorse or promote products derived
- *    from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
  */
 
 #ifndef _COMMON_H
index 2ced236e1553c97c54829a387af413b87f819977..22a3cdb940bedd285fa112f2a0c5f01108026775 100644 (file)
@@ -1,49 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0 or BSD-3-Clause
 /*
  * Copyright(c) 2015-2018 Intel Corporation.
- *
- * This file is provided under a dual BSD/GPLv2 license.  When using or
- * redistributing this file, you may do so under either license.
- *
- * GPL LICENSE SUMMARY
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * BSD LICENSE
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- *  - Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- *  - Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in
- *    the documentation and/or other materials provided with the
- *    distribution.
- *  - Neither the name of Intel Corporation nor the names of its
- *    contributors may be used to endorse or promote products derived
- *    from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
  */
+
 #include <linux/debugfs.h>
 #include <linux/seq_file.h>
 #include <linux/kernel.h>
@@ -1358,7 +1317,7 @@ static void _driver_stats_seq_stop(struct seq_file *s, void *v)
 {
 }
 
-static u64 hfi1_sps_ints(void)
+static void hfi1_sps_show_ints(struct seq_file *s)
 {
        unsigned long index, flags;
        struct hfi1_devdata *dd;
@@ -1369,24 +1328,19 @@ static u64 hfi1_sps_ints(void)
                sps_ints += get_all_cpu_total(dd->int_counter);
        }
        xa_unlock_irqrestore(&hfi1_dev_table, flags);
-       return sps_ints;
+       seq_write(s, &sps_ints, sizeof(u64));
 }
 
 static int _driver_stats_seq_show(struct seq_file *s, void *v)
 {
        loff_t *spos = v;
-       char *buffer;
        u64 *stats = (u64 *)&hfi1_stats;
-       size_t sz = seq_get_buf(s, &buffer);
 
-       if (sz < sizeof(u64))
-               return SEQ_SKIP;
        /* special case for interrupts */
        if (*spos == 0)
-               *(u64 *)buffer = hfi1_sps_ints();
+               hfi1_sps_show_ints(s);
        else
-               *(u64 *)buffer = stats[*spos];
-       seq_commit(s,  sizeof(u64));
+               seq_write(s, stats + *spos, sizeof(u64));
        return 0;
 }
 
index 57e582caa5eb33bb044632df8924ad2aa7977fa8..29a5a8de2c41a69da924a58b270a71cbca78e685 100644 (file)
@@ -1,52 +1,11 @@
-#ifndef _HFI1_DEBUGFS_H
-#define _HFI1_DEBUGFS_H
+/* SPDX-License-Identifier: GPL-2.0 or BSD-3-Clause */
 /*
  * Copyright(c) 2015, 2016, 2018 Intel Corporation.
- *
- * This file is provided under a dual BSD/GPLv2 license.  When using or
- * redistributing this file, you may do so under either license.
- *
- * GPL LICENSE SUMMARY
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * BSD LICENSE
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- *  - Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- *  - Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in
- *    the documentation and/or other materials provided with the
- *    distribution.
- *  - Neither the name of Intel Corporation nor the names of its
- *    contributors may be used to endorse or promote products derived
- *    from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
  */
 
+#ifndef _HFI1_DEBUGFS_H
+#define _HFI1_DEBUGFS_H
+
 struct hfi1_ibdev;
 
 #define DEBUGFS_SEQ_FILE_OPS(name) \
index bbb6069dec2a443bb065fa167eb23df3614ec515..68a184c3994198c8ee0a3b3f9a529768490f568a 100644 (file)
@@ -1,48 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0 or BSD-3-Clause
 /*
  * Copyright(c) 2015, 2016 Intel Corporation.
- *
- * This file is provided under a dual BSD/GPLv2 license.  When using or
- * redistributing this file, you may do so under either license.
- *
- * GPL LICENSE SUMMARY
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * BSD LICENSE
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- *  - Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- *  - Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in
- *    the documentation and/or other materials provided with the
- *    distribution.
- *  - Neither the name of Intel Corporation nor the names of its
- *    contributors may be used to endorse or promote products derived
- *    from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
  */
 
 #include <linux/cdev.h>
index c3ec19cb0ac94da37b21c4505083d32748f1159c..c371b5612b6b67fd0b6edc8d006d28a4f4c8a2f4 100644 (file)
@@ -1,52 +1,11 @@
-#ifndef _HFI1_DEVICE_H
-#define _HFI1_DEVICE_H
+/* SPDX-License-Identifier: GPL-2.0 or BSD-3-Clause */
 /*
  * Copyright(c) 2015, 2016 Intel Corporation.
- *
- * This file is provided under a dual BSD/GPLv2 license.  When using or
- * redistributing this file, you may do so under either license.
- *
- * GPL LICENSE SUMMARY
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * BSD LICENSE
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- *  - Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- *  - Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in
- *    the documentation and/or other materials provided with the
- *    distribution.
- *  - Neither the name of Intel Corporation nor the names of its
- *    contributors may be used to endorse or promote products derived
- *    from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
  */
 
+#ifndef _HFI1_DEVICE_H
+#define _HFI1_DEVICE_H
+
 int hfi1_cdev_init(int minor, const char *name,
                   const struct file_operations *fops,
                   struct cdev *cdev, struct device **devp,
index f88bb4af245fef5c66f8e36709f835b2d39d4cb5..de411884386bfb6598964b0d86108c7f65e1f84b 100644 (file)
@@ -1,48 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0 or BSD-3-Clause
 /*
  * Copyright(c) 2015-2020 Intel Corporation.
- *
- * This file is provided under a dual BSD/GPLv2 license.  When using or
- * redistributing this file, you may do so under either license.
- *
- * GPL LICENSE SUMMARY
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * BSD LICENSE
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- *  - Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- *  - Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in
- *    the documentation and/or other materials provided with the
- *    distribution.
- *  - Neither the name of Intel Corporation nor the names of its
- *    contributors may be used to endorse or promote products derived
- *    from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
  */
 
 #include <linux/spinlock.h>
index c22ab7b5163b3f7f95ad64b6d28715b28f9b8a93..f275dd1abed85baa397c9a66d3d80b8f9e16c534 100644 (file)
@@ -1,48 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0 or BSD-3-Clause
 /*
  * Copyright(c) 2015, 2016 Intel Corporation.
- *
- * This file is provided under a dual BSD/GPLv2 license.  When using or
- * redistributing this file, you may do so under either license.
- *
- * GPL LICENSE SUMMARY
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * BSD LICENSE
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- *  - Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- *  - Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in
- *    the documentation and/or other materials provided with the
- *    distribution.
- *  - Neither the name of Intel Corporation nor the names of its
- *    contributors may be used to endorse or promote products derived
- *    from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
  */
 
 #include <linux/ctype.h>
index 94e9e70de568aa1a4291fddc86346062b4a5f041..5ebc2f07bbef018f20c63ff2c4d80e2d36fca40c 100644 (file)
@@ -1,49 +1,8 @@
+/* SPDX-License-Identifier: GPL-2.0 or BSD-3-Clause */
 /*
  * Copyright(c) 2015, 2016 Intel Corporation.
- *
- * This file is provided under a dual BSD/GPLv2 license.  When using or
- * redistributing this file, you may do so under either license.
- *
- * GPL LICENSE SUMMARY
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * BSD LICENSE
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- *  - Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- *  - Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in
- *    the documentation and/or other materials provided with the
- *    distribution.
- *  - Neither the name of Intel Corporation nor the names of its
- *    contributors may be used to endorse or promote products derived
- *    from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
  */
+
 #ifndef _HFI1_EFIVAR_H
 #define _HFI1_EFIVAR_H
 
index 1613af1c58d9ddaafca831b1282a6462fdc10b66..fbe95810745722e97bba047c68e0f945ad94baa0 100644 (file)
@@ -1,49 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0 or BSD-3-Clause
 /*
  * Copyright(c) 2015, 2016 Intel Corporation.
- *
- * This file is provided under a dual BSD/GPLv2 license.  When using or
- * redistributing this file, you may do so under either license.
- *
- * GPL LICENSE SUMMARY
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * BSD LICENSE
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- *  - Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- *  - Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in
- *    the documentation and/or other materials provided with the
- *    distribution.
- *  - Neither the name of Intel Corporation nor the names of its
- *    contributors may be used to endorse or promote products derived
- *    from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
  */
+
 #include <linux/delay.h>
 #include "hfi.h"
 #include "common.h"
index e774184f1643013c46d8b09b12fa982dbba2af77..772c516366cee64c9f989d7358d38c3bf99a8bce 100644 (file)
@@ -1,48 +1,6 @@
+/* SPDX-License-Identifier: GPL-2.0 or BSD-3-Clause */
 /*
  * Copyright(c) 2015, 2016 Intel Corporation.
- *
- * This file is provided under a dual BSD/GPLv2 license.  When using or
- * redistributing this file, you may do so under either license.
- *
- * GPL LICENSE SUMMARY
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * BSD LICENSE
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- *  - Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- *  - Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in
- *    the documentation and/or other materials provided with the
- *    distribution.
- *  - Neither the name of Intel Corporation nor the names of its
- *    contributors may be used to endorse or promote products derived
- *    from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
  */
 
 struct hfi1_devdata;
index a414214f60355434f6d73164d0e3b82983668697..b86f697c7956e1d4b483d6bf9cdf10aff4d5b502 100644 (file)
@@ -1,48 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0 or BSD-3-Clause
 /*
  * Copyright(c) 2017 Intel Corporation.
- *
- * This file is provided under a dual BSD/GPLv2 license.  When using or
- * redistributing this file, you may do so under either license.
- *
- * GPL LICENSE SUMMARY
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * BSD LICENSE
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- *  - Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- *  - Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in
- *    the documentation and/or other materials provided with the
- *    distribution.
- *  - Neither the name of Intel Corporation nor the names of its
- *    contributors may be used to endorse or promote products derived
- *    from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
  */
 
 #include "exp_rcv.h"
index f25362015095bbf319009220d3cd84195d837a28..c6291bbf723cabb75076009525446a3588e70533 100644 (file)
@@ -1,52 +1,10 @@
-#ifndef _HFI1_EXP_RCV_H
-#define _HFI1_EXP_RCV_H
+/* SPDX-License-Identifier: GPL-2.0 or BSD-3-Clause */
 /*
  * Copyright(c) 2017 Intel Corporation.
- *
- * This file is provided under a dual BSD/GPLv2 license.  When using or
- * redistributing this file, you may do so under either license.
- *
- * GPL LICENSE SUMMARY
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * BSD LICENSE
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- *  - Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- *  - Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in
- *    the documentation and/or other materials provided with the
- *    distribution.
- *  - Neither the name of Intel Corporation nor the names of its
- *    contributors may be used to endorse or promote products derived
- *    from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
  */
 
+#ifndef _HFI1_EXP_RCV_H
+#define _HFI1_EXP_RCV_H
 #include "hfi.h"
 
 #define EXP_TID_SET_EMPTY(set) (set.count == 0 && list_empty(&set.list))
index 0dfbcfb048ca9d8987bc0a9f42c133e10c0587f8..e2e4f9f6fae233d7bd3bd9b742138d5851af2e59 100644 (file)
@@ -1,49 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0 or BSD-3-Clause
 /*
  * Copyright(c) 2018 Intel Corporation.
- *
- * This file is provided under a dual BSD/GPLv2 license.  When using or
- * redistributing this file, you may do so under either license.
- *
- * GPL LICENSE SUMMARY
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * BSD LICENSE
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- *  - Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- *  - Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in
- *    the documentation and/or other materials provided with the
- *    distribution.
- *  - Neither the name of Intel Corporation nor the names of its
- *    contributors may be used to endorse or promote products derived
- *    from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
  */
+
 #include <linux/debugfs.h>
 #include <linux/seq_file.h>
 #include <linux/kernel.h>
index a83382700a7c09ef22a8aec61933e988e33a20e8..7fe7f47219dbcbd835bda906af65263d6cfa2aff 100644 (file)
@@ -1,51 +1,11 @@
-#ifndef _HFI1_FAULT_H
-#define _HFI1_FAULT_H
+/* SPDX-License-Identifier: GPL-2.0 or BSD-3-Clause */
 /*
  * Copyright(c) 2018 Intel Corporation.
- *
- * This file is provided under a dual BSD/GPLv2 license.  When using or
- * redistributing this file, you may do so under either license.
- *
- * GPL LICENSE SUMMARY
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * BSD LICENSE
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- *  - Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- *  - Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in
- *    the documentation and/or other materials provided with the
- *    distribution.
- *  - Neither the name of Intel Corporation nor the names of its
- *    contributors may be used to endorse or promote products derived
- *    from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
  */
+
+#ifndef _HFI1_FAULT_H
+#define _HFI1_FAULT_H
+
 #include <linux/fault-inject.h>
 #include <linux/dcache.h>
 #include <linux/bitops.h>
index 955c3637980e8e37849092d9c7a2520a17a6da5b..1783a6ea5427bba74cee33133f5ac104932e8dd1 100644 (file)
@@ -1,50 +1,9 @@
+// SPDX-License-Identifier: GPL-2.0 or BSD-3-Clause
 /*
  * Copyright(c) 2020 Cornelis Networks, Inc.
  * Copyright(c) 2015-2020 Intel Corporation.
- *
- * This file is provided under a dual BSD/GPLv2 license.  When using or
- * redistributing this file, you may do so under either license.
- *
- * GPL LICENSE SUMMARY
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * BSD LICENSE
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- *  - Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- *  - Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in
- *    the documentation and/or other materials provided with the
- *    distribution.
- *  - Neither the name of Intel Corporation nor the names of its
- *    contributors may be used to endorse or promote products derived
- *    from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
  */
+
 #include <linux/poll.h>
 #include <linux/cdev.h>
 #include <linux/vmalloc.h>
@@ -194,7 +153,7 @@ static int hfi1_file_open(struct inode *inode, struct file *fp)
        if (!((dd->flags & HFI1_PRESENT) && dd->kregbase1))
                return -EINVAL;
 
-       if (!atomic_inc_not_zero(&dd->user_refcount))
+       if (!refcount_inc_not_zero(&dd->user_refcount))
                return -ENXIO;
 
        /* The real work is performed later in assign_ctxt() */
@@ -213,7 +172,7 @@ static int hfi1_file_open(struct inode *inode, struct file *fp)
 nomem:
        kfree(fd);
        fp->private_data = NULL;
-       if (atomic_dec_and_test(&dd->user_refcount))
+       if (refcount_dec_and_test(&dd->user_refcount))
                complete(&dd->user_comp);
        return -ENOMEM;
 }
@@ -711,7 +670,7 @@ static int hfi1_file_close(struct inode *inode, struct file *fp)
        deallocate_ctxt(uctxt);
 done:
 
-       if (atomic_dec_and_test(&dd->user_refcount))
+       if (refcount_dec_and_test(&dd->user_refcount))
                complete(&dd->user_comp);
 
        cleanup_srcu_struct(&fdata->pq_srcu);
index 2cf102b5abd44269c53b1d033ca13c30dd71477f..31e63e245ea92b345eb0d809dedc3878aa07d9a7 100644 (file)
@@ -1,48 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0 or BSD-3-Clause
 /*
  * Copyright(c) 2015 - 2017 Intel Corporation.
- *
- * This file is provided under a dual BSD/GPLv2 license.  When using or
- * redistributing this file, you may do so under either license.
- *
- * GPL LICENSE SUMMARY
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * BSD LICENSE
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- *  - Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- *  - Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in
- *    the documentation and/or other materials provided with the
- *    distribution.
- *  - Neither the name of Intel Corporation nor the names of its
- *    contributors may be used to endorse or promote products derived
- *    from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
  */
 
 #include <linux/firmware.h>
index 31664f43c27fefdf14c0d88f43557c2978a39b61..7fa9cd39254fd53fac23499fd6392b5aa7d21888 100644 (file)
@@ -1,53 +1,13 @@
-#ifndef _HFI1_KERNEL_H
-#define _HFI1_KERNEL_H
+/* SPDX-License-Identifier: GPL-2.0 or BSD-3-Clause */
 /*
  * Copyright(c) 2020 Cornelis Networks, Inc.
  * Copyright(c) 2015-2020 Intel Corporation.
- *
- * This file is provided under a dual BSD/GPLv2 license.  When using or
- * redistributing this file, you may do so under either license.
- *
- * GPL LICENSE SUMMARY
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * BSD LICENSE
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- *  - Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- *  - Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in
- *    the documentation and/or other materials provided with the
- *    distribution.
- *  - Neither the name of Intel Corporation nor the names of its
- *    contributors may be used to endorse or promote products derived
- *    from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
  */
 
+#ifndef _HFI1_KERNEL_H
+#define _HFI1_KERNEL_H
+
+#include <linux/refcount.h>
 #include <linux/interrupt.h>
 #include <linux/pci.h>
 #include <linux/dma-mapping.h>
@@ -1384,7 +1344,7 @@ struct hfi1_devdata {
        /* Number of verbs contexts which have disabled ASPM */
        atomic_t aspm_disabled_cnt;
        /* Keeps track of user space clients */
-       atomic_t user_refcount;
+       refcount_t user_refcount;
        /* Used to wait for outstanding user space clients before dev removal */
        struct completion user_comp;
 
@@ -2601,7 +2561,7 @@ static inline bool hfi1_get_hdr_type(u32 lid, struct rdma_ah_attr *attr)
                        HFI1_PKT_TYPE_16B : HFI1_PKT_TYPE_9B;
 
        /*
-        * Return a 16B header type if either the the destination
+        * Return a 16B header type if either the destination
         * or source lid is extended.
         */
        if (hfi1_get_packet_type(rdma_ah_get_dlid(attr)) == HFI1_PKT_TYPE_16B)
index 0986aa065418aff62b5f0a89fe2b12fa8bcf23ab..e3679d076eaafa1cf6dd09ca932bdc3e4dde3109 100644 (file)
@@ -1,48 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0 or BSD-3-Clause
 /*
  * Copyright(c) 2015 - 2020 Intel Corporation.
- *
- * This file is provided under a dual BSD/GPLv2 license.  When using or
- * redistributing this file, you may do so under either license.
- *
- * GPL LICENSE SUMMARY
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * BSD LICENSE
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- *  - Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- *  - Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in
- *    the documentation and/or other materials provided with the
- *    distribution.
- *  - Neither the name of Intel Corporation nor the names of its
- *    contributors may be used to endorse or promote products derived
- *    from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
  */
 
 #include <linux/pci.h>
@@ -650,12 +608,7 @@ void hfi1_init_pportdata(struct pci_dev *pdev, struct hfi1_pportdata *ppd,
 
        ppd->pkeys[default_pkey_idx] = DEFAULT_P_KEY;
        ppd->part_enforce |= HFI1_PART_ENFORCE_IN;
-
-       if (loopback) {
-               dd_dev_err(dd, "Faking data partition 0x8001 in idx %u\n",
-                          !default_pkey_idx);
-               ppd->pkeys[!default_pkey_idx] = 0x8001;
-       }
+       ppd->pkeys[0] = 0x8001;
 
        INIT_WORK(&ppd->link_vc_work, handle_verify_cap);
        INIT_WORK(&ppd->link_up_work, handle_link_up);
@@ -1752,7 +1705,7 @@ static void wait_for_clients(struct hfi1_devdata *dd)
         * Remove the device init value and complete the device if there is
         * no clients or wait for active clients to finish.
         */
-       if (atomic_dec_and_test(&dd->user_refcount))
+       if (refcount_dec_and_test(&dd->user_refcount))
                complete(&dd->user_comp);
 
        wait_for_completion(&dd->user_comp);
index 5ba5c11459e79a1e04059bbcadf2a5220bfbab60..70376e6dba335f0f3a710351bcf503bdec2eb38c 100644 (file)
@@ -1,48 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0 or BSD-3-Clause
 /*
  * Copyright(c) 2015, 2016 Intel Corporation.
- *
- * This file is provided under a dual BSD/GPLv2 license.  When using or
- * redistributing this file, you may do so under either license.
- *
- * GPL LICENSE SUMMARY
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * BSD LICENSE
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- *  - Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- *  - Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in
- *    the documentation and/or other materials provided with the
- *    distribution.
- *  - Neither the name of Intel Corporation nor the names of its
- *    contributors may be used to endorse or promote products derived
- *    from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
  */
 
 #include <linux/pci.h>
index cda81a7843c2452ff183422a1b4c1e4d2acde9e0..4df0700cbabad478dbcf3100e94ba81ca86b1ba1 100644 (file)
@@ -1,52 +1,11 @@
-#ifndef _HFI1_IOWAIT_H
-#define _HFI1_IOWAIT_H
+/* SPDX-License-Identifier: GPL-2.0 or BSD-3-Clause */
 /*
  * Copyright(c) 2015 - 2018 Intel Corporation.
- *
- * This file is provided under a dual BSD/GPLv2 license.  When using or
- * redistributing this file, you may do so under either license.
- *
- * GPL LICENSE SUMMARY
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * BSD LICENSE
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- *  - Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- *  - Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in
- *    the documentation and/or other materials provided with the
- *    distribution.
- *  - Neither the name of Intel Corporation nor the names of its
- *    contributors may be used to endorse or promote products derived
- *    from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
  */
 
+#ifndef _HFI1_IOWAIT_H
+#define _HFI1_IOWAIT_H
+
 #include <linux/list.h>
 #include <linux/workqueue.h>
 #include <linux/wait.h>
index 993f9838b6c8043fca15e4d420b1743f7984048f..e74ddbe465891df1ccf42ba0db1d39ff829e27d7 100644 (file)
@@ -644,10 +644,13 @@ static int hfi1_ipoib_sdma_sleep(struct sdma_engine *sde,
                        /* came from non-list submit */
                        list_add_tail(&txreq->list, &txq->tx_list);
                if (list_empty(&txq->wait.list)) {
+                       struct hfi1_ibport *ibp = &sde->ppd->ibport_data;
+
                        if (!atomic_xchg(&txq->no_desc, 1)) {
                                trace_hfi1_txq_queued(txq);
                                hfi1_ipoib_stop_txq(txq);
                        }
+                       ibp->rvp.n_dmawait++;
                        iowait_queue(pkts_sent, wait->iow, &sde->dmawait);
                }
 
index 1fe5e702f31d2dadc8a52844b2f162a310784a9a..4146a2113a9540ea0e7435364c6ee5b7ef158beb 100644 (file)
@@ -1,48 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0 or BSD-3-Clause
 /*
  * Copyright(c) 2015-2018 Intel Corporation.
- *
- * This file is provided under a dual BSD/GPLv2 license.  When using or
- * redistributing this file, you may do so under either license.
- *
- * GPL LICENSE SUMMARY
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * BSD LICENSE
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- *  - Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- *  - Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in
- *    the documentation and/or other materials provided with the
- *    distribution.
- *  - Neither the name of Intel Corporation nor the names of its
- *    contributors may be used to endorse or promote products derived
- *    from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
  */
 
 #include <linux/net.h>
index 0205d308ef5e9beded85bcb1cf079e6659bf912e..1d45a008fa7f4093aa047c31ab0d8b7a66a28cc9 100644 (file)
@@ -1,49 +1,8 @@
+/* SPDX-License-Identifier: GPL-2.0 or BSD-3-Clause */
 /*
  * Copyright(c) 2015 - 2017 Intel Corporation.
- *
- * This file is provided under a dual BSD/GPLv2 license.  When using or
- * redistributing this file, you may do so under either license.
- *
- * GPL LICENSE SUMMARY
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * BSD LICENSE
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- *  - Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- *  - Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in
- *    the documentation and/or other materials provided with the
- *    distribution.
- *  - Neither the name of Intel Corporation nor the names of its
- *    contributors may be used to endorse or promote products derived
- *    from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
  */
+
 #ifndef _HFI1_MAD_H
 #define _HFI1_MAD_H
 
index d213f65d4cdd0ff5fe9a34d5617e3ccb149d94d9..876cc78a22cca16e2ff184fc73daf0a1e89dc9e0 100644 (file)
@@ -1,50 +1,9 @@
+// SPDX-License-Identifier: GPL-2.0 or BSD-3-Clause
 /*
  * Copyright(c) 2020 Cornelis Networks, Inc.
  * Copyright(c) 2016 - 2017 Intel Corporation.
- *
- * This file is provided under a dual BSD/GPLv2 license.  When using or
- * redistributing this file, you may do so under either license.
- *
- * GPL LICENSE SUMMARY
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * BSD LICENSE
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- *  - Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- *  - Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in
- *    the documentation and/or other materials provided with the
- *    distribution.
- *  - Neither the name of Intel Corporation nor the names of its
- *    contributors may be used to endorse or promote products derived
- *    from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
  */
+
 #include <linux/list.h>
 #include <linux/rculist.h>
 #include <linux/mmu_notifier.h>
index 423aacc67e9488aa70dbf18fa91cb2570d37f0d7..7417be2b9dc8a509577717626f49025d8e565cba 100644 (file)
@@ -1,50 +1,9 @@
+/* SPDX-License-Identifier: GPL-2.0 or BSD-3-Clause */
 /*
  * Copyright(c) 2020 Cornelis Networks, Inc.
  * Copyright(c) 2016 Intel Corporation.
- *
- * This file is provided under a dual BSD/GPLv2 license.  When using or
- * redistributing this file, you may do so under either license.
- *
- * GPL LICENSE SUMMARY
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * BSD LICENSE
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- *  - Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- *  - Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in
- *    the documentation and/or other materials provided with the
- *    distribution.
- *  - Neither the name of Intel Corporation nor the names of its
- *    contributors may be used to endorse or promote products derived
- *    from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
  */
+
 #ifndef _HFI1_MMU_RB_H
 #define _HFI1_MMU_RB_H
 
index 57a5f02ebc777f5acf95cf99267d21b7552e2f86..77d2ece9a9cbaf0cdbc5c7721e93c38e3c22ccd3 100644 (file)
@@ -1,49 +1,6 @@
 // SPDX-License-Identifier: (GPL-2.0 OR BSD-3-Clause)
 /*
  * Copyright(c) 2018 - 2020 Intel Corporation.
- *
- * This file is provided under a dual BSD/GPLv2 license.  When using or
- * redistributing this file, you may do so under either license.
- *
- * GPL LICENSE SUMMARY
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * BSD LICENSE
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- *  - Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- *  - Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in
- *    the documentation and/or other materials provided with the
- *    distribution.
- *  - Neither the name of Intel Corporation nor the names of its
- *    contributors may be used to endorse or promote products derived
- *    from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
  */
 
 #include "hfi.h"
index e63e944bf0fc9f31183d2d8ee2b41e559860f963..9530ccb0a2cecb35fc7c0ddf241816747b314ac2 100644 (file)
@@ -1,50 +1,8 @@
 /* SPDX-License-Identifier: (GPL-2.0 OR BSD-3-Clause) */
 /*
  * Copyright(c) 2018 - 2020 Intel Corporation.
- *
- * This file is provided under a dual BSD/GPLv2 license.  When using or
- * redistributing this file, you may do so under either license.
- *
- * GPL LICENSE SUMMARY
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * BSD LICENSE
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- *  - Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- *  - Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in
- *    the documentation and/or other materials provided with the
- *    distribution.
- *  - Neither the name of Intel Corporation nor the names of its
- *    contributors may be used to endorse or promote products derived
- *    from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
  */
+
 #ifndef _HFI1_MSIX_H
 #define _HFI1_MSIX_H
 
index 774215b95df55a0a3cbac5aabde3a4a91a792c15..31570b0cfd18b66652b6a1e31f8a97779551852c 100644 (file)
@@ -1,52 +1,10 @@
-#ifndef _LINUX_H
-#define _LINUX_H
+/* SPDX-License-Identifier: GPL-2.0 or BSD-3-Clause */
 /*
  * Copyright(c) 2015, 2016 Intel Corporation.
- *
- * This file is provided under a dual BSD/GPLv2 license.  When using or
- * redistributing this file, you may do so under either license.
- *
- * GPL LICENSE SUMMARY
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * BSD LICENSE
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- *  - Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- *  - Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in
- *    the documentation and/or other materials provided with the
- *    distribution.
- *  - Neither the name of Intel Corporation nor the names of its
- *    contributors may be used to endorse or promote products derived
- *    from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
  */
 
+#ifndef _LINUX_H
+#define _LINUX_H
 /*
  * This header file is for OPA-specific definitions which are
  * required by the HFI driver, and which aren't yet in the Linux
index 6f06e9920503723da2c3ee616879ee4da3ef7f01..a0802332c8cb32f36a386d49561e8bef3688b9b6 100644 (file)
@@ -1,48 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0 or BSD-3-Clause
 /*
  * Copyright(c) 2015 - 2019 Intel Corporation.
- *
- * This file is provided under a dual BSD/GPLv2 license.  When using or
- * redistributing this file, you may do so under either license.
- *
- * GPL LICENSE SUMMARY
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * BSD LICENSE
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- *  - Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- *  - Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in
- *    the documentation and/or other materials provided with the
- *    distribution.
- *  - Neither the name of Intel Corporation nor the names of its
- *    contributors may be used to endorse or promote products derived
- *    from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
  */
 
 #include <linux/pci.h>
@@ -92,25 +50,18 @@ int hfi1_pcie_init(struct hfi1_devdata *dd)
                goto bail;
        }
 
-       ret = pci_set_dma_mask(pdev, DMA_BIT_MASK(64));
+       ret = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64));
        if (ret) {
                /*
                 * If the 64 bit setup fails, try 32 bit.  Some systems
                 * do not setup 64 bit maps on systems with 2GB or less
                 * memory installed.
                 */
-               ret = pci_set_dma_mask(pdev, DMA_BIT_MASK(32));
+               ret = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));
                if (ret) {
                        dd_dev_err(dd, "Unable to set DMA mask: %d\n", ret);
                        goto bail;
                }
-               ret = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32));
-       } else {
-               ret = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(64));
-       }
-       if (ret) {
-               dd_dev_err(dd, "Unable to set DMA consistent mask: %d\n", ret);
-               goto bail;
        }
 
        pci_set_master(pdev);
index e276522104c6a604574db9d6331446a00fddf057..489b436f19bb3df07b361a0487feb43e7e05792d 100644 (file)
@@ -1,48 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0 or BSD-3-Clause
 /*
  * Copyright(c) 2015-2018 Intel Corporation.
- *
- * This file is provided under a dual BSD/GPLv2 license.  When using or
- * redistributing this file, you may do so under either license.
- *
- * GPL LICENSE SUMMARY
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * BSD LICENSE
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- *  - Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- *  - Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in
- *    the documentation and/or other materials provided with the
- *    distribution.
- *  - Neither the name of Intel Corporation nor the names of its
- *    contributors may be used to endorse or promote products derived
- *    from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
  */
 
 #include <linux/delay.h>
index 9e5f08d2b9852a87679f1248ec877cd2cbb4af2a..ea714008f261abdf2f5d5600c6b1983aa4867fda 100644 (file)
@@ -1,52 +1,10 @@
-#ifndef _PIO_H
-#define _PIO_H
+/* SPDX-License-Identifier: GPL-2.0 or BSD-3-Clause */
 /*
  * Copyright(c) 2015-2017 Intel Corporation.
- *
- * This file is provided under a dual BSD/GPLv2 license.  When using or
- * redistributing this file, you may do so under either license.
- *
- * GPL LICENSE SUMMARY
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * BSD LICENSE
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- *  - Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- *  - Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in
- *    the documentation and/or other materials provided with the
- *    distribution.
- *  - Neither the name of Intel Corporation nor the names of its
- *    contributors may be used to endorse or promote products derived
- *    from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
  */
 
+#ifndef _PIO_H
+#define _PIO_H
 /* send context types */
 #define SC_KERNEL 0
 #define SC_VL15   1
index 14bfd8287f4ae83f6769d580441de7a136e6f3a1..136f9a99e1e08a0461ea36dfc89c1ae7808bade5 100644 (file)
@@ -1,48 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0 or BSD-3-Clause
 /*
  * Copyright(c) 2015, 2016 Intel Corporation.
- *
- * This file is provided under a dual BSD/GPLv2 license.  When using or
- * redistributing this file, you may do so under either license.
- *
- * GPL LICENSE SUMMARY
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * BSD LICENSE
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- *  - Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- *  - Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in
- *    the documentation and/or other materials provided with the
- *    distribution.
- *  - Neither the name of Intel Corporation nor the names of its
- *    contributors may be used to endorse or promote products derived
- *    from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
  */
 
 #include "hfi.h"
index 4642d6ceb89033bb8009a967c3d2f78d68de942b..54cbd8f1a6c1e76ffd63b95ba5d55c5d2fdf3f5d 100644 (file)
@@ -1,48 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0 or BSD-3-Clause
 /*
  * Copyright(c) 2015, 2016 Intel Corporation.
- *
- * This file is provided under a dual BSD/GPLv2 license.  When using or
- * redistributing this file, you may do so under either license.
- *
- * GPL LICENSE SUMMARY
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * BSD LICENSE
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- *  - Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- *  - Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in
- *    the documentation and/or other materials provided with the
- *    distribution.
- *  - Neither the name of Intel Corporation nor the names of its
- *    contributors may be used to endorse or promote products derived
- *    from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
  */
 
 #include <linux/firmware.h>
index eed0aa9124fa6f922fbd148cbc0d32a59c3e4635..1d51dca1bc305c6cd618c43ab580b72df2948f12 100644 (file)
@@ -1,49 +1,8 @@
+/* SPDX-License-Identifier: GPL-2.0 or BSD-3-Clause */
 /*
  * Copyright(c) 2015, 2016 Intel Corporation.
- *
- * This file is provided under a dual BSD/GPLv2 license.  When using or
- * redistributing this file, you may do so under either license.
- *
- * GPL LICENSE SUMMARY
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * BSD LICENSE
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- *  - Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- *  - Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in
- *    the documentation and/or other materials provided with the
- *    distribution.
- *  - Neither the name of Intel Corporation nor the names of its
- *    contributors may be used to endorse or promote products derived
- *    from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
  */
+
 #ifndef __PLATFORM_H
 #define __PLATFORM_H
 
index e037df91151273434b9954e584a22322c9f78f3d..6193d48b2c1fa008c6d29d030b90bf3c0e9a836e 100644 (file)
@@ -1,48 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0 or BSD-3-Clause
 /*
  * Copyright(c) 2015 - 2020 Intel Corporation.
- *
- * This file is provided under a dual BSD/GPLv2 license.  When using or
- * redistributing this file, you may do so under either license.
- *
- * GPL LICENSE SUMMARY
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * BSD LICENSE
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- *  - Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- *  - Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in
- *    the documentation and/or other materials provided with the
- *    distribution.
- *  - Neither the name of Intel Corporation nor the names of its
- *    contributors may be used to endorse or promote products derived
- *    from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
  */
 
 #include <linux/err.h>
index b0d053d12129ece3d420af51ce22f2bb88d143da..cdf87bc6ad94aa37358ea296d2d719ce08870dc9 100644 (file)
@@ -1,52 +1,10 @@
-#ifndef _QP_H
-#define _QP_H
+/* SPDX-License-Identifier: GPL-2.0 or BSD-3-Clause */
 /*
  * Copyright(c) 2015 - 2018 Intel Corporation.
- *
- * This file is provided under a dual BSD/GPLv2 license.  When using or
- * redistributing this file, you may do so under either license.
- *
- * GPL LICENSE SUMMARY
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * BSD LICENSE
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- *  - Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- *  - Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in
- *    the documentation and/or other materials provided with the
- *    distribution.
- *  - Neither the name of Intel Corporation nor the names of its
- *    contributors may be used to endorse or promote products derived
- *    from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
  */
 
+#ifndef _QP_H
+#define _QP_H
 #include <linux/hash.h>
 #include <rdma/rdmavt_qp.h>
 #include "verbs.h"
index 38f311f855b5776cb87a0134feea99c66f360eb1..19d7887a4f105a64e8302c579357a42950b2415c 100644 (file)
@@ -1,48 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0 or BSD-3-Clause
 /*
  * Copyright(c) 2015, 2016 Intel Corporation.
- *
- * This file is provided under a dual BSD/GPLv2 license.  When using or
- * redistributing this file, you may do so under either license.
- *
- * GPL LICENSE SUMMARY
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * BSD LICENSE
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- *  - Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- *  - Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in
- *    the documentation and/or other materials provided with the
- *    distribution.
- *  - Neither the name of Intel Corporation nor the names of its
- *    contributors may be used to endorse or promote products derived
- *    from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
  */
 
 #include <linux/delay.h>
index 36cf52359848afdc5180d03602d587d3813f5b71..8f14111eaa479627ea0646918b087a5f469c67d1 100644 (file)
@@ -1,48 +1,6 @@
+/* SPDX-License-Identifier: GPL-2.0 or BSD-3-Clause */
 /*
  * Copyright(c) 2015, 2016 Intel Corporation.
- *
- * This file is provided under a dual BSD/GPLv2 license.  When using or
- * redistributing this file, you may do so under either license.
- *
- * GPL LICENSE SUMMARY
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * BSD LICENSE
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- *  - Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- *  - Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in
- *    the documentation and/or other materials provided with the
- *    distribution.
- *  - Neither the name of Intel Corporation nor the names of its
- *    contributors may be used to endorse or promote products derived
- *    from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
  */
 /* QSFP support common definitions, for hfi driver */
 
index 0174b8ee9f00f1f86759797db6bc4a53d8903427..acd2b273ea7d79b1c9ebb54919f6bd69bf10caf3 100644 (file)
@@ -1,48 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0 or BSD-3-Clause
 /*
  * Copyright(c) 2015 - 2018 Intel Corporation.
- *
- * This file is provided under a dual BSD/GPLv2 license.  When using or
- * redistributing this file, you may do so under either license.
- *
- * GPL LICENSE SUMMARY
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * BSD LICENSE
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- *  - Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- *  - Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in
- *    the documentation and/or other materials provided with the
- *    distribution.
- *  - Neither the name of Intel Corporation nor the names of its
- *    contributors may be used to endorse or promote products derived
- *    from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
  */
 
 #include <linux/io.h>
index c3fa1814c6a86d52ff1b1e889005ba49855475de..b0151b7293f5da940a0dfa349ee2f9ccf78be5df 100644 (file)
@@ -1,48 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0 or BSD-3-Clause
 /*
  * Copyright(c) 2015 - 2018 Intel Corporation.
- *
- * This file is provided under a dual BSD/GPLv2 license.  When using or
- * redistributing this file, you may do so under either license.
- *
- * GPL LICENSE SUMMARY
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * BSD LICENSE
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- *  - Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- *  - Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in
- *    the documentation and/or other materials provided with the
- *    distribution.
- *  - Neither the name of Intel Corporation nor the names of its
- *    contributors may be used to endorse or promote products derived
- *    from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
  */
 
 #include <linux/spinlock.h>
@@ -459,7 +417,7 @@ void hfi1_make_ruc_header(struct rvt_qp *qp, struct ib_other_headers *ohdr,
  * send engine
  * @qp: a pointer to QP
  * @ps: a pointer to a structure with commonly lookup values for
- *      the the send engine progress
+ *      the send engine progress
  * @tid: true if it is the tid leg
  *
  * This routine checks if the time slice for the QP has expired
index eb15c310d63d8d7cebfd17492d67e49d2b869e4c..21966ba255b988fa48cf854706b4f29efaf30bed 100644 (file)
@@ -1,48 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0 or BSD-3-Clause
 /*
  * Copyright(c) 2015 - 2018 Intel Corporation.
- *
- * This file is provided under a dual BSD/GPLv2 license.  When using or
- * redistributing this file, you may do so under either license.
- *
- * GPL LICENSE SUMMARY
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * BSD LICENSE
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- *  - Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- *  - Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in
- *    the documentation and/or other materials provided with the
- *    distribution.
- *  - Neither the name of Intel Corporation nor the names of its
- *    contributors may be used to endorse or promote products derived
- *    from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
  */
 
 #include <linux/spinlock.h>
@@ -1860,7 +1818,7 @@ retry:
 
        /*
         * The SDMA idle interrupt is not guaranteed to be ordered with respect
-        * to updates to the the dma_head location in host memory. The head
+        * to updates to the dma_head location in host memory. The head
         * value read might not be fully up to date. If there are pending
         * descriptors and the SDMA idle interrupt fired then read from the
         * CSR SDMA head instead to get the latest value from the hardware.
index f57d55272dd25a87fec71a16178b53f5959a0245..d8170fcbfbdd5b4a4ae689408fd3a8c5aca79c1a 100644 (file)
@@ -1,52 +1,11 @@
-#ifndef _HFI1_SDMA_H
-#define _HFI1_SDMA_H
+/* SPDX-License-Identifier: GPL-2.0 or BSD-3-Clause */
 /*
  * Copyright(c) 2015 - 2018 Intel Corporation.
- *
- * This file is provided under a dual BSD/GPLv2 license.  When using or
- * redistributing this file, you may do so under either license.
- *
- * GPL LICENSE SUMMARY
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * BSD LICENSE
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- *  - Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- *  - Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in
- *    the documentation and/or other materials provided with the
- *    distribution.
- *  - Neither the name of Intel Corporation nor the names of its
- *    contributors may be used to endorse or promote products derived
- *    from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
  */
 
+#ifndef _HFI1_SDMA_H
+#define _HFI1_SDMA_H
+
 #include <linux/types.h>
 #include <linux/list.h>
 #include <asm/byteorder.h>
index 514a4784566b2a4dbf72bfcc5b33e171e0dd4ff7..e262fb5c5ec611bc471459e8f66c82b7b8729edb 100644 (file)
@@ -1,48 +1,6 @@
+/* SPDX-License-Identifier: GPL-2.0 or BSD-3-Clause */
 /*
  * Copyright(c) 2016 Intel Corporation.
- *
- * This file is provided under a dual BSD/GPLv2 license.  When using or
- * redistributing this file, you may do so under either license.
- *
- * GPL LICENSE SUMMARY
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * BSD LICENSE
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- *  - Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- *  - Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in
- *    the documentation and/or other materials provided with the
- *    distribution.
- *  - Neither the name of Intel Corporation nor the names of its
- *    contributors may be used to endorse or promote products derived
- *    from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
  */
 
 #ifndef HFI1_SDMA_TXREQ_H
index acfcbedebe0d69fe60ab47788a19ee5f64879936..3b3407dc7c21dd4e8d11990e78080bed654665b2 100644 (file)
@@ -1,49 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0 or BSD-3-Clause
 /*
  * Copyright(c) 2015-2017 Intel Corporation.
- *
- * This file is provided under a dual BSD/GPLv2 license.  When using or
- * redistributing this file, you may do so under either license.
- *
- * GPL LICENSE SUMMARY
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * BSD LICENSE
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- *  - Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- *  - Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in
- *    the documentation and/or other materials provided with the
- *    distribution.
- *  - Neither the name of Intel Corporation nor the names of its
- *    contributors may be used to endorse or promote products derived
- *    from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
  */
+
 #include <linux/ctype.h>
 #include <rdma/ib_sysfs.h>
 
index 233ea48b72c80c0cf8eb8329db451d4916af9ad7..2a7abf7a1f7fb9da3c672b6f860dfb42158600e3 100644 (file)
@@ -605,7 +605,7 @@ static void __trigger_tid_waiter(struct rvt_qp *qp)
  * to this call via first_qp().
  *
  * If the qp trigger was already scheduled (!rval)
- * the the reference is dropped, otherwise the resume
+ * the reference is dropped, otherwise the resume
  * or the destroy cancel will dispatch the reference.
  */
 static void tid_rdma_schedule_tid_wakeup(struct rvt_qp *qp)
@@ -5174,7 +5174,7 @@ bail_no_tx:
        priv->s_flags &= ~RVT_S_BUSY;
        /*
         * If we didn't get a txreq, the QP will be woken up later to try
-        * again, set the flags to the the wake up which work item to wake
+        * again, set the flags to the wake up which work item to wake
         * up.
         * (A better algorithm should be found to do this and generalize the
         * sleep/wakeup flags.)
index 715c81308b85cb43c435b4bc955eb2a7b6b85c1b..d9b5bbb2d0112de1e6f09cf0da00f7082578a1fe 100644 (file)
@@ -1,48 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0 or BSD-3-Clause
 /*
  * Copyright(c) 2015 - 2020 Intel Corporation.
- *
- * This file is provided under a dual BSD/GPLv2 license.  When using or
- * redistributing this file, you may do so under either license.
- *
- * GPL LICENSE SUMMARY
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * BSD LICENSE
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- *  - Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- *  - Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in
- *    the documentation and/or other materials provided with the
- *    distribution.
- *  - Neither the name of Intel Corporation nor the names of its
- *    contributors may be used to endorse or promote products derived
- *    from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
  */
 #define CREATE_TRACE_POINTS
 #include "trace.h"
index 1ce5518641180d0423c0d558a955915526e479e8..31e027c5a0c0d1c0421aa97df34da3d1c32cf6b6 100644 (file)
@@ -1,48 +1,6 @@
+/* SPDX-License-Identifier: GPL-2.0 or BSD-3-Clause */
 /*
  * Copyright(c) 2015 - 2018 Intel Corporation.
- *
- * This file is provided under a dual BSD/GPLv2 license.  When using or
- * redistributing this file, you may do so under either license.
- *
- * GPL LICENSE SUMMARY
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * BSD LICENSE
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- *  - Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- *  - Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in
- *    the documentation and/or other materials provided with the
- *    distribution.
- *  - Neither the name of Intel Corporation nor the names of its
- *    contributors may be used to endorse or promote products derived
- *    from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
  */
 
 #define packettype_name(etype) { RHF_RCV_TYPE_##etype, #etype }
index d8c168dc3ea89b1ac976a7ebe39822e1b43f94c5..1858eaf33b1882890900a81447220aa554188e8a 100644 (file)
@@ -1,49 +1,8 @@
+/* SPDX-License-Identifier: GPL-2.0 or BSD-3-Clause */
 /*
 * Copyright(c) 2015 - 2020 Intel Corporation.
-*
-* This file is provided under a dual BSD/GPLv2 license.  When using or
-* redistributing this file, you may do so under either license.
-*
-* GPL LICENSE SUMMARY
-*
-* This program is free software; you can redistribute it and/or modify
-* it under the terms of version 2 of the GNU General Public License as
-* published by the Free Software Foundation.
-*
-* This program is distributed in the hope that it will be useful, but
-* WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-* General Public License for more details.
-*
-* BSD LICENSE
-*
-* Redistribution and use in source and binary forms, with or without
-* modification, are permitted provided that the following conditions
-* are met:
-*
-*  - Redistributions of source code must retain the above copyright
-*    notice, this list of conditions and the following disclaimer.
-*  - Redistributions in binary form must reproduce the above copyright
-*    notice, this list of conditions and the following disclaimer in
-*    the documentation and/or other materials provided with the
-*    distribution.
-*  - Neither the name of Intel Corporation nor the names of its
-*    contributors may be used to endorse or promote products derived
-*    from this software without specific prior written permission.
-*
-* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*
 */
+
 #if !defined(__HFI1_TRACE_CTXTS_H) || defined(TRACE_HEADER_MULTI_READ)
 #define __HFI1_TRACE_CTXTS_H
 
index de7a87392b8d64c1b54c590d40694c0192831b38..707f1053f0b708b38bc363617b3085afbd80799e 100644 (file)
@@ -1,49 +1,8 @@
+/* SPDX-License-Identifier: GPL-2.0 or BSD-3-Clause */
 /*
 * Copyright(c) 2015 - 2018 Intel Corporation.
-*
-* This file is provided under a dual BSD/GPLv2 license.  When using or
-* redistributing this file, you may do so under either license.
-*
-* GPL LICENSE SUMMARY
-*
-* This program is free software; you can redistribute it and/or modify
-* it under the terms of version 2 of the GNU General Public License as
-* published by the Free Software Foundation.
-*
-* This program is distributed in the hope that it will be useful, but
-* WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-* General Public License for more details.
-*
-* BSD LICENSE
-*
-* Redistribution and use in source and binary forms, with or without
-* modification, are permitted provided that the following conditions
-* are met:
-*
-*  - Redistributions of source code must retain the above copyright
-*    notice, this list of conditions and the following disclaimer.
-*  - Redistributions in binary form must reproduce the above copyright
-*    notice, this list of conditions and the following disclaimer in
-*    the documentation and/or other materials provided with the
-*    distribution.
-*  - Neither the name of Intel Corporation nor the names of its
-*    contributors may be used to endorse or promote products derived
-*    from this software without specific prior written permission.
-*
-* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*
 */
+
 #if !defined(__HFI1_TRACE_EXTRA_H) || defined(TRACE_HEADER_MULTI_READ)
 #define __HFI1_TRACE_EXTRA_H
 
index 2f84290a88caff10c867f00b8bb5b6b414404a1d..b33f8f575f8a2b928c36f05d0f407e987efcb71e 100644 (file)
@@ -1,49 +1,8 @@
+/* SPDX-License-Identifier: GPL-2.0 or BSD-3-Clause */
 /*
  * Copyright(c) 2015 - 2017 Intel Corporation.
- *
- * This file is provided under a dual BSD/GPLv2 license.  When using or
- * redistributing this file, you may do so under either license.
- *
- * GPL LICENSE SUMMARY
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * BSD LICENSE
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- *  - Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- *  - Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in
- *    the documentation and/or other materials provided with the
- *    distribution.
- *  - Neither the name of Intel Corporation nor the names of its
- *    contributors may be used to endorse or promote products derived
- *    from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
  */
+
 #if !defined(__HFI1_TRACE_IBHDRS_H) || defined(TRACE_HEADER_MULTI_READ)
 #define __HFI1_TRACE_IBHDRS_H
 
index 93338988b9220dbe211bab76f3ff3958adb2eb0e..742675fa7576bb44811bfd4ccb7eec79c4f934c2 100644 (file)
@@ -1,49 +1,8 @@
+/* SPDX-License-Identifier: GPL-2.0 or BSD-3-Clause */
 /*
 * Copyright(c) 2015, 2016 Intel Corporation.
-*
-* This file is provided under a dual BSD/GPLv2 license.  When using or
-* redistributing this file, you may do so under either license.
-*
-* GPL LICENSE SUMMARY
-*
-* This program is free software; you can redistribute it and/or modify
-* it under the terms of version 2 of the GNU General Public License as
-* published by the Free Software Foundation.
-*
-* This program is distributed in the hope that it will be useful, but
-* WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-* General Public License for more details.
-*
-* BSD LICENSE
-*
-* Redistribution and use in source and binary forms, with or without
-* modification, are permitted provided that the following conditions
-* are met:
-*
-*  - Redistributions of source code must retain the above copyright
-*    notice, this list of conditions and the following disclaimer.
-*  - Redistributions in binary form must reproduce the above copyright
-*    notice, this list of conditions and the following disclaimer in
-*    the documentation and/or other materials provided with the
-*    distribution.
-*  - Neither the name of Intel Corporation nor the names of its
-*    contributors may be used to endorse or promote products derived
-*    from this software without specific prior written permission.
-*
-* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*
 */
+
 #if !defined(__HFI1_TRACE_MISC_H) || defined(TRACE_HEADER_MULTI_READ)
 #define __HFI1_TRACE_MISC_H
 
index 3b7abbc382c209d81ca742ae23b1fdda93da2fa8..187e9244fe5ed9c704c5ecb5e86f5d4e8d76be97 100644 (file)
@@ -1,49 +1,8 @@
+/* SPDX-License-Identifier: GPL-2.0 or BSD-3-Clause */
 /*
  * Copyright(c) 2017 Intel Corporation.
- *
- * This file is provided under a dual BSD/GPLv2 license.  When using or
- * redistributing this file, you may do so under either license.
- *
- * GPL LICENSE SUMMARY
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * BSD LICENSE
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- *  - Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- *  - Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in
- *    the documentation and/or other materials provided with the
- *    distribution.
- *  - Neither the name of Intel Corporation nor the names of its
- *    contributors may be used to endorse or promote products derived
- *    from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
  */
+
 #if !defined(__HFI1_TRACE_MMU_H) || defined(TRACE_HEADER_MULTI_READ)
 #define __HFI1_TRACE_MMU_H
 
index 5f49e1eeb2116b4c81334bd07150653e3746ffbc..7c3a1c77536d27be7e84a657b783ff959fb12f21 100644 (file)
@@ -1,49 +1,8 @@
+/* SPDX-License-Identifier: GPL-2.0 or BSD-3-Clause */
 /*
 * Copyright(c) 2015, 2016, 2017 Intel Corporation.
-*
-* This file is provided under a dual BSD/GPLv2 license.  When using or
-* redistributing this file, you may do so under either license.
-*
-* GPL LICENSE SUMMARY
-*
-* This program is free software; you can redistribute it and/or modify
-* it under the terms of version 2 of the GNU General Public License as
-* published by the Free Software Foundation.
-*
-* This program is distributed in the hope that it will be useful, but
-* WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-* General Public License for more details.
-*
-* BSD LICENSE
-*
-* Redistribution and use in source and binary forms, with or without
-* modification, are permitted provided that the following conditions
-* are met:
-*
-*  - Redistributions of source code must retain the above copyright
-*    notice, this list of conditions and the following disclaimer.
-*  - Redistributions in binary form must reproduce the above copyright
-*    notice, this list of conditions and the following disclaimer in
-*    the documentation and/or other materials provided with the
-*    distribution.
-*  - Neither the name of Intel Corporation nor the names of its
-*    contributors may be used to endorse or promote products derived
-*    from this software without specific prior written permission.
-*
-* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*
 */
+
 #if !defined(__HFI1_TRACE_RC_H) || defined(TRACE_HEADER_MULTI_READ)
 #define __HFI1_TRACE_RC_H
 
index 168079ed122ce4a41e3ce7ab00ddbaafcaaebc5d..0da22f9bc75e3f4d2272f7c65133a506799b5366 100644 (file)
@@ -1,49 +1,8 @@
+/* SPDX-License-Identifier: GPL-2.0 or BSD-3-Clause */
 /*
  * Copyright(c) 2015 - 2018 Intel Corporation.
- *
- * This file is provided under a dual BSD/GPLv2 license.  When using or
- * redistributing this file, you may do so under either license.
- *
- * GPL LICENSE SUMMARY
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * BSD LICENSE
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- *  - Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- *  - Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in
- *    the documentation and/or other materials provided with the
- *    distribution.
- *  - Neither the name of Intel Corporation nor the names of its
- *    contributors may be used to endorse or promote products derived
- *    from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
  */
+
 #if !defined(__HFI1_TRACE_RX_H) || defined(TRACE_HEADER_MULTI_READ)
 #define __HFI1_TRACE_RX_H
 
index f1922a7619fe87e45a03e48ba30c0b3a119eb6c8..7318aa6150b527b8559a44e8106679a9f21f7099 100644 (file)
@@ -1,48 +1,6 @@
+/* SPDX-License-Identifier: GPL-2.0 or BSD-3-Clause */
 /*
  * Copyright(c) 2015 - 2017 Intel Corporation.
- *
- * This file is provided under a dual BSD/GPLv2 license.  When using or
- * redistributing this file, you may do so under either license.
- *
- * GPL LICENSE SUMMARY
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * BSD LICENSE
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- *  - Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- *  - Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in
- *    the documentation and/or other materials provided with the
- *    distribution.
- *  - Neither the name of Intel Corporation nor the names of its
- *    contributors may be used to endorse or promote products derived
- *    from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
  */
 #if !defined(__HFI1_TRACE_TX_H) || defined(TRACE_HEADER_MULTI_READ)
 #define __HFI1_TRACE_TX_H
index 5b0f536b34e0c5bce43734a285ee9f5c5116211f..4e9d6aa39305bfb4ed1149e08c133fe1e54c702e 100644 (file)
@@ -1,48 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0 or BSD-3-Clause
 /*
  * Copyright(c) 2015 - 2018 Intel Corporation.
- *
- * This file is provided under a dual BSD/GPLv2 license.  When using or
- * redistributing this file, you may do so under either license.
- *
- * GPL LICENSE SUMMARY
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * BSD LICENSE
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- *  - Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- *  - Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in
- *    the documentation and/or other materials provided with the
- *    distribution.
- *  - Neither the name of Intel Corporation nor the names of its
- *    contributors may be used to endorse or promote products derived
- *    from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
  */
 
 #include "hfi.h"
index 6ecb984c85fac77915b061954659bb1cca003c52..b64b9d7e08f0ef685f6bb875d5653ae6c435f160 100644 (file)
@@ -1,48 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0 or BSD-3-Clause
 /*
  * Copyright(c) 2015 - 2019 Intel Corporation.
- *
- * This file is provided under a dual BSD/GPLv2 license.  When using or
- * redistributing this file, you may do so under either license.
- *
- * GPL LICENSE SUMMARY
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * BSD LICENSE
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- *  - Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- *  - Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in
- *    the documentation and/or other materials provided with the
- *    distribution.
- *  - Neither the name of Intel Corporation nor the names of its
- *    contributors may be used to endorse or promote products derived
- *    from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
  */
 
 #include <linux/net.h>
index 58dcab2679d9d9bb73ecaaedd46b5e22130266e3..0c86e9d354f8ea2e6c1c6cb6ab84c8c952cd9b7f 100644 (file)
@@ -1,49 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0 or BSD-3-Clause
 /*
  * Copyright(c) 2020 Cornelis Networks, Inc.
  * Copyright(c) 2015-2018 Intel Corporation.
- *
- * This file is provided under a dual BSD/GPLv2 license.  When using or
- * redistributing this file, you may do so under either license.
- *
- * GPL LICENSE SUMMARY
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * BSD LICENSE
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- *  - Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- *  - Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in
- *    the documentation and/or other materials provided with the
- *    distribution.
- *  - Neither the name of Intel Corporation nor the names of its
- *    contributors may be used to endorse or promote products derived
- *    from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
  */
 #include <asm/page.h>
 #include <linux/string.h>
@@ -177,8 +135,8 @@ static void unpin_rcv_pages(struct hfi1_filedata *fd,
        struct mm_struct *mm;
 
        if (mapped) {
-               pci_unmap_single(dd->pcidev, node->dma_addr,
-                                node->npages * PAGE_SIZE, PCI_DMA_FROMDEVICE);
+               dma_unmap_single(&dd->pcidev->dev, node->dma_addr,
+                                node->npages * PAGE_SIZE, DMA_FROM_DEVICE);
                pages = &node->pages[idx];
                mm = mm_from_tid_node(node);
        } else {
@@ -739,9 +697,8 @@ static int set_rcvarray_entry(struct hfi1_filedata *fd,
        if (!node)
                return -ENOMEM;
 
-       phys = pci_map_single(dd->pcidev,
-                             __va(page_to_phys(pages[0])),
-                             npages * PAGE_SIZE, PCI_DMA_FROMDEVICE);
+       phys = dma_map_single(&dd->pcidev->dev, __va(page_to_phys(pages[0])),
+                             npages * PAGE_SIZE, DMA_FROM_DEVICE);
        if (dma_mapping_error(&dd->pcidev->dev, phys)) {
                dd_dev_err(dd, "Failed to DMA map Exp Rcv pages 0x%llx\n",
                           phys);
@@ -783,8 +740,8 @@ out_unmap:
        hfi1_cdbg(TID, "Failed to insert RB node %u 0x%lx, 0x%lx %d",
                  node->rcventry, node->notifier.interval_tree.start,
                  node->phys, ret);
-       pci_unmap_single(dd->pcidev, phys, npages * PAGE_SIZE,
-                        PCI_DMA_FROMDEVICE);
+       dma_unmap_single(&dd->pcidev->dev, phys, npages * PAGE_SIZE,
+                        DMA_FROM_DEVICE);
        kfree(node);
        return -EFAULT;
 }
index d45c7b6988d4d56ec284669d97bc2415361f199b..8c53e416bf843cb662d5abab6e1ea03d11f5fc39 100644 (file)
@@ -1,53 +1,12 @@
-#ifndef _HFI1_USER_EXP_RCV_H
-#define _HFI1_USER_EXP_RCV_H
+/* SPDX-License-Identifier: GPL-2.0 or BSD-3-Clause */
 /*
  * Copyright(c) 2020 - Cornelis Networks, Inc.
  * Copyright(c) 2015 - 2017 Intel Corporation.
- *
- * This file is provided under a dual BSD/GPLv2 license.  When using or
- * redistributing this file, you may do so under either license.
- *
- * GPL LICENSE SUMMARY
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * BSD LICENSE
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- *  - Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- *  - Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in
- *    the documentation and/or other materials provided with the
- *    distribution.
- *  - Neither the name of Intel Corporation nor the names of its
- *    contributors may be used to endorse or promote products derived
- *    from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
  */
 
+#ifndef _HFI1_USER_EXP_RCV_H
+#define _HFI1_USER_EXP_RCV_H
+
 #include "hfi.h"
 #include "exp_rcv.h"
 
index 3b505006c0a65a6c3e93ecf86a7cca0979119753..7bce963e2ae69f9962eb5e007f5a0b6adf02d71e 100644 (file)
@@ -1,48 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0 or BSD-3-Clause
 /*
  * Copyright(c) 2015-2017 Intel Corporation.
- *
- * This file is provided under a dual BSD/GPLv2 license.  When using or
- * redistributing this file, you may do so under either license.
- *
- * GPL LICENSE SUMMARY
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * BSD LICENSE
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- *  - Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- *  - Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in
- *    the documentation and/or other materials provided with the
- *    distribution.
- *  - Neither the name of Intel Corporation nor the names of its
- *    contributors may be used to endorse or promote products derived
- *    from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
  */
 
 #include <linux/mm.h>
index da5b2e37355ab3e7327959bfd27111fb7084ce43..5b11c82827445ef2919848c75fb8eed41648888e 100644 (file)
@@ -1,50 +1,9 @@
+// SPDX-License-Identifier: GPL-2.0 or BSD-3-Clause
 /*
  * Copyright(c) 2020 - Cornelis Networks, Inc.
  * Copyright(c) 2015 - 2018 Intel Corporation.
- *
- * This file is provided under a dual BSD/GPLv2 license.  When using or
- * redistributing this file, you may do so under either license.
- *
- * GPL LICENSE SUMMARY
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * BSD LICENSE
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- *  - Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- *  - Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in
- *    the documentation and/or other materials provided with the
- *    distribution.
- *  - Neither the name of Intel Corporation nor the names of its
- *    contributors may be used to endorse or promote products derived
- *    from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
  */
+
 #include <linux/mm.h>
 #include <linux/types.h>
 #include <linux/device.h>
index fabe5813990684c15e7e8003c31877c4889d89c0..ea56eb57e65689c0c2836989146ce1577443569d 100644 (file)
@@ -1,52 +1,11 @@
-#ifndef _HFI1_USER_SDMA_H
-#define _HFI1_USER_SDMA_H
+/* SPDX-License-Identifier: GPL-2.0 or BSD-3-Clause */
 /*
  * Copyright(c) 2020 - Cornelis Networks, Inc.
  * Copyright(c) 2015 - 2018 Intel Corporation.
- *
- * This file is provided under a dual BSD/GPLv2 license.  When using or
- * redistributing this file, you may do so under either license.
- *
- * GPL LICENSE SUMMARY
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * BSD LICENSE
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- *  - Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- *  - Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in
- *    the documentation and/or other materials provided with the
- *    distribution.
- *  - Neither the name of Intel Corporation nor the names of its
- *    contributors may be used to endorse or promote products derived
- *    from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
  */
+#ifndef _HFI1_USER_SDMA_H
+#define _HFI1_USER_SDMA_H
+
 #include <linux/device.h>
 #include <linux/wait.h>
 
index 9b198c35e1a1af32b29d2dc8cc42733a5c35126d..26bea51869bf058e2d8fdecefd83962b20f97df7 100644 (file)
@@ -1,48 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0 or BSD-3-Clause
 /*
  * Copyright(c) 2015 - 2020 Intel Corporation.
- *
- * This file is provided under a dual BSD/GPLv2 license.  When using or
- * redistributing this file, you may do so under either license.
- *
- * GPL LICENSE SUMMARY
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * BSD LICENSE
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- *  - Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- *  - Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in
- *    the documentation and/or other materials provided with the
- *    distribution.
- *  - Neither the name of Intel Corporation nor the names of its
- *    contributors may be used to endorse or promote products derived
- *    from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
  */
 
 #include <rdma/ib_mad.h>
index 420df17cd1848b127fc81ea87f34d54fabf1d7bf..38565532d6542e674c4f9302163d3896d7db16c5 100644 (file)
@@ -1,48 +1,6 @@
+/* SPDX-License-Identifier: GPL-2.0 or BSD-3-Clause */
 /*
  * Copyright(c) 2015 - 2018 Intel Corporation.
- *
- * This file is provided under a dual BSD/GPLv2 license.  When using or
- * redistributing this file, you may do so under either license.
- *
- * GPL LICENSE SUMMARY
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * BSD LICENSE
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- *  - Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- *  - Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in
- *    the documentation and/or other materials provided with the
- *    distribution.
- *  - Neither the name of Intel Corporation nor the names of its
- *    contributors may be used to endorse or promote products derived
- *    from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
  */
 
 #ifndef HFI1_VERBS_H
index 8f766dd3f61c894e83ee6cdf7885fddab1c16125..cfecc81a27c7964c98939c476ad0ae7e8d6857a9 100644 (file)
@@ -1,48 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0 or BSD-3-Clause
 /*
  * Copyright(c) 2016 - 2018 Intel Corporation.
- *
- * This file is provided under a dual BSD/GPLv2 license.  When using or
- * redistributing this file, you may do so under either license.
- *
- * GPL LICENSE SUMMARY
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * BSD LICENSE
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- *  - Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- *  - Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in
- *    the documentation and/or other materials provided with the
- *    distribution.
- *  - Neither the name of Intel Corporation nor the names of its
- *    contributors may be used to endorse or promote products derived
- *    from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
  */
 
 #include "hfi.h"
index 4bdfc79323768d4819c226fd19c33ec2430f3b4d..2a7e0ae892e95dc748fcbb14221710862781ac9b 100644 (file)
@@ -1,48 +1,6 @@
+/* SPDX-License-Identifier: GPL-2.0 or BSD-3-Clause */
 /*
  * Copyright(c) 2016 - 2018 Intel Corporation.
- *
- * This file is provided under a dual BSD/GPLv2 license.  When using or
- * redistributing this file, you may do so under either license.
- *
- * GPL LICENSE SUMMARY
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * BSD LICENSE
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- *  - Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- *  - Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in
- *    the documentation and/or other materials provided with the
- *    distribution.
- *  - Neither the name of Intel Corporation nor the names of its
- *    contributors may be used to endorse or promote products derived
- *    from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
  */
 
 #ifndef HFI1_VERBS_TXREQ_H
index a7a450e2cf2cc0e8fed2c50186a3e974d422ebbd..34f03e7770becdea43ed567e9b2bbbfe8ac038a8 100644 (file)
@@ -1,52 +1,10 @@
-#ifndef _HFI1_VNIC_H
-#define _HFI1_VNIC_H
+/* SPDX-License-Identifier: GPL-2.0 or BSD-3-Clause */
 /*
  * Copyright(c) 2017 - 2020 Intel Corporation.
- *
- * This file is provided under a dual BSD/GPLv2 license.  When using or
- * redistributing this file, you may do so under either license.
- *
- * GPL LICENSE SUMMARY
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * BSD LICENSE
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- *  - Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- *  - Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in
- *    the documentation and/or other materials provided with the
- *    distribution.
- *  - Neither the name of Intel Corporation nor the names of its
- *    contributors may be used to endorse or promote products derived
- *    from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
  */
 
+#ifndef _HFI1_VNIC_H
+#define _HFI1_VNIC_H
 #include <rdma/opa_vnic.h>
 #include "hfi.h"
 #include "sdma.h"
index 7e79c0578ecf3478368ac1f2d8981470b8221745..3650fababf251a2824b2ba447ada441ec260e4eb 100644 (file)
@@ -1,48 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0 or BSD-3-Clause
 /*
  * Copyright(c) 2017 - 2020 Intel Corporation.
- *
- * This file is provided under a dual BSD/GPLv2 license.  When using or
- * redistributing this file, you may do so under either license.
- *
- * GPL LICENSE SUMMARY
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * BSD LICENSE
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- *  - Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- *  - Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in
- *    the documentation and/or other materials provided with the
- *    distribution.
- *  - Neither the name of Intel Corporation nor the names of its
- *    contributors may be used to endorse or promote products derived
- *    from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
  */
 
 /*
index 7d90b900131ba23fe4337ebe0c5e2ca2d3aa7192..c3f0f8d877c37049dd5d8265677572f22af1920b 100644 (file)
@@ -1,48 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0 or BSD-3-Clause
 /*
  * Copyright(c) 2017 - 2018 Intel Corporation.
- *
- * This file is provided under a dual BSD/GPLv2 license.  When using or
- * redistributing this file, you may do so under either license.
- *
- * GPL LICENSE SUMMARY
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * BSD LICENSE
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- *  - Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- *  - Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in
- *    the documentation and/or other materials provided with the
- *    distribution.
- *  - Neither the name of Intel Corporation nor the names of its
- *    contributors may be used to endorse or promote products derived
- *    from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
  */
 
 /*
index 1b02d3bc9bae2d218b92e88eb0f573f7ad7799c4..d4fa0fd522946ed830e1293b825d2ba0f3956dd9 100644 (file)
 #include "hns_roce_device.h"
 #include <rdma/ib_umem.h>
 
-int hns_roce_bitmap_alloc(struct hns_roce_bitmap *bitmap, unsigned long *obj)
-{
-       int ret = 0;
-
-       spin_lock(&bitmap->lock);
-       *obj = find_next_zero_bit(bitmap->table, bitmap->max, bitmap->last);
-       if (*obj >= bitmap->max) {
-               bitmap->top = (bitmap->top + bitmap->max + bitmap->reserved_top)
-                              & bitmap->mask;
-               *obj = find_first_zero_bit(bitmap->table, bitmap->max);
-       }
-
-       if (*obj < bitmap->max) {
-               set_bit(*obj, bitmap->table);
-               bitmap->last = (*obj + 1);
-               if (bitmap->last == bitmap->max)
-                       bitmap->last = 0;
-               *obj |= bitmap->top;
-       } else {
-               ret = -EINVAL;
-       }
-
-       spin_unlock(&bitmap->lock);
-
-       return ret;
-}
-
-void hns_roce_bitmap_free(struct hns_roce_bitmap *bitmap, unsigned long obj)
-{
-       obj &= bitmap->max + bitmap->reserved_top - 1;
-
-       spin_lock(&bitmap->lock);
-       clear_bit(obj, bitmap->table);
-
-       bitmap->last = min(bitmap->last, obj);
-       bitmap->top = (bitmap->top + bitmap->max + bitmap->reserved_top)
-                      & bitmap->mask;
-       spin_unlock(&bitmap->lock);
-}
-
-int hns_roce_bitmap_init(struct hns_roce_bitmap *bitmap, u32 num, u32 mask,
-                        u32 reserved_bot, u32 reserved_top)
-{
-       u32 i;
-
-       if (num != roundup_pow_of_two(num))
-               return -EINVAL;
-
-       bitmap->last = 0;
-       bitmap->top = 0;
-       bitmap->max = num - reserved_top;
-       bitmap->mask = mask;
-       bitmap->reserved_top = reserved_top;
-       spin_lock_init(&bitmap->lock);
-       bitmap->table = kcalloc(BITS_TO_LONGS(bitmap->max), sizeof(long),
-                               GFP_KERNEL);
-       if (!bitmap->table)
-               return -ENOMEM;
-
-       for (i = 0; i < reserved_bot; ++i)
-               set_bit(i, bitmap->table);
-
-       return 0;
-}
-
-void hns_roce_bitmap_cleanup(struct hns_roce_bitmap *bitmap)
-{
-       kfree(bitmap->table);
-}
-
 void hns_roce_buf_free(struct hns_roce_dev *hr_dev, struct hns_roce_buf *buf)
 {
        struct hns_roce_buf_list *trunks;
@@ -248,10 +178,10 @@ void hns_roce_cleanup_bitmap(struct hns_roce_dev *hr_dev)
                ida_destroy(&hr_dev->xrcd_ida.ida);
 
        if (hr_dev->caps.flags & HNS_ROCE_CAP_FLAG_SRQ)
-               hns_roce_cleanup_srq_table(hr_dev);
+               ida_destroy(&hr_dev->srq_table.srq_ida.ida);
        hns_roce_cleanup_qp_table(hr_dev);
        hns_roce_cleanup_cq_table(hr_dev);
        ida_destroy(&hr_dev->mr_table.mtpt_ida.ida);
        ida_destroy(&hr_dev->pd_ida.ida);
-       hns_roce_cleanup_uar_table(hr_dev);
+       ida_destroy(&hr_dev->uar_ida.ida);
 }
index 991f65269fa61696d0ee500078e594135f54a781..9467c39e3d2884021243ddba3aa305ad9494670d 100644 (file)
@@ -496,6 +496,12 @@ struct hns_roce_bank {
        u32 next; /* Next ID to allocate. */
 };
 
+struct hns_roce_idx_table {
+       u32 *spare_idx;
+       u32 head;
+       u32 tail;
+};
+
 struct hns_roce_qp_table {
        struct hns_roce_hem_table       qp_table;
        struct hns_roce_hem_table       irrl_table;
@@ -504,6 +510,7 @@ struct hns_roce_qp_table {
        struct mutex                    scc_mutex;
        struct hns_roce_bank bank[HNS_ROCE_QP_BANK_NUM];
        struct mutex bank_mutex;
+       struct hns_roce_idx_table       idx_table;
 };
 
 struct hns_roce_cq_table {
@@ -514,7 +521,7 @@ struct hns_roce_cq_table {
 };
 
 struct hns_roce_srq_table {
-       struct hns_roce_bitmap          bitmap;
+       struct hns_roce_ida             srq_ida;
        struct xarray                   xa;
        struct hns_roce_hem_table       table;
 };
@@ -963,7 +970,7 @@ struct hns_roce_dev {
        struct hns_roce_cmdq    cmd;
        struct hns_roce_ida pd_ida;
        struct hns_roce_ida xrcd_ida;
-       struct hns_roce_uar_table uar_table;
+       struct hns_roce_ida uar_ida;
        struct hns_roce_mr_table  mr_table;
        struct hns_roce_cq_table  cq_table;
        struct hns_roce_srq_table srq_table;
@@ -1118,10 +1125,8 @@ static inline u8 get_tclass(const struct ib_global_route *grh)
               grh->traffic_class >> DSCP_SHIFT : grh->traffic_class;
 }
 
-int hns_roce_init_uar_table(struct hns_roce_dev *dev);
+void hns_roce_init_uar_table(struct hns_roce_dev *dev);
 int hns_roce_uar_alloc(struct hns_roce_dev *dev, struct hns_roce_uar *uar);
-void hns_roce_uar_free(struct hns_roce_dev *dev, struct hns_roce_uar *uar);
-void hns_roce_cleanup_uar_table(struct hns_roce_dev *dev);
 
 int hns_roce_cmd_init(struct hns_roce_dev *hr_dev);
 void hns_roce_cmd_cleanup(struct hns_roce_dev *hr_dev);
@@ -1146,20 +1151,14 @@ int hns_roce_mtr_map(struct hns_roce_dev *hr_dev, struct hns_roce_mtr *mtr,
 void hns_roce_init_pd_table(struct hns_roce_dev *hr_dev);
 void hns_roce_init_mr_table(struct hns_roce_dev *hr_dev);
 void hns_roce_init_cq_table(struct hns_roce_dev *hr_dev);
-void hns_roce_init_qp_table(struct hns_roce_dev *hr_dev);
-int hns_roce_init_srq_table(struct hns_roce_dev *hr_dev);
+int hns_roce_init_qp_table(struct hns_roce_dev *hr_dev);
+void hns_roce_init_srq_table(struct hns_roce_dev *hr_dev);
 void hns_roce_init_xrcd_table(struct hns_roce_dev *hr_dev);
 
 void hns_roce_cleanup_eq_table(struct hns_roce_dev *hr_dev);
 void hns_roce_cleanup_cq_table(struct hns_roce_dev *hr_dev);
 void hns_roce_cleanup_qp_table(struct hns_roce_dev *hr_dev);
-void hns_roce_cleanup_srq_table(struct hns_roce_dev *hr_dev);
 
-int hns_roce_bitmap_alloc(struct hns_roce_bitmap *bitmap, unsigned long *obj);
-void hns_roce_bitmap_free(struct hns_roce_bitmap *bitmap, unsigned long obj);
-int hns_roce_bitmap_init(struct hns_roce_bitmap *bitmap, u32 num, u32 mask,
-                        u32 reserved_bot, u32 resetrved_top);
-void hns_roce_bitmap_cleanup(struct hns_roce_bitmap *bitmap);
 void hns_roce_cleanup_bitmap(struct hns_roce_dev *hr_dev);
 
 int hns_roce_create_ah(struct ib_ah *ah, struct rdma_ah_init_attr *init_attr,
@@ -1216,9 +1215,8 @@ int hns_roce_destroy_srq(struct ib_srq *ibsrq, struct ib_udata *udata);
 int hns_roce_alloc_xrcd(struct ib_xrcd *ib_xrcd, struct ib_udata *udata);
 int hns_roce_dealloc_xrcd(struct ib_xrcd *ib_xrcd, struct ib_udata *udata);
 
-struct ib_qp *hns_roce_create_qp(struct ib_pd *ib_pd,
-                                struct ib_qp_init_attr *init_attr,
-                                struct ib_udata *udata);
+int hns_roce_create_qp(struct ib_qp *ib_qp, struct ib_qp_init_attr *init_attr,
+                      struct ib_udata *udata);
 int hns_roce_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr,
                       int attr_mask, struct ib_udata *udata);
 void init_flush_work(struct hns_roce_dev *hr_dev, struct hns_roce_qp *hr_qp);
index a3305d196675a4b03337427aed462d418d1f67b3..e0f59b8d7d5d6d3e98496eb5eff17743244a72b8 100644 (file)
@@ -758,7 +758,7 @@ static struct hns_roce_qp *hns_roce_v1_create_lp_qp(struct hns_roce_dev *hr_dev,
        init_attr.cap.max_recv_wr       = HNS_ROCE_MIN_WQE_NUM;
        init_attr.cap.max_send_wr       = HNS_ROCE_MIN_WQE_NUM;
 
-       qp = hns_roce_create_qp(pd, &init_attr, NULL);
+       qp = ib_create_qp(pd, &init_attr);
        if (IS_ERR(qp)) {
                dev_err(dev, "Create loop qp for mr free failed!");
                return NULL;
@@ -923,7 +923,7 @@ static int hns_roce_v1_rsv_lp_qp(struct hns_roce_dev *hr_dev)
 create_lp_qp_failed:
        for (i -= 1; i >= 0; i--) {
                hr_qp = free_mr->mr_free_qp[i];
-               if (hns_roce_v1_destroy_qp(&hr_qp->ibqp, NULL))
+               if (ib_destroy_qp(&hr_qp->ibqp))
                        dev_err(dev, "Destroy qp %d for mr free failed!\n", i);
        }
 
@@ -953,7 +953,7 @@ static void hns_roce_v1_release_lp_qp(struct hns_roce_dev *hr_dev)
                if (!hr_qp)
                        continue;
 
-               ret = hns_roce_v1_destroy_qp(&hr_qp->ibqp, NULL);
+               ret = ib_destroy_qp(&hr_qp->ibqp);
                if (ret)
                        dev_err(dev, "Destroy qp %d for mr free failed(%d)!\n",
                                i, ret);
index 594d4cef31b362d7a5e55dc4a5a4383c12a72f51..5b9953105752c397ac2cacdce4e7eaaf8a993387 100644 (file)
@@ -1248,8 +1248,7 @@ static void hns_roce_cmq_setup_basic_desc(struct hns_roce_cmq_desc *desc,
 {
        memset((void *)desc, 0, sizeof(struct hns_roce_cmq_desc));
        desc->opcode = cpu_to_le16(opcode);
-       desc->flag =
-               cpu_to_le16(HNS_ROCE_CMD_FLAG_NO_INTR | HNS_ROCE_CMD_FLAG_IN);
+       desc->flag = cpu_to_le16(HNS_ROCE_CMD_FLAG_IN);
        if (is_read)
                desc->flag |= cpu_to_le16(HNS_ROCE_CMD_FLAG_WR);
        else
@@ -1288,16 +1287,11 @@ static int __hns_roce_cmq_send(struct hns_roce_dev *hr_dev,
        /* Write to hardware */
        roce_write(hr_dev, ROCEE_TX_CMQ_PI_REG, csq->head);
 
-       /* If the command is sync, wait for the firmware to write back,
-        * if multi descriptors to be sent, use the first one to check
-        */
-       if (le16_to_cpu(desc->flag) & HNS_ROCE_CMD_FLAG_NO_INTR) {
-               do {
-                       if (hns_roce_cmq_csq_done(hr_dev))
-                               break;
-                       udelay(1);
-               } while (++timeout < priv->cmq.tx_timeout);
-       }
+       do {
+               if (hns_roce_cmq_csq_done(hr_dev))
+                       break;
+               udelay(1);
+       } while (++timeout < priv->cmq.tx_timeout);
 
        if (hns_roce_cmq_csq_done(hr_dev)) {
                for (ret = 0, i = 0; i < num; i++) {
@@ -1761,8 +1755,7 @@ static int __hns_roce_set_vf_switch_param(struct hns_roce_dev *hr_dev,
        if (ret)
                return ret;
 
-       desc.flag =
-               cpu_to_le16(HNS_ROCE_CMD_FLAG_NO_INTR | HNS_ROCE_CMD_FLAG_IN);
+       desc.flag = cpu_to_le16(HNS_ROCE_CMD_FLAG_IN);
        desc.flag &= cpu_to_le16(~HNS_ROCE_CMD_FLAG_WR);
        roce_set_bit(swt->cfg, VF_SWITCH_DATA_CFG_ALW_LPBK_S, 1);
        roce_set_bit(swt->cfg, VF_SWITCH_DATA_CFG_ALW_LCL_LPBK_S, 0);
@@ -2004,6 +1997,7 @@ static void set_default_caps(struct hns_roce_dev *hr_dev)
        caps->gid_table_len[0] = HNS_ROCE_V2_GID_INDEX_NUM;
 
        if (hr_dev->pci_dev->revision >= PCI_REVISION_ID_HIP09) {
+               caps->flags |= HNS_ROCE_CAP_FLAG_STASH;
                caps->max_sq_inline = HNS_ROCE_V3_MAX_SQ_INLINE;
        } else {
                caps->max_sq_inline = HNS_ROCE_V2_MAX_SQ_INLINE;
@@ -4114,6 +4108,9 @@ static void modify_qp_reset_to_init(struct ib_qp *ibqp,
        if (hr_qp->en_flags & HNS_ROCE_QP_CAP_RQ_RECORD_DB)
                hr_reg_enable(context, QPC_RQ_RECORD_EN);
 
+       if (hr_qp->en_flags & HNS_ROCE_QP_CAP_OWNER_DB)
+               hr_reg_enable(context, QPC_OWNER_MODE);
+
        hr_reg_write(context, QPC_RQ_DB_RECORD_ADDR_L,
                     lower_32_bits(hr_qp->rdb.dma) >> 1);
        hr_reg_write(context, QPC_RQ_DB_RECORD_ADDR_H,
@@ -4146,8 +4143,6 @@ static void modify_qp_init_to_init(struct ib_qp *ibqp,
                                   struct hns_roce_v2_qp_context *context,
                                   struct hns_roce_v2_qp_context *qpc_mask)
 {
-       struct hns_roce_qp *hr_qp = to_hr_qp(ibqp);
-
        /*
         * In v2 engine, software pass context and context mask to hardware
         * when modifying qp. If software need modify some fields in context,
@@ -4172,11 +4167,6 @@ static void modify_qp_init_to_init(struct ib_qp *ibqp,
                hr_reg_write(context, QPC_SRQN, to_hr_srq(ibqp->srq)->srqn);
                hr_reg_clear(qpc_mask, QPC_SRQN);
        }
-
-       if (attr_mask & IB_QP_DEST_QPN) {
-               hr_reg_write(context, QPC_DQPN, hr_qp->qpn);
-               hr_reg_clear(qpc_mask, QPC_DQPN);
-       }
 }
 
 static int config_qp_rq_buf(struct hns_roce_dev *hr_dev,
@@ -4486,9 +4476,6 @@ static int modify_qp_rtr_to_rts(struct ib_qp *ibqp,
 
        hr_reg_clear(qpc_mask, QPC_CHECK_FLG);
 
-       hr_reg_write(context, QPC_LSN, 0x100);
-       hr_reg_clear(qpc_mask, QPC_LSN);
-
        hr_reg_clear(qpc_mask, QPC_V2_IRRL_HEAD);
 
        return 0;
@@ -4507,15 +4494,23 @@ static int get_dip_ctx_idx(struct ib_qp *ibqp, const struct ib_qp_attr *attr,
 {
        const struct ib_global_route *grh = rdma_ah_read_grh(&attr->ah_attr);
        struct hns_roce_dev *hr_dev = to_hr_dev(ibqp->device);
+       u32 *spare_idx = hr_dev->qp_table.idx_table.spare_idx;
+       u32 *head =  &hr_dev->qp_table.idx_table.head;
+       u32 *tail =  &hr_dev->qp_table.idx_table.tail;
        struct hns_roce_dip *hr_dip;
        unsigned long flags;
        int ret = 0;
 
        spin_lock_irqsave(&hr_dev->dip_list_lock, flags);
 
+       spare_idx[*tail] = ibqp->qp_num;
+       *tail = (*tail == hr_dev->caps.num_qps - 1) ? 0 : (*tail + 1);
+
        list_for_each_entry(hr_dip, &hr_dev->dip_list, node) {
-               if (!memcmp(grh->dgid.raw, hr_dip->dgid, 16))
+               if (!memcmp(grh->dgid.raw, hr_dip->dgid, 16)) {
+                       *dip_idx = hr_dip->dip_idx;
                        goto out;
+               }
        }
 
        /* If no dgid is found, a new dip and a mapping between dgid and
@@ -4528,7 +4523,8 @@ static int get_dip_ctx_idx(struct ib_qp *ibqp, const struct ib_qp_attr *attr,
        }
 
        memcpy(hr_dip->dgid, grh->dgid.raw, sizeof(grh->dgid.raw));
-       hr_dip->dip_idx = *dip_idx = ibqp->qp_num;
+       hr_dip->dip_idx = *dip_idx = spare_idx[*head];
+       *head = (*head == hr_dev->caps.num_qps - 1) ? 0 : (*head + 1);
        list_add_tail(&hr_dip->node, &hr_dev->dip_list);
 
 out:
@@ -5127,7 +5123,7 @@ static int hns_roce_v2_query_qp(struct ib_qp *ibqp, struct ib_qp_attr *qp_attr,
 
        qp_attr->rq_psn = hr_reg_read(&context, QPC_RX_REQ_EPSN);
        qp_attr->sq_psn = (u32)hr_reg_read(&context, QPC_SQ_CUR_PSN);
-       qp_attr->dest_qp_num = (u8)hr_reg_read(&context, QPC_DQPN);
+       qp_attr->dest_qp_num = hr_reg_read(&context, QPC_DQPN);
        qp_attr->qp_access_flags =
                ((hr_reg_read(&context, QPC_RRE)) << V2_QP_RRE_S) |
                ((hr_reg_read(&context, QPC_RWE)) << V2_QP_RWE_S) |
@@ -5224,7 +5220,6 @@ static int hns_roce_v2_destroy_qp_common(struct hns_roce_dev *hr_dev,
 
                if (send_cq && send_cq != recv_cq)
                        __hns_roce_v2_cq_clean(send_cq, hr_qp->qpn, NULL);
-
        }
 
        hns_roce_qp_remove(hr_dev, hr_qp);
@@ -6118,35 +6113,32 @@ static int hns_roce_v2_init_eq_table(struct hns_roce_dev *hr_dev)
 
                ret = hns_roce_v2_create_eq(hr_dev, eq, eq_cmd);
                if (ret) {
-                       dev_err(dev, "eq create failed.\n");
+                       dev_err(dev, "failed to create eq.\n");
                        goto err_create_eq_fail;
                }
        }
 
-       /* enable irq */
-       hns_roce_v2_int_mask_enable(hr_dev, eq_num, EQ_ENABLE);
+       hr_dev->irq_workq = alloc_ordered_workqueue("hns_roce_irq_workq", 0);
+       if (!hr_dev->irq_workq) {
+               dev_err(dev, "failed to create irq workqueue.\n");
+               ret = -ENOMEM;
+               goto err_create_eq_fail;
+       }
 
-       ret = __hns_roce_request_irq(hr_dev, irq_num, comp_num,
-                                    aeq_num, other_num);
+       ret = __hns_roce_request_irq(hr_dev, irq_num, comp_num, aeq_num,
+                                    other_num);
        if (ret) {
-               dev_err(dev, "Request irq failed.\n");
+               dev_err(dev, "failed to request irq.\n");
                goto err_request_irq_fail;
        }
 
-       hr_dev->irq_workq = alloc_ordered_workqueue("hns_roce_irq_workq", 0);
-       if (!hr_dev->irq_workq) {
-               dev_err(dev, "Create irq workqueue failed!\n");
-               ret = -ENOMEM;
-               goto err_create_wq_fail;
-       }
+       /* enable irq */
+       hns_roce_v2_int_mask_enable(hr_dev, eq_num, EQ_ENABLE);
 
        return 0;
 
-err_create_wq_fail:
-       __hns_roce_free_irq(hr_dev);
-
 err_request_irq_fail:
-       hns_roce_v2_int_mask_enable(hr_dev, eq_num, EQ_DISABLE);
+       destroy_workqueue(hr_dev->irq_workq);
 
 err_create_eq_fail:
        for (i -= 1; i >= 0; i--)
@@ -6367,7 +6359,6 @@ static int hns_roce_hw_v2_init_instance(struct hnae3_handle *handle)
 
        handle->rinfo.instance_state = HNS_ROCE_STATE_INITED;
 
-
        return 0;
 
 reset_chk_err:
index b8a09d411e2e51c609ab8b6a075767215f8a3ec8..4d904d5e82be4efb7efb7b91b4dc656e00535b41 100644 (file)
 
 #define HNS_ROCE_V2_TABLE_CHUNK_SIZE           (1 << 18)
 
-#define HNS_ROCE_CMD_FLAG_IN_VALID_SHIFT       0
-#define HNS_ROCE_CMD_FLAG_OUT_VALID_SHIFT      1
-#define HNS_ROCE_CMD_FLAG_NEXT_SHIFT           2
-#define HNS_ROCE_CMD_FLAG_WR_OR_RD_SHIFT       3
-#define HNS_ROCE_CMD_FLAG_NO_INTR_SHIFT                4
-#define HNS_ROCE_CMD_FLAG_ERR_INTR_SHIFT       5
-
-#define HNS_ROCE_CMD_FLAG_IN           BIT(HNS_ROCE_CMD_FLAG_IN_VALID_SHIFT)
-#define HNS_ROCE_CMD_FLAG_OUT          BIT(HNS_ROCE_CMD_FLAG_OUT_VALID_SHIFT)
-#define HNS_ROCE_CMD_FLAG_NEXT         BIT(HNS_ROCE_CMD_FLAG_NEXT_SHIFT)
-#define HNS_ROCE_CMD_FLAG_WR           BIT(HNS_ROCE_CMD_FLAG_WR_OR_RD_SHIFT)
-#define HNS_ROCE_CMD_FLAG_NO_INTR      BIT(HNS_ROCE_CMD_FLAG_NO_INTR_SHIFT)
-#define HNS_ROCE_CMD_FLAG_ERR_INTR     BIT(HNS_ROCE_CMD_FLAG_ERR_INTR_SHIFT)
+enum {
+       HNS_ROCE_CMD_FLAG_IN = BIT(0),
+       HNS_ROCE_CMD_FLAG_OUT = BIT(1),
+       HNS_ROCE_CMD_FLAG_NEXT = BIT(2),
+       HNS_ROCE_CMD_FLAG_WR = BIT(3),
+       HNS_ROCE_CMD_FLAG_ERR_INTR = BIT(5),
+};
 
 #define HNS_ROCE_CMQ_DESC_NUM_S                3
 
@@ -1413,7 +1407,6 @@ struct hns_roce_cmq_desc {
                        __le32 rsv[4];
                } func_info;
        };
-
 };
 
 struct hns_roce_v2_cmq_ring {
@@ -1447,7 +1440,7 @@ struct hns_roce_v2_priv {
 
 struct hns_roce_dip {
        u8 dgid[GID_LEN_V2];
-       u8 dip_idx;
+       u32 dip_idx;
        struct list_head node;  /* all dips are on a list */
 };
 
index cc6eab14a2220d0ea607fad8902a7db7764d2108..5d39bd08582afda61b12579d2460fa59b5f77d61 100644 (file)
@@ -325,7 +325,7 @@ static int hns_roce_alloc_ucontext(struct ib_ucontext *uctx,
        return 0;
 
 error_fail_copy_to_udata:
-       hns_roce_uar_free(hr_dev, &context->uar);
+       ida_free(&hr_dev->uar_ida.ida, (int)context->uar.logic_idx);
 
 error_fail_uar_alloc:
        return ret;
@@ -334,8 +334,9 @@ error_fail_uar_alloc:
 static void hns_roce_dealloc_ucontext(struct ib_ucontext *ibcontext)
 {
        struct hns_roce_ucontext *context = to_hr_ucontext(ibcontext);
+       struct hns_roce_dev *hr_dev = to_hr_dev(ibcontext->device);
 
-       hns_roce_uar_free(to_hr_dev(ibcontext->device), &context->uar);
+       ida_free(&hr_dev->uar_ida.ida, (int)context->uar.logic_idx);
 }
 
 static int hns_roce_mmap(struct ib_ucontext *context,
@@ -454,6 +455,7 @@ static const struct ib_device_ops hns_roce_dev_ops = {
        INIT_RDMA_OBJ_SIZE(ib_ah, hns_roce_ah, ibah),
        INIT_RDMA_OBJ_SIZE(ib_cq, hns_roce_cq, ib_cq),
        INIT_RDMA_OBJ_SIZE(ib_pd, hns_roce_pd, ibpd),
+       INIT_RDMA_OBJ_SIZE(ib_qp, hns_roce_qp, ibqp),
        INIT_RDMA_OBJ_SIZE(ib_ucontext, hns_roce_ucontext, ibucontext),
 };
 
@@ -736,11 +738,7 @@ static int hns_roce_setup_hca(struct hns_roce_dev *hr_dev)
                mutex_init(&hr_dev->pgdir_mutex);
        }
 
-       ret = hns_roce_init_uar_table(hr_dev);
-       if (ret) {
-               dev_err(dev, "Failed to initialize uar table. aborting\n");
-               return ret;
-       }
+       hns_roce_init_uar_table(hr_dev);
 
        ret = hns_roce_uar_alloc(hr_dev, &hr_dev->priv_uar);
        if (ret) {
@@ -748,6 +746,12 @@ static int hns_roce_setup_hca(struct hns_roce_dev *hr_dev)
                goto err_uar_table_free;
        }
 
+       ret = hns_roce_init_qp_table(hr_dev);
+       if (ret) {
+               dev_err(dev, "Failed to init qp_table.\n");
+               goto err_uar_table_free;
+       }
+
        hns_roce_init_pd_table(hr_dev);
 
        if (hr_dev->caps.flags & HNS_ROCE_CAP_FLAG_XRC)
@@ -757,32 +761,14 @@ static int hns_roce_setup_hca(struct hns_roce_dev *hr_dev)
 
        hns_roce_init_cq_table(hr_dev);
 
-       hns_roce_init_qp_table(hr_dev);
-
        if (hr_dev->caps.flags & HNS_ROCE_CAP_FLAG_SRQ) {
-               ret = hns_roce_init_srq_table(hr_dev);
-               if (ret) {
-                       dev_err(dev,
-                               "Failed to init share receive queue table.\n");
-                       goto err_qp_table_free;
-               }
+               hns_roce_init_srq_table(hr_dev);
        }
 
        return 0;
 
-err_qp_table_free:
-       hns_roce_cleanup_qp_table(hr_dev);
-       hns_roce_cleanup_cq_table(hr_dev);
-       ida_destroy(&hr_dev->mr_table.mtpt_ida.ida);
-
-       if (hr_dev->caps.flags & HNS_ROCE_CAP_FLAG_XRC)
-               ida_destroy(&hr_dev->xrcd_ida.ida);
-
-       ida_destroy(&hr_dev->pd_ida.ida);
-       hns_roce_uar_free(hr_dev, &hr_dev->priv_uar);
-
 err_uar_table_free:
-       hns_roce_cleanup_uar_table(hr_dev);
+       ida_destroy(&hr_dev->uar_ida.ida);
        return ret;
 }
 
index 006c84bb3f9fd83c72de4775760938cbd63b4c87..7089ac780291340e6ef51eb41174a5119a2d2464 100644 (file)
@@ -352,7 +352,9 @@ struct ib_mr *hns_roce_rereg_user_mr(struct ib_mr *ibmr, int flags, u64 start,
 free_cmd_mbox:
        hns_roce_free_cmd_mailbox(hr_dev, mailbox);
 
-       return ERR_PTR(ret);
+       if (ret)
+               return ERR_PTR(ret);
+       return NULL;
 }
 
 int hns_roce_dereg_mr(struct ib_mr *ibmr, struct ib_udata *udata)
index ea566363098564fa4bc3ec9412cfd5ea6d980f4d..81ffad77ae420b9ec3a8c19ed09bb9e8a2f410fa 100644 (file)
@@ -85,13 +85,18 @@ int hns_roce_dealloc_pd(struct ib_pd *pd, struct ib_udata *udata)
 
 int hns_roce_uar_alloc(struct hns_roce_dev *hr_dev, struct hns_roce_uar *uar)
 {
+       struct hns_roce_ida *uar_ida = &hr_dev->uar_ida;
        struct resource *res;
-       int ret;
+       int id;
 
        /* Using bitmap to manager UAR index */
-       ret = hns_roce_bitmap_alloc(&hr_dev->uar_table.bitmap, &uar->logic_idx);
-       if (ret)
+       id = ida_alloc_range(&uar_ida->ida, uar_ida->min, uar_ida->max,
+                            GFP_KERNEL);
+       if (id < 0) {
+               ibdev_err(&hr_dev->ib_dev, "failed to alloc uar id(%d).\n", id);
                return -ENOMEM;
+       }
+       uar->logic_idx = (unsigned long)id;
 
        if (uar->logic_idx > 0 && hr_dev->caps.phy_num_uars > 1)
                uar->index = (uar->logic_idx - 1) %
@@ -102,6 +107,7 @@ int hns_roce_uar_alloc(struct hns_roce_dev *hr_dev, struct hns_roce_uar *uar)
        if (!dev_is_pci(hr_dev->dev)) {
                res = platform_get_resource(hr_dev->pdev, IORESOURCE_MEM, 0);
                if (!res) {
+                       ida_free(&uar_ida->ida, id);
                        dev_err(&hr_dev->pdev->dev, "memory resource not found!\n");
                        return -EINVAL;
                }
@@ -114,22 +120,13 @@ int hns_roce_uar_alloc(struct hns_roce_dev *hr_dev, struct hns_roce_uar *uar)
        return 0;
 }
 
-void hns_roce_uar_free(struct hns_roce_dev *hr_dev, struct hns_roce_uar *uar)
+void hns_roce_init_uar_table(struct hns_roce_dev *hr_dev)
 {
-       hns_roce_bitmap_free(&hr_dev->uar_table.bitmap, uar->logic_idx);
-}
+       struct hns_roce_ida *uar_ida = &hr_dev->uar_ida;
 
-int hns_roce_init_uar_table(struct hns_roce_dev *hr_dev)
-{
-       return hns_roce_bitmap_init(&hr_dev->uar_table.bitmap,
-                                   hr_dev->caps.num_uars,
-                                   hr_dev->caps.num_uars - 1,
-                                   hr_dev->caps.reserved_uars, 0);
-}
-
-void hns_roce_cleanup_uar_table(struct hns_roce_dev *hr_dev)
-{
-       hns_roce_bitmap_cleanup(&hr_dev->uar_table.bitmap);
+       ida_init(&uar_ida->ida);
+       uar_ida->max = hr_dev->caps.num_uars - 1;
+       uar_ida->min = hr_dev->caps.reserved_uars;
 }
 
 static int hns_roce_xrcd_alloc(struct hns_roce_dev *hr_dev, u32 *xrcdn)
index b101b7e578f256f92f993083f69be5fd9cbdfbe4..9af4509894e685c1c97e8393198d00bbbd7e2e49 100644 (file)
@@ -715,7 +715,6 @@ static int alloc_rq_inline_buf(struct hns_roce_qp *hr_qp,
        /* allocate recv inline buf */
        wqe_list = kcalloc(wqe_cnt, sizeof(struct hns_roce_rinl_wqe),
                           GFP_KERNEL);
-
        if (!wqe_list)
                goto err;
 
@@ -823,77 +822,104 @@ static inline bool kernel_qp_has_rdb(struct hns_roce_dev *hr_dev,
                hns_roce_qp_has_rq(init_attr));
 }
 
+static int alloc_user_qp_db(struct hns_roce_dev *hr_dev,
+                           struct hns_roce_qp *hr_qp,
+                           struct ib_qp_init_attr *init_attr,
+                           struct ib_udata *udata,
+                           struct hns_roce_ib_create_qp *ucmd,
+                           struct hns_roce_ib_create_qp_resp *resp)
+{
+       struct hns_roce_ucontext *uctx = rdma_udata_to_drv_context(udata,
+               struct hns_roce_ucontext, ibucontext);
+       struct ib_device *ibdev = &hr_dev->ib_dev;
+       int ret;
+
+       if (user_qp_has_sdb(hr_dev, init_attr, udata, resp, ucmd)) {
+               ret = hns_roce_db_map_user(uctx, ucmd->sdb_addr, &hr_qp->sdb);
+               if (ret) {
+                       ibdev_err(ibdev,
+                                 "failed to map user SQ doorbell, ret = %d.\n",
+                                 ret);
+                       goto err_out;
+               }
+               hr_qp->en_flags |= HNS_ROCE_QP_CAP_SQ_RECORD_DB;
+       }
+
+       if (user_qp_has_rdb(hr_dev, init_attr, udata, resp)) {
+               ret = hns_roce_db_map_user(uctx, ucmd->db_addr, &hr_qp->rdb);
+               if (ret) {
+                       ibdev_err(ibdev,
+                                 "failed to map user RQ doorbell, ret = %d.\n",
+                                 ret);
+                       goto err_sdb;
+               }
+               hr_qp->en_flags |= HNS_ROCE_QP_CAP_RQ_RECORD_DB;
+       }
+
+       return 0;
+
+err_sdb:
+       if (hr_qp->en_flags & HNS_ROCE_QP_CAP_SQ_RECORD_DB)
+               hns_roce_db_unmap_user(uctx, &hr_qp->sdb);
+err_out:
+       return ret;
+}
+
+static int alloc_kernel_qp_db(struct hns_roce_dev *hr_dev,
+                             struct hns_roce_qp *hr_qp,
+                             struct ib_qp_init_attr *init_attr)
+{
+       struct ib_device *ibdev = &hr_dev->ib_dev;
+       int ret;
+
+       if (hr_dev->pci_dev->revision >= PCI_REVISION_ID_HIP09)
+               hr_qp->sq.db_reg = hr_dev->mem_base +
+                                  HNS_ROCE_DWQE_SIZE * hr_qp->qpn;
+       else
+               hr_qp->sq.db_reg = hr_dev->reg_base + hr_dev->sdb_offset +
+                                  DB_REG_OFFSET * hr_dev->priv_uar.index;
+
+       hr_qp->rq.db_reg = hr_dev->reg_base + hr_dev->odb_offset +
+                          DB_REG_OFFSET * hr_dev->priv_uar.index;
+
+       if (kernel_qp_has_rdb(hr_dev, init_attr)) {
+               ret = hns_roce_alloc_db(hr_dev, &hr_qp->rdb, 0);
+               if (ret) {
+                       ibdev_err(ibdev,
+                                 "failed to alloc kernel RQ doorbell, ret = %d.\n",
+                                 ret);
+                       return ret;
+               }
+               *hr_qp->rdb.db_record = 0;
+               hr_qp->en_flags |= HNS_ROCE_QP_CAP_RQ_RECORD_DB;
+       }
+
+       return 0;
+}
+
 static int alloc_qp_db(struct hns_roce_dev *hr_dev, struct hns_roce_qp *hr_qp,
                       struct ib_qp_init_attr *init_attr,
                       struct ib_udata *udata,
                       struct hns_roce_ib_create_qp *ucmd,
                       struct hns_roce_ib_create_qp_resp *resp)
 {
-       struct hns_roce_ucontext *uctx = rdma_udata_to_drv_context(
-               udata, struct hns_roce_ucontext, ibucontext);
-       struct ib_device *ibdev = &hr_dev->ib_dev;
        int ret;
 
        if (hr_dev->caps.flags & HNS_ROCE_CAP_FLAG_SDI_MODE)
                hr_qp->en_flags |= HNS_ROCE_QP_CAP_OWNER_DB;
 
        if (udata) {
-               if (user_qp_has_sdb(hr_dev, init_attr, udata, resp, ucmd)) {
-                       ret = hns_roce_db_map_user(uctx, ucmd->sdb_addr,
-                                                  &hr_qp->sdb);
-                       if (ret) {
-                               ibdev_err(ibdev,
-                                         "failed to map user SQ doorbell, ret = %d.\n",
-                                         ret);
-                               goto err_out;
-                       }
-                       hr_qp->en_flags |= HNS_ROCE_QP_CAP_SQ_RECORD_DB;
-                       resp->cap_flags |= HNS_ROCE_QP_CAP_SQ_RECORD_DB;
-               }
-
-               if (user_qp_has_rdb(hr_dev, init_attr, udata, resp)) {
-                       ret = hns_roce_db_map_user(uctx, ucmd->db_addr,
-                                                  &hr_qp->rdb);
-                       if (ret) {
-                               ibdev_err(ibdev,
-                                         "failed to map user RQ doorbell, ret = %d.\n",
-                                         ret);
-                               goto err_sdb;
-                       }
-                       hr_qp->en_flags |= HNS_ROCE_QP_CAP_RQ_RECORD_DB;
-                       resp->cap_flags |= HNS_ROCE_QP_CAP_RQ_RECORD_DB;
-               }
+               ret = alloc_user_qp_db(hr_dev, hr_qp, init_attr, udata, ucmd,
+                                      resp);
+               if (ret)
+                       return ret;
        } else {
-               if (hr_dev->pci_dev->revision >= PCI_REVISION_ID_HIP09)
-                       hr_qp->sq.db_reg = hr_dev->mem_base +
-                                          HNS_ROCE_DWQE_SIZE * hr_qp->qpn;
-               else
-                       hr_qp->sq.db_reg =
-                               hr_dev->reg_base + hr_dev->sdb_offset +
-                               DB_REG_OFFSET * hr_dev->priv_uar.index;
-
-               hr_qp->rq.db_reg = hr_dev->reg_base + hr_dev->odb_offset +
-                                  DB_REG_OFFSET * hr_dev->priv_uar.index;
-
-               if (kernel_qp_has_rdb(hr_dev, init_attr)) {
-                       ret = hns_roce_alloc_db(hr_dev, &hr_qp->rdb, 0);
-                       if (ret) {
-                               ibdev_err(ibdev,
-                                         "failed to alloc kernel RQ doorbell, ret = %d.\n",
-                                         ret);
-                               goto err_out;
-                       }
-                       *hr_qp->rdb.db_record = 0;
-                       hr_qp->en_flags |= HNS_ROCE_QP_CAP_RQ_RECORD_DB;
-               }
+               ret = alloc_kernel_qp_db(hr_dev, hr_qp, init_attr);
+               if (ret)
+                       return ret;
        }
 
        return 0;
-err_sdb:
-       if (udata && hr_qp->en_flags & HNS_ROCE_QP_CAP_SQ_RECORD_DB)
-               hns_roce_db_unmap_user(uctx, &hr_qp->sdb);
-err_out:
-       return ret;
 }
 
 static void free_qp_db(struct hns_roce_dev *hr_dev, struct hns_roce_qp *hr_qp,
@@ -959,8 +985,6 @@ static int set_qp_param(struct hns_roce_dev *hr_dev, struct hns_roce_qp *hr_qp,
        struct ib_device *ibdev = &hr_dev->ib_dev;
        int ret;
 
-       hr_qp->ibqp.qp_type = init_attr->qp_type;
-
        if (init_attr->cap.max_inline_data > hr_dev->caps.max_sq_inline)
                init_attr->cap.max_inline_data = hr_dev->caps.max_sq_inline;
 
@@ -1073,6 +1097,7 @@ static int hns_roce_create_qp_common(struct hns_roce_dev *hr_dev,
        }
 
        if (udata) {
+               resp.cap_flags = hr_qp->en_flags;
                ret = ib_copy_to_udata(udata, &resp,
                                       min(udata->outlen, sizeof(resp)));
                if (ret) {
@@ -1121,8 +1146,6 @@ void hns_roce_qp_destroy(struct hns_roce_dev *hr_dev, struct hns_roce_qp *hr_qp,
        free_qp_buf(hr_dev, hr_qp);
        free_kernel_wrid(hr_qp);
        free_qp_db(hr_dev, hr_qp, udata);
-
-       kfree(hr_qp);
 }
 
 static int check_qp_type(struct hns_roce_dev *hr_dev, enum ib_qp_type type,
@@ -1154,31 +1177,21 @@ out:
        return -EOPNOTSUPP;
 }
 
-struct ib_qp *hns_roce_create_qp(struct ib_pd *pd,
-                                struct ib_qp_init_attr *init_attr,
-                                struct ib_udata *udata)
+int hns_roce_create_qp(struct ib_qp *qp, struct ib_qp_init_attr *init_attr,
+                      struct ib_udata *udata)
 {
-       struct ib_device *ibdev = pd ? pd->device : init_attr->xrcd->device;
+       struct ib_device *ibdev = qp->device;
        struct hns_roce_dev *hr_dev = to_hr_dev(ibdev);
-       struct hns_roce_qp *hr_qp;
+       struct hns_roce_qp *hr_qp = to_hr_qp(qp);
+       struct ib_pd *pd = qp->pd;
        int ret;
 
        ret = check_qp_type(hr_dev, init_attr->qp_type, !!udata);
        if (ret)
-               return ERR_PTR(ret);
-
-       hr_qp = kzalloc(sizeof(*hr_qp), GFP_KERNEL);
-       if (!hr_qp)
-               return ERR_PTR(-ENOMEM);
-
-       if (init_attr->qp_type == IB_QPT_XRC_INI)
-               init_attr->recv_cq = NULL;
+               return ret;
 
-       if (init_attr->qp_type == IB_QPT_XRC_TGT) {
+       if (init_attr->qp_type == IB_QPT_XRC_TGT)
                hr_qp->xrcdn = to_hr_xrcd(init_attr->xrcd)->xrcdn;
-               init_attr->recv_cq = NULL;
-               init_attr->send_cq = NULL;
-       }
 
        if (init_attr->qp_type == IB_QPT_GSI) {
                hr_qp->port = init_attr->port_num - 1;
@@ -1186,15 +1199,11 @@ struct ib_qp *hns_roce_create_qp(struct ib_pd *pd,
        }
 
        ret = hns_roce_create_qp_common(hr_dev, pd, init_attr, udata, hr_qp);
-       if (ret) {
+       if (ret)
                ibdev_err(ibdev, "Create QP type 0x%x failed(%d)\n",
                          init_attr->qp_type, ret);
 
-               kfree(hr_qp);
-               return ERR_PTR(ret);
-       }
-
-       return &hr_qp->ibqp;
+       return ret;
 }
 
 int to_hr_qp_type(int qp_type)
@@ -1321,17 +1330,8 @@ int hns_roce_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr,
        if (ret)
                goto out;
 
-       if (cur_state == new_state && cur_state == IB_QPS_RESET) {
-               if (hr_dev->hw_rev == HNS_ROCE_HW_VER1) {
-                       ret = -EPERM;
-                       ibdev_err(&hr_dev->ib_dev,
-                                 "RST2RST state is not supported\n");
-               } else {
-                       ret = 0;
-               }
-
+       if (cur_state == new_state && cur_state == IB_QPS_RESET)
                goto out;
-       }
 
        ret = hr_dev->hw->modify_qp(ibqp, attr, attr_mask, cur_state,
                                    new_state);
@@ -1429,12 +1429,17 @@ bool hns_roce_wq_overflow(struct hns_roce_wq *hr_wq, u32 nreq,
        return cur + nreq >= hr_wq->wqe_cnt;
 }
 
-void hns_roce_init_qp_table(struct hns_roce_dev *hr_dev)
+int hns_roce_init_qp_table(struct hns_roce_dev *hr_dev)
 {
        struct hns_roce_qp_table *qp_table = &hr_dev->qp_table;
        unsigned int reserved_from_bot;
        unsigned int i;
 
+       qp_table->idx_table.spare_idx = kcalloc(hr_dev->caps.num_qps,
+                                       sizeof(u32), GFP_KERNEL);
+       if (!qp_table->idx_table.spare_idx)
+               return -ENOMEM;
+
        mutex_init(&qp_table->scc_mutex);
        mutex_init(&qp_table->bank_mutex);
        xa_init(&hr_dev->qp_table_xa);
@@ -1452,6 +1457,8 @@ void hns_roce_init_qp_table(struct hns_roce_dev *hr_dev)
                                               HNS_ROCE_QP_BANK_NUM - 1;
                hr_dev->qp_table.bank[i].next = hr_dev->qp_table.bank[i].min;
        }
+
+       return 0;
 }
 
 void hns_roce_cleanup_qp_table(struct hns_roce_dev *hr_dev)
@@ -1460,4 +1467,5 @@ void hns_roce_cleanup_qp_table(struct hns_roce_dev *hr_dev)
 
        for (i = 0; i < HNS_ROCE_QP_BANK_NUM; i++)
                ida_destroy(&hr_dev->qp_table.bank[i].ida);
+       kfree(hr_dev->qp_table.idx_table.spare_idx);
 }
index 6f2992f443fa817ac39c50eea5317ddb536764e7..6eee9deadd122c0ec1263c12fa7b5ceffe50aca4 100644 (file)
@@ -80,15 +80,19 @@ static int hns_roce_hw_destroy_srq(struct hns_roce_dev *dev,
 static int alloc_srqc(struct hns_roce_dev *hr_dev, struct hns_roce_srq *srq)
 {
        struct hns_roce_srq_table *srq_table = &hr_dev->srq_table;
+       struct hns_roce_ida *srq_ida = &hr_dev->srq_table.srq_ida;
        struct ib_device *ibdev = &hr_dev->ib_dev;
        struct hns_roce_cmd_mailbox *mailbox;
        int ret;
+       int id;
 
-       ret = hns_roce_bitmap_alloc(&srq_table->bitmap, &srq->srqn);
-       if (ret) {
-               ibdev_err(ibdev, "failed to alloc SRQ number.\n");
+       id = ida_alloc_range(&srq_ida->ida, srq_ida->min, srq_ida->max,
+                            GFP_KERNEL);
+       if (id < 0) {
+               ibdev_err(ibdev, "failed to alloc srq(%d).\n", id);
                return -ENOMEM;
        }
+       srq->srqn = (unsigned long)id;
 
        ret = hns_roce_table_get(hr_dev, &srq_table->table, srq->srqn);
        if (ret) {
@@ -132,7 +136,7 @@ err_xa:
 err_put:
        hns_roce_table_put(hr_dev, &srq_table->table, srq->srqn);
 err_out:
-       hns_roce_bitmap_free(&srq_table->bitmap, srq->srqn);
+       ida_free(&srq_ida->ida, id);
 
        return ret;
 }
@@ -154,7 +158,7 @@ static void free_srqc(struct hns_roce_dev *hr_dev, struct hns_roce_srq *srq)
        wait_for_completion(&srq->free);
 
        hns_roce_table_put(hr_dev, &srq_table->table, srq->srqn);
-       hns_roce_bitmap_free(&srq_table->bitmap, srq->srqn);
+       ida_free(&srq_table->srq_ida.ida, (int)srq->srqn);
 }
 
 static int alloc_srq_idx(struct hns_roce_dev *hr_dev, struct hns_roce_srq *srq,
@@ -440,18 +444,14 @@ int hns_roce_destroy_srq(struct ib_srq *ibsrq, struct ib_udata *udata)
        return 0;
 }
 
-int hns_roce_init_srq_table(struct hns_roce_dev *hr_dev)
+void hns_roce_init_srq_table(struct hns_roce_dev *hr_dev)
 {
        struct hns_roce_srq_table *srq_table = &hr_dev->srq_table;
+       struct hns_roce_ida *srq_ida = &srq_table->srq_ida;
 
        xa_init(&srq_table->xa);
 
-       return hns_roce_bitmap_init(&srq_table->bitmap, hr_dev->caps.num_srqs,
-                                   hr_dev->caps.num_srqs - 1,
-                                   hr_dev->caps.reserved_srqs, 0);
-}
-
-void hns_roce_cleanup_srq_table(struct hns_roce_dev *hr_dev)
-{
-       hns_roce_bitmap_cleanup(&hr_dev->srq_table.bitmap);
+       ida_init(&srq_ida->ida);
+       srq_ida->max = hr_dev->caps.num_srqs - 1;
+       srq_ida->min = hr_dev->caps.reserved_srqs;
 }
index e3f5173706fe039956389f89d0a0b9d5d832329f..78f598fdbccf0c5a83911f4d0038b5433179b8ab 100644 (file)
@@ -71,8 +71,6 @@ void irdma_qp_rem_qos(struct irdma_sc_qp *qp);
 struct irdma_sc_qp *irdma_get_qp_from_list(struct list_head *head,
                                           struct irdma_sc_qp *qp);
 void irdma_reinitialize_ieq(struct irdma_sc_vsi *vsi);
-u16 irdma_alloc_ws_node_id(struct irdma_sc_dev *dev);
-void irdma_free_ws_node_id(struct irdma_sc_dev *dev, u16 node_id);
 /* terminate functions*/
 void irdma_terminate_send_fin(struct irdma_sc_qp *qp);
 
index 5bbe44e54f9a11f3c58fb50a2a42542d7680c479..e94470991fe0eb25a0f338ea9a18080c2671f6bb 100644 (file)
@@ -1141,10 +1141,7 @@ void irdma_free_qp_rsrc(struct irdma_qp *iwqp)
                          iwqp->kqp.dma_mem.va, iwqp->kqp.dma_mem.pa);
        iwqp->kqp.dma_mem.va = NULL;
        kfree(iwqp->kqp.sq_wrid_mem);
-       iwqp->kqp.sq_wrid_mem = NULL;
        kfree(iwqp->kqp.rq_wrid_mem);
-       iwqp->kqp.rq_wrid_mem = NULL;
-       kfree(iwqp);
 }
 
 /**
index e2114f2134bb23f7dcdf76d32012635370cbf03f..4fc32340207361c0de003fe0c1f59dad01ff2ca2 100644 (file)
@@ -790,18 +790,19 @@ static int irdma_validate_qp_attrs(struct ib_qp_init_attr *init_attr,
 
 /**
  * irdma_create_qp - create qp
- * @ibpd: ptr of pd
+ * @ibqp: ptr of qp
  * @init_attr: attributes for qp
  * @udata: user data for create qp
  */
-static struct ib_qp *irdma_create_qp(struct ib_pd *ibpd,
-                                    struct ib_qp_init_attr *init_attr,
-                                    struct ib_udata *udata)
+static int irdma_create_qp(struct ib_qp *ibqp,
+                          struct ib_qp_init_attr *init_attr,
+                          struct ib_udata *udata)
 {
+       struct ib_pd *ibpd = ibqp->pd;
        struct irdma_pd *iwpd = to_iwpd(ibpd);
        struct irdma_device *iwdev = to_iwdev(ibpd->device);
        struct irdma_pci_f *rf = iwdev->rf;
-       struct irdma_qp *iwqp;
+       struct irdma_qp *iwqp = to_iwqp(ibqp);
        struct irdma_create_qp_req req;
        struct irdma_create_qp_resp uresp = {};
        u32 qp_num = 0;
@@ -818,7 +819,7 @@ static struct ib_qp *irdma_create_qp(struct ib_pd *ibpd,
 
        err_code = irdma_validate_qp_attrs(init_attr, iwdev);
        if (err_code)
-               return ERR_PTR(err_code);
+               return err_code;
 
        sq_size = init_attr->cap.max_send_wr;
        rq_size = init_attr->cap.max_recv_wr;
@@ -831,10 +832,6 @@ static struct ib_qp *irdma_create_qp(struct ib_pd *ibpd,
        init_info.qp_uk_init_info.max_rq_frag_cnt = init_attr->cap.max_recv_sge;
        init_info.qp_uk_init_info.max_inline_data = init_attr->cap.max_inline_data;
 
-       iwqp = kzalloc(sizeof(*iwqp), GFP_KERNEL);
-       if (!iwqp)
-               return ERR_PTR(-ENOMEM);
-
        qp = &iwqp->sc_qp;
        qp->qp_uk.back_qp = iwqp;
        qp->qp_uk.lock = &iwqp->lock;
@@ -847,10 +844,8 @@ static struct ib_qp *irdma_create_qp(struct ib_pd *ibpd,
                                                 iwqp->q2_ctx_mem.size,
                                                 &iwqp->q2_ctx_mem.pa,
                                                 GFP_KERNEL);
-       if (!iwqp->q2_ctx_mem.va) {
-               err_code = -ENOMEM;
-               goto error;
-       }
+       if (!iwqp->q2_ctx_mem.va)
+               return -ENOMEM;
 
        init_info.q2 = iwqp->q2_ctx_mem.va;
        init_info.q2_pa = iwqp->q2_ctx_mem.pa;
@@ -999,17 +994,16 @@ static struct ib_qp *irdma_create_qp(struct ib_pd *ibpd,
                if (err_code) {
                        ibdev_dbg(&iwdev->ibdev, "VERBS: copy_to_udata failed\n");
                        irdma_destroy_qp(&iwqp->ibqp, udata);
-                       return ERR_PTR(err_code);
+                       return err_code;
                }
        }
 
        init_completion(&iwqp->free_qp);
-       return &iwqp->ibqp;
+       return 0;
 
 error:
        irdma_free_qp_rsrc(iwqp);
-
-       return ERR_PTR(err_code);
+       return err_code;
 }
 
 static int irdma_get_ib_acc_flags(struct irdma_qp *iwqp)
@@ -4404,6 +4398,7 @@ static const struct ib_device_ops irdma_dev_ops = {
        INIT_RDMA_OBJ_SIZE(ib_ah, irdma_ah, ibah),
        INIT_RDMA_OBJ_SIZE(ib_cq, irdma_cq, ibcq),
        INIT_RDMA_OBJ_SIZE(ib_mw, irdma_mr, ibmw),
+       INIT_RDMA_OBJ_SIZE(ib_qp, irdma_qp, ibqp),
 };
 
 /**
index ae4c91b612ce3f5e4bb565218295a7d4172250ac..f367f4a4abffc1e1ff996866770b2c81575703a7 100644 (file)
@@ -2577,6 +2577,7 @@ static const struct ib_device_ops mlx4_ib_dev_ops = {
        INIT_RDMA_OBJ_SIZE(ib_ah, mlx4_ib_ah, ibah),
        INIT_RDMA_OBJ_SIZE(ib_cq, mlx4_ib_cq, ibcq),
        INIT_RDMA_OBJ_SIZE(ib_pd, mlx4_ib_pd, ibpd),
+       INIT_RDMA_OBJ_SIZE(ib_qp, mlx4_ib_qp, ibqp),
        INIT_RDMA_OBJ_SIZE(ib_srq, mlx4_ib_srq, ibsrq),
        INIT_RDMA_OBJ_SIZE(ib_ucontext, mlx4_ib_ucontext, ibucontext),
 };
index e856cf23a0a110ab0e37547306c0f848b8869ba0..c60f6e9ac640d29dc69602f692ecef0e05fe4bf7 100644 (file)
@@ -792,9 +792,8 @@ void mlx4_ib_free_srq_wqe(struct mlx4_ib_srq *srq, int wqe_index);
 int mlx4_ib_post_srq_recv(struct ib_srq *ibsrq, const struct ib_recv_wr *wr,
                          const struct ib_recv_wr **bad_wr);
 
-struct ib_qp *mlx4_ib_create_qp(struct ib_pd *pd,
-                               struct ib_qp_init_attr *init_attr,
-                               struct ib_udata *udata);
+int mlx4_ib_create_qp(struct ib_qp *qp, struct ib_qp_init_attr *init_attr,
+                     struct ib_udata *udata);
 int mlx4_ib_destroy_qp(struct ib_qp *qp, struct ib_udata *udata);
 void mlx4_ib_drain_sq(struct ib_qp *qp);
 void mlx4_ib_drain_rq(struct ib_qp *qp);
index 4a2ef7daadeda3b57e45385043d78ca20f8d10d1..8662f462e2a5faab9d3bedf168867b4cf62680b4 100644 (file)
@@ -1578,24 +1578,19 @@ static int _mlx4_ib_create_qp(struct ib_pd *pd, struct mlx4_ib_qp *qp,
        return 0;
 }
 
-struct ib_qp *mlx4_ib_create_qp(struct ib_pd *pd,
-                               struct ib_qp_init_attr *init_attr,
-                               struct ib_udata *udata) {
-       struct ib_device *device = pd ? pd->device : init_attr->xrcd->device;
+int mlx4_ib_create_qp(struct ib_qp *ibqp, struct ib_qp_init_attr *init_attr,
+                     struct ib_udata *udata)
+{
+       struct ib_device *device = ibqp->device;
        struct mlx4_ib_dev *dev = to_mdev(device);
-       struct mlx4_ib_qp *qp;
+       struct mlx4_ib_qp *qp = to_mqp(ibqp);
+       struct ib_pd *pd = ibqp->pd;
        int ret;
 
-       qp = kzalloc(sizeof(*qp), GFP_KERNEL);
-       if (!qp)
-               return ERR_PTR(-ENOMEM);
-
        mutex_init(&qp->mutex);
        ret = _mlx4_ib_create_qp(pd, qp, init_attr, udata);
-       if (ret) {
-               kfree(qp);
-               return ERR_PTR(ret);
-       }
+       if (ret)
+               return ret;
 
        if (init_attr->qp_type == IB_QPT_GSI &&
            !(init_attr->create_flags & MLX4_IB_QP_CREATE_ROCE_V2_GSI)) {
@@ -1618,7 +1613,7 @@ struct ib_qp *mlx4_ib_create_qp(struct ib_pd *pd,
                        init_attr->create_flags &= ~MLX4_IB_QP_CREATE_ROCE_V2_GSI;
                }
        }
-       return &qp->ibqp;
+       return 0;
 }
 
 static int _mlx4_ib_destroy_qp(struct ib_qp *qp, struct ib_udata *udata)
@@ -1646,8 +1641,6 @@ static int _mlx4_ib_destroy_qp(struct ib_qp *qp, struct ib_udata *udata)
        }
 
        kfree(mqp->sqp);
-       kfree(mqp);
-
        return 0;
 }
 
index b8e5e371bb1962fdf3527681b0e081da440bfa38..a190fb5815913463cf245f5978a46595856953be 100644 (file)
@@ -996,7 +996,7 @@ int mlx5_ib_create_cq(struct ib_cq *ibcq, const struct ib_cq_init_attr *attr,
                                  MLX5_IB_CQ_PR_FLAGS_CQE_128_PAD));
        MLX5_SET(cqc, cqc, log_cq_size, ilog2(entries));
        MLX5_SET(cqc, cqc, uar_page, index);
-       MLX5_SET(cqc, cqc, c_eqn, eqn);
+       MLX5_SET(cqc, cqc, c_eqn_or_apu_element, eqn);
        MLX5_SET64(cqc, cqc, dbr_addr, cq->db.dma);
        if (cq->create_flags & IB_UVERBS_CQ_FLAGS_IGNORE_OVERRUN)
                MLX5_SET(cqc, cqc, oi, 1);
index c869b2a91a289b4fa1b7c249b837f0f90edd4d0e..e95967aefe788cf5d896a1c52d71df26893815d6 100644 (file)
@@ -1436,11 +1436,10 @@ out:
        rcu_read_unlock();
 }
 
-static bool is_apu_thread_cq(struct mlx5_ib_dev *dev, const void *in)
+static bool is_apu_cq(struct mlx5_ib_dev *dev, const void *in)
 {
        if (!MLX5_CAP_GEN(dev->mdev, apu) ||
-           !MLX5_GET(cqc, MLX5_ADDR_OF(create_cq_in, in, cq_context),
-                     apu_thread_cq))
+           !MLX5_GET(cqc, MLX5_ADDR_OF(create_cq_in, in, cq_context), apu_cq))
                return false;
 
        return true;
@@ -1500,7 +1499,7 @@ static int UVERBS_HANDLER(MLX5_IB_METHOD_DEVX_OBJ_CREATE)(
                err = mlx5_core_create_dct(dev, &obj->core_dct, cmd_in,
                                           cmd_in_len, cmd_out, cmd_out_len);
        } else if (opcode == MLX5_CMD_OP_CREATE_CQ &&
-                  !is_apu_thread_cq(dev, cmd_in)) {
+                  !is_apu_cq(dev, cmd_in)) {
                obj->flags |= DEVX_OBJ_FLAGS_CQ;
                obj->core_cq.comp = devx_cq_comp;
                err = mlx5_core_create_cq(dev->mdev, &obj->core_cq,
index 7fcad91352769e575bdd85d77c358d76ea1d9bd0..3ad8f637c589a5e10f5e093b16f7ff3f736c3ef6 100644 (file)
@@ -116,8 +116,6 @@ int mlx5_ib_create_gsi(struct ib_pd *pd, struct mlx5_ib_qp *mqp,
                goto err_free_tx;
        }
 
-       mutex_lock(&dev->devr.mutex);
-
        if (dev->devr.ports[port_num - 1].gsi) {
                mlx5_ib_warn(dev, "GSI QP already exists on port %d\n",
                             port_num);
@@ -147,35 +145,20 @@ int mlx5_ib_create_gsi(struct ib_pd *pd, struct mlx5_ib_qp *mqp,
                hw_init_attr.cap.max_inline_data = 0;
        }
 
-       gsi->rx_qp = mlx5_ib_create_qp(pd, &hw_init_attr, NULL);
+       gsi->rx_qp = ib_create_qp(pd, &hw_init_attr);
        if (IS_ERR(gsi->rx_qp)) {
                mlx5_ib_warn(dev, "unable to create hardware GSI QP. error %ld\n",
                             PTR_ERR(gsi->rx_qp));
                ret = PTR_ERR(gsi->rx_qp);
                goto err_destroy_cq;
        }
-       gsi->rx_qp->device = pd->device;
-       gsi->rx_qp->pd = pd;
-       gsi->rx_qp->real_qp = gsi->rx_qp;
-
-       gsi->rx_qp->qp_type = hw_init_attr.qp_type;
-       gsi->rx_qp->send_cq = hw_init_attr.send_cq;
-       gsi->rx_qp->recv_cq = hw_init_attr.recv_cq;
-       gsi->rx_qp->event_handler = hw_init_attr.event_handler;
-       spin_lock_init(&gsi->rx_qp->mr_lock);
-       INIT_LIST_HEAD(&gsi->rx_qp->rdma_mrs);
-       INIT_LIST_HEAD(&gsi->rx_qp->sig_mrs);
 
        dev->devr.ports[attr->port_num - 1].gsi = gsi;
-
-       mutex_unlock(&dev->devr.mutex);
-
        return 0;
 
 err_destroy_cq:
        ib_free_cq(gsi->cq);
 err_free_wrs:
-       mutex_unlock(&dev->devr.mutex);
        kfree(gsi->outstanding_wrs);
 err_free_tx:
        kfree(gsi->tx_qps);
@@ -190,16 +173,13 @@ int mlx5_ib_destroy_gsi(struct mlx5_ib_qp *mqp)
        int qp_index;
        int ret;
 
-       mutex_lock(&dev->devr.mutex);
-       ret = mlx5_ib_destroy_qp(gsi->rx_qp, NULL);
+       ret = ib_destroy_qp(gsi->rx_qp);
        if (ret) {
                mlx5_ib_warn(dev, "unable to destroy hardware GSI QP. error %d\n",
                             ret);
-               mutex_unlock(&dev->devr.mutex);
                return ret;
        }
        dev->devr.ports[port_num - 1].gsi = NULL;
-       mutex_unlock(&dev->devr.mutex);
        gsi->rx_qp = NULL;
 
        for (qp_index = 0; qp_index < gsi->num_qps; ++qp_index) {
@@ -213,8 +193,6 @@ int mlx5_ib_destroy_gsi(struct mlx5_ib_qp *mqp)
 
        kfree(gsi->outstanding_wrs);
        kfree(gsi->tx_qps);
-       kfree(mqp);
-
        return 0;
 }
 
@@ -339,23 +317,13 @@ err_destroy_qp:
        WARN_ON_ONCE(qp);
 }
 
-static void setup_qps(struct mlx5_ib_gsi_qp *gsi)
-{
-       struct mlx5_ib_dev *dev = to_mdev(gsi->rx_qp->device);
-       u16 qp_index;
-
-       mutex_lock(&dev->devr.mutex);
-       for (qp_index = 0; qp_index < gsi->num_qps; ++qp_index)
-               setup_qp(gsi, qp_index);
-       mutex_unlock(&dev->devr.mutex);
-}
-
 int mlx5_ib_gsi_modify_qp(struct ib_qp *qp, struct ib_qp_attr *attr,
                          int attr_mask)
 {
        struct mlx5_ib_dev *dev = to_mdev(qp->device);
        struct mlx5_ib_qp *mqp = to_mqp(qp);
        struct mlx5_ib_gsi_qp *gsi = &mqp->gsi;
+       u16 qp_index;
        int ret;
 
        mlx5_ib_dbg(dev, "modifying GSI QP to state %d\n", attr->qp_state);
@@ -366,8 +334,11 @@ int mlx5_ib_gsi_modify_qp(struct ib_qp *qp, struct ib_qp_attr *attr,
                return ret;
        }
 
-       if (to_mqp(gsi->rx_qp)->state == IB_QPS_RTS)
-               setup_qps(gsi);
+       if (to_mqp(gsi->rx_qp)->state != IB_QPS_RTS)
+               return 0;
+
+       for (qp_index = 0; qp_index < gsi->num_qps; ++qp_index)
+               setup_qp(gsi, qp_index);
        return 0;
 }
 
@@ -511,8 +482,8 @@ int mlx5_ib_gsi_post_recv(struct ib_qp *qp, const struct ib_recv_wr *wr,
 
 void mlx5_ib_gsi_pkey_change(struct mlx5_ib_gsi_qp *gsi)
 {
-       if (!gsi)
-               return;
+       u16 qp_index;
 
-       setup_qps(gsi);
+       for (qp_index = 0; qp_index < gsi->num_qps; ++qp_index)
+               setup_qp(gsi, qp_index);
 }
index b25e0b33a11ac794fe17f918b2805f675fbf8b15..52821485371abde4aaf0090de97118eb8e14fe16 100644 (file)
@@ -8,13 +8,15 @@
 #include "srq.h"
 
 static int
-mlx5_ib_set_vport_rep(struct mlx5_core_dev *dev, struct mlx5_eswitch_rep *rep)
+mlx5_ib_set_vport_rep(struct mlx5_core_dev *dev,
+                     struct mlx5_eswitch_rep *rep,
+                     int vport_index)
 {
        struct mlx5_ib_dev *ibdev;
-       int vport_index;
 
        ibdev = mlx5_eswitch_uplink_get_proto_dev(dev->priv.eswitch, REP_IB);
-       vport_index = rep->vport_index;
+       if (!ibdev)
+               return -EINVAL;
 
        ibdev->port[vport_index].rep = rep;
        rep->rep_data[REP_IB].priv = ibdev;
@@ -26,19 +28,39 @@ mlx5_ib_set_vport_rep(struct mlx5_core_dev *dev, struct mlx5_eswitch_rep *rep)
        return 0;
 }
 
+static void mlx5_ib_register_peer_vport_reps(struct mlx5_core_dev *mdev);
+
 static int
 mlx5_ib_vport_rep_load(struct mlx5_core_dev *dev, struct mlx5_eswitch_rep *rep)
 {
        u32 num_ports = mlx5_eswitch_get_total_vports(dev);
        const struct mlx5_ib_profile *profile;
+       struct mlx5_core_dev *peer_dev;
        struct mlx5_ib_dev *ibdev;
+       u32 peer_num_ports;
        int vport_index;
        int ret;
 
+       vport_index = rep->vport_index;
+
+       if (mlx5_lag_is_shared_fdb(dev)) {
+               peer_dev = mlx5_lag_get_peer_mdev(dev);
+               peer_num_ports = mlx5_eswitch_get_total_vports(peer_dev);
+               if (mlx5_lag_is_master(dev)) {
+                       /* Only 1 ib port is the representor for both uplinks */
+                       num_ports += peer_num_ports - 1;
+               } else {
+                       if (rep->vport == MLX5_VPORT_UPLINK)
+                               return 0;
+                       vport_index += peer_num_ports;
+                       dev = peer_dev;
+               }
+       }
+
        if (rep->vport == MLX5_VPORT_UPLINK)
                profile = &raw_eth_profile;
        else
-               return mlx5_ib_set_vport_rep(dev, rep);
+               return mlx5_ib_set_vport_rep(dev, rep, vport_index);
 
        ibdev = ib_alloc_device(mlx5_ib_dev, ib_dev);
        if (!ibdev)
@@ -64,6 +86,8 @@ mlx5_ib_vport_rep_load(struct mlx5_core_dev *dev, struct mlx5_eswitch_rep *rep)
                goto fail_add;
 
        rep->rep_data[REP_IB].priv = ibdev;
+       if (mlx5_lag_is_shared_fdb(dev))
+               mlx5_ib_register_peer_vport_reps(dev);
 
        return 0;
 
@@ -82,18 +106,45 @@ static void *mlx5_ib_rep_to_dev(struct mlx5_eswitch_rep *rep)
 static void
 mlx5_ib_vport_rep_unload(struct mlx5_eswitch_rep *rep)
 {
+       struct mlx5_core_dev *mdev = mlx5_eswitch_get_core_dev(rep->esw);
        struct mlx5_ib_dev *dev = mlx5_ib_rep_to_dev(rep);
+       int vport_index = rep->vport_index;
        struct mlx5_ib_port *port;
 
-       port = &dev->port[rep->vport_index];
+       if (WARN_ON(!mdev))
+               return;
+
+       if (mlx5_lag_is_shared_fdb(mdev) &&
+           !mlx5_lag_is_master(mdev)) {
+               struct mlx5_core_dev *peer_mdev;
+
+               if (rep->vport == MLX5_VPORT_UPLINK)
+                       return;
+               peer_mdev = mlx5_lag_get_peer_mdev(mdev);
+               vport_index += mlx5_eswitch_get_total_vports(peer_mdev);
+       }
+
+       if (!dev)
+               return;
+
+       port = &dev->port[vport_index];
        write_lock(&port->roce.netdev_lock);
        port->roce.netdev = NULL;
        write_unlock(&port->roce.netdev_lock);
        rep->rep_data[REP_IB].priv = NULL;
        port->rep = NULL;
 
-       if (rep->vport == MLX5_VPORT_UPLINK)
+       if (rep->vport == MLX5_VPORT_UPLINK) {
+               struct mlx5_core_dev *peer_mdev;
+               struct mlx5_eswitch *esw;
+
+               if (mlx5_lag_is_shared_fdb(mdev)) {
+                       peer_mdev = mlx5_lag_get_peer_mdev(mdev);
+                       esw = peer_mdev->priv.eswitch;
+                       mlx5_eswitch_unregister_vport_reps(esw, REP_IB);
+               }
                __mlx5_ib_remove(dev, dev->profile, MLX5_IB_STAGE_MAX);
+       }
 }
 
 static const struct mlx5_eswitch_rep_ops rep_ops = {
@@ -102,6 +153,18 @@ static const struct mlx5_eswitch_rep_ops rep_ops = {
        .get_proto_dev = mlx5_ib_rep_to_dev,
 };
 
+static void mlx5_ib_register_peer_vport_reps(struct mlx5_core_dev *mdev)
+{
+       struct mlx5_core_dev *peer_mdev = mlx5_lag_get_peer_mdev(mdev);
+       struct mlx5_eswitch *esw;
+
+       if (!peer_mdev)
+               return;
+
+       esw = peer_mdev->priv.eswitch;
+       mlx5_eswitch_register_vport_reps(esw, &rep_ops, REP_IB);
+}
+
 struct net_device *mlx5_ib_get_rep_netdev(struct mlx5_eswitch *esw,
                                          u16 vport_num)
 {
@@ -123,7 +186,7 @@ struct mlx5_flow_handle *create_flow_rule_vport_sq(struct mlx5_ib_dev *dev,
 
        rep = dev->port[port - 1].rep;
 
-       return mlx5_eswitch_add_send_to_vport_rule(esw, rep, sq->base.mqp.qpn);
+       return mlx5_eswitch_add_send_to_vport_rule(esw, esw, rep, sq->base.mqp.qpn);
 }
 
 static int mlx5r_rep_probe(struct auxiliary_device *adev,
index 094c976b1eedf73298a1f13efa6a6e3d869ce758..b36ad5ad8197776d7838114f26839069c6aedcaa 100644 (file)
@@ -126,6 +126,7 @@ static int get_port_state(struct ib_device *ibdev,
 
 static struct mlx5_roce *mlx5_get_rep_roce(struct mlx5_ib_dev *dev,
                                           struct net_device *ndev,
+                                          struct net_device *upper,
                                           u32 *port_num)
 {
        struct net_device *rep_ndev;
@@ -137,6 +138,14 @@ static struct mlx5_roce *mlx5_get_rep_roce(struct mlx5_ib_dev *dev,
                if (!port->rep)
                        continue;
 
+               if (upper == ndev && port->rep->vport == MLX5_VPORT_UPLINK) {
+                       *port_num = i + 1;
+                       return &port->roce;
+               }
+
+               if (upper && port->rep->vport == MLX5_VPORT_UPLINK)
+                       continue;
+
                read_lock(&port->roce.netdev_lock);
                rep_ndev = mlx5_ib_get_rep_netdev(port->rep->esw,
                                                  port->rep->vport);
@@ -196,11 +205,12 @@ static int mlx5_netdev_event(struct notifier_block *this,
                }
 
                if (ibdev->is_rep)
-                       roce = mlx5_get_rep_roce(ibdev, ndev, &port_num);
+                       roce = mlx5_get_rep_roce(ibdev, ndev, upper, &port_num);
                if (!roce)
                        return NOTIFY_DONE;
-               if ((upper == ndev || (!upper && ndev == roce->netdev))
-                   && ibdev->ib_active) {
+               if ((upper == ndev ||
+                    ((!upper || ibdev->is_rep) && ndev == roce->netdev)) &&
+                   ibdev->ib_active) {
                        struct ib_event ibev = { };
                        enum ib_port_state port_state;
 
@@ -1174,6 +1184,16 @@ static int mlx5_ib_query_device(struct ib_device *ibdev,
                                MLX5_IB_TUNNELED_OFFLOADS_MPLS_UDP;
        }
 
+       if (offsetofend(typeof(resp), dci_streams_caps) <= uhw_outlen) {
+               resp.response_length += sizeof(resp.dci_streams_caps);
+
+               resp.dci_streams_caps.max_log_num_concurent =
+                       MLX5_CAP_GEN(mdev, log_max_dci_stream_channels);
+
+               resp.dci_streams_caps.max_log_num_errored =
+                       MLX5_CAP_GEN(mdev, log_max_dci_errored_streams);
+       }
+
        if (uhw_outlen) {
                err = ib_copy_to_udata(uhw, &resp, resp.response_length);
 
@@ -2491,6 +2511,13 @@ static void pkey_change_handler(struct work_struct *work)
                container_of(work, struct mlx5_ib_port_resources,
                             pkey_change_work);
 
+       if (!ports->gsi)
+               /*
+                * We got this event before device was fully configured
+                * and MAD registration code wasn't called/finished yet.
+                */
+               return;
+
        mlx5_ib_gsi_pkey_change(ports->gsi);
 }
 
@@ -2785,33 +2812,16 @@ static int mlx5_ib_dev_res_init(struct mlx5_ib_dev *dev)
        if (!MLX5_CAP_GEN(dev->mdev, xrc))
                return -EOPNOTSUPP;
 
-       mutex_init(&devr->mutex);
+       devr->p0 = ib_alloc_pd(ibdev, 0);
+       if (IS_ERR(devr->p0))
+               return PTR_ERR(devr->p0);
 
-       devr->p0 = rdma_zalloc_drv_obj(ibdev, ib_pd);
-       if (!devr->p0)
-               return -ENOMEM;
-
-       devr->p0->device  = ibdev;
-       devr->p0->uobject = NULL;
-       atomic_set(&devr->p0->usecnt, 0);
-
-       ret = mlx5_ib_alloc_pd(devr->p0, NULL);
-       if (ret)
-               goto error0;
-
-       devr->c0 = rdma_zalloc_drv_obj(ibdev, ib_cq);
-       if (!devr->c0) {
-               ret = -ENOMEM;
+       devr->c0 = ib_create_cq(ibdev, NULL, NULL, NULL, &cq_attr);
+       if (IS_ERR(devr->c0)) {
+               ret = PTR_ERR(devr->c0);
                goto error1;
        }
 
-       devr->c0->device = &dev->ib_dev;
-       atomic_set(&devr->c0->usecnt, 0);
-
-       ret = mlx5_ib_create_cq(devr->c0, &cq_attr, NULL);
-       if (ret)
-               goto err_create_cq;
-
        ret = mlx5_cmd_xrcd_alloc(dev->mdev, &devr->xrcdn0, 0);
        if (ret)
                goto error2;
@@ -2826,45 +2836,22 @@ static int mlx5_ib_dev_res_init(struct mlx5_ib_dev *dev)
        attr.srq_type = IB_SRQT_XRC;
        attr.ext.cq = devr->c0;
 
-       devr->s0 = rdma_zalloc_drv_obj(ibdev, ib_srq);
-       if (!devr->s0) {
-               ret = -ENOMEM;
-               goto error4;
-       }
-
-       devr->s0->device        = &dev->ib_dev;
-       devr->s0->pd            = devr->p0;
-       devr->s0->srq_type      = IB_SRQT_XRC;
-       devr->s0->ext.cq        = devr->c0;
-       ret = mlx5_ib_create_srq(devr->s0, &attr, NULL);
-       if (ret)
+       devr->s0 = ib_create_srq(devr->p0, &attr);
+       if (IS_ERR(devr->s0)) {
+               ret = PTR_ERR(devr->s0);
                goto err_create;
-
-       atomic_inc(&devr->s0->ext.cq->usecnt);
-       atomic_inc(&devr->p0->usecnt);
-       atomic_set(&devr->s0->usecnt, 0);
+       }
 
        memset(&attr, 0, sizeof(attr));
        attr.attr.max_sge = 1;
        attr.attr.max_wr = 1;
        attr.srq_type = IB_SRQT_BASIC;
-       devr->s1 = rdma_zalloc_drv_obj(ibdev, ib_srq);
-       if (!devr->s1) {
-               ret = -ENOMEM;
-               goto error5;
-       }
 
-       devr->s1->device        = &dev->ib_dev;
-       devr->s1->pd            = devr->p0;
-       devr->s1->srq_type      = IB_SRQT_BASIC;
-       devr->s1->ext.cq        = devr->c0;
-
-       ret = mlx5_ib_create_srq(devr->s1, &attr, NULL);
-       if (ret)
+       devr->s1 = ib_create_srq(devr->p0, &attr);
+       if (IS_ERR(devr->s1)) {
+               ret = PTR_ERR(devr->s1);
                goto error6;
-
-       atomic_inc(&devr->p0->usecnt);
-       atomic_set(&devr->s1->usecnt, 0);
+       }
 
        for (port = 0; port < ARRAY_SIZE(devr->ports); ++port)
                INIT_WORK(&devr->ports[port].pkey_change_work,
@@ -2873,23 +2860,15 @@ static int mlx5_ib_dev_res_init(struct mlx5_ib_dev *dev)
        return 0;
 
 error6:
-       kfree(devr->s1);
-error5:
-       mlx5_ib_destroy_srq(devr->s0, NULL);
+       ib_destroy_srq(devr->s0);
 err_create:
-       kfree(devr->s0);
-error4:
        mlx5_cmd_xrcd_dealloc(dev->mdev, devr->xrcdn1, 0);
 error3:
        mlx5_cmd_xrcd_dealloc(dev->mdev, devr->xrcdn0, 0);
 error2:
-       mlx5_ib_destroy_cq(devr->c0, NULL);
-err_create_cq:
-       kfree(devr->c0);
+       ib_destroy_cq(devr->c0);
 error1:
-       mlx5_ib_dealloc_pd(devr->p0, NULL);
-error0:
-       kfree(devr->p0);
+       ib_dealloc_pd(devr->p0);
        return ret;
 }
 
@@ -2898,20 +2877,21 @@ static void mlx5_ib_dev_res_cleanup(struct mlx5_ib_dev *dev)
        struct mlx5_ib_resources *devr = &dev->devr;
        int port;
 
-       mlx5_ib_destroy_srq(devr->s1, NULL);
-       kfree(devr->s1);
-       mlx5_ib_destroy_srq(devr->s0, NULL);
-       kfree(devr->s0);
-       mlx5_cmd_xrcd_dealloc(dev->mdev, devr->xrcdn1, 0);
-       mlx5_cmd_xrcd_dealloc(dev->mdev, devr->xrcdn0, 0);
-       mlx5_ib_destroy_cq(devr->c0, NULL);
-       kfree(devr->c0);
-       mlx5_ib_dealloc_pd(devr->p0, NULL);
-       kfree(devr->p0);
-
-       /* Make sure no change P_Key work items are still executing */
+       /*
+        * Make sure no change P_Key work items are still executing.
+        *
+        * At this stage, the mlx5_ib_event should be unregistered
+        * and it ensures that no new works are added.
+        */
        for (port = 0; port < ARRAY_SIZE(devr->ports); ++port)
                cancel_work_sync(&devr->ports[port].pkey_change_work);
+
+       ib_destroy_srq(devr->s1);
+       ib_destroy_srq(devr->s0);
+       mlx5_cmd_xrcd_dealloc(dev->mdev, devr->xrcdn1, 0);
+       mlx5_cmd_xrcd_dealloc(dev->mdev, devr->xrcdn0, 0);
+       ib_destroy_cq(devr->c0);
+       ib_dealloc_pd(devr->p0);
 }
 
 static u32 get_core_cap_flags(struct ib_device *ibdev,
@@ -3012,7 +2992,7 @@ static int mlx5_eth_lag_init(struct mlx5_ib_dev *dev)
        struct mlx5_flow_table *ft;
        int err;
 
-       if (!ns || !mlx5_lag_is_roce(mdev))
+       if (!ns || !mlx5_lag_is_active(mdev))
                return 0;
 
        err = mlx5_cmd_create_vport_lag(mdev);
@@ -3074,9 +3054,11 @@ static int mlx5_enable_eth(struct mlx5_ib_dev *dev)
 {
        int err;
 
-       err = mlx5_nic_vport_enable_roce(dev->mdev);
-       if (err)
-               return err;
+       if (!dev->is_rep && dev->profile != &raw_eth_profile) {
+               err = mlx5_nic_vport_enable_roce(dev->mdev);
+               if (err)
+                       return err;
+       }
 
        err = mlx5_eth_lag_init(dev);
        if (err)
@@ -3085,7 +3067,8 @@ static int mlx5_enable_eth(struct mlx5_ib_dev *dev)
        return 0;
 
 err_disable_roce:
-       mlx5_nic_vport_disable_roce(dev->mdev);
+       if (!dev->is_rep && dev->profile != &raw_eth_profile)
+               mlx5_nic_vport_disable_roce(dev->mdev);
 
        return err;
 }
@@ -3093,7 +3076,8 @@ err_disable_roce:
 static void mlx5_disable_eth(struct mlx5_ib_dev *dev)
 {
        mlx5_eth_lag_cleanup(dev);
-       mlx5_nic_vport_disable_roce(dev->mdev);
+       if (!dev->is_rep && dev->profile != &raw_eth_profile)
+               mlx5_nic_vport_disable_roce(dev->mdev);
 }
 
 static int mlx5_ib_rn_get_params(struct ib_device *device, u32 port_num,
@@ -3785,6 +3769,7 @@ static const struct ib_device_ops mlx5_ib_dev_ops = {
        INIT_RDMA_OBJ_SIZE(ib_counters, mlx5_ib_mcounters, ibcntrs),
        INIT_RDMA_OBJ_SIZE(ib_cq, mlx5_ib_cq, ibcq),
        INIT_RDMA_OBJ_SIZE(ib_pd, mlx5_ib_pd, ibpd),
+       INIT_RDMA_OBJ_SIZE(ib_qp, mlx5_ib_qp, ibqp),
        INIT_RDMA_OBJ_SIZE(ib_srq, mlx5_ib_srq, ibsrq),
        INIT_RDMA_OBJ_SIZE(ib_ucontext, mlx5_ib_ucontext, ibucontext),
 };
@@ -3950,12 +3935,7 @@ static int mlx5_ib_roce_init(struct mlx5_ib_dev *dev)
 
                /* Register only for native ports */
                err = mlx5_add_netdev_notifier(dev, port_num);
-               if (err || dev->is_rep || !mlx5_is_roce_init_enabled(mdev))
-                       /*
-                        * We don't enable ETH interface for
-                        * 1. IB representors
-                        * 2. User disabled ROCE through devlink interface
-                        */
+               if (err)
                        return err;
 
                err = mlx5_enable_eth(dev);
@@ -3980,8 +3960,7 @@ static void mlx5_ib_roce_cleanup(struct mlx5_ib_dev *dev)
        ll = mlx5_port_type_cap_to_rdma_ll(port_type_cap);
 
        if (ll == IB_LINK_LAYER_ETHERNET) {
-               if (!dev->is_rep)
-                       mlx5_disable_eth(dev);
+               mlx5_disable_eth(dev);
 
                port_num = mlx5_core_native_port_num(dev->mdev) - 1;
                mlx5_remove_netdev_notifier(dev, port_num);
@@ -4037,7 +4016,7 @@ static int mlx5_ib_stage_ib_reg_init(struct mlx5_ib_dev *dev)
 {
        const char *name;
 
-       if (!mlx5_lag_is_roce(dev->mdev))
+       if (!mlx5_lag_is_active(dev->mdev))
                name = "mlx5_%d";
        else
                name = "mlx5_bond_%d";
@@ -4053,7 +4032,7 @@ static void mlx5_ib_stage_pre_ib_reg_umr_cleanup(struct mlx5_ib_dev *dev)
                mlx5_ib_warn(dev, "mr cache cleanup failed\n");
 
        if (dev->umrc.qp)
-               mlx5_ib_destroy_qp(dev->umrc.qp, NULL);
+               ib_destroy_qp(dev->umrc.qp);
        if (dev->umrc.cq)
                ib_free_cq(dev->umrc.cq);
        if (dev->umrc.pd)
@@ -4106,23 +4085,17 @@ static int mlx5_ib_stage_post_ib_reg_umr_init(struct mlx5_ib_dev *dev)
        init_attr->cap.max_send_sge = 1;
        init_attr->qp_type = MLX5_IB_QPT_REG_UMR;
        init_attr->port_num = 1;
-       qp = mlx5_ib_create_qp(pd, init_attr, NULL);
+       qp = ib_create_qp(pd, init_attr);
        if (IS_ERR(qp)) {
                mlx5_ib_dbg(dev, "Couldn't create sync UMR QP\n");
                ret = PTR_ERR(qp);
                goto error_3;
        }
-       qp->device     = &dev->ib_dev;
-       qp->real_qp    = qp;
-       qp->uobject    = NULL;
-       qp->qp_type    = MLX5_IB_QPT_REG_UMR;
-       qp->send_cq    = init_attr->send_cq;
-       qp->recv_cq    = init_attr->recv_cq;
 
        attr->qp_state = IB_QPS_INIT;
        attr->port_num = 1;
-       ret = mlx5_ib_modify_qp(qp, attr, IB_QP_STATE | IB_QP_PKEY_INDEX |
-                               IB_QP_PORT, NULL);
+       ret = ib_modify_qp(qp, attr,
+                          IB_QP_STATE | IB_QP_PKEY_INDEX | IB_QP_PORT);
        if (ret) {
                mlx5_ib_dbg(dev, "Couldn't modify UMR QP\n");
                goto error_4;
@@ -4132,7 +4105,7 @@ static int mlx5_ib_stage_post_ib_reg_umr_init(struct mlx5_ib_dev *dev)
        attr->qp_state = IB_QPS_RTR;
        attr->path_mtu = IB_MTU_256;
 
-       ret = mlx5_ib_modify_qp(qp, attr, IB_QP_STATE, NULL);
+       ret = ib_modify_qp(qp, attr, IB_QP_STATE);
        if (ret) {
                mlx5_ib_dbg(dev, "Couldn't modify umr QP to rtr\n");
                goto error_4;
@@ -4140,7 +4113,7 @@ static int mlx5_ib_stage_post_ib_reg_umr_init(struct mlx5_ib_dev *dev)
 
        memset(attr, 0, sizeof(*attr));
        attr->qp_state = IB_QPS_RTS;
-       ret = mlx5_ib_modify_qp(qp, attr, IB_QP_STATE, NULL);
+       ret = ib_modify_qp(qp, attr, IB_QP_STATE);
        if (ret) {
                mlx5_ib_dbg(dev, "Couldn't modify umr QP to rts\n");
                goto error_4;
@@ -4163,7 +4136,7 @@ static int mlx5_ib_stage_post_ib_reg_umr_init(struct mlx5_ib_dev *dev)
        return 0;
 
 error_4:
-       mlx5_ib_destroy_qp(qp, NULL);
+       ib_destroy_qp(qp);
        dev->umrc.qp = NULL;
 
 error_3:
index 585fb00bdce8fa7dd4c7d376f5586a841e9cdb58..bf20a388eabe13e09ab8e9ac29297e8510aac29f 100644 (file)
@@ -795,8 +795,6 @@ struct mlx5_ib_resources {
        struct ib_srq   *s0;
        struct ib_srq   *s1;
        struct mlx5_ib_port_resources ports[2];
-       /* Protects changes to the port resources */
-       struct mutex    mutex;
 };
 
 struct mlx5_ib_counters {
@@ -1221,9 +1219,8 @@ int mlx5_ib_post_srq_recv(struct ib_srq *ibsrq, const struct ib_recv_wr *wr,
                          const struct ib_recv_wr **bad_wr);
 int mlx5_ib_enable_lb(struct mlx5_ib_dev *dev, bool td, bool qp);
 void mlx5_ib_disable_lb(struct mlx5_ib_dev *dev, bool td, bool qp);
-struct ib_qp *mlx5_ib_create_qp(struct ib_pd *pd,
-                               struct ib_qp_init_attr *init_attr,
-                               struct ib_udata *udata);
+int mlx5_ib_create_qp(struct ib_qp *qp, struct ib_qp_init_attr *init_attr,
+                     struct ib_udata *udata);
 int mlx5_ib_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr,
                      int attr_mask, struct ib_udata *udata);
 int mlx5_ib_query_qp(struct ib_qp *ibqp, struct ib_qp_attr *qp_attr, int qp_attr_mask,
index a77db29f8391481db329c300127c39db67e74ea7..b2fca110346c1740fe9a5912165ffe4270e667b0 100644 (file)
@@ -1906,7 +1906,6 @@ static int get_atomic_mode(struct mlx5_ib_dev *dev,
 static int create_xrc_tgt_qp(struct mlx5_ib_dev *dev, struct mlx5_ib_qp *qp,
                             struct mlx5_create_qp_params *params)
 {
-       struct mlx5_ib_create_qp *ucmd = params->ucmd;
        struct ib_qp_init_attr *attr = params->attr;
        u32 uidx = params->uidx;
        struct mlx5_ib_resources *devr = &dev->devr;
@@ -1926,8 +1925,6 @@ static int create_xrc_tgt_qp(struct mlx5_ib_dev *dev, struct mlx5_ib_qp *qp,
        if (!in)
                return -ENOMEM;
 
-       if (MLX5_CAP_GEN(mdev, ece_support) && ucmd)
-               MLX5_SET(create_qp_in, in, ece, ucmd->ece_options);
        qpc = MLX5_ADDR_OF(create_qp_in, in, qpc);
 
        MLX5_SET(qpc, qpc, st, MLX5_QP_ST_XRC);
@@ -1982,6 +1979,167 @@ static int create_xrc_tgt_qp(struct mlx5_ib_dev *dev, struct mlx5_ib_qp *qp,
        return 0;
 }
 
+static int create_dci(struct mlx5_ib_dev *dev, struct ib_pd *pd,
+                     struct mlx5_ib_qp *qp,
+                     struct mlx5_create_qp_params *params)
+{
+       struct ib_qp_init_attr *init_attr = params->attr;
+       struct mlx5_ib_create_qp *ucmd = params->ucmd;
+       u32 out[MLX5_ST_SZ_DW(create_qp_out)] = {};
+       struct ib_udata *udata = params->udata;
+       u32 uidx = params->uidx;
+       struct mlx5_ib_resources *devr = &dev->devr;
+       int inlen = MLX5_ST_SZ_BYTES(create_qp_in);
+       struct mlx5_core_dev *mdev = dev->mdev;
+       struct mlx5_ib_cq *send_cq;
+       struct mlx5_ib_cq *recv_cq;
+       unsigned long flags;
+       struct mlx5_ib_qp_base *base;
+       int ts_format;
+       int mlx5_st;
+       void *qpc;
+       u32 *in;
+       int err;
+
+       spin_lock_init(&qp->sq.lock);
+       spin_lock_init(&qp->rq.lock);
+
+       mlx5_st = to_mlx5_st(qp->type);
+       if (mlx5_st < 0)
+               return -EINVAL;
+
+       if (init_attr->sq_sig_type == IB_SIGNAL_ALL_WR)
+               qp->sq_signal_bits = MLX5_WQE_CTRL_CQ_UPDATE;
+
+       base = &qp->trans_qp.base;
+
+       qp->has_rq = qp_has_rq(init_attr);
+       err = set_rq_size(dev, &init_attr->cap, qp->has_rq, qp, ucmd);
+       if (err) {
+               mlx5_ib_dbg(dev, "err %d\n", err);
+               return err;
+       }
+
+       if (ucmd->rq_wqe_shift != qp->rq.wqe_shift ||
+           ucmd->rq_wqe_count != qp->rq.wqe_cnt)
+               return -EINVAL;
+
+       if (ucmd->sq_wqe_count > (1 << MLX5_CAP_GEN(mdev, log_max_qp_sz)))
+               return -EINVAL;
+
+       ts_format = get_qp_ts_format(dev, to_mcq(init_attr->send_cq),
+                                    to_mcq(init_attr->recv_cq));
+
+       if (ts_format < 0)
+               return ts_format;
+
+       err = _create_user_qp(dev, pd, qp, udata, init_attr, &in, &params->resp,
+                             &inlen, base, ucmd);
+       if (err)
+               return err;
+
+       if (MLX5_CAP_GEN(mdev, ece_support))
+               MLX5_SET(create_qp_in, in, ece, ucmd->ece_options);
+       qpc = MLX5_ADDR_OF(create_qp_in, in, qpc);
+
+       MLX5_SET(qpc, qpc, st, mlx5_st);
+       MLX5_SET(qpc, qpc, pm_state, MLX5_QP_PM_MIGRATED);
+       MLX5_SET(qpc, qpc, pd, to_mpd(pd)->pdn);
+
+       if (qp->flags_en & MLX5_QP_FLAG_SIGNATURE)
+               MLX5_SET(qpc, qpc, wq_signature, 1);
+
+       if (qp->flags & IB_QP_CREATE_CROSS_CHANNEL)
+               MLX5_SET(qpc, qpc, cd_master, 1);
+       if (qp->flags & IB_QP_CREATE_MANAGED_SEND)
+               MLX5_SET(qpc, qpc, cd_slave_send, 1);
+       if (qp->flags_en & MLX5_QP_FLAG_SCATTER_CQE)
+               configure_requester_scat_cqe(dev, qp, init_attr, qpc);
+
+       if (qp->rq.wqe_cnt) {
+               MLX5_SET(qpc, qpc, log_rq_stride, qp->rq.wqe_shift - 4);
+               MLX5_SET(qpc, qpc, log_rq_size, ilog2(qp->rq.wqe_cnt));
+       }
+
+       if (qp->flags_en & MLX5_QP_FLAG_DCI_STREAM) {
+               MLX5_SET(qpc, qpc, log_num_dci_stream_channels,
+                        ucmd->dci_streams.log_num_concurent);
+               MLX5_SET(qpc, qpc, log_num_dci_errored_streams,
+                        ucmd->dci_streams.log_num_errored);
+       }
+
+       MLX5_SET(qpc, qpc, ts_format, ts_format);
+       MLX5_SET(qpc, qpc, rq_type, get_rx_type(qp, init_attr));
+
+       MLX5_SET(qpc, qpc, log_sq_size, ilog2(qp->sq.wqe_cnt));
+
+       /* Set default resources */
+       if (init_attr->srq) {
+               MLX5_SET(qpc, qpc, xrcd, devr->xrcdn0);
+               MLX5_SET(qpc, qpc, srqn_rmpn_xrqn,
+                        to_msrq(init_attr->srq)->msrq.srqn);
+       } else {
+               MLX5_SET(qpc, qpc, xrcd, devr->xrcdn1);
+               MLX5_SET(qpc, qpc, srqn_rmpn_xrqn,
+                        to_msrq(devr->s1)->msrq.srqn);
+       }
+
+       if (init_attr->send_cq)
+               MLX5_SET(qpc, qpc, cqn_snd,
+                        to_mcq(init_attr->send_cq)->mcq.cqn);
+
+       if (init_attr->recv_cq)
+               MLX5_SET(qpc, qpc, cqn_rcv,
+                        to_mcq(init_attr->recv_cq)->mcq.cqn);
+
+       MLX5_SET64(qpc, qpc, dbr_addr, qp->db.dma);
+
+       /* 0xffffff means we ask to work with cqe version 0 */
+       if (MLX5_CAP_GEN(mdev, cqe_version) == MLX5_CQE_VERSION_V1)
+               MLX5_SET(qpc, qpc, user_index, uidx);
+
+       if (qp->flags & IB_QP_CREATE_PCI_WRITE_END_PADDING) {
+               MLX5_SET(qpc, qpc, end_padding_mode,
+                        MLX5_WQ_END_PAD_MODE_ALIGN);
+               /* Special case to clean flag */
+               qp->flags &= ~IB_QP_CREATE_PCI_WRITE_END_PADDING;
+       }
+
+       err = mlx5_qpc_create_qp(dev, &base->mqp, in, inlen, out);
+
+       kvfree(in);
+       if (err)
+               goto err_create;
+
+       base->container_mibqp = qp;
+       base->mqp.event = mlx5_ib_qp_event;
+       if (MLX5_CAP_GEN(mdev, ece_support))
+               params->resp.ece_options = MLX5_GET(create_qp_out, out, ece);
+
+       get_cqs(qp->type, init_attr->send_cq, init_attr->recv_cq,
+               &send_cq, &recv_cq);
+       spin_lock_irqsave(&dev->reset_flow_resource_lock, flags);
+       mlx5_ib_lock_cqs(send_cq, recv_cq);
+       /* Maintain device to QPs access, needed for further handling via reset
+        * flow
+        */
+       list_add_tail(&qp->qps_list, &dev->qp_list);
+       /* Maintain CQ to QPs access, needed for further handling via reset flow
+        */
+       if (send_cq)
+               list_add_tail(&qp->cq_send_list, &send_cq->list_send_qp);
+       if (recv_cq)
+               list_add_tail(&qp->cq_recv_list, &recv_cq->list_recv_qp);
+       mlx5_ib_unlock_cqs(send_cq, recv_cq);
+       spin_unlock_irqrestore(&dev->reset_flow_resource_lock, flags);
+
+       return 0;
+
+err_create:
+       destroy_qp(dev, qp, base, udata);
+       return err;
+}
+
 static int create_user_qp(struct mlx5_ib_dev *dev, struct ib_pd *pd,
                          struct mlx5_ib_qp *qp,
                          struct mlx5_create_qp_params *params)
@@ -2512,7 +2670,6 @@ static int create_dct(struct mlx5_ib_dev *dev, struct ib_pd *pd,
        }
 
        qp->state = IB_QPS_RESET;
-       rdma_restrack_no_track(&qp->ibqp.res);
        return 0;
 }
 
@@ -2653,6 +2810,9 @@ static int process_vendor_flags(struct mlx5_ib_dev *dev, struct mlx5_ib_qp *qp,
 
        process_vendor_flag(dev, &flags, MLX5_QP_FLAG_TYPE_DCI, true, qp);
        process_vendor_flag(dev, &flags, MLX5_QP_FLAG_TYPE_DCT, true, qp);
+       process_vendor_flag(dev, &flags, MLX5_QP_FLAG_DCI_STREAM,
+                           MLX5_CAP_GEN(mdev, log_max_dci_stream_channels),
+                           qp);
 
        process_vendor_flag(dev, &flags, MLX5_QP_FLAG_SIGNATURE, true, qp);
        process_vendor_flag(dev, &flags, MLX5_QP_FLAG_SCATTER_CQE,
@@ -2847,6 +3007,10 @@ static int create_qp(struct mlx5_ib_dev *dev, struct ib_pd *pd,
        switch (qp->type) {
        case MLX5_IB_QPT_DCT:
                err = create_dct(dev, pd, qp, params);
+               rdma_restrack_no_track(&qp->ibqp.res);
+               break;
+       case MLX5_IB_QPT_DCI:
+               err = create_dci(dev, pd, qp, params);
                break;
        case IB_QPT_XRC_TGT:
                err = create_xrc_tgt_qp(dev, qp, params);
@@ -2854,6 +3018,10 @@ static int create_qp(struct mlx5_ib_dev *dev, struct ib_pd *pd,
        case IB_QPT_GSI:
                err = mlx5_ib_create_gsi(pd, qp, params->attr);
                break;
+       case MLX5_IB_QPT_HW_GSI:
+       case MLX5_IB_QPT_REG_UMR:
+               rdma_restrack_no_track(&qp->ibqp.res);
+               fallthrough;
        default:
                if (params->udata)
                        err = create_user_qp(dev, pd, qp, params);
@@ -2942,7 +3110,6 @@ static int mlx5_ib_destroy_dct(struct mlx5_ib_qp *mqp)
        }
 
        kfree(mqp->dct.in);
-       kfree(mqp);
        return 0;
 }
 
@@ -2980,25 +3147,23 @@ static int check_ucmd_data(struct mlx5_ib_dev *dev,
        return ret ? 0 : -EINVAL;
 }
 
-struct ib_qp *mlx5_ib_create_qp(struct ib_pd *pd, struct ib_qp_init_attr *attr,
-                               struct ib_udata *udata)
+int mlx5_ib_create_qp(struct ib_qp *ibqp, struct ib_qp_init_attr *attr,
+                     struct ib_udata *udata)
 {
        struct mlx5_create_qp_params params = {};
-       struct mlx5_ib_dev *dev;
-       struct mlx5_ib_qp *qp;
+       struct mlx5_ib_dev *dev = to_mdev(ibqp->device);
+       struct mlx5_ib_qp *qp = to_mqp(ibqp);
+       struct ib_pd *pd = ibqp->pd;
        enum ib_qp_type type;
        int err;
 
-       dev = pd ? to_mdev(pd->device) :
-                  to_mdev(to_mxrcd(attr->xrcd)->ibxrcd.device);
-
        err = check_qp_type(dev, attr, &type);
        if (err)
-               return ERR_PTR(err);
+               return err;
 
        err = check_valid_flow(dev, pd, attr, udata);
        if (err)
-               return ERR_PTR(err);
+               return err;
 
        params.udata = udata;
        params.uidx = MLX5_IB_DEFAULT_UIDX;
@@ -3008,49 +3173,43 @@ struct ib_qp *mlx5_ib_create_qp(struct ib_pd *pd, struct ib_qp_init_attr *attr,
        if (udata) {
                err = process_udata_size(dev, &params);
                if (err)
-                       return ERR_PTR(err);
+                       return err;
 
                err = check_ucmd_data(dev, &params);
                if (err)
-                       return ERR_PTR(err);
+                       return err;
 
                params.ucmd = kzalloc(params.ucmd_size, GFP_KERNEL);
                if (!params.ucmd)
-                       return ERR_PTR(-ENOMEM);
+                       return -ENOMEM;
 
                err = ib_copy_from_udata(params.ucmd, udata, params.inlen);
                if (err)
                        goto free_ucmd;
        }
 
-       qp = kzalloc(sizeof(*qp), GFP_KERNEL);
-       if (!qp) {
-               err = -ENOMEM;
-               goto free_ucmd;
-       }
-
        mutex_init(&qp->mutex);
        qp->type = type;
        if (udata) {
                err = process_vendor_flags(dev, qp, params.ucmd, attr);
                if (err)
-                       goto free_qp;
+                       goto free_ucmd;
 
                err = get_qp_uidx(qp, &params);
                if (err)
-                       goto free_qp;
+                       goto free_ucmd;
        }
        err = process_create_flags(dev, qp, attr);
        if (err)
-               goto free_qp;
+               goto free_ucmd;
 
        err = check_qp_attr(dev, qp, attr);
        if (err)
-               goto free_qp;
+               goto free_ucmd;
 
        err = create_qp(dev, pd, qp, &params);
        if (err)
-               goto free_qp;
+               goto free_ucmd;
 
        kfree(params.ucmd);
        params.ucmd = NULL;
@@ -3065,7 +3224,7 @@ struct ib_qp *mlx5_ib_create_qp(struct ib_pd *pd, struct ib_qp_init_attr *attr,
        if (err)
                goto destroy_qp;
 
-       return &qp->ibqp;
+       return 0;
 
 destroy_qp:
        switch (qp->type) {
@@ -3076,22 +3235,12 @@ destroy_qp:
                mlx5_ib_destroy_gsi(qp);
                break;
        default:
-               /*
-                * These lines below are temp solution till QP allocation
-                * will be moved to be under IB/core responsiblity.
-                */
-               qp->ibqp.send_cq = attr->send_cq;
-               qp->ibqp.recv_cq = attr->recv_cq;
-               qp->ibqp.pd = pd;
                destroy_qp_common(dev, qp, udata);
        }
 
-       qp = NULL;
-free_qp:
-       kfree(qp);
 free_ucmd:
        kfree(params.ucmd);
-       return ERR_PTR(err);
+       return err;
 }
 
 int mlx5_ib_destroy_qp(struct ib_qp *qp, struct ib_udata *udata)
@@ -3106,9 +3255,6 @@ int mlx5_ib_destroy_qp(struct ib_qp *qp, struct ib_udata *udata)
                return mlx5_ib_destroy_dct(mqp);
 
        destroy_qp_common(dev, mqp, udata);
-
-       kfree(mqp);
-
        return 0;
 }
 
index c0ddf7b3c6e2ba27d8730604f26173d3de65a650..bbfcce3bdc84ec3af432cb9433e5ea6845165934 100644 (file)
@@ -114,14 +114,18 @@ out:
 static int fill_switchdev_info(struct mlx5_ib_dev *dev, u32 port_num,
                               struct mlx5_ib_uapi_query_port *info)
 {
-       struct mlx5_core_dev *mdev = dev->mdev;
        struct mlx5_eswitch_rep *rep;
+       struct mlx5_core_dev *mdev;
        int err;
 
        rep = dev->port[port_num - 1].rep;
        if (!rep)
                return -EOPNOTSUPP;
 
+       mdev = mlx5_eswitch_get_core_dev(rep->esw);
+       if (!mdev)
+               return -EINVAL;
+
        info->vport = rep->vport;
        info->flags |= MLX5_IB_UAPI_QUERY_PORT_VPORT;
 
@@ -138,9 +142,9 @@ static int fill_switchdev_info(struct mlx5_ib_dev *dev, u32 port_num,
        if (err)
                return err;
 
-       if (mlx5_eswitch_vport_match_metadata_enabled(mdev->priv.eswitch)) {
+       if (mlx5_eswitch_vport_match_metadata_enabled(rep->esw)) {
                info->reg_c0.value = mlx5_eswitch_get_vport_metadata_for_match(
-                       mdev->priv.eswitch, rep->vport);
+                       rep->esw, rep->vport);
                info->reg_c0.mask = mlx5_eswitch_get_vport_metadata_mask();
                info->flags |= MLX5_IB_UAPI_QUERY_PORT_VPORT_REG_C0;
        }
index 2cdf686203c11e0c9f5b95c9a82a33a021bf0179..97287c544da8db17c8ad420a47e0a3d2669c2830 100644 (file)
@@ -617,9 +617,9 @@ static void mthca_free_eq(struct mthca_dev *dev,
 
        mthca_free_mr(dev, &eq->mr);
        for (i = 0; i < npages; ++i)
-               pci_free_consistent(dev->pdev, PAGE_SIZE,
-                                   eq->page_list[i].buf,
-                                   dma_unmap_addr(&eq->page_list[i], mapping));
+               dma_free_coherent(&dev->pdev->dev, PAGE_SIZE,
+                                 eq->page_list[i].buf,
+                                 dma_unmap_addr(&eq->page_list[i], mapping));
 
        kfree(eq->page_list);
        mthca_free_mailbox(dev, mailbox);
@@ -739,17 +739,18 @@ int mthca_map_eq_icm(struct mthca_dev *dev, u64 icm_virt)
        dev->eq_table.icm_page = alloc_page(GFP_HIGHUSER);
        if (!dev->eq_table.icm_page)
                return -ENOMEM;
-       dev->eq_table.icm_dma  = pci_map_page(dev->pdev, dev->eq_table.icm_page, 0,
-                                             PAGE_SIZE, PCI_DMA_BIDIRECTIONAL);
-       if (pci_dma_mapping_error(dev->pdev, dev->eq_table.icm_dma)) {
+       dev->eq_table.icm_dma =
+               dma_map_page(&dev->pdev->dev, dev->eq_table.icm_page, 0,
+                            PAGE_SIZE, DMA_BIDIRECTIONAL);
+       if (dma_mapping_error(&dev->pdev->dev, dev->eq_table.icm_dma)) {
                __free_page(dev->eq_table.icm_page);
                return -ENOMEM;
        }
 
        ret = mthca_MAP_ICM_page(dev, dev->eq_table.icm_dma, icm_virt);
        if (ret) {
-               pci_unmap_page(dev->pdev, dev->eq_table.icm_dma, PAGE_SIZE,
-                              PCI_DMA_BIDIRECTIONAL);
+               dma_unmap_page(&dev->pdev->dev, dev->eq_table.icm_dma,
+                              PAGE_SIZE, DMA_BIDIRECTIONAL);
                __free_page(dev->eq_table.icm_page);
        }
 
@@ -759,8 +760,8 @@ int mthca_map_eq_icm(struct mthca_dev *dev, u64 icm_virt)
 void mthca_unmap_eq_icm(struct mthca_dev *dev)
 {
        mthca_UNMAP_ICM(dev, dev->eq_table.icm_virt, 1);
-       pci_unmap_page(dev->pdev, dev->eq_table.icm_dma, PAGE_SIZE,
-                      PCI_DMA_BIDIRECTIONAL);
+       dma_unmap_page(&dev->pdev->dev, dev->eq_table.icm_dma, PAGE_SIZE,
+                      DMA_BIDIRECTIONAL);
        __free_page(dev->eq_table.icm_page);
 }
 
index fe9654a7af713a30f562699f81521dffbcf1727e..f507c4cd46d3c87944ed1cb8efb0799cb6306f99 100644 (file)
@@ -937,26 +937,15 @@ static int __mthca_init_one(struct pci_dev *pdev, int hca_type)
 
        pci_set_master(pdev);
 
-       err = pci_set_dma_mask(pdev, DMA_BIT_MASK(64));
+       err = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64));
        if (err) {
                dev_warn(&pdev->dev, "Warning: couldn't set 64-bit PCI DMA mask.\n");
-               err = pci_set_dma_mask(pdev, DMA_BIT_MASK(32));
+               err = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));
                if (err) {
                        dev_err(&pdev->dev, "Can't set PCI DMA mask, aborting.\n");
                        goto err_free_res;
                }
        }
-       err = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(64));
-       if (err) {
-               dev_warn(&pdev->dev, "Warning: couldn't set 64-bit "
-                        "consistent PCI DMA mask.\n");
-               err = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32));
-               if (err) {
-                       dev_err(&pdev->dev, "Can't set consistent PCI DMA mask, "
-                               "aborting.\n");
-                       goto err_free_res;
-               }
-       }
 
        /* We can handle large RDMA requests, so allow larger segments. */
        dma_set_max_seg_size(&pdev->dev, 1024 * 1024 * 1024);
index fa808582b08b7c48be085182b4769e8801cc659f..f2734a5c5f26fdb944ee894bdfb2bf2254f747d9 100644 (file)
@@ -66,8 +66,8 @@ static void mthca_free_icm_pages(struct mthca_dev *dev, struct mthca_icm_chunk *
        int i;
 
        if (chunk->nsg > 0)
-               pci_unmap_sg(dev->pdev, chunk->mem, chunk->npages,
-                            PCI_DMA_BIDIRECTIONAL);
+               dma_unmap_sg(&dev->pdev->dev, chunk->mem, chunk->npages,
+                            DMA_BIDIRECTIONAL);
 
        for (i = 0; i < chunk->npages; ++i)
                __free_pages(sg_page(&chunk->mem[i]),
@@ -184,9 +184,10 @@ struct mthca_icm *mthca_alloc_icm(struct mthca_dev *dev, int npages,
                        if (coherent)
                                ++chunk->nsg;
                        else if (chunk->npages == MTHCA_ICM_CHUNK_LEN) {
-                               chunk->nsg = pci_map_sg(dev->pdev, chunk->mem,
-                                                       chunk->npages,
-                                                       PCI_DMA_BIDIRECTIONAL);
+                               chunk->nsg =
+                                       dma_map_sg(&dev->pdev->dev, chunk->mem,
+                                                  chunk->npages,
+                                                  DMA_BIDIRECTIONAL);
 
                                if (chunk->nsg <= 0)
                                        goto fail;
@@ -204,9 +205,8 @@ struct mthca_icm *mthca_alloc_icm(struct mthca_dev *dev, int npages,
        }
 
        if (!coherent && chunk) {
-               chunk->nsg = pci_map_sg(dev->pdev, chunk->mem,
-                                       chunk->npages,
-                                       PCI_DMA_BIDIRECTIONAL);
+               chunk->nsg = dma_map_sg(&dev->pdev->dev, chunk->mem,
+                                       chunk->npages, DMA_BIDIRECTIONAL);
 
                if (chunk->nsg <= 0)
                        goto fail;
@@ -480,7 +480,8 @@ int mthca_map_user_db(struct mthca_dev *dev, struct mthca_uar *uar,
        sg_set_page(&db_tab->page[i].mem, pages[0], MTHCA_ICM_PAGE_SIZE,
                        uaddr & ~PAGE_MASK);
 
-       ret = pci_map_sg(dev->pdev, &db_tab->page[i].mem, 1, PCI_DMA_TODEVICE);
+       ret = dma_map_sg(&dev->pdev->dev, &db_tab->page[i].mem, 1,
+                        DMA_TO_DEVICE);
        if (ret < 0) {
                unpin_user_page(pages[0]);
                goto out;
@@ -489,7 +490,8 @@ int mthca_map_user_db(struct mthca_dev *dev, struct mthca_uar *uar,
        ret = mthca_MAP_ICM_page(dev, sg_dma_address(&db_tab->page[i].mem),
                                 mthca_uarc_virt(dev, uar, i));
        if (ret) {
-               pci_unmap_sg(dev->pdev, &db_tab->page[i].mem, 1, PCI_DMA_TODEVICE);
+               dma_unmap_sg(&dev->pdev->dev, &db_tab->page[i].mem, 1,
+                            DMA_TO_DEVICE);
                unpin_user_page(sg_page(&db_tab->page[i].mem));
                goto out;
        }
@@ -555,7 +557,8 @@ void mthca_cleanup_user_db_tab(struct mthca_dev *dev, struct mthca_uar *uar,
        for (i = 0; i < dev->uar_table.uarc_size / MTHCA_ICM_PAGE_SIZE; ++i) {
                if (db_tab->page[i].uvirt) {
                        mthca_UNMAP_ICM(dev, mthca_uarc_virt(dev, uar, i), 1);
-                       pci_unmap_sg(dev->pdev, &db_tab->page[i].mem, 1, PCI_DMA_TODEVICE);
+                       dma_unmap_sg(&dev->pdev->dev, &db_tab->page[i].mem, 1,
+                                    DMA_TO_DEVICE);
                        unpin_user_page(sg_page(&db_tab->page[i].mem));
                }
        }
index adf4fcf0fee47c5109b0c665734756505defba12..ceee23ebc0f2e0073408d499bc2ffd04216eee2b 100644 (file)
@@ -459,52 +459,45 @@ static int mthca_destroy_srq(struct ib_srq *srq, struct ib_udata *udata)
        return 0;
 }
 
-static struct ib_qp *mthca_create_qp(struct ib_pd *pd,
-                                    struct ib_qp_init_attr *init_attr,
-                                    struct ib_udata *udata)
+static int mthca_create_qp(struct ib_qp *ibqp,
+                          struct ib_qp_init_attr *init_attr,
+                          struct ib_udata *udata)
 {
        struct mthca_ucontext *context = rdma_udata_to_drv_context(
                udata, struct mthca_ucontext, ibucontext);
        struct mthca_create_qp ucmd;
-       struct mthca_qp *qp;
+       struct mthca_qp *qp = to_mqp(ibqp);
+       struct mthca_dev *dev = to_mdev(ibqp->device);
        int err;
 
        if (init_attr->create_flags)
-               return ERR_PTR(-EOPNOTSUPP);
+               return -EOPNOTSUPP;
 
        switch (init_attr->qp_type) {
        case IB_QPT_RC:
        case IB_QPT_UC:
        case IB_QPT_UD:
        {
-               qp = kzalloc(sizeof(*qp), GFP_KERNEL);
-               if (!qp)
-                       return ERR_PTR(-ENOMEM);
-
                if (udata) {
-                       if (ib_copy_from_udata(&ucmd, udata, sizeof ucmd)) {
-                               kfree(qp);
-                               return ERR_PTR(-EFAULT);
-                       }
+                       if (ib_copy_from_udata(&ucmd, udata, sizeof(ucmd)))
+                               return -EFAULT;
 
-                       err = mthca_map_user_db(to_mdev(pd->device), &context->uar,
+                       err = mthca_map_user_db(dev, &context->uar,
                                                context->db_tab,
-                                               ucmd.sq_db_index, ucmd.sq_db_page);
-                       if (err) {
-                               kfree(qp);
-                               return ERR_PTR(err);
-                       }
+                                               ucmd.sq_db_index,
+                                               ucmd.sq_db_page);
+                       if (err)
+                               return err;
 
-                       err = mthca_map_user_db(to_mdev(pd->device), &context->uar,
+                       err = mthca_map_user_db(dev, &context->uar,
                                                context->db_tab,
-                                               ucmd.rq_db_index, ucmd.rq_db_page);
+                                               ucmd.rq_db_index,
+                                               ucmd.rq_db_page);
                        if (err) {
-                               mthca_unmap_user_db(to_mdev(pd->device),
-                                                   &context->uar,
+                               mthca_unmap_user_db(dev, &context->uar,
                                                    context->db_tab,
                                                    ucmd.sq_db_index);
-                               kfree(qp);
-                               return ERR_PTR(err);
+                               return err;
                        }
 
                        qp->mr.ibmr.lkey = ucmd.lkey;
@@ -512,20 +505,16 @@ static struct ib_qp *mthca_create_qp(struct ib_pd *pd,
                        qp->rq.db_index  = ucmd.rq_db_index;
                }
 
-               err = mthca_alloc_qp(to_mdev(pd->device), to_mpd(pd),
+               err = mthca_alloc_qp(dev, to_mpd(ibqp->pd),
                                     to_mcq(init_attr->send_cq),
                                     to_mcq(init_attr->recv_cq),
                                     init_attr->qp_type, init_attr->sq_sig_type,
                                     &init_attr->cap, qp, udata);
 
                if (err && udata) {
-                       mthca_unmap_user_db(to_mdev(pd->device),
-                                           &context->uar,
-                                           context->db_tab,
+                       mthca_unmap_user_db(dev, &context->uar, context->db_tab,
                                            ucmd.sq_db_index);
-                       mthca_unmap_user_db(to_mdev(pd->device),
-                                           &context->uar,
-                                           context->db_tab,
+                       mthca_unmap_user_db(dev, &context->uar, context->db_tab,
                                            ucmd.rq_db_index);
                }
 
@@ -535,34 +524,28 @@ static struct ib_qp *mthca_create_qp(struct ib_pd *pd,
        case IB_QPT_SMI:
        case IB_QPT_GSI:
        {
-               qp = kzalloc(sizeof(*qp), GFP_KERNEL);
-               if (!qp)
-                       return ERR_PTR(-ENOMEM);
                qp->sqp = kzalloc(sizeof(struct mthca_sqp), GFP_KERNEL);
-               if (!qp->sqp) {
-                       kfree(qp);
-                       return ERR_PTR(-ENOMEM);
-               }
+               if (!qp->sqp)
+                       return -ENOMEM;
 
                qp->ibqp.qp_num = init_attr->qp_type == IB_QPT_SMI ? 0 : 1;
 
-               err = mthca_alloc_sqp(to_mdev(pd->device), to_mpd(pd),
+               err = mthca_alloc_sqp(dev, to_mpd(ibqp->pd),
                                      to_mcq(init_attr->send_cq),
                                      to_mcq(init_attr->recv_cq),
                                      init_attr->sq_sig_type, &init_attr->cap,
-                                     qp->ibqp.qp_num, init_attr->port_num,
-                                     qp, udata);
+                                     qp->ibqp.qp_num, init_attr->port_num, qp,
+                                     udata);
                break;
        }
        default:
                /* Don't support raw QPs */
-               return ERR_PTR(-EOPNOTSUPP);
+               return -EOPNOTSUPP;
        }
 
        if (err) {
                kfree(qp->sqp);
-               kfree(qp);
-               return ERR_PTR(err);
+               return err;
        }
 
        init_attr->cap.max_send_wr     = qp->sq.max;
@@ -571,7 +554,7 @@ static struct ib_qp *mthca_create_qp(struct ib_pd *pd,
        init_attr->cap.max_recv_sge    = qp->rq.max_gs;
        init_attr->cap.max_inline_data = qp->max_inline_data;
 
-       return &qp->ibqp;
+       return 0;
 }
 
 static int mthca_destroy_qp(struct ib_qp *qp, struct ib_udata *udata)
@@ -594,7 +577,6 @@ static int mthca_destroy_qp(struct ib_qp *qp, struct ib_udata *udata)
        }
        mthca_free_qp(to_mdev(qp->device), to_mqp(qp));
        kfree(to_mqp(qp)->sqp);
-       kfree(to_mqp(qp));
        return 0;
 }
 
@@ -1121,6 +1103,7 @@ static const struct ib_device_ops mthca_dev_ops = {
        INIT_RDMA_OBJ_SIZE(ib_ah, mthca_ah, ibah),
        INIT_RDMA_OBJ_SIZE(ib_cq, mthca_cq, ibcq),
        INIT_RDMA_OBJ_SIZE(ib_pd, mthca_pd, ibpd),
+       INIT_RDMA_OBJ_SIZE(ib_qp, mthca_qp, ibqp),
        INIT_RDMA_OBJ_SIZE(ib_ucontext, mthca_ucontext, ibucontext),
 };
 
index f329db0c591f088bc0154e36bdc87971f69a89bc..7abf6cf1e93782ffa31b9a5af1afaf6009f29acc 100644 (file)
@@ -185,6 +185,7 @@ static const struct ib_device_ops ocrdma_dev_ops = {
        INIT_RDMA_OBJ_SIZE(ib_ah, ocrdma_ah, ibah),
        INIT_RDMA_OBJ_SIZE(ib_cq, ocrdma_cq, ibcq),
        INIT_RDMA_OBJ_SIZE(ib_pd, ocrdma_pd, ibpd),
+       INIT_RDMA_OBJ_SIZE(ib_qp, ocrdma_qp, ibqp),
        INIT_RDMA_OBJ_SIZE(ib_ucontext, ocrdma_ucontext, ibucontext),
 };
 
index 58619ce64d0d3a055a32ba77144f19d4397b067a..735123d0e9ecec254de96edcccedf66614e70732 100644 (file)
@@ -1288,19 +1288,19 @@ static void ocrdma_store_gsi_qp_cq(struct ocrdma_dev *dev,
        }
 }
 
-struct ib_qp *ocrdma_create_qp(struct ib_pd *ibpd,
-                              struct ib_qp_init_attr *attrs,
-                              struct ib_udata *udata)
+int ocrdma_create_qp(struct ib_qp *ibqp, struct ib_qp_init_attr *attrs,
+                    struct ib_udata *udata)
 {
        int status;
+       struct ib_pd *ibpd = ibqp->pd;
        struct ocrdma_pd *pd = get_ocrdma_pd(ibpd);
-       struct ocrdma_qp *qp;
-       struct ocrdma_dev *dev = get_ocrdma_dev(ibpd->device);
+       struct ocrdma_qp *qp = get_ocrdma_qp(ibqp);
+       struct ocrdma_dev *dev = get_ocrdma_dev(ibqp->device);
        struct ocrdma_create_qp_ureq ureq;
        u16 dpp_credit_lmt, dpp_offset;
 
        if (attrs->create_flags)
-               return ERR_PTR(-EOPNOTSUPP);
+               return -EOPNOTSUPP;
 
        status = ocrdma_check_qp_params(ibpd, dev, attrs, udata);
        if (status)
@@ -1309,12 +1309,7 @@ struct ib_qp *ocrdma_create_qp(struct ib_pd *ibpd,
        memset(&ureq, 0, sizeof(ureq));
        if (udata) {
                if (ib_copy_from_udata(&ureq, udata, sizeof(ureq)))
-                       return ERR_PTR(-EFAULT);
-       }
-       qp = kzalloc(sizeof(*qp), GFP_KERNEL);
-       if (!qp) {
-               status = -ENOMEM;
-               goto gen_err;
+                       return -EFAULT;
        }
        ocrdma_set_qp_init_params(qp, pd, attrs);
        if (udata == NULL)
@@ -1349,7 +1344,7 @@ struct ib_qp *ocrdma_create_qp(struct ib_pd *ibpd,
        ocrdma_store_gsi_qp_cq(dev, attrs);
        qp->ibqp.qp_num = qp->id;
        mutex_unlock(&dev->dev_lock);
-       return &qp->ibqp;
+       return 0;
 
 cpy_err:
        ocrdma_del_qpn_map(dev, qp);
@@ -1359,10 +1354,9 @@ mbx_err:
        mutex_unlock(&dev->dev_lock);
        kfree(qp->wqe_wr_id_tbl);
        kfree(qp->rqe_wr_id_tbl);
-       kfree(qp);
        pr_err("%s(%d) error=%d\n", __func__, dev->id, status);
 gen_err:
-       return ERR_PTR(status);
+       return status;
 }
 
 int _ocrdma_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr,
@@ -1731,7 +1725,6 @@ int ocrdma_destroy_qp(struct ib_qp *ibqp, struct ib_udata *udata)
 
        kfree(qp->wqe_wr_id_tbl);
        kfree(qp->rqe_wr_id_tbl);
-       kfree(qp);
        return 0;
 }
 
index b1c5fad816033946969009759a92844fa58839e0..b73d742a520c5eee5200a98943b2aa8d4d938c53 100644 (file)
@@ -75,9 +75,8 @@ int ocrdma_create_cq(struct ib_cq *ibcq, const struct ib_cq_init_attr *attr,
 int ocrdma_resize_cq(struct ib_cq *, int cqe, struct ib_udata *);
 int ocrdma_destroy_cq(struct ib_cq *ibcq, struct ib_udata *udata);
 
-struct ib_qp *ocrdma_create_qp(struct ib_pd *,
-                              struct ib_qp_init_attr *attrs,
-                              struct ib_udata *);
+int ocrdma_create_qp(struct ib_qp *qp, struct ib_qp_init_attr *attrs,
+                    struct ib_udata *udata);
 int _ocrdma_modify_qp(struct ib_qp *, struct ib_qp_attr *attr,
                      int attr_mask);
 int ocrdma_modify_qp(struct ib_qp *, struct ib_qp_attr *attr,
index de98e0604f914abfb0243df211fe1b37e6160308..755930be01b8e627deafd972cd7fd45cc6dbffed 100644 (file)
@@ -233,6 +233,7 @@ static const struct ib_device_ops qedr_dev_ops = {
        INIT_RDMA_OBJ_SIZE(ib_ah, qedr_ah, ibah),
        INIT_RDMA_OBJ_SIZE(ib_cq, qedr_cq, ibcq),
        INIT_RDMA_OBJ_SIZE(ib_pd, qedr_pd, ibpd),
+       INIT_RDMA_OBJ_SIZE(ib_qp, qedr_qp, ibqp),
        INIT_RDMA_OBJ_SIZE(ib_srq, qedr_srq, ibsrq),
        INIT_RDMA_OBJ_SIZE(ib_xrcd, qedr_xrcd, ibxrcd),
        INIT_RDMA_OBJ_SIZE(ib_ucontext, qedr_ucontext, ibucontext),
index 13e5e6bbec99cb74c72da0be484c7370d4f9b84b..05307c1488b8300b15b177ab84eb40f90ab66021 100644 (file)
@@ -319,20 +319,19 @@ err1:
        return rc;
 }
 
-struct ib_qp *qedr_create_gsi_qp(struct qedr_dev *dev,
-                                struct ib_qp_init_attr *attrs,
-                                struct qedr_qp *qp)
+int qedr_create_gsi_qp(struct qedr_dev *dev, struct ib_qp_init_attr *attrs,
+                      struct qedr_qp *qp)
 {
        int rc;
 
        rc = qedr_check_gsi_qp_attrs(dev, attrs);
        if (rc)
-               return ERR_PTR(rc);
+               return rc;
 
        rc = qedr_ll2_start(dev, attrs, qp);
        if (rc) {
                DP_ERR(dev, "create gsi qp: failed on ll2 start. rc=%d\n", rc);
-               return ERR_PTR(rc);
+               return rc;
        }
 
        /* create QP */
@@ -359,7 +358,7 @@ struct ib_qp *qedr_create_gsi_qp(struct qedr_dev *dev,
 
        DP_DEBUG(dev, QEDR_MSG_GSI, "created GSI QP %p\n", qp);
 
-       return &qp->ibqp;
+       return 0;
 
 err:
        kfree(qp->rqe_wr_id);
@@ -368,7 +367,7 @@ err:
        if (rc)
                DP_ERR(dev, "create gsi qp: failed destroy on create\n");
 
-       return ERR_PTR(-ENOMEM);
+       return -ENOMEM;
 }
 
 int qedr_destroy_gsi_qp(struct qedr_dev *dev)
index d46dcd3f64247099fab3846492315d408103a6d7..f3432f035ec65b85c4159264259311c4d6de10ee 100644 (file)
@@ -50,9 +50,8 @@ int qedr_gsi_post_recv(struct ib_qp *ibqp, const struct ib_recv_wr *wr,
                       const struct ib_recv_wr **bad_wr);
 int qedr_gsi_post_send(struct ib_qp *ibqp, const struct ib_send_wr *wr,
                       const struct ib_send_wr **bad_wr);
-struct ib_qp *qedr_create_gsi_qp(struct qedr_dev *dev,
-                                struct ib_qp_init_attr *attrs,
-                                struct qedr_qp *qp);
+int qedr_create_gsi_qp(struct qedr_dev *dev, struct ib_qp_init_attr *attrs,
+                      struct qedr_qp *qp);
 void qedr_store_gsi_qp_cq(struct qedr_dev *dev,
                          struct qedr_qp *qp, struct ib_qp_init_attr *attrs);
 int qedr_destroy_gsi_qp(struct qedr_dev *dev);
index f23d324bd5e1ebb404c6629bff7ad599aafce69d..3fbf172dbbef41fa6c7c74debd17d6b517a09c41 100644 (file)
@@ -1339,6 +1339,15 @@ static int qedr_copy_qp_uresp(struct qedr_dev *dev,
        return rc;
 }
 
+static void qedr_reset_qp_hwq_info(struct qedr_qp_hwq_info *qph)
+{
+       qed_chain_reset(&qph->pbl);
+       qph->prod = 0;
+       qph->cons = 0;
+       qph->wqe_cons = 0;
+       qph->db_data.data.value = cpu_to_le16(0);
+}
+
 static void qedr_set_common_qp_params(struct qedr_dev *dev,
                                      struct qedr_qp *qp,
                                      struct qedr_pd *pd,
@@ -1354,9 +1363,13 @@ static void qedr_set_common_qp_params(struct qedr_dev *dev,
        qp->qp_type = attrs->qp_type;
        qp->max_inline_data = attrs->cap.max_inline_data;
        qp->state = QED_ROCE_QP_STATE_RESET;
+
+       qp->prev_wqe_size = 0;
+
        qp->signaled = (attrs->sq_sig_type == IB_SIGNAL_ALL_WR) ? true : false;
        qp->dev = dev;
        if (qedr_qp_has_sq(qp)) {
+               qedr_reset_qp_hwq_info(&qp->sq);
                qp->sq.max_sges = attrs->cap.max_send_sge;
                qp->sq_cq = get_qedr_cq(attrs->send_cq);
                DP_DEBUG(dev, QEDR_MSG_QP,
@@ -1368,6 +1381,7 @@ static void qedr_set_common_qp_params(struct qedr_dev *dev,
                qp->srq = get_qedr_srq(attrs->srq);
 
        if (qedr_qp_has_rq(qp)) {
+               qedr_reset_qp_hwq_info(&qp->rq);
                qp->rq_cq = get_qedr_cq(attrs->recv_cq);
                qp->rq.max_sges = attrs->cap.max_recv_sge;
                DP_DEBUG(dev, QEDR_MSG_QP,
@@ -2239,34 +2253,30 @@ static int qedr_free_qp_resources(struct qedr_dev *dev, struct qedr_qp *qp,
        return 0;
 }
 
-struct ib_qp *qedr_create_qp(struct ib_pd *ibpd,
-                            struct ib_qp_init_attr *attrs,
-                            struct ib_udata *udata)
+int qedr_create_qp(struct ib_qp *ibqp, struct ib_qp_init_attr *attrs,
+                  struct ib_udata *udata)
 {
        struct qedr_xrcd *xrcd = NULL;
-       struct qedr_pd *pd = NULL;
-       struct qedr_dev *dev;
-       struct qedr_qp *qp;
-       struct ib_qp *ibqp;
+       struct ib_pd *ibpd = ibqp->pd;
+       struct qedr_pd *pd = get_qedr_pd(ibpd);
+       struct qedr_dev *dev = get_qedr_dev(ibqp->device);
+       struct qedr_qp *qp = get_qedr_qp(ibqp);
        int rc = 0;
 
        if (attrs->create_flags)
-               return ERR_PTR(-EOPNOTSUPP);
+               return -EOPNOTSUPP;
 
-       if (attrs->qp_type == IB_QPT_XRC_TGT) {
+       if (attrs->qp_type == IB_QPT_XRC_TGT)
                xrcd = get_qedr_xrcd(attrs->xrcd);
-               dev = get_qedr_dev(xrcd->ibxrcd.device);
-       } else {
+       else
                pd = get_qedr_pd(ibpd);
-               dev = get_qedr_dev(ibpd->device);
-       }
 
        DP_DEBUG(dev, QEDR_MSG_QP, "create qp: called from %s, pd=%p\n",
                 udata ? "user library" : "kernel", pd);
 
        rc = qedr_check_qp_attrs(ibpd, dev, attrs, udata);
        if (rc)
-               return ERR_PTR(rc);
+               return rc;
 
        DP_DEBUG(dev, QEDR_MSG_QP,
                 "create qp: called from %s, event_handler=%p, eepd=%p sq_cq=%p, sq_icid=%d, rq_cq=%p, rq_icid=%d\n",
@@ -2276,20 +2286,10 @@ struct ib_qp *qedr_create_qp(struct ib_pd *ibpd,
                 get_qedr_cq(attrs->recv_cq),
                 attrs->recv_cq ? get_qedr_cq(attrs->recv_cq)->icid : 0);
 
-       qp = kzalloc(sizeof(*qp), GFP_KERNEL);
-       if (!qp) {
-               DP_ERR(dev, "create qp: failed allocating memory\n");
-               return ERR_PTR(-ENOMEM);
-       }
-
        qedr_set_common_qp_params(dev, qp, pd, attrs);
 
-       if (attrs->qp_type == IB_QPT_GSI) {
-               ibqp = qedr_create_gsi_qp(dev, attrs, qp);
-               if (IS_ERR(ibqp))
-                       kfree(qp);
-               return ibqp;
-       }
+       if (attrs->qp_type == IB_QPT_GSI)
+               return qedr_create_gsi_qp(dev, attrs, qp);
 
        if (udata || xrcd)
                rc = qedr_create_user_qp(dev, qp, ibpd, udata, attrs);
@@ -2297,7 +2297,7 @@ struct ib_qp *qedr_create_qp(struct ib_pd *ibpd,
                rc = qedr_create_kernel_qp(dev, qp, ibpd, attrs);
 
        if (rc)
-               goto out_free_qp;
+               return rc;
 
        qp->ibqp.qp_num = qp->qp_id;
 
@@ -2307,14 +2307,11 @@ struct ib_qp *qedr_create_qp(struct ib_pd *ibpd,
                        goto out_free_qp_resources;
        }
 
-       return &qp->ibqp;
+       return 0;
 
 out_free_qp_resources:
        qedr_free_qp_resources(dev, qp, udata);
-out_free_qp:
-       kfree(qp);
-
-       return ERR_PTR(-EFAULT);
+       return -EFAULT;
 }
 
 static enum ib_qp_state qedr_get_ibqp_state(enum qed_roce_qp_state qp_state)
@@ -2359,15 +2356,6 @@ static enum qed_roce_qp_state qedr_get_state_from_ibqp(
        }
 }
 
-static void qedr_reset_qp_hwq_info(struct qedr_qp_hwq_info *qph)
-{
-       qed_chain_reset(&qph->pbl);
-       qph->prod = 0;
-       qph->cons = 0;
-       qph->wqe_cons = 0;
-       qph->db_data.data.value = cpu_to_le16(0);
-}
-
 static int qedr_update_qp_state(struct qedr_dev *dev,
                                struct qedr_qp *qp,
                                enum qed_roce_qp_state cur_state,
@@ -2382,9 +2370,6 @@ static int qedr_update_qp_state(struct qedr_dev *dev,
        case QED_ROCE_QP_STATE_RESET:
                switch (new_state) {
                case QED_ROCE_QP_STATE_INIT:
-                       qp->prev_wqe_size = 0;
-                       qedr_reset_qp_hwq_info(&qp->sq);
-                       qedr_reset_qp_hwq_info(&qp->rq);
                        break;
                default:
                        status = -EINVAL;
@@ -2874,8 +2859,6 @@ int qedr_destroy_qp(struct ib_qp *ibqp, struct ib_udata *udata)
 
        if (rdma_protocol_iwarp(&dev->ibdev, 1))
                qedr_iw_qp_rem_ref(&qp->ibqp);
-       else
-               kfree(qp);
 
        return 0;
 }
@@ -2996,7 +2979,11 @@ struct ib_mr *qedr_reg_user_mr(struct ib_pd *ibpd, u64 start, u64 len,
 
        rc = dev->ops->rdma_alloc_tid(dev->rdma_ctx, &mr->hw_mr.itid);
        if (rc) {
-               DP_ERR(dev, "roce alloc tid returned an error %d\n", rc);
+               if (rc == -EINVAL)
+                       DP_ERR(dev, "Out of MR resources\n");
+               else
+                       DP_ERR(dev, "roce alloc tid returned error %d\n", rc);
+
                goto err1;
        }
 
@@ -3091,7 +3078,11 @@ static struct qedr_mr *__qedr_alloc_mr(struct ib_pd *ibpd,
 
        rc = dev->ops->rdma_alloc_tid(dev->rdma_ctx, &mr->hw_mr.itid);
        if (rc) {
-               DP_ERR(dev, "roce alloc tid returned an error %d\n", rc);
+               if (rc == -EINVAL)
+                       DP_ERR(dev, "Out of MR resources\n");
+               else
+                       DP_ERR(dev, "roce alloc tid returned error %d\n", rc);
+
                goto err0;
        }
 
@@ -3221,7 +3212,11 @@ struct ib_mr *qedr_get_dma_mr(struct ib_pd *ibpd, int acc)
 
        rc = dev->ops->rdma_alloc_tid(dev->rdma_ctx, &mr->hw_mr.itid);
        if (rc) {
-               DP_ERR(dev, "roce alloc tid returned an error %d\n", rc);
+               if (rc == -EINVAL)
+                       DP_ERR(dev, "Out of MR resources\n");
+               else
+                       DP_ERR(dev, "roce alloc tid returned error %d\n", rc);
+
                goto err1;
        }
 
@@ -3915,12 +3910,6 @@ int qedr_post_recv(struct ib_qp *ibqp, const struct ib_recv_wr *wr,
 
        spin_lock_irqsave(&qp->q_lock, flags);
 
-       if (qp->state == QED_ROCE_QP_STATE_RESET) {
-               spin_unlock_irqrestore(&qp->q_lock, flags);
-               *bad_wr = wr;
-               return -EINVAL;
-       }
-
        while (wr) {
                int i;
 
index 34ad47515861a05e436e3837f44e707ba72d59f9..031687dafc611778960ccf8f13db3a0a866fcc50 100644 (file)
@@ -56,8 +56,8 @@ int qedr_create_cq(struct ib_cq *ibcq, const struct ib_cq_init_attr *attr,
 int qedr_resize_cq(struct ib_cq *, int cqe, struct ib_udata *);
 int qedr_destroy_cq(struct ib_cq *ibcq, struct ib_udata *udata);
 int qedr_arm_cq(struct ib_cq *ibcq, enum ib_cq_notify_flags flags);
-struct ib_qp *qedr_create_qp(struct ib_pd *, struct ib_qp_init_attr *attrs,
-                            struct ib_udata *);
+int qedr_create_qp(struct ib_qp *qp, struct ib_qp_init_attr *attrs,
+                  struct ib_udata *udata);
 int qedr_modify_qp(struct ib_qp *, struct ib_qp_attr *attr,
                   int attr_mask, struct ib_udata *udata);
 int qedr_query_qp(struct ib_qp *, struct ib_qp_attr *qp_attr,
index c60e79d214a175c6756c3509006f1d3658ea373d..63854f4b652455bbc1a4fd0639a8dbaf68f771cb 100644 (file)
@@ -429,8 +429,8 @@ cleanup:
                                dd->f_put_tid(dd, &tidbase[tid],
                                              RCVHQ_RCV_TYPE_EXPECTED,
                                              dd->tidinvalid);
-                               pci_unmap_page(dd->pcidev, phys, PAGE_SIZE,
-                                              PCI_DMA_FROMDEVICE);
+                               dma_unmap_page(&dd->pcidev->dev, phys,
+                                              PAGE_SIZE, DMA_FROM_DEVICE);
                                dd->pageshadow[ctxttid + tid] = NULL;
                        }
                }
@@ -544,8 +544,8 @@ static int qib_tid_free(struct qib_ctxtdata *rcd, unsigned subctxt,
                         */
                        dd->f_put_tid(dd, &tidbase[tid],
                                      RCVHQ_RCV_TYPE_EXPECTED, dd->tidinvalid);
-                       pci_unmap_page(dd->pcidev, phys, PAGE_SIZE,
-                                      PCI_DMA_FROMDEVICE);
+                       dma_unmap_page(&dd->pcidev->dev, phys, PAGE_SIZE,
+                                      DMA_FROM_DEVICE);
                        qib_release_user_pages(&p, 1);
                }
        }
@@ -1781,8 +1781,8 @@ static void unlock_expected_tids(struct qib_ctxtdata *rcd)
                phys = dd->physshadow[i];
                dd->physshadow[i] = dd->tidinvalid;
                dd->pageshadow[i] = NULL;
-               pci_unmap_page(dd->pcidev, phys, PAGE_SIZE,
-                              PCI_DMA_FROMDEVICE);
+               dma_unmap_page(&dd->pcidev->dev, phys, PAGE_SIZE,
+                              DMA_FROM_DEVICE);
                qib_release_user_pages(&p, 1);
                cnt++;
        }
index b5a78576c48bd79dbe5421882897aa162b9a5b7c..d1a72e89e297e99ff6fdbc95493856acbe889238 100644 (file)
@@ -1335,8 +1335,8 @@ static void cleanup_device_data(struct qib_devdata *dd)
                        for (i = ctxt_tidbase; i < maxtid; i++) {
                                if (!tmpp[i])
                                        continue;
-                               pci_unmap_page(dd->pcidev, tmpd[i],
-                                              PAGE_SIZE, PCI_DMA_FROMDEVICE);
+                               dma_unmap_page(&dd->pcidev->dev, tmpd[i],
+                                              PAGE_SIZE, DMA_FROM_DEVICE);
                                qib_release_user_pages(&tmpp[i], 1);
                                tmpp[i] = NULL;
                        }
index 5d6cf7427431bf971f5dbbfcf50ba54f14c63487..f4b5f05058e4c6713a9bfb8a2afff4e106bf4497 100644 (file)
@@ -60,15 +60,15 @@ int qib_map_page(struct pci_dev *hwdev, struct page *page, dma_addr_t *daddr)
 {
        dma_addr_t phys;
 
-       phys = pci_map_page(hwdev, page, 0, PAGE_SIZE, PCI_DMA_FROMDEVICE);
-       if (pci_dma_mapping_error(hwdev, phys))
+       phys = dma_map_page(&hwdev->dev, page, 0, PAGE_SIZE, DMA_FROM_DEVICE);
+       if (dma_mapping_error(&hwdev->dev, phys))
                return -ENOMEM;
 
        if (!phys) {
-               pci_unmap_page(hwdev, phys, PAGE_SIZE, PCI_DMA_FROMDEVICE);
-               phys = pci_map_page(hwdev, page, 0, PAGE_SIZE,
-                                   PCI_DMA_FROMDEVICE);
-               if (pci_dma_mapping_error(hwdev, phys))
+               dma_unmap_page(&hwdev->dev, phys, PAGE_SIZE, DMA_FROM_DEVICE);
+               phys = dma_map_page(&hwdev->dev, page, 0, PAGE_SIZE,
+                                   DMA_FROM_DEVICE);
+               if (dma_mapping_error(&hwdev->dev, phys))
                        return -ENOMEM;
                /*
                 * FIXME: If we get 0 again, we should keep this page,
index c49f9e19d92669f76df9bb126bf34e0ff4de15ec..228e9a36dad0d8e17465a141b43e8bb1019bdd3a 100644 (file)
@@ -360,6 +360,7 @@ static const struct ib_device_ops usnic_dev_ops = {
        .reg_user_mr = usnic_ib_reg_mr,
        INIT_RDMA_OBJ_SIZE(ib_pd, usnic_ib_pd, ibpd),
        INIT_RDMA_OBJ_SIZE(ib_cq, usnic_ib_cq, ibcq),
+       INIT_RDMA_OBJ_SIZE(ib_qp, usnic_ib_qp_grp, ibqp),
        INIT_RDMA_OBJ_SIZE(ib_ucontext, usnic_ib_ucontext, ibucontext),
 };
 
index 0cdb156e165e325ec847018b9df3e44f404cdda1..3b60fa9cb58d78867d1af3aa3cd3a963cbc37e1b 100644 (file)
@@ -665,13 +665,12 @@ static int qp_grp_id_from_flow(struct usnic_ib_qp_grp_flow *qp_flow,
        return 0;
 }
 
-struct usnic_ib_qp_grp *
-usnic_ib_qp_grp_create(struct usnic_fwd_dev *ufdev, struct usnic_ib_vf *vf,
-                       struct usnic_ib_pd *pd,
-                       struct usnic_vnic_res_spec *res_spec,
-                       struct usnic_transport_spec *transport_spec)
+int usnic_ib_qp_grp_create(struct usnic_ib_qp_grp *qp_grp,
+                          struct usnic_fwd_dev *ufdev, struct usnic_ib_vf *vf,
+                          struct usnic_ib_pd *pd,
+                          struct usnic_vnic_res_spec *res_spec,
+                          struct usnic_transport_spec *transport_spec)
 {
-       struct usnic_ib_qp_grp *qp_grp;
        int err;
        enum usnic_transport_type transport = transport_spec->trans_type;
        struct usnic_ib_qp_grp_flow *qp_flow;
@@ -684,20 +683,15 @@ usnic_ib_qp_grp_create(struct usnic_fwd_dev *ufdev, struct usnic_ib_vf *vf,
                usnic_err("Spec does not meet minimum req for transport %d\n",
                                transport);
                log_spec(res_spec);
-               return ERR_PTR(err);
+               return err;
        }
 
-       qp_grp = kzalloc(sizeof(*qp_grp), GFP_ATOMIC);
-       if (!qp_grp)
-               return NULL;
-
        qp_grp->res_chunk_list = alloc_res_chunk_list(vf->vnic, res_spec,
                                                        qp_grp);
-       if (IS_ERR_OR_NULL(qp_grp->res_chunk_list)) {
-               err = qp_grp->res_chunk_list ?
-                               PTR_ERR(qp_grp->res_chunk_list) : -ENOMEM;
-               goto out_free_qp_grp;
-       }
+       if (IS_ERR_OR_NULL(qp_grp->res_chunk_list))
+               return qp_grp->res_chunk_list ?
+                                    PTR_ERR(qp_grp->res_chunk_list) :
+                                    -ENOMEM;
 
        err = qp_grp_and_vf_bind(vf, pd, qp_grp);
        if (err)
@@ -724,7 +718,7 @@ usnic_ib_qp_grp_create(struct usnic_fwd_dev *ufdev, struct usnic_ib_vf *vf,
 
        usnic_ib_sysfs_qpn_add(qp_grp);
 
-       return qp_grp;
+       return 0;
 
 out_release_flow:
        release_and_remove_flow(qp_flow);
@@ -732,10 +726,7 @@ out_qp_grp_vf_unbind:
        qp_grp_and_vf_unbind(qp_grp);
 out_free_res:
        free_qp_grp_res(qp_grp->res_chunk_list);
-out_free_qp_grp:
-       kfree(qp_grp);
-
-       return ERR_PTR(err);
+       return err;
 }
 
 void usnic_ib_qp_grp_destroy(struct usnic_ib_qp_grp *qp_grp)
@@ -748,7 +739,6 @@ void usnic_ib_qp_grp_destroy(struct usnic_ib_qp_grp *qp_grp)
        usnic_ib_sysfs_qpn_remove(qp_grp);
        qp_grp_and_vf_unbind(qp_grp);
        free_qp_grp_res(qp_grp->res_chunk_list);
-       kfree(qp_grp);
 }
 
 struct usnic_vnic_res_chunk*
index a8a2314c953189cac50b6f41d4cb570b3f000acf..62e732be6736988673feefdf7d6842d1545e2018 100644 (file)
@@ -89,11 +89,11 @@ extern const struct usnic_vnic_res_spec min_transport_spec[USNIC_TRANSPORT_MAX];
 const char *usnic_ib_qp_grp_state_to_string(enum ib_qp_state state);
 int usnic_ib_qp_grp_dump_hdr(char *buf, int buf_sz);
 int usnic_ib_qp_grp_dump_rows(void *obj, char *buf, int buf_sz);
-struct usnic_ib_qp_grp *
-usnic_ib_qp_grp_create(struct usnic_fwd_dev *ufdev, struct usnic_ib_vf *vf,
-                       struct usnic_ib_pd *pd,
-                       struct usnic_vnic_res_spec *res_spec,
-                       struct usnic_transport_spec *trans_spec);
+int usnic_ib_qp_grp_create(struct usnic_ib_qp_grp *qp,
+                          struct usnic_fwd_dev *ufdev, struct usnic_ib_vf *vf,
+                          struct usnic_ib_pd *pd,
+                          struct usnic_vnic_res_spec *res_spec,
+                          struct usnic_transport_spec *trans_spec);
 void usnic_ib_qp_grp_destroy(struct usnic_ib_qp_grp *qp_grp);
 int usnic_ib_qp_grp_modify(struct usnic_ib_qp_grp *qp_grp,
                                enum ib_qp_state new_state,
index 57d210ca855a5e3f9e1562baea80703b5b004619..06a4e9d4545da0cd38e1ec146352da0ef8803f08 100644 (file)
@@ -168,30 +168,31 @@ static int usnic_ib_fill_create_qp_resp(struct usnic_ib_qp_grp *qp_grp,
        return 0;
 }
 
-static struct usnic_ib_qp_grp*
-find_free_vf_and_create_qp_grp(struct usnic_ib_dev *us_ibdev,
-                               struct usnic_ib_pd *pd,
-                               struct usnic_transport_spec *trans_spec,
-                               struct usnic_vnic_res_spec *res_spec)
+static int
+find_free_vf_and_create_qp_grp(struct ib_qp *qp,
+                              struct usnic_transport_spec *trans_spec,
+                              struct usnic_vnic_res_spec *res_spec)
 {
+       struct usnic_ib_dev *us_ibdev = to_usdev(qp->device);
+       struct usnic_ib_pd *pd = to_upd(qp->pd);
        struct usnic_ib_vf *vf;
        struct usnic_vnic *vnic;
-       struct usnic_ib_qp_grp *qp_grp;
+       struct usnic_ib_qp_grp *qp_grp = to_uqp_grp(qp);
        struct device *dev, **dev_list;
-       int i;
+       int i, ret;
 
        BUG_ON(!mutex_is_locked(&us_ibdev->usdev_lock));
 
        if (list_empty(&us_ibdev->vf_dev_list)) {
                usnic_info("No vfs to allocate\n");
-               return NULL;
+               return -ENOMEM;
        }
 
        if (usnic_ib_share_vf) {
                /* Try to find resouces on a used vf which is in pd */
                dev_list = usnic_uiom_get_dev_list(pd->umem_pd);
                if (IS_ERR(dev_list))
-                       return ERR_CAST(dev_list);
+                       return PTR_ERR(dev_list);
                for (i = 0; dev_list[i]; i++) {
                        dev = dev_list[i];
                        vf = dev_get_drvdata(dev);
@@ -202,10 +203,10 @@ find_free_vf_and_create_qp_grp(struct usnic_ib_dev *us_ibdev,
                                                dev_name(&us_ibdev->ib_dev.dev),
                                                pci_name(usnic_vnic_get_pdev(
                                                                        vnic)));
-                               qp_grp = usnic_ib_qp_grp_create(us_ibdev->ufdev,
-                                                               vf, pd,
-                                                               res_spec,
-                                                               trans_spec);
+                               ret = usnic_ib_qp_grp_create(qp_grp,
+                                                            us_ibdev->ufdev,
+                                                            vf, pd, res_spec,
+                                                            trans_spec);
 
                                spin_unlock(&vf->lock);
                                goto qp_grp_check;
@@ -223,9 +224,9 @@ find_free_vf_and_create_qp_grp(struct usnic_ib_dev *us_ibdev,
                vnic = vf->vnic;
                if (vf->qp_grp_ref_cnt == 0 &&
                    usnic_vnic_check_room(vnic, res_spec) == 0) {
-                       qp_grp = usnic_ib_qp_grp_create(us_ibdev->ufdev, vf,
-                                                       pd, res_spec,
-                                                       trans_spec);
+                       ret = usnic_ib_qp_grp_create(qp_grp, us_ibdev->ufdev,
+                                                    vf, pd, res_spec,
+                                                    trans_spec);
 
                        spin_unlock(&vf->lock);
                        goto qp_grp_check;
@@ -235,16 +236,15 @@ find_free_vf_and_create_qp_grp(struct usnic_ib_dev *us_ibdev,
 
        usnic_info("No free qp grp found on %s\n",
                   dev_name(&us_ibdev->ib_dev.dev));
-       return ERR_PTR(-ENOMEM);
+       return -ENOMEM;
 
 qp_grp_check:
-       if (IS_ERR_OR_NULL(qp_grp)) {
+       if (ret) {
                usnic_err("Failed to allocate qp_grp\n");
                if (usnic_ib_share_vf)
                        usnic_uiom_free_dev_list(dev_list);
-               return ERR_PTR(qp_grp ? PTR_ERR(qp_grp) : -ENOMEM);
        }
-       return qp_grp;
+       return ret;
 }
 
 static void qp_grp_destroy(struct usnic_ib_qp_grp *qp_grp)
@@ -458,13 +458,12 @@ int usnic_ib_dealloc_pd(struct ib_pd *pd, struct ib_udata *udata)
        return 0;
 }
 
-struct ib_qp *usnic_ib_create_qp(struct ib_pd *pd,
-                                       struct ib_qp_init_attr *init_attr,
-                                       struct ib_udata *udata)
+int usnic_ib_create_qp(struct ib_qp *ibqp, struct ib_qp_init_attr *init_attr,
+                      struct ib_udata *udata)
 {
        int err;
        struct usnic_ib_dev *us_ibdev;
-       struct usnic_ib_qp_grp *qp_grp;
+       struct usnic_ib_qp_grp *qp_grp = to_uqp_grp(ibqp);
        struct usnic_ib_ucontext *ucontext = rdma_udata_to_drv_context(
                udata, struct usnic_ib_ucontext, ibucontext);
        int cq_cnt;
@@ -474,29 +473,29 @@ struct ib_qp *usnic_ib_create_qp(struct ib_pd *pd,
 
        usnic_dbg("\n");
 
-       us_ibdev = to_usdev(pd->device);
+       us_ibdev = to_usdev(ibqp->device);
 
        if (init_attr->create_flags)
-               return ERR_PTR(-EOPNOTSUPP);
+               return -EOPNOTSUPP;
 
        err = ib_copy_from_udata(&cmd, udata, sizeof(cmd));
        if (err) {
                usnic_err("%s: cannot copy udata for create_qp\n",
                          dev_name(&us_ibdev->ib_dev.dev));
-               return ERR_PTR(-EINVAL);
+               return -EINVAL;
        }
 
        err = create_qp_validate_user_data(cmd);
        if (err) {
                usnic_err("%s: Failed to validate user data\n",
                          dev_name(&us_ibdev->ib_dev.dev));
-               return ERR_PTR(-EINVAL);
+               return -EINVAL;
        }
 
        if (init_attr->qp_type != IB_QPT_UD) {
                usnic_err("%s asked to make a non-UD QP: %d\n",
                          dev_name(&us_ibdev->ib_dev.dev), init_attr->qp_type);
-               return ERR_PTR(-EOPNOTSUPP);
+               return -EOPNOTSUPP;
        }
 
        trans_spec = cmd.spec;
@@ -504,13 +503,9 @@ struct ib_qp *usnic_ib_create_qp(struct ib_pd *pd,
        cq_cnt = (init_attr->send_cq == init_attr->recv_cq) ? 1 : 2;
        res_spec = min_transport_spec[trans_spec.trans_type];
        usnic_vnic_res_spec_update(&res_spec, USNIC_VNIC_RES_TYPE_CQ, cq_cnt);
-       qp_grp = find_free_vf_and_create_qp_grp(us_ibdev, to_upd(pd),
-                                               &trans_spec,
-                                               &res_spec);
-       if (IS_ERR_OR_NULL(qp_grp)) {
-               err = qp_grp ? PTR_ERR(qp_grp) : -ENOMEM;
+       err = find_free_vf_and_create_qp_grp(ibqp, &trans_spec, &res_spec);
+       if (err)
                goto out_release_mutex;
-       }
 
        err = usnic_ib_fill_create_qp_resp(qp_grp, udata);
        if (err) {
@@ -522,13 +517,13 @@ struct ib_qp *usnic_ib_create_qp(struct ib_pd *pd,
        list_add_tail(&qp_grp->link, &ucontext->qp_grp_list);
        usnic_ib_log_vf(qp_grp->vf);
        mutex_unlock(&us_ibdev->usdev_lock);
-       return &qp_grp->ibqp;
+       return 0;
 
 out_release_qp_grp:
        qp_grp_destroy(qp_grp);
 out_release_mutex:
        mutex_unlock(&us_ibdev->usdev_lock);
-       return ERR_PTR(err);
+       return err;
 }
 
 int usnic_ib_destroy_qp(struct ib_qp *qp, struct ib_udata *udata)
index 6b82d0f2d184c809c1f29a967b2503294b54201f..6ca9ee0dddbe1496f2284494028f3d7c555dda82 100644 (file)
@@ -50,9 +50,8 @@ int usnic_ib_query_gid(struct ib_device *ibdev, u32 port, int index,
                                union ib_gid *gid);
 int usnic_ib_alloc_pd(struct ib_pd *ibpd, struct ib_udata *udata);
 int usnic_ib_dealloc_pd(struct ib_pd *pd, struct ib_udata *udata);
-struct ib_qp *usnic_ib_create_qp(struct ib_pd *pd,
-                                       struct ib_qp_init_attr *init_attr,
-                                       struct ib_udata *udata);
+int usnic_ib_create_qp(struct ib_qp *qp, struct ib_qp_init_attr *init_attr,
+                      struct ib_udata *udata);
 int usnic_ib_destroy_qp(struct ib_qp *qp, struct ib_udata *udata);
 int usnic_ib_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr,
                                int attr_mask, struct ib_udata *udata);
index 8ed8bc24c69fe54a9f0da458a67a26420a88fc0f..105f3a15593952cd1fab937f179a0c8cf763e495 100644 (file)
@@ -185,6 +185,7 @@ static const struct ib_device_ops pvrdma_dev_ops = {
        INIT_RDMA_OBJ_SIZE(ib_ah, pvrdma_ah, ibah),
        INIT_RDMA_OBJ_SIZE(ib_cq, pvrdma_cq, ibcq),
        INIT_RDMA_OBJ_SIZE(ib_pd, pvrdma_pd, ibpd),
+       INIT_RDMA_OBJ_SIZE(ib_qp, pvrdma_qp, ibqp),
        INIT_RDMA_OBJ_SIZE(ib_ucontext, pvrdma_ucontext, ibucontext),
 };
 
@@ -810,18 +811,10 @@ static int pvrdma_pci_probe(struct pci_dev *pdev,
        }
 
        /* Enable 64-Bit DMA */
-       if (pci_set_dma_mask(pdev, DMA_BIT_MASK(64)) == 0) {
-               ret = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(64));
+       if (dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64)) != 0) {
+               ret = dma_set_mask(&pdev->dev, DMA_BIT_MASK(32));
                if (ret != 0) {
-                       dev_err(&pdev->dev,
-                               "pci_set_consistent_dma_mask failed\n");
-                       goto err_free_resource;
-               }
-       } else {
-               ret = pci_set_dma_mask(pdev, DMA_BIT_MASK(32));
-               if (ret != 0) {
-                       dev_err(&pdev->dev,
-                               "pci_set_dma_mask failed\n");
+                       dev_err(&pdev->dev, "dma_set_mask failed\n");
                        goto err_free_resource;
                }
        }
index 67769b715126a21309e9d5b99ac8613575bca3d0..f83cd4a9d99234c64bebddba19b9f0205f121af6 100644 (file)
@@ -182,18 +182,17 @@ static int pvrdma_set_sq_size(struct pvrdma_dev *dev, struct ib_qp_cap *req_cap,
 
 /**
  * pvrdma_create_qp - create queue pair
- * @pd: protection domain
+ * @ibqp: queue pair
  * @init_attr: queue pair attributes
  * @udata: user data
  *
- * @return: the ib_qp pointer on success, otherwise returns an errno.
+ * @return: the 0 on success, otherwise returns an errno.
  */
-struct ib_qp *pvrdma_create_qp(struct ib_pd *pd,
-                              struct ib_qp_init_attr *init_attr,
-                              struct ib_udata *udata)
+int pvrdma_create_qp(struct ib_qp *ibqp, struct ib_qp_init_attr *init_attr,
+                    struct ib_udata *udata)
 {
-       struct pvrdma_qp *qp = NULL;
-       struct pvrdma_dev *dev = to_vdev(pd->device);
+       struct pvrdma_qp *qp = to_vqp(ibqp);
+       struct pvrdma_dev *dev = to_vdev(ibqp->device);
        union pvrdma_cmd_req req;
        union pvrdma_cmd_resp rsp;
        struct pvrdma_cmd_create_qp *cmd = &req.create_qp;
@@ -209,7 +208,7 @@ struct ib_qp *pvrdma_create_qp(struct ib_pd *pd,
                dev_warn(&dev->pdev->dev,
                         "invalid create queuepair flags %#x\n",
                         init_attr->create_flags);
-               return ERR_PTR(-EOPNOTSUPP);
+               return -EOPNOTSUPP;
        }
 
        if (init_attr->qp_type != IB_QPT_RC &&
@@ -217,22 +216,22 @@ struct ib_qp *pvrdma_create_qp(struct ib_pd *pd,
            init_attr->qp_type != IB_QPT_GSI) {
                dev_warn(&dev->pdev->dev, "queuepair type %d not supported\n",
                         init_attr->qp_type);
-               return ERR_PTR(-EOPNOTSUPP);
+               return -EOPNOTSUPP;
        }
 
        if (is_srq && !dev->dsr->caps.max_srq) {
                dev_warn(&dev->pdev->dev,
                         "SRQs not supported by device\n");
-               return ERR_PTR(-EINVAL);
+               return -EINVAL;
        }
 
        if (!atomic_add_unless(&dev->num_qps, 1, dev->dsr->caps.max_qp))
-               return ERR_PTR(-ENOMEM);
+               return -ENOMEM;
 
        switch (init_attr->qp_type) {
        case IB_QPT_GSI:
                if (init_attr->port_num == 0 ||
-                   init_attr->port_num > pd->device->phys_port_cnt) {
+                   init_attr->port_num > ibqp->device->phys_port_cnt) {
                        dev_warn(&dev->pdev->dev, "invalid queuepair attrs\n");
                        ret = -EINVAL;
                        goto err_qp;
@@ -240,12 +239,6 @@ struct ib_qp *pvrdma_create_qp(struct ib_pd *pd,
                fallthrough;
        case IB_QPT_RC:
        case IB_QPT_UD:
-               qp = kzalloc(sizeof(*qp), GFP_KERNEL);
-               if (!qp) {
-                       ret = -ENOMEM;
-                       goto err_qp;
-               }
-
                spin_lock_init(&qp->sq.lock);
                spin_lock_init(&qp->rq.lock);
                mutex_init(&qp->mutex);
@@ -275,9 +268,9 @@ struct ib_qp *pvrdma_create_qp(struct ib_pd *pd,
 
                        if (!is_srq) {
                                /* set qp->sq.wqe_cnt, shift, buf_size.. */
-                               qp->rumem =
-                                       ib_umem_get(pd->device, ucmd.rbuf_addr,
-                                                   ucmd.rbuf_size, 0);
+                               qp->rumem = ib_umem_get(ibqp->device,
+                                                       ucmd.rbuf_addr,
+                                                       ucmd.rbuf_size, 0);
                                if (IS_ERR(qp->rumem)) {
                                        ret = PTR_ERR(qp->rumem);
                                        goto err_qp;
@@ -288,7 +281,7 @@ struct ib_qp *pvrdma_create_qp(struct ib_pd *pd,
                                qp->srq = to_vsrq(init_attr->srq);
                        }
 
-                       qp->sumem = ib_umem_get(pd->device, ucmd.sbuf_addr,
+                       qp->sumem = ib_umem_get(ibqp->device, ucmd.sbuf_addr,
                                                ucmd.sbuf_size, 0);
                        if (IS_ERR(qp->sumem)) {
                                if (!is_srq)
@@ -306,12 +299,12 @@ struct ib_qp *pvrdma_create_qp(struct ib_pd *pd,
                                qp->npages_recv = 0;
                        qp->npages = qp->npages_send + qp->npages_recv;
                } else {
-                       ret = pvrdma_set_sq_size(to_vdev(pd->device),
+                       ret = pvrdma_set_sq_size(to_vdev(ibqp->device),
                                                 &init_attr->cap, qp);
                        if (ret)
                                goto err_qp;
 
-                       ret = pvrdma_set_rq_size(to_vdev(pd->device),
+                       ret = pvrdma_set_rq_size(to_vdev(ibqp->device),
                                                 &init_attr->cap, qp);
                        if (ret)
                                goto err_qp;
@@ -362,7 +355,7 @@ struct ib_qp *pvrdma_create_qp(struct ib_pd *pd,
 
        memset(cmd, 0, sizeof(*cmd));
        cmd->hdr.cmd = PVRDMA_CMD_CREATE_QP;
-       cmd->pd_handle = to_vpd(pd)->pd_handle;
+       cmd->pd_handle = to_vpd(ibqp->pd)->pd_handle;
        cmd->send_cq_handle = to_vcq(init_attr->send_cq)->cq_handle;
        cmd->recv_cq_handle = to_vcq(init_attr->recv_cq)->cq_handle;
        if (is_srq)
@@ -418,11 +411,11 @@ struct ib_qp *pvrdma_create_qp(struct ib_pd *pd,
                        dev_warn(&dev->pdev->dev,
                                 "failed to copy back udata\n");
                        __pvrdma_destroy_qp(dev, qp);
-                       return ERR_PTR(-EINVAL);
+                       return -EINVAL;
                }
        }
 
-       return &qp->ibqp;
+       return 0;
 
 err_pdir:
        pvrdma_page_dir_cleanup(dev, &qp->pdir);
@@ -430,10 +423,8 @@ err_umem:
        ib_umem_release(qp->rumem);
        ib_umem_release(qp->sumem);
 err_qp:
-       kfree(qp);
        atomic_dec(&dev->num_qps);
-
-       return ERR_PTR(ret);
+       return ret;
 }
 
 static void _pvrdma_free_qp(struct pvrdma_qp *qp)
@@ -454,8 +445,6 @@ static void _pvrdma_free_qp(struct pvrdma_qp *qp)
 
        pvrdma_page_dir_cleanup(dev, &qp->pdir);
 
-       kfree(qp);
-
        atomic_dec(&dev->num_qps);
 }
 
index 544b94d97c3a25837fcb7d4a987dd786a83b738d..78807b23d831c66d2c60532bd3b326a709fd207b 100644 (file)
@@ -390,9 +390,8 @@ int pvrdma_modify_srq(struct ib_srq *ibsrq, struct ib_srq_attr *attr,
 int pvrdma_query_srq(struct ib_srq *srq, struct ib_srq_attr *srq_attr);
 int pvrdma_destroy_srq(struct ib_srq *srq, struct ib_udata *udata);
 
-struct ib_qp *pvrdma_create_qp(struct ib_pd *pd,
-                              struct ib_qp_init_attr *init_attr,
-                              struct ib_udata *udata);
+int pvrdma_create_qp(struct ib_qp *qp, struct ib_qp_init_attr *init_attr,
+                    struct ib_udata *udata);
 int pvrdma_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr,
                     int attr_mask, struct ib_udata *udata);
 int pvrdma_query_qp(struct ib_qp *ibqp, struct ib_qp_attr *qp_attr,
index a3e5b368c5e7b37af71026eb2a83dac7b417a68e..63999239ed9e7ed7ce1b89a19772228b3720e398 100644 (file)
@@ -1,48 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0 or BSD-3-Clause
 /*
  * Copyright(c) 2016 - 2019 Intel Corporation.
- *
- * This file is provided under a dual BSD/GPLv2 license.  When using or
- * redistributing this file, you may do so under either license.
- *
- * GPL LICENSE SUMMARY
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * BSD LICENSE
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- *  - Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- *  - Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in
- *    the documentation and/or other materials provided with the
- *    distribution.
- *  - Neither the name of Intel Corporation nor the names of its
- *    contributors may be used to endorse or promote products derived
- *    from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
  */
 
 #include <linux/slab.h>
index 5a85edd06491a909bd9e92062db90682a381f670..c11fdf637d64079e8c96d980249d3a4096a29a39 100644 (file)
@@ -1,53 +1,11 @@
-#ifndef DEF_RVTAH_H
-#define DEF_RVTAH_H
-
+/* SPDX-License-Identifier: GPL-2.0 or BSD-3-Clause */
 /*
  * Copyright(c) 2016 Intel Corporation.
- *
- * This file is provided under a dual BSD/GPLv2 license.  When using or
- * redistributing this file, you may do so under either license.
- *
- * GPL LICENSE SUMMARY
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * BSD LICENSE
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- *  - Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- *  - Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in
- *    the documentation and/or other materials provided with the
- *    distribution.
- *  - Neither the name of Intel Corporation nor the names of its
- *    contributors may be used to endorse or promote products derived
- *    from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
  */
 
+#ifndef DEF_RVTAH_H
+#define DEF_RVTAH_H
+
 #include <rdma/rdma_vt.h>
 
 int rvt_create_ah(struct ib_ah *ah, struct rdma_ah_init_attr *init_attr,
index 5138afca067f64dbcfa21c34bfdbf5c2fe53cd1e..9fe4dcaa049aa122a5092c12bcb41c0ac564c8d5 100644 (file)
@@ -1,48 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0 or BSD-3-Clause
 /*
  * Copyright(c) 2016 - 2018 Intel Corporation.
- *
- * This file is provided under a dual BSD/GPLv2 license.  When using or
- * redistributing this file, you may do so under either license.
- *
- * GPL LICENSE SUMMARY
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * BSD LICENSE
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- *  - Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- *  - Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in
- *    the documentation and/or other materials provided with the
- *    distribution.
- *  - Neither the name of Intel Corporation nor the names of its
- *    contributors may be used to endorse or promote products derived
- *    from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
  */
 
 #include <linux/slab.h>
index feb01e7ee00449e72b72f1aab06c8ecdb052f537..b0a948ec760bc9d1f317a93bf07a2f7836880261 100644 (file)
@@ -1,53 +1,11 @@
-#ifndef DEF_RVTCQ_H
-#define DEF_RVTCQ_H
-
+/* SPDX-License-Identifier: GPL-2.0 or BSD-3-Clause */
 /*
  * Copyright(c) 2016 - 2018 Intel Corporation.
- *
- * This file is provided under a dual BSD/GPLv2 license.  When using or
- * redistributing this file, you may do so under either license.
- *
- * GPL LICENSE SUMMARY
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * BSD LICENSE
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- *  - Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- *  - Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in
- *    the documentation and/or other materials provided with the
- *    distribution.
- *  - Neither the name of Intel Corporation nor the names of its
- *    contributors may be used to endorse or promote products derived
- *    from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
  */
 
+#ifndef DEF_RVTCQ_H
+#define DEF_RVTCQ_H
+
 #include <rdma/rdma_vt.h>
 #include <rdma/rdmavt_cq.h>
 
index 207bc0ed96ff1a8d48d311e128521a12e87c6479..98a8fe3b04ef1046899e662c1634644123c907cb 100644 (file)
@@ -1,48 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0 or BSD-3-Clause
 /*
  * Copyright(c) 2016 Intel Corporation.
- *
- * This file is provided under a dual BSD/GPLv2 license.  When using or
- * redistributing this file, you may do so under either license.
- *
- * GPL LICENSE SUMMARY
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * BSD LICENSE
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- *  - Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- *  - Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in
- *    the documentation and/or other materials provided with the
- *    distribution.
- *  - Neither the name of Intel Corporation nor the names of its
- *    contributors may be used to endorse or promote products derived
- *    from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
  */
 
 #include <rdma/ib_mad.h>
index 1eae5efea4be6bd3b0afd27431d60f44fc3d6cfb..368be29eab378c81eba9c8677699f93989b4defb 100644 (file)
@@ -1,53 +1,11 @@
-#ifndef DEF_RVTMAD_H
-#define DEF_RVTMAD_H
-
+/* SPDX-License-Identifier: GPL-2.0 or BSD-3-Clause */
 /*
  * Copyright(c) 2016 Intel Corporation.
- *
- * This file is provided under a dual BSD/GPLv2 license.  When using or
- * redistributing this file, you may do so under either license.
- *
- * GPL LICENSE SUMMARY
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * BSD LICENSE
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- *  - Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- *  - Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in
- *    the documentation and/or other materials provided with the
- *    distribution.
- *  - Neither the name of Intel Corporation nor the names of its
- *    contributors may be used to endorse or promote products derived
- *    from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
  */
 
+#ifndef DEF_RVTMAD_H
+#define DEF_RVTMAD_H
+
 #include <rdma/rdma_vt.h>
 
 int rvt_process_mad(struct ib_device *ibdev, int mad_flags, u32 port_num,
index 951abac13dbb45b069a920ca45b73806f6272c61..a123874e1ca7176a33fe287b776cd393d7d22b97 100644 (file)
@@ -1,48 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0 or BSD-3-Clause
 /*
  * Copyright(c) 2016 Intel Corporation.
- *
- * This file is provided under a dual BSD/GPLv2 license.  When using or
- * redistributing this file, you may do so under either license.
- *
- * GPL LICENSE SUMMARY
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * BSD LICENSE
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- *  - Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- *  - Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in
- *    the documentation and/or other materials provided with the
- *    distribution.
- *  - Neither the name of Intel Corporation nor the names of its
- *    contributors may be used to endorse or promote products derived
- *    from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
  */
 
 #include <linux/slab.h>
index 29f579267608cd52817a4bc17716af22da705586..b96d86f9625be9eae5fb7635dac9fd35a8e967b9 100644 (file)
@@ -1,53 +1,11 @@
-#ifndef DEF_RVTMCAST_H
-#define DEF_RVTMCAST_H
-
+/* SPDX-License-Identifier: GPL-2.0 or BSD-3-Clause */
 /*
  * Copyright(c) 2016 Intel Corporation.
- *
- * This file is provided under a dual BSD/GPLv2 license.  When using or
- * redistributing this file, you may do so under either license.
- *
- * GPL LICENSE SUMMARY
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * BSD LICENSE
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- *  - Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- *  - Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in
- *    the documentation and/or other materials provided with the
- *    distribution.
- *  - Neither the name of Intel Corporation nor the names of its
- *    contributors may be used to endorse or promote products derived
- *    from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
  */
 
+#ifndef DEF_RVTMCAST_H
+#define DEF_RVTMCAST_H
+
 #include <rdma/rdma_vt.h>
 
 void rvt_driver_mcast_init(struct rvt_dev_info *rdi);
index f5d0e33cf3d7d726eca5b4e1389b0a1dd82fa028..4d2238f3f3c8f62a6c80c726c582e41f0457003b 100644 (file)
@@ -1,48 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0 or BSD-3-Clause
 /*
  * Copyright(c) 2016 Intel Corporation.
- *
- * This file is provided under a dual BSD/GPLv2 license.  When using or
- * redistributing this file, you may do so under either license.
- *
- * GPL LICENSE SUMMARY
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * BSD LICENSE
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- *  - Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- *  - Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in
- *    the documentation and/or other materials provided with the
- *    distribution.
- *  - Neither the name of Intel Corporation nor the names of its
- *    contributors may be used to endorse or promote products derived
- *    from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
  */
 
 #include <linux/slab.h>
index 02466c40bc1edf294db716817c97cfb4e91defff..7e92cf28e071a1fb661eb3b054581c9dd5ead521 100644 (file)
@@ -1,53 +1,11 @@
-#ifndef DEF_RDMAVTMMAP_H
-#define DEF_RDMAVTMMAP_H
-
+/* SPDX-License-Identifier: GPL-2.0 or BSD-3-Clause */
 /*
  * Copyright(c) 2016 Intel Corporation.
- *
- * This file is provided under a dual BSD/GPLv2 license.  When using or
- * redistributing this file, you may do so under either license.
- *
- * GPL LICENSE SUMMARY
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * BSD LICENSE
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- *  - Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- *  - Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in
- *    the documentation and/or other materials provided with the
- *    distribution.
- *  - Neither the name of Intel Corporation nor the names of its
- *    contributors may be used to endorse or promote products derived
- *    from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
  */
 
+#ifndef DEF_RDMAVTMMAP_H
+#define DEF_RDMAVTMMAP_H
+
 #include <rdma/rdma_vt.h>
 
 void rvt_mmap_init(struct rvt_dev_info *rdi);
index dfb99a56d952d42627f3f450c4ffc8fba2e2cd34..8a1f2e2851801011f65ff9832a9f6bc4fa1a77fb 100644 (file)
@@ -1,48 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0 or BSD-3-Clause
 /*
  * Copyright(c) 2016 Intel Corporation.
- *
- * This file is provided under a dual BSD/GPLv2 license.  When using or
- * redistributing this file, you may do so under either license.
- *
- * GPL LICENSE SUMMARY
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * BSD LICENSE
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- *  - Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- *  - Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in
- *    the documentation and/or other materials provided with the
- *    distribution.
- *  - Neither the name of Intel Corporation nor the names of its
- *    contributors may be used to endorse or promote products derived
- *    from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
  */
 
 #include <linux/slab.h>
index b3aba359401bc9cc98805f3da4b8f839f0f2439b..d17f1400b5f6b5684334ed8842fccdd6a84978c5 100644 (file)
@@ -1,53 +1,11 @@
-#ifndef DEF_RVTMR_H
-#define DEF_RVTMR_H
-
+/* SPDX-License-Identifier: GPL-2.0 or BSD-3-Clause */
 /*
  * Copyright(c) 2016 Intel Corporation.
- *
- * This file is provided under a dual BSD/GPLv2 license.  When using or
- * redistributing this file, you may do so under either license.
- *
- * GPL LICENSE SUMMARY
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * BSD LICENSE
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- *  - Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- *  - Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in
- *    the documentation and/or other materials provided with the
- *    distribution.
- *  - Neither the name of Intel Corporation nor the names of its
- *    contributors may be used to endorse or promote products derived
- *    from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
  */
 
+#ifndef DEF_RVTMR_H
+#define DEF_RVTMR_H
+
 #include <rdma/rdma_vt.h>
 
 struct rvt_mr {
index 01b7abf9152054760950e18e154839151a329e27..ae62071969fa3193999a22523eea62efc2d65f76 100644 (file)
@@ -1,48 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0 or BSD-3-Clause
 /*
  * Copyright(c) 2016 Intel Corporation.
- *
- * This file is provided under a dual BSD/GPLv2 license.  When using or
- * redistributing this file, you may do so under either license.
- *
- * GPL LICENSE SUMMARY
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * BSD LICENSE
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- *  - Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- *  - Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in
- *    the documentation and/or other materials provided with the
- *    distribution.
- *  - Neither the name of Intel Corporation nor the names of its
- *    contributors may be used to endorse or promote products derived
- *    from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
  */
 
 #include <linux/slab.h>
index 06a6a38beedc8f0417e6f39afb1b26c2f598e851..42a0ef3b7da383f7556470a00d5e9a2d355ab4e2 100644 (file)
@@ -1,53 +1,11 @@
-#ifndef DEF_RDMAVTPD_H
-#define DEF_RDMAVTPD_H
-
+/* SPDX-License-Identifier: GPL-2.0 or BSD-3-Clause */
 /*
  * Copyright(c) 2016 Intel Corporation.
- *
- * This file is provided under a dual BSD/GPLv2 license.  When using or
- * redistributing this file, you may do so under either license.
- *
- * GPL LICENSE SUMMARY
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * BSD LICENSE
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- *  - Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- *  - Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in
- *    the documentation and/or other materials provided with the
- *    distribution.
- *  - Neither the name of Intel Corporation nor the names of its
- *    contributors may be used to endorse or promote products derived
- *    from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
  */
 
+#ifndef DEF_RDMAVTPD_H
+#define DEF_RDMAVTPD_H
+
 #include <rdma/rdma_vt.h>
 
 int rvt_alloc_pd(struct ib_pd *pd, struct ib_udata *udata);
index e9f3d356b3616c4df1ad268b6cea498971dca833..49bdd78ac664329aaa7e2eab7b9295fdcb651bd3 100644 (file)
@@ -1,48 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0 or BSD-3-Clause
 /*
  * Copyright(c) 2016 - 2020 Intel Corporation.
- *
- * This file is provided under a dual BSD/GPLv2 license.  When using or
- * redistributing this file, you may do so under either license.
- *
- * GPL LICENSE SUMMARY
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * BSD LICENSE
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- *  - Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- *  - Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in
- *    the documentation and/or other materials provided with the
- *    distribution.
- *  - Neither the name of Intel Corporation nor the names of its
- *    contributors may be used to endorse or promote products derived
- *    from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
  */
 
 #include <linux/hash.h>
@@ -1058,7 +1016,7 @@ static int alloc_ud_wq_attr(struct rvt_qp *qp, int node)
 
 /**
  * rvt_create_qp - create a queue pair for a device
- * @ibpd: the protection domain who's device we create the queue pair for
+ * @ibqp: the queue pair
  * @init_attr: the attributes of the queue pair
  * @udata: user data for libibverbs.so
  *
@@ -1066,47 +1024,45 @@ static int alloc_ud_wq_attr(struct rvt_qp *qp, int node)
  * unique idea of what queue pair numbers mean. For instance there is a reserved
  * range for PSM.
  *
- * Return: the queue pair on success, otherwise returns an errno.
+ * Return: 0 on success, otherwise returns an errno.
  *
  * Called by the ib_create_qp() core verbs function.
  */
-struct ib_qp *rvt_create_qp(struct ib_pd *ibpd,
-                           struct ib_qp_init_attr *init_attr,
-                           struct ib_udata *udata)
+int rvt_create_qp(struct ib_qp *ibqp, struct ib_qp_init_attr *init_attr,
+                 struct ib_udata *udata)
 {
-       struct rvt_qp *qp;
-       int err;
+       struct rvt_qp *qp = ibqp_to_rvtqp(ibqp);
+       int ret = -ENOMEM;
        struct rvt_swqe *swq = NULL;
        size_t sz;
-       size_t sg_list_sz;
-       struct ib_qp *ret = ERR_PTR(-ENOMEM);
-       struct rvt_dev_info *rdi = ib_to_rvt(ibpd->device);
+       size_t sg_list_sz = 0;
+       struct rvt_dev_info *rdi = ib_to_rvt(ibqp->device);
        void *priv = NULL;
        size_t sqsize;
        u8 exclude_prefix = 0;
 
        if (!rdi)
-               return ERR_PTR(-EINVAL);
+               return -EINVAL;
 
        if (init_attr->create_flags & ~IB_QP_CREATE_NETDEV_USE)
-               return ERR_PTR(-EOPNOTSUPP);
+               return -EOPNOTSUPP;
 
        if (init_attr->cap.max_send_sge > rdi->dparms.props.max_send_sge ||
            init_attr->cap.max_send_wr > rdi->dparms.props.max_qp_wr)
-               return ERR_PTR(-EINVAL);
+               return -EINVAL;
 
        /* Check receive queue parameters if no SRQ is specified. */
        if (!init_attr->srq) {
                if (init_attr->cap.max_recv_sge >
                    rdi->dparms.props.max_recv_sge ||
                    init_attr->cap.max_recv_wr > rdi->dparms.props.max_qp_wr)
-                       return ERR_PTR(-EINVAL);
+                       return -EINVAL;
 
                if (init_attr->cap.max_send_sge +
                    init_attr->cap.max_send_wr +
                    init_attr->cap.max_recv_sge +
                    init_attr->cap.max_recv_wr == 0)
-                       return ERR_PTR(-EINVAL);
+                       return -EINVAL;
        }
        sqsize =
                init_attr->cap.max_send_wr + 1 +
@@ -1115,8 +1071,8 @@ struct ib_qp *rvt_create_qp(struct ib_pd *ibpd,
        case IB_QPT_SMI:
        case IB_QPT_GSI:
                if (init_attr->port_num == 0 ||
-                   init_attr->port_num > ibpd->device->phys_port_cnt)
-                       return ERR_PTR(-EINVAL);
+                   init_attr->port_num > ibqp->device->phys_port_cnt)
+                       return -EINVAL;
                fallthrough;
        case IB_QPT_UC:
        case IB_QPT_RC:
@@ -1124,10 +1080,8 @@ struct ib_qp *rvt_create_qp(struct ib_pd *ibpd,
                sz = struct_size(swq, sg_list, init_attr->cap.max_send_sge);
                swq = vzalloc_node(array_size(sz, sqsize), rdi->dparms.node);
                if (!swq)
-                       return ERR_PTR(-ENOMEM);
+                       return -ENOMEM;
 
-               sz = sizeof(*qp);
-               sg_list_sz = 0;
                if (init_attr->srq) {
                        struct rvt_srq *srq = ibsrq_to_rvtsrq(init_attr->srq);
 
@@ -1137,10 +1091,10 @@ struct ib_qp *rvt_create_qp(struct ib_pd *ibpd,
                } else if (init_attr->cap.max_recv_sge > 1)
                        sg_list_sz = sizeof(*qp->r_sg_list) *
                                (init_attr->cap.max_recv_sge - 1);
-               qp = kzalloc_node(sz + sg_list_sz, GFP_KERNEL,
-                                 rdi->dparms.node);
-               if (!qp)
-                       goto bail_swq;
+               qp->r_sg_list =
+                       kzalloc_node(sg_list_sz, GFP_KERNEL, rdi->dparms.node);
+               if (!qp->r_sg_list)
+                       goto bail_qp;
                qp->allowed_ops = get_allowed_ops(init_attr->qp_type);
 
                RCU_INIT_POINTER(qp->next, NULL);
@@ -1165,7 +1119,7 @@ struct ib_qp *rvt_create_qp(struct ib_pd *ibpd,
                 */
                priv = rdi->driver_f.qp_priv_alloc(rdi, qp);
                if (IS_ERR(priv)) {
-                       ret = priv;
+                       ret = PTR_ERR(priv);
                        goto bail_qp;
                }
                qp->priv = priv;
@@ -1179,12 +1133,10 @@ struct ib_qp *rvt_create_qp(struct ib_pd *ibpd,
                        qp->r_rq.max_sge = init_attr->cap.max_recv_sge;
                        sz = (sizeof(struct ib_sge) * qp->r_rq.max_sge) +
                                sizeof(struct rvt_rwqe);
-                       err = rvt_alloc_rq(&qp->r_rq, qp->r_rq.size * sz,
+                       ret = rvt_alloc_rq(&qp->r_rq, qp->r_rq.size * sz,
                                           rdi->dparms.node, udata);
-                       if (err) {
-                               ret = ERR_PTR(err);
+                       if (ret)
                                goto bail_driver_priv;
-                       }
                }
 
                /*
@@ -1205,40 +1157,35 @@ struct ib_qp *rvt_create_qp(struct ib_pd *ibpd,
                qp->s_max_sge = init_attr->cap.max_send_sge;
                if (init_attr->sq_sig_type == IB_SIGNAL_REQ_WR)
                        qp->s_flags = RVT_S_SIGNAL_REQ_WR;
-               err = alloc_ud_wq_attr(qp, rdi->dparms.node);
-               if (err) {
-                       ret = (ERR_PTR(err));
+               ret = alloc_ud_wq_attr(qp, rdi->dparms.node);
+               if (ret)
                        goto bail_rq_rvt;
-               }
 
                if (init_attr->create_flags & IB_QP_CREATE_NETDEV_USE)
                        exclude_prefix = RVT_AIP_QP_PREFIX;
 
-               err = alloc_qpn(rdi, &rdi->qp_dev->qpn_table,
+               ret = alloc_qpn(rdi, &rdi->qp_dev->qpn_table,
                                init_attr->qp_type,
                                init_attr->port_num,
                                exclude_prefix);
-               if (err < 0) {
-                       ret = ERR_PTR(err);
+               if (ret < 0)
                        goto bail_rq_wq;
-               }
-               qp->ibqp.qp_num = err;
+
+               qp->ibqp.qp_num = ret;
                if (init_attr->create_flags & IB_QP_CREATE_NETDEV_USE)
                        qp->ibqp.qp_num |= RVT_AIP_QP_BASE;
                qp->port_num = init_attr->port_num;
                rvt_init_qp(rdi, qp, init_attr->qp_type);
                if (rdi->driver_f.qp_priv_init) {
-                       err = rdi->driver_f.qp_priv_init(rdi, qp, init_attr);
-                       if (err) {
-                               ret = ERR_PTR(err);
+                       ret = rdi->driver_f.qp_priv_init(rdi, qp, init_attr);
+                       if (ret)
                                goto bail_rq_wq;
-                       }
                }
                break;
 
        default:
                /* Don't support raw QPs */
-               return ERR_PTR(-EOPNOTSUPP);
+               return -EOPNOTSUPP;
        }
 
        init_attr->cap.max_inline_data = 0;
@@ -1251,28 +1198,24 @@ struct ib_qp *rvt_create_qp(struct ib_pd *ibpd,
                if (!qp->r_rq.wq) {
                        __u64 offset = 0;
 
-                       err = ib_copy_to_udata(udata, &offset,
+                       ret = ib_copy_to_udata(udata, &offset,
                                               sizeof(offset));
-                       if (err) {
-                               ret = ERR_PTR(err);
+                       if (ret)
                                goto bail_qpn;
-                       }
                } else {
                        u32 s = sizeof(struct rvt_rwq) + qp->r_rq.size * sz;
 
                        qp->ip = rvt_create_mmap_info(rdi, s, udata,
                                                      qp->r_rq.wq);
                        if (IS_ERR(qp->ip)) {
-                               ret = ERR_CAST(qp->ip);
+                               ret = PTR_ERR(qp->ip);
                                goto bail_qpn;
                        }
 
-                       err = ib_copy_to_udata(udata, &qp->ip->offset,
+                       ret = ib_copy_to_udata(udata, &qp->ip->offset,
                                               sizeof(qp->ip->offset));
-                       if (err) {
-                               ret = ERR_PTR(err);
+                       if (ret)
                                goto bail_ip;
-                       }
                }
                qp->pid = current->pid;
        }
@@ -1280,7 +1223,7 @@ struct ib_qp *rvt_create_qp(struct ib_pd *ibpd,
        spin_lock(&rdi->n_qps_lock);
        if (rdi->n_qps_allocated == rdi->dparms.props.max_qp) {
                spin_unlock(&rdi->n_qps_lock);
-               ret = ERR_PTR(-ENOMEM);
+               ret = ENOMEM;
                goto bail_ip;
        }
 
@@ -1306,9 +1249,7 @@ struct ib_qp *rvt_create_qp(struct ib_pd *ibpd,
                spin_unlock_irq(&rdi->pending_lock);
        }
 
-       ret = &qp->ibqp;
-
-       return ret;
+       return 0;
 
 bail_ip:
        if (qp->ip)
@@ -1328,11 +1269,8 @@ bail_driver_priv:
 
 bail_qp:
        kfree(qp->s_ack_queue);
-       kfree(qp);
-
-bail_swq:
+       kfree(qp->r_sg_list);
        vfree(swq);
-
        return ret;
 }
 
@@ -1762,11 +1700,11 @@ int rvt_destroy_qp(struct ib_qp *ibqp, struct ib_udata *udata)
        kvfree(qp->r_rq.kwq);
        rdi->driver_f.qp_priv_free(rdi, qp);
        kfree(qp->s_ack_queue);
+       kfree(qp->r_sg_list);
        rdma_destroy_ah_attr(&qp->remote_ah_attr);
        rdma_destroy_ah_attr(&qp->alt_ah_attr);
        free_ud_wq_attr(qp);
        vfree(qp->s_wq);
-       kfree(qp);
        return 0;
 }
 
index 2cdba1283bf6da6f8f1cab2649a6e4efe1226008..bd04be80723c20579885957764f187cc2a6ca165 100644 (file)
@@ -1,60 +1,17 @@
-#ifndef DEF_RVTQP_H
-#define DEF_RVTQP_H
-
+/* SPDX-License-Identifier: GPL-2.0 or BSD-3-Clause */
 /*
  * Copyright(c) 2016 Intel Corporation.
- *
- * This file is provided under a dual BSD/GPLv2 license.  When using or
- * redistributing this file, you may do so under either license.
- *
- * GPL LICENSE SUMMARY
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * BSD LICENSE
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- *  - Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- *  - Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in
- *    the documentation and/or other materials provided with the
- *    distribution.
- *  - Neither the name of Intel Corporation nor the names of its
- *    contributors may be used to endorse or promote products derived
- *    from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
  */
 
+#ifndef DEF_RVTQP_H
+#define DEF_RVTQP_H
+
 #include <rdma/rdmavt_qp.h>
 
 int rvt_driver_qp_init(struct rvt_dev_info *rdi);
 void rvt_qp_exit(struct rvt_dev_info *rdi);
-struct ib_qp *rvt_create_qp(struct ib_pd *ibpd,
-                           struct ib_qp_init_attr *init_attr,
-                           struct ib_udata *udata);
+int rvt_create_qp(struct ib_qp *ibqp, struct ib_qp_init_attr *init_attr,
+                 struct ib_udata *udata);
 int rvt_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr,
                  int attr_mask, struct ib_udata *udata);
 int rvt_destroy_qp(struct ib_qp *ibqp, struct ib_udata *udata);
index c58735f4c94adb9a324244aee016051af8889ae1..4e5d4a27633cf1cd28c96c3cd11783e2e1f1eeff 100644 (file)
@@ -1,48 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0 or BSD-3-Clause
 /*
  * Copyright(c) 2016 Intel Corporation.
- *
- * This file is provided under a dual BSD/GPLv2 license.  When using or
- * redistributing this file, you may do so under either license.
- *
- * GPL LICENSE SUMMARY
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * BSD LICENSE
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- *  - Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- *  - Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in
- *    the documentation and/or other materials provided with the
- *    distribution.
- *  - Neither the name of Intel Corporation nor the names of its
- *    contributors may be used to endorse or promote products derived
- *    from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
  */
 
 #include <rdma/rdmavt_qp.h>
index 2a7c2f12d372e9801252226f5848b1e6928cceff..14d196bde2a1c5673da746cce3d64586e1b4035b 100644 (file)
@@ -1,48 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0 or BSD-3-Clause
 /*
  * Copyright(c) 2016 Intel Corporation.
- *
- * This file is provided under a dual BSD/GPLv2 license.  When using or
- * redistributing this file, you may do so under either license.
- *
- * GPL LICENSE SUMMARY
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * BSD LICENSE
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- *  - Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- *  - Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in
- *    the documentation and/or other materials provided with the
- *    distribution.
- *  - Neither the name of Intel Corporation nor the names of its
- *    contributors may be used to endorse or promote products derived
- *    from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
  */
 
 #include <linux/err.h>
index d5a1a053b1b9ff0a661ec1b15370a3c3b64e5b5f..7d17372cd26909f17f5961c5340cd1f35bfeea78 100644 (file)
@@ -1,53 +1,11 @@
-#ifndef DEF_RVTSRQ_H
-#define DEF_RVTSRQ_H
-
+/* SPDX-License-Identifier: GPL-2.0 or BSD-3-Clause */
 /*
  * Copyright(c) 2016 Intel Corporation.
- *
- * This file is provided under a dual BSD/GPLv2 license.  When using or
- * redistributing this file, you may do so under either license.
- *
- * GPL LICENSE SUMMARY
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * BSD LICENSE
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- *  - Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- *  - Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in
- *    the documentation and/or other materials provided with the
- *    distribution.
- *  - Neither the name of Intel Corporation nor the names of its
- *    contributors may be used to endorse or promote products derived
- *    from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
  */
 
+#ifndef DEF_RVTSRQ_H
+#define DEF_RVTSRQ_H
+
 #include <rdma/rdma_vt.h>
 void rvt_driver_srq_init(struct rvt_dev_info *rdi);
 int rvt_create_srq(struct ib_srq *ibsrq, struct ib_srq_init_attr *srq_init_attr,
index d593285a349cac785a178f4c0279f2b277dc7842..01704b8dd683824c14b2058092fc00af31885a12 100644 (file)
@@ -1,48 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0 or BSD-3-Clause
 /*
  * Copyright(c) 2016 Intel Corporation.
- *
- * This file is provided under a dual BSD/GPLv2 license.  When using or
- * redistributing this file, you may do so under either license.
- *
- * GPL LICENSE SUMMARY
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * BSD LICENSE
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- *  - Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- *  - Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in
- *    the documentation and/or other materials provided with the
- *    distribution.
- *  - Neither the name of Intel Corporation nor the names of its
- *    contributors may be used to endorse or promote products derived
- *    from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
  */
 
 #define CREATE_TRACE_POINTS
index 36ddbd291ee0c0e079db7e6a8b9d1d3dc12361f2..30eb4a72ea7dea59bfe15a1beff70f82372bfb14 100644 (file)
@@ -1,48 +1,6 @@
+/* SPDX-License-Identifier: GPL-2.0 or BSD-3-Clause */
 /*
  * Copyright(c) 2016, 2017 Intel Corporation.
- *
- * This file is provided under a dual BSD/GPLv2 license.  When using or
- * redistributing this file, you may do so under either license.
- *
- * GPL LICENSE SUMMARY
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * BSD LICENSE
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- *  - Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- *  - Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in
- *    the documentation and/or other materials provided with the
- *    distribution.
- *  - Neither the name of Intel Corporation nor the names of its
- *    contributors may be used to endorse or promote products derived
- *    from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
  */
 
 #define RDI_DEV_ENTRY(rdi)   __string(dev, rvt_get_ibdev_name(rdi))
index 91bc192cee5e4e670ee56c49f4bff65ae6970f1c..30dd1d9bae26c5d1a93b642ac4bbf924c4f63277 100644 (file)
@@ -1,48 +1,6 @@
+/* SPDX-License-Identifier: GPL-2.0 or BSD-3-Clause */
 /*
  * Copyright(c) 2016 - 2018 Intel Corporation.
- *
- * This file is provided under a dual BSD/GPLv2 license.  When using or
- * redistributing this file, you may do so under either license.
- *
- * GPL LICENSE SUMMARY
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * BSD LICENSE
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- *  - Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- *  - Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in
- *    the documentation and/or other materials provided with the
- *    distribution.
- *  - Neither the name of Intel Corporation nor the names of its
- *    contributors may be used to endorse or promote products derived
- *    from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
  */
 #if !defined(__RVT_TRACE_CQ_H) || defined(TRACE_HEADER_MULTI_READ)
 #define __RVT_TRACE_CQ_H
index c5b675ca4fa08e75e5da9010f85450d2d4919a5b..1de7012000cb50619382ad8a9a0acc618f920b2f 100644 (file)
@@ -1,48 +1,6 @@
+/* SPDX-License-Identifier: GPL-2.0 or BSD-3-Clause */
 /*
  * Copyright(c) 2016 Intel Corporation.
- *
- * This file is provided under a dual BSD/GPLv2 license.  When using or
- * redistributing this file, you may do so under either license.
- *
- * GPL LICENSE SUMMARY
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * BSD LICENSE
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- *  - Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- *  - Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in
- *    the documentation and/or other materials provided with the
- *    distribution.
- *  - Neither the name of Intel Corporation nor the names of its
- *    contributors may be used to endorse or promote products derived
- *    from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
  */
 #if !defined(__RVT_TRACE_MR_H) || defined(TRACE_HEADER_MULTI_READ)
 #define __RVT_TRACE_MR_H
index 800cec8bb3c76204cff79f25c187b16fb0fcf2d3..c28c81fcb32a328f8d51d0417b3bf6a4cac0df15 100644 (file)
@@ -1,48 +1,6 @@
+/* SPDX-License-Identifier: GPL-2.0 or BSD-3-Clause */
 /*
  * Copyright(c) 2016 Intel Corporation.
- *
- * This file is provided under a dual BSD/GPLv2 license.  When using or
- * redistributing this file, you may do so under either license.
- *
- * GPL LICENSE SUMMARY
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * BSD LICENSE
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- *  - Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- *  - Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in
- *    the documentation and/or other materials provided with the
- *    distribution.
- *  - Neither the name of Intel Corporation nor the names of its
- *    contributors may be used to endorse or promote products derived
- *    from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
  */
 #if !defined(__RVT_TRACE_QP_H) || defined(TRACE_HEADER_MULTI_READ)
 #define __RVT_TRACE_QP_H
index 9de52e13802519f6766de8cc207df899f99571cb..833bf778b05d76dedea5ba64871bf6d46dc10b13 100644 (file)
@@ -1,48 +1,6 @@
+/* SPDX-License-Identifier: GPL-2.0 or BSD-3-Clause */
 /*
  * Copyright(c) 2017 Intel Corporation.
- *
- * This file is provided under a dual BSD/GPLv2 license.  When using or
- * redistributing this file, you may do so under either license.
- *
- * GPL LICENSE SUMMARY
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * BSD LICENSE
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- *  - Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- *  - Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in
- *    the documentation and/or other materials provided with the
- *    distribution.
- *  - Neither the name of Intel Corporation nor the names of its
- *    contributors may be used to endorse or promote products derived
- *    from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
  */
 #if !defined(__RVT_TRACE_RC_H) || defined(TRACE_HEADER_MULTI_READ)
 #define __RVT_TRACE_RC_H
index 746f33461d9a2630459bac4174fedfb7137776f3..9df6b0b8263b3baba91970f45023a80e1758a8ae 100644 (file)
@@ -1,48 +1,6 @@
+/* SPDX-License-Identifier: GPL-2.0 or BSD-3-Clause */
 /*
  * Copyright(c) 2016 Intel Corporation.
- *
- * This file is provided under a dual BSD/GPLv2 license.  When using or
- * redistributing this file, you may do so under either license.
- *
- * GPL LICENSE SUMMARY
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * BSD LICENSE
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- *  - Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- *  - Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in
- *    the documentation and/or other materials provided with the
- *    distribution.
- *  - Neither the name of Intel Corporation nor the names of its
- *    contributors may be used to endorse or promote products derived
- *    from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
  */
 #if !defined(__RVT_TRACE_RVT_H) || defined(TRACE_HEADER_MULTI_READ)
 #define __RVT_TRACE_RVT_H
index cb96be0f8f1946e31dbf7bc1264e21f65c60d853..ff7d39a30768ef09f5bc0182150403cf6f078172 100644 (file)
@@ -1,48 +1,6 @@
+/* SPDX-License-Identifier: GPL-2.0 or BSD-3-Clause */
 /*
  * Copyright(c) 2016 Intel Corporation.
- *
- * This file is provided under a dual BSD/GPLv2 license.  When using or
- * redistributing this file, you may do so under either license.
- *
- * GPL LICENSE SUMMARY
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * BSD LICENSE
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- *  - Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- *  - Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in
- *    the documentation and/or other materials provided with the
- *    distribution.
- *  - Neither the name of Intel Corporation nor the names of its
- *    contributors may be used to endorse or promote products derived
- *    from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
  */
 #if !defined(__RVT_TRACE_TX_H) || defined(TRACE_HEADER_MULTI_READ)
 #define __RVT_TRACE_TX_H
index ac17209816cdda3c188ddc94c489cab0c3e704ae..59481ae395054441e2a7112819f4a43863d56067 100644 (file)
@@ -1,48 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0 or BSD-3-Clause
 /*
  * Copyright(c) 2016 - 2018 Intel Corporation.
- *
- * This file is provided under a dual BSD/GPLv2 license.  When using or
- * redistributing this file, you may do so under either license.
- *
- * GPL LICENSE SUMMARY
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * BSD LICENSE
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- *  - Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- *  - Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in
- *    the documentation and/or other materials provided with the
- *    distribution.
- *  - Neither the name of Intel Corporation nor the names of its
- *    contributors may be used to endorse or promote products derived
- *    from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
  */
 
 #include <linux/module.h>
@@ -131,6 +89,13 @@ static int rvt_query_device(struct ib_device *ibdev,
        return 0;
 }
 
+static int rvt_get_numa_node(struct ib_device *ibdev)
+{
+       struct rvt_dev_info *rdi = ib_to_rvt(ibdev);
+
+       return rdi->dparms.node;
+}
+
 static int rvt_modify_device(struct ib_device *device,
                             int device_modify_mask,
                             struct ib_device_modify *device_modify)
@@ -380,6 +345,7 @@ static const struct ib_device_ops rvt_dev_ops = {
        .destroy_srq = rvt_destroy_srq,
        .detach_mcast = rvt_detach_mcast,
        .get_dma_mr = rvt_get_dma_mr,
+       .get_numa_node = rvt_get_numa_node,
        .get_port_immutable = rvt_get_port_immutable,
        .map_mr_sg = rvt_map_mr_sg,
        .mmap = rvt_mmap,
@@ -406,6 +372,7 @@ static const struct ib_device_ops rvt_dev_ops = {
        INIT_RDMA_OBJ_SIZE(ib_ah, rvt_ah, ibah),
        INIT_RDMA_OBJ_SIZE(ib_cq, rvt_cq, ibcq),
        INIT_RDMA_OBJ_SIZE(ib_pd, rvt_pd, ibpd),
+       INIT_RDMA_OBJ_SIZE(ib_qp, rvt_qp, ibqp),
        INIT_RDMA_OBJ_SIZE(ib_srq, rvt_srq, ibsrq),
        INIT_RDMA_OBJ_SIZE(ib_ucontext, rvt_ucontext, ibucontext),
 };
index c0fed6510f0b94d3dbad67bedab1111f055d9b4c..461574e3f6a5022a179684c7279c8bee531d01c7 100644 (file)
@@ -1,53 +1,11 @@
-#ifndef DEF_RDMAVT_H
-#define DEF_RDMAVT_H
-
+/* SPDX-License-Identifier: GPL-2.0 or BSD-3-Clause */
 /*
  * Copyright(c) 2016 Intel Corporation.
- *
- * This file is provided under a dual BSD/GPLv2 license.  When using or
- * redistributing this file, you may do so under either license.
- *
- * GPL LICENSE SUMMARY
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * BSD LICENSE
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- *  - Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- *  - Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in
- *    the documentation and/or other materials provided with the
- *    distribution.
- *  - Neither the name of Intel Corporation nor the names of its
- *    contributors may be used to endorse or promote products derived
- *    from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
  */
 
+#ifndef DEF_RDMAVT_H
+#define DEF_RDMAVT_H
+
 #include <rdma/rdma_vt.h>
 #include <linux/pci.h>
 #include "pd.h"
index 623fd17df02dded1cc3beedff6a8e2ea6b87351e..1bb3fb618bf5781b55eb120019a7228ade796908 100644 (file)
@@ -14,7 +14,6 @@
 
 #include <linux/module.h>
 #include <linux/skbuff.h>
-#include <linux/crc32.h>
 
 #include <rdma/ib_verbs.h>
 #include <rdma/ib_user_verbs.h>
 
 extern bool rxe_initialized;
 
-static inline u32 rxe_crc32(struct rxe_dev *rxe,
-                           u32 crc, void *next, size_t len)
-{
-       u32 retval;
-       int err;
-
-       SHASH_DESC_ON_STACK(shash, rxe->tfm);
-
-       shash->tfm = rxe->tfm;
-       *(u32 *)shash_desc_ctx(shash) = crc;
-       err = crypto_shash_update(shash, next, len);
-       if (unlikely(err)) {
-               pr_warn_ratelimited("failed crc calculation, err: %d\n", err);
-               return crc32_le(crc, next, len);
-       }
-
-       retval = *(u32 *)shash_desc_ctx(shash);
-       barrier_data(shash_desc_ctx(shash));
-       return retval;
-}
-
 void rxe_set_mtu(struct rxe_dev *rxe, unsigned int dev_mtu);
 
 int rxe_add(struct rxe_dev *rxe, unsigned int mtu, const char *ibdev_name);
index 58ad9c2644f3d2bf168432351ed5a737aaccfab7..d2d802c776fdc7caad46f380f4da4ed680a65b84 100644 (file)
@@ -349,7 +349,7 @@ static inline enum comp_state do_read(struct rxe_qp *qp,
 
        ret = copy_data(qp->pd, IB_ACCESS_LOCAL_WRITE,
                        &wqe->dma, payload_addr(pkt),
-                       payload_size(pkt), RXE_TO_MR_OBJ, NULL);
+                       payload_size(pkt), RXE_TO_MR_OBJ);
        if (ret) {
                wqe->status = IB_WC_LOC_PROT_ERR;
                return COMPST_ERROR;
@@ -371,7 +371,7 @@ static inline enum comp_state do_atomic(struct rxe_qp *qp,
 
        ret = copy_data(qp->pd, IB_ACCESS_LOCAL_WRITE,
                        &wqe->dma, &atomic_orig,
-                       sizeof(u64), RXE_TO_MR_OBJ, NULL);
+                       sizeof(u64), RXE_TO_MR_OBJ);
        if (ret) {
                wqe->status = IB_WC_LOC_PROT_ERR;
                return COMPST_ERROR;
index 66b2aad54bb7d1fa572969bfd0fc4810ff18dcf3..e03af3012590447756d98bde325b9d4f599d2db1 100644 (file)
@@ -4,18 +4,79 @@
  * Copyright (c) 2015 System Fabric Works, Inc. All rights reserved.
  */
 
+#include <linux/crc32.h>
+
 #include "rxe.h"
 #include "rxe_loc.h"
 
-/* Compute a partial ICRC for all the IB transport headers. */
-u32 rxe_icrc_hdr(struct rxe_pkt_info *pkt, struct sk_buff *skb)
+/**
+ * rxe_icrc_init() - Initialize crypto function for computing crc32
+ * @rxe: rdma_rxe device object
+ *
+ * Return: 0 on success else an error
+ */
+int rxe_icrc_init(struct rxe_dev *rxe)
+{
+       struct crypto_shash *tfm;
+
+       tfm = crypto_alloc_shash("crc32", 0, 0);
+       if (IS_ERR(tfm)) {
+               pr_warn("failed to init crc32 algorithm err:%ld\n",
+                              PTR_ERR(tfm));
+               return PTR_ERR(tfm);
+       }
+
+       rxe->tfm = tfm;
+
+       return 0;
+}
+
+/**
+ * rxe_crc32() - Compute cumulative crc32 for a contiguous segment
+ * @rxe: rdma_rxe device object
+ * @crc: starting crc32 value from previous segments
+ * @next: starting address of current segment
+ * @len: length of current segment
+ *
+ * Return: the cumulative crc32 checksum
+ */
+static __be32 rxe_crc32(struct rxe_dev *rxe, __be32 crc, void *next, size_t len)
+{
+       __be32 icrc;
+       int err;
+
+       SHASH_DESC_ON_STACK(shash, rxe->tfm);
+
+       shash->tfm = rxe->tfm;
+       *(__be32 *)shash_desc_ctx(shash) = crc;
+       err = crypto_shash_update(shash, next, len);
+       if (unlikely(err)) {
+               pr_warn_ratelimited("failed crc calculation, err: %d\n", err);
+               return (__force __be32)crc32_le((__force u32)crc, next, len);
+       }
+
+       icrc = *(__be32 *)shash_desc_ctx(shash);
+       barrier_data(shash_desc_ctx(shash));
+
+       return icrc;
+}
+
+/**
+ * rxe_icrc_hdr() - Compute the partial ICRC for the network and transport
+ *               headers of a packet.
+ * @skb: packet buffer
+ * @pkt: packet information
+ *
+ * Return: the partial ICRC
+ */
+static __be32 rxe_icrc_hdr(struct sk_buff *skb, struct rxe_pkt_info *pkt)
 {
        unsigned int bth_offset = 0;
        struct iphdr *ip4h = NULL;
        struct ipv6hdr *ip6h = NULL;
        struct udphdr *udph;
        struct rxe_bth *bth;
-       int crc;
+       __be32 crc;
        int length;
        int hdr_size = sizeof(struct udphdr) +
                (skb->protocol == htons(ETH_P_IP) ?
@@ -30,7 +91,7 @@ u32 rxe_icrc_hdr(struct rxe_pkt_info *pkt, struct sk_buff *skb)
        /* This seed is the result of computing a CRC with a seed of
         * 0xfffffff and 8 bytes of 0xff representing a masked LRH.
         */
-       crc = 0xdebb20e3;
+       crc = (__force __be32)0xdebb20e3;
 
        if (skb->protocol == htons(ETH_P_IP)) { /* IPv4 */
                memcpy(pshdr, ip_hdr(skb), hdr_size);
@@ -67,3 +128,58 @@ u32 rxe_icrc_hdr(struct rxe_pkt_info *pkt, struct sk_buff *skb)
                        rxe_opcode[pkt->opcode].length - RXE_BTH_BYTES);
        return crc;
 }
+
+/**
+ * rxe_icrc_check() - Compute ICRC for a packet and compare to the ICRC
+ *                   delivered in the packet.
+ * @skb: packet buffer
+ * @pkt: packet information
+ *
+ * Return: 0 if the values match else an error
+ */
+int rxe_icrc_check(struct sk_buff *skb, struct rxe_pkt_info *pkt)
+{
+       __be32 *icrcp;
+       __be32 pkt_icrc;
+       __be32 icrc;
+
+       icrcp = (__be32 *)(pkt->hdr + pkt->paylen - RXE_ICRC_SIZE);
+       pkt_icrc = *icrcp;
+
+       icrc = rxe_icrc_hdr(skb, pkt);
+       icrc = rxe_crc32(pkt->rxe, icrc, (u8 *)payload_addr(pkt),
+                               payload_size(pkt) + bth_pad(pkt));
+       icrc = ~icrc;
+
+       if (unlikely(icrc != pkt_icrc)) {
+               if (skb->protocol == htons(ETH_P_IPV6))
+                       pr_warn_ratelimited("bad ICRC from %pI6c\n",
+                                           &ipv6_hdr(skb)->saddr);
+               else if (skb->protocol == htons(ETH_P_IP))
+                       pr_warn_ratelimited("bad ICRC from %pI4\n",
+                                           &ip_hdr(skb)->saddr);
+               else
+                       pr_warn_ratelimited("bad ICRC from unknown\n");
+
+               return -EINVAL;
+       }
+
+       return 0;
+}
+
+/**
+ * rxe_icrc_generate() - compute ICRC for a packet.
+ * @skb: packet buffer
+ * @pkt: packet information
+ */
+void rxe_icrc_generate(struct sk_buff *skb, struct rxe_pkt_info *pkt)
+{
+       __be32 *icrcp;
+       __be32 icrc;
+
+       icrcp = (__be32 *)(pkt->hdr + pkt->paylen - RXE_ICRC_SIZE);
+       icrc = rxe_icrc_hdr(skb, pkt);
+       icrc = rxe_crc32(pkt->rxe, icrc, (u8 *)payload_addr(pkt),
+                               payload_size(pkt) + bth_pad(pkt));
+       *icrcp = ~icrc;
+}
index 1ddb20855dee7621d4cd56f137b3413b24a4a8f0..f0c954575bdec7099109d73af14d36ada220fb8f 100644 (file)
@@ -77,10 +77,9 @@ int rxe_mr_init_user(struct rxe_pd *pd, u64 start, u64 length, u64 iova,
                     int access, struct rxe_mr *mr);
 int rxe_mr_init_fast(struct rxe_pd *pd, int max_pages, struct rxe_mr *mr);
 int rxe_mr_copy(struct rxe_mr *mr, u64 iova, void *addr, int length,
-               enum rxe_mr_copy_dir dir, u32 *crcp);
-int copy_data(struct rxe_pd *pd, int access,
-             struct rxe_dma_info *dma, void *addr, int length,
-             enum rxe_mr_copy_dir dir, u32 *crcp);
+               enum rxe_mr_copy_dir dir);
+int copy_data(struct rxe_pd *pd, int access, struct rxe_dma_info *dma,
+             void *addr, int length, enum rxe_mr_copy_dir dir);
 void *iova_to_vaddr(struct rxe_mr *mr, u64 iova, int length);
 struct rxe_mr *lookup_mr(struct rxe_pd *pd, int access, u32 key,
                         enum rxe_mr_lookup_type type);
@@ -99,11 +98,11 @@ struct rxe_mw *rxe_lookup_mw(struct rxe_qp *qp, int access, u32 rkey);
 void rxe_mw_cleanup(struct rxe_pool_entry *arg);
 
 /* rxe_net.c */
-void rxe_loopback(struct sk_buff *skb);
-int rxe_send(struct rxe_pkt_info *pkt, struct sk_buff *skb);
 struct sk_buff *rxe_init_packet(struct rxe_dev *rxe, struct rxe_av *av,
                                int paylen, struct rxe_pkt_info *pkt);
-int rxe_prepare(struct rxe_pkt_info *pkt, struct sk_buff *skb, u32 *crc);
+int rxe_prepare(struct rxe_pkt_info *pkt, struct sk_buff *skb);
+int rxe_xmit_packet(struct rxe_qp *qp, struct rxe_pkt_info *pkt,
+                   struct sk_buff *skb);
 const char *rxe_parent_name(struct rxe_dev *rxe, unsigned int port_num);
 int rxe_mcast_add(struct rxe_dev *rxe, union ib_gid *mgid);
 int rxe_mcast_delete(struct rxe_dev *rxe, union ib_gid *mgid);
@@ -193,7 +192,10 @@ int rxe_completer(void *arg);
 int rxe_requester(void *arg);
 int rxe_responder(void *arg);
 
-u32 rxe_icrc_hdr(struct rxe_pkt_info *pkt, struct sk_buff *skb);
+/* rxe_icrc.c */
+int rxe_icrc_init(struct rxe_dev *rxe);
+int rxe_icrc_check(struct sk_buff *skb, struct rxe_pkt_info *pkt);
+void rxe_icrc_generate(struct sk_buff *skb, struct rxe_pkt_info *pkt);
 
 void rxe_resp_queue_pkt(struct rxe_qp *qp, struct sk_buff *skb);
 
@@ -204,47 +206,4 @@ static inline unsigned int wr_opcode_mask(int opcode, struct rxe_qp *qp)
        return rxe_wr_opcode_info[opcode].mask[qp->ibqp.qp_type];
 }
 
-static inline int rxe_xmit_packet(struct rxe_qp *qp, struct rxe_pkt_info *pkt,
-                                 struct sk_buff *skb)
-{
-       int err;
-       int is_request = pkt->mask & RXE_REQ_MASK;
-       struct rxe_dev *rxe = to_rdev(qp->ibqp.device);
-
-       if ((is_request && (qp->req.state != QP_STATE_READY)) ||
-           (!is_request && (qp->resp.state != QP_STATE_READY))) {
-               pr_info("Packet dropped. QP is not in ready state\n");
-               goto drop;
-       }
-
-       if (pkt->mask & RXE_LOOPBACK_MASK) {
-               memcpy(SKB_TO_PKT(skb), pkt, sizeof(*pkt));
-               rxe_loopback(skb);
-               err = 0;
-       } else {
-               err = rxe_send(pkt, skb);
-       }
-
-       if (err) {
-               rxe->xmit_errors++;
-               rxe_counter_inc(rxe, RXE_CNT_SEND_ERR);
-               return err;
-       }
-
-       if ((qp_type(qp) != IB_QPT_RC) &&
-           (pkt->mask & RXE_END_MASK)) {
-               pkt->wqe->state = wqe_state_done;
-               rxe_run_task(&qp->comp.task, 1);
-       }
-
-       rxe_counter_inc(rxe, RXE_CNT_SENT_PKTS);
-       goto done;
-
-drop:
-       kfree_skb(skb);
-       err = 0;
-done:
-       return err;
-}
-
 #endif /* RXE_LOC_H */
index b5fcb14350c796995fe2382238f3ffa3b71f32d2..5890a824621616b73f80314df858ab472ca80871 100644 (file)
@@ -123,7 +123,6 @@ int rxe_mr_init_user(struct rxe_pd *pd, u64 start, u64 length, u64 iova,
                goto err_out;
        }
 
-       mr->umem = umem;
        num_buf = ib_umem_num_pages(umem);
 
        rxe_mr_init(access, mr);
@@ -286,11 +285,10 @@ out:
 }
 
 /* copy data from a range (vaddr, vaddr+length-1) to or from
- * a mr object starting at iova. Compute incremental value of
- * crc32 if crcp is not zero. caller must hold a reference to mr
+ * a mr object starting at iova.
  */
 int rxe_mr_copy(struct rxe_mr *mr, u64 iova, void *addr, int length,
-               enum rxe_mr_copy_dir dir, u32 *crcp)
+               enum rxe_mr_copy_dir dir)
 {
        int                     err;
        int                     bytes;
@@ -300,7 +298,6 @@ int rxe_mr_copy(struct rxe_mr *mr, u64 iova, void *addr, int length,
        int                     m;
        int                     i;
        size_t                  offset;
-       u32                     crc = crcp ? (*crcp) : 0;
 
        if (length == 0)
                return 0;
@@ -314,10 +311,6 @@ int rxe_mr_copy(struct rxe_mr *mr, u64 iova, void *addr, int length,
 
                memcpy(dest, src, length);
 
-               if (crcp)
-                       *crcp = rxe_crc32(to_rdev(mr->ibmr.device), *crcp, dest,
-                                         length);
-
                return 0;
        }
 
@@ -348,10 +341,6 @@ int rxe_mr_copy(struct rxe_mr *mr, u64 iova, void *addr, int length,
 
                memcpy(dest, src, bytes);
 
-               if (crcp)
-                       crc = rxe_crc32(to_rdev(mr->ibmr.device), crc, dest,
-                                       bytes);
-
                length  -= bytes;
                addr    += bytes;
 
@@ -366,9 +355,6 @@ int rxe_mr_copy(struct rxe_mr *mr, u64 iova, void *addr, int length,
                }
        }
 
-       if (crcp)
-               *crcp = crc;
-
        return 0;
 
 err1:
@@ -384,8 +370,7 @@ int copy_data(
        struct rxe_dma_info     *dma,
        void                    *addr,
        int                     length,
-       enum rxe_mr_copy_dir    dir,
-       u32                     *crcp)
+       enum rxe_mr_copy_dir    dir)
 {
        int                     bytes;
        struct rxe_sge          *sge    = &dma->sge[dma->cur_sge];
@@ -446,7 +431,7 @@ int copy_data(
                if (bytes > 0) {
                        iova = sge->addr + offset;
 
-                       err = rxe_mr_copy(mr, iova, addr, bytes, dir, crcp);
+                       err = rxe_mr_copy(mr, iova, addr, bytes, dir);
                        if (err)
                                goto err2;
 
index 5ac27f28ace10260d8416da885fd424de34f311c..2cb810cb890a5108c2bfdb8d4b928fc7944c5b85 100644 (file)
@@ -344,7 +344,7 @@ static int prepare6(struct rxe_pkt_info *pkt, struct sk_buff *skb)
        return 0;
 }
 
-int rxe_prepare(struct rxe_pkt_info *pkt, struct sk_buff *skb, u32 *crc)
+int rxe_prepare(struct rxe_pkt_info *pkt, struct sk_buff *skb)
 {
        int err = 0;
 
@@ -353,8 +353,6 @@ int rxe_prepare(struct rxe_pkt_info *pkt, struct sk_buff *skb, u32 *crc)
        else if (skb->protocol == htons(ETH_P_IPV6))
                err = prepare6(pkt, skb);
 
-       *crc = rxe_icrc_hdr(pkt, skb);
-
        if (ether_addr_equal(skb->dev->dev_addr, rxe_get_av(pkt)->dmac))
                pkt->mask |= RXE_LOOPBACK_MASK;
 
@@ -374,7 +372,7 @@ static void rxe_skb_tx_dtor(struct sk_buff *skb)
        rxe_drop_ref(qp);
 }
 
-int rxe_send(struct rxe_pkt_info *pkt, struct sk_buff *skb)
+static int rxe_send(struct sk_buff *skb, struct rxe_pkt_info *pkt)
 {
        int err;
 
@@ -407,19 +405,64 @@ int rxe_send(struct rxe_pkt_info *pkt, struct sk_buff *skb)
 /* fix up a send packet to match the packets
  * received from UDP before looping them back
  */
-void rxe_loopback(struct sk_buff *skb)
+static int rxe_loopback(struct sk_buff *skb, struct rxe_pkt_info *pkt)
 {
-       struct rxe_pkt_info *pkt = SKB_TO_PKT(skb);
+       memcpy(SKB_TO_PKT(skb), pkt, sizeof(*pkt));
 
        if (skb->protocol == htons(ETH_P_IP))
                skb_pull(skb, sizeof(struct iphdr));
        else
                skb_pull(skb, sizeof(struct ipv6hdr));
 
-       if (WARN_ON(!ib_device_try_get(&pkt->rxe->ib_dev)))
+       if (WARN_ON(!ib_device_try_get(&pkt->rxe->ib_dev))) {
                kfree_skb(skb);
+               return -EIO;
+       }
+
+       rxe_rcv(skb);
+
+       return 0;
+}
+
+int rxe_xmit_packet(struct rxe_qp *qp, struct rxe_pkt_info *pkt,
+                   struct sk_buff *skb)
+{
+       int err;
+       int is_request = pkt->mask & RXE_REQ_MASK;
+       struct rxe_dev *rxe = to_rdev(qp->ibqp.device);
+
+       if ((is_request && (qp->req.state != QP_STATE_READY)) ||
+           (!is_request && (qp->resp.state != QP_STATE_READY))) {
+               pr_info("Packet dropped. QP is not in ready state\n");
+               goto drop;
+       }
+
+       rxe_icrc_generate(skb, pkt);
+
+       if (pkt->mask & RXE_LOOPBACK_MASK)
+               err = rxe_loopback(skb, pkt);
        else
-               rxe_rcv(skb);
+               err = rxe_send(skb, pkt);
+       if (err) {
+               rxe->xmit_errors++;
+               rxe_counter_inc(rxe, RXE_CNT_SEND_ERR);
+               return err;
+       }
+
+       if ((qp_type(qp) != IB_QPT_RC) &&
+           (pkt->mask & RXE_END_MASK)) {
+               pkt->wqe->state = wqe_state_done;
+               rxe_run_task(&qp->comp.task, 1);
+       }
+
+       rxe_counter_inc(rxe, RXE_CNT_SENT_PKTS);
+       goto done;
+
+drop:
+       kfree_skb(skb);
+       err = 0;
+done:
+       return err;
 }
 
 struct sk_buff *rxe_init_packet(struct rxe_dev *rxe, struct rxe_av *av,
index 0b8e7c6255a25560db16a250bf7c220a5de45b99..ffa8420b4765d5a136d24337ec5c3a26f73ba33f 100644 (file)
@@ -41,7 +41,7 @@ struct rxe_type_info rxe_type_info[RXE_NUM_TYPES] = {
                .size           = sizeof(struct rxe_qp),
                .elem_offset    = offsetof(struct rxe_qp, pelem),
                .cleanup        = rxe_qp_cleanup,
-               .flags          = RXE_POOL_INDEX,
+               .flags          = RXE_POOL_INDEX | RXE_POOL_NO_ALLOC,
                .min_index      = RXE_MIN_QP_INDEX,
                .max_index      = RXE_MAX_QP_INDEX,
        },
index 7a49e27da23a9ad202bce3f35d05aa7ca703c52a..6a6cc1fa90e4b1c04e1794ee975f7c2e9839b35d 100644 (file)
@@ -361,8 +361,6 @@ void rxe_rcv(struct sk_buff *skb)
        int err;
        struct rxe_pkt_info *pkt = SKB_TO_PKT(skb);
        struct rxe_dev *rxe = pkt->rxe;
-       __be32 *icrcp;
-       u32 calc_icrc, pack_icrc;
 
        if (unlikely(skb->len < RXE_BTH_BYTES))
                goto drop;
@@ -384,26 +382,9 @@ void rxe_rcv(struct sk_buff *skb)
        if (unlikely(err))
                goto drop;
 
-       /* Verify ICRC */
-       icrcp = (__be32 *)(pkt->hdr + pkt->paylen - RXE_ICRC_SIZE);
-       pack_icrc = be32_to_cpu(*icrcp);
-
-       calc_icrc = rxe_icrc_hdr(pkt, skb);
-       calc_icrc = rxe_crc32(rxe, calc_icrc, (u8 *)payload_addr(pkt),
-                             payload_size(pkt) + bth_pad(pkt));
-       calc_icrc = (__force u32)cpu_to_be32(~calc_icrc);
-       if (unlikely(calc_icrc != pack_icrc)) {
-               if (skb->protocol == htons(ETH_P_IPV6))
-                       pr_warn_ratelimited("bad ICRC from %pI6c\n",
-                                           &ipv6_hdr(skb)->saddr);
-               else if (skb->protocol == htons(ETH_P_IP))
-                       pr_warn_ratelimited("bad ICRC from %pI4\n",
-                                           &ip_hdr(skb)->saddr);
-               else
-                       pr_warn_ratelimited("bad ICRC from unknown\n");
-
+       err = rxe_icrc_check(skb, pkt);
+       if (unlikely(err))
                goto drop;
-       }
 
        rxe_counter_inc(rxe, RXE_CNT_RCVD_PKTS);
 
index c57699cc6578d2552be21e02c296c1ec4ea6a704..3894197a82f62f8bf6bc9df236022fe9cef73d17 100644 (file)
@@ -466,12 +466,9 @@ static int finish_packet(struct rxe_qp *qp, struct rxe_send_wqe *wqe,
                       struct rxe_pkt_info *pkt, struct sk_buff *skb,
                       int paylen)
 {
-       struct rxe_dev *rxe = to_rdev(qp->ibqp.device);
-       u32 crc = 0;
-       u32 *p;
        int err;
 
-       err = rxe_prepare(pkt, skb, &crc);
+       err = rxe_prepare(pkt, skb);
        if (err)
                return err;
 
@@ -479,7 +476,6 @@ static int finish_packet(struct rxe_qp *qp, struct rxe_send_wqe *wqe,
                if (wqe->wr.send_flags & IB_SEND_INLINE) {
                        u8 *tmp = &wqe->dma.inline_data[wqe->dma.sge_offset];
 
-                       crc = rxe_crc32(rxe, crc, tmp, paylen);
                        memcpy(payload_addr(pkt), tmp, paylen);
 
                        wqe->dma.resid -= paylen;
@@ -487,8 +483,7 @@ static int finish_packet(struct rxe_qp *qp, struct rxe_send_wqe *wqe,
                } else {
                        err = copy_data(qp->pd, 0, &wqe->dma,
                                        payload_addr(pkt), paylen,
-                                       RXE_FROM_MR_OBJ,
-                                       &crc);
+                                       RXE_FROM_MR_OBJ);
                        if (err)
                                return err;
                }
@@ -496,12 +491,8 @@ static int finish_packet(struct rxe_qp *qp, struct rxe_send_wqe *wqe,
                        u8 *pad = payload_addr(pkt) + paylen;
 
                        memset(pad, 0, bth_pad(pkt));
-                       crc = rxe_crc32(rxe, crc, pad, bth_pad(pkt));
                }
        }
-       p = payload_addr(pkt) + paylen + bth_pad(pkt);
-
-       *p = ~crc;
 
        return 0;
 }
index 360ec67cb9e1e10665e293f9d6dc5f3ca0f0e821..5501227ddc650faa015a3435018c2f45267f330a 100644 (file)
@@ -536,7 +536,7 @@ static enum resp_states send_data_in(struct rxe_qp *qp, void *data_addr,
        int err;
 
        err = copy_data(qp->pd, IB_ACCESS_LOCAL_WRITE, &qp->resp.wqe->dma,
-                       data_addr, data_len, RXE_TO_MR_OBJ, NULL);
+                       data_addr, data_len, RXE_TO_MR_OBJ);
        if (unlikely(err))
                return (err == -ENOSPC) ? RESPST_ERR_LENGTH
                                        : RESPST_ERR_MALFORMED_WQE;
@@ -552,7 +552,7 @@ static enum resp_states write_data_in(struct rxe_qp *qp,
        int data_len = payload_size(pkt);
 
        err = rxe_mr_copy(qp->resp.mr, qp->resp.va + qp->resp.offset,
-                         payload_addr(pkt), data_len, RXE_TO_MR_OBJ, NULL);
+                         payload_addr(pkt), data_len, RXE_TO_MR_OBJ);
        if (err) {
                rc = RESPST_ERR_RKEY_VIOLATION;
                goto out;
@@ -613,13 +613,10 @@ static struct sk_buff *prepare_ack_packet(struct rxe_qp *qp,
                                          int opcode,
                                          int payload,
                                          u32 psn,
-                                         u8 syndrome,
-                                         u32 *crcp)
+                                         u8 syndrome)
 {
        struct rxe_dev *rxe = to_rdev(qp->ibqp.device);
        struct sk_buff *skb;
-       u32 crc = 0;
-       u32 *p;
        int paylen;
        int pad;
        int err;
@@ -651,20 +648,12 @@ static struct sk_buff *prepare_ack_packet(struct rxe_qp *qp,
        if (ack->mask & RXE_ATMACK_MASK)
                atmack_set_orig(ack, qp->resp.atomic_orig);
 
-       err = rxe_prepare(ack, skb, &crc);
+       err = rxe_prepare(ack, skb);
        if (err) {
                kfree_skb(skb);
                return NULL;
        }
 
-       if (crcp) {
-               /* CRC computation will be continued by the caller */
-               *crcp = crc;
-       } else {
-               p = payload_addr(ack) + payload + bth_pad(ack);
-               *p = ~crc;
-       }
-
        return skb;
 }
 
@@ -682,8 +671,6 @@ static enum resp_states read_reply(struct rxe_qp *qp,
        int opcode;
        int err;
        struct resp_res *res = qp->resp.res;
-       u32 icrc;
-       u32 *p;
 
        if (!res) {
                /* This is the first time we process that request. Get a
@@ -742,24 +729,20 @@ static enum resp_states read_reply(struct rxe_qp *qp,
        payload = min_t(int, res->read.resid, mtu);
 
        skb = prepare_ack_packet(qp, req_pkt, &ack_pkt, opcode, payload,
-                                res->cur_psn, AETH_ACK_UNLIMITED, &icrc);
+                                res->cur_psn, AETH_ACK_UNLIMITED);
        if (!skb)
                return RESPST_ERR_RNR;
 
        err = rxe_mr_copy(res->read.mr, res->read.va, payload_addr(&ack_pkt),
-                         payload, RXE_FROM_MR_OBJ, &icrc);
+                         payload, RXE_FROM_MR_OBJ);
        if (err)
                pr_err("Failed copying memory\n");
 
        if (bth_pad(&ack_pkt)) {
-               struct rxe_dev *rxe = to_rdev(qp->ibqp.device);
                u8 *pad = payload_addr(&ack_pkt) + payload;
 
                memset(pad, 0, bth_pad(&ack_pkt));
-               icrc = rxe_crc32(rxe, icrc, pad, bth_pad(&ack_pkt));
        }
-       p = payload_addr(&ack_pkt) + payload + bth_pad(&ack_pkt);
-       *p = ~icrc;
 
        err = rxe_xmit_packet(qp, &ack_pkt, skb);
        if (err) {
@@ -984,7 +967,7 @@ static int send_ack(struct rxe_qp *qp, struct rxe_pkt_info *pkt,
        struct sk_buff *skb;
 
        skb = prepare_ack_packet(qp, pkt, &ack_pkt, IB_OPCODE_RC_ACKNOWLEDGE,
-                                0, psn, syndrome, NULL);
+                                0, psn, syndrome);
        if (!skb) {
                err = -ENOMEM;
                goto err1;
@@ -1008,7 +991,7 @@ static int send_atomic_ack(struct rxe_qp *qp, struct rxe_pkt_info *pkt,
 
        skb = prepare_ack_packet(qp, pkt, &ack_pkt,
                                 IB_OPCODE_RC_ATOMIC_ACKNOWLEDGE, 0, pkt->psn,
-                                syndrome, NULL);
+                                syndrome);
        if (!skb) {
                rc = -ENOMEM;
                goto out;
index c223959ac174edc02d93e0566dec215dcfd403c0..267b5a9c345d0864a3334b6f51202ea9833255d7 100644 (file)
@@ -391,59 +391,52 @@ static int rxe_post_srq_recv(struct ib_srq *ibsrq, const struct ib_recv_wr *wr,
        return err;
 }
 
-static struct ib_qp *rxe_create_qp(struct ib_pd *ibpd,
-                                  struct ib_qp_init_attr *init,
-                                  struct ib_udata *udata)
+static int rxe_create_qp(struct ib_qp *ibqp, struct ib_qp_init_attr *init,
+                        struct ib_udata *udata)
 {
        int err;
-       struct rxe_dev *rxe = to_rdev(ibpd->device);
-       struct rxe_pd *pd = to_rpd(ibpd);
-       struct rxe_qp *qp;
+       struct rxe_dev *rxe = to_rdev(ibqp->device);
+       struct rxe_pd *pd = to_rpd(ibqp->pd);
+       struct rxe_qp *qp = to_rqp(ibqp);
        struct rxe_create_qp_resp __user *uresp = NULL;
 
        if (udata) {
                if (udata->outlen < sizeof(*uresp))
-                       return ERR_PTR(-EINVAL);
+                       return -EINVAL;
                uresp = udata->outbuf;
        }
 
        if (init->create_flags)
-               return ERR_PTR(-EOPNOTSUPP);
+               return -EOPNOTSUPP;
 
        err = rxe_qp_chk_init(rxe, init);
        if (err)
-               goto err1;
-
-       qp = rxe_alloc(&rxe->qp_pool);
-       if (!qp) {
-               err = -ENOMEM;
-               goto err1;
-       }
+               return err;
 
        if (udata) {
-               if (udata->inlen) {
-                       err = -EINVAL;
-                       goto err2;
-               }
+               if (udata->inlen)
+                       return -EINVAL;
+
                qp->is_user = true;
        } else {
                qp->is_user = false;
        }
 
-       rxe_add_index(qp);
+       err = rxe_add_to_pool(&rxe->qp_pool, qp);
+       if (err)
+               return err;
 
-       err = rxe_qp_from_init(rxe, qp, pd, init, uresp, ibpd, udata);
+       rxe_add_index(qp);
+       err = rxe_qp_from_init(rxe, qp, pd, init, uresp, ibqp->pd, udata);
        if (err)
-               goto err3;
+               goto qp_init;
 
-       return &qp->ibqp;
+       return 0;
 
-err3:
+qp_init:
        rxe_drop_index(qp);
-err2:
        rxe_drop_ref(qp);
-err1:
-       return ERR_PTR(err);
+       return err;
 }
 
 static int rxe_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr,
@@ -1145,6 +1138,7 @@ static const struct ib_device_ops rxe_dev_ops = {
        INIT_RDMA_OBJ_SIZE(ib_ah, rxe_ah, ibah),
        INIT_RDMA_OBJ_SIZE(ib_cq, rxe_cq, ibcq),
        INIT_RDMA_OBJ_SIZE(ib_pd, rxe_pd, ibpd),
+       INIT_RDMA_OBJ_SIZE(ib_qp, rxe_qp, ibqp),
        INIT_RDMA_OBJ_SIZE(ib_srq, rxe_srq, ibsrq),
        INIT_RDMA_OBJ_SIZE(ib_ucontext, rxe_ucontext, ibuc),
        INIT_RDMA_OBJ_SIZE(ib_mw, rxe_mw, ibmw),
@@ -1154,7 +1148,6 @@ int rxe_register_device(struct rxe_dev *rxe, const char *ibdev_name)
 {
        int err;
        struct ib_device *dev = &rxe->ib_dev;
-       struct crypto_shash *tfm;
 
        strscpy(dev->node_desc, "rxe", sizeof(dev->node_desc));
 
@@ -1173,13 +1166,9 @@ int rxe_register_device(struct rxe_dev *rxe, const char *ibdev_name)
        if (err)
                return err;
 
-       tfm = crypto_alloc_shash("crc32", 0, 0);
-       if (IS_ERR(tfm)) {
-               pr_err("failed to allocate crc algorithm err:%ld\n",
-                      PTR_ERR(tfm));
-               return PTR_ERR(tfm);
-       }
-       rxe->tfm = tfm;
+       err = rxe_icrc_init(rxe);
+       if (err)
+               return err;
 
        err = ib_register_device(dev, ibdev_name, NULL);
        if (err)
index 959a3260fcab7ada515bee86cab608dc4fb0313c..ac2a2148027f47cd93afb1dae8c9694d9bf7e74f 100644 (file)
@@ -210,8 +210,8 @@ struct rxe_resp_info {
 };
 
 struct rxe_qp {
-       struct rxe_pool_entry   pelem;
        struct ib_qp            ibqp;
+       struct rxe_pool_entry   pelem;
        struct ib_qp_attr       attr;
        unsigned int            valid;
        unsigned int            mtu;
index cf55326f2ab49e4c520531a357bdb9caed47113c..9093e6a80b2606e0c9bdf97d223328512c772d3b 100644 (file)
@@ -297,6 +297,7 @@ static const struct ib_device_ops siw_device_ops = {
 
        INIT_RDMA_OBJ_SIZE(ib_cq, siw_cq, base_cq),
        INIT_RDMA_OBJ_SIZE(ib_pd, siw_pd, base_pd),
+       INIT_RDMA_OBJ_SIZE(ib_qp, siw_qp, base_qp),
        INIT_RDMA_OBJ_SIZE(ib_srq, siw_srq, base_srq),
        INIT_RDMA_OBJ_SIZE(ib_ucontext, siw_ucontext, base_ucontext),
 };
index ddb2e66f9f1334fa916ea8d8de2f3da4bb680599..7e01f2438afc5ed759182cac9a18514b92a7b850 100644 (file)
@@ -1344,6 +1344,4 @@ void siw_free_qp(struct kref *ref)
        siw_put_tx_cpu(qp->tx_cpu);
 
        atomic_dec(&sdev->num_qp);
-       siw_dbg_qp(qp, "free QP\n");
-       kfree_rcu(qp, rcu);
 }
index 7989c4043db4ef0d6e894ffa3b6ae82a1ba253cb..1f4e60257700ef4dffff91a81f3305569c45ebb1 100644 (file)
@@ -76,7 +76,7 @@ static int siw_try_1seg(struct siw_iwarp_tx *c_tx, void *paddr)
                        if (unlikely(!p))
                                return -EFAULT;
 
-                       buffer = kmap(p);
+                       buffer = kmap_local_page(p);
 
                        if (likely(PAGE_SIZE - off >= bytes)) {
                                memcpy(paddr, buffer + off, bytes);
@@ -84,7 +84,7 @@ static int siw_try_1seg(struct siw_iwarp_tx *c_tx, void *paddr)
                                unsigned long part = bytes - (PAGE_SIZE - off);
 
                                memcpy(paddr, buffer + off, part);
-                               kunmap(p);
+                               kunmap_local(buffer);
 
                                if (!mem->is_pbl)
                                        p = siw_get_upage(mem->umem,
@@ -96,10 +96,10 @@ static int siw_try_1seg(struct siw_iwarp_tx *c_tx, void *paddr)
                                if (unlikely(!p))
                                        return -EFAULT;
 
-                               buffer = kmap(p);
+                               buffer = kmap_local_page(p);
                                memcpy(paddr + part, buffer, bytes - part);
                        }
-                       kunmap(p);
+                       kunmap_local(buffer);
                }
        }
        return (int)bytes;
@@ -396,13 +396,20 @@ static int siw_0copy_tx(struct socket *s, struct page **page,
 
 #define MAX_TRAILER (MPA_CRC_SIZE + 4)
 
-static void siw_unmap_pages(struct page **pp, unsigned long kmap_mask)
+static void siw_unmap_pages(struct kvec *iov, unsigned long kmap_mask, int len)
 {
-       while (kmap_mask) {
-               if (kmap_mask & BIT(0))
-                       kunmap(*pp);
-               pp++;
-               kmap_mask >>= 1;
+       int i;
+
+       /*
+        * Work backwards through the array to honor the kmap_local_page()
+        * ordering requirements.
+        */
+       for (i = (len-1); i >= 0; i--) {
+               if (kmap_mask & BIT(i)) {
+                       unsigned long addr = (unsigned long)iov[i].iov_base;
+
+                       kunmap_local((void *)(addr & PAGE_MASK));
+               }
        }
 }
 
@@ -485,6 +492,7 @@ static int siw_tx_hdt(struct siw_iwarp_tx *c_tx, struct socket *s)
 
                while (sge_len) {
                        size_t plen = min((int)PAGE_SIZE - fp_off, sge_len);
+                       void *kaddr;
 
                        if (!is_kva) {
                                struct page *p;
@@ -497,7 +505,7 @@ static int siw_tx_hdt(struct siw_iwarp_tx *c_tx, struct socket *s)
                                        p = siw_get_upage(mem->umem,
                                                          sge->laddr + sge_off);
                                if (unlikely(!p)) {
-                                       siw_unmap_pages(page_array, kmap_mask);
+                                       siw_unmap_pages(iov, kmap_mask, seg);
                                        wqe->processed -= c_tx->bytes_unsent;
                                        rv = -EFAULT;
                                        goto done_crc;
@@ -505,11 +513,12 @@ static int siw_tx_hdt(struct siw_iwarp_tx *c_tx, struct socket *s)
                                page_array[seg] = p;
 
                                if (!c_tx->use_sendpage) {
-                                       iov[seg].iov_base = kmap(p) + fp_off;
-                                       iov[seg].iov_len = plen;
+                                       void *kaddr = kmap_local_page(p);
 
                                        /* Remember for later kunmap() */
                                        kmap_mask |= BIT(seg);
+                                       iov[seg].iov_base = kaddr + fp_off;
+                                       iov[seg].iov_len = plen;
 
                                        if (do_crc)
                                                crypto_shash_update(
@@ -517,10 +526,11 @@ static int siw_tx_hdt(struct siw_iwarp_tx *c_tx, struct socket *s)
                                                        iov[seg].iov_base,
                                                        plen);
                                } else if (do_crc) {
+                                       kaddr = kmap_local_page(p);
                                        crypto_shash_update(c_tx->mpa_crc_hd,
-                                                           kmap(p) + fp_off,
+                                                           kaddr + fp_off,
                                                            plen);
-                                       kunmap(p);
+                                       kunmap_local(kaddr);
                                }
                        } else {
                                u64 va = sge->laddr + sge_off;
@@ -540,7 +550,7 @@ static int siw_tx_hdt(struct siw_iwarp_tx *c_tx, struct socket *s)
 
                        if (++seg > (int)MAX_ARRAY) {
                                siw_dbg_qp(tx_qp(c_tx), "to many fragments\n");
-                               siw_unmap_pages(page_array, kmap_mask);
+                               siw_unmap_pages(iov, kmap_mask, seg-1);
                                wqe->processed -= c_tx->bytes_unsent;
                                rv = -EMSGSIZE;
                                goto done_crc;
@@ -591,7 +601,7 @@ sge_done:
        } else {
                rv = kernel_sendmsg(s, &msg, iov, seg + 1,
                                    hdr_len + data_len + trl_len);
-               siw_unmap_pages(page_array, kmap_mask);
+               siw_unmap_pages(iov, kmap_mask, seg);
        }
        if (rv < (int)hdr_len) {
                /* Not even complete hdr pushed or negative rv */
index 3f175f220a2299bc74e025b6fbcf73729357f5a3..1b36350601faaabc374207a4dce673894e1aad86 100644 (file)
@@ -285,16 +285,16 @@ siw_mmap_entry_insert(struct siw_ucontext *uctx,
  *
  * Create QP of requested size on given device.
  *
- * @pd:                Protection Domain
+ * @qp:                Queue pait
  * @attrs:     Initial QP attributes.
  * @udata:     used to provide QP ID, SQ and RQ size back to user.
  */
 
-struct ib_qp *siw_create_qp(struct ib_pd *pd,
-                           struct ib_qp_init_attr *attrs,
-                           struct ib_udata *udata)
+int siw_create_qp(struct ib_qp *ibqp, struct ib_qp_init_attr *attrs,
+                 struct ib_udata *udata)
 {
-       struct siw_qp *qp = NULL;
+       struct ib_pd *pd = ibqp->pd;
+       struct siw_qp *qp = to_siw_qp(ibqp);
        struct ib_device *base_dev = pd->device;
        struct siw_device *sdev = to_siw_dev(base_dev);
        struct siw_ucontext *uctx =
@@ -307,17 +307,16 @@ struct ib_qp *siw_create_qp(struct ib_pd *pd,
        siw_dbg(base_dev, "create new QP\n");
 
        if (attrs->create_flags)
-               return ERR_PTR(-EOPNOTSUPP);
+               return -EOPNOTSUPP;
 
        if (atomic_inc_return(&sdev->num_qp) > SIW_MAX_QP) {
                siw_dbg(base_dev, "too many QP's\n");
-               rv = -ENOMEM;
-               goto err_out;
+               return -ENOMEM;
        }
        if (attrs->qp_type != IB_QPT_RC) {
                siw_dbg(base_dev, "only RC QP's supported\n");
                rv = -EOPNOTSUPP;
-               goto err_out;
+               goto err_atomic;
        }
        if ((attrs->cap.max_send_wr > SIW_MAX_QP_WR) ||
            (attrs->cap.max_recv_wr > SIW_MAX_QP_WR) ||
@@ -325,13 +324,13 @@ struct ib_qp *siw_create_qp(struct ib_pd *pd,
            (attrs->cap.max_recv_sge > SIW_MAX_SGE)) {
                siw_dbg(base_dev, "QP size error\n");
                rv = -EINVAL;
-               goto err_out;
+               goto err_atomic;
        }
        if (attrs->cap.max_inline_data > SIW_MAX_INLINE) {
                siw_dbg(base_dev, "max inline send: %d > %d\n",
                        attrs->cap.max_inline_data, (int)SIW_MAX_INLINE);
                rv = -EINVAL;
-               goto err_out;
+               goto err_atomic;
        }
        /*
         * NOTE: we allow for zero element SQ and RQ WQE's SGL's
@@ -340,19 +339,15 @@ struct ib_qp *siw_create_qp(struct ib_pd *pd,
        if (attrs->cap.max_send_wr + attrs->cap.max_recv_wr == 0) {
                siw_dbg(base_dev, "QP must have send or receive queue\n");
                rv = -EINVAL;
-               goto err_out;
+               goto err_atomic;
        }
 
        if (!attrs->send_cq || (!attrs->recv_cq && !attrs->srq)) {
                siw_dbg(base_dev, "send CQ or receive CQ invalid\n");
                rv = -EINVAL;
-               goto err_out;
-       }
-       qp = kzalloc(sizeof(*qp), GFP_KERNEL);
-       if (!qp) {
-               rv = -ENOMEM;
-               goto err_out;
+               goto err_atomic;
        }
+
        init_rwsem(&qp->state_lock);
        spin_lock_init(&qp->sq_lock);
        spin_lock_init(&qp->rq_lock);
@@ -360,7 +355,7 @@ struct ib_qp *siw_create_qp(struct ib_pd *pd,
 
        rv = siw_qp_add(sdev, qp);
        if (rv)
-               goto err_out;
+               goto err_atomic;
 
        num_sqe = attrs->cap.max_send_wr;
        num_rqe = attrs->cap.max_recv_wr;
@@ -482,23 +477,20 @@ struct ib_qp *siw_create_qp(struct ib_pd *pd,
        list_add_tail(&qp->devq, &sdev->qp_list);
        spin_unlock_irqrestore(&sdev->lock, flags);
 
-       return &qp->base_qp;
+       return 0;
 
 err_out_xa:
        xa_erase(&sdev->qp_xa, qp_id(qp));
-err_out:
-       if (qp) {
-               if (uctx) {
-                       rdma_user_mmap_entry_remove(qp->sq_entry);
-                       rdma_user_mmap_entry_remove(qp->rq_entry);
-               }
-               vfree(qp->sendq);
-               vfree(qp->recvq);
-               kfree(qp);
+       if (uctx) {
+               rdma_user_mmap_entry_remove(qp->sq_entry);
+               rdma_user_mmap_entry_remove(qp->rq_entry);
        }
-       atomic_dec(&sdev->num_qp);
+       vfree(qp->sendq);
+       vfree(qp->recvq);
 
-       return ERR_PTR(rv);
+err_atomic:
+       atomic_dec(&sdev->num_qp);
+       return rv;
 }
 
 /*
index 67ac08886a709fe3e75fc887ad8dcb471a241369..09964234f8d39636fea5931490ec415ffb38baca 100644 (file)
@@ -50,9 +50,8 @@ int siw_query_gid(struct ib_device *base_dev, u32 port, int idx,
                  union ib_gid *gid);
 int siw_alloc_pd(struct ib_pd *base_pd, struct ib_udata *udata);
 int siw_dealloc_pd(struct ib_pd *base_pd, struct ib_udata *udata);
-struct ib_qp *siw_create_qp(struct ib_pd *base_pd,
-                           struct ib_qp_init_attr *attr,
-                           struct ib_udata *udata);
+int siw_create_qp(struct ib_qp *qp, struct ib_qp_init_attr *attr,
+                 struct ib_udata *udata);
 int siw_query_qp(struct ib_qp *base_qp, struct ib_qp_attr *qp_attr,
                 int qp_attr_mask, struct ib_qp_init_attr *qp_init_attr);
 int siw_verbs_modify_qp(struct ib_qp *base_qp, struct ib_qp_attr *attr,
index 26bbe5d6dff576029dd4b8f266eac746bd94f4ce..5e780bdd763d3d7fb884feb39b48e52532dfc8cb 100644 (file)
@@ -20,7 +20,7 @@ void rtrs_clt_update_wc_stats(struct rtrs_clt_con *con)
 
        cpu = raw_smp_processor_id();
        s = this_cpu_ptr(stats->pcpu_stats);
-       if (unlikely(con->cpu != cpu)) {
+       if (con->cpu != cpu) {
                s->cpu_migr.to++;
 
                /* Careful here, override s pointer */
@@ -180,7 +180,7 @@ void rtrs_clt_update_all_stats(struct rtrs_clt_io_req *req, int dir)
 
        len = req->usr_len + req->data_len;
        rtrs_clt_update_rdma_stats(stats, len, dir);
-       if (sess->clt->mp_policy == MP_POLICY_MIN_INFLIGHT)
+       if (req->mp_policy == MP_POLICY_MIN_INFLIGHT)
                atomic_inc(&stats->inflight);
 }
 
index f2c40e50f25ea4956a0914b7c0232c2d5e45c3ce..bc8824b4ee0d445d7feef7d30d6cc621c3435ada 100644 (file)
@@ -75,9 +75,9 @@ __rtrs_get_permit(struct rtrs_clt *clt, enum rtrs_clt_con_type con_type)
         */
        do {
                bit = find_first_zero_bit(clt->permits_map, max_depth);
-               if (unlikely(bit >= max_depth))
+               if (bit >= max_depth)
                        return NULL;
-       } while (unlikely(test_and_set_bit_lock(bit, clt->permits_map)));
+       } while (test_and_set_bit_lock(bit, clt->permits_map));
 
        permit = get_permit(clt, bit);
        WARN_ON(permit->mem_id != bit);
@@ -115,14 +115,14 @@ struct rtrs_permit *rtrs_clt_get_permit(struct rtrs_clt *clt,
        DEFINE_WAIT(wait);
 
        permit = __rtrs_get_permit(clt, con_type);
-       if (likely(permit) || !can_wait)
+       if (permit || !can_wait)
                return permit;
 
        do {
                prepare_to_wait(&clt->permits_wait, &wait,
                                TASK_UNINTERRUPTIBLE);
                permit = __rtrs_get_permit(clt, con_type);
-               if (likely(permit))
+               if (permit)
                        break;
 
                io_schedule();
@@ -175,7 +175,7 @@ struct rtrs_clt_con *rtrs_permit_to_clt_con(struct rtrs_clt_sess *sess,
 {
        int id = 0;
 
-       if (likely(permit->con_type == RTRS_IO_CON))
+       if (permit->con_type == RTRS_IO_CON)
                id = (permit->cpu_id % (sess->s.irq_con_num - 1)) + 1;
 
        return to_clt_con(sess->s.con[id]);
@@ -329,7 +329,7 @@ static void rtrs_clt_fast_reg_done(struct ib_cq *cq, struct ib_wc *wc)
 {
        struct rtrs_clt_con *con = to_clt_con(wc->qp->qp_context);
 
-       if (unlikely(wc->status != IB_WC_SUCCESS)) {
+       if (wc->status != IB_WC_SUCCESS) {
                rtrs_err(con->c.sess, "Failed IB_WR_REG_MR: %s\n",
                          ib_wc_status_msg(wc->status));
                rtrs_rdma_error_recovery(con);
@@ -349,13 +349,13 @@ static void rtrs_clt_inv_rkey_done(struct ib_cq *cq, struct ib_wc *wc)
                container_of(wc->wr_cqe, typeof(*req), inv_cqe);
        struct rtrs_clt_con *con = to_clt_con(wc->qp->qp_context);
 
-       if (unlikely(wc->status != IB_WC_SUCCESS)) {
+       if (wc->status != IB_WC_SUCCESS) {
                rtrs_err(con->c.sess, "Failed IB_WR_LOCAL_INV: %s\n",
                          ib_wc_status_msg(wc->status));
                rtrs_rdma_error_recovery(con);
        }
        req->need_inv = false;
-       if (likely(req->need_inv_comp))
+       if (req->need_inv_comp)
                complete(&req->inv_comp);
        else
                /* Complete request from INV callback */
@@ -390,7 +390,7 @@ static void complete_rdma_req(struct rtrs_clt_io_req *req, int errno,
        sess = to_clt_sess(con->c.sess);
 
        if (req->sg_cnt) {
-               if (unlikely(req->dir == DMA_FROM_DEVICE && req->need_inv)) {
+               if (req->dir == DMA_FROM_DEVICE && req->need_inv) {
                        /*
                         * We are here to invalidate read requests
                         * ourselves.  In normal scenario server should
@@ -405,7 +405,7 @@ static void complete_rdma_req(struct rtrs_clt_io_req *req, int errno,
                         *        should do that ourselves.
                         */
 
-                       if (likely(can_wait)) {
+                       if (can_wait) {
                                req->need_inv_comp = true;
                        } else {
                                /* This should be IO path, so always notify */
@@ -416,10 +416,10 @@ static void complete_rdma_req(struct rtrs_clt_io_req *req, int errno,
 
                        refcount_inc(&req->ref);
                        err = rtrs_inv_rkey(req);
-                       if (unlikely(err)) {
+                       if (err) {
                                rtrs_err(con->c.sess, "Send INV WR key=%#x: %d\n",
                                          req->mr->rkey, err);
-                       } else if (likely(can_wait)) {
+                       } else if (can_wait) {
                                wait_for_completion(&req->inv_comp);
                        } else {
                                /*
@@ -438,7 +438,7 @@ static void complete_rdma_req(struct rtrs_clt_io_req *req, int errno,
        }
        if (!refcount_dec_and_test(&req->ref))
                return;
-       if (sess->clt->mp_policy == MP_POLICY_MIN_INFLIGHT)
+       if (req->mp_policy == MP_POLICY_MIN_INFLIGHT)
                atomic_dec(&sess->stats->inflight);
 
        req->in_use = false;
@@ -463,7 +463,7 @@ static int rtrs_post_send_rdma(struct rtrs_clt_con *con,
        enum ib_send_flags flags;
        struct ib_sge sge;
 
-       if (unlikely(!req->sg_size)) {
+       if (!req->sg_size) {
                rtrs_wrn(con->c.sess,
                         "Doing RDMA Write failed, no data supplied\n");
                return -EINVAL;
@@ -478,7 +478,7 @@ static int rtrs_post_send_rdma(struct rtrs_clt_con *con,
         * From time to time we have to post signalled sends,
         * or send queue will fill up and only QP reset can help.
         */
-       flags = atomic_inc_return(&con->io_cnt) % sess->queue_depth ?
+       flags = atomic_inc_return(&con->c.wr_cnt) % sess->s.signal_interval ?
                        0 : IB_SEND_SIGNALED;
 
        ib_dma_sync_single_for_device(sess->s.dev->ib_dev, req->iu->dma_addr,
@@ -513,7 +513,7 @@ static void rtrs_clt_recv_done(struct rtrs_clt_con *con, struct ib_wc *wc)
        iu = container_of(wc->wr_cqe, struct rtrs_iu,
                          cqe);
        err = rtrs_iu_post_recv(&con->c, iu);
-       if (unlikely(err)) {
+       if (err) {
                rtrs_err(con->c.sess, "post iu failed %d\n", err);
                rtrs_rdma_error_recovery(con);
        }
@@ -533,7 +533,7 @@ static void rtrs_clt_rkey_rsp_done(struct rtrs_clt_con *con, struct ib_wc *wc)
 
        iu = container_of(wc->wr_cqe, struct rtrs_iu, cqe);
 
-       if (unlikely(wc->byte_len < sizeof(*msg))) {
+       if (wc->byte_len < sizeof(*msg)) {
                rtrs_err(con->c.sess, "rkey response is malformed: size %d\n",
                          wc->byte_len);
                goto out;
@@ -541,7 +541,7 @@ static void rtrs_clt_rkey_rsp_done(struct rtrs_clt_con *con, struct ib_wc *wc)
        ib_dma_sync_single_for_cpu(sess->s.dev->ib_dev, iu->dma_addr,
                                   iu->size, DMA_FROM_DEVICE);
        msg = iu->buf;
-       if (unlikely(le16_to_cpu(msg->type) != RTRS_MSG_RKEY_RSP)) {
+       if (le16_to_cpu(msg->type) != RTRS_MSG_RKEY_RSP) {
                rtrs_err(sess->clt, "rkey response is malformed: type %d\n",
                          le16_to_cpu(msg->type));
                goto out;
@@ -551,8 +551,8 @@ static void rtrs_clt_rkey_rsp_done(struct rtrs_clt_con *con, struct ib_wc *wc)
                goto out;
 
        rtrs_from_imm(be32_to_cpu(wc->ex.imm_data), &imm_type, &imm_payload);
-       if (likely(imm_type == RTRS_IO_RSP_IMM ||
-                  imm_type == RTRS_IO_RSP_W_INV_IMM)) {
+       if (imm_type == RTRS_IO_RSP_IMM ||
+           imm_type == RTRS_IO_RSP_W_INV_IMM) {
                u32 msg_id;
 
                w_inval = (imm_type == RTRS_IO_RSP_W_INV_IMM);
@@ -605,7 +605,7 @@ static void rtrs_clt_rdma_done(struct ib_cq *cq, struct ib_wc *wc)
        bool w_inval = false;
        int err;
 
-       if (unlikely(wc->status != IB_WC_SUCCESS)) {
+       if (wc->status != IB_WC_SUCCESS) {
                if (wc->status != IB_WC_WR_FLUSH_ERR) {
                        rtrs_err(sess->clt, "RDMA failed: %s\n",
                                  ib_wc_status_msg(wc->status));
@@ -625,8 +625,8 @@ static void rtrs_clt_rdma_done(struct ib_cq *cq, struct ib_wc *wc)
                        return;
                rtrs_from_imm(be32_to_cpu(wc->ex.imm_data),
                               &imm_type, &imm_payload);
-               if (likely(imm_type == RTRS_IO_RSP_IMM ||
-                          imm_type == RTRS_IO_RSP_W_INV_IMM)) {
+               if (imm_type == RTRS_IO_RSP_IMM ||
+                   imm_type == RTRS_IO_RSP_W_INV_IMM) {
                        u32 msg_id;
 
                        w_inval = (imm_type == RTRS_IO_RSP_W_INV_IMM);
@@ -657,7 +657,7 @@ static void rtrs_clt_rdma_done(struct ib_cq *cq, struct ib_wc *wc)
                        err = rtrs_post_recv_empty_x2(&con->c, &io_comp_cqe);
                else
                        err = rtrs_post_recv_empty(&con->c, &io_comp_cqe);
-               if (unlikely(err)) {
+               if (err) {
                        rtrs_err(con->c.sess, "rtrs_post_recv_empty(): %d\n",
                                  err);
                        rtrs_rdma_error_recovery(con);
@@ -680,6 +680,7 @@ static void rtrs_clt_rdma_done(struct ib_cq *cq, struct ib_wc *wc)
        case IB_WC_RDMA_WRITE:
                /*
                 * post_send() RDMA write completions of IO reqs (read/write)
+                * and hb.
                 */
                break;
 
@@ -702,7 +703,7 @@ static int post_recv_io(struct rtrs_clt_con *con, size_t q_size)
                } else {
                        err = rtrs_post_recv_empty(&con->c, &io_comp_cqe);
                }
-               if (unlikely(err))
+               if (err)
                        return err;
        }
 
@@ -727,7 +728,7 @@ static int post_recv_sess(struct rtrs_clt_sess *sess)
                q_size *= 2;
 
                err = post_recv_io(to_clt_con(sess->s.con[cid]), q_size);
-               if (unlikely(err)) {
+               if (err) {
                        rtrs_err(sess->clt, "post_recv_io(), err: %d\n", err);
                        return err;
                }
@@ -788,7 +789,7 @@ static struct rtrs_clt_sess *get_next_path_rr(struct path_it *it)
 
        ppcpu_path = this_cpu_ptr(clt->pcpu_path);
        path = rcu_dereference(*ppcpu_path);
-       if (unlikely(!path))
+       if (!path)
                path = list_first_or_null_rcu(&clt->paths_list,
                                              typeof(*path), s.entry);
        else
@@ -819,10 +820,10 @@ static struct rtrs_clt_sess *get_next_path_min_inflight(struct path_it *it)
        int inflight;
 
        list_for_each_entry_rcu(sess, &clt->paths_list, s.entry) {
-               if (unlikely(READ_ONCE(sess->state) != RTRS_CLT_CONNECTED))
+               if (READ_ONCE(sess->state) != RTRS_CLT_CONNECTED)
                        continue;
 
-               if (unlikely(!list_empty(raw_cpu_ptr(sess->mp_skip_entry))))
+               if (!list_empty(raw_cpu_ptr(sess->mp_skip_entry)))
                        continue;
 
                inflight = atomic_read(&sess->stats->inflight);
@@ -870,10 +871,10 @@ static struct rtrs_clt_sess *get_next_path_min_latency(struct path_it *it)
        ktime_t latency;
 
        list_for_each_entry_rcu(sess, &clt->paths_list, s.entry) {
-               if (unlikely(READ_ONCE(sess->state) != RTRS_CLT_CONNECTED))
+               if (READ_ONCE(sess->state) != RTRS_CLT_CONNECTED)
                        continue;
 
-               if (unlikely(!list_empty(raw_cpu_ptr(sess->mp_skip_entry))))
+               if (!list_empty(raw_cpu_ptr(sess->mp_skip_entry)))
                        continue;
 
                latency = sess->s.hb_cur_latency;
@@ -963,6 +964,7 @@ static void rtrs_clt_init_req(struct rtrs_clt_io_req *req,
        req->need_inv_comp = false;
        req->inv_errno = 0;
        refcount_set(&req->ref, 1);
+       req->mp_policy = sess->clt->mp_policy;
 
        iov_iter_kvec(&iter, READ, vec, 1, usr_len);
        len = _copy_from_iter(req->iu->buf, usr_len, &iter);
@@ -1043,7 +1045,7 @@ static int rtrs_post_rdma_write_sg(struct rtrs_clt_con *con,
         * From time to time we have to post signalled sends,
         * or send queue will fill up and only QP reset can help.
         */
-       flags = atomic_inc_return(&con->io_cnt) % sess->queue_depth ?
+       flags = atomic_inc_return(&con->c.wr_cnt) % sess->s.signal_interval ?
                        0 : IB_SEND_SIGNALED;
 
        ib_dma_sync_single_for_device(sess->s.dev->ib_dev, req->iu->dma_addr,
@@ -1062,7 +1064,7 @@ static int rtrs_map_sg_fr(struct rtrs_clt_io_req *req, size_t count)
        nr = ib_map_mr_sg(req->mr, req->sglist, count, NULL, SZ_4K);
        if (nr < 0)
                return nr;
-       if (unlikely(nr < req->sg_cnt))
+       if (nr < req->sg_cnt)
                return -EINVAL;
        ib_update_fast_reg_key(req->mr, ib_inc_rkey(req->mr->rkey));
 
@@ -1086,7 +1088,7 @@ static int rtrs_clt_write_req(struct rtrs_clt_io_req *req)
 
        const size_t tsize = sizeof(*msg) + req->data_len + req->usr_len;
 
-       if (unlikely(tsize > sess->chunk_size)) {
+       if (tsize > sess->chunk_size) {
                rtrs_wrn(s, "Write request failed, size too big %zu > %d\n",
                          tsize, sess->chunk_size);
                return -EMSGSIZE;
@@ -1094,7 +1096,7 @@ static int rtrs_clt_write_req(struct rtrs_clt_io_req *req)
        if (req->sg_cnt) {
                count = ib_dma_map_sg(sess->s.dev->ib_dev, req->sglist,
                                      req->sg_cnt, req->dir);
-               if (unlikely(!count)) {
+               if (!count) {
                        rtrs_wrn(s, "Write request failed, map failed\n");
                        return -EINVAL;
                }
@@ -1148,12 +1150,12 @@ static int rtrs_clt_write_req(struct rtrs_clt_io_req *req)
        ret = rtrs_post_rdma_write_sg(req->con, req, rbuf, fr_en,
                                      req->usr_len + sizeof(*msg),
                                      imm, wr, &inv_wr);
-       if (unlikely(ret)) {
+       if (ret) {
                rtrs_err_rl(s,
                            "Write request failed: error=%d path=%s [%s:%u]\n",
                            ret, kobject_name(&sess->kobj), sess->hca_name,
                            sess->hca_port);
-               if (sess->clt->mp_policy == MP_POLICY_MIN_INFLIGHT)
+               if (req->mp_policy == MP_POLICY_MIN_INFLIGHT)
                        atomic_dec(&sess->stats->inflight);
                if (req->sg_cnt)
                        ib_dma_unmap_sg(sess->s.dev->ib_dev, req->sglist,
@@ -1179,7 +1181,7 @@ static int rtrs_clt_read_req(struct rtrs_clt_io_req *req)
 
        const size_t tsize = sizeof(*msg) + req->data_len + req->usr_len;
 
-       if (unlikely(tsize > sess->chunk_size)) {
+       if (tsize > sess->chunk_size) {
                rtrs_wrn(s,
                          "Read request failed, message size is %zu, bigger than CHUNK_SIZE %d\n",
                          tsize, sess->chunk_size);
@@ -1189,7 +1191,7 @@ static int rtrs_clt_read_req(struct rtrs_clt_io_req *req)
        if (req->sg_cnt) {
                count = ib_dma_map_sg(dev->ib_dev, req->sglist, req->sg_cnt,
                                      req->dir);
-               if (unlikely(!count)) {
+               if (!count) {
                        rtrs_wrn(s,
                                  "Read request failed, dma map failed\n");
                        return -EINVAL;
@@ -1254,12 +1256,12 @@ static int rtrs_clt_read_req(struct rtrs_clt_io_req *req)
 
        ret = rtrs_post_send_rdma(req->con, req, &sess->rbufs[buf_id],
                                   req->data_len, imm, wr);
-       if (unlikely(ret)) {
+       if (ret) {
                rtrs_err_rl(s,
                            "Read request failed: error=%d path=%s [%s:%u]\n",
                            ret, kobject_name(&sess->kobj), sess->hca_name,
                            sess->hca_port);
-               if (sess->clt->mp_policy == MP_POLICY_MIN_INFLIGHT)
+               if (req->mp_policy == MP_POLICY_MIN_INFLIGHT)
                        atomic_dec(&sess->stats->inflight);
                req->need_inv = false;
                if (req->sg_cnt)
@@ -1287,15 +1289,14 @@ static int rtrs_clt_failover_req(struct rtrs_clt *clt,
        for (path_it_init(&it, clt);
             (alive_sess = it.next_path(&it)) && it.i < it.clt->paths_num;
             it.i++) {
-               if (unlikely(READ_ONCE(alive_sess->state) !=
-                            RTRS_CLT_CONNECTED))
+               if (READ_ONCE(alive_sess->state) != RTRS_CLT_CONNECTED)
                        continue;
                req = rtrs_clt_get_copy_req(alive_sess, fail_req);
                if (req->dir == DMA_TO_DEVICE)
                        err = rtrs_clt_write_req(req);
                else
                        err = rtrs_clt_read_req(req);
-               if (unlikely(err)) {
+               if (err) {
                        req->in_use = false;
                        continue;
                }
@@ -1330,7 +1331,7 @@ static void fail_all_outstanding_reqs(struct rtrs_clt_sess *sess)
                complete_rdma_req(req, -ECONNABORTED, false, true);
 
                err = rtrs_clt_failover_req(clt, req);
-               if (unlikely(err))
+               if (err)
                        /* Failover failed, notify anyway */
                        req->conf(req->priv, err);
        }
@@ -1601,7 +1602,8 @@ static int create_con(struct rtrs_clt_sess *sess, unsigned int cid)
        con->cpu  = (cid ? cid - 1 : 0) % nr_cpu_ids;
        con->c.cid = cid;
        con->c.sess = &sess->s;
-       atomic_set(&con->io_cnt, 0);
+       /* Align with srv, init as 1 */
+       atomic_set(&con->c.wr_cnt, 1);
        mutex_init(&con->con_mutex);
 
        sess->s.con[cid] = &con->c;
@@ -1678,6 +1680,7 @@ static int create_con_cq_qp(struct rtrs_clt_con *con)
                              sess->queue_depth * 3 + 1);
                max_send_sge = 2;
        }
+       atomic_set(&con->c.sq_wr_avail, max_send_wr);
        cq_num = max_send_wr + max_recv_wr;
        /* alloc iu to recv new rkey reply when server reports flags set */
        if (sess->flags & RTRS_MSG_NEW_RKEY_F || con->c.cid == 0) {
@@ -1841,13 +1844,14 @@ static int rtrs_rdma_conn_established(struct rtrs_clt_con *con,
                }
 
                if (!sess->rbufs) {
-                       kfree(sess->rbufs);
                        sess->rbufs = kcalloc(queue_depth, sizeof(*sess->rbufs),
                                              GFP_KERNEL);
                        if (!sess->rbufs)
                                return -ENOMEM;
                }
                sess->queue_depth = queue_depth;
+               sess->s.signal_interval = min_not_zero(queue_depth,
+                                               (unsigned short) SERVICE_CON_QUEUE_DEPTH);
                sess->max_hdr_size = le32_to_cpu(msg->max_hdr_size);
                sess->max_io_size = le32_to_cpu(msg->max_io_size);
                sess->flags = le32_to_cpu(msg->flags);
@@ -1958,7 +1962,7 @@ static int rtrs_clt_rdma_cm_handler(struct rdma_cm_id *cm_id,
                break;
        case RDMA_CM_EVENT_ESTABLISHED:
                cm_err = rtrs_rdma_conn_established(con, ev);
-               if (likely(!cm_err)) {
+               if (!cm_err) {
                        /*
                         * Report success and wake up. Here we abuse state_wq,
                         * i.e. wake up without state change, but we set cm_err.
@@ -2377,7 +2381,7 @@ static void rtrs_clt_info_req_done(struct ib_cq *cq, struct ib_wc *wc)
        iu = container_of(wc->wr_cqe, struct rtrs_iu, cqe);
        rtrs_iu_free(iu, sess->s.dev->ib_dev, 1);
 
-       if (unlikely(wc->status != IB_WC_SUCCESS)) {
+       if (wc->status != IB_WC_SUCCESS) {
                rtrs_err(sess->clt, "Sess info request send failed: %s\n",
                          ib_wc_status_msg(wc->status));
                rtrs_clt_change_state_get_old(sess, RTRS_CLT_CONNECTING_ERR, NULL);
@@ -2394,7 +2398,7 @@ static int process_info_rsp(struct rtrs_clt_sess *sess,
        int i, sgi;
 
        sg_cnt = le16_to_cpu(msg->sg_cnt);
-       if (unlikely(!sg_cnt || (sess->queue_depth % sg_cnt))) {
+       if (!sg_cnt || (sess->queue_depth % sg_cnt)) {
                rtrs_err(sess->clt, "Incorrect sg_cnt %d, is not multiple\n",
                          sg_cnt);
                return -EINVAL;
@@ -2404,9 +2408,8 @@ static int process_info_rsp(struct rtrs_clt_sess *sess,
         * Check if IB immediate data size is enough to hold the mem_id and
         * the offset inside the memory chunk.
         */
-       if (unlikely((ilog2(sg_cnt - 1) + 1) +
-                    (ilog2(sess->chunk_size - 1) + 1) >
-                    MAX_IMM_PAYL_BITS)) {
+       if ((ilog2(sg_cnt - 1) + 1) + (ilog2(sess->chunk_size - 1) + 1) >
+           MAX_IMM_PAYL_BITS) {
                rtrs_err(sess->clt,
                          "RDMA immediate size (%db) not enough to encode %d buffers of size %dB\n",
                          MAX_IMM_PAYL_BITS, sg_cnt, sess->chunk_size);
@@ -2424,7 +2427,7 @@ static int process_info_rsp(struct rtrs_clt_sess *sess,
 
                total_len += len;
 
-               if (unlikely(!len || (len % sess->chunk_size))) {
+               if (!len || (len % sess->chunk_size)) {
                        rtrs_err(sess->clt, "Incorrect [%d].len %d\n", sgi,
                                  len);
                        return -EINVAL;
@@ -2438,11 +2441,11 @@ static int process_info_rsp(struct rtrs_clt_sess *sess,
                }
        }
        /* Sanity check */
-       if (unlikely(sgi != sg_cnt || i != sess->queue_depth)) {
+       if (sgi != sg_cnt || i != sess->queue_depth) {
                rtrs_err(sess->clt, "Incorrect sg vector, not fully mapped\n");
                return -EINVAL;
        }
-       if (unlikely(total_len != sess->chunk_size * sess->queue_depth)) {
+       if (total_len != sess->chunk_size * sess->queue_depth) {
                rtrs_err(sess->clt, "Incorrect total_len %d\n", total_len);
                return -EINVAL;
        }
@@ -2464,14 +2467,14 @@ static void rtrs_clt_info_rsp_done(struct ib_cq *cq, struct ib_wc *wc)
 
        WARN_ON(con->c.cid);
        iu = container_of(wc->wr_cqe, struct rtrs_iu, cqe);
-       if (unlikely(wc->status != IB_WC_SUCCESS)) {
+       if (wc->status != IB_WC_SUCCESS) {
                rtrs_err(sess->clt, "Sess info response recv failed: %s\n",
                          ib_wc_status_msg(wc->status));
                goto out;
        }
        WARN_ON(wc->opcode != IB_WC_RECV);
 
-       if (unlikely(wc->byte_len < sizeof(*msg))) {
+       if (wc->byte_len < sizeof(*msg)) {
                rtrs_err(sess->clt, "Sess info response is malformed: size %d\n",
                          wc->byte_len);
                goto out;
@@ -2479,24 +2482,24 @@ static void rtrs_clt_info_rsp_done(struct ib_cq *cq, struct ib_wc *wc)
        ib_dma_sync_single_for_cpu(sess->s.dev->ib_dev, iu->dma_addr,
                                   iu->size, DMA_FROM_DEVICE);
        msg = iu->buf;
-       if (unlikely(le16_to_cpu(msg->type) != RTRS_MSG_INFO_RSP)) {
+       if (le16_to_cpu(msg->type) != RTRS_MSG_INFO_RSP) {
                rtrs_err(sess->clt, "Sess info response is malformed: type %d\n",
                          le16_to_cpu(msg->type));
                goto out;
        }
        rx_sz  = sizeof(*msg);
        rx_sz += sizeof(msg->desc[0]) * le16_to_cpu(msg->sg_cnt);
-       if (unlikely(wc->byte_len < rx_sz)) {
+       if (wc->byte_len < rx_sz) {
                rtrs_err(sess->clt, "Sess info response is malformed: size %d\n",
                          wc->byte_len);
                goto out;
        }
        err = process_info_rsp(sess, msg);
-       if (unlikely(err))
+       if (err)
                goto out;
 
        err = post_recv_sess(sess);
-       if (unlikely(err))
+       if (err)
                goto out;
 
        state = RTRS_CLT_CONNECTED;
@@ -2523,13 +2526,13 @@ static int rtrs_send_sess_info(struct rtrs_clt_sess *sess)
                               rtrs_clt_info_req_done);
        rx_iu = rtrs_iu_alloc(1, rx_sz, GFP_KERNEL, sess->s.dev->ib_dev,
                               DMA_FROM_DEVICE, rtrs_clt_info_rsp_done);
-       if (unlikely(!tx_iu || !rx_iu)) {
+       if (!tx_iu || !rx_iu) {
                err = -ENOMEM;
                goto out;
        }
        /* Prepare for getting info response */
        err = rtrs_iu_post_recv(&usr_con->c, rx_iu);
-       if (unlikely(err)) {
+       if (err) {
                rtrs_err(sess->clt, "rtrs_iu_post_recv(), err: %d\n", err);
                goto out;
        }
@@ -2544,7 +2547,7 @@ static int rtrs_send_sess_info(struct rtrs_clt_sess *sess)
 
        /* Send info request */
        err = rtrs_iu_post_send(&usr_con->c, tx_iu, sizeof(*msg), NULL);
-       if (unlikely(err)) {
+       if (err) {
                rtrs_err(sess->clt, "rtrs_iu_post_send(), err: %d\n", err);
                goto out;
        }
@@ -2555,7 +2558,7 @@ static int rtrs_send_sess_info(struct rtrs_clt_sess *sess)
                                         sess->state != RTRS_CLT_CONNECTING,
                                         msecs_to_jiffies(
                                                 RTRS_CONNECT_TIMEOUT_MS));
-       if (unlikely(READ_ONCE(sess->state) != RTRS_CLT_CONNECTED)) {
+       if (READ_ONCE(sess->state) != RTRS_CLT_CONNECTED) {
                if (READ_ONCE(sess->state) == RTRS_CLT_CONNECTING_ERR)
                        err = -ECONNRESET;
                else
@@ -2567,7 +2570,7 @@ out:
                rtrs_iu_free(tx_iu, sess->s.dev->ib_dev, 1);
        if (rx_iu)
                rtrs_iu_free(rx_iu, sess->s.dev->ib_dev, 1);
-       if (unlikely(err))
+       if (err)
                /* If we've never taken async path because of malloc problems */
                rtrs_clt_change_state_get_old(sess, RTRS_CLT_CONNECTING_ERR, NULL);
 
@@ -2915,7 +2918,7 @@ int rtrs_clt_remove_path_from_sysfs(struct rtrs_clt_sess *sess,
                                                        &old_state);
        } while (!changed && old_state != RTRS_CLT_DEAD);
 
-       if (likely(changed)) {
+       if (changed) {
                rtrs_clt_remove_path_from_arr(sess);
                rtrs_clt_destroy_sess_files(sess, sysfs_self);
                kobject_put(&sess->kobj);
@@ -2987,10 +2990,10 @@ int rtrs_clt_request(int dir, struct rtrs_clt_req_ops *ops,
        rcu_read_lock();
        for (path_it_init(&it, clt);
             (sess = it.next_path(&it)) && it.i < it.clt->paths_num; it.i++) {
-               if (unlikely(READ_ONCE(sess->state) != RTRS_CLT_CONNECTED))
+               if (READ_ONCE(sess->state) != RTRS_CLT_CONNECTED)
                        continue;
 
-               if (unlikely(usr_len + hdr_len > sess->max_hdr_size)) {
+               if (usr_len + hdr_len > sess->max_hdr_size) {
                        rtrs_wrn_rl(sess->clt,
                                     "%s request failed, user message size is %zu and header length %zu, but max size is %u\n",
                                     dir == READ ? "Read" : "Write",
@@ -3005,7 +3008,7 @@ int rtrs_clt_request(int dir, struct rtrs_clt_req_ops *ops,
                        err = rtrs_clt_read_req(req);
                else
                        err = rtrs_clt_write_req(req);
-               if (unlikely(err)) {
+               if (err) {
                        req->in_use = false;
                        continue;
                }
@@ -3078,6 +3081,18 @@ int rtrs_clt_create_path_from_sysfs(struct rtrs_clt *clt,
        if (IS_ERR(sess))
                return PTR_ERR(sess);
 
+       mutex_lock(&clt->paths_mutex);
+       if (clt->paths_num == 0) {
+               /*
+                * When all the paths are removed for a session,
+                * the addition of the first path is like a new session for
+                * the storage server
+                */
+               sess->for_new_clt = 1;
+       }
+
+       mutex_unlock(&clt->paths_mutex);
+
        /*
         * It is totally safe to add path in CONNECTING state: coming
         * IO will never grab it.  Also it is very important to add
index e276a2dfcf7c7a12686babe95f90e5b34abacf78..9dc819885ec71b49d984f44c954a3d8e0a626520 100644 (file)
@@ -74,7 +74,6 @@ struct rtrs_clt_con {
        u32                     queue_num;
        unsigned int            cpu;
        struct mutex            con_mutex;
-       atomic_t                io_cnt;
        int                     cm_err;
 };
 
@@ -102,6 +101,7 @@ struct rtrs_clt_io_req {
        unsigned int            usr_len;
        void                    *priv;
        bool                    in_use;
+       enum rtrs_mp_policy     mp_policy;
        struct rtrs_clt_con     *con;
        struct rtrs_sg_desc     *desc;
        struct ib_sge           *sge;
@@ -230,10 +230,7 @@ int rtrs_clt_stats_migration_cnt_to_str(struct rtrs_clt_stats *stats, char *buf,
                                         size_t len);
 int rtrs_clt_reset_reconnects_stat(struct rtrs_clt_stats *stats, bool enable);
 int rtrs_clt_stats_reconnects_to_str(struct rtrs_clt_stats *stats, char *buf,
-                                     size_t len);
-int rtrs_clt_reset_wc_comp_stats(struct rtrs_clt_stats *stats, bool enable);
-int rtrs_clt_stats_wc_completion_to_str(struct rtrs_clt_stats *stats, char *buf,
-                                        size_t len);
+                                    size_t len);
 int rtrs_clt_reset_rdma_stats(struct rtrs_clt_stats *stats, bool enable);
 ssize_t rtrs_clt_stats_rdma_to_str(struct rtrs_clt_stats *stats,
                                    char *page, size_t len);
index 36f184a3b67612d2e8fa829e2de22ad0826a139d..d12ddfa5074792125141228502ddef7c0430a16c 100644 (file)
@@ -96,6 +96,8 @@ struct rtrs_con {
        struct rdma_cm_id       *cm_id;
        unsigned int            cid;
        int                     nr_cqe;
+       atomic_t                wr_cnt;
+       atomic_t                sq_wr_avail;
 };
 
 struct rtrs_sess {
@@ -108,6 +110,7 @@ struct rtrs_sess {
        unsigned int            con_num;
        unsigned int            irq_con_num;
        unsigned int            recon_cnt;
+       unsigned int            signal_interval;
        struct rtrs_ib_dev      *dev;
        int                     dev_ref;
        struct ib_cqe           *hb_cqe;
@@ -309,9 +312,6 @@ int rtrs_iu_post_rdma_write_imm(struct rtrs_con *con, struct rtrs_iu *iu,
                                struct ib_send_wr *tail);
 
 int rtrs_post_recv_empty(struct rtrs_con *con, struct ib_cqe *cqe);
-int rtrs_post_rdma_write_imm_empty(struct rtrs_con *con, struct ib_cqe *cqe,
-                                  u32 imm_data, enum ib_send_flags flags,
-                                  struct ib_send_wr *head);
 
 int rtrs_cq_qp_create(struct rtrs_sess *sess, struct rtrs_con *con,
                      u32 max_send_sge, int cq_vector, int nr_cqe,
index 3df2900861697af1c2bccc24142a5d9b92a83e5a..716ef7b235587a39b0ba04329cb084df80d531e0 100644 (file)
@@ -183,7 +183,7 @@ static void rtrs_srv_reg_mr_done(struct ib_cq *cq, struct ib_wc *wc)
        struct rtrs_sess *s = con->c.sess;
        struct rtrs_srv_sess *sess = to_srv_sess(s);
 
-       if (unlikely(wc->status != IB_WC_SUCCESS)) {
+       if (wc->status != IB_WC_SUCCESS) {
                rtrs_err(s, "REG MR failed: %s\n",
                          ib_wc_status_msg(wc->status));
                close_sess(sess);
@@ -201,7 +201,6 @@ static int rdma_write_sg(struct rtrs_srv_op *id)
        struct rtrs_srv_sess *sess = to_srv_sess(s);
        dma_addr_t dma_addr = sess->dma_addr[id->msg_id];
        struct rtrs_srv_mr *srv_mr;
-       struct rtrs_srv *srv = sess->srv;
        struct ib_send_wr inv_wr;
        struct ib_rdma_wr imm_wr;
        struct ib_rdma_wr *wr = NULL;
@@ -216,7 +215,7 @@ static int rdma_write_sg(struct rtrs_srv_op *id)
 
        sg_cnt = le16_to_cpu(id->rd_msg->sg_cnt);
        need_inval = le16_to_cpu(id->rd_msg->flags) & RTRS_MSG_NEED_INVAL_F;
-       if (unlikely(sg_cnt != 1))
+       if (sg_cnt != 1)
                return -EINVAL;
 
        offset = 0;
@@ -229,7 +228,7 @@ static int rdma_write_sg(struct rtrs_srv_op *id)
        /* WR will fail with length error
         * if this is 0
         */
-       if (unlikely(plist->length == 0)) {
+       if (plist->length == 0) {
                rtrs_err(s, "Invalid RDMA-Write sg list length 0\n");
                return -EINVAL;
        }
@@ -269,7 +268,7 @@ static int rdma_write_sg(struct rtrs_srv_op *id)
         * From time to time we have to post signaled sends,
         * or send queue will fill up and only QP reset can help.
         */
-       flags = (atomic_inc_return(&id->con->wr_cnt) % srv->queue_depth) ?
+       flags = (atomic_inc_return(&id->con->c.wr_cnt) % s->signal_interval) ?
                0 : IB_SEND_SIGNALED;
 
        if (need_inval) {
@@ -322,7 +321,7 @@ static int rdma_write_sg(struct rtrs_srv_op *id)
                                      offset, DMA_BIDIRECTIONAL);
 
        err = ib_post_send(id->con->c.qp, &id->tx_wr.wr, NULL);
-       if (unlikely(err))
+       if (err)
                rtrs_err(s,
                          "Posting RDMA-Write-Request to QP failed, err: %d\n",
                          err);
@@ -347,7 +346,6 @@ static int send_io_resp_imm(struct rtrs_srv_con *con, struct rtrs_srv_op *id,
        struct ib_send_wr inv_wr, *wr = NULL;
        struct ib_rdma_wr imm_wr;
        struct ib_reg_wr rwr;
-       struct rtrs_srv *srv = sess->srv;
        struct rtrs_srv_mr *srv_mr;
        bool need_inval = false;
        enum ib_send_flags flags;
@@ -363,7 +361,7 @@ static int send_io_resp_imm(struct rtrs_srv_con *con, struct rtrs_srv_op *id,
                sg_cnt = le16_to_cpu(rd_msg->sg_cnt);
 
                if (need_inval) {
-                       if (likely(sg_cnt)) {
+                       if (sg_cnt) {
                                inv_wr.wr_cqe   = &io_comp_cqe;
                                inv_wr.sg_list = NULL;
                                inv_wr.num_sge = 0;
@@ -396,7 +394,7 @@ static int send_io_resp_imm(struct rtrs_srv_con *con, struct rtrs_srv_op *id,
         * From time to time we have to post signalled sends,
         * or send queue will fill up and only QP reset can help.
         */
-       flags = (atomic_inc_return(&con->wr_cnt) % srv->queue_depth) ?
+       flags = (atomic_inc_return(&con->c.wr_cnt) % s->signal_interval) ?
                0 : IB_SEND_SIGNALED;
        imm = rtrs_to_io_rsp_imm(id->msg_id, errno, need_inval);
        imm_wr.wr.next = NULL;
@@ -439,7 +437,7 @@ static int send_io_resp_imm(struct rtrs_srv_con *con, struct rtrs_srv_op *id,
        imm_wr.wr.ex.imm_data = cpu_to_be32(imm);
 
        err = ib_post_send(id->con->c.qp, wr, NULL);
-       if (unlikely(err))
+       if (err)
                rtrs_err_rl(s, "Posting RDMA-Reply to QP failed, err: %d\n",
                             err);
 
@@ -496,7 +494,7 @@ bool rtrs_srv_resp_rdma(struct rtrs_srv_op *id, int status)
 
        id->status = status;
 
-       if (unlikely(sess->state != RTRS_SRV_CONNECTED)) {
+       if (sess->state != RTRS_SRV_CONNECTED) {
                rtrs_err_rl(s,
                            "Sending I/O response failed,  session %s is disconnected, sess state %s\n",
                            kobject_name(&sess->kobj),
@@ -508,12 +506,11 @@ bool rtrs_srv_resp_rdma(struct rtrs_srv_op *id, int status)
 
                ib_update_fast_reg_key(mr->mr, ib_inc_rkey(mr->mr->rkey));
        }
-       if (unlikely(atomic_sub_return(1,
-                                      &con->sq_wr_avail) < 0)) {
+       if (atomic_sub_return(1, &con->c.sq_wr_avail) < 0) {
                rtrs_err(s, "IB send queue full: sess=%s cid=%d\n",
                         kobject_name(&sess->kobj),
                         con->c.cid);
-               atomic_add(1, &con->sq_wr_avail);
+               atomic_add(1, &con->c.sq_wr_avail);
                spin_lock(&con->rsp_wr_wait_lock);
                list_add_tail(&id->wait_list, &con->rsp_wr_wait_list);
                spin_unlock(&con->rsp_wr_wait_lock);
@@ -525,7 +522,7 @@ bool rtrs_srv_resp_rdma(struct rtrs_srv_op *id, int status)
        else
                err = rdma_write_sg(id);
 
-       if (unlikely(err)) {
+       if (err) {
                rtrs_err_rl(s, "IO response failed: %d: sess=%s\n", err,
                            kobject_name(&sess->kobj));
                close_sess(sess);
@@ -712,7 +709,7 @@ static void rtrs_srv_info_rsp_done(struct ib_cq *cq, struct ib_wc *wc)
        iu = container_of(wc->wr_cqe, struct rtrs_iu, cqe);
        rtrs_iu_free(iu, sess->s.dev->ib_dev, 1);
 
-       if (unlikely(wc->status != IB_WC_SUCCESS)) {
+       if (wc->status != IB_WC_SUCCESS) {
                rtrs_err(s, "Sess info response send failed: %s\n",
                          ib_wc_status_msg(wc->status));
                close_sess(sess);
@@ -801,7 +798,7 @@ static int process_info_req(struct rtrs_srv_con *con,
        size_t tx_sz;
 
        err = post_recv_sess(sess);
-       if (unlikely(err)) {
+       if (err) {
                rtrs_err(s, "post_recv_sess(), err: %d\n", err);
                return err;
        }
@@ -814,14 +811,14 @@ static int process_info_req(struct rtrs_srv_con *con,
        strscpy(sess->s.sessname, msg->sessname, sizeof(sess->s.sessname));
 
        rwr = kcalloc(sess->mrs_num, sizeof(*rwr), GFP_KERNEL);
-       if (unlikely(!rwr))
+       if (!rwr)
                return -ENOMEM;
 
        tx_sz  = sizeof(*rsp);
        tx_sz += sizeof(rsp->desc[0]) * sess->mrs_num;
        tx_iu = rtrs_iu_alloc(1, tx_sz, GFP_KERNEL, sess->s.dev->ib_dev,
                               DMA_TO_DEVICE, rtrs_srv_info_rsp_done);
-       if (unlikely(!tx_iu)) {
+       if (!tx_iu) {
                err = -ENOMEM;
                goto rwr_free;
        }
@@ -853,7 +850,7 @@ static int process_info_req(struct rtrs_srv_con *con,
        }
 
        err = rtrs_srv_create_sess_files(sess);
-       if (unlikely(err))
+       if (err)
                goto iu_free;
        kobject_get(&sess->kobj);
        get_device(&sess->srv->dev);
@@ -873,7 +870,7 @@ static int process_info_req(struct rtrs_srv_con *con,
 
        /* Send info response */
        err = rtrs_iu_post_send(&con->c, tx_iu, tx_sz, reg_wr);
-       if (unlikely(err)) {
+       if (err) {
                rtrs_err(s, "rtrs_iu_post_send(), err: %d\n", err);
 iu_free:
                rtrs_iu_free(tx_iu, sess->s.dev->ib_dev, 1);
@@ -896,14 +893,14 @@ static void rtrs_srv_info_req_done(struct ib_cq *cq, struct ib_wc *wc)
        WARN_ON(con->c.cid);
 
        iu = container_of(wc->wr_cqe, struct rtrs_iu, cqe);
-       if (unlikely(wc->status != IB_WC_SUCCESS)) {
+       if (wc->status != IB_WC_SUCCESS) {
                rtrs_err(s, "Sess info request receive failed: %s\n",
                          ib_wc_status_msg(wc->status));
                goto close;
        }
        WARN_ON(wc->opcode != IB_WC_RECV);
 
-       if (unlikely(wc->byte_len < sizeof(*msg))) {
+       if (wc->byte_len < sizeof(*msg)) {
                rtrs_err(s, "Sess info request is malformed: size %d\n",
                          wc->byte_len);
                goto close;
@@ -911,13 +908,13 @@ static void rtrs_srv_info_req_done(struct ib_cq *cq, struct ib_wc *wc)
        ib_dma_sync_single_for_cpu(sess->s.dev->ib_dev, iu->dma_addr,
                                   iu->size, DMA_FROM_DEVICE);
        msg = iu->buf;
-       if (unlikely(le16_to_cpu(msg->type) != RTRS_MSG_INFO_REQ)) {
+       if (le16_to_cpu(msg->type) != RTRS_MSG_INFO_REQ) {
                rtrs_err(s, "Sess info request is malformed: type %d\n",
                          le16_to_cpu(msg->type));
                goto close;
        }
        err = process_info_req(con, msg);
-       if (unlikely(err))
+       if (err)
                goto close;
 
 out:
@@ -938,11 +935,11 @@ static int post_recv_info_req(struct rtrs_srv_con *con)
        rx_iu = rtrs_iu_alloc(1, sizeof(struct rtrs_msg_info_req),
                               GFP_KERNEL, sess->s.dev->ib_dev,
                               DMA_FROM_DEVICE, rtrs_srv_info_req_done);
-       if (unlikely(!rx_iu))
+       if (!rx_iu)
                return -ENOMEM;
        /* Prepare for getting info response */
        err = rtrs_iu_post_recv(&con->c, rx_iu);
-       if (unlikely(err)) {
+       if (err) {
                rtrs_err(s, "rtrs_iu_post_recv(), err: %d\n", err);
                rtrs_iu_free(rx_iu, sess->s.dev->ib_dev, 1);
                return err;
@@ -957,7 +954,7 @@ static int post_recv_io(struct rtrs_srv_con *con, size_t q_size)
 
        for (i = 0; i < q_size; i++) {
                err = rtrs_post_recv_empty(&con->c, &io_comp_cqe);
-               if (unlikely(err))
+               if (err)
                        return err;
        }
 
@@ -978,7 +975,7 @@ static int post_recv_sess(struct rtrs_srv_sess *sess)
                        q_size = srv->queue_depth;
 
                err = post_recv_io(to_srv_con(sess->s.con[cid]), q_size);
-               if (unlikely(err)) {
+               if (err) {
                        rtrs_err(s, "post_recv_io(), err: %d\n", err);
                        return err;
                }
@@ -1001,13 +998,13 @@ static void process_read(struct rtrs_srv_con *con,
        void *data;
        int ret;
 
-       if (unlikely(sess->state != RTRS_SRV_CONNECTED)) {
+       if (sess->state != RTRS_SRV_CONNECTED) {
                rtrs_err_rl(s,
                             "Processing read request failed,  session is disconnected, sess state %s\n",
                             rtrs_srv_state_str(sess->state));
                return;
        }
-       if (unlikely(msg->sg_cnt != 1 && msg->sg_cnt != 0)) {
+       if (msg->sg_cnt != 1 && msg->sg_cnt != 0) {
                rtrs_err_rl(s,
                            "Processing read request failed, invalid message\n");
                return;
@@ -1025,7 +1022,7 @@ static void process_read(struct rtrs_srv_con *con,
        ret = ctx->ops.rdma_ev(srv->priv, id, READ, data, data_len,
                           data + data_len, usr_len);
 
-       if (unlikely(ret)) {
+       if (ret) {
                rtrs_err_rl(s,
                             "Processing read request failed, user module cb reported for msg_id %d, err: %d\n",
                             buf_id, ret);
@@ -1059,7 +1056,7 @@ static void process_write(struct rtrs_srv_con *con,
        void *data;
        int ret;
 
-       if (unlikely(sess->state != RTRS_SRV_CONNECTED)) {
+       if (sess->state != RTRS_SRV_CONNECTED) {
                rtrs_err_rl(s,
                             "Processing write request failed,  session is disconnected, sess state %s\n",
                             rtrs_srv_state_str(sess->state));
@@ -1076,8 +1073,8 @@ static void process_write(struct rtrs_srv_con *con,
        data_len = off - usr_len;
        data = page_address(srv->chunks[buf_id]);
        ret = ctx->ops.rdma_ev(srv->priv, id, WRITE, data, data_len,
-                          data + data_len, usr_len);
-       if (unlikely(ret)) {
+                              data + data_len, usr_len);
+       if (ret) {
                rtrs_err_rl(s,
                             "Processing write request failed, user module callback reports err: %d\n",
                             ret);
@@ -1141,7 +1138,7 @@ static void rtrs_srv_inv_rkey_done(struct ib_cq *cq, struct ib_wc *wc)
        u32 msg_id, off;
        void *data;
 
-       if (unlikely(wc->status != IB_WC_SUCCESS)) {
+       if (wc->status != IB_WC_SUCCESS) {
                rtrs_err(s, "Failed IB_WR_LOCAL_INV: %s\n",
                          ib_wc_status_msg(wc->status));
                close_sess(sess);
@@ -1198,7 +1195,7 @@ static void rtrs_srv_rdma_done(struct ib_cq *cq, struct ib_wc *wc)
        u32 imm_type, imm_payload;
        int err;
 
-       if (unlikely(wc->status != IB_WC_SUCCESS)) {
+       if (wc->status != IB_WC_SUCCESS) {
                if (wc->status != IB_WC_WR_FLUSH_ERR) {
                        rtrs_err(s,
                                  "%s (wr_cqe: %p, type: %d, vendor_err: 0x%x, len: %u)\n",
@@ -1218,21 +1215,20 @@ static void rtrs_srv_rdma_done(struct ib_cq *cq, struct ib_wc *wc)
                if (WARN_ON(wc->wr_cqe != &io_comp_cqe))
                        return;
                err = rtrs_post_recv_empty(&con->c, &io_comp_cqe);
-               if (unlikely(err)) {
+               if (err) {
                        rtrs_err(s, "rtrs_post_recv(), err: %d\n", err);
                        close_sess(sess);
                        break;
                }
                rtrs_from_imm(be32_to_cpu(wc->ex.imm_data),
                               &imm_type, &imm_payload);
-               if (likely(imm_type == RTRS_IO_REQ_IMM)) {
+               if (imm_type == RTRS_IO_REQ_IMM) {
                        u32 msg_id, off;
                        void *data;
 
                        msg_id = imm_payload >> sess->mem_bits;
                        off = imm_payload & ((1 << sess->mem_bits) - 1);
-                       if (unlikely(msg_id >= srv->queue_depth ||
-                                    off >= max_chunk_size)) {
+                       if (msg_id >= srv->queue_depth || off >= max_chunk_size) {
                                rtrs_err(s, "Wrong msg_id %u, off %u\n",
                                          msg_id, off);
                                close_sess(sess);
@@ -1244,7 +1240,7 @@ static void rtrs_srv_rdma_done(struct ib_cq *cq, struct ib_wc *wc)
                                mr->msg_off = off;
                                mr->msg_id = msg_id;
                                err = rtrs_srv_inv_rkey(con, mr);
-                               if (unlikely(err)) {
+                               if (err) {
                                        rtrs_err(s, "rtrs_post_recv(), err: %d\n",
                                                  err);
                                        close_sess(sess);
@@ -1268,10 +1264,11 @@ static void rtrs_srv_rdma_done(struct ib_cq *cq, struct ib_wc *wc)
        case IB_WC_SEND:
                /*
                 * post_send() RDMA write completions of IO reqs (read/write)
+                * and hb.
                 */
-               atomic_add(srv->queue_depth, &con->sq_wr_avail);
+               atomic_add(s->signal_interval, &con->c.sq_wr_avail);
 
-               if (unlikely(!list_empty_careful(&con->rsp_wr_wait_list)))
+               if (!list_empty_careful(&con->rsp_wr_wait_list))
                        rtrs_rdma_process_wr_wait_list(con);
 
                break;
@@ -1648,7 +1645,7 @@ static int create_con(struct rtrs_srv_sess *sess,
        con->c.cm_id = cm_id;
        con->c.sess = &sess->s;
        con->c.cid = cid;
-       atomic_set(&con->wr_cnt, 1);
+       atomic_set(&con->c.wr_cnt, 1);
        wr_limit = sess->s.dev->ib_dev->attrs.max_qp_wr;
 
        if (con->c.cid == 0) {
@@ -1659,6 +1656,8 @@ static int create_con(struct rtrs_srv_sess *sess,
                max_send_wr = min_t(int, wr_limit,
                                    SERVICE_CON_QUEUE_DEPTH * 2 + 2);
                max_recv_wr = max_send_wr;
+               s->signal_interval = min_not_zero(srv->queue_depth,
+                                                 (size_t)SERVICE_CON_QUEUE_DEPTH);
        } else {
                /* when always_invlaidate enalbed, we need linv+rinv+mr+imm */
                if (always_invalidate)
@@ -1679,7 +1678,7 @@ static int create_con(struct rtrs_srv_sess *sess,
                 */
        }
        cq_num = max_send_wr + max_recv_wr;
-       atomic_set(&con->sq_wr_avail, max_send_wr);
+       atomic_set(&con->c.sq_wr_avail, max_send_wr);
        cq_vector = rtrs_srv_get_next_cq_vector(sess);
 
        /* TODO: SOFTIRQ can be faster, but be careful with softirq context */
@@ -1894,7 +1893,7 @@ static int rtrs_rdma_connect(struct rdma_cm_id *cm_id,
        err = create_con(sess, cm_id, cid);
        if (err) {
                rtrs_err((&sess->s), "create_con(), error %d\n", err);
-               (void)rtrs_rdma_do_reject(cm_id, err);
+               rtrs_rdma_do_reject(cm_id, err);
                /*
                 * Since session has other connections we follow normal way
                 * through workqueue, but still return an error to tell cma.c
@@ -1905,7 +1904,7 @@ static int rtrs_rdma_connect(struct rdma_cm_id *cm_id,
        err = rtrs_rdma_do_accept(sess, cm_id);
        if (err) {
                rtrs_err((&sess->s), "rtrs_rdma_do_accept(), error %d\n", err);
-               (void)rtrs_rdma_do_reject(cm_id, err);
+               rtrs_rdma_do_reject(cm_id, err);
                /*
                 * Since current connection was successfully added to the
                 * session we follow normal way through workqueue to close the
index f8da2e3f0bdac4937e622891c32ed1f0610762e5..9d8d2a91a235bb588856aac64bf036007b7132d7 100644 (file)
@@ -42,8 +42,6 @@ struct rtrs_srv_stats {
 
 struct rtrs_srv_con {
        struct rtrs_con         c;
-       atomic_t                wr_cnt;
-       atomic_t                sq_wr_avail;
        struct list_head        rsp_wr_wait_list;
        spinlock_t              rsp_wr_wait_lock;
 };
@@ -140,10 +138,6 @@ static inline void rtrs_srv_update_rdma_stats(struct rtrs_srv_stats *s,
 int rtrs_srv_reset_rdma_stats(struct rtrs_srv_stats *stats, bool enable);
 ssize_t rtrs_srv_stats_rdma_to_str(struct rtrs_srv_stats *stats,
                                    char *page, size_t len);
-int rtrs_srv_reset_wc_completion_stats(struct rtrs_srv_stats *stats,
-                                       bool enable);
-int rtrs_srv_stats_wc_completion_to_str(struct rtrs_srv_stats *stats, char *buf,
-                                        size_t len);
 int rtrs_srv_reset_all_stats(struct rtrs_srv_stats *stats, bool enable);
 ssize_t rtrs_srv_reset_all_help(struct rtrs_srv_stats *stats,
                                 char *page, size_t len);
index 61919ebd92b2db2ce8ccd96c0e33c4f57cd09ef6..ca542e477d3848353f8c4b94e2170878ff9745c3 100644 (file)
@@ -182,22 +182,28 @@ int rtrs_iu_post_rdma_write_imm(struct rtrs_con *con, struct rtrs_iu *iu,
 }
 EXPORT_SYMBOL_GPL(rtrs_iu_post_rdma_write_imm);
 
-int rtrs_post_rdma_write_imm_empty(struct rtrs_con *con, struct ib_cqe *cqe,
-                                   u32 imm_data, enum ib_send_flags flags,
-                                   struct ib_send_wr *head)
+static int rtrs_post_rdma_write_imm_empty(struct rtrs_con *con,
+                                         struct ib_cqe *cqe,
+                                         u32 imm_data,
+                                         struct ib_send_wr *head)
 {
        struct ib_rdma_wr wr;
+       struct rtrs_sess *sess = con->sess;
+       enum ib_send_flags sflags;
+
+       atomic_dec_if_positive(&con->sq_wr_avail);
+       sflags = (atomic_inc_return(&con->wr_cnt) % sess->signal_interval) ?
+               0 : IB_SEND_SIGNALED;
 
        wr = (struct ib_rdma_wr) {
                .wr.wr_cqe      = cqe,
-               .wr.send_flags  = flags,
+               .wr.send_flags  = sflags,
                .wr.opcode      = IB_WR_RDMA_WRITE_WITH_IMM,
                .wr.ex.imm_data = cpu_to_be32(imm_data),
        };
 
        return rtrs_post_send(con->qp, head, &wr.wr, NULL);
 }
-EXPORT_SYMBOL_GPL(rtrs_post_rdma_write_imm_empty);
 
 static void qp_event_handler(struct ib_event *ev, void *ctx)
 {
@@ -314,8 +320,9 @@ void rtrs_send_hb_ack(struct rtrs_sess *sess)
 
        imm = rtrs_to_imm(RTRS_HB_ACK_IMM, 0);
        err = rtrs_post_rdma_write_imm_empty(usr_con, sess->hb_cqe, imm,
-                                            0, NULL);
+                                            NULL);
        if (err) {
+               rtrs_err(sess, "send HB ACK failed, errno: %d\n", err);
                sess->hb_err_handler(usr_con);
                return;
        }
@@ -333,6 +340,7 @@ static void hb_work(struct work_struct *work)
        usr_con = sess->con[0];
 
        if (sess->hb_missed_cnt > sess->hb_missed_max) {
+               rtrs_err(sess, "HB missed max reached.\n");
                sess->hb_err_handler(usr_con);
                return;
        }
@@ -346,8 +354,9 @@ static void hb_work(struct work_struct *work)
 
        imm = rtrs_to_imm(RTRS_HB_MSG_IMM, 0);
        err = rtrs_post_rdma_write_imm_empty(usr_con, sess->hb_cqe, imm,
-                                            0, NULL);
+                                            NULL);
        if (err) {
+               rtrs_err(sess, "HB send failed, errno: %d\n", err);
                sess->hb_err_handler(usr_con);
                return;
        }
index 360e093874d4fc00ddf68aecf8353d204011224a..cf97985628ab91d4bf2940adb24cd70b18a34e1f 100644 (file)
@@ -89,7 +89,8 @@ static void mlx5_add_cq_to_tasklet(struct mlx5_core_cq *cq,
 int mlx5_core_create_cq(struct mlx5_core_dev *dev, struct mlx5_core_cq *cq,
                        u32 *in, int inlen, u32 *out, int outlen)
 {
-       int eqn = MLX5_GET(cqc, MLX5_ADDR_OF(create_cq_in, in, cq_context), c_eqn);
+       int eqn = MLX5_GET(cqc, MLX5_ADDR_OF(create_cq_in, in, cq_context),
+                          c_eqn_or_apu_element);
        u32 din[MLX5_ST_SZ_DW(destroy_cq_in)] = {};
        struct mlx5_eq_comp *eq;
        int err;
index ea321e5287490d63f621e0e5165c4fdfa10e8392..4e72ca8070e2438d4ef5042bc237a26514a7ebc5 100644 (file)
@@ -5,11 +5,15 @@
 #include <linux/slab.h>
 #include <linux/xarray.h>
 #include <linux/hashtable.h>
+#include <linux/refcount.h>
 
 #include "mapping.h"
 
 #define MAPPING_GRACE_PERIOD 2000
 
+static LIST_HEAD(shared_ctx_list);
+static DEFINE_MUTEX(shared_ctx_lock);
+
 struct mapping_ctx {
        struct xarray xarray;
        DECLARE_HASHTABLE(ht, 8);
@@ -20,6 +24,10 @@ struct mapping_ctx {
        struct delayed_work dwork;
        struct list_head pending_list;
        spinlock_t pending_list_lock; /* Guards pending list */
+       u64 id;
+       u8 type;
+       struct list_head list;
+       refcount_t refcount;
 };
 
 struct mapping_item {
@@ -205,11 +213,48 @@ mapping_create(size_t data_size, u32 max_id, bool delayed_removal)
        mutex_init(&ctx->lock);
        xa_init_flags(&ctx->xarray, XA_FLAGS_ALLOC1);
 
+       refcount_set(&ctx->refcount, 1);
+       INIT_LIST_HEAD(&ctx->list);
+
+       return ctx;
+}
+
+struct mapping_ctx *
+mapping_create_for_id(u64 id, u8 type, size_t data_size, u32 max_id, bool delayed_removal)
+{
+       struct mapping_ctx *ctx;
+
+       mutex_lock(&shared_ctx_lock);
+       list_for_each_entry(ctx, &shared_ctx_list, list) {
+               if (ctx->id == id && ctx->type == type) {
+                       if (refcount_inc_not_zero(&ctx->refcount))
+                               goto unlock;
+                       break;
+               }
+       }
+
+       ctx = mapping_create(data_size, max_id, delayed_removal);
+       if (IS_ERR(ctx))
+               goto unlock;
+
+       ctx->id = id;
+       ctx->type = type;
+       list_add(&ctx->list, &shared_ctx_list);
+
+unlock:
+       mutex_unlock(&shared_ctx_lock);
        return ctx;
 }
 
 void mapping_destroy(struct mapping_ctx *ctx)
 {
+       if (!refcount_dec_and_test(&ctx->refcount))
+               return;
+
+       mutex_lock(&shared_ctx_lock);
+       list_del(&ctx->list);
+       mutex_unlock(&shared_ctx_lock);
+
        mapping_flush_work(ctx);
        xa_destroy(&ctx->xarray);
        mutex_destroy(&ctx->lock);
index 285525cc5470389484365af3d97d596bf34dc0b4..4e2119f0f4c119ee7a670c5723d97ff7b863dc68 100644 (file)
@@ -24,4 +24,9 @@ struct mapping_ctx *mapping_create(size_t data_size, u32 max_id,
                                   bool delayed_removal);
 void mapping_destroy(struct mapping_ctx *ctx);
 
+/* adds mapping with an id or get an existing mapping with the same id
+ */
+struct mapping_ctx *
+mapping_create_for_id(u64 id, u8 type, size_t data_size, u32 max_id, bool delayed_removal);
+
 #endif /* __MLX5_MAPPING_H__ */
index 91e7a01e32bed83591988141967ce4a422c01f16..b1707b86aa1620d1a6c7809185e4eabf7f94015d 100644 (file)
@@ -2138,6 +2138,7 @@ mlx5_tc_ct_init(struct mlx5e_priv *priv, struct mlx5_fs_chains *chains,
        struct mlx5_tc_ct_priv *ct_priv;
        struct mlx5_core_dev *dev;
        const char *msg;
+       u64 mapping_id;
        int err;
 
        dev = priv->mdev;
@@ -2153,13 +2154,17 @@ mlx5_tc_ct_init(struct mlx5e_priv *priv, struct mlx5_fs_chains *chains,
        if (!ct_priv)
                goto err_alloc;
 
-       ct_priv->zone_mapping = mapping_create(sizeof(u16), 0, true);
+       mapping_id = mlx5_query_nic_system_image_guid(dev);
+
+       ct_priv->zone_mapping = mapping_create_for_id(mapping_id, MAPPING_TYPE_ZONE,
+                                                     sizeof(u16), 0, true);
        if (IS_ERR(ct_priv->zone_mapping)) {
                err = PTR_ERR(ct_priv->zone_mapping);
                goto err_mapping_zone;
        }
 
-       ct_priv->labels_mapping = mapping_create(sizeof(u32) * 4, 0, true);
+       ct_priv->labels_mapping = mapping_create_for_id(mapping_id, MAPPING_TYPE_LABELS,
+                                                       sizeof(u32) * 4, 0, true);
        if (IS_ERR(ct_priv->labels_mapping)) {
                err = PTR_ERR(ct_priv->labels_mapping);
                goto err_mapping_labels;
index 24f919ef9b8e46a506ae5f3d28f5f7a5c8c004fd..3b378b84b8fa120851e33e15cb5fb697d30051a9 100644 (file)
@@ -1619,7 +1619,7 @@ static int mlx5e_create_cq(struct mlx5e_cq *cq, struct mlx5e_cq_param *param)
                                  (__be64 *)MLX5_ADDR_OF(create_cq_in, in, pas));
 
        MLX5_SET(cqc,   cqc, cq_period_mode, param->cq_period_mode);
-       MLX5_SET(cqc,   cqc, c_eqn,         eqn);
+       MLX5_SET(cqc,   cqc, c_eqn_or_apu_element, eqn);
        MLX5_SET(cqc,   cqc, uar_page,      mdev->priv.uar->index);
        MLX5_SET(cqc,   cqc, log_page_size, cq->wq_ctrl.buf.page_shift -
                                            MLX5_ADAPTER_PAGE_SHIFT);
index bf94bcb6fa5d23dc3ed1dd9ebb78f0923936874d..cc34600b4dde5102547b4c2f47a1009e3bd0e017 100644 (file)
@@ -49,6 +49,7 @@
 #include "en/devlink.h"
 #include "fs_core.h"
 #include "lib/mlx5.h"
+#include "lib/devcom.h"
 #define CREATE_TRACE_POINTS
 #include "diag/en_rep_tracepoint.h"
 #include "en_accel/ipsec.h"
@@ -310,6 +311,8 @@ static void mlx5e_sqs2vport_stop(struct mlx5_eswitch *esw,
        rpriv = mlx5e_rep_to_rep_priv(rep);
        list_for_each_entry_safe(rep_sq, tmp, &rpriv->vport_sqs_list, list) {
                mlx5_eswitch_del_send_to_vport_rule(rep_sq->send_to_vport_rule);
+               if (rep_sq->send_to_vport_rule_peer)
+                       mlx5_eswitch_del_send_to_vport_rule(rep_sq->send_to_vport_rule_peer);
                list_del(&rep_sq->list);
                kfree(rep_sq);
        }
@@ -319,6 +322,7 @@ static int mlx5e_sqs2vport_start(struct mlx5_eswitch *esw,
                                 struct mlx5_eswitch_rep *rep,
                                 u32 *sqns_array, int sqns_num)
 {
+       struct mlx5_eswitch *peer_esw = NULL;
        struct mlx5_flow_handle *flow_rule;
        struct mlx5e_rep_priv *rpriv;
        struct mlx5e_rep_sq *rep_sq;
@@ -329,6 +333,10 @@ static int mlx5e_sqs2vport_start(struct mlx5_eswitch *esw,
                return 0;
 
        rpriv = mlx5e_rep_to_rep_priv(rep);
+       if (mlx5_devcom_is_paired(esw->dev->priv.devcom, MLX5_DEVCOM_ESW_OFFLOADS))
+               peer_esw = mlx5_devcom_get_peer_data(esw->dev->priv.devcom,
+                                                    MLX5_DEVCOM_ESW_OFFLOADS);
+
        for (i = 0; i < sqns_num; i++) {
                rep_sq = kzalloc(sizeof(*rep_sq), GFP_KERNEL);
                if (!rep_sq) {
@@ -337,7 +345,7 @@ static int mlx5e_sqs2vport_start(struct mlx5_eswitch *esw,
                }
 
                /* Add re-inject rule to the PF/representor sqs */
-               flow_rule = mlx5_eswitch_add_send_to_vport_rule(esw, rep,
+               flow_rule = mlx5_eswitch_add_send_to_vport_rule(esw, esw, rep,
                                                                sqns_array[i]);
                if (IS_ERR(flow_rule)) {
                        err = PTR_ERR(flow_rule);
@@ -345,12 +353,34 @@ static int mlx5e_sqs2vport_start(struct mlx5_eswitch *esw,
                        goto out_err;
                }
                rep_sq->send_to_vport_rule = flow_rule;
+               rep_sq->sqn = sqns_array[i];
+
+               if (peer_esw) {
+                       flow_rule = mlx5_eswitch_add_send_to_vport_rule(peer_esw, esw,
+                                                                       rep, sqns_array[i]);
+                       if (IS_ERR(flow_rule)) {
+                               err = PTR_ERR(flow_rule);
+                               mlx5_eswitch_del_send_to_vport_rule(rep_sq->send_to_vport_rule);
+                               kfree(rep_sq);
+                               goto out_err;
+                       }
+                       rep_sq->send_to_vport_rule_peer = flow_rule;
+               }
+
                list_add(&rep_sq->list, &rpriv->vport_sqs_list);
        }
+
+       if (peer_esw)
+               mlx5_devcom_release_peer_data(esw->dev->priv.devcom, MLX5_DEVCOM_ESW_OFFLOADS);
+
        return 0;
 
 out_err:
        mlx5e_sqs2vport_stop(esw, rep);
+
+       if (peer_esw)
+               mlx5_devcom_release_peer_data(esw->dev->priv.devcom, MLX5_DEVCOM_ESW_OFFLOADS);
+
        return err;
 }
 
@@ -1264,10 +1294,64 @@ static void *mlx5e_vport_rep_get_proto_dev(struct mlx5_eswitch_rep *rep)
        return rpriv->netdev;
 }
 
+static void mlx5e_vport_rep_event_unpair(struct mlx5_eswitch_rep *rep)
+{
+       struct mlx5e_rep_priv *rpriv;
+       struct mlx5e_rep_sq *rep_sq;
+
+       rpriv = mlx5e_rep_to_rep_priv(rep);
+       list_for_each_entry(rep_sq, &rpriv->vport_sqs_list, list) {
+               if (!rep_sq->send_to_vport_rule_peer)
+                       continue;
+               mlx5_eswitch_del_send_to_vport_rule(rep_sq->send_to_vport_rule_peer);
+               rep_sq->send_to_vport_rule_peer = NULL;
+       }
+}
+
+static int mlx5e_vport_rep_event_pair(struct mlx5_eswitch *esw,
+                                     struct mlx5_eswitch_rep *rep,
+                                     struct mlx5_eswitch *peer_esw)
+{
+       struct mlx5_flow_handle *flow_rule;
+       struct mlx5e_rep_priv *rpriv;
+       struct mlx5e_rep_sq *rep_sq;
+
+       rpriv = mlx5e_rep_to_rep_priv(rep);
+       list_for_each_entry(rep_sq, &rpriv->vport_sqs_list, list) {
+               if (rep_sq->send_to_vport_rule_peer)
+                       continue;
+               flow_rule = mlx5_eswitch_add_send_to_vport_rule(peer_esw, esw, rep, rep_sq->sqn);
+               if (IS_ERR(flow_rule))
+                       goto err_out;
+               rep_sq->send_to_vport_rule_peer = flow_rule;
+       }
+
+       return 0;
+err_out:
+       mlx5e_vport_rep_event_unpair(rep);
+       return PTR_ERR(flow_rule);
+}
+
+static int mlx5e_vport_rep_event(struct mlx5_eswitch *esw,
+                                struct mlx5_eswitch_rep *rep,
+                                enum mlx5_switchdev_event event,
+                                void *data)
+{
+       int err = 0;
+
+       if (event == MLX5_SWITCHDEV_EVENT_PAIR)
+               err = mlx5e_vport_rep_event_pair(esw, rep, data);
+       else if (event == MLX5_SWITCHDEV_EVENT_UNPAIR)
+               mlx5e_vport_rep_event_unpair(rep);
+
+       return err;
+}
+
 static const struct mlx5_eswitch_rep_ops rep_ops = {
        .load = mlx5e_vport_rep_load,
        .unload = mlx5e_vport_rep_unload,
-       .get_proto_dev = mlx5e_vport_rep_get_proto_dev
+       .get_proto_dev = mlx5e_vport_rep_get_proto_dev,
+       .event = mlx5e_vport_rep_event,
 };
 
 static int mlx5e_rep_probe(struct auxiliary_device *adev,
index 47a2dfb7792acf2c7707563fdef8e17742dea688..8f0c82448eece96160f6b40aa141ca23eecba2cc 100644 (file)
@@ -207,6 +207,8 @@ struct mlx5e_encap_entry {
 
 struct mlx5e_rep_sq {
        struct mlx5_flow_handle *send_to_vport_rule;
+       struct mlx5_flow_handle *send_to_vport_rule_peer;
+       u32 sqn;
        struct list_head         list;
 };
 
index d273758255c3a5e048e253444f7caf926d0ac69d..160c7c3fdfd040e99abc12bda5d4c2b1a7f5d75f 100644 (file)
@@ -4877,6 +4877,7 @@ int mlx5e_tc_nic_init(struct mlx5e_priv *priv)
        struct mlx5_core_dev *dev = priv->mdev;
        struct mapping_ctx *chains_mapping;
        struct mlx5_chains_attr attr = {};
+       u64 mapping_id;
        int err;
 
        mlx5e_mod_hdr_tbl_init(&tc->mod_hdr);
@@ -4890,8 +4891,12 @@ int mlx5e_tc_nic_init(struct mlx5e_priv *priv)
 
        lockdep_set_class(&tc->ht.mutex, &tc_ht_lock_key);
 
-       chains_mapping = mapping_create(sizeof(struct mlx5_mapped_obj),
-                                       MLX5E_TC_TABLE_CHAIN_TAG_MASK, true);
+       mapping_id = mlx5_query_nic_system_image_guid(dev);
+
+       chains_mapping = mapping_create_for_id(mapping_id, MAPPING_TYPE_CHAIN,
+                                              sizeof(struct mlx5_mapped_obj),
+                                              MLX5E_TC_TABLE_CHAIN_TAG_MASK, true);
+
        if (IS_ERR(chains_mapping)) {
                err = PTR_ERR(chains_mapping);
                goto err_mapping;
@@ -4980,6 +4985,7 @@ int mlx5e_tc_esw_init(struct rhashtable *tc_ht)
        struct mapping_ctx *mapping;
        struct mlx5_eswitch *esw;
        struct mlx5e_priv *priv;
+       u64 mapping_id;
        int err = 0;
 
        uplink_priv = container_of(tc_ht, struct mlx5_rep_uplink_priv, tc_ht);
@@ -4996,8 +5002,12 @@ int mlx5e_tc_esw_init(struct rhashtable *tc_ht)
        uplink_priv->esw_psample = mlx5_esw_sample_init(netdev_priv(priv->netdev));
 #endif
 
-       mapping = mapping_create(sizeof(struct tunnel_match_key),
-                                TUNNEL_INFO_BITS_MASK, true);
+       mapping_id = mlx5_query_nic_system_image_guid(esw->dev);
+
+       mapping = mapping_create_for_id(mapping_id, MAPPING_TYPE_TUNNEL,
+                                       sizeof(struct tunnel_match_key),
+                                       TUNNEL_INFO_BITS_MASK, true);
+
        if (IS_ERR(mapping)) {
                err = PTR_ERR(mapping);
                goto err_tun_mapping;
@@ -5005,7 +5015,8 @@ int mlx5e_tc_esw_init(struct rhashtable *tc_ht)
        uplink_priv->tunnel_mapping = mapping;
 
        /* 0xFFF is reserved for stack devices slow path table mark */
-       mapping = mapping_create(sz_enc_opts, ENC_OPTS_BITS_MASK - 1, true);
+       mapping = mapping_create_for_id(mapping_id, MAPPING_TYPE_TUNNEL_ENC_OPTS,
+                                       sz_enc_opts, ENC_OPTS_BITS_MASK - 1, true);
        if (IS_ERR(mapping)) {
                err = PTR_ERR(mapping);
                goto err_enc_opts_mapping;
index 505bf811984a0ba11057b28e1ef2bb2ea4441317..2e504c7461c6574f7c4303886e9a6a002408e365 100644 (file)
@@ -15,6 +15,15 @@ static void esw_acl_egress_ofld_fwd2vport_destroy(struct mlx5_vport *vport)
        vport->egress.offloads.fwd_rule = NULL;
 }
 
+static void esw_acl_egress_ofld_bounce_rule_destroy(struct mlx5_vport *vport)
+{
+       if (!vport->egress.offloads.bounce_rule)
+               return;
+
+       mlx5_del_flow_rules(vport->egress.offloads.bounce_rule);
+       vport->egress.offloads.bounce_rule = NULL;
+}
+
 static int esw_acl_egress_ofld_fwd2vport_create(struct mlx5_eswitch *esw,
                                                struct mlx5_vport *vport,
                                                struct mlx5_flow_destination *fwd_dest)
@@ -87,6 +96,7 @@ static void esw_acl_egress_ofld_rules_destroy(struct mlx5_vport *vport)
 {
        esw_acl_egress_vlan_destroy(vport);
        esw_acl_egress_ofld_fwd2vport_destroy(vport);
+       esw_acl_egress_ofld_bounce_rule_destroy(vport);
 }
 
 static int esw_acl_egress_ofld_groups_create(struct mlx5_eswitch *esw,
@@ -145,6 +155,12 @@ static void esw_acl_egress_ofld_groups_destroy(struct mlx5_vport *vport)
                mlx5_destroy_flow_group(vport->egress.offloads.fwd_grp);
                vport->egress.offloads.fwd_grp = NULL;
        }
+
+       if (!IS_ERR_OR_NULL(vport->egress.offloads.bounce_grp)) {
+               mlx5_destroy_flow_group(vport->egress.offloads.bounce_grp);
+               vport->egress.offloads.bounce_grp = NULL;
+       }
+
        esw_acl_egress_vlan_grp_destroy(vport);
 }
 
index 97e6cb6f13c14d119785c409ca1a7874e176ae7b..f3a7f9d3334fc8ae07cb7bc12f58a934f458a04a 100644 (file)
@@ -1458,8 +1458,6 @@ int mlx5_eswitch_enable_locked(struct mlx5_eswitch *esw, int mode, int num_vfs)
 
        esw->mode = mode;
 
-       mlx5_lag_update(esw->dev);
-
        if (mode == MLX5_ESWITCH_LEGACY) {
                err = esw_legacy_enable(esw);
        } else {
@@ -1506,6 +1504,7 @@ int mlx5_eswitch_enable(struct mlx5_eswitch *esw, int num_vfs)
        if (!mlx5_esw_allowed(esw))
                return 0;
 
+       mlx5_lag_disable_change(esw->dev);
        down_write(&esw->mode_lock);
        if (esw->mode == MLX5_ESWITCH_NONE) {
                ret = mlx5_eswitch_enable_locked(esw, MLX5_ESWITCH_LEGACY, num_vfs);
@@ -1519,6 +1518,7 @@ int mlx5_eswitch_enable(struct mlx5_eswitch *esw, int num_vfs)
                        esw->esw_funcs.num_vfs = num_vfs;
        }
        up_write(&esw->mode_lock);
+       mlx5_lag_enable_change(esw->dev);
        return ret;
 }
 
@@ -1550,8 +1550,6 @@ void mlx5_eswitch_disable_locked(struct mlx5_eswitch *esw, bool clear_vf)
        old_mode = esw->mode;
        esw->mode = MLX5_ESWITCH_NONE;
 
-       mlx5_lag_update(esw->dev);
-
        if (old_mode == MLX5_ESWITCH_OFFLOADS)
                mlx5_rescan_drivers(esw->dev);
 
@@ -1567,10 +1565,12 @@ void mlx5_eswitch_disable(struct mlx5_eswitch *esw, bool clear_vf)
        if (!mlx5_esw_allowed(esw))
                return;
 
+       mlx5_lag_disable_change(esw->dev);
        down_write(&esw->mode_lock);
        mlx5_eswitch_disable_locked(esw, clear_vf);
        esw->esw_funcs.num_vfs = 0;
        up_write(&esw->mode_lock);
+       mlx5_lag_enable_change(esw->dev);
 }
 
 static int mlx5_query_hca_cap_host_pf(struct mlx5_core_dev *dev, void *out)
@@ -1759,7 +1759,9 @@ int mlx5_eswitch_init(struct mlx5_core_dev *dev)
        ida_init(&esw->offloads.vport_metadata_ida);
        xa_init_flags(&esw->offloads.vhca_map, XA_FLAGS_ALLOC);
        mutex_init(&esw->state_lock);
+       lockdep_register_key(&esw->mode_lock_key);
        init_rwsem(&esw->mode_lock);
+       lockdep_set_class(&esw->mode_lock, &esw->mode_lock_key);
 
        esw->enabled_vports = 0;
        esw->mode = MLX5_ESWITCH_NONE;
@@ -1793,6 +1795,7 @@ void mlx5_eswitch_cleanup(struct mlx5_eswitch *esw)
 
        esw->dev->priv.eswitch = NULL;
        destroy_workqueue(esw->work_queue);
+       lockdep_unregister_key(&esw->mode_lock_key);
        mutex_destroy(&esw->state_lock);
        WARN_ON(!xa_empty(&esw->offloads.vhca_map));
        xa_destroy(&esw->offloads.vhca_map);
@@ -2366,9 +2369,22 @@ int mlx5_esw_try_lock(struct mlx5_eswitch *esw)
  */
 void mlx5_esw_unlock(struct mlx5_eswitch *esw)
 {
+       if (!mlx5_esw_allowed(esw))
+               return;
        up_write(&esw->mode_lock);
 }
 
+/**
+ * mlx5_esw_lock() - Take write lock on esw mode lock
+ * @esw: eswitch device.
+ */
+void mlx5_esw_lock(struct mlx5_eswitch *esw)
+{
+       if (!mlx5_esw_allowed(esw))
+               return;
+       down_write(&esw->mode_lock);
+}
+
 /**
  * mlx5_eswitch_get_total_vports - Get total vports of the eswitch
  *
@@ -2384,3 +2400,15 @@ u16 mlx5_eswitch_get_total_vports(const struct mlx5_core_dev *dev)
        return mlx5_esw_allowed(esw) ? esw->total_vports : 0;
 }
 EXPORT_SYMBOL_GPL(mlx5_eswitch_get_total_vports);
+
+/**
+ * mlx5_eswitch_get_core_dev - Get the mdev device
+ * @esw : eswitch device.
+ *
+ * Return the mellanox core device which manages the eswitch.
+ */
+struct mlx5_core_dev *mlx5_eswitch_get_core_dev(struct mlx5_eswitch *esw)
+{
+       return mlx5_esw_allowed(esw) ? esw->dev : NULL;
+}
+EXPORT_SYMBOL(mlx5_eswitch_get_core_dev);
index d562edf5b0bc1c48aedb96bafb3de7297bd31e77..d49066d8ba453313731f035f59462e9dd54df38d 100644 (file)
@@ -86,6 +86,14 @@ struct mlx5_mapped_obj {
 #define esw_chains(esw) \
        ((esw)->fdb_table.offloads.esw_chains_priv)
 
+enum {
+       MAPPING_TYPE_CHAIN,
+       MAPPING_TYPE_TUNNEL,
+       MAPPING_TYPE_TUNNEL_ENC_OPTS,
+       MAPPING_TYPE_LABELS,
+       MAPPING_TYPE_ZONE,
+};
+
 struct vport_ingress {
        struct mlx5_flow_table *acl;
        struct mlx5_flow_handle *allow_rule;
@@ -124,6 +132,8 @@ struct vport_egress {
                struct {
                        struct mlx5_flow_group *fwd_grp;
                        struct mlx5_flow_handle *fwd_rule;
+                       struct mlx5_flow_handle *bounce_rule;
+                       struct mlx5_flow_group *bounce_grp;
                } offloads;
        };
 };
@@ -315,6 +325,7 @@ struct mlx5_eswitch {
                u32             large_group_num;
        }  params;
        struct blocking_notifier_head n_head;
+       struct lock_class_key mode_lock_key;
 };
 
 void esw_offloads_disable(struct mlx5_eswitch *esw);
@@ -699,11 +710,18 @@ void mlx5_esw_get(struct mlx5_core_dev *dev);
 void mlx5_esw_put(struct mlx5_core_dev *dev);
 int mlx5_esw_try_lock(struct mlx5_eswitch *esw);
 void mlx5_esw_unlock(struct mlx5_eswitch *esw);
+void mlx5_esw_lock(struct mlx5_eswitch *esw);
 
 void esw_vport_change_handle_locked(struct mlx5_vport *vport);
 
 bool mlx5_esw_offloads_controller_valid(const struct mlx5_eswitch *esw, u32 controller);
 
+int mlx5_eswitch_offloads_config_single_fdb(struct mlx5_eswitch *master_esw,
+                                           struct mlx5_eswitch *slave_esw);
+void mlx5_eswitch_offloads_destroy_single_fdb(struct mlx5_eswitch *master_esw,
+                                             struct mlx5_eswitch *slave_esw);
+int mlx5_eswitch_reload_reps(struct mlx5_eswitch *esw);
+
 #else  /* CONFIG_MLX5_ESWITCH */
 /* eswitch API stubs */
 static inline int  mlx5_eswitch_init(struct mlx5_core_dev *dev) { return 0; }
@@ -719,6 +737,9 @@ static inline const u32 *mlx5_esw_query_functions(struct mlx5_core_dev *dev)
        return ERR_PTR(-EOPNOTSUPP);
 }
 
+static inline void mlx5_esw_unlock(struct mlx5_eswitch *esw) { return; }
+static inline void mlx5_esw_lock(struct mlx5_eswitch *esw) { return; }
+
 static inline struct mlx5_flow_handle *
 esw_add_restore_rule(struct mlx5_eswitch *esw, u32 tag)
 {
@@ -731,6 +752,23 @@ mlx5_esw_vport_to_devlink_port_index(const struct mlx5_core_dev *dev,
 {
        return vport_num;
 }
+
+static inline int
+mlx5_eswitch_offloads_config_single_fdb(struct mlx5_eswitch *master_esw,
+                                       struct mlx5_eswitch *slave_esw)
+{
+       return 0;
+}
+
+static inline void
+mlx5_eswitch_offloads_destroy_single_fdb(struct mlx5_eswitch *master_esw,
+                                        struct mlx5_eswitch *slave_esw) {}
+
+static inline int
+mlx5_eswitch_reload_reps(struct mlx5_eswitch *esw)
+{
+       return 0;
+}
 #endif /* CONFIG_MLX5_ESWITCH */
 
 #endif /* __MLX5_ESWITCH_H__ */
index 3bb71a1860042a753030032f0a5a4406af9b6e09..c98674a451a320264fc1023cb243933da73c691a 100644 (file)
@@ -927,6 +927,7 @@ out:
 
 struct mlx5_flow_handle *
 mlx5_eswitch_add_send_to_vport_rule(struct mlx5_eswitch *on_esw,
+                                   struct mlx5_eswitch *from_esw,
                                    struct mlx5_eswitch_rep *rep,
                                    u32 sqn)
 {
@@ -945,10 +946,10 @@ mlx5_eswitch_add_send_to_vport_rule(struct mlx5_eswitch *on_esw,
        misc = MLX5_ADDR_OF(fte_match_param, spec->match_value, misc_parameters);
        MLX5_SET(fte_match_set_misc, misc, source_sqn, sqn);
        /* source vport is the esw manager */
-       MLX5_SET(fte_match_set_misc, misc, source_port, rep->esw->manager_vport);
+       MLX5_SET(fte_match_set_misc, misc, source_port, from_esw->manager_vport);
        if (MLX5_CAP_ESW(on_esw->dev, merged_eswitch))
                MLX5_SET(fte_match_set_misc, misc, source_eswitch_owner_vhca_id,
-                        MLX5_CAP_GEN(rep->esw->dev, vhca_id));
+                        MLX5_CAP_GEN(from_esw->dev, vhca_id));
 
        misc = MLX5_ADDR_OF(fte_match_param, spec->match_criteria, misc_parameters);
        MLX5_SET_TO_ONES(fte_match_set_misc, misc, source_sqn);
@@ -964,6 +965,9 @@ mlx5_eswitch_add_send_to_vport_rule(struct mlx5_eswitch *on_esw,
        dest.vport.flags |= MLX5_FLOW_DEST_VPORT_VHCA_ID;
        flow_act.action = MLX5_FLOW_CONTEXT_ACTION_FWD_DEST;
 
+       if (rep->vport == MLX5_VPORT_UPLINK)
+               spec->flow_context.flow_source = MLX5_FLOW_CONTEXT_FLOW_SOURCE_LOCAL_VPORT;
+
        flow_rule = mlx5_add_flow_rules(on_esw->fdb_table.offloads.slow_fdb,
                                        spec, &flow_act, &dest, 1);
        if (IS_ERR(flow_rule))
@@ -1614,7 +1618,18 @@ static int esw_create_offloads_fdb_tables(struct mlx5_eswitch *esw)
                goto ns_err;
        }
 
-       table_size = esw->total_vports * MAX_SQ_NVPORTS + MAX_PF_SQ +
+       /* To be strictly correct:
+        *      MLX5_MAX_PORTS * (esw->total_vports * MAX_SQ_NVPORTS + MAX_PF_SQ)
+        * should be:
+        *      esw->total_vports * MAX_SQ_NVPORTS + MAX_PF_SQ +
+        *      peer_esw->total_vports * MAX_SQ_NVPORTS + MAX_PF_SQ
+        * but as the peer device might not be in switchdev mode it's not
+        * possible. We use the fact that by default FW sets max vfs and max sfs
+        * to the same value on both devices. If it needs to be changed in the future note
+        * the peer miss group should also be created based on the number of
+        * total vports of the peer (currently is also uses esw->total_vports).
+        */
+       table_size = MLX5_MAX_PORTS * (esw->total_vports * MAX_SQ_NVPORTS + MAX_PF_SQ) +
                MLX5_ESW_MISS_FLOWS + esw->total_vports + esw->esw_funcs.num_vfs;
 
        /* create the slow path fdb with encap set, so further table instances
@@ -1671,7 +1686,8 @@ static int esw_create_offloads_fdb_tables(struct mlx5_eswitch *esw)
                         source_eswitch_owner_vhca_id_valid, 1);
        }
 
-       ix = esw->total_vports * MAX_SQ_NVPORTS + MAX_PF_SQ;
+       /* See comment above table_size calculation */
+       ix = MLX5_MAX_PORTS * (esw->total_vports * MAX_SQ_NVPORTS + MAX_PF_SQ);
        MLX5_SET(create_flow_group_in, flow_group_in, start_flow_index, 0);
        MLX5_SET(create_flow_group_in, flow_group_in, end_flow_index, ix - 1);
 
@@ -2311,14 +2327,293 @@ void esw_offloads_unload_rep(struct mlx5_eswitch *esw, u16 vport_num)
                mlx5_esw_offloads_devlink_port_unregister(esw, vport_num);
 }
 
+static int esw_set_uplink_slave_ingress_root(struct mlx5_core_dev *master,
+                                            struct mlx5_core_dev *slave)
+{
+       u32 in[MLX5_ST_SZ_DW(set_flow_table_root_in)]   = {};
+       u32 out[MLX5_ST_SZ_DW(set_flow_table_root_out)] = {};
+       struct mlx5_eswitch *esw;
+       struct mlx5_flow_root_namespace *root;
+       struct mlx5_flow_namespace *ns;
+       struct mlx5_vport *vport;
+       int err;
+
+       MLX5_SET(set_flow_table_root_in, in, opcode,
+                MLX5_CMD_OP_SET_FLOW_TABLE_ROOT);
+       MLX5_SET(set_flow_table_root_in, in, table_type, FS_FT_ESW_INGRESS_ACL);
+       MLX5_SET(set_flow_table_root_in, in, other_vport, 1);
+       MLX5_SET(set_flow_table_root_in, in, vport_number, MLX5_VPORT_UPLINK);
+
+       if (master) {
+               esw = master->priv.eswitch;
+               vport = mlx5_eswitch_get_vport(esw, MLX5_VPORT_UPLINK);
+               MLX5_SET(set_flow_table_root_in, in, table_of_other_vport, 1);
+               MLX5_SET(set_flow_table_root_in, in, table_vport_number,
+                        MLX5_VPORT_UPLINK);
+
+               ns = mlx5_get_flow_vport_acl_namespace(master,
+                                                      MLX5_FLOW_NAMESPACE_ESW_INGRESS,
+                                                      vport->index);
+               root = find_root(&ns->node);
+               mutex_lock(&root->chain_lock);
+
+               MLX5_SET(set_flow_table_root_in, in,
+                        table_eswitch_owner_vhca_id_valid, 1);
+               MLX5_SET(set_flow_table_root_in, in,
+                        table_eswitch_owner_vhca_id,
+                        MLX5_CAP_GEN(master, vhca_id));
+               MLX5_SET(set_flow_table_root_in, in, table_id,
+                        root->root_ft->id);
+       } else {
+               esw = slave->priv.eswitch;
+               vport = mlx5_eswitch_get_vport(esw, MLX5_VPORT_UPLINK);
+               ns = mlx5_get_flow_vport_acl_namespace(slave,
+                                                      MLX5_FLOW_NAMESPACE_ESW_INGRESS,
+                                                      vport->index);
+               root = find_root(&ns->node);
+               mutex_lock(&root->chain_lock);
+               MLX5_SET(set_flow_table_root_in, in, table_id, root->root_ft->id);
+       }
+
+       err = mlx5_cmd_exec(slave, in, sizeof(in), out, sizeof(out));
+       mutex_unlock(&root->chain_lock);
+
+       return err;
+}
+
+static int esw_set_slave_root_fdb(struct mlx5_core_dev *master,
+                                 struct mlx5_core_dev *slave)
+{
+       u32 in[MLX5_ST_SZ_DW(set_flow_table_root_in)]   = {};
+       u32 out[MLX5_ST_SZ_DW(set_flow_table_root_out)] = {};
+       struct mlx5_flow_root_namespace *root;
+       struct mlx5_flow_namespace *ns;
+       int err;
+
+       MLX5_SET(set_flow_table_root_in, in, opcode,
+                MLX5_CMD_OP_SET_FLOW_TABLE_ROOT);
+       MLX5_SET(set_flow_table_root_in, in, table_type,
+                FS_FT_FDB);
+
+       if (master) {
+               ns = mlx5_get_flow_namespace(master,
+                                            MLX5_FLOW_NAMESPACE_FDB);
+               root = find_root(&ns->node);
+               mutex_lock(&root->chain_lock);
+               MLX5_SET(set_flow_table_root_in, in,
+                        table_eswitch_owner_vhca_id_valid, 1);
+               MLX5_SET(set_flow_table_root_in, in,
+                        table_eswitch_owner_vhca_id,
+                        MLX5_CAP_GEN(master, vhca_id));
+               MLX5_SET(set_flow_table_root_in, in, table_id,
+                        root->root_ft->id);
+       } else {
+               ns = mlx5_get_flow_namespace(slave,
+                                            MLX5_FLOW_NAMESPACE_FDB);
+               root = find_root(&ns->node);
+               mutex_lock(&root->chain_lock);
+               MLX5_SET(set_flow_table_root_in, in, table_id,
+                        root->root_ft->id);
+       }
+
+       err = mlx5_cmd_exec(slave, in, sizeof(in), out, sizeof(out));
+       mutex_unlock(&root->chain_lock);
+
+       return err;
+}
+
+static int __esw_set_master_egress_rule(struct mlx5_core_dev *master,
+                                       struct mlx5_core_dev *slave,
+                                       struct mlx5_vport *vport,
+                                       struct mlx5_flow_table *acl)
+{
+       struct mlx5_flow_handle *flow_rule = NULL;
+       struct mlx5_flow_destination dest = {};
+       struct mlx5_flow_act flow_act = {};
+       struct mlx5_flow_spec *spec;
+       int err = 0;
+       void *misc;
+
+       spec = kvzalloc(sizeof(*spec), GFP_KERNEL);
+       if (!spec)
+               return -ENOMEM;
+
+       spec->match_criteria_enable = MLX5_MATCH_MISC_PARAMETERS;
+       misc = MLX5_ADDR_OF(fte_match_param, spec->match_value,
+                           misc_parameters);
+       MLX5_SET(fte_match_set_misc, misc, source_port, MLX5_VPORT_UPLINK);
+       MLX5_SET(fte_match_set_misc, misc, source_eswitch_owner_vhca_id,
+                MLX5_CAP_GEN(slave, vhca_id));
+
+       misc = MLX5_ADDR_OF(fte_match_param, spec->match_criteria, misc_parameters);
+       MLX5_SET_TO_ONES(fte_match_set_misc, misc, source_port);
+       MLX5_SET_TO_ONES(fte_match_set_misc, misc,
+                        source_eswitch_owner_vhca_id);
+
+       flow_act.action = MLX5_FLOW_CONTEXT_ACTION_FWD_DEST;
+       dest.type = MLX5_FLOW_DESTINATION_TYPE_VPORT;
+       dest.vport.num = slave->priv.eswitch->manager_vport;
+       dest.vport.vhca_id = MLX5_CAP_GEN(slave, vhca_id);
+       dest.vport.flags |= MLX5_FLOW_DEST_VPORT_VHCA_ID;
+
+       flow_rule = mlx5_add_flow_rules(acl, spec, &flow_act,
+                                       &dest, 1);
+       if (IS_ERR(flow_rule))
+               err = PTR_ERR(flow_rule);
+       else
+               vport->egress.offloads.bounce_rule = flow_rule;
+
+       kvfree(spec);
+       return err;
+}
+
+static int esw_set_master_egress_rule(struct mlx5_core_dev *master,
+                                     struct mlx5_core_dev *slave)
+{
+       int inlen = MLX5_ST_SZ_BYTES(create_flow_group_in);
+       struct mlx5_eswitch *esw = master->priv.eswitch;
+       struct mlx5_flow_table_attr ft_attr = {
+               .max_fte = 1, .prio = 0, .level = 0,
+       };
+       struct mlx5_flow_namespace *egress_ns;
+       struct mlx5_flow_table *acl;
+       struct mlx5_flow_group *g;
+       struct mlx5_vport *vport;
+       void *match_criteria;
+       u32 *flow_group_in;
+       int err;
+
+       vport = mlx5_eswitch_get_vport(esw, esw->manager_vport);
+       if (IS_ERR(vport))
+               return PTR_ERR(vport);
+
+       egress_ns = mlx5_get_flow_vport_acl_namespace(master,
+                                                     MLX5_FLOW_NAMESPACE_ESW_EGRESS,
+                                                     vport->index);
+       if (!egress_ns)
+               return -EINVAL;
+
+       if (vport->egress.acl)
+               return -EINVAL;
+
+       flow_group_in = kvzalloc(inlen, GFP_KERNEL);
+       if (!flow_group_in)
+               return -ENOMEM;
+
+       acl = mlx5_create_vport_flow_table(egress_ns, &ft_attr, vport->vport);
+       if (IS_ERR(acl)) {
+               err = PTR_ERR(acl);
+               goto out;
+       }
+
+       match_criteria = MLX5_ADDR_OF(create_flow_group_in, flow_group_in,
+                                     match_criteria);
+       MLX5_SET_TO_ONES(fte_match_param, match_criteria,
+                        misc_parameters.source_port);
+       MLX5_SET_TO_ONES(fte_match_param, match_criteria,
+                        misc_parameters.source_eswitch_owner_vhca_id);
+       MLX5_SET(create_flow_group_in, flow_group_in, match_criteria_enable,
+                MLX5_MATCH_MISC_PARAMETERS);
+
+       MLX5_SET(create_flow_group_in, flow_group_in,
+                source_eswitch_owner_vhca_id_valid, 1);
+       MLX5_SET(create_flow_group_in, flow_group_in, start_flow_index, 0);
+       MLX5_SET(create_flow_group_in, flow_group_in, end_flow_index, 0);
+
+       g = mlx5_create_flow_group(acl, flow_group_in);
+       if (IS_ERR(g)) {
+               err = PTR_ERR(g);
+               goto err_group;
+       }
+
+       err = __esw_set_master_egress_rule(master, slave, vport, acl);
+       if (err)
+               goto err_rule;
+
+       vport->egress.acl = acl;
+       vport->egress.offloads.bounce_grp = g;
+
+       kvfree(flow_group_in);
+
+       return 0;
+
+err_rule:
+       mlx5_destroy_flow_group(g);
+err_group:
+       mlx5_destroy_flow_table(acl);
+out:
+       kvfree(flow_group_in);
+       return err;
+}
+
+static void esw_unset_master_egress_rule(struct mlx5_core_dev *dev)
+{
+       struct mlx5_vport *vport;
+
+       vport = mlx5_eswitch_get_vport(dev->priv.eswitch,
+                                      dev->priv.eswitch->manager_vport);
+
+       esw_acl_egress_ofld_cleanup(vport);
+}
+
+int mlx5_eswitch_offloads_config_single_fdb(struct mlx5_eswitch *master_esw,
+                                           struct mlx5_eswitch *slave_esw)
+{
+       int err;
+
+       err = esw_set_uplink_slave_ingress_root(master_esw->dev,
+                                               slave_esw->dev);
+       if (err)
+               return -EINVAL;
+
+       err = esw_set_slave_root_fdb(master_esw->dev,
+                                    slave_esw->dev);
+       if (err)
+               goto err_fdb;
+
+       err = esw_set_master_egress_rule(master_esw->dev,
+                                        slave_esw->dev);
+       if (err)
+               goto err_acl;
+
+       return err;
+
+err_acl:
+       esw_set_slave_root_fdb(NULL, slave_esw->dev);
+
+err_fdb:
+       esw_set_uplink_slave_ingress_root(NULL, slave_esw->dev);
+
+       return err;
+}
+
+void mlx5_eswitch_offloads_destroy_single_fdb(struct mlx5_eswitch *master_esw,
+                                             struct mlx5_eswitch *slave_esw)
+{
+       esw_unset_master_egress_rule(master_esw->dev);
+       esw_set_slave_root_fdb(NULL, slave_esw->dev);
+       esw_set_uplink_slave_ingress_root(NULL, slave_esw->dev);
+}
+
 #define ESW_OFFLOADS_DEVCOM_PAIR       (0)
 #define ESW_OFFLOADS_DEVCOM_UNPAIR     (1)
 
-static int mlx5_esw_offloads_pair(struct mlx5_eswitch *esw,
-                                 struct mlx5_eswitch *peer_esw)
+static void mlx5_esw_offloads_rep_event_unpair(struct mlx5_eswitch *esw)
 {
+       const struct mlx5_eswitch_rep_ops *ops;
+       struct mlx5_eswitch_rep *rep;
+       unsigned long i;
+       u8 rep_type;
 
-       return esw_add_fdb_peer_miss_rules(esw, peer_esw->dev);
+       mlx5_esw_for_each_rep(esw, i, rep) {
+               rep_type = NUM_REP_TYPES;
+               while (rep_type--) {
+                       ops = esw->offloads.rep_ops[rep_type];
+                       if (atomic_read(&rep->rep_data[rep_type].state) == REP_LOADED &&
+                           ops->event)
+                               ops->event(esw, rep, MLX5_SWITCHDEV_EVENT_UNPAIR, NULL);
+               }
+       }
 }
 
 static void mlx5_esw_offloads_unpair(struct mlx5_eswitch *esw)
@@ -2326,9 +2621,42 @@ static void mlx5_esw_offloads_unpair(struct mlx5_eswitch *esw)
 #if IS_ENABLED(CONFIG_MLX5_CLS_ACT)
        mlx5e_tc_clean_fdb_peer_flows(esw);
 #endif
+       mlx5_esw_offloads_rep_event_unpair(esw);
        esw_del_fdb_peer_miss_rules(esw);
 }
 
+static int mlx5_esw_offloads_pair(struct mlx5_eswitch *esw,
+                                 struct mlx5_eswitch *peer_esw)
+{
+       const struct mlx5_eswitch_rep_ops *ops;
+       struct mlx5_eswitch_rep *rep;
+       unsigned long i;
+       u8 rep_type;
+       int err;
+
+       err = esw_add_fdb_peer_miss_rules(esw, peer_esw->dev);
+       if (err)
+               return err;
+
+       mlx5_esw_for_each_rep(esw, i, rep) {
+               for (rep_type = 0; rep_type < NUM_REP_TYPES; rep_type++) {
+                       ops = esw->offloads.rep_ops[rep_type];
+                       if (atomic_read(&rep->rep_data[rep_type].state) == REP_LOADED &&
+                           ops->event) {
+                               err = ops->event(esw, rep, MLX5_SWITCHDEV_EVENT_PAIR, peer_esw);
+                               if (err)
+                                       goto err_out;
+                       }
+               }
+       }
+
+       return 0;
+
+err_out:
+       mlx5_esw_offloads_unpair(esw);
+       return err;
+}
+
 static int mlx5_esw_offloads_set_ns_peer(struct mlx5_eswitch *esw,
                                         struct mlx5_eswitch *peer_esw,
                                         bool pair)
@@ -2619,6 +2947,31 @@ static void esw_destroy_uplink_offloads_acl_tables(struct mlx5_eswitch *esw)
        esw_vport_destroy_offloads_acl_tables(esw, vport);
 }
 
+int mlx5_eswitch_reload_reps(struct mlx5_eswitch *esw)
+{
+       struct mlx5_eswitch_rep *rep;
+       unsigned long i;
+       int ret;
+
+       if (!esw || esw->mode != MLX5_ESWITCH_OFFLOADS)
+               return 0;
+
+       rep = mlx5_eswitch_get_rep(esw, MLX5_VPORT_UPLINK);
+       if (atomic_read(&rep->rep_data[REP_ETH].state) != REP_LOADED)
+               return 0;
+
+       ret = mlx5_esw_offloads_rep_load(esw, MLX5_VPORT_UPLINK);
+       if (ret)
+               return ret;
+
+       mlx5_esw_for_each_rep(esw, i, rep) {
+               if (atomic_read(&rep->rep_data[REP_ETH].state) == REP_LOADED)
+                       mlx5_esw_offloads_rep_load(esw, rep->vport);
+       }
+
+       return 0;
+}
+
 static int esw_offloads_steering_init(struct mlx5_eswitch *esw)
 {
        struct mlx5_esw_indir_table *indir;
@@ -2788,6 +3141,7 @@ int esw_offloads_enable(struct mlx5_eswitch *esw)
        struct mapping_ctx *reg_c0_obj_pool;
        struct mlx5_vport *vport;
        unsigned long i;
+       u64 mapping_id;
        int err;
 
        if (MLX5_CAP_ESW_FLOWTABLE_FDB(esw->dev, reformat) &&
@@ -2811,9 +3165,13 @@ int esw_offloads_enable(struct mlx5_eswitch *esw)
        if (err)
                goto err_vport_metadata;
 
-       reg_c0_obj_pool = mapping_create(sizeof(struct mlx5_mapped_obj),
-                                        ESW_REG_C0_USER_DATA_METADATA_MASK,
-                                        true);
+       mapping_id = mlx5_query_nic_system_image_guid(esw->dev);
+
+       reg_c0_obj_pool = mapping_create_for_id(mapping_id, MAPPING_TYPE_CHAIN,
+                                               sizeof(struct mlx5_mapped_obj),
+                                               ESW_REG_C0_USER_DATA_METADATA_MASK,
+                                               true);
+
        if (IS_ERR(reg_c0_obj_pool)) {
                err = PTR_ERR(reg_c0_obj_pool);
                goto err_pool;
@@ -2991,10 +3349,11 @@ int mlx5_devlink_eswitch_mode_set(struct devlink *devlink, u16 mode,
        if (esw_mode_from_devlink(mode, &mlx5_mode))
                return -EINVAL;
 
+       mlx5_lag_disable_change(esw->dev);
        err = mlx5_esw_try_lock(esw);
        if (err < 0) {
                NL_SET_ERR_MSG_MOD(extack, "Can't change mode, E-Switch is busy");
-               return err;
+               goto enable_lag;
        }
        cur_mlx5_mode = err;
        err = 0;
@@ -3018,6 +3377,8 @@ int mlx5_devlink_eswitch_mode_set(struct devlink *devlink, u16 mode,
 
 unlock:
        mlx5_esw_unlock(esw);
+enable_lag:
+       mlx5_lag_enable_change(esw->dev);
        return err;
 }
 
index d5da4ab65766da03d8d2eb894fa177e4cf3ca247..306279b7f9e7045197dd06134616add6d0e88609 100644 (file)
@@ -453,7 +453,7 @@ static int mlx5_fpga_conn_create_cq(struct mlx5_fpga_conn *conn, int cq_size)
 
        cqc = MLX5_ADDR_OF(create_cq_in, in, cq_context);
        MLX5_SET(cqc, cqc, log_cq_size, ilog2(cq_size));
-       MLX5_SET(cqc, cqc, c_eqn, eqn);
+       MLX5_SET(cqc, cqc, c_eqn_or_apu_element, eqn);
        MLX5_SET(cqc, cqc, uar_page, fdev->conn_res.uar->index);
        MLX5_SET(cqc, cqc, log_page_size, conn->cq.wq_ctrl.buf.page_shift -
                           MLX5_ADAPTER_PAGE_SHIFT);
index 896a6c3dbdb794cf7bbd626fc3559669817a4905..7db8df64a60e24e9124b9a9c49ba15d3d810815b 100644 (file)
@@ -152,17 +152,56 @@ static int mlx5_cmd_stub_destroy_ns(struct mlx5_flow_root_namespace *ns)
        return 0;
 }
 
+static int mlx5_cmd_set_slave_root_fdb(struct mlx5_core_dev *master,
+                                      struct mlx5_core_dev *slave,
+                                      bool ft_id_valid,
+                                      u32 ft_id)
+{
+       u32 out[MLX5_ST_SZ_DW(set_flow_table_root_out)] = {};
+       u32 in[MLX5_ST_SZ_DW(set_flow_table_root_in)] = {};
+       struct mlx5_flow_root_namespace *root;
+       struct mlx5_flow_namespace *ns;
+
+       MLX5_SET(set_flow_table_root_in, in, opcode,
+                MLX5_CMD_OP_SET_FLOW_TABLE_ROOT);
+       MLX5_SET(set_flow_table_root_in, in, table_type,
+                FS_FT_FDB);
+       if (ft_id_valid) {
+               MLX5_SET(set_flow_table_root_in, in,
+                        table_eswitch_owner_vhca_id_valid, 1);
+               MLX5_SET(set_flow_table_root_in, in,
+                        table_eswitch_owner_vhca_id,
+                        MLX5_CAP_GEN(master, vhca_id));
+               MLX5_SET(set_flow_table_root_in, in, table_id,
+                        ft_id);
+       } else {
+               ns = mlx5_get_flow_namespace(slave,
+                                            MLX5_FLOW_NAMESPACE_FDB);
+               root = find_root(&ns->node);
+               MLX5_SET(set_flow_table_root_in, in, table_id,
+                        root->root_ft->id);
+       }
+
+       return mlx5_cmd_exec(slave, in, sizeof(in), out, sizeof(out));
+}
+
 static int mlx5_cmd_update_root_ft(struct mlx5_flow_root_namespace *ns,
                                   struct mlx5_flow_table *ft, u32 underlay_qpn,
                                   bool disconnect)
 {
        u32 in[MLX5_ST_SZ_DW(set_flow_table_root_in)] = {};
        struct mlx5_core_dev *dev = ns->dev;
+       int err;
 
        if ((MLX5_CAP_GEN(dev, port_type) == MLX5_CAP_PORT_TYPE_IB) &&
            underlay_qpn == 0)
                return 0;
 
+       if (ft->type == FS_FT_FDB &&
+           mlx5_lag_is_shared_fdb(dev) &&
+           !mlx5_lag_is_master(dev))
+               return 0;
+
        MLX5_SET(set_flow_table_root_in, in, opcode,
                 MLX5_CMD_OP_SET_FLOW_TABLE_ROOT);
        MLX5_SET(set_flow_table_root_in, in, table_type, ft->type);
@@ -177,7 +216,24 @@ static int mlx5_cmd_update_root_ft(struct mlx5_flow_root_namespace *ns,
        MLX5_SET(set_flow_table_root_in, in, other_vport,
                 !!(ft->flags & MLX5_FLOW_TABLE_OTHER_VPORT));
 
-       return mlx5_cmd_exec_in(dev, set_flow_table_root, in);
+       err = mlx5_cmd_exec_in(dev, set_flow_table_root, in);
+       if (!err &&
+           ft->type == FS_FT_FDB &&
+           mlx5_lag_is_shared_fdb(dev) &&
+           mlx5_lag_is_master(dev)) {
+               err = mlx5_cmd_set_slave_root_fdb(dev,
+                                                 mlx5_lag_get_peer_mdev(dev),
+                                                 !disconnect, (!disconnect) ?
+                                                 ft->id : 0);
+               if (err && !disconnect) {
+                       MLX5_SET(set_flow_table_root_in, in, op_mod, 0);
+                       MLX5_SET(set_flow_table_root_in, in, table_id,
+                                ns->root_ft->id);
+                       mlx5_cmd_exec_in(dev, set_flow_table_root, in);
+               }
+       }
+
+       return err;
 }
 
 static int mlx5_cmd_create_flow_table(struct mlx5_flow_root_namespace *ns,
index c0697e1b71185ab61bf4f7ae84b1a26e7d0cf888..8481027e493cb31481b60087619beeb97619318a 100644 (file)
@@ -413,7 +413,7 @@ static bool check_valid_spec(const struct mlx5_flow_spec *spec)
        return true;
 }
 
-static struct mlx5_flow_root_namespace *find_root(struct fs_node *node)
+struct mlx5_flow_root_namespace *find_root(struct fs_node *node)
 {
        struct fs_node *root;
        struct mlx5_flow_namespace *ns;
index 7317cdeab661694abbd18192b0476a458e486a22..98240badc342cfe1ea87e30210ef762e1473a7d6 100644 (file)
@@ -294,6 +294,8 @@ void mlx5_fs_egress_acls_cleanup(struct mlx5_core_dev *dev);
 int mlx5_fs_ingress_acls_init(struct mlx5_core_dev *dev, int total_vports);
 void mlx5_fs_ingress_acls_cleanup(struct mlx5_core_dev *dev);
 
+struct mlx5_flow_root_namespace *find_root(struct fs_node *node);
+
 #define fs_get_obj(v, _node)  {v = container_of((_node), typeof(*v), node); }
 
 #define fs_list_for_each_entry(pos, root)              \
index 5c043c5cc40354bedf1d33bff436e9c1fd017812..f4dfa55c8c7e4c0c4af1762445cb8815d91726a5 100644 (file)
@@ -32,7 +32,9 @@
 
 #include <linux/netdevice.h>
 #include <linux/mlx5/driver.h>
+#include <linux/mlx5/eswitch.h>
 #include <linux/mlx5/vport.h>
+#include "lib/devcom.h"
 #include "mlx5_core.h"
 #include "eswitch.h"
 #include "lag.h"
@@ -45,7 +47,7 @@
 static DEFINE_SPINLOCK(lag_lock);
 
 static int mlx5_cmd_create_lag(struct mlx5_core_dev *dev, u8 remap_port1,
-                              u8 remap_port2)
+                              u8 remap_port2, bool shared_fdb)
 {
        u32 in[MLX5_ST_SZ_DW(create_lag_in)] = {};
        void *lag_ctx = MLX5_ADDR_OF(create_lag_in, in, ctx);
@@ -54,6 +56,7 @@ static int mlx5_cmd_create_lag(struct mlx5_core_dev *dev, u8 remap_port1,
 
        MLX5_SET(lagc, lag_ctx, tx_remap_affinity_1, remap_port1);
        MLX5_SET(lagc, lag_ctx, tx_remap_affinity_2, remap_port2);
+       MLX5_SET(lagc, lag_ctx, fdb_selection_mode, shared_fdb);
 
        return mlx5_cmd_exec_in(dev, create_lag, in);
 }
@@ -224,35 +227,59 @@ void mlx5_modify_lag(struct mlx5_lag *ldev,
 }
 
 static int mlx5_create_lag(struct mlx5_lag *ldev,
-                          struct lag_tracker *tracker)
+                          struct lag_tracker *tracker,
+                          bool shared_fdb)
 {
        struct mlx5_core_dev *dev0 = ldev->pf[MLX5_LAG_P1].dev;
+       struct mlx5_core_dev *dev1 = ldev->pf[MLX5_LAG_P2].dev;
+       u32 in[MLX5_ST_SZ_DW(destroy_lag_in)] = {};
        int err;
 
        mlx5_infer_tx_affinity_mapping(tracker, &ldev->v2p_map[MLX5_LAG_P1],
                                       &ldev->v2p_map[MLX5_LAG_P2]);
 
-       mlx5_core_info(dev0, "lag map port 1:%d port 2:%d",
-                      ldev->v2p_map[MLX5_LAG_P1], ldev->v2p_map[MLX5_LAG_P2]);
+       mlx5_core_info(dev0, "lag map port 1:%d port 2:%d shared_fdb:%d",
+                      ldev->v2p_map[MLX5_LAG_P1], ldev->v2p_map[MLX5_LAG_P2],
+                      shared_fdb);
 
        err = mlx5_cmd_create_lag(dev0, ldev->v2p_map[MLX5_LAG_P1],
-                                 ldev->v2p_map[MLX5_LAG_P2]);
-       if (err)
+                                 ldev->v2p_map[MLX5_LAG_P2], shared_fdb);
+       if (err) {
                mlx5_core_err(dev0,
                              "Failed to create LAG (%d)\n",
                              err);
+               return err;
+       }
+
+       if (shared_fdb) {
+               err = mlx5_eswitch_offloads_config_single_fdb(dev0->priv.eswitch,
+                                                             dev1->priv.eswitch);
+               if (err)
+                       mlx5_core_err(dev0, "Can't enable single FDB mode\n");
+               else
+                       mlx5_core_info(dev0, "Operation mode is single FDB\n");
+       }
+
+       if (err) {
+               MLX5_SET(destroy_lag_in, in, opcode, MLX5_CMD_OP_DESTROY_LAG);
+               if (mlx5_cmd_exec_in(dev0, destroy_lag, in))
+                       mlx5_core_err(dev0,
+                                     "Failed to deactivate RoCE LAG; driver restart required\n");
+       }
+
        return err;
 }
 
 int mlx5_activate_lag(struct mlx5_lag *ldev,
                      struct lag_tracker *tracker,
-                     u8 flags)
+                     u8 flags,
+                     bool shared_fdb)
 {
        bool roce_lag = !!(flags & MLX5_LAG_FLAG_ROCE);
        struct mlx5_core_dev *dev0 = ldev->pf[MLX5_LAG_P1].dev;
        int err;
 
-       err = mlx5_create_lag(ldev, tracker);
+       err = mlx5_create_lag(ldev, tracker, shared_fdb);
        if (err) {
                if (roce_lag) {
                        mlx5_core_err(dev0,
@@ -266,6 +293,7 @@ int mlx5_activate_lag(struct mlx5_lag *ldev,
        }
 
        ldev->flags |= flags;
+       ldev->shared_fdb = shared_fdb;
        return 0;
 }
 
@@ -278,6 +306,12 @@ static int mlx5_deactivate_lag(struct mlx5_lag *ldev)
 
        ldev->flags &= ~MLX5_LAG_MODE_FLAGS;
 
+       if (ldev->shared_fdb) {
+               mlx5_eswitch_offloads_destroy_single_fdb(ldev->pf[MLX5_LAG_P1].dev->priv.eswitch,
+                                                        ldev->pf[MLX5_LAG_P2].dev->priv.eswitch);
+               ldev->shared_fdb = false;
+       }
+
        MLX5_SET(destroy_lag_in, in, opcode, MLX5_CMD_OP_DESTROY_LAG);
        err = mlx5_cmd_exec_in(dev0, destroy_lag, in);
        if (err) {
@@ -333,6 +367,10 @@ static void mlx5_lag_remove_devices(struct mlx5_lag *ldev)
                if (!ldev->pf[i].dev)
                        continue;
 
+               if (ldev->pf[i].dev->priv.flags &
+                   MLX5_PRIV_FLAGS_DISABLE_ALL_ADEV)
+                       continue;
+
                ldev->pf[i].dev->priv.flags |= MLX5_PRIV_FLAGS_DISABLE_IB_ADEV;
                mlx5_rescan_drivers_locked(ldev->pf[i].dev);
        }
@@ -342,12 +380,15 @@ static void mlx5_disable_lag(struct mlx5_lag *ldev)
 {
        struct mlx5_core_dev *dev0 = ldev->pf[MLX5_LAG_P1].dev;
        struct mlx5_core_dev *dev1 = ldev->pf[MLX5_LAG_P2].dev;
+       bool shared_fdb = ldev->shared_fdb;
        bool roce_lag;
        int err;
 
        roce_lag = __mlx5_lag_is_roce(ldev);
 
-       if (roce_lag) {
+       if (shared_fdb) {
+               mlx5_lag_remove_devices(ldev);
+       } else if (roce_lag) {
                if (!(dev0->priv.flags & MLX5_PRIV_FLAGS_DISABLE_ALL_ADEV)) {
                        dev0->priv.flags |= MLX5_PRIV_FLAGS_DISABLE_IB_ADEV;
                        mlx5_rescan_drivers_locked(dev0);
@@ -359,8 +400,34 @@ static void mlx5_disable_lag(struct mlx5_lag *ldev)
        if (err)
                return;
 
-       if (roce_lag)
+       if (shared_fdb || roce_lag)
                mlx5_lag_add_devices(ldev);
+
+       if (shared_fdb) {
+               if (!(dev0->priv.flags & MLX5_PRIV_FLAGS_DISABLE_ALL_ADEV))
+                       mlx5_eswitch_reload_reps(dev0->priv.eswitch);
+               if (!(dev1->priv.flags & MLX5_PRIV_FLAGS_DISABLE_ALL_ADEV))
+                       mlx5_eswitch_reload_reps(dev1->priv.eswitch);
+       }
+}
+
+static bool mlx5_shared_fdb_supported(struct mlx5_lag *ldev)
+{
+       struct mlx5_core_dev *dev0 = ldev->pf[MLX5_LAG_P1].dev;
+       struct mlx5_core_dev *dev1 = ldev->pf[MLX5_LAG_P2].dev;
+
+       if (is_mdev_switchdev_mode(dev0) &&
+           is_mdev_switchdev_mode(dev1) &&
+           mlx5_eswitch_vport_match_metadata_enabled(dev0->priv.eswitch) &&
+           mlx5_eswitch_vport_match_metadata_enabled(dev1->priv.eswitch) &&
+           mlx5_devcom_is_paired(dev0->priv.devcom,
+                                 MLX5_DEVCOM_ESW_OFFLOADS) &&
+           MLX5_CAP_GEN(dev1, lag_native_fdb_selection) &&
+           MLX5_CAP_ESW(dev1, root_ft_on_other_esw) &&
+           MLX5_CAP_ESW(dev0, esw_shared_ingress_acl))
+               return true;
+
+       return false;
 }
 
 static void mlx5_do_bond(struct mlx5_lag *ldev)
@@ -371,14 +438,17 @@ static void mlx5_do_bond(struct mlx5_lag *ldev)
        bool do_bond, roce_lag;
        int err;
 
-       if (!mlx5_lag_is_ready(ldev))
-               return;
-
-       tracker = ldev->tracker;
+       if (!mlx5_lag_is_ready(ldev)) {
+               do_bond = false;
+       } else {
+               tracker = ldev->tracker;
 
-       do_bond = tracker.is_bonded && mlx5_lag_check_prereq(ldev);
+               do_bond = tracker.is_bonded && mlx5_lag_check_prereq(ldev);
+       }
 
        if (do_bond && !__mlx5_lag_is_active(ldev)) {
+               bool shared_fdb = mlx5_shared_fdb_supported(ldev);
+
                roce_lag = !mlx5_sriov_is_enabled(dev0) &&
                           !mlx5_sriov_is_enabled(dev1);
 
@@ -388,23 +458,40 @@ static void mlx5_do_bond(struct mlx5_lag *ldev)
                           dev1->priv.eswitch->mode == MLX5_ESWITCH_NONE;
 #endif
 
-               if (roce_lag)
+               if (shared_fdb || roce_lag)
                        mlx5_lag_remove_devices(ldev);
 
                err = mlx5_activate_lag(ldev, &tracker,
                                        roce_lag ? MLX5_LAG_FLAG_ROCE :
-                                       MLX5_LAG_FLAG_SRIOV);
+                                                  MLX5_LAG_FLAG_SRIOV,
+                                       shared_fdb);
                if (err) {
-                       if (roce_lag)
+                       if (shared_fdb || roce_lag)
                                mlx5_lag_add_devices(ldev);
 
                        return;
-               }
-
-               if (roce_lag) {
+               } else if (roce_lag) {
                        dev0->priv.flags &= ~MLX5_PRIV_FLAGS_DISABLE_IB_ADEV;
                        mlx5_rescan_drivers_locked(dev0);
                        mlx5_nic_vport_enable_roce(dev1);
+               } else if (shared_fdb) {
+                       dev0->priv.flags &= ~MLX5_PRIV_FLAGS_DISABLE_IB_ADEV;
+                       mlx5_rescan_drivers_locked(dev0);
+
+                       err = mlx5_eswitch_reload_reps(dev0->priv.eswitch);
+                       if (!err)
+                               err = mlx5_eswitch_reload_reps(dev1->priv.eswitch);
+
+                       if (err) {
+                               dev0->priv.flags |= MLX5_PRIV_FLAGS_DISABLE_IB_ADEV;
+                               mlx5_rescan_drivers_locked(dev0);
+                               mlx5_deactivate_lag(ldev);
+                               mlx5_lag_add_devices(ldev);
+                               mlx5_eswitch_reload_reps(dev0->priv.eswitch);
+                               mlx5_eswitch_reload_reps(dev1->priv.eswitch);
+                               mlx5_core_err(dev0, "Failed to enable lag\n");
+                               return;
+                       }
                }
        } else if (do_bond && __mlx5_lag_is_active(ldev)) {
                mlx5_modify_lag(ldev, &tracker);
@@ -418,21 +505,48 @@ static void mlx5_queue_bond_work(struct mlx5_lag *ldev, unsigned long delay)
        queue_delayed_work(ldev->wq, &ldev->bond_work, delay);
 }
 
+static void mlx5_lag_lock_eswitches(struct mlx5_core_dev *dev0,
+                                   struct mlx5_core_dev *dev1)
+{
+       if (dev0)
+               mlx5_esw_lock(dev0->priv.eswitch);
+       if (dev1)
+               mlx5_esw_lock(dev1->priv.eswitch);
+}
+
+static void mlx5_lag_unlock_eswitches(struct mlx5_core_dev *dev0,
+                                     struct mlx5_core_dev *dev1)
+{
+       if (dev1)
+               mlx5_esw_unlock(dev1->priv.eswitch);
+       if (dev0)
+               mlx5_esw_unlock(dev0->priv.eswitch);
+}
+
 static void mlx5_do_bond_work(struct work_struct *work)
 {
        struct delayed_work *delayed_work = to_delayed_work(work);
        struct mlx5_lag *ldev = container_of(delayed_work, struct mlx5_lag,
                                             bond_work);
+       struct mlx5_core_dev *dev0 = ldev->pf[MLX5_LAG_P1].dev;
+       struct mlx5_core_dev *dev1 = ldev->pf[MLX5_LAG_P2].dev;
        int status;
 
        status = mlx5_dev_list_trylock();
        if (!status) {
-               /* 1 sec delay. */
                mlx5_queue_bond_work(ldev, HZ);
                return;
        }
 
+       if (ldev->mode_changes_in_progress) {
+               mlx5_dev_list_unlock();
+               mlx5_queue_bond_work(ldev, HZ);
+               return;
+       }
+
+       mlx5_lag_lock_eswitches(dev0, dev1);
        mlx5_do_bond(ldev);
+       mlx5_lag_unlock_eswitches(dev0, dev1);
        mlx5_dev_list_unlock();
 }
 
@@ -630,7 +744,7 @@ static void mlx5_ldev_remove_mdev(struct mlx5_lag *ldev,
 }
 
 /* Must be called with intf_mutex held */
-static void __mlx5_lag_dev_add_mdev(struct mlx5_core_dev *dev)
+static int __mlx5_lag_dev_add_mdev(struct mlx5_core_dev *dev)
 {
        struct mlx5_lag *ldev = NULL;
        struct mlx5_core_dev *tmp_dev;
@@ -638,7 +752,7 @@ static void __mlx5_lag_dev_add_mdev(struct mlx5_core_dev *dev)
        if (!MLX5_CAP_GEN(dev, vport_group_manager) ||
            !MLX5_CAP_GEN(dev, lag_master) ||
            MLX5_CAP_GEN(dev, num_lag_ports) != MLX5_MAX_PORTS)
-               return;
+               return 0;
 
        tmp_dev = mlx5_get_next_phys_dev(dev);
        if (tmp_dev)
@@ -648,15 +762,17 @@ static void __mlx5_lag_dev_add_mdev(struct mlx5_core_dev *dev)
                ldev = mlx5_lag_dev_alloc(dev);
                if (!ldev) {
                        mlx5_core_err(dev, "Failed to alloc lag dev\n");
-                       return;
+                       return 0;
                }
        } else {
+               if (ldev->mode_changes_in_progress)
+                       return -EAGAIN;
                mlx5_ldev_get(ldev);
        }
 
        mlx5_ldev_add_mdev(ldev, dev);
 
-       return;
+       return 0;
 }
 
 void mlx5_lag_remove_mdev(struct mlx5_core_dev *dev)
@@ -667,7 +783,13 @@ void mlx5_lag_remove_mdev(struct mlx5_core_dev *dev)
        if (!ldev)
                return;
 
+recheck:
        mlx5_dev_list_lock();
+       if (ldev->mode_changes_in_progress) {
+               mlx5_dev_list_unlock();
+               msleep(100);
+               goto recheck;
+       }
        mlx5_ldev_remove_mdev(ldev, dev);
        mlx5_dev_list_unlock();
        mlx5_ldev_put(ldev);
@@ -675,8 +797,16 @@ void mlx5_lag_remove_mdev(struct mlx5_core_dev *dev)
 
 void mlx5_lag_add_mdev(struct mlx5_core_dev *dev)
 {
+       int err;
+
+recheck:
        mlx5_dev_list_lock();
-       __mlx5_lag_dev_add_mdev(dev);
+       err = __mlx5_lag_dev_add_mdev(dev);
+       if (err) {
+               mlx5_dev_list_unlock();
+               msleep(100);
+               goto recheck;
+       }
        mlx5_dev_list_unlock();
 }
 
@@ -690,11 +820,11 @@ void mlx5_lag_remove_netdev(struct mlx5_core_dev *dev,
        if (!ldev)
                return;
 
-       if (__mlx5_lag_is_active(ldev))
-               mlx5_disable_lag(ldev);
-
        mlx5_ldev_remove_netdev(ldev, netdev);
        ldev->flags &= ~MLX5_LAG_FLAG_READY;
+
+       if (__mlx5_lag_is_active(ldev))
+               mlx5_queue_bond_work(ldev, 0);
 }
 
 /* Must be called with intf_mutex held */
@@ -716,6 +846,7 @@ void mlx5_lag_add_netdev(struct mlx5_core_dev *dev,
 
        if (i >= MLX5_MAX_PORTS)
                ldev->flags |= MLX5_LAG_FLAG_READY;
+       mlx5_queue_bond_work(ldev, 0);
 }
 
 bool mlx5_lag_is_roce(struct mlx5_core_dev *dev)
@@ -746,6 +877,21 @@ bool mlx5_lag_is_active(struct mlx5_core_dev *dev)
 }
 EXPORT_SYMBOL(mlx5_lag_is_active);
 
+bool mlx5_lag_is_master(struct mlx5_core_dev *dev)
+{
+       struct mlx5_lag *ldev;
+       bool res;
+
+       spin_lock(&lag_lock);
+       ldev = mlx5_lag_dev(dev);
+       res = ldev && __mlx5_lag_is_active(ldev) &&
+               dev == ldev->pf[MLX5_LAG_P1].dev;
+       spin_unlock(&lag_lock);
+
+       return res;
+}
+EXPORT_SYMBOL(mlx5_lag_is_master);
+
 bool mlx5_lag_is_sriov(struct mlx5_core_dev *dev)
 {
        struct mlx5_lag *ldev;
@@ -760,19 +906,50 @@ bool mlx5_lag_is_sriov(struct mlx5_core_dev *dev)
 }
 EXPORT_SYMBOL(mlx5_lag_is_sriov);
 
-void mlx5_lag_update(struct mlx5_core_dev *dev)
+bool mlx5_lag_is_shared_fdb(struct mlx5_core_dev *dev)
+{
+       struct mlx5_lag *ldev;
+       bool res;
+
+       spin_lock(&lag_lock);
+       ldev = mlx5_lag_dev(dev);
+       res = ldev && __mlx5_lag_is_sriov(ldev) && ldev->shared_fdb;
+       spin_unlock(&lag_lock);
+
+       return res;
+}
+EXPORT_SYMBOL(mlx5_lag_is_shared_fdb);
+
+void mlx5_lag_disable_change(struct mlx5_core_dev *dev)
 {
+       struct mlx5_core_dev *dev0;
+       struct mlx5_core_dev *dev1;
        struct mlx5_lag *ldev;
 
        mlx5_dev_list_lock();
+
        ldev = mlx5_lag_dev(dev);
-       if (!ldev)
-               goto unlock;
+       dev0 = ldev->pf[MLX5_LAG_P1].dev;
+       dev1 = ldev->pf[MLX5_LAG_P2].dev;
 
-       mlx5_do_bond(ldev);
+       ldev->mode_changes_in_progress++;
+       if (__mlx5_lag_is_active(ldev)) {
+               mlx5_lag_lock_eswitches(dev0, dev1);
+               mlx5_disable_lag(ldev);
+               mlx5_lag_unlock_eswitches(dev0, dev1);
+       }
+       mlx5_dev_list_unlock();
+}
 
-unlock:
+void mlx5_lag_enable_change(struct mlx5_core_dev *dev)
+{
+       struct mlx5_lag *ldev;
+
+       mlx5_dev_list_lock();
+       ldev = mlx5_lag_dev(dev);
+       ldev->mode_changes_in_progress--;
        mlx5_dev_list_unlock();
+       mlx5_queue_bond_work(ldev, 0);
 }
 
 struct net_device *mlx5_lag_get_roce_netdev(struct mlx5_core_dev *dev)
@@ -827,6 +1004,26 @@ unlock:
 }
 EXPORT_SYMBOL(mlx5_lag_get_slave_port);
 
+struct mlx5_core_dev *mlx5_lag_get_peer_mdev(struct mlx5_core_dev *dev)
+{
+       struct mlx5_core_dev *peer_dev = NULL;
+       struct mlx5_lag *ldev;
+
+       spin_lock(&lag_lock);
+       ldev = mlx5_lag_dev(dev);
+       if (!ldev)
+               goto unlock;
+
+       peer_dev = ldev->pf[MLX5_LAG_P1].dev == dev ?
+                          ldev->pf[MLX5_LAG_P2].dev :
+                          ldev->pf[MLX5_LAG_P1].dev;
+
+unlock:
+       spin_unlock(&lag_lock);
+       return peer_dev;
+}
+EXPORT_SYMBOL(mlx5_lag_get_peer_mdev);
+
 int mlx5_lag_query_cong_counters(struct mlx5_core_dev *dev,
                                 u64 *values,
                                 int num_counters,
index 191392c37558eb3b06fdf5f251513923cd252282..d4bae528954e63484e1b5613a8c8648e310b5f55 100644 (file)
@@ -39,6 +39,8 @@ struct lag_tracker {
  */
 struct mlx5_lag {
        u8                        flags;
+       int                       mode_changes_in_progress;
+       bool                      shared_fdb;
        u8                        v2p_map[MLX5_MAX_PORTS];
        struct kref               ref;
        struct lag_func           pf[MLX5_MAX_PORTS];
@@ -71,7 +73,8 @@ void mlx5_modify_lag(struct mlx5_lag *ldev,
                     struct lag_tracker *tracker);
 int mlx5_activate_lag(struct mlx5_lag *ldev,
                      struct lag_tracker *tracker,
-                     u8 flags);
+                     u8 flags,
+                     bool shared_fdb);
 int mlx5_lag_dev_get_netdev_idx(struct mlx5_lag *ldev,
                                struct net_device *ndev);
 
index c4bf8b679541ee4f575cca2c4f62703e685df2dd..011b639b29bf1cee48bc64d0098dc6d29fd5a744 100644 (file)
@@ -161,7 +161,7 @@ static void mlx5_lag_fib_route_event(struct mlx5_lag *ldev,
                struct lag_tracker tracker;
 
                tracker = ldev->tracker;
-               mlx5_activate_lag(ldev, &tracker, MLX5_LAG_FLAG_MULTIPATH);
+               mlx5_activate_lag(ldev, &tracker, MLX5_LAG_FLAG_MULTIPATH, false);
        }
 
        mlx5_lag_set_port_affinity(ldev, MLX5_LAG_NORMAL_AFFINITY);
index c84ad87c99bb6b8a1f19c6b03d3b46c5ef08158e..320c890ede540225586e1ff5b9a41a6d97cadffb 100644 (file)
@@ -1179,6 +1179,7 @@ static int mlx5_load(struct mlx5_core_dev *dev)
                goto err_ec;
        }
 
+       mlx5_lag_add_mdev(dev);
        err = mlx5_sriov_attach(dev);
        if (err) {
                mlx5_core_err(dev, "sriov init failed %d\n", err);
@@ -1186,11 +1187,11 @@ static int mlx5_load(struct mlx5_core_dev *dev)
        }
 
        mlx5_sf_dev_table_create(dev);
-       mlx5_lag_add_mdev(dev);
 
        return 0;
 
 err_sriov:
+       mlx5_lag_remove_mdev(dev);
        mlx5_ec_cleanup(dev);
 err_ec:
        mlx5_sf_hw_table_destroy(dev);
@@ -1222,9 +1223,9 @@ err_irq_table:
 
 static void mlx5_unload(struct mlx5_core_dev *dev)
 {
-       mlx5_lag_remove_mdev(dev);
        mlx5_sf_dev_table_destroy(dev);
        mlx5_sriov_detach(dev);
+       mlx5_lag_remove_mdev(dev);
        mlx5_ec_cleanup(dev);
        mlx5_sf_hw_table_destroy(dev);
        mlx5_vhca_event_stop(dev);
index da365b8f014155d52d2be840aa1b4bb169667132..ca6363198a673d9dcc2ab99bb17a87f6164b0152 100644 (file)
@@ -168,6 +168,8 @@ void mlx5_lag_add_netdev(struct mlx5_core_dev *dev, struct net_device *netdev);
 void mlx5_lag_remove_netdev(struct mlx5_core_dev *dev, struct net_device *netdev);
 void mlx5_lag_add_mdev(struct mlx5_core_dev *dev);
 void mlx5_lag_remove_mdev(struct mlx5_core_dev *dev);
+void mlx5_lag_disable_change(struct mlx5_core_dev *dev);
+void mlx5_lag_enable_change(struct mlx5_core_dev *dev);
 
 int mlx5_events_init(struct mlx5_core_dev *dev);
 void mlx5_events_cleanup(struct mlx5_core_dev *dev);
index 9df0e73d1c358d7c3a96382740115fbecb3ef119..8a1623a4d8bce0bc757adcb966d653b288d4053f 100644 (file)
@@ -789,7 +789,7 @@ static struct mlx5dr_cq *dr_create_cq(struct mlx5_core_dev *mdev,
 
        cqc = MLX5_ADDR_OF(create_cq_in, in, cq_context);
        MLX5_SET(cqc, cqc, log_cq_size, ilog2(ncqe));
-       MLX5_SET(cqc, cqc, c_eqn, eqn);
+       MLX5_SET(cqc, cqc, c_eqn_or_apu_element, eqn);
        MLX5_SET(cqc, cqc, uar_page, uar->index);
        MLX5_SET(cqc, cqc, log_page_size, cq->wq_ctrl.buf.page_shift -
                 MLX5_ADAPTER_PAGE_SHIFT);
index 5a0a3cbcc1c179def05074a0954ea16bc5069132..cb0f2a3a1ac98a534fe5d084f0cdb224098483ca 100644 (file)
@@ -2226,8 +2226,8 @@ qed_cxt_dynamic_ilt_alloc(struct qed_hwfn *p_hwfn,
                p_blk = &p_cli->pf_blks[CDUT_SEG_BLK(QED_CXT_ROCE_TID_SEG)];
                break;
        default:
-               DP_NOTICE(p_hwfn, "-EINVALID elem type = %d", elem_type);
-               return -EINVAL;
+               DP_NOTICE(p_hwfn, "-EOPNOTSUPP elem type = %d", elem_type);
+               return -EOPNOTSUPP;
        }
 
        /* Calculate line in ilt */
index 379a19144a25019253752a89c38f0af73bdc9630..b94d3c73b68e1e539716b285902a1d63a72414f8 100644 (file)
@@ -572,7 +572,7 @@ static int cq_create(struct mlx5_vdpa_net *ndev, u16 idx, u32 num_ent)
        cqc = MLX5_ADDR_OF(create_cq_in, in, cq_context);
        MLX5_SET(cqc, cqc, log_cq_size, ilog2(num_ent));
        MLX5_SET(cqc, cqc, uar_page, ndev->mvdev.res.uar->index);
-       MLX5_SET(cqc, cqc, c_eqn, eqn);
+       MLX5_SET(cqc, cqc, c_eqn_or_apu_element, eqn);
        MLX5_SET64(cqc, cqc, dbr_addr, vcq->db.dma);
 
        err = mlx5_core_create_cq(mdev, &vcq->mcq, in, inlen, out, sizeof(out));
index 25a8be58d28951fb888b596456475ddd7b51a6b6..0a303b193ea100c4d928b66a103c08d2c96fb4b9 100644 (file)
@@ -1137,6 +1137,8 @@ bool mlx5_lag_is_roce(struct mlx5_core_dev *dev);
 bool mlx5_lag_is_sriov(struct mlx5_core_dev *dev);
 bool mlx5_lag_is_multipath(struct mlx5_core_dev *dev);
 bool mlx5_lag_is_active(struct mlx5_core_dev *dev);
+bool mlx5_lag_is_master(struct mlx5_core_dev *dev);
+bool mlx5_lag_is_shared_fdb(struct mlx5_core_dev *dev);
 struct net_device *mlx5_lag_get_roce_netdev(struct mlx5_core_dev *dev);
 u8 mlx5_lag_get_slave_port(struct mlx5_core_dev *dev,
                           struct net_device *slave);
@@ -1144,6 +1146,7 @@ int mlx5_lag_query_cong_counters(struct mlx5_core_dev *dev,
                                 u64 *values,
                                 int num_counters,
                                 size_t *offsets);
+struct mlx5_core_dev *mlx5_lag_get_peer_mdev(struct mlx5_core_dev *dev);
 struct mlx5_uars_page *mlx5_get_uars_page(struct mlx5_core_dev *mdev);
 void mlx5_put_uars_page(struct mlx5_core_dev *mdev, struct mlx5_uars_page *up);
 int mlx5_dm_sw_icm_alloc(struct mlx5_core_dev *dev, enum mlx5_sw_icm_type type,
index bc7db2e059eb1a16ec722e671300ca8c833c9449..4ab5c1fc1270df1e9d26973e2927afac27dce695 100644 (file)
@@ -29,11 +29,20 @@ enum {
        REP_LOADED,
 };
 
+enum mlx5_switchdev_event {
+       MLX5_SWITCHDEV_EVENT_PAIR,
+       MLX5_SWITCHDEV_EVENT_UNPAIR,
+};
+
 struct mlx5_eswitch_rep;
 struct mlx5_eswitch_rep_ops {
        int (*load)(struct mlx5_core_dev *dev, struct mlx5_eswitch_rep *rep);
        void (*unload)(struct mlx5_eswitch_rep *rep);
        void *(*get_proto_dev)(struct mlx5_eswitch_rep *rep);
+       int (*event)(struct mlx5_eswitch *esw,
+                    struct mlx5_eswitch_rep *rep,
+                    enum mlx5_switchdev_event event,
+                    void *data);
 };
 
 struct mlx5_eswitch_rep_data {
@@ -63,6 +72,7 @@ struct mlx5_eswitch_rep *mlx5_eswitch_vport_rep(struct mlx5_eswitch *esw,
 void *mlx5_eswitch_uplink_get_proto_dev(struct mlx5_eswitch *esw, u8 rep_type);
 struct mlx5_flow_handle *
 mlx5_eswitch_add_send_to_vport_rule(struct mlx5_eswitch *on_esw,
+                                   struct mlx5_eswitch *from_esw,
                                    struct mlx5_eswitch_rep *rep, u32 sqn);
 
 #ifdef CONFIG_MLX5_ESWITCH
@@ -128,6 +138,7 @@ u32 mlx5_eswitch_get_vport_metadata_for_set(struct mlx5_eswitch *esw,
 
 u8 mlx5_eswitch_mode(struct mlx5_core_dev *dev);
 u16 mlx5_eswitch_get_total_vports(const struct mlx5_core_dev *dev);
+struct mlx5_core_dev *mlx5_eswitch_get_core_dev(struct mlx5_eswitch *esw);
 
 #else  /* CONFIG_MLX5_ESWITCH */
 
@@ -171,6 +182,11 @@ static inline u16 mlx5_eswitch_get_total_vports(const struct mlx5_core_dev *dev)
        return 0;
 }
 
+static inline struct mlx5_core_dev *mlx5_eswitch_get_core_dev(struct mlx5_eswitch *esw)
+{
+       return NULL;
+}
+
 #endif /* CONFIG_MLX5_ESWITCH */
 
 static inline bool is_mdev_switchdev_mode(struct mlx5_core_dev *dev)
index b0009aa3647f4c60f0d013cb3bc1944a9ecc616e..0b413f36569990f8888cdfdbf914ab134596c066 100644 (file)
@@ -1651,7 +1651,13 @@ struct mlx5_ifc_cmd_hca_cap_bits {
        u8         max_geneve_tlv_option_data_len[0x5];
        u8         reserved_at_570[0x10];
 
-       u8         reserved_at_580[0x33];
+       u8         reserved_at_580[0xb];
+       u8         log_max_dci_stream_channels[0x5];
+       u8         reserved_at_590[0x3];
+       u8         log_max_dci_errored_streams[0x5];
+       u8         reserved_at_598[0x8];
+
+       u8         reserved_at_5a0[0x13];
        u8         log_max_dek[0x5];
        u8         reserved_at_5b8[0x4];
        u8         mini_cqe_resp_stride_index[0x1];
@@ -3020,10 +3026,12 @@ struct mlx5_ifc_qpc_bits {
        u8         reserved_at_3c0[0x8];
        u8         next_send_psn[0x18];
 
-       u8         reserved_at_3e0[0x8];
+       u8         reserved_at_3e0[0x3];
+       u8         log_num_dci_stream_channels[0x5];
        u8         cqn_snd[0x18];
 
-       u8         reserved_at_400[0x8];
+       u8         reserved_at_400[0x3];
+       u8         log_num_dci_errored_streams[0x5];
        u8         deth_sqpn[0x18];
 
        u8         reserved_at_420[0x20];
@@ -3911,7 +3919,7 @@ struct mlx5_ifc_cqc_bits {
        u8         status[0x4];
        u8         reserved_at_4[0x2];
        u8         dbr_umem_valid[0x1];
-       u8         apu_thread_cq[0x1];
+       u8         apu_cq[0x1];
        u8         cqe_sz[0x3];
        u8         cc[0x1];
        u8         reserved_at_c[0x1];
@@ -3937,8 +3945,7 @@ struct mlx5_ifc_cqc_bits {
        u8         cq_period[0xc];
        u8         cq_max_count[0x10];
 
-       u8         reserved_at_a0[0x18];
-       u8         c_eqn[0x8];
+       u8         c_eqn_or_apu_element[0x20];
 
        u8         reserved_at_c0[0x3];
        u8         log_page_size[0x5];
index ba3c808a3789eaf9a43bac517c0459712689ba66..3634d4cc7a5638670bada0432ea7ff25d385044d 100644 (file)
@@ -366,20 +366,6 @@ struct ib_sa_mcmember_rec {
 
 #define IB_DEFAULT_SERVICE_LEASE       0xFFFFFFFF
 
-struct ib_sa_service_rec {
-       u64             id;
-       union ib_gid    gid;
-       __be16          pkey;
-       /* reserved */
-       u32             lease;
-       u8              key[16];
-       u8              name[64];
-       u8              data8[16];
-       u16             data16[8];
-       u32             data32[4];
-       u64             data64[2];
-};
-
 #define IB_SA_GUIDINFO_REC_LID         IB_SA_COMP_MASK(0)
 #define IB_SA_GUIDINFO_REC_BLOCK_NUM   IB_SA_COMP_MASK(1)
 #define IB_SA_GUIDINFO_REC_RES1                IB_SA_COMP_MASK(2)
@@ -430,16 +416,6 @@ int ib_sa_path_rec_get(struct ib_sa_client *client, struct ib_device *device,
                                        void *context),
                       void *context, struct ib_sa_query **query);
 
-int ib_sa_service_rec_query(struct ib_sa_client *client,
-                           struct ib_device *device, u32 port_num, u8 method,
-                           struct ib_sa_service_rec *rec,
-                           ib_sa_comp_mask comp_mask, unsigned long timeout_ms,
-                           gfp_t gfp_mask,
-                           void (*callback)(int status,
-                                            struct ib_sa_service_rec *resp,
-                                            void *context),
-                           void *context, struct ib_sa_query **sa_query);
-
 struct ib_sa_multicast {
        struct ib_sa_mcmember_rec rec;
        ib_sa_comp_mask         comp_mask;
index 2dba30849731e1d2f18e7366aa091f2e323b283c..4b50d9a3018a66f8edf2b8f96fb7e76249560a11 100644 (file)
@@ -2268,8 +2268,13 @@ struct iw_cm_conn_param;
                         !__same_type(((struct drv_struct *)NULL)->member,     \
                                      struct ib_struct)))
 
-#define rdma_zalloc_drv_obj_gfp(ib_dev, ib_type, gfp)                         \
-       ((struct ib_type *)kzalloc(ib_dev->ops.size_##ib_type, gfp))
+#define rdma_zalloc_drv_obj_gfp(ib_dev, ib_type, gfp)                          \
+       ((struct ib_type *)rdma_zalloc_obj(ib_dev, ib_dev->ops.size_##ib_type, \
+                                          gfp, false))
+
+#define rdma_zalloc_drv_obj_numa(ib_dev, ib_type)                              \
+       ((struct ib_type *)rdma_zalloc_obj(ib_dev, ib_dev->ops.size_##ib_type, \
+                                          GFP_KERNEL, true))
 
 #define rdma_zalloc_drv_obj(ib_dev, ib_type)                                   \
        rdma_zalloc_drv_obj_gfp(ib_dev, ib_type, GFP_KERNEL)
@@ -2435,9 +2440,8 @@ struct ib_device_ops {
                          struct ib_udata *udata);
        int (*query_srq)(struct ib_srq *srq, struct ib_srq_attr *srq_attr);
        int (*destroy_srq)(struct ib_srq *srq, struct ib_udata *udata);
-       struct ib_qp *(*create_qp)(struct ib_pd *pd,
-                                  struct ib_qp_init_attr *qp_init_attr,
-                                  struct ib_udata *udata);
+       int (*create_qp)(struct ib_qp *qp, struct ib_qp_init_attr *qp_init_attr,
+                        struct ib_udata *udata);
        int (*modify_qp)(struct ib_qp *qp, struct ib_qp_attr *qp_attr,
                         int qp_attr_mask, struct ib_udata *udata);
        int (*query_qp)(struct ib_qp *qp, struct ib_qp_attr *qp_attr,
@@ -2635,11 +2639,18 @@ struct ib_device_ops {
        int (*query_ucontext)(struct ib_ucontext *context,
                              struct uverbs_attr_bundle *attrs);
 
+       /*
+        * Provide NUMA node. This API exists for rdmavt/hfi1 only.
+        * Everyone else relies on Linux memory management model.
+        */
+       int (*get_numa_node)(struct ib_device *dev);
+
        DECLARE_RDMA_OBJ_SIZE(ib_ah);
        DECLARE_RDMA_OBJ_SIZE(ib_counters);
        DECLARE_RDMA_OBJ_SIZE(ib_cq);
        DECLARE_RDMA_OBJ_SIZE(ib_mw);
        DECLARE_RDMA_OBJ_SIZE(ib_pd);
+       DECLARE_RDMA_OBJ_SIZE(ib_qp);
        DECLARE_RDMA_OBJ_SIZE(ib_rwq_ind_table);
        DECLARE_RDMA_OBJ_SIZE(ib_srq);
        DECLARE_RDMA_OBJ_SIZE(ib_ucontext);
@@ -2746,6 +2757,15 @@ struct ib_device {
        u32 lag_flags;
 };
 
+static inline void *rdma_zalloc_obj(struct ib_device *dev, size_t size,
+                                   gfp_t gfp, bool is_numa_aware)
+{
+       if (is_numa_aware && dev->ops.get_numa_node)
+               return kzalloc_node(size, gfp, dev->ops.get_numa_node(dev));
+
+       return kzalloc(size, gfp);
+}
+
 struct ib_client_nl_info;
 struct ib_client {
        const char *name;
@@ -3668,13 +3688,21 @@ static inline int ib_post_srq_recv(struct ib_srq *srq,
                                              bad_recv_wr ? : &dummy);
 }
 
-struct ib_qp *ib_create_named_qp(struct ib_pd *pd,
-                                struct ib_qp_init_attr *qp_init_attr,
-                                const char *caller);
+struct ib_qp *ib_create_qp_kernel(struct ib_pd *pd,
+                                 struct ib_qp_init_attr *qp_init_attr,
+                                 const char *caller);
+/**
+ * ib_create_qp - Creates a kernel QP associated with the specific protection
+ * domain.
+ * @pd: The protection domain associated with the QP.
+ * @init_attr: A list of initial attributes required to create the
+ *   QP.  If QP creation succeeds, then the attributes are updated to
+ *   the actual capabilities of the created QP.
+ */
 static inline struct ib_qp *ib_create_qp(struct ib_pd *pd,
                                         struct ib_qp_init_attr *init_attr)
 {
-       return ib_create_named_qp(pd, init_attr, KBUILD_MODNAME);
+       return ib_create_qp_kernel(pd, init_attr, KBUILD_MODNAME);
 }
 
 /**
index 8275954f5ce6b69014691afbabedeada0a327984..2e58d5e6ac0e46d76a4346e28134e341cfe7dde1 100644 (file)
@@ -444,7 +444,7 @@ struct rvt_qp {
        /*
         * This sge list MUST be last. Do not add anything below here.
         */
-       struct rvt_sge r_sg_list[] /* verified SGEs */
+       struct rvt_sge *r_sg_list /* verified SGEs */
                ____cacheline_aligned_in_smp;
 };
 
index 8597e6f22a1c77ac416fdeb9b257184210639b21..86be4a92b67bfe52ad3b55ee80002bad72ea4025 100644 (file)
@@ -50,6 +50,7 @@ enum {
        MLX5_QP_FLAG_ALLOW_SCATTER_CQE  = 1 << 8,
        MLX5_QP_FLAG_PACKET_BASED_CREDIT_MODE   = 1 << 9,
        MLX5_QP_FLAG_UAR_PAGE_INDEX = 1 << 10,
+       MLX5_QP_FLAG_DCI_STREAM = 1 << 11,
 };
 
 enum {
@@ -238,6 +239,11 @@ struct mlx5_ib_striding_rq_caps {
        __u32 reserved;
 };
 
+struct mlx5_ib_dci_streams_caps {
+       __u8 max_log_num_concurent;
+       __u8 max_log_num_errored;
+};
+
 enum mlx5_ib_query_dev_resp_flags {
        /* Support 128B CQE compression */
        MLX5_IB_QUERY_DEV_RESP_FLAGS_CQE_128B_COMP = 1 << 0,
@@ -266,7 +272,8 @@ struct mlx5_ib_query_device_resp {
        struct mlx5_ib_sw_parsing_caps sw_parsing_caps;
        struct mlx5_ib_striding_rq_caps striding_rq_caps;
        __u32   tunnel_offloads_caps; /* enum mlx5_ib_tunnel_offloads */
-       __u32   reserved;
+       struct  mlx5_ib_dci_streams_caps dci_streams_caps;
+       __u16 reserved;
 };
 
 enum mlx5_ib_create_cq_flags {
@@ -313,6 +320,11 @@ struct mlx5_ib_create_srq_resp {
        __u32   reserved;
 };
 
+struct mlx5_ib_create_qp_dci_streams {
+       __u8 log_num_concurent;
+       __u8 log_num_errored;
+};
+
 struct mlx5_ib_create_qp {
        __aligned_u64 buf_addr;
        __aligned_u64 db_addr;
@@ -327,7 +339,8 @@ struct mlx5_ib_create_qp {
                __aligned_u64 access_key;
        };
        __u32  ece_options;
-       __u32  reserved;
+       struct  mlx5_ib_create_qp_dci_streams dci_streams;
+       __u16 reserved;
 };
 
 /* RX Hash function flags */