Whamcloud - gitweb
b=11245,i=liangzhen:
authorisaac <isaac>
Sun, 1 Feb 2009 21:00:46 +0000 (21:00 +0000)
committerisaac <isaac>
Sun, 1 Feb 2009 21:00:46 +0000 (21:00 +0000)
- IB path MTU mistakenly set to 1st path MTU when ib_mtu is off.

lnet/ChangeLog
lnet/klnds/o2iblnd/o2iblnd.c
lnet/klnds/o2iblnd/o2iblnd_modparams.c
lnet/utils/portals.c

index a85dcc2..5b9b547 100644 (file)
@@ -18,6 +18,12 @@ Description:
 Details    :
 
 Severity   : minor
+Bugzilla   : 11245
+Description: IB path MTU mistakenly set to 1st path MTU when ib_mtu is off
+Details    : See comment 46 in bug 11245 for details - it's indeed a bug
+             introduced by the original 11245 fix.
+
+Severity   : minor
 Bugzilla   : 15984
 Description: uptllnd credit overflow fix
 Details    : kptl_msg_t::ptlm_credits could be overflown by uptllnd since
index 0416c7c..749278a 100644 (file)
@@ -772,17 +772,9 @@ kiblnd_create_conn (kib_peer_t *peer, struct rdma_cm_id *cmid, int state)
         init_qp_attr->send_cq = cq;
         init_qp_attr->recv_cq = cq;
 
-        rc = 0;
         write_lock_irqsave(&kiblnd_data.kib_global_lock, flags);
         switch (*kiblnd_tunables.kib_ib_mtu) {
-        default:
-                rc = *kiblnd_tunables.kib_ib_mtu;
-                /* fall through to... */
-        case 0: /* set tunable to the default
-                 * CAVEAT EMPTOR! this assumes the default is one of the MTUs
-                 * below, otherwise we'll WARN on the next QP create */
-                *kiblnd_tunables.kib_ib_mtu =
-                        ib_mtu_enum_to_int(cmid->route.path_rec->mtu);
+        case 0: /* don't force path MTU */
                 break;
         case 256:
                 cmid->route.path_rec->mtu = IB_MTU_256;
@@ -799,13 +791,12 @@ kiblnd_create_conn (kib_peer_t *peer, struct rdma_cm_id *cmid, int state)
         case 4096:
                 cmid->route.path_rec->mtu = IB_MTU_4096;
                 break;
+        default:
+                LBUG();
+                break;
         }
         write_unlock_irqrestore(&kiblnd_data.kib_global_lock, flags);
 
-        if (rc != 0)
-                CWARN("Invalid IB MTU value %d, using default value %d\n",
-                      rc, *kiblnd_tunables.kib_ib_mtu);
-                                
         rc = rdma_create_qp(cmid, net->ibn_dev->ibd_pd, init_qp_attr);
         if (rc != 0) {
                 CERROR("Can't create QP: %d\n", rc);
@@ -1052,16 +1043,23 @@ kiblnd_ctl(lnet_ni_t *ni, unsigned int cmd, void *arg)
                 break;
         }
         case IOC_LIBCFS_GET_CONN: {
-                kib_conn_t *conn = kiblnd_get_conn_by_idx(ni, data->ioc_count);
+                kib_conn_t *conn;
 
+                rc = 0;
+                conn = kiblnd_get_conn_by_idx(ni, data->ioc_count);
                 if (conn == NULL) {
                         rc = -ENOENT;
-                } else {
-                        // kiblnd_debug_conn(conn);
-                        rc = 0;
-                        data->ioc_nid = conn->ibc_peer->ibp_nid;
-                        kiblnd_conn_decref(conn);
+                        break;
                 }
+
+                LASSERT (conn->ibc_cmid != NULL);
+                data->ioc_nid = conn->ibc_peer->ibp_nid;
+                if (conn->ibc_cmid->route.path_rec == NULL)
+                        data->ioc_u32[0] = 0; /* iWarp has no path MTU */
+                else
+                        data->ioc_u32[0] =
+                        ib_mtu_enum_to_int(conn->ibc_cmid->route.path_rec->mtu);
+                kiblnd_conn_decref(conn);
                 break;
         }
         case IOC_LIBCFS_CLOSE_CONNECTION: {
@@ -1427,18 +1425,11 @@ out:
 int
 kiblnd_base_startup (void)
 {
-        int               rc;
-        int               i;
+        int i;
+        int rc;
 
         LASSERT (kiblnd_data.kib_init == IBLND_INIT_NOTHING);
 
-        if (*kiblnd_tunables.kib_credits > *kiblnd_tunables.kib_ntx) {
-                CERROR("Can't set credits(%d) > ntx(%d)\n",
-                       *kiblnd_tunables.kib_credits,
-                       *kiblnd_tunables.kib_ntx);
-                return -EINVAL;
-        }
-
         PORTAL_MODULE_USE;
         memset(&kiblnd_data, 0, sizeof(kiblnd_data)); /* zero pointers, flags etc */
 
index dff7e7c..6af4e85 100644 (file)
@@ -351,7 +351,23 @@ kiblnd_sysctl_fini (void)
 int
 kiblnd_tunables_init (void)
 {
-        kiblnd_sysctl_init();
+        if (*kiblnd_tunables.kib_credits > *kiblnd_tunables.kib_ntx) {
+                CERROR("Can't set credits(%d) > ntx(%d)\n",
+                       *kiblnd_tunables.kib_credits,
+                       *kiblnd_tunables.kib_ntx);
+                return -EINVAL;
+        }
+
+        if (*kiblnd_tunables.kib_ib_mtu != 0 &&
+            *kiblnd_tunables.kib_ib_mtu != 256 &&
+            *kiblnd_tunables.kib_ib_mtu != 512 &&
+            *kiblnd_tunables.kib_ib_mtu != 1024 &&
+            *kiblnd_tunables.kib_ib_mtu != 2048 &&
+            *kiblnd_tunables.kib_ib_mtu != 4096) {
+                CERROR("Invalid ib_mtu %d, expected 256/512/1024/2048/4096\n",
+                       *kiblnd_tunables.kib_ib_mtu);
+                return -EINVAL;
+        }
 
         if (*kiblnd_tunables.kib_concurrent_sends > IBLND_RX_MSGS)
                 *kiblnd_tunables.kib_concurrent_sends = IBLND_RX_MSGS;
@@ -364,6 +380,7 @@ kiblnd_tunables_init (void)
                       *kiblnd_tunables.kib_concurrent_sends, IBLND_MSG_QUEUE_SIZE);
         }
 
+        kiblnd_sysctl_init();
         return 0;
 }
 
index fc700c3..9d043b7 100644 (file)
@@ -813,6 +813,10 @@ jt_ptl_print_connections (int argc, char **argv)
                         printf ("%-20s [%d]\n",
                                 libcfs_nid2str(data.ioc_nid),
                                 data.ioc_u32[0] /* device id */);
+                } else if (g_net_is_compatible (NULL, O2IBLND, 0)) {
+                        printf ("%s mtu %d\n",
+                                libcfs_nid2str(data.ioc_nid),
+                                data.ioc_u32[0]); /* path MTU */
                 } else {
                         printf ("%s\n", libcfs_nid2str(data.ioc_nid));
                 }