src/dpdk/drivers/net/qede/qede_debug.c
static enum dbg_status qed_parse_idle_chk_dump(struct ecore_hwfn *p_hwfn,
					       u32 *dump_buf,
					       u32 num_dumped_dwords,
					       char *results_buf,
					       u32 *parsed_results_bytes,
					       u32 *num_errors,
					       u32 *num_warnings)
{
	const char *section_name, *param_name, *param_str_val;
	u32 *dump_buf_end = dump_buf + num_dumped_dwords;
	u32 num_section_params = 0, num_rules;

	/* Offset in results_buf in bytes */
	u32 results_offset = 0;

	*parsed_results_bytes = 0;
	*num_errors = 0;
	*num_warnings = 0;

	if (!p_hwfn->dbg_arrays[BIN_BUF_DBG_PARSING_STRINGS].ptr ||
	    !p_hwfn->dbg_arrays[BIN_BUF_DBG_IDLE_CHK_PARSING_DATA].ptr)
		return DBG_STATUS_DBG_ARRAY_NOT_SET;

	/* Read global_params section */
	dump_buf += qed_read_section_hdr(dump_buf,
					 &section_name, &num_section_params);
	if (strcmp(section_name, "global_params"))
		return DBG_STATUS_IDLE_CHK_PARSE_FAILED;

	/* Print global params */
	dump_buf += qed_print_section_params(dump_buf,
					     num_section_params,
					     results_buf, &results_offset);

	/* Read idle_chk section */
	dump_buf += qed_read_section_hdr(dump_buf,
					 &section_name, &num_section_params);
	if (strcmp(section_name, "idle_chk") || num_section_params != 1)
		return DBG_STATUS_IDLE_CHK_PARSE_FAILED;
	dump_buf += qed_read_param(dump_buf,
				   &param_name, &param_str_val, &num_rules);
	if (strcmp(param_name, "num_rules"))
		return DBG_STATUS_IDLE_CHK_PARSE_FAILED;

	if (num_rules) {
		u32 rules_print_size;

		/* Print FW output */
		results_offset +=
		    sprintf(qed_get_buf_ptr(results_buf,
					    results_offset),
			    "FW_IDLE_CHECK:\n");
		rules_print_size =
			qed_parse_idle_chk_dump_rules(p_hwfn,
						      dump_buf,
						      dump_buf_end,
						      num_rules,
						      true,
						      results_buf ?
						      results_buf +
						      results_offset :
						      NULL,
						      num_errors,
						      num_warnings);
		results_offset += rules_print_size;
		if (!rules_print_size)
			return DBG_STATUS_IDLE_CHK_PARSE_FAILED;

		/* Print LSI output */
		results_offset +=
		    sprintf(qed_get_buf_ptr(results_buf,
					    results_offset),
			    "\nLSI_IDLE_CHECK:\n");
		rules_print_size =
			qed_parse_idle_chk_dump_rules(p_hwfn,
						      dump_buf,
						      dump_buf_end,
						      num_rules,
						      false,
						      results_buf ?
						      results_buf +
						      results_offset :
						      NULL,
						      num_errors,
						      num_warnings);
		results_offset += rules_print_size;
		if (!rules_print_size)
			return DBG_STATUS_IDLE_CHK_PARSE_FAILED;
	}

	/* Print errors/warnings count */
	if (*num_errors)
		results_offset +=
		    sprintf(qed_get_buf_ptr(results_buf,
					    results_offset),
			    "\nIdle Check failed!!! (with %d errors and %d warnings)\n",
			    *num_errors, *num_warnings);
	else if (*num_warnings)
		results_offset +=
		    sprintf(qed_get_buf_ptr(results_buf,
					    results_offset),
			    "\nIdle Check completed successfully (with %d warnings)\n",
			    *num_warnings);
	else
		results_offset +=
		    sprintf(qed_get_buf_ptr(results_buf,
					    results_offset),
			    "\nIdle Check completed successfully\n");

	/* Add 1 for string NULL termination */
	*parsed_results_bytes = results_offset + 1;

	return DBG_STATUS_OK;
}
/* Parses an idle check dump buffer.
 * If result_buf is not NULL, the idle check results are printed to it.
 * In any case, the required results buffer size is assigned to
 * parsed_results_bytes.
 * The parsing status is returned.
 */
Parses an idle check dump buffer.
If result_buf is not NULL, the idle check results are printed to it.
In any case, the required results buffer size is assigned to
parsed_results_bytes.
The parsing status is returned.
Parses an idle check dump buffer . If result_buf is not NULL the idle check results are printed to it . In any case the required results buffer size is assigned to parsed_results_bytes . The parsing status is returned .
static enum dbg_status qed_parse_idle_chk_dump(struct ecore_hwfn *p_hwfn,
					       u32 *dump_buf,
					       u32 num_dumped_dwords,
					       char *results_buf,
					       u32 *parsed_results_bytes,
					       u32 *num_errors,
					       u32 *num_warnings)
{
	const char *section_name, *param_name, *param_str_val;
	u32 *dump_buf_end = dump_buf + num_dumped_dwords;
	u32 num_section_params = 0, num_rules;
	u32 results_offset = 0;
	*parsed_results_bytes = 0;
	*num_errors = 0;
	*num_warnings = 0;
	if (!p_hwfn->dbg_arrays[BIN_BUF_DBG_PARSING_STRINGS].ptr ||
	    !p_hwfn->dbg_arrays[BIN_BUF_DBG_IDLE_CHK_PARSING_DATA].ptr)
		return DBG_STATUS_DBG_ARRAY_NOT_SET;
	dump_buf += qed_read_section_hdr(dump_buf,
					 &section_name, &num_section_params);
	if (strcmp(section_name, "global_params"))
		return DBG_STATUS_IDLE_CHK_PARSE_FAILED;
	dump_buf += qed_print_section_params(dump_buf,
					     num_section_params,
					     results_buf, &results_offset);
	dump_buf += qed_read_section_hdr(dump_buf,
					 &section_name, &num_section_params);
	if (strcmp(section_name, "idle_chk") || num_section_params != 1)
		return DBG_STATUS_IDLE_CHK_PARSE_FAILED;
	dump_buf += qed_read_param(dump_buf,
				   &param_name, &param_str_val, &num_rules);
	if (strcmp(param_name, "num_rules"))
		return DBG_STATUS_IDLE_CHK_PARSE_FAILED;
	if (num_rules) {
		u32 rules_print_size;
		results_offset +=
		    sprintf(qed_get_buf_ptr(results_buf,
					    results_offset),
			    "FW_IDLE_CHECK:\n");
		rules_print_size =
			qed_parse_idle_chk_dump_rules(p_hwfn,
						      dump_buf,
						      dump_buf_end,
						      num_rules,
						      true,
						      results_buf ?
						      results_buf +
						      results_offset :
						      NULL,
						      num_errors,
						      num_warnings);
		results_offset += rules_print_size;
		if (!rules_print_size)
			return DBG_STATUS_IDLE_CHK_PARSE_FAILED;
		results_offset +=
		    sprintf(qed_get_buf_ptr(results_buf,
					    results_offset),
			    "\nLSI_IDLE_CHECK:\n");
		rules_print_size =
			qed_parse_idle_chk_dump_rules(p_hwfn,
						      dump_buf,
						      dump_buf_end,
						      num_rules,
						      false,
						      results_buf ?
						      results_buf +
						      results_offset :
						      NULL,
						      num_errors,
						      num_warnings);
		results_offset += rules_print_size;
		if (!rules_print_size)
			return DBG_STATUS_IDLE_CHK_PARSE_FAILED;
	}
	if (*num_errors)
		results_offset +=
		    sprintf(qed_get_buf_ptr(results_buf,
					    results_offset),
			    "\nIdle Check failed!!! (with %d errors and %d warnings)\n",
			    *num_errors, *num_warnings);
	else if (*num_warnings)
		results_offset +=
		    sprintf(qed_get_buf_ptr(results_buf,
					    results_offset),
			    "\nIdle Check completed successfully (with %d warnings)\n",
			    *num_warnings);
	else
		results_offset +=
		    sprintf(qed_get_buf_ptr(results_buf,
					    results_offset),
			    "\nIdle Check completed successfully\n");
	*parsed_results_bytes = results_offset + 1;
	return DBG_STATUS_OK;
}
static enum dbg_status qed_parse_idle_chk_dump ( struct ecore_hwfn * p_hwfn , u32 * dump_buf , u32 num_dumped_dwords , char * results_buf , u32 * parsed_results_bytes , u32 * num_errors , u32 * num_warnings ) { const char * section_name , * param_name , * param_str_val ; u32 * dump_buf_end = dump_buf + num_dumped_dwords ; u32 num_section_params = 0 , num_rules ; u32 results_offset = 0 ; * parsed_results_bytes = 0 ; * num_errors = 0 ; * num_warnings = 0 ; if ( ! p_hwfn -> dbg_arrays [ BIN_BUF_DBG_PARSING_STRINGS ] . ptr || ! p_hwfn -> dbg_arrays [ BIN_BUF_DBG_IDLE_CHK_PARSING_DATA ] . ptr ) return DBG_STATUS_DBG_ARRAY_NOT_SET ; dump_buf += qed_read_section_hdr ( dump_buf , & section_name , & num_section_params ) ; if ( strcmp ( section_name , " " ) ) return DBG_STATUS_IDLE_CHK_PARSE_FAILED ; dump_buf += qed_print_section_params ( dump_buf , num_section_params , results_buf , & results_offset ) ; dump_buf += qed_read_section_hdr ( dump_buf , & section_name , & num_section_params ) ; if ( strcmp ( section_name , " " ) || num_section_params != 1 ) return DBG_STATUS_IDLE_CHK_PARSE_FAILED ; dump_buf += qed_read_param ( dump_buf , & param_name , & param_str_val , & num_rules ) ; if ( strcmp ( param_name , " " ) ) return DBG_STATUS_IDLE_CHK_PARSE_FAILED ; if ( num_rules ) { u32 rules_print_size ; results_offset += sprintf ( qed_get_buf_ptr ( results_buf , results_offset ) , " \n " ) ; rules_print_size = qed_parse_idle_chk_dump_rules ( p_hwfn , dump_buf , dump_buf_end , num_rules , true , results_buf ? results_buf + results_offset : NULL , num_errors , num_warnings ) ; results_offset += rules_print_size ; if ( ! rules_print_size ) return DBG_STATUS_IDLE_CHK_PARSE_FAILED ; results_offset += sprintf ( qed_get_buf_ptr ( results_buf , results_offset ) , " \n \n " ) ; rules_print_size = qed_parse_idle_chk_dump_rules ( p_hwfn , dump_buf , dump_buf_end , num_rules , false , results_buf ? results_buf + results_offset : NULL , num_errors , num_warnings ) ; results_offset += rules_print_size ; if ( ! rules_print_size ) return DBG_STATUS_IDLE_CHK_PARSE_FAILED ; } if ( * num_errors ) results_offset += sprintf ( qed_get_buf_ptr ( results_buf , results_offset ) , " \n \n " , * num_errors , * num_warnings ) ; else if ( * num_warnings ) results_offset += sprintf ( qed_get_buf_ptr ( results_buf , results_offset ) , " \n \n " , * num_warnings ) ; else results_offset += sprintf ( qed_get_buf_ptr ( results_buf , results_offset ) , " \n \n " ) ; * parsed_results_bytes = results_offset + 1 ; return DBG_STATUS_OK ; }
Parses an idle check dump buffer.
Parses an idle check dump buffer .
/* Offset in results_buf in bytes */ /* Read global_params section */ /* Print global params */ /* Read idle_chk section */ /* Print FW output */ /* Print LSI output */ /* Print errors/warnings count */ /* Add 1 for string NULL termination */