summaryrefslogtreecommitdiffstats
path: root/src/drivers
diff options
context:
space:
mode:
authorMichael Brown2017-03-22 09:47:46 +0100
committerMichael Brown2017-03-22 10:18:02 +0100
commit39ef530088859ccbbcf29bf6af2cf9f0307dc476 (patch)
tree1f90063aa65d6fa2065bdb7f430aebf70623856e /src/drivers
parent[build] Avoid confusing sparse in single-argument DBG() macros (diff)
downloadipxe-39ef530088859ccbbcf29bf6af2cf9f0307dc476.tar.gz
ipxe-39ef530088859ccbbcf29bf6af2cf9f0307dc476.tar.xz
ipxe-39ef530088859ccbbcf29bf6af2cf9f0307dc476.zip
[infiniband] Return status code from ib_create_cq() and ib_create_qp()
Any underlying errors arising during ib_create_cq() or ib_create_qp() are lost since the functions simply return NULL on error. This makes debugging harder, since a debug-enabled build is required to discover the root cause of the error. Fix by returning a status code from these functions, thereby allowing any underlying errors to be propagated. Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/drivers')
-rw-r--r--src/drivers/infiniband/flexboot_nodnic.c16
-rw-r--r--src/drivers/infiniband/hermon.c20
-rw-r--r--src/drivers/net/eoib.c19
-rw-r--r--src/drivers/net/ipoib.c20
4 files changed, 33 insertions, 42 deletions
diff --git a/src/drivers/infiniband/flexboot_nodnic.c b/src/drivers/infiniband/flexboot_nodnic.c
index 1ee10f54..2108e78f 100644
--- a/src/drivers/infiniband/flexboot_nodnic.c
+++ b/src/drivers/infiniband/flexboot_nodnic.c
@@ -860,6 +860,7 @@ static int flexboot_nodnic_eth_open ( struct net_device *netdev ) {
mlx_uint64 cq_size = 0;
mlx_uint32 qpn = 0;
nodnic_port_state state = nodnic_port_state_down;
+ int rc;
if ( port->port_priv.port_state & NODNIC_PORT_OPENED ) {
DBGC ( flexboot_nodnic, "%s: port %d is already opened\n",
@@ -877,11 +878,11 @@ static int flexboot_nodnic_eth_open ( struct net_device *netdev ) {
}
INIT_LIST_HEAD ( &dummy_cq->work_queues );
- port->eth_qp = ib_create_qp ( ibdev, IB_QPT_ETH,
- FLEXBOOT_NODNIC_ETH_NUM_SEND_WQES, dummy_cq,
- FLEXBOOT_NODNIC_ETH_NUM_RECV_WQES, dummy_cq,
- &flexboot_nodnic_eth_qp_op, netdev->name );
- if ( !port->eth_qp ) {
+ if ( ( rc = ib_create_qp ( ibdev, IB_QPT_ETH,
+ FLEXBOOT_NODNIC_ETH_NUM_SEND_WQES, dummy_cq,
+ FLEXBOOT_NODNIC_ETH_NUM_RECV_WQES, dummy_cq,
+ &flexboot_nodnic_eth_qp_op, netdev->name,
+ &port->eth_qp ) ) != 0 ) {
DBGC ( flexboot_nodnic, "flexboot_nodnic %p port %d could not create queue pair\n",
flexboot_nodnic, ibdev->port );
status = MLX_OUT_OF_RESOURCES;
@@ -894,9 +895,8 @@ static int flexboot_nodnic_eth_open ( struct net_device *netdev ) {
MLX_FATAL_CHECK_STATUS(status, get_cq_size_err,
"nodnic_port_get_cq_size failed");
- port->eth_cq = ib_create_cq ( ibdev, cq_size,
- &flexboot_nodnic_eth_cq_op );
- if ( !port->eth_cq ) {
+ if ( ( rc = ib_create_cq ( ibdev, cq_size, &flexboot_nodnic_eth_cq_op,
+ &port->eth_cq ) ) != 0 ) {
DBGC ( flexboot_nodnic,
"flexboot_nodnic %p port %d could not create completion queue\n",
flexboot_nodnic, ibdev->port );
diff --git a/src/drivers/infiniband/hermon.c b/src/drivers/infiniband/hermon.c
index 2199a9d9..3797d96e 100644
--- a/src/drivers/infiniband/hermon.c
+++ b/src/drivers/infiniband/hermon.c
@@ -3261,24 +3261,20 @@ static int hermon_eth_open ( struct net_device *netdev ) {
goto err_open;
/* Allocate completion queue */
- port->eth_cq = ib_create_cq ( ibdev, HERMON_ETH_NUM_CQES,
- &hermon_eth_cq_op );
- if ( ! port->eth_cq ) {
+ if ( ( rc = ib_create_cq ( ibdev, HERMON_ETH_NUM_CQES,
+ &hermon_eth_cq_op, &port->eth_cq ) ) != 0 ) {
DBGC ( hermon, "Hermon %p port %d could not create completion "
- "queue\n", hermon, ibdev->port );
- rc = -ENOMEM;
+ "queue: %s\n", hermon, ibdev->port, strerror ( rc ) );
goto err_create_cq;
}
/* Allocate queue pair */
- port->eth_qp = ib_create_qp ( ibdev, IB_QPT_ETH,
- HERMON_ETH_NUM_SEND_WQES, port->eth_cq,
- HERMON_ETH_NUM_RECV_WQES, port->eth_cq,
- &hermon_eth_qp_op, netdev->name );
- if ( ! port->eth_qp ) {
+ if ( ( rc = ib_create_qp ( ibdev, IB_QPT_ETH, HERMON_ETH_NUM_SEND_WQES,
+ port->eth_cq, HERMON_ETH_NUM_RECV_WQES,
+ port->eth_cq, &hermon_eth_qp_op,
+ netdev->name, &port->eth_qp ) ) != 0 ) {
DBGC ( hermon, "Hermon %p port %d could not create queue "
- "pair\n", hermon, ibdev->port );
- rc = -ENOMEM;
+ "pair: %s\n", hermon, ibdev->port, strerror ( rc ) );
goto err_create_qp;
}
ib_qp_set_ownerdata ( port->eth_qp, netdev );
diff --git a/src/drivers/net/eoib.c b/src/drivers/net/eoib.c
index e8247837..ba291295 100644
--- a/src/drivers/net/eoib.c
+++ b/src/drivers/net/eoib.c
@@ -538,22 +538,19 @@ static int eoib_open ( struct net_device *netdev ) {
}
/* Allocate completion queue */
- eoib->cq = ib_create_cq ( ibdev, EOIB_NUM_CQES, &eoib_cq_op );
- if ( ! eoib->cq ) {
- DBGC ( eoib, "EoIB %s could not allocate completion queue\n",
- eoib->name );
- rc = -ENOMEM;
+ if ( ( rc = ib_create_cq ( ibdev, EOIB_NUM_CQES, &eoib_cq_op,
+ &eoib->cq ) ) != 0 ) {
+ DBGC ( eoib, "EoIB %s could not create completion queue: %s\n",
+ eoib->name, strerror ( rc ) );
goto err_create_cq;
}
/* Allocate queue pair */
- eoib->qp = ib_create_qp ( ibdev, IB_QPT_UD, EOIB_NUM_SEND_WQES,
+ if ( ( rc = ib_create_qp ( ibdev, IB_QPT_UD, EOIB_NUM_SEND_WQES,
eoib->cq, EOIB_NUM_RECV_WQES, eoib->cq,
- &eoib_qp_op, netdev->name );
- if ( ! eoib->qp ) {
- DBGC ( eoib, "EoIB %s could not allocate queue pair\n",
- eoib->name );
- rc = -ENOMEM;
+ &eoib_qp_op, netdev->name, &eoib->qp ) )!=0){
+ DBGC ( eoib, "EoIB %s could not create queue pair: %s\n",
+ eoib->name, strerror ( rc ) );
goto err_create_qp;
}
ib_qp_set_ownerdata ( eoib->qp, eoib );
diff --git a/src/drivers/net/ipoib.c b/src/drivers/net/ipoib.c
index 8a65c87b..33c7ddcc 100644
--- a/src/drivers/net/ipoib.c
+++ b/src/drivers/net/ipoib.c
@@ -854,22 +854,20 @@ static int ipoib_open ( struct net_device *netdev ) {
}
/* Allocate completion queue */
- ipoib->cq = ib_create_cq ( ibdev, IPOIB_NUM_CQES, &ipoib_cq_op );
- if ( ! ipoib->cq ) {
- DBGC ( ipoib, "IPoIB %p could not allocate completion queue\n",
- ipoib );
- rc = -ENOMEM;
+ if ( ( rc = ib_create_cq ( ibdev, IPOIB_NUM_CQES, &ipoib_cq_op,
+ &ipoib->cq ) ) != 0 ) {
+ DBGC ( ipoib, "IPoIB %p could not create completion queue: "
+ "%s\n", ipoib, strerror ( rc ) );
goto err_create_cq;
}
/* Allocate queue pair */
- ipoib->qp = ib_create_qp ( ibdev, IB_QPT_UD, IPOIB_NUM_SEND_WQES,
+ if ( ( rc = ib_create_qp ( ibdev, IB_QPT_UD, IPOIB_NUM_SEND_WQES,
ipoib->cq, IPOIB_NUM_RECV_WQES, ipoib->cq,
- &ipoib_qp_op, netdev->name );
- if ( ! ipoib->qp ) {
- DBGC ( ipoib, "IPoIB %p could not allocate queue pair\n",
- ipoib );
- rc = -ENOMEM;
+ &ipoib_qp_op, netdev->name,
+ &ipoib->qp ) ) != 0 ) {
+ DBGC ( ipoib, "IPoIB %p could not create queue pair: %s\n",
+ ipoib, strerror ( rc ) );
goto err_create_qp;
}
ib_qp_set_ownerdata ( ipoib->qp, ipoib );