Skip to contentSkip to conversation

qed deadcoding

PATCH Applied [email protected] 2 participants 7 messages Apr 14, 2025 – Apr 15, 2025

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

cover qed deadcoding

From: "Dr. David Alan Gilbert" <[email protected]>

Hi,
This is a set of deadcode removals for the qed ethernet
device. I've tried to avoid removing anything that are trivial firmware wrappers.

One odd one I've not removed is qed_bw_update(),
it doesn't seem to be called but looks like the only caller of the bw_update(..) method which qedf does define. Perhaps qed_bw_update is supposed to be called somewhere?

Dave

Dr. David Alan Gilbert (5):
qed: Remove unused qed_memset_*ctx functions
qed: Remove unused qed_calc_*_ctx_validation functions
qed: Remove unused qed_ptt_invalidate
qed: Remove unused qed_print_mcp_trace_*
qed: Remove unused qed_db_recovery_dp

 drivers/net/ethernet/qlogic/qed/qed.h         |   1 -
 drivers/net/ethernet/qlogic/qed/qed_dbg_hsi.h |  31 ----
 drivers/net/ethernet/qlogic/qed/qed_debug.c   |  25 ----
 drivers/net/ethernet/qlogic/qed/qed_dev.c     |  19 ---
 drivers/net/ethernet/qlogic/qed/qed_hsi.h     |  52 -------
 drivers/net/ethernet/qlogic/qed/qed_hw.c      |  11 --
 drivers/net/ethernet/qlogic/qed/qed_hw.h      |   9 --
 .../ethernet/qlogic/qed/qed_init_fw_funcs.c   | 138 ------------------
 8 files changed, 286 deletions(-)
Signature · 1 line
2.49.0
#1 lore raw

PATCH 1/5 qed: Remove unused qed_memset_*ctx functions

From: "Dr. David Alan Gilbert" <[email protected]>

qed_memset_session_ctx() and qed_memset_task_ctx() were added in 2017 as part of
commit da09091732ae ("qed*: Utilize FW 8.33.1.0")

but have not been used.

Remove them.

---
 drivers/net/ethernet/qlogic/qed/qed_hsi.h     | 24 ------------
 .../ethernet/qlogic/qed/qed_init_fw_funcs.c   | 38 -------------------
 2 files changed, 62 deletions(-)
drivers/net/ethernet/qlogic/qed/qed_hsi.h +0 -24
index ed1a84542ad2..3181fed1274e 100644
@@ -2694,30 +2694,6 @@ void qed_calc_session_ctx_validation(void *p_ctx_mem,
 void qed_calc_task_ctx_validation(void *p_ctx_mem,
 				  u16 ctx_size, u8 ctx_type, u32 tid);
 
-/**
- * qed_memset_session_ctx(): Memset session context to 0 while
- *                            preserving validation bytes.
- *
- * @p_ctx_mem: Pointer to context memory.
- * @ctx_size: Size to initialzie.
- * @ctx_type: Context type.
- *
- * Return: Void.
- */
-void qed_memset_session_ctx(void *p_ctx_mem, u32 ctx_size, u8 ctx_type);
-
-/**
- * qed_memset_task_ctx(): Memset task context to 0 while preserving
- *                        validation bytes.
- *
- * @p_ctx_mem: Pointer to context memory.
- * @ctx_size: size to initialzie.
- * @ctx_type: context type.
- *
- * Return: Void.
- */
-void qed_memset_task_ctx(void *p_ctx_mem, u32 ctx_size, u8 ctx_type);
-
 #define NUM_STORMS 6
 
 /**
drivers/net/ethernet/qlogic/qed/qed_init_fw_funcs.c +0 -38
index 407029a36fa1..4b9128c08ad3 100644
@@ -1666,44 +1666,6 @@ void qed_calc_task_ctx_validation(void *p_ctx_mem,
 	*region1_val_ptr = qed_calc_cdu_validation_byte(ctx_type, 1, tid);
 }
 
-/* Memset session context to 0 while preserving validation bytes */
-void qed_memset_session_ctx(void *p_ctx_mem, u32 ctx_size, u8 ctx_type)
-{
-	u8 *x_val_ptr, *t_val_ptr, *u_val_ptr, *p_ctx;
-	u8 x_val, t_val, u_val;
-
-	p_ctx = (u8 * const)p_ctx_mem;
-	x_val_ptr = &p_ctx[con_region_offsets[0][ctx_type]];
-	t_val_ptr = &p_ctx[con_region_offsets[1][ctx_type]];
-	u_val_ptr = &p_ctx[con_region_offsets[2][ctx_type]];
-
-	x_val = *x_val_ptr;
-	t_val = *t_val_ptr;
-	u_val = *u_val_ptr;
-
-	memset(p_ctx, 0, ctx_size);
-
-	*x_val_ptr = x_val;
-	*t_val_ptr = t_val;
-	*u_val_ptr = u_val;
-}
-
-/* Memset task context to 0 while preserving validation bytes */
-void qed_memset_task_ctx(void *p_ctx_mem, u32 ctx_size, u8 ctx_type)
-{
-	u8 *p_ctx, *region1_val_ptr;
-	u8 region1_val;
-
-	p_ctx = (u8 * const)p_ctx_mem;
-	region1_val_ptr = &p_ctx[task_region_offsets[0][ctx_type]];
-
-	region1_val = *region1_val_ptr;
-
-	memset(p_ctx, 0, ctx_size);
-
-	*region1_val_ptr = region1_val;
-}
-
 /* Enable and configure context validation */
 void qed_enable_context_validation(struct qed_hwfn *p_hwfn,
 				   struct qed_ptt *p_ptt)
Signature · 1 line
2.49.0
#2 lore raw

PATCH 2/5 qed: Remove unused qed_calc_*_ctx_validation functions

In reply to [email protected]

From: "Dr. David Alan Gilbert" <[email protected]>

qed_calc_session_ctx_validation() and qed_calc_task_ctx_validation() were added as part of 2017's
commit da09091732ae ("qed*: Utilize FW 8.33.1.0")

but have remained unused.

Remove them.

This leaves; con_region_offsets[], task_region_offsets[], cdu_crc8_table and qed_calc_cdu_validation_byte() unused.

Remove them.

---
 drivers/net/ethernet/qlogic/qed/qed_hsi.h     |  28 -----
 .../ethernet/qlogic/qed/qed_init_fw_funcs.c   | 100 ------------------
 2 files changed, 128 deletions(-)
drivers/net/ethernet/qlogic/qed/qed_hsi.h +0 -28
index 3181fed1274e..10e355397cee 100644
@@ -2666,34 +2666,6 @@ void qed_gft_config(struct qed_hwfn *p_hwfn,
 void qed_enable_context_validation(struct qed_hwfn *p_hwfn,
 				   struct qed_ptt *p_ptt);
 
-/**
- * qed_calc_session_ctx_validation(): Calcualte validation byte for
- *                                    session context.
- *
- * @p_ctx_mem: Pointer to context memory.
- * @ctx_size: Context size.
- * @ctx_type: Context type.
- * @cid: Context cid.
- *
- * Return: Void.
- */
-void qed_calc_session_ctx_validation(void *p_ctx_mem,
-				     u16 ctx_size, u8 ctx_type, u32 cid);
-
-/**
- * qed_calc_task_ctx_validation(): Calcualte validation byte for task
- *                                 context.
- *
- * @p_ctx_mem: Pointer to context memory.
- * @ctx_size: Context size.
- * @ctx_type: Context type.
- * @tid: Context tid.
- *
- * Return: Void.
- */
-void qed_calc_task_ctx_validation(void *p_ctx_mem,
-				  u16 ctx_size, u8 ctx_type, u32 tid);
-
 #define NUM_STORMS 6
 
 /**
drivers/net/ethernet/qlogic/qed/qed_init_fw_funcs.c +0 -100

112 lines not on this page · raw message

Signature · 1 line
2.49.0
#3 lore raw

PATCH 3/5 qed: Remove unused qed_ptt_invalidate

In reply to [email protected]

From: "Dr. David Alan Gilbert" <[email protected]>

qed_ptt_invalidate() was added in 2015 as part of commit fe56b9e6a8d9 ("qed: Add module with basic common support") but has remained unused.

Remove it.

---
 drivers/net/ethernet/qlogic/qed/qed_hw.c | 11 -----------
 drivers/net/ethernet/qlogic/qed/qed_hw.h |  9 ---------
 2 files changed, 20 deletions(-)
drivers/net/ethernet/qlogic/qed/qed_hw.c +0 -11
index 9e5f0dbc8a07..9907973399dc 100644
@@ -69,17 +69,6 @@ int qed_ptt_pool_alloc(struct qed_hwfn *p_hwfn)
 	return 0;
 }
 
-void qed_ptt_invalidate(struct qed_hwfn *p_hwfn)
-{
-	struct qed_ptt *p_ptt;
-	int i;
-
-	for (i = 0; i < PXP_EXTERNAL_BAR_PF_WINDOW_NUM; i++) {
-		p_ptt = &p_hwfn->p_ptt_pool->ptts[i];
-		p_ptt->pxp.offset = QED_BAR_INVALID_OFFSET;
-	}
-}
-
 void qed_ptt_pool_free(struct qed_hwfn *p_hwfn)
 {
 	kfree(p_hwfn->p_ptt_pool);
drivers/net/ethernet/qlogic/qed/qed_hw.h +0 -9
index e535983ce21b..3c98f58a184f 100644
@@ -61,15 +61,6 @@ enum _dmae_cmd_crc_mask {
  */
 void qed_gtt_init(struct qed_hwfn *p_hwfn);
 
-/**
- * qed_ptt_invalidate(): Forces all ptt entries to be re-configured
- *
- * @p_hwfn: HW device data.
- *
- * Return: Void.
- */
-void qed_ptt_invalidate(struct qed_hwfn *p_hwfn);
-
 /**
  * qed_ptt_pool_alloc(): Allocate and initialize PTT pool.
  *
Signature · 1 line
2.49.0
#4 lore raw

PATCH 4/5 qed: Remove unused qed_print_mcp_trace_*

In reply to [email protected]

From: "Dr. David Alan Gilbert" <[email protected]>

While most of the trace code is reachable by other routes (I think mostly via the qed_features_lookup[] array), there are a couple of unused wrappers.

qed_print_mcp_trace_line() and qed_print_mcp_trace_results_cont() were added in 2018 as part of
commit a3f723079df8 ("qed*: Utilize FW 8.37.7.0")
but have remained unused.

Remove them.

---
 drivers/net/ethernet/qlogic/qed/qed_dbg_hsi.h | 31 -------------------
 drivers/net/ethernet/qlogic/qed/qed_debug.c   | 25 ---------------
 2 files changed, 56 deletions(-)
drivers/net/ethernet/qlogic/qed/qed_dbg_hsi.h +0 -31
index f6cd1b3efdfd..27e91d0d39f8 100644
@@ -1304,37 +1304,6 @@ enum dbg_status qed_print_mcp_trace_results(struct qed_hwfn *p_hwfn,
 					    u32 num_dumped_dwords,
 					    char *results_buf);
 
-/**
- * qed_print_mcp_trace_results_cont(): Prints MCP Trace results, and
- * keeps the MCP trace meta data allocated, to support continuous MCP Trace
- * parsing. After the continuous parsing ends, mcp_trace_free_meta_data should
- * be called to free the meta data.
- *
- * @p_hwfn: HW device data.
- * @dump_buf: MVP trace dump buffer, starting from the header.
- * @results_buf: Buffer for printing the mcp trace results.
- *
- * Return: Error if the parsing fails, ok otherwise.
- */
-enum dbg_status qed_print_mcp_trace_results_cont(struct qed_hwfn *p_hwfn,
-						 u32 *dump_buf,
-						 char *results_buf);
-
-/**
- * qed_print_mcp_trace_line(): Prints MCP Trace results for a single line
- *
- * @p_hwfn: HW device data.
- * @dump_buf: MCP trace dump buffer, starting from the header.
- * @num_dumped_bytes: Number of bytes that were dumped.
- * @results_buf: Buffer for printing the mcp trace results.
- *
- * Return: Error if the parsing fails, ok otherwise.
- */
-enum dbg_status qed_print_mcp_trace_line(struct qed_hwfn *p_hwfn,
-					 u8 *dump_buf,
-					 u32 num_dumped_bytes,
-					 char *results_buf);
-
 /**
  * qed_mcp_trace_free_meta_data(): Frees the MCP Trace meta data.
  * Should be called after continuous MCP Trace parsing.
drivers/net/ethernet/qlogic/qed/qed_debug.c +0 -25
index 464a72afb758..9c3d3dd2f847 100644
@@ -7614,31 +7614,6 @@ enum dbg_status qed_print_mcp_trace_results(struct qed_hwfn *p_hwfn,
 					results_buf, &parsed_buf_size, true);
 }
 
-enum dbg_status qed_print_mcp_trace_results_cont(struct qed_hwfn *p_hwfn,
-						 u32 *dump_buf,
-						 char *results_buf)
-{
-	u32 parsed_buf_size;
-
-	return qed_parse_mcp_trace_dump(p_hwfn, dump_buf, results_buf,
-					&parsed_buf_size, false);
-}
-
-enum dbg_status qed_print_mcp_trace_line(struct qed_hwfn *p_hwfn,
-					 u8 *dump_buf,
-					 u32 num_dumped_bytes,
-					 char *results_buf)
-{
-	u32 parsed_results_bytes;
-
-	return qed_parse_mcp_trace_buf(p_hwfn,
-				       dump_buf,
-				       num_dumped_bytes,
-				       0,
-				       num_dumped_bytes,
-				       results_buf, &parsed_results_bytes);
-}
-
 /* Frees the specified MCP Trace meta data */
 void qed_mcp_trace_free_meta_data(struct qed_hwfn *p_hwfn)
 {
Signature · 1 line
2.49.0
#5 lore raw

PATCH 5/5 qed: Remove unused qed_db_recovery_dp

In reply to [email protected]

From: "Dr. David Alan Gilbert" <[email protected]>

qed_db_recovery_dp() was added in 2018 as part of
commit 36907cd5cd72 ("qed: Add doorbell overflow recovery mechanism") but has remained unused.

Remove it.

---
 drivers/net/ethernet/qlogic/qed/qed.h     |  1 -
 drivers/net/ethernet/qlogic/qed/qed_dev.c | 19 -------------------
 2 files changed, 20 deletions(-)
drivers/net/ethernet/qlogic/qed/qed.h +0 -1
index b7def3b54937..016b575861b9 100644
@@ -939,7 +939,6 @@ u16 qed_get_cm_pq_idx_ofld_mtc(struct qed_hwfn *p_hwfn, u8 tc);
 u16 qed_get_cm_pq_idx_llt_mtc(struct qed_hwfn *p_hwfn, u8 tc);
 
 /* doorbell recovery mechanism */
-void qed_db_recovery_dp(struct qed_hwfn *p_hwfn);
 void qed_db_recovery_execute(struct qed_hwfn *p_hwfn);
 bool qed_edpm_enabled(struct qed_hwfn *p_hwfn);
 
drivers/net/ethernet/qlogic/qed/qed_dev.c +0 -19
index 86a93cac2647..9659ce5b0712 100644
@@ -255,25 +255,6 @@ static void qed_db_recovery_teardown(struct qed_hwfn *p_hwfn)
 	p_hwfn->db_recovery_info.db_recovery_counter = 0;
 }
 
-/* Print the content of the doorbell recovery mechanism */
-void qed_db_recovery_dp(struct qed_hwfn *p_hwfn)
-{
-	struct qed_db_recovery_entry *db_entry = NULL;
-
-	DP_NOTICE(p_hwfn,
-		  "Displaying doorbell recovery database. Counter was %d\n",
-		  p_hwfn->db_recovery_info.db_recovery_counter);
-
-	/* Protect the list */
-	spin_lock_bh(&p_hwfn->db_recovery_info.lock);
-	list_for_each_entry(db_entry,
-			    &p_hwfn->db_recovery_info.list, list_entry) {
-		qed_db_recovery_dp_entry(p_hwfn, db_entry, "Printing");
-	}
-
-	spin_unlock_bh(&p_hwfn->db_recovery_info.lock);
-}
-
 /* Ring the doorbell of a single doorbell recovery entry */
 static void qed_db_recovery_ring(struct qed_hwfn *p_hwfn,
 				 struct qed_db_recovery_entry *db_entry)
Signature · 1 line
2.49.0
#6 lore raw
In reply to [email protected]
This series was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:

Hello:

This series was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:

Quoted 8 lines · On Mon, 14 Apr 2025 01:52:42 +0100 you wrote:

From: "Dr. David Alan Gilbert" <[email protected]>

Hi,
This is a set of deadcode removals for the qed ethernet
device. I've tried to avoid removing anything that are trivial firmware wrappers.

[...]

Here is the summary with links:
- [net-next,1/5] qed: Remove unused qed_memset_*ctx functions

    https://git.kernel.org/netdev/net-next/c/e056d3d70388
  - [net-next,2/5] qed: Remove unused qed_calc_*_ctx_validation functions
    https://git.kernel.org/netdev/net-next/c/fa381e21a907
  - [net-next,3/5] qed: Remove unused qed_ptt_invalidate
    https://git.kernel.org/netdev/net-next/c/3c18acefaf9f
  - [net-next,4/5] qed: Remove unused qed_print_mcp_trace_*
    https://git.kernel.org/netdev/net-next/c/058fa8736570
  - [net-next,5/5] qed: Remove unused qed_db_recovery_dp
    https://git.kernel.org/netdev/net-next/c/915359abc68c

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html