sctp: Do not account for sizeof(struct sk_buff) in estimated rwnd
[linux-2.6.git] / net / rds / rdma_transport.c
index e599ba2..f8760e1 100644 (file)
 
 static struct rdma_cm_id *rds_rdma_listen_id;
 
+static char *rds_cm_event_strings[] = {
+#define RDS_CM_EVENT_STRING(foo) \
+               [RDMA_CM_EVENT_##foo] = __stringify(RDMA_CM_EVENT_##foo)
+       RDS_CM_EVENT_STRING(ADDR_RESOLVED),
+       RDS_CM_EVENT_STRING(ADDR_ERROR),
+       RDS_CM_EVENT_STRING(ROUTE_RESOLVED),
+       RDS_CM_EVENT_STRING(ROUTE_ERROR),
+       RDS_CM_EVENT_STRING(CONNECT_REQUEST),
+       RDS_CM_EVENT_STRING(CONNECT_RESPONSE),
+       RDS_CM_EVENT_STRING(CONNECT_ERROR),
+       RDS_CM_EVENT_STRING(UNREACHABLE),
+       RDS_CM_EVENT_STRING(REJECTED),
+       RDS_CM_EVENT_STRING(ESTABLISHED),
+       RDS_CM_EVENT_STRING(DISCONNECTED),
+       RDS_CM_EVENT_STRING(DEVICE_REMOVAL),
+       RDS_CM_EVENT_STRING(MULTICAST_JOIN),
+       RDS_CM_EVENT_STRING(MULTICAST_ERROR),
+       RDS_CM_EVENT_STRING(ADDR_CHANGE),
+       RDS_CM_EVENT_STRING(TIMEWAIT_EXIT),
+#undef RDS_CM_EVENT_STRING
+};
+
+static char *rds_cm_event_str(enum rdma_cm_event_type type)
+{
+       return rds_str_array(rds_cm_event_strings,
+                            ARRAY_SIZE(rds_cm_event_strings), type);
+};
+
 int rds_rdma_cm_event_handler(struct rdma_cm_id *cm_id,
                              struct rdma_cm_event *event)
 {
@@ -44,8 +72,8 @@ int rds_rdma_cm_event_handler(struct rdma_cm_id *cm_id,
        struct rds_transport *trans;
        int ret = 0;
 
-       rdsdebug("conn %p id %p handling event %u\n", conn, cm_id,
-                event->event);
+       rdsdebug("conn %p id %p handling event %u (%s)\n", conn, cm_id,
+                event->event, rds_cm_event_str(event->event));
 
        if (cm_id->device->node_type == RDMA_NODE_RNIC)
                trans = &rds_iw_transport;
@@ -109,7 +137,8 @@ int rds_rdma_cm_event_handler(struct rdma_cm_id *cm_id,
 
        default:
                /* things like device disconnect? */
-               printk(KERN_ERR "RDS: unknown event %u!\n", event->event);
+               printk(KERN_ERR "RDS: unknown event %u (%s)!\n",
+                      event->event, rds_cm_event_str(event->event));
                break;
        }
 
@@ -117,18 +146,20 @@ out:
        if (conn)
                mutex_unlock(&conn->c_cm_lock);
 
-       rdsdebug("id %p event %u handling ret %d\n", cm_id, event->event, ret);
+       rdsdebug("id %p event %u (%s) handling ret %d\n", cm_id, event->event,
+                rds_cm_event_str(event->event), ret);
 
        return ret;
 }
 
-static int __init rds_rdma_listen_init(void)
+static int rds_rdma_listen_init(void)
 {
        struct sockaddr_in sin;
        struct rdma_cm_id *cm_id;
        int ret;
 
-       cm_id = rdma_create_id(rds_rdma_cm_event_handler, NULL, RDMA_PS_TCP);
+       cm_id = rdma_create_id(rds_rdma_cm_event_handler, NULL, RDMA_PS_TCP,
+                              IB_QPT_RC);
        if (IS_ERR(cm_id)) {
                ret = PTR_ERR(cm_id);
                printk(KERN_ERR "RDS/RDMA: failed to setup listener, "
@@ -177,7 +208,7 @@ static void rds_rdma_listen_stop(void)
        }
 }
 
-int __init rds_rdma_init(void)
+static int rds_rdma_init(void)
 {
        int ret;
 
@@ -204,7 +235,7 @@ out:
 }
 module_init(rds_rdma_init);
 
-void rds_rdma_exit(void)
+static void rds_rdma_exit(void)
 {
        /* stop listening first to ensure no new connections are attempted */
        rds_rdma_listen_stop();