lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250206175114.1974171-15-bvanassche@acm.org>
Date: Thu,  6 Feb 2025 09:50:55 -0800
From: Bart Van Assche <bvanassche@....org>
To: Peter Zijlstra <peterz@...radead.org>
Cc: Will Deacon <will@...nel.org>,
	Christoph Hellwig <hch@....de>,
	Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
	Marco Elver <elver@...gle.com>,
	Nick Desaulniers <ndesaulniers@...gle.com>,
	Nathan Chancellor <nathan@...nel.org>,
	Kees Cook <kees@...nel.org>,
	Jann Horn <jannh@...gle.com>,
	linux-kernel@...r.kernel.org,
	Bart Van Assche <bvanassche@....org>,
	Tony Nguyen <anthony.l.nguyen@...el.com>,
	Przemek Kitszel <przemyslaw.kitszel@...el.com>
Subject: [PATCH RFC 14/33] ice: Split ice_dcb_rebuild()

Prepare for adding a second caller. No functionality has been changed.

Cc: Tony Nguyen <anthony.l.nguyen@...el.com>
Cc: Przemek Kitszel <przemyslaw.kitszel@...el.com>
Signed-off-by: Bart Van Assche <bvanassche@....org>
---
 drivers/net/ethernet/intel/ice/ice_dcb_lib.c | 46 +++++++++++---------
 1 file changed, 25 insertions(+), 21 deletions(-)

diff --git a/drivers/net/ethernet/intel/ice/ice_dcb_lib.c b/drivers/net/ethernet/intel/ice/ice_dcb_lib.c
index a7c510832824..69a4b84f935f 100644
--- a/drivers/net/ethernet/intel/ice/ice_dcb_lib.c
+++ b/drivers/net/ethernet/intel/ice/ice_dcb_lib.c
@@ -526,6 +526,30 @@ ice_dcb_need_recfg(struct ice_pf *pf, struct ice_dcbx_cfg *old_cfg,
 	return need_reconfig;
 }
 
+static void disable_dcb(struct ice_pf *pf)
+{
+	struct ice_dcbx_cfg *err_cfg;
+	struct device *dev = ice_pf_to_dev(pf);
+
+	dev_err(dev, "Disabling DCB until new settings occur\n");
+	err_cfg = kzalloc(sizeof(*err_cfg), GFP_KERNEL);
+	if (!err_cfg)
+		return;
+
+	err_cfg->etscfg.willing = true;
+	err_cfg->etscfg.tcbwtable[0] = ICE_TC_MAX_BW;
+	err_cfg->etscfg.tsatable[0] = ICE_IEEE_TSA_ETS;
+	memcpy(&err_cfg->etsrec, &err_cfg->etscfg, sizeof(err_cfg->etsrec));
+	/* Coverity warns the return code of ice_pf_dcb_cfg() is not checked
+	 * here as is done for other calls to that function. That check is
+	 * not necessary since this is in this function's error cleanup path.
+	 * Suppress the Coverity warning with the following comment...
+	 */
+	/* coverity[check_return] */
+	ice_pf_dcb_cfg(pf, err_cfg, false);
+	kfree(err_cfg);
+}
+
 /**
  * ice_dcb_rebuild - rebuild DCB post reset
  * @pf: physical function instance
@@ -534,7 +558,6 @@ void ice_dcb_rebuild(struct ice_pf *pf)
 {
 	struct ice_aqc_port_ets_elem buf = { 0 };
 	struct device *dev = ice_pf_to_dev(pf);
-	struct ice_dcbx_cfg *err_cfg;
 	int ret;
 
 	ret = ice_query_port_ets(pf->hw.port_info, &buf, sizeof(buf), NULL);
@@ -574,26 +597,7 @@ void ice_dcb_rebuild(struct ice_pf *pf)
 	return;
 
 dcb_error:
-	dev_err(dev, "Disabling DCB until new settings occur\n");
-	err_cfg = kzalloc(sizeof(*err_cfg), GFP_KERNEL);
-	if (!err_cfg) {
-		mutex_unlock(&pf->tc_mutex);
-		return;
-	}
-
-	err_cfg->etscfg.willing = true;
-	err_cfg->etscfg.tcbwtable[0] = ICE_TC_MAX_BW;
-	err_cfg->etscfg.tsatable[0] = ICE_IEEE_TSA_ETS;
-	memcpy(&err_cfg->etsrec, &err_cfg->etscfg, sizeof(err_cfg->etsrec));
-	/* Coverity warns the return code of ice_pf_dcb_cfg() is not checked
-	 * here as is done for other calls to that function. That check is
-	 * not necessary since this is in this function's error cleanup path.
-	 * Suppress the Coverity warning with the following comment...
-	 */
-	/* coverity[check_return] */
-	ice_pf_dcb_cfg(pf, err_cfg, false);
-	kfree(err_cfg);
-
+	disable_dcb(pf);
 	mutex_unlock(&pf->tc_mutex);
 }
 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ