Commit 97f67597 authored by Mehdi Dogguy's avatar Mehdi Dogguy

Imported Upstream version 3.0+0.16.gb2f2e82

parent a8b168f9
......@@ -37,3 +37,21 @@ stamp-h1
#Ctags
tags
#Programs
ib_atomic_bw
ib_atomic_lat
ib_read_bw
ib_read_lat
ib_send_bw
ib_send_lat
ib_write_bw
ib_write_lat
raw_ethernet_bw
raw_ethernet_lat
#Debian Stuff
debian/compat
debian/*.log
debian/files
debian/perftest
Name: perftest
Summary: IB Performance tests
Version: 3.0
Release: 0.9.g214990b
Release: 0.16.gb2f2e82
License: BSD 3-Clause, GPL v2 or later
Group: Productivity/Networking/Diagnostic
Source: http://www.openfabrics.org/downloads/perftest-3.0-0.9.g214990b.tar.gz
Source: http://www.openfabrics.org/downloads/perftest-3.0-0.16.gb2f2e82.tar.gz
Url: http://www.openfabrics.org
BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildRequires: libibverbs-devel librdmacm-devel libibumad-devel
......
......@@ -134,7 +134,7 @@ static double sample_get_cpu_mhz(void)
}
#ifndef __s390x__
static double proc_get_cpu_mhz(int no_cpu_freq_fail)
static double proc_get_cpu_mhz(int no_cpu_freq_warn)
{
FILE* f;
char buf[256];
......@@ -185,13 +185,9 @@ static double proc_get_cpu_mhz(int no_cpu_freq_fail)
delta = mhz > m ? mhz - m : m - mhz;
if ((delta / mhz > 0.02) && (print_flag ==0)) {
print_flag = 1;
fprintf(stderr, "Conflicting CPU frequency values"
" detected: %lf != %lf\n", mhz, m);
if (no_cpu_freq_fail) {
fprintf(stderr, "Test integrity may be harmed !\n");
} else {
fclose(f);
return 0.0;
if (!no_cpu_freq_warn) {
fprintf(stderr, "Conflicting CPU frequency values"
" detected: %lf != %lf. CPU Frequency is not max.\n", mhz, m);
}
continue;
}
......@@ -202,14 +198,14 @@ static double proc_get_cpu_mhz(int no_cpu_freq_fail)
}
#endif
double get_cpu_mhz(int no_cpu_freq_fail)
double get_cpu_mhz(int no_cpu_freq_warn)
{
#ifdef __s390x__
return sample_get_cpu_mgz();
#else
double sample, proc, delta;
sample = sample_get_cpu_mhz();
proc = proc_get_cpu_mhz(no_cpu_freq_fail);
proc = proc_get_cpu_mhz(no_cpu_freq_warn);
#ifdef __aarch64__
if (proc < 1)
proc = sample;
......@@ -219,13 +215,6 @@ double get_cpu_mhz(int no_cpu_freq_fail)
delta = proc > sample ? proc - sample : sample - proc;
if (delta / proc > 0.02) {
#if !defined (__PPC__) && !defined (__PPC64__)
fprintf(stderr, "Warning: measured timestamp frequency "
"%g differs from nominal %g MHz\n",
sample, proc);
if (!no_cpu_freq_fail)
fprintf(stderr, " Add --CPU-freq flag to show report\n");
#endif
return sample;
}
return proc;
......
......@@ -64,9 +64,9 @@ static int post_one_recv_wqe(struct pingpong_context *ctx)
struct ibv_recv_wr *bad_wr;
struct ibv_sge list;
list.addr = (uintptr_t)ctx->buf;
list.addr = (uintptr_t)ctx->buf[0];
list.length = sizeof(struct pingpong_dest);
list.lkey = ctx->mr->lkey;
list.lkey = ctx->mr[0]->lkey;
wr.next = NULL;
wr.wr_id = SYNC_SPEC_ID;
......@@ -90,9 +90,9 @@ static int post_recv_to_get_ah(struct pingpong_context *ctx)
struct ibv_recv_wr *bad_wr;
struct ibv_sge list;
list.addr = (uintptr_t)ctx->buf;
list.addr = (uintptr_t)ctx->buf[0];
list.length = UD_ADDITION + sizeof(uint32_t);
list.lkey = ctx->mr->lkey;
list.lkey = ctx->mr[0]->lkey;
wr.next = NULL;
wr.wr_id = 0;
......@@ -120,11 +120,11 @@ static int send_qp_num_for_ah(struct pingpong_context *ctx,
struct ibv_wc wc;
int ne;
memcpy(ctx->buf,&ctx->qp[0]->qp_num,sizeof(uint32_t));
memcpy(ctx->buf[0], &ctx->qp[0]->qp_num, sizeof(uint32_t));
list.addr = (uintptr_t)ctx->buf;
list.addr = (uintptr_t)ctx->buf[0];
list.length = sizeof(uint32_t);
list.lkey = ctx->mr->lkey;
list.lkey = ctx->mr[0]->lkey;
wr.wr_id = 0;
wr.sg_list = &list;
......@@ -177,7 +177,7 @@ static int create_ah_from_wc_recv(struct pingpong_context *ctx,
return 1;
}
ctx->ah[0] = ibv_create_ah_from_wc(ctx->pd,&wc,(struct ibv_grh*)ctx->buf,ctx->cm_id->port_num);
ctx->ah[0] = ibv_create_ah_from_wc(ctx->pd, &wc, (struct ibv_grh*)ctx->buf[0], ctx->cm_id->port_num);
user_param->rem_ud_qpn = ntohl(wc.imm_data);
ibv_query_qp(ctx->qp[0],&attr, IBV_QP_QKEY,&init_attr);
user_param->rem_ud_qkey = attr.qkey;
......@@ -358,13 +358,13 @@ static int rdma_write_keys(struct pingpong_dest *my_dest,
m_my_dest.gid.raw[i] = my_dest->gid.raw[i];
}
memcpy(comm->rdma_ctx->buf, &m_my_dest, sizeof(struct pingpong_dest));
memcpy(comm->rdma_ctx->buf[0], &m_my_dest, sizeof(struct pingpong_dest));
#else
memcpy(comm->rdma_ctx->buf, &my_dest, sizeof(struct pingpong_dest));
memcpy(comm->rdma_ctx->buf[0], &my_dest, sizeof(struct pingpong_dest));
#endif
list.addr = (uintptr_t)comm->rdma_ctx->buf;
list.addr = (uintptr_t)comm->rdma_ctx->buf[0];
list.length = sizeof(struct pingpong_dest);
list.lkey = comm->rdma_ctx->mr->lkey;
list.lkey = comm->rdma_ctx->mr[0]->lkey;
wr.wr_id = SYNC_SPEC_ID;
......@@ -413,7 +413,7 @@ static int rdma_read_keys(struct pingpong_dest *rem_dest,
}
#ifdef HAVE_ENDIAN
memcpy(&a_rem_dest,comm->rdma_ctx->buf,sizeof(struct pingpong_dest));
memcpy(&a_rem_dest,comm->rdma_ctx->buf[0],sizeof(struct pingpong_dest));
rem_dest->lid = ntohl(a_rem_dest.lid);
rem_dest->out_reads = ntohl(a_rem_dest.out_reads);
rem_dest->qpn = ntohl(a_rem_dest.qpn);
......@@ -423,7 +423,7 @@ static int rdma_read_keys(struct pingpong_dest *rem_dest,
rem_dest->vaddr = be64toh(a_rem_dest.vaddr);
memcpy(rem_dest->gid.raw, &(a_rem_dest.gid), 16*sizeof(uint8_t));
#else
memcpy(&rem_dest,comm->rdma_ctx->buf,sizeof(struct pingpong_dest));
memcpy(&rem_dest,comm->rdma_ctx->buf[0],sizeof(struct pingpong_dest));
#endif
if (post_one_recv_wqe(comm->rdma_ctx)) {
......@@ -625,11 +625,14 @@ int set_up_connection(struct pingpong_context *ctx,
my_dest[i].qpn = ctx->qp[i]->qp_num;
my_dest[i].psn = lrand48() & 0xffffff;
my_dest[i].rkey = ctx->mr->rkey;
my_dest[i].rkey = ctx->mr[i]->rkey;
/* Each qp gives his receive buffer address.*/
my_dest[i].out_reads = user_param->out_reads;
my_dest[i].vaddr = (uintptr_t)ctx->buf + (user_param->num_of_qps + i)*BUFF_SIZE(ctx->size,ctx->cycle_buffer);
if (user_param->mr_per_qp)
my_dest[i].vaddr = (uintptr_t)ctx->buf[i] + BUFF_SIZE(ctx->size,ctx->cycle_buffer);
else
my_dest[i].vaddr = (uintptr_t)ctx->buf[0] + (user_param->num_of_qps + i)*BUFF_SIZE(ctx->size,ctx->cycle_buffer);
if (user_param->dualport==ON) {
......@@ -783,7 +786,7 @@ int rdma_client_connect(struct pingpong_context *ctx,struct perftest_parameters
temp = user_param->work_rdma_cm;
user_param->work_rdma_cm = ON;
if (ctx_init(ctx,user_param)) {
if (ctx_init(ctx, user_param)) {
fprintf(stderr," Unable to create the resources needed by comm struct\n");
return FAILURE;
}
......@@ -862,7 +865,6 @@ int retry_rdma_connect(struct pingpong_context *ctx,
}
if (rdma_client_connect(ctx,user_param) == SUCCESS)
return SUCCESS;
if (destroy_rdma_resources(ctx,user_param)) {
fprintf(stderr,"Unable to destroy rdma resources\n");
return FAILURE;
......@@ -992,30 +994,33 @@ int rdma_server_connect(struct pingpong_context *ctx,
int create_comm_struct(struct perftest_comm *comm,
struct perftest_parameters *user_param)
{
ALLOCATE(comm->rdma_params,struct perftest_parameters,1);
memset(comm->rdma_params,0,sizeof(struct perftest_parameters));
comm->rdma_params->port = user_param->port;
comm->rdma_params->sockfd = -1;
comm->rdma_params->gid_index = user_param->gid_index;
comm->rdma_params->gid_index2 = user_param->gid_index2;
comm->rdma_params->use_rdma_cm = user_param->use_rdma_cm;
comm->rdma_params->servername = user_param->servername;
comm->rdma_params->machine = user_param->machine;
comm->rdma_params->side = LOCAL;
comm->rdma_params->verb = user_param->verb;
comm->rdma_params->use_mcg = user_param->use_mcg;
comm->rdma_params->duplex = user_param->duplex;
comm->rdma_params->tos = DEF_TOS;
comm->rdma_params->use_xrc = user_param->use_xrc;
ALLOCATE(comm->rdma_params, struct perftest_parameters, 1);
memset(comm->rdma_params, 0, sizeof(struct perftest_parameters));
comm->rdma_params->port = user_param->port;
comm->rdma_params->sockfd = -1;
comm->rdma_params->gid_index = user_param->gid_index;
comm->rdma_params->gid_index2 = user_param->gid_index2;
comm->rdma_params->use_rdma_cm = user_param->use_rdma_cm;
comm->rdma_params->servername = user_param->servername;
comm->rdma_params->machine = user_param->machine;
comm->rdma_params->side = LOCAL;
comm->rdma_params->verb = user_param->verb;
comm->rdma_params->use_mcg = user_param->use_mcg;
comm->rdma_params->duplex = user_param->duplex;
comm->rdma_params->tos = DEF_TOS;
comm->rdma_params->use_xrc = user_param->use_xrc;
comm->rdma_params->connection_type = user_param->connection_type;
comm->rdma_params->output = user_param->output;
comm->rdma_params->report_per_port = user_param->report_per_port;
comm->rdma_params->output = user_param->output;
comm->rdma_params->report_per_port = user_param->report_per_port;
comm->rdma_params->retry_count = user_param->retry_count;
comm->rdma_params->mr_per_qp = user_param->mr_per_qp;
comm->rdma_params->dlid = user_param->dlid;
if (user_param->use_rdma_cm) {
ALLOCATE(comm->rdma_ctx,struct pingpong_context,1);
memset(comm->rdma_ctx,0,sizeof(struct pingpong_context));
ALLOCATE(comm->rdma_ctx, struct pingpong_context, 1);
memset(comm->rdma_ctx, 0, sizeof(struct pingpong_context));
comm->rdma_params->tx_depth = 1;
comm->rdma_params->rx_depth = 1;
......@@ -1025,6 +1030,8 @@ int create_comm_struct(struct perftest_comm *comm,
comm->rdma_params->size = sizeof(struct pingpong_dest);
comm->rdma_ctx->context = NULL;
ALLOCATE(comm->rdma_ctx->mr, struct ibv_mr*, user_param->num_of_qps);
ALLOCATE(comm->rdma_ctx->buf, void* , user_param->num_of_qps);
ALLOCATE(comm->rdma_ctx->qp,struct ibv_qp*,comm->rdma_params->num_of_qps);
comm->rdma_ctx->buff_size = user_param->cycle_buffer;
......@@ -1212,7 +1219,7 @@ int rdma_read_data(void *data,
return 1;
}
memcpy(data,comm->rdma_ctx->buf,size);
memcpy(data,comm->rdma_ctx->buf[0], size);
if (post_one_recv_wqe(comm->rdma_ctx)) {
fprintf(stderr, "Couldn't post send \n");
......@@ -1233,11 +1240,11 @@ int rdma_write_data(void *data,
struct ibv_sge list;
struct ibv_wc wc;
int ne;
memcpy(comm->rdma_ctx->buf,data,size);
memcpy(comm->rdma_ctx->buf[0],data,size);
list.addr = (uintptr_t)comm->rdma_ctx->buf;
list.addr = (uintptr_t)comm->rdma_ctx->buf[0];
list.length = size;
list.lkey = comm->rdma_ctx->mr->lkey;
list.lkey = comm->rdma_ctx->mr[0]->lkey;
wr.wr_id = SYNC_SPEC_ID;
wr.sg_list = &list;
......@@ -1399,10 +1406,15 @@ void ctx_print_pingpong_data(struct pingpong_dest *element,
struct perftest_comm *comm)
{
int is_there_mgid,local_mgid,remote_mgid;
/* use dlid value from user (if user specified and only on the remote side) */
uint16_t dlid = (comm->rdma_params->dlid && comm->rdma_params->side) ?
comm->rdma_params->dlid : element->lid;
if (comm->rdma_params->output != FULL_VERBOSITY)
return;
/*First of all we print the basic format.*/
printf(BASIC_ADDR_FMT,sideArray[comm->rdma_params->side],element->lid,element->qpn,element->psn);
printf(BASIC_ADDR_FMT, sideArray[comm->rdma_params->side], dlid, element->qpn, element->psn);
switch (comm->rdma_params->verb) {
case 2 : printf(READ_FMT,element->out_reads);
......
This diff is collapsed.
......@@ -323,6 +323,8 @@ struct perftest_parameters {
int tcp;
int is_server_port;
int is_client_port;
uint16_t ethertype;
int is_ethertype;
int cpu_freq_f;
int connection_type;
int num_of_qps;
......@@ -375,6 +377,8 @@ struct perftest_parameters {
int pkey_index;
int raw_qos;
int use_cuda;
char *mmap_file;
unsigned long mmap_offset;
/* New test params format pilot. will be used in all flags soon,. */
enum ctx_test_method test_method;
enum ibv_transport_type transport_type;
......@@ -411,6 +415,8 @@ struct perftest_parameters {
int is_exp_cq;
int is_exp_qp;
int use_res_domain;
int mr_per_qp;
uint16_t dlid;
};
struct report_options {
......
This diff is collapsed.
......@@ -129,10 +129,10 @@ struct pingpong_context {
struct ibv_context *context;
struct ibv_comp_channel *channel;
struct ibv_pd *pd;
struct ibv_mr *mr;
struct ibv_mr **mr;
struct ibv_cq *send_cq;
struct ibv_cq *recv_cq;
void *buf;
void **buf;
struct ibv_ah **ah;
struct ibv_qp **qp;
struct ibv_srq *srq;
......@@ -777,4 +777,38 @@ struct ibv_qp* ctx_exp_qp_create(struct pingpong_context *ctx,
int modify_qp_to_init(struct pingpong_context *ctx,
struct perftest_parameters *user_param, int qp_index, int num_of_qps);
/* create_single_mr
*
* Description :
*
* Creates a single MR for a specific QP index.
*
* Parameters :
* ctx - Resources sructure.
* user_param - the perftest parameters.
* qp_index - QP index to register a MR
*
* Return Value : SUCCESS, FAILURE.
*
*/
int create_single_mr(struct pingpong_context *ctx,
struct perftest_parameters *user_param, int qp_index);
/* create_mr
*
* Description :
*
* Creates Memory Regions for the test.
* Takes into consideration all user parameters and test type.
*
* Parameters :
* ctx - Resources sructure.
* user_param - the perftest parameters.
*
* Return Value : SUCCESS, FAILURE.
*
*/
int create_mr(struct pingpong_context *ctx,
struct perftest_parameters *user_param);
#endif /* PERFTEST_RESOURCES_H */
......@@ -49,11 +49,15 @@
struct perftest_parameters* duration_param;
int check_flow_steering_support()
int check_flow_steering_support(char *dev_name)
{
char* file_name = "/sys/module/mlx4_core/parameters/log_num_mgm_entry_size";
FILE *fp;
char line[4];
if (strstr(dev_name, "mlx5") != NULL)
return 0;
fp = fopen(file_name, "r");
fgets(line,4,fp);
int val = atoi(line);
......@@ -431,13 +435,14 @@ void create_raw_eth_pkt( struct perftest_parameters *user_param,
int offset = 0;
struct ETH_header* eth_header;
uint16_t ip_next_protocol = 0;
uint16_t eth_type = (user_param->is_client_ip || user_param->is_server_ip ? IP_ETHER_TYPE : (ctx->size-RAWETH_ADDITION));
uint16_t eth_type = user_param->is_ethertype ? user_param->ethertype :
(user_param->is_client_ip || user_param->is_server_ip ? IP_ETHER_TYPE : (ctx->size-RAWETH_ADDITION));
if(user_param->is_client_port && user_param->is_server_port)
ip_next_protocol = (user_param->tcp ? TCP_PROTOCOL : UDP_PROTOCOL);
DEBUG_LOG(TRACE,">>>>>>%s",__FUNCTION__);
eth_header = (void*)ctx->buf;
eth_header = (void*)ctx->buf[0];
/* build single packet on ctx buffer */
build_pkt_on_buffer(eth_header,my_dest_info,rem_dest_info,user_param,eth_type,ip_next_protocol,PRINT_ON,ctx->size-RAWETH_ADDITION);
......@@ -447,7 +452,7 @@ void create_raw_eth_pkt( struct perftest_parameters *user_param,
if (ctx->size <= (ctx->cycle_buffer / 2)) {
while (offset < ctx->cycle_buffer-INC(ctx->size,ctx->cache_line_size)) {
offset += INC(ctx->size,ctx->cache_line_size);
eth_header = (void*)ctx->buf+offset;
eth_header = (void*)ctx->buf[0]+offset;
build_pkt_on_buffer(eth_header,my_dest_info,rem_dest_info,
user_param,eth_type,ip_next_protocol,
PRINT_OFF,ctx->size-RAWETH_ADDITION);
......@@ -617,6 +622,12 @@ int send_set_up_connection(
memset((void*)&spec_info->tcp_udp.mask.dst_port, 0xFF,sizeof(spec_info->ipv4.mask.dst_ip));
memset((void*)&spec_info->tcp_udp.mask.src_port, 0xFF,sizeof(spec_info->ipv4.mask.src_ip));
}
if (user_param->is_ethertype) {
spec_info->eth.val.ether_type = htons(user_param->ethertype);
spec_info->eth.mask.ether_type = 0xffff;
}
}
if (user_param->machine == CLIENT || user_param->duplex) {
......
......@@ -108,7 +108,7 @@ void print_ip_header(struct IP_V4_header* ip_header);
void print_udp_header(struct UDP_header* udp_header);
void print_pkt(void* pkt,struct perftest_parameters *user_param);
int check_flow_steering_support();
int check_flow_steering_support(char *dev_name);
/* build_pkt_on_buffer
* Description: build single Ethernet packet on ctx buffer
......
......@@ -82,10 +82,6 @@ int main(int argc, char *argv[])
strncpy(user_param.version, VERSION, sizeof(user_param.version));
user_param.connection_type = RawEth;
if (check_flow_steering_support()) {
return 1;
}
ret_parser = parser(&user_param,argv,argc);
if (ret_parser) {
......@@ -130,6 +126,11 @@ int main(int argc, char *argv[])
DEBUG_LOG(TRACE,"<<<<<<%s",__FUNCTION__);
return 1;
}
GET_STRING(user_param.ib_devname, ibv_get_device_name(ib_dev));
if (check_flow_steering_support(user_param.ib_devname)) {
return 1;
}
/* Getting the relevant context from the device */
ctx.context = ibv_open_device(ib_dev);
......
......@@ -84,9 +84,6 @@ int main(int argc, char *argv[])
user_param.connection_type = RawEth;
user_param.r_flag = &report;
if (check_flow_steering_support()) {
return 1;
}
/* Configure the parameters values according to user
arguments or default values. */
......@@ -113,6 +110,11 @@ int main(int argc, char *argv[])
DEBUG_LOG(TRACE,"<<<<<<%s",__FUNCTION__);
return 1;
}
GET_STRING(user_param.ib_devname, ibv_get_device_name(ib_dev));
if (check_flow_steering_support(user_param.ib_devname)) {
return 1;
}
/* Getting the relevant context from the device */
ctx.context = ibv_open_device(ib_dev);
......
......@@ -105,58 +105,31 @@ static int send_set_up_connection(struct pingpong_context *ctx,
struct perftest_comm *comm)
{
int i;
srand48(getpid() * time(NULL));
union ibv_gid temp_gid;
if (user_param->gid_index != -1) {
if (ibv_query_gid(ctx->context,user_param->ib_port,user_param->gid_index,&temp_gid)) {
return -1;
}
if (set_up_connection(ctx,user_param,my_dest)) {
fprintf(stderr," Unable to set up my IB connection parameters\n");
return FAILURE;
}
for (i = 0; i < user_param->num_of_qps; i++) {
if (user_param->use_mcg) {
if (set_mcast_group(ctx,user_param,mcg_params)) {
return 1;
}
my_dest[i].gid = mcg_params->mgid;
my_dest[i].lid = mcg_params->mlid;
my_dest[i].qpn = QPNUM_MCAST;
} else {
memcpy(my_dest[i].gid.raw,temp_gid.raw ,16);
my_dest[i].lid = ctx_get_local_lid(ctx->context,user_param->ib_port);
my_dest[i].qpn = ctx->qp[i]->qp_num;
}
if (user_param->use_mcg && (user_param->duplex || user_param->machine == SERVER)) {
my_dest[i].psn = lrand48() & 0xffffff;
/* We do not fail test upon lid above RoCE. */
if (user_param->gid_index < 0) {
if (!my_dest->lid) {
fprintf(stderr," Local lid 0x0 detected,without any use of gid. Is SM running?\n");
return -1;
}
mcg_params->user_mgid = user_param->user_mgid;
set_multicast_gid(mcg_params,ctx->qp[0]->qp_num,(int)user_param->machine);
if (set_mcast_group(ctx,user_param,mcg_params)) {
return 1;
}
#ifdef HAVE_XRCD
if (user_param->use_xrc || user_param->connection_type == DC) {
if (ibv_get_srq_num(ctx->srq,&(my_dest[i].srqn))) {
fprintf(stderr, "Couldn't get SRQ number\n");
for (i=0; i < user_param->num_of_qps; i++) {
if (ibv_attach_mcast(ctx->qp[i],&mcg_params->mgid,mcg_params->mlid)) {
fprintf(stderr, "Couldn't attach QP to MultiCast group");
return 1;
}
}
#endif
#ifdef HAVE_DC
if (user_param->connection_type == DC) {
if (ibv_get_srq_num(ctx->srq,&(my_dest[i].srqn))) {
fprintf(stderr, "Couldn't get SRQ number\n");
return 1;
}
}
#endif
mcg_params->mcast_state |= MCAST_IS_ATTACHED;
my_dest->gid = mcg_params->mgid;
my_dest->lid = mcg_params->mlid;
my_dest->qpn = QPNUM_MCAST;
}
return 0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment