[openib-general] Re: [openib-commits] r3362 - gen2/trunk/src/linux-kernel/infiniband/ulp/sdp

Michael S. Tsirkin mst at mellanox.co.il
Mon Sep 12 04:05:58 PDT 2005


Quoting Hal Rosenstock <halr at voltaire.com>:
> >  	sdp_dbg_init("Main pool initialized with min:max <%d:%d> buffers.",
> >  		     buff_min, buff_max);
> 
> These variables are no longer declared

I wander why does this compile for me?
Hal, does the following fix your problem?
5 files changed, 8 insertions(+), 79 deletions(-)

---

Kill unused code/data in sdp_buff.*

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

Index: linux-2.6.13/drivers/infiniband/ulp/sdp/sdp_proto.h
===================================================================
--- linux-2.6.13.orig/drivers/infiniband/ulp/sdp/sdp_proto.h	2005-09-12 13:58:10.000000000 +0300
+++ linux-2.6.13/drivers/infiniband/ulp/sdp/sdp_proto.h	2005-09-12 15:49:37.000000000 +0300
@@ -52,12 +52,6 @@ struct sdpc_buff *sdp_buff_pool_get(void
 
 void sdp_buff_pool_put(struct sdpc_buff *buff);
 
-void sdp_buff_pool_chain_put(struct sdpc_buff *buff, u32 count);
-
-void sdp_buff_pool_chain_link(struct sdpc_buff *head, struct sdpc_buff *buff);
-
-int sdp_buff_pool_buff_size(void);
-
 void sdp_buff_q_init(struct sdpc_buff_q *pool);
 
 void sdp_buff_q_clear_unmap(struct sdpc_buff_q *pool,
Index: linux-2.6.13/drivers/infiniband/ulp/sdp/sdp_recv.c
===================================================================
--- linux-2.6.13.orig/drivers/infiniband/ulp/sdp/sdp_recv.c	2005-09-08 11:55:59.000000000 +0300
+++ linux-2.6.13/drivers/infiniband/ulp/sdp/sdp_recv.c	2005-09-12 15:49:37.000000000 +0300
@@ -1064,7 +1064,6 @@ int sdp_inet_recv(struct kiocb  *req, st
 	struct sdp_sock   *conn;
 	struct sdpc_iocb *iocb;
 	struct sdpc_buff *buff;
-	struct sdpc_buff *head = NULL;
 	long   timeout;
 	size_t length;
 	int result = 0;
@@ -1073,7 +1072,6 @@ int sdp_inet_recv(struct kiocb  *req, st
 	int copied = 0;
 	int copy;
 	int update;
-	int free_count = 0;
 	s8 oob = 0;
 	s8 ack = 0;
 	struct sdpc_buff_q peek_queue;
@@ -1215,15 +1213,8 @@ int sdp_inet_recv(struct kiocb  *req, st
 			else {
 				if (buff->flags & SDP_BUFF_F_OOB_PRES)
 					conn->rcv_urg_cnt -= 1;
-				/*
-				 * create a link of buffers which
-				 * will be returned to the free pool
-				 * in one group.
-				 */
-				sdp_buff_pool_chain_link(head, buff);
 
-				head = buff;
-				free_count++;
+				sdp_buff_pool_put(buff);
 				/*
 				 * post additional recv buffers if
 				 * needed, but check only every N
@@ -1383,8 +1374,6 @@ done:
 			sdp_dbg_warn(conn, "Error <%d> flushing recv queue.",
 				     expect);
 	}
-
-	sdp_buff_pool_chain_put(head, free_count);
 	/*
 	 * return any peeked buffers to the recv queue, in the correct order.
 	 */
Index: linux-2.6.13/drivers/infiniband/ulp/sdp/sdp_sent.c
===================================================================
--- linux-2.6.13.orig/drivers/infiniband/ulp/sdp/sdp_sent.c	2005-09-08 11:55:59.000000000 +0300
+++ linux-2.6.13/drivers/infiniband/ulp/sdp/sdp_sent.c	2005-09-12 15:52:41.000000000 +0300
@@ -117,7 +117,6 @@ static int sdp_sent_abort(struct sdp_soc
  */
 int sdp_event_send(struct sdp_sock *conn, struct ib_wc *comp)
 {
-	struct sdpc_buff *head = NULL;
 	struct sdpc_buff *buff;
 	u64 current_wrid = 0;
 	u32 free_count = 0;
@@ -240,21 +239,15 @@ int sdp_event_send(struct sdp_sock *conn
 
 		if (SDP_BUFF_F_GET_UNSIG(buff) > 0)
 			conn->send_usig--;
-		/*
-		 * create a link of buffers which will be returned to
-		 * the free pool in one group.
-		 */
-		sdp_buff_pool_chain_link(head, buff);
 
-		head = buff;
+		sdp_buff_pool_put(buff);
+
 		free_count++;
 
 		if (comp->wr_id == current_wrid)
 			break;
 	}
 
-	sdp_buff_pool_chain_put(head, free_count);
-
 	if (free_count <= 0 || conn->send_usig < 0) {
 		sdp_dbg_warn(conn,
 			     "Send processing mismatch. <%llu:%llu:%d:%d>",
@@ -276,7 +269,6 @@ int sdp_event_send(struct sdp_sock *conn
 	return 0;
 drop:
 	sdp_buff_pool_put(buff);
-	sdp_buff_pool_chain_put(head, free_count);
 done:
 	return result;
 }
Index: linux-2.6.13/drivers/infiniband/ulp/sdp/sdp_buff.c
===================================================================
--- linux-2.6.13.orig/drivers/infiniband/ulp/sdp/sdp_buff.c	2005-09-11 12:36:48.000000000 +0300
+++ linux-2.6.13/drivers/infiniband/ulp/sdp/sdp_buff.c	2005-09-12 15:51:18.000000000 +0300
@@ -305,7 +305,7 @@ void sdp_buff_q_clear_unmap(struct sdpc_
 /*
  * sdp_buff_pool_release - release allocated buffers from the main pool
  */
-static void sdp_buff_pool_release(struct sdpc_buff *buff)
+void sdp_buff_pool_put(struct sdpc_buff *buff)
 {
 	kmem_cache_free(main_pool.pool_cache, buff->head);
 	kmem_cache_free(main_pool.buff_cache, buff);
@@ -368,8 +368,7 @@ int sdp_buff_pool_init(void)
 		result = -ENOMEM;
 		goto error_buff;
 	}
-	sdp_dbg_init("Main pool initialized with min:max <%d:%d> buffers.",
-		     buff_min, buff_max);
+	sdp_dbg_init("Main pool initialized.");
 
 	return 0;
 
@@ -416,34 +415,3 @@ struct sdpc_buff *sdp_buff_pool_get(void
 
 	return buff;
 }
-
-/*
- * sdp_buff_pool_put - Return a buffer to the main buffer pool
- */
-void sdp_buff_pool_put(struct sdpc_buff *buff)
-{
-	sdp_buff_pool_release(buff);
-}
-
-/*
- * sdp_buff_pool_chain_link - create chain of buffers which can be returned
- */
-void sdp_buff_pool_chain_link(struct sdpc_buff *head, struct sdpc_buff *buff)
-{
-	sdp_buff_pool_release(buff);
-}
-
-/*
- * sdp_buff_pool_chain_put - Return a buffer to the main buffer pool
- */
-void sdp_buff_pool_chain_put(struct sdpc_buff *buff, u32 count)
-{
-}
-
-/*
- * sdp_buff_pool_buff_size - return the size of buffers in the main pool
- */
-int sdp_buff_pool_buff_size(void)
-{
-	return PAGE_SIZE;
-}
Index: linux-2.6.13/drivers/infiniband/ulp/sdp/sdp_buff.h
===================================================================
--- linux-2.6.13.orig/drivers/infiniband/ulp/sdp/sdp_buff.h	2005-09-08 19:19:46.000000000 +0300
+++ linux-2.6.13/drivers/infiniband/ulp/sdp/sdp_buff.h	2005-09-12 15:49:37.000000000 +0300
@@ -76,24 +76,8 @@ struct sdpc_buff {
 };
 
 struct sdpc_buff_root {
-	/*
-	 * variant
-	 */
-	struct sdpc_buff_q pool;  /* actual pool of buffers */
-	spinlock_t lock;          /* spin lock for pool access */
-	/*
-	 * invariant
-	 */
-	kmem_cache_t *pool_cache; /* cache of pool objects */
+	kmem_cache_t *pool_cache; /* pool of buffers */
 	kmem_cache_t *buff_cache; /* cache of buffer descriptor objects */
-
-	int buff_min;   /* minimum allocated buffers */
-	int buff_max;   /* maximum allocated buffers */
-	int buff_cur;   /* total allocated buffers */
-	int buff_size;	/* size of each buffer in the pool */
-
-	int alloc_inc;  /* allocation increment */
-	int free_mark;  /* start freeing unused buffers */
 };
 
 /*
@@ -117,4 +101,6 @@ struct sdpc_buff_root {
  */
 #define sdp_buff_q_size(pool) ((pool)->size)
 
+#define sdp_buff_pool_buff_size() PAGE_SIZE
+
 #endif /* _SDP_BUFF_H */

-- 
MST



More information about the general mailing list