[openib-general] [PATCH]: GSI: Make RMPP ready to be a configurable option
Hal Rosenstock
halr at voltaire.com
Sat Aug 7 16:49:20 PDT 2004
Make RMPP ready to be a configurable option
This will be completed when I put in the changes for 2.6 kbuilding
For now, the Makefile continues to enable it
Index: gsi_main.c
===================================================================
--- gsi_main.c (revision 598)
+++ gsi_main.c (working copy)
@@ -138,7 +138,7 @@
# define GSI_REDIR_LIST_UNLOCK(class_info) spin_unlock_irqrestore(&class_info->redirect_class_port_info_list_lock,\
redirect_class_port_info_list_sflags)
-/* ID reserved for server (AGENT in IB MI terms) */
+/* ID reserved for server (Agent in IB MI terms) */
#define GSI_SERVER_ID 0
static struct list_head gsi_class_list;
@@ -154,14 +154,16 @@
static int gsi_hca_h_array_num_ports = 0;
#endif
-/* Current client ID (MANAGER in IB MI terms) */
+/* Current client ID (Manager in IB MI terms) */
static u32 gsi_curr_client_id = GSI_SERVER_ID + 1;
static u32 gsi_curr_tid_cnt = 0;
static u32 gsi_stat_2put_err = 0;
static u32 gsi_stat_put_err = 0;
+#ifdef GSI_RMPP_SUPPORT
extern int rmpp_spec_compliant;
+#endif
/*
* Our transaction ID structure -
@@ -195,6 +197,7 @@
static void gsi_thread_stop(struct gsi_hca_info_st *hca);
static void gsi_thread_signal(struct gsi_hca_info_st *hca);
+#ifdef GSI_RMPP_SUPPORT
static void gsi_rmpp_receive_cb(void *rmpp_h,
struct rmpp_ib_mad_element_t *rmpp_mad);
static void gsi_rmpp_send_compl_cb(void *rmpp_h,
@@ -210,6 +213,7 @@
static inline
int gsi_is_rmpp_mad(struct gsi_serv_class_info_st *class_info,
struct gsi_dtgrm_t *dtgrm);
+#endif
#ifndef min
static inline int
@@ -875,6 +879,7 @@
*handle = (void *) newinfo;
+#ifdef GSI_RMPP_SUPPORT
if (rmpp) {
if (gsi_dtgrm_pool_create(GSI_RMPP_RCV_POOL_SIZE,
&newinfo->rmpp_rcv_dtgrm_pool) < 0) {
@@ -905,6 +910,7 @@
printk(KERN_DEBUG "Registered RMPP service for class (0x%x)\n",
class);
}
+#endif
GSI_CLASS_LOCK();
list_add_tail((struct list_head *) newinfo, &gsi_class_list);
@@ -915,6 +921,7 @@
return 0;
+#ifdef GSI_RMPP_SUPPORT
error5:
if (rmpp)
gsi_dtgrm_pool_destroy(newinfo->rmpp_snd_dtgrm_pool);
@@ -923,6 +930,7 @@
gsi_dtgrm_pool_destroy(newinfo->rmpp_rcv_dtgrm_pool);
error3:
kfree(newinfo);
+#endif
error2:
gsi_hca_close(hca);
error1:
@@ -950,6 +958,7 @@
v_list_del((struct list_head *) class_info);
GSI_CLASS_UNLOCK();
+#ifdef GSI_RMPP_SUPPORT
if (class_info->rmpp) {
if (rmpp_deregister(class_info->rmpp_h) != RMPP_IB_SUCCESS) {
printk(KERN_ERR \
@@ -963,6 +972,7 @@
gsi_dtgrm_pool_destroy(class_info->rmpp_snd_dtgrm_pool);
gsi_dtgrm_pool_destroy(class_info->rmpp_rcv_dtgrm_pool);
}
+#endif
gsi_class_return_posted_snd_dtgrms(class_info);
gsi_class_clean_redirect_class_port_info_list(class_info);
@@ -1180,7 +1190,6 @@
gsi_post_receive_dtgrms(hca);
ib_req_notify_cq(hca->cq, IB_CQ_NEXT_COMP);
}
-
}
/*
@@ -1268,6 +1277,7 @@
/* Increase class use counter */
gsi_use_class_info(class_info);
+#ifdef GSI_RMPP_SUPPORT
/* If the sent MAD is for RMPP, handle it properly. */
if (gsi_is_rmpp_mad(class_info, (struct gsi_dtgrm_t *) dtgrm_priv)) {
printk(KERN_DEBUG "RMPP segment send done\n");
@@ -1275,6 +1285,9 @@
dtgrm_priv->rmpp_context);
gsi_dtgrm_pool_put((struct gsi_dtgrm_t *) dtgrm_priv);
} else if (class_info->send_compl_cb) {
+#else
+ if (class_info->send_compl_cb) {
+#endif
class_info->send_compl_cb(class_info,
class_info->context,
(struct gsi_dtgrm_t *) dtgrm_priv);
@@ -1324,7 +1337,7 @@
/*
* The function checks send datagram lists for all classes and release request datagrams
- * that was not released as a result of response (if the datagram life time is finished).
+ * that were not released as a result of response (if the datagram life time is finished).
*/
static void
gsi_sent_dtgrm_timer_handler(unsigned long data)
@@ -1499,8 +1512,8 @@
}
/*
-* Keep the received class port info in the redirect info list.
-*/
+ * Keep the received class port info in the redirect info list.
+ */
memcpy(&redirect_info->class_port_info,
&redir_mad->class_port_info,
sizeof (redirect_info->class_port_info));
@@ -1545,6 +1558,7 @@
return;
}
+#ifdef GSI_RMPP_SUPPORT
static void
gsi_rmpp_recv(struct gsi_serv_class_info_st *class_info,
struct gsi_dtgrm_priv_st *dtgrm_priv)
@@ -1587,6 +1601,7 @@
(((struct mad_rmpp_hdr_t *) &dtgrm->mad)->
rmpp_flags & MAD_RMPP_FLAG_ACTIVE));
}
+#endif
/*
* Receive callback
@@ -1701,11 +1716,13 @@
goto out1;
}
+#ifdef GSI_RMPP_SUPPORT
/* If the received MAD is for RMPP - handle it properly. */
if (gsi_is_rmpp_mad(class_info, (struct gsi_dtgrm_t *) dtgrm_priv)) {
gsi_rmpp_recv(class_info, dtgrm_priv);
goto out1;
}
+#endif
if (class_info->receive_cb) {
class_info->receive_cb(class_info,
class_info->context,
@@ -1781,7 +1798,6 @@
dtgrm_priv->rqp = 1;
dtgrm_priv->r_q_key = GSI_QP1_WELL_KNOWN_Q_KEY;
}
-
}
/*
@@ -1832,6 +1848,7 @@
}
}
+#ifdef GSI_RMPP_SUPPORT
if (gsi_is_rmpp_send_dtgrm(class_info, dtgrm)) {
printk(KERN_DEBUG "Post RMPP datagram\n");
ret = gsi_post_send_rmpp(class_info, dtgrm);
@@ -1839,6 +1856,11 @@
printk(KERN_DEBUG "Post regular datagram\n");
ret = gsi_post_send_mad(class_info, dtgrm);
}
+#else
+ printk(KERN_DEBUG "Post regular datagram\n");
+ ret = gsi_post_send_mad(class_info, dtgrm);
+#endif
+
error:
return ret;
}
@@ -1947,6 +1969,7 @@
return ret;
}
+#ifdef GSI_RMPP_SUPPORT
static void
gsi_conv_rmpp_mad_to_dtgrm(struct gsi_dtgrm_priv_st *dtgrm_priv,
struct rmpp_ib_mad_element_t *rmpp_mad)
@@ -1974,6 +1997,7 @@
dtgrm_priv->rmpp_dir_switch_needed = rmpp_mad->dir_switch_needed;
}
+#endif
/*
* Post send a single PLM reply MAD.
@@ -2076,6 +2100,7 @@
return ret;
}
+#ifdef GSI_RMPP_SUPPORT
static void
gsi_conv_rcv_dtgm_to_rmpp_mad(struct rmpp_ib_mad_element_t *rmpp_mad,
struct gsi_dtgrm_priv_st *dtgrm_priv)
@@ -2211,6 +2236,7 @@
err:
rmpp_put_mad(rmpp_mad);
}
+#endif
/*
* proc file read procedure.
@@ -2397,8 +2423,10 @@
GSI_HCA_LIST_LOCK_VAR;
printk("********************************************\n");
+#ifdef GSI_RMPP_SUPPORT
printk("SA SPEC compliant - %s\n\n",
rmpp_spec_compliant ? "TRUE" : "FALSE");
+#endif
/*
* Print HCA/port information
@@ -2589,9 +2617,8 @@
/*
* GSI thread.
- * If we may call completion callabacks only from
- * a thread context, not tasklets,
- * GSI thread is used.
+ * If we may call completion callbacks only from
+ * a thread context, not tasklets, GSI thread is used.
* The thread sleeps on a wait queue waiting for
* a signal from gsi_thread_compl_cb().
* gsi_compl_cb() will be called by the thread.
@@ -2856,7 +2883,9 @@
gsi_cleanup_module(void)
{
printk(KERN_DEBUG "Bye GSI!\n");
+#ifdef GSI_RMPP_SUPPORT
rmpp_cleanup();
+#endif
ib_device_notifier_deregister(&gsi_notifier);
@@ -3029,8 +3058,10 @@
}
memset((*dtgrm)->mad, 0, sizeof ((*dtgrm)->mad));
+#ifdef GSI_RMPP_SUPPORT
(*dtgrm)->rmpp_payload = NULL;
(*dtgrm)->rmpp_payload_size = 0;
+#endif
(*dtgrm)->is_marked_for_release = 0;
(*dtgrm)->is_in_use = 0;
((struct gsi_dtgrm_priv_st *) (*dtgrm))->posted = 0;
@@ -3056,7 +3087,9 @@
dtgrm_priv = ((struct gsi_dtgrm_priv_st *) dtgrm);
pool = (struct gsi_dtgrm_pool_info_st *) dtgrm_priv->pool;
+#ifdef GSI_RMPP_SUPPORT
gsi_dtgrm_free_rmpp_buf(dtgrm);
+#endif
kmem_cache_free(pool->cache, dtgrm);
@@ -3096,6 +3129,7 @@
return cnt;
}
+#ifdef GSI_RMPP_SUPPORT
void *
gsi_dtgrm_alloc_rmpp_buf(struct gsi_dtgrm_t *dtgrm, int size)
{
@@ -3123,6 +3157,7 @@
*size = dtgrm->rmpp_payload_size;
return dtgrm->rmpp_payload;
}
+#endif
/*
* Exported functions
@@ -3138,9 +3173,11 @@
EXPORT_SYMBOL_NOVERS(gsi_dtgrm_pool_get);
EXPORT_SYMBOL_NOVERS(gsi_dtgrm_pool_put);
EXPORT_SYMBOL_NOVERS(gsi_post_send_dtgrm);
+#ifdef GSI_RMPP_SUPPORT
EXPORT_SYMBOL_NOVERS(gsi_dtgrm_alloc_rmpp_buf);
EXPORT_SYMBOL_NOVERS(gsi_dtgrm_free_rmpp_buf);
EXPORT_SYMBOL_NOVERS(gsi_dtgrm_get_rmpp_buf);
+#endif
MODULE_LICENSE("GPL/BSD");
Index: gsi.h
===================================================================
--- gsi.h (revision 596)
+++ gsi.h (working copy)
@@ -60,7 +60,6 @@
#include "class_port_info.h"
#if 0
-#define GSI_RMPP_SUPPORT
#define GSI_POOL_TRACE
#endif
@@ -100,7 +99,7 @@
char mad[MAD_BLOCK_SIZE];
char cache_pad[(32 - ((sizeof (struct mad_t) + IB_GRH_LEN) % 32)) % 32];
-#if 1 /* GSI_RMPP_SUPPORT */
+#ifdef GSI_RMPP_SUPPORT
void *rmpp_payload;
int rmpp_payload_size;
void *rmpp_context;
@@ -230,7 +229,7 @@
*/
int gsi_post_send_dtgrm(void *handle, struct gsi_dtgrm_t *dtgrm);
-#if 1 /* GSI_RMPP_SUPPORT */
+#ifdef GSI_RMPP_SUPPORT
/*
* Allocate a buffer for RMMP (Relable Multi-Packet Protocol) payload.
* The buffer does not include general MAD header or RMMP header.
Index: Makefile
===================================================================
--- Makefile (revision 561)
+++ Makefile (working copy)
@@ -10,7 +10,7 @@
OBJS += gsi_rmpp_vendal.o rmpp/rmpp_module.o
#CFLAGS := -W -O2 -DVD_MODULE_NAME=GSI -DVD_TRACE_LEVEL=6 -DVD_ENTERLEAVE_LEVEL=3 -DMODULE -D__KERNEL__ -DKBUILD_BASENAME=$(MODULE) -DKBUILD_MODNAME=$(MODULE) $(INCDIRS)
-CFLAGS := -W -O2 -DVD_MODULE_NAME=GSI -DMODULE -D__KERNEL__ -DKBUILD_BASENAME=$(MODULE) -DKBUILD_MODNAME=$(MODULE) $(INCDIRS)
+CFLAGS := -W -O2 -DVD_MODULE_NAME=GSI -DMODULE -D__KERNEL__ -DKBUILD_BASENAME=$(MODULE) -DKBUILD_MODNAME=$(MODULE) -DGSI_RMPP_SUPPORT $(INCDIRS)
all: gsi.o
More information about the general
mailing list