src/dpdk/drivers/net/qede/qede_debug.c
static u32 qed_ilt_dump(struct ecore_hwfn *p_hwfn,
			struct ecore_ptt *p_ptt, u32 *dump_buf, bool dump)
{
	struct ecore_ilt_client_cfg *clients = p_hwfn->p_cxt_mngr->clients;
	u32 valid_conn_vf_cids, valid_conn_vf_pages, offset = 0;
	u32 valid_conn_pf_cids, valid_conn_pf_pages, num_pages;
	u32 num_cids_per_page, conn_ctx_size;
	u32 cduc_page_size, cdut_page_size;
	struct phys_mem_desc *ilt_pages;
	u8 conn_type;

	cduc_page_size = 1 <<
	    (clients[ILT_CLI_CDUC].p_size.val + PXP_ILT_PAGE_SIZE_NUM_BITS_MIN);
	cdut_page_size = 1 <<
	    (clients[ILT_CLI_CDUT].p_size.val + PXP_ILT_PAGE_SIZE_NUM_BITS_MIN);
	conn_ctx_size = p_hwfn->p_cxt_mngr->conn_ctx_size;
	num_cids_per_page = (int)(cduc_page_size / conn_ctx_size);
	ilt_pages = p_hwfn->p_cxt_mngr->ilt_shadow;

	/* Dump global params - 22 must match number of params below */
	offset += qed_dump_common_global_params(p_hwfn, p_ptt,
						dump_buf + offset, dump, 22);
	offset += qed_dump_str_param(dump_buf + offset,
				     dump, "dump-type", "ilt-dump");
	offset += qed_dump_num_param(dump_buf + offset,
				     dump,
				     "cduc-page-size", cduc_page_size);
	offset += qed_dump_num_param(dump_buf + offset,
				     dump,
				     "cduc-first-page-id",
				     clients[ILT_CLI_CDUC].first.val);
	offset += qed_dump_num_param(dump_buf + offset,
				     dump,
				     "cduc-last-page-id",
				     clients[ILT_CLI_CDUC].last.val);
	offset += qed_dump_num_param(dump_buf + offset,
				     dump,
				     "cduc-num-pf-pages",
				     clients
				     [ILT_CLI_CDUC].pf_total_lines);
	offset += qed_dump_num_param(dump_buf + offset,
				     dump,
				     "cduc-num-vf-pages",
				     clients
				     [ILT_CLI_CDUC].vf_total_lines);
	offset += qed_dump_num_param(dump_buf + offset,
				     dump,
				     "max-conn-ctx-size",
				     conn_ctx_size);
	offset += qed_dump_num_param(dump_buf + offset,
				     dump,
				     "cdut-page-size", cdut_page_size);
	offset += qed_dump_num_param(dump_buf + offset,
				     dump,
				     "cdut-first-page-id",
				     clients[ILT_CLI_CDUT].first.val);
	offset += qed_dump_num_param(dump_buf + offset,
				     dump,
				     "cdut-last-page-id",
				     clients[ILT_CLI_CDUT].last.val);
	offset += qed_dump_num_param(dump_buf + offset,
				     dump,
				     "cdut-num-pf-init-pages",
				     ecore_get_cdut_num_pf_init_pages(p_hwfn));
	offset += qed_dump_num_param(dump_buf + offset,
				     dump,
				     "cdut-num-vf-init-pages",
				     ecore_get_cdut_num_vf_init_pages(p_hwfn));
	offset += qed_dump_num_param(dump_buf + offset,
				     dump,
				     "cdut-num-pf-work-pages",
				     ecore_get_cdut_num_pf_work_pages(p_hwfn));
	offset += qed_dump_num_param(dump_buf + offset,
				     dump,
				     "cdut-num-vf-work-pages",
				     ecore_get_cdut_num_vf_work_pages(p_hwfn));
	offset += qed_dump_num_param(dump_buf + offset,
				     dump,
				     "max-task-ctx-size",
				     p_hwfn->p_cxt_mngr->task_ctx_size);
	offset += qed_dump_num_param(dump_buf + offset,
				     dump,
				     "task-type-id",
				     p_hwfn->p_cxt_mngr->task_type_id);
	offset += qed_dump_num_param(dump_buf + offset,
				     dump,
				     "first-vf-id-in-pf",
				     p_hwfn->p_cxt_mngr->first_vf_in_pf);
	offset += /* 18 */ qed_dump_num_param(dump_buf + offset,
					      dump,
					      "num-vfs-in-pf",
					      p_hwfn->p_cxt_mngr->vf_count);
	offset += qed_dump_num_param(dump_buf + offset,
				     dump,
				     "ptr-size-bytes", sizeof(void *));
	offset += qed_dump_num_param(dump_buf + offset,
				     dump,
				     "pf-start-line",
				     p_hwfn->p_cxt_mngr->pf_start_line);
	offset += qed_dump_num_param(dump_buf + offset,
				     dump,
				     "page-mem-desc-size-dwords",
				     PAGE_MEM_DESC_SIZE_DWORDS);
	offset += qed_dump_num_param(dump_buf + offset,
				     dump,
				     "ilt-shadow-size",
				     p_hwfn->p_cxt_mngr->ilt_shadow_size);
	/* Additional/Less parameters require matching of number in call to
	 * dump_common_global_params()
	 */

	/* Dump section containing number of PF CIDs per connection type */
	offset += qed_dump_section_hdr(dump_buf + offset,
				       dump, "num_pf_cids_per_conn_type", 1);
	offset += qed_dump_num_param(dump_buf + offset,
				     dump, "size", NUM_OF_CONNECTION_TYPES);
	for (conn_type = 0, valid_conn_pf_cids = 0;
	     conn_type < NUM_OF_CONNECTION_TYPES; conn_type++, offset++) {
		u32 num_pf_cids =
		    p_hwfn->p_cxt_mngr->conn_cfg[conn_type].cid_count;

		if (dump)
			*(dump_buf + offset) = num_pf_cids;
		valid_conn_pf_cids += num_pf_cids;
	}

	/* Dump section containing number of VF CIDs per connection type */
	offset += qed_dump_section_hdr(dump_buf + offset,
				       dump, "num_vf_cids_per_conn_type", 1);
	offset += qed_dump_num_param(dump_buf + offset,
				     dump, "size", NUM_OF_CONNECTION_TYPES);
	for (conn_type = 0, valid_conn_vf_cids = 0;
	     conn_type < NUM_OF_CONNECTION_TYPES; conn_type++, offset++) {
		u32 num_vf_cids =
		    p_hwfn->p_cxt_mngr->conn_cfg[conn_type].cids_per_vf;

		if (dump)
			*(dump_buf + offset) = num_vf_cids;
		valid_conn_vf_cids += num_vf_cids;
	}

	/* Dump section containing physical memory descs for each ILT page */
	num_pages = p_hwfn->p_cxt_mngr->ilt_shadow_size;
	offset += qed_dump_section_hdr(dump_buf + offset,
				       dump, "ilt_page_desc", 1);
	offset += qed_dump_num_param(dump_buf + offset,
				     dump,
				     "size",
				     num_pages * PAGE_MEM_DESC_SIZE_DWORDS);

	/* Copy memory descriptors to dump buffer */
	if (dump) {
		u32 page_id;

		for (page_id = 0; page_id < num_pages;
		     page_id++, offset += PAGE_MEM_DESC_SIZE_DWORDS)
			memcpy(dump_buf + offset,
			       &ilt_pages[page_id],
			       DWORDS_TO_BYTES(PAGE_MEM_DESC_SIZE_DWORDS));
	} else {
		offset += num_pages * PAGE_MEM_DESC_SIZE_DWORDS;
	}

	valid_conn_pf_pages = DIV_ROUND_UP(valid_conn_pf_cids,
					   num_cids_per_page);
	valid_conn_vf_pages = DIV_ROUND_UP(valid_conn_vf_cids,
					   num_cids_per_page);

	/* Dump ILT pages IDs */
	offset += qed_ilt_dump_pages_section(p_hwfn,
					     dump_buf + offset,
					     dump,
					     valid_conn_pf_pages,
					     valid_conn_vf_pages,
					     ilt_pages, true);

	/* Dump ILT pages memory */
	offset += qed_ilt_dump_pages_section(p_hwfn,
					     dump_buf + offset,
					     dump,
					     valid_conn_pf_pages,
					     valid_conn_vf_pages,
					     ilt_pages, false);

	/* Dump last section */
	offset += qed_dump_last_section(dump_buf, offset, dump);

	return offset;
}
/* Performs ILT Dump to the specified buffer.
 * Returns the dumped size in dwords.
 */
Performs ILT Dump to the specified buffer.
Returns the dumped size in dwords.
Performs ILT Dump to the specified buffer . Returns the dumped size in dwords .
static u32 qed_ilt_dump(struct ecore_hwfn *p_hwfn,
			struct ecore_ptt *p_ptt, u32 *dump_buf, bool dump)
{
	struct ecore_ilt_client_cfg *clients = p_hwfn->p_cxt_mngr->clients;
	u32 valid_conn_vf_cids, valid_conn_vf_pages, offset = 0;
	u32 valid_conn_pf_cids, valid_conn_pf_pages, num_pages;
	u32 num_cids_per_page, conn_ctx_size;
	u32 cduc_page_size, cdut_page_size;
	struct phys_mem_desc *ilt_pages;
	u8 conn_type;
	cduc_page_size = 1 <<
	    (clients[ILT_CLI_CDUC].p_size.val + PXP_ILT_PAGE_SIZE_NUM_BITS_MIN);
	cdut_page_size = 1 <<
	    (clients[ILT_CLI_CDUT].p_size.val + PXP_ILT_PAGE_SIZE_NUM_BITS_MIN);
	conn_ctx_size = p_hwfn->p_cxt_mngr->conn_ctx_size;
	num_cids_per_page = (int)(cduc_page_size / conn_ctx_size);
	ilt_pages = p_hwfn->p_cxt_mngr->ilt_shadow;
	offset += qed_dump_common_global_params(p_hwfn, p_ptt,
						dump_buf + offset, dump, 22);
	offset += qed_dump_str_param(dump_buf + offset,
				     dump, "dump-type", "ilt-dump");
	offset += qed_dump_num_param(dump_buf + offset,
				     dump,
				     "cduc-page-size", cduc_page_size);
	offset += qed_dump_num_param(dump_buf + offset,
				     dump,
				     "cduc-first-page-id",
				     clients[ILT_CLI_CDUC].first.val);
	offset += qed_dump_num_param(dump_buf + offset,
				     dump,
				     "cduc-last-page-id",
				     clients[ILT_CLI_CDUC].last.val);
	offset += qed_dump_num_param(dump_buf + offset,
				     dump,
				     "cduc-num-pf-pages",
				     clients
				     [ILT_CLI_CDUC].pf_total_lines);
	offset += qed_dump_num_param(dump_buf + offset,
				     dump,
				     "cduc-num-vf-pages",
				     clients
				     [ILT_CLI_CDUC].vf_total_lines);
	offset += qed_dump_num_param(dump_buf + offset,
				     dump,
				     "max-conn-ctx-size",
				     conn_ctx_size);
	offset += qed_dump_num_param(dump_buf + offset,
				     dump,
				     "cdut-page-size", cdut_page_size);
	offset += qed_dump_num_param(dump_buf + offset,
				     dump,
				     "cdut-first-page-id",
				     clients[ILT_CLI_CDUT].first.val);
	offset += qed_dump_num_param(dump_buf + offset,
				     dump,
				     "cdut-last-page-id",
				     clients[ILT_CLI_CDUT].last.val);
	offset += qed_dump_num_param(dump_buf + offset,
				     dump,
				     "cdut-num-pf-init-pages",
				     ecore_get_cdut_num_pf_init_pages(p_hwfn));
	offset += qed_dump_num_param(dump_buf + offset,
				     dump,
				     "cdut-num-vf-init-pages",
				     ecore_get_cdut_num_vf_init_pages(p_hwfn));
	offset += qed_dump_num_param(dump_buf + offset,
				     dump,
				     "cdut-num-pf-work-pages",
				     ecore_get_cdut_num_pf_work_pages(p_hwfn));
	offset += qed_dump_num_param(dump_buf + offset,
				     dump,
				     "cdut-num-vf-work-pages",
				     ecore_get_cdut_num_vf_work_pages(p_hwfn));
	offset += qed_dump_num_param(dump_buf + offset,
				     dump,
				     "max-task-ctx-size",
				     p_hwfn->p_cxt_mngr->task_ctx_size);
	offset += qed_dump_num_param(dump_buf + offset,
				     dump,
				     "task-type-id",
				     p_hwfn->p_cxt_mngr->task_type_id);
	offset += qed_dump_num_param(dump_buf + offset,
				     dump,
				     "first-vf-id-in-pf",
				     p_hwfn->p_cxt_mngr->first_vf_in_pf);
	offset +=  qed_dump_num_param(dump_buf + offset,
					      dump,
					      "num-vfs-in-pf",
					      p_hwfn->p_cxt_mngr->vf_count);
	offset += qed_dump_num_param(dump_buf + offset,
				     dump,
				     "ptr-size-bytes", sizeof(void *));
	offset += qed_dump_num_param(dump_buf + offset,
				     dump,
				     "pf-start-line",
				     p_hwfn->p_cxt_mngr->pf_start_line);
	offset += qed_dump_num_param(dump_buf + offset,
				     dump,
				     "page-mem-desc-size-dwords",
				     PAGE_MEM_DESC_SIZE_DWORDS);
	offset += qed_dump_num_param(dump_buf + offset,
				     dump,
				     "ilt-shadow-size",
				     p_hwfn->p_cxt_mngr->ilt_shadow_size);
	offset += qed_dump_section_hdr(dump_buf + offset,
				       dump, "num_pf_cids_per_conn_type", 1);
	offset += qed_dump_num_param(dump_buf + offset,
				     dump, "size", NUM_OF_CONNECTION_TYPES);
	for (conn_type = 0, valid_conn_pf_cids = 0;
	     conn_type < NUM_OF_CONNECTION_TYPES; conn_type++, offset++) {
		u32 num_pf_cids =
		    p_hwfn->p_cxt_mngr->conn_cfg[conn_type].cid_count;
		if (dump)
			*(dump_buf + offset) = num_pf_cids;
		valid_conn_pf_cids += num_pf_cids;
	}
	offset += qed_dump_section_hdr(dump_buf + offset,
				       dump, "num_vf_cids_per_conn_type", 1);
	offset += qed_dump_num_param(dump_buf + offset,
				     dump, "size", NUM_OF_CONNECTION_TYPES);
	for (conn_type = 0, valid_conn_vf_cids = 0;
	     conn_type < NUM_OF_CONNECTION_TYPES; conn_type++, offset++) {
		u32 num_vf_cids =
		    p_hwfn->p_cxt_mngr->conn_cfg[conn_type].cids_per_vf;
		if (dump)
			*(dump_buf + offset) = num_vf_cids;
		valid_conn_vf_cids += num_vf_cids;
	}
	num_pages = p_hwfn->p_cxt_mngr->ilt_shadow_size;
	offset += qed_dump_section_hdr(dump_buf + offset,
				       dump, "ilt_page_desc", 1);
	offset += qed_dump_num_param(dump_buf + offset,
				     dump,
				     "size",
				     num_pages * PAGE_MEM_DESC_SIZE_DWORDS);
	if (dump) {
		u32 page_id;
		for (page_id = 0; page_id < num_pages;
		     page_id++, offset += PAGE_MEM_DESC_SIZE_DWORDS)
			memcpy(dump_buf + offset,
			       &ilt_pages[page_id],
			       DWORDS_TO_BYTES(PAGE_MEM_DESC_SIZE_DWORDS));
	} else {
		offset += num_pages * PAGE_MEM_DESC_SIZE_DWORDS;
	}
	valid_conn_pf_pages = DIV_ROUND_UP(valid_conn_pf_cids,
					   num_cids_per_page);
	valid_conn_vf_pages = DIV_ROUND_UP(valid_conn_vf_cids,
					   num_cids_per_page);
	offset += qed_ilt_dump_pages_section(p_hwfn,
					     dump_buf + offset,
					     dump,
					     valid_conn_pf_pages,
					     valid_conn_vf_pages,
					     ilt_pages, true);
	offset += qed_ilt_dump_pages_section(p_hwfn,
					     dump_buf + offset,
					     dump,
					     valid_conn_pf_pages,
					     valid_conn_vf_pages,
					     ilt_pages, false);
	offset += qed_dump_last_section(dump_buf, offset, dump);
	return offset;
}
static u32 qed_ilt_dump ( struct ecore_hwfn * p_hwfn , struct ecore_ptt * p_ptt , u32 * dump_buf , bool dump ) { struct ecore_ilt_client_cfg * clients = p_hwfn -> p_cxt_mngr -> clients ; u32 valid_conn_vf_cids , valid_conn_vf_pages , offset = 0 ; u32 valid_conn_pf_cids , valid_conn_pf_pages , num_pages ; u32 num_cids_per_page , conn_ctx_size ; u32 cduc_page_size , cdut_page_size ; struct phys_mem_desc * ilt_pages ; u8 conn_type ; cduc_page_size = 1 << ( clients [ ILT_CLI_CDUC ] . p_size . val + PXP_ILT_PAGE_SIZE_NUM_BITS_MIN ) ; cdut_page_size = 1 << ( clients [ ILT_CLI_CDUT ] . p_size . val + PXP_ILT_PAGE_SIZE_NUM_BITS_MIN ) ; conn_ctx_size = p_hwfn -> p_cxt_mngr -> conn_ctx_size ; num_cids_per_page = ( int ) ( cduc_page_size / conn_ctx_size ) ; ilt_pages = p_hwfn -> p_cxt_mngr -> ilt_shadow ; offset += qed_dump_common_global_params ( p_hwfn , p_ptt , dump_buf + offset , dump , 22 ) ; offset += qed_dump_str_param ( dump_buf + offset , dump , " " , " " ) ; offset += qed_dump_num_param ( dump_buf + offset , dump , " " , cduc_page_size ) ; offset += qed_dump_num_param ( dump_buf + offset , dump , " " , clients [ ILT_CLI_CDUC ] . first . val ) ; offset += qed_dump_num_param ( dump_buf + offset , dump , " " , clients [ ILT_CLI_CDUC ] . last . val ) ; offset += qed_dump_num_param ( dump_buf + offset , dump , " " , clients [ ILT_CLI_CDUC ] . pf_total_lines ) ; offset += qed_dump_num_param ( dump_buf + offset , dump , " " , clients [ ILT_CLI_CDUC ] . vf_total_lines ) ; offset += qed_dump_num_param ( dump_buf + offset , dump , " " , conn_ctx_size ) ; offset += qed_dump_num_param ( dump_buf + offset , dump , " " , cdut_page_size ) ; offset += qed_dump_num_param ( dump_buf + offset , dump , " " , clients [ ILT_CLI_CDUT ] . first . val ) ; offset += qed_dump_num_param ( dump_buf + offset , dump , " " , clients [ ILT_CLI_CDUT ] . last . val ) ; offset += qed_dump_num_param ( dump_buf + offset , dump , " " , ecore_get_cdut_num_pf_init_pages ( p_hwfn ) ) ; offset += qed_dump_num_param ( dump_buf + offset , dump , " " , ecore_get_cdut_num_vf_init_pages ( p_hwfn ) ) ; offset += qed_dump_num_param ( dump_buf + offset , dump , " " , ecore_get_cdut_num_pf_work_pages ( p_hwfn ) ) ; offset += qed_dump_num_param ( dump_buf + offset , dump , " " , ecore_get_cdut_num_vf_work_pages ( p_hwfn ) ) ; offset += qed_dump_num_param ( dump_buf + offset , dump , " " , p_hwfn -> p_cxt_mngr -> task_ctx_size ) ; offset += qed_dump_num_param ( dump_buf + offset , dump , " " , p_hwfn -> p_cxt_mngr -> task_type_id ) ; offset += qed_dump_num_param ( dump_buf + offset , dump , " " , p_hwfn -> p_cxt_mngr -> first_vf_in_pf ) ; offset += qed_dump_num_param ( dump_buf + offset , dump , " " , p_hwfn -> p_cxt_mngr -> vf_count ) ; offset += qed_dump_num_param ( dump_buf + offset , dump , " " , sizeof ( void * ) ) ; offset += qed_dump_num_param ( dump_buf + offset , dump , " " , p_hwfn -> p_cxt_mngr -> pf_start_line ) ; offset += qed_dump_num_param ( dump_buf + offset , dump , " " , PAGE_MEM_DESC_SIZE_DWORDS ) ; offset += qed_dump_num_param ( dump_buf + offset , dump , " " , p_hwfn -> p_cxt_mngr -> ilt_shadow_size ) ; offset += qed_dump_section_hdr ( dump_buf + offset , dump , " " , 1 ) ; offset += qed_dump_num_param ( dump_buf + offset , dump , " " , NUM_OF_CONNECTION_TYPES ) ; for ( conn_type = 0 , valid_conn_pf_cids = 0 ; conn_type < NUM_OF_CONNECTION_TYPES ; conn_type ++ , offset ++ ) { u32 num_pf_cids = p_hwfn -> p_cxt_mngr -> conn_cfg [ conn_type ] . cid_count ; if ( dump ) * ( dump_buf + offset ) = num_pf_cids ; valid_conn_pf_cids += num_pf_cids ; } offset += qed_dump_section_hdr ( dump_buf + offset , dump , " " , 1 ) ; offset += qed_dump_num_param ( dump_buf + offset , dump , " " , NUM_OF_CONNECTION_TYPES ) ; for ( conn_type = 0 , valid_conn_vf_cids = 0 ; conn_type < NUM_OF_CONNECTION_TYPES ; conn_type ++ , offset ++ ) { u32 num_vf_cids = p_hwfn -> p_cxt_mngr -> conn_cfg [ conn_type ] . cids_per_vf ; if ( dump ) * ( dump_buf + offset ) = num_vf_cids ; valid_conn_vf_cids += num_vf_cids ; } num_pages = p_hwfn -> p_cxt_mngr -> ilt_shadow_size ; offset += qed_dump_section_hdr ( dump_buf + offset , dump , " " , 1 ) ; offset += qed_dump_num_param ( dump_buf + offset , dump , " " , num_pages * PAGE_MEM_DESC_SIZE_DWORDS ) ; if ( dump ) { u32 page_id ; for ( page_id = 0 ; page_id < num_pages ; page_id ++ , offset += PAGE_MEM_DESC_SIZE_DWORDS ) memcpy ( dump_buf + offset , & ilt_pages [ page_id ] , DWORDS_TO_BYTES ( PAGE_MEM_DESC_SIZE_DWORDS ) ) ; } else { offset += num_pages * PAGE_MEM_DESC_SIZE_DWORDS ; } valid_conn_pf_pages = DIV_ROUND_UP ( valid_conn_pf_cids , num_cids_per_page ) ; valid_conn_vf_pages = DIV_ROUND_UP ( valid_conn_vf_cids , num_cids_per_page ) ; offset += qed_ilt_dump_pages_section ( p_hwfn , dump_buf + offset , dump , valid_conn_pf_pages , valid_conn_vf_pages , ilt_pages , true ) ; offset += qed_ilt_dump_pages_section ( p_hwfn , dump_buf + offset , dump , valid_conn_pf_pages , valid_conn_vf_pages , ilt_pages , false ) ; offset += qed_dump_last_section ( dump_buf , offset , dump ) ; return offset ; }
Performs ILT Dump to the specified buffer.
Performs ILT Dump to the specified buffer .
/* Dump global params - 22 must match number of params below */ /* 18 */ /* Additional/Less parameters require matching of number in call to
	 * dump_common_global_params()
	 */ /* Dump section containing number of PF CIDs per connection type */ /* Dump section containing number of VF CIDs per connection type */ /* Dump section containing physical memory descs for each ILT page */ /* Copy memory descriptors to dump buffer */ /* Dump ILT pages IDs */ /* Dump ILT pages memory */ /* Dump last section */