netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Michal Swiatkowski <michal.swiatkowski@linux.intel.com>
To: intel-wired-lan@lists.osuosl.org
Cc: netdev@vger.kernel.org, przemyslaw.kitszel@intel.com,
	dawid.osuchowski@linux.intel.com,
	Michal Swiatkowski <michal.swiatkowski@linux.intel.com>
Subject: [PATCH iwl-next v1 02/15] ice: move get_fwlog_data() to fwlog file
Date: Tue, 22 Jul 2025 12:45:47 +0200	[thread overview]
Message-ID: <20250722104600.10141-3-michal.swiatkowski@linux.intel.com> (raw)
In-Reply-To: <20250722104600.10141-1-michal.swiatkowski@linux.intel.com>

Change the function prototype to receive hw structure instead of pf to
simplify the call. Instead of passing whole event pass only msg_buf
pointer and length.

Make ice_fwlog_ring_full() static as it isn't  called from any other
context.

Reviewed-by: Przemek Kitszel <przemyslaw.kitszel@intel.com>
Signed-off-by: Michal Swiatkowski <michal.swiatkowski@linux.intel.com>
---
 drivers/net/ethernet/intel/ice/ice_fwlog.c | 27 +++++++++++++++++++-
 drivers/net/ethernet/intel/ice/ice_fwlog.h |  2 +-
 drivers/net/ethernet/intel/ice/ice_main.c  | 29 ++--------------------
 3 files changed, 29 insertions(+), 29 deletions(-)

diff --git a/drivers/net/ethernet/intel/ice/ice_fwlog.c b/drivers/net/ethernet/intel/ice/ice_fwlog.c
index e48856206648..ea5d6d2d3f30 100644
--- a/drivers/net/ethernet/intel/ice/ice_fwlog.c
+++ b/drivers/net/ethernet/intel/ice/ice_fwlog.c
@@ -6,7 +6,7 @@
 #include "ice_common.h"
 #include "ice_fwlog.h"
 
-bool ice_fwlog_ring_full(struct ice_fwlog_ring *rings)
+static bool ice_fwlog_ring_full(struct ice_fwlog_ring *rings)
 {
 	u16 head, tail;
 
@@ -456,3 +456,28 @@ int ice_fwlog_unregister(struct ice_hw *hw)
 
 	return status;
 }
+
+/**
+ * ice_get_fwlog_data - copy the FW log data from ARQ event
+ * @hw: HW that the FW log event is associated with
+ * @buf: event buffer pointer
+ * @len: len of event descriptor
+ */
+void ice_get_fwlog_data(struct ice_hw *hw, u8 *buf, u16 len)
+{
+	struct ice_fwlog_data *fwlog;
+
+	fwlog = &hw->fwlog_ring.rings[hw->fwlog_ring.tail];
+
+	memset(fwlog->data, 0, PAGE_SIZE);
+	fwlog->data_size = len;
+
+	memcpy(fwlog->data, buf, fwlog->data_size);
+	ice_fwlog_ring_increment(&hw->fwlog_ring.tail, hw->fwlog_ring.size);
+
+	if (ice_fwlog_ring_full(&hw->fwlog_ring)) {
+		/* the rings are full so bump the head to create room */
+		ice_fwlog_ring_increment(&hw->fwlog_ring.head,
+					 hw->fwlog_ring.size);
+	}
+}
diff --git a/drivers/net/ethernet/intel/ice/ice_fwlog.h b/drivers/net/ethernet/intel/ice/ice_fwlog.h
index 7d95d11b6ef9..5b9244f4f0f1 100644
--- a/drivers/net/ethernet/intel/ice/ice_fwlog.h
+++ b/drivers/net/ethernet/intel/ice/ice_fwlog.h
@@ -64,7 +64,6 @@ struct ice_fwlog_ring {
 #define ICE_FWLOG_RING_SIZE_DFLT 256
 #define ICE_FWLOG_RING_SIZE_MAX 512
 
-bool ice_fwlog_ring_full(struct ice_fwlog_ring *rings);
 bool ice_fwlog_ring_empty(struct ice_fwlog_ring *rings);
 void ice_fwlog_ring_increment(u16 *item, u16 size);
 int ice_fwlog_init(struct ice_hw *hw);
@@ -73,4 +72,5 @@ int ice_fwlog_set(struct ice_hw *hw, struct ice_fwlog_cfg *cfg);
 int ice_fwlog_register(struct ice_hw *hw);
 int ice_fwlog_unregister(struct ice_hw *hw);
 void ice_fwlog_realloc_rings(struct ice_hw *hw, int index);
+void ice_get_fwlog_data(struct ice_hw *hw, u8 *buf, u16 len);
 #endif /* _ICE_FWLOG_H_ */
diff --git a/drivers/net/ethernet/intel/ice/ice_main.c b/drivers/net/ethernet/intel/ice/ice_main.c
index 8e0b06c1e02b..c2101853adf8 100644
--- a/drivers/net/ethernet/intel/ice/ice_main.c
+++ b/drivers/net/ethernet/intel/ice/ice_main.c
@@ -1250,32 +1250,6 @@ ice_handle_link_event(struct ice_pf *pf, struct ice_rq_event_info *event)
 	return status;
 }
 
-/**
- * ice_get_fwlog_data - copy the FW log data from ARQ event
- * @pf: PF that the FW log event is associated with
- * @event: event structure containing FW log data
- */
-static void
-ice_get_fwlog_data(struct ice_pf *pf, struct ice_rq_event_info *event)
-{
-	struct ice_fwlog_data *fwlog;
-	struct ice_hw *hw = &pf->hw;
-
-	fwlog = &hw->fwlog_ring.rings[hw->fwlog_ring.tail];
-
-	memset(fwlog->data, 0, PAGE_SIZE);
-	fwlog->data_size = le16_to_cpu(event->desc.datalen);
-
-	memcpy(fwlog->data, event->msg_buf, fwlog->data_size);
-	ice_fwlog_ring_increment(&hw->fwlog_ring.tail, hw->fwlog_ring.size);
-
-	if (ice_fwlog_ring_full(&hw->fwlog_ring)) {
-		/* the rings are full so bump the head to create room */
-		ice_fwlog_ring_increment(&hw->fwlog_ring.head,
-					 hw->fwlog_ring.size);
-	}
-}
-
 /**
  * ice_aq_prep_for_event - Prepare to wait for an AdminQ event from firmware
  * @pf: pointer to the PF private structure
@@ -1566,7 +1540,8 @@ static int __ice_clean_ctrlq(struct ice_pf *pf, enum ice_ctl_q q_type)
 			}
 			break;
 		case ice_aqc_opc_fw_logs_event:
-			ice_get_fwlog_data(pf, &event);
+			ice_get_fwlog_data(hw, event.msg_buf,
+					   le16_to_cpu(event.desc.datalen));
 			break;
 		case ice_aqc_opc_lldp_set_mib_change:
 			ice_dcb_process_lldp_set_mib_change(pf, &event);
-- 
2.49.0


  parent reply	other threads:[~2025-07-22 11:06 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-22 10:45 [PATCH iwl-next v1 00/15] Fwlog support in ixgbe Michal Swiatkowski
2025-07-22 10:45 ` [PATCH iwl-next v1 01/15] ice: make fwlog functions static Michal Swiatkowski
2025-07-22 11:58   ` [Intel-wired-lan] " Loktionov, Aleksandr
2025-07-22 10:45 ` Michal Swiatkowski [this message]
2025-07-22 12:02   ` [Intel-wired-lan] [PATCH iwl-next v1 02/15] ice: move get_fwlog_data() to fwlog file Loktionov, Aleksandr
2025-07-23  4:48     ` Michal Swiatkowski
2025-07-22 10:45 ` [PATCH iwl-next v1 03/15] ice: drop ice_pf_fwlog_update_module() Michal Swiatkowski
2025-07-22 12:06   ` [Intel-wired-lan] " Loktionov, Aleksandr
2025-07-22 10:45 ` [PATCH iwl-next v1 04/15] ice: introduce ice_fwlog structure Michal Swiatkowski
2025-07-22 12:17   ` [Intel-wired-lan] " Loktionov, Aleksandr
2025-07-22 10:45 ` [PATCH iwl-next v1 05/15] ice: add pdev into fwlog structure and use it for logging Michal Swiatkowski
2025-07-23 10:36   ` [Intel-wired-lan] " Loktionov, Aleksandr
2025-07-22 10:45 ` [PATCH iwl-next v1 06/15] ice: allow calling custom send function in fwlog Michal Swiatkowski
2025-07-22 10:45 ` [PATCH iwl-next v1 07/15] ice: move out debugfs init from fwlog Michal Swiatkowski
2025-07-22 10:45 ` [PATCH iwl-next v1 08/15] ice: check for PF number outside the fwlog code Michal Swiatkowski
2025-07-23 10:38   ` [Intel-wired-lan] " Loktionov, Aleksandr
2025-07-22 10:45 ` [PATCH iwl-next v1 09/15] ice: drop driver specific structure from " Michal Swiatkowski
2025-07-22 14:54   ` Simon Horman
2025-07-23  4:47     ` Michal Swiatkowski
2025-07-23 10:42   ` [Intel-wired-lan] " Loktionov, Aleksandr
2025-07-22 10:45 ` [PATCH iwl-next v1 10/15] libie, ice: move fwlog admin queue to libie Michal Swiatkowski
2025-07-22 10:45 ` [PATCH iwl-next v1 11/15] ice: move debugfs code to fwlog Michal Swiatkowski
2025-07-22 10:45 ` [PATCH iwl-next v1 12/15] ice: prepare for moving file to libie Michal Swiatkowski
2025-07-22 10:45 ` [PATCH iwl-next v1 13/15] ice: reregister fwlog after driver reinit Michal Swiatkowski
2025-07-22 10:45 ` [PATCH iwl-next v1 14/15] ice, libie: move fwlog code to libie Michal Swiatkowski
2025-07-22 10:46 ` [PATCH iwl-next v1 15/15] ixgbe: fwlog support for e610 Michal Swiatkowski
2025-07-23  0:45   ` [Intel-wired-lan] " kernel test robot
2025-07-23 12:12 ` [PATCH iwl-next v1 00/15] Fwlog support in ixgbe Jiri Pirko
2025-07-23 12:48   ` Michal Swiatkowski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250722104600.10141-3-michal.swiatkowski@linux.intel.com \
    --to=michal.swiatkowski@linux.intel.com \
    --cc=dawid.osuchowski@linux.intel.com \
    --cc=intel-wired-lan@lists.osuosl.org \
    --cc=netdev@vger.kernel.org \
    --cc=przemyslaw.kitszel@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).