1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
|
/*
* Copyright (c) 2006-2008 Voltaire, Inc. All rights reserved.
* Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.
* Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
*
* This software is available to you under a choice of one of two
* licenses. You may choose to be licensed under the terms of the GNU
* General Public License (GPL) Version 2, available from the file
* COPYING in the main directory of this source tree, or the
* OpenIB.org BSD license below:
*
* Redistribution and use in source and binary forms, with or
* without modification, are permitted provided that the following
* conditions are met:
*
* - Redistributions of source code must retain the above
* copyright notice, this list of conditions and the following
* disclaimer.
*
* - Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
*/
/*
* Abstract:
* Implementation of Multicast Member testing flow..
*
*/
#ifndef __WIN__
#include <unistd.h>
#endif
#include <sys/socket.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <arpa/inet.h>
#include <complib/cl_debug.h>
#include <complib/cl_map.h>
#include <complib/cl_list.h>
#include "osmtest.h"
/**********************************************************************
**********************************************************************/
static void __osmt_print_all_multicast_records(IN osmtest_t * const p_osmt)
{
uint32_t i;
ib_api_status_t status;
osmv_query_req_t req;
osmv_user_query_t user;
osmtest_req_context_t context;
ib_member_rec_t *mcast_record;
memset(&context, 0, sizeof(context));
memset(&req, 0, sizeof(req));
memset(&user, 0, sizeof(user));
user.attr_id = IB_MAD_ATTR_MCMEMBER_RECORD;
user.attr_offset = ib_get_attr_offset(sizeof(*mcast_record));
req.query_type = OSMV_QUERY_USER_DEFINED;
req.timeout_ms = p_osmt->opt.transaction_timeout;
req.retry_cnt = 1;
req.flags = OSM_SA_FLAGS_SYNC;
context.p_osmt = p_osmt;
req.query_context = &context;
req.pfn_query_cb = osmtest_query_res_cb;
req.p_query_input = &user;
/* UnTrusted (SMKey of 0) - get the multicast groups */
status = osmv_query_sa(p_osmt->h_bind, &req);
if (status != IB_SUCCESS || context.result.status != IB_SUCCESS) {
OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 02B5: "
"Failed getting the multicast groups records - %s/%s\n",
ib_get_err_str(status),
ib_get_err_str(context.result.status));
return;
}
osm_log(&p_osmt->log, OSM_LOG_INFO,
"\n |------------------------------------------|"
"\n | Remaining Multicast Groups |"
"\n |------------------------------------------|\n");
for (i = 0; i < context.result.result_cnt; i++) {
mcast_record =
osmv_get_query_mc_rec(context.result.p_result_madw, i);
osm_dump_mc_record(&p_osmt->log, mcast_record, OSM_LOG_INFO);
}
/* Trusted - now get the multicast group members */
req.sm_key = OSM_DEFAULT_SM_KEY;
status = osmv_query_sa(p_osmt->h_bind, &req);
if (status != IB_SUCCESS || context.result.status != IB_SUCCESS) {
OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 02B6: "
"Failed getting the multicast group members records - %s/%s\n",
ib_get_err_str(status),
ib_get_err_str(context.result.status));
return;
}
osm_log(&p_osmt->log, OSM_LOG_INFO,
"\n |--------------------------------------------------|"
"\n | Remaining Multicast Group Members |"
"\n |--------------------------------------------------|\n");
for (i = 0; i < context.result.result_cnt; i++) {
mcast_record =
osmv_get_query_mc_rec(context.result.p_result_madw, i);
osm_dump_mc_record(&p_osmt->log, mcast_record, OSM_LOG_INFO);
}
}
/**********************************************************************
**********************************************************************/
static cl_status_t
__match_mgids(IN const void *const p_object, IN void *context)
{
ib_gid_t *p_mgid_context = (ib_gid_t *) context;
ib_gid_t *p_mgid_list_item = (ib_gid_t *) p_object;
int32_t count;
count = memcmp(p_mgid_context, p_mgid_list_item, sizeof(ib_gid_t));
if (count == 0)
return CL_SUCCESS;
else
return CL_NOT_FOUND;
}
/**********************************************************************
**********************************************************************/
ib_api_status_t osmt_query_mcast(IN osmtest_t * const p_osmt)
{
ib_api_status_t status = IB_SUCCESS;
osmv_user_query_t user;
osmv_query_req_t req;
osmtest_req_context_t context;
ib_member_rec_t *p_rec;
uint32_t i, num_recs = 0;
cl_list_t mgids_list;
cl_list_t *p_mgids_list;
cl_list_iterator_t p_mgids_res;
cl_status_t cl_status;
cl_map_item_t *p_item, *p_next_item;
osmtest_mgrp_t *p_mgrp;
OSM_LOG_ENTER(&p_osmt->log);
/*
* Do a blocking query for all Multicast Records in the subnet.
* The result is returned in the result field of the caller's
* context structure.
*
* The query structures are locals.
*/
memset(&req, 0, sizeof(req));
memset(&user, 0, sizeof(user));
context.p_osmt = p_osmt;
user.attr_id = IB_MAD_ATTR_MCMEMBER_RECORD;
user.attr_offset = ib_get_attr_offset(sizeof(ib_member_rec_t));
req.query_type = OSMV_QUERY_USER_DEFINED;
req.timeout_ms = p_osmt->opt.transaction_timeout;
req.retry_cnt = p_osmt->opt.retry_count;
req.flags = OSM_SA_FLAGS_SYNC;
req.query_context = &context;
req.pfn_query_cb = osmtest_query_res_cb;
req.p_query_input = &user;
status = osmv_query_sa(p_osmt->h_bind, &req);
if (status != IB_SUCCESS) {
OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0203: "
"ib_query failed (%s)\n", ib_get_err_str(status));
goto Exit;
}
status = context.result.status;
if (status != IB_SUCCESS) {
OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0264: "
"ib_query failed (%s)\n", ib_get_err_str(status));
if (status == IB_REMOTE_ERROR) {
OSM_LOG(&p_osmt->log, OSM_LOG_ERROR,
"Remote error = %s.\n",
ib_get_mad_status_str(osm_madw_get_mad_ptr
(context.result.
p_result_madw)));
}
goto Exit;
}
/* ok we have got something */
/* First Delete the old MGID Table */
p_next_item = cl_qmap_head(&p_osmt->exp_subn.mgrp_mlid_tbl);
while (p_next_item != cl_qmap_end(&p_osmt->exp_subn.mgrp_mlid_tbl)) {
p_item = p_next_item;
p_next_item = cl_qmap_next(p_item);
cl_qmap_remove_item(&p_osmt->exp_subn.mgrp_mlid_tbl, p_item);
free(p_item);
}
cl_list_construct(&mgids_list);
cl_list_init(&mgids_list, num_recs);
p_mgids_list = &mgids_list;
num_recs = context.result.result_cnt;
OSM_LOG(&p_osmt->log, OSM_LOG_VERBOSE, "Received %u records\n",
num_recs);
for (i = 0; i < num_recs; i++) {
p_rec = osmv_get_query_result(context.result.p_result_madw, i);
p_mgids_res =
cl_list_find_from_head(p_mgids_list, __match_mgids,
&(p_rec->mgid));
/* If returns iterator other than end of list, same mgid exists already */
if (p_mgids_res != cl_list_end(p_mgids_list)) {
char gid_str[INET6_ADDRSTRLEN];
OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0265: "
"MCG MGIDs are the same - invalid MGID : %s\n",
inet_ntop(AF_INET6, p_rec->mgid.raw, gid_str,
sizeof gid_str));
status = IB_ERROR;
goto Exit;
}
osm_dump_mc_record(&p_osmt->log, p_rec, OSM_LOG_VERBOSE);
cl_status = cl_list_insert_head(p_mgids_list, &(p_rec->mgid));
if (cl_status) {
OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0205: "
"Could not add MGID to cl_list\n");
status = IB_ERROR;
goto Exit;
}
p_mgrp = (osmtest_mgrp_t *) malloc(sizeof(*p_mgrp));
if (!p_mgrp) {
OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0204: "
"Could not allocate new MCG\n");
status = IB_ERROR;
goto Exit;
}
memcpy(&p_mgrp->mcmember_rec, p_rec,
sizeof(p_mgrp->mcmember_rec));
cl_qmap_insert(&p_osmt->exp_subn.mgrp_mlid_tbl,
cl_ntoh16(p_rec->mlid), &p_mgrp->map_item);
}
Exit:
if (context.result.p_result_madw != NULL) {
osm_mad_pool_put(&p_osmt->mad_pool,
context.result.p_result_madw);
context.result.p_result_madw = NULL;
}
OSM_LOG_EXIT(&p_osmt->log);
return (status);
}
/**********************************************************************
**********************************************************************/
/* given a multicast request send and wait for response. */
ib_api_status_t
osmt_send_mcast_request(IN osmtest_t * const p_osmt,
IN uint8_t is_set,
IN ib_member_rec_t * p_mc_req,
IN uint64_t comp_mask, OUT ib_sa_mad_t * p_res)
{
osmtest_req_context_t context;
ib_api_status_t status = IB_SUCCESS;
osmv_user_query_t user;
osmv_query_req_t req;
OSM_LOG_ENTER(&p_osmt->log);
/*
* Do a blocking query for this record in the subnet.
*
* The query structures are locals.
*/
memset(&req, 0, sizeof(req));
memset(&user, 0, sizeof(user));
memset(&context, 0, sizeof(context));
memset(p_res, 0, sizeof(ib_sa_mad_t));
context.p_osmt = p_osmt;
user.p_attr = p_mc_req;
user.comp_mask = comp_mask;
if (is_set == 1) {
req.query_type = OSMV_QUERY_UD_MULTICAST_SET;
} else if (is_set == 0) {
req.query_type = OSMV_QUERY_UD_MULTICAST_DELETE;
} else if (is_set == 0xee) {
OSM_LOG(&p_osmt->log, OSM_LOG_VERBOSE,
"Set USER DEFINED QUERY\n");
req.query_type = OSMV_QUERY_USER_DEFINED;
user.method = IB_MAD_METHOD_GET;
user.attr_id = IB_MAD_ATTR_MCMEMBER_RECORD;
user.attr_offset = ib_get_attr_offset(sizeof(ib_member_rec_t));
} else if (is_set == 0xff) {
OSM_LOG(&p_osmt->log, OSM_LOG_VERBOSE,
"Set USER DEFINED QUERY\n");
req.query_type = OSMV_QUERY_USER_DEFINED;
user.method = IB_MAD_METHOD_SET;
user.attr_id = IB_MAD_ATTR_MCMEMBER_RECORD;
user.attr_offset = ib_get_attr_offset(sizeof(ib_member_rec_t));
}
/* TODO : Check the validity of all user fields in order to use
OSMV_QUERY_USER_DEFINED
p_user_query = ( osmv_user_query_t * ) p_query_req->p_query_input;
if (p_user_query->method) sa_mad_data.method = p_user_query->method;
sa_mad_data.attr_offset = p_user_query->attr_offset;
sa_mad_data.attr_id = p_user_query->attr_id;
sa_mad_data.comp_mask = p_user_query->comp_mask;
sa_mad_data.p_attr = p_user_query->p_attr;
*/
req.timeout_ms = p_osmt->opt.transaction_timeout;
req.retry_cnt = p_osmt->opt.retry_count;
req.flags = OSM_SA_FLAGS_SYNC;
req.query_context = &context;
req.pfn_query_cb = osmtest_query_res_cb;
req.p_query_input = &user;
status = osmv_query_sa(p_osmt->h_bind, &req);
if (status != IB_SUCCESS) {
OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0206: "
"ib_query failed (%s)\n", ib_get_err_str(status));
goto Exit;
}
/* ok it worked */
memcpy(p_res,
osm_madw_get_mad_ptr(context.result.p_result_madw),
sizeof(ib_sa_mad_t));
status = context.result.status;
if (status != IB_SUCCESS) {
OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0224: "
"ib_query failed (%s)\n", ib_get_err_str(status));
if (status == IB_REMOTE_ERROR) {
OSM_LOG(&p_osmt->log, OSM_LOG_ERROR,
"Remote error = %s\n",
ib_get_mad_status_str(osm_madw_get_mad_ptr
(context.result.
p_result_madw)));
}
}
Exit:
/*
* Return the IB query MAD to the pool as necessary.
*/
if (context.result.p_result_madw != NULL) {
osm_mad_pool_put(&p_osmt->mad_pool,
context.result.p_result_madw);
context.result.p_result_madw = NULL;
}
OSM_LOG_EXIT(&p_osmt->log);
return (status);
}
/**********************************************************************
**********************************************************************/
void
osmt_init_mc_query_rec(IN osmtest_t * const p_osmt,
IN OUT ib_member_rec_t * p_mc_req)
{
/* use default values so we can change only what we want later */
memset(p_mc_req, 0, sizeof(ib_member_rec_t));
/* we leave the MGID to the user */
memcpy(&p_mc_req->port_gid.unicast.interface_id,
&p_osmt->local_port.port_guid,
sizeof(p_osmt->local_port.port_guid)
);
/* use our own subnet prefix: */
p_mc_req->port_gid.unicast.prefix = CL_HTON64(0xFE80000000000000ULL);
/* ib_net32_t qkey; */
/* ib_net16_t mlid; - we keep it zero for upper level to decide. */
/* uint8_t mtu; - keep it zero means - anything you have please. */
/* uint8_t tclass; can leave as zero for now (between subnets) */
/* ib_net16_t pkey; leave as zero */
p_mc_req->rate = IB_LINK_WIDTH_ACTIVE_4X;
/* uint8_t pkt_life; zero means greater than zero ... */
/* ib_net32_t sl_flow_hop; keep it all zeros */
/* we want to use a link local scope: 0x02 */
p_mc_req->scope_state = ib_member_set_scope_state(0x02, 0);
}
/***********************************************************************
* UD Multicast testing flow:
* o15.0.1.3:
* - Request new MCG with not enough components in comp_mask :
* ERR_INSUFFICIENT_COMPONENTS
* o15.0.1.8:
* - Request a join with irrelevant RATE and get a ERR_INVALID_REQ
* o15.0.1.4:
* - Create an MGID by asking for a join with MGID = 0
* providing P_Key, Q_Key, SL, FlowLabel, Tclass.
* o15.0.1.5:
* - Check the returned MGID is valid. (p 804)
* o15.0.1.6:
* - Create a new MCG with valid requested MGID.
* - Try to create a new MCG with invalid MGID : get back ERR_REQ_INVALID
* - Try again with MGID prefix = 0xA01B (maybe 0x1BA0 little or big ?)
* - Try to create again the already created group: ERR_REQ_INVALID
* o15.0.1.7 - implicitlly checked during the prev steps.
* o15.0.1.9
* - Create MCG with Invalid JoinState.FullMember != 1 : get ERR_REQ_INVALID
* o15.0.1.10 - can't check on a single client .
* o15.0.1.11:
* - Try to join into a MGID that exists with JoinState=SendOnlyMember -
* see that it updates JoinState. What is the routing change?
* - We can not check simple join since we have only one tester (for now)
* o15.0.1.12:
* - The last join should have a special treatment in the SA (sender only)
* but what is it ?
* o15.0.1.13:
* - Try joining with wrong rate - ERR_REQ_INVALID
* o15.0.1.14:
* - Try partial delete - actually updating the join state. check it.
* - Register by InformInfo flow to receive trap 67 on MCG delete.
* - Try full delete (JoinState and should be 0)
* - Wait for trap 67.
* - Try joining (not full mem) again to see the group was deleted.
* (should fail - o15.0.1.13)
* o15.0.1.15:
* - Try deletion of the IPoIB MCG and get: ERR_REQ_INVALID
* o15.0.1.16:
* - Try GetTable with PortGUID wildcarded and get back some groups.
***********************************************************************/
/* The following macro can be used only within the osmt_run_mcast_flow() function */
#define IS_IPOIB_MGID(p_mgid) \
( !memcmp(&osm_ipoib_good_mgid, (p_mgid), sizeof(osm_ipoib_good_mgid)) || \
!memcmp(&osm_ts_ipoib_good_mgid, (p_mgid), sizeof(osm_ts_ipoib_good_mgid)) )
ib_api_status_t osmt_run_mcast_flow(IN osmtest_t * const p_osmt)
{
char gid_str[INET6_ADDRSTRLEN];
char gid_str2[INET6_ADDRSTRLEN];
ib_api_status_t status;
ib_member_rec_t mc_req_rec;
ib_member_rec_t *p_mc_res;
ib_sa_mad_t res_sa_mad;
uint64_t comp_mask = 0;
ib_net64_t remote_port_guid = 0x0;
cl_qmap_t *p_mgrp_mlid_tbl;
osmtest_mgrp_t *p_mgrp;
ib_gid_t special_mgid, tmp_mgid, proxy_mgid;
ib_net16_t invalid_mlid = 0x0;
ib_net16_t max_mlid = cl_hton16(0xFFFE), tmp_mlid;
boolean_t ReachedMlidLimit = FALSE;
int start_cnt = 0, cnt, middle_cnt = 0, end_cnt = 0;
int start_ipoib_cnt = 0, end_ipoib_cnt = 0;
int mcg_outside_test_cnt = 0, fail_to_delete_mcg = 0;
osmtest_req_context_t context;
ib_node_record_t *p_rec;
uint32_t num_recs = 0, i;
uint8_t mtu_phys = 0, rate_phys = 0;
cl_map_t test_created_mlids; /* List of all mlids created in this test */
ib_member_rec_t *p_recvd_rec;
boolean_t got_error = FALSE;
static ib_gid_t good_mgid = {
{
0xFF, 0x12, 0xA0, 0x1C,
0xFE, 0x80, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x12, 0x34, 0x56, 0x78}
};
static ib_gid_t osm_ipoib_mgid = {
{
0xff, /* multicast field */
0x12, /* scope */
0x40, 0x1b, /* IPv4 signature */
0xff, 0xff, /* 16 bits of P_Key (to be filled in) */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 48 bits of zeros */
0xff, 0xff, 0xff, 0xee, /* 32 bit IPv4 broadcast address */
},
};
static ib_gid_t osm_ts_ipoib_good_mgid = {
{
0xff, /* multicast field */
0x12, /* non-permanent bit,scope */
0x40, 0x1b, /* IPv4 signature */
0xff, 0xff, /* 16 bits of P_Key (to be filled in) */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 48 bits of zeros */
0x00, 0x00, 0x00, 0x01, /* 32 bit IPv4 broadcast address */
},
};
static ib_gid_t osm_ipoib_good_mgid = {
{
0xff, /* multicast field */
0x12, /* non-permanent bit,scope */
0x40, 0x1b, /* IPv4 signature */
0xff, 0xff, /* 16 bits of P_Key (to be filled in) */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 48 bits of zeros */
0xff, 0xff, 0xff, 0xff, /* 32 bit IPv4 broadcast address */
},
};
static ib_gid_t osm_link_local_mgid = {
{
0xFF, 0x02, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x01},
};
OSM_LOG_ENTER(&p_osmt->log);
OSM_LOG(&p_osmt->log, OSM_LOG_INFO, "GetTable of all current MCGs...\n");
status = osmt_query_mcast(p_osmt);
if (status != IB_SUCCESS) {
OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 2FF "
"GetTable of all records has failed!\n");
goto Exit;
}
/* Initialize the test_created_mgrps map */
cl_map_construct(&test_created_mlids);
cl_map_init(&test_created_mlids, 1000);
p_mgrp_mlid_tbl = &p_osmt->exp_subn.mgrp_mlid_tbl;
osmt_init_mc_query_rec(p_osmt, &mc_req_rec);
p_mc_res = ib_sa_mad_get_payload_ptr(&res_sa_mad);
/* Only when we are on single mode check flow - do the count comparison, otherwise skip */
if (p_osmt->opt.mmode == 1 || p_osmt->opt.mmode == 3) {
start_cnt = cl_qmap_count(p_mgrp_mlid_tbl);
OSM_LOG(&p_osmt->log, OSM_LOG_INFO, "(start): "
"Number of MC Records found in SA DB is %d\n",
start_cnt);
}
/* This flow is being added due to bug discovered using SilverStorm stack -
The bug was initializing MCast with MTU & RATE min values that do
not match the subnet capability, even though that OpenSM
reponds with the correct value it does not store it in the MCG.
We want the check a join request to already existing group (ipoib)
without using MTU or RATE then getting response from OpenSM with
the correct values then join again with them and get IB_SUCCESS
all the way
*/
/* First validate IPoIB exist in the SA DB */
p_mgrp = (osmtest_mgrp_t *) cl_qmap_head(p_mgrp_mlid_tbl);
/* scan all available multicast groups in the DB and fill in the table */
while (p_mgrp != (osmtest_mgrp_t *) cl_qmap_end(p_mgrp_mlid_tbl)) {
/* search for ipoib mgid */
if (IS_IPOIB_MGID(&p_mgrp->mcmember_rec.mgid)) {
start_ipoib_cnt++;
} else {
OSM_LOG(&p_osmt->log, OSM_LOG_INFO,
"Non-IPoIB MC Groups exist: mgid=%s\n",
inet_ntop(AF_INET6,
p_mgrp->mcmember_rec.mgid.raw,
gid_str, sizeof gid_str));
mcg_outside_test_cnt++;
}
p_mgrp = (osmtest_mgrp_t *) cl_qmap_next(&p_mgrp->map_item);
}
OSM_LOG(&p_osmt->log, OSM_LOG_INFO,
"Found %d non-IPoIB MC Groups\n", mcg_outside_test_cnt);
if (start_ipoib_cnt) {
/* o15-0.2.4 - Check a join request to already created MCG */
OSM_LOG(&p_osmt->log, OSM_LOG_INFO,
"Found IPoIB MC Group, so we run SilverStorm Bug Flow...\n");
/* Try to join first like IPoIB of SilverStorm */
memcpy(&mc_req_rec.mgid, &osm_ipoib_good_mgid,
sizeof(ib_gid_t));
/* Request Join */
ib_member_set_join_state(&mc_req_rec,
IB_MC_REC_STATE_FULL_MEMBER);
comp_mask =
IB_MCR_COMPMASK_MGID | IB_MCR_COMPMASK_PORT_GID |
IB_MCR_COMPMASK_JOIN_STATE;
status = osmt_send_mcast_request(p_osmt, 0xff, /* User Defined query Set */
&mc_req_rec,
comp_mask, &res_sa_mad);
OSM_LOG(&p_osmt->log, OSM_LOG_INFO,
"Joining an existing IPoIB multicast group\n");
OSM_LOG(&p_osmt->log, OSM_LOG_INFO,
"Sent Join request with :\n\t\tport_gid=%s, mgid=%s\n"
"\t\tjoin state= 0x%x, response is : %s\n",
inet_ntop(AF_INET6, mc_req_rec.port_gid.raw,
gid_str, sizeof gid_str),
inet_ntop(AF_INET6, mc_req_rec.mgid.raw,
gid_str2, sizeof gid_str2),
(mc_req_rec.scope_state & 0x0F),
ib_get_err_str(status));
if (status != IB_SUCCESS) {
OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 02B3: "
"Failed joining existing IPoIB MCGroup - got %s\n",
ib_get_err_str(status));
goto Exit;
}
/* Check MTU & Rate Value and resend with SA suggested values */
p_mc_res = ib_sa_mad_get_payload_ptr(&res_sa_mad);
/* Prepare the mc_req_rec for the rest of the flow */
osmt_init_mc_query_rec(p_osmt, &mc_req_rec);
/*
We simulate the same situation as in SilverStorm - a response with the
exact RATE & MTU as the SA responded with. Actually the query
has included some more fields but we know that problem was
genereated by the RATE
*/
OSM_LOG(&p_osmt->log, OSM_LOG_INFO,
"Received attributes of MCG : \n\t\tMTU=0x%02X, RATE=0x%02X\n",
p_mc_res->mtu, p_mc_res->rate);
mc_req_rec.mtu = p_mc_res->mtu;
mc_req_rec.rate = p_mc_res->rate;
/* Set feasible mtu & rate that will allow check the
exact statement of OpenSM */
mtu_phys = p_mc_res->mtu;
rate_phys = p_mc_res->rate;
memcpy(&mc_req_rec.mgid, &osm_ipoib_good_mgid,
sizeof(ib_gid_t));
/* Request Join */
ib_member_set_join_state(&mc_req_rec,
IB_MC_REC_STATE_FULL_MEMBER);
comp_mask =
IB_MCR_COMPMASK_MGID | IB_MCR_COMPMASK_PORT_GID |
IB_MCR_COMPMASK_JOIN_STATE | IB_MCR_COMPMASK_MTU_SEL |
IB_MCR_COMPMASK_MTU | IB_MCR_COMPMASK_RATE_SEL |
IB_MCR_COMPMASK_RATE;
OSM_LOG(&p_osmt->log, OSM_LOG_INFO,
"Sending attributes of MCG : \n\t\tMTU=0x%02X, RATE=0x%02X\n",
mc_req_rec.mtu, mc_req_rec.rate);
status = osmt_send_mcast_request(p_osmt, 0xff, /* User Defined query */
&mc_req_rec,
comp_mask, &res_sa_mad);
OSM_LOG(&p_osmt->log, OSM_LOG_INFO,
"Sent Join request using response values, response is : %s\n",
ib_get_err_str(status));
if (status != IB_SUCCESS) {
OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 02EF: "
"Query as Full Member of already existing "
"ipoib group gid %s has failed\n",
inet_ntop(AF_INET6, mc_req_rec.mgid.raw,
gid_str, sizeof gid_str));
goto Exit;
}
/* We do not want to leave the MCG since its IPoIB */
}
/**************************************************************************/
/* Check Get with invalid mlid */
OSM_LOG(&p_osmt->log, OSM_LOG_INFO,
"Checking Get with invalid mlid...\n");
/* Request Get */
ib_member_set_join_state(&mc_req_rec, IB_MC_REC_STATE_FULL_MEMBER);
mc_req_rec.mlid = invalid_mlid;
comp_mask = IB_MCR_COMPMASK_MLID;
OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, EXPECTING_ERRORS_START "\n");
status = osmt_send_mcast_request(p_osmt, 0xee, /* User Defined query Get */
&mc_req_rec, comp_mask, &res_sa_mad);
OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, EXPECTING_ERRORS_END "\n");
if (status == IB_SUCCESS) {
OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 2E0 "
"SubnAdmGet with invalid mlid 0x%x succeeded\n",
cl_ntoh16(mc_req_rec.mlid));
status = IB_ERROR;
goto Exit;
}
/* Prepare the mc_req_rec for the rest of the flow */
osmt_init_mc_query_rec(p_osmt, &mc_req_rec);
/**************************************************************************/
/* Check Get with invalid port guid */
OSM_LOG(&p_osmt->log, OSM_LOG_INFO,
"Checking Get with invalid port guid (0x0) but valid interface ID : 0x%"
PRIx64 "...\n",
cl_ntoh64(mc_req_rec.port_gid.unicast.interface_id));
/* Request Get */
ib_member_set_join_state(&mc_req_rec, IB_MC_REC_STATE_FULL_MEMBER);
memset(&mc_req_rec.port_gid.unicast.interface_id, 0,
sizeof(ib_net64_t));
comp_mask = IB_MCR_COMPMASK_GID;
OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, EXPECTING_ERRORS_START "\n");
status = osmt_send_mcast_request(p_osmt, 0xee, /* User Defined query Get */
&mc_req_rec, comp_mask, &res_sa_mad);
OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, EXPECTING_ERRORS_END "\n");
if (status == IB_SUCCESS) {
OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 2E4 "
"SubnAdmGet with invalid port guid succeeded\n");
status = IB_ERROR;
goto Exit;
}
/* Prepare the mc_req_rec for the rest of the flow */
osmt_init_mc_query_rec(p_osmt, &mc_req_rec);
/**************************************************************************/
/* o15.0.1.3: */
/* - Request Join with insufficient comp_mask */
OSM_LOG(&p_osmt->log, OSM_LOG_INFO,
"Checking Join with insufficient comp mask qkey & pkey (o15.0.1.3)...\n");
/* no MGID */
memset(&mc_req_rec.mgid, 0, sizeof(ib_gid_t));
/* Request Join */
ib_member_set_join_state(&mc_req_rec, IB_MC_REC_STATE_FULL_MEMBER);
comp_mask = IB_MCR_COMPMASK_MGID | IB_MCR_COMPMASK_PORT_GID |
/* IB_MCR_COMPMASK_QKEY | */
/* IB_MCR_COMPMASK_PKEY | intentionaly missed to raise the error */
IB_MCR_COMPMASK_SL | IB_MCR_COMPMASK_FLOW | IB_MCR_COMPMASK_JOIN_STATE | IB_MCR_COMPMASK_TCLASS | /* all above are required */
IB_MCR_COMPMASK_RATE_SEL | IB_MCR_COMPMASK_RATE;
OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, EXPECTING_ERRORS_START "\n");
status = osmt_send_mcast_request(p_osmt, 1,
&mc_req_rec, comp_mask, &res_sa_mad);
OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, EXPECTING_ERRORS_END "\n");
if (status != IB_REMOTE_ERROR ||
((ib_net16_t) (res_sa_mad.status & IB_SMP_STATUS_MASK)) !=
IB_SA_MAD_STATUS_INSUF_COMPS) {
OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 02EE: "
"Expectedd REMOTE ERROR IB_SA_MAD_STATUS_INSUF_COMPS got:%s/%s\n",
ib_get_err_str(status),
ib_get_mad_status_str((ib_mad_t *) (&res_sa_mad)));
status = IB_ERROR;
goto Exit;
}
OSM_LOG(&p_osmt->log, OSM_LOG_INFO,
"Checking Join with insufficient comp mask - sl (15.0.1.3)...\n");
/* no MGID */
memset(&mc_req_rec.mgid, 0, sizeof(ib_gid_t));
/* Request Join */
ib_member_set_join_state(&mc_req_rec, IB_MC_REC_STATE_FULL_MEMBER);
comp_mask =
IB_MCR_COMPMASK_MGID |
IB_MCR_COMPMASK_PORT_GID |
IB_MCR_COMPMASK_QKEY | IB_MCR_COMPMASK_PKEY |
/* IB_MCR_COMPMASK_SL | */
IB_MCR_COMPMASK_FLOW | IB_MCR_COMPMASK_JOIN_STATE | IB_MCR_COMPMASK_TCLASS | /* all above are required */
IB_MCR_COMPMASK_RATE_SEL | IB_MCR_COMPMASK_RATE;
OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, EXPECTING_ERRORS_START "\n");
status = osmt_send_mcast_request(p_osmt, 1,
&mc_req_rec, comp_mask, &res_sa_mad);
OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, EXPECTING_ERRORS_END "\n");
if (status != IB_REMOTE_ERROR ||
((ib_net16_t) (res_sa_mad.status & IB_SMP_STATUS_MASK)) !=
IB_SA_MAD_STATUS_INSUF_COMPS) {
OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 02ED: "
"Expectedd REMOTE ERROR IB_SA_MAD_STATUS_INSUF_COMPS got:%s/%s\n",
ib_get_err_str(status),
ib_get_mad_status_str((ib_mad_t *) (&res_sa_mad)));
status = IB_ERROR;
goto Exit;
}
osmt_init_mc_query_rec(p_osmt, &mc_req_rec);
/* no MGID */
memset(&mc_req_rec.mgid, 0, sizeof(ib_gid_t));
mc_req_rec.mgid.raw[15] = 0x01;
p_mc_res = ib_sa_mad_get_payload_ptr(&res_sa_mad);
OSM_LOG(&p_osmt->log, OSM_LOG_INFO,
"Checking Join with insufficient comp mask - flow label (o15.0.1.3)...\n");
/* Request Join */
ib_member_set_join_state(&mc_req_rec, IB_MC_REC_STATE_FULL_MEMBER);
comp_mask =
IB_MCR_COMPMASK_MGID |
IB_MCR_COMPMASK_PORT_GID |
IB_MCR_COMPMASK_QKEY | IB_MCR_COMPMASK_PKEY | IB_MCR_COMPMASK_SL |
/* IB_MCR_COMPMASK_FLOW | intentionaly missed to raise the error */
IB_MCR_COMPMASK_JOIN_STATE | IB_MCR_COMPMASK_TCLASS | /* all above are required */
IB_MCR_COMPMASK_RATE_SEL | IB_MCR_COMPMASK_RATE;
OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, EXPECTING_ERRORS_START "\n");
status = osmt_send_mcast_request(p_osmt, 1,
&mc_req_rec, comp_mask, &res_sa_mad);
OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, EXPECTING_ERRORS_END "\n");
if (status != IB_REMOTE_ERROR ||
((ib_net16_t) (res_sa_mad.status & IB_SMP_STATUS_MASK)) !=
IB_SA_MAD_STATUS_INSUF_COMPS) {
OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 02EC: "
"Expected REMOTE ERROR IB_SA_MAD_STATUS_INSUF_COMPS got:%s/%s\n",
ib_get_err_str(status),
ib_get_mad_status_str((ib_mad_t *) (&res_sa_mad)));
status = IB_ERROR;
goto Exit;
}
osmt_init_mc_query_rec(p_osmt, &mc_req_rec);
p_mc_res = ib_sa_mad_get_payload_ptr(&res_sa_mad);
OSM_LOG(&p_osmt->log, OSM_LOG_INFO,
"Checking Join with insufficient comp mask - tclass (o15.0.1.3)...\n");
/* Request Join */
ib_member_set_join_state(&mc_req_rec, IB_MC_REC_STATE_FULL_MEMBER);
comp_mask =
IB_MCR_COMPMASK_MGID |
IB_MCR_COMPMASK_PORT_GID |
IB_MCR_COMPMASK_QKEY |
IB_MCR_COMPMASK_PKEY |
IB_MCR_COMPMASK_SL |
IB_MCR_COMPMASK_FLOW | IB_MCR_COMPMASK_JOIN_STATE |
/* IB_MCR_COMPMASK_TCLASS | Intentionally missed to raise an error */
IB_MCR_COMPMASK_RATE_SEL | IB_MCR_COMPMASK_RATE;
OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, EXPECTING_ERRORS_START "\n");
status = osmt_send_mcast_request(p_osmt, 1,
&mc_req_rec, comp_mask, &res_sa_mad);
OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, EXPECTING_ERRORS_END "\n");
if (status != IB_REMOTE_ERROR ||
((ib_net16_t) (res_sa_mad.status & IB_SMP_STATUS_MASK)) !=
IB_SA_MAD_STATUS_INSUF_COMPS) {
OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 02EA: "
"Expected REMOTE ERROR IB_SA_MAD_STATUS_INSUF_COMPS got:%s/%s\n",
ib_get_err_str(status),
ib_get_mad_status_str((ib_mad_t *) (&res_sa_mad)));
status = IB_ERROR;
goto Exit;
}
osmt_init_mc_query_rec(p_osmt, &mc_req_rec);
p_mc_res = ib_sa_mad_get_payload_ptr(&res_sa_mad);
OSM_LOG(&p_osmt->log, OSM_LOG_INFO,
"Checking Join with insufficient comp mask - tclass qkey (o15.0.1.3)...\n");
/* no MGID */
/* memset(&mc_req_rec.mgid, 0, sizeof(ib_gid_t)); */
/* Request Join */
ib_member_set_join_state(&mc_req_rec, IB_MC_REC_STATE_FULL_MEMBER);
comp_mask = IB_MCR_COMPMASK_MGID | IB_MCR_COMPMASK_PORT_GID |
/* IB_MCR_COMPMASK_QKEY | intentionaly missed to raise the error */
IB_MCR_COMPMASK_PKEY |
IB_MCR_COMPMASK_SL |
IB_MCR_COMPMASK_FLOW | IB_MCR_COMPMASK_JOIN_STATE |
/* IB_MCR_COMPMASK_TCLASS | intentionaly missed to raise the error */
IB_MCR_COMPMASK_RATE_SEL | IB_MCR_COMPMASK_RATE;
OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, EXPECTING_ERRORS_START "\n");
status = osmt_send_mcast_request(p_osmt, 1,
&mc_req_rec, comp_mask, &res_sa_mad);
OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, EXPECTING_ERRORS_END "\n");
if (status != IB_REMOTE_ERROR ||
((ib_net16_t) (res_sa_mad.status & IB_SMP_STATUS_MASK)) !=
IB_SA_MAD_STATUS_INSUF_COMPS) {
OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 02E9: "
"Expected REMOTE ERROR IB_SA_MAD_STATUS_INSUF_COMPS got:%s/%s\n",
ib_get_err_str(status),
ib_get_mad_status_str((ib_mad_t *) (&res_sa_mad)));
status = IB_ERROR;
goto Exit;
}
/* o15.0.1.8: */
/* - Request join with irrelevant RATE : get a ERR_INSUFFICIENT_COMPONENTS */
OSM_LOG(&p_osmt->log, OSM_LOG_INFO,
"Checking Join with unrealistic rate (o15.0.1.8)...\n");
/* impossible requested rate */
mc_req_rec.rate =
IB_LINK_WIDTH_ACTIVE_12X | IB_PATH_SELECTOR_GREATER_THAN << 6;
comp_mask = IB_MCR_COMPMASK_GID | IB_MCR_COMPMASK_PORT_GID | IB_MCR_COMPMASK_QKEY | IB_MCR_COMPMASK_PKEY | IB_MCR_COMPMASK_SL | IB_MCR_COMPMASK_FLOW | IB_MCR_COMPMASK_JOIN_STATE | IB_MCR_COMPMASK_TCLASS | /* all above are required */
IB_MCR_COMPMASK_RATE_SEL | IB_MCR_COMPMASK_RATE;
OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, EXPECTING_ERRORS_START "\n");
status = osmt_send_mcast_request(p_osmt, 1,
&mc_req_rec, comp_mask, &res_sa_mad);
OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, EXPECTING_ERRORS_END "\n");
if (status != IB_REMOTE_ERROR ||
res_sa_mad.status != IB_SA_MAD_STATUS_REQ_INVALID) {
OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0207: "
"Expected REMOTE ERROR IB_SA_MAD_STATUS_REQ_INVALID got:%s/%s\n",
ib_get_err_str(status),
ib_get_mad_status_str((ib_mad_t *) (&res_sa_mad)));
status = IB_ERROR;
goto Exit;
}
/* Check Valid value which is unreasonable now */
OSM_LOG(&p_osmt->log, OSM_LOG_INFO,
"Checking Join with unrealistic rate 120GB (o15.0.1.8)...\n");
/* impossible requested rate */
mc_req_rec.rate =
IB_PATH_RECORD_RATE_120_GBS | IB_PATH_SELECTOR_GREATER_THAN << 6;
comp_mask = IB_MCR_COMPMASK_GID | IB_MCR_COMPMASK_PORT_GID | IB_MCR_COMPMASK_QKEY | IB_MCR_COMPMASK_PKEY | IB_MCR_COMPMASK_SL | IB_MCR_COMPMASK_FLOW | IB_MCR_COMPMASK_JOIN_STATE | IB_MCR_COMPMASK_TCLASS | /* all above are required */
IB_MCR_COMPMASK_RATE_SEL | IB_MCR_COMPMASK_RATE;
OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, EXPECTING_ERRORS_START "\n");
status = osmt_send_mcast_request(p_osmt, 1,
&mc_req_rec, comp_mask, &res_sa_mad);
OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, EXPECTING_ERRORS_END "\n");
if (status != IB_REMOTE_ERROR ||
res_sa_mad.status != IB_SA_MAD_STATUS_REQ_INVALID) {
OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0208: "
"Expected REMOTE ERROR IB_SA_MAD_STATUS_REQ_INVALID got:%s/%s\n",
ib_get_err_str(status),
ib_get_mad_status_str((ib_mad_t *) (&res_sa_mad)));
status = IB_ERROR;
goto Exit;
}
/* Check Valid value which is unreasonable now */
OSM_LOG(&p_osmt->log, OSM_LOG_INFO,
"Checking Join with less than min rate 2.5GB (o15.0.1.8)...\n");
/* impossible requested rate */
mc_req_rec.rate =
IB_PATH_RECORD_RATE_2_5_GBS | IB_PATH_SELECTOR_LESS_THAN << 6;
comp_mask = IB_MCR_COMPMASK_GID | IB_MCR_COMPMASK_PORT_GID | IB_MCR_COMPMASK_QKEY | IB_MCR_COMPMASK_PKEY | IB_MCR_COMPMASK_SL | IB_MCR_COMPMASK_FLOW | IB_MCR_COMPMASK_JOIN_STATE | IB_MCR_COMPMASK_TCLASS | /* all above are required */
IB_MCR_COMPMASK_RATE_SEL | IB_MCR_COMPMASK_RATE;
OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, EXPECTING_ERRORS_START "\n");
status = osmt_send_mcast_request(p_osmt, 1,
&mc_req_rec, comp_mask, &res_sa_mad);
OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, EXPECTING_ERRORS_END "\n");
if (status != IB_REMOTE_ERROR ||
res_sa_mad.status != IB_SA_MAD_STATUS_REQ_INVALID) {
OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 02AB: "
"Expected REMOTE ERROR IB_SA_MAD_STATUS_REQ_INVALID got:%s/%s\n",
ib_get_err_str(status),
ib_get_mad_status_str((ib_mad_t *) (&res_sa_mad)));
status = IB_ERROR;
goto Exit;
}
/* Checking above max value of MTU which is impossible */
OSM_LOG(&p_osmt->log, OSM_LOG_INFO,
"Checking Join with unrealistic mtu : \n\t\tmore than 4096 -"
" max (o15.0.1.8)...\n");
/* impossible requested mtu */
mc_req_rec.mtu = IB_MTU_LEN_4096 | IB_PATH_SELECTOR_GREATER_THAN << 6;
comp_mask = IB_MCR_COMPMASK_GID | IB_MCR_COMPMASK_PORT_GID | IB_MCR_COMPMASK_QKEY | IB_MCR_COMPMASK_PKEY | IB_MCR_COMPMASK_SL | IB_MCR_COMPMASK_FLOW | IB_MCR_COMPMASK_JOIN_STATE | IB_MCR_COMPMASK_TCLASS | /* all above are required */
IB_MCR_COMPMASK_MTU_SEL | IB_MCR_COMPMASK_MTU;
OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, EXPECTING_ERRORS_START "\n");
status = osmt_send_mcast_request(p_osmt, 1,
&mc_req_rec, comp_mask, &res_sa_mad);
OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, EXPECTING_ERRORS_END "\n");
if (status != IB_REMOTE_ERROR ||
res_sa_mad.status != IB_SA_MAD_STATUS_REQ_INVALID) {
OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 02AC: "
"Expected REMOTE ERROR IB_SA_MAD_STATUS_REQ_INVALID got:%s/%s\n",
ib_get_err_str(status),
ib_get_mad_status_str((ib_mad_t *) (&res_sa_mad))
);
status = IB_ERROR;
goto Exit;
}
/* Checking below min value of MTU which is impossible */
OSM_LOG(&p_osmt->log, OSM_LOG_INFO,
"Checking Join with unrealistic mtu : \n\t\tless than 256 -"
" min (o15.0.1.8)...\n");
/* impossible requested mtu */
mc_req_rec.mtu = IB_MTU_LEN_256 | IB_PATH_SELECTOR_LESS_THAN << 6;
comp_mask = IB_MCR_COMPMASK_GID | IB_MCR_COMPMASK_PORT_GID | IB_MCR_COMPMASK_QKEY | IB_MCR_COMPMASK_PKEY | IB_MCR_COMPMASK_SL | IB_MCR_COMPMASK_FLOW | IB_MCR_COMPMASK_JOIN_STATE | IB_MCR_COMPMASK_TCLASS | /* all above are required */
IB_MCR_COMPMASK_MTU_SEL | IB_MCR_COMPMASK_MTU;
OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, EXPECTING_ERRORS_START "\n");
status = osmt_send_mcast_request(p_osmt, 1,
&mc_req_rec, comp_mask, &res_sa_mad);
OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, EXPECTING_ERRORS_END "\n");
if (status != IB_REMOTE_ERROR ||
res_sa_mad.status != IB_SA_MAD_STATUS_REQ_INVALID) {
OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 02AD: "
"Expected REMOTE ERROR IB_SA_MAD_STATUS_REQ_INVALID got:%s/%s\n",
ib_get_err_str(status),
ib_get_mad_status_str((ib_mad_t *) (&res_sa_mad)));
status = IB_ERROR;
goto Exit;
}
OSM_LOG(&p_osmt->log, OSM_LOG_INFO,
"Checking Join with unrealistic mtu (o15.0.1.8)...\n");
/* impossible requested mtu */
mc_req_rec.mtu = 0x6 | IB_PATH_SELECTOR_GREATER_THAN << 6;
comp_mask = IB_MCR_COMPMASK_GID | IB_MCR_COMPMASK_PORT_GID | IB_MCR_COMPMASK_QKEY | IB_MCR_COMPMASK_PKEY | IB_MCR_COMPMASK_SL | IB_MCR_COMPMASK_FLOW | IB_MCR_COMPMASK_JOIN_STATE | IB_MCR_COMPMASK_TCLASS | /* all above are required */
IB_MCR_COMPMASK_MTU_SEL | IB_MCR_COMPMASK_MTU;
OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, EXPECTING_ERRORS_START "\n");
status = osmt_send_mcast_request(p_osmt, 1,
&mc_req_rec, comp_mask, &res_sa_mad);
OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, EXPECTING_ERRORS_END "\n");
if (status != IB_REMOTE_ERROR ||
res_sa_mad.status != IB_SA_MAD_STATUS_REQ_INVALID) {
OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 02AE: "
"Expected REMOTE ERROR IB_SA_MAD_STATUS_REQ_INVALID got:%s/%s\n",
ib_get_err_str(status),
ib_get_mad_status_str((ib_mad_t *) (&res_sa_mad)));
status = IB_ERROR;
goto Exit;
}
#if 0
/* Currently PacketLifeTime isn't checked in opensm */
/* Check PacketLifeTime as 0 */
OSM_LOG(&p_osmt->log, OSM_LOG_INFO,
"Checking Create with unrealistic packet life value less than 0 (o15.0.1.8)...\n");
/* impossible requested packet life */
mc_req_rec.pkt_life = 0 | IB_PATH_SELECTOR_LESS_THAN << 6;
comp_mask = IB_MCR_COMPMASK_GID | IB_MCR_COMPMASK_PORT_GID | IB_MCR_COMPMASK_QKEY | IB_MCR_COMPMASK_PKEY | IB_MCR_COMPMASK_SL | IB_MCR_COMPMASK_FLOW | IB_MCR_COMPMASK_JOIN_STATE | IB_MCR_COMPMASK_TCLASS | /* all above are required */
IB_MCR_COMPMASK_LIFE | IB_MCR_COMPMASK_LIFE_SEL;
OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, EXPECTING_ERRORS_START "\n");
status = osmt_send_mcast_request(p_osmt, 1,
&mc_req_rec, comp_mask, &res_sa_mad);
OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, EXPECTING_ERRORS_END "\n");
if (status != IB_REMOTE_ERROR ||
res_sa_mad.status != IB_SA_MAD_STATUS_REQ_INVALID) {
OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 02AF: "
"Expected REMOTE ERROR IB_SA_MAD_STATUS_REQ_INVALID got:%s/%s\n",
ib_get_err_str(status),
ib_get_mad_status_str((ib_mad_t *) (&res_sa_mad)));
status = IB_ERROR;
goto Exit;
}
#endif
/* o15.0.1.4: */
/* - Create an MGID by asking for a join with MGID = 0 */
/* providing P_Key, Q_Key, SL, FlowLabel, Tclass. */
OSM_LOG(&p_osmt->log, OSM_LOG_INFO,
"Checking Create given MGID=0 skip service level (o15.0.1.4)...\n");
osmt_init_mc_query_rec(p_osmt, &mc_req_rec);
p_mc_res = ib_sa_mad_get_payload_ptr(&res_sa_mad);
/* no MGID */
memset(&mc_req_rec.mgid, 0, sizeof(ib_gid_t));
/* Request Join */
ib_member_set_join_state(&mc_req_rec, IB_MC_REC_STATE_FULL_MEMBER);
comp_mask =
IB_MCR_COMPMASK_MGID |
IB_MCR_COMPMASK_PORT_GID |
IB_MCR_COMPMASK_QKEY | IB_MCR_COMPMASK_PKEY |
/* IB_MCR_COMPMASK_SL | Intentionally missed */
IB_MCR_COMPMASK_FLOW | IB_MCR_COMPMASK_JOIN_STATE | IB_MCR_COMPMASK_TCLASS | /* all above are required */
IB_MCR_COMPMASK_RATE_SEL | IB_MCR_COMPMASK_RATE;
OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, EXPECTING_ERRORS_START "\n");
status = osmt_send_mcast_request(p_osmt, 1,
&mc_req_rec, comp_mask, &res_sa_mad);
OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, EXPECTING_ERRORS_END "\n");
if (status != IB_REMOTE_ERROR ||
((ib_net16_t) (res_sa_mad.status & IB_SMP_STATUS_MASK)) !=
IB_SA_MAD_STATUS_INSUF_COMPS) {
OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 02A8: "
"Expected REMOTE ERROR IB_SA_MAD_STATUS_INSUF_COMPS got:%s/%s\n",
ib_get_err_str(status),
ib_get_mad_status_str((ib_mad_t *) (&res_sa_mad)));
status = IB_ERROR;
goto Exit;
}
/* Check that no same MCG in the SMDB */
status = osmt_query_mcast(p_osmt);
if (status != IB_SUCCESS) {
OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 02AA: "
"Could not get all MC Records in subnet, got:%s/%s\n",
ib_get_err_str(status),
ib_get_mad_status_str((ib_mad_t *) (&res_sa_mad)));
goto Exit;
}
/* Only when we are on single mode check flow - do the count comparison, otherwise skip */
if (p_osmt->opt.mmode == 1 || p_osmt->opt.mmode == 3) {
middle_cnt = cl_qmap_count(&p_osmt->exp_subn.mgrp_mlid_tbl);
OSM_LOG(&p_osmt->log, OSM_LOG_INFO, "(post false create): "
"Number of MC Records found in SA DB is %d\n",
middle_cnt);
if (middle_cnt != start_cnt) {
OSM_LOG(&p_osmt->log, OSM_LOG_INFO,
"Got different number of records stored in SA DB (before any creation)\n"
"Instead of %d got %d\n", start_cnt,
middle_cnt);
}
}
OSM_LOG(&p_osmt->log, OSM_LOG_INFO,
"Checking Create given MGID=0 skip Qkey and Pkey (o15.0.1.4)...\n");
osmt_init_mc_query_rec(p_osmt, &mc_req_rec);
p_mc_res = ib_sa_mad_get_payload_ptr(&res_sa_mad);
/* no MGID */
memset(&mc_req_rec.mgid, 0, sizeof(ib_gid_t));
/* Request Join */
ib_member_set_join_state(&mc_req_rec, IB_MC_REC_STATE_FULL_MEMBER);
comp_mask = IB_MCR_COMPMASK_MGID | IB_MCR_COMPMASK_PORT_GID |
/* IB_MCR_COMPMASK_QKEY | */
/* IB_MCR_COMPMASK_PKEY | Intentionally missed */
IB_MCR_COMPMASK_SL | IB_MCR_COMPMASK_FLOW | IB_MCR_COMPMASK_JOIN_STATE | IB_MCR_COMPMASK_TCLASS | /* all above are required */
IB_MCR_COMPMASK_RATE_SEL | IB_MCR_COMPMASK_RATE;
OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, EXPECTING_ERRORS_START "\n");
status = osmt_send_mcast_request(p_osmt, 1,
&mc_req_rec, comp_mask, &res_sa_mad);
OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, EXPECTING_ERRORS_END "\n");
if (status != IB_REMOTE_ERROR ||
((ib_net16_t) (res_sa_mad.status & IB_SMP_STATUS_MASK)) !=
IB_SA_MAD_STATUS_INSUF_COMPS) {
OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 02A7: "
"Expected REMOTE ERROR IB_SA_MAD_STATUS_INSUF_COMPS got:%s/%s\n",
ib_get_err_str(status),
ib_get_mad_status_str((ib_mad_t *) (&res_sa_mad)));
status = IB_ERROR;
goto Exit;
}
/* Bad Query o15.0.1.4 */
status = osmt_query_mcast(p_osmt);
OSM_LOG(&p_osmt->log, OSM_LOG_INFO,
"Checking Create given MGID=0 skip TClass (o15.0.1.4)...\n");
osmt_init_mc_query_rec(p_osmt, &mc_req_rec);
p_mc_res = ib_sa_mad_get_payload_ptr(&res_sa_mad);
/* no MGID */
memset(&mc_req_rec.mgid, 0, sizeof(ib_gid_t));
/* Request Join */
ib_member_set_join_state(&mc_req_rec, IB_MC_REC_STATE_FULL_MEMBER);
comp_mask =
IB_MCR_COMPMASK_MGID |
IB_MCR_COMPMASK_PORT_GID |
IB_MCR_COMPMASK_QKEY |
IB_MCR_COMPMASK_PKEY |
IB_MCR_COMPMASK_SL |
IB_MCR_COMPMASK_FLOW | IB_MCR_COMPMASK_JOIN_STATE |
/* IB_MCR_COMPMASK_TCLASS | Intentionally missed */
/* all above are required */
IB_MCR_COMPMASK_RATE_SEL | IB_MCR_COMPMASK_RATE;
OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, EXPECTING_ERRORS_START "\n");
status = osmt_send_mcast_request(p_osmt, 1,
&mc_req_rec, comp_mask, &res_sa_mad);
OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, EXPECTING_ERRORS_END "\n");
if (status != IB_REMOTE_ERROR ||
((ib_net16_t) (res_sa_mad.status & IB_SMP_STATUS_MASK)) !=
IB_SA_MAD_STATUS_INSUF_COMPS) {
OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 02A6: "
"Expected REMOTE ERROR IB_SA_MAD_STATUS_INSUF_COMPS got:%s/%s\n",
ib_get_err_str(status),
ib_get_mad_status_str((ib_mad_t *) (&res_sa_mad)));
status = IB_ERROR;
goto Exit;
}
OSM_LOG(&p_osmt->log, OSM_LOG_INFO,
"Checking Create given MGID=0 valid Set several options :\n\t\t"
"First above min RATE, Second less than max RATE\n\t\t"
"Third above min MTU, Second less than max MTU\n\t\t"
"Fifth exact MTU & RATE feasible, Sixth exact RATE feasible\n\t\t"
"Seventh exact MTU feasible (o15.0.1.4)...\n");
/* Good Flow - mgid is 0 while giving all required fields for join : P_Key, Q_Key, SL, FlowLabel, Tclass */
mc_req_rec.rate =
IB_LINK_WIDTH_ACTIVE_1X | IB_PATH_SELECTOR_GREATER_THAN << 6;
comp_mask = IB_MCR_COMPMASK_MGID | IB_MCR_COMPMASK_PORT_GID | IB_MCR_COMPMASK_QKEY | IB_MCR_COMPMASK_PKEY | IB_MCR_COMPMASK_SL | IB_MCR_COMPMASK_FLOW | IB_MCR_COMPMASK_JOIN_STATE | IB_MCR_COMPMASK_TCLASS | /* all above are required */
IB_MCR_COMPMASK_RATE_SEL | IB_MCR_COMPMASK_RATE;
status = osmt_send_mcast_request(p_osmt, 1,
&mc_req_rec, comp_mask, &res_sa_mad);
if (status != IB_SUCCESS) {
OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 02A5: "
"Failed to create MCG for MGID=0 with higher than minimum RATE - got %s/%s\n",
ib_get_err_str(status),
ib_get_mad_status_str((ib_mad_t *) (&res_sa_mad)));
goto Exit;
}
/* Save the mlid created in test_created_mlids map */
p_recvd_rec =
(ib_member_rec_t *) ib_sa_mad_get_payload_ptr(&res_sa_mad);
OSM_LOG(&p_osmt->log, OSM_LOG_VERBOSE, "created MGID:%s MLID:0x%04X\n",
inet_ntop(AF_INET6, p_recvd_rec->mgid.raw, gid_str,
sizeof gid_str), cl_ntoh16(p_recvd_rec->mlid));
cl_map_insert(&test_created_mlids, cl_ntoh16(p_recvd_rec->mlid),
p_recvd_rec);
/* Good Flow - mgid is 0 while giving all required fields for join : P_Key, Q_Key, SL, FlowLabel, Tclass */
mc_req_rec.rate =
IB_LINK_WIDTH_ACTIVE_12X | IB_PATH_SELECTOR_LESS_THAN << 6;
comp_mask = IB_MCR_COMPMASK_MGID | IB_MCR_COMPMASK_PORT_GID | IB_MCR_COMPMASK_QKEY | IB_MCR_COMPMASK_PKEY | IB_MCR_COMPMASK_SL | IB_MCR_COMPMASK_FLOW | IB_MCR_COMPMASK_JOIN_STATE | IB_MCR_COMPMASK_TCLASS | /* all above are required */
IB_MCR_COMPMASK_RATE_SEL | IB_MCR_COMPMASK_RATE;
status = osmt_send_mcast_request(p_osmt, 1,
&mc_req_rec, comp_mask, &res_sa_mad);
if (status != IB_SUCCESS) {
OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0211: "
"Failed to create MCG for MGID=0 with less than highest RATE - got %s/%s\n",
ib_get_err_str(status),
ib_get_mad_status_str((ib_mad_t *) (&res_sa_mad)));
goto Exit;
}
/* Save the mlid created in test_created_mlids map */
p_recvd_rec =
(ib_member_rec_t *) ib_sa_mad_get_payload_ptr(&res_sa_mad);
OSM_LOG(&p_osmt->log, OSM_LOG_VERBOSE, "Created MGID:%s MLID:0x%04X\n",
inet_ntop(AF_INET6, p_recvd_rec->mgid.raw, gid_str,
sizeof gid_str), cl_ntoh16(p_recvd_rec->mlid));
cl_map_insert(&test_created_mlids, cl_ntoh16(p_recvd_rec->mlid),
p_recvd_rec);
/* Good Flow - mgid is 0 while giving all required fields for join : P_Key, Q_Key, SL, FlowLabel, Tclass */
mc_req_rec.mtu = IB_MTU_LEN_4096 | IB_PATH_SELECTOR_LESS_THAN << 6;
comp_mask = IB_MCR_COMPMASK_MGID | IB_MCR_COMPMASK_PORT_GID | IB_MCR_COMPMASK_QKEY | IB_MCR_COMPMASK_PKEY | IB_MCR_COMPMASK_SL | IB_MCR_COMPMASK_FLOW | IB_MCR_COMPMASK_JOIN_STATE | IB_MCR_COMPMASK_TCLASS | /* all above are required */
IB_MCR_COMPMASK_MTU_SEL | IB_MCR_COMPMASK_MTU;
status = osmt_send_mcast_request(p_osmt, 1,
&mc_req_rec, comp_mask, &res_sa_mad);
if (status != IB_SUCCESS) {
OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0238: "
"Failed to create MCG for MGID=0 with less than highest MTU - got %s/%s\n",
ib_get_err_str(status),
ib_get_mad_status_str((ib_mad_t *) (&res_sa_mad)));
goto Exit;
}
/* Save the mlid created in test_created_mlids map */
p_recvd_rec =
(ib_member_rec_t *) ib_sa_mad_get_payload_ptr(&res_sa_mad);
OSM_LOG(&p_osmt->log, OSM_LOG_VERBOSE, "Created MGID:%s MLID:0x%04X\n",
inet_ntop(AF_INET6, p_recvd_rec->mgid.raw, gid_str,
sizeof gid_str), cl_ntoh16(p_recvd_rec->mlid));
cl_map_insert(&test_created_mlids, cl_ntoh16(p_recvd_rec->mlid),
p_recvd_rec);
/* Good Flow - mgid is 0 while giving all required fields for join : P_Key, Q_Key, SL, FlowLabel, Tclass */
mc_req_rec.mtu = IB_MTU_LEN_256 | IB_PATH_SELECTOR_GREATER_THAN << 6;
comp_mask = IB_MCR_COMPMASK_MGID | IB_MCR_COMPMASK_PORT_GID | IB_MCR_COMPMASK_QKEY | IB_MCR_COMPMASK_PKEY | IB_MCR_COMPMASK_SL | IB_MCR_COMPMASK_FLOW | IB_MCR_COMPMASK_JOIN_STATE | IB_MCR_COMPMASK_TCLASS | /* all above are required */
IB_MCR_COMPMASK_MTU_SEL | IB_MCR_COMPMASK_MTU;
status = osmt_send_mcast_request(p_osmt, 1,
&mc_req_rec, comp_mask, &res_sa_mad);
if (status != IB_SUCCESS) {
OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0239: "
"Failed to create MCG for MGID=0 with higher than lowest MTU - got %s/%s\n",
ib_get_err_str(status),
ib_get_mad_status_str((ib_mad_t *) (&res_sa_mad)));
goto Exit;
}
/* Save the mlid created in test_created_mlids map */
p_recvd_rec =
(ib_member_rec_t *) ib_sa_mad_get_payload_ptr(&res_sa_mad);
OSM_LOG(&p_osmt->log, OSM_LOG_VERBOSE, "Created MGID:%s MLID:0x%04X\n",
inet_ntop(AF_INET6, p_recvd_rec->mgid.raw, gid_str,
sizeof gid_str), cl_ntoh16(p_recvd_rec->mlid));
cl_map_insert(&test_created_mlids, cl_ntoh16(p_recvd_rec->mlid),
p_recvd_rec);
/* Good Flow - mgid is 0 while giving all required fields for join : P_Key, Q_Key, SL, FlowLabel, Tclass */
/* Using Exact feasible MTU & RATE */
OSM_LOG(&p_osmt->log, OSM_LOG_VERBOSE,
"Using Exact feasible MTU & RATE: "
"MTU = 0x%02X, RATE = 0x%02X\n", mtu_phys, rate_phys);
mc_req_rec.mtu = mtu_phys;
mc_req_rec.rate = rate_phys;
comp_mask = IB_MCR_COMPMASK_MGID | IB_MCR_COMPMASK_PORT_GID | IB_MCR_COMPMASK_QKEY | IB_MCR_COMPMASK_PKEY | IB_MCR_COMPMASK_SL | IB_MCR_COMPMASK_FLOW | IB_MCR_COMPMASK_JOIN_STATE | IB_MCR_COMPMASK_TCLASS | /* all above are required */
IB_MCR_COMPMASK_MTU_SEL |
IB_MCR_COMPMASK_MTU |
IB_MCR_COMPMASK_RATE_SEL | IB_MCR_COMPMASK_RATE;
status = osmt_send_mcast_request(p_osmt, 1,
&mc_req_rec, comp_mask, &res_sa_mad);
if (status != IB_SUCCESS) {
OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0240: "
"Failed to create MCG for MGID=0 with exact MTU & RATE - got %s/%s\n",
ib_get_err_str(status),
ib_get_mad_status_str((ib_mad_t *) (&res_sa_mad)));
goto Exit;
}
/* Save the mlid created in test_created_mlids map */
p_recvd_rec =
(ib_member_rec_t *) ib_sa_mad_get_payload_ptr(&res_sa_mad);
OSM_LOG(&p_osmt->log, OSM_LOG_VERBOSE, "Created MGID:%s MLID:0x%04X\n",
inet_ntop(AF_INET6, p_recvd_rec->mgid.raw, gid_str,
sizeof gid_str), cl_ntoh16(p_recvd_rec->mlid));
cl_map_insert(&test_created_mlids, cl_ntoh16(p_recvd_rec->mlid),
p_recvd_rec);
/* Good Flow - mgid is 0 while giving all required fields for join : P_Key, Q_Key, SL, FlowLabel, Tclass */
/* Using Exact feasible RATE */
OSM_LOG(&p_osmt->log, OSM_LOG_VERBOSE,
"Using Exact feasible RATE: 0x%02X\n", rate_phys);
mc_req_rec.rate = rate_phys;
comp_mask = IB_MCR_COMPMASK_MGID | IB_MCR_COMPMASK_PORT_GID | IB_MCR_COMPMASK_QKEY | IB_MCR_COMPMASK_PKEY | IB_MCR_COMPMASK_SL | IB_MCR_COMPMASK_FLOW | IB_MCR_COMPMASK_JOIN_STATE | IB_MCR_COMPMASK_TCLASS | /* all above are required */
IB_MCR_COMPMASK_RATE_SEL | IB_MCR_COMPMASK_RATE;
status = osmt_send_mcast_request(p_osmt, 1,
&mc_req_rec, comp_mask, &res_sa_mad);
if (status != IB_SUCCESS) {
OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0241: "
"Failed to create MCG for MGID=0 with exact RATE - got %s/%s\n",
ib_get_err_str(status),
ib_get_mad_status_str((ib_mad_t *) (&res_sa_mad)));
goto Exit;
}
/* Save the mlid created in test_created_mlids map */
p_recvd_rec =
(ib_member_rec_t *) ib_sa_mad_get_payload_ptr(&res_sa_mad);
OSM_LOG(&p_osmt->log, OSM_LOG_VERBOSE, "Created MGID:%s MLID:0x%04X\n",
inet_ntop(AF_INET6, p_recvd_rec->mgid.raw, gid_str,
sizeof gid_str), cl_ntoh16(p_recvd_rec->mlid));
cl_map_insert(&test_created_mlids, cl_ntoh16(p_recvd_rec->mlid),
p_recvd_rec);
/* Good Flow - mgid is 0 while giving all required fields for join : P_Key, Q_Key, SL, FlowLabel, Tclass */
/* Using Exact feasible MTU */
OSM_LOG(&p_osmt->log, OSM_LOG_VERBOSE,
"Using Exact feasible MTU: 0x%02X\n", mtu_phys);
mc_req_rec.mtu = mtu_phys;
comp_mask = IB_MCR_COMPMASK_MGID | IB_MCR_COMPMASK_PORT_GID | IB_MCR_COMPMASK_QKEY | IB_MCR_COMPMASK_PKEY | IB_MCR_COMPMASK_SL | IB_MCR_COMPMASK_FLOW | IB_MCR_COMPMASK_JOIN_STATE | IB_MCR_COMPMASK_TCLASS | /* all above are required */
IB_MCR_COMPMASK_MTU_SEL | IB_MCR_COMPMASK_MTU;
status = osmt_send_mcast_request(p_osmt, 1,
&mc_req_rec, comp_mask, &res_sa_mad);
if (status != IB_SUCCESS) {
OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0242: "
"Failed to create MCG for MGID=0 with exact MTU - got %s/%s\n",
ib_get_err_str(status),
ib_get_mad_status_str((ib_mad_t *) (&res_sa_mad)));
goto Exit;
}
/* Save the mlid created in test_created_mlids map */
p_recvd_rec =
(ib_member_rec_t *) ib_sa_mad_get_payload_ptr(&res_sa_mad);
OSM_LOG(&p_osmt->log, OSM_LOG_VERBOSE, "Created MGID:%s MLID:0x%04X\n",
inet_ntop(AF_INET6, p_recvd_rec->mgid.raw, gid_str,
sizeof gid_str), cl_ntoh16(p_recvd_rec->mlid));
cl_map_insert(&test_created_mlids, cl_ntoh16(p_recvd_rec->mlid),
p_recvd_rec);
/* o15.0.1.5: */
/* - Check the returned MGID is valid. (p 804) */
OSM_LOG(&p_osmt->log, OSM_LOG_INFO,
"Validating resulting MGID (o15.0.1.5)...\n");
/* prefix 0xFF1 Scope 0xA01B */
/* Since we did not directly specified SCOPE in comp mask
we should get the comp mask that is link-local scope */
if ((p_mc_res->mgid.multicast.header[0] != 0xFF) ||
(p_mc_res->mgid.multicast.header[1] != 0x12) ||
(p_mc_res->mgid.multicast.raw_group_id[0] != 0xA0) ||
(p_mc_res->mgid.multicast.raw_group_id[1] != 0x1B)) {
OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0209: "
"Validating MGID failed. MGID:%s\n",
inet_ntop(AF_INET6, p_mc_res->mgid.raw, gid_str,
sizeof gid_str));
status = IB_ERROR;
goto Exit;
}
/* Good Flow - mgid is 0 while giving all required fields for join : P_Key, Q_Key, SL, FlowLabel, Tclass */
/* Using feasible GREATER_THAN 0 packet lifitime */
OSM_LOG(&p_osmt->log, OSM_LOG_INFO,
"Checking Create given MGID=0 (o15.0.1.4)...\n");
status = osmt_query_mcast(p_osmt);
osmt_init_mc_query_rec(p_osmt, &mc_req_rec);
p_mc_res = ib_sa_mad_get_payload_ptr(&res_sa_mad);
/* no MGID */
memset(&mc_req_rec.mgid, 0, sizeof(ib_gid_t));
/* Request Join */
ib_member_set_join_state(&mc_req_rec, IB_MC_REC_STATE_FULL_MEMBER);
mc_req_rec.pkt_life = 0 | IB_PATH_SELECTOR_GREATER_THAN << 6;
comp_mask = IB_MCR_COMPMASK_MGID | IB_MCR_COMPMASK_PORT_GID | IB_MCR_COMPMASK_QKEY | IB_MCR_COMPMASK_PKEY | IB_MCR_COMPMASK_SL | IB_MCR_COMPMASK_FLOW | IB_MCR_COMPMASK_JOIN_STATE | IB_MCR_COMPMASK_TCLASS | /* all above are required */
IB_MCR_COMPMASK_LIFE | IB_MCR_COMPMASK_LIFE_SEL;
status = osmt_send_mcast_request(p_osmt, 1,
&mc_req_rec, comp_mask, &res_sa_mad);
if (status != IB_SUCCESS) {
OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0210: "
"Failed to create MCG for MGID=0 - got %s/%s\n",
ib_get_err_str(status),
ib_get_mad_status_str((ib_mad_t *) (&res_sa_mad)));
goto Exit;
}
/* Save the mlid created in test_created_mlids map */
p_recvd_rec =
(ib_member_rec_t *) ib_sa_mad_get_payload_ptr(&res_sa_mad);
OSM_LOG(&p_osmt->log, OSM_LOG_VERBOSE, "Created MGID:%s MLID:0x%04X\n",
inet_ntop(AF_INET6, p_recvd_rec->mgid.raw, gid_str,
sizeof gid_str), cl_ntoh16(p_recvd_rec->mlid));
cl_map_insert(&test_created_mlids, cl_ntoh16(p_recvd_rec->mlid),
p_recvd_rec);
/* o15.0.1.6: */
/* - Create a new MCG with valid requested MGID. */
osmt_init_mc_query_rec(p_osmt, &mc_req_rec);
mc_req_rec.mgid = good_mgid;
OSM_LOG(&p_osmt->log, OSM_LOG_INFO,
"Checking Create given valid MGID=%s (o15.0.1.6)...\n",
inet_ntop(AF_INET6, mc_req_rec.mgid.raw, gid_str,
sizeof gid_str));
/* Before creation, need to check that this group doesn't exist */
OSM_LOG(&p_osmt->log, OSM_LOG_INFO,
"Verifying that MCGroup with this MGID doesn't exist by trying to Join it (o15.0.1.13)...\n");
ib_member_set_join_state(&mc_req_rec, IB_MC_REC_STATE_NON_MEMBER);
OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, EXPECTING_ERRORS_START "\n");
status = osmt_send_mcast_request(p_osmt, 1, /* join */
&mc_req_rec, comp_mask, &res_sa_mad);
OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, EXPECTING_ERRORS_END "\n");
if ((status != IB_REMOTE_ERROR) ||
(res_sa_mad.status != IB_SA_MAD_STATUS_REQ_INVALID)) {
OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0301: "
"Tried joining group that shouldn't have existed - got %s/%s\n",
ib_get_err_str(status),
ib_get_mad_status_str((ib_mad_t *) (&res_sa_mad)));
status = IB_ERROR;
goto Exit;
}
/* Set State to full member to allow group creation */
ib_member_set_join_state(&mc_req_rec, IB_MC_REC_STATE_FULL_MEMBER);
OSM_LOG(&p_osmt->log, OSM_LOG_INFO,
"Now creating group with given valid MGID=%s (o15.0.1.6)...\n",
inet_ntop(AF_INET6, mc_req_rec.mgid.raw, gid_str,
sizeof gid_str));
status = osmt_send_mcast_request(p_osmt, 1,
&mc_req_rec, comp_mask, &res_sa_mad);
if (status != IB_SUCCESS) {
OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0211: "
"Failed to create MCG for MGID=%s (o15.0.1.6) - got %s/%s\n",
inet_ntop(AF_INET6, good_mgid.raw, gid_str,
sizeof gid_str), ib_get_err_str(status),
ib_get_mad_status_str((ib_mad_t *) (&res_sa_mad)));
goto Exit;
}
/* Save the mlid created in test_created_mlids map */
p_recvd_rec =
(ib_member_rec_t *) ib_sa_mad_get_payload_ptr(&res_sa_mad);
OSM_LOG(&p_osmt->log, OSM_LOG_VERBOSE, "Created MGID:%s MLID:0x%04X\n",
inet_ntop(AF_INET6, p_recvd_rec->mgid.raw, gid_str,
sizeof gid_str), cl_ntoh16(p_recvd_rec->mlid));
cl_map_insert(&test_created_mlids, cl_ntoh16(p_recvd_rec->mlid),
p_recvd_rec);
OSM_LOG(&p_osmt->log, OSM_LOG_INFO,
"Validating resulting MGID (o15.0.1.6)...\n");
/* prefix 0xFF1 Scope 0xA01B */
if ((p_mc_res->mgid.multicast.header[0] != 0xFF) || (p_mc_res->mgid.multicast.header[1] != 0x12) || /* HACK hardcoded scope = 0x02 */
(p_mc_res->mgid.multicast.raw_group_id[0] != 0xA0) ||
(p_mc_res->mgid.multicast.raw_group_id[1] != 0x1C)) {
OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0212: "
"Validating MGID failed. MGID:%s\n",
inet_ntop(AF_INET6, p_mc_res->mgid.raw, gid_str,
sizeof gid_str));
status = IB_ERROR;
goto Exit;
}
/* - Try to create a new MCG with invalid MGID : get back ERR_REQ_INVALID */
OSM_LOG(&p_osmt->log, OSM_LOG_INFO,
"Checking BAD MGID=0xFA..... (o15.0.1.6)...\n");
OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, EXPECTING_ERRORS_START "\n");
mc_req_rec.mgid.raw[0] = 0xFA;
status = osmt_send_mcast_request(p_osmt, 1,
&mc_req_rec, comp_mask, &res_sa_mad);
OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, EXPECTING_ERRORS_END "\n");
if ((status != IB_REMOTE_ERROR) ||
(res_sa_mad.status != IB_SA_MAD_STATUS_REQ_INVALID)) {
OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0213: "
"Failed to recognize MGID error for MGID=0xFA - got %s/%s\n",
ib_get_err_str(status),
ib_get_mad_status_str((ib_mad_t *) (&res_sa_mad)));
status = IB_ERROR;
goto Exit;
}
/* - Try again with MGID prefix = 0xA01B (maybe 0x1BA0 little or big ?) */
OSM_LOG(&p_osmt->log, OSM_LOG_INFO,
"Checking BAD MGID=0xFF12A01B..... with link-local scope (o15.0.1.6)...\n");
mc_req_rec.mgid.raw[0] = 0xFF;
mc_req_rec.mgid.raw[3] = 0x1B;
comp_mask = comp_mask | IB_MCR_COMPMASK_SCOPE;
mc_req_rec.scope_state = mc_req_rec.scope_state & 0x2F; /* local scope */
OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, EXPECTING_ERRORS_START "\n");
status = osmt_send_mcast_request(p_osmt, 1,
&mc_req_rec, comp_mask, &res_sa_mad);
OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, EXPECTING_ERRORS_END "\n");
if ((status != IB_REMOTE_ERROR) ||
(res_sa_mad.status != IB_SA_MAD_STATUS_REQ_INVALID)) {
OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0214: "
"Failed to recognize MGID error for A01B with link-local bit (status %s) (rem status %s)\n",
ib_get_err_str(status),
ib_get_mad_status_str((ib_mad_t *) (&res_sa_mad)));
status = IB_ERROR;
goto Exit;
}
/* Change the mgid prefix - get back ERR_REQ_INVALID */
OSM_LOG(&p_osmt->log, OSM_LOG_INFO,
"Checking BAD MGID PREFIX=0xEF... (o15.0.1.6)...\n");
mc_req_rec.mgid = good_mgid;
mc_req_rec.mgid.raw[0] = 0xEF;
OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, EXPECTING_ERRORS_START "\n");
status = osmt_send_mcast_request(p_osmt, 1,
&mc_req_rec, comp_mask, &res_sa_mad);
OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, EXPECTING_ERRORS_END "\n");
if ((status != IB_REMOTE_ERROR) ||
(res_sa_mad.status != IB_SA_MAD_STATUS_REQ_INVALID)) {
OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0215: "
"Failed to recognize MGID PREFIX error for MGID=0xEF - got %s/%s\n",
ib_get_err_str(status),
ib_get_mad_status_str((ib_mad_t *) (&res_sa_mad)));
status = IB_ERROR;
goto Exit;
}
/* Change the scope to reserved - get back VALID REQ */
OSM_LOG(&p_osmt->log, OSM_LOG_INFO,
"Checking local scope with full member \n\t\tand valid mgid %s"
" ... (o15.0.1.6)...\n",
inet_ntop(AF_INET6, mc_req_rec.mgid.raw, gid_str,
sizeof gid_str));
mc_req_rec.mgid = good_mgid;
mc_req_rec.mgid.raw[1] = 0x1F;
status = osmt_send_mcast_request(p_osmt, 1,
&mc_req_rec, comp_mask, &res_sa_mad);
if (status != IB_SUCCESS) {
OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0216: "
"Failed to create MCG for MGID=%s - got %s/%s\n",
inet_ntop(AF_INET6, good_mgid.raw, gid_str,
sizeof gid_str), ib_get_err_str(status),
ib_get_mad_status_str((ib_mad_t *) (&res_sa_mad)));
goto Exit;
}
/* Save the mlid created in test_created_mlids map */
p_recvd_rec =
(ib_member_rec_t *) ib_sa_mad_get_payload_ptr(&res_sa_mad);
OSM_LOG(&p_osmt->log, OSM_LOG_VERBOSE, "Created MGID:%s MLID:0x%04X\n",
inet_ntop(AF_INET6, p_recvd_rec->mgid.raw, gid_str,
sizeof gid_str), cl_ntoh16(p_recvd_rec->mlid));
cl_map_insert(&test_created_mlids, cl_ntoh16(p_recvd_rec->mlid),
p_recvd_rec);
/* Change the flags to invalid value 0x2 - get back INVALID REQ */
OSM_LOG(&p_osmt->log, OSM_LOG_INFO,
"Checking invalid flags=0xFF 22 ... (o15.0.1.6)...\n");
OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, EXPECTING_ERRORS_START "\n");
mc_req_rec.mgid = good_mgid;
mc_req_rec.mgid.raw[1] = 0x22;
status = osmt_send_mcast_request(p_osmt, 1,
&mc_req_rec, comp_mask, &res_sa_mad);
OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, EXPECTING_ERRORS_END "\n");
if ((status != IB_REMOTE_ERROR) ||
(res_sa_mad.status != IB_SA_MAD_STATUS_REQ_INVALID)) {
OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0217: "
"Failed to recognize create with invalid flags value 0x2 - got %s/%s\n",
ib_get_err_str(status),
ib_get_mad_status_str((ib_mad_t *) (&res_sa_mad)));
status = IB_ERROR;
goto Exit;
}
/* Change the MGID to link local MGID - get back VALID REQ */
OSM_LOG(&p_osmt->log, OSM_LOG_INFO,
"Checking link local MGID 0xFF02:0:0:0:0:0:0:1 (o15.0.1.6)...\n");
mc_req_rec.mgid = osm_link_local_mgid;
status = osmt_send_mcast_request(p_osmt, 1,
&mc_req_rec, comp_mask, &res_sa_mad);
if (status != IB_SUCCESS) {
OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0218: "
"Failed to create MCG for MGID=0xFF02:0:0:0:0:0:0:1 - got %s/%s\n",
ib_get_err_str(status),
ib_get_mad_status_str((ib_mad_t *) (&res_sa_mad)));
goto Exit;
}
/* Save the mlid created in test_created_mlids map */
p_recvd_rec =
(ib_member_rec_t *) ib_sa_mad_get_payload_ptr(&res_sa_mad);
OSM_LOG(&p_osmt->log, OSM_LOG_VERBOSE, "Created MGID:%s MLID:0x%04X\n",
inet_ntop(AF_INET6, p_recvd_rec->mgid.raw, gid_str,
sizeof gid_str), cl_ntoh16(p_recvd_rec->mlid));
cl_map_insert(&test_created_mlids, cl_ntoh16(p_recvd_rec->mlid),
p_recvd_rec);
/* o15.0.1.7 - implicitlly checked during the prev steps. */
/* o15.0.1.8 - implicitlly checked during the prev steps. */
/* o15.0.1.9 */
/* - Create MCG with Invalid JoinState.FullMember != 1 : get ERR_REQ_INVALID */
OSM_LOG(&p_osmt->log, OSM_LOG_INFO,
"Checking new MGID with invalid join state (o15.0.1.9)...\n");
OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, EXPECTING_ERRORS_START "\n");
mc_req_rec.mgid = good_mgid;
mc_req_rec.mgid.raw[12] = 0xFF;
mc_req_rec.scope_state = 0x22; /* link-local scope, non-member state */
status = osmt_send_mcast_request(p_osmt, 1,
&mc_req_rec, comp_mask, &res_sa_mad);
OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, EXPECTING_ERRORS_END "\n");
if ((status != IB_REMOTE_ERROR) ||
(res_sa_mad.status != IB_SA_MAD_STATUS_REQ_INVALID)) {
OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0219: "
"Failed to recognize create with JoinState != FullMember - got %s/%s\n",
ib_get_err_str(status),
ib_get_mad_status_str((ib_mad_t *) (&res_sa_mad)));
status = IB_ERROR;
goto Exit;
}
/* Lets try a valid join scope state */
OSM_LOG(&p_osmt->log, OSM_LOG_INFO,
"Checking new MGID with valid join state (o15.0.1.9)...\n");
mc_req_rec.mgid = good_mgid;
mc_req_rec.scope_state = 0x23; /* link-local scope, non member and full member */
status = osmt_send_mcast_request(p_osmt, 1,
&mc_req_rec, comp_mask, &res_sa_mad);
if (status != IB_SUCCESS) {
OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0220: "
"Failed to create MCG with valid join state 0x3 - got %s/%s\n",
ib_get_err_str(status),
ib_get_mad_status_str((ib_mad_t *) (&res_sa_mad)));
goto Exit;
}
/* Save the mlid created in test_created_mlids map */
p_recvd_rec =
(ib_member_rec_t *) ib_sa_mad_get_payload_ptr(&res_sa_mad);
OSM_LOG(&p_osmt->log, OSM_LOG_VERBOSE, "Created MGID:%s MLID:0x%04X\n",
inet_ntop(AF_INET6, p_recvd_rec->mgid.raw, gid_str,
sizeof gid_str), cl_ntoh16(p_recvd_rec->mlid));
cl_map_insert(&test_created_mlids, cl_ntoh16(p_recvd_rec->mlid),
p_recvd_rec);
/* Lets try another invalid join scope state */
OSM_LOG(&p_osmt->log, OSM_LOG_INFO,
"Checking new MGID with invalid join state (o15.0.1.9)...\n");
OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, EXPECTING_ERRORS_START "\n");
/* We have created a new MCG so now we need different mgid when cresting group otherwise it will be counted as join request . */
mc_req_rec.mgid = good_mgid;
mc_req_rec.mgid.raw[12] = 0xFC;
mc_req_rec.scope_state = 0x24; /* link-local scope, send only member */
status = osmt_send_mcast_request(p_osmt, 1,
&mc_req_rec, comp_mask, &res_sa_mad);
OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, EXPECTING_ERRORS_END "\n");
if ((status != IB_REMOTE_ERROR) ||
(res_sa_mad.status != IB_SA_MAD_STATUS_REQ_INVALID)) {
OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0221: "
"Failed to recognize create with JoinState != FullMember - got %s/%s\n",
ib_get_err_str(status),
ib_get_mad_status_str((ib_mad_t *) (&res_sa_mad)));
status = IB_ERROR;
goto Exit;
}
/* Lets try another valid join scope state */
OSM_LOG(&p_osmt->log, OSM_LOG_INFO,
"Checking new MGID creation with valid join state (o15.0.2.3)...\n");
mc_req_rec.mgid = good_mgid;
mc_req_rec.mgid.raw[12] = 0xFB;
memcpy(&special_mgid, &mc_req_rec.mgid, sizeof(ib_gid_t));
mc_req_rec.scope_state = 0x2F; /* link-local scope, Full member with all other bits turned on */
status = osmt_send_mcast_request(p_osmt, 1,
&mc_req_rec, comp_mask, &res_sa_mad);
if (status != IB_SUCCESS) {
OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0222: "
"Failed to create MCG with valid join state 0xF - got %s/%s\n",
ib_get_err_str(status),
ib_get_mad_status_str((ib_mad_t *) (&res_sa_mad)));
goto Exit;
}
/* Save the mlid created in test_created_mlids map */
p_recvd_rec =
(ib_member_rec_t *) ib_sa_mad_get_payload_ptr(&res_sa_mad);
OSM_LOG(&p_osmt->log, OSM_LOG_VERBOSE, "Created MGID:%s MLID:0x%04X\n",
inet_ntop(AF_INET6, p_recvd_rec->mgid.raw, gid_str,
sizeof gid_str), cl_ntoh16(p_recvd_rec->mlid));
cl_map_insert(&test_created_mlids, cl_ntoh16(p_recvd_rec->mlid),
p_recvd_rec);
/* o15.0.1.10 - can't check on a single client .-- obsolete -
checked by SilverStorm bug o15-0.2.4, never the less recheck */
/* o15-0.2.4 - Check a join request to already created MCG */
p_mc_res = ib_sa_mad_get_payload_ptr(&res_sa_mad);
OSM_LOG(&p_osmt->log, OSM_LOG_INFO, "Check o15-0.2.4 statement...\n");
/* Try to join */
memcpy(&mc_req_rec.mgid, &p_mc_res->mgid, sizeof(ib_gid_t));
/* Request Join */
ib_member_set_join_state(&mc_req_rec, IB_MC_REC_STATE_NON_MEMBER);
comp_mask =
IB_MCR_COMPMASK_MGID |
IB_MCR_COMPMASK_PORT_GID | IB_MCR_COMPMASK_JOIN_STATE;
status = osmt_send_mcast_request(p_osmt, 0x1, /* SubnAdmSet */
&mc_req_rec, comp_mask, &res_sa_mad);
if (status != IB_SUCCESS) {
OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 02CC: "
"Failed to join MCG with valid req, returned status = %s\n",
ib_get_mad_status_str((ib_mad_t *) (&res_sa_mad)));
goto Exit;
}
p_mc_res = ib_sa_mad_get_payload_ptr(&res_sa_mad);
if ((p_mc_res->scope_state & 0x7) != 0x7) {
OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 02D0: "
"Validating JoinState update failed. "
"Expected 0x27 got 0x%02X\n",
p_mc_res->scope_state);
status = IB_ERROR;
goto Exit;
}
/* o15.0.1.11: */
/* - Try to join into a MGID that exists with JoinState=SendOnlyMember - */
/* see that it updates JoinState. What is the routing change? */
OSM_LOG(&p_osmt->log, OSM_LOG_INFO,
"Checking Retry of existing MGID - See JoinState update (o15.0.1.11)...\n");
mc_req_rec.mgid = good_mgid;
/* first, make sure that the group exists */
mc_req_rec.scope_state = 0x21;
status = osmt_send_mcast_request(p_osmt, 1,
&mc_req_rec, comp_mask, &res_sa_mad);
if (status != IB_SUCCESS) {
OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 02CD: "
"Failed to create/join as full member - got %s/%s\n",
ib_get_err_str(status),
ib_get_mad_status_str((ib_mad_t *) (&res_sa_mad)));
goto Exit;
}
mc_req_rec.scope_state = 0x22; /* link-local scope, non-member */
status = osmt_send_mcast_request(p_osmt, 1,
&mc_req_rec, comp_mask, &res_sa_mad);
if (status != IB_SUCCESS) {
OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 02D1: "
"Failed to update existing MGID - got %s/%s\n",
ib_get_err_str(status),
ib_get_mad_status_str((ib_mad_t *) (&res_sa_mad)));
goto Exit;
}
OSM_LOG(&p_osmt->log, OSM_LOG_INFO,
"Validating Join State update with NonMember (o15.0.1.11)...\n");
if (p_mc_res->scope_state != 0x23) { /* scope is LSB */
OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 02CE: "
"Validating JoinState update failed. Expected 0x23 got: 0x%02X\n",
p_mc_res->scope_state);
status = IB_ERROR;
goto Exit;
}
/* Try delete current join state then update it with another value */
OSM_LOG(&p_osmt->log, OSM_LOG_INFO,
"Checking JoinState update request should return 0x22 (o15.0.1.11)...\n");
mc_req_rec.rate =
IB_LINK_WIDTH_ACTIVE_1X | IB_PATH_SELECTOR_GREATER_THAN << 6;
mc_req_rec.mgid = good_mgid;
OSM_LOG(&p_osmt->log, OSM_LOG_INFO,
"Checking Partially delete JoinState (o15.0.1.14)...\n");
/* link-local scope, both non-member bits,
so we should not be able to delete) */
mc_req_rec.scope_state = 0x26;
OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, EXPECTING_ERRORS_START "\n");
status = osmt_send_mcast_request(p_osmt, 0,
&mc_req_rec, comp_mask, &res_sa_mad);
OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, EXPECTING_ERRORS_END "\n");
if (status != IB_REMOTE_ERROR) {
OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 02CF: "
"Expected to fail partially update JoinState, "
"but got %s\n",
ib_get_err_str(status));
status = IB_ERROR;
goto Exit;
}
/* link-local scope, NonMember bit, the FullMember bit should stay */
mc_req_rec.scope_state = 0x22;
status = osmt_send_mcast_request(p_osmt, 0,
&mc_req_rec, comp_mask, &res_sa_mad);
if (status != IB_SUCCESS) {
OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 02D3: "
"Failed to partially update JoinState : %s/%s\n",
ib_get_err_str(status),
ib_get_mad_status_str((ib_mad_t *) (&res_sa_mad)));
status = IB_ERROR;
goto Exit;
}
p_mc_res = ib_sa_mad_get_payload_ptr(&res_sa_mad);
if (p_mc_res->scope_state != 0x21) {
OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 02D4: "
"Failed to partially update JoinState : "
"JoinState = 0x%02X, expected 0x%02X\n",
p_mc_res->scope_state, 0x21);
status = IB_ERROR;
goto Exit;
}
/* So far successfully delete state - Now change it */
mc_req_rec.mgid = good_mgid;
mc_req_rec.scope_state = 0x24; /* link-local scope, send only member */
status = osmt_send_mcast_request(p_osmt, 1,
&mc_req_rec, comp_mask, &res_sa_mad);
if (status != IB_SUCCESS) {
OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 02C0: "
"Failed to update existing MCG - got %s/%s\n",
ib_get_err_str(status),
ib_get_mad_status_str((ib_mad_t *) (&res_sa_mad)));
goto Exit;
}
OSM_LOG(&p_osmt->log, OSM_LOG_INFO,
"Validating Join State update with Send Only Member (o15.0.1.11)...\n");
if (p_mc_res->scope_state != 0x25) { /* scope is MSB */
OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 02C1: "
"Validating JoinState update failed. Expected 0x25 got: 0x%02X\n",
p_mc_res->scope_state);
status = IB_ERROR;
goto Exit;
}
/* Now try to update value of join state */
mc_req_rec.scope_state = 0x21; /* link-local scope, full member */
status = osmt_send_mcast_request(p_osmt, 1,
&mc_req_rec, comp_mask, &res_sa_mad);
if (status != IB_SUCCESS) {
OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 02C2: "
"Failed to update existing MGID - got %s/%s\n",
ib_get_err_str(status),
ib_get_mad_status_str((ib_mad_t *) (&res_sa_mad)));
goto Exit;
}
OSM_LOG(&p_osmt->log, OSM_LOG_INFO,
"Validating Join State update with Full Member\n\t\t"
"to an existing 0x5 state MCG (o15.0.1.11)...\n");
if (p_mc_res->scope_state != 0x25) { /* scope is LSB */
OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 02C3: "
"Validating JoinState update failed. Expected 0x25 got: 0x%02X\n",
p_mc_res->scope_state);
status = IB_ERROR;
goto Exit;
}
/* Now try to update value of join state */
mc_req_rec.scope_state = 0x22; /* link-local scope,non member */
status = osmt_send_mcast_request(p_osmt, 1,
&mc_req_rec, comp_mask, &res_sa_mad);
if (status != IB_SUCCESS) {
OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 02C4: "
"Failed to update existing MGID - got %s/%s\n",
ib_get_err_str(status),
ib_get_mad_status_str((ib_mad_t *) (&res_sa_mad)));
goto Exit;
}
OSM_LOG(&p_osmt->log, OSM_LOG_INFO,
"Validating Join State update with Non Member\n\t\t"
"to an existing 0x5 state MCG (o15.0.1.11)...\n");
if (p_mc_res->scope_state != 0x27) { /* scope is LSB */
OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 02C5: "
"Validating JoinState update failed. Expected 0x27 got: 0x%02X\n",
p_mc_res->scope_state);
status = IB_ERROR;
goto Exit;
}
OSM_LOG(&p_osmt->log, OSM_LOG_VERBOSE,
"DEBUG - Current scope_state value : 0x%02X...\n",
p_mc_res->scope_state);
/* - We can not check simple join since we have only one tester (for now) */
/* o15.0.1.12: Not Supported */
/* - The SendOnlyNonMem join should have a special treatment in the
SA but what is it ? */
/* o15.0.1.13: */
/* - Try joining with rate that does not exist in any MCG -
ERR_REQ_INVALID */
OSM_LOG(&p_osmt->log, OSM_LOG_INFO,
"Checking BAD RATE when connecting to existing MGID (o15.0.1.13)...\n");
OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, EXPECTING_ERRORS_START "\n");
mc_req_rec.mgid = good_mgid;
mc_req_rec.rate =
IB_LINK_WIDTH_ACTIVE_1X | IB_PATH_SELECTOR_LESS_THAN << 6;
comp_mask = IB_MCR_COMPMASK_GID | IB_MCR_COMPMASK_PORT_GID | IB_MCR_COMPMASK_QKEY | IB_MCR_COMPMASK_PKEY | IB_MCR_COMPMASK_SL | IB_MCR_COMPMASK_FLOW | IB_MCR_COMPMASK_JOIN_STATE | IB_MCR_COMPMASK_TCLASS | /* all above are required */
IB_MCR_COMPMASK_RATE_SEL | IB_MCR_COMPMASK_RATE;
status = osmt_send_mcast_request(p_osmt, 1,
&mc_req_rec, comp_mask, &res_sa_mad);
OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, EXPECTING_ERRORS_END "\n");
if ((status != IB_REMOTE_ERROR) ||
(res_sa_mad.status != IB_SA_MAD_STATUS_REQ_INVALID)) {
OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 02C6: "
"Failed to catch BAD RATE joining an exiting MGID: %s/%s\n",
ib_get_err_str(status),
ib_get_mad_status_str((ib_mad_t *) (&res_sa_mad)));
status = IB_ERROR;
goto Exit;
}
/* Try MTU that does not exist in any MCG */
OSM_LOG(&p_osmt->log, OSM_LOG_INFO,
"Checking BAD MTU (higher them max) when connecting to "
"existing MGID (o15.0.1.13)...\n");
OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, EXPECTING_ERRORS_START "\n");
mc_req_rec.mgid = osm_ipoib_mgid;
mc_req_rec.mtu = IB_MTU_LEN_4096 | IB_PATH_SELECTOR_GREATER_THAN << 6;
comp_mask = IB_MCR_COMPMASK_GID | IB_MCR_COMPMASK_PORT_GID | IB_MCR_COMPMASK_QKEY | IB_MCR_COMPMASK_PKEY | IB_MCR_COMPMASK_SL | IB_MCR_COMPMASK_FLOW | IB_MCR_COMPMASK_JOIN_STATE | IB_MCR_COMPMASK_TCLASS | /* all above are required */
IB_MCR_COMPMASK_MTU_SEL | IB_MCR_COMPMASK_MTU;
status = osmt_send_mcast_request(p_osmt, 1,
&mc_req_rec, comp_mask, &res_sa_mad);
OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, EXPECTING_ERRORS_END "\n");
if ((status != IB_REMOTE_ERROR) ||
(res_sa_mad.status != IB_SA_MAD_STATUS_REQ_INVALID)) {
OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 02C7: "
"Failed to catch BAD RATE (higher them max) joining an exiting MGID: %s/%s\n",
ib_get_err_str(status),
ib_get_mad_status_str((ib_mad_t *) (&res_sa_mad)));
status = IB_ERROR;
goto Exit;
}
/* Try another MTU that does not exist in any MCG */
OSM_LOG(&p_osmt->log, OSM_LOG_INFO,
"Checking BAD MTU (less than min) when connecting "
"to existing MGID (o15.0.1.13)...\n");
OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, EXPECTING_ERRORS_START "\n");
mc_req_rec.mgid = osm_ipoib_mgid;
mc_req_rec.mtu = IB_MTU_LEN_256 | IB_PATH_SELECTOR_LESS_THAN << 6;
comp_mask = IB_MCR_COMPMASK_GID | IB_MCR_COMPMASK_PORT_GID | IB_MCR_COMPMASK_QKEY | IB_MCR_COMPMASK_PKEY | IB_MCR_COMPMASK_SL | IB_MCR_COMPMASK_FLOW | IB_MCR_COMPMASK_JOIN_STATE | IB_MCR_COMPMASK_TCLASS | /* all above are required */
IB_MCR_COMPMASK_MTU_SEL | IB_MCR_COMPMASK_MTU;
status = osmt_send_mcast_request(p_osmt, 1,
&mc_req_rec, comp_mask, &res_sa_mad);
OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, EXPECTING_ERRORS_END "\n");
if ((status != IB_REMOTE_ERROR) ||
(res_sa_mad.status != IB_SA_MAD_STATUS_REQ_INVALID)) {
OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 02C8: "
"Failed to catch BAD RATE (less them min) joining an exiting MGID: %s/%s\n",
ib_get_err_str(status),
ib_get_mad_status_str((ib_mad_t *) (&res_sa_mad)));
status = IB_ERROR;
goto Exit;
}
/* o15.0.1.14: */
/* - Try partial delete - actually updating the join state. check it. */
OSM_LOG(&p_osmt->log, OSM_LOG_INFO,
"Checking partial JoinState delete request - removing NonMember (o15.0.1.14)...\n");
mc_req_rec.rate =
IB_LINK_WIDTH_ACTIVE_1X | IB_PATH_SELECTOR_GREATER_THAN << 6;
mc_req_rec.mgid = good_mgid;
comp_mask = IB_MCR_COMPMASK_GID | IB_MCR_COMPMASK_PORT_GID | IB_MCR_COMPMASK_QKEY | IB_MCR_COMPMASK_PKEY | IB_MCR_COMPMASK_SL | IB_MCR_COMPMASK_FLOW | IB_MCR_COMPMASK_JOIN_STATE | IB_MCR_COMPMASK_TCLASS | /* all above are required */
IB_MCR_COMPMASK_RATE_SEL | IB_MCR_COMPMASK_RATE;
/* link-local scope, non member (so we should not be able to delete) */
/* but the NonMember bit should be gone */
mc_req_rec.scope_state = 0x22;
status = osmt_send_mcast_request(p_osmt, 0,
&mc_req_rec, comp_mask, &res_sa_mad);
if (status != IB_SUCCESS) {
OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 02C9: "
"Fail to partially update JoinState during delete: %s/%s\n",
ib_get_err_str(status),
ib_get_mad_status_str((ib_mad_t *) (&res_sa_mad)));
status = IB_ERROR;
goto Exit;
}
OSM_LOG(&p_osmt->log, OSM_LOG_INFO,
"Validating Join State removal of Non Member bit (o15.0.1.14)...\n");
if (p_mc_res->scope_state != 0x25) { /* scope is MSB - now only the full member & send only member have left */
OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 02CA: "
"Validating JoinState update failed. Expected 0x25 got: 0x%02X\n",
p_mc_res->scope_state);
status = IB_ERROR;
goto Exit;
}
/* Now use the same scope_state and delete all JoinState - leave multicast group since state is 0x0 */
mc_req_rec.scope_state = 0x25;
status = osmt_send_mcast_request(p_osmt, 0,
&mc_req_rec, comp_mask, &res_sa_mad);
if (status != IB_SUCCESS) {
OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 02CB: "
"Failed to update JoinState during delete: %s/%s\n",
ib_get_err_str(status),
ib_get_mad_status_str((ib_mad_t *) (&res_sa_mad)));
status = IB_ERROR;
goto Exit;
}
OSM_LOG(&p_osmt->log, OSM_LOG_INFO,
"Validating Join State update remove (o15.0.1.14)...\n");
if (p_mc_res->scope_state != 0x25) { /* scope is MSB - now only 0x0 so port is removed from MCG */
OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 02BF: "
"Validating JoinState update failed. Expected 0x25 got: 0x%02X\n",
p_mc_res->scope_state);
status = IB_ERROR;
goto Exit;
}
/* - Try joining (not full mem) again to see the group was deleted. (should fail) */
OSM_LOG(&p_osmt->log, OSM_LOG_INFO,
"Checking Delete by trying to Join deleted group (o15.0.1.13)...\n");
mc_req_rec.scope_state = 0x22; /* use non member - so if no group fail */
OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, EXPECTING_ERRORS_START "\n");
status = osmt_send_mcast_request(p_osmt, 1, /* join */
&mc_req_rec, comp_mask, &res_sa_mad);
OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, EXPECTING_ERRORS_END "\n");
if (status != IB_REMOTE_ERROR) {
OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 02BC: "
"Succeeded Joining Deleted Group: %s/%s\n",
ib_get_err_str(status),
ib_get_mad_status_str((ib_mad_t *) (&res_sa_mad)));
status = IB_ERROR;
goto Exit;
}
/* - Try deletion of the IPoIB MCG and get: ERR_REQ_INVALID */
OSM_LOG(&p_osmt->log, OSM_LOG_INFO,
"Checking BAD Delete of Mgid membership (no prev join) (o15.0.1.15)...\n");
OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, EXPECTING_ERRORS_START "\n");
mc_req_rec.mgid = osm_ipoib_mgid;
mc_req_rec.rate =
IB_LINK_WIDTH_ACTIVE_1X | IB_PATH_SELECTOR_GREATER_THAN << 6;
mc_req_rec.scope_state = 0x21; /* delete full member */
status = osmt_send_mcast_request(p_osmt, 0, /* delete flag */
&mc_req_rec, comp_mask, &res_sa_mad);
OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, EXPECTING_ERRORS_END "\n");
if ((status != IB_REMOTE_ERROR) ||
(res_sa_mad.status != IB_SA_MAD_STATUS_REQ_INVALID)) {
OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 02BD: "
"Failed to catch BAD delete from IPoIB: %s/%s\n",
ib_get_err_str(status),
ib_get_mad_status_str((ib_mad_t *) (&res_sa_mad)));
status = IB_ERROR;
goto Exit;
}
/* Prepare another MCG for the following tests : */
OSM_LOG(&p_osmt->log, OSM_LOG_INFO,
"Checking Create given MGID=%s\n\t\t(o15.0.1.4)...\n",
inet_ntop(AF_INET6, osm_ipoib_mgid.raw, gid_str,
sizeof gid_str));
mc_req_rec.mgid = good_mgid;
mc_req_rec.mgid.raw[12] = 0xAA;
mc_req_rec.pkt_life = 0 | IB_PATH_SELECTOR_GREATER_THAN << 6;
mc_req_rec.scope_state = 0x21; /* Full memeber */
comp_mask = IB_MCR_COMPMASK_GID | IB_MCR_COMPMASK_PORT_GID | IB_MCR_COMPMASK_QKEY | IB_MCR_COMPMASK_PKEY | IB_MCR_COMPMASK_SL | IB_MCR_COMPMASK_FLOW | IB_MCR_COMPMASK_JOIN_STATE | IB_MCR_COMPMASK_TCLASS | /* all above are required */
IB_MCR_COMPMASK_LIFE | IB_MCR_COMPMASK_LIFE_SEL;
status = osmt_send_mcast_request(p_osmt, 1,
&mc_req_rec, comp_mask, &res_sa_mad);
if (status != IB_SUCCESS) {
OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 02BE: "
"Failed to create MCG for %s - got %s/%s\n",
inet_ntop(AF_INET6, good_mgid.raw, gid_str,
sizeof gid_str), ib_get_err_str(status),
ib_get_mad_status_str((ib_mad_t *) (&res_sa_mad)));
goto Exit;
}
/* - Try delete with valid join state */
OSM_LOG(&p_osmt->log, OSM_LOG_INFO,
"Checking Full Delete of a group (o15.0.1.14)...\n");
mc_req_rec.scope_state = 0x21; /* the FullMember is the current JoinState */
status = osmt_send_mcast_request(p_osmt, 0,
&mc_req_rec, comp_mask, &res_sa_mad);
if (status != IB_SUCCESS) {
goto Exit;
}
/* o15.0.1.15: */
/* - Try deletion of the IPoIB MCG and get: ERR_REQ_INVALID */
OSM_LOG(&p_osmt->log, OSM_LOG_INFO,
"Checking BAD Delete of IPoIB membership (no prev join) (o15.0.1.15)...\n");
OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, EXPECTING_ERRORS_START "\n");
mc_req_rec.mgid = osm_ipoib_mgid;
mc_req_rec.rate =
IB_LINK_WIDTH_ACTIVE_1X | IB_PATH_SELECTOR_GREATER_THAN << 6;
mc_req_rec.scope_state = 0x21; /* delete full member */
status = osmt_send_mcast_request(p_osmt, 0, /* delete flag */
&mc_req_rec, comp_mask, &res_sa_mad);
OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, EXPECTING_ERRORS_END "\n");
if ((status != IB_REMOTE_ERROR) ||
(res_sa_mad.status != IB_SA_MAD_STATUS_REQ_INVALID)) {
OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0223: "
"Failed to catch BAD delete from IPoIB: %s/%s\n",
ib_get_err_str(status),
ib_get_mad_status_str((ib_mad_t *) (&res_sa_mad)));
status = IB_ERROR;
goto Exit;
}
/**************************************************************************/
/* Checking join with invalid MTU */
osmt_init_mc_query_rec(p_osmt, &mc_req_rec);
OSM_LOG(&p_osmt->log, OSM_LOG_INFO,
"Checking Join with unrealistic mtu : \n"
"\t\tFirst create new MCG than try to join it \n"
"\t\twith unrealistic MTU greater than 4096 (o15.0.1.8)...\n");
/* First create new mgrp */
ib_member_set_join_state(&mc_req_rec, IB_MC_REC_STATE_FULL_MEMBER);
mc_req_rec.mtu = IB_MTU_LEN_1024 | IB_PATH_SELECTOR_EXACTLY << 6;
memset(&mc_req_rec.mgid, 0, sizeof(ib_gid_t));
comp_mask = IB_MCR_COMPMASK_MGID | IB_MCR_COMPMASK_PORT_GID | IB_MCR_COMPMASK_QKEY | IB_MCR_COMPMASK_PKEY | IB_MCR_COMPMASK_SL | IB_MCR_COMPMASK_FLOW | IB_MCR_COMPMASK_JOIN_STATE | IB_MCR_COMPMASK_TCLASS | /* all above are required */
IB_MCR_COMPMASK_MTU_SEL | IB_MCR_COMPMASK_MTU;
status = osmt_send_mcast_request(p_osmt, 1,
&mc_req_rec, comp_mask, &res_sa_mad);
p_mc_res = ib_sa_mad_get_payload_ptr(&res_sa_mad);
if (status != IB_SUCCESS) {
OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 02EB: "
"Failed to create new mgrp\n");
goto Exit;
}
memcpy(&tmp_mgid, &p_mc_res->mgid, sizeof(ib_gid_t));
osm_dump_mc_record(&p_osmt->log, p_mc_res, OSM_LOG_INFO);
/* tmp_mtu = p_mc_res->mtu & 0x3F; */
/* impossible requested mtu always greater than exist in MCG */
mc_req_rec.mtu = IB_MTU_LEN_4096 | IB_PATH_SELECTOR_GREATER_THAN << 6;
memcpy(&mc_req_rec.mgid, &tmp_mgid, sizeof(ib_gid_t));
ib_member_set_join_state(&mc_req_rec, IB_MC_REC_STATE_FULL_MEMBER);
comp_mask =
IB_MCR_COMPMASK_GID |
IB_MCR_COMPMASK_PORT_GID |
IB_MCR_COMPMASK_JOIN_STATE |
IB_MCR_COMPMASK_MTU_SEL | IB_MCR_COMPMASK_MTU;
OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, EXPECTING_ERRORS_START "\n");
status = osmt_send_mcast_request(p_osmt, 1,
&mc_req_rec, comp_mask, &res_sa_mad);
OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, EXPECTING_ERRORS_END "\n");
if (status == IB_SUCCESS) {
OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 02E4: "
"Expected REMOTE ERROR got:%s/%s\n",
ib_get_err_str(status),
ib_get_mad_status_str((ib_mad_t *) (&res_sa_mad)));
status = IB_ERROR;
goto Exit;
}
/* - Try GetTable with PortGUID wildcarded and get back some groups. */
status = osmt_query_mcast(p_osmt);
cnt = cl_qmap_count(&p_osmt->exp_subn.mgrp_mlid_tbl);
OSM_LOG(&p_osmt->log, OSM_LOG_INFO, "(Before checking Max MCG creation): "
"Number of MC Records found in SA DB is %d\n", cnt);
/**************************************************************************/
/* Checking join on behalf of remote port gid */
OSM_LOG(&p_osmt->log, OSM_LOG_INFO, "Checking Proxy Join...\n");
osmt_init_mc_query_rec(p_osmt, &mc_req_rec);
memset(&context, 0, sizeof(context));
/*
* Do a blocking query for all NodeRecords in the subnet.
*/
status = osmtest_get_all_recs(p_osmt, IB_MAD_ATTR_NODE_RECORD,
sizeof(*p_rec), &context);
if (status != IB_SUCCESS) {
OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 02E5: "
"osmtest_get_all_recs failed on getting all node records(%s)\n",
ib_get_err_str(status));
goto Exit;
}
/*
* Populate the database with the received records.
*/
num_recs = context.result.result_cnt;
OSM_LOG(&p_osmt->log, OSM_LOG_VERBOSE, "Received %u records\n", num_recs);
for (i = 0; i < num_recs; i++) {
p_rec =
osmv_get_query_node_rec(context.result.p_result_madw, i);
if (p_rec->node_info.port_guid != p_osmt->local_port.port_guid
&& p_rec->node_info.node_type == IB_NODE_TYPE_CA) {
OSM_LOG(&p_osmt->log, OSM_LOG_VERBOSE,
"remote port_guid = 0x%" PRIx64 "\n",
cl_ntoh64(p_rec->node_info.port_guid));
remote_port_guid = p_rec->node_info.port_guid;
i = num_recs;
break;
}
}
if (remote_port_guid != 0x0) {
ib_member_set_join_state(&mc_req_rec,
IB_MC_REC_STATE_FULL_MEMBER);
memset(&mc_req_rec.mgid, 0, sizeof(ib_gid_t));
mc_req_rec.port_gid.unicast.interface_id = remote_port_guid;
comp_mask = IB_MCR_COMPMASK_MGID | IB_MCR_COMPMASK_PORT_GID | IB_MCR_COMPMASK_QKEY | IB_MCR_COMPMASK_PKEY | IB_MCR_COMPMASK_SL | IB_MCR_COMPMASK_FLOW | IB_MCR_COMPMASK_JOIN_STATE | IB_MCR_COMPMASK_TCLASS; /* all above are required */
status = osmt_send_mcast_request(p_osmt, 1,
&mc_req_rec,
comp_mask, &res_sa_mad);
if (status != IB_SUCCESS) {
OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 02B4: "
"Could not join on behalf of remote port 0x%016"
PRIx64 " remote status: %s\n",
cl_ntoh64(remote_port_guid),
ib_get_mad_status_str((ib_mad_t
*) (&res_sa_mad)));
status = IB_ERROR;
goto Exit;
}
p_mc_res = ib_sa_mad_get_payload_ptr(&res_sa_mad);
memcpy(&proxy_mgid, &p_mc_res->mgid, sizeof(ib_gid_t));
/* First try a bad deletion then good one */
OSM_LOG(&p_osmt->log, OSM_LOG_INFO,
"Trying deletion of remote port with local port guid\n");
osmt_init_mc_query_rec(p_osmt, &mc_req_rec);
ib_member_set_join_state(&mc_req_rec,
IB_MC_REC_STATE_FULL_MEMBER);
comp_mask =
IB_MCR_COMPMASK_MGID | IB_MCR_COMPMASK_PORT_GID |
IB_MCR_COMPMASK_JOIN_STATE;
OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, EXPECTING_ERRORS_START "\n");
status = osmt_send_mcast_request(p_osmt, 0, /* delete flag */
&mc_req_rec,
comp_mask, &res_sa_mad);
OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, EXPECTING_ERRORS_END "\n");
if (status == IB_SUCCESS) {
OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 02A9: "
"Successful deletion of remote port guid with local one MGID : "
"%s, Got : %s/%s\n",
inet_ntop(AF_INET6,
p_mgrp->mcmember_rec.mgid.raw,
gid_str, sizeof gid_str),
ib_get_err_str(status),
ib_get_mad_status_str((ib_mad_t
*) (&res_sa_mad)));
status = IB_ERROR;
goto Exit;
}
OSM_LOG(&p_osmt->log, OSM_LOG_INFO,
"Trying deletion of remote port with the right port guid\n");
osmt_init_mc_query_rec(p_osmt, &mc_req_rec);
ib_member_set_join_state(&mc_req_rec,
IB_MC_REC_STATE_FULL_MEMBER);
mc_req_rec.mgid = proxy_mgid;
mc_req_rec.port_gid.unicast.interface_id = remote_port_guid;
comp_mask =
IB_MCR_COMPMASK_MGID |
IB_MCR_COMPMASK_PORT_GID | IB_MCR_COMPMASK_JOIN_STATE;
status = osmt_send_mcast_request(p_osmt, 0, /* delete flag */
&mc_req_rec,
comp_mask, &res_sa_mad);
if (status != IB_SUCCESS) {
OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 02B0: "
"Failed to delete mgid with remote port guid MGID : "
"%s, Got : %s/%s\n",
inet_ntop(AF_INET6,
p_mgrp->mcmember_rec.mgid.raw,
gid_str, sizeof gid_str),
ib_get_err_str(status),
ib_get_mad_status_str((ib_mad_t
*) (&res_sa_mad)));
goto Exit;
}
} else {
OSM_LOG(&p_osmt->log, OSM_LOG_INFO,
"Could not check proxy join since could not found remote port, different from local port\n");
}
/* prepare init for next check */
osmt_init_mc_query_rec(p_osmt, &mc_req_rec);
/**************************************************************************/
if (p_osmt->opt.mmode > 2) {
/* Check invalid Join with max mlid which is more than the
Mellanox switches support 0xC000+0x1000 = 0xd000 */
OSM_LOG(&p_osmt->log, OSM_LOG_INFO,
"Checking Creation of Maximum avaliable Groups (MulticastFDBCap)...\n");
tmp_mlid = cl_ntoh16(max_mlid) - cnt;
while (tmp_mlid > 0 && !ReachedMlidLimit) {
uint16_t cur_mlid = 0;
/* Request Set */
ib_member_set_join_state(&mc_req_rec,
IB_MC_REC_STATE_FULL_MEMBER);
/* Good Flow - mgid is 0 while giving all required fields for
join : P_Key, Q_Key, SL, FlowLabel, Tclass */
mc_req_rec.rate =
IB_LINK_WIDTH_ACTIVE_1X |
IB_PATH_SELECTOR_GREATER_THAN << 6;
mc_req_rec.mlid = max_mlid;
memset(&mc_req_rec.mgid, 0, sizeof(ib_gid_t));
comp_mask = IB_MCR_COMPMASK_MGID | IB_MCR_COMPMASK_PORT_GID | IB_MCR_COMPMASK_QKEY | IB_MCR_COMPMASK_PKEY | IB_MCR_COMPMASK_SL | IB_MCR_COMPMASK_FLOW | IB_MCR_COMPMASK_JOIN_STATE | IB_MCR_COMPMASK_TCLASS | /* all above are required */
IB_MCR_COMPMASK_MLID;
status = osmt_send_mcast_request(p_osmt, 1,
&mc_req_rec,
comp_mask,
&res_sa_mad);
p_mc_res = ib_sa_mad_get_payload_ptr(&res_sa_mad);
if (status != IB_SUCCESS) {
if (cur_mlid > cl_ntoh16(max_mlid)) {
OSM_LOG(&p_osmt->log, OSM_LOG_ERROR,
"ERR 2E1 "
"Successful Join with greater mlid than switches support (MulticastFDBCap) 0x%04X\n",
cur_mlid);
status = IB_ERROR;
osm_dump_mc_record(&p_osmt->log,
p_mc_res,
OSM_LOG_VERBOSE);
goto Exit;
} else
if ((res_sa_mad.
status & IB_SMP_STATUS_MASK) ==
IB_SA_MAD_STATUS_NO_RESOURCES) {
/* You can quitly exit the loop since no available mlid in SA DB
i.e. reached the maximum valiad avalable mlid */
ReachedMlidLimit = TRUE;
}
} else {
cur_mlid = cl_ntoh16(p_mc_res->mlid);
/* Save the mlid created in test_created_mlids map */
p_recvd_rec =
(ib_member_rec_t *)
ib_sa_mad_get_payload_ptr(&res_sa_mad);
OSM_LOG(&p_osmt->log, OSM_LOG_VERBOSE,
"Created MGID:%s MLID:0x%04X\n",
inet_ntop(AF_INET6,
p_recvd_rec->mgid.raw,
gid_str, sizeof gid_str),
cl_ntoh16(p_recvd_rec->mlid));
cl_map_insert(&test_created_mlids,
cl_ntoh16(p_recvd_rec->mlid),
p_recvd_rec);
}
tmp_mlid--;
}
}
/* Prepare the mc_req_rec for the rest of the flow */
osmt_init_mc_query_rec(p_osmt, &mc_req_rec);
/**************************************************************************/
/* o15.0.1.16: */
/* - Try GetTable with PortGUID wildcarded and get back some groups. */
status = osmt_query_mcast(p_osmt);
if (status != IB_SUCCESS) {
OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 02B1: "
"Failed to query multicast groups: %s\n",
ib_get_err_str(status));
goto Exit;
}
cnt = cl_qmap_count(&p_osmt->exp_subn.mgrp_mlid_tbl);
OSM_LOG(&p_osmt->log, OSM_LOG_INFO, "(Before Deletion of all MCG): "
"Number of MC Records found in SA DB is %d\n", cnt);
/* Delete all MCG that are not of IPoIB */
OSM_LOG(&p_osmt->log, OSM_LOG_INFO,
"Cleanup all MCG that are not IPoIB...\n");
p_mgrp_mlid_tbl = &p_osmt->exp_subn.mgrp_mlid_tbl;
p_mgrp = (osmtest_mgrp_t *) cl_qmap_head(p_mgrp_mlid_tbl);
/* scan all available multicast groups in the DB and fill in the table */
while (p_mgrp != (osmtest_mgrp_t *) cl_qmap_end(p_mgrp_mlid_tbl)) {
/* Only if different from IPoIB Mgid try to delete */
if (!IS_IPOIB_MGID(&p_mgrp->mcmember_rec.mgid)) {
osmt_init_mc_query_rec(p_osmt, &mc_req_rec);
mc_req_rec.mgid = p_mgrp->mcmember_rec.mgid;
/* o15-0.1.4 - need to specify the oppsite state for a valid delete */
if (!memcmp
(&special_mgid, &p_mgrp->mcmember_rec.mgid,
sizeof(special_mgid))) {
mc_req_rec.scope_state = 0x2F;
} else {
mc_req_rec.scope_state = 0x21;
}
comp_mask =
IB_MCR_COMPMASK_MGID |
IB_MCR_COMPMASK_PORT_GID |
IB_MCR_COMPMASK_JOIN_STATE;
OSM_LOG(&p_osmt->log, OSM_LOG_VERBOSE,
"Sending request to delete MGID : %s"
", scope_state : 0x%02X\n",
inet_ntop(AF_INET6, mc_req_rec.mgid.raw,
gid_str, sizeof gid_str),
mc_req_rec.scope_state);
status = osmt_send_mcast_request(p_osmt, 0, /* delete flag */
&mc_req_rec,
comp_mask,
&res_sa_mad);
if (status != IB_SUCCESS) {
OSM_LOG(&p_osmt->log, OSM_LOG_ERROR,
"ERR 02FF: Failed to delete MGID : %s"
" ,\n\t\t it is not our MCG, Status : %s/%s\n",
inet_ntop(AF_INET6,
p_mgrp->mcmember_rec.mgid.raw,
gid_str, sizeof gid_str),
ib_get_err_str(status),
ib_get_mad_status_str((ib_mad_t *)
(&res_sa_mad)));
fail_to_delete_mcg++;
}
} else {
end_ipoib_cnt++;
}
p_mgrp = (osmtest_mgrp_t *) cl_qmap_next(&p_mgrp->map_item);
}
status = osmt_query_mcast(p_osmt);
if (status != IB_SUCCESS) {
OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 02B2 "
"GetTable of all records has failed - got %s\n",
ib_get_err_str(status));
goto Exit;
}
/* If we are in single mode check flow - need to make sure all the multicast groups
that are left are not ones created during the flow.
*/
if (p_osmt->opt.mmode == 1 || p_osmt->opt.mmode == 3) {
end_cnt = cl_qmap_count(&p_osmt->exp_subn.mgrp_mlid_tbl);
OSM_LOG(&p_osmt->log, OSM_LOG_INFO, "Status of MC Records in SA DB during the test flow:\n" " Beginning of test\n" " Unrelated to the test: %d\n" " IPoIB MC Records : %d\n" " Total : %d\n" " End of test\n" " Failed to delete : %d\n" " IPoIB MC Records : %d\n" " Total : %d\n", mcg_outside_test_cnt, /* Non-IPoIB that existed at the beginning */
start_ipoib_cnt, /* IPoIB records */
start_cnt, /* Total: IPoIB and MC Records unrelated to the test */
fail_to_delete_mcg, /* Failed to delete at the end */
end_ipoib_cnt, /* IPoIB records */
end_cnt); /* Total MC Records at the end */
/* when we compare num of MCG we should consider an outside source which create other MCGs */
if ((end_cnt - fail_to_delete_mcg - end_ipoib_cnt) !=
(start_cnt - mcg_outside_test_cnt - start_ipoib_cnt)) {
OSM_LOG(&p_osmt->log, OSM_LOG_INFO,
"Got different number of non-IPoIB records stored in SA DB\n\t\t"
"at Start got %d, at End got %d (IPoIB groups only)\n",
(start_cnt - mcg_outside_test_cnt -
start_ipoib_cnt),
(end_cnt - fail_to_delete_mcg - end_ipoib_cnt));
}
p_mgrp_mlid_tbl = &p_osmt->exp_subn.mgrp_mlid_tbl;
p_mgrp = (osmtest_mgrp_t *) cl_qmap_head(p_mgrp_mlid_tbl);
while (p_mgrp !=
(osmtest_mgrp_t *) cl_qmap_end(p_mgrp_mlid_tbl)) {
uint16_t mlid =
(uint16_t) cl_qmap_key((cl_map_item_t *) p_mgrp);
OSM_LOG(&p_osmt->log, OSM_LOG_INFO,
"Found MLID:0x%04X\n", mlid);
/* Check if the mlid is in the test_created_mlids. If TRUE, then we
didn't delete a MCgroup that was created in this flow. */
if (cl_map_get(&test_created_mlids, mlid) != NULL) {
/* This means that we still have an mgrp that we created!! */
OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 02FE: "
"Wasn't able to erase mgrp with MGID:%s"
" MLID:0x%04X\n",
inet_ntop(AF_INET6,
p_mgrp->mcmember_rec.mgid.raw,
gid_str, sizeof gid_str),
mlid);
got_error = TRUE;
} else {
OSM_LOG(&p_osmt->log, OSM_LOG_INFO,
"Still exists %s MGID:%s\n",
(IS_IPOIB_MGID
(&p_mgrp->mcmember_rec.
mgid)) ? "IPoIB" : "non-IPoIB",
inet_ntop(AF_INET6,
p_mgrp->mcmember_rec.mgid.raw,
gid_str, sizeof gid_str));
}
p_mgrp =
(osmtest_mgrp_t *) cl_qmap_next(&p_mgrp->map_item);
}
if (got_error) {
__osmt_print_all_multicast_records(p_osmt);
status = IB_ERROR;
}
}
Exit:
OSM_LOG_EXIT(&p_osmt->log);
return status;
}
|