X-Git-Url: https://git.whamcloud.com/?a=blobdiff_plain;f=lnet%2Ftests%2Fping_cli.c;h=b216df16c589451fee41e398bbb01f46dc0852c5;hb=7bb892f4f3de837a940d867b97fe14013ad67dc6;hp=9977f206720cbb50e91f7c4fa06283a93d491424;hpb=57e6d88a8a8d858e2d74aeefba4c764ad08cf86d;p=fs%2Flustre-release.git diff --git a/lnet/tests/ping_cli.c b/lnet/tests/ping_cli.c index 9977f20..b216df1 100644 --- a/lnet/tests/ping_cli.c +++ b/lnet/tests/ping_cli.c @@ -46,7 +46,7 @@ static struct pingcli_data *client = NULL; static int count = 0; static void -pingcli_shutdown(int err) +pingcli_shutdown(ptl_handle_ni_t nih, int err) { int rc; @@ -70,7 +70,7 @@ pingcli_shutdown(int err) if ((rc = PtlMEUnlink (client->me))) PDEBUG ("PtlMEUnlink", rc); case 3: - kportal_put_ni (client->args->ioc_nal); + PtlNIFini(nih); case 4: /* Free our buffers */ @@ -84,7 +84,7 @@ pingcli_shutdown(int err) CDEBUG (D_OTHER, "ping client released resources\n"); } /* pingcli_shutdown() */ -static int pingcli_callback(ptl_event_t *ev) +static void pingcli_callback(ptl_event_t *ev) { int i, magic; i = *(int *)(ev->mem_desc.start + ev->offset + sizeof(unsigned)); @@ -92,21 +92,19 @@ static int pingcli_callback(ptl_event_t *ev) if(magic != 0xcafebabe) { printk ("LustreError: Unexpected response \n"); - return 1; } if((i == count) || !count) wake_up_process (client->tsk); else printk ("LustreError: Received response after timeout for %d\n",i); - return 1; } static struct pingcli_data * pingcli_start(struct portal_ioctl_data *args) { - ptl_handle_ni_t *nip; + ptl_handle_ni_t nih = PTL_INVALID_HANDLE; unsigned ping_head_magic = PING_HEADER_MAGIC; unsigned ping_bulk_magic = PING_BULK_MAGIC; int rc; @@ -127,7 +125,7 @@ pingcli_start(struct portal_ioctl_data *args) if (client->outbuf == NULL) { CERROR ("Unable to allocate out_buf ("LPSZ" bytes)\n", STDSIZE); - pingcli_shutdown (4); + pingcli_shutdown (nih, 4); return (NULL); } @@ -136,23 +134,24 @@ pingcli_start(struct portal_ioctl_data *args) if (client->inbuf == NULL) { CERROR ("Unable to allocate out_buf ("LPSZ" bytes)\n", STDSIZE); - pingcli_shutdown (4); + pingcli_shutdown (nih, 4); return (NULL); } /* Aquire and initialize the proper nal for portals. */ - if ((nip = kportal_get_ni (args->ioc_nal)) == NULL) + rc = PtlNIInit(args->ioc_nal, 0, NULL, NULL, &nih); + if (rc != PTL_OK || rc != PTL_IFACE_DUP) { CERROR ("NAL %d not loaded\n", args->ioc_nal); - pingcli_shutdown (4); + pingcli_shutdown (nih, 4); return (NULL); } /* Based on the initialization aquire our unique portal ID. */ - if ((rc = PtlGetId (*nip, &client->myid))) + if ((rc = PtlGetId (nih, &client->myid))) { CERROR ("PtlGetId error %d\n", rc); - pingcli_shutdown (2); + pingcli_shutdown (nih, 2); return (NULL); } @@ -164,20 +163,20 @@ pingcli_start(struct portal_ioctl_data *args) client->id_remote.nid = args->ioc_nid; client->id_remote.pid = 0; - if ((rc = PtlMEAttach (*nip, PTL_PING_CLIENT, + if ((rc = PtlMEAttach (nih, PTL_PING_CLIENT, client->id_local, 0, ~0, PTL_RETAIN, PTL_INS_AFTER, &client->me))) { CERROR ("PtlMEAttach error %d\n", rc); - pingcli_shutdown (2); + pingcli_shutdown (nih, 2); return (NULL); } /* Allocate the event queue for this network interface */ - if ((rc = PtlEQAlloc (*nip, 64, pingcli_callback, &client->eq))) + if ((rc = PtlEQAlloc (nih, 64, pingcli_callback, &client->eq))) { CERROR ("PtlEQAlloc error %d\n", rc); - pingcli_shutdown (2); + pingcli_shutdown (nih, 2); return (NULL); } @@ -196,7 +195,7 @@ pingcli_start(struct portal_ioctl_data *args) if ((rc = PtlMDAttach (client->me, client->md_in_head, PTL_UNLINK, &client->md_in_head_h))) { CERROR ("PtlMDAttach error %d\n", rc); - pingcli_shutdown (1); + pingcli_shutdown (nih, 1); return (NULL); } /* Setup the outgoing ping header */ @@ -212,10 +211,10 @@ pingcli_start(struct portal_ioctl_data *args) count = 0; /* Bind the outgoing ping header */ - if ((rc=PtlMDBind (*nip, client->md_out_head, + if ((rc=PtlMDBind (nih, client->md_out_head, PTL_UNLINK, &client->md_out_head_h))) { CERROR ("PtlMDBind error %d\n", rc); - pingcli_shutdown (1); + pingcli_shutdown (nih, 1); return NULL; } while ((args->ioc_count - count)) { @@ -230,7 +229,7 @@ pingcli_start(struct portal_ioctl_data *args) if((rc = PtlPut (client->md_out_head_h, PTL_NOACK_REQ, client->id_remote, PTL_PING_SERVER, 0, 0, 0, 0))) { PDEBUG ("PtlPut (header)", rc); - pingcli_shutdown (1); + pingcli_shutdown (nih, 1); return NULL; } printk ("Lustre: sent msg no %d", count); @@ -255,7 +254,7 @@ pingcli_start(struct portal_ioctl_data *args) PORTAL_FREE (client->inbuf, (args->ioc_size + STDSIZE) * args->ioc_count); - pingcli_shutdown (2); + pingcli_shutdown (nih, 2); /* Success! */ return NULL;