All of lore.kernel.org
 help / color / mirror / Atom feed
* [Intel-wired-lan] [PATCH S33 01/15] ice: Store number of functions for the device
@ 2019-11-08 14:23 Tony Nguyen
  2019-11-08 14:23 ` [Intel-wired-lan] [PATCH S33 02/15] ice: Correct capabilities reporting of max TCs Tony Nguyen
                   ` (14 more replies)
  0 siblings, 15 replies; 30+ messages in thread
From: Tony Nguyen @ 2019-11-08 14:23 UTC (permalink / raw)
  To: intel-wired-lan

From: Bruce Allan <bruce.w.allan@intel.com>

Store the number of functions the device has and use this number when
setting safe mode capabilities instead of calculating it.

Signed-off-by: Bruce Allan <bruce.w.allan@intel.com>
Co-developed-by: Kevin Scott <kevin.c.scott@intel.com>
Signed-off-by: Kevin Scott <kevin.c.scott@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
---
 drivers/net/ethernet/intel/ice/ice_common.c | 21 ++++++++++-----------
 drivers/net/ethernet/intel/ice/ice_type.h   |  1 +
 2 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/drivers/net/ethernet/intel/ice/ice_common.c b/drivers/net/ethernet/intel/ice/ice_common.c
index 36be501ae623..e92eaec19c83 100644
--- a/drivers/net/ethernet/intel/ice/ice_common.c
+++ b/drivers/net/ethernet/intel/ice/ice_common.c
@@ -1673,6 +1673,10 @@ ice_parse_caps(struct ice_hw *hw, void *buf, u32 cap_count,
 			ice_debug(hw, ICE_DBG_INIT,
 				  "%s: valid_functions (bitmap) = %d\n", prefix,
 				  caps->valid_functions);
+
+			/* store func count for resource management purposes */
+			if (dev_p)
+				dev_p->num_funcs = hweight32(number);
 			break;
 		case ICE_AQC_CAPS_SRIOV:
 			caps->sr_iov_1_1 = (number == 1);
@@ -1875,8 +1879,7 @@ void ice_set_safe_mode_caps(struct ice_hw *hw)
 	struct ice_hw_dev_caps *dev_caps = &hw->dev_caps;
 	u32 valid_func, rxq_first_id, txq_first_id;
 	u32 msix_vector_first_id, max_mtu;
-	u32 num_func = 0;
-	u8 i;
+	u32 num_funcs;
 
 	/* cache some func_caps values that should be restored after memset */
 	valid_func = func_caps->common_cap.valid_functions;
@@ -1909,6 +1912,7 @@ void ice_set_safe_mode_caps(struct ice_hw *hw)
 	rxq_first_id = dev_caps->common_cap.rxq_first_id;
 	msix_vector_first_id = dev_caps->common_cap.msix_vector_first_id;
 	max_mtu = dev_caps->common_cap.max_mtu;
+	num_funcs = dev_caps->num_funcs;
 
 	/* unset dev capabilities */
 	memset(dev_caps, 0, sizeof(*dev_caps));
@@ -1919,19 +1923,14 @@ void ice_set_safe_mode_caps(struct ice_hw *hw)
 	dev_caps->common_cap.rxq_first_id = rxq_first_id;
 	dev_caps->common_cap.msix_vector_first_id = msix_vector_first_id;
 	dev_caps->common_cap.max_mtu = max_mtu;
-
-	/* valid_func is a bitmap. get number of functions */
-#define ICE_MAX_FUNCS 8
-	for (i = 0; i < ICE_MAX_FUNCS; i++)
-		if (valid_func & BIT(i))
-			num_func++;
+	dev_caps->num_funcs = num_funcs;
 
 	/* one Tx and one Rx queue per function in safe mode */
-	dev_caps->common_cap.num_rxq = num_func;
-	dev_caps->common_cap.num_txq = num_func;
+	dev_caps->common_cap.num_rxq = num_funcs;
+	dev_caps->common_cap.num_txq = num_funcs;
 
 	/* two MSIX vectors per function */
-	dev_caps->common_cap.num_msix_vectors = 2 * num_func;
+	dev_caps->common_cap.num_msix_vectors = 2 * num_funcs;
 }
 
 /**
diff --git a/drivers/net/ethernet/intel/ice/ice_type.h b/drivers/net/ethernet/intel/ice/ice_type.h
index eba8b04b8cbd..c4854a987130 100644
--- a/drivers/net/ethernet/intel/ice/ice_type.h
+++ b/drivers/net/ethernet/intel/ice/ice_type.h
@@ -202,6 +202,7 @@ struct ice_hw_dev_caps {
 	struct ice_hw_common_caps common_cap;
 	u32 num_vfs_exposed;		/* Total number of VFs exposed */
 	u32 num_vsi_allocd_to_host;	/* Excluding EMP VSI */
+	u32 num_funcs;
 };
 
 /* MAC info */
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 30+ messages in thread

end of thread, other threads:[~2019-11-12 19:37 UTC | newest]

Thread overview: 30+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-11-08 14:23 [Intel-wired-lan] [PATCH S33 01/15] ice: Store number of functions for the device Tony Nguyen
2019-11-08 14:23 ` [Intel-wired-lan] [PATCH S33 02/15] ice: Correct capabilities reporting of max TCs Tony Nguyen
2019-11-12 19:30   ` Bowers, AndrewX
2019-11-08 14:23 ` [Intel-wired-lan] [PATCH S33 03/15] ice: Disallow VF VLAN opcodes if VLAN offloads disabled Tony Nguyen
2019-11-12 19:31   ` Bowers, AndrewX
2019-11-08 14:23 ` [Intel-wired-lan] [PATCH S33 04/15] ice: Don't modify stripping for add/del VLANs on VF Tony Nguyen
2019-11-12 19:32   ` Bowers, AndrewX
2019-11-08 14:23 ` [Intel-wired-lan] [PATCH S33 05/15] ice: fix stack leakage Tony Nguyen
2019-11-12 19:32   ` Bowers, AndrewX
2019-11-08 14:23 ` [Intel-wired-lan] [PATCH S33 06/15] ice: Only disable VF state when freeing each VF resources Tony Nguyen
2019-11-12 19:33   ` Bowers, AndrewX
2019-11-08 14:23 ` [Intel-wired-lan] [PATCH S33 07/15] ice: Fix setting coalesce to handle DCB configuration Tony Nguyen
2019-11-12 19:33   ` Bowers, AndrewX
2019-11-08 14:23 ` [Intel-wired-lan] [PATCH S33 08/15] ice: Refactor removal of VLAN promiscuous rules Tony Nguyen
2019-11-12 19:34   ` Bowers, AndrewX
2019-11-08 14:23 ` [Intel-wired-lan] [PATCH S33 09/15] ice: Do not use devm* functions for local uses Tony Nguyen
2019-11-12 19:34   ` Bowers, AndrewX
2019-11-08 14:23 ` [Intel-wired-lan] [PATCH S33 10/15] ice: Add ice_pf_to_dev(pf) macro Tony Nguyen
2019-11-12 19:35   ` Bowers, AndrewX
2019-11-08 14:23 ` [Intel-wired-lan] [PATCH S33 11/15] ice: add helpers for virtchnl Tony Nguyen
2019-11-12 19:35   ` Bowers, AndrewX
2019-11-08 14:23 ` [Intel-wired-lan] [PATCH S33 12/15] ice: implement VF stats NDO Tony Nguyen
2019-11-12 19:35   ` Bowers, AndrewX
2019-11-08 14:23 ` [Intel-wired-lan] [PATCH S33 13/15] ice: Implement ethtool ops for channels Tony Nguyen
2019-11-12 19:36   ` Bowers, AndrewX
2019-11-08 14:23 ` [Intel-wired-lan] [PATCH S33 14/15] ice: remove pointless NULL check of port_info Tony Nguyen
2019-11-12 19:36   ` Bowers, AndrewX
2019-11-08 14:23 ` [Intel-wired-lan] [PATCH S33 15/15] ice: Update FW API minor version Tony Nguyen
2019-11-12 19:37   ` Bowers, AndrewX
2019-11-12 19:30 ` [Intel-wired-lan] [PATCH S33 01/15] ice: Store number of functions for the device Bowers, AndrewX

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.