From 6ffa505ad054aab0e01cb7f2feb72aa5e950b605 Mon Sep 17 00:00:00 2001 From: eeb Date: Thu, 7 Jul 2005 17:51:53 +0000 Subject: [PATCH] * first signs of life from newconfig tcpnal + liblustre echo_client --- lnet/libcfs/nidstrings.c | 4 ++-- lnet/lnet/api-ni.c | 6 ++++-- lnet/ulnds/procapi.c | 4 +++- lnet/ulnds/socklnd/procapi.c | 4 +++- lnet/ulnds/socklnd/tcplnd.c | 19 ++++++++++++++----- lnet/ulnds/tcplnd.c | 19 ++++++++++++++----- lnet/utils/Makefile.am | 2 +- 7 files changed, 41 insertions(+), 17 deletions(-) diff --git a/lnet/libcfs/nidstrings.c b/lnet/libcfs/nidstrings.c index f3005d4..8a0edf6 100644 --- a/lnet/libcfs/nidstrings.c +++ b/lnet/libcfs/nidstrings.c @@ -61,8 +61,8 @@ void libcfs_init_nidstrings (void) # define NIDSTR_LOCK(f) spin_lock_irqsave(&libcfs_nidstring_lock, f) # define NIDSTR_UNLOCK(f) spin_unlock_irqrestore(&libcfs_nidstring_lock, f) #else -# define NIDSTR_LOCK(f) (f) /* avoid unused var warnings */ -# define NIDSTR_UNLOCK(f) (f) +# define NIDSTR_LOCK(f) (f=0) /* avoid unused var warnings */ +# define NIDSTR_UNLOCK(f) (f=0) #endif static char * diff --git a/lnet/lnet/api-ni.c b/lnet/lnet/api-ni.c index 2314c9e..5fc44e5 100644 --- a/lnet/lnet/api-ni.c +++ b/lnet/lnet/api-ni.c @@ -644,8 +644,10 @@ ptl_shutdown_nalnis (void) } /* Drop the cached loopback NI. */ - ptl_ni_decref_locked(ptl_loni); - ptl_loni = NULL; + if (ptl_loni != NULL) { + ptl_ni_decref_locked(ptl_loni); + ptl_loni = NULL; + } /* Now wait for the NI's I just nuked to show up on apini_zombie_nis * and shut them down in guaranteed thread context */ diff --git a/lnet/ulnds/procapi.c b/lnet/ulnds/procapi.c index a13b6b7..543b564 100644 --- a/lnet/ulnds/procapi.c +++ b/lnet/ulnds/procapi.c @@ -121,6 +121,7 @@ procbridge_startup (ptl_ni_t *ni) { procbridge p; bridge b; + int rc; /* NB The local NID is not assigned. We only ever connect to the socknal, * which assigns the src nid/pid on incoming non-privileged connections @@ -160,7 +161,8 @@ procbridge_startup (ptl_ni_t *ni) #endif /* create nal thread */ - if (pthread_create(&p->t, NULL, nal_thread, b)) { + rc = pthread_create(&p->t, NULL, nal_thread, b); + if (rc != 0) { perror("nal_init: pthread_create"); return PTL_FAIL; } diff --git a/lnet/ulnds/socklnd/procapi.c b/lnet/ulnds/socklnd/procapi.c index a13b6b7..543b564 100644 --- a/lnet/ulnds/socklnd/procapi.c +++ b/lnet/ulnds/socklnd/procapi.c @@ -121,6 +121,7 @@ procbridge_startup (ptl_ni_t *ni) { procbridge p; bridge b; + int rc; /* NB The local NID is not assigned. We only ever connect to the socknal, * which assigns the src nid/pid on incoming non-privileged connections @@ -160,7 +161,8 @@ procbridge_startup (ptl_ni_t *ni) #endif /* create nal thread */ - if (pthread_create(&p->t, NULL, nal_thread, b)) { + rc = pthread_create(&p->t, NULL, nal_thread, b); + if (rc != 0) { perror("nal_init: pthread_create"); return PTL_FAIL; } diff --git a/lnet/ulnds/socklnd/tcplnd.c b/lnet/ulnds/socklnd/tcplnd.c index 3bbc1ec..db15bd0 100644 --- a/lnet/ulnds/socklnd/tcplnd.c +++ b/lnet/ulnds/socklnd/tcplnd.c @@ -213,13 +213,22 @@ finalize: static int from_connection(void *a, void *d) { connection c = d; - bridge b = a; - ptl_hdr_t hdr; + bridge b = a; + ptl_hdr_t hdr; + ptl_err_t rc; if (read_connection(c, (unsigned char *)&hdr, sizeof(hdr))){ - ptl_parse(b->b_ni, &hdr, c); - /*TODO: check error status*/ - return(1); + /* replace dest_nid,pid (socknal sets its own) */ + hdr.dest_nid = cpu_to_le64(b->b_ni->ni_nid); + hdr.dest_pid = cpu_to_le32(ptl_getpid()); + + rc = ptl_parse(b->b_ni, &hdr, c); + if (rc != PTL_OK) { + CERROR("Error %d from ptl_parse\n", rc); + return 0; + } + + return(1); } return(0); } diff --git a/lnet/ulnds/tcplnd.c b/lnet/ulnds/tcplnd.c index 3bbc1ec..db15bd0 100644 --- a/lnet/ulnds/tcplnd.c +++ b/lnet/ulnds/tcplnd.c @@ -213,13 +213,22 @@ finalize: static int from_connection(void *a, void *d) { connection c = d; - bridge b = a; - ptl_hdr_t hdr; + bridge b = a; + ptl_hdr_t hdr; + ptl_err_t rc; if (read_connection(c, (unsigned char *)&hdr, sizeof(hdr))){ - ptl_parse(b->b_ni, &hdr, c); - /*TODO: check error status*/ - return(1); + /* replace dest_nid,pid (socknal sets its own) */ + hdr.dest_nid = cpu_to_le64(b->b_ni->ni_nid); + hdr.dest_pid = cpu_to_le32(ptl_getpid()); + + rc = ptl_parse(b->b_ni, &hdr, c); + if (rc != PTL_OK) { + CERROR("Error %d from ptl_parse\n", rc); + return 0; + } + + return(1); } return(0); } diff --git a/lnet/utils/Makefile.am b/lnet/utils/Makefile.am index 39c10ec..2f3c868 100644 --- a/lnet/utils/Makefile.am +++ b/lnet/utils/Makefile.am @@ -11,7 +11,7 @@ if LIBLUSTRE noinst_LIBRARIES = libuptlctl.a endif -libuptlctl_a_SOURCES = portals.c debug.c l_ioctl.c +libuptlctl_a_SOURCES = portals.c nidstrings.c debug.c l_ioctl.c libuptlctl_a_CPPFLAGS = $(LLCPPFLAGS) libuptlctl_a_CFLAGS = $(LLCFLAGS) -- 1.8.3.1