mirror of
https://github.com/hermitcore/libhermit.git
synced 2025-03-09 00:00:03 +01:00
write_bw linking.
This commit is contained in:
parent
ea4a2f6de1
commit
db151e597f
11 changed files with 6685 additions and 451 deletions
|
@ -9,9 +9,11 @@ target_link_libraries(basic pthread)
|
|||
add_executable(hg hg.c hist.c rdtsc.c run.c init.c opt.c report.c setup.c)
|
||||
|
||||
# add_executable(ib-pingpong-ud ib/pingpong.c ib/pingpong-ud.c)
|
||||
add_executable(ib_write_bw ib/write_bw.c ib/get_clock.c ib/perftest_parameters.c
|
||||
ib/perftest_resources.c ib/perftest_communication.c)
|
||||
target_link_libraries(ib_write_bw pthread)
|
||||
# add_executable(ib_write_bw ib/write_bw.c ib/get_clock.c ib/perftest_parameters.c
|
||||
# ib/perftest_resources.c ib/perftest_communication.c)
|
||||
add_executable(ib_write_bw ib/write_bw.c ib/get_clock.c
|
||||
ib/perftest_parameters_write_bw.c ib/perftest_resources_write_bw.c
|
||||
ib/perftest_communication_write_bw.c)
|
||||
|
||||
add_executable(netio netio.c)
|
||||
|
||||
|
|
|
@ -959,6 +959,7 @@ int ethernet_write_data(struct perftest_comm *comm, char *msg, size_t size)
|
|||
return 0;
|
||||
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
******************************************************************************/
|
||||
|
|
1013
usr/benchmarks/ib/perftest_communication_write_bw.c
Executable file
1013
usr/benchmarks/ib/perftest_communication_write_bw.c
Executable file
File diff suppressed because it is too large
Load diff
417
usr/benchmarks/ib/perftest_communication_write_bw.h
Executable file
417
usr/benchmarks/ib/perftest_communication_write_bw.h
Executable file
|
@ -0,0 +1,417 @@
|
|||
/*
|
||||
* Copyright (c) 2011 Mellanox Technologies Ltd. All rights reserved.
|
||||
*
|
||||
* This software is available to you under a choice of one of two
|
||||
* licenses. You may choose to be licensed under the terms of the GNU
|
||||
* General Public License (GPL) Version 2, available from the file
|
||||
* COPYING in the main directory of this source tree, or the
|
||||
* OpenIB.org BSD license below:
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
|
||||
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
||||
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*
|
||||
* Author: Ido Shamay <idos@dev.mellanox.co.il>
|
||||
*
|
||||
* Description : ...
|
||||
*
|
||||
* Methods : ...
|
||||
*/
|
||||
|
||||
#ifndef PERFTEST_COMMUNICATION_WRITE_BW_H
|
||||
#define PERFTEST_COMMUNICATION_WRITE_BW_H
|
||||
|
||||
#include <netinet/in.h>
|
||||
|
||||
#include <hermit/ibv.h>
|
||||
#include <hermit/verbs.h>
|
||||
|
||||
#include "perftest_resources_write_bw.h"
|
||||
|
||||
/* Macro for 64 bit variables to switch to/from net */
|
||||
#if __BYTE_ORDER == __BIG_ENDIAN || __BYTE_ORDER == __LITTLE_ENDIAN
|
||||
#if __BYTE_ORDER == __BIG_ENDIAN
|
||||
#define ntoh_64(x) (x)
|
||||
#define hton_64(x) (x)
|
||||
#define ntoh_double(x) (x)
|
||||
#define hton_double(x) (x)
|
||||
#else
|
||||
#define ntoh_64(x) bswap_64(x)
|
||||
#define hton_64(x) bswap_64(x)
|
||||
#define ntoh_double(x) bswap_double(x)
|
||||
#define hton_double(x) bswap_double(x)
|
||||
#endif
|
||||
#else
|
||||
#error "Only BIG_ENDIAN and LITTLE_ENDIAN are supported."
|
||||
#endif
|
||||
|
||||
/* long is 64-bit in LP64 mode, 32-bit in LLP64 mode. */
|
||||
#if defined(_LP64) || defined(__LP64__)
|
||||
#define ntoh_long(x) ntoh_64(x)
|
||||
#define hton_long(x) hton_64(x)
|
||||
#else
|
||||
#define ntoh_long(x) ntohl(x)
|
||||
#define hton_long(x) htonl(x)
|
||||
#endif
|
||||
|
||||
/* int is 32-bit in both LP64 and LLP64 modes. */
|
||||
#define ntoh_int(x) (int) ntohl((uint32_t) (x))
|
||||
#define hton_int(x) (int) htonl((uint32_t) (x))
|
||||
|
||||
#define KEY_MSG_SIZE (59) /* Message size without gid. */
|
||||
#define KEY_MSG_SIZE_GID (108) /* Message size with gid (MGID as well). */
|
||||
#define SYNC_SPEC_ID (5)
|
||||
|
||||
/* The Format of the message we pass through sockets , without passing Gid. */
|
||||
#define KEY_PRINT_FMT "%04x:%04x:%06x:%06x:%08x:%016Lx:%08x"
|
||||
|
||||
/* The Format of the message we pass through sockets (With Gid). */
|
||||
#define KEY_PRINT_FMT_GID "%04x:%04x:%06x:%06x:%08x:%016Lx:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%08x:"
|
||||
|
||||
/* The Basic print format for all verbs. */
|
||||
#define BASIC_ADDR_FMT " %s address: LID %#04x QPN %#06x PSN %#06x"
|
||||
|
||||
/* Addition format string for READ - the outstanding reads. */
|
||||
#define READ_FMT " OUT %#04x"
|
||||
|
||||
/* The print format of the pingpong_dest element for RDMA verbs. */
|
||||
#define RDMA_FMT " RKey %#08x VAddr %#016Lx"
|
||||
|
||||
/* The print number of SRQ in case of XRC */
|
||||
#define XRC_FMT " SRQn %#08x"
|
||||
#define DC_FMT " SRQn %#08x"
|
||||
|
||||
/* The print format of a global address or a multicast address. */
|
||||
#define PERF_GID_FMT " %s: %02d:%02d:%02d:%02d:%02d:%02d:%02d:%02d:%02d:%02d:%02d:%02d:%02d:%02d:%02d:%02d\n"
|
||||
|
||||
/* The print format of a global address or a multicast address. */
|
||||
#define PERF_RAW_MGID_FMT " %s: %02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x\n"
|
||||
|
||||
struct perftest_comm {
|
||||
struct pingpong_context *rdma_ctx;
|
||||
struct perftest_parameters *rdma_params;
|
||||
};
|
||||
|
||||
/* bswap_double
|
||||
*
|
||||
* Description : swap byte order for double.
|
||||
*
|
||||
* Parameters :
|
||||
* x - input double variable
|
||||
*
|
||||
* Return Value : double after byte order being swapped.
|
||||
*/
|
||||
double bswap_double(double x);
|
||||
|
||||
|
||||
/* create_comm_struct
|
||||
*
|
||||
* Description : Creating the communication struct for Etherent.
|
||||
*
|
||||
* Parameters :
|
||||
* comm - An empty Communication struct.
|
||||
* user_param - Perftest parameters.
|
||||
*
|
||||
* Return Value : SUCCESS,FAILURE.
|
||||
*/
|
||||
int create_comm_struct (struct perftest_comm *comm,
|
||||
struct perftest_parameters *user_param);
|
||||
|
||||
|
||||
/* set_up_connection .
|
||||
*
|
||||
* Description : Fills the my_dest with all of the machine proporties.
|
||||
*
|
||||
*
|
||||
* Parameters :
|
||||
* ctx - Pingoong context after the ctx_init function.
|
||||
* user_param - Perftest parameters.
|
||||
* my_dest - An empty pingpong_dest struct.
|
||||
*
|
||||
* Return Value : SUCCESS,FAILURE.
|
||||
*/
|
||||
int set_up_connection(struct pingpong_context *ctx,
|
||||
struct perftest_parameters *user_param,
|
||||
struct pingpong_dest *my_dest);
|
||||
|
||||
/* establish_connection .
|
||||
*
|
||||
* Description :
|
||||
*
|
||||
* Connect the client to a well known server to a requested port.
|
||||
* It assumes the Server is waiting for request on the port.
|
||||
* It uses Ethernet sockets.
|
||||
*
|
||||
* Parameters :
|
||||
* comm - The communication struct with all the data.
|
||||
*
|
||||
* Return Value : SUCCESS,FAILURE.
|
||||
*/
|
||||
int establish_connection(struct perftest_comm *comm);
|
||||
|
||||
/* retry_rdma_connect .
|
||||
*
|
||||
* Description : Retries rdma_client_connect() because the listener may not be ready
|
||||
* when the rdma client attempts to connect
|
||||
*
|
||||
* Parameters :
|
||||
* ctx - An empty resources struct to fill the resources created for this QP.
|
||||
* user_param - Perftest parameters.
|
||||
*
|
||||
* Return Value : SUCCESS,FAILURE.
|
||||
*/
|
||||
int retry_rdma_connect(struct pingpong_context *ctx,
|
||||
struct perftest_parameters *user_param);
|
||||
|
||||
/* ctx_hand_shake .
|
||||
*
|
||||
* Description :
|
||||
*
|
||||
* Exchanging the data , represented in struct pingpong_dest , between
|
||||
* a server and client that performed the ctx_server/clinet_connect.
|
||||
* The method fills in rem_dest the remote machine data , and passed the data
|
||||
* in my_dest to other machine.
|
||||
*
|
||||
* Parameters :
|
||||
*
|
||||
* params - The parameters needed for this method. Are mentioned above ,and
|
||||
* contains standard IB info. (exists on perftest).
|
||||
* my_dest - Contains the data you want to pass to the other side.
|
||||
* rem_dest - The other side data.
|
||||
*
|
||||
* Return Value : 0 upon success. -1 if it fails.
|
||||
*/
|
||||
int ctx_hand_shake(struct perftest_comm *comm,
|
||||
struct pingpong_dest *my_dest,
|
||||
struct pingpong_dest *rem_dest);
|
||||
|
||||
|
||||
|
||||
/* ctx_print_pingpong_data.
|
||||
*
|
||||
* Description :
|
||||
*
|
||||
* Prints the data stored in the struct pingpong_dest.
|
||||
*
|
||||
* Parameters :
|
||||
*
|
||||
* params - The parameters of the machine.
|
||||
* element - The element to print.
|
||||
*/
|
||||
void ctx_print_pingpong_data(struct pingpong_dest *element,
|
||||
struct perftest_comm *comm);
|
||||
|
||||
/* ctx_close_connection .
|
||||
*
|
||||
* Description :
|
||||
*
|
||||
* Close the connection between the 2 machines.
|
||||
* It performs an handshake to ensure the 2 sides are there.
|
||||
*
|
||||
* Parameters :
|
||||
*
|
||||
* params - The parameters of the machine
|
||||
* my_dest ,rem_dest - The 2 sides that ends the connection.
|
||||
*
|
||||
* Return Value : 0 upon success. -1 if it fails.
|
||||
*/
|
||||
int ctx_close_connection(struct perftest_comm *comm,
|
||||
struct pingpong_dest *my_dest,
|
||||
struct pingpong_dest *rem_dest);
|
||||
|
||||
/* ctx_xchg_data .
|
||||
*
|
||||
* Description :
|
||||
*
|
||||
* Exchanging data between
|
||||
* a server and client after performing ctx_server/client_connect.
|
||||
* The method fills in rem_data the remote machine data , and passed the data
|
||||
* in my_dest to other machine.
|
||||
*
|
||||
* Parameters :
|
||||
*
|
||||
* comm - contains connections info
|
||||
* my_data - Contains the data you want to pass to the other side.
|
||||
* rem_data - The other side data.
|
||||
* size - size of my_data (after casting is made)
|
||||
*
|
||||
* Return Value : 0 upon success. -1 if it fails.
|
||||
*/
|
||||
int ctx_xchg_data( struct perftest_comm *comm,
|
||||
void *my_data,
|
||||
void *rem_data,int size);
|
||||
|
||||
/* ethernet_write_data .
|
||||
*
|
||||
* Description :
|
||||
*
|
||||
* Sends data that is written in msg using ethernet
|
||||
* This functions can send any basic type (int,float,double,char*,string, etc..).
|
||||
* If you need to send a struct, decoder and encoder must be implemented to convert
|
||||
* the struct to a string
|
||||
*
|
||||
* Parameters :
|
||||
*
|
||||
* comm - contains connections info
|
||||
* msg - message that will be sent
|
||||
* size - size of the message
|
||||
* Return Value : 0 upon success. -1 if it fails.
|
||||
*/
|
||||
int ethernet_write_data(struct perftest_comm *comm, char *msg, size_t size);
|
||||
|
||||
/* ethernet_read_data .
|
||||
*
|
||||
* Description :
|
||||
*
|
||||
* Read data from remote machine using ethernet.
|
||||
*
|
||||
* Parameters :
|
||||
*
|
||||
* comm - contains connections info
|
||||
* recv_msg - function will return, in this argument, the message from remote machine
|
||||
* size - size of the message
|
||||
* Return Value : 0 upon success. -1 if it fails.
|
||||
*/
|
||||
int ethernet_read_data(struct perftest_comm *comm, char *recv_msg, size_t size);
|
||||
|
||||
/* rdma_write_data .
|
||||
*
|
||||
* Description :
|
||||
*
|
||||
* Sends data that to remote machine using RDMA.
|
||||
* This functions can send any variable type
|
||||
*
|
||||
* Parameters :
|
||||
*
|
||||
* data - data that will be sent
|
||||
* comm - contains connections info
|
||||
* size - size of data
|
||||
* Return Value : 0 upon success. -1 if it fails.
|
||||
*/
|
||||
int rdma_write_data(void *data, struct perftest_comm *comm, int size);
|
||||
|
||||
/* rdma_read_data .
|
||||
*
|
||||
* Description :
|
||||
*
|
||||
* Reads data from remote machine using RDMA.
|
||||
* This functions can read any variable type
|
||||
*
|
||||
* Parameters :
|
||||
*
|
||||
* data - data that will be sent
|
||||
* comm - contains connections info
|
||||
* size - size of data
|
||||
* Return Value : 0 upon success. -1 if it fails.
|
||||
* Return Value : 0 upon success. -1 if it fails.
|
||||
*/
|
||||
int rdma_read_data(void *data, struct perftest_comm *comm, int size);
|
||||
|
||||
/* ctx_xchg_data .
|
||||
*
|
||||
* Description :
|
||||
*
|
||||
* Implements ctx_xchg_data for ethernet
|
||||
*
|
||||
* Parameters :
|
||||
*
|
||||
* comm - contains connections info
|
||||
* my_data - Contains the data you want to pass to the other side.
|
||||
* rem_data - The other side data.
|
||||
* size - size of my_data (after casting is made)
|
||||
*
|
||||
* Return Value : 0 upon success. -1 if it fails.
|
||||
*/
|
||||
int ctx_xchg_data_ethernet( struct perftest_comm *comm, void *my_data, void *rem_data,int size);
|
||||
|
||||
/* ctx_xchg_data .
|
||||
*
|
||||
* Description :
|
||||
*
|
||||
* Implements ctx_xchg_data for RDMA
|
||||
*
|
||||
* Parameters :
|
||||
*
|
||||
* comm - contains connections info
|
||||
* my_data - Contains the data you want to pass to the other side.
|
||||
* rem_data - The other side data.
|
||||
* size - size of my_data (after casting is made)
|
||||
*
|
||||
* Return Value : 0 upon success. -1 if it fails.
|
||||
*/
|
||||
int ctx_xchg_data_rdma( struct perftest_comm *comm, void *my_data, void *rem_data,int size);
|
||||
|
||||
/* ctx_xchg_data .
|
||||
*
|
||||
* Description :
|
||||
*
|
||||
* Exchanging bw reports between
|
||||
* a server and client after performing ctx_server/client_connect.
|
||||
* The method fills in rem_data the remote machine data , and passed the data
|
||||
* in my_dest to other machine.
|
||||
*
|
||||
* Parameters :
|
||||
*
|
||||
* comm - contains connections info
|
||||
* my_bw_rep - Contains the data you want to pass to the other side.
|
||||
* rem_bw_rep - The other side data.
|
||||
*
|
||||
* Return Value : 0 upon success. -1 if it fails.
|
||||
*/
|
||||
void xchg_bw_reports (struct perftest_comm *comm, struct bw_report_data *my_bw_rep,
|
||||
struct bw_report_data *rem_bw_rep, float remote_version);
|
||||
|
||||
/* exchange_versions.
|
||||
*
|
||||
* Description :
|
||||
* Exchange versions between sides.
|
||||
*
|
||||
*/
|
||||
void exchange_versions (struct perftest_comm *user_comm, struct perftest_parameters *user_param);
|
||||
|
||||
/* check_sys_data.
|
||||
*
|
||||
* Description :
|
||||
* Exchange system data between sides.
|
||||
*
|
||||
*/
|
||||
void check_sys_data(struct perftest_comm *user_comm, struct perftest_parameters *user_param);
|
||||
|
||||
/* check_mtu
|
||||
*
|
||||
* Description : Configures test MTU.
|
||||
*
|
||||
* Parameters :
|
||||
*
|
||||
* context - Context of the device.
|
||||
* user_param - Perftest parameters.
|
||||
* user_comm - user communication struct.
|
||||
* Return Value : SUCCESS, FAILURE.
|
||||
*/
|
||||
int check_mtu(struct ibv_context *context,struct perftest_parameters *user_param, struct perftest_comm *user_comm);
|
||||
|
||||
int ctx_check_gid_compatibility(struct pingpong_dest *my_dest,
|
||||
struct pingpong_dest *rem_dest);
|
||||
|
||||
#endif /* PERFTEST_COMMUNICATION_H */
|
||||
|
||||
|
||||
|
File diff suppressed because it is too large
Load diff
1411
usr/benchmarks/ib/perftest_parameters_write_bw.c
Executable file
1411
usr/benchmarks/ib/perftest_parameters_write_bw.c
Executable file
File diff suppressed because it is too large
Load diff
752
usr/benchmarks/ib/perftest_parameters_write_bw.h
Executable file
752
usr/benchmarks/ib/perftest_parameters_write_bw.h
Executable file
|
@ -0,0 +1,752 @@
|
|||
/*
|
||||
* Copyright (c) 2009 Mellanox Technologies Ltd. All rights reserved.
|
||||
*
|
||||
* This software is available to you under a choice of one of two
|
||||
* licenses. You may choose to be licensed under the terms of the GNU
|
||||
* General Public License (GPL) Version 2, available from the file
|
||||
* COPYING in the main directory of this source tree, or the
|
||||
* OpenIB.org BSD license below:
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
|
||||
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
||||
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*
|
||||
* Author: Ido Shamay <idos@dev.mellanox.co.il>
|
||||
*
|
||||
* Description :
|
||||
*
|
||||
* This API defines structs, formats and enums for all perftest benchmarks.
|
||||
* It includes parameters parser, and a report generator.
|
||||
*
|
||||
* Methods :
|
||||
*
|
||||
* link_layer_str - Return a String representation of the link type.
|
||||
* parser - Setting default test parameters and parsing the user choices.
|
||||
* check_link - Configures test MTU,inline and link layer of the test.
|
||||
* check_link_and_mtu - Configures test MTU,inline and link layer of the test.
|
||||
* print_report_bw - Calculate the peak and average throughput of the BW test.
|
||||
* print_full_bw_report - Print the peak and average throughput of the BW test.
|
||||
* print_report_lat - Print the min/max/median latency samples taken from a latency test.
|
||||
* print_report_lat_duration - Prints only the avergae latency for samples taken from
|
||||
* a latency test with Duration..
|
||||
* set_mtu - set MTU from the port or user.
|
||||
* set_eth_mtu - set MTU for Raw Ethernet tests.
|
||||
*/
|
||||
|
||||
#ifndef PERFTEST_PARAMETERS_WRITE_BW_H
|
||||
#define PERFTEST_PARAMETERS_WRITE_BW_H
|
||||
|
||||
#include <hermit/ibv.h>
|
||||
#include <hermit/verbs.h>
|
||||
|
||||
#include <unistd.h>
|
||||
#include <malloc.h>
|
||||
#include <stddef.h>
|
||||
#include <netinet/in.h>
|
||||
#include <sys/socket.h>
|
||||
|
||||
// #include <endian.h>
|
||||
|
||||
#include "get_clock.h"
|
||||
|
||||
// #ifdef HAVE_CONFIG_H
|
||||
// #include <config.h>
|
||||
// #endif
|
||||
|
||||
/* ------------------------------------------------------------------- */
|
||||
/* Config TODO */
|
||||
|
||||
// #define HAVE_VERBS_EXP
|
||||
|
||||
// #define HAVE_RAW_ETH_EXP
|
||||
// #define HAVE_RAW_ETH_REG
|
||||
// #define HAVE_XRCD
|
||||
|
||||
#define HAVE_ENDIAN
|
||||
// #define HAVE_SCIF
|
||||
// #define HAVE_MASKED_ATOMICS
|
||||
// #define HAVE_RSS_EXP
|
||||
// #define HAVE_DC
|
||||
// #define HAVE_ACCL_VERBS
|
||||
|
||||
#define HAVE_IPV6
|
||||
#define HAVE_IPV4_EXT
|
||||
|
||||
#define HAVE_SNIFFER
|
||||
// #define HAVE_SNIFFER_EXP
|
||||
|
||||
#define HAVE_EX
|
||||
|
||||
#define HAVE_EX_ODP
|
||||
// #define HAVE_EXP_ODP
|
||||
|
||||
// #define HAVE_CUDA
|
||||
// #define HAVE_SCATTER_FCS
|
||||
// #define HAVE_GID_ATTR
|
||||
|
||||
// #define HAVE_PACKET_PACING_EXP
|
||||
#define HAVE_PACKET_PACING
|
||||
|
||||
// #define HAVE_OOO_ATTR
|
||||
// #define HAVE_EXP_OOO_ATTR
|
||||
|
||||
#define VERSION "1"
|
||||
|
||||
/* ------------------------------------------------------------------- */
|
||||
|
||||
/* Connection types available. */
|
||||
#define RC (0)
|
||||
#define UC (1)
|
||||
#define UD (2)
|
||||
#define RawEth (3)
|
||||
#define XRC (4)
|
||||
#define DC (5)
|
||||
|
||||
/* Genral control definitions */
|
||||
#define OFF (0)
|
||||
#define ON (1)
|
||||
#define SUCCESS (0)
|
||||
#define FAILURE (1)
|
||||
#define VERSION_EXIT (10)
|
||||
#define HELP_EXIT (11)
|
||||
#define MTU_FIX (7)
|
||||
#define MAX_SIZE (8388608)
|
||||
#define LINK_FAILURE (-1)
|
||||
#define LINK_UNSPEC (-2)
|
||||
#define MAX_OUT_READ_HERMON (16)
|
||||
#define MAX_OUT_READ (4)
|
||||
#define UD_ADDITION (40)
|
||||
#define RAWETH_ADDITION (18)
|
||||
#define HW_CRC_ADDITION (4)
|
||||
|
||||
/* Default Values of perftest parameters */
|
||||
#define DEF_PORT (18515)
|
||||
#define DEF_IB_PORT (1)
|
||||
#define DEF_IB_PORT2 (2)
|
||||
#define DEF_SIZE_BW (65536)
|
||||
#define DEF_SIZE_LAT (2)
|
||||
#define DEF_ITERS (1000)
|
||||
#define DEF_ITERS_WB (5000)
|
||||
#define DEF_TX_BW (128)
|
||||
#define DEF_TX_LAT (1)
|
||||
#define DEF_QP_TIME (14)
|
||||
#define DEF_SL (0)
|
||||
#define DEF_GID_INDEX (-1)
|
||||
#define DEF_NUM_QPS (1)
|
||||
#define DEF_RX_RDMA (1)
|
||||
#define DEF_RX_SEND (512)
|
||||
#define DEF_CQ_MOD (100)
|
||||
#define DEF_SIZE_ATOMIC (8)
|
||||
#define DEF_QKEY 0x11111111
|
||||
#define DEF_DURATION (5)
|
||||
#define DEF_MARGIN (2)
|
||||
#define DEF_INIT_MARGIN (-1)
|
||||
#define DEF_INLINE (-1)
|
||||
#define DEF_TOS (-1)
|
||||
#define DEF_RETRY_COUNT (7)
|
||||
#define DEF_CACHE_LINE_SIZE (64)
|
||||
#define DEF_PAGE_SIZE (4096)
|
||||
#define DEF_FLOWS (1)
|
||||
#define RATE_VALUES_COUNT (18)
|
||||
#define SERVER_NAME "137.226.133.151"
|
||||
|
||||
/* Optimal Values for Inline */
|
||||
#define DEF_INLINE_WRITE (220)
|
||||
#define DEF_INLINE_SEND_RC_UC (236)
|
||||
#define DEF_INLINE_SEND_XRC (236)
|
||||
#define DEF_INLINE_SEND_UD (188)
|
||||
#define DEF_INLINE_DC (150)
|
||||
|
||||
/* Max and Min allowed values for perftest parameters. */
|
||||
#define MIN_TOS (0)
|
||||
#define MAX_TOS (255)
|
||||
#define MIN_IB_PORT (1)
|
||||
#define MAX_IB_PORT (3)
|
||||
#define MIN_ITER (5)
|
||||
#define MAX_ITER (100000000)
|
||||
#define MIN_TX (1)
|
||||
#define MAX_TX (15000)
|
||||
#define MIN_SL (0)
|
||||
#define MAX_SL (15)
|
||||
#define MIN_GID_IX (0)
|
||||
#define MAX_GID_IX (64)
|
||||
#define MIN_QP_NUM (1)
|
||||
#define MAX_QP_NUM (16384)
|
||||
#define MIN_QP_MCAST (1)
|
||||
#define MAX_QP_MCAST (56)
|
||||
#define MIN_RX (1)
|
||||
#define MAX_RX (16384)
|
||||
#define UC_MAX_RX (16000)
|
||||
#define MIN_CQ_MOD (1)
|
||||
#define MAX_CQ_MOD (1024)
|
||||
#define MAX_INLINE (912)
|
||||
#define MAX_INLINE_UD (884)
|
||||
#define MIN_EQ_NUM (0)
|
||||
#define MAX_EQ_NUM (2048)
|
||||
|
||||
/* Raw etherent defines */
|
||||
#define RAWETH_MIN_MSG_SIZE (64)
|
||||
#define MIN_MTU_RAW_ETERNET (64)
|
||||
#define MAX_MTU_RAW_ETERNET (9600)
|
||||
#define MIN_FS_PORT (5000)
|
||||
#define MAX_FS_PORT (65536)
|
||||
#define VLAN_PCP_VARIOUS (8)
|
||||
|
||||
#define RESULT_LINE "---------------------------------------------------------------------------------------\n"
|
||||
|
||||
#define RESULT_LINE_PER_PORT "-------------------------------------------------------------------------------------------------------------------------------------------------------------------\n"
|
||||
#define CYCLES "cycles"
|
||||
#define USEC "usec"
|
||||
|
||||
/* The format of the results */
|
||||
#define RESULT_FMT " #bytes #iterations BW peak[MB/sec] BW average[MB/sec] MsgRate[Mpps]"
|
||||
#define RESULT_FMT_PER_PORT " #bytes #iterations BW peak[MB/sec] BW average[MB/sec] MsgRate[Mpps] BW Port1[MB/sec] MsgRate Port1[Mpps] BW Port2[MB/sec] MsgRate Port2[Mpps]"
|
||||
#define RESULT_FMT_G " #bytes #iterations BW peak[Gb/sec] BW average[Gb/sec] MsgRate[Mpps]"
|
||||
#define RESULT_FMT_G_PER_PORT " #bytes #iterations BW peak[Gb/sec] BW average[Gb/sec] MsgRate[Mpps] BW Port1[Gb/sec] MsgRate Port1[Mpps] BW Port2[Gb/sec] MsgRate Port2[Mpps]"
|
||||
#define RESULT_FMT_QOS " #bytes #sl #iterations BW peak[MB/sec] BW average[MB/sec] MsgRate[Mpps]"
|
||||
#define RESULT_FMT_G_QOS " #bytes #sl #iterations BW peak[Gb/sec] BW average[Gb/sec] MsgRate[Mpps]"
|
||||
#define RESULT_FMT_LAT " #bytes #iterations t_min[usec] t_max[usec] t_typical[usec] t_avg[usec] t_stdev[usec] 99""%"" percentile[usec] 99.9""%"" percentile[usec] "
|
||||
#define RESULT_FMT_LAT_DUR " #bytes #iterations t_avg[usec] tps average"
|
||||
|
||||
#define RESULT_EXT "\n"
|
||||
#define RESULT_EXT_CPU_UTIL " CPU_Util[%%]\n"
|
||||
|
||||
#define RESULT_FMT_FS_RATE " #flows fs_min_time[usec] fs_max_time[usec] fs_typical_time[usec] fs_avg_time[usec] fps[flow per sec]"
|
||||
#define RESULT_FMT_FS_RATE_DUR " #flows fs_avg_time[usec] fps[flow per sec]"
|
||||
|
||||
/* Result print format */
|
||||
#define REPORT_FMT " %-7lu %-10lu %-7.2lf %-7.2lf %-7.6lf"
|
||||
#define REPORT_FMT_EXT " %-7lu %lu %-7.6lf %-7.6lf %-7.6lf"
|
||||
#define REPORT_FMT_PER_PORT " %-7lu %-10lu %-7.2lf %-7.2lf %-7.6lf %-7.2lf %-7.6lf %-7.2lf %-7.6lf"
|
||||
#define REPORT_EXT "\n"
|
||||
#define REPORT_EXT_CPU_UTIL " %-3.2f\n"
|
||||
#define REPORT_FMT_QOS " %-7lu %d %lu %-7.2lf %-7.2lf %-7.6lf\n"
|
||||
|
||||
/* Result print format for latency tests. */
|
||||
#define REPORT_FMT_LAT " %-7lu %d %-7.2f %-7.2f %-7.2f %-7.2f %-7.2f %-7.2f %-7.2f"
|
||||
#define REPORT_FMT_LAT_DUR " %-7lu %d %-7.2f %-7.2f"
|
||||
#define REPORT_FMT_FS_RATE " %d %-7.2f %-7.2f %-7.2f %-7.2f %-7.2f"
|
||||
#define REPORT_FMT_FS_RATE_DUR " %d %-7.2f %-7.2f"
|
||||
|
||||
#define CHECK_VALUE(arg,type,minv,maxv,name) \
|
||||
{ arg = (type)strtol(optarg, NULL, 0); if ((arg < minv) || (arg > maxv)) \
|
||||
{ fprintf(stderr," %s should be between %d and %d\n",name,minv,maxv); return 1; }}
|
||||
|
||||
/* Macro for allocating. */
|
||||
#define ALLOCATE(var,type,size) \
|
||||
{ if((var = (type*)malloc(sizeof(type)*(size))) == NULL) \
|
||||
{ fprintf(stderr," Cannot Allocate\n"); exit(1);}}
|
||||
|
||||
/* This is our string builder */
|
||||
#define GET_STRING(orig,temp) \
|
||||
{ ALLOCATE(orig,char,(strlen(temp) + 1)); strcpy(orig,temp); }
|
||||
|
||||
#define MTU_SIZE(mtu_ind) (((uint64_t)1 << (MTU_FIX + mtu_ind)))
|
||||
|
||||
#define MAX_VERSION 16 /* Reserve 15 bytes for version numbers */
|
||||
|
||||
#define GET_ARRAY_SIZE(arr) (sizeof((arr)) / sizeof((arr[0])))
|
||||
|
||||
/* The Verb of the benchmark. */
|
||||
typedef enum { SEND , WRITE, READ, ATOMIC } VerbType;
|
||||
|
||||
/* The type of the test */
|
||||
typedef enum { LAT , BW , LAT_BY_BW, FS_RATE } TestType;
|
||||
|
||||
/* The type of the machine ( server or client actually). */
|
||||
typedef enum { SERVER , CLIENT , UNCHOSEN} MachineType;
|
||||
|
||||
/* The type of the machine ( server or client actually). */
|
||||
typedef enum { LOCAL , REMOTE } PrintDataSide;
|
||||
|
||||
/* The atomic test type */
|
||||
typedef enum {CMP_AND_SWAP, FETCH_AND_ADD} AtomicType;
|
||||
|
||||
/* Type of test method. */
|
||||
typedef enum { ITERATIONS , DURATION } TestMethod;
|
||||
|
||||
/* for duration calculation */
|
||||
typedef enum { START_STATE, SAMPLE_STATE, STOP_SAMPLE_STATE, END_STATE} DurationStates;
|
||||
|
||||
/* Report format (Gbit/s VS MB/s) */
|
||||
enum ctx_report_fmt { GBS, MBS };
|
||||
|
||||
/* Test method */
|
||||
enum ctx_test_method {RUN_REGULAR, RUN_ALL, RUN_INFINITELY};
|
||||
|
||||
/* The type of the device */
|
||||
enum ctx_device {
|
||||
DEVICE_ERROR = -1,
|
||||
UNKNOWN = 0,
|
||||
CONNECTX = 1,
|
||||
CONNECTX2 = 2,
|
||||
CONNECTX3 = 3,
|
||||
CONNECTIB = 4,
|
||||
LEGACY = 5,
|
||||
CHELSIO_T4 = 6,
|
||||
CHELSIO_T5 = 7,
|
||||
CONNECTX3_PRO = 8,
|
||||
SKYHAWK = 9,
|
||||
CONNECTX4 = 10,
|
||||
CONNECTX4LX = 11,
|
||||
QLOGIC_E4 = 12,
|
||||
QLOGIC_AH = 13,
|
||||
CHELSIO_T6 = 14,
|
||||
CONNECTX5 = 15,
|
||||
CONNECTX5EX = 16,
|
||||
CONNECTX6 = 17,
|
||||
BLUEFIELD = 18
|
||||
};
|
||||
|
||||
/* Units for rate limiter */
|
||||
enum rate_limiter_units {MEGA_BYTE_PS, GIGA_BIT_PS, PACKET_PS};
|
||||
|
||||
/*Types rate limit*/
|
||||
enum rate_limiter_types {HW_RATE_LIMIT, SW_RATE_LIMIT, PP_RATE_LIMIT, DISABLE_RATE_LIMIT};
|
||||
|
||||
/* Verbosity Levels for test report */
|
||||
enum verbosity_level {FULL_VERBOSITY=-1, OUTPUT_BW=0, OUTPUT_MR, OUTPUT_LAT };
|
||||
|
||||
/*Accelerated verbs */
|
||||
enum verbs_intf {
|
||||
NORMAL_INTF,
|
||||
ACCL_INTF,
|
||||
};
|
||||
|
||||
struct cpu_util_data {
|
||||
int enable;
|
||||
long long ustat[2];
|
||||
long long idle[2];
|
||||
};
|
||||
|
||||
struct check_alive_data {
|
||||
int current_totrcnt;
|
||||
int last_totrcnt;
|
||||
int g_total_iters;
|
||||
int to_exit;
|
||||
int is_events;
|
||||
};
|
||||
|
||||
/* gen_eth_header .
|
||||
* Description :create raw Ethernet header on buffer
|
||||
*
|
||||
* Parameters :
|
||||
* eth_header - Pointer to output
|
||||
* src_mac - source MAC address of the packet
|
||||
* dst_mac - destination MAC address of the packet
|
||||
* eth_type - IP/or size of ptk
|
||||
*
|
||||
*
|
||||
struct ETH_header {
|
||||
uint8_t dst_mac[6];
|
||||
uint8_t src_mac[6];
|
||||
uint16_t eth_type;
|
||||
}__attribute__((packed));
|
||||
|
||||
struct ETH_vlan_header {
|
||||
uint8_t dst_mac[6];
|
||||
uint8_t src_mac[6];
|
||||
uint32_t vlan_header;
|
||||
uint16_t eth_type;
|
||||
}__attribute__((packed));*/
|
||||
|
||||
struct perftest_parameters {
|
||||
int port;
|
||||
char *ib_devname;
|
||||
char *servername;
|
||||
uint8_t ib_port;
|
||||
uint8_t ib_port2;
|
||||
|
||||
int mtu; // minimum translation unit
|
||||
enum ibv_mtu curr_mtu;
|
||||
uint64_t size; // BW: 65536, LAT: 2
|
||||
uint64_t dct_key;
|
||||
int iters;
|
||||
|
||||
uint64_t iters_per_port[2];
|
||||
uint64_t *port_by_qp;
|
||||
|
||||
int tx_depth; // <= iters
|
||||
uint8_t qp_timeout;
|
||||
uint8_t sl; // service lvl
|
||||
int gid_index;
|
||||
int gid_index2;
|
||||
int use_gid_user;
|
||||
uint8_t source_mac[6];
|
||||
uint8_t dest_mac[6];
|
||||
int is_source_mac;
|
||||
int is_dest_mac;
|
||||
uint8_t server_ip6[16];
|
||||
uint8_t client_ip6[16];
|
||||
uint8_t local_ip6[16];
|
||||
uint8_t remote_ip6[16];
|
||||
uint8_t local_mac[6];
|
||||
uint8_t remote_mac[6];
|
||||
uint32_t client_ip;
|
||||
uint32_t server_ip;
|
||||
int is_server_ip;
|
||||
int is_client_ip;
|
||||
uint32_t local_ip;
|
||||
uint32_t remote_ip;
|
||||
int server_port;
|
||||
int client_port;
|
||||
int tcp;
|
||||
int is_server_port;
|
||||
int is_client_port;
|
||||
int local_port;
|
||||
int remote_port;
|
||||
int is_old_raw_eth_param;
|
||||
int is_new_raw_eth_param;
|
||||
uint16_t ethertype;
|
||||
int is_ethertype;
|
||||
int cpu_freq_f;
|
||||
int connection_type;
|
||||
int num_of_qps;
|
||||
int use_event;
|
||||
int eq_num;
|
||||
int use_eq_num;
|
||||
int inline_size;
|
||||
int inline_recv_size;
|
||||
int out_reads;
|
||||
int rx_depth;
|
||||
int duplex;
|
||||
int noPeak;
|
||||
int cq_mod;
|
||||
int spec;
|
||||
int dualport;
|
||||
int post_list;
|
||||
int duration;
|
||||
int use_srq;
|
||||
int use_xrc;
|
||||
int use_rss;
|
||||
int srq_exists;
|
||||
int tos;
|
||||
int margin;
|
||||
int is_bw_limit_passed;
|
||||
int is_msgrate_limit_passed;
|
||||
int is_limit_bw;
|
||||
int is_limit_msgrate;
|
||||
float limit_bw;
|
||||
float limit_msgrate;
|
||||
uint32_t rem_ud_qpn;
|
||||
uint32_t rem_ud_qkey;
|
||||
int8_t link_type;
|
||||
int8_t link_type2;
|
||||
MachineType machine;
|
||||
PrintDataSide side;
|
||||
VerbType verb;
|
||||
TestType tst;
|
||||
AtomicType atomicType;
|
||||
TestMethod test_type;
|
||||
DurationStates state;
|
||||
int sockfd;
|
||||
char version[MAX_VERSION];
|
||||
char rem_version[MAX_VERSION];
|
||||
cycles_t *tposted;
|
||||
cycles_t *tcompleted;
|
||||
int use_mcg;
|
||||
int use_rdma_cm;
|
||||
int is_reversed;
|
||||
int work_rdma_cm;
|
||||
char *user_mgid;
|
||||
int buff_size;
|
||||
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;
|
||||
enum ctx_report_fmt report_fmt;
|
||||
struct report_options *r_flag ;
|
||||
int mac_fwd;
|
||||
int report_both; /* in bidirectional tests, report tx and rx separately */
|
||||
/* results limits */
|
||||
float min_bw_limit;
|
||||
float min_msgRate_limit;
|
||||
/* Rate Limiter */
|
||||
char *rate_limit_str;
|
||||
double rate_limit;
|
||||
int valid_hw_rate_limit;
|
||||
int burst_size;
|
||||
enum rate_limiter_units rate_units;
|
||||
enum rate_limiter_types rate_limit_type;
|
||||
int is_rate_limit_type;
|
||||
enum verbosity_level output;
|
||||
int cpu_util;
|
||||
struct cpu_util_data cpu_util_data;
|
||||
int latency_gap;
|
||||
int flow_label;
|
||||
int retry_count;
|
||||
int dont_xchg_versions;
|
||||
int use_exp;
|
||||
int ipv6;
|
||||
int raw_ipv6;
|
||||
int report_per_port;
|
||||
int use_odp;
|
||||
int use_hugepages;
|
||||
int use_promiscuous;
|
||||
int use_sniffer;
|
||||
int check_alive_exited;
|
||||
int raw_mcast;
|
||||
int masked_atomics;
|
||||
int cycle_buffer;
|
||||
int cache_line_size;
|
||||
enum verbs_intf verb_type;
|
||||
int is_exp_cq;
|
||||
int is_exp_qp;
|
||||
int use_res_domain;
|
||||
int mr_per_qp;
|
||||
uint16_t dlid;
|
||||
uint8_t traffic_class;
|
||||
uint32_t wait_destroy;
|
||||
int disable_fcs;
|
||||
int flows;
|
||||
int flows_burst;
|
||||
uint32_t reply_every;
|
||||
int perform_warm_up;
|
||||
int use_ooo;
|
||||
int vlan_en;
|
||||
uint32_t vlan_pcp;
|
||||
// void (*print_eth_func)(void*);
|
||||
};
|
||||
|
||||
struct report_options {
|
||||
int unsorted;
|
||||
int histogram;
|
||||
int cycles;
|
||||
};
|
||||
|
||||
struct bw_report_data {
|
||||
unsigned long size;
|
||||
uint64_t iters;
|
||||
double bw_peak;
|
||||
double bw_avg;
|
||||
double bw_avg_p1;
|
||||
double bw_avg_p2;
|
||||
double msgRate_avg;
|
||||
double msgRate_avg_p1;
|
||||
double msgRate_avg_p2;
|
||||
int sl;
|
||||
};
|
||||
|
||||
struct rate_gbps_string {
|
||||
enum ibv_rate rate_gbps_enum;
|
||||
char* rate_gbps_str;
|
||||
};
|
||||
/*
|
||||
*Enums taken from verbs.h
|
||||
*/
|
||||
static const struct rate_gbps_string RATE_VALUES[RATE_VALUES_COUNT] = {
|
||||
{IBV_RATE_2_5_GBPS, "2.5"},
|
||||
{IBV_RATE_5_GBPS, "5"},
|
||||
{IBV_RATE_10_GBPS, "10"},
|
||||
{IBV_RATE_14_GBPS, "14"},
|
||||
{IBV_RATE_20_GBPS, "20"},
|
||||
{IBV_RATE_25_GBPS, "25"},
|
||||
{IBV_RATE_30_GBPS, "30"},
|
||||
{IBV_RATE_40_GBPS, "40"},
|
||||
{IBV_RATE_56_GBPS, "56"},
|
||||
{IBV_RATE_60_GBPS, "60"},
|
||||
{IBV_RATE_80_GBPS, "80"},
|
||||
{IBV_RATE_100_GBPS, "100"},
|
||||
{IBV_RATE_112_GBPS, "112"},
|
||||
{IBV_RATE_120_GBPS, "120"},
|
||||
{IBV_RATE_168_GBPS, "168"},
|
||||
{IBV_RATE_200_GBPS, "200"},
|
||||
{IBV_RATE_300_GBPS, "300"},
|
||||
{IBV_RATE_MAX, "MAX"}
|
||||
};
|
||||
|
||||
|
||||
|
||||
/* link_layer_str
|
||||
*
|
||||
* Description : Return a String representation of the link type.
|
||||
*
|
||||
* link_layer : (According to verbs.h) :
|
||||
* IBV_LINK_LAYER_UNSPECIFIED.
|
||||
* IBV_LINK_LAYER_INFINIBAND.
|
||||
* IBV_LINK_LAYER_ETHERNET.
|
||||
*
|
||||
* Return Value :"IB", "Etherent" or "Unknown".
|
||||
*/
|
||||
const char *link_layer_str(int8_t link_layer);
|
||||
|
||||
/* str_link_layer
|
||||
*
|
||||
* Description : Try to parse a string into a verbs link layer type.
|
||||
*
|
||||
* link_layer : (According to verbs.h) :
|
||||
* "IB" -> IBV_LINK_LAYER_INFINIBAND.
|
||||
* "Ethernet" -> IBV_LINK_LAYER_ETHERNET.
|
||||
* otherwise -> LINK_FAILURE.
|
||||
*
|
||||
* Return Value : IBV_LINK_LAYER or LINK_FAILURE
|
||||
*/
|
||||
const int str_link_layer(const char *str);
|
||||
|
||||
/* parser
|
||||
*
|
||||
* Description : Setting default test parameters and parsing the user choises
|
||||
*
|
||||
* Parameters :
|
||||
*
|
||||
* user_param - the parameters element.
|
||||
* argv & argc - from the user prompt.
|
||||
*
|
||||
* Return Value : 0 upon success. -1 if it fails.
|
||||
*/
|
||||
int parser(struct perftest_parameters *user_param,char *argv[], int argc);
|
||||
|
||||
/* check_link_and_mtu
|
||||
*
|
||||
* Description : Configures test MTU,inline and link layer of the test.
|
||||
*
|
||||
* Parameters :
|
||||
*
|
||||
* context - Context of the device.
|
||||
* user_param - Perftest parameters.
|
||||
*
|
||||
* Return Value : SUCCESS, FAILURE.
|
||||
*/
|
||||
int check_link(struct ibv_context *context,struct perftest_parameters *user_param);
|
||||
|
||||
/* check_link_and_mtu
|
||||
*
|
||||
* Description : Configures test MTU,inline and link layer of the test.
|
||||
*
|
||||
* Parameters :
|
||||
*
|
||||
|
||||
* context - Context of the device.
|
||||
* user_param - Perftest parameters.
|
||||
*
|
||||
* Return Value : SUCCESS, FAILURE.
|
||||
*/
|
||||
int check_link_and_mtu(struct ibv_context *context,struct perftest_parameters *user_param);
|
||||
|
||||
/* ctx_print_test_info
|
||||
*
|
||||
* Description : Prints all the parameters selected for this run.
|
||||
*
|
||||
* Parameters :
|
||||
*
|
||||
* user_param - the parameters parameters.
|
||||
*
|
||||
*/
|
||||
void ctx_print_test_info(struct perftest_parameters *user_param);
|
||||
|
||||
/* print_report_bw
|
||||
*
|
||||
* Description : Calculate the peak and average throughput of the BW test.
|
||||
* The function will print when not in duplex mode.
|
||||
*
|
||||
* Parameters :
|
||||
*
|
||||
* user_param - the parameters parameters.
|
||||
* my_bw_rep - get my bw test report.
|
||||
*
|
||||
*/
|
||||
void print_report_bw (struct perftest_parameters *user_param, struct bw_report_data *my_bw_rep);
|
||||
|
||||
/* print_full_bw_report
|
||||
*
|
||||
* Description : Print the peak and average throughput of the BW test.
|
||||
* If rem_bw_rep is not NULL, the function will sum the server and client results.
|
||||
*
|
||||
* Parameters :
|
||||
*
|
||||
* user_param - the parameters parameters.
|
||||
* my_bw_rep - my bw test report.
|
||||
* rem_bw_rep - remote's bw test report.
|
||||
*
|
||||
*/
|
||||
void print_full_bw_report (struct perftest_parameters *user_param, struct bw_report_data *my_bw_rep, struct bw_report_data *rem_bw_rep);
|
||||
|
||||
/* print_report_lat
|
||||
*
|
||||
* Description : Print the min/max/median latency samples taken from a latency test.
|
||||
* It also support a unsorted/histogram report of all samples.
|
||||
*
|
||||
* Parameters :
|
||||
*
|
||||
* user_param - the parameters parameters.
|
||||
*
|
||||
*/
|
||||
void print_report_lat (struct perftest_parameters *user_param);
|
||||
|
||||
/* print_report_lat_duration
|
||||
*
|
||||
* Description : Prints only the avergae latency for samples taken from a latency test
|
||||
* With Duration.
|
||||
*
|
||||
* Parameters :
|
||||
*
|
||||
* user_param - the parameters parameters.
|
||||
*
|
||||
*/
|
||||
void print_report_lat_duration (struct perftest_parameters *user_param);
|
||||
|
||||
/* print_report_fs_rate
|
||||
*
|
||||
* Description : Prints the Flow steering rate and avarage latency to create flow
|
||||
*
|
||||
* Parameters :
|
||||
*
|
||||
* user_param - the parameters parameters.
|
||||
*
|
||||
*/
|
||||
void print_report_fs_rate (struct perftest_parameters *user_param);
|
||||
|
||||
/* set_mtu
|
||||
*
|
||||
* Description : set MTU from the port or user
|
||||
*
|
||||
* Parameters :
|
||||
*
|
||||
* context - Context of the device.
|
||||
* ib_port - ib port number that's in use.
|
||||
* user_mtu - MTU that the user supplied.
|
||||
*
|
||||
* Return Value : MTU size
|
||||
*/
|
||||
enum ibv_mtu set_mtu(struct ibv_context *context,uint8_t ib_port,int user_mtu);
|
||||
|
||||
/* set_eth_mtu
|
||||
*
|
||||
* Description : set MTU for Raw Ethernet tests
|
||||
*
|
||||
* Parameters :
|
||||
*
|
||||
* user_param - the parameters parameters.
|
||||
*
|
||||
* Return Value : MTU size
|
||||
*/
|
||||
int set_eth_mtu(struct perftest_parameters *user_param);
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
******************************************************************************/
|
||||
enum ctx_device ib_dev_name(struct ibv_context *context);
|
||||
|
||||
#endif /* PERFTEST_RESOURCES_H */
|
|
@ -2907,9 +2907,7 @@ int perform_warm_up(struct pingpong_context *ctx,struct perftest_parameters *use
|
|||
ne = ibv_poll_cq(ctx->send_cq,user_param->tx_depth,wc_for_cleaning);
|
||||
|
||||
for (index=0 ; index < num_of_qps ; index++) {
|
||||
|
||||
for (warmindex = 0 ;warmindex < warmupsession ;warmindex += user_param->post_list) {
|
||||
|
||||
#ifdef HAVE_VERBS_EXP
|
||||
if (user_param->use_exp == 1)
|
||||
err = (ctx->exp_post_send_func_pointer)(ctx->qp[index],
|
||||
|
@ -2928,22 +2926,17 @@ int perform_warm_up(struct pingpong_context *ctx,struct perftest_parameters *use
|
|||
}
|
||||
|
||||
do {
|
||||
|
||||
ne = ibv_poll_cq(ctx->send_cq,1,&wc);
|
||||
if (ne > 0) {
|
||||
|
||||
if (wc.status != IBV_WC_SUCCESS) {
|
||||
return_value = FAILURE;
|
||||
goto cleaning;
|
||||
}
|
||||
|
||||
warmindex -= user_param->post_list;
|
||||
|
||||
} else if (ne < 0) {
|
||||
return_value = FAILURE;
|
||||
goto cleaning;
|
||||
}
|
||||
|
||||
} while (warmindex);
|
||||
}
|
||||
|
||||
|
@ -4762,6 +4755,7 @@ cleaning:
|
|||
free(wc);
|
||||
return return_value;
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
******************************************************************************/
|
||||
|
|
1796
usr/benchmarks/ib/perftest_resources_write_bw.c
Executable file
1796
usr/benchmarks/ib/perftest_resources_write_bw.c
Executable file
File diff suppressed because it is too large
Load diff
836
usr/benchmarks/ib/perftest_resources_write_bw.h
Executable file
836
usr/benchmarks/ib/perftest_resources_write_bw.h
Executable file
|
@ -0,0 +1,836 @@
|
|||
/*
|
||||
* Copyright (c) 2009 Mellanox Technologies Ltd. All rights reserved.
|
||||
*
|
||||
* This software is available to you under a choice of one of two
|
||||
* licenses. You may choose to be licensed under the terms of the GNU
|
||||
* General Public License (GPL) Version 2, available from the file
|
||||
* COPYING in the main directory of this source tree, or the
|
||||
* OpenIB.org BSD license below:
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
|
||||
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
||||
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*
|
||||
* Author: Ido Shamay <idos@dev.mellanox.co.il>
|
||||
*
|
||||
* Description :
|
||||
*
|
||||
* This API gathres the Socket interface methods for all perftest benchmarks
|
||||
* and can be used for any benchmark for IB.
|
||||
* It passes messages between 2 end points through sockets interface methods,
|
||||
* while passing the rellevant information for the IB entities.
|
||||
*
|
||||
* Methods :
|
||||
*
|
||||
* ctx_get_local_lid - Receives the Local id from the subnet manager.
|
||||
* ctx_client_connect - Connects the client through sockets interface.
|
||||
* ctx_server_connect - Connects the Server to client through sockets.
|
||||
* ctx_hand_shake - Passes the data between 2 end points machines.
|
||||
* ctx_print_pingpong_data - Prints the data that was passed.
|
||||
* ctx_close_connection - Closing the sockets interface.
|
||||
*/
|
||||
|
||||
#ifndef PERFTEST_RESOURCES_WRITE_BW_H
|
||||
#define PERFTEST_RESOURCES_WRITE_BW_H
|
||||
|
||||
#include <hermit/ibv.h>
|
||||
#include <hermit/verbs.h>
|
||||
|
||||
#include <stdint.h>
|
||||
#include <unistd.h>
|
||||
// #include <byteswap.h>
|
||||
#include <math.h>
|
||||
#include <netinet/in.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/types.h>
|
||||
// #include <sys/socket.h>
|
||||
#include <netdb.h>
|
||||
#include <fcntl.h> // ?
|
||||
|
||||
#include "perftest_parameters_write_bw.h"
|
||||
|
||||
#define NUM_OF_RETRIES (10)
|
||||
|
||||
/* Outstanding reads for "read" verb only. */
|
||||
#define MAX_SEND_SGE (1)
|
||||
#define MAX_RECV_SGE (1)
|
||||
#define CTX_POLL_BATCH (16)
|
||||
#define PL (1)
|
||||
#define ATOMIC_ADD_VALUE (1)
|
||||
#define ATOMIC_SWAP_VALUE (0)
|
||||
|
||||
/* Space for GRH when we scatter the packet in UD. */
|
||||
#define PINGPONG_SEND_WRID (60)
|
||||
#define PINGPONG_RDMA_WRID (3)
|
||||
#define PINGPONG_READ_WRID (1)
|
||||
#define PINGPONG_ATOMIC_WRID (22)
|
||||
#define DEFF_QKEY (0x11111111)
|
||||
|
||||
#ifdef HAVE_XRCD
|
||||
#define SERVER_FD "/tmp/xrc_domain_server"
|
||||
#define CLIENT_FD "/tmp/xrc_domain_client"
|
||||
#endif
|
||||
|
||||
|
||||
#define NOTIFY_COMP_ERROR_SEND(wc,scnt,ccnt) \
|
||||
{ fprintf(stderr," Completion with error at client\n"); \
|
||||
fprintf(stderr," Failed status %d: wr_id %d syndrom 0x%x\n",wc.status,(int) wc.wr_id,wc.vendor_err); \
|
||||
fprintf(stderr, "scnt=%lu, ccnt=%lu\n",scnt, ccnt); }
|
||||
|
||||
#define NOTIFY_COMP_ERROR_RECV(wc,rcnt) \
|
||||
{ fprintf(stderr," Completion with error at server\n"); \
|
||||
fprintf(stderr," Failed status %d: wr_id %d syndrom 0x%x\n",wc.status,(int) wc.wr_id,wc.vendor_err); \
|
||||
fprintf(stderr," rcnt=%lu\n",rcnt); }
|
||||
|
||||
/* Macro to determine packet size in case of UD. The UD addition is for the GRH . */
|
||||
#define SIZE(type,size,valid) ((type == UD && valid) ? (size + UD_ADDITION) : (size))
|
||||
|
||||
/* Macro to define the buffer size (according to "Nahalem" chip set).
|
||||
* for small message size (under 4K) , we allocate 4K buffer , and the RDMA write
|
||||
* verb will write in cycle on the buffer. this improves the BW in "Nahalem" systems.
|
||||
*/
|
||||
#define BUFF_SIZE(size,cycle_buffer) ((size < cycle_buffer) ? (cycle_buffer) : (size))
|
||||
|
||||
/* UD addition to the buffer. */
|
||||
#define IF_UD_ADD(type,cache_line_size) ((type == UD) ? (cache_line_size) : (0))
|
||||
|
||||
/* Macro that defines the address where we write in RDMA.
|
||||
* If message size is smaller then CACHE_LINE size then we write in CACHE_LINE jumps.
|
||||
*/
|
||||
#define INC(size,cache_line_size) ((size > cache_line_size) ? ((size%cache_line_size == 0) ? \
|
||||
(size) : (cache_line_size*(size/cache_line_size+1))) : (cache_line_size))
|
||||
|
||||
#define UD_MSG_2_EXP(size) ((log(size))/(log(2)))
|
||||
|
||||
#define MASK_IS_SET(mask, attr) (((mask)&(attr))!=0)
|
||||
|
||||
/******************************************************************************
|
||||
* Perftest resources Structures and data types.
|
||||
******************************************************************************/
|
||||
|
||||
struct pingpong_context {
|
||||
// struct rdma_event_channel *cm_channel;
|
||||
// struct rdma_cm_id *cm_id_control;
|
||||
// struct rdma_cm_id *cm_id;
|
||||
struct ibv_context *context;
|
||||
struct ibv_comp_channel *channel;
|
||||
struct ibv_pd *pd;
|
||||
struct ibv_mr **mr;
|
||||
struct ibv_cq *send_cq;
|
||||
struct ibv_cq *recv_cq;
|
||||
void **buf;
|
||||
struct ibv_ah **ah;
|
||||
struct ibv_qp **qp;
|
||||
struct ibv_srq *srq;
|
||||
struct ibv_sge *sge_list;
|
||||
struct ibv_sge *recv_sge_list;
|
||||
struct ibv_send_wr *wr;
|
||||
struct ibv_recv_wr *rwr;
|
||||
uint64_t size;
|
||||
uint64_t *my_addr;
|
||||
uint64_t *rx_buffer_addr;
|
||||
uint64_t *rem_addr;
|
||||
uint64_t buff_size;
|
||||
uint64_t send_qp_buff_size;
|
||||
uint64_t flow_buff_size;
|
||||
int tx_depth;
|
||||
int huge_shmid;
|
||||
uint64_t *scnt;
|
||||
uint64_t *ccnt;
|
||||
int is_contig_supported;
|
||||
uint32_t *ctrl_buf;
|
||||
uint32_t *credit_buf;
|
||||
struct ibv_mr *credit_mr;
|
||||
struct ibv_sge *ctrl_sge_list;
|
||||
struct ibv_send_wr *ctrl_wr;
|
||||
int send_rcredit;
|
||||
int credit_cnt;
|
||||
int cache_line_size;
|
||||
int cycle_buffer;
|
||||
#ifdef HAVE_XRCD
|
||||
struct ibv_xrcd *xrc_domain;
|
||||
int fd;
|
||||
#endif
|
||||
#ifdef HAVE_ACCL_VERBS
|
||||
struct ibv_exp_res_domain *res_domain;
|
||||
struct ibv_exp_cq_family *send_cq_family;
|
||||
struct ibv_exp_cq_family *recv_cq_family;
|
||||
struct ibv_exp_qp_burst_family **qp_burst_family;
|
||||
#endif
|
||||
};
|
||||
|
||||
struct pingpong_dest {
|
||||
int lid;
|
||||
int out_reads;
|
||||
int qpn;
|
||||
int psn;
|
||||
unsigned rkey;
|
||||
unsigned long long vaddr;
|
||||
union ibv_gid gid;
|
||||
unsigned srqn;
|
||||
int gid_index;
|
||||
};
|
||||
|
||||
struct raw_ethernet_info { // !
|
||||
uint8_t mac[6];
|
||||
uint32_t ip;
|
||||
uint8_t ip6[16];
|
||||
int port;
|
||||
};
|
||||
|
||||
/******************************************************************************
|
||||
* Perftest resources Methods and interface utilitizes.
|
||||
******************************************************************************/
|
||||
|
||||
/* check_add_port
|
||||
*
|
||||
* Description : Creating a service struct from a given port and servername.
|
||||
*
|
||||
* Parameters :
|
||||
* service - an empty char** to contain the service name.
|
||||
* port - The selected port on which the server will listen.
|
||||
* hints - The requested ai_* params for the connection.
|
||||
* res - Holds the result.
|
||||
*
|
||||
* Return Value : SUCCESS, FAILURE.
|
||||
*/
|
||||
// int check_add_port(char **service,int port,
|
||||
// const char *servername,
|
||||
// struct addrinfo *hints,
|
||||
// struct addrinfo **res);
|
||||
|
||||
/* ctx_find_dev
|
||||
*
|
||||
* Description : Returns the device corresponding to ib_devname
|
||||
* or the first one found , in case ib_devname == NULL
|
||||
*
|
||||
* Parameters :
|
||||
*
|
||||
* ib_devname - The name of the device requested or NULL for the first one.
|
||||
*
|
||||
* Return Value : the device or NULL in case of failure.
|
||||
*/
|
||||
struct ibv_device* ctx_find_dev(const char *ib_devname);
|
||||
|
||||
/* alloc_ctx
|
||||
*
|
||||
* Description : allocate all perftest resources.
|
||||
*
|
||||
* Parameters :
|
||||
* ctx - Resources sructure.
|
||||
* user_param - the perftest parameters.
|
||||
*/
|
||||
void alloc_ctx(struct pingpong_context *ctx,struct perftest_parameters *user_param);
|
||||
|
||||
/* destroy_ctx
|
||||
*
|
||||
* Description : Deallocate all perftest resources.
|
||||
*
|
||||
* Parameters :
|
||||
* ctx - Resources sructure.
|
||||
* user_param - the perftest parameters.
|
||||
*
|
||||
* Return Value : SUCCESS, FAILURE.
|
||||
*/
|
||||
int destroy_ctx(struct pingpong_context *ctx,
|
||||
struct perftest_parameters *user_param);
|
||||
|
||||
/* verify_params_with_device_context
|
||||
*
|
||||
* Description :
|
||||
* Verify user params that require information from the ibv_context
|
||||
*
|
||||
* Parameters :
|
||||
* context - ibv_context
|
||||
* user_param - the perftest parameters.
|
||||
*
|
||||
* Return Value : SUCCESS, FAILURE.
|
||||
*/
|
||||
int verify_params_with_device_context(struct ibv_context *ctx,
|
||||
struct perftest_parameters *user_param);
|
||||
|
||||
|
||||
/* ctx_init
|
||||
*
|
||||
* Description :
|
||||
* Creates all the test resources.
|
||||
* It creates Buffer, PD, MR, CQ QPs and moves the QPs to INIT.
|
||||
*
|
||||
* Parameters :
|
||||
* ctx - An empty resources sructure to fill inside the resources.
|
||||
* user_param - the perftest parameters.
|
||||
*
|
||||
* Return Value : SUCCESS, FAILURE.
|
||||
*/
|
||||
int ctx_init(struct pingpong_context *ctx,struct perftest_parameters *user_param);
|
||||
|
||||
/* ctx_qp_create.
|
||||
*
|
||||
* Description :
|
||||
*
|
||||
* Creates a QP , according to the attributes given in param.
|
||||
* The relevent attributes are tx_depth,rx_depth,inline_size and connection_type.
|
||||
*
|
||||
* Parameters :
|
||||
*
|
||||
* pd - The Protection domain , each the qp will be assigned to.
|
||||
* send_cq - The CQ that will produce send CQE.
|
||||
* recv_qp - The CQ that will produce recv CQE.
|
||||
* param - The parameters for the QP.
|
||||
*
|
||||
* Return Value : Adress of the new QP.
|
||||
*/
|
||||
struct ibv_qp* ctx_qp_create(struct pingpong_context *ctx,
|
||||
struct perftest_parameters *user_param);
|
||||
|
||||
/* ctx_modify_qp_to_init.
|
||||
*
|
||||
* Description :
|
||||
*
|
||||
* Modifies the given QP to INIT state , according to attributes in param.
|
||||
* The relevent attributes are ib_port, connection_type and verb.
|
||||
*
|
||||
* Parameters :
|
||||
*
|
||||
* qp - The QP that will be moved to INIT.
|
||||
* param - The parameters for the QP.
|
||||
*
|
||||
* Return Value : SUCCESS, FAILURE.
|
||||
*
|
||||
*/
|
||||
int ctx_modify_qp_to_init(struct ibv_qp *qp,struct perftest_parameters *user_param, uint64_t init_flag);
|
||||
|
||||
/* ctx_connect.
|
||||
*
|
||||
* Description :
|
||||
*
|
||||
* Modifies the given QP to RTR and then RTS states, given it's transport type and feature.
|
||||
*
|
||||
* Parameters :
|
||||
*
|
||||
* ctx - Test Context.
|
||||
* dest - pingpong_dest struct of the remote side.
|
||||
* user_param - user_parameters struct for this test.
|
||||
* my_dest - pingpong_dest struct of this side.
|
||||
*
|
||||
* Return Value : SUCCESS, FAILURE.
|
||||
*
|
||||
*/
|
||||
int ctx_connect(struct pingpong_context *ctx,
|
||||
struct pingpong_dest *dest,
|
||||
struct perftest_parameters *user_param,
|
||||
struct pingpong_dest *my_dest);
|
||||
|
||||
/* ctx_set_send_exp_wqes.
|
||||
*
|
||||
* Description :
|
||||
*
|
||||
* Prepare the exp send work request templates for all QPs
|
||||
*
|
||||
* Parameters :
|
||||
*
|
||||
* ctx - Test Context.
|
||||
* user_param - user_parameters struct for this test.
|
||||
* rem_dest - pingpong_dest struct of the remote side.
|
||||
*
|
||||
*/
|
||||
void ctx_set_send_exp_wqes(struct pingpong_context *ctx,
|
||||
struct perftest_parameters *user_param,
|
||||
struct pingpong_dest *rem_dest);
|
||||
|
||||
|
||||
/* ctx_set_send_regwqes.
|
||||
*
|
||||
* Description :
|
||||
*
|
||||
* Prepare the regular send work request templates for all QPs
|
||||
*
|
||||
* Parameters :
|
||||
*
|
||||
* ctx - Test Context.
|
||||
* user_param - user_parameters struct for this test.
|
||||
* rem_dest - pingpong_dest struct of the remote side.
|
||||
*
|
||||
*/
|
||||
void ctx_set_send_reg_wqes(struct pingpong_context *ctx,
|
||||
struct perftest_parameters *user_param,
|
||||
struct pingpong_dest *rem_dest);
|
||||
|
||||
/* ctx_set_send_wqes.
|
||||
*
|
||||
* Description :
|
||||
*
|
||||
* Prepare the send work request templates for all QPs
|
||||
*
|
||||
* Parameters :
|
||||
*
|
||||
* ctx - Test Context.
|
||||
* user_param - user_parameters struct for this test.
|
||||
* rem_dest - pingpong_dest struct of the remote side.
|
||||
*
|
||||
*/
|
||||
void ctx_set_send_wqes(struct pingpong_context *ctx,
|
||||
struct perftest_parameters *user_param,
|
||||
struct pingpong_dest *rem_dest);
|
||||
|
||||
|
||||
/* ctx_set_recv_wqes.
|
||||
*
|
||||
* Description :
|
||||
*
|
||||
* Prepare the receives work request templates for all QPs in SEND receive test.
|
||||
*
|
||||
* Parameters :
|
||||
*
|
||||
* ctx - Test Context.
|
||||
* user_param - user_parameters struct for this test.
|
||||
*
|
||||
*/
|
||||
int ctx_set_recv_wqes(struct pingpong_context *ctx,struct perftest_parameters *user_param);
|
||||
|
||||
/* ctx_alloc_credit
|
||||
*
|
||||
* Description :
|
||||
*
|
||||
* Allocate resources to support the credit exchange mechanism,
|
||||
* which allows ib_send_bw to work with iWARP
|
||||
*
|
||||
* Parameters :
|
||||
*
|
||||
* ctx - test context
|
||||
* user_param - user parameters struct for this test
|
||||
* my_dest - pingpong_dest struct of the this side
|
||||
*
|
||||
* my_dest is updated to store the credit buf vaddr and rkey
|
||||
* which need to be exchanged with the remote side
|
||||
* to enable RDMA WRITE op
|
||||
*/
|
||||
int ctx_alloc_credit(struct pingpong_context *ctx,
|
||||
struct perftest_parameters *user_param,
|
||||
struct pingpong_dest *my_dest);
|
||||
/* ctx_set_credit_wqes
|
||||
*
|
||||
* Description :
|
||||
*
|
||||
* Prepare the send credit work request templates for all QPs
|
||||
* RDMA WRITE op is used for sending credit
|
||||
* Credit exchange is necessary for ib_send_bw to work with iWARP
|
||||
*
|
||||
* Parameters :
|
||||
*
|
||||
* ctx - test context
|
||||
* user_param - user parameters struct for this test
|
||||
* rem_dest - pingpong_dest struct of the remote side.
|
||||
*/
|
||||
int ctx_set_credit_wqes(struct pingpong_context *ctx,
|
||||
struct perftest_parameters *user_param,
|
||||
struct pingpong_dest *rem_dest);
|
||||
/* run_iter_bw.
|
||||
*
|
||||
* Description :
|
||||
*
|
||||
* The main testing method in BW tests.
|
||||
*
|
||||
* Parameters :
|
||||
*
|
||||
* ctx - Test Context.
|
||||
* user_param - user_parameters struct for this test.
|
||||
*
|
||||
*/
|
||||
int run_iter_bw(struct pingpong_context *ctx,struct perftest_parameters *user_param);
|
||||
|
||||
/* run_iter_bw_infinitely
|
||||
*
|
||||
* Description :
|
||||
*
|
||||
* Infinite BW method, that prints BW every 5 seconds and never stops.
|
||||
*
|
||||
* Parameters :
|
||||
*
|
||||
* ctx - Test Context.
|
||||
* user_param - user_parameters struct for this test.
|
||||
*
|
||||
*/
|
||||
// int run_iter_bw_infinitely(struct pingpong_context *ctx,struct perftest_parameters *user_param);
|
||||
|
||||
/* run_iter_bw_infinitely_server
|
||||
*
|
||||
* Description :
|
||||
*
|
||||
* Infinite on SEND server BW method, will not print anything and will post receive wqes for each incoming packet.
|
||||
*
|
||||
* Parameters :
|
||||
*
|
||||
* ctx - Test Context.
|
||||
* user_param - user_parameters struct for this test.
|
||||
*
|
||||
*/
|
||||
int run_iter_bw_infinitely_server(struct pingpong_context *ctx, struct perftest_parameters *user_param);
|
||||
|
||||
/* run_iter_bw_server.
|
||||
*
|
||||
* Description :
|
||||
*
|
||||
* The main testing method for Receiver in SEND test.
|
||||
*
|
||||
* Parameters :
|
||||
*
|
||||
* ctx - Test Context.
|
||||
* user_param - user_parameters struct for this test.
|
||||
*
|
||||
*/
|
||||
int run_iter_bw_server(struct pingpong_context *ctx, struct perftest_parameters *user_param);
|
||||
|
||||
/* run_iter_bi.
|
||||
*
|
||||
* Description :
|
||||
*
|
||||
* The main testing method for bidirrectional.
|
||||
*
|
||||
* Parameters :
|
||||
*
|
||||
* ctx - Test Context.
|
||||
* user_param - user_parameters struct for this test.
|
||||
*
|
||||
*/
|
||||
int run_iter_bi(struct pingpong_context *ctx,struct perftest_parameters *user_param);
|
||||
|
||||
/* run_iter_lat_write
|
||||
*
|
||||
* Description :
|
||||
*
|
||||
* This is the latency test function for WRITE verb.
|
||||
*
|
||||
* Parameters :
|
||||
*
|
||||
* ctx - Test Context.
|
||||
* user_param - user_parameters struct for this test.
|
||||
*/
|
||||
int run_iter_lat_write(struct pingpong_context *ctx,struct perftest_parameters *user_param);
|
||||
|
||||
/* run_iter_lat
|
||||
*
|
||||
* Description :
|
||||
*
|
||||
* This is the latency test function for READ or ATOMIC verb latency tests.
|
||||
*
|
||||
* Parameters :
|
||||
*
|
||||
* ctx - Test Context.
|
||||
* user_param - user_parameters struct for this test.
|
||||
*/
|
||||
int run_iter_lat(struct pingpong_context *ctx,struct perftest_parameters *user_param);
|
||||
|
||||
/* run_iter_lat_send
|
||||
*
|
||||
* Description :
|
||||
*
|
||||
* This is the latency test function for SEND verb latency test.
|
||||
*
|
||||
* Parameters :
|
||||
*
|
||||
* ctx - Test Context.
|
||||
* user_param - user_parameters struct for this test.
|
||||
*/
|
||||
int run_iter_lat_send(struct pingpong_context *ctx, struct perftest_parameters *user_param);
|
||||
|
||||
/* run_iter_lat_burst
|
||||
*
|
||||
* Description :
|
||||
*
|
||||
* This is the latency test function for SEND verb latency test in burst mode
|
||||
*
|
||||
* Parameters :
|
||||
*
|
||||
* ctx - Test Context.
|
||||
* user_param - user_parameters struct for this test.
|
||||
*/
|
||||
|
||||
int run_iter_lat_burst(struct pingpong_context *ctx, struct perftest_parameters *user_param);
|
||||
|
||||
/* run_iter_lat_burst_server
|
||||
*
|
||||
* Description :
|
||||
*
|
||||
* This is the latency test function for server side latency test in burst mode
|
||||
*
|
||||
* Parameters :
|
||||
*
|
||||
* ctx - Test Context.
|
||||
* user_param - user_parameters struct for this test.
|
||||
*/
|
||||
|
||||
int run_iter_lat_burst_server(struct pingpong_context *ctx, struct perftest_parameters *user_param);
|
||||
|
||||
/* ctx_get_local_lid .
|
||||
*
|
||||
* Description :
|
||||
*
|
||||
* This method find and returns the local Id in IB subnet manager of
|
||||
* the selected port and HCA given.The lid identifies the port.
|
||||
*
|
||||
* Parameters :
|
||||
*
|
||||
* context - the context of the HCA device.
|
||||
* ib_port - The port of the HCA (1 or 2).
|
||||
*
|
||||
* Return Value : The Lid itself. (No error values).
|
||||
*/
|
||||
uint16_t ctx_get_local_lid(struct ibv_context *context, int ib_port);
|
||||
|
||||
/* ctx_notify_events
|
||||
*
|
||||
* Description : Prepare the test to work with events instead of polling the CQ.
|
||||
* This is the way to work in un interipted mode.
|
||||
*
|
||||
* Parameters :
|
||||
* channel - (Mandotory) the created event channel.
|
||||
*
|
||||
* Return Value : SUCCESS, FAILURE.
|
||||
*/
|
||||
static __inline int ctx_notify_events(struct ibv_comp_channel *channel)
|
||||
{
|
||||
|
||||
struct ibv_cq *ev_cq;
|
||||
void *ev_ctx;
|
||||
|
||||
if (ibv_get_cq_event(channel,&ev_cq,&ev_ctx)) {
|
||||
fprintf(stderr, "Failed to get cq_event\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
ibv_ack_cq_events(ev_cq,1);
|
||||
|
||||
if (ibv_req_notify_cq(ev_cq, 0)) {
|
||||
fprintf(stderr, "Couldn't request CQ notification\n");
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if defined(HAVE_VERBS_EXP)
|
||||
static __inline void increase_exp_rem_addr(struct ibv_exp_send_wr *wr,int size,uint64_t scnt,uint64_t prim_addr,VerbType verb, int cache_line_size, int cycle_buffer)
|
||||
{
|
||||
if (verb == ATOMIC)
|
||||
wr->wr.atomic.remote_addr += INC(size,cache_line_size);
|
||||
|
||||
else
|
||||
wr->wr.rdma.remote_addr += INC(size,cache_line_size);
|
||||
|
||||
if ( ((scnt+1) % (cycle_buffer/ INC(size,cache_line_size))) == 0) {
|
||||
|
||||
if (verb == ATOMIC)
|
||||
wr->wr.atomic.remote_addr = prim_addr;
|
||||
|
||||
else
|
||||
wr->wr.rdma.remote_addr = prim_addr;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
static __inline void increase_rem_addr(struct ibv_send_wr *wr,int size,uint64_t scnt,uint64_t prim_addr,VerbType verb, int cache_line_size, int cycle_buffer)
|
||||
{
|
||||
if (verb == ATOMIC)
|
||||
wr->wr.atomic.remote_addr += INC(size,cache_line_size);
|
||||
|
||||
else
|
||||
wr->wr.rdma.remote_addr += INC(size,cache_line_size);
|
||||
|
||||
if ( ((scnt+1) % (cycle_buffer/ INC(size,cache_line_size))) == 0) {
|
||||
|
||||
if (verb == ATOMIC)
|
||||
wr->wr.atomic.remote_addr = prim_addr;
|
||||
|
||||
else
|
||||
wr->wr.rdma.remote_addr = prim_addr;
|
||||
}
|
||||
}
|
||||
|
||||
/* increase_loc_addr.
|
||||
*
|
||||
* Description :
|
||||
* Increases the local address in all verbs ,
|
||||
* (at least 64 CACHE_LINE size) , so that the system will be a able to cahce the data
|
||||
* in an orginzed way.
|
||||
*
|
||||
* Parameters :
|
||||
* sg - The scatter element of the wqe.
|
||||
* size - size of the message to send.
|
||||
* rcnt - The ammount of post_send or post_receive we called.
|
||||
* prim_addr - The address of the original buffer.
|
||||
* server_is_ud - Indication to weather we are in UD mode.
|
||||
*/
|
||||
static __inline void increase_loc_addr(struct ibv_sge *sg,int size,uint64_t rcnt,uint64_t prim_addr,int server_is_ud, int cache_line_size, int cycle_buffer)
|
||||
{
|
||||
sg->addr += INC(size,cache_line_size);
|
||||
|
||||
if ( ((rcnt+1) % (cycle_buffer/ INC(size,cache_line_size))) == 0 )
|
||||
sg->addr = prim_addr;
|
||||
|
||||
}
|
||||
|
||||
/* catch_alarm.
|
||||
*
|
||||
* Description :
|
||||
* Signal catcher for duration feature.
|
||||
* run_iter_bw in start will set it to triger at MARGIN (parameter), it will then start counting packets
|
||||
* and triger it back to SAMPLE TIME, in that time the test will count packets and completion and
|
||||
* will calculate BW accordingley.
|
||||
*
|
||||
*/
|
||||
void catch_alarm(int sig);
|
||||
|
||||
void check_alive(int sig);
|
||||
|
||||
/* catch_alarm.
|
||||
*
|
||||
* Description :
|
||||
* Signal catcher for run_infinitely feature.
|
||||
* Will be triggered every 5 sec and measure BW in this time frame.
|
||||
*
|
||||
*/
|
||||
void catch_alarm_infintely();
|
||||
|
||||
/* handle_signal_print_thread
|
||||
*
|
||||
* Description :
|
||||
* Handle thread creation for signal catching in run_infinitely mode
|
||||
*
|
||||
*/
|
||||
void *handle_signal_print_thread(void *sig_mask);
|
||||
|
||||
/* ctx_modify_dc_qp_to_init.
|
||||
*
|
||||
* Description :
|
||||
*
|
||||
* Modifies the given QP to INIT state , according to attributes in param.
|
||||
* The relevent attributes are ib_port, connection_type and verb.
|
||||
*
|
||||
* Parameters :
|
||||
*
|
||||
* qp - The QP that will be moved to INIT.
|
||||
* param - The parameters for the QP.
|
||||
*
|
||||
* Return Value : SUCCESS, FAILURE.
|
||||
*
|
||||
*/
|
||||
int ctx_modify_dc_qp_to_init(struct ibv_qp *qp,struct perftest_parameters *user_param);
|
||||
|
||||
int perform_warm_up(struct pingpong_context *ctx,struct perftest_parameters *user_param);
|
||||
|
||||
#ifdef HAVE_MASKED_ATOMICS
|
||||
struct ibv_qp* ctx_atomic_qp_create(struct pingpong_context *ctx,
|
||||
struct perftest_parameters *user_param);
|
||||
int check_masked_atomics_support(struct pingpong_context *ctx);
|
||||
#endif
|
||||
|
||||
#if defined (HAVE_PACKET_PACING_EXP) || defined (HAVE_PACKET_PACING)
|
||||
int check_packet_pacing_support(struct pingpong_context *ctx);
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_ACCL_VERBS
|
||||
struct ibv_exp_res_domain* create_res_domain(struct pingpong_context *ctx,
|
||||
struct perftest_parameters *user_param);
|
||||
#endif
|
||||
|
||||
int create_reg_qp_main(struct pingpong_context *ctx,
|
||||
struct perftest_parameters *user_param, int i, int num_of_qps);
|
||||
|
||||
#ifdef HAVE_VERBS_EXP
|
||||
int create_exp_qp_main(struct pingpong_context *ctx,
|
||||
struct perftest_parameters *user_param, int i, int num_of_qps);
|
||||
#endif
|
||||
|
||||
int create_qp_main(struct pingpong_context *ctx,
|
||||
struct perftest_parameters *user_param, int i, int num_of_qps);
|
||||
|
||||
#ifdef HAVE_VERBS_EXP
|
||||
struct ibv_qp* ctx_exp_qp_create(struct pingpong_context *ctx,
|
||||
struct perftest_parameters *user_param, int qp_index);
|
||||
#endif
|
||||
|
||||
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);
|
||||
|
||||
/* alloc_hugapage_region
|
||||
*
|
||||
* Description :
|
||||
*
|
||||
* Creates hugepage memory Regions for the test.
|
||||
*
|
||||
* Parameters :
|
||||
* ctx - Resources sructure.
|
||||
*
|
||||
* Return Value : SUCCESS, FAILURE.
|
||||
*
|
||||
*/
|
||||
int alloc_hugepage_region (struct pingpong_context *ctx);
|
||||
|
||||
/* run_iter_fs_rate
|
||||
*
|
||||
* Description :
|
||||
*
|
||||
* The main testing method for Flow steering creation
|
||||
*
|
||||
* Parameters :
|
||||
*
|
||||
* ctx - Test Context.
|
||||
* user_param - user_parameters struct for this test.
|
||||
*
|
||||
*/
|
||||
|
||||
int run_iter_fs(struct pingpong_context *ctx, struct perftest_parameters *user_param);
|
||||
|
||||
#endif /* PERFTEST_RESOURCES_H */
|
|
@ -1,26 +1,26 @@
|
|||
/*
|
||||
* Copyright (c) 2005 Topspin Communications. All rights reserved.
|
||||
* Copyright (c) 2005 Mellanox Technologies Ltd. All rights reserved.
|
||||
* Copyright (c) 2009 HNR Consulting. All rights reserved.
|
||||
* Copyright (c) 2005 Topspin Communications. All rights reserved.
|
||||
* Copyright (c) 2005 Mellanox Technologies Ltd. All rights reserved.
|
||||
* Copyright (c) 2009 HNR Consulting. All rights reserved.
|
||||
*
|
||||
* This software is available to you under a choice of one of two
|
||||
* licenses. You may choose to be licensed under the terms of the GNU
|
||||
* licenses. You may choose to be licensed under the terms of the GNU
|
||||
* General Public License (GPL) Version 2, available from the file
|
||||
* COPYING in the main directory of this source tree, or the
|
||||
* OpenIB.org BSD license below:
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or
|
||||
* without modification, are permitted provided that the following
|
||||
* conditions are met:
|
||||
* 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 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.
|
||||
* - 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.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
|
@ -39,29 +39,29 @@
|
|||
#include <string.h>
|
||||
#include <time.h>
|
||||
|
||||
#include "perftest_parameters.h"
|
||||
#include "perftest_resources.h"
|
||||
#include "perftest_communication.h"
|
||||
#include "perftest_parameters_write_bw.h"
|
||||
#include "perftest_resources_write_bw.h"
|
||||
#include "perftest_communication_write_bw.h"
|
||||
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
int ret_parser,i = 0;
|
||||
struct ibv_device *ib_dev = NULL;
|
||||
int ret_parser,i = 0;
|
||||
struct ibv_device *ib_dev = NULL;
|
||||
|
||||
struct pingpong_context ctx;
|
||||
struct pingpong_dest *my_dest,*rem_dest;
|
||||
struct perftest_parameters user_param;
|
||||
struct perftest_comm user_comm;
|
||||
struct bw_report_data my_bw_rep, rem_bw_rep;
|
||||
struct pingpong_context ctx;
|
||||
struct pingpong_dest *my_dest,*rem_dest;
|
||||
struct perftest_parameters user_param;
|
||||
struct perftest_comm user_comm;
|
||||
struct bw_report_data my_bw_rep, rem_bw_rep;
|
||||
|
||||
/* init default values to user's parameters */
|
||||
memset(&user_param,0,sizeof(struct perftest_parameters));
|
||||
memset(&user_comm,0,sizeof(struct perftest_comm));
|
||||
memset(&ctx,0,sizeof(struct pingpong_context));
|
||||
|
||||
user_param.verb = WRITE;
|
||||
user_param.tst = BW;
|
||||
user_param.verb = WRITE;
|
||||
user_param.tst = BW;
|
||||
strncpy(user_param.version, VERSION, sizeof(user_param.version));
|
||||
|
||||
/* Configure the parameters values according to user arguments or default values. */
|
||||
|
@ -110,7 +110,15 @@ int main(int argc, char *argv[])
|
|||
fprintf(stderr," Unable to init the socket connection\n");
|
||||
return FAILURE;
|
||||
}
|
||||
sleep(1);
|
||||
|
||||
/* sleep(1); // TODO: linker */
|
||||
|
||||
// sleep replacement:
|
||||
struct timeval tv;
|
||||
tv.tv_sec = 1;
|
||||
tv.tv_usec = 0;
|
||||
select(0, NULL, NULL, NULL, &tv);
|
||||
|
||||
exchange_versions(&user_comm, &user_param);
|
||||
|
||||
check_sys_data(&user_comm, &user_param);
|
||||
|
@ -161,7 +169,7 @@ int main(int argc, char *argv[])
|
|||
ctx_print_pingpong_data(&rem_dest[i],&user_comm);
|
||||
}
|
||||
|
||||
if (user_param.work_rdma_cm == OFF) {
|
||||
if (user_param.work_rdma_cm == OFF) { // TODO:
|
||||
if (ctx_check_gid_compatibility(&my_dest[0], &rem_dest[0])) {
|
||||
fprintf(stderr,"\n Found Incompatibility issue with GID types.\n");
|
||||
fprintf(stderr," Please Try to use a different IP version.\n\n");
|
||||
|
@ -218,14 +226,14 @@ int main(int argc, char *argv[])
|
|||
printf(RESULT_LINE);
|
||||
}
|
||||
|
||||
if (user_param.work_rdma_cm == ON) {
|
||||
if (destroy_ctx(&ctx,&user_param)) {
|
||||
fprintf(stderr, "Failed to destroy resources\n");
|
||||
return FAILURE;
|
||||
}
|
||||
user_comm.rdma_params->work_rdma_cm = ON;
|
||||
return destroy_ctx(user_comm.rdma_ctx,user_comm.rdma_params);
|
||||
}
|
||||
/* if (user_param.work_rdma_cm == ON) { */
|
||||
/* if (destroy_ctx(&ctx,&user_param)) { */
|
||||
/* fprintf(stderr, "Failed to destroy resources\n"); */
|
||||
/* return FAILURE; */
|
||||
/* } */
|
||||
/* user_comm.rdma_params->work_rdma_cm = ON; */
|
||||
/* return destroy_ctx(user_comm.rdma_ctx,user_comm.rdma_params); */
|
||||
/* } */
|
||||
|
||||
return destroy_ctx(&ctx,&user_param);
|
||||
}
|
||||
|
@ -359,21 +367,21 @@ int main(int argc, char *argv[])
|
|||
}
|
||||
|
||||
if (!user_param.is_msgrate_limit_passed && (user_param.is_limit_bw == ON )) {
|
||||
fprintf(stderr,"Error: Msg rate is below msg_rate limit\n");
|
||||
fprintf(stderr,"Error: Msg rate is below msg_rate limit\n");
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
free(my_dest);
|
||||
free(rem_dest);
|
||||
|
||||
if (user_param.work_rdma_cm == ON) {
|
||||
if (destroy_ctx(&ctx,&user_param)) {
|
||||
fprintf(stderr, "Failed to destroy resources\n");
|
||||
return FAILURE;
|
||||
}
|
||||
user_comm.rdma_params->work_rdma_cm = ON;
|
||||
return destroy_ctx(user_comm.rdma_ctx,user_comm.rdma_params);
|
||||
}
|
||||
/* if (user_param.work_rdma_cm == ON) { */
|
||||
/* if (destroy_ctx(&ctx,&user_param)) { */
|
||||
/* fprintf(stderr, "Failed to destroy resources\n"); */
|
||||
/* return FAILURE; */
|
||||
/* } */
|
||||
/* user_comm.rdma_params->work_rdma_cm = ON; */
|
||||
/* return destroy_ctx(user_comm.rdma_ctx,user_comm.rdma_params); */
|
||||
/* } */
|
||||
|
||||
return destroy_ctx(&ctx,&user_param);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue