[openib-general] [PATCH] remove unused code from SDP.
Libor Michalek
libor at topspin.com
Fri Feb 18 12:03:06 PST 2005
There's code in SDP which is never used, mostly helper functions that
at the time looked like they might be useful, but never got used.
-Libor
Signed-off-by: Libor Michalek <libor at topspin.com>
Index: sdp_link.c
===================================================================
--- sdp_link.c (revision 1831)
+++ sdp_link.c (working copy)
@@ -321,7 +321,7 @@
/*
* _sdp_link_path_rec_get - resolve GIDs to a path record
*/
-int _sdp_link_path_rec_get(struct sdp_path_info *info)
+static int _sdp_link_path_rec_get(struct sdp_path_info *info)
{
int result;
Index: sdp_inet.c
===================================================================
--- sdp_inet.c (revision 1831)
+++ sdp_inet.c (working copy)
@@ -1736,16 +1736,6 @@
goto error_proc;
}
/*
- * generic table
- */
- result = sdp_main_desc_init();
- if (0 > result) {
-
- sdp_warn("INIT: Error <%d> initializing generic table",
- result);
- goto error_generic;
- }
- /*
* advertisment table
*/
result = sdp_main_advt_init();
@@ -1816,8 +1806,6 @@
error_link:
(void)sdp_main_advt_cleanup();
error_advt:
- (void)sdp_main_desc_cleanup();
-error_generic:
(void)sdp_main_proc_cleanup();
error_proc:
return result; /* success */
@@ -1850,10 +1838,6 @@
*/
(void)sdp_main_advt_cleanup();
/*
- * delete generic table
- */
- (void)sdp_main_desc_cleanup();
- /*
* proc tables
*/
(void)sdp_main_proc_cleanup();
Index: sdp_proto.h
===================================================================
--- sdp_proto.h (revision 1832)
+++ sdp_proto.h (working copy)
@@ -56,8 +56,6 @@
int sdp_buff_pool_chain_link(struct sdpc_buff *head, struct sdpc_buff *buff);
-int sdp_buff_pool_size(void);
-
int sdp_buff_pool_buff_size(void);
int sdp_buff_q_init(struct sdpc_buff_q *pool, u32 size);
@@ -81,8 +79,6 @@
struct sdpc_buff *sdp_buff_q_look_head(struct sdpc_buff_q *pool);
-struct sdpc_buff *sdp_buff_q_look_tail(struct sdpc_buff_q *pool);
-
int sdp_buff_q_put(struct sdpc_buff_q *pool, struct sdpc_buff *buff);
int sdp_buff_q_put_head(struct sdpc_buff_q *pool, struct sdpc_buff *buff);
@@ -94,16 +90,6 @@
void *arg),
void *usr_arg);
-struct sdpc_buff *sdp_buff_q_fetch_tail(struct sdpc_buff_q *pool,
- int (*test)(struct sdpc_buff *buff,
- void *arg),
- void *usr_arg);
-
-int sdp_buff_q_trav_tail(struct sdpc_buff_q *pool,
- int (*trav_func)(struct sdpc_buff *buff,
- void *arg),
- void *usr_arg);
-
int sdp_buff_q_trav_head(struct sdpc_buff_q *pool,
int (*trav_func)(struct sdpc_buff *buff,
void *arg),
@@ -129,8 +115,6 @@
/*
* Wall between userspace protocol and SDP protocol proper
*/
-int sdp_wall_send_reject(struct sdp_opt *conn);
-
int sdp_wall_send_close(struct sdp_opt *conn);
int sdp_wall_send_closing(struct sdp_opt *conn);
@@ -162,14 +146,10 @@
int sdp_main_advt_cleanup(void);
-struct sdpc_advt_q *sdp_advt_q_create(int *result);
-
int sdp_advt_q_init(struct sdpc_advt_q *table);
int sdp_advt_q_clear(struct sdpc_advt_q *table);
-int sdp_advt_q_destroy(struct sdpc_advt_q *table);
-
struct sdpc_advt *sdp_advt_create(void);
int sdp_advt_destroy(struct sdpc_advt *advt);
@@ -187,14 +167,10 @@
int sdp_main_iocb_cleanup(void);
-struct sdpc_iocb_q *sdp_iocb_q_create(int *result);
-
int sdp_iocb_q_init(struct sdpc_iocb_q *table);
int sdp_iocb_q_clear(struct sdpc_iocb_q *table);
-int sdp_iocb_q_destroy(struct sdpc_iocb_q *table);
-
struct sdpc_iocb *sdp_iocb_create(void);
int sdp_iocb_destroy(struct sdpc_iocb *iocb);
@@ -209,8 +185,6 @@
int sdp_iocb_q_put_tail(struct sdpc_iocb_q *table, struct sdpc_iocb *iocb);
-struct sdpc_iocb *sdp_iocb_q_get_key(struct sdpc_iocb_q *table, u32 key);
-
struct sdpc_iocb *sdp_iocb_q_lookup(struct sdpc_iocb_q *table, u32 key);
int sdp_iocb_q_cancel(struct sdpc_iocb_q *table, u32 mask, ssize_t comp);
@@ -232,8 +206,6 @@
*/
int sdp_desc_q_remove(struct sdpc_desc *element);
-struct sdpc_desc *sdp_desc_q_get_all(struct sdpc_desc_q *table);
-
struct sdpc_desc *sdp_desc_q_get_head(struct sdpc_desc_q *table);
struct sdpc_desc *sdp_desc_q_get_tail(struct sdpc_desc_q *table);
@@ -246,12 +218,8 @@
struct sdpc_desc *sdp_desc_q_look_head(struct sdpc_desc_q *table);
-struct sdpc_desc *sdp_desc_q_look_tail(struct sdpc_desc_q *table);
-
int sdp_desc_q_type_head(struct sdpc_desc_q *table);
-int sdp_desc_q_type_tail(struct sdpc_desc_q *table);
-
struct sdpc_desc *sdp_desc_q_look_type_head(struct sdpc_desc_q *table,
enum sdp_desc_type type);
@@ -266,20 +234,10 @@
int sdp_desc_q_types_size(struct sdpc_desc_q *table,
enum sdp_desc_type type);
-int sdp_desc_q_size(struct sdpc_desc_q *table);
-
-struct sdpc_desc_q *sdp_desc_q_create(int *result);
-
int sdp_desc_q_init(struct sdpc_desc_q *table);
int sdp_desc_q_clear(struct sdpc_desc_q *table);
-int sdp_desc_q_destroy(struct sdpc_desc_q *table);
-
-int sdp_main_desc_init(void);
-
-int sdp_main_desc_cleanup(void);
-
/*
* proc entry managment
*/
Index: sdp_conn.c
===================================================================
--- sdp_conn.c (revision 1831)
+++ sdp_conn.c (working copy)
@@ -540,9 +540,9 @@
} /* sdp_inet_port_inherit */
/*
- * sdp_conn_table_insert - insert a connection into the connection table
+ * _sdp_conn_table_insert - insert a connection into the connection table
*/
-int sdp_conn_table_insert(struct sdp_opt *conn)
+static int _sdp_conn_table_insert(struct sdp_opt *conn)
{
u32 counter;
int result = -ENOMEM;
@@ -589,7 +589,7 @@
*/
spin_unlock_irqrestore(&_dev_root_s.sock_lock, flags);
return result;
-} /* sdp_conn_table_insert */
+} /* _sdp_conn_table_insert */
/*
* sdp_conn_table_remove - remove a connection from the connection table
@@ -1426,7 +1426,7 @@
/*
* insert connection into lookup table
*/
- result = sdp_conn_table_insert(conn);
+ result = _sdp_conn_table_insert(conn);
if (0 > result) {
sdp_dbg_warn(conn, "Error <%d> conn table insert <%d:%d>",
Index: sdp_advt.c
===================================================================
--- sdp_advt.c (revision 1831)
+++ sdp_advt.c (working copy)
@@ -35,7 +35,6 @@
#include "sdp_main.h"
static kmem_cache_t *__sdp_advt_cache = NULL;
-static kmem_cache_t *__sdp_advt_table = NULL;
/*
* module specific functions
@@ -171,33 +170,6 @@
} /* sdp_advt_q_put */
/*
- * public table functions
- */
-
-/*
- * sdp_advt_q_create - create an advertisment table
- */
-struct sdpc_advt_q *sdp_advt_q_create(int * result)
-{
- struct sdpc_advt_q *table = NULL;
-
- SDP_CHECK_NULL(result, NULL);
-
- table = kmem_cache_alloc(__sdp_advt_table, SLAB_KERNEL);
- if (NULL == table) {
-
- *result = -ENOMEM;
- return NULL;
- }
-
- table->head = NULL;
- table->size = 0;
-
- *result = 0;
- return table;
-} /* sdp_advt_q_create */
-
-/*
* sdp_advt_q_init - initialize a new empty advertisment table
*/
int sdp_advt_q_init(struct sdpc_advt_q *table)
@@ -232,31 +204,6 @@
} /* sdp_advt_q_clear */
/*
- * sdp_advt_q_destroy - destroy an advertisment table
- */
-int sdp_advt_q_destroy(struct sdpc_advt_q *table)
-{
- struct sdpc_advt *advt;
- int result;
-
- SDP_CHECK_NULL(table, -EINVAL);
- /*
- * drain the table of any objects
- */
- while (NULL != (advt = sdp_advt_q_get(table))) {
-
- result = sdp_advt_destroy(advt);
- SDP_EXPECT(!(0 > result));
- }
- /*
- * return the table to the cache
- */
- kmem_cache_free(__sdp_advt_table, table);
-
- return 0;
-} /* sdp_advt_q_destroy */
-
-/*
* primary initialization/cleanup functions
*/
@@ -271,7 +218,7 @@
/*
* initialize the caches only once.
*/
- if (NULL != __sdp_advt_cache || NULL != __sdp_advt_table) {
+ if (NULL != __sdp_advt_cache) {
sdp_warn("Advertisment caches already initialized.");
return -EINVAL;
@@ -287,20 +234,7 @@
goto error_advt_c;
}
- __sdp_advt_table = kmem_cache_create("sdp_advt_q",
- sizeof(struct sdpc_advt_q),
- 0, SLAB_HWCACHE_ALIGN, NULL,
- NULL);
- if (NULL == __sdp_advt_table) {
-
- result = -ENOMEM;
- goto error_advt_t;
- }
-
return 0;
-error_advt_t:
- kmem_cache_destroy(__sdp_advt_cache);
- __sdp_advt_cache = NULL;
error_advt_c:
return 0;
} /* sdp_main_advt_init */
@@ -315,12 +249,10 @@
* cleanup the caches
*/
kmem_cache_destroy(__sdp_advt_cache);
- kmem_cache_destroy(__sdp_advt_table);
/*
* null out entries.
*/
__sdp_advt_cache = NULL;
- __sdp_advt_table = NULL;
return 0;
} /* sdp_main_advt_cleanup */
Index: sdp_wall.c
===================================================================
--- sdp_wall.c (revision 1831)
+++ sdp_wall.c (working copy)
@@ -39,30 +39,6 @@
*/
/*
- * sdp_wall_send_reject - callback to reject an active open
- */
-int sdp_wall_send_reject(struct sdp_opt *conn)
-{
- int result;
-
- SDP_CHECK_NULL(conn, -EINVAL);
-
- sdp_dbg_ctrl(conn, "Connect reject. src <%08x:%04x> dst <%08x:%04x>",
- conn->src_addr, conn->src_port,
- conn->dst_addr, conn->dst_port);
- /*
- * respond to the remote connection manager with a REQ_REJ
- */
- result = sdp_cm_reject(conn);
- if (0 > result) {
-
- sdp_dbg_warn(conn, "Error <%d> CM connect reject", result);
- }
-
- return 0;
-} /* sdp_wall_send_reject */
-
-/*
* sdp_wall_send_close - callback to accept an active close
*/
int sdp_wall_send_close(struct sdp_opt *conn)
Index: sdp_iocb.c
===================================================================
--- sdp_iocb.c (revision 1831)
+++ sdp_iocb.c (working copy)
@@ -35,7 +35,6 @@
#include "sdp_main.h"
static kmem_cache_t *__sdp_iocb_cache = NULL;
-static kmem_cache_t *__sdp_iocb_table = NULL;
/*
* memory locking functions
@@ -778,30 +777,6 @@
} /* sdp_iocb_q_look */
/*
- * sdp_iocb_q_get_key - find an iocb based on key, and remove it
- */
-struct sdpc_iocb *sdp_iocb_q_get_key(struct sdpc_iocb_q *table, u32 key)
-{
- struct sdpc_iocb *iocb;
- int result;
-
- iocb = sdp_iocb_q_lookup(table, key);
- if (NULL == iocb) {
-
- goto done;
- }
-
- result = sdp_iocb_q_remove(iocb);
- if (0 > result) {
-
- iocb = NULL;
- }
-
-done:
- return iocb;
-} /* sdp_iocb_q_get_key */
-
-/*
* _sdp_iocb_q_get - get, and remove, the object at the tables head
*/
static struct sdpc_iocb *_sdp_iocb_q_get(struct sdpc_iocb_q *table, int head)
@@ -852,9 +827,9 @@
/*
* _sdp_iocb_q_put - put the IOCB object at the tables tail
*/
-int _sdp_iocb_q_put(struct sdpc_iocb_q *table,
- struct sdpc_iocb *iocb,
- int head)
+static int _sdp_iocb_q_put(struct sdpc_iocb_q *table,
+ struct sdpc_iocb *iocb,
+ int head)
{
struct sdpc_iocb *next;
struct sdpc_iocb *prev;
@@ -966,31 +941,6 @@
} /* sdp_iocb_q_cancel */
/*
- * public table functions
- */
-
-/*
- * sdp_iocb_q_create - create an IOCB table
- */
-struct sdpc_iocb_q *sdp_iocb_q_create(int *result)
-{
- struct sdpc_iocb_q *table = NULL;
-
- table = kmem_cache_alloc(__sdp_iocb_table, SLAB_KERNEL);
- if (NULL == table) {
-
- *result = -ENOMEM;
- return NULL;
- }
-
- table->head = NULL;
- table->size = 0;
-
- *result = 0;
- return table;
-} /* sdp_iocb_q_create */
-
-/*
* sdp_iocb_q_init - initialize a new empty IOCB table
*/
int sdp_iocb_q_init(struct sdpc_iocb_q *table)
@@ -1025,27 +975,6 @@
} /* sdp_iocb_q_clear */
/*
- * sdp_iocb_q_destroy - destroy an IOCB table
- */
-int sdp_iocb_q_destroy(struct sdpc_iocb_q *table)
-{
- int result;
-
- SDP_CHECK_NULL(table, -EINVAL);
- /*
- * drain the table of any objects
- */
- result = sdp_iocb_q_clear(table);
- SDP_EXPECT(!(0 > result));
- /*
- * return the table to the cache
- */
- kmem_cache_free(__sdp_iocb_table, table);
-
- return 0;
-} /* sdp_iocb_q_destroy */
-
-/*
* primary initialization/cleanup functions
*/
@@ -1069,8 +998,7 @@
/*
* initialize the caches only once.
*/
- if (NULL != __sdp_iocb_cache ||
- NULL != __sdp_iocb_table) {
+ if (NULL != __sdp_iocb_cache) {
sdp_warn("IOCB caches already initialized.");
return -EINVAL;
@@ -1086,20 +1014,7 @@
goto error_iocb_c;
}
- __sdp_iocb_table = kmem_cache_create("sdp_iocb_q",
- sizeof(struct sdpc_iocb_q),
- 0, SLAB_HWCACHE_ALIGN, NULL,
- NULL);
- if (NULL == __sdp_iocb_table) {
-
- result = -ENOMEM;
- goto error_iocb_t;
- }
-
return 0;
-error_iocb_t:
- kmem_cache_destroy(__sdp_iocb_cache);
- __sdp_iocb_cache = NULL;
error_iocb_c:
(void)_sdp_mem_lock_cleanup();
return result;
@@ -1115,12 +1030,10 @@
* cleanup the caches
*/
kmem_cache_destroy(__sdp_iocb_cache);
- kmem_cache_destroy(__sdp_iocb_table);
/*
* null out entries.
*/
__sdp_iocb_cache = NULL;
- __sdp_iocb_table = NULL;
/*
* cleanup memory locking
*/
Index: sdp_buff.c
===================================================================
--- sdp_buff.c (revision 1831)
+++ sdp_buff.c (working copy)
@@ -299,18 +299,6 @@
} /* sdp_buff_q_look_head */
/*
- * sdp_buff_q_look_tail - look at the buffer at the end of the pool
- */
-struct sdpc_buff *sdp_buff_q_look_tail(struct sdpc_buff_q *pool)
-{
- struct sdpc_buff *buff;
-
- buff = _sdp_buff_q_look(pool, 0);
-
- return buff;
-} /* sdp_buff_q_look_tail */
-
-/*
* sdp_buff_q_fetch_head - Get the pools first buffer, if the test passes
*/
struct sdpc_buff *sdp_buff_q_fetch_head(struct sdpc_buff_q *pool,
@@ -326,21 +314,6 @@
} /* sdp_buff_q_fetch_head */
/*
- * sdp_buff_q_fetch_tail - Get the pools last buffer, if the test passes
- */
-struct sdpc_buff *sdp_buff_q_fetch_tail(struct sdpc_buff_q *pool,
- int (*test)(struct sdpc_buff *buff,
- void *arg),
- void *usr_arg)
-{
- struct sdpc_buff *buff;
-
- buff = _sdp_buff_q_get(pool, 0, test, usr_arg);
-
- return buff;
-} /* sdp_buff_q_fetch_tail */
-
-/*
* sdp_buff_q_fetch - Get the first matching buffer from the pool
*/
struct sdpc_buff *sdp_buff_q_fetch(struct sdpc_buff_q *pool,
@@ -383,41 +356,6 @@
} /* sdp_buff_q_fetch_head */
/*
- * sdp_buff_q_trav_tail - traverse buffers in pool,from the tail
- */
-int sdp_buff_q_trav_tail(struct sdpc_buff_q *pool,
- int (*trav_func)(struct sdpc_buff *buff,
- void *arg),
- void *usr_arg)
-{
- struct sdpc_buff *buff;
- int result = 0;
- int counter;
-
- SDP_CHECK_NULL(pool, -EINVAL);
- SDP_CHECK_NULL(trav_func, -EINVAL);
- /*
- * check to see if there is anything to traverse.
- */
- if (NULL != pool->head) {
- /*
- * lock to prevent corruption of table
- */
- for (counter = 0, buff = pool->head->prev;
- counter < pool->size; counter++, buff = buff->prev) {
-
- result = trav_func(buff, usr_arg);
- if (0 > result) {
-
- break;
- }
- }
- }
-
- return result;
-} /* sdp_buff_q_trav_tail */
-
-/*
* sdp_buff_q_trav_head - traverse buffers in pool, from the head
*/
int sdp_buff_q_trav_head(struct sdpc_buff_q *pool,
@@ -988,26 +926,6 @@
} /* sdp_buff_pool_chain_put */
/*
- * sdp_buff_pool_size - number of elements in the main buffer pool
- */
-int sdp_buff_pool_size(void)
-{
- unsigned long flags;
- int size;
-
- if (NULL == main_pool) {
-
- return -1;
- }
-
- spin_lock_irqsave(&main_pool->lock, flags);
- size = sdp_buff_q_size(&main_pool->pool);
- spin_unlock_irqrestore(&main_pool->lock, flags);
-
- return size;
-} /* sdp_buff_pool_size */
-
-/*
* sdp_buff_pool_buff_size - return the size of buffers in the main pool
*/
int sdp_buff_pool_buff_size(void)
Index: sdp_queue.c
===================================================================
--- sdp_queue.c (revision 1831)
+++ sdp_queue.c (working copy)
@@ -34,8 +34,6 @@
#include "sdp_main.h"
-static kmem_cache_t *__sdp_desc_table = NULL;
-
/*
* module specific functions
*/
@@ -207,23 +205,6 @@
} /* sdp_desc_q_lookup */
/*
- * sdp_desc_q_get_all - Get the element at the front of the table
- */
-struct sdpc_desc *sdp_desc_q_get_all(struct sdpc_desc_q *table)
-{
- struct sdpc_desc *head;
-
- head = table->head;
-
- table->head = NULL;
- table->size = 0;
-
- memset(table->count, 0, sizeof(table->count));
-
- return head;
-} /* sdp_desc_q_get_all */
-
-/*
* sdp_desc_q_get_head - Get the element at the front of the table
*/
struct sdpc_desc *sdp_desc_q_get_head(struct sdpc_desc_q *table)
@@ -268,16 +249,6 @@
} /* sdp_desc_q_look_head */
/*
- * sdp_desc_q_look_tail - look at the end of the table
- */
-struct sdpc_desc *sdp_desc_q_look_tail(struct sdpc_desc_q *table)
-{
- SDP_CHECK_NULL(table, NULL);
-
- return ((NULL == table->head) ? NULL : table->head->prev);
-} /* sdp_desc_q_look_tail */
-
-/*
* sdp_desc_q_type_head - look at the type at the front of the table
*/
int sdp_desc_q_type_head(struct sdpc_desc_q *table)
@@ -295,23 +266,6 @@
} /* sdp_desc_q_type_head */
/*
- * sdp_desc_q_type_tail - look at the type at the end of the table
- */
-int sdp_desc_q_type_tail(struct sdpc_desc_q *table)
-{
- SDP_CHECK_NULL(table, -EINVAL);
-
- if (NULL == table->head) {
-
- return SDP_DESC_TYPE_NONE;
- }
- else {
-
- return table->head->prev->type;
- }
-} /* sdp_desc_q_type_tail */
-
-/*
* sdp_desc_q_look_type_head - look at a specific object
*/
struct sdpc_desc *sdp_desc_q_look_type_head(struct sdpc_desc_q *table,
@@ -361,35 +315,6 @@
} /* sdp_desc_q_types_size */
/*
- * public table functions
- */
-
-/*
- * sdp_desc_q_create - create/allocate a generic table
- */
-struct sdpc_desc_q *sdp_desc_q_create(int *result)
-{
- struct sdpc_desc_q *table = NULL;
-
- SDP_CHECK_NULL(result, NULL);
-
- table = kmem_cache_alloc(__sdp_desc_table, SLAB_ATOMIC);
- if (NULL == table) {
-
- *result = -ENOMEM;
- return NULL;
- }
-
- table->head = NULL;
- table->size = 0;
-
- memset(table, 0, sizeof(struct sdpc_desc_q));
-
- *result = 0;
- return table;
-} /* sdp_desc_q_create */
-
-/*
* sdp_desc_q_init - initialize a new empty generic table
*/
int sdp_desc_q_init(struct sdpc_desc_q *table)
@@ -427,77 +352,3 @@
return 0;
} /* sdp_desc_q_clear */
-
-/*
- * sdp_desc_q_destroy - destroy a generic table
- */
-int sdp_desc_q_destroy(struct sdpc_desc_q *table)
-{
- int result;
-
- SDP_CHECK_NULL(table, -EINVAL);
- /*
- * drain the table of any objects
- */
- result = sdp_desc_q_clear(table);
- SDP_EXPECT(!(0 > result));
- /*
- * return the table to the cache
- */
- kmem_cache_free(__sdp_desc_table, table);
-
- return 0;
-} /* sdp_desc_q_destroy */
-
-/*
- * primary initialization/cleanup functions
- */
-
-/*
- * sdp_main_desc_init - initialize the generic table caches
- */
-int sdp_main_desc_init(void)
-{
- int result;
-
- sdp_dbg_init("Generic table cache initialization.");
- /*
- * initialize the caches only once.
- */
- if (NULL != __sdp_desc_table) {
-
- sdp_warn("Generic table caches already initialized.");
- return -EINVAL;
- }
-
- __sdp_desc_table = kmem_cache_create("sdp_desc_q",
- sizeof(struct sdpc_desc_q), 0,
- SLAB_HWCACHE_ALIGN, NULL, NULL);
- if (NULL == __sdp_desc_table) {
-
- result = -ENOMEM;
- goto error_advt_t;
- }
-
- return 0;
-error_advt_t:
- return 0;
-} /* sdp_main_desc_init */
-
-/*
- * sdp_main_desc_cleanup - cleanup the generic table caches
- */
-int sdp_main_desc_cleanup(void)
-{
- sdp_dbg_init("Generic table cache cleanup.");
- /*
- * cleanup the caches
- */
- kmem_cache_destroy(__sdp_desc_table);
- /*
- * null out entries.
- */
- __sdp_desc_table = NULL;
-
- return 0;
-} /* sdp_main_desc_cleanup */
More information about the general
mailing list