#ifndef PTL_USE_LIB_FREELIST
int
-kportal_descriptor_setup (nal_cb_t *nal)
+kportal_descriptor_setup (nal_cb_t *nal,
+ ptl_ni_limits_t *requested_limits,
+ ptl_ni_limits_t *actual_limits)
{
+ /* Ignore requested limits! */
+ actual_limits->max_mes = INT_MAX;
+ actual_limits->max_mds = INT_MAX;
+ actual_limits->max_eqs = INT_MAX;
+
return PTL_OK;
}
}
int
-kportal_descriptor_setup (nal_cb_t *nal)
+kportal_descriptor_setup (nal_cb_t *nal,
+ ptl_ni_limits_t *requested_limits,
+ ptl_ni_limits_t *actual_limits)
{
/* NB on failure caller must still call kportal_descriptor_cleanup */
/* ****** */
memset (&nal->ni.ni_free_mds, 0, sizeof (nal->ni.ni_free_mds));
memset (&nal->ni.ni_free_eqs, 0, sizeof (nal->ni.ni_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 = lib_freelist_init (nal, &nal->ni.ni_free_mes,
MAX_MES, sizeof (lib_me_t));
if (rc != PTL_OK)
}
int
-lib_init(nal_cb_t * nal, ptl_nid_t nid, ptl_pid_t pid, int gsize,
- ptl_pt_index_t ptl_size, ptl_ac_index_t acl_size)
+lib_init(nal_cb_t *nal, ptl_process_id_t process_id,
+ ptl_ni_limits_t *requested_limits,
+ ptl_ni_limits_t *actual_limits)
{
int rc = PTL_OK;
lib_ni_t *ni = &nal->ni;
+ int ptl_size;
int i;
ENTRY;
/* NB serialised in PtlNIInit() */
- if (ni->refcnt != 0) { /* already initialised */
- ni->refcnt++;
- goto out;
- }
-
lib_assert_wire_constants ();
/*
*/
memset(&ni->counters, 0, sizeof(lib_counters_t));
- rc = kportal_descriptor_setup (nal);
+ rc = kportal_descriptor_setup (nal, requested_limits,
+ &ni->actual_limits);
if (rc != PTL_OK)
goto out;
if (rc != PTL_OK)
goto out;
- ni->nid = nid;
- ni->pid = pid;
+ ni->nid = process_id.nid;
+ ni->pid = process_id.pid;
- ni->num_nodes = gsize;
- ni->tbl.size = ptl_size;
+ if (requested_limits != NULL)
+ ptl_size = requested_limits->max_pt_index + 1;
+ else
+ ptl_size = 64;
+ ni->tbl.size = ptl_size;
ni->tbl.tbl = nal->cb_malloc(nal, sizeof(struct list_head) * ptl_size);
if (ni->tbl.tbl == NULL) {
rc = PTL_NO_SPACE;
for (i = 0; i < ptl_size; i++)
INIT_LIST_HEAD(&(ni->tbl.tbl[i]));
- ni->debug = PTL_DEBUG_NONE;
- ni->up = 1;
- ni->refcnt++;
+ /* max_{mes,mds,eqs} set in kportal_descriptor_setup */
+
+ /* We don't have an access control table! */
+ ni->actual_limits.max_ac_index = -1;
+
+ ni->actual_limits.max_pt_index = ptl_size - 1;
+ ni->actual_limits.max_md_iovecs = PTL_MD_MAX_IOV;
+ ni->actual_limits.max_me_list = INT_MAX;
+
+ /* We don't support PtlGetPut! */
+ ni->actual_limits.max_getput_md = 0;
+
+ if (actual_limits != NULL)
+ *actual_limits = ni->actual_limits;
out:
if (rc != PTL_OK) {
lib_ni_t *ni = &nal->ni;
int idx;
- ni->refcnt--;
-
- if (ni->refcnt != 0)
- goto out;
-
- /* NB no stat_lock() since this is the last reference. The NAL
+ /* NB no state_lock() since this is the last reference. The NAL
* should have shut down already, so it should be safe to unlink
* and free all descriptors, even those that appear committed to a
* network op (eg MD with non-zero pending count)
}
nal->cb_free(nal, ni->tbl.tbl, sizeof(struct list_head) * ni->tbl.size);
- ni->up = 0;
lib_cleanup_handle_hash (nal);
kportal_descriptor_cleanup (nal);
- out:
return (PTL_OK);
}