Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
laffer1 committed Nov 22, 2024
1 parent fca858b commit c14eb46
Show file tree
Hide file tree
Showing 40 changed files with 6,451 additions and 114 deletions.
8 changes: 8 additions & 0 deletions contrib/ofed/infiniband-diags/src/ibdiag_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ static inline int val_str_true(const char *val_str)
void read_ibdiag_config(const char *file)
{
char buf[1024];
char orig_buf[1024];
FILE *config_fd = NULL;
char *p_prefix, *p_last;
char *name;
Expand All @@ -142,8 +143,14 @@ void read_ibdiag_config(const char *file)
if (*p_prefix == '#')
continue; /* ignore comment lines */

strlcpy(orig_buf, buf, sizeof(orig_buf));
name = strtok_r(p_prefix, "=", &p_last);
val_str = strtok_r(NULL, "\n", &p_last);
if (!name || !val_str) {
fprintf(stderr, "%s: malformed line in \"%s\":\n%s\n",
prog_name, file, orig_buf);
continue;
}

if (strncmp(name, "CA", strlen("CA")) == 0) {
free(ibd_ca);
Expand All @@ -165,6 +172,7 @@ void read_ibdiag_config(const char *file)
ibd_sakey = strtoull(val_str, 0, 0);
} else if (strncmp(name, "nd_format",
strlen("nd_format")) == 0) {
free(ibd_nd_format);
ibd_nd_format = strdup(val_str);
}
}
Expand Down
2 changes: 1 addition & 1 deletion contrib/ofed/infiniband-diags/src/ibdiag_sa.c
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ static const char *ib_mad_inv_field_str[] = {
"MAD Reserved",
"MAD Reserved",
"MAD Reserved",
"MAD Invalid value in Attribute field(s) or Attribute Modifier"
"MAD Invalid value in Attribute field(s) or Attribute Modifier",
"MAD UNKNOWN ERROR"
};
#define MAD_ERR_UNKNOWN (ARR_SIZE(ib_mad_inv_field_str) - 1)
Expand Down
5 changes: 3 additions & 2 deletions contrib/ofed/infiniband-diags/src/iblinkinfo.c
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,8 @@ void print_node_header(ibnd_node_t *node, int *out_header_flag,
printf("%s%s: %s:\n",
out_prefix ? out_prefix : "",
nodetype_str(node), remap);
(*out_header_flag)++;
if (out_header_flag)
(*out_header_flag)++;
free(remap);
}
}
Expand Down Expand Up @@ -397,7 +398,7 @@ void diff_node_ports(ibnd_node_t * fabric1_node, ibnd_node_t * fabric2_node,
}

if (output_diff && fabric2_port) {
print_node_header(fabric1_node,
print_node_header(fabric2_node,
head_print,
NULL);
print_port(fabric2_node,
Expand Down
1 change: 1 addition & 0 deletions contrib/ofed/infiniband-diags/src/ibportstate.c
Original file line number Diff line number Diff line change
Expand Up @@ -564,6 +564,7 @@ int main(int argc, char **argv)
printf("Port is already in enable state\n");
goto close_port;
}
/* FALLTHROUGH */
case ENABLE:
case RESET:
/* Polling */
Expand Down
7 changes: 7 additions & 0 deletions contrib/ofed/infiniband-diags/src/ibqueryerrors.c
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ static void set_thres(char *name, uint32_t val)
static void set_thresholds(char *threshold_file)
{
char buf[1024];
char orig_buf[1024];
int val = 0;
FILE *thresf = fopen(threshold_file, "r");
char *p_prefix, *p_last;
Expand All @@ -156,8 +157,14 @@ static void set_thresholds(char *threshold_file)
if (*p_prefix == '#')
continue; /* ignore comment lines */

strlcpy(orig_buf, buf, sizeof(orig_buf));
name = strtok_r(p_prefix, "=", &p_last);
val_str = strtok_r(NULL, "\n", &p_last);
if (!name || !val_str) {
fprintf(stderr, "malformed line in \"%s\":\n%s\n",
threshold_file, orig_buf);
continue;
}

val = strtoul(val_str, NULL, 0);
set_thres(name, val);
Expand Down
4 changes: 3 additions & 1 deletion contrib/ofed/infiniband-diags/src/ibroute.c
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,7 @@ char *dump_multicast_tables(ib_portid_t * portid, unsigned startlid,
fprintf(stderr, "SubnGet() failed"
"; MAD status 0x%x AM 0x%x\n",
status, mod);
free(mapnd);
return NULL;
}
}
Expand Down Expand Up @@ -354,6 +355,8 @@ char *dump_unicast_tables(ib_portid_t * portid, int startlid, int endlid)
" (%s):\n", startlid, endlid, portid2str(portid), nodeguid,
mapnd);

free(mapnd);

DEBUG("Switch top is 0x%x\n", top);

printf(" Lid Out Destination\n");
Expand Down Expand Up @@ -390,7 +393,6 @@ char *dump_unicast_tables(ib_portid_t * portid, int startlid, int endlid)
}

printf("%d %slids dumped \n", n, dump_all ? "" : "valid ");
free(mapnd);
return 0;
}

Expand Down
3 changes: 0 additions & 3 deletions contrib/ofed/libibumad/umad_str.c
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,6 @@ static const char * umad_sm_attr_str(__be16 attr_id)
default:
return (umad_common_attr_str(attr_id));
}
return ("<unknown>");
}

static const char * umad_sa_attr_str(__be16 attr_id)
Expand Down Expand Up @@ -301,7 +300,6 @@ static const char * umad_sa_attr_str(__be16 attr_id)
default:
return (umad_common_attr_str(attr_id));
}
return ("<unknown>");
}

static const char * umad_cm_attr_str(__be16 attr_id)
Expand Down Expand Up @@ -336,7 +334,6 @@ static const char * umad_cm_attr_str(__be16 attr_id)
default:
return (umad_common_attr_str(attr_id));
}
return ("<unknown>");
}

const char * umad_attribute_str(uint8_t mgmt_class, __be16 attr_id)
Expand Down
3 changes: 0 additions & 3 deletions contrib/ofed/libibverbs/device.c
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,6 @@ int __ibv_close_device(struct ibv_context *context)
{
int async_fd = context->async_fd;
int cmd_fd = context->cmd_fd;
int cq_fd = -1;
struct verbs_context *context_ex;
struct verbs_device *verbs_device = verbs_get_device(context->device);

Expand All @@ -279,8 +278,6 @@ int __ibv_close_device(struct ibv_context *context)

close(async_fd);
close(cmd_fd);
if (abi_ver <= 2)
close(cq_fd);

return 0;
}
Expand Down
6 changes: 5 additions & 1 deletion contrib/ofed/libibverbs/examples/rc_pingpong.c
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,11 @@ static struct pingpong_dest *pp_server_exch_dest(struct pingpong_context *ctx,
return NULL;
}

listen(sockfd, 1);
if (listen(sockfd, 1) < 0) {
perror("listen() failed");
close(sockfd);
return NULL;
}
connfd = accept(sockfd, NULL, NULL);
close(sockfd);
if (connfd < 0) {
Expand Down
6 changes: 5 additions & 1 deletion contrib/ofed/libibverbs/examples/srq_pingpong.c
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,11 @@ static struct pingpong_dest *pp_server_exch_dest(struct pingpong_context *ctx,
return NULL;
}

listen(sockfd, 1);
if (listen(sockfd, 1) < 0) {
perror("listen() failed");
close(sockfd);
return NULL;
}
connfd = accept(sockfd, NULL, NULL);
close(sockfd);
if (connfd < 0) {
Expand Down
6 changes: 5 additions & 1 deletion contrib/ofed/libibverbs/examples/uc_pingpong.c
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,11 @@ static struct pingpong_dest *pp_server_exch_dest(struct pingpong_context *ctx,
return NULL;
}

listen(sockfd, 1);
if (listen(sockfd, 1) < 0) {
perror("listen() failed");
close(sockfd);
return NULL;
}
connfd = accept(sockfd, NULL, NULL);
close(sockfd);
if (connfd < 0) {
Expand Down
6 changes: 5 additions & 1 deletion contrib/ofed/libibverbs/examples/ud_pingpong.c
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,11 @@ static struct pingpong_dest *pp_server_exch_dest(struct pingpong_context *ctx,
return NULL;
}

listen(sockfd, 1);
if (listen(sockfd, 1) < 0) {
perror("listen() failed");
close(sockfd);
return NULL;
}
connfd = accept(sockfd, NULL, NULL);
close(sockfd);
if (connfd < 0) {
Expand Down
6 changes: 5 additions & 1 deletion contrib/ofed/libibverbs/examples/xsrq_pingpong.c
Original file line number Diff line number Diff line change
Expand Up @@ -630,7 +630,11 @@ static int pp_server_connect(int port)
return 1;
}

listen(sockfd, ctx.num_clients);
if (listen(sockfd, ctx.num_clients) < 0) {
perror("listen() failed");
close(sockfd);
return 1;
}

for (i = 0; i < ctx.num_clients; i++) {
connfd = accept(sockfd, NULL, NULL);
Expand Down
3 changes: 0 additions & 3 deletions contrib/ofed/libibverbs/libibverbs.map
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ IBVERBS_1.0 {
ibv_get_async_event;
ibv_ack_async_event;
ibv_query_device;
ibv_query_device_ex;
ibv_query_port;
ibv_query_gid;
ibv_query_pkey;
Expand Down Expand Up @@ -65,7 +64,6 @@ IBVERBS_1.1 {
ibv_fork_init;
ibv_dontfork_range;
ibv_dofork_range;
ibv_register_driver;

ibv_node_type_str;
ibv_port_state_str;
Expand Down Expand Up @@ -136,7 +134,6 @@ IBVERBS_PRIVATE_14 {
ibv_cmd_rereg_mr;
ibv_cmd_resize_cq;
ibv_query_gid_type;
ibv_register_driver;
verbs_register_driver;
verbs_init_cq;
};
Loading

0 comments on commit c14eb46

Please sign in to comment.