[ofa-general] [PATCH 4/5] IB/ipoib: rx WQE draft in IPOIB UD

Eli Cohen eli at dev.mellanox.co.il
Fri Feb 1 02:25:20 PST 2008


IB/ipoib: rx WQE draft in IPOIB UD
    
Put a prepared WQE in the private data to save time in
the receive flow.
    
Signed-off-by: Eli Cohen <eli at mellanox.co.il>
---

Index: ofed_kernel/drivers/infiniband/ulp/ipoib/ipoib_ib.c
===================================================================
--- ofed_kernel.orig/drivers/infiniband/ulp/ipoib/ipoib_ib.c	2008-01-28 10:12:28.000000000 +0200
+++ ofed_kernel/drivers/infiniband/ulp/ipoib/ipoib_ib.c	2008-01-28 10:18:39.000000000 +0200
@@ -92,21 +92,13 @@ void ipoib_free_ah(struct kref *kref)
 static int ipoib_ib_post_receive(struct net_device *dev, int id)
 {
 	struct ipoib_dev_priv *priv = netdev_priv(dev);
-	struct ib_sge list;
-	struct ib_recv_wr param;
 	struct ib_recv_wr *bad_wr;
 	int ret;
 
-	list.addr     = priv->rx_ring[id].mapping;
-	list.length   = IPOIB_BUF_SIZE;
-	list.lkey     = priv->mr->lkey;
-
-	param.next    = NULL;
-	param.wr_id   = id | IPOIB_OP_RECV;
-	param.sg_list = &list;
-	param.num_sge = 1;
+	priv->sglist_draft.addr = priv->rx_ring[id].mapping;
+	priv->rx_wr_draft.wr_id = id | IPOIB_OP_RECV;
 
-	ret = ib_post_recv(priv->qp, &param, &bad_wr);
+	ret = ib_post_recv(priv->qp, &priv->rx_wr_draft, &bad_wr);
 	if (unlikely(ret)) {
 		ipoib_warn(priv, "receive failed for buf %d (%d)\n", id, ret);
 		ib_dma_unmap_single(priv->ca, priv->rx_ring[id].mapping,
@@ -202,7 +194,7 @@ static void ipoib_ib_handle_rx_wc(struct
 	 * Drop packets that this interface sent, ie multicast packets
 	 * that the HCA has replicated.
 	 */
-	if (wc->slid == priv->local_lid && wc->src_qp == priv->qp->qp_num)
+	if (unlikely(wc->slid == priv->local_lid && wc->src_qp == priv->qp->qp_num))
 		goto repost;
 
 	/*
Index: ofed_kernel/drivers/infiniband/ulp/ipoib/ipoib.h
===================================================================
--- ofed_kernel.orig/drivers/infiniband/ulp/ipoib/ipoib.h	2008-01-28 10:12:28.000000000 +0200
+++ ofed_kernel/drivers/infiniband/ulp/ipoib/ipoib.h	2008-01-28 10:17:10.000000000 +0200
@@ -327,6 +327,8 @@ struct ipoib_dev_priv {
 	spinlock_t lock;
 
 	struct net_device *dev;
+	struct ib_recv_wr rx_wr_draft;
+	struct ib_sge sglist_draft;
 
 	struct napi_struct napi;
 
Index: ofed_kernel/drivers/infiniband/ulp/ipoib/ipoib_verbs.c
===================================================================
--- ofed_kernel.orig/drivers/infiniband/ulp/ipoib/ipoib_verbs.c	2008-01-28 10:12:28.000000000 +0200
+++ ofed_kernel/drivers/infiniband/ulp/ipoib/ipoib_verbs.c	2008-01-28 10:17:10.000000000 +0200
@@ -217,6 +217,13 @@ int ipoib_transport_dev_init(struct net_
 	priv->tx_wr.sg_list 	= priv->tx_sge;
 	priv->tx_wr.send_flags 	= IB_SEND_SIGNALED;
 
+	priv->rx_wr_draft.next = NULL;
+	priv->rx_wr_draft.sg_list = &priv->sglist_draft;
+	priv->rx_wr_draft.num_sge = 1;
+
+	priv->sglist_draft.length = IPOIB_BUF_SIZE;
+	priv->sglist_draft.lkey = priv->mr->lkey;
+
 	return 0;
 
 out_free_cq:





More information about the general mailing list