@@ -1490,11 +1490,12 @@ mlxcx_eq_check(void *arg)
14901490{
14911491 mlxcx_t * mlxp = (mlxcx_t * )arg ;
14921492 mlxcx_event_queue_t * eq ;
1493- mlxcx_eventq_ctx_t ctx ;
1493+ mlxcx_eventq_ctx_t * ctx ;
14941494 const char * str ;
1495-
14961495 uint_t i ;
14971496
1497+ ctx = kmem_zalloc (sizeof (* ctx ), KM_SLEEP );
1498+
14981499 for (i = 0 ; i < mlxp -> mlx_intr_count ; ++ i ) {
14991500 eq = & mlxp -> mlx_eqs [i ];
15001501
@@ -1508,26 +1509,26 @@ mlxcx_eq_check(void *arg)
15081509 */
15091510 ASSERT0 (eq -> mleq_state & MLXCX_EQ_DESTROYED );
15101511
1511- if (!mlxcx_cmd_query_eq (mlxp , eq , & ctx ))
1512+ if (!mlxcx_cmd_query_eq (mlxp , eq , ctx ))
15121513 continue ;
15131514
15141515 str = "???" ;
1515- switch (ctx . mleqc_status ) {
1516+ switch (ctx -> mleqc_status ) {
15161517 case MLXCX_EQ_STATUS_OK :
15171518 break ;
15181519 case MLXCX_EQ_STATUS_WRITE_FAILURE :
15191520 str = "WRITE_FAILURE" ;
15201521 break ;
15211522 }
15221523
1523- if (ctx . mleqc_status != MLXCX_EQ_STATUS_OK ) {
1524+ if (ctx -> mleqc_status != MLXCX_EQ_STATUS_OK ) {
15241525 mlxcx_fm_qstate_ereport (mlxp , "event" ,
1525- eq -> mleq_num , str , ctx . mleqc_status );
1526+ eq -> mleq_num , str , ctx -> mleqc_status );
15261527 mlxcx_warn (mlxp , "EQ %u is in bad status: %x (%s)" ,
1527- eq -> mleq_intr_index , ctx . mleqc_status , str );
1528+ eq -> mleq_intr_index , ctx -> mleqc_status , str );
15281529 }
15291530
1530- if (ctx . mleqc_state != MLXCX_EQ_ST_ARMED &&
1531+ if (ctx -> mleqc_state != MLXCX_EQ_ST_ARMED &&
15311532 (eq -> mleq_state & MLXCX_EQ_ARMED )) {
15321533 if (eq -> mleq_cc == eq -> mleq_check_disarm_cc &&
15331534 ++ eq -> mleq_check_disarm_cnt >= 3 ) {
@@ -1541,17 +1542,21 @@ mlxcx_eq_check(void *arg)
15411542 eq -> mleq_check_disarm_cnt = 0 ;
15421543 }
15431544 }
1545+
1546+ kmem_free (ctx , sizeof (* ctx ));
15441547}
15451548
15461549static void
15471550mlxcx_cq_check (void * arg )
15481551{
15491552 mlxcx_t * mlxp = (mlxcx_t * )arg ;
15501553 mlxcx_completion_queue_t * cq ;
1551- mlxcx_completionq_ctx_t ctx ;
1554+ mlxcx_completionq_ctx_t * ctx ;
15521555 const char * str , * type ;
15531556 uint_t v ;
15541557
1558+ ctx = kmem_zalloc (sizeof (* ctx ), KM_SLEEP );
1559+
15551560 for (cq = list_head (& mlxp -> mlx_cqs ); cq != NULL ;
15561561 cq = list_next (& mlxp -> mlx_cqs , cq )) {
15571562
@@ -1569,7 +1574,7 @@ mlxcx_cq_check(void *arg)
15691574 if (cq -> mlcq_fm_repd_qstate )
15701575 continue ;
15711576
1572- if (!mlxcx_cmd_query_cq (mlxp , cq , & ctx ))
1577+ if (!mlxcx_cmd_query_cq (mlxp , cq , ctx ))
15731578 continue ;
15741579
15751580 if (cq -> mlcq_wq != NULL ) {
@@ -1585,7 +1590,7 @@ mlxcx_cq_check(void *arg)
15851590 }
15861591
15871592 str = "???" ;
1588- v = get_bits32 (ctx . mlcqc_flags , MLXCX_CQ_CTX_STATUS );
1593+ v = get_bits32 (ctx -> mlcqc_flags , MLXCX_CQ_CTX_STATUS );
15891594 switch (v ) {
15901595 case MLXCX_CQC_STATUS_OK :
15911596 break ;
@@ -1608,7 +1613,7 @@ mlxcx_cq_check(void *arg)
16081613 cq -> mlcq_fm_repd_qstate = B_TRUE ;
16091614 }
16101615
1611- v = get_bits32 (ctx . mlcqc_flags , MLXCX_CQ_CTX_STATE );
1616+ v = get_bits32 (ctx -> mlcqc_flags , MLXCX_CQ_CTX_STATE );
16121617 if (v != MLXCX_CQC_STATE_ARMED &&
16131618 (cq -> mlcq_state & MLXCX_CQ_ARMED ) &&
16141619 !(cq -> mlcq_state & MLXCX_CQ_POLLING )) {
@@ -1624,19 +1629,25 @@ mlxcx_cq_check(void *arg)
16241629 cq -> mlcq_check_disarm_cc = 0 ;
16251630 }
16261631 }
1632+
1633+ kmem_free (ctx , sizeof (* ctx ));
16271634}
16281635
16291636void
16301637mlxcx_check_sq (mlxcx_t * mlxp , mlxcx_work_queue_t * sq )
16311638{
1632- mlxcx_sq_ctx_t ctx ;
1639+ mlxcx_sq_ctx_t * ctx ;
16331640 mlxcx_sq_state_t state ;
16341641
1635- if (!mlxcx_cmd_query_sq (mlxp , sq , & ctx ))
1642+ ctx = kmem_zalloc (sizeof (mlxcx_sq_ctx_t ), KM_SLEEP );
1643+
1644+ if (!mlxcx_cmd_query_sq (mlxp , sq , ctx )) {
1645+ kmem_free (ctx , sizeof (* ctx ));
16361646 return ;
1647+ }
16371648
1638- ASSERT3U (from_be24 (ctx . mlsqc_cqn ), = = , sq -> mlwq_cq -> mlcq_num );
1639- state = get_bits32 (ctx . mlsqc_flags , MLXCX_SQ_STATE );
1649+ ASSERT3U (from_be24 (ctx -> mlsqc_cqn ), = = , sq -> mlwq_cq -> mlcq_num );
1650+ state = get_bits32 (ctx -> mlsqc_flags , MLXCX_SQ_STATE );
16401651 switch (state ) {
16411652 case MLXCX_SQ_STATE_RST :
16421653 if (sq -> mlwq_state & MLXCX_WQ_STARTED ) {
@@ -1663,20 +1674,25 @@ mlxcx_check_sq(mlxcx_t *mlxp, mlxcx_work_queue_t *sq)
16631674 sq -> mlwq_fm_repd_qstate = B_TRUE ;
16641675 break ;
16651676 }
1677+
1678+ kmem_free (ctx , sizeof (mlxcx_sq_ctx_t ));
16661679}
16671680
16681681void
16691682mlxcx_check_rq (mlxcx_t * mlxp , mlxcx_work_queue_t * rq )
16701683{
1671- mlxcx_rq_ctx_t ctx ;
1684+ mlxcx_rq_ctx_t * ctx ;
16721685 mlxcx_rq_state_t state ;
16731686
1687+ ctx = kmem_zalloc (sizeof (* ctx ), KM_SLEEP );
16741688
1675- if (!mlxcx_cmd_query_rq (mlxp , rq , & ctx ))
1689+ if (!mlxcx_cmd_query_rq (mlxp , rq , ctx )) {
1690+ kmem_free (ctx , sizeof (* ctx ));
16761691 return ;
1692+ }
16771693
1678- ASSERT3U (from_be24 (ctx . mlrqc_cqn ), = = , rq -> mlwq_cq -> mlcq_num );
1679- state = get_bits32 (ctx . mlrqc_flags , MLXCX_RQ_STATE );
1694+ ASSERT3U (from_be24 (ctx -> mlrqc_cqn ), = = , rq -> mlwq_cq -> mlcq_num );
1695+ state = get_bits32 (ctx -> mlrqc_flags , MLXCX_RQ_STATE );
16801696 switch (state ) {
16811697 case MLXCX_RQ_STATE_RST :
16821698 if (rq -> mlwq_state & MLXCX_WQ_STARTED ) {
@@ -1703,6 +1719,8 @@ mlxcx_check_rq(mlxcx_t *mlxp, mlxcx_work_queue_t *rq)
17031719 rq -> mlwq_fm_repd_qstate = B_TRUE ;
17041720 break ;
17051721 }
1722+
1723+ kmem_free (ctx , sizeof (* ctx ));
17061724}
17071725
17081726static void
0 commit comments