aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJason Gunthorpe <jgunthorpe@obsidianresearch.com>2011-03-09 01:28:10 +0000
committerRoland Dreier <roland@purestorage.com>2011-07-06 09:13:18 -0700
commit1a132f8341df2fe5c481308bc8353f9288933531 (patch)
tree0b5280343cf6e21b712d1962d20c1b9c6deb3962
parent64670397753cc6ea9d169ae6cc02e973f105b5d3 (diff)
downloadlibmlx4-1a132f8341df2fe5c481308bc8353f9288933531.tar.gz
Return ERRNO codes from ibv_post_send/recv instead of -1
The man pages for these functions document a positive return of errno, not -1. Signed-off-by: Jason Gunthorpe <jgunthorpe@obsidianresearch> Signed-off-by: Roland Dreier <roland@purestorage.com>
-rw-r--r--src/qp.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/qp.c b/src/qp.c
index d194ae3..ec138cd 100644
--- a/src/qp.c
+++ b/src/qp.c
@@ -40,6 +40,7 @@
#include <netinet/in.h>
#include <pthread.h>
#include <string.h>
+#include <errno.h>
#include "mlx4.h"
#include "doorbell.h"
@@ -206,19 +207,19 @@ int mlx4_post_send(struct ibv_qp *ibqp, struct ibv_send_wr *wr,
for (nreq = 0; wr; ++nreq, wr = wr->next) {
if (wq_overflow(&qp->sq, nreq, to_mcq(qp->ibv_qp.send_cq))) {
- ret = -1;
+ ret = ENOMEM;
*bad_wr = wr;
goto out;
}
if (wr->num_sge > qp->sq.max_gs) {
- ret = -1;
+ ret = ENOMEM;
*bad_wr = wr;
goto out;
}
if (wr->opcode >= sizeof mlx4_ib_opcode / sizeof mlx4_ib_opcode[0]) {
- ret = -1;
+ ret = EINVAL;
*bad_wr = wr;
goto out;
}
@@ -309,7 +310,7 @@ int mlx4_post_send(struct ibv_qp *ibqp, struct ibv_send_wr *wr,
if (inl > qp->max_inline_data) {
inl = 0;
- ret = -1;
+ ret = ENOMEM;
*bad_wr = wr;
goto out;
}
@@ -450,13 +451,13 @@ int mlx4_post_recv(struct ibv_qp *ibqp, struct ibv_recv_wr *wr,
for (nreq = 0; wr; ++nreq, wr = wr->next) {
if (wq_overflow(&qp->rq, nreq, to_mcq(qp->ibv_qp.recv_cq))) {
- ret = -1;
+ ret = ENOMEM;
*bad_wr = wr;
goto out;
}
if (wr->num_sge > qp->rq.max_gs) {
- ret = -1;
+ ret = ENOMEM;
*bad_wr = wr;
goto out;
}