Whamcloud - gitweb
* Added lonal (loopback NAL)
authoreeb <eeb>
Thu, 18 Nov 2004 11:19:59 +0000 (11:19 +0000)
committereeb <eeb>
Thu, 18 Nov 2004 11:19:59 +0000 (11:19 +0000)
16 files changed:
lustre/configure.in
lustre/portals/include/linux/kp30.h
lustre/portals/include/linux/libcfs.h
lustre/portals/knals/Makefile.in
lustre/portals/knals/Makefile.mk
lustre/portals/knals/autoMakefile.am
lustre/portals/knals/lonal/.cvsignore [new file with mode: 0644]
lustre/portals/knals/lonal/Makefile.in [new file with mode: 0644]
lustre/portals/knals/lonal/autoMakefile.am [new file with mode: 0644]
lustre/portals/knals/lonal/lonal.c [new file with mode: 0644]
lustre/portals/knals/lonal/lonal.h [new file with mode: 0644]
lustre/portals/knals/lonal/lonal_cb.c [new file with mode: 0644]
lustre/portals/utils/portals.c
lustre/ptlrpc/events.c
lustre/utils/lconf
lustre/utils/lmc

index 479bf65..f737f7d 100644 (file)
@@ -239,6 +239,8 @@ portals/knals/qswnal/Makefile
 portals/knals/qswnal/autoMakefile
 portals/knals/socknal/Makefile
 portals/knals/socknal/autoMakefile
+portals/knals/lonal/Makefile
+portals/knals/lonal/autoMakefile
 portals/libcfs/Makefile
 portals/libcfs/autoMakefile
 portals/portals/Makefile
index 1162c1b..55524f2 100644 (file)
@@ -651,6 +651,7 @@ enum {
         ROUTER    = 6,
         OPENIBNAL = 7,
         IIBNAL    = 8,
+        LONAL     = 9,
         NAL_ENUM_END_MARKER
 };
 
index 17f78b7..b1844a2 100644 (file)
@@ -109,6 +109,7 @@ struct ptldebug_header {
 #define S_SM          0x00800000
 #define S_ASOBD       0x01000000
 #define S_CONFOBD     0x02000000
+#define S_LONAL       0x04000000
 
 /* If you change these values, please keep portals/utils/debug.c
  * up to date! */
index 9763d14..610b55c 100644 (file)
@@ -3,5 +3,6 @@
 @BUILD_IIBNAL_TRUE@subdir-m += iibnal
 @BUILD_QSWNAL_TRUE@subdir-m += qswnal
 subdir-m += socknal
+subdir-m += lonal
 
 @INCLUDE_RULES@
index cd5d9d6..454ee16 100644 (file)
@@ -1,4 +1,5 @@
 include $(obj)/../Kernelenv
 
 obj-y = socknal/
+obj-y = lonal/
 # more coming...
index 0090364..2bc4b5c 100644 (file)
@@ -3,4 +3,4 @@
 # This code is issued under the GNU General Public License.
 # See the file COPYING in this distribution
 
-SUBDIRS = gmnal iibnal openibnal qswnal socknal 
+SUBDIRS = gmnal iibnal openibnal qswnal socknal lonal
diff --git a/lustre/portals/knals/lonal/.cvsignore b/lustre/portals/knals/lonal/.cvsignore
new file mode 100644 (file)
index 0000000..5ed596b
--- /dev/null
@@ -0,0 +1,10 @@
+.deps
+Makefile
+.*.cmd
+autoMakefile.in
+autoMakefile
+*.ko
+*.mod.c
+.*.flags
+.tmp_versions
+.depend
diff --git a/lustre/portals/knals/lonal/Makefile.in b/lustre/portals/knals/lonal/Makefile.in
new file mode 100644 (file)
index 0000000..222e861
--- /dev/null
@@ -0,0 +1,4 @@
+MODULES := klonal
+klonal-objs := lonal.o lonal_cb.o
+
+@INCLUDE_RULES@
diff --git a/lustre/portals/knals/lonal/autoMakefile.am b/lustre/portals/knals/lonal/autoMakefile.am
new file mode 100644 (file)
index 0000000..d1ef995
--- /dev/null
@@ -0,0 +1,11 @@
+# Copyright (C) 2001  Cluster File Systems, Inc.
+#
+# This code is issued under the GNU General Public License.
+# See the file COPYING in this distribution
+
+if MODULES
+modulenet_DATA = klonal$(KMODEXT)
+endif
+
+MOSTLYCLEANFILES = *.o *.ko *.mod.c
+DIST_SOURCES = $(klonal-objs:%.o=%.c) lonal.h
diff --git a/lustre/portals/knals/lonal/lonal.c b/lustre/portals/knals/lonal/lonal.c
new file mode 100644 (file)
index 0000000..055e002
--- /dev/null
@@ -0,0 +1,170 @@
+/*
+ * Copyright (C) 2002 Cluster File Systems, Inc.
+ *   Author: Eric Barton <eric@bartonsoftware.com>
+ *
+ * Copyright (C) 2002, Lawrence Livermore National Labs (LLNL)
+ * W. Marcus Miller - Based on ksocknal
+ *
+ * This file is part of Portals, http://www.sf.net/projects/lustre/
+ *
+ * Portals is free software; you can redistribute it and/or
+ * modify it under the terms of version 2 of the GNU General Public
+ * License as published by the Free Software Foundation.
+ *
+ * Portals is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Portals; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+#include "lonal.h"
+
+nal_t                  klonal_api;
+klonal_data_t          klonal_data;
+ptl_handle_ni_t        klonal_ni;
+
+
+int
+klonal_cmd (struct portals_cfg *pcfg, void *private)
+{
+       LASSERT (pcfg != NULL);
+       
+       switch (pcfg->pcfg_command) {
+       case NAL_CMD_REGISTER_MYNID:
+               CDEBUG (D_IOCTL, "setting NID to "LPX64" (was "LPX64")\n",
+                       pcfg->pcfg_nid, klonal_lib.libnal_ni.ni_pid.nid);
+               klonal_lib.libnal_ni.ni_pid.nid = pcfg->pcfg_nid;
+               return (0);
+               
+       default:
+               return (-EINVAL);
+       }
+}
+
+static void
+klonal_shutdown(nal_t *nal)
+{
+       unsigned long flags;
+
+       /* NB The first ref was this module! */
+       if (nal->nal_refct != 0)
+               return;
+
+       CDEBUG (D_NET, "shutdown\n");
+       LASSERT (nal == &klonal_api);
+
+       switch (klonal_data.klo_init)
+       {
+       default:
+               LASSERT (0);
+
+       case KLO_INIT_ALL:
+                libcfs_nal_cmd_unregister(LONAL);
+               /* fall through */
+
+       case KLO_INIT_LIB:
+               lib_fini (&klonal_lib);
+               break;
+
+       case KLO_INIT_NOTHING:
+               return;
+       }
+
+       memset(&klonal_data, 0, sizeof (klonal_data));
+
+       CDEBUG (D_MALLOC, "done kmem %d\n", atomic_read(&portal_kmemory));
+
+       printk (KERN_INFO "Lustre: LO NAL unloaded (final mem %d)\n",
+                atomic_read(&portal_kmemory));
+       PORTAL_MODULE_UNUSE;
+}
+
+static int
+klonal_startup (nal_t *nal, ptl_pid_t requested_pid,
+               ptl_ni_limits_t *requested_limits, 
+               ptl_ni_limits_t *actual_limits)
+{
+       int               rc;
+       int               i;
+       ptl_process_id_t  my_process_id;
+       int               pkmem = atomic_read(&portal_kmemory);
+
+       LASSERT (nal == &klonal_api);
+
+       if (nal->nal_refct != 0) {
+               if (actual_limits != NULL)
+                       *actual_limits = klonal_lib.libnal_ni.ni_actual_limits;
+               return (PTL_OK);
+       }
+
+       LASSERT (klonal_data.klo_init == KLO_INIT_NOTHING);
+
+       CDEBUG (D_MALLOC, "start kmem %d\n", atomic_read(&portal_kmemory));
+
+       /* ensure all pointers NULL etc */
+       memset (&klonal_data, 0, sizeof (klonal_data));
+
+       my_process_id.nid = 0;
+       my_process_id.pid = requested_pid;
+
+       rc = lib_init(&klonal_lib, nal, my_process_id,
+                     requested_limits, actual_limits);
+        if (rc != PTL_OK) {
+               CERROR ("lib_init failed %d\n", rc);
+               klonal_shutdown (nal);
+               return (rc);
+       }
+
+       klonal_data.klo_init = KLO_INIT_LIB;
+
+       rc = libcfs_nal_cmd_register (LONAL, &klonal_cmd, NULL);
+       if (rc != 0) {
+               CERROR ("Can't initialise command interface (rc = %d)\n", rc);
+               klonal_shutdown (nal);
+               return (PTL_FAIL);
+       }
+
+       klonal_data.klo_init = KLO_INIT_ALL;
+
+       printk(KERN_INFO "Lustre: LO NAL (initial mem %d)\n", pkmem);
+       PORTAL_MODULE_USE;
+
+       return (PTL_OK);
+}
+
+void __exit
+klonal_finalise (void)
+{
+       PtlNIFini(klonal_ni);
+
+       ptl_unregister_nal(LONAL);
+}
+
+static int __init
+klonal_initialise (void)
+{
+       int   rc;
+
+       klonal_api.nal_ni_init = klonal_startup;
+       klonal_api.nal_ni_fini = klonal_shutdown;
+
+       rc = ptl_register_nal(LONAL, &klonal_api);
+       if (rc != PTL_OK) {
+               CERROR("Can't register LONAL: %d\n", rc);
+               return (-ENOMEM);               /* or something... */
+       }
+
+       return (0);
+}
+
+MODULE_AUTHOR("Cluster File Systems, Inc. <info@clusterfs.com>");
+MODULE_DESCRIPTION("Loopback NAL v0.01");
+MODULE_LICENSE("GPL");
+
+module_init (klonal_initialise);
+module_exit (klonal_finalise);
diff --git a/lustre/portals/knals/lonal/lonal.h b/lustre/portals/knals/lonal/lonal.h
new file mode 100644 (file)
index 0000000..f1675a7
--- /dev/null
@@ -0,0 +1,77 @@
+/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
+ * vim:expandtab:shiftwidth=8:tabstop=8:
+ *
+ *  Copyright (C) 2001 Cluster File Systems, Inc. <braam@clusterfs.com>
+ *
+ *   This file is part of Lustre, http://www.lustre.org.
+ *
+ *   Lustre is free software; you can redistribute it and/or
+ *   modify it under the terms of version 2 of the GNU General Public
+ *   License as published by the Free Software Foundation.
+ *
+ *   Lustre is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with Lustre; if not, write to the Free Software
+ *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ * Basic library routines. 
+ *
+ */
+
+#ifndef _LONAL_H
+#define _LONAL_H
+#ifndef EXPORT_SYMTAB
+# define EXPORT_SYMTAB
+#endif
+
+#include <linux/config.h>
+#include <linux/module.h>
+#include <linux/kernel.h>
+#include <linux/mm.h>
+#include <linux/string.h>
+#include <linux/stat.h>
+#include <linux/errno.h>
+#include <linux/uio.h>
+
+#define DEBUG_SUBSYSTEM S_LONAL
+
+#include <linux/kp30.h>
+#include <portals/p30.h>
+#include <portals/lib-p30.h>
+#include <portals/nal.h>
+
+#define KLOD_IOV        153401
+#define KLOD_KIOV       153402
+
+typedef struct
+{
+        unsigned int     klod_type;
+        unsigned int     klod_niov;
+        size_t           klod_offset;
+        size_t           klod_nob;
+        union {
+                struct iovec  *iov;
+                ptl_kiov_t    *kiov;
+        }                klod_iov;
+                
+} klo_desc_t;
+
+typedef struct
+{
+        char               klo_init;            /* what's been initialised */
+}  klonal_data_t;
+
+/* kqn_init state */
+#define KLO_INIT_NOTHING        0               /* MUST BE ZERO so zeroed state is initialised OK */
+#define KLO_INIT_LIB            1
+#define KLO_INIT_ALL            2
+
+extern lib_nal_t           klonal_lib;
+extern nal_t               klonal_api;
+extern klonal_data_t       klonal_data;
+
+#endif /* _LONAL_H */
diff --git a/lustre/portals/knals/lonal/lonal_cb.c b/lustre/portals/knals/lonal/lonal_cb.c
new file mode 100644 (file)
index 0000000..dccc81a
--- /dev/null
@@ -0,0 +1,272 @@
+/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
+ * vim:expandtab:shiftwidth=8:tabstop=8:
+ *
+ * Copyright (C) 2002 Cluster File Systems, Inc.
+ *   Author: Eric Barton <eric@bartonsoftware.com>
+ *
+ * Copyright (C) 2002, Lawrence Livermore National Labs (LLNL)
+ * W. Marcus Miller - Based on ksocknal
+ *
+ * This file is part of Portals, http://www.sf.net/projects/sandiaportals/
+ *
+ * Portals is free software; you can redistribute it and/or
+ * modify it under the terms of version 2 of the GNU General Public
+ * License as published by the Free Software Foundation.
+ *
+ * Portals is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Portals; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+#include "lonal.h"
+
+/*
+ *  LIB functions follow
+ *
+ */
+static int
+klonal_dist(lib_nal_t *nal, ptl_nid_t nid, unsigned long *dist)
+{
+        *dist = 0;                      /* it's me */
+        return (0);
+}
+
+static ptl_err_t
+klonal_send (lib_nal_t    *nal,
+             void         *private,
+             lib_msg_t    *libmsg,
+             ptl_hdr_t    *hdr,
+             int           type,
+             ptl_nid_t     nid,
+             ptl_pid_t     pid,
+             unsigned int  payload_niov,
+             struct iovec *payload_iov,
+             size_t        payload_offset,
+             size_t        payload_nob)
+{
+        klo_desc_t klod = {
+                .klod_type    = KLOD_IOV,
+                .klod_niov    = payload_niov,
+                .klod_offset  = payload_offset,
+                .klod_nob     = payload_nob,
+                .klod_iov.iov = payload_iov};
+        ptl_err_t rc;
+
+        LASSERT(nid == klonal_lib.libnal_ni.ni_pid.nid);
+
+        rc = lib_parse(&klonal_lib, hdr, &klod);
+        if (rc == PTL_OK)
+                lib_finalize(&klonal_lib, private, libmsg, PTL_OK);
+        
+        return rc;
+}
+
+static ptl_err_t
+klonal_send_pages (lib_nal_t    *nal,
+                   void         *private,
+                   lib_msg_t    *libmsg,
+                   ptl_hdr_t    *hdr,
+                   int           type,
+                   ptl_nid_t     nid,
+                   ptl_pid_t     pid,
+                   unsigned int  payload_niov,
+                   ptl_kiov_t   *payload_kiov,
+                   size_t        payload_offset,
+                   size_t        payload_nob)
+{
+        klo_desc_t klod = {
+                .klod_type     = KLOD_KIOV,
+                .klod_niov     = payload_niov,
+                .klod_offset   = payload_offset,
+                .klod_nob      = payload_nob,
+                .klod_iov.kiov = payload_kiov};
+        ptl_err_t   rc;
+
+        LASSERT(nid == klonal_lib.libnal_ni.ni_pid.nid);
+        
+        rc = lib_parse(&klonal_lib, hdr, &klod);
+        if (rc == PTL_OK)
+                lib_finalize(&klonal_lib, private, libmsg, PTL_OK);
+        
+        return rc;
+}
+
+static ptl_err_t
+klonal_recv(lib_nal_t    *nal,
+            void         *private,
+            lib_msg_t    *libmsg,
+            unsigned int  niov,
+            struct iovec *iov,
+            size_t        offset,
+            size_t        mlen,
+            size_t        rlen)
+{
+        klo_desc_t *klod = (klo_desc_t *)private;
+
+        /* I only handle mapped->mapped matches */
+        LASSERT(klod->klod_type == KLOD_IOV);
+
+        if (mlen == 0)
+                return PTL_OK;
+
+        while (offset >= iov->iov_len) {
+                offset -= iov->iov_len;
+                iov++;
+                niov--;
+                LASSERT(niov > 0);
+        }
+        
+        while (klod->klod_offset >= klod->klod_iov.iov->iov_len) {
+                klod->klod_offset -= klod->klod_iov.iov->iov_len;
+                klod->klod_iov.iov++;
+                klod->klod_niov--;
+                LASSERT(klod->klod_niov > 0);
+        }
+        
+        do {
+                int fraglen = MIN(iov->iov_len - offset,
+                                  klod->klod_iov.iov->iov_len - klod->klod_offset);
+
+                LASSERT(niov > 0);
+                LASSERT(klod->klod_niov > 0);
+
+                if (fraglen > mlen)
+                        fraglen = mlen;
+                
+                memcpy((void *)((unsigned long)iov->iov_base + offset),
+                       (void *)((unsigned long)klod->klod_iov.iov->iov_base +
+                                klod->klod_offset),
+                       fraglen);
+
+                if (offset + fraglen < iov->iov_len) {
+                        offset += fraglen;
+                } else {
+                        offset = 0;
+                        iov++;
+                        niov--;
+                }
+
+                if (klod->klod_offset + fraglen < klod->klod_iov.iov->iov_len ) {
+                        klod->klod_offset += fraglen;
+                } else {
+                        klod->klod_offset = 0;
+                        klod->klod_iov.iov++;
+                        klod->klod_niov--;
+                }
+
+                mlen -= fraglen;
+        } while (mlen > 0);
+        
+        lib_finalize(&klonal_lib, private, libmsg, PTL_OK);
+        return PTL_OK;
+}
+
+static ptl_err_t
+klonal_recv_pages(lib_nal_t    *nal,
+                  void         *private,
+                  lib_msg_t    *libmsg,
+                  unsigned int  niov,
+                  ptl_kiov_t   *kiov,
+                  size_t        offset,
+                  size_t        mlen,
+                  size_t        rlen)
+{
+        void          *srcaddr = NULL;
+        void          *dstaddr = NULL;
+        unsigned long  srcfrag = 0;
+        unsigned long  dstfrag = 0;
+        unsigned long  fraglen;
+        klo_desc_t    *klod = (klo_desc_t *)private;
+
+        /* I only handle unmapped->unmapped matches */
+        LASSERT(klod->klod_type == KLOD_KIOV);
+
+        if (mlen == 0)
+                return PTL_OK;
+
+        while (offset >= kiov->kiov_len) {
+                offset -= kiov->kiov_len;
+                kiov++;
+                niov--;
+                LASSERT(niov > 0);
+        }
+
+        while (klod->klod_offset >= klod->klod_iov.kiov->kiov_len) {
+                klod->klod_offset -= klod->klod_iov.kiov->kiov_len;
+                klod->klod_iov.kiov++;
+                klod->klod_niov--;
+                LASSERT(klod->klod_niov > 0);
+        }
+
+        do {
+        /* CAVEAT EMPTOR: I kmap 2 pages at once == slight risk of deadlock */
+                LASSERT(niov > 0);
+                if (dstaddr == NULL) {
+                        dstaddr = (void *)((unsigned long)kmap(kiov->kiov_page) +
+                                           kiov->kiov_offset + offset);
+                        dstfrag = kiov->kiov_len -  offset;
+                }
+
+                LASSERT(klod->klod_niov > 0);
+                if (srcaddr == NULL) {
+                        srcaddr = (void *)((unsigned long)kmap(klod->klod_iov.kiov->kiov_page) +
+                                           klod->klod_iov.kiov->kiov_offset + klod->klod_offset);
+                        srcfrag = klod->klod_iov.kiov->kiov_len - klod->klod_offset;
+                }
+                
+                fraglen = MIN(srcfrag, dstfrag);
+                if (fraglen > mlen)
+                        fraglen = mlen;
+                
+                memcpy(dstaddr, srcaddr, fraglen);
+                
+                if (fraglen < dstfrag) {
+                        dstfrag -= fraglen;
+                        dstaddr = (void *)((unsigned long)dstaddr + fraglen);
+                } else {
+                        kunmap(kiov->kiov_page);
+                        dstaddr = NULL;
+                        offset = 0;
+                        kiov++;
+                        niov--;
+                }
+
+                if (fraglen < srcfrag) {
+                        srcfrag -= fraglen;
+                        srcaddr = (void *)((unsigned long)srcaddr + fraglen);
+                } else {
+                        kunmap(klod->klod_iov.kiov->kiov_page);
+                        srcaddr = NULL;
+                        klod->klod_offset = 0;
+                        klod->klod_iov.kiov++;
+                        klod->klod_niov--;
+                }
+
+                mlen -= fraglen;
+        } while (mlen > 0);
+
+        if (dstaddr != NULL)
+                kunmap(kiov->kiov_page);
+
+        if (srcaddr != NULL)
+                kunmap(klod->klod_iov.kiov->kiov_page);
+
+        lib_finalize(&klonal_lib, private, libmsg, PTL_OK);
+        return PTL_OK;
+}
+
+lib_nal_t klonal_lib =
+{
+        libnal_data:       &klonal_data,         /* NAL private data */
+        libnal_send:        klonal_send,
+        libnal_send_pages:  klonal_send_pages,
+        libnal_recv:        klonal_recv,
+        libnal_recv_pages:  klonal_recv_pages,
+        libnal_dist:        klonal_dist
+};
index d5d29dc..07fada2 100644 (file)
@@ -71,6 +71,7 @@ static name2num_t nalnames[] = {
         {"gm",         GMNAL},
         {"openib",      OPENIBNAL},
         {"iib",         IIBNAL},
+        {"lo",          LONAL},
         {NULL,         -1}
 };
 
index b357c77..dd3489d 100644 (file)
@@ -623,6 +623,7 @@ int ptlrpc_init_portals(void)
                 {OPENIBNAL, "openibnal"},
                 {IIBNAL,    "iibnal"},
                 {TCPNAL,    "tcpnal"},
+                {LONAL,     "lonal"},
 #else
                 {CRAY_KB_ERNAL, "cray_kb_ernal"},
 #endif
index b1cef54..f4e832d 100755 (executable)
@@ -114,6 +114,7 @@ subsystem_names = {
     "ptlrouter" :    (1 << 20),
     "cobd" :         (1 << 21),
     "ibnal" :        (1 << 22),
+    "lonal" :        (1 << 23),
     }
 
 
@@ -990,6 +991,8 @@ def sys_get_local_address(net_type, wildcard, cluster_id):
                 local = elan_id
         except IOError, e:
             log(e)
+    elif net_type == 'lo':
+        fixme("automatic local address for loopback")
     elif net_type == 'gm':
         fixme("automatic local address for GM")
 
@@ -1206,6 +1209,8 @@ class Network(Module):
             self.add_portals_module("knals/openibnal", 'kopenibnal')
         if self.net_type == 'iib':
             self.add_portals_module("knals/iibnal", 'kiibnal')
+        if self.net_type == 'lo':
+            self.add_portals_module("knals/lonal", 'klonal')
 
     def nid_to_uuid(self, nid):
         return "NID_%s_UUID" %(nid,)
index 0d34ace..23eeab3 100755 (executable)
@@ -648,7 +648,7 @@ def add_net(gen, lustre, options):
 
     if net_type in ('tcp',):
         port = get_option_int(options, 'port')
-    elif net_type in ('elan', 'gm', 'openib','iib'):
+    elif net_type in ('elan', 'gm', 'openib','iib','lo'):
         port = 0
     else:
         print "Unknown net_type: ", net_type