Skip to contentSkip to conversation

net/ice: Update base code with latest snapshot.

RFC In review Ian Stokes 6 participants 428 messages May 1, 2024 – Jun 28, 2024 Page 1 of 5

Subsystems (3)
lore
Share & tools
lore

Ian Stokes

author
#0 lore raw

RFC 1/1 net/ice: Update base code with latest snapshot.

The purpose of this patch is to update shared code for the ice driver. This patch not only contains the updated base code files but also the required changes within the DPDK code base to enable compilation and basic functionality. This is with a view to allow further regression testing while a final patch series is generated that correctly splits the code changes into an expected manner.

---
 drivers/net/ice/base/ice_acl.c           |   58 +-
 drivers/net/ice/base/ice_acl.h           |   50 +-
 drivers/net/ice/base/ice_acl_ctrl.c      |   45 +-
 drivers/net/ice/base/ice_adminq_cmd.h    |  459 ++-
 drivers/net/ice/base/ice_bitops.h        |    8 +-
 drivers/net/ice/base/ice_cgu_regs.h      |   90 +
 drivers/net/ice/base/ice_common.c        | 1621 +++++---
 drivers/net/ice/base/ice_common.h        |  189 +-
 drivers/net/ice/base/ice_controlq.c      |  213 +-
 drivers/net/ice/base/ice_controlq.h      |   28 +-
 drivers/net/ice/base/ice_dcb.c           |   79 +-
 drivers/net/ice/base/ice_dcb.h           |   32 +-
 drivers/net/ice/base/ice_ddp.c           |  115 +-
 drivers/net/ice/base/ice_ddp.h           |   18 +-
 drivers/net/ice/base/ice_devids.h        |   39 +-
 drivers/net/ice/base/ice_fdir.c          |   50 +-
 drivers/net/ice/base/ice_fdir.h          |   18 +-
 drivers/net/ice/base/ice_flex_pipe.c     |  385 +-
 drivers/net/ice/base/ice_flex_pipe.h     |   32 +-
 drivers/net/ice/base/ice_flex_type.h     |   41 +-
 drivers/net/ice/base/ice_flow.c          |  337 +-
 drivers/net/ice/base/ice_flow.h          |   52 +-
 drivers/net/ice/base/ice_fwlog.c         |    5 +
 drivers/net/ice/base/ice_fwlog.h         |    4 +
 drivers/net/ice/base/ice_hw_autogen.h    | 2569 ++++++++++--
 drivers/net/ice/base/ice_lan_tx_rx.h     |   87 +-
 drivers/net/ice/base/ice_metainit.c      |    2 +-
 drivers/net/ice/base/ice_nvm.c           |  321 +-
 drivers/net/ice/base/ice_nvm.h           |   36 +-
 drivers/net/ice/base/ice_parser.c        |   57 +-
 drivers/net/ice/base/ice_parser.h        |   30 +-
 drivers/net/ice/base/ice_parser_rt.c     |   88 +-
 drivers/net/ice/base/ice_parser_rt.h     |   23 +-
 drivers/net/ice/base/ice_phy_regs.h      |   84 +
 drivers/net/ice/base/ice_protocol_type.h |   17 +-
 drivers/net/ice/base/ice_ptp_consts.h    |    3 +-
 drivers/net/ice/base/ice_ptp_hw.c        | 4593 ++++++++++------------
 drivers/net/ice/base/ice_ptp_hw.h        |  332 +-
 drivers/net/ice/base/ice_sbq_cmd.h       |    1 -
 drivers/net/ice/base/ice_sched.c         |  556 +--
 drivers/net/ice/base/ice_sched.h         |  130 +-
 drivers/net/ice/base/ice_switch.c        | 1893 +++++----
 drivers/net/ice/base/ice_switch.h        |  241 +-
 drivers/net/ice/base/ice_type.h          |  194 +-
 drivers/net/ice/base/ice_vf_mbx.c        |    4 +
 drivers/net/ice/base/ice_vf_mbx.h        |    4 +
 drivers/net/ice/base/ice_vlan_mode.c     |   47 +-
 drivers/net/ice/base/ice_vlan_mode.h     |    2 +-
 drivers/net/ice/base/ice_xlt_kb.c        |    4 +-
 drivers/net/ice/base/meson.build         |    2 +
 drivers/net/ice/ice_diagnose.c           |    9 +-
 drivers/net/ice/ice_ethdev.c             |   55 +-
 52 files changed, 9105 insertions(+), 6247 deletions(-)
 create mode 100644 drivers/net/ice/base/ice_fwlog.c
 create mode 100644 drivers/net/ice/base/ice_fwlog.h
 create mode 100644 drivers/net/ice/base/ice_phy_regs.h
 create mode 100644 drivers/net/ice/base/ice_vf_mbx.c
 create mode 100644 drivers/net/ice/base/ice_vf_mbx.h
drivers/net/ice/base/ice_acl.c +29 -29
index fd9c6d5c14..6ace29c946 100644
@@ -13,7 +13,7 @@
  *
  * Allocate ACL table (indirect 0x0C10)
  */
-enum ice_status
+int
 ice_aq_alloc_acl_tbl(struct ice_hw *hw, struct ice_acl_alloc_tbl *tbl,
 		     struct ice_sq_cd *cd)
 {
@@ -64,7 +64,7 @@ ice_aq_alloc_acl_tbl(struct ice_hw *hw, struct ice_acl_alloc_tbl *tbl,
  * format is 'struct ice_aqc_acl_generic', pass ptr to that struct
  * as 'buf' and its size as 'buf_size'
  */
-enum ice_status
+int
 ice_aq_dealloc_acl_tbl(struct ice_hw *hw, u16 alloc_id,
 		       struct ice_aqc_acl_generic *buf, struct ice_sq_cd *cd)
 {
@@ -78,7 +78,7 @@ ice_aq_dealloc_acl_tbl(struct ice_hw *hw, u16 alloc_id,
 	return ice_aq_send_cmd(hw, &desc, buf, sizeof(*buf), cd);
 }
 
-static enum ice_status
+static int
 ice_aq_acl_entry(struct ice_hw *hw, u16 opcode, u8 tcam_idx, u16 entry_idx,
 		 struct ice_aqc_acl_data *buf, struct ice_sq_cd *cd)
 {
@@ -107,7 +107,7 @@ ice_aq_acl_entry(struct ice_hw *hw, u16 opcode, u8 tcam_idx, u16 entry_idx,
  *
  * Program ACL entry (direct 0x0C20)
  */
-enum ice_status
+int
 ice_aq_program_acl_entry(struct ice_hw *hw, u8 tcam_idx, u16 entry_idx,
 			 struct ice_aqc_acl_data *buf, struct ice_sq_cd *cd)
 {
@@ -128,7 +128,7 @@ ice_aq_program_acl_entry(struct ice_hw *hw, u8 tcam_idx, u16 entry_idx,
  * NOTE: Caller of this API to parse 'buf' appropriately since it contains
  * response (key and key invert)
  */
-enum ice_status
+int
 ice_aq_query_acl_entry(struct ice_hw *hw, u8 tcam_idx, u16 entry_idx,
 		       struct ice_aqc_acl_data *buf, struct ice_sq_cd *cd)
 {
@@ -137,7 +137,7 @@ ice_aq_query_acl_entry(struct ice_hw *hw, u8 tcam_idx, u16 entry_idx,
 }
 
 /* Helper function to alloc/dealloc ACL action pair */
-static enum ice_status
+static int
 ice_aq_actpair_a_d(struct ice_hw *hw, u16 opcode, u16 alloc_id,
 		   struct ice_aqc_acl_generic *buf, struct ice_sq_cd *cd)
 {
@@ -163,7 +163,7 @@ ice_aq_actpair_a_d(struct ice_hw *hw, u16 opcode, u16 alloc_id,
  * This command doesn't need and doesn't have its own command buffer
  * but for response format is as specified in 'struct ice_aqc_acl_generic'
  */
-enum ice_status
+int
 ice_aq_alloc_actpair(struct ice_hw *hw, u16 alloc_id,
 		     struct ice_aqc_acl_generic *buf, struct ice_sq_cd *cd)
 {
@@ -180,7 +180,7 @@ ice_aq_alloc_actpair(struct ice_hw *hw, u16 alloc_id,
  *
  *  Deallocate ACL actionpair (direct 0x0C13)
  */
-enum ice_status
+int
 ice_aq_dealloc_actpair(struct ice_hw *hw, u16 alloc_id,
 		       struct ice_aqc_acl_generic *buf, struct ice_sq_cd *cd)
 {
@@ -189,7 +189,7 @@ ice_aq_dealloc_actpair(struct ice_hw *hw, u16 alloc_id,
 }
 
 /* Helper function to program/query ACL action pair */
-static enum ice_status
+static int
 ice_aq_actpair_p_q(struct ice_hw *hw, u16 opcode, u8 act_mem_idx,
 		   u16 act_entry_idx, struct ice_aqc_actpair *buf,
 		   struct ice_sq_cd *cd)
@@ -219,7 +219,7 @@ ice_aq_actpair_p_q(struct ice_hw *hw, u16 opcode, u8 act_mem_idx,
  *
  * Program action entries (indirect 0x0C1C)
  */
-enum ice_status
+int
 ice_aq_program_actpair(struct ice_hw *hw, u8 act_mem_idx, u16 act_entry_idx,
 		       struct ice_aqc_actpair *buf, struct ice_sq_cd *cd)
 {
@@ -237,7 +237,7 @@ ice_aq_program_actpair(struct ice_hw *hw, u8 act_mem_idx, u16 act_entry_idx,
  *
  * Query ACL actionpair (indirect 0x0C25)
  */
-enum ice_status
+int
 ice_aq_query_actpair(struct ice_hw *hw, u8 act_mem_idx, u16 act_entry_idx,
 		     struct ice_aqc_actpair *buf, struct ice_sq_cd *cd)
 {
@@ -253,7 +253,7 @@ ice_aq_query_actpair(struct ice_hw *hw, u8 act_mem_idx, u16 act_entry_idx,
  * De-allocate ACL resources (direct 0x0C1A). Used by SW to release all the
  * resources allocated for it using a single command
  */
-enum ice_status ice_aq_dealloc_acl_res(struct ice_hw *hw, struct ice_sq_cd *cd)
+int ice_aq_dealloc_acl_res(struct ice_hw *hw, struct ice_sq_cd *cd)
 {
 	struct ice_aq_desc desc;
 
@@ -272,7 +272,7 @@ enum ice_status ice_aq_dealloc_acl_res(struct ice_hw *hw, struct ice_sq_cd *cd)
  *
  * This function sends ACL profile commands
  */
-static enum ice_status
+static int
 ice_acl_prof_aq_send(struct ice_hw *hw, u16 opc, u8 prof_id,
 		     struct ice_aqc_acl_prof_generic_frmt *buf,
 		     struct ice_sq_cd *cd)
@@ -296,7 +296,7 @@ ice_acl_prof_aq_send(struct ice_hw *hw, u16 opc, u8 prof_id,
  *
  * Program ACL profile extraction (indirect 0x0C1D)
  */
-enum ice_status
+int
 ice_prgm_acl_prof_xtrct(struct ice_hw *hw, u8 prof_id,
 			struct ice_aqc_acl_prof_generic_frmt *buf,
 			struct ice_sq_cd *cd)
@@ -314,7 +314,7 @@ ice_prgm_acl_prof_xtrct(struct ice_hw *hw, u8 prof_id,
  *
  * Query ACL profile (indirect 0x0C21)
  */
-enum ice_status
+int
 ice_query_acl_prof(struct ice_hw *hw, u8 prof_id,
 		   struct ice_aqc_acl_prof_generic_frmt *buf,
 		   struct ice_sq_cd *cd)
@@ -330,9 +330,9 @@ ice_query_acl_prof(struct ice_hw *hw, u8 prof_id,
  * This function checks the counter bank range for counter type and returns
  * success or failure.
  */
-static enum ice_status ice_aq_acl_cntrs_chk_params(struct ice_acl_cntrs *cntrs)
+static int ice_aq_acl_cntrs_chk_params(struct ice_acl_cntrs *cntrs)
 {
-	enum ice_status status = ICE_SUCCESS;
+	int status = 0;
 
 	if (!cntrs || !cntrs->amount)
 		return ICE_ERR_PARAM;
@@ -373,14 +373,14 @@ static enum ice_status ice_aq_acl_cntrs_chk_params(struct ice_acl_cntrs *cntrs)
  * unsuccessful if returned counter value is invalid. In this case it returns
  * an error otherwise success.
  */
-enum ice_status
+int
 ice_aq_alloc_acl_cntrs(struct ice_hw *hw, struct ice_acl_cntrs *cntrs,
 		       struct ice_sq_cd *cd)
 {
 	struct ice_aqc_acl_alloc_counters *cmd;
 	u16 first_cntr, last_cntr;
 	struct ice_aq_desc desc;
-	enum ice_status status;
+	int status;
 
 	/* check for invalid params */
 	status = ice_aq_acl_cntrs_chk_params(cntrs);
@@ -412,13 +412,13 @@ ice_aq_alloc_acl_cntrs(struct ice_hw *hw, struct ice_acl_cntrs *cntrs,
  *
  * De-allocate ACL counters (direct 0x0C17)
  */
-enum ice_status
+int
 ice_aq_dealloc_acl_cntrs(struct ice_hw *hw, struct ice_acl_cntrs *cntrs,
 			 struct ice_sq_cd *cd)
 {
 	struct ice_aqc_acl_dealloc_counters *cmd;
 	struct ice_aq_desc desc;
-	enum ice_status status;
+	int status;
 
 	/* check for invalid params */
 	status = ice_aq_acl_cntrs_chk_params(cntrs);
@@ -443,7 +443,7 @@ ice_aq_dealloc_acl_cntrs(struct ice_hw *hw, struct ice_acl_cntrs *cntrs,
  *
  * Program ACL profile ranges (indirect 0x0C1E)
  */
-enum ice_status
+int
 ice_prog_acl_prof_ranges(struct ice_hw *hw, u8 prof_id,
 			 struct ice_aqc_acl_profile_ranges *buf,
 			 struct ice_sq_cd *cd)
@@ -466,7 +466,7 @@ ice_prog_acl_prof_ranges(struct ice_hw *hw, u8 prof_id,
  *
  * Query ACL profile ranges (indirect 0x0C22)
  */
-enum ice_status
+int
 ice_query_acl_prof_ranges(struct ice_hw *hw, u8 prof_id,
 			  struct ice_aqc_acl_profile_ranges *buf,
 			  struct ice_sq_cd *cd)
@@ -488,13 +488,13 @@ ice_query_acl_prof_ranges(struct ice_hw *hw, u8 prof_id,
  *
  * Allocate ACL scenario (indirect 0x0C14)
  */
-enum ice_status
+int
 ice_aq_alloc_acl_scen(struct ice_hw *hw, u16 *scen_id,
 		      struct ice_aqc_acl_scen *buf, struct ice_sq_cd *cd)
 {
 	struct ice_aqc_acl_alloc_scen *cmd;
 	struct ice_aq_desc desc;
-	enum ice_status status;
+	int status;
 
 	if (!scen_id)
 		return ICE_ERR_PARAM;
@@ -518,7 +518,7 @@ ice_aq_alloc_acl_scen(struct ice_hw *hw, u16 *scen_id,
  *
  * Deallocate ACL scenario (direct 0x0C15)
  */
-enum ice_status
+int
 ice_aq_dealloc_acl_scen(struct ice_hw *hw, u16 scen_id, struct ice_sq_cd *cd)
 {
 	struct ice_aqc_acl_dealloc_scen *cmd;
@@ -541,7 +541,7 @@ ice_aq_dealloc_acl_scen(struct ice_hw *hw, u16 scen_id, struct ice_sq_cd *cd)
  *
  * Calls update or query ACL scenario
  */
-static enum ice_status
+static int
 ice_aq_update_query_scen(struct ice_hw *hw, u16 opcode, u16 scen_id,
 			 struct ice_aqc_acl_scen *buf, struct ice_sq_cd *cd)
 {
@@ -566,7 +566,7 @@ ice_aq_update_query_scen(struct ice_hw *hw, u16 opcode, u16 scen_id,
  *
  * Update ACL scenario (indirect 0x0C1B)
  */
-enum ice_status
+int
 ice_aq_update_acl_scen(struct ice_hw *hw, u16 scen_id,
 		       struct ice_aqc_acl_scen *buf, struct ice_sq_cd *cd)
 {
@@ -583,7 +583,7 @@ ice_aq_update_acl_scen(struct ice_hw *hw, u16 scen_id,
  *
  * Query ACL scenario (indirect 0x0C23)
  */
-enum ice_status
+int
 ice_aq_query_acl_scen(struct ice_hw *hw, u16 scen_id,
 		      struct ice_aqc_acl_scen *buf, struct ice_sq_cd *cd)
 {
drivers/net/ice/base/ice_acl.h +25 -25

102 lines not on this page · raw message

drivers/net/ice/base/ice_acl_ctrl.c +23 -22

172 lines not on this page · raw message

drivers/net/ice/base/ice_adminq_cmd.h +345 -114

774 lines not on this page · raw message

drivers/net/ice/base/ice_bitops.h +4 -4
index 3b71c1b7f5..85e14a2358 100644
@@ -375,7 +375,7 @@ static inline bool ice_is_any_bit_set(ice_bitmap_t *bitmap, u16 size)
 }
 
 /**
- * ice_cp_bitmap - copy bitmaps.
+ * ice_cp_bitmap - copy bitmaps
  * @dst: bitmap destination
  * @src: bitmap to copy from
  * @size: Size of the bitmaps in bits
@@ -418,10 +418,10 @@ ice_bitmap_set(ice_bitmap_t *dst, u16 pos, u16 num_bits)
  * Note that this function assumes it is operating on a bitmap declared using
  * ice_declare_bitmap.
  */
-static inline int
+static inline u16
 ice_bitmap_hweight(ice_bitmap_t *bm, u16 size)
 {
-	int count = 0;
+	u16 count = 0;
 	u16 bit = 0;
 
 	while (size > (bit = ice_find_next_bit(bm, size, bit))) {
@@ -433,7 +433,7 @@ ice_bitmap_hweight(ice_bitmap_t *bm, u16 size)
 }
 
 /**
- * ice_cmp_bitmap - compares two bitmaps.
+ * ice_cmp_bitmap - compares two bitmaps
  * @bmp1: the bitmap to compare
  * @bmp2: the bitmap to compare with bmp1
  * @size: Size of the bitmaps in bits
drivers/net/ice/base/ice_cgu_regs.h +90 -0

106 lines not on this page · raw message

drivers/net/ice/base/ice_common.c +966 -655

1,593 lines not on this page · raw message

drivers/net/ice/base/ice_common.h +107 -82

189 lines not on this page · raw message

drivers/net/ice/base/ice_controlq.c +114 -99

213 lines not on this page · raw message

drivers/net/ice/base/ice_controlq.h +20 -8
index 986604ec3c..27849c6ac1 100644

Lines of this file are not shown. View the raw message.

drivers/net/ice/base/ice_dcb.c +39 -40

79 lines not on this page · raw message

drivers/net/ice/base/ice_dcb.h +16 -16
index bae033a460..c2c48ae8bb 100644

Lines of this file are not shown. View the raw message.

drivers/net/ice/base/ice_ddp.c +53 -62

115 lines not on this page · raw message

drivers/net/ice/base/ice_ddp.h +11 -7
index 1e02adf0db..bedbc12879 100644

Lines of this file are not shown. View the raw message.

drivers/net/ice/base/ice_devids.h +27 -12
index 19478d2db1..0b7a5406c2 100644

Lines of this file are not shown. View the raw message.

drivers/net/ice/base/ice_fdir.c +27 -23

50 lines not on this page · raw message

drivers/net/ice/base/ice_fdir.h +9 -9
index 81ba6008e4..1bb8a14a5d 100644

Lines of this file are not shown. View the raw message.

drivers/net/ice/base/ice_flex_pipe.c +194 -191

385 lines not on this page · raw message

drivers/net/ice/base/ice_flex_pipe.h +16 -16
index 422d09becc..9d897887d0 100644

Lines of this file are not shown. View the raw message.

drivers/net/ice/base/ice_flex_type.h +24 -17

41 lines not on this page · raw message

drivers/net/ice/base/ice_flow.c +176 -161

337 lines not on this page · raw message

drivers/net/ice/base/ice_flow.h +27 -25

52 lines not on this page · raw message

drivers/net/ice/base/ice_fwlog.c new file +5 -0
new file mode 100644
index 0000000000..a285ff3c66

Lines of this file are not shown. View the raw message.

drivers/net/ice/base/ice_fwlog.h new file +4 -0
new file mode 100644
index 0000000000..7faf002754

Lines of this file are not shown. View the raw message.

drivers/net/ice/base/ice_hw_autogen.h +2186 -383

2,569 lines not on this page · raw message

drivers/net/ice/base/ice_lan_tx_rx.h +35 -52

87 lines not on this page · raw message

drivers/net/ice/base/ice_metainit.c +1 -1
index 1e990c9aa0..978545adc6 100644

Lines of this file are not shown. View the raw message.

drivers/net/ice/base/ice_nvm.c +190 -131

321 lines not on this page · raw message

drivers/net/ice/base/ice_nvm.h +19 -17
index c3e61a301f..f47b4b6d5a 100644

Lines of this file are not shown. View the raw message.

drivers/net/ice/base/ice_parser.c +30 -27

57 lines not on this page · raw message

drivers/net/ice/base/ice_parser.h +15 -15
index 0f64584898..28c96af6da 100644

Lines of this file are not shown. View the raw message.

drivers/net/ice/base/ice_parser_rt.c +41 -47

88 lines not on this page · raw message

drivers/net/ice/base/ice_parser_rt.h +9 -14
index de851643b4..d69e82e62c 100644

Lines of this file are not shown. View the raw message.

drivers/net/ice/base/ice_phy_regs.h new file +84 -0

84 lines not on this page · raw message

drivers/net/ice/base/ice_protocol_type.h +8 -9
index d2d3f75fc2..cb2349086d 100644

Lines of this file are not shown. View the raw message.

drivers/net/ice/base/ice_ptp_consts.h +2 -1
index 546bf8ba91..bd0258f437 100644

Lines of this file are not shown. View the raw message.

drivers/net/ice/base/ice_ptp_hw.c +2057 -2536

4,593 lines not on this page · raw message

drivers/net/ice/base/ice_ptp_hw.h +178 -154

332 lines not on this page · raw message

drivers/net/ice/base/ice_sbq_cmd.h +0 -1
index 4da16caf70..a74c4b8e8e 100644

Lines of this file are not shown. View the raw message.

drivers/net/ice/base/ice_sched.c +316 -240

556 lines not on this page · raw message

drivers/net/ice/base/ice_sched.h +79 -51

130 lines not on this page · raw message

drivers/net/ice/base/ice_switch.c +1123 -770

1,893 lines not on this page · raw message

drivers/net/ice/base/ice_switch.h +138 -103

241 lines not on this page · raw message

drivers/net/ice/base/ice_type.h +177 -17

194 lines not on this page · raw message

drivers/net/ice/base/ice_vf_mbx.c new file +4 -0
new file mode 100644
index 0000000000..7faf002754

Lines of this file are not shown. View the raw message.

drivers/net/ice/base/ice_vf_mbx.h new file +4 -0
new file mode 100644
index 0000000000..7faf002754

Lines of this file are not shown. View the raw message.

drivers/net/ice/base/ice_vlan_mode.c +22 -25

47 lines not on this page · raw message

drivers/net/ice/base/ice_vlan_mode.h +1 -1
index d2380eb94b..bcb591b308 100644

Lines of this file are not shown. View the raw message.

drivers/net/ice/base/ice_xlt_kb.c +2 -2
index b8240946b4..0d5a510384 100644

Lines of this file are not shown. View the raw message.

drivers/net/ice/base/meson.build +2 -0
index 41ed2d96c6..38ddde9e8c 100644

Lines of this file are not shown. View the raw message.

drivers/net/ice/ice_diagnose.c +5 -4
index 3be819d7f8..4006e9b35d 100644

Lines of this file are not shown. View the raw message.

drivers/net/ice/ice_ethdev.c +26 -29

55 lines not on this page · raw message

The rest of this diff is not shown. View the raw message.

Signature · 1 line
2.34.1

Part of the diff is not shown here. View the raw message.

#1 lore raw

Hello Ian,

In general, base drivers are updated with multiple commits, one per feature. It helps tracking the changes.

Please would it be possible to split?

PS: look like you are not registered in the mailing list, this patch was in the moderation queue.

30/04/2024 17:40, Ian Stokes:

Quoted 68 lines

The purpose of this patch is to update shared code for the ice driver. This patch not only contains the updated base code files but also the required changes within the DPDK code base to enable compilation and basic functionality. This is with a view to allow further regression testing while a final patch series is generated that correctly splits the code changes into an expected manner.

---
 drivers/net/ice/base/ice_acl.c           |   58 +-
 drivers/net/ice/base/ice_acl.h           |   50 +-
 drivers/net/ice/base/ice_acl_ctrl.c      |   45 +-
 drivers/net/ice/base/ice_adminq_cmd.h    |  459 ++-
 drivers/net/ice/base/ice_bitops.h        |    8 +-
 drivers/net/ice/base/ice_cgu_regs.h      |   90 +
 drivers/net/ice/base/ice_common.c        | 1621 +++++---
 drivers/net/ice/base/ice_common.h        |  189 +-
 drivers/net/ice/base/ice_controlq.c      |  213 +-
 drivers/net/ice/base/ice_controlq.h      |   28 +-
 drivers/net/ice/base/ice_dcb.c           |   79 +-
 drivers/net/ice/base/ice_dcb.h           |   32 +-
 drivers/net/ice/base/ice_ddp.c           |  115 +-
 drivers/net/ice/base/ice_ddp.h           |   18 +-
 drivers/net/ice/base/ice_devids.h        |   39 +-
 drivers/net/ice/base/ice_fdir.c          |   50 +-
 drivers/net/ice/base/ice_fdir.h          |   18 +-
 drivers/net/ice/base/ice_flex_pipe.c     |  385 +-
 drivers/net/ice/base/ice_flex_pipe.h     |   32 +-
 drivers/net/ice/base/ice_flex_type.h     |   41 +-
 drivers/net/ice/base/ice_flow.c          |  337 +-
 drivers/net/ice/base/ice_flow.h          |   52 +-
 drivers/net/ice/base/ice_fwlog.c         |    5 +
 drivers/net/ice/base/ice_fwlog.h         |    4 +
 drivers/net/ice/base/ice_hw_autogen.h    | 2569 ++++++++++--
 drivers/net/ice/base/ice_lan_tx_rx.h     |   87 +-
 drivers/net/ice/base/ice_metainit.c      |    2 +-
 drivers/net/ice/base/ice_nvm.c           |  321 +-
 drivers/net/ice/base/ice_nvm.h           |   36 +-
 drivers/net/ice/base/ice_parser.c        |   57 +-
 drivers/net/ice/base/ice_parser.h        |   30 +-
 drivers/net/ice/base/ice_parser_rt.c     |   88 +-
 drivers/net/ice/base/ice_parser_rt.h     |   23 +-
 drivers/net/ice/base/ice_phy_regs.h      |   84 +
 drivers/net/ice/base/ice_protocol_type.h |   17 +-
 drivers/net/ice/base/ice_ptp_consts.h    |    3 +-
 drivers/net/ice/base/ice_ptp_hw.c        | 4593 ++++++++++------------
 drivers/net/ice/base/ice_ptp_hw.h        |  332 +-
 drivers/net/ice/base/ice_sbq_cmd.h       |    1 -
 drivers/net/ice/base/ice_sched.c         |  556 +--
 drivers/net/ice/base/ice_sched.h         |  130 +-
 drivers/net/ice/base/ice_switch.c        | 1893 +++++----
 drivers/net/ice/base/ice_switch.h        |  241 +-
 drivers/net/ice/base/ice_type.h          |  194 +-
 drivers/net/ice/base/ice_vf_mbx.c        |    4 +
 drivers/net/ice/base/ice_vf_mbx.h        |    4 +
 drivers/net/ice/base/ice_vlan_mode.c     |   47 +-
 drivers/net/ice/base/ice_vlan_mode.h     |    2 +-
 drivers/net/ice/base/ice_xlt_kb.c        |    4 +-
 drivers/net/ice/base/meson.build         |    2 +
 drivers/net/ice/ice_diagnose.c           |    9 +-
 drivers/net/ice/ice_ethdev.c             |   55 +-
 52 files changed, 9105 insertions(+), 6247 deletions(-)
 create mode 100644 drivers/net/ice/base/ice_fwlog.c
 create mode 100644 drivers/net/ice/base/ice_fwlog.h
 create mode 100644 drivers/net/ice/base/ice_phy_regs.h
 create mode 100644 drivers/net/ice/base/ice_vf_mbx.c
 create mode 100644 drivers/net/ice/base/ice_vf_mbx.h
#2 lore raw
Quoted 7 lines · Thomas Monjalon

Hello Ian,

In general, base drivers are updated with multiple commits, one per feature. It helps tracking the changes.

Please would it be possible to split?

Hi Thomas,

yes, that is very much the intention. As Ian states in his last line, we sent this as an RFC to a) flag that the series is coming in future, and b) have an initial CI run done, while we work in parallel on splitting the code changes into a more meaningful series of commits. Given the scope of the changes we didn't have time to do the split yet, but wanted to get an inital RFC to the list.

/Bruce

Quoted 78 lines

PS: look like you are not registered in the mailing list, this patch was in the moderation queue.

30/04/2024 17:40, Ian Stokes:

Quoted 68 lines

The purpose of this patch is to update shared code for the ice driver. This patch not only contains the updated base code files but also the required changes within the DPDK code base to enable compilation and basic functionality. This is with a view to allow further regression testing while a final patch series is generated that correctly splits the code changes into an expected manner.

---
 drivers/net/ice/base/ice_acl.c           |   58 +-
 drivers/net/ice/base/ice_acl.h           |   50 +-
 drivers/net/ice/base/ice_acl_ctrl.c      |   45 +-
 drivers/net/ice/base/ice_adminq_cmd.h    |  459 ++-
 drivers/net/ice/base/ice_bitops.h        |    8 +-
 drivers/net/ice/base/ice_cgu_regs.h      |   90 +
 drivers/net/ice/base/ice_common.c        | 1621 +++++---
 drivers/net/ice/base/ice_common.h        |  189 +-
 drivers/net/ice/base/ice_controlq.c      |  213 +-
 drivers/net/ice/base/ice_controlq.h      |   28 +-
 drivers/net/ice/base/ice_dcb.c           |   79 +-
 drivers/net/ice/base/ice_dcb.h           |   32 +-
 drivers/net/ice/base/ice_ddp.c           |  115 +-
 drivers/net/ice/base/ice_ddp.h           |   18 +-
 drivers/net/ice/base/ice_devids.h        |   39 +-
 drivers/net/ice/base/ice_fdir.c          |   50 +-
 drivers/net/ice/base/ice_fdir.h          |   18 +-
 drivers/net/ice/base/ice_flex_pipe.c     |  385 +-
 drivers/net/ice/base/ice_flex_pipe.h     |   32 +-
 drivers/net/ice/base/ice_flex_type.h     |   41 +-
 drivers/net/ice/base/ice_flow.c          |  337 +-
 drivers/net/ice/base/ice_flow.h          |   52 +-
 drivers/net/ice/base/ice_fwlog.c         |    5 +
 drivers/net/ice/base/ice_fwlog.h         |    4 +
 drivers/net/ice/base/ice_hw_autogen.h    | 2569 ++++++++++--
 drivers/net/ice/base/ice_lan_tx_rx.h     |   87 +-
 drivers/net/ice/base/ice_metainit.c      |    2 +-
 drivers/net/ice/base/ice_nvm.c           |  321 +-
 drivers/net/ice/base/ice_nvm.h           |   36 +-
 drivers/net/ice/base/ice_parser.c        |   57 +-
 drivers/net/ice/base/ice_parser.h        |   30 +-
 drivers/net/ice/base/ice_parser_rt.c     |   88 +-
 drivers/net/ice/base/ice_parser_rt.h     |   23 +-
 drivers/net/ice/base/ice_phy_regs.h      |   84 +
 drivers/net/ice/base/ice_protocol_type.h |   17 +-
 drivers/net/ice/base/ice_ptp_consts.h    |    3 +-
 drivers/net/ice/base/ice_ptp_hw.c        | 4593 ++++++++++------------
 drivers/net/ice/base/ice_ptp_hw.h        |  332 +-
 drivers/net/ice/base/ice_sbq_cmd.h       |    1 -
 drivers/net/ice/base/ice_sched.c         |  556 +--
 drivers/net/ice/base/ice_sched.h         |  130 +-
 drivers/net/ice/base/ice_switch.c        | 1893 +++++----
 drivers/net/ice/base/ice_switch.h        |  241 +-
 drivers/net/ice/base/ice_type.h          |  194 +-
 drivers/net/ice/base/ice_vf_mbx.c        |    4 +
 drivers/net/ice/base/ice_vf_mbx.h        |    4 +
 drivers/net/ice/base/ice_vlan_mode.c     |   47 +-
 drivers/net/ice/base/ice_vlan_mode.h     |    2 +-
 drivers/net/ice/base/ice_xlt_kb.c        |    4 +-
 drivers/net/ice/base/meson.build         |    2 +
 drivers/net/ice/ice_diagnose.c           |    9 +-
 drivers/net/ice/ice_ethdev.c             |   55 +-
 52 files changed, 9105 insertions(+), 6247 deletions(-)
 create mode 100644 drivers/net/ice/base/ice_fwlog.c
 create mode 100644 drivers/net/ice/base/ice_fwlog.h
 create mode 100644 drivers/net/ice/base/ice_phy_regs.h
 create mode 100644 drivers/net/ice/base/ice_vf_mbx.c
 create mode 100644 drivers/net/ice/base/ice_vf_mbx.h
#3 lore raw

01/05/2024 11:06, Bruce Richardson:

Quoted 9 lines · Thomas Monjalon
Quoted 7 lines

Hello Ian,

In general, base drivers are updated with multiple commits, one per feature. It helps tracking the changes.

Please would it be possible to split?

Quoted 8 lines

Hi Thomas,

yes, that is very much the intention. As Ian states in his last line, we sent this as an RFC to a) flag that the series is coming in future, and b) have an initial CI run done, while we work in parallel on splitting the code changes into a more meaningful series of commits. Given the scope of the changes we didn't have time to do the split yet, but wanted to get an inital RFC to the list.

OK thanks, I didn't pay enough attention to the last words.

Quoted 13 lines
Quoted 13 lines

PS: look like you are not registered in the mailing list, this patch was in the moderation queue.

30/04/2024 17:40, Ian Stokes:

Quoted 8 lines

The purpose of this patch is to update shared code for the ice driver. This patch not only contains the updated base code files but also the required changes within the DPDK code base to enable compilation and basic functionality. This is with a view to allow further regression testing while a final patch series is generated that correctly splits the code changes into an expected manner.

#4 lore raw

v2 cover Update net/ice base driver to latest upstream snapshot

In reply to Ian Stokes

This is a patchset loosely based on internal development tree which tracked ICE driver development over a period of time since last snapshot update.

RFC -> v1:
- From one, many

Anatoly Burakov (21):
net/ice/base: alloc port_info only once
net/ice/base: be more verbose when preparing timer sync net/ice/base: be more verbose in configuring Rx timestamp offset net/ice/base: match code style to upstream net/ice/base: move ice_ptp_init_phy_model to align with upstream net/ice/base: add Get Link Status Data version 2 net/ice/base: add port option commands
net/ice/base: merge unified E830 headers net/ice/base: replace array initialization with macros net/ice/base: switch speed conversions to static lookups net/ice/base: support E830 in DDP pkg handling net/ice/base: support E830 in Topology AQ command net/ice/base: add E830 PTP init
net/ice/base: allow skipping main timer programming net/ice/base: align code to upstream
net/ice/base: use const char* array for storing link modes net/ice/base: fix compile issues on some targets net/ice/base: move code to common headers net/ice/base: make some switch-related functions static net/ice/base: add support for L2TP on switch net/ice/base: add L2TPv3 support for adv rules

Bruce Richardson (1):
net/ice: add new device ids

Ian Stokes (126):
net/ice/base: convert enum ice_status to int
net/ice/base: replace ICE_SUCCESS with int
net/ice/base: update E830 headers
net/ice/base: update phy config during link restart net/ice/base: fix for pointer to variable outside scope net/ice/base: add missing include for flow
net/ice/base: add ability to set markid via switch filter net/ice/base: improve ice_debug_cq messages
net/ice/base: add mgmt netlist auth support command net/ice/base: fix undefined variables
net/ice/base: fix get media type
net/ice/base: clean up __ice_aq_get_set_rss_lut() net/ice/base: update flow seg fields to declared bitmaps net/ice/base: update interface in ice_parse_common_caps net/ice/base: refactor (non) bitmap declarations net/ice/base: remove unnecessary control queue cmd_buf arrays net/ice/base: update code with flex array safe allocations net/ice/base: bring back ability to use 128 as size of PF type RSS LUT net/ice/base: support for OROM update in recovery mode net/ice/base: code adjustments for E830
net/ice/base: improve find recipe routine
net/ice/base: fix memory leak when checking firmware version net/ice/base: add LL Tx timestamp interrupt read net/ice/base: use model-dependent number of PHY ports net/ice/base: use ice_bitmap_t in promisc functions net/ice/base: fix rx-only unicast promiscuous mode net/ice/base: add support for E825-C TX clock changing net/ice/base: fix for applying multiple cloud filters net/ice/base: limit PF RSS LUT to one VSI at time net/ice/base: prevent potential integer overflow net/ice/base: cosmetic changes
net/ice/base: implement initial PTP support for E830 net/ice/base: fix resource leak
net/ice/base: move lock outside of if-else
net/ice/base: refactor control queue send delay net/ice/base: fix NVM feature check
net/ice/base: allow for dumping all clusters
net/ice/base: remove PTP aqc_driver_params
net/ice/base: add FW load status mask
net/ice/base: add direction metadata
net/ice/base: change data buffer in i2c write to be const net/ice/base: remove unused code from upstream build net/ice/base: fix sign-extension
net/ice/base: implement switch recipe reuse feature net/ice/base: add helper function for refsync net/ice/base: added informational message for NAC topology net/ice/base: add Cage Max Power override NVM module net/ice/base: adapt No FEC in Auto support check to add E82X devices net/ice/base: move (read|write)_sma_ctrl functions to match upstream net/ice/base: fix incorrect size when allocating children arrays net/ice/base: fix GCS descriptor field offsets net/ice/base: add VSI type for subfunctions
net/ice/base: correct the return type of ice_bitmap_hweight net/ice/base: fix ice_ptp_one_port_cmd to avoid stale PHY commands net/ice/base: remove dead code from ice_get_ddp_pkg_state net/ice/base: get rid of enum ice_status
net/ice/base: use ICE_PTP_NOP to better indicate no action net/ice/base: add fw log file
net/ice/base: update comments regarding clearing timestamps net/ice/base: use "err" instead of "status" in ice_ptp_hw.c net/ice/base: re-number E810-T subdevice IDs to match upstream net/ice/base: enable RDMA Act-Act unload paths net/ice/base: parse 1PPS GPIO in 1588 function caps net/ice/base: rename netlist check functions to match upstream net/ice/base: fix check for existing switch rule net/ice/base: fall back to safe CGU params
net/ice/base: change tmr_idx to u32
net/ice/base: update strict status when assigning BW limits net/ice/base: remove unused define
net/ice/base: improve read retry value calculation net/ice/base: check if recipe buffer was already allocated net/ice/base: fix handling recipes when reusing is not supported net/ice/base: use correct type
net/ice/base: read OROM in a loop
net/ice/base: ignore snprintf return value
net/ice/base: check array bounds
net/ice/base: copy output IO params from command descriptor net/ice/base: enable Next Cluster ID capability net/ice/base: fix potential TLV length overflow net/ice/base: add function to read SDP section from NVM net/ice/base: add Floating VEB support
net/ice/base: add defines for loopback mode
net/ice/base: allow skipping PF clear
net/ice/base: fix in the definition of the Board Type net/ice/base : make ice_clear_vsi_q_ctx() non-static net/ice/base: fix package download algorithm
net/ice/base: allows packages with mixed signature presence net/ice/base: fix ice_memcpy type specifiers
net/ice/base: allow different FW API versions based on MAC type net/ice/base: add 32 GT bus speed enumerated value net/ice/base: add E830 debug dump cluster ID values net/ice/base: fix for preparing PHY for timesync command net/ice/base: support for firmware sanitization net/ice/base: add 200G speeds to PHY types decoding net/ice/base: temporary workaround for E830 signed package support net/ice/base: add PHY OFFSET_READY register clearing net/ice/base: rename PHY model designator fields and functions net/ice/base: enable SB access explicitly before 1st PHY access net/ice/base: refactor ETH56G PHY initialization net/ice/base: refactor ETH56G support for miltiple PHYs per MAC net/ice/base: implement interface to reset timestamp memory net/ice/base: fix iterations over PTP ports
net/ice/base: return high address for multi-read eth56g registers net/ice/base: add function to read Tx timestamp status register net/ice/base: implement upper-level PHY control functions net/ice/base: squash multiple fixes for e56g device net/ice/base: add PHY statistics dump
net/ice/base: add missing files for shared code update net/ice/base: detect and store device sensor reading capability net/ice/base: add missing defines and misc cleanup net/ice/base: increase PF reset wait timeout to 500 milliseconds net/ice/base: fix memcpy type
net/ice/base: too big a timeout for QV diagnostic tests net/ice/base: fix ice_get_ctx() issue
net/ice/base: add AQ function to configure SyncE error reporting net/ice/base: support DCF query port ETS adminq net/ice/base: update boost struct for traffic types net/ice/base: clean up ice_lan_tx_rx
net/ice/base: enable CGU error reporting
net/ice/base: cleanup timestamp registers correctly net/ice/base: rework multiple functions
net/ice/base: change a method to get pca9575 handle net/ice/base: rename SMA register macros to match Linux upstream net/ice/base: introduce new functions in ice_sched_node net/ice/base: misc header file clean up
net/ice: update rss lut value for RSS init

 drivers/net/ice/base/ice_acl.c                |   58 +-
 drivers/net/ice/base/ice_acl.h                |   50 +-
 drivers/net/ice/base/ice_acl_ctrl.c           |   44 +-
 drivers/net/ice/base/ice_adminq_cmd.h         |  458 +-
 drivers/net/ice/base/ice_bitops.h             |    8 +-
 drivers/net/ice/base/ice_cgu_regs.h           |   90 +
 drivers/net/ice/base/ice_common.c             | 1629 +++---
 drivers/net/ice/base/ice_common.h             |  189 +-
 drivers/net/ice/base/ice_controlq.c           |  213 +-
 drivers/net/ice/base/ice_controlq.h           |   28 +-
 drivers/net/ice/base/ice_dcb.c                |   77 +-
 drivers/net/ice/base/ice_dcb.h                |   32 +-
 drivers/net/ice/base/ice_ddp.c                |  120 +-
 drivers/net/ice/base/ice_ddp.h                |   15 +-
 drivers/net/ice/base/ice_devids.h             |   36 +-
 drivers/net/ice/base/ice_fdir.c               |   46 +-
 drivers/net/ice/base/ice_fdir.h               |   18 +-
 drivers/net/ice/base/ice_flex_pipe.c          |  376 +-
 drivers/net/ice/base/ice_flex_pipe.h          |   30 +-
 drivers/net/ice/base/ice_flex_type.h          |   13 +-
 drivers/net/ice/base/ice_flow.c               |  328 +-
 drivers/net/ice/base/ice_flow.h               |   52 +-
 drivers/net/ice/base/ice_fwlog.c              |    5 +
 .../base/ice_fwlog.h}                         |    2 +-
 drivers/net/ice/base/ice_hw_autogen.h         | 2556 +++++++--
 drivers/net/ice/base/ice_lan_tx_rx.h          |   40 +-
 drivers/net/ice/base/ice_nvm.c                |  320 +-
 drivers/net/ice/base/ice_nvm.h                |   36 +-
 drivers/net/ice/base/ice_parser.c             |   51 +-
 drivers/net/ice/base/ice_parser.h             |   30 +-
 drivers/net/ice/base/ice_parser_rt.c          |   30 +-
 drivers/net/ice/base/ice_parser_rt.h          |    4 +-
 drivers/net/ice/base/ice_phy_regs.h           |   84 +
 drivers/net/ice/base/ice_protocol_type.h      |   12 +-
 drivers/net/ice/base/ice_ptp_consts.h         |    3 +-
 drivers/net/ice/base/ice_ptp_hw.c             | 4609 ++++++++++-------
 drivers/net/ice/base/ice_ptp_hw.h             |  274 +-
 drivers/net/ice/base/ice_sbq_cmd.h            |    3 +-
 drivers/net/ice/base/ice_sched.c              |  548 +-
 drivers/net/ice/base/ice_sched.h              |  129 +-
 drivers/net/ice/base/ice_status.h             |    2 +
 drivers/net/ice/base/ice_switch.c             | 1821 ++++---
 drivers/net/ice/base/ice_switch.h             |  236 +-
 drivers/net/ice/base/ice_type.h               |  198 +-
 .../base/ice_vf_mbx.c}                        |    2 +-
 .../base/ice_vf_mbx.h}                        |    2 +-
 drivers/net/ice/base/ice_vlan_mode.c          |   38 +-
 drivers/net/ice/base/ice_vlan_mode.h          |    2 +-
 drivers/net/ice/base/ice_xlt_kb.c             |    4 +-
 drivers/net/ice/base/meson.build              |    2 +
 drivers/net/ice/ice_diagnose.c                |    9 +-
 drivers/net/ice/ice_ethdev.c                  |   59 +-
 52 files changed, 9797 insertions(+), 5224 deletions(-)
 create mode 100644 drivers/net/ice/base/ice_fwlog.c
 copy drivers/net/{vmxnet3/base/vmware_pack_end.h => ice/base/ice_fwlog.h} (50%)
 create mode 100644 drivers/net/ice/base/ice_phy_regs.h
 copy drivers/net/{vmxnet3/base/vmware_pack_end.h => ice/base/ice_vf_mbx.c} (50%)
 copy drivers/net/{vmxnet3/base/vmware_pack_end.h => ice/base/ice_vf_mbx.h} (50%)
Signature · 1 line
2.43.0
#5 lore raw

PATCH v2 1/148 net/ice/base: convert enum ice_status to int

From: Ian Stokes <[email protected]>

Convert enum ice_status variables/return type to just int.
Do so by applying following:
grep -Inrl ice_status |
grep -v ice_status.h |
xargs -r gawk -i inplace '/[Ii]nclude/ || gsub(/(enum )?ice_status/, "int") || 1'

---
 drivers/net/ice/base/ice_acl.c       |  56 ++--
 drivers/net/ice/base/ice_acl.h       |  50 ++--
 drivers/net/ice/base/ice_acl_ctrl.c  |  36 +--
 drivers/net/ice/base/ice_common.c    | 267 +++++++++--------
 drivers/net/ice/base/ice_common.h    | 150 +++++-----
 drivers/net/ice/base/ice_controlq.c  |  58 ++--
 drivers/net/ice/base/ice_dcb.c       |  60 ++--
 drivers/net/ice/base/ice_dcb.h       |  32 +--
 drivers/net/ice/base/ice_ddp.c       |  48 ++--
 drivers/net/ice/base/ice_ddp.h       |  14 +-
 drivers/net/ice/base/ice_fdir.c      |  20 +-
 drivers/net/ice/base/ice_fdir.h      |  18 +-
 drivers/net/ice/base/ice_flex_pipe.c | 176 ++++++------
 drivers/net/ice/base/ice_flex_pipe.h |  30 +-
 drivers/net/ice/base/ice_flow.c      | 136 ++++-----
 drivers/net/ice/base/ice_flow.h      |  28 +-
 drivers/net/ice/base/ice_nvm.c       | 119 ++++----
 drivers/net/ice/base/ice_nvm.h       |  33 +--
 drivers/net/ice/base/ice_parser.c    |  16 +-
 drivers/net/ice/base/ice_parser.h    |  12 +-
 drivers/net/ice/base/ice_parser_rt.c |   4 +-
 drivers/net/ice/base/ice_parser_rt.h |   2 +-
 drivers/net/ice/base/ice_ptp_hw.c    | 414 +++++++++++++--------------
 drivers/net/ice/base/ice_ptp_hw.h    |  86 +++---
 drivers/net/ice/base/ice_sched.c     | 372 ++++++++++++------------
 drivers/net/ice/base/ice_sched.h     |  96 +++----
 drivers/net/ice/base/ice_switch.c    | 325 ++++++++++-----------
 drivers/net/ice/base/ice_switch.h    | 106 +++----
 drivers/net/ice/base/ice_vlan_mode.c |  28 +-
 drivers/net/ice/base/ice_vlan_mode.h |   2 +-
 30 files changed, 1396 insertions(+), 1398 deletions(-)
drivers/net/ice/base/ice_acl.c +28 -28
index fd9c6d5c14..34d031338f 100644
@@ -13,7 +13,7 @@
  *
  * Allocate ACL table (indirect 0x0C10)
  */
-enum ice_status
+int
 ice_aq_alloc_acl_tbl(struct ice_hw *hw, struct ice_acl_alloc_tbl *tbl,
 		     struct ice_sq_cd *cd)
 {
@@ -64,7 +64,7 @@ ice_aq_alloc_acl_tbl(struct ice_hw *hw, struct ice_acl_alloc_tbl *tbl,
  * format is 'struct ice_aqc_acl_generic', pass ptr to that struct
  * as 'buf' and its size as 'buf_size'
  */
-enum ice_status
+int
 ice_aq_dealloc_acl_tbl(struct ice_hw *hw, u16 alloc_id,
 		       struct ice_aqc_acl_generic *buf, struct ice_sq_cd *cd)
 {
@@ -78,7 +78,7 @@ ice_aq_dealloc_acl_tbl(struct ice_hw *hw, u16 alloc_id,
 	return ice_aq_send_cmd(hw, &desc, buf, sizeof(*buf), cd);
 }
 
-static enum ice_status
+static int
 ice_aq_acl_entry(struct ice_hw *hw, u16 opcode, u8 tcam_idx, u16 entry_idx,
 		 struct ice_aqc_acl_data *buf, struct ice_sq_cd *cd)
 {
@@ -107,7 +107,7 @@ ice_aq_acl_entry(struct ice_hw *hw, u16 opcode, u8 tcam_idx, u16 entry_idx,
  *
  * Program ACL entry (direct 0x0C20)
  */
-enum ice_status
+int
 ice_aq_program_acl_entry(struct ice_hw *hw, u8 tcam_idx, u16 entry_idx,
 			 struct ice_aqc_acl_data *buf, struct ice_sq_cd *cd)
 {
@@ -128,7 +128,7 @@ ice_aq_program_acl_entry(struct ice_hw *hw, u8 tcam_idx, u16 entry_idx,
  * NOTE: Caller of this API to parse 'buf' appropriately since it contains
  * response (key and key invert)
  */
-enum ice_status
+int
 ice_aq_query_acl_entry(struct ice_hw *hw, u8 tcam_idx, u16 entry_idx,
 		       struct ice_aqc_acl_data *buf, struct ice_sq_cd *cd)
 {
@@ -137,7 +137,7 @@ ice_aq_query_acl_entry(struct ice_hw *hw, u8 tcam_idx, u16 entry_idx,
 }
 
 /* Helper function to alloc/dealloc ACL action pair */
-static enum ice_status
+static int
 ice_aq_actpair_a_d(struct ice_hw *hw, u16 opcode, u16 alloc_id,
 		   struct ice_aqc_acl_generic *buf, struct ice_sq_cd *cd)
 {
@@ -163,7 +163,7 @@ ice_aq_actpair_a_d(struct ice_hw *hw, u16 opcode, u16 alloc_id,
  * This command doesn't need and doesn't have its own command buffer
  * but for response format is as specified in 'struct ice_aqc_acl_generic'
  */
-enum ice_status
+int
 ice_aq_alloc_actpair(struct ice_hw *hw, u16 alloc_id,
 		     struct ice_aqc_acl_generic *buf, struct ice_sq_cd *cd)
 {
@@ -180,7 +180,7 @@ ice_aq_alloc_actpair(struct ice_hw *hw, u16 alloc_id,
  *
  *  Deallocate ACL actionpair (direct 0x0C13)
  */
-enum ice_status
+int
 ice_aq_dealloc_actpair(struct ice_hw *hw, u16 alloc_id,
 		       struct ice_aqc_acl_generic *buf, struct ice_sq_cd *cd)
 {
@@ -189,7 +189,7 @@ ice_aq_dealloc_actpair(struct ice_hw *hw, u16 alloc_id,
 }
 
 /* Helper function to program/query ACL action pair */
-static enum ice_status
+static int
 ice_aq_actpair_p_q(struct ice_hw *hw, u16 opcode, u8 act_mem_idx,
 		   u16 act_entry_idx, struct ice_aqc_actpair *buf,
 		   struct ice_sq_cd *cd)
@@ -219,7 +219,7 @@ ice_aq_actpair_p_q(struct ice_hw *hw, u16 opcode, u8 act_mem_idx,
  *
  * Program action entries (indirect 0x0C1C)
  */
-enum ice_status
+int
 ice_aq_program_actpair(struct ice_hw *hw, u8 act_mem_idx, u16 act_entry_idx,
 		       struct ice_aqc_actpair *buf, struct ice_sq_cd *cd)
 {
@@ -237,7 +237,7 @@ ice_aq_program_actpair(struct ice_hw *hw, u8 act_mem_idx, u16 act_entry_idx,
  *
  * Query ACL actionpair (indirect 0x0C25)
  */
-enum ice_status
+int
 ice_aq_query_actpair(struct ice_hw *hw, u8 act_mem_idx, u16 act_entry_idx,
 		     struct ice_aqc_actpair *buf, struct ice_sq_cd *cd)
 {
@@ -253,7 +253,7 @@ ice_aq_query_actpair(struct ice_hw *hw, u8 act_mem_idx, u16 act_entry_idx,
  * De-allocate ACL resources (direct 0x0C1A). Used by SW to release all the
  * resources allocated for it using a single command
  */
-enum ice_status ice_aq_dealloc_acl_res(struct ice_hw *hw, struct ice_sq_cd *cd)
+int ice_aq_dealloc_acl_res(struct ice_hw *hw, struct ice_sq_cd *cd)
 {
 	struct ice_aq_desc desc;
 
@@ -272,7 +272,7 @@ enum ice_status ice_aq_dealloc_acl_res(struct ice_hw *hw, struct ice_sq_cd *cd)
  *
  * This function sends ACL profile commands
  */
-static enum ice_status
+static int
 ice_acl_prof_aq_send(struct ice_hw *hw, u16 opc, u8 prof_id,
 		     struct ice_aqc_acl_prof_generic_frmt *buf,
 		     struct ice_sq_cd *cd)
@@ -296,7 +296,7 @@ ice_acl_prof_aq_send(struct ice_hw *hw, u16 opc, u8 prof_id,
  *
  * Program ACL profile extraction (indirect 0x0C1D)
  */
-enum ice_status
+int
 ice_prgm_acl_prof_xtrct(struct ice_hw *hw, u8 prof_id,
 			struct ice_aqc_acl_prof_generic_frmt *buf,
 			struct ice_sq_cd *cd)
@@ -314,7 +314,7 @@ ice_prgm_acl_prof_xtrct(struct ice_hw *hw, u8 prof_id,
  *
  * Query ACL profile (indirect 0x0C21)
  */
-enum ice_status
+int
 ice_query_acl_prof(struct ice_hw *hw, u8 prof_id,
 		   struct ice_aqc_acl_prof_generic_frmt *buf,
 		   struct ice_sq_cd *cd)
@@ -330,7 +330,7 @@ ice_query_acl_prof(struct ice_hw *hw, u8 prof_id,
  * This function checks the counter bank range for counter type and returns
  * success or failure.
  */
-static enum ice_status ice_aq_acl_cntrs_chk_params(struct ice_acl_cntrs *cntrs)
+static int ice_aq_acl_cntrs_chk_params(struct ice_acl_cntrs *cntrs)
 {
 	enum ice_status status = ICE_SUCCESS;
 
@@ -373,14 +373,14 @@ static enum ice_status ice_aq_acl_cntrs_chk_params(struct ice_acl_cntrs *cntrs)
  * unsuccessful if returned counter value is invalid. In this case it returns
  * an error otherwise success.
  */
-enum ice_status
+int
 ice_aq_alloc_acl_cntrs(struct ice_hw *hw, struct ice_acl_cntrs *cntrs,
 		       struct ice_sq_cd *cd)
 {
 	struct ice_aqc_acl_alloc_counters *cmd;
 	u16 first_cntr, last_cntr;
 	struct ice_aq_desc desc;
-	enum ice_status status;
+	int status;
 
 	/* check for invalid params */
 	status = ice_aq_acl_cntrs_chk_params(cntrs);
@@ -412,13 +412,13 @@ ice_aq_alloc_acl_cntrs(struct ice_hw *hw, struct ice_acl_cntrs *cntrs,
  *
  * De-allocate ACL counters (direct 0x0C17)
  */
-enum ice_status
+int
 ice_aq_dealloc_acl_cntrs(struct ice_hw *hw, struct ice_acl_cntrs *cntrs,
 			 struct ice_sq_cd *cd)
 {
 	struct ice_aqc_acl_dealloc_counters *cmd;
 	struct ice_aq_desc desc;
-	enum ice_status status;
+	int status;
 
 	/* check for invalid params */
 	status = ice_aq_acl_cntrs_chk_params(cntrs);
@@ -443,7 +443,7 @@ ice_aq_dealloc_acl_cntrs(struct ice_hw *hw, struct ice_acl_cntrs *cntrs,
  *
  * Program ACL profile ranges (indirect 0x0C1E)
  */
-enum ice_status
+int
 ice_prog_acl_prof_ranges(struct ice_hw *hw, u8 prof_id,
 			 struct ice_aqc_acl_profile_ranges *buf,
 			 struct ice_sq_cd *cd)
@@ -466,7 +466,7 @@ ice_prog_acl_prof_ranges(struct ice_hw *hw, u8 prof_id,
  *
  * Query ACL profile ranges (indirect 0x0C22)
  */
-enum ice_status
+int
 ice_query_acl_prof_ranges(struct ice_hw *hw, u8 prof_id,
 			  struct ice_aqc_acl_profile_ranges *buf,
 			  struct ice_sq_cd *cd)
@@ -488,13 +488,13 @@ ice_query_acl_prof_ranges(struct ice_hw *hw, u8 prof_id,
  *
  * Allocate ACL scenario (indirect 0x0C14)
  */
-enum ice_status
+int
 ice_aq_alloc_acl_scen(struct ice_hw *hw, u16 *scen_id,
 		      struct ice_aqc_acl_scen *buf, struct ice_sq_cd *cd)
 {
 	struct ice_aqc_acl_alloc_scen *cmd;
 	struct ice_aq_desc desc;
-	enum ice_status status;
+	int status;
 
 	if (!scen_id)
 		return ICE_ERR_PARAM;
@@ -518,7 +518,7 @@ ice_aq_alloc_acl_scen(struct ice_hw *hw, u16 *scen_id,
  *
  * Deallocate ACL scenario (direct 0x0C15)
  */
-enum ice_status
+int
 ice_aq_dealloc_acl_scen(struct ice_hw *hw, u16 scen_id, struct ice_sq_cd *cd)
 {
 	struct ice_aqc_acl_dealloc_scen *cmd;
@@ -541,7 +541,7 @@ ice_aq_dealloc_acl_scen(struct ice_hw *hw, u16 scen_id, struct ice_sq_cd *cd)
  *
  * Calls update or query ACL scenario
  */
-static enum ice_status
+static int
 ice_aq_update_query_scen(struct ice_hw *hw, u16 opcode, u16 scen_id,
 			 struct ice_aqc_acl_scen *buf, struct ice_sq_cd *cd)
 {
@@ -566,7 +566,7 @@ ice_aq_update_query_scen(struct ice_hw *hw, u16 opcode, u16 scen_id,
  *
  * Update ACL scenario (indirect 0x0C1B)
  */
-enum ice_status
+int
 ice_aq_update_acl_scen(struct ice_hw *hw, u16 scen_id,
 		       struct ice_aqc_acl_scen *buf, struct ice_sq_cd *cd)
 {
@@ -583,7 +583,7 @@ ice_aq_update_acl_scen(struct ice_hw *hw, u16 scen_id,
  *
  * Query ACL scenario (indirect 0x0C23)
  */
-enum ice_status
+int
 ice_aq_query_acl_scen(struct ice_hw *hw, u16 scen_id,
 		      struct ice_aqc_acl_scen *buf, struct ice_sq_cd *cd)
 {
drivers/net/ice/base/ice_acl.h +25 -25

102 lines not on this page · raw message

drivers/net/ice/base/ice_acl_ctrl.c +18 -18
index 2223a8313b..4a902cbe7f 100644
@@ -74,7 +74,7 @@ ice_acl_scen_assign_entry_idx(struct ice_acl_scen *scen,
  *
  * To mark an entry available in scenario
  */
-static enum ice_status
+static int
 ice_acl_scen_free_entry_idx(struct ice_acl_scen *scen, u16 idx)
 {
 	if (idx >= scen->num_entry)
@@ -141,11 +141,11 @@ static u16 ice_acl_tbl_calc_end_idx(u16 start, u16 num_entries, u16 width)
  *
  * Initialize the ACL table by invalidating TCAM entries and action pairs.
  */
-static enum ice_status ice_acl_init_tbl(struct ice_hw *hw)
+static int ice_acl_init_tbl(struct ice_hw *hw)
 {
 	struct ice_aqc_actpair act_buf;
 	struct ice_aqc_acl_data buf;
-	enum ice_status status = ICE_SUCCESS;
+	int status = ICE_SUCCESS;
 	struct ice_acl_tbl *tbl;
 	u8 tcam_idx, i;
 	u16 idx;
@@ -303,14 +303,14 @@ static void ice_acl_divide_act_mems_to_tcams(struct ice_acl_tbl *tbl)
  * values for the size of the table, but this will need to grow as more flow
  * entries are added by the user level.
  */
-enum ice_status
+int
 ice_acl_create_tbl(struct ice_hw *hw, struct ice_acl_tbl_params *params)
 {
 	u16 width, depth, first_e, last_e, i;
 	struct ice_aqc_acl_generic *resp_buf;
 	struct ice_acl_alloc_tbl tbl_alloc;
 	struct ice_acl_tbl *tbl;
-	enum ice_status status;
+	int status;
 
 	if (hw->acl_tbl)
 		return ICE_ERR_ALREADY_EXISTS;
@@ -423,7 +423,7 @@ ice_acl_create_tbl(struct ice_hw *hw, struct ice_acl_tbl_params *params)
  * @hw: pointer to the hardware structure
  * @req: info of partition being allocated
  */
-static enum ice_status
+static int
 ice_acl_alloc_partition(struct ice_hw *hw, struct ice_acl_scen *req)
 {
 	u16 start = 0, cnt = 0, off = 0;
@@ -737,14 +737,14 @@ ice_acl_commit_partition(struct ice_hw *hw, struct ice_acl_scen *scen,
  * @num_entries: number of entries to be allocated for the scenario
  * @scen_id: holds returned scenario ID if successful
  */
-enum ice_status
+int
 ice_acl_create_scen(struct ice_hw *hw, u16 match_width, u16 num_entries,
 		    u16 *scen_id)
 {
 	u8 cascade_cnt, first_tcam, last_tcam, i, k;
 	struct ice_aqc_acl_scen scen_buf;
 	struct ice_acl_scen *scen;
-	enum ice_status status;
+	int status;
 
 	if (!hw->acl_tbl)
 		return ICE_ERR_DOES_NOT_EXIST;
@@ -845,11 +845,11 @@ ice_acl_create_scen(struct ice_hw *hw, u16 match_width, u16 num_entries,
  * @hw: pointer to the HW struct
  * @scen_id: ID of the remove scenario
  */
-static enum ice_status ice_acl_destroy_scen(struct ice_hw *hw, u16 scen_id)
+static int ice_acl_destroy_scen(struct ice_hw *hw, u16 scen_id)
 {
 	struct ice_acl_scen *scen, *tmp_scen;
 	struct ice_flow_prof *p, *tmp;
-	enum ice_status status;
+	int status;
 
 	if (!hw->acl_tbl)
 		return ICE_ERR_DOES_NOT_EXIST;
@@ -889,12 +889,12 @@ static enum ice_status ice_acl_destroy_scen(struct ice_hw *hw, u16 scen_id)
  * ice_acl_destroy_tbl - Destroy a previously created LEM table for ACL
  * @hw: pointer to the HW struct
  */
-enum ice_status ice_acl_destroy_tbl(struct ice_hw *hw)
+int ice_acl_destroy_tbl(struct ice_hw *hw)
 {
 	struct ice_acl_scen *pos_scen, *tmp_scen;
 	struct ice_aqc_acl_generic resp_buf;
 	struct ice_aqc_acl_scen buf;
-	enum ice_status status;
+	int status;
 	u8 i;
 
 	if (!hw->acl_tbl)
@@ -966,7 +966,7 @@ enum ice_status ice_acl_destroy_tbl(struct ice_hw *hw)
  * The "keys" and "inverts" buffers must be of the size which is the same as
  * the scenario's width
  */
-enum ice_status
+int
 ice_acl_add_entry(struct ice_hw *hw, struct ice_acl_scen *scen,
 		  enum ice_acl_entry_prio prio, u8 *keys, u8 *inverts,
 		  struct ice_acl_act_entry *acts, u8 acts_cnt, u16 *entry_idx)
@@ -974,7 +974,7 @@ ice_acl_add_entry(struct ice_hw *hw, struct ice_acl_scen *scen,
 	struct ice_aqc_acl_data buf;
 	u8 entry_tcam, offset;
 	u16 i, num_cscd, idx;
-	enum ice_status status = ICE_SUCCESS;
+	int status = ICE_SUCCESS;
 
 	if (!scen)
 		return ICE_ERR_DOES_NOT_EXIST;
@@ -1043,14 +1043,14 @@ ice_acl_add_entry(struct ice_hw *hw, struct ice_acl_scen *scen,
  *
  * Program a scenario's action memory
  */
-enum ice_status
+int
 ice_acl_prog_act(struct ice_hw *hw, struct ice_acl_scen *scen,
 		 struct ice_acl_act_entry *acts, u8 acts_cnt,
 		 u16 entry_idx)
 {
 	u16 idx, entry_tcam, num_cscd, i, actx_idx = 0;
 	struct ice_aqc_actpair act_buf;
-	enum ice_status status = ICE_SUCCESS;
+	int status = ICE_SUCCESS;
 
 	if (entry_idx >= scen->num_entry)
 		return ICE_ERR_MAX_LIMIT;
@@ -1105,12 +1105,12 @@ ice_acl_prog_act(struct ice_hw *hw, struct ice_acl_scen *scen,
  * @scen: scenario to remove the entry from
  * @entry_idx: the scenario-relative index of the flow entry being removed
  */
-enum ice_status
+int
 ice_acl_rem_entry(struct ice_hw *hw, struct ice_acl_scen *scen, u16 entry_idx)
 {
 	struct ice_aqc_actpair act_buf;
 	struct ice_aqc_acl_data buf;
-	enum ice_status status = ICE_SUCCESS;
+	int status = ICE_SUCCESS;
 	u16 num_cscd, idx, i;
 	u8 entry_tcam;
 
drivers/net/ice/base/ice_common.c +133 -134

1,020 lines not on this page · raw message

drivers/net/ice/base/ice_common.h +74 -76

328 lines not on this page · raw message

drivers/net/ice/base/ice_controlq.c +29 -29

195 lines not on this page · raw message

drivers/net/ice/base/ice_dcb.c +30 -30

211 lines not on this page · raw message

drivers/net/ice/base/ice_dcb.h +16 -16
index bae033a460..c2c48ae8bb 100644
@@ -188,48 +188,48 @@ struct ice_dcbx_variables {
 	u32 deftsaassignment;
 };
 
-enum ice_status
+int
 ice_aq_get_lldp_mib(struct ice_hw *hw, u8 bridge_type, u8 mib_type, void *buf,
 		    u16 buf_size, u16 *local_len, u16 *remote_len,
 		    struct ice_sq_cd *cd);
-enum ice_status
+int
 ice_aq_get_cee_dcb_cfg(struct ice_hw *hw,
 		       struct ice_aqc_get_cee_dcb_cfg_resp *buff,
 		       struct ice_sq_cd *cd);
-enum ice_status
+int
 ice_aq_set_pfc_mode(struct ice_hw *hw, u8 pfc_mode, struct ice_sq_cd *cd);
-enum ice_status ice_lldp_to_dcb_cfg(u8 *lldpmib, struct ice_dcbx_cfg *dcbcfg);
+int ice_lldp_to_dcb_cfg(u8 *lldpmib, struct ice_dcbx_cfg *dcbcfg);
 u8 ice_get_dcbx_status(struct ice_hw *hw);
-enum ice_status
+int
 ice_aq_get_dcb_cfg(struct ice_hw *hw, u8 mib_type, u8 bridgetype,
 		   struct ice_dcbx_cfg *dcbcfg);
-enum ice_status ice_get_dcb_cfg(struct ice_port_info *pi);
-enum ice_status ice_set_dcb_cfg(struct ice_port_info *pi);
+int ice_get_dcb_cfg(struct ice_port_info *pi);
+int ice_set_dcb_cfg(struct ice_port_info *pi);
 void ice_get_dcb_cfg_from_mib_change(struct ice_port_info *pi,
 				     struct ice_rq_event_info *event);
-enum ice_status ice_init_dcb(struct ice_hw *hw, bool enable_mib_change);
+int ice_init_dcb(struct ice_hw *hw, bool enable_mib_change);
 void ice_dcb_cfg_to_lldp(u8 *lldpmib, u16 *miblen, struct ice_dcbx_cfg *dcbcfg);
-enum ice_status
+int
 ice_query_port_ets(struct ice_port_info *pi,
 		   struct ice_aqc_port_ets_elem *buf, u16 buf_size,
 		   struct ice_sq_cd *cmd_details);
-enum ice_status
+int
 ice_aq_query_port_ets(struct ice_port_info *pi,
 		      struct ice_aqc_port_ets_elem *buf, u16 buf_size,
 		      struct ice_sq_cd *cd);
-enum ice_status
+int
 ice_update_port_tc_tree_cfg(struct ice_port_info *pi,
 			    struct ice_aqc_port_ets_elem *buf);
-enum ice_status
+int
 ice_aq_stop_lldp(struct ice_hw *hw, bool shutdown_lldp_agent, bool persist,
 		 struct ice_sq_cd *cd);
-enum ice_status
+int
 ice_aq_start_lldp(struct ice_hw *hw, bool persist, struct ice_sq_cd *cd);
-enum ice_status
+int
 ice_aq_start_stop_dcbx(struct ice_hw *hw, bool start_dcbx_agent,
 		       bool *dcbx_agent_status, struct ice_sq_cd *cd);
-enum ice_status ice_cfg_lldp_mib_change(struct ice_hw *hw, bool ena_mib);
-enum ice_status
+int ice_cfg_lldp_mib_change(struct ice_hw *hw, bool ena_mib);
+int
 ice_aq_cfg_lldp_mib_change(struct ice_hw *hw, bool ena_update,
 			   struct ice_sq_cd *cd);
 #endif /* _ICE_DCB_H_ */
drivers/net/ice/base/ice_ddp.c +24 -24

182 lines not on this page · raw message

drivers/net/ice/base/ice_ddp.h +7 -7
index 1e02adf0db..9aa5f03559 100644
@@ -405,23 +405,23 @@ struct ice_marker_ptype_tcam_section {
 
 struct ice_hw;
 
-enum ice_status
+int
 ice_acquire_change_lock(struct ice_hw *hw, enum ice_aq_res_access_type access);
 void ice_release_change_lock(struct ice_hw *hw);
 
 struct ice_buf_build *ice_pkg_buf_alloc(struct ice_hw *hw);
 void *
 ice_pkg_buf_alloc_section(struct ice_buf_build *bld, u32 type, u16 size);
-enum ice_status
+int
 ice_pkg_buf_reserve_section(struct ice_buf_build *bld, u16 count);
-enum ice_status
+int
 ice_get_sw_fv_list(struct ice_hw *hw, struct ice_prot_lkup_ext *lkups,
 		   ice_bitmap_t *bm, struct LIST_HEAD_TYPE *fv_list);
 u16 ice_pkg_buf_get_active_sections(struct ice_buf_build *bld);
 
-enum ice_status
+int
 ice_update_pkg(struct ice_hw *hw, struct ice_buf *bufs, u32 count);
-enum ice_status
+int
 ice_update_pkg_no_lock(struct ice_hw *hw, struct ice_buf *bufs, u32 count);
 void ice_release_global_cfg_lock(struct ice_hw *hw);
 struct ice_generic_seg_hdr *
@@ -433,7 +433,7 @@ enum ice_ddp_state
 ice_get_pkg_info(struct ice_hw *hw);
 void ice_init_pkg_hints(struct ice_hw *hw, struct ice_seg *ice_seg);
 struct ice_buf_table *ice_find_buf_table(struct ice_seg *ice_seg);
-enum ice_status
+int
 ice_acquire_global_cfg_lock(struct ice_hw *hw,
 			    enum ice_aq_res_access_type access);
 
@@ -462,6 +462,6 @@ ice_pkg_buf_alloc_single_section(struct ice_hw *hw, u32 type, u16 size,
 struct ice_buf *ice_pkg_buf(struct ice_buf_build *bld);
 void ice_pkg_buf_free(struct ice_hw *hw, struct ice_buf_build *bld);
 
-enum ice_status ice_cfg_tx_topo(struct ice_hw *hw, u8 *buf, u32 len);
+int ice_cfg_tx_topo(struct ice_hw *hw, u8 *buf, u32 len);
 
 #endif /* _ICE_DDP_H_ */
drivers/net/ice/base/ice_fdir.c +10 -10
index c742c77ac6..9334933a2e 100644
@@ -3502,7 +3502,7 @@ ice_fdir_get_prgm_desc(struct ice_hw *hw, struct ice_fdir_fltr *input,
  * @hw: pointer to the hardware structure
  * @cntr_id: returns counter index
  */
-enum ice_status ice_alloc_fd_res_cntr(struct ice_hw *hw, u16 *cntr_id)
+int ice_alloc_fd_res_cntr(struct ice_hw *hw, u16 *cntr_id)
 {
 	return ice_alloc_res_cntr(hw, ICE_AQC_RES_TYPE_FDIR_COUNTER_BLOCK,
 				  ICE_AQC_RES_TYPE_FLAG_DEDICATED, 1, cntr_id);
@@ -3513,7 +3513,7 @@ enum ice_status ice_alloc_fd_res_cntr(struct ice_hw *hw, u16 *cntr_id)
  * @hw: pointer to the hardware structure
  * @cntr_id: counter index to be freed
  */
-enum ice_status ice_free_fd_res_cntr(struct ice_hw *hw, u16 cntr_id)
+int ice_free_fd_res_cntr(struct ice_hw *hw, u16 cntr_id)
 {
 	return ice_free_res_cntr(hw, ICE_AQC_RES_TYPE_FDIR_COUNTER_BLOCK,
 				 ICE_AQC_RES_TYPE_FLAG_DEDICATED, 1, cntr_id);
@@ -3525,7 +3525,7 @@ enum ice_status ice_free_fd_res_cntr(struct ice_hw *hw, u16 cntr_id)
  * @cntr_id: returns counter index
  * @num_fltr: number of filter entries to be allocated
  */
-enum ice_status
+int
 ice_alloc_fd_guar_item(struct ice_hw *hw, u16 *cntr_id, u16 num_fltr)
 {
 	return ice_alloc_res_cntr(hw, ICE_AQC_RES_TYPE_FDIR_GUARANTEED_ENTRIES,
@@ -3539,7 +3539,7 @@ ice_alloc_fd_guar_item(struct ice_hw *hw, u16 *cntr_id, u16 num_fltr)
  * @cntr_id: counter index that needs to be freed
  * @num_fltr: number of filters to be freed
  */
-enum ice_status
+int
 ice_free_fd_guar_item(struct ice_hw *hw, u16 cntr_id, u16 num_fltr)
 {
 	return ice_free_res_cntr(hw, ICE_AQC_RES_TYPE_FDIR_GUARANTEED_ENTRIES,
@@ -3553,7 +3553,7 @@ ice_free_fd_guar_item(struct ice_hw *hw, u16 cntr_id, u16 num_fltr)
  * @cntr_id: returns counter index
  * @num_fltr: number of filter entries to be allocated
  */
-enum ice_status
+int
 ice_alloc_fd_shrd_item(struct ice_hw *hw, u16 *cntr_id, u16 num_fltr)
 {
 	return ice_alloc_res_cntr(hw, ICE_AQC_RES_TYPE_FDIR_SHARED_ENTRIES,
@@ -3567,7 +3567,7 @@ ice_alloc_fd_shrd_item(struct ice_hw *hw, u16 *cntr_id, u16 num_fltr)
  * @cntr_id: counter index that needs to be freed
  * @num_fltr: number of filters to be freed
  */
-enum ice_status
+int
 ice_free_fd_shrd_item(struct ice_hw *hw, u16 cntr_id, u16 num_fltr)
 {
 	return ice_free_res_cntr(hw, ICE_AQC_RES_TYPE_FDIR_SHARED_ENTRIES,
@@ -3690,7 +3690,7 @@ static void ice_pkt_insert_mac_addr(u8 *pkt, u8 *addr)
  *
  * returns an open tunnel port specified for this flow type
  */
-static enum ice_status
+static int
 ice_fdir_get_open_tunnel_port(struct ice_hw *hw, enum ice_fltr_ptype flow,
 			      u16 *port)
 {
@@ -3822,7 +3822,7 @@ ice_fdir_gen_l2tpv2_pkt(u8 *pkt, struct ice_fdir_l2tpv2 *l2tpv2_data,
  * @frag: generate a fragment packet
  * @tun: true implies generate a tunnel packet
  */
-enum ice_status
+int
 ice_fdir_get_gen_prgm_pkt(struct ice_hw *hw, struct ice_fdir_fltr *input,
 			  u8 *pkt, bool frag, bool tun)
 {
@@ -4810,7 +4810,7 @@ ice_fdir_get_gen_prgm_pkt(struct ice_hw *hw, struct ice_fdir_fltr *input,
  * @pkt: pointer to return filter packet
  * @frag: generate a fragment packet
  */
-enum ice_status
+int
 ice_fdir_get_prgm_pkt(struct ice_fdir_fltr *input, u8 *pkt, bool frag)
 {
 	return ice_fdir_get_gen_prgm_pkt(NULL, input, pkt, frag, false);
@@ -4995,7 +4995,7 @@ bool ice_fdir_is_dup_fltr(struct ice_hw *hw, struct ice_fdir_fltr *input)
  *
  * Clears FD table entries for a PF by issuing admin command (direct, 0x0B06)
  */
-enum ice_status ice_clear_pf_fd_table(struct ice_hw *hw)
+int ice_clear_pf_fd_table(struct ice_hw *hw)
 {
 	struct ice_aqc_clear_fd_table *cmd;
 	struct ice_aq_desc desc;
drivers/net/ice/base/ice_fdir.h +9 -9
index 81ba6008e4..1bb8a14a5d 100644
@@ -318,24 +318,24 @@ ice_fdir_comp_rules_basic(struct ice_fdir_fltr *a,  struct ice_fdir_fltr *b);
 bool
 ice_fdir_comp_rules_extended(struct ice_fdir_fltr *a,  struct ice_fdir_fltr *b);
 
-enum ice_status ice_alloc_fd_res_cntr(struct ice_hw *hw, u16 *cntr_id);
-enum ice_status ice_free_fd_res_cntr(struct ice_hw *hw, u16 cntr_id);
-enum ice_status
+int ice_alloc_fd_res_cntr(struct ice_hw *hw, u16 *cntr_id);
+int ice_free_fd_res_cntr(struct ice_hw *hw, u16 cntr_id);
+int
 ice_alloc_fd_guar_item(struct ice_hw *hw, u16 *cntr_id, u16 num_fltr);
-enum ice_status
+int
 ice_free_fd_guar_item(struct ice_hw *hw, u16 cntr_id, u16 num_fltr);
-enum ice_status
+int
 ice_alloc_fd_shrd_item(struct ice_hw *hw, u16 *cntr_id, u16 num_fltr);
-enum ice_status
+int
 ice_free_fd_shrd_item(struct ice_hw *hw, u16 cntr_id, u16 num_fltr);
-enum ice_status ice_clear_pf_fd_table(struct ice_hw *hw);
+int ice_clear_pf_fd_table(struct ice_hw *hw);
 void
 ice_fdir_get_prgm_desc(struct ice_hw *hw, struct ice_fdir_fltr *input,
 		       struct ice_fltr_desc *fdesc, bool add);
-enum ice_status
+int
 ice_fdir_get_gen_prgm_pkt(struct ice_hw *hw, struct ice_fdir_fltr *input,
 			  u8 *pkt, bool frag, bool tun);
-enum ice_status
+int
 ice_fdir_get_prgm_pkt(struct ice_fdir_fltr *input, u8 *pkt, bool frag);
 int ice_get_fdir_cnt_all(struct ice_hw *hw);
 bool ice_fdir_is_dup_fltr(struct ice_hw *hw, struct ice_fdir_fltr *input);
drivers/net/ice/base/ice_flex_pipe.c +88 -88

386 lines not on this page · raw message

drivers/net/ice/base/ice_flex_pipe.h +15 -15
index 422d09becc..5e5d3a78f0 100644

Lines of this file are not shown. View the raw message.

drivers/net/ice/base/ice_flow.c +68 -68

136 lines not on this page · raw message

drivers/net/ice/base/ice_flow.h +14 -14
index 57e8e1f1df..4f9206db1f 100644

Lines of this file are not shown. View the raw message.

drivers/net/ice/base/ice_nvm.c +59 -60

119 lines not on this page · raw message

drivers/net/ice/base/ice_nvm.h +17 -16
index c3e61a301f..552e4659b7 100644

Lines of this file are not shown. View the raw message.

drivers/net/ice/base/ice_parser.c +8 -8
index 79c97f7903..05fb297d78 100644

Lines of this file are not shown. View the raw message.

drivers/net/ice/base/ice_parser.h +6 -6
index 0f64584898..f2a72cc44b 100644

Lines of this file are not shown. View the raw message.

drivers/net/ice/base/ice_parser_rt.c +2 -2
index 68c0f5d7fb..b10e10861c 100644

Lines of this file are not shown. View the raw message.

drivers/net/ice/base/ice_parser_rt.h +1 -1
index de851643b4..f95068d07d 100644

Lines of this file are not shown. View the raw message.

drivers/net/ice/base/ice_ptp_hw.c +206 -208

414 lines not on this page · raw message

drivers/net/ice/base/ice_ptp_hw.h +43 -43

86 lines not on this page · raw message

drivers/net/ice/base/ice_sched.c +187 -185

372 lines not on this page · raw message

drivers/net/ice/base/ice_sched.h +48 -48

96 lines not on this page · raw message

drivers/net/ice/base/ice_switch.c +163 -162

325 lines not on this page · raw message

drivers/net/ice/base/ice_switch.h +53 -53

106 lines not on this page · raw message

drivers/net/ice/base/ice_vlan_mode.c +14 -14
index 33759e4b8a..2e1e922d00 100644

Lines of this file are not shown. View the raw message.

drivers/net/ice/base/ice_vlan_mode.h +1 -1
index d2380eb94b..bcb591b308 100644

Lines of this file are not shown. View the raw message.

The rest of this diff is not shown. View the raw message.

Signature · 1 line
2.43.0

Part of the diff is not shown here. View the raw message.

#6 lore raw

PATCH v2 2/148 net/ice/base: replace ICE_SUCCESS with int

In reply to Anatoly Burakov

From: Ian Stokes <[email protected]>

Replace all usages of ICE_SUCCESS with its integer equivalent.

---
 drivers/net/ice/base/ice_acl.c       |   2 +-
 drivers/net/ice/base/ice_acl_ctrl.c  |  16 +--
 drivers/net/ice/base/ice_common.c    |  78 +++++++-------
 drivers/net/ice/base/ice_controlq.c  |  26 ++---
 drivers/net/ice/base/ice_dcb.c       |  22 ++--
 drivers/net/ice/base/ice_ddp.c       |  20 ++--
 drivers/net/ice/base/ice_fdir.c      |   4 +-
 drivers/net/ice/base/ice_flex_pipe.c | 108 +++++++++----------
 drivers/net/ice/base/ice_flow.c      |  64 +++++------
 drivers/net/ice/base/ice_nvm.c       |  54 +++++-----
 drivers/net/ice/base/ice_parser.c    |   8 +-
 drivers/net/ice/base/ice_parser_rt.c |   2 +-
 drivers/net/ice/base/ice_ptp_hw.c    | 152 +++++++++++++--------------
 drivers/net/ice/base/ice_sched.c     | 142 ++++++++++++-------------
 drivers/net/ice/base/ice_switch.c    | 127 +++++++++++-----------
 drivers/net/ice/base/ice_vlan_mode.c |  10 +-
 16 files changed, 418 insertions(+), 417 deletions(-)
drivers/net/ice/base/ice_acl.c +1 -1
index 34d031338f..6ace29c946 100644
@@ -332,7 +332,7 @@ ice_query_acl_prof(struct ice_hw *hw, u8 prof_id,
  */
 static int ice_aq_acl_cntrs_chk_params(struct ice_acl_cntrs *cntrs)
 {
-	enum ice_status status = ICE_SUCCESS;
+	int status = 0;
 
 	if (!cntrs || !cntrs->amount)
 		return ICE_ERR_PARAM;
drivers/net/ice/base/ice_acl_ctrl.c +8 -8
index 4a902cbe7f..6cee2c98ea 100644
@@ -83,7 +83,7 @@ ice_acl_scen_free_entry_idx(struct ice_acl_scen *scen, u16 idx)
 	if (!ice_test_and_clear_bit(idx, scen->entry_bitmap))
 		return ICE_ERR_DOES_NOT_EXIST;
 
-	return ICE_SUCCESS;
+	return 0;
 }
 
 /**
@@ -145,8 +145,8 @@ static int ice_acl_init_tbl(struct ice_hw *hw)
 {
 	struct ice_aqc_actpair act_buf;
 	struct ice_aqc_acl_data buf;
-	int status = ICE_SUCCESS;
 	struct ice_acl_tbl *tbl;
+	int status = 0;
 	u8 tcam_idx, i;
 	u16 idx;
 
@@ -547,7 +547,7 @@ ice_acl_alloc_partition(struct ice_hw *hw, struct ice_acl_scen *req)
 		}
 	} while (!done);
 
-	return cnt >= r_entries ? ICE_SUCCESS : ICE_ERR_MAX_LIMIT;
+	return cnt >= r_entries ? 0 : ICE_ERR_MAX_LIMIT;
 }
 
 /**
@@ -882,7 +882,7 @@ static int ice_acl_destroy_scen(struct ice_hw *hw, u16 scen_id)
 			ice_free(hw, scen);
 		}
 
-	return ICE_SUCCESS;
+	return 0;
 }
 
 /**
@@ -947,7 +947,7 @@ int ice_acl_destroy_tbl(struct ice_hw *hw)
 	ice_free(hw, hw->acl_tbl);
 	hw->acl_tbl = NULL;
 
-	return ICE_SUCCESS;
+	return 0;
 }
 
 /**
@@ -974,7 +974,7 @@ ice_acl_add_entry(struct ice_hw *hw, struct ice_acl_scen *scen,
 	struct ice_aqc_acl_data buf;
 	u8 entry_tcam, offset;
 	u16 i, num_cscd, idx;
-	int status = ICE_SUCCESS;
+	int status = 0;
 
 	if (!scen)
 		return ICE_ERR_DOES_NOT_EXIST;
@@ -1050,7 +1050,7 @@ ice_acl_prog_act(struct ice_hw *hw, struct ice_acl_scen *scen,
 {
 	u16 idx, entry_tcam, num_cscd, i, actx_idx = 0;
 	struct ice_aqc_actpair act_buf;
-	int status = ICE_SUCCESS;
+	int status = 0;
 
 	if (entry_idx >= scen->num_entry)
 		return ICE_ERR_MAX_LIMIT;
@@ -1110,8 +1110,8 @@ ice_acl_rem_entry(struct ice_hw *hw, struct ice_acl_scen *scen, u16 entry_idx)
 {
 	struct ice_aqc_actpair act_buf;
 	struct ice_aqc_acl_data buf;
-	int status = ICE_SUCCESS;
 	u16 num_cscd, idx, i;
+	int status = 0;
 	u8 entry_tcam;
 
 	if (!scen)
drivers/net/ice/base/ice_common.c +39 -39

312 lines not on this page · raw message

drivers/net/ice/base/ice_controlq.c +13 -13
index 8c02a5067f..db80fe8c1d 100644
@@ -108,7 +108,7 @@ ice_alloc_ctrlq_sq_ring(struct ice_hw *hw, struct ice_ctl_q_info *cq)
 		return ICE_ERR_NO_MEMORY;
 	}
 
-	return ICE_SUCCESS;
+	return 0;
 }
 
 /**
@@ -124,7 +124,7 @@ ice_alloc_ctrlq_rq_ring(struct ice_hw *hw, struct ice_ctl_q_info *cq)
 	cq->rq.desc_buf.va = ice_alloc_dma_mem(hw, &cq->rq.desc_buf, size);
 	if (!cq->rq.desc_buf.va)
 		return ICE_ERR_NO_MEMORY;
-	return ICE_SUCCESS;
+	return 0;
 }
 
 /**
@@ -190,7 +190,7 @@ ice_alloc_rq_bufs(struct ice_hw *hw, struct ice_ctl_q_info *cq)
 		desc->params.generic.param0 = 0;
 		desc->params.generic.param1 = 0;
 	}
-	return ICE_SUCCESS;
+	return 0;
 
 unwind_alloc_rq_bufs:
 	/* don't try to free the one that failed... */
@@ -230,7 +230,7 @@ ice_alloc_sq_bufs(struct ice_hw *hw, struct ice_ctl_q_info *cq)
 		if (!bi->va)
 			goto unwind_alloc_sq_bufs;
 	}
-	return ICE_SUCCESS;
+	return 0;
 
 unwind_alloc_sq_bufs:
 	/* don't try to free the one that failed... */
@@ -260,7 +260,7 @@ ice_cfg_cq_regs(struct ice_hw *hw, struct ice_ctl_q_ring *ring, u16 num_entries)
 	if (rd32(hw, ring->bal) != ICE_LO_DWORD(ring->desc_buf.pa))
 		return ICE_ERR_AQ_ERROR;
 
-	return ICE_SUCCESS;
+	return 0;
 }
 
 /**
@@ -295,7 +295,7 @@ ice_cfg_rq_regs(struct ice_hw *hw, struct ice_ctl_q_info *cq)
 	/* Update tail in the HW to post pre-allocated buffers */
 	wr32(hw, cq->rq.tail, (u32)(cq->num_rq_entries - 1));
 
-	return ICE_SUCCESS;
+	return 0;
 }
 
 #define ICE_FREE_CQ_BUFS(hw, qi, ring)					\
@@ -450,7 +450,7 @@ static int ice_init_rq(struct ice_hw *hw, struct ice_ctl_q_info *cq)
 static int
 ice_shutdown_sq(struct ice_hw *hw, struct ice_ctl_q_info *cq)
 {
-	int ret_code = ICE_SUCCESS;
+	int ret_code = 0;
 
 	ice_debug(hw, ICE_DBG_TRACE, "%s\n", __func__);
 
@@ -521,7 +521,7 @@ static bool ice_aq_ver_check(struct ice_hw *hw)
 static int
 ice_shutdown_rq(struct ice_hw *hw, struct ice_ctl_q_info *cq)
 {
-	int ret_code = ICE_SUCCESS;
+	int ret_code = 0;
 
 	ice_debug(hw, ICE_DBG_TRACE, "%s\n", __func__);
 
@@ -571,7 +571,7 @@ static int ice_init_check_adminq(struct ice_hw *hw)
 		goto init_ctrlq_free_rq;
 	}
 
-	return ICE_SUCCESS;
+	return 0;
 
 init_ctrlq_free_rq:
 	ice_shutdown_rq(hw, cq);
@@ -638,7 +638,7 @@ static int ice_init_ctrlq(struct ice_hw *hw, enum ice_ctl_q q_type)
 		goto init_ctrlq_free_sq;
 
 	/* success! */
-	return ICE_SUCCESS;
+	return 0;
 
 init_ctrlq_free_sq:
 	ice_shutdown_sq(hw, cq);
@@ -949,9 +949,9 @@ ice_sq_send_cmd_nolock(struct ice_hw *hw, struct ice_ctl_q_info *cq,
 	struct ice_dma_mem *dma_buf = NULL;
 	struct ice_aq_desc *desc_on_ring;
 	bool cmd_completed = false;
-	int status = ICE_SUCCESS;
 	struct ice_sq_cd *details;
 	u32 total_delay = 0;
+	int status = 0;
 	u16 retval = 0;
 	u32 val = 0;
 
@@ -1125,7 +1125,7 @@ ice_sq_send_cmd(struct ice_hw *hw, struct ice_ctl_q_info *cq,
 		struct ice_aq_desc *desc, void *buf, u16 buf_size,
 		struct ice_sq_cd *cd)
 {
-	int status = ICE_SUCCESS;
+	int status = 0;
 
 	/* if reset is in progress return a soft error */
 	if (hw->reset_ongoing)
@@ -1170,9 +1170,9 @@ ice_clean_rq_elem(struct ice_hw *hw, struct ice_ctl_q_info *cq,
 {
 	u16 ntc = cq->rq.next_to_clean;
 	enum ice_aq_err rq_last_status;
-	int ret_code = ICE_SUCCESS;
 	struct ice_aq_desc *desc;
 	struct ice_dma_mem *bi;
+	int ret_code = 0;
 	u16 desc_idx;
 	u16 datalen;
 	u16 flags;
drivers/net/ice/base/ice_dcb.c +11 -11
index dc401f7c00..4ef54613b1 100644
@@ -604,8 +604,8 @@ ice_parse_org_tlv(struct ice_lldp_org_tlv *tlv, struct ice_dcbx_cfg *dcbcfg)
 int ice_lldp_to_dcb_cfg(u8 *lldpmib, struct ice_dcbx_cfg *dcbcfg)
 {
 	struct ice_lldp_org_tlv *tlv;
-	int ret = ICE_SUCCESS;
 	u16 offset = 0;
+	int ret = 0;
 	u16 typelen;
 	u16 type;
 	u16 len;
@@ -655,8 +655,8 @@ int
 ice_aq_get_dcb_cfg(struct ice_hw *hw, u8 mib_type, u8 bridgetype,
 		   struct ice_dcbx_cfg *dcbcfg)
 {
-	int ret;
 	u8 *lldpmib;
+	int ret;
 
 	/* Allocate the LLDPDU */
 	lldpmib = (u8 *)ice_malloc(hw, ICE_LLDPDU_SIZE);
@@ -666,7 +666,7 @@ ice_aq_get_dcb_cfg(struct ice_hw *hw, u8 mib_type, u8 bridgetype,
 	ret = ice_aq_get_lldp_mib(hw, bridgetype, mib_type, (void *)lldpmib,
 				  ICE_LLDPDU_SIZE, NULL, NULL, NULL);
 
-	if (ret == ICE_SUCCESS)
+	if (!ret)
 		/* Parse LLDP MIB to get DCB configuration */
 		ret = ice_lldp_to_dcb_cfg(lldpmib, dcbcfg);
 
@@ -686,7 +686,7 @@ ice_aq_get_dcb_cfg(struct ice_hw *hw, u8 mib_type, u8 bridgetype,
  * @cd: pointer to command details structure or NULL
  *
  * Start/Stop the embedded dcbx Agent. In case that this wrapper function
- * returns ICE_SUCCESS, caller will need to check if FW returns back the same
+ * returns 0, caller will need to check if FW returns back the same
  * value as stated in dcbx_agent_status, and react accordingly. (0x0A09)
  */
 int
@@ -711,7 +711,7 @@ ice_aq_start_stop_dcbx(struct ice_hw *hw, bool start_dcbx_agent,
 
 	*dcbx_agent_status = false;
 
-	if (status == ICE_SUCCESS &&
+	if (!status &&
 	    cmd->command == ICE_AQC_START_STOP_AGENT_START_DCBX)
 		*dcbx_agent_status = true;
 
@@ -775,7 +775,7 @@ ice_aq_set_pfc_mode(struct ice_hw *hw, u8 pfc_mode, struct ice_sq_cd *cd)
 	if (cmd->pfc_mode != pfc_mode)
 		return ICE_ERR_NOT_SUPPORTED;
 
-	return ICE_SUCCESS;
+	return 0;
 }
 
 /**
@@ -934,7 +934,7 @@ ice_get_ieee_or_cee_dcb_cfg(struct ice_port_info *pi, u8 dcbx_mode)
 				 ICE_AQ_LLDP_BRID_TYPE_NEAREST_BRID, dcbx_cfg);
 	/* Don't treat ENOENT as an error for Remote MIBs */
 	if (pi->hw->adminq.sq_last_status == ICE_AQ_RC_ENOENT)
-		ret = ICE_SUCCESS;
+		ret = 0;
 
 out:
 	return ret;
@@ -956,7 +956,7 @@ int ice_get_dcb_cfg(struct ice_port_info *pi)
 		return ICE_ERR_PARAM;
 
 	ret = ice_aq_get_cee_dcb_cfg(pi->hw, &cee_cfg, NULL);
-	if (ret == ICE_SUCCESS) {
+	if (!ret) {
 		/* CEE mode */
 		ret = ice_get_ieee_or_cee_dcb_cfg(pi, ICE_DCBX_MODE_CEE);
 		ice_cee_to_dcb_cfg(&cee_cfg, pi);
@@ -1017,7 +1017,7 @@ void ice_get_dcb_cfg_from_mib_change(struct ice_port_info *pi,
 int ice_init_dcb(struct ice_hw *hw, bool enable_mib_change)
 {
 	struct ice_qos_cfg *qos_cfg = &hw->port_info->qos_cfg;
-	int ret = ICE_SUCCESS;
+	int ret = 0;
 
 	if (!hw->func_caps.common_cap.dcb)
 		return ICE_ERR_NOT_SUPPORTED;
@@ -1512,9 +1512,9 @@ int ice_set_dcb_cfg(struct ice_port_info *pi)
 {
 	u8 mib_type, *lldpmib = NULL;
 	struct ice_dcbx_cfg *dcbcfg;
-	int ret;
 	struct ice_hw *hw;
 	u16 miblen;
+	int ret;
 
 	if (!pi)
 		return ICE_ERR_PARAM;
@@ -1583,8 +1583,8 @@ ice_update_port_tc_tree_cfg(struct ice_port_info *pi,
 {
 	struct ice_sched_node *node, *tc_node;
 	struct ice_aqc_txsched_elem_data elem;
-	int status = ICE_SUCCESS;
 	u32 teid1, teid2;
+	int status = 0;
 	u8 i, j;
 
 	if (!pi)
drivers/net/ice/base/ice_ddp.c +10 -10
index 6b0af7f601..fcf6dc69e3 100644
@@ -231,7 +231,7 @@ ice_is_signing_seg_type_at_idx(struct ice_pkg_hdr *pkg_hdr, u32 idx,
 int
 ice_update_pkg_no_lock(struct ice_hw *hw, struct ice_buf *bufs, u32 count)
 {
-	int status = ICE_SUCCESS;
+	int status = 0;
 	u32 i;
 
 	for (i = 0; i < count; i++) {
@@ -1181,7 +1181,7 @@ static int ice_get_prof_index_max(struct ice_hw *hw)
 
 	hw->switch_info->max_used_prof_index = max_prof_index;
 
-	return ICE_SUCCESS;
+	return 0;
 }
 
 /**
@@ -1584,7 +1584,7 @@ ice_get_sw_fv_list(struct ice_hw *hw, struct ice_prot_lkup_ext *lkups,
 	u32 offset;
 
 	if (!lkups->n_val_words)
-		return ICE_SUCCESS;
+		return 0;
 
 	ice_memset(&state, 0, sizeof(state), ICE_NONDMA_MEM);
 
@@ -1634,7 +1634,7 @@ ice_get_sw_fv_list(struct ice_hw *hw, struct ice_prot_lkup_ext *lkups,
 		ice_warn(hw, "Required profiles not found in currently loaded DDP package");
 		return ICE_ERR_CFG;
 	}
-	return ICE_SUCCESS;
+	return 0;
 
 err:
 	LIST_FOR_EACH_ENTRY_SAFE(fvl, tmp, fv_list, ice_sw_fv_list_entry,
@@ -1738,7 +1738,7 @@ ice_pkg_buf_reserve_section(struct ice_buf_build *bld, u16 count)
 		FLEX_ARRAY_SIZE(buf, section_entry, count);
 	buf->data_end = CPU_TO_LE16(data_end);
 
-	return ICE_SUCCESS;
+	return 0;
 }
 
 /**
@@ -2148,7 +2148,7 @@ ice_find_boost_entry(struct ice_seg *ice_seg, u16 addr,
 					  ice_boost_tcam_handler);
 		if (tcam && LE16_TO_CPU(tcam->addr) == addr) {
 			*entry = tcam;
-			return ICE_SUCCESS;
+			return 0;
 		}
 
 		ice_seg = NULL;
@@ -2224,7 +2224,7 @@ void ice_init_pkg_hints(struct ice_hw *hw, struct ice_seg *ice_seg)
  * or writing of the package. When attempting to obtain write access, the
  * caller must check for the following two return values:
  *
- * ICE_SUCCESS        - Means the caller has acquired the global config lock
+ * 0                  - Means the caller has acquired the global config lock
  *                      and can perform writing of the package.
  * ICE_ERR_AQ_NO_WORK - Indicates another driver has already written the
  *                      package or has found that no update was necessary; in
@@ -2321,7 +2321,7 @@ ice_get_set_tx_topo(struct ice_hw *hw, u8 *buf, u16 buf_size,
 	if (!set && flags)
 		*flags = desc.params.get_set_tx_topo.set_flags;
 
-	return ICE_SUCCESS;
+	return 0;
 }
 
 /**
@@ -2463,7 +2463,7 @@ int ice_cfg_tx_topo(struct ice_hw *hw, u8 *buf, u32 len)
 		/* Reset is in progress, re-init the hw again */
 		ice_debug(hw, ICE_DBG_INIT, "Reset is in progress. layer topology might be applied already\n");
 		ice_check_reset(hw);
-		return ICE_SUCCESS;
+		return 0;
 	}
 
 	/* set new topology */
@@ -2480,5 +2480,5 @@ int ice_cfg_tx_topo(struct ice_hw *hw, u8 *buf, u32 len)
 	/* CORER will clear the global lock, so no explicit call
 	 * required for release
 	 */
-	return ICE_SUCCESS;
+	return 0;
 }
drivers/net/ice/base/ice_fdir.c +2 -2
index 9334933a2e..75fae4408f 100644
@@ -3706,7 +3706,7 @@ ice_fdir_get_open_tunnel_port(struct ice_hw *hw, enum ice_fltr_ptype flow,
 			return ICE_ERR_DOES_NOT_EXIST;
 	}
 
-	return ICE_SUCCESS;
+	return 0;
 }
 
 /**
@@ -4801,7 +4801,7 @@ ice_fdir_get_gen_prgm_pkt(struct ice_hw *hw, struct ice_fdir_fltr *input,
 	if (input->flex_fltr)
 		ice_pkt_insert_u16(loc, input->flex_offset, input->flex_word);
 
-	return ICE_SUCCESS;
+	return 0;
 }
 
 /**
drivers/net/ice/base/ice_flex_pipe.c +54 -54

453 lines not on this page · raw message

drivers/net/ice/base/ice_flow.c +32 -32

258 lines not on this page · raw message

drivers/net/ice/base/ice_nvm.c +27 -27

210 lines not on this page · raw message

drivers/net/ice/base/ice_parser.c +4 -4
index 05fb297d78..551e24a5f5 100644
@@ -270,7 +270,7 @@ int ice_parser_create(struct ice_hw *hw, struct ice_parser **psr)
 	}
 
 	*psr = p;
-	return ICE_SUCCESS;
+	return 0;
 err:
 	ice_parser_destroy(p);
 	return status;
@@ -389,7 +389,7 @@ _tunnel_port_set(struct ice_parser *psr, const char *prefix, u16 udp_port,
 			item->key[15] = (u8)(0xff - buf[0]);
 			item->key[16] = (u8)(0xff - buf[1]);
 
-			return ICE_SUCCESS;
+			return 0;
 		/* found a matched slot to delete */
 		} else if (!on && (item->key_inv[15] == buf[0] ||
 			   item->key_inv[16] == buf[1])) {
@@ -398,7 +398,7 @@ _tunnel_port_set(struct ice_parser *psr, const char *prefix, u16 udp_port,
 			item->key[15] = 0xff;
 			item->key[16] = 0xfe;
 
-			return ICE_SUCCESS;
+			return 0;
 		}
 		i++;
 	}
@@ -528,7 +528,7 @@ int ice_parser_profile_init(struct ice_parser_result *rslt,
 		prof->fv_num++;
 	}
 
-	return ICE_SUCCESS;
+	return 0;
 }
 
 /**
drivers/net/ice/base/ice_parser_rt.c +1 -1
index b10e10861c..69655fdd96 100644
@@ -773,12 +773,12 @@ static void _result_resolve(struct ice_parser_rt *rt,
 int ice_parser_rt_execute(struct ice_parser_rt *rt,
 				      struct ice_parser_result *rslt)
 {
-	int status = ICE_SUCCESS;
 	struct ice_pg_nm_cam_item *pg_nm_cam;
 	struct ice_parser *psr = rt->psr;
 	struct ice_pg_cam_item *pg_cam;
 	struct ice_bst_tcam_item *bst;
 	struct ice_imem_item *imem;
+	int status = 0;
 	u16 node;
 	u16 pc;
 
drivers/net/ice/base/ice_ptp_hw.c +76 -76

608 lines not on this page · raw message

drivers/net/ice/base/ice_sched.c +71 -71

579 lines not on this page · raw message

drivers/net/ice/base/ice_switch.c +64 -63

166 lines not on this page · raw message

drivers/net/ice/base/ice_vlan_mode.c +5 -5
index 2e1e922d00..85cb2686d9 100644

Lines of this file are not shown. View the raw message.

The rest of this diff is not shown. View the raw message.

Signature · 1 line
2.43.0

Part of the diff is not shown here. View the raw message.

#7 lore raw

PATCH v2 3/148 net/ice/base: update E830 headers

In reply to Anatoly Burakov

From: Ian Stokes <[email protected]>

Update E830 header file for use with simulation systems.

---
 drivers/net/ice/base/ice_hw_autogen.h | 78 +++++++++++++++++----------
 1 file changed, 49 insertions(+), 29 deletions(-)
drivers/net/ice/base/ice_hw_autogen.h +49 -29
index 4610cec6a7..c17fbd83a2 100644
@@ -429,9 +429,11 @@
 #define PF0INT_OICR_CPM_PAGE_QUEUE_S		1
 #define PF0INT_OICR_CPM_PAGE_QUEUE_M		BIT(1)
 #define PF0INT_OICR_CPM_PAGE_RSV1_S		2
-#define PF0INT_OICR_CPM_PAGE_RSV1_M		MAKEMASK(0xFF, 2)
-#define PF0INT_OICR_CPM_PAGE_HH_COMP_S		10
-#define PF0INT_OICR_CPM_PAGE_HH_COMP_M		BIT(10)
+#define PF0INT_OICR_CPM_PAGE_RSV1_M_BY_MAC(hw) ((hw)->mac_type == ICE_MAC_E830 ? E830_PF0INT_OICR_CPM_PAGE_RSV1_M : E800_PF0INT_OICR_CPM_PAGE_RSV1_M)
+#define E800_PF0INT_OICR_CPM_PAGE_RSV1_M	MAKEMASK(0xFF, 2)
+#define E830_PF0INT_OICR_CPM_PAGE_RSV1_M	MAKEMASK(0x3F, 2)
+#define E800_PF0INT_OICR_CPM_PAGE_HH_COMP_S	10
+#define E800_PF0INT_OICR_CPM_PAGE_HH_COMP_M	BIT(10)
 #define PF0INT_OICR_CPM_PAGE_TSYN_TX_S		11
 #define PF0INT_OICR_CPM_PAGE_TSYN_TX_M		BIT(11)
 #define PF0INT_OICR_CPM_PAGE_TSYN_EVNT_S	12
@@ -493,9 +495,11 @@
 #define PF0INT_OICR_HLP_PAGE_QUEUE_S		1
 #define PF0INT_OICR_HLP_PAGE_QUEUE_M		BIT(1)
 #define PF0INT_OICR_HLP_PAGE_RSV1_S		2
-#define PF0INT_OICR_HLP_PAGE_RSV1_M		MAKEMASK(0xFF, 2)
-#define PF0INT_OICR_HLP_PAGE_HH_COMP_S		10
-#define PF0INT_OICR_HLP_PAGE_HH_COMP_M		BIT(10)
+#define PF0INT_OICR_HLP_PAGE_RSV1_M_BY_MAC(hw) ((hw)->mac_type == ICE_MAC_E830 ? E830_PF0INT_OICR_HLP_PAGE_RSV1_M : E800_PF0INT_OICR_HLP_PAGE_RSV1_M)
+#define E800_PF0INT_OICR_HLP_PAGE_RSV1_M	MAKEMASK(0xFF, 2)
+#define E830_PF0INT_OICR_HLP_PAGE_RSV1_M	MAKEMASK(0x3F, 2)
+#define E800_PF0INT_OICR_HLP_PAGE_HH_COMP_S	10
+#define E800_PF0INT_OICR_HLP_PAGE_HH_COMP_M	BIT(10)
 #define PF0INT_OICR_HLP_PAGE_TSYN_TX_S		11
 #define PF0INT_OICR_HLP_PAGE_TSYN_TX_M		BIT(11)
 #define PF0INT_OICR_HLP_PAGE_TSYN_EVNT_S	12
@@ -542,9 +546,11 @@
 #define PF0INT_OICR_PSM_PAGE_QUEUE_S		1
 #define PF0INT_OICR_PSM_PAGE_QUEUE_M		BIT(1)
 #define PF0INT_OICR_PSM_PAGE_RSV1_S		2
-#define PF0INT_OICR_PSM_PAGE_RSV1_M		MAKEMASK(0xFF, 2)
-#define PF0INT_OICR_PSM_PAGE_HH_COMP_S		10
-#define PF0INT_OICR_PSM_PAGE_HH_COMP_M		BIT(10)
+#define PF0INT_OICR_PSM_PAGE_RSV1_M_BY_MAC(hw) ((hw)->mac_type == ICE_MAC_E830 ? E830_PF0INT_OICR_PSM_PAGE_RSV1_M : E800_PF0INT_OICR_PSM_PAGE_RSV1_M)
+#define E800_PF0INT_OICR_PSM_PAGE_RSV1_M	MAKEMASK(0xFF, 2)
+#define E830_PF0INT_OICR_PSM_PAGE_RSV1_M	MAKEMASK(0x3F, 2)
+#define E800_PF0INT_OICR_PSM_PAGE_HH_COMP_S	10
+#define E800_PF0INT_OICR_PSM_PAGE_HH_COMP_M	BIT(10)
 #define PF0INT_OICR_PSM_PAGE_TSYN_TX_S		11
 #define PF0INT_OICR_PSM_PAGE_TSYN_TX_M		BIT(11)
 #define PF0INT_OICR_PSM_PAGE_TSYN_EVNT_S	12
@@ -4397,11 +4403,11 @@
 #define GLTPB_100G_MAC_FC_THRESH_PORT0_FC_THRESH_M MAKEMASK(0xFFFF, 0)
 #define GLTPB_100G_MAC_FC_THRESH_PORT1_FC_THRESH_S 16
 #define GLTPB_100G_MAC_FC_THRESH_PORT1_FC_THRESH_M MAKEMASK(0xFFFF, 16)
-#define GLTPB_100G_RPB_FC_THRESH		0x0009963C /* Reset Source: CORER */
-#define GLTPB_100G_RPB_FC_THRESH_PORT0_FC_THRESH_S 0
-#define GLTPB_100G_RPB_FC_THRESH_PORT0_FC_THRESH_M MAKEMASK(0xFFFF, 0)
-#define GLTPB_100G_RPB_FC_THRESH_PORT1_FC_THRESH_S 16
-#define GLTPB_100G_RPB_FC_THRESH_PORT1_FC_THRESH_M MAKEMASK(0xFFFF, 16)
+#define E800_GLTPB_100G_RPB_FC_THRESH		0x0009963C /* Reset Source: CORER */
+#define E800_GLTPB_100G_RPB_FC_THRESH_PORT0_FC_THRESH_S 0
+#define E800_GLTPB_100G_RPB_FC_THRESH_PORT0_FC_THRESH_M MAKEMASK(0xFFFF, 0)
+#define E800_GLTPB_100G_RPB_FC_THRESH_PORT1_FC_THRESH_S 16
+#define E800_GLTPB_100G_RPB_FC_THRESH_PORT1_FC_THRESH_M MAKEMASK(0xFFFF, 16)
 #define GLTPB_PACING_10G			0x000994E4 /* Reset Source: CORER */
 #define GLTPB_PACING_10G_N_S			0
 #define GLTPB_PACING_10G_N_M			MAKEMASK(0xFF, 0)
@@ -4545,7 +4551,9 @@
 #define GLINT_TSYN_PFMSTR_PF_MASTER_M		MAKEMASK(0x7, 0)
 #define GLINT_TSYN_PHY				0x0016CC50 /* Reset Source: CORER */
 #define GLINT_TSYN_PHY_PHY_INDX_S		0
-#define GLINT_TSYN_PHY_PHY_INDX_M		MAKEMASK(0x1F, 0)
+#define GLINT_TSYN_PHY_PHY_INDX_M_BY_MAC(hw) ((hw)->mac_type == ICE_MAC_E830 ? E830_GLINT_TSYN_PHY_PHY_INDX_M : E800_GLINT_TSYN_PHY_PHY_INDX_M)
+#define E800_GLINT_TSYN_PHY_PHY_INDX_M		MAKEMASK(0x1F, 0)
+#define E830_GLINT_TSYN_PHY_PHY_INDX_M		MAKEMASK(0xFF, 0)
 #define GLINT_VECT2FUNC(_INT)			(0x00162000 + ((_INT) * 4)) /* _i=0...2047 */ /* Reset Source: CORER */
 #define GLINT_VECT2FUNC_MAX_INDEX		2047
 #define GLINT_VECT2FUNC_VF_NUM_S		0
@@ -4605,9 +4613,11 @@
 #define PF0INT_OICR_CPM_QUEUE_S			1
 #define PF0INT_OICR_CPM_QUEUE_M			BIT(1)
 #define PF0INT_OICR_CPM_RSV1_S			2
-#define PF0INT_OICR_CPM_RSV1_M			MAKEMASK(0xFF, 2)
-#define PF0INT_OICR_CPM_HH_COMP_S		10
-#define PF0INT_OICR_CPM_HH_COMP_M		BIT(10)
+#define PF0INT_OICR_CPM_RSV1_M_BY_MAC(hw) ((hw)->mac_type == ICE_MAC_E830 ? E830_PF0INT_OICR_CPM_RSV1_M : E800_PF0INT_OICR_CPM_RSV1_M)
+#define E800_PF0INT_OICR_CPM_RSV1_M		MAKEMASK(0xFF, 2)
+#define E830_PF0INT_OICR_CPM_RSV1_M		MAKEMASK(0x3F, 2)
+#define E800_PF0INT_OICR_CPM_HH_COMP_S		10
+#define E800_PF0INT_OICR_CPM_HH_COMP_M		BIT(10)
 #define PF0INT_OICR_CPM_TSYN_TX_S		11
 #define PF0INT_OICR_CPM_TSYN_TX_M		BIT(11)
 #define PF0INT_OICR_CPM_TSYN_EVNT_S		12
@@ -4696,9 +4706,11 @@
 #define PF0INT_OICR_HLP_QUEUE_S			1
 #define PF0INT_OICR_HLP_QUEUE_M			BIT(1)
 #define PF0INT_OICR_HLP_RSV1_S			2
-#define PF0INT_OICR_HLP_RSV1_M			MAKEMASK(0xFF, 2)
-#define PF0INT_OICR_HLP_HH_COMP_S		10
-#define PF0INT_OICR_HLP_HH_COMP_M		BIT(10)
+#define PF0INT_OICR_HLP_RSV1_M_BY_MAC(hw) ((hw)->mac_type == ICE_MAC_E830 ? E830_PF0INT_OICR_HLP_RSV1_M : E800_PF0INT_OICR_HLP_RSV1_M)
+#define E800_PF0INT_OICR_HLP_RSV1_M		MAKEMASK(0xFF, 2)
+#define E830_PF0INT_OICR_HLP_RSV1_M		MAKEMASK(0x3F, 2)
+#define E800_PF0INT_OICR_HLP_HH_COMP_S		10
+#define E800_PF0INT_OICR_HLP_HH_COMP_M		BIT(10)
 #define PF0INT_OICR_HLP_TSYN_TX_S		11
 #define PF0INT_OICR_HLP_TSYN_TX_M		BIT(11)
 #define PF0INT_OICR_HLP_TSYN_EVNT_S		12
@@ -4745,9 +4757,11 @@
 #define PF0INT_OICR_PSM_QUEUE_S			1
 #define PF0INT_OICR_PSM_QUEUE_M			BIT(1)
 #define PF0INT_OICR_PSM_RSV1_S			2
-#define PF0INT_OICR_PSM_RSV1_M			MAKEMASK(0xFF, 2)
-#define PF0INT_OICR_PSM_HH_COMP_S		10
-#define PF0INT_OICR_PSM_HH_COMP_M		BIT(10)
+#define PF0INT_OICR_PSM_RSV1_M_BY_MAC(hw) ((hw)->mac_type == ICE_MAC_E830 ? E830_PF0INT_OICR_PSM_RSV1_M : E800_PF0INT_OICR_PSM_RSV1_M)
+#define E800_PF0INT_OICR_PSM_RSV1_M		MAKEMASK(0xFF, 2)
+#define E830_PF0INT_OICR_PSM_RSV1_M		MAKEMASK(0x3F, 2)
+#define E800_PF0INT_OICR_PSM_HH_COMP_S		10
+#define E800_PF0INT_OICR_PSM_HH_COMP_M		BIT(10)
 #define PF0INT_OICR_PSM_TSYN_TX_S		11
 #define PF0INT_OICR_PSM_TSYN_TX_M		BIT(11)
 #define PF0INT_OICR_PSM_TSYN_EVNT_S		12
@@ -4868,9 +4882,11 @@
 #define PFINT_OICR_QUEUE_S			1
 #define PFINT_OICR_QUEUE_M			BIT(1)
 #define PFINT_OICR_RSV1_S			2
-#define PFINT_OICR_RSV1_M			MAKEMASK(0xFF, 2)
-#define PFINT_OICR_HH_COMP_S			10
-#define PFINT_OICR_HH_COMP_M			BIT(10)
+#define PFINT_OICR_RSV1_M_BY_MAC(hw) ((hw)->mac_type == ICE_MAC_E830 ? E830_PFINT_OICR_RSV1_M : E800_PFINT_OICR_RSV1_M)
+#define E800_PFINT_OICR_RSV1_M			MAKEMASK(0xFF, 2)
+#define E830_PFINT_OICR_RSV1_M			MAKEMASK(0x3F, 2)
+#define E800_PFINT_OICR_HH_COMP_S		10
+#define E800_PFINT_OICR_HH_COMP_M		BIT(10)
 #define PFINT_OICR_TSYN_TX_S			11
 #define PFINT_OICR_TSYN_TX_M			BIT(11)
 #define PFINT_OICR_TSYN_EVNT_S			12
@@ -4936,7 +4952,9 @@
 #define PFINT_SB_CTL_INTEVENT_M			BIT(31)
 #define PFINT_TSYN_MSK				0x0016C980 /* Reset Source: CORER */
 #define PFINT_TSYN_MSK_PHY_INDX_S		0
-#define PFINT_TSYN_MSK_PHY_INDX_M		MAKEMASK(0x1F, 0)
+#define PFINT_TSYN_MSK_PHY_INDX_M_BY_MAC(hw) ((hw)->mac_type == ICE_MAC_E830 ? E830_PFINT_TSYN_MSK_PHY_INDX_M : E800_PFINT_TSYN_MSK_PHY_INDX_M)
+#define E800_PFINT_TSYN_MSK_PHY_INDX_M		MAKEMASK(0x1F, 0)
+#define E830_PFINT_TSYN_MSK_PHY_INDX_M		MAKEMASK(0xFF, 0)
 #define QINT_RQCTL(_QRX)			(0x00150000 + ((_QRX) * 4)) /* _i=0...2047 */ /* Reset Source: CORER */
 #define QINT_RQCTL_MAX_INDEX			2047
 #define QINT_RQCTL_MSIX_INDX_S			0
@@ -5443,7 +5461,9 @@
 #define GL_FWRESETCNT				0x00083100 /* Reset Source: POR */
 #define GL_FWRESETCNT_FWRESETCNT_S		0
 #define GL_FWRESETCNT_FWRESETCNT_M		MAKEMASK(0xFFFFFFFF, 0)
-#define GL_MNG_FW_RAM_STAT			0x0008309C /* Reset Source: POR */
+#define GL_MNG_FW_RAM_STAT_BY_MAC(hw) ((hw)->mac_type == ICE_MAC_E830 ? E830_GL_MNG_FW_RAM_STAT : E800_GL_MNG_FW_RAM_STAT)
+#define E800_GL_MNG_FW_RAM_STAT			0x0008309C /* Reset Source: POR */
+#define E830_GL_MNG_FW_RAM_STAT			0x000830F4 /* Reset Source: POR */
 #define GL_MNG_FW_RAM_STAT_FW_RAM_RST_STAT_S	0
 #define GL_MNG_FW_RAM_STAT_FW_RAM_RST_STAT_M	BIT(0)
 #define GL_MNG_FW_RAM_STAT_MNG_MEM_ECC_ERR_S	1
Signature · 1 line
2.43.0
#8 lore raw

PATCH v2 4/148 net/ice/base: update phy config during link restart

In reply to Anatoly Burakov

From: Ian Stokes <[email protected]>

Update en_link in curr_user_phy_cfg.caps on successful execution of set_link_restart_an operation.

---
 drivers/net/ice/base/ice_common.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)
drivers/net/ice/base/ice_common.c +11 -1
index 2eb3084dac..1d666b7708 100644
@@ -3966,6 +3966,7 @@ int
 ice_aq_set_link_restart_an(struct ice_port_info *pi, bool ena_link,
 			   struct ice_sq_cd *cd)
 {
+	enum ice_status status = ICE_ERR_AQ_ERROR;
 	struct ice_aqc_restart_an *cmd;
 	struct ice_aq_desc desc;
 
@@ -3980,7 +3981,16 @@ ice_aq_set_link_restart_an(struct ice_port_info *pi, bool ena_link,
 	else
 		cmd->cmd_flags &= ~ICE_AQC_RESTART_AN_LINK_ENABLE;
 
-	return ice_aq_send_cmd(pi->hw, &desc, NULL, 0, cd);
+	status = ice_aq_send_cmd(pi->hw, &desc, NULL, 0, cd);
+	if (status)
+		return status;
+
+	if (ena_link)
+		pi->phy.curr_user_phy_cfg.caps |= ICE_AQC_PHY_EN_LINK;
+	else
+		pi->phy.curr_user_phy_cfg.caps &= ~ICE_AQC_PHY_EN_LINK;
+
+	return ICE_SUCCESS;
 }
 
 /**
Signature · 1 line
2.43.0
#9 lore raw

Re: [PATCH v2 004/148] net/ice/base: update phy config during link restart

Quoted 16 lines · Anatoly Burakov

From: Ian Stokes <[email protected]>

Update en_link in curr_user_phy_cfg.caps on successful execution of set_link_restart_an operation.

---
 drivers/net/ice/base/ice_common.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)
drivers/net/ice/base/ice_common.c +0 -0
index 2eb3084dac..1d666b7708 100644

drivers/net/ice/base/ice_common.c int · line 3969

Quoted 4 lines
drivers/net/ice/base/ice_common.c +1 -0
@@ -3966,6 +3966,7 @@ int
 ice_aq_set_link_restart_an(struct ice_port_info *pi, bool ena_link,
 			   struct ice_sq_cd *cd)
 {
+	enum ice_status status = ICE_ERR_AQ_ERROR;

Here is the first re-introduction of ice_status, AFAIK. Is it feasible to avoid re-introducing and then later re-doing the conversion of it to int?

Quoted 24 lines
drivers/net/ice/base/ice_common.c +10 -1
 	struct ice_aqc_restart_an *cmd;
 	struct ice_aq_desc desc;
 
@@ -3980,7 +3981,16 @@ ice_aq_set_link_restart_an(struct ice_port_info *pi, bool ena_link,
 	else
 		cmd->cmd_flags &= ~ICE_AQC_RESTART_AN_LINK_ENABLE;
 
-	return ice_aq_send_cmd(pi->hw, &desc, NULL, 0, cd);
+	status = ice_aq_send_cmd(pi->hw, &desc, NULL, 0, cd);
+	if (status)
+		return status;
+
+	if (ena_link)
+		pi->phy.curr_user_phy_cfg.caps |= ICE_AQC_PHY_EN_LINK;
+	else
+		pi->phy.curr_user_phy_cfg.caps &= ~ICE_AQC_PHY_EN_LINK;
+
+	return ICE_SUCCESS;
 }
 
 /**
Signature · 1 line
2.43.0
#10 lore raw

PATCH v2 5/148 net/ice/base: fix for pointer to variable outside scope

In reply to Anatoly Burakov

From: Ian Stokes <[email protected]>

Currently, the 'temp' variable is in the same scope as 'first_teid_ptr' and we take point to it, which means on new loop iterations the memory goes out of scope and we keep a dangling pointer. Move 'temp' to outside of the loop to fix it.

---
 drivers/net/ice/base/ice_sched.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ice/base/ice_sched.c +1 -1
index d694bfd414..c9d70fb043 100644
@@ -1069,11 +1069,11 @@ ice_sched_add_nodes_to_layer(struct ice_port_info *pi,
 	u32 *first_teid_ptr = first_node_teid;
 	u16 new_num_nodes = num_nodes;
 	int status = 0;
+	u32 temp;
 
 	*num_nodes_added = 0;
 	while (*num_nodes_added < num_nodes) {
 		u16 max_child_nodes, num_added = 0;
-		u32 temp;
 
 		status = ice_sched_add_nodes_to_hw_layer(pi, tc_node, parent,
 							 layer,	new_num_nodes,
Signature · 1 line
2.43.0
#11 lore raw

PATCH v2 6/148 net/ice/base: add missing include for flow

In reply to Anatoly Burakov

From: Ian Stokes <[email protected]>

When building with certain targets, a missing include was causing a compilation failure. Add the missing include.

---
 drivers/net/ice/base/ice_flow.h | 1 +
 1 file changed, 1 insertion(+)
drivers/net/ice/base/ice_flow.h +1 -0
index 4f9206db1f..7811c38e15 100644
@@ -7,6 +7,7 @@
 
 #include "ice_flex_type.h"
 #include "ice_acl.h"
+#include "ice_parser.h"
 
 #define ICE_IPV4_MAKE_PREFIX_MASK(prefix) ((u32)(~0) << (32 - (prefix)))
 #define ICE_FLOW_PROF_ID_INVAL		0xfffffffffffffffful
Signature · 1 line
2.43.0
#12 lore raw

PATCH v2 7/148 net/ice/base: add ability to set markid via switch filter

In reply to Anatoly Burakov

From: Ian Stokes <[email protected]>

Support to add large action to set 32 bits markid via switch filter.

---
 drivers/net/ice/base/ice_switch.c | 22 ++++++++++++----------
 drivers/net/ice/base/ice_switch.h | 24 ++++++++++++------------
 2 files changed, 24 insertions(+), 22 deletions(-)
drivers/net/ice/base/ice_switch.c +12 -10
index 8d32c96fe3..0c13b12faa 100644
@@ -9333,9 +9333,10 @@ ice_add_adv_rule(struct ice_hw *hw, struct ice_adv_lkup_elem *lkups,
 		 struct ice_rule_query_data *added_entry)
 {
 	struct ice_adv_fltr_mgmt_list_entry *m_entry, *adv_fltr = NULL;
-	u16 lg_act_size, lg_act_id = ICE_INVAL_LG_ACT_INDEX;
+	u16 lg_act_sz, lg_act_id = ICE_INVAL_LG_ACT_INDEX;
 	u16 rid = 0, i, pkt_len, rule_buf_sz, vsi_handle;
 	const struct ice_dummy_pkt_offsets *pkt_offsets;
+	struct ice_aqc_sw_rules_elem *lg_rule = NULL;
 	struct ice_aqc_sw_rules_elem *s_rule = NULL;
 	struct ice_aqc_sw_rules_elem *rx_tx;
 	struct LIST_HEAD_TYPE *rule_head;
@@ -9457,7 +9458,7 @@ ice_add_adv_rule(struct ice_hw *hw, struct ice_adv_lkup_elem *lkups,
 		       ICE_SINGLE_ACT_Q_REGION_M;
 		break;
 	case ICE_SET_MARK:
-		if (rinfo->sw_act.markid != (rinfo->sw_act.markid & 0xFFFF))
+		if (rinfo->sw_act.markid > 0xFFFF)
 			nb_lg_acts_mark += 1;
 		/* Allocate a hardware table entry to hold large act. */
 		status = ice_alloc_res_lg_act(hw, &lg_act_id, nb_lg_acts_mark);
@@ -9521,18 +9522,19 @@ ice_add_adv_rule(struct ice_hw *hw, struct ice_adv_lkup_elem *lkups,
 
 	rx_tx = s_rule;
 	if (rinfo->sw_act.fltr_act == ICE_SET_MARK) {
-		lg_act_size = (u16)ICE_SW_RULE_LG_ACT_SIZE(nb_lg_acts_mark);
-		s_rule = ice_fill_sw_marker_lg_act(hw, rinfo->sw_act.markid,
-						   lg_act_id, rule_buf_sz,
-						   lg_act_size, nb_lg_acts_mark,
-						   s_rule);
-		if (!s_rule)
+		lg_act_sz = (u16)ICE_SW_RULE_LG_ACT_SIZE(nb_lg_acts_mark);
+		lg_rule = ice_fill_sw_marker_lg_act(hw, rinfo->sw_act.markid,
+						    lg_act_id, rule_buf_sz,
+						    lg_act_sz, nb_lg_acts_mark,
+						    s_rule);
+		if (!lg_rule)
 			goto err_ice_add_adv_rule;
 
-		rule_buf_sz += lg_act_size;
+		s_rule = lg_rule;
+		rule_buf_sz += lg_act_sz;
 		num_rules += 1;
 		rx_tx = (struct ice_aqc_sw_rules_elem *)
-			((u8 *)s_rule + lg_act_size);
+			((u8 *)s_rule + lg_act_sz);
 	}
 
 	status = ice_aq_sw_rules(hw, (struct ice_aqc_sw_rules *)s_rule,
drivers/net/ice/base/ice_switch.h +12 -12
index e3ba837467..0cf86ec965 100644
@@ -219,19 +219,19 @@ struct ice_adv_lkup_elem {
 	union ice_prot_hdr m_u;	/* Mask of header values to match */
 };
 
-struct lg_entry_vsi_fwd {
+struct entry_vsi_fwd {
 	u16 vsi_list;
 	u8 list;
 	u8 valid;
 };
 
-struct lg_entry_to_q {
+struct entry_to_q {
 	u16 q_idx;
 	u8 q_region_sz;
 	u8 q_pri;
 };
 
-struct lg_entry_prune {
+struct entry_prune {
 	u16 vsi_list;
 	u8 list;
 	u8 egr;
@@ -239,27 +239,27 @@ struct lg_entry_prune {
 	u8 prune_t;
 };
 
-struct lg_entry_mirror {
+struct entry_mirror {
 	u16 mirror_vsi;
 };
 
-struct lg_entry_generic_act {
+struct entry_generic_act {
 	u16 generic_value;
 	u8 offset;
 	u8 priority;
 };
 
-struct lg_entry_statistics {
+struct entry_statistics {
 	u8 counter_idx;
 };
 
 union lg_act_entry {
-	struct lg_entry_vsi_fwd vsi_fwd;
-	struct lg_entry_to_q to_q;
-	struct lg_entry_prune prune;
-	struct lg_entry_mirror mirror;
-	struct lg_entry_generic_act generic_act;
-	struct lg_entry_statistics statistics;
+	struct entry_vsi_fwd vsi_fwd;
+	struct entry_to_q to_q;
+	struct entry_prune prune;
+	struct entry_mirror mirror;
+	struct entry_generic_act generic_act;
+	struct entry_statistics statistics;
 };
 struct ice_prof_type_entry {
 	u16 prof_id;
Signature · 1 line
2.43.0
#13 lore raw

PATCH v2 8/148 net/ice/base: improve ice_debug_cq messages

In reply to Anatoly Burakov

From: Ian Stokes <[email protected]>

The ice_debug_cq function is called to print debug data for a control queue descriptor in multiple places. This includes both before we send a message on a transmit queue, after the writeback completion of a message on the transmit queue, and when we receive a message on a receive queue.

This function does not include data about *which* control queue the message is on, nor whether it was what we sent to the queue or what we received from the queue.

Modify ice_debug_cq to take two extra parameters, a pointer to the control queue and a boolean indicating if this was a response or a command. Improve the debug messages by replacing "CQ CMD" with a string indicating which specific control queue (based on cq->qtype) and whether this was a command sent by the PF or a response from the queue.

This helps make the log output easier to understand and consume when debugging.

Also tidy existing comments.

---
 drivers/net/ice/base/ice_controlq.c | 80 +++++++++++++++++++----------
 1 file changed, 53 insertions(+), 27 deletions(-)
drivers/net/ice/base/ice_controlq.c +53 -27
index db80fe8c1d..7d40468aa0 100644
@@ -176,7 +176,7 @@ ice_alloc_rq_bufs(struct ice_hw *hw, struct ice_ctl_q_info *cq)
 		if (cq->rq_buf_size > ICE_AQ_LG_BUF)
 			desc->flags |= CPU_TO_LE16(ICE_AQ_FLAG_LB);
 		desc->opcode = 0;
-		/* This is in accordance with Admin queue design, there is no
+		/* This is in accordance with control queue design, there is no
 		 * register for buffer size configuration
 		 */
 		desc->datalen = CPU_TO_LE16(bi->size);
@@ -379,11 +379,11 @@ static int ice_init_sq(struct ice_hw *hw, struct ice_ctl_q_info *cq)
 }
 
 /**
- * ice_init_rq - initialize ARQ
+ * ice_init_rq - initialize receive side of a control queue
  * @hw: pointer to the hardware structure
  * @cq: pointer to the specific Control queue
  *
- * The main initialization routine for the Admin Receive (Event) Queue.
+ * The main initialization routine for Receive side of a control queue.
  * Prior to calling this function, the driver *MUST* set the following fields
  * in the cq->structure:
  *     - cq->num_rq_entries
@@ -441,7 +441,7 @@ static int ice_init_rq(struct ice_hw *hw, struct ice_ctl_q_info *cq)
 }
 
 /**
- * ice_shutdown_sq - shutdown the Control ATQ
+ * ice_shutdown_sq - shutdown the transmit side of a control queue
  * @hw: pointer to the hardware structure
  * @cq: pointer to the specific Control queue
  *
@@ -461,7 +461,7 @@ ice_shutdown_sq(struct ice_hw *hw, struct ice_ctl_q_info *cq)
 		goto shutdown_sq_out;
 	}
 
-	/* Stop firmware AdminQ processing */
+	/* Stop processing of the control queue */
 	wr32(hw, cq->sq.head, 0);
 	wr32(hw, cq->sq.tail, 0);
 	wr32(hw, cq->sq.len, 0);
@@ -834,7 +834,7 @@ void ice_destroy_all_ctrlq(struct ice_hw *hw)
 }
 
 /**
- * ice_clean_sq - cleans Admin send queue (ATQ)
+ * ice_clean_sq - cleans send side of a control queue
  * @hw: pointer to the hardware structure
  * @cq: pointer to the specific Control queue
  *
@@ -866,16 +866,42 @@ static u16 ice_clean_sq(struct ice_hw *hw, struct ice_ctl_q_info *cq)
 	return ICE_CTL_Q_DESC_UNUSED(sq);
 }
 
+/**
+ * ice_ctl_q_str - Convert control queue type to string
+ * @qtype: the control queue type
+ *
+ * Returns: A string name for the given control queue type.
+ */
+static const char *ice_ctl_q_str(enum ice_ctl_q qtype)
+{
+	switch (qtype) {
+	case ICE_CTL_Q_UNKNOWN:
+		return "Unknown CQ";
+	case ICE_CTL_Q_ADMIN:
+		return "AQ";
+	case ICE_CTL_Q_MAILBOX:
+		return "MBXQ";
+	case ICE_CTL_Q_SB:
+		return "SBQ";
+	default:
+		return "Unrecognized CQ";
+	}
+}
+
 /**
  * ice_debug_cq
  * @hw: pointer to the hardware structure
+ * @cq: pointer to the specific Control queue
  * @desc: pointer to control queue descriptor
  * @buf: pointer to command buffer
  * @buf_len: max length of buf
+ * @response: true if this is the writeback response
  *
  * Dumps debug log about control command with descriptor contents.
  */
-static void ice_debug_cq(struct ice_hw *hw, void *desc, void *buf, u16 buf_len)
+static void
+ice_debug_cq(struct ice_hw *hw, struct ice_ctl_q_info *cq,
+	     void *desc, void *buf, u16 buf_len, bool response)
 {
 	struct ice_aq_desc *cq_desc = (struct ice_aq_desc *)desc;
 	u16 datalen, flags;
@@ -889,7 +915,8 @@ static void ice_debug_cq(struct ice_hw *hw, void *desc, void *buf, u16 buf_len)
 	datalen = LE16_TO_CPU(cq_desc->datalen);
 	flags = LE16_TO_CPU(cq_desc->flags);
 
-	ice_debug(hw, ICE_DBG_AQ_DESC, "CQ CMD: opcode 0x%04X, flags 0x%04X, datalen 0x%04X, retval 0x%04X\n",
+	ice_debug(hw, ICE_DBG_AQ_DESC, "%s %s: opcode 0x%04X, flags 0x%04X, datalen 0x%04X, retval 0x%04X\n",
+		  ice_ctl_q_str(cq->qtype), response ? "Response" : "Command",
 		  LE16_TO_CPU(cq_desc->opcode), flags, datalen,
 		  LE16_TO_CPU(cq_desc->retval));
 	ice_debug(hw, ICE_DBG_AQ_DESC, "\tcookie (h,l) 0x%08X 0x%08X\n",
@@ -914,23 +941,23 @@ static void ice_debug_cq(struct ice_hw *hw, void *desc, void *buf, u16 buf_len)
 }
 
 /**
- * ice_sq_done - check if FW has processed the Admin Send Queue (ATQ)
+ * ice_sq_done - check if the last send on a control queue has completed
  * @hw: pointer to the HW struct
  * @cq: pointer to the specific Control queue
  *
- * Returns true if the firmware has processed all descriptors on the
- * admin send queue. Returns false if there are still requests pending.
+ * Returns: true if all the descriptors on the send side of a control queue
+ *          are finished processing, false otherwise.
  */
 static bool ice_sq_done(struct ice_hw *hw, struct ice_ctl_q_info *cq)
 {
-	/* AQ designers suggest use of head for better
+	/* control queue designers suggest use of head for better
 	 * timing reliability than DD bit
 	 */
 	return rd32(hw, cq->sq.head) == cq->sq.next_to_use;
 }
 
 /**
- * ice_sq_send_cmd_nolock - send command to Control Queue (ATQ)
+ * ice_sq_send_cmd_nolock - send command to a control queue
  * @hw: pointer to the HW struct
  * @cq: pointer to the specific Control queue
  * @desc: prefilled descriptor describing the command (non DMA mem)
@@ -938,8 +965,9 @@ static bool ice_sq_done(struct ice_hw *hw, struct ice_ctl_q_info *cq)
  * @buf_size: size of buffer for indirect commands (or 0 for direct commands)
  * @cd: pointer to command details structure
  *
- * This is the main send command routine for the ATQ. It runs the queue,
- * cleans the queue, etc.
+ * This is the main send command routine for a control queue. It prepares the
+ * command into a descriptor, bumps the send queue tail, waits for the command
+ * to complete, captures status and data for the command, etc.
  */
 int
 ice_sq_send_cmd_nolock(struct ice_hw *hw, struct ice_ctl_q_info *cq,
@@ -1035,8 +1063,7 @@ ice_sq_send_cmd_nolock(struct ice_hw *hw, struct ice_ctl_q_info *cq,
 
 	/* Debug desc and buffer */
 	ice_debug(hw, ICE_DBG_AQ_DESC, "ATQ: Control Send queue desc and buffer:\n");
-
-	ice_debug_cq(hw, (void *)desc_on_ring, buf, buf_size);
+	ice_debug_cq(hw, cq, (void *)desc_on_ring, buf, buf_size, false);
 
 	(cq->sq.next_to_use)++;
 	if (cq->sq.next_to_use == cq->sq.count)
@@ -1084,8 +1111,7 @@ ice_sq_send_cmd_nolock(struct ice_hw *hw, struct ice_ctl_q_info *cq,
 	}
 
 	ice_debug(hw, ICE_DBG_AQ_MSG, "ATQ: desc and buffer writeback:\n");
-
-	ice_debug_cq(hw, (void *)desc, buf, buf_size);
+	ice_debug_cq(hw, cq, (void *)desc, buf, buf_size, true);
 
 	/* save writeback AQ if requested */
 	if (details->wb_desc)
@@ -1109,7 +1135,7 @@ ice_sq_send_cmd_nolock(struct ice_hw *hw, struct ice_ctl_q_info *cq,
 }
 
 /**
- * ice_sq_send_cmd - send command to Control Queue (ATQ)
+ * ice_sq_send_cmd - send command to a control queue
  * @hw: pointer to the HW struct
  * @cq: pointer to the specific Control queue
  * @desc: prefilled descriptor describing the command
@@ -1117,8 +1143,9 @@ ice_sq_send_cmd_nolock(struct ice_hw *hw, struct ice_ctl_q_info *cq,
  * @buf_size: size of buffer for indirect commands (or 0 for direct commands)
  * @cd: pointer to command details structure
  *
- * This is the main send command routine for the ATQ. It runs the queue,
- * cleans the queue, etc.
+ * Main command for the transmit side of a control queue. It puts the command
+ * on the queue, bumps the tail, waits for processing of the command, captures
+ * command status and results, etc.
  */
 int
 ice_sq_send_cmd(struct ice_hw *hw, struct ice_ctl_q_info *cq,
@@ -1160,9 +1187,9 @@ void ice_fill_dflt_direct_cmd_desc(struct ice_aq_desc *desc, u16 opcode)
  * @e: event info from the receive descriptor, includes any buffers
  * @pending: number of events that could be left to process
  *
- * This function cleans one Admin Receive Queue element and returns
- * the contents through e. It can also return how many events are
- * left to process through 'pending'.
+ * Clean one element from the receive side of a control queue. On return 'e'
+ * contains contents of the message, and 'pending' contains the number of
+ * events left to process.
  */
 int
 ice_clean_rq_elem(struct ice_hw *hw, struct ice_ctl_q_info *cq,
@@ -1218,8 +1245,7 @@ ice_clean_rq_elem(struct ice_hw *hw, struct ice_ctl_q_info *cq,
 			   e->msg_len, ICE_DMA_TO_NONDMA);
 
 	ice_debug(hw, ICE_DBG_AQ_DESC, "ARQ: desc and buffer:\n");
-
-	ice_debug_cq(hw, (void *)desc, e->msg_buf, cq->rq_buf_size);
+	ice_debug_cq(hw, cq, (void *)desc, e->msg_buf, cq->rq_buf_size, true);
 
 	/* Restore the original datalen and buffer address in the desc,
 	 * FW updates datalen to indicate the event message size
Signature · 1 line
2.43.0
#14 lore raw

PATCH v2 9/148 net/ice/base: add mgmt netlist auth support command

In reply to Anatoly Burakov

From: Ian Stokes <[email protected]>

Add new Admin Q command to check if netlist auth is supported.

---
 drivers/net/ice/base/ice_common.c | 5 +++++
 drivers/net/ice/base/ice_type.h   | 2 ++
 2 files changed, 7 insertions(+)
drivers/net/ice/base/ice_common.c +5 -0
index 1d666b7708..113620ff0a 100644
@@ -2495,6 +2495,11 @@ ice_parse_common_caps(struct ice_hw *hw, struct ice_hw_common_caps *caps,
 			true : false;
 		ice_debug(hw, ICE_DBG_INIT, "%s: nvm_unified_update = %d\n", prefix,
 			  caps->nvm_unified_update);
+		caps->netlist_auth =
+			(number & ICE_NVM_MGMT_NETLIST_AUTH_SUPPORT) ?
+			true : false;
+		ice_debug(hw, ICE_DBG_INIT, "%s: netlist_auth = %d\n", prefix,
+			  caps->netlist_auth);
 		break;
 	case ICE_AQC_CAPS_MAX_MTU:
 		caps->max_mtu = number;
drivers/net/ice/base/ice_type.h +2 -0
index d13105070b..e7bd2215ce 100644
@@ -602,9 +602,11 @@ struct ice_hw_common_caps {
 	bool sec_rev_disabled;
 	bool update_disabled;
 	bool nvm_unified_update;
+	bool netlist_auth;
 #define ICE_NVM_MGMT_SEC_REV_DISABLED		BIT(0)
 #define ICE_NVM_MGMT_UPDATE_DISABLED		BIT(1)
 #define ICE_NVM_MGMT_UNIFIED_UPD_SUPPORT	BIT(3)
+#define ICE_NVM_MGMT_NETLIST_AUTH_SUPPORT	BIT(5)
 	/* PCIe reset avoidance */
 	bool pcie_reset_avoidance; /* false: not supported, true: supported */
 	/* Post update reset restriction */
Signature · 1 line
2.43.0
#15 lore raw

PATCH v2 10/148 net/ice/base: fix undefined variables

In reply to Anatoly Burakov

From: Ian Stokes <[email protected]>

Initialize some variable to avoid "variable might be not defined" warning. This is due to the fact that for QV, sometimes alternative fragments of code are being executed exclusively thanks to use of goto, which some compilers cannot handle correctly.

---
 drivers/net/ice/base/ice_switch.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/ice/base/ice_switch.c +2 -2
index 0c13b12faa..fbfc92f294 100644
@@ -5768,7 +5768,7 @@ ice_cfg_dflt_vsi(struct ice_port_info *pi, u16 vsi_handle, bool set,
 		 u8 direction)
 {
 	struct ice_fltr_list_entry f_list_entry;
-	struct ice_sw_recipe *recp_list;
+	struct ice_sw_recipe *recp_list = NULL;
 	struct ice_fltr_info f_info;
 	struct ice_hw *hw = pi->hw;
 	u8 lport = pi->lport;
@@ -10091,7 +10091,7 @@ int
 ice_replay_vsi_all_fltr(struct ice_hw *hw, struct ice_port_info *pi,
 			u16 vsi_handle)
 {
-	struct ice_switch_info *sw;
+	struct ice_switch_info *sw = NULL;
 	int status;
 	u8 i;
 
Signature · 1 line
2.43.0
#16 lore raw

PATCH v2 11/148 net/ice/base: fix get media type

In reply to Anatoly Burakov

From: Ian Stokes <[email protected]>

The use of get link status PHY type for determining the media type can result in incorrect reporting the incorrect media type. This can happen for a couple reasons:

1. The get link states current PHY type field can return non-PHY type values
(i.e. bit 127 indicates link state disabled, and bit 126 indicates PHY is in auto-negotiation state)

2. Forced link configurations can result in incorrectly mapping on media type (i.e. forcing optical link modes on copper media)

Add the media type ICE_MEDIA_NONE. As part of this patch add the new PHY type bits needed for 200G architecture.

Michael <[email protected]>

---
 drivers/net/ice/base/ice_adminq_cmd.h |  13 +-
 drivers/net/ice/base/ice_common.c     | 244 ++++++++++----------------
 drivers/net/ice/base/ice_type.h       |  94 +++++++++-
 3 files changed, 195 insertions(+), 156 deletions(-)
drivers/net/ice/base/ice_adminq_cmd.h +12 -1
index 844e90bbce..56c9a4813e 100644
@@ -1398,7 +1398,18 @@ struct ice_aqc_get_phy_caps {
 #define ICE_PHY_TYPE_HIGH_100G_CAUI2		BIT_ULL(2)
 #define ICE_PHY_TYPE_HIGH_100G_AUI2_AOC_ACC	BIT_ULL(3)
 #define ICE_PHY_TYPE_HIGH_100G_AUI2		BIT_ULL(4)
-#define ICE_PHY_TYPE_HIGH_MAX_INDEX		4
+#define ICE_PHY_TYPE_HIGH_200G_CR4_PAM4		BIT_ULL(5)
+#define ICE_PHY_TYPE_HIGH_200G_SR4		BIT_ULL(6)
+#define ICE_PHY_TYPE_HIGH_200G_FR4		BIT_ULL(7)
+#define ICE_PHY_TYPE_HIGH_200G_LR4		BIT_ULL(8)
+#define ICE_PHY_TYPE_HIGH_200G_DR4		BIT_ULL(9)
+#define ICE_PHY_TYPE_HIGH_200G_KR4_PAM4		BIT_ULL(10)
+#define ICE_PHY_TYPE_HIGH_200G_AUI4_AOC_ACC	BIT_ULL(11)
+#define ICE_PHY_TYPE_HIGH_200G_AUI4		BIT_ULL(12)
+#define ICE_PHY_TYPE_HIGH_200G_AUI8_AOC_ACC	BIT_ULL(13)
+#define ICE_PHY_TYPE_HIGH_200G_AUI8		BIT_ULL(14)
+#define ICE_PHY_TYPE_HIGH_400GBASE_FR8		BIT_ULL(15)
+#define ICE_PHY_TYPE_HIGH_MAX_INDEX		15
 
 struct ice_aqc_get_phy_caps_data {
 	__le64 phy_type_low; /* Use values from ICE_PHY_TYPE_LOW_* */
drivers/net/ice/base/ice_common.c +90 -154

286 lines not on this page · raw message

drivers/net/ice/base/ice_type.h +93 -1

106 lines not on this page · raw message

Signature · 1 line
2.43.0
#17 lore raw

Re: [PATCH v2 011/148] net/ice/base: fix get media type

Quoted 13 lines · Anatoly Burakov

From: Ian Stokes <[email protected]>

The use of get link status PHY type for determining the media type can result in incorrect reporting the incorrect media type. This can happen for a couple reasons:

1. The get link states current PHY type field can return non-PHY type values
(i.e. bit 127 indicates link state disabled, and bit 126 indicates PHY is in auto-negotiation state)

2. Forced link configurations can result in incorrectly mapping on media type (i.e. forcing optical link modes on copper media)

Quoted 7 lines

Add the media type ICE_MEDIA_NONE. As part of this patch add the new PHY type bits needed for 200G architecture.

Michael <[email protected]>

---

Nit: beware malformed sign-offs. No worries if any slip through, I can fix on apply of V3.

Also, for any patches with titles starting "fix", consider if suitable for backport and CC stable if appropriate. [If not for backport, perhaps "fix" is not the best verb to use in title?]

/Bruce

#18 lore raw

PATCH v2 12/148 net/ice/base: clean up __ice_aq_get_set_rss_lut()

In reply to Anatoly Burakov

From: Ian Stokes <[email protected]>

Refactor __ice_aq_get_set_rss_lut():
get:
- make use params->lut_size only as a size of params->lut;
- return LUT size via params->lut_size;
set:
- remove option to set RSS LUT smaller than available (eg forbid PF LUT sized 512);
both:
- clean up code.

---
 drivers/net/ice/base/ice_adminq_cmd.h |  17 +++-
 drivers/net/ice/base/ice_common.c     | 126 ++++++++++++++------------
 drivers/net/ice/base/ice_common.h     |   1 +
 3 files changed, 82 insertions(+), 62 deletions(-)
drivers/net/ice/base/ice_adminq_cmd.h +15 -2
index 56c9a4813e..a6a8210dd5 100644
@@ -2225,6 +2225,19 @@ struct ice_aqc_get_set_rss_keys {
 	u8 extended_hash_key[ICE_AQC_GET_SET_RSS_KEY_DATA_HASH_KEY_SIZE];
 };
 
+enum ice_lut_type {
+	ICE_LUT_VSI = 0,
+	ICE_LUT_PF = 1,
+	ICE_LUT_GLOBAL = 2,
+	ICE_LUT_TYPE_MASK = 3
+};
+
+enum ice_lut_size {
+	ICE_LUT_VSI_SIZE = 64,
+	ICE_LUT_GLOBAL_SIZE = 512,
+	ICE_LUT_PF_SIZE = 2048,
+};
+
 /* Get/Set RSS LUT (indirect 0x0B05/0x0B03) */
 struct ice_aqc_get_set_rss_lut {
 #define ICE_AQC_GSET_RSS_LUT_VSI_VALID	BIT(15)
@@ -2233,7 +2246,7 @@ struct ice_aqc_get_set_rss_lut {
 	__le16 vsi_id;
 #define ICE_AQC_GSET_RSS_LUT_TABLE_TYPE_S	0
 #define ICE_AQC_GSET_RSS_LUT_TABLE_TYPE_M	\
-				(0x3 << ICE_AQC_GSET_RSS_LUT_TABLE_TYPE_S)
+	(ICE_LUT_TYPE_MASK << ICE_AQC_GSET_RSS_LUT_TABLE_TYPE_S)
 
 #define ICE_AQC_GSET_RSS_LUT_TABLE_TYPE_VSI	 0
 #define ICE_AQC_GSET_RSS_LUT_TABLE_TYPE_PF	 1
@@ -2241,7 +2254,7 @@ struct ice_aqc_get_set_rss_lut {
 
 #define ICE_AQC_GSET_RSS_LUT_TABLE_SIZE_S	 2
 #define ICE_AQC_GSET_RSS_LUT_TABLE_SIZE_M	 \
-				(0x3 << ICE_AQC_GSET_RSS_LUT_TABLE_SIZE_S)
+	(ICE_LUT_TYPE_MASK << ICE_AQC_GSET_RSS_LUT_TABLE_SIZE_S)
 
 #define ICE_AQC_GSET_RSS_LUT_TABLE_SIZE_128	 128
 #define ICE_AQC_GSET_RSS_LUT_TABLE_SIZE_128_FLAG 0
drivers/net/ice/base/ice_common.c +66 -60

156 lines not on this page · raw message

drivers/net/ice/base/ice_common.h +1 -0
index 2aeb1a520a..fe99b56f8b 100644
@@ -101,6 +101,7 @@ ice_write_tx_drbell_q_ctx(struct ice_hw *hw,
 			  struct ice_tx_drbell_q_ctx *tx_drbell_q_ctx,
 			  u32 tx_drbell_q_index);
 
+int ice_lut_size_to_type(int lut_size);
 int
 ice_aq_get_rss_lut(struct ice_hw *hw, struct ice_aq_get_set_rss_lut_params *get_params);
 int
Signature · 1 line
2.43.0
#19 lore raw

Re: [PATCH v2 012/148] net/ice/base: clean up __ice_aq_get_set_rss_lut()

Quoted 8 lines · Anatoly Burakov

From: Ian Stokes <[email protected]>

Refactor __ice_aq_get_set_rss_lut():
get:
- make use params->lut_size only as a size of params->lut;
- return LUT size via params->lut_size;
set:
- remove option to set RSS LUT smaller than available

Quoted 6 lines
    (eg forbid PF LUT sized 512);

both:
- clean up code.

I have not much interest in DPDK, but when you CC me on code authored by me, it would be nice to also apply proper authorship (the From: line).

Quoted 224 lines
---
  drivers/net/ice/base/ice_adminq_cmd.h |  17 +++-
  drivers/net/ice/base/ice_common.c     | 126 ++++++++++++++------------
  drivers/net/ice/base/ice_common.h     |   1 +
  3 files changed, 82 insertions(+), 62 deletions(-)
drivers/net/ice/base/ice_adminq_cmd.h +15 -2
index 56c9a4813e..a6a8210dd5 100644
@@ -2225,6 +2225,19 @@ struct ice_aqc_get_set_rss_keys {
  	u8 extended_hash_key[ICE_AQC_GET_SET_RSS_KEY_DATA_HASH_KEY_SIZE];
  };
 
+enum ice_lut_type {
+	ICE_LUT_VSI = 0,
+	ICE_LUT_PF = 1,
+	ICE_LUT_GLOBAL = 2,
+	ICE_LUT_TYPE_MASK = 3
+};
+
+enum ice_lut_size {
+	ICE_LUT_VSI_SIZE = 64,
+	ICE_LUT_GLOBAL_SIZE = 512,
+	ICE_LUT_PF_SIZE = 2048,
+};
+
  /* Get/Set RSS LUT (indirect 0x0B05/0x0B03) */
  struct ice_aqc_get_set_rss_lut {
  #define ICE_AQC_GSET_RSS_LUT_VSI_VALID	BIT(15)
@@ -2233,7 +2246,7 @@ struct ice_aqc_get_set_rss_lut {
  	__le16 vsi_id;
  #define ICE_AQC_GSET_RSS_LUT_TABLE_TYPE_S	0
  #define ICE_AQC_GSET_RSS_LUT_TABLE_TYPE_M	\
-				(0x3 << ICE_AQC_GSET_RSS_LUT_TABLE_TYPE_S)
+	(ICE_LUT_TYPE_MASK << ICE_AQC_GSET_RSS_LUT_TABLE_TYPE_S)
 
  #define ICE_AQC_GSET_RSS_LUT_TABLE_TYPE_VSI	 0
  #define ICE_AQC_GSET_RSS_LUT_TABLE_TYPE_PF	 1
@@ -2241,7 +2254,7 @@ struct ice_aqc_get_set_rss_lut {
 
  #define ICE_AQC_GSET_RSS_LUT_TABLE_SIZE_S	 2
  #define ICE_AQC_GSET_RSS_LUT_TABLE_SIZE_M	 \
-				(0x3 << ICE_AQC_GSET_RSS_LUT_TABLE_SIZE_S)
+	(ICE_LUT_TYPE_MASK << ICE_AQC_GSET_RSS_LUT_TABLE_SIZE_S)
 
  #define ICE_AQC_GSET_RSS_LUT_TABLE_SIZE_128	 128
  #define ICE_AQC_GSET_RSS_LUT_TABLE_SIZE_128_FLAG 0
drivers/net/ice/base/ice_common.c +66 -60
index 1fe9bebe7d..314d1bffb4 100644
@@ -4127,6 +4127,51 @@ ice_aq_read_topo_dev_nvm(struct ice_hw *hw,
  	return 0;
  }
 
+static u16 ice_lut_type_to_size(u16 lut_type)
+{
+	switch (lut_type) {
+	case ICE_LUT_VSI:
+		return ICE_LUT_VSI_SIZE;
+	case ICE_LUT_GLOBAL:
+		return ICE_LUT_GLOBAL_SIZE;
+	case ICE_LUT_PF:
+		return ICE_LUT_PF_SIZE;
+	default:
+		return 0;
+	}
+}
+
+static u16 ice_lut_size_to_flag(u16 lut_size)
+{
+	u16 f = 0;
+
+	switch (lut_size) {
+	case ICE_LUT_GLOBAL_SIZE:
+		f = ICE_AQC_GSET_RSS_LUT_TABLE_SIZE_512_FLAG;
+		break;
+	case ICE_LUT_PF_SIZE:
+		f = ICE_AQC_GSET_RSS_LUT_TABLE_SIZE_2K_FLAG;
+		break;
+	default:
+		break;
+	}
+	return f << ICE_AQC_GSET_RSS_LUT_TABLE_SIZE_S;
+}
+
+int ice_lut_size_to_type(int lut_size)
+{
+	switch (lut_size) {
+	case ICE_LUT_VSI_SIZE:
+		return ICE_LUT_VSI;
+	case ICE_LUT_GLOBAL_SIZE:
+		return ICE_LUT_GLOBAL;
+	case ICE_LUT_PF_SIZE:
+		return ICE_LUT_PF;
+	default:
+		return -1;
+	}
+}
+
  /**
   * __ice_aq_get_set_rss_lut
   * @hw: pointer to the hardware structure
@@ -4138,7 +4183,7 @@ ice_aq_read_topo_dev_nvm(struct ice_hw *hw,
  static int
  __ice_aq_get_set_rss_lut(struct ice_hw *hw, struct ice_aq_get_set_rss_lut_params *params, bool set)
  {
-	u16 flags = 0, vsi_id, lut_type, lut_size, glob_lut_idx, vsi_handle;
+	u16 flags, vsi_id, lut_type, lut_size, glob_lut_idx = 0, vsi_handle;
  	struct ice_aqc_get_set_rss_lut *cmd_resp;
  	struct ice_aq_desc desc;
  	int status;
@@ -4149,16 +4194,22 @@ __ice_aq_get_set_rss_lut(struct ice_hw *hw, struct ice_aq_get_set_rss_lut_params
 
  	vsi_handle = params->vsi_handle;
  	lut = params->lut;
-
-	if (!ice_is_vsi_valid(hw, vsi_handle) || !lut)
-		return ICE_ERR_PARAM;
-
-	lut_size = params->lut_size;
  	lut_type = params->lut_type;
-	glob_lut_idx = params->global_lut_id;
-	vsi_id = ice_get_hw_vsi_num(hw, vsi_handle);
-
+	lut_size = ice_lut_type_to_size(lut_type);
  	cmd_resp = &desc.params.get_set_rss_lut;
+	if (lut_type == ICE_AQC_GSET_RSS_LUT_TABLE_TYPE_GLOBAL)
+		glob_lut_idx = params->global_lut_id;
+
+	if (!lut || !lut_size || !ice_is_vsi_valid(hw, vsi_handle))
+		return ICE_ERR_PARAM;
+
+	if (lut_size > params->lut_size)
+		return ICE_ERR_INVAL_SIZE;
+
+	if (set && lut_size != params->lut_size)
+		return ICE_ERR_PARAM;
+
+	vsi_id = ice_get_hw_vsi_num(hw, vsi_handle);
 
  	if (set) {
  		ice_fill_dflt_direct_cmd_desc(&desc, ice_aqc_opc_set_rss_lut);
@@ -4172,61 +4223,16 @@ __ice_aq_get_set_rss_lut(struct ice_hw *hw, struct ice_aq_get_set_rss_lut_params
  					ICE_AQC_GSET_RSS_LUT_VSI_ID_M) |
  				       ICE_AQC_GSET_RSS_LUT_VSI_VALID);
 
-	switch (lut_type) {
-	case ICE_AQC_GSET_RSS_LUT_TABLE_TYPE_VSI:
-	case ICE_AQC_GSET_RSS_LUT_TABLE_TYPE_PF:
-	case ICE_AQC_GSET_RSS_LUT_TABLE_TYPE_GLOBAL:
-		flags |= ((lut_type << ICE_AQC_GSET_RSS_LUT_TABLE_TYPE_S) &
-			  ICE_AQC_GSET_RSS_LUT_TABLE_TYPE_M);
-		break;
-	default:
-		status = ICE_ERR_PARAM;
-		goto ice_aq_get_set_rss_lut_exit;
-	}
+	flags = ice_lut_size_to_flag(lut_size) |
+		 ((lut_type << ICE_AQC_GSET_RSS_LUT_TABLE_TYPE_S) &
+		  ICE_AQC_GSET_RSS_LUT_TABLE_TYPE_M) |
+		 ((glob_lut_idx << ICE_AQC_GSET_RSS_LUT_GLOBAL_IDX_S) &
+		  ICE_AQC_GSET_RSS_LUT_GLOBAL_IDX_M);
 
-	if (lut_type == ICE_AQC_GSET_RSS_LUT_TABLE_TYPE_GLOBAL) {
-		flags |= ((glob_lut_idx << ICE_AQC_GSET_RSS_LUT_GLOBAL_IDX_S) &
-			  ICE_AQC_GSET_RSS_LUT_GLOBAL_IDX_M);
-
-		if (!set)
-			goto ice_aq_get_set_rss_lut_send;
-	} else if (lut_type == ICE_AQC_GSET_RSS_LUT_TABLE_TYPE_PF) {
-		if (!set)
-			goto ice_aq_get_set_rss_lut_send;
-	} else {
-		goto ice_aq_get_set_rss_lut_send;
-	}
-
-	/* LUT size is only valid for Global and PF table types */
-	switch (lut_size) {
-	case ICE_AQC_GSET_RSS_LUT_TABLE_SIZE_128:
-		flags |= (ICE_AQC_GSET_RSS_LUT_TABLE_SIZE_128_FLAG <<
-			  ICE_AQC_GSET_RSS_LUT_TABLE_SIZE_S) &
-			 ICE_AQC_GSET_RSS_LUT_TABLE_SIZE_M;
-		break;
-	case ICE_AQC_GSET_RSS_LUT_TABLE_SIZE_512:
-		flags |= (ICE_AQC_GSET_RSS_LUT_TABLE_SIZE_512_FLAG <<
-			  ICE_AQC_GSET_RSS_LUT_TABLE_SIZE_S) &
-			 ICE_AQC_GSET_RSS_LUT_TABLE_SIZE_M;
-		break;
-	case ICE_AQC_GSET_RSS_LUT_TABLE_SIZE_2K:
-		if (lut_type == ICE_AQC_GSET_RSS_LUT_TABLE_TYPE_PF) {
-			flags |= (ICE_AQC_GSET_RSS_LUT_TABLE_SIZE_2K_FLAG <<
-				  ICE_AQC_GSET_RSS_LUT_TABLE_SIZE_S) &
-				 ICE_AQC_GSET_RSS_LUT_TABLE_SIZE_M;
-			break;
-		}
-		/* fall-through */
-	default:
-		status = ICE_ERR_PARAM;
-		goto ice_aq_get_set_rss_lut_exit;
-	}
-
-ice_aq_get_set_rss_lut_send:
  	cmd_resp->flags = CPU_TO_LE16(flags);
  	status = ice_aq_send_cmd(hw, &desc, lut, lut_size, NULL);
 
-ice_aq_get_set_rss_lut_exit:
+	params->lut_size = LE16_TO_CPU(desc.datalen);
  	return status;
  }
 
drivers/net/ice/base/ice_common.h +1 -0
index 2aeb1a520a..fe99b56f8b 100644
@@ -101,6 +101,7 @@ ice_write_tx_drbell_q_ctx(struct ice_hw *hw,
  			  struct ice_tx_drbell_q_ctx *tx_drbell_q_ctx,
  			  u32 tx_drbell_q_index);
 
+int ice_lut_size_to_type(int lut_size);
  int
  ice_aq_get_rss_lut(struct ice_hw *hw, struct ice_aq_get_set_rss_lut_params *get_params);
  int
#20 lore raw

Re: [PATCH v2 012/148] net/ice/base: clean up __ice_aq_get_set_rss_lut()

Quoted 13 lines · Przemek Kitszel
Quoted 12 lines · Anatoly Burakov

From: Ian Stokes <[email protected]>

Refactor __ice_aq_get_set_rss_lut():
get:
  - make use params->lut_size only as a size of params->lut;
  - return LUT size via params->lut_size;
set:
  - remove option to set RSS LUT smaller than available (eg forbid PF LUT sized 512);
both:
  - clean up code.

Quoted 6 lines
Quoted 2 lines

I have not much interest in DPDK, but when you CC me on code authored by me, it would be nice to also apply proper authorship (the From: line).

Hi,

Yes, apologies for that, it's an artifact of the process we were using to create these patches. Will be addressed for all patches in next revisions.

Signature · 2 lines
Thanks,
Anatoly
#21 lore raw

Re: [PATCH v2 012/148] net/ice/base: clean up __ice_aq_get_set_rss_lut()

In reply to Anatoly Burakov

Avoid use of function names in title. This could be "improve RSS LUT function", perhaps?

Quoted 15 lines · Anatoly Burakov

From: Ian Stokes <[email protected]>

Refactor __ice_aq_get_set_rss_lut():
get:
- make use params->lut_size only as a size of params->lut;
- return LUT size via params->lut_size;
set:
- remove option to set RSS LUT smaller than available (eg forbid PF LUT sized 512);
both:
- clean up code.

---

#22 lore raw

PATCH v2 13/148 net/ice/base: update flow seg fields to declared bitmaps

In reply to Anatoly Burakov

From: Ian Stokes <[email protected]>

ice_flow_seg_info fields match and range are being used with bit operations but not declared as bitmaps. This can cause issues when casting values greater than 32. This change is to declare them as proper bitmaps so that the bitmap operations can function as intended.

---
 drivers/net/ice/base/ice_flow.c | 53 ++++++++++++++++++++++-----------
 drivers/net/ice/base/ice_flow.h |  6 ++--
 2 files changed, 39 insertions(+), 20 deletions(-)
drivers/net/ice/base/ice_flow.c +35 -18
index 0b9974aee2..3a34771f21 100644
@@ -1371,7 +1371,7 @@ ice_flow_xtract_pkt_flags(struct ice_hw *hw,
  */
 static int
 ice_flow_xtract_fld(struct ice_hw *hw, struct ice_flow_prof_params *params,
-		    u8 seg, enum ice_flow_field fld, u64 match)
+		    u8 seg, enum ice_flow_field fld, ice_bitmap_t *match)
 {
 	enum ice_flow_field sib = ICE_FLOW_FIELD_IDX_MAX;
 	u8 fv_words = (u8)hw->blk[params->blk].es.fvw;
@@ -1420,7 +1420,7 @@ ice_flow_xtract_fld(struct ice_hw *hw, struct ice_flow_prof_params *params,
 		/* If the sibling field is also included, that field's
 		 * mask needs to be included.
 		 */
-		if (match & BIT(sib))
+		if (ice_is_bit_set(match, sib))
 			sib_mask = ice_flds_info[sib].mask;
 		break;
 	case ICE_FLOW_FIELD_IDX_IPV6_TTL:
@@ -1451,7 +1451,7 @@ ice_flow_xtract_fld(struct ice_hw *hw, struct ice_flow_prof_params *params,
 		/* If the sibling field is also included, that field's
 		 * mask needs to be included.
 		 */
-		if (match & BIT(sib))
+		if (ice_is_bit_set(match, sib))
 			sib_mask = ice_flds_info[sib].mask;
 		break;
 	case ICE_FLOW_FIELD_IDX_IPV4_SA:
@@ -1722,15 +1722,16 @@ ice_flow_create_xtrct_seq(struct ice_hw *hw,
 	}
 
 	for (i = 0; i < params->prof->segs_cnt; i++) {
-		u64 match = params->prof->segs[i].match;
+		ice_declare_bitmap(match, ICE_FLOW_FIELD_IDX_MAX);
 		enum ice_flow_field j;
 
-		ice_for_each_set_bit(j, (ice_bitmap_t *)&match,
-				     ICE_FLOW_FIELD_IDX_MAX) {
+		ice_cp_bitmap(match, params->prof->segs[i].match,
+			      ICE_FLOW_FIELD_IDX_MAX);
+		ice_for_each_set_bit(j, match, ICE_FLOW_FIELD_IDX_MAX) {
 			status = ice_flow_xtract_fld(hw, params, i, j, match);
 			if (status)
 				return status;
-			ice_clear_bit(j, (ice_bitmap_t *)&match);
+			ice_clear_bit(j, match);
 		}
 
 		/* Process raw matching bytes */
@@ -1789,7 +1790,7 @@ ice_flow_acl_def_entry_frmt(struct ice_flow_prof_params *params)
 		struct ice_flow_seg_info *seg = &params->prof->segs[i];
 		u16 j;
 
-		ice_for_each_set_bit(j, (ice_bitmap_t *)&seg->match,
+		ice_for_each_set_bit(j, seg->match,
 				     (u16)ICE_FLOW_FIELD_IDX_MAX) {
 			struct ice_flow_fld_info *fld = &seg->fields[j];
 
@@ -1932,7 +1933,10 @@ ice_flow_find_prof_conds(struct ice_hw *hw, enum ice_block blk,
 			for (i = 0; i < segs_cnt; i++)
 				if (segs[i].hdrs != p->segs[i].hdrs ||
 				    ((conds & ICE_FLOW_FIND_PROF_CHK_FLDS) &&
-				     segs[i].match != p->segs[i].match))
+				     (ice_cmp_bitmap(segs[i].match,
+						     p->segs[i].match,
+						     ICE_FLOW_FIELD_IDX_MAX) ==
+				       false)))
 					break;
 
 			/* A match is found if all segments are matched */
@@ -2432,7 +2436,7 @@ ice_flow_acl_set_xtrct_seq(struct ice_hw *hw, struct ice_flow_prof *prof)
 			struct ice_flow_seg_info *seg = &prof->segs[i];
 			u16 j;
 
-			ice_for_each_set_bit(j, (ice_bitmap_t *)&seg->match,
+			ice_for_each_set_bit(j, seg->match,
 					     ICE_FLOW_FIELD_IDX_MAX) {
 				info = &seg->fields[j];
 
@@ -3002,7 +3006,7 @@ ice_flow_acl_frmt_entry(struct ice_hw *hw, struct ice_flow_prof *prof,
 		struct ice_flow_seg_info *seg = &prof->segs[i];
 		u16 j;
 
-		ice_for_each_set_bit(j, (ice_bitmap_t *)&seg->match,
+		ice_for_each_set_bit(j, seg->match,
 				     (u16)ICE_FLOW_FIELD_IDX_MAX) {
 			struct ice_flow_fld_info *info = &seg->fields[j];
 
@@ -3576,11 +3580,9 @@ ice_flow_set_fld_ext(struct ice_flow_seg_info *seg, enum ice_flow_field fld,
 		     enum ice_flow_fld_match_type field_type, u16 val_loc,
 		     u16 mask_loc, u16 last_loc)
 {
-	u64 bit = BIT_ULL(fld);
-
-	seg->match |= bit;
+	ice_set_bit(fld, seg->match);
 	if (field_type == ICE_FLOW_FLD_TYPE_RANGE)
-		seg->range |= bit;
+		ice_set_bit(fld, seg->range);
 
 	seg->fields[fld].type = field_type;
 	seg->fields[fld].src.val = val_loc;
@@ -3929,6 +3931,14 @@ ice_rem_rss_list(struct ice_hw *hw, u16 vsi_handle, struct ice_flow_prof *prof)
 {
 	enum ice_rss_cfg_hdr_type hdr_type;
 	struct ice_rss_cfg *r, *tmp;
+	u64 seg_match = 0;
+	u16 i;
+
+	/* convert match bitmap to u64 for hash field comparison */
+	ice_for_each_set_bit(i, prof->segs[prof->segs_cnt - 1].match,
+			     ICE_FLOW_FIELD_IDX_MAX) {
+		seg_match |= 1ULL << i;
+	}
 
 	/* Search for RSS hash fields associated to the VSI that match the
 	 * hash configurations associated to the flow profile. If found
@@ -3937,7 +3947,7 @@ ice_rem_rss_list(struct ice_hw *hw, u16 vsi_handle, struct ice_flow_prof *prof)
 	hdr_type = ice_get_rss_hdr_type(prof);
 	LIST_FOR_EACH_ENTRY_SAFE(r, tmp, &hw->rss_list_head,
 				 ice_rss_cfg, l_entry)
-		if (r->hash.hash_flds == prof->segs[prof->segs_cnt - 1].match &&
+		if (r->hash.hash_flds == seg_match &&
 		    r->hash.addl_hdrs == prof->segs[prof->segs_cnt - 1].hdrs &&
 		    r->hash.hdr_type == hdr_type) {
 			ice_clear_bit(vsi_handle, r->vsis);
@@ -3962,11 +3972,18 @@ ice_add_rss_list(struct ice_hw *hw, u16 vsi_handle, struct ice_flow_prof *prof)
 {
 	enum ice_rss_cfg_hdr_type hdr_type;
 	struct ice_rss_cfg *r, *rss_cfg;
+	u64 seg_match = 0;
+	u16 i;
+
+	ice_for_each_set_bit(i, prof->segs[prof->segs_cnt - 1].match,
+			     ICE_FLOW_FIELD_IDX_MAX) {
+		seg_match |= 1ULL << i;
+	}
 
 	hdr_type = ice_get_rss_hdr_type(prof);
 	LIST_FOR_EACH_ENTRY(r, &hw->rss_list_head,
 			    ice_rss_cfg, l_entry)
-		if (r->hash.hash_flds == prof->segs[prof->segs_cnt - 1].match &&
+		if (r->hash.hash_flds == seg_match &&
 		    r->hash.addl_hdrs == prof->segs[prof->segs_cnt - 1].hdrs &&
 		    r->hash.hdr_type == hdr_type) {
 			ice_set_bit(vsi_handle, r->vsis);
@@ -3977,7 +3994,7 @@ ice_add_rss_list(struct ice_hw *hw, u16 vsi_handle, struct ice_flow_prof *prof)
 	if (!rss_cfg)
 		return ICE_ERR_NO_MEMORY;
 
-	rss_cfg->hash.hash_flds = prof->segs[prof->segs_cnt - 1].match;
+	rss_cfg->hash.hash_flds = seg_match;
 	rss_cfg->hash.addl_hdrs = prof->segs[prof->segs_cnt - 1].hdrs;
 	rss_cfg->hash.hdr_type = hdr_type;
 	rss_cfg->hash.symm = prof->cfg.symm;
drivers/net/ice/base/ice_flow.h +4 -2
index 7811c38e15..c1658be477 100644
@@ -453,8 +453,10 @@ struct ice_flow_seg_fld_raw {
 
 struct ice_flow_seg_info {
 	u32 hdrs;	/* Bitmask indicating protocol headers present */
-	u64 match;	/* Bitmask indicating header fields to be matched */
-	u64 range;	/* Bitmask indicating header fields matched as ranges */
+	/* Bitmask indicating header fields to be matched */
+	ice_declare_bitmap(match, ICE_FLOW_FIELD_IDX_MAX);
+	/* Bitmask indicating header fields matched as ranges */
+	ice_declare_bitmap(range, ICE_FLOW_FIELD_IDX_MAX);
 
 	struct ice_flow_fld_info fields[ICE_FLOW_FIELD_IDX_MAX];
 
Signature · 1 line
2.43.0
#23 lore raw

PATCH v2 14/148 net/ice/base: update interface in ice_parse_common_caps

In reply to Anatoly Burakov

From: Ian Stokes <[email protected]>

New flag for external topology devices for different types of versioning.

---
 drivers/net/ice/base/ice_common.c | 6 ++++++
 drivers/net/ice/base/ice_type.h   | 2 ++
 2 files changed, 8 insertions(+)
drivers/net/ice/base/ice_common.c +6 -0
index 314d1bffb4..9b08a10022 100644
@@ -2470,6 +2470,8 @@ ice_parse_common_caps(struct ice_hw *hw, struct ice_hw_common_caps *caps,
 			(phys_id & ICE_EXT_TOPO_DEV_IMG_LOAD_EN) != 0;
 		caps->ext_topo_dev_img_prog_en[index] =
 			(phys_id & ICE_EXT_TOPO_DEV_IMG_PROG_EN) != 0;
+		caps->ext_topo_dev_img_ver_schema[index] =
+			(phys_id & ICE_EXT_TOPO_DEV_IMG_VER_SCHEMA) != 0;
 		ice_debug(hw, ICE_DBG_INIT,
 			  "%s: ext_topo_dev_img_ver_high[%d] = %d\n",
 			  prefix, index,
@@ -2490,6 +2492,10 @@ ice_parse_common_caps(struct ice_hw *hw, struct ice_hw_common_caps *caps,
 			  "%s: ext_topo_dev_img_prog_en[%d] = %d\n",
 			  prefix, index,
 			  caps->ext_topo_dev_img_prog_en[index]);
+		ice_debug(hw, ICE_DBG_INIT,
+			  "%s: ext_topo_dev_img_ver_schema[%d] = %d\n",
+			  prefix, index,
+			  caps->ext_topo_dev_img_ver_schema[index]);
 		break;
 	}
 	case ICE_AQC_CAPS_TX_SCHED_TOPO_COMP_MODE:
drivers/net/ice/base/ice_type.h +2 -0
index c7ca62bea0..b2f093c84b 100644
@@ -716,6 +716,8 @@ struct ice_hw_common_caps {
 #define ICE_EXT_TOPO_DEV_IMG_LOAD_EN	BIT(0)
 	bool ext_topo_dev_img_prog_en[ICE_EXT_TOPO_DEV_IMG_COUNT];
 #define ICE_EXT_TOPO_DEV_IMG_PROG_EN	BIT(1)
+	bool ext_topo_dev_img_ver_schema[ICE_EXT_TOPO_DEV_IMG_COUNT];
+#define ICE_EXT_TOPO_DEV_IMG_VER_SCHEMA	BIT(2)
 	bool tx_sched_topo_comp_mode_en;
 };
 
Signature · 1 line
2.43.0
#24 lore raw

PATCH v2 15/148 net/ice/base: refactor (non) bitmap declarations

In reply to Anatoly Burakov

From: Ian Stokes <[email protected]>

The firmware interface definition file mistakenly started using bitmap declarations for its storage in a couple of structures. The data structure contains a "bit-map" of bits that the hardware/firmware sets or reads but it's not a DECLARE_BITMAP style bitmap and it's not accessed with the set_bit/clear_bit operators, so stop declaring them that way.

---
 drivers/net/ice/base/ice_adminq_cmd.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/ice/base/ice_adminq_cmd.h +2 -2
index a6a8210dd5..aaa4045d38 100644
@@ -796,7 +796,7 @@ struct ice_aqc_recipe_data_elem {
 struct ice_aqc_recipe_to_profile {
 	__le16 profile_id;
 	u8 rsvd[6];
-	ice_declare_bitmap(recipe_assoc, ICE_MAX_NUM_RECIPES);
+	u8 recipe_assoc[DIVIDE_AND_ROUND_UP(ICE_MAX_NUM_RECIPES, BITS_PER_BYTE)];
 };
 
 /* Add/Update/Remove/Get switch rules (indirect 0x02A0, 0x02A1, 0x02A2, 0x02A3)
@@ -972,7 +972,7 @@ struct ice_sw_rule_vsi_list {
 /* Query VSI list command/response entry */
 struct ice_sw_rule_vsi_list_query {
 	__le16 index;
-	ice_declare_bitmap(vsi_list, ICE_MAX_VSI);
+	u8 vsi_list[DIVIDE_AND_ROUND_UP(ICE_MAX_VSI, BITS_PER_BYTE)];
 };
 #pragma pack()
 
Signature · 1 line
2.43.0
#25 lore raw

PATCH v2 16/148 net/ice/base: remove unnecessary control queue cmd_buf arrays

In reply to Anatoly Burakov

From: Ian Stokes <[email protected]>

The driver allocates a cmd_buf array in addition to the desc_buf array. This array stores an ice_sq_cd command details structure for each entry in the control queue ring.

The contents of the structure are copied from the value passed in via ice_sq_send_cmd, and include only a pointer to storage for the write back descriptor contents.

Originally this array was intended to support asynchronous completion including features such as a callback function. This support was never implemented. All that exists today is needless copying and resetting of a cmd_buf array that is otherwise functionally unused.

Since we do not plan to implement asynchronous completions, drop this unnecessary memory and logic. This saves memory for each control queue, and avoids the pointless copying and memset.

---
 drivers/net/ice/base/ice_controlq.c | 27 +++------------------------
 drivers/net/ice/base/ice_controlq.h |  2 --
 2 files changed, 3 insertions(+), 26 deletions(-)
drivers/net/ice/base/ice_controlq.c +3 -24
index 7d40468aa0..cac04c6a98 100644
@@ -101,13 +101,6 @@ ice_alloc_ctrlq_sq_ring(struct ice_hw *hw, struct ice_ctl_q_info *cq)
 	if (!cq->sq.desc_buf.va)
 		return ICE_ERR_NO_MEMORY;
 
-	cq->sq.cmd_buf = ice_calloc(hw, cq->num_sq_entries,
-				    sizeof(struct ice_sq_cd));
-	if (!cq->sq.cmd_buf) {
-		ice_free_dma_mem(hw, &cq->sq.desc_buf);
-		return ICE_ERR_NO_MEMORY;
-	}
-
 	return 0;
 }
 
@@ -309,9 +302,6 @@ do {									\
 				ice_free_dma_mem((hw),			\
 					&(qi)->ring.r.ring##_bi[i]);	\
 	}								\
-	/* free the buffer info list */					\
-	if ((qi)->ring.cmd_buf)						\
-		ice_free(hw, (qi)->ring.cmd_buf);			\
 	/* free DMA head */						\
 	ice_free(hw, (qi)->ring.dma_head);				\
 } while (0)
@@ -844,21 +834,17 @@ static u16 ice_clean_sq(struct ice_hw *hw, struct ice_ctl_q_info *cq)
 {
 	struct ice_ctl_q_ring *sq = &cq->sq;
 	u16 ntc = sq->next_to_clean;
-	struct ice_sq_cd *details;
 	struct ice_aq_desc *desc;
 
 	desc = ICE_CTL_Q_DESC(*sq, ntc);
-	details = ICE_CTL_Q_DETAILS(*sq, ntc);
 
 	while (rd32(hw, cq->sq.head) != ntc) {
 		ice_debug(hw, ICE_DBG_AQ_MSG, "ntc %d head %d.\n", ntc, rd32(hw, cq->sq.head));
 		ice_memset(desc, 0, sizeof(*desc), ICE_DMA_MEM);
-		ice_memset(details, 0, sizeof(*details), ICE_NONDMA_MEM);
 		ntc++;
 		if (ntc == sq->count)
 			ntc = 0;
 		desc = ICE_CTL_Q_DESC(*sq, ntc);
-		details = ICE_CTL_Q_DETAILS(*sq, ntc);
 	}
 
 	sq->next_to_clean = ntc;
@@ -977,7 +963,6 @@ ice_sq_send_cmd_nolock(struct ice_hw *hw, struct ice_ctl_q_info *cq,
 	struct ice_dma_mem *dma_buf = NULL;
 	struct ice_aq_desc *desc_on_ring;
 	bool cmd_completed = false;
-	struct ice_sq_cd *details;
 	u32 total_delay = 0;
 	int status = 0;
 	u16 retval = 0;
@@ -1021,12 +1006,6 @@ ice_sq_send_cmd_nolock(struct ice_hw *hw, struct ice_ctl_q_info *cq,
 		goto sq_send_command_error;
 	}
 
-	details = ICE_CTL_Q_DETAILS(cq->sq, cq->sq.next_to_use);
-	if (cd)
-		*details = *cd;
-	else
-		ice_memset(details, 0, sizeof(*details), ICE_NONDMA_MEM);
-
 	/* Call clean and check queue available function to reclaim the
 	 * descriptors that were processed by FW/MBX; the function returns the
 	 * number of desc available. The clean function called here could be
@@ -1114,9 +1093,9 @@ ice_sq_send_cmd_nolock(struct ice_hw *hw, struct ice_ctl_q_info *cq,
 	ice_debug_cq(hw, cq, (void *)desc, buf, buf_size, true);
 
 	/* save writeback AQ if requested */
-	if (details->wb_desc)
-		ice_memcpy(details->wb_desc, desc_on_ring,
-			   sizeof(*details->wb_desc), ICE_DMA_TO_NONDMA);
+	if (cd && cd->wb_desc)
+		ice_memcpy(cd->wb_desc, desc_on_ring,
+			   sizeof(*cd->wb_desc), ICE_DMA_TO_NONDMA);
 
 	/* update the error if time out occurred */
 	if (!cmd_completed) {
drivers/net/ice/base/ice_controlq.h +0 -2
index 986604ec3c..5c5bb069d8 100644
@@ -43,7 +43,6 @@ enum ice_ctl_q {
 struct ice_ctl_q_ring {
 	void *dma_head;			/* Virtual address to DMA head */
 	struct ice_dma_mem desc_buf;	/* descriptor ring memory */
-	void *cmd_buf;			/* command buffer memory */
 
 	union {
 		struct ice_dma_mem *sq_bi;
@@ -73,7 +72,6 @@ struct ice_sq_cd {
 	struct ice_aq_desc *wb_desc;
 };
 
-#define ICE_CTL_Q_DETAILS(R, i) (&(((struct ice_sq_cd *)((R).cmd_buf))[i]))
 
 /* rq event information */
 struct ice_rq_event_info {
Signature · 1 line
2.43.0
#26 lore raw

PATCH v2 17/148 net/ice/base: alloc port_info only once

In reply to Anatoly Burakov

When devlink reload is called port_info should stay. Check if it wasn't already allocated before doing allocation.

---
 drivers/net/ice/base/ice_common.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/ice/base/ice_common.c +2 -1
index 9b08a10022..f88ced7a5d 100644
@@ -1006,7 +1006,8 @@ int ice_init_hw(struct ice_hw *hw)
 	if (status)
 		goto err_unroll_cqinit;
 
-	hw->port_info = (struct ice_port_info *)
+	if (!hw->port_info)
+		hw->port_info = (struct ice_port_info *)
 			ice_malloc(hw, sizeof(*hw->port_info));
 	if (!hw->port_info) {
 		status = ICE_ERR_NO_MEMORY;
Signature · 1 line
2.43.0
#27 lore raw

PATCH v2 18/148 net/ice/base: update code with flex array safe allocations

In reply to Anatoly Burakov

From: Ian Stokes <[email protected]>

The Linux Kernel is now requiring flex array safe allocations from drivers and the way that we used overlaid union structures was confusing or worse, breaking Klocwork as well as failing upstream builds that were checking -Warray-bounds.

This update was inspired by Alexander Lobakin's upstream changes to do the same, but none of the code was copied, and the changes here were all made by me.

The ice_adminq_cmd.h file changes structures due to this change and the firmware team may not want to sync up with these changes. However, none of the data formats change and will continue to work with firmware using the old layouts. It's just that after this change the shared code has provably correct usage of flexible arrays. It's possible that the firmware team no longer really needs to sync with this file anyway.

There are no binary format changes, and I noticed that a very similar change to this was made and then reverted back in 2017. However, that was before we had the STRUCT_HACK_LEN defines figured out. Now, this code compiles as well under C++ as it does under C, and all the structure length checking macros work in all cases that I can tell.

---
 drivers/net/ice/base/ice_adminq_cmd.h |  59 +++---
 drivers/net/ice/base/ice_switch.c     | 271 +++++++++++++-------------
 drivers/net/ice/base/ice_switch.h     |  12 --
 3 files changed, 166 insertions(+), 176 deletions(-)
drivers/net/ice/base/ice_adminq_cmd.h +30 -29
index aaa4045d38..3549fc28f1 100644
@@ -813,12 +813,30 @@ struct ice_aqc_sw_rules {
 	__le32 addr_low;
 };
 
+/* Add switch rule response:
+ * Content of return buffer is same as the input buffer. The status field and
+ * LUT index are updated as part of the response
+ */
+struct ice_aqc_sw_rules_elem_hdr {
+	__le16 type; /* Switch rule type, one of T_... */
+#define ICE_AQC_SW_RULES_T_LKUP_RX		0x0
+#define ICE_AQC_SW_RULES_T_LKUP_TX		0x1
+#define ICE_AQC_SW_RULES_T_LG_ACT		0x2
+#define ICE_AQC_SW_RULES_T_VSI_LIST_SET		0x3
+#define ICE_AQC_SW_RULES_T_VSI_LIST_CLEAR	0x4
+#define ICE_AQC_SW_RULES_T_PRUNE_LIST_SET	0x5
+#define ICE_AQC_SW_RULES_T_PRUNE_LIST_CLEAR	0x6
+	__le16 status;
+};
+
 /* Add/Update/Get/Remove lookup Rx/Tx command/response entry
  * This structures describes the lookup rules and associated actions. "index"
  * is returned as part of a response to a successful Add command, and can be
  * used to identify the rule for Update/Get/Remove commands.
  */
 struct ice_sw_rule_lkup_rx_tx {
+	struct ice_aqc_sw_rules_elem_hdr hdr;
+
 	__le16 recipe_id;
 #define ICE_SW_RECIPE_LOGICAL_PORT_FWD		10
 	/* Source port for LOOKUP_RX and source VSI in case of LOOKUP_TX */
@@ -895,14 +913,17 @@ struct ice_sw_rule_lkup_rx_tx {
 	 * lookup-type
 	 */
 	__le16 hdr_len;
-	u8 hdr[STRUCT_HACK_VAR_LEN];
+	u8 hdr_data[STRUCT_HACK_VAR_LEN];
 };
 
+#pragma pack(1)
 /* Add/Update/Remove large action command/response entry
  * "index" is returned as part of a response to a successful Add command, and
  * can be used to identify the action for Update/Get/Remove commands.
  */
 struct ice_sw_rule_lg_act {
+	struct ice_aqc_sw_rules_elem_hdr hdr;
+
 	__le16 index; /* Index in large action table */
 	__le16 size;
 	/* Max number of large actions */
@@ -957,16 +978,21 @@ struct ice_sw_rule_lg_act {
 #define ICE_LG_ACT_STAT_COUNT_M		(0x7F << ICE_LG_ACT_STAT_COUNT_S)
 	__le32 act[STRUCT_HACK_VAR_LEN]; /* array of size for actions */
 };
+#pragma pack()
 
+#pragma pack(1)
 /* Add/Update/Remove VSI list command/response entry
  * "index" is returned as part of a response to a successful Add command, and
  * can be used to identify the VSI list for Update/Get/Remove commands.
  */
 struct ice_sw_rule_vsi_list {
+	struct ice_aqc_sw_rules_elem_hdr hdr;
+
 	__le16 index; /* Index of VSI/Prune list */
 	__le16 number_vsi;
 	__le16 vsi[STRUCT_HACK_VAR_LEN]; /* Array of number_vsi VSI numbers */
 };
+#pragma pack()
 
 #pragma pack(1)
 /* Query VSI list command/response entry */
@@ -976,31 +1002,6 @@ struct ice_sw_rule_vsi_list_query {
 };
 #pragma pack()
 
-#pragma pack(1)
-/* Add switch rule response:
- * Content of return buffer is same as the input buffer. The status field and
- * LUT index are updated as part of the response
- */
-struct ice_aqc_sw_rules_elem {
-	__le16 type; /* Switch rule type, one of T_... */
-#define ICE_AQC_SW_RULES_T_LKUP_RX		0x0
-#define ICE_AQC_SW_RULES_T_LKUP_TX		0x1
-#define ICE_AQC_SW_RULES_T_LG_ACT		0x2
-#define ICE_AQC_SW_RULES_T_VSI_LIST_SET		0x3
-#define ICE_AQC_SW_RULES_T_VSI_LIST_CLEAR	0x4
-#define ICE_AQC_SW_RULES_T_PRUNE_LIST_SET	0x5
-#define ICE_AQC_SW_RULES_T_PRUNE_LIST_CLEAR	0x6
-	__le16 status;
-	union {
-		struct ice_sw_rule_lkup_rx_tx lkup_tx_rx;
-		struct ice_sw_rule_lg_act lg_act;
-		struct ice_sw_rule_vsi_list vsi_list;
-		struct ice_sw_rule_vsi_list_query vsi_list_query;
-	} pdata;
-};
-
-#pragma pack()
-
 /* PFC Ignore (direct 0x0301)
  * The command and response use the same descriptor structure
  */
@@ -1012,8 +1013,8 @@ struct ice_aqc_pfc_ignore {
 	u8	reserved[14];
 };
 
-/* Set PFC Mode (direct 0x0303)
- * Query PFC Mode (direct 0x0302)
+/* Query PFC Mode (direct 0x0302)
+ * Set PFC Mode (direct 0x0303)
  */
 struct ice_aqc_set_query_pfc_mode {
 	u8	pfc_mode;
@@ -2821,7 +2822,7 @@ struct ice_aqc_move_txqs_data {
 };
 
 /* Download Package (indirect 0x0C40) */
-/* Also used for Update Package (indirect 0x0C42 and 0x0C41) */
+/* Also used for Update Package (indirect 0x0C41 and 0x0C42) */
 struct ice_aqc_download_pkg {
 	u8 flags;
 #define ICE_AQC_DOWNLOAD_PKG_LAST_BUF	0x01
drivers/net/ice/base/ice_switch.c +136 -135

686 lines not on this page · raw message

drivers/net/ice/base/ice_switch.h +0 -12
index 0cf86ec965..38daab0adb 100644
@@ -71,18 +71,6 @@
 #define ICE_PROFID_IPV6_PFCP_SESSION	82
 
 #define DUMMY_ETH_HDR_LEN		16
-#define ICE_SW_RULE_RX_TX_ETH_HDR_SIZE \
-	(offsetof(struct ice_aqc_sw_rules_elem, pdata.lkup_tx_rx.hdr) + \
-	 (DUMMY_ETH_HDR_LEN * \
-	  sizeof(((struct ice_sw_rule_lkup_rx_tx *)0)->hdr[0])))
-#define ICE_SW_RULE_RX_TX_NO_HDR_SIZE \
-	(offsetof(struct ice_aqc_sw_rules_elem, pdata.lkup_tx_rx.hdr))
-#define ICE_SW_RULE_LG_ACT_SIZE(n) \
-	(offsetof(struct ice_aqc_sw_rules_elem, pdata.lg_act.act) + \
-	 ((n) * sizeof(((struct ice_sw_rule_lg_act *)0)->act[0])))
-#define ICE_SW_RULE_VSI_LIST_SIZE(n) \
-	(offsetof(struct ice_aqc_sw_rules_elem, pdata.vsi_list.vsi) + \
-	 ((n) * sizeof(((struct ice_sw_rule_vsi_list *)0)->vsi[0])))
 
 /* Worst case buffer length for ice_aqc_opc_get_res_alloc */
 #define ICE_MAX_RES_TYPES 0x80
Signature · 1 line
2.43.0
#28 lore raw

PATCH v2 19/148 net/ice/base: bring back ability to use 128 as size of PF type RSS LUT

In reply to Anatoly Burakov

From: Ian Stokes <[email protected]>

Allow PF RSS LUT to be sized 128.

Recent refactor simplified code and made it impossible.

Also clean up unused defines.

---
 drivers/net/ice/base/ice_adminq_cmd.h | 12 +++---------
 drivers/net/ice/base/ice_common.c     | 10 +++++++---
 drivers/net/ice/ice_ethdev.c          | 12 ++++++------
 3 files changed, 16 insertions(+), 18 deletions(-)
drivers/net/ice/base/ice_adminq_cmd.h +3 -9
index 3549fc28f1..ab3dfd8685 100644
@@ -2230,11 +2230,13 @@ enum ice_lut_type {
 	ICE_LUT_VSI = 0,
 	ICE_LUT_PF = 1,
 	ICE_LUT_GLOBAL = 2,
-	ICE_LUT_TYPE_MASK = 3
+	ICE_LUT_TYPE_MASK = 3,
+	ICE_LUT_PF_SMALL = 5, /* yields ICE_LUT_PF when &= ICE_LUT_TYPE_MASK */
 };
 
 enum ice_lut_size {
 	ICE_LUT_VSI_SIZE = 64,
+	ICE_LUT_PF_SMALL_SIZE = 128,
 	ICE_LUT_GLOBAL_SIZE = 512,
 	ICE_LUT_PF_SIZE = 2048,
 };
@@ -2249,19 +2251,11 @@ struct ice_aqc_get_set_rss_lut {
 #define ICE_AQC_GSET_RSS_LUT_TABLE_TYPE_M	\
 	(ICE_LUT_TYPE_MASK << ICE_AQC_GSET_RSS_LUT_TABLE_TYPE_S)
 
-#define ICE_AQC_GSET_RSS_LUT_TABLE_TYPE_VSI	 0
-#define ICE_AQC_GSET_RSS_LUT_TABLE_TYPE_PF	 1
-#define ICE_AQC_GSET_RSS_LUT_TABLE_TYPE_GLOBAL	 2
-
 #define ICE_AQC_GSET_RSS_LUT_TABLE_SIZE_S	 2
 #define ICE_AQC_GSET_RSS_LUT_TABLE_SIZE_M	 \
 	(ICE_LUT_TYPE_MASK << ICE_AQC_GSET_RSS_LUT_TABLE_SIZE_S)
 
-#define ICE_AQC_GSET_RSS_LUT_TABLE_SIZE_128	 128
-#define ICE_AQC_GSET_RSS_LUT_TABLE_SIZE_128_FLAG 0
-#define ICE_AQC_GSET_RSS_LUT_TABLE_SIZE_512	 512
 #define ICE_AQC_GSET_RSS_LUT_TABLE_SIZE_512_FLAG 1
-#define ICE_AQC_GSET_RSS_LUT_TABLE_SIZE_2K	 2048
 #define ICE_AQC_GSET_RSS_LUT_TABLE_SIZE_2K_FLAG	 2
 
 #define ICE_AQC_GSET_RSS_LUT_GLOBAL_IDX_S	 4
drivers/net/ice/base/ice_common.c +7 -3
index f88ced7a5d..34a4b74956 100644
@@ -4143,6 +4143,8 @@ static u16 ice_lut_type_to_size(u16 lut_type)
 		return ICE_LUT_GLOBAL_SIZE;
 	case ICE_LUT_PF:
 		return ICE_LUT_PF_SIZE;
+	case ICE_LUT_PF_SMALL:
+		return ICE_LUT_PF_SMALL_SIZE;
 	default:
 		return 0;
 	}
@@ -4174,6 +4176,8 @@ int ice_lut_size_to_type(int lut_size)
 		return ICE_LUT_GLOBAL;
 	case ICE_LUT_PF_SIZE:
 		return ICE_LUT_PF;
+	case ICE_LUT_PF_SMALL_SIZE:
+		return ICE_LUT_PF_SMALL;
 	default:
 		return -1;
 	}
@@ -4201,10 +4205,10 @@ __ice_aq_get_set_rss_lut(struct ice_hw *hw, struct ice_aq_get_set_rss_lut_params
 
 	vsi_handle = params->vsi_handle;
 	lut = params->lut;
-	lut_type = params->lut_type;
-	lut_size = ice_lut_type_to_size(lut_type);
+	lut_size = ice_lut_type_to_size(params->lut_type);
+	lut_type = params->lut_type & ICE_LUT_TYPE_MASK;
 	cmd_resp = &desc.params.get_set_rss_lut;
-	if (lut_type == ICE_AQC_GSET_RSS_LUT_TABLE_TYPE_GLOBAL)
+	if (lut_type == ICE_LUT_GLOBAL)
 		glob_lut_idx = params->global_lut_id;
 
 	if (!lut || !lut_size || !ice_is_vsi_valid(hw, vsi_handle))
drivers/net/ice/ice_ethdev.c +6 -6
index 87385d2649..56adc3a3d9 100644
@@ -3468,7 +3468,7 @@ static int ice_init_rss(struct ice_pf *pf)
 
 	lut_params.vsi_handle = vsi->idx;
 	lut_params.lut_size = vsi->rss_lut_size;
-	lut_params.lut_type = ICE_AQC_GSET_RSS_LUT_TABLE_TYPE_PF;
+	lut_params.lut_type = ICE_LUT_PF;
 	lut_params.lut = vsi->rss_lut;
 	lut_params.global_lut_id = 0;
 	ret = ice_aq_set_rss_lut(hw, &lut_params);
@@ -4928,7 +4928,7 @@ ice_get_rss_lut(struct ice_vsi *vsi, uint8_t *lut, uint16_t lut_size)
 	if (pf->flags & ICE_FLAG_RSS_AQ_CAPABLE) {
 		lut_params.vsi_handle = vsi->idx;
 		lut_params.lut_size = lut_size;
-		lut_params.lut_type = ICE_AQC_GSET_RSS_LUT_TABLE_TYPE_PF;
+		lut_params.lut_type = ICE_LUT_PF;
 		lut_params.lut = lut;
 		lut_params.global_lut_id = 0;
 		ret = ice_aq_get_rss_lut(hw, &lut_params);
@@ -4964,7 +4964,7 @@ ice_set_rss_lut(struct ice_vsi *vsi, uint8_t *lut, uint16_t lut_size)
 	if (pf->flags & ICE_FLAG_RSS_AQ_CAPABLE) {
 		lut_params.vsi_handle = vsi->idx;
 		lut_params.lut_size = lut_size;
-		lut_params.lut_type = ICE_AQC_GSET_RSS_LUT_TABLE_TYPE_PF;
+		lut_params.lut_type = ICE_LUT_PF;
 		lut_params.lut = lut;
 		lut_params.global_lut_id = 0;
 		ret = ice_aq_set_rss_lut(hw, &lut_params);
@@ -4996,9 +4996,9 @@ ice_rss_reta_update(struct rte_eth_dev *dev,
 	uint8_t *lut;
 	int ret;
 
-	if (reta_size != ICE_AQC_GSET_RSS_LUT_TABLE_SIZE_128 &&
-	    reta_size != ICE_AQC_GSET_RSS_LUT_TABLE_SIZE_512 &&
-	    reta_size != ICE_AQC_GSET_RSS_LUT_TABLE_SIZE_2K) {
+	if (reta_size != ICE_LUT_PF_SMALL_SIZE  &&
+	    reta_size != ICE_LUT_GLOBAL_SIZE  &&
+	    reta_size != ICE_LUT_PF_SIZE) {
 		PMD_DRV_LOG(ERR,
 			    "The size of hash lookup table configured (%d)"
 			    "doesn't match the number hardware can "
Signature · 1 line
2.43.0
#29 lore raw

Re: [PATCH v2 019/148] net/ice/base: bring back ability to use 128 as size of PF type RSS LUT

Quoted 22 lines · Anatoly Burakov

From: Ian Stokes <[email protected]>

Allow PF RSS LUT to be sized 128.

Recent refactor simplified code and made it impossible.

Also clean up unused defines.

---
  drivers/net/ice/base/ice_adminq_cmd.h | 12 +++---------
  drivers/net/ice/base/ice_common.c     | 10 +++++++---
  drivers/net/ice/ice_ethdev.c          | 12 ++++++------
  3 files changed, 16 insertions(+), 18 deletions(-)
drivers/net/ice/base/ice_adminq_cmd.h +0 -0
index 3549fc28f1..ab3dfd8685 100644
@@ -2230,11 +2230,13 @@ enum ice_lut_type {
  	ICE_LUT_VSI = 0,

drivers/net/ice/base/ice_adminq_cmd.h enum ice_lut_type { · line 2239

Quoted 10 lines
drivers/net/ice/base/ice_adminq_cmd.h +3 -1
  	ICE_LUT_PF = 1,
  	ICE_LUT_GLOBAL = 2,
-	ICE_LUT_TYPE_MASK = 3
+	ICE_LUT_TYPE_MASK = 3,
+	ICE_LUT_PF_SMALL = 5, /* yields ICE_LUT_PF when &= ICE_LUT_TYPE_MASK */
  };
 
  enum ice_lut_size {
  	ICE_LUT_VSI_SIZE = 64,
+	ICE_LUT_PF_SMALL_SIZE = 128,

This size is disallowed for both "upstream kernel ice" and "OOT ice", I added it only for Windows, so please disallow it.

Quoted 28 lines
drivers/net/ice/base/ice_adminq_cmd.h +0 -8
  	ICE_LUT_GLOBAL_SIZE = 512,
  	ICE_LUT_PF_SIZE = 2048,
  };
@@ -2249,19 +2251,11 @@ struct ice_aqc_get_set_rss_lut {
  #define ICE_AQC_GSET_RSS_LUT_TABLE_TYPE_M	\
  	(ICE_LUT_TYPE_MASK << ICE_AQC_GSET_RSS_LUT_TABLE_TYPE_S)
 
-#define ICE_AQC_GSET_RSS_LUT_TABLE_TYPE_VSI	 0
-#define ICE_AQC_GSET_RSS_LUT_TABLE_TYPE_PF	 1
-#define ICE_AQC_GSET_RSS_LUT_TABLE_TYPE_GLOBAL	 2
-
  #define ICE_AQC_GSET_RSS_LUT_TABLE_SIZE_S	 2
  #define ICE_AQC_GSET_RSS_LUT_TABLE_SIZE_M	 \
  	(ICE_LUT_TYPE_MASK << ICE_AQC_GSET_RSS_LUT_TABLE_SIZE_S)
 
-#define ICE_AQC_GSET_RSS_LUT_TABLE_SIZE_128	 128
-#define ICE_AQC_GSET_RSS_LUT_TABLE_SIZE_128_FLAG 0
-#define ICE_AQC_GSET_RSS_LUT_TABLE_SIZE_512	 512
  #define ICE_AQC_GSET_RSS_LUT_TABLE_SIZE_512_FLAG 1
-#define ICE_AQC_GSET_RSS_LUT_TABLE_SIZE_2K	 2048
  #define ICE_AQC_GSET_RSS_LUT_TABLE_SIZE_2K_FLAG	 2
 
  #define ICE_AQC_GSET_RSS_LUT_GLOBAL_IDX_S	 4
drivers/net/ice/base/ice_common.c +0 -0
index f88ced7a5d..34a4b74956 100644

drivers/net/ice/base/ice_common.c static u16 ice_lut_type_to_size(u16 lut_type) · line 4147

Quoted 5 lines
drivers/net/ice/base/ice_common.c +2 -0
@@ -4143,6 +4143,8 @@ static u16 ice_lut_type_to_size(u16 lut_type)
  		return ICE_LUT_GLOBAL_SIZE;
  	case ICE_LUT_PF:
  		return ICE_LUT_PF_SIZE;
+	case ICE_LUT_PF_SMALL:
+		return ICE_LUT_PF_SMALL_SIZE;

removing this two lines would do what I want
(but then you have to replace the title, as 128 will be disallowed)

Quoted 58 lines
drivers/net/ice/base/ice_common.c +5 -3
  	default:
  		return 0;
  	}
@@ -4174,6 +4176,8 @@ int ice_lut_size_to_type(int lut_size)
  		return ICE_LUT_GLOBAL;
  	case ICE_LUT_PF_SIZE:
  		return ICE_LUT_PF;
+	case ICE_LUT_PF_SMALL_SIZE:
+		return ICE_LUT_PF_SMALL;
  	default:
  		return -1;
  	}
@@ -4201,10 +4205,10 @@ __ice_aq_get_set_rss_lut(struct ice_hw *hw, struct ice_aq_get_set_rss_lut_params
 
  	vsi_handle = params->vsi_handle;
  	lut = params->lut;
-	lut_type = params->lut_type;
-	lut_size = ice_lut_type_to_size(lut_type);
+	lut_size = ice_lut_type_to_size(params->lut_type);
+	lut_type = params->lut_type & ICE_LUT_TYPE_MASK;
  	cmd_resp = &desc.params.get_set_rss_lut;
-	if (lut_type == ICE_AQC_GSET_RSS_LUT_TABLE_TYPE_GLOBAL)
+	if (lut_type == ICE_LUT_GLOBAL)
  		glob_lut_idx = params->global_lut_id;
 
  	if (!lut || !lut_size || !ice_is_vsi_valid(hw, vsi_handle))
drivers/net/ice/ice_ethdev.c +3 -3
index 87385d2649..56adc3a3d9 100644
@@ -3468,7 +3468,7 @@ static int ice_init_rss(struct ice_pf *pf)
 
  	lut_params.vsi_handle = vsi->idx;
  	lut_params.lut_size = vsi->rss_lut_size;
-	lut_params.lut_type = ICE_AQC_GSET_RSS_LUT_TABLE_TYPE_PF;
+	lut_params.lut_type = ICE_LUT_PF;
  	lut_params.lut = vsi->rss_lut;
  	lut_params.global_lut_id = 0;
  	ret = ice_aq_set_rss_lut(hw, &lut_params);
@@ -4928,7 +4928,7 @@ ice_get_rss_lut(struct ice_vsi *vsi, uint8_t *lut, uint16_t lut_size)
  	if (pf->flags & ICE_FLAG_RSS_AQ_CAPABLE) {
  		lut_params.vsi_handle = vsi->idx;
  		lut_params.lut_size = lut_size;
-		lut_params.lut_type = ICE_AQC_GSET_RSS_LUT_TABLE_TYPE_PF;
+		lut_params.lut_type = ICE_LUT_PF;
  		lut_params.lut = lut;
  		lut_params.global_lut_id = 0;
  		ret = ice_aq_get_rss_lut(hw, &lut_params);
@@ -4964,7 +4964,7 @@ ice_set_rss_lut(struct ice_vsi *vsi, uint8_t *lut, uint16_t lut_size)
  	if (pf->flags & ICE_FLAG_RSS_AQ_CAPABLE) {
  		lut_params.vsi_handle = vsi->idx;
  		lut_params.lut_size = lut_size;
-		lut_params.lut_type = ICE_AQC_GSET_RSS_LUT_TABLE_TYPE_PF;
+		lut_params.lut_type = ICE_LUT_PF;
  		lut_params.lut = lut;
  		lut_params.global_lut_id = 0;
  		ret = ice_aq_set_rss_lut(hw, &lut_params);

drivers/net/ice/ice_ethdev.c ice_rss_reta_update(struct rte_eth_dev *dev, · line 4999

Quoted 7 lines
drivers/net/ice/ice_ethdev.c +1 -3
@@ -4996,9 +4996,9 @@ ice_rss_reta_update(struct rte_eth_dev *dev,
  	uint8_t *lut;
  	int ret;
 
-	if (reta_size != ICE_AQC_GSET_RSS_LUT_TABLE_SIZE_128 &&
-	    reta_size != ICE_AQC_GSET_RSS_LUT_TABLE_SIZE_512 &&
-	    reta_size != ICE_AQC_GSET_RSS_LUT_TABLE_SIZE_2K) {
+	if (reta_size != ICE_LUT_PF_SMALL_SIZE  &&

perhaps this one too,
but only if you agree

Quoted 5 lines
drivers/net/ice/ice_ethdev.c +2 -0
+	    reta_size != ICE_LUT_GLOBAL_SIZE  &&
+	    reta_size != ICE_LUT_PF_SIZE) {
  		PMD_DRV_LOG(ERR,
  			    "The size of hash lookup table configured (%d)"
  			    "doesn't match the number hardware can "
#30 lore raw

PATCH v2 20/148 net/ice/base: support for OROM update in recovery mode

In reply to Anatoly Burakov

From: Ian Stokes <[email protected]>

OROM update in recovery mode is allowed or not based on function capability 0x0090. This patch adds capability parsing for it.

---
 drivers/net/ice/base/ice_adminq_cmd.h | 1 +
 drivers/net/ice/base/ice_common.c     | 5 +++++
 drivers/net/ice/base/ice_type.h       | 2 ++
 3 files changed, 8 insertions(+)
drivers/net/ice/base/ice_adminq_cmd.h +1 -0
index ab3dfd8685..fe82df747c 100644
@@ -129,6 +129,7 @@ struct ice_aqc_list_caps_elem {
 #define ICE_AQC_CAPS_EXT_TOPO_DEV_IMG3			0x0084
 #define ICE_AQC_CAPS_TX_SCHED_TOPO_COMP_MODE		0x0085
 #define ICE_AQC_CAPS_NAC_TOPOLOGY			0x0087
+#define ICE_AQC_CAPS_OROM_RECOVERY_UPDATE		0x0090
 #define ICE_AQC_CAPS_ROCEV2_LAG				0x0092
 
 	u8 major_ver;
drivers/net/ice/base/ice_common.c +5 -0
index 34a4b74956..ca9a6baef7 100644
@@ -2502,6 +2502,11 @@ ice_parse_common_caps(struct ice_hw *hw, struct ice_hw_common_caps *caps,
 	case ICE_AQC_CAPS_TX_SCHED_TOPO_COMP_MODE:
 		caps->tx_sched_topo_comp_mode_en = (number == 1);
 		break;
+	case ICE_AQC_CAPS_OROM_RECOVERY_UPDATE:
+		caps->orom_recovery_update = (number == 1);
+		ice_debug(hw, ICE_DBG_INIT, "%s: orom_recovery_update = %d\n",
+			  prefix, caps->orom_recovery_update);
+		break;
 	default:
 		/* Not one of the recognized common capabilities */
 		found = false;
drivers/net/ice/base/ice_type.h +2 -0
index b2f093c84b..239b1a018e 100644
@@ -719,6 +719,8 @@ struct ice_hw_common_caps {
 	bool ext_topo_dev_img_ver_schema[ICE_EXT_TOPO_DEV_IMG_COUNT];
 #define ICE_EXT_TOPO_DEV_IMG_VER_SCHEMA	BIT(2)
 	bool tx_sched_topo_comp_mode_en;
+	/* Support for OROM update in Recovery Mode */
+	bool orom_recovery_update;
 };
 
 /* IEEE 1588 TIME_SYNC specific info */
Signature · 1 line
2.43.0
#31 lore raw

PATCH v2 21/148 net/ice/base: code adjustments for E830

In reply to Anatoly Burakov

From: Ian Stokes <[email protected]>

Adjustments required for E830 code base where other platforms may need to be recognised. Changes are included here to reduced diff between here and upstream.

Also include minor comment adjustment.

---
 drivers/net/ice/base/ice_common.c | 10 ++++++----
 drivers/net/ice/base/ice_switch.c |  2 +-
 2 files changed, 7 insertions(+), 5 deletions(-)
drivers/net/ice/base/ice_common.c +6 -4
index ca9a6baef7..4a2421a896 100644
@@ -1209,7 +1209,7 @@ int ice_check_reset(struct ice_hw *hw)
  */
 static int ice_pf_reset(struct ice_hw *hw)
 {
-	u32 cnt, reg;
+	u32 cnt, reg, reset_wait_cnt, cfg_lock_timeout;
 
 	/* If at function entry a global reset was already in progress, i.e.
 	 * state is not 'device active' or any of the reset done bits are not
@@ -1234,8 +1234,10 @@ static int ice_pf_reset(struct ice_hw *hw)
 	 * timeout plus the PFR timeout which will account for a possible reset
 	 * that is occurring during a download package operation.
 	 */
-	for (cnt = 0; cnt < ICE_GLOBAL_CFG_LOCK_TIMEOUT +
-	     ICE_PF_RESET_WAIT_COUNT; cnt++) {
+	reset_wait_cnt = ICE_PF_RESET_WAIT_COUNT;
+	cfg_lock_timeout = ICE_GLOBAL_CFG_LOCK_TIMEOUT;
+
+	for (cnt = 0; cnt < cfg_lock_timeout + reset_wait_cnt; cnt++) {
 		reg = rd32(hw, PFGEN_CTRL);
 		if (!(reg & PFGEN_CTRL_PFSWR_M))
 			break;
@@ -1243,7 +1245,7 @@ static int ice_pf_reset(struct ice_hw *hw)
 		ice_msec_delay(1, true);
 	}
 
-	if (cnt == ICE_PF_RESET_WAIT_COUNT) {
+	if (cnt == cfg_lock_timeout + reset_wait_cnt) {
 		ice_debug(hw, ICE_DBG_INIT, "PF reset polling failed to complete.\n");
 		return ICE_ERR_RESET_FAILED;
 	}
drivers/net/ice/base/ice_switch.c +1 -1
index 73b4a8675e..448ec26fe2 100644
@@ -9483,7 +9483,7 @@ ice_add_adv_rule(struct ice_hw *hw, struct ice_adv_lkup_elem *lkups,
 		goto err_ice_add_adv_rule;
 	}
 
-	/* set the rule LOOKUP type based on caller specified 'Rx'
+	/* Set the rule LOOKUP type based on caller specified 'Rx'
 	 * instead of hardcoding it to be either LOOKUP_TX/RX
 	 *
 	 * for 'Rx' set the source to be the port number
Signature · 1 line
2.43.0
#32 lore raw

PATCH v2 22/148 net/ice/base: improve find recipe routine

In reply to Anatoly Burakov

From: Ian Stokes <[email protected]>

Return error if there were no recipes found.

---
 drivers/net/ice/base/ice_switch.c | 5 +++++
 1 file changed, 5 insertions(+)
drivers/net/ice/base/ice_switch.c +5 -0
index 448ec26fe2..db9b021035 100644
@@ -2457,6 +2457,11 @@ ice_get_recp_frm_fw(struct ice_hw *hw, struct ice_sw_recipe *recps, u8 rid,
 	if (status)
 		goto err_unroll;
 
+	if (!num_recps) {
+		status = ICE_ERR_PARAM;
+		goto err_unroll;
+	}
+
 	/* Get recipe to profile map so that we can get the fv from lkups that
 	 * we read for a recipe from FW. Since we want to minimize the number of
 	 * times we make this FW call, just make one call and cache the copy
Signature · 1 line
2.43.0
#33 lore raw

PATCH v2 23/148 net/ice/base: fix memory leak when checking firmware version

In reply to Anatoly Burakov

From: Ian Stokes <[email protected]>

If ice_cfg_phy_fec() goes through case ICE_FEC_DIS_AUTO but the underlying device firmware isn't the correct version, then the memory used to hold the PHY capabilities output from the firmware isn't freed.

Fix this by making sure the memory is freed by jumping to the label that frees the memory instead of returning from the version check immediately.

---
 drivers/net/ice/base/ice_common.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/net/ice/base/ice_common.c +4 -2
index 4a2421a896..c3d429828d 100644
@@ -3845,8 +3845,10 @@ ice_cfg_phy_fec(struct ice_port_info *pi, struct ice_aqc_set_phy_cfg_data *cfg,
 		break;
 	case ICE_FEC_DIS_AUTO:
 		/* Set No FEC and auto FEC */
-		if (!ice_fw_supports_fec_dis_auto(hw))
-			return ICE_ERR_NOT_SUPPORTED;
+		if (!ice_fw_supports_fec_dis_auto(hw)) {
+			status = ICE_ERR_NOT_SUPPORTED;
+			goto out;
+		}
 		cfg->link_fec_opt |= ICE_AQC_PHY_FEC_DIS;
 		/* fall-through */
 	case ICE_FEC_AUTO:
Signature · 1 line
2.43.0
#34 lore raw

PATCH v2 24/148 net/ice/base: add LL Tx timestamp interrupt read

In reply to Anatoly Burakov

From: Ian Stokes <[email protected]>

E810 products can support low latency Tx timestamp register read using the SW interrupt from the FW. Add a check for the device capability and use the new method if supported.

---
 drivers/net/ice/base/ice_common.c | 3 +++
 drivers/net/ice/base/ice_ptp_hw.h | 1 +
 drivers/net/ice/base/ice_type.h   | 2 ++
 3 files changed, 6 insertions(+)
drivers/net/ice/base/ice_common.c +3 -0
index c3d429828d..1f98034c55 100644
@@ -2783,6 +2783,7 @@ ice_parse_1588_dev_caps(struct ice_hw *hw, struct ice_hw_dev_caps *dev_p,
 	info->tmr1_ena = ((number & ICE_TS_TMR1_ENA_M) != 0);
 
 	info->ts_ll_read = ((number & ICE_TS_LL_TX_TS_READ_M) != 0);
+	info->ts_ll_int_read = ((number & ICE_TS_LL_TX_TS_INT_READ_M) != 0);
 
 	info->tmr_own_map = phys_id;
 
@@ -2802,6 +2803,8 @@ ice_parse_1588_dev_caps(struct ice_hw *hw, struct ice_hw_dev_caps *dev_p,
 		  info->tmr1_ena);
 	ice_debug(hw, ICE_DBG_INIT, "dev caps: ts_ll_read = %u\n",
 		  info->ts_ll_read);
+	ice_debug(hw, ICE_DBG_INIT, "dev caps: ts_ll_int_read = %u\n",
+		  info->ts_ll_int_read);
 	ice_debug(hw, ICE_DBG_INIT, "dev caps: tmr_own_map = %u\n",
 		  info->tmr_own_map);
 }
drivers/net/ice/base/ice_ptp_hw.h +1 -0
index 35ab9bb3e8..441ad0b77d 100644
@@ -489,6 +489,7 @@ int ice_ptp_init_phy_cfg(struct ice_hw *hw);
 
 /* Tx timestamp low latency read definitions */
 #define TS_LL_READ_RETRIES		200
+#define TS_LL_READ_TS_INTR		BIT(30)
 #define TS_LL_READ_TS			BIT(31)
 #define TS_LL_READ_TS_IDX_S		24
 #define TS_LL_READ_TS_IDX_M		MAKEMASK(0x3F, 0)
drivers/net/ice/base/ice_type.h +2 -0
index 239b1a018e..7a1471e474 100644
@@ -778,6 +778,7 @@ struct ice_ts_func_info {
 #define ICE_TS_TMR0_ENA_M		BIT(25)
 #define ICE_TS_TMR1_ENA_M		BIT(26)
 #define ICE_TS_LL_TX_TS_READ_M		BIT(28)
+#define ICE_TS_LL_TX_TS_INT_READ_M	BIT(29)
 
 struct ice_ts_dev_info {
 	/* Device specific info */
@@ -790,6 +791,7 @@ struct ice_ts_dev_info {
 	u8 tmr0_ena : 1;
 	u8 tmr1_ena : 1;
 	u8 ts_ll_read : 1;
+	u8 ts_ll_int_read : 1;
 };
 
 #define ICE_NAC_TOPO_PRIMARY_M	BIT(0)
Signature · 1 line
2.43.0
#35 lore raw

PATCH v2 25/148 net/ice/base: use model-dependent number of PHY ports

In reply to Anatoly Burakov

From: Ian Stokes <[email protected]>

Set up and use model-dependent number of PHY ports.

Also fix iterations over PTP ports.

Define 'max_phy_port', a new ice_hw struct member to store the max port number handled by given clock owner. Replace 'phy_ports' with 'max_phy_port' for max range in iterations over PTP ports in case of ETH56G based devices.

---
 drivers/net/ice/base/ice_ptp_hw.c | 2 ++
 drivers/net/ice/base/ice_type.h   | 2 ++
 2 files changed, 4 insertions(+)
drivers/net/ice/base/ice_ptp_hw.c +2 -0
index 8ce803bfb3..5ce48250b4 100644
@@ -1814,6 +1814,8 @@ ice_ptp_init_phy_cfg(struct ice_hw *hw)
 		hw->phy_cfg = ICE_PHY_E810;
 	else
 		hw->phy_cfg = ICE_PHY_E822;
+	hw->phy_ports = ICE_NUM_EXTERNAL_PORTS;
+	hw->max_phy_port = ICE_NUM_EXTERNAL_PORTS;
 
 	return 0;
 }
drivers/net/ice/base/ice_type.h +2 -0
index 7a1471e474..48f892bfd3 100644
@@ -1260,6 +1260,8 @@ struct ice_hw {
 
 	u8 pf_id;		/* device profile info */
 	enum ice_phy_cfg phy_cfg;
+	u8 phy_ports;
+	u8 max_phy_port;
 	u8 logical_pf_id;
 
 	u16 max_burst_size;	/* driver sets this value */
Signature · 1 line
2.43.0
#36 lore raw

Re: [PATCH v2 025/148] net/ice/base: use model-dependent number of PHY ports

Quoted 5 lines · Anatoly Burakov

From: Ian Stokes <[email protected]>

Set up and use model-dependent number of PHY ports.

Also fix iterations over PTP ports.

Don't see this code making it into this patch. Just see the new variables discussed below.

/Bruce

Quoted 42 lines

Define 'max_phy_port', a new ice_hw struct member to store the max port number handled by given clock owner. Replace 'phy_ports' with 'max_phy_port' for max range in iterations over PTP ports in case of ETH56G based devices.

---
 drivers/net/ice/base/ice_ptp_hw.c | 2 ++
 drivers/net/ice/base/ice_type.h   | 2 ++
 2 files changed, 4 insertions(+)
drivers/net/ice/base/ice_ptp_hw.c +2 -0
index 8ce803bfb3..5ce48250b4 100644
@@ -1814,6 +1814,8 @@ ice_ptp_init_phy_cfg(struct ice_hw *hw)
 		hw->phy_cfg = ICE_PHY_E810;
 	else
 		hw->phy_cfg = ICE_PHY_E822;
+	hw->phy_ports = ICE_NUM_EXTERNAL_PORTS;
+	hw->max_phy_port = ICE_NUM_EXTERNAL_PORTS;
 
 	return 0;
 }
drivers/net/ice/base/ice_type.h +2 -0
index 7a1471e474..48f892bfd3 100644
@@ -1260,6 +1260,8 @@ struct ice_hw {
 
 	u8 pf_id;		/* device profile info */
 	enum ice_phy_cfg phy_cfg;
+	u8 phy_ports;
+	u8 max_phy_port;
 	u8 logical_pf_id;
 
 	u16 max_burst_size;	/* driver sets this value */
Signature · 1 line
2.43.0
#37 lore raw

PATCH v2 26/148 net/ice/base: use ice_bitmap_t in promisc functions

In reply to Anatoly Burakov

From: Ian Stokes <[email protected]>

Currently all functions related to promiscuous modes use u8 bit mask. All 8 bits are utilized already and to be able to add any new flag, all the drivers need to comply.

To address that, change u8 into ice_bitmap_t and use dedicated functions to process it.

---
 drivers/net/ice/base/ice_switch.c | 159 ++++++++++++++++++------------
 drivers/net/ice/base/ice_switch.h |  38 +++----
 drivers/net/ice/ice_ethdev.c      |  24 ++---
 3 files changed, 127 insertions(+), 94 deletions(-)
drivers/net/ice/base/ice_switch.c +95 -64
index db9b021035..9cb5b67699 100644
@@ -6152,34 +6152,38 @@ ice_add_to_vsi_fltr_list(struct ice_hw *hw, u16 vsi_handle,
 /**
  * ice_determine_promisc_mask
  * @fi: filter info to parse
+ * @promisc_mask: pointer to mask to be filled in
  *
  * Helper function to determine which ICE_PROMISC_ mask corresponds
  * to given filter into.
  */
-static u8 ice_determine_promisc_mask(struct ice_fltr_info *fi)
+static void ice_determine_promisc_mask(struct ice_fltr_info *fi,
+				       ice_bitmap_t *promisc_mask)
 {
 	u16 vid = fi->l_data.mac_vlan.vlan_id;
 	u8 *macaddr = fi->l_data.mac.mac_addr;
 	bool is_tx_fltr = false;
-	u8 promisc_mask = 0;
+
+	ice_zero_bitmap(promisc_mask, ICE_PROMISC_MAX);
 
 	if (fi->flag == ICE_FLTR_TX)
 		is_tx_fltr = true;
 
-	if (IS_BROADCAST_ETHER_ADDR(macaddr))
-		promisc_mask |= is_tx_fltr ?
-			ICE_PROMISC_BCAST_TX : ICE_PROMISC_BCAST_RX;
-	else if (IS_MULTICAST_ETHER_ADDR(macaddr))
-		promisc_mask |= is_tx_fltr ?
-			ICE_PROMISC_MCAST_TX : ICE_PROMISC_MCAST_RX;
-	else if (IS_UNICAST_ETHER_ADDR(macaddr))
-		promisc_mask |= is_tx_fltr ?
-			ICE_PROMISC_UCAST_TX : ICE_PROMISC_UCAST_RX;
-	if (vid)
-		promisc_mask |= is_tx_fltr ?
-			ICE_PROMISC_VLAN_TX : ICE_PROMISC_VLAN_RX;
+	if (IS_BROADCAST_ETHER_ADDR(macaddr)) {
+		ice_set_bit(is_tx_fltr ? ICE_PROMISC_BCAST_TX
+				       : ICE_PROMISC_BCAST_RX, promisc_mask);
+	} else if (IS_MULTICAST_ETHER_ADDR(macaddr)) {
+		ice_set_bit(is_tx_fltr ? ICE_PROMISC_MCAST_TX
+				       : ICE_PROMISC_MCAST_RX, promisc_mask);
+	} else if (IS_UNICAST_ETHER_ADDR(macaddr)) {
+		ice_set_bit(is_tx_fltr ? ICE_PROMISC_UCAST_TX
+				       : ICE_PROMISC_UCAST_RX, promisc_mask);
+	}
 
-	return promisc_mask;
+	if (vid) {
+		ice_set_bit(is_tx_fltr ? ICE_PROMISC_VLAN_TX
+				       : ICE_PROMISC_VLAN_RX, promisc_mask);
+	}
 }
 
 /**
@@ -6192,10 +6196,11 @@ static u8 ice_determine_promisc_mask(struct ice_fltr_info *fi)
  * @lkup: switch rule filter lookup type
  */
 static int
-_ice_get_vsi_promisc(struct ice_hw *hw, u16 vsi_handle, u8 *promisc_mask,
-		     u16 *vid, struct ice_switch_info *sw,
-		     enum ice_sw_lkup_type lkup)
+_ice_get_vsi_promisc(struct ice_hw *hw, u16 vsi_handle,
+		     ice_bitmap_t *promisc_mask, u16 *vid,
+		     struct ice_switch_info *sw, enum ice_sw_lkup_type lkup)
 {
+	ice_declare_bitmap(fltr_promisc_mask, ICE_PROMISC_MAX);
 	struct ice_fltr_mgmt_list_entry *itr;
 	struct LIST_HEAD_TYPE *rule_head;
 	struct ice_lock *rule_lock;	/* Lock to protect filter rule list */
@@ -6205,10 +6210,11 @@ _ice_get_vsi_promisc(struct ice_hw *hw, u16 vsi_handle, u8 *promisc_mask,
 		return ICE_ERR_PARAM;
 
 	*vid = 0;
-	*promisc_mask = 0;
 	rule_head = &sw->recp_list[lkup].filt_rules;
 	rule_lock = &sw->recp_list[lkup].filt_rule_lock;
 
+	ice_zero_bitmap(promisc_mask, ICE_PROMISC_MAX);
+
 	ice_acquire_lock(rule_lock);
 	LIST_FOR_EACH_ENTRY(itr, rule_head,
 			    ice_fltr_mgmt_list_entry, list_entry) {
@@ -6218,7 +6224,9 @@ _ice_get_vsi_promisc(struct ice_hw *hw, u16 vsi_handle, u8 *promisc_mask,
 		if (!ice_vsi_uses_fltr(itr, vsi_handle))
 			continue;
 
-		*promisc_mask |= ice_determine_promisc_mask(&itr->fltr_info);
+		ice_determine_promisc_mask(&itr->fltr_info, fltr_promisc_mask);
+		ice_or_bitmap(promisc_mask, promisc_mask, fltr_promisc_mask,
+			      ICE_PROMISC_MAX);
 	}
 	ice_release_lock(rule_lock);
 
@@ -6233,9 +6241,12 @@ _ice_get_vsi_promisc(struct ice_hw *hw, u16 vsi_handle, u8 *promisc_mask,
  * @vid: VLAN ID of promisc VLAN VSI
  */
 int
-ice_get_vsi_promisc(struct ice_hw *hw, u16 vsi_handle, u8 *promisc_mask,
-		    u16 *vid)
+ice_get_vsi_promisc(struct ice_hw *hw, u16 vsi_handle,
+		    ice_bitmap_t *promisc_mask, u16 *vid)
 {
+	if (!vid || !promisc_mask || !hw)
+		return ICE_ERR_PARAM;
+
 	return _ice_get_vsi_promisc(hw, vsi_handle, promisc_mask,
 				    vid, hw->switch_info, ICE_SW_LKUP_PROMISC);
 }
@@ -6248,8 +6259,8 @@ ice_get_vsi_promisc(struct ice_hw *hw, u16 vsi_handle, u8 *promisc_mask,
  * @vid: VLAN ID of promisc VLAN VSI
  */
 int
-ice_get_vsi_vlan_promisc(struct ice_hw *hw, u16 vsi_handle, u8 *promisc_mask,
-			 u16 *vid)
+ice_get_vsi_vlan_promisc(struct ice_hw *hw, u16 vsi_handle,
+			 ice_bitmap_t *promisc_mask, u16 *vid)
 {
 	return _ice_get_vsi_promisc(hw, vsi_handle, promisc_mask,
 				    vid, hw->switch_info,
@@ -6284,14 +6295,17 @@ ice_remove_promisc(struct ice_hw *hw, u8 recp_id,
  * _ice_clear_vsi_promisc - clear specified promiscuous mode(s)
  * @hw: pointer to the hardware structure
  * @vsi_handle: VSI handle to clear mode
- * @promisc_mask: mask of promiscuous config bits to clear
+ * @promisc_mask: pointer to mask of promiscuous config bits to clear
  * @vid: VLAN ID to clear VLAN promiscuous
  * @sw: pointer to switch info struct for which function add rule
  */
 static int
-_ice_clear_vsi_promisc(struct ice_hw *hw, u16 vsi_handle, u8 promisc_mask,
-		       u16 vid, struct ice_switch_info *sw)
+_ice_clear_vsi_promisc(struct ice_hw *hw, u16 vsi_handle,
+		       ice_bitmap_t *promisc_mask, u16 vid,
+		       struct ice_switch_info *sw)
 {
+	ice_declare_bitmap(compl_promisc_mask, ICE_PROMISC_MAX);
+	ice_declare_bitmap(fltr_promisc_mask, ICE_PROMISC_MAX);
 	struct ice_fltr_list_entry *fm_entry, *tmp;
 	struct LIST_HEAD_TYPE remove_list_head;
 	struct ice_fltr_mgmt_list_entry *itr;
@@ -6303,7 +6317,8 @@ _ice_clear_vsi_promisc(struct ice_hw *hw, u16 vsi_handle, u8 promisc_mask,
 	if (!ice_is_vsi_valid(hw, vsi_handle))
 		return ICE_ERR_PARAM;
 
-	if (promisc_mask & (ICE_PROMISC_VLAN_RX | ICE_PROMISC_VLAN_TX))
+	if (ice_is_bit_set(promisc_mask, ICE_PROMISC_VLAN_RX) &&
+	    ice_is_bit_set(promisc_mask, ICE_PROMISC_VLAN_TX))
 		recipe_id = ICE_SW_LKUP_PROMISC_VLAN;
 	else
 		recipe_id = ICE_SW_LKUP_PROMISC;
@@ -6317,7 +6332,7 @@ _ice_clear_vsi_promisc(struct ice_hw *hw, u16 vsi_handle, u8 promisc_mask,
 	LIST_FOR_EACH_ENTRY(itr, rule_head,
 			    ice_fltr_mgmt_list_entry, list_entry) {
 		struct ice_fltr_info *fltr_info;
-		u8 fltr_promisc_mask = 0;
+		ice_zero_bitmap(compl_promisc_mask, ICE_PROMISC_MAX);
 
 		if (!ice_vsi_uses_fltr(itr, vsi_handle))
 			continue;
@@ -6327,10 +6342,12 @@ _ice_clear_vsi_promisc(struct ice_hw *hw, u16 vsi_handle, u8 promisc_mask,
 		    vid != fltr_info->l_data.mac_vlan.vlan_id)
 			continue;
 
-		fltr_promisc_mask |= ice_determine_promisc_mask(fltr_info);
+		ice_determine_promisc_mask(fltr_info, fltr_promisc_mask);
+		ice_andnot_bitmap(compl_promisc_mask, fltr_promisc_mask,
+				  promisc_mask, ICE_PROMISC_MAX);
 
 		/* Skip if filter is not completely specified by given mask */
-		if (fltr_promisc_mask & ~promisc_mask)
+		if (ice_is_any_bit_set(compl_promisc_mask, ICE_PROMISC_MAX))
 			continue;
 
 		status = ice_add_entry_to_vsi_fltr_list(hw, vsi_handle,
@@ -6359,13 +6376,16 @@ _ice_clear_vsi_promisc(struct ice_hw *hw, u16 vsi_handle, u8 promisc_mask,
  * ice_clear_vsi_promisc - clear specified promiscuous mode(s) for given VSI
  * @hw: pointer to the hardware structure
  * @vsi_handle: VSI handle to clear mode
- * @promisc_mask: mask of promiscuous config bits to clear
+ * @promisc_mask: pointer to mask of promiscuous config bits to clear
  * @vid: VLAN ID to clear VLAN promiscuous
  */
 int
 ice_clear_vsi_promisc(struct ice_hw *hw, u16 vsi_handle,
-		      u8 promisc_mask, u16 vid)
+		      ice_bitmap_t *promisc_mask, u16 vid)
 {
+	if (!hw || !promisc_mask)
+		return ICE_ERR_PARAM;
+
 	return _ice_clear_vsi_promisc(hw, vsi_handle, promisc_mask,
 				      vid, hw->switch_info);
 }
@@ -6374,16 +6394,18 @@ ice_clear_vsi_promisc(struct ice_hw *hw, u16 vsi_handle,
  * _ice_set_vsi_promisc - set given VSI to given promiscuous mode(s)
  * @hw: pointer to the hardware structure
  * @vsi_handle: VSI handle to configure
- * @promisc_mask: mask of promiscuous config bits
+ * @promisc_mask: pointer to mask of promiscuous config bits
  * @vid: VLAN ID to set VLAN promiscuous
  * @lport: logical port number to configure promisc mode
  * @sw: pointer to switch info struct for which function add rule
  */
 static int
-_ice_set_vsi_promisc(struct ice_hw *hw, u16 vsi_handle, u8 promisc_mask,
-		     u16 vid, u8 lport, struct ice_switch_info *sw)
+_ice_set_vsi_promisc(struct ice_hw *hw, u16 vsi_handle,
+		     ice_bitmap_t *promisc_mask, u16 vid, u8 lport,
+		     struct ice_switch_info *sw)
 {
 	enum { UCAST_FLTR = 1, MCAST_FLTR, BCAST_FLTR };
+	ice_declare_bitmap(p_mask, ICE_PROMISC_MAX);
 	struct ice_fltr_list_entry f_list_entry;
 	bool is_tx_fltr;
 	struct ice_fltr_info new_fltr;
@@ -6400,7 +6422,11 @@ _ice_set_vsi_promisc(struct ice_hw *hw, u16 vsi_handle, u8 promisc_mask,
 
 	ice_memset(&new_fltr, 0, sizeof(new_fltr), ICE_NONDMA_MEM);
 
-	if (promisc_mask & (ICE_PROMISC_VLAN_RX | ICE_PROMISC_VLAN_TX)) {
+	/* Do not modify original bitmap */
+	ice_cp_bitmap(p_mask, promisc_mask, ICE_PROMISC_MAX);
+
+	if (ice_is_bit_set(p_mask, ICE_PROMISC_VLAN_RX) &&
+	    ice_is_bit_set(p_mask, ICE_PROMISC_VLAN_TX)) {
 		new_fltr.lkup_type = ICE_SW_LKUP_PROMISC_VLAN;
 		new_fltr.l_data.mac_vlan.vlan_id = vid;
 		recipe_id = ICE_SW_LKUP_PROMISC_VLAN;
@@ -6414,44 +6440,43 @@ _ice_set_vsi_promisc(struct ice_hw *hw, u16 vsi_handle, u8 promisc_mask,
 	 * individual type, and clear it out in the input mask as it
 	 * is found.
 	 */
-	while (promisc_mask) {
+	while (ice_is_any_bit_set(p_mask, ICE_PROMISC_MAX)) {
 		struct ice_sw_recipe *recp_list;
 		u8 *mac_addr;
 
 		pkt_type = 0;
 		is_tx_fltr = false;
 
-		if (promisc_mask & ICE_PROMISC_UCAST_RX) {
-			promisc_mask &= ~ICE_PROMISC_UCAST_RX;
+		if (ice_test_and_clear_bit(ICE_PROMISC_UCAST_RX,
+					   p_mask)) {
 			pkt_type = UCAST_FLTR;
-		} else if (promisc_mask & ICE_PROMISC_UCAST_TX) {
-			promisc_mask &= ~ICE_PROMISC_UCAST_TX;
+		} else if (ice_test_and_clear_bit(ICE_PROMISC_UCAST_TX,
+						  p_mask)) {
 			pkt_type = UCAST_FLTR;
 			is_tx_fltr = true;
-		} else if (promisc_mask & ICE_PROMISC_MCAST_RX) {
-			promisc_mask &= ~ICE_PROMISC_MCAST_RX;
+		} else if (ice_test_and_clear_bit(ICE_PROMISC_MCAST_RX,
+						  p_mask)) {
 			pkt_type = MCAST_FLTR;
-		} else if (promisc_mask & ICE_PROMISC_MCAST_TX) {
-			promisc_mask &= ~ICE_PROMISC_MCAST_TX;
+		} else if (ice_test_and_clear_bit(ICE_PROMISC_MCAST_TX,
+						  p_mask)) {
 			pkt_type = MCAST_FLTR;
 			is_tx_fltr = true;
-		} else if (promisc_mask & ICE_PROMISC_BCAST_RX) {
-			promisc_mask &= ~ICE_PROMISC_BCAST_RX;
+		} else if (ice_test_and_clear_bit(ICE_PROMISC_BCAST_RX,
+						  p_mask)) {
 			pkt_type = BCAST_FLTR;
-		} else if (promisc_mask & ICE_PROMISC_BCAST_TX) {
-			promisc_mask &= ~ICE_PROMISC_BCAST_TX;
+		} else if (ice_test_and_clear_bit(ICE_PROMISC_BCAST_TX,
+						  p_mask)) {
 			pkt_type = BCAST_FLTR;
 			is_tx_fltr = true;
 		}
 
 		/* Check for VLAN promiscuous flag */
-		if (promisc_mask & ICE_PROMISC_VLAN_RX) {
-			promisc_mask &= ~ICE_PROMISC_VLAN_RX;
-		} else if (promisc_mask & ICE_PROMISC_VLAN_TX) {
-			promisc_mask &= ~ICE_PROMISC_VLAN_TX;
+		if (ice_is_bit_set(p_mask, ICE_PROMISC_VLAN_RX)) {
+			ice_clear_bit(ICE_PROMISC_VLAN_RX, p_mask);
+		} else if (ice_test_and_clear_bit(ICE_PROMISC_VLAN_TX,
+						  p_mask)) {
 			is_tx_fltr = true;
 		}
-
 		/* Set filter DA based on packet type */
 		mac_addr = new_fltr.l_data.mac.mac_addr;
 		if (pkt_type == BCAST_FLTR) {
@@ -6495,13 +6520,16 @@ _ice_set_vsi_promisc(struct ice_hw *hw, u16 vsi_handle, u8 promisc_mask,
  * ice_set_vsi_promisc - set given VSI to given promiscuous mode(s)
  * @hw: pointer to the hardware structure
  * @vsi_handle: VSI handle to configure
- * @promisc_mask: mask of promiscuous config bits
+ * @promisc_mask: pointer to mask of promiscuous config bits
  * @vid: VLAN ID to set VLAN promiscuous
  */
 int
-ice_set_vsi_promisc(struct ice_hw *hw, u16 vsi_handle, u8 promisc_mask,
-		    u16 vid)
+ice_set_vsi_promisc(struct ice_hw *hw, u16 vsi_handle,
+		    ice_bitmap_t *promisc_mask, u16 vid)
 {
+	if (!hw || !promisc_mask)
+		return ICE_ERR_PARAM;
+
 	return _ice_set_vsi_promisc(hw, vsi_handle, promisc_mask, vid,
 				    hw->port_info->lport,
 				    hw->switch_info);
@@ -6511,7 +6539,7 @@ ice_set_vsi_promisc(struct ice_hw *hw, u16 vsi_handle, u8 promisc_mask,
  * _ice_set_vlan_vsi_promisc
  * @hw: pointer to the hardware structure
  * @vsi_handle: VSI handle to configure
- * @promisc_mask: mask of promiscuous config bits
+ * @promisc_mask: pointer to mask of promiscuous config bits
  * @rm_vlan_promisc: Clear VLANs VSI promisc mode
  * @lport: logical port number to configure promisc mode
  * @sw: pointer to switch info struct for which function add rule
@@ -6519,9 +6547,9 @@ ice_set_vsi_promisc(struct ice_hw *hw, u16 vsi_handle, u8 promisc_mask,
  * Configure VSI with all associated VLANs to given promiscuous mode(s)
  */
 static int
-_ice_set_vlan_vsi_promisc(struct ice_hw *hw, u16 vsi_handle, u8 promisc_mask,
-			  bool rm_vlan_promisc, u8 lport,
-			  struct ice_switch_info *sw)
+_ice_set_vlan_vsi_promisc(struct ice_hw *hw, u16 vsi_handle,
+			  ice_bitmap_t *promisc_mask, bool rm_vlan_promisc,
+			  u8 lport, struct ice_switch_info *sw)
 {
 	struct ice_fltr_list_entry *list_itr, *tmp;
 	struct LIST_HEAD_TYPE vsi_list_head;
@@ -6581,9 +6609,12 @@ _ice_set_vlan_vsi_promisc(struct ice_hw *hw, u16 vsi_handle, u8 promisc_mask,
  * Configure VSI with all associated VLANs to given promiscuous mode(s)
  */
 int
-ice_set_vlan_vsi_promisc(struct ice_hw *hw, u16 vsi_handle, u8 promisc_mask,
-			 bool rm_vlan_promisc)
+ice_set_vlan_vsi_promisc(struct ice_hw *hw, u16 vsi_handle,
+			 ice_bitmap_t *promisc_mask, bool rm_vlan_promisc)
 {
+	if (!hw || !promisc_mask)
+		return ICE_ERR_PARAM;
+
 	return _ice_set_vlan_vsi_promisc(hw, vsi_handle, promisc_mask,
 					 rm_vlan_promisc, hw->port_info->lport,
 					 hw->switch_info);
drivers/net/ice/base/ice_switch.h +20 -18
index 38daab0adb..473784dc30 100644
@@ -418,14 +418,16 @@ struct ice_adv_fltr_mgmt_list_entry {
 };
 
 enum ice_promisc_flags {
-	ICE_PROMISC_UCAST_RX = 0x1,
-	ICE_PROMISC_UCAST_TX = 0x2,
-	ICE_PROMISC_MCAST_RX = 0x4,
-	ICE_PROMISC_MCAST_TX = 0x8,
-	ICE_PROMISC_BCAST_RX = 0x10,
-	ICE_PROMISC_BCAST_TX = 0x20,
-	ICE_PROMISC_VLAN_RX = 0x40,
-	ICE_PROMISC_VLAN_TX = 0x80,
+	ICE_PROMISC_UCAST_RX = 0,
+	ICE_PROMISC_UCAST_TX,
+	ICE_PROMISC_MCAST_RX,
+	ICE_PROMISC_MCAST_TX,
+	ICE_PROMISC_BCAST_RX,
+	ICE_PROMISC_BCAST_TX,
+	ICE_PROMISC_VLAN_RX,
+	ICE_PROMISC_VLAN_TX,
+	/* Max value */
+	ICE_PROMISC_MAX,
 };
 
 /* VSI related commands */
@@ -526,22 +528,22 @@ ice_cfg_dflt_vsi(struct ice_port_info *pi, u16 vsi_handle, bool set,
 bool ice_check_if_dflt_vsi(struct ice_port_info *pi, u16 vsi_handle,
 			   bool *rule_exists);
 int
-ice_set_vsi_promisc(struct ice_hw *hw, u16 vsi_handle, u8 promisc_mask,
-		    u16 vid);
+ice_set_vsi_promisc(struct ice_hw *hw, u16 vsi_handle,
+		    ice_bitmap_t *promisc_mask, u16 vid);
 int
-ice_clear_vsi_promisc(struct ice_hw *hw, u16 vsi_handle, u8 promisc_mask,
-		      u16 vid);
+ice_clear_vsi_promisc(struct ice_hw *hw, u16 vsi_handle,
+		      ice_bitmap_t *promisc_mask, u16 vid);
 int
-ice_set_vlan_vsi_promisc(struct ice_hw *hw, u16 vsi_handle, u8 promisc_mask,
-			 bool rm_vlan_promisc);
+ice_set_vlan_vsi_promisc(struct ice_hw *hw, u16 vsi_handle,
+			 ice_bitmap_t *promisc_mask, bool rm_vlan_promisc);
 
 /* Get VSIs Promisc/defport settings */
 int
-ice_get_vsi_promisc(struct ice_hw *hw, u16 vsi_handle, u8 *promisc_mask,
-		    u16 *vid);
+ice_get_vsi_promisc(struct ice_hw *hw, u16 vsi_handle,
+		    ice_bitmap_t *promisc_mask, u16 *vid);
 int
-ice_get_vsi_vlan_promisc(struct ice_hw *hw, u16 vsi_handle, u8 *promisc_mask,
-			 u16 *vid);
+ice_get_vsi_vlan_promisc(struct ice_hw *hw, u16 vsi_handle,
+			 ice_bitmap_t *promisc_mask, u16 *vid);
 
 int
 ice_aq_add_recipe(struct ice_hw *hw,
drivers/net/ice/ice_ethdev.c +12 -12
index 56adc3a3d9..1290c19591 100644
@@ -3785,6 +3785,7 @@ ice_dev_start(struct rte_eth_dev *dev)
 	uint8_t timer = hw->func_caps.ts_func_info.tmr_index_owned;
 	uint32_t pin_idx = ad->devargs.pin_idx;
 	struct rte_tm_error tm_err;
+	ice_bitmap_t pmask;
 
 	/* program Tx queues' context in hardware */
 	for (nb_txq = 0; nb_txq < data->nb_tx_queues; nb_txq++) {
@@ -3838,10 +3839,9 @@ ice_dev_start(struct rte_eth_dev *dev)
 		return -EIO;
 
 	/* Enable receiving broadcast packets and transmitting packets */
-	ret = ice_set_vsi_promisc(hw, vsi->idx,
-				  ICE_PROMISC_BCAST_RX | ICE_PROMISC_BCAST_TX |
-				  ICE_PROMISC_UCAST_TX | ICE_PROMISC_MCAST_TX,
-				  0);
+	pmask = ICE_PROMISC_BCAST_RX | ICE_PROMISC_BCAST_TX |
+			ICE_PROMISC_UCAST_TX | ICE_PROMISC_MCAST_TX;
+	ret = ice_set_vsi_promisc(hw, vsi->idx, &pmask, 0);
 	if (ret != ICE_SUCCESS)
 		PMD_DRV_LOG(INFO, "fail to set vsi broadcast");
 
@@ -5173,13 +5173,13 @@ ice_promisc_enable(struct rte_eth_dev *dev)
 	struct ice_hw *hw = ICE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
 	struct ice_vsi *vsi = pf->main_vsi;
 	enum ice_status status;
-	uint8_t pmask;
+	ice_bitmap_t pmask;;
 	int ret = 0;
 
 	pmask = ICE_PROMISC_UCAST_RX | ICE_PROMISC_UCAST_TX |
 		ICE_PROMISC_MCAST_RX | ICE_PROMISC_MCAST_TX;
 
-	status = ice_set_vsi_promisc(hw, vsi->idx, pmask, 0);
+	status = ice_set_vsi_promisc(hw, vsi->idx, &pmask, 0);
 	switch (status) {
 	case ICE_ERR_ALREADY_EXISTS:
 		PMD_DRV_LOG(DEBUG, "Promisc mode has already been enabled");
@@ -5200,7 +5200,7 @@ ice_promisc_disable(struct rte_eth_dev *dev)
 	struct ice_hw *hw = ICE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
 	struct ice_vsi *vsi = pf->main_vsi;
 	enum ice_status status;
-	uint8_t pmask;
+	ice_bitmap_t pmask;
 	int ret = 0;
 
 	if (dev->data->all_multicast == 1)
@@ -5209,7 +5209,7 @@ ice_promisc_disable(struct rte_eth_dev *dev)
 		pmask = ICE_PROMISC_UCAST_RX | ICE_PROMISC_UCAST_TX |
 			ICE_PROMISC_MCAST_RX | ICE_PROMISC_MCAST_TX;
 
-	status = ice_clear_vsi_promisc(hw, vsi->idx, pmask, 0);
+	status = ice_clear_vsi_promisc(hw, vsi->idx, &pmask, 0);
 	if (status != ICE_SUCCESS) {
 		PMD_DRV_LOG(ERR, "Failed to clear promisc, err=%d", status);
 		ret = -EAGAIN;
@@ -5225,12 +5225,12 @@ ice_allmulti_enable(struct rte_eth_dev *dev)
 	struct ice_hw *hw = ICE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
 	struct ice_vsi *vsi = pf->main_vsi;
 	enum ice_status status;
-	uint8_t pmask;
+	ice_bitmap_t pmask;
 	int ret = 0;
 
 	pmask = ICE_PROMISC_MCAST_RX | ICE_PROMISC_MCAST_TX;
 
-	status = ice_set_vsi_promisc(hw, vsi->idx, pmask, 0);
+	status = ice_set_vsi_promisc(hw, vsi->idx, &pmask, 0);
 
 	switch (status) {
 	case ICE_ERR_ALREADY_EXISTS:
@@ -5252,7 +5252,7 @@ ice_allmulti_disable(struct rte_eth_dev *dev)
 	struct ice_hw *hw = ICE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
 	struct ice_vsi *vsi = pf->main_vsi;
 	enum ice_status status;
-	uint8_t pmask;
+	ice_bitmap_t pmask;
 	int ret = 0;
 
 	if (dev->data->promiscuous == 1)
@@ -5260,7 +5260,7 @@ ice_allmulti_disable(struct rte_eth_dev *dev)
 
 	pmask = ICE_PROMISC_MCAST_RX | ICE_PROMISC_MCAST_TX;
 
-	status = ice_clear_vsi_promisc(hw, vsi->idx, pmask, 0);
+	status = ice_clear_vsi_promisc(hw, vsi->idx, &pmask, 0);
 	if (status != ICE_SUCCESS) {
 		PMD_DRV_LOG(ERR, "Failed to clear allmulti, err=%d", status);
 		ret = -EAGAIN;
Signature · 1 line
2.43.0
#38 lore raw

PATCH v2 27/148 net/ice/base: fix rx-only unicast promiscuous mode

In reply to Anatoly Burakov

From: Ian Stokes <[email protected]>

Currently for unicast promiscuous, the driver is adding a LOOKUP_RX filter rule using recipe 3. The direction bit in this recipe is the pkt_is_from_network flag, so the filter only matches on packets from the network, not loopback packets. To match loopback packets without replicating all Tx packets, LOOKUP_TX (where source is the VSI) filter with LB_EN bit set to 0 is needed. This would be equivalent to the rx-only promiscuous mode used in E700 cards.

Extended promiscuous mask by additional UCAST_RX_LB entry, added another flag pointing to RX_LB to distinguish filter from the TX, aligned unittests.

---
 drivers/net/ice/base/ice_switch.c | 30 ++++++++++++++++++++++++++----
 drivers/net/ice/base/ice_switch.h |  7 +++++--
 2 files changed, 31 insertions(+), 6 deletions(-)
drivers/net/ice/base/ice_switch.c +26 -4
index 9cb5b67699..1a851e4d0e 100644
@@ -3966,6 +3966,13 @@ static void ice_fill_sw_info(struct ice_hw *hw, struct ice_fltr_info *fi)
 			fi->lan_en = true;
 		}
 	}
+	/* To be able to receive packets coming from the VF on the same PF,
+	 * unicast filter needs to be added without LB_EN bit
+	 */
+	if (fi->flag & ICE_FLTR_RX_LB) {
+		fi->lb_en = false;
+		fi->lan_en = true;
+	}
 }
 
 /**
@@ -4796,7 +4803,7 @@ ice_add_rule_internal(struct ice_hw *hw, struct ice_sw_recipe *recp_list,
 	new_fltr = &f_entry->fltr_info;
 	if (new_fltr->flag & ICE_FLTR_RX)
 		new_fltr->src = lport;
-	else if (new_fltr->flag & ICE_FLTR_TX)
+	else if (new_fltr->flag & (ICE_FLTR_TX | ICE_FLTR_RX_LB))
 		new_fltr->src =
 			ice_get_hw_vsi_num(hw, f_entry->fltr_info.vsi_handle);
 
@@ -6162,12 +6169,15 @@ static void ice_determine_promisc_mask(struct ice_fltr_info *fi,
 {
 	u16 vid = fi->l_data.mac_vlan.vlan_id;
 	u8 *macaddr = fi->l_data.mac.mac_addr;
+	bool is_rx_lb_fltr = false;
 	bool is_tx_fltr = false;
 
 	ice_zero_bitmap(promisc_mask, ICE_PROMISC_MAX);
 
 	if (fi->flag == ICE_FLTR_TX)
 		is_tx_fltr = true;
+	if (fi->flag == ICE_FLTR_RX_LB)
+		is_rx_lb_fltr = true;
 
 	if (IS_BROADCAST_ETHER_ADDR(macaddr)) {
 		ice_set_bit(is_tx_fltr ? ICE_PROMISC_BCAST_TX
@@ -6176,8 +6186,12 @@ static void ice_determine_promisc_mask(struct ice_fltr_info *fi,
 		ice_set_bit(is_tx_fltr ? ICE_PROMISC_MCAST_TX
 				       : ICE_PROMISC_MCAST_RX, promisc_mask);
 	} else if (IS_UNICAST_ETHER_ADDR(macaddr)) {
-		ice_set_bit(is_tx_fltr ? ICE_PROMISC_UCAST_TX
-				       : ICE_PROMISC_UCAST_RX, promisc_mask);
+		if (is_tx_fltr)
+			ice_set_bit(ICE_PROMISC_UCAST_TX, promisc_mask);
+		else if (is_rx_lb_fltr)
+			ice_set_bit(ICE_PROMISC_UCAST_RX_LB, promisc_mask);
+		else
+			ice_set_bit(ICE_PROMISC_UCAST_RX, promisc_mask);
 	}
 
 	if (vid) {
@@ -6407,7 +6421,7 @@ _ice_set_vsi_promisc(struct ice_hw *hw, u16 vsi_handle,
 	enum { UCAST_FLTR = 1, MCAST_FLTR, BCAST_FLTR };
 	ice_declare_bitmap(p_mask, ICE_PROMISC_MAX);
 	struct ice_fltr_list_entry f_list_entry;
-	bool is_tx_fltr;
+	bool is_tx_fltr, is_rx_lb_fltr;
 	struct ice_fltr_info new_fltr;
 	int status = 0;
 	u16 hw_vsi_id;
@@ -6446,6 +6460,7 @@ _ice_set_vsi_promisc(struct ice_hw *hw, u16 vsi_handle,
 
 		pkt_type = 0;
 		is_tx_fltr = false;
+		is_rx_lb_fltr = false;
 
 		if (ice_test_and_clear_bit(ICE_PROMISC_UCAST_RX,
 					   p_mask)) {
@@ -6468,6 +6483,10 @@ _ice_set_vsi_promisc(struct ice_hw *hw, u16 vsi_handle,
 						  p_mask)) {
 			pkt_type = BCAST_FLTR;
 			is_tx_fltr = true;
+		} else if (ice_test_and_clear_bit(ICE_PROMISC_UCAST_RX_LB,
+						  p_mask)) {
+			pkt_type = UCAST_FLTR;
+			is_rx_lb_fltr = true;
 		}
 
 		/* Check for VLAN promiscuous flag */
@@ -6495,6 +6514,9 @@ _ice_set_vsi_promisc(struct ice_hw *hw, u16 vsi_handle,
 		if (is_tx_fltr) {
 			new_fltr.flag |= ICE_FLTR_TX;
 			new_fltr.src = hw_vsi_id;
+		} else if (is_rx_lb_fltr) {
+			new_fltr.flag |= ICE_FLTR_RX_LB;
+			new_fltr.src = hw_vsi_id;
 		} else {
 			new_fltr.flag |= ICE_FLTR_RX;
 			new_fltr.src = lport;
drivers/net/ice/base/ice_switch.h +5 -2
index 473784dc30..184e30f226 100644
@@ -11,8 +11,10 @@
 #define ICE_SW_CFG_MAX_BUF_LEN 2048
 #define ICE_MAX_SW 256
 #define ICE_DFLT_VSI_INVAL 0xff
-#define ICE_FLTR_RX BIT(0)
-#define ICE_FLTR_TX BIT(1)
+
+#define ICE_FLTR_RX	BIT(0)
+#define ICE_FLTR_TX	BIT(1)
+#define ICE_FLTR_RX_LB	BIT(2)
 #define ICE_FLTR_TX_RX (ICE_FLTR_RX | ICE_FLTR_TX)
 
 /* Switch Profile IDs for Profile related switch rules */
@@ -426,6 +428,7 @@ enum ice_promisc_flags {
 	ICE_PROMISC_BCAST_TX,
 	ICE_PROMISC_VLAN_RX,
 	ICE_PROMISC_VLAN_TX,
+	ICE_PROMISC_UCAST_RX_LB,
 	/* Max value */
 	ICE_PROMISC_MAX,
 };
Signature · 1 line
2.43.0
#39 lore raw

PATCH v2 28/148 net/ice/base: add support for E825-C TX clock changing

In reply to Anatoly Burakov

From: Ian Stokes <[email protected]>

E825-C hardware has a new feature which allows to change the clocks which drives the TX on the PHYs. The registers are accessed directly no interaction with FW via admin queue commands. Add this support.

---
 drivers/net/ice/base/ice_cgu_regs.h |  90 ++++++
 drivers/net/ice/base/ice_common.c   |  19 ++
 drivers/net/ice/base/ice_common.h   |   1 +
 drivers/net/ice/base/ice_phy_regs.h |  84 ++++++
 drivers/net/ice/base/ice_ptp_hw.c   | 453 ++++++++++++++++++++++++++--
 drivers/net/ice/base/ice_ptp_hw.h   |  12 +
 6 files changed, 628 insertions(+), 31 deletions(-)
 create mode 100644 drivers/net/ice/base/ice_phy_regs.h
drivers/net/ice/base/ice_cgu_regs.h +90 -0
index c44bfc1846..f24f4746dd 100644
@@ -28,6 +28,42 @@ union nac_cgu_dword9 {
 	u32 val;
 };
 
+#define NAC_CGU_DWORD10_E825C 0x28
+union nac_cgu_dword10_e825c {
+	struct {
+		u32 ja_pll_enable : 1;
+		u32 misc11 : 1;
+		u32 fdpll_enable : 1;
+		u32 fdpll_slow : 1;
+		u32 fdpll_lock_int_enb : 1;
+		u32 synce_clko_sel : 4;
+		u32 synce_clkodiv_m1 : 5;
+		u32 synce_clkodiv_load : 1;
+		u32 synce_dck_rst : 1;
+		u32 synce_ethclko_sel : 3;
+		u32 synce_ethdiv_m1 : 5;
+		u32 synce_ethdiv_load : 1;
+		u32 synce_dck2_rst : 1;
+		u32 synce_sel_gnd : 1;
+		u32 synce_s_ref_clk : 5;
+	} field;
+	u32 val;
+};
+
+#define NAC_CGU_DWORD11_E825C 0x2c
+union nac_cgu_dword11_e825c {
+	struct {
+		u32 misc25 : 1;
+		u32 synce_s_byp_clk : 6;
+		u32 synce_hdov_mode : 1;
+		u32 synce_rat_sel : 2;
+		u32 synce_link_enable : 20;
+		u32 synce_misclk_en : 1;
+		u32 synce_misclk_rat_m1 : 1;
+	} field;
+	u32 val;
+};
+
 #define NAC_CGU_DWORD19 0x4c
 union nac_cgu_dword19 {
 	struct {
@@ -68,6 +104,22 @@ union nac_cgu_dword22 {
 	u32 val;
 };
 
+#define NAC_CGU_DWORD23_E825C 0x5C
+union nac_cgu_dword23_e825c {
+	struct {
+		u32 cgupll_fbdiv_intgr : 10;
+		u32 ux56pll_fbdiv_intgr : 10;
+		u32 misc20 : 4;
+		u32 ts_pll_enable : 1;
+		u32 time_sync_tspll_align_sel : 1;
+		u32 ext_synce_sel : 1;
+		u32 ref1588_ck_div : 4;
+		u32 time_ref_sel : 1;
+
+	} field;
+	u32 val;
+};
+
 #define NAC_CGU_DWORD24 0x60
 union nac_cgu_dword24 {
 	struct {
@@ -114,4 +166,42 @@ union tspll_ro_bwm_lf {
 	u32 val;
 };
 
+#define TSPLL_RO_LOCK_E825C 0x3f0
+union tspll_ro_lock_e825c {
+	struct {
+		u32 bw_freqov_high_cri_7_0 : 8;
+		u32 bw_freqov_high_cri_9_8 : 2;
+		u32 reserved455 : 1;
+		u32 plllock_gain_tran_cri : 1;
+		u32 plllock_true_lock_cri : 1;
+		u32 pllunlock_flag_cri : 1;
+		u32 afcerr_cri : 1;
+		u32 afcdone_cri : 1;
+		u32 feedfwrdgain_cal_cri_7_0 : 8;
+		u32 reserved462 : 8;
+	} field;
+	u32 val;
+};
+
+#define TSPLL_BW_TDC_E825C 0x31c
+union tspll_bw_tdc_e825c {
+	struct {
+		u32 i_tdc_offset_lock_1_0 : 2;
+		u32 i_bbthresh1_2_0 : 3;
+		u32 i_bbthresh2_2_0 : 3;
+		u32 i_tdcsel_1_0 : 2;
+		u32 i_tdcovccorr_en_h : 1;
+		u32 i_divretimeren : 1;
+		u32 i_bw_ampmeas_window : 1;
+		u32 i_bw_lowerbound_2_0 : 3;
+		u32 i_bw_upperbound_2_0 : 3;
+		u32 i_bw_mode_1_0 : 2;
+		u32 i_ft_mode_sel_2_0 : 3;
+		u32 i_bwphase_4_0 : 5;
+		u32 i_plllock_sel_1_0 : 2;
+		u32 i_afc_divratio : 1;
+	} field;
+	u32 val;
+};
+
 #endif /* _ICE_CGU_REGS_H_ */
drivers/net/ice/base/ice_common.c +19 -0
index 1f98034c55..987d7f033d 100644
@@ -270,6 +270,25 @@ bool ice_is_e823(struct ice_hw *hw)
 	}
 }
 
+/**
+ * ice_is_e825c
+ * @hw: pointer to the hardware structure
+ *
+ * returns true if the device is E825-C based, false if not.
+ */
+bool ice_is_e825c(struct ice_hw *hw)
+{
+	switch (hw->device_id) {
+	case ICE_DEV_ID_E825C_BACKPLANE:
+	case ICE_DEV_ID_E825C_QSFP:
+	case ICE_DEV_ID_E825C_SFP:
+	case ICE_DEV_ID_E825C_SGMII:
+		return true;
+	default:
+		return false;
+	}
+}
+
 /**
  * ice_clear_pf_cfg - Clear PF configuration
  * @hw: pointer to the hardware structure
drivers/net/ice/base/ice_common.h +1 -0
index fe99b56f8b..6517a1effe 100644
@@ -266,6 +266,7 @@ void ice_print_rollback_msg(struct ice_hw *hw);
 bool ice_is_generic_mac(struct ice_hw *hw);
 bool ice_is_e810(struct ice_hw *hw);
 bool ice_is_e810t(struct ice_hw *hw);
+bool ice_is_e825c(struct ice_hw *hw);
 bool ice_is_e823(struct ice_hw *hw);
 int
 ice_sched_query_elem(struct ice_hw *hw, u32 node_teid,
drivers/net/ice/base/ice_phy_regs.h new file +84 -0

84 lines not on this page · raw message

drivers/net/ice/base/ice_ptp_hw.c +422 -31

589 lines not on this page · raw message

drivers/net/ice/base/ice_ptp_hw.h +12 -0
index 441ad0b77d..d55eb99178 100644
@@ -166,6 +166,18 @@ ice_ptp_one_port_cmd_e822(struct ice_hw *hw, u8 port,
 int
 ice_cfg_cgu_pll_e822(struct ice_hw *hw, enum ice_time_ref_freq clk_freq,
 		     enum ice_clk_src clk_src);
+enum ice_status
+ice_cfg_cgu_pll_e825c(struct ice_hw *hw, enum ice_time_ref_freq *clk_freq,
+		      enum ice_clk_src *clk_src);
+enum ice_status
+ice_cgu_ts_pll_lost_lock_e825c(struct ice_hw *hw, bool *lost_lock);
+enum ice_status ice_cgu_ts_pll_restart_e825c(struct ice_hw *hw);
+enum ice_status
+ice_cgu_bypass_mux_port_active_e825c(struct ice_hw *hw, u8 port, bool *active);
+enum ice_status
+ice_cfg_cgu_bypass_mux_e825c(struct ice_hw *hw, u8 port_num, bool clock_1588,
+			     unsigned int ena);
+enum ice_status ice_cfg_synce_ethdiv_e825c(struct ice_hw *hw, u8 *divider);
 
 /**
  * ice_e822_time_ref - Get the current TIME_REF from capabilities
Signature · 1 line
2.43.0
#40 lore raw

PATCH v2 29/148 net/ice/base: fix for applying multiple cloud filters

In reply to Anatoly Burakov

From: Ian Stokes <[email protected]>

When applying UDP cloud filter with tunnel type different than VXLAN for each of the filter new recipe will be created instead of using already created one. This will quickly use all of the resources for specific recipe. Modified check to detect if recipe with similar tunnel type has been already created.

---
 drivers/net/ice/base/ice_switch.c | 30 +++++++++++++++++++-----------
 1 file changed, 19 insertions(+), 11 deletions(-)
drivers/net/ice/base/ice_switch.c +19 -11
index 1a851e4d0e..8f800e6fa2 100644
@@ -2224,15 +2224,16 @@ static struct ice_prof_type_entry ice_prof_type_tbl[ICE_GTPU_PROFILE] = {
  */
 static enum ice_sw_tunnel_type ice_get_tun_type_for_recipe(u8 rid, bool vlan)
 {
-	u8 vxlan_profile[12] = {10, 11, 12, 16, 17, 18, 22, 23, 24, 25, 26, 27};
+	u8 udp_tun_profile[12] = {10, 11, 12, 16, 17, 18, 22, 23, 24, 25, 26,
+				  27};
 	u8 gre_profile[12] = {13, 14, 15, 19, 20, 21, 28, 29, 30, 31, 32, 33};
 	u8 pppoe_profile[7] = {34, 35, 36, 37, 38, 39, 40};
 	u8 non_tun_profile[6] = {4, 5, 6, 7, 8, 9};
 	enum ice_sw_tunnel_type tun_type;
 	u16 i, j, k, profile_num = 0;
+	bool udp_tun_valid = false;
 	bool non_tun_valid = false;
 	bool pppoe_valid = false;
-	bool vxlan_valid = false;
 	bool gre_valid = false;
 	bool gtp_valid = false;
 	bool flag_valid = false;
@@ -2249,8 +2250,8 @@ static enum ice_sw_tunnel_type ice_get_tun_type_for_recipe(u8 rid, bool vlan)
 		}
 
 		for (i = 0; i < 12; i++) {
-			if (vxlan_profile[i] == j)
-				vxlan_valid = true;
+			if (udp_tun_profile[i] == j)
+				udp_tun_valid = true;
 		}
 
 		for (i = 0; i < 7; i++) {
@@ -2274,8 +2275,8 @@ static enum ice_sw_tunnel_type ice_get_tun_type_for_recipe(u8 rid, bool vlan)
 			flag_valid = true;
 	}
 
-	if (!non_tun_valid && vxlan_valid)
-		tun_type = ICE_SW_TUN_VXLAN;
+	if (!non_tun_valid && udp_tun_valid)
+		tun_type = ICE_SW_TUN_UDP;
 	else if (!non_tun_valid && gre_valid)
 		tun_type = ICE_SW_TUN_NVGRE;
 	else if (!non_tun_valid && pppoe_valid)
@@ -2283,9 +2284,9 @@ static enum ice_sw_tunnel_type ice_get_tun_type_for_recipe(u8 rid, bool vlan)
 	else if (!non_tun_valid && gtp_valid)
 		tun_type = ICE_SW_TUN_GTP;
 	else if (non_tun_valid &&
-		 (vxlan_valid || gre_valid || gtp_valid || pppoe_valid))
+		 (udp_tun_valid || gre_valid || gtp_valid || pppoe_valid))
 		tun_type = ICE_SW_TUN_AND_NON_TUN;
-	else if (non_tun_valid && !vxlan_valid && !gre_valid && !gtp_valid &&
+	else if (non_tun_valid && !udp_tun_valid && !gre_valid && !gtp_valid &&
 		 !pppoe_valid)
 		tun_type = ICE_NON_TUN;
 	else
@@ -7186,9 +7187,16 @@ static u16 ice_find_recp(struct ice_hw *hw, struct ice_prot_lkup_ext *lkup_exts,
 			/* If for "i"th recipe the found was never set to false
 			 * then it means we found our match
 			 */
-			if (tun_type == recp[i].tun_type && found &&
-			    priority == recp[i].priority)
-				return i; /* Return the recipe ID */
+			if (found && priority == recp[i].priority) {
+				if (tun_type == recp[i].tun_type ||
+				    (recp[i].tun_type == ICE_SW_TUN_UDP &&
+				     (tun_type == ICE_SW_TUN_VXLAN_GPE ||
+				      tun_type == ICE_SW_TUN_VXLAN ||
+				      tun_type == ICE_SW_TUN_GENEVE ||
+				      tun_type == ICE_SW_TUN_GENEVE_VLAN ||
+				      tun_type == ICE_SW_TUN_VXLAN_VLAN)))
+					return i; /* Return the recipe ID */
+			}
 		}
 	}
 	return ICE_MAX_NUM_RECIPES;
Signature · 1 line
2.43.0
#41 lore raw

PATCH v2 30/148 net/ice/base: limit PF RSS LUT to one VSI at time

In reply to Anatoly Burakov

From: Ian Stokes <[email protected]>

Allow only one VSI to alloc the PF RSS LUT.

Shared part consists of just a new field, actual implementation will use rss_locks to serialize the access. Take advantage of the fact that VSI #0 is main VSI for PF, what is the default PF LUT holder, so zero-init of struct ice_hw sets it as designed.

---
 drivers/net/ice/base/ice_type.h | 1 +
 1 file changed, 1 insertion(+)
drivers/net/ice/base/ice_type.h +1 -0
index 48f892bfd3..1e133bb1a6 100644
@@ -1394,6 +1394,7 @@ struct ice_hw {
 	ice_declare_bitmap(fdir_perfect_fltr, ICE_FLTR_PTYPE_MAX);
 	struct ice_lock rss_locks;	/* protect RSS configuration */
 	struct LIST_HEAD_TYPE rss_list_head;
+	u16 vsi_owning_pf_lut; /* SW IDX of VSI that acquired PF RSS LUT */
 	ice_declare_bitmap(hw_ptype, ICE_FLOW_PTYPE_MAX);
 	u8 dvm_ena;
 	u16 io_expander_handle;
Signature · 1 line
2.43.0
#42 lore raw

Re: [PATCH v2 030/148] net/ice/base: limit PF RSS LUT to one VSI at time

Quoted 21 lines · Anatoly Burakov

From: Ian Stokes <[email protected]>

Allow only one VSI to alloc the PF RSS LUT.

Shared part consists of just a new field, actual implementation will use rss_locks to serialize the access. Take advantage of the fact that VSI #0 is main VSI for PF, what is the default PF LUT holder, so zero-init of struct ice_hw sets it as designed.

---
 drivers/net/ice/base/ice_type.h | 1 +
 1 file changed, 1 insertion(+)
drivers/net/ice/base/ice_type.h +0 -0
index 48f892bfd3..1e133bb1a6 100644

drivers/net/ice/base/ice_type.h struct ice_hw { · line 1400

Quoted 7 lines
drivers/net/ice/base/ice_type.h +1 -0
@@ -1394,6 +1394,7 @@ struct ice_hw {
 	ice_declare_bitmap(fdir_perfect_fltr, ICE_FLTR_PTYPE_MAX);
 	struct ice_lock rss_locks;	/* protect RSS configuration */
 	struct LIST_HEAD_TYPE rss_list_head;
+	u16 vsi_owning_pf_lut; /* SW IDX of VSI that acquired PF RSS LUT */
 	ice_declare_bitmap(hw_ptype, ICE_FLOW_PTYPE_MAX);
 	u8 dvm_ena;
 	u16 io_expander_handle;

This is a one-line change, so can probably be merged into some other patch, rather than needing a whole commit on its own.

/Bruce

#43 lore raw

Re: [PATCH v2 030/148] net/ice/base: limit PF RSS LUT to one VSI at time

Quoted 33 lines · Bruce Richardson
Quoted 21 lines · Anatoly Burakov

From: Ian Stokes <[email protected]>

Allow only one VSI to alloc the PF RSS LUT.

Shared part consists of just a new field, actual implementation will use rss_locks to serialize the access. Take advantage of the fact that VSI #0 is main VSI for PF, what is the default PF LUT holder, so zero-init of struct ice_hw sets it as designed.

---
  drivers/net/ice/base/ice_type.h | 1 +
  1 file changed, 1 insertion(+)
drivers/net/ice/base/ice_type.h +0 -0
index 48f892bfd3..1e133bb1a6 100644

drivers/net/ice/base/ice_type.h struct ice_hw { · line 1400

Quoted 7 lines
drivers/net/ice/base/ice_type.h +1 -0
@@ -1394,6 +1394,7 @@ struct ice_hw {
  	ice_declare_bitmap(fdir_perfect_fltr, ICE_FLTR_PTYPE_MAX);
  	struct ice_lock rss_locks;	/* protect RSS configuration */
  	struct LIST_HEAD_TYPE rss_list_head;
+	u16 vsi_owning_pf_lut; /* SW IDX of VSI that acquired PF RSS LUT */
  	ice_declare_bitmap(hw_ptype, ICE_FLOW_PTYPE_MAX);
  	u8 dvm_ena;
  	u16 io_expander_handle;

This is a one-line change, so can probably be merged into some other patch, rather than needing a whole commit on its own.

Quoted 1 line

/Bruce

preferably to the patch that is the first to use that new field, I see none (but I'm not subscribed to the dpdk ML, so perhaps there is some other in the series)

#44 lore raw

PATCH v2 31/148 net/ice/base: prevent potential integer overflow

In reply to Anatoly Burakov

From: Ian Stokes <[email protected]>

The original bit-shift was made on a 16-bit value which could overflow. Use 64-bit integer to do bit-shifts instead.

---
 drivers/net/ice/base/ice_parser_rt.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/ice/base/ice_parser_rt.c +2 -2
index 69655fdd96..50a3d301b0 100644
@@ -469,9 +469,9 @@ static void _err_add(struct ice_parser_rt *rt, int idx, bool val)
 {
 	rt->pu.err_msk |= (u16)(1 << idx);
 	if (val)
-		rt->pu.flg_val |= (u16)(1 << idx);
+		rt->pu.flg_val |= (1ULL << idx);
 	else
-		rt->pu.flg_val &= ~(u16)(1 << idx);
+		rt->pu.flg_val &= ~(1ULL << idx);
 
 	ice_debug(rt->psr->hw, ICE_DBG_PARSER, "Pending update for error %d value %d\n",
 		  idx, val);
Signature · 1 line
2.43.0
#45 lore raw

PATCH v2 32/148 net/ice/base: cosmetic changes

In reply to Anatoly Burakov

From: Ian Stokes <[email protected]>

- Fix some alignment issues
- Added missing comment
- Removed useless !!
- Add Missing DBG cluster ID

---
 drivers/net/ice/base/ice_adminq_cmd.h |  1 +
 drivers/net/ice/base/ice_switch.c     | 10 +++++-----
 2 files changed, 6 insertions(+), 5 deletions(-)
drivers/net/ice/base/ice_adminq_cmd.h +1 -0
index fe82df747c..6add57d797 100644
@@ -2917,6 +2917,7 @@ struct ice_aqc_debug_dump_internals {
 #define ICE_AQC_DBG_DUMP_CLUSTER_ID_L2P			8
 #define ICE_AQC_DBG_DUMP_CLUSTER_ID_QUEUE_MNG		9
 #define ICE_AQC_DBG_DUMP_CLUSTER_ID_FULL_CSR_SPACE	21
+#define ICE_ACQ_DBG_DUMP_CLUSTER_ID_MNG_TRANSACTION	22
 	u8 reserved;
 	__le16 table_id; /* Used only for non-memory clusters */
 	__le32 idx; /* In table entries for tables, in bytes for memory */
drivers/net/ice/base/ice_switch.c +5 -5
index 8f800e6fa2..cf1ab35f26 100644
@@ -1864,7 +1864,7 @@ static const u8 dummy_pppoe_ipv6_udp_packet[] = {
 static const struct ice_dummy_pkt_offsets dummy_ipv4_esp_packet_offsets[] = {
 	{ ICE_MAC_OFOS,		0 },
 	{ ICE_IPV4_OFOS,	14 },
-	{ ICE_ESP,			34 },
+	{ ICE_ESP,		34 },
 	{ ICE_PROTOCOL_LAST,	0 },
 };
 
@@ -1888,7 +1888,7 @@ static const u8 dummy_ipv4_esp_pkt[] = {
 static const struct ice_dummy_pkt_offsets dummy_ipv6_esp_packet_offsets[] = {
 	{ ICE_MAC_OFOS,		0 },
 	{ ICE_IPV6_OFOS,	14 },
-	{ ICE_ESP,			54 },
+	{ ICE_ESP,		54 },
 	{ ICE_PROTOCOL_LAST,	0 },
 };
 
@@ -1917,7 +1917,7 @@ static const u8 dummy_ipv6_esp_pkt[] = {
 static const struct ice_dummy_pkt_offsets dummy_ipv4_ah_packet_offsets[] = {
 	{ ICE_MAC_OFOS,		0 },
 	{ ICE_IPV4_OFOS,	14 },
-	{ ICE_AH,			34 },
+	{ ICE_AH,		34 },
 	{ ICE_PROTOCOL_LAST,	0 },
 };
 
@@ -1942,7 +1942,7 @@ static const u8 dummy_ipv4_ah_pkt[] = {
 static const struct ice_dummy_pkt_offsets dummy_ipv6_ah_packet_offsets[] = {
 	{ ICE_MAC_OFOS,		0 },
 	{ ICE_IPV6_OFOS,	14 },
-	{ ICE_AH,			54 },
+	{ ICE_AH,		54 },
 	{ ICE_PROTOCOL_LAST,	0 },
 };
 
@@ -2546,7 +2546,7 @@ ice_get_recp_frm_fw(struct ice_hw *hw, struct ice_sw_recipe *recps, u8 rid,
 		LIST_ADD(&rg_entry->l_entry, &recps[rid].rg_list);
 
 		/* Propagate some data to the recipe database */
-		recps[idx].is_root = !!is_root;
+		recps[idx].is_root = is_root;
 		recps[idx].priority = root_bufs.content.act_ctrl_fwd_priority;
 		ice_zero_bitmap(recps[idx].res_idxs, ICE_MAX_FV_WORDS);
 		if (root_bufs.content.result_indx & ICE_AQ_RECIPE_RESULT_EN) {
Signature · 1 line
2.43.0
#46 lore raw

PATCH v2 33/148 net/ice/base: implement initial PTP support for E830

In reply to Anatoly Burakov

From: Ian Stokes <[email protected]>

The new series of devices supported by ice driver are E830 devices. This hardware supports the PTP feature very similar to E810 devices. The main difference besides some other register addresses is that in E830 we are able to read the TX timestamps memory directly from BARs (in E810 we used SBQ to read those).

Note some workaround code for E830 functions and defines are added at this point but a full E830 Patch will add full functionality at a later stage.

---
 drivers/net/ice/base/ice_common.c     |  22 ++++
 drivers/net/ice/base/ice_common.h     |   1 +
 drivers/net/ice/base/ice_devids.h     |  18 ++++
 drivers/net/ice/base/ice_hw_autogen.h |   5 +
 drivers/net/ice/base/ice_ptp_hw.c     | 144 +++++++++++++++++++++++++-
 drivers/net/ice/base/ice_ptp_hw.h     |   9 +-
 drivers/net/ice/base/ice_type.h       |   2 +
 7 files changed, 195 insertions(+), 6 deletions(-)
drivers/net/ice/base/ice_common.c +22 -0
index 987d7f033d..977071e1e9 100644
@@ -177,6 +177,17 @@ static int ice_set_mac_type(struct ice_hw *hw)
 	case ICE_DEV_ID_E825C_SGMII:
 		hw->mac_type = ICE_MAC_GENERIC_3K_E825;
 		break;
+	case ICE_DEV_ID_E830_BACKPLANE:
+	case ICE_DEV_ID_E830_QSFP56:
+	case ICE_DEV_ID_E830_SFP:
+	case ICE_DEV_ID_E830C_BACKPLANE:
+	case ICE_DEV_ID_E830_XXV_BACKPLANE:
+	case ICE_DEV_ID_E830C_QSFP:
+	case ICE_DEV_ID_E830_XXV_QSFP:
+	case ICE_DEV_ID_E830C_SFP:
+	case ICE_DEV_ID_E830_XXV_SFP:
+		hw->mac_type = ICE_MAC_E830;
+		break;
 	default:
 		hw->mac_type = ICE_MAC_UNKNOWN;
 		break;
@@ -245,6 +256,17 @@ bool ice_is_e810t(struct ice_hw *hw)
 	return false;
 }
 
+/**
+ * ice_is_e830
+ * @hw: pointer to the hardware structure
+ *
+ * returns true if the device is E830 based, false if not.
+ */
+bool ice_is_e830(struct ice_hw *hw)
+{
+	return hw->mac_type == ICE_MAC_E830;
+}
+
 /**
  * ice_is_e823
  * @hw: pointer to the hardware structure
drivers/net/ice/base/ice_common.h +1 -0
index 6517a1effe..4a871d69b5 100644
@@ -266,6 +266,7 @@ void ice_print_rollback_msg(struct ice_hw *hw);
 bool ice_is_generic_mac(struct ice_hw *hw);
 bool ice_is_e810(struct ice_hw *hw);
 bool ice_is_e810t(struct ice_hw *hw);
+bool ice_is_e830(struct ice_hw *hw);
 bool ice_is_e825c(struct ice_hw *hw);
 bool ice_is_e823(struct ice_hw *hw);
 int
drivers/net/ice/base/ice_devids.h +18 -0
index 19478d2db1..49d642372a 100644
@@ -15,6 +15,24 @@
 #define ICE_DEV_ID_E823L_1GBE		0x124F
 /* Intel(R) Ethernet Connection E823-L for QSFP */
 #define ICE_DEV_ID_E823L_QSFP		0x151D
+/* Intel(R) Ethernet Controller E830-CC for backplane */
+#define ICE_DEV_ID_E830_BACKPLANE	0x12D1
+/* Intel(R) Ethernet Controller E830-CC for QSFP */
+#define ICE_DEV_ID_E830_QSFP56		0x12D2
+/* Intel(R) Ethernet Controller E830-CC for SFP */
+#define ICE_DEV_ID_E830_SFP		0x12D3
+/* Intel(R) Ethernet Controller E830-C for backplane */
+#define ICE_DEV_ID_E830C_BACKPLANE      0x12D5
+/* Intel(R) Ethernet Controller E830-XXV for backplane */
+#define ICE_DEV_ID_E830_XXV_BACKPLANE   0x12DC
+/* Intel(R) Ethernet Controller E830-C for QSFP */
+#define ICE_DEV_ID_E830C_QSFP           0x12D8
+/* Intel(R) Ethernet Controller E830-XXV for QSFP */
+#define ICE_DEV_ID_E830_XXV_QSFP        0x12DD
+/* Intel(R) Ethernet Controller E830-C for SFP */
+#define ICE_DEV_ID_E830C_SFP            0x12DA
+/* Intel(R) Ethernet Controller E830-XXV for SFP */
+#define ICE_DEV_ID_E830_XXV_SFP         0x12DE
 /* Intel(R) Ethernet Controller E810-C for backplane */
 #define ICE_DEV_ID_E810C_BACKPLANE	0x1591
 /* Intel(R) Ethernet Controller E810-C for QSFP */
drivers/net/ice/base/ice_hw_autogen.h +5 -0
index c17fbd83a2..3d5d8950bf 100644
@@ -7,6 +7,11 @@
 #ifndef _ICE_HW_AUTOGEN_H_
 #define _ICE_HW_AUTOGEN_H_
 
+#define E830_PRTTSYN_TXTIME_H(_i)		(0x001E5004 + ((_i) * 64)) /* _i=0...63 */ /* Reset Source: GLOBR */
+#define E830_PRTTSYN_TXTIME_L(_i)		(0x001E5000 + ((_i) * 64)) /* _i=0...63 */ /* Reset Source: GLOBR */
+#define E830_PRTMAC_TS_TX_MEM_VALID_L		0x001E2000 /* Reset Source: GLOBR */
+#define E830_PRTMAC_TS_TX_MEM_VALID_H		0x001E2020 /* Reset Source: GLOBR */
+
 #define GL_HIDA(_i)			(0x00082000 + ((_i) * 4))
 #define GL_HIBA(_i)			(0x00081000 + ((_i) * 4))
 #define GL_HICR				0x00082040
drivers/net/ice/base/ice_ptp_hw.c +139 -5

224 lines not on this page · raw message

drivers/net/ice/base/ice_ptp_hw.h +8 -1
index d55eb99178..d88ecbbef3 100644
@@ -482,7 +482,9 @@ int ice_ptp_init_phy_cfg(struct ice_hw *hw);
 #define ETH_GLTSYN_SHADJ_H(_i)		(0x0300037C + ((_i) * 32))
 
 /* E810 timer command register */
-#define ETH_GLTSYN_CMD			0x03000344
+#define E810_ETH_GLTSYN_CMD		0x03000344
+/* E830 timer command register */
+#define E830_ETH_GLTSYN_CMD		0x00088814
 
 /* Source timer incval macros */
 #define INCVAL_HIGH_M			0xFF
@@ -522,6 +524,11 @@ int ice_ptp_init_phy_cfg(struct ice_hw *hw);
 #define LOW_TX_MEMORY_BANK_START	0x03090000
 #define HIGH_TX_MEMORY_BANK_START	0x03090004
 
+#define E830_LOW_TX_MEMORY_BANK(slot, port) \
+				(E830_PRTTSYN_TXTIME_L(slot) + 0x8 * (port))
+#define E830_HIGH_TX_MEMORY_BANK(slot, port) \
+				(E830_PRTTSYN_TXTIME_H(slot) + 0x8 * (port))
+
 /* E810T PCA9575 IO controller registers */
 #define ICE_PCA9575_P0_IN	0x0
 #define ICE_PCA9575_P1_IN	0x1
drivers/net/ice/base/ice_type.h +2 -0
index 1e133bb1a6..907764d66b 100644
@@ -204,6 +204,7 @@ enum ice_set_fc_aq_failures {
 enum ice_mac_type {
 	ICE_MAC_UNKNOWN = 0,
 	ICE_MAC_E810,
+	ICE_MAC_E830,
 	ICE_MAC_GENERIC,
 	ICE_MAC_GENERIC_3K,
 	ICE_MAC_GENERIC_3K_E825,
@@ -1233,6 +1234,7 @@ enum ice_phy_cfg {
 	ICE_PHY_E810 = 1,
 	ICE_PHY_E822,
 	ICE_PHY_ETH56G,
+	ICE_PHY_E830,
 };
 
 /* Port hardware description */
Signature · 1 line
2.43.0
#47 lore raw

PATCH v2 34/148 net/ice/base: fix resource leak

In reply to Anatoly Burakov

From: Ian Stokes <[email protected]>

When errors happen during OROM reads, the allocated buffer is not freed. Fix it by adding a goto label to free the buffer in case of error.

---
 drivers/net/ice/base/ice_nvm.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
drivers/net/ice/base/ice_nvm.c +6 -4
index 9cebe7a07b..55e624cb31 100644
@@ -748,7 +748,7 @@ ice_get_orom_civd_data(struct ice_hw *hw, enum ice_bank_select bank,
 				       orom_data, hw->flash.banks.orom_size);
 	if (status) {
 		ice_debug(hw, ICE_DBG_NVM, "Unable to read Option ROM data\n");
-		return status;
+		goto exit_error;;
 	}
 
 	/* Scan the memory buffer to locate the CIVD data section */
@@ -772,7 +772,8 @@ ice_get_orom_civd_data(struct ice_hw *hw, enum ice_bank_select bank,
 		if (sum) {
 			ice_debug(hw, ICE_DBG_NVM, "Found CIVD data with invalid checksum of %u\n",
 				  sum);
-			goto err_invalid_checksum;
+			status = ICE_ERR_NVM;
+			goto exit_error;
 		}
 
 		*civd = *tmp;
@@ -780,11 +781,12 @@ ice_get_orom_civd_data(struct ice_hw *hw, enum ice_bank_select bank,
 		return 0;
 	}
 
+	status = ICE_ERR_NVM;
 	ice_debug(hw, ICE_DBG_NVM, "Unable to locate CIVD data within the Option ROM\n");
 
-err_invalid_checksum:
+exit_error:
 	ice_free(hw, orom_data);
-	return ICE_ERR_NVM;
+	return status;
 }
 
 /**
Signature · 1 line
2.43.0
#48 lore raw

PATCH v2 35/148 net/ice/base: move lock outside of if-else

In reply to Anatoly Burakov

From: Ian Stokes <[email protected]>

When current version of driver snapshot was generated, there was a "fix" applied to it that moved the lock inside the if-else block. This change was made in error and was later reverted in the upstream driver, so adjust DPDK driver accordingly.

---
 drivers/net/ice/base/ice_flow.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/net/ice/base/ice_flow.c +2 -4
index 3a34771f21..8473c2b964 100644
@@ -4387,13 +4387,11 @@ ice_add_rss_cfg(struct ice_hw *hw, u16 vsi_handle,
 	    cfg->hash_flds == ICE_HASH_INVALID)
 		return ICE_ERR_PARAM;
 
+	ice_acquire_lock(&hw->rss_locks);
 	local_cfg = *cfg;
 	if (cfg->hdr_type < ICE_RSS_ANY_HEADERS) {
-		ice_acquire_lock(&hw->rss_locks);
 		status = ice_add_rss_cfg_sync(hw, vsi_handle, &local_cfg);
-		ice_release_lock(&hw->rss_locks);
 	} else {
-		ice_acquire_lock(&hw->rss_locks);
 		local_cfg.hdr_type = ICE_RSS_OUTER_HEADERS;
 		status = ice_add_rss_cfg_sync(hw, vsi_handle, &local_cfg);
 		if (!status) {
@@ -4401,8 +4399,8 @@ ice_add_rss_cfg(struct ice_hw *hw, u16 vsi_handle,
 			status = ice_add_rss_cfg_sync(hw, vsi_handle,
 						      &local_cfg);
 		}
-		ice_release_lock(&hw->rss_locks);
 	}
+	ice_release_lock(&hw->rss_locks);
 
 	return status;
 }
Signature · 1 line
2.43.0
#49 lore raw

PATCH v2 36/148 net/ice/base: refactor control queue send delay

In reply to Anatoly Burakov

From: Ian Stokes <[email protected]>

Since we know that most side band queue messages complete within 2-3 microseconds, introduce an initial 5 microsecond delay before we enter the main timeout loop. Use ice_flush(hw) first to ensure that we immediately flush the tail bump before delaying. This should mean that in practice almost all side band messages will be completed at the first ice_sq_done() check.

Because the driver already uses non-sleeping delays, it should not affect the CPU usage in a negative way to check more frequently.

Currently, the delay is specified using a macro which makes reading the code difficult as you must look up the macro to figure out the delay value. In general we try to avoid such "magic" numbers. However, delay values aren't really magic they're a number. Using a macro obscures the intent here, plus the macro names are rather long. I double checked the Linux kernel and nearly all invocations of udelay, usleep_range, and msleep today use raw values or some multiple of HZ in the case of msleep.

These changes should reduce the amount of time that the driver spins a CPU, minimizing CPU waste, and reducing the time required to process most control queue messages.

---
 drivers/net/ice/base/ice_controlq.c | 8 +++++++-
 drivers/net/ice/base/ice_controlq.h | 3 +--
 2 files changed, 8 insertions(+), 3 deletions(-)
drivers/net/ice/base/ice_controlq.c +7 -1
index cac04c6a98..c2cf747b65 100644
@@ -1048,12 +1048,18 @@ ice_sq_send_cmd_nolock(struct ice_hw *hw, struct ice_ctl_q_info *cq,
 	if (cq->sq.next_to_use == cq->sq.count)
 		cq->sq.next_to_use = 0;
 	wr32(hw, cq->sq.tail, cq->sq.next_to_use);
+	ice_flush(hw);
+
+	/* Wait a short time before initial ice_sq_done() check, to allow
+	 * hardware time for completion.
+	 */
+	ice_usec_delay(5, false);
 
 	do {
 		if (ice_sq_done(hw, cq))
 			break;
 
-		ice_usec_delay(ICE_CTL_Q_SQ_CMD_USEC, false);
+		ice_usec_delay(10, false);
 		total_delay++;
 	} while (total_delay < cq->sq_cmd_timeout);
 
drivers/net/ice/base/ice_controlq.h +1 -2
index 5c5bb069d8..45394ee695 100644
@@ -35,8 +35,7 @@ enum ice_ctl_q {
 };
 
 /* Control Queue timeout settings - max delay 1s */
-#define ICE_CTL_Q_SQ_CMD_TIMEOUT	10000 /* Count 10000 times */
-#define ICE_CTL_Q_SQ_CMD_USEC		100   /* Check every 100usec */
+#define ICE_CTL_Q_SQ_CMD_TIMEOUT	100000	/* Count 100000 times */
 #define ICE_CTL_Q_ADMIN_INIT_TIMEOUT	10    /* Count 10 times */
 #define ICE_CTL_Q_ADMIN_INIT_MSEC	100   /* Check every 100msec */
 
Signature · 1 line
2.43.0
#50 lore raw

PATCH v2 37/148 net/ice/base: fix NVM feature check

In reply to Anatoly Burakov

From: Ian Stokes <[email protected]>

Add defines required by NVM feature check. Although not directly used in this patch this change is required in order to better match upstream.

---
 drivers/net/ice/base/ice_adminq_cmd.h | 2 ++
 1 file changed, 2 insertions(+)
drivers/net/ice/base/ice_adminq_cmd.h +2 -0
index 6add57d797..89f565d09f 100644
@@ -131,6 +131,8 @@ struct ice_aqc_list_caps_elem {
 #define ICE_AQC_CAPS_NAC_TOPOLOGY			0x0087
 #define ICE_AQC_CAPS_OROM_RECOVERY_UPDATE		0x0090
 #define ICE_AQC_CAPS_ROCEV2_LAG				0x0092
+#define ICE_AQC_BIT_ROCEV2_LAG				0x01
+#define ICE_AQC_BIT_SRIOV_LAG				0x02
 
 	u8 major_ver;
 	u8 minor_ver;
Signature · 1 line
2.43.0
#51 lore raw

Re: [PATCH v2 037/148] net/ice/base: fix NVM feature check

Quoted 15 lines · Anatoly Burakov

From: Ian Stokes <[email protected]>

Add defines required by NVM feature check. Although not directly used in this patch this change is required in order to better match upstream.

---
 drivers/net/ice/base/ice_adminq_cmd.h | 2 ++
 1 file changed, 2 insertions(+)
drivers/net/ice/base/ice_adminq_cmd.h +0 -0
index 6add57d797..89f565d09f 100644

drivers/net/ice/base/ice_adminq_cmd.h struct ice_aqc_list_caps_elem { · line 136

Quoted 6 lines
drivers/net/ice/base/ice_adminq_cmd.h +2 -0
@@ -131,6 +131,8 @@ struct ice_aqc_list_caps_elem {
 #define ICE_AQC_CAPS_NAC_TOPOLOGY			0x0087
 #define ICE_AQC_CAPS_OROM_RECOVERY_UPDATE		0x0090
 #define ICE_AQC_CAPS_ROCEV2_LAG				0x0092
+#define ICE_AQC_BIT_ROCEV2_LAG				0x01
+#define ICE_AQC_BIT_SRIOV_LAG				0x02
 

For defines like this that are just for alignment with the base code, I'd merge to a single patch, or into other patches that add other defines. Similar defines are in patch 40 here, so at minimum those can be merged.

/Bruce

#52 lore raw

PATCH v2 38/148 net/ice/base: allow for dumping all clusters

In reply to Anatoly Burakov

From: Ian Stokes <[email protected]>

Define MNG Transactions cluster ID, as well as adjust definition of 0xFF08 admin command according to better match data sheet. Also, modify ice_aq_get_internal_data() wrapping function so that it returns next cluster ID.

---
 drivers/net/ice/base/ice_adminq_cmd.h |  3 +--
 drivers/net/ice/base/ice_common.c     | 11 +++++++----
 drivers/net/ice/base/ice_common.h     |  6 +++---
 drivers/net/ice/ice_diagnose.c        |  7 ++++---
 4 files changed, 15 insertions(+), 12 deletions(-)
drivers/net/ice/base/ice_adminq_cmd.h +1 -2
index 89f565d09f..3b917e9d7d 100644
@@ -2905,7 +2905,7 @@ struct ice_aqc_event_lan_overflow {
 
 /* Debug Dump Internal Data (indirect 0xFF08) */
 struct ice_aqc_debug_dump_internals {
-	u8 cluster_id;
+	__le16 cluster_id; /* Expresses next cluster ID in response */
 #define ICE_AQC_DBG_DUMP_CLUSTER_ID_SW			0
 #define ICE_AQC_DBG_DUMP_CLUSTER_ID_ACL			1
 #define ICE_AQC_DBG_DUMP_CLUSTER_ID_TXSCHED		2
@@ -2920,7 +2920,6 @@ struct ice_aqc_debug_dump_internals {
 #define ICE_AQC_DBG_DUMP_CLUSTER_ID_QUEUE_MNG		9
 #define ICE_AQC_DBG_DUMP_CLUSTER_ID_FULL_CSR_SPACE	21
 #define ICE_ACQ_DBG_DUMP_CLUSTER_ID_MNG_TRANSACTION	22
-	u8 reserved;
 	__le16 table_id; /* Used only for non-memory clusters */
 	__le32 idx; /* In table entries for tables, in bytes for memory */
 	__le32 addr_high;
drivers/net/ice/base/ice_common.c +7 -4
index 977071e1e9..6266b67f24 100644
@@ -4858,6 +4858,7 @@ ice_set_ctx(struct ice_hw *hw, u8 *src_ctx, u8 *dest_ctx,
  * @buf: dump buffer
  * @buf_size: dump buffer size
  * @ret_buf_size: return buffer size (returned by FW)
+ * @ret_next_cluster: next cluster to read (returned by FW)
  * @ret_next_table: next block to read (returned by FW)
  * @ret_next_index: next index to read (returned by FW)
  * @cd: pointer to command details structure
@@ -4865,10 +4866,10 @@ ice_set_ctx(struct ice_hw *hw, u8 *src_ctx, u8 *dest_ctx,
  * Get internal FW/HW data (0xFF08) for debug purposes.
  */
 int
-ice_aq_get_internal_data(struct ice_hw *hw, u8 cluster_id, u16 table_id,
+ice_aq_get_internal_data(struct ice_hw *hw, u16 cluster_id, u16 table_id,
 			 u32 start, void *buf, u16 buf_size, u16 *ret_buf_size,
-			 u16 *ret_next_table, u32 *ret_next_index,
-			 struct ice_sq_cd *cd)
+			 u16 *ret_next_cluster, u16 *ret_next_table,
+			 u32 *ret_next_index, struct ice_sq_cd *cd)
 {
 	struct ice_aqc_debug_dump_internals *cmd;
 	struct ice_aq_desc desc;
@@ -4881,7 +4882,7 @@ ice_aq_get_internal_data(struct ice_hw *hw, u8 cluster_id, u16 table_id,
 
 	ice_fill_dflt_direct_cmd_desc(&desc, ice_aqc_opc_debug_dump_internals);
 
-	cmd->cluster_id = cluster_id;
+	cmd->cluster_id = CPU_TO_LE16(cluster_id);
 	cmd->table_id = CPU_TO_LE16(table_id);
 	cmd->idx = CPU_TO_LE32(start);
 
@@ -4890,6 +4891,8 @@ ice_aq_get_internal_data(struct ice_hw *hw, u8 cluster_id, u16 table_id,
 	if (!status) {
 		if (ret_buf_size)
 			*ret_buf_size = LE16_TO_CPU(desc.datalen);
+		if (ret_next_cluster)
+			*ret_next_cluster = LE16_TO_CPU(cmd->cluster_id);
 		if (ret_next_table)
 			*ret_next_table = LE16_TO_CPU(cmd->table_id);
 		if (ret_next_index)
drivers/net/ice/base/ice_common.h +3 -3
index 4a871d69b5..567c6481e9 100644
@@ -65,10 +65,10 @@ int ice_get_caps(struct ice_hw *hw);
 void ice_set_safe_mode_caps(struct ice_hw *hw);
 
 int
-ice_aq_get_internal_data(struct ice_hw *hw, u8 cluster_id, u16 table_id,
+ice_aq_get_internal_data(struct ice_hw *hw, u16 cluster_id, u16 table_id,
 			 u32 start, void *buf, u16 buf_size, u16 *ret_buf_size,
-			 u16 *ret_next_table, u32 *ret_next_index,
-			 struct ice_sq_cd *cd);
+			 u16 *ret_next_cluster, u16 *ret_next_table,
+			 u32 *ret_next_index, struct ice_sq_cd *cd);
 
 /* Define a macro that will align a pointer to point to the next memory address
  * that falls on the given power of 2 (i.e., 2, 4, 8, 16, 32, 64...). For
drivers/net/ice/ice_diagnose.c +4 -3
index 3be819d7f8..3e9d25a8ea 100644
@@ -437,9 +437,10 @@ static int
 ice_dump_switch(struct rte_eth_dev *dev, uint8_t **buff2, uint32_t *size)
 {
 	struct ice_hw *hw;
+	struct ice_sq_cd *cd = NULL;
 	int i = 0;
 	uint16_t tbl_id = 0;
-	uint32_t tbl_idx = 0;
+	uint16_t tbl_idx = 0;
 	uint8_t *buffer = *buff2;
 
 	hw = ICE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
@@ -469,7 +470,7 @@ ice_dump_switch(struct rte_eth_dev *dev, uint8_t **buff2, uint32_t *size)
 			ICE_AQC_DBG_DUMP_CLUSTER_ID_SW,
 			tbl_id, tbl_idx, buff,
 			ICE_PKG_BUF_SIZE,
-			&buff_size, &tbl_id, &tbl_idx, NULL);
+			&buff_size, &tbl_id, &tbl_idx, NULL, cd);
 
 		if (res) {
 			free(buff);
@@ -481,7 +482,7 @@ ice_dump_switch(struct rte_eth_dev *dev, uint8_t **buff2, uint32_t *size)
 
 		free(buff);
 
-		if (tbl_idx == 0xffffffff) {
+		if (tbl_idx == 0xffff) {
 			tbl_idx = 0;
 			memset(buffer, '\n', sizeof(char));
 			buffer++;
Signature · 1 line
2.43.0
#53 lore raw

PATCH v2 39/148 net/ice/base: remove PTP aqc_driver_params

In reply to Anatoly Burakov

From: Ian Stokes <[email protected]>

With the introduction of PTP auxiliary bus driver, aqc_driver_params are no longer needed to share data between the PFs.

---
 drivers/net/ice/base/ice_adminq_cmd.h | 5 -----
 1 file changed, 5 deletions(-)
drivers/net/ice/base/ice_adminq_cmd.h +0 -5
index 3b917e9d7d..82f5e8bd76 100644
@@ -2887,11 +2887,6 @@ struct ice_aqc_driver_shared_params {
 };
 
 enum ice_aqc_driver_params {
-	/* OS clock index for PTP timer Domain 0 */
-	ICE_AQC_DRIVER_PARAM_CLK_IDX_TMR0 = 0,
-	/* OS clock index for PTP timer Domain 1 */
-	ICE_AQC_DRIVER_PARAM_CLK_IDX_TMR1,
-
 	/* Add new parameters above */
 	ICE_AQC_DRIVER_PARAM_MAX = 16,
 };
Signature · 1 line
2.43.0
#54 lore raw

PATCH v2 40/148 net/ice/base: add FW load status mask

In reply to Anatoly Burakov

From: Ian Stokes <[email protected]>

Add a mask used to extract FW load status from GL_MNG_FWSM.

---
 drivers/net/ice/base/ice_hw_autogen.h | 1 +
 1 file changed, 1 insertion(+)
drivers/net/ice/base/ice_hw_autogen.h +1 -0
index 3d5d8950bf..fde5f9d86f 100644
@@ -5474,6 +5474,7 @@
 #define GL_MNG_FW_RAM_STAT_MNG_MEM_ECC_ERR_S	1
 #define GL_MNG_FW_RAM_STAT_MNG_MEM_ECC_ERR_M	BIT(1)
 #define GL_MNG_FWSM				0x000B6134 /* Reset Source: POR */
+#define GL_MNG_FWSM_FW_LOADING_M		BIT(30)
 #define GL_MNG_FWSM_FW_MODES_S			0
 #define GL_MNG_FWSM_FW_MODES_M			MAKEMASK(0x7, 0)
 #define GL_MNG_FWSM_RSV0_S			3
Signature · 1 line
2.43.0
#55 lore raw

Re: [PATCH v2 040/148] net/ice/base: add FW load status mask

Quoted 16 lines · Anatoly Burakov

From: Ian Stokes <[email protected]>

Add a mask used to extract FW load status from GL_MNG_FWSM.

---
 drivers/net/ice/base/ice_hw_autogen.h | 1 +
 1 file changed, 1 insertion(+)
drivers/net/ice/base/ice_hw_autogen.h +0 -0
index 3d5d8950bf..fde5f9d86f 100644

drivers/net/ice/base/ice_hw_autogen.h line 5480

Quoted 7 lines
drivers/net/ice/base/ice_hw_autogen.h +1 -0
@@ -5474,6 +5474,7 @@
 #define GL_MNG_FW_RAM_STAT_MNG_MEM_ECC_ERR_S	1
 #define GL_MNG_FW_RAM_STAT_MNG_MEM_ECC_ERR_M	BIT(1)
 #define GL_MNG_FWSM				0x000B6134 /* Reset Source: POR */
+#define GL_MNG_FWSM_FW_LOADING_M		BIT(30)
 #define GL_MNG_FWSM_FW_MODES_S			0
 #define GL_MNG_FWSM_FW_MODES_M			MAKEMASK(0x7, 0)
 #define GL_MNG_FWSM_RSV0_S			3

This can be merged into another patch. Either patch 37 as I suggested in comment on it, or perhaps better in patch 3.

/Bruce

#56 lore raw

PATCH v2 41/148 net/ice/base: add direction metadata

In reply to Anatoly Burakov

From: Ian Stokes <[email protected]>

Currently it is possible to create a filter which breaks TX traffic, e.g.:

tc filter add dev $PF1 ingress protocol ip prio 1 flower ip_proto udp dst_port $PORT action mirred egress redirect dev $VF1_PR

This adds a rule which might match both TX and RX traffic, and in TX path the PF will actually receive the traffic, which breaks communication.

To fix this, always add a direction flag. Currently it is possible to create a filter which breaks TX traffic, e.g.:

tc filter add dev $PF1 ingress protocol ip prio 1 flower ip_proto udp dst_port $PORT action mirred egress redirect dev $VF1_PR

This adds a rule which might match both TX and RX traffic, and in TX path the PF will actually receive the traffic, which breaks communication.

To fix this, always add a direction flag.

---
 drivers/net/ice/base/ice_protocol_type.h |  1 +
 drivers/net/ice/base/ice_switch.c        | 11 +++++++++++
 2 files changed, 12 insertions(+)
drivers/net/ice/base/ice_protocol_type.h +1 -0
index d2d3f75fc2..9f17b5d0f5 100644
@@ -225,6 +225,7 @@ enum ice_prot_id {
 #define ICE_TUN_FLAG_MDID 20
 #define ICE_TUN_FLAG_MDID_OFF(word)   (ICE_MDID_SIZE * (ICE_TUN_FLAG_MDID + (word)))
 #define ICE_TUN_FLAG_MASK 0xFF
+#define ICE_FROM_NETWORK_FLAG_MASK 0x8
 #define ICE_DIR_FLAG_MASK 0x10
 #define ICE_TUN_FLAG_IN_VLAN_MASK 0x80 /* VLAN inside tunneled header */
 #define ICE_TUN_FLAG_VLAN_MASK 0x01
drivers/net/ice/base/ice_switch.c +11 -0
index cf1ab35f26..ba8d2eb4b1 100644
@@ -7872,6 +7872,17 @@ ice_add_special_words(struct ice_adv_rule_info *rinfo,
 	u16 mask;
 	u16 off;
 
+	/* Always add direction flag */
+	if (lkup_exts->n_val_words < ICE_MAX_CHAIN_WORDS) {
+		u8 word = lkup_exts->n_val_words++;
+
+		lkup_exts->fv_words[word].prot_id = ICE_META_DATA_ID_HW;
+		lkup_exts->fv_words[word].off = ICE_TUN_FLAG_MDID_OFF(0);
+		lkup_exts->field_mask[word] = ICE_FROM_NETWORK_FLAG_MASK;
+	} else {
+		return ICE_ERR_MAX_LIMIT;
+	}
+
 	/* If this is a tunneled packet, then add recipe index to match the
 	 * tunnel bit in the packet metadata flags. If this is a tun_and_non_tun
 	 * packet, then add recipe index to match the direction bit in the flag.
Signature · 1 line
2.43.0
#57 lore raw

PATCH v2 42/148 net/ice/base: change data buffer in i2c write to be const

In reply to Anatoly Burakov

From: Ian Stokes <[email protected]>

Data should not be changed by generic i2c write, hence it should be const.

---
 drivers/net/ice/base/ice_common.c | 2 +-
 drivers/net/ice/base/ice_common.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/net/ice/base/ice_common.c +1 -1
index 6266b67f24..6c487e02dc 100644
@@ -5752,7 +5752,7 @@ ice_aq_read_i2c(struct ice_hw *hw, struct ice_aqc_link_topo_addr topo_addr,
  */
 int
 ice_aq_write_i2c(struct ice_hw *hw, struct ice_aqc_link_topo_addr topo_addr,
-		 u16 bus_addr, __le16 addr, u8 params, u8 *data,
+		 u16 bus_addr, __le16 addr, u8 params, const u8 *data,
 		 struct ice_sq_cd *cd)
 {
 	struct ice_aq_desc desc = { 0 };
drivers/net/ice/base/ice_common.h +1 -1
index 567c6481e9..14620d05b4 100644
@@ -298,7 +298,7 @@ ice_aq_read_i2c(struct ice_hw *hw, struct ice_aqc_link_topo_addr topo_addr,
 		struct ice_sq_cd *cd);
 int
 ice_aq_write_i2c(struct ice_hw *hw, struct ice_aqc_link_topo_addr topo_addr,
-		 u16 bus_addr, __le16 addr, u8 params, u8 *data,
+		 u16 bus_addr, __le16 addr, u8 params, const u8 *data,
 		 struct ice_sq_cd *cd);
 bool ice_fw_supports_report_dflt_cfg(struct ice_hw *hw);
 /* AQ API version for FW auto drop reports */
Signature · 1 line
2.43.0
#58 lore raw

PATCH v2 43/148 net/ice/base: remove unused code from upstream build

In reply to Anatoly Burakov

From: Ian Stokes <[email protected]>

Align code to better resemble upstream.

---
 drivers/net/ice/base/ice_adminq_cmd.h | 33 ---------------------------
 1 file changed, 33 deletions(-)
drivers/net/ice/base/ice_adminq_cmd.h +0 -33
index 82f5e8bd76..cfc13f0b2b 100644
@@ -109,7 +109,6 @@ struct ice_aqc_list_caps {
 struct ice_aqc_list_caps_elem {
 	__le16 cap;
 #define ICE_AQC_CAPS_VALID_FUNCTIONS			0x0005
-#define ICE_AQC_MAX_VALID_FUNCTIONS			0x8
 #define ICE_AQC_CAPS_VSI				0x0017
 #define ICE_AQC_CAPS_DCB				0x0018
 #define ICE_AQC_CAPS_RSS				0x0040
@@ -997,25 +996,6 @@ struct ice_sw_rule_vsi_list {
 };
 #pragma pack()
 
-#pragma pack(1)
-/* Query VSI list command/response entry */
-struct ice_sw_rule_vsi_list_query {
-	__le16 index;
-	u8 vsi_list[DIVIDE_AND_ROUND_UP(ICE_MAX_VSI, BITS_PER_BYTE)];
-};
-#pragma pack()
-
-/* PFC Ignore (direct 0x0301)
- * The command and response use the same descriptor structure
- */
-struct ice_aqc_pfc_ignore {
-	u8	tc_bitmap;
-	u8	cmd_flags; /* unused in response */
-#define ICE_AQC_PFC_IGNORE_SET		BIT(7)
-#define ICE_AQC_PFC_IGNORE_CLEAR	0
-	u8	reserved[14];
-};
-
 /* Query PFC Mode (direct 0x0302)
  * Set PFC Mode (direct 0x0303)
  */
@@ -1030,17 +1010,6 @@ struct ice_aqc_set_query_pfc_mode {
 	u8	rsvd[15];
 };
 
-/* Set DCB Parameters (direct 0x0306) */
-struct ice_aqc_set_dcb_params {
-	u8 cmd_flags; /* unused in response */
-#define ICE_AQC_LINK_UP_DCB_CFG    BIT(0)
-#define ICE_AQC_PERSIST_DCB_CFG    BIT(1)
-	u8 valid_flags; /* unused in response */
-#define ICE_AQC_LINK_UP_DCB_CFG_VALID    BIT(0)
-#define ICE_AQC_PERSIST_DCB_CFG_VALID    BIT(1)
-	u8 rsvd[14];
-};
-
 /* Get Default Topology (indirect 0x0400) */
 struct ice_aqc_get_topo {
 	u8 port_num;
@@ -3072,9 +3041,7 @@ struct ice_aq_desc {
 		struct ice_aqc_nvm nvm;
 		struct ice_aqc_nvm_cfg nvm_cfg;
 		struct ice_aqc_nvm_checksum nvm_checksum;
-		struct ice_aqc_pfc_ignore pfc_ignore;
 		struct ice_aqc_set_query_pfc_mode set_query_pfc_mode;
-		struct ice_aqc_set_dcb_params set_dcb_params;
 		struct ice_aqc_lldp_get_mib lldp_get_mib;
 		struct ice_aqc_lldp_set_mib_change lldp_set_event;
 		struct ice_aqc_lldp_add_delete_tlv lldp_add_delete_tlv;
Signature · 1 line
2.43.0
#59 lore raw

PATCH v2 44/148 net/ice/base: fix sign-extension

In reply to Anatoly Burakov

From: Ian Stokes <[email protected]>

Fix a static analysis warning where if the 16-bit value in mask has the high-bit set, it will be sign extended by the shift left (which converts it to a signed integer). Avoid this by casting to a u32 to make sure the conversion happens before the shift and that it stays unsigned.

---
 drivers/net/ice/base/ice_flex_pipe.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)
drivers/net/ice/base/ice_flex_pipe.c +3 -5
index e06dbb0885..413b6f8ece 100644
@@ -1534,16 +1534,14 @@ ice_write_prof_mask_reg(struct ice_hw *hw, enum ice_block blk, u16 mask_idx,
 	switch (blk) {
 	case ICE_BLK_RSS:
 		offset = GLQF_HMASK(mask_idx);
-		val = (idx << GLQF_HMASK_MSK_INDEX_S) &
-			GLQF_HMASK_MSK_INDEX_M;
-		val |= (mask << GLQF_HMASK_MASK_S) & GLQF_HMASK_MASK_M;
+		val = (idx << GLQF_HMASK_MSK_INDEX_S) & GLQF_HMASK_MSK_INDEX_M;
+		val |= ((u32)mask << GLQF_HMASK_MASK_S) & GLQF_HMASK_MASK_M;
 		break;
 	case ICE_BLK_FD:
 		offset = GLQF_FDMASK(mask_idx);
 		val = (idx << GLQF_FDMASK_MSK_INDEX_S) &
 			GLQF_FDMASK_MSK_INDEX_M;
-		val |= (mask << GLQF_FDMASK_MASK_S) &
-			GLQF_FDMASK_MASK_M;
+		val |= ((u32)mask << GLQF_FDMASK_MASK_S) & GLQF_FDMASK_MASK_M;
 		break;
 	default:
 		ice_debug(hw, ICE_DBG_PKG, "No profile masks for block %d\n",
Signature · 1 line
2.43.0
#60 lore raw

PATCH v2 45/148 net/ice/base: implement switch recipe reuse feature

In reply to Anatoly Burakov

From: Ian Stokes <[email protected]>

If FW supports the corresponding functionality, the driver allows PFs to subscribe the same switch recipes. Then when the PF is done with a switch recipe, the PF can ask the FW to free that switch recipe.

When the FW detects that all subscribing PFs have freed the switch recipe, the FW will free the switch recipe so that it can be reused.

This feature also fixes a problem where all switch recipes would eventually be exhausted because switch recipes could not be freed, as freeing a shared recipe could potentially break other PFs that were using it.

---
 drivers/net/ice/base/ice_adminq_cmd.h |   2 +
 drivers/net/ice/base/ice_common.c     |   2 +
 drivers/net/ice/base/ice_switch.c     | 277 +++++++++++++++++++++++---
 drivers/net/ice/base/ice_switch.h     |   2 +
 drivers/net/ice/base/ice_type.h       |   2 +
 5 files changed, 262 insertions(+), 23 deletions(-)
drivers/net/ice/base/ice_adminq_cmd.h +2 -0
index cfc13f0b2b..8d6de52a72 100644
@@ -308,6 +308,8 @@ struct ice_aqc_set_port_params {
 #define ICE_AQC_RES_TYPE_FLAG_SHARED			BIT(7)
 #define ICE_AQC_RES_TYPE_FLAG_SCAN_BOTTOM		BIT(12)
 #define ICE_AQC_RES_TYPE_FLAG_IGNORE_INDEX		BIT(13)
+#define ICE_AQC_RES_TYPE_FLAG_SUBSCRIBE_SHARED		BIT(14)
+#define ICE_AQC_RES_TYPE_FLAG_SUBSCRIBE_CTL		BIT(15)
 
 #define ICE_AQC_RES_TYPE_FLAG_DEDICATED			0x00
 
drivers/net/ice/base/ice_common.c +2 -0
index 6c487e02dc..45fea193da 100644
@@ -1141,6 +1141,8 @@ int ice_init_hw(struct ice_hw *hw)
 		goto err_unroll_fltr_mgmt_struct;
 	ice_init_lock(&hw->tnl_lock);
 
+	ice_init_chk_subscribable_recipe_support(hw);
+
 	return 0;
 
 err_unroll_fltr_mgmt_struct:
drivers/net/ice/base/ice_switch.c +254 -23

388 lines not on this page · raw message

drivers/net/ice/base/ice_switch.h +2 -0
index 184e30f226..939fa6df3c 100644
@@ -565,6 +565,8 @@ int
 ice_aq_get_recipe_to_profile(struct ice_hw *hw, u32 profile_id, u8 *r_bitmap,
 			     struct ice_sq_cd *cd);
 
+void ice_init_chk_subscribable_recipe_support(struct ice_hw *hw);
+
 int ice_alloc_recipe(struct ice_hw *hw, u16 *recipe_id);
 int
 ice_add_adv_rule(struct ice_hw *hw, struct ice_adv_lkup_elem *lkups,
drivers/net/ice/base/ice_type.h +2 -0
index 907764d66b..79a6c1aa0f 100644
@@ -1400,6 +1400,8 @@ struct ice_hw {
 	ice_declare_bitmap(hw_ptype, ICE_FLOW_PTYPE_MAX);
 	u8 dvm_ena;
 	u16 io_expander_handle;
+
+	bool subscribable_recipes_supported;
 };
 
 /* Statistics collected by each port, VSI, VEB, and S-channel */
Signature · 1 line
2.43.0
#61 lore raw

Re: [PATCH v2 045/148] net/ice/base: implement switch recipe reuse feature

Quoted 23 lines · Anatoly Burakov

From: Ian Stokes <[email protected]>

If FW supports the corresponding functionality, the driver allows PFs to subscribe the same switch recipes. Then when the PF is done with a switch recipe, the PF can ask the FW to free that switch recipe.

When the FW detects that all subscribing PFs have freed the switch recipe, the FW will free the switch recipe so that it can be reused.

This feature also fixes a problem where all switch recipes would eventually be exhausted because switch recipes could not be freed, as freeing a shared recipe could potentially break other PFs that were using it.

---
 drivers/net/ice/base/ice_adminq_cmd.h |   2 +
 drivers/net/ice/base/ice_common.c     |   2 +
 drivers/net/ice/base/ice_switch.c     | 277 +++++++++++++++++++++++---
 drivers/net/ice/base/ice_switch.h     |   2 +
 drivers/net/ice/base/ice_type.h       |   2 +
 5 files changed, 262 insertions(+), 23 deletions(-)

<snip>

drivers/net/ice/base/ice_switch.c int ice_alloc_recipe(struct ice_hw *hw, u16 *rid) · line 3863

Quoted 6 lines
drivers/net/ice/base/ice_switch.c +6 -0
+/**
+ * ice_alloc_recipe - add recipe resource
+ * @hw: pointer to the hardware structure
+ * @rid: recipe ID returned as response to AQ call
+ */
+enum ice_status ice_alloc_recipe(struct ice_hw *hw, u16 *rid)

This use of ice_status here in this patch breaks the patch-by-patch builds.

error: conflicting types for 'ice_alloc_recipe' due to enum/integer mismatch;

Probably want to convert the ice_status's to ints globally here.

/Bruce

#62 lore raw

PATCH v2 46/148 net/ice/base: add helper function for refsync

In reply to Anatoly Burakov

From: Ian Stokes <[email protected]>

Add a helper function to determine whether a given pin of DPLL is capable for refsync configuration.

---
 drivers/net/ice/base/ice_ptp_hw.c | 16 ++++++++++++++++
 drivers/net/ice/base/ice_ptp_hw.h |  1 +
 2 files changed, 17 insertions(+)
drivers/net/ice/base/ice_ptp_hw.c +16 -0
index 084532c5fc..db28aa308c 100644
@@ -5783,3 +5783,19 @@ int ice_ptp_init_phc(struct ice_hw *hw)
 
 	return status;
 }
+
+/**
+ * refsync_pin_id_valid
+ * @hw: pointer to the HW struct
+ * @id: pin index
+ *
+ * Checks whether DPLL's input pin can be configured to ref-sync pairing mode.
+ */
+bool refsync_pin_id_valid(struct ice_hw *hw, u8 id)
+{
+	/* refsync is allowed only on pins 1 or 5 for E810T */
+	if (ice_is_e810t(hw) && id != 1 && id != 5)
+		return false;
+
+	return true;
+}
drivers/net/ice/base/ice_ptp_hw.h +1 -0
index d88ecbbef3..04556db7e9 100644
@@ -142,6 +142,7 @@ ice_read_phy_tstamp(struct ice_hw *hw, u8 block, u8 idx, u64 *tstamp);
 int
 ice_clear_phy_tstamp(struct ice_hw *hw, u8 block, u8 idx);
 int ice_ptp_init_phc(struct ice_hw *hw);
+bool refsync_pin_id_valid(struct ice_hw *hw, u8 id);
 
 /* E822 family functions */
 int
Signature · 1 line
2.43.0
#63 lore raw

PATCH v2 47/148 net/ice/base: added informational message for NAC topology

In reply to Anatoly Burakov

From: Ian Stokes <[email protected]>

Use proper bitmask to verify primary/secondary mode instead of whole 'mode' field, which also includes other information. In the result, for Mode 2a for example, 'secondary' mode was always reported which was misleading.

---
 drivers/net/ice/base/ice_common.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/net/ice/base/ice_common.c +4 -0
index 45fea193da..62c68b6d73 100644
@@ -2886,6 +2886,10 @@ ice_parse_nac_topo_dev_caps(struct ice_hw *hw, struct ice_hw_dev_caps *dev_p,
 	dev_p->nac_topo.mode = LE32_TO_CPU(cap->number);
 	dev_p->nac_topo.id = LE32_TO_CPU(cap->phys_id) & ICE_NAC_TOPO_ID_M;
 
+	ice_info(hw, "PF is configured in %s mode with IP instance ID %d\n",
+		 (dev_p->nac_topo.mode & ICE_NAC_TOPO_PRIMARY_M) ?
+		 "primary" : "secondary", dev_p->nac_topo.id);
+
 	ice_debug(hw, ICE_DBG_INIT, "dev caps: nac topology is_primary = %d\n",
 		  !!(dev_p->nac_topo.mode & ICE_NAC_TOPO_PRIMARY_M));
 	ice_debug(hw, ICE_DBG_INIT, "dev caps: nac topology is_dual = %d\n",
Signature · 1 line
2.43.0
#64 lore raw

Re: [PATCH v2 047/148] net/ice/base: added informational message for NAC topology

Quoted 6 lines · Anatoly Burakov

From: Ian Stokes <[email protected]>

Use proper bitmask to verify primary/secondary mode instead of whole 'mode' field, which also includes other information. In the result, for Mode 2a for example, 'secondary' mode was always reported which was misleading.

Commit log is not accurate for this, I think. Commit title alone is probably sufficient for such a simple change, or at most a one-line description of it.

/Bruce

Quoted 24 lines
---
 drivers/net/ice/base/ice_common.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/net/ice/base/ice_common.c +4 -0
index 45fea193da..62c68b6d73 100644
@@ -2886,6 +2886,10 @@ ice_parse_nac_topo_dev_caps(struct ice_hw *hw, struct ice_hw_dev_caps *dev_p,
 	dev_p->nac_topo.mode = LE32_TO_CPU(cap->number);
 	dev_p->nac_topo.id = LE32_TO_CPU(cap->phys_id) & ICE_NAC_TOPO_ID_M;
 
+	ice_info(hw, "PF is configured in %s mode with IP instance ID %d\n",
+		 (dev_p->nac_topo.mode & ICE_NAC_TOPO_PRIMARY_M) ?
+		 "primary" : "secondary", dev_p->nac_topo.id);
+
 	ice_debug(hw, ICE_DBG_INIT, "dev caps: nac topology is_primary = %d\n",
 		  !!(dev_p->nac_topo.mode & ICE_NAC_TOPO_PRIMARY_M));
 	ice_debug(hw, ICE_DBG_INIT, "dev caps: nac topology is_dual = %d\n",
Signature · 1 line
2.43.0
#65 lore raw

PATCH v2 48/148 net/ice/base: add Cage Max Power override NVM module

In reply to Anatoly Burakov

From: Ian Stokes <[email protected]>

Define Cage Max Power override NVM module which allows to override maximum power of QSFP/SFP cage. There might be up to 8 cages so each of them has its own word in the module. From the ice driver perspective we need only Override Enable bit so there is no need to define bits where maximum power s stored. This bit determines if the new max power should be used (1) or the default value should be used (0).

---
 drivers/net/ice/base/ice_adminq_cmd.h | 8 ++++++++
 1 file changed, 8 insertions(+)
drivers/net/ice/base/ice_adminq_cmd.h +8 -0
index 8d6de52a72..04a0b1cf9b 100644
@@ -1950,6 +1950,14 @@ struct ice_aqc_nvm {
 #define ICE_AQC_NVM_LLDP_STATUS_RD_LEN		4 /* In Bytes */
 
 #define ICE_AQC_NVM_TX_TOPO_MOD_ID		0x14B
+#define ICE_AQC_NVM_CMPO_MOD_ID			0x153
+
+/* Cage Max Power override NVM module */
+struct ice_aqc_nvm_cmpo {
+	__le16 length;
+#define ICE_AQC_NVM_CMPO_ENABLE	BIT(8)
+	__le16 cages_cfg[8];
+};
 
 struct ice_aqc_nvm_tx_topo_user_sel {
 	__le16 length;
Signature · 1 line
2.43.0
#66 lore raw

PATCH v2 49/148 net/ice/base: adapt No FEC in Auto support check to add E82X devices

In reply to Anatoly Burakov

From: Ian Stokes <[email protected]>

Previously, the "No FEC in Auto mode" feature was added to the link management engine (part of firmware) for E810 devices, and was unsupported at the time on E82X devices. However, this support is now being extended to new FW versions for E82X devices, and so the SW check to enable this mode must be changed to allow E82X devices as well.

Importantly, to support this, modify the existing the ice_is_fw_min_ver() function to no longer check FW Major/Minor/Patch versions across branches, since features land in the E810 and E82X branches in different versions. Then, the check in ice_fw_supports_fec_dis_auto() can check the supported versions in each branch separately. ice_is_fw_min_ver() is only used in this function, so there's no behavior change needed elsewhere.

---
 drivers/net/ice/base/ice_common.c | 11 +++++++----
 drivers/net/ice/base/ice_type.h   |  7 +++++++
 2 files changed, 14 insertions(+), 4 deletions(-)
drivers/net/ice/base/ice_common.c +7 -4
index 62c68b6d73..d4b9d793ba 100644
@@ -5965,8 +5965,6 @@ static bool ice_is_fw_min_ver(struct ice_hw *hw, u8 branch, u8 maj, u8 min,
 			if (hw->fw_min_ver == min && hw->fw_patch >= patch)
 				return true;
 		}
-	} else if (hw->fw_branch > branch) {
-		return true;
 	}
 
 	return false;
@@ -6180,11 +6178,16 @@ bool ice_fw_supports_report_dflt_cfg(struct ice_hw *hw)
  */
 bool ice_fw_supports_fec_dis_auto(struct ice_hw *hw)
 {
-	return ice_is_fw_min_ver(hw, ICE_FW_FEC_DIS_AUTO_BRANCH,
+	return ice_is_fw_min_ver(hw, ICE_FW_VER_BRANCH_E810,
 				 ICE_FW_FEC_DIS_AUTO_MAJ,
 				 ICE_FW_FEC_DIS_AUTO_MIN,
-				 ICE_FW_FEC_DIS_AUTO_PATCH);
+				 ICE_FW_FEC_DIS_AUTO_PATCH) ||
+	       ice_is_fw_min_ver(hw, ICE_FW_VER_BRANCH_E82X,
+				 ICE_FW_FEC_DIS_AUTO_MAJ_E82X,
+				 ICE_FW_FEC_DIS_AUTO_MIN_E82X,
+				 ICE_FW_FEC_DIS_AUTO_PATCH_E82X);
 }
+
 /**
  * ice_is_fw_auto_drop_supported
  * @hw: pointer to the hardware structure
drivers/net/ice/base/ice_type.h +7 -0
index 79a6c1aa0f..879624fc6f 100644
@@ -1656,11 +1656,18 @@ struct ice_aq_get_set_rss_lut_params {
 
 #define ICE_FW_API_REPORT_DFLT_CFG_PATCH	3
 
+/* FW branch number for hardware families */
+#define ICE_FW_VER_BRANCH_E82X			0
+#define ICE_FW_VER_BRANCH_E810			1
+
 /* FW version for FEC disable in Auto FEC mode */
 #define ICE_FW_FEC_DIS_AUTO_BRANCH		1
 #define ICE_FW_FEC_DIS_AUTO_MAJ			7
 #define ICE_FW_FEC_DIS_AUTO_MIN			0
 #define ICE_FW_FEC_DIS_AUTO_PATCH		5
+#define ICE_FW_FEC_DIS_AUTO_MAJ_E82X		7
+#define ICE_FW_FEC_DIS_AUTO_MIN_E82X		1
+#define ICE_FW_FEC_DIS_AUTO_PATCH_E82X		2
 
 /* AQ API version for FW auto drop reports */
 #define ICE_FW_API_AUTO_DROP_MAJ		1
Signature · 1 line
2.43.0
#67 lore raw

PATCH v2 50/148 net/ice/base: move (read|write)_sma_ctrl functions to match upstream

In reply to Anatoly Burakov

From: Ian Stokes <[email protected]>

The upstream driver placed the ice_read_sma_ctrl_e810t and ice_write_sma_ctrl_e810t functions before the ice_read_pca9575_reg_e810t function.

Align with upstream and order the functions so that the sma functions come before the pca9575 functions, slightly reducing the difference between upstream and out-of-tree.

---
 drivers/net/ice/base/ice_ptp_hw.c | 135 +++++++++++++++---------------
 drivers/net/ice/base/ice_ptp_hw.h |   7 +-
 2 files changed, 71 insertions(+), 71 deletions(-)
drivers/net/ice/base/ice_ptp_hw.c +67 -68
index db28aa308c..bd759a0e83 100644
@@ -5153,70 +5153,6 @@ bool ice_is_gps_present_e810t(struct ice_hw *hw)
 	return true;
 }
 
-/**
- * ice_read_pca9575_reg_e810t
- * @hw: pointer to the hw struct
- * @offset: GPIO controller register offset
- * @data: pointer to data to be read from the GPIO controller
- *
- * Read the register from the GPIO controller
- */
-int
-ice_read_pca9575_reg_e810t(struct ice_hw *hw, u8 offset, u8 *data)
-{
-	struct ice_aqc_link_topo_addr link_topo;
-	int status;
-	__le16 addr;
-	u16 handle;
-
-	memset(&link_topo, 0, sizeof(link_topo));
-
-	status = ice_get_pca9575_handle(hw, &handle);
-	if (status)
-		return status;
-
-	link_topo.handle = CPU_TO_LE16(handle);
-	link_topo.topo_params.node_type_ctx =
-		(ICE_AQC_LINK_TOPO_NODE_CTX_PROVIDED <<
-		 ICE_AQC_LINK_TOPO_NODE_CTX_S);
-
-	addr = CPU_TO_LE16((u16)offset);
-
-	return ice_aq_read_i2c(hw, link_topo, 0, addr, 1, data, NULL);
-}
-
-/**
- * ice_write_pca9575_reg_e810t
- * @hw: pointer to the hw struct
- * @offset: GPIO controller register offset
- * @data: data to be written to the GPIO controller
- *
- * Write the data to the GPIO controller register
- */
-int
-ice_write_pca9575_reg_e810t(struct ice_hw *hw, u8 offset, u8 data)
-{
-	struct ice_aqc_link_topo_addr link_topo;
-	__le16 addr;
-	int status;
-	u16 handle;
-
-	memset(&link_topo, 0, sizeof(link_topo));
-
-	status = ice_get_pca9575_handle(hw, &handle);
-	if (status)
-		return status;
-
-	link_topo.handle = CPU_TO_LE16(handle);
-	link_topo.topo_params.node_type_ctx =
-		(ICE_AQC_LINK_TOPO_NODE_CTX_PROVIDED <<
-		 ICE_AQC_LINK_TOPO_NODE_CTX_S);
-
-	addr = CPU_TO_LE16((u16)offset);
-
-	return ice_aq_write_i2c(hw, link_topo, 0, addr, 1, &data, NULL);
-}
-
 /**
  * ice_read_sma_ctrl_e810t
  * @hw: pointer to the hw struct
@@ -5236,10 +5172,10 @@ int ice_read_sma_ctrl_e810t(struct ice_hw *hw, u8 *data)
 
 	*data = 0;
 
-	for (i = ICE_E810T_SMA_MIN_BIT; i <= ICE_E810T_SMA_MAX_BIT; i++) {
+	for (i = ICE_SMA_MIN_BIT_E810T; i <= ICE_SMA_MAX_BIT_E810T; i++) {
 		bool pin;
 
-		status = ice_aq_get_gpio(hw, handle, i + ICE_E810T_P1_OFFSET,
+		status = ice_aq_get_gpio(hw, handle, i + ICE_PCA9575_P1_OFFSET,
 					 &pin, NULL);
 		if (status)
 			break;
@@ -5266,11 +5202,11 @@ int ice_write_sma_ctrl_e810t(struct ice_hw *hw, u8 data)
 	if (status)
 		return status;
 
-	for (i = ICE_E810T_SMA_MIN_BIT; i <= ICE_E810T_SMA_MAX_BIT; i++) {
+	for (i = ICE_SMA_MIN_BIT_E810T; i <= ICE_SMA_MAX_BIT_E810T; i++) {
 		bool pin;
 
 		pin = !(data & (1 << i));
-		status = ice_aq_set_gpio(hw, handle, i + ICE_E810T_P1_OFFSET,
+		status = ice_aq_set_gpio(hw, handle, i + ICE_PCA9575_P1_OFFSET,
 					 pin, NULL);
 		if (status)
 			break;
@@ -5279,6 +5215,69 @@ int ice_write_sma_ctrl_e810t(struct ice_hw *hw, u8 data)
 	return status;
 }
 
+/**
+ * ice_read_pca9575_reg_e810t
+ * @hw: pointer to the hw struct
+ * @offset: GPIO controller register offset
+ * @data: pointer to data to be read from the GPIO controller
+ *
+ * Read the register from the GPIO controller
+ */
+int ice_read_pca9575_reg_e810t(struct ice_hw *hw, u8 offset, u8 *data)
+{
+	struct ice_aqc_link_topo_addr link_topo;
+	__le16 addr;
+	u16 handle;
+	int err;
+
+	memset(&link_topo, 0, sizeof(link_topo));
+
+	err = ice_get_pca9575_handle(hw, &handle);
+	if (err)
+		return err;
+
+	link_topo.handle = CPU_TO_LE16(handle);
+	link_topo.topo_params.node_type_ctx =
+		(ICE_AQC_LINK_TOPO_NODE_CTX_PROVIDED <<
+		 ICE_AQC_LINK_TOPO_NODE_CTX_S);
+
+	addr = CPU_TO_LE16((u16)offset);
+
+	return ice_aq_read_i2c(hw, link_topo, 0, addr, 1, data, NULL);
+}
+
+/**
+ * ice_write_pca9575_reg_e810t
+ * @hw: pointer to the hw struct
+ * @offset: GPIO controller register offset
+ * @data: data to be written to the GPIO controller
+ *
+ * Write the data to the GPIO controller register
+ */
+int
+ice_write_pca9575_reg_e810t(struct ice_hw *hw, u8 offset, u8 data)
+{
+	struct ice_aqc_link_topo_addr link_topo;
+	__le16 addr;
+	int status;
+	u16 handle;
+
+	memset(&link_topo, 0, sizeof(link_topo));
+
+	status = ice_get_pca9575_handle(hw, &handle);
+	if (status)
+		return status;
+
+	link_topo.handle = CPU_TO_LE16(handle);
+	link_topo.topo_params.node_type_ctx =
+		(ICE_AQC_LINK_TOPO_NODE_CTX_PROVIDED <<
+		 ICE_AQC_LINK_TOPO_NODE_CTX_S);
+
+	addr = CPU_TO_LE16((u16)offset);
+
+	return ice_aq_write_i2c(hw, link_topo, 0, addr, 1, &data, NULL);
+}
+
 /**
  * ice_is_pca9575_present
  * @hw: pointer to the hw struct
drivers/net/ice/base/ice_ptp_hw.h +4 -3
index 04556db7e9..da5acf7556 100644
@@ -530,6 +530,10 @@ int ice_ptp_init_phy_cfg(struct ice_hw *hw);
 #define E830_HIGH_TX_MEMORY_BANK(slot, port) \
 				(E830_PRTTSYN_TXTIME_H(slot) + 0x8 * (port))
 
+#define ICE_SMA_MIN_BIT_E810T	3
+#define ICE_SMA_MAX_BIT_E810T	7
+#define ICE_PCA9575_P1_OFFSET	8
+
 /* E810T PCA9575 IO controller registers */
 #define ICE_PCA9575_P0_IN	0x0
 #define ICE_PCA9575_P1_IN	0x1
@@ -546,9 +550,6 @@ int ice_ptp_init_phy_cfg(struct ice_hw *hw);
 #define ICE_E810T_P1_SMA2_DIR_EN	BIT(6)
 #define ICE_E810T_P1_SMA2_TX_EN		BIT(7)
 
-#define ICE_E810T_SMA_MIN_BIT	3
-#define ICE_E810T_SMA_MAX_BIT	7
-#define ICE_E810T_P1_OFFSET	8
 /* 56G PHY quad register base addresses */
 #define ICE_PHY0_BASE			0x092000
 #define ICE_PHY1_BASE			0x126000
Signature · 1 line
2.43.0
#68 lore raw

PATCH v2 51/148 net/ice/base: fix incorrect size when allocating children arrays

In reply to Anatoly Burakov

From: Ian Stokes <[email protected]>

The ice_sched_add_root_node() and ice_sched_add_node() functions have comments to suppress Coverity warnings about a suspicious sizeof used when allocating the children array of an struct ice_sched_node.

The size is calculated using the size of the scheduler node, which overallocates the array by a significant amount.

Fix the code to correctly calculate the size by using *root->children and *node->children respectively.

This saves some memory and allows us to drop the Coverity suppression comments.

---
 drivers/net/ice/base/ice_sched.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
drivers/net/ice/base/ice_sched.c +3 -4
index c9d70fb043..74d57329da 100644
@@ -28,9 +28,8 @@ ice_sched_add_root_node(struct ice_port_info *pi,
 	if (!root)
 		return ICE_ERR_NO_MEMORY;
 
-	/* coverity[suspicious_sizeof] */
 	root->children = (struct ice_sched_node **)
-		ice_calloc(hw, hw->max_children[0], sizeof(*root));
+		ice_calloc(hw, hw->max_children[0], sizeof(*root->children));
 	if (!root->children) {
 		ice_free(hw, root);
 		return ICE_ERR_NO_MEMORY;
@@ -186,9 +185,9 @@ ice_sched_add_node(struct ice_port_info *pi, u8 layer,
 	if (!node)
 		return ICE_ERR_NO_MEMORY;
 	if (hw->max_children[layer]) {
-		/* coverity[suspicious_sizeof] */
 		node->children = (struct ice_sched_node **)
-			ice_calloc(hw, hw->max_children[layer], sizeof(*node));
+			ice_calloc(hw, hw->max_children[layer],
+				   sizeof(*node->children));
 		if (!node->children) {
 			ice_free(hw, node);
 			return ICE_ERR_NO_MEMORY;
Signature · 1 line
2.43.0
#69 lore raw

PATCH v2 52/148 net/ice/base: fix GCS descriptor field offsets

In reply to Anatoly Burakov

From: Ian Stokes <[email protected]>

Update the offsets, and remove the ICE_TX_GCS_DESC_ENA define since a non-0 value used for the ICE_TX_GCS_DESC_TYPE field will enable GCS offload; there is no dedicated bit to enable it anymore.

---
 drivers/net/ice/base/ice_lan_tx_rx.h | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
drivers/net/ice/base/ice_lan_tx_rx.h +3 -4
index d816df0ff6..39673e36f7 100644
@@ -1074,10 +1074,9 @@ struct ice_tx_ctx_desc {
 	__le64 qw1;
 };
 
-#define ICE_TX_GSC_DESC_START	0  /* 7 BITS */
-#define ICE_TX_GSC_DESC_OFFSET	7  /* 4 BITS */
-#define ICE_TX_GSC_DESC_TYPE	11 /* 2 BITS */
-#define ICE_TX_GSC_DESC_ENA	13 /* 1 BIT */
+#define ICE_TX_GCS_DESC_START	0  /* 8 BITS */
+#define ICE_TX_GCS_DESC_OFFSET	8  /* 4 BITS */
+#define ICE_TX_GCS_DESC_TYPE	12 /* 3 BITS */
 
 #define ICE_TXD_CTX_QW1_DTYPE_S	0
 #define ICE_TXD_CTX_QW1_DTYPE_M	(0xFUL << ICE_TXD_CTX_QW1_DTYPE_S)
Signature · 1 line
2.43.0
#70 lore raw

PATCH v2 53/148 net/ice/base: add VSI type for subfunctions

In reply to Anatoly Burakov

From: Ian Stokes <[email protected]>

Add a separate VSI type for devlink subfunctions due to specific handling in the driver.

---
 drivers/net/ice/base/ice_type.h | 1 +
 1 file changed, 1 insertion(+)
drivers/net/ice/base/ice_type.h +1 -0
index 879624fc6f..cfdae5ffb7 100644
@@ -317,6 +317,7 @@ enum ice_vsi_type {
 	ICE_VSI_PF = 0,
 	ICE_VSI_CTRL = 3,	/* equates to ICE_VSI_PF with 1 queue pair */
 	ICE_VSI_LB = 6,
+	ICE_VSI_ADI = 8,
 };
 
 struct ice_link_status {
Signature · 1 line
2.43.0
#71 lore raw

PATCH v2 54/148 net/ice/base: correct the return type of ice_bitmap_hweight

In reply to Anatoly Burakov

From: Ian Stokes <[email protected]>

"count" is the returned value, and in this function, value of "count" and "bit" are the same, so there is no reason why these values should be declared as different types, and for returned value data type to be different.

---
 drivers/net/ice/base/ice_bitops.h |  4 ++--
 drivers/net/ice/base/ice_switch.c | 10 ++++++----
 2 files changed, 8 insertions(+), 6 deletions(-)
drivers/net/ice/base/ice_bitops.h +2 -2
index 3b71c1b7f5..5c17bcb674 100644
@@ -418,10 +418,10 @@ ice_bitmap_set(ice_bitmap_t *dst, u16 pos, u16 num_bits)
  * Note that this function assumes it is operating on a bitmap declared using
  * ice_declare_bitmap.
  */
-static inline int
+static inline u16
 ice_bitmap_hweight(ice_bitmap_t *bm, u16 size)
 {
-	int count = 0;
+	u16 count = 0;
 	u16 bit = 0;
 
 	while (size > (bit = ice_find_next_bit(bm, size, bit))) {
drivers/net/ice/base/ice_switch.c +6 -4
index fc9a690b6f..e49b86e009 100644
@@ -3919,7 +3919,7 @@ static void ice_subscribable_recp_shared(struct ice_hw *hw, u16 rid)
 {
 	ice_declare_bitmap(sub_bitmap, ICE_MAX_NUM_RECIPES);
 	struct ice_sw_recipe *recps;
-	u8 i, cnt;
+	u16 i, cnt;
 
 	recps = hw->switch_info->recp_list;
 	ice_cp_bitmap(sub_bitmap, recps[rid].r_bitmap, ICE_MAX_NUM_RECIPES);
@@ -3944,8 +3944,9 @@ static enum ice_status ice_release_recipe_res(struct ice_hw *hw,
 {
 	ice_declare_bitmap(r_bitmap, ICE_MAX_NUM_RECIPES);
 	struct ice_switch_info *sw = hw->switch_info;
-	u8 num_recp, rid, num_prof, prof, i, j;
 	enum ice_status status = ICE_SUCCESS;
+	u16 num_recp, num_prof;
+	u8 rid, prof, i, j;
 
 	num_recp = ice_bitmap_hweight(recp->r_bitmap, ICE_MAX_NUM_RECIPES);
 	for (i = 0; i < num_recp; i++) {
@@ -7657,7 +7658,7 @@ ice_find_free_recp_res_idx(struct ice_hw *hw, const ice_bitmap_t *profiles,
 	ice_xor_bitmap(free_idx, used_idx, possible_idx, ICE_MAX_FV_WORDS);
 
 	/* return number of free indexes */
-	return (u16)ice_bitmap_hweight(free_idx, ICE_MAX_FV_WORDS);
+	return ice_bitmap_hweight(free_idx, ICE_MAX_FV_WORDS);
 }
 
 static void ice_set_recipe_index(unsigned long idx, u8 *bitmap)
@@ -8377,9 +8378,10 @@ ice_add_adv_recipe(struct ice_hw *hw, struct ice_adv_lkup_elem *lkups,
 	struct ice_recp_grp_entry *r_tmp;
 	struct ice_sw_fv_list_entry *tmp;
 	struct ice_sw_recipe *rm;
-	u8 i, cnt, rid_tmp;
+	u8 i, rid_tmp;
 	bool is_add = true;
 	int status = ICE_SUCCESS;
+	u16 cnt;
 
 	if (!ice_is_prof_rule(rinfo->tun_type) && !lkups_cnt)
 		return ICE_ERR_PARAM;
Signature · 1 line
2.43.0
#72 lore raw

PATCH v2 55/148 net/ice/base: fix ice_ptp_one_port_cmd to avoid stale PHY commands

In reply to Anatoly Burakov

From: Ian Stokes <[email protected]>

Code using ice_ptp_one_port_cmd() (or the device specific variants for E822 and ETH56G) has a subtle bug where-in the executing of ice_ptp_exec_tmr_cmd() will cause all other ports to execute their last executed command.

Most flows operate on all timers at once, but some flows such as handling link state change only operate on one port at a time. This can lead to issues if the userspace performs clock operations at just the right time.

In addition to this bug, recent support for new hardware families has complicated the structure and organization of the various functions involved in programming PHY ports.

For example:

* ETH56G and E822 both re-implement the same looping structure for operating on all ports
* E810 and E830 use "ice_ptp_port_cmd" which takes a register value to write and only operates on these two families despite having a generic name.

Refactor ice_ptp_one_port_cmd() to both fix the issue of stale PHY port commands, and reduce the organizational complexity.

Rename the existing device implementations from ice_ptp_one_port_cmd_<device> to ice_ptp_write_port_cmd_<device>. This function just performs the task of writing one command to one port. Do not export this outside of ice_ptp_hw.c, instead ensure all callers use the refactored ice_ptp_one_port_cmd() which properly initializes all ports.

Fix ice_ptp_one_port_cmd() to correctly loop over all ports. For the configured port, call ice_ptp_write_port_cmd() with the configured command. For all other ports, call ice_ptp_write_port_cmd() with ICE_PTP_NOP.

Stop duplicating the port iteration logic in each of the ice_ptp_port_cmd_<dev>() implementations, instead moving this into the generic ice_ptp_port_cmd() implementation.

Since every flow now properly initializes both the main timer register and all port registers, ice_ptp_clean_cmd() is no longer needed, so remove it.

This fixes the issue of using stale PHY port commands, and aligns better with the flow for how ice_ptp_hw.c is implemented.

---
 drivers/net/ice/base/ice_ptp_hw.c | 649 +++++++++++++++---------------
 drivers/net/ice/base/ice_ptp_hw.h |  25 +-
 2 files changed, 356 insertions(+), 318 deletions(-)
drivers/net/ice/base/ice_ptp_hw.c +334 -315
index bd759a0e83..ad3a7599d7 100644
@@ -772,6 +772,104 @@ static enum ice_status ice_init_cgu_e82x(struct ice_hw *hw)
 	return 0;
 }
 
+/**
+ * @ice_ptp_tmr_cmd_to_src_reg - Convert to source timer command value
+ * @hw: pointer to HW struct
+ * @cmd: Timer command
+ *
+ * Returns: the source timer command register value for the given PTP timer
+ * command.
+ */
+static u32 ice_ptp_tmr_cmd_to_src_reg(struct ice_hw *hw,
+				      enum ice_ptp_tmr_cmd cmd)
+{
+	u32 cmd_val;
+	u8 tmr_idx;
+
+	switch (cmd) {
+	case ICE_PTP_INIT_TIME:
+		cmd_val = GLTSYN_CMD_INIT_TIME;
+		break;
+	case ICE_PTP_INIT_INCVAL:
+		cmd_val = GLTSYN_CMD_INIT_INCVAL;
+		break;
+	case ICE_PTP_ADJ_TIME:
+		cmd_val = GLTSYN_CMD_ADJ_TIME;
+		break;
+	case ICE_PTP_ADJ_TIME_AT_TIME:
+		cmd_val = GLTSYN_CMD_ADJ_INIT_TIME;
+		break;
+	case ICE_PTP_NOP:
+	case ICE_PTP_READ_TIME:
+		cmd_val = GLTSYN_CMD_READ_TIME;
+		break;
+	default:
+		ice_warn(hw, "Ignoring unrecognized timer command %u\n", cmd);
+		cmd_val = 0;
+	}
+
+	tmr_idx = ice_get_ptp_src_clock_index(hw) << SEL_CPK_SRC;
+
+	return tmr_idx | cmd_val;
+}
+
+/**
+ * ice_ptp_tmr_cmd_to_port_reg- Convert to port timer command value
+ * @hw: pointer to HW struct
+ * @cmd: Timer command
+ *
+ * Note that some hardware families use a different command register value for
+ * the PHY ports, while other hardware families use the same register values
+ * as the source timer.
+ *
+ * Returns: the PHY port timer command register value for the given PTP timer
+ * command.
+ */
+static u32 ice_ptp_tmr_cmd_to_port_reg(struct ice_hw *hw,
+				       enum ice_ptp_tmr_cmd cmd)
+{
+	u32 cmd_val, tmr_idx;
+
+	/* Certain hardware families share the same register values for the
+	 * port register and source timer register.
+	 */
+	switch (hw->phy_cfg) {
+	case ICE_PHY_E810:
+	case ICE_PHY_E830:
+		return ice_ptp_tmr_cmd_to_src_reg(hw, cmd) & TS_CMD_MASK_E810;
+	default:
+		break;
+	}
+
+	switch (cmd) {
+	case ICE_PTP_INIT_TIME:
+		cmd_val = PHY_CMD_INIT_TIME;
+		break;
+	case ICE_PTP_INIT_INCVAL:
+		cmd_val = PHY_CMD_INIT_INCVAL;
+		break;
+	case ICE_PTP_ADJ_TIME:
+		cmd_val = PHY_CMD_ADJ_TIME;
+		break;
+	case ICE_PTP_ADJ_TIME_AT_TIME:
+		cmd_val = PHY_CMD_ADJ_TIME_AT_TIME;
+		break;
+	case ICE_PTP_READ_TIME:
+		cmd_val = PHY_CMD_READ_TIME;
+		break;
+	case ICE_PTP_NOP:
+		cmd_val = 0;
+		break;
+	default:
+		ice_warn(hw, "Ignoring unrecognized timer command %u\n", cmd);
+		cmd_val = 0;
+	}
+
+	tmr_idx = ice_get_ptp_src_clock_index(hw) << SEL_PHY_SRC;
+
+	return tmr_idx | cmd_val;
+}
+
 /**
  * ice_ptp_src_cmd - Prepare source timer for a timer command
  * @hw: pointer to HW structure
@@ -781,34 +879,7 @@ static enum ice_status ice_init_cgu_e82x(struct ice_hw *hw)
  */
 void ice_ptp_src_cmd(struct ice_hw *hw, enum ice_ptp_tmr_cmd cmd)
 {
-	u32 cmd_val;
-	u8 tmr_idx;
-
-	tmr_idx = ice_get_ptp_src_clock_index(hw);
-	cmd_val = tmr_idx << SEL_CPK_SRC;
-
-	switch (cmd) {
-	case ICE_PTP_INIT_TIME:
-		cmd_val |= GLTSYN_CMD_INIT_TIME;
-		break;
-	case ICE_PTP_INIT_INCVAL:
-		cmd_val |= GLTSYN_CMD_INIT_INCVAL;
-		break;
-	case ICE_PTP_ADJ_TIME:
-		cmd_val |= GLTSYN_CMD_ADJ_TIME;
-		break;
-	case ICE_PTP_ADJ_TIME_AT_TIME:
-		cmd_val |= GLTSYN_CMD_ADJ_INIT_TIME;
-		break;
-	case ICE_PTP_READ_TIME:
-		cmd_val |= GLTSYN_CMD_READ_TIME;
-		break;
-	case ICE_PTP_NOP:
-		break;
-	default:
-		ice_warn(hw, "Unknown timer command %u\n", cmd);
-		return;
-	}
+	u32 cmd_val = ice_ptp_tmr_cmd_to_src_reg(hw, cmd);
 
 	wr32(hw, GLTSYN_CMD, cmd_val);
 }
@@ -827,18 +898,6 @@ static void ice_ptp_exec_tmr_cmd(struct ice_hw *hw)
 	ice_flush(hw);
 }
 
-/**
- * ice_ptp_clean_cmd - Clean the timer command register
- * @hw: pointer to HW struct
- *
- * Zero out the GLTSYN_CMD to avoid any residual command execution.
- */
-static void ice_ptp_clean_cmd(struct ice_hw *hw)
-{
-	wr32(hw, GLTSYN_CMD, 0);
-	ice_flush(hw);
-}
-
 /* 56G PHY access functions */
 static const u32 eth56g_port_base[ICE_NUM_PHY_PORTS] = {
 	ICE_PHY0_BASE,
@@ -1796,7 +1855,7 @@ ice_ptp_one_port_cmd_eth56g(struct ice_hw *hw, u8 port,
  * Prepare all ports connected to this device for an upcoming timer sync
  * command.
  */
-static int
+int
 ice_ptp_port_cmd_eth56g(struct ice_hw *hw, enum ice_ptp_tmr_cmd cmd,
 			bool lock_sbq)
 {
@@ -1949,7 +2008,6 @@ ice_read_phy_and_phc_time_eth56g(struct ice_hw *hw, u8 port, u64 *phy_time,
 
 	/* Issue the sync to start the ICE_PTP_READ_TIME capture */
 	ice_ptp_exec_tmr_cmd(hw);
-	ice_ptp_clean_cmd(hw);
 
 	/* Read the captured PHC time from the shadow time registers */
 	zo = rd32(hw, GLTSYN_SHTIME_0(tmr_idx));
@@ -2024,7 +2082,6 @@ static int ice_sync_phy_timer_eth56g(struct ice_hw *hw, u8 port)
 
 	/* Issue the sync to activate the time adjustment */
 	ice_ptp_exec_tmr_cmd(hw);
-	ice_ptp_clean_cmd(hw);
 
 	/* Re-capture the timer values to flush the command registers and
 	 * verify that the time was properly adjusted.
@@ -2185,8 +2242,7 @@ ice_ptp_read_tx_hwtstamp_status_eth56g(struct ice_hw *hw, u32 *ts_status)
  * mask. Returns the mask of ports where TX timestamps are available
  * @hw: pointer to the HW struct
  */
-int
-ice_ptp_init_phy_cfg(struct ice_hw *hw)
+int ice_ptp_init_phy_cfg(struct ice_hw *hw)
 {
 	int status;
 	u32 phy_rev;
@@ -2211,8 +2267,7 @@ ice_ptp_init_phy_cfg(struct ice_hw *hw)
 	return 0;
 }
 
-/* ----------------------------------------------------------------------------
- * E822 family functions
+/* E822 family functions
  *
  * The following functions operate on the E822 family of devices.
  */
@@ -3154,7 +3209,7 @@ ice_ptp_read_port_capture_e822(struct ice_hw *hw, u8 port, u64 *tx_ts,
 }
 
 /**
- * ice_ptp_one_port_cmd_e822 - Prepare a single PHY port for a timer command
+ * ice_ptp_write_port_cmd_e822 - Prepare a single PHY port for a timer command
  * @hw: pointer to HW struct
  * @port: Port to which cmd has to be sent
  * @cmd: Command to be sent to the port
@@ -3166,50 +3221,13 @@ ice_ptp_read_port_capture_e822(struct ice_hw *hw, u8 port, u64 *tx_ts,
  * always handles all external PHYs internally.
  */
 int
-ice_ptp_one_port_cmd_e822(struct ice_hw *hw, u8 port, enum ice_ptp_tmr_cmd cmd,
-			  bool lock_sbq)
+ice_ptp_write_port_cmd_e822(struct ice_hw *hw, u8 port,
+			    enum ice_ptp_tmr_cmd cmd, bool lock_sbq)
 {
+	u32 val = ice_ptp_tmr_cmd_to_port_reg(hw, cmd);
 	int status;
-	u32 cmd_val, val;
-	u8 tmr_idx;
-
-	tmr_idx = ice_get_ptp_src_clock_index(hw);
-	cmd_val = tmr_idx << SEL_PHY_SRC;
-	switch (cmd) {
-	case ICE_PTP_INIT_TIME:
-		cmd_val |= PHY_CMD_INIT_TIME;
-		break;
-	case ICE_PTP_INIT_INCVAL:
-		cmd_val |= PHY_CMD_INIT_INCVAL;
-		break;
-	case ICE_PTP_ADJ_TIME:
-		cmd_val |= PHY_CMD_ADJ_TIME;
-		break;
-	case ICE_PTP_ADJ_TIME_AT_TIME:
-		cmd_val |= PHY_CMD_ADJ_TIME_AT_TIME;
-		break;
-	case ICE_PTP_READ_TIME:
-		cmd_val |= PHY_CMD_READ_TIME;
-		break;
-	default:
-		ice_warn(hw, "Unknown timer command %u\n", cmd);
-		return ICE_ERR_PARAM;
-	}
 
 	/* Tx case */
-	/* Read, modify, write */
-	status = ice_read_phy_reg_e822_lp(hw, port, P_REG_TX_TMR_CMD, &val,
-					  lock_sbq);
-	if (status) {
-		ice_debug(hw, ICE_DBG_PTP, "Failed to read TX_TMR_CMD, status %d\n",
-			  status);
-		return status;
-	}
-
-	/* Modify necessary bits only and perform write */
-	val &= ~TS_CMD_MASK;
-	val |= cmd_val;
-
 	status = ice_write_phy_reg_e822_lp(hw, port, P_REG_TX_TMR_CMD, val,
 					   lock_sbq);
 	if (status) {
@@ -3219,19 +3237,6 @@ ice_ptp_one_port_cmd_e822(struct ice_hw *hw, u8 port, enum ice_ptp_tmr_cmd cmd,
 	}
 
 	/* Rx case */
-	/* Read, modify, write */
-	status = ice_read_phy_reg_e822_lp(hw, port, P_REG_RX_TMR_CMD, &val,
-					  lock_sbq);
-	if (status) {
-		ice_debug(hw, ICE_DBG_PTP, "Failed to read RX_TMR_CMD, status %d\n",
-			  status);
-		return status;
-	}
-
-	/* Modify necessary bits only and perform write */
-	val &= ~TS_CMD_MASK;
-	val |= cmd_val;
-
 	status = ice_write_phy_reg_e822_lp(hw, port, P_REG_RX_TMR_CMD, val,
 					   lock_sbq);
 	if (status) {
@@ -3243,32 +3248,6 @@ ice_ptp_one_port_cmd_e822(struct ice_hw *hw, u8 port, enum ice_ptp_tmr_cmd cmd,
 	return 0;
 }
 
-/**
- * ice_ptp_port_cmd_e822 - Prepare all ports for a timer command
- * @hw: pointer to the HW struct
- * @cmd: timer command to prepare
- * @lock_sbq: true if the sideband queue lock must  be acquired
- *
- * Prepare all ports connected to this device for an upcoming timer sync
- * command.
- */
-static int
-ice_ptp_port_cmd_e822(struct ice_hw *hw, enum ice_ptp_tmr_cmd cmd,
-		      bool lock_sbq)
-{
-	u8 port;
-
-	for (port = 0; port < ICE_NUM_EXTERNAL_PORTS; port++) {
-		int status;
-
-		status = ice_ptp_one_port_cmd_e822(hw, port, cmd, lock_sbq);
-		if (status)
-			return status;
-	}
-
-	return 0;
-}
-
 /* E822 Vernier calibration functions
  *
  * The following functions are used as part of the vernier calibration of
@@ -4138,13 +4117,12 @@ ice_read_phy_and_phc_time_e822(struct ice_hw *hw, u8 port, u64 *phy_time,
 	ice_ptp_src_cmd(hw, ICE_PTP_READ_TIME);
 
 	/* Prepare the PHY timer for a ICE_PTP_READ_TIME capture command */
-	status = ice_ptp_one_port_cmd_e822(hw, port, ICE_PTP_READ_TIME, true);
+	status = ice_ptp_one_port_cmd(hw, port, ICE_PTP_READ_TIME, true);
 	if (status)
 		return status;
 
 	/* Issue the sync to start the ICE_PTP_READ_TIME capture */
 	ice_ptp_exec_tmr_cmd(hw);
-	ice_ptp_clean_cmd(hw);
 
 	/* Read the captured PHC time from the shadow time registers */
 	zo = rd32(hw, GLTSYN_SHTIME_0(tmr_idx));
@@ -4210,7 +4188,7 @@ static int ice_sync_phy_timer_e822(struct ice_hw *hw, u8 port)
 	if (status)
 		goto err_unlock;
 
-	status = ice_ptp_one_port_cmd_e822(hw, port, ICE_PTP_ADJ_TIME, true);
+	status = ice_ptp_one_port_cmd(hw, port, ICE_PTP_ADJ_TIME, true);
 	if (status)
 		goto err_unlock;
 
@@ -4219,7 +4197,6 @@ static int ice_sync_phy_timer_e822(struct ice_hw *hw, u8 port)
 
 	/* Issue the sync to activate the time adjustment */
 	ice_ptp_exec_tmr_cmd(hw);
-	ice_ptp_clean_cmd(hw);
 
 	/* Re-capture the timer values to flush the command registers and
 	 * verify that the time was properly adjusted.
@@ -4315,7 +4292,6 @@ ice_start_phy_timer_e822(struct ice_hw *hw, u8 port, bool bypass)
 	u64 incval;
 	u8 tmr_idx;
 
-	ice_ptp_clean_cmd(hw);
 	tmr_idx = ice_get_ptp_src_clock_index(hw);
 
 	status = ice_stop_phy_timer_e822(hw, port, false);
@@ -4340,7 +4316,7 @@ ice_start_phy_timer_e822(struct ice_hw *hw, u8 port, bool bypass)
 	if (status)
 		return status;
 
-	status = ice_ptp_one_port_cmd_e822(hw, port, ICE_PTP_INIT_INCVAL, true);
+	status = ice_ptp_one_port_cmd(hw, port, ICE_PTP_INIT_INCVAL, true);
 	if (status)
 		return status;
 
@@ -4368,7 +4344,7 @@ ice_start_phy_timer_e822(struct ice_hw *hw, u8 port, bool bypass)
 	if (status)
 		return status;
 
-	status = ice_ptp_one_port_cmd_e822(hw, port, ICE_PTP_INIT_INCVAL, true);
+	status = ice_ptp_one_port_cmd(hw, port, ICE_PTP_INIT_INCVAL, true);
 	if (status)
 		return status;
 
@@ -4690,38 +4666,6 @@ ice_read_phy_tstamp_e810(struct ice_hw *hw, u8 lport, u8 idx, u64 *tstamp)
 	return 0;
 }
 
-/**
- * ice_read_phy_tstamp_e830 - Read a PHY timestamp out of the external PHY
- * @hw: pointer to the HW struct
- * @lport: the lport to read from
- * @idx: the timestamp index to read
- * @tstamp: on return, the 40bit timestamp value
- *
- * Read a 40bit timestamp value out of the timestamp block of the external PHY
- * on the E830 device.
- */
-static enum ice_status
-ice_read_phy_tstamp_e830(struct ice_hw *hw, u8 lport, u8 idx, u64 *tstamp)
-{
-	u32 hi_addr = E830_HIGH_TX_MEMORY_BANK(idx, lport);
-	u32 lo_addr = E830_LOW_TX_MEMORY_BANK(idx, lport);
-	u32 lo_val, hi_val, lo;
-	u8 hi;
-
-	lo_val = rd32(hw, lo_addr);
-	hi_val = rd32(hw, hi_addr);
-
-	lo = lo_val;
-	hi = (u8)hi_val;
-
-	/* For E830 devices, the timestamp is reported with the lower 32 bits
-	* in the low register, and the upper 8 bits in the high register.
-	*/
-	*tstamp = ((u64)hi) << TS_HIGH_S | ((u64)lo & TS_LOW_M);
-
-	return ICE_SUCCESS;
-}
-
 /**
  * ice_clear_phy_tstamp_e810 - Clear a timestamp from the external PHY
  * @hw: pointer to the HW struct
@@ -4912,31 +4856,6 @@ ice_ptp_prep_phy_incval_e810(struct ice_hw *hw, u64 incval)
 	return 0;
 }
 
-/**
- * ice_ptp_write_direct_incval_e830 - Prep PHY port increment value change
- * @hw: pointer to HW struct
- * @incval: The new 40bit increment value to prepare
- *
- * Prepare the PHY port for a new increment value by programming the PHC
- * GLTSYN_INCVAL_L and GLTSYN_INCVAL_H registers. The actual change is
- * completed by FW automatically.
- */
-static enum ice_status
-ice_ptp_write_direct_incval_e830(struct ice_hw *hw, u64 incval)
-{
-	u32 high, low;
-	u8 tmr_idx;
-
-	tmr_idx = hw->func_caps.ts_func_info.tmr_index_owned;
-	low = ICE_LO_DWORD(incval);
-	high = ICE_HI_DWORD(incval);
-
-	wr32(hw, GLTSYN_INCVAL_L(tmr_idx), low);
-	wr32(hw, GLTSYN_INCVAL_H(tmr_idx), high);
-
-	return ICE_SUCCESS;
-}
-
 /**
  * ice_ptp_prep_phy_adj_target_e810 - Prepare PHY port with adjust target
  * @hw: Board private structure
@@ -4976,68 +4895,6 @@ ice_ptp_prep_phy_adj_target_e810(struct ice_hw *hw, u32 target_time)
 	return 0;
 }
 
-/**
- * ice_ptp_port_cmd - Prepare all external PHYs for a timer command
- * @hw: pointer to HW struct
- * @cmd: Command to be sent to the port
- * @lock_sbq: true if the sideband queue lock must be acquired
- * @eth_gltsyn_cmd_addr: address for ETH_GLTSYN_CMD register
- *
- * Prepare the external PHYs connected to this device for a timer sync
- * command.
- */
-static int
-ice_ptp_port_cmd(struct ice_hw *hw, enum ice_ptp_tmr_cmd cmd,
-		 bool lock_sbq, u32 eth_gltsyn_cmd_addr)
-{
-	int status;
-	u32 cmd_val, val;
-
-	switch (cmd) {
-	case ICE_PTP_INIT_TIME:
-		cmd_val = GLTSYN_CMD_INIT_TIME;
-		break;
-	case ICE_PTP_INIT_INCVAL:
-		cmd_val = GLTSYN_CMD_INIT_INCVAL;
-		break;
-	case ICE_PTP_ADJ_TIME:
-		cmd_val = GLTSYN_CMD_ADJ_TIME;
-		break;
-	case ICE_PTP_ADJ_TIME_AT_TIME:
-		cmd_val = GLTSYN_CMD_ADJ_INIT_TIME;
-		break;
-	case ICE_PTP_READ_TIME:
-		cmd_val = GLTSYN_CMD_READ_TIME;
-		break;
-	default:
-		ice_warn(hw, "Unknown timer command %u\n", cmd);
-		return ICE_ERR_PARAM;
-	}
-
-	/* Read, modify, write */
-	status = ice_read_phy_reg_e810_lp(hw, eth_gltsyn_cmd_addr, &val,
-					  lock_sbq);
-	if (status) {
-		ice_debug(hw, ICE_DBG_PTP, "Failed to read GLTSYN_CMD, status %d\n",
-			  status);
-		return status;
-	}
-
-	/* Modify necessary bits only and perform write */
-	val &= ~TS_CMD_MASK_E810;
-	val |= cmd_val;
-
-	status = ice_write_phy_reg_e810_lp(hw, eth_gltsyn_cmd_addr, val,
-					   lock_sbq);
-	if (status) {
-		ice_debug(hw, ICE_DBG_PTP, "Failed to write back GLTSYN_CMD, status %d\n",
-			  status);
-		return status;
-	}
-
-	return 0;
-}
-
 /**
  * ice_ptp_port_cmd_e810 - Prepare all external PHYs for a timer command
  * @hw: pointer to HW struct
@@ -5047,27 +4904,14 @@ ice_ptp_port_cmd(struct ice_hw *hw, enum ice_ptp_tmr_cmd cmd,
  * Prepare the external PHYs connected to this device for a timer sync
  * command.
  */
-static enum ice_status
+enum ice_status
 ice_ptp_port_cmd_e810(struct ice_hw *hw, enum ice_ptp_tmr_cmd cmd,
 		      bool lock_sbq)
 {
-	return ice_ptp_port_cmd(hw, cmd, lock_sbq, E810_ETH_GLTSYN_CMD);
-}
+	u32 val = ice_ptp_tmr_cmd_to_port_reg(hw, cmd);
 
-/**
- * ice_ptp_port_cmd_e830 - Prepare all external PHYs for a timer command
- * @hw: pointer to HW struct
- * @cmd: Command to be sent to the port
- * @lock_sbq: true if the sideband queue lock must be acquired
- *
- * Prepare the external PHYs connected to this device for a timer sync
- * command.
- */
-static enum ice_status
-ice_ptp_port_cmd_e830(struct ice_hw *hw, enum ice_ptp_tmr_cmd cmd,
-		      bool lock_sbq)
-{
-	return ice_ptp_port_cmd(hw, cmd, lock_sbq, E830_ETH_GLTSYN_CMD);
+	return ice_write_phy_reg_e810_lp(hw, E810_ETH_GLTSYN_CMD, val,
+					 lock_sbq);
 }
 
 /* E810T SMA functions
@@ -5296,6 +5140,129 @@ bool ice_is_pca9575_present(struct ice_hw *hw)
 	return false;
 }
 
+/**
+ * ice_ptp_write_direct_incval_e830 - Prep PHY port increment value change
+ * @hw: pointer to HW struct
+ * @incval: The new 40bit increment value to prepare
+ *
+ * Prepare the PHY port for a new increment value by programming the PHC
+ * GLTSYN_INCVAL_L and GLTSYN_INCVAL_H registers. The actual change is
+ * completed by FW automatically.
+ */
+static enum ice_status
+ice_ptp_write_direct_incval_e830(struct ice_hw *hw, u64 incval)
+{
+	u32 high, low;
+	u8 tmr_idx;
+
+	tmr_idx = hw->func_caps.ts_func_info.tmr_index_owned;
+	low = ICE_LO_DWORD(incval);
+	high = ICE_HI_DWORD(incval);
+
+	wr32(hw, GLTSYN_INCVAL_L(tmr_idx), low);
+	wr32(hw, GLTSYN_INCVAL_H(tmr_idx), high);
+
+	return ICE_SUCCESS;
+}
+
+/**
+ * ice_ptp_write_direct_phc_time_e830 - Prepare PHY port with initial time
+ * @hw: Board private structure
+ * @time: Time to initialize the PHY port clock to
+ *
+ * Program the PHY port ETH_GLTSYN_SHTIME registers in preparation setting the
+ * initial clock time. The time will not actually be programmed until the
+ * driver issues an ICE_PTP_INIT_TIME command.
+ *
+ * The time value is the upper 32 bits of the PHY timer, usually in units of
+ * nominal nanoseconds.
+ */
+static enum ice_status
+ice_ptp_write_direct_phc_time_e830(struct ice_hw *hw, u64 time)
+{
+	u8 tmr_idx;
+
+	tmr_idx = hw->func_caps.ts_func_info.tmr_index_owned;
+
+	wr32(hw, GLTSYN_TIME_0(tmr_idx), 0);
+	wr32(hw, GLTSYN_TIME_L(tmr_idx), ICE_LO_DWORD(time));
+	wr32(hw, GLTSYN_TIME_H(tmr_idx), ICE_HI_DWORD(time));
+
+	return ICE_SUCCESS;
+}
+
+/**
+ * ice_ptp_port_cmd_e830 - Prepare all external PHYs for a timer command
+ * @hw: pointer to HW struct
+ * @cmd: Command to be sent to the port
+ * @lock_sbq: true if the sideband queue lock must be acquired
+ *
+ * Prepare the external PHYs connected to this device for a timer sync
+ * command.
+ */
+enum ice_status
+ice_ptp_port_cmd_e830(struct ice_hw *hw, enum ice_ptp_tmr_cmd cmd,
+		      bool lock_sbq)
+{
+	u32 val = ice_ptp_tmr_cmd_to_port_reg(hw, cmd);
+
+	return ice_write_phy_reg_e810_lp(hw, E830_ETH_GLTSYN_CMD, val,
+					   lock_sbq);
+}
+
+/**
+ * ice_read_phy_tstamp_e830 - Read a PHY timestamp out of the external PHY
+ * @hw: pointer to the HW struct
+ * @lport: the lport to read from
+ * @idx: the timestamp index to read
+ * @tstamp: on return, the 40bit timestamp value
+ *
+ * Read a 40bit timestamp value out of the timestamp block of the external PHY
+ * on the E830 device.
+ */
+static enum ice_status
+ice_read_phy_tstamp_e830(struct ice_hw *hw, u8 lport, u8 idx, u64 *tstamp)
+{
+	u32 hi_addr = E830_HIGH_TX_MEMORY_BANK(idx, lport);
+	u32 lo_addr = E830_LOW_TX_MEMORY_BANK(idx, lport);
+	u32 lo_val, hi_val, lo;
+	u8 hi;
+
+	lo_val = rd32(hw, lo_addr);
+	hi_val = rd32(hw, hi_addr);
+
+	lo = lo_val;
+	hi = (u8)hi_val;
+
+	/* For E830 devices, the timestamp is reported with the lower 32 bits
+	 * in the low register, and the upper 8 bits in the high register.
+	 */
+	*tstamp = ((u64)hi) << TS_HIGH_S | ((u64)lo & TS_LOW_M);
+
+	return ICE_SUCCESS;
+}
+
+/**
+ * ice_get_phy_tx_tstamp_ready_e830 - Read Tx memory status register
+ * @hw: pointer to the HW struct
+ * @port: the PHY port to read
+ * @tstamp_ready: contents of the Tx memory status register
+ *
+ */
+enum ice_status
+ice_get_phy_tx_tstamp_ready_e830(struct ice_hw *hw, u8 port, u64 *tstamp_ready)
+{
+	u64 hi;
+	u32 lo;
+
+	lo = rd32(hw, E830_PRTMAC_TS_TX_MEM_VALID_L);
+	hi = (u64)rd32(hw, E830_PRTMAC_TS_TX_MEM_VALID_H) << 32;
+
+	*tstamp_ready = hi | lo;
+
+	return ICE_SUCCESS;
+}
+
 /* Device agnostic functions
  *
  * The following functions implement shared behavior common to both E822/E823
@@ -5352,6 +5319,100 @@ void ice_ptp_unlock(struct ice_hw *hw)
 	wr32(hw, PFTSYN_SEM + (PFTSYN_SEM_BYTES * hw->pf_id), 0);
 }
 
+/**
+ * ice_ptp_write_port_cmd - Prepare a single PHY port for a timer command
+ * @hw: pointer to HW struct
+ * @port: Port to which cmd has to be sent
+ * @cmd: Command to be sent to the port
+ * @lock_sbq: true if the sideband queue lock must be acquired
+ *
+ * Prepare one port for the upcoming timer sync command. Do not use this for
+ * programming only a single port, instead use ice_ptp_one_port_cmd() to
+ * ensure non-modified ports get properly initialized to ICE_PTP_NOP.
+ */
+enum ice_status
+ice_ptp_write_port_cmd(struct ice_hw *hw, u8 port, enum ice_ptp_tmr_cmd cmd,
+		       bool lock_sbq)
+{
+	switch (hw->phy_cfg) {
+	case ICE_PHY_E822:
+		return ice_ptp_write_port_cmd_e822(hw, port, cmd, lock_sbq);
+	default:
+		return ICE_ERR_NOT_SUPPORTED;
+	}
+}
+
+/**
+ * ice_ptp_one_port_cmd - Program one PHY port for a timer command
+ * @hw: pointer to HW struct
+ * @configured_port: the port that should execute the command
+ * @configured_cmd: the command to be executed on the configured port
+ * @lock_sbq: true if the sideband queue lock must be acquired
+ *
+ * Prepare one port for executing a timer command, while preparing all other
+ * ports to ICE_PTP_NOP. This allows executing a command on a single port
+ * while ensuring all other ports do not execute stale commands.
+ */
+enum ice_status
+ice_ptp_one_port_cmd(struct ice_hw *hw, u8 configured_port,
+		     enum ice_ptp_tmr_cmd configured_cmd, bool lock_sbq)
+{
+	u8 port;
+
+	for (port = 0; port < hw->max_phy_port; port++) {
+		enum ice_ptp_tmr_cmd cmd;
+		enum ice_status status;
+
+		/* Program the configured port with the configured command,
+		 * program all other ports with ICE_PTP_NOP.
+		 */
+		cmd = port == configured_port ? configured_cmd : ICE_PTP_NOP;
+
+		status = ice_ptp_write_port_cmd(hw, port, cmd, lock_sbq);
+		if (status)
+			return status;
+	}
+
+	return ICE_SUCCESS;
+}
+
+/**
+ * ice_ptp_port_cmd - Prepare PHY ports for a timer sync command
+ * @hw: pointer to HW struct
+ * @cmd: the timer command to setup
+ * @lock_sbq: true of sideband queue lock must be acquired
+ *
+ * Prepare all PHY ports on this device for the requested timer command. For
+ * some families this can be done in one shot, but for other families each
+ * port must be configured individually.
+ */
+static enum ice_status
+ice_ptp_port_cmd(struct ice_hw *hw, enum ice_ptp_tmr_cmd cmd, bool lock_sbq)
+{
+	u8 port;
+
+	/* PHY models which can program all ports simultaneously */
+	switch (hw->phy_cfg) {
+	case ICE_PHY_E830:
+		return ice_ptp_port_cmd_e830(hw, cmd, lock_sbq);
+	case ICE_PHY_E810:
+		return ice_ptp_port_cmd_e810(hw, cmd, lock_sbq);
+	default:
+		break;
+	}
+
+	/* PHY models which require programming each port separately */
+	for (port = 0; port < hw->max_phy_port; port++) {
+		enum ice_status status;
+
+		status = ice_ptp_write_port_cmd(hw, port, cmd, lock_sbq);
+		if (status)
+			return status;
+	}
+
+	return ICE_SUCCESS;
+}
+
 /**
  * ice_ptp_tmr_cmd - Prepare and trigger a timer sync command
  * @hw: pointer to HW struct
@@ -5372,22 +5433,7 @@ static int ice_ptp_tmr_cmd(struct ice_hw *hw, enum ice_ptp_tmr_cmd cmd,
 	ice_ptp_src_cmd(hw, cmd);
 
 	/* Next, prepare the ports */
-	switch (hw->phy_cfg) {
-	case ICE_PHY_ETH56G:
-		status = ice_ptp_port_cmd_eth56g(hw, cmd, lock_sbq);
-		break;
-	case ICE_PHY_E830:
-		status = ice_ptp_port_cmd_e830(hw, cmd, lock_sbq);
-		break;
-	case ICE_PHY_E810:
-		status = ice_ptp_port_cmd_e810(hw, cmd, lock_sbq);
-		break;
-	case ICE_PHY_E822:
-		status = ice_ptp_port_cmd_e822(hw, cmd, lock_sbq);
-		break;
-	default:
-		status = ICE_ERR_NOT_SUPPORTED;
-	}
+	status = ice_ptp_port_cmd(hw, cmd, lock_sbq);
 	if (status) {
 		ice_debug(hw, ICE_DBG_PTP, "Failed to prepare PHY ports for timer command %u, status %d\n",
 			  cmd, status);
@@ -5398,37 +5444,10 @@ static int ice_ptp_tmr_cmd(struct ice_hw *hw, enum ice_ptp_tmr_cmd cmd,
 	 * commands synchronously
 	 */
 	ice_ptp_exec_tmr_cmd(hw);
-	ice_ptp_clean_cmd(hw);
 
 	return 0;
 }
 
-/**
- * ice_ptp_write_direct_phc_time_e830 - Prepare PHY port with initial time
- * @hw: Board private structure
- * @time: Time to initialize the PHY port clock to
- *
- * Program the PHY port ETH_GLTSYN_SHTIME registers in preparation setting the
- * initial clock time. The time will not actually be programmed until the
- * driver issues an ICE_PTP_INIT_TIME command.
- *
- * The time value is the upper 32 bits of the PHY timer, usually in units of
- * nominal nanoseconds.
- */
-static enum ice_status
-ice_ptp_write_direct_phc_time_e830(struct ice_hw *hw, u64 time)
-{
-	u8 tmr_idx;
-
-	tmr_idx = hw->func_caps.ts_func_info.tmr_index_owned;
-
-	wr32(hw, GLTSYN_TIME_0(tmr_idx), 0);
-	wr32(hw, GLTSYN_TIME_L(tmr_idx), ICE_LO_DWORD(time));
-	wr32(hw, GLTSYN_TIME_H(tmr_idx), ICE_HI_DWORD(time));
-
-	return ICE_SUCCESS;
-}
-
 /**
  * ice_ptp_init_time - Initialize device time to provided value
  * @hw: pointer to HW struct
@@ -5451,7 +5470,7 @@ int ice_ptp_init_time(struct ice_hw *hw, u64 time)
 
 	/* Source timers */
 	/* For E830 we don't need to use shadow registers, its automatic */
-	if (ice_is_e830(hw))
+	if (hw->phy_cfg == ICE_PHY_E830)
 		return ice_ptp_write_direct_phc_time_e830(hw, time);
 
 	wr32(hw, GLTSYN_SHTIME_L(tmr_idx), ICE_LO_DWORD(time));
@@ -5502,7 +5521,7 @@ int ice_ptp_write_incval(struct ice_hw *hw, u64 incval)
 	tmr_idx = hw->func_caps.ts_func_info.tmr_index_owned;
 
 	/* For E830 we don't need to use shadow registers, its automatic */
-	if (ice_is_e830(hw))
+	if (hw->phy_cfg == ICE_PHY_E830)
 		return ice_ptp_write_direct_incval_e830(hw, incval);
 
 	/* Shadow Adjust */
drivers/net/ice/base/ice_ptp_hw.h +22 -3
index da5acf7556..1fda3cd74c 100644
@@ -143,6 +143,9 @@ int
 ice_clear_phy_tstamp(struct ice_hw *hw, u8 block, u8 idx);
 int ice_ptp_init_phc(struct ice_hw *hw);
 bool refsync_pin_id_valid(struct ice_hw *hw, u8 id);
+int
+ice_ptp_one_port_cmd(struct ice_hw *hw, u8 configured_port,
+		     enum ice_ptp_tmr_cmd configured_cmd, bool lock_sbq);
 
 /* E822 family functions */
 int
@@ -162,11 +165,14 @@ int
 ice_ptp_read_port_capture_e822(struct ice_hw *hw, u8 port,
 			       u64 *tx_ts, u64 *rx_ts);
 int
-ice_ptp_one_port_cmd_e822(struct ice_hw *hw, u8 port,
-			  enum ice_ptp_tmr_cmd cmd, bool lock_sbq);
-int
 ice_cfg_cgu_pll_e822(struct ice_hw *hw, enum ice_time_ref_freq clk_freq,
 		     enum ice_clk_src clk_src);
+int
+ice_ptp_write_port_cmd_e822(struct ice_hw *hw, u8 port,
+			    enum ice_ptp_tmr_cmd cmd, bool lock_sbq);
+enum ice_status
+ice_ptp_write_port_cmd(struct ice_hw *hw, u8 port, enum ice_ptp_tmr_cmd cmd,
+		       bool lock_sbq);
 enum ice_status
 ice_cfg_cgu_pll_e825c(struct ice_hw *hw, enum ice_time_ref_freq *clk_freq,
 		      enum ice_clk_src *clk_src);
@@ -180,6 +186,19 @@ ice_cfg_cgu_bypass_mux_e825c(struct ice_hw *hw, u8 port_num, bool clock_1588,
 			     unsigned int ena);
 enum ice_status ice_cfg_synce_ethdiv_e825c(struct ice_hw *hw, u8 *divider);
 
+/* E8 Family */
+enum ice_status
+ice_ptp_port_cmd_e830(struct ice_hw *hw, enum ice_ptp_tmr_cmd cmd,
+		      bool lock_sbq);
+enum ice_status
+ice_ptp_port_cmd_e810(struct ice_hw *hw, enum ice_ptp_tmr_cmd cmd,
+		      bool lock_sbq);
+enum ice_status
+ice_get_phy_tx_tstamp_ready_e830(struct ice_hw *hw, u8 port, u64 *tstamp_ready);
+int
+ice_ptp_port_cmd_eth56g(struct ice_hw *hw, enum ice_ptp_tmr_cmd cmd,
+			bool lock_sbq);
+
 /**
  * ice_e822_time_ref - Get the current TIME_REF from capabilities
  * @hw: pointer to the HW structure
Signature · 1 line
2.43.0
#73 lore raw

Re: [PATCH v2 055/148] net/ice/base: fix ice_ptp_one_port_cmd to avoid stale PHY commands

Quoted 52 lines · Anatoly Burakov

From: Ian Stokes <[email protected]>

Code using ice_ptp_one_port_cmd() (or the device specific variants for E822 and ETH56G) has a subtle bug where-in the executing of ice_ptp_exec_tmr_cmd() will cause all other ports to execute their last executed command.

Most flows operate on all timers at once, but some flows such as handling link state change only operate on one port at a time. This can lead to issues if the userspace performs clock operations at just the right time.

In addition to this bug, recent support for new hardware families has complicated the structure and organization of the various functions involved in programming PHY ports.

For example:

* ETH56G and E822 both re-implement the same looping structure for operating on all ports
* E810 and E830 use "ice_ptp_port_cmd" which takes a register value to write and only operates on these two families despite having a generic name.

Refactor ice_ptp_one_port_cmd() to both fix the issue of stale PHY port commands, and reduce the organizational complexity.

Rename the existing device implementations from ice_ptp_one_port_cmd_<device> to ice_ptp_write_port_cmd_<device>. This function just performs the task of writing one command to one port. Do not export this outside of ice_ptp_hw.c, instead ensure all callers use the refactored ice_ptp_one_port_cmd() which properly initializes all ports.

Fix ice_ptp_one_port_cmd() to correctly loop over all ports. For the configured port, call ice_ptp_write_port_cmd() with the configured command. For all other ports, call ice_ptp_write_port_cmd() with ICE_PTP_NOP.

Stop duplicating the port iteration logic in each of the ice_ptp_port_cmd_<dev>() implementations, instead moving this into the generic ice_ptp_port_cmd() implementation.

Since every flow now properly initializes both the main timer register and all port registers, ice_ptp_clean_cmd() is no longer needed, so remove it.

This fixes the issue of using stale PHY port commands, and aligns better with the flow for how ice_ptp_hw.c is implemented.

---
 drivers/net/ice/base/ice_ptp_hw.c | 649 +++++++++++++++---------------
 drivers/net/ice/base/ice_ptp_hw.h |  25 +-
 2 files changed, 356 insertions(+), 318 deletions(-)

<snip>

drivers/net/ice/base/ice_ptp_hw.c void ice_ptp_unlock(struct ice_hw *hw) · line 5356

Quoted 12 lines
drivers/net/ice/base/ice_ptp_hw.c +12 -0
+/**
+ * ice_ptp_one_port_cmd - Program one PHY port for a timer command
+ * @hw: pointer to HW struct
+ * @configured_port: the port that should execute the command
+ * @configured_cmd: the command to be executed on the configured port
+ * @lock_sbq: true if the sideband queue lock must be acquired
+ *
+ * Prepare one port for executing a timer command, while preparing all other
+ * ports to ICE_PTP_NOP. This allows executing a command on a single port
+ * while ensuring all other ports do not execute stale commands.
+ */
+enum ice_status

Compiler again throws build error on use of ice_status here.

/Bruce

Quoted 3 lines
drivers/net/ice/base/ice_ptp_hw.c +3 -0
+ice_ptp_one_port_cmd(struct ice_hw *hw, u8 configured_port,
+		     enum ice_ptp_tmr_cmd configured_cmd, bool lock_sbq)
+{
#74 lore raw

PATCH v2 56/148 net/ice/base: remove dead code from ice_get_ddp_pkg_state

In reply to Anatoly Burakov

From: Ian Stokes <[email protected]>

Removed "else" statement in ice_get_ddp_pkg_state() as it may never happen.

---
 drivers/net/ice/base/ice_ddp.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/net/ice/base/ice_ddp.c +1 -4
index fcf6dc69e3..5a0cf4d54f 100644
@@ -1205,11 +1205,8 @@ ice_get_ddp_pkg_state(struct ice_hw *hw, bool already_loaded)
 	} else if (hw->active_pkg_ver.major != ICE_PKG_SUPP_VER_MAJ ||
 		   hw->active_pkg_ver.minor != ICE_PKG_SUPP_VER_MNR) {
 		return ICE_DDP_PKG_ALREADY_LOADED_NOT_SUPPORTED;
-	} else if (hw->active_pkg_ver.major == ICE_PKG_SUPP_VER_MAJ &&
-		   hw->active_pkg_ver.minor == ICE_PKG_SUPP_VER_MNR) {
+	} else {
 		return ICE_DDP_PKG_COMPATIBLE_ALREADY_LOADED;
-	} else {
-		return ICE_DDP_PKG_ERR;
 	}
 }
 
Signature · 1 line
2.43.0
#75 lore raw

PATCH v2 57/148 net/ice/base: get rid of enum ice_status

In reply to Anatoly Burakov

From: Ian Stokes <[email protected]>

Replace enum ice_status with int. Also replcae ICE_SUCCESS instances with 0.

---
 drivers/net/ice/base/ice_common.c | 12 ++--
 drivers/net/ice/base/ice_ptp_hw.c | 93 +++++++++++++++----------------
 drivers/net/ice/base/ice_ptp_hw.h | 20 +++----
 drivers/net/ice/base/ice_switch.c | 20 +++----
 4 files changed, 71 insertions(+), 74 deletions(-)
drivers/net/ice/base/ice_common.c +6 -6
index d4b9d793ba..75d02d39f5 100644
@@ -703,7 +703,7 @@ ice_aq_get_link_info(struct ice_port_info *pi, bool ena_lse,
 
 	status = ice_aq_send_cmd(hw, &desc, &link_data, sizeof(link_data), cd);
 
-	if (status != 0)
+	if (status)
 		return status;
 
 	/* save off old link status information */
@@ -3973,7 +3973,7 @@ int
 ice_aq_set_link_restart_an(struct ice_port_info *pi, bool ena_link,
 			   struct ice_sq_cd *cd)
 {
-	enum ice_status status = ICE_ERR_AQ_ERROR;
+	int status = ICE_ERR_AQ_ERROR;
 	struct ice_aqc_restart_an *cmd;
 	struct ice_aq_desc desc;
 
@@ -3997,7 +3997,7 @@ ice_aq_set_link_restart_an(struct ice_port_info *pi, bool ena_link,
 	else
 		pi->phy.curr_user_phy_cfg.caps &= ~ICE_AQC_PHY_EN_LINK;
 
-	return ICE_SUCCESS;
+	return 0;
 }
 
 /**
@@ -5228,7 +5228,7 @@ ice_ena_vsi_txq(struct ice_port_info *pi, u16 vsi_handle, u8 tc, u16 q_handle,
 
 	/* add the LAN queue */
 	status = ice_aq_add_lan_txq(hw, num_qgrps, buf, buf_size, cd);
-	if (status != 0) {
+	if (status) {
 		ice_debug(hw, ICE_DBG_SCHED, "enable queue %d failed %d\n",
 			  LE16_TO_CPU(buf->txqs[0].txq_id),
 			  hw->adminq.sq_last_status);
@@ -5323,7 +5323,7 @@ ice_dis_vsi_txq(struct ice_port_info *pi, u16 vsi_handle, u8 tc, u8 num_queues,
 		status = ice_aq_dis_lan_txq(hw, 1, qg_list, buf_size, rst_src,
 					    vmvf_num, cd);
 
-		if (status != 0)
+		if (status)
 			break;
 		ice_free_sched_node(pi, node);
 		q_ctx->q_handle = ICE_INVAL_Q_HANDLE;
@@ -5664,7 +5664,7 @@ ice_sched_query_elem(struct ice_hw *hw, u32 node_teid,
 	buf->node_teid = CPU_TO_LE32(node_teid);
 	status = ice_aq_query_sched_elems(hw, 1, buf, buf_size, &num_elem_ret,
 					  NULL);
-	if (status != 0 || num_elem_ret != 1)
+	if (status || num_elem_ret != 1)
 		ice_debug(hw, ICE_DBG_SCHED, "query element failed\n");
 	return status;
 }
drivers/net/ice/base/ice_ptp_hw.c +45 -48

317 lines not on this page · raw message

drivers/net/ice/base/ice_ptp_hw.h +10 -10
index 1fda3cd74c..be62e594bc 100644
@@ -170,30 +170,30 @@ ice_cfg_cgu_pll_e822(struct ice_hw *hw, enum ice_time_ref_freq clk_freq,
 int
 ice_ptp_write_port_cmd_e822(struct ice_hw *hw, u8 port,
 			    enum ice_ptp_tmr_cmd cmd, bool lock_sbq);
-enum ice_status
+int
 ice_ptp_write_port_cmd(struct ice_hw *hw, u8 port, enum ice_ptp_tmr_cmd cmd,
 		       bool lock_sbq);
-enum ice_status
+int
 ice_cfg_cgu_pll_e825c(struct ice_hw *hw, enum ice_time_ref_freq *clk_freq,
 		      enum ice_clk_src *clk_src);
-enum ice_status
+int
 ice_cgu_ts_pll_lost_lock_e825c(struct ice_hw *hw, bool *lost_lock);
-enum ice_status ice_cgu_ts_pll_restart_e825c(struct ice_hw *hw);
-enum ice_status
+int ice_cgu_ts_pll_restart_e825c(struct ice_hw *hw);
+int
 ice_cgu_bypass_mux_port_active_e825c(struct ice_hw *hw, u8 port, bool *active);
-enum ice_status
+int
 ice_cfg_cgu_bypass_mux_e825c(struct ice_hw *hw, u8 port_num, bool clock_1588,
 			     unsigned int ena);
-enum ice_status ice_cfg_synce_ethdiv_e825c(struct ice_hw *hw, u8 *divider);
+int ice_cfg_synce_ethdiv_e825c(struct ice_hw *hw, u8 *divider);
 
 /* E8 Family */
-enum ice_status
+int
 ice_ptp_port_cmd_e830(struct ice_hw *hw, enum ice_ptp_tmr_cmd cmd,
 		      bool lock_sbq);
-enum ice_status
+int
 ice_ptp_port_cmd_e810(struct ice_hw *hw, enum ice_ptp_tmr_cmd cmd,
 		      bool lock_sbq);
-enum ice_status
+int
 ice_get_phy_tx_tstamp_ready_e830(struct ice_hw *hw, u8 port, u64 *tstamp_ready);
 int
 ice_ptp_port_cmd_eth56g(struct ice_hw *hw, enum ice_ptp_tmr_cmd cmd,
drivers/net/ice/base/ice_switch.c +10 -10
index e49b86e009..6d0dcf43c6 100644
@@ -3823,11 +3823,11 @@ ice_alloc_legacy_shared_recipe(struct ice_hw *hw, u16 *rid)
  * @hw: pointer to the hardware structure
  * @rid: recipe ID returned as response to AQ call
  */
-static enum ice_status
+static int
 ice_alloc_subscribable_recipe(struct ice_hw *hw, u16 *rid)
 {
 	struct ice_aqc_alloc_free_res_elem *buf;
-	enum ice_status status;
+	int status;
 	u16 buf_len;
 
 	buf_len = ice_struct_size(buf, elem, 1);
@@ -3860,7 +3860,7 @@ ice_alloc_subscribable_recipe(struct ice_hw *hw, u16 *rid)
  * @hw: pointer to the hardware structure
  * @rid: recipe ID returned as response to AQ call
  */
-enum ice_status ice_alloc_recipe(struct ice_hw *hw, u16 *rid)
+int ice_alloc_recipe(struct ice_hw *hw, u16 *rid)
 {
 	if (hw->subscribable_recipes_supported)
 		return ice_alloc_subscribable_recipe(hw, rid);
@@ -3873,7 +3873,7 @@ enum ice_status ice_alloc_recipe(struct ice_hw *hw, u16 *rid)
  * @hw: pointer to the hardware structure
  * @rid: recipe ID to free
  */
-static enum ice_status ice_free_recipe_res(struct ice_hw *hw, u16 rid)
+static int ice_free_recipe_res(struct ice_hw *hw, u16 rid)
 {
 	return ice_free_hw_res(hw, ICE_AQC_RES_TYPE_RECIPE, 1, &rid);
 }
@@ -3883,10 +3883,10 @@ static enum ice_status ice_free_recipe_res(struct ice_hw *hw, u16 rid)
  * @hw: pointer to the hardware structure
  * @rid: recipe ID to subscribe to
  */
-static enum ice_status ice_subscribe_recipe(struct ice_hw *hw, u16 rid)
+static int ice_subscribe_recipe(struct ice_hw *hw, u16 rid)
 {
 	struct ice_aqc_alloc_free_res_elem *buf;
-	enum ice_status status;
+	int status;
 	u16 buf_len;
 
 	buf_len = ice_struct_size(buf, elem, 1);
@@ -3939,12 +3939,12 @@ static void ice_subscribable_recp_shared(struct ice_hw *hw, u16 rid)
  * @hw: pointer to the hardware structure
  * @recp: the recipe struct resource to unassociate and free
  */
-static enum ice_status ice_release_recipe_res(struct ice_hw *hw,
-					      struct ice_sw_recipe *recp)
+static int ice_release_recipe_res(struct ice_hw *hw,
+				  struct ice_sw_recipe *recp)
 {
 	ice_declare_bitmap(r_bitmap, ICE_MAX_NUM_RECIPES);
 	struct ice_switch_info *sw = hw->switch_info;
-	enum ice_status status = ICE_SUCCESS;
+	int status = 0;
 	u16 num_recp, num_prof;
 	u8 rid, prof, i, j;
 
@@ -10418,7 +10418,7 @@ ice_replay_vsi_all_fltr(struct ice_hw *hw, struct ice_port_info *pi,
 						     head);
 		else
 			status = ice_replay_vsi_adv_rule(hw, vsi_handle, head);
-		if (status != 0)
+		if (status)
 			return status;
 	}
 
Signature · 1 line
2.43.0
#76 lore raw

Re: [PATCH v2 057/148] net/ice/base: get rid of enum ice_status

Quoted 4 lines · Anatoly Burakov

From: Ian Stokes <[email protected]>

Replace enum ice_status with int. Also replcae ICE_SUCCESS instances with 0.

Quoted 9 lines
---
 drivers/net/ice/base/ice_common.c | 12 ++--
 drivers/net/ice/base/ice_ptp_hw.c | 93 +++++++++++++++----------------
 drivers/net/ice/base/ice_ptp_hw.h | 20 +++----
 drivers/net/ice/base/ice_switch.c | 20 +++----
 4 files changed, 71 insertions(+), 74 deletions(-)

This looks a duplicate of patch 1 of the series. Rather than having two patches removing ice_status, can all instances be removed in patch 1, and then avoid adding new ones in subsequent patches. This will also remove the previously flagged build errors due to type mismatches of int vs enum.

One suggestion might be to rename "enum ice_status" to e.g."enum ice_status__" as part of patch one, meaning any subsequent use of it as a type will trigger a build error, while still allowing use of the individual values from it. WDYT?

/Bruce

#77 lore raw

PATCH v2 58/148 net/ice/base: use ICE_PTP_NOP to better indicate no action

In reply to Anatoly Burakov

From: Ian Stokes <[email protected]>

A couple of E822 PTP functions use ICE_PTP_READ_TIME on the main timer to avoid any side effects when programming a single PHY port. Match the ETH56G code by using ICE_PTP_NOP instead, which better reflects the intended behavior.

---
 drivers/net/ice/base/ice_ptp_hw.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/net/ice/base/ice_ptp_hw.c +4 -4
index 7424b8d6f4..22b3fe917a 100644
@@ -4192,8 +4192,8 @@ static int ice_sync_phy_timer_e822(struct ice_hw *hw, u8 port)
 	if (status)
 		goto err_unlock;
 
-	/* Init PHC mstr/src cmd for exec during sync */
-	ice_ptp_src_cmd(hw, ICE_PTP_READ_TIME);
+	/* Do not perform any action on the main timer */
+	ice_ptp_src_cmd(hw, ICE_PTP_NOP);
 
 	/* Issue the sync to activate the time adjustment */
 	ice_ptp_exec_tmr_cmd(hw);
@@ -4320,8 +4320,8 @@ ice_start_phy_timer_e822(struct ice_hw *hw, u8 port, bool bypass)
 	if (status)
 		return status;
 
-	/* Init PHC mstr/src cmd for exec during sync */
-	ice_ptp_src_cmd(hw, ICE_PTP_READ_TIME);
+	/* Do not perform any action on the main timer */
+	ice_ptp_src_cmd(hw, ICE_PTP_NOP);
 
 	ice_ptp_exec_tmr_cmd(hw);
 
Signature · 1 line
2.43.0
#78 lore raw

PATCH v2 59/148 net/ice/base: add fw log file

In reply to Anatoly Burakov

From: Ian Stokes <[email protected]>

Shared code has a fw_log.c file that is used to handle the firmware logging. For DPDK it's empty, but it is added to reduce delta between DPDK and shared code.

---
 drivers/net/ice/base/ice_fwlog.c                             | 5 +++++
 .../{vmxnet3/base/vmware_pack_end.h => ice/base/ice_fwlog.h} | 2 +-
 drivers/net/ice/base/meson.build                             | 1 +
 3 files changed, 7 insertions(+), 1 deletion(-)
 create mode 100644 drivers/net/ice/base/ice_fwlog.c
 copy drivers/net/{vmxnet3/base/vmware_pack_end.h => ice/base/ice_fwlog.h} (50%)
drivers/net/ice/base/ice_fwlog.c new file +5 -0
new file mode 100644
index 0000000000..a285ff3c66
@@ -0,0 +1,5 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2001-2023 Intel Corporation
+ */
+
+#include "ice_osdep.h"
drivers/net/ice/base/ice_fwlog.h renamed from drivers/net/vmxnet3/base/vmware_pack_end.h +1 -1
similarity index 50%
copy from drivers/net/vmxnet3/base/vmware_pack_end.h
copy to drivers/net/ice/base/ice_fwlog.h
index df22590f82..220da416ec 100644
@@ -1,3 +1,3 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2010-2014 Intel Corporation
+ * Copyright(c) 2001-2023 Intel Corporation
  */
drivers/net/ice/base/meson.build +1 -0
index 41ed2d96c6..5db5675856 100644
@@ -27,6 +27,7 @@ sources = [
         'ice_xlt_kb.c',
         'ice_parser_rt.c',
         'ice_ddp.c',
+        'ice_fwlog.c',
 ]
 
 error_cflags = [
Signature · 1 line
2.43.0
#79 lore raw

PATCH v2 60/148 net/ice/base: update comments regarding clearing timestamps

In reply to Anatoly Burakov

From: Ian Stokes <[email protected]>

During upstream review of the introduction of ice_clear_phy_tstamp(), reviewers requested to clarify the comments regarding the function behavior.

---
 drivers/net/ice/base/ice_ptp_hw.c | 30 +++++++++++++++++++++++++-----
 1 file changed, 25 insertions(+), 5 deletions(-)
drivers/net/ice/base/ice_ptp_hw.c +25 -5
index 22b3fe917a..07c8c65050 100644
@@ -2825,8 +2825,21 @@ ice_read_phy_tstamp_e822(struct ice_hw *hw, u8 quad, u8 idx, u64 *tstamp)
  * @quad: the quad to read from
  * @idx: the timestamp index to reset
  *
- * Clear a timestamp, resetting its valid bit, from the PHY quad block that is
- * shared between the internal PHYs on the E822 devices.
+ * Read the timestamp out of the quad to clear its timestamp status bit from
+ * the PHY quad block that is shared between the internal PHYs of the E822
+ * devices.
+ *
+ * Note that unlike E810, software cannot directly write to the quad memory
+ * bank registers. E822 relies on the ice_get_phy_tx_tstamp_ready() function
+ * to determine which timestamps are valid. Reading a timestamp auto-clears
+ * the valid bit.
+ *
+ * To directly clear the contents of the timestamp block entirely, discarding
+ * all timestamp data at once, software should instead use
+ * ice_ptp_reset_ts_memory_quad_e822().
+ *
+ * This function should only be called on an idx whose bit is set according to
+ * ice_get_phy_tx_tstamp_ready().
  */
 static int
 ice_clear_phy_tstamp_e822(struct ice_hw *hw, u8 quad, u8 idx)
@@ -4667,13 +4680,20 @@ ice_read_phy_tstamp_e810(struct ice_hw *hw, u8 lport, u8 idx, u64 *tstamp)
 }
 
 /**
- * ice_clear_phy_tstamp_e810 - Clear a timestamp from the external PHY
+ * ice_clear_phy_tstamp - Clear a timestamp from the timestamp block
  * @hw: pointer to the HW struct
  * @lport: the lport to read from
  * @idx: the timestamp index to reset
  *
- * Clear a timestamp, resetting its valid bit, from the timestamp block of the
- * external PHY on the E810 device.
+ * Clear a timestamp from the timestamp block, discarding its value without
+ * returning it. This resets the memory status bit for the timestamp index
+ * allowing it to be reused for another timestamp in the future.
+ *
+ * For E822 devices, the block number is the PHY quad to clear from. For E810
+ * devices, the block number is the logical port to clear from.
+ *
+ * This function must only be called on a timestamp index whose valid bit is
+ * set according to ice_get_phy_tx_tstamp_ready().
  */
 static int
 ice_clear_phy_tstamp_e810(struct ice_hw *hw, u8 lport, u8 idx)
Signature · 1 line
2.43.0
#80 lore raw

PATCH v2 61/148 net/ice/base: use "err" instead of "status" in ice_ptp_hw.c

In reply to Anatoly Burakov

From: Ian Stokes <[email protected]>

With the exception of a few functions, the upstream Linux version of ice_ptp_hw.c switched to using "int err" early before the initial conversion of "enum ice_status status" to "int status" was completed. This results in the upstream version using a different variable name than the out-of-tree shared file uses. This leads to difference tools like double-blame and patch-detective reporting differences due to the variable name change.

Standardize the ice_ptp_hw.c file to use "err" instead of "status" across almost all functions. The exceptions are:

* ice_get_pca9575_handle
* ice_read_sma_ctrl_e810t
* ice_write_sma_ctrl_e810t
* ice_is_pca9575_present

These functions were upstreamed using "int status" and we can leave them alone. The standard for the rest of this file going forward will be to use "err" going forward as that matches the style used throughout the rest of the file.

This should have no impact on functionality.

---
 drivers/net/ice/base/ice_ptp_hw.c | 2098 ++++++++++++++---------------
 1 file changed, 1043 insertions(+), 1055 deletions(-)
drivers/net/ice/base/ice_ptp_hw.c +1043 -1055
index 07c8c65050..237c9ffa94 100644
@@ -115,18 +115,18 @@ static int
 ice_read_cgu_reg_e82x(struct ice_hw *hw, u16 addr, u32 *val)
 {
 	struct ice_sbq_msg_input cgu_msg;
-	int status;
+	int err;
 
 	cgu_msg.opcode = ice_sbq_msg_rd;
 	cgu_msg.dest_dev = cgu;
 	cgu_msg.msg_addr_low = addr;
 	cgu_msg.msg_addr_high = 0x0;
 
-	status = ice_sbq_rw_reg_lp(hw, &cgu_msg, true);
-	if (status) {
-		ice_debug(hw, ICE_DBG_PTP, "Failed to read CGU register 0x%04x, status %d\n",
-			  addr, status);
-		return status;
+	err = ice_sbq_rw_reg_lp(hw, &cgu_msg, true);
+	if (err) {
+		ice_debug(hw, ICE_DBG_PTP, "Failed to read CGU register 0x%04x, err %d\n",
+			  addr, err);
+		return err;
 	}
 
 	*val = cgu_msg.data;
@@ -147,7 +147,7 @@ static int
 ice_write_cgu_reg_e82x(struct ice_hw *hw, u16 addr, u32 val)
 {
 	struct ice_sbq_msg_input cgu_msg;
-	int status;
+	int err;
 
 	cgu_msg.opcode = ice_sbq_msg_wr;
 	cgu_msg.dest_dev = cgu;
@@ -155,11 +155,11 @@ ice_write_cgu_reg_e82x(struct ice_hw *hw, u16 addr, u32 val)
 	cgu_msg.msg_addr_high = 0x0;
 	cgu_msg.data = val;
 
-	status = ice_sbq_rw_reg_lp(hw, &cgu_msg, true);
-	if (status) {
-		ice_debug(hw, ICE_DBG_PTP, "Failed to write CGU register 0x%04x, status %d\n",
-			  addr, status);
-		return status;
+	err = ice_sbq_rw_reg_lp(hw, &cgu_msg, true);
+	if (err) {
+		ice_debug(hw, ICE_DBG_PTP, "Failed to write CGU register 0x%04x, err %d\n",
+			  addr, err);
+		return err;
 	}
 
 	return 0;
@@ -227,7 +227,7 @@ ice_cfg_cgu_pll_e822(struct ice_hw *hw, enum ice_time_ref_freq clk_freq,
 	union nac_cgu_dword22 dw22;
 	union nac_cgu_dword24 dw24;
 	union nac_cgu_dword9 dw9;
-	int status;
+	int err;
 
 	if (clk_freq >= NUM_ICE_TIME_REF_FREQ) {
 		ice_warn(hw, "Invalid TIME_REF frequency %u\n", clk_freq);
@@ -245,17 +245,17 @@ ice_cfg_cgu_pll_e822(struct ice_hw *hw, enum ice_time_ref_freq clk_freq,
 		return ICE_ERR_PARAM;
 	}
 
-	status = ice_read_cgu_reg_e82x(hw, NAC_CGU_DWORD9, &dw9.val);
-	if (status)
-		return status;
+	err = ice_read_cgu_reg_e82x(hw, NAC_CGU_DWORD9, &dw9.val);
+	if (err)
+		return err;
 
-	status = ice_read_cgu_reg_e82x(hw, NAC_CGU_DWORD24, &dw24.val);
-	if (status)
-		return status;
+	err = ice_read_cgu_reg_e82x(hw, NAC_CGU_DWORD24, &dw24.val);
+	if (err)
+		return err;
 
-	status = ice_read_cgu_reg_e82x(hw, TSPLL_RO_BWM_LF, &bwm_lf.val);
-	if (status)
-		return status;
+	err = ice_read_cgu_reg_e82x(hw, TSPLL_RO_BWM_LF, &bwm_lf.val);
+	if (err)
+		return err;
 
 	/* Log the current clock configuration */
 	ice_debug(hw, ICE_DBG_PTP, "Current CGU configuration -- %s, clk_src %s, clk_freq %s, PLL %s\n",
@@ -268,67 +268,67 @@ ice_cfg_cgu_pll_e822(struct ice_hw *hw, enum ice_time_ref_freq clk_freq,
 	if (dw24.field.ts_pll_enable) {
 		dw24.field.ts_pll_enable = 0;
 
-		status = ice_write_cgu_reg_e82x(hw, NAC_CGU_DWORD24, dw24.val);
-		if (status)
-			return status;
+		err = ice_write_cgu_reg_e82x(hw, NAC_CGU_DWORD24, dw24.val);
+		if (err)
+			return err;
 	}
 
 	/* Set the frequency */
 	dw9.field.time_ref_freq_sel = clk_freq;
-	status = ice_write_cgu_reg_e82x(hw, NAC_CGU_DWORD9, dw9.val);
-	if (status)
-		return status;
+	err = ice_write_cgu_reg_e82x(hw, NAC_CGU_DWORD9, dw9.val);
+	if (err)
+		return err;
 
 	/* Configure the TS PLL feedback divisor */
-	status = ice_read_cgu_reg_e82x(hw, NAC_CGU_DWORD19, &dw19.val);
-	if (status)
-		return status;
+	err = ice_read_cgu_reg_e82x(hw, NAC_CGU_DWORD19, &dw19.val);
+	if (err)
+		return err;
 
 	dw19.field.tspll_fbdiv_intgr = e822_cgu_params[clk_freq].feedback_div;
 	dw19.field.tspll_ndivratio = 1;
 
-	status = ice_write_cgu_reg_e82x(hw, NAC_CGU_DWORD19, dw19.val);
-	if (status)
-		return status;
+	err = ice_write_cgu_reg_e82x(hw, NAC_CGU_DWORD19, dw19.val);
+	if (err)
+		return err;
 
 	/* Configure the TS PLL post divisor */
-	status = ice_read_cgu_reg_e82x(hw, NAC_CGU_DWORD22, &dw22.val);
-	if (status)
-		return status;
+	err = ice_read_cgu_reg_e82x(hw, NAC_CGU_DWORD22, &dw22.val);
+	if (err)
+		return err;
 
 	dw22.field.time1588clk_div = e822_cgu_params[clk_freq].post_pll_div;
 	dw22.field.time1588clk_sel_div2 = 0;
 
-	status = ice_write_cgu_reg_e82x(hw, NAC_CGU_DWORD22, dw22.val);
-	if (status)
-		return status;
+	err = ice_write_cgu_reg_e82x(hw, NAC_CGU_DWORD22, dw22.val);
+	if (err)
+		return err;
 
 	/* Configure the TS PLL pre divisor and clock source */
-	status = ice_read_cgu_reg_e82x(hw, NAC_CGU_DWORD24, &dw24.val);
-	if (status)
-		return status;
+	err = ice_read_cgu_reg_e82x(hw, NAC_CGU_DWORD24, &dw24.val);
+	if (err)
+		return err;
 
 	dw24.field.ref1588_ck_div = e822_cgu_params[clk_freq].refclk_pre_div;
 	dw24.field.tspll_fbdiv_frac = e822_cgu_params[clk_freq].frac_n_div;
 	dw24.field.time_ref_sel = clk_src;
 
-	status = ice_write_cgu_reg_e82x(hw, NAC_CGU_DWORD24, dw24.val);
-	if (status)
-		return status;
+	err = ice_write_cgu_reg_e82x(hw, NAC_CGU_DWORD24, dw24.val);
+	if (err)
+		return err;
 
 	/* Finally, enable the PLL */
 	dw24.field.ts_pll_enable = 1;
 
-	status = ice_write_cgu_reg_e82x(hw, NAC_CGU_DWORD24, dw24.val);
-	if (status)
-		return status;
+	err = ice_write_cgu_reg_e82x(hw, NAC_CGU_DWORD24, dw24.val);
+	if (err)
+		return err;
 
 	/* Wait to verify if the PLL locks */
 	ice_msec_delay(1, true);
 
-	status = ice_read_cgu_reg_e82x(hw, TSPLL_RO_BWM_LF, &bwm_lf.val);
-	if (status)
-		return status;
+	err = ice_read_cgu_reg_e82x(hw, TSPLL_RO_BWM_LF, &bwm_lf.val);
+	if (err)
+		return err;
 
 	if (!bwm_lf.field.plllock_true_lock_cri) {
 		ice_warn(hw, "CGU PLL failed to lock\n");
@@ -364,7 +364,7 @@ ice_cfg_cgu_pll_e825c(struct ice_hw *hw, enum ice_time_ref_freq *clk_freq,
 	union nac_cgu_dword22 dw22;
 	union nac_cgu_dword24 dw24;
 	union nac_cgu_dword9 dw9;
-	int status;
+	int err;
 
 	if (*clk_freq >= NUM_ICE_TIME_REF_FREQ) {
 		ice_warn(hw, "Invalid TIME_REF frequency %u\n", *clk_freq);
@@ -382,21 +382,21 @@ ice_cfg_cgu_pll_e825c(struct ice_hw *hw, enum ice_time_ref_freq *clk_freq,
 		return ICE_ERR_PARAM;
 	}
 
-	status = ice_read_cgu_reg_e82x(hw, NAC_CGU_DWORD9, &dw9.val);
-	if (status)
-		return status;
+	err = ice_read_cgu_reg_e82x(hw, NAC_CGU_DWORD9, &dw9.val);
+	if (err)
+		return err;
 
-	status = ice_read_cgu_reg_e82x(hw, NAC_CGU_DWORD24, &dw24.val);
-	if (status)
-		return status;
+	err = ice_read_cgu_reg_e82x(hw, NAC_CGU_DWORD24, &dw24.val);
+	if (err)
+		return err;
 
-	status = ice_read_cgu_reg_e82x(hw, NAC_CGU_DWORD23_E825C, &dw23.val);
-	if (status)
-		return status;
+	err = ice_read_cgu_reg_e82x(hw, NAC_CGU_DWORD23_E825C, &dw23.val);
+	if (err)
+		return err;
 
-	status = ice_read_cgu_reg_e82x(hw, TSPLL_RO_LOCK_E825C, &ro_lock.val);
-	if (status)
-		return status;
+	err = ice_read_cgu_reg_e82x(hw, TSPLL_RO_LOCK_E825C, &ro_lock.val);
+	if (err)
+		return err;
 
 	/* Log the current clock configuration */
 	ice_debug(hw, ICE_DBG_PTP, "Current CGU configuration -- %s, clk_src %s, clk_freq %s, PLL %s\n",
@@ -409,73 +409,73 @@ ice_cfg_cgu_pll_e825c(struct ice_hw *hw, enum ice_time_ref_freq *clk_freq,
 	if (dw23.field.ts_pll_enable) {
 		dw23.field.ts_pll_enable = 0;
 
-		status = ice_write_cgu_reg_e82x(hw, NAC_CGU_DWORD23_E825C,
-						dw23.val);
-		if (status)
-			return status;
+		err = ice_write_cgu_reg_e82x(hw, NAC_CGU_DWORD23_E825C,
+					     dw23.val);
+		if (err)
+			return err;
 	}
 
 	/* Set the frequency */
 	dw9.field.time_ref_freq_sel = *clk_freq;
-	status = ice_write_cgu_reg_e82x(hw, NAC_CGU_DWORD9, dw9.val);
-	if (status)
-		return status;
+	err = ice_write_cgu_reg_e82x(hw, NAC_CGU_DWORD9, dw9.val);
+	if (err)
+		return err;
 
 	/* Configure the TS PLL feedback divisor */
-	status = ice_read_cgu_reg_e82x(hw, NAC_CGU_DWORD19, &dw19.val);
-	if (status)
-		return status;
+	err = ice_read_cgu_reg_e82x(hw, NAC_CGU_DWORD19, &dw19.val);
+	if (err)
+		return err;
 
 	dw19.field.tspll_fbdiv_intgr = e822_cgu_params[*clk_freq].feedback_div;
 	dw19.field.tspll_ndivratio = 1;
 
-	status = ice_write_cgu_reg_e82x(hw, NAC_CGU_DWORD19, dw19.val);
-	if (status)
-		return status;
+	err = ice_write_cgu_reg_e82x(hw, NAC_CGU_DWORD19, dw19.val);
+	if (err)
+		return err;
 
 	/* Configure the TS PLL post divisor */
-	status = ice_read_cgu_reg_e82x(hw, NAC_CGU_DWORD22, &dw22.val);
-	if (status)
-		return status;
+	err = ice_read_cgu_reg_e82x(hw, NAC_CGU_DWORD22, &dw22.val);
+	if (err)
+		return err;
 
 	dw22.field.time1588clk_div = e822_cgu_params[*clk_freq].post_pll_div;
 	dw22.field.time1588clk_sel_div2 = 0;
 
-	status = ice_write_cgu_reg_e82x(hw, NAC_CGU_DWORD22, dw22.val);
-	if (status)
-		return status;
+	err = ice_write_cgu_reg_e82x(hw, NAC_CGU_DWORD22, dw22.val);
+	if (err)
+		return err;
 
 	/* Configure the TS PLL pre divisor and clock source */
-	status = ice_read_cgu_reg_e82x(hw, NAC_CGU_DWORD23_E825C, &dw23.val);
-	if (status)
-		return status;
+	err = ice_read_cgu_reg_e82x(hw, NAC_CGU_DWORD23_E825C, &dw23.val);
+	if (err)
+		return err;
 
 	dw23.field.ref1588_ck_div = e822_cgu_params[*clk_freq].refclk_pre_div;
 	dw23.field.time_ref_sel = *clk_src;
 
-	status = ice_write_cgu_reg_e82x(hw, NAC_CGU_DWORD23_E825C, dw23.val);
-	if (status)
-		return status;
+	err = ice_write_cgu_reg_e82x(hw, NAC_CGU_DWORD23_E825C, dw23.val);
+	if (err)
+		return err;
 
 	dw24.field.tspll_fbdiv_frac = e822_cgu_params[*clk_freq].frac_n_div;
 
-	status = ice_write_cgu_reg_e82x(hw, NAC_CGU_DWORD24, dw24.val);
-	if (status)
-		return status;
+	err = ice_write_cgu_reg_e82x(hw, NAC_CGU_DWORD24, dw24.val);
+	if (err)
+		return err;
 
 	/* Finally, enable the PLL */
 	dw23.field.ts_pll_enable = 1;
 
-	status = ice_write_cgu_reg_e82x(hw, NAC_CGU_DWORD23_E825C, dw23.val);
-	if (status)
-		return status;
+	err = ice_write_cgu_reg_e82x(hw, NAC_CGU_DWORD23_E825C, dw23.val);
+	if (err)
+		return err;
 
 	/* Wait to verify if the PLL locks */
 	ice_msec_delay(1, true);
 
-	status = ice_read_cgu_reg_e82x(hw, TSPLL_RO_LOCK_E825C, &ro_lock.val);
-	if (status)
-		return status;
+	err = ice_read_cgu_reg_e82x(hw, TSPLL_RO_LOCK_E825C, &ro_lock.val);
+	if (err)
+		return err;
 
 	if (!ro_lock.field.plllock_true_lock_cri) {
 		ice_warn(hw, "CGU PLL failed to lock\n");
@@ -505,19 +505,19 @@ ice_cfg_cgu_pll_e825c(struct ice_hw *hw, enum ice_time_ref_freq *clk_freq,
 static int ice_cfg_cgu_pll_dis_sticky_bits_e822(struct ice_hw *hw)
 {
 	union tspll_cntr_bist_settings cntr_bist;
-	int status;
+	int err;
 
-	status = ice_read_cgu_reg_e82x(hw, TSPLL_CNTR_BIST_SETTINGS,
-				       &cntr_bist.val);
-	if (status)
-		return status;
+	err = ice_read_cgu_reg_e82x(hw, TSPLL_CNTR_BIST_SETTINGS,
+				    &cntr_bist.val);
+	if (err)
+		return err;
 
 	cntr_bist.field.i_plllock_sel_0 = 0;
 	cntr_bist.field.i_plllock_sel_1 = 0;
 
-	status = ice_write_cgu_reg_e82x(hw, TSPLL_CNTR_BIST_SETTINGS,
-					cntr_bist.val);
-	return status;
+	err = ice_write_cgu_reg_e82x(hw, TSPLL_CNTR_BIST_SETTINGS,
+				     cntr_bist.val);
+	return err;
 }
 
 /**
@@ -530,18 +530,16 @@ static int ice_cfg_cgu_pll_dis_sticky_bits_e822(struct ice_hw *hw)
 static int ice_cfg_cgu_pll_dis_sticky_bits_e825c(struct ice_hw *hw)
 {
 	union tspll_bw_tdc_e825c bw_tdc;
-	int status;
+	int err;
 
-	status = ice_read_cgu_reg_e82x(hw, TSPLL_BW_TDC_E825C,
-				       &bw_tdc.val);
-	if (status)
-		return status;
+	err = ice_read_cgu_reg_e82x(hw, TSPLL_BW_TDC_E825C, &bw_tdc.val);
+	if (err)
+		return err;
 
 	bw_tdc.field.i_plllock_sel_1_0 = 0;
 
-	status = ice_write_cgu_reg_e82x(hw, TSPLL_BW_TDC_E825C,
-					bw_tdc.val);
-	return status;
+	err = ice_write_cgu_reg_e82x(hw, TSPLL_BW_TDC_E825C, bw_tdc.val);
+	return err;
 }
 
 /**
@@ -553,11 +551,11 @@ int
 ice_cgu_ts_pll_lost_lock_e825c(struct ice_hw *hw, bool *lost_lock)
 {
 	union tspll_ro_lock_e825c ro_lock;
-	int status;
+	int err;
 
-	status = ice_read_cgu_reg_e82x(hw, TSPLL_RO_LOCK_E825C, &ro_lock.val);
-	if (status)
-		return status;
+	err = ice_read_cgu_reg_e82x(hw, TSPLL_RO_LOCK_E825C, &ro_lock.val);
+	if (err)
+		return err;
 
 	if (ro_lock.field.pllunlock_flag_cri &&
 	    !ro_lock.field.plllock_true_lock_cri)
@@ -575,19 +573,19 @@ ice_cgu_ts_pll_lost_lock_e825c(struct ice_hw *hw, bool *lost_lock)
 int ice_cgu_ts_pll_restart_e825c(struct ice_hw *hw)
 {
 	union nac_cgu_dword23_e825c dw23;
-	int status;
+	int err;
 
 	/* Read the initial values of DW23 */
-	status = ice_read_cgu_reg_e82x(hw, NAC_CGU_DWORD23_E825C, &dw23.val);
-	if (status)
-		return status;
+	err = ice_read_cgu_reg_e82x(hw, NAC_CGU_DWORD23_E825C, &dw23.val);
+	if (err)
+		return err;
 
 	/* Disable the PLL */
 	dw23.field.ts_pll_enable = 0;
 
-	status = ice_write_cgu_reg_e82x(hw, NAC_CGU_DWORD23_E825C, dw23.val);
-	if (status)
-		return status;
+	err = ice_write_cgu_reg_e82x(hw, NAC_CGU_DWORD23_E825C, dw23.val);
+	if (err)
+		return err;
 
 	/* Wait 5us before reenabling PLL */
 	ice_usec_delay(5, false);
@@ -595,9 +593,9 @@ int ice_cgu_ts_pll_restart_e825c(struct ice_hw *hw)
 	/* Re-enable the PLL */
 	dw23.field.ts_pll_enable = 1;
 
-	status = ice_write_cgu_reg_e82x(hw, NAC_CGU_DWORD23_E825C, dw23.val);
-	if (status)
-		return status;
+	err = ice_write_cgu_reg_e82x(hw, NAC_CGU_DWORD23_E825C, dw23.val);
+	if (err)
+		return err;
 
 	return 0;
 }
@@ -624,11 +622,11 @@ int
 ice_cgu_bypass_mux_port_active_e825c(struct ice_hw *hw, u8 port, bool *active)
 {
 	union nac_cgu_dword11_e825c dw11;
-	int status;
+	int err;
 
-	status = ice_read_cgu_reg_e82x(hw, NAC_CGU_DWORD11_E825C, &dw11.val);
-	if (status)
-		return status;
+	err = ice_read_cgu_reg_e82x(hw, NAC_CGU_DWORD11_E825C, &dw11.val);
+	if (err)
+		return err;
 
 	if (dw11.field.synce_s_byp_clk == cgu_bypass_mux_port(hw, port))
 		*active = true;
@@ -651,22 +649,22 @@ ice_cfg_cgu_bypass_mux_e825c(struct ice_hw *hw, u8 port, bool clock_1588,
 {
 	union nac_cgu_dword11_e825c dw11;
 	union nac_cgu_dword10_e825c dw10;
-	int status;
+	int err;
 
-	status = ice_read_cgu_reg_e82x(hw, NAC_CGU_DWORD11_E825C, &dw11.val);
-	if (status)
-		return status;
+	err = ice_read_cgu_reg_e82x(hw, NAC_CGU_DWORD11_E825C, &dw11.val);
+	if (err)
+		return err;
 
-	status = ice_read_cgu_reg_e82x(hw, NAC_CGU_DWORD10_E825C, &dw10.val);
-	if (status)
-		return status;
+	err = ice_read_cgu_reg_e82x(hw, NAC_CGU_DWORD10_E825C, &dw10.val);
+	if (err)
+		return err;
 
 	/* ref_clk_byp1_div */
 	dw10.field.synce_ethclko_sel = 0x1;
 
-	status = ice_write_cgu_reg_e82x(hw, NAC_CGU_DWORD10_E825C, dw10.val);
-	if (status)
-		return status;
+	err = ice_write_cgu_reg_e82x(hw, NAC_CGU_DWORD10_E825C, dw10.val);
+	if (err)
+		return err;
 
 	if (!ena)
 		/* net_ref_clk0 */
@@ -716,24 +714,23 @@ static int ice_get_div_e825c(u16 link_speed, u8 *divider)
 int ice_cfg_synce_ethdiv_e825c(struct ice_hw *hw, u8 *divider)
 {
 	union nac_cgu_dword10_e825c dw10;
-	int status;
+	int err;
 	u16 link_speed;
 
 	link_speed = hw->port_info->phy.link_info.link_speed;
-	status = ice_get_div_e825c(link_speed, divider);
-	if (status)
-		return status;
+	err = ice_get_div_e825c(link_speed, divider);
+	if (err)
+		return err;
 
-	status = ice_read_cgu_reg_e82x(hw, NAC_CGU_DWORD10_E825C, &dw10.val);
-	if (status)
-		return status;
+	err = ice_read_cgu_reg_e82x(hw, NAC_CGU_DWORD10_E825C, &dw10.val);
+	if (err)
+		return err;
 
 	/*  programmable divider value (from 2 to 16) minus 1 for ETHCLKOUT */
 	dw10.field.synce_ethdiv_m1 = *divider + 1;
 
-	status = ice_write_cgu_reg_e82x(hw, NAC_CGU_DWORD10_E825C,
-					dw10.val);
-	return status;
+	err = ice_write_cgu_reg_e82x(hw, NAC_CGU_DWORD10_E825C, dw10.val);
+	return err;
 }
 
 /**
@@ -747,15 +744,15 @@ static int ice_init_cgu_e82x(struct ice_hw *hw)
 	struct ice_ts_func_info *ts_info = &hw->func_caps.ts_func_info;
 	enum ice_time_ref_freq time_ref_freq;
 	enum ice_clk_src clk_src;
-	int status;
+	int err;
 
 	/* Disable sticky lock detection so lock status reported is accurate */
 	if (ice_is_e825c(hw))
-		status = ice_cfg_cgu_pll_dis_sticky_bits_e825c(hw);
+		err = ice_cfg_cgu_pll_dis_sticky_bits_e825c(hw);
 	else
-		status = ice_cfg_cgu_pll_dis_sticky_bits_e822(hw);
-	if (status)
-		return status;
+		err = ice_cfg_cgu_pll_dis_sticky_bits_e822(hw);
+	if (err)
+		return err;
 
 	/* Configure the CGU PLL using the parameters from the function
 	 * capabilities.
@@ -763,11 +760,11 @@ static int ice_init_cgu_e82x(struct ice_hw *hw)
 	time_ref_freq = (enum ice_time_ref_freq)ts_info->time_ref;
 	clk_src = (enum ice_clk_src)ts_info->clk_src;
 	if (ice_is_e825c(hw))
-		status = ice_cfg_cgu_pll_e825c(hw, &time_ref_freq, &clk_src);
+		err = ice_cfg_cgu_pll_e825c(hw, &time_ref_freq, &clk_src);
 	else
-		status = ice_cfg_cgu_pll_e822(hw, time_ref_freq, clk_src);
-	if (status)
-		return status;
+		err = ice_cfg_cgu_pll_e822(hw, time_ref_freq, clk_src);
+	if (err)
+		return err;
 
 	return 0;
 }
@@ -919,7 +916,7 @@ ice_write_phy_eth56g_raw_lp(struct ice_hw *hw,  u32 reg_addr, u32 val,
 			    bool lock_sbq)
 {
 	struct ice_sbq_msg_input phy_msg;
-	int status;
+	int err;
 
 	phy_msg.opcode = ice_sbq_msg_wr;
 
@@ -929,13 +926,13 @@ ice_write_phy_eth56g_raw_lp(struct ice_hw *hw,  u32 reg_addr, u32 val,
 	phy_msg.data = val;
 	phy_msg.dest_dev = phy_56g;
 
-	status = ice_sbq_rw_reg_lp(hw, &phy_msg, lock_sbq);
+	err = ice_sbq_rw_reg_lp(hw, &phy_msg, lock_sbq);
 
-	if (status)
+	if (err)
 		ice_debug(hw, ICE_DBG_PTP, "PTP failed to send msg to phy %d\n",
-			  status);
+			  err);
 
-	return status;
+	return err;
 }
 
 /**
@@ -950,7 +947,7 @@ ice_read_phy_eth56g_raw_lp(struct ice_hw *hw, u32 reg_addr, u32 *val,
 			   bool lock_sbq)
 {
 	struct ice_sbq_msg_input phy_msg;
-	int status;
+	int err;
 
 	phy_msg.opcode = ice_sbq_msg_rd;
 
@@ -959,15 +956,15 @@ ice_read_phy_eth56g_raw_lp(struct ice_hw *hw, u32 reg_addr, u32 *val,
 
 	phy_msg.dest_dev = phy_56g;
 
-	status = ice_sbq_rw_reg_lp(hw, &phy_msg, lock_sbq);
+	err = ice_sbq_rw_reg_lp(hw, &phy_msg, lock_sbq);
 
-	if (status)
+	if (err)
 		ice_debug(hw, ICE_DBG_PTP, "PTP failed to send msg to phy %d\n",
-			  status);
+			  err);
 	else
 		*val = phy_msg.data;
 
-	return status;
+	return err;
 }
 
 /**
@@ -1028,12 +1025,12 @@ static int
 ice_write_phy_reg_eth56g_lp(struct ice_hw *hw, u8 port, u16 offset, u32 val,
 			    bool lock_sbq)
 {
-	int status;
+	int err;
 	u32 reg_addr;
 
-	status = ice_phy_port_reg_address_eth56g(port, offset, &reg_addr);
-	if (status)
-		return status;
+	err = ice_phy_port_reg_address_eth56g(port, offset, &reg_addr);
+	if (err)
+		return err;
 
 	return ice_write_phy_eth56g_raw_lp(hw, reg_addr, val, lock_sbq);
 }
@@ -1064,12 +1061,12 @@ static int
 ice_read_phy_reg_eth56g_lp(struct ice_hw *hw, u8 port, u16 offset, u32 *val,
 			   bool lock_sbq)
 {
-	int status;
+	int err;
 	u32 reg_addr;
 
-	status = ice_phy_port_reg_address_eth56g(port, offset, &reg_addr);
-	if (status)
-		return status;
+	err = ice_phy_port_reg_address_eth56g(port, offset, &reg_addr);
+	if (err)
+		return err;
 
 	return ice_read_phy_eth56g_raw_lp(hw, reg_addr, val, lock_sbq);
 }
@@ -1100,12 +1097,12 @@ static int
 ice_phy_port_mem_read_eth56g_lp(struct ice_hw *hw, u8 port, u16 offset,
 				u32 *val, bool lock_sbq)
 {
-	int status;
+	int err;
 	u32 mem_addr;
 
-	status = ice_phy_port_mem_address_eth56g(port, offset, &mem_addr);
-	if (status)
-		return status;
+	err = ice_phy_port_mem_address_eth56g(port, offset, &mem_addr);
+	if (err)
+		return err;
 
 	return ice_read_phy_eth56g_raw_lp(hw, mem_addr, val, lock_sbq);
 }
@@ -1137,12 +1134,12 @@ static int
 ice_phy_port_mem_write_eth56g_lp(struct ice_hw *hw, u8 port, u16 offset,
 				 u32 val, bool lock_sbq)
 {
-	int status;
+	int err;
 	u32 mem_addr;
 
-	status = ice_phy_port_mem_address_eth56g(port, offset, &mem_addr);
-	if (status)
-		return status;
+	err = ice_phy_port_mem_address_eth56g(port, offset, &mem_addr);
+	if (err)
+		return err;
 
 	return ice_write_phy_eth56g_raw_lp(hw, mem_addr, val, lock_sbq);
 }
@@ -1217,24 +1214,24 @@ static int
 ice_read_40b_phy_reg_eth56g(struct ice_hw *hw, u8 port, u16 low_addr, u64 *val)
 {
 	u16 high_addr = low_addr + sizeof(u32);
-	int status;
+	int err;
 	u32 lo, hi;
 
 	if (!ice_is_40b_phy_reg_eth56g(low_addr))
 		return ICE_ERR_PARAM;
 
-	status = ice_read_phy_reg_eth56g(hw, port, low_addr, &lo);
-	if (status) {
-		ice_debug(hw, ICE_DBG_PTP, "Failed to read from low register %#08x\n, status %d",
-			  (int)low_addr, status);
-		return status;
+	err = ice_read_phy_reg_eth56g(hw, port, low_addr, &lo);
+	if (err) {
+		ice_debug(hw, ICE_DBG_PTP, "Failed to read from low register %#08x\n, err %d",
+			  (int)low_addr, err);
+		return err;
 	}
 
-	status = ice_read_phy_reg_eth56g(hw, port, low_addr + sizeof(u32), &hi);
-	if (status) {
-		ice_debug(hw, ICE_DBG_PTP, "Failed to read from high register %08x\n, status %d",
-			  high_addr, status);
-		return status;
+	err = ice_read_phy_reg_eth56g(hw, port, low_addr + sizeof(u32), &hi);
+	if (err) {
+		ice_debug(hw, ICE_DBG_PTP, "Failed to read from high register %08x\n, err %d",
+			  high_addr, err);
+		return err;
 	}
 
 	*val = ((u64)hi << P_REG_40B_HIGH_S) | (lo & P_REG_40B_LOW_M);
@@ -1258,24 +1255,24 @@ static int
 ice_read_64b_phy_reg_eth56g(struct ice_hw *hw, u8 port, u16 low_addr, u64 *val)
 {
 	u16 high_addr = low_addr + sizeof(u32);
-	int status;
+	int err;
 	u32 lo, hi;
 
 	if (!ice_is_64b_phy_reg_eth56g(low_addr))
 		return ICE_ERR_PARAM;
 
-	status = ice_read_phy_reg_eth56g(hw, port, low_addr, &lo);
-	if (status) {
-		ice_debug(hw, ICE_DBG_PTP, "Failed to read from low register %#08x\n, status %d",
-			  low_addr, status);
-		return status;
+	err = ice_read_phy_reg_eth56g(hw, port, low_addr, &lo);
+	if (err) {
+		ice_debug(hw, ICE_DBG_PTP, "Failed to read from low register %#08x\n, err %d",
+			  low_addr, err);
+		return err;
 	}
 
-	status = ice_read_phy_reg_eth56g(hw, port, high_addr, &hi);
-	if (status) {
-		ice_debug(hw, ICE_DBG_PTP, "Failed to read from high register %#08x\n, status %d",
-			  high_addr, status);
-		return status;
+	err = ice_read_phy_reg_eth56g(hw, port, high_addr, &hi);
+	if (err) {
+		ice_debug(hw, ICE_DBG_PTP, "Failed to read from high register %#08x\n, err %d",
+			  high_addr, err);
+		return err;
 	}
 
 	*val = ((u64)hi << 32) | lo;
@@ -1299,7 +1296,7 @@ static int
 ice_write_40b_phy_reg_eth56g(struct ice_hw *hw, u8 port, u16 low_addr, u64 val)
 {
 	u16 high_addr = low_addr + sizeof(u32);
-	int status;
+	int err;
 	u32 lo, hi;
 
 	if (!ice_is_40b_phy_reg_eth56g(low_addr))
@@ -1308,18 +1305,18 @@ ice_write_40b_phy_reg_eth56g(struct ice_hw *hw, u8 port, u16 low_addr, u64 val)
 	lo = (u32)(val & P_REG_40B_LOW_M);
 	hi = (u32)(val >> P_REG_40B_HIGH_S);
 
-	status = ice_write_phy_reg_eth56g(hw, port, low_addr, lo);
-	if (status) {
-		ice_debug(hw, ICE_DBG_PTP, "Failed to write to low register 0x%08x\n, status %d",
-			  low_addr, status);
-		return status;
+	err = ice_write_phy_reg_eth56g(hw, port, low_addr, lo);
+	if (err) {
+		ice_debug(hw, ICE_DBG_PTP, "Failed to write to low register 0x%08x\n, err %d",
+			  low_addr, err);
+		return err;
 	}
 
-	status = ice_write_phy_reg_eth56g(hw, port, high_addr, hi);
-	if (status) {
-		ice_debug(hw, ICE_DBG_PTP, "Failed to write to high register 0x%08x\n, status %d",
-			  high_addr, status);
-		return status;
+	err = ice_write_phy_reg_eth56g(hw, port, high_addr, hi);
+	if (err) {
+		ice_debug(hw, ICE_DBG_PTP, "Failed to write to high register 0x%08x\n, err %d",
+			  high_addr, err);
+		return err;
 	}
 
 	return 0;
@@ -1340,7 +1337,7 @@ static int
 ice_write_64b_phy_reg_eth56g(struct ice_hw *hw, u8 port, u16 low_addr, u64 val)
 {
 	u16 high_addr = low_addr + sizeof(u32);
-	int status;
+	int err;
 	u32 lo, hi;
 
 	if (!ice_is_64b_phy_reg_eth56g(low_addr))
@@ -1349,18 +1346,18 @@ ice_write_64b_phy_reg_eth56g(struct ice_hw *hw, u8 port, u16 low_addr, u64 val)
 	lo = ICE_LO_DWORD(val);
 	hi = ICE_HI_DWORD(val);
 
-	status = ice_write_phy_reg_eth56g(hw, port, low_addr, lo);
-	if (status) {
-		ice_debug(hw, ICE_DBG_PTP, "Failed to write to low register 0x%08x\n, status %d",
-			  low_addr, status);
-		return status;
+	err = ice_write_phy_reg_eth56g(hw, port, low_addr, lo);
+	if (err) {
+		ice_debug(hw, ICE_DBG_PTP, "Failed to write to low register 0x%08x\n, err %d",
+			  low_addr, err);
+		return err;
 	}
 
-	status = ice_write_phy_reg_eth56g(hw, port, high_addr, hi);
-	if (status) {
-		ice_debug(hw, ICE_DBG_PTP, "Failed to write to high register 0x%08x\n, status %d",
-			  high_addr, status);
-		return status;
+	err = ice_write_phy_reg_eth56g(hw, port, high_addr, hi);
+	if (err) {
+		ice_debug(hw, ICE_DBG_PTP, "Failed to write to high register 0x%08x\n, err %d",
+			  high_addr, err);
+		return err;
 	}
 
 	return 0;
@@ -1379,25 +1376,25 @@ ice_write_64b_phy_reg_eth56g(struct ice_hw *hw, u8 port, u16 low_addr, u64 val)
 static int
 ice_read_phy_tstamp_eth56g(struct ice_hw *hw, u8 port, u8 idx, u64 *tstamp)
 {
-	int status;
 	u16 lo_addr, hi_addr;
 	u32 lo, hi;
+	int err;
 
 	lo_addr = (u16)PHY_TSTAMP_L(idx);
 	hi_addr = (u16)PHY_TSTAMP_U(idx);
 
-	status = ice_phy_port_mem_read_eth56g(hw, port, lo_addr, &lo);
-	if (status) {
-		ice_debug(hw, ICE_DBG_PTP, "Failed to read low PTP timestamp register, status %d\n",
-			  status);
-		return status;
+	err = ice_phy_port_mem_read_eth56g(hw, port, lo_addr, &lo);
+	if (err) {
+		ice_debug(hw, ICE_DBG_PTP, "Failed to read low PTP timestamp register, err %d\n",
+			  err);
+		return err;
 	}
 
-	status = ice_phy_port_mem_read_eth56g(hw, port, hi_addr, &hi);
-	if (status) {
-		ice_debug(hw, ICE_DBG_PTP, "Failed to read high PTP timestamp register, status %d\n",
-			  status);
-		return status;
+	err = ice_phy_port_mem_read_eth56g(hw, port, hi_addr, &hi);
+	if (err) {
+		ice_debug(hw, ICE_DBG_PTP, "Failed to read high PTP timestamp register, err %d\n",
+			  err);
+		return err;
 	}
 
 	/* For 56G based internal PHYs, the timestamp is reported with the
@@ -1421,16 +1418,16 @@ ice_read_phy_tstamp_eth56g(struct ice_hw *hw, u8 port, u8 idx, u64 *tstamp)
 static int
 ice_clear_phy_tstamp_eth56g(struct ice_hw *hw, u8 port, u8 idx)
 {
-	int status;
+	int err;
 	u16 lo_addr;
 
 	lo_addr = (u16)PHY_TSTAMP_L(idx);
 
-	status = ice_phy_port_mem_write_eth56g(hw, port, lo_addr, 0);
-	if (status) {
-		ice_debug(hw, ICE_DBG_PTP, "Failed to clear low PTP timestamp register, status %d\n",
-			  status);
-		return status;
+	err = ice_phy_port_mem_write_eth56g(hw, port, lo_addr, 0);
+	if (err) {
+		ice_debug(hw, ICE_DBG_PTP, "Failed to clear low PTP timestamp register for port %u, idx %u, err %d\n",
+			  port, idx, err);
+		return err;
 	}
 
 	return 0;
@@ -1447,14 +1444,14 @@ ice_clear_phy_tstamp_eth56g(struct ice_hw *hw, u8 port, u8 idx)
 static int
 ice_ptp_prep_port_phy_time_eth56g(struct ice_hw *hw, u8 port, u64 phy_time)
 {
-	int status;
+	int err;
 
 	/* Tx case */
-	status = ice_write_64b_phy_reg_eth56g(hw, port,
+	err = ice_write_64b_phy_reg_eth56g(hw, port,
 					      PHY_REG_TX_TIMER_INC_PRE_L,
 					      phy_time);
-	if (status)
-		return status;
+	if (err)
+		return err;
 
 	/* Rx case */
 	return ice_write_64b_phy_reg_eth56g(hw, port,
@@ -1475,7 +1472,6 @@ ice_ptp_prep_port_phy_time_eth56g(struct ice_hw *hw, u8 port, u64 phy_time)
 static int
 ice_ptp_prep_phy_time_eth56g(struct ice_hw *hw, u32 time)
 {
-	int status;
 	u64 phy_time;
 	u8 port;
 
@@ -1485,15 +1481,15 @@ ice_ptp_prep_phy_time_eth56g(struct ice_hw *hw, u32 time)
 	phy_time = (u64)time << 32;
 
 	for (port = 0; port < ICE_NUM_EXTERNAL_PORTS; port++) {
+		int err;
 		if (!(hw->ena_lports & BIT(port)))
 			continue;
-		status = ice_ptp_prep_port_phy_time_eth56g(hw, port,
-							   phy_time);
+		err = ice_ptp_prep_port_phy_time_eth56g(hw, port, phy_time);
 
-		if (status) {
-			ice_debug(hw, ICE_DBG_PTP, "Failed to write init time for port %u, status %d\n",
-				  port, status);
-			return status;
+		if (err) {
+			ice_debug(hw, ICE_DBG_PTP, "Failed to write init time for port %u, err %d\n",
+				  port, err);
+			return err;
 		}
 	}
 
@@ -1521,44 +1517,40 @@ int
 ice_ptp_prep_port_adj_eth56g(struct ice_hw *hw, u8 port, s64 time,
 			     bool lock_sbq)
 {
-	int status;
 	u32 l_time, u_time;
+	int err;
 
 	l_time = ICE_LO_DWORD(time);
 	u_time = ICE_HI_DWORD(time);
 
 	/* Tx case */
-	status = ice_write_phy_reg_eth56g_lp(hw, port,
-					     PHY_REG_TX_TIMER_INC_PRE_L,
-					     l_time, lock_sbq);
-	if (status)
+	err = ice_write_phy_reg_eth56g_lp(hw, port, PHY_REG_TX_TIMER_INC_PRE_L,
+					  l_time, lock_sbq);
+	if (err)
 		goto exit_err;
 
-	status = ice_write_phy_reg_eth56g_lp(hw, port,
-					     PHY_REG_TX_TIMER_INC_PRE_U,
-					     u_time, lock_sbq);
-	if (status)
+	err = ice_write_phy_reg_eth56g_lp(hw, port, PHY_REG_TX_TIMER_INC_PRE_U,
+					  u_time, lock_sbq);
+	if (err)
 		goto exit_err;
 
 	/* Rx case */
-	status = ice_write_phy_reg_eth56g_lp(hw, port,
-					     PHY_REG_RX_TIMER_INC_PRE_L,
-					     l_time, lock_sbq);
-	if (status)
+	err = ice_write_phy_reg_eth56g_lp(hw, port, PHY_REG_RX_TIMER_INC_PRE_L,
+					  l_time, lock_sbq);
+	if (err)
 		goto exit_err;
 
-	status = ice_write_phy_reg_eth56g_lp(hw, port,
-					     PHY_REG_RX_TIMER_INC_PRE_U,
-					     u_time, lock_sbq);
-	if (status)
+	err = ice_write_phy_reg_eth56g_lp(hw, port, PHY_REG_RX_TIMER_INC_PRE_U,
+					  u_time, lock_sbq);
+	if (err)
 		goto exit_err;
 
 	return 0;
 
 exit_err:
-	ice_debug(hw, ICE_DBG_PTP, "Failed to write time adjust for port %u, status %d\n",
-		  port, status);
-	return status;
+	ice_debug(hw, ICE_DBG_PTP, "Failed to write time adjust for port %u, err %d\n",
+		  port, err);
+	return err;
 }
 
 /**
@@ -1575,7 +1567,7 @@ ice_ptp_prep_port_adj_eth56g(struct ice_hw *hw, u8 port, s64 time,
 static int
 ice_ptp_prep_phy_adj_eth56g(struct ice_hw *hw, s32 adj, bool lock_sbq)
 {
-	int status = 0;
+	int err = 0;
 	s64 cycles;
 	u8 port;
 
@@ -1589,13 +1581,12 @@ ice_ptp_prep_phy_adj_eth56g(struct ice_hw *hw, s32 adj, bool lock_sbq)
 		if (!(hw->ena_lports & BIT(port)))
 			continue;
 
-		status = ice_ptp_prep_port_adj_eth56g(hw, port, cycles,
-						      lock_sbq);
-		if (status)
+		err = ice_ptp_prep_port_adj_eth56g(hw, port, cycles, lock_sbq);
+		if (err)
 			break;
 	}
 
-	return status;
+	return err;
 }
 
 /**
@@ -1610,19 +1601,18 @@ ice_ptp_prep_phy_adj_eth56g(struct ice_hw *hw, s32 adj, bool lock_sbq)
 static int
 ice_ptp_prep_phy_incval_eth56g(struct ice_hw *hw, u64 incval)
 {
-	int status;
 	u8 port;
 
 	for (port = 0; port < ICE_NUM_EXTERNAL_PORTS; port++) {
+		int err;
 		if (!(hw->ena_lports & BIT(port)))
 			continue;
-		status = ice_write_40b_phy_reg_eth56g(hw, port,
-						      PHY_REG_TIMETUS_L,
-						      incval);
-		if (status) {
-			ice_debug(hw, ICE_DBG_PTP, "Failed to write incval for port %u, status %d\n",
-				  port, status);
-			return status;
+		err = ice_write_40b_phy_reg_eth56g(hw, port, PHY_REG_TIMETUS_L,
+						   incval);
+		if (err) {
+			ice_debug(hw, ICE_DBG_PTP, "Failed to write incval for port %u, err %d\n",
+				  port, err);
+			return err;
 		}
 	}
 
@@ -1640,14 +1630,14 @@ ice_ptp_prep_phy_incval_eth56g(struct ice_hw *hw, u64 incval)
 int
 ice_ptp_read_phy_incval_eth56g(struct ice_hw *hw, u8 port, u64 *incval)
 {
-	int status;
+	int err;
 
-	status = ice_read_40b_phy_reg_eth56g(hw, port, PHY_REG_TIMETUS_L,
+	err = ice_read_40b_phy_reg_eth56g(hw, port, PHY_REG_TIMETUS_L,
 					     incval);
-	if (status) {
-		ice_debug(hw, ICE_DBG_PTP, "Failed to read TIMETUS_L, status %d\n",
-			  status);
-		return status;
+	if (err) {
+		ice_debug(hw, ICE_DBG_PTP, "Failed to read TIMETUS_L, err %d\n",
+			  err);
+		return err;
 	}
 
 	ice_debug(hw, ICE_DBG_PTP, "read INCVAL = 0x%016llx\n",
@@ -1672,7 +1662,7 @@ ice_ptp_read_phy_incval_eth56g(struct ice_hw *hw, u8 port, u64 *incval)
 static int
 ice_ptp_prep_phy_adj_target_eth56g(struct ice_hw *hw, u32 target_time)
 {
-	int status;
+	int err;
 	u8 port;
 
 	for (port = 0; port < ICE_NUM_EXTERNAL_PORTS; port++) {
@@ -1681,40 +1671,40 @@ ice_ptp_prep_phy_adj_target_eth56g(struct ice_hw *hw, u32 target_time)
 
 		/* Tx case */
 		/* No sub-nanoseconds data */
-		status = ice_write_phy_reg_eth56g_lp(hw, port,
-						     PHY_REG_TX_TIMER_CNT_ADJ_L,
-						     0, true);
-		if (status)
+		err = ice_write_phy_reg_eth56g_lp(hw, port,
+						  PHY_REG_TX_TIMER_CNT_ADJ_L,
+						  0, true);
+		if (err)
 			goto exit_err;
 
-		status = ice_write_phy_reg_eth56g_lp(hw, port,
-						     PHY_REG_TX_TIMER_CNT_ADJ_U,
-						     target_time, true);
-		if (status)
+		err = ice_write_phy_reg_eth56g_lp(hw, port,
+						  PHY_REG_TX_TIMER_CNT_ADJ_U,
+						  target_time, true);
+		if (err)
 			goto exit_err;
 
 		/* Rx case */
 		/* No sub-nanoseconds data */
-		status = ice_write_phy_reg_eth56g_lp(hw, port,
-						     PHY_REG_RX_TIMER_CNT_ADJ_L,
-						     0, true);
-		if (status)
+		err = ice_write_phy_reg_eth56g_lp(hw, port,
+						  PHY_REG_RX_TIMER_CNT_ADJ_L,
+						  0, true);
+		if (err)
 			goto exit_err;
 
-		status = ice_write_phy_reg_eth56g_lp(hw, port,
-						     PHY_REG_RX_TIMER_CNT_ADJ_U,
-						     target_time, true);
-		if (status)
+		err = ice_write_phy_reg_eth56g_lp(hw, port,
+						  PHY_REG_RX_TIMER_CNT_ADJ_U,
+						  target_time, true);
+		if (err)
 			goto exit_err;
 	}
 
 	return 0;
 
 exit_err:
-	ice_debug(hw, ICE_DBG_PTP, "Failed to write target time for port %u, status %d\n",
-		  port, status);
+	ice_debug(hw, ICE_DBG_PTP, "Failed to write target time for port %u, err %d\n",
+		  port, err);
 
-	return status;
+	return err;
 }
 
 /**
@@ -1730,27 +1720,27 @@ int
 ice_ptp_read_port_capture_eth56g(struct ice_hw *hw, u8 port, u64 *tx_ts,
 				 u64 *rx_ts)
 {
-	int status;
+	int err;
 
 	/* Tx case */
-	status = ice_read_64b_phy_reg_eth56g(hw, port, PHY_REG_TX_CAPTURE_L,
-					     tx_ts);
-	if (status) {
-		ice_debug(hw, ICE_DBG_PTP, "Failed to read REG_TX_CAPTURE, status %d\n",
-			  status);
-		return status;
+	err = ice_read_64b_phy_reg_eth56g(hw, port, PHY_REG_TX_CAPTURE_L,
+					  tx_ts);
+	if (err) {
+		ice_debug(hw, ICE_DBG_PTP, "Failed to read REG_TX_CAPTURE, err %d\n",
+			  err);
+		return err;
 	}
 
 	ice_debug(hw, ICE_DBG_PTP, "tx_init = %#016llx\n",
 		  (unsigned long long)*tx_ts);
 
 	/* Rx case */
-	status = ice_read_64b_phy_reg_eth56g(hw, port, PHY_REG_RX_CAPTURE_L,
-					     rx_ts);
-	if (status) {
-		ice_debug(hw, ICE_DBG_PTP, "Failed to read RX_CAPTURE, status %d\n",
-			  status);
-		return status;
+	err = ice_read_64b_phy_reg_eth56g(hw, port, PHY_REG_RX_CAPTURE_L,
+					  rx_ts);
+	if (err) {
+		ice_debug(hw, ICE_DBG_PTP, "Failed to read RX_CAPTURE, err %d\n",
+			  err);
+		return err;
 	}
 
 	ice_debug(hw, ICE_DBG_PTP, "rx_init = %#016llx\n",
@@ -1772,7 +1762,7 @@ int
 ice_ptp_one_port_cmd_eth56g(struct ice_hw *hw, u8 port,
 			    enum ice_ptp_tmr_cmd cmd, bool lock_sbq)
 {
-	int status;
+	int err;
 	u32 cmd_val, val;
 	u8 tmr_idx;
 
@@ -1801,46 +1791,46 @@ ice_ptp_one_port_cmd_eth56g(struct ice_hw *hw, u8 port,
 
 	/* Tx case */
 	/* Read, modify, write */
-	status = ice_read_phy_reg_eth56g_lp(hw, port, PHY_REG_TX_TMR_CMD, &val,
+	err = ice_read_phy_reg_eth56g_lp(hw, port, PHY_REG_TX_TMR_CMD, &val,
 					    lock_sbq);
-	if (status) {
-		ice_debug(hw, ICE_DBG_PTP, "Failed to read TX_TMR_CMD, status %d\n",
-			  status);
-		return status;
+	if (err) {
+		ice_debug(hw, ICE_DBG_PTP, "Failed to read TX_TMR_CMD, err %d\n",
+			  err);
+		return err;
 	}
 
 	/* Modify necessary bits only and perform write */
 	val &= ~TS_CMD_MASK;
 	val |= cmd_val;
 
-	status = ice_write_phy_reg_eth56g_lp(hw, port, PHY_REG_TX_TMR_CMD, val,
+	err = ice_write_phy_reg_eth56g_lp(hw, port, PHY_REG_TX_TMR_CMD, val,
 					     lock_sbq);
-	if (status) {
-		ice_debug(hw, ICE_DBG_PTP, "Failed to write back TX_TMR_CMD, status %d\n",
-			  status);
-		return status;
+	if (err) {
+		ice_debug(hw, ICE_DBG_PTP, "Failed to write back TX_TMR_CMD, err %d\n",
+			  err);
+		return err;
 	}
 
 	/* Rx case */
 	/* Read, modify, write */
-	status = ice_read_phy_reg_eth56g_lp(hw, port, PHY_REG_RX_TMR_CMD, &val,
+	err = ice_read_phy_reg_eth56g_lp(hw, port, PHY_REG_RX_TMR_CMD, &val,
 					    lock_sbq);
-	if (status) {
-		ice_debug(hw, ICE_DBG_PTP, "Failed to read RX_TMR_CMD, status %d\n",
-			  status);
-		return status;
+	if (err) {
+		ice_debug(hw, ICE_DBG_PTP, "Failed to read RX_TMR_CMD, err %d\n",
+			  err);
+		return err;
 	}
 
 	/* Modify necessary bits only and perform write */
 	val &= ~TS_CMD_MASK;
 	val |= cmd_val;
 
-	status = ice_write_phy_reg_eth56g_lp(hw, port, PHY_REG_RX_TMR_CMD, val,
+	err = ice_write_phy_reg_eth56g_lp(hw, port, PHY_REG_RX_TMR_CMD, val,
 					     lock_sbq);
-	if (status) {
-		ice_debug(hw, ICE_DBG_PTP, "Failed to write back RX_TMR_CMD, status %d\n",
-			  status);
-		return status;
+	if (err) {
+		ice_debug(hw, ICE_DBG_PTP, "Failed to write back RX_TMR_CMD, err %d\n",
+			  err);
+		return err;
 	}
 
 	return 0;
@@ -1859,16 +1849,16 @@ int
 ice_ptp_port_cmd_eth56g(struct ice_hw *hw, enum ice_ptp_tmr_cmd cmd,
 			bool lock_sbq)
 {
-	int status;
+	int err;
 	u8 port;
 
 	for (port = 0; port < ICE_NUM_EXTERNAL_PORTS; port++) {
 		if (!(hw->ena_lports & BIT(port)))
 			continue;
 
-		status = ice_ptp_one_port_cmd_eth56g(hw, port, cmd, lock_sbq);
-		if (status)
-			return status;
+		err = ice_ptp_one_port_cmd_eth56g(hw, port, cmd, lock_sbq);
+		if (err)
+			return err;
 	}
 
 	return 0;
@@ -1905,8 +1895,8 @@ ice_calc_fixed_tx_offset_eth56g(struct ice_hw *hw,
 int ice_phy_cfg_tx_offset_eth56g(struct ice_hw *hw, u8 port)
 {
 	enum ice_ptp_link_spd link_spd = ICE_PTP_LNK_SPD_10G;
-	int status;
 	u64 total_offset;
+	int err;
 
 	total_offset = ice_calc_fixed_tx_offset_eth56g(hw, link_spd);
 
@@ -1914,11 +1904,10 @@ int ice_phy_cfg_tx_offset_eth56g(struct ice_hw *hw, u8 port)
 	 * PHY and indicate that the Tx offset is ready. After this,
 	 * timestamps will be enabled.
 	 */
-	status = ice_write_64b_phy_reg_eth56g(hw, port,
-					      PHY_REG_TOTAL_TX_OFFSET_L,
-					      total_offset);
-	if (status)
-		return status;
+	err = ice_write_64b_phy_reg_eth56g(hw, port, PHY_REG_TOTAL_TX_OFFSET_L,
+					   total_offset);
+	if (err)
+		return err;
 
 	return ice_write_phy_reg_eth56g(hw, port, PHY_REG_TX_OFFSET_READY, 1);
 }
@@ -1959,7 +1948,7 @@ ice_calc_fixed_rx_offset_eth56g(struct ice_hw *hw,
  */
 int ice_phy_cfg_rx_offset_eth56g(struct ice_hw *hw, u8 port)
 {
-	int status;
+	int err;
 	u64 total_offset;
 
 	total_offset = ice_calc_fixed_rx_offset_eth56g(hw, 0);
@@ -1968,11 +1957,10 @@ int ice_phy_cfg_rx_offset_eth56g(struct ice_hw *hw, u8 port)
 	 * PHY and indicate that the Rx offset is ready. After this,
 	 * timestamps will be enabled.
 	 */
-	status = ice_write_64b_phy_reg_eth56g(hw, port,
-					      PHY_REG_TOTAL_RX_OFFSET_L,
-					      total_offset);
-	if (status)
-		return status;
+	err = ice_write_64b_phy_reg_eth56g(hw, port, PHY_REG_TOTAL_RX_OFFSET_L,
+					   total_offset);
+	if (err)
+		return err;
 
 	return ice_write_phy_reg_eth56g(hw, port, PHY_REG_RX_OFFSET_READY, 1);
 }
@@ -1991,10 +1979,10 @@ static int
 ice_read_phy_and_phc_time_eth56g(struct ice_hw *hw, u8 port, u64 *phy_time,
 				 u64 *phc_time)
 {
-	int status;
 	u64 tx_time, rx_time;
 	u32 zo, lo;
 	u8 tmr_idx;
+	int err;
 
 	tmr_idx = ice_get_ptp_src_clock_index(hw);
 
@@ -2002,9 +1990,9 @@ ice_read_phy_and_phc_time_eth56g(struct ice_hw *hw, u8 port, u64 *phy_time,
 	ice_ptp_src_cmd(hw, ICE_PTP_READ_TIME);
 
 	/* Prepare the PHY timer for a ICE_PTP_READ_TIME capture command */
-	status = ice_ptp_one_port_cmd_eth56g(hw, port, ICE_PTP_READ_TIME, true);
-	if (status)
-		return status;
+	err = ice_ptp_one_port_cmd_eth56g(hw, port, ICE_PTP_READ_TIME, true);
+	if (err)
+		return err;
 
 	/* Issue the sync to start the ICE_PTP_READ_TIME capture */
 	ice_ptp_exec_tmr_cmd(hw);
@@ -2015,9 +2003,9 @@ ice_read_phy_and_phc_time_eth56g(struct ice_hw *hw, u8 port, u64 *phy_time,
 	*phc_time = (u64)lo << 32 | zo;
 
 	/* Read the captured PHY time from the PHY shadow registers */
-	status = ice_ptp_read_port_capture_eth56g(hw, port, &tx_time, &rx_time);
-	if (status)
-		return status;
+	err = ice_ptp_read_port_capture_eth56g(hw, port, &tx_time, &rx_time);
+	if (err)
+		return err;
 
 	/* If the PHY Tx and Rx timers don't match, log a warning message.
 	 * Note that this should not happen in normal circumstances since the
@@ -2048,16 +2036,16 @@ ice_read_phy_and_phc_time_eth56g(struct ice_hw *hw, u8 port, u64 *phy_time,
 static int ice_sync_phy_timer_eth56g(struct ice_hw *hw, u8 port)
 {
 	u64 phc_time, phy_time, difference;
-	int status;
+	int err;
 
 	if (!ice_ptp_lock(hw)) {
 		ice_debug(hw, ICE_DBG_PTP, "Failed to acquire PTP semaphore\n");
 		return ICE_ERR_NOT_READY;
 	}
 
-	status = ice_read_phy_and_phc_time_eth56g(hw, port, &phy_time,
-						  &phc_time);
-	if (status)
+	err = ice_read_phy_and_phc_time_eth56g(hw, port, &phy_time,
+					       &phc_time);
+	if (err)
 		goto err_unlock;
 
 	/* Calculate the amount required to add to the port time in order for
@@ -2072,12 +2060,12 @@ static int ice_sync_phy_timer_eth56g(struct ice_hw *hw, u8 port)
 	ice_ptp_src_cmd(hw, ICE_PTP_NOP);
 	difference = phc_time - phy_time;
 
-	status = ice_ptp_prep_port_adj_eth56g(hw, port, (s64)difference, true);
-	if (status)
+	err = ice_ptp_prep_port_adj_eth56g(hw, port, (s64)difference, true);
+	if (err)
 		goto err_unlock;
 
-	status = ice_ptp_one_port_cmd_eth56g(hw, port, ICE_PTP_ADJ_TIME, true);
-	if (status)
+	err = ice_ptp_one_port_cmd_eth56g(hw, port, ICE_PTP_ADJ_TIME, true);
+	if (err)
 		goto err_unlock;
 
 	/* Issue the sync to activate the time adjustment */
@@ -2087,9 +2075,9 @@ static int ice_sync_phy_timer_eth56g(struct ice_hw *hw, u8 port)
 	 * verify that the time was properly adjusted.
 	 */
 
-	status = ice_read_phy_and_phc_time_eth56g(hw, port, &phy_time,
-						  &phc_time);
-	if (status)
+	err = ice_read_phy_and_phc_time_eth56g(hw, port, &phy_time,
+					       &phc_time);
+	if (err)
 		goto err_unlock;
 
 	ice_info(hw, "Port %u PHY time synced to PHC: 0x%016llX, 0x%016llX\n",
@@ -2098,7 +2086,7 @@ static int ice_sync_phy_timer_eth56g(struct ice_hw *hw, u8 port)
 
 err_unlock:
 	ice_ptp_unlock(hw);
-	return status;
+	return err;
 }
 
 /**
@@ -2114,15 +2102,15 @@ static int ice_sync_phy_timer_eth56g(struct ice_hw *hw, u8 port)
 int
 ice_stop_phy_timer_eth56g(struct ice_hw *hw, u8 port, bool soft_reset)
 {
-	int status;
+	int err;
 
-	status = ice_write_phy_reg_eth56g(hw, port, PHY_REG_TX_OFFSET_READY, 0);
-	if (status)
-		return status;
+	err = ice_write_phy_reg_eth56g(hw, port, PHY_REG_TX_OFFSET_READY, 0);
+	if (err)
+		return err;
 
-	status = ice_write_phy_reg_eth56g(hw, port, PHY_REG_RX_OFFSET_READY, 0);
-	if (status)
-		return status;
+	err = ice_write_phy_reg_eth56g(hw, port, PHY_REG_RX_OFFSET_READY, 0);
+	if (err)
+		return err;
 
 	ice_debug(hw, ICE_DBG_PTP, "Disabled clock on PHY port %u\n", port);
 
@@ -2143,16 +2131,16 @@ ice_stop_phy_timer_eth56g(struct ice_hw *hw, u8 port, bool soft_reset)
 int
 ice_start_phy_timer_eth56g(struct ice_hw *hw, u8 port, bool bypass)
 {
-	int status;
+	int err;
 	u32 lo, hi;
 	u64 incval;
 	u8 tmr_idx;
 
 	tmr_idx = ice_get_ptp_src_clock_index(hw);
 
-	status = ice_stop_phy_timer_eth56g(hw, port, false);
-	if (status)
-		return status;
+	err = ice_stop_phy_timer_eth56g(hw, port, false);
+	if (err)
+		return err;
 
 	ice_ptp_src_cmd(hw, ICE_PTP_NOP);
 
@@ -2160,31 +2148,31 @@ ice_start_phy_timer_eth56g(struct ice_hw *hw, u8 port, bool bypass)
 	hi = rd32(hw, GLTSYN_INCVAL_H(tmr_idx));
 	incval = (u64)hi << 32 | lo;
 
-	status = ice_write_40b_phy_reg_eth56g(hw, port, PHY_REG_TIMETUS_L,
-					      incval);
-	if (status)
-		return status;
+	err = ice_write_40b_phy_reg_eth56g(hw, port, PHY_REG_TIMETUS_L,
+					   incval);
+	if (err)
+		return err;
 
-	status = ice_ptp_one_port_cmd_eth56g(hw, port, ICE_PTP_INIT_INCVAL,
+	err = ice_ptp_one_port_cmd_eth56g(hw, port, ICE_PTP_INIT_INCVAL,
 					     true);
-	if (status)
-		return status;
+	if (err)
+		return err;
 
 	ice_ptp_exec_tmr_cmd(hw);
 
-	status = ice_sync_phy_timer_eth56g(hw, port);
-	if (status)
-		return status;
+	err = ice_sync_phy_timer_eth56g(hw, port);
+	if (err)
+		return err;
 
 	/* Program the Tx offset */
-	status = ice_phy_cfg_tx_offset_eth56g(hw, port);
-	if (status)
-		return status;
+	err = ice_phy_cfg_tx_offset_eth56g(hw, port);
+	if (err)
+		return err;
 
 	/* Program the Rx offset */
-	status = ice_phy_cfg_rx_offset_eth56g(hw, port);
-	if (status)
-		return status;
+	err = ice_phy_cfg_rx_offset_eth56g(hw, port);
+	if (err)
+		return err;
 
 	ice_debug(hw, ICE_DBG_PTP, "Enabled clock on PHY port %u\n", port);
 
@@ -2199,7 +2187,7 @@ ice_start_phy_timer_eth56g(struct ice_hw *hw, u8 port, bool bypass)
  */
 static int ice_ptp_init_phc_eth56g(struct ice_hw *hw)
 {
-	int status = 0;
+	int err = 0;
 	u32 regval;
 
 	/* Enable reading switch and PHY registers over the sideband queue */
@@ -2211,46 +2199,46 @@ static int ice_ptp_init_phc_eth56g(struct ice_hw *hw)
 	wr32(hw, PF_SB_REM_DEV_CTL, regval);
 
 	/* Initialize the Clock Generation Unit */
-	status = ice_init_cgu_e82x(hw);
+	err = ice_init_cgu_e82x(hw);
 
-	return status;
+	return err;
 }
 
 /**
  * ice_ptp_read_tx_hwtstamp_status_eth56g - Get the current TX timestamp
- * status mask. Returns the mask of ports where TX timestamps are available
+ * err mask. Returns the mask of ports where TX timestamps are available
  * @hw: pointer to the HW struct
- * @ts_status: the timestamp mask pointer
+ * @ts_err: the timestamp mask pointer
  */
 int
-ice_ptp_read_tx_hwtstamp_status_eth56g(struct ice_hw *hw, u32 *ts_status)
+ice_ptp_read_tx_hwtstamp_status_eth56g(struct ice_hw *hw, u32 *ts_err)
 {
-	int status;
+	int err;
 
-	status = ice_read_phy_eth56g_raw_lp(hw, PHY_PTP_INT_STATUS, ts_status,
+	err = ice_read_phy_eth56g_raw_lp(hw, PHY_PTP_INT_STATUS, ts_err,
 					    true);
-	if (status)
-		return status;
+	if (err)
+		return err;
 
-	ice_debug(hw, ICE_DBG_PTP, "PHY interrupt status: %x\n", *ts_status);
+	ice_debug(hw, ICE_DBG_PTP, "PHY interrupt err: %x\n", *ts_err);
 
 	return 0;
 }
 
 /**
- * ice_ptp_init_phy_cfg - Get the current TX timestamp status
+ * ice_ptp_init_phy_cfg - Get the current TX timestamp err
  * mask. Returns the mask of ports where TX timestamps are available
  * @hw: pointer to the HW struct
  */
 int ice_ptp_init_phy_cfg(struct ice_hw *hw)
 {
-	int status;
+	int err;
 	u32 phy_rev;
 
-	status = ice_read_phy_eth56g_raw_lp(hw, PHY_REG_REVISION, &phy_rev,
+	err = ice_read_phy_eth56g_raw_lp(hw, PHY_REG_REVISION, &phy_rev,
 					    true);
-	if (status)
-		return status;
+	if (err)
+		return err;
 
 	if (phy_rev == PHY_REVISION_ETH56G) {
 		hw->phy_cfg = ICE_PHY_ETH56G;
@@ -2416,16 +2404,16 @@ ice_read_phy_reg_e822_lp(struct ice_hw *hw, u8 port, u16 offset, u32 *val,
 			 bool lock_sbq)
 {
 	struct ice_sbq_msg_input msg = {0};
-	int status;
+	int err;
 
 	ice_fill_phy_msg_e822(&msg, port, offset);
 	msg.opcode = ice_sbq_msg_rd;
 
-	status = ice_sbq_rw_reg_lp(hw, &msg, lock_sbq);
-	if (status) {
-		ice_debug(hw, ICE_DBG_PTP, "Failed to send message to phy, status %d\n",
-			  status);
-		return status;
+	err = ice_sbq_rw_reg_lp(hw, &msg, lock_sbq);
+	if (err) {
+		ice_debug(hw, ICE_DBG_PTP, "Failed to send message to PHY, err %d\n",
+			  err);
+		return err;
 	}
 
 	*val = msg.data;
@@ -2454,9 +2442,9 @@ ice_read_phy_reg_e822(struct ice_hw *hw, u8 port, u16 offset, u32 *val)
 static int
 ice_read_40b_phy_reg_e822(struct ice_hw *hw, u8 port, u16 low_addr, u64 *val)
 {
-	int status;
 	u32 low, high;
 	u16 high_addr;
+	int err;
 
 	/* Only operate on registers known to be split into two 32bit
 	 * registers.
@@ -2467,18 +2455,18 @@ ice_read_40b_phy_reg_e822(struct ice_hw *hw, u8 port, u16 low_addr, u64 *val)
 		return ICE_ERR_PARAM;
 	}
 
-	status = ice_read_phy_reg_e822(hw, port, low_addr, &low);
-	if (status) {
-		ice_debug(hw, ICE_DBG_PTP, "Failed to read from low register 0x%08x\n, status %d",
-			  low_addr, status);
-		return status;
+	err = ice_read_phy_reg_e822(hw, port, low_addr, &low);
+	if (err) {
+		ice_debug(hw, ICE_DBG_PTP, "Failed to read from low register 0x%08x\n, err %d",
+			  low_addr, err);
+		return err;
 	}
 
-	status = ice_read_phy_reg_e822(hw, port, high_addr, &high);
-	if (status) {
-		ice_debug(hw, ICE_DBG_PTP, "Failed to read from high register 0x%08x\n, status %d",
-			  high_addr, status);
-		return status;
+	err = ice_read_phy_reg_e822(hw, port, high_addr, &high);
+	if (err) {
+		ice_debug(hw, ICE_DBG_PTP, "Failed to read from high register 0x%08x\n, err %d",
+			  high_addr, err);
+		return err;
 	}
 
 	*val = (u64)high << P_REG_40B_HIGH_S | (low & P_REG_40B_LOW_M);
@@ -2501,9 +2489,9 @@ ice_read_40b_phy_reg_e822(struct ice_hw *hw, u8 port, u16 low_addr, u64 *val)
 static int
 ice_read_64b_phy_reg_e822(struct ice_hw *hw, u8 port, u16 low_addr, u64 *val)
 {
-	int status;
 	u32 low, high;
 	u16 high_addr;
+	int err;
 
 	/* Only operate on registers known to be split into two 32bit
 	 * registers.
@@ -2514,18 +2502,18 @@ ice_read_64b_phy_reg_e822(struct ice_hw *hw, u8 port, u16 low_addr, u64 *val)
 		return ICE_ERR_PARAM;
 	}
 
-	status = ice_read_phy_reg_e822(hw, port, low_addr, &low);
-	if (status) {
-		ice_debug(hw, ICE_DBG_PTP, "Failed to read from low register 0x%08x\n, status %d",
-			  low_addr, status);
-		return status;
+	err = ice_read_phy_reg_e822(hw, port, low_addr, &low);
+	if (err) {
+		ice_debug(hw, ICE_DBG_PTP, "Failed to read from low register 0x%08x\n, err %d",
+			  low_addr, err);
+		return err;
 	}
 
-	status = ice_read_phy_reg_e822(hw, port, high_addr, &high);
-	if (status) {
-		ice_debug(hw, ICE_DBG_PTP, "Failed to read from high register 0x%08x\n, status %d",
-			  high_addr, status);
-		return status;
+	err = ice_read_phy_reg_e822(hw, port, high_addr, &high);
+	if (err) {
+		ice_debug(hw, ICE_DBG_PTP, "Failed to read from high register 0x%08x\n, err %d",
+			  high_addr, err);
+		return err;
 	}
 
 	*val = (u64)high << 32 | low;
@@ -2548,17 +2536,17 @@ ice_write_phy_reg_e822_lp(struct ice_hw *hw, u8 port, u16 offset, u32 val,
 			  bool lock_sbq)
 {
 	struct ice_sbq_msg_input msg = {0};
-	int status;
+	int err;
 
 	ice_fill_phy_msg_e822(&msg, port, offset);
 	msg.opcode = ice_sbq_msg_wr;
 	msg.data = val;
 
-	status = ice_sbq_rw_reg_lp(hw, &msg, lock_sbq);
-	if (status) {
-		ice_debug(hw, ICE_DBG_PTP, "Failed to send message to phy, status %d\n",
-			  status);
-		return status;
+	err = ice_sbq_rw_reg_lp(hw, &msg, lock_sbq);
+	if (err) {
+		ice_debug(hw, ICE_DBG_PTP, "Failed to send message to PHY, err %d\n",
+			  err);
+		return err;
 	}
 
 	return 0;
@@ -2583,9 +2571,9 @@ ice_write_phy_reg_e822(struct ice_hw *hw, u8 port, u16 offset, u32 val)
 static int
 ice_write_40b_phy_reg_e822(struct ice_hw *hw, u8 port, u16 low_addr, u64 val)
 {
-	int status;
 	u32 low, high;
 	u16 high_addr;
+	int err;
 
 	/* Only operate on registers known to be split into a lower 8 bit
 	 * register and an upper 32 bit register.
@@ -2599,18 +2587,18 @@ ice_write_40b_phy_reg_e822(struct ice_hw *hw, u8 port, u16 low_addr, u64 val)
 	low = (u32)(val & P_REG_40B_LOW_M);
 	high = (u32)(val >> P_REG_40B_HIGH_S);
 
-	status = ice_write_phy_reg_e822(hw, port, low_addr, low);
-	if (status) {
-		ice_debug(hw, ICE_DBG_PTP, "Failed to write to low register 0x%08x\n, status %d",
-			  low_addr, status);
-		return status;
+	err = ice_write_phy_reg_e822(hw, port, low_addr, low);
+	if (err) {
+		ice_debug(hw, ICE_DBG_PTP, "Failed to write to low register 0x%08x\n, err %d",
+			  low_addr, err);
+		return err;
 	}
 
-	status = ice_write_phy_reg_e822(hw, port, high_addr, high);
-	if (status) {
-		ice_debug(hw, ICE_DBG_PTP, "Failed to write to high register 0x%08x\n, status %d",
-			  high_addr, status);
-		return status;
+	err = ice_write_phy_reg_e822(hw, port, high_addr, high);
+	if (err) {
+		ice_debug(hw, ICE_DBG_PTP, "Failed to write to high register 0x%08x\n, err %d",
+			  high_addr, err);
+		return err;
 	}
 
 	return 0;
@@ -2631,9 +2619,9 @@ ice_write_40b_phy_reg_e822(struct ice_hw *hw, u8 port, u16 low_addr, u64 val)
 static int
 ice_write_64b_phy_reg_e822(struct ice_hw *hw, u8 port, u16 low_addr, u64 val)
 {
-	int status;
 	u32 low, high;
 	u16 high_addr;
+	int err;
 
 	/* Only operate on registers known to be split into two 32bit
 	 * registers.
@@ -2647,18 +2635,18 @@ ice_write_64b_phy_reg_e822(struct ice_hw *hw, u8 port, u16 low_addr, u64 val)
 	low = ICE_LO_DWORD(val);
 	high = ICE_HI_DWORD(val);
 
-	status = ice_write_phy_reg_e822(hw, port, low_addr, low);
-	if (status) {
-		ice_debug(hw, ICE_DBG_PTP, "Failed to write to low register 0x%08x\n, status %d",
-			  low_addr, status);
-		return status;
+	err = ice_write_phy_reg_e822(hw, port, low_addr, low);
+	if (err) {
+		ice_debug(hw, ICE_DBG_PTP, "Failed to write to low register 0x%08x\n, err %d",
+			  low_addr, err);
+		return err;
 	}
 
-	status = ice_write_phy_reg_e822(hw, port, high_addr, high);
-	if (status) {
-		ice_debug(hw, ICE_DBG_PTP, "Failed to write to high register 0x%08x\n, status %d",
-			  high_addr, status);
-		return status;
+	err = ice_write_phy_reg_e822(hw, port, high_addr, high);
+	if (err) {
+		ice_debug(hw, ICE_DBG_PTP, "Failed to write to high register 0x%08x\n, err %d",
+			  high_addr, err);
+		return err;
 	}
 
 	return 0;
@@ -2710,23 +2698,24 @@ ice_read_quad_reg_e822_lp(struct ice_hw *hw, u8 quad, u16 offset, u32 *val,
 			  bool lock_sbq)
 {
 	struct ice_sbq_msg_input msg = {0};
-	int status;
+	int err;
 
-	status = ice_fill_quad_msg_e822(&msg, quad, offset);
-	if (status)
-		goto exit_err;
+	err = ice_fill_quad_msg_e822(&msg, quad, offset);
+	if (err)
+		return err;
 
 	msg.opcode = ice_sbq_msg_rd;
 
-	status = ice_sbq_rw_reg_lp(hw, &msg, lock_sbq);
-exit_err:
-	if (status)
-		ice_debug(hw, ICE_DBG_PTP, "Failed to send message to phy, status %d\n",
-			  status);
-	else
-		*val = msg.data;
+	err = ice_sbq_rw_reg_lp(hw, &msg, lock_sbq);
+	if (err) {
+		ice_debug(hw, ICE_DBG_PTP, "Failed to send message to PHY, err %d\n",
+			  err);
+		return err;
+	}
 
-	return ICE_SUCCESS;
+	*val = msg.data;
+
+	return 0;
 }
 
 int
@@ -2751,22 +2740,23 @@ ice_write_quad_reg_e822_lp(struct ice_hw *hw, u8 quad, u16 offset, u32 val,
 			   bool lock_sbq)
 {
 	struct ice_sbq_msg_input msg = {0};
-	int status;
+	int err;
 
-	status = ice_fill_quad_msg_e822(&msg, quad, offset);
-	if (status)
-		goto exit_err;
+	err = ice_fill_quad_msg_e822(&msg, quad, offset);
+	if (err)
+		return err;
 
 	msg.opcode = ice_sbq_msg_wr;
 	msg.data = val;
 
-	status = ice_sbq_rw_reg_lp(hw, &msg, lock_sbq);
-exit_err:
-	if (status)
-		ice_debug(hw, ICE_DBG_PTP, "Failed to send message to phy, status %d\n",
-			  status);
+	err = ice_sbq_rw_reg_lp(hw, &msg, lock_sbq);
+	if (err) {
+		ice_debug(hw, ICE_DBG_PTP, "Failed to send message to PHY, err %d\n",
+			  err);
+		return err;
+	}
 
-	return ICE_SUCCESS;
+	return 0;
 }
 
 int
@@ -2789,25 +2779,25 @@ ice_write_quad_reg_e822(struct ice_hw *hw, u8 quad, u16 offset, u32 val)
 static int
 ice_read_phy_tstamp_e822(struct ice_hw *hw, u8 quad, u8 idx, u64 *tstamp)
 {
-	int status;
 	u16 lo_addr, hi_addr;
 	u32 lo, hi;
+	int err;
 
 	lo_addr = (u16)TS_L(Q_REG_TX_MEMORY_BANK_START, idx);
 	hi_addr = (u16)TS_H(Q_REG_TX_MEMORY_BANK_START, idx);
 
-	status = ice_read_quad_reg_e822(hw, quad, lo_addr, &lo);
-	if (status) {
-		ice_debug(hw, ICE_DBG_PTP, "Failed to read low PTP timestamp register, status %d\n",
-			  status);
-		return status;
+	err = ice_read_quad_reg_e822(hw, quad, lo_addr, &lo);
+	if (err) {
+		ice_debug(hw, ICE_DBG_PTP, "Failed to read low PTP timestamp register, err %d\n",
+			  err);
+		return err;
 	}
 
-	status = ice_read_quad_reg_e822(hw, quad, hi_addr, &hi);
-	if (status) {
-		ice_debug(hw, ICE_DBG_PTP, "Failed to read high PTP timestamp register, status %d\n",
-			  status);
-		return status;
+	err = ice_read_quad_reg_e822(hw, quad, hi_addr, &hi);
+	if (err) {
+		ice_debug(hw, ICE_DBG_PTP, "Failed to read high PTP timestamp register, err %d\n",
+			  err);
+		return err;
 	}
 
 	/* For E822 based internal PHYs, the timestamp is reported with the
@@ -2844,24 +2834,24 @@ ice_read_phy_tstamp_e822(struct ice_hw *hw, u8 quad, u8 idx, u64 *tstamp)
 static int
 ice_clear_phy_tstamp_e822(struct ice_hw *hw, u8 quad, u8 idx)
 {
-	int status;
+	int err;
 	u16 lo_addr, hi_addr;
 
 	lo_addr = (u16)TS_L(Q_REG_TX_MEMORY_BANK_START, idx);
 	hi_addr = (u16)TS_H(Q_REG_TX_MEMORY_BANK_START, idx);
 
-	status = ice_write_quad_reg_e822(hw, quad, lo_addr, 0);
-	if (status) {
-		ice_debug(hw, ICE_DBG_PTP, "Failed to clear low PTP timestamp register, status %d\n",
-			  status);
-		return status;
+	err = ice_write_quad_reg_e822(hw, quad, lo_addr, 0);
+	if (err) {
+		ice_debug(hw, ICE_DBG_PTP, "Failed to clear low PTP timestamp register, err %d\n",
+			  err);
+		return err;
 	}
 
-	status = ice_write_quad_reg_e822(hw, quad, hi_addr, 0);
-	if (status) {
-		ice_debug(hw, ICE_DBG_PTP, "Failed to clear high PTP timestamp register, status %d\n",
-			  status);
-		return status;
+	err = ice_write_quad_reg_e822(hw, quad, hi_addr, 0);
+	if (err) {
+		ice_debug(hw, ICE_DBG_PTP, "Failed to clear high PTP timestamp register, err %d\n",
+			  err);
+		return err;
 	}
 
 	return 0;
@@ -2878,14 +2868,14 @@ int ice_ptp_set_vernier_wl(struct ice_hw *hw)
 	u8 port;
 
 	for (port = 0; port < ICE_NUM_EXTERNAL_PORTS; port++) {
-		int status;
+		int err;
 
-		status = ice_write_phy_reg_e822_lp(hw, port, P_REG_WL,
-						   PTP_VERNIER_WL, true);
-		if (status) {
-			ice_debug(hw, ICE_DBG_PTP, "Failed to set vernier window length for port %u, status %d\n",
-				  port, status);
-			return status;
+		err = ice_write_phy_reg_e822_lp(hw, port, P_REG_WL,
+						PTP_VERNIER_WL, true);
+		if (err) {
+			ice_debug(hw, ICE_DBG_PTP, "Failed to set vernier window length for port %u, err %d\n",
+				  port, err);
+			return err;
 		}
 	}
 
@@ -2900,7 +2890,7 @@ int ice_ptp_set_vernier_wl(struct ice_hw *hw)
  */
 static int ice_ptp_init_phc_e822(struct ice_hw *hw)
 {
-	int status;
+	int err;
 	u32 regval;
 
 	/* Enable reading switch and PHY registers over the sideband queue */
@@ -2912,9 +2902,9 @@ static int ice_ptp_init_phc_e822(struct ice_hw *hw)
 	wr32(hw, PF_SB_REM_DEV_CTL, regval);
 
 	/* Initialize the Clock Generation Unit */
-	status = ice_init_cgu_e82x(hw);
-	if (status)
-		return status;
+	err = ice_init_cgu_e82x(hw);
+	if (err)
+		return err;
 
 	/* Set window length for all the ports */
 	return ice_ptp_set_vernier_wl(hw);
@@ -2933,8 +2923,8 @@ static int ice_ptp_init_phc_e822(struct ice_hw *hw)
 static int
 ice_ptp_prep_phy_time_e822(struct ice_hw *hw, u32 time)
 {
-	int status;
 	u64 phy_time;
+	int err;
 	u8 port;
 
 	/* The time represents the upper 32 bits of the PHY timer, so we need
@@ -2945,27 +2935,27 @@ ice_ptp_prep_phy_time_e822(struct ice_hw *hw, u32 time)
 	for (port = 0; port < ICE_NUM_EXTERNAL_PORTS; port++) {
 
 		/* Tx case */
-		status = ice_write_64b_phy_reg_e822(hw, port,
-						    P_REG_TX_TIMER_INC_PRE_L,
-						    phy_time);
-		if (status)
+		err = ice_write_64b_phy_reg_e822(hw, port,
+						 P_REG_TX_TIMER_INC_PRE_L,
+						 phy_time);
+		if (err)
 			goto exit_err;
 
 		/* Rx case */
-		status = ice_write_64b_phy_reg_e822(hw, port,
-						    P_REG_RX_TIMER_INC_PRE_L,
-						    phy_time);
-		if (status)
+		err = ice_write_64b_phy_reg_e822(hw, port,
+						 P_REG_RX_TIMER_INC_PRE_L,
+						 phy_time);
+		if (err)
 			goto exit_err;
 	}
 
 	return 0;
 
 exit_err:
-	ice_debug(hw, ICE_DBG_PTP, "Failed to write init time for port %u, status %d\n",
-		  port, status);
+	ice_debug(hw, ICE_DBG_PTP, "Failed to write init time for port %u, err %d\n",
+		  port, err);
 
-	return status;
+	return err;
 }
 
 /**
@@ -2989,40 +2979,40 @@ int
 ice_ptp_prep_port_adj_e822(struct ice_hw *hw, u8 port, s64 time,
 			   bool lock_sbq)
 {
-	int status;
 	u32 l_time, u_time;
+	int err;
 
 	l_time = ICE_LO_DWORD(time);
 	u_time = ICE_HI_DWORD(time);
 
 	/* Tx case */
-	status = ice_write_phy_reg_e822_lp(hw, port, P_REG_TX_TIMER_INC_PRE_L,
-					   l_time, lock_sbq);
-	if (status)
+	err = ice_write_phy_reg_e822_lp(hw, port, P_REG_TX_TIMER_INC_PRE_L,
+					l_time, lock_sbq);
+	if (err)
 		goto exit_err;
 
-	status = ice_write_phy_reg_e822_lp(hw, port, P_REG_TX_TIMER_INC_PRE_U,
-					   u_time, lock_sbq);
-	if (status)
+	err = ice_write_phy_reg_e822_lp(hw, port, P_REG_TX_TIMER_INC_PRE_U,
+					u_time, lock_sbq);
+	if (err)
 		goto exit_err;
 
 	/* Rx case */
-	status = ice_write_phy_reg_e822_lp(hw, port, P_REG_RX_TIMER_INC_PRE_L,
-					   l_time, lock_sbq);
-	if (status)
+	err = ice_write_phy_reg_e822_lp(hw, port, P_REG_RX_TIMER_INC_PRE_L,
+					l_time, lock_sbq);
+	if (err)
 		goto exit_err;
 
-	status = ice_write_phy_reg_e822_lp(hw, port, P_REG_RX_TIMER_INC_PRE_U,
-					   u_time, lock_sbq);
-	if (status)
+	err = ice_write_phy_reg_e822_lp(hw, port, P_REG_RX_TIMER_INC_PRE_U,
+					u_time, lock_sbq);
+	if (err)
 		goto exit_err;
 
 	return 0;
 
 exit_err:
-	ice_debug(hw, ICE_DBG_PTP, "Failed to write time adjust for port %u, status %d\n",
-		  port, status);
-	return status;
+	ice_debug(hw, ICE_DBG_PTP, "Failed to write time adjust for port %u, err %d\n",
+		  port, err);
+	return err;
 }
 
 /**
@@ -3052,12 +3042,11 @@ ice_ptp_prep_phy_adj_e822(struct ice_hw *hw, s32 adj, bool lock_sbq)
 		cycles = -(((s64)-adj) << 32);
 
 	for (port = 0; port < ICE_NUM_EXTERNAL_PORTS; port++) {
-		int status;
+		int err;
 
-		status = ice_ptp_prep_port_adj_e822(hw, port, cycles,
-						    lock_sbq);
-		if (status)
-			return status;
+		err = ice_ptp_prep_port_adj_e822(hw, port, cycles, lock_sbq);
+		if (err)
+			return err;
 	}
 
 	return 0;
@@ -3075,23 +3064,23 @@ ice_ptp_prep_phy_adj_e822(struct ice_hw *hw, s32 adj, bool lock_sbq)
 static int
 ice_ptp_prep_phy_incval_e822(struct ice_hw *hw, u64 incval)
 {
-	int status;
+	int err;
 	u8 port;
 
 	for (port = 0; port < ICE_NUM_EXTERNAL_PORTS; port++) {
-		status = ice_write_40b_phy_reg_e822(hw, port, P_REG_TIMETUS_L,
-						    incval);
-		if (status)
+		err = ice_write_40b_phy_reg_e822(hw, port, P_REG_TIMETUS_L,
+						 incval);
+		if (err)
 			goto exit_err;
 	}
 
 	return 0;
 
 exit_err:
-	ice_debug(hw, ICE_DBG_PTP, "Failed to write incval for port %u, status %d\n",
-		  port, status);
+	ice_debug(hw, ICE_DBG_PTP, "Failed to write incval for port %u, err %d\n",
+		  port, err);
 
-	return status;
+	return err;
 }
 
 /**
@@ -3105,13 +3094,13 @@ ice_ptp_prep_phy_incval_e822(struct ice_hw *hw, u64 incval)
 int
 ice_ptp_read_phy_incval_e822(struct ice_hw *hw, u8 port, u64 *incval)
 {
-	int status;
+	int err;
 
-	status = ice_read_40b_phy_reg_e822(hw, port, P_REG_TIMETUS_L, incval);
-	if (status) {
-		ice_debug(hw, ICE_DBG_PTP, "Failed to read TIMETUS_L, status %d\n",
-			  status);
-		return status;
+	err = ice_read_40b_phy_reg_e822(hw, port, P_REG_TIMETUS_L, incval);
+	if (err) {
+		ice_debug(hw, ICE_DBG_PTP, "Failed to read TIMETUS_L, err %d\n",
+			  err);
+		return err;
 	}
 
 	ice_debug(hw, ICE_DBG_PTP, "read INCVAL = 0x%016llx\n",
@@ -3136,47 +3125,47 @@ ice_ptp_read_phy_incval_e822(struct ice_hw *hw, u8 port, u64 *incval)
 static int
 ice_ptp_prep_phy_adj_target_e822(struct ice_hw *hw, u32 target_time)
 {
-	int status;
+	int err;
 	u8 port;
 
 	for (port = 0; port < ICE_NUM_EXTERNAL_PORTS; port++) {
 
 		/* Tx case */
 		/* No sub-nanoseconds data */
-		status = ice_write_phy_reg_e822_lp(hw, port,
-						   P_REG_TX_TIMER_CNT_ADJ_L,
-						   0, true);
-		if (status)
+		err = ice_write_phy_reg_e822_lp(hw, port,
+						P_REG_TX_TIMER_CNT_ADJ_L,
+						0, true);
+		if (err)
 			goto exit_err;
 
-		status = ice_write_phy_reg_e822_lp(hw, port,
-						   P_REG_TX_TIMER_CNT_ADJ_U,
-						   target_time, true);
-		if (status)
+		err = ice_write_phy_reg_e822_lp(hw, port,
+						P_REG_TX_TIMER_CNT_ADJ_U,
+						target_time, true);
+		if (err)
 			goto exit_err;
 
 		/* Rx case */
 		/* No sub-nanoseconds data */
-		status = ice_write_phy_reg_e822_lp(hw, port,
-						   P_REG_RX_TIMER_CNT_ADJ_L,
-						   0, true);
-		if (status)
+		err = ice_write_phy_reg_e822_lp(hw, port,
+						P_REG_RX_TIMER_CNT_ADJ_L,
+						0, true);
+		if (err)
 			goto exit_err;
 
-		status = ice_write_phy_reg_e822_lp(hw, port,
-						   P_REG_RX_TIMER_CNT_ADJ_U,
-						   target_time, true);
-		if (status)
+		err = ice_write_phy_reg_e822_lp(hw, port,
+						P_REG_RX_TIMER_CNT_ADJ_U,
+						target_time, true);
+		if (err)
 			goto exit_err;
 	}
 
 	return 0;
 
 exit_err:
-	ice_debug(hw, ICE_DBG_PTP, "Failed to write target time for port %u, status %d\n",
-		  port, status);
+	ice_debug(hw, ICE_DBG_PTP, "Failed to write target time for port %u, err %d\n",
+		  port, err);
 
-	return status;
+	return err;
 }
 
 /**
@@ -3194,25 +3183,25 @@ int
 ice_ptp_read_port_capture_e822(struct ice_hw *hw, u8 port, u64 *tx_ts,
 			       u64 *rx_ts)
 {
-	int status;
+	int err;
 
 	/* Tx case */
-	status = ice_read_64b_phy_reg_e822(hw, port, P_REG_TX_CAPTURE_L, tx_ts);
-	if (status) {
-		ice_debug(hw, ICE_DBG_PTP, "Failed to read REG_TX_CAPTURE, status %d\n",
-			  status);
-		return status;
+	err = ice_read_64b_phy_reg_e822(hw, port, P_REG_TX_CAPTURE_L, tx_ts);
+	if (err) {
+		ice_debug(hw, ICE_DBG_PTP, "Failed to read REG_TX_CAPTURE, err %d\n",
+			  err);
+		return err;
 	}
 
 	ice_debug(hw, ICE_DBG_PTP, "tx_init = 0x%016llx\n",
 		  (unsigned long long)*tx_ts);
 
 	/* Rx case */
-	status = ice_read_64b_phy_reg_e822(hw, port, P_REG_RX_CAPTURE_L, rx_ts);
-	if (status) {
-		ice_debug(hw, ICE_DBG_PTP, "Failed to read RX_CAPTURE, status %d\n",
-			  status);
-		return status;
+	err = ice_read_64b_phy_reg_e822(hw, port, P_REG_RX_CAPTURE_L, rx_ts);
+	if (err) {
+		ice_debug(hw, ICE_DBG_PTP, "Failed to read RX_CAPTURE, err %d\n",
+			  err);
+		return err;
 	}
 
 	ice_debug(hw, ICE_DBG_PTP, "rx_init = 0x%016llx\n",
@@ -3238,24 +3227,24 @@ ice_ptp_write_port_cmd_e822(struct ice_hw *hw, u8 port,
 			    enum ice_ptp_tmr_cmd cmd, bool lock_sbq)
 {
 	u32 val = ice_ptp_tmr_cmd_to_port_reg(hw, cmd);
-	int status;
+	int err;
 
 	/* Tx case */
-	status = ice_write_phy_reg_e822_lp(hw, port, P_REG_TX_TMR_CMD, val,
-					   lock_sbq);
-	if (status) {
-		ice_debug(hw, ICE_DBG_PTP, "Failed to write back TX_TMR_CMD, status %d\n",
-			  status);
-		return status;
+	err = ice_write_phy_reg_e822_lp(hw, port, P_REG_TX_TMR_CMD, val,
+					lock_sbq);
+	if (err) {
+		ice_debug(hw, ICE_DBG_PTP, "Failed to write back TX_TMR_CMD, err %d\n",
+			  err);
+		return err;
 	}
 
 	/* Rx case */
-	status = ice_write_phy_reg_e822_lp(hw, port, P_REG_RX_TMR_CMD, val,
-					   lock_sbq);
-	if (status) {
-		ice_debug(hw, ICE_DBG_PTP, "Failed to write back RX_TMR_CMD, status %d\n",
-			  status);
-		return status;
+	err = ice_write_phy_reg_e822_lp(hw, port, P_REG_RX_TMR_CMD, val,
+					lock_sbq);
+	if (err) {
+		ice_debug(hw, ICE_DBG_PTP, "Failed to write back RX_TMR_CMD, err %d\n",
+			  err);
+		return err;
 	}
 
 	return 0;
@@ -3285,13 +3274,13 @@ ice_phy_get_speed_and_fec_e822(struct ice_hw *hw, u8 port,
 {
 	enum ice_ptp_link_spd link;
 	enum ice_ptp_fec_mode fec;
-	int status;
 	u32 serdes;
+	int err;
 
-	status = ice_read_phy_reg_e822(hw, port, P_REG_LINK_SPEED, &serdes);
-	if (status) {
+	err = ice_read_phy_reg_e822(hw, port, P_REG_LINK_SPEED, &serdes);
+	if (err) {
 		ice_debug(hw, ICE_DBG_PTP, "Failed to read serdes info\n");
-		return status;
+		return err;
 	}
 
 	/* Determine the FEC algorithm */
@@ -3352,23 +3341,23 @@ ice_phy_get_speed_and_fec_e822(struct ice_hw *hw, u8 port,
 void ice_phy_cfg_lane_e822(struct ice_hw *hw, u8 port)
 {
 	enum ice_ptp_link_spd link_spd;
-	int status;
+	int err;
 	u32 val;
 	u8 quad;
 
-	status = ice_phy_get_speed_and_fec_e822(hw, port, &link_spd, NULL);
-	if (status) {
-		ice_debug(hw, ICE_DBG_PTP, "Failed to get PHY link speed, status %d\n",
-			  status);
+	err = ice_phy_get_speed_and_fec_e822(hw, port, &link_spd, NULL);
+	if (err) {
+		ice_debug(hw, ICE_DBG_PTP, "Failed to get PHY link speed, err %d\n",
+			  err);
 		return;
 	}
 
 	quad = port / ICE_PORTS_PER_QUAD;
 
-	status = ice_read_quad_reg_e822(hw, quad, Q_REG_TX_MEM_GBL_CFG, &val);
-	if (status) {
-		ice_debug(hw, ICE_DBG_PTP, "Failed to read TX_MEM_GLB_CFG, status %d\n",
-			  status);
+	err = ice_read_quad_reg_e822(hw, quad, Q_REG_TX_MEM_GBL_CFG, &val);
+	if (err) {
+		ice_debug(hw, ICE_DBG_PTP, "Failed to read TX_MEM_GLB_CFG, err %d\n",
+			  err);
 		return;
 	}
 
@@ -3377,10 +3366,10 @@ void ice_phy_cfg_lane_e822(struct ice_hw *hw, u8 port)
 	else
 		val |= Q_REG_TX_MEM_GBL_CFG_LANE_TYPE_M;
 
-	status = ice_write_quad_reg_e822(hw, quad, Q_REG_TX_MEM_GBL_CFG, val);
-	if (status) {
-		ice_debug(hw, ICE_DBG_PTP, "Failed to write back TX_MEM_GBL_CFG, status %d\n",
-			  status);
+	err = ice_write_quad_reg_e822(hw, quad, Q_REG_TX_MEM_GBL_CFG, val);
+	if (err) {
+		ice_debug(hw, ICE_DBG_PTP, "Failed to write back TX_MEM_GBL_CFG, err %d\n",
+			  err);
 		return;
 	}
 }
@@ -3434,7 +3423,7 @@ void ice_phy_cfg_lane_e822(struct ice_hw *hw, u8 port)
 static int ice_phy_cfg_uix_e822(struct ice_hw *hw, u8 port)
 {
 	u64 cur_freq, clk_incval, tu_per_sec, uix;
-	int status;
+	int err;
 
 	cur_freq = ice_e822_pll_freq(ice_e822_time_ref(hw));
 	clk_incval = ice_ptp_read_src_incval(hw);
@@ -3448,23 +3437,23 @@ static int ice_phy_cfg_uix_e822(struct ice_hw *hw, u8 port)
 	/* Program the 10Gb/40Gb conversion ratio */
 	uix = DIV_U64(tu_per_sec * LINE_UI_10G_40G, 390625000);
 
-	status = ice_write_64b_phy_reg_e822(hw, port, P_REG_UIX66_10G_40G_L,
-					    uix);
-	if (status) {
-		ice_debug(hw, ICE_DBG_PTP, "Failed to write UIX66_10G_40G, status %d\n",
-			  status);
-		return status;
+	err = ice_write_64b_phy_reg_e822(hw, port, P_REG_UIX66_10G_40G_L,
+					 uix);
+	if (err) {
+		ice_debug(hw, ICE_DBG_PTP, "Failed to write UIX66_10G_40G, err %d\n",
+			  err);
+		return err;
 	}
 
 	/* Program the 25Gb/100Gb conversion ratio */
 	uix = DIV_U64(tu_per_sec * LINE_UI_25G_100G, 390625000);
 
-	status = ice_write_64b_phy_reg_e822(hw, port, P_REG_UIX66_25G_100G_L,
-					    uix);
-	if (status) {
-		ice_debug(hw, ICE_DBG_PTP, "Failed to write UIX66_25G_100G, status %d\n",
-			  status);
-		return status;
+	err = ice_write_64b_phy_reg_e822(hw, port, P_REG_UIX66_25G_100G_L,
+					 uix);
+	if (err) {
+		ice_debug(hw, ICE_DBG_PTP, "Failed to write UIX66_25G_100G, err %d\n",
+			  err);
+		return err;
 	}
 
 	return 0;
@@ -3518,11 +3507,11 @@ static int ice_phy_cfg_parpcs_e822(struct ice_hw *hw, u8 port)
 	u64 cur_freq, clk_incval, tu_per_sec, phy_tus;
 	enum ice_ptp_link_spd link_spd;
 	enum ice_ptp_fec_mode fec_mode;
-	int status;
+	int err;
 
-	status = ice_phy_get_speed_and_fec_e822(hw, port, &link_spd, &fec_mode);
-	if (status)
-		return status;
+	err = ice_phy_get_speed_and_fec_e822(hw, port, &link_spd, &fec_mode);
+	if (err)
+		return err;
 
 	cur_freq = ice_e822_pll_freq(ice_e822_time_ref(hw));
 	clk_incval = ice_ptp_read_src_incval(hw);
@@ -3544,10 +3533,10 @@ static int ice_phy_cfg_parpcs_e822(struct ice_hw *hw, u8 port)
 	else
 		phy_tus = 0;
 
-	status = ice_write_40b_phy_reg_e822(hw, port, P_REG_PAR_TX_TUS_L,
-					    phy_tus);
-	if (status)
-		return status;
+	err = ice_write_40b_phy_reg_e822(hw, port, P_REG_PAR_TX_TUS_L,
+					 phy_tus);
+	if (err)
+		return err;
 
 	/* P_REG_PAR_RX_TUS */
 	if (e822_vernier[link_spd].rx_par_clk)
@@ -3556,10 +3545,10 @@ static int ice_phy_cfg_parpcs_e822(struct ice_hw *hw, u8 port)
 	else
 		phy_tus = 0;
 
-	status = ice_write_40b_phy_reg_e822(hw, port, P_REG_PAR_RX_TUS_L,
-					    phy_tus);
-	if (status)
-		return status;
+	err = ice_write_40b_phy_reg_e822(hw, port, P_REG_PAR_RX_TUS_L,
+					 phy_tus);
+	if (err)
+		return err;
 
 	/* P_REG_PCS_TX_TUS */
 	if (e822_vernier[link_spd].tx_pcs_clk)
@@ -3568,10 +3557,10 @@ static int ice_phy_cfg_parpcs_e822(struct ice_hw *hw, u8 port)
 	else
 		phy_tus = 0;
 
-	status = ice_write_40b_phy_reg_e822(hw, port, P_REG_PCS_TX_TUS_L,
-					    phy_tus);
-	if (status)
-		return status;
+	err = ice_write_40b_phy_reg_e822(hw, port, P_REG_PCS_TX_TUS_L,
+					 phy_tus);
+	if (err)
+		return err;
 
 	/* P_REG_PCS_RX_TUS */
 	if (e822_vernier[link_spd].rx_pcs_clk)
@@ -3580,10 +3569,10 @@ static int ice_phy_cfg_parpcs_e822(struct ice_hw *hw, u8 port)
 	else
 		phy_tus = 0;
 
-	status = ice_write_40b_phy_reg_e822(hw, port, P_REG_PCS_RX_TUS_L,
-					    phy_tus);
-	if (status)
-		return status;
+	err = ice_write_40b_phy_reg_e822(hw, port, P_REG_PCS_RX_TUS_L,
+					 phy_tus);
+	if (err)
+		return err;
 
 	/* P_REG_DESK_PAR_TX_TUS */
 	if (e822_vernier[link_spd].tx_desk_rsgb_par)
@@ -3592,10 +3581,10 @@ static int ice_phy_cfg_parpcs_e822(struct ice_hw *hw, u8 port)
 	else
 		phy_tus = 0;
 
-	status = ice_write_40b_phy_reg_e822(hw, port, P_REG_DESK_PAR_TX_TUS_L,
-					    phy_tus);
-	if (status)
-		return status;
+	err = ice_write_40b_phy_reg_e822(hw, port, P_REG_DESK_PAR_TX_TUS_L,
+					 phy_tus);
+	if (err)
+		return err;
 
 	/* P_REG_DESK_PAR_RX_TUS */
 	if (e822_vernier[link_spd].rx_desk_rsgb_par)
@@ -3604,10 +3593,10 @@ static int ice_phy_cfg_parpcs_e822(struct ice_hw *hw, u8 port)
 	else
 		phy_tus = 0;
 
-	status = ice_write_40b_phy_reg_e822(hw, port, P_REG_DESK_PAR_RX_TUS_L,
-					    phy_tus);
-	if (status)
-		return status;
+	err = ice_write_40b_phy_reg_e822(hw, port, P_REG_DESK_PAR_RX_TUS_L,
+					 phy_tus);
+	if (err)
+		return err;
 
 	/* P_REG_DESK_PCS_TX_TUS */
 	if (e822_vernier[link_spd].tx_desk_rsgb_pcs)
@@ -3616,10 +3605,10 @@ static int ice_phy_cfg_parpcs_e822(struct ice_hw *hw, u8 port)
 	else
 		phy_tus = 0;
 
-	status = ice_write_40b_phy_reg_e822(hw, port, P_REG_DESK_PCS_TX_TUS_L,
-					    phy_tus);
-	if (status)
-		return status;
+	err = ice_write_40b_phy_reg_e822(hw, port, P_REG_DESK_PCS_TX_TUS_L,
+					 phy_tus);
+	if (err)
+		return err;
 
 	/* P_REG_DESK_PCS_RX_TUS */
 	if (e822_vernier[link_spd].rx_desk_rsgb_pcs)
@@ -3685,12 +3674,12 @@ int ice_phy_cfg_tx_offset_e822(struct ice_hw *hw, u8 port)
 {
 	enum ice_ptp_link_spd link_spd;
 	enum ice_ptp_fec_mode fec_mode;
-	int status;
 	u64 total_offset, val;
+	int err;
 
-	status = ice_phy_get_speed_and_fec_e822(hw, port, &link_spd, &fec_mode);
-	if (status)
-		return status;
+	err = ice_phy_get_speed_and_fec_e822(hw, port, &link_spd, &fec_mode);
+	if (err)
+		return err;
 
 	total_offset = ice_calc_fixed_tx_offset_e822(hw, link_spd);
 
@@ -3703,11 +3692,11 @@ int ice_phy_cfg_tx_offset_e822(struct ice_hw *hw, u8 port)
 	    link_spd == ICE_PTP_LNK_SPD_25G_RS ||
 	    link_spd == ICE_PTP_LNK_SPD_40G ||
 	    link_spd == ICE_PTP_LNK_SPD_50G) {
-		status = ice_read_64b_phy_reg_e822(hw, port,
-						   P_REG_PAR_PCS_TX_OFFSET_L,
-						   &val);
-		if (status)
-			return status;
+		err = ice_read_64b_phy_reg_e822(hw, port,
+						P_REG_PAR_PCS_TX_OFFSET_L,
+						&val);
+		if (err)
+			return err;
 
 		total_offset += val;
 	}
@@ -3718,11 +3707,10 @@ int ice_phy_cfg_tx_offset_e822(struct ice_hw *hw, u8 port)
 	 */
 	if (link_spd == ICE_PTP_LNK_SPD_50G_RS ||
 	    link_spd == ICE_PTP_LNK_SPD_100G_RS) {
-		status = ice_read_64b_phy_reg_e822(hw, port,
-						   P_REG_PAR_TX_TIME_L,
-						   &val);
-		if (status)
-			return status;
+		err = ice_read_64b_phy_reg_e822(hw, port, P_REG_PAR_TX_TIME_L,
+						&val);
+		if (err)
+			return err;
 
 		total_offset += val;
 	}
@@ -3731,14 +3719,14 @@ int ice_phy_cfg_tx_offset_e822(struct ice_hw *hw, u8 port)
 	 * PHY and indicate that the Tx offset is ready. After this,
 	 * timestamps will be enabled.
 	 */
-	status = ice_write_64b_phy_reg_e822(hw, port, P_REG_TOTAL_TX_OFFSET_L,
-					    total_offset);
-	if (status)
-		return status;
+	err = ice_write_64b_phy_reg_e822(hw, port, P_REG_TOTAL_TX_OFFSET_L,
+					 total_offset);
+	if (err)
+		return err;
 
-	status = ice_write_phy_reg_e822(hw, port, P_REG_TX_OR, 1);
-	if (status)
-		return status;
+	err = ice_write_phy_reg_e822(hw, port, P_REG_TX_OR, 1);
+	if (err)
+		return err;
 
 	return 0;
 }
@@ -3756,12 +3744,12 @@ ice_phy_cfg_fixed_tx_offset_e822(struct ice_hw *hw, u8 port)
 {
 	enum ice_ptp_link_spd link_spd;
 	enum ice_ptp_fec_mode fec_mode;
-	int status;
+	int err;
 	u64 total_offset;
 
-	status = ice_phy_get_speed_and_fec_e822(hw, port, &link_spd, &fec_mode);
-	if (status)
-		return status;
+	err = ice_phy_get_speed_and_fec_e822(hw, port, &link_spd, &fec_mode);
+	if (err)
+		return err;
 
 	total_offset = ice_calc_fixed_tx_offset_e822(hw, link_spd);
 
@@ -3772,14 +3760,14 @@ ice_phy_cfg_fixed_tx_offset_e822(struct ice_hw *hw, u8 port)
 	 * Note that this skips including the more precise offsets generated
 	 * by the Vernier calibration.
 	 */
-	status = ice_write_64b_phy_reg_e822(hw, port, P_REG_TOTAL_TX_OFFSET_L,
+	err = ice_write_64b_phy_reg_e822(hw, port, P_REG_TOTAL_TX_OFFSET_L,
 					    total_offset);
-	if (status)
-		return status;
+	if (err)
+		return err;
 
-	status = ice_write_phy_reg_e822(hw, port, P_REG_TX_OR, 1);
-	if (status)
-		return status;
+	err = ice_write_phy_reg_e822(hw, port, P_REG_TX_OR, 1);
+	if (err)
+		return err;
 
 	return 0;
 }
@@ -3803,14 +3791,14 @@ ice_phy_calc_pmd_adj_e822(struct ice_hw *hw, u8 port,
 {
 	u64 cur_freq, clk_incval, tu_per_sec, mult, adj;
 	u32 pmd_adj_divisor, val;
-	int status;
+	int err;
 	u8 pmd_align;
 
-	status = ice_read_phy_reg_e822(hw, port, P_REG_PMD_ALIGNMENT, &val);
-	if (status) {
-		ice_debug(hw, ICE_DBG_PTP, "Failed to read PMD alignment, status %d\n",
-			  status);
-		return status;
+	err = ice_read_phy_reg_e822(hw, port, P_REG_PMD_ALIGNMENT, &val);
+	if (err) {
+		ice_debug(hw, ICE_DBG_PTP, "Failed to read PMD alignment, err %d\n",
+			  err);
+		return err;
 	}
 
 	pmd_align = (u8)val;
@@ -3897,12 +3885,12 @@ ice_phy_calc_pmd_adj_e822(struct ice_hw *hw, u8 port,
 		u64 cycle_adj;
 		u8 rx_cycle;
 
-		status = ice_read_phy_reg_e822(hw, port, P_REG_RX_40_TO_160_CNT,
-					       &val);
-		if (status) {
-			ice_debug(hw, ICE_DBG_PTP, "Failed to read 25G-RS Rx cycle count, status %d\n",
-				  status);
-			return status;
+		err = ice_read_phy_reg_e822(hw, port, P_REG_RX_40_TO_160_CNT,
+					    &val);
+		if (err) {
+			ice_debug(hw, ICE_DBG_PTP, "Failed to read 25G-RS Rx cycle count, err %d\n",
+				  err);
+			return err;
 		}
 
 		rx_cycle = val & P_REG_RX_40_TO_160_CNT_RXCYC_M;
@@ -3919,12 +3907,12 @@ ice_phy_calc_pmd_adj_e822(struct ice_hw *hw, u8 port,
 		u64 cycle_adj;
 		u8 rx_cycle;
 
-		status = ice_read_phy_reg_e822(hw, port, P_REG_RX_80_TO_160_CNT,
-					       &val);
-		if (status) {
-			ice_debug(hw, ICE_DBG_PTP, "Failed to read 50G-RS Rx cycle count, status %d\n",
-				  status);
-			return status;
+		err = ice_read_phy_reg_e822(hw, port, P_REG_RX_80_TO_160_CNT,
+					    &val);
+		if (err) {
+			ice_debug(hw, ICE_DBG_PTP, "Failed to read 50G-RS Rx cycle count, err %d\n",
+				  err);
+			return err;
 		}
 
 		rx_cycle = val & P_REG_RX_80_TO_160_CNT_RXCYC_M;
@@ -4000,22 +3988,22 @@ int ice_phy_cfg_rx_offset_e822(struct ice_hw *hw, u8 port)
 	enum ice_ptp_link_spd link_spd;
 	enum ice_ptp_fec_mode fec_mode;
 	u64 total_offset, pmd, val;
-	int status;
+	int err;
 
-	status = ice_phy_get_speed_and_fec_e822(hw, port, &link_spd, &fec_mode);
-	if (status)
-		return status;
+	err = ice_phy_get_speed_and_fec_e822(hw, port, &link_spd, &fec_mode);
+	if (err)
+		return err;
 
 	total_offset = ice_calc_fixed_rx_offset_e822(hw, link_spd);
 
 	/* Read the first Vernier offset from the PHY register and add it to
 	 * the total offset.
 	 */
-	status = ice_read_64b_phy_reg_e822(hw, port,
-					   P_REG_PAR_PCS_RX_OFFSET_L,
-					   &val);
-	if (status)
-		return status;
+	err = ice_read_64b_phy_reg_e822(hw, port,
+					P_REG_PAR_PCS_RX_OFFSET_L,
+					&val);
+	if (err)
+		return err;
 
 	total_offset += val;
 
@@ -4026,19 +4014,19 @@ int ice_phy_cfg_rx_offset_e822(struct ice_hw *hw, u8 port)
 	    link_spd == ICE_PTP_LNK_SPD_50G ||
 	    link_spd == ICE_PTP_LNK_SPD_50G_RS ||
 	    link_spd == ICE_PTP_LNK_SPD_100G_RS) {
-		status = ice_read_64b_phy_reg_e822(hw, port,
-						   P_REG_PAR_RX_TIME_L,
-						   &val);
-		if (status)
-			return status;
+		err = ice_read_64b_phy_reg_e822(hw, port,
+						P_REG_PAR_RX_TIME_L,
+						&val);
+		if (err)
+			return err;
 
 		total_offset += val;
 	}
 
 	/* In addition, Rx must account for the PMD alignment */
-	status = ice_phy_calc_pmd_adj_e822(hw, port, link_spd, fec_mode, &pmd);
-	if (status)
-		return status;
+	err = ice_phy_calc_pmd_adj_e822(hw, port, link_spd, fec_mode, &pmd);
+	if (err)
+		return err;
 
 	/* For RS-FEC, this adjustment adds delay, but for other modes, it
 	 * subtracts delay.
@@ -4052,14 +4040,14 @@ int ice_phy_cfg_rx_offset_e822(struct ice_hw *hw, u8 port)
 	 * PHY and indicate that the Rx offset is ready. After this,
 	 * timestamps will be enabled.
 	 */
-	status = ice_write_64b_phy_reg_e822(hw, port, P_REG_TOTAL_RX_OFFSET_L,
-					    total_offset);
-	if (status)
-		return status;
+	err = ice_write_64b_phy_reg_e822(hw, port, P_REG_TOTAL_RX_OFFSET_L,
+					 total_offset);
+	if (err)
+		return err;
 
-	status = ice_write_phy_reg_e822(hw, port, P_REG_RX_OR, 1);
-	if (status)
-		return status;
+	err = ice_write_phy_reg_e822(hw, port, P_REG_RX_OR, 1);
+	if (err)
+		return err;
 
 	return 0;
 }
@@ -4077,12 +4065,12 @@ ice_phy_cfg_fixed_rx_offset_e822(struct ice_hw *hw, u8 port)
 {
 	enum ice_ptp_link_spd link_spd;
 	enum ice_ptp_fec_mode fec_mode;
-	int status;
+	int err;
 	u64 total_offset;
 
-	status = ice_phy_get_speed_and_fec_e822(hw, port, &link_spd, &fec_mode);
-	if (status)
-		return status;
+	err = ice_phy_get_speed_and_fec_e822(hw, port, &link_spd, &fec_mode);
+	if (err)
+		return err;
 
 	total_offset = ice_calc_fixed_rx_offset_e822(hw, link_spd);
 
@@ -4093,14 +4081,14 @@ ice_phy_cfg_fixed_rx_offset_e822(struct ice_hw *hw, u8 port)
 	 * Note that this skips including the more precise offsets generated
 	 * by Vernier calibration.
 	 */
-	status = ice_write_64b_phy_reg_e822(hw, port, P_REG_TOTAL_RX_OFFSET_L,
+	err = ice_write_64b_phy_reg_e822(hw, port, P_REG_TOTAL_RX_OFFSET_L,
 					    total_offset);
-	if (status)
-		return status;
+	if (err)
+		return err;
 
-	status = ice_write_phy_reg_e822(hw, port, P_REG_RX_OR, 1);
-	if (status)
-		return status;
+	err = ice_write_phy_reg_e822(hw, port, P_REG_RX_OR, 1);
+	if (err)
+		return err;
 
 	return 0;
 }
@@ -4119,10 +4107,10 @@ static int
 ice_read_phy_and_phc_time_e822(struct ice_hw *hw, u8 port, u64 *phy_time,
 			       u64 *phc_time)
 {
-	int status;
 	u64 tx_time, rx_time;
 	u32 zo, lo;
 	u8 tmr_idx;
+	int err;
 
 	tmr_idx = ice_get_ptp_src_clock_index(hw);
 
@@ -4130,9 +4118,9 @@ ice_read_phy_and_phc_time_e822(struct ice_hw *hw, u8 port, u64 *phy_time,
 	ice_ptp_src_cmd(hw, ICE_PTP_READ_TIME);
 
 	/* Prepare the PHY timer for a ICE_PTP_READ_TIME capture command */
-	status = ice_ptp_one_port_cmd(hw, port, ICE_PTP_READ_TIME, true);
-	if (status)
-		return status;
+	err = ice_ptp_one_port_cmd(hw, port, ICE_PTP_READ_TIME, true);
+	if (err)
+		return err;
 
 	/* Issue the sync to start the ICE_PTP_READ_TIME capture */
 	ice_ptp_exec_tmr_cmd(hw);
@@ -4143,9 +4131,9 @@ ice_read_phy_and_phc_time_e822(struct ice_hw *hw, u8 port, u64 *phy_time,
 	*phc_time = (u64)lo << 32 | zo;
 
 	/* Read the captured PHY time from the PHY shadow registers */
-	status = ice_ptp_read_port_capture_e822(hw, port, &tx_time, &rx_time);
-	if (status)
-		return status;
+	err = ice_ptp_read_port_capture_e822(hw, port, &tx_time, &rx_time);
+	if (err)
+		return err;
 
 	/* If the PHY Tx and Rx timers don't match, log a warning message.
 	 * Note that this should not happen in normal circumstances since the
@@ -4176,15 +4164,15 @@ ice_read_phy_and_phc_time_e822(struct ice_hw *hw, u8 port, u64 *phy_time,
 static int ice_sync_phy_timer_e822(struct ice_hw *hw, u8 port)
 {
 	u64 phc_time, phy_time, difference;
-	int status;
+	int err;
 
 	if (!ice_ptp_lock(hw)) {
 		ice_debug(hw, ICE_DBG_PTP, "Failed to acquire PTP semaphore\n");
 		return ICE_ERR_NOT_READY;
 	}
 
-	status = ice_read_phy_and_phc_time_e822(hw, port, &phy_time, &phc_time);
-	if (status)
+	err = ice_read_phy_and_phc_time_e822(hw, port, &phy_time, &phc_time);
+	if (err)
 		goto err_unlock;
 
 	/* Calculate the amount required to add to the port time in order for
@@ -4197,12 +4185,12 @@ static int ice_sync_phy_timer_e822(struct ice_hw *hw, u8 port)
 	 */
 	difference = phc_time - phy_time;
 
-	status = ice_ptp_prep_port_adj_e822(hw, port, (s64)difference, true);
-	if (status)
+	err = ice_ptp_prep_port_adj_e822(hw, port, (s64)difference, true);
+	if (err)
 		goto err_unlock;
 
-	status = ice_ptp_one_port_cmd(hw, port, ICE_PTP_ADJ_TIME, true);
-	if (status)
+	err = ice_ptp_one_port_cmd(hw, port, ICE_PTP_ADJ_TIME, true);
+	if (err)
 		goto err_unlock;
 
 	/* Do not perform any action on the main timer */
@@ -4214,8 +4202,8 @@ static int ice_sync_phy_timer_e822(struct ice_hw *hw, u8 port)
 	/* Re-capture the timer values to flush the command registers and
 	 * verify that the time was properly adjusted.
 	 */
-	status = ice_read_phy_and_phc_time_e822(hw, port, &phy_time, &phc_time);
-	if (status)
+	err = ice_read_phy_and_phc_time_e822(hw, port, &phy_time, &phc_time);
+	if (err)
 		goto err_unlock;
 
 	ice_info(hw, "Port %u PHY time synced to PHC: 0x%016llX, 0x%016llX\n",
@@ -4228,7 +4216,7 @@ static int ice_sync_phy_timer_e822(struct ice_hw *hw, u8 port)
 
 err_unlock:
 	ice_ptp_unlock(hw);
-	return status;
+	return err;
 }
 
 /**
@@ -4244,36 +4232,36 @@ static int ice_sync_phy_timer_e822(struct ice_hw *hw, u8 port)
 int
 ice_stop_phy_timer_e822(struct ice_hw *hw, u8 port, bool soft_reset)
 {
-	int status;
+	int err;
 	u32 val;
 
-	status = ice_write_phy_reg_e822(hw, port, P_REG_TX_OR, 0);
-	if (status)
-		return status;
+	err = ice_write_phy_reg_e822(hw, port, P_REG_TX_OR, 0);
+	if (err)
+		return err;
 
-	status = ice_write_phy_reg_e822(hw, port, P_REG_RX_OR, 0);
-	if (status)
-		return status;
+	err = ice_write_phy_reg_e822(hw, port, P_REG_RX_OR, 0);
+	if (err)
+		return err;
 
-	status = ice_read_phy_reg_e822(hw, port, P_REG_PS, &val);
-	if (status)
-		return status;
+	err = ice_read_phy_reg_e822(hw, port, P_REG_PS, &val);
+	if (err)
+		return err;
 
 	val &= ~P_REG_PS_START_M;
-	status = ice_write_phy_reg_e822(hw, port, P_REG_PS, val);
-	if (status)
-		return status;
+	err = ice_write_phy_reg_e822(hw, port, P_REG_PS, val);
+	if (err)
+		return err;
 
 	val &= ~P_REG_PS_ENA_CLK_M;
-	status = ice_write_phy_reg_e822(hw, port, P_REG_PS, val);
-	if (status)
-		return status;
+	err = ice_write_phy_reg_e822(hw, port, P_REG_PS, val);
+	if (err)
+		return err;
 
 	if (soft_reset) {
 		val |= P_REG_PS_SFT_RESET_M;
-		status = ice_write_phy_reg_e822(hw, port, P_REG_PS, val);
-		if (status)
-			return status;
+		err = ice_write_phy_reg_e822(hw, port, P_REG_PS, val);
+		if (err)
+			return err;
 	}
 
 	ice_debug(hw, ICE_DBG_PTP, "Disabled clock on PHY port %u\n", port);
@@ -4300,101 +4288,101 @@ ice_stop_phy_timer_e822(struct ice_hw *hw, u8 port, bool soft_reset)
 int
 ice_start_phy_timer_e822(struct ice_hw *hw, u8 port, bool bypass)
 {
-	int status;
 	u32 lo, hi, val;
 	u64 incval;
 	u8 tmr_idx;
+	int err;
 
 	tmr_idx = ice_get_ptp_src_clock_index(hw);
 
-	status = ice_stop_phy_timer_e822(hw, port, false);
-	if (status)
-		return status;
+	err = ice_stop_phy_timer_e822(hw, port, false);
+	if (err)
+		return err;
 
 	ice_phy_cfg_lane_e822(hw, port);
 
-	status = ice_phy_cfg_uix_e822(hw, port);
-	if (status)
-		return status;
+	err = ice_phy_cfg_uix_e822(hw, port);
+	if (err)
+		return err;
 
-	status = ice_phy_cfg_parpcs_e822(hw, port);
-	if (status)
-		return status;
+	err = ice_phy_cfg_parpcs_e822(hw, port);
+	if (err)
+		return err;
 
 	lo = rd32(hw, GLTSYN_INCVAL_L(tmr_idx));
 	hi = rd32(hw, GLTSYN_INCVAL_H(tmr_idx));
 	incval = (u64)hi << 32 | lo;
 
-	status = ice_write_40b_phy_reg_e822(hw, port, P_REG_TIMETUS_L, incval);
-	if (status)
-		return status;
+	err = ice_write_40b_phy_reg_e822(hw, port, P_REG_TIMETUS_L, incval);
+	if (err)
+		return err;
 
-	status = ice_ptp_one_port_cmd(hw, port, ICE_PTP_INIT_INCVAL, true);
-	if (status)
-		return status;
+	err = ice_ptp_one_port_cmd(hw, port, ICE_PTP_INIT_INCVAL, true);
+	if (err)
+		return err;
 
 	/* Do not perform any action on the main timer */
 	ice_ptp_src_cmd(hw, ICE_PTP_NOP);
 
 	ice_ptp_exec_tmr_cmd(hw);
 
-	status = ice_read_phy_reg_e822(hw, port, P_REG_PS, &val);
-	if (status)
-		return status;
+	err = ice_read_phy_reg_e822(hw, port, P_REG_PS, &val);
+	if (err)
+		return err;
 
 	val |= P_REG_PS_SFT_RESET_M;
-	status = ice_write_phy_reg_e822(hw, port, P_REG_PS, val);
-	if (status)
-		return status;
+	err = ice_write_phy_reg_e822(hw, port, P_REG_PS, val);
+	if (err)
+		return err;
 
 	val |= P_REG_PS_START_M;
-	status = ice_write_phy_reg_e822(hw, port, P_REG_PS, val);
-	if (status)
-		return status;
+	err = ice_write_phy_reg_e822(hw, port, P_REG_PS, val);
+	if (err)
+		return err;
 
 	val &= ~P_REG_PS_SFT_RESET_M;
-	status = ice_write_phy_reg_e822(hw, port, P_REG_PS, val);
-	if (status)
-		return status;
+	err = ice_write_phy_reg_e822(hw, port, P_REG_PS, val);
+	if (err)
+		return err;
 
-	status = ice_ptp_one_port_cmd(hw, port, ICE_PTP_INIT_INCVAL, true);
-	if (status)
-		return status;
+	err = ice_ptp_one_port_cmd(hw, port, ICE_PTP_INIT_INCVAL, true);
+	if (err)
+		return err;
 
 	ice_ptp_exec_tmr_cmd(hw);
 
 	val |= P_REG_PS_ENA_CLK_M;
-	status = ice_write_phy_reg_e822(hw, port, P_REG_PS, val);
-	if (status)
-		return status;
+	err = ice_write_phy_reg_e822(hw, port, P_REG_PS, val);
+	if (err)
+		return err;
 
 	val |= P_REG_PS_LOAD_OFFSET_M;
-	status = ice_write_phy_reg_e822(hw, port, P_REG_PS, val);
-	if (status)
-		return status;
+	err = ice_write_phy_reg_e822(hw, port, P_REG_PS, val);
+	if (err)
+		return err;
 
 	ice_ptp_exec_tmr_cmd(hw);
 
-	status = ice_sync_phy_timer_e822(hw, port);
-	if (status)
-		return status;
+	err = ice_sync_phy_timer_e822(hw, port);
+	if (err)
+		return err;
 
 	if (bypass) {
 		val |= P_REG_PS_BYPASS_MODE_M;
 		/* Enter BYPASS mode, enabling timestamps immediately. */
-		status = ice_write_phy_reg_e822(hw, port, P_REG_PS, val);
-		if (status)
-			return status;
+		err = ice_write_phy_reg_e822(hw, port, P_REG_PS, val);
+		if (err)
+			return err;
 
 		/* Program the fixed Tx offset */
-		status = ice_phy_cfg_fixed_tx_offset_e822(hw, port);
-		if (status)
-			return status;
+		err = ice_phy_cfg_fixed_tx_offset_e822(hw, port);
+		if (err)
+			return err;
 
 		/* Program the fixed Rx offset */
-		status = ice_phy_cfg_fixed_rx_offset_e822(hw, port);
-		if (status)
[… more lines in the raw message]

Lines of this file are not shown. View the raw message.

The rest of this diff is not shown. View the raw message.

Signature · 1 line
2.43.0

Part of the diff is not shown here. View the raw message.

#81 lore raw

PATCH v2 62/148 net/ice/base: re-number E810-T subdevice IDs to match upstream

In reply to Anatoly Burakov

From: Ian Stokes <[email protected]>

When upstreaming the E810-T support for Linux, during review it was pointed out that the E810T subdevice IDs numbering was odd. The subdevice ID numbers seemed to be arbitrary. The upstream driver re-numbered the subdevice ID values so that they were in increasing order.

Align with upstream, and re-number the E810-T macros to match. Fix the ice_is_e810t function to properly use the appropriate macros when determining if a given card is E810-T.

Note that this has no functional difference as the only users of the ICE_SUBDEV_ID_E810T macros is ice_is_e810t. The generated switch case statements are identical before and after this change. You can confirm this using 'gcc -E' on Linux.

---
 drivers/net/ice/base/ice_common.c | 18 +++++++++---------
 drivers/net/ice/base/ice_devids.h | 10 +++++-----
 2 files changed, 14 insertions(+), 14 deletions(-)
drivers/net/ice/base/ice_common.c +9 -9
index 75d02d39f5..0062bce2d7 100644
@@ -236,16 +236,16 @@ bool ice_is_e810t(struct ice_hw *hw)
 		case ICE_SUBDEV_ID_E810T2:
 		case ICE_SUBDEV_ID_E810T3:
 		case ICE_SUBDEV_ID_E810T4:
-		case ICE_SUBDEV_ID_E810T5:
-		case ICE_SUBDEV_ID_E810T7:
-			return true;
-		}
-		break;
-	case ICE_DEV_ID_E810C_QSFP:
-		switch (hw->subsystem_device_id) {
-		case ICE_SUBDEV_ID_E810T2:
-		case ICE_SUBDEV_ID_E810T5:
 		case ICE_SUBDEV_ID_E810T6:
+		case ICE_SUBDEV_ID_E810T7:
+			return true;
+		}
+		break;
+	case ICE_DEV_ID_E810C_QSFP:
+		switch (hw->subsystem_device_id) {
+		case ICE_SUBDEV_ID_E810T2:
+		case ICE_SUBDEV_ID_E810T3:
+		case ICE_SUBDEV_ID_E810T5:
 			return true;
 		}
 		break;
drivers/net/ice/base/ice_devids.h +5 -5
index 49d642372a..33e6cc6ade 100644
@@ -41,11 +41,11 @@
 #define ICE_DEV_ID_E810C_SFP		0x1593
 #define ICE_SUBDEV_ID_E810T		0x000E
 #define ICE_SUBDEV_ID_E810T2		0x000F
-#define ICE_SUBDEV_ID_E810T3		0x02E9
-#define ICE_SUBDEV_ID_E810T4		0x02EA
-#define ICE_SUBDEV_ID_E810T5		0x0010
-#define ICE_SUBDEV_ID_E810T6		0x0012
-#define ICE_SUBDEV_ID_E810T7		0x0011
+#define ICE_SUBDEV_ID_E810T3		0x0010
+#define ICE_SUBDEV_ID_E810T4		0x0011
+#define ICE_SUBDEV_ID_E810T5		0x0012
+#define ICE_SUBDEV_ID_E810T6		0x02E9
+#define ICE_SUBDEV_ID_E810T7		0x02EA
 /* Intel(R) Ethernet Controller E810-XXV for backplane */
 #define ICE_DEV_ID_E810_XXV_BACKPLANE	0x1599
 /* Intel(R) Ethernet Controller E810-XXV for QSFP */
Signature · 1 line
2.43.0
#82 lore raw

PATCH v2 63/148 net/ice/base: enable RDMA Act-Act unload paths

In reply to Anatoly Burakov

From: Ian Stokes <[email protected]>

In certain unload conditions the non-standard paths to breaking down the bond supporting resources need special considerations in that there could be nodes moved out of the tree and this can cause a NULL pointer to be passed into the find node by
teid function.

Add in a NULL pointer check to handle these situations

---
 drivers/net/ice/base/ice_sched.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/net/ice/base/ice_sched.c +3 -0
index 74d57329da..af8f8cc7a9 100644
@@ -56,6 +56,9 @@ ice_sched_find_node_by_teid(struct ice_sched_node *start_node, u32 teid)
 {
 	u16 i;
 
+	if (!start_node)
+		return NULL;
+
 	/* The TEID is same as that of the start_node */
 	if (ICE_TXSCHED_GET_NODE_TEID(start_node) == teid)
 		return start_node;
Signature · 1 line
2.43.0
#83 lore raw

PATCH v2 64/148 net/ice/base: parse 1PPS GPIO in 1588 function caps

In reply to Anatoly Burakov

From: Ian Stokes <[email protected]>

Check for 1PPS GPIO association in 1588 function caps. Remove legacy code related to a workaround setting 1588 capabilities to a fixed value.

---
 drivers/net/ice/base/ice_common.c | 4 +++-
 drivers/net/ice/base/ice_type.h   | 2 ++
 2 files changed, 5 insertions(+), 1 deletion(-)
drivers/net/ice/base/ice_common.c +3 -1
index 0062bce2d7..e48085106c 100644
@@ -2618,7 +2618,7 @@ ice_parse_1588_func_caps(struct ice_hw *hw, struct ice_hw_func_caps *func_p,
 	u32 number = LE32_TO_CPU(cap->number);
 	u8 clk_freq;
 
-	ice_debug(hw, ICE_DBG_INIT, "1588 func caps: raw value %x\n", number);
+	ice_debug(hw, ICE_DBG_INIT, "1588 func caps: raw value %#x\n", number);
 
 	info->ena = ((number & ICE_TS_FUNC_ENA_M) != 0);
 	func_p->common_cap.ieee_1588 = info->ena;
@@ -2628,6 +2628,8 @@ ice_parse_1588_func_caps(struct ice_hw *hw, struct ice_hw_func_caps *func_p,
 	info->tmr_index_owned = ((number & ICE_TS_TMR_IDX_OWND_M) != 0);
 	info->tmr_index_assoc = ((number & ICE_TS_TMR_IDX_ASSOC_M) != 0);
 
+	info->gpio_1pps = ((number & ICE_TS_GPIO_1PPS_ASSOC) != 0);
+
 	info->clk_src = ((number & ICE_TS_CLK_SRC_M) != 0);
 	clk_freq = (number & ICE_TS_CLK_FREQ_M) >> ICE_TS_CLK_FREQ_S;
 	if (clk_freq < NUM_ICE_TIME_REF_FREQ) {
drivers/net/ice/base/ice_type.h +2 -0
index cfdae5ffb7..3a4833a0e1 100644
@@ -732,6 +732,7 @@ struct ice_hw_common_caps {
 #define ICE_TS_TMR_ENA_M		BIT(2)
 #define ICE_TS_TMR_IDX_OWND_S		4
 #define ICE_TS_TMR_IDX_OWND_M		BIT(4)
+#define ICE_TS_GPIO_1PPS_ASSOC		BIT(12)
 #define ICE_TS_CLK_FREQ_S		16
 #define ICE_TS_CLK_FREQ_M		MAKEMASK(0x7, ICE_TS_CLK_FREQ_S)
 #define ICE_TS_CLK_SRC_S		20
@@ -768,6 +769,7 @@ struct ice_ts_func_info {
 	u8 tmr_index_owned : 1;
 	u8 src_tmr_owned : 1;
 	u8 tmr_ena : 1;
+	u8 gpio_1pps : 1;
 };
 
 /* Device specific definitions */
Signature · 1 line
2.43.0
#84 lore raw

PATCH v2 65/148 net/ice/base: rename netlist check functions to match upstream

In reply to Anatoly Burakov

From: Ian Stokes <[email protected]>

The driver checks the netlist for nodes indicating hardware support using functions named "ice_is_<feature>_present" sometimes with an additional _e810t postfix. These functions check the contents of the netlist, and don't make any direct device ID check.

When upstreaming the functions, the names were changed to use the form "ice_is_<feature>_in_netlist" and removed all the device postfixes. Rename these functions to match.

---
 drivers/net/ice/base/ice_adminq_cmd.h |   4 +-
 drivers/net/ice/base/ice_common.c     | 220 ++++++++++++++------------
 drivers/net/ice/base/ice_common.h     |   1 +
 drivers/net/ice/base/ice_ptp_hw.c     |  17 +-
 drivers/net/ice/base/ice_ptp_hw.h     |   1 -
 5 files changed, 124 insertions(+), 119 deletions(-)
drivers/net/ice/base/ice_adminq_cmd.h +2 -2
index 04a0b1cf9b..8c62683731 100644
@@ -1731,8 +1731,8 @@ struct ice_aqc_link_topo_addr {
 struct ice_aqc_get_link_topo {
 	struct ice_aqc_link_topo_addr addr;
 	u8 node_part_num;
-#define ICE_ACQ_GET_LINK_TOPO_NODE_NR_PCA9575	0x21
-#define ICE_ACQ_GET_LINK_TOPO_NODE_NR_GEN_GPS	0x48
+#define ICE_AQC_GET_LINK_TOPO_NODE_NR_PCA9575			0x21
+#define ICE_AQC_GET_LINK_TOPO_NODE_NR_GEN_GPS			0x48
 	u8 rsvd[9];
 };
 
drivers/net/ice/base/ice_common.c +120 -100

238 lines not on this page · raw message

drivers/net/ice/base/ice_common.h +1 -0
index 14620d05b4..882359f5e3 100644
@@ -159,6 +159,7 @@ ice_aq_get_netlist_node(struct ice_hw *hw, struct ice_aqc_get_link_topo *cmd,
 int
 ice_find_netlist_node(struct ice_hw *hw, u8 node_type_ctx, u8 node_part_number,
 		      u16 *node_handle);
+bool ice_is_gps_in_netlist(struct ice_hw *hw);
 void
 ice_update_phy_type(u64 *phy_type_low, u64 *phy_type_high,
 		    u16 link_speeds_bitmap);
drivers/net/ice/base/ice_ptp_hw.c +1 -16
index 237c9ffa94..ab18169529 100644
@@ -4979,7 +4979,7 @@ ice_get_pca9575_handle(struct ice_hw *hw, u16 *pca9575_handle)
 		return ICE_ERR_NOT_SUPPORTED;
 
 	/* Verify if we found the right IO expander type */
-	if (node_part_number != ICE_ACQ_GET_LINK_TOPO_NODE_NR_PCA9575)
+	if (node_part_number != ICE_AQC_GET_LINK_TOPO_NODE_NR_PCA9575)
 		return ICE_ERR_NOT_SUPPORTED;
 
 	/* If present save the handle and return it */
@@ -4989,21 +4989,6 @@ ice_get_pca9575_handle(struct ice_hw *hw, u16 *pca9575_handle)
 	return 0;
 }
 
-/**
- * ice_is_gps_present_e810t
- * @hw: pointer to the hw struct
- *
- * Check if the GPS generic device is present in the netlist
- */
-bool ice_is_gps_present_e810t(struct ice_hw *hw)
-{
-	if (ice_find_netlist_node(hw, ICE_AQC_LINK_TOPO_NODE_TYPE_GPS,
-				  ICE_ACQ_GET_LINK_TOPO_NODE_NR_GEN_GPS, NULL))
-		return false;
-
-	return true;
-}
-
 /**
  * ice_read_sma_ctrl_e810t
  * @hw: pointer to the hw struct
drivers/net/ice/base/ice_ptp_hw.h +0 -1
index be62e594bc..7fe250c541 100644
@@ -255,7 +255,6 @@ int ice_phy_cfg_rx_offset_e822(struct ice_hw *hw, u8 port);
 int ice_phy_exit_bypass_e822(struct ice_hw *hw, u8 port);
 
 /* E810 family functions */
-bool ice_is_gps_present_e810t(struct ice_hw *hw);
 int ice_ptp_init_phy_e810(struct ice_hw *hw);
 int
 ice_read_pca9575_reg_e810t(struct ice_hw *hw, u8 offset, u8 *data);
Signature · 1 line
2.43.0
#85 lore raw

PATCH v2 66/148 net/ice/base: fix check for existing switch rule

In reply to Anatoly Burakov

From: Ian Stokes <[email protected]>

In case the rule already exists and another VSI wants to subscribe to it new VSI list is being created and both VSIs are moved to it. Currently, the check for already existing VSI with the same rule is done based on fdw_id.hw_vsi_id, which applies only to LOOKUP_RX flag. Change it to vsi_handle. This is software VSI ID, but it can be applied here, because vsi_map itself is also based on it.

Additionally change return status in case the VSI already exists in the VSI map to "Already exists". Such case should be handled by the caller.

---
 drivers/net/ice/base/ice_switch.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/ice/base/ice_switch.c +2 -2
index 6d0dcf43c6..62f86aaf13 100644
@@ -4813,7 +4813,7 @@ ice_add_update_vsi_list(struct ice_hw *hw,
 		u16 vsi_handle_arr[2];
 
 		/* A rule already exists with the new VSI being added */
-		if (cur_fltr->fwd_id.hw_vsi_id == new_fltr->fwd_id.hw_vsi_id)
+		if (cur_fltr->vsi_handle == new_fltr->vsi_handle)
 			return ICE_ERR_ALREADY_EXISTS;
 
 		vsi_handle_arr[0] = cur_fltr->vsi_handle;
@@ -4861,7 +4861,7 @@ ice_add_update_vsi_list(struct ice_hw *hw,
 
 		/* A rule already exists with the new VSI being added */
 		if (ice_is_bit_set(m_entry->vsi_list_info->vsi_map, vsi_handle))
-			return 0;
+			return ICE_ERR_ALREADY_EXISTS;
 
 		/* Update the previously created VSI list set with
 		 * the new VSI ID passed in
Signature · 1 line
2.43.0
#86 lore raw

PATCH v2 67/148 net/ice/base: fall back to safe CGU params

In reply to Anatoly Burakov

From: Ian Stokes <[email protected]>

If TS PLL fails to lock to the values from the capabilities, retry with safe internal 25 MHz TCXO in nanosecond mode. This prevents PTP init fail and does not disturb nominal initialization of the device.

---
 drivers/net/ice/base/ice_ptp_hw.c | 55 ++++++++++++++++++++-----------
 drivers/net/ice/base/ice_ptp_hw.h |  4 +--
 2 files changed, 38 insertions(+), 21 deletions(-)
drivers/net/ice/base/ice_ptp_hw.c +36 -19
index ab18169529..62558ac761 100644
@@ -219,8 +219,8 @@ static const char *ice_clk_src_str(u8 clk_src)
  * time reference, enabling the PLL which drives the PTP hardware clock.
  */
 int
-ice_cfg_cgu_pll_e822(struct ice_hw *hw, enum ice_time_ref_freq clk_freq,
-		     enum ice_clk_src clk_src)
+ice_cfg_cgu_pll_e822(struct ice_hw *hw, enum ice_time_ref_freq *clk_freq,
+		     enum ice_clk_src *clk_src)
 {
 	union tspll_ro_bwm_lf bwm_lf;
 	union nac_cgu_dword19 dw19;
@@ -229,18 +229,18 @@ ice_cfg_cgu_pll_e822(struct ice_hw *hw, enum ice_time_ref_freq clk_freq,
 	union nac_cgu_dword9 dw9;
 	int err;
 
-	if (clk_freq >= NUM_ICE_TIME_REF_FREQ) {
-		ice_warn(hw, "Invalid TIME_REF frequency %u\n", clk_freq);
+	if (*clk_freq >= NUM_ICE_TIME_REF_FREQ) {
+		ice_warn(hw, "Invalid TIME_REF frequency %u\n", *clk_freq);
 		return ICE_ERR_PARAM;
 	}
 
-	if (clk_src >= NUM_ICE_CLK_SRC) {
-		ice_warn(hw, "Invalid clock source %u\n", clk_src);
+	if (*clk_src >= NUM_ICE_CLK_SRC) {
+		ice_warn(hw, "Invalid clock source %u\n", *clk_src);
 		return ICE_ERR_PARAM;
 	}
 
-	if (clk_src == ICE_CLK_SRC_TCX0 &&
-	    clk_freq != ICE_TIME_REF_FREQ_25_000) {
+	if (*clk_src == ICE_CLK_SRC_TCX0 &&
+	    *clk_freq != ICE_TIME_REF_FREQ_25_000) {
 		ice_warn(hw, "TCX0 only supports 25 MHz frequency\n");
 		return ICE_ERR_PARAM;
 	}
@@ -258,7 +258,7 @@ ice_cfg_cgu_pll_e822(struct ice_hw *hw, enum ice_time_ref_freq clk_freq,
 		return err;
 
 	/* Log the current clock configuration */
-	ice_debug(hw, ICE_DBG_PTP, "Current CGU configuration -- %s, clk_src %s, clk_freq %s, PLL %s\n",
+	ice_debug(hw, ICE_DBG_PTP, "Current CGU configuration -- %s, clk_src %s, *clk_freq %s, PLL %s\n",
 		  dw24.field.ts_pll_enable ? "enabled" : "disabled",
 		  ice_clk_src_str(dw24.field.time_ref_sel),
 		  ice_clk_freq_str(dw9.field.time_ref_freq_sel),
@@ -274,7 +274,7 @@ ice_cfg_cgu_pll_e822(struct ice_hw *hw, enum ice_time_ref_freq clk_freq,
 	}
 
 	/* Set the frequency */
-	dw9.field.time_ref_freq_sel = clk_freq;
+	dw9.field.time_ref_freq_sel = *clk_freq;
 	err = ice_write_cgu_reg_e82x(hw, NAC_CGU_DWORD9, dw9.val);
 	if (err)
 		return err;
@@ -284,7 +284,7 @@ ice_cfg_cgu_pll_e822(struct ice_hw *hw, enum ice_time_ref_freq clk_freq,
 	if (err)
 		return err;
 
-	dw19.field.tspll_fbdiv_intgr = e822_cgu_params[clk_freq].feedback_div;
+	dw19.field.tspll_fbdiv_intgr = e822_cgu_params[*clk_freq].feedback_div;
 	dw19.field.tspll_ndivratio = 1;
 
 	err = ice_write_cgu_reg_e82x(hw, NAC_CGU_DWORD19, dw19.val);
@@ -296,7 +296,7 @@ ice_cfg_cgu_pll_e822(struct ice_hw *hw, enum ice_time_ref_freq clk_freq,
 	if (err)
 		return err;
 
-	dw22.field.time1588clk_div = e822_cgu_params[clk_freq].post_pll_div;
+	dw22.field.time1588clk_div = e822_cgu_params[*clk_freq].post_pll_div;
 	dw22.field.time1588clk_sel_div2 = 0;
 
 	err = ice_write_cgu_reg_e82x(hw, NAC_CGU_DWORD22, dw22.val);
@@ -308,9 +308,9 @@ ice_cfg_cgu_pll_e822(struct ice_hw *hw, enum ice_time_ref_freq clk_freq,
 	if (err)
 		return err;
 
-	dw24.field.ref1588_ck_div = e822_cgu_params[clk_freq].refclk_pre_div;
-	dw24.field.tspll_fbdiv_frac = e822_cgu_params[clk_freq].frac_n_div;
-	dw24.field.time_ref_sel = clk_src;
+	dw24.field.ref1588_ck_div = e822_cgu_params[*clk_freq].refclk_pre_div;
+	dw24.field.tspll_fbdiv_frac = e822_cgu_params[*clk_freq].frac_n_div;
+	dw24.field.time_ref_sel = *clk_src;
 
 	err = ice_write_cgu_reg_e82x(hw, NAC_CGU_DWORD24, dw24.val);
 	if (err)
@@ -342,6 +342,9 @@ ice_cfg_cgu_pll_e822(struct ice_hw *hw, enum ice_time_ref_freq clk_freq,
 		  ice_clk_freq_str(dw9.field.time_ref_freq_sel),
 		  bwm_lf.field.plllock_true_lock_cri ? "locked" : "unlocked");
 
+	*clk_freq = (enum ice_time_ref_freq)dw9.field.time_ref_freq_sel;
+	*clk_src = (enum ice_clk_src)dw24.field.time_ref_sel;
+
 	return 0;
 }
 
@@ -762,11 +765,25 @@ static int ice_init_cgu_e82x(struct ice_hw *hw)
 	if (ice_is_e825c(hw))
 		err = ice_cfg_cgu_pll_e825c(hw, &time_ref_freq, &clk_src);
 	else
-		err = ice_cfg_cgu_pll_e822(hw, time_ref_freq, clk_src);
-	if (err)
-		return err;
+		err = ice_cfg_cgu_pll_e822(hw, &time_ref_freq, &clk_src);
+	if (err) {
+		ice_warn(hw, "Failed to lock TS PLL to predefined frequency. Retrying with fallback frequency.\n");
 
-	return 0;
+		/* Try to lock to internal 25 MHz TCXO as a fallback */
+		time_ref_freq = ICE_TIME_REF_FREQ_25_000;
+		clk_src = ICE_CLK_SRC_TCX0;
+		if (ice_is_e825c(hw))
+			err = ice_cfg_cgu_pll_e825c(hw, &time_ref_freq,
+						    &clk_src);
+		else
+			err = ice_cfg_cgu_pll_e822(hw, &time_ref_freq,
+						   &clk_src);
+
+		if (err)
+			ice_warn(hw, "Failed to lock TS PLL to fallback frequency.\n");
+	}
+
+	return err;
 }
 
 /**
drivers/net/ice/base/ice_ptp_hw.h +2 -2
index 7fe250c541..50716e7b25 100644
@@ -165,8 +165,8 @@ int
 ice_ptp_read_port_capture_e822(struct ice_hw *hw, u8 port,
 			       u64 *tx_ts, u64 *rx_ts);
 int
-ice_cfg_cgu_pll_e822(struct ice_hw *hw, enum ice_time_ref_freq clk_freq,
-		     enum ice_clk_src clk_src);
+ice_cfg_cgu_pll_e822(struct ice_hw *hw, enum ice_time_ref_freq *clk_freq,
+		     enum ice_clk_src *clk_src);
 int
 ice_ptp_write_port_cmd_e822(struct ice_hw *hw, u8 port,
 			    enum ice_ptp_tmr_cmd cmd, bool lock_sbq);
Signature · 1 line
2.43.0
#87 lore raw

PATCH v2 68/148 net/ice/base: change tmr_idx to u32

In reply to Anatoly Burakov

From: Ian Stokes <[email protected]>

When converting to source timer command value, tmr_idx is left shifted by 8 (CPK_SRC_SEL), which overflows the 8-bit data type. Change to 32-bit.

---
 drivers/net/ice/base/ice_ptp_hw.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/net/ice/base/ice_ptp_hw.c +1 -2
index 62558ac761..31d6c7cf81 100644
@@ -797,8 +797,7 @@ static int ice_init_cgu_e82x(struct ice_hw *hw)
 static u32 ice_ptp_tmr_cmd_to_src_reg(struct ice_hw *hw,
 				      enum ice_ptp_tmr_cmd cmd)
 {
-	u32 cmd_val;
-	u8 tmr_idx;
+	u32 cmd_val, tmr_idx;
 
 	switch (cmd) {
 	case ICE_PTP_INIT_TIME:
Signature · 1 line
2.43.0
#88 lore raw

PATCH v2 69/148 net/ice/base: be more verbose when preparing timer sync

In reply to Anatoly Burakov

Add an informative error message when preparing external PHYs for a timer sync fails.

---
 drivers/net/ice/base/ice_ptp_hw.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)
drivers/net/ice/base/ice_ptp_hw.c +9 -2
index 31d6c7cf81..81b57b068c 100644
@@ -4932,9 +4932,16 @@ int ice_ptp_port_cmd_e810(struct ice_hw *hw, enum ice_ptp_tmr_cmd cmd,
 			  bool lock_sbq)
 {
 	u32 val = ice_ptp_tmr_cmd_to_port_reg(hw, cmd);
+	int err;
 
-	return ice_write_phy_reg_e810_lp(hw, E810_ETH_GLTSYN_CMD, val,
-					 lock_sbq);
+	err = ice_write_phy_reg_e810_lp(hw, E810_ETH_GLTSYN_CMD, val,
+					lock_sbq);
+	if (err) {
+		ice_debug(hw, ICE_DBG_PTP, "Failed to write back GLTSYN_CMD, err %d\n", err);
+		return err;
+	}
+
+	return 0;
 }
 
 /* E810T SMA functions
Signature · 1 line
2.43.0
#89 lore raw

PATCH v2 70/148 net/ice/base: be more verbose in configuring Rx timestamp offset

In reply to Anatoly Burakov

Add an info message at the end of successful Rx timestamp offset configuration.

---
 drivers/net/ice/base/ice_ptp_hw.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/net/ice/base/ice_ptp_hw.c +3 -0
index 81b57b068c..1ba8afa544 100644
@@ -4065,6 +4065,9 @@ int ice_phy_cfg_rx_offset_e822(struct ice_hw *hw, u8 port)
 	if (err)
 		return err;
 
+	ice_info(hw,
+		 "Port=%d Rx vernier offset calibration complete\n", port);
+
 	return 0;
 }
 
Signature · 1 line
2.43.0
#90 lore raw

PATCH v2 71/148 net/ice/base: match code style to upstream

In reply to Anatoly Burakov

The out-of-tree shared code has a few places where we differed in how the variables were used compared to the upstream. Match what's upstream to reduce the difference between the out-of-tree and upstream drivers.

---
 drivers/net/ice/base/ice_ptp_hw.c | 13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)
drivers/net/ice/base/ice_ptp_hw.c +5 -8
index 1ba8afa544..ddcadf603c 100644
@@ -3806,9 +3806,9 @@ ice_phy_calc_pmd_adj_e822(struct ice_hw *hw, u8 port,
 			  enum ice_ptp_fec_mode fec_mode, u64 *pmd_adj)
 {
 	u64 cur_freq, clk_incval, tu_per_sec, mult, adj;
-	u32 pmd_adj_divisor, val;
-	int err;
 	u8 pmd_align;
+	u32 val;
+	int err;
 
 	err = ice_read_phy_reg_e822(hw, port, P_REG_PMD_ALIGNMENT, &val);
 	if (err) {
@@ -3825,9 +3825,6 @@ ice_phy_calc_pmd_adj_e822(struct ice_hw *hw, u8 port,
 	/* Calculate TUs per second */
 	tu_per_sec = cur_freq * clk_incval;
 
-	/* Get the link speed dependent PMD adjustment divisor */
-	pmd_adj_divisor = e822_vernier[link_spd].pmd_adj_divisor;
-
 	/* The PMD alignment adjustment measurement depends on the link speed,
 	 * and whether FEC is enabled. For each link speed, the alignment
 	 * adjustment is calculated by dividing a value by the length of
@@ -3892,7 +3889,7 @@ ice_phy_calc_pmd_adj_e822(struct ice_hw *hw, u8 port,
 	 */
 	adj = DIV_U64(tu_per_sec, 125);
 	adj *= mult;
-	adj = DIV_U64(adj, pmd_adj_divisor);
+	adj = DIV_U64(adj, e822_vernier[link_spd].pmd_adj_divisor);
 
 	/* Finally, for 25G-RS and 50G-RS, a further adjustment for the Rx
 	 * cycle count is necessary.
@@ -3915,7 +3912,7 @@ ice_phy_calc_pmd_adj_e822(struct ice_hw *hw, u8 port,
 
 			cycle_adj = DIV_U64(tu_per_sec, 125);
 			cycle_adj *= mult;
-			cycle_adj = DIV_U64(cycle_adj, pmd_adj_divisor);
+			cycle_adj = DIV_U64(cycle_adj, e822_vernier[link_spd].pmd_adj_divisor);
 
 			adj += cycle_adj;
 		}
@@ -3937,7 +3934,7 @@ ice_phy_calc_pmd_adj_e822(struct ice_hw *hw, u8 port,
 
 			cycle_adj = DIV_U64(tu_per_sec, 125);
 			cycle_adj *= mult;
-			cycle_adj = DIV_U64(cycle_adj, pmd_adj_divisor);
+			cycle_adj = DIV_U64(cycle_adj, e822_vernier[link_spd].pmd_adj_divisor);
 
 			adj += cycle_adj;
 		}
Signature · 1 line
2.43.0