@@ -21,8 +21,20 @@ addons:
- pkg-config
- python
- valgrind
+
+ # 32 bit support packages
+ - gcc-multilib
+ - lib32gcc-6-dev
script:
- - mkdir build
+ - mkdir build build32
- cd build
- - CC=gcc-6 cmake -GNinja ..
+ # The goal is warning free compile on latest gcc.
+ - CC=gcc-6 CFLAGS=-Werror cmake -GNinja ..
+ - ninja
+
+ # 32 bit build
+ - cd ../build32
+ # travis's trusty is not configured in a way that enables all32 bit
+ # packages. We could fix this with some sudo stuff.. For now turn off libnl
+ - CC=gcc-6 CFLAGS="-Werror -m32" cmake -GNinja .. -DENABLE_RESOLVE_NEIGH=0
- ninja
@@ -218,7 +218,7 @@ static struct sa_data {
struct pollfd *fds;
struct acmc_port **ports;
int nfds;
-} sa = { 2000, 2, 1};
+} sa = { 2000, 2, 1, 0, NULL, NULL, 0};
/*
* Service options - may be set through ibacm_opts.cfg file.
@@ -1402,7 +1402,7 @@ static int acm_nl_send(SOCKET sock, struct acm_msg *msg)
int ret;
int datalen;
- orig = (struct acm_nl_msg *) msg->hdr.tid;
+ orig = (struct acm_nl_msg *)(uintptr_t)msg->hdr.tid;
memset(&dst_addr, 0, sizeof(dst_addr));
dst_addr.nl_family = AF_NETLINK;
@@ -1562,7 +1562,7 @@ static void acm_nl_process_invalid_request(struct acmc_client *client,
msg.hdr.version = ACM_VERSION;
msg.hdr.length = ACM_MSG_HDR_LENGTH;
msg.hdr.status = ACM_STATUS_EINVAL;
- msg.hdr.tid = (uint64_t) acmnlmsg;
+ msg.hdr.tid = (uintptr_t) acmnlmsg;
acm_nl_send(client->sock, &msg);
}
@@ -1584,7 +1584,7 @@ static void acm_nl_process_resolve(struct acmc_client *client,
msg.hdr.version = ACM_VERSION;
msg.hdr.length = ACM_MSG_HDR_LENGTH + ACM_MSG_EP_LENGTH;
msg.hdr.status = ACM_STATUS_SUCCESS;
- msg.hdr.tid = (uint64_t) acmnlmsg;
+ msg.hdr.tid = (uintptr_t) acmnlmsg;
msg.resolve_data[0].type = ACM_EP_INFO_PATH;
/* We support only one pathrecord */
@@ -3031,7 +3031,6 @@ static int acm_open_lock_file(void)
snprintf(pid, sizeof pid, "%d\n", getpid());
if (write(lock_fd, pid, strlen(pid)) != strlen(pid)){
- lockf(lock_fd, F_ULOCK, 0);
close(lock_fd);
return -1;
}
@@ -38,6 +38,7 @@
#include <getopt.h>
#include <netdb.h>
#include <arpa/inet.h>
+#include <inttypes.h>
#include <osd.h>
#include <infiniband/verbs.h>
@@ -902,7 +903,7 @@ static int enumerate_ep(char *svc, int index)
labels = 1;
}
- printf("%s,0x%016lx,%d,0x%04x,%d,%s", svc, ep_data->dev_guid,
+ printf("%s,0x%016" PRIx64 ",%d,0x%04x,%d,%s", svc, ep_data->dev_guid,
ep_data->port_num, ep_data->pkey, index, ep_data->prov_name);
for (i = 0; i < ep_data->addr_cnt; i++)
printf(",%s", ep_data->addrs[i].name);
@@ -927,7 +928,7 @@ static void enumerate_eps(char *svc)
static int query_svcs(void)
{
char **svc_list;
- int ret, i;
+ int ret = -1, i;
svc_list = parse(svc_arg, NULL);
if (!svc_list) {
@@ -82,7 +82,7 @@ iwpm_mapping_request *create_iwpm_map_request(struct nlmsghdr *req_nlh,
/* assochandle helps match iwpm request sent to remote peer with future iwpm accept/reject */
iwpm_map_req->assochandle = assochandle;
if (!assochandle)
- iwpm_map_req->assochandle = (__u64)iwpm_map_req;
+ iwpm_map_req->assochandle = (uintptr_t)iwpm_map_req;
memcpy(&iwpm_map_req->src_addr, src_addr, sizeof(struct sockaddr_storage));
/* keep record of remote IP address and port */
@@ -607,7 +607,7 @@ int hfi1_modify_srq(struct ibv_srq *ibsrq,
(sizeof(struct ibv_sge) * srq->rq.max_sge)) *
srq->rq.size;
}
- cmd.offset_addr = (__u64) &offset;
+ cmd.offset_addr = (uintptr_t) &offset;
ret = ibv_cmd_modify_srq(ibsrq, attr, attr_mask,
&cmd.ibv_cmd, sizeof cmd);
if (ret) {
@@ -557,7 +557,7 @@ static int i40iw_vmapped_qp(struct i40iw_uqp *iwuqp, struct ibv_pd *pd,
return 0;
}
cmd.user_wqe_buffers = (__u64)((uintptr_t)info->sq);
- cmd.user_compl_ctx = (u64)&iwuqp->qp;
+ cmd.user_compl_ctx = (uintptr_t)&iwuqp->qp;
ret = ibv_cmd_create_qp(pd, &iwuqp->ibv_qp, attr, &cmd.ibv_cmd, sizeof(cmd),
&resp->ibv_resp, sizeof(struct i40iw_ucreate_qp_resp));
@@ -858,7 +858,7 @@ int i40iw_upost_send(struct ibv_qp *ib_qp, struct ibv_send_wr *ib_wr, struct ibv
info.op_type = I40IW_OP_TYPE_SEND;
if (ib_wr->send_flags & IBV_SEND_INLINE) {
- info.op.inline_send.data = (void *)ib_wr->sg_list[0].addr;
+ info.op.inline_send.data = (void *)(uintptr_t)ib_wr->sg_list[0].addr;
info.op.inline_send.len = ib_wr->sg_list[0].length;
ret = iwuqp->qp.ops.iw_inline_send(&iwuqp->qp, &info,
ib_wr->wr.rdma.rkey, false);
@@ -881,7 +881,7 @@ int i40iw_upost_send(struct ibv_qp *ib_qp, struct ibv_send_wr *ib_wr, struct ibv
info.op_type = I40IW_OP_TYPE_RDMA_WRITE;
if (ib_wr->send_flags & IBV_SEND_INLINE) {
- info.op.inline_rdma_write.data = (void *)ib_wr->sg_list[0].addr;
+ info.op.inline_rdma_write.data = (void *)(uintptr_t)ib_wr->sg_list[0].addr;
info.op.inline_rdma_write.len = ib_wr->sg_list[0].length;
info.op.inline_rdma_write.rem_addr.tag_off = ib_wr->wr.rdma.remote_addr;
info.op.inline_rdma_write.rem_addr.len = ib_wr->sg_list->length;
@@ -100,7 +100,6 @@ int open_test_device(void)
void test_register(void)
{
- int rc = 0;
int agent_id;
long method_mask[16 / sizeof(long)];
uint32_t class_oui = 0x001405; /* OPENIB_OUI */
@@ -105,7 +105,7 @@ int main(int argc, char *argv[])
static struct option long_options[] = {
{ .name = "ib-dev", .has_arg = 1, .val = 'd' },
{ .name = "help", .has_arg = 0, .val = 'h' },
- { 0 }
+ {}
};
c = getopt_long(argc, argv, "d:h", long_options, NULL);
@@ -44,7 +44,7 @@ enum ibv_mtu pp_mtu_to_enum(int mtu)
case 1024: return IBV_MTU_1024;
case 2048: return IBV_MTU_2048;
case 4096: return IBV_MTU_4096;
- default: return -1;
+ default: return 0;
}
}
@@ -208,14 +208,13 @@ static struct pingpong_dest *pp_client_exch_dest(const char *servername, int por
goto out;
}
- if (read(sockfd, msg, sizeof msg) != sizeof msg) {
- perror("client read");
- fprintf(stderr, "Couldn't read remote address\n");
+ if (read(sockfd, msg, sizeof msg) != sizeof msg ||
+ write(sockfd, "done", sizeof "done") != sizeof "done") {
+ perror("client read/write");
+ fprintf(stderr, "Couldn't read/write remote address\n");
goto out;
}
- write(sockfd, "done", sizeof "done");
-
rem_dest = malloc(sizeof *rem_dest);
if (!rem_dest)
goto out;
@@ -316,14 +315,14 @@ static struct pingpong_dest *pp_server_exch_dest(struct pingpong_context *ctx,
gid_to_wire_gid(&my_dest->gid, gid);
sprintf(msg, "%04x:%06x:%06x:%s", my_dest->lid, my_dest->qpn,
my_dest->psn, gid);
- if (write(connfd, msg, sizeof msg) != sizeof msg) {
- fprintf(stderr, "Couldn't send local address\n");
+ if (write(connfd, msg, sizeof msg) != sizeof msg ||
+ read(connfd, msg, sizeof msg) != sizeof msg) {
+ fprintf(stderr, "Couldn't send/recv local address\n");
free(rem_dest);
rem_dest = NULL;
goto out;
}
- read(connfd, msg, sizeof msg);
out:
close(connfd);
@@ -732,7 +731,7 @@ int main(int argc, char *argv[])
{ .name = "gid-idx", .has_arg = 1, .val = 'g' },
{ .name = "odp", .has_arg = 0, .val = 'o' },
{ .name = "ts", .has_arg = 0, .val = 't' },
- { 0 }
+ {}
};
c = getopt_long(argc, argv, "p:d:i:s:m:r:n:l:eg:ot",
@@ -768,7 +767,7 @@ int main(int argc, char *argv[])
case 'm':
mtu = pp_mtu_to_enum(strtol(optarg, NULL, 0));
- if (mtu < 0) {
+ if (mtu == 0) {
usage(argv[0]);
return 1;
}
@@ -222,8 +222,10 @@ static struct pingpong_dest *pp_client_exch_dest(const char *servername, int por
wire_gid_to_gid(gid, &rem_dest[i].gid);
}
- write(sockfd, "done", sizeof "done");
-
+ if (write(sockfd, "done", sizeof "done") != sizeof "done") {
+ perror("client write");
+ goto out;
+ }
out:
close(sockfd);
return rem_dest;
@@ -333,7 +335,12 @@ static struct pingpong_dest *pp_server_exch_dest(struct pingpong_context *ctx,
}
}
- read(connfd, msg, sizeof msg);
+ if (read(connfd, msg, sizeof msg) != sizeof msg) {
+ perror("client write");
+ free(rem_dest);
+ rem_dest = NULL;
+ goto out;
+ }
out:
close(connfd);
@@ -658,7 +665,7 @@ int main(int argc, char *argv[])
{ .name = "sl", .has_arg = 1, .val = 'l' },
{ .name = "events", .has_arg = 0, .val = 'e' },
{ .name = "gid-idx", .has_arg = 1, .val = 'g' },
- { 0 }
+ {}
};
c = getopt_long(argc, argv, "p:d:i:s:m:q:r:n:l:eg:",
@@ -697,7 +704,7 @@ int main(int argc, char *argv[])
case 'm':
mtu = pp_mtu_to_enum(strtol(optarg, NULL, 0));
- if (mtu < 0) {
+ if (mtu == 0) {
usage(argv[0]);
return 1;
}
@@ -176,13 +176,13 @@ static struct pingpong_dest *pp_client_exch_dest(const char *servername, int por
goto out;
}
- if (read(sockfd, msg, sizeof msg) != sizeof msg) {
- perror("client read");
- fprintf(stderr, "Couldn't read remote address\n");
+ if (read(sockfd, msg, sizeof msg) != sizeof msg ||
+ write(sockfd, "done", sizeof "done") != sizeof "done") {
+ perror("client read/write");
+ fprintf(stderr, "Couldn't read/write remote address\n");
goto out;
}
- write(sockfd, "done", sizeof "done");
rem_dest = malloc(sizeof *rem_dest);
if (!rem_dest)
@@ -284,15 +284,14 @@ static struct pingpong_dest *pp_server_exch_dest(struct pingpong_context *ctx,
gid_to_wire_gid(&my_dest->gid, gid);
sprintf(msg, "%04x:%06x:%06x:%s", my_dest->lid, my_dest->qpn,
my_dest->psn, gid);
- if (write(connfd, msg, sizeof msg) != sizeof msg) {
- fprintf(stderr, "Couldn't send local address\n");
+ if (write(connfd, msg, sizeof msg) != sizeof msg ||
+ read(connfd, msg, sizeof msg) != sizeof msg) {
+ fprintf(stderr, "Couldn't send/recv local address\n");
free(rem_dest);
rem_dest = NULL;
goto out;
}
- read(connfd, msg, sizeof msg);
-
out:
close(connfd);
return rem_dest;
@@ -569,7 +568,7 @@ int main(int argc, char *argv[])
{ .name = "sl", .has_arg = 1, .val = 'l' },
{ .name = "events", .has_arg = 0, .val = 'e' },
{ .name = "gid-idx", .has_arg = 1, .val = 'g' },
- { 0 }
+ {}
};
c = getopt_long(argc, argv, "p:d:i:s:m:r:n:l:eg:",
@@ -604,7 +603,7 @@ int main(int argc, char *argv[])
case 'm':
mtu = pp_mtu_to_enum(strtol(optarg, NULL, 0));
- if (mtu < 0) {
+ if (mtu == 0) {
usage(argv[0]);
return 1;
}
@@ -176,14 +176,13 @@ static struct pingpong_dest *pp_client_exch_dest(const char *servername, int por
goto out;
}
- if (read(sockfd, msg, sizeof msg) != sizeof msg) {
- perror("client read");
- fprintf(stderr, "Couldn't read remote address\n");
+ if (read(sockfd, msg, sizeof msg) != sizeof msg ||
+ write(sockfd, "done", sizeof "done") != sizeof "done") {
+ perror("client read/write");
+ fprintf(stderr, "Couldn't read/write remote address\n");
goto out;
}
- write(sockfd, "done", sizeof "done");
-
rem_dest = malloc(sizeof *rem_dest);
if (!rem_dest)
goto out;
@@ -282,15 +281,13 @@ static struct pingpong_dest *pp_server_exch_dest(struct pingpong_context *ctx,
gid_to_wire_gid(&my_dest->gid, gid);
sprintf(msg, "%04x:%06x:%06x:%s", my_dest->lid, my_dest->qpn,
my_dest->psn, gid);
- if (write(connfd, msg, sizeof msg) != sizeof msg) {
- fprintf(stderr, "Couldn't send local address\n");
+ if (write(connfd, msg, sizeof msg) != sizeof msg ||
+ read(connfd, msg, sizeof msg) != sizeof msg) {
+ fprintf(stderr, "Couldn't send/recv local address\n");
free(rem_dest);
rem_dest = NULL;
goto out;
}
-
- read(connfd, msg, sizeof msg);
-
out:
close(connfd);
return rem_dest;
@@ -327,7 +324,7 @@ static struct pingpong_context *pp_init_ctx(struct ibv_device *ib_dev, int size,
}
{
- struct ibv_port_attr port_info = { 0 };
+ struct ibv_port_attr port_info = {};
int mtu;
if (ibv_query_port(ctx->context, port, &port_info)) {
@@ -591,7 +588,7 @@ int main(int argc, char *argv[])
{ .name = "sl", .has_arg = 1, .val = 'l' },
{ .name = "events", .has_arg = 0, .val = 'e' },
{ .name = "gid-idx", .has_arg = 1, .val = 'g' },
- { 0 }
+ {}
};
c = getopt_long(argc, argv, "p:d:i:s:r:n:l:eg:",
@@ -875,7 +875,7 @@ int main(int argc, char *argv[])
{ .name = "sl", .has_arg = 1, .val = 'l' },
{ .name = "events", .has_arg = 0, .val = 'e' },
{ .name = "gid-idx", .has_arg = 1, .val = 'g' },
- { 0 }
+ {}
};
c = getopt_long(argc, argv, "p:d:i:s:m:c:n:l:eg:", long_options,
@@ -906,7 +906,7 @@ int main(int argc, char *argv[])
break;
case 'm':
ctx.mtu = pp_mtu_to_enum(strtol(optarg, NULL, 0));
- if (ctx.mtu < 0) {
+ if (ctx.mtu == 0) {
usage(argv[0]);
return 1;
}
@@ -19,6 +19,7 @@
#include <unistd.h>
#include <ifaddrs.h>
#include <netdb.h>
+#include <assert.h>
#ifndef _LINUX_IF_H
#include <net/if.h>
#else
@@ -207,7 +208,7 @@ static int create_socket(struct get_neigh_handler *neigh_handler,
&addr_src.len);
if (err) {
errno = EADDRNOTAVAIL;
- return err;
+ return -1;
}
addr_dst->len = sizeof(addr_dst->sktaddr);
@@ -216,24 +217,22 @@ static int create_socket(struct get_neigh_handler *neigh_handler,
&addr_dst->len);
if (err) {
errno = EADDRNOTAVAIL;
- return err;
+ return -1;
}
err = set_link_port(&addr_dst->sktaddr, PORT_DISCARD,
neigh_handler->oif);
if (err)
- return err;
+ return -1;
sock_fd = socket(addr_dst->sktaddr.s.sa_family,
SOCK_DGRAM | SOCK_CLOEXEC, 0);
if (sock_fd == -1)
- return errno ? -errno : -1;
+ return -1;
err = bind(sock_fd, &addr_src.sktaddr.s, addr_src.len);
if (err) {
- int bind_err = -errno;
-
close(sock_fd);
- return bind_err ?: EADDRNOTAVAIL;
+ return -1;
}
*psock_fd = sock_fd;
@@ -374,9 +373,11 @@ static struct nl_addr *process_get_neigh_mac(
if (FD_ISSET(timer_fd, &fdset)) {
uint64_t read_val;
+ ssize_t rc;
- (void)read(timer_fd, &read_val,
- sizeof(read_val));
+ rc =
+ read(timer_fd, &read_val, sizeof(read_val));
+ assert(rc == sizeof(read_val));
if (++retries >= NUM_OF_TRIES) {
if (!errno)
errno = EDESTADDRREQ;
@@ -729,7 +730,7 @@ uint16_t neigh_get_vlan_id_from_dev(struct get_neigh_handler *neigh_handler)
void neigh_set_vlan_id(struct get_neigh_handler *neigh_handler, uint16_t vid)
{
- if (vid >= 0 && vid <= 0xfff)
+ if (vid <= 0xfff)
neigh_handler->vid = vid;
}
@@ -583,7 +583,7 @@ int ipath_modify_srq(struct ibv_srq *ibsrq,
(sizeof(struct ibv_sge) * srq->rq.max_sge)) *
srq->rq.size;
}
- cmd.offset_addr = (__u64) &offset;
+ cmd.offset_addr = (uintptr_t) &offset;
ret = ibv_cmd_modify_srq(ibsrq, attr, attr_mask,
&cmd.ibv_cmd, sizeof cmd);
if (ret) {
@@ -1700,8 +1700,8 @@ mlx5_open_xrcd(struct ibv_context *context,
{
int err;
struct verbs_xrcd *xrcd;
- struct ibv_open_xrcd cmd = {0};
- struct ibv_open_xrcd_resp resp = {0};
+ struct ibv_open_xrcd cmd = {};
+ struct ibv_open_xrcd_resp resp = {};
xrcd = calloc(1, sizeof(*xrcd));
if (!xrcd)
@@ -215,6 +215,7 @@ int nes_udereg_mr(struct ibv_mr *mr)
return 0;
}
+#if HAVE_DECL_IBV_QPT_RAW_ETH
static
int nes_ima_ureplace_cq(struct ibv_cq *cq,
int mcrqf,
@@ -296,6 +297,7 @@ int nes_ima_ureplace_cq(struct ibv_cq *cq,
err:
return ret;
}
+#endif
/**
* nes_ucreate_cq
@@ -425,7 +427,6 @@ int nes_ima_upoll_cq(struct ibv_cq *cq, int num_entries, struct ibv_wc *entry)
int cqe_count = 0;
uint32_t head;
uint32_t cq_size;
- uint16_t qp_size;
volatile struct nes_hw_nic_cqe *cqe = 0;
volatile struct nes_hw_nic_cqe *cqes;
@@ -487,7 +488,6 @@ int nes_ima_upoll_cq(struct ibv_cq *cq, int num_entries, struct ibv_wc *entry)
entry->src_qp = nesuqp->qp_id;
if (cqe_misc & NES_NIC_CQE_SQ) {
entry->opcode = IBV_WC_SEND;
- qp_size = nesuqp->sq_size;
entry->wr_id =
nesuqp->send_wr_id[nesuqp->sq_tail];
@@ -518,8 +518,8 @@ int nes_ima_upoll_cq(struct ibv_cq *cq, int num_entries, struct ibv_wc *entry)
/* Working on a RQ Completion*/
if (++nesuqp->rq_tail >= nesuqp->rq_size)
nesuqp->rq_tail = 0;
- if (entry->status == NES_CQ_BUF_OV_ERR)
- entry->status = IBV_WC_LOC_LEN_ERR;
+ if (entry->status == NES_CQ_BUF_OV_ERR)
+ entry->status = IBV_WC_LOC_LEN_ERR;
}
if (++head >= cq_size)
@@ -557,7 +557,6 @@ int nes_upoll_cq(struct ibv_cq *cq, int num_entries, struct ibv_wc *entry)
uint32_t wqe_index;
uint32_t wq_tail = 0;
struct nes_hw_cqe cqe;
- uint32_t tmp;
uint64_t u64temp;
int move_cq_head = 1;
uint32_t err_code;
@@ -679,7 +678,6 @@ nes_upoll_cq_update:
nesvctx = to_nes_uctx(cq->context);
nesvctx->nesupd->udoorbell->cqe_alloc = cpu_to_le32(nesucq->cq_id |
(nesucq->polled_completions << 16));
- tmp = nesvctx->nesupd->udoorbell->cqe_alloc;
nesucq->polled_completions = 0;
}
} else {
@@ -699,7 +697,6 @@ nes_upoll_cq_update:
nesvctx = to_nes_uctx(cq->context);
nesvctx->nesupd->udoorbell->cqe_alloc = cpu_to_le32(nesucq->cq_id |
(nesucq->polled_completions << 16));
- tmp = nesvctx->nesupd->udoorbell->cqe_alloc;
nesucq->polled_completions = 0;
}
nesucq->head = head;
@@ -1140,7 +1137,6 @@ struct ibv_qp *nes_ucreate_qp(struct ibv_pd *pd, struct ibv_qp_init_attr *attr)
struct nes_uqp *nesuqp;
int sqdepth, rqdepth;
int status = 1;
- int i = 0;
/* fprintf(stderr, PFX "%s\n", __FUNCTION__); */
@@ -1211,6 +1207,8 @@ struct ibv_qp *nes_ucreate_qp(struct ibv_pd *pd, struct ibv_qp_init_attr *attr)
#if HAVE_DECL_IBV_QPT_RAW_ETH
if (attr->qp_type == IBV_QPT_RAW_ETH) {
+ int i = 0;
+
nesuqp->nes_ud_sksq_fd = open("/dev/infiniband/nes_ud_sksq",
O_RDWR);
if (nesuqp->nes_ud_sksq_fd <= 0)
@@ -1327,7 +1325,6 @@ int nes_udestroy_qp(struct ibv_qp *qp)
{
struct nes_uqp *nesuqp = to_nes_uqp(qp);
int ret = 0;
- int i = 0;
// fprintf(stderr, PFX "%s addr&mr= %p \n", __FUNCTION__, &nesuqp->mr );
@@ -1353,6 +1350,8 @@ int nes_udestroy_qp(struct ibv_qp *qp)
#if HAVE_DECL_IBV_QPT_RAW_ETH
if (qp->qp_type == IBV_QPT_RAW_ETH) {
+ int i = 0;
+
if (nesuqp->pend_rx_wr) {
for (i = 0; i < NES_UD_RX_BATCH_SZ; i++)
if (nesuqp->pend_rx_wr[i].sg_list) {
@@ -1381,6 +1380,7 @@ int nes_udestroy_qp(struct ibv_qp *qp)
return 0;
}
+#if HAVE_DECL_IBV_QPT_RAW_ETH
static inline
int nes_ima_upost_send(struct ibv_qp *ib_qp, struct ibv_send_wr *ib_wr,
struct ibv_send_wr **bad_wr)
@@ -1457,6 +1457,7 @@ int nes_ima_upost_send(struct ibv_qp *ib_qp, struct ibv_send_wr *ib_wr,
out:
return ret;
}
+#endif
/**
* nes_upost_send
@@ -1653,6 +1654,7 @@ int nes_upost_send(struct ibv_qp *ib_qp, struct ibv_send_wr *ib_wr,
return err;
}
+#if HAVE_DECL_IBV_QPT_RAW_ETH
static inline
int nes_ima_upost_recv(struct ibv_qp *ib_qp, struct ibv_recv_wr *ib_wr,
struct ibv_recv_wr **bad_wr)
@@ -1727,6 +1729,7 @@ int nes_ima_upost_recv(struct ibv_qp *ib_qp, struct ibv_recv_wr *ib_wr,
out:
return ret;
}
+#endif
/**
* nes_upost_recv
@@ -945,10 +945,11 @@ static inline void *ocrdma_hwq_head(struct ocrdma_qp_hwq_info *q)
return q->va + (q->head * q->entry_size);
}
-static inline void *ocrdma_wq_tail(struct ocrdma_qp_hwq_info *q)
+/*static inline void *ocrdma_wq_tail(struct ocrdma_qp_hwq_info *q)
{
return q->va + (q->tail * q->entry_size);
}
+*/
static inline void *ocrdma_hwq_head_from_idx(struct ocrdma_qp_hwq_info *q,
uint32_t idx)
@@ -128,13 +128,6 @@ static inline int __list_empty(struct work_list *list)
return list->list.next == &list->list;
}
-static inline int list_empty(struct work_list *work_list)
-{
- pthread_mutex_lock(&work_list->lock);
- return work_list->list.next == &work_list->list;
- pthread_mutex_unlock(&work_list->lock);
-}
-
static inline struct list_head *__list_remove_head(struct work_list *work_list)
{
struct list_head *list_item;
@@ -144,15 +137,6 @@ static inline struct list_head *__list_remove_head(struct work_list *work_list)
return list_item;
}
-static inline struct list_head *list_remove_head(struct work_list *work_list)
-{
- struct list_head *list_item;
- pthread_mutex_lock(&work_list->lock);
- list_item = __list_remove_head(work_list);
- pthread_mutex_unlock(&work_list->lock);
- return list_item;
-}
-
static inline void list_add_tail(struct work_list *work_list, struct list_head *req)
{
int empty;
@@ -121,7 +121,8 @@ static int ucma_set_server_port(void)
FILE *f;
if ((f = fopen(IBACM_PORT_FILE, "r" STREAM_CLOEXEC))) {
- fscanf(f, "%" SCNu16, &server_port);
+ if (fscanf(f, "%" SCNu16, &server_port) != 1)
+ server_port = 0;
fclose(f);
}
return server_port;
@@ -404,6 +404,20 @@ struct ds_udp_header {
#define ds_next_qp(qp) container_of((qp)->list.next, struct ds_qp, list)
+static void write_all(int fd, const void *msg, size_t len)
+{
+ // FIXME: if fd is a socket this really needs to handle EINTR and other conditions.
+ ssize_t rc = write(fd, msg, len);
+ assert(rc == len);
+}
+
+static void read_all(int fd, void *msg, size_t len)
+{
+ // FIXME: if fd is a socket this really needs to handle EINTR and other conditions.
+ ssize_t rc = read(fd, msg, len);
+ assert(rc == len);
+}
+
static void ds_insert_qp(struct rsocket *rs, struct ds_qp *qp)
{
if (!rs->qp_list)
@@ -444,8 +458,8 @@ static int rs_notify_svc(struct rs_svc *svc, struct rsocket *rs, int cmd)
msg.cmd = cmd;
msg.status = EINVAL;
msg.rs = rs;
- write(svc->sock[0], &msg, sizeof msg);
- read(svc->sock[0], &msg, sizeof msg);
+ write_all(svc->sock[0], &msg, sizeof msg);
+ read_all(svc->sock[0], &msg, sizeof msg);
ret = rdma_seterrno(msg.status);
if (svc->cnt)
goto unlock;
@@ -484,6 +498,15 @@ static int rs_scale_to_value(int value, int bits)
value : (value & ~(1 << (bits - 1))) << bits;
}
+/* gcc > ~5 will not allow (void)fscanf to suppress -Wunused-result, but this
+ will do it. In this case ignoring the result is OK (but horribly
+ unfriendly to user) since the library has a sane default. */
+#define failable_fscanf(f, fmt, ...) \
+ { \
+ int rc = fscanf(f, fmt, __VA_ARGS__); \
+ (void) rc; \
+ }
+
void rs_configure(void)
{
FILE *f;
@@ -501,27 +524,27 @@ void rs_configure(void)
ucma_ib_init();
if ((f = fopen(RS_CONF_DIR "/polling_time", "r"))) {
- (void) fscanf(f, "%u", &polling_time);
+ failable_fscanf(f, "%u", &polling_time);
fclose(f);
}
if ((f = fopen(RS_CONF_DIR "/inline_default", "r"))) {
- (void) fscanf(f, "%hu", &def_inline);
+ failable_fscanf(f, "%hu", &def_inline);
fclose(f);
}
if ((f = fopen(RS_CONF_DIR "/sqsize_default", "r"))) {
- (void) fscanf(f, "%hu", &def_sqsize);
+ failable_fscanf(f, "%hu", &def_sqsize);
fclose(f);
}
if ((f = fopen(RS_CONF_DIR "/rqsize_default", "r"))) {
- (void) fscanf(f, "%hu", &def_rqsize);
+ failable_fscanf(f, "%hu", &def_rqsize);
fclose(f);
}
if ((f = fopen(RS_CONF_DIR "/mem_default", "r"))) {
- (void) fscanf(f, "%u", &def_mem);
+ failable_fscanf(f, "%u", &def_mem);
fclose(f);
if (def_mem < 1)
@@ -529,14 +552,14 @@ void rs_configure(void)
}
if ((f = fopen(RS_CONF_DIR "/wmem_default", "r"))) {
- (void) fscanf(f, "%u", &def_wmem);
+ failable_fscanf(f, "%u", &def_wmem);
fclose(f);
if (def_wmem < RS_SNDLOWAT)
def_wmem = RS_SNDLOWAT << 1;
}
if ((f = fopen(RS_CONF_DIR "/iomap_size", "r"))) {
- (void) fscanf(f, "%hu", &def_iomap_size);
+ failable_fscanf(f, "%hu", &def_iomap_size);
fclose(f);
/* round to supported values */
@@ -3345,7 +3368,8 @@ static int rs_set_keepalive(struct rsocket *rs, int on)
if (on) {
if (!rs->keepalive_time) {
if ((f = fopen("/proc/sys/net/ipv4/tcp_keepalive_time", "r"))) {
- (void) fscanf(f, "%u", &rs->keepalive_time);
+ if (fscanf(f, "%u", &rs->keepalive_time) != 1)
+ rs->keepalive_time = 7200;
fclose(f);
} else {
rs->keepalive_time = 7200;
@@ -3985,7 +4009,7 @@ static void udp_svc_process_sock(struct rs_svc *svc)
{
struct rs_svc_msg msg;
- read(svc->sock[1], &msg, sizeof msg);
+ read_all(svc->sock[1], &msg, sizeof msg);
switch (msg.cmd) {
case RS_SVC_ADD_DGRAM:
msg.status = rs_svc_add_rs(svc, msg.rs);
@@ -4009,7 +4033,7 @@ static void udp_svc_process_sock(struct rs_svc *svc)
break;
}
- write(svc->sock[1], &msg, sizeof msg);
+ write_all(svc->sock[1], &msg, sizeof msg);
}
static uint8_t udp_svc_sgid_index(struct ds_dest *dest, union ibv_gid *sgid)
@@ -4184,7 +4208,7 @@ static void *udp_svc_run(void *arg)
ret = rs_svc_grow_sets(svc, 4);
if (ret) {
msg.status = ret;
- write(svc->sock[1], &msg, sizeof msg);
+ write_all(svc->sock[1], &msg, sizeof msg);
return (void *) (uintptr_t) ret;
}
@@ -4222,7 +4246,7 @@ static void tcp_svc_process_sock(struct rs_svc *svc)
struct rs_svc_msg msg;
int i;
- read(svc->sock[1], &msg, sizeof msg);
+ read_all(svc->sock[1], &msg, sizeof msg);
switch (msg.cmd) {
case RS_SVC_ADD_KEEPALIVE:
msg.status = rs_svc_add_rs(svc, msg.rs);
@@ -4253,7 +4277,7 @@ static void tcp_svc_process_sock(struct rs_svc *svc)
default:
break;
}
- write(svc->sock[1], &msg, sizeof msg);
+ write_all(svc->sock[1], &msg, sizeof msg);
}
/*
@@ -4266,7 +4290,7 @@ static void tcp_svc_send_keepalive(struct rsocket *rs)
if (rs_ctrl_avail(rs) && (rs->state & rs_connected)) {
rs->ctrl_seqno++;
rs_post_write(rs, NULL, 0, rs_msg_set(RS_OP_CTRL, RS_CTRL_KEEPALIVE),
- 0, (uint64_t) NULL, (uint64_t) NULL);
+ 0, (uintptr_t) NULL, (uintptr_t) NULL);
}
fastlock_release(&rs->cq_lock);
}
@@ -4282,7 +4306,7 @@ static void *tcp_svc_run(void *arg)
ret = rs_svc_grow_sets(svc, 16);
if (ret) {
msg.status = ret;
- write(svc->sock[1], &msg, sizeof msg);
+ write_all(svc->sock[1], &msg, sizeof msg);
return (void *) (uintptr_t) ret;
}
@@ -596,6 +596,12 @@ void convert_send_wr(struct rxe_send_wr *kwr, struct ibv_send_wr *uwr)
kwr->wr.atomic.swap = uwr->wr.atomic.swap;
kwr->wr.atomic.rkey = uwr->wr.atomic.rkey;
break;
+
+ case IBV_WR_LOCAL_INV:
+ case IBV_WR_BIND_MW:
+ case IBV_WR_SEND_WITH_INV:
+ case IBV_WR_TSO:
+ break;
}
}