From e196fa3351b40038af3fb96f9b8c8d624b8a1f64 Mon Sep 17 00:00:00 2001 From: eeb Date: Thu, 8 Sep 2005 15:18:55 +0000 Subject: [PATCH] * Removed unused parameters from LNet??? APIs (e.g. interface handle) * Removed unused LNet??? APIs. * Removed many scalar typedefs inherited from portals. * fixed up alignment in some decls that s/ptl/lnet/ had unaligned. * updated sanity.sh to s/portals.debug/lnet.debug/ * verified lnet can zeroconf mount a pre-lnet filesystem after lctl --write_config --- lnet/include/lnet/api.h | 144 ++++++++++++-------------------------- lnet/include/lnet/lib-lnet.h | 31 ++++----- lnet/include/lnet/lib-types.h | 63 +++++++++-------- lnet/include/lnet/types.h | 61 ++++------------ lnet/klnds/iiblnd/iiblnd.c | 1 - lnet/klnds/qswlnd/qswlnd.c | 2 +- lnet/lnet/api-ni.c | 157 +++++++----------------------------------- lnet/lnet/lib-eq.c | 4 +- lnet/lnet/lib-md.c | 5 +- lnet/lnet/lib-me.c | 15 ++-- lnet/lnet/lib-move.c | 110 ++++++++++++++--------------- lnet/lnet/lib-msg.c | 6 +- lnet/lnet/module.c | 19 ++--- lnet/tests/ping.h | 10 ++- lnet/tests/ping_cli.c | 38 +++++----- lnet/tests/ping_srv.c | 18 +++-- lnet/tests/sping_cli.c | 42 +++++------ lnet/tests/sping_srv.c | 20 +++--- 18 files changed, 263 insertions(+), 483 deletions(-) diff --git a/lnet/include/lnet/api.h b/lnet/include/lnet/api.h index 1d8008c..8faae14 100644 --- a/lnet/include/lnet/api.h +++ b/lnet/include/lnet/api.h @@ -5,75 +5,36 @@ #include -int LNetInit(int *); - +int LNetInit(void); void LNetFini(void); -int LNetNIInit(lnet_interface_t interface, - lnet_pid_t requested_pid, - lnet_ni_limits_t *desired_limits, - lnet_ni_limits_t *actual_limits, - lnet_handle_ni_t *interface_out); - -int LNetNIInitialized(lnet_interface_t); - -int LNetNIFini(lnet_handle_ni_t interface_in); - -int LNetGetId(lnet_handle_ni_t ni_handle, - lnet_process_id_t *id); - -int LNetGetUid(lnet_handle_ni_t ni_handle, - lnet_uid_t *uid); - -/* - * Network interfaces - */ -int LNetNIStatus(lnet_handle_ni_t interface_in, - int register_in, - lnet_sr_value_t *status_out); - -int LNetNIDist(lnet_handle_ni_t interface_in, - lnet_process_id_t process_in, - unsigned long *distance_out); - -int LNetNIHandle(lnet_handle_any_t handle_in, - lnet_handle_ni_t *interface_out); - -/* - * LNetFailNid - * - * Not an official Portals 3 API call. It provides a way of calling - * network-specific functions - */ -int LNetNICtl(lnet_handle_ni_t interface, unsigned int cmd, void *arg); +int LNetNIInit(lnet_pid_t requested_pid); +int LNetNIFini(void); -/* - * LNetSnprintHandle: - * - * This is not an official Portals 3 API call. It is provided - * so that an application can print an opaque handle. - */ +int LNetGetId(unsigned int index, lnet_process_id_t *id); +int LNetDist(lnet_nid_t nid, int *order); +int LNetCtl(unsigned int cmd, void *arg); void LNetSnprintHandle (char *str, int str_len, lnet_handle_any_t handle); + /* * Match entries */ -int LNetMEAttach(lnet_handle_ni_t interface_in, - lnet_pt_index_t index_in, - lnet_process_id_t match_id_in, - lnet_match_bits_t match_bits_in, - lnet_match_bits_t ignore_bits_in, - lnet_unlink_t unlink_in, - lnet_ins_pos_t pos_in, - lnet_handle_me_t *handle_out); +int LNetMEAttach(unsigned int portal, + lnet_process_id_t match_id_in, + __u64 match_bits_in, + __u64 ignore_bits_in, + lnet_unlink_t unlink_in, + lnet_ins_pos_t pos_in, + lnet_handle_me_t *handle_out); int LNetMEInsert(lnet_handle_me_t current_in, - lnet_process_id_t match_id_in, - lnet_match_bits_t match_bits_in, - lnet_match_bits_t ignore_bits_in, - lnet_unlink_t unlink_in, - lnet_ins_pos_t position_in, - lnet_handle_me_t *handle_out); + lnet_process_id_t match_id_in, + __u64 match_bits_in, + __u64 ignore_bits_in, + lnet_unlink_t unlink_in, + lnet_ins_pos_t position_in, + lnet_handle_me_t *handle_out); int LNetMEUnlink(lnet_handle_me_t current_in); @@ -81,68 +42,53 @@ int LNetMEUnlink(lnet_handle_me_t current_in); * Memory descriptors */ int LNetMDAttach(lnet_handle_me_t current_in, - lnet_md_t md_in, - lnet_unlink_t unlink_in, - lnet_handle_md_t *handle_out); + lnet_md_t md_in, + lnet_unlink_t unlink_in, + lnet_handle_md_t *handle_out); -int LNetMDBind(lnet_handle_ni_t ni_in, - lnet_md_t md_in, - lnet_unlink_t unlink_in, - lnet_handle_md_t *handle_out); +int LNetMDBind(lnet_md_t md_in, + lnet_unlink_t unlink_in, + lnet_handle_md_t *handle_out); int LNetMDUnlink(lnet_handle_md_t md_in); /* * Event queues */ -int LNetEQAlloc(lnet_handle_ni_t ni_in, - lnet_size_t count_in, - lnet_eq_handler_t handler, - lnet_handle_eq_t *handle_out); +int LNetEQAlloc(unsigned int count_in, + lnet_eq_handler_t handler, + lnet_handle_eq_t *handle_out); int LNetEQFree(lnet_handle_eq_t eventq_in); int LNetEQGet(lnet_handle_eq_t eventq_in, - lnet_event_t *event_out); + lnet_event_t *event_out); int LNetEQWait(lnet_handle_eq_t eventq_in, - lnet_event_t *event_out); + lnet_event_t *event_out); int LNetEQPoll(lnet_handle_eq_t *eventqs_in, - int neq_in, - int timeout_ms, - lnet_event_t *event_out, - int *which_eq_out); - -/* - * Access Control Table - */ -int LNetACEntry(lnet_handle_ni_t ni_in, - lnet_ac_index_t index_in, - lnet_process_id_t match_id_in, - lnet_pt_index_t portal_in); - + int neq_in, + int timeout_ms, + lnet_event_t *event_out, + int *which_eq_out); /* * Data movement */ int LNetPut(lnet_handle_md_t md_in, - lnet_ack_req_t ack_req_in, - lnet_process_id_t target_in, - lnet_pt_index_t portal_in, - lnet_ac_index_t cookie_in, - lnet_match_bits_t match_bits_in, - lnet_size_t offset_in, - lnet_hdr_data_t hdr_data_in); + lnet_ack_req_t ack_req_in, + lnet_process_id_t target_in, + unsigned int portal_in, + __u64 match_bits_in, + unsigned int offset_in, + __u64 hdr_data_in); int LNetGet(lnet_handle_md_t md_in, - lnet_process_id_t target_in, - lnet_pt_index_t portal_in, - lnet_ac_index_t cookie_in, - lnet_match_bits_t match_bits_in, - lnet_size_t offset_in); - -int LNetDist(lnet_handle_ni_t interface, lnet_nid_t nid, int *order); + lnet_process_id_t target_in, + unsigned int portal_in, + __u64 match_bits_in, + unsigned int offset_in); #endif diff --git a/lnet/include/lnet/lib-lnet.h b/lnet/include/lnet/lib-lnet.h index 2fa3fae..a33bab9 100644 --- a/lnet/include/lnet/lib-lnet.h +++ b/lnet/include/lnet/lib-lnet.h @@ -55,6 +55,8 @@ static inline int ptl_md_exhausted (ptl_libmd_t *md) #define PTL_MUTEX_UP(m) pthread_mutex_unlock(m) #endif +#define MAX_PORTALS 64 + #ifdef PTL_USE_LIB_FREELIST #define MAX_MES 2048 @@ -436,46 +438,43 @@ ptl_ni_decref(ptl_ni_t *ni) extern ptl_nal_t ptl_lonal; extern ptl_ni_t *ptl_loni; -extern int ptl_get_apinih (lnet_handle_ni_t *nih); - extern ptl_ni_t *lnet_net2ni (__u32 net); extern int ptl_islocalnid (lnet_nid_t nid); extern int ptl_islocalnet (__u32 net, int *orderp); extern void ptl_enq_event_locked (void *private, ptl_eq_t *eq, lnet_event_t *ev); -extern void lnet_finalize (ptl_ni_t *ni, void *private, ptl_msg_t *msg, - lnet_ni_fail_t ni_fail_type); +extern void lnet_finalize (ptl_ni_t *ni, void *private, ptl_msg_t *msg, int rc); extern int lnet_parse (ptl_ni_t *ni, ptl_hdr_t *hdr, void *private); extern ptl_msg_t *lnet_create_reply_msg (ptl_ni_t *ni, lnet_nid_t peer_nid, ptl_msg_t *get_msg); extern void ptl_print_hdr (ptl_hdr_t * hdr); extern int ptl_fail_nid(lnet_nid_t nid, unsigned int threshold); -extern lnet_size_t lnet_iov_nob (int niov, struct iovec *iov); +extern unsigned int lnet_iov_nob (int niov, struct iovec *iov); extern void lnet_copy_iov2buf (char *dest, int niov, struct iovec *iov, - lnet_size_t offset, lnet_size_t len); -extern void lnet_copy_buf2iov (int niov, struct iovec *iov, lnet_size_t offset, - char *src, lnet_size_t len); + unsigned int offset, unsigned int len); +extern void lnet_copy_buf2iov (int niov, struct iovec *iov, unsigned int offset, + char *src, unsigned int len); extern int lnet_extract_iov (int dst_niov, struct iovec *dst, int src_niov, struct iovec *src, - lnet_size_t offset, lnet_size_t len); + unsigned int offset, unsigned int len); -extern lnet_size_t lnet_kiov_nob (int niov, lnet_kiov_t *iov); +extern unsigned int lnet_kiov_nob (int niov, lnet_kiov_t *iov); extern void lnet_copy_kiov2buf (char *dest, int niov, lnet_kiov_t *kiov, - lnet_size_t offset, lnet_size_t len); -extern void lnet_copy_buf2kiov (int niov, lnet_kiov_t *kiov, lnet_size_t offset, - char *src, lnet_size_t len); + unsigned int offset, unsigned int len); +extern void lnet_copy_buf2kiov (int niov, lnet_kiov_t *kiov, unsigned int offset, + char *src, unsigned int len); extern int lnet_extract_kiov (int dst_niov, lnet_kiov_t *dst, int src_niov, lnet_kiov_t *src, - lnet_size_t offset, lnet_size_t len); + unsigned int offset, unsigned int len); extern lnet_pid_t lnet_getpid(void); extern int ptl_recv (ptl_ni_t *ni, void *private, ptl_msg_t *msg, ptl_libmd_t *md, - lnet_size_t offset, lnet_size_t mlen, lnet_size_t rlen); + unsigned int offset, unsigned int mlen, unsigned int rlen); extern int ptl_send (ptl_ni_t *ni, void *private, ptl_msg_t *msg, ptl_hdr_t *hdr, int type, lnet_process_id_t target, - ptl_libmd_t *md, lnet_size_t offset, lnet_size_t len); + ptl_libmd_t *md, unsigned int offset, unsigned int len); extern void ptl_me_unlink(ptl_me_t *me); diff --git a/lnet/include/lnet/lib-types.h b/lnet/include/lnet/lib-types.h index 687ba03..8fc9ea9 100644 --- a/lnet/include/lnet/lib-types.h +++ b/lnet/include/lnet/lib-types.h @@ -52,25 +52,25 @@ typedef enum { * wire structs MUST be fixed size and the smaller types are placed at the * end. */ typedef struct ptl_ack { - ptl_handle_wire_t dst_wmd; - lnet_match_bits_t match_bits; - lnet_size_t mlength; + ptl_handle_wire_t dst_wmd; + __u64 match_bits; + __u32 mlength; } WIRE_ATTR ptl_ack_t; typedef struct ptl_put { - ptl_handle_wire_t ack_wmd; - lnet_match_bits_t match_bits; - lnet_hdr_data_t hdr_data; - lnet_pt_index_t ptl_index; - lnet_size_t offset; + ptl_handle_wire_t ack_wmd; + __u64 match_bits; + __u64 hdr_data; + __u32 ptl_index; + __u32 offset; } WIRE_ATTR ptl_put_t; typedef struct ptl_get { - ptl_handle_wire_t return_wmd; - lnet_match_bits_t match_bits; - lnet_pt_index_t ptl_index; - lnet_size_t src_offset; - lnet_size_t sink_length; + ptl_handle_wire_t return_wmd; + __u64 match_bits; + __u32 ptl_index; + __u32 src_offset; + __u32 sink_length; } WIRE_ATTR ptl_get_t; typedef struct ptl_reply { @@ -83,10 +83,10 @@ typedef struct ptl_hello { } WIRE_ATTR ptl_hello_t; typedef struct { - lnet_nid_t dest_nid; - lnet_nid_t src_nid; - lnet_pid_t dest_pid; - lnet_pid_t src_pid; + lnet_nid_t dest_nid; + lnet_nid_t src_nid; + lnet_pid_t dest_pid; + lnet_pid_t src_pid; __u32 type; /* ptl_msg_type_t */ __u32 payload_length; /* payload data to follow */ /*<------__u64 aligned------->*/ @@ -144,7 +144,7 @@ typedef struct ptl_msg { struct list_head msg_list; struct ptl_libmd *msg_md; ptl_handle_wire_t msg_ack_wmd; - lnet_event_t msg_ev; + lnet_event_t msg_ev; } ptl_msg_t; typedef struct ptl_libhandle { @@ -158,21 +158,21 @@ typedef struct ptl_libhandle { typedef struct ptl_eq { struct list_head eq_list; ptl_libhandle_t eq_lh; - lnet_seq_t eq_enq_seq; - lnet_seq_t eq_deq_seq; - lnet_size_t eq_size; - lnet_event_t *eq_events; + lnet_seq_t eq_enq_seq; + lnet_seq_t eq_deq_seq; + unsigned int eq_size; + lnet_event_t *eq_events; int eq_refcount; - lnet_eq_handler_t eq_callback; + lnet_eq_handler_t eq_callback; } ptl_eq_t; typedef struct ptl_me { struct list_head me_list; ptl_libhandle_t me_lh; - lnet_process_id_t me_match_id; - lnet_match_bits_t me_match_bits; - lnet_match_bits_t me_ignore_bits; - lnet_unlink_t me_unlink; + lnet_process_id_t me_match_id; + __u64 me_match_bits; + __u64 me_ignore_bits; + lnet_unlink_t me_unlink; struct ptl_libmd *me_md; } ptl_me_t; @@ -181,9 +181,9 @@ typedef struct ptl_libmd { ptl_libhandle_t md_lh; ptl_me_t *md_me; char *md_start; - lnet_size_t md_offset; - lnet_size_t md_length; - lnet_size_t md_max_size; + unsigned int md_offset; + unsigned int md_length; + unsigned int md_max_size; int md_threshold; int md_pending; unsigned int md_options; @@ -374,8 +374,7 @@ typedef struct int apini_nportals; /* # portals */ struct list_head *apini_portals; /* the vector of portals */ - lnet_pid_t apini_pid; /* requested pid */ - lnet_ni_limits_t apini_actual_limits; + lnet_pid_t apini_pid; /* requested pid */ struct list_head apini_nis; /* NAL instances */ struct list_head apini_zombie_nis; /* dying NAL instances */ diff --git a/lnet/include/lnet/types.h b/lnet/include/lnet/types.h index 7939db9..24c72da 100644 --- a/lnet/include/lnet/types.h +++ b/lnet/include/lnet/types.h @@ -5,21 +5,8 @@ #include -/* This implementation uses the same type for API function return codes and - * the completion status in an event */ -#define LNET_NI_OK 0 -typedef int lnet_ni_fail_t; - -typedef __u32 lnet_uid_t; -typedef __u32 lnet_jid_t; typedef __u64 lnet_nid_t; -typedef __u32 lnet_netid_t; typedef __u32 lnet_pid_t; -typedef __u32 lnet_pt_index_t; -typedef __u32 lnet_ac_index_t; -typedef __u64 lnet_match_bits_t; -typedef __u64 lnet_hdr_data_t; -typedef __u32 lnet_size_t; #define LNET_TIME_FOREVER (-1) @@ -27,7 +14,6 @@ typedef struct { __u64 cookie; } lnet_handle_any_t; -typedef lnet_handle_any_t lnet_handle_ni_t; typedef lnet_handle_any_t lnet_handle_eq_t; typedef lnet_handle_any_t lnet_handle_md_t; typedef lnet_handle_any_t lnet_handle_me_t; @@ -41,8 +27,6 @@ static inline int LNetHandleIsEqual (lnet_handle_any_t h1, lnet_handle_any_t h2) return (h1.cookie == h2.cookie); } -#define LNET_UID_ANY ((lnet_uid_t) -1) -#define LNET_JID_ANY ((lnet_jid_t) -1) #define LNET_NID_ANY ((lnet_nid_t) -1) #define LNET_PID_ANY ((lnet_pid_t) -1) @@ -63,23 +47,23 @@ typedef enum { typedef struct { void *start; - lnet_size_t length; + unsigned int length; int threshold; int max_size; unsigned int options; void *user_ptr; - lnet_handle_eq_t eq_handle; + lnet_handle_eq_t eq_handle; } lnet_md_t; /* Options for the MD structure */ #define LNET_MD_OP_PUT (1 << 0) #define LNET_MD_OP_GET (1 << 1) #define LNET_MD_MANAGE_REMOTE (1 << 2) -/* unused (1 << 3) */ +/* unused (1 << 3) */ #define LNET_MD_TRUNCATE (1 << 4) #define LNET_MD_ACK_DISABLE (1 << 5) -#define LNET_MD_IOVEC (1 << 6) -#define LNET_MD_MAX_SIZE (1 << 7) +#define LNET_MD_IOVEC (1 << 6) +#define LNET_MD_MAX_SIZE (1 << 7) #define LNET_MD_KIOV (1 << 8) /* For compatibility with Cray Portals */ @@ -119,20 +103,17 @@ typedef unsigned LNET_SEQ_BASETYPE lnet_seq_t; typedef struct { lnet_event_kind_t type; lnet_process_id_t initiator; - lnet_uid_t uid; - lnet_jid_t jid; - lnet_pt_index_t pt_index; - lnet_match_bits_t match_bits; - lnet_size_t rlength; - lnet_size_t mlength; - lnet_size_t offset; + unsigned int pt_index; + __u64 match_bits; + unsigned int rlength; + unsigned int mlength; + unsigned int offset; lnet_handle_md_t md_handle; lnet_md_t md; - lnet_hdr_data_t hdr_data; + __u64 hdr_data; lnet_seq_t link; - lnet_ni_fail_t ni_fail_type; - - int unlinked; + int status; + int unlinked; volatile lnet_seq_t sequence; } lnet_event_t; @@ -148,20 +129,4 @@ typedef enum { typedef void (*lnet_eq_handler_t)(lnet_event_t *event); #define LNET_EQ_HANDLER_NONE NULL -typedef struct { - int max_mes; - int max_mds; - int max_eqs; - int max_ac_index; - int max_pt_index; - int max_md_iovecs; - int max_me_list; - int max_getput_md; -} lnet_ni_limits_t; - -typedef int lnet_sr_value_t; - -typedef int lnet_interface_t; -#define LNET_IFACE_DEFAULT (-1) - #endif diff --git a/lnet/klnds/iiblnd/iiblnd.c b/lnet/klnds/iiblnd/iiblnd.c index 899f489..0b3e9dc 100644 --- a/lnet/klnds/iiblnd/iiblnd.c +++ b/lnet/klnds/iiblnd/iiblnd.c @@ -32,7 +32,6 @@ ptl_nal_t kibnal_nal = { .nal_recv = kibnal_recv, }; -lnet_handle_ni_t kibnal_ni; kib_tunables_t kibnal_tunables; kib_data_t kibnal_data = { diff --git a/lnet/klnds/qswlnd/qswlnd.c b/lnet/klnds/qswlnd/qswlnd.c index 85ea75e..de01fb4 100644 --- a/lnet/klnds/qswlnd/qswlnd.c +++ b/lnet/klnds/qswlnd/qswlnd.c @@ -687,7 +687,7 @@ kqswnal_initialise (void) } MODULE_AUTHOR("Cluster File Systems, Inc. "); -MODULE_DESCRIPTION("Kernel Quadrics/Elan NAL v1.01"); +MODULE_DESCRIPTION("Kernel Quadrics/Elan LND v1.01"); MODULE_LICENSE("GPL"); module_init (kqswnal_initialise); diff --git a/lnet/lnet/api-ni.c b/lnet/lnet/api-ni.c index 1982edf..53f90ea 100644 --- a/lnet/lnet/api-ni.c +++ b/lnet/lnet/api-ni.c @@ -152,7 +152,7 @@ lnet_register_nal (ptl_nal_t *nal) nal->nal_refcount = 0; if (nal->nal_type != LONAL) - LCONSOLE(0, "%s NAL registered\n", + LCONSOLE(0, "%s LND registered\n", libcfs_nal2str(nal->nal_type)); PTL_MUTEX_UP(&lnet_apini.apini_nal_mutex); @@ -169,22 +169,17 @@ lnet_unregister_nal (ptl_nal_t *nal) list_del (&nal->nal_list); if (nal->nal_type != LONAL) - LCONSOLE(0, "%s NAL unregistered\n", + LCONSOLE(0, "%s LND unregistered\n", libcfs_nal2str(nal->nal_type)); PTL_MUTEX_UP(&lnet_apini.apini_nal_mutex); } #ifndef PTL_USE_LIB_FREELIST + int -ptl_descriptor_setup (lnet_ni_limits_t *requested_limits, - lnet_ni_limits_t *actual_limits) +ptl_descriptor_setup (void) { - /* Ignore requested limits! */ - actual_limits->max_mes = INT_MAX; - actual_limits->max_mds = INT_MAX; - actual_limits->max_eqs = INT_MAX; - return 0; } @@ -243,8 +238,7 @@ ptl_freelist_fini (ptl_freelist_t *fl) } int -ptl_descriptor_setup (lnet_ni_limits_t *requested_limits, - lnet_ni_limits_t *actual_limits) +ptl_descriptor_setup (void) { /* NB on failure caller must still call ptl_descriptor_cleanup */ /* ****** */ @@ -255,13 +249,6 @@ ptl_descriptor_setup (lnet_ni_limits_t *requested_limits, memset (&lnet_apini.apini_free_mds, 0, sizeof (lnet_apini.apini_free_mds)); memset (&lnet_apini.apini_free_eqs, 0, sizeof (lnet_apini.apini_free_eqs)); - /* Ignore requested limits! */ - actual_limits->max_mes = MAX_MES; - actual_limits->max_mds = MAX_MDS; - actual_limits->max_eqs = MAX_EQS; - /* Hahahah what a load of bollocks. There's nowhere to - * specify the max # messages in-flight */ - rc = ptl_freelist_init (&lnet_apini.apini_free_mes, MAX_MES, sizeof (ptl_me_t)); if (rc != 0) @@ -395,12 +382,9 @@ ptl_invalidate_handle (ptl_libhandle_t *lh) } int -lnet_apini_init(lnet_pid_t requested_pid, - lnet_ni_limits_t *requested_limits, - lnet_ni_limits_t *actual_limits) +lnet_apini_init(lnet_pid_t requested_pid) { int rc = 0; - int ptl_size; int i; ENTRY; @@ -408,8 +392,7 @@ lnet_apini_init(lnet_pid_t requested_pid, lnet_apini.apini_pid = requested_pid; - rc = ptl_descriptor_setup (requested_limits, - &lnet_apini.apini_actual_limits); + rc = ptl_descriptor_setup (); if (rc != 0) goto out; @@ -429,36 +412,18 @@ lnet_apini_init(lnet_pid_t requested_pid, if (rc != 0) goto out; - if (requested_limits != NULL) - ptl_size = requested_limits->max_pt_index + 1; - else - ptl_size = 64; - - lnet_apini.apini_nportals = ptl_size; + lnet_apini.apini_nportals = MAX_PORTALS; PORTAL_ALLOC(lnet_apini.apini_portals, - ptl_size * sizeof(*lnet_apini.apini_portals)); + lnet_apini.apini_nportals * + sizeof(*lnet_apini.apini_portals)); if (lnet_apini.apini_portals == NULL) { rc = -ENOMEM; goto out; } - for (i = 0; i < ptl_size; i++) + for (i = 0; i < lnet_apini.apini_nportals; i++) CFS_INIT_LIST_HEAD(&(lnet_apini.apini_portals[i])); - /* max_{mes,mds,eqs} set in ptl_descriptor_setup */ - - /* We don't have an access control table! */ - lnet_apini.apini_actual_limits.max_ac_index = -1; - - lnet_apini.apini_actual_limits.max_pt_index = ptl_size - 1; - lnet_apini.apini_actual_limits.max_md_iovecs = PTL_MD_MAX_IOV; - lnet_apini.apini_actual_limits.max_me_list = INT_MAX; - - /* We don't support LNetGetPut! */ - lnet_apini.apini_actual_limits.max_getput_md = 0; - - if (actual_limits != NULL) - *actual_limits = lnet_apini.apini_actual_limits; out: if (rc != 0) { ptl_cleanup_handle_hash (); @@ -825,7 +790,7 @@ extern ptl_nal_t tcpnal_nal; #endif int -LNetInit(int *max_interfaces) +LNetInit(void) { ptl_assert_wire_constants (); @@ -848,9 +813,6 @@ LNetInit(int *max_interfaces) lnet_apini.apini_init = 1; - if (max_interfaces != NULL) - *max_interfaces = 1; - /* NALs in separate modules register themselves when their module * loads, and unregister themselves when their module is unloaded. * Otherwise they are plugged in explicitly here... */ @@ -881,9 +843,7 @@ LNetFini(void) } int -LNetNIInit(lnet_interface_t interface, lnet_pid_t requested_pid, - lnet_ni_limits_t *requested_limits, lnet_ni_limits_t *actual_limits, - lnet_handle_ni_t *handle) +LNetNIInit(lnet_pid_t requested_pid) { int rc; @@ -897,7 +857,7 @@ LNetNIInit(lnet_interface_t interface, lnet_pid_t requested_pid, goto out; } - rc = lnet_apini_init(requested_pid, requested_limits, actual_limits); + rc = lnet_apini_init(requested_pid); if (rc != 0) goto out; @@ -924,17 +884,13 @@ LNetNIInit(lnet_interface_t interface, lnet_pid_t requested_pid, lnet_apini.apini_refcount = 1; - memset (handle, 0, sizeof(*handle)); - LASSERT (!LNetHandleIsEqual(*handle, LNET_INVALID_HANDLE)); - /* Handle can be anything; LNET_INVALID_HANDLE isn't wise though :) */ - out: PTL_MUTEX_UP(&lnet_apini.apini_api_mutex); return rc; } int -LNetNIFini(lnet_handle_ni_t ni) +LNetNIFini() { PTL_MUTEX_DOWN(&lnet_apini.apini_api_mutex); @@ -954,35 +910,20 @@ LNetNIFini(lnet_handle_ni_t ni) } int -LNetNICtl(lnet_handle_ni_t nih, unsigned int cmd, void *arg) +LNetCtl(unsigned int cmd, void *arg) { struct portal_ioctl_data *data = arg; - struct list_head *tmp; + lnet_process_id_t id; ptl_ni_t *ni; int rc; - unsigned long flags; - int count; LASSERT (lnet_apini.apini_init); LASSERT (lnet_apini.apini_refcount > 0); switch (cmd) { case IOC_PORTAL_GET_NI: - count = data->ioc_count; - data->ioc_nid = LNET_NID_ANY; - rc = -ENOENT; - - PTL_LOCK(flags); - list_for_each (tmp, &lnet_apini.apini_nis) { - if (count-- != 0) - continue; - - ni = list_entry(tmp, ptl_ni_t, ni_list); - data->ioc_nid = ni->ni_nid; - rc = 0; - break; - } - PTL_UNLOCK(flags); + rc = LNetGetId(data->ioc_count, &id); + data->ioc_nid = id.nid; return rc; case IOC_PORTAL_FAIL_NID: @@ -1011,25 +952,23 @@ LNetNICtl(lnet_handle_ni_t nih, unsigned int cmd, void *arg) } int -LNetGetId(lnet_handle_ni_t ni_handle, lnet_process_id_t *id) +LNetGetId(unsigned int index, lnet_process_id_t *id) { ptl_ni_t *ni; unsigned long flags; struct list_head *tmp; - int rc = -EINVAL; + int rc = -ENOENT; LASSERT (lnet_apini.apini_init); LASSERT (lnet_apini.apini_refcount > 0); - /* pretty useless; just return the NID of the first local interface, - * that isn't LONAL (it has the same NID on all nodes) */ - PTL_LOCK(flags); list_for_each(tmp, &lnet_apini.apini_nis) { - ni = list_entry(tmp, ptl_ni_t, ni_list); - if (ni->ni_nal->nal_type == LONAL) + if (index-- != 0) continue; + + ni = list_entry(tmp, ptl_ni_t, ni_list); id->nid = ni->ni_nid; id->pid = lnet_apini.apini_pid; @@ -1042,58 +981,10 @@ LNetGetId(lnet_handle_ni_t ni_handle, lnet_process_id_t *id) return rc; } -int -LNetNIHandle(lnet_handle_any_t handle_in, lnet_handle_ni_t *ni_out) -{ - LASSERT (lnet_apini.apini_init); - LASSERT (lnet_apini.apini_refcount > 0); - - *ni_out = handle_in; - return 0; -} - void LNetSnprintHandle(char *str, int len, lnet_handle_any_t h) { snprintf(str, len, LPX64, h.cookie); } -int -LNetGetUid(lnet_handle_ni_t ni_handle, lnet_uid_t *uid) -{ - LASSERT (lnet_apini.apini_init); - LASSERT (lnet_apini.apini_refcount > 0); - - *uid = 0; /* fake it */ - return 0; -} - -int -LNetNIDist(lnet_handle_ni_t interface_in, lnet_process_id_t process_in, - unsigned long *distance_out) -{ - LASSERT (lnet_apini.apini_init); - LASSERT (lnet_apini.apini_refcount > 0); - - return 1; /* fake it */ -} - -int -LNetNIStatus(lnet_handle_ni_t interface_in, int register_in, - lnet_sr_value_t *status_out) -{ - LASSERT (lnet_apini.apini_init); - LASSERT (lnet_apini.apini_refcount > 0); - - return -EPERM; /* not supported */ -} -int -LNetACEntry(lnet_handle_ni_t ni_in, lnet_ac_index_t index_in, - lnet_process_id_t match_id_in, lnet_pt_index_t portal_in) -{ - LASSERT (lnet_apini.apini_init); - LASSERT (lnet_apini.apini_refcount > 0); - - return -EPERM; /* not supported */ -} diff --git a/lnet/lnet/lib-eq.c b/lnet/lnet/lib-eq.c index 6ce94dd..79c91d1 100644 --- a/lnet/lnet/lib-eq.c +++ b/lnet/lnet/lib-eq.c @@ -26,8 +26,8 @@ #include int -LNetEQAlloc(lnet_handle_ni_t interface, lnet_size_t count, - lnet_eq_handler_t callback, lnet_handle_eq_t *handle) +LNetEQAlloc(unsigned int count, lnet_eq_handler_t callback, + lnet_handle_eq_t *handle) { ptl_eq_t *eq; unsigned long flags; diff --git a/lnet/lnet/lib-md.c b/lnet/lnet/lib-md.c index 9dc81a9..d7c3740 100644 --- a/lnet/lnet/lib-md.c +++ b/lnet/lnet/lib-md.c @@ -240,8 +240,7 @@ LNetMDAttach(lnet_handle_me_t meh, lnet_md_t umd, } int -LNetMDBind(lnet_handle_ni_t nih, lnet_md_t umd, - lnet_unlink_t unlink, lnet_handle_md_t *handle) +LNetMDBind(lnet_md_t umd, lnet_unlink_t unlink, lnet_handle_md_t *handle) { ptl_libmd_t *md; unsigned long flags; @@ -302,7 +301,7 @@ LNetMDUnlink (lnet_handle_md_t mdh) memset(&ev, 0, sizeof(ev)); ev.type = LNET_EVENT_UNLINK; - ev.ni_fail_type = 0; + ev.status = 0; ev.unlinked = 1; ptl_md_deconstruct(md, &ev.md); ptl_md2handle(&ev.md_handle, md); diff --git a/lnet/lnet/lib-me.c b/lnet/lnet/lib-me.c index 4739518..46e81d5 100644 --- a/lnet/lnet/lib-me.c +++ b/lnet/lnet/lib-me.c @@ -27,13 +27,11 @@ #include int -LNetMEAttach(lnet_handle_ni_t interface, - lnet_pt_index_t portal, - lnet_process_id_t match_id, - lnet_match_bits_t match_bits, - lnet_match_bits_t ignore_bits, - lnet_unlink_t unlink, lnet_ins_pos_t pos, - lnet_handle_me_t *handle) +LNetMEAttach(unsigned int portal, + lnet_process_id_t match_id, + __u64 match_bits, __u64 ignore_bits, + lnet_unlink_t unlink, lnet_ins_pos_t pos, + lnet_handle_me_t *handle) { ptl_me_t *me; unsigned long flags; @@ -73,8 +71,7 @@ LNetMEAttach(lnet_handle_ni_t interface, int LNetMEInsert(lnet_handle_me_t current_meh, lnet_process_id_t match_id, - lnet_match_bits_t match_bits, - lnet_match_bits_t ignore_bits, + __u64 match_bits, __u64 ignore_bits, lnet_unlink_t unlink, lnet_ins_pos_t pos, lnet_handle_me_t *handle) { diff --git a/lnet/lnet/lib-move.c b/lnet/lnet/lib-move.c index cf3a3d1..622db02 100644 --- a/lnet/lnet/lib-move.c +++ b/lnet/lnet/lib-move.c @@ -45,16 +45,16 @@ static void ptl_commit_md (ptl_libmd_t *md, ptl_msg_t *msg); static ptl_libmd_t * ptl_match_md(int index, int op_mask, lnet_process_id_t src, - lnet_size_t rlength, lnet_size_t roffset, - lnet_match_bits_t match_bits, ptl_msg_t *msg, - lnet_size_t *mlength_out, lnet_size_t *offset_out) + unsigned int rlength, unsigned int roffset, + __u64 match_bits, ptl_msg_t *msg, + unsigned int *mlength_out, unsigned int *offset_out) { struct list_head *match_list = &lnet_apini.apini_portals[index]; struct list_head *tmp; ptl_me_t *me; ptl_libmd_t *md; - lnet_size_t mlength; - lnet_size_t offset; + unsigned int mlength; + unsigned int offset; ENTRY; CDEBUG (D_NET, "Request from %s of length %d into portal %d " @@ -275,10 +275,10 @@ fail_peer (lnet_nid_t nid, int outgoing) return (fail); } -lnet_size_t +unsigned int lnet_iov_nob (int niov, struct iovec *iov) { - lnet_size_t nob = 0; + unsigned int nob = 0; while (niov-- > 0) nob += (iov++)->iov_len; @@ -288,9 +288,9 @@ lnet_iov_nob (int niov, struct iovec *iov) void lnet_copy_iov2buf (char *dest, int niov, struct iovec *iov, - lnet_size_t offset, lnet_size_t len) + unsigned int offset, unsigned int len) { - lnet_size_t nob; + unsigned int nob; if (len == 0) return; @@ -318,10 +318,10 @@ lnet_copy_iov2buf (char *dest, int niov, struct iovec *iov, } void -lnet_copy_buf2iov (int niov, struct iovec *iov, lnet_size_t offset, - char *src, lnet_size_t len) +lnet_copy_buf2iov (int niov, struct iovec *iov, unsigned int offset, + char *src, unsigned int len) { - lnet_size_t nob; + unsigned int nob; if (len == 0) return; @@ -350,13 +350,13 @@ lnet_copy_buf2iov (int niov, struct iovec *iov, lnet_size_t offset, int lnet_extract_iov (int dst_niov, struct iovec *dst, - int src_niov, struct iovec *src, - lnet_size_t offset, lnet_size_t len) + int src_niov, struct iovec *src, + unsigned int offset, unsigned int len) { /* Initialise 'dst' to the subset of 'src' starting at 'offset', * for exactly 'len' bytes, and return the number of entries. * NB not destructive to 'src' */ - lnet_size_t frag_len; + unsigned int frag_len; int niov; if (len == 0) /* no data => */ @@ -395,7 +395,7 @@ lnet_extract_iov (int dst_niov, struct iovec *dst, } #ifndef __KERNEL__ -lnet_size_t +unsigned int lnet_kiov_nob (int niov, lnet_kiov_t *kiov) { LASSERT (0); @@ -404,32 +404,32 @@ lnet_kiov_nob (int niov, lnet_kiov_t *kiov) void lnet_copy_kiov2buf (char *dest, int niov, lnet_kiov_t *kiov, - lnet_size_t offset, lnet_size_t len) + unsigned int offset, unsigned int len) { LASSERT (0); } void -lnet_copy_buf2kiov (int niov, lnet_kiov_t *kiov, lnet_size_t offset, - char *src, lnet_size_t len) +lnet_copy_buf2kiov (int niov, lnet_kiov_t *kiov, unsigned int offset, + char *src, unsigned int len) { LASSERT (0); } int lnet_extract_kiov (int dst_niov, lnet_kiov_t *dst, - int src_niov, lnet_kiov_t *src, - lnet_size_t offset, lnet_size_t len) + int src_niov, lnet_kiov_t *src, + unsigned int offset, unsigned int len) { LASSERT (0); } #else /* __KERNEL__ */ -lnet_size_t +unsigned int lnet_kiov_nob (int niov, lnet_kiov_t *kiov) { - lnet_size_t nob = 0; + unsigned int nob = 0; while (niov-- > 0) nob += (kiov++)->kiov_len; @@ -439,10 +439,10 @@ lnet_kiov_nob (int niov, lnet_kiov_t *kiov) void lnet_copy_kiov2buf (char *dest, int niov, lnet_kiov_t *kiov, - lnet_size_t offset, lnet_size_t len) + unsigned int offset, unsigned int len) { - lnet_size_t nob; - char *addr; + unsigned int nob; + char *addr; if (len == 0) return; @@ -475,11 +475,11 @@ lnet_copy_kiov2buf (char *dest, int niov, lnet_kiov_t *kiov, } void -lnet_copy_buf2kiov (int niov, lnet_kiov_t *kiov, lnet_size_t offset, - char *src, lnet_size_t len) +lnet_copy_buf2kiov (int niov, lnet_kiov_t *kiov, unsigned int offset, + char *src, unsigned int len) { - lnet_size_t nob; - char *addr; + unsigned int nob; + char *addr; if (len == 0) return; @@ -513,13 +513,13 @@ lnet_copy_buf2kiov (int niov, lnet_kiov_t *kiov, lnet_size_t offset, int lnet_extract_kiov (int dst_niov, lnet_kiov_t *dst, - int src_niov, lnet_kiov_t *src, - lnet_size_t offset, lnet_size_t len) + int src_niov, lnet_kiov_t *src, + unsigned int offset, unsigned int len) { /* Initialise 'dst' to the subset of 'src' starting at 'offset', * for exactly 'len' bytes, and return the number of entries. * NB not destructive to 'src' */ - lnet_size_t frag_len; + unsigned int frag_len; int niov; if (len == 0) /* no data => */ @@ -563,7 +563,7 @@ lnet_extract_kiov (int dst_niov, lnet_kiov_t *dst, int ptl_recv (ptl_ni_t *ni, void *private, ptl_msg_t *msg, ptl_libmd_t *md, - lnet_size_t offset, lnet_size_t mlen, lnet_size_t rlen) + unsigned int offset, unsigned int mlen, unsigned int rlen) { int niov = 0; struct iovec *iov = NULL; @@ -584,7 +584,7 @@ ptl_recv (ptl_ni_t *ni, void *private, ptl_msg_t *msg, ptl_libmd_t *md, int ptl_send (ptl_ni_t *ni, void *private, ptl_msg_t *msg, ptl_hdr_t *hdr, int type, lnet_process_id_t target, - ptl_libmd_t *md, lnet_size_t offset, lnet_size_t len) + ptl_libmd_t *md, unsigned int offset, unsigned int len) { unsigned long flags; lnet_nid_t gw_nid; @@ -704,13 +704,13 @@ ptl_drop_message (ptl_ni_t *ni, void *private, ptl_hdr_t *hdr) static int lnet_parse_put(ptl_ni_t *ni, ptl_hdr_t *hdr, void *private, ptl_msg_t *msg) { - lnet_size_t mlength = 0; - lnet_size_t offset = 0; + unsigned int mlength = 0; + unsigned int offset = 0; lnet_process_id_t src = {.nid = hdr->src_nid, - .pid = hdr->src_pid}; - int rc; - ptl_libmd_t *md; - unsigned long flags; + .pid = hdr->src_pid}; + int rc; + ptl_libmd_t *md; + unsigned long flags; /* Convert put fields to host byte order */ hdr->msg.put.match_bits = le64_to_cpu(hdr->msg.put.match_bits); @@ -754,14 +754,14 @@ lnet_parse_put(ptl_ni_t *ni, ptl_hdr_t *hdr, void *private, ptl_msg_t *msg) static int lnet_parse_get(ptl_ni_t *ni, ptl_hdr_t *hdr, void *private, ptl_msg_t *msg) { - lnet_size_t mlength = 0; - lnet_size_t offset = 0; + unsigned int mlength = 0; + unsigned int offset = 0; lnet_process_id_t src = {.nid = hdr->src_nid, - .pid = hdr->src_pid}; - ptl_libmd_t *md; - ptl_hdr_t reply; - unsigned long flags; - int rc; + .pid = hdr->src_pid}; + ptl_libmd_t *md; + ptl_hdr_t reply; + unsigned long flags; + int rc; /* Convert get fields to host byte order */ hdr->msg.get.match_bits = le64_to_cpu(hdr->msg.get.match_bits); @@ -1130,9 +1130,9 @@ lnet_parse(ptl_ni_t *ni, ptl_hdr_t *hdr, void *private) int LNetPut(lnet_handle_md_t mdh, lnet_ack_req_t ack, - lnet_process_id_t target, lnet_pt_index_t portal, - lnet_ac_index_t ac, lnet_match_bits_t match_bits, - lnet_size_t offset, lnet_hdr_data_t hdr_data) + lnet_process_id_t target, unsigned int portal, + __u64 match_bits, unsigned int offset, + __u64 hdr_data) { ptl_msg_t *msg; ptl_hdr_t hdr; @@ -1286,9 +1286,9 @@ lnet_create_reply_msg (ptl_ni_t *ni, lnet_nid_t peer_nid, ptl_msg_t *getmsg) } int -LNetGet(lnet_handle_md_t mdh, lnet_process_id_t target, - lnet_pt_index_t portal, lnet_ac_index_t ac, - lnet_match_bits_t match_bits, lnet_size_t offset) +LNetGet(lnet_handle_md_t mdh, + lnet_process_id_t target, unsigned int portal, + __u64 match_bits, unsigned int offset) { ptl_msg_t *msg; ptl_hdr_t hdr; @@ -1372,7 +1372,7 @@ LNetGet(lnet_handle_md_t mdh, lnet_process_id_t target, } int -LNetDist (lnet_handle_ni_t interface, lnet_nid_t nid, int *order) +LNetDist (lnet_nid_t nid, int *order) { LASSERT (lnet_apini.apini_init); LASSERT (lnet_apini.apini_refcount > 0); diff --git a/lnet/lnet/lib-msg.c b/lnet/lnet/lib-msg.c index 85b5a25..d8389b7 100644 --- a/lnet/lnet/lib-msg.c +++ b/lnet/lnet/lib-msg.c @@ -37,10 +37,6 @@ ptl_enq_event_locked (void *private, ptl_eq_t *eq, lnet_event_t *ev) * UNLINK event unless an explicit unlink succeeds, so the link * sequence is pretty useless */ - /* We don't support different uid/jids yet */ - ev->uid = 0; - ev->jid = 0; - /* size must be a power of 2 to handle sequence # overflow */ LASSERT (eq->eq_size != 0 && eq->eq_size == LOWEST_BIT_SET (eq->eq_size)); @@ -115,7 +111,7 @@ lnet_finalize (ptl_ni_t *ni, void *private, ptl_msg_t *msg, int status) else unlink = ptl_md_exhausted(md); - msg->msg_ev.ni_fail_type = status; + msg->msg_ev.status = status; msg->msg_ev.unlinked = unlink; if (md->md_eq != NULL) diff --git a/lnet/lnet/module.c b/lnet/lnet/module.c index 41e85a7..0fb1caf 100644 --- a/lnet/lnet/module.c +++ b/lnet/lnet/module.c @@ -31,9 +31,8 @@ CFS_MODULE_PARM(config_on_load, "i", int, 0444, static int kportal_ioctl(unsigned int cmd, struct portal_ioctl_data *data) { - int initrc; + int initrc; int rc; - lnet_handle_ni_t nih; if (cmd == IOC_PORTAL_UNCONFIGURE) { /* ghastly hack to prevent repeated net config */ @@ -45,18 +44,17 @@ static int kportal_ioctl(unsigned int cmd, struct portal_ioctl_data *data) if (initrc) { rc--; - LNetNIFini((lnet_handle_ni_t){0}); + LNetNIFini(); } return rc == 0 ? 0 : -EBUSY; } - initrc = LNetNIInit(LNET_IFACE_DEFAULT, LUSTRE_SRV_PTL_PID, - NULL, NULL, &nih); + initrc = LNetNIInit(LUSTRE_SRV_PTL_PID); if (initrc < 0) RETURN (-ENETDOWN); - rc = LNetNICtl(nih, cmd, data); + rc = LNetCtl(cmd, data); if (initrc == 0) { PTL_MUTEX_DOWN(&lnet_apini.apini_api_mutex); @@ -64,7 +62,7 @@ static int kportal_ioctl(unsigned int cmd, struct portal_ioctl_data *data) lnet_apini.apini_niinit_self = 1; PTL_MUTEX_UP(&lnet_apini.apini_api_mutex); } else { - LNetNIFini(nih); + LNetNIFini(); } return rc; @@ -77,21 +75,18 @@ static int init_kportals_module(void) int rc; ENTRY; - rc = LNetInit(NULL); + rc = LNetInit(); if (rc != 0) { CERROR("LNetInit: error %d\n", rc); RETURN(rc); } if (config_on_load) { - lnet_handle_ni_t nih; - PTL_MUTEX_DOWN(&lnet_apini.apini_api_mutex); lnet_apini.apini_niinit_self = 1; PTL_MUTEX_UP(&lnet_apini.apini_api_mutex); - rc = LNetNIInit(LNET_IFACE_DEFAULT, LUSTRE_SRV_PTL_PID, - NULL, NULL, &nih); + rc = LNetNIInit(LUSTRE_SRV_PTL_PID); if (rc != 0) { /* Can't LNetFini or fail now if I loaded NALs */ PTL_MUTEX_DOWN(&lnet_apini.apini_api_mutex); diff --git a/lnet/tests/ping.h b/lnet/tests/ping.h index f68c4fc..1dde8bc 100644 --- a/lnet/tests/ping.h +++ b/lnet/tests/ping.h @@ -36,11 +36,9 @@ #if __KERNEL__ struct pingsrv_data { - - lnet_handle_ni_t ni; - lnet_handle_me_t me; + lnet_handle_me_t me; lnet_handle_eq_t eq; - void *in_buf; + void *in_buf; lnet_process_id_t my_id; lnet_process_id_t id_local; lnet_md_t mdin; @@ -55,10 +53,10 @@ struct pingcli_data { int count; int size; - lnet_nid_t nid; + lnet_nid_t nid; int timeout; lnet_handle_me_t me; - lnet_handle_eq_t eq; + lnet_handle_eq_t eq; char *inbuf; char *outbuf; lnet_process_id_t myid; diff --git a/lnet/tests/ping_cli.c b/lnet/tests/ping_cli.c index 41e001e..54086e3 100644 --- a/lnet/tests/ping_cli.c +++ b/lnet/tests/ping_cli.c @@ -42,7 +42,7 @@ static struct pingcli_data *client = NULL; static int count = 0; static void -pingcli_shutdown(lnet_handle_ni_t nih, int err) +pingcli_shutdown(int err) { int rc; @@ -66,7 +66,7 @@ pingcli_shutdown(lnet_handle_ni_t nih, int err) if ((rc = LNetMEUnlink (client->me))) PDEBUG ("LNetMEUnlink", rc); case 3: - LNetNIFini(nih); + LNetNIFini(); case 4: /* Free our buffers */ @@ -107,7 +107,6 @@ static void pingcli_callback(lnet_event_t *ev) static void pingcli_start(struct portal_ioctl_data *args) { - lnet_handle_ni_t nih = LNET_INVALID_HANDLE; unsigned ping_head_magic = __cpu_to_le32(PING_HEADER_MAGIC); int rc; struct timeval tv1, tv2; @@ -129,7 +128,7 @@ pingcli_start(struct portal_ioctl_data *args) if (client->outbuf == NULL) { CERROR ("Unable to allocate out_buf ("LPSZ" bytes)\n", STDSIZE); - pingcli_shutdown (nih, 4); + pingcli_shutdown (4); return; } @@ -138,23 +137,23 @@ pingcli_start(struct portal_ioctl_data *args) if (client->inbuf == NULL) { CERROR ("Unable to allocate out_buf ("LPSZ" bytes)\n", STDSIZE); - pingcli_shutdown (nih, 4); + pingcli_shutdown (4); return; } - rc = LNetNIInit(LNET_IFACE_DEFAULT, 0, NULL, NULL, &nih); + rc = LNetNIInit(0); if (rc != 0 && rc != 1) { CERROR ("LNetNIInit: error %d\n", rc); - pingcli_shutdown (nih, 4); + pingcli_shutdown (4); return; } /* Based on the initialization aquire our unique portal ID. */ - if ((rc = LNetGetId (nih, &client->myid))) + if ((rc = LNetGetId (1, &client->myid))) { CERROR ("LNetGetId error %d\n", rc); - pingcli_shutdown (nih, 2); + pingcli_shutdown (2); return; } @@ -166,20 +165,20 @@ pingcli_start(struct portal_ioctl_data *args) client->id_remote.nid = client->nid; client->id_remote.pid = 0; - if ((rc = LNetMEAttach (nih, PTL_PING_CLIENT, + if ((rc = LNetMEAttach (PTL_PING_CLIENT, client->id_local, 0, ~0, LNET_RETAIN, LNET_INS_AFTER, &client->me))) { CERROR ("LNetMEAttach error %d\n", rc); - pingcli_shutdown (nih, 2); + pingcli_shutdown (2); return; } /* Allocate the event queue for this network interface */ - if ((rc = LNetEQAlloc (nih, 64, pingcli_callback, &client->eq))) + if ((rc = LNetEQAlloc (64, pingcli_callback, &client->eq))) { CERROR ("LNetEQAlloc error %d\n", rc); - pingcli_shutdown (nih, 2); + pingcli_shutdown (2); return; } @@ -197,7 +196,7 @@ pingcli_start(struct portal_ioctl_data *args) if ((rc = LNetMDAttach (client->me, client->md_in_head, LNET_UNLINK, &client->md_in_head_h))) { CERROR ("LNetMDAttach error %d\n", rc); - pingcli_shutdown (nih, 1); + pingcli_shutdown (1); return; } /* Setup the outgoing ping header */ @@ -213,10 +212,10 @@ pingcli_start(struct portal_ioctl_data *args) count = 0; /* Bind the outgoing ping header */ - if ((rc=LNetMDBind (nih, client->md_out_head, + if ((rc=LNetMDBind (client->md_out_head, LNET_UNLINK, &client->md_out_head_h))) { CERROR ("LNetMDBind error %d\n", rc); - pingcli_shutdown (nih, 1); + pingcli_shutdown (1); return; } while ((client->count - count)) { @@ -232,9 +231,10 @@ pingcli_start(struct portal_ioctl_data *args) sizeof(struct timeval)); if((rc = LNetPut (client->md_out_head_h, LNET_NOACK_REQ, - client->id_remote, PTL_PING_SERVER, 0, 0, 0, 0))) { + client->id_remote, PTL_PING_SERVER, + 0, 0, 0))) { PDEBUG ("LNetPut (header)", rc); - pingcli_shutdown (nih, 1); + pingcli_shutdown (1); return; } CWARN ("Lustre: sent msg no %d.\n", count); @@ -252,7 +252,7 @@ pingcli_start(struct portal_ioctl_data *args) count++; } - pingcli_shutdown (nih, 2); + pingcli_shutdown (2); } /* pingcli_setup() */ diff --git a/lnet/tests/ping_srv.c b/lnet/tests/ping_srv.c index 99ca849..c407fb7 100644 --- a/lnet/tests/ping_srv.c +++ b/lnet/tests/ping_srv.c @@ -63,7 +63,7 @@ static void *pingsrv_shutdown(int err) PDEBUG ("LNetMEUnlink", rc); case 3: - LNetNIFini (server->ni); + LNetNIFini (); case 4: @@ -116,7 +116,7 @@ int pingsrv_thread(void *arg) server->mdout.eq_handle = LNET_EQ_NONE; /* Bind the outgoing buffer */ - if ((rc = LNetMDBind (server->ni, server->mdout, + if ((rc = LNetMDBind (server->mdout, LNET_UNLINK, &server->mdout_h))) { PDEBUG ("LNetMDBind", rc); pingsrv_shutdown (1); @@ -138,7 +138,8 @@ int pingsrv_thread(void *arg) } if ((rc = LNetPut (server->mdout_h, LNET_NOACK_REQ, - server->evnt.initiator, PTL_PING_CLIENT, 0, 0, 0, 0))) + server->evnt.initiator, PTL_PING_CLIENT, + 0, 0, 0))) PDEBUG ("LNetPut", rc); atomic_dec (&pkt); @@ -183,10 +184,8 @@ static struct pingsrv_data *pingsrv_setup(void) { int rc; - server->ni = LNET_INVALID_HANDLE; - /* Aquire and initialize the proper nal for portals. */ - rc = LNetNIInit(LNET_IFACE_DEFAULT, 0, NULL, NULL, &server->ni); + rc = LNetNIInit(0); if (!(rc == 0 || rc == 1)) { CDEBUG (D_OTHER, "LNetNIInit: error %d\n", rc); return pingsrv_shutdown (4); @@ -194,7 +193,7 @@ static struct pingsrv_data *pingsrv_setup(void) /* Based on the initialization aquire our unique portal ID. */ - if ((rc = LNetGetId (server->ni, &server->my_id))) { + if ((rc = LNetGetId (1, &server->my_id))) { PDEBUG ("LNetGetId", rc); return pingsrv_shutdown (2); } @@ -203,7 +202,7 @@ static struct pingsrv_data *pingsrv_setup(void) server->id_local.pid = LNET_PID_ANY; /* Attach a match entries for header packets */ - if ((rc = LNetMEAttach (server->ni, PTL_PING_SERVER, + if ((rc = LNetMEAttach (PTL_PING_SERVER, server->id_local,0, ~0, LNET_RETAIN, LNET_INS_AFTER, &server->me))) { PDEBUG ("LNetMEAttach", rc); @@ -211,8 +210,7 @@ static struct pingsrv_data *pingsrv_setup(void) } - if ((rc = LNetEQAlloc (server->ni, 1024, &pingsrv_callback, - &server->eq))) { + if ((rc = LNetEQAlloc (1024, &pingsrv_callback, &server->eq))) { PDEBUG ("LNetEQAlloc (callback)", rc); return pingsrv_shutdown (2); } diff --git a/lnet/tests/sping_cli.c b/lnet/tests/sping_cli.c index c9778aa..d7d4813 100644 --- a/lnet/tests/sping_cli.c +++ b/lnet/tests/sping_cli.c @@ -51,7 +51,7 @@ static struct pingcli_data *client = NULL; static int count = 0; static void -pingcli_shutdown(lnet_handle_ni_t nih, int err) +pingcli_shutdown(int err) { int rc; @@ -72,7 +72,7 @@ pingcli_shutdown(lnet_handle_ni_t nih, int err) if ((rc = LNetMEUnlink (client->me))) PDEBUG ("LNetMEUnlink", rc); case 3: - LNetNIFini (nih); + LNetNIFini (); case 4: /* Free our buffers */ @@ -101,7 +101,6 @@ static void pingcli_callback(lnet_event_t *ev) static void pingcli_start(struct portal_ioctl_data *args) { - lnet_handle_ni_t nih = LNET_INVALID_HANDLE; unsigned ping_head_magic = PING_HEADER_MAGIC; int rc; @@ -122,7 +121,7 @@ pingcli_start(struct portal_ioctl_data *args) if (client->outbuf == NULL) { CERROR ("Unable to allocate out_buf ("LPSZ" bytes)\n", STDSIZE); - pingcli_shutdown (nih, 4); + pingcli_shutdown (4); return; } @@ -131,24 +130,24 @@ pingcli_start(struct portal_ioctl_data *args) if (client->inbuf == NULL) { CERROR ("Unable to allocate out_buf ("LPSZ" bytes)\n", STDSIZE); - pingcli_shutdown (nih, 4); + pingcli_shutdown (4); return; } /* Aquire and initialize the proper nal for portals. */ - rc = LNetNIInit(LNET_IFACE_DEFAULT, 0, NULL, NULL, &nih); + rc = LNetNIInit(0); if (rc != 0 && rc != 1) { CERROR ("LNetNIInit: error %d\n", rc); - pingcli_shutdown (nih, 4); + pingcli_shutdown (4); return; } /* Based on the initialization aquire our unique portal ID. */ - if ((rc = LNetGetId (nih, &client->myid))) + if ((rc = LNetGetId (1, &client->myid))) { CERROR ("LNetGetId error %d\n", rc); - pingcli_shutdown (nih, 2); + pingcli_shutdown (2); return; } @@ -160,20 +159,20 @@ pingcli_start(struct portal_ioctl_data *args) client->id_remote.nid = client->nid; client->id_remote.pid = 0; - if ((rc = LNetMEAttach (nih, PTL_PING_CLIENT, + if ((rc = LNetMEAttach (PTL_PING_CLIENT, client->id_local, 0, ~0, LNET_RETAIN, LNET_INS_AFTER, &client->me))) { CERROR ("LNetMEAttach error %d\n", rc); - pingcli_shutdown (nih, 2); + pingcli_shutdown (2); return; } /* Allocate the event queue for this network interface */ - if ((rc = LNetEQAlloc (nih, 64, pingcli_callback, &client->eq))) + if ((rc = LNetEQAlloc (64, pingcli_callback, &client->eq))) { CERROR ("LNetEQAlloc error %d\n", rc); - pingcli_shutdown (nih, 2); + pingcli_shutdown (2); return; } @@ -190,7 +189,7 @@ pingcli_start(struct portal_ioctl_data *args) if ((rc = LNetMDAttach (client->me, client->md_in_head, LNET_UNLINK, &client->md_in_head_h))) { CERROR ("LNetMDAttach error %d\n", rc); - pingcli_shutdown (nih, 1); + pingcli_shutdown (1); return; } @@ -205,17 +204,18 @@ pingcli_start(struct portal_ioctl_data *args) memcpy (client->outbuf, &ping_head_magic, sizeof(ping_head_magic)); /* Bind the outgoing ping header */ - if ((rc=LNetMDBind (nih, client->md_out_head, - LNET_UNLINK, &client->md_out_head_h))) { + if ((rc=LNetMDBind (client->md_out_head, + LNET_UNLINK, &client->md_out_head_h))) { CERROR ("LNetMDBind error %d\n", rc); - pingcli_shutdown (nih, 1); + pingcli_shutdown (1); return; } /* Put the ping packet */ if((rc = LNetPut (client->md_out_head_h, LNET_NOACK_REQ, - client->id_remote, PTL_PING_SERVER, 0, 0, 0, 0))) { + client->id_remote, PTL_PING_SERVER, + 0, 0, 0))) { PDEBUG ("LNetPut (header)", rc); - pingcli_shutdown (nih, 1); + pingcli_shutdown (1); return; } @@ -224,13 +224,13 @@ pingcli_start(struct portal_ioctl_data *args) rc = schedule_timeout (20 * client->timeout); if (rc == 0) { CERROR ("Time out on the server\n"); - pingcli_shutdown (nih, 2); + pingcli_shutdown (2); return; } else { CWARN("Received respose from the server \n"); } - pingcli_shutdown (nih, 2); + pingcli_shutdown (2); } /* pingcli_setup() */ diff --git a/lnet/tests/sping_srv.c b/lnet/tests/sping_srv.c index 0c8fc69..8ff3860 100644 --- a/lnet/tests/sping_srv.c +++ b/lnet/tests/sping_srv.c @@ -85,7 +85,7 @@ static void *pingsrv_shutdown(int err) PDEBUG ("LNetMEUnlink", rc); case 3: - LNetNIFini(server->ni); + LNetNIFini(); case 4: @@ -125,8 +125,8 @@ int pingsrv_thread(void *arg) server->mdout.eq_handle = LNET_EQ_NONE; /* Bind the outgoing buffer */ - if ((rc = LNetMDBind (server->ni, server->mdout, - LNET_UNLINK, &server->mdout_h))) { + if ((rc = LNetMDBind (server->mdout, + LNET_UNLINK, &server->mdout_h))) { PDEBUG ("LNetMDBind", rc); pingsrv_shutdown (1); return 1; @@ -147,7 +147,8 @@ int pingsrv_thread(void *arg) } if ((rc = LNetPut (server->mdout_h, LNET_NOACK_REQ, - server->evnt.initiator, PTL_PING_CLIENT, 0, 0, 0, 0))) + server->evnt.initiator, PTL_PING_CLIENT, + 0, 0, 0))) PDEBUG ("LNetPut", rc); atomic_dec (&pkt); @@ -189,16 +190,14 @@ static struct pingsrv_data *pingsrv_setup(void) { int rc; - server->ni = LNET_INVALID_HANDLE; - - rc = LNetNIInit(LNET_IFACE_DEFAULT, 0, NULL, NULL, &server->ni); + rc = LNetNIInit(0); if (rc != 0 && rc != 1) { CDEBUG (D_OTHER, "LNetNIInit: error %d\n", rc); return pingsrv_shutdown (4); } /* Based on the initialization aquire our unique portal ID. */ - if ((rc = LNetGetId (server->ni, &server->my_id))) { + if ((rc = LNetGetId (1, &server->my_id))) { PDEBUG ("LNetGetId", rc); return pingsrv_shutdown (2); } @@ -207,7 +206,7 @@ static struct pingsrv_data *pingsrv_setup(void) server->id_local.pid = LNET_PID_ANY; /* Attach a match entries for header packets */ - if ((rc = LNetMEAttach (server->ni, PTL_PING_SERVER, + if ((rc = LNetMEAttach (PTL_PING_SERVER, server->id_local,0, ~0, LNET_RETAIN, LNET_INS_AFTER, &server->me))) { PDEBUG ("LNetMEAttach", rc); @@ -215,8 +214,7 @@ static struct pingsrv_data *pingsrv_setup(void) } - if ((rc = LNetEQAlloc (server->ni, 64, pingsrv_callback, - &server->eq))) { + if ((rc = LNetEQAlloc (64, pingsrv_callback, &server->eq))) { PDEBUG ("LNetEQAlloc (callback)", rc); return pingsrv_shutdown (2); } -- 1.8.3.1