Skip to contentSkip to conversation

net/ice/base: share code update

PATCH Superseded Qiming Yang 5 participants 56 messages Apr 27, 2023 – Mar 5, 2024 Network drivers

lore
Share & tools
lore
#0 lore raw

cover net/ice/base: share code update

Updated share code to 2023.03 version.

Qiming Yang (30):
net/ice/base: updated copyright
net/ice/base: add flex array safe allocations net/ice/base: remove unnecessary control queue array net/ice/base: update flow seg fields to declared bitmaps net/ice/base: clean up RSS LUT and fix media type net/ice/base: add ability to set markid via switch filter net/ice/base: add reading cap and ropo cap net/ice/base: add function to read HW sensors net/ice/base: add pre-allocate memory argument net/ice/base: use coccinelle to instead macro net/ice/base: add new fls function
net/ice/base: add E830 device ids
net/ice/base: add function to get rxq context net/ice/base: removed no need 56G releated code net/ice/base: allow skip main timer net/ice/base: add E830 PTP init
net/ice/base: add C825X device support net/ice/base: add VLAN TPID in switchdev net/ice/base: reduce time to read Option ROM CIVD net/ice/base: add L2TPv3 support for adv rules net/ice/base: add PHY OFFSET READY register clear net/ice/base: return CGU PLL config function params net/ice/base: change method to get pca9575 handle net/ice/base: cleanup timestamp registers correct net/ice/base: add PPPoE hardware offload net/ice/base: remove bypass mode
net/ice/base: support inner etype in switchdev net/ice/base: use const array to store link modes net/ice/base: introduce a new ID for E810 NIC net/ice/base: fix Generic Checksum acronym

 drivers/net/ice/base/README              |    2 +-
 drivers/net/ice/base/ice_acl.c           |    2 +-
 drivers/net/ice/base/ice_acl.h           |    2 +-
 drivers/net/ice/base/ice_acl_ctrl.c      |    2 +-
 drivers/net/ice/base/ice_adminq_cmd.h    |  143 +-
 drivers/net/ice/base/ice_alloc.h         |    2 +-
 drivers/net/ice/base/ice_bitops.h        |    2 +-
 drivers/net/ice/base/ice_bst_tcam.c      |    2 +-
 drivers/net/ice/base/ice_bst_tcam.h      |    2 +-
 drivers/net/ice/base/ice_cgu_regs.h      |    2 +-
 drivers/net/ice/base/ice_common.c        |  820 ++++----
 drivers/net/ice/base/ice_common.h        |   25 +-
 drivers/net/ice/base/ice_controlq.c      |  109 +-
 drivers/net/ice/base/ice_controlq.h      |    5 +-
 drivers/net/ice/base/ice_dcb.c           |    6 +-
 drivers/net/ice/base/ice_dcb.h           |    2 +-
 drivers/net/ice/base/ice_ddp.c           |   19 +-
 drivers/net/ice/base/ice_ddp.h           |    4 +-
 drivers/net/ice/base/ice_defs.h          |    2 +-
 drivers/net/ice/base/ice_devids.h        |   26 +-
 drivers/net/ice/base/ice_fdir.c          |    2 +-
 drivers/net/ice/base/ice_fdir.h          |    2 +-
 drivers/net/ice/base/ice_flex_pipe.c     |    2 +-
 drivers/net/ice/base/ice_flex_pipe.h     |    2 +-
 drivers/net/ice/base/ice_flex_type.h     |    2 +-
 drivers/net/ice/base/ice_flg_rd.c        |    2 +-
 drivers/net/ice/base/ice_flg_rd.h        |    2 +-
 drivers/net/ice/base/ice_flow.c          |   76 +-
 drivers/net/ice/base/ice_flow.h          |    9 +-
 drivers/net/ice/base/ice_hw_autogen.h    | 1642 +++++++++++++++-
 drivers/net/ice/base/ice_imem.c          |    2 +-
 drivers/net/ice/base/ice_imem.h          |    2 +-
 drivers/net/ice/base/ice_lan_tx_rx.h     |   20 +-
 drivers/net/ice/base/ice_metainit.c      |    2 +-
 drivers/net/ice/base/ice_metainit.h      |    2 +-
 drivers/net/ice/base/ice_mk_grp.c        |    2 +-
 drivers/net/ice/base/ice_mk_grp.h        |    2 +-
 drivers/net/ice/base/ice_nvm.c           |   71 +-
 drivers/net/ice/base/ice_nvm.h           |    3 +-
 drivers/net/ice/base/ice_parser.c        |    2 +-
 drivers/net/ice/base/ice_parser.h        |    2 +-
 drivers/net/ice/base/ice_parser_rt.c     |    2 +-
 drivers/net/ice/base/ice_parser_rt.h     |    2 +-
 drivers/net/ice/base/ice_parser_util.h   |    2 +-
 drivers/net/ice/base/ice_pg_cam.c        |    2 +-
 drivers/net/ice/base/ice_pg_cam.h        |    2 +-
 drivers/net/ice/base/ice_proto_grp.c     |    2 +-
 drivers/net/ice/base/ice_proto_grp.h     |    2 +-
 drivers/net/ice/base/ice_protocol_type.h |   24 +-
 drivers/net/ice/base/ice_ptp_consts.h    |    2 +-
 drivers/net/ice/base/ice_ptp_hw.c        | 2263 +++++-----------------
 drivers/net/ice/base/ice_ptp_hw.h        |  149 +-
 drivers/net/ice/base/ice_ptype_mk.c      |    2 +-
 drivers/net/ice/base/ice_ptype_mk.h      |    2 +-
 drivers/net/ice/base/ice_sbq_cmd.h       |    2 +-
 drivers/net/ice/base/ice_sched.c         |  415 +++-
 drivers/net/ice/base/ice_sched.h         |   73 +-
 drivers/net/ice/base/ice_status.h        |    2 +-
 drivers/net/ice/base/ice_switch.c        | 1271 +++++++-----
 drivers/net/ice/base/ice_switch.h        |   44 +-
 drivers/net/ice/base/ice_tmatch.h        |    2 +-
 drivers/net/ice/base/ice_type.h          |  153 +-
 drivers/net/ice/base/ice_vlan_mode.c     |    2 +-
 drivers/net/ice/base/ice_vlan_mode.h     |    2 +-
 drivers/net/ice/base/ice_xlt_kb.c        |    2 +-
 drivers/net/ice/base/ice_xlt_kb.h        |    2 +-
 drivers/net/ice/ice_ethdev.c             |   13 +-
 67 files changed, 4594 insertions(+), 2875 deletions(-)
Signature · 1 line
2.25.1
#1 lore raw

PATCH 1/30 net/ice/base: updated copyright

Updated copyright to 2023.

---
 drivers/net/ice/base/README              | 2 +-
 drivers/net/ice/base/ice_acl.c           | 2 +-
 drivers/net/ice/base/ice_acl.h           | 2 +-
 drivers/net/ice/base/ice_acl_ctrl.c      | 2 +-
 drivers/net/ice/base/ice_adminq_cmd.h    | 2 +-
 drivers/net/ice/base/ice_alloc.h         | 2 +-
 drivers/net/ice/base/ice_bitops.h        | 2 +-
 drivers/net/ice/base/ice_bst_tcam.c      | 2 +-
 drivers/net/ice/base/ice_bst_tcam.h      | 2 +-
 drivers/net/ice/base/ice_cgu_regs.h      | 2 +-
 drivers/net/ice/base/ice_common.c        | 2 +-
 drivers/net/ice/base/ice_common.h        | 2 +-
 drivers/net/ice/base/ice_controlq.c      | 2 +-
 drivers/net/ice/base/ice_controlq.h      | 2 +-
 drivers/net/ice/base/ice_dcb.c           | 2 +-
 drivers/net/ice/base/ice_dcb.h           | 2 +-
 drivers/net/ice/base/ice_ddp.c           | 2 +-
 drivers/net/ice/base/ice_ddp.h           | 2 +-
 drivers/net/ice/base/ice_defs.h          | 2 +-
 drivers/net/ice/base/ice_devids.h        | 2 +-
 drivers/net/ice/base/ice_fdir.c          | 2 +-
 drivers/net/ice/base/ice_fdir.h          | 2 +-
 drivers/net/ice/base/ice_flex_pipe.c     | 2 +-
 drivers/net/ice/base/ice_flex_pipe.h     | 2 +-
 drivers/net/ice/base/ice_flex_type.h     | 2 +-
 drivers/net/ice/base/ice_flg_rd.c        | 2 +-
 drivers/net/ice/base/ice_flg_rd.h        | 2 +-
 drivers/net/ice/base/ice_flow.c          | 2 +-
 drivers/net/ice/base/ice_flow.h          | 2 +-
 drivers/net/ice/base/ice_hw_autogen.h    | 2 +-
 drivers/net/ice/base/ice_imem.c          | 2 +-
 drivers/net/ice/base/ice_imem.h          | 2 +-
 drivers/net/ice/base/ice_lan_tx_rx.h     | 2 +-
 drivers/net/ice/base/ice_metainit.c      | 2 +-
 drivers/net/ice/base/ice_metainit.h      | 2 +-
 drivers/net/ice/base/ice_mk_grp.c        | 2 +-
 drivers/net/ice/base/ice_mk_grp.h        | 2 +-
 drivers/net/ice/base/ice_nvm.c           | 2 +-
 drivers/net/ice/base/ice_nvm.h           | 2 +-
 drivers/net/ice/base/ice_parser.c        | 2 +-
 drivers/net/ice/base/ice_parser.h        | 2 +-
 drivers/net/ice/base/ice_parser_rt.c     | 2 +-
 drivers/net/ice/base/ice_parser_rt.h     | 2 +-
 drivers/net/ice/base/ice_parser_util.h   | 2 +-
 drivers/net/ice/base/ice_pg_cam.c        | 2 +-
 drivers/net/ice/base/ice_pg_cam.h        | 2 +-
 drivers/net/ice/base/ice_proto_grp.c     | 2 +-
 drivers/net/ice/base/ice_proto_grp.h     | 2 +-
 drivers/net/ice/base/ice_protocol_type.h | 2 +-
 drivers/net/ice/base/ice_ptp_consts.h    | 2 +-
 drivers/net/ice/base/ice_ptp_hw.c        | 2 +-
 drivers/net/ice/base/ice_ptp_hw.h        | 2 +-
 drivers/net/ice/base/ice_ptype_mk.c      | 2 +-
 drivers/net/ice/base/ice_ptype_mk.h      | 2 +-
 drivers/net/ice/base/ice_sbq_cmd.h       | 2 +-
 drivers/net/ice/base/ice_sched.c         | 2 +-
 drivers/net/ice/base/ice_sched.h         | 2 +-
 drivers/net/ice/base/ice_status.h        | 2 +-
 drivers/net/ice/base/ice_switch.c        | 2 +-
 drivers/net/ice/base/ice_switch.h        | 2 +-
 drivers/net/ice/base/ice_tmatch.h        | 2 +-
 drivers/net/ice/base/ice_type.h          | 2 +-
 drivers/net/ice/base/ice_vlan_mode.c     | 2 +-
 drivers/net/ice/base/ice_vlan_mode.h     | 2 +-
 drivers/net/ice/base/ice_xlt_kb.c        | 2 +-
 drivers/net/ice/base/ice_xlt_kb.h        | 2 +-
 66 files changed, 66 insertions(+), 66 deletions(-)
drivers/net/ice/base/README +1 -1
index 0e37a5f7a1..d3b96e0fb4 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2020-2022 Intel Corporation
+ * Copyright(c) 2020-2023 Intel Corporation
  */
 
 Intel® ICE driver
drivers/net/ice/base/ice_acl.c +1 -1
index 23b6c608be..fd9c6d5c14 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2001-2022 Intel Corporation
+ * Copyright(c) 2001-2023 Intel Corporation
  */
 
 #include "ice_acl.h"
drivers/net/ice/base/ice_acl.h +1 -1
index b5f2ec04a4..ac703be0a1 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2001-2022 Intel Corporation
+ * Copyright(c) 2001-2023 Intel Corporation
  */
 
 #ifndef _ICE_ACL_H_
drivers/net/ice/base/ice_acl_ctrl.c +1 -1
index 3a912f2aa0..2223a8313b 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2001-2022 Intel Corporation
+ * Copyright(c) 2001-2023 Intel Corporation
  */
 
 #include "ice_acl.h"
drivers/net/ice/base/ice_adminq_cmd.h +1 -1
index 5a817982b4..65cba9ab37 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2001-2022 Intel Corporation
+ * Copyright(c) 2001-2023 Intel Corporation
  */
 
 #ifndef _ICE_ADMINQ_CMD_H_
drivers/net/ice/base/ice_alloc.h +1 -1
index dca502ab25..6487cdc210 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2001-2022 Intel Corporation
+ * Copyright(c) 2001-2023 Intel Corporation
  */
 
 #ifndef _ICE_ALLOC_H_
drivers/net/ice/base/ice_bitops.h +1 -1
index c4ae2b9c8e..5384e99415 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2001-2022 Intel Corporation
+ * Copyright(c) 2001-2023 Intel Corporation
  */
 
 #ifndef _ICE_BITOPS_H_
drivers/net/ice/base/ice_bst_tcam.c +1 -1
index 5cc0d12251..fbe106df60 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2001-2022 Intel Corporation
+ * Copyright(c) 2001-2023 Intel Corporation
  */
 
 #include "ice_common.h"
drivers/net/ice/base/ice_bst_tcam.h +1 -1
index 292444c919..2fb2c8421e 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2001-2022 Intel Corporation
+ * Copyright(c) 2001-2023 Intel Corporation
  */
 
 #ifndef _ICE_BST_TCAM_H_
drivers/net/ice/base/ice_cgu_regs.h +1 -1
index 6b9a359c5b..c44bfc1846 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2001-2022 Intel Corporation
+ * Copyright(c) 2001-2023 Intel Corporation
  */
 
 #ifndef _ICE_CGU_REGS_H_
drivers/net/ice/base/ice_common.c +1 -1
index 1a02aad869..fa30c50ca1 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2001-2022 Intel Corporation
+ * Copyright(c) 2001-2023 Intel Corporation
  */
 
 #include "ice_common.h"
drivers/net/ice/base/ice_common.h +1 -1
index 58260afb93..e1febfb0c4 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2001-2022 Intel Corporation
+ * Copyright(c) 2001-2023 Intel Corporation
  */
 
 #ifndef _ICE_COMMON_H_
drivers/net/ice/base/ice_controlq.c +1 -1
index 8971a140ef..c34407b48c 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2001-2022 Intel Corporation
+ * Copyright(c) 2001-2023 Intel Corporation
  */
 
 #include "ice_common.h"
drivers/net/ice/base/ice_controlq.h +1 -1
index 45fe70450e..986604ec3c 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2001-2022 Intel Corporation
+ * Copyright(c) 2001-2023 Intel Corporation
  */
 
 #ifndef _ICE_CONTROLQ_H_
drivers/net/ice/base/ice_dcb.c +1 -1
index 0e604df541..2a308b02bf 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2001-2022 Intel Corporation
+ * Copyright(c) 2001-2023 Intel Corporation
  */
 
 #include "ice_common.h"
drivers/net/ice/base/ice_dcb.h +1 -1
index d010c539a6..bae033a460 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2001-2022 Intel Corporation
+ * Copyright(c) 2001-2023 Intel Corporation
  */
 
 #ifndef _ICE_DCB_H_
drivers/net/ice/base/ice_ddp.c +1 -1
index d1cae48047..93ff2608d4 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2001-2022 Intel Corporation
+ * Copyright(c) 2001-2023 Intel Corporation
  */
 
 #include "ice_ddp.h"
drivers/net/ice/base/ice_ddp.h +1 -1
index 53bbbe2a5a..4896e85b91 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2001-2022 Intel Corporation
+ * Copyright(c) 2001-2023 Intel Corporation
  */
 
 #ifndef _ICE_DDP_H_
drivers/net/ice/base/ice_defs.h +1 -1
index 6e886f6aac..210ce6263b 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2001-2022 Intel Corporation
+ * Copyright(c) 2001-2023 Intel Corporation
  */
 
 #ifndef _ICE_DEFS_H_
drivers/net/ice/base/ice_devids.h +1 -1
index 13a4b16402..f80789ebc5 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2001-2022 Intel Corporation
+ * Copyright(c) 2001-2023 Intel Corporation
  */
 
 #ifndef _ICE_DEVIDS_H_
drivers/net/ice/base/ice_fdir.c +1 -1
index 85ca29bae5..3ed2a63b68 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2001-2022 Intel Corporation
+ * Copyright(c) 2001-2023 Intel Corporation
  */
 
 #include "ice_common.h"
drivers/net/ice/base/ice_fdir.h +1 -1
index f338da38c2..81ba6008e4 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2001-2022 Intel Corporation
+ * Copyright(c) 2001-2023 Intel Corporation
  */
 
 #ifndef _ICE_FDIR_H_
drivers/net/ice/base/ice_flex_pipe.c +1 -1
index b6bc0062a3..f9266447d9 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2001-2022 Intel Corporation
+ * Copyright(c) 2001-2023 Intel Corporation
  */
 
 #include "ice_common.h"
drivers/net/ice/base/ice_flex_pipe.h +1 -1
index 9ba337e1fa..422d09becc 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2001-2022 Intel Corporation
+ * Copyright(c) 2001-2023 Intel Corporation
  */
 
 #ifndef _ICE_FLEX_PIPE_H_
drivers/net/ice/base/ice_flex_type.h +1 -1
index 7b8f6f9049..c83479d6fa 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2001-2022 Intel Corporation
+ * Copyright(c) 2001-2023 Intel Corporation
  */
 
 #ifndef _ICE_FLEX_TYPE_H_
drivers/net/ice/base/ice_flg_rd.c +1 -1
index f320958bd3..97f62e6cc4 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2001-2022 Intel Corporation
+ * Copyright(c) 2001-2023 Intel Corporation
  */
 
 #include "ice_common.h"
drivers/net/ice/base/ice_flg_rd.h +1 -1
index 8cd375f89f..c194a4f462 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2001-2022 Intel Corporation
+ * Copyright(c) 2001-2023 Intel Corporation
  */
 
 #ifndef _ICE_FLG_RD_H_
drivers/net/ice/base/ice_flow.c +1 -1
index 3483a5ed4f..5254ee27ed 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2001-2022 Intel Corporation
+ * Copyright(c) 2001-2023 Intel Corporation
  */
 
 #include "ice_common.h"
drivers/net/ice/base/ice_flow.h +1 -1
index dba71aab74..57e8e1f1df 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2001-2022 Intel Corporation
+ * Copyright(c) 2001-2023 Intel Corporation
  */
 
 #ifndef _ICE_FLOW_H_
drivers/net/ice/base/ice_hw_autogen.h +1 -1
index 6dc77bf7cb..4610cec6a7 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2001-2022 Intel Corporation
+ * Copyright(c) 2001-2023 Intel Corporation
  */
 
 /* Machine generated file. Do not edit. */
drivers/net/ice/base/ice_imem.c +1 -1
index 277311fd20..f193aaf836 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2001-2022 Intel Corporation
+ * Copyright(c) 2001-2023 Intel Corporation
  */
 
 #include "ice_common.h"
drivers/net/ice/base/ice_imem.h +1 -1
index 06d3d5a96d..0328830b94 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2001-2022 Intel Corporation
+ * Copyright(c) 2001-2023 Intel Corporation
  */
 
 #ifndef _ICE_IMEM_H_
drivers/net/ice/base/ice_lan_tx_rx.h +1 -1
index be6d88f0ca..d816df0ff6 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2001-2022 Intel Corporation
+ * Copyright(c) 2001-2023 Intel Corporation
  */
 
 #ifndef _ICE_LAN_TX_RX_H_
drivers/net/ice/base/ice_metainit.c +1 -1
index b75d68c010..1e990c9aa0 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2001-2022 Intel Corporation
+ * Copyright(c) 2001-2023 Intel Corporation
  */
 
 #include "ice_common.h"
drivers/net/ice/base/ice_metainit.h +1 -1
index dad4faf4d4..440932ae30 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2001-2022 Intel Corporation
+ * Copyright(c) 2001-2023 Intel Corporation
  */
 
 #ifndef _ICE_METAINIT_H_
drivers/net/ice/base/ice_mk_grp.c +1 -1
index cafe51544d..9de4527b58 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2001-2022 Intel Corporation
+ * Copyright(c) 2001-2023 Intel Corporation
  */
 
 #include "ice_common.h"
drivers/net/ice/base/ice_mk_grp.h +1 -1
index 9401647ef0..161dd724cb 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2001-2022 Intel Corporation
+ * Copyright(c) 2001-2023 Intel Corporation
  */
 
 #ifndef _ICE_MK_GRP_H_
drivers/net/ice/base/ice_nvm.c +1 -1
index 6550dda557..cb45cb8134 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2001-2022 Intel Corporation
+ * Copyright(c) 2001-2023 Intel Corporation
  */
 
 #include "ice_common.h"
drivers/net/ice/base/ice_nvm.h +1 -1
index a8cda452db..c3e61a301f 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2001-2022 Intel Corporation
+ * Copyright(c) 2001-2023 Intel Corporation
  */
 
 #ifndef _ICE_NVM_H_
drivers/net/ice/base/ice_parser.c +1 -1
index a1b906d369..79c97f7903 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2001-2022 Intel Corporation
+ * Copyright(c) 2001-2023 Intel Corporation
  */
 
 #include "ice_common.h"
drivers/net/ice/base/ice_parser.h +1 -1
index b4c5e7b14d..0f64584898 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2001-2022 Intel Corporation
+ * Copyright(c) 2001-2023 Intel Corporation
  */
 
 #ifndef _ICE_PARSER_H_
drivers/net/ice/base/ice_parser_rt.c +1 -1
index 215e11abd2..68c0f5d7fb 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2001-2022 Intel Corporation
+ * Copyright(c) 2001-2023 Intel Corporation
  */
 
 #include "ice_common.h"
drivers/net/ice/base/ice_parser_rt.h +1 -1
index c1e1af0059..de851643b4 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2001-2022 Intel Corporation
+ * Copyright(c) 2001-2023 Intel Corporation
  */
 
 #ifndef _ICE_PARSER_RT_H_
drivers/net/ice/base/ice_parser_util.h +1 -1
index a33d6bf11c..9949b985ee 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2001-2022 Intel Corporation
+ * Copyright(c) 2001-2023 Intel Corporation
  */
 
 #ifndef _ICE_PARSER_UTIL_H_
drivers/net/ice/base/ice_pg_cam.c +1 -1
index f06a3581a0..e6324945fb 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2001-2022 Intel Corporation
+ * Copyright(c) 2001-2023 Intel Corporation
  */
 
 #include "ice_common.h"
drivers/net/ice/base/ice_pg_cam.h +1 -1
index ac0863afb0..0412ac5ae2 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2001-2022 Intel Corporation
+ * Copyright(c) 2001-2023 Intel Corporation
  */
 
 #ifndef _ICE_PG_CAM_H_
drivers/net/ice/base/ice_proto_grp.c +1 -1
index a9ed9e051f..94f4df0aaa 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2001-2022 Intel Corporation
+ * Copyright(c) 2001-2023 Intel Corporation
  */
 
 #include "ice_common.h"
drivers/net/ice/base/ice_proto_grp.h +1 -1
index 762d32464b..dc6d8a32a4 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2001-2022 Intel Corporation
+ * Copyright(c) 2001-2023 Intel Corporation
  */
 
 #ifndef _ICE_PROTO_GRP_H_
drivers/net/ice/base/ice_protocol_type.h +1 -1
index d17ab54bd3..eeaf044059 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2001-2022 Intel Corporation
+ * Copyright(c) 2001-2023 Intel Corporation
  */
 
 #ifndef _ICE_PROTOCOL_TYPE_H_
drivers/net/ice/base/ice_ptp_consts.h +1 -1
index ddf6242d8e..546bf8ba91 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2001-2022 Intel Corporation
+ * Copyright(c) 2001-2023 Intel Corporation
  */
 
 #ifndef _ICE_PTP_CONSTS_H_
drivers/net/ice/base/ice_ptp_hw.c +1 -1
index a0b8af1b94..548ef5e820 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2001-2022 Intel Corporation
+ * Copyright(c) 2001-2023 Intel Corporation
  */
 
 #include "ice_type.h"
drivers/net/ice/base/ice_ptp_hw.h +1 -1
index 09c236e7e0..3667c9882d 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2001-2022 Intel Corporation
+ * Copyright(c) 2001-2023 Intel Corporation
  */
 
 #ifndef _ICE_PTP_HW_H_
drivers/net/ice/base/ice_ptype_mk.c +1 -1
index 4cd8396167..6814095dbd 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2001-2022 Intel Corporation
+ * Copyright(c) 2001-2023 Intel Corporation
  */
 
 #include "ice_common.h"
drivers/net/ice/base/ice_ptype_mk.h +1 -1
index 3efe294dda..66427c6866 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2001-2022 Intel Corporation
+ * Copyright(c) 2001-2023 Intel Corporation
  */
 
 #ifndef _ICE_PTYPE_MK_H_
drivers/net/ice/base/ice_sbq_cmd.h +1 -1
index a215303a56..4da16caf70 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2001-2022 Intel Corporation
+ * Copyright(c) 2001-2023 Intel Corporation
  */
 
 #ifndef _ICE_SBQ_CMD_H_
drivers/net/ice/base/ice_sched.c +1 -1
index a526c8f32c..83cd152388 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2001-2022 Intel Corporation
+ * Copyright(c) 2001-2023 Intel Corporation
  */
 
 #include "ice_sched.h"
drivers/net/ice/base/ice_sched.h +1 -1
index 3724ef33a8..a71619ebf0 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2001-2022 Intel Corporation
+ * Copyright(c) 2001-2023 Intel Corporation
  */
 
 #ifndef _ICE_SCHED_H_
drivers/net/ice/base/ice_status.h +1 -1
index f52121c3a3..1965347a8b 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2001-2022 Intel Corporation
+ * Copyright(c) 2001-2023 Intel Corporation
  */
 
 #ifndef _ICE_STATUS_H_
drivers/net/ice/base/ice_switch.c +1 -1
index e4eed66406..cd6237136e 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2001-2022 Intel Corporation
+ * Copyright(c) 2001-2023 Intel Corporation
  */
 
 #include "ice_common.h"
drivers/net/ice/base/ice_switch.h +1 -1
index 949c94c0c3..7a12619459 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2001-2022 Intel Corporation
+ * Copyright(c) 2001-2023 Intel Corporation
  */
 
 #ifndef _ICE_SWITCH_H_
drivers/net/ice/base/ice_tmatch.h +1 -1
index e70926acd1..a2df0c4367 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2001-2022 Intel Corporation
+ * Copyright(c) 2001-2023 Intel Corporation
  */
 
 #ifndef _ICE_TMATCH_H_
drivers/net/ice/base/ice_type.h +1 -1
index bfec317b57..da813c8307 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2001-2022 Intel Corporation
+ * Copyright(c) 2001-2023 Intel Corporation
  */
 
 #ifndef _ICE_TYPE_H_
drivers/net/ice/base/ice_vlan_mode.c +1 -1
index 74d414b3b8..7ee00df124 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2001-2022 Intel Corporation
+ * Copyright(c) 2001-2023 Intel Corporation
  */
 
 #include "ice_common.h"
drivers/net/ice/base/ice_vlan_mode.h +1 -1
index 5e3f454a25..d2380eb94b 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2001-2022 Intel Corporation
+ * Copyright(c) 2001-2023 Intel Corporation
  */
 
 #ifndef _ICE_VLAN_MODE_H_
drivers/net/ice/base/ice_xlt_kb.c +1 -1
index 59472a08d4..b8240946b4 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2001-2022 Intel Corporation
+ * Copyright(c) 2001-2023 Intel Corporation
  */
 
 #include "ice_common.h"
drivers/net/ice/base/ice_xlt_kb.h +1 -1
index f870f18ed6..0cce33142a 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2001-2022 Intel Corporation
+ * Copyright(c) 2001-2023 Intel Corporation
  */
 
 #ifndef _ICE_XLT_KB_H_
Signature · 1 line
2.25.1
#2 lore raw

PATCH 2/30 net/ice/base: add flex array safe allocations

In reply to Qiming Yang

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.
And refactor structure size macros. The driver used several macros to compute size of flexible arrays. These macros are just as well converted to plain code that does struct_size.

---
 drivers/net/ice/base/ice_adminq_cmd.h |  57 +++---
 drivers/net/ice/base/ice_switch.c     | 265 +++++++++++++-------------
 drivers/net/ice/base/ice_switch.h     |  12 --
 3 files changed, 165 insertions(+), 169 deletions(-)
drivers/net/ice/base/ice_adminq_cmd.h +30 -27
index 65cba9ab37..69e528a8c9 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 */
@@ -866,6 +884,8 @@ struct ice_sw_rule_lkup_rx_tx {
 #define ICE_SINGLE_ACT_PTR		0x2
 #define ICE_SINGLE_ACT_PTR_VAL_S	4
 #define ICE_SINGLE_ACT_PTR_VAL_M	(0x1FFF << ICE_SINGLE_ACT_PTR_VAL_S)
+	/* Bit 17 should be set if pointed action includes a FWD cmd */
+#define ICE_SINGLE_ACT_PTR_HAS_FWD	BIT(17)
 	/* Bit 18 should be set to 1 */
 #define ICE_SINGLE_ACT_PTR_BIT		BIT(18)
 
@@ -895,14 +915,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 +980,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 +1004,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
  */
@@ -2771,7 +2774,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 +135 -130

641 lines not on this page · raw message

drivers/net/ice/base/ice_switch.h +0 -12
index 7a12619459..c55ef19a8c 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.25.1
#3 lore raw

PATCH 3/30 net/ice/base: remove unnecessary control queue array

In reply to Qiming Yang

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. And improve debug print for control queue messages.

---
 drivers/net/ice/base/ice_controlq.c | 107 +++++++++++++++-------------
 drivers/net/ice/base/ice_controlq.h |   3 -
 2 files changed, 56 insertions(+), 54 deletions(-)
drivers/net/ice/base/ice_controlq.c +56 -51
index c34407b48c..acd6ad249b 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 ICE_SUCCESS;
 }
 
@@ -176,7 +169,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);
@@ -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)
@@ -379,11 +369,11 @@ static enum ice_status 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 +431,7 @@ static enum ice_status 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 +451,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 +824,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
  *
@@ -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;
@@ -866,16 +852,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 +901,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 +927,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 +951,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.
  */
 enum ice_status
 ice_sq_send_cmd_nolock(struct ice_hw *hw, struct ice_ctl_q_info *cq,
@@ -950,7 +964,6 @@ ice_sq_send_cmd_nolock(struct ice_hw *hw, struct ice_ctl_q_info *cq,
 	struct ice_aq_desc *desc_on_ring;
 	bool cmd_completed = false;
 	enum ice_status status = ICE_SUCCESS;
-	struct ice_sq_cd *details;
 	u32 total_delay = 0;
 	u16 retval = 0;
 	u32 val = 0;
@@ -993,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
@@ -1035,8 +1042,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,13 +1090,12 @@ 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)
-		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) {
@@ -1109,7 +1114,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 +1122,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.
  */
 enum ice_status
 ice_sq_send_cmd(struct ice_hw *hw, struct ice_ctl_q_info *cq,
@@ -1160,9 +1166,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.
  */
 enum ice_status
 ice_clean_rq_elem(struct ice_hw *hw, struct ice_ctl_q_info *cq,
@@ -1218,8 +1224,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
drivers/net/ice/base/ice_controlq.h +0 -3
index 986604ec3c..5c60469693 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,8 +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 {
 	struct ice_aq_desc desc;
Signature · 1 line
2.25.1
#4 lore raw

Re: [**EXTERNAL**] [PATCH 03/30] net/ice/base: remove unnecessary control queue array

Hi @Qiming Yang<mailto:[email protected]>, @Jacob Keller<mailto:[email protected]>

Good day!
I am seeing a crash in ice/base running DPDK-2111-stable. We use VPP.
While looking at DPDK-emails, I see some relevant changes here.
Can you please take a look at the back-trace and suggest/point if this has been found and fixed ?

(gdb) bt

#0  __pthread_kill_implementation (threadid=<optimized out>, signo=signo@entry=6, no_tid=no_tid@entry=0) at pthread_kill.c:44
#1  0x00007fb6f9983773 in __pthread_kill_internal (signo=6, threadid=<optimized out>) at pthread_kill.c:78
#2  0x00007fb6f9938876 in __GI_raise (sig=sig@entry=6) at ../sysdeps/posix/raise.c:26
#3  0x00007fb6f99237e3 in __GI_abort () at abort.c:79
#4  0x00000000004083fa in os_exit (code=code@entry=1) at /usr/src/debug/vpp/21.01+gitAUTOINC+fdd8bd2f89-r0/git/src/vpp/vnet/main.c:434
#5  0x00007fb6f9c6b8d1 in unix_signal_handler (signum=11, si=<optimized out>, uc=<optimized out>) at /usr/src/debug/vpp/21.01+gitAUTOINC+fdd8bd2f89-r0/git/src/vlib/unix/main.c:190
#6  <signal handler called>
#7  0x00007fb6b37e5850 in ice_sq_send_cmd_nolock (hw=0xac0318700, cq=0xac031a1c0, desc=0x7fb6b643c5e0, buf=0xac2a78200, buf_size=6, cd=0x0) at ../git/drivers/net/ice/base/ice_controlq.c:1058
#8  0x00007fb6b37f428a in ice_sq_send_cmd (hw=0xac0318700, cq=0xac031a1c0, desc=0x7fb6b643c5e0, buf=0xac2a78200, buf_size=6, cd=0x0) at ../git/drivers/net/ice/base/ice_controlq.c:1126
#9  0x00007fb6b3824ddb in ice_sq_send_cmd_retry (hw=0xac0318700, cq=0xac031a1c0, desc=0x7fb6b643c5e0, buf=0xac2a78200, buf_size=6, cd=0x0) at ../git/drivers/net/ice/base/ice_common.c:1729

#10 0x00007fb6b38335ee in ice_aq_send_cmd (hw=0xac0318700, desc=0x7fb6b643c5e0, buf=0xac2a78200, buf_size=6, cd=0x0) at ../git/drivers/net/ice/base/ice_common.c:1788 #11 0x00007fb6b3833fca in ice_aq_alloc_free_res (hw=0xac0318700, num_entries=1, buf=0xac2a78200, buf_size=6, opc=ice_aqc_opc_alloc_res, cd=0x0) at ../git/drivers/net/ice/base/ice_common.c:2124 #12 0x00007fb6b38340a1 in ice_alloc_hw_res (hw=0xac0318700, type=96, num=1, btm=false, res=0x7fb6b643f348) at ../git/drivers/net/ice/base/ice_common.c:2154
#13 0x00007fb6b39e25e8 in ice_alloc_prof_id (hw=0xac0318700, blk=ICE_BLK_RSS, prof_id=0x7fb6b643f39f "") at ../git/drivers/net/ice/base/ice_flex_pipe.c:3309
#14 0x00007fb6b3a03659 in ice_add_prof (hw=0xac0318700, blk=ICE_BLK_RSS, id=17179875328, ptypes=0xac2a790fc "", attr=0x0, attr_cnt=0, es=0xac2a78fd0, masks=0xac2a7909a, fd_swap=true)

    at ../git/drivers/net/ice/base/ice_flex_pipe.c:5028
#15 0x00007fb6b3a20210 in ice_flow_add_prof_sync (hw=0xac0318700, blk=ICE_BLK_RSS, dir=ICE_FLOW_RX, prof_id=17179875328, segs=0xac2a79200, segs_cnt=1 '\001', acts=0x0, acts_cnt=0 '\000',
    prof=0x7fb6b6444f10) at ../git/drivers/net/ice/base/ice_flow.c:2245
#16 0x00007fb6b3a20f9a in ice_flow_add_prof (hw=0xac0318700, blk=ICE_BLK_RSS, dir=ICE_FLOW_RX, prof_id=17179875328, segs=0xac2a79200, segs_cnt=1 '\001', acts=0x0, acts_cnt=0 '\000',
    prof=0x7fb6b6444f10) at ../git/drivers/net/ice/base/ice_flow.c:2646

#17 0x00007fb6b3a483af in ice_add_rss_cfg_sync (hw=0xac0318700, vsi_handle=0, cfg=0x7fb6b6444f60) at ../git/drivers/net/ice/base/ice_flow.c:4276 #18 0x00007fb6b3a48503 in ice_add_rss_cfg (hw=0xac0318700, vsi_handle=0, cfg=0x7fb6b6444fe0) at ../git/drivers/net/ice/base/ice_flow.c:4329 #19 0x00007fb6b3c18577 in ice_add_rss_cfg_wrap (pf=0xac031b718, vsi_id=0, cfg=0x7fb6b6444fe0) at ../git/drivers/net/ice/ice_ethdev.c:2998 #20 0x00007fb6b3c186cc in ice_rss_hash_set (pf=0xac031b718, rss_hf=12220) at ../git/drivers/net/ice/ice_ethdev.c:3038
#21 0x00007fb6b3c2eba9 in ice_init_rss (pf=0xac031b718) at ../git/drivers/net/ice/ice_ethdev.c:3289
#22 0x00007fb6b3c2eccd in ice_dev_configure (dev=0x7fb6b8dc04c0 <rte_eth_devices>) at ../git/drivers/net/ice/ice_ethdev.c:3323
#23 0x00007fb6b8ca82a3 in rte_eth_dev_configure (port_id=0, nb_rx_q=2, nb_tx_q=3, dev_conf=0x7fb6bbde3820) at ../git/lib/ethdev/rte_ethdev.c:1633 #24 0x00007fb6b8fb7fef in dpdk_device_setup (xd=xd@entry=0x7fb6bbde37c0) at /usr/src/debug/vpp/21.01+gitAUTOINC+fdd8bd2f89-r0/git/src/plugins/dpdk/device/common.c:92 #25 0x00007fb6b8fcbe37 in dpdk_lib_init (dm=0x7fb6b901d260 <dpdk_main>) at /usr/src/debug/vpp/21.01+gitAUTOINC+fdd8bd2f89-r0/git/src/plugins/dpdk/device/init.c:759 #26 0x00007fb6b8fd0936 in dpdk_process (vm=0x4aef40 <vlib_global_main>, rt=<optimized out>, f=<optimized out>)

    at /usr/src/debug/vpp/21.01+gitAUTOINC+fdd8bd2f89-r0/git/src/plugins/dpdk/device/init.c:1684

#27 0x00007fb6f9c1c7b7 in vlib_process_bootstrap (_a=<optimized out>) at /usr/src/debug/vpp/21.01+gitAUTOINC+fdd8bd2f89-r0/git/src/vlib/main.c:1477
#28 0x00007fb6f9b24ea8 in clib_calljmp () at /usr/src/debug/vpp/21.01+gitAUTOINC+fdd8bd2f89-r0/git/src/vppinfra/longjmp.S:123
#29 0x00007fb6b8656d10 in ?? ()
#30 0x00007fb6f9c2075c in vlib_process_startup (f=0x0, p=0x7fb6b966e080, vm=0x4aef40 <vlib_global_main>) at /usr/src/debug/vpp/21.01+gitAUTOINC+fdd8bd2f89-r0/git/src/vlib/main.c:1502 #31 dispatch_process (vm=0x4aef40 <vlib_global_main>, p=0x7fb6b966e080, last_time_stamp=<optimized out>, f=0x0) at /usr/src/debug/vpp/21.01+gitAUTOINC+fdd8bd2f89-r0/git/src/vlib/main.c:1558 #32 0x0000000000000000 in ?? ()

Thanks,
Leela sankar

From: Qiming Yang <[email protected]>
Date: Thursday, April 27, 2023 at 1:38 AM
To: [email protected] <[email protected]>
Cc: [email protected] <[email protected]>, Qiming Yang <[email protected]>, Jacob Keller <[email protected]>
Subject: [**EXTERNAL**] [PATCH 03/30] net/ice/base: remove unnecessary control queue array
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. And improve debug print for control queue messages.

---
 drivers/net/ice/base/ice_controlq.c | 107 +++++++++++++++-------------
 drivers/net/ice/base/ice_controlq.h |   3 -
 2 files changed, 56 insertions(+), 54 deletions(-)
drivers/net/ice/base/ice_controlq.c +56 -51
index c34407b48c..acd6ad249b 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 ICE_SUCCESS;
 }
 
@@ -176,7 +169,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);
@@ -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)
@@ -379,11 +369,11 @@ static enum ice_status 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 +431,7 @@ static enum ice_status 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 +451,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 +824,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
  *
@@ -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;
@@ -866,16 +852,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 +901,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 +927,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 +951,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.
  */
 enum ice_status
 ice_sq_send_cmd_nolock(struct ice_hw *hw, struct ice_ctl_q_info *cq,
@@ -950,7 +964,6 @@ ice_sq_send_cmd_nolock(struct ice_hw *hw, struct ice_ctl_q_info *cq,
         struct ice_aq_desc *desc_on_ring;
         bool cmd_completed = false;
         enum ice_status status = ICE_SUCCESS;
-       struct ice_sq_cd *details;
         u32 total_delay = 0;
         u16 retval = 0;
         u32 val = 0;
@@ -993,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
@@ -1035,8 +1042,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,13 +1090,12 @@ 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)
-               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) {
@@ -1109,7 +1114,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 +1122,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.
  */
 enum ice_status
 ice_sq_send_cmd(struct ice_hw *hw, struct ice_ctl_q_info *cq,
@@ -1160,9 +1166,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.
  */
 enum ice_status
 ice_clean_rq_elem(struct ice_hw *hw, struct ice_ctl_q_info *cq,
@@ -1218,8 +1224,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
drivers/net/ice/base/ice_controlq.h +0 -3
index 986604ec3c..5c60469693 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,8 +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 {
         struct ice_aq_desc desc;

--
2.25.1

#5 lore raw

PATCH 4/30 net/ice/base: update flow seg fields to declared bitmaps

In reply to Qiming Yang

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 | 74 +++++++++++++++++++++++----------
 drivers/net/ice/base/ice_flow.h |  6 ++-
 2 files changed, 56 insertions(+), 24 deletions(-)
drivers/net/ice/base/ice_flow.c +52 -22
index 5254ee27ed..8db394471c 100644
@@ -1132,6 +1132,7 @@ ice_flow_proc_seg_hdrs(struct ice_flow_prof_params *params)
 			ice_and_bitmap(params->ptypes, params->ptypes, src,
 				       ICE_FLOW_PTYPE_MAX);
 		}
+
 		if ((hdrs & ICE_FLOW_SEG_HDR_IPV4) &&
 		    (hdrs & ICE_FLOW_SEG_HDR_IPV_OTHER)) {
 			src = i ?
@@ -1371,7 +1372,7 @@ ice_flow_xtract_pkt_flags(struct ice_hw *hw,
  */
 static enum ice_status
 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 +1421,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 +1452,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 +1723,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 +1791,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 +1934,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 +2437,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];
 
@@ -2601,7 +2606,8 @@ ice_flow_set_hw_prof(struct ice_hw *hw, u16 dest_vsi_handle,
 			idx = i;
 		params->es[idx].prot_id = prof->fv[i].proto_id;
 		params->es[idx].off = prof->fv[i].offset;
-		params->mask[idx] = CPU_TO_BE16(prof->fv[i].msk);
+		params->mask[idx] = (((prof->fv[i].msk) << 8) & 0xff00) |
+				    (((prof->fv[i].msk) >> 8) & 0x00ff);
 	}
 
 	switch (prof->flags) {
@@ -3002,7 +3008,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];
 
@@ -3534,7 +3540,7 @@ enum ice_status ice_flow_rem_entry(struct ice_hw *hw, enum ice_block blk,
 	if (entry_h == ICE_FLOW_ENTRY_HANDLE_INVAL)
 		return ICE_ERR_PARAM;
 
-	entry = ICE_FLOW_ENTRY_PTR((intptr_t)entry_h);
+	entry = ICE_FLOW_ENTRY_PTR(entry_h);
 
 	/* Retain the pointer to the flow profile as the entry will be freed */
 	prof = entry->prof;
@@ -3576,11 +3582,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;
@@ -3741,7 +3745,7 @@ enum ice_status ice_flow_rem_vsi_prof(struct ice_hw *hw, enum ice_block blk, u16
 }
 
 #define ICE_FLOW_RSS_SEG_HDR_L2_MASKS \
-(ICE_FLOW_SEG_HDR_ETH | ICE_FLOW_SEG_HDR_ETH_NON_IP | ICE_FLOW_SEG_HDR_VLAN)
+(ICE_FLOW_SEG_HDR_ETH | ICE_FLOW_SEG_HDR_VLAN)
 
 #define ICE_FLOW_RSS_SEG_HDR_L3_MASKS \
 	(ICE_FLOW_SEG_HDR_IPV4 | ICE_FLOW_SEG_HDR_IPV6)
@@ -3856,6 +3860,7 @@ enum ice_status ice_rem_vsi_rss_cfg(struct ice_hw *hw, u16 vsi_handle)
 	const enum ice_block blk = ICE_BLK_RSS;
 	struct ice_flow_prof *p, *t;
 	enum ice_status status = ICE_SUCCESS;
+	u16 vsig;
 
 	if (!ice_is_vsi_valid(hw, vsi_handle))
 		return ICE_ERR_PARAM;
@@ -3865,7 +3870,16 @@ enum ice_status ice_rem_vsi_rss_cfg(struct ice_hw *hw, u16 vsi_handle)
 
 	ice_acquire_lock(&hw->rss_locks);
 	LIST_FOR_EACH_ENTRY_SAFE(p, t, &hw->fl_profs[blk], ice_flow_prof,
-				 l_entry)
+				 l_entry) {
+		int ret;
+
+		/* check if vsig is already removed */
+		ret = ice_vsig_find_vsi(hw, blk,
+					ice_get_hw_vsi_num(hw, vsi_handle),
+					&vsig);
+		if (!ret && !vsig)
+			break;
+
 		if (ice_is_bit_set(p->vsis, vsi_handle)) {
 			status = ice_flow_disassoc_prof(hw, blk, p, vsi_handle);
 			if (status)
@@ -3877,6 +3891,7 @@ enum ice_status ice_rem_vsi_rss_cfg(struct ice_hw *hw, u16 vsi_handle)
 					break;
 			}
 		}
+	}
 	ice_release_lock(&hw->rss_locks);
 
 	return status;
@@ -3918,6 +3933,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
@@ -3926,7 +3949,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);
@@ -3951,11 +3974,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);
@@ -3966,7 +3996,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 57e8e1f1df..1415f5ba87 100644
@@ -452,8 +452,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.25.1
#6 lore raw

PATCH 5/30 net/ice/base: clean up RSS LUT and fix media type

In reply to Qiming Yang

Refactor __ice_aq_get_set_rss_lut():
- get variant:
- 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.
- fix get media type and add the media type ICE_MEDIA_NONE.

---
 drivers/net/ice/base/ice_adminq_cmd.h |  30 ++-
 drivers/net/ice/base/ice_common.c     | 366 +++++++++++---------------
 drivers/net/ice/base/ice_common.h     |   1 +
 drivers/net/ice/base/ice_type.h       |  94 ++++++-
 4 files changed, 275 insertions(+), 216 deletions(-)
drivers/net/ice/base/ice_adminq_cmd.h +27 -3
index 69e528a8c9..8731f35022 100644
@@ -1401,7 +1401,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_* */
@@ -2191,6 +2202,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)
@@ -2199,7 +2223,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
@@ -2207,7 +2231,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 +154 -212

439 lines not on this page · raw message

drivers/net/ice/base/ice_common.h +1 -0
index e1febfb0c4..f612ce7c52 100644
@@ -100,6 +100,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);
 enum ice_status
 ice_aq_get_rss_lut(struct ice_hw *hw, struct ice_aq_get_set_rss_lut_params *get_params);
 enum ice_status
drivers/net/ice/base/ice_type.h +93 -1

106 lines not on this page · raw message

Signature · 1 line
2.25.1
#7 lore raw

PATCH 6/30 net/ice/base: add ability to set markid via switch filter

In reply to Qiming Yang

Support to add large action to set 32 bits markid via switch filter. For OVS-DPDK VXLAN acceleration solution, switch markid will be used for mega flow match for decap.
For one ptype, the pattern may have different fields as follow:
eth / ipv4 src / udp dst
eth / ipv4 dst src / udp dst
FDIR will have conflict with the same profile id. So we could chose switch to set markid.

---
 drivers/net/ice/base/ice_common.c | 17 ++++++++++-
 drivers/net/ice/base/ice_sched.c  |  2 +-
 drivers/net/ice/base/ice_switch.c | 48 +++++++++++++++++++++++++++----
 drivers/net/ice/base/ice_switch.h | 26 +++++++++--------
 drivers/net/ice/base/ice_type.h   |  3 ++
 5 files changed, 77 insertions(+), 19 deletions(-)
drivers/net/ice/base/ice_common.c +16 -1
index 006ffa802c..5bd40ece78 100644
@@ -2369,6 +2369,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;
@@ -3814,6 +3819,7 @@ enum ice_status
 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;
 
@@ -3828,7 +3834,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;
 }
 
 /**
drivers/net/ice/base/ice_sched.c +1 -1
index 83cd152388..e3a638dcdd 100644
@@ -1057,11 +1057,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;
 	enum ice_status status = ICE_SUCCESS;
+	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,
drivers/net/ice/base/ice_switch.c +43 -5

92 lines not on this page · raw message

drivers/net/ice/base/ice_switch.h +14 -12
index c55ef19a8c..49bd535c79 100644
@@ -207,19 +207,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;
@@ -227,28 +227,29 @@ 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;
 	enum ice_sw_tunnel_type type;
@@ -301,6 +302,7 @@ struct ice_adv_rule_info {
 	u8 rx; /* true means LOOKUP_RX otherwise LOOKUP_TX */
 	u16 fltr_rule_id;
 	u16 lg_id;
+	u16 vlan_type;
 	struct ice_adv_rule_flags_info flags_info;
 };
 
drivers/net/ice/base/ice_type.h +3 -0
index 3249e359de..b2df99e472 100644
@@ -693,9 +693,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 */
@@ -1458,6 +1460,7 @@ enum ice_sw_fwd_act_type {
 	ICE_FWD_TO_QGRP,
 	ICE_SET_MARK,
 	ICE_DROP_PACKET,
+	ICE_LG_ACTION,
 	ICE_INVAL_ACT
 };
 
Signature · 1 line
2.25.1
#8 lore raw

PATCH 7/30 net/ice/base: add reading cap and ropo cap

In reply to Qiming Yang

The driver can use this capability to see if temperature sensor reading or other HW sensor reading capabilities are supported before reading them using the Get Sensor Reading AQ command.
Define and add parsing support for new device capability ICE_AQC_CAPS_NAC_TOPOLOGY.

---
 drivers/net/ice/base/ice_adminq_cmd.h |  1 +
 drivers/net/ice/base/ice_common.c     | 49 +++++++++++++++++++++++++++
 drivers/net/ice/base/ice_type.h       | 13 +++++++
 3 files changed, 63 insertions(+)
drivers/net/ice/base/ice_adminq_cmd.h +1 -0
index 8731f35022..4c4fd27865 100644
@@ -120,6 +120,7 @@ struct ice_aqc_list_caps_elem {
 #define ICE_AQC_CAPS_1588				0x0046
 #define ICE_AQC_CAPS_MAX_MTU				0x0047
 #define ICE_AQC_CAPS_IWARP				0x0051
+#define ICE_AQC_CAPS_SENSOR_READING			0x0067
 #define ICE_AQC_CAPS_PCIE_RESET_AVOIDANCE		0x0076
 #define ICE_AQC_CAPS_POST_UPDATE_RESET_RESTRICT		0x0077
 #define ICE_AQC_CAPS_NVM_MGMT				0x0080
drivers/net/ice/base/ice_common.c +49 -0

61 lines not on this page · raw message

drivers/net/ice/base/ice_type.h +13 -0
index b2df99e472..17383ae23f 100644
@@ -787,6 +787,15 @@ struct ice_ts_dev_info {
 	u8 ts_ll_read : 1;
 };
 
+#define ICE_NAC_TOPO_PRIMARY_M	BIT(0)
+#define ICE_NAC_TOPO_DUAL_M	BIT(1)
+#define ICE_NAC_TOPO_ID_M	MAKEMASK(0xf, 0)
+
+struct ice_nac_topology {
+	u32 mode;
+	u8 id;
+};
+
 /* Function specific capabilities */
 struct ice_hw_func_caps {
 	struct ice_hw_common_caps common_cap;
@@ -803,6 +812,10 @@ struct ice_hw_dev_caps {
 	u32 num_flow_director_fltr;	/* Number of FD filters available */
 	struct ice_ts_dev_info ts_dev_info;
 	u32 num_funcs;
+	struct ice_nac_topology nac_topo;
+	/* bitmap of supported sensors */
+	u32 supported_sensors;
+#define ICE_SENSOR_SUPPORT_E810_INT_TEMP	BIT(0)
 };
 
 /* Information about MAC such as address, etc... */
Signature · 1 line
2.25.1
#9 lore raw

PATCH 8/30 net/ice/base: add function to read HW sensors

In reply to Qiming Yang

Adds new helper function to read from HW sensors via a new AQ command "Get Sensor Reading (0x0632)".

---
 drivers/net/ice/base/ice_adminq_cmd.h | 29 +++++++++++++++++++++
 drivers/net/ice/base/ice_common.c     | 36 +++++++++++++++++++++++++++
 drivers/net/ice/base/ice_common.h     |  6 +++--
 3 files changed, 69 insertions(+), 2 deletions(-)
drivers/net/ice/base/ice_adminq_cmd.h +29 -0
index 4c4fd27865..5a44ebbdc0 100644
@@ -1681,6 +1681,32 @@ struct ice_aqc_set_mac_lb {
 	u8 reserved[15];
 };
 
+/* Get sensor reading (direct 0x0632) */
+struct ice_aqc_get_sensor_reading {
+	u8 sensor;
+#define ICE_AQC_INT_TEMP_SENSOR		0x0
+	u8 format;
+#define ICE_AQC_INT_TEMP_FORMAT		0x0
+	u8 reserved[6];
+	__le32 addr_high;
+	__le32 addr_low;
+};
+
+/* Get sensor reading response (direct 0x0632) */
+struct ice_aqc_get_sensor_reading_resp {
+	union {
+		u8 raw[8];
+		/* Output data for sensor 0x00, format 0x00 */
+		struct {
+			s8 temp;
+			u8 temp_warning_threshold;
+			u8 temp_critical_threshold;
+			u8 temp_fatal_threshold;
+			u8 reserved[4];
+		} s0f0;
+	} data;
+};
+
 struct ice_aqc_link_topo_params {
 	u8 lport_num;
 	u8 lport_num_valid;
@@ -3032,6 +3058,8 @@ struct ice_aq_desc {
 		struct ice_aqc_get_phy_caps get_phy;
 		struct ice_aqc_set_phy_cfg set_phy;
 		struct ice_aqc_restart_an restart_an;
+		struct ice_aqc_get_sensor_reading get_sensor_reading;
+		struct ice_aqc_get_sensor_reading_resp get_sensor_reading_resp;
 		struct ice_aqc_i2c read_write_i2c;
 		struct ice_aqc_read_i2c_resp read_i2c_resp;
 		struct ice_aqc_gpio read_write_gpio;
@@ -3281,6 +3309,7 @@ enum ice_adminq_opc {
 	ice_aqc_opc_get_link_status			= 0x0607,
 	ice_aqc_opc_set_event_mask			= 0x0613,
 	ice_aqc_opc_set_mac_lb				= 0x0620,
+	ice_aqc_opc_get_sensor_reading			= 0x0632,
 	ice_aqc_opc_get_link_topo			= 0x06E0,
 	ice_aqc_opc_get_link_topo_pin			= 0x06E1,
 	ice_aqc_opc_read_i2c				= 0x06E2,
drivers/net/ice/base/ice_common.c +36 -0
index a51a436df6..ed811e406d 100644
@@ -5278,6 +5278,42 @@ ice_cfg_vsi_lan(struct ice_port_info *pi, u16 vsi_handle, u16 tc_bitmap,
 			      ICE_SCHED_NODE_OWNER_LAN);
 }
 
+/**
+ * ice_aq_get_sensor_reading
+ * @hw: pointer to the HW struct
+ * @sensor: sensor type
+ * @format: requested response format
+ * @data: pointer to data to be read from the sensor
+ * @cd: pointer to command details structure or NULL
+ *
+ * Get sensor reading (0x0632)
+ */
+enum ice_status
+ice_aq_get_sensor_reading(struct ice_hw *hw, u8 sensor, u8 format,
+			  struct ice_aqc_get_sensor_reading_resp *data,
+			  struct ice_sq_cd *cd)
+{
+	struct ice_aqc_get_sensor_reading *cmd;
+	struct ice_aq_desc desc;
+	enum ice_status status;
+
+	if (!data)
+		return ICE_ERR_PARAM;
+
+	ice_fill_dflt_direct_cmd_desc(&desc, ice_aqc_opc_get_sensor_reading);
+	cmd = &desc.params.get_sensor_reading;
+	cmd->sensor = sensor;
+	cmd->format = format;
+
+	status = ice_aq_send_cmd(hw, &desc, NULL, 0, cd);
+
+	if (!status)
+		ice_memcpy(data, &desc.params.get_sensor_reading_resp,
+			   sizeof(*data), ICE_NONDMA_TO_NONDMA);
+
+	return status;
+}
+
 /**
  * ice_is_main_vsi - checks whether the VSI is main VSI
  * @hw: pointer to the HW struct
drivers/net/ice/base/ice_common.h +4 -2
index f612ce7c52..ccefe85af7 100644
@@ -29,7 +29,6 @@ enum ice_status ice_init_hw(struct ice_hw *hw);
 void ice_deinit_hw(struct ice_hw *hw);
 enum ice_status ice_check_reset(struct ice_hw *hw);
 enum ice_status ice_reset(struct ice_hw *hw, enum ice_reset_req req);
-
 enum ice_status ice_create_all_ctrlq(struct ice_hw *hw);
 enum ice_status ice_init_all_ctrlq(struct ice_hw *hw);
 void ice_shutdown_all_ctrlq(struct ice_hw *hw, bool unloading);
@@ -61,7 +60,6 @@ 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);
 void ice_clear_pxe_mode(struct ice_hw *hw);
-
 enum ice_status ice_get_caps(struct ice_hw *hw);
 
 void ice_set_safe_mode_caps(struct ice_hw *hw);
@@ -247,6 +245,10 @@ enum ice_status ice_sbq_rw_reg_lp(struct ice_hw *hw,
 void ice_sbq_lock(struct ice_hw *hw);
 void ice_sbq_unlock(struct ice_hw *hw);
 enum ice_status ice_sbq_rw_reg(struct ice_hw *hw, struct ice_sbq_msg_input *in);
+enum ice_status
+ice_aq_get_sensor_reading(struct ice_hw *hw, u8 sensor, u8 format,
+			  struct ice_aqc_get_sensor_reading_resp *data,
+			  struct ice_sq_cd *cd);
 void
 ice_stat_update40(struct ice_hw *hw, u32 reg, bool prev_stat_loaded,
 		  u64 *prev_stat, u64 *cur_stat);
Signature · 1 line
2.25.1
#10 lore raw

PATCH 9/30 net/ice/base: add pre-allocate memory argument

In reply to Qiming Yang

Add an option to pre-allocate memory for ice_sched_node struct. Add new arguments to ice_sched_add() and ice_sched_add_elems() that allow for pre-allocation of memory for ice_sched_node struct

---
 drivers/net/ice/base/ice_adminq_cmd.h |   4 +-
 drivers/net/ice/base/ice_common.c     |   2 +-
 drivers/net/ice/base/ice_dcb.c        |   4 +-
 drivers/net/ice/base/ice_sched.c      | 411 ++++++++++++++++++++++++--
 drivers/net/ice/base/ice_sched.h      |  71 ++++-
 drivers/net/ice/base/ice_type.h       |   3 +
 6 files changed, 466 insertions(+), 29 deletions(-)
drivers/net/ice/base/ice_adminq_cmd.h +2 -2
index 5a44ebbdc0..cd4a6ffddf 100644
@@ -1120,9 +1120,9 @@ struct ice_aqc_txsched_elem {
 	u8 generic;
 #define ICE_AQC_ELEM_GENERIC_MODE_M		0x1
 #define ICE_AQC_ELEM_GENERIC_PRIO_S		0x1
-#define ICE_AQC_ELEM_GENERIC_PRIO_M	(0x7 << ICE_AQC_ELEM_GENERIC_PRIO_S)
+#define ICE_AQC_ELEM_GENERIC_PRIO_M		(0x7 << ICE_AQC_ELEM_GENERIC_PRIO_S)
 #define ICE_AQC_ELEM_GENERIC_SP_S		0x4
-#define ICE_AQC_ELEM_GENERIC_SP_M	(0x1 << ICE_AQC_ELEM_GENERIC_SP_S)
+#define ICE_AQC_ELEM_GENERIC_SP_M		(0x1 << ICE_AQC_ELEM_GENERIC_SP_S)
 #define ICE_AQC_ELEM_GENERIC_ADJUST_VAL_S	0x5
 #define ICE_AQC_ELEM_GENERIC_ADJUST_VAL_M	\
 	(0x3 << ICE_AQC_ELEM_GENERIC_ADJUST_VAL_S)
drivers/net/ice/base/ice_common.c +1 -1
index ed811e406d..984830ea37 100644
@@ -5129,7 +5129,7 @@ ice_ena_vsi_txq(struct ice_port_info *pi, u16 vsi_handle, u8 tc, u16 q_handle,
 	q_ctx->q_teid = LE32_TO_CPU(node.node_teid);
 
 	/* add a leaf node into scheduler tree queue layer */
-	status = ice_sched_add_node(pi, hw->num_tx_sched_layers - 1, &node);
+	status = ice_sched_add_node(pi, hw->num_tx_sched_layers - 1, &node, NULL);
 	if (!status)
 		status = ice_sched_replay_q_bw(pi, q_ctx);
 
drivers/net/ice/base/ice_dcb.c +2 -2
index 2a308b02bf..ca418090bc 100644
@@ -1370,7 +1370,7 @@ ice_add_dscp_tc_bw_tlv(struct ice_lldp_org_tlv *tlv,
 			   ICE_DSCP_SUBTYPE_TCBW);
 	tlv->ouisubtype = HTONL(ouisubtype);
 
-	/* First Octet after subtype
+	/* First Octect after subtype
 	 * ----------------------------
 	 * | RSV | CBS | RSV | Max TCs |
 	 * | 1b  | 1b  | 3b  | 3b      |
@@ -1624,7 +1624,7 @@ ice_update_port_tc_tree_cfg(struct ice_port_info *pi,
 		/* new TC */
 		status = ice_sched_query_elem(pi->hw, teid2, &elem);
 		if (!status)
-			status = ice_sched_add_node(pi, 1, &elem);
+			status = ice_sched_add_node(pi, 1, &elem, NULL);
 		if (status)
 			break;
 		/* update the TC number */
drivers/net/ice/base/ice_sched.c +390 -21

511 lines not on this page · raw message

drivers/net/ice/base/ice_sched.h +68 -3

107 lines not on this page · raw message

drivers/net/ice/base/ice_type.h +3 -0
index 17383ae23f..ec4892179a 100644
@@ -992,9 +992,11 @@ struct ice_sched_node {
 	u8 num_children;
 	u8 tc_num;
 	u8 owner;
+	u8 cgd;				/* Valid only for Layer 2 */
 #define ICE_SCHED_NODE_OWNER_LAN	0
 #define ICE_SCHED_NODE_OWNER_AE		1
 #define ICE_SCHED_NODE_OWNER_RDMA	2
+#define ICE_MAX_CGD_PER_PORT		4
 };
 
 /* Access Macros for Tx Sched Elements data */
@@ -1213,6 +1215,7 @@ struct ice_port_info {
 	struct ice_bw_type_info tc_node_bw_t_info[ICE_MAX_TRAFFIC_CLASS];
 	struct ice_qos_cfg qos_cfg;
 	u8 is_vf:1;
+	u8 is_custom_tx_enabled:1;
 };
 
 struct ice_switch_info {
Signature · 1 line
2.25.1
#11 lore raw

PATCH 10/30 net/ice/base: use coccinelle to instead macro

In reply to Qiming Yang

MSVC is not allowing array initialization with indexes, best way to avoid the issue when compiling for Windows is to use macro to remove index on Windows and use coccinelle to maintain compatibility with linux upstream.

---
 drivers/net/ice/base/ice_common.c    | 74 ++++++++++++++++++++++++++++
 drivers/net/ice/base/ice_common.h    |  8 +++
 drivers/net/ice/base/ice_ddp.c       |  3 ++
 drivers/net/ice/base/ice_flow.h      |  1 +
 drivers/net/ice/base/ice_lan_tx_rx.h |  1 -
 drivers/net/ice/base/ice_switch.c    | 23 +--------
 drivers/net/ice/base/ice_switch.h    |  3 +-
 7 files changed, 89 insertions(+), 24 deletions(-)
drivers/net/ice/base/ice_common.c +74 -0
index 984830ea37..cebf1504f1 100644
@@ -11,6 +11,80 @@
 
 #define ICE_PF_RESET_WAIT_COUNT	300
 
+static const char * const ice_link_mode_str_low[] = {
+	ice_arr_elem_idx(0, "100BASE_TX"),
+	ice_arr_elem_idx(1, "100M_SGMII"),
+	ice_arr_elem_idx(2, "1000BASE_T"),
+	ice_arr_elem_idx(3, "1000BASE_SX"),
+	ice_arr_elem_idx(4, "1000BASE_LX"),
+	ice_arr_elem_idx(5, "1000BASE_KX"),
+	ice_arr_elem_idx(6, "1G_SGMII"),
+	ice_arr_elem_idx(7, "2500BASE_T"),
+	ice_arr_elem_idx(8, "2500BASE_X"),
+	ice_arr_elem_idx(9, "2500BASE_KX"),
+	ice_arr_elem_idx(10, "5GBASE_T"),
+	ice_arr_elem_idx(11, "5GBASE_KR"),
+	ice_arr_elem_idx(12, "10GBASE_T"),
+	ice_arr_elem_idx(13, "10G_SFI_DA"),
+	ice_arr_elem_idx(14, "10GBASE_SR"),
+	ice_arr_elem_idx(15, "10GBASE_LR"),
+	ice_arr_elem_idx(16, "10GBASE_KR_CR1"),
+	ice_arr_elem_idx(17, "10G_SFI_AOC_ACC"),
+	ice_arr_elem_idx(18, "10G_SFI_C2C"),
+	ice_arr_elem_idx(19, "25GBASE_T"),
+	ice_arr_elem_idx(20, "25GBASE_CR"),
+	ice_arr_elem_idx(21, "25GBASE_CR_S"),
+	ice_arr_elem_idx(22, "25GBASE_CR1"),
+	ice_arr_elem_idx(23, "25GBASE_SR"),
+	ice_arr_elem_idx(24, "25GBASE_LR"),
+	ice_arr_elem_idx(25, "25GBASE_KR"),
+	ice_arr_elem_idx(26, "25GBASE_KR_S"),
+	ice_arr_elem_idx(27, "25GBASE_KR1"),
+	ice_arr_elem_idx(28, "25G_AUI_AOC_ACC"),
+	ice_arr_elem_idx(29, "25G_AUI_C2C"),
+	ice_arr_elem_idx(30, "40GBASE_CR4"),
+	ice_arr_elem_idx(31, "40GBASE_SR4"),
+	ice_arr_elem_idx(32, "40GBASE_LR4"),
+	ice_arr_elem_idx(33, "40GBASE_KR4"),
+	ice_arr_elem_idx(34, "40G_XLAUI_AOC_ACC"),
+	ice_arr_elem_idx(35, "40G_XLAUI"),
+	ice_arr_elem_idx(36, "50GBASE_CR2"),
+	ice_arr_elem_idx(37, "50GBASE_SR2"),
+	ice_arr_elem_idx(38, "50GBASE_LR2"),
+	ice_arr_elem_idx(39, "50GBASE_KR2"),
+	ice_arr_elem_idx(40, "50G_LAUI2_AOC_ACC"),
+	ice_arr_elem_idx(41, "50G_LAUI2"),
+	ice_arr_elem_idx(42, "50G_AUI2_AOC_ACC"),
+	ice_arr_elem_idx(43, "50G_AUI2"),
+	ice_arr_elem_idx(44, "50GBASE_CP"),
+	ice_arr_elem_idx(45, "50GBASE_SR"),
+	ice_arr_elem_idx(46, "50GBASE_FR"),
+	ice_arr_elem_idx(47, "50GBASE_LR"),
+	ice_arr_elem_idx(48, "50GBASE_KR_PAM4"),
+	ice_arr_elem_idx(49, "50G_AUI1_AOC_ACC"),
+	ice_arr_elem_idx(50, "50G_AUI1"),
+	ice_arr_elem_idx(51, "100GBASE_CR4"),
+	ice_arr_elem_idx(52, "100GBASE_SR4"),
+	ice_arr_elem_idx(53, "100GBASE_LR4"),
+	ice_arr_elem_idx(54, "100GBASE_KR4"),
+	ice_arr_elem_idx(55, "100G_CAUI4_AOC_ACC"),
+	ice_arr_elem_idx(56, "100G_CAUI4"),
+	ice_arr_elem_idx(57, "100G_AUI4_AOC_ACC"),
+	ice_arr_elem_idx(58, "100G_AUI4"),
+	ice_arr_elem_idx(59, "100GBASE_CR_PAM4"),
+	ice_arr_elem_idx(60, "100GBASE_KR_PAM4"),
+	ice_arr_elem_idx(61, "100GBASE_CP2"),
+	ice_arr_elem_idx(62, "100GBASE_SR2"),
+	ice_arr_elem_idx(63, "100GBASE_DR"),
+};
+
+static const char * const ice_link_mode_str_high[] = {
+	ice_arr_elem_idx(0, "100GBASE_KR2_PAM4"),
+	ice_arr_elem_idx(1, "100G_CAUI2_AOC_ACC"),
+	ice_arr_elem_idx(2, "100G_CAUI2"),
+	ice_arr_elem_idx(3, "100G_AUI2_AOC_ACC"),
+	ice_arr_elem_idx(4, "100G_AUI2"),
+};
 /**
  * dump_phy_type - helper function that prints PHY type strings
  * @hw: pointer to the HW structure
drivers/net/ice/base/ice_common.h +8 -0
index ccefe85af7..83ef438041 100644
@@ -81,6 +81,14 @@ ice_aq_get_internal_data(struct ice_hw *hw, u8 cluster_id, u16 table_id,
  */
 #define ICE_ALIGN(ptr, align)	(((ptr) + ((align) - 1)) & ~((align) - 1))
 
+/* Define a macro for initializing array using indexes. Due to limitation
+ * of MSVC compiler it is necessary to allow other projects to replace
+ * that macro and strip the index from initialization.
+ * Linux driver is using coccinelle to maintain source sync with upstream
+ * and is not requiring this macro.
+ */
+#define ice_arr_elem_idx(idx, val)	[(idx)] = (val)
+
 enum ice_status
 ice_write_rxq_ctx(struct ice_hw *hw, struct ice_rlan_ctx *rlan_ctx,
 		  u32 rxq_index);
drivers/net/ice/base/ice_ddp.c +3 -0
index 93ff2608d4..ae0a03c8ba 100644
@@ -1579,6 +1579,9 @@ ice_get_sw_fv_list(struct ice_hw *hw, struct ice_prot_lkup_ext *lkups,
 	struct ice_fv *fv;
 	u32 offset;
 
+	if (!lkups->n_val_words)
+		return ICE_SUCCESS;
+
 	ice_memset(&state, 0, sizeof(state), ICE_NONDMA_MEM);
 
 	if (!lkups->n_val_words || !hw->seg)
drivers/net/ice/base/ice_flow.h +1 -0
index 1415f5ba87..2e5a3b386e 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
drivers/net/ice/base/ice_lan_tx_rx.h +0 -1
index d816df0ff6..229db1041c 100644
@@ -162,7 +162,6 @@ struct ice_fltr_desc {
 
 #define ICE_FXD_FLTR_QW1_FDID_PRI_S	25
 #define ICE_FXD_FLTR_QW1_FDID_PRI_M	(0x7ULL << ICE_FXD_FLTR_QW1_FDID_PRI_S)
-#define ICE_FXD_FLTR_QW1_FDID_PRI_ZERO	0x0ULL
 #define ICE_FXD_FLTR_QW1_FDID_PRI_ONE	0x1ULL
 #define ICE_FXD_FLTR_QW1_FDID_PRI_THREE	0x3ULL
 
drivers/net/ice/base/ice_switch.c +2 -21
index dd4cc38114..b3d9847669 100644
@@ -7500,25 +7500,6 @@ ice_create_recipe_group(struct ice_hw *hw, struct ice_sw_recipe *rm,
 	return status;
 }
 
-/**
- * ice_get_fv - get field vectors/extraction sequences for spec. lookup types
- * @hw: pointer to hardware structure
- * @lkups: lookup elements or match criteria for the advanced recipe, one
- *	   structure per protocol header
- * @bm: bitmap of field vectors to consider
- * @fv_list: pointer to a list that holds the returned field vectors
- */
-static enum ice_status
-ice_get_fv(struct ice_hw *hw, struct ice_prot_lkup_ext *lkups,
-	   ice_bitmap_t *bm, struct LIST_HEAD_TYPE *fv_list)
-{
-	if (!lkups->n_val_words)
-		return ICE_SUCCESS;
-
-	/* Find field vectors that include all specified protocol types */
-	return ice_get_sw_fv_list(hw, lkups, bm, fv_list);
-}
-
 /**
  * ice_tun_type_match_word - determine if tun type needs a match mask
  * @tun_type: tunnel type
@@ -7905,11 +7886,11 @@ ice_add_adv_recipe(struct ice_hw *hw, struct ice_adv_lkup_elem *lkups,
 
 	/* Get bitmap of field vectors (profiles) that are compatible with the
 	 * rule request; only these will be searched in the subsequent call to
-	 * ice_get_fv.
+	 * ice_get_sw_fv_list.
 	 */
 	ice_get_compat_fv_bitmap(hw, rinfo, fv_bitmap);
 
-	status = ice_get_fv(hw, lkup_exts, fv_bitmap, &rm->fv_list);
+	status = ice_get_sw_fv_list(hw, lkup_exts, fv_bitmap, &rm->fv_list);
 	if (status)
 		goto err_unroll;
 
drivers/net/ice/base/ice_switch.h +1 -2
index 49bd535c79..adb467eb66 100644
@@ -498,8 +498,7 @@ ice_aq_get_res_descs(struct ice_hw *hw, u16 num_entries,
 		     bool res_shared, u16 *desc_id, struct ice_sq_cd *cd);
 enum ice_status
 ice_add_vlan(struct ice_hw *hw, struct LIST_HEAD_TYPE *m_list);
-enum ice_status
-ice_remove_vlan(struct ice_hw *hw, struct LIST_HEAD_TYPE *v_list);
+enum ice_status ice_remove_vlan(struct ice_hw *hw, struct LIST_HEAD_TYPE *v_list);
 void ice_rem_all_sw_rules_info(struct ice_hw *hw);
 enum ice_status ice_add_mac(struct ice_hw *hw, struct LIST_HEAD_TYPE *m_lst);
 enum ice_status ice_remove_mac(struct ice_hw *hw, struct LIST_HEAD_TYPE *m_lst);
Signature · 1 line
2.25.1
#12 lore raw

PATCH 11/30 net/ice/base: add new fls function

In reply to Qiming Yang

Add a new function called ice_fls() and merged some code clean.

---
 drivers/net/ice/base/ice_common.c        | 40 ++++++++++++++++++++++--
 drivers/net/ice/base/ice_common.h        |  1 +
 drivers/net/ice/base/ice_protocol_type.h | 11 +++----
 drivers/net/ice/base/ice_switch.c        | 25 ++++++++-------
 drivers/net/ice/base/ice_type.h          | 18 +++++++++++
 5 files changed, 75 insertions(+), 20 deletions(-)
drivers/net/ice/base/ice_common.c +38 -2
index cebf1504f1..6967ff1a8f 100644
@@ -3238,8 +3238,8 @@ bool ice_is_100m_speed_supported(struct ice_hw *hw)
  * Note: In the structure of [phy_type_low, phy_type_high], there should
  * be one bit set, as this function will convert one PHY type to its
  * speed.
- * If no bit gets set, ICE_LINK_SPEED_UNKNOWN will be returned
- * If more than one bit gets set, ICE_LINK_SPEED_UNKNOWN will be returned
+ * If no bit gets set, ICE_AQ_LINK_SPEED_UNKNOWN will be returned
+ * If more than one bit gets set, ICE_AQ_LINK_SPEED_UNKNOWN will be returned
  */
 static u16
 ice_get_link_speed_based_on_phy_type(u64 phy_type_low, u64 phy_type_high)
@@ -6134,6 +6134,42 @@ bool ice_fw_supports_report_dflt_cfg(struct ice_hw *hw)
 				     ICE_FW_API_REPORT_DFLT_CFG_PATCH);
 }
 
+/* each of the indexes into the following array match the speed of a return
+ * value from the list of AQ returned speeds like the range:
+ * ICE_AQ_LINK_SPEED_10MB .. ICE_AQ_LINK_SPEED_100GB excluding
+ * ICE_AQ_LINK_SPEED_UNKNOWN which is BIT(15) The array is defined as 15
+ * elements long because the link_speed returned by the firmware is a 16 bit
+ * value, but is indexed by [fls(speed) - 1]
+ */
+static const u32 ice_aq_to_link_speed[] = {
+	ICE_LINK_SPEED_10MBPS,	/* BIT(0) */
+	ICE_LINK_SPEED_100MBPS,
+	ICE_LINK_SPEED_1000MBPS,
+	ICE_LINK_SPEED_2500MBPS,
+	ICE_LINK_SPEED_5000MBPS,
+	ICE_LINK_SPEED_10000MBPS,
+	ICE_LINK_SPEED_20000MBPS,
+	ICE_LINK_SPEED_25000MBPS,
+	ICE_LINK_SPEED_40000MBPS,
+	ICE_LINK_SPEED_50000MBPS,
+	ICE_LINK_SPEED_100000MBPS,	/* BIT(10) */
+	ICE_LINK_SPEED_200000MBPS,
+};
+
+/**
+ * ice_get_link_speed - get integer speed from table
+ * @index: array index from fls(aq speed) - 1
+ *
+ * Returns: u32 value containing integer speed
+ */
+u32 ice_get_link_speed(u16 index)
+{
+	if (index >= ARRAY_SIZE(ice_aq_to_link_speed))
+		return ICE_LINK_SPEED_UNKNOWN;
+
+	return ice_aq_to_link_speed[index];
+}
+
 /**
  * ice_fw_supports_fec_dis_auto
  * @hw: pointer to the hardware structure
drivers/net/ice/base/ice_common.h +1 -0
index 83ef438041..d8fb7a6163 100644
@@ -217,6 +217,7 @@ enum ice_status
 ice_aq_sff_eeprom(struct ice_hw *hw, u16 lport, u8 bus_addr,
 		  u16 mem_addr, u8 page, u8 set_page, u8 *data, u8 length,
 		  bool write, struct ice_sq_cd *cd);
+u32 ice_get_link_speed(u16 index);
 
 enum ice_status
 ice_aq_prog_topo_dev_nvm(struct ice_hw *hw,
drivers/net/ice/base/ice_protocol_type.h +5 -6
index eeaf044059..1d9baea624 100644
@@ -97,6 +97,10 @@ enum ice_sw_tunnel_type {
 	ICE_SW_TUN_IPV6_GTPU_EH_IPV6_UDP,
 	ICE_SW_TUN_IPV6_GTPU_IPV6_TCP,
 	ICE_SW_TUN_IPV6_GTPU_EH_IPV6_TCP,
+	ICE_SW_TUN_IPV4_GTPU_IPV4,
+	ICE_SW_TUN_IPV4_GTPU_IPV6,
+	ICE_SW_TUN_IPV6_GTPU_IPV4,
+	ICE_SW_TUN_IPV6_GTPU_IPV6,
 	ICE_SW_TUN_PPPOE,
 	ICE_SW_TUN_PPPOE_PAY,
 	ICE_SW_TUN_PPPOE_IPV4,
@@ -127,12 +131,6 @@ enum ice_sw_tunnel_type {
 	ICE_SW_TUN_PPPOE_PAY_QINQ,
 	ICE_SW_TUN_PPPOE_IPV4_QINQ,
 	ICE_SW_TUN_PPPOE_IPV6_QINQ,
-	ICE_SW_TUN_IPV4_GTPU_IPV4,
-	ICE_SW_TUN_IPV4_GTPU_IPV6,
-	ICE_SW_TUN_IPV6_GTPU_IPV4,
-	ICE_SW_TUN_IPV6_GTPU_IPV6,
-	ICE_SW_TUN_GTP_IPV4,
-	ICE_SW_TUN_GTP_IPV6,
 	ICE_ALL_TUNNELS /* All tunnel types including NVGRE */
 };
 
@@ -224,6 +222,7 @@ enum ice_prot_id {
 #define ICE_TUN_FLAG_MDID_OFF(word)   (ICE_MDID_SIZE * (ICE_TUN_FLAG_MDID + (word)))
 #define ICE_TUN_FLAG_MASK 0xFF
 #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
 #define ICE_TUN_FLAG_FV_IND 2
 
drivers/net/ice/base/ice_switch.c +13 -12
index b3d9847669..1b8311fdc7 100644
@@ -915,15 +915,6 @@ static const u8 dummy_ipv6_gtpu_ipv6_udp_packet[] = {
 	0x00, 0x00, /* 2 bytes for 4 byte alignment */
 };
 
-static const struct ice_dummy_pkt_offsets dummy_ipv4_gtpu_ipv4_packet_offsets[] = {
-	{ ICE_MAC_OFOS,		0 },
-	{ ICE_IPV4_OFOS,	14 },
-	{ ICE_UDP_OF,		34 },
-	{ ICE_GTP,		42 },
-	{ ICE_IPV4_IL,		62 },
-	{ ICE_PROTOCOL_LAST,	0 },
-};
-
 static const u8 dummy_ipv4_gtpu_ipv4_packet[] = {
 	0x00, 0x00, 0x00, 0x00, /* ICE_MAC_OFOS 0 */
 	0x00, 0x00, 0x00, 0x00,
@@ -954,8 +945,17 @@ static const u8 dummy_ipv4_gtpu_ipv4_packet[] = {
 	0x00, 0x00,
 };
 
-static const
-struct ice_dummy_pkt_offsets dummy_ipv4_gtpu_ipv6_packet_offsets[] = {
+static const struct
+ice_dummy_pkt_offsets dummy_ipv4_gtpu_ipv4_packet_offsets[] = {
+	{ ICE_MAC_OFOS,		0 },
+	{ ICE_IPV4_OFOS,	14 },
+	{ ICE_UDP_OF,		34 },
+	{ ICE_GTP,		42 },
+	{ ICE_IPV4_IL,		62 },
+	{ ICE_PROTOCOL_LAST,	0 },
+};
+
+static const struct ice_dummy_pkt_offsets dummy_ipv4_gtpu_ipv6_packet_offsets[] = {
 	{ ICE_MAC_OFOS,		0 },
 	{ ICE_IPV4_OFOS,	14 },
 	{ ICE_UDP_OF,		34 },
@@ -7532,7 +7532,8 @@ static bool ice_tun_type_match_word(enum ice_sw_tunnel_type tun_type, u16 *off,
 
 	case ICE_SW_TUN_GENEVE_VLAN:
 	case ICE_SW_TUN_VXLAN_VLAN:
-		*mask = ICE_TUN_FLAG_MASK & ~ICE_TUN_FLAG_VLAN_MASK;
+		*mask = ICE_TUN_FLAG_MASK & ~(ICE_TUN_FLAG_VLAN_MASK |
+			ICE_TUN_FLAG_IN_VLAN_MASK);
 		*off = ICE_TUN_FLAG_MDID_OFF(1);
 		return true;
 
drivers/net/ice/base/ice_type.h +18 -0
index ec4892179a..5779590a7e 100644
@@ -43,6 +43,24 @@ static inline int ice_ilog2(u64 n)
 	return -1;
 }
 
+/**
+ * ice_fls - find the most significant bit set in a u64
+ * @n: u64 value to scan for a bit
+ *
+ * Returns: 0 if no bits found, otherwise the index of the highest bit that was
+ * set, like ice_fls(0x20) == 6. This means this is returning a *1 based*
+ * count, and that the maximum largest value returned is 64!
+ */
+static inline unsigned int ice_fls(u64 n)
+{
+	int ret;
+
+	ret = ice_ilog2(n);
+
+	/* add one to turn to the ilog2 value into a 1 based index */
+	return ret >= 0 ? ret + 1 : 0;
+}
+
 static inline bool ice_is_tc_ena(ice_bitmap_t bitmap, u8 tc)
 {
 	return ice_is_bit_set(&bitmap, tc);
Signature · 1 line
2.25.1
#13 lore raw

PATCH 12/30 net/ice/base: add E830 device ids

In reply to Qiming Yang

Added new E830 device id and related registers.

---
 drivers/net/ice/base/ice_common.c     |    8 +-
 drivers/net/ice/base/ice_ddp.c        |    6 +
 drivers/net/ice/base/ice_ddp.h        |    1 +
 drivers/net/ice/base/ice_devids.h     |    8 +
 drivers/net/ice/base/ice_hw_autogen.h | 1640 +++++++++++++++++++++++++
 drivers/net/ice/base/ice_lan_tx_rx.h  |    2 +-
 drivers/net/ice/base/ice_nvm.c        |   15 +-
 drivers/net/ice/base/ice_type.h       |    1 +
 8 files changed, 1673 insertions(+), 8 deletions(-)
drivers/net/ice/base/ice_common.c +7 -1
index 6967ff1a8f..58da198d62 100644
@@ -9,7 +9,7 @@
 #include "ice_flow.h"
 #include "ice_switch.h"
 
-#define ICE_PF_RESET_WAIT_COUNT	300
+#define ICE_PF_RESET_WAIT_COUNT	500
 
 static const char * const ice_link_mode_str_low[] = {
 	ice_arr_elem_idx(0, "100BASE_TX"),
@@ -249,6 +249,12 @@ static enum ice_status ice_set_mac_type(struct ice_hw *hw)
 	case ICE_DEV_ID_E825X:
 		hw->mac_type = ICE_MAC_GENERIC;
 		break;
+	case ICE_DEV_ID_E830_BACKPLANE:
+	case ICE_DEV_ID_E830_QSFP56:
+	case ICE_DEV_ID_E830_SFP:
+	case ICE_DEV_ID_E830_SFP_DD:
+		hw->mac_type = ICE_MAC_E830;
+		break;
 	default:
 		hw->mac_type = ICE_MAC_UNKNOWN;
 		break;
drivers/net/ice/base/ice_ddp.c +6 -0
index ae0a03c8ba..e3c1f413dd 100644
@@ -439,6 +439,9 @@ static u32 ice_get_pkg_segment_id(enum ice_mac_type mac_type)
 	u32 seg_id;
 
 	switch (mac_type) {
+	case ICE_MAC_E830:
+		seg_id = SEGMENT_TYPE_ICE_E830;
+		break;
 	case ICE_MAC_GENERIC:
 	case ICE_MAC_GENERIC_3K:
 	default:
@@ -458,6 +461,9 @@ static u32 ice_get_pkg_sign_type(enum ice_mac_type mac_type)
 	u32 sign_type;
 
 	switch (mac_type) {
+	case ICE_MAC_E830:
+		sign_type = SEGMENT_SIGN_TYPE_RSA3K_SBB;
+		break;
 	case ICE_MAC_GENERIC_3K:
 		sign_type = SEGMENT_SIGN_TYPE_RSA3K;
 		break;
drivers/net/ice/base/ice_ddp.h +1 -0
index 4896e85b91..57b39c72ca 100644
@@ -106,6 +106,7 @@ struct ice_generic_seg_hdr {
 #define SEGMENT_TYPE_METADATA	0x00000001
 #define SEGMENT_TYPE_ICE_E810	0x00000010
 #define SEGMENT_TYPE_SIGNING	0x00001001
+#define SEGMENT_TYPE_ICE_E830	0x00000017
 #define SEGMENT_TYPE_ICE_RUN_TIME_CFG 0x00000020
 	__le32 seg_type;
 	struct ice_pkg_ver seg_format_ver;
drivers/net/ice/base/ice_devids.h +8 -0
index f80789ebc5..9ea915b967 100644
@@ -15,6 +15,14 @@
 #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-C for backplane */
+#define ICE_DEV_ID_E830_BACKPLANE	0x12D1
+/* Intel(R) Ethernet Controller E830-C for QSFP */
+#define ICE_DEV_ID_E830_QSFP56		0x12D2
+/* Intel(R) Ethernet Controller E830-C for SFP */
+#define ICE_DEV_ID_E830_SFP		0x12D3
+/* Intel(R) Ethernet Controller E830-C for SFP-DD */
+#define ICE_DEV_ID_E830_SFP_DD		0x12D4
 /* 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 +1640 -0

1,645 lines not on this page · raw message

drivers/net/ice/base/ice_lan_tx_rx.h +1 -1
index 229db1041c..d8ac841e46 100644
@@ -2469,5 +2469,5 @@ static inline struct ice_rx_ptype_decoded ice_decode_rx_desc_ptype(u16 ptype)
 #define ICE_LINK_SPEED_40000MBPS	40000
 #define ICE_LINK_SPEED_50000MBPS	50000
 #define ICE_LINK_SPEED_100000MBPS	100000
-
+#define ICE_LINK_SPEED_200000MBPS	200000
 #endif /* _ICE_LAN_TX_RX_H_ */
drivers/net/ice/base/ice_nvm.c +9 -6
index cb45cb8134..6ab359af33 100644
@@ -1330,14 +1330,17 @@ ice_nvm_access_write(struct ice_hw *hw, struct ice_nvm_access_cmd *cmd,
 		return status;
 
 	/* Reject requests to write to read-only registers */
-	switch (cmd->offset) {
-	case GL_HICR_EN:
-	case GLGEN_RSTAT:
-		return ICE_ERR_OUT_OF_RANGE;
-	default:
-		break;
+	if (hw->mac_type == ICE_MAC_E830) {
+		if (cmd->offset == E830_GL_HICR_EN)
+			return ICE_ERR_OUT_OF_RANGE;
+	} else {
+		if (cmd->offset == GL_HICR_EN)
+			return ICE_ERR_OUT_OF_RANGE;
 	}
 
+	if (cmd->offset == GLGEN_RSTAT)
+		return ICE_ERR_OUT_OF_RANGE;
+
 	ice_debug(hw, ICE_DBG_NVM, "NVM access: writing register %08x with value %08x\n",
 		  cmd->offset, data->regval);
 
drivers/net/ice/base/ice_type.h +1 -0
index 5779590a7e..576998549e 100644
@@ -222,6 +222,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,
 };
Signature · 1 line
2.25.1
#14 lore raw

PATCH 13/30 net/ice/base: add function to get rxq context

In reply to Qiming Yang

This patch exports rxq context which is consumed by linux linve migration driver to save device state.

---
 drivers/net/ice/base/ice_common.c | 75 +++++++++++++++++++++++++++----
 drivers/net/ice/base/ice_common.h |  7 ++-
 2 files changed, 71 insertions(+), 11 deletions(-)
drivers/net/ice/base/ice_common.c +66 -9
index 58da198d62..ed822afc30 100644
@@ -1397,6 +1397,37 @@ ice_copy_rxq_ctx_to_hw(struct ice_hw *hw, u8 *ice_rxq_ctx, u32 rxq_index)
 	return ICE_SUCCESS;
 }
 
+/**
+ * ice_copy_rxq_ctx_from_hw - Copy rxq context register from HW
+ * @hw: pointer to the hardware structure
+ * @ice_rxq_ctx: pointer to the rxq context
+ * @rxq_index: the index of the Rx queue
+ *
+ * Copies rxq context from HW register space to dense structure
+ */
+static enum ice_status
+ice_copy_rxq_ctx_from_hw(struct ice_hw *hw, u8 *ice_rxq_ctx, u32 rxq_index)
+{
+	u8 i;
+
+	if (!ice_rxq_ctx)
+		return ICE_ERR_BAD_PTR;
+
+	if (rxq_index > QRX_CTRL_MAX_INDEX)
+		return ICE_ERR_PARAM;
+
+	/* Copy each dword separately from HW */
+	for (i = 0; i < ICE_RXQ_CTX_SIZE_DWORDS; i++) {
+		u32 *ctx = (u32 *)(ice_rxq_ctx + (i * sizeof(u32)));
+
+		*ctx = rd32(hw, QRX_CONTEXT(i, rxq_index));
+
+		ice_debug(hw, ICE_DBG_QCTX, "qrxdata[%d]: %08X\n", i, *ctx);
+	}
+
+	return ICE_SUCCESS;
+}
+
 /* LAN Rx Queue Context */
 static const struct ice_ctx_ele ice_rlan_ctx_info[] = {
 	/* Field		Width	LSB */
@@ -1448,6 +1479,32 @@ ice_write_rxq_ctx(struct ice_hw *hw, struct ice_rlan_ctx *rlan_ctx,
 	return ice_copy_rxq_ctx_to_hw(hw, ctx_buf, rxq_index);
 }
 
+/**
+ * ice_read_rxq_ctx - Read rxq context from HW
+ * @hw: pointer to the hardware structure
+ * @rlan_ctx: pointer to the rxq context
+ * @rxq_index: the index of the Rx queue
+ *
+ * Read rxq context from HW register space and then converts it from dense
+ * structure to sparse
+ */
+enum ice_status
+ice_read_rxq_ctx(struct ice_hw *hw, struct ice_rlan_ctx *rlan_ctx,
+		 u32 rxq_index)
+{
+	u8 ctx_buf[ICE_RXQ_CTX_SZ] = { 0 };
+	enum ice_status status;
+
+	if (!rlan_ctx)
+		return ICE_ERR_BAD_PTR;
+
+	status = ice_copy_rxq_ctx_from_hw(hw, ctx_buf, rxq_index);
+	if (status)
+		return status;
+
+	return ice_get_ctx(ctx_buf, (u8 *)rlan_ctx, ice_rlan_ctx_info);
+}
+
 /**
  * ice_clear_rxq_ctx
  * @hw: pointer to the hardware structure
@@ -4883,7 +4940,7 @@ ice_aq_get_internal_data(struct ice_hw *hw, u8 cluster_id, u16 table_id,
  * @ce_info:  a description of the struct to be filled
  */
 static void
-ice_read_byte(u8 *src_ctx, u8 *dest_ctx, struct ice_ctx_ele *ce_info)
+ice_read_byte(u8 *src_ctx, u8 *dest_ctx, const struct ice_ctx_ele *ce_info)
 {
 	u8 dest_byte, mask;
 	u8 *src, *target;
@@ -4901,7 +4958,7 @@ ice_read_byte(u8 *src_ctx, u8 *dest_ctx, struct ice_ctx_ele *ce_info)
 
 	ice_memcpy(&dest_byte, src, sizeof(dest_byte), ICE_DMA_TO_NONDMA);
 
-	dest_byte &= ~(mask);
+	dest_byte &= mask;
 
 	dest_byte >>= shift_width;
 
@@ -4919,7 +4976,7 @@ ice_read_byte(u8 *src_ctx, u8 *dest_ctx, struct ice_ctx_ele *ce_info)
  * @ce_info:  a description of the struct to be filled
  */
 static void
-ice_read_word(u8 *src_ctx, u8 *dest_ctx, struct ice_ctx_ele *ce_info)
+ice_read_word(u8 *src_ctx, u8 *dest_ctx, const struct ice_ctx_ele *ce_info)
 {
 	u16 dest_word, mask;
 	u8 *src, *target;
@@ -4941,7 +4998,7 @@ ice_read_word(u8 *src_ctx, u8 *dest_ctx, struct ice_ctx_ele *ce_info)
 	/* the data in the memory is stored as little endian so mask it
 	 * correctly
 	 */
-	src_word &= ~(CPU_TO_LE16(mask));
+	src_word &= CPU_TO_LE16(mask);
 
 	/* get the data back into host order before shifting */
 	dest_word = LE16_TO_CPU(src_word);
@@ -4962,7 +5019,7 @@ ice_read_word(u8 *src_ctx, u8 *dest_ctx, struct ice_ctx_ele *ce_info)
  * @ce_info:  a description of the struct to be filled
  */
 static void
-ice_read_dword(u8 *src_ctx, u8 *dest_ctx, struct ice_ctx_ele *ce_info)
+ice_read_dword(u8 *src_ctx, u8 *dest_ctx, const struct ice_ctx_ele *ce_info)
 {
 	u32 dest_dword, mask;
 	__le32 src_dword;
@@ -4992,7 +5049,7 @@ ice_read_dword(u8 *src_ctx, u8 *dest_ctx, struct ice_ctx_ele *ce_info)
 	/* the data in the memory is stored as little endian so mask it
 	 * correctly
 	 */
-	src_dword &= ~(CPU_TO_LE32(mask));
+	src_dword &= CPU_TO_LE32(mask);
 
 	/* get the data back into host order before shifting */
 	dest_dword = LE32_TO_CPU(src_dword);
@@ -5013,7 +5070,7 @@ ice_read_dword(u8 *src_ctx, u8 *dest_ctx, struct ice_ctx_ele *ce_info)
  * @ce_info:  a description of the struct to be filled
  */
 static void
-ice_read_qword(u8 *src_ctx, u8 *dest_ctx, struct ice_ctx_ele *ce_info)
+ice_read_qword(u8 *src_ctx, u8 *dest_ctx, const struct ice_ctx_ele *ce_info)
 {
 	u64 dest_qword, mask;
 	__le64 src_qword;
@@ -5043,7 +5100,7 @@ ice_read_qword(u8 *src_ctx, u8 *dest_ctx, struct ice_ctx_ele *ce_info)
 	/* the data in the memory is stored as little endian so mask it
 	 * correctly
 	 */
-	src_qword &= ~(CPU_TO_LE64(mask));
+	src_qword &= CPU_TO_LE64(mask);
 
 	/* get the data back into host order before shifting */
 	dest_qword = LE64_TO_CPU(src_qword);
@@ -5064,7 +5121,7 @@ ice_read_qword(u8 *src_ctx, u8 *dest_ctx, struct ice_ctx_ele *ce_info)
  * @ce_info:  a description of the structure to be read from
  */
 enum ice_status
-ice_get_ctx(u8 *src_ctx, u8 *dest_ctx, struct ice_ctx_ele *ce_info)
+ice_get_ctx(u8 *src_ctx, u8 *dest_ctx, const struct ice_ctx_ele *ce_info)
 {
 	int f;
 
drivers/net/ice/base/ice_common.h +5 -2
index d8fb7a6163..3e03f2e903 100644
@@ -92,6 +92,9 @@ ice_aq_get_internal_data(struct ice_hw *hw, u8 cluster_id, u16 table_id,
 enum ice_status
 ice_write_rxq_ctx(struct ice_hw *hw, struct ice_rlan_ctx *rlan_ctx,
 		  u32 rxq_index);
+enum ice_status
+ice_read_rxq_ctx(struct ice_hw *hw, struct ice_rlan_ctx *rlan_ctx,
+		 u32 rxq_index);
 enum ice_status ice_clear_rxq_ctx(struct ice_hw *hw, u32 rxq_index);
 enum ice_status
 ice_clear_tx_cmpltnq_ctx(struct ice_hw *hw, u32 tx_cmpltnq_index);
@@ -135,6 +138,8 @@ extern const struct ice_ctx_ele ice_tlan_ctx_info[];
 enum ice_status
 ice_set_ctx(struct ice_hw *hw, u8 *src_ctx, u8 *dest_ctx,
 	    const struct ice_ctx_ele *ce_info);
+enum ice_status
+ice_get_ctx(u8 *src_ctx, u8 *dest_ctx, const struct ice_ctx_ele *ce_info);
 
 enum ice_status
 ice_aq_send_cmd(struct ice_hw *hw, struct ice_aq_desc *desc,
@@ -229,8 +234,6 @@ ice_aq_read_topo_dev_nvm(struct ice_hw *hw,
 			 u32 start_address, u8 *buf, u8 buf_size,
 			 struct ice_sq_cd *cd);
 
-enum ice_status
-ice_get_ctx(u8 *src_ctx, u8 *dest_ctx, struct ice_ctx_ele *ce_info);
 enum ice_status
 ice_dis_vsi_txq(struct ice_port_info *pi, u16 vsi_handle, u8 tc, u8 num_queues,
 		u16 *q_handle, u16 *q_ids, u32 *q_teids,
Signature · 1 line
2.25.1
#15 lore raw

PATCH 14/30 net/ice/base: removed no need 56G releated code

In reply to Qiming Yang

As 56G related code is no need, delete unnecessary code.

---
 drivers/net/ice/base/ice_ptp_hw.c | 1396 -----------------------------
 drivers/net/ice/base/ice_ptp_hw.h |   38 -
 2 files changed, 1434 deletions(-)
drivers/net/ice/base/ice_ptp_hw.c +0 -1396
index 548ef5e820..61145262ac 100644
@@ -448,1375 +448,6 @@ static void ice_ptp_clean_cmd(struct ice_hw *hw)
 	ice_flush(hw);
 }
 
-/* 56G PHY access functions */
-static const u32 eth56g_port_base[ICE_NUM_PHY_PORTS] = {
-	ICE_PHY0_BASE,
-	ICE_PHY1_BASE,
-	ICE_PHY2_BASE,
-	ICE_PHY3_BASE,
-	ICE_PHY4_BASE,
-};
-
-/**
- * ice_write_phy_eth56g_raw_lp - Write a PHY port register with lock parameter
- * @hw: pointer to the HW struct
- * @reg_addr: PHY register address
- * @val: Value to write
- * @lock_sbq: true to lock the sideband queue
- */
-static enum ice_status
-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;
-	enum ice_status status;
-
-	phy_msg.opcode = ice_sbq_msg_wr;
-
-	phy_msg.msg_addr_low = ICE_LO_WORD(reg_addr);
-	phy_msg.msg_addr_high = ICE_HI_WORD(reg_addr);
-
-	phy_msg.data = val;
-	phy_msg.dest_dev = phy_56g;
-
-	status = ice_sbq_rw_reg_lp(hw, &phy_msg, lock_sbq);
-
-	if (status)
-		ice_debug(hw, ICE_DBG_PTP, "PTP failed to send msg to phy %d\n",
-			  status);
-
-	return status;
-}
-
-/**
- * ice_read_phy_eth56g_raw_lp - Read a PHY port register with lock parameter
- * @hw: pointer to the HW struct
- * @reg_addr: PHY port register address
- * @val: Pointer to the value to read (out param)
- * @lock_sbq: true to lock the sideband queue
- */
-static enum ice_status
-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;
-	enum ice_status status;
-
-	phy_msg.opcode = ice_sbq_msg_rd;
-
-	phy_msg.msg_addr_low = ICE_LO_WORD(reg_addr);
-	phy_msg.msg_addr_high = ICE_HI_WORD(reg_addr);
-
-	phy_msg.dest_dev = phy_56g;
-
-	status = ice_sbq_rw_reg_lp(hw, &phy_msg, lock_sbq);
-
-	if (status)
-		ice_debug(hw, ICE_DBG_PTP, "PTP failed to send msg to phy %d\n",
-			  status);
-	else
-		*val = phy_msg.data;
-
-	return status;
-}
-
-/**
- * ice_phy_port_reg_address_eth56g - Calculate a PHY port register address
- * @port: Port number to be written
- * @offset: Offset from PHY port register base
- * @address: The result address
- */
-static enum ice_status
-ice_phy_port_reg_address_eth56g(u8 port, u16 offset, u32 *address)
-{
-	u8 phy, lane;
-
-	if (port >= ICE_NUM_EXTERNAL_PORTS)
-		return ICE_ERR_OUT_OF_RANGE;
-
-	phy = port / ICE_PORTS_PER_QUAD;
-	lane = port % ICE_PORTS_PER_QUAD;
-
-	*address = offset + eth56g_port_base[phy] +
-		   PHY_PTP_LANE_ADDR_STEP * lane;
-
-	return ICE_SUCCESS;
-}
-
-/**
- * ice_phy_port_mem_address_eth56g - Calculate a PHY port memory address
- * @port: Port number to be written
- * @offset: Offset from PHY port register base
- * @address: The result address
- */
-static enum ice_status
-ice_phy_port_mem_address_eth56g(u8 port, u16 offset, u32 *address)
-{
-	u8 phy, lane;
-
-	if (port >= ICE_NUM_EXTERNAL_PORTS)
-		return ICE_ERR_OUT_OF_RANGE;
-
-	phy = port / ICE_PORTS_PER_QUAD;
-	lane = port % ICE_PORTS_PER_QUAD;
-
-	*address = offset + eth56g_port_base[phy] +
-		   PHY_PTP_MEM_START + PHY_PTP_MEM_LANE_STEP * lane;
-
-	return ICE_SUCCESS;
-}
-
-/**
- * ice_write_phy_reg_eth56g_lp - Write a PHY port register with lock parameter
- * @hw: pointer to the HW struct
- * @port: Port number to be written
- * @offset: Offset from PHY port register base
- * @val: Value to write
- * @lock_sbq: true to lock the sideband queue
- */
-static enum ice_status
-ice_write_phy_reg_eth56g_lp(struct ice_hw *hw, u8 port, u16 offset, u32 val,
-			    bool lock_sbq)
-{
-	enum ice_status status;
-	u32 reg_addr;
-
-	status = ice_phy_port_reg_address_eth56g(port, offset, &reg_addr);
-	if (status)
-		return status;
-
-	return ice_write_phy_eth56g_raw_lp(hw, reg_addr, val, lock_sbq);
-}
-
-/**
- * ice_write_phy_reg_eth56g - Write a PHY port register with sbq locked
- * @hw: pointer to the HW struct
- * @port: Port number to be written
- * @offset: Offset from PHY port register base
- * @val: Value to write
- */
-enum ice_status
-ice_write_phy_reg_eth56g(struct ice_hw *hw, u8 port, u16 offset, u32 val)
-{
-	return ice_write_phy_reg_eth56g_lp(hw, port, offset, val, true);
-}
-
-/**
- * ice_read_phy_reg_eth56g_lp - Read a PHY port register with
- * lock parameter
- * @hw: pointer to the HW struct
- * @port: Port number to be read
- * @offset: Offset from PHY port register base
- * @val: Pointer to the value to read (out param)
- * @lock_sbq: true to lock the sideband queue
- */
-static enum ice_status
-ice_read_phy_reg_eth56g_lp(struct ice_hw *hw, u8 port, u16 offset, u32 *val,
-			   bool lock_sbq)
-{
-	enum ice_status status;
-	u32 reg_addr;
-
-	status = ice_phy_port_reg_address_eth56g(port, offset, &reg_addr);
-	if (status)
-		return status;
-
-	return ice_read_phy_eth56g_raw_lp(hw, reg_addr, val, lock_sbq);
-}
-
-/**
- * ice_read_phy_reg_eth56g - Read a PHY port register with sbq locked
- * @hw: pointer to the HW struct
- * @port: Port number to be read
- * @offset: Offset from PHY port register base
- * @val: Pointer to the value to read (out param)
- */
-enum ice_status
-ice_read_phy_reg_eth56g(struct ice_hw *hw, u8 port, u16 offset, u32 *val)
-{
-	return ice_read_phy_reg_eth56g_lp(hw, port, offset, val, true);
-}
-
-/**
- * ice_phy_port_mem_read_eth56g_lp - Read a PHY port memory location
- * with lock parameter
- * @hw: pointer to the HW struct
- * @port: Port number to be read
- * @offset: Offset from PHY port register base
- * @val: Pointer to the value to read (out param)
- * @lock_sbq: true to lock the sideband queue
- */
-static enum ice_status
-ice_phy_port_mem_read_eth56g_lp(struct ice_hw *hw, u8 port, u16 offset,
-				u32 *val, bool lock_sbq)
-{
-	enum ice_status status;
-	u32 mem_addr;
-
-	status = ice_phy_port_mem_address_eth56g(port, offset, &mem_addr);
-	if (status)
-		return status;
-
-	return ice_read_phy_eth56g_raw_lp(hw, mem_addr, val, lock_sbq);
-}
-
-/**
- * ice_phy_port_mem_read_eth56g - Read a PHY port memory location with
- * sbq locked
- * @hw: pointer to the HW struct
- * @port: Port number to be read
- * @offset: Offset from PHY port register base
- * @val: Pointer to the value to read (out param)
- */
-static enum ice_status
-ice_phy_port_mem_read_eth56g(struct ice_hw *hw, u8 port, u16 offset, u32 *val)
-{
-	return ice_phy_port_mem_read_eth56g_lp(hw, port, offset, val, true);
-}
-
-/**
- * ice_phy_port_mem_write_eth56g_lp - Write a PHY port memory location with
- * lock parameter
- * @hw: pointer to the HW struct
- * @port: Port number to be read
- * @offset: Offset from PHY port register base
- * @val: Pointer to the value to read (out param)
- * @lock_sbq: true to lock the sideband queue
- */
-static enum ice_status
-ice_phy_port_mem_write_eth56g_lp(struct ice_hw *hw, u8 port, u16 offset,
-				 u32 val, bool lock_sbq)
-{
-	enum ice_status status;
-	u32 mem_addr;
-
-	status = ice_phy_port_mem_address_eth56g(port, offset, &mem_addr);
-	if (status)
-		return status;
-
-	return ice_write_phy_eth56g_raw_lp(hw, mem_addr, val, lock_sbq);
-}
-
-/**
- * ice_phy_port_mem_write_eth56g - Write a PHY port memory location with
- * sbq locked
- * @hw: pointer to the HW struct
- * @port: Port number to be read
- * @offset: Offset from PHY port register base
- * @val: Pointer to the value to read (out param)
- */
-static enum ice_status
-ice_phy_port_mem_write_eth56g(struct ice_hw *hw, u8 port, u16 offset, u32 val)
-{
-	return ice_phy_port_mem_write_eth56g_lp(hw, port, offset, val, true);
-}
-
-/**
- * ice_is_64b_phy_reg_eth56g - Check if this is a 64bit PHY register
- * @low_addr: the low address to check
- *
- * Checks if the provided low address is one of the known 64bit PHY values
- * represented as two 32bit registers.
- */
-static bool ice_is_64b_phy_reg_eth56g(u16 low_addr)
-{
-	switch (low_addr) {
-	case PHY_REG_TX_TIMER_INC_PRE_L:
-	case PHY_REG_RX_TIMER_INC_PRE_L:
-	case PHY_REG_TX_CAPTURE_L:
-	case PHY_REG_RX_CAPTURE_L:
-	case PHY_REG_TOTAL_TX_OFFSET_L:
-	case PHY_REG_TOTAL_RX_OFFSET_L:
-		return true;
-	default:
-		return false;
-	}
-}
-
-/**
- * ice_is_40b_phy_reg_eth56g - Check if this is a 40bit PHY register
- * @low_addr: the low address to check
- *
- * Checks if the provided low address is one of the known 40bit PHY values
- * split into two registers with the lower 8 bits in the low register and the
- * upper 32 bits in the high register.
- */
-static bool ice_is_40b_phy_reg_eth56g(u16 low_addr)
-{
-	switch (low_addr) {
-	case PHY_REG_TIMETUS_L:
-		return true;
-	default:
-		return false;
-	}
-}
-
-/**
- * ice_read_40b_phy_reg_eth56g - Read a 40bit value from PHY registers
- * @hw: pointer to the HW struct
- * @port: PHY port to read from
- * @low_addr: offset of the lower register to read from
- * @val: on return, the contents of the 40bit value from the PHY registers
- *
- * Reads the two registers associated with a 40bit value and returns it in the
- * val pointer.
- * This function checks that the caller has specified a known 40 bit register
- * offset
- */
-static enum ice_status
-ice_read_40b_phy_reg_eth56g(struct ice_hw *hw, u8 port, u16 low_addr, u64 *val)
-{
-	u16 high_addr = low_addr + sizeof(u32);
-	enum ice_status status;
-	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;
-	}
-
-	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;
-	}
-
-	*val = ((u64)hi << P_REG_40B_HIGH_S) | (lo & P_REG_40B_LOW_M);
-
-	return ICE_SUCCESS;
-}
-
-/**
- * ice_read_64b_phy_reg_eth56g - Read a 64bit value from PHY registers
- * @hw: pointer to the HW struct
- * @port: PHY port to read from
- * @low_addr: offset of the lower register to read from
- * @val: on return, the contents of the 64bit value from the PHY registers
- *
- * Reads the two registers associated with a 64bit value and returns it in the
- * val pointer.
- * This function checks that the caller has specified a known 64 bit register
- * offset
- */
-static enum ice_status
-ice_read_64b_phy_reg_eth56g(struct ice_hw *hw, u8 port, u16 low_addr, u64 *val)
-{
-	u16 high_addr = low_addr + sizeof(u32);
-	enum ice_status status;
-	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;
-	}
-
-	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;
-	}
-
-	*val = ((u64)hi << 32) | lo;
-
-	return ICE_SUCCESS;
-}
-
-/**
- * ice_write_40b_phy_reg_eth56g - Write a 40b value to the PHY
- * @hw: pointer to the HW struct
- * @port: port to write to
- * @low_addr: offset of the low register
- * @val: 40b value to write
- *
- * Write the provided 40b value to the two associated registers by splitting
- * it up into two chunks, the lower 8 bits and the upper 32 bits.
- * This function checks that the caller has specified a known 40 bit register
- * offset
- */
-static enum ice_status
-ice_write_40b_phy_reg_eth56g(struct ice_hw *hw, u8 port, u16 low_addr, u64 val)
-{
-	u16 high_addr = low_addr + sizeof(u32);
-	enum ice_status status;
-	u32 lo, hi;
-
-	if (!ice_is_40b_phy_reg_eth56g(low_addr))
-		return ICE_ERR_PARAM;
-
-	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;
-	}
-
-	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;
-	}
-
-	return ICE_SUCCESS;
-}
-
-/**
- * ice_write_64b_phy_reg_eth56g - Write a 64bit value to PHY registers
- * @hw: pointer to the HW struct
- * @port: PHY port to read from
- * @low_addr: offset of the lower register to read from
- * @val: the contents of the 64bit value to write to PHY
- *
- * Write the 64bit value to the two associated 32bit PHY registers.
- * This function checks that the caller has specified a known 64 bit register
- * offset
- */
-static enum ice_status
-ice_write_64b_phy_reg_eth56g(struct ice_hw *hw, u8 port, u16 low_addr, u64 val)
-{
-	u16 high_addr = low_addr + sizeof(u32);
-	enum ice_status status;
-	u32 lo, hi;
-
-	if (!ice_is_64b_phy_reg_eth56g(low_addr))
-		return ICE_ERR_PARAM;
-
-	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;
-	}
-
-	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;
-	}
-
-	return ICE_SUCCESS;
-}
-
-/**
- * ice_read_phy_tstamp_eth56g - Read a PHY timestamp out of the port memory
- * @hw: pointer to the HW struct
- * @port: the port to read from
- * @idx: the timestamp index to read
- * @tstamp: on return, the 40bit timestamp value
- *
- * Read a 40bit timestamp value out of the two associated entries in the
- * port memory block of the internal PHYs of the 56G devices.
- */
-static enum ice_status
-ice_read_phy_tstamp_eth56g(struct ice_hw *hw, u8 port, u8 idx, u64 *tstamp)
-{
-	enum ice_status status;
-	u16 lo_addr, hi_addr;
-	u32 lo, hi;
-
-	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;
-	}
-
-	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;
-	}
-
-	/* For 56G based internal PHYs, the timestamp is reported with the
-	 * lower 8 bits in the low register, and the upper 32 bits in the high
-	 * register.
-	 */
-	*tstamp = ((u64)hi) << TS_PHY_HIGH_S | ((u64)lo & TS_PHY_LOW_M);
-
-	return ICE_SUCCESS;
-}
-
-/**
- * ice_clear_phy_tstamp_eth56g - Clear a timestamp from the quad block
- * @hw: pointer to the HW struct
- * @port: the quad to read from
- * @idx: the timestamp index to reset
- *
- * Clear a timestamp, resetting its valid bit, in the PHY port memory of
- * internal PHYs of the 56G devices.
- */
-static enum ice_status
-ice_clear_phy_tstamp_eth56g(struct ice_hw *hw, u8 port, u8 idx)
-{
-	enum ice_status status;
-	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;
-	}
-
-	return ICE_SUCCESS;
-}
-
-/**
- * ice_ptp_prep_port_phy_time_eth56g - Prepare one PHY port with initial time
- * @hw: pointer to the HW struct
- * @port: port number
- * @phy_time: time to initialize the PHY port clocks to
- *
- * Write a new initial time value into registers of a specific PHY port.
- */
-static enum ice_status
-ice_ptp_prep_port_phy_time_eth56g(struct ice_hw *hw, u8 port, u64 phy_time)
-{
-	enum ice_status status;
-
-	/* Tx case */
-	status = ice_write_64b_phy_reg_eth56g(hw, port,
-					      PHY_REG_TX_TIMER_INC_PRE_L,
-					      phy_time);
-	if (status)
-		return status;
-
-	/* Rx case */
-	return ice_write_64b_phy_reg_eth56g(hw, port,
-					    PHY_REG_RX_TIMER_INC_PRE_L,
-					    phy_time);
-}
-
-/**
- * ice_ptp_prep_phy_time_eth56g - Prepare PHY port with initial time
- * @hw: pointer to the HW struct
- * @time: Time to initialize the PHY port clocks to
- *
- * Program the PHY port registers with a new initial time value. The port
- * clock will be initialized once the driver issues an ICE_PTP_INIT_TIME sync
- * 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_prep_phy_time_eth56g(struct ice_hw *hw, u32 time)
-{
-	enum ice_status status;
-	u64 phy_time;
-	u8 port;
-
-	/* The time represents the upper 32 bits of the PHY timer, so we need
-	 * to shift to account for this when programming.
-	 */
-	phy_time = (u64)time << 32;
-
-	for (port = 0; port < ICE_NUM_EXTERNAL_PORTS; port++) {
-		if (!(hw->ena_lports & BIT(port)))
-			continue;
-		status = 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;
-		}
-	}
-
-	return ICE_SUCCESS;
-}
-
-/**
- * ice_ptp_prep_port_adj_eth56g - Prepare a single port for time adjust
- * @hw: pointer to HW struct
- * @port: Port number to be programmed
- * @time: time in cycles to adjust the port Tx and Rx clocks
- * @lock_sbq: true to lock the sbq sq_lock (the usual case); false if the
- *            sq_lock has already been locked at a higher level
- *
- * Program the port for an atomic adjustment by writing the Tx and Rx timer
- * registers. The atomic adjustment won't be completed until the driver issues
- * an ICE_PTP_ADJ_TIME command.
- *
- * Note that time is not in units of nanoseconds. It is in clock time
- * including the lower sub-nanosecond portion of the port timer.
- *
- * Negative adjustments are supported using 2s complement arithmetic.
- */
-enum ice_status
-ice_ptp_prep_port_adj_eth56g(struct ice_hw *hw, u8 port, s64 time,
-			     bool lock_sbq)
-{
-	enum ice_status status;
-	u32 l_time, u_time;
-
-	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)
-		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)
-		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)
-		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)
-		goto exit_err;
-
-	return ICE_SUCCESS;
-
-exit_err:
-	ice_debug(hw, ICE_DBG_PTP, "Failed to write time adjust for port %u, status %d\n",
-		  port, status);
-	return status;
-}
-
-/**
- * ice_ptp_prep_phy_adj_eth56g - Prep PHY ports for a time adjustment
- * @hw: pointer to HW struct
- * @adj: adjustment in nanoseconds
- * @lock_sbq: true to lock the sbq sq_lock (the usual case); false if the
- *            sq_lock has already been locked at a higher level
- *
- * Prepare the PHY ports for an atomic time adjustment by programming the PHY
- * Tx and Rx port registers. The actual adjustment is completed by issuing an
- * ICE_PTP_ADJ_TIME or ICE_PTP_ADJ_TIME_AT_TIME sync command.
- */
-static enum ice_status
-ice_ptp_prep_phy_adj_eth56g(struct ice_hw *hw, s32 adj, bool lock_sbq)
-{
-	enum ice_status status = ICE_SUCCESS;
-	s64 cycles;
-	u8 port;
-
-	/* The port clock supports adjustment of the sub-nanosecond portion of
-	 * the clock. We shift the provided adjustment in nanoseconds to
-	 * calculate the appropriate adjustment to program into the PHY ports.
-	 */
-	cycles = (s64)adj << 32;
-
-	for (port = 0; port < ICE_NUM_EXTERNAL_PORTS; port++) {
-		if (!(hw->ena_lports & BIT(port)))
-			continue;
-
-		status = ice_ptp_prep_port_adj_eth56g(hw, port, cycles,
-						      lock_sbq);
-		if (status)
-			break;
-	}
-
-	return status;
-}
-
-/**
- * ice_ptp_prep_phy_incval_eth56g - Prepare PHY ports for time adjustment
- * @hw: pointer to HW struct
- * @incval: new increment value to prepare
- *
- * Prepare each of the PHY ports for a new increment value by programming the
- * port's TIMETUS registers. The new increment value will be updated after
- * issuing an ICE_PTP_INIT_INCVAL command.
- */
-static enum ice_status
-ice_ptp_prep_phy_incval_eth56g(struct ice_hw *hw, u64 incval)
-{
-	enum ice_status status;
-	u8 port;
-
-	for (port = 0; port < ICE_NUM_EXTERNAL_PORTS; port++) {
-		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;
-		}
-	}
-
-	return ICE_SUCCESS;
-}
-
-/**
- * ice_ptp_read_phy_incval_eth56g - Read a PHY port's current incval
- * @hw: pointer to the HW struct
- * @port: the port to read
- * @incval: on return, the time_clk_cyc incval for this port
- *
- * Read the time_clk_cyc increment value for a given PHY port.
- */
-enum ice_status
-ice_ptp_read_phy_incval_eth56g(struct ice_hw *hw, u8 port, u64 *incval)
-{
-	enum ice_status status;
-
-	status = 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;
-	}
-
-	ice_debug(hw, ICE_DBG_PTP, "read INCVAL = 0x%016llx\n",
-		  (unsigned long long)*incval);
-
-	return ICE_SUCCESS;
-}
-
-/**
- * ice_ptp_prep_phy_adj_target_eth56g - Prepare PHY for adjust at target time
- * @hw: pointer to HW struct
- * @target_time: target time to program
- *
- * Program the PHY port Tx and Rx TIMER_CNT_ADJ registers used for the
- * ICE_PTP_ADJ_TIME_AT_TIME command. This should be used in conjunction with
- * ice_ptp_prep_phy_adj_eth56g to program an atomic adjustment that is
- * delayed until a specified target time.
- *
- * Note that a target time adjustment is not currently supported on E810
- * devices.
- */
-static enum ice_status
-ice_ptp_prep_phy_adj_target_eth56g(struct ice_hw *hw, u32 target_time)
-{
-	enum ice_status status;
-	u8 port;
-
-	for (port = 0; port < ICE_NUM_EXTERNAL_PORTS; port++) {
-		if (!(hw->ena_lports & BIT(port)))
-			continue;
-
-		/* 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)
-			goto exit_err;
-
-		status = ice_write_phy_reg_eth56g_lp(hw, port,
-						     PHY_REG_TX_TIMER_CNT_ADJ_U,
-						     target_time, true);
-		if (status)
-			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)
-			goto exit_err;
-
-		status = ice_write_phy_reg_eth56g_lp(hw, port,
-						     PHY_REG_RX_TIMER_CNT_ADJ_U,
-						     target_time, true);
-		if (status)
-			goto exit_err;
-	}
-
-	return ICE_SUCCESS;
-
-exit_err:
-	ice_debug(hw, ICE_DBG_PTP, "Failed to write target time for port %u, status %d\n",
-		  port, status);
-
-	return status;
-}
-
-/**
- * ice_ptp_read_port_capture_eth56g - Read a port's local time capture
- * @hw: pointer to HW struct
- * @port: Port number to read
- * @tx_ts: on return, the Tx port time capture
- * @rx_ts: on return, the Rx port time capture
- *
- * Read the port's Tx and Rx local time capture values.
- */
-enum ice_status
-ice_ptp_read_port_capture_eth56g(struct ice_hw *hw, u8 port, u64 *tx_ts,
-				 u64 *rx_ts)
-{
-	enum ice_status status;
-
-	/* 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;
-	}
-
-	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;
-	}
-
-	ice_debug(hw, ICE_DBG_PTP, "rx_init = %#016llx\n",
-		  (unsigned long long)*rx_ts);
-
-	return ICE_SUCCESS;
-}
-
-/**
- * ice_ptp_one_port_cmd_eth56g - 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 the requested port for an upcoming timer sync command.
- */
-enum ice_status
-ice_ptp_one_port_cmd_eth56g(struct ice_hw *hw, u8 port,
-			    enum ice_ptp_tmr_cmd cmd, bool lock_sbq)
-{
-	enum ice_status 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_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;
-	}
-
-	/* 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,
-					     lock_sbq);
-	if (status) {
-		ice_debug(hw, ICE_DBG_PTP, "Failed to write back TX_TMR_CMD, status %d\n",
-			  status);
-		return status;
-	}
-
-	/* Rx case */
-	/* Read, modify, write */
-	status = 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;
-	}
-
-	/* 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,
-					     lock_sbq);
-	if (status) {
-		ice_debug(hw, ICE_DBG_PTP, "Failed to write back RX_TMR_CMD, status %d\n",
-			  status);
-		return status;
-	}
-
-	return ICE_SUCCESS;
-}
-
-/**
- * ice_ptp_port_cmd_eth56g - 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 enum ice_status
-ice_ptp_port_cmd_eth56g(struct ice_hw *hw, enum ice_ptp_tmr_cmd cmd,
-			bool lock_sbq)
-{
-	enum ice_status status;
-	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;
-	}
-
-	return ICE_SUCCESS;
-}
-
-/**
- * ice_calc_fixed_tx_offset_eth56g - Calculated Fixed Tx offset for a port
- * @hw: pointer to the HW struct
- * @link_spd: the Link speed to calculate for
- *
- * Calculate the fixed offset due to known static latency data.
- */
-static u64
-ice_calc_fixed_tx_offset_eth56g(struct ice_hw *hw,
-				enum ice_ptp_link_spd link_spd)
-{
-	u64 fixed_offset = 0;
-	return fixed_offset;
-}
-
-/**
- * ice_phy_cfg_tx_offset_eth56g - Configure total Tx timestamp offset
- * @hw: pointer to the HW struct
- * @port: the PHY port to configure
- *
- * Program the PHY_REG_TOTAL_TX_OFFSET register with the total number of TUs to
- * adjust Tx timestamps by.
- *
- * To avoid overflow, when calculating the offset based on the known static
- * latency values, we use measurements in 1/100th of a nanosecond, and divide
- * the TUs per second up front. This avoids overflow while allowing
- * calculation of the adjustment using integer arithmetic.
- */
-enum ice_status ice_phy_cfg_tx_offset_eth56g(struct ice_hw *hw, u8 port)
-{
-	enum ice_ptp_link_spd link_spd = ICE_PTP_LNK_SPD_10G;
-	enum ice_status status;
-	u64 total_offset;
-
-	total_offset = ice_calc_fixed_tx_offset_eth56g(hw, link_spd);
-
-	/* Now that the total offset has been calculated, program it to the
-	 * 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;
-
-	return ice_write_phy_reg_eth56g(hw, port, PHY_REG_TX_OFFSET_READY, 1);
-}
-
-/**
- * ice_calc_fixed_rx_offset_eth56g - Calculated the fixed Rx offset for a port
- * @hw: pointer to HW struct
- * @link_spd: The Link speed to calculate for
- *
- * Determine the fixed Rx latency for a given link speed.
- */
-static u64
-ice_calc_fixed_rx_offset_eth56g(struct ice_hw *hw,
-				enum ice_ptp_link_spd link_spd)
-{
-	u64 fixed_offset = 0;
-	return fixed_offset;
-}
-
-/**
- * ice_phy_cfg_rx_offset_eth56g - Configure total Rx timestamp offset
- * @hw: pointer to the HW struct
- * @port: the PHY port to configure
- *
- * Program the PHY_REG_TOTAL_RX_OFFSET register with the number of Time Units to
- * adjust Rx timestamps by. This combines calculations from the Vernier offset
- * measurements taken in hardware with some data about known fixed delay as
- * well as adjusting for multi-lane alignment delay.
- *
- * This function must be called only after the offset registers are valid,
- * i.e. after the Vernier calibration wait has passed, to ensure that the PHY
- * has measured the offset.
- *
- * To avoid overflow, when calculating the offset based on the known static
- * latency values, we use measurements in 1/100th of a nanosecond, and divide
- * the TUs per second up front. This avoids overflow while allowing
- * calculation of the adjustment using integer arithmetic.
- */
-enum ice_status ice_phy_cfg_rx_offset_eth56g(struct ice_hw *hw, u8 port)
-{
-	enum ice_status status;
-	u64 total_offset;
-
-	total_offset = ice_calc_fixed_rx_offset_eth56g(hw, 0);
-
-	/* Now that the total offset has been calculated, program it to the
-	 * 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;
-
-	return ice_write_phy_reg_eth56g(hw, port, PHY_REG_RX_OFFSET_READY, 1);
-}
-
-/**
- * ice_read_phy_and_phc_time_eth56g - Simultaneously capture PHC and PHY time
- * @hw: pointer to the HW struct
- * @port: the PHY port to read
- * @phy_time: on return, the 64bit PHY timer value
- * @phc_time: on return, the lower 64bits of PHC time
- *
- * Issue a ICE_PTP_READ_TIME timer command to simultaneously capture the PHY
- * and PHC timer values.
- */
-static enum ice_status
-ice_read_phy_and_phc_time_eth56g(struct ice_hw *hw, u8 port, u64 *phy_time,
-				 u64 *phc_time)
-{
-	enum ice_status status;
-	u64 tx_time, rx_time;
-	u32 zo, lo;
-	u8 tmr_idx;
-
-	tmr_idx = ice_get_ptp_src_clock_index(hw);
-
-	/* Prepare the PHC timer for a ICE_PTP_READ_TIME capture command */
-	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;
-
-	/* 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));
-	lo = rd32(hw, GLTSYN_SHTIME_L(tmr_idx));
-	*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;
-
-	/* 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
-	 * driver always programs them together.
-	 */
-	if (tx_time != rx_time)
-		ice_warn(hw, "PHY port %u Tx and Rx timers do not match, tx_time 0x%016llX, rx_time 0x%016llX\n",
-			 port, (unsigned long long)tx_time,
-			 (unsigned long long)rx_time);
-
-	*phy_time = tx_time;
-
-	return ICE_SUCCESS;
-}
-
-/**
- * ice_sync_phy_timer_eth56g - Synchronize the PHY timer with PHC timer
- * @hw: pointer to the HW struct
- * @port: the PHY port to synchronize
- *
- * Perform an adjustment to ensure that the PHY and PHC timers are in sync.
- * This is done by issuing a ICE_PTP_READ_TIME command which triggers a
- * simultaneous read of the PHY timer and PHC timer. Then we use the
- * difference to calculate an appropriate 2s complement addition to add
- * to the PHY timer in order to ensure it reads the same value as the
- * primary PHC timer.
- */
-static enum ice_status ice_sync_phy_timer_eth56g(struct ice_hw *hw, u8 port)
-{
-	u64 phc_time, phy_time, difference;
-	enum ice_status status;
-
-	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)
-		goto err_unlock;
-
-	/* Calculate the amount required to add to the port time in order for
-	 * it to match the PHC time.
-	 *
-	 * Note that the port adjustment is done using 2s complement
-	 * arithmetic. This is convenient since it means that we can simply
-	 * calculate the difference between the PHC time and the port time,
-	 * and it will be interpreted correctly.
-	 */
-
-	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)
-		goto err_unlock;
-
-	status = ice_ptp_one_port_cmd_eth56g(hw, port, ICE_PTP_ADJ_TIME, true);
-	if (status)
-		goto err_unlock;
-
-	/* 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.
-	 */
-
-	status = ice_read_phy_and_phc_time_eth56g(hw, port, &phy_time,
-						  &phc_time);
-	if (status)
-		goto err_unlock;
-
-	ice_info(hw, "Port %u PHY time synced to PHC: 0x%016llX, 0x%016llX\n",
-		 port, (unsigned long long)phy_time,
-		 (unsigned long long)phc_time);
-
-err_unlock:
-	ice_ptp_unlock(hw);
-	return status;
-}
-
-/**
- * ice_stop_phy_timer_eth56g - Stop the PHY clock timer
- * @hw: pointer to the HW struct
- * @port: the PHY port to stop
- * @soft_reset: if true, hold the SOFT_RESET bit of PHY_REG_PS
- *
- * Stop the clock of a PHY port. This must be done as part of the flow to
- * re-calibrate Tx and Rx timestamping offsets whenever the clock time is
- * initialized or when link speed changes.
- */
-enum ice_status
-ice_stop_phy_timer_eth56g(struct ice_hw *hw, u8 port, bool soft_reset)
-{
-	enum ice_status status;
-
-	status = ice_write_phy_reg_eth56g(hw, port, PHY_REG_TX_OFFSET_READY, 0);
-	if (status)
-		return status;
-
-	status = ice_write_phy_reg_eth56g(hw, port, PHY_REG_RX_OFFSET_READY, 0);
-	if (status)
-		return status;
-
-	ice_debug(hw, ICE_DBG_PTP, "Disabled clock on PHY port %u\n", port);
-
-	return ICE_SUCCESS;
-}
-
-/**
- * ice_start_phy_timer_eth56g - Start the PHY clock timer
- * @hw: pointer to the HW struct
- * @port: the PHY port to start
- * @bypass: unused, for compatibility
- *
- * Start the clock of a PHY port. This must be done as part of the flow to
- * re-calibrate Tx and Rx timestamping offsets whenever the clock time is
- * initialized or when link speed changes.
- *
- */
-enum ice_status
-ice_start_phy_timer_eth56g(struct ice_hw *hw, u8 port, bool bypass)
-{
-	enum ice_status status;
-	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;
-
-	ice_ptp_src_cmd(hw, ICE_PTP_NOP);
-
-	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_eth56g(hw, port, PHY_REG_TIMETUS_L,
-					      incval);
-	if (status)
-		return status;
-
-	status = ice_ptp_one_port_cmd_eth56g(hw, port, ICE_PTP_INIT_INCVAL,
-					     true);
-	if (status)
-		return status;
-
-	ice_ptp_exec_tmr_cmd(hw);
-
-	status = ice_sync_phy_timer_eth56g(hw, port);
-	if (status)
-		return status;
-
-	/* Program the Tx offset */
-	status = ice_phy_cfg_tx_offset_eth56g(hw, port);
-	if (status)
-		return status;
-
-	/* Program the Rx offset */
-	status = ice_phy_cfg_rx_offset_eth56g(hw, port);
-	if (status)
-		return status;
-
-	ice_debug(hw, ICE_DBG_PTP, "Enabled clock on PHY port %u\n", port);
-
-	return ICE_SUCCESS;
-}
-
-/**
- * ice_ptp_init_phc_eth56g - Perform E822 specific PHC initialization
- * @hw: pointer to HW struct
- *
- * Perform PHC initialization steps specific to E822 devices.
- */
-static enum ice_status ice_ptp_init_phc_eth56g(struct ice_hw *hw)
-{
-	enum ice_status status = ICE_SUCCESS;
-	u32 regval;
-
-	/* Enable reading switch and PHY registers over the sideband queue */
-#define PF_SB_REM_DEV_CTL_SWITCH_READ BIT(1)
-#define PF_SB_REM_DEV_CTL_PHY0 BIT(2)
-	regval = rd32(hw, PF_SB_REM_DEV_CTL);
-	regval |= (PF_SB_REM_DEV_CTL_SWITCH_READ |
-		   PF_SB_REM_DEV_CTL_PHY0);
-	wr32(hw, PF_SB_REM_DEV_CTL, regval);
-
-	/* Initialize the Clock Generation Unit */
-	status = ice_init_cgu_e822(hw);
-
-	return status;
-}
-
-/**
- * ice_ptp_read_tx_hwtstamp_status_eth56g - Get the current TX timestamp
- * status mask. Returns the mask of ports where TX timestamps are available
- * @hw: pointer to the HW struct
- * @ts_status: the timestamp mask pointer
- */
-enum ice_status
-ice_ptp_read_tx_hwtstamp_status_eth56g(struct ice_hw *hw, u32 *ts_status)
-{
-	enum ice_status status;
-
-	status = ice_read_phy_eth56g_raw_lp(hw, PHY_PTP_INT_STATUS, ts_status,
-					    true);
-	if (status)
-		return status;
-
-	ice_debug(hw, ICE_DBG_PTP, "PHY interrupt status: %x\n", *ts_status);
-
-	return ICE_SUCCESS;
-}
-
-/**
- * ice_ptp_init_phy_cfg - Get the current TX timestamp status
- * mask. Returns the mask of ports where TX timestamps are available
- * @hw: pointer to the HW struct
- */
-enum ice_status
-ice_ptp_init_phy_cfg(struct ice_hw *hw)
-{
-	enum ice_status status;
-	u32 phy_rev;
-
-	status = ice_read_phy_eth56g_raw_lp(hw, PHY_REG_REVISION, &phy_rev,
-					    true);
-	if (status)
-		return status;
-
-	if (phy_rev == PHY_REVISION_ETH56G) {
-		hw->phy_cfg = ICE_PHY_ETH56G;
-		return ICE_SUCCESS;
-	}
-
-	if (ice_is_e810(hw))
-		hw->phy_cfg = ICE_PHY_E810;
-	else
-		hw->phy_cfg = ICE_PHY_E822;
-
-	return ICE_SUCCESS;
-}
 
 /* ----------------------------------------------------------------------------
  * E822 family functions
@@ -4891,9 +3522,6 @@ ice_ptp_tmr_cmd(struct ice_hw *hw, enum ice_ptp_tmr_cmd cmd, bool lock_sbq)
 
 	/* 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_E810:
 		status = ice_ptp_port_cmd_e810(hw, cmd, lock_sbq);
 		break;
@@ -4946,9 +3574,6 @@ enum ice_status ice_ptp_init_time(struct ice_hw *hw, u64 time)
 	/* PHY Clks */
 	/* Fill Rx and Tx ports and send msg to PHY */
 	switch (hw->phy_cfg) {
-	case ICE_PHY_ETH56G:
-		status = ice_ptp_prep_phy_time_eth56g(hw, time & 0xFFFFFFFF);
-		break;
 	case ICE_PHY_E810:
 		status = ice_ptp_prep_phy_time_e810(hw, time & 0xFFFFFFFF);
 		break;
@@ -4991,9 +3616,6 @@ enum ice_status ice_ptp_write_incval(struct ice_hw *hw, u64 incval)
 	wr32(hw, GLTSYN_SHADJ_H(tmr_idx), ICE_HI_DWORD(incval));
 
 	switch (hw->phy_cfg) {
-	case ICE_PHY_ETH56G:
-		status = ice_ptp_prep_phy_incval_eth56g(hw, incval);
-		break;
 	case ICE_PHY_E810:
 		status = ice_ptp_prep_phy_incval_e810(hw, incval);
 		break;
@@ -5062,9 +3684,6 @@ enum ice_status ice_ptp_adj_clock(struct ice_hw *hw, s32 adj, bool lock_sbq)
 	wr32(hw, GLTSYN_SHADJ_H(tmr_idx), adj);
 
 	switch (hw->phy_cfg) {
-	case ICE_PHY_ETH56G:
-		status = ice_ptp_prep_phy_adj_eth56g(hw, adj, lock_sbq);
-		break;
 	case ICE_PHY_E810:
 		status = ice_ptp_prep_phy_adj_e810(hw, adj, lock_sbq);
 		break;
@@ -5123,9 +3742,6 @@ ice_ptp_adj_clock_at_time(struct ice_hw *hw, u64 at_time, s32 adj)
 
 	/* Prepare PHY port adjustments */
 	switch (hw->phy_cfg) {
-	case ICE_PHY_ETH56G:
-		status = ice_ptp_prep_phy_adj_eth56g(hw, adj, true);
-		break;
 	case ICE_PHY_E810:
 		status = ice_ptp_prep_phy_adj_e810(hw, adj, true);
 		break;
@@ -5141,9 +3757,6 @@ ice_ptp_adj_clock_at_time(struct ice_hw *hw, u64 at_time, s32 adj)
 
 	/* Set target time for each PHY port */
 	switch (hw->phy_cfg) {
-	case ICE_PHY_ETH56G:
-		status = ice_ptp_prep_phy_adj_target_eth56g(hw, time_lo);
-		break;
 	case ICE_PHY_E810:
 		status = ice_ptp_prep_phy_adj_target_e810(hw, time_lo);
 		break;
@@ -5177,9 +3790,6 @@ ice_read_phy_tstamp(struct ice_hw *hw, u8 block, u8 idx, u64 *tstamp)
 	enum ice_status status;
 
 	switch (hw->phy_cfg) {
-	case ICE_PHY_ETH56G:
-		status = ice_read_phy_tstamp_eth56g(hw, block, idx, tstamp);
-		break;
 	case ICE_PHY_E810:
 		status = ice_read_phy_tstamp_e810(hw, block, idx, tstamp);
 		break;
@@ -5209,9 +3819,6 @@ ice_clear_phy_tstamp(struct ice_hw *hw, u8 block, u8 idx)
 	enum ice_status status;
 
 	switch (hw->phy_cfg) {
-	case ICE_PHY_ETH56G:
-		status = ice_clear_phy_tstamp_eth56g(hw, block, idx);
-		break;
 	case ICE_PHY_E810:
 		status = ice_clear_phy_tstamp_e810(hw, block, idx);
 		break;
@@ -5243,9 +3850,6 @@ enum ice_status ice_ptp_init_phc(struct ice_hw *hw)
 	(void)rd32(hw, GLTSYN_STAT(src_idx));
 
 	switch (hw->phy_cfg) {
-	case ICE_PHY_ETH56G:
-		status = ice_ptp_init_phc_eth56g(hw);
-		break;
 	case ICE_PHY_E810:
 		status = ice_ptp_init_phc_e810(hw);
 		break;
drivers/net/ice/base/ice_ptp_hw.h +0 -38
index 3667c9882d..d2581e63f9 100644
@@ -235,38 +235,7 @@ bool ice_is_pca9575_present(struct ice_hw *hw);
 
 void
 ice_ptp_process_cgu_err(struct ice_hw *hw, struct ice_rq_event_info *event);
-/* ETH56G family functions */
-enum ice_status
-ice_read_phy_reg_eth56g(struct ice_hw *hw, u8 port, u16 offset, u32 *val);
-enum ice_status
-ice_write_phy_reg_eth56g(struct ice_hw *hw, u8 port, u16 offset, u32 val);
-enum ice_status
-ice_read_phy_mem_eth56g(struct ice_hw *hw, u8 port, u16 offset, u32 *val);
-enum ice_status
-ice_write_phy_mem_eth56g(struct ice_hw *hw, u8 port, u16 offset, u32 val);
-
-enum ice_status
-ice_ptp_prep_port_adj_eth56g(struct ice_hw *hw, u8 port, s64 time,
-			     bool lock_sbq);
-
-enum ice_status
-ice_ptp_read_phy_incval_eth56g(struct ice_hw *hw, u8 port, u64 *incval);
-enum ice_status
-ice_ptp_read_port_capture_eth56g(struct ice_hw *hw, u8 port,
-				 u64 *tx_ts, u64 *rx_ts);
-enum ice_status
-ice_ptp_one_port_cmd_eth56g(struct ice_hw *hw, u8 port,
-			    enum ice_ptp_tmr_cmd cmd, bool lock_sbq);
-enum ice_status
-ice_ptp_read_tx_hwtstamp_status_eth56g(struct ice_hw *hw, u32 *ts_status);
-enum ice_status
-ice_stop_phy_timer_eth56g(struct ice_hw *hw, u8 port, bool soft_reset);
-enum ice_status
-ice_start_phy_timer_eth56g(struct ice_hw *hw, u8 port, bool bypass);
-enum ice_status ice_phy_cfg_tx_offset_eth56g(struct ice_hw *hw, u8 port);
-enum ice_status ice_phy_cfg_rx_offset_eth56g(struct ice_hw *hw, u8 port);
 
-enum ice_status ice_ptp_init_phy_cfg(struct ice_hw *hw);
 
 #define PFTSYN_SEM_BYTES	4
 
@@ -528,12 +497,6 @@ enum ice_status ice_ptp_init_phy_cfg(struct ice_hw *hw);
 #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
-#define ICE_PHY2_BASE			0x1BA000
-#define ICE_PHY3_BASE			0x24E000
-#define ICE_PHY4_BASE			0x2E2000
 
 /* Timestamp memory */
 #define PHY_PTP_LANE_ADDR_STEP		0x98
@@ -602,6 +565,5 @@ enum ice_status ice_ptp_init_phy_cfg(struct ice_hw *hw);
 #define PHY_TSTAMP_U(x) (((x) * 8) + 4)
 
 #define PHY_REG_REVISION		0x85000
-#define PHY_REVISION_ETH56G		0x10200
 
 #endif /* _ICE_PTP_HW_H_ */
Signature · 1 line
2.25.1
#16 lore raw

PATCH 15/30 net/ice/base: allow skip main timer

In reply to Qiming Yang

Allow initialization functions to skip main timer programming.

---
 drivers/net/ice/base/ice_ptp_hw.c | 32 ++++++++++++++++++++-----------
 drivers/net/ice/base/ice_ptp_hw.h |  9 ++++++---
 drivers/net/ice/ice_ethdev.c      |  2 +-
 3 files changed, 28 insertions(+), 15 deletions(-)
drivers/net/ice/base/ice_ptp_hw.c +21 -11
index 61145262ac..43b7e313f4 100644
@@ -3550,6 +3550,7 @@ ice_ptp_tmr_cmd(struct ice_hw *hw, enum ice_ptp_tmr_cmd cmd, bool lock_sbq)
  * ice_ptp_init_time - Initialize device time to provided value
  * @hw: pointer to HW struct
  * @time: 64bits of time (GLTSYN_TIME_L and GLTSYN_TIME_H)
+ * @wr_main_tmr: program the main timer
  *
  * Initialize the device to the specified time provided. This requires a three
  * step process:
@@ -3559,7 +3560,8 @@ ice_ptp_tmr_cmd(struct ice_hw *hw, enum ice_ptp_tmr_cmd cmd, bool lock_sbq)
  * 3) issue an init_time timer command to synchronously switch both the source
  *    and port timers to the new init time value at the next clock cycle.
  */
-enum ice_status ice_ptp_init_time(struct ice_hw *hw, u64 time)
+enum ice_status ice_ptp_init_time(struct ice_hw *hw, u64 time,
+				  bool wr_main_tmr)
 {
 	enum ice_status status;
 	u8 tmr_idx;
@@ -3567,9 +3569,11 @@ enum ice_status ice_ptp_init_time(struct ice_hw *hw, u64 time)
 	tmr_idx = hw->func_caps.ts_func_info.tmr_index_owned;
 
 	/* Source timers */
-	wr32(hw, GLTSYN_SHTIME_L(tmr_idx), ICE_LO_DWORD(time));
-	wr32(hw, GLTSYN_SHTIME_H(tmr_idx), ICE_HI_DWORD(time));
-	wr32(hw, GLTSYN_SHTIME_0(tmr_idx), 0);
+	if (wr_main_tmr) {
+		wr32(hw, GLTSYN_SHTIME_L(tmr_idx), ICE_LO_DWORD(time));
+		wr32(hw, GLTSYN_SHTIME_H(tmr_idx), ICE_HI_DWORD(time));
+		wr32(hw, GLTSYN_SHTIME_0(tmr_idx), 0);
+	}
 
 	/* PHY Clks */
 	/* Fill Rx and Tx ports and send msg to PHY */
@@ -3594,8 +3598,9 @@ enum ice_status ice_ptp_init_time(struct ice_hw *hw, u64 time)
  * ice_ptp_write_incval - Program PHC with new increment value
  * @hw: pointer to HW struct
  * @incval: Source timer increment value per clock cycle
+ * @wr_main_tmr: Program the main timer
  *
- * Program the PHC with a new increment value. This requires a three-step
+ * Program the timers with a new increment value. This requires a three-step
  * process:
  *
  * 1) Write the increment value to the source timer shadow registers
@@ -3604,16 +3609,19 @@ enum ice_status ice_ptp_init_time(struct ice_hw *hw, u64 time)
  *    the source and port timers to the new increment value at the next clock
  *    cycle.
  */
-enum ice_status ice_ptp_write_incval(struct ice_hw *hw, u64 incval)
+enum ice_status ice_ptp_write_incval(struct ice_hw *hw, u64 incval,
+				     bool wr_main_tmr)
 {
 	enum ice_status status;
 	u8 tmr_idx;
 
 	tmr_idx = hw->func_caps.ts_func_info.tmr_index_owned;
 
-	/* Shadow Adjust */
-	wr32(hw, GLTSYN_SHADJ_L(tmr_idx), ICE_LO_DWORD(incval));
-	wr32(hw, GLTSYN_SHADJ_H(tmr_idx), ICE_HI_DWORD(incval));
+	if (wr_main_tmr) {
+		/* Shadow Adjust */
+		wr32(hw, GLTSYN_SHADJ_L(tmr_idx), ICE_LO_DWORD(incval));
+		wr32(hw, GLTSYN_SHADJ_H(tmr_idx), ICE_HI_DWORD(incval));
+	}
 
 	switch (hw->phy_cfg) {
 	case ICE_PHY_E810:
@@ -3636,17 +3644,19 @@ enum ice_status ice_ptp_write_incval(struct ice_hw *hw, u64 incval)
  * ice_ptp_write_incval_locked - Program new incval while holding semaphore
  * @hw: pointer to HW struct
  * @incval: Source timer increment value per clock cycle
+ * @wr_main_tmr: Program the main timer
  *
  * Program a new PHC incval while holding the PTP semaphore.
  */
-enum ice_status ice_ptp_write_incval_locked(struct ice_hw *hw, u64 incval)
+enum ice_status ice_ptp_write_incval_locked(struct ice_hw *hw, u64 incval,
+					    bool wr_main_tmr)
 {
 	enum ice_status status;
 
 	if (!ice_ptp_lock(hw))
 		return ICE_ERR_NOT_READY;
 
-	status = ice_ptp_write_incval(hw, incval);
+	status = ice_ptp_write_incval(hw, incval, wr_main_tmr);
 
 	ice_ptp_unlock(hw);
 
drivers/net/ice/base/ice_ptp_hw.h +6 -3
index d2581e63f9..48a30f1f4e 100644
@@ -131,9 +131,12 @@ u64 ice_ptp_read_src_incval(struct ice_hw *hw);
 bool ice_ptp_lock(struct ice_hw *hw);
 void ice_ptp_unlock(struct ice_hw *hw);
 void ice_ptp_src_cmd(struct ice_hw *hw, enum ice_ptp_tmr_cmd cmd);
-enum ice_status ice_ptp_init_time(struct ice_hw *hw, u64 time);
-enum ice_status ice_ptp_write_incval(struct ice_hw *hw, u64 incval);
-enum ice_status ice_ptp_write_incval_locked(struct ice_hw *hw, u64 incval);
+enum ice_status ice_ptp_init_time(struct ice_hw *hw, u64 time,
+				  bool wr_main_tmr);
+enum ice_status ice_ptp_write_incval(struct ice_hw *hw, u64 incval,
+				     bool wr_main_tmr);
+enum ice_status ice_ptp_write_incval_locked(struct ice_hw *hw, u64 incval,
+					    bool wr_main_tmr);
 enum ice_status ice_ptp_adj_clock(struct ice_hw *hw, s32 adj, bool lock_sbq);
 enum ice_status
 ice_ptp_adj_clock_at_time(struct ice_hw *hw, u64 at_time, s32 adj);
drivers/net/ice/ice_ethdev.c +1 -1
index 9a88cf9796..6700893bc5 100644
@@ -5832,7 +5832,7 @@ ice_timesync_enable(struct rte_eth_dev *dev)
 			return -1;
 		}
 
-		ret = ice_ptp_write_incval(hw, ICE_PTP_NOMINAL_INCVAL_E810);
+		ret = ice_ptp_write_incval(hw, ICE_PTP_NOMINAL_INCVAL_E810, 1);
 		if (ret) {
 			PMD_DRV_LOG(ERR,
 				"Failed to write PHC increment time value");
Signature · 1 line
2.25.1
#17 lore raw

PATCH 16/30 net/ice/base: add E830 PTP init

In reply to Qiming Yang

The E830, E822 and E810 PTP initialization flows are similar. So related fix are also added.

---
 drivers/net/ice/base/ice_ptp_hw.c | 295 +++++++++++++++++++-----------
 drivers/net/ice/base/ice_ptp_hw.h |  94 +++++++++-
 drivers/net/ice/base/ice_type.h   |  18 +-
 drivers/net/ice/ice_ethdev.c      |   6 +-
 4 files changed, 298 insertions(+), 115 deletions(-)
drivers/net/ice/base/ice_ptp_hw.c +193 -102
index 43b7e313f4..a638bb114c 100644
@@ -448,6 +448,17 @@ static void ice_ptp_clean_cmd(struct ice_hw *hw)
 	ice_flush(hw);
 }
 
+/**
+ * ice_ptp_zero_syn_dlay - Set synchronization delay to zero
+ * @hw: pointer to HW struct
+ *
+ * Zero E810 and E830 specific PTP hardware clock synchronization delay.
+ */
+static void ice_ptp_zero_syn_dlay(struct ice_hw *hw)
+{
+	wr32(hw, GLTSYN_SYNC_DLAY, 0);
+	ice_flush(hw);
+}
 
 /* ----------------------------------------------------------------------------
  * E822 family functions
@@ -1037,6 +1048,33 @@ ice_clear_phy_tstamp_e822(struct ice_hw *hw, u8 quad, u8 idx)
 	return ICE_SUCCESS;
 }
 
+/**
+ * ice_ptp_reset_ts_memory_quad_e822 - Clear all timestamps from the quad block
+ * @hw: pointer to the HW struct
+ * @quad: the quad to read from
+ *
+ * Clear all timestamps from the PHY quad block that is shared between the
+ * internal PHYs on the E822 devices.
+ */
+void ice_ptp_reset_ts_memory_quad_e822(struct ice_hw *hw, u8 quad)
+{
+	ice_write_quad_reg_e822(hw, quad, Q_REG_TS_CTRL, Q_REG_TS_CTRL_M);
+	ice_write_quad_reg_e822(hw, quad, Q_REG_TS_CTRL, ~(u32)Q_REG_TS_CTRL_M);
+}
+
+/**
+ * ice_ptp_reset_ts_memory_e822 - Clear all timestamps from all quad blocks
+ * @hw: pointer to the HW struct
+ */
+static void ice_ptp_reset_ts_memory_e822(struct ice_hw *hw)
+{
+	u8 quad;
+
+	for (quad = 0; quad < ICE_MAX_QUAD; quad++) {
+		ice_ptp_reset_ts_memory_quad_e822(hw, quad);
+	}
+}
+
 /**
  * ice_ptp_set_vernier_wl - Set the window length for vernier calibration
  * @hw: pointer to the HW struct
@@ -2652,89 +2690,43 @@ ice_start_phy_timer_e822(struct ice_hw *hw, u8 port, bool bypass)
 }
 
 /**
- * ice_phy_exit_bypass_e822 - Exit bypass mode, after vernier calculations
+ * ice_get_phy_tx_tstamp_ready_e822 - Read Tx memory status register
  * @hw: pointer to the HW struct
- * @port: the PHY port to configure
- *
- * After hardware finishes vernier calculations for the Tx and Rx offset, this
- * function can be used to exit bypass mode by updating the total Tx and Rx
- * offsets, and then disabling bypass. This will enable hardware to include
- * the more precise offset calibrations, increasing precision of the generated
- * timestamps.
+ * @quad: the timestamp quad to read from
+ * @tstamp_ready: contents of the Tx memory status register
  *
- * This cannot be done until hardware has measured the offsets, which requires
- * waiting until at least one packet has been sent and received by the device.
+ * Read the Q_REG_TX_MEMORY_STATUS register indicating which timestamps in
+ * the PHY are ready. A set bit means the corresponding timestamp is valid and
+ * ready to be captured from the PHY timestamp block.
  */
-enum ice_status ice_phy_exit_bypass_e822(struct ice_hw *hw, u8 port)
+static enum ice_status
+ice_get_phy_tx_tstamp_ready_e822(struct ice_hw *hw, u8 quad, u64 *tstamp_ready)
 {
 	enum ice_status status;
-	u32 val;
+	u32 hi, lo;
 
-	status = ice_read_phy_reg_e822(hw, port, P_REG_TX_OV_STATUS, &val);
+	status = ice_read_quad_reg_e822(hw, quad, Q_REG_TX_MEMORY_STATUS_U,
+					&hi);
 	if (status) {
-		ice_debug(hw, ICE_DBG_PTP, "Failed to read TX_OV_STATUS for port %u, status %d\n",
-			  port, status);
+		ice_debug(hw, ICE_DBG_PTP, "Failed to read TX_MEMORY_STATUS_U for quad %u, status %d\n",
+			  quad, status);
 		return status;
 	}
 
-	if (!(val & P_REG_TX_OV_STATUS_OV_M)) {
-		ice_debug(hw, ICE_DBG_PTP, "Tx offset is not yet valid for port %u\n",
-			  port);
-		return ICE_ERR_NOT_READY;
-	}
-
-	status = ice_read_phy_reg_e822(hw, port, P_REG_RX_OV_STATUS, &val);
+	status = ice_read_quad_reg_e822(hw, quad, Q_REG_TX_MEMORY_STATUS_L,
+					&lo);
 	if (status) {
-		ice_debug(hw, ICE_DBG_PTP, "Failed to read RX_OV_STATUS for port %u, status %d\n",
-			  port, status);
+		ice_debug(hw, ICE_DBG_PTP, "Failed to read TX_MEMORY_STATUS_L for quad %u, status %d\n",
+			  quad, status);
 		return status;
 	}
 
-	if (!(val & P_REG_TX_OV_STATUS_OV_M)) {
-		ice_debug(hw, ICE_DBG_PTP, "Rx offset is not yet valid for port %u\n",
-			  port);
-		return ICE_ERR_NOT_READY;
-	}
-
-	status = ice_phy_cfg_tx_offset_e822(hw, port);
-	if (status) {
-		ice_debug(hw, ICE_DBG_PTP, "Failed to program total Tx offset for port %u, status %d\n",
-			  port, status);
-		return status;
-	}
-
-	status = ice_phy_cfg_rx_offset_e822(hw, port);
-	if (status) {
-		ice_debug(hw, ICE_DBG_PTP, "Failed to program total Rx offset for port %u, status %d\n",
-			  port, status);
-		return status;
-	}
-
-	/* Exit bypass mode now that the offset has been updated */
-	status = ice_read_phy_reg_e822(hw, port, P_REG_PS, &val);
-	if (status) {
-		ice_debug(hw, ICE_DBG_PTP, "Failed to read P_REG_PS for port %u, status %d\n",
-			  port, status);
-		return status;
-	}
-
-	if (!(val & P_REG_PS_BYPASS_MODE_M))
-		ice_debug(hw, ICE_DBG_PTP, "Port %u not in bypass mode\n",
-			  port);
-
-	val &= ~P_REG_PS_BYPASS_MODE_M;
-	status = ice_write_phy_reg_e822(hw, port, P_REG_PS, val);
-	if (status) {
-		ice_debug(hw, ICE_DBG_PTP, "Failed to disable bypass for port %u, status %d\n",
-			  port, status);
-		return status;
-	}
-
-	ice_info(hw, "Exiting bypass mode on PHY port %u\n", port);
+	*tstamp_ready = (u64)hi << 32 | (u64)lo;
 
 	return ICE_SUCCESS;
 }
 
+
 /* E810 functions
  *
  * The following functions operate on the E810 series devices which use
@@ -3218,6 +3210,22 @@ ice_ptp_port_cmd_e810(struct ice_hw *hw, enum ice_ptp_tmr_cmd cmd,
 	return ICE_SUCCESS;
 }
 
+/**
+ * ice_get_phy_tx_tstamp_ready_e810 - 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
+ *
+ * E810 devices do not use a Tx memory status register. Instead simply
+ * indicate that all timestamps are currently ready.
+ */
+static enum ice_status
+ice_get_phy_tx_tstamp_ready_e810(struct ice_hw *hw, u8 port, u64 *tstamp_ready)
+{
+	*tstamp_ready = 0xFFFFFFFFFFFFFFFF;
+	return ICE_SUCCESS;
+}
+
 /* E810T SMA functions
  *
  * The following functions operate specifically on E810T hardware and are used
@@ -3445,6 +3453,23 @@ bool ice_is_pca9575_present(struct ice_hw *hw)
 	return false;
 }
 
+/* E830 functions
+ *
+ * The following functions operate on the E830 series devices.
+ *
+ */
+
+/**
+ * ice_ptp_init_phc_e830 - Perform E830 specific PHC initialization
+ * @hw: pointer to HW struct
+ *
+ * Perform E830-specific PTP hardware clock initialization steps.
+ */
+static enum ice_status ice_ptp_init_phc_e830(struct ice_hw *hw)
+{
+	ice_ptp_zero_syn_dlay(hw);
+	return ICE_SUCCESS;
+}
 /* Device agnostic functions
  *
  * The following functions implement shared behavior common to both E822/E823
@@ -3501,6 +3526,29 @@ void ice_ptp_unlock(struct ice_hw *hw)
 	wr32(hw, PFTSYN_SEM + (PFTSYN_SEM_BYTES * hw->pf_id), 0);
 }
 
+#define ICE_DEVID_MASK 0xFFF8
+
+/**
+ * ice_ptp_init_phy_model - Initialize hw->phy_model based on device type
+ * @hw: pointer to the HW structure
+ *
+ * Determine the PHY model for the device, and initialize hw->phy_model
+ * for use by other functions.
+ */
+enum ice_status ice_ptp_init_phy_model(struct ice_hw *hw)
+{
+
+	if (ice_is_e810(hw))
+		hw->phy_model = ICE_PHY_E810;
+	else if (ice_is_e830(hw))
+		hw->phy_model = ICE_PHY_E830;
+	else
+		hw->phy_model = ICE_PHY_E822;
+	hw->phy_ports = ICE_NUM_EXTERNAL_PORTS;
+
+	return ICE_SUCCESS;
+}
+
 /**
  * ice_ptp_tmr_cmd - Prepare and trigger a timer sync command
  * @hw: pointer to HW struct
@@ -3521,16 +3569,20 @@ ice_ptp_tmr_cmd(struct ice_hw *hw, enum ice_ptp_tmr_cmd cmd, bool lock_sbq)
 	ice_ptp_src_cmd(hw, cmd);
 
 	/* Next, prepare the ports */
-	switch (hw->phy_cfg) {
+	switch (hw->phy_model) {
 	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;
+	case ICE_PHY_E830:
+		status = ICE_SUCCESS;
+		break;
 	default:
 		status = ICE_ERR_NOT_SUPPORTED;
 	}
+
 	if (status) {
 		ice_debug(hw, ICE_DBG_PTP, "Failed to prepare PHY ports for timer command %u, status %d\n",
 			  cmd, status);
@@ -3577,13 +3629,16 @@ enum ice_status ice_ptp_init_time(struct ice_hw *hw, u64 time,
 
 	/* PHY Clks */
 	/* Fill Rx and Tx ports and send msg to PHY */
-	switch (hw->phy_cfg) {
+	switch (hw->phy_model) {
 	case ICE_PHY_E810:
 		status = ice_ptp_prep_phy_time_e810(hw, time & 0xFFFFFFFF);
 		break;
 	case ICE_PHY_E822:
 		status = ice_ptp_prep_phy_time_e822(hw, time & 0xFFFFFFFF);
 		break;
+	case ICE_PHY_E830:
+		status = ICE_SUCCESS;
+		break;
 	default:
 		status = ICE_ERR_NOT_SUPPORTED;
 	}
@@ -3623,13 +3678,16 @@ enum ice_status ice_ptp_write_incval(struct ice_hw *hw, u64 incval,
 		wr32(hw, GLTSYN_SHADJ_H(tmr_idx), ICE_HI_DWORD(incval));
 	}
 
-	switch (hw->phy_cfg) {
+	switch (hw->phy_model) {
 	case ICE_PHY_E810:
 		status = ice_ptp_prep_phy_incval_e810(hw, incval);
 		break;
 	case ICE_PHY_E822:
 		status = ice_ptp_prep_phy_incval_e822(hw, incval);
 		break;
+	case ICE_PHY_E830:
+		status = ICE_SUCCESS;
+		break;
 	default:
 		status = ICE_ERR_NOT_SUPPORTED;
 	}
@@ -3693,7 +3751,7 @@ enum ice_status ice_ptp_adj_clock(struct ice_hw *hw, s32 adj, bool lock_sbq)
 	wr32(hw, GLTSYN_SHADJ_L(tmr_idx), 0);
 	wr32(hw, GLTSYN_SHADJ_H(tmr_idx), adj);
 
-	switch (hw->phy_cfg) {
+	switch (hw->phy_model) {
 	case ICE_PHY_E810:
 		status = ice_ptp_prep_phy_adj_e810(hw, adj, lock_sbq);
 		break;
@@ -3751,7 +3809,7 @@ ice_ptp_adj_clock_at_time(struct ice_hw *hw, u64 at_time, s32 adj)
 	wr32(hw, GLTSYN_SHTIME_H(tmr_idx), time_hi);
 
 	/* Prepare PHY port adjustments */
-	switch (hw->phy_cfg) {
+	switch (hw->phy_model) {
 	case ICE_PHY_E810:
 		status = ice_ptp_prep_phy_adj_e810(hw, adj, true);
 		break;
@@ -3766,7 +3824,7 @@ ice_ptp_adj_clock_at_time(struct ice_hw *hw, u64 at_time, s32 adj)
 		return status;
 
 	/* Set target time for each PHY port */
-	switch (hw->phy_cfg) {
+	switch (hw->phy_model) {
 	case ICE_PHY_E810:
 		status = ice_ptp_prep_phy_adj_target_e810(hw, time_lo);
 		break;
@@ -3797,49 +3855,58 @@ ice_ptp_adj_clock_at_time(struct ice_hw *hw, u64 at_time, s32 adj)
 enum ice_status
 ice_read_phy_tstamp(struct ice_hw *hw, u8 block, u8 idx, u64 *tstamp)
 {
-	enum ice_status status;
-
-	switch (hw->phy_cfg) {
+	switch (hw->phy_model) {
 	case ICE_PHY_E810:
-		status = ice_read_phy_tstamp_e810(hw, block, idx, tstamp);
-		break;
+		return ice_read_phy_tstamp_e810(hw, block, idx, tstamp);
 	case ICE_PHY_E822:
-		status = ice_read_phy_tstamp_e822(hw, block, idx, tstamp);
-		break;
+		return ice_read_phy_tstamp_e822(hw, block, idx, tstamp);
 	default:
-		status = ICE_ERR_NOT_SUPPORTED;
+		return ICE_ERR_NOT_SUPPORTED;
 	}
-
-	return status;
 }
 
 /**
- * ice_clear_phy_tstamp - Clear a timestamp from the timestamp block
+ * ice_clear_phy_tstamp - Drop a timestamp from the timestamp block
  * @hw: pointer to the HW struct
  * @block: the block to read from
  * @idx: the timestamp index to reset
  *
- * Clear a timestamp, resetting its valid bit, from the timestamp block. For
- * E822 devices, the block is the quad to clear from. For E810 devices, the
- * block is the logical port to clear from.
+ * Drop a timestamp from the timestamp block by reading it. This will reset
+ * the memory status bit allowing the timestamp index to be reused. For E822
+ * devices, the block is the quad to clear from. For E810 devices, the block
+ * is the logical port to clear from.
+ *
+ * This function should only be called on a timestamp index whose valid bit
+ * is set according to ice_get_phy_tx_tstamp_ready.
  */
 enum ice_status
 ice_clear_phy_tstamp(struct ice_hw *hw, u8 block, u8 idx)
 {
-	enum ice_status status;
-
-	switch (hw->phy_cfg) {
+	switch (hw->phy_model) {
 	case ICE_PHY_E810:
-		status = ice_clear_phy_tstamp_e810(hw, block, idx);
-		break;
+		return ice_clear_phy_tstamp_e810(hw, block, idx);
 	case ICE_PHY_E822:
-		status = ice_clear_phy_tstamp_e822(hw, block, idx);
-		break;
+		return ice_clear_phy_tstamp_e822(hw, block, idx);
 	default:
-		status = ICE_ERR_NOT_SUPPORTED;
+		return ICE_ERR_NOT_SUPPORTED;
 	}
+}
 
-	return status;
+/**
+ * ice_ptp_reset_ts_memory - Reset timestamp memory for all blocks
+ * @hw: pointer to the HW struct
+ */
+void ice_ptp_reset_ts_memory(struct ice_hw *hw)
+{
+	switch (hw->phy_model) {
+	case ICE_PHY_E822:
+		ice_ptp_reset_ts_memory_e822(hw);
+		break;
+	case ICE_PHY_E810:
+	case ICE_PHY_E830:
+	default:
+		return;
+	}
 }
 
 /**
@@ -3850,7 +3917,6 @@ ice_clear_phy_tstamp(struct ice_hw *hw, u8 block, u8 idx)
  */
 enum ice_status ice_ptp_init_phc(struct ice_hw *hw)
 {
-	enum ice_status status;
 	u8 src_idx = hw->func_caps.ts_func_info.tmr_index_owned;
 
 	/* Enable source clocks */
@@ -3859,16 +3925,41 @@ enum ice_status ice_ptp_init_phc(struct ice_hw *hw)
 	/* Clear event status indications for auxiliary pins */
 	(void)rd32(hw, GLTSYN_STAT(src_idx));
 
-	switch (hw->phy_cfg) {
+	switch (hw->phy_model) {
 	case ICE_PHY_E810:
-		status = ice_ptp_init_phc_e810(hw);
-		break;
+		return ice_ptp_init_phc_e810(hw);
 	case ICE_PHY_E822:
-		status = ice_ptp_init_phc_e822(hw);
-		break;
+		return ice_ptp_init_phc_e822(hw);
+	case ICE_PHY_E830:
+		return ice_ptp_init_phc_e830(hw);
 	default:
-		status = ICE_ERR_NOT_SUPPORTED;
+		return ICE_ERR_NOT_SUPPORTED;
 	}
+}
 
-	return status;
+/**
+ * ice_get_phy_tx_tstamp_ready - Read PHY Tx memory status indication
+ * @hw: pointer to the HW struct
+ * @block: the timestamp block to check
+ * @tstamp_ready: storage for the PHY Tx memory status information
+ *
+ * Check the PHY for Tx timestamp memory status. This reports a 64 bit value
+ * which indicates which timestamps in the block may be captured. A set bit
+ * means the timestamp can be read. An unset bit means the timestamp is not
+ * ready and software should avoid reading the register.
+ */
+enum ice_status
+ice_get_phy_tx_tstamp_ready(struct ice_hw *hw, u8 block, u64 *tstamp_ready)
+{
+	switch (hw->phy_model) {
+	case ICE_PHY_E810:
+		return ice_get_phy_tx_tstamp_ready_e810(hw, block,
+							tstamp_ready);
+	case ICE_PHY_E822:
+		return ice_get_phy_tx_tstamp_ready_e822(hw, block,
+							tstamp_ready);
+		break;
+	default:
+		return ICE_ERR_NOT_SUPPORTED;
+	}
 }
drivers/net/ice/base/ice_ptp_hw.h +92 -2

129 lines not on this page · raw message

drivers/net/ice/base/ice_type.h +10 -8
index 576998549e..d072b0bfe2 100644
@@ -760,7 +760,9 @@ enum ice_time_ref_freq {
 	ICE_TIME_REF_FREQ_156_250	= 4,
 	ICE_TIME_REF_FREQ_245_760	= 5,
 
-	NUM_ICE_TIME_REF_FREQ
+	NUM_ICE_TIME_REF_FREQ,
+
+	ICE_TIME_REF_FREQ_INVALID	= -1,
 };
 
 /* Clock source specification */
@@ -1246,11 +1248,12 @@ struct ice_switch_info {
 	ice_declare_bitmap(prof_res_bm[ICE_MAX_NUM_PROFILES], ICE_MAX_FV_WORDS);
 };
 
-/* PHY configuration */
-enum ice_phy_cfg {
-	ICE_PHY_E810 = 1,
+/* PHY model */
+enum ice_phy_model {
+	ICE_PHY_UNSUP = -1,
+	ICE_PHY_E810  = 1,
 	ICE_PHY_E822,
-	ICE_PHY_ETH56G,
+	ICE_PHY_E830,
 };
 
 /* Port hardware description */
@@ -1277,7 +1280,8 @@ struct ice_hw {
 	u8 revision_id;
 
 	u8 pf_id;		/* device profile info */
-	enum ice_phy_cfg phy_cfg;
+	enum ice_phy_model phy_model;
+	u8 phy_ports;
 	u8 logical_pf_id;
 
 	u16 max_burst_size;	/* driver sets this value */
@@ -1311,7 +1315,6 @@ struct ice_hw {
 			      void *buf, u16 buf_size);
 	void *aq_send_cmd_param;
 	u8 dcf_enabled;		/* Device Config Function */
-
 	u8 api_branch;		/* API branch version */
 	u8 api_maj_ver;		/* API major version */
 	u8 api_min_ver;		/* API minor version */
@@ -1665,7 +1668,6 @@ struct ice_aq_get_set_rss_lut_params {
 /* AQ API version for report default configuration */
 #define ICE_FW_API_REPORT_DFLT_CFG_MAJ		1
 #define ICE_FW_API_REPORT_DFLT_CFG_MIN		7
-
 #define ICE_FW_API_REPORT_DFLT_CFG_PATCH	3
 
 /* FW version for FEC disable in Auto FEC mode */
drivers/net/ice/ice_ethdev.c +3 -3
index 6700893bc5..a5bf8317a7 100644
@@ -2414,11 +2414,11 @@ ice_dev_init(struct rte_eth_dev *dev)
 	ice_tm_conf_init(dev);
 
 	if (ice_is_e810(hw))
-		hw->phy_cfg = ICE_PHY_E810;
+		hw->phy_model = ICE_PHY_E810;
 	else
-		hw->phy_cfg = ICE_PHY_E822;
+		hw->phy_model = ICE_PHY_E822;
 
-	if (hw->phy_cfg == ICE_PHY_E822) {
+	if (hw->phy_model == ICE_PHY_E822) {
 		ret = ice_start_phy_timer_e822(hw, hw->pf_id, true);
 		if (ret)
 			PMD_INIT_LOG(ERR, "Failed to start phy timer\n");
Signature · 1 line
2.25.1
#18 lore raw

PATCH 17/30 net/ice/base: add C825X device support

In reply to Qiming Yang

Use ICE_MAC_GENERIC_3K type for C825X devices and fix E825X name to C825X.

---
 drivers/net/ice/base/ice_common.c | 13 +++++++++----
 drivers/net/ice/base/ice_ddp.c    |  8 +++++++-
 drivers/net/ice/base/ice_ddp.h    |  1 +
 drivers/net/ice/base/ice_devids.h | 11 ++++-------
 drivers/net/ice/base/ice_type.h   |  1 +
 drivers/net/ice/ice_ethdev.c      |  3 +--
 6 files changed, 23 insertions(+), 14 deletions(-)
drivers/net/ice/base/ice_common.c +9 -4
index ed822afc30..e4b25321db 100644
@@ -241,13 +241,17 @@ static enum ice_status ice_set_mac_type(struct ice_hw *hw)
 	case ICE_DEV_ID_E823C_QSFP:
 	case ICE_DEV_ID_E823C_SFP:
 	case ICE_DEV_ID_E823C_SGMII:
+		hw->mac_type = ICE_MAC_GENERIC;
+		break;
 	case ICE_DEV_ID_E824S:
+		hw->mac_type = ICE_MAC_GENERIC_3K;
+		break;
 	case ICE_DEV_ID_E825C_BACKPLANE:
 	case ICE_DEV_ID_E825C_QSFP:
 	case ICE_DEV_ID_E825C_SFP:
-	case ICE_DEV_ID_E825C_1GBE:
-	case ICE_DEV_ID_E825X:
-		hw->mac_type = ICE_MAC_GENERIC;
+	case ICE_DEV_ID_C825X:
+	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:
@@ -273,7 +277,8 @@ static enum ice_status ice_set_mac_type(struct ice_hw *hw)
 bool ice_is_generic_mac(struct ice_hw *hw)
 {
 	return (hw->mac_type == ICE_MAC_GENERIC ||
-		hw->mac_type == ICE_MAC_GENERIC_3K);
+		hw->mac_type == ICE_MAC_GENERIC_3K ||
+		hw->mac_type == ICE_MAC_GENERIC_3K_E825);
 }
 
 /**
drivers/net/ice/base/ice_ddp.c +7 -1
index e3c1f413dd..e43aab981d 100644
@@ -444,6 +444,7 @@ static u32 ice_get_pkg_segment_id(enum ice_mac_type mac_type)
 		break;
 	case ICE_MAC_GENERIC:
 	case ICE_MAC_GENERIC_3K:
+	case ICE_MAC_GENERIC_3K_E825:
 	default:
 		seg_id = SEGMENT_TYPE_ICE_E810;
 		break;
@@ -467,6 +468,9 @@ static u32 ice_get_pkg_sign_type(enum ice_mac_type mac_type)
 	case ICE_MAC_GENERIC_3K:
 		sign_type = SEGMENT_SIGN_TYPE_RSA3K;
 		break;
+	case ICE_MAC_GENERIC_3K_E825:
+		sign_type = SEGMENT_SIGN_TYPE_RSA3K_E825;
+		break;
 	case ICE_MAC_GENERIC:
 	default:
 		sign_type = SEGMENT_SIGN_TYPE_RSA2K;
@@ -1632,8 +1636,10 @@ ice_get_sw_fv_list(struct ice_hw *hw, struct ice_prot_lkup_ext *lkups,
 			}
 		}
 	} while (fv);
-	if (LIST_EMPTY(fv_list))
+	if (LIST_EMPTY(fv_list)) {
+		ice_warn(hw, "Required profiles not found in currently loaded DDP package");
 		return ICE_ERR_CFG;
+	}
 	return ICE_SUCCESS;
 
 err:
drivers/net/ice/base/ice_ddp.h +1 -0
index 57b39c72ca..6c87f11972 100644
@@ -99,6 +99,7 @@ struct ice_pkg_hdr {
 #define SEGMENT_SIGN_TYPE_RSA2K		0x00000001
 #define SEGMENT_SIGN_TYPE_RSA3K		0x00000002
 #define SEGMENT_SIGN_TYPE_RSA3K_SBB	0x00000003 /* Secure Boot Block */
+#define SEGMENT_SIGN_TYPE_RSA3K_E825	0x00000005
 
 /* generic segment */
 struct ice_generic_seg_hdr {
drivers/net/ice/base/ice_devids.h +4 -7
index 9ea915b967..0e0a20542b 100644
@@ -76,13 +76,10 @@
 /* Intel(R) Ethernet Connection E825-C for backplane */
 #define ICE_DEV_ID_E825C_BACKPLANE	0x579C
 /* Intel(R) Ethernet Connection E825-C for QSFP */
-#define ICE_DEV_ID_E825C_QSFP	        0x579D
+#define ICE_DEV_ID_E825C_QSFP		0x579D
 /* Intel(R) Ethernet Connection E825-C for SFP */
-#define ICE_DEV_ID_E825C_SFP	        0x579E
+#define ICE_DEV_ID_E825C_SFP		0x579E
 /* Intel(R) Ethernet Connection E825-C 1GbE */
-#define ICE_DEV_ID_E825C_1GBE	        0x579F
-/* Intel(R) Ethernet Connection E825-X */
-#define ICE_DEV_ID_E825X	        0x0DCD
-
-
+#define ICE_DEV_ID_E825C_SGMII		0x579F
+#define ICE_DEV_ID_C825X		0x0DCD
 #endif /* _ICE_DEVIDS_H_ */
drivers/net/ice/base/ice_type.h +1 -0
index d072b0bfe2..9651720470 100644
@@ -225,6 +225,7 @@ enum ice_mac_type {
 	ICE_MAC_E830,
 	ICE_MAC_GENERIC,
 	ICE_MAC_GENERIC_3K,
+	ICE_MAC_GENERIC_3K_E825,
 };
 
 /* Media Types */
drivers/net/ice/ice_ethdev.c +1 -2
index a5bf8317a7..2a4073c4d1 100644
@@ -196,8 +196,7 @@ static const struct rte_pci_id pci_id_ice_map[] = {
 	{ RTE_PCI_DEVICE(ICE_INTEL_VENDOR_ID, ICE_DEV_ID_E825C_BACKPLANE) },
 	{ RTE_PCI_DEVICE(ICE_INTEL_VENDOR_ID, ICE_DEV_ID_E825C_QSFP) },
 	{ RTE_PCI_DEVICE(ICE_INTEL_VENDOR_ID, ICE_DEV_ID_E825C_SFP) },
-	{ RTE_PCI_DEVICE(ICE_INTEL_VENDOR_ID, ICE_DEV_ID_E825C_1GBE) },
-	{ RTE_PCI_DEVICE(ICE_INTEL_VENDOR_ID, ICE_DEV_ID_E825X) },
+	{ RTE_PCI_DEVICE(ICE_INTEL_VENDOR_ID, ICE_DEV_ID_C825X) },
 	{ .vendor_id = 0, /* sentinel */ },
 };
 
Signature · 1 line
2.25.1
#19 lore raw

PATCH 18/30 net/ice/base: add VLAN TPID in switchdev

In reply to Qiming Yang
---
 drivers/net/ice/base/ice_protocol_type.h |  6 +++-
 drivers/net/ice/base/ice_switch.c        | 42 ++++++++++++++++++------
 drivers/net/ice/base/ice_switch.h        |  1 +
 3 files changed, 38 insertions(+), 11 deletions(-)
drivers/net/ice/base/ice_protocol_type.h +5 -1
index 1d9baea624..7f5f5069b6 100644
@@ -215,7 +215,7 @@ enum ice_prot_id {
  */
 #define ICE_UDP_OF_HW	52 /* UDP Tunnels */
 #define ICE_GRE_OF_HW	64 /* NVGRE */
-#define ICE_META_DATA_ID_HW 255 /* this is used for tunnel type */
+#define ICE_META_DATA_ID_HW 255 /* this is used for tunnel and VLAN type */
 
 #define ICE_MDID_SIZE 2
 #define ICE_TUN_FLAG_MDID 20
@@ -226,6 +226,10 @@ enum ice_prot_id {
 #define ICE_TUN_FLAG_VLAN_MASK 0x01
 #define ICE_TUN_FLAG_FV_IND 2
 
+#define ICE_VLAN_FLAG_MDID 20
+#define ICE_VLAN_FLAG_MDID_OFF (ICE_MDID_SIZE * ICE_VLAN_FLAG_MDID)
+#define ICE_PKT_FLAGS_0_TO_15_VLAN_FLAGS_MASK 0xD000
+
 #define ICE_PROTOCOL_MAX_ENTRIES 16
 
 /* Mapping of software defined protocol ID to hardware defined protocol ID */
drivers/net/ice/base/ice_switch.c +32 -10

103 lines not on this page · raw message

drivers/net/ice/base/ice_switch.h +1 -0
index adb467eb66..366b9bb425 100644
@@ -300,6 +300,7 @@ struct ice_adv_rule_info {
 	struct ice_sw_act_ctrl sw_act;
 	u32 priority;
 	u8 rx; /* true means LOOKUP_RX otherwise LOOKUP_TX */
+	u8 add_dir_lkup;
 	u16 fltr_rule_id;
 	u16 lg_id;
 	u16 vlan_type;
Signature · 1 line
2.25.1
#20 lore raw

PATCH 19/30 net/ice/base: reduce time to read Option ROM CIVD

In reply to Qiming Yang

Re-write ice_get_orom_civd_data to allocate memory to store the Option ROM data. Copy the entire OptionROM contents at once using ice_read_flash_module. Finally, use this memory copy to scan for the '$CIV' section.

This change significantly reduces the time to read the Option ROM CIVD section from ~10 seconds down to ~1 second. This has a significant impact on the total time to complete a driver rebuild or probe.

---
 drivers/net/ice/base/ice_nvm.c | 54 +++++++++++++++++++++++++---------
 1 file changed, 40 insertions(+), 14 deletions(-)
drivers/net/ice/base/ice_nvm.c +40 -14
index 6ab359af33..ba855533ec 100644
@@ -190,12 +190,14 @@ ice_read_sr_buf_aq(struct ice_hw *hw, u16 offset, u16 *words, u16 *data)
 enum ice_status
 ice_acquire_nvm(struct ice_hw *hw, enum ice_aq_res_access_type access)
 {
+	u32 timeout = ICE_NVM_TIMEOUT;
+
 	ice_debug(hw, ICE_DBG_TRACE, "%s\n", __func__);
 
 	if (hw->flash.blank_nvm_mode)
 		return ICE_SUCCESS;
 
-	return ice_acquire_res(hw, ICE_NVM_RES_ID, access, ICE_NVM_TIMEOUT);
+	return ice_acquire_res(hw, ICE_NVM_RES_ID, access, timeout);
 }
 
 /**
@@ -724,43 +726,67 @@ static enum ice_status
 ice_get_orom_civd_data(struct ice_hw *hw, enum ice_bank_select bank,
 		       struct ice_orom_civd_info *civd)
 {
-	struct ice_orom_civd_info tmp;
+	u8 *orom_data;
+	enum ice_status status;
 	u32 offset;
 
 	/* The CIVD section is located in the Option ROM aligned to 512 bytes.
 	 * The first 4 bytes must contain the ASCII characters "$CIV".
 	 * A simple modulo 256 sum of all of the bytes of the structure must
 	 * equal 0.
+	 *
+	 * The exact location is unknown and varies between images but is
+	 * usually somewhere in the middle of the bank. We need to scan the
+	 * Option ROM bank to locate it.
+	 *
+	 * It's significantly faster to read the entire Option ROM up front
+	 * using the maximum page size, than to read each possible location
+	 * with a separate firmware command.
 	 */
+	orom_data = (u8 *)ice_calloc(hw, hw->flash.banks.orom_size, sizeof(u8));
+	if (!orom_data)
+		return ICE_ERR_NO_MEMORY;
+
+	status = ice_read_flash_module(hw, bank, ICE_SR_1ST_OROM_BANK_PTR, 0,
+				       orom_data, hw->flash.banks.orom_size);
+	if (status) {
+		ice_debug(hw, ICE_DBG_NVM, "Unable to read Option ROM data\n");
+		return status;
+	}
+
+	/* Scan the memory buffer to locate the CIVD data section */
 	for (offset = 0; (offset + 512) <= hw->flash.banks.orom_size; offset += 512) {
-		enum ice_status status;
+		struct ice_orom_civd_info *tmp;
 		u8 sum = 0, i;
 
-		status = ice_read_flash_module(hw, bank, ICE_SR_1ST_OROM_BANK_PTR,
-					       offset, (u8 *)&tmp, sizeof(tmp));
-		if (status) {
-			ice_debug(hw, ICE_DBG_NVM, "Unable to read Option ROM CIVD data\n");
-			return status;
-		}
+		tmp = (struct ice_orom_civd_info *)&orom_data[offset];
 
 		/* Skip forward until we find a matching signature */
-		if (memcmp("$CIV", tmp.signature, sizeof(tmp.signature)) != 0)
+		if (memcmp("$CIV", tmp->signature, sizeof(tmp->signature)) != 0)
 			continue;
 
+		ice_debug(hw, ICE_DBG_NVM, "Found CIVD section at offset %u\n",
+			  offset);
+
 		/* Verify that the simple checksum is zero */
-		for (i = 0; i < sizeof(tmp); i++)
-			sum += ((u8 *)&tmp)[i];
+		for (i = 0; i < sizeof(*tmp); i++)
+			sum += ((u8 *)tmp)[i];
 
 		if (sum) {
 			ice_debug(hw, ICE_DBG_NVM, "Found CIVD data with invalid checksum of %u\n",
 				  sum);
-			return ICE_ERR_NVM;
+			goto err_invalid_checksum;
 		}
 
-		*civd = tmp;
+		*civd = *tmp;
+		ice_free(hw, orom_data);
 		return ICE_SUCCESS;
 	}
 
+	ice_debug(hw, ICE_DBG_NVM, "Unable to locate CIVD data within the Option ROM\n");
+
+err_invalid_checksum:
+	ice_free(hw, orom_data);
 	return ICE_ERR_NVM;
 }
 
Signature · 1 line
2.25.1
#21 lore raw

PATCH 20/30 net/ice/base: add L2TPv3 support for adv rules

In reply to Qiming Yang

This patch unwraps L2TPv3 dummy packet, date structures and defines from DPDK_SUPPORT.

---
 drivers/net/ice/base/ice_nvm.h           |   1 -
 drivers/net/ice/base/ice_protocol_type.h |   5 +-
 drivers/net/ice/base/ice_switch.c        | 740 +++++++++++++++--------
 3 files changed, 495 insertions(+), 251 deletions(-)
drivers/net/ice/base/ice_nvm.h +0 -1
index c3e61a301f..824526e8f8 100644
@@ -34,7 +34,6 @@ struct ice_orom_civd_info {
 	u8 combo_name_len;	/* Length of the unicode combo image version string, max of 32 */
 	__le16 combo_name[32];	/* Unicode string representing the Combo Image version */
 };
-
 #pragma pack()
 
 #define ICE_NVM_ACCESS_MAJOR_VER	0
drivers/net/ice/base/ice_protocol_type.h +4 -1
index 7f5f5069b6..1ef23c5a50 100644
@@ -31,6 +31,7 @@ enum ice_protocol_type {
 	ICE_MAC_OFOS = 0,
 	ICE_MAC_IL,
 	ICE_ETYPE_OL,
+	ICE_ETYPE_IL,
 	ICE_VLAN_OFOS,
 	ICE_IPV4_OFOS,
 	ICE_IPV4_IL,
@@ -195,6 +196,7 @@ enum ice_prot_id {
 #define ICE_MAC_OFOS_HW		1
 #define ICE_MAC_IL_HW		4
 #define ICE_ETYPE_OL_HW		9
+#define ICE_ETYPE_IL_HW		10
 #define ICE_VLAN_OF_HW		16
 #define ICE_VLAN_OL_HW		17
 #define ICE_IPV4_OFOS_HW	32
@@ -219,7 +221,8 @@ enum ice_prot_id {
 
 #define ICE_MDID_SIZE 2
 #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_MDID_OFF(word) \
+	(ICE_MDID_SIZE * (ICE_TUN_FLAG_MDID + (word)))
 #define ICE_TUN_FLAG_MASK 0xFF
 #define ICE_DIR_FLAG_MASK 0x10
 #define ICE_TUN_FLAG_IN_VLAN_MASK 0x80 /* VLAN inside tunneled header */
drivers/net/ice/base/ice_switch.c +491 -249

1,056 lines not on this page · raw message

Signature · 1 line
2.25.1
#22 lore raw

PATCH 21/30 net/ice/base: add PHY OFFSET READY register clear

In reply to Qiming Yang

Add a possibility to mark all transmitted/received timestamps as invalid by clearing PHY OFFSET_READY registers.

---
 drivers/net/ice/base/ice_adminq_cmd.h |   4 +
 drivers/net/ice/base/ice_ptp_hw.c     | 126 ++++++++------------------
 drivers/net/ice/base/ice_ptp_hw.h     |   1 +
 3 files changed, 43 insertions(+), 88 deletions(-)
drivers/net/ice/base/ice_adminq_cmd.h +4 -0
index cd4a6ffddf..c51054ecc1 100644
@@ -2897,6 +2897,10 @@ enum ice_aqc_driver_params {
 	ICE_AQC_DRIVER_PARAM_CLK_IDX_TMR0 = 0,
 	/* OS clock index for PTP timer Domain 1 */
 	ICE_AQC_DRIVER_PARAM_CLK_IDX_TMR1,
+	/* Request ID to recalibrate PHC logic */
+	ICE_AQC_DRIVER_PARAM_PHC_RECALC,
+	/* Indicates that PTP clock controller failed */
+	ICE_AQC_DRIVER_PARAM_PTP_CC_FAILED,
 
 	/* Add new parameters above */
 	ICE_AQC_DRIVER_PARAM_MAX = 16,
drivers/net/ice/base/ice_ptp_hw.c +38 -88

158 lines not on this page · raw message

drivers/net/ice/base/ice_ptp_hw.h +1 -0
index e25018a68f..f4d64ea02b 100644
@@ -151,6 +151,7 @@ enum ice_status ice_ptp_write_incval_locked(struct ice_hw *hw, u64 incval,
 enum ice_status ice_ptp_adj_clock(struct ice_hw *hw, s32 adj, bool lock_sbq);
 enum ice_status
 ice_ptp_adj_clock_at_time(struct ice_hw *hw, u64 at_time, s32 adj);
+enum ice_status ice_ptp_clear_phy_offset_ready(struct ice_hw *hw);
 enum ice_status
 ice_read_phy_tstamp(struct ice_hw *hw, u8 block, u8 idx, u64 *tstamp);
 enum ice_status
Signature · 1 line
2.25.1
#23 lore raw

PATCH 22/30 net/ice/base: return CGU PLL config function params

In reply to Qiming Yang

Change params in ice_cfg_cgu_pll_e822 to pointers to return real values of frequency and clock source.
Remove static from frequency and clock source conversion functions.

---
 drivers/net/ice/base/ice_ptp_hw.c | 39 ++++++++++++++++++-------------
 drivers/net/ice/base/ice_ptp_hw.h |  4 ++--
 2 files changed, 25 insertions(+), 18 deletions(-)
drivers/net/ice/base/ice_ptp_hw.c +23 -16
index f27131efcc..cc6c1f3152 100644
@@ -218,8 +218,8 @@ static const char *ice_clk_src_str(u8 clk_src)
  * time reference, enabling the PLL which drives the PTP hardware clock.
  */
 enum ice_status
-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;
@@ -228,18 +228,18 @@ ice_cfg_cgu_pll_e822(struct ice_hw *hw, enum ice_time_ref_freq clk_freq,
 	union nac_cgu_dword9 dw9;
 	enum ice_status status;
 
-	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;
 	}
@@ -273,7 +273,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;
 	status = ice_write_cgu_reg_e822(hw, NAC_CGU_DWORD9, dw9.val);
 	if (status)
 		return status;
@@ -283,7 +283,7 @@ ice_cfg_cgu_pll_e822(struct ice_hw *hw, enum ice_time_ref_freq clk_freq,
 	if (status)
 		return status;
 
-	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;
 
 	status = ice_write_cgu_reg_e822(hw, NAC_CGU_DWORD19, dw19.val);
@@ -295,7 +295,7 @@ ice_cfg_cgu_pll_e822(struct ice_hw *hw, enum ice_time_ref_freq clk_freq,
 	if (status)
 		return status;
 
-	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;
 
 	status = ice_write_cgu_reg_e822(hw, NAC_CGU_DWORD22, dw22.val);
@@ -307,9 +307,9 @@ ice_cfg_cgu_pll_e822(struct ice_hw *hw, enum ice_time_ref_freq clk_freq,
 	if (status)
 		return status;
 
-	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;
 
 	status = ice_write_cgu_reg_e822(hw, NAC_CGU_DWORD24, dw24.val);
 	if (status)
@@ -341,6 +341,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 ICE_SUCCESS;
 }
 
@@ -354,6 +357,8 @@ static enum ice_status ice_init_cgu_e822(struct ice_hw *hw)
 {
 	struct ice_ts_func_info *ts_info = &hw->func_caps.ts_func_info;
 	union tspll_cntr_bist_settings cntr_bist;
+	enum ice_time_ref_freq time_ref_freq;
+	enum ice_clk_src clk_src;
 	enum ice_status status;
 
 	status = ice_read_cgu_reg_e822(hw, TSPLL_CNTR_BIST_SETTINGS,
@@ -373,8 +378,9 @@ static enum ice_status ice_init_cgu_e822(struct ice_hw *hw)
 	/* Configure the CGU PLL using the parameters from the function
 	 * capabilities.
 	 */
-	status = ice_cfg_cgu_pll_e822(hw, ts_info->time_ref,
-				      (enum ice_clk_src)ts_info->clk_src);
+	time_ref_freq = (enum ice_time_ref_freq)ts_info->time_ref;
+	clk_src = (enum ice_clk_src)ts_info->clk_src;
+	status = ice_cfg_cgu_pll_e822(hw, &time_ref_freq, &clk_src);
 	if (status)
 		return status;
 
@@ -2024,6 +2030,7 @@ enum ice_status ice_phy_cfg_tx_offset_e822(struct ice_hw *hw, u8 port)
 	if (status)
 		return status;
 
+
 	return ICE_SUCCESS;
 }
 
drivers/net/ice/base/ice_ptp_hw.h +2 -2
index f4d64ea02b..4d5d728e26 100644
@@ -184,8 +184,8 @@ ice_ptp_one_port_cmd_e822(struct ice_hw *hw, u8 port,
 			  enum ice_ptp_tmr_cmd cmd, bool lock_sbq);
 void ice_ptp_reset_ts_memory_quad_e822(struct ice_hw *hw, u8 quad);
 enum ice_status
-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);
 
 /**
  * ice_e822_time_ref - Get the current TIME_REF from capabilities
Signature · 1 line
2.25.1
#24 lore raw

PATCH 23/30 net/ice/base: change method to get pca9575 handle

In reply to Qiming Yang

More universal method for getting pca9575 handle is introduced. The first step is to look for CLK_MUX handle. Having that it is possible to find CLK_MUX GPIO pin. Provided data let check what is driving the pin - the expectation is that pca9575 node part number is returned.

---
 drivers/net/ice/base/ice_adminq_cmd.h |  12 ++-
 drivers/net/ice/base/ice_ptp_hw.c     | 125 ++++++++++++++++++++++----
 2 files changed, 120 insertions(+), 17 deletions(-)
drivers/net/ice/base/ice_adminq_cmd.h +10 -2
index c51054ecc1..29b123d900 100644
@@ -1723,6 +1723,8 @@ struct ice_aqc_link_topo_params {
 #define ICE_AQC_LINK_TOPO_NODE_TYPE_CAGE	6
 #define ICE_AQC_LINK_TOPO_NODE_TYPE_MEZZ	7
 #define ICE_AQC_LINK_TOPO_NODE_TYPE_ID_EEPROM	8
+#define ICE_AQC_LINK_TOPO_NODE_TYPE_CLK_CTRL	9
+#define ICE_AQC_LINK_TOPO_NODE_TYPE_CLK_MUX	10
 #define ICE_AQC_LINK_TOPO_NODE_TYPE_GPS		11
 #define ICE_AQC_LINK_TOPO_NODE_CTX_S		4
 #define ICE_AQC_LINK_TOPO_NODE_CTX_M		\
@@ -1760,8 +1762,13 @@ 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_ACQ_GET_LINK_TOPO_NODE_NR_PCA9575			0x21
+#define ICE_ACQ_GET_LINK_TOPO_NODE_NR_ZL30632_80032		0x24
+#define ICE_ACQ_GET_LINK_TOPO_NODE_NR_SI5383_5384		0x25
+#define ICE_ACQ_GET_LINK_TOPO_NODE_NR_E822_PHY			0x30
+#define ICE_ACQ_GET_LINK_TOPO_NODE_NR_C827			0x31
+#define ICE_ACQ_GET_LINK_TOPO_NODE_NR_GEN_CLK_MUX		0x47
+#define ICE_ACQ_GET_LINK_TOPO_NODE_NR_GEN_GPS			0x48
 	u8 rsvd[9];
 };
 
@@ -1789,6 +1796,7 @@ struct ice_aqc_get_link_topo_pin {
 #define ICE_AQC_LINK_TOPO_IO_FUNC_RED_LED	12
 #define ICE_AQC_LINK_TOPO_IO_FUNC_GREEN_LED	13
 #define ICE_AQC_LINK_TOPO_IO_FUNC_BLUE_LED	14
+#define ICE_AQC_LINK_TOPO_IO_FUNC_CLK_IN	20
 #define ICE_AQC_LINK_TOPO_INPUT_IO_TYPE_S	5
 #define ICE_AQC_LINK_TOPO_INPUT_IO_TYPE_M	\
 			(0x7 << ICE_AQC_LINK_TOPO_INPUT_IO_TYPE_S)
drivers/net/ice/base/ice_ptp_hw.c +110 -15

212 lines not on this page · raw message

Signature · 1 line
2.25.1
#25 lore raw

PATCH 24/30 net/ice/base: cleanup timestamp registers correct

In reply to Qiming Yang

E822 PHY TS registers should not be written and the only way to cleanup them is to reset QUAD memory.

To ensure that the status bit for the timestamp index is cleared, ensure that ice_clear_phy_tstamp implementations first read the timestamp out. Implementations which can write the register continue to do so.

Add a note to indicate this function should only be called on timestamps which have their valid bit set.

---
 drivers/net/ice/base/ice_ptp_hw.c | 54 ++++++++++++++++++-------------
 1 file changed, 31 insertions(+), 23 deletions(-)
drivers/net/ice/base/ice_ptp_hw.c +31 -23
index 29840b2b91..e559d4907f 100644
@@ -1020,34 +1020,31 @@ ice_read_phy_tstamp_e822(struct ice_hw *hw, u8 quad, u8 idx, u64 *tstamp)
 }
 
 /**
- * ice_clear_phy_tstamp_e822 - Clear a timestamp from the quad block
+ * ice_clear_phy_tstamp_e822 - Drop a timestamp from the quad block
  * @hw: pointer to the HW struct
  * @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 timetamp 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 software cannot directly write the quad memory bank registers,
+ * and must use ice_ptp_reset_ts_memory_quad_e822 for that purpose.
+ *
+ * This function should only be called on an idx whose bit is set according to
+ * ice_get_phy_tx_tstamp_ready.
  */
 static enum ice_status
 ice_clear_phy_tstamp_e822(struct ice_hw *hw, u8 quad, u8 idx)
 {
 	enum ice_status status;
-	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;
-	}
+	u64 unused_tstamp;
 
-	status = ice_write_quad_reg_e822(hw, quad, hi_addr, 0);
+	status = ice_read_phy_tstamp_e822(hw, quad, idx, &unused_tstamp);
 	if (status) {
-		ice_debug(hw, ICE_DBG_PTP, "Failed to clear high PTP timestamp register, status %d\n",
-			  status);
+		ice_debug(hw, ICE_DBG_PTP, "Failed to read the timestamp register for quad %u, idx %u, status %d\n",
+			  quad, idx, status);
 		return status;
 	}
 
@@ -2926,29 +2923,40 @@ ice_read_phy_tstamp_e810(struct ice_hw *hw, u8 lport, u8 idx, u64 *tstamp)
  * @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.
+ * Read the timestamp and then forcibly overwrite its value to clear the valid
+ * bit from the timestamp block of the external PHY on the E810 device.
+ *
+ * This function should only be called on an idx whose bit is set according to
+ * ice_get_phy_tx_tstamp_ready.
  */
 static enum ice_status
 ice_clear_phy_tstamp_e810(struct ice_hw *hw, u8 lport, u8 idx)
 {
 	enum ice_status status;
 	u32 lo_addr, hi_addr;
+	u64 unused_tstamp;
+
+	status = ice_read_phy_tstamp_e810(hw, lport, idx, &unused_tstamp);
+	if (status) {
+		ice_debug(hw, ICE_DBG_PTP, "Failed to read the timestamp register for lport %u, idx %u, status %d\n",
+			  lport, idx, status);
+		return status;
+	}
 
 	lo_addr = TS_EXT(LOW_TX_MEMORY_BANK_START, lport, idx);
 	hi_addr = TS_EXT(HIGH_TX_MEMORY_BANK_START, lport, idx);
 
 	status = ice_write_phy_reg_e810(hw, lo_addr, 0);
 	if (status) {
-		ice_debug(hw, ICE_DBG_PTP, "Failed to clear low PTP timestamp register, status %d\n",
-			  status);
+		ice_debug(hw, ICE_DBG_PTP, "Failed to clear low PTP timestamp register for lport %u, idx %u, status %d\n",
+			  lport, idx, status);
 		return status;
 	}
 
 	status = ice_write_phy_reg_e810(hw, hi_addr, 0);
 	if (status) {
-		ice_debug(hw, ICE_DBG_PTP, "Failed to clear high PTP timestamp register, status %d\n",
-			  status);
+		ice_debug(hw, ICE_DBG_PTP, "Failed to clear high PTP timestamp register for lport %u, idx %u, status %d\n",
+			  lport, idx, status);
 		return status;
 	}
 
Signature · 1 line
2.25.1
#26 lore raw

PATCH 25/30 net/ice/base: add PPPoE hardware offload

In reply to Qiming Yang

Add support for creating PPPoE filters in switchdev mode. Add support for parsing PPPoE and PPP-specific tc options: pppoe_sid and ppp_proto.

---
 drivers/net/ice/base/ice_switch.c | 82 ++++++++++++++++++++++++-------
 1 file changed, 65 insertions(+), 17 deletions(-)
drivers/net/ice/base/ice_switch.c +65 -17
index c78ec448ae..37c192fb87 100644
@@ -7390,6 +7390,17 @@ ice_find_free_recp_res_idx(struct ice_hw *hw, const ice_bitmap_t *profiles,
 	return (u16)ice_bitmap_hweight(free_idx, ICE_MAX_FV_WORDS);
 }
 
+static void ice_set_recipe_index(unsigned long idx, u8 *bitmap)
+{
+	u32 byte = idx / BITS_PER_BYTE;
+	u32 bit = idx % BITS_PER_BYTE;
+
+	if (byte >= 8)
+		return;
+
+	bitmap[byte] |= 1 << bit;
+}
+
 /**
  * ice_add_sw_recipe - function to call AQ calls to create switch recipe
  * @hw: pointer to hardware structure
@@ -7517,10 +7528,10 @@ ice_add_sw_recipe(struct ice_hw *hw, struct ice_sw_recipe *rm,
 		}
 
 		/* fill recipe dependencies */
-		ice_zero_bitmap((ice_bitmap_t *)buf[recps].recipe_bitmap,
-				ICE_MAX_NUM_RECIPES);
-		ice_set_bit(buf[recps].recipe_indx,
-			    (ice_bitmap_t *)buf[recps].recipe_bitmap);
+		ice_memset(buf[recps].recipe_bitmap, 0,
+			   sizeof(buf[recps].recipe_bitmap), ICE_NONDMA_MEM);
+		ice_set_recipe_index(buf[recps].recipe_indx,
+				     buf[recps].recipe_bitmap);
 		buf[recps].content.act_ctrl_fwd_priority = rm->priority;
 		recps++;
 	}
@@ -8305,18 +8316,26 @@ ice_find_dummy_packet(struct ice_adv_lkup_elem *lkups, u16 lkups_cnt,
 			 lkups[i].m_u.ethertype.ethtype_id ==
 				CPU_TO_BE16(0xFFFF))
 			outer_ipv6 = true;
+		else if (lkups[i].type == ICE_ETYPE_IL &&
+			 lkups[i].h_u.ethertype.ethtype_id ==
+				CPU_TO_BE16(ICE_IPV6_ETHER_ID) &&
+			 lkups[i].m_u.ethertype.ethtype_id ==
+				CPU_TO_BE16(0xFFFF))
+			inner_ipv6 = true;
+		else if (lkups[i].type == ICE_PPPOE) {
+			pppoe = true;
+			if (lkups[i].h_u.pppoe_hdr.ppp_prot_id ==
+				CPU_TO_BE16(ICE_PPP_IPV6_PROTO_ID) &&
+			    lkups[i].m_u.pppoe_hdr.ppp_prot_id ==
+				CPU_TO_BE16(0xFFFF))
+				outer_ipv6 = true;
+		}
 		else if (lkups[i].type == ICE_IPV4_OFOS &&
 			 lkups[i].h_u.ipv4_hdr.protocol ==
 				ICE_IPV4_NVGRE_PROTO_ID &&
 			 lkups[i].m_u.ipv4_hdr.protocol ==
 				0xFF)
 			gre = true;
-		else if (lkups[i].type == ICE_PPPOE &&
-			 lkups[i].h_u.pppoe_hdr.ppp_prot_id ==
-				CPU_TO_BE16(ICE_PPP_IPV6_PROTO_ID) &&
-			 lkups[i].m_u.pppoe_hdr.ppp_prot_id ==
-				0xFFFF)
-			outer_ipv6 = true;
 		else if (lkups[i].type == ICE_IPV4_IL &&
 			 lkups[i].h_u.ipv4_hdr.protocol ==
 				ICE_TCP_PROTO_ID &&
@@ -8373,6 +8392,34 @@ ice_find_dummy_packet(struct ice_adv_lkup_elem *lkups, u16 lkups_cnt,
 		}
 	}
 
+	if (tun_type == ICE_SW_IPV4_TCP) {
+		*pkt = dummy_tcp_packet;
+		*pkt_len = sizeof(dummy_tcp_packet);
+		*offsets = dummy_tcp_packet_offsets;
+		return;
+	}
+
+	if (tun_type == ICE_SW_IPV4_UDP) {
+		*pkt = dummy_udp_packet;
+		*pkt_len = sizeof(dummy_udp_packet);
+		*offsets = dummy_udp_packet_offsets;
+		return;
+	}
+
+	if (tun_type == ICE_SW_IPV6_TCP) {
+		*pkt = dummy_tcp_ipv6_packet;
+		*pkt_len = sizeof(dummy_tcp_ipv6_packet);
+		*offsets = dummy_tcp_ipv6_packet_offsets;
+		return;
+	}
+
+	if (tun_type == ICE_SW_IPV6_UDP) {
+		*pkt = dummy_udp_ipv6_packet;
+		*pkt_len = sizeof(dummy_udp_ipv6_packet);
+		*offsets = dummy_udp_ipv6_packet_offsets;
+		return;
+	}
+
 	if (tun_type == ICE_SW_TUN_PPPOE_IPV6_QINQ) {
 		*pkt = dummy_qinq_pppoe_ipv6_packet;
 		*pkt_len = sizeof(dummy_qinq_pppoe_ipv6_packet);
@@ -8811,6 +8858,7 @@ ice_fill_adv_dummy_packet(struct ice_adv_lkup_elem *lkups, u16 lkups_cnt,
 			len = sizeof(struct ice_ether_hdr);
 			break;
 		case ICE_ETYPE_OL:
+		case ICE_ETYPE_IL:
 			len = sizeof(struct ice_ethtype_hdr);
 			break;
 		case ICE_VLAN_OFOS:
@@ -8843,9 +8891,6 @@ ice_fill_adv_dummy_packet(struct ice_adv_lkup_elem *lkups, u16 lkups_cnt,
 			len = sizeof(struct ice_udp_tnl_hdr);
 			break;
 
-		case ICE_PPPOE:
-			len = sizeof(struct ice_pppoe_hdr);
-			break;
 		case ICE_ESP:
 			len = sizeof(struct ice_esp_hdr);
 			break;
@@ -8855,13 +8900,16 @@ ice_fill_adv_dummy_packet(struct ice_adv_lkup_elem *lkups, u16 lkups_cnt,
 		case ICE_AH:
 			len = sizeof(struct ice_ah_hdr);
 			break;
-		case ICE_L2TPV3:
-			len = sizeof(struct ice_l2tpv3_sess_hdr);
-			break;
-		case ICE_GTP:
 		case ICE_GTP_NO_PAY:
+		case ICE_GTP:
 			len = sizeof(struct ice_udp_gtp_hdr);
 			break;
+		case ICE_PPPOE:
+			len = sizeof(struct ice_pppoe_hdr);
+			break;
+		case ICE_L2TPV3:
+			len = sizeof(struct ice_l2tpv3_sess_hdr);
+			break;
 		default:
 			return ICE_ERR_PARAM;
 		}
Signature · 1 line
2.25.1
#27 lore raw

PATCH 26/30 net/ice/base: remove bypass mode

In reply to Qiming Yang

Previous implementation switches between bypass and Vernier mode dynamically. However bypass mode should be removed due to low precision.

---
 drivers/net/ice/base/ice_ptp_hw.c | 46 ++++++++++++++++++++++++++-----
 drivers/net/ice/base/ice_ptp_hw.h |  5 ++--
 drivers/net/ice/ice_ethdev.c      |  2 +-
 3 files changed, 43 insertions(+), 10 deletions(-)
drivers/net/ice/base/ice_ptp_hw.c +39 -7
index e559d4907f..f67e0b0c34 100644
@@ -2584,20 +2584,15 @@ ice_stop_phy_timer_e822(struct ice_hw *hw, u8 port, bool soft_reset)
  * ice_start_phy_timer_e822 - Start the PHY clock timer
  * @hw: pointer to the HW struct
  * @port: the PHY port to start
- * @bypass: if true, start the PHY in bypass mode
  *
  * Start the clock of a PHY port. This must be done as part of the flow to
  * re-calibrate Tx and Rx timestamping offsets whenever the clock time is
  * initialized or when link speed changes.
  *
- * Bypass mode enables timestamps immediately without waiting for Vernier
- * calibration to complete. Hardware will still continue taking Vernier
- * measurements on Tx or Rx of packets, but they will not be applied to
- * timestamps. Use ice_phy_exit_bypass_e822 to exit bypass mode once hardware
- * has completed offset calculation.
+ * Hardware will take Vernier measurements on Tx or Rx of packets.
  */
 enum ice_status
-ice_start_phy_timer_e822(struct ice_hw *hw, u8 port, bool bypass)
+ice_start_phy_timer_e822(struct ice_hw *hw, u8 port)
 {
 	enum ice_status status;
 	u32 lo, hi, val;
@@ -2721,6 +2716,43 @@ ice_get_phy_tx_tstamp_ready_e822(struct ice_hw *hw, u8 quad, u64 *tstamp_ready)
 	return ICE_SUCCESS;
 }
 
+/**
+ * ice_phy_cfg_intr_e822 - Configure TX timestamp interrupt
+ * @hw: pointer to the HW struct
+ * @quad: the timestamp quad
+ * @ena: enable or disable interrupt
+ * @threshold: interrupt threshold
+ *
+ * Configure TX timestamp interrupt for the specified quad
+ */
+
+enum ice_status
+ice_phy_cfg_intr_e822(struct ice_hw *hw, u8 quad, bool ena, u8 threshold)
+{
+	enum ice_status err;
+	u32 val;
+
+	err = ice_read_quad_reg_e822(hw, quad,
+				     Q_REG_TX_MEM_GBL_CFG,
+				     &val);
+	if (err)
+		return err;
+
+	if (ena) {
+		val |= Q_REG_TX_MEM_GBL_CFG_INTR_ENA_M;
+		val &= ~Q_REG_TX_MEM_GBL_CFG_INTR_THR_M;
+		val |= ((threshold << Q_REG_TX_MEM_GBL_CFG_INTR_THR_S) &
+			Q_REG_TX_MEM_GBL_CFG_INTR_THR_M);
+	} else {
+		val &= ~Q_REG_TX_MEM_GBL_CFG_INTR_ENA_M;
+	}
+
+	err = ice_write_quad_reg_e822(hw, quad,
+				      Q_REG_TX_MEM_GBL_CFG,
+				      val);
+
+	return err;
+}
 
 /* E810 functions
  *
drivers/net/ice/base/ice_ptp_hw.h +3 -2
index 4d5d728e26..0a7c6d052c 100644
@@ -237,10 +237,11 @@ void ice_phy_cfg_lane_e822(struct ice_hw *hw, u8 port);
 enum ice_status
 ice_stop_phy_timer_e822(struct ice_hw *hw, u8 port, bool soft_reset);
 enum ice_status
-ice_start_phy_timer_e822(struct ice_hw *hw, u8 port, bool bypass);
+ice_start_phy_timer_e822(struct ice_hw *hw, u8 port);
 enum ice_status ice_phy_cfg_tx_offset_e822(struct ice_hw *hw, u8 port);
 enum ice_status ice_phy_cfg_rx_offset_e822(struct ice_hw *hw, u8 port);
-enum ice_status ice_phy_exit_bypass_e822(struct ice_hw *hw, u8 port);
+enum ice_status
+ice_phy_cfg_intr_e822(struct ice_hw *hw, u8 quad, bool ena, u8 threshold);
 
 /* E810 family functions */
 bool ice_is_gps_present_e810t(struct ice_hw *hw);
drivers/net/ice/ice_ethdev.c +1 -1
index 2a4073c4d1..8b41753b83 100644
@@ -2418,7 +2418,7 @@ ice_dev_init(struct rte_eth_dev *dev)
 		hw->phy_model = ICE_PHY_E822;
 
 	if (hw->phy_model == ICE_PHY_E822) {
-		ret = ice_start_phy_timer_e822(hw, hw->pf_id, true);
+		ret = ice_start_phy_timer_e822(hw, hw->pf_id);
 		if (ret)
 			PMD_INIT_LOG(ERR, "Failed to start phy timer\n");
 	}
Signature · 1 line
2.25.1
#28 lore raw

PATCH 27/30 net/ice/base: support inner etype in switchdev

In reply to Qiming Yang

Enable support for adding TC rules that filter on the inner EtherType field of tunneled packet headers.

---
 drivers/net/ice/base/ice_switch.c | 32 ++++++++++++++++++++-----------
 1 file changed, 21 insertions(+), 11 deletions(-)
drivers/net/ice/base/ice_switch.c +21 -11
index 37c192fb87..5061af5d79 100644
@@ -49,6 +49,7 @@ static const struct ice_dummy_pkt_offsets dummy_gre_tcp_packet_offsets[] = {
 	{ ICE_IPV4_OFOS,	14 },
 	{ ICE_NVGRE,		34 },
 	{ ICE_MAC_IL,		42 },
+	{ ICE_ETYPE_IL,		54 },
 	{ ICE_IPV4_IL,		56 },
 	{ ICE_TCP_IL,		76 },
 	{ ICE_PROTOCOL_LAST,	0 },
@@ -73,7 +74,8 @@ static const u8 dummy_gre_tcp_packet[] = {
 	0x00, 0x00, 0x00, 0x00,	/* ICE_MAC_IL 42 */
 	0x00, 0x00, 0x00, 0x00,
 	0x00, 0x00, 0x00, 0x00,
-	0x08, 0x00,
+
+	0x08, 0x00,		/* ICE_ETYPE_IL 54 */
 
 	0x45, 0x00, 0x00, 0x14,	/* ICE_IPV4_IL 56 */
 	0x00, 0x00, 0x00, 0x00,
@@ -94,6 +96,7 @@ static const struct ice_dummy_pkt_offsets dummy_gre_udp_packet_offsets[] = {
 	{ ICE_IPV4_OFOS,	14 },
 	{ ICE_NVGRE,		34 },
 	{ ICE_MAC_IL,		42 },
+	{ ICE_ETYPE_IL,		54 },
 	{ ICE_IPV4_IL,		56 },
 	{ ICE_UDP_ILOS,		76 },
 	{ ICE_PROTOCOL_LAST,	0 },
@@ -118,7 +121,8 @@ static const u8 dummy_gre_udp_packet[] = {
 	0x00, 0x00, 0x00, 0x00,	/* ICE_MAC_IL 42 */
 	0x00, 0x00, 0x00, 0x00,
 	0x00, 0x00, 0x00, 0x00,
-	0x08, 0x00,
+
+	0x08, 0x00,		/* ICE_ETYPE_IL 54 */
 
 	0x45, 0x00, 0x00, 0x14,	/* ICE_IPV4_IL 56 */
 	0x00, 0x00, 0x00, 0x00,
@@ -167,7 +171,8 @@ static const u8 dummy_udp_tun_tcp_packet[] = {
 	0x00, 0x00, 0x00, 0x00, /* ICE_MAC_IL 50 */
 	0x00, 0x00, 0x00, 0x00,
 	0x00, 0x00, 0x00, 0x00,
-	0x08, 0x00,
+
+	0x08, 0x00,		/* ICE_ETYPE_IL 62*/
 
 	0x45, 0x00, 0x00, 0x28, /* ICE_IPV4_IL 64 */
 	0x00, 0x01, 0x00, 0x00,
@@ -191,6 +196,7 @@ static const struct ice_dummy_pkt_offsets dummy_udp_tun_udp_packet_offsets[] = {
 	{ ICE_GENEVE,		42 },
 	{ ICE_VXLAN_GPE,	42 },
 	{ ICE_MAC_IL,		50 },
+	{ ICE_ETYPE_IL,		62 },
 	{ ICE_IPV4_IL,		64 },
 	{ ICE_UDP_ILOS,		84 },
 	{ ICE_PROTOCOL_LAST,	0 },
@@ -218,7 +224,8 @@ static const u8 dummy_udp_tun_udp_packet[] = {
 	0x00, 0x00, 0x00, 0x00, /* ICE_MAC_IL 50 */
 	0x00, 0x00, 0x00, 0x00,
 	0x00, 0x00, 0x00, 0x00,
-	0x08, 0x00,
+
+	0x08, 0x00,		/* ICE_ETYPE_IL 62 */
 
 	0x45, 0x00, 0x00, 0x1c, /* ICE_IPV4_IL 64 */
 	0x00, 0x01, 0x00, 0x00,
@@ -2216,6 +2223,7 @@ static struct ice_prof_type_entry ice_prof_type_tbl[ICE_GTPU_PROFILE] = {
 /**
  * ice_get_tun_type_for_recipe - get tunnel type for the recipe
  * @rid: recipe ID that we are populating
+ * @vlan: flag of vlan protocol
  */
 static enum ice_sw_tunnel_type ice_get_tun_type_for_recipe(u8 rid, bool vlan)
 {
@@ -2224,7 +2232,8 @@ static enum ice_sw_tunnel_type ice_get_tun_type_for_recipe(u8 rid, bool vlan)
 	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;
+	u16 i, j, profile_num = 0;
+	u16 k;
 	bool non_tun_valid = false;
 	bool pppoe_valid = false;
 	bool vxlan_valid = false;
@@ -3355,6 +3364,8 @@ ice_aq_add_update_mir_rule(struct ice_hw *hw, u16 rule_type, u16 dest_vsi,
 			else /* remove VSI from mirror rule */
 				mr_list[i] = CPU_TO_LE16(id);
 		}
+
+		desc.flags |= CPU_TO_LE16(ICE_AQ_FLAG_RD);
 	}
 
 	cmd = &desc.params.add_update_rule;
@@ -6984,6 +6995,7 @@ static const struct ice_prot_ext_tbl_entry ice_prot_ext[ICE_PROTOCOL_LAST] = {
 	{ ICE_MAC_OFOS,		{ 0, 2, 4, 6, 8, 10, 12 } },
 	{ ICE_MAC_IL,		{ 0, 2, 4, 6, 8, 10, 12 } },
 	{ ICE_ETYPE_OL,		{ 0 } },
+	{ ICE_ETYPE_IL,		{ 0 } },
 	{ ICE_VLAN_OFOS,	{ 2, 0 } },
 	{ ICE_IPV4_OFOS,	{ 0, 2, 4, 6, 8, 10, 12, 14, 16, 18 } },
 	{ ICE_IPV4_IL,		{ 0, 2, 4, 6, 8, 10, 12, 14, 16, 18 } },
@@ -7021,6 +7033,7 @@ static struct ice_protocol_entry ice_prot_id_tbl[ICE_PROTOCOL_LAST] = {
 	{ ICE_MAC_OFOS,		ICE_MAC_OFOS_HW },
 	{ ICE_MAC_IL,		ICE_MAC_IL_HW },
 	{ ICE_ETYPE_OL,		ICE_ETYPE_OL_HW },
+	{ ICE_ETYPE_IL,		ICE_ETYPE_IL_HW },
 	{ ICE_VLAN_OFOS,	ICE_VLAN_OL_HW },
 	{ ICE_IPV4_OFOS,	ICE_IPV4_OFOS_HW },
 	{ ICE_IPV4_IL,		ICE_IPV4_IL_HW },
@@ -7051,6 +7064,8 @@ static struct ice_protocol_entry ice_prot_id_tbl[ICE_PROTOCOL_LAST] = {
  * ice_find_recp - find a recipe
  * @hw: pointer to the hardware structure
  * @lkup_exts: extension sequence to match
+ * @tun_type: tunnel type of switch filter
+ * @priority: priority of switch filter
  *
  * Returns index of matching recipe, or ICE_MAX_NUM_RECIPES if not found.
  */
@@ -8961,13 +8976,11 @@ ice_fill_adv_packet_tun(struct ice_hw *hw, enum ice_sw_tunnel_type tun_type,
 		if (!ice_get_open_tunnel_port(hw, TNL_VXLAN, &open_port))
 			return ICE_ERR_CFG;
 		break;
-
 	case ICE_SW_TUN_GENEVE:
 	case ICE_SW_TUN_GENEVE_VLAN:
 		if (!ice_get_open_tunnel_port(hw, TNL_GENEVE, &open_port))
 			return ICE_ERR_CFG;
 		break;
-
 	default:
 		/* Nothing needs to be done for this tunnel type */
 		return ICE_SUCCESS;
@@ -9579,7 +9592,6 @@ ice_add_adv_rule(struct ice_hw *hw, struct ice_adv_lkup_elem *lkups,
 err_ice_add_adv_rule:
 	if (status && rinfo->sw_act.fltr_act == ICE_SET_MARK)
 		ice_free_sw_marker_lg(hw, lg_act_id, rinfo->sw_act.markid);
-
 	if (status && adv_fltr) {
 		ice_free(hw, adv_fltr->lkups);
 		ice_free(hw, adv_fltr);
@@ -9861,8 +9873,7 @@ enum ice_status ice_rem_adv_rule_for_vsi(struct ice_hw *hw, u16 vsi_handle)
 				if (!map_info)
 					continue;
 
-				if (!ice_is_bit_set(map_info->vsi_map,
-						    vsi_handle))
+				if (!ice_is_bit_set(map_info->vsi_map, vsi_handle))
 					continue;
 			} else if (rinfo.sw_act.vsi_handle != vsi_handle) {
 				continue;
@@ -9871,7 +9882,6 @@ enum ice_status ice_rem_adv_rule_for_vsi(struct ice_hw *hw, u16 vsi_handle)
 			rinfo.sw_act.vsi_handle = vsi_handle;
 			status = ice_rem_adv_rule(hw, list_itr->lkups,
 						  list_itr->lkups_cnt, &rinfo);
-
 			if (status)
 				return status;
 		}
Signature · 1 line
2.25.1
#29 lore raw

PATCH 28/30 net/ice/base: use const array to store link modes

In reply to Qiming Yang

Change suggested during review on E1000 mailing list. Implementation moves 1,5k of .text to .rodata

---
 drivers/net/ice/base/ice_common.c | 135 +++++++-----------------------
 1 file changed, 30 insertions(+), 105 deletions(-)
drivers/net/ice/base/ice_common.c +30 -105
index e4b25321db..f899e4644c 100644
@@ -85,118 +85,36 @@ static const char * const ice_link_mode_str_high[] = {
 	ice_arr_elem_idx(3, "100G_AUI2_AOC_ACC"),
 	ice_arr_elem_idx(4, "100G_AUI2"),
 };
-/**
- * dump_phy_type - helper function that prints PHY type strings
- * @hw: pointer to the HW structure
- * @phy: 64 bit PHY type to decipher
- * @i: bit index within phy
- * @phy_string: string corresponding to bit i in phy
- * @prefix: prefix string to differentiate multiple dumps
- */
-static void
-dump_phy_type(struct ice_hw *hw, u64 phy, u8 i, const char *phy_string,
-	      const char *prefix)
-{
-	if (phy & BIT_ULL(i))
-		ice_debug(hw, ICE_DBG_PHY, "%s: bit(%d): %s\n", prefix, i,
-			  phy_string);
-}
 
 /**
- * ice_dump_phy_type_low - helper function to dump phy_type_low
+ * ice_dump_phy_type - helper function to dump phy_type
  * @hw: pointer to the HW structure
  * @low: 64 bit value for phy_type_low
+ * @high: 64 bit value for phy_type_high
  * @prefix: prefix string to differentiate multiple dumps
  */
 static void
-ice_dump_phy_type_low(struct ice_hw *hw, u64 low, const char *prefix)
+ice_dump_phy_type(struct ice_hw *hw, u64 low, u64 high, const char *prefix)
 {
+	u32 i;
+
 	ice_debug(hw, ICE_DBG_PHY, "%s: phy_type_low: 0x%016llx\n", prefix,
 		  (unsigned long long)low);
 
-	dump_phy_type(hw, low, 0, "100BASE_TX", prefix);
-	dump_phy_type(hw, low, 1, "100M_SGMII", prefix);
-	dump_phy_type(hw, low, 2, "1000BASE_T", prefix);
-	dump_phy_type(hw, low, 3, "1000BASE_SX", prefix);
-	dump_phy_type(hw, low, 4, "1000BASE_LX", prefix);
-	dump_phy_type(hw, low, 5, "1000BASE_KX", prefix);
-	dump_phy_type(hw, low, 6, "1G_SGMII", prefix);
-	dump_phy_type(hw, low, 7, "2500BASE_T", prefix);
-	dump_phy_type(hw, low, 8, "2500BASE_X", prefix);
-	dump_phy_type(hw, low, 9, "2500BASE_KX", prefix);
-	dump_phy_type(hw, low, 10, "5GBASE_T", prefix);
-	dump_phy_type(hw, low, 11, "5GBASE_KR", prefix);
-	dump_phy_type(hw, low, 12, "10GBASE_T", prefix);
-	dump_phy_type(hw, low, 13, "10G_SFI_DA", prefix);
-	dump_phy_type(hw, low, 14, "10GBASE_SR", prefix);
-	dump_phy_type(hw, low, 15, "10GBASE_LR", prefix);
-	dump_phy_type(hw, low, 16, "10GBASE_KR_CR1", prefix);
-	dump_phy_type(hw, low, 17, "10G_SFI_AOC_ACC", prefix);
-	dump_phy_type(hw, low, 18, "10G_SFI_C2C", prefix);
-	dump_phy_type(hw, low, 19, "25GBASE_T", prefix);
-	dump_phy_type(hw, low, 20, "25GBASE_CR", prefix);
-	dump_phy_type(hw, low, 21, "25GBASE_CR_S", prefix);
-	dump_phy_type(hw, low, 22, "25GBASE_CR1", prefix);
-	dump_phy_type(hw, low, 23, "25GBASE_SR", prefix);
-	dump_phy_type(hw, low, 24, "25GBASE_LR", prefix);
-	dump_phy_type(hw, low, 25, "25GBASE_KR", prefix);
-	dump_phy_type(hw, low, 26, "25GBASE_KR_S", prefix);
-	dump_phy_type(hw, low, 27, "25GBASE_KR1", prefix);
-	dump_phy_type(hw, low, 28, "25G_AUI_AOC_ACC", prefix);
-	dump_phy_type(hw, low, 29, "25G_AUI_C2C", prefix);
-	dump_phy_type(hw, low, 30, "40GBASE_CR4", prefix);
-	dump_phy_type(hw, low, 31, "40GBASE_SR4", prefix);
-	dump_phy_type(hw, low, 32, "40GBASE_LR4", prefix);
-	dump_phy_type(hw, low, 33, "40GBASE_KR4", prefix);
-	dump_phy_type(hw, low, 34, "40G_XLAUI_AOC_ACC", prefix);
-	dump_phy_type(hw, low, 35, "40G_XLAUI", prefix);
-	dump_phy_type(hw, low, 36, "50GBASE_CR2", prefix);
-	dump_phy_type(hw, low, 37, "50GBASE_SR2", prefix);
-	dump_phy_type(hw, low, 38, "50GBASE_LR2", prefix);
-	dump_phy_type(hw, low, 39, "50GBASE_KR2", prefix);
-	dump_phy_type(hw, low, 40, "50G_LAUI2_AOC_ACC", prefix);
-	dump_phy_type(hw, low, 41, "50G_LAUI2", prefix);
-	dump_phy_type(hw, low, 42, "50G_AUI2_AOC_ACC", prefix);
-	dump_phy_type(hw, low, 43, "50G_AUI2", prefix);
-	dump_phy_type(hw, low, 44, "50GBASE_CP", prefix);
-	dump_phy_type(hw, low, 45, "50GBASE_SR", prefix);
-	dump_phy_type(hw, low, 46, "50GBASE_FR", prefix);
-	dump_phy_type(hw, low, 47, "50GBASE_LR", prefix);
-	dump_phy_type(hw, low, 48, "50GBASE_KR_PAM4", prefix);
-	dump_phy_type(hw, low, 49, "50G_AUI1_AOC_ACC", prefix);
-	dump_phy_type(hw, low, 50, "50G_AUI1", prefix);
-	dump_phy_type(hw, low, 51, "100GBASE_CR4", prefix);
-	dump_phy_type(hw, low, 52, "100GBASE_SR4", prefix);
-	dump_phy_type(hw, low, 53, "100GBASE_LR4", prefix);
-	dump_phy_type(hw, low, 54, "100GBASE_KR4", prefix);
-	dump_phy_type(hw, low, 55, "100G_CAUI4_AOC_ACC", prefix);
-	dump_phy_type(hw, low, 56, "100G_CAUI4", prefix);
-	dump_phy_type(hw, low, 57, "100G_AUI4_AOC_ACC", prefix);
-	dump_phy_type(hw, low, 58, "100G_AUI4", prefix);
-	dump_phy_type(hw, low, 59, "100GBASE_CR_PAM4", prefix);
-	dump_phy_type(hw, low, 60, "100GBASE_KR_PAM4", prefix);
-	dump_phy_type(hw, low, 61, "100GBASE_CP2", prefix);
-	dump_phy_type(hw, low, 62, "100GBASE_SR2", prefix);
-	dump_phy_type(hw, low, 63, "100GBASE_DR", prefix);
-}
-
-/**
- * ice_dump_phy_type_high - helper function to dump phy_type_high
- * @hw: pointer to the HW structure
- * @high: 64 bit value for phy_type_high
- * @prefix: prefix string to differentiate multiple dumps
- */
-static void
-ice_dump_phy_type_high(struct ice_hw *hw, u64 high, const char *prefix)
-{
+	for (i = 0; i < ARRAY_SIZE(ice_link_mode_str_low); i++) {
+		if (low & BIT_ULL(i))
+			ice_debug(hw, ICE_DBG_PHY, "%s:   bit(%d): %s\n",
+				  prefix, i, ice_link_mode_str_low[i]);
+	}
+
 	ice_debug(hw, ICE_DBG_PHY, "%s: phy_type_high: 0x%016llx\n", prefix,
 		  (unsigned long long)high);
 
-	dump_phy_type(hw, high, 0, "100GBASE_KR2_PAM4", prefix);
-	dump_phy_type(hw, high, 1, "100G_CAUI2_AOC_ACC", prefix);
-	dump_phy_type(hw, high, 2, "100G_CAUI2", prefix);
-	dump_phy_type(hw, high, 3, "100G_AUI2_AOC_ACC", prefix);
-	dump_phy_type(hw, high, 4, "100G_AUI2", prefix);
+	for (i = 0; i < ARRAY_SIZE(ice_link_mode_str_high); i++) {
+		if (high & BIT_ULL(i))
+			ice_debug(hw, ICE_DBG_PHY, "%s:   bit(%d): %s\n",
+				  prefix, i, ice_link_mode_str_high[i]);
+	}
 }
 
 /**
@@ -551,23 +469,30 @@ ice_aq_get_phy_caps(struct ice_port_info *pi, bool qual_mods, u8 report_mode,
 		cmd->param0 |= CPU_TO_LE16(ICE_AQC_GET_PHY_RQM);
 
 	cmd->param0 |= CPU_TO_LE16(report_mode);
+
 	status = ice_aq_send_cmd(hw, &desc, pcaps, pcaps_size, cd);
 
 	ice_debug(hw, ICE_DBG_LINK, "get phy caps dump\n");
 
-	if (report_mode == ICE_AQC_REPORT_TOPO_CAP_MEDIA)
+	switch (report_mode) {
+	case ICE_AQC_REPORT_TOPO_CAP_MEDIA:
 		prefix = "phy_caps_media";
-	else if (report_mode == ICE_AQC_REPORT_TOPO_CAP_NO_MEDIA)
+		break;
+	case ICE_AQC_REPORT_TOPO_CAP_NO_MEDIA:
 		prefix = "phy_caps_no_media";
-	else if (report_mode == ICE_AQC_REPORT_ACTIVE_CFG)
+		break;
+	case ICE_AQC_REPORT_ACTIVE_CFG:
 		prefix = "phy_caps_active";
-	else if (report_mode == ICE_AQC_REPORT_DFLT_CFG)
+		break;
+	case ICE_AQC_REPORT_DFLT_CFG:
 		prefix = "phy_caps_default";
-	else
+		break;
+	default:
 		prefix = "phy_caps_invalid";
+	}
 
-	ice_dump_phy_type_low(hw, LE64_TO_CPU(pcaps->phy_type_low), prefix);
-	ice_dump_phy_type_high(hw, LE64_TO_CPU(pcaps->phy_type_high), prefix);
+	ice_dump_phy_type(hw, LE64_TO_CPU(pcaps->phy_type_low),
+			  LE64_TO_CPU(pcaps->phy_type_high), prefix);
 
 	ice_debug(hw, ICE_DBG_LINK, "%s: report_mode = 0x%x\n",
 		  prefix, report_mode);
Signature · 1 line
2.25.1
#30 lore raw

PATCH 29/30 net/ice/base: introduce a new ID for E810 NIC

In reply to Qiming Yang
---
 drivers/net/ice/base/ice_adminq_cmd.h | 4 ++--
 drivers/net/ice/base/ice_common.c     | 1 +
 drivers/net/ice/base/ice_devids.h     | 5 +++--
 3 files changed, 6 insertions(+), 4 deletions(-)
drivers/net/ice/base/ice_adminq_cmd.h +2 -2
index 29b123d900..06452481bb 100644
@@ -2051,8 +2051,8 @@ struct ice_aqc_lldp_get_mib {
 #define ICE_AQ_LLDP_DCBX_S			6
 #define ICE_AQ_LLDP_DCBX_M			(0x3 << ICE_AQ_LLDP_DCBX_S)
 #define ICE_AQ_LLDP_DCBX_NA			0
-#define ICE_AQ_LLDP_DCBX_IEEE			1
-#define ICE_AQ_LLDP_DCBX_CEE			2
+#define ICE_AQ_LLDP_DCBX_CEE			1
+#define ICE_AQ_LLDP_DCBX_IEEE			2
 /* The following bytes are reserved for the Get LLDP MIB command (0x0A00)
  * and in the LLDP MIB Change Event (0x0A01). They are valid for the
  * Get LLDP MIB (0x0A00) response only.
drivers/net/ice/base/ice_common.c +1 -0
index f899e4644c..7d2a254c47 100644
@@ -226,6 +226,7 @@ bool ice_is_e810t(struct ice_hw *hw)
 		case ICE_SUBDEV_ID_E810T3:
 		case ICE_SUBDEV_ID_E810T4:
 		case ICE_SUBDEV_ID_E810T5:
+		case ICE_SUBDEV_ID_E810T7:
 			return true;
 		}
 		break;
drivers/net/ice/base/ice_devids.h +3 -2
index 0e0a20542b..81d993bfea 100644
@@ -6,6 +6,8 @@
 #define _ICE_DEVIDS_H_
 
 /* Device IDs */
+#define ICE_DEV_ID_E822_SI_DFLT		0x1888
+/* Intel(R) Ethernet Connection E823-L for backplane */
 #define ICE_DEV_ID_E823L_BACKPLANE	0x124C
 /* Intel(R) Ethernet Connection E823-L for SFP */
 #define ICE_DEV_ID_E823L_SFP		0x124D
@@ -35,6 +37,7 @@
 #define ICE_SUBDEV_ID_E810T4		0x02EA
 #define ICE_SUBDEV_ID_E810T5		0x0010
 #define ICE_SUBDEV_ID_E810T6		0x0012
+#define ICE_SUBDEV_ID_E810T7		0x0011
 /* Intel(R) Ethernet Controller E810-XXV for backplane */
 #define ICE_DEV_ID_E810_XXV_BACKPLANE	0x1599
 /* Intel(R) Ethernet Controller E810-XXV for QSFP */
@@ -42,8 +45,6 @@
 /* Intel(R) Ethernet Controller E810-XXV for SFP */
 #define ICE_DEV_ID_E810_XXV_SFP		0x159B
 /* Intel(R) Ethernet Connection E823-C for backplane */
-#define ICE_DEV_ID_E822_SI_DFLT		0x1888
-/* Intel(R) Ethernet Connection E823-L for backplane */
 #define ICE_DEV_ID_E823C_BACKPLANE	0x188A
 /* Intel(R) Ethernet Connection E823-C for QSFP */
 #define ICE_DEV_ID_E823C_QSFP		0x188B
Signature · 1 line
2.25.1
#31 lore raw

PATCH 30/30 net/ice/base: fix Generic Checksum acronym

In reply to Qiming Yang
Fixes c31095a0b20f ("net/ice/base: add GCO defines and GCO flex descriptor")
---
 drivers/net/ice/base/ice_common.c    |  2 +-
 drivers/net/ice/base/ice_lan_tx_rx.h | 15 ++++++++-------
 2 files changed, 9 insertions(+), 8 deletions(-)
drivers/net/ice/base/ice_common.c +1 -1
index 7d2a254c47..c324500b54 100644
@@ -1488,7 +1488,7 @@ const struct ice_ctx_ele ice_tlan_ctx_info[] = {
 	ICE_CTX_STORE(ice_tlan_ctx, cache_prof_idx,		2,	166),
 	ICE_CTX_STORE(ice_tlan_ctx, pkt_shaper_prof_idx,	3,	168),
 	ICE_CTX_STORE(ice_tlan_ctx, int_q_state,		122,	171),
-	ICE_CTX_STORE(ice_tlan_ctx, gsc_ena,			1,	172),
+	ICE_CTX_STORE(ice_tlan_ctx, gcs_ena,			1,	172),
 	{ 0 }
 };
 
drivers/net/ice/base/ice_lan_tx_rx.h +8 -7
index d8ac841e46..d84f2f6db5 100644
@@ -747,7 +747,7 @@ enum ice_rxdid {
 	ICE_RXDID_FLEX_NIC		= 2,
 	ICE_RXDID_FLEX_NIC_2		= 6,
 	ICE_RXDID_HW			= 7,
-	ICE_RXDID_GSC			= 9,
+	ICE_RXDID_GCS			= 9,
 	ICE_RXDID_COMMS_GENERIC		= 16,
 	ICE_RXDID_COMMS_AUX_VLAN	= 17,
 	ICE_RXDID_COMMS_AUX_IPV4	= 18,
@@ -1069,14 +1069,14 @@ enum ice_tx_desc_len_fields {
 struct ice_tx_ctx_desc {
 	__le32 tunneling_params;
 	__le16 l2tag2;
-	__le16 gsc;
+	__le16 gcs;
 	__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  /* 7 BITS */
+#define ICE_TX_GCS_DESC_OFFSET	7  /* 4 BITS */
+#define ICE_TX_GCS_DESC_TYPE	11 /* 2 BITS */
+#define ICE_TX_GCS_DESC_ENA	13 /* 1 BIT */
 
 #define ICE_TXD_CTX_QW1_DTYPE_S	0
 #define ICE_TXD_CTX_QW1_DTYPE_M	(0xFUL << ICE_TXD_CTX_QW1_DTYPE_S)
@@ -1188,8 +1188,9 @@ struct ice_tlan_ctx {
 	u8 drop_ena;
 	u8 cache_prof_idx;
 	u8 pkt_shaper_prof_idx;
-	u8 gsc_ena;
+	u8 gcs_ena;
 	u8 int_q_state;	/* width not needed - internal - DO NOT WRITE!!! */
+	u16 tail;
 };
 
 /* LAN Tx Completion Queue data */
Signature · 1 line
2.25.1
#32 lore raw

RE: [PATCH 30/30] net/ice/base: fix Generic Checksum acronym

Since the E830 Generic Checksum requirements have changed, this patch should probably wait until the code changes have been completed. GCO is no longer by the LAN Tx Queue Context, but will be done by the LAN Tx Context Descriptor GCS field. Also the RX Flex Id will be 2, not 9.

Thanks,
Paul

-----Original Message-----
From: Yang, Qiming <[email protected]>
Sent: Wednesday, April 26, 2023 11:20 PM
To: [email protected]
Cc: Zhang, Qi Z <[email protected]>; Yang, Qiming <[email protected]>; [email protected]; Greenwalt, Paul <[email protected]>
Subject: [PATCH 30/30] net/ice/base: fix Generic Checksum acronym

Fixes c31095a0b20f ("net/ice/base: add GCO defines and GCO flex descriptor")
---
 drivers/net/ice/base/ice_common.c    |  2 +-
 drivers/net/ice/base/ice_lan_tx_rx.h | 15 ++++++++-------
 2 files changed, 9 insertions(+), 8 deletions(-)
drivers/net/ice/base/ice_common.c +1 -1
index 7d2a254c47..c324500b54 100644
@@ -1488,7 +1488,7 @@ const struct ice_ctx_ele ice_tlan_ctx_info[] = {
 	ICE_CTX_STORE(ice_tlan_ctx, cache_prof_idx,		2,	166),
 	ICE_CTX_STORE(ice_tlan_ctx, pkt_shaper_prof_idx,	3,	168),
 	ICE_CTX_STORE(ice_tlan_ctx, int_q_state,		122,	171),
-	ICE_CTX_STORE(ice_tlan_ctx, gsc_ena,			1,	172),
+	ICE_CTX_STORE(ice_tlan_ctx, gcs_ena,			1,	172),
 	{ 0 }
 };
 
drivers/net/ice/base/ice_lan_tx_rx.h +8 -7
index d8ac841e46..d84f2f6db5 100644
@@ -747,7 +747,7 @@ enum ice_rxdid {
 	ICE_RXDID_FLEX_NIC		= 2,
 	ICE_RXDID_FLEX_NIC_2		= 6,
 	ICE_RXDID_HW			= 7,
-	ICE_RXDID_GSC			= 9,
+	ICE_RXDID_GCS			= 9,
 	ICE_RXDID_COMMS_GENERIC		= 16,
 	ICE_RXDID_COMMS_AUX_VLAN	= 17,
 	ICE_RXDID_COMMS_AUX_IPV4	= 18,
@@ -1069,14 +1069,14 @@ enum ice_tx_desc_len_fields {  struct ice_tx_ctx_desc {
 	__le32 tunneling_params;
 	__le16 l2tag2;
-	__le16 gsc;
+	__le16 gcs;
 	__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  /* 7 BITS */
+#define ICE_TX_GCS_DESC_OFFSET	7  /* 4 BITS */
+#define ICE_TX_GCS_DESC_TYPE	11 /* 2 BITS */
+#define ICE_TX_GCS_DESC_ENA	13 /* 1 BIT */
 
 #define ICE_TXD_CTX_QW1_DTYPE_S	0
 #define ICE_TXD_CTX_QW1_DTYPE_M	(0xFUL << ICE_TXD_CTX_QW1_DTYPE_S)
@@ -1188,8 +1188,9 @@ struct ice_tlan_ctx {
 	u8 drop_ena;
 	u8 cache_prof_idx;
 	u8 pkt_shaper_prof_idx;
-	u8 gsc_ena;
+	u8 gcs_ena;
 	u8 int_q_state;	/* width not needed - internal - DO NOT WRITE!!! */
+	u16 tail;
 };
 
 /* LAN Tx Completion Queue data */

--
2.25.1

#33 lore raw

v2 cover net/ice/base: code update

In reply to Qiming Yang

Updated share code to 2023.02 version.

Qiming Yang (20):
net/ice/base: updated copyright
net/ice/base: add NAC Topology device capability parser net/ice/base: add new device for E810 net/ice/base: fix incorrect defines for DCBx net/ice/base: introduce a non-atomic function net/ice/base: add missing AQ flag to AQ command net/ice/base: add support for inner etype in switchdev net/ice/base: add support for PPPoE hardware offload net/ice/base: remove direction metadata for switchdev net/ice/base: reduce time to read Option data net/ice/base: add support for VLAN TPID filters net/ice/base: add C825-X device ID net/ice/base: add function to get rxq context net/ice/base: modify tunnel match mask net/ice/base: check VSIG before disassociating VSI net/ice/base: delete get field vector function net/ice/base: update 3k-sign DDP support for E825C net/ice/base: fix static analyzer bug net/ice/base: offer memory config for schedual node net/ice/base: add new AQ ro read HW sensors

 drivers/net/ice/base/README              |   2 +-
 drivers/net/ice/base/ice_acl.c           |   2 +-
 drivers/net/ice/base/ice_acl.h           |   2 +-
 drivers/net/ice/base/ice_acl_ctrl.c      |   2 +-
 drivers/net/ice/base/ice_adminq_cmd.h    |  35 +-
 drivers/net/ice/base/ice_alloc.h         |   2 +-
 drivers/net/ice/base/ice_bitops.h        |  11 +-
 drivers/net/ice/base/ice_bst_tcam.c      |   2 +-
 drivers/net/ice/base/ice_bst_tcam.h      |   2 +-
 drivers/net/ice/base/ice_cgu_regs.h      |   2 +-
 drivers/net/ice/base/ice_common.c        | 147 +++++++-
 drivers/net/ice/base/ice_common.h        |  13 +-
 drivers/net/ice/base/ice_controlq.c      |   2 +-
 drivers/net/ice/base/ice_controlq.h      |   2 +-
 drivers/net/ice/base/ice_dcb.c           |   4 +-
 drivers/net/ice/base/ice_dcb.h           |   2 +-
 drivers/net/ice/base/ice_ddp.c           |  13 +-
 drivers/net/ice/base/ice_ddp.h           |   3 +-
 drivers/net/ice/base/ice_defs.h          |   2 +-
 drivers/net/ice/base/ice_devids.h        |  10 +-
 drivers/net/ice/base/ice_fdir.c          |   2 +-
 drivers/net/ice/base/ice_fdir.h          |   2 +-
 drivers/net/ice/base/ice_flex_pipe.c     |   2 +-
 drivers/net/ice/base/ice_flex_pipe.h     |   2 +-
 drivers/net/ice/base/ice_flex_type.h     |   2 +-
 drivers/net/ice/base/ice_flg_rd.c        |   2 +-
 drivers/net/ice/base/ice_flg_rd.h        |   2 +-
 drivers/net/ice/base/ice_flow.c          |  15 +-
 drivers/net/ice/base/ice_flow.h          |   2 +-
 drivers/net/ice/base/ice_hw_autogen.h    |   2 +-
 drivers/net/ice/base/ice_imem.c          |   2 +-
 drivers/net/ice/base/ice_imem.h          |   2 +-
 drivers/net/ice/base/ice_lan_tx_rx.h     |   2 +-
 drivers/net/ice/base/ice_metainit.c      |   2 +-
 drivers/net/ice/base/ice_metainit.h      |   2 +-
 drivers/net/ice/base/ice_mk_grp.c        |   2 +-
 drivers/net/ice/base/ice_mk_grp.h        |   2 +-
 drivers/net/ice/base/ice_nvm.c           |  52 ++-
 drivers/net/ice/base/ice_nvm.h           |   2 +-
 drivers/net/ice/base/ice_parser.c        |   2 +-
 drivers/net/ice/base/ice_parser.h        |   2 +-
 drivers/net/ice/base/ice_parser_rt.c     |   2 +-
 drivers/net/ice/base/ice_parser_rt.h     |   2 +-
 drivers/net/ice/base/ice_parser_util.h   |   2 +-
 drivers/net/ice/base/ice_pg_cam.c        |   2 +-
 drivers/net/ice/base/ice_pg_cam.h        |   2 +-
 drivers/net/ice/base/ice_proto_grp.c     |   2 +-
 drivers/net/ice/base/ice_proto_grp.h     |   2 +-
 drivers/net/ice/base/ice_protocol_type.h |  11 +-
 drivers/net/ice/base/ice_ptp_consts.h    |   2 +-
 drivers/net/ice/base/ice_ptp_hw.c        |   2 +-
 drivers/net/ice/base/ice_ptp_hw.h        |   2 +-
 drivers/net/ice/base/ice_ptype_mk.c      |   2 +-
 drivers/net/ice/base/ice_ptype_mk.h      |   2 +-
 drivers/net/ice/base/ice_sbq_cmd.h       |   2 +-
 drivers/net/ice/base/ice_sched.c         |  42 ++-
 drivers/net/ice/base/ice_sched.h         |  10 +-
 drivers/net/ice/base/ice_status.h        |   2 +-
 drivers/net/ice/base/ice_switch.c        | 442 ++++++++++++++++++++---
 drivers/net/ice/base/ice_switch.h        |   4 +-
 drivers/net/ice/base/ice_tmatch.h        |   2 +-
 drivers/net/ice/base/ice_type.h          |  13 +-
 drivers/net/ice/base/ice_vlan_mode.c     |   3 +-
 drivers/net/ice/base/ice_vlan_mode.h     |   2 +-
 drivers/net/ice/base/ice_xlt_kb.c        |   2 +-
 drivers/net/ice/base/ice_xlt_kb.h        |   2 +-
 drivers/net/ice/ice_ethdev.c             |   4 +-
 67 files changed, 755 insertions(+), 175 deletions(-)
Signature · 1 line
2.25.1
#34 lore raw

PATCH v2 1/20 net/ice/base: updated copyright

Updated copyright to 2023.

---
 drivers/net/ice/base/README              | 2 +-
 drivers/net/ice/base/ice_acl.c           | 2 +-
 drivers/net/ice/base/ice_acl.h           | 2 +-
 drivers/net/ice/base/ice_acl_ctrl.c      | 2 +-
 drivers/net/ice/base/ice_adminq_cmd.h    | 2 +-
 drivers/net/ice/base/ice_alloc.h         | 2 +-
 drivers/net/ice/base/ice_bitops.h        | 2 +-
 drivers/net/ice/base/ice_bst_tcam.c      | 2 +-
 drivers/net/ice/base/ice_bst_tcam.h      | 2 +-
 drivers/net/ice/base/ice_cgu_regs.h      | 2 +-
 drivers/net/ice/base/ice_common.c        | 2 +-
 drivers/net/ice/base/ice_common.h        | 2 +-
 drivers/net/ice/base/ice_controlq.c      | 2 +-
 drivers/net/ice/base/ice_controlq.h      | 2 +-
 drivers/net/ice/base/ice_dcb.c           | 2 +-
 drivers/net/ice/base/ice_dcb.h           | 2 +-
 drivers/net/ice/base/ice_ddp.c           | 2 +-
 drivers/net/ice/base/ice_ddp.h           | 2 +-
 drivers/net/ice/base/ice_defs.h          | 2 +-
 drivers/net/ice/base/ice_devids.h        | 2 +-
 drivers/net/ice/base/ice_fdir.c          | 2 +-
 drivers/net/ice/base/ice_fdir.h          | 2 +-
 drivers/net/ice/base/ice_flex_pipe.c     | 2 +-
 drivers/net/ice/base/ice_flex_pipe.h     | 2 +-
 drivers/net/ice/base/ice_flex_type.h     | 2 +-
 drivers/net/ice/base/ice_flg_rd.c        | 2 +-
 drivers/net/ice/base/ice_flg_rd.h        | 2 +-
 drivers/net/ice/base/ice_flow.c          | 2 +-
 drivers/net/ice/base/ice_flow.h          | 2 +-
 drivers/net/ice/base/ice_hw_autogen.h    | 2 +-
 drivers/net/ice/base/ice_imem.c          | 2 +-
 drivers/net/ice/base/ice_imem.h          | 2 +-
 drivers/net/ice/base/ice_lan_tx_rx.h     | 2 +-
 drivers/net/ice/base/ice_metainit.c      | 2 +-
 drivers/net/ice/base/ice_metainit.h      | 2 +-
 drivers/net/ice/base/ice_mk_grp.c        | 2 +-
 drivers/net/ice/base/ice_mk_grp.h        | 2 +-
 drivers/net/ice/base/ice_nvm.c           | 2 +-
 drivers/net/ice/base/ice_nvm.h           | 2 +-
 drivers/net/ice/base/ice_parser.c        | 2 +-
 drivers/net/ice/base/ice_parser.h        | 2 +-
 drivers/net/ice/base/ice_parser_rt.c     | 2 +-
 drivers/net/ice/base/ice_parser_rt.h     | 2 +-
 drivers/net/ice/base/ice_parser_util.h   | 2 +-
 drivers/net/ice/base/ice_pg_cam.c        | 2 +-
 drivers/net/ice/base/ice_pg_cam.h        | 2 +-
 drivers/net/ice/base/ice_proto_grp.c     | 2 +-
 drivers/net/ice/base/ice_proto_grp.h     | 2 +-
 drivers/net/ice/base/ice_protocol_type.h | 2 +-
 drivers/net/ice/base/ice_ptp_consts.h    | 2 +-
 drivers/net/ice/base/ice_ptp_hw.c        | 2 +-
 drivers/net/ice/base/ice_ptp_hw.h        | 2 +-
 drivers/net/ice/base/ice_ptype_mk.c      | 2 +-
 drivers/net/ice/base/ice_ptype_mk.h      | 2 +-
 drivers/net/ice/base/ice_sbq_cmd.h       | 2 +-
 drivers/net/ice/base/ice_sched.c         | 2 +-
 drivers/net/ice/base/ice_sched.h         | 2 +-
 drivers/net/ice/base/ice_status.h        | 2 +-
 drivers/net/ice/base/ice_switch.c        | 2 +-
 drivers/net/ice/base/ice_switch.h        | 2 +-
 drivers/net/ice/base/ice_tmatch.h        | 2 +-
 drivers/net/ice/base/ice_type.h          | 2 +-
 drivers/net/ice/base/ice_vlan_mode.c     | 2 +-
 drivers/net/ice/base/ice_vlan_mode.h     | 2 +-
 drivers/net/ice/base/ice_xlt_kb.c        | 2 +-
 drivers/net/ice/base/ice_xlt_kb.h        | 2 +-
 66 files changed, 66 insertions(+), 66 deletions(-)
drivers/net/ice/base/README +1 -1
index 0e37a5f7a1..d3b96e0fb4 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2020-2022 Intel Corporation
+ * Copyright(c) 2020-2023 Intel Corporation
  */
 
 Intel® ICE driver
drivers/net/ice/base/ice_acl.c +1 -1
index 23b6c608be..fd9c6d5c14 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2001-2022 Intel Corporation
+ * Copyright(c) 2001-2023 Intel Corporation
  */
 
 #include "ice_acl.h"
drivers/net/ice/base/ice_acl.h +1 -1
index b5f2ec04a4..ac703be0a1 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2001-2022 Intel Corporation
+ * Copyright(c) 2001-2023 Intel Corporation
  */
 
 #ifndef _ICE_ACL_H_
drivers/net/ice/base/ice_acl_ctrl.c +1 -1
index 3a912f2aa0..2223a8313b 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2001-2022 Intel Corporation
+ * Copyright(c) 2001-2023 Intel Corporation
  */
 
 #include "ice_acl.h"
drivers/net/ice/base/ice_adminq_cmd.h +1 -1
index 5a817982b4..65cba9ab37 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2001-2022 Intel Corporation
+ * Copyright(c) 2001-2023 Intel Corporation
  */
 
 #ifndef _ICE_ADMINQ_CMD_H_
drivers/net/ice/base/ice_alloc.h +1 -1
index dca502ab25..6487cdc210 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2001-2022 Intel Corporation
+ * Copyright(c) 2001-2023 Intel Corporation
  */
 
 #ifndef _ICE_ALLOC_H_
drivers/net/ice/base/ice_bitops.h +1 -1
index c4ae2b9c8e..5384e99415 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2001-2022 Intel Corporation
+ * Copyright(c) 2001-2023 Intel Corporation
  */
 
 #ifndef _ICE_BITOPS_H_
drivers/net/ice/base/ice_bst_tcam.c +1 -1
index 5cc0d12251..fbe106df60 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2001-2022 Intel Corporation
+ * Copyright(c) 2001-2023 Intel Corporation
  */
 
 #include "ice_common.h"
drivers/net/ice/base/ice_bst_tcam.h +1 -1
index 292444c919..2fb2c8421e 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2001-2022 Intel Corporation
+ * Copyright(c) 2001-2023 Intel Corporation
  */
 
 #ifndef _ICE_BST_TCAM_H_
drivers/net/ice/base/ice_cgu_regs.h +1 -1
index 6b9a359c5b..c44bfc1846 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2001-2022 Intel Corporation
+ * Copyright(c) 2001-2023 Intel Corporation
  */
 
 #ifndef _ICE_CGU_REGS_H_
drivers/net/ice/base/ice_common.c +1 -1
index 1a02aad869..fa30c50ca1 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2001-2022 Intel Corporation
+ * Copyright(c) 2001-2023 Intel Corporation
  */
 
 #include "ice_common.h"
drivers/net/ice/base/ice_common.h +1 -1
index 58260afb93..e1febfb0c4 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2001-2022 Intel Corporation
+ * Copyright(c) 2001-2023 Intel Corporation
  */
 
 #ifndef _ICE_COMMON_H_
drivers/net/ice/base/ice_controlq.c +1 -1
index 8971a140ef..c34407b48c 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2001-2022 Intel Corporation
+ * Copyright(c) 2001-2023 Intel Corporation
  */
 
 #include "ice_common.h"
drivers/net/ice/base/ice_controlq.h +1 -1
index 45fe70450e..986604ec3c 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2001-2022 Intel Corporation
+ * Copyright(c) 2001-2023 Intel Corporation
  */
 
 #ifndef _ICE_CONTROLQ_H_
drivers/net/ice/base/ice_dcb.c +1 -1
index 0e604df541..2a308b02bf 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2001-2022 Intel Corporation
+ * Copyright(c) 2001-2023 Intel Corporation
  */
 
 #include "ice_common.h"
drivers/net/ice/base/ice_dcb.h +1 -1
index d010c539a6..bae033a460 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2001-2022 Intel Corporation
+ * Copyright(c) 2001-2023 Intel Corporation
  */
 
 #ifndef _ICE_DCB_H_
drivers/net/ice/base/ice_ddp.c +1 -1
index d1cae48047..93ff2608d4 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2001-2022 Intel Corporation
+ * Copyright(c) 2001-2023 Intel Corporation
  */
 
 #include "ice_ddp.h"
drivers/net/ice/base/ice_ddp.h +1 -1
index 53bbbe2a5a..4896e85b91 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2001-2022 Intel Corporation
+ * Copyright(c) 2001-2023 Intel Corporation
  */
 
 #ifndef _ICE_DDP_H_
drivers/net/ice/base/ice_defs.h +1 -1
index 6e886f6aac..210ce6263b 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2001-2022 Intel Corporation
+ * Copyright(c) 2001-2023 Intel Corporation
  */
 
 #ifndef _ICE_DEFS_H_
drivers/net/ice/base/ice_devids.h +1 -1
index 13a4b16402..f80789ebc5 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2001-2022 Intel Corporation
+ * Copyright(c) 2001-2023 Intel Corporation
  */
 
 #ifndef _ICE_DEVIDS_H_
drivers/net/ice/base/ice_fdir.c +1 -1
index 85ca29bae5..3ed2a63b68 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2001-2022 Intel Corporation
+ * Copyright(c) 2001-2023 Intel Corporation
  */
 
 #include "ice_common.h"
drivers/net/ice/base/ice_fdir.h +1 -1
index f338da38c2..81ba6008e4 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2001-2022 Intel Corporation
+ * Copyright(c) 2001-2023 Intel Corporation
  */
 
 #ifndef _ICE_FDIR_H_
drivers/net/ice/base/ice_flex_pipe.c +1 -1
index b6bc0062a3..f9266447d9 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2001-2022 Intel Corporation
+ * Copyright(c) 2001-2023 Intel Corporation
  */
 
 #include "ice_common.h"
drivers/net/ice/base/ice_flex_pipe.h +1 -1
index 9ba337e1fa..422d09becc 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2001-2022 Intel Corporation
+ * Copyright(c) 2001-2023 Intel Corporation
  */
 
 #ifndef _ICE_FLEX_PIPE_H_
drivers/net/ice/base/ice_flex_type.h +1 -1
index 7b8f6f9049..c83479d6fa 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2001-2022 Intel Corporation
+ * Copyright(c) 2001-2023 Intel Corporation
  */
 
 #ifndef _ICE_FLEX_TYPE_H_
drivers/net/ice/base/ice_flg_rd.c +1 -1
index f320958bd3..97f62e6cc4 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2001-2022 Intel Corporation
+ * Copyright(c) 2001-2023 Intel Corporation
  */
 
 #include "ice_common.h"
drivers/net/ice/base/ice_flg_rd.h +1 -1
index 8cd375f89f..c194a4f462 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2001-2022 Intel Corporation
+ * Copyright(c) 2001-2023 Intel Corporation
  */
 
 #ifndef _ICE_FLG_RD_H_
drivers/net/ice/base/ice_flow.c +1 -1
index 3483a5ed4f..5254ee27ed 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2001-2022 Intel Corporation
+ * Copyright(c) 2001-2023 Intel Corporation
  */
 
 #include "ice_common.h"
drivers/net/ice/base/ice_flow.h +1 -1
index dba71aab74..57e8e1f1df 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2001-2022 Intel Corporation
+ * Copyright(c) 2001-2023 Intel Corporation
  */
 
 #ifndef _ICE_FLOW_H_
drivers/net/ice/base/ice_hw_autogen.h +1 -1
index 6dc77bf7cb..4610cec6a7 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2001-2022 Intel Corporation
+ * Copyright(c) 2001-2023 Intel Corporation
  */
 
 /* Machine generated file. Do not edit. */
drivers/net/ice/base/ice_imem.c +1 -1
index 277311fd20..f193aaf836 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2001-2022 Intel Corporation
+ * Copyright(c) 2001-2023 Intel Corporation
  */
 
 #include "ice_common.h"
drivers/net/ice/base/ice_imem.h +1 -1
index 06d3d5a96d..0328830b94 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2001-2022 Intel Corporation
+ * Copyright(c) 2001-2023 Intel Corporation
  */
 
 #ifndef _ICE_IMEM_H_
drivers/net/ice/base/ice_lan_tx_rx.h +1 -1
index be6d88f0ca..d816df0ff6 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2001-2022 Intel Corporation
+ * Copyright(c) 2001-2023 Intel Corporation
  */
 
 #ifndef _ICE_LAN_TX_RX_H_
drivers/net/ice/base/ice_metainit.c +1 -1
index b75d68c010..1e990c9aa0 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2001-2022 Intel Corporation
+ * Copyright(c) 2001-2023 Intel Corporation
  */
 
 #include "ice_common.h"
drivers/net/ice/base/ice_metainit.h +1 -1
index dad4faf4d4..440932ae30 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2001-2022 Intel Corporation
+ * Copyright(c) 2001-2023 Intel Corporation
  */
 
 #ifndef _ICE_METAINIT_H_
drivers/net/ice/base/ice_mk_grp.c +1 -1
index cafe51544d..9de4527b58 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2001-2022 Intel Corporation
+ * Copyright(c) 2001-2023 Intel Corporation
  */
 
 #include "ice_common.h"
drivers/net/ice/base/ice_mk_grp.h +1 -1
index 9401647ef0..161dd724cb 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2001-2022 Intel Corporation
+ * Copyright(c) 2001-2023 Intel Corporation
  */
 
 #ifndef _ICE_MK_GRP_H_
drivers/net/ice/base/ice_nvm.c +1 -1
index 6550dda557..cb45cb8134 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2001-2022 Intel Corporation
+ * Copyright(c) 2001-2023 Intel Corporation
  */
 
 #include "ice_common.h"
drivers/net/ice/base/ice_nvm.h +1 -1
index a8cda452db..c3e61a301f 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2001-2022 Intel Corporation
+ * Copyright(c) 2001-2023 Intel Corporation
  */
 
 #ifndef _ICE_NVM_H_
drivers/net/ice/base/ice_parser.c +1 -1
index a1b906d369..79c97f7903 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2001-2022 Intel Corporation
+ * Copyright(c) 2001-2023 Intel Corporation
  */
 
 #include "ice_common.h"
drivers/net/ice/base/ice_parser.h +1 -1
index b4c5e7b14d..0f64584898 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2001-2022 Intel Corporation
+ * Copyright(c) 2001-2023 Intel Corporation
  */
 
 #ifndef _ICE_PARSER_H_
drivers/net/ice/base/ice_parser_rt.c +1 -1
index 215e11abd2..68c0f5d7fb 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2001-2022 Intel Corporation
+ * Copyright(c) 2001-2023 Intel Corporation
  */
 
 #include "ice_common.h"
drivers/net/ice/base/ice_parser_rt.h +1 -1
index c1e1af0059..de851643b4 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2001-2022 Intel Corporation
+ * Copyright(c) 2001-2023 Intel Corporation
  */
 
 #ifndef _ICE_PARSER_RT_H_
drivers/net/ice/base/ice_parser_util.h +1 -1
index a33d6bf11c..9949b985ee 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2001-2022 Intel Corporation
+ * Copyright(c) 2001-2023 Intel Corporation
  */
 
 #ifndef _ICE_PARSER_UTIL_H_
drivers/net/ice/base/ice_pg_cam.c +1 -1
index f06a3581a0..e6324945fb 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2001-2022 Intel Corporation
+ * Copyright(c) 2001-2023 Intel Corporation
  */
 
 #include "ice_common.h"
drivers/net/ice/base/ice_pg_cam.h +1 -1
index ac0863afb0..0412ac5ae2 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2001-2022 Intel Corporation
+ * Copyright(c) 2001-2023 Intel Corporation
  */
 
 #ifndef _ICE_PG_CAM_H_
drivers/net/ice/base/ice_proto_grp.c +1 -1
index a9ed9e051f..94f4df0aaa 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2001-2022 Intel Corporation
+ * Copyright(c) 2001-2023 Intel Corporation
  */
 
 #include "ice_common.h"
drivers/net/ice/base/ice_proto_grp.h +1 -1
index 762d32464b..dc6d8a32a4 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2001-2022 Intel Corporation
+ * Copyright(c) 2001-2023 Intel Corporation
  */
 
 #ifndef _ICE_PROTO_GRP_H_
drivers/net/ice/base/ice_protocol_type.h +1 -1
index d17ab54bd3..eeaf044059 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2001-2022 Intel Corporation
+ * Copyright(c) 2001-2023 Intel Corporation
  */
 
 #ifndef _ICE_PROTOCOL_TYPE_H_
drivers/net/ice/base/ice_ptp_consts.h +1 -1
index ddf6242d8e..546bf8ba91 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2001-2022 Intel Corporation
+ * Copyright(c) 2001-2023 Intel Corporation
  */
 
 #ifndef _ICE_PTP_CONSTS_H_
drivers/net/ice/base/ice_ptp_hw.c +1 -1
index a0b8af1b94..548ef5e820 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2001-2022 Intel Corporation
+ * Copyright(c) 2001-2023 Intel Corporation
  */
 
 #include "ice_type.h"
drivers/net/ice/base/ice_ptp_hw.h +1 -1
index 09c236e7e0..3667c9882d 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2001-2022 Intel Corporation
+ * Copyright(c) 2001-2023 Intel Corporation
  */
 
 #ifndef _ICE_PTP_HW_H_
drivers/net/ice/base/ice_ptype_mk.c +1 -1
index 4cd8396167..6814095dbd 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2001-2022 Intel Corporation
+ * Copyright(c) 2001-2023 Intel Corporation
  */
 
 #include "ice_common.h"
drivers/net/ice/base/ice_ptype_mk.h +1 -1
index 3efe294dda..66427c6866 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2001-2022 Intel Corporation
+ * Copyright(c) 2001-2023 Intel Corporation
  */
 
 #ifndef _ICE_PTYPE_MK_H_
drivers/net/ice/base/ice_sbq_cmd.h +1 -1
index a215303a56..4da16caf70 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2001-2022 Intel Corporation
+ * Copyright(c) 2001-2023 Intel Corporation
  */
 
 #ifndef _ICE_SBQ_CMD_H_
drivers/net/ice/base/ice_sched.c +1 -1
index a526c8f32c..83cd152388 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2001-2022 Intel Corporation
+ * Copyright(c) 2001-2023 Intel Corporation
  */
 
 #include "ice_sched.h"
drivers/net/ice/base/ice_sched.h +1 -1
index 3724ef33a8..a71619ebf0 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2001-2022 Intel Corporation
+ * Copyright(c) 2001-2023 Intel Corporation
  */
 
 #ifndef _ICE_SCHED_H_
drivers/net/ice/base/ice_status.h +1 -1
index f52121c3a3..1965347a8b 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2001-2022 Intel Corporation
+ * Copyright(c) 2001-2023 Intel Corporation
  */
 
 #ifndef _ICE_STATUS_H_
drivers/net/ice/base/ice_switch.c +1 -1
index e4eed66406..cd6237136e 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2001-2022 Intel Corporation
+ * Copyright(c) 2001-2023 Intel Corporation
  */
 
 #include "ice_common.h"
drivers/net/ice/base/ice_switch.h +1 -1
index 949c94c0c3..7a12619459 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2001-2022 Intel Corporation
+ * Copyright(c) 2001-2023 Intel Corporation
  */
 
 #ifndef _ICE_SWITCH_H_
drivers/net/ice/base/ice_tmatch.h +1 -1
index e70926acd1..a2df0c4367 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2001-2022 Intel Corporation
+ * Copyright(c) 2001-2023 Intel Corporation
  */
 
 #ifndef _ICE_TMATCH_H_
drivers/net/ice/base/ice_type.h +1 -1
index bfec317b57..da813c8307 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2001-2022 Intel Corporation
+ * Copyright(c) 2001-2023 Intel Corporation
  */
 
 #ifndef _ICE_TYPE_H_
drivers/net/ice/base/ice_vlan_mode.c +1 -1
index 74d414b3b8..7ee00df124 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2001-2022 Intel Corporation
+ * Copyright(c) 2001-2023 Intel Corporation
  */
 
 #include "ice_common.h"
drivers/net/ice/base/ice_vlan_mode.h +1 -1
index 5e3f454a25..d2380eb94b 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2001-2022 Intel Corporation
+ * Copyright(c) 2001-2023 Intel Corporation
  */
 
 #ifndef _ICE_VLAN_MODE_H_
drivers/net/ice/base/ice_xlt_kb.c +1 -1
index 59472a08d4..b8240946b4 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2001-2022 Intel Corporation
+ * Copyright(c) 2001-2023 Intel Corporation
  */
 
 #include "ice_common.h"
drivers/net/ice/base/ice_xlt_kb.h +1 -1
index f870f18ed6..0cce33142a 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2001-2022 Intel Corporation
+ * Copyright(c) 2001-2023 Intel Corporation
  */
 
 #ifndef _ICE_XLT_KB_H_
Signature · 1 line
2.25.1
#35 lore raw

PATCH v2 2/20 net/ice/base: add NAC Topology device capability parser

In reply to Qiming Yang

Define and add parsing support for new device capability ICE_AQC_CAPS_NAC_TOPOLOGY.

---
 drivers/net/ice/base/ice_common.c | 26 ++++++++++++++++++++++++++
 drivers/net/ice/base/ice_type.h   | 10 ++++++++++
 2 files changed, 36 insertions(+)
drivers/net/ice/base/ice_common.c +26 -0
index fa30c50ca1..ede46820cd 100644
@@ -2807,6 +2807,29 @@ ice_parse_fdir_dev_caps(struct ice_hw *hw, struct ice_hw_dev_caps *dev_p,
 		  dev_p->num_flow_director_fltr);
 }
 
+/**
+ * ice_parse_nac_topo_dev_caps - Parse ICE_AQC_CAPS_NAC_TOPOLOGY cap
+ * @hw: pointer to the HW struct
+ * @dev_p: pointer to device capabilities structure
+ * @cap: capability element to parse
+ *
+ * Parse ICE_AQC_CAPS_NAC_TOPOLOGY for device capabilities.
+ */
+static void
+ice_parse_nac_topo_dev_caps(struct ice_hw *hw, struct ice_hw_dev_caps *dev_p,
+			    struct ice_aqc_list_caps_elem *cap)
+{
+	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_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",
+		  !!(dev_p->nac_topo.mode & ICE_NAC_TOPO_DUAL_M));
+	ice_debug(hw, ICE_DBG_INIT, "dev caps: nac topology id = %d\n",
+		  dev_p->nac_topo.id);
+}
+
 /**
  * ice_parse_dev_caps - Parse device capabilities
  * @hw: pointer to the HW struct
@@ -2852,6 +2875,9 @@ ice_parse_dev_caps(struct ice_hw *hw, struct ice_hw_dev_caps *dev_p,
 		case  ICE_AQC_CAPS_FD:
 			ice_parse_fdir_dev_caps(hw, dev_p, &cap_resp[i]);
 			break;
+		case ICE_AQC_CAPS_NAC_TOPOLOGY:
+			ice_parse_nac_topo_dev_caps(hw, dev_p, &cap_resp[i]);
+			break;
 		default:
 			/* Don't list common capabilities as unknown */
 			if (!found)
drivers/net/ice/base/ice_type.h +10 -0
index da813c8307..c653c1de3e 100644
@@ -693,6 +693,15 @@ struct ice_ts_dev_info {
 	u8 ts_ll_read : 1;
 };
 
+#define ICE_NAC_TOPO_PRIMARY_M	BIT(0)
+#define ICE_NAC_TOPO_DUAL_M	BIT(1)
+#define ICE_NAC_TOPO_ID_M	MAKEMASK(0xf, 0)
+
+struct ice_nac_topology {
+	u32 mode;
+	u8 id;
+};
+
 /* Function specific capabilities */
 struct ice_hw_func_caps {
 	struct ice_hw_common_caps common_cap;
@@ -709,6 +718,7 @@ struct ice_hw_dev_caps {
 	u32 num_flow_director_fltr;	/* Number of FD filters available */
 	struct ice_ts_dev_info ts_dev_info;
 	u32 num_funcs;
+	struct ice_nac_topology nac_topo;
 };
 
 /* Information about MAC such as address, etc... */
Signature · 1 line
2.25.1
#36 lore raw

PATCH v2 3/20 net/ice/base: add new device for E810

In reply to Qiming Yang

New subsystem ID is introduced for E810 NIC

---
 drivers/net/ice/base/ice_common.c | 1 +
 drivers/net/ice/base/ice_devids.h | 1 +
 2 files changed, 2 insertions(+)
drivers/net/ice/base/ice_common.c +1 -0
index ede46820cd..bcfd8e458d 100644
@@ -223,6 +223,7 @@ bool ice_is_e810t(struct ice_hw *hw)
 		case ICE_SUBDEV_ID_E810T3:
 		case ICE_SUBDEV_ID_E810T4:
 		case ICE_SUBDEV_ID_E810T5:
+		case ICE_SUBDEV_ID_E810T7:
 			return true;
 		}
 		break;
drivers/net/ice/base/ice_devids.h +1 -0
index f80789ebc5..83af3c3b05 100644
@@ -27,6 +27,7 @@
 #define ICE_SUBDEV_ID_E810T4		0x02EA
 #define ICE_SUBDEV_ID_E810T5		0x0010
 #define ICE_SUBDEV_ID_E810T6		0x0012
+#define ICE_SUBDEV_ID_E810T7		0x0011
 /* 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.25.1
#37 lore raw

PATCH v2 4/20 net/ice/base: fix incorrect defines for DCBx

In reply to Qiming Yang

In all cases but one, CEE mode is defined as 0x01 and IEEE mode is defined as 0x02. in past these values were swapped. This is causing the DCB information sent from the FW agent to be parsed with incorrect structures and resulting in incorrect values.

Change the defines to match what they are in the rest of the kernel.

Fixes 97e32e8d4870 ("net/ice/base: complete pending LLDP MIB")
---
 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 65cba9ab37..8df6ca41e9 100644
@@ -2002,8 +2002,8 @@ struct ice_aqc_lldp_get_mib {
 #define ICE_AQ_LLDP_DCBX_S			6
 #define ICE_AQ_LLDP_DCBX_M			(0x3 << ICE_AQ_LLDP_DCBX_S)
 #define ICE_AQ_LLDP_DCBX_NA			0
-#define ICE_AQ_LLDP_DCBX_IEEE			1
-#define ICE_AQ_LLDP_DCBX_CEE			2
+#define ICE_AQ_LLDP_DCBX_CEE			1
+#define ICE_AQ_LLDP_DCBX_IEEE			2
 /* The following bytes are reserved for the Get LLDP MIB command (0x0A00)
  * and in the LLDP MIB Change Event (0x0A01). They are valid for the
  * Get LLDP MIB (0x0A00) response only.
Signature · 1 line
2.25.1
#38 lore raw

PATCH v2 5/20 net/ice/base: introduce a non-atomic function

In reply to Qiming Yang

recipe_bitmap is not aligned to 8 bytes in ice_aqc_recipe_data_elem structure and set_bit is a atomic operation we end up with a split lock. The reason for this is that recipe_bitmap might end up being in two cache lines because it's not aligned.
Fix this by introducing non-atomic function ice_set_recipe_index to replace ice_set_bit in this specific case.

---
 drivers/net/ice/base/ice_bitops.h |  7 +++++++
 drivers/net/ice/base/ice_switch.c | 19 +++++++++++++++----
 2 files changed, 22 insertions(+), 4 deletions(-)
drivers/net/ice/base/ice_bitops.h +7 -0
index 5384e99415..df00c859ac 100644
@@ -11,6 +11,13 @@
 /* Define the size of the bitmap chunk */
 typedef u32 ice_bitmap_t;
 
+/* NOTE!
+ * Do not use any of the functions declared in this file
+ * on memory that was not declared with ice_declare_bitmap.
+ * Not following this rule might cause issues like split
+ * locks.
+ */
+
 /* Number of bits per bitmap chunk */
 #define BITS_PER_CHUNK		(BITS_PER_BYTE * sizeof(ice_bitmap_t))
 /* Determine which chunk a bit belongs in */
drivers/net/ice/base/ice_switch.c +15 -4
index cd6237136e..c71861a36d 100644
@@ -7163,6 +7163,17 @@ ice_find_free_recp_res_idx(struct ice_hw *hw, const ice_bitmap_t *profiles,
 	return (u16)ice_bitmap_hweight(free_idx, ICE_MAX_FV_WORDS);
 }
 
+static void ice_set_recipe_index(unsigned long idx, u8 *bitmap)
+{
+	u32 byte = idx / BITS_PER_BYTE;
+	u32 bit = idx % BITS_PER_BYTE;
+
+	if (byte >= 8)
+		return;
+
+	bitmap[byte] |= 1 << bit;
+}
+
 /**
  * ice_add_sw_recipe - function to call AQ calls to create switch recipe
  * @hw: pointer to hardware structure
@@ -7290,10 +7301,10 @@ ice_add_sw_recipe(struct ice_hw *hw, struct ice_sw_recipe *rm,
 		}
 
 		/* fill recipe dependencies */
-		ice_zero_bitmap((ice_bitmap_t *)buf[recps].recipe_bitmap,
-				ICE_MAX_NUM_RECIPES);
-		ice_set_bit(buf[recps].recipe_indx,
-			    (ice_bitmap_t *)buf[recps].recipe_bitmap);
+		ice_memset(buf[recps].recipe_bitmap, 0,
+			   sizeof(buf[recps].recipe_bitmap), ICE_NONDMA_MEM);
+		ice_set_recipe_index(buf[recps].recipe_indx,
+				     buf[recps].recipe_bitmap);
 		buf[recps].content.act_ctrl_fwd_priority = rm->priority;
 		recps++;
 	}
Signature · 1 line
2.25.1
#39 lore raw

PATCH v2 6/20 net/ice/base: add missing AQ flag to AQ command

In reply to Qiming Yang

The RD flag needs to be set when virtual port rules are added since the FW needs to read the additional buffer with the mirror rule parameters.

---
 drivers/net/ice/base/ice_switch.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/net/ice/base/ice_switch.c +2 -0
index c71861a36d..f201c287fc 100644
@@ -3134,6 +3134,8 @@ ice_aq_add_update_mir_rule(struct ice_hw *hw, u16 rule_type, u16 dest_vsi,
 			else /* remove VSI from mirror rule */
 				mr_list[i] = CPU_TO_LE16(id);
 		}
+
+		desc.flags |= CPU_TO_LE16(ICE_AQ_FLAG_RD);
 	}
 
 	cmd = &desc.params.add_update_rule;
Signature · 1 line
2.25.1
#40 lore raw

PATCH v2 7/20 net/ice/base: add support for inner etype in switchdev

In reply to Qiming Yang

Enable support for adding TC rules that filter on the inner EtherType field of tunneled packet headers.

---
 drivers/net/ice/base/ice_protocol_type.h |   2 +
 drivers/net/ice/base/ice_switch.c        | 270 ++++++++++++++++++++++-
 2 files changed, 268 insertions(+), 4 deletions(-)
drivers/net/ice/base/ice_protocol_type.h +2 -0
index eeaf044059..8c57cd2081 100644
@@ -31,6 +31,7 @@ enum ice_protocol_type {
 	ICE_MAC_OFOS = 0,
 	ICE_MAC_IL,
 	ICE_ETYPE_OL,
+	ICE_ETYPE_IL,
 	ICE_VLAN_OFOS,
 	ICE_IPV4_OFOS,
 	ICE_IPV4_IL,
@@ -197,6 +198,7 @@ enum ice_prot_id {
 #define ICE_MAC_OFOS_HW		1
 #define ICE_MAC_IL_HW		4
 #define ICE_ETYPE_OL_HW		9
+#define ICE_ETYPE_IL_HW		10
 #define ICE_VLAN_OF_HW		16
 #define ICE_VLAN_OL_HW		17
 #define ICE_IPV4_OFOS_HW	32
drivers/net/ice/base/ice_switch.c +266 -4

366 lines not on this page · raw message

Signature · 1 line
2.25.1
#41 lore raw

PATCH v2 8/20 net/ice/base: add support for PPPoE hardware offload

In reply to Qiming Yang

Add support for creating PPPoE filters in switchdev mode. Add support for parsing PPPoE and PPP-specific tc options: pppoe_sid and ppp_proto.

---
 drivers/net/ice/base/ice_bitops.h |  2 +-
 drivers/net/ice/base/ice_ddp.c    |  4 ++-
 drivers/net/ice/base/ice_switch.c | 46 +++++++++++++++++++++++--------
 3 files changed, 38 insertions(+), 14 deletions(-)
drivers/net/ice/base/ice_bitops.h +1 -1
index df00c859ac..3b71c1b7f5 100644
@@ -433,7 +433,7 @@ ice_bitmap_hweight(ice_bitmap_t *bm, u16 size)
 }
 
 /**
- * ice_cmp_bitmaps - 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_ddp.c +3 -1
index 93ff2608d4..3e18f2bc70 100644
@@ -1623,8 +1623,10 @@ ice_get_sw_fv_list(struct ice_hw *hw, struct ice_prot_lkup_ext *lkups,
 			}
 		}
 	} while (fv);
-	if (LIST_EMPTY(fv_list))
+	if (LIST_EMPTY(fv_list)) {
+		ice_warn(hw, "Required profiles not found in currently loaded DDP package");
 		return ICE_ERR_CFG;
+	}
 	return ICE_SUCCESS;
 
 err:
drivers/net/ice/base/ice_switch.c +34 -12

112 lines not on this page · raw message

Signature · 1 line
2.25.1
#42 lore raw

PATCH v2 9/20 net/ice/base: remove direction metadata for switchdev

In reply to Qiming Yang

ICE_SW_TUN_AND_NON_TUN tunnel type is used by switchdev for default MAC rules. Currently a "special word" is added to recipes for such tunnels, specifying that rule should work only in ingress direction. Because of this, all egress traffic from VF is being dropped.

To fix that, add a field add_dir_lkup to ice_adv_rule_info struct (will be set in CORE before calling ice_add_adv_rule()).

---
 drivers/net/ice/base/ice_switch.c | 20 +++++++++++++-------
 drivers/net/ice/base/ice_switch.h |  1 +
 2 files changed, 14 insertions(+), 7 deletions(-)
drivers/net/ice/base/ice_switch.c +13 -7
index e290a845bc..c5951b5d40 100644
@@ -7754,13 +7754,14 @@ ice_get_fv(struct ice_hw *hw, struct ice_prot_lkup_ext *lkups,
 
 /**
  * ice_tun_type_match_word - determine if tun type needs a match mask
- * @tun_type: tunnel type
+ * @rinfo: other information regarding the rule e.g. priority and action info
  * @off: offset of packet flag
  * @mask: mask to be used for the tunnel
  */
-static bool ice_tun_type_match_word(enum ice_sw_tunnel_type tun_type, u16 *off, u16 *mask)
+static bool
+ice_tun_type_match_word(struct ice_adv_rule_info *rinfo, u16 *off, u16 *mask)
 {
-	switch (tun_type) {
+	switch (rinfo->tun_type) {
 	case ICE_SW_TUN_VXLAN_GPE:
 	case ICE_SW_TUN_GENEVE:
 	case ICE_SW_TUN_VXLAN:
@@ -7778,9 +7779,14 @@ static bool ice_tun_type_match_word(enum ice_sw_tunnel_type tun_type, u16 *off,
 		return true;
 
 	case ICE_SW_TUN_AND_NON_TUN:
-		*mask = ICE_DIR_FLAG_MASK;
-		*off = ICE_TUN_FLAG_MDID_OFF(0);
-		return true;
+		if (rinfo->add_dir_lkup) {
+			*mask = ICE_DIR_FLAG_MASK;
+			*off = ICE_TUN_FLAG_MDID_OFF(0);
+			return true;
+		}
+		*mask = 0;
+		*off = 0;
+		return false;
 
 	case ICE_SW_TUN_GENEVE_VLAN:
 	case ICE_SW_TUN_VXLAN_VLAN:
@@ -7811,7 +7817,7 @@ ice_add_special_words(struct ice_adv_rule_info *rinfo,
 	 * 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.
 	 */
-	if (ice_tun_type_match_word(rinfo->tun_type, &off, &mask)) {
+	if (ice_tun_type_match_word(rinfo, &off, &mask)) {
 		if (lkup_exts->n_val_words < ICE_MAX_CHAIN_WORDS) {
 			u8 word = lkup_exts->n_val_words++;
 
drivers/net/ice/base/ice_switch.h +1 -0
index 7a12619459..7421e02466 100644
@@ -311,6 +311,7 @@ struct ice_adv_rule_info {
 	struct ice_sw_act_ctrl sw_act;
 	u32 priority;
 	u8 rx; /* true means LOOKUP_RX otherwise LOOKUP_TX */
+	u8 add_dir_lkup;
 	u16 fltr_rule_id;
 	u16 lg_id;
 	struct ice_adv_rule_flags_info flags_info;
Signature · 1 line
2.25.1
#43 lore raw

PATCH v2 10/20 net/ice/base: reduce time to read Option data

In reply to Qiming Yang

Re-write ice_get_orom_civd_data to allocate memory to store the Option ROM data. This change significantly reduces the time to read the Option ROM CIVD section from ~10 seconds down to ~1 second.

---
 drivers/net/ice/base/ice_nvm.c | 50 +++++++++++++++++++++++++---------
 1 file changed, 37 insertions(+), 13 deletions(-)
drivers/net/ice/base/ice_nvm.c +37 -13
index cb45cb8134..e46aded12a 100644
@@ -724,43 +724,67 @@ static enum ice_status
 ice_get_orom_civd_data(struct ice_hw *hw, enum ice_bank_select bank,
 		       struct ice_orom_civd_info *civd)
 {
-	struct ice_orom_civd_info tmp;
+	u8 *orom_data;
+	enum ice_status status;
 	u32 offset;
 
 	/* The CIVD section is located in the Option ROM aligned to 512 bytes.
 	 * The first 4 bytes must contain the ASCII characters "$CIV".
 	 * A simple modulo 256 sum of all of the bytes of the structure must
 	 * equal 0.
+	 *
+	 * The exact location is unknown and varies between images but is
+	 * usually somewhere in the middle of the bank. We need to scan the
+	 * Option ROM bank to locate it.
+	 *
+	 * It's significantly faster to read the entire Option ROM up front
+	 * using the maximum page size, than to read each possible location
+	 * with a separate firmware command.
 	 */
+	orom_data = (u8 *)ice_calloc(hw, hw->flash.banks.orom_size, sizeof(u8));
+	if (!orom_data)
+		return ICE_ERR_NO_MEMORY;
+
+	status = ice_read_flash_module(hw, bank, ICE_SR_1ST_OROM_BANK_PTR, 0,
+				       orom_data, hw->flash.banks.orom_size);
+	if (status) {
+		ice_debug(hw, ICE_DBG_NVM, "Unable to read Option ROM data\n");
+		return status;
+	}
+
+	/* Scan the memory buffer to locate the CIVD data section */
 	for (offset = 0; (offset + 512) <= hw->flash.banks.orom_size; offset += 512) {
-		enum ice_status status;
+		struct ice_orom_civd_info *tmp;
 		u8 sum = 0, i;
 
-		status = ice_read_flash_module(hw, bank, ICE_SR_1ST_OROM_BANK_PTR,
-					       offset, (u8 *)&tmp, sizeof(tmp));
-		if (status) {
-			ice_debug(hw, ICE_DBG_NVM, "Unable to read Option ROM CIVD data\n");
-			return status;
-		}
+		tmp = (struct ice_orom_civd_info *)&orom_data[offset];
 
 		/* Skip forward until we find a matching signature */
-		if (memcmp("$CIV", tmp.signature, sizeof(tmp.signature)) != 0)
+		if (memcmp("$CIV", tmp->signature, sizeof(tmp->signature)) != 0)
 			continue;
 
+		ice_debug(hw, ICE_DBG_NVM, "Found CIVD section at offset %u\n",
+			  offset);
+
 		/* Verify that the simple checksum is zero */
-		for (i = 0; i < sizeof(tmp); i++)
-			sum += ((u8 *)&tmp)[i];
+		for (i = 0; i < sizeof(*tmp); i++)
+			sum += ((u8 *)tmp)[i];
 
 		if (sum) {
 			ice_debug(hw, ICE_DBG_NVM, "Found CIVD data with invalid checksum of %u\n",
 				  sum);
-			return ICE_ERR_NVM;
+			goto err_invalid_checksum;
 		}
 
-		*civd = tmp;
+		*civd = *tmp;
+		ice_free(hw, orom_data);
 		return ICE_SUCCESS;
 	}
 
+	ice_debug(hw, ICE_DBG_NVM, "Unable to locate CIVD data within the Option ROM\n");
+
+err_invalid_checksum:
+	ice_free(hw, orom_data);
 	return ICE_ERR_NVM;
 }
 
Signature · 1 line
2.25.1
#44 lore raw

RE: [PATCH v2 10/20] net/ice/base: reduce time to read Option data

Quoted 10 lines

-----Original Message-----
From: Yang, Qiming <[email protected]>
Sent: Thursday, May 18, 2023 8:16 AM
To: [email protected]
Cc: Zhang, Qi Z <[email protected]>; Yang, Qiming <[email protected]>; Keller, Jacob E <[email protected]>
Subject: [PATCH v2 10/20] net/ice/base: reduce time to read Option data

Quoted 7 lines

Re-write ice_get_orom_civd_data to allocate memory to store the Option ROM data. This change significantly reduces the time to read the Option ROM CIVD section from ~10 seconds down to ~1 second.

---

ACK.

Thanks,
Jake

#45 lore raw

PATCH v2 11/20 net/ice/base: add support for VLAN TPID filters

In reply to Qiming Yang

Enable support for adding TC rules that filter on the VLAN tag type in switchdev mode.

---
 drivers/net/ice/base/ice_protocol_type.h |  6 ++-
 drivers/net/ice/base/ice_switch.c        | 59 ++++++++++++++++++++++--
 drivers/net/ice/base/ice_switch.h        |  1 +
 drivers/net/ice/base/ice_vlan_mode.c     |  1 -
 4 files changed, 62 insertions(+), 5 deletions(-)
drivers/net/ice/base/ice_protocol_type.h +5 -1
index 8c57cd2081..05a89050fe 100644
@@ -219,7 +219,7 @@ enum ice_prot_id {
  */
 #define ICE_UDP_OF_HW	52 /* UDP Tunnels */
 #define ICE_GRE_OF_HW	64 /* NVGRE */
-#define ICE_META_DATA_ID_HW 255 /* this is used for tunnel type */
+#define ICE_META_DATA_ID_HW 255 /* this is used for tunnel and VLAN type */
 
 #define ICE_MDID_SIZE 2
 #define ICE_TUN_FLAG_MDID 20
@@ -229,6 +229,10 @@ enum ice_prot_id {
 #define ICE_TUN_FLAG_VLAN_MASK 0x01
 #define ICE_TUN_FLAG_FV_IND 2
 
+#define ICE_VLAN_FLAG_MDID 20
+#define ICE_VLAN_FLAG_MDID_OFF (ICE_MDID_SIZE * ICE_VLAN_FLAG_MDID)
+#define ICE_PKT_FLAGS_0_TO_15_VLAN_FLAGS_MASK 0xD000
+
 #define ICE_PROTOCOL_MAX_ENTRIES 16
 
 /* Mapping of software defined protocol ID to hardware defined protocol ID */
drivers/net/ice/base/ice_switch.c +56 -3

104 lines not on this page · raw message

drivers/net/ice/base/ice_switch.h +1 -0
index 7421e02466..7a6944893d 100644
@@ -314,6 +314,7 @@ struct ice_adv_rule_info {
 	u8 add_dir_lkup;
 	u16 fltr_rule_id;
 	u16 lg_id;
+	u16 vlan_type;
 	struct ice_adv_rule_flags_info flags_info;
 };
 
drivers/net/ice/base/ice_vlan_mode.c +0 -1
index 7ee00df124..33759e4b8a 100644
@@ -201,7 +201,6 @@ static bool ice_is_dvm_supported(struct ice_hw *hw)
 #define ICE_SW_LKUP_VLAN_PKT_FLAGS_LKUP_IDX		2
 #define ICE_SW_LKUP_PROMISC_VLAN_LOC_LKUP_IDX		2
 #define ICE_PKT_FLAGS_0_TO_15_FV_IDX			1
-#define ICE_PKT_FLAGS_0_TO_15_VLAN_FLAGS_MASK		0xD000
 static struct ice_update_recipe_lkup_idx_params ice_dvm_dflt_recipes[] = {
 	{
 		/* Update recipe ICE_SW_LKUP_VLAN to filter based on the
Signature · 1 line
2.25.1
#46 lore raw

PATCH v2 12/20 net/ice/base: add C825-X device ID

In reply to Qiming Yang

Add the device ID for the Intel(R) Ethernet Connection C825-X.

---
 drivers/net/ice/base/ice_common.c | 6 +++---
 drivers/net/ice/base/ice_devids.h | 7 ++-----
 drivers/net/ice/base/ice_type.h   | 1 +
 drivers/net/ice/ice_ethdev.c      | 4 ++--
 4 files changed, 8 insertions(+), 10 deletions(-)
drivers/net/ice/base/ice_common.c +3 -3
index bcfd8e458d..a958ecef83 100644
@@ -171,9 +171,9 @@ static enum ice_status ice_set_mac_type(struct ice_hw *hw)
 	case ICE_DEV_ID_E825C_BACKPLANE:
 	case ICE_DEV_ID_E825C_QSFP:
 	case ICE_DEV_ID_E825C_SFP:
-	case ICE_DEV_ID_E825C_1GBE:
-	case ICE_DEV_ID_E825X:
-		hw->mac_type = ICE_MAC_GENERIC;
+	case ICE_DEV_ID_C825X:
+	case ICE_DEV_ID_E825C_SGMII:
+		hw->mac_type = ICE_MAC_GENERIC_3K_E825;
 		break;
 	default:
 		hw->mac_type = ICE_MAC_UNKNOWN;
drivers/net/ice/base/ice_devids.h +2 -5
index 83af3c3b05..19478d2db1 100644
@@ -73,9 +73,6 @@
 /* Intel(R) Ethernet Connection E825-C for SFP */
 #define ICE_DEV_ID_E825C_SFP	        0x579E
 /* Intel(R) Ethernet Connection E825-C 1GbE */
-#define ICE_DEV_ID_E825C_1GBE	        0x579F
-/* Intel(R) Ethernet Connection E825-X */
-#define ICE_DEV_ID_E825X	        0x0DCD
-
-
+#define ICE_DEV_ID_E825C_SGMII		0x579F
+#define ICE_DEV_ID_C825X		0x0DCD
 #endif /* _ICE_DEVIDS_H_ */
drivers/net/ice/base/ice_type.h +1 -0
index c653c1de3e..d13105070b 100644
@@ -206,6 +206,7 @@ enum ice_mac_type {
 	ICE_MAC_E810,
 	ICE_MAC_GENERIC,
 	ICE_MAC_GENERIC_3K,
+	ICE_MAC_GENERIC_3K_E825,
 };
 
 /* Media Types */
drivers/net/ice/ice_ethdev.c +2 -2
index 9a88cf9796..a696e70d91 100644
@@ -196,8 +196,8 @@ static const struct rte_pci_id pci_id_ice_map[] = {
 	{ RTE_PCI_DEVICE(ICE_INTEL_VENDOR_ID, ICE_DEV_ID_E825C_BACKPLANE) },
 	{ RTE_PCI_DEVICE(ICE_INTEL_VENDOR_ID, ICE_DEV_ID_E825C_QSFP) },
 	{ RTE_PCI_DEVICE(ICE_INTEL_VENDOR_ID, ICE_DEV_ID_E825C_SFP) },
-	{ RTE_PCI_DEVICE(ICE_INTEL_VENDOR_ID, ICE_DEV_ID_E825C_1GBE) },
-	{ RTE_PCI_DEVICE(ICE_INTEL_VENDOR_ID, ICE_DEV_ID_E825X) },
+	{ RTE_PCI_DEVICE(ICE_INTEL_VENDOR_ID, ICE_DEV_ID_C825X) },
+	{ RTE_PCI_DEVICE(ICE_INTEL_VENDOR_ID, ICE_DEV_ID_E825C_SGMII ) },
 	{ .vendor_id = 0, /* sentinel */ },
 };
 
Signature · 1 line
2.25.1
#47 lore raw

PATCH v2 13/20 net/ice/base: add function to get rxq context

In reply to Qiming Yang

This patch exports rxq context which is consumed by linux live migration driver to save device state.

---
 drivers/net/ice/base/ice_common.c | 67 ++++++++++++++++++++++++++++---
 drivers/net/ice/base/ice_common.h |  7 +++-
 2 files changed, 67 insertions(+), 7 deletions(-)
drivers/net/ice/base/ice_common.c +62 -5
index a958ecef83..9992d0ad4d 100644
@@ -1381,6 +1381,37 @@ ice_copy_rxq_ctx_to_hw(struct ice_hw *hw, u8 *ice_rxq_ctx, u32 rxq_index)
 	return ICE_SUCCESS;
 }
 
+/**
+ * ice_copy_rxq_ctx_from_hw - Copy rxq context register from HW
+ * @hw: pointer to the hardware structure
+ * @ice_rxq_ctx: pointer to the rxq context
+ * @rxq_index: the index of the Rx queue
+ *
+ * Copies rxq context from HW register space to dense structure
+ */
+static enum ice_status
+ice_copy_rxq_ctx_from_hw(struct ice_hw *hw, u8 *ice_rxq_ctx, u32 rxq_index)
+{
+	u8 i;
+
+	if (!ice_rxq_ctx)
+		return ICE_ERR_BAD_PTR;
+
+	if (rxq_index > QRX_CTRL_MAX_INDEX)
+		return ICE_ERR_PARAM;
+
+	/* Copy each dword separately from HW */
+	for (i = 0; i < ICE_RXQ_CTX_SIZE_DWORDS; i++) {
+		u32 *ctx = (u32 *)(ice_rxq_ctx + (i * sizeof(u32)));
+
+		*ctx = rd32(hw, QRX_CONTEXT(i, rxq_index));
+
+		ice_debug(hw, ICE_DBG_QCTX, "qrxdata[%d]: %08X\n", i, *ctx);
+	}
+
+	return ICE_SUCCESS;
+}
+
 /* LAN Rx Queue Context */
 static const struct ice_ctx_ele ice_rlan_ctx_info[] = {
 	/* Field		Width	LSB */
@@ -1432,6 +1463,32 @@ ice_write_rxq_ctx(struct ice_hw *hw, struct ice_rlan_ctx *rlan_ctx,
 	return ice_copy_rxq_ctx_to_hw(hw, ctx_buf, rxq_index);
 }
 
+/**
+ * ice_read_rxq_ctx - Read rxq context from HW
+ * @hw: pointer to the hardware structure
+ * @rlan_ctx: pointer to the rxq context
+ * @rxq_index: the index of the Rx queue
+ *
+ * Read rxq context from HW register space and then converts it from dense
+ * structure to sparse
+ */
+enum ice_status
+ice_read_rxq_ctx(struct ice_hw *hw, struct ice_rlan_ctx *rlan_ctx,
+		 u32 rxq_index)
+{
+	u8 ctx_buf[ICE_RXQ_CTX_SZ] = { 0 };
+	enum ice_status status;
+
+	if (!rlan_ctx)
+		return ICE_ERR_BAD_PTR;
+
+	status = ice_copy_rxq_ctx_from_hw(hw, ctx_buf, rxq_index);
+	if (status)
+		return status;
+
+	return ice_get_ctx(ctx_buf, (u8 *)rlan_ctx, ice_rlan_ctx_info);
+}
+
 /**
  * ice_clear_rxq_ctx
  * @hw: pointer to the hardware structure
@@ -4824,7 +4881,7 @@ ice_aq_get_internal_data(struct ice_hw *hw, u8 cluster_id, u16 table_id,
  * @ce_info:  a description of the struct to be filled
  */
 static void
-ice_read_byte(u8 *src_ctx, u8 *dest_ctx, struct ice_ctx_ele *ce_info)
+ice_read_byte(u8 *src_ctx, u8 *dest_ctx, const struct ice_ctx_ele *ce_info)
 {
 	u8 dest_byte, mask;
 	u8 *src, *target;
@@ -4860,7 +4917,7 @@ ice_read_byte(u8 *src_ctx, u8 *dest_ctx, struct ice_ctx_ele *ce_info)
  * @ce_info:  a description of the struct to be filled
  */
 static void
-ice_read_word(u8 *src_ctx, u8 *dest_ctx, struct ice_ctx_ele *ce_info)
+ice_read_word(u8 *src_ctx, u8 *dest_ctx, const struct ice_ctx_ele *ce_info)
 {
 	u16 dest_word, mask;
 	u8 *src, *target;
@@ -4903,7 +4960,7 @@ ice_read_word(u8 *src_ctx, u8 *dest_ctx, struct ice_ctx_ele *ce_info)
  * @ce_info:  a description of the struct to be filled
  */
 static void
-ice_read_dword(u8 *src_ctx, u8 *dest_ctx, struct ice_ctx_ele *ce_info)
+ice_read_dword(u8 *src_ctx, u8 *dest_ctx, const struct ice_ctx_ele *ce_info)
 {
 	u32 dest_dword, mask;
 	__le32 src_dword;
@@ -4954,7 +5011,7 @@ ice_read_dword(u8 *src_ctx, u8 *dest_ctx, struct ice_ctx_ele *ce_info)
  * @ce_info:  a description of the struct to be filled
  */
 static void
-ice_read_qword(u8 *src_ctx, u8 *dest_ctx, struct ice_ctx_ele *ce_info)
+ice_read_qword(u8 *src_ctx, u8 *dest_ctx, const struct ice_ctx_ele *ce_info)
 {
 	u64 dest_qword, mask;
 	__le64 src_qword;
@@ -5005,7 +5062,7 @@ ice_read_qword(u8 *src_ctx, u8 *dest_ctx, struct ice_ctx_ele *ce_info)
  * @ce_info:  a description of the structure to be read from
  */
 enum ice_status
-ice_get_ctx(u8 *src_ctx, u8 *dest_ctx, struct ice_ctx_ele *ce_info)
+ice_get_ctx(u8 *src_ctx, u8 *dest_ctx, const struct ice_ctx_ele *ce_info)
 {
 	int f;
 
drivers/net/ice/base/ice_common.h +5 -2
index e1febfb0c4..aff361e5aa 100644
@@ -86,6 +86,9 @@ ice_aq_get_internal_data(struct ice_hw *hw, u8 cluster_id, u16 table_id,
 enum ice_status
 ice_write_rxq_ctx(struct ice_hw *hw, struct ice_rlan_ctx *rlan_ctx,
 		  u32 rxq_index);
+enum ice_status
+ice_read_rxq_ctx(struct ice_hw *hw, struct ice_rlan_ctx *rlan_ctx,
+		 u32 rxq_index);
 enum ice_status ice_clear_rxq_ctx(struct ice_hw *hw, u32 rxq_index);
 enum ice_status
 ice_clear_tx_cmpltnq_ctx(struct ice_hw *hw, u32 tx_cmpltnq_index);
@@ -128,6 +131,8 @@ extern const struct ice_ctx_ele ice_tlan_ctx_info[];
 enum ice_status
 ice_set_ctx(struct ice_hw *hw, u8 *src_ctx, u8 *dest_ctx,
 	    const struct ice_ctx_ele *ce_info);
+enum ice_status
+ice_get_ctx(u8 *src_ctx, u8 *dest_ctx, const struct ice_ctx_ele *ce_info);
 
 enum ice_status
 ice_aq_send_cmd(struct ice_hw *hw, struct ice_aq_desc *desc,
@@ -221,8 +226,6 @@ ice_aq_read_topo_dev_nvm(struct ice_hw *hw,
 			 u32 start_address, u8 *buf, u8 buf_size,
 			 struct ice_sq_cd *cd);
 
-enum ice_status
-ice_get_ctx(u8 *src_ctx, u8 *dest_ctx, struct ice_ctx_ele *ce_info);
 enum ice_status
 ice_dis_vsi_txq(struct ice_port_info *pi, u16 vsi_handle, u8 tc, u8 num_queues,
 		u16 *q_handle, u16 *q_ids, u32 *q_teids,
Signature · 1 line
2.25.1
#48 lore raw

PATCH v2 14/20 net/ice/base: modify tunnel match mask

In reply to Qiming Yang

Tunneled packets with VLAN inside were not detected by filter. This patch fix it by modifying tunnel flag match mask. As a result both type of packets (tunneled VLAN, tunneled non-VLAN) will be detected by filter.

---
 drivers/net/ice/base/ice_common.c        | 4 +++-
 drivers/net/ice/base/ice_protocol_type.h | 1 +
 drivers/net/ice/base/ice_switch.c        | 3 ++-
 3 files changed, 6 insertions(+), 2 deletions(-)
drivers/net/ice/base/ice_common.c +3 -1
index 9992d0ad4d..67203cb932 100644
@@ -1510,7 +1510,9 @@ enum ice_status ice_clear_rxq_ctx(struct ice_hw *hw, u32 rxq_index)
 	return ICE_SUCCESS;
 }
 
-/* LAN Tx Queue Context */
+/* LAN Tx Queue Context used for set Tx config by ice_aqc_opc_add_txqs,
+ * Bit[0-175] is valid
+ */
 const struct ice_ctx_ele ice_tlan_ctx_info[] = {
 				    /* Field			Width	LSB */
 	ICE_CTX_STORE(ice_tlan_ctx, base,			57,	0),
drivers/net/ice/base/ice_protocol_type.h +1 -0
index 05a89050fe..d2d3f75fc2 100644
@@ -226,6 +226,7 @@ enum ice_prot_id {
 #define ICE_TUN_FLAG_MDID_OFF(word)   (ICE_MDID_SIZE * (ICE_TUN_FLAG_MDID + (word)))
 #define ICE_TUN_FLAG_MASK 0xFF
 #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
 #define ICE_TUN_FLAG_FV_IND 2
 
drivers/net/ice/base/ice_switch.c +2 -1
index c86d68d543..06665a29db 100644
@@ -7790,7 +7790,8 @@ ice_tun_type_match_word(struct ice_adv_rule_info *rinfo, u16 *off, u16 *mask)
 
 	case ICE_SW_TUN_GENEVE_VLAN:
 	case ICE_SW_TUN_VXLAN_VLAN:
-		*mask = ICE_TUN_FLAG_MASK & ~ICE_TUN_FLAG_VLAN_MASK;
+		*mask = ICE_TUN_FLAG_MASK & ~(ICE_TUN_FLAG_VLAN_MASK |
+			ICE_TUN_FLAG_IN_VLAN_MASK);
 		*off = ICE_TUN_FLAG_MDID_OFF(1);
 		return true;
 
Signature · 1 line
2.25.1
#49 lore raw

PATCH v2 15/20 net/ice/base: check VSIG before disassociating VSI

In reply to Qiming Yang

Add checking if the VSIG group exists when iterating through all flow profiles and disassociating them from the VSI.

---
 drivers/net/ice/base/ice_flow.c | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)
drivers/net/ice/base/ice_flow.c +12 -1
index 5254ee27ed..7f1490de50 100644
@@ -3856,6 +3856,7 @@ enum ice_status ice_rem_vsi_rss_cfg(struct ice_hw *hw, u16 vsi_handle)
 	const enum ice_block blk = ICE_BLK_RSS;
 	struct ice_flow_prof *p, *t;
 	enum ice_status status = ICE_SUCCESS;
+	u16 vsig;
 
 	if (!ice_is_vsi_valid(hw, vsi_handle))
 		return ICE_ERR_PARAM;
@@ -3865,7 +3866,16 @@ enum ice_status ice_rem_vsi_rss_cfg(struct ice_hw *hw, u16 vsi_handle)
 
 	ice_acquire_lock(&hw->rss_locks);
 	LIST_FOR_EACH_ENTRY_SAFE(p, t, &hw->fl_profs[blk], ice_flow_prof,
-				 l_entry)
+				 l_entry) {
+		int ret;
+
+		/* check if vsig is already removed */
+		ret = ice_vsig_find_vsi(hw, blk,
+					ice_get_hw_vsi_num(hw, vsi_handle),
+					&vsig);
+		if (!ret && !vsig)
+			break;
+
 		if (ice_is_bit_set(p->vsis, vsi_handle)) {
 			status = ice_flow_disassoc_prof(hw, blk, p, vsi_handle);
 			if (status)
@@ -3877,6 +3887,7 @@ enum ice_status ice_rem_vsi_rss_cfg(struct ice_hw *hw, u16 vsi_handle)
 					break;
 			}
 		}
+	}
 	ice_release_lock(&hw->rss_locks);
 
 	return status;
Signature · 1 line
2.25.1
#50 lore raw

PATCH v2 16/20 net/ice/base: delete get field vector function

In reply to Qiming Yang

Currently ice_get_fv() is only used inside ice_get_sw_fv_list(). Remove ice_get_fv() and call ice_get_sw_fv_list() directly.

---
 drivers/net/ice/base/ice_ddp.c    |  3 +++
 drivers/net/ice/base/ice_switch.c | 23 ++---------------------
 2 files changed, 5 insertions(+), 21 deletions(-)
drivers/net/ice/base/ice_ddp.c +3 -0
index 3e18f2bc70..d88c417faf 100644
@@ -1579,6 +1579,9 @@ ice_get_sw_fv_list(struct ice_hw *hw, struct ice_prot_lkup_ext *lkups,
 	struct ice_fv *fv;
 	u32 offset;
 
+	if (!lkups->n_val_words)
+		return ICE_SUCCESS;
+
 	ice_memset(&state, 0, sizeof(state), ICE_NONDMA_MEM);
 
 	if (!lkups->n_val_words || !hw->seg)
drivers/net/ice/base/ice_switch.c +2 -21
index 06665a29db..1f391002b8 100644
@@ -7733,25 +7733,6 @@ ice_create_recipe_group(struct ice_hw *hw, struct ice_sw_recipe *rm,
 	return status;
 }
 
-/**
- * ice_get_fv - get field vectors/extraction sequences for spec. lookup types
- * @hw: pointer to hardware structure
- * @lkups: lookup elements or match criteria for the advanced recipe, one
- *	   structure per protocol header
- * @bm: bitmap of field vectors to consider
- * @fv_list: pointer to a list that holds the returned field vectors
- */
-static enum ice_status
-ice_get_fv(struct ice_hw *hw, struct ice_prot_lkup_ext *lkups,
-	   ice_bitmap_t *bm, struct LIST_HEAD_TYPE *fv_list)
-{
-	if (!lkups->n_val_words)
-		return ICE_SUCCESS;
-
-	/* Find field vectors that include all specified protocol types */
-	return ice_get_sw_fv_list(hw, lkups, bm, fv_list);
-}
-
 /**
  * ice_tun_type_match_word - determine if tun type needs a match mask
  * @rinfo: other information regarding the rule e.g. priority and action info
@@ -8159,11 +8140,11 @@ ice_add_adv_recipe(struct ice_hw *hw, struct ice_adv_lkup_elem *lkups,
 
 	/* Get bitmap of field vectors (profiles) that are compatible with the
 	 * rule request; only these will be searched in the subsequent call to
-	 * ice_get_fv.
+	 * ice_get_sw_fv_list.
 	 */
 	ice_get_compat_fv_bitmap(hw, rinfo, fv_bitmap);
 
-	status = ice_get_fv(hw, lkup_exts, fv_bitmap, &rm->fv_list);
+	status = ice_get_sw_fv_list(hw, lkup_exts, fv_bitmap, &rm->fv_list);
 	if (status)
 		goto err_unroll;
 
Signature · 1 line
2.25.1
#51 lore raw

PATCH v2 17/20 net/ice/base: update 3k-sign DDP support for E825C

In reply to Qiming Yang

The original DDP specification has been changed in terms of Signature Type ID definition for E825-C.

---
 drivers/net/ice/base/ice_common.c | 3 ++-
 drivers/net/ice/base/ice_ddp.c    | 4 ++++
 drivers/net/ice/base/ice_ddp.h    | 1 +
 3 files changed, 7 insertions(+), 1 deletion(-)
drivers/net/ice/base/ice_common.c +2 -1
index 67203cb932..f253e2f213 100644
@@ -193,7 +193,8 @@ static enum ice_status ice_set_mac_type(struct ice_hw *hw)
 bool ice_is_generic_mac(struct ice_hw *hw)
 {
 	return (hw->mac_type == ICE_MAC_GENERIC ||
-		hw->mac_type == ICE_MAC_GENERIC_3K);
+		hw->mac_type == ICE_MAC_GENERIC_3K ||
+		hw->mac_type == ICE_MAC_GENERIC_3K_E825);
 }
 
 /**
drivers/net/ice/base/ice_ddp.c +4 -0
index d88c417faf..ffcd5a9394 100644
@@ -441,6 +441,7 @@ static u32 ice_get_pkg_segment_id(enum ice_mac_type mac_type)
 	switch (mac_type) {
 	case ICE_MAC_GENERIC:
 	case ICE_MAC_GENERIC_3K:
+	case ICE_MAC_GENERIC_3K_E825:
 	default:
 		seg_id = SEGMENT_TYPE_ICE_E810;
 		break;
@@ -461,6 +462,9 @@ static u32 ice_get_pkg_sign_type(enum ice_mac_type mac_type)
 	case ICE_MAC_GENERIC_3K:
 		sign_type = SEGMENT_SIGN_TYPE_RSA3K;
 		break;
+	case ICE_MAC_GENERIC_3K_E825:
+		sign_type = SEGMENT_SIGN_TYPE_RSA3K_E825;
+		break;
 	case ICE_MAC_GENERIC:
 	default:
 		sign_type = SEGMENT_SIGN_TYPE_RSA2K;
drivers/net/ice/base/ice_ddp.h +1 -0
index 4896e85b91..1e02adf0db 100644
@@ -99,6 +99,7 @@ struct ice_pkg_hdr {
 #define SEGMENT_SIGN_TYPE_RSA2K		0x00000001
 #define SEGMENT_SIGN_TYPE_RSA3K		0x00000002
 #define SEGMENT_SIGN_TYPE_RSA3K_SBB	0x00000003 /* Secure Boot Block */
+#define SEGMENT_SIGN_TYPE_RSA3K_E825	0x00000005
 
 /* generic segment */
 struct ice_generic_seg_hdr {
Signature · 1 line
2.25.1
#52 lore raw

PATCH v2 18/20 net/ice/base: fix static analyzer bug

In reply to Qiming Yang

The default condition in the switch statement in ice_sched_get_psm_clk_freq() is an unreachable code. The variable clk_src is restricted to values 0 to 3 with the bit mask and shift values set.

Fixes 76ac9d771c97 ("net/ice/base: read PSM clock frequency from register")
---
 drivers/net/ice/base/ice_sched.c | 16 ++++++----------
 drivers/net/ice/base/ice_sched.h |  5 +++++
 2 files changed, 11 insertions(+), 10 deletions(-)
drivers/net/ice/base/ice_sched.c +6 -10
index 83cd152388..f558eccb93 100644
@@ -1417,11 +1417,6 @@ void ice_sched_get_psm_clk_freq(struct ice_hw *hw)
 	clk_src = (val & GLGEN_CLKSTAT_SRC_PSM_CLK_SRC_M) >>
 		GLGEN_CLKSTAT_SRC_PSM_CLK_SRC_S;
 
-#define PSM_CLK_SRC_367_MHZ 0x0
-#define PSM_CLK_SRC_416_MHZ 0x1
-#define PSM_CLK_SRC_446_MHZ 0x2
-#define PSM_CLK_SRC_390_MHZ 0x3
-
 	switch (clk_src) {
 	case PSM_CLK_SRC_367_MHZ:
 		hw->psm_clk_freq = ICE_PSM_CLK_367MHZ_IN_HZ;
@@ -1435,11 +1430,12 @@ void ice_sched_get_psm_clk_freq(struct ice_hw *hw)
 	case PSM_CLK_SRC_390_MHZ:
 		hw->psm_clk_freq = ICE_PSM_CLK_390MHZ_IN_HZ;
 		break;
-	default:
-		ice_debug(hw, ICE_DBG_SCHED, "PSM clk_src unexpected %u\n",
-			  clk_src);
-		/* fall back to a safe default */
-		hw->psm_clk_freq = ICE_PSM_CLK_446MHZ_IN_HZ;
+
+	/* default condition is not required as clk_src is restricted
+	 * to a 2-bit value from GLGEN_CLKSTAT_SRC_PSM_CLK_SRC_M mask.
+	 * The above switch statements cover the possible values of
+	 * this variable.
+	 */
 	}
 }
 
drivers/net/ice/base/ice_sched.h +5 -0
index a71619ebf0..c54f5ca9a0 100644
@@ -38,6 +38,11 @@
 #define ICE_PSM_CLK_446MHZ_IN_HZ 446428571
 #define ICE_PSM_CLK_390MHZ_IN_HZ 390625000
 
+#define PSM_CLK_SRC_367_MHZ 0x0
+#define PSM_CLK_SRC_416_MHZ 0x1
+#define PSM_CLK_SRC_446_MHZ 0x2
+#define PSM_CLK_SRC_390_MHZ 0x3
+
 struct rl_profile_params {
 	u32 bw;			/* in Kbps */
 	u16 rl_multiplier;
Signature · 1 line
2.25.1
#53 lore raw

PATCH v2 19/20 net/ice/base: offer memory config for schedual node

In reply to Qiming Yang

Add an option to pre-allocate memory for ice_sched_node struct. Add new arguments to ice_sched_add() and ice_sched_add_elems() that allow for pre-allocation of memory for ice_sched_node struct.

---
 drivers/net/ice/base/ice_common.c |  2 +-
 drivers/net/ice/base/ice_dcb.c    |  2 +-
 drivers/net/ice/base/ice_sched.c  | 24 ++++++++++++++++++------
 drivers/net/ice/base/ice_sched.h  |  3 ++-
 4 files changed, 22 insertions(+), 9 deletions(-)
drivers/net/ice/base/ice_common.c +1 -1
index f253e2f213..f7f43cd7e0 100644
@@ -5210,7 +5210,7 @@ ice_ena_vsi_txq(struct ice_port_info *pi, u16 vsi_handle, u8 tc, u16 q_handle,
 	q_ctx->q_teid = LE32_TO_CPU(node.node_teid);
 
 	/* add a leaf node into scheduler tree queue layer */
-	status = ice_sched_add_node(pi, hw->num_tx_sched_layers - 1, &node);
+	status = ice_sched_add_node(pi, hw->num_tx_sched_layers - 1, &node, NULL);
 	if (!status)
 		status = ice_sched_replay_q_bw(pi, q_ctx);
 
drivers/net/ice/base/ice_dcb.c +1 -1
index 2a308b02bf..cc4e28a702 100644
@@ -1624,7 +1624,7 @@ ice_update_port_tc_tree_cfg(struct ice_port_info *pi,
 		/* new TC */
 		status = ice_sched_query_elem(pi->hw, teid2, &elem);
 		if (!status)
-			status = ice_sched_add_node(pi, 1, &elem);
+			status = ice_sched_add_node(pi, 1, &elem, NULL);
 		if (status)
 			break;
 		/* update the TC number */
drivers/net/ice/base/ice_sched.c +18 -6
index f558eccb93..a4d31647fe 100644
@@ -143,12 +143,14 @@ ice_aq_query_sched_elems(struct ice_hw *hw, u16 elems_req,
  * @pi: port information structure
  * @layer: Scheduler layer of the node
  * @info: Scheduler element information from firmware
+ * @prealloc_node: preallocated ice_sched_node struct for SW DB
  *
  * This function inserts a scheduler node to the SW DB.
  */
 enum ice_status
 ice_sched_add_node(struct ice_port_info *pi, u8 layer,
-		   struct ice_aqc_txsched_elem_data *info)
+		   struct ice_aqc_txsched_elem_data *info,
+		   struct ice_sched_node *prealloc_node)
 {
 	struct ice_aqc_txsched_elem_data elem;
 	struct ice_sched_node *parent;
@@ -176,7 +178,11 @@ ice_sched_add_node(struct ice_port_info *pi, u8 layer,
 	status = ice_sched_query_elem(hw, LE32_TO_CPU(info->node_teid), &elem);
 	if (status)
 		return status;
-	node = (struct ice_sched_node *)ice_malloc(hw, sizeof(*node));
+
+	if (prealloc_node)
+		node = prealloc_node;
+	else
+		node = (struct ice_sched_node *)ice_malloc(hw, sizeof(*node));
 	if (!node)
 		return ICE_ERR_NO_MEMORY;
 	if (hw->max_children[layer]) {
@@ -901,13 +907,15 @@ ice_aq_cfg_l2_node_cgd(struct ice_hw *hw, u16 num_l2_nodes,
  * @num_nodes: number of nodes
  * @num_nodes_added: pointer to num nodes added
  * @first_node_teid: if new nodes are added then return the TEID of first node
+ * @prealloc_nodes: preallocated nodes struct for software DB
  *
  * This function add nodes to HW as well as to SW DB for a given layer
  */
 static enum ice_status
 ice_sched_add_elems(struct ice_port_info *pi, struct ice_sched_node *tc_node,
 		    struct ice_sched_node *parent, u8 layer, u16 num_nodes,
-		    u16 *num_nodes_added, u32 *first_node_teid)
+		    u16 *num_nodes_added, u32 *first_node_teid,
+		    struct ice_sched_node **prealloc_nodes)
 {
 	struct ice_sched_node *prev, *new_node;
 	struct ice_aqc_add_elem *buf;
@@ -953,7 +961,11 @@ ice_sched_add_elems(struct ice_port_info *pi, struct ice_sched_node *tc_node,
 	*num_nodes_added = num_nodes;
 	/* add nodes to the SW DB */
 	for (i = 0; i < num_nodes; i++) {
-		status = ice_sched_add_node(pi, layer, &buf->generic[i]);
+		if (prealloc_nodes)
+			status = ice_sched_add_node(pi, layer, &buf->generic[i], prealloc_nodes[i]);
+		else
+			status = ice_sched_add_node(pi, layer, &buf->generic[i], NULL);
+
 		if (status != ICE_SUCCESS) {
 			ice_debug(hw, ICE_DBG_SCHED, "add nodes in SW DB failed status =%d\n",
 				  status);
@@ -1032,7 +1044,7 @@ ice_sched_add_nodes_to_hw_layer(struct ice_port_info *pi,
 	}
 
 	return ice_sched_add_elems(pi, tc_node, parent, layer, num_nodes,
-				   num_nodes_added, first_node_teid);
+				   num_nodes_added, first_node_teid, NULL);
 }
 
 /**
@@ -1292,7 +1304,7 @@ enum ice_status ice_sched_init_port(struct ice_port_info *pi)
 			    ICE_AQC_ELEM_TYPE_ENTRY_POINT)
 				hw->sw_entry_point_layer = j;
 
-			status = ice_sched_add_node(pi, j, &buf[i].generic[j]);
+			status = ice_sched_add_node(pi, j, &buf[i].generic[j], NULL);
 			if (status)
 				goto err_init_port;
 		}
drivers/net/ice/base/ice_sched.h +2 -1
index c54f5ca9a0..4b68f3f535 100644
@@ -117,7 +117,8 @@ ice_sched_find_node_by_teid(struct ice_sched_node *start_node, u32 teid);
 /* Add a scheduling node into SW DB for given info */
 enum ice_status
 ice_sched_add_node(struct ice_port_info *pi, u8 layer,
-		   struct ice_aqc_txsched_elem_data *info);
+		   struct ice_aqc_txsched_elem_data *info,
+		   struct ice_sched_node *prealloc_node);
 void ice_free_sched_node(struct ice_port_info *pi, struct ice_sched_node *node);
 struct ice_sched_node *ice_sched_get_tc_node(struct ice_port_info *pi, u8 tc);
 struct ice_sched_node *
Signature · 1 line
2.25.1
#54 lore raw

PATCH v2 20/20 net/ice/base: add new AQ ro read HW sensors

In reply to Qiming Yang

Adds new helper function to read from HW sensors via a new AQ command "Get Sensor Reading (0x0632)".

Currently, this AQ command only supports reading the temperature from E810 devices with a supported firmware, but in the future it could be extended to read other sensors.

---
 drivers/net/ice/base/ice_adminq_cmd.h | 29 +++++++++++++++++++++
 drivers/net/ice/base/ice_common.c     | 36 +++++++++++++++++++++++++++
 drivers/net/ice/base/ice_common.h     |  4 +++
 3 files changed, 69 insertions(+)
drivers/net/ice/base/ice_adminq_cmd.h +29 -0
index 8df6ca41e9..844e90bbce 100644
@@ -1666,6 +1666,32 @@ struct ice_aqc_set_mac_lb {
 	u8 reserved[15];
 };
 
+/* Get sensor reading (direct 0x0632) */
+struct ice_aqc_get_sensor_reading {
+	u8 sensor;
+#define ICE_AQC_INT_TEMP_SENSOR		0x0
+	u8 format;
+#define ICE_AQC_INT_TEMP_FORMAT		0x0
+	u8 reserved[6];
+	__le32 addr_high;
+	__le32 addr_low;
+};
+
+/* Get sensor reading response (direct 0x0632) */
+struct ice_aqc_get_sensor_reading_resp {
+	union {
+		u8 raw[8];
+		/* Output data for sensor 0x00, format 0x00 */
+		struct {
+			s8 temp;
+			u8 temp_warning_threshold;
+			u8 temp_critical_threshold;
+			u8 temp_fatal_threshold;
+			u8 reserved[4];
+		} s0f0;
+	} data;
+};
+
 struct ice_aqc_link_topo_params {
 	u8 lport_num;
 	u8 lport_num_valid;
@@ -3004,6 +3030,8 @@ struct ice_aq_desc {
 		struct ice_aqc_get_phy_caps get_phy;
 		struct ice_aqc_set_phy_cfg set_phy;
 		struct ice_aqc_restart_an restart_an;
+		struct ice_aqc_get_sensor_reading get_sensor_reading;
+		struct ice_aqc_get_sensor_reading_resp get_sensor_reading_resp;
 		struct ice_aqc_i2c read_write_i2c;
 		struct ice_aqc_read_i2c_resp read_i2c_resp;
 		struct ice_aqc_gpio read_write_gpio;
@@ -3253,6 +3281,7 @@ enum ice_adminq_opc {
 	ice_aqc_opc_get_link_status			= 0x0607,
 	ice_aqc_opc_set_event_mask			= 0x0613,
 	ice_aqc_opc_set_mac_lb				= 0x0620,
+	ice_aqc_opc_get_sensor_reading			= 0x0632,
 	ice_aqc_opc_get_link_topo			= 0x06E0,
 	ice_aqc_opc_get_link_topo_pin			= 0x06E1,
 	ice_aqc_opc_read_i2c				= 0x06E2,
drivers/net/ice/base/ice_common.c +36 -0
index f7f43cd7e0..0f26f1d854 100644
@@ -5359,6 +5359,42 @@ ice_cfg_vsi_lan(struct ice_port_info *pi, u16 vsi_handle, u16 tc_bitmap,
 			      ICE_SCHED_NODE_OWNER_LAN);
 }
 
+/**
+ * ice_aq_get_sensor_reading
+ * @hw: pointer to the HW struct
+ * @sensor: sensor type
+ * @format: requested response format
+ * @data: pointer to data to be read from the sensor
+ * @cd: pointer to command details structure or NULL
+ *
+ * Get sensor reading (0x0632)
+ */
+enum ice_status
+ice_aq_get_sensor_reading(struct ice_hw *hw, u8 sensor, u8 format,
+			  struct ice_aqc_get_sensor_reading_resp *data,
+			  struct ice_sq_cd *cd)
+{
+	struct ice_aqc_get_sensor_reading *cmd;
+	struct ice_aq_desc desc;
+	enum ice_status status;
+
+	if (!data)
+		return ICE_ERR_PARAM;
+
+	ice_fill_dflt_direct_cmd_desc(&desc, ice_aqc_opc_get_sensor_reading);
+	cmd = &desc.params.get_sensor_reading;
+	cmd->sensor = sensor;
+	cmd->format = format;
+
+	status = ice_aq_send_cmd(hw, &desc, NULL, 0, cd);
+
+	if (!status)
+		ice_memcpy(data, &desc.params.get_sensor_reading_resp,
+			   sizeof(*data), ICE_NONDMA_TO_NONDMA);
+
+	return status;
+}
+
 /**
  * ice_is_main_vsi - checks whether the VSI is main VSI
  * @hw: pointer to the HW struct
drivers/net/ice/base/ice_common.h +4 -0
index aff361e5aa..0f1be917db 100644
@@ -249,6 +249,10 @@ enum ice_status ice_sbq_rw_reg_lp(struct ice_hw *hw,
 void ice_sbq_lock(struct ice_hw *hw);
 void ice_sbq_unlock(struct ice_hw *hw);
 enum ice_status ice_sbq_rw_reg(struct ice_hw *hw, struct ice_sbq_msg_input *in);
+enum ice_status
+ice_aq_get_sensor_reading(struct ice_hw *hw, u8 sensor, u8 format,
+			  struct ice_aqc_get_sensor_reading_resp *data,
+			  struct ice_sq_cd *cd);
 void
 ice_stat_update40(struct ice_hw *hw, u32 reg, bool prev_stat_loaded,
 		  u64 *prev_stat, u64 *cur_stat);
Signature · 1 line
2.25.1
Acked-by on the v2 series Applied
#55 lore raw

RE: [PATCH v2 00/20] net/ice/base: code update

In reply to Qiming Yang
Quoted 103 lines

-----Original Message-----
From: Yang, Qiming <[email protected]>
Sent: Thursday, May 18, 2023 11:16 PM
To: [email protected]
Cc: Zhang, Qi Z <[email protected]>; Yang, Qiming <[email protected]>
Subject: [PATCH v2 00/20] net/ice/base: code update

Updated share code to 2023.02 version.

Qiming Yang (20):
net/ice/base: updated copyright
net/ice/base: add NAC Topology device capability parser net/ice/base: add new device for E810 net/ice/base: fix incorrect defines for DCBx net/ice/base: introduce a non-atomic function net/ice/base: add missing AQ flag to AQ command net/ice/base: add support for inner etype in switchdev net/ice/base: add support for PPPoE hardware offload net/ice/base: remove direction metadata for switchdev net/ice/base: reduce time to read Option data net/ice/base: add support for VLAN TPID filters net/ice/base: add C825-X device ID net/ice/base: add function to get rxq context net/ice/base: modify tunnel match mask net/ice/base: check VSIG before disassociating VSI net/ice/base: delete get field vector function net/ice/base: update 3k-sign DDP support for E825C net/ice/base: fix static analyzer bug net/ice/base: offer memory config for schedual node net/ice/base: add new AQ ro read HW sensors

 drivers/net/ice/base/README              |   2 +-
 drivers/net/ice/base/ice_acl.c           |   2 +-
 drivers/net/ice/base/ice_acl.h           |   2 +-
 drivers/net/ice/base/ice_acl_ctrl.c      |   2 +-
 drivers/net/ice/base/ice_adminq_cmd.h    |  35 +-
 drivers/net/ice/base/ice_alloc.h         |   2 +-
 drivers/net/ice/base/ice_bitops.h        |  11 +-
 drivers/net/ice/base/ice_bst_tcam.c      |   2 +-
 drivers/net/ice/base/ice_bst_tcam.h      |   2 +-
 drivers/net/ice/base/ice_cgu_regs.h      |   2 +-
 drivers/net/ice/base/ice_common.c        | 147 +++++++-
 drivers/net/ice/base/ice_common.h        |  13 +-
 drivers/net/ice/base/ice_controlq.c      |   2 +-
 drivers/net/ice/base/ice_controlq.h      |   2 +-
 drivers/net/ice/base/ice_dcb.c           |   4 +-
 drivers/net/ice/base/ice_dcb.h           |   2 +-
 drivers/net/ice/base/ice_ddp.c           |  13 +-
 drivers/net/ice/base/ice_ddp.h           |   3 +-
 drivers/net/ice/base/ice_defs.h          |   2 +-
 drivers/net/ice/base/ice_devids.h        |  10 +-
 drivers/net/ice/base/ice_fdir.c          |   2 +-
 drivers/net/ice/base/ice_fdir.h          |   2 +-
 drivers/net/ice/base/ice_flex_pipe.c     |   2 +-
 drivers/net/ice/base/ice_flex_pipe.h     |   2 +-
 drivers/net/ice/base/ice_flex_type.h     |   2 +-
 drivers/net/ice/base/ice_flg_rd.c        |   2 +-
 drivers/net/ice/base/ice_flg_rd.h        |   2 +-
 drivers/net/ice/base/ice_flow.c          |  15 +-
 drivers/net/ice/base/ice_flow.h          |   2 +-
 drivers/net/ice/base/ice_hw_autogen.h    |   2 +-
 drivers/net/ice/base/ice_imem.c          |   2 +-
 drivers/net/ice/base/ice_imem.h          |   2 +-
 drivers/net/ice/base/ice_lan_tx_rx.h     |   2 +-
 drivers/net/ice/base/ice_metainit.c      |   2 +-
 drivers/net/ice/base/ice_metainit.h      |   2 +-
 drivers/net/ice/base/ice_mk_grp.c        |   2 +-
 drivers/net/ice/base/ice_mk_grp.h        |   2 +-
 drivers/net/ice/base/ice_nvm.c           |  52 ++-
 drivers/net/ice/base/ice_nvm.h           |   2 +-
 drivers/net/ice/base/ice_parser.c        |   2 +-
 drivers/net/ice/base/ice_parser.h        |   2 +-
 drivers/net/ice/base/ice_parser_rt.c     |   2 +-
 drivers/net/ice/base/ice_parser_rt.h     |   2 +-
 drivers/net/ice/base/ice_parser_util.h   |   2 +-
 drivers/net/ice/base/ice_pg_cam.c        |   2 +-
 drivers/net/ice/base/ice_pg_cam.h        |   2 +-
 drivers/net/ice/base/ice_proto_grp.c     |   2 +-
 drivers/net/ice/base/ice_proto_grp.h     |   2 +-
 drivers/net/ice/base/ice_protocol_type.h |  11 +-
 drivers/net/ice/base/ice_ptp_consts.h    |   2 +-
 drivers/net/ice/base/ice_ptp_hw.c        |   2 +-
 drivers/net/ice/base/ice_ptp_hw.h        |   2 +-
 drivers/net/ice/base/ice_ptype_mk.c      |   2 +-
 drivers/net/ice/base/ice_ptype_mk.h      |   2 +-
 drivers/net/ice/base/ice_sbq_cmd.h       |   2 +-
 drivers/net/ice/base/ice_sched.c         |  42 ++-
 drivers/net/ice/base/ice_sched.h         |  10 +-
 drivers/net/ice/base/ice_status.h        |   2 +-
 drivers/net/ice/base/ice_switch.c        | 442 ++++++++++++++++++++---
 drivers/net/ice/base/ice_switch.h        |   4 +-
 drivers/net/ice/base/ice_tmatch.h        |   2 +-
 drivers/net/ice/base/ice_type.h          |  13 +-
 drivers/net/ice/base/ice_vlan_mode.c     |   3 +-
 drivers/net/ice/base/ice_vlan_mode.h     |   2 +-
 drivers/net/ice/base/ice_xlt_kb.c        |   2 +-
 drivers/net/ice/base/ice_xlt_kb.h        |   2 +-
 drivers/net/ice/ice_ethdev.c             |   4 +-
 67 files changed, 755 insertions(+), 175 deletions(-)
Quoted 2 lines

--
2.25.1

Also updated the base code release version to 2023.03.30 in ice/base/README.

Applied to dpdk-next-net-intel.

Thanks
Qi