[ofa-general] [PATCH] IB/mthca: optimize post srq

Eli Cohen eli at mellanox.co.il
Wed Oct 10 08:55:37 PDT 2007


Put likely/unlikely in post srq

Signed-off-by: Eli Cohen <eli at mellanox.co.il>

---
If this approach is accepted I can do the same for mlx4

Index: ofa_kernel-1.2.5/drivers/infiniband/hw/mthca/mthca_srq.c
===================================================================
--- ofa_kernel-1.2.5.orig/drivers/infiniband/hw/mthca/mthca_srq.c	2007-10-10 15:18:20.000000000 +0200
+++ ofa_kernel-1.2.5/drivers/infiniband/hw/mthca/mthca_srq.c	2007-10-10 15:18:40.000000000 +0200
@@ -509,7 +509,7 @@ int mthca_tavor_post_srq_recv(struct ib_
 	for (nreq = 0; wr; wr = wr->next) {
 		ind = srq->first_free;
 
-		if (ind < 0) {
+		if (unlikely(ind < 0)) {
 			mthca_err(dev, "SRQ %06x full\n", srq->srqn);
 			err = -ENOMEM;
 			*bad_wr = wr;
@@ -519,7 +519,7 @@ int mthca_tavor_post_srq_recv(struct ib_
 		wqe       = get_wqe(srq, ind);
 		next_ind  = *wqe_to_link(wqe);
 
-		if (next_ind < 0) {
+		if (unlikely(next_ind < 0)) {
 			mthca_err(dev, "SRQ %06x full\n", srq->srqn);
 			err = -ENOMEM;
 			*bad_wr = wr;
@@ -631,7 +631,7 @@ int mthca_arbel_post_srq_recv(struct ib_
 	for (nreq = 0; wr; ++nreq, wr = wr->next) {
 		ind = srq->first_free;
 
-		if (ind < 0) {
+		if (unlikely(ind < 0)) {
 			mthca_err(dev, "SRQ %06x full\n", srq->srqn);
 			err = -ENOMEM;
 			*bad_wr = wr;
@@ -641,7 +641,7 @@ int mthca_arbel_post_srq_recv(struct ib_
 		wqe       = get_wqe(srq, ind);
 		next_ind  = *wqe_to_link(wqe);
 
-		if (next_ind < 0) {
+		if (unlikely(next_ind < 0)) {
 			mthca_err(dev, "SRQ %06x full\n", srq->srqn);
 			err = -ENOMEM;
 			*bad_wr = wr;




More information about the general mailing list