OpenCores
URL https://opencores.org/ocsvn/funbase_ip_library/funbase_ip_library/trunk

Subversion Repositories funbase_ip_library

[/] [funbase_ip_library/] [trunk/] [TUT/] [ip.swp.api/] [openmcapi/] [1.0/] [test/] [func/] [fts_mcapi_test.c] - Blame information for rev 145

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 145 lanttu
/*
2
 * Copyright (c) 2010, Mentor Graphics Corporation
3
 * All rights reserved.
4
 *
5
 * Redistribution and use in source and binary forms, with or without
6
 * modification, are permitted provided that the following conditions are met:
7
 *
8
 * 1. Redistributions of source code must retain the above copyright notice,
9
 *    this list of conditions and the following disclaimer.
10
 * 2. Redistributions in binary form must reproduce the above copyright notice,
11
 *    this list of conditions and the following disclaimer in the documentation
12
 *    and/or other materials provided with the distribution.
13
 * 3. Neither the name of the <ORGANIZATION> nor the names of its contributors
14
 *    may be used to endorse or promote products derived from this software
15
 *    without specific prior written permission.
16
 *
17
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
18
 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20
 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
21
 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
22
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
25
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
26
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
27
 * POSSIBILITY OF SUCH DAMAGE.
28
 */
29
 
30
/*
31
*   FILENAME
32
*
33
*       fts_main.c
34
*
35
*
36
*************************************************************************/
37
 
38
#include "fts_defs.h"
39
#include "support_suite/mcapid_support.h"
40
#include "mcapid.h"
41
 
42
extern MCAPI_MUTEX      MCAPID_FTS_Mutex;
43
 
44
/************************************************************************
45
*
46
*   FUNCTION
47
*
48
*       MCAPI_FTS_Tx_2_33_1
49
*
50
*   DESCRIPTION
51
*
52
*       Testing mcapi_test while getting a foreign endpoint - endpoint
53
*       does not yet exist
54
*
55
*           Node 0 – Waits for get endpoint request, create endpoint
56
*
57
*           Node 1 – Issues get endpoint request, test for completion
58
*
59
*************************************************************************/
60
MCAPI_THREAD_ENTRY(MCAPI_FTS_Tx_2_33_1)
61
{
62
    MCAPID_STRUCT       *mcapi_struct = (MCAPID_STRUCT*)argv;
63
    mcapi_endpoint_t    endpoint;
64
    size_t              rx_len;
65
    mcapi_status_t      status;
66
    mcapi_boolean_t     finished;
67
    int                 deleted = 0;
68
 
69
    /* Don't let any other test run while this test is running. */
70
    MCAPI_Obtain_Mutex(&MCAPID_FTS_Mutex);
71
 
72
    /* Get the foreign endpoint. */
73
    mcapi_get_endpoint_i(FUNC_BACKEND_NODE_ID, 1024, &endpoint,
74
                         &mcapi_struct->request, &mcapi_struct->status);
75
    status_assert(mcapi_struct->status);
76
 
77
    /* Check the status. */
78
    finished = mcapi_test(&mcapi_struct->request, &rx_len, &mcapi_struct->status);
79
    status_assert_code(mcapi_struct->status, MCAPI_PENDING);
80
    general_assert(finished == MCAPI_FALSE);
81
 
82
    /* Indicate that the endpoint should be created in 500 milliseconds. */
83
    mcapi_struct->status =
84
        MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_CREATE_ENDP, 1024,
85
                               mcapi_struct->local_endp, 500, MCAPI_DEFAULT_PRIO);
86
    status_assert(mcapi_struct->status);
87
 
88
    unsigned long start = MCAPID_Time();
89
 
90
    for (;;)
91
    {
92
        timeout_assert(start, 5);
93
 
94
        /* The wait call should return success eventually. */
95
        finished =
96
            mcapi_test(&mcapi_struct->request, &rx_len, &mcapi_struct->status);
97
 
98
        if ( (finished == MCAPI_TRUE) &&
99
             (mcapi_struct->status == MCAPI_SUCCESS) )
100
        {
101
            /* Tell the other side to delete the endpoint. */
102
            status =
103
                MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_DELETE_ENDP, 1024,
104
                                       mcapi_struct->local_endp, 0,
105
                                       MCAPI_DEFAULT_PRIO);
106
            status_assert(mcapi_struct->status);
107
            deleted = 1;
108
 
109
            /* Wait for a response before releasing the mutex. */
110
            status = MCAPID_RX_Mgmt_Response(mcapi_struct);
111
 
112
            break;
113
        }
114
 
115
        /* Let the other side create the endpoint. */
116
        MCAPID_Sleep(250);
117
    }
118
 
119
    if (!deleted)
120
        MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_DELETE_ENDP, 1024,
121
                               mcapi_struct->local_endp, 0,
122
                               MCAPI_DEFAULT_PRIO);
123
 
124
    /* Set the state of the test to completed. */
125
    mcapi_struct->state = 0;
126
 
127
    /* Allow the next test to run. */
128
    MCAPI_Release_Mutex(&MCAPID_FTS_Mutex);
129
 
130
} /* MCAPI_FTS_Tx_2_33_1 */
131
 
132
/************************************************************************
133
*
134
*   FUNCTION
135
*
136
*       MCAPI_FTS_Tx_2_33_2
137
*
138
*   DESCRIPTION
139
*
140
*       Testing mcapi_test while getting a foreign endpoint - endpoint
141
*       already exists
142
*
143
*           Node 0 – Create endpoint
144
*
145
*           Node 1 – Issues get endpoint request, test for completion
146
*
147
*************************************************************************/
148
MCAPI_THREAD_ENTRY(MCAPI_FTS_Tx_2_33_2)
149
{
150
    MCAPID_STRUCT       *mcapi_struct = (MCAPID_STRUCT*)argv;
151
    mcapi_endpoint_t    endpoint;
152
    size_t              rx_len;
153
    mcapi_status_t      status;
154
    mcapi_boolean_t     finished;
155
 
156
    /* Don't let any other test run while this test is running. */
157
    MCAPI_Obtain_Mutex(&MCAPID_FTS_Mutex);
158
 
159
    /* Indicate that the endpoint should be created. */
160
    mcapi_struct->status =
161
        MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_CREATE_ENDP, 1024,
162
                               mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
163
    status_assert(mcapi_struct->status);
164
 
165
    /* Get the response. */
166
    mcapi_struct->status = MCAPID_RX_Mgmt_Response(mcapi_struct);
167
    status_assert(mcapi_struct->status);
168
 
169
    /* Get the foreign endpoint. */
170
    mcapi_get_endpoint_i(FUNC_BACKEND_NODE_ID, 1024, &endpoint,
171
                         &mcapi_struct->request, &mcapi_struct->status);
172
    status_assert(mcapi_struct->status);
173
 
174
    /* This is an arbitrary wait to allow for the get_endpoint message
175
     * round trip. */
176
    MCAPID_Sleep(100);
177
 
178
    /* The test call should return success almost immediately. */
179
    finished = mcapi_test(&mcapi_struct->request, &rx_len, &mcapi_struct->status);
180
    status_assert(mcapi_struct->status);
181
    general_assert(finished == MCAPI_TRUE);
182
 
183
    /* Tell the other side to delete the endpoint. */
184
    status =
185
        MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_DELETE_ENDP, 1024,
186
                               mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
187
    status_assert(mcapi_struct->status);
188
 
189
    /* Wait for a response before releasing the mutex. */
190
    status = MCAPID_RX_Mgmt_Response(mcapi_struct);
191
 
192
    /* Set the state of the test to completed. */
193
    mcapi_struct->state = 0;
194
 
195
    /* Allow the next test to run. */
196
    MCAPI_Release_Mutex(&MCAPID_FTS_Mutex);
197
 
198
} /* MCAPI_FTS_Tx_2_33_2 */
199
 
200
/************************************************************************
201
*
202
*   FUNCTION
203
*
204
*       MCAPI_FTS_Tx_2_33_3
205
*
206
*   DESCRIPTION
207
*
208
*       Testing mcapi_test while getting a foreign endpoint - endpoint
209
*       does not yet exist and get operation is canceled
210
*
211
*           Node 0 – Waits for get endpoint request, create endpoint
212
*
213
*           Node 1 – Issues get endpoint request, cancel request, test
214
*                    for completion
215
*
216
*************************************************************************/
217
MCAPI_THREAD_ENTRY(MCAPI_FTS_Tx_2_33_3)
218
{
219
    MCAPID_STRUCT       *mcapi_struct = (MCAPID_STRUCT*)argv;
220
    mcapi_endpoint_t    endpoint = 0xffffffff;
221
    size_t              rx_len;
222
    mcapi_status_t      status;
223
    mcapi_boolean_t     finished;
224
 
225
    /* Don't let any other test run while this test is running. */
226
    MCAPI_Obtain_Mutex(&MCAPID_FTS_Mutex);
227
 
228
    /* Get the foreign endpoint. */
229
    mcapi_get_endpoint_i(FUNC_BACKEND_NODE_ID, 1024, &endpoint,
230
                         &mcapi_struct->request, &mcapi_struct->status);
231
 
232
    if (mcapi_struct->status == MCAPI_SUCCESS)
233
    {
234
        /* Indicate that the endpoint should be created in 500 milliseconds. */
235
        mcapi_struct->status =
236
            MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_CREATE_ENDP, 1024,
237
                                   mcapi_struct->local_endp, 500, MCAPI_DEFAULT_PRIO);
238
 
239
        /* Wait for a response. */
240
        if (mcapi_struct->status == MCAPI_SUCCESS)
241
        {
242
            /* Cancel the get operation. */
243
            mcapi_cancel(&mcapi_struct->request, &mcapi_struct->status);
244
 
245
            /* The wait call should return canceled immediately. */
246
            finished =
247
                mcapi_test(&mcapi_struct->request, &rx_len, &mcapi_struct->status);
248
 
249
            if ( (finished == MCAPI_FALSE) &&
250
                 (mcapi_struct->status == MCAPI_ERR_REQUEST_CANCELLED) )
251
            {
252
                mcapi_struct->status = MCAPI_SUCCESS;
253
            }
254
 
255
            else
256
            {
257
                mcapi_struct->status = -1;
258
            }
259
 
260
            /* Wait for the response that the endpoint has been created. */
261
            status = MCAPID_RX_Mgmt_Response(mcapi_struct);
262
 
263
            if (mcapi_struct->status == MCAPI_SUCCESS)
264
            {
265
                /* Ensure the endpoint was not updated. */
266
                if (endpoint != 0xffffffff)
267
                {
268
                    mcapi_struct->status = -1;
269
                }
270
 
271
                /* Tell the other side to delete the endpoint. */
272
                status =
273
                    MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_DELETE_ENDP, 1024,
274
                                           mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
275
 
276
                if (status == MCAPI_SUCCESS)
277
                {
278
                    /* Wait for a response before releasing the mutex. */
279
                    status = MCAPID_RX_Mgmt_Response(mcapi_struct);
280
                }
281
            }
282
        }
283
    }
284
 
285
    /* Set the state of the test to completed. */
286
    mcapi_struct->state = 0;
287
 
288
    /* Allow the next test to run. */
289
    MCAPI_Release_Mutex(&MCAPID_FTS_Mutex);
290
 
291
} /* MCAPI_FTS_Tx_2_33_3 */
292
 
293
/************************************************************************
294
*
295
*   FUNCTION
296
*
297
*       MCAPI_FTS_Tx_2_33_4
298
*
299
*   DESCRIPTION
300
*
301
*       Testing mcapi_test for completed transmission using
302
*       mcapi_msg_send_i.
303
*
304
*           Node 0 – Create an endpoint, wait for data
305
*
306
*           Node 1 – Issue get endpoint request, transmit data, check
307
*                    for completed transmission
308
*
309
*************************************************************************/
310
MCAPI_THREAD_ENTRY(MCAPI_FTS_Tx_2_33_4)
311
{
312
    MCAPID_STRUCT       *mcapi_struct = (MCAPID_STRUCT*)argv;
313
    unsigned char       buffer[MCAPID_MSG_LEN];
314
    size_t              rx_len;
315
    mcapi_boolean_t     finished;
316
 
317
    /* Don't let any other test run while this test is running. */
318
    MCAPI_Obtain_Mutex(&MCAPID_FTS_Mutex);
319
 
320
    /* Store the endpoint to which the other side should reply. */
321
    mcapi_put32((unsigned char*)buffer, MCAPID_MGMT_LOCAL_ENDP_OFFSET, mcapi_struct->local_endp);
322
 
323
    /* Send a message. */
324
    mcapi_msg_send_i(mcapi_struct->local_endp, mcapi_struct->foreign_endp,
325
                     buffer, MCAPID_MSG_LEN, 0, &mcapi_struct->request,
326
                     &mcapi_struct->status);
327
 
328
    /* Wait for a response. */
329
    if (mcapi_struct->status == MCAPI_SUCCESS)
330
    {
331
        /* Test if the data was sent. */
332
        finished =
333
            mcapi_test(&mcapi_struct->request, &rx_len, &mcapi_struct->status);
334
 
335
        /* If the test does not return success or the correct number of bytes
336
         * transmitted.
337
         */
338
        if ( (finished != MCAPI_TRUE) ||
339
             (mcapi_struct->status != MCAPI_SUCCESS) ||
340
             (rx_len != MCAPID_MSG_LEN) )
341
        {
342
            mcapi_struct->status = -1;
343
        }
344
    }
345
 
346
    /* Set the state of the test to completed. */
347
    mcapi_struct->state = 0;
348
 
349
    /* Allow the next test to run. */
350
    MCAPI_Release_Mutex(&MCAPID_FTS_Mutex);
351
 
352
} /* MCAPI_FTS_Tx_2_33_4 */
353
 
354
/************************************************************************
355
*
356
*   FUNCTION
357
*
358
*       MCAPI_FTS_Tx_2_33_5
359
*
360
*   DESCRIPTION
361
*
362
*       Testing mcapi_test receiving data using mcapi_msg_recv_i -
363
*       incomplete.
364
*
365
*           Node 1 – Create endpoint, issue receive request, test for
366
*                    completion.
367
*
368
*************************************************************************/
369
MCAPI_THREAD_ENTRY(MCAPI_FTS_Tx_2_33_5)
370
{
371
    MCAPID_STRUCT       *mcapi_struct = (MCAPID_STRUCT*)argv;
372
    char                buffer[MCAPID_MGMT_PKT_LEN];
373
    size_t              rx_len;
374
    mcapi_boolean_t     finished;
375
 
376
    /* Don't let any other test run while this test is running. */
377
    MCAPI_Obtain_Mutex(&MCAPID_FTS_Mutex);
378
 
379
    /* Make the call to receive the data. */
380
    mcapi_msg_recv_i(mcapi_struct->local_endp, buffer, MCAPID_MGMT_PKT_LEN,
381
                     &mcapi_struct->request, &mcapi_struct->status);
382
 
383
    if (mcapi_struct->status == MCAPI_SUCCESS)
384
    {
385
        /* Wait for the data. */
386
        finished =
387
            mcapi_test(&mcapi_struct->request, &rx_len, &mcapi_struct->status);
388
 
389
        if ( (mcapi_struct->status == MCAPI_PENDING) &&
390
             (finished == MCAPI_FALSE) )
391
        {
392
            mcapi_struct->status = MCAPI_SUCCESS;
393
        }
394
 
395
        else
396
        {
397
            mcapi_struct->status = -1;
398
        }
399
    }
400
 
401
    /* Set the state of the test to completed. */
402
    mcapi_struct->state = 0;
403
 
404
    /* Allow the next test to run. */
405
    MCAPI_Release_Mutex(&MCAPID_FTS_Mutex);
406
 
407
} /* MCAPI_FTS_Tx_2_33_5 */
408
 
409
/************************************************************************
410
*
411
*   FUNCTION
412
*
413
*       MCAPI_FTS_Tx_2_33_6
414
*
415
*   DESCRIPTION
416
*
417
*       Testing mcapi_test receiving data using mcapi_msg_recv_i -
418
*       complete.
419
*
420
*           Node 0 - Create endpoint, wait for other side to issue call
421
*                    to receive data, send data to Node 1.
422
*
423
*           Node 1 – Create endpoint, issue receive request, test for
424
*                    completion.
425
*
426
*************************************************************************/
427
MCAPI_THREAD_ENTRY(MCAPI_FTS_Tx_2_33_6)
428
{
429
    MCAPID_STRUCT       *mcapi_struct = (MCAPID_STRUCT*)argv;
430
    char                buffer[MCAPID_MGMT_PKT_LEN];
431
    size_t              rx_len;
432
    mcapi_status_t      status;
433
    mcapi_boolean_t     finished;
434
 
435
    /* Don't let any other test run while this test is running. */
436
    MCAPI_Obtain_Mutex(&MCAPID_FTS_Mutex);
437
 
438
    /* Indicate that a remote endpoint should be created for sending data
439
     * to this node.
440
     */
441
    mcapi_struct->status =
442
        MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_CREATE_ENDP, 1024,
443
                               mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
444
 
445
    /* Wait for a response. */
446
    if (mcapi_struct->status == MCAPI_SUCCESS)
447
    {
448
        /* Wait for the response. */
449
        mcapi_struct->status = MCAPID_RX_Mgmt_Response(mcapi_struct);
450
 
451
        /* If the endpoint was created. */
452
        if (mcapi_struct->status == MCAPI_SUCCESS)
453
        {
454
            /* Make the call to receive the data. */
455
            mcapi_msg_recv_i(mcapi_struct->local_endp, buffer, MCAPID_MGMT_PKT_LEN,
456
                             &mcapi_struct->request, &mcapi_struct->status);
457
 
458
            /* Cause the other side to send data. */
459
            mcapi_struct->status =
460
                MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_TX_BLCK_MSG, 1024,
461
                                       mcapi_struct->local_endp, 1000, MCAPI_DEFAULT_PRIO);
462
 
463
            if (mcapi_struct->status == MCAPI_SUCCESS)
464
            {
465
                /* Wait for the response. */
466
                mcapi_struct->status = MCAPID_RX_Mgmt_Response(mcapi_struct);
467
 
468
                if (mcapi_struct->status == MCAPI_SUCCESS)
469
                {
470
                    /* Test for the data. */
471
                    finished =
472
                        mcapi_test(&mcapi_struct->request, &rx_len, &mcapi_struct->status);
473
 
474
                    if ( (finished != MCAPI_TRUE) ||
475
                         (mcapi_struct->status != MCAPI_SUCCESS) )
476
                    {
477
                        mcapi_struct->status = -1;
478
                    }
479
                }
480
            }
481
 
482
            /* Tell the other side to delete the endpoint. */
483
            status =
484
                MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_DELETE_ENDP, 1024,
485
                                       mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
486
 
487
            if (status == MCAPI_SUCCESS)
488
            {
489
                /* Wait for the response. */
490
                status = MCAPID_RX_Mgmt_Response(mcapi_struct);
491
            }
492
        }
493
    }
494
 
495
    /* Set the state of the test to completed. */
496
    mcapi_struct->state = 0;
497
 
498
    /* Allow the next test to run. */
499
    MCAPI_Release_Mutex(&MCAPID_FTS_Mutex);
500
 
501
} /* MCAPI_FTS_Tx_2_33_6 */
502
 
503
/************************************************************************
504
*
505
*   FUNCTION
506
*
507
*       MCAPI_FTS_Tx_2_33_7
508
*
509
*   DESCRIPTION
510
*
511
*       Testing mcapi_test receiving data using mcapi_msg_recv_i -
512
*       call canceled.
513
*
514
*           Node 0 - Create endpoint, wait for other side to cancel call
515
*                    to receive data, send data to Node 1.
516
*
517
*           Node 1 – Create endpoint, issue receive request, cancel call,
518
*                    test for completion.
519
*
520
*************************************************************************/
521
MCAPI_THREAD_ENTRY(MCAPI_FTS_Tx_2_33_7)
522
{
523
    MCAPID_STRUCT       *mcapi_struct = (MCAPID_STRUCT*)argv;
524
    char                buffer[MCAPID_MGMT_PKT_LEN];
525
    size_t              rx_len;
526
    mcapi_status_t      status;
527
    mcapi_boolean_t     finished;
528
 
529
    /* Don't let any other test run while this test is running. */
530
    MCAPI_Obtain_Mutex(&MCAPID_FTS_Mutex);
531
 
532
    /* Indicate that a remote endpoint should be created for sending data
533
     * to this node.
534
     */
535
    mcapi_struct->status =
536
        MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_CREATE_ENDP, 1024,
537
                               mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
538
 
539
    /* Wait for a response. */
540
    if (mcapi_struct->status == MCAPI_SUCCESS)
541
    {
542
        /* Wait for the response. */
543
        mcapi_struct->status = MCAPID_RX_Mgmt_Response(mcapi_struct);
544
 
545
        /* If the endpoint was created. */
546
        if (mcapi_struct->status == MCAPI_SUCCESS)
547
        {
548
            /* Make the call to receive the data. */
549
            mcapi_msg_recv_i(mcapi_struct->local_endp, buffer, MCAPID_MGMT_PKT_LEN,
550
                             &mcapi_struct->request, &mcapi_struct->status);
551
 
552
            /* Cancel the call. */
553
            mcapi_cancel(&mcapi_struct->request, &mcapi_struct->status);
554
 
555
            /* Cause the other side to send data. */
556
            mcapi_struct->status =
557
                MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_TX_BLCK_MSG, 1024,
558
                                       mcapi_struct->local_endp, 1000, MCAPI_DEFAULT_PRIO);
559
 
560
            if (mcapi_struct->status == MCAPI_SUCCESS)
561
            {
562
                /* Wait for the response. */
563
                mcapi_struct->status = MCAPID_RX_Mgmt_Response(mcapi_struct);
564
 
565
                if (mcapi_struct->status == MCAPI_SUCCESS)
566
                {
567
                    /* Test for the data. */
568
                    finished =
569
                        mcapi_test(&mcapi_struct->request, &rx_len, &mcapi_struct->status);
570
 
571
                    if ( (finished == MCAPI_FALSE) &&
572
                         (mcapi_struct->status == MCAPI_ERR_REQUEST_CANCELLED) )
573
                    {
574
                        mcapi_struct->status = MCAPI_SUCCESS;
575
                    }
576
 
577
                    else
578
                    {
579
                        mcapi_struct->status = -1;
580
                    }
581
                }
582
            }
583
 
584
            /* Tell the other side to delete the endpoint. */
585
            status =
586
                MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_DELETE_ENDP, 1024,
587
                                       mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
588
 
589
            if (status == MCAPI_SUCCESS)
590
            {
591
                /* Wait for the response. */
592
                status = MCAPID_RX_Mgmt_Response(mcapi_struct);
593
            }
594
        }
595
    }
596
 
597
    /* Set the state of the test to completed. */
598
    mcapi_struct->state = 0;
599
 
600
    /* Allow the next test to run. */
601
    MCAPI_Release_Mutex(&MCAPID_FTS_Mutex);
602
 
603
} /* MCAPI_FTS_Tx_2_33_7 */
604
 
605
/************************************************************************
606
*
607
*   FUNCTION
608
*
609
*       MCAPI_FTS_Tx_2_33_8
610
*
611
*   DESCRIPTION
612
*
613
*       Testing mcapi_connect_pktchan_i - completed
614
*
615
*           Node 0 – Create an endpoint
616
*
617
*           Node 1 – Create an endpoint, get the endpoint on Node 0, issue
618
*                    connection, test for completion
619
*
620
*************************************************************************/
621
MCAPI_THREAD_ENTRY(MCAPI_FTS_Tx_2_33_8)
622
{
623
    MCAPID_STRUCT           *mcapi_struct = (MCAPID_STRUCT*)argv;
624
    size_t                  rx_len;
625
    mcapi_status_t          status;
626
    mcapi_endpoint_t        tx_endp, rx_endp;
627
    mcapi_boolean_t         finished;
628
 
629
    /* Don't let any other test run while this test is running. */
630
    MCAPI_Obtain_Mutex(&MCAPID_FTS_Mutex);
631
 
632
    /* An extra endpoint is required for the test. */
633
    rx_endp = mcapi_create_endpoint(MCAPI_PORT_ANY, &mcapi_struct->status);
634
 
635
    if (mcapi_struct->status == MCAPI_SUCCESS)
636
    {
637
        /* Indicate that a remote endpoint should be created. */
638
        mcapi_struct->status =
639
            MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_CREATE_ENDP, 1024,
640
                                   mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
641
 
642
        if (mcapi_struct->status == MCAPI_SUCCESS)
643
        {
644
            /* Wait for a response. */
645
            mcapi_struct->status = MCAPID_RX_Mgmt_Response(mcapi_struct);
646
 
647
            /* If the endpoint was created. */
648
            if (mcapi_struct->status == MCAPI_SUCCESS)
649
            {
650
                /* Get the foreign endpoint. */
651
                tx_endp = mcapi_get_endpoint(FUNC_BACKEND_NODE_ID, 1024, &mcapi_struct->status);
652
 
653
                if (mcapi_struct->status == MCAPI_SUCCESS)
654
                {
655
                    /* Connect the two endpoints. */
656
                    mcapi_connect_pktchan_i(tx_endp, rx_endp,
657
                                            &mcapi_struct->request,
658
                                            &mcapi_struct->status);
659
 
660
                    if (mcapi_struct->status == MCAPI_SUCCESS)
661
                    {
662
                        unsigned long start = MCAPID_Time();
663
 
664
                        for (;;)
665
                        {
666
                            timeout_assert(start, 5);
667
 
668
                            /* The connect call will return successfully. */
669
                            finished =
670
                                mcapi_test(&mcapi_struct->request, &rx_len,
671
                                           &mcapi_struct->status);
672
 
673
                            if (finished == MCAPI_FALSE)
674
                            {
675
                                MCAPID_Sleep(250);
676
                            }
677
 
678
                            else
679
                            {
680
                                if (mcapi_struct->status != MCAPI_SUCCESS)
681
                                {
682
                                    mcapi_struct->status = -1;
683
                                }
684
 
685
                                break;
686
                            }
687
                        }
688
                    }
689
                }
690
 
691
                /* Tell the other side to delete the endpoint. */
692
                status =
693
                    MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_DELETE_ENDP, 1024,
694
                                           mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
695
 
696
                if (status == MCAPI_SUCCESS)
697
                {
698
                    /* Wait for the response. */
699
                    status = MCAPID_RX_Mgmt_Response(mcapi_struct);
700
                }
701
            }
702
        }
703
 
704
        /* Delete the extra endpoint. */
705
        mcapi_delete_endpoint(rx_endp, &status);
706
    }
707
 
708
    /* Set the state of the test to completed. */
709
    mcapi_struct->state = 0;
710
 
711
    /* Allow the next test to run. */
712
    MCAPI_Release_Mutex(&MCAPID_FTS_Mutex);
713
 
714
} /* MCAPI_FTS_Tx_2_33_8 */
715
 
716
/************************************************************************
717
*
718
*   FUNCTION
719
*
720
*       MCAPI_FTS_Tx_2_33_9
721
*
722
*   DESCRIPTION
723
*
724
*       Testing mcapi_test over mcapi_open_pktchan_recv_i - incomplete
725
*
726
*           Node 1 – Create endpoint, open receive side, test for
727
*                    completion.
728
*
729
*************************************************************************/
730
MCAPI_THREAD_ENTRY(MCAPI_FTS_Tx_2_33_9)
731
{
732
    MCAPID_STRUCT       *mcapi_struct = (MCAPID_STRUCT*)argv;
733
    size_t              rx_len;
734
    mcapi_status_t      status;
735
    mcapi_boolean_t     finished;
736
 
737
    /* Don't let any other test run while this test is running. */
738
    MCAPI_Obtain_Mutex(&MCAPID_FTS_Mutex);
739
 
740
    /* Open the receive side. */
741
    mcapi_open_pktchan_recv_i(&mcapi_struct->pkt_rx_handle,
742
                              mcapi_struct->local_endp,
743
                              &mcapi_struct->request,
744
                              &mcapi_struct->status);
745
 
746
    if (mcapi_struct->status == MGC_MCAPI_ERR_NOT_CONNECTED)
747
    {
748
        /* Check for completion. */
749
        finished =
750
            mcapi_test(&mcapi_struct->request, &rx_len, &mcapi_struct->status);
751
 
752
        if ( (mcapi_struct->status == MCAPI_PENDING) &&
753
             (finished == MCAPI_FALSE) )
754
        {
755
            mcapi_struct->status = MCAPI_SUCCESS;
756
        }
757
 
758
        else
759
        {
760
            mcapi_struct->status = -1;
761
        }
762
 
763
        mcapi_cancel(&mcapi_struct->request, &status);
764
    }
765
 
766
    /* Set the state of the test to completed. */
767
    mcapi_struct->state = 0;
768
 
769
    /* Allow the next test to run. */
770
    MCAPI_Release_Mutex(&MCAPID_FTS_Mutex);
771
 
772
} /* MCAPI_FTS_Tx_2_33_9 */
773
 
774
/************************************************************************
775
*
776
*   FUNCTION
777
*
778
*       MCAPI_FTS_Tx_2_33_10
779
*
780
*   DESCRIPTION
781
*
782
*       Testing mcapi_test over mcapi_open_pktchan_recv_i - complete
783
*
784
*           Node 0 - Create endpoint, open send side.
785
*
786
*           Node 1 – Create endpoint, connect, open receive side, test for
787
*                    completion.
788
*
789
*************************************************************************/
790
MCAPI_THREAD_ENTRY(MCAPI_FTS_Tx_2_33_10)
791
{
792
    MCAPID_STRUCT       *mcapi_struct = (MCAPID_STRUCT*)argv;
793
    size_t              rx_len;
794
    mcapi_status_t      status;
795
    mcapi_boolean_t     finished;
796
    mcapi_request_t     request;
797
    mcapi_endpoint_t    tx_endp;
798
 
799
    /* Don't let any other test run while this test is running. */
800
    MCAPI_Obtain_Mutex(&MCAPID_FTS_Mutex);
801
 
802
    /* Indicate that a remote endpoint should be created. */
803
    mcapi_struct->status =
804
        MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_CREATE_ENDP, 1024,
805
                               mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
806
 
807
    if (mcapi_struct->status == MCAPI_SUCCESS)
808
    {
809
        /* Wait for the response. */
810
        mcapi_struct->status = MCAPID_RX_Mgmt_Response(mcapi_struct);
811
 
812
        /* If the endpoint was created. */
813
        if (mcapi_struct->status == MCAPI_SUCCESS)
814
        {
815
            /* Indicate that the endpoint should be opened as a sender. */
816
            mcapi_struct->status =
817
                MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_OPEN_TX_SIDE_PKT,
818
                                       1024, mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
819
 
820
            /* Wait for the response. */
821
            mcapi_struct->status = MCAPID_RX_Mgmt_Response(mcapi_struct);
822
 
823
            if (mcapi_struct->status == MGC_MCAPI_ERR_NOT_CONNECTED)
824
            {
825
                /* Get the foreign endpoint. */
826
                tx_endp = mcapi_get_endpoint(FUNC_BACKEND_NODE_ID, 1024, &mcapi_struct->status);
827
 
828
                if (mcapi_struct->status == MCAPI_SUCCESS)
829
                {
830
                    /* Connect two endpoints. */
831
                    mcapi_connect_pktchan_i(tx_endp, mcapi_struct->local_endp,
832
                                            &mcapi_struct->request,
833
                                            &mcapi_struct->status);
834
 
835
                    if (mcapi_struct->status == MCAPI_SUCCESS)
836
                    {
837
                        unsigned long start = MCAPID_Time();
838
 
839
                        /* Open the receive side. */
840
                        mcapi_open_pktchan_recv_i(&mcapi_struct->pkt_rx_handle,
841
                                                  mcapi_struct->local_endp,
842
                                                  &request, &mcapi_struct->status);
843
 
844
                        for (;;)
845
                        {
846
                            timeout_assert(start, 5);
847
 
848
                            /* Test for the completion. */
849
                            finished =
850
                                mcapi_test(&request, &rx_len, &mcapi_struct->status);
851
 
852
                            if (finished == MCAPI_FALSE)
853
                            {
854
                                MCAPID_Sleep(250);
855
                            }
856
 
857
                            else
858
                            {
859
                                if (mcapi_struct->status != MCAPI_SUCCESS)
860
                                {
861
                                    mcapi_struct->status = -1;
862
                                }
863
 
864
                                break;
865
                            }
866
                        }
867
 
868
                        /* Close the receive side. */
869
                        mcapi_packetchan_recv_close_i(mcapi_struct->pkt_rx_handle,
870
                                                      &request, &status);
871
                    }
872
                }
873
 
874
                /* Tell the other side to close the send side. */
875
                status =
876
                    MCAPID_TX_Mgmt_Message(mcapi_struct,
877
                                           MCAPID_MGMT_CLOSE_TX_SIDE_PKT,
878
                                           1024, mcapi_struct->local_endp,
879
                                           0, MCAPI_DEFAULT_PRIO);
880
 
881
                if (status == MCAPI_SUCCESS)
882
                {
883
                    /* Wait for the response. */
884
                    status = MCAPID_RX_Mgmt_Response(mcapi_struct);
885
                }
886
            }
887
 
888
            /* Tell the other side to delete the endpoint. */
889
            status =
890
                MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_DELETE_ENDP, 1024,
891
                                       mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
892
 
893
            if (status == MCAPI_SUCCESS)
894
            {
895
                /* Wait for the response. */
896
                status = MCAPID_RX_Mgmt_Response(mcapi_struct);
897
            }
898
        }
899
    }
900
 
901
    /* Set the state of the test to completed. */
902
    mcapi_struct->state = 0;
903
 
904
    /* Allow the next test to run. */
905
    MCAPI_Release_Mutex(&MCAPID_FTS_Mutex);
906
 
907
} /* MCAPI_FTS_Tx_2_33_10 */
908
 
909
/************************************************************************
910
*
911
*   FUNCTION
912
*
913
*       MCAPI_FTS_Tx_2_33_11
914
*
915
*   DESCRIPTION
916
*
917
*       Testing mcapi_test over mcapi_open_pktchan_recv_i - canceled
918
*
919
*           Node 1 – Create endpoint, open receive side, cancel, test for
920
*                    completion.
921
*
922
*************************************************************************/
923
MCAPI_THREAD_ENTRY(MCAPI_FTS_Tx_2_33_11)
924
{
925
    MCAPID_STRUCT       *mcapi_struct = (MCAPID_STRUCT*)argv;
926
    size_t              rx_len;
927
    mcapi_boolean_t     finished;
928
 
929
    /* Don't let any other test run while this test is running. */
930
    MCAPI_Obtain_Mutex(&MCAPID_FTS_Mutex);
931
 
932
    /* Open the receive side. */
933
    mcapi_open_pktchan_recv_i(&mcapi_struct->pkt_rx_handle,
934
                              mcapi_struct->local_endp,
935
                              &mcapi_struct->request,
936
                              &mcapi_struct->status);
937
 
938
    if (mcapi_struct->status == MGC_MCAPI_ERR_NOT_CONNECTED)
939
    {
940
        /* Cancel. */
941
        mcapi_cancel(&mcapi_struct->request, &mcapi_struct->status);
942
 
943
        if (mcapi_struct->status == MCAPI_SUCCESS)
944
        {
945
            /* Check for completion. */
946
            finished =
947
                mcapi_test(&mcapi_struct->request, &rx_len, &mcapi_struct->status);
948
 
949
            if ( (mcapi_struct->status == MCAPI_ERR_REQUEST_CANCELLED) &&
950
                 (finished == MCAPI_FALSE) )
951
            {
952
                mcapi_struct->status = MCAPI_SUCCESS;
953
            }
954
 
955
            else
956
            {
957
                mcapi_struct->status = -1;
958
            }
959
        }
960
    }
961
 
962
    /* Set the state of the test to completed. */
963
    mcapi_struct->state = 0;
964
 
965
    /* Allow the next test to run. */
966
    MCAPI_Release_Mutex(&MCAPID_FTS_Mutex);
967
 
968
} /* MCAPI_FTS_Tx_2_33_11 */
969
 
970
/************************************************************************
971
*
972
*   FUNCTION
973
*
974
*       MCAPI_FTS_Tx_2_33_12
975
*
976
*   DESCRIPTION
977
*
978
*       Testing mcapi_test over mcapi_open_pktchan_send_i - incomplete
979
*
980
*           Node 1 – Create endpoint, open send side, test for
981
*                    completion.
982
*
983
*************************************************************************/
984
MCAPI_THREAD_ENTRY(MCAPI_FTS_Tx_2_33_12)
985
{
986
    MCAPID_STRUCT       *mcapi_struct = (MCAPID_STRUCT*)argv;
987
    size_t              rx_len;
988
    mcapi_status_t      status;
989
    mcapi_boolean_t     finished;
990
 
991
    /* Don't let any other test run while this test is running. */
992
    MCAPI_Obtain_Mutex(&MCAPID_FTS_Mutex);
993
 
994
    /* Open the send side. */
995
    mcapi_open_pktchan_send_i(&mcapi_struct->pkt_tx_handle,
996
                              mcapi_struct->local_endp,
997
                              &mcapi_struct->request,
998
                              &mcapi_struct->status);
999
 
1000
    if (mcapi_struct->status == MGC_MCAPI_ERR_NOT_CONNECTED)
1001
    {
1002
        /* Check for completion. */
1003
        finished =
1004
            mcapi_test(&mcapi_struct->request, &rx_len, &mcapi_struct->status);
1005
 
1006
        if ( (mcapi_struct->status == MCAPI_PENDING) &&
1007
             (finished == MCAPI_FALSE) )
1008
        {
1009
            mcapi_struct->status = MCAPI_SUCCESS;
1010
        }
1011
 
1012
        else
1013
        {
1014
            mcapi_struct->status = -1;
1015
        }
1016
 
1017
        mcapi_cancel(&mcapi_struct->request, &status);
1018
    }
1019
 
1020
    /* Set the state of the test to completed. */
1021
    mcapi_struct->state = 0;
1022
 
1023
    /* Allow the next test to run. */
1024
    MCAPI_Release_Mutex(&MCAPID_FTS_Mutex);
1025
 
1026
} /* MCAPI_FTS_Tx_2_33_12 */
1027
 
1028
/************************************************************************
1029
*
1030
*   FUNCTION
1031
*
1032
*       MCAPI_FTS_Tx_2_33_13
1033
*
1034
*   DESCRIPTION
1035
*
1036
*       Testing mcapi_test over mcapi_open_pktchan_send_i - complete
1037
*
1038
*           Node 0 - Create endpoint, open receive side.
1039
*
1040
*           Node 1 – Create endpoint, connect, open send side, test for
1041
*                    completion.
1042
*
1043
*************************************************************************/
1044
MCAPI_THREAD_ENTRY(MCAPI_FTS_Tx_2_33_13)
1045
{
1046
    MCAPID_STRUCT       *mcapi_struct = (MCAPID_STRUCT*)argv;
1047
    size_t              rx_len;
1048
    mcapi_status_t      status;
1049
    mcapi_boolean_t     finished;
1050
    mcapi_request_t     request;
1051
    mcapi_endpoint_t    rx_endp;
1052
 
1053
    /* Don't let any other test run while this test is running. */
1054
    MCAPI_Obtain_Mutex(&MCAPID_FTS_Mutex);
1055
 
1056
    /* Indicate that a remote endpoint should be created. */
1057
    mcapi_struct->status =
1058
        MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_CREATE_ENDP, 1024,
1059
                               mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
1060
 
1061
    if (mcapi_struct->status == MCAPI_SUCCESS)
1062
    {
1063
        /* Wait for the response. */
1064
        mcapi_struct->status = MCAPID_RX_Mgmt_Response(mcapi_struct);
1065
 
1066
        /* If the endpoint was created. */
1067
        if (mcapi_struct->status == MCAPI_SUCCESS)
1068
        {
1069
            /* Indicate that the endpoint should be opened as a receiver. */
1070
            mcapi_struct->status =
1071
                MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_OPEN_RX_SIDE_PKT,
1072
                                       1024, mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
1073
 
1074
            /* Wait for the response. */
1075
            mcapi_struct->status = MCAPID_RX_Mgmt_Response(mcapi_struct);
1076
 
1077
            if (mcapi_struct->status == MGC_MCAPI_ERR_NOT_CONNECTED)
1078
            {
1079
                /* Get the foreign endpoint. */
1080
                rx_endp = mcapi_get_endpoint(FUNC_BACKEND_NODE_ID, 1024, &mcapi_struct->status);
1081
 
1082
                if (mcapi_struct->status == MCAPI_SUCCESS)
1083
                {
1084
                    /* Connect two endpoints. */
1085
                    mcapi_connect_pktchan_i(mcapi_struct->local_endp, rx_endp,
1086
                                            &mcapi_struct->request,
1087
                                            &mcapi_struct->status);
1088
 
1089
                    if (mcapi_struct->status == MCAPI_SUCCESS)
1090
                    {
1091
                        unsigned long start = MCAPID_Time();
1092
 
1093
                        /* Open the send side. */
1094
                        mcapi_open_pktchan_send_i(&mcapi_struct->pkt_tx_handle,
1095
                                                  mcapi_struct->local_endp,
1096
                                                  &request, &mcapi_struct->status);
1097
 
1098
                        for (;;)
1099
                        {
1100
                            timeout_assert(start, 5);
1101
 
1102
                            /* Test for the completion. */
1103
                            finished =
1104
                                mcapi_test(&request, &rx_len, &mcapi_struct->status);
1105
 
1106
                            if (finished == MCAPI_FALSE)
1107
                            {
1108
                                MCAPID_Sleep(250);
1109
                            }
1110
 
1111
                            else
1112
                            {
1113
                                if (mcapi_struct->status != MCAPI_SUCCESS)
1114
                                {
1115
                                    mcapi_struct->status = -1;
1116
                                }
1117
 
1118
                                break;
1119
                            }
1120
                        }
1121
 
1122
                        /* Close the send side. */
1123
                        mcapi_packetchan_send_close_i(mcapi_struct->pkt_tx_handle,
1124
                                                      &request, &status);
1125
                    }
1126
                }
1127
 
1128
                /* Tell the other side to close the receive side. */
1129
                status =
1130
                    MCAPID_TX_Mgmt_Message(mcapi_struct,
1131
                                           MCAPID_MGMT_CLOSE_RX_SIDE_PKT,
1132
                                           1024, mcapi_struct->local_endp,
1133
                                           0, MCAPI_DEFAULT_PRIO);
1134
 
1135
                if (status == MCAPI_SUCCESS)
1136
                {
1137
                    /* Wait for the response. */
1138
                    status = MCAPID_RX_Mgmt_Response(mcapi_struct);
1139
                }
1140
            }
1141
 
1142
            /* Tell the other side to delete the endpoint. */
1143
            status =
1144
                MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_DELETE_ENDP, 1024,
1145
                                       mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
1146
 
1147
            if (status == MCAPI_SUCCESS)
1148
            {
1149
                /* Wait for the response. */
1150
                status = MCAPID_RX_Mgmt_Response(mcapi_struct);
1151
            }
1152
        }
1153
    }
1154
 
1155
    /* Set the state of the test to completed. */
1156
    mcapi_struct->state = 0;
1157
 
1158
    /* Allow the next test to run. */
1159
    MCAPI_Release_Mutex(&MCAPID_FTS_Mutex);
1160
 
1161
} /* MCAPI_FTS_Tx_2_33_13 */
1162
 
1163
/************************************************************************
1164
*
1165
*   FUNCTION
1166
*
1167
*       MCAPI_FTS_Tx_2_33_14
1168
*
1169
*   DESCRIPTION
1170
*
1171
*       Testing mcapi_test over mcapi_open_pktchan_send_i - canceled
1172
*
1173
*           Node 1 – Create endpoint, open send side, cancel, test for
1174
*                    completion.
1175
*
1176
*************************************************************************/
1177
MCAPI_THREAD_ENTRY(MCAPI_FTS_Tx_2_33_14)
1178
{
1179
    MCAPID_STRUCT       *mcapi_struct = (MCAPID_STRUCT*)argv;
1180
    size_t              rx_len;
1181
    mcapi_boolean_t     finished;
1182
 
1183
    /* Don't let any other test run while this test is running. */
1184
    MCAPI_Obtain_Mutex(&MCAPID_FTS_Mutex);
1185
 
1186
    /* Open the send side. */
1187
    mcapi_open_pktchan_send_i(&mcapi_struct->pkt_tx_handle,
1188
                              mcapi_struct->local_endp,
1189
                              &mcapi_struct->request,
1190
                              &mcapi_struct->status);
1191
 
1192
    if (mcapi_struct->status == MGC_MCAPI_ERR_NOT_CONNECTED)
1193
    {
1194
        /* Cancel. */
1195
        mcapi_cancel(&mcapi_struct->request, &mcapi_struct->status);
1196
 
1197
        if (mcapi_struct->status == MCAPI_SUCCESS)
1198
        {
1199
            /* Check for completion. */
1200
            finished =
1201
                mcapi_test(&mcapi_struct->request, &rx_len, &mcapi_struct->status);
1202
 
1203
            if ( (mcapi_struct->status == MCAPI_ERR_REQUEST_CANCELLED) &&
1204
                 (finished == MCAPI_FALSE) )
1205
            {
1206
                mcapi_struct->status = MCAPI_SUCCESS;
1207
            }
1208
 
1209
            else
1210
            {
1211
                mcapi_struct->status = -1;
1212
            }
1213
        }
1214
    }
1215
 
1216
    /* Set the state of the test to completed. */
1217
    mcapi_struct->state = 0;
1218
 
1219
    /* Allow the next test to run. */
1220
    MCAPI_Release_Mutex(&MCAPID_FTS_Mutex);
1221
 
1222
} /* MCAPI_FTS_Tx_2_33_14 */
1223
 
1224
/************************************************************************
1225
*
1226
*   FUNCTION
1227
*
1228
*       MCAPI_FTS_Tx_2_33_15
1229
*
1230
*   DESCRIPTION
1231
*
1232
*       Testing mcapi_test over mcapi_pktchan_send_i - complete
1233
*
1234
*           Node 0 - Create endpoint, open receive side, wait for data.
1235
*
1236
*           Node 1 – Create endpoint, open send side, connect, send data,
1237
*                    test for completion.
1238
*
1239
*************************************************************************/
1240
MCAPI_THREAD_ENTRY(MCAPI_FTS_Tx_2_33_15)
1241
{
1242
    MCAPID_STRUCT       *mcapi_struct = (MCAPID_STRUCT*)argv;
1243
    size_t              rx_len;
1244
    mcapi_boolean_t     finished;
1245
    char                buffer[MCAPID_MSG_LEN];
1246
    mcapi_status_t      status;
1247
 
1248
    /* Don't let any other test run while this test is running. */
1249
    MCAPI_Obtain_Mutex(&MCAPID_FTS_Mutex);
1250
 
1251
    /* Send some data. */
1252
    mcapi_pktchan_send_i(mcapi_struct->pkt_tx_handle, buffer, MCAPID_MSG_LEN,
1253
                         &mcapi_struct->request, &mcapi_struct->status);
1254
 
1255
    if (mcapi_struct->status == MCAPI_SUCCESS)
1256
    {
1257
        /* Check for completion. */
1258
        finished =
1259
            mcapi_test(&mcapi_struct->request, &rx_len, &mcapi_struct->status);
1260
 
1261
        if ( (mcapi_struct->status != MCAPI_SUCCESS) || (rx_len != MCAPID_MSG_LEN) )
1262
        {
1263
            mcapi_struct->status = -1;
1264
        }
1265
    }
1266
 
1267
    /* Close the send side. */
1268
    mcapi_packetchan_send_close_i(mcapi_struct->pkt_tx_handle,
1269
                                  &mcapi_struct->request, &status);
1270
 
1271
    /* Set the state of the test to completed. */
1272
    mcapi_struct->state = 0;
1273
 
1274
    /* Allow the next test to run. */
1275
    MCAPI_Release_Mutex(&MCAPID_FTS_Mutex);
1276
 
1277
} /* MCAPI_FTS_Tx_2_33_15 */
1278
 
1279
/************************************************************************
1280
*
1281
*   FUNCTION
1282
*
1283
*       MCAPI_FTS_Tx_2_33_16
1284
*
1285
*   DESCRIPTION
1286
*
1287
*       Testing mcapi_test over mcapi_pktchan_recv_i - incomplete
1288
*
1289
*           Node 0 - Create endpoint, open send side.
1290
*
1291
*           Node 1 – Create endpoint, connect, open receive side, issue
1292
*                    receive call, test for completion.
1293
*
1294
*************************************************************************/
1295
MCAPI_THREAD_ENTRY(MCAPI_FTS_Tx_2_33_16)
1296
{
1297
    MCAPID_STRUCT       *mcapi_struct = (MCAPID_STRUCT*)argv;
1298
    size_t              rx_len;
1299
    mcapi_status_t      status;
1300
    mcapi_boolean_t     finished;
1301
    mcapi_request_t     request;
1302
    mcapi_endpoint_t    tx_endp;
1303
    char                *buffer;
1304
 
1305
    /* Don't let any other test run while this test is running. */
1306
    MCAPI_Obtain_Mutex(&MCAPID_FTS_Mutex);
1307
 
1308
    /* Indicate that a remote endpoint should be created. */
1309
    mcapi_struct->status =
1310
        MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_CREATE_ENDP, 1024,
1311
                               mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
1312
 
1313
    if (mcapi_struct->status == MCAPI_SUCCESS)
1314
    {
1315
        /* Wait for the response. */
1316
        mcapi_struct->status = MCAPID_RX_Mgmt_Response(mcapi_struct);
1317
 
1318
        /* If the endpoint was created. */
1319
        if (mcapi_struct->status == MCAPI_SUCCESS)
1320
        {
1321
            /* Indicate that the endpoint should be opened as a sender. */
1322
            mcapi_struct->status =
1323
                MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_OPEN_TX_SIDE_PKT,
1324
                                       1024, mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
1325
 
1326
            /* Wait for the response. */
1327
            mcapi_struct->status = MCAPID_RX_Mgmt_Response(mcapi_struct);
1328
 
1329
            if (mcapi_struct->status == MGC_MCAPI_ERR_NOT_CONNECTED)
1330
            {
1331
                /* Get the foreign endpoint. */
1332
                tx_endp = mcapi_get_endpoint(FUNC_BACKEND_NODE_ID, 1024, &mcapi_struct->status);
1333
 
1334
                if (mcapi_struct->status == MCAPI_SUCCESS)
1335
                {
1336
                    /* Connect two endpoints. */
1337
                    mcapi_connect_pktchan_i(tx_endp, mcapi_struct->local_endp,
1338
                                            &mcapi_struct->request,
1339
                                            &mcapi_struct->status);
1340
 
1341
                    if (mcapi_struct->status == MCAPI_SUCCESS)
1342
                    {
1343
                        /* Open the receive side. */
1344
                        mcapi_open_pktchan_recv_i(&mcapi_struct->pkt_rx_handle,
1345
                                                  mcapi_struct->local_endp,
1346
                                                  &request, &mcapi_struct->status);
1347
 
1348
                        /* Wait for the receive side to open. */
1349
                        mcapi_wait(&request, &rx_len, &mcapi_struct->status, MCAPI_FTS_TIMEOUT);
1350
 
1351
                        if (mcapi_struct->status == MCAPI_SUCCESS)
1352
                        {
1353
                            /* Issue a receive call. */
1354
                            mcapi_pktchan_recv_i(mcapi_struct->pkt_rx_handle,
1355
                                                 (void**)&buffer, &mcapi_struct->request,
1356
                                                 &mcapi_struct->status);
1357
 
1358
                            if (mcapi_struct->status == MCAPI_SUCCESS)
1359
                            {
1360
                                /* Test for the completion. */
1361
                                finished = mcapi_test(&mcapi_struct->request, &rx_len,
1362
                                                      &mcapi_struct->status);
1363
 
1364
                                if ( (finished == MCAPI_FALSE) &&
1365
                                     (mcapi_struct->status == MCAPI_PENDING) )
1366
                                {
1367
                                    mcapi_struct->status = MCAPI_SUCCESS;
1368
                                }
1369
 
1370
                                else
1371
                                {
1372
                                    mcapi_struct->status = -1;
1373
                                }
1374
 
1375
                                /* Cancel the receive call. */
1376
                                mcapi_cancel(&mcapi_struct->request, &status);
1377
                            }
1378
 
1379
                            /* Close the receive side. */
1380
                            mcapi_packetchan_recv_close_i(mcapi_struct->pkt_rx_handle,
1381
                                                          &request, &status);
1382
                        }
1383
                    }
1384
                }
1385
 
1386
                /* Tell the other side to close the send side. */
1387
                status =
1388
                    MCAPID_TX_Mgmt_Message(mcapi_struct,
1389
                                           MCAPID_MGMT_CLOSE_TX_SIDE_PKT,
1390
                                           1024, mcapi_struct->local_endp,
1391
                                           0, MCAPI_DEFAULT_PRIO);
1392
 
1393
                if (status == MCAPI_SUCCESS)
1394
                {
1395
                    /* Wait for the response. */
1396
                    status = MCAPID_RX_Mgmt_Response(mcapi_struct);
1397
                }
1398
            }
1399
 
1400
            /* Tell the other side to delete the endpoint. */
1401
            status =
1402
                MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_DELETE_ENDP, 1024,
1403
                                       mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
1404
 
1405
            if (status == MCAPI_SUCCESS)
1406
            {
1407
                /* Wait for the response. */
1408
                status = MCAPID_RX_Mgmt_Response(mcapi_struct);
1409
            }
1410
        }
1411
    }
1412
 
1413
    /* Set the state of the test to completed. */
1414
    mcapi_struct->state = 0;
1415
 
1416
    /* Allow the next test to run. */
1417
    MCAPI_Release_Mutex(&MCAPID_FTS_Mutex);
1418
 
1419
} /* MCAPI_FTS_Tx_2_33_16 */
1420
 
1421
/************************************************************************
1422
*
1423
*   FUNCTION
1424
*
1425
*       MCAPI_FTS_Tx_2_33_17
1426
*
1427
*   DESCRIPTION
1428
*
1429
*       Testing mcapi_test over mcapi_pktchan_recv_i - complete
1430
*
1431
*           Node 0 - Create endpoint, open send side, send data.
1432
*
1433
*           Node 1 – Create endpoint, connect, open receive side, issue
1434
*                    receive call, test for completion.
1435
*
1436
*************************************************************************/
1437
MCAPI_THREAD_ENTRY(MCAPI_FTS_Tx_2_33_17)
1438
{
1439
    MCAPID_STRUCT       *mcapi_struct = (MCAPID_STRUCT*)argv;
1440
    size_t              rx_len;
1441
    mcapi_status_t      status;
1442
    mcapi_boolean_t     finished;
1443
    mcapi_request_t     request;
1444
    mcapi_endpoint_t    tx_endp, rx_endp;
1445
    char                *buffer;
1446
 
1447
    /* Don't let any other test run while this test is running. */
1448
    MCAPI_Obtain_Mutex(&MCAPID_FTS_Mutex);
1449
 
1450
    /* This test requires an extra endpoint. */
1451
    rx_endp = mcapi_create_endpoint(MCAPI_PORT_ANY, &mcapi_struct->status);
1452
 
1453
    if (mcapi_struct->status == MCAPI_SUCCESS)
1454
    {
1455
        /* Indicate that a remote endpoint should be created. */
1456
        mcapi_struct->status =
1457
            MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_CREATE_ENDP, 1024,
1458
                                   mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
1459
 
1460
        if (mcapi_struct->status == MCAPI_SUCCESS)
1461
        {
1462
            /* Wait for the response. */
1463
            mcapi_struct->status = MCAPID_RX_Mgmt_Response(mcapi_struct);
1464
 
1465
            /* If the endpoint was created. */
1466
            if (mcapi_struct->status == MCAPI_SUCCESS)
1467
            {
1468
                /* Indicate that the endpoint should be opened as a sender. */
1469
                mcapi_struct->status =
1470
                    MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_OPEN_TX_SIDE_PKT,
1471
                                           1024, mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
1472
 
1473
                /* Wait for the response. */
1474
                mcapi_struct->status = MCAPID_RX_Mgmt_Response(mcapi_struct);
1475
 
1476
                if (mcapi_struct->status == MGC_MCAPI_ERR_NOT_CONNECTED)
1477
                {
1478
                    /* Get the foreign endpoint. */
1479
                    tx_endp = mcapi_get_endpoint(FUNC_BACKEND_NODE_ID, 1024, &mcapi_struct->status);
1480
 
1481
                    if (mcapi_struct->status == MCAPI_SUCCESS)
1482
                    {
1483
                        /* Connect two endpoints. */
1484
                        mcapi_connect_pktchan_i(tx_endp, rx_endp,
1485
                                                &mcapi_struct->request,
1486
                                                &mcapi_struct->status);
1487
 
1488
                        if (mcapi_struct->status == MCAPI_SUCCESS)
1489
                        {
1490
                            mcapi_wait(&mcapi_struct->request, &rx_len,
1491
                                       &mcapi_struct->status, MCAPI_FTS_TIMEOUT);
1492
 
1493
                            /* Open the receive side. */
1494
                            mcapi_open_pktchan_recv_i(&mcapi_struct->pkt_rx_handle,
1495
                                                      rx_endp, &request,
1496
                                                      &mcapi_struct->status);
1497
 
1498
                            /* Wait for the receive side to open. */
1499
                            mcapi_wait(&request, &rx_len, &mcapi_struct->status,
1500
                                       MCAPI_FTS_TIMEOUT);
1501
 
1502
                            if (mcapi_struct->status == MCAPI_SUCCESS)
1503
                            {
1504
                                /* Issue a receive call. */
1505
                                mcapi_pktchan_recv_i(mcapi_struct->pkt_rx_handle,
1506
                                                     (void**)&buffer,
1507
                                                     &mcapi_struct->request,
1508
                                                     &mcapi_struct->status);
1509
 
1510
                                if (mcapi_struct->status == MCAPI_SUCCESS)
1511
                                {
1512
                                    /* Tell the other side to send some data. */
1513
                                    mcapi_struct->status =
1514
                                        MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_TX_PKT,
1515
                                                               1024, mcapi_struct->local_endp,
1516
                                                               0, MCAPI_DEFAULT_PRIO);
1517
 
1518
                                    if (mcapi_struct->status == MCAPI_SUCCESS)
1519
                                    {
1520
                                        /* Wait for the response. */
1521
                                        mcapi_struct->status =
1522
                                            MCAPID_RX_Mgmt_Response(mcapi_struct);
1523
 
1524
                                        if (mcapi_struct->status == MCAPI_SUCCESS)
1525
                                        {
1526
                                            /* Test for the completion. */
1527
                                            finished = mcapi_test(&mcapi_struct->request,
1528
                                                                  &rx_len,
1529
                                                                  &mcapi_struct->status);
1530
 
1531
                                            if ( (finished != MCAPI_TRUE) ||
1532
                                                 (mcapi_struct->status != MCAPI_SUCCESS) )
1533
                                            {
1534
                                                mcapi_struct->status = -1;
1535
                                            }
1536
 
1537
                                            /* The buffer must be freed. */
1538
                                            else
1539
                                            {
1540
                                                mcapi_pktchan_free(buffer, &status);
1541
                                            }
1542
                                        }
1543
                                    }
1544
                                }
1545
 
1546
                                /* Close the receive side. */
1547
                                mcapi_packetchan_recv_close_i(mcapi_struct->pkt_rx_handle,
1548
                                                              &request, &status);
1549
                            }
1550
                        }
1551
                    }
1552
 
1553
                    /* Tell the other side to close the send side. */
1554
                    status =
1555
                        MCAPID_TX_Mgmt_Message(mcapi_struct,
1556
                                               MCAPID_MGMT_CLOSE_TX_SIDE_PKT,
1557
                                               1024, mcapi_struct->local_endp,
1558
                                               0, MCAPI_DEFAULT_PRIO);
1559
 
1560
                    if (status == MCAPI_SUCCESS)
1561
                    {
1562
                        /* Wait for the response. */
1563
                        status = MCAPID_RX_Mgmt_Response(mcapi_struct);
1564
                    }
1565
                }
1566
 
1567
                /* Tell the other side to delete the endpoint. */
1568
                status =
1569
                    MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_DELETE_ENDP, 1024,
1570
                                           mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
1571
 
1572
                if (status == MCAPI_SUCCESS)
1573
                {
1574
                    /* Wait for the response. */
1575
                    status = MCAPID_RX_Mgmt_Response(mcapi_struct);
1576
                }
1577
            }
1578
        }
1579
 
1580
        /* Delete the extra endpoint. */
1581
        mcapi_delete_endpoint(rx_endp, &status);
1582
    }
1583
 
1584
    /* Set the state of the test to completed. */
1585
    mcapi_struct->state = 0;
1586
 
1587
    /* Allow the next test to run. */
1588
    MCAPI_Release_Mutex(&MCAPID_FTS_Mutex);
1589
 
1590
} /* MCAPI_FTS_Tx_2_33_17 */
1591
 
1592
/************************************************************************
1593
*
1594
*   FUNCTION
1595
*
1596
*       MCAPI_FTS_Tx_2_33_18
1597
*
1598
*   DESCRIPTION
1599
*
1600
*       Testing mcapi_test over mcapi_pktchan_recv_i - complete
1601
*
1602
*           Node 0 - Create endpoint, open send side.
1603
*
1604
*           Node 1 – Create endpoint, connect, open receive side, issue
1605
*                    receive call, cancel receive call, test for completion.
1606
*
1607
*************************************************************************/
1608
MCAPI_THREAD_ENTRY(MCAPI_FTS_Tx_2_33_18)
1609
{
1610
    MCAPID_STRUCT       *mcapi_struct = (MCAPID_STRUCT*)argv;
1611
    size_t              rx_len;
1612
    mcapi_status_t      status;
1613
    mcapi_boolean_t     finished;
1614
    mcapi_request_t     request;
1615
    mcapi_endpoint_t    tx_endp, rx_endp;
1616
    char                *buffer;
1617
 
1618
    /* Don't let any other test run while this test is running. */
1619
    MCAPI_Obtain_Mutex(&MCAPID_FTS_Mutex);
1620
 
1621
    /* This test requires an extra endpoint. */
1622
    rx_endp = mcapi_create_endpoint(MCAPI_PORT_ANY, &mcapi_struct->status);
1623
 
1624
    if (mcapi_struct->status == MCAPI_SUCCESS)
1625
    {
1626
        /* Indicate that a remote endpoint should be created. */
1627
        mcapi_struct->status =
1628
            MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_CREATE_ENDP, 1024,
1629
                                   mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
1630
 
1631
        if (mcapi_struct->status == MCAPI_SUCCESS)
1632
        {
1633
            /* Wait for the response. */
1634
            mcapi_struct->status = MCAPID_RX_Mgmt_Response(mcapi_struct);
1635
 
1636
            /* If the endpoint was created. */
1637
            if (mcapi_struct->status == MCAPI_SUCCESS)
1638
            {
1639
                /* Indicate that the endpoint should be opened as a sender. */
1640
                mcapi_struct->status =
1641
                    MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_OPEN_TX_SIDE_PKT,
1642
                                           1024, mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
1643
 
1644
                /* Wait for the response. */
1645
                mcapi_struct->status = MCAPID_RX_Mgmt_Response(mcapi_struct);
1646
 
1647
                if (mcapi_struct->status == MGC_MCAPI_ERR_NOT_CONNECTED)
1648
                {
1649
                    /* Get the foreign endpoint. */
1650
                    tx_endp = mcapi_get_endpoint(FUNC_BACKEND_NODE_ID, 1024, &mcapi_struct->status);
1651
 
1652
                    if (mcapi_struct->status == MCAPI_SUCCESS)
1653
                    {
1654
                        /* Connect two endpoints. */
1655
                        mcapi_connect_pktchan_i(tx_endp, rx_endp,
1656
                                                &mcapi_struct->request,
1657
                                                &mcapi_struct->status);
1658
 
1659
                        if (mcapi_struct->status == MCAPI_SUCCESS)
1660
                        {
1661
                            mcapi_wait(&mcapi_struct->request, &rx_len,
1662
                                       &mcapi_struct->status, MCAPI_FTS_TIMEOUT);
1663
 
1664
                            /* Open the receive side. */
1665
                            mcapi_open_pktchan_recv_i(&mcapi_struct->pkt_rx_handle,
1666
                                                      rx_endp, &request,
1667
                                                      &mcapi_struct->status);
1668
 
1669
                            /* Wait for the receive side to open. */
1670
                            mcapi_wait(&request, &rx_len, &mcapi_struct->status,
1671
                                       MCAPI_FTS_TIMEOUT);
1672
 
1673
                            if (mcapi_struct->status == MCAPI_SUCCESS)
1674
                            {
1675
                                /* Issue a receive call. */
1676
                                mcapi_pktchan_recv_i(mcapi_struct->pkt_rx_handle,
1677
                                                     (void**)&buffer,
1678
                                                     &mcapi_struct->request,
1679
                                                     &mcapi_struct->status);
1680
 
1681
                                if (mcapi_struct->status == MCAPI_SUCCESS)
1682
                                {
1683
                                    /* Cancel the receive call. */
1684
                                    mcapi_cancel(&mcapi_struct->request,
1685
                                                 &mcapi_struct->status);
1686
 
1687
                                    if (mcapi_struct->status == MCAPI_SUCCESS)
1688
                                    {
1689
                                        /* Test for the completion. */
1690
                                        finished = mcapi_test(&mcapi_struct->request,
1691
                                                              &rx_len,
1692
                                                              &mcapi_struct->status);
1693
 
1694
                                        if ( (finished != MCAPI_FALSE) ||
1695
                                             (mcapi_struct->status != MCAPI_ERR_REQUEST_CANCELLED) )
1696
                                        {
1697
                                            mcapi_struct->status = -1;
1698
                                        }
1699
 
1700
                                        else
1701
                                        {
1702
                                            mcapi_struct->status = MCAPI_SUCCESS;
1703
                                        }
1704
                                    }
1705
                                }
1706
 
1707
                                /* Close the receive side. */
1708
                                mcapi_packetchan_recv_close_i(mcapi_struct->pkt_rx_handle,
1709
                                                              &request, &status);
1710
                            }
1711
                        }
1712
                    }
1713
 
1714
                    /* Tell the other side to close the send side. */
1715
                    status =
1716
                        MCAPID_TX_Mgmt_Message(mcapi_struct,
1717
                                               MCAPID_MGMT_CLOSE_TX_SIDE_PKT,
1718
                                               1024, mcapi_struct->local_endp,
1719
                                               0, MCAPI_DEFAULT_PRIO);
1720
 
1721
                    if (status == MCAPI_SUCCESS)
1722
                    {
1723
                        /* Wait for the response. */
1724
                        status = MCAPID_RX_Mgmt_Response(mcapi_struct);
1725
                    }
1726
                }
1727
 
1728
                /* Tell the other side to delete the endpoint. */
1729
                status =
1730
                    MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_DELETE_ENDP, 1024,
1731
                                           mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
1732
 
1733
                if (status == MCAPI_SUCCESS)
1734
                {
1735
                    /* Wait for the response. */
1736
                    status = MCAPID_RX_Mgmt_Response(mcapi_struct);
1737
                }
1738
            }
1739
        }
1740
 
1741
        /* Delete the extra endpoint. */
1742
        mcapi_delete_endpoint(rx_endp, &status);
1743
    }
1744
 
1745
    /* Set the state of the test to completed. */
1746
    mcapi_struct->state = 0;
1747
 
1748
    /* Allow the next test to run. */
1749
    MCAPI_Release_Mutex(&MCAPID_FTS_Mutex);
1750
 
1751
} /* MCAPI_FTS_Tx_2_33_18 */
1752
 
1753
/************************************************************************
1754
*
1755
*   FUNCTION
1756
*
1757
*       MCAPI_FTS_Tx_2_33_19
1758
*
1759
*   DESCRIPTION
1760
*
1761
*       Testing mcapi_test over mcapi_pktchan_recv_close_i - tx not
1762
*       opened, not connected
1763
*
1764
*           Node 1 – Create endpoint, open receive side, close receive
1765
*                    side, test for completion.
1766
*
1767
*************************************************************************/
1768
MCAPI_THREAD_ENTRY(MCAPI_FTS_Tx_2_33_19)
1769
{
1770
    MCAPID_STRUCT       *mcapi_struct = (MCAPID_STRUCT*)argv;
1771
    size_t              rx_len;
1772
    mcapi_boolean_t     finished;
1773
    mcapi_request_t     request;
1774
 
1775
    /* Don't let any other test run while this test is running. */
1776
    MCAPI_Obtain_Mutex(&MCAPID_FTS_Mutex);
1777
 
1778
    /* Open the receive side. */
1779
    mcapi_open_pktchan_recv_i(&mcapi_struct->pkt_rx_handle,
1780
                              mcapi_struct->local_endp,
1781
                              &mcapi_struct->request,
1782
                              &mcapi_struct->status);
1783
 
1784
    if (mcapi_struct->status == MGC_MCAPI_ERR_NOT_CONNECTED)
1785
    {
1786
        /* Close the receive side. */
1787
        mcapi_packetchan_recv_close_i(mcapi_struct->pkt_rx_handle,
1788
                                      &request, &mcapi_struct->status);
1789
 
1790
        if (mcapi_struct->status == MCAPI_SUCCESS)
1791
        {
1792
            /* Test for the completion. */
1793
            finished = mcapi_test(&request, &rx_len, &mcapi_struct->status);
1794
 
1795
            if ( (finished != MCAPI_TRUE) ||
1796
                 (mcapi_struct->status != MCAPI_SUCCESS) )
1797
            {
1798
                mcapi_struct->status = -1;
1799
            }
1800
        }
1801
    }
1802
 
1803
    /* Set the state of the test to completed. */
1804
    mcapi_struct->state = 0;
1805
 
1806
    /* Allow the next test to run. */
1807
    MCAPI_Release_Mutex(&MCAPID_FTS_Mutex);
1808
 
1809
} /* MCAPI_FTS_Tx_2_33_19 */
1810
 
1811
/************************************************************************
1812
*
1813
*   FUNCTION
1814
*
1815
*       MCAPI_FTS_Tx_2_33_20
1816
*
1817
*   DESCRIPTION
1818
*
1819
*       Testing mcapi_test over mcapi_pktchan_recv_close_i - tx opened,
1820
*       not connected
1821
*
1822
*           Node 0 - Create endpoint, open send side
1823
*
1824
*           Node 1 – Create endpoint, open receive side, wait for Node 0 to
1825
*                    open send side, test for completion.
1826
*
1827
*************************************************************************/
1828
MCAPI_THREAD_ENTRY(MCAPI_FTS_Tx_2_33_20)
1829
{
1830
    MCAPID_STRUCT       *mcapi_struct = (MCAPID_STRUCT*)argv;
1831
    size_t              rx_len;
1832
    mcapi_status_t      status;
1833
    mcapi_boolean_t     finished;
1834
    mcapi_request_t     request;
1835
 
1836
    /* Don't let any other test run while this test is running. */
1837
    MCAPI_Obtain_Mutex(&MCAPID_FTS_Mutex);
1838
 
1839
    /* Indicate that a remote endpoint should be created. */
1840
    mcapi_struct->status =
1841
        MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_CREATE_ENDP, 1024,
1842
                               mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
1843
 
1844
    if (mcapi_struct->status == MCAPI_SUCCESS)
1845
    {
1846
        /* Wait for the response. */
1847
        mcapi_struct->status = MCAPID_RX_Mgmt_Response(mcapi_struct);
1848
 
1849
        /* If the endpoint was created. */
1850
        if (mcapi_struct->status == MCAPI_SUCCESS)
1851
        {
1852
            /* Indicate that the endpoint should be opened as a sender. */
1853
            mcapi_struct->status =
1854
                MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_OPEN_TX_SIDE_PKT,
1855
                                       1024, mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
1856
 
1857
            /* Wait for the response. */
1858
            mcapi_struct->status = MCAPID_RX_Mgmt_Response(mcapi_struct);
1859
 
1860
            if (mcapi_struct->status == MGC_MCAPI_ERR_NOT_CONNECTED)
1861
            {
1862
                /* Open the receive side. */
1863
                mcapi_open_pktchan_recv_i(&mcapi_struct->pkt_rx_handle,
1864
                                          mcapi_struct->local_endp,
1865
                                          &mcapi_struct->request,
1866
                                          &mcapi_struct->status);
1867
 
1868
                if (mcapi_struct->status == MGC_MCAPI_ERR_NOT_CONNECTED)
1869
                {
1870
                    /* Close the receive side. */
1871
                    mcapi_packetchan_recv_close_i(mcapi_struct->pkt_rx_handle,
1872
                                                  &request, &mcapi_struct->status);
1873
 
1874
                    if (mcapi_struct->status == MCAPI_SUCCESS)
1875
                    {
1876
                        /* Test for the completion. */
1877
                        finished = mcapi_test(&request, &rx_len,
1878
                                              &mcapi_struct->status);
1879
 
1880
                        if ( (finished != MCAPI_TRUE) ||
1881
                             (mcapi_struct->status != MCAPI_SUCCESS) )
1882
                        {
1883
                            mcapi_struct->status = -1;
1884
                        }
1885
                    }
1886
                }
1887
 
1888
                /* Tell the other side to close the send side. */
1889
                status =
1890
                    MCAPID_TX_Mgmt_Message(mcapi_struct,
1891
                                           MCAPID_MGMT_CLOSE_TX_SIDE_PKT,
1892
                                           1024, mcapi_struct->local_endp,
1893
                                           0, MCAPI_DEFAULT_PRIO);
1894
 
1895
                if (status == MCAPI_SUCCESS)
1896
                {
1897
                    /* Wait for the response. */
1898
                    status = MCAPID_RX_Mgmt_Response(mcapi_struct);
1899
                }
1900
            }
1901
 
1902
            /* Tell the other side to delete the endpoint. */
1903
            status =
1904
                MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_DELETE_ENDP, 1024,
1905
                                       mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
1906
 
1907
            if (status == MCAPI_SUCCESS)
1908
            {
1909
                /* Wait for the response. */
1910
                status = MCAPID_RX_Mgmt_Response(mcapi_struct);
1911
            }
1912
        }
1913
    }
1914
 
1915
    /* Set the state of the test to completed. */
1916
    mcapi_struct->state = 0;
1917
 
1918
    /* Allow the next test to run. */
1919
    MCAPI_Release_Mutex(&MCAPID_FTS_Mutex);
1920
 
1921
} /* MCAPI_FTS_Tx_2_33_20 */
1922
 
1923
/************************************************************************
1924
*
1925
*   FUNCTION
1926
*
1927
*       MCAPI_FTS_Tx_2_33_21
1928
*
1929
*   DESCRIPTION
1930
*
1931
*       Testing mcapi_test over mcapi_pktchan_recv_close_i - tx opened,
1932
*       connected
1933
*
1934
*           Node 0 - Create endpoint, open send side
1935
*
1936
*           Node 1 – Create endpoint, issue connection, open receive side,
1937
*                    test for completion.
1938
*
1939
*************************************************************************/
1940
MCAPI_THREAD_ENTRY(MCAPI_FTS_Tx_2_33_21)
1941
{
1942
    MCAPID_STRUCT       *mcapi_struct = (MCAPID_STRUCT*)argv;
1943
    size_t              rx_len;
1944
    mcapi_status_t      status;
1945
    mcapi_boolean_t     finished;
1946
    mcapi_request_t     request;
1947
    mcapi_endpoint_t    tx_endp;
1948
 
1949
    /* Don't let any other test run while this test is running. */
1950
    MCAPI_Obtain_Mutex(&MCAPID_FTS_Mutex);
1951
 
1952
    /* Indicate that a remote endpoint should be created. */
1953
    mcapi_struct->status =
1954
        MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_CREATE_ENDP, 1024,
1955
                               mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
1956
 
1957
    if (mcapi_struct->status == MCAPI_SUCCESS)
1958
    {
1959
        /* Wait for the response. */
1960
        mcapi_struct->status = MCAPID_RX_Mgmt_Response(mcapi_struct);
1961
 
1962
        /* If the endpoint was created. */
1963
        if (mcapi_struct->status == MCAPI_SUCCESS)
1964
        {
1965
            /* Indicate that the endpoint should be opened as a sender. */
1966
            mcapi_struct->status =
1967
                MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_OPEN_TX_SIDE_PKT,
1968
                                       1024, mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
1969
 
1970
            /* Wait for the response. */
1971
            mcapi_struct->status = MCAPID_RX_Mgmt_Response(mcapi_struct);
1972
 
1973
            if (mcapi_struct->status == MGC_MCAPI_ERR_NOT_CONNECTED)
1974
            {
1975
                /* Get the send side endpoint. */
1976
                tx_endp = mcapi_get_endpoint(FUNC_BACKEND_NODE_ID, 1024, &mcapi_struct->status);
1977
 
1978
                if (mcapi_struct->status == MCAPI_SUCCESS)
1979
                {
1980
                    /* Connect the two endpoints. */
1981
                    mcapi_connect_pktchan_i(tx_endp, mcapi_struct->local_endp,
1982
                                            &mcapi_struct->request,
1983
                                            &mcapi_struct->status);
1984
 
1985
                    if (mcapi_struct->status == MCAPI_SUCCESS)
1986
                    {
1987
                        /* Wait for the connection to open. */
1988
                        mcapi_wait(&mcapi_struct->request, &rx_len, &mcapi_struct->status,
1989
                                   MCAPI_FTS_TIMEOUT);
1990
 
1991
                        if (mcapi_struct->status == MCAPI_SUCCESS)
1992
                        {
1993
                            /* Open the receive side. */
1994
                            mcapi_open_pktchan_recv_i(&mcapi_struct->pkt_rx_handle,
1995
                                                      mcapi_struct->local_endp,
1996
                                                      &request, &mcapi_struct->status);
1997
 
1998
                            if (mcapi_struct->status == MCAPI_SUCCESS)
1999
                            {
2000
                                /* Wait for the receive side to open. */
2001
                                mcapi_wait(&request, &rx_len, &mcapi_struct->status,
2002
                                           MCAPI_FTS_TIMEOUT);
2003
 
2004
                                if (mcapi_struct->status == MCAPI_SUCCESS)
2005
                                {
2006
                                    /* Close the receive side. */
2007
                                    mcapi_packetchan_recv_close_i(mcapi_struct->pkt_rx_handle,
2008
                                                                  &request, &mcapi_struct->status);
2009
 
2010
                                    if (mcapi_struct->status == MCAPI_SUCCESS)
2011
                                    {
2012
                                        /* Test for the completion. */
2013
                                        finished = mcapi_test(&request, &rx_len,
2014
                                                              &mcapi_struct->status);
2015
 
2016
                                        if ( (finished != MCAPI_TRUE) ||
2017
                                             (mcapi_struct->status != MCAPI_SUCCESS) )
2018
                                        {
2019
                                            mcapi_struct->status = -1;
2020
                                        }
2021
                                    }
2022
                                }
2023
                            }
2024
                        }
2025
                    }
2026
                }
2027
 
2028
                /* Tell the other side to close the send side. */
2029
                status =
2030
                    MCAPID_TX_Mgmt_Message(mcapi_struct,
2031
                                           MCAPID_MGMT_CLOSE_TX_SIDE_PKT,
2032
                                           1024, mcapi_struct->local_endp,
2033
                                           0, MCAPI_DEFAULT_PRIO);
2034
 
2035
                if (status == MCAPI_SUCCESS)
2036
                {
2037
                    /* Wait for the response. */
2038
                    status = MCAPID_RX_Mgmt_Response(mcapi_struct);
2039
                }
2040
            }
2041
 
2042
            /* Tell the other side to delete the endpoint. */
2043
            status =
2044
                MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_DELETE_ENDP, 1024,
2045
                                       mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
2046
 
2047
            if (status == MCAPI_SUCCESS)
2048
            {
2049
                /* Wait for the response. */
2050
                status = MCAPID_RX_Mgmt_Response(mcapi_struct);
2051
            }
2052
        }
2053
    }
2054
 
2055
    /* Set the state of the test to completed. */
2056
    mcapi_struct->state = 0;
2057
 
2058
    /* Allow the next test to run. */
2059
    MCAPI_Release_Mutex(&MCAPID_FTS_Mutex);
2060
 
2061
} /* MCAPI_FTS_Tx_2_33_21 */
2062
 
2063
/************************************************************************
2064
*
2065
*   FUNCTION
2066
*
2067
*       MCAPI_FTS_Tx_2_33_22
2068
*
2069
*   DESCRIPTION
2070
*
2071
*       Testing mcapi_test over mcapi_pktchan_send_close_i - rx not
2072
*       opened, not connected
2073
*
2074
*           Node 1 – Create endpoint, open send side, close send
2075
*                    side, test for completion.
2076
*
2077
*************************************************************************/
2078
MCAPI_THREAD_ENTRY(MCAPI_FTS_Tx_2_33_22)
2079
{
2080
    MCAPID_STRUCT       *mcapi_struct = (MCAPID_STRUCT*)argv;
2081
    size_t              rx_len;
2082
    mcapi_boolean_t     finished;
2083
    mcapi_request_t     request;
2084
 
2085
    /* Don't let any other test run while this test is running. */
2086
    MCAPI_Obtain_Mutex(&MCAPID_FTS_Mutex);
2087
 
2088
    /* Open the send side. */
2089
    mcapi_open_pktchan_send_i(&mcapi_struct->pkt_tx_handle,
2090
                              mcapi_struct->local_endp,
2091
                              &mcapi_struct->request,
2092
                              &mcapi_struct->status);
2093
 
2094
    if (mcapi_struct->status == MGC_MCAPI_ERR_NOT_CONNECTED)
2095
    {
2096
        /* Close the send side. */
2097
        mcapi_packetchan_send_close_i(mcapi_struct->pkt_tx_handle,
2098
                                      &request, &mcapi_struct->status);
2099
 
2100
        if (mcapi_struct->status == MCAPI_SUCCESS)
2101
        {
2102
            /* Test for the completion. */
2103
            finished = mcapi_test(&request, &rx_len, &mcapi_struct->status);
2104
 
2105
            if ( (finished != MCAPI_TRUE) ||
2106
                 (mcapi_struct->status != MCAPI_SUCCESS) )
2107
            {
2108
                mcapi_struct->status = -1;
2109
            }
2110
        }
2111
    }
2112
 
2113
    /* Set the state of the test to completed. */
2114
    mcapi_struct->state = 0;
2115
 
2116
    /* Allow the next test to run. */
2117
    MCAPI_Release_Mutex(&MCAPID_FTS_Mutex);
2118
 
2119
} /* MCAPI_FTS_Tx_2_33_22 */
2120
 
2121
/************************************************************************
2122
*
2123
*   FUNCTION
2124
*
2125
*       MCAPI_FTS_Tx_2_33_23
2126
*
2127
*   DESCRIPTION
2128
*
2129
*       Testing mcapi_test over mcapi_pktchan_send_close_i - rx opened,
2130
*       not connected
2131
*
2132
*           Node 0 - Create endpoint, open receive side
2133
*
2134
*           Node 1 – Create endpoint, open send side, wait for Node 0 to
2135
*                    open receive side, test for completion.
2136
*
2137
*************************************************************************/
2138
MCAPI_THREAD_ENTRY(MCAPI_FTS_Tx_2_33_23)
2139
{
2140
    MCAPID_STRUCT       *mcapi_struct = (MCAPID_STRUCT*)argv;
2141
    size_t              rx_len;
2142
    mcapi_status_t      status;
2143
    mcapi_boolean_t     finished;
2144
    mcapi_request_t     request;
2145
 
2146
    /* Don't let any other test run while this test is running. */
2147
    MCAPI_Obtain_Mutex(&MCAPID_FTS_Mutex);
2148
 
2149
    /* Indicate that a remote endpoint should be created. */
2150
    mcapi_struct->status =
2151
        MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_CREATE_ENDP, 1024,
2152
                               mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
2153
 
2154
    if (mcapi_struct->status == MCAPI_SUCCESS)
2155
    {
2156
        /* Wait for the response. */
2157
        mcapi_struct->status = MCAPID_RX_Mgmt_Response(mcapi_struct);
2158
 
2159
        /* If the endpoint was created. */
2160
        if (mcapi_struct->status == MCAPI_SUCCESS)
2161
        {
2162
            /* Indicate that the endpoint should be opened as a receiver. */
2163
            mcapi_struct->status =
2164
                MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_OPEN_RX_SIDE_PKT,
2165
                                       1024, mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
2166
 
2167
            /* Wait for the response. */
2168
            mcapi_struct->status = MCAPID_RX_Mgmt_Response(mcapi_struct);
2169
 
2170
            if (mcapi_struct->status == MGC_MCAPI_ERR_NOT_CONNECTED)
2171
            {
2172
                /* Open the send side. */
2173
                mcapi_open_pktchan_send_i(&mcapi_struct->pkt_tx_handle,
2174
                                          mcapi_struct->local_endp,
2175
                                          &mcapi_struct->request,
2176
                                          &mcapi_struct->status);
2177
 
2178
                if (mcapi_struct->status == MGC_MCAPI_ERR_NOT_CONNECTED)
2179
                {
2180
                    /* Close the send side. */
2181
                    mcapi_packetchan_send_close_i(mcapi_struct->pkt_tx_handle,
2182
                                                  &request, &mcapi_struct->status);
2183
 
2184
                    if (mcapi_struct->status == MCAPI_SUCCESS)
2185
                    {
2186
                        /* Test for the completion. */
2187
                        finished = mcapi_test(&request, &rx_len,
2188
                                              &mcapi_struct->status);
2189
 
2190
                        if ( (finished != MCAPI_TRUE) ||
2191
                             (mcapi_struct->status != MCAPI_SUCCESS) )
2192
                        {
2193
                            mcapi_struct->status = -1;
2194
                        }
2195
                    }
2196
                }
2197
 
2198
                /* Tell the other side to close the receive side. */
2199
                status =
2200
                    MCAPID_TX_Mgmt_Message(mcapi_struct,
2201
                                           MCAPID_MGMT_CLOSE_RX_SIDE_PKT,
2202
                                           1024, mcapi_struct->local_endp,
2203
                                           0, MCAPI_DEFAULT_PRIO);
2204
 
2205
                if (status == MCAPI_SUCCESS)
2206
                {
2207
                    /* Wait for the response. */
2208
                    status = MCAPID_RX_Mgmt_Response(mcapi_struct);
2209
                }
2210
            }
2211
 
2212
            /* Tell the other side to delete the endpoint. */
2213
            status =
2214
                MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_DELETE_ENDP, 1024,
2215
                                       mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
2216
 
2217
            if (status == MCAPI_SUCCESS)
2218
            {
2219
                /* Wait for the response. */
2220
                status = MCAPID_RX_Mgmt_Response(mcapi_struct);
2221
            }
2222
        }
2223
    }
2224
 
2225
    /* Set the state of the test to completed. */
2226
    mcapi_struct->state = 0;
2227
 
2228
    /* Allow the next test to run. */
2229
    MCAPI_Release_Mutex(&MCAPID_FTS_Mutex);
2230
 
2231
} /* MCAPI_FTS_Tx_2_33_23 */
2232
 
2233
/************************************************************************
2234
*
2235
*   FUNCTION
2236
*
2237
*       MCAPI_FTS_Tx_2_33_24
2238
*
2239
*   DESCRIPTION
2240
*
2241
*       Testing mcapi_test over mcapi_pktchan_send_close_i - rx opened,
2242
*       connected
2243
*
2244
*           Node 0 - Create endpoint, open receive side
2245
*
2246
*           Node 1 – Create endpoint, issue connection, open send side,
2247
*                    test for completion.
2248
*
2249
*************************************************************************/
2250
MCAPI_THREAD_ENTRY(MCAPI_FTS_Tx_2_33_24)
2251
{
2252
    MCAPID_STRUCT       *mcapi_struct = (MCAPID_STRUCT*)argv;
2253
    size_t              rx_len;
2254
    mcapi_status_t      status;
2255
    mcapi_boolean_t     finished;
2256
    mcapi_request_t     request;
2257
    mcapi_endpoint_t    rx_endp;
2258
 
2259
    /* Don't let any other test run while this test is running. */
2260
    MCAPI_Obtain_Mutex(&MCAPID_FTS_Mutex);
2261
 
2262
    /* Indicate that a remote endpoint should be created. */
2263
    mcapi_struct->status =
2264
        MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_CREATE_ENDP, 1024,
2265
                               mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
2266
 
2267
    if (mcapi_struct->status == MCAPI_SUCCESS)
2268
    {
2269
        /* Wait for the response. */
2270
        mcapi_struct->status = MCAPID_RX_Mgmt_Response(mcapi_struct);
2271
 
2272
        /* If the endpoint was created. */
2273
        if (mcapi_struct->status == MCAPI_SUCCESS)
2274
        {
2275
            /* Indicate that the endpoint should be opened as a receiver. */
2276
            mcapi_struct->status =
2277
                MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_OPEN_RX_SIDE_PKT,
2278
                                       1024, mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
2279
 
2280
            /* Wait for the response. */
2281
            mcapi_struct->status = MCAPID_RX_Mgmt_Response(mcapi_struct);
2282
 
2283
            if (mcapi_struct->status == MGC_MCAPI_ERR_NOT_CONNECTED)
2284
            {
2285
                /* Get the receive side endpoint. */
2286
                rx_endp = mcapi_get_endpoint(FUNC_BACKEND_NODE_ID, 1024, &mcapi_struct->status);
2287
 
2288
                if (mcapi_struct->status == MCAPI_SUCCESS)
2289
                {
2290
                    /* Connect the two endpoints. */
2291
                    mcapi_connect_pktchan_i(mcapi_struct->local_endp, rx_endp,
2292
                                            &mcapi_struct->request,
2293
                                            &mcapi_struct->status);
2294
 
2295
                    if (mcapi_struct->status == MCAPI_SUCCESS)
2296
                    {
2297
                        /* Wait for the connection to open. */
2298
                        mcapi_wait(&mcapi_struct->request, &rx_len, &mcapi_struct->status,
2299
                                   MCAPI_FTS_TIMEOUT);
2300
 
2301
                        if (mcapi_struct->status == MCAPI_SUCCESS)
2302
                        {
2303
                            /* Open the send side. */
2304
                            mcapi_open_pktchan_send_i(&mcapi_struct->pkt_tx_handle,
2305
                                                      mcapi_struct->local_endp,
2306
                                                      &request, &mcapi_struct->status);
2307
 
2308
                            if (mcapi_struct->status == MCAPI_SUCCESS)
2309
                            {
2310
                                /* Wait for the send side to open. */
2311
                                mcapi_wait(&request, &rx_len, &mcapi_struct->status,
2312
                                           MCAPI_FTS_TIMEOUT);
2313
 
2314
                                if (mcapi_struct->status == MCAPI_SUCCESS)
2315
                                {
2316
                                    /* Close the send side. */
2317
                                    mcapi_packetchan_send_close_i(mcapi_struct->pkt_tx_handle,
2318
                                                                  &request, &mcapi_struct->status);
2319
 
2320
                                    if (mcapi_struct->status == MCAPI_SUCCESS)
2321
                                    {
2322
                                        /* Test for the completion. */
2323
                                        finished = mcapi_test(&request, &rx_len,
2324
                                                              &mcapi_struct->status);
2325
 
2326
                                        if ( (finished != MCAPI_TRUE) ||
2327
                                             (mcapi_struct->status != MCAPI_SUCCESS) )
2328
                                        {
2329
                                            mcapi_struct->status = -1;
2330
                                        }
2331
                                    }
2332
                                }
2333
                            }
2334
                        }
2335
                    }
2336
                }
2337
 
2338
                /* Tell the other side to close the receive side. */
2339
                status =
2340
                    MCAPID_TX_Mgmt_Message(mcapi_struct,
2341
                                           MCAPID_MGMT_CLOSE_RX_SIDE_PKT,
2342
                                           1024, mcapi_struct->local_endp,
2343
                                           0, MCAPI_DEFAULT_PRIO);
2344
 
2345
                if (status == MCAPI_SUCCESS)
2346
                {
2347
                    /* Wait for the response. */
2348
                    status = MCAPID_RX_Mgmt_Response(mcapi_struct);
2349
                }
2350
            }
2351
 
2352
            /* Tell the other side to delete the endpoint. */
2353
            status =
2354
                MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_DELETE_ENDP, 1024,
2355
                                       mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
2356
 
2357
            if (status == MCAPI_SUCCESS)
2358
            {
2359
                /* Wait for the response. */
2360
                status = MCAPID_RX_Mgmt_Response(mcapi_struct);
2361
            }
2362
        }
2363
    }
2364
 
2365
    /* Set the state of the test to completed. */
2366
    mcapi_struct->state = 0;
2367
 
2368
    /* Allow the next test to run. */
2369
    MCAPI_Release_Mutex(&MCAPID_FTS_Mutex);
2370
 
2371
} /* MCAPI_FTS_Tx_2_33_24 */
2372
 
2373
/************************************************************************
2374
*
2375
*   FUNCTION
2376
*
2377
*       MCAPI_FTS_Tx_2_33_25
2378
*
2379
*   DESCRIPTION
2380
*
2381
*       Testing mcapi_connect_sclchan_i - completed
2382
*
2383
*           Node 0 – Create an endpoint
2384
*
2385
*           Node 1 – Create an endpoint, get the endpoint on Node 0, issue
2386
*                    connection, test for completion
2387
*
2388
*************************************************************************/
2389
MCAPI_THREAD_ENTRY(MCAPI_FTS_Tx_2_33_25)
2390
{
2391
    MCAPID_STRUCT           *mcapi_struct = (MCAPID_STRUCT*)argv;
2392
    size_t                  rx_len;
2393
    mcapi_status_t          status;
2394
    mcapi_endpoint_t        tx_endp, rx_endp;
2395
    mcapi_boolean_t         finished;
2396
 
2397
    /* Don't let any other test run while this test is running. */
2398
    MCAPI_Obtain_Mutex(&MCAPID_FTS_Mutex);
2399
 
2400
    /* An extra endpoint is required for the test. */
2401
    rx_endp = mcapi_create_endpoint(MCAPI_PORT_ANY, &mcapi_struct->status);
2402
 
2403
    if (mcapi_struct->status == MCAPI_SUCCESS)
2404
    {
2405
        /* Indicate that a remote endpoint should be created. */
2406
        mcapi_struct->status =
2407
            MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_CREATE_ENDP, 1024,
2408
                                   mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
2409
 
2410
        if (mcapi_struct->status == MCAPI_SUCCESS)
2411
        {
2412
            /* Wait for a response. */
2413
            mcapi_struct->status = MCAPID_RX_Mgmt_Response(mcapi_struct);
2414
 
2415
            /* If the endpoint was created. */
2416
            if (mcapi_struct->status == MCAPI_SUCCESS)
2417
            {
2418
                /* Get the foreign endpoint. */
2419
                tx_endp = mcapi_get_endpoint(FUNC_BACKEND_NODE_ID, 1024, &mcapi_struct->status);
2420
 
2421
                if (mcapi_struct->status == MCAPI_SUCCESS)
2422
                {
2423
                    /* Connect the two endpoints. */
2424
                    mcapi_connect_sclchan_i(tx_endp, rx_endp,
2425
                                            &mcapi_struct->request,
2426
                                            &mcapi_struct->status);
2427
 
2428
                    if (mcapi_struct->status == MCAPI_SUCCESS)
2429
                    {
2430
                        unsigned long start = MCAPID_Time();
2431
 
2432
                        for (;;)
2433
                        {
2434
                            timeout_assert(start, 5);
2435
 
2436
                            /* The connect call will return successfully. */
2437
                            finished =
2438
                                mcapi_test(&mcapi_struct->request, &rx_len,
2439
                                           &mcapi_struct->status);
2440
 
2441
                            if (finished == MCAPI_FALSE)
2442
                            {
2443
                                MCAPID_Sleep(250);
2444
                            }
2445
 
2446
                            else
2447
                            {
2448
                                if (mcapi_struct->status != MCAPI_SUCCESS)
2449
                                {
2450
                                    mcapi_struct->status = -1;
2451
                                }
2452
 
2453
                                break;
2454
                            }
2455
                        }
2456
                    }
2457
                }
2458
 
2459
                /* Tell the other side to delete the endpoint. */
2460
                status =
2461
                    MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_DELETE_ENDP, 1024,
2462
                                           mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
2463
 
2464
                if (status == MCAPI_SUCCESS)
2465
                {
2466
                    /* Wait for the response. */
2467
                    status = MCAPID_RX_Mgmt_Response(mcapi_struct);
2468
                }
2469
            }
2470
        }
2471
 
2472
        /* Delete the extra endpoint. */
2473
        mcapi_delete_endpoint(rx_endp, &status);
2474
    }
2475
 
2476
    /* Set the state of the test to completed. */
2477
    mcapi_struct->state = 0;
2478
 
2479
    /* Allow the next test to run. */
2480
    MCAPI_Release_Mutex(&MCAPID_FTS_Mutex);
2481
 
2482
} /* MCAPI_FTS_Tx_2_33_25 */
2483
 
2484
/************************************************************************
2485
*
2486
*   FUNCTION
2487
*
2488
*       MCAPI_FTS_Tx_2_33_26
2489
*
2490
*   DESCRIPTION
2491
*
2492
*       Testing mcapi_test over mcapi_open_sclchan_recv_i - incomplete
2493
*
2494
*           Node 1 – Create endpoint, open receive side, test for
2495
*                    completion.
2496
*
2497
*************************************************************************/
2498
MCAPI_THREAD_ENTRY(MCAPI_FTS_Tx_2_33_26)
2499
{
2500
    MCAPID_STRUCT       *mcapi_struct = (MCAPID_STRUCT*)argv;
2501
    size_t              rx_len;
2502
    mcapi_status_t      status;
2503
    mcapi_boolean_t     finished;
2504
 
2505
    /* Don't let any other test run while this test is running. */
2506
    MCAPI_Obtain_Mutex(&MCAPID_FTS_Mutex);
2507
 
2508
    /* Open the receive side. */
2509
    mcapi_open_sclchan_recv_i(&mcapi_struct->scl_rx_handle,
2510
                              mcapi_struct->local_endp,
2511
                              &mcapi_struct->request,
2512
                              &mcapi_struct->status);
2513
 
2514
    if (mcapi_struct->status == MGC_MCAPI_ERR_NOT_CONNECTED)
2515
    {
2516
        /* Check for completion. */
2517
        finished =
2518
            mcapi_test(&mcapi_struct->request, &rx_len, &mcapi_struct->status);
2519
 
2520
        if ( (mcapi_struct->status == MCAPI_PENDING) &&
2521
             (finished == MCAPI_FALSE) )
2522
        {
2523
            mcapi_struct->status = MCAPI_SUCCESS;
2524
        }
2525
 
2526
        else
2527
        {
2528
            mcapi_struct->status = -1;
2529
        }
2530
 
2531
        mcapi_cancel(&mcapi_struct->request, &status);
2532
    }
2533
 
2534
    /* Set the state of the test to completed. */
2535
    mcapi_struct->state = 0;
2536
 
2537
    /* Allow the next test to run. */
2538
    MCAPI_Release_Mutex(&MCAPID_FTS_Mutex);
2539
 
2540
} /* MCAPI_FTS_Tx_2_33_26 */
2541
 
2542
/************************************************************************
2543
*
2544
*   FUNCTION
2545
*
2546
*       MCAPI_FTS_Tx_2_33_27
2547
*
2548
*   DESCRIPTION
2549
*
2550
*       Testing mcapi_test over mcapi_open_sclchan_recv_i - complete
2551
*
2552
*           Node 0 - Create endpoint, open send side.
2553
*
2554
*           Node 1 – Create endpoint, connect, open receive side, test for
2555
*                    completion.
2556
*
2557
*************************************************************************/
2558
MCAPI_THREAD_ENTRY(MCAPI_FTS_Tx_2_33_27)
2559
{
2560
    MCAPID_STRUCT       *mcapi_struct = (MCAPID_STRUCT*)argv;
2561
    size_t              rx_len;
2562
    mcapi_status_t      status;
2563
    mcapi_boolean_t     finished;
2564
    mcapi_request_t     request;
2565
    mcapi_endpoint_t    tx_endp;
2566
 
2567
    /* Don't let any other test run while this test is running. */
2568
    MCAPI_Obtain_Mutex(&MCAPID_FTS_Mutex);
2569
 
2570
    /* Indicate that a remote endpoint should be created. */
2571
    mcapi_struct->status =
2572
        MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_CREATE_ENDP, 1024,
2573
                               mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
2574
 
2575
    if (mcapi_struct->status == MCAPI_SUCCESS)
2576
    {
2577
        /* Wait for the response. */
2578
        mcapi_struct->status = MCAPID_RX_Mgmt_Response(mcapi_struct);
2579
 
2580
        /* If the endpoint was created. */
2581
        if (mcapi_struct->status == MCAPI_SUCCESS)
2582
        {
2583
            /* Indicate that the endpoint should be opened as a sender. */
2584
            mcapi_struct->status =
2585
                MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_OPEN_TX_SIDE_SCL,
2586
                                       1024, mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
2587
 
2588
            /* Wait for the response. */
2589
            mcapi_struct->status = MCAPID_RX_Mgmt_Response(mcapi_struct);
2590
 
2591
            if (mcapi_struct->status == MGC_MCAPI_ERR_NOT_CONNECTED)
2592
            {
2593
                /* Get the foreign endpoint. */
2594
                tx_endp = mcapi_get_endpoint(FUNC_BACKEND_NODE_ID, 1024, &mcapi_struct->status);
2595
 
2596
                if (mcapi_struct->status == MCAPI_SUCCESS)
2597
                {
2598
                    /* Connect two endpoints. */
2599
                    mcapi_connect_sclchan_i(tx_endp, mcapi_struct->local_endp,
2600
                                            &mcapi_struct->request,
2601
                                            &mcapi_struct->status);
2602
 
2603
                    if (mcapi_struct->status == MCAPI_SUCCESS)
2604
                    {
2605
                        unsigned long start = MCAPID_Time();
2606
 
2607
                        /* Open the receive side. */
2608
                        mcapi_open_sclchan_recv_i(&mcapi_struct->scl_rx_handle,
2609
                                                  mcapi_struct->local_endp,
2610
                                                  &request, &mcapi_struct->status);
2611
 
2612
                        for (;;)
2613
                        {
2614
                            timeout_assert(start, 5);
2615
 
2616
                            /* Test for the completion. */
2617
                            finished =
2618
                                mcapi_test(&request, &rx_len, &mcapi_struct->status);
2619
 
2620
                            if (finished == MCAPI_FALSE)
2621
                            {
2622
                                MCAPID_Sleep(250);
2623
                            }
2624
 
2625
                            else
2626
                            {
2627
                                if (mcapi_struct->status != MCAPI_SUCCESS)
2628
                                {
2629
                                    mcapi_struct->status = -1;
2630
                                }
2631
 
2632
                                break;
2633
                            }
2634
                        }
2635
 
2636
                        /* Close the receive side. */
2637
                        mcapi_sclchan_recv_close_i(mcapi_struct->scl_rx_handle,
2638
                                                   &request, &status);
2639
                    }
2640
                }
2641
 
2642
                /* Tell the other side to close the send side. */
2643
                status =
2644
                    MCAPID_TX_Mgmt_Message(mcapi_struct,
2645
                                           MCAPID_MGMT_CLOSE_TX_SIDE_SCL,
2646
                                           1024, mcapi_struct->local_endp,
2647
                                           0, MCAPI_DEFAULT_PRIO);
2648
 
2649
                if (status == MCAPI_SUCCESS)
2650
                {
2651
                    /* Wait for the response. */
2652
                    status = MCAPID_RX_Mgmt_Response(mcapi_struct);
2653
                }
2654
            }
2655
 
2656
            /* Tell the other side to delete the endpoint. */
2657
            status =
2658
                MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_DELETE_ENDP, 1024,
2659
                                       mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
2660
 
2661
            if (status == MCAPI_SUCCESS)
2662
            {
2663
                /* Wait for the response. */
2664
                status = MCAPID_RX_Mgmt_Response(mcapi_struct);
2665
            }
2666
        }
2667
    }
2668
 
2669
    /* Set the state of the test to completed. */
2670
    mcapi_struct->state = 0;
2671
 
2672
    /* Allow the next test to run. */
2673
    MCAPI_Release_Mutex(&MCAPID_FTS_Mutex);
2674
 
2675
} /* MCAPI_FTS_Tx_2_33_27 */
2676
 
2677
/************************************************************************
2678
*
2679
*   FUNCTION
2680
*
2681
*       MCAPI_FTS_Tx_2_33_28
2682
*
2683
*   DESCRIPTION
2684
*
2685
*       Testing mcapi_test over mcapi_open_sclchan_recv_i - canceled
2686
*
2687
*           Node 1 – Create endpoint, open receive side, cancel, test for
2688
*                    completion.
2689
*
2690
*************************************************************************/
2691
MCAPI_THREAD_ENTRY(MCAPI_FTS_Tx_2_33_28)
2692
{
2693
    MCAPID_STRUCT       *mcapi_struct = (MCAPID_STRUCT*)argv;
2694
    size_t              rx_len;
2695
    mcapi_boolean_t     finished;
2696
 
2697
    /* Don't let any other test run while this test is running. */
2698
    MCAPI_Obtain_Mutex(&MCAPID_FTS_Mutex);
2699
 
2700
    /* Open the receive side. */
2701
    mcapi_open_sclchan_recv_i(&mcapi_struct->scl_rx_handle,
2702
                              mcapi_struct->local_endp,
2703
                              &mcapi_struct->request,
2704
                              &mcapi_struct->status);
2705
 
2706
    if (mcapi_struct->status == MGC_MCAPI_ERR_NOT_CONNECTED)
2707
    {
2708
        /* Cancel. */
2709
        mcapi_cancel(&mcapi_struct->request, &mcapi_struct->status);
2710
 
2711
        if (mcapi_struct->status == MCAPI_SUCCESS)
2712
        {
2713
            /* Check for completion. */
2714
            finished =
2715
                mcapi_test(&mcapi_struct->request, &rx_len, &mcapi_struct->status);
2716
 
2717
            if ( (mcapi_struct->status == MCAPI_ERR_REQUEST_CANCELLED) &&
2718
                 (finished == MCAPI_FALSE) )
2719
            {
2720
                mcapi_struct->status = MCAPI_SUCCESS;
2721
            }
2722
 
2723
            else
2724
            {
2725
                mcapi_struct->status = -1;
2726
            }
2727
        }
2728
    }
2729
 
2730
    /* Set the state of the test to completed. */
2731
    mcapi_struct->state = 0;
2732
 
2733
    /* Allow the next test to run. */
2734
    MCAPI_Release_Mutex(&MCAPID_FTS_Mutex);
2735
 
2736
} /* MCAPI_FTS_Tx_2_33_28 */
2737
 
2738
/************************************************************************
2739
*
2740
*   FUNCTION
2741
*
2742
*       MCAPI_FTS_Tx_2_33_29
2743
*
2744
*   DESCRIPTION
2745
*
2746
*       Testing mcapi_test over mcapi_open_sclchan_send_i - incomplete
2747
*
2748
*           Node 1 – Create endpoint, open send side, test for
2749
*                    completion.
2750
*
2751
*************************************************************************/
2752
MCAPI_THREAD_ENTRY(MCAPI_FTS_Tx_2_33_29)
2753
{
2754
    MCAPID_STRUCT       *mcapi_struct = (MCAPID_STRUCT*)argv;
2755
    size_t              rx_len;
2756
    mcapi_status_t      status;
2757
    mcapi_boolean_t     finished;
2758
 
2759
    /* Don't let any other test run while this test is running. */
2760
    MCAPI_Obtain_Mutex(&MCAPID_FTS_Mutex);
2761
 
2762
    /* Open the send side. */
2763
    mcapi_open_sclchan_send_i(&mcapi_struct->scl_tx_handle,
2764
                              mcapi_struct->local_endp,
2765
                              &mcapi_struct->request,
2766
                              &mcapi_struct->status);
2767
 
2768
    if (mcapi_struct->status == MGC_MCAPI_ERR_NOT_CONNECTED)
2769
    {
2770
        /* Check for completion. */
2771
        finished =
2772
            mcapi_test(&mcapi_struct->request, &rx_len, &mcapi_struct->status);
2773
 
2774
        if ( (mcapi_struct->status == MCAPI_PENDING) &&
2775
             (finished == MCAPI_FALSE) )
2776
        {
2777
            mcapi_struct->status = MCAPI_SUCCESS;
2778
        }
2779
 
2780
        else
2781
        {
2782
            mcapi_struct->status = -1;
2783
        }
2784
 
2785
        mcapi_cancel(&mcapi_struct->request, &status);
2786
    }
2787
 
2788
    /* Set the state of the test to completed. */
2789
    mcapi_struct->state = 0;
2790
 
2791
    /* Allow the next test to run. */
2792
    MCAPI_Release_Mutex(&MCAPID_FTS_Mutex);
2793
 
2794
} /* MCAPI_FTS_Tx_2_33_29 */
2795
 
2796
/************************************************************************
2797
*
2798
*   FUNCTION
2799
*
2800
*       MCAPI_FTS_Tx_2_33_30
2801
*
2802
*   DESCRIPTION
2803
*
2804
*       Testing mcapi_test over mcapi_open_sclchan_send_i - complete
2805
*
2806
*           Node 0 - Create endpoint, open receive side.
2807
*
2808
*           Node 1 – Create endpoint, connect, open send side, test for
2809
*                    completion.
2810
*
2811
*************************************************************************/
2812
MCAPI_THREAD_ENTRY(MCAPI_FTS_Tx_2_33_30)
2813
{
2814
    MCAPID_STRUCT       *mcapi_struct = (MCAPID_STRUCT*)argv;
2815
    size_t              rx_len;
2816
    mcapi_status_t      status;
2817
    mcapi_boolean_t     finished;
2818
    mcapi_request_t     request;
2819
    mcapi_endpoint_t    rx_endp;
2820
 
2821
    /* Don't let any other test run while this test is running. */
2822
    MCAPI_Obtain_Mutex(&MCAPID_FTS_Mutex);
2823
 
2824
    /* Indicate that a remote endpoint should be created. */
2825
    mcapi_struct->status =
2826
        MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_CREATE_ENDP, 1024,
2827
                               mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
2828
 
2829
    if (mcapi_struct->status == MCAPI_SUCCESS)
2830
    {
2831
        /* Wait for the response. */
2832
        mcapi_struct->status = MCAPID_RX_Mgmt_Response(mcapi_struct);
2833
 
2834
        /* If the endpoint was created. */
2835
        if (mcapi_struct->status == MCAPI_SUCCESS)
2836
        {
2837
            /* Indicate that the endpoint should be opened as a receiver. */
2838
            mcapi_struct->status =
2839
                MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_OPEN_RX_SIDE_SCL,
2840
                                       1024, mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
2841
 
2842
            /* Wait for the response. */
2843
            mcapi_struct->status = MCAPID_RX_Mgmt_Response(mcapi_struct);
2844
 
2845
            if (mcapi_struct->status == MGC_MCAPI_ERR_NOT_CONNECTED)
2846
            {
2847
                /* Get the foreign endpoint. */
2848
                rx_endp = mcapi_get_endpoint(FUNC_BACKEND_NODE_ID, 1024, &mcapi_struct->status);
2849
 
2850
                if (mcapi_struct->status == MCAPI_SUCCESS)
2851
                {
2852
                    /* Connect two endpoints. */
2853
                    mcapi_connect_sclchan_i(mcapi_struct->local_endp, rx_endp,
2854
                                            &mcapi_struct->request,
2855
                                            &mcapi_struct->status);
2856
 
2857
                    if (mcapi_struct->status == MCAPI_SUCCESS)
2858
                    {
2859
                        unsigned long start = MCAPID_Time();
2860
 
2861
                        /* Open the send side. */
2862
                        mcapi_open_sclchan_send_i(&mcapi_struct->scl_tx_handle,
2863
                                                  mcapi_struct->local_endp,
2864
                                                  &request, &mcapi_struct->status);
2865
 
2866
                        for (;;)
2867
                        {
2868
                            timeout_assert(start, 5);
2869
 
2870
                            /* Test for the completion. */
2871
                            finished =
2872
                                mcapi_test(&request, &rx_len, &mcapi_struct->status);
2873
 
2874
                            if (finished == MCAPI_FALSE)
2875
                            {
2876
                                MCAPID_Sleep(250);
2877
                            }
2878
 
2879
                            else
2880
                            {
2881
                                if (mcapi_struct->status != MCAPI_SUCCESS)
2882
                                {
2883
                                    mcapi_struct->status = -1;
2884
                                }
2885
 
2886
                                break;
2887
                            }
2888
                        }
2889
 
2890
                        /* Close the send side. */
2891
                        mcapi_sclchan_send_close_i(mcapi_struct->scl_tx_handle,
2892
                                                   &request, &status);
2893
                    }
2894
                }
2895
 
2896
                /* Tell the other side to close the receive side. */
2897
                status =
2898
                    MCAPID_TX_Mgmt_Message(mcapi_struct,
2899
                                           MCAPID_MGMT_CLOSE_RX_SIDE_SCL,
2900
                                           1024, mcapi_struct->local_endp,
2901
                                           0, MCAPI_DEFAULT_PRIO);
2902
 
2903
                if (status == MCAPI_SUCCESS)
2904
                {
2905
                    /* Wait for the response. */
2906
                    status = MCAPID_RX_Mgmt_Response(mcapi_struct);
2907
                }
2908
            }
2909
 
2910
            /* Tell the other side to delete the endpoint. */
2911
            status =
2912
                MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_DELETE_ENDP, 1024,
2913
                                       mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
2914
 
2915
            if (status == MCAPI_SUCCESS)
2916
            {
2917
                /* Wait for the response. */
2918
                status = MCAPID_RX_Mgmt_Response(mcapi_struct);
2919
            }
2920
        }
2921
    }
2922
 
2923
    /* Set the state of the test to completed. */
2924
    mcapi_struct->state = 0;
2925
 
2926
    /* Allow the next test to run. */
2927
    MCAPI_Release_Mutex(&MCAPID_FTS_Mutex);
2928
 
2929
} /* MCAPI_FTS_Tx_2_33_30 */
2930
 
2931
/************************************************************************
2932
*
2933
*   FUNCTION
2934
*
2935
*       MCAPI_FTS_Tx_2_33_31
2936
*
2937
*   DESCRIPTION
2938
*
2939
*       Testing mcapi_test over mcapi_open_sclchan_send_i - canceled
2940
*
2941
*           Node 1 – Create endpoint, open send side, cancel, test for
2942
*                    completion.
2943
*
2944
*************************************************************************/
2945
MCAPI_THREAD_ENTRY(MCAPI_FTS_Tx_2_33_31)
2946
{
2947
    MCAPID_STRUCT       *mcapi_struct = (MCAPID_STRUCT*)argv;
2948
    size_t              rx_len;
2949
    mcapi_boolean_t     finished;
2950
 
2951
    /* Don't let any other test run while this test is running. */
2952
    MCAPI_Obtain_Mutex(&MCAPID_FTS_Mutex);
2953
 
2954
    /* Open the send side. */
2955
    mcapi_open_sclchan_send_i(&mcapi_struct->scl_tx_handle,
2956
                              mcapi_struct->local_endp,
2957
                              &mcapi_struct->request,
2958
                              &mcapi_struct->status);
2959
 
2960
    if (mcapi_struct->status == MGC_MCAPI_ERR_NOT_CONNECTED)
2961
    {
2962
        /* Cancel. */
2963
        mcapi_cancel(&mcapi_struct->request, &mcapi_struct->status);
2964
 
2965
        if (mcapi_struct->status == MCAPI_SUCCESS)
2966
        {
2967
            /* Check for completion. */
2968
            finished =
2969
                mcapi_test(&mcapi_struct->request, &rx_len, &mcapi_struct->status);
2970
 
2971
            if ( (mcapi_struct->status == MCAPI_ERR_REQUEST_CANCELLED) &&
2972
                 (finished == MCAPI_FALSE) )
2973
            {
2974
                mcapi_struct->status = MCAPI_SUCCESS;
2975
            }
2976
 
2977
            else
2978
            {
2979
                mcapi_struct->status = -1;
2980
            }
2981
        }
2982
    }
2983
 
2984
    /* Set the state of the test to completed. */
2985
    mcapi_struct->state = 0;
2986
 
2987
    /* Allow the next test to run. */
2988
    MCAPI_Release_Mutex(&MCAPID_FTS_Mutex);
2989
 
2990
} /* MCAPI_FTS_Tx_2_33_31 */
2991
 
2992
/************************************************************************
2993
*
2994
*   FUNCTION
2995
*
2996
*       MCAPI_FTS_Tx_2_33_32
2997
*
2998
*   DESCRIPTION
2999
*
3000
*       Testing mcapi_test over mcapi_sclchan_recv_close_i - tx not
3001
*       opened, not connected
3002
*
3003
*           Node 1 – Create endpoint, open receive side, close receive
3004
*                    side, test for completion.
3005
*
3006
*************************************************************************/
3007
MCAPI_THREAD_ENTRY(MCAPI_FTS_Tx_2_33_32)
3008
{
3009
    MCAPID_STRUCT       *mcapi_struct = (MCAPID_STRUCT*)argv;
3010
    size_t              rx_len;
3011
    mcapi_boolean_t     finished;
3012
    mcapi_request_t     request;
3013
 
3014
    /* Don't let any other test run while this test is running. */
3015
    MCAPI_Obtain_Mutex(&MCAPID_FTS_Mutex);
3016
 
3017
    /* Open the receive side. */
3018
    mcapi_open_sclchan_recv_i(&mcapi_struct->scl_rx_handle,
3019
                              mcapi_struct->local_endp,
3020
                              &mcapi_struct->request,
3021
                              &mcapi_struct->status);
3022
 
3023
    if (mcapi_struct->status == MGC_MCAPI_ERR_NOT_CONNECTED)
3024
    {
3025
        /* Close the receive side. */
3026
        mcapi_sclchan_recv_close_i(mcapi_struct->scl_rx_handle,
3027
                                   &request, &mcapi_struct->status);
3028
 
3029
        if (mcapi_struct->status == MCAPI_SUCCESS)
3030
        {
3031
            /* Test for the completion. */
3032
            finished = mcapi_test(&request, &rx_len, &mcapi_struct->status);
3033
 
3034
            if ( (finished != MCAPI_TRUE) ||
3035
                 (mcapi_struct->status != MCAPI_SUCCESS) )
3036
            {
3037
                mcapi_struct->status = -1;
3038
            }
3039
        }
3040
    }
3041
 
3042
    /* Set the state of the test to completed. */
3043
    mcapi_struct->state = 0;
3044
 
3045
    /* Allow the next test to run. */
3046
    MCAPI_Release_Mutex(&MCAPID_FTS_Mutex);
3047
 
3048
} /* MCAPI_FTS_Tx_2_33_32 */
3049
 
3050
/************************************************************************
3051
*
3052
*   FUNCTION
3053
*
3054
*       MCAPI_FTS_Tx_2_33_33
3055
*
3056
*   DESCRIPTION
3057
*
3058
*       Testing mcapi_test over mcapi_sclchan_recv_close_i - tx opened,
3059
*       not connected
3060
*
3061
*           Node 0 - Create endpoint, open send side
3062
*
3063
*           Node 1 – Create endpoint, open receive side, wait for Node 0 to
3064
*                    open send side, test for completion.
3065
*
3066
*************************************************************************/
3067
MCAPI_THREAD_ENTRY(MCAPI_FTS_Tx_2_33_33)
3068
{
3069
    MCAPID_STRUCT       *mcapi_struct = (MCAPID_STRUCT*)argv;
3070
    size_t              rx_len;
3071
    mcapi_status_t      status;
3072
    mcapi_boolean_t     finished;
3073
    mcapi_request_t     request;
3074
 
3075
    /* Don't let any other test run while this test is running. */
3076
    MCAPI_Obtain_Mutex(&MCAPID_FTS_Mutex);
3077
 
3078
    /* Indicate that a remote endpoint should be created. */
3079
    mcapi_struct->status =
3080
        MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_CREATE_ENDP, 1024,
3081
                               mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
3082
 
3083
    if (mcapi_struct->status == MCAPI_SUCCESS)
3084
    {
3085
        /* Wait for the response. */
3086
        mcapi_struct->status = MCAPID_RX_Mgmt_Response(mcapi_struct);
3087
 
3088
        /* If the endpoint was created. */
3089
        if (mcapi_struct->status == MCAPI_SUCCESS)
3090
        {
3091
            /* Indicate that the endpoint should be opened as a sender. */
3092
            mcapi_struct->status =
3093
                MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_OPEN_TX_SIDE_SCL,
3094
                                       1024, mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
3095
 
3096
            /* Wait for the response. */
3097
            mcapi_struct->status = MCAPID_RX_Mgmt_Response(mcapi_struct);
3098
 
3099
            if (mcapi_struct->status == MGC_MCAPI_ERR_NOT_CONNECTED)
3100
            {
3101
                /* Open the receive side. */
3102
                mcapi_open_sclchan_recv_i(&mcapi_struct->scl_rx_handle,
3103
                                          mcapi_struct->local_endp,
3104
                                          &mcapi_struct->request,
3105
                                          &mcapi_struct->status);
3106
 
3107
                if (mcapi_struct->status == MGC_MCAPI_ERR_NOT_CONNECTED)
3108
                {
3109
                    /* Close the receive side. */
3110
                    mcapi_sclchan_recv_close_i(mcapi_struct->scl_rx_handle,
3111
                                               &request, &mcapi_struct->status);
3112
 
3113
                    if (mcapi_struct->status == MCAPI_SUCCESS)
3114
                    {
3115
                        /* Test for the completion. */
3116
                        finished = mcapi_test(&request, &rx_len,
3117
                                              &mcapi_struct->status);
3118
 
3119
                        if ( (finished != MCAPI_TRUE) ||
3120
                             (mcapi_struct->status != MCAPI_SUCCESS) )
3121
                        {
3122
                            mcapi_struct->status = -1;
3123
                        }
3124
                    }
3125
                }
3126
 
3127
                /* Tell the other side to close the send side. */
3128
                status =
3129
                    MCAPID_TX_Mgmt_Message(mcapi_struct,
3130
                                           MCAPID_MGMT_CLOSE_TX_SIDE_SCL,
3131
                                           1024, mcapi_struct->local_endp,
3132
                                           0, MCAPI_DEFAULT_PRIO);
3133
 
3134
                if (status == MCAPI_SUCCESS)
3135
                {
3136
                    /* Wait for the response. */
3137
                    status = MCAPID_RX_Mgmt_Response(mcapi_struct);
3138
                }
3139
            }
3140
 
3141
            /* Tell the other side to delete the endpoint. */
3142
            status =
3143
                MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_DELETE_ENDP, 1024,
3144
                                       mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
3145
 
3146
            if (status == MCAPI_SUCCESS)
3147
            {
3148
                /* Wait for the response. */
3149
                status = MCAPID_RX_Mgmt_Response(mcapi_struct);
3150
            }
3151
        }
3152
    }
3153
 
3154
    /* Set the state of the test to completed. */
3155
    mcapi_struct->state = 0;
3156
 
3157
    /* Allow the next test to run. */
3158
    MCAPI_Release_Mutex(&MCAPID_FTS_Mutex);
3159
 
3160
} /* MCAPI_FTS_Tx_2_33_33 */
3161
 
3162
/************************************************************************
3163
*
3164
*   FUNCTION
3165
*
3166
*       MCAPI_FTS_Tx_2_33_34
3167
*
3168
*   DESCRIPTION
3169
*
3170
*       Testing mcapi_test over mcapi_sclchan_recv_close_i - tx opened,
3171
*       connected
3172
*
3173
*           Node 0 - Create endpoint, open send side
3174
*
3175
*           Node 1 – Create endpoint, issue connection, open receive side,
3176
*                    test for completion.
3177
*
3178
*************************************************************************/
3179
MCAPI_THREAD_ENTRY(MCAPI_FTS_Tx_2_33_34)
3180
{
3181
    MCAPID_STRUCT       *mcapi_struct = (MCAPID_STRUCT*)argv;
3182
    size_t              rx_len;
3183
    mcapi_status_t      status;
3184
    mcapi_boolean_t     finished;
3185
    mcapi_request_t     request;
3186
    mcapi_endpoint_t    tx_endp;
3187
 
3188
    /* Don't let any other test run while this test is running. */
3189
    MCAPI_Obtain_Mutex(&MCAPID_FTS_Mutex);
3190
 
3191
    /* Indicate that a remote endpoint should be created. */
3192
    mcapi_struct->status =
3193
        MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_CREATE_ENDP, 1024,
3194
                               mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
3195
 
3196
    if (mcapi_struct->status == MCAPI_SUCCESS)
3197
    {
3198
        /* Wait for the response. */
3199
        mcapi_struct->status = MCAPID_RX_Mgmt_Response(mcapi_struct);
3200
 
3201
        /* If the endpoint was created. */
3202
        if (mcapi_struct->status == MCAPI_SUCCESS)
3203
        {
3204
            /* Indicate that the endpoint should be opened as a sender. */
3205
            mcapi_struct->status =
3206
                MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_OPEN_TX_SIDE_SCL,
3207
                                       1024, mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
3208
 
3209
            /* Wait for the response. */
3210
            mcapi_struct->status = MCAPID_RX_Mgmt_Response(mcapi_struct);
3211
 
3212
            if (mcapi_struct->status == MGC_MCAPI_ERR_NOT_CONNECTED)
3213
            {
3214
                /* Get the send side endpoint. */
3215
                tx_endp = mcapi_get_endpoint(FUNC_BACKEND_NODE_ID, 1024, &mcapi_struct->status);
3216
 
3217
                if (mcapi_struct->status == MCAPI_SUCCESS)
3218
                {
3219
                    /* Connect the two endpoints. */
3220
                    mcapi_connect_sclchan_i(tx_endp, mcapi_struct->local_endp,
3221
                                            &mcapi_struct->request,
3222
                                            &mcapi_struct->status);
3223
 
3224
                    if (mcapi_struct->status == MCAPI_SUCCESS)
3225
                    {
3226
                        /* Wait for the connection to open. */
3227
                        mcapi_wait(&mcapi_struct->request, &rx_len, &mcapi_struct->status,
3228
                                   MCAPI_FTS_TIMEOUT);
3229
 
3230
                        if (mcapi_struct->status == MCAPI_SUCCESS)
3231
                        {
3232
                            /* Open the receive side. */
3233
                            mcapi_open_sclchan_recv_i(&mcapi_struct->scl_rx_handle,
3234
                                                      mcapi_struct->local_endp,
3235
                                                      &request, &mcapi_struct->status);
3236
 
3237
                            if (mcapi_struct->status == MCAPI_SUCCESS)
3238
                            {
3239
                                /* Wait for the receive side to open. */
3240
                                mcapi_wait(&request, &rx_len, &mcapi_struct->status,
3241
                                           MCAPI_FTS_TIMEOUT);
3242
 
3243
                                if (mcapi_struct->status == MCAPI_SUCCESS)
3244
                                {
3245
                                    /* Close the receive side. */
3246
                                    mcapi_sclchan_recv_close_i(mcapi_struct->scl_rx_handle,
3247
                                                               &request, &mcapi_struct->status);
3248
 
3249
                                    if (mcapi_struct->status == MCAPI_SUCCESS)
3250
                                    {
3251
                                        /* Test for the completion. */
3252
                                        finished = mcapi_test(&request, &rx_len,
3253
                                                              &mcapi_struct->status);
3254
 
3255
                                        if ( (finished != MCAPI_TRUE) ||
3256
                                             (mcapi_struct->status != MCAPI_SUCCESS) )
3257
                                        {
3258
                                            mcapi_struct->status = -1;
3259
                                        }
3260
                                    }
3261
                                }
3262
                            }
3263
                        }
3264
                    }
3265
                }
3266
 
3267
                /* Tell the other side to close the send side. */
3268
                status =
3269
                    MCAPID_TX_Mgmt_Message(mcapi_struct,
3270
                                           MCAPID_MGMT_CLOSE_TX_SIDE_SCL,
3271
                                           1024, mcapi_struct->local_endp,
3272
                                           0, MCAPI_DEFAULT_PRIO);
3273
 
3274
                if (status == MCAPI_SUCCESS)
3275
                {
3276
                    /* Wait for the response. */
3277
                    status = MCAPID_RX_Mgmt_Response(mcapi_struct);
3278
                }
3279
            }
3280
 
3281
            /* Tell the other side to delete the endpoint. */
3282
            status =
3283
                MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_DELETE_ENDP, 1024,
3284
                                       mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
3285
 
3286
            if (status == MCAPI_SUCCESS)
3287
            {
3288
                /* Wait for the response. */
3289
                status = MCAPID_RX_Mgmt_Response(mcapi_struct);
3290
            }
3291
        }
3292
    }
3293
 
3294
    /* Set the state of the test to completed. */
3295
    mcapi_struct->state = 0;
3296
 
3297
    /* Allow the next test to run. */
3298
    MCAPI_Release_Mutex(&MCAPID_FTS_Mutex);
3299
 
3300
} /* MCAPI_FTS_Tx_2_33_34 */
3301
 
3302
/************************************************************************
3303
*
3304
*   FUNCTION
3305
*
3306
*       MCAPI_FTS_Tx_2_33_35
3307
*
3308
*   DESCRIPTION
3309
*
3310
*       Testing mcapi_test over mcapi_sclchan_send_close_i - rx not
3311
*       opened, not connected
3312
*
3313
*           Node 1 – Create endpoint, open send side, close send
3314
*                    side, test for completion.
3315
*
3316
*************************************************************************/
3317
MCAPI_THREAD_ENTRY(MCAPI_FTS_Tx_2_33_35)
3318
{
3319
    MCAPID_STRUCT       *mcapi_struct = (MCAPID_STRUCT*)argv;
3320
    size_t              rx_len;
3321
    mcapi_boolean_t     finished;
3322
    mcapi_request_t     request;
3323
 
3324
    /* Don't let any other test run while this test is running. */
3325
    MCAPI_Obtain_Mutex(&MCAPID_FTS_Mutex);
3326
 
3327
    /* Open the send side. */
3328
    mcapi_open_sclchan_send_i(&mcapi_struct->scl_tx_handle,
3329
                              mcapi_struct->local_endp,
3330
                              &mcapi_struct->request,
3331
                              &mcapi_struct->status);
3332
 
3333
    if (mcapi_struct->status == MGC_MCAPI_ERR_NOT_CONNECTED)
3334
    {
3335
        /* Close the send side. */
3336
        mcapi_sclchan_send_close_i(mcapi_struct->scl_tx_handle,
3337
                                   &request, &mcapi_struct->status);
3338
 
3339
        if (mcapi_struct->status == MCAPI_SUCCESS)
3340
        {
3341
            /* Test for the completion. */
3342
            finished = mcapi_test(&request, &rx_len, &mcapi_struct->status);
3343
 
3344
            if ( (finished != MCAPI_TRUE) ||
3345
                 (mcapi_struct->status != MCAPI_SUCCESS) )
3346
            {
3347
                mcapi_struct->status = -1;
3348
            }
3349
        }
3350
    }
3351
 
3352
    /* Set the state of the test to completed. */
3353
    mcapi_struct->state = 0;
3354
 
3355
    /* Allow the next test to run. */
3356
    MCAPI_Release_Mutex(&MCAPID_FTS_Mutex);
3357
 
3358
} /* MCAPI_FTS_Tx_2_33_35 */
3359
 
3360
/************************************************************************
3361
*
3362
*   FUNCTION
3363
*
3364
*       MCAPI_FTS_Tx_2_33_36
3365
*
3366
*   DESCRIPTION
3367
*
3368
*       Testing mcapi_test over mcapi_sclchan_send_close_i - rx opened,
3369
*       not connected
3370
*
3371
*           Node 0 - Create endpoint, open receive side
3372
*
3373
*           Node 1 – Create endpoint, open send side, wait for Node 0 to
3374
*                    open receive side, test for completion.
3375
*
3376
*************************************************************************/
3377
MCAPI_THREAD_ENTRY(MCAPI_FTS_Tx_2_33_36)
3378
{
3379
    MCAPID_STRUCT       *mcapi_struct = (MCAPID_STRUCT*)argv;
3380
    size_t              rx_len;
3381
    mcapi_status_t      status;
3382
    mcapi_boolean_t     finished;
3383
    mcapi_request_t     request;
3384
 
3385
    /* Don't let any other test run while this test is running. */
3386
    MCAPI_Obtain_Mutex(&MCAPID_FTS_Mutex);
3387
 
3388
    /* Indicate that a remote endpoint should be created. */
3389
    mcapi_struct->status =
3390
        MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_CREATE_ENDP, 1024,
3391
                               mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
3392
 
3393
    if (mcapi_struct->status == MCAPI_SUCCESS)
3394
    {
3395
        /* Wait for the response. */
3396
        mcapi_struct->status = MCAPID_RX_Mgmt_Response(mcapi_struct);
3397
 
3398
        /* If the endpoint was created. */
3399
        if (mcapi_struct->status == MCAPI_SUCCESS)
3400
        {
3401
            /* Indicate that the endpoint should be opened as a receiver. */
3402
            mcapi_struct->status =
3403
                MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_OPEN_RX_SIDE_SCL,
3404
                                       1024, mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
3405
 
3406
            /* Wait for the response. */
3407
            mcapi_struct->status = MCAPID_RX_Mgmt_Response(mcapi_struct);
3408
 
3409
            if (mcapi_struct->status == MGC_MCAPI_ERR_NOT_CONNECTED)
3410
            {
3411
                /* Open the send side. */
3412
                mcapi_open_sclchan_send_i(&mcapi_struct->scl_tx_handle,
3413
                                          mcapi_struct->local_endp,
3414
                                          &mcapi_struct->request,
3415
                                          &mcapi_struct->status);
3416
 
3417
                if (mcapi_struct->status == MGC_MCAPI_ERR_NOT_CONNECTED)
3418
                {
3419
                    /* Close the send side. */
3420
                    mcapi_sclchan_send_close_i(mcapi_struct->scl_tx_handle,
3421
                                               &request, &mcapi_struct->status);
3422
 
3423
                    if (mcapi_struct->status == MCAPI_SUCCESS)
3424
                    {
3425
                        /* Test for the completion. */
3426
                        finished = mcapi_test(&request, &rx_len,
3427
                                              &mcapi_struct->status);
3428
 
3429
                        if ( (finished != MCAPI_TRUE) ||
3430
                             (mcapi_struct->status != MCAPI_SUCCESS) )
3431
                        {
3432
                            mcapi_struct->status = -1;
3433
                        }
3434
                    }
3435
                }
3436
 
3437
                /* Tell the other side to close the receive side. */
3438
                status =
3439
                    MCAPID_TX_Mgmt_Message(mcapi_struct,
3440
                                           MCAPID_MGMT_CLOSE_RX_SIDE_SCL,
3441
                                           1024, mcapi_struct->local_endp,
3442
                                           0, MCAPI_DEFAULT_PRIO);
3443
 
3444
                if (status == MCAPI_SUCCESS)
3445
                {
3446
                    /* Wait for the response. */
3447
                    status = MCAPID_RX_Mgmt_Response(mcapi_struct);
3448
                }
3449
            }
3450
 
3451
            /* Tell the other side to delete the endpoint. */
3452
            status =
3453
                MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_DELETE_ENDP, 1024,
3454
                                       mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
3455
 
3456
            if (status == MCAPI_SUCCESS)
3457
            {
3458
                /* Wait for the response. */
3459
                status = MCAPID_RX_Mgmt_Response(mcapi_struct);
3460
            }
3461
        }
3462
    }
3463
 
3464
    /* Set the state of the test to completed. */
3465
    mcapi_struct->state = 0;
3466
 
3467
    /* Allow the next test to run. */
3468
    MCAPI_Release_Mutex(&MCAPID_FTS_Mutex);
3469
 
3470
} /* MCAPI_FTS_Tx_2_33_36 */
3471
 
3472
/************************************************************************
3473
*
3474
*   FUNCTION
3475
*
3476
*       MCAPI_FTS_Tx_2_33_37
3477
*
3478
*   DESCRIPTION
3479
*
3480
*       Testing mcapi_test over mcapi_sclchan_send_close_i - rx opened,
3481
*       connected
3482
*
3483
*           Node 0 - Create endpoint, open receive side
3484
*
3485
*           Node 1 – Create endpoint, issue connection, open send side,
3486
*                    test for completion.
3487
*
3488
*************************************************************************/
3489
MCAPI_THREAD_ENTRY(MCAPI_FTS_Tx_2_33_37)
3490
{
3491
    MCAPID_STRUCT       *mcapi_struct = (MCAPID_STRUCT*)argv;
3492
    size_t              rx_len;
3493
    mcapi_status_t      status;
3494
    mcapi_boolean_t     finished;
3495
    mcapi_request_t     request;
3496
    mcapi_endpoint_t    rx_endp;
3497
 
3498
    /* Don't let any other test run while this test is running. */
3499
    MCAPI_Obtain_Mutex(&MCAPID_FTS_Mutex);
3500
 
3501
    /* Indicate that a remote endpoint should be created. */
3502
    mcapi_struct->status =
3503
        MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_CREATE_ENDP, 1024,
3504
                               mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
3505
 
3506
    if (mcapi_struct->status == MCAPI_SUCCESS)
3507
    {
3508
        /* Wait for the response. */
3509
        mcapi_struct->status = MCAPID_RX_Mgmt_Response(mcapi_struct);
3510
 
3511
        /* If the endpoint was created. */
3512
        if (mcapi_struct->status == MCAPI_SUCCESS)
3513
        {
3514
            /* Indicate that the endpoint should be opened as a receiver. */
3515
            mcapi_struct->status =
3516
                MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_OPEN_RX_SIDE_SCL,
3517
                                       1024, mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
3518
 
3519
            /* Wait for the response. */
3520
            mcapi_struct->status = MCAPID_RX_Mgmt_Response(mcapi_struct);
3521
 
3522
            if (mcapi_struct->status == MGC_MCAPI_ERR_NOT_CONNECTED)
3523
            {
3524
                /* Get the receive side endpoint. */
3525
                rx_endp = mcapi_get_endpoint(FUNC_BACKEND_NODE_ID, 1024, &mcapi_struct->status);
3526
 
3527
                if (mcapi_struct->status == MCAPI_SUCCESS)
3528
                {
3529
                    /* Connect the two endpoints. */
3530
                    mcapi_connect_sclchan_i(mcapi_struct->local_endp, rx_endp,
3531
                                            &mcapi_struct->request,
3532
                                            &mcapi_struct->status);
3533
 
3534
                    if (mcapi_struct->status == MCAPI_SUCCESS)
3535
                    {
3536
                        /* Wait for the connection to open. */
3537
                        mcapi_wait(&mcapi_struct->request, &rx_len, &mcapi_struct->status,
3538
                                   MCAPI_FTS_TIMEOUT);
3539
 
3540
                        if (mcapi_struct->status == MCAPI_SUCCESS)
3541
                        {
3542
                            /* Open the send side. */
3543
                            mcapi_open_sclchan_send_i(&mcapi_struct->scl_tx_handle,
3544
                                                      mcapi_struct->local_endp,
3545
                                                      &request, &mcapi_struct->status);
3546
 
3547
                            if (mcapi_struct->status == MCAPI_SUCCESS)
3548
                            {
3549
                                /* Wait for the send side to open. */
3550
                                mcapi_wait(&request, &rx_len, &mcapi_struct->status,
3551
                                           MCAPI_FTS_TIMEOUT);
3552
 
3553
                                if (mcapi_struct->status == MCAPI_SUCCESS)
3554
                                {
3555
                                    /* Close the send side. */
3556
                                    mcapi_sclchan_send_close_i(mcapi_struct->scl_tx_handle,
3557
                                                               &request, &mcapi_struct->status);
3558
 
3559
                                    if (mcapi_struct->status == MCAPI_SUCCESS)
3560
                                    {
3561
                                        /* Test for the completion. */
3562
                                        finished = mcapi_test(&request, &rx_len,
3563
                                                              &mcapi_struct->status);
3564
 
3565
                                        if ( (finished != MCAPI_TRUE) ||
3566
                                             (mcapi_struct->status != MCAPI_SUCCESS) )
3567
                                        {
3568
                                            mcapi_struct->status = -1;
3569
                                        }
3570
                                    }
3571
                                }
3572
                            }
3573
                        }
3574
                    }
3575
                }
3576
 
3577
                /* Tell the other side to close the receive side. */
3578
                status =
3579
                    MCAPID_TX_Mgmt_Message(mcapi_struct,
3580
                                           MCAPID_MGMT_CLOSE_RX_SIDE_SCL,
3581
                                           1024, mcapi_struct->local_endp,
3582
                                           0, MCAPI_DEFAULT_PRIO);
3583
 
3584
                if (status == MCAPI_SUCCESS)
3585
                {
3586
                    /* Wait for the response. */
3587
                    status = MCAPID_RX_Mgmt_Response(mcapi_struct);
3588
                }
3589
            }
3590
 
3591
            /* Tell the other side to delete the endpoint. */
3592
            status =
3593
                MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_DELETE_ENDP, 1024,
3594
                                       mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
3595
 
3596
            if (status == MCAPI_SUCCESS)
3597
            {
3598
                /* Wait for the response. */
3599
                status = MCAPID_RX_Mgmt_Response(mcapi_struct);
3600
            }
3601
        }
3602
    }
3603
 
3604
    /* Set the state of the test to completed. */
3605
    mcapi_struct->state = 0;
3606
 
3607
    /* Allow the next test to run. */
3608
    MCAPI_Release_Mutex(&MCAPID_FTS_Mutex);
3609
 
3610
} /* MCAPI_FTS_Tx_2_33_37 */

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.