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
|
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
*/
/*
* ibtl_chan.c
*
* This file contains Transport API functions related to Channel Functions
* and internal Protection Domain and Address Handle Verbs functions.
*/
#include <sys/ib/ibtl/impl/ibtl.h>
#include <sys/ib/ibtl/impl/ibtl_cm.h>
#include <sys/ib/ib_pkt_hdrs.h>
static char ibtl_chan[] = "ibtl_chan";
/*
* RC Channel.
*/
/*
* Function:
* ibt_alloc_rc_channel
* Input:
* hca_hdl HCA Handle.
* flags Channel allocate flags.
* args A pointer to an ibt_rc_chan_alloc_args_t struct that
* specifies required channel attributes.
* Output:
* rc_chan_p The returned RC Channel handle.
* sizes NULL or a pointer to ibt_chan_sizes_s struct where
* new SendQ/RecvQ, and WR SGL sizes are returned.
* Returns:
* IBT_SUCCESS
* IBT_INVALID_PARAM
* Description:
* Allocates a RC communication channels that satisfy the specified
* channel attributes.
*/
ibt_status_t
ibt_alloc_rc_channel(ibt_hca_hdl_t hca_hdl, ibt_chan_alloc_flags_t flags,
ibt_rc_chan_alloc_args_t *args, ibt_channel_hdl_t *rc_chan_p,
ibt_chan_sizes_t *sizes)
{
ibt_status_t retval;
ibt_qp_alloc_attr_t qp_attr;
ibt_qp_info_t qp_modify_attr;
ibt_channel_hdl_t chanp;
IBTF_DPRINTF_L3(ibtl_chan, "ibt_alloc_rc_channel(%p, %x, %p, %p)",
hca_hdl, flags, args, sizes);
bzero(&qp_modify_attr, sizeof (ibt_qp_info_t));
qp_attr.qp_alloc_flags = IBT_QP_NO_FLAGS;
if (flags & IBT_ACHAN_USER_MAP)
qp_attr.qp_alloc_flags |= IBT_QP_USER_MAP;
if (flags & IBT_ACHAN_DEFER_ALLOC)
qp_attr.qp_alloc_flags |= IBT_QP_DEFER_ALLOC;
if (flags & IBT_ACHAN_USES_SRQ) {
if (args->rc_srq == NULL) {
IBTF_DPRINTF_L2(ibtl_chan, "ibt_alloc_rc_channel: "
"NULL SRQ Handle specified.");
return (IBT_INVALID_PARAM);
}
qp_attr.qp_alloc_flags |= IBT_QP_USES_SRQ;
}
/*
* Check if this request is to clone the channel, or to allocate a
* fresh one.
*/
if (flags & IBT_ACHAN_CLONE) {
ibt_rc_chan_query_attr_t chan_attrs;
if (args->rc_clone_chan == NULL) {
IBTF_DPRINTF_L2(ibtl_chan, "ibt_alloc_rc_channel: "
"Clone Channel info not available.");
return (IBT_INVALID_PARAM);
} else if (args->rc_clone_chan->ch_qp.qp_hca != hca_hdl) {
IBTF_DPRINTF_L2(ibtl_chan, "ibt_alloc_rc_channel: "
"Clone Channel's & requested HCA Handle mismatch");
return (IBT_INVALID_PARAM);
}
IBTF_DPRINTF_L3(ibtl_chan, "ibt_alloc_rc_channel: "
"Clone <%p> - RC Channel", args->rc_clone_chan);
/*
* Query the source channel, to obtained the attributes
* so that the new channel share the same attributes.
*/
retval = ibt_query_rc_channel(args->rc_clone_chan, &chan_attrs);
if (retval != IBT_SUCCESS) {
IBTF_DPRINTF_L2(ibtl_chan, "ibt_alloc_rc_channel: "
"Failed to query the source channel: %d", retval);
return (retval);
}
/* Setup QP alloc attributes. */
qp_attr.qp_scq_hdl = chan_attrs.rc_scq;
qp_attr.qp_rcq_hdl = chan_attrs.rc_rcq;
qp_attr.qp_pd_hdl = chan_attrs.rc_pd;
qp_attr.qp_flags = chan_attrs.rc_flags;
qp_attr.qp_srq_hdl = chan_attrs.rc_srq;
bcopy(&chan_attrs.rc_chan_sizes, &qp_attr.qp_sizes,
sizeof (ibt_chan_sizes_t));
qp_modify_attr.qp_flags = chan_attrs.rc_control;
qp_modify_attr.qp_transport.rc.rc_path.cep_hca_port_num =
chan_attrs.rc_prim_path.cep_hca_port_num;
qp_modify_attr.qp_transport.rc.rc_path.cep_pkey_ix =
chan_attrs.rc_prim_path.cep_pkey_ix;
} else {
/* Setup QP alloc attributes. */
qp_attr.qp_scq_hdl = args->rc_scq;
qp_attr.qp_rcq_hdl = args->rc_rcq;
qp_attr.qp_pd_hdl = args->rc_pd;
qp_attr.qp_flags = args->rc_flags;
qp_attr.qp_srq_hdl = args->rc_srq;
bcopy(&args->rc_sizes, &qp_attr.qp_sizes,
sizeof (ibt_chan_sizes_t));
qp_modify_attr.qp_flags = args->rc_control;
if ((args->rc_hca_port_num == 0) ||
(args->rc_hca_port_num > IBTL_HCA2NPORTS(hca_hdl))) {
IBTF_DPRINTF_L2(ibtl_chan, "ibt_alloc_rc_channel: "
"Invalid port_num %d, range is (1 to %d)",
args->rc_hca_port_num, IBTL_HCA2NPORTS(hca_hdl));
return (IBT_HCA_PORT_INVALID);
}
qp_modify_attr.qp_transport.rc.rc_path.cep_hca_port_num =
args->rc_hca_port_num;
/*
* We allocate the Channel initially with the default PKey,
* and later client can update this when the channel is opened
* with the pkey returned from a path record lookup.
*/
mutex_enter(&ibtl_clnt_list_mutex);
qp_modify_attr.qp_transport.rc.rc_path.cep_pkey_ix =
hca_hdl->ha_hca_devp->
hd_portinfop[args->rc_hca_port_num - 1].p_def_pkey_ix;
mutex_exit(&ibtl_clnt_list_mutex);
}
/* Allocate Channel and Initialize the channel. */
retval = ibt_alloc_qp(hca_hdl, IBT_RC_RQP, &qp_attr, sizes, NULL,
&chanp);
if (retval != IBT_SUCCESS) {
IBTF_DPRINTF_L2(ibtl_chan, "ibt_alloc_rc_channel: "
"Failed to allocate QP: %d", retval);
*rc_chan_p = NULL;
return (retval);
}
qp_modify_attr.qp_trans = IBT_RC_SRV;
/* Initialize RC Channel by transitioning it to INIT State. */
retval = ibt_initialize_qp(chanp, &qp_modify_attr);
if (retval != IBT_SUCCESS) {
IBTF_DPRINTF_L2(ibtl_chan, "ibt_alloc_rc_channel: "
"Failed to Initialize QP: %d", retval);
/* Free the QP as we failed to initialize it. */
(void) ibt_free_qp(chanp);
*rc_chan_p = NULL;
return (retval);
}
*rc_chan_p = chanp;
IBTF_DPRINTF_L3(ibtl_chan, "ibt_alloc_rc_channel(%p): - SUCCESS (%p)",
hca_hdl, chanp);
return (IBT_SUCCESS);
}
/*
* Function:
* ibt_query_rc_channel
* Input:
* rc_chan A previously allocated channel handle.
* chan_attrs A pointer to an ibt_rc_chan_query_args_t struct where
* Channel's current attributes are returned.
* Output:
* chan_attrs A pointer to an ibt_rc_chan_query_args_t struct where
* Channel's current attributes are returned.
* Returns:
* IBT_SUCCESS
* Description:
* Query an RC channel's attributes.
*/
ibt_status_t
ibt_query_rc_channel(ibt_channel_hdl_t rc_chan,
ibt_rc_chan_query_attr_t *chan_attrs)
{
ibt_status_t retval;
ibt_qp_query_attr_t qp_attr;
IBTF_DPRINTF_L3(ibtl_chan, "ibt_query_rc_channel(%p, %p)",
rc_chan, chan_attrs);
if (rc_chan->ch_qp.qp_type != IBT_RC_SRV) {
IBTF_DPRINTF_L2(ibtl_chan, "ibt_query_rc_channel: "
"type of channel (%d) is not RC", rc_chan->ch_qp.qp_type);
return (IBT_CHAN_SRV_TYPE_INVALID);
}
bzero(&qp_attr, sizeof (ibt_qp_query_attr_t));
/* Query the channel (QP) */
retval = ibt_query_qp(rc_chan, &qp_attr);
if (retval != IBT_SUCCESS) {
IBTF_DPRINTF_L2(ibtl_chan, "ibt_query_rc_channel: "
"ibt_query_qp failed on QP %p: %d", rc_chan, retval);
return (retval);
}
chan_attrs->rc_hca_guid = IBTL_HCA2HCAGUID(IBTL_CHAN2HCA(rc_chan));
chan_attrs->rc_scq = qp_attr.qp_sq_cq;
chan_attrs->rc_rcq = qp_attr.qp_rq_cq;
chan_attrs->rc_pd = rc_chan->ch_qp.qp_pd_hdl;
chan_attrs->rc_state = qp_attr.qp_info.qp_state;
chan_attrs->rc_path_mtu = qp_attr.qp_info.qp_transport.rc.rc_path_mtu;
chan_attrs->rc_path_retry_cnt =
qp_attr.qp_info.qp_transport.rc.rc_retry_cnt;
chan_attrs->rc_path_rnr_retry_cnt =
qp_attr.qp_info.qp_transport.rc.rc_rnr_retry_cnt;
chan_attrs->rc_min_rnr_nak =
qp_attr.qp_info.qp_transport.rc.rc_min_rnr_nak;
chan_attrs->rc_prim_path = qp_attr.qp_info.qp_transport.rc.rc_path;
chan_attrs->rc_alt_path = qp_attr.qp_info.qp_transport.rc.rc_alt_path;
chan_attrs->rc_chan_sizes.cs_sq = qp_attr.qp_info.qp_sq_sz;
chan_attrs->rc_chan_sizes.cs_rq = qp_attr.qp_info.qp_rq_sz;
chan_attrs->rc_chan_sizes.cs_sq_sgl = qp_attr.qp_sq_sgl;
chan_attrs->rc_chan_sizes.cs_rq_sgl = qp_attr.qp_rq_sgl;
chan_attrs->rc_srq = qp_attr.qp_srq;
chan_attrs->rc_rdma_ra_out =
qp_attr.qp_info.qp_transport.rc.rc_rdma_ra_out;
chan_attrs->rc_rdma_ra_in =
qp_attr.qp_info.qp_transport.rc.rc_rdma_ra_in;
chan_attrs->rc_flags = rc_chan->ch_qp.qp_flags;
chan_attrs->rc_control = qp_attr.qp_info.qp_flags;
chan_attrs->rc_mig_state = qp_attr.qp_info.qp_transport.rc.rc_mig_state;
chan_attrs->rc_qpn = qp_attr.qp_qpn & IB_QPN_MASK;
chan_attrs->rc_dst_qpn =
qp_attr.qp_info.qp_transport.rc.rc_dst_qpn & IB_QPN_MASK;
return (retval);
}
/*
* Function:
* ibt_modify_rc_channel
* Input:
* rc_chan A previously allocated channel handle.
* flags Specifies which attributes in ibt_rc_chan_modify_attr_t
* are to be modified.
* attrs Attributes to be modified.
* Output:
* actual_sz On return contains the new send and receive queue sizes.
* Returns:
* IBT_SUCCESS
* Description:
* Modifies an RC channel's attributes, as specified by a
* ibt_cep_modify_flags_t parameter to those specified in the
* ibt_rc_chan_modify_attr_t structure.
*/
ibt_status_t
ibt_modify_rc_channel(ibt_channel_hdl_t rc_chan, ibt_cep_modify_flags_t flags,
ibt_rc_chan_modify_attr_t *attrs, ibt_queue_sizes_t *actual_sz)
{
ibt_status_t retval;
ibt_qp_info_t qp_info;
int retries = 1;
IBTF_DPRINTF_L3(ibtl_chan, "ibt_modify_rc_channel(%p, %x, %p, %p)",
rc_chan, flags, attrs, actual_sz);
if (rc_chan->ch_qp.qp_type != IBT_RC_SRV) {
IBTF_DPRINTF_L2(ibtl_chan, "ibt_modify_rc_channel: "
"type of channel (%d) is not RC", rc_chan->ch_qp.qp_type);
return (IBT_CHAN_SRV_TYPE_INVALID);
}
retry:
bzero(&qp_info, sizeof (ibt_qp_info_t));
if (flags & IBT_CEP_SET_ADDS_VECT) {
bcopy(&attrs->rc_prim_adds_vect,
&qp_info.qp_transport.rc.rc_path.cep_adds_vect,
sizeof (ibt_adds_vect_t));
}
qp_info.qp_trans = IBT_RC_SRV;
qp_info.qp_transport.rc.rc_path.cep_hca_port_num =
attrs->rc_prim_port_num;
qp_info.qp_transport.rc.rc_retry_cnt = attrs->rc_path_retry_cnt;
qp_info.qp_transport.rc.rc_rnr_retry_cnt =
attrs->rc_path_rnr_retry_cnt;
qp_info.qp_transport.rc.rc_rdma_ra_out = attrs->rc_rdma_ra_out;
qp_info.qp_transport.rc.rc_rdma_ra_in = attrs->rc_rdma_ra_in;
/* Current channel state must be either SQD or RTS. */
qp_info.qp_current_state = rc_chan->ch_current_state;
qp_info.qp_state = rc_chan->ch_current_state; /* No Change in State */
qp_info.qp_flags = attrs->rc_control;
qp_info.qp_sq_sz = attrs->rc_sq_sz;
qp_info.qp_rq_sz = attrs->rc_rq_sz;
qp_info.qp_transport.rc.rc_min_rnr_nak = attrs->rc_min_rnr_nak;
if (flags & IBT_CEP_SET_ALT_PATH) {
bcopy(&attrs->rc_alt_adds_vect,
&qp_info.qp_transport.rc.rc_alt_path.cep_adds_vect,
sizeof (ibt_adds_vect_t));
qp_info.qp_transport.rc.rc_alt_path.cep_hca_port_num =
attrs->rc_alt_port_num;
}
flags |= IBT_CEP_SET_STATE;
retval = ibt_modify_qp(rc_chan, flags, &qp_info, actual_sz);
if (retval != IBT_SUCCESS) {
IBTF_DPRINTF_L2(ibtl_chan, "ibt_modify_rc_channel: "
"ibt_modify_qp failed on QP %p: %d", rc_chan, retval);
/* give it one more shot if the old current state was stale */
if (qp_info.qp_current_state != rc_chan->ch_current_state &&
--retries >= 0 &&
(qp_info.qp_current_state == IBT_STATE_RTS ||
qp_info.qp_current_state == IBT_STATE_SQD))
goto retry;
}
return (retval);
}
/*
* UD Channel.
*/
/*
* Function:
* ibt_alloc_ud_channel
* Input:
* hca_hdl HCA Handle.
* flags Channel allocate flags.
* args A pointer to an ibt_ud_chan_alloc_args_t struct that
* specifies required channel attributes.
* Output:
* ud_chan_p The returned UD Channel handle.
* sizes NULL or a pointer to ibt_chan_sizes_s struct where
* new SendQ/RecvQ, and WR SGL sizes are returned.
* Returns:
* IBT_SUCCESS
* IBT_INVALID_PARAM
* Description:
* Allocate UD channels that satisfy the specified channel attributes.
*/
ibt_status_t
ibt_alloc_ud_channel(ibt_hca_hdl_t hca_hdl, ibt_chan_alloc_flags_t flags,
ibt_ud_chan_alloc_args_t *args, ibt_channel_hdl_t *ud_chan_p,
ibt_chan_sizes_t *sizes)
{
ibt_status_t retval;
ibt_qp_alloc_attr_t qp_attr;
ibt_qp_info_t qp_modify_attr;
ibt_channel_hdl_t chanp;
ibt_chan_alloc_flags_t variant_flags;
IBTF_DPRINTF_L3(ibtl_chan, "ibt_alloc_ud_channel(%p, %x, %p, %p)",
hca_hdl, flags, args, sizes);
if (flags & IBT_ACHAN_USES_FEXCH) {
IBTF_DPRINTF_L2(ibtl_chan, "ibt_alloc_ud_channel: "
"FEXCH QPs are allocated by ibt_alloc_ud_channel_range()");
return (IBT_CHAN_SRV_TYPE_INVALID);
}
bzero(&qp_modify_attr, sizeof (ibt_qp_info_t));
bzero(&qp_attr, sizeof (ibt_qp_alloc_attr_t));
qp_attr.qp_alloc_flags = IBT_QP_NO_FLAGS;
/* allow at most one of these flags */
variant_flags = flags & (IBT_ACHAN_USER_MAP | IBT_ACHAN_USES_RSS |
IBT_ACHAN_USES_RFCI | IBT_ACHAN_USES_FCMD | IBT_ACHAN_CLONE);
switch (variant_flags) {
case IBT_ACHAN_USER_MAP:
qp_attr.qp_alloc_flags |= IBT_QP_USER_MAP;
break;
case IBT_ACHAN_USES_RSS:
qp_attr.qp_alloc_flags |= IBT_QP_USES_RSS;
qp_modify_attr.qp_transport.ud.ud_rss = args->ud_rss;
break;
case IBT_ACHAN_USES_RFCI:
qp_attr.qp_alloc_flags |= IBT_QP_USES_RFCI;
qp_modify_attr.qp_transport.ud.ud_fc = qp_attr.qp_fc =
args->ud_fc;
break;
case IBT_ACHAN_USES_FCMD:
qp_attr.qp_alloc_flags |= IBT_QP_USES_FCMD;
qp_modify_attr.qp_transport.ud.ud_fc = qp_attr.qp_fc =
args->ud_fc;
break;
case IBT_ACHAN_CLONE:
case 0:
break;
default:
return (IBT_INVALID_PARAM);
}
if (flags & IBT_ACHAN_DEFER_ALLOC)
qp_attr.qp_alloc_flags |= IBT_QP_DEFER_ALLOC;
if (flags & IBT_ACHAN_USES_SRQ) {
if (args->ud_srq == NULL) {
IBTF_DPRINTF_L2(ibtl_chan, "ibt_alloc_ud_channel: "
"NULL SRQ Handle specified.");
return (IBT_INVALID_PARAM);
}
if (flags & IBT_ACHAN_USES_RSS) {
IBTF_DPRINTF_L2(ibtl_chan, "ibt_alloc_ud_channel: "
"SRQ not allowed with RSS.");
return (IBT_INVALID_PARAM);
}
qp_attr.qp_alloc_flags |= IBT_QP_USES_SRQ;
}
/*
* Check if this request is to clone the channel, or to allocate a
* fresh one.
*/
if (flags & IBT_ACHAN_CLONE) {
ibt_ud_chan_query_attr_t chan_attrs;
if (args->ud_clone_chan == NULL) {
IBTF_DPRINTF_L2(ibtl_chan, "ibt_alloc_ud_channel: "
"Clone Channel info not available.");
return (IBT_INVALID_PARAM);
} else if (args->ud_clone_chan->ch_qp.qp_hca != hca_hdl) {
IBTF_DPRINTF_L2(ibtl_chan, "ibt_alloc_ud_channel: "
"Clone Channel and HCA Handle mismatch");
return (IBT_INVALID_PARAM);
}
IBTF_DPRINTF_L3(ibtl_chan, "ibt_alloc_ud_channel: "
"Clone <%p> - UD Channel", args->ud_clone_chan);
retval = ibt_query_ud_channel(args->ud_clone_chan, &chan_attrs);
if (retval != IBT_SUCCESS) {
IBTF_DPRINTF_L2(ibtl_chan, "ibt_alloc_ud_channel: "
"Failed to Query the source channel: %d", retval);
return (retval);
}
/* Setup QP alloc attributes. */
qp_attr.qp_scq_hdl = chan_attrs.ud_scq;
qp_attr.qp_rcq_hdl = chan_attrs.ud_rcq;
qp_attr.qp_pd_hdl = chan_attrs.ud_pd;
qp_attr.qp_flags = chan_attrs.ud_flags;
qp_attr.qp_srq_hdl = chan_attrs.ud_srq;
bcopy(&chan_attrs.ud_chan_sizes, &qp_attr.qp_sizes,
sizeof (ibt_chan_sizes_t));
qp_modify_attr.qp_transport.ud.ud_port =
chan_attrs.ud_hca_port_num;
qp_modify_attr.qp_transport.ud.ud_qkey = chan_attrs.ud_qkey;
qp_modify_attr.qp_transport.ud.ud_pkey_ix =
chan_attrs.ud_pkey_ix;
} else {
ib_pkey_t tmp_pkey;
/* Setup QP alloc attributes. */
qp_attr.qp_scq_hdl = args->ud_scq;
qp_attr.qp_rcq_hdl = args->ud_rcq;
qp_attr.qp_pd_hdl = args->ud_pd;
qp_attr.qp_flags = args->ud_flags;
qp_attr.qp_srq_hdl = args->ud_srq;
bcopy(&args->ud_sizes, &qp_attr.qp_sizes,
sizeof (ibt_chan_sizes_t));
qp_modify_attr.qp_transport.ud.ud_port = args->ud_hca_port_num;
qp_modify_attr.qp_transport.ud.ud_qkey = args->ud_qkey;
/* Validate input hca_port_num and pkey_ix values. */
if ((retval = ibt_index2pkey(hca_hdl, args->ud_hca_port_num,
args->ud_pkey_ix, &tmp_pkey)) != IBT_SUCCESS) {
IBTF_DPRINTF_L2(ibtl_chan, "ibt_alloc_ud_channel: "
"ibt_index2pkey failed, status: %d", retval);
*ud_chan_p = NULL;
return (retval);
}
qp_modify_attr.qp_transport.ud.ud_pkey_ix = args->ud_pkey_ix;
}
/* Allocate Channel and Initialize the channel. */
retval = ibt_alloc_qp(hca_hdl, IBT_UD_RQP, &qp_attr, sizes, NULL,
&chanp);
if (retval != IBT_SUCCESS) {
IBTF_DPRINTF_L2(ibtl_chan, "ibt_alloc_ud_channel: "
"Failed to allocate QP: %d", retval);
*ud_chan_p = NULL;
return (retval);
}
/* Initialize UD Channel by transitioning it to RTS State. */
qp_modify_attr.qp_trans = IBT_UD_SRV;
qp_modify_attr.qp_flags = IBT_CEP_NO_FLAGS;
qp_modify_attr.qp_transport.ud.ud_sq_psn = 0;
retval = ibt_initialize_qp(chanp, &qp_modify_attr);
if (retval != IBT_SUCCESS) {
IBTF_DPRINTF_L2(ibtl_chan, "ibt_alloc_ud_channel: "
"Failed to Initialize QP: %d", retval);
/* Free the QP as we failed to initialize it. */
(void) ibt_free_qp(chanp);
*ud_chan_p = NULL;
return (retval);
}
*ud_chan_p = chanp;
IBTF_DPRINTF_L3(ibtl_chan, "ibt_alloc_ud_channel(%p): - SUCCESS (%p)",
hca_hdl, chanp);
return (IBT_SUCCESS);
}
/*
* Function:
* ibt_alloc_ud_channel_range
* Input:
* hca_hdl HCA Handle.
* log2 Log (base 2) of the number of QPs to allocate.
* flags Channel allocate flags.
* args A pointer to an ibt_ud_chan_alloc_args_t struct that
* specifies required channel attributes.
* send_cq A pointer to an array of CQ handles.
* recv_cq A pointer to an array of CQ handles.
* Output:
* base_qpn_p The returned QP number of the base QP.
* ud_chan_p The returned UD Channel handle.
* sizes NULL or a pointer to ibt_chan_sizes_s struct where
* new SendQ/RecvQ, and WR SGL sizes are returned.
* Returns:
* IBT_SUCCESS
* IBT_INVALID_PARAM
* Description:
* Allocate UD channels that satisfy the specified channel attributes.
*/
ibt_status_t
ibt_alloc_ud_channel_range(ibt_hca_hdl_t hca_hdl, uint_t log2,
ibt_chan_alloc_flags_t flags, ibt_ud_chan_alloc_args_t *args,
ibt_cq_hdl_t *send_cq, ibt_cq_hdl_t *recv_cq, ib_qpn_t *base_qpn_p,
ibt_channel_hdl_t *ud_chan_p, ibt_chan_sizes_t *sizes)
{
ibt_status_t retval;
ibt_qp_alloc_attr_t qp_attr;
ibt_qp_info_t qp_modify_attr;
ibtl_channel_t *chanp;
ibt_cq_hdl_t ibt_cq_hdl;
ibc_cq_hdl_t *ibc_send_cq, *ibc_recv_cq;
ibc_qp_hdl_t *ibc_qp_hdl_p;
int i, n = 1 << log2;
ib_pkey_t tmp_pkey;
IBTF_DPRINTF_L3(ibtl_chan, "ibt_alloc_ud_channel_range(%p, %x, %p, %p)",
hca_hdl, flags, args, sizes);
bzero(&qp_modify_attr, sizeof (ibt_qp_info_t));
qp_attr.qp_alloc_flags = IBT_QP_NO_FLAGS;
if (flags & IBT_ACHAN_CLONE)
return (IBT_INVALID_PARAM);
if (flags & IBT_ACHAN_USER_MAP)
qp_attr.qp_alloc_flags |= IBT_QP_USER_MAP;
if (flags & IBT_ACHAN_DEFER_ALLOC)
qp_attr.qp_alloc_flags |= IBT_QP_DEFER_ALLOC;
if (flags & IBT_ACHAN_USES_SRQ) {
if (args->ud_srq == NULL) {
IBTF_DPRINTF_L2(ibtl_chan, "ibt_alloc_ud_channel: "
"NULL SRQ Handle specified.");
return (IBT_INVALID_PARAM);
}
qp_attr.qp_alloc_flags |= IBT_QP_USES_SRQ;
}
if (flags & IBT_ACHAN_USES_FEXCH) {
qp_attr.qp_alloc_flags |= IBT_QP_USES_FEXCH;
qp_attr.qp_fc = args->ud_fc;
qp_modify_attr.qp_transport.ud.ud_fc = qp_attr.qp_fc =
args->ud_fc;
}
if (flags & IBT_ACHAN_USES_RSS) {
if (log2 >
hca_hdl->ha_hca_devp->hd_hca_attr->hca_rss_max_log2_table)
return (IBT_INSUFF_RESOURCE);
qp_attr.qp_alloc_flags |= IBT_QP_USES_RSS;
}
ibc_send_cq = kmem_alloc(sizeof (ibc_cq_hdl_t) << log2, KM_SLEEP);
ibc_recv_cq = kmem_alloc(sizeof (ibc_cq_hdl_t) << log2, KM_SLEEP);
ibc_qp_hdl_p = kmem_alloc(sizeof (ibc_qp_hdl_t) << log2, KM_SLEEP);
for (i = 0; i < 1 << log2; i++) {
ud_chan_p[i] = kmem_zalloc(sizeof (ibtl_channel_t), KM_SLEEP);
ibt_cq_hdl = send_cq[i];
ibc_send_cq[i] = ibt_cq_hdl ? ibt_cq_hdl->cq_ibc_cq_hdl : NULL;
ibt_cq_hdl = recv_cq[i];
ibc_recv_cq[i] = ibt_cq_hdl ? ibt_cq_hdl->cq_ibc_cq_hdl : NULL;
}
/* Setup QP alloc attributes. */
qp_attr.qp_pd_hdl = args->ud_pd;
qp_attr.qp_flags = args->ud_flags;
qp_attr.qp_srq_hdl = args->ud_srq;
bcopy(&args->ud_sizes, &qp_attr.qp_sizes,
sizeof (ibt_chan_sizes_t));
qp_modify_attr.qp_transport.ud.ud_port = args->ud_hca_port_num;
qp_modify_attr.qp_transport.ud.ud_qkey = args->ud_qkey;
/* Validate input hca_port_num and pkey_ix values. */
if ((retval = ibt_index2pkey(hca_hdl, args->ud_hca_port_num,
args->ud_pkey_ix, &tmp_pkey)) != IBT_SUCCESS) {
IBTF_DPRINTF_L2(ibtl_chan, "ibt_alloc_ud_channel_range:"
" ibt_index2pkey failed, status: %d", retval);
goto fail;
}
qp_modify_attr.qp_transport.ud.ud_pkey_ix = args->ud_pkey_ix;
/* Allocate Channel and Initialize the channel. */
retval = (IBTL_HCA2CIHCAOPS_P(hca_hdl)->ibc_alloc_qp_range)(
IBTL_HCA2CIHCA(hca_hdl), log2, (ibtl_qp_hdl_t *)ud_chan_p,
IBT_UD_RQP, &qp_attr, sizes, ibc_send_cq, ibc_recv_cq,
base_qpn_p, ibc_qp_hdl_p);
if (retval != IBT_SUCCESS) {
IBTF_DPRINTF_L2(ibtl_chan, "ibt_alloc_ud_channel_range: "
"Failed to allocate QPs: %d", retval);
goto fail;
}
/* Initialize UD Channel by transitioning it to RTS State. */
qp_modify_attr.qp_trans = IBT_UD_SRV;
qp_modify_attr.qp_flags = IBT_CEP_NO_FLAGS;
qp_modify_attr.qp_transport.ud.ud_sq_psn = 0;
for (i = 0; i < n; i++) {
/* Initialize the internal QP struct. */
chanp = ud_chan_p[i];
chanp->ch_qp.qp_type = IBT_UD_SRV;
chanp->ch_qp.qp_hca = hca_hdl;
chanp->ch_qp.qp_ibc_qp_hdl = ibc_qp_hdl_p[i];
chanp->ch_qp.qp_send_cq = send_cq[i];
chanp->ch_qp.qp_recv_cq = recv_cq[i];
chanp->ch_current_state = IBT_STATE_RESET;
mutex_init(&chanp->ch_cm_mutex, NULL, MUTEX_DEFAULT, NULL);
cv_init(&chanp->ch_cm_cv, NULL, CV_DEFAULT, NULL);
retval = ibt_initialize_qp(chanp, &qp_modify_attr);
if (retval != IBT_SUCCESS) {
int j;
IBTF_DPRINTF_L2(ibtl_chan, "ibt_alloc_ud_channel_range:"
" Failed to Initialize QP: %d", retval);
/* Free the QP as we failed to initialize it. */
(void) ibt_free_qp(chanp);
for (j = 0; j < i; j++) {
chanp = ud_chan_p[j];
(void) ibt_free_qp(chanp);
}
goto fail;
}
/*
* The IBTA spec does not include the signal type or PD on a QP
* query operation. In order to implement the "CLONE" feature
* we need to cache these values.
*/
chanp->ch_qp.qp_flags = qp_attr.qp_flags;
chanp->ch_qp.qp_pd_hdl = qp_attr.qp_pd_hdl;
}
IBTF_DPRINTF_L2(ibtl_chan, "ibt_alloc_ud_channel_range(%p): SUCCESS");
atomic_add_32(&hca_hdl->ha_qp_cnt, n);
retval = IBT_SUCCESS;
fail:
kmem_free(ibc_send_cq, sizeof (ibc_cq_hdl_t) << log2);
kmem_free(ibc_recv_cq, sizeof (ibc_cq_hdl_t) << log2);
kmem_free(ibc_qp_hdl_p, sizeof (ibc_qp_hdl_t) << log2);
if (retval != IBT_SUCCESS) {
for (i = 0; i < 1 << log2; i++) {
kmem_free(ud_chan_p[i], sizeof (ibtl_channel_t));
ud_chan_p[i] = NULL;
}
IBTF_DPRINTF_L2(ibtl_chan, "ibt_alloc_ud_channel_range(%p): "
"failed: %d", retval);
}
return (retval);
}
/*
* Function:
* ibt_query_ud_channel
* Input:
* ud_chan A previously allocated UD channel handle.
* Output:
* chan_attrs Channel's current attributes.
* Returns:
* IBT_SUCCESS
* Description:
* Query a UD channel's attributes.
*/
ibt_status_t
ibt_query_ud_channel(ibt_channel_hdl_t ud_chan,
ibt_ud_chan_query_attr_t *ud_chan_attrs)
{
ibt_status_t retval;
ibt_qp_query_attr_t qp_attr;
IBTF_DPRINTF_L3(ibtl_chan, "ibt_query_ud_channel(%p, %p)",
ud_chan, ud_chan_attrs);
if (ud_chan->ch_qp.qp_type != IBT_UD_SRV) {
IBTF_DPRINTF_L2(ibtl_chan, "ibt_query_ud_channel: "
"type of channel (%d) is not UD", ud_chan->ch_qp.qp_type);
return (IBT_CHAN_SRV_TYPE_INVALID);
}
bzero(&qp_attr, sizeof (ibt_qp_query_attr_t));
/* Query the channel (QP) */
retval = ibt_query_qp(ud_chan, &qp_attr);
if (retval != IBT_SUCCESS) {
IBTF_DPRINTF_L2(ibtl_chan, "ibt_query_ud_channel: "
"ibt_query_qp failed on QP %p: %d", ud_chan, retval);
return (retval);
}
ud_chan_attrs->ud_qpn = qp_attr.qp_qpn & IB_QPN_MASK;
ud_chan_attrs->ud_hca_guid = IBTL_HCA2HCAGUID(IBTL_CHAN2HCA(ud_chan));
ud_chan_attrs->ud_scq = qp_attr.qp_sq_cq;
ud_chan_attrs->ud_rcq = qp_attr.qp_rq_cq;
ud_chan_attrs->ud_pd = ud_chan->ch_qp.qp_pd_hdl;
ud_chan_attrs->ud_hca_port_num =
qp_attr.qp_info.qp_transport.ud.ud_port;
ud_chan_attrs->ud_state = qp_attr.qp_info.qp_state;
ud_chan_attrs->ud_pkey_ix = qp_attr.qp_info.qp_transport.ud.ud_pkey_ix;
ud_chan_attrs->ud_qkey = qp_attr.qp_info.qp_transport.ud.ud_qkey;
ud_chan_attrs->ud_chan_sizes.cs_sq = qp_attr.qp_info.qp_sq_sz;
ud_chan_attrs->ud_chan_sizes.cs_rq = qp_attr.qp_info.qp_rq_sz;
ud_chan_attrs->ud_chan_sizes.cs_sq_sgl = qp_attr.qp_sq_sgl;
ud_chan_attrs->ud_chan_sizes.cs_rq_sgl = qp_attr.qp_rq_sgl;
ud_chan_attrs->ud_srq = qp_attr.qp_srq;
ud_chan_attrs->ud_flags = ud_chan->ch_qp.qp_flags;
ud_chan_attrs->ud_query_fc = qp_attr.qp_query_fexch;
return (retval);
}
/*
* Function:
* ibt_modify_ud_channel
* Input:
* ud_chan A previously allocated UD channel handle.
* flags Specifies which attributes in ibt_ud_chan_modify_attr_t
* are to be modified.
* attrs Attributes to be modified.
* Output:
* actual_sz On return contains the new send and receive queue sizes.
* Returns:
* IBT_SUCCESS
* Description:
* Modifies an UD channel's attributes, as specified by a
* ibt_cep_modify_flags_t parameter to those specified in the
* ibt_ud_chan_modify_attr_t structure.
*/
ibt_status_t
ibt_modify_ud_channel(ibt_channel_hdl_t ud_chan, ibt_cep_modify_flags_t flags,
ibt_ud_chan_modify_attr_t *attrs, ibt_queue_sizes_t *actual_sz)
{
ibt_status_t retval;
ibt_qp_info_t qp_info;
ibt_cep_modify_flags_t good_flags;
int retries = 1;
IBTF_DPRINTF_L3(ibtl_chan, "ibt_modify_ud_channel(%p, %x, %p, %p)",
ud_chan, flags, attrs, actual_sz);
if (ud_chan->ch_qp.qp_type != IBT_UD_SRV) {
IBTF_DPRINTF_L2(ibtl_chan, "ibt_modify_ud_channel: "
"type of channel (%d) is not UD", ud_chan->ch_qp.qp_type);
return (IBT_CHAN_SRV_TYPE_INVALID);
}
good_flags = IBT_CEP_SET_SQ_SIZE | IBT_CEP_SET_RQ_SIZE |
IBT_CEP_SET_QKEY;
if (flags & ~good_flags) {
IBTF_DPRINTF_L2(ibtl_chan, "ibt_modify_ud_channel: "
"Invalid Modify Flags: %x", flags);
return (IBT_INVALID_PARAM);
}
retry:
bzero(&qp_info, sizeof (ibt_qp_info_t));
qp_info.qp_state = ud_chan->ch_current_state; /* No Change in State */
qp_info.qp_current_state = ud_chan->ch_current_state;
qp_info.qp_flags = IBT_CEP_NO_FLAGS;
qp_info.qp_sq_sz = attrs->ud_sq_sz;
qp_info.qp_rq_sz = attrs->ud_rq_sz;
qp_info.qp_trans = IBT_UD_SRV;
qp_info.qp_transport.ud.ud_qkey = attrs->ud_qkey;
flags |= IBT_CEP_SET_STATE;
retval = ibt_modify_qp(ud_chan, flags, &qp_info, actual_sz);
if (retval != IBT_SUCCESS) {
IBTF_DPRINTF_L2(ibtl_chan, "ibt_modify_ud_channel: "
"ibt_modify_qp failed on QP %p: %d", ud_chan, retval);
/* give it one more shot if the old current state was stale */
if (qp_info.qp_current_state != ud_chan->ch_current_state &&
--retries >= 0 &&
(qp_info.qp_current_state == IBT_STATE_RTS ||
qp_info.qp_current_state == IBT_STATE_SQD))
goto retry;
}
return (retval);
}
/*
* Function:
* ibt_recover_ud_channel
* Input:
* ud_chan An UD channel handle which is in SQError state.
* Output:
* none.
* Returns:
* IBT_SUCCESS
* IBT_CHAN_HDL_INVALID
* IBT_CHAN_SRV_TYPE_INVALID
* IBT_CHAN_STATE_INVALID
* Description:
* Recover an UD Channel which has transitioned to SQ Error state. The
* ibt_recover_ud_channel() transitions the channel from SQ Error state
* to Ready-To-Send channel state.
*
* If a work request posted to a UD channel's send queue completes with
* an error (see ibt_wc_status_t), the channel gets transitioned to SQ
* Error state. In order to reuse this channel, ibt_recover_ud_channel()
* can be used to recover the channel to a usable (Ready-to-Send) state.
*/
ibt_status_t
ibt_recover_ud_channel(ibt_channel_hdl_t ud_chan)
{
ibt_qp_info_t modify_attr;
ibt_status_t retval;
IBTF_DPRINTF_L3(ibtl_chan, "ibt_recover_ud_channel(%p)", ud_chan);
if (ud_chan->ch_qp.qp_type != IBT_UD_SRV) {
IBTF_DPRINTF_L2(ibtl_chan, "ibt_recover_ud_channel: "
"Called for non-UD channels<%d>", ud_chan->ch_qp.qp_type);
return (IBT_CHAN_SRV_TYPE_INVALID);
}
bzero(&modify_attr, sizeof (ibt_qp_info_t));
/* Set the channel state to RTS, to activate the send processing. */
modify_attr.qp_state = IBT_STATE_RTS;
modify_attr.qp_trans = ud_chan->ch_qp.qp_type;
modify_attr.qp_current_state = IBT_STATE_SQE;
retval = ibt_modify_qp(ud_chan, IBT_CEP_SET_STATE, &modify_attr, NULL);
if (retval != IBT_SUCCESS)
IBTF_DPRINTF_L2(ibtl_chan, "ibt_recover_ud_channel: "
"ibt_modify_qp failed on qp %p: status = %d",
ud_chan, retval);
return (retval);
}
/*
* Function:
* ibt_flush_channel
* Input:
* chan The opaque channel handle returned in a previous call
* to ibt_alloc_ud_channel() or ibt_alloc_rc_channel().
* Output:
* none.
* Returns:
* IBT_SUCCESS
* Description:
* Flush the specified channel. Outstanding work requests are flushed
* so that the client can do the associated clean up. After that, the
* client will usually deregister the previously registered memory,
* then free the channel by calling ibt_free_channel(). This function
* applies to UD channels, or to RC channels that have not successfully
* been opened.
*/
ibt_status_t
ibt_flush_channel(ibt_channel_hdl_t chan)
{
ibt_status_t retval;
IBTF_DPRINTF_L3(ibtl_chan, "ibt_flush_channel(%p)", chan);
retval = ibt_flush_qp(chan);
if (retval != IBT_SUCCESS) {
IBTF_DPRINTF_L2(ibtl_chan, "ibt_flush_channel: "
"ibt_flush_qp failed on QP %p: %d", chan, retval);
}
return (retval);
}
/*
* Function:
* ibt_free_channel
* Input:
* chan The opaque channel handle returned in a previous
* call to ibt_alloc_{ud,rc}_channel().
* Output:
* none.
* Returns:
* IBT_SUCCESS
* Description:
* Releases the resources associated with the specified channel.
* It is well assumed that channel has been closed before this.
*/
ibt_status_t
ibt_free_channel(ibt_channel_hdl_t chan)
{
return (ibt_free_qp(chan));
}
/*
* UD Destination.
*/
/*
* Function:
* ibt_alloc_ud_dest
* Input:
* hca_hdl HCA Handle.
* pd Protection Domain
* Output:
* ud_dest_p Address to store the returned UD destination handle.
* Returns:
* IBT_SUCCESS
* Description:
* Allocate a UD destination handle. The returned UD destination handle
* has no useful contents, but is usable after calling ibt_modify_ud_dest,
* ibt_modify_reply_ud_dest, or ibt_open_ud_dest.
*/
ibt_status_t
ibt_alloc_ud_dest(ibt_hca_hdl_t hca_hdl, ibt_ud_dest_flags_t flags,
ibt_pd_hdl_t pd, ibt_ud_dest_hdl_t *ud_dest_p)
{
ibt_status_t retval;
ibt_ud_dest_t *ud_destp;
ibt_ah_hdl_t ah;
ibt_adds_vect_t adds_vect;
IBTF_DPRINTF_L3(ibtl_chan, "ibt_alloc_ud_dest(%p, %x, %p)",
hca_hdl, flags, pd);
bzero(&adds_vect, sizeof (adds_vect));
adds_vect.av_port_num = 1;
adds_vect.av_srate = IBT_SRATE_1X; /* assume the minimum */
retval = ibt_alloc_ah(hca_hdl, flags, pd, &adds_vect, &ah);
if (retval != IBT_SUCCESS) {
IBTF_DPRINTF_L2(ibtl_chan, "ibt_alloc_ud_dest: "
"Address Handle Allocation failed: %d", retval);
*ud_dest_p = NULL;
return (retval);
}
ud_destp = kmem_alloc(sizeof (*ud_destp), KM_SLEEP);
ud_destp->ud_ah = ah;
ud_destp->ud_dest_hca = hca_hdl;
ud_destp->ud_dst_qpn = 0;
ud_destp->ud_qkey = 0;
*ud_dest_p = ud_destp;
return (IBT_SUCCESS);
}
/*
* Function:
* ibt_query_ud_dest
* Input:
* ud_dest A previously allocated UD destination handle.
* Output:
* dest_attrs UD destination's current attributes.
* Returns:
* IBT_SUCCESS
* Description:
* Query a UD destination's attributes.
*/
ibt_status_t
ibt_query_ud_dest(ibt_ud_dest_hdl_t ud_dest,
ibt_ud_dest_query_attr_t *dest_attrs)
{
ibt_status_t retval;
ASSERT(dest_attrs != NULL);
/* Query Address Handle */
retval = ibt_query_ah(ud_dest->ud_dest_hca, ud_dest->ud_ah,
&dest_attrs->ud_pd, &dest_attrs->ud_addr_vect);
if (retval != IBT_SUCCESS) {
IBTF_DPRINTF_L2(ibtl_chan, "ibt_query_ud_dest: "
"Failed to Query Address Handle: %d", retval);
return (retval);
}
/* Update the return struct. */
dest_attrs->ud_hca_hdl = ud_dest->ud_dest_hca;
dest_attrs->ud_dst_qpn = ud_dest->ud_dst_qpn;
dest_attrs->ud_qkey = ud_dest->ud_qkey;
return (retval);
}
/*
* Function:
* ibt_modify_ud_dest
* Input:
* ud_dest A previously allocated UD destination handle
* as returned by ibt_alloc_ud_dest().
* qkey QKey of the destination.
* dest_qpn QPN of the destination.
* adds_vect NULL or Address Vector for the destination.
*
* Output:
* none.
* Returns:
* IBT_SUCCESS
* Description:
* Modify a previously allocated UD destination handle from the
* arguments supplied by the caller.
*/
ibt_status_t
ibt_modify_ud_dest(ibt_ud_dest_hdl_t ud_dest, ib_qkey_t qkey,
ib_qpn_t dest_qpn, ibt_adds_vect_t *adds_vect)
{
ibt_status_t retval;
IBTF_DPRINTF_L3(ibtl_chan, "ibt_modify_ud_dest(%p, %x, %x, %p) ",
ud_dest, qkey, dest_qpn, adds_vect);
if ((adds_vect != NULL) &&
(retval = ibt_modify_ah(ud_dest->ud_dest_hca, ud_dest->ud_ah,
adds_vect)) != IBT_SUCCESS) {
IBTF_DPRINTF_L2(ibtl_chan, "ibt_modify_ud_dest: "
"ibt_modify_ah() failed: status = %d", retval);
return (retval);
}
ud_dest->ud_dst_qpn = dest_qpn;
ud_dest->ud_qkey = qkey;
return (IBT_SUCCESS);
}
/*
* Function:
* ibt_free_ud_dest
* Input:
* ud_dest The opaque destination handle returned in a previous
* call to ibt_alloc_ud_dest() or ibt_alloc_mcg_dest().
* Output:
* none.
* Returns:
* IBT_SUCCESS
* Description:
* Releases the resources associated with the specified destination
* handle.
*/
ibt_status_t
ibt_free_ud_dest(ibt_ud_dest_hdl_t ud_dest)
{
ibt_status_t retval;
retval = ibt_free_ah(ud_dest->ud_dest_hca, ud_dest->ud_ah);
if (retval != IBT_SUCCESS) {
IBTF_DPRINTF_L2(ibtl_chan, "ibt_free_ud_dest: "
"Address Handle free failed: %d", retval);
return (retval);
}
kmem_free(ud_dest, sizeof (*ud_dest));
return (IBT_SUCCESS);
}
static ibt_status_t
ibtl_find_sgid_ix(ib_gid_t *sgid, ibt_channel_hdl_t ud_chan, uint8_t port,
uint_t *sgid_ix_p)
{
ibtl_hca_devinfo_t *hca_devp = ud_chan->ch_qp.qp_hca->ha_hca_devp;
ib_gid_t *sgidp;
uint_t i;
uint_t sgid_tbl_sz;
if (port == 0 || port > hca_devp->hd_hca_attr->hca_nports ||
sgid->gid_prefix == 0 || sgid->gid_guid == 0) {
*sgid_ix_p = 0;
return (IBT_INVALID_PARAM);
}
mutex_enter(&ibtl_clnt_list_mutex);
sgidp = &hca_devp->hd_portinfop[port - 1].p_sgid_tbl[0];
sgid_tbl_sz = hca_devp->hd_portinfop[port - 1].p_sgid_tbl_sz;
for (i = 0; i < sgid_tbl_sz; i++, sgidp++) {
if ((sgid->gid_guid != sgidp->gid_guid) ||
(sgid->gid_prefix != sgidp->gid_prefix))
continue;
mutex_exit(&ibtl_clnt_list_mutex);
*sgid_ix_p = i;
return (IBT_SUCCESS);
}
mutex_exit(&ibtl_clnt_list_mutex);
*sgid_ix_p = 0;
return (IBT_INVALID_PARAM);
}
/*
* Function:
* ibt_modify_reply_ud_dest
* Input:
* ud_dest A previously allocated UD reply destination handle
* as returned by ibt_alloc_ud_dest().
* qkey Qkey. 0 means "not specified", so use the Q_Key
* in the QP context.
* recv_buf Pointer to the first data buffer associated with the
* receive work request.
* Output:
* Returns:
* IBT_SUCCESS
* Description:
* Modify a previously allocated UD destination handle, so that it
* can be used to reply to the sender of the datagram contained in the
* specified work request completion. If the qkey is not supplied (0),
* then use the qkey in the QP (we just set qkey to a privileged QKEY).
*/
ibt_status_t
ibt_modify_reply_ud_dest(ibt_channel_hdl_t ud_chan, ibt_ud_dest_hdl_t ud_dest,
ib_qkey_t qkey, ibt_wc_t *wc, ib_vaddr_t recv_buf)
{
ibt_status_t retval;
ibt_adds_vect_t adds_vect;
ib_grh_t *grh;
uint8_t port;
uint32_t ver_tc_flow;
IBTF_DPRINTF_L3(ibtl_chan, "ibt_modify_reply_ud_dest(%p, %p, %x, %p, "
"%llx)", ud_chan, ud_dest, qkey, wc, recv_buf);
if (ud_chan->ch_qp.qp_type != IBT_UD_SRV) {
IBTF_DPRINTF_L2(ibtl_chan, "ibt_modify_reply_ud_dest: "
"type of channel (%d) is not UD",
ud_chan->ch_qp.qp_type);
return (IBT_CHAN_SRV_TYPE_INVALID);
}
if (qkey == 0)
qkey = ud_chan->ch_transport.ud.ud_qkey;
port = ud_chan->ch_transport.ud.ud_port_num;
if (wc->wc_flags & IBT_WC_GRH_PRESENT) {
grh = (ib_grh_t *)(uintptr_t)recv_buf;
adds_vect.av_send_grh = B_TRUE;
adds_vect.av_dgid.gid_prefix = b2h64(grh->SGID.gid_prefix);
adds_vect.av_dgid.gid_guid = b2h64(grh->SGID.gid_guid);
adds_vect.av_sgid.gid_prefix = b2h64(grh->DGID.gid_prefix);
adds_vect.av_sgid.gid_guid = b2h64(grh->DGID.gid_guid);
(void) ibtl_find_sgid_ix(&adds_vect.av_sgid, ud_chan,
port, &adds_vect.av_sgid_ix);
ver_tc_flow = b2h32(grh->IPVer_TC_Flow);
adds_vect.av_flow = ver_tc_flow & IB_GRH_FLOW_LABEL_MASK;
adds_vect.av_tclass = (ver_tc_flow & IB_GRH_TCLASS_MASK) >> 20;
adds_vect.av_hop = grh->HopLmt;
} else {
adds_vect.av_send_grh = B_FALSE;
adds_vect.av_dgid.gid_prefix = 0;
adds_vect.av_sgid.gid_prefix = 0;
adds_vect.av_dgid.gid_guid = 0;
adds_vect.av_sgid.gid_guid = 0;
adds_vect.av_sgid_ix = 0;
adds_vect.av_flow = 0;
adds_vect.av_tclass = 0;
adds_vect.av_hop = 0;
}
adds_vect.av_srate = IBT_SRATE_1X; /* assume the minimum */
adds_vect.av_srvl = wc->wc_sl;
adds_vect.av_dlid = wc->wc_slid;
adds_vect.av_src_path = wc->wc_path_bits;
adds_vect.av_port_num = port;
if ((retval = ibt_modify_ah(ud_dest->ud_dest_hca, ud_dest->ud_ah,
&adds_vect)) != IBT_SUCCESS) {
IBTF_DPRINTF_L2(ibtl_chan, "ibt_modify_reply_ud_dest: "
"ibt_alloc_ah() failed: status = %d", retval);
return (retval);
}
ud_dest->ud_dst_qpn = wc->wc_qpn & IB_QPN_MASK;
ud_dest->ud_qkey = qkey;
return (IBT_SUCCESS);
}
/*
* Function:
* ibt_is_privileged_ud_dest
* Input:
* ud_dest A previously allocated destination handle.
* Output:
* none
* Returns:
* B_FALSE/B_TRUE
* Description:
* Determine if a UD destination Handle is a privileged handle.
*/
boolean_t
ibt_is_privileged_ud_dest(ibt_ud_dest_hdl_t ud_dest)
{
return ((ud_dest->ud_qkey & IB_PRIVILEGED_QKEY_BIT) ? B_TRUE : B_FALSE);
}
/*
* Function:
* ibt_update_channel_qkey
* Input:
* ud_chan The UD channel handle, that is to be used to
* communicate with the specified destination.
*
* ud_dest A UD destination handle returned from
* ibt_alloc_ud_dest(9F).
* Output:
* none
* Returns:
* IBT_SUCCESS
* Description:
* ibt_update_channel_qkey() sets the Q_Key in the specified channel context
* to the Q_Key in the specified destination handle. This function can be used
* to enable sends to a privileged destination. All posted send work requests
* that contain a privileged destination handle now use the Q_Key in the
* channel context.
*
* ibt_update_channel_qkey() can also be used to enable the caller to receive
* from the specified remote destination on the specified channel.
*/
ibt_status_t
ibt_update_channel_qkey(ibt_channel_hdl_t ud_chan, ibt_ud_dest_hdl_t ud_dest)
{
ibt_status_t retval;
ibt_qp_info_t qp_info;
IBTF_DPRINTF_L3(ibtl_chan, "ibt_update_channel_qkey(%p, %p)",
ud_chan, ud_dest);
if (ud_chan->ch_qp.qp_type != IBT_UD_SRV) {
IBTF_DPRINTF_L2(ibtl_chan, "ibt_update_channel_qkey: "
"type of channel (%d) is not UD",
ud_chan->ch_qp.qp_type);
return (IBT_CHAN_SRV_TYPE_INVALID);
}
bzero(&qp_info, sizeof (ibt_qp_info_t));
qp_info.qp_trans = IBT_UD_SRV;
qp_info.qp_state = ud_chan->ch_current_state;
qp_info.qp_current_state = ud_chan->ch_current_state;
qp_info.qp_transport.ud.ud_qkey = ud_dest->ud_qkey;
retval = ibt_modify_qp(ud_chan, IBT_CEP_SET_QKEY | IBT_CEP_SET_STATE,
&qp_info, NULL);
if (retval != IBT_SUCCESS) {
IBTF_DPRINTF_L2(ibtl_chan, "ibt_update_channel_qkey: "
"Failed to modify QP %p: status %d", ud_chan, retval);
} else {
ud_chan->ch_transport.ud.ud_qkey = ud_dest->ud_qkey;
}
return (retval);
}
/*
* Function:
* ibt_set_chan_private
* Input:
* chan A previously allocated channel handle.
* clnt_private The client private data.
* Output:
* none.
* Returns:
* none.
* Description:
* Set the client private data.
*/
void
ibt_set_chan_private(ibt_channel_hdl_t chan, void *clnt_private)
{
chan->ch_clnt_private = clnt_private;
}
/*
* Function:
* ibt_get_chan_private
* Input:
* chan A previously allocated channel handle.
* Output:
* A pointer to the client private data.
* Returns:
* none.
* Description:
* Get a pointer to client private data.
*/
void *
ibt_get_chan_private(ibt_channel_hdl_t chan)
{
return (chan->ch_clnt_private);
}
/*
* Function:
* ibt_channel_to_hca_guid
* Input:
* chan Channel Handle.
* Output:
* none.
* Returns:
* hca_guid Returned HCA GUID on which the specified Channel is
* allocated. Valid if it is non-NULL on return.
* Description:
* A helper function to retrieve HCA GUID for the specified Channel.
*/
ib_guid_t
ibt_channel_to_hca_guid(ibt_channel_hdl_t chan)
{
IBTF_DPRINTF_L3(ibtl_chan, "ibt_channel_to_hca_guid(%p)", chan);
return (IBTL_HCA2HCAGUID(IBTL_CHAN2HCA(chan)));
}
/*
* Protection Domain Verbs Functions.
*/
/*
* Function:
* ibt_alloc_pd
* Input:
* hca_hdl The IBT HCA handle, the device on which we need
* to create the requested Protection Domain.
* flags IBT_PD_NO_FLAGS, IBT_PD_USER_MAP or IBT_PD_DEFER_ALLOC
* Output:
* pd IBT Protection Domain Handle.
* Returns:
* IBT_SUCCESS
* IBT_HCA_HDL_INVALID
* Description:
* Allocate a Protection Domain.
*/
ibt_status_t
ibt_alloc_pd(ibt_hca_hdl_t hca_hdl, ibt_pd_flags_t flags, ibt_pd_hdl_t *pd)
{
ibt_status_t retval;
IBTF_DPRINTF_L3(ibtl_chan, "ibt_alloc_pd(%p, %x)", hca_hdl, flags);
/* re-direct the call to CI's call */
ibtl_qp_flow_control_enter();
retval = IBTL_HCA2CIHCAOPS_P(hca_hdl)->ibc_alloc_pd(
IBTL_HCA2CIHCA(hca_hdl), flags, pd);
ibtl_qp_flow_control_exit();
if (retval != IBT_SUCCESS) {
IBTF_DPRINTF_L2(ibtl_chan, "ibt_alloc_pd: CI PD Alloc Err");
return (retval);
}
/* Update the PDs Resource Count per HCA Device. */
atomic_inc_32(&hca_hdl->ha_pd_cnt);
return (retval);
}
/*
* Function:
* ibt_free_pd
* Input:
* hca_hdl The IBT HCA handle, the device on which we need
* to free the requested Protection Domain.
* pd IBT Protection Domain Handle.
* Output:
* none.
* Returns:
* IBT_SUCCESS
* IBT_HCA_HDL_INVALID
* IBT_MEM_PD_HDL_INVALID
* IBT_MEM_PD_IN_USE
* Description:
* Release/de-allocate a Protection Domain.
*/
ibt_status_t
ibt_free_pd(ibt_hca_hdl_t hca_hdl, ibt_pd_hdl_t pd)
{
ibt_status_t retval;
IBTF_DPRINTF_L3(ibtl_chan, "ibt_free_pd(%p, %p)", hca_hdl, pd);
/* re-direct the call to CI's call */
retval = IBTL_HCA2CIHCAOPS_P(hca_hdl)->ibc_free_pd(
IBTL_HCA2CIHCA(hca_hdl), pd);
if (retval != IBT_SUCCESS) {
IBTF_DPRINTF_L2(ibtl_chan, "ibt_free_pd: CI Free PD Failed");
return (retval);
}
/* Update the PDs Resource Count per HCA Device. */
atomic_dec_32(&hca_hdl->ha_pd_cnt);
return (retval);
}
/*
* Address Handle Verbs Functions.
*/
/*
* Function:
* ibt_alloc_ah
* Input:
* hca_hdl The IBT HCA Handle.
* pd The IBT Protection Domain to associate with this handle.
* adds_vectp Points to an ibt_adds_vect_t struct.
* Output:
* ah IBT Address Handle.
* Returns:
* IBT_SUCCESS
* IBT_HCA_HDL_INVALID
* IBT_INSUFF_RESOURCE
* IBT_MEM_PD_HDL_INVALID
* Description:
* Allocate and returns an Address Handle.
*/
ibt_status_t
ibt_alloc_ah(ibt_hca_hdl_t hca_hdl, ibt_ah_flags_t flags, ibt_pd_hdl_t pd,
ibt_adds_vect_t *adds_vectp, ibt_ah_hdl_t *ah)
{
ibt_status_t retval;
IBTF_DPRINTF_L3(ibtl_chan, "ibt_alloc_ah(%p, %x, %p, %p)",
hca_hdl, flags, pd, adds_vectp);
/* XXX - if av_send_grh, need to compute av_sgid_ix from av_sgid */
/* re-direct the call to CI's call */
retval = IBTL_HCA2CIHCAOPS_P(hca_hdl)->ibc_alloc_ah(
IBTL_HCA2CIHCA(hca_hdl), flags, pd, adds_vectp, ah);
if (retval != IBT_SUCCESS) {
IBTF_DPRINTF_L2(ibtl_chan, "ibt_alloc_ah: "
"ibc_alloc_ah failed: status = %d", retval);
return (retval);
}
/* Update the AHs Resource Count per HCA Device. */
atomic_inc_32(&hca_hdl->ha_ah_cnt);
return (retval);
}
/*
* Function:
* ibt_free_ah
* Input:
* hca_hdl The IBT HCA Handle.
* ah IBT Address Handle.
* Output:
* none.
* Returns:
* IBT_SUCCESS
* IBT_HCA_HDL_INVALID
* IBT_AH_HDL_INVALID
* Description:
* Release/de-allocate the specified Address Handle.
*/
ibt_status_t
ibt_free_ah(ibt_hca_hdl_t hca_hdl, ibt_ah_hdl_t ah)
{
ibt_status_t retval;
IBTF_DPRINTF_L3(ibtl_chan, "ibt_free_ah(%p, %p)", hca_hdl, ah);
/* re-direct the call to CI's call */
retval = IBTL_HCA2CIHCAOPS_P(hca_hdl)->ibc_free_ah(
IBTL_HCA2CIHCA(hca_hdl), ah);
if (retval != IBT_SUCCESS) {
IBTF_DPRINTF_L2(ibtl_chan, "ibt_free_ah: CI Free AH Failed");
return (retval);
}
/* Update the AHs Resource Count per HCA Device. */
atomic_dec_32(&hca_hdl->ha_ah_cnt);
return (retval);
}
/*
* Function:
* ibt_query_ah
* Input:
* hca_hdl The IBT HCA Handle.
* ah IBT Address Handle.
* Output:
* pd The Protection Domain Handle with which this
* Address Handle is associated.
* adds_vectp Points to an ibt_adds_vect_t struct.
* Returns:
* IBT_SUCCESS/IBT_HCA_HDL_INVALID/IBT_AH_HDL_INVALID
* Description:
* Obtain the address vector information for the specified address handle.
*/
ibt_status_t
ibt_query_ah(ibt_hca_hdl_t hca_hdl, ibt_ah_hdl_t ah, ibt_pd_hdl_t *pd,
ibt_adds_vect_t *adds_vectp)
{
ibt_status_t retval;
IBTF_DPRINTF_L3(ibtl_chan, "ibt_query_ah(%p, %p)", hca_hdl, ah);
/* re-direct the call to CI's call */
retval = (IBTL_HCA2CIHCAOPS_P(hca_hdl)->ibc_query_ah(
IBTL_HCA2CIHCA(hca_hdl), ah, pd, adds_vectp));
/*
* We need to fill in av_sgid, as the CI does only saves/restores
* av_sgid_ix.
*/
if (retval == IBT_SUCCESS) {
ibtl_hca_devinfo_t *hca_devp = hca_hdl->ha_hca_devp;
uint8_t port = adds_vectp->av_port_num;
mutex_enter(&ibtl_clnt_list_mutex);
if (port > 0 && port <= hca_devp->hd_hca_attr->hca_nports &&
adds_vectp->av_sgid_ix < IBTL_HDIP2SGIDTBLSZ(hca_devp)) {
ib_gid_t *sgidp;
sgidp = hca_devp->hd_portinfop[port-1].p_sgid_tbl;
adds_vectp->av_sgid = sgidp[adds_vectp->av_sgid_ix];
} else {
adds_vectp->av_sgid.gid_prefix = 0;
adds_vectp->av_sgid.gid_guid = 0;
}
mutex_exit(&ibtl_clnt_list_mutex);
}
return (retval);
}
/*
* Function:
* ibt_modify_ah
* Input:
* hca_hdl The IBT HCA Handle.
* ah IBT Address Handle.
* Output:
* adds_vectp Points to an ibt_adds_vect_t struct. The new address
* vector information is specified is returned in this
* structure.
* Returns:
* IBT_SUCCESS/IBT_HCA_HDL_INVALID/IBT_AH_HDL_INVALID
* Description:
* Modify the address vector information for the specified Address Handle.
*/
ibt_status_t
ibt_modify_ah(ibt_hca_hdl_t hca_hdl, ibt_ah_hdl_t ah,
ibt_adds_vect_t *adds_vectp)
{
IBTF_DPRINTF_L3(ibtl_chan, "ibt_modify_ah(%p, %p)", hca_hdl, ah);
/* XXX - if av_send_grh, need to compute av_sgid_ix from av_sgid */
/* re-direct the call to CI's call */
return (IBTL_HCA2CIHCAOPS_P(hca_hdl)->ibc_modify_ah(
IBTL_HCA2CIHCA(hca_hdl), ah, adds_vectp));
}
|