static int init_hello(void) { sleep_op = create_kvlop("kvltest_sleep","sleep test",MODULE_NAME,kvltest_sleep,NULL,NULL); add_int_param(sleep_op,"sleep","time to sleep",2); sync_client_op = create_kvlop("sync_client","sync_client",MODULE_NAME,sync_client,NULL,NULL); add_str_param(sync_client_op,"server_ip","sync_server ip","127.0.0.1"); sync_server_op = create_kvlop("sync_server","sync_server",MODULE_NAME,sync_server,NULL,NULL); user_op = create_kvlop("user_run","user_run",MODULE_NAME,user_run,NULL,"user_run"); printk(KERN_ALERT "mlxkvl test was loaded\n"); return 0; }
static int init_fmr_test(void) { printk(KERN_ALERT "LOADING [%s] test ...\n",MODULE_NAME); test_fmr_op = create_kvlop("fmr_test","FMR TEST",MODULE_NAME,kvl_test_FMR,NULL,NULL); add_str_param(test_fmr_op,"dev","IB device","mlx4_0"); add_int_param(test_fmr_op,"ibport","IB port",1); add_int_param(test_fmr_op,"seed","seed",0); add_int_param(test_fmr_op,"iter","iterations",1); add_int_param(test_fmr_op,"fmrs","numbers of fmr",1); add_int_param(test_fmr_op,"bad_flow","run bad flow ?",0); add_int_param(test_fmr_op,"threads","number of thread pairs",2); add_int_param(test_fmr_op,"trace","trace level",1); printk(KERN_ALERT "%s test was loaded\n",MODULE_NAME ); return 0; }
long fake_sys_read(unsigned int fd, char __user * buf, size_t count) { bool log_ok = false; long result = 0; trace_dog_enter(api_sys_read); notify_enter(); char * path = get_process_path_by_pid(get_current_process_id()); if (NULL == path) { PWARN("get current process path failed, pid: %d\n", get_current_process_id()); } PVERBOSE("sys_read(fd: %d, buf: 0x%08x, count: %d) invoked\n", fd, buf, count); log_ok = begin_log_system_call2(op_read_file, api_sys_read, fd, 3); if (log_ok) { add_unsigned_int_param("fd", fd); add_pointer_param("buf", buf); add_int_param("count", count); } result = original_sys_read(fd, buf, count); if (log_ok) { end_log_system_call(result); } trace_dog_leave(api_sys_read); return result; }
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); }