[openib-general] [PATCH] mthca: make IB_SEND_FENCE work

Michael S. Tsirkin mst at mellanox.co.il
Wed Aug 9 00:50:36 PDT 2006


Quoting r. Muli Ben-Yehuda <muli at il.ibm.com>:
> Subject: Re: [PATCH] mthca: make IB_SEND_FENCE work
> 
> On Wed, Aug 09, 2006 at 10:37:20AM +0300, Michael S. Tsirkin wrote:
> > Quoting r. Muli Ben-Yehuda <muli at il.ibm.com>:
> > > > +enum {
> > > > +	MTHCA_SEND_DOORBELL_FENCE = 1 << 5
> > > > +};
> > > 
> > > Does anonymous enum have any benefit over define for this?
> > 
> > Not really, no.
> 
> Good, because I think #define is the idiomatic way to do this...

Fine with me too.

--

IB/mthca: make IB_SEND_FENCE work

Fence bit must be set in the doorbell, not only in WQE

Signed-off-by: Michael S. Tsirkin <mst at mellanox.co.il>

diff --git a/drivers/infiniband/hw/mthca/mthca_doorbell.h b/drivers/infiniband/hw/mthca/mthca_doorbell.h
index dd9a44d..e5f0ad6 100644
--- a/drivers/infiniband/hw/mthca/mthca_doorbell.h
+++ b/drivers/infiniband/hw/mthca/mthca_doorbell.h
@@ -42,6 +42,8 @@ #define MTHCA_RECEIVE_DOORBELL 0x18
 #define MTHCA_CQ_DOORBELL      0x20
 #define MTHCA_EQ_DOORBELL      0x28
 
+#define MTHCA_SEND_DOORBELL_FENCE (1 << 5)
+
 #if BITS_PER_LONG == 64
 /*
  * Assume that we can just write a 64-bit doorbell atomically.  s390
diff --git a/drivers/infiniband/hw/mthca/mthca_qp.c b/drivers/infiniband/hw/mthca/mthca_qp.c
index cd8b672..6efba4a 100644
--- a/drivers/infiniband/hw/mthca/mthca_qp.c
+++ b/drivers/infiniband/hw/mthca/mthca_qp.c
@@ -1502,7 +1502,7 @@ int mthca_tavor_post_send(struct ib_qp *
 	int i;
 	int size;
 	int size0 = 0;
-	u32 f0 = 0;
+	u32 f0 = unlikely(wr->send_flags & IB_SEND_FENCE) ? MTHCA_SEND_DOORBELL_FENCE : 0;
 	int ind;
 	u8 op0 = 0;
 
@@ -1843,7 +1843,7 @@ int mthca_arbel_post_send(struct ib_qp *
 	int i;
 	int size;
 	int size0 = 0;
-	u32 f0 = 0;
+	u32 f0 = unlikely(wr->send_flags & IB_SEND_FENCE) ? MTHCA_SEND_DOORBELL_FENCE : 0;
 	int ind;
 	u8 op0 = 0;
 
@@ -1864,6 +1864,7 @@ int mthca_arbel_post_send(struct ib_qp *
 
 			qp->sq.head += MTHCA_ARBEL_MAX_WQES_PER_SEND_DB;
 			size0 = 0;
+			f0 = unlikely(wr->send_flags & IB_SEND_FENCE) ? MTHCA_SEND_DOORBELL_FENCE : 0;
 
 			/*
 			 * Make sure that descriptors are written before

-- 
MST




More information about the general mailing list