Esempio n. 1
0
static void
roq_eth_add_one(struct ib_device *ibdev)
{
	struct roq_eth_priv *priv;
	struct roq_dev *roq_dev = container_of(ibdev, struct roq_dev, ofa_dev);
	struct net_device *ndev = roq_dev->l2dev;

	/* roq is represented as RDMA_NODE_RNIC */
	if (rdma_node_get_transport(ibdev->node_type) != RDMA_TRANSPORT_IWARP
	    || strncmp(ibdev->name, "roq", IB_DEVICE_NAME_MAX) != 0)
		return;

	priv = ib_get_client_data(ibdev, &roq_eth_client);
	if (priv) {
		pr_warn("roq_eth_add_one: netdev already allocated!\n");
		return;
	}

	SET_NETDEV_DEV(ndev, ibdev->dma_device);

	priv = netdev_priv(ndev);
	priv->ndev  = ndev;
	priv->ibdev = ibdev;
	ib_set_client_data(ibdev, &roq_eth_client, priv);

	return;
}
Esempio n. 2
0
static void pfmr_add_one(struct ib_device *device)
{
	char opname[64];
	struct pfmr_test_ctx *test_ctx = pfmr_create_test_ctx(device);
	debug("adding IB device %s ...\n", device->name);
	if (!test_ctx) {
		error("Failed to create test context");
		return;
	}
	ib_set_client_data(device, &test_client, test_ctx);

	sprintf(opname, "%s-create_fmr", device->name);
	test_ctx->create_fmr_op = create_kvlop(opname, "create FMRs",
					       MODULE_NAME, pfmr_create_fmr,
					       test_ctx, NULL);
	if (!test_ctx->create_fmr_op) {
		error("Failed to create FMRs OP for :%s\n",device->name);
		return;
	}
	add_int_param(test_ctx->create_fmr_op, "nfmr", "num FMRs", 1);
	add_int_param(test_ctx->create_fmr_op, "max_pages", "Maximum pages for FMR", 10);
	add_int_param(test_ctx->create_fmr_op, "max_maps", "Maximum remaps for FMR", 10);
	add_int_param(test_ctx->create_fmr_op, "show", "show fmrs", 0);

	sprintf(opname, "%s-destroy_fmr", device->name);
	test_ctx->destroy_fmr_op = create_kvlop(opname, "destroy FMRs",
						MODULE_NAME, pfmr_destroy_fmr,
						test_ctx, NULL);
	if (!test_ctx->destroy_fmr_op) {
		error("Failed to create FMR destroy OP for %s\n", device->name);
		return;
	}
	add_int_param(test_ctx->destroy_fmr_op, "fmr_idx", "index of FMR", 0);

	sprintf(opname, "%s-create_dma", device->name);
	test_ctx->create_dma_op = create_kvlop(opname, "create DMA buffers",
					       MODULE_NAME,
					       pfmr_create_dma_buff, test_ctx,
					       NULL);
	if (!test_ctx->create_dma_op) {
		error("Failed to create DMA OP for :%s\n", device->name);
		return;
	}
	add_int_param(test_ctx->create_dma_op, "ndma", "num DMA buffers", 1);
	add_int_param(test_ctx->create_dma_op, "show", "show dma buffers", 0);

	sprintf(opname, "%s-dma", device->name);
	test_ctx->destroy_dma_op = create_kvlop(opname, "DMA buffer operations",
						MODULE_NAME, pfmr_dma_ops,
						test_ctx, NULL);
	if (!test_ctx->destroy_dma_op) {
		error("Failed to create DMA OP for :%s\n",device->name);
		return;
	}
	add_int_param(test_ctx->destroy_dma_op, "dma_idx", "DMA index", 0);
	add_int_param(test_ctx->destroy_dma_op, "des", "Destroy DMA", 0);
	add_int_param(test_ctx->destroy_dma_op, "get", "Read value", 0);
	add_str_param(test_ctx->destroy_dma_op, "set", "Set value", "~");

	sprintf(opname, "%s-fmr_map", device->name);
	test_ctx->fmr_map_op = create_kvlop(opname, "MAP FMRs", MODULE_NAME,
					    pfmr_map_dma_fmr, test_ctx, NULL);
	if (!test_ctx->fmr_map_op) {
		error("Failed to create MAP FMRs OP for :%s\n",device->name);
		return;
	}
	add_int_param(test_ctx->fmr_map_op , "fmr_idx", "index of FMR", 0);
	add_int_param(test_ctx->fmr_map_op , "dma_idx", "DMA index of dma "
		      "address", 0);
	add_int_param(test_ctx->fmr_map_op, "unmap", "unmap", 0);
	add_int_param(test_ctx->fmr_map_op, "show", "show mappings", 0);

	sprintf(opname, "%s-fmr_pool", device->name);
	test_ctx->fmr_pool_op = create_kvlop(opname, "Create FMR Pool",
					     MODULE_NAME, pfmr_create_pool,
					     test_ctx, NULL);
	if (!test_ctx->fmr_pool_op) {
		error("Failed to create FMR POOL OP for :%s\n", device->name);
		return;
	}
	add_int_param(test_ctx->fmr_pool_op, "size", "size of FMR pool", 1024);

	sprintf(opname, "%s-cq", device->name);
	test_ctx->cq_op = create_kvlop(opname, "CQ",
				       MODULE_NAME, pfmr_cq_op,
				       test_ctx, NULL);
	if (!test_ctx->cq_op) {
		error("Failed to create CQ OP for :%s\n", device->name);
		return;
	}
	add_int_param(test_ctx->cq_op, "show", "Show CQ list", 0);
	add_int_param(test_ctx->cq_op, "cr", "Create CQ", 0);
	add_int_param(test_ctx->cq_op, "des", "Destroty CQ", 0);

	sprintf(opname, "%s-qp", device->name);
	test_ctx->qp_op = create_kvlop(opname, "QP",
				       MODULE_NAME, pfmr_qp_op,
				       test_ctx, NULL);
	if (!test_ctx->qp_op) {
		error("Failed to create QP OP for :%s\n", device->name);
		return;
	}
	add_int_param(test_ctx->qp_op, "show", "Show QP list", 0);
	add_int_param(test_ctx->qp_op, "des", "Destroty QP", 0);
	add_int_param(test_ctx->qp_op, "cr", "Create QP(scq_idx, rcq_idx)", 0);
	add_int_param(test_ctx->qp_op, "scq_idx", "Index of send CQ", 0);
	add_int_param(test_ctx->qp_op, "rcq_idx", "Index of recv CQ", 0);
	add_int_param(test_ctx->qp_op, "rts", "Change QP state RTS (port, dlid,"
				       " dqpn)", 0);
	add_int_param(test_ctx->qp_op, "port", "Source port", 0);
	add_int_param(test_ctx->qp_op, "dlid", "Dest LID", 0);
	add_int_param(test_ctx->qp_op, "dqpn_idx", "Destination QP", 0);
	add_str_param(test_ctx->qp_op, "dqpn", "Destination QP number", 0);
	add_int_param(test_ctx->qp_op, "rdma", "Send memory to dest (fmr_idx, "
				       "rfmr_idx)", 0);
	add_int_param(test_ctx->qp_op , "fmr_idx", "Index of FMR", 0);
	add_int_param(test_ctx->qp_op , "rfmr_idx", "Remote FMR index", 0);
	add_str_param(test_ctx->qp_op , "rkey", "Remote key", 0);
	add_str_param(test_ctx->qp_op , "raddr", "Remote address", 0);

	sprintf(opname, "%s-complete_test", device->name);
	test_ctx->complete_test_op = create_kvlop(opname,
						  "Complete FMR test",
						  MODULE_NAME,
						  pfmr_complete_test,
						  test_ctx, NULL);
	if (!test_ctx->complete_test_op) {
		error("Failed to create Complete FMR OP for %s\n",
		      device->name);
		return;
	}

	info("pfmr test ops created for IB device %s...\n", device->name);
}