Whamcloud - gitweb
* vibnal takes a single interface name which defaults to 'ipoib0'
authoreeb <eeb>
Thu, 2 Jun 2005 17:57:59 +0000 (17:57 +0000)
committereeb <eeb>
Thu, 2 Jun 2005 17:57:59 +0000 (17:57 +0000)
lnet/klnds/viblnd/viblnd.c
lnet/lnet/config.c

index 0486ca9..2a6aee7 100644 (file)
@@ -1575,6 +1575,10 @@ kibnal_shutdown (ptl_ni_t *ni)
 ptl_err_t
 kibnal_startup (ptl_ni_t *ni)
 {
+        char                     *ifname = "ipoib0"; /* default IF name */
+        __u32                     ip;
+        __u32                     netmask;
+        int                       up;
         struct timeval            tv;
         int                       pkmem = atomic_read(&portal_kmemory);
         int                       rc;
@@ -1590,12 +1594,28 @@ kibnal_startup (ptl_ni_t *ni)
                 return PTL_FAIL;
         }
 
+        CLASSERT (PTL_MAX_INTERFACES > 1);
+        
         if (ni->ni_interfaces[0] != NULL) {
-                CERROR("Explicit interface config not supported\n");
+                if (ni->ni_interfaces[1] != NULL) {
+                        CERROR("Multiple interfaces not supported\n");
+                        return PTL_FAIL;
+                }
+                ifname = ni->ni_interfaces[0];
+        }
+        
+        rc = libcfs_ipif_query(ifname, &up, &ip, &netmask);
+        if (rc != 0) {
+                CERROR("Can't queue interface %s: %d\n", ifname, rc);
                 return PTL_FAIL;
         }
-
-#warning discover IPoIB IP address here
+        
+        if (!up) {
+                CERROR("Can't use interface %s: it's down\n", ifname);
+                return PTL_FAIL;
+        }
+        
+        ni->ni_nid = PTL_MKNID(PTL_NIDNET(ni->ni_nid), ip);
         
         PORTAL_MODULE_USE;
         memset (&kibnal_data, 0, sizeof (kibnal_data)); /* zero pointers, flags etc */
index 631a7c6..f2d014b 100644 (file)
@@ -756,10 +756,16 @@ ptl_set_ip_niaddr (ptl_ni_t *ni)
                 rc = libcfs_ipif_query(ni->ni_interfaces[0],
                                        &up, &ip, &netmask);
                 if (rc != 0) {
-                        CERROR("Net %s can't qeury interface %s: %d\n",
+                        CERROR("Net %s can't query interface %s: %d\n",
                                libcfs_net2str(net), ni->ni_interfaces[0], rc);
                         return PTL_FAIL;
                 }
+
+                if (!up) {
+                        CERROR("Net %s can't use interface %s: it's down\n",
+                               libcfs_net2str(net), ni->ni_interfaces[0]);
+                        return PTL_FAIL;
+                }
                 
                 ni->ni_nid = PTL_MKNID(net, ip);
                 return PTL_OK;