@@ -57,13 +57,20 @@ static void bnxt_qplib_service_creq(struct tasklet_struct *t);
5757 * bnxt_qplib_map_rc - map return type based on opcode
5858 * @opcode - roce slow path opcode
5959 *
60- * In some cases like firmware halt is detected, the driver is supposed to
61- * remap the error code of the timed out command.
60+ * case #1
61+ * Firmware initiated error recovery is a safe state machine and
62+ * driver can consider all the underlying rdma resources are free.
63+ * In this state, it is safe to return success for opcodes related to
64+ * destroying rdma resources (like destroy qp, destroy cq etc.).
6265 *
63- * It is not safe to assume hardware is really inactive so certain opcodes
64- * like destroy qp etc are not safe to be returned success, but this function
65- * will be called when FW already reports a timeout. This would be possible
66- * only when FW crashes and resets. This will clear all the HW resources.
66+ * case #2
67+ * If driver detect potential firmware stall, it is not safe state machine
68+ * and the driver can not consider all the underlying rdma resources are
69+ * freed.
70+ * In this state, it is not safe to return success for opcodes related to
71+ * destroying rdma resources (like destroy qp, destroy cq etc.).
72+ *
73+ * Scope of this helper function is only for case #1.
6774 *
6875 * Returns:
6976 * 0 to communicate success to caller.
@@ -417,7 +424,7 @@ static int __send_message_basic_sanity(struct bnxt_qplib_rcfw *rcfw,
417424
418425 /* Prevent posting if f/w is not in a state to process */
419426 if (test_bit (ERR_DEVICE_DETACHED , & rcfw -> cmdq .flags ))
420- return - ENXIO ;
427+ return bnxt_qplib_map_rc ( opcode ) ;
421428 if (test_bit (FIRMWARE_STALL_DETECTED , & cmdq -> flags ))
422429 return - ETIMEDOUT ;
423430
@@ -487,7 +494,7 @@ static int __bnxt_qplib_rcfw_send_message(struct bnxt_qplib_rcfw *rcfw,
487494
488495 rc = __send_message_basic_sanity (rcfw , msg , opcode );
489496 if (rc )
490- return rc == - ENXIO ? bnxt_qplib_map_rc ( opcode ) : rc ;
497+ return rc ;
491498
492499 rc = __send_message (rcfw , msg , opcode );
493500 if (rc )
0 commit comments