]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
ice: move get_fwlog_data() to fwlog file
authorMichal Swiatkowski <michal.swiatkowski@linux.intel.com>
Tue, 12 Aug 2025 04:23:23 +0000 (06:23 +0200)
committerTony Nguyen <anthony.l.nguyen@intel.com>
Thu, 11 Sep 2025 19:09:26 +0000 (12:09 -0700)
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>
Reviewed-by: Simon Horman <horms@kernel.org>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
drivers/net/ethernet/intel/ice/ice_fwlog.c
drivers/net/ethernet/intel/ice/ice_fwlog.h
drivers/net/ethernet/intel/ice/ice_main.c

index e488562066489c912dd281416097a5436a5ad41c..ea5d6d2d3f30c49603342e44af9159226fd6e018 100644 (file)
@@ -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);
+       }
+}
index 7d95d11b6ef9349cb709938b43bdd0c765933877..5b9244f4f0f10db96bf45172ba7942eceb63413a 100644 (file)
@@ -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_ */
index 92b95d92d59924e29b5dcbc4d810aed984775fdc..dcb8e752047176efe10a3ab1b5f1e88033c52edc 100644 (file)
@@ -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);