35 static char ibtf_qp[] = "ibtl";
36
37 /* This table indirectly initializes the ibt_cep_next_state[] table. */
38 typedef struct ibt_cep_next_state_s {
39 ibt_cep_state_t next_state;
40 ibt_cep_modify_flags_t modify_flags;
41 } ibt_cep_next_state_t;
42
43 struct {
44 ibt_cep_state_t current_state;
45 ibt_cep_state_t next_state;
46 ibt_cep_modify_flags_t modify_flags;
47 } ibt_cep_next_state_inits[] = {
48 { IBT_STATE_RESET, IBT_STATE_INIT, IBT_CEP_SET_RESET_INIT},
49 { IBT_STATE_INIT, IBT_STATE_RTR, IBT_CEP_SET_INIT_RTR},
50 { IBT_STATE_RTR, IBT_STATE_RTS, IBT_CEP_SET_RTR_RTS}
51 };
52
53 ibt_cep_next_state_t ibt_cep_next_state[IBT_STATE_NUM];
54
55 _NOTE(SCHEME_PROTECTS_DATA("unique", ibt_cep_next_state))
56
57 /* The following data and functions can increase system stability. */
58
59 int ibtl_qp_calls_curr;
60 int ibtl_qp_calls_max = 128; /* limit on # of simultaneous QP verb calls */
61 kmutex_t ibtl_qp_mutex;
62 kcondvar_t ibtl_qp_cv;
63
64 void
65 ibtl_qp_flow_control_enter(void)
66 {
67 mutex_enter(&ibtl_qp_mutex);
68 while (ibtl_qp_calls_curr >= ibtl_qp_calls_max) {
69 cv_wait(&ibtl_qp_cv, &ibtl_qp_mutex);
70 }
71 ++ibtl_qp_calls_curr;
72 mutex_exit(&ibtl_qp_mutex);
73 }
74
75 void
76 ibtl_qp_flow_control_exit(void)
1268 * IBT_SUCCESS
1269 * Description:
1270 * Query the SendQ/RecvQ sizes of a channel.
1271 */
1272 ibt_status_t
1273 ibt_query_queues(ibt_channel_hdl_t chan, ibt_queue_sizes_t *actual_sz)
1274 {
1275 ibt_status_t retval;
1276 ibt_qp_query_attr_t qp_query_attr;
1277
1278 IBTF_DPRINTF_L3(ibtf_qp, "ibt_query_queues(%p)", chan);
1279
1280 /* Perform Query QP and retrieve QP sizes. */
1281 retval = ibt_query_qp(chan, &qp_query_attr);
1282 if (retval != IBT_SUCCESS) {
1283 IBTF_DPRINTF_L2(ibtf_qp, "ibt_query_queues: "
1284 "ibt_query_qp failed: qp %p: %d", chan, retval);
1285 return (retval);
1286 }
1287
1288 _NOTE(NOW_INVISIBLE_TO_OTHER_THREADS(actual_sz->qs_rq,
1289 actual_sz->qs_sq))
1290 actual_sz->qs_sq = qp_query_attr.qp_info.qp_sq_sz;
1291 actual_sz->qs_rq = qp_query_attr.qp_info.qp_rq_sz;
1292 _NOTE(NOW_VISIBLE_TO_OTHER_THREADS(actual_sz->qs_rq,
1293 actual_sz->qs_sq))
1294 chan->ch_current_state = qp_query_attr.qp_info.qp_state;
1295
1296 return (retval);
1297 }
1298
1299
1300 /*
1301 * Function:
1302 * ibt_modify_rdma
1303 * Input:
1304 * rc_chan A previously allocated channel handle.
1305 *
1306 * modify_flags Bitwise "or" of any of the following:
1307 * IBT_CEP_SET_RDMA_R Enable/Disable RDMA RD
1308 * IBT_CEP_SET_RDMA_W Enable/Disable RDMA WR
1309 * IBT_CEP_SET_ATOMIC Enable/Disable Atomics
1310 *
1311 * flags Channel End Point (CEP) Disable Flags (0 => enable).
1312 * IBT_CEP_NO_RDMA_RD Disable incoming RDMA RD's
1313 * IBT_CEP_NO_RDMA_WR Disable incoming RDMA WR's
|
35 static char ibtf_qp[] = "ibtl";
36
37 /* This table indirectly initializes the ibt_cep_next_state[] table. */
38 typedef struct ibt_cep_next_state_s {
39 ibt_cep_state_t next_state;
40 ibt_cep_modify_flags_t modify_flags;
41 } ibt_cep_next_state_t;
42
43 struct {
44 ibt_cep_state_t current_state;
45 ibt_cep_state_t next_state;
46 ibt_cep_modify_flags_t modify_flags;
47 } ibt_cep_next_state_inits[] = {
48 { IBT_STATE_RESET, IBT_STATE_INIT, IBT_CEP_SET_RESET_INIT},
49 { IBT_STATE_INIT, IBT_STATE_RTR, IBT_CEP_SET_INIT_RTR},
50 { IBT_STATE_RTR, IBT_STATE_RTS, IBT_CEP_SET_RTR_RTS}
51 };
52
53 ibt_cep_next_state_t ibt_cep_next_state[IBT_STATE_NUM];
54
55 /* The following data and functions can increase system stability. */
56
57 int ibtl_qp_calls_curr;
58 int ibtl_qp_calls_max = 128; /* limit on # of simultaneous QP verb calls */
59 kmutex_t ibtl_qp_mutex;
60 kcondvar_t ibtl_qp_cv;
61
62 void
63 ibtl_qp_flow_control_enter(void)
64 {
65 mutex_enter(&ibtl_qp_mutex);
66 while (ibtl_qp_calls_curr >= ibtl_qp_calls_max) {
67 cv_wait(&ibtl_qp_cv, &ibtl_qp_mutex);
68 }
69 ++ibtl_qp_calls_curr;
70 mutex_exit(&ibtl_qp_mutex);
71 }
72
73 void
74 ibtl_qp_flow_control_exit(void)
1266 * IBT_SUCCESS
1267 * Description:
1268 * Query the SendQ/RecvQ sizes of a channel.
1269 */
1270 ibt_status_t
1271 ibt_query_queues(ibt_channel_hdl_t chan, ibt_queue_sizes_t *actual_sz)
1272 {
1273 ibt_status_t retval;
1274 ibt_qp_query_attr_t qp_query_attr;
1275
1276 IBTF_DPRINTF_L3(ibtf_qp, "ibt_query_queues(%p)", chan);
1277
1278 /* Perform Query QP and retrieve QP sizes. */
1279 retval = ibt_query_qp(chan, &qp_query_attr);
1280 if (retval != IBT_SUCCESS) {
1281 IBTF_DPRINTF_L2(ibtf_qp, "ibt_query_queues: "
1282 "ibt_query_qp failed: qp %p: %d", chan, retval);
1283 return (retval);
1284 }
1285
1286 actual_sz->qs_sq = qp_query_attr.qp_info.qp_sq_sz;
1287 actual_sz->qs_rq = qp_query_attr.qp_info.qp_rq_sz;
1288 chan->ch_current_state = qp_query_attr.qp_info.qp_state;
1289
1290 return (retval);
1291 }
1292
1293
1294 /*
1295 * Function:
1296 * ibt_modify_rdma
1297 * Input:
1298 * rc_chan A previously allocated channel handle.
1299 *
1300 * modify_flags Bitwise "or" of any of the following:
1301 * IBT_CEP_SET_RDMA_R Enable/Disable RDMA RD
1302 * IBT_CEP_SET_RDMA_W Enable/Disable RDMA WR
1303 * IBT_CEP_SET_ATOMIC Enable/Disable Atomics
1304 *
1305 * flags Channel End Point (CEP) Disable Flags (0 => enable).
1306 * IBT_CEP_NO_RDMA_RD Disable incoming RDMA RD's
1307 * IBT_CEP_NO_RDMA_WR Disable incoming RDMA WR's
|