* GPL HEADER END
*/
/*
- * Copyright 2008 Sun Microsystems, Inc. All rights reserved
+ * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
* Use is subject to license terms.
*/
/*
lnet_md_exhausted(md));
}
+static inline unsigned int
+lnet_match_to_hash(lnet_process_id_t id, __u64 mbits)
+{
+ mbits += id.nid + id.pid;
+ return cfs_hash_long((unsigned long)mbits, LNET_PORTAL_HASH_BITS);
+}
+
#ifdef __KERNEL__
-#define LNET_LOCK() spin_lock(&the_lnet.ln_lock)
-#define LNET_UNLOCK() spin_unlock(&the_lnet.ln_lock)
-#define LNET_MUTEX_DOWN(m) mutex_down(m)
-#define LNET_MUTEX_UP(m) mutex_up(m)
+#define LNET_LOCK() cfs_spin_lock(&the_lnet.ln_lock)
+#define LNET_UNLOCK() cfs_spin_unlock(&the_lnet.ln_lock)
+#define LNET_MUTEX_DOWN(m) cfs_mutex_down(m)
+#define LNET_MUTEX_UP(m) cfs_mutex_up(m)
#else
# ifndef HAVE_LIBPTHREAD
#define LNET_SINGLE_THREADED_LOCK(l) \
/* ALWAYS called with liblock held */
lnet_freeobj_t *o;
- if (list_empty (&fl->fl_list))
+ if (cfs_list_empty (&fl->fl_list))
return (NULL);
- o = list_entry (fl->fl_list.next, lnet_freeobj_t, fo_list);
- list_del (&o->fo_list);
+ o = cfs_list_entry (fl->fl_list.next, lnet_freeobj_t, fo_list);
+ cfs_list_del (&o->fo_list);
return ((void *)&o->fo_contents);
}
lnet_freelist_free (lnet_freelist_t *fl, void *obj)
{
/* ALWAYS called with liblock held */
- lnet_freeobj_t *o = list_entry (obj, lnet_freeobj_t, fo_contents);
+ lnet_freeobj_t *o = cfs_list_entry (obj, lnet_freeobj_t, fo_contents);
- list_add (&o->fo_list, &fl->fl_list);
+ cfs_list_add (&o->fo_list, &fl->fl_list);
}
LIBCFS_ALLOC(msg, sizeof(*msg));
- if (msg != NULL) {
- /* NULL pointers, clear flags etc */
- memset (msg, 0, sizeof (*msg));
+ /* no need to zero, LIBCFS_ALLOC does for us */
+
#ifdef CRAY_XT3
+ if (msg != NULL) {
msg->msg_ev.uid = LNET_UID_ANY;
-#endif
}
+#endif
return (msg);
}
return (lh_entry (lh, lnet_me_t, me_lh));
}
+static inline int
+lnet_portal_is_lazy(lnet_portal_t *ptl)
+{
+ return !!(ptl->ptl_options & LNET_PTL_LAZY);
+}
+
+static inline int
+lnet_portal_is_unique(lnet_portal_t *ptl)
+{
+ return !!(ptl->ptl_options & LNET_PTL_MATCH_UNIQUE);
+}
+
+static inline int
+lnet_portal_is_wildcard(lnet_portal_t *ptl)
+{
+ return !!(ptl->ptl_options & LNET_PTL_MATCH_WILDCARD);
+}
+
+static inline void
+lnet_portal_setopt(lnet_portal_t *ptl, int opt)
+{
+ ptl->ptl_options |= opt;
+}
+
+static inline void
+lnet_portal_unsetopt(lnet_portal_t *ptl, int opt)
+{
+ ptl->ptl_options &= ~opt;
+}
+
+static inline int
+lnet_match_is_unique(lnet_process_id_t match_id,
+ __u64 match_bits, __u64 ignore_bits)
+{
+ return ignore_bits == 0 &&
+ match_id.nid != LNET_NID_ANY &&
+ match_id.pid != LNET_PID_ANY;
+}
+
+static inline cfs_list_t *
+lnet_portal_me_head(int index, lnet_process_id_t id, __u64 mbits)
+{
+ lnet_portal_t *ptl = &the_lnet.ln_portals[index];
+
+ if (lnet_portal_is_wildcard(ptl)) {
+ return &ptl->ptl_mlist;
+ } else if (lnet_portal_is_unique(ptl)) {
+ LASSERT (ptl->ptl_mhash != NULL);
+ return &ptl->ptl_mhash[lnet_match_to_hash(id, mbits)];
+ }
+ return NULL;
+}
+
+cfs_list_t *lnet_portal_mhash_alloc(void);
+void lnet_portal_mhash_free(cfs_list_t *mhash);
+
static inline void
lnet_peer_addref_locked(lnet_peer_t *lp)
{
LASSERT (ni->ni_refcount > 0);
ni->ni_refcount--;
if (ni->ni_refcount == 0)
- list_add_tail(&ni->ni_list, &the_lnet.ln_zombie_nis);
+ cfs_list_add_tail(&ni->ni_list, &the_lnet.ln_zombie_nis);
}
static inline void
LNET_UNLOCK();
}
-static inline struct list_head *
+static inline cfs_list_t *
lnet_nid2peerhash (lnet_nid_t nid)
{
unsigned int idx = LNET_NIDADDR(nid) % LNET_PEER_HASHSIZE;
int lnet_peers_start_down(void);
int lnet_peer_buffer_credits(lnet_ni_t *ni);
-extern int router_ping_timeout;
-extern int dead_router_check_interval;
-extern int live_router_check_interval;
int lnet_router_checker_start(void);
void lnet_router_checker_stop(void);
void lnet_swap_pinginfo(lnet_ping_info_t *info);
int lnet_parse_ip2nets (char **networksp, char *ip2nets);
int lnet_parse_routes (char *route_str, int *im_a_router);
-int lnet_parse_networks (struct list_head *nilist, char *networks);
+int lnet_parse_networks (cfs_list_t *nilist, char *networks);
int lnet_nid2peer_locked(lnet_peer_t **lpp, lnet_nid_t nid);
lnet_peer_t *lnet_find_peer_locked (lnet_nid_t nid);