diff mbox series

[1/1] IB/iser: add unlikely checks in the fast path

Message ID 1569274369-29217-1-git-send-email-maxg@mellanox.com (mailing list archive)
State Mainlined
Commit 70bcc63f84eaa08c53a14e669550cffc947ca3b7
Delegated to: Jason Gunthorpe
Headers show
Series [1/1] IB/iser: add unlikely checks in the fast path | expand

Commit Message

Max Gurtovoy Sept. 23, 2019, 9:32 p.m. UTC
ib_post_send, ib_post_recv and ib_dma_map_sg  operations should succeed
unless something unusual happened to the ib device.

Signed-off-by: Max Gurtovoy <maxg@mellanox.com>
---
 drivers/infiniband/ulp/iser/iser_memory.c | 2 +-
 drivers/infiniband/ulp/iser/iser_verbs.c  | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

Comments

Sagi Grimberg Sept. 23, 2019, 10:02 p.m. UTC | #1
Acked-by: Sagi Grimberg <sagi@grimberg.me>
Jason Gunthorpe Oct. 1, 2019, 2:29 p.m. UTC | #2
On Tue, Sep 24, 2019 at 12:32:49AM +0300, Max Gurtovoy wrote:
> ib_post_send, ib_post_recv and ib_dma_map_sg  operations should succeed
> unless something unusual happened to the ib device.
> 
> Signed-off-by: Max Gurtovoy <maxg@mellanox.com>
> Acked-by: Sagi Grimberg <sagi@grimberg.me>
> ---
>  drivers/infiniband/ulp/iser/iser_memory.c | 2 +-
>  drivers/infiniband/ulp/iser/iser_verbs.c  | 4 ++--
>  2 files changed, 3 insertions(+), 3 deletions(-)

Applied to for-next, thanks

Jason
diff mbox series

Patch

diff --git a/drivers/infiniband/ulp/iser/iser_memory.c b/drivers/infiniband/ulp/iser/iser_memory.c
index 2cc89a9..3a26e5b 100644
--- a/drivers/infiniband/ulp/iser/iser_memory.c
+++ b/drivers/infiniband/ulp/iser/iser_memory.c
@@ -170,7 +170,7 @@  int iser_dma_map_task_data(struct iscsi_iser_task *iser_task,
 	dev = iser_task->iser_conn->ib_conn.device->ib_device;
 
 	data->dma_nents = ib_dma_map_sg(dev, data->sg, data->size, dma_dir);
-	if (data->dma_nents == 0) {
+	if (unlikely(data->dma_nents == 0)) {
 		iser_err("dma_map_sg failed!!!\n");
 		return -EINVAL;
 	}
diff --git a/drivers/infiniband/ulp/iser/iser_verbs.c b/drivers/infiniband/ulp/iser/iser_verbs.c
index a6548de..94b5011 100644
--- a/drivers/infiniband/ulp/iser/iser_verbs.c
+++ b/drivers/infiniband/ulp/iser/iser_verbs.c
@@ -1019,7 +1019,7 @@  int iser_post_recvm(struct iser_conn *iser_conn, int count)
 
 	ib_conn->post_recv_buf_count += count;
 	ib_ret = ib_post_recv(ib_conn->qp, ib_conn->rx_wr, NULL);
-	if (ib_ret) {
+	if (unlikely(ib_ret)) {
 		iser_err("ib_post_recv failed ret=%d\n", ib_ret);
 		ib_conn->post_recv_buf_count -= count;
 	} else
@@ -1060,7 +1060,7 @@  int iser_post_send(struct ib_conn *ib_conn, struct iser_tx_desc *tx_desc,
 		first_wr = wr;
 
 	ib_ret = ib_post_send(ib_conn->qp, first_wr, NULL);
-	if (ib_ret)
+	if (unlikely(ib_ret))
 		iser_err("ib_post_send failed, ret:%d opcode:%d\n",
 			 ib_ret, wr->opcode);