Intel-Wired-Lan Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Jacob Keller <jacob.e.keller@intel.com>
To: Intel Wired LAN <intel-wired-lan@lists.osuosl.org>
Cc: Anthony Nguyen <anthony.l.nguyen@intel.com>,
	Jesse Brandeburg <jesse.brandeburg@intel.com>
Subject: [Intel-wired-lan] [intel-next PATCH 01/14] ice: re-order ice_mbx_reset_snapshot function
Date: Wed, 22 Feb 2023 09:09:07 -0800	[thread overview]
Message-ID: <20230222170920.1629293-2-jacob.e.keller@intel.com> (raw)
In-Reply-To: <20230222170920.1629293-1-jacob.e.keller@intel.com>

A future change is going to refactor the VF mailbox overflow detection
logic, including modifying ice_mbx_reset_snapshot and its callers. To make
this change easier to review, first move the ice_mbx_reset_snapshot
function higher in the ice_vf_mbx.c file.

Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Reviewed-by: Michal Swiatkowski <michal.swiatkowski@linux.intel.com>
---
 drivers/net/ethernet/intel/ice/ice_vf_mbx.c | 48 ++++++++++-----------
 1 file changed, 24 insertions(+), 24 deletions(-)

diff --git a/drivers/net/ethernet/intel/ice/ice_vf_mbx.c b/drivers/net/ethernet/intel/ice/ice_vf_mbx.c
index f56fa94ff3d0..2fe9a9504914 100644
--- a/drivers/net/ethernet/intel/ice/ice_vf_mbx.c
+++ b/drivers/net/ethernet/intel/ice/ice_vf_mbx.c
@@ -130,6 +130,30 @@ u32 ice_conv_link_speed_to_virtchnl(bool adv_link_support, u16 link_speed)
  */
 #define ICE_IGNORE_MAX_MSG_CNT	0xFFFF
 
+/**
+ * ice_mbx_reset_snapshot - Reset mailbox snapshot structure
+ * @snap: pointer to mailbox snapshot structure in the ice_hw struct
+ *
+ * Reset the mailbox snapshot structure and clear VF counter array.
+ */
+static void ice_mbx_reset_snapshot(struct ice_mbx_snapshot *snap)
+{
+	u32 vfcntr_len;
+
+	if (!snap || !snap->mbx_vf.vf_cntr)
+		return;
+
+	/* Clear VF counters. */
+	vfcntr_len = snap->mbx_vf.vfcntr_len;
+	if (vfcntr_len)
+		memset(snap->mbx_vf.vf_cntr, 0,
+		       (vfcntr_len * sizeof(*snap->mbx_vf.vf_cntr)));
+
+	/* Reset mailbox snapshot for a new capture. */
+	memset(&snap->mbx_buf, 0, sizeof(snap->mbx_buf));
+	snap->mbx_buf.state = ICE_MAL_VF_DETECT_STATE_NEW_SNAPSHOT;
+}
+
 /**
  * ice_mbx_traverse - Pass through mailbox snapshot
  * @hw: pointer to the HW struct
@@ -201,30 +225,6 @@ ice_mbx_detect_malvf(struct ice_hw *hw, u16 vf_id,
 	return 0;
 }
 
-/**
- * ice_mbx_reset_snapshot - Reset mailbox snapshot structure
- * @snap: pointer to mailbox snapshot structure in the ice_hw struct
- *
- * Reset the mailbox snapshot structure and clear VF counter array.
- */
-static void ice_mbx_reset_snapshot(struct ice_mbx_snapshot *snap)
-{
-	u32 vfcntr_len;
-
-	if (!snap || !snap->mbx_vf.vf_cntr)
-		return;
-
-	/* Clear VF counters. */
-	vfcntr_len = snap->mbx_vf.vfcntr_len;
-	if (vfcntr_len)
-		memset(snap->mbx_vf.vf_cntr, 0,
-		       (vfcntr_len * sizeof(*snap->mbx_vf.vf_cntr)));
-
-	/* Reset mailbox snapshot for a new capture. */
-	memset(&snap->mbx_buf, 0, sizeof(snap->mbx_buf));
-	snap->mbx_buf.state = ICE_MAL_VF_DETECT_STATE_NEW_SNAPSHOT;
-}
-
 /**
  * ice_mbx_vf_state_handler - Handle states of the overflow algorithm
  * @hw: pointer to the HW struct

base-commit: 3a127e58112af46ebf9922a0cc2e52146bc931a4
-- 
2.39.1.405.gd4c25cc71f83

_______________________________________________
Intel-wired-lan mailing list
Intel-wired-lan@osuosl.org
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan

  reply	other threads:[~2023-02-22 17:15 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-22 17:09 [Intel-wired-lan] [intel-next PATCH 00/14] ice: refactor mailbox overflow detection Jacob Keller
2023-02-22 17:09 ` Jacob Keller [this message]
2023-03-10 13:15   ` [Intel-wired-lan] [intel-next PATCH 01/14] ice: re-order ice_mbx_reset_snapshot function Szlosek, Marek
2023-02-22 17:09 ` [Intel-wired-lan] [intel-next PATCH 02/14] ice: convert ice_mbx_clear_malvf to void and use WARN Jacob Keller
2023-03-10 13:15   ` Szlosek, Marek
2023-02-22 17:09 ` [Intel-wired-lan] [intel-next PATCH 03/14] ice: track malicious VFs in new ice_mbx_vf_info structure Jacob Keller
2023-03-10 13:15   ` Szlosek, Marek
2023-02-22 17:09 ` [Intel-wired-lan] [intel-next PATCH 04/14] ice: move VF overflow message count into struct ice_mbx_vf_info Jacob Keller
2023-03-10 13:16   ` Szlosek, Marek
2023-02-22 17:09 ` [Intel-wired-lan] [intel-next PATCH 05/14] ice: remove ice_mbx_deinit_snapshot Jacob Keller
2023-03-10 13:16   ` Szlosek, Marek
2023-02-22 17:09 ` [Intel-wired-lan] [intel-next PATCH 06/14] ice: merge ice_mbx_report_malvf with ice_mbx_vf_state_handler Jacob Keller
2023-03-10 13:17   ` Szlosek, Marek
2023-02-22 17:09 ` [Intel-wired-lan] [intel-next PATCH 07/14] ice: initialize mailbox snapshot earlier in PF init Jacob Keller
2023-03-10 13:17   ` Szlosek, Marek
2023-02-22 17:09 ` [Intel-wired-lan] [intel-next PATCH 08/14] ice: declare ice_vc_process_vf_msg in ice_virtchnl.h Jacob Keller
2023-03-10 13:17   ` Szlosek, Marek
2023-02-22 17:09 ` [Intel-wired-lan] [intel-next PATCH 09/14] ice: always report VF overflowing mailbox even without PF VSI Jacob Keller
2023-03-10 13:17   ` Szlosek, Marek
2023-02-22 17:09 ` [Intel-wired-lan] [intel-next PATCH 10/14] ice: remove unnecessary &array[0] and just use array Jacob Keller
2023-03-10 13:18   ` Szlosek, Marek
2023-02-22 17:09 ` [Intel-wired-lan] [intel-next PATCH 11/14] ice: pass mbxdata to ice_is_malicious_vf() Jacob Keller
2023-03-10 13:18   ` Szlosek, Marek
2023-02-22 17:09 ` [Intel-wired-lan] [intel-next PATCH 12/14] ice: print message if ice_mbx_vf_state_handler returns an error Jacob Keller
2023-03-10 13:18   ` Szlosek, Marek
2023-02-22 17:09 ` [Intel-wired-lan] [intel-next PATCH 13/14] ice: move ice_is_malicious_vf() to ice_virtchnl.c Jacob Keller
2023-03-10 13:19   ` Szlosek, Marek
2023-02-22 17:09 ` [Intel-wired-lan] [intel-next PATCH 14/14] ice: call ice_is_malicious_vf() from ice_vc_process_vf_msg() Jacob Keller
2023-03-10 13:19   ` Szlosek, Marek

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=20230222170920.1629293-2-jacob.e.keller@intel.com \
    --to=jacob.e.keller@intel.com \
    --cc=anthony.l.nguyen@intel.com \
    --cc=intel-wired-lan@lists.osuosl.org \
    --cc=jesse.brandeburg@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