Skip to contentSkip to conversation

enhancements to host based flow table management

PATCH New Venkat Duvvuru 3 participants 129 messages May 30, 2021 – Jul 8, 2021 Page 1 of 4

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

cover enhancements to host based flow table management

This patchset adds flow table management support for Thor network adapter and introduces enhancements to the existing flow table management functionality.

Farah Smith (11):
net/bnxt: add base TRUFLOW support for Thor net/bnxt: update TRUFLOW resources net/bnxt: add action SRAM Translation net/bnxt: add 64B SRAM record management with RM net/bnxt: modify TRUFLOW HWRM messages net/bnxt: shared TCAM region support net/bnxt: cleanup session open/close messages net/bnxt: add WC TCAM hi/lo move support net/bnxt: add API to get shared table increments net/bnxt: cleanup of WC TCAM shared unbind net/bnxt: add API to clear hi/lo WC region

Jay Ding (9):
net/bnxt: check resource reservation in TRUFLOW net/bnxt: add L2 Context TCAM get support net/bnxt: add Thor WC TCAM support net/bnxt: change RM database type net/bnxt: add shared session support net/bnxt: update shared session functionality net/bnxt: modify resource reservation strategy net/bnxt: modify host session failure cleanup net/bnxt: add support for WC TCAM shared session

Jeffrey Huang (1):
net/bnxt: add CFA folder to HCAPI directory

Kishore Padmanabha (23):
net/bnxt: add support for generic table processing net/bnxt: add support for mapper flow database opcodes net/bnxt: modify TCAM opcode processing net/bnxt: modify table processing
net/bnxt: modify ULP priority opcode processing net/bnxt: add support for conflict resolution net/bnxt: add support for conditional goto processing net/bnxt: set shared handle for generic table net/bnxt: modify ULP template
net/bnxt: add conditional opcode and L4 port fields net/bnxt: refactor TF ULP
net/bnxt: add partial header field processing net/bnxt: add support for wild card pattern match net/bnxt: enable extended exact match support net/bnxt: refactor ULP mapper and parser net/bnxt: add support for generic hash table net/bnxt: add support for Thor platform net/bnxt: refactor flow parser in ULP net/bnxt: add field opcodes in ULP
net/bnxt: add support for application ID in ULP matcher net/bnxt: add support for shared sessions in ULP net/bnxt: add support for icmp6 ULP parsing net/bnxt: add support for ULP context list for timers

Mike Baucom (5):
net/bnxt: add conditional execution and rejection net/bnxt: add shared session support to ULP net/bnxt: process resource lists before session open net/bnxt: add HA support in ULP
net/bnxt: add Thor template support

Peter Spreadborough (4):
net/bnxt: add mailbox selection via dev op
net/bnxt: add support for EM with FKB
net/bnxt: add hashing changes for Thor
net/bnxt: add dpool allocator for EM allocation

Shahaji Bhosle (1):
net/bnxt: cleanup ULP parser and mapper

Venkat Duvvuru (4):
net/bnxt: check FW capability to support TRUFLOW net/bnxt: modify VXLAN decap for multichannel mode net/bnxt: add support for GRE flows net/bnxt: reorganize ULP template directory structure

 doc/guides/nics/bnxt.rst                      |     3 +-
 drivers/net/bnxt/bnxt.h                       |    19 +-
 drivers/net/bnxt/bnxt_ethdev.c                |   162 +-
 drivers/net/bnxt/bnxt_hwrm.c                  |     7 +-
 drivers/net/bnxt/bnxt_util.h                  |     3 +
 drivers/net/bnxt/hcapi/cfa/hcapi_cfa.h        |   126 +
 drivers/net/bnxt/hcapi/cfa/hcapi_cfa_common.c |    83 +
 drivers/net/bnxt/hcapi/cfa/hcapi_cfa_defs.h   |   381 +
 drivers/net/bnxt/hcapi/cfa/hcapi_cfa_p4.c     |   292 +
 drivers/net/bnxt/hcapi/cfa/hcapi_cfa_p4.h     |   185 +
 drivers/net/bnxt/hcapi/cfa/hcapi_cfa_p58.c    |   122 +
 drivers/net/bnxt/hcapi/cfa/hcapi_cfa_p58.h    |   142 +
 drivers/net/bnxt/hcapi/cfa/meson.build        |    12 +
 drivers/net/bnxt/hcapi/cfa_p40_hw.h           |   781 -
 drivers/net/bnxt/hcapi/cfa_p40_tbl.h          |   303 -
 drivers/net/bnxt/hcapi/hcapi_cfa.h            |   295 -
 drivers/net/bnxt/hcapi/hcapi_cfa_defs.h       |   672 -
 drivers/net/bnxt/hcapi/hcapi_cfa_p4.c         |   399 -
 drivers/net/bnxt/hcapi/hcapi_cfa_p4.h         |   467 -
 drivers/net/bnxt/hsi_struct_def_dpdk.h        |   281 +-
 drivers/net/bnxt/meson.build                  |    65 +-
 drivers/net/bnxt/tf_core/bitalloc.c           |    10 +-
 drivers/net/bnxt/tf_core/bitalloc.h           |     5 +-
 drivers/net/bnxt/tf_core/cfa_resource_types.h |     3 +-
 drivers/net/bnxt/tf_core/dpool.c              |   373 +
 drivers/net/bnxt/tf_core/dpool.h              |   309 +
 drivers/net/bnxt/tf_core/hwrm_tf.h            |   195 -
 drivers/net/bnxt/tf_core/lookup3.h            |     2 +-
 drivers/net/bnxt/tf_core/meson.build          |    36 +
 drivers/net/bnxt/tf_core/tf_core.c            |   326 +-
 drivers/net/bnxt/tf_core/tf_core.h            |   563 +-
 drivers/net/bnxt/tf_core/tf_device.c          |   530 +-
 drivers/net/bnxt/tf_core/tf_device.h          |   276 +-
 drivers/net/bnxt/tf_core/tf_device_p4.c       |   164 +-
 drivers/net/bnxt/tf_core/tf_device_p4.h       |   203 +-
 drivers/net/bnxt/tf_core/tf_device_p45.h      |   105 -
 drivers/net/bnxt/tf_core/tf_device_p58.c      |   375 +
 drivers/net/bnxt/tf_core/tf_device_p58.h      |   212 +
 drivers/net/bnxt/tf_core/tf_em.h              |    99 +-
 drivers/net/bnxt/tf_core/tf_em_common.c       |   332 +-
 drivers/net/bnxt/tf_core/tf_em_common.h       |    68 +-
 .../net/bnxt/tf_core/tf_em_hash_internal.c    |   215 +
 drivers/net/bnxt/tf_core/tf_em_host.c         |   115 +-
 drivers/net/bnxt/tf_core/tf_em_internal.c     |   376 +-
 drivers/net/bnxt/tf_core/tf_ext_flow_handle.h |    15 +-
 drivers/net/bnxt/tf_core/tf_identifier.c      |   174 +-
 drivers/net/bnxt/tf_core/tf_identifier.h      |    26 +
 drivers/net/bnxt/tf_core/tf_if_tbl.c          |    20 +-
 drivers/net/bnxt/tf_core/tf_msg.c             |  1219 +-
 drivers/net/bnxt/tf_core/tf_msg.h             |   217 +-
 drivers/net/bnxt/tf_core/tf_msg_common.h      |     3 -
 drivers/net/bnxt/tf_core/tf_rm.c              |   834 +-
 drivers/net/bnxt/tf_core/tf_rm.h              |   143 +-
 drivers/net/bnxt/tf_core/tf_session.c         |   261 +-
 drivers/net/bnxt/tf_core/tf_session.h         |   206 +-
 drivers/net/bnxt/tf_core/tf_shadow_tbl.c      |   785 -
 drivers/net/bnxt/tf_core/tf_shadow_tbl.h      |   256 -
 drivers/net/bnxt/tf_core/tf_shadow_tcam.c     |     6 +-
 drivers/net/bnxt/tf_core/tf_tbl.c             |   656 +-
 drivers/net/bnxt/tf_core/tf_tbl.h             |    57 +-
 drivers/net/bnxt/tf_core/tf_tcam.c            |   435 +-
 drivers/net/bnxt/tf_core/tf_tcam.h            |    30 +
 drivers/net/bnxt/tf_core/tf_tcam_shared.c     |  1283 +
 drivers/net/bnxt/tf_core/tf_tcam_shared.h     |   183 +
 drivers/net/bnxt/tf_core/tf_util.c            |    62 +-
 drivers/net/bnxt/tf_core/tf_util.h            |    31 +-
 drivers/net/bnxt/tf_core/tfp.c                |    44 +-
 drivers/net/bnxt/tf_core/tfp.h                |    61 +-
 drivers/net/bnxt/tf_ulp/bnxt_tf_common.h      |     2 -
 drivers/net/bnxt/tf_ulp/bnxt_tf_pmd_shim.c    |   378 +
 drivers/net/bnxt/tf_ulp/bnxt_tf_pmd_shim.h    |    29 +
 drivers/net/bnxt/tf_ulp/bnxt_ulp.c            |   943 +-
 drivers/net/bnxt/tf_ulp/bnxt_ulp.h            |    85 +-
 drivers/net/bnxt/tf_ulp/bnxt_ulp_flow.c       |    74 +-
 .../bnxt/tf_ulp/generic_templates/meson.build |    13 +
 .../generic_templates/ulp_template_db_act.c   |  1017 +
 .../generic_templates/ulp_template_db_class.c | 13188 ++++++++++
 .../generic_templates/ulp_template_db_enum.h  |  1883 ++
 .../generic_templates/ulp_template_db_field.h |   686 +
 .../generic_templates/ulp_template_db_tbl.c   |  3335 +++
 .../generic_templates/ulp_template_db_tbl.h   |   112 +
 .../ulp_template_db_thor_act.c                |   225 +
 .../ulp_template_db_thor_class.c              |  6107 +++++
 .../ulp_template_db_wh_plus_act.c             |  4974 ++++
 .../ulp_template_db_wh_plus_class.c           | 14270 +++++++++++
 drivers/net/bnxt/tf_ulp/meson.build           |    28 +
 drivers/net/bnxt/tf_ulp/ulp_def_rules.c       |    91 +-
 drivers/net/bnxt/tf_ulp/ulp_fc_mgr.c          |   171 +-
 drivers/net/bnxt/tf_ulp/ulp_fc_mgr.h          |     1 +
 drivers/net/bnxt/tf_ulp/ulp_flow_db.c         |   129 +-
 drivers/net/bnxt/tf_ulp/ulp_flow_db.h         |    20 +-
 drivers/net/bnxt/tf_ulp/ulp_gen_hash.c        |   369 +
 drivers/net/bnxt/tf_ulp/ulp_gen_hash.h        |   166 +
 drivers/net/bnxt/tf_ulp/ulp_gen_tbl.c         |   417 +
 drivers/net/bnxt/tf_ulp/ulp_gen_tbl.h         |   171 +
 drivers/net/bnxt/tf_ulp/ulp_ha_mgr.c          |   637 +
 drivers/net/bnxt/tf_ulp/ulp_ha_mgr.h          |    67 +
 drivers/net/bnxt/tf_ulp/ulp_mapper.c          |  3572 ++-
 drivers/net/bnxt/tf_ulp/ulp_mapper.h          |    59 +-
 drivers/net/bnxt/tf_ulp/ulp_mark_mgr.c        |    10 +-
 drivers/net/bnxt/tf_ulp/ulp_matcher.c         |    36 +-
 drivers/net/bnxt/tf_ulp/ulp_port_db.c         |   140 +-
 drivers/net/bnxt/tf_ulp/ulp_port_db.h         |    42 +
 ...emplate_db_tbl.c => ulp_rte_handler_tbl.c} |   269 +-
 drivers/net/bnxt/tf_ulp/ulp_rte_parser.c      |  1207 +-
 drivers/net/bnxt/tf_ulp/ulp_rte_parser.h      |    36 +-
 drivers/net/bnxt/tf_ulp/ulp_template_db.c     |  4622 ----
 drivers/net/bnxt/tf_ulp/ulp_template_db.h     |   614 -
 drivers/net/bnxt/tf_ulp/ulp_template_db_act.c |   815 -
 .../net/bnxt/tf_ulp/ulp_template_db_class.c   |  3985 ---
 .../net/bnxt/tf_ulp/ulp_template_db_enum.h    |   973 -
 .../net/bnxt/tf_ulp/ulp_template_db_field.h   |  1191 -
 .../tf_ulp/ulp_template_db_stingray_act.c     |  3305 ---
 .../tf_ulp/ulp_template_db_stingray_class.c   | 20566 ----------------
 drivers/net/bnxt/tf_ulp/ulp_template_db_tbl.h |    48 -
 .../bnxt/tf_ulp/ulp_template_db_wh_plus_act.c |  3304 ---
 .../tf_ulp/ulp_template_db_wh_plus_class.c    | 20566 ----------------
 .../net/bnxt/tf_ulp/ulp_template_field_db.h   |   224 -
 drivers/net/bnxt/tf_ulp/ulp_template_struct.h |   192 +-
 drivers/net/bnxt/tf_ulp/ulp_tun.c             |   194 +-
 drivers/net/bnxt/tf_ulp/ulp_tun.h             |    33 +-
 drivers/net/bnxt/tf_ulp/ulp_utils.c           |   339 +-
 drivers/net/bnxt/tf_ulp/ulp_utils.h           |   153 +-
 123 files changed, 63946 insertions(+), 68836 deletions(-)
 create mode 100644 drivers/net/bnxt/hcapi/cfa/hcapi_cfa.h
 create mode 100644 drivers/net/bnxt/hcapi/cfa/hcapi_cfa_common.c
 create mode 100644 drivers/net/bnxt/hcapi/cfa/hcapi_cfa_defs.h
 create mode 100644 drivers/net/bnxt/hcapi/cfa/hcapi_cfa_p4.c
 create mode 100644 drivers/net/bnxt/hcapi/cfa/hcapi_cfa_p4.h
 create mode 100644 drivers/net/bnxt/hcapi/cfa/hcapi_cfa_p58.c
 create mode 100644 drivers/net/bnxt/hcapi/cfa/hcapi_cfa_p58.h
 create mode 100644 drivers/net/bnxt/hcapi/cfa/meson.build
 delete mode 100644 drivers/net/bnxt/hcapi/cfa_p40_hw.h
 delete mode 100644 drivers/net/bnxt/hcapi/cfa_p40_tbl.h
 delete mode 100644 drivers/net/bnxt/hcapi/hcapi_cfa.h
 delete mode 100644 drivers/net/bnxt/hcapi/hcapi_cfa_defs.h
 delete mode 100644 drivers/net/bnxt/hcapi/hcapi_cfa_p4.c
 delete mode 100644 drivers/net/bnxt/hcapi/hcapi_cfa_p4.h
 create mode 100644 drivers/net/bnxt/tf_core/dpool.c
 create mode 100644 drivers/net/bnxt/tf_core/dpool.h
 delete mode 100644 drivers/net/bnxt/tf_core/hwrm_tf.h
 create mode 100644 drivers/net/bnxt/tf_core/meson.build
 delete mode 100644 drivers/net/bnxt/tf_core/tf_device_p45.h
 create mode 100644 drivers/net/bnxt/tf_core/tf_device_p58.c
 create mode 100644 drivers/net/bnxt/tf_core/tf_device_p58.h
 create mode 100644 drivers/net/bnxt/tf_core/tf_em_hash_internal.c
 delete mode 100644 drivers/net/bnxt/tf_core/tf_shadow_tbl.c
 delete mode 100644 drivers/net/bnxt/tf_core/tf_shadow_tbl.h
 create mode 100644 drivers/net/bnxt/tf_core/tf_tcam_shared.c
 create mode 100644 drivers/net/bnxt/tf_core/tf_tcam_shared.h
 create mode 100644 drivers/net/bnxt/tf_ulp/bnxt_tf_pmd_shim.c
 create mode 100644 drivers/net/bnxt/tf_ulp/bnxt_tf_pmd_shim.h
 create mode 100644 drivers/net/bnxt/tf_ulp/generic_templates/meson.build
 create mode 100644 drivers/net/bnxt/tf_ulp/generic_templates/ulp_template_db_act.c
 create mode 100644 drivers/net/bnxt/tf_ulp/generic_templates/ulp_template_db_class.c
 create mode 100644 drivers/net/bnxt/tf_ulp/generic_templates/ulp_template_db_enum.h
 create mode 100644 drivers/net/bnxt/tf_ulp/generic_templates/ulp_template_db_field.h
 create mode 100644 drivers/net/bnxt/tf_ulp/generic_templates/ulp_template_db_tbl.c
 create mode 100644 drivers/net/bnxt/tf_ulp/generic_templates/ulp_template_db_tbl.h
 create mode 100644 drivers/net/bnxt/tf_ulp/generic_templates/ulp_template_db_thor_act.c
 create mode 100644 drivers/net/bnxt/tf_ulp/generic_templates/ulp_template_db_thor_class.c
 create mode 100644 drivers/net/bnxt/tf_ulp/generic_templates/ulp_template_db_wh_plus_act.c
 create mode 100644 drivers/net/bnxt/tf_ulp/generic_templates/ulp_template_db_wh_plus_class.c
 create mode 100644 drivers/net/bnxt/tf_ulp/meson.build
 create mode 100644 drivers/net/bnxt/tf_ulp/ulp_gen_hash.c
 create mode 100644 drivers/net/bnxt/tf_ulp/ulp_gen_hash.h
 create mode 100644 drivers/net/bnxt/tf_ulp/ulp_gen_tbl.c
 create mode 100644 drivers/net/bnxt/tf_ulp/ulp_gen_tbl.h
 create mode 100644 drivers/net/bnxt/tf_ulp/ulp_ha_mgr.c
 create mode 100644 drivers/net/bnxt/tf_ulp/ulp_ha_mgr.h
 rename drivers/net/bnxt/tf_ulp/{ulp_template_db_tbl.c => ulp_rte_handler_tbl.c} (60%)
 delete mode 100644 drivers/net/bnxt/tf_ulp/ulp_template_db.c
 delete mode 100644 drivers/net/bnxt/tf_ulp/ulp_template_db.h
 delete mode 100644 drivers/net/bnxt/tf_ulp/ulp_template_db_act.c
 delete mode 100644 drivers/net/bnxt/tf_ulp/ulp_template_db_class.c
 delete mode 100644 drivers/net/bnxt/tf_ulp/ulp_template_db_enum.h
 delete mode 100644 drivers/net/bnxt/tf_ulp/ulp_template_db_field.h
 delete mode 100644 drivers/net/bnxt/tf_ulp/ulp_template_db_stingray_act.c
 delete mode 100644 drivers/net/bnxt/tf_ulp/ulp_template_db_stingray_class.c
 delete mode 100644 drivers/net/bnxt/tf_ulp/ulp_template_db_tbl.h
 delete mode 100644 drivers/net/bnxt/tf_ulp/ulp_template_db_wh_plus_act.c
 delete mode 100644 drivers/net/bnxt/tf_ulp/ulp_template_db_wh_plus_class.c
 delete mode 100644 drivers/net/bnxt/tf_ulp/ulp_template_field_db.h
Signature · 1 line
2.17.1
#1 lore raw

PATCH 1/58 net/bnxt: add CFA folder to HCAPI directory

From: Jeffrey Huang <[email protected]>

Before introducing more HCAPI components to DPDK, the CFA code needs to be organized into a dedicated folder so it is separated from other new HCAPI components

---
 drivers/net/bnxt/hcapi/{ => cfa}/hcapi_cfa.h  |  14 -
 .../net/bnxt/hcapi/{ => cfa}/hcapi_cfa_defs.h |   8 +-
 .../net/bnxt/hcapi/{ => cfa}/hcapi_cfa_p4.c   |   0
 .../net/bnxt/hcapi/{ => cfa}/hcapi_cfa_p4.h   |   2 -
 drivers/net/bnxt/hcapi/cfa/meson.build        |  10 +
 drivers/net/bnxt/hcapi/cfa_p40_hw.h           | 781 ------------------
 drivers/net/bnxt/hcapi/cfa_p40_tbl.h          | 303 -------
 drivers/net/bnxt/meson.build                  |  65 +-
 drivers/net/bnxt/tf_core/meson.build          |  33 +
 drivers/net/bnxt/tf_core/tf_core.h            |   2 +-
 drivers/net/bnxt/tf_core/tf_em.h              |   2 +-
 drivers/net/bnxt/tf_ulp/meson.build           |  28 +
 12 files changed, 89 insertions(+), 1159 deletions(-)
 rename drivers/net/bnxt/hcapi/{ => cfa}/hcapi_cfa.h (96%)
 rename drivers/net/bnxt/hcapi/{ => cfa}/hcapi_cfa_defs.h (98%)
 rename drivers/net/bnxt/hcapi/{ => cfa}/hcapi_cfa_p4.c (100%)
 rename drivers/net/bnxt/hcapi/{ => cfa}/hcapi_cfa_p4.h (99%)
 create mode 100644 drivers/net/bnxt/hcapi/cfa/meson.build
 delete mode 100644 drivers/net/bnxt/hcapi/cfa_p40_hw.h
 delete mode 100644 drivers/net/bnxt/hcapi/cfa_p40_tbl.h
 create mode 100644 drivers/net/bnxt/tf_core/meson.build
 create mode 100644 drivers/net/bnxt/tf_ulp/meson.build
drivers/net/bnxt/hcapi/cfa/hcapi_cfa.h renamed from drivers/net/bnxt/hcapi/hcapi_cfa.h +0 -14
similarity index 96%
rename from drivers/net/bnxt/hcapi/hcapi_cfa.h
rename to drivers/net/bnxt/hcapi/cfa/hcapi_cfa.h
index c58092e72d..b8c85a0fca 100644
@@ -14,20 +14,6 @@
 
 #include "hcapi_cfa_defs.h"
 
-#if CHIP_CFG == SR_A
-#define SUPPORT_CFA_HW_P45  1
-#undef SUPPORT_CFA_HW_P4
-#define SUPPORT_CFA_HW_P4   0
-#elif CHIP_CFG == CMB_A
-#define SUPPORT_CFA_HW_P4  1
-#else
-#error "Chip not supported"
-#endif
-
-#if SUPPORT_CFA_HW_P4 && SUPPORT_CFA_HW_P58 && SUPPORT_CFA_HW_P59
-#define SUPPORT_CFA_HW_ALL  1
-#endif
-
 /**
  * Index used for the sram_entries field
  */
drivers/net/bnxt/hcapi/cfa/hcapi_cfa_defs.h renamed from drivers/net/bnxt/hcapi/hcapi_cfa_defs.h +1 -7
similarity index 98%
rename from drivers/net/bnxt/hcapi/hcapi_cfa_defs.h
rename to drivers/net/bnxt/hcapi/cfa/hcapi_cfa_defs.h
index b3d6892b0b..08f098ec86 100644
@@ -17,11 +17,6 @@
 #include <stdint.h>
 #include <stddef.h>
 
-#define SUPPORT_CFA_HW_ALL 0
-#define SUPPORT_CFA_HW_P4  1
-#define SUPPORT_CFA_HW_P58 0
-#define SUPPORT_CFA_HW_P59 0
-
 #define CFA_BITS_PER_BYTE (8)
 #define __CFA_ALIGN_MASK(x, mask) (((x) + (mask)) & ~(mask))
 #define CFA_ALIGN(x, a) __CFA_ALIGN_MASK(x, (a) - 1)
@@ -49,8 +44,7 @@ enum hcapi_cfa_ver {
 	HCAPI_CFA_P40 = 0, /**< CFA phase 4.0 */
 	HCAPI_CFA_P45 = 1, /**< CFA phase 4.5 */
 	HCAPI_CFA_P58 = 2, /**< CFA phase 5.8 */
-	HCAPI_CFA_P59 = 3, /**< CFA phase 5.9 */
-	HCAPI_CFA_PMAX = 4
+	HCAPI_CFA_PMAX = 3
 };
 
 /**
drivers/net/bnxt/hcapi/cfa/hcapi_cfa_p4.c renamed from drivers/net/bnxt/hcapi/hcapi_cfa_p4.c +0 -0
similarity index 100%
rename from drivers/net/bnxt/hcapi/hcapi_cfa_p4.c
rename to drivers/net/bnxt/hcapi/cfa/hcapi_cfa_p4.c
drivers/net/bnxt/hcapi/cfa/hcapi_cfa_p4.h renamed from drivers/net/bnxt/hcapi/hcapi_cfa_p4.h +0 -2
similarity index 99%
rename from drivers/net/bnxt/hcapi/hcapi_cfa_p4.h
rename to drivers/net/bnxt/hcapi/cfa/hcapi_cfa_p4.h
index 305c83bc9f..74a5483c0b 100644
@@ -6,8 +6,6 @@
 #ifndef _HCAPI_CFA_P4_H_
 #define _HCAPI_CFA_P4_H_
 
-#include "cfa_p40_hw.h"
-
 /** CFA phase 4 fix formatted table(layout) ID definition
  *
  */
drivers/net/bnxt/hcapi/cfa/meson.build new file +10 -0
new file mode 100644
index 0000000000..8b70d273f4
@@ -0,0 +1,10 @@
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright(c) 2018 Intel Corporation
+# Copyright(c) 2021 Broadcom
+
+#Include the folder for headers
+includes += include_directories('.')
+
+#Add the source files
+sources += files(
+        'hcapi_cfa_p4.c')
drivers/net/bnxt/hcapi/cfa_p40_hw.h deleted +0 -781

781 lines not on this page · raw message

drivers/net/bnxt/hcapi/cfa_p40_tbl.h deleted +0 -303

303 lines not on this page · raw message

drivers/net/bnxt/meson.build +15 -50

81 lines not on this page · raw message

drivers/net/bnxt/tf_core/meson.build new file +33 -0
new file mode 100644
index 0000000000..b23e0fbe70
@@ -0,0 +1,33 @@
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright(c) 2018 Intel Corporation
+# Copyright(c) 2021 Broadcom
+
+#Include the folder for headers
+includes += include_directories('.')
+
+#Add the source files
+sources += files(
+        'tf_core.c',
+        'bitalloc.c',
+        'tf_msg.c',
+        'rand.c',
+        'stack.c',
+        'tf_em_common.c',
+        'tf_em_internal.c',
+        'tf_rm.c',
+        'tf_tbl.c',
+        'tfp.c',
+        'tf_session.c',
+        'tf_device.c',
+        'tf_device_p4.c',
+        'tf_identifier.c',
+        'tf_shadow_tbl.c',
+        'tf_shadow_tcam.c',
+        'tf_tcam.c',
+        'tf_util.c',
+        'tf_if_tbl.c',
+        'll.c',
+        'tf_global_cfg.c',
+        'tf_em_host.c',
+        'tf_shadow_identifier.c',
+        'tf_hash.c')
drivers/net/bnxt/tf_core/tf_core.h +1 -1
index a47edff1e3..5e458c58fb 100644
@@ -10,7 +10,7 @@
 #include <stdlib.h>
 #include <stdbool.h>
 #include <stdio.h>
-#include "hcapi/hcapi_cfa_defs.h"
+#include "hcapi/cfa/hcapi_cfa_defs.h"
 #include "tf_project.h"
 
 /**
drivers/net/bnxt/tf_core/tf_em.h +1 -1
index 23591272bd..b5c3acb09a 100644
@@ -9,7 +9,7 @@
 #include "tf_core.h"
 #include "tf_session.h"
 
-#include "hcapi/hcapi_cfa_defs.h"
+#include "hcapi/cfa/hcapi_cfa_defs.h"
 
 #define TF_EM_MIN_ENTRIES     (1 << 15) /* 32K */
 #define TF_EM_MAX_ENTRIES     (1 << 27) /* 128M */
drivers/net/bnxt/tf_ulp/meson.build new file +28 -0
new file mode 100644
index 0000000000..98cbdf3177
@@ -0,0 +1,28 @@
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright(c) 2018 Intel Corporation
+# Copyright(c) 2021 Broadcom
+
+#Include the folder for headers
+includes += include_directories('.')
+
+#Add the source files
+sources += files(
+        'bnxt_ulp.c',
+        'ulp_mark_mgr.c',
+        'ulp_flow_db.c',
+        'ulp_template_db_tbl.c',
+        'ulp_template_db_class.c',
+        'ulp_template_db_act.c',
+        'ulp_utils.c',
+        'ulp_mapper.c',
+        'ulp_matcher.c',
+        'ulp_rte_parser.c',
+        'bnxt_ulp_flow.c',
+        'ulp_port_db.c',
+        'ulp_def_rules.c',
+        'ulp_fc_mgr.c',
+        'ulp_tun.c',
+        'ulp_template_db_wh_plus_act.c',
+        'ulp_template_db_wh_plus_class.c',
+        'ulp_template_db_stingray_act.c',
+        'ulp_template_db_stingray_class.c')
Signature · 1 line
2.17.1
#2 lore raw

PATCH 2/58 net/bnxt: add base TRUFLOW support for Thor

In reply to Venkat Duvvuru

From: Farah Smith <[email protected]>

Add infrastructure code to support TRUFLOW on Thor NICs. Also update meson.build

---
 drivers/net/bnxt/tf_core/cfa_resource_types.h |   1 -
 drivers/net/bnxt/tf_core/meson.build          |   1 +
 drivers/net/bnxt/tf_core/tf_core.c            |   1 +
 drivers/net/bnxt/tf_core/tf_device.c          | 207 +++++++++++++
 drivers/net/bnxt/tf_core/tf_device.h          |  24 ++
 drivers/net/bnxt/tf_core/tf_device_p4.c       | 111 ++++++-
 drivers/net/bnxt/tf_core/tf_device_p4.h       |   3 +-
 drivers/net/bnxt/tf_core/tf_device_p58.c      | 284 ++++++++++++++++++
 drivers/net/bnxt/tf_core/tf_device_p58.h      |  79 +++++
 drivers/net/bnxt/tf_core/tf_em_common.c       |   4 +-
 drivers/net/bnxt/tf_core/tf_msg.c             |  33 --
 drivers/net/bnxt/tf_core/tf_rm.c              |   8 +-
 drivers/net/bnxt/tf_core/tf_shadow_tcam.c     |   4 +-
 13 files changed, 711 insertions(+), 49 deletions(-)
 create mode 100644 drivers/net/bnxt/tf_core/tf_device_p58.c
 create mode 100644 drivers/net/bnxt/tf_core/tf_device_p58.h
drivers/net/bnxt/tf_core/cfa_resource_types.h +0 -1
index f55a98a388..b63b87bcf3 100644
@@ -254,5 +254,4 @@
 #define CFA_RESOURCE_TYPE_P4_TBL_SCOPE           0x22UL
 #define CFA_RESOURCE_TYPE_P4_LAST               CFA_RESOURCE_TYPE_P4_TBL_SCOPE
 
-
 #endif /* _CFA_RESOURCE_TYPES_H_ */
drivers/net/bnxt/tf_core/meson.build +1 -0
index b23e0fbe70..d7e8f664fd 100644
@@ -20,6 +20,7 @@ sources += files(
         'tf_session.c',
         'tf_device.c',
         'tf_device_p4.c',
+        'tf_device_p58.c',
         'tf_identifier.c',
         'tf_shadow_tbl.c',
         'tf_shadow_tcam.c',
drivers/net/bnxt/tf_core/tf_core.c +1 -0
index feec3cf459..b1ce4e721c 100644
@@ -35,6 +35,7 @@ tf_open_session(struct tf *tfp,
 	 * firmware open session succeeds.
 	 */
 	if (parms->device_type != TF_DEVICE_TYPE_WH &&
+	    parms->device_type != TF_DEVICE_TYPE_THOR &&
 	    parms->device_type != TF_DEVICE_TYPE_SR) {
 		TFP_DRV_LOG(ERR,
 			    "Unsupported device type %d\n",
drivers/net/bnxt/tf_core/tf_device.c +207 -0

237 lines not on this page · raw message

drivers/net/bnxt/tf_core/tf_device.h +24 -0
index d0c4ec80d0..d5ef72309f 100644
@@ -134,6 +134,28 @@ struct tf_dev_ops {
 	int (*tf_dev_get_max_types)(struct tf *tfp,
 				    uint16_t *max_types);
 
+	/**
+	 * Retrieves the string description for the CFA resource
+	 * type
+	 *
+	 * [in] tfp
+	 *   Pointer to TF handle
+	 *
+	 * [in] resource_id
+	 *   HCAPI cfa resource type id
+	 *
+	 * [out] resource_str
+	 *   Pointer to a string
+	 *
+	 * Returns
+	 *   - (0) if successful.
+	 *   - (-EINVAL) on failure.
+	 */
+	int (*tf_dev_get_resource_str)(struct tf *tfp,
+				       uint16_t resource_id,
+				       const char **resource_str);
+
+
 	/**
 	 * Retrieves the WC TCAM slice information that the device
 	 * supports.
@@ -709,5 +731,7 @@ struct tf_dev_ops {
  */
 extern const struct tf_dev_ops tf_dev_ops_p4_init;
 extern const struct tf_dev_ops tf_dev_ops_p4;
+extern const struct tf_dev_ops tf_dev_ops_p58_init;
+extern const struct tf_dev_ops tf_dev_ops_p58;
 
 #endif /* _TF_DEVICE_H_ */
drivers/net/bnxt/tf_core/tf_device_p4.c +109 -2

148 lines not on this page · raw message

drivers/net/bnxt/tf_core/tf_device_p4.h +1 -2
index 81ed2322d1..bfad02a0b8 100644
@@ -6,8 +6,7 @@
 #ifndef _TF_DEVICE_P4_H_
 #define _TF_DEVICE_P4_H_
 
-#include <cfa_resource_types.h>
-
+#include "cfa_resource_types.h"
 #include "tf_core.h"
 #include "tf_rm.h"
 #include "tf_if_tbl.h"
drivers/net/bnxt/tf_core/tf_device_p58.c new file +284 -0

284 lines not on this page · raw message

drivers/net/bnxt/tf_core/tf_device_p58.h new file +79 -0

79 lines not on this page · raw message

drivers/net/bnxt/tf_core/tf_em_common.c +2 -2
index c4137af2bd..ddc6b3c4dd 100644
@@ -1115,8 +1115,8 @@ int tf_em_ext_map_tbl_scope(struct tf *tfp,
 		goto cleaner;
 	}
 
-	gcfg_parms.type =
-		(enum tf_global_config_type)TF_GLOBAL_CFG_INTERNAL_PARIF_2_PF;
+	/* Note that TF_GLOBAL_CFG_INTERNAL_PARIF_2_PF is same as below enum */
+	gcfg_parms.type = TF_GLOBAL_CFG_TYPE_MAX;
 	gcfg_parms.offset = 0;
 	gcfg_parms.config = (uint8_t *)data;
 	gcfg_parms.config_mask = (uint8_t *)mask;
drivers/net/bnxt/tf_core/tf_msg.c +0 -33
index 46fc6288b2..f20a5113bf 100644
@@ -19,9 +19,6 @@
 #include "hwrm_tf.h"
 #include "tf_em.h"
 
-/* Logging defines */
-#define TF_RM_MSG_DEBUG  0
-
 /* Specific msg size defines as we cannot use defines in tf.yaml. This
  * means we have to manually sync hwrm with these defines if the
  * tf.yaml changes.
@@ -361,29 +358,13 @@ tf_msg_session_resc_qcaps(struct tf *tfp,
 		goto cleanup;
 	}
 
-#if (TF_RM_MSG_DEBUG == 1)
-	printf("size: %d\n", tfp_le_to_cpu_32(resp.size));
-#endif /* (TF_RM_MSG_DEBUG == 1) */
-
 	/* Post process the response */
 	data = (struct tf_rm_resc_req_entry *)qcaps_buf.va_addr;
 
-#if (TF_RM_MSG_DEBUG == 1)
-	printf("\nQCAPS\n");
-#endif /* (TF_RM_MSG_DEBUG == 1) */
 	for (i = 0; i < size; i++) {
 		query[i].type = tfp_le_to_cpu_32(data[i].type);
 		query[i].min = tfp_le_to_cpu_16(data[i].min);
 		query[i].max = tfp_le_to_cpu_16(data[i].max);
-
-#if (TF_RM_MSG_DEBUG == 1)
-		printf("type: %d(0x%x) %d %d\n",
-		       query[i].type,
-		       query[i].type,
-		       query[i].min,
-		       query[i].max);
-#endif /* (TF_RM_MSG_DEBUG == 1) */
-
 	}
 
 	*resv_strategy = resp.flags &
@@ -476,26 +457,12 @@ tf_msg_session_resc_alloc(struct tf *tfp,
 		goto cleanup;
 	}
 
-#if (TF_RM_MSG_DEBUG == 1)
-	printf("\nRESV\n");
-	printf("size: %d\n", tfp_le_to_cpu_32(resp.size));
-#endif /* (TF_RM_MSG_DEBUG == 1) */
-
 	/* Post process the response */
 	resv_data = (struct tf_rm_resc_entry *)resv_buf.va_addr;
 	for (i = 0; i < size; i++) {
 		resv[i].type = tfp_le_to_cpu_32(resv_data[i].type);
 		resv[i].start = tfp_le_to_cpu_16(resv_data[i].start);
 		resv[i].stride = tfp_le_to_cpu_16(resv_data[i].stride);
-
-#if (TF_RM_MSG_DEBUG == 1)
-		printf("%d type: %d(0x%x) %d %d\n",
-		       i,
-		       resv[i].type,
-		       resv[i].type,
-		       resv[i].start,
-		       resv[i].stride);
-#endif /* (TF_RM_MSG_DEBUG == 1) */
 	}
 
 cleanup:
drivers/net/bnxt/tf_core/tf_rm.c +1 -7
index 887a3dccf8..f93a6d9018 100644
@@ -6,6 +6,7 @@
 #include <string.h>
 
 #include <rte_common.h>
+#include <rte_debug.h>
 
 #include <cfa_resource_types.h>
 
@@ -596,13 +597,6 @@ tf_rm_create_db(struct tf *tfp,
 	rm_db->type = parms->type;
 	*parms->rm_db = (void *)rm_db;
 
-#if (TF_RM_DEBUG == 1)
-	printf("%s: type:%d num_entries:%d\n",
-	       tf_dir_2_str(parms->dir),
-	       parms->type,
-	       i);
-#endif /* (TF_RM_DEBUG == 1) */
-
 	tfp_free((void *)req);
 	tfp_free((void *)resv);
 
drivers/net/bnxt/tf_core/tf_shadow_tcam.c +2 -2
index 38b1e7687b..523261f189 100644
@@ -6,6 +6,7 @@
 #include "tf_common.h"
 #include "tf_util.h"
 #include "tfp.h"
+#include "tf_tcam.h"
 #include "tf_shadow_tcam.h"
 #include "tf_hash.h"
 
@@ -634,8 +635,7 @@ tf_shadow_tcam_search(struct tf_shadow_tcam_search_parms *parms)
 			 * requested allocation and return the info
 			 */
 			if (sparms->alloc)
-				ctxt->shadow_ctxt.sh_res_tbl[shtbl_key].refcnt =
-			ctxt->shadow_ctxt.sh_res_tbl[shtbl_key].refcnt + 1;
+				ctxt->shadow_ctxt.sh_res_tbl[shtbl_key].refcnt++;
 
 			sparms->hit = 1;
 			sparms->search_status = HIT;
Signature · 1 line
2.17.1
#3 lore raw

PATCH 3/58 net/bnxt: add mailbox selection via dev op

In reply to Venkat Duvvuru

From: Peter Spreadborough <[email protected]>

Add get mailbox dev op so that mailbox offset is based on device rather than hard coded.

---
 drivers/net/bnxt/tf_core/tf_device.c     |  21 ++
 drivers/net/bnxt/tf_core/tf_device.h     |  12 +
 drivers/net/bnxt/tf_core/tf_device_p4.c  |   8 +
 drivers/net/bnxt/tf_core/tf_device_p58.c |   7 +
 drivers/net/bnxt/tf_core/tf_msg.c        | 410 +++++++++++++++++++++--
 drivers/net/bnxt/tf_core/tf_msg.h        |  12 +-
 drivers/net/bnxt/tf_core/tf_rm.c         |   2 +
 drivers/net/bnxt/tf_core/tf_session.c    |  22 +-
 drivers/net/bnxt/tf_core/tf_tcam.c       |   4 +-
 9 files changed, 463 insertions(+), 35 deletions(-)
drivers/net/bnxt/tf_core/tf_device.c +21 -0
index 9c63f6d5d4..5116601a69 100644
@@ -461,6 +461,27 @@ tf_dev_bind(struct tf *tfp __rte_unused,
 	}
 }
 
+int
+tf_dev_bind_ops(enum tf_device_type type,
+		struct tf_dev_info *dev_handle)
+{
+	switch (type) {
+	case TF_DEVICE_TYPE_WH:
+	case TF_DEVICE_TYPE_SR:
+		dev_handle->ops = &tf_dev_ops_p4;
+		break;
+	case TF_DEVICE_TYPE_THOR:
+		dev_handle->ops = &tf_dev_ops_p58;
+		break;
+	default:
+		TFP_DRV_LOG(ERR,
+			    "No such device\n");
+		return -ENODEV;
+	}
+
+	return 0;
+}
+
 int
 tf_dev_unbind(struct tf *tfp,
 	      struct tf_dev_info *dev_handle)
drivers/net/bnxt/tf_core/tf_device.h +12 -0
index d5ef72309f..cbacc09ea5 100644
@@ -108,6 +108,10 @@ int tf_dev_bind(struct tf *tfp,
 int tf_dev_unbind(struct tf *tfp,
 		  struct tf_dev_info *dev_handle);
 
+int
+tf_dev_bind_ops(enum tf_device_type type,
+		struct tf_dev_info *dev_handle);
+
 /**
  * Truflow device specific function hooks structure
  *
@@ -724,6 +728,14 @@ struct tf_dev_ops {
 	 */
 	int (*tf_dev_get_global_cfg)(struct tf *tfp,
 				     struct tf_global_cfg_parms *parms);
+
+	/**
+	 * Get mailbox
+	 *
+	 *    returns:
+	 *      mailbox
+	 */
+	int (*tf_dev_get_mailbox)(void);
 };
 
 /**
drivers/net/bnxt/tf_core/tf_device_p4.c +8 -0
index 257a0fb2d0..6b28f6ce59 100644
@@ -13,6 +13,7 @@
 #include "tf_em.h"
 #include "tf_if_tbl.h"
 #include "tfp.h"
+#include "tf_msg_common.h"
 
 #define TF_DEV_P4_PARIF_MAX 16
 #define TF_DEV_P4_PF_MASK 0xfUL
@@ -241,6 +242,11 @@ tf_dev_p4_map_parif(struct tf *tfp __rte_unused,
 	return 0;
 }
 
+static int tf_dev_p4_get_mailbox(void)
+{
+	return TF_KONG_MB;
+}
+
 
 /**
  * Truflow P4 device specific functions
@@ -278,6 +284,7 @@ const struct tf_dev_ops tf_dev_ops_p4_init = {
 	.tf_dev_get_if_tbl = NULL,
 	.tf_dev_set_global_cfg = NULL,
 	.tf_dev_get_global_cfg = NULL,
+	.tf_dev_get_mailbox = tf_dev_p4_get_mailbox,
 };
 
 /**
@@ -316,4 +323,5 @@ const struct tf_dev_ops tf_dev_ops_p4 = {
 	.tf_dev_get_if_tbl = tf_if_tbl_get,
 	.tf_dev_set_global_cfg = tf_global_cfg_set,
 	.tf_dev_get_global_cfg = tf_global_cfg_get,
+	.tf_dev_get_mailbox = tf_dev_p4_get_mailbox,
 };
drivers/net/bnxt/tf_core/tf_device_p58.c +7 -0
index fb5ad29a5c..b4530f8762 100644
@@ -13,6 +13,7 @@
 #include "tf_em.h"
 #include "tf_if_tbl.h"
 #include "tfp.h"
+#include "tf_msg_common.h"
 
 #define TF_DEV_P58_PARIF_MAX 16
 #define TF_DEV_P58_PF_MASK 0xfUL
@@ -206,6 +207,10 @@ tf_dev_p58_map_parif(struct tf *tfp __rte_unused,
 	return 0;
 }
 
+static int tf_dev_p58_get_mailbox(void)
+{
+	return TF_CHIMP_MB;
+}
 
 /**
  * Truflow P58 device specific functions
@@ -243,6 +248,7 @@ const struct tf_dev_ops tf_dev_ops_p58_init = {
 	.tf_dev_get_if_tbl = NULL,
 	.tf_dev_set_global_cfg = NULL,
 	.tf_dev_get_global_cfg = NULL,
+	.tf_dev_get_mailbox = tf_dev_p58_get_mailbox,
 };
 
 /**
@@ -281,4 +287,5 @@ const struct tf_dev_ops tf_dev_ops_p58 = {
 	.tf_dev_get_if_tbl = tf_if_tbl_get,
 	.tf_dev_set_global_cfg = tf_global_cfg_set,
 	.tf_dev_get_global_cfg = tf_global_cfg_get,
+	.tf_dev_get_mailbox = tf_dev_p58_get_mailbox,
 };
drivers/net/bnxt/tf_core/tf_msg.c +383 -27

737 lines not on this page · raw message

drivers/net/bnxt/tf_core/tf_msg.h +10 -2
index 0a2566010c..25e29a554f 100644
@@ -36,7 +36,8 @@ struct tf;
 int tf_msg_session_open(struct tf *tfp,
 			char *ctrl_chan_name,
 			uint8_t *fw_session_id,
-			uint8_t *fw_session_client_id);
+			uint8_t *fw_session_client_id,
+			struct tf_dev_info *dev);
 
 /**
  * Sends session close request to Firmware
@@ -75,6 +76,7 @@ int tf_msg_session_attach(struct tf *tfp,
  *   0 on Success else internal Truflow error
  */
 int tf_msg_session_client_register(struct tf *tfp,
+				   struct tf_session *tfs,
 				   char *ctrl_channel_name,
 				   uint8_t *fw_session_client_id);
 
@@ -92,6 +94,7 @@ int tf_msg_session_client_register(struct tf *tfp,
  *   0 on Success else internal Truflow error
  */
 int tf_msg_session_client_unregister(struct tf *tfp,
+				     struct tf_session *tfs,
 				     uint8_t fw_session_client_id);
 
 /**
@@ -103,7 +106,8 @@ int tf_msg_session_client_unregister(struct tf *tfp,
  * Returns:
  *   0 on Success else internal Truflow error
  */
-int tf_msg_session_close(struct tf *tfp);
+int tf_msg_session_close(struct tf *tfp,
+			 struct tf_session *tfs);
 
 /**
  * Sends session query config request to TF Firmware
@@ -139,6 +143,7 @@ int tf_msg_session_qcfg(struct tf *tfp);
  *   0 on Success else internal Truflow error
  */
 int tf_msg_session_resc_qcaps(struct tf *tfp,
+			      struct tf_dev_info *dev,
 			      enum tf_dir dir,
 			      uint16_t size,
 			      struct tf_rm_resc_req_entry *query,
@@ -166,6 +171,7 @@ int tf_msg_session_resc_qcaps(struct tf *tfp,
  *   0 on Success else internal Truflow error
  */
 int tf_msg_session_resc_alloc(struct tf *tfp,
+			      struct tf_dev_info *dev,
 			      enum tf_dir dir,
 			      uint16_t size,
 			      struct tf_rm_resc_req_entry *request,
@@ -368,6 +374,7 @@ int tf_msg_em_op(struct tf *tfp,
  *  0 on Success else internal Truflow error
  */
 int tf_msg_tcam_entry_set(struct tf *tfp,
+			  struct tf_dev_info *dev,
 			  struct tf_tcam_set_parms *parms);
 
 /**
@@ -383,6 +390,7 @@ int tf_msg_tcam_entry_set(struct tf *tfp,
  *  0 on Success else internal Truflow error
  */
 int tf_msg_tcam_entry_free(struct tf *tfp,
+			   struct tf_dev_info *dev,
 			   struct tf_tcam_free_parms *parms);
 
 /**
drivers/net/bnxt/tf_core/tf_rm.c +2 -0
index f93a6d9018..2c08fb80fe 100644
@@ -415,6 +415,7 @@ tf_rm_create_db(struct tf *tfp,
 
 	/* Get Firmware Capabilities */
 	rc = tf_msg_session_resc_qcaps(tfp,
+				       dev,
 				       parms->dir,
 				       max_types,
 				       query,
@@ -499,6 +500,7 @@ tf_rm_create_db(struct tf *tfp,
 	}
 
 	rc = tf_msg_session_resc_alloc(tfp,
+				       dev,
 				       parms->dir,
 				       hcapi_items,
 				       req,
drivers/net/bnxt/tf_core/tf_session.c +18 -4
index 6335ad358c..b3fa7e13ff 100644
@@ -56,14 +56,19 @@ tf_session_create(struct tf *tfp,
 	uint8_t fw_session_id;
 	uint8_t fw_session_client_id;
 	union tf_session_id *session_id;
+	struct tf_dev_info dev;
 
 	TF_CHECK_PARMS2(tfp, parms);
 
+	tf_dev_bind_ops(parms->open_cfg->device_type,
+			&dev);
+
 	/* Open FW session and get a new session_id */
 	rc = tf_msg_session_open(tfp,
 				 parms->open_cfg->ctrl_chan_name,
 				 &fw_session_id,
-				 &fw_session_client_id);
+				 &fw_session_client_id,
+				 &dev);
 	if (rc) {
 		/* Log error */
 		if (rc == -EEXIST)
@@ -177,6 +182,13 @@ tf_session_create(struct tf *tfp,
 	if (rc)
 		return rc;
 
+	if (session->dev.ops->tf_dev_get_mailbox == NULL) {
+		/* Log error */
+		TFP_DRV_LOG(ERR,
+			    "No tf_dev_get_mailbox() defined for device\n");
+		goto cleanup;
+	}
+
 	session->dev_init = true;
 
 	return 0;
@@ -234,8 +246,9 @@ tf_session_client_create(struct tf *tfp,
 
 	rc = tf_msg_session_client_register
 		    (tfp,
-		    parms->ctrl_chan_name,
-		    &session_client_id.internal.fw_session_client_id);
+		     session,
+		     parms->ctrl_chan_name,
+		     &session_client_id.internal.fw_session_client_id);
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to create client on session, rc:%s\n",
@@ -346,6 +359,7 @@ tf_session_client_destroy(struct tf *tfp,
 
 	rc = tf_msg_session_client_unregister
 			(tfp,
+			tfs,
 			parms->session_client_id.internal.fw_session_client_id);
 
 	/* Log error, but continue. If FW fails we do not really have
@@ -534,7 +548,7 @@ tf_session_close_session(struct tf *tfp,
 			    strerror(-rc));
 	}
 
-	rc = tf_msg_session_close(tfp);
+	rc = tf_msg_session_close(tfp, tfs);
 	if (rc) {
 		/* Log error */
 		TFP_DRV_LOG(ERR,
drivers/net/bnxt/tf_core/tf_tcam.c +2 -2
index 22bc01c95d..038aa40e92 100644
@@ -428,7 +428,7 @@ tf_tcam_free(struct tf *tfp,
 	if (rc)
 		return rc;
 
-	rc = tf_msg_tcam_entry_free(tfp, parms);
+	rc = tf_msg_tcam_entry_free(tfp, dev, parms);
 	if (rc) {
 		/* Log error */
 		TFP_DRV_LOG(ERR,
@@ -652,7 +652,7 @@ tf_tcam_set(struct tf *tfp __rte_unused,
 	if (rc)
 		return rc;
 
-	rc = tf_msg_tcam_entry_set(tfp, parms);
+	rc = tf_msg_tcam_entry_set(tfp, dev, parms);
 	if (rc) {
 		/* Log error */
 		TFP_DRV_LOG(ERR,
Signature · 1 line
2.17.1
#4 lore raw

PATCH 4/58 net/bnxt: check resource reservation in TRUFLOW

In reply to Venkat Duvvuru

From: Jay Ding <[email protected]>

- Allow tf_open to continue if no resource is allocated for some table type.
- Close the session if binding fails for any table.
- Close the session if no resource is allocated for all tables.

---
 drivers/net/bnxt/tf_core/tf_device.c  | 284 +++++++++++++++++++-------
 drivers/net/bnxt/tf_core/tf_session.c |   2 +-
 2 files changed, 207 insertions(+), 79 deletions(-)
drivers/net/bnxt/tf_core/tf_device.c +206 -78
index 5116601a69..d4c93439ec 100644
@@ -15,6 +15,44 @@ struct tf;
 static int tf_dev_unbind_p4(struct tf *tfp);
 static int tf_dev_unbind_p58(struct tf *tfp);
 
+/**
+ * Resource Reservation Check function
+ *
+ * [in] tfp
+ *   Pointer to TF handle
+ *
+ * [in] cfg
+ *   Pointer to rm element config
+ *
+ * [in] reservations
+ *   Pointer to resource reservation array
+ *
+ * Returns
+ *   - (n) number of tables that have non-zero reservation count.
+ */
+static int
+tf_dev_reservation_check(struct tf *tfp __rte_unused,
+			 uint16_t count,
+			 struct tf_rm_element_cfg *cfg,
+			 uint16_t *reservations)
+{
+	uint16_t cnt = 0;
+	uint16_t *rm_num;
+	int i, j;
+
+	for (i = 0; i < TF_DIR_MAX; i++) {
+		rm_num = (uint16_t *)reservations + i * count;
+		for (j = 0; j < count; j++) {
+			if ((cfg[j].cfg_type == TF_RM_ELEM_CFG_HCAPI ||
+			     cfg[j].cfg_type == TF_RM_ELEM_CFG_HCAPI_BA) &&
+			     rm_num[j] > 0)
+				cnt++;
+		}
+	}
+
+	return cnt;
+}
+
 /**
  * Device specific bind function, WH+
  *
@@ -42,6 +80,8 @@ tf_dev_bind_p4(struct tf *tfp,
 {
 	int rc;
 	int frc;
+	int rsv_cnt;
+	bool no_rsv_flag = true;
 	struct tf_ident_cfg_parms ident_cfg;
 	struct tf_tbl_cfg_parms tbl_cfg;
 	struct tf_tcam_cfg_parms tcam_cfg;
@@ -54,69 +94,117 @@ tf_dev_bind_p4(struct tf *tfp,
 
 	/* Initialize the modules */
 
-	ident_cfg.num_elements = TF_IDENT_TYPE_MAX;
-	ident_cfg.cfg = tf_ident_p4;
-	ident_cfg.shadow_copy = shadow_copy;
-	ident_cfg.resources = resources;
-	rc = tf_ident_bind(tfp, &ident_cfg);
-	if (rc) {
-		TFP_DRV_LOG(ERR,
-			    "Identifier initialization failure\n");
-		goto fail;
+	rsv_cnt = tf_dev_reservation_check(tfp,
+					   TF_IDENT_TYPE_MAX,
+					   tf_ident_p4,
+					   (uint16_t *)resources->ident_cnt);
+	if (rsv_cnt) {
+		ident_cfg.num_elements = TF_IDENT_TYPE_MAX;
+		ident_cfg.cfg = tf_ident_p4;
+		ident_cfg.shadow_copy = shadow_copy;
+		ident_cfg.resources = resources;
+		rc = tf_ident_bind(tfp, &ident_cfg);
+		if (rc) {
+			TFP_DRV_LOG(ERR,
+				    "Identifier initialization failure\n");
+			goto fail;
+		}
+
+		no_rsv_flag = false;
 	}
 
-	tbl_cfg.num_elements = TF_TBL_TYPE_MAX;
-	tbl_cfg.cfg = tf_tbl_p4;
-	tbl_cfg.shadow_copy = shadow_copy;
-	tbl_cfg.resources = resources;
-	rc = tf_tbl_bind(tfp, &tbl_cfg);
-	if (rc) {
-		TFP_DRV_LOG(ERR,
-			    "Table initialization failure\n");
-		goto fail;
+	rsv_cnt = tf_dev_reservation_check(tfp,
+					   TF_TBL_TYPE_MAX,
+					   tf_tbl_p4,
+					   (uint16_t *)resources->tbl_cnt);
+	if (rsv_cnt) {
+		tbl_cfg.num_elements = TF_TBL_TYPE_MAX;
+		tbl_cfg.cfg = tf_tbl_p4;
+		tbl_cfg.shadow_copy = shadow_copy;
+		tbl_cfg.resources = resources;
+		rc = tf_tbl_bind(tfp, &tbl_cfg);
+		if (rc) {
+			TFP_DRV_LOG(ERR,
+				    "Table initialization failure\n");
+			goto fail;
+		}
+
+		no_rsv_flag = false;
 	}
 
-	tcam_cfg.num_elements = TF_TCAM_TBL_TYPE_MAX;
-	tcam_cfg.cfg = tf_tcam_p4;
-	tcam_cfg.shadow_copy = shadow_copy;
-	tcam_cfg.resources = resources;
-	rc = tf_tcam_bind(tfp, &tcam_cfg);
-	if (rc) {
-		TFP_DRV_LOG(ERR,
-			    "TCAM initialization failure\n");
-		goto fail;
+	rsv_cnt = tf_dev_reservation_check(tfp,
+					   TF_TCAM_TBL_TYPE_MAX,
+					   tf_tcam_p4,
+					   (uint16_t *)resources->tcam_cnt);
+	if (rsv_cnt) {
+		tcam_cfg.num_elements = TF_TCAM_TBL_TYPE_MAX;
+		tcam_cfg.cfg = tf_tcam_p4;
+		tcam_cfg.shadow_copy = shadow_copy;
+		tcam_cfg.resources = resources;
+		rc = tf_tcam_bind(tfp, &tcam_cfg);
+		if (rc) {
+			TFP_DRV_LOG(ERR,
+				    "TCAM initialization failure\n");
+			goto fail;
+		}
+		no_rsv_flag = false;
 	}
 
 	/*
 	 * EEM
 	 */
-	em_cfg.num_elements = TF_EM_TBL_TYPE_MAX;
 	if (dev_handle->type == TF_DEVICE_TYPE_WH)
 		em_cfg.cfg = tf_em_ext_p4;
 	else
 		em_cfg.cfg = tf_em_ext_p45;
-	em_cfg.resources = resources;
-	em_cfg.mem_type = TF_EEM_MEM_TYPE_HOST;
-	rc = tf_em_ext_common_bind(tfp, &em_cfg);
-	if (rc) {
-		TFP_DRV_LOG(ERR,
-			    "EEM initialization failure\n");
-		goto fail;
+
+	rsv_cnt = tf_dev_reservation_check(tfp,
+					   TF_EM_TBL_TYPE_MAX,
+					   em_cfg.cfg,
+					   (uint16_t *)resources->em_cnt);
+	if (rsv_cnt) {
+		em_cfg.num_elements = TF_EM_TBL_TYPE_MAX;
+		em_cfg.resources = resources;
+		em_cfg.mem_type = TF_EEM_MEM_TYPE_HOST;
+		rc = tf_em_ext_common_bind(tfp, &em_cfg);
+		if (rc) {
+			TFP_DRV_LOG(ERR,
+				    "EEM initialization failure\n");
+			goto fail;
+		}
+		no_rsv_flag = false;
 	}
 
 	/*
 	 * EM
 	 */
-	em_cfg.num_elements = TF_EM_TBL_TYPE_MAX;
-	em_cfg.cfg = tf_em_int_p4;
-	em_cfg.resources = resources;
-	em_cfg.mem_type = 0; /* Not used by EM */
+	rsv_cnt = tf_dev_reservation_check(tfp,
+					   TF_EM_TBL_TYPE_MAX,
+					   tf_em_int_p4,
+					   (uint16_t *)resources->em_cnt);
+	if (rsv_cnt) {
+		em_cfg.num_elements = TF_EM_TBL_TYPE_MAX;
+		em_cfg.cfg = tf_em_int_p4;
+		em_cfg.resources = resources;
+		em_cfg.mem_type = 0; /* Not used by EM */
+
+		rc = tf_em_int_bind(tfp, &em_cfg);
+		if (rc) {
+			TFP_DRV_LOG(ERR,
+				    "EM initialization failure\n");
+			goto fail;
+		}
+		no_rsv_flag = false;
+	}
 
-	rc = tf_em_int_bind(tfp, &em_cfg);
-	if (rc) {
+	/*
+	 * There is no rm reserved for any tables
+	 *
+	 */
+	if (no_rsv_flag) {
 		TFP_DRV_LOG(ERR,
-			    "EM initialization failure\n");
-		goto fail;
+			    "No rm reserved for any tables\n");
+		return -ENOMEM;
 	}
 
 	/*
@@ -263,6 +351,8 @@ tf_dev_bind_p58(struct tf *tfp,
 {
 	int rc;
 	int frc;
+	int rsv_cnt;
+	bool no_rsv_flag = true;
 	struct tf_ident_cfg_parms ident_cfg;
 	struct tf_tbl_cfg_parms tbl_cfg;
 	struct tf_tcam_cfg_parms tcam_cfg;
@@ -275,52 +365,90 @@ tf_dev_bind_p58(struct tf *tfp,
 
 	/* Initialize the modules */
 
-	ident_cfg.num_elements = TF_IDENT_TYPE_MAX;
-	ident_cfg.cfg = tf_ident_p58;
-	ident_cfg.shadow_copy = shadow_copy;
-	ident_cfg.resources = resources;
-	rc = tf_ident_bind(tfp, &ident_cfg);
-	if (rc) {
-		TFP_DRV_LOG(ERR,
-			    "Identifier initialization failure\n");
-		goto fail;
+	rsv_cnt = tf_dev_reservation_check(tfp,
+					   TF_IDENT_TYPE_MAX,
+					   tf_ident_p58,
+					   (uint16_t *)resources->ident_cnt);
+	if (rsv_cnt) {
+		ident_cfg.num_elements = TF_IDENT_TYPE_MAX;
+		ident_cfg.cfg = tf_ident_p58;
+		ident_cfg.shadow_copy = shadow_copy;
+		ident_cfg.resources = resources;
+		rc = tf_ident_bind(tfp, &ident_cfg);
+		if (rc) {
+			TFP_DRV_LOG(ERR,
+				    "Identifier initialization failure\n");
+			goto fail;
+		}
+		no_rsv_flag = false;
 	}
 
-	tbl_cfg.num_elements = TF_TBL_TYPE_MAX;
-	tbl_cfg.cfg = tf_tbl_p58;
-	tbl_cfg.shadow_copy = shadow_copy;
-	tbl_cfg.resources = resources;
-	rc = tf_tbl_bind(tfp, &tbl_cfg);
-	if (rc) {
-		TFP_DRV_LOG(ERR,
-			    "Table initialization failure\n");
-		goto fail;
+	rsv_cnt = tf_dev_reservation_check(tfp,
+					   TF_TBL_TYPE_MAX,
+					   tf_tbl_p58,
+					   (uint16_t *)resources->tbl_cnt);
+	if (rsv_cnt) {
+		tbl_cfg.num_elements = TF_TBL_TYPE_MAX;
+		tbl_cfg.cfg = tf_tbl_p58;
+		tbl_cfg.shadow_copy = shadow_copy;
+		tbl_cfg.resources = resources;
+		rc = tf_tbl_bind(tfp, &tbl_cfg);
+		if (rc) {
+			TFP_DRV_LOG(ERR,
+				    "Table initialization failure\n");
+			goto fail;
+		}
+		no_rsv_flag = false;
 	}
 
-	tcam_cfg.num_elements = TF_TCAM_TBL_TYPE_MAX;
-	tcam_cfg.cfg = tf_tcam_p58;
-	tcam_cfg.shadow_copy = shadow_copy;
-	tcam_cfg.resources = resources;
-	rc = tf_tcam_bind(tfp, &tcam_cfg);
-	if (rc) {
-		TFP_DRV_LOG(ERR,
-			    "TCAM initialization failure\n");
-		goto fail;
+	rsv_cnt = tf_dev_reservation_check(tfp,
+					   TF_TCAM_TBL_TYPE_MAX,
+					   tf_tcam_p58,
+					   (uint16_t *)resources->tcam_cnt);
+	if (rsv_cnt) {
+		tcam_cfg.num_elements = TF_TCAM_TBL_TYPE_MAX;
+		tcam_cfg.cfg = tf_tcam_p58;
+		tcam_cfg.shadow_copy = shadow_copy;
+		tcam_cfg.resources = resources;
+		rc = tf_tcam_bind(tfp, &tcam_cfg);
+		if (rc) {
+			TFP_DRV_LOG(ERR,
+				    "TCAM initialization failure\n");
+			goto fail;
+		}
+		no_rsv_flag = false;
 	}
 
 	/*
 	 * EM
 	 */
-	em_cfg.num_elements = TF_EM_TBL_TYPE_MAX;
-	em_cfg.cfg = tf_em_int_p58;
-	em_cfg.resources = resources;
-	em_cfg.mem_type = 0; /* Not used by EM */
+	rsv_cnt = tf_dev_reservation_check(tfp,
+					   TF_EM_TBL_TYPE_MAX,
+					   tf_em_int_p58,
+					   (uint16_t *)resources->em_cnt);
+	if (rsv_cnt) {
+		em_cfg.num_elements = TF_EM_TBL_TYPE_MAX;
+		em_cfg.cfg = tf_em_int_p58;
+		em_cfg.resources = resources;
+		em_cfg.mem_type = 0; /* Not used by EM */
+
+		rc = tf_em_int_bind(tfp, &em_cfg);
+		if (rc) {
+			TFP_DRV_LOG(ERR,
+				    "EM initialization failure\n");
+			goto fail;
+		}
+		no_rsv_flag = false;
+	}
 
-	rc = tf_em_int_bind(tfp, &em_cfg);
-	if (rc) {
+	/*
+	 * There is no rm reserved for any tables
+	 *
+	 */
+	if (no_rsv_flag) {
 		TFP_DRV_LOG(ERR,
-			    "EM initialization failure\n");
-		goto fail;
+			    "No rm reserved for any tables\n");
+		return -ENOMEM;
 	}
 
 	/*
drivers/net/bnxt/tf_core/tf_session.c +1 -1
index b3fa7e13ff..d2b24f5e20 100644
@@ -180,7 +180,7 @@ tf_session_create(struct tf *tfp,
 			 &session->dev);
 	/* Logging handled by dev_bind */
 	if (rc)
-		return rc;
+		goto cleanup;
 
 	if (session->dev.ops->tf_dev_get_mailbox == NULL) {
 		/* Log error */
Signature · 1 line
2.17.1
#5 lore raw

PATCH 5/58 net/bnxt: update TRUFLOW resources

In reply to Venkat Duvvuru

From: Farah Smith <[email protected]>

- Remove unused tables from tf_tbl_type
- Encode flow type into flow handle (internal or external)
- Clean up Whitney resource tables
- Clean up Truflow CLI open tables and update Thor resources
- Add Thor SRAM and external pool types to core API
- Remove unneeded Stingray table reference

---
 drivers/net/bnxt/tf_core/tf_core.c            |   9 +-
 drivers/net/bnxt/tf_core/tf_core.h            |  83 +++++----
 drivers/net/bnxt/tf_core/tf_device.c          |   5 +-
 drivers/net/bnxt/tf_core/tf_device_p4.c       | 105 ++++-------
 drivers/net/bnxt/tf_core/tf_device_p4.h       | 175 ++++++++++--------
 drivers/net/bnxt/tf_core/tf_device_p45.h      | 105 -----------
 drivers/net/bnxt/tf_core/tf_device_p58.c      |  61 +++---
 drivers/net/bnxt/tf_core/tf_device_p58.h      |   6 +
 drivers/net/bnxt/tf_core/tf_em_common.c       |   2 +-
 drivers/net/bnxt/tf_core/tf_em_internal.c     |   2 +-
 drivers/net/bnxt/tf_core/tf_ext_flow_handle.h |  15 +-
 drivers/net/bnxt/tf_core/tf_msg.c             |   3 +-
 drivers/net/bnxt/tf_core/tf_rm.c              |  14 +-
 drivers/net/bnxt/tf_core/tf_shadow_tbl.c      |   2 -
 drivers/net/bnxt/tf_core/tf_util.c            |   8 +-
 15 files changed, 246 insertions(+), 349 deletions(-)
 delete mode 100644 drivers/net/bnxt/tf_core/tf_device_p45.h
drivers/net/bnxt/tf_core/tf_core.c +5 -4
index b1ce4e721c..ebe0fc34aa 100644
@@ -19,6 +19,7 @@
 #include "rand.h"
 #include "tf_common.h"
 #include "hwrm_tf.h"
+#include "tf_ext_flow_handle.h"
 
 int
 tf_open_session(struct tf *tfp,
@@ -251,6 +252,7 @@ int tf_delete_em_entry(struct tf *tfp,
 	struct tf_session      *tfs;
 	struct tf_dev_info     *dev;
 	int rc;
+	unsigned int flag = 0;
 
 	TF_CHECK_PARMS2(tfp, parms);
 
@@ -274,12 +276,11 @@ int tf_delete_em_entry(struct tf *tfp,
 		return rc;
 	}
 
-	if (parms->mem == TF_MEM_EXTERNAL)
-		rc = dev->ops->tf_dev_delete_ext_em_entry(tfp, parms);
-	else if (parms->mem == TF_MEM_INTERNAL)
+	TF_GET_FLAG_FROM_FLOW_HANDLE(parms->flow_handle, flag);
+	if ((flag & TF_FLAGS_FLOW_HANDLE_INTERNAL))
 		rc = dev->ops->tf_dev_delete_int_em_entry(tfp, parms);
 	else
-		return -EINVAL;
+		rc = dev->ops->tf_dev_delete_ext_em_entry(tfp, parms);
 
 	if (rc) {
 		TFP_DRV_LOG(ERR,
drivers/net/bnxt/tf_core/tf_core.h +51 -32

161 lines not on this page · raw message

drivers/net/bnxt/tf_core/tf_device.c +1 -4
index d4c93439ec..d072b9877c 100644
@@ -153,11 +153,8 @@ tf_dev_bind_p4(struct tf *tfp,
 	/*
 	 * EEM
 	 */
-	if (dev_handle->type == TF_DEVICE_TYPE_WH)
-		em_cfg.cfg = tf_em_ext_p4;
-	else
-		em_cfg.cfg = tf_em_ext_p45;
 
+	em_cfg.cfg = tf_em_ext_p4;
 	rsv_cnt = tf_dev_reservation_check(tfp,
 					   TF_EM_TBL_TYPE_MAX,
 					   em_cfg.cfg,
drivers/net/bnxt/tf_core/tf_device_p4.c +35 -70

111 lines not on this page · raw message

drivers/net/bnxt/tf_core/tf_device_p4.h +100 -75

198 lines not on this page · raw message

drivers/net/bnxt/tf_core/tf_device_p45.h deleted +0 -105

105 lines not on this page · raw message

drivers/net/bnxt/tf_core/tf_device_p58.c +21 -40

68 lines not on this page · raw message

drivers/net/bnxt/tf_core/tf_device_p58.h +6 -0
index 3d6e3240bf..de7bb1cd76 100644
@@ -49,6 +49,12 @@ struct tf_rm_element_cfg tf_tcam_p58[TF_TCAM_TBL_TYPE_MAX] = {
 };
 
 struct tf_rm_element_cfg tf_tbl_p58[TF_TBL_TYPE_MAX] = {
+	[TF_TBL_TYPE_EM_FKB] = {
+		TF_RM_ELEM_CFG_HCAPI_BA, CFA_RESOURCE_TYPE_P58_EM_FKB
+	},
+	[TF_TBL_TYPE_WC_FKB] = {
+		TF_RM_ELEM_CFG_HCAPI_BA, CFA_RESOURCE_TYPE_P58_WC_FKB
+	},
 	[TF_TBL_TYPE_METER_PROF] = {
 		TF_RM_ELEM_CFG_HCAPI_BA, CFA_RESOURCE_TYPE_P58_METER_PROF
 	},
drivers/net/bnxt/tf_core/tf_em_common.c +1 -1
index ddc6b3c4dd..6cd6086685 100644
@@ -777,7 +777,7 @@ tf_insert_eem_entry(struct tf_tbl_scope_cb *tbl_scope_cb,
 	TF_SET_FIELDS_IN_FLOW_HANDLE(parms->flow_handle,
 				     0,
 				     0,
-				     0,
+				     TF_FLAGS_FLOW_HANDLE_EXTERNAL,
 				     index,
 				     0,
 				     table_type);
drivers/net/bnxt/tf_core/tf_em_internal.c +1 -1
index 62ccd7b78f..bdffd801b3 100644
@@ -203,7 +203,7 @@ tf_em_insert_int_entry(struct tf *tfp,
 	TF_SET_FIELDS_IN_FLOW_HANDLE(parms->flow_handle,
 				     (uint32_t)num_of_entries,
 				     0,
-				     0,
+				     TF_FLAGS_FLOW_HANDLE_INTERNAL,
 				     rptr_index,
 				     rptr_entry,
 				     0);
drivers/net/bnxt/tf_core/tf_ext_flow_handle.h +13 -2
index 9eb5aeb771..bf6dbcd238 100644
@@ -19,6 +19,9 @@
 #define TF_HASH_TYPE_FLOW_HANDLE_MASK		0x0000000100000000ULL
 #define TF_HASH_TYPE_FLOW_HANDLE_SFT		32
 
+#define TF_FLAGS_FLOW_HANDLE_INTERNAL		0x2
+#define TF_FLAGS_FLOW_HANDLE_EXTERNAL		0x0
+
 #define TF_FLOW_HANDLE_MASK (TF_NUM_KEY_ENTRIES_FLOW_HANDLE_MASK |	\
 				TF_FLOW_TYPE_FLOW_HANDLE_MASK |		\
 				TF_FLAGS_FLOW_HANDLE_MASK |		\
@@ -92,15 +95,23 @@ do {									\
 
 #define TF_GET_NUM_KEY_ENTRIES_FROM_FLOW_HANDLE(flow_handle,		\
 					  num_key_entries)		\
+do {									\
 	(num_key_entries =						\
 		(((flow_handle) & TF_NUM_KEY_ENTRIES_FLOW_HANDLE_MASK) >> \
-		     TF_NUM_KEY_ENTRIES_FLOW_HANDLE_SFT))		\
+		     TF_NUM_KEY_ENTRIES_FLOW_HANDLE_SFT));		\
+} while (0)
 
 #define TF_GET_ENTRY_NUM_FROM_FLOW_HANDLE(flow_handle,		\
 					  entry_num)		\
+do {									\
 	(entry_num =						\
 		(((flow_handle) & TF_ENTRY_NUM_FLOW_HANDLE_MASK) >> \
-		     TF_ENTRY_NUM_FLOW_HANDLE_SFT))		\
+		     TF_ENTRY_NUM_FLOW_HANDLE_SFT));		\
+} while (0)
+
+#define TF_GET_FLAG_FROM_FLOW_HANDLE(flow_handle, flag)		\
+	(flag =	(((flow_handle) & TF_FLAGS_FLOW_HANDLE_MASK) >>\
+		     TF_FLAGS_FLOW_HANDLE_SFT))
 
 /*
  * 32 bit Flow ID handlers
drivers/net/bnxt/tf_core/tf_msg.c +1 -2
index 1007211363..be30d4a09f 100644
@@ -415,7 +415,6 @@ tf_msg_session_resc_qcaps(struct tf *tfp,
 
 	/* Post process the response */
 	data = (struct tf_rm_resc_req_entry *)qcaps_buf.va_addr;
-
 	for (i = 0; i < size; i++) {
 		query[i].type = tfp_le_to_cpu_32(data[i].type);
 		query[i].min = tfp_le_to_cpu_16(data[i].min);
@@ -1462,7 +1461,7 @@ tf_msg_set_global_cfg(struct tf *tfp,
 	/* Only set mask if pointer is provided
 	 */
 	if (params->config_mask) {
-		tfp_memcpy(req.data + params->config_sz_in_bytes,
+		tfp_memcpy(req.mask,
 			   params->config_mask,
 			   params->config_sz_in_bytes);
 	}
drivers/net/bnxt/tf_core/tf_rm.c +10 -4
index 2c08fb80fe..19de6e4c63 100644
@@ -486,14 +486,20 @@ tf_rm_create_db(struct tf *tfp,
 				req[j].max = parms->alloc_cnt[i];
 				j++;
 			} else {
+				const char *type_str;
+				uint16_t hcapi_type = parms->cfg[i].hcapi_type;
+
+				dev->ops->tf_dev_get_resource_str(tfp,
+								  hcapi_type,
+								  &type_str);
 				TFP_DRV_LOG(ERR,
-					    "%s: Resource failure, type:%d\n",
-					    tf_dir_2_str(parms->dir),
-					    parms->cfg[i].hcapi_type);
+					"%s: Resource failure, type:%d:%s\n",
+					tf_dir_2_str(parms->dir),
+					hcapi_type, type_str);
 				TFP_DRV_LOG(ERR,
 					"req:%d, avail:%d\n",
 					parms->alloc_cnt[i],
-					query[parms->cfg[i].hcapi_type].max);
+					query[hcapi_type].max);
 				return -EINVAL;
 			}
 		}
drivers/net/bnxt/tf_core/tf_shadow_tbl.c +0 -2
index 014e4f3c83..396ebdb0a9 100644
@@ -177,8 +177,6 @@ static int tf_shadow_tbl_is_searchable(enum tf_tbl_type type)
 	case TF_TBL_TYPE_ACT_SP_SMAC_IPV4:
 	case TF_TBL_TYPE_ACT_SP_SMAC_IPV6:
 	case TF_TBL_TYPE_ACT_MODIFY_IPV4:
-	case TF_TBL_TYPE_ACT_MODIFY_SPORT:
-	case TF_TBL_TYPE_ACT_MODIFY_DPORT:
 		rc = 1;
 		break;
 	default:
drivers/net/bnxt/tf_core/tf_util.c +1 -7
index ca37df5102..74c8f26204 100644
@@ -88,12 +88,8 @@ tf_tbl_type_2_str(enum tf_tbl_type tbl_type)
 		return "Source Properties SMAC IPv6";
 	case TF_TBL_TYPE_ACT_STATS_64:
 		return "Stats 64B";
-	case TF_TBL_TYPE_ACT_MODIFY_SPORT:
-		return "NAT Source Port";
-	case TF_TBL_TYPE_ACT_MODIFY_DPORT:
-		return "NAT Destination Port";
 	case TF_TBL_TYPE_ACT_MODIFY_IPV4:
-		return "NAT IPv4";
+		return "Modify IPv4";
 	case TF_TBL_TYPE_METER_PROF:
 		return "Meter Profile";
 	case TF_TBL_TYPE_METER_INST:
@@ -116,8 +112,6 @@ tf_tbl_type_2_str(enum tf_tbl_type tbl_type)
 		return "Range";
 	case TF_TBL_TYPE_LAG:
 		return "Link Aggregation";
-	case TF_TBL_TYPE_VNIC_SVIF:
-		return "VNIC SVIF";
 	case TF_TBL_TYPE_EM_FKB:
 		return "EM Flexible Key Builder";
 	case TF_TBL_TYPE_WC_FKB:
Signature · 1 line
2.17.1
#6 lore raw

PATCH 6/58 net/bnxt: add support for EM with FKB

In reply to Venkat Duvvuru

From: Peter Spreadborough <[email protected]>

Main TF changes to support EM insert with FKB. Flexible Key builder is required to create Wild Card and Exact Match keys for TCAM lookups.

---
 drivers/net/bnxt/tf_core/meson.build          |   1 +
 drivers/net/bnxt/tf_core/tf_device_p58.c      |  14 +-
 drivers/net/bnxt/tf_core/tf_em.h              |  32 +++++
 .../net/bnxt/tf_core/tf_em_hash_internal.c    | 123 ++++++++++++++++++
 drivers/net/bnxt/tf_core/tf_em_internal.c     |   3 +-
 drivers/net/bnxt/tf_core/tf_msg.c             |  96 ++++++++++++++
 drivers/net/bnxt/tf_core/tf_msg.h             |  35 +++++
 7 files changed, 295 insertions(+), 9 deletions(-)
 create mode 100644 drivers/net/bnxt/tf_core/tf_em_hash_internal.c
drivers/net/bnxt/tf_core/meson.build +1 -0
index d7e8f664fd..373ee0413b 100644
@@ -30,5 +30,6 @@ sources += files(
         'll.c',
         'tf_global_cfg.c',
         'tf_em_host.c',
+        'tf_em_hash_internal.c',
         'tf_shadow_identifier.c',
         'tf_hash.c')
drivers/net/bnxt/tf_core/tf_device_p58.c +7 -7
index 7dd806000c..6cef1d5ba5 100644
@@ -256,14 +256,14 @@ const struct tf_dev_ops tf_dev_ops_p58 = {
 	.tf_dev_alloc_search_tcam = tf_tcam_alloc_search,
 	.tf_dev_set_tcam = tf_tcam_set,
 	.tf_dev_get_tcam = NULL,
-	.tf_dev_insert_int_em_entry = tf_em_insert_int_entry,
-	.tf_dev_delete_int_em_entry = tf_em_delete_int_entry,
-	.tf_dev_insert_ext_em_entry = tf_em_insert_ext_entry,
-	.tf_dev_delete_ext_em_entry = tf_em_delete_ext_entry,
-	.tf_dev_alloc_tbl_scope = tf_em_ext_common_alloc,
-	.tf_dev_map_tbl_scope = tf_em_ext_map_tbl_scope,
+	.tf_dev_insert_int_em_entry = tf_em_hash_insert_int_entry,
+	.tf_dev_delete_int_em_entry = tf_em_hash_delete_int_entry,
+	.tf_dev_insert_ext_em_entry = NULL,
+	.tf_dev_delete_ext_em_entry = NULL,
+	.tf_dev_alloc_tbl_scope = NULL,
+	.tf_dev_map_tbl_scope = NULL,
 	.tf_dev_map_parif = tf_dev_p58_map_parif,
-	.tf_dev_free_tbl_scope = tf_em_ext_common_free,
+	.tf_dev_free_tbl_scope = NULL,
 	.tf_dev_set_if_tbl = tf_if_tbl_set,
 	.tf_dev_get_if_tbl = tf_if_tbl_get,
 	.tf_dev_set_global_cfg = tf_global_cfg_set,
drivers/net/bnxt/tf_core/tf_em.h +32 -0
index b5c3acb09a..5a67ca3509 100644
@@ -197,6 +197,38 @@ int tf_em_insert_int_entry(struct tf *tfp,
 int tf_em_delete_int_entry(struct tf *tfp,
 			   struct tf_delete_em_entry_parms *parms);
 
+/**
+ * Insert record in to internal EM table
+ *
+ * [in] tfp
+ *   Pointer to TruFlow handle
+ *
+ * [in] parms
+ *   Pointer to input parameters
+ *
+ * Returns:
+ *   0       - Success
+ *   -EINVAL - Parameter error
+ */
+int tf_em_hash_insert_int_entry(struct tf *tfp,
+				struct tf_insert_em_entry_parms *parms);
+
+/**
+ * Delete record from internal EM table
+ *
+ * [in] tfp
+ *   Pointer to TruFlow handle
+ *
+ * [in] parms
+ *   Pointer to input parameters
+ *
+ * Returns:
+ *   0       - Success
+ *   -EINVAL - Parameter error
+ */
+int tf_em_hash_delete_int_entry(struct tf *tfp,
+				struct tf_delete_em_entry_parms *parms);
+
 /**
  * Insert record in to external EEM table
  *
drivers/net/bnxt/tf_core/tf_em_hash_internal.c new file +123 -0

123 lines not on this page · raw message

drivers/net/bnxt/tf_core/tf_em_internal.c +1 -2
index bdffd801b3..0864218469 100644
@@ -30,11 +30,10 @@ static void *em_db[TF_DIR_MAX];
  */
 static uint8_t init;
 
-
 /**
  * EM Pool
  */
-static struct stack em_pool[TF_DIR_MAX];
+struct stack em_pool[TF_DIR_MAX];
 
 /**
  * Create EM Tbl pool of memory indexes.
drivers/net/bnxt/tf_core/tf_msg.c +96 -0

108 lines not on this page · raw message

drivers/net/bnxt/tf_core/tf_msg.h +35 -0
index 25e29a554f..1d82ce5049 100644
@@ -225,6 +225,41 @@ int tf_msg_insert_em_internal_entry(struct tf *tfp,
 				    uint16_t *rptr_index,
 				    uint8_t *rptr_entry,
 				    uint8_t *num_of_entries);
+/**
+ * Sends EM hash internal insert request to Firmware
+ *
+ * [in] tfp
+ *   Pointer to TF handle
+ *
+ * [in] params
+ *   Pointer to em insert parameter list
+ *
+ * [in] key0_hash
+ *      CRC32 hash of key
+ *
+ * [in] key1_hash
+ *      Lookup3 hash of key
+ *
+ * [in] rptr_index
+ *   Record ptr index
+ *
+ * [in] rptr_entry
+ *   Record ptr entry
+ *
+ * [in] num_of_entries
+ *   Number of entries to insert
+ *
+ * Returns:
+ *   0 on Success else internal Truflow error
+ */
+int
+tf_msg_hash_insert_em_internal_entry(struct tf *tfp,
+				struct tf_insert_em_entry_parms *em_parms,
+				uint32_t key0_hash,
+				uint32_t key1_hash,
+				uint16_t *rptr_index,
+				uint8_t *rptr_entry,
+				uint8_t *num_of_entries);
 /**
  * Sends EM internal delete request to Firmware
  *
Signature · 1 line
2.17.1
#7 lore raw

PATCH 7/58 net/bnxt: add L2 Context TCAM get support

In reply to Venkat Duvvuru

From: Jay Ding <[email protected]>

- Implement TCAM get in host
- Add Thor support for TCAM set/free

---
 drivers/net/bnxt/tf_core/hwrm_tf.h       |  1 +
 drivers/net/bnxt/tf_core/tf_core.c       | 65 +++++++++++++++--
 drivers/net/bnxt/tf_core/tf_device.h     | 12 ++++
 drivers/net/bnxt/tf_core/tf_device_p4.c  |  6 ++
 drivers/net/bnxt/tf_core/tf_device_p58.c |  9 ++-
 drivers/net/bnxt/tf_core/tf_msg.c        | 52 ++++++++++++++
 drivers/net/bnxt/tf_core/tf_msg.h        | 16 +++++
 drivers/net/bnxt/tf_core/tf_tcam.c       | 89 +++++++++++++++++++++++-
 drivers/net/bnxt/tf_core/tf_tcam.h       |  4 ++
 9 files changed, 248 insertions(+), 6 deletions(-)
drivers/net/bnxt/tf_core/hwrm_tf.h +1 -0
index a707cd2758..9cc9a1435c 100644
@@ -65,6 +65,7 @@ typedef enum tf_subtype {
 
 #define TF_BITS2BYTES(x) (((x) + 7) >> 3)
 #define TF_BITS2BYTES_WORD_ALIGN(x) ((((x) + 31) >> 5) * 4)
+#define TF_BITS2BYTES_64B_WORD_ALIGN(x) ((((x) + 63) >> 6) * 8)
 
 struct tf_set_global_cfg_input;
 struct tf_get_global_cfg_input;
drivers/net/bnxt/tf_core/tf_core.c +61 -4

85 lines not on this page · raw message

drivers/net/bnxt/tf_core/tf_device.h +12 -0
index cbacc09ea5..4f4120c603 100644
@@ -736,6 +736,18 @@ struct tf_dev_ops {
 	 *      mailbox
 	 */
 	int (*tf_dev_get_mailbox)(void);
+
+	/**
+	 * Convert length in bit to length in byte and align to word.
+	 * The word length depends on device type.
+	 *
+	 * [in] size
+	 *   Size in bit
+	 *
+	 * Returns
+	 *   Size in byte
+	 */
+	int (*tf_dev_word_align)(uint16_t size);
 };
 
 /**
drivers/net/bnxt/tf_core/tf_device_p4.c +6 -0
index f6c8f5efd0..fbe92b7733 100644
@@ -212,6 +212,10 @@ static int tf_dev_p4_get_mailbox(void)
 	return TF_KONG_MB;
 }
 
+static int tf_dev_p4_word_align(uint16_t size)
+{
+	return ((((size) + 31) >> 5) * 4);
+}
 
 /**
  * Truflow P4 device specific functions
@@ -250,6 +254,7 @@ const struct tf_dev_ops tf_dev_ops_p4_init = {
 	.tf_dev_set_global_cfg = NULL,
 	.tf_dev_get_global_cfg = NULL,
 	.tf_dev_get_mailbox = tf_dev_p4_get_mailbox,
+	.tf_dev_word_align = NULL,
 };
 
 /**
@@ -289,4 +294,5 @@ const struct tf_dev_ops tf_dev_ops_p4 = {
 	.tf_dev_set_global_cfg = tf_global_cfg_set,
 	.tf_dev_get_global_cfg = tf_global_cfg_get,
 	.tf_dev_get_mailbox = tf_dev_p4_get_mailbox,
+	.tf_dev_word_align = tf_dev_p4_word_align,
 };
drivers/net/bnxt/tf_core/tf_device_p58.c +8 -1
index 6cef1d5ba5..688d987cb7 100644
@@ -193,6 +193,11 @@ static int tf_dev_p58_get_mailbox(void)
 	return TF_CHIMP_MB;
 }
 
+static int tf_dev_p58_word_align(uint16_t size)
+{
+	return ((((size) + 63) >> 6) * 8);
+}
+
 /**
  * Truflow P58 device specific functions
  */
@@ -230,6 +235,7 @@ const struct tf_dev_ops tf_dev_ops_p58_init = {
 	.tf_dev_set_global_cfg = NULL,
 	.tf_dev_get_global_cfg = NULL,
 	.tf_dev_get_mailbox = tf_dev_p58_get_mailbox,
+	.tf_dev_word_align = NULL,
 };
 
 /**
@@ -255,7 +261,7 @@ const struct tf_dev_ops tf_dev_ops_p58 = {
 	.tf_dev_free_tcam = tf_tcam_free,
 	.tf_dev_alloc_search_tcam = tf_tcam_alloc_search,
 	.tf_dev_set_tcam = tf_tcam_set,
-	.tf_dev_get_tcam = NULL,
+	.tf_dev_get_tcam = tf_tcam_get,
 	.tf_dev_insert_int_em_entry = tf_em_hash_insert_int_entry,
 	.tf_dev_delete_int_em_entry = tf_em_hash_delete_int_entry,
 	.tf_dev_insert_ext_em_entry = NULL,
@@ -269,4 +275,5 @@ const struct tf_dev_ops tf_dev_ops_p58 = {
 	.tf_dev_set_global_cfg = tf_global_cfg_set,
 	.tf_dev_get_global_cfg = tf_global_cfg_get,
 	.tf_dev_get_mailbox = tf_dev_p58_get_mailbox,
+	.tf_dev_word_align = tf_dev_p58_word_align,
 };
drivers/net/bnxt/tf_core/tf_msg.c +52 -0

58 lines not on this page · raw message

drivers/net/bnxt/tf_core/tf_msg.h +16 -0
index 1d82ce5049..a14bcd3927 100644
@@ -412,6 +412,22 @@ int tf_msg_tcam_entry_set(struct tf *tfp,
 			  struct tf_dev_info *dev,
 			  struct tf_tcam_set_parms *parms);
 
+/**
+ * Sends tcam entry 'get' to the Firmware.
+ *
+ * [in] tfp
+ *   Pointer to session handle
+ *
+ * [in] parms
+ *   Pointer to get parameters
+ *
+ * Returns:
+ *  0 on Success else internal Truflow error
+ */
+int tf_msg_tcam_entry_get(struct tf *tfp,
+			  struct tf_dev_info *dev,
+			  struct tf_tcam_get_parms *parms);
+
 /**
  * Sends tcam entry 'free' to the Firmware.
  *
drivers/net/bnxt/tf_core/tf_tcam.c +88 -1

95 lines not on this page · raw message

drivers/net/bnxt/tf_core/tf_tcam.h +4 -0
index 40d010b09a..b550fa43ca 100644
@@ -207,6 +207,10 @@ struct tf_tcam_get_parms {
 	 * [in] Type of object to get
 	 */
 	enum tf_tcam_tbl_type type;
+	/**
+	 * [in] Type of HCAPI
+	 */
+	uint16_t hcapi_type;
 	/**
 	 * [in] Entry index to read
 	 */
Signature · 1 line
2.17.1
#8 lore raw

PATCH 8/58 net/bnxt: add action SRAM Translation

In reply to Venkat Duvvuru

From: Farah Smith <[email protected]>

- Translate Truflow action types for Thor to HCAPI RM resource defined SRAM banks.
- move module type enum definitions to tf_core API
- Switch to subtype concept for RM.
- alloc/free working for Thor SRAM table type for full AR.

---
 drivers/net/bnxt/bnxt_util.h                |   3 +
 drivers/net/bnxt/hcapi/cfa/hcapi_cfa.h      | 339 +++------
 drivers/net/bnxt/hcapi/cfa/hcapi_cfa_defs.h | 387 +---------
 drivers/net/bnxt/hcapi/cfa/hcapi_cfa_p58.h  | 411 ++++++++++
 drivers/net/bnxt/tf_core/meson.build        |   1 -
 drivers/net/bnxt/tf_core/tf_core.h          |  24 +
 drivers/net/bnxt/tf_core/tf_device.c        |  43 +-
 drivers/net/bnxt/tf_core/tf_device.h        |  23 -
 drivers/net/bnxt/tf_core/tf_device_p4.c     |  21 +-
 drivers/net/bnxt/tf_core/tf_device_p58.c    |  53 +-
 drivers/net/bnxt/tf_core/tf_device_p58.h    | 110 ++-
 drivers/net/bnxt/tf_core/tf_em_common.c     |   4 +-
 drivers/net/bnxt/tf_core/tf_em_host.c       |   6 +-
 drivers/net/bnxt/tf_core/tf_em_internal.c   |   4 +-
 drivers/net/bnxt/tf_core/tf_identifier.c    |  10 +-
 drivers/net/bnxt/tf_core/tf_if_tbl.c        |   2 +-
 drivers/net/bnxt/tf_core/tf_rm.c            | 508 ++++++++-----
 drivers/net/bnxt/tf_core/tf_rm.h            | 109 ++-
 drivers/net/bnxt/tf_core/tf_shadow_tbl.c    | 783 --------------------
 drivers/net/bnxt/tf_core/tf_shadow_tbl.h    | 256 -------
 drivers/net/bnxt/tf_core/tf_tbl.c           | 238 +-----
 drivers/net/bnxt/tf_core/tf_tcam.c          |  20 +-
 drivers/net/bnxt/tf_core/tf_util.c          |  36 +-
 drivers/net/bnxt/tf_core/tf_util.h          |  26 +-
 24 files changed, 1130 insertions(+), 2287 deletions(-)
 create mode 100644 drivers/net/bnxt/hcapi/cfa/hcapi_cfa_p58.h
 delete mode 100644 drivers/net/bnxt/tf_core/tf_shadow_tbl.c
 delete mode 100644 drivers/net/bnxt/tf_core/tf_shadow_tbl.h
drivers/net/bnxt/bnxt_util.h +3 -0
index 64e97eed15..b243c21ec2 100644
@@ -9,6 +9,9 @@
 #ifndef BIT
 #define BIT(n)	(1UL << (n))
 #endif /* BIT */
+#ifndef BIT_MASK
+#define BIT_MASK(len) (BIT(len) - 1)
+#endif /* BIT_MASK */
 
 #define PCI_SUBSYSTEM_ID_OFFSET	0x2e
 
drivers/net/bnxt/hcapi/cfa/hcapi_cfa.h +92 -247

373 lines not on this page · raw message

drivers/net/bnxt/hcapi/cfa/hcapi_cfa_defs.h +3 -384

406 lines not on this page · raw message

drivers/net/bnxt/hcapi/cfa/hcapi_cfa_p58.h new file +411 -0

411 lines not on this page · raw message

drivers/net/bnxt/tf_core/meson.build +0 -1
index 373ee0413b..2c02214d83 100644
@@ -22,7 +22,6 @@ sources += files(
         'tf_device_p4.c',
         'tf_device_p58.c',
         'tf_identifier.c',
-        'tf_shadow_tbl.c',
         'tf_shadow_tcam.c',
         'tf_tcam.c',
         'tf_util.c',
drivers/net/bnxt/tf_core/tf_core.h +24 -0
index 4fe0590569..0cc3719a1b 100644
@@ -153,6 +153,30 @@ enum tf_device_type {
 	TF_DEVICE_TYPE_MAX     /**< Maximum   */
 };
 
+/**
+ * Module types
+ */
+enum tf_module_type {
+	/**
+	 * Identifier module
+	 */
+	TF_MODULE_TYPE_IDENTIFIER,
+	/**
+	 * Table type module
+	 */
+	TF_MODULE_TYPE_TABLE,
+	/**
+	 * TCAM module
+	 */
+	TF_MODULE_TYPE_TCAM,
+	/**
+	 * EM module
+	 */
+	TF_MODULE_TYPE_EM,
+	TF_MODULE_TYPE_MAX
+};
+
+
 /**
  * Identifier resource types
  */
drivers/net/bnxt/tf_core/tf_device.c +16 -27

125 lines not on this page · raw message

drivers/net/bnxt/tf_core/tf_device.h +0 -23
index 4f4120c603..2cbb42fe2a 100644
@@ -16,29 +16,6 @@
 struct tf;
 struct tf_session;
 
-/**
- * Device module types
- */
-enum tf_device_module_type {
-	/**
-	 * Identifier module
-	 */
-	TF_DEVICE_MODULE_TYPE_IDENTIFIER,
-	/**
-	 * Table type module
-	 */
-	TF_DEVICE_MODULE_TYPE_TABLE,
-	/**
-	 * TCAM module
-	 */
-	TF_DEVICE_MODULE_TYPE_TCAM,
-	/**
-	 * EM module
-	 */
-	TF_DEVICE_MODULE_TYPE_EM,
-	TF_DEVICE_MODULE_TYPE_MAX
-};
-
 /**
  * The Device module provides a general device template. A supported
  * device type should implement one or more of the listed function
drivers/net/bnxt/tf_core/tf_device_p4.c +1 -20
index fbe92b7733..d0bede89e3 100644
@@ -74,29 +74,10 @@ static int
 tf_dev_p4_get_max_types(struct tf *tfp,
 			uint16_t *max_types)
 {
-	struct tf_session *tfs;
-	struct tf_dev_info *dev;
-	int rc;
-
 	if (max_types == NULL || tfp == NULL)
 		return -EINVAL;
 
-	/* Retrieve the session information */
-	rc = tf_session_get_session(tfp, &tfs);
-	if (rc)
-		return rc;
-
-	/* Retrieve the device information */
-	rc = tf_session_get_device(tfs, &dev);
-	if (rc)
-		return rc;
-
-	if (dev->type == TF_DEVICE_TYPE_WH)
-		*max_types = CFA_RESOURCE_TYPE_P4_LAST + 1;
-	else if (dev->type == TF_DEVICE_TYPE_SR)
-		*max_types = CFA_RESOURCE_TYPE_P45_LAST + 1;
-	else
-		return -ENODEV;
+	*max_types = CFA_RESOURCE_TYPE_P4_LAST + 1;
 
 	return 0;
 }
drivers/net/bnxt/tf_core/tf_device_p58.c +2 -51

75 lines not on this page · raw message

drivers/net/bnxt/tf_core/tf_device_p58.h +109 -1

122 lines not on this page · raw message

drivers/net/bnxt/tf_core/tf_em_common.c +2 -2
index 6cd6086685..589df60041 100644
@@ -54,7 +54,7 @@ tbl_scope_cb_find(uint32_t tbl_scope_id)
 
 	/* Check that id is valid */
 	parms.rm_db = eem_db[TF_DIR_RX];
-	parms.db_index = TF_EM_TBL_TYPE_TBL_SCOPE;
+	parms.subtype = TF_EM_TBL_TYPE_TBL_SCOPE;
 	parms.index = tbl_scope_id;
 	parms.allocated = &allocated;
 
@@ -895,7 +895,7 @@ tf_em_ext_common_bind(struct tf *tfp,
 		return -EINVAL;
 	}
 
-	db_cfg.type = TF_DEVICE_MODULE_TYPE_EM;
+	db_cfg.module = TF_MODULE_TYPE_EM;
 	db_cfg.num_elements = parms->num_elements;
 	db_cfg.cfg = parms->cfg;
 
drivers/net/bnxt/tf_core/tf_em_host.c +3 -3
index 69f7e5bddd..166f397935 100644
@@ -379,7 +379,7 @@ tf_em_ext_alloc(struct tf *tfp, struct tf_alloc_tbl_scope_parms *parms)
 
 	/* Get Table Scope control block from the session pool */
 	aparms.rm_db = eem_db[TF_DIR_RX];
-	aparms.db_index = TF_EM_TBL_TYPE_TBL_SCOPE;
+	aparms.subtype = TF_EM_TBL_TYPE_TBL_SCOPE;
 	aparms.index = (uint32_t *)&parms->tbl_scope_id;
 	rc = tf_rm_allocate(&aparms);
 	if (rc) {
@@ -488,7 +488,7 @@ tf_em_ext_alloc(struct tf *tfp, struct tf_alloc_tbl_scope_parms *parms)
 cleanup:
 	/* Free Table control block */
 	fparms.rm_db = eem_db[TF_DIR_RX];
-	fparms.db_index = TF_EM_TBL_TYPE_TBL_SCOPE;
+	fparms.subtype = TF_EM_TBL_TYPE_TBL_SCOPE;
 	fparms.index = parms->tbl_scope_id;
 	tf_rm_free(&fparms);
 	return -EINVAL;
@@ -512,7 +512,7 @@ tf_em_ext_free(struct tf *tfp,
 
 	/* Free Table control block */
 	aparms.rm_db = eem_db[TF_DIR_RX];
-	aparms.db_index = TF_EM_TBL_TYPE_TBL_SCOPE;
+	aparms.subtype = TF_EM_TBL_TYPE_TBL_SCOPE;
 	aparms.index = parms->tbl_scope_id;
 	rc = tf_rm_free(&aparms);
 	if (rc) {
drivers/net/bnxt/tf_core/tf_em_internal.c +2 -2
index 0864218469..043f9be4da 100644
@@ -251,7 +251,7 @@ tf_em_int_bind(struct tf *tfp,
 		return -EINVAL;
 	}
 
-	db_cfg.type = TF_DEVICE_MODULE_TYPE_EM;
+	db_cfg.module = TF_MODULE_TYPE_EM;
 	db_cfg.num_elements = parms->num_elements;
 	db_cfg.cfg = parms->cfg;
 
@@ -294,7 +294,7 @@ tf_em_int_bind(struct tf *tfp,
 
 	for (i = 0; i < TF_DIR_MAX; i++) {
 		iparms.rm_db = em_db[i];
-		iparms.db_index = TF_EM_DB_EM_REC;
+		iparms.subtype = TF_EM_DB_EM_REC;
 		iparms.info = &info;
 
 		rc = tf_rm_get_info(&iparms);
drivers/net/bnxt/tf_core/tf_identifier.c +5 -5
index 41ab13c132..9d0a578085 100644
@@ -52,7 +52,7 @@ tf_ident_bind(struct tf *tfp,
 		return -EINVAL;
 	}
 
-	db_cfg.type = TF_DEVICE_MODULE_TYPE_IDENTIFIER;
+	db_cfg.module = TF_MODULE_TYPE_IDENTIFIER;
 	db_cfg.num_elements = parms->num_elements;
 	db_cfg.cfg = parms->cfg;
 
@@ -161,7 +161,7 @@ tf_ident_alloc(struct tf *tfp __rte_unused,
 
 	/* Allocate requested element */
 	aparms.rm_db = ident_db[parms->dir];
-	aparms.db_index = parms->type;
+	aparms.subtype = parms->type;
 	aparms.index = &id;
 	aparms.base_index = &base_id;
 	rc = tf_rm_allocate(&aparms);
@@ -215,7 +215,7 @@ tf_ident_free(struct tf *tfp __rte_unused,
 
 	/* Check if element is in use */
 	aparms.rm_db = ident_db[parms->dir];
-	aparms.db_index = parms->type;
+	aparms.subtype = parms->type;
 	aparms.index = parms->id;
 	aparms.base_index = &base_id;
 	aparms.allocated = &allocated;
@@ -255,7 +255,7 @@ tf_ident_free(struct tf *tfp __rte_unused,
 
 	/* Free requested element */
 	fparms.rm_db = ident_db[parms->dir];
-	fparms.db_index = parms->type;
+	fparms.subtype = parms->type;
 	fparms.index = parms->id;
 	rc = tf_rm_free(&fparms);
 	if (rc) {
@@ -298,7 +298,7 @@ tf_ident_search(struct tf *tfp __rte_unused,
 
 	/* Check if element is in use */
 	aparms.rm_db = ident_db[parms->dir];
-	aparms.db_index = parms->type;
+	aparms.subtype = parms->type;
 	aparms.index = parms->search_id;
 	aparms.base_index = &base_id;
 	aparms.allocated = &allocated;
drivers/net/bnxt/tf_core/tf_if_tbl.c +1 -1
index 16afa95e38..f58fa79b63 100644
@@ -144,7 +144,7 @@ int
 tf_if_tbl_get(struct tf *tfp,
 	      struct tf_if_tbl_get_parms *parms)
 {
-	int rc;
+	int rc = 0;
 	struct tf_if_tbl_get_hcapi_parms hparms;
 
 	TF_CHECK_PARMS3(tfp, parms, parms->data);
drivers/net/bnxt/tf_core/tf_rm.c +331 -177

866 lines not on this page · raw message

drivers/net/bnxt/tf_core/tf_rm.h +74 -35

204 lines not on this page · raw message

drivers/net/bnxt/tf_core/tf_shadow_tbl.c deleted +0 -783

209 lines not on this page · raw message

drivers/net/bnxt/tf_core/tf_shadow_tbl.h deleted +0 -256

256 lines not on this page · raw message

drivers/net/bnxt/tf_core/tf_tbl.c +12 -226

238 lines not on this page · raw message

drivers/net/bnxt/tf_core/tf_tcam.c +10 -10
index a18d0e1e19..42d503f500 100644

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

drivers/net/bnxt/tf_core/tf_util.c +18 -18
index 74c8f26204..b4d47d5a8c 100644

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

drivers/net/bnxt/tf_core/tf_util.h +11 -15
index 4225c756f6..1aa35b6b82 100644

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

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

Signature · 1 line
2.17.1

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

#9 lore raw

PATCH 9/58 net/bnxt: add Thor WC TCAM support

In reply to Venkat Duvvuru

From: Jay Ding <[email protected]>

1. Add set/get/free/alloc for WC TCAM
2. Rework the key size in slice management.
3. Add 3 FKB WC keys for WC TCAM set cli cmd
4. Add transform key function for WC TCAM FKB key
5. Add checking for key buffer length for get_tcam

---
 drivers/net/bnxt/tf_core/tf_core.c       |   2 +
 drivers/net/bnxt/tf_core/tf_core.h       |   5 +-
 drivers/net/bnxt/tf_core/tf_device_p4.c  |   2 -
 drivers/net/bnxt/tf_core/tf_device_p58.c |   7 +-
 drivers/net/bnxt/tf_core/tf_device_p58.h |   3 +
 drivers/net/bnxt/tf_core/tf_msg.c        |  31 ++--
 drivers/net/bnxt/tf_core/tf_tcam.c       | 192 ++++++++++++-----------
 7 files changed, 132 insertions(+), 110 deletions(-)
drivers/net/bnxt/tf_core/tf_core.c +2 -0
index a3b6afbc88..573fa0b1ed 100644
@@ -842,8 +842,10 @@ tf_get_tcam_entry(struct tf *tfp __rte_unused,
 	gparms.type = parms->tcam_tbl_type;
 	gparms.idx = parms->idx;
 	gparms.key = parms->key;
+	gparms.key_size = dev->ops->tf_dev_word_align(parms->key_sz_in_bits);
 	gparms.mask = parms->mask;
 	gparms.result = parms->result;
+	gparms.result_size = TF_BITS2BYTES_WORD_ALIGN(parms->result_sz_in_bits);
 
 	rc = dev->ops->tf_dev_get_tcam(tfp, &gparms);
 	if (rc) {
drivers/net/bnxt/tf_core/tf_core.h +3 -2
index 0cc3719a1b..fcba492dc5 100644
@@ -1286,7 +1286,7 @@ struct tf_get_tcam_entry_parms {
 	 */
 	uint8_t *mask;
 	/**
-	 * [out] key size in bits
+	 * [in/out] key size in bits
 	 */
 	uint16_t key_sz_in_bits;
 	/**
@@ -1294,7 +1294,7 @@ struct tf_get_tcam_entry_parms {
 	 */
 	uint8_t *result;
 	/**
-	 * [out] struct containing result size in bits
+	 * [in/out] struct containing result size in bits
 	 */
 	uint16_t result_sz_in_bits;
 };
@@ -1961,6 +1961,7 @@ enum tf_tunnel_encap_offsets {
 enum tf_global_config_type {
 	TF_TUNNEL_ENCAP,  /**< Tunnel Encap Config(TECT) */
 	TF_ACTION_BLOCK,  /**< Action Block Config(ABCR) */
+	TF_COUNTER_CFG,   /**< Counter Configuration (CNTRS_CTRL) */
 	TF_GLOBAL_CFG_TYPE_MAX
 };
 
drivers/net/bnxt/tf_core/tf_device_p4.c +0 -2
index d0bede89e3..e5aaaac9a0 100644
@@ -144,8 +144,6 @@ tf_dev_p4_get_tcam_slice_info(struct tf *tfp __rte_unused,
 		*num_slices_per_row = CFA_P4_WC_TCAM_SLICES_PER_ROW;
 		if (key_sz > *num_slices_per_row * CFA_P4_WC_TCAM_SLICE_SIZE)
 			return -ENOTSUP;
-
-		*num_slices_per_row = 1;
 	} else { /* for other type of tcam */
 		*num_slices_per_row = 1;
 	}
drivers/net/bnxt/tf_core/tf_device_p58.c +3 -4
index 50a8d82074..65e283ed11 100644
@@ -123,15 +123,14 @@ tf_dev_p58_get_tcam_slice_info(struct tf *tfp __rte_unused,
 			      uint16_t key_sz,
 			      uint16_t *num_slices_per_row)
 {
-#define CFA_P58_WC_TCAM_SLICES_PER_ROW 2
-#define CFA_P58_WC_TCAM_SLICE_SIZE     12
+#define CFA_P58_WC_TCAM_SLICES_PER_ROW 1
+#define CFA_P58_WC_TCAM_SLICE_SIZE     24
 
 	if (type == TF_TCAM_TBL_TYPE_WC_TCAM) {
+		/* only support single slice key size now */
 		*num_slices_per_row = CFA_P58_WC_TCAM_SLICES_PER_ROW;
 		if (key_sz > *num_slices_per_row * CFA_P58_WC_TCAM_SLICE_SIZE)
 			return -ENOTSUP;
-
-		*num_slices_per_row = 1;
 	} else { /* for other type of tcam */
 		*num_slices_per_row = 1;
 	}
drivers/net/bnxt/tf_core/tf_device_p58.h +3 -0
index abd916985e..07f022769b 100644
@@ -189,5 +189,8 @@ struct tf_global_cfg_cfg tf_global_cfg_p58[TF_GLOBAL_CFG_TYPE_MAX] = {
 	[TF_ACTION_BLOCK] = {
 		TF_GLOBAL_CFG_CFG_HCAPI, TF_ACTION_BLOCK
 	},
+	[TF_COUNTER_CFG] = {
+		TF_GLOBAL_CFG_CFG_HCAPI, TF_COUNTER_CFG
+	},
 };
 #endif /* _TF_DEVICE_P58_H_ */
drivers/net/bnxt/tf_core/tf_msg.c +20 -11
index 1af5c6d11c..ec4c7890c3 100644
@@ -39,19 +39,8 @@
  * array size (define above) should be checked and compared.
  */
 #define TF_MSG_SIZE_HWRM_TF_GLOBAL_CFG_SET 56
-static_assert(sizeof(struct hwrm_tf_global_cfg_set_input) ==
-	      TF_MSG_SIZE_HWRM_TF_GLOBAL_CFG_SET,
-	      "HWRM message size changed: hwrm_tf_global_cfg_set_input");
-
 #define TF_MSG_SIZE_HWRM_TF_EM_INSERT      104
-static_assert(sizeof(struct hwrm_tf_em_insert_input) ==
-	      TF_MSG_SIZE_HWRM_TF_EM_INSERT,
-	      "HWRM message size changed: hwrm_tf_em_insert_input");
-
 #define TF_MSG_SIZE_HWRM_TF_TBL_TYPE_SET   128
-static_assert(sizeof(struct hwrm_tf_tbl_type_set_input) ==
-	      TF_MSG_SIZE_HWRM_TF_TBL_TYPE_SET,
-	      "HWRM message size changed: hwrm_tf_tbl_type_set_input");
 
 /**
  * This is the MAX data we can transport across regular HWRM
@@ -630,6 +619,9 @@ tf_msg_insert_em_internal_entry(struct tf *tfp,
 	struct tf_dev_info *dev;
 	struct tf_session *tfs;
 
+	RTE_BUILD_BUG_ON(sizeof(struct hwrm_tf_em_insert_input) !=
+			 TF_MSG_SIZE_HWRM_TF_EM_INSERT);
+
 	/* Retrieve the session information */
 	rc = tf_session_get_session_internal(tfp, &tfs);
 	if (rc) {
@@ -1255,6 +1247,17 @@ tf_msg_tcam_entry_get(struct tf *tfp,
 	if (mparms.tf_resp_code != 0)
 		return tfp_le_to_cpu_32(mparms.tf_resp_code);
 
+	if (parms->key_size < resp.key_size ||
+	    parms->result_size < resp.result_size) {
+		rc = -EINVAL;
+		TFP_DRV_LOG(ERR,
+			    "%s: Key buffer(%d) is smaller than the key(%d), rc:%s\n",
+			    tf_dir_2_str(parms->dir),
+			    parms->key_size,
+			    resp.key_size,
+			    strerror(-rc));
+		return rc;
+	}
 	parms->key_size = resp.key_size;
 	parms->result_size = resp.result_size;
 	tfp_memcpy(parms->key, resp.dev_data, resp.key_size);
@@ -1320,6 +1323,9 @@ tf_msg_set_tbl_entry(struct tf *tfp,
 	struct tf_dev_info *dev;
 	struct tf_session *tfs;
 
+	RTE_BUILD_BUG_ON(sizeof(struct hwrm_tf_tbl_type_set_input) !=
+			 TF_MSG_SIZE_HWRM_TF_TBL_TYPE_SET);
+
 	/* Retrieve the session information */
 	rc = tf_session_get_session_internal(tfp, &tfs);
 	if (rc) {
@@ -1554,6 +1560,9 @@ tf_msg_set_global_cfg(struct tf *tfp,
 	struct tf_dev_info *dev;
 	struct tf_session *tfs;
 
+	RTE_BUILD_BUG_ON(sizeof(struct hwrm_tf_global_cfg_set_input) !=
+			 TF_MSG_SIZE_HWRM_TF_GLOBAL_CFG_SET);
+
 	/* Retrieve the session information */
 	rc = tf_session_get_session_internal(tfp, &tfs);
 	if (rc) {
drivers/net/bnxt/tf_core/tf_tcam.c +101 -91

307 lines not on this page · raw message

Signature · 1 line
2.17.1
#10 lore raw

PATCH 10/58 net/bnxt: add 64B SRAM record management with RM

In reply to Venkat Duvvuru

From: Farah Smith <[email protected]>

HCAPI RM now manages 64B records instead of 8B. Truflow core RM will manage the same. The tf_tbl core APIs now return 8B pointer addresses. These can be used directly as SRAM pointers in Action Records. When communicating with the firmware 8B addresses will be used.

---
 drivers/net/bnxt/tf_core/tf_device.h     |  29 ++++-
 drivers/net/bnxt/tf_core/tf_device_p4.c  |   2 +
 drivers/net/bnxt/tf_core/tf_device_p58.c |  71 ++++++++++
 drivers/net/bnxt/tf_core/tf_device_p58.h |  24 ++--
 drivers/net/bnxt/tf_core/tf_rm.h         |   2 +-
 drivers/net/bnxt/tf_core/tf_tbl.c        | 158 ++++++++++++++++++++++-
 6 files changed, 267 insertions(+), 19 deletions(-)
drivers/net/bnxt/tf_core/tf_device.h +28 -1
index 2cbb42fe2a..a18d59660b 100644
@@ -220,9 +220,36 @@ struct tf_dev_ops {
 	 */
 	int (*tf_dev_search_ident)(struct tf *tfp,
 				   struct tf_ident_search_parms *parms);
+	/**
+	 * Get SRAM table information.
+	 *
+	 * Converts an internal RM allocated element offset to
+	 * a user address and vice versa.
+	 *
+	 * [in] tfp
+	 *   Pointer to TF handle
+	 *
+	 * [in] type
+	 *   Truflow index table type, e.g. TF_TYPE_FULL_ACT_RECORD
+	 *
+	 * [in/out] base
+	 *   Pointer to the base address of the associated table type.
+	 *
+	 * [in/out] shift
+	 *   Pointer to any shift required for the associated table type.
+	 *
+	 * Returns
+	 *   - (0) if successful.
+	 *   - (-EINVAL) on failure.
+	 */
+	int (*tf_dev_get_tbl_info)(struct tf *tfp,
+				   void *tbl_db,
+				   enum tf_tbl_type type,
+				   uint16_t *base,
+				   uint16_t *shift);
 
 	/**
-	 * Allocation of a table type element.
+	 * Allocation of an index table type element.
 	 *
 	 * This API allocates the specified table type element from a
 	 * device specific table type DB. The allocated element is
drivers/net/bnxt/tf_core/tf_device_p4.c +2 -0
index e5aaaac9a0..8274978bfe 100644
@@ -206,6 +206,7 @@ const struct tf_dev_ops tf_dev_ops_p4_init = {
 	.tf_dev_alloc_ident = NULL,
 	.tf_dev_free_ident = NULL,
 	.tf_dev_search_ident = NULL,
+	.tf_dev_get_tbl_info = NULL,
 	.tf_dev_alloc_ext_tbl = NULL,
 	.tf_dev_alloc_tbl = NULL,
 	.tf_dev_free_ext_tbl = NULL,
@@ -246,6 +247,7 @@ const struct tf_dev_ops tf_dev_ops_p4 = {
 	.tf_dev_alloc_ident = tf_ident_alloc,
 	.tf_dev_free_ident = tf_ident_free,
 	.tf_dev_search_ident = tf_ident_search,
+	.tf_dev_get_tbl_info = NULL,
 	.tf_dev_alloc_tbl = tf_tbl_alloc,
 	.tf_dev_alloc_ext_tbl = tf_tbl_ext_alloc,
 	.tf_dev_free_tbl = tf_tbl_free,
drivers/net/bnxt/tf_core/tf_device_p58.c +71 -0

89 lines not on this page · raw message

drivers/net/bnxt/tf_core/tf_device_p58.h +12 -12
index 07f022769b..4d7a78e52c 100644
@@ -68,35 +68,35 @@ struct tf_rm_element_cfg tf_tbl_p58[TF_TBL_TYPE_MAX] = {
 	[TF_TBL_TYPE_FULL_ACT_RECORD] = {
 		.cfg_type        = TF_RM_ELEM_CFG_HCAPI_BA_PARENT,
 		.hcapi_type      = CFA_RESOURCE_TYPE_P58_SRAM_BANK_1,
-		.slices          = 4,
+		.slices          = 1,
 		.divider         = 8,
 	},
 	[TF_TBL_TYPE_COMPACT_ACT_RECORD] = {
 		.cfg_type        = TF_RM_ELEM_CFG_HCAPI_BA_CHILD,
 		.parent_subtype  = TF_TBL_TYPE_FULL_ACT_RECORD,
 		.hcapi_type      = CFA_RESOURCE_TYPE_P58_SRAM_BANK_1,
-		.slices          = 8,
+		.slices          = 1,
 		.divider         = 8,
 	},
 	/* Policy - Encaps in bank 2 */
 	[TF_TBL_TYPE_ACT_ENCAP_8B] = {
 		.cfg_type        = TF_RM_ELEM_CFG_HCAPI_BA_PARENT,
 		.hcapi_type      = CFA_RESOURCE_TYPE_P58_SRAM_BANK_2,
-		.slices          = 8,
+		.slices          = 1,
 		.divider         = 8,
 	},
 	[TF_TBL_TYPE_ACT_ENCAP_16B] = {
 		.cfg_type        = TF_RM_ELEM_CFG_HCAPI_BA_CHILD,
 		.parent_subtype  = TF_TBL_TYPE_ACT_ENCAP_8B,
 		.hcapi_type      = CFA_RESOURCE_TYPE_P58_SRAM_BANK_2,
-		.slices          = 4,
+		.slices          = 1,
 		.divider         = 8,
 	},
 	[TF_TBL_TYPE_ACT_ENCAP_32B] = {
 		.cfg_type        = TF_RM_ELEM_CFG_HCAPI_BA_CHILD,
 		.parent_subtype  = TF_TBL_TYPE_ACT_ENCAP_8B,
 		.hcapi_type      = CFA_RESOURCE_TYPE_P58_SRAM_BANK_2,
-		.slices          = 2,
+		.slices          = 1,
 		.divider         = 8,
 	},
 	[TF_TBL_TYPE_ACT_ENCAP_64B] = {
@@ -111,21 +111,21 @@ struct tf_rm_element_cfg tf_tbl_p58[TF_TBL_TYPE_MAX] = {
 		.cfg_type        = TF_RM_ELEM_CFG_HCAPI_BA_CHILD,
 		.parent_subtype  = TF_TBL_TYPE_ACT_ENCAP_8B,
 		.hcapi_type      = CFA_RESOURCE_TYPE_P58_SRAM_BANK_2,
-		.slices          = 8,
+		.slices          = 1,
 		.divider         = 8,
 	},
 	[TF_TBL_TYPE_ACT_MODIFY_16B] = {
 		.cfg_type        = TF_RM_ELEM_CFG_HCAPI_BA_CHILD,
 		.parent_subtype  = TF_TBL_TYPE_ACT_ENCAP_8B,
 		.hcapi_type      = CFA_RESOURCE_TYPE_P58_SRAM_BANK_2,
-		.slices          = 4,
+		.slices          = 1,
 		.divider         = 8,
 	},
 	[TF_TBL_TYPE_ACT_MODIFY_32B] = {
 		.cfg_type        = TF_RM_ELEM_CFG_HCAPI_BA_CHILD,
 		.parent_subtype  = TF_TBL_TYPE_ACT_ENCAP_8B,
 		.hcapi_type      = CFA_RESOURCE_TYPE_P58_SRAM_BANK_2,
-		.slices          = 2,
+		.slices          = 1,
 		.divider         = 8,
 	},
 	[TF_TBL_TYPE_ACT_MODIFY_64B] = {
@@ -139,28 +139,28 @@ struct tf_rm_element_cfg tf_tbl_p58[TF_TBL_TYPE_MAX] = {
 	[TF_TBL_TYPE_ACT_SP_SMAC] = {
 		.cfg_type        = TF_RM_ELEM_CFG_HCAPI_BA_PARENT,
 		.hcapi_type      = CFA_RESOURCE_TYPE_P58_SRAM_BANK_0,
-		.slices          = 8,
+		.slices          = 1,
 		.divider         = 8,
 	},
 	[TF_TBL_TYPE_ACT_SP_SMAC_IPV4] = {
 		.cfg_type        = TF_RM_ELEM_CFG_HCAPI_BA_CHILD,
 		.parent_subtype  = TF_TBL_TYPE_ACT_SP_SMAC,
 		.hcapi_type      = CFA_RESOURCE_TYPE_P58_SRAM_BANK_0,
-		.slices          = 4,
+		.slices          = 1,
 		.divider         = 8,
 	},
 	[TF_TBL_TYPE_ACT_SP_SMAC_IPV6] = {
 		.cfg_type        = TF_RM_ELEM_CFG_HCAPI_BA_CHILD,
 		.parent_subtype  = TF_TBL_TYPE_ACT_SP_SMAC,
 		.hcapi_type      = CFA_RESOURCE_TYPE_P58_SRAM_BANK_0,
-		.slices          = 2,
+		.slices          = 1,
 		.divider         = 8,
 	},
 	/* Policy - Stats in bank 3 */
 	[TF_TBL_TYPE_ACT_STATS_64] = {
 		.cfg_type        = TF_RM_ELEM_CFG_HCAPI_BA_PARENT,
 		.hcapi_type      = CFA_RESOURCE_TYPE_P58_SRAM_BANK_3,
-		.slices          = 8,
+		.slices          = 1,
 		.divider         = 8,
 	},
 };
drivers/net/bnxt/tf_core/tf_rm.h +1 -1
index 407c7d5bf9..6eb6865dac 100644
@@ -138,6 +138,7 @@ struct tf_rm_element_cfg {
 	 * resource pool chunk size.
 	 */
 	uint8_t slices;
+
 	/**
 	 * Pool element divider count
 	 * If 0 or 1, there is 1:1 correspondence between the RM
@@ -146,7 +147,6 @@ struct tf_rm_element_cfg {
 	 * correspondence to the HCAPI RM firmware resource.
 	 */
 	uint8_t divider;
-
 };
 
 /**
drivers/net/bnxt/tf_core/tf_tbl.c +153 -5

249 lines not on this page · raw message

Signature · 1 line
2.17.1
#11 lore raw

PATCH 11/58 net/bnxt: add hashing changes for Thor

In reply to Venkat Duvvuru

From: Peter Spreadborough <[email protected]>

- Move HCAPI hashing code to common file and add Thor support.
- Change DPDK EM insert for FKB to use limited size Type 3 key.
- Update FKB builder to be able to tell between EM and WC keys during transform.

---
 drivers/net/bnxt/hcapi/cfa/hcapi_cfa.h        |  72 ++++++++++-
 drivers/net/bnxt/hcapi/cfa/hcapi_cfa_common.c |  85 ++++++++++++
 drivers/net/bnxt/hcapi/cfa/hcapi_cfa_defs.h   |  15 +++
 drivers/net/bnxt/hcapi/cfa/hcapi_cfa_p4.c     | 109 +---------------
 drivers/net/bnxt/hcapi/cfa/hcapi_cfa_p58.c    | 122 ++++++++++++++++++
 drivers/net/bnxt/hcapi/cfa/hcapi_cfa_p58.h    |   6 +
 drivers/net/bnxt/hcapi/cfa/meson.build        |   4 +-
 drivers/net/bnxt/tf_core/tf_device.h          |  15 +++
 drivers/net/bnxt/tf_core/tf_device_p4.c       |   4 +
 drivers/net/bnxt/tf_core/tf_device_p58.c      |   4 +
 drivers/net/bnxt/tf_core/tf_em.h              |   8 +-
 drivers/net/bnxt/tf_core/tf_em_common.c       |  42 ++++--
 .../net/bnxt/tf_core/tf_em_hash_internal.c    |  22 +++-
 13 files changed, 383 insertions(+), 125 deletions(-)
 create mode 100644 drivers/net/bnxt/hcapi/cfa/hcapi_cfa_common.c
 create mode 100644 drivers/net/bnxt/hcapi/cfa/hcapi_cfa_p58.c
drivers/net/bnxt/hcapi/cfa/hcapi_cfa.h +68 -4
index c67aa29ad0..0580e07c45 100644
@@ -63,10 +63,74 @@ struct hcapi_cfa_devops {
 	 */
 	uint64_t (*hcapi_cfa_key_hash)(uint64_t *key_data, uint16_t bitlen);
 
-	/** hardware operation on the CFA EM key
-	 *
-	 * This API provides the functionality to program the exact match and
-	 * key data to exact match record memory.
+int hcapi_cfa_action_hw_op(struct hcapi_cfa_hwop *op,
+			   uint8_t *act_tbl,
+			   struct hcapi_cfa_data *act_obj);
+int hcapi_cfa_dev_hw_op(struct hcapi_cfa_hwop *op, uint16_t tbl_id,
+			struct hcapi_cfa_data *obj_data);
+int hcapi_cfa_rm_register_client(hcapi_cfa_rm_data_t *data,
+				 const char *client_name,
+				 int *client_id);
+int hcapi_cfa_rm_unregister_client(hcapi_cfa_rm_data_t *data,
+				   int client_id);
+int hcapi_cfa_rm_query_resources(hcapi_cfa_rm_data_t *data,
+				 int client_id,
+				 uint16_t chnl_id,
+				 struct hcapi_cfa_resc_req_db *req_db);
+int hcapi_cfa_rm_query_resources_one(hcapi_cfa_rm_data_t *data,
+				     int clien_id,
+				     struct hcapi_cfa_resc_db *resc_db);
+int hcapi_cfa_rm_reserve_resources(hcapi_cfa_rm_data_t *data,
+				   int client_id,
+				   struct hcapi_cfa_resc_req_db *resc_req,
+				   struct hcapi_cfa_resc_db *resc_db);
+int hcapi_cfa_rm_release_resources(hcapi_cfa_rm_data_t *data,
+				   int client_id,
+				   struct hcapi_cfa_resc_req_db *resc_req,
+				   struct hcapi_cfa_resc_db *resc_db);
+int hcapi_cfa_rm_initialize(hcapi_cfa_rm_data_t *data);
+
+#if SUPPORT_CFA_HW_P4
+
+int hcapi_cfa_p4_dev_hw_op(struct hcapi_cfa_hwop *op, uint16_t tbl_id,
+			    struct hcapi_cfa_data *obj_data);
+int hcapi_cfa_p4_prof_l2ctxt_hwop(struct hcapi_cfa_hwop *op,
+				   struct hcapi_cfa_data *obj_data);
+int hcapi_cfa_p4_prof_l2ctxtrmp_hwop(struct hcapi_cfa_hwop *op,
+				      struct hcapi_cfa_data *obj_data);
+int hcapi_cfa_p4_prof_tcam_hwop(struct hcapi_cfa_hwop *op,
+				 struct hcapi_cfa_data *obj_data);
+int hcapi_cfa_p4_prof_tcamrmp_hwop(struct hcapi_cfa_hwop *op,
+				    struct hcapi_cfa_data *obj_data);
+int hcapi_cfa_p4_wc_tcam_hwop(struct hcapi_cfa_hwop *op,
+			       struct hcapi_cfa_data *obj_data);
+int hcapi_cfa_p4_wc_tcam_rec_hwop(struct hcapi_cfa_hwop *op,
+				   struct hcapi_cfa_data *obj_data);
+int hcapi_cfa_p4_mirror_hwop(struct hcapi_cfa_hwop *op,
+			     struct hcapi_cfa_data *mirror);
+int hcapi_cfa_p4_global_cfg_hwop(struct hcapi_cfa_hwop *op,
+				 uint32_t type,
+				 struct hcapi_cfa_data *config);
+/* SUPPORT_CFA_HW_P4 */
+#elif SUPPORT_CFA_HW_P45
+int hcapi_cfa_p45_mirror_hwop(struct hcapi_cfa_hwop *op,
+			      struct hcapi_cfa_data *mirror);
+int hcapi_cfa_p45_global_cfg_hwop(struct hcapi_cfa_hwop *op,
+				  uint32_t type,
+				  struct hcapi_cfa_data *config);
+/* SUPPORT_CFA_HW_P45 */
+#endif
+
+/**
+ *  HCAPI CFA device HW operation function callback definition
+ *  This is standardized function callback hook to install different
+ *  CFA HW table programming function callback.
+ */
+
+struct hcapi_cfa_tbl_cb {
+	/**
+	 * This function callback provides the functionality to read/write
+	 * HW table entry from a HW table.
 	 *
 	 * @param[in] op
 	 *   A pointer to the Hardware operation parameter
drivers/net/bnxt/hcapi/cfa/hcapi_cfa_common.c new file +85 -0

85 lines not on this page · raw message

drivers/net/bnxt/hcapi/cfa/hcapi_cfa_defs.h +15 -0
index 8e5095a6ef..579f1d5693 100644
@@ -54,6 +54,16 @@ enum hcapi_cfa_dir {
 	HCAPI_CFA_DIR_MAX = 2
 };
 
+/*
+ * Hashing defines
+ */
+#define HCAPI_CFA_LKUP_SEED_MEM_SIZE 512
+
+/* CRC32i support for Key0 hash */
+#define ucrc32(ch, crc) (crc32tbl[((crc) ^ (ch)) & 0xff] ^ ((crc) >> 8))
+#define crc32(x, y) crc32i(~0, x, y)
+
+
 /**
  * CFA HW OPCODE definition
  */
@@ -282,4 +292,9 @@ int hcapi_cfa_key_hw_op(struct hcapi_cfa_hwop *op,
 
 uint64_t hcapi_get_table_page(struct hcapi_cfa_em_table *mem,
 			      uint32_t page);
+uint32_t hcapi_cfa_crc32i(uint32_t crc, const uint8_t *buf, size_t len);
+uint64_t hcapi_cfa_p4_key_hash(uint64_t *key_data,
+			       uint16_t bitlen);
+uint64_t hcapi_cfa_p58_key_hash(uint64_t *key_data,
+				uint16_t bitlen);
 #endif /* HCAPI_CFA_DEFS_H_ */
drivers/net/bnxt/hcapi/cfa/hcapi_cfa_p4.c +7 -102

127 lines not on this page · raw message

drivers/net/bnxt/hcapi/cfa/hcapi_cfa_p58.c new file +122 -0

122 lines not on this page · raw message

drivers/net/bnxt/hcapi/cfa/hcapi_cfa_p58.h +6 -0
index b2535098d2..27796b1b2f 100644
@@ -6,6 +6,12 @@
 #ifndef _HCAPI_CFA_P58_H_
 #define _HCAPI_CFA_P58_H_
 
+/**
+ * EEM Key entry sizes
+ */
+#define CFA_P58_EEM_KEY_MAX_SIZE 80
+#define CFA_P58_EEM_KEY_RECORD_SIZE 80
+
 /** CFA phase 5.8 fix formatted table(layout) ID definition
  *
  */
drivers/net/bnxt/hcapi/cfa/meson.build +3 -1
index 8b70d273f4..5cdb1862f3 100644
@@ -7,4 +7,6 @@ includes += include_directories('.')
 
 #Add the source files
 sources += files(
-        'hcapi_cfa_p4.c')
+	'hcapi_cfa_p4.c',
+	'hcapi_cfa_p58.c',
+	'hcapi_cfa_common.c')
drivers/net/bnxt/tf_core/tf_device.h +15 -0
index a18d59660b..3f2c24a0c6 100644
@@ -752,6 +752,21 @@ struct tf_dev_ops {
 	 *   Size in byte
 	 */
 	int (*tf_dev_word_align)(uint16_t size);
+
+	/**
+	 * Hash key using crc32 and lookup3
+	 *
+	 * [in] key_data
+	 *   Pointer to key
+	 *
+	 * [in] bitlen
+	 *   Number of key bits
+	 *
+	 * Returns
+	 *   Hashes
+	 */
+	uint64_t (*tf_dev_cfa_key_hash)(uint64_t *key_data,
+					  uint16_t bitlen);
 };
 
 /**
drivers/net/bnxt/tf_core/tf_device_p4.c +4 -0
index 8274978bfe..2fb8fadb56 100644
@@ -18,6 +18,9 @@
 #define TF_DEV_P4_PARIF_MAX 16
 #define TF_DEV_P4_PF_MASK 0xfUL
 
+uint64_t hcapi_cfa_key_hash_p4(uint64_t *key_data,
+			       uint16_t bitlen);
+
 const char *tf_resource_str_p4[CFA_RESOURCE_TYPE_P4_LAST + 1] = {
 	[CFA_RESOURCE_TYPE_P4_MCG] = "mc_group",
 	[CFA_RESOURCE_TYPE_P4_ENCAP_8B] = "encap_8 ",
@@ -276,4 +279,5 @@ const struct tf_dev_ops tf_dev_ops_p4 = {
 	.tf_dev_get_global_cfg = tf_global_cfg_get,
 	.tf_dev_get_mailbox = tf_dev_p4_get_mailbox,
 	.tf_dev_word_align = tf_dev_p4_word_align,
+	.tf_dev_cfa_key_hash = hcapi_cfa_p4_key_hash
 };
drivers/net/bnxt/tf_core/tf_device_p58.c +4 -0
index b61c58e41b..517ffc811b 100644
@@ -18,6 +18,9 @@
 #define TF_DEV_P58_PARIF_MAX 16
 #define TF_DEV_P58_PF_MASK 0xfUL
 
+uint64_t hcapi_cfa_key_hash_p58(uint64_t *key_data,
+				uint16_t bitlen);
+
 /* For print alignment, make all entries 8 chars in this table */
 const char *tf_resource_str_p58[CFA_RESOURCE_TYPE_P58_LAST + 1] = {
 	[CFA_RESOURCE_TYPE_P58_METER]              = "meter   ",
@@ -297,4 +300,5 @@ const struct tf_dev_ops tf_dev_ops_p58 = {
 	.tf_dev_get_global_cfg = tf_global_cfg_get,
 	.tf_dev_get_mailbox = tf_dev_p58_get_mailbox,
 	.tf_dev_word_align = tf_dev_p58_word_align,
+	.tf_dev_cfa_key_hash = hcapi_cfa_p58_key_hash
 };
drivers/net/bnxt/tf_core/tf_em.h +5 -3
index 5a67ca3509..4de9e42cbc 100644
@@ -14,8 +14,10 @@
 #define TF_EM_MIN_ENTRIES     (1 << 15) /* 32K */
 #define TF_EM_MAX_ENTRIES     (1 << 27) /* 128M */
 
-#define TF_HW_EM_KEY_MAX_SIZE 52
-#define TF_EM_KEY_RECORD_SIZE 64
+#define TF_P4_HW_EM_KEY_MAX_SIZE 52
+#define TF_P4_EM_KEY_RECORD_SIZE 64
+
+#define TF_P58_HW_EM_KEY_MAX_SIZE 80
 
 #define TF_EM_MAX_MASK 0x7FFF
 #define TF_EM_MAX_ENTRY (128 * 1024 * 1024)
@@ -95,7 +97,7 @@ struct tf_em_64b_entry {
 	/** Header is 8 bytes long */
 	struct cfa_p4_eem_entry_hdr hdr;
 	/** Key is 448 bits - 56 bytes */
-	uint8_t key[TF_EM_KEY_RECORD_SIZE - sizeof(struct cfa_p4_eem_entry_hdr)];
+	uint8_t key[TF_P4_EM_KEY_RECORD_SIZE - sizeof(struct cfa_p4_eem_entry_hdr)];
 };
 
 /** EEM Memory Type
drivers/net/bnxt/tf_core/tf_em_common.c +30 -12

96 lines not on this page · raw message

drivers/net/bnxt/tf_core/tf_em_hash_internal.c +19 -3
index 09183b42f0..f6c9772b44 100644
@@ -15,6 +15,7 @@
 #include "tf_msg.h"
 #include "tfp.h"
 #include "tf_ext_flow_handle.h"
+#include "tf_device.h"
 
 #include "bnxt.h"
 
@@ -43,6 +44,18 @@ tf_em_hash_insert_int_entry(struct tf *tfp,
 	uint32_t key0_hash;
 	uint32_t key1_hash;
 	uint64_t big_hash;
+	struct tf_dev_info *dev;
+	struct tf_session *tfs;
+
+	/* Retrieve the session information */
+	rc = tf_session_get_session_internal(tfp, &tfs);
+	if (rc)
+		return rc;
+
+	/* Retrieve the device information */
+	rc = tf_session_get_device(tfs, &dev);
+	if (rc)
+		return rc;
 
 	rc = stack_pop(pool, &index);
 	if (rc) {
@@ -52,8 +65,11 @@ tf_em_hash_insert_int_entry(struct tf *tfp,
 		return rc;
 	}
 
-	big_hash = hcapi_cfa_key_hash((uint64_t *)parms->key,
-				      (TF_HW_EM_KEY_MAX_SIZE + 4) * 8);
+	if (dev->ops->tf_dev_cfa_key_hash == NULL)
+		return -EINVAL;
+
+	big_hash = dev->ops->tf_dev_cfa_key_hash((uint64_t *)parms->key,
+					TF_P58_HW_EM_KEY_MAX_SIZE * 8);
 	key0_hash = (uint32_t)(big_hash >> 32);
 	key1_hash = (uint32_t)(big_hash & 0xFFFFFFFF);
 
@@ -93,7 +109,7 @@ tf_em_hash_insert_int_entry(struct tf *tfp,
 	TF_SET_FIELDS_IN_FLOW_HANDLE(parms->flow_handle,
 				     (uint32_t)num_of_entries,
 				     0,
-				     0,
+				     TF_FLAGS_FLOW_HANDLE_INTERNAL,
 				     rptr_index,
 				     rptr_entry,
 				     0);
Signature · 1 line
2.17.1
#12 lore raw

PATCH 12/58 net/bnxt: modify TRUFLOW HWRM messages

In reply to Venkat Duvvuru

From: Farah Smith <[email protected]>

- Move Bulk get to a direct HWRM message
- Deprecate code based on HCAPI changes

---
 drivers/net/bnxt/hcapi/cfa/hcapi_cfa.h        |  72 +----
 drivers/net/bnxt/hcapi/cfa/hcapi_cfa_common.c |   4 +-
 drivers/net/bnxt/hcapi/cfa/hcapi_cfa_defs.h   | 197 ++++++++----
 drivers/net/bnxt/hcapi/cfa/hcapi_cfa_p4.c     | 116 ++++---
 drivers/net/bnxt/hcapi/cfa/hcapi_cfa_p4.h     | 282 +----------------
 drivers/net/bnxt/hcapi/cfa/hcapi_cfa_p58.c    |   2 +-
 drivers/net/bnxt/hcapi/cfa/hcapi_cfa_p58.h    | 287 +-----------------
 drivers/net/bnxt/tf_core/hwrm_tf.h            | 196 ------------
 drivers/net/bnxt/tf_core/lookup3.h            |   2 +-
 drivers/net/bnxt/tf_core/tf_core.c            |   1 -
 drivers/net/bnxt/tf_core/tf_core.h            | 127 ++++----
 drivers/net/bnxt/tf_core/tf_device.c          |   2 +-
 drivers/net/bnxt/tf_core/tf_device_p4.h       |  75 +++--
 drivers/net/bnxt/tf_core/tf_device_p58.h      |  48 ++-
 drivers/net/bnxt/tf_core/tf_em.h              |   4 +-
 drivers/net/bnxt/tf_core/tf_em_common.c       | 250 ++++++++++-----
 drivers/net/bnxt/tf_core/tf_em_common.h       |  68 ++++-
 drivers/net/bnxt/tf_core/tf_em_host.c         | 109 +++++--
 drivers/net/bnxt/tf_core/tf_msg.c             | 263 ++++++++++++++--
 drivers/net/bnxt/tf_core/tf_msg.h             |  87 ++++++
 drivers/net/bnxt/tf_core/tf_msg_common.h      |   3 -
 drivers/net/bnxt/tf_core/tf_session.c         | 115 +++++++
 drivers/net/bnxt/tf_core/tf_session.h         |  90 ++++++
 drivers/net/bnxt/tf_core/tf_tbl.h             |  30 --
 drivers/net/bnxt/tf_core/tf_util.c            |  12 -
 drivers/net/bnxt/tf_core/tf_util.h            |   4 +
 drivers/net/bnxt/tf_core/tfp.c                |  34 ---
 drivers/net/bnxt/tf_core/tfp.h                |  52 ----
 28 files changed, 1202 insertions(+), 1330 deletions(-)
 delete mode 100644 drivers/net/bnxt/tf_core/hwrm_tf.h
drivers/net/bnxt/hcapi/cfa/hcapi_cfa.h +4 -68
index 0580e07c45..c67aa29ad0 100644
@@ -63,74 +63,10 @@ struct hcapi_cfa_devops {
 	 */
 	uint64_t (*hcapi_cfa_key_hash)(uint64_t *key_data, uint16_t bitlen);
 
-int hcapi_cfa_action_hw_op(struct hcapi_cfa_hwop *op,
-			   uint8_t *act_tbl,
-			   struct hcapi_cfa_data *act_obj);
-int hcapi_cfa_dev_hw_op(struct hcapi_cfa_hwop *op, uint16_t tbl_id,
-			struct hcapi_cfa_data *obj_data);
-int hcapi_cfa_rm_register_client(hcapi_cfa_rm_data_t *data,
-				 const char *client_name,
-				 int *client_id);
-int hcapi_cfa_rm_unregister_client(hcapi_cfa_rm_data_t *data,
-				   int client_id);
-int hcapi_cfa_rm_query_resources(hcapi_cfa_rm_data_t *data,
-				 int client_id,
-				 uint16_t chnl_id,
-				 struct hcapi_cfa_resc_req_db *req_db);
-int hcapi_cfa_rm_query_resources_one(hcapi_cfa_rm_data_t *data,
-				     int clien_id,
-				     struct hcapi_cfa_resc_db *resc_db);
-int hcapi_cfa_rm_reserve_resources(hcapi_cfa_rm_data_t *data,
-				   int client_id,
-				   struct hcapi_cfa_resc_req_db *resc_req,
-				   struct hcapi_cfa_resc_db *resc_db);
-int hcapi_cfa_rm_release_resources(hcapi_cfa_rm_data_t *data,
-				   int client_id,
-				   struct hcapi_cfa_resc_req_db *resc_req,
-				   struct hcapi_cfa_resc_db *resc_db);
-int hcapi_cfa_rm_initialize(hcapi_cfa_rm_data_t *data);
-
-#if SUPPORT_CFA_HW_P4
-
-int hcapi_cfa_p4_dev_hw_op(struct hcapi_cfa_hwop *op, uint16_t tbl_id,
-			    struct hcapi_cfa_data *obj_data);
-int hcapi_cfa_p4_prof_l2ctxt_hwop(struct hcapi_cfa_hwop *op,
-				   struct hcapi_cfa_data *obj_data);
-int hcapi_cfa_p4_prof_l2ctxtrmp_hwop(struct hcapi_cfa_hwop *op,
-				      struct hcapi_cfa_data *obj_data);
-int hcapi_cfa_p4_prof_tcam_hwop(struct hcapi_cfa_hwop *op,
-				 struct hcapi_cfa_data *obj_data);
-int hcapi_cfa_p4_prof_tcamrmp_hwop(struct hcapi_cfa_hwop *op,
-				    struct hcapi_cfa_data *obj_data);
-int hcapi_cfa_p4_wc_tcam_hwop(struct hcapi_cfa_hwop *op,
-			       struct hcapi_cfa_data *obj_data);
-int hcapi_cfa_p4_wc_tcam_rec_hwop(struct hcapi_cfa_hwop *op,
-				   struct hcapi_cfa_data *obj_data);
-int hcapi_cfa_p4_mirror_hwop(struct hcapi_cfa_hwop *op,
-			     struct hcapi_cfa_data *mirror);
-int hcapi_cfa_p4_global_cfg_hwop(struct hcapi_cfa_hwop *op,
-				 uint32_t type,
-				 struct hcapi_cfa_data *config);
-/* SUPPORT_CFA_HW_P4 */
-#elif SUPPORT_CFA_HW_P45
-int hcapi_cfa_p45_mirror_hwop(struct hcapi_cfa_hwop *op,
-			      struct hcapi_cfa_data *mirror);
-int hcapi_cfa_p45_global_cfg_hwop(struct hcapi_cfa_hwop *op,
-				  uint32_t type,
-				  struct hcapi_cfa_data *config);
-/* SUPPORT_CFA_HW_P45 */
-#endif
-
-/**
- *  HCAPI CFA device HW operation function callback definition
- *  This is standardized function callback hook to install different
- *  CFA HW table programming function callback.
- */
-
-struct hcapi_cfa_tbl_cb {
-	/**
-	 * This function callback provides the functionality to read/write
-	 * HW table entry from a HW table.
+	/** hardware operation on the CFA EM key
+	 *
+	 * This API provides the functionality to program the exact match and
+	 * key data to exact match record memory.
 	 *
 	 * @param[in] op
 	 *   A pointer to the Hardware operation parameter
drivers/net/bnxt/hcapi/cfa/hcapi_cfa_common.c +1 -3
index fc96e3bff7..93a9f555df 100644
@@ -3,9 +3,7 @@
  *   All rights reserved.
  */
 
-#include "hcapi_cfa_defs.h"
-#include <errno.h>
-#include "assert.h"
+#include "hcapi_cfa.h"
 
 const uint32_t crc32tbl[] = {	/* CRC polynomial 0xedb88320 */
 0x00000000, 0x77073096, 0xee0e612c, 0x990951ba,
drivers/net/bnxt/hcapi/cfa/hcapi_cfa_defs.h +139 -58

299 lines not on this page · raw message

drivers/net/bnxt/hcapi/cfa/hcapi_cfa_p4.c +52 -64

258 lines not on this page · raw message

drivers/net/bnxt/hcapi/cfa/hcapi_cfa_p4.h +1 -281

292 lines not on this page · raw message

drivers/net/bnxt/hcapi/cfa/hcapi_cfa_p58.c +1 -1
index 723b8393b9..a70c6f4eaa 100644
@@ -88,7 +88,7 @@ static uint32_t hcapi_cfa_lookup3_hash(uint8_t *in_key)
 {
 	uint32_t val1;
 
-	val1 = hashword(((uint32_t *)in_key) + 1,
+	val1 = hashword(((uint32_t *)in_key),
 			 CFA_P58_EEM_KEY_MAX_SIZE / (sizeof(uint32_t)),
 			 hcapi_cfa_lkup_lkup3_init_cfg);
 
drivers/net/bnxt/hcapi/cfa/hcapi_cfa_p58.h +6 -281

305 lines not on this page · raw message

drivers/net/bnxt/tf_core/hwrm_tf.h deleted +0 -196

196 lines not on this page · raw message

drivers/net/bnxt/tf_core/lookup3.h +1 -1
index b1fd2cd436..743c4d9c4f 100644
@@ -122,7 +122,7 @@ static inline uint32_t hashword(const uint32_t *k,
 				size_t length,
 				uint32_t initval) {
 	uint32_t a, b, c;
-	int index = 12;
+	int index = length - 1;
 
 	/* Set up the internal state */
 	a = 0xdeadbeef + (((uint32_t)length) << 2) + initval;
drivers/net/bnxt/tf_core/tf_core.c +0 -1
index 573fa0b1ed..9b8677caac 100644
@@ -18,7 +18,6 @@
 #include "bnxt.h"
 #include "rand.h"
 #include "tf_common.h"
-#include "hwrm_tf.h"
 #include "tf_ext_flow_handle.h"
 
 int
drivers/net/bnxt/tf_core/tf_core.h +62 -65

277 lines not on this page · raw message

drivers/net/bnxt/tf_core/tf_device.c +1 -1
index 61b3746d8b..9e71c04bf2 100644
@@ -487,7 +487,7 @@ tf_dev_bind_p58(struct tf *tfp,
  *   - (-EINVAL) on failure.
  */
 static int
-	tf_dev_unbind_p58(struct tf *tfp)
+tf_dev_unbind_p58(struct tf *tfp)
 {
 	int rc = 0;
 	bool fail = false;
drivers/net/bnxt/tf_core/tf_device_p4.h +50 -25

142 lines not on this page · raw message

drivers/net/bnxt/tf_core/tf_device_p58.h +32 -16

94 lines not on this page · raw message

drivers/net/bnxt/tf_core/tf_em.h +3 -1
index 4de9e42cbc..2de1862cd9 100644
@@ -9,7 +9,9 @@
 #include "tf_core.h"
 #include "tf_session.h"
 
-#include "hcapi/cfa/hcapi_cfa_defs.h"
+#include "tf_em_common.h"
+
+#include "hcapi_cfa_defs.h"
 
 #define TF_EM_MIN_ENTRIES     (1 << 15) /* 32K */
 #define TF_EM_MAX_ENTRIES     (1 << 27) /* 128M */
drivers/net/bnxt/tf_core/tf_em_common.c +168 -82

413 lines not on this page · raw message

drivers/net/bnxt/tf_core/tf_em_common.h +67 -1

84 lines not on this page · raw message

drivers/net/bnxt/tf_core/tf_em_host.c +84 -25

197 lines not on this page · raw message

drivers/net/bnxt/tf_core/tf_msg.c +234 -29

314 lines not on this page · raw message

drivers/net/bnxt/tf_core/tf_msg.h +87 -0

87 lines not on this page · raw message

drivers/net/bnxt/tf_core/tf_msg_common.h +0 -3
index 0c5c21fd68..49f334717d 100644

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

drivers/net/bnxt/tf_core/tf_session.c +115 -0

115 lines not on this page · raw message

drivers/net/bnxt/tf_core/tf_session.h +90 -0

90 lines not on this page · raw message

drivers/net/bnxt/tf_core/tf_tbl.h +0 -30
index f0d8e94f7e..9271cf28eb 100644

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

drivers/net/bnxt/tf_core/tf_util.c +0 -12
index b4d47d5a8c..25f5c152d2 100644

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

drivers/net/bnxt/tf_core/tf_util.h +4 -0
index 1aa35b6b82..4caf50349d 100644

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

drivers/net/bnxt/tf_core/tfp.c +0 -34
index b88affcf1e..37c49b587d 100644

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

drivers/net/bnxt/tf_core/tfp.h +0 -52

52 lines not on this page · raw message

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

Signature · 1 line
2.17.1

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

#13 lore raw

PATCH 13/58 net/bnxt: change RM database type

In reply to Venkat Duvvuru

From: Jay Ding <[email protected]>

RM databases are statically defined in each module. New static database needs to be defined in the code when multiple sessions are added. Add dynamic alloc database and associate it to each session.

---
 drivers/net/bnxt/tf_core/tf_em.h          |  10 ++
 drivers/net/bnxt/tf_core/tf_em_internal.c |  44 +++++--
 drivers/net/bnxt/tf_core/tf_identifier.c  |  82 ++++++++++--
 drivers/net/bnxt/tf_core/tf_identifier.h  |  10 ++
 drivers/net/bnxt/tf_core/tf_tbl.c         | 151 +++++++++++++++++-----
 drivers/net/bnxt/tf_core/tf_tbl.h         |  10 ++
 drivers/net/bnxt/tf_core/tf_tcam.c        | 107 ++++++++++++---
 drivers/net/bnxt/tf_core/tf_tcam.h        |  10 ++
 8 files changed, 351 insertions(+), 73 deletions(-)
drivers/net/bnxt/tf_core/tf_em.h +10 -0
index 2de1862cd9..19ad7f12be 100644
@@ -133,6 +133,16 @@ struct tf_em_cfg_parms {
 	enum tf_mem_type mem_type;
 };
 
+/**
+ * EM database
+ *
+ * EM rm database
+ *
+ */
+struct em_rm_db {
+	struct rm_db *em_db[TF_DIR_MAX];
+};
+
 /**
  * @page em EM
  *
drivers/net/bnxt/tf_core/tf_em_internal.c +34 -10

93 lines not on this page · raw message

drivers/net/bnxt/tf_core/tf_identifier.c +69 -13

174 lines not on this page · raw message

drivers/net/bnxt/tf_core/tf_identifier.h +10 -0
index 2700416c71..54cecbfd4c 100644
@@ -99,6 +99,16 @@ struct tf_ident_search_parms {
 	uint32_t *ref_cnt;
 };
 
+/**
+ * Identifier database
+ *
+ * Identifier rm database
+ *
+ */
+struct ident_rm_db {
+	struct rm_db *ident_db[TF_DIR_MAX];
+};
+
 /**
  * @page ident Identity Management
  *
drivers/net/bnxt/tf_core/tf_tbl.c +122 -29

324 lines not on this page · raw message

drivers/net/bnxt/tf_core/tf_tbl.h +10 -0
index 9271cf28eb..83b72d1b3f 100644
@@ -229,6 +229,16 @@ struct tf_tbl_get_bulk_parms {
 	uint64_t physical_mem_addr;
 };
 
+/**
+ * Table RM database
+ *
+ * Table rm database
+ *
+ */
+struct tbl_rm_db {
+	struct rm_db *tbl_db[TF_DIR_MAX];
+};
+
 /**
  * @page tbl Table
  *
drivers/net/bnxt/tf_core/tf_tcam.c +86 -21

260 lines not on this page · raw message

drivers/net/bnxt/tf_core/tf_tcam.h +10 -0
index b550fa43ca..acab223532 100644
@@ -237,6 +237,16 @@ struct tf_tcam_get_parms {
 	uint16_t result_size;
 };
 
+/**
+ * TCAM database
+ *
+ * Tcam rm database
+ *
+ */
+struct tcam_rm_db {
+	struct rm_db *tcam_db[TF_DIR_MAX];
+};
+
 /**
  * @page tcam TCAM
  *
Signature · 1 line
2.17.1
#14 lore raw

PATCH 14/58 net/bnxt: add shared session support

In reply to Venkat Duvvuru

From: Jay Ding <[email protected]>

There are 2 types of sessions - shared and non-shared. For non-shared all the allocated resources are owned and managed by a single session instance. No other applications have access to the resources owned by the non-shared session. For a shared session, resources are shared between 2 applications.

The FW shared session can only be created by one application and shared by other apps. The host session that creates the FW shared session is the creator.

Applications can retrieve the reserved resources through a new API tf_get_session_resc_info.

Each module supports two sessions, one is shared session, the other is non-shared session.

---
 drivers/net/bnxt/hsi_struct_def_dpdk.h    | 281 +++++++++++++++++-----
 drivers/net/bnxt/tf_core/bitalloc.c       |  10 +-
 drivers/net/bnxt/tf_core/bitalloc.h       |   3 +-
 drivers/net/bnxt/tf_core/tf_core.c        | 105 ++++++++
 drivers/net/bnxt/tf_core/tf_core.h        | 177 +++++++++++++-
 drivers/net/bnxt/tf_core/tf_device.c      |  76 +++---
 drivers/net/bnxt/tf_core/tf_device.h      |  73 ++++++
 drivers/net/bnxt/tf_core/tf_device_p4.c   |   8 +
 drivers/net/bnxt/tf_core/tf_device_p58.c  |   8 +
 drivers/net/bnxt/tf_core/tf_em.h          |  17 ++
 drivers/net/bnxt/tf_core/tf_em_common.c   |  25 --
 drivers/net/bnxt/tf_core/tf_em_internal.c | 118 +++++----
 drivers/net/bnxt/tf_core/tf_identifier.c  |  89 +++----
 drivers/net/bnxt/tf_core/tf_identifier.h  |  16 ++
 drivers/net/bnxt/tf_core/tf_msg.c         | 223 ++++++++++++++---
 drivers/net/bnxt/tf_core/tf_msg.h         |  47 +++-
 drivers/net/bnxt/tf_core/tf_rm.c          | 277 ++++++++++++++++++++-
 drivers/net/bnxt/tf_core/tf_rm.h          |  34 +++
 drivers/net/bnxt/tf_core/tf_session.c     |  37 ++-
 drivers/net/bnxt/tf_core/tf_session.h     |  66 +++++
 drivers/net/bnxt/tf_core/tf_tbl.c         | 104 ++++----
 drivers/net/bnxt/tf_core/tf_tbl.h         |  17 ++
 drivers/net/bnxt/tf_core/tf_tcam.c        | 103 ++++----
 drivers/net/bnxt/tf_core/tf_tcam.h        |  16 ++
 drivers/net/bnxt/tf_core/tfp.c            |   6 +-
 drivers/net/bnxt/tf_core/tfp.h            |   3 +-
 26 files changed, 1560 insertions(+), 379 deletions(-)
drivers/net/bnxt/hsi_struct_def_dpdk.h +222 -59
index aea9305486..046acb8de2 100644
@@ -699,6 +699,8 @@ struct cmd_nums {
 	/* Experimental */
 	#define HWRM_TF_SESSION_RESC_FLUSH                UINT32_C(0x2cf)
 	/* Experimental */
+	#define HWRM_TF_SESSION_RESC_INFO                 UINT32_C(0x2d0)
+	/* Experimental */
 	#define HWRM_TF_TBL_TYPE_GET                      UINT32_C(0x2da)
 	/* Experimental */
 	#define HWRM_TF_TBL_TYPE_SET                      UINT32_C(0x2db)
@@ -727,6 +729,8 @@ struct cmd_nums {
 	/* Experimental */
 	#define HWRM_TF_EM_HASH_INSERT                    UINT32_C(0x2ec)
 	/* Experimental */
+	#define HWRM_TF_EM_MOVE                           UINT32_C(0x2ed)
+	/* Experimental */
 	#define HWRM_TF_TCAM_SET                          UINT32_C(0x2f8)
 	/* Experimental */
 	#define HWRM_TF_TCAM_GET                          UINT32_C(0x2f9)
@@ -986,8 +990,8 @@ struct hwrm_err_output {
 #define HWRM_VERSION_MINOR 10
 #define HWRM_VERSION_UPDATE 2
 /* non-zero means beta version */
-#define HWRM_VERSION_RSVD 15
-#define HWRM_VERSION_STR "1.10.2.15"
+#define HWRM_VERSION_RSVD 22
+#define HWRM_VERSION_STR "1.10.2.22"
 
 /****************
  * hwrm_ver_get *
@@ -11971,7 +11975,7 @@ struct hwrm_func_cfg_input {
 	/*
 	 * Function ID of the function that is being
 	 * configured.
-	 * If set to 0xFF... (All Fs), then the configuration is
+	 * If set to 0xFF... (All Fs), then the the configuration is
 	 * for the requesting function.
 	 */
 	uint16_t	fid;
@@ -12671,7 +12675,7 @@ struct hwrm_func_cfg_input {
 	/*
 	 * When this bit is '1', the caller requests to disable a MPC
 	 * channel with destination to the TX configurable flow processing
-	 * block. When this bit is ‘0’, this flag has no effect.
+	 * block block. When this bit is ‘0’, this flag has no effect.
 	 */
 	#define HWRM_FUNC_CFG_INPUT_MPC_CHNLS_TE_CFA_DISABLE \
 		UINT32_C(0x20)
@@ -12685,7 +12689,7 @@ struct hwrm_func_cfg_input {
 	/*
 	 * When this bit is '1', the caller requests to disable a MPC
 	 * channel with destination to the RX configurable flow processing
-	 * block. When this bit is ‘0’, this flag has no effect.
+	 * block block. When this bit is ‘0’, this flag has no effect.
 	 */
 	#define HWRM_FUNC_CFG_INPUT_MPC_CHNLS_RE_CFA_DISABLE \
 		UINT32_C(0x80)
@@ -18041,7 +18045,7 @@ struct hwrm_func_spd_cfg_input {
 		UINT32_C(0x10)
 	/*
 	 * Ethertype value used in the encapsulated SPD packet header.
-	 * The user must choose a value that is not conflicting with
+	 * The user must chooose a value that is not conflicting with
 	 * publicly defined ethertype values. By default, the ethertype
 	 * value of 0xffff is used if there is no user specified value.
 	 */
@@ -18300,7 +18304,7 @@ struct hwrm_func_spd_qcfg_output {
 	uint8_t	unused_1;
 	/*
 	 * Ethertype value used in the encapsulated SPD packet header.
-	 * The user must choose a value that is not conflicting with
+	 * The user must chooose a value that is not conflicting with
 	 * publicly defined ethertype values. By default, the ethertype
 	 * value of 0xffff is used if there is no user specified value.
 	 */
@@ -29815,7 +29819,7 @@ struct hwrm_vnic_cfg_input {
 	 * queue ID will be arriving on this VNIC.  Packet priority to CoS mapping
 	 * rules can be specified using HWRM_QUEUE_PRI2COS_CFG.  In this mode,
 	 * ntuple filters with VNIC destination specified are invalid since they
-	 * conflict with the CoS to VNIC steering rules in this mode.
+	 * conflict with the the CoS to VNIC steering rules in this mode.
 	 *
 	 * If this field is not specified, packet to VNIC steering will be
 	 * subject to the standard L2 filter rules and any additional ntuple
@@ -41312,14 +41316,14 @@ struct hwrm_cfa_eem_qcaps_output {
 	#define HWRM_CFA_EEM_QCAPS_OUTPUT_FLAGS_PATH_RX \
 		UINT32_C(0x2)
 	/*
-	 * When set to 1, indicates the FW supports the Centralized
+	 * When set to 1, indicates the the FW supports the Centralized
 	 * Memory Model. The concept designates one entity for the
 	 * memory allocation while all others ‘subscribe’ to it.
 	 */
 	#define HWRM_CFA_EEM_QCAPS_OUTPUT_FLAGS_CENTRALIZED_MEMORY_MODEL_SUPPORTED \
 		UINT32_C(0x4)
 	/*
-	 * When set to 1, indicates the FW supports the Detached
+	 * When set to 1, indicates the the FW supports the Detached
 	 * Centralized Memory Model. The memory is allocated and managed
 	 * as a separate entity. All PFs and VFs will be granted direct
 	 * or semi-direct access to the allocated memory while none of
@@ -42143,8 +42147,24 @@ struct hwrm_tf_session_open_output {
 	 * the newly created session.
 	 */
 	uint32_t	fw_session_client_id;
-	/* unused. */
-	uint32_t	unused0;
+	uint32_t	flags;
+	/* Indicates if the shared session has been created. */
+	#define HWRM_TF_SESSION_OPEN_OUTPUT_FLAGS_SHARED_SESSION \
+		UINT32_C(0x1)
+	/*
+	 * If this bit set to 0, then it indicates the shared session
+	 * has been created by another session.
+	 */
+	#define HWRM_TF_SESSION_OPEN_OUTPUT_FLAGS_SHARED_SESSION_NOT_CREATOR \
+		UINT32_C(0x0)
+	/*
+	 * If this bit is set to 1, then it indicates the shared session
+	 * is created by this session.
+	 */
+	#define HWRM_TF_SESSION_OPEN_OUTPUT_FLAGS_SHARED_SESSION_CREATOR \
+		UINT32_C(0x1)
+	#define HWRM_TF_SESSION_OPEN_OUTPUT_FLAGS_SHARED_SESSION_LAST \
+		HWRM_TF_SESSION_OPEN_OUTPUT_FLAGS_SHARED_SESSION_CREATOR
 	/* unused. */
 	uint8_t	unused1[3];
 	/*
@@ -42948,6 +42968,105 @@ struct hwrm_tf_session_resc_flush_output {
 	uint8_t	valid;
 } __rte_packed;
 
+/*****************************
+ * hwrm_tf_session_resc_info *
+ *****************************/
+
+
+/* hwrm_tf_session_resc_info_input (size:320b/40B) */
+struct hwrm_tf_session_resc_info_input {
+	/* The HWRM command request type. */
+	uint16_t	req_type;
+	/*
+	 * The completion ring to send the completion event on. This should
+	 * be the NQ ID returned from the `nq_alloc` HWRM command.
+	 */
+	uint16_t	cmpl_ring;
+	/*
+	 * The sequence ID is used by the driver for tracking multiple
+	 * commands. This ID is treated as opaque data by the firmware and
+	 * the value is returned in the `hwrm_resp_hdr` upon completion.
+	 */
+	uint16_t	seq_id;
+	/*
+	 * The target ID of the command:
+	 * * 0x0-0xFFF8 - The function ID
+	 * * 0xFFF8-0xFFFC, 0xFFFE - Reserved for internal processors
+	 * * 0xFFFD - Reserved for user-space HWRM interface
+	 * * 0xFFFF - HWRM
+	 */
+	uint16_t	target_id;
+	/*
+	 * A physical address pointer pointing to a host buffer that the
+	 * command's response data will be written. This can be either a host
+	 * physical address (HPA) or a guest physical address (GPA) and must
+	 * point to a physically contiguous block of memory.
+	 */
+	uint64_t	resp_addr;
+	/* Firmware session id returned when HWRM_TF_SESSION_OPEN is sent. */
+	uint32_t	fw_session_id;
+	/* Control flags. */
+	uint16_t	flags;
+	/* Indicates the flow direction. */
+	#define HWRM_TF_SESSION_RESC_INFO_INPUT_FLAGS_DIR     UINT32_C(0x1)
+	/* If this bit set to 0, then it indicates rx flow. */
+	#define HWRM_TF_SESSION_RESC_INFO_INPUT_FLAGS_DIR_RX    UINT32_C(0x0)
+	/* If this bit is set to 1, then it indicates tx flow. */
+	#define HWRM_TF_SESSION_RESC_INFO_INPUT_FLAGS_DIR_TX    UINT32_C(0x1)
+	#define HWRM_TF_SESSION_RESC_INFO_INPUT_FLAGS_DIR_LAST \
+		HWRM_TF_SESSION_RESC_INFO_INPUT_FLAGS_DIR_TX
+	/*
+	 * Defines the array size of the provided req_addr and
+	 * resv_addr array buffers. Should be set to the number of
+	 * request entries.
+	 */
+	uint16_t	req_size;
+	/*
+	 * This is the DMA address for the request input data array
+	 * buffer. Array is of tf_rm_resc_req_entry type. Size of the
+	 * array buffer is provided by the 'req_size' field in this
+	 * message.
+	 */
+	uint64_t	req_addr;
+	/*
+	 * This is the DMA address for the resc output data array
+	 * buffer. Array is of tf_rm_resc_entry type. Size of the array
+	 * buffer is provided by the 'req_size' field in this
+	 * message.
+	 */
+	uint64_t	resc_addr;
+} __rte_packed;
+
+/* hwrm_tf_session_resc_info_output (size:128b/16B) */
+struct hwrm_tf_session_resc_info_output {
+	/* The specific error status for the command. */
+	uint16_t	error_code;
+	/* The HWRM command request type. */
+	uint16_t	req_type;
+	/* The sequence ID from the original command. */
+	uint16_t	seq_id;
+	/* The length of the response data in number of bytes. */
+	uint16_t	resp_len;
+	/*
+	 * Size of the returned tf_rm_resc_entry data array. The value
+	 * cannot exceed the req_size defined by the input msg. The data
+	 * array is returned using the resv_addr specified DMA
+	 * address also provided by the input msg.
+	 */
+	uint16_t	size;
+	/* unused. */
+	uint8_t	unused0[5];
+	/*
+	 * This field is used in Output records to indicate that the output
+	 * is completely written to RAM. This field should be read as '1'
+	 * to indicate that the output has been completely written.
+	 * When writing a command completion or response to an internal
+	 * processor, the order of writes has to be such that this field is
+	 * written last.
+	 */
+	uint8_t	valid;
+} __rte_packed;
+
 /* TruFlow RM capability of a resource. */
 /* tf_rm_resc_req_entry (size:64b/8B) */
 struct tf_rm_resc_req_entry {
@@ -43608,14 +43727,14 @@ struct hwrm_tf_ext_em_qcaps_output {
 	uint16_t	resp_len;
 	uint32_t	flags;
 	/*
-	 * When set to 1, indicates the FW supports the Centralized
+	 * When set to 1, indicates the the FW supports the Centralized
 	 * Memory Model. The concept designates one entity for the
 	 * memory allocation while all others ‘subscribe’ to it.
 	 */
 	#define HWRM_TF_EXT_EM_QCAPS_OUTPUT_FLAGS_CENTRALIZED_MEMORY_MODEL_SUPPORTED \
 		UINT32_C(0x1)
 	/*
-	 * When set to 1, indicates the FW supports the Detached
+	 * When set to 1, indicates the the FW supports the Detached
 	 * Centralized Memory Model. The memory is allocated and managed
 	 * as a separate entity. All PFs and VFs will be granted direct
 	 * or semi-direct access to the allocated memory while none of
@@ -44434,6 +44553,79 @@ struct hwrm_tf_em_delete_output {
 	uint16_t	unused0[3];
 } __rte_packed;
 
+/*******************
+ * hwrm_tf_em_move *
+ *******************/
+
+
+/* hwrm_tf_em_move_input (size:320b/40B) */
+struct hwrm_tf_em_move_input {
+	/* The HWRM command request type. */
+	uint16_t	req_type;
+	/*
+	 * The completion ring to send the completion event on. This should
+	 * be the NQ ID returned from the `nq_alloc` HWRM command.
+	 */
+	uint16_t	cmpl_ring;
+	/*
+	 * The sequence ID is used by the driver for tracking multiple
+	 * commands. This ID is treated as opaque data by the firmware and
+	 * the value is returned in the `hwrm_resp_hdr` upon completion.
+	 */
+	uint16_t	seq_id;
+	/*
+	 * The target ID of the command:
+	 * * 0x0-0xFFF8 - The function ID
+	 * * 0xFFF8-0xFFFC, 0xFFFE - Reserved for internal processors
+	 * * 0xFFFD - Reserved for user-space HWRM interface
+	 * * 0xFFFF - HWRM
+	 */
+	uint16_t	target_id;
+	/*
+	 * A physical address pointer pointing to a host buffer that the
+	 * command's response data will be written. This can be either a host
+	 * physical address (HPA) or a guest physical address (GPA) and must
+	 * point to a physically contiguous block of memory.
+	 */
+	uint64_t	resp_addr;
+	/* Session Id. */
+	uint32_t	fw_session_id;
+	/* Control flags. */
+	uint16_t	flags;
+	/* Indicates the flow direction. */
+	#define HWRM_TF_EM_MOVE_INPUT_FLAGS_DIR     UINT32_C(0x1)
+	/* If this bit set to 0, then it indicates rx flow. */
+	#define HWRM_TF_EM_MOVE_INPUT_FLAGS_DIR_RX    UINT32_C(0x0)
+	/* If this bit is set to 1, then it indicates tx flow. */
+	#define HWRM_TF_EM_MOVE_INPUT_FLAGS_DIR_TX    UINT32_C(0x1)
+	#define HWRM_TF_EM_MOVE_INPUT_FLAGS_DIR_LAST \
+		HWRM_TF_EM_MOVE_INPUT_FLAGS_DIR_TX
+	/* Number of EM entry blocks */
+	uint16_t	num_blocks;
+	/* New index for entry */
+	uint32_t	new_index;
+	/* Unused */
+	uint32_t	unused0;
+	/* EM internal flow handle. */
+	uint64_t	flow_handle;
+} __rte_packed;
+
+/* hwrm_tf_em_move_output (size:128b/16B) */
+struct hwrm_tf_em_move_output {
+	/* The specific error status for the command. */
+	uint16_t	error_code;
+	/* The HWRM command request type. */
+	uint16_t	req_type;
+	/* The sequence ID from the original command. */
+	uint16_t	seq_id;
+	/* The length of the response data in number of bytes. */
+	uint16_t	resp_len;
+	/* Index of old entry. */
+	uint16_t	em_index;
+	/* unused. */
+	uint16_t	unused0[3];
+} __rte_packed;
+
 /********************
  * hwrm_tf_tcam_set *
  ********************/
@@ -46988,10 +47180,7 @@ struct hwrm_nvm_write_input {
 	 * This is where the source data is.
 	 */
 	uint64_t	host_src_addr;
-	/*
-	 * The Directory Entry Type (valid values are defined in the bnxnvm
-	 * directory_type enum defined in the file bnxnvm_defs.h).
-	 */
+	/* The Directory Entry Type (valid values are defined in the bnxnvm_directory_type enum defined in the file bnxnvm_defs.h). */
 	uint16_t	dir_type;
 	/*
 	 * Directory ordinal.
@@ -47003,10 +47192,8 @@ struct hwrm_nvm_write_input {
 	/* Directory Entry Attribute flags (see BNX_DIR_ATTR_* in the file bnxnvm_defs.h). */
 	uint16_t	dir_attr;
 	/*
-	 * Length of data to write, in bytes. May be less than or equal to the allocated
-	 * size for the directory entry.
-	 * The data length stored in the directory entry will be updated to reflect
-	 * this value once the write is complete.
+	 * Length of data to write, in bytes. May be less than or equal to the allocated size for the directory entry.
+	 * The data length stored in the directory entry will be updated to reflect this value once the write is complete.
 	 */
 	uint32_t	dir_data_length;
 	/* Option. */
@@ -47019,15 +47206,11 @@ struct hwrm_nvm_write_input {
 	#define HWRM_NVM_WRITE_INPUT_FLAGS_KEEP_ORIG_ACTIVE_IMG \
 		UINT32_C(0x1)
 	/*
-	 * The requested length of the allocated NVM for the item, in bytes. This
-	 * value may be greater than or equal to the specified data length (dir_data_length).
+	 * The requested length of the allocated NVM for the item, in bytes. This value may be greater than or equal to the specified data length (dir_data_length).
 	 * If this value is less than the specified data length, it will be ignored.
-	 * The response will contain the actual allocated item length, which may be
-	 * greater than the requested item length.
-	 * The purpose for allocating more than the required number of bytes for
-	 * an item's data is to pre-allocate extra storage (padding) to accommodate
-	 * the potential future growth of an item (e.g. upgraded firmware with a
-	 * size increase, log growth, expanded configuration data).
+	 * The response will contain the actual allocated item length, which may be greater than the requested item length.
+	 * The purpose for allocating more than the required number of bytes for an item's data is to pre-allocate extra storage (padding) to accommodate
+	 * the potential future growth of an item (e.g. upgraded firmware with a size increase, log growth, expanded configuration data).
 	 */
 	uint32_t	dir_item_length;
 	uint32_t	unused_0;
@@ -47044,11 +47227,8 @@ struct hwrm_nvm_write_output {
 	/* The length of the response data in number of bytes. */
 	uint16_t	resp_len;
 	/*
-	 * Length of the allocated NVM for the item, in bytes. The value may be
-	 * greater than or equal to the specified data length or the requested
-	 * item length.
-	 * The actual item length used when creating a new directory entry will be
-	 * a multiple of an NVM block size.
+	 * Length of the allocated NVM for the item, in bytes. The value may be greater than or equal to the specified data length or the requested item length.
+	 * The actual item length used when creating a new directory entry will be a multiple of an NVM block size.
 	 */
 	uint32_t	dir_item_length;
 	/* The directory index of the created or modified item. */
@@ -47392,10 +47572,7 @@ struct hwrm_nvm_get_dev_info_output {
 	/* Total size, in bytes of the NVRAM device. */
 	uint32_t	nvram_size;
 	uint32_t	reserved_size;
-	/*
-	 * Available size that can be used, in bytes.  Available size is the
-	 * NVRAM size take away the used size and reserved size.
-	 */
+	/* Available size that can be used, in bytes.  Available size is the NVRAM size take away the used size and reserved size. */
 	uint32_t	available_size;
 	/* This field represents the major version of NVM cfg */
 	uint8_t	nvm_cfg_ver_maj;
@@ -47537,15 +47714,9 @@ struct hwrm_nvm_mod_dir_entry_input {
 	 * The (0-based) instance of this Directory Type.
 	 */
 	uint16_t	dir_ordinal;
-	/*
-	 * The Directory Entry Extension flags (see BNX_DIR_EXT_* for extension
-	 * flag definitions).
-	 */
+	/* The Directory Entry Extension flags (see BNX_DIR_EXT_* for extension flag definitions). */
 	uint16_t	dir_ext;
-	/*
-	 * Directory Entry Attribute flags (see BNX_DIR_ATTR_* for attribute flag
-	 * definitions).
-	 */
+	/* Directory Entry Attribute flags (see BNX_DIR_ATTR_* for attribute flag definitions). */
 	uint16_t	dir_attr;
 	/*
 	 * If valid, then this field updates the checksum
@@ -47712,10 +47883,8 @@ struct hwrm_nvm_install_update_input {
 	#define HWRM_NVM_INSTALL_UPDATE_INPUT_FLAGS_ERASE_UNUSED_SPACE \
 		UINT32_C(0x1)
 	/*
-	 * If set to 1, then unspecified images, images not in the package file,
-	 * will be safely deleted.
-	 * When combined with erase_unused_space then unspecified images will be
-	 * securely erased.
+	 * If set to 1, then unspecified images, images not in the package file, will be safely deleted.
+	 * When combined with erase_unused_space then unspecified images will be securely erased.
 	 */
 	#define HWRM_NVM_INSTALL_UPDATE_INPUT_FLAGS_REMOVE_UNUSED_PKG \
 		UINT32_C(0x2)
@@ -48100,10 +48269,7 @@ struct hwrm_nvm_set_variable_input {
 	/* index for the 4th dimensions */
 	uint16_t	index_3;
 	uint8_t	flags;
-	/*
-	 * When this bit is 1, flush internal cache after this write operation
-	 * (see hwrm_nvm_flush command.)
-	 */
+	/* When this bit is 1, flush internal cache after this write operation (see hwrm_nvm_flush command.) */
 	#define HWRM_NVM_SET_VARIABLE_INPUT_FLAGS_FORCE_FLUSH \
 		UINT32_C(0x1)
 	/* encryption method */
@@ -48405,10 +48571,7 @@ struct hwrm_fw_reset_input {
 	 */
 	#define HWRM_FW_RESET_INPUT_EMBEDDED_PROC_TYPE_HOST \
 		UINT32_C(0x4)
-	/*
-	 * AP processor complex (in multi-host environment). Use host_idx to
-	 * control which core is reset
-	 */
+	/* AP processor complex (in multi-host environment). Use host_idx to control which core is reset */
 	#define HWRM_FW_RESET_INPUT_EMBEDDED_PROC_TYPE_AP \
 		UINT32_C(0x5)
 	/* Reset all blocks of the chip (including all processors) */
drivers/net/bnxt/tf_core/bitalloc.c +6 -4
index af1397071b..e253cfc3a6 100644
@@ -65,7 +65,7 @@ ba_ffs(bitalloc_word_t v)
 }
 
 int
-ba_init(struct bitalloc *pool, int size)
+ba_init(struct bitalloc *pool, int size, bool free)
 {
 	bitalloc_word_t *mem = (bitalloc_word_t *)pool;
 	int       i;
@@ -101,9 +101,11 @@ ba_init(struct bitalloc *pool, int size)
 		pool->storage[offset++] = words[--lev];
 	}
 
-	/* Free the entire pool */
-	for (i = 0; i < size; i++)
-		ba_free(pool, i);
+	/* Free the entire pool if it is required*/
+	if (free) {
+		for (i = 0; i < size; i++)
+			ba_free(pool, i);
+	}
 
 	return 0;
 }
drivers/net/bnxt/tf_core/bitalloc.h +2 -1
index 7244b86e95..e3b389e68d 100644
@@ -7,6 +7,7 @@
 #define _BITALLOC_H_
 
 #include <stdint.h>
+#include <stdbool.h>
 
 /* Bitalloc works on uint32_t as its word size */
 typedef uint32_t bitalloc_word_t;
@@ -64,7 +65,7 @@ struct bitalloc {
  * Returns 0 on success, -1 on failure.  Size is arbitrary up to
  * BITALLOC_MAX_SIZE
  */
-int ba_init(struct bitalloc *pool, int size);
+int ba_init(struct bitalloc *pool, int size, bool free);
 
 /**
  * Returns -1 on failure, or index of allocated entry
drivers/net/bnxt/tf_core/tf_core.c +105 -0

120 lines not on this page · raw message

drivers/net/bnxt/tf_core/tf_core.h +166 -11

208 lines not on this page · raw message

drivers/net/bnxt/tf_core/tf_device.c +46 -30

106 lines not on this page · raw message

drivers/net/bnxt/tf_core/tf_device.h +73 -0

97 lines not on this page · raw message

drivers/net/bnxt/tf_core/tf_device_p4.c +8 -0
index 2fb8fadb56..3f788638c1 100644
@@ -209,6 +209,7 @@ const struct tf_dev_ops tf_dev_ops_p4_init = {
 	.tf_dev_alloc_ident = NULL,
 	.tf_dev_free_ident = NULL,
 	.tf_dev_search_ident = NULL,
+	.tf_dev_get_ident_resc_info = NULL,
 	.tf_dev_get_tbl_info = NULL,
 	.tf_dev_alloc_ext_tbl = NULL,
 	.tf_dev_alloc_tbl = NULL,
@@ -219,15 +220,18 @@ const struct tf_dev_ops tf_dev_ops_p4_init = {
 	.tf_dev_set_ext_tbl = NULL,
 	.tf_dev_get_tbl = NULL,
 	.tf_dev_get_bulk_tbl = NULL,
+	.tf_dev_get_tbl_resc_info = NULL,
 	.tf_dev_alloc_tcam = NULL,
 	.tf_dev_free_tcam = NULL,
 	.tf_dev_alloc_search_tcam = NULL,
 	.tf_dev_set_tcam = NULL,
 	.tf_dev_get_tcam = NULL,
+	.tf_dev_get_tcam_resc_info = NULL,
 	.tf_dev_insert_int_em_entry = NULL,
 	.tf_dev_delete_int_em_entry = NULL,
 	.tf_dev_insert_ext_em_entry = NULL,
 	.tf_dev_delete_ext_em_entry = NULL,
+	.tf_dev_get_em_resc_info = NULL,
 	.tf_dev_alloc_tbl_scope = NULL,
 	.tf_dev_map_tbl_scope = NULL,
 	.tf_dev_map_parif = NULL,
@@ -250,6 +254,7 @@ const struct tf_dev_ops tf_dev_ops_p4 = {
 	.tf_dev_alloc_ident = tf_ident_alloc,
 	.tf_dev_free_ident = tf_ident_free,
 	.tf_dev_search_ident = tf_ident_search,
+	.tf_dev_get_ident_resc_info = tf_ident_get_resc_info,
 	.tf_dev_get_tbl_info = NULL,
 	.tf_dev_alloc_tbl = tf_tbl_alloc,
 	.tf_dev_alloc_ext_tbl = tf_tbl_ext_alloc,
@@ -260,15 +265,18 @@ const struct tf_dev_ops tf_dev_ops_p4 = {
 	.tf_dev_set_ext_tbl = tf_tbl_ext_common_set,
 	.tf_dev_get_tbl = tf_tbl_get,
 	.tf_dev_get_bulk_tbl = tf_tbl_bulk_get,
+	.tf_dev_get_tbl_resc_info = tf_tbl_get_resc_info,
 	.tf_dev_alloc_tcam = tf_tcam_alloc,
 	.tf_dev_free_tcam = tf_tcam_free,
 	.tf_dev_alloc_search_tcam = tf_tcam_alloc_search,
 	.tf_dev_set_tcam = tf_tcam_set,
 	.tf_dev_get_tcam = NULL,
+	.tf_dev_get_tcam_resc_info = tf_tcam_get_resc_info,
 	.tf_dev_insert_int_em_entry = tf_em_insert_int_entry,
 	.tf_dev_delete_int_em_entry = tf_em_delete_int_entry,
 	.tf_dev_insert_ext_em_entry = tf_em_insert_ext_entry,
 	.tf_dev_delete_ext_em_entry = tf_em_delete_ext_entry,
+	.tf_dev_get_em_resc_info = tf_em_get_resc_info,
 	.tf_dev_alloc_tbl_scope = tf_em_ext_common_alloc,
 	.tf_dev_map_tbl_scope = tf_em_ext_map_tbl_scope,
 	.tf_dev_map_parif = tf_dev_p4_map_parif,
drivers/net/bnxt/tf_core/tf_device_p58.c +8 -0
index 517ffc811b..c2bc283220 100644
@@ -230,6 +230,7 @@ const struct tf_dev_ops tf_dev_ops_p58_init = {
 	.tf_dev_alloc_ident = NULL,
 	.tf_dev_free_ident = NULL,
 	.tf_dev_search_ident = NULL,
+	.tf_dev_get_ident_resc_info = NULL,
 	.tf_dev_get_tbl_info = NULL,
 	.tf_dev_alloc_ext_tbl = NULL,
 	.tf_dev_alloc_tbl = NULL,
@@ -240,15 +241,18 @@ const struct tf_dev_ops tf_dev_ops_p58_init = {
 	.tf_dev_set_ext_tbl = NULL,
 	.tf_dev_get_tbl = NULL,
 	.tf_dev_get_bulk_tbl = NULL,
+	.tf_dev_get_tbl_resc_info = NULL,
 	.tf_dev_alloc_tcam = NULL,
 	.tf_dev_free_tcam = NULL,
 	.tf_dev_alloc_search_tcam = NULL,
 	.tf_dev_set_tcam = NULL,
 	.tf_dev_get_tcam = NULL,
+	.tf_dev_get_tcam_resc_info = NULL,
 	.tf_dev_insert_int_em_entry = NULL,
 	.tf_dev_delete_int_em_entry = NULL,
 	.tf_dev_insert_ext_em_entry = NULL,
 	.tf_dev_delete_ext_em_entry = NULL,
+	.tf_dev_get_em_resc_info = NULL,
 	.tf_dev_alloc_tbl_scope = NULL,
 	.tf_dev_map_tbl_scope = NULL,
 	.tf_dev_map_parif = NULL,
@@ -271,6 +275,7 @@ const struct tf_dev_ops tf_dev_ops_p58 = {
 	.tf_dev_alloc_ident = tf_ident_alloc,
 	.tf_dev_free_ident = tf_ident_free,
 	.tf_dev_search_ident = tf_ident_search,
+	.tf_dev_get_ident_resc_info = tf_ident_get_resc_info,
 	.tf_dev_get_tbl_info = tf_dev_p58_get_sram_tbl_info,
 	.tf_dev_alloc_tbl = tf_tbl_alloc,
 	.tf_dev_alloc_ext_tbl = tf_tbl_ext_alloc,
@@ -281,15 +286,18 @@ const struct tf_dev_ops tf_dev_ops_p58 = {
 	.tf_dev_set_ext_tbl = tf_tbl_ext_common_set,
 	.tf_dev_get_tbl = tf_tbl_get,
 	.tf_dev_get_bulk_tbl = tf_tbl_bulk_get,
+	.tf_dev_get_tbl_resc_info = tf_tbl_get_resc_info,
 	.tf_dev_alloc_tcam = tf_tcam_alloc,
 	.tf_dev_free_tcam = tf_tcam_free,
 	.tf_dev_alloc_search_tcam = tf_tcam_alloc_search,
 	.tf_dev_set_tcam = tf_tcam_set,
 	.tf_dev_get_tcam = tf_tcam_get,
+	.tf_dev_get_tcam_resc_info = tf_tcam_get_resc_info,
 	.tf_dev_insert_int_em_entry = tf_em_hash_insert_int_entry,
 	.tf_dev_delete_int_em_entry = tf_em_hash_delete_int_entry,
 	.tf_dev_insert_ext_em_entry = NULL,
 	.tf_dev_delete_ext_em_entry = NULL,
+	.tf_dev_get_em_resc_info = tf_em_get_resc_info,
 	.tf_dev_alloc_tbl_scope = NULL,
 	.tf_dev_map_tbl_scope = NULL,
 	.tf_dev_map_parif = NULL,
drivers/net/bnxt/tf_core/tf_em.h +17 -0
index 19ad7f12be..60d90e28de 100644
@@ -530,4 +530,21 @@ tf_em_ext_system_bind(struct tf *tfp,
 		      struct tf_em_cfg_parms *parms);
 
 int offload_system_mmap(struct tf_tbl_scope_cb *tbl_scope_cb);
+
+/**
+ * Retrieves the allocated resource info
+ *
+ * [in] tfp
+ *   Pointer to TF handle, used for HCAPI communication
+ *
+ * [in] parms
+ *   Pointer to parameters
+ *
+ * Returns
+ *   - (0) if successful.
+ *   - (-EINVAL) on failure.
+ */
+int
+tf_em_get_resc_info(struct tf *tfp,
+		    struct tf_em_resource_info *em);
 #endif /* _TF_EM_H_ */
drivers/net/bnxt/tf_core/tf_em_common.c +0 -25
index 4dc3c86b57..ed8f6db58c 100644
@@ -26,11 +26,6 @@
 /* Number of pointers per page_size */
 #define MAX_PAGE_PTRS(page_size)  ((page_size) / sizeof(void *))
 
-/**
- * Init flag, set on bind and cleared on unbind
- */
-static uint8_t init;
-
 /**
  * Host or system
  */
@@ -924,18 +919,11 @@ tf_em_ext_common_bind(struct tf *tfp,
 	int rc;
 	int i;
 	struct tf_rm_create_db_parms db_cfg = { 0 };
-	uint8_t db_exists = 0;
 	struct em_ext_db *ext_db;
 	struct tfp_calloc_parms cparms;
 
 	TF_CHECK_PARMS2(tfp, parms);
 
-	if (init) {
-		TFP_DRV_LOG(ERR,
-			    "EM Ext DB already initialized\n");
-		return -EINVAL;
-	}
-
 	cparms.nitems = 1;
 	cparms.size = sizeof(struct em_ext_db);
 	cparms.alignment = 0;
@@ -974,12 +962,8 @@ tf_em_ext_common_bind(struct tf *tfp,
 
 			return rc;
 		}
-		db_exists = 1;
 	}
 
-	if (db_exists)
-		init = 1;
-
 	mem_type = parms->mem_type;
 
 	return 0;
@@ -1001,13 +985,6 @@ tf_em_ext_common_unbind(struct tf *tfp)
 
 	TF_CHECK_PARMS1(tfp);
 
-	/* Bail if nothing has been initialized */
-	if (!init) {
-		TFP_DRV_LOG(INFO,
-			    "No EM Ext DBs created\n");
-		return 0;
-	}
-
 	rc = tf_session_get_session_internal(tfp, &tfs);
 	if (rc) {
 		TFP_DRV_LOG(ERR, "Failed to get tf_session, rc:%s\n",
@@ -1064,8 +1041,6 @@ tf_em_ext_common_unbind(struct tf *tfp)
 	tfp_free(ext_db);
 	tf_session_set_em_ext_db(tfp, NULL);
 
-	init = 0;
-
 	return 0;
 }
 
drivers/net/bnxt/tf_core/tf_em_internal.c +74 -44

171 lines not on this page · raw message

drivers/net/bnxt/tf_core/tf_identifier.c +47 -42

149 lines not on this page · raw message

drivers/net/bnxt/tf_core/tf_identifier.h +16 -0
index 54cecbfd4c..55c093802e 100644
@@ -201,4 +201,20 @@ int tf_ident_free(struct tf *tfp,
 int tf_ident_search(struct tf *tfp,
 		    struct tf_ident_search_parms *parms);
 
+/**
+ * Retrieves the allocated resource info
+ *
+ * [in] tfp
+ *   Pointer to TF handle, used for HCAPI communication
+ *
+ * [in] parms
+ *   Pointer to parameters
+ *
+ * Returns
+ *   - (0) if successful.
+ *   - (-EINVAL) on failure.
+ */
+int tf_ident_get_resc_info(struct tf *tfp,
+			   struct tf_identifier_resource_info *parms);
+
 #endif /* _TF_IDENTIFIER_H_ */
drivers/net/bnxt/tf_core/tf_msg.c +192 -31

448 lines not on this page · raw message

drivers/net/bnxt/tf_core/tf_msg.h +43 -4

77 lines not on this page · raw message

drivers/net/bnxt/tf_core/tf_rm.c +276 -1

295 lines not on this page · raw message

drivers/net/bnxt/tf_core/tf_rm.h +34 -0
index 6eb6865dac..8b984112e8 100644
@@ -425,6 +425,24 @@ struct tf_rm_check_indexes_in_range_parms {
 int tf_rm_create_db(struct tf *tfp,
 		    struct tf_rm_create_db_parms *parms);
 
+/**
+ * Creates and fills a Resource Manager (RM) DB with requested
+ * elements. The DB is indexed per the parms structure. It only retrieve
+ * allocated resource information for a exist session.
+ *
+ * [in] tfp
+ *   Pointer to TF handle, used for HCAPI communication
+ *
+ * [in] parms
+ *   Pointer to create parameters
+ *
+ * Returns
+ *   - (0) if successful.
+ *   - (-EINVAL) on failure.
+ */
+int tf_rm_create_db_no_reservation(struct tf *tfp,
+		    struct tf_rm_create_db_parms *parms);
+
 /**
  * Closes the Resource Manager (RM) DB and frees all allocated
  * resources per the associated database.
@@ -498,6 +516,22 @@ int tf_rm_is_allocated(struct tf_rm_is_allocated_parms *parms);
  */
 int tf_rm_get_info(struct tf_rm_get_alloc_info_parms *parms);
 
+/**
+ * Retrieves all elements allocation information from the Resource
+ * Manager (RM) DB.
+ *
+ * [in] parms
+ *   Pointer to get info parameters
+ *
+ * [in] size
+ *   number of the elements for the specific module
+ *
+ * Returns
+ *   - (0) if successful.
+ *   - (-EINVAL) on failure.
+ */
+int tf_rm_get_all_info(struct tf_rm_get_alloc_info_parms *parms, int size);
+
 /**
  * Performs a lookup in the Resource Manager DB and retrieves the
  * requested HCAPI RM type.
drivers/net/bnxt/tf_core/tf_session.c +31 -6
index f591fbe3f5..391d8786ab 100644
@@ -11,6 +11,7 @@
 #include "tf_common.h"
 #include "tf_msg.h"
 #include "tfp.h"
+#include "bnxt.h"
 
 struct tf_session_client_create_parms {
 	/**
@@ -57,6 +58,7 @@ tf_session_create(struct tf *tfp,
 	uint8_t fw_session_client_id;
 	union tf_session_id *session_id;
 	struct tf_dev_info dev;
+	bool shared_session_creator;
 
 	TF_CHECK_PARMS2(tfp, parms);
 
@@ -64,11 +66,12 @@ tf_session_create(struct tf *tfp,
 			&dev);
 
 	/* Open FW session and get a new session_id */
-	rc = tf_msg_session_open(tfp,
+	rc = tf_msg_session_open(parms->open_cfg->bp,
 				 parms->open_cfg->ctrl_chan_name,
 				 &fw_session_id,
 				 &fw_session_client_id,
-				 &dev);
+				 &dev,
+				 &shared_session_creator);
 	if (rc) {
 		/* Log error */
 		if (rc == -EEXIST)
@@ -137,6 +140,7 @@ tf_session_create(struct tf *tfp,
 	session_id->id = session->session_id.id;
 
 	session->shadow_copy = parms->open_cfg->shadow_copy;
+	session->bp = parms->open_cfg->bp;
 
 	/* Init session client list */
 	ll_init(&session->client_ll);
@@ -175,12 +179,20 @@ tf_session_create(struct tf *tfp,
 
 	/* Init session em_ext_db */
 	session->em_ext_db_handle = NULL;
+	if (!strcmp(parms->open_cfg->ctrl_chan_name, "tf_share"))
+		session->shared_session = true;
+
+	if (session->shared_session && shared_session_creator) {
+		session->shared_session_creator = true;
+		parms->open_cfg->shared_session_creator = true;
+	}
 
 	rc = tf_dev_bind(tfp,
 			 parms->open_cfg->device_type,
 			 session->shadow_copy,
 			 &parms->open_cfg->resources,
 			 &session->dev);
+
 	/* Logging handled by dev_bind */
 	if (rc)
 		goto cleanup;
@@ -857,16 +869,29 @@ tf_session_get_db(struct tf *tfp,
 
 	switch (type) {
 	case TF_MODULE_TYPE_IDENTIFIER:
-		*db_handle = tfs->id_db_handle;
+		if (tfs->id_db_handle)
+			*db_handle = tfs->id_db_handle;
+		else
+			rc = -EINVAL;
 		break;
 	case TF_MODULE_TYPE_TABLE:
-		*db_handle = tfs->tbl_db_handle;
+		if (tfs->tbl_db_handle)
+			*db_handle = tfs->tbl_db_handle;
+		else
+			rc = -EINVAL;
+
 		break;
 	case TF_MODULE_TYPE_TCAM:
-		*db_handle = tfs->tcam_db_handle;
+		if (tfs->tcam_db_handle)
+			*db_handle = tfs->tcam_db_handle;
+		else
+			rc = -EINVAL;
 		break;
 	case TF_MODULE_TYPE_EM:
-		*db_handle = tfs->em_db_handle;
+		if (tfs->em_db_handle)
+			*db_handle = tfs->em_db_handle;
+		else
+			rc = -EINVAL;
 		break;
 	default:
 		rc = -EINVAL;
drivers/net/bnxt/tf_core/tf_session.h +66 -0

82 lines not on this page · raw message

drivers/net/bnxt/tf_core/tf_tbl.c +47 -57

176 lines not on this page · raw message

drivers/net/bnxt/tf_core/tf_tbl.h +17 -0
index 83b72d1b3f..aba46fd161 100644
@@ -396,4 +396,21 @@ int tf_tbl_get(struct tf *tfp,
 int tf_tbl_bulk_get(struct tf *tfp,
 		    struct tf_tbl_get_bulk_parms *parms);
 
+/**
+ * Retrieves the allocated resource info
+ *
+ * [in] tfp
+ *   Pointer to TF handle, used for HCAPI communication
+ *
+ * [in] parms
+ *   Pointer to Table resource info parameters
+ *
+ * Returns
+ *   - (0) if successful.
+ *   - (-EINVAL) on failure.
+ */
+int
+tf_tbl_get_resc_info(struct tf *tfp,
+		     struct tf_tbl_resource_info *tbl);
+
 #endif /* TF_TBL_TYPE_H */
drivers/net/bnxt/tf_core/tf_tcam.c +44 -59

184 lines not on this page · raw message

drivers/net/bnxt/tf_core/tf_tcam.h +16 -0
index acab223532..bed17af6ae 100644
@@ -386,4 +386,20 @@ int tf_tcam_set(struct tf *tfp,
 int tf_tcam_get(struct tf *tfp,
 		struct tf_tcam_get_parms *parms);
 
+/**
+ * Retrieves the allocated resource info
+ *
+ * [in] tfp
+ *   Pointer to TF handle, used for HCAPI communication
+ *
+ * [in] parms
+ *   Pointer to parameters
+ *
+ * Returns
+ *   - (0) if successful.
+ *   - (-EINVAL) on failure.
+ */
+int tf_tcam_get_resc_info(struct tf *tfp,
+			  struct tf_tcam_resource_info *parms);
+
 #endif /* _TF_TCAM_H */
drivers/net/bnxt/tf_core/tfp.c +2 -4
index 37c49b587d..4d9b37f749 100644
@@ -28,7 +28,7 @@
  * Returns success or failure code.
  */
 int
-tfp_send_msg_direct(struct tf *tfp,
+tfp_send_msg_direct(struct bnxt *bp,
 		    struct tfp_send_msg_parms *parms)
 {
 	int      rc = 0;
@@ -40,9 +40,7 @@ tfp_send_msg_direct(struct tf *tfp,
 	if (parms->mailbox == TF_CHIMP_MB)
 		use_kong_mb = 0;
 
-	rc = bnxt_hwrm_tf_message_direct(container_of(tfp,
-					       struct bnxt,
-					       tfp),
+	rc = bnxt_hwrm_tf_message_direct(bp,
 					 use_kong_mb,
 					 parms->tf_type,
 					 parms->req_data,
drivers/net/bnxt/tf_core/tfp.h +2 -1
index bcc56b0a54..58f34bbcab 100644
@@ -15,6 +15,7 @@
 #include <rte_spinlock.h>
 #include <rte_log.h>
 #include <rte_byteorder.h>
+#include <bnxt.h>
 
 /**
  * DPDK/Driver specific log level for the BNXT Eth driver.
@@ -130,7 +131,7 @@ struct tfp_calloc_parms {
  *   -1             - Global error like not supported
  *   -EINVAL        - Parameter Error
  */
-int tfp_send_msg_direct(struct tf *tfp,
+int tfp_send_msg_direct(struct bnxt *bp,
 			struct tfp_send_msg_parms *parms);
 
 /**
Signature · 1 line
2.17.1
#15 lore raw

PATCH 15/58 net/bnxt: add dpool allocator for EM allocation

In reply to Venkat Duvvuru

From: Peter Spreadborough <[email protected]>

The dpool allocator supports variable size entries and also supports defragmentation of the allocation space. EM will by default use the fixed size stack allocator. The dynamic allocator may be selected at build time. The dpool allocator supports variable size entries and also supports defragmentation of the allocation space.

---
 drivers/net/bnxt/tf_core/dpool.c              | 373 ++++++++++++++++++
 drivers/net/bnxt/tf_core/dpool.h              | 309 +++++++++++++++
 drivers/net/bnxt/tf_core/meson.build          |   1 +
 drivers/net/bnxt/tf_core/tf_core.h            |  42 ++
 drivers/net/bnxt/tf_core/tf_device.h          |  34 ++
 drivers/net/bnxt/tf_core/tf_device_p58.c      |   5 +
 drivers/net/bnxt/tf_core/tf_em.h              |  26 ++
 .../net/bnxt/tf_core/tf_em_hash_internal.c    | 102 ++++-
 drivers/net/bnxt/tf_core/tf_em_internal.c     | 215 ++++++++--
 drivers/net/bnxt/tf_core/tf_msg.c             |  69 ++++
 drivers/net/bnxt/tf_core/tf_msg.h             |  15 +
 drivers/net/bnxt/tf_core/tf_session.h         |   5 +
 12 files changed, 1156 insertions(+), 40 deletions(-)
 create mode 100644 drivers/net/bnxt/tf_core/dpool.c
 create mode 100644 drivers/net/bnxt/tf_core/dpool.h
drivers/net/bnxt/tf_core/dpool.c new file +373 -0
new file mode 100644
index 0000000000..a5f9f866b7
@@ -0,0 +1,373 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2019-2021 Broadcom
+ * All rights reserved.
+ */
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <errno.h>
+
+#include <rte_malloc.h>
+
+#include "tfp.h"
+#include "dpool.h"
+
+int dpool_init(struct dpool *dpool,
+	       uint32_t start_index,
+	       uint32_t size,
+	       uint8_t max_alloc_size,
+	       void *user_data,
+	       int (*move_callback)(void *, uint64_t, uint32_t))
+{
+	uint32_t i;
+	int rc;
+	struct tfp_calloc_parms parms;
+
+	parms.nitems = size;
+	parms.size = sizeof(struct dpool_entry);
+	parms.alignment = 0;
+
+	rc = tfp_calloc(&parms);
+
+	if (rc)
+		return rc;
+
+	dpool->entry = parms.mem_va;
+	dpool->start_index = start_index;
+	dpool->size = size;
+	dpool->max_alloc_size = max_alloc_size;
+	dpool->user_data = user_data;
+	dpool->move_callback = move_callback;
+	/*
+	 * Init entries
+	 */
+	for (i = 0; i < size; i++) {
+		dpool->entry[i].flags = 0;
+		dpool->entry[i].index = start_index;
+		dpool->entry[i].entry_data = 0UL;
+		start_index++;
+	}
+
+	return 0;
+}
+
+static int dpool_move(struct dpool *dpool,
+		      uint32_t dst_index,
+		      uint32_t src_index)
+{
+	uint32_t size;
+	uint32_t i;
+	if (DP_IS_FREE(dpool->entry[dst_index].flags)) {
+		size = DP_FLAGS_SIZE(dpool->entry[src_index].flags);
+
+		dpool->entry[dst_index].flags = dpool->entry[src_index].flags;
+		dpool->entry[dst_index].entry_data = dpool->entry[src_index].entry_data;
+
+		if (dpool->move_callback != NULL) {
+			dpool->move_callback(dpool->user_data,
+					     dpool->entry[src_index].entry_data,
+					     dst_index + dpool->start_index);
+		}
+
+		dpool->entry[src_index].flags = 0;
+		dpool->entry[src_index].entry_data = 0UL;
+
+		for (i = 1; i < size; i++) {
+			dpool->entry[dst_index + i].flags = size;
+			dpool->entry[src_index + i].flags = 0;
+		}
+	} else {
+		return -1;
+	}
+
+	return 0;
+}
+
+
+int dpool_defrag(struct dpool *dpool,
+		 uint32_t entry_size,
+		 uint8_t defrag)
+{
+	struct dpool_free_list *free_list;
+	struct dpool_adj_list *adj_list;
+	uint32_t count;
+	uint32_t index;
+	uint32_t used;
+	uint32_t i;
+	uint32_t size;
+	uint32_t largest_free_index = 0;
+	uint32_t largest_free_size;
+	uint32_t max;
+	uint32_t max_index;
+	uint32_t max_size = 0;
+	int rc;
+
+	free_list = rte_zmalloc("dpool_free_list",
+				sizeof(struct dpool_free_list), 0);
+	if (free_list == NULL) {
+		TFP_DRV_LOG(ERR, "dpool free list allocation failed\n");
+		return -ENOMEM;
+	}
+
+	adj_list = rte_zmalloc("dpool_adjacent_list",
+				sizeof(struct dpool_adj_list), 0);
+	if (adj_list == NULL) {
+		TFP_DRV_LOG(ERR, "dpool adjacent list allocation failed\n");
+		return -ENOMEM;
+	}
+
+	while (1) {
+		/*
+		 * Create list of free entries
+		 */
+		free_list->size = 0;
+		largest_free_size = 0;
+		largest_free_index = 0;
+		count = 0;
+
+		for (i = 0; i < dpool->size; i++) {
+			if (DP_IS_FREE(dpool->entry[i].flags)) {
+				if (count == 0)
+					index = i;
+				count++;
+			} else if (count > 0) {
+				free_list->entry[free_list->size].index = index;
+				free_list->entry[free_list->size].size = count;
+
+				if (count > largest_free_size) {
+					largest_free_index = free_list->size;
+					largest_free_size = count;
+				}
+
+				free_list->size++;
+				count = 0;
+			}
+		}
+
+		if (free_list->size == 0)
+			largest_free_size = count;
+
+		/*
+		 * If using defrag to fit and there's a large enough
+		 * space then we are done.
+		 */
+		if (defrag == DP_DEFRAG_TO_FIT &&
+		    largest_free_size >= entry_size)
+			goto done;
+
+		/*
+		 * Create list of entries adjacent to free entries
+		 */
+		count = 0;
+		adj_list->size = 0;
+		used = 0;
+
+		for (i = 0; i < dpool->size; ) {
+			if (DP_IS_USED(dpool->entry[i].flags)) {
+				used++;
+
+				if (count > 0) {
+					adj_list->entry[adj_list->size].index = i;
+					adj_list->entry[adj_list->size].size =
+						DP_FLAGS_SIZE(dpool->entry[i].flags);
+					adj_list->entry[adj_list->size].left = count;
+
+					if (adj_list->size > 0 && used == 1)
+						adj_list->entry[adj_list->size - 1].right = count;
+
+					adj_list->size++;
+				}
+
+				count = 0;
+				i += DP_FLAGS_SIZE(dpool->entry[i].flags);
+			} else {
+				used = 0;
+				count++;
+				i++;
+			}
+		}
+
+		/*
+		 * Using the size of the largest free space available
+		 * select the adjacency list entry of that size with
+		 * the largest left + right + size count. If there
+		 * are no entries of that size then decrement the size
+		 * and try again.
+		 */
+		max = 0;
+		max_index = 0;
+		max_size = 0;
+
+		for (size = largest_free_size; size > 0; size--) {
+			for (i = 0; i < adj_list->size; i++) {
+				if (adj_list->entry[i].size == size &&
+				    ((size +
+				      adj_list->entry[i].left +
+				      adj_list->entry[i].right) > max)) {
+					max = size +
+						adj_list->entry[i].left +
+						adj_list->entry[i].right;
+					max_size = size;
+					max_index = adj_list->entry[i].index;
+				}
+			}
+
+			if (max)
+				break;
+		}
+
+		/*
+		 * If the max entry is smaller than the largest_free_size
+		 * find the first entry in the free list that it cn fit in to.
+		 */
+		if (max_size < largest_free_size) {
+			for (i = 0; i < free_list->size; i++) {
+				if (free_list->entry[i].size >= max_size) {
+					largest_free_index = i;
+					break;
+				}
+			}
+		}
+
+		/*
+		 * If we have a contender then move it to the new spot.
+		 */
+		if (max) {
+			rc = dpool_move(dpool,
+					free_list->entry[largest_free_index].index,
+					max_index);
+			if (rc) {
+				rte_free(free_list);
+				rte_free(adj_list);
+				return rc;
+			}
+		} else {
+			break;
+		}
+	}
+
+done:
+	rte_free(free_list);
+	rte_free(adj_list);
+	return largest_free_size;
+}
+
+
+uint32_t dpool_alloc(struct dpool *dpool,
+		     uint32_t size,
+		     uint8_t defrag)
+{
+	uint32_t i;
+	uint32_t j;
+	uint32_t count = 0;
+	uint32_t first_entry_index;
+	int rc;
+
+	if (size > dpool->max_alloc_size || size == 0)
+		return DP_INVALID_INDEX;
+
+	/*
+	 * Defrag requires EM move support.
+	 */
+	if (defrag != DP_DEFRAG_NONE &&
+	    dpool->move_callback == NULL)
+		return DP_INVALID_INDEX;
+
+	while (1) {
+		/*
+		 * find <size> consecutive free entries
+		 */
+		for (i = 0; i < dpool->size; i++) {
+			if (DP_IS_FREE(dpool->entry[i].flags)) {
+				if (count == 0)
+					first_entry_index = i;
+
+				count++;
+
+				if (count == size) {
+					for (j = 0; j < size; j++) {
+						dpool->entry[j + first_entry_index].flags = size;
+						if (j == 0)
+							dpool->entry[j + first_entry_index].flags |= DP_FLAGS_START;
+					}
+
+					dpool->entry[i].entry_data = 0UL;
+					return (first_entry_index + dpool->start_index);
+				}
+			} else {
+				count = 0;
+			}
+		}
+
+		/*
+		 * If defragging then do it to it
+		 */
+		if (defrag != DP_DEFRAG_NONE) {
+			rc = dpool_defrag(dpool, size, defrag);
+
+			if (rc < 0)
+				return DP_INVALID_INDEX;
+		} else {
+			break;
+		}
+
+		/*
+		 * If the defrag created enough space then try the
+		 * alloc again else quit.
+		 */
+		if ((uint32_t)rc < size)
+			break;
+	}
+
+	return DP_INVALID_INDEX;
+}
+
+int dpool_free(struct dpool *dpool,
+	       uint32_t index)
+{
+	uint32_t i;
+	int start = (index - dpool->start_index);
+	uint32_t size;
+
+	if (start < 0)
+		return -1;
+
+	if (DP_IS_START(dpool->entry[start].flags)) {
+		size = DP_FLAGS_SIZE(dpool->entry[start].flags);
+		if (size > dpool->max_alloc_size || size == 0)
+			return -1;
+
+		for (i = start; i < (start + size); i++)
+			dpool->entry[i].flags = 0;
+
+		return 0;
+	}
+
+	return -1;
+}
+
+void dpool_free_all(struct dpool *dpool)
+{
+	uint32_t i;
+
+	for (i = 0; i < dpool->size; i++)
+		dpool_free(dpool, dpool->entry[i].index);
+}
+
+int dpool_set_entry_data(struct dpool *dpool,
+			 uint32_t index,
+			 uint64_t entry_data)
+{
+	int start = (index - dpool->start_index);
+
+	if (start < 0)
+		return -1;
+
+	if (DP_IS_START(dpool->entry[start].flags)) {
+		dpool->entry[start].entry_data = entry_data;
+		return 0;
+	}
+
+	return -1;
+}
drivers/net/bnxt/tf_core/dpool.h new file +309 -0

309 lines not on this page · raw message

drivers/net/bnxt/tf_core/meson.build +1 -0
index 2c02214d83..3a91f04bc0 100644
@@ -10,6 +10,7 @@ sources += files(
         'tf_core.c',
         'bitalloc.c',
         'tf_msg.c',
+	'dpool.c',
         'rand.c',
         'stack.c',
         'tf_em_common.c',
drivers/net/bnxt/tf_core/tf_core.h +42 -0

48 lines not on this page · raw message

drivers/net/bnxt/tf_core/tf_device.h +34 -0
index 16c2fe0f64..31806bb289 100644
@@ -611,6 +611,22 @@ struct tf_dev_ops {
 	int (*tf_dev_delete_int_em_entry)(struct tf *tfp,
 					  struct tf_delete_em_entry_parms *parms);
 
+	/**
+	 * Move EM hash entry API
+	 *
+	 * [in] tfp
+	 *   Pointer to TF handle
+	 *
+	 * [in] parms
+	 *   Pointer to E/EM move parameters
+	 *
+	 *    returns:
+	 *    0       - Success
+	 *    -EINVAL - Error
+	 */
+	int (*tf_dev_move_int_em_entry)(struct tf *tfp,
+					struct tf_move_em_entry_parms *parms);
+
 	/**
 	 * Insert EEM hash entry API
 	 *
@@ -661,6 +677,24 @@ struct tf_dev_ops {
 	int (*tf_dev_get_em_resc_info)(struct tf *tfp,
 				       struct tf_em_resource_info *parms);
 
+	/**
+	 * Move EEM hash entry API
+	 *
+	 *   Pointer to E/EM move parameters
+	 *
+	 * [in] tfp
+	 *   Pointer to TF handle
+	 *
+	 * [in] parms
+	 *   Pointer to em info
+	 *
+	 *    returns:
+	 *    0       - Success
+	 *    -EINVAL - Error
+	 */
+	int (*tf_dev_move_ext_em_entry)(struct tf *tfp,
+					struct tf_move_em_entry_parms *parms);
+
 	/**
 	 * Allocate EEM table scope
 	 *
drivers/net/bnxt/tf_core/tf_device_p58.c +5 -0
index c2bc283220..7917c9613a 100644
@@ -295,6 +295,11 @@ const struct tf_dev_ops tf_dev_ops_p58 = {
 	.tf_dev_get_tcam_resc_info = tf_tcam_get_resc_info,
 	.tf_dev_insert_int_em_entry = tf_em_hash_insert_int_entry,
 	.tf_dev_delete_int_em_entry = tf_em_hash_delete_int_entry,
+#if (TF_EM_ALLOC == 1)
+	.tf_dev_move_int_em_entry = tf_em_move_int_entry,
+#else
+	.tf_dev_move_int_em_entry = NULL,
+#endif
 	.tf_dev_insert_ext_em_entry = NULL,
 	.tf_dev_delete_ext_em_entry = NULL,
 	.tf_dev_get_em_resc_info = tf_em_get_resc_info,
drivers/net/bnxt/tf_core/tf_em.h +26 -0
index 60d90e28de..9d168c3c7f 100644
@@ -13,6 +13,16 @@
 
 #include "hcapi_cfa_defs.h"
 
+/**
+ * TF_EM_ALLOC
+ *
+ * 0: Use stack allocator with fixed sized entries
+ *    (default).
+ * 1: Use dpool allocator with variable size
+ *    entries.
+ */
+#define TF_EM_ALLOC 0
+
 #define TF_EM_MIN_ENTRIES     (1 << 15) /* 32K */
 #define TF_EM_MAX_ENTRIES     (1 << 27) /* 128M */
 
@@ -243,6 +253,22 @@ int tf_em_hash_insert_int_entry(struct tf *tfp,
 int tf_em_hash_delete_int_entry(struct tf *tfp,
 				struct tf_delete_em_entry_parms *parms);
 
+/**
+ * Move record from internal EM table
+ *
+ * [in] tfp
+ *   Pointer to TruFlow handle
+ *
+ * [in] parms
+ *   Pointer to input parameters
+ *
+ * Returns:
+ *   0       - Success
+ *   -EINVAL - Parameter error
+ */
+int tf_em_move_int_entry(struct tf *tfp,
+			 struct tf_move_em_entry_parms *parms);
+
 /**
  * Insert record in to external EEM table
  *
drivers/net/bnxt/tf_core/tf_em_hash_internal.c +89 -13

154 lines not on this page · raw message

drivers/net/bnxt/tf_core/tf_em_internal.c +188 -27

311 lines not on this page · raw message

drivers/net/bnxt/tf_core/tf_msg.c +69 -0

75 lines not on this page · raw message

drivers/net/bnxt/tf_core/tf_msg.h +15 -0
index 5ecaf9e7e7..e8662fef0e 100644
@@ -315,6 +315,21 @@ tf_msg_hash_insert_em_internal_entry(struct tf *tfp,
 int tf_msg_delete_em_entry(struct tf *tfp,
 			   struct tf_delete_em_entry_parms *em_parms);
 
+/**
+ * Sends EM internal move request to Firmware
+ *
+ * [in] tfp
+ *   Pointer to TF handle
+ *
+ * [in] em_parms
+ *   Pointer to em move parameters
+ *
+ * Returns:
+ *   0 on Success else internal Truflow error
+ */
+int tf_msg_move_em_entry(struct tf *tfp,
+			 struct tf_move_em_entry_parms *em_parms);
+
 /**
  * Sends Ext EM mem allocation request to Firmware
  *
drivers/net/bnxt/tf_core/tf_session.h +5 -0
index 0b8f63c374..e2cebd20a1 100644
@@ -159,6 +159,11 @@ struct tf_session {
 	 * the pointer to the parent bp struct
 	 */
 	void *bp;
+
+	/**
+	 * EM allocator for session
+	 */
+	void *em_pool[TF_DIR_MAX];
 };
 
 /**
Signature · 1 line
2.17.1
#16 lore raw

PATCH 16/58 net/bnxt: update shared session functionality

In reply to Venkat Duvvuru

From: Jay Ding <[email protected]>

- Distinguish the shared session on host side using PCI address
- One session could be shared by multiple interfaces.

---
 drivers/net/bnxt/tf_core/tf_core.c        |  9 ---
 drivers/net/bnxt/tf_core/tf_core.h        |  4 ++
 drivers/net/bnxt/tf_core/tf_device.c      | 28 +++++----
 drivers/net/bnxt/tf_core/tf_device_p58.c  |  7 ++-
 drivers/net/bnxt/tf_core/tf_em_internal.c | 23 ++++----
 drivers/net/bnxt/tf_core/tf_identifier.c  | 15 ++---
 drivers/net/bnxt/tf_core/tf_msg.c         | 69 +++++++++++++----------
 drivers/net/bnxt/tf_core/tf_session.c     | 13 ++++-
 drivers/net/bnxt/tf_core/tf_session.h     |  9 +--
 drivers/net/bnxt/tf_core/tf_tbl.c         | 57 ++++++++++++++++---
 drivers/net/bnxt/tf_core/tf_tcam.c        | 15 ++---
 drivers/net/bnxt/tf_core/tfp.c            |  4 +-
 12 files changed, 153 insertions(+), 100 deletions(-)
drivers/net/bnxt/tf_core/tf_core.c +0 -9
index 69f5c10293..945e54bfdd 100644
@@ -27,8 +27,6 @@ tf_open_session(struct tf *tfp,
 	int rc;
 	unsigned int domain, bus, slot, device;
 	struct tf_session_open_session_parms oparms;
-	int name_len;
-	char *name;
 
 	TF_CHECK_PARMS2(tfp, parms);
 
@@ -71,13 +69,6 @@ tf_open_session(struct tf *tfp,
 		}
 	}
 
-	name_len = strlen(parms->ctrl_chan_name);
-	name = &parms->ctrl_chan_name[name_len - strlen("tf_shared")];
-	if (!strncmp(name, "tf_shared", strlen("tf_shared"))) {
-		memset(parms->ctrl_chan_name, 0, strlen(parms->ctrl_chan_name));
-		strcpy(parms->ctrl_chan_name, "tf_share");
-	}
-
 	parms->session_id.internal.domain = domain;
 	parms->session_id.internal.bus = bus;
 	parms->session_id.internal.device = device;
drivers/net/bnxt/tf_core/tf_core.h +4 -0
index 08a083077c..3d14dc5391 100644
@@ -458,6 +458,10 @@ struct tf_session_info {
  */
 struct tf {
 	struct tf_session_info *session;
+	/**
+	 * the pointer to the parent bp struct
+	 */
+	void *bp;
 };
 
 /**
drivers/net/bnxt/tf_core/tf_device.c +16 -12
index fed4156200..97ae73fa5a 100644
@@ -44,7 +44,11 @@ tf_dev_reservation_check(uint16_t count,
 		rm_num = (uint16_t *)reservations + i * count;
 		for (j = 0; j < count; j++) {
 			if ((cfg[j].cfg_type == TF_RM_ELEM_CFG_HCAPI ||
-			     cfg[j].cfg_type == TF_RM_ELEM_CFG_HCAPI_BA) &&
+			     cfg[j].cfg_type == TF_RM_ELEM_CFG_HCAPI_BA ||
+			     cfg[j].cfg_type ==
+				TF_RM_ELEM_CFG_HCAPI_BA_PARENT ||
+			     cfg[j].cfg_type ==
+				TF_RM_ELEM_CFG_HCAPI_BA_CHILD) &&
 			     rm_num[j] > 0)
 				cnt++;
 		}
@@ -263,49 +267,49 @@ tf_dev_unbind_p4(struct tf *tfp)
 	 */
 	rc = tf_tcam_unbind(tfp);
 	if (rc) {
-		TFP_DRV_LOG(ERR,
+		TFP_DRV_LOG(INFO,
 			    "Device unbind failed, TCAM\n");
 		fail = true;
 	}
 
 	rc = tf_ident_unbind(tfp);
 	if (rc) {
-		TFP_DRV_LOG(ERR,
+		TFP_DRV_LOG(INFO,
 			    "Device unbind failed, Identifier\n");
 		fail = true;
 	}
 
 	rc = tf_tbl_unbind(tfp);
 	if (rc) {
-		TFP_DRV_LOG(ERR,
+		TFP_DRV_LOG(INFO,
 			    "Device unbind failed, Table Type\n");
 		fail = true;
 	}
 
 	rc = tf_em_ext_common_unbind(tfp);
 	if (rc) {
-		TFP_DRV_LOG(ERR,
+		TFP_DRV_LOG(INFO,
 			    "Device unbind failed, EEM\n");
 		fail = true;
 	}
 
 	rc = tf_em_int_unbind(tfp);
 	if (rc) {
-		TFP_DRV_LOG(ERR,
+		TFP_DRV_LOG(INFO,
 			    "Device unbind failed, EM\n");
 		fail = true;
 	}
 
 	rc = tf_if_tbl_unbind(tfp);
 	if (rc) {
-		TFP_DRV_LOG(ERR,
+		TFP_DRV_LOG(INFO,
 			    "Device unbind failed, IF Table Type\n");
 		fail = true;
 	}
 
 	rc = tf_global_cfg_unbind(tfp);
 	if (rc) {
-		TFP_DRV_LOG(ERR,
+		TFP_DRV_LOG(INFO,
 			    "Device unbind failed, Global Cfg Type\n");
 		fail = true;
 	}
@@ -515,28 +519,28 @@ tf_dev_unbind_p58(struct tf *tfp)
 	 */
 	rc = tf_tcam_unbind(tfp);
 	if (rc) {
-		TFP_DRV_LOG(ERR,
+		TFP_DRV_LOG(INFO,
 			    "Device unbind failed, TCAM\n");
 		fail = true;
 	}
 
 	rc = tf_ident_unbind(tfp);
 	if (rc) {
-		TFP_DRV_LOG(ERR,
+		TFP_DRV_LOG(INFO,
 			    "Device unbind failed, Identifier\n");
 		fail = true;
 	}
 
 	rc = tf_tbl_unbind(tfp);
 	if (rc) {
-		TFP_DRV_LOG(ERR,
+		TFP_DRV_LOG(INFO,
 			    "Device unbind failed, Table Type\n");
 		fail = true;
 	}
 
 	rc = tf_em_int_unbind(tfp);
 	if (rc) {
-		TFP_DRV_LOG(ERR,
+		TFP_DRV_LOG(INFO,
 			    "Device unbind failed, EM\n");
 		fail = true;
 	}
drivers/net/bnxt/tf_core/tf_device_p58.c +5 -2
index 7917c9613a..ba82efdfe2 100644
@@ -193,8 +193,11 @@ static int tf_dev_p58_get_sram_tbl_info(struct tf *tfp __rte_unused,
 	parms.hcapi_type = &hcapi_type;
 
 	rc = tf_rm_get_hcapi_type(&parms);
-	if (rc)
-		return rc;
+	if (rc) {
+		*base = 0;
+		*shift = 0;
+		return 0;
+	}
 
 	switch (hcapi_type) {
 	case CFA_RESOURCE_TYPE_P58_SRAM_BANK_0:
drivers/net/bnxt/tf_core/tf_em_internal.c +11 -12
index eec15b89bc..3b1e4e385d 100644
@@ -509,21 +509,21 @@ tf_em_int_unbind(struct tf *tfp)
 
 	rc = tf_session_get_db(tfp, TF_MODULE_TYPE_EM, &em_db_ptr);
 	if (rc) {
-		TFP_DRV_LOG(ERR,
-			    "Failed to get em_ext_db from session, rc:%s\n",
+		TFP_DRV_LOG(INFO,
+			    "Em_db is not initialized, rc:%s\n",
 			    strerror(-rc));
-		return rc;
+		return 0;
 	}
 	em_db = (struct em_rm_db *)em_db_ptr;
 
 	for (i = 0; i < TF_DIR_MAX; i++) {
+		if (em_db->em_db[i] == NULL)
+			continue;
 		fparms.dir = i;
 		fparms.rm_db = em_db->em_db[i];
-		if (em_db->em_db[i] != NULL) {
-			rc = tf_rm_free_db(tfp, &fparms);
-			if (rc)
-				return rc;
-		}
+		rc = tf_rm_free_db(tfp, &fparms);
+		if (rc)
+			return rc;
 
 		em_db->em_db[i] = NULL;
 	}
@@ -546,10 +546,9 @@ tf_em_get_resc_info(struct tf *tfp,
 
 	rc = tf_session_get_db(tfp, TF_MODULE_TYPE_EM, &em_db_ptr);
 	if (rc) {
-		TFP_DRV_LOG(ERR,
-			    "Failed to get em_ext_db from session, rc:%s\n",
-			    strerror(-rc));
-		return rc;
+		TFP_DRV_LOG(INFO,
+			    "No resource allocated for em from session\n");
+		return 0;
 	}
 	em_db = (struct em_rm_db *)em_db_ptr;
 
drivers/net/bnxt/tf_core/tf_identifier.c +8 -7
index 4063f3ba17..ebb975562d 100644
@@ -119,14 +119,16 @@ tf_ident_unbind(struct tf *tfp)
 
 	rc = tf_session_get_db(tfp, TF_MODULE_TYPE_IDENTIFIER, &ident_db_ptr);
 	if (rc) {
-		TFP_DRV_LOG(ERR,
-			    "Failed to get ident_db from session, rc:%s\n",
+		TFP_DRV_LOG(INFO,
+			    "Ident_db is not initialized, rc:%s\n",
 			    strerror(-rc));
-		return rc;
+		return 0;
 	}
 	ident_db = (struct ident_rm_db *)ident_db_ptr;
 
 	for (i = 0; i < TF_DIR_MAX; i++) {
+		if (ident_db->ident_db[i] == NULL)
+			continue;
 		fparms.rm_db = ident_db->ident_db[i];
 		fparms.dir = i;
 		rc = tf_rm_free_db(tfp, &fparms);
@@ -372,10 +374,9 @@ tf_ident_get_resc_info(struct tf *tfp,
 
 	rc = tf_session_get_db(tfp, TF_MODULE_TYPE_IDENTIFIER, &ident_db_ptr);
 	if (rc) {
-		TFP_DRV_LOG(ERR,
-			    "Failed to get ident_db from session, rc:%s\n",
-			    strerror(-rc));
-		return rc;
+		TFP_DRV_LOG(INFO,
+			    "No resource allocated for ident from session\n");
+		return 0;
 	}
 	ident_db = (struct ident_rm_db *)ident_db_ptr;
 
drivers/net/bnxt/tf_core/tf_msg.c +38 -31

257 lines not on this page · raw message

drivers/net/bnxt/tf_core/tf_session.c +10 -3
index 391d8786ab..93876d8e5d 100644
@@ -59,6 +59,8 @@ tf_session_create(struct tf *tfp,
 	union tf_session_id *session_id;
 	struct tf_dev_info dev;
 	bool shared_session_creator;
+	int name_len;
+	char *name;
 
 	TF_CHECK_PARMS2(tfp, parms);
 
@@ -140,7 +142,6 @@ tf_session_create(struct tf *tfp,
 	session_id->id = session->session_id.id;
 
 	session->shadow_copy = parms->open_cfg->shadow_copy;
-	session->bp = parms->open_cfg->bp;
 
 	/* Init session client list */
 	ll_init(&session->client_ll);
@@ -179,7 +180,12 @@ tf_session_create(struct tf *tfp,
 
 	/* Init session em_ext_db */
 	session->em_ext_db_handle = NULL;
-	if (!strcmp(parms->open_cfg->ctrl_chan_name, "tf_share"))
+
+	/* Populate the request */
+	name_len = strnlen(parms->open_cfg->ctrl_chan_name,
+			   TF_SESSION_NAME_MAX);
+	name = &parms->open_cfg->ctrl_chan_name[name_len - strlen("tf_shared")];
+	if (!strncmp(name, "tf_shared", strlen("tf_shared")))
 		session->shared_session = true;
 
 	if (session->shared_session && shared_session_creator) {
@@ -404,8 +410,9 @@ tf_session_open_session(struct tf *tfp,
 	int rc;
 	struct tf_session_client_create_parms scparms;
 
-	TF_CHECK_PARMS2(tfp, parms);
+	TF_CHECK_PARMS3(tfp, parms, parms->open_cfg->bp);
 
+	tfp->bp = parms->open_cfg->bp;
 	/* Decide if we're creating a new session or session client */
 	if (tfp->session == NULL) {
 		rc = tf_session_create(tfp, parms);
drivers/net/bnxt/tf_core/tf_session.h +2 -7
index e2cebd20a1..034a2213a4 100644
@@ -155,11 +155,6 @@ struct tf_session {
 	 */
 	void *em_db_handle;
 
-	/**
-	 * the pointer to the parent bp struct
-	 */
-	void *bp;
-
 	/**
 	 * EM allocator for session
 	 */
@@ -567,8 +562,8 @@ tf_session_is_shared_session_creator(struct tf_session *tfs)
  *   - the pointer to the parent bnxt struct
  */
 static inline struct bnxt*
-tf_session_get_bp(struct tf_session *tfs)
+tf_session_get_bp(struct tf *tfp)
 {
-	return tfs->bp;
+	return tfp->bp;
 }
 #endif /* _TF_SESSION_H_ */
drivers/net/bnxt/tf_core/tf_tbl.c +49 -8

93 lines not on this page · raw message

drivers/net/bnxt/tf_core/tf_tcam.c +8 -7
index 70dc539f15..0f05af87f1 100644
@@ -220,14 +220,16 @@ tf_tcam_unbind(struct tf *tfp)
 
 	rc = tf_session_get_db(tfp, TF_MODULE_TYPE_TCAM, &tcam_db_ptr);
 	if (rc) {
-		TFP_DRV_LOG(ERR,
-			    "Failed to get em_ext_db from session, rc:%s\n",
+		TFP_DRV_LOG(INFO,
+			    "Tcam_db is not initialized, rc:%s\n",
 			    strerror(-rc));
-		return rc;
+		return 0;
 	}
 	tcam_db = (struct tcam_rm_db *)tcam_db_ptr;
 
 	for (i = 0; i < TF_DIR_MAX; i++) {
+		if (tcam_db->tcam_db[i] == NULL)
+			continue;
 		memset(&fparms, 0, sizeof(fparms));
 		fparms.dir = i;
 		fparms.rm_db = tcam_db->tcam_db[i];
@@ -816,10 +818,9 @@ tf_tcam_get_resc_info(struct tf *tfp,
 
 	rc = tf_session_get_db(tfp, TF_MODULE_TYPE_TCAM, &tcam_db_ptr);
 	if (rc) {
-		TFP_DRV_LOG(ERR,
-			    "Failed to get em_ext_db from session, rc:%s\n",
-			    strerror(-rc));
-		return rc;
+		TFP_DRV_LOG(INFO,
+			    "No resource allocated for tcam from session\n");
+		return 0;
 	}
 	tcam_db = (struct tcam_rm_db *)tcam_db_ptr;
 
drivers/net/bnxt/tf_core/tfp.c +2 -2
index 4d9b37f749..a4b0934610 100644
@@ -134,7 +134,7 @@ tfp_get_fid(struct tf *tfp, uint16_t *fw_fid)
 	if (tfp == NULL || fw_fid == NULL)
 		return -EINVAL;
 
-	bp = container_of(tfp, struct bnxt, tfp);
+	bp = (struct bnxt *)tfp->bp;
 	if (bp == NULL)
 		return -EINVAL;
 
@@ -151,7 +151,7 @@ tfp_get_pf(struct tf *tfp, uint16_t *pf)
 	if (tfp == NULL || pf == NULL)
 		return -EINVAL;
 
-	bp = container_of(tfp, struct bnxt, tfp);
+	bp = (struct bnxt *)tfp->bp;
 	if (BNXT_VF(bp) && bp->parent) {
 		*pf = bp->parent->fid - 1;
 		return 0;
Signature · 1 line
2.17.1
#17 lore raw

PATCH 17/58 net/bnxt: modify resource reservation strategy

In reply to Venkat Duvvuru

From: Jay Ding <[email protected]>

Allow an application to only reserve resources for one direction.

---
 drivers/net/bnxt/tf_core/tf_core.c        |  4 --
 drivers/net/bnxt/tf_core/tf_em_common.c   | 61 +++++++++++------------
 drivers/net/bnxt/tf_core/tf_em_internal.c | 13 +++--
 drivers/net/bnxt/tf_core/tf_identifier.c  | 15 +++---
 drivers/net/bnxt/tf_core/tf_tbl.c         | 12 +++--
 drivers/net/bnxt/tf_core/tf_tcam.c        | 14 ++++--
 6 files changed, 65 insertions(+), 54 deletions(-)
drivers/net/bnxt/tf_core/tf_core.c +0 -4
index 945e54bfdd..de2a93646f 100644
@@ -1636,7 +1636,6 @@ int tf_get_session_info(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "Ident get resc info failed, rc:%s\n",
 			    strerror(-rc));
-		return rc;
 	}
 
 	if (dev->ops->tf_dev_get_tbl_resc_info == NULL) {
@@ -1652,7 +1651,6 @@ int tf_get_session_info(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "Tbl get resc info failed, rc:%s\n",
 			    strerror(-rc));
-		return rc;
 	}
 
 	if (dev->ops->tf_dev_get_tcam_resc_info == NULL) {
@@ -1668,7 +1666,6 @@ int tf_get_session_info(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "TCAM get resc info failed, rc:%s\n",
 			    strerror(-rc));
-		return rc;
 	}
 
 	if (dev->ops->tf_dev_get_em_resc_info == NULL) {
@@ -1684,7 +1681,6 @@ int tf_get_session_info(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "EM get resc info failed, rc:%s\n",
 			    strerror(-rc));
-		return rc;
 	}
 
 	return 0;
drivers/net/bnxt/tf_core/tf_em_common.c +30 -31

91 lines not on this page · raw message

drivers/net/bnxt/tf_core/tf_em_internal.c +9 -4
index 3b1e4e385d..93de513989 100644
@@ -349,6 +349,7 @@ tf_em_int_bind(struct tf *tfp,
 	       struct tf_em_cfg_parms *parms)
 {
 	int rc;
+	int db_rc[TF_DIR_MAX] = { 0 };
 	int i;
 	struct tf_rm_create_db_parms db_cfg = { 0 };
 	struct tf_rm_get_alloc_info_parms iparms;
@@ -408,18 +409,22 @@ tf_em_int_bind(struct tf *tfp,
 		db_cfg.rm_db = (void *)&em_db->em_db[i];
 		if (tf_session_is_shared_session(tfs) &&
 			(!tf_session_is_shared_session_creator(tfs)))
-			rc = tf_rm_create_db_no_reservation(tfp, &db_cfg);
+			db_rc[i] = tf_rm_create_db_no_reservation(tfp, &db_cfg);
 		else
-			rc = tf_rm_create_db(tfp, &db_cfg);
-		if (rc) {
+			db_rc[i] = tf_rm_create_db(tfp, &db_cfg);
+		if (db_rc[i]) {
 			TFP_DRV_LOG(ERR,
 				    "%s: EM Int DB creation failed\n",
 				    tf_dir_2_str(i));
 
-			return rc;
 		}
 	}
 
+	/* No db created */
+	if (db_rc[TF_DIR_RX] && db_rc[TF_DIR_TX])
+		return db_rc[TF_DIR_RX];
+
+
 	if (!tf_session_is_shared_session(tfs)) {
 		for (i = 0; i < TF_DIR_MAX; i++) {
 			iparms.rm_db = em_db->em_db[i];
drivers/net/bnxt/tf_core/tf_identifier.c +9 -6
index ebb975562d..3cc87de4ef 100644
@@ -30,6 +30,7 @@ tf_ident_bind(struct tf *tfp,
 	      struct tf_ident_cfg_parms *parms)
 {
 	int rc;
+	int db_rc[TF_DIR_MAX] = { 0 };
 	int i;
 	struct tf_rm_create_db_parms db_cfg = { 0 };
 	struct tf_shadow_ident_cfg_parms shadow_cfg = { 0 };
@@ -70,15 +71,13 @@ tf_ident_bind(struct tf *tfp,
 		db_cfg.alloc_cnt = parms->resources->ident_cnt[i].cnt;
 		if (tf_session_is_shared_session(tfs) &&
 			(!tf_session_is_shared_session_creator(tfs)))
-			rc = tf_rm_create_db_no_reservation(tfp, &db_cfg);
+			db_rc[i] = tf_rm_create_db_no_reservation(tfp, &db_cfg);
 		else
-			rc = tf_rm_create_db(tfp, &db_cfg);
-		if (rc) {
-			TFP_DRV_LOG(ERR,
+			db_rc[i] = tf_rm_create_db(tfp, &db_cfg);
+		if (db_rc[i]) {
+			TFP_DRV_LOG(INFO,
 				    "%s: Identifier DB creation failed\n",
 				    tf_dir_2_str(i));
-
-			return rc;
 		}
 
 		if (parms->shadow_copy) {
@@ -99,6 +98,10 @@ tf_ident_bind(struct tf *tfp,
 		}
 	}
 
+	/* No db created */
+	if (db_rc[TF_DIR_RX] && db_rc[TF_DIR_TX])
+		return db_rc[TF_DIR_RX];
+
 	TFP_DRV_LOG(INFO,
 		    "Identifier - initialized\n");
 
drivers/net/bnxt/tf_core/tf_tbl.c +8 -4
index ca1aef8ebf..192115183b 100644
@@ -41,6 +41,7 @@ tf_tbl_bind(struct tf *tfp,
 	    struct tf_tbl_cfg_parms *parms)
 {
 	int rc, d, i;
+	int db_rc[TF_DIR_MAX] = { 0 };
 	struct tf_rm_create_db_parms db_cfg = { 0 };
 	struct tbl_rm_db *tbl_db;
 	struct tfp_calloc_parms cparms;
@@ -79,18 +80,21 @@ tf_tbl_bind(struct tf *tfp,
 		db_cfg.rm_db = (void *)&tbl_db->tbl_db[d];
 		if (tf_session_is_shared_session(tfs) &&
 			(!tf_session_is_shared_session_creator(tfs)))
-			rc = tf_rm_create_db_no_reservation(tfp, &db_cfg);
+			db_rc[d] = tf_rm_create_db_no_reservation(tfp, &db_cfg);
 		else
-			rc = tf_rm_create_db(tfp, &db_cfg);
-		if (rc) {
+			db_rc[d] = tf_rm_create_db(tfp, &db_cfg);
+		if (db_rc[d]) {
 			TFP_DRV_LOG(ERR,
 				    "%s: Table DB creation failed\n",
 				    tf_dir_2_str(d));
 
-			return rc;
 		}
 	}
 
+	/* No db created */
+	if (db_rc[TF_DIR_RX] && db_rc[TF_DIR_TX])
+		return db_rc[TF_DIR_RX];
+
 	TFP_DRV_LOG(INFO,
 		    "Table Type - initialized\n");
 
drivers/net/bnxt/tf_core/tf_tcam.c +9 -5
index 0f05af87f1..ce959e3923 100644
@@ -33,6 +33,7 @@ tf_tcam_bind(struct tf *tfp,
 	     struct tf_tcam_cfg_parms *parms)
 {
 	int rc;
+	int db_rc[TF_DIR_MAX] = { 0 };
 	int i, d;
 	struct tf_rm_alloc_info info;
 	struct tf_rm_free_db_parms fparms;
@@ -109,17 +110,20 @@ tf_tcam_bind(struct tf *tfp,
 		db_cfg.rm_db = (void *)&tcam_db->tcam_db[d];
 		if (tf_session_is_shared_session(tfs) &&
 			(!tf_session_is_shared_session_creator(tfs)))
-			rc = tf_rm_create_db_no_reservation(tfp, &db_cfg);
+			db_rc[d] = tf_rm_create_db_no_reservation(tfp, &db_cfg);
 		else
-			rc = tf_rm_create_db(tfp, &db_cfg);
-		if (rc) {
-			TFP_DRV_LOG(ERR,
+			db_rc[d] = tf_rm_create_db(tfp, &db_cfg);
+		if (db_rc[d]) {
+			TFP_DRV_LOG(INFO,
 				    "%s: TCAM DB creation failed\n",
 				    tf_dir_2_str(d));
-			return rc;
 		}
 	}
 
+	/* No db created */
+	if (db_rc[TF_DIR_RX] && db_rc[TF_DIR_TX])
+		return db_rc[TF_DIR_RX];
+
 	/* check if reserved resource for WC is multiple of num_slices */
 	for (d = 0; d < TF_DIR_MAX; d++) {
 		memset(&info, 0, sizeof(info));
Signature · 1 line
2.17.1
#18 lore raw

PATCH 18/58 net/bnxt: shared TCAM region support

In reply to Venkat Duvvuru

From: Farah Smith <[email protected]>

- switch to single slice management on Wh+
- Support of shared session WC_TCAM_HIGH and WC_TCAM_LOW regions
- Enable/disable using TF_TCAM_SHARED flag in tf_core.h
- Fix empty session module DBs in the case that none are allocated for a given module type

---
 drivers/net/bnxt/tf_core/meson.build      |  25 +-
 drivers/net/bnxt/tf_core/tf_core.h        |  45 +-
 drivers/net/bnxt/tf_core/tf_device.c      |  72 ++-
 drivers/net/bnxt/tf_core/tf_device.h      |   4 +-
 drivers/net/bnxt/tf_core/tf_device_p4.c   |  17 +-
 drivers/net/bnxt/tf_core/tf_device_p58.c  |  13 +-
 drivers/net/bnxt/tf_core/tf_identifier.c  |   2 +-
 drivers/net/bnxt/tf_core/tf_tbl.c         |   5 +-
 drivers/net/bnxt/tf_core/tf_tcam.c        |   5 +-
 drivers/net/bnxt/tf_core/tf_tcam_shared.c | 744 ++++++++++++++++++++++
 drivers/net/bnxt/tf_core/tf_tcam_shared.h | 127 ++++
 drivers/net/bnxt/tf_core/tf_util.c        |   6 +
 12 files changed, 1014 insertions(+), 51 deletions(-)
 create mode 100644 drivers/net/bnxt/tf_core/tf_tcam_shared.c
 create mode 100644 drivers/net/bnxt/tf_core/tf_tcam_shared.h
drivers/net/bnxt/tf_core/meson.build +13 -12
index 3a91f04bc0..f28e77ec2e 100644
@@ -10,26 +10,27 @@ sources += files(
         'tf_core.c',
         'bitalloc.c',
         'tf_msg.c',
-	'dpool.c',
+        'll.c',
+        'dpool.c',
         'rand.c',
         'stack.c',
-        'tf_em_common.c',
-        'tf_em_internal.c',
         'tf_rm.c',
         'tf_tbl.c',
+        'tf_em_common.c',
+        'tf_em_host.c',
+        'tf_em_internal.c',
+        'tf_em_hash_internal.c',
         'tfp.c',
-        'tf_session.c',
+        'tf_util.c',
         'tf_device.c',
         'tf_device_p4.c',
-        'tf_device_p58.c',
+        'tf_global_cfg.c',
         'tf_identifier.c',
+        'tf_if_tbl.c',
+        'tf_session.c',
         'tf_shadow_tcam.c',
         'tf_tcam.c',
-        'tf_util.c',
-        'tf_if_tbl.c',
-        'll.c',
-        'tf_global_cfg.c',
-        'tf_em_host.c',
-        'tf_em_hash_internal.c',
+        'tf_tcam_shared.c',
         'tf_shadow_identifier.c',
-        'tf_hash.c')
+        'tf_hash.c',
+        'tf_device_p58.c')
drivers/net/bnxt/tf_core/tf_core.h +41 -4

81 lines not on this page · raw message

drivers/net/bnxt/tf_core/tf_device.c +49 -23

120 lines not on this page · raw message

drivers/net/bnxt/tf_core/tf_device.h +3 -1
index 31806bb289..ea4dcfb8e2 100644
@@ -10,6 +10,9 @@
 #include "tf_identifier.h"
 #include "tf_tbl.h"
 #include "tf_tcam.h"
+#ifdef TF_TCAM_SHARED
+#include "tf_tcam_shared.h"
+#endif
 #include "tf_if_tbl.h"
 #include "tf_global_cfg.h"
 
@@ -136,7 +139,6 @@ struct tf_dev_ops {
 				       uint16_t resource_id,
 				       const char **resource_str);
 
-
 	/**
 	 * Retrieves the WC TCAM slice information that the device
 	 * supports.
drivers/net/bnxt/tf_core/tf_device_p4.c +14 -3
index 3f788638c1..fccbccc2d8 100644
@@ -10,6 +10,9 @@
 #include "tf_identifier.h"
 #include "tf_tbl.h"
 #include "tf_tcam.h"
+#ifdef TF_TCAM_SHARED
+#include "tf_tcam_shared.h"
+#endif /* TF_TCAM_SHARED */
 #include "tf_em.h"
 #include "tf_if_tbl.h"
 #include "tfp.h"
@@ -140,7 +143,8 @@ tf_dev_p4_get_tcam_slice_info(struct tf *tfp __rte_unused,
 			      uint16_t key_sz,
 			      uint16_t *num_slices_per_row)
 {
-#define CFA_P4_WC_TCAM_SLICES_PER_ROW 2
+/* Single slice support */
+#define CFA_P4_WC_TCAM_SLICES_PER_ROW 1
 #define CFA_P4_WC_TCAM_SLICE_SIZE     12
 
 	if (type == TF_TCAM_TBL_TYPE_WC_TCAM) {
@@ -266,11 +270,18 @@ const struct tf_dev_ops tf_dev_ops_p4 = {
 	.tf_dev_get_tbl = tf_tbl_get,
 	.tf_dev_get_bulk_tbl = tf_tbl_bulk_get,
 	.tf_dev_get_tbl_resc_info = tf_tbl_get_resc_info,
+#ifdef TF_TCAM_SHARED
+	.tf_dev_alloc_tcam = tf_tcam_shared_alloc,
+	.tf_dev_free_tcam = tf_tcam_shared_free,
+	.tf_dev_set_tcam = tf_tcam_shared_set,
+	.tf_dev_get_tcam = tf_tcam_shared_get,
+#else /* !TF_TCAM_SHARED */
 	.tf_dev_alloc_tcam = tf_tcam_alloc,
 	.tf_dev_free_tcam = tf_tcam_free,
-	.tf_dev_alloc_search_tcam = tf_tcam_alloc_search,
 	.tf_dev_set_tcam = tf_tcam_set,
-	.tf_dev_get_tcam = NULL,
+	.tf_dev_get_tcam = tf_tcam_get,
+#endif
+	.tf_dev_alloc_search_tcam = tf_tcam_alloc_search,
 	.tf_dev_get_tcam_resc_info = tf_tcam_get_resc_info,
 	.tf_dev_insert_int_em_entry = tf_em_insert_int_entry,
 	.tf_dev_delete_int_em_entry = tf_em_delete_int_entry,
drivers/net/bnxt/tf_core/tf_device_p58.c +11 -2
index ba82efdfe2..b25c5acf94 100644
@@ -10,6 +10,9 @@
 #include "tf_identifier.h"
 #include "tf_tbl.h"
 #include "tf_tcam.h"
+#ifdef TF_TCAM_SHARED
+#include "tf_tcam_shared.h"
+#endif /* TF_TCAM_SHARED */
 #include "tf_em.h"
 #include "tf_if_tbl.h"
 #include "tfp.h"
@@ -151,7 +154,6 @@ static int tf_dev_p58_word_align(uint16_t size)
 	return ((((size) + 63) >> 6) * 8);
 }
 
-
 #define TF_DEV_P58_BANK_SZ_64B 2048
 /**
  * Get SRAM table information.
@@ -290,11 +292,18 @@ const struct tf_dev_ops tf_dev_ops_p58 = {
 	.tf_dev_get_tbl = tf_tbl_get,
 	.tf_dev_get_bulk_tbl = tf_tbl_bulk_get,
 	.tf_dev_get_tbl_resc_info = tf_tbl_get_resc_info,
+#ifdef TF_TCAM_SHARED
+	.tf_dev_alloc_tcam = tf_tcam_shared_alloc,
+	.tf_dev_free_tcam = tf_tcam_shared_free,
+	.tf_dev_set_tcam = tf_tcam_set,
+	.tf_dev_get_tcam = tf_tcam_get,
+#else /* !TF_TCAM_SHARED */
 	.tf_dev_alloc_tcam = tf_tcam_alloc,
 	.tf_dev_free_tcam = tf_tcam_free,
-	.tf_dev_alloc_search_tcam = tf_tcam_alloc_search,
 	.tf_dev_set_tcam = tf_tcam_set,
 	.tf_dev_get_tcam = tf_tcam_get,
+#endif
+	.tf_dev_alloc_search_tcam = tf_tcam_alloc_search,
 	.tf_dev_get_tcam_resc_info = tf_tcam_get_resc_info,
 	.tf_dev_insert_int_em_entry = tf_em_hash_insert_int_entry,
 	.tf_dev_delete_int_em_entry = tf_em_hash_delete_int_entry,
drivers/net/bnxt/tf_core/tf_identifier.c +1 -1
index 3cc87de4ef..3575c3e1a0 100644
@@ -76,7 +76,7 @@ tf_ident_bind(struct tf *tfp,
 			db_rc[i] = tf_rm_create_db(tfp, &db_cfg);
 		if (db_rc[i]) {
 			TFP_DRV_LOG(INFO,
-				    "%s: Identifier DB creation failed\n",
+				    "%s: No Identifier DB required\n",
 				    tf_dir_2_str(i));
 		}
 
drivers/net/bnxt/tf_core/tf_tbl.c +1 -4
index 192115183b..295204ac87 100644
@@ -85,7 +85,7 @@ tf_tbl_bind(struct tf *tfp,
 			db_rc[d] = tf_rm_create_db(tfp, &db_cfg);
 		if (db_rc[d]) {
 			TFP_DRV_LOG(ERR,
-				    "%s: Table DB creation failed\n",
+				    "%s: No Table DB creation required\n",
 				    tf_dir_2_str(d));
 
 		}
@@ -656,7 +656,6 @@ tf_tbl_get_resc_info(struct tf *tfp,
 	}
 	tbl_db = (struct tbl_rm_db *)tbl_db_ptr;
 
-
 	/* check if reserved resource for WC is multiple of num_slices */
 	for (d = 0; d < TF_DIR_MAX; d++) {
 		ainfo.rm_db = tbl_db->tbl_db[d];
@@ -693,7 +692,5 @@ tf_tbl_get_resc_info(struct tf *tfp,
 		}
 	}
 
-
-
 	return 0;
 }
drivers/net/bnxt/tf_core/tf_tcam.c +4 -1
index ce959e3923..5c018f7003 100644
@@ -115,7 +115,7 @@ tf_tcam_bind(struct tf *tfp,
 			db_rc[d] = tf_rm_create_db(tfp, &db_cfg);
 		if (db_rc[d]) {
 			TFP_DRV_LOG(INFO,
-				    "%s: TCAM DB creation failed\n",
+				    "%s: no TCAM DB required\n",
 				    tf_dir_2_str(d));
 		}
 	}
@@ -126,6 +126,9 @@ tf_tcam_bind(struct tf *tfp,
 
 	/* check if reserved resource for WC is multiple of num_slices */
 	for (d = 0; d < TF_DIR_MAX; d++) {
+		if (!tcam_db->tcam_db[d])
+			continue;
+
 		memset(&info, 0, sizeof(info));
 		ainfo.rm_db = tcam_db->tcam_db[d];
 		ainfo.subtype = TF_TCAM_TBL_TYPE_WC_TCAM;
drivers/net/bnxt/tf_core/tf_tcam_shared.c new file +744 -0

744 lines not on this page · raw message

drivers/net/bnxt/tf_core/tf_tcam_shared.h new file +127 -0

127 lines not on this page · raw message

drivers/net/bnxt/tf_core/tf_util.c +6 -0
index 25f5c152d2..e712816209 100644
@@ -59,6 +59,12 @@ tf_tcam_tbl_2_str(enum tf_tcam_tbl_type tcam_type)
 		return "sp_tcam";
 	case TF_TCAM_TBL_TYPE_CT_RULE_TCAM:
 		return "ct_rule_tcam";
+#ifdef TF_TCAM_SHARED
+	case TF_TCAM_TBL_TYPE_WC_TCAM_HIGH:
+		return "wc_tcam_hi";
+	case TF_TCAM_TBL_TYPE_WC_TCAM_LOW:
+		return "wc_tcam_lo";
+#endif
 	default:
 		return "Invalid tcam table type";
 	}
Signature · 1 line
2.17.1
#19 lore raw

PATCH 19/58 net/bnxt: cleanup session open/close messages

In reply to Venkat Duvvuru

From: Farah Smith <[email protected]>

Add profile_id to set_prof_tcam.

---
 drivers/net/bnxt/tf_core/tf_device.c      | 90 ++++++++++++-----------
 drivers/net/bnxt/tf_core/tf_em_internal.c | 13 +---
 drivers/net/bnxt/tf_core/tf_identifier.c  | 15 +---
 drivers/net/bnxt/tf_core/tf_if_tbl.c      | 18 +----
 drivers/net/bnxt/tf_core/tf_session.c     | 18 +++--
 drivers/net/bnxt/tf_core/tf_tbl.c         | 18 ++---
 drivers/net/bnxt/tf_core/tf_tcam.c        | 12 +--
 7 files changed, 77 insertions(+), 107 deletions(-)
drivers/net/bnxt/tf_core/tf_device.c +49 -41
index 55cf55886a..498e668b16 100644
@@ -216,20 +216,20 @@ tf_dev_bind_p4(struct tf *tfp,
 		return -ENOMEM;
 	}
 
-	if (!tf_session_is_shared_session(tfs)) {
-		/*
-		 * IF_TBL
-		 */
-		if_tbl_cfg.num_elements = TF_IF_TBL_TYPE_MAX;
-		if_tbl_cfg.cfg = tf_if_tbl_p4;
-		if_tbl_cfg.shadow_copy = shadow_copy;
-		rc = tf_if_tbl_bind(tfp, &if_tbl_cfg);
-		if (rc) {
-			TFP_DRV_LOG(ERR,
-				    "IF Table initialization failure\n");
-			goto fail;
-		}
+	/*
+	 * IF_TBL
+	 */
+	if_tbl_cfg.num_elements = TF_IF_TBL_TYPE_MAX;
+	if_tbl_cfg.cfg = tf_if_tbl_p4;
+	if_tbl_cfg.shadow_copy = shadow_copy;
+	rc = tf_if_tbl_bind(tfp, &if_tbl_cfg);
+	if (rc) {
+		TFP_DRV_LOG(ERR,
+			    "IF Table initialization failure\n");
+		goto fail;
+	}
 
+	if (!tf_session_is_shared_session(tfs)) {
 		/*
 		 * GLOBAL_CFG
 		 */
@@ -271,6 +271,12 @@ tf_dev_unbind_p4(struct tf *tfp)
 {
 	int rc = 0;
 	bool fail = false;
+	struct tf_session *tfs;
+
+	/* Retrieve the session information */
+	rc = tf_session_get_session_internal(tfp, &tfs);
+	if (rc)
+		return rc;
 
 	/* Unbind all the support modules. As this is only done on
 	 * close we only report errors as everything has to be cleaned
@@ -318,18 +324,20 @@ tf_dev_unbind_p4(struct tf *tfp)
 		fail = true;
 	}
 
-	rc = tf_if_tbl_unbind(tfp);
-	if (rc) {
-		TFP_DRV_LOG(INFO,
-			    "Device unbind failed, IF Table Type\n");
-		fail = true;
-	}
+	if (!tf_session_is_shared_session(tfs)) {
+		rc = tf_if_tbl_unbind(tfp);
+		if (rc) {
+			TFP_DRV_LOG(INFO,
+				    "Device unbind failed, IF Table Type\n");
+			fail = true;
+		}
 
-	rc = tf_global_cfg_unbind(tfp);
-	if (rc) {
-		TFP_DRV_LOG(INFO,
-			    "Device unbind failed, Global Cfg Type\n");
-		fail = true;
+		rc = tf_global_cfg_unbind(tfp);
+		if (rc) {
+			TFP_DRV_LOG(INFO,
+				    "Device unbind failed, Global Cfg Type\n");
+			fail = true;
+		}
 	}
 
 	if (fail)
@@ -472,17 +480,17 @@ tf_dev_bind_p58(struct tf *tfp,
 	/*
 	 * IF_TBL
 	 */
-	if (!tf_session_is_shared_session(tfs)) {
-		if_tbl_cfg.num_elements = TF_IF_TBL_TYPE_MAX;
-		if_tbl_cfg.cfg = tf_if_tbl_p58;
-		if_tbl_cfg.shadow_copy = shadow_copy;
-		rc = tf_if_tbl_bind(tfp, &if_tbl_cfg);
-		if (rc) {
-			TFP_DRV_LOG(ERR,
-				    "IF Table initialization failure\n");
-			goto fail;
-		}
+	if_tbl_cfg.num_elements = TF_IF_TBL_TYPE_MAX;
+	if_tbl_cfg.cfg = tf_if_tbl_p58;
+	if_tbl_cfg.shadow_copy = shadow_copy;
+	rc = tf_if_tbl_bind(tfp, &if_tbl_cfg);
+	if (rc) {
+		TFP_DRV_LOG(ERR,
+			    "IF Table initialization failure\n");
+		goto fail;
+	}
 
+	if (!tf_session_is_shared_session(tfs)) {
 		/*
 		 * GLOBAL_CFG
 		 */
@@ -571,14 +579,14 @@ tf_dev_unbind_p58(struct tf *tfp)
 		fail = true;
 	}
 
-	if (!tf_session_is_shared_session(tfs)) {
-		rc = tf_if_tbl_unbind(tfp);
-		if (rc) {
-			TFP_DRV_LOG(ERR,
-				    "Device unbind failed, IF Table Type\n");
-			fail = true;
-		}
+	rc = tf_if_tbl_unbind(tfp);
+	if (rc) {
+		TFP_DRV_LOG(ERR,
+			    "Device unbind failed, IF Table Type\n");
+		fail = true;
+	}
 
+	if (!tf_session_is_shared_session(tfs)) {
 		rc = tf_global_cfg_unbind(tfp);
 		if (rc) {
 			TFP_DRV_LOG(ERR,
drivers/net/bnxt/tf_core/tf_em_internal.c +3 -10
index 93de513989..28ffbd5876 100644
@@ -412,17 +412,13 @@ tf_em_int_bind(struct tf *tfp,
 			db_rc[i] = tf_rm_create_db_no_reservation(tfp, &db_cfg);
 		else
 			db_rc[i] = tf_rm_create_db(tfp, &db_cfg);
-		if (db_rc[i]) {
-			TFP_DRV_LOG(ERR,
-				    "%s: EM Int DB creation failed\n",
-				    tf_dir_2_str(i));
-
-		}
 	}
 
 	/* No db created */
-	if (db_rc[TF_DIR_RX] && db_rc[TF_DIR_TX])
+	if (db_rc[TF_DIR_RX] && db_rc[TF_DIR_TX]) {
+		TFP_DRV_LOG(ERR, "EM Int DB creation failed\n");
 		return db_rc[TF_DIR_RX];
+	}
 
 
 	if (!tf_session_is_shared_session(tfs)) {
@@ -514,9 +510,6 @@ tf_em_int_unbind(struct tf *tfp)
 
 	rc = tf_session_get_db(tfp, TF_MODULE_TYPE_EM, &em_db_ptr);
 	if (rc) {
-		TFP_DRV_LOG(INFO,
-			    "Em_db is not initialized, rc:%s\n",
-			    strerror(-rc));
 		return 0;
 	}
 	em_db = (struct em_rm_db *)em_db_ptr;
drivers/net/bnxt/tf_core/tf_identifier.c +4 -11
index 3575c3e1a0..9f27a41fcf 100644
@@ -74,11 +74,6 @@ tf_ident_bind(struct tf *tfp,
 			db_rc[i] = tf_rm_create_db_no_reservation(tfp, &db_cfg);
 		else
 			db_rc[i] = tf_rm_create_db(tfp, &db_cfg);
-		if (db_rc[i]) {
-			TFP_DRV_LOG(INFO,
-				    "%s: No Identifier DB required\n",
-				    tf_dir_2_str(i));
-		}
 
 		if (parms->shadow_copy) {
 			shadow_cfg.alloc_cnt =
@@ -99,8 +94,10 @@ tf_ident_bind(struct tf *tfp,
 	}
 
 	/* No db created */
-	if (db_rc[TF_DIR_RX] && db_rc[TF_DIR_TX])
+	if (db_rc[TF_DIR_RX] && db_rc[TF_DIR_TX]) {
+		TFP_DRV_LOG(ERR, "No Identifier DB created\n");
 		return db_rc[TF_DIR_RX];
+	}
 
 	TFP_DRV_LOG(INFO,
 		    "Identifier - initialized\n");
@@ -121,12 +118,8 @@ tf_ident_unbind(struct tf *tfp)
 	TF_CHECK_PARMS1(tfp);
 
 	rc = tf_session_get_db(tfp, TF_MODULE_TYPE_IDENTIFIER, &ident_db_ptr);
-	if (rc) {
-		TFP_DRV_LOG(INFO,
-			    "Ident_db is not initialized, rc:%s\n",
-			    strerror(-rc));
+	if (rc)
 		return 0;
-	}
 	ident_db = (struct ident_rm_db *)ident_db_ptr;
 
 	for (i = 0; i < TF_DIR_MAX; i++) {
drivers/net/bnxt/tf_core/tf_if_tbl.c +2 -16
index f58fa79b63..762dac0473 100644
@@ -16,24 +16,16 @@ struct tf;
 
 /**
  * IF Table DBs.
+ * TODO: Store this data in session db
  */
 static void *if_tbl_db[TF_DIR_MAX];
 
-/**
- * IF Table Shadow DBs
- */
-/* static void *shadow_if_tbl_db[TF_DIR_MAX]; */
-
 /**
  * Init flag, set on bind and cleared on unbind
+ * TODO: Store this data in session db
  */
 static uint8_t init;
 
-/**
- * Shadow init flag, set on bind and cleared on unbind
- */
-/* static uint8_t shadow_init; */
-
 /**
  * Convert if_tbl_type to hwrm type.
  *
@@ -70,12 +62,6 @@ tf_if_tbl_bind(struct tf *tfp __rte_unused,
 {
 	TF_CHECK_PARMS2(tfp, parms);
 
-	if (init) {
-		TFP_DRV_LOG(ERR,
-			    "IF TBL DB already initialized\n");
-		return -EINVAL;
-	}
-
 	if_tbl_db[TF_DIR_RX] = parms->cfg;
 	if_tbl_db[TF_DIR_TX] = parms->cfg;
 
drivers/net/bnxt/tf_core/tf_session.c +10 -8
index 93876d8e5d..e6ab518121 100644
@@ -425,9 +425,11 @@ tf_session_open_session(struct tf *tfp,
 		}
 
 		TFP_DRV_LOG(INFO,
-		       "Session created, session_client_id:%d, session_id:%d\n",
+		       "Session created, session_client_id:%d,"
+		       "session_id:0x%08x, fw_session_id:%d\n",
 		       parms->open_cfg->session_client_id.id,
-		       parms->open_cfg->session_id.id);
+		       parms->open_cfg->session_id.id,
+		       parms->open_cfg->session_id.internal.fw_session_id);
 	} else {
 		scparms.ctrl_chan_name = parms->open_cfg->ctrl_chan_name;
 		scparms.session_client_id = &parms->open_cfg->session_client_id;
@@ -438,16 +440,16 @@ tf_session_open_session(struct tf *tfp,
 		rc = tf_session_client_create(tfp, &scparms);
 		if (rc) {
 			TFP_DRV_LOG(ERR,
-			      "Failed to create client on session %d, rc:%s\n",
+			      "Failed to create client on session 0x%x, rc:%s\n",
 			      parms->open_cfg->session_id.id,
 			      strerror(-rc));
 			return rc;
 		}
 
 		TFP_DRV_LOG(INFO,
-			    "Session Client:%d created on session:%d\n",
-			    parms->open_cfg->session_client_id.id,
-			    parms->open_cfg->session_id.id);
+			"Session Client:%d registered on session:0x%8x\n",
+			scparms.session_client_id->internal.fw_session_client_id,
+			tfp->session->session_id.id);
 	}
 
 	return 0;
@@ -541,7 +543,7 @@ tf_session_close_session(struct tf *tfp,
 			    client->session_client_id.id);
 
 		TFP_DRV_LOG(INFO,
-			    "session_id:%d, ref_count:%d\n",
+			    "session_id:0x%08x, ref_count:%d\n",
 			    tfs->session_id.id,
 			    tfs->ref_count);
 
@@ -587,7 +589,7 @@ tf_session_close_session(struct tf *tfp,
 	tfs->ref_count--;
 
 	TFP_DRV_LOG(INFO,
-		    "Closed session, session_id:%d, ref_count:%d\n",
+		    "Closed session, session_id:0x%08x, ref_count:%d\n",
 		    tfs->session_id.id,
 		    tfs->ref_count);
 
drivers/net/bnxt/tf_core/tf_tbl.c +6 -12
index 295204ac87..6842291adf 100644
@@ -83,17 +83,15 @@ tf_tbl_bind(struct tf *tfp,
 			db_rc[d] = tf_rm_create_db_no_reservation(tfp, &db_cfg);
 		else
 			db_rc[d] = tf_rm_create_db(tfp, &db_cfg);
-		if (db_rc[d]) {
-			TFP_DRV_LOG(ERR,
-				    "%s: No Table DB creation required\n",
-				    tf_dir_2_str(d));
-
-		}
 	}
 
 	/* No db created */
-	if (db_rc[TF_DIR_RX] && db_rc[TF_DIR_TX])
+	if (db_rc[TF_DIR_RX] && db_rc[TF_DIR_TX]) {
+		TFP_DRV_LOG(ERR,
+			    "%s: No Table DB created\n",
+			    tf_dir_2_str(d));
 		return db_rc[TF_DIR_RX];
+	}
 
 	TFP_DRV_LOG(INFO,
 		    "Table Type - initialized\n");
@@ -112,12 +110,8 @@ tf_tbl_unbind(struct tf *tfp)
 	TF_CHECK_PARMS1(tfp);
 
 	rc = tf_session_get_db(tfp, TF_MODULE_TYPE_TABLE, &tbl_db_ptr);
-	if (rc) {
-		TFP_DRV_LOG(INFO,
-			    "Tbl_db is not initialized, rc:%s\n",
-			    strerror(-rc));
+	if (rc)
 		return 0;
-	}
 	tbl_db = (struct tbl_rm_db *)tbl_db_ptr;
 
 	for (i = 0; i < TF_DIR_MAX; i++) {
drivers/net/bnxt/tf_core/tf_tcam.c +3 -9
index 5c018f7003..7878f8727a 100644
@@ -113,16 +113,13 @@ tf_tcam_bind(struct tf *tfp,
 			db_rc[d] = tf_rm_create_db_no_reservation(tfp, &db_cfg);
 		else
 			db_rc[d] = tf_rm_create_db(tfp, &db_cfg);
-		if (db_rc[d]) {
-			TFP_DRV_LOG(INFO,
-				    "%s: no TCAM DB required\n",
-				    tf_dir_2_str(d));
-		}
 	}
 
 	/* No db created */
-	if (db_rc[TF_DIR_RX] && db_rc[TF_DIR_TX])
+	if (db_rc[TF_DIR_RX] && db_rc[TF_DIR_TX]) {
+		TFP_DRV_LOG(ERR, "No TCAM DB created\n");
 		return db_rc[TF_DIR_RX];
+	}
 
 	/* check if reserved resource for WC is multiple of num_slices */
 	for (d = 0; d < TF_DIR_MAX; d++) {
@@ -227,9 +224,6 @@ tf_tcam_unbind(struct tf *tfp)
 
 	rc = tf_session_get_db(tfp, TF_MODULE_TYPE_TCAM, &tcam_db_ptr);
 	if (rc) {
-		TFP_DRV_LOG(INFO,
-			    "Tcam_db is not initialized, rc:%s\n",
-			    strerror(-rc));
 		return 0;
 	}
 	tcam_db = (struct tcam_rm_db *)tcam_db_ptr;
Signature · 1 line
2.17.1
#20 lore raw

PATCH 20/58 net/bnxt: add WC TCAM hi/lo move support

In reply to Venkat Duvvuru

From: Farah Smith <[email protected]>

- Add new API to move wc tcam regions from the hi pool to the low pool.
- Enable shared tcam get/set functions on Thor.

---
 drivers/net/bnxt/tf_core/tf_core.c        |  53 +++
 drivers/net/bnxt/tf_core/tf_core.h        |  39 ++
 drivers/net/bnxt/tf_core/tf_device.h      |  18 +
 drivers/net/bnxt/tf_core/tf_device_p4.c   |   1 +
 drivers/net/bnxt/tf_core/tf_device_p58.c  |   5 +-
 drivers/net/bnxt/tf_core/tf_session.c     |  41 ++
 drivers/net/bnxt/tf_core/tf_session.h     |  48 +++
 drivers/net/bnxt/tf_core/tf_tcam.c        |   2 +-
 drivers/net/bnxt/tf_core/tf_tcam_shared.c | 468 ++++++++++++++++++++--
 drivers/net/bnxt/tf_core/tf_tcam_shared.h |  35 ++
 10 files changed, 673 insertions(+), 37 deletions(-)
drivers/net/bnxt/tf_core/tf_core.c +53 -0
index de2a93646f..73dbee2940 100644
@@ -917,6 +917,59 @@ tf_free_tcam_entry(struct tf *tfp,
 	return 0;
 }
 
+#ifdef TF_TCAM_SHARED
+int
+tf_move_tcam_shared_entries(struct tf *tfp,
+			    struct tf_move_tcam_shared_entries_parms *parms)
+{
+	int rc;
+	struct tf_session *tfs;
+	struct tf_dev_info *dev;
+
+	TF_CHECK_PARMS2(tfp, parms);
+
+	/* Retrieve the session information */
+	rc = tf_session_get_session(tfp, &tfs);
+	if (rc) {
+		TFP_DRV_LOG(ERR,
+			    "%s: Failed to lookup session, rc:%s\n",
+			    tf_dir_2_str(parms->dir),
+			    strerror(-rc));
+		return rc;
+	}
+
+	/* Retrieve the device information */
+	rc = tf_session_get_device(tfs, &dev);
+	if (rc) {
+		TFP_DRV_LOG(ERR,
+			    "%s: Failed to lookup device, rc:%s\n",
+			    tf_dir_2_str(parms->dir),
+			    strerror(-rc));
+		return rc;
+	}
+
+	if (dev->ops->tf_dev_move_tcam == NULL) {
+		rc = -EOPNOTSUPP;
+		TFP_DRV_LOG(ERR,
+			    "%s: Operation not supported, rc:%s\n",
+			    tf_dir_2_str(parms->dir),
+			    strerror(-rc));
+		return rc;
+	}
+
+	rc = dev->ops->tf_dev_move_tcam(tfp, parms);
+	if (rc) {
+		TFP_DRV_LOG(ERR,
+			    "%s: TCAM shared entries move failed, rc:%s\n",
+			    tf_dir_2_str(parms->dir),
+			    strerror(-rc));
+		return rc;
+	}
+
+	return 0;
+}
+#endif /* TF_TCAM_SHARED */
+
 int
 tf_alloc_tbl_entry(struct tf *tfp,
 		   struct tf_alloc_tbl_entry_parms *parms)
drivers/net/bnxt/tf_core/tf_core.h +39 -0
index 39a498122b..95cde2e8eb 100644
@@ -1242,6 +1242,10 @@ int tf_free_tbl_scope(struct tf *tfp,
  * @ref tf_get_tcam_entry
  *
  * @ref tf_free_tcam_entry
+ *
+#ifdef TF_TCAM_SHARED
+ * @ref tf_move_tcam_shared_entries
+#endif
  */
 
 /**
@@ -1543,6 +1547,41 @@ struct tf_free_tcam_entry_parms {
 int tf_free_tcam_entry(struct tf *tfp,
 		       struct tf_free_tcam_entry_parms *parms);
 
+#ifdef TF_TCAM_SHARED
+/**
+ * tf_move_tcam_shared_entries parameter definition
+ */
+struct tf_move_tcam_shared_entries_parms {
+	/**
+	 * [in] receive or transmit direction
+	 */
+	enum tf_dir dir;
+	/**
+	 * [in] TCAM table type
+	 */
+	enum tf_tcam_tbl_type tcam_tbl_type;
+};
+
+/**
+ * Move TCAM entries
+ *
+ * This API only affects the following TCAM pools within a shared session:
+ *
+ * TF_TCAM_TBL_TYPE_WC_TCAM_HIGH
+ * TF_TCAM_TBL_TYPE_WC_TCAM_LOW
+ *
+ * When called, all allocated entries from the high pool will be moved to
+ * the low pool.  Then the allocated entries in the high pool will be
+ * cleared and freed.
+ *
+ * This API is not supported on a non-shared session.
+ *
+ * Returns success or failure code.
+ */
+int tf_move_tcam_shared_entries(struct tf *tfp,
+				struct tf_move_tcam_shared_entries_parms *parms);
+
+#endif /* TF_TCAM_SHARED */
 /**
  * @page table Table Access
  *
drivers/net/bnxt/tf_core/tf_device.h +18 -0
index ea4dcfb8e2..48ab17d56b 100644
@@ -563,6 +563,24 @@ struct tf_dev_ops {
 	int (*tf_dev_get_tcam)(struct tf *tfp,
 			       struct tf_tcam_get_parms *parms);
 
+#ifdef TF_TCAM_SHARED
+	/**
+	 * Move TCAM shared entries
+	 *
+	 * [in] tfp
+	 *   Pointer to TF handle
+	 *
+	 * [in] parms
+	 *   Pointer to parameters
+	 *
+	 *    returns:
+	 *    0       - Success
+	 *    -EINVAL - Error
+	 */
+	int (*tf_dev_move_tcam)(struct tf *tfp,
+				struct tf_move_tcam_shared_entries_parms *parms);
+#endif /* TF_TCAM_SHARED */
+
 	/**
 	 * Retrieves the tcam resource info.
 	 *
drivers/net/bnxt/tf_core/tf_device_p4.c +1 -0
index fccbccc2d8..c870f45ff0 100644
@@ -275,6 +275,7 @@ const struct tf_dev_ops tf_dev_ops_p4 = {
 	.tf_dev_free_tcam = tf_tcam_shared_free,
 	.tf_dev_set_tcam = tf_tcam_shared_set,
 	.tf_dev_get_tcam = tf_tcam_shared_get,
+	.tf_dev_move_tcam = tf_tcam_shared_move_p4,
 #else /* !TF_TCAM_SHARED */
 	.tf_dev_alloc_tcam = tf_tcam_alloc,
 	.tf_dev_free_tcam = tf_tcam_free,
drivers/net/bnxt/tf_core/tf_device_p58.c +3 -2
index b25c5acf94..14b9d28b13 100644
@@ -295,8 +295,9 @@ const struct tf_dev_ops tf_dev_ops_p58 = {
 #ifdef TF_TCAM_SHARED
 	.tf_dev_alloc_tcam = tf_tcam_shared_alloc,
 	.tf_dev_free_tcam = tf_tcam_shared_free,
-	.tf_dev_set_tcam = tf_tcam_set,
-	.tf_dev_get_tcam = tf_tcam_get,
+	.tf_dev_set_tcam = tf_tcam_shared_set,
+	.tf_dev_get_tcam = tf_tcam_shared_get,
+	.tf_dev_move_tcam = tf_tcam_shared_move_p58,
 #else /* !TF_TCAM_SHARED */
 	.tf_dev_alloc_tcam = tf_tcam_alloc,
 	.tf_dev_free_tcam = tf_tcam_free,
drivers/net/bnxt/tf_core/tf_session.c +41 -0

44 lines not on this page · raw message

drivers/net/bnxt/tf_core/tf_session.h +48 -0

64 lines not on this page · raw message

drivers/net/bnxt/tf_core/tf_tcam.c +1 -1
index 7878f8727a..d7e12e00ef 100644
@@ -299,7 +299,7 @@ tf_tcam_alloc(struct tf *tfp,
 	rc = tf_session_get_db(tfp, TF_MODULE_TYPE_TCAM, &tcam_db_ptr);
 	if (rc) {
 		TFP_DRV_LOG(ERR,
-			    "Failed to get em_ext_db from session, rc:%s\n",
+			    "Failed to get tcam_db from session, rc:%s\n",
 			    strerror(-rc));
 		return rc;
 	}
drivers/net/bnxt/tf_core/tf_tcam_shared.c +434 -34

639 lines not on this page · raw message

drivers/net/bnxt/tf_core/tf_tcam_shared.h +35 -0
index fad6e23b4c..5588125470 100644
@@ -124,4 +124,39 @@ int tf_tcam_shared_set(struct tf *tfp,
 int tf_tcam_shared_get(struct tf *tfp,
 		       struct tf_tcam_get_parms *parms);
 
+
+/**
+ * Moves entries from the WC_TCAM_HI to the WC_TCAM_LO shared pools
+ * for the P4 device.
+ *
+ * [in] tfp
+ *   Pointer to the truflow handle
+ *
+ * [in] parms
+ *   Pointer to parameters
+ *
+ * Returns
+ *   - (0) if successful.
+ *   - (-EINVAL) on failure.
+ */
+int tf_tcam_shared_move_p4(struct tf *tfp,
+			   struct tf_move_tcam_shared_entries_parms *parms);
+
+/**
+ * Moves entries from the WC_TCAM_HI to the WC_TCAM_LO shared pools
+ * for the P58 device.
+ *
+ * [in] tfp
+ *   Pointer to the truflow handle
+ *
+ * [in] parms
+ *   Pointer to parameters
+ *
+ * Returns
+ *   - (0) if successful.
+ *   - (-EINVAL) on failure.
+ */
+int tf_tcam_shared_move_p58(struct tf *tfp,
+			    struct tf_move_tcam_shared_entries_parms *parms);
+
 #endif /* _TF_TCAM_SHARED_H */
Signature · 1 line
2.17.1
#21 lore raw

PATCH 21/58 net/bnxt: add API to get shared table increments

In reply to Venkat Duvvuru

From: Farah Smith <[email protected]>

Provide tf API to get the shared table increment value for a given TF table type.

---
 drivers/net/bnxt/tf_core/tf_core.c        | 52 +++++++++++++++++++++++
 drivers/net/bnxt/tf_core/tf_core.h        | 34 ++++++++++++++-
 drivers/net/bnxt/tf_core/tf_device.h      | 17 ++++++++
 drivers/net/bnxt/tf_core/tf_device_p4.c   | 25 +++++++++++
 drivers/net/bnxt/tf_core/tf_device_p58.c  | 44 +++++++++++++++++++
 drivers/net/bnxt/tf_core/tf_tcam_shared.c | 22 +++++++---
 6 files changed, 188 insertions(+), 6 deletions(-)
drivers/net/bnxt/tf_core/tf_core.c +52 -0
index 73dbee2940..0fbbd40252 100644
@@ -1415,6 +1415,58 @@ tf_bulk_get_tbl_entry(struct tf *tfp,
 	return rc;
 }
 
+int tf_get_shared_tbl_increment(struct tf *tfp,
+				struct tf_get_shared_tbl_increment_parms *parms)
+{
+	int rc = 0;
+	struct tf_session *tfs;
+	struct tf_dev_info *dev;
+
+	TF_CHECK_PARMS2(tfp, parms);
+
+	/* Retrieve the session information */
+	rc = tf_session_get_session(tfp, &tfs);
+	if (rc) {
+		TFP_DRV_LOG(ERR,
+			    "%s: Failed to lookup session, rc:%s\n",
+			    tf_dir_2_str(parms->dir),
+			    strerror(-rc));
+		return rc;
+	}
+
+	/* Retrieve the device information */
+	rc = tf_session_get_device(tfs, &dev);
+	if (rc) {
+		TFP_DRV_LOG(ERR,
+			    "%s: Failed to lookup device, rc:%s\n",
+			    tf_dir_2_str(parms->dir),
+			    strerror(-rc));
+		return rc;
+	}
+
+	/* Internal table type processing */
+
+	if (dev->ops->tf_dev_get_shared_tbl_increment == NULL) {
+		rc = -EOPNOTSUPP;
+		TFP_DRV_LOG(ERR,
+			    "%s: Operation not supported, rc:%s\n",
+			    tf_dir_2_str(parms->dir),
+			    strerror(-rc));
+		return -EOPNOTSUPP;
+	}
+
+	rc = dev->ops->tf_dev_get_shared_tbl_increment(tfp, parms);
+	if (rc) {
+		TFP_DRV_LOG(ERR,
+			    "%s: Get table increment not supported, rc:%s\n",
+			    tf_dir_2_str(parms->dir),
+			    strerror(-rc));
+		return rc;
+	}
+
+	return rc;
+}
+
 int
 tf_alloc_tbl_scope(struct tf *tfp,
 		   struct tf_alloc_tbl_scope_parms *parms)
drivers/net/bnxt/tf_core/tf_core.h +33 -1
index 95cde2e8eb..44c30fa904 100644
@@ -848,7 +848,6 @@ struct tf_get_session_info_parms {
  */
 int tf_get_session_info(struct tf *tfp,
 			struct tf_get_session_info_parms *parms);
-
 /**
  * Experimental
  *
@@ -1594,6 +1593,8 @@ int tf_move_tcam_shared_entries(struct tf *tfp,
  * @ref tf_get_tbl_entry
  *
  * @ref tf_bulk_get_tbl_entry
+ *
+ * @ref tf_get_shared_tbl_increment
  */
 
 /**
@@ -1844,6 +1845,37 @@ struct tf_set_tbl_entry_parms {
 int tf_set_tbl_entry(struct tf *tfp,
 		     struct tf_set_tbl_entry_parms *parms);
 
+/**
+ * tf_get_shared_tbl_increment parameter definition
+ */
+struct tf_get_shared_tbl_increment_parms {
+	/**
+	 * [in] Receive or transmit direction
+	 */
+	enum tf_dir dir;
+	/**
+	 * [in] Type of object to set
+	 */
+	enum tf_tbl_type type;
+	/**
+	 * [out] Value to increment by for resource type
+	 */
+	uint32_t increment_cnt;
+};
+
+/**
+ * tf_get_shared_tbl_increment
+ *
+ * This API is currently only required for use in the shared
+ * session for Thor (p58) actions.  An increment count is returned per
+ * type to indicate how much to increment the start by for each
+ * entry (see tf_resource_info)
+ *
+ * Returns success or failure code.
+ */
+int tf_get_shared_tbl_increment(struct tf *tfp,
+				struct tf_get_shared_tbl_increment_parms *parms);
+
 /**
  * tf_get_tbl_entry parameter definition
  */
drivers/net/bnxt/tf_core/tf_device.h +17 -0
index 48ab17d56b..1893f630e7 100644
@@ -446,6 +446,23 @@ struct tf_dev_ops {
 	int (*tf_dev_get_bulk_tbl)(struct tf *tfp,
 				   struct tf_tbl_get_bulk_parms *parms);
 
+	/**
+	 * Gets the increment value to add to the shared session resource
+	 * start offset by for each count in the "stride"
+	 *
+	 * [in] tfp
+	 *   Pointer to TF handle
+	 *
+	 * [in] parms
+	 *   Pointer to get shared tbl increment parameters
+	 *
+	 * Returns
+	 *   - (0) if successful.
+	 *   - (-EINVAL) on failure.
+	 */
+	int (*tf_dev_get_shared_tbl_increment)(struct tf *tfp,
+				struct tf_get_shared_tbl_increment_parms *parms);
+
 	/**
 	 * Retrieves the table resource info.
 	 *
drivers/net/bnxt/tf_core/tf_device_p4.c +25 -0
index c870f45ff0..28a6e41906 100644
@@ -193,6 +193,26 @@ tf_dev_p4_map_parif(struct tf *tfp __rte_unused,
 	return 0;
 }
 
+/**
+ * Device specific function that retrieves the increment
+ * required for certain table types in a shared session
+ *
+ * [in] tfp
+ *  tf handle
+ *
+ * [in/out] parms
+ *   pointer to parms structure
+ *
+ * Returns
+ *   - (0) if successful.
+ *   - (-EINVAL) on failure.
+ */
+static int tf_dev_p4_get_shared_tbl_increment(struct tf *tfp __rte_unused,
+				struct tf_get_shared_tbl_increment_parms *parms)
+{
+	parms->increment_cnt = 1;
+	return 0;
+}
 static int tf_dev_p4_get_mailbox(void)
 {
 	return TF_KONG_MB;
@@ -224,12 +244,16 @@ const struct tf_dev_ops tf_dev_ops_p4_init = {
 	.tf_dev_set_ext_tbl = NULL,
 	.tf_dev_get_tbl = NULL,
 	.tf_dev_get_bulk_tbl = NULL,
+	.tf_dev_get_shared_tbl_increment = tf_dev_p4_get_shared_tbl_increment,
 	.tf_dev_get_tbl_resc_info = NULL,
 	.tf_dev_alloc_tcam = NULL,
 	.tf_dev_free_tcam = NULL,
 	.tf_dev_alloc_search_tcam = NULL,
 	.tf_dev_set_tcam = NULL,
 	.tf_dev_get_tcam = NULL,
+#ifdef TF_TCAM_SHARED
+	.tf_dev_move_tcam = NULL,
+#endif /* TF_TCAM_SHARED */
 	.tf_dev_get_tcam_resc_info = NULL,
 	.tf_dev_insert_int_em_entry = NULL,
 	.tf_dev_delete_int_em_entry = NULL,
@@ -269,6 +293,7 @@ const struct tf_dev_ops tf_dev_ops_p4 = {
 	.tf_dev_set_ext_tbl = tf_tbl_ext_common_set,
 	.tf_dev_get_tbl = tf_tbl_get,
 	.tf_dev_get_bulk_tbl = tf_tbl_bulk_get,
+	.tf_dev_get_shared_tbl_increment = tf_dev_p4_get_shared_tbl_increment,
 	.tf_dev_get_tbl_resc_info = tf_tbl_get_resc_info,
 #ifdef TF_TCAM_SHARED
 	.tf_dev_alloc_tcam = tf_tcam_shared_alloc,
drivers/net/bnxt/tf_core/tf_device_p58.c +44 -0

62 lines not on this page · raw message

drivers/net/bnxt/tf_core/tf_tcam_shared.c +17 -5
index 0e8cb78f8d..f0727cea80 100644
@@ -858,6 +858,10 @@ union tf_tmp_key {
 	uint8_t bytes[(TF_TMP_MAX_KEY_BITLEN + 7) / 8];
 };
 
+/** p58 has an enable bit, p4 does not
+ */
+#define TF_TCAM_SHARED_ENTRY_ENABLE 0x8
+
 /** Move a WC TCAM entry from the high offset to the same low offset
  */
 static int
@@ -869,7 +873,8 @@ tf_tcam_shared_move_entry(struct tf *tfp,
 			  int dphy_idx,
 			  int key_sz_bytes,
 			  int remap_sz_bytes,
-			  uint16_t num_slices)
+			  uint16_t num_slices,
+			  bool set_enable_bit)
 {
 	int rc = 0;
 	struct tf_tcam_get_parms gparms;
@@ -911,6 +916,9 @@ tf_tcam_shared_move_entry(struct tf *tfp,
 		return rc;
 	}
 
+	if (set_enable_bit)
+		tcam_key_obj.bytes[0] |= TF_TCAM_SHARED_ENTRY_ENABLE;
+
 	/* Override HI/LO type with parent WC TCAM type */
 	sparms.hcapi_type = hcapi_type;
 	sparms.dir = dir;
@@ -960,7 +968,8 @@ static
 int tf_tcam_shared_move(struct tf *tfp,
 			struct tf_move_tcam_shared_entries_parms *parms,
 			int key_sz_bytes,
-			int remap_sz_bytes)
+			int remap_sz_bytes,
+			bool set_enable_bit)
 {
 	int rc;
 	struct tf_session *tfs;
@@ -1084,7 +1093,8 @@ int tf_tcam_shared_move(struct tf *tfp,
 							       lo_start + log_idx,
 							       key_sz_bytes,
 							       remap_sz_bytes,
-							       num_slices);
+							       num_slices,
+							       set_enable_bit);
 				if (rc) {
 					TFP_DRV_LOG(ERR,
 						    "Cannot allocate %s index %d\n",
@@ -1125,7 +1135,8 @@ int tf_tcam_shared_move_p4(struct tf *tfp,
 	rc = tf_tcam_shared_move(tfp,
 				 parms,
 				 TF_TCAM_SHARED_KEY_SLICE_SZ_BYTES_P4,
-				 TF_TCAM_SHARED_REMAP_SZ_BYTES_P4);
+				 TF_TCAM_SHARED_REMAP_SZ_BYTES_P4,
+				 false); /* no enable bit */
 	return rc;
 }
 
@@ -1139,6 +1150,7 @@ int tf_tcam_shared_move_p58(struct tf *tfp,
 	rc = tf_tcam_shared_move(tfp,
 				 parms,
 				 TF_TCAM_SHARED_KEY_SLICE_SZ_BYTES_P58,
-				 TF_TCAM_SHARED_REMAP_SZ_BYTES_P58);
+				 TF_TCAM_SHARED_REMAP_SZ_BYTES_P58,
+				 true); /* set enable bit */
 	return rc;
 }
Signature · 1 line
2.17.1
#22 lore raw

PATCH 22/58 net/bnxt: modify host session failure cleanup

In reply to Venkat Duvvuru

From: Jay Ding <[email protected]>

- Close fw session if session open fails after fw session open.
- Additional WC TCAM debug info to help in future debug
- Reduce key/mask buffer sizes for performance
- When a 64b counter is freed, clear the entry

---
 drivers/net/bnxt/tf_core/tf_em_internal.c | 15 +++---
 drivers/net/bnxt/tf_core/tf_identifier.c  | 14 ++++--
 drivers/net/bnxt/tf_core/tf_msg.c         | 24 ++-------
 drivers/net/bnxt/tf_core/tf_msg.h         |  9 +++-
 drivers/net/bnxt/tf_core/tf_rm.c          | 59 +++--------------------
 drivers/net/bnxt/tf_core/tf_session.c     | 32 ++++++++++--
 drivers/net/bnxt/tf_core/tf_tbl.c         | 51 ++++++++++++++++++--
 drivers/net/bnxt/tf_core/tf_tcam.c        | 14 ++++--
 drivers/net/bnxt/tf_core/tf_tcam_shared.c | 41 ++++++++--------
 9 files changed, 138 insertions(+), 121 deletions(-)
drivers/net/bnxt/tf_core/tf_em_internal.c +9 -6
index 28ffbd5876..0720bb905d 100644
@@ -543,18 +543,21 @@ tf_em_get_resc_info(struct tf *tfp,
 	TF_CHECK_PARMS2(tfp, em);
 
 	rc = tf_session_get_db(tfp, TF_MODULE_TYPE_EM, &em_db_ptr);
-	if (rc) {
-		TFP_DRV_LOG(INFO,
-			    "No resource allocated for em from session\n");
-		return 0;
-	}
+	if (rc == -ENOMEM)
+		return 0;  /* db does not exist */
+	else if (rc)
+		return rc; /* db error */
+
 	em_db = (struct em_rm_db *)em_db_ptr;
 
-	/* check if reserved resource for WC is multiple of num_slices */
+	/* check if reserved resource for EM is multiple of num_slices */
 	for (d = 0; d < TF_DIR_MAX; d++) {
 		ainfo.rm_db = em_db->em_db[d];
 		dinfo = em[d].info;
 
+		if (!ainfo.rm_db)
+			continue;
+
 		ainfo.info = (struct tf_rm_alloc_info *)dinfo;
 		ainfo.subtype = 0;
 		rc = tf_rm_get_all_info(&ainfo, TF_EM_TBL_TYPE_MAX);
drivers/net/bnxt/tf_core/tf_identifier.c +9 -5
index 9f27a41fcf..c491f77a2b 100644
@@ -369,16 +369,20 @@ tf_ident_get_resc_info(struct tf *tfp,
 	TF_CHECK_PARMS2(tfp, ident);
 
 	rc = tf_session_get_db(tfp, TF_MODULE_TYPE_IDENTIFIER, &ident_db_ptr);
-	if (rc) {
-		TFP_DRV_LOG(INFO,
-			    "No resource allocated for ident from session\n");
-		return 0;
-	}
+	if (rc == -ENOMEM)
+		return 0; /* db doesn't exist */
+	else if (rc)
+		return rc; /* error getting db */
+
 	ident_db = (struct ident_rm_db *)ident_db_ptr;
 
 	/* check if reserved resource for WC is multiple of num_slices */
 	for (d = 0; d < TF_DIR_MAX; d++) {
 		ainfo.rm_db = ident_db->ident_db[d];
+
+		if (!ainfo.rm_db)
+			continue;
+
 		dinfo = ident[d].info;
 
 		ainfo.info = (struct tf_rm_alloc_info *)dinfo;
drivers/net/bnxt/tf_core/tf_msg.c +3 -21
index 18eea8338a..fbd4b1d910 100644
@@ -267,31 +267,13 @@ tf_msg_session_client_unregister(struct tf *tfp,
 
 int
 tf_msg_session_close(struct tf *tfp,
-		     struct tf_session *tfs)
+		     uint8_t fw_session_id,
+		     int mailbox)
 {
 	int rc;
 	struct hwrm_tf_session_close_input req = { 0 };
 	struct hwrm_tf_session_close_output resp = { 0 };
 	struct tfp_send_msg_parms parms = { 0 };
-	uint8_t fw_session_id;
-	struct tf_dev_info *dev;
-
-	/* Retrieve the device information */
-	rc = tf_session_get_device(tfs, &dev);
-	if (rc) {
-		TFP_DRV_LOG(ERR,
-			    "Failed to lookup device, rc:%s\n",
-			    strerror(-rc));
-		return rc;
-	}
-
-	rc = tf_session_get_fw_session_id(tfp, &fw_session_id);
-	if (rc) {
-		TFP_DRV_LOG(ERR,
-			    "Unable to lookup FW id, rc:%s\n",
-			    strerror(-rc));
-		return rc;
-	}
 
 	/* Populate the request */
 	req.fw_session_id = tfp_cpu_to_le_32(fw_session_id);
@@ -301,7 +283,7 @@ tf_msg_session_close(struct tf *tfp,
 	parms.req_size = sizeof(req);
 	parms.resp_data = (uint32_t *)&resp;
 	parms.resp_size = sizeof(resp);
-	parms.mailbox = dev->ops->tf_dev_get_mailbox();
+	parms.mailbox = mailbox;
 
 	rc = tfp_send_msg_direct(tf_session_get_bp(tfp),
 				 &parms);
drivers/net/bnxt/tf_core/tf_msg.h +8 -1
index e8662fef0e..b26b15bfa3 100644
@@ -115,11 +115,18 @@ int tf_msg_session_client_unregister(struct tf *tfp,
  * [in] session
  *   Pointer to session handle
  *
+ * [in] fw_session_id
+ *   fw session id
+ *
+ * [in] mailbox
+ *   mailbox
+ *
  * Returns:
  *   0 on Success else internal Truflow error
  */
 int tf_msg_session_close(struct tf *tfp,
-			 struct tf_session *tfs);
+			 uint8_t fw_session_id,
+			 int mailbox);
 
 /**
  * Sends session query config request to TF Firmware
drivers/net/bnxt/tf_core/tf_rm.c +7 -52

89 lines not on this page · raw message

drivers/net/bnxt/tf_core/tf_session.c +27 -5
index 70844edb50..71ccb2e3e7 100644
@@ -215,6 +215,16 @@ tf_session_create(struct tf *tfp,
 	return 0;
 
  cleanup:
+	rc = tf_msg_session_close(tfp,
+			fw_session_id,
+			dev.ops->tf_dev_get_mailbox());
+	if (rc) {
+		/* Log error */
+		TFP_DRV_LOG(ERR,
+			    "FW Session close failed, rc:%s\n",
+			    strerror(-rc));
+	}
+
 	tfp_free(tfp->session->core_data);
 	tfp_free(tfp->session);
 	tfp->session = NULL;
@@ -479,6 +489,8 @@ tf_session_close_session(struct tf *tfp,
 	struct tf_dev_info *tfd = NULL;
 	struct tf_session_client_destroy_parms scdparms;
 	uint16_t fid;
+	uint8_t fw_session_id = 1;
+	int mailbox = 0;
 
 	TF_CHECK_PARMS2(tfp, parms);
 
@@ -563,6 +575,16 @@ tf_session_close_session(struct tf *tfp,
 		return rc;
 	}
 
+	mailbox = tfd->ops->tf_dev_get_mailbox();
+
+	rc = tf_session_get_fw_session_id(tfp, &fw_session_id);
+	if (rc) {
+		TFP_DRV_LOG(ERR,
+			    "Unable to lookup FW id, rc:%s\n",
+			    strerror(-rc));
+		return rc;
+	}
+
 	/* Unbind the device */
 	rc = tf_dev_unbind(tfp, tfd);
 	if (rc) {
@@ -572,7 +594,7 @@ tf_session_close_session(struct tf *tfp,
 			    strerror(-rc));
 	}
 
-	rc = tf_msg_session_close(tfp, tfs);
+	rc = tf_msg_session_close(tfp, fw_session_id, mailbox);
 	if (rc) {
 		/* Log error */
 		TFP_DRV_LOG(ERR,
@@ -881,26 +903,26 @@ tf_session_get_db(struct tf *tfp,
 		if (tfs->id_db_handle)
 			*db_handle = tfs->id_db_handle;
 		else
-			rc = -EINVAL;
+			rc = -ENOMEM;
 		break;
 	case TF_MODULE_TYPE_TABLE:
 		if (tfs->tbl_db_handle)
 			*db_handle = tfs->tbl_db_handle;
 		else
-			rc = -EINVAL;
+			rc = -ENOMEM;
 
 		break;
 	case TF_MODULE_TYPE_TCAM:
 		if (tfs->tcam_db_handle)
 			*db_handle = tfs->tcam_db_handle;
 		else
-			rc = -EINVAL;
+			rc = -ENOMEM;
 		break;
 	case TF_MODULE_TYPE_EM:
 		if (tfs->em_db_handle)
 			*db_handle = tfs->em_db_handle;
 		else
-			rc = -EINVAL;
+			rc = -ENOMEM;
 		break;
 	default:
 		rc = -EINVAL;
drivers/net/bnxt/tf_core/tf_tbl.c +46 -5

69 lines not on this page · raw message

drivers/net/bnxt/tf_core/tf_tcam.c +9 -5
index d7e12e00ef..45206c5992 100644
@@ -818,16 +818,20 @@ tf_tcam_get_resc_info(struct tf *tfp,
 	TF_CHECK_PARMS2(tfp, tcam);
 
 	rc = tf_session_get_db(tfp, TF_MODULE_TYPE_TCAM, &tcam_db_ptr);
-	if (rc) {
-		TFP_DRV_LOG(INFO,
-			    "No resource allocated for tcam from session\n");
-		return 0;
-	}
+	if (rc == -ENOMEM)
+		return 0;  /* db doesn't exist */
+	else if (rc)
+		return rc; /* error getting db */
+
 	tcam_db = (struct tcam_rm_db *)tcam_db_ptr;
 
 	/* check if reserved resource for WC is multiple of num_slices */
 	for (d = 0; d < TF_DIR_MAX; d++) {
 		ainfo.rm_db = tcam_db->tcam_db[d];
+
+		if (!ainfo.rm_db)
+			continue;
+
 		dinfo = tcam[d].info;
 
 		ainfo.info = (struct tf_rm_alloc_info *)dinfo;
drivers/net/bnxt/tf_core/tf_tcam_shared.c +20 -21

82 lines not on this page · raw message

Signature · 1 line
2.17.1
#23 lore raw

PATCH 23/58 net/bnxt: cleanup of WC TCAM shared unbind

In reply to Venkat Duvvuru

From: Farah Smith <[email protected]>

- clean up all allocated hi or lo pool tcam regions on close
- message cleanup
- remove unsupported multi-slice
- find next free entry should start from 0 first time
- update reserved resources so cli open session can come up

---
 drivers/net/bnxt/tf_core/tf_tcam_shared.c | 333 ++++++++++++----------
 1 file changed, 179 insertions(+), 154 deletions(-)
drivers/net/bnxt/tf_core/tf_tcam_shared.c +179 -154
index 5139b28537..b96d9ca9dd 100644
@@ -19,8 +19,6 @@
 #include "tf_core.h"
 #include "tf_rm.h"
 
-struct tf;
-
 /** Shared WC TCAM pool identifiers
  */
 enum tf_tcam_shared_wc_pool_id {
@@ -288,6 +286,12 @@ tf_tcam_shared_bind(struct tf *tfp,
 		if (rc)
 			return rc;
 
+		if (num_slices > 1) {
+			TFP_DRV_LOG(ERR,
+				    "Only single slice supported\n");
+			return -EOPNOTSUPP;
+		}
+
 		tf_tcam_shared_create_db(&tcam_shared_wc);
 
 
@@ -338,49 +342,135 @@ int
 tf_tcam_shared_unbind(struct tf *tfp)
 {
 	int rc, dir;
+	struct tf_dev_info *dev;
 	struct tf_session *tfs;
 	void *tcam_shared_db_ptr = NULL;
 	struct tf_tcam_shared_wc_pools *tcam_shared_wc;
+	enum tf_tcam_shared_wc_pool_id pool_id;
+	struct tf_tcam_free_parms parms;
+	struct bitalloc *pool;
+	uint16_t start;
+	int log_idx, phy_idx;
+	uint16_t hcapi_type;
+	struct tf_rm_alloc_info info;
+	int i, pool_cnt;
 
 	TF_CHECK_PARMS1(tfp);
 
-	/* Perform normal unbind, this will write all the
-	 * allocated TCAM entries in the shared session.
-	 */
-	rc = tf_tcam_unbind(tfp);
-	if (rc)
-		return rc;
-
 	/* Retrieve the session information */
 	rc = tf_session_get_session_internal(tfp, &tfs);
 	if (rc)
 		return rc;
 
-	rc = tf_session_get_tcam_shared_db(tfp, (void *)&tcam_shared_db_ptr);
+	/* If not the shared session, call the normal
+	 * tcam unbind and exit
+	 */
+	if (!tf_session_is_shared_session(tfs)) {
+		rc = tf_tcam_unbind(tfp);
+		return rc;
+	}
+
+	/* We must be a shared session, get the database
+	 */
+	rc = tf_session_get_tcam_shared_db(tfp,
+					   (void *)&tcam_shared_db_ptr);
 	if (rc) {
 		TFP_DRV_LOG(ERR,
-			    "Failed to get tcam_shared_db from session, rc:%s\n",
+			    "Failed to get tcam_shared_db, rc:%s\n",
 			    strerror(-rc));
 		return rc;
 	}
-	tcam_shared_wc = (struct tf_tcam_shared_wc_pools *)tcam_shared_db_ptr;
 
-	/* If we are the shared session
+	tcam_shared_wc =
+		(struct tf_tcam_shared_wc_pools *)tcam_shared_db_ptr;
+
+
+	/* Get the device
 	 */
-	if (tf_session_is_shared_session(tfs)) {
-		/* If there are WC TCAM entries allocated, free them
+	rc = tf_session_get_device(tfs, &dev);
+	if (rc)
+		return rc;
+
+
+	/* If there are WC TCAM entries allocated, free them
+	 */
+	for (dir = 0; dir < TF_DIR_MAX; dir++) {
+		/* If the database is invalid, skip
 		 */
-		for (dir = 0; dir < TF_DIR_MAX; dir++) {
-			tf_tcam_shared_free_wc_pool(dir,
-						    TF_TCAM_SHARED_WC_POOL_HI,
-						    tcam_shared_wc);
+		if (!tf_tcam_db_valid(tfp, dir))
+			continue;
+
+		rc = tf_tcam_shared_get_rm_info(tfp,
+						dir,
+						&hcapi_type,
+						&info);
+		if (rc) {
+			TFP_DRV_LOG(ERR,
+				    "%s: TCAM shared rm info get failed\n",
+				    tf_dir_2_str(dir));
+			return rc;
+		}
+
+		for (pool_id = TF_TCAM_SHARED_WC_POOL_HI;
+		     pool_id < TF_TCAM_SHARED_WC_POOL_MAX;
+		     pool_id++) {
+			pool = tcam_shared_wc->db[dir][pool_id].pool;
+			start = tcam_shared_wc->db[dir][pool_id].info.start;
+			pool_cnt = ba_inuse_count(pool);
+
+			if (pool_cnt) {
+				TFP_DRV_LOG(INFO,
+					    "%s: %s: %d residuals found, freeing\n",
+					    tf_dir_2_str(dir),
+					    tf_pool_2_str(pool_id),
+					    pool_cnt);
+			}
+
+			log_idx = 0;
+
+			for (i = 0; i < pool_cnt; i++) {
+				log_idx = ba_find_next_inuse(pool, log_idx);
+
+				if (log_idx < 0) {
+					TFP_DRV_LOG(ERR,
+						    "Expected a found %s entry %d\n",
+						    tf_pool_2_str(pool_id),
+						    i);
+					/* attempt normal unbind
+					 */
+					goto done;
+				}
+				phy_idx = start + log_idx;
+
+				parms.type = TF_TCAM_TBL_TYPE_WC_TCAM;
+				parms.hcapi_type = hcapi_type;
+				parms.idx = phy_idx;
+				parms.dir = dir;
+				rc = tf_msg_tcam_entry_free(tfp, dev, &parms);
+				if (rc) {
+					/* Log error */
+					TFP_DRV_LOG(ERR,
+						    "%s: %s: %d free failed, rc:%s\n",
+						    tf_dir_2_str(parms.dir),
+						    tf_tcam_tbl_2_str(parms.type),
+						    phy_idx,
+						    strerror(-rc));
+					return rc;
+				}
+			}
+			/* Free the pool once all the entries
+			 * have been cleared
+			 */
 			tf_tcam_shared_free_wc_pool(dir,
-						    TF_TCAM_SHARED_WC_POOL_LO,
+						    pool_id,
 						    tcam_shared_wc);
 		}
 	}
-	return 0;
+done:
+	rc = tf_tcam_unbind(tfp);
+	return rc;
 }
+
 /**
  * tf_tcam_shared_alloc
  */
@@ -388,13 +478,12 @@ int
 tf_tcam_shared_alloc(struct tf *tfp,
 		     struct tf_tcam_alloc_parms *parms)
 {
-	int rc, i;
+	int rc;
 	struct tf_session *tfs;
 	struct tf_dev_info *dev;
 	int log_idx;
 	struct bitalloc *pool;
 	enum tf_tcam_shared_wc_pool_id id;
-	uint16_t num_slices;
 	struct tf_tcam_shared_wc_pools *tcam_shared_wc;
 	void *tcam_shared_db_ptr = NULL;
 
@@ -444,32 +533,24 @@ tf_tcam_shared_alloc(struct tf *tfp,
 	if (rc)
 		return rc;
 
-	rc = tf_tcam_shared_get_slices(tfp, dev, &num_slices);
-	if (rc)
-		return rc;
-
 	pool = tcam_shared_wc->db[parms->dir][id].pool;
 
-	for (i = 0; i < num_slices; i++) {
-		/*
-		 * priority  0: allocate from top of the tcam i.e. high
-		 * priority !0: allocate index from bottom i.e lowest
-		 */
-		if (parms->priority)
-			log_idx = ba_alloc_reverse(pool);
-		else
-			log_idx = ba_alloc(pool);
-		if (log_idx == BA_FAIL) {
-			TFP_DRV_LOG(ERR,
-				    "%s: Allocation failed, rc:%s\n",
-				    tf_dir_2_str(parms->dir),
-				    strerror(ENOMEM));
-			return -ENOMEM;
-		}
-		/* return the index without the start of each row */
-		if (i == 0)
-			parms->idx = log_idx;
+	/*
+	 * priority  0: allocate from top of the tcam i.e. high
+	 * priority !0: allocate index from bottom i.e lowest
+	 */
+	if (parms->priority)
+		log_idx = ba_alloc_reverse(pool);
+	else
+		log_idx = ba_alloc(pool);
+	if (log_idx == BA_FAIL) {
+		TFP_DRV_LOG(ERR,
+			    "%s: Allocation failed, rc:%s\n",
+			    tf_dir_2_str(parms->dir),
+			    strerror(ENOMEM));
+		return -ENOMEM;
 	}
+	parms->idx = log_idx;
 	return 0;
 }
 
@@ -481,13 +562,11 @@ tf_tcam_shared_free(struct tf *tfp,
 	struct tf_session *tfs;
 	struct tf_dev_info *dev;
 	int allocated = 0;
-	int i;
 	uint16_t start;
 	int phy_idx;
 	struct bitalloc *pool;
 	enum tf_tcam_shared_wc_pool_id id;
 	struct tf_tcam_free_parms nparms;
-	uint16_t num_slices;
 	uint16_t hcapi_type;
 	struct tf_rm_alloc_info info;
 	void *tcam_shared_db_ptr = NULL;
@@ -540,10 +619,6 @@ tf_tcam_shared_free(struct tf *tfp,
 	if (rc)
 		return rc;
 
-	rc = tf_tcam_shared_get_slices(tfp, dev, &num_slices);
-	if (rc)
-		return rc;
-
 	rc = tf_tcam_shared_get_rm_info(tfp,
 					parms->dir,
 					&hcapi_type,
@@ -558,13 +633,6 @@ tf_tcam_shared_free(struct tf *tfp,
 	pool = tcam_shared_wc->db[parms->dir][id].pool;
 	start = tcam_shared_wc->db[parms->dir][id].info.start;
 
-	if (parms->idx % num_slices) {
-		TFP_DRV_LOG(ERR,
-			    "%s: TCAM reserved resource is not multiple of %d\n",
-			    tf_dir_2_str(parms->dir), num_slices);
-		return -EINVAL;
-	}
-
 	phy_idx = parms->idx + start;
 	allocated = ba_inuse(pool, parms->idx);
 
@@ -575,16 +643,14 @@ tf_tcam_shared_free(struct tf *tfp,
 		return -EINVAL;
 	}
 
-	for (i = 0; i < num_slices; i++) {
-		rc = ba_free(pool, parms->idx + i);
-		if (rc) {
-			TFP_DRV_LOG(ERR,
-				    "%s: Free failed, type:%s, idx:%d\n",
-				    tf_dir_2_str(parms->dir),
-				    tf_tcam_tbl_2_str(parms->type),
-				    parms->idx);
-			return rc;
-		}
+	rc = ba_free(pool, parms->idx);
+	if (rc) {
+		TFP_DRV_LOG(ERR,
+			    "%s: Free failed, type:%s, idx:%d\n",
+			    tf_dir_2_str(parms->dir),
+			    tf_tcam_tbl_2_str(parms->type),
+			    parms->idx);
+		return rc;
 	}
 
 	/* Override HI/LO type with parent WC TCAM type */
@@ -616,7 +682,6 @@ tf_tcam_shared_set(struct tf *tfp __rte_unused,
 	struct tf_dev_info *dev;
 	int allocated = 0;
 	int phy_idx, log_idx;
-	uint16_t num_slices;
 	struct tf_tcam_set_parms nparms;
 	struct bitalloc *pool;
 	uint16_t start;
@@ -685,16 +750,7 @@ tf_tcam_shared_set(struct tf *tfp __rte_unused,
 			    tf_dir_2_str(parms->dir), parms->type, log_idx);
 		return -EINVAL;
 	}
-	rc = tf_tcam_shared_get_slices(tfp, dev, &num_slices);
-	if (rc)
-		return rc;
 
-	if (parms->idx % num_slices) {
-		TFP_DRV_LOG(ERR,
-			    "%s: TCAM reserved resource is not multiple of %d\n",
-			    tf_dir_2_str(parms->dir), num_slices);
-		return -EINVAL;
-	}
 	rc = tf_tcam_shared_get_rm_info(tfp,
 					parms->dir,
 					&hcapi_type,
@@ -736,7 +792,6 @@ tf_tcam_shared_get(struct tf *tfp __rte_unused,
 	struct tf_dev_info *dev;
 	int allocated = 0;
 	int phy_idx, log_idx;
-	uint16_t num_slices;
 	struct tf_tcam_get_parms nparms;
 	struct bitalloc *pool;
 	uint16_t start;
@@ -794,16 +849,6 @@ tf_tcam_shared_get(struct tf *tfp __rte_unused,
 	pool = tcam_shared_wc->db[parms->dir][id].pool;
 	start = tcam_shared_wc->db[parms->dir][id].info.start;
 
-	rc = tf_tcam_shared_get_slices(tfp, dev, &num_slices);
-	if (rc)
-		return rc;
-
-	if (parms->idx % num_slices) {
-		TFP_DRV_LOG(ERR,
-			    "%s: TCAM reserved resource is not multiple of %d\n",
-			    tf_dir_2_str(parms->dir), num_slices);
-		return -EINVAL;
-	}
 	log_idx = parms->idx;
 	phy_idx = parms->idx + start;
 	allocated = ba_inuse(pool, parms->idx);
@@ -881,7 +926,6 @@ tf_tcam_shared_move_entry(struct tf *tfp,
 			  int dphy_idx,
 			  int key_sz_bytes,
 			  int remap_sz_bytes,
-			  uint16_t num_slices,
 			  bool set_enable_bit)
 {
 	int rc = 0;
@@ -897,12 +941,6 @@ tf_tcam_shared_move_entry(struct tf *tfp,
 	memset(&tcam_remap_obj, 0, sizeof(tcam_remap_obj));
 	memset(&gparms, 0, sizeof(gparms));
 
-	if (num_slices > 1) {
-		TFP_DRV_LOG(ERR,
-			    "Only single slice supported");
-		return -EOPNOTSUPP;
-	}
-
 	gparms.hcapi_type = hcapi_type;
 	gparms.dir = dir;
 	gparms.type = TF_TCAM_TBL_TYPE_WC_TCAM;
@@ -917,7 +955,8 @@ tf_tcam_shared_move_entry(struct tf *tfp,
 	if (rc) {
 		/* Log error */
 		TFP_DRV_LOG(ERR,
-			    "%s: WC_TCAM_HIGH: phyid(%d) get failed, rc:%s",
+			    "%s: %s: phyid(%d) get failed, rc:%s\n",
+			    tf_tcam_tbl_2_str(gparms.type),
 			    tf_dir_2_str(dir),
 			    gparms.idx,
 			    strerror(-rc));
@@ -942,7 +981,8 @@ tf_tcam_shared_move_entry(struct tf *tfp,
 	if (rc) {
 		/* Log error */
 		TFP_DRV_LOG(ERR,
-			    "%s: WC_TCAM_LOW phyid(%d/0x%x) set failed, rc:%s",
+			    "%s: %s phyid(%d/0x%x) set failed, rc:%s\n",
+			    tf_tcam_tbl_2_str(sparms.type),
 			    tf_dir_2_str(dir),
 			    sparms.idx,
 			    sparms.idx,
@@ -985,13 +1025,12 @@ int tf_tcam_shared_move(struct tf *tfp,
 	struct tf_session *tfs;
 	struct tf_dev_info *dev;
 	int log_idx;
-	uint16_t num_slices;
 	struct bitalloc *hi_pool, *lo_pool;
 	uint16_t hi_start, lo_start;
 	enum tf_tcam_shared_wc_pool_id hi_id, lo_id;
 	uint16_t hcapi_type;
 	struct tf_rm_alloc_info info;
-	int hi_cnt, i, j;
+	int hi_cnt, i;
 	struct tf_tcam_shared_wc_pools *tcam_shared_wc;
 	void *tcam_shared_db_ptr = NULL;
 
@@ -1027,9 +1066,6 @@ int tf_tcam_shared_move(struct tf *tfp,
 		/* TODO print amazing error */
 		return rc;
 	}
-	rc = tf_tcam_shared_get_slices(tfp, dev, &num_slices);
-	if (rc)
-		return rc;
 
 	rc = tf_tcam_shared_get_rm_info(tfp,
 					parms->dir,
@@ -1068,62 +1104,51 @@ int tf_tcam_shared_move(struct tf *tfp,
 
 	/* Copy each valid entry to the same low pool logical offset
 	 */
+	log_idx = 0;
+
 	for (i = 0; i < hi_cnt; i++) {
-		/* Go through all the slices
+		/* Find next free index starting from where we left off
 		 */
-		for (j = 0; j < num_slices; j++) {
-			/* Find next free starting from where we left off
-			 */
-			log_idx = ba_find_next_inuse(hi_pool, i);
+		log_idx = ba_find_next_inuse(hi_pool, log_idx);
+		if (log_idx < 0) {
+			TFP_DRV_LOG(ERR,
+				    "Expected a found %s entry %d\n",
+				    tf_pool_2_str(hi_id),
+				    i);
+			goto done;
+		}
+		/* The user should have never allocated from the low
+		 * pool because the move only happens when switching
+		 * from the high to the low pool
+		 */
+		if (ba_alloc_index(lo_pool, log_idx) < 0) {
+			TFP_DRV_LOG(ERR,
+				    "Warning %s index %d already allocated\n",
+				    tf_pool_2_str(lo_id),
+				    i);
 
-			if (log_idx < 0) {
-				TFP_DRV_LOG(ERR,
-					    "Expected a found %s entry %d\n",
-					    tf_pool_2_str(hi_id),
-					    i);
-				goto done;
-			}
-			/* The user should have never allocated from the low
-			 * pool because the move only happens when switching
-			 * from the high to the low pool
+			/* Since already allocated, continue with move
 			 */
-			if (ba_alloc_index(lo_pool, log_idx) < 0) {
-				TFP_DRV_LOG(ERR,
-					    "Cannot allocate %s index %d\n",
-					    tf_pool_2_str(lo_id),
-					    i);
-				goto done;
-			}
+		}
 
-			if (j == 0) {
-				rc = tf_tcam_shared_move_entry(tfp, dev,
-							       hcapi_type,
-							       parms->dir,
-							       hi_start + log_idx,
-							       lo_start + log_idx,
-							       key_sz_bytes,
-							       remap_sz_bytes,
-							       num_slices,
-							       set_enable_bit);
-				if (rc) {
-					TFP_DRV_LOG(ERR,
-						    "Cannot allocate %s index %d\n",
-						    tf_pool_2_str(hi_id),
-						    i);
-					goto done;
-				}
-				ba_free(hi_pool, log_idx);
-				TFP_DRV_LOG(DEBUG,
-					    "%s: TCAM shared move pool(%s) phyid(%d)\n",
-					    tf_dir_2_str(parms->dir),
-					    tf_pool_2_str(hi_id),
-					    hi_start + log_idx);
-				TFP_DRV_LOG(DEBUG,
-					    "to pool(%s) phyid(%d)\n",
-					    tf_pool_2_str(lo_id),
-					    lo_start + log_idx);
-			}
+		rc = tf_tcam_shared_move_entry(tfp, dev,
+					       hcapi_type,
+					       parms->dir,
+					       hi_start + log_idx,
+					       lo_start + log_idx,
+					       key_sz_bytes,
+					       remap_sz_bytes,
+					       set_enable_bit);
+		if (rc) {
+			TFP_DRV_LOG(ERR,
+				    "%s: Move error %s to %s index %d\n",
+				    tf_dir_2_str(parms->dir),
+				    tf_pool_2_str(hi_id),
+				    tf_pool_2_str(lo_id),
+				    i);
+			goto done;
 		}
+		ba_free(hi_pool, log_idx);
 	}
 done:
 	return rc;
Signature · 1 line
2.17.1
#24 lore raw

PATCH 24/58 net/bnxt: add support for WC TCAM shared session

In reply to Venkat Duvvuru

From: Jay Ding <[email protected]>

If the session shares WC TCAM entries with others, specify it in the session name by attach "-wc_tcam". Firmware will flush the shared WC TCAM entries if the last shared session using them is closed.

---
 drivers/net/bnxt/tf_core/tf_msg.c     | 46 +++++++++++++++++++++++----
 drivers/net/bnxt/tf_core/tf_session.c |  5 +++
 2 files changed, 44 insertions(+), 7 deletions(-)
drivers/net/bnxt/tf_core/tf_msg.c +39 -7
index fbd4b1d910..6717710dbd 100644
@@ -58,6 +58,16 @@ static_assert(sizeof(struct hwrm_tf_tbl_type_set_input) ==
  */
 #define TF_PCI_BUF_SIZE_MAX 88
 
+/**
+ * This is the length of shared session name "tf_share"
+ */
+#define TF_SHARED_SESSION_NAME_LEN 8
+
+/**
+ * This is the length of tcam shared session name "tf_shared-wc_tcam"
+ */
+#define TF_TCAM_SHARED_SESSION_NAME_LEN 17
+
 /**
  * If data bigger than TF_PCI_BUF_SIZE_MAX then use DMA method
  */
@@ -126,13 +136,17 @@ tf_msg_session_open(struct bnxt *bp,
 	struct hwrm_tf_session_open_output resp = { 0 };
 	struct tfp_send_msg_parms parms = { 0 };
 	int name_len;
-	char *name;
+	char *session_name;
+	char *tcam_session_name;
 
 	/* Populate the request */
 	name_len = strnlen(ctrl_chan_name, TF_SESSION_NAME_MAX);
-	name = &ctrl_chan_name[name_len - strlen("tf_shared")];
-	if (!strncmp(name, "tf_shared", strlen("tf_shared")))
-		tfp_memcpy(&req.session_name, name, strlen("tf_share"));
+	session_name = &ctrl_chan_name[name_len - strlen("tf_shared")];
+	tcam_session_name = &ctrl_chan_name[name_len - strlen("tf_shared-wc_tcam")];
+	if (!strncmp(tcam_session_name, "tf_shared-wc_tcam", strlen("tf_shared-wc_tcam")))
+		tfp_memcpy(&req.session_name, tcam_session_name, TF_TCAM_SHARED_SESSION_NAME_LEN);
+	else if (!strncmp(session_name, "tf_shared", strlen("tf_shared")))
+		tfp_memcpy(&req.session_name, session_name, TF_SHARED_SESSION_NAME_LEN);
 	else
 		tfp_memcpy(&req.session_name, ctrl_chan_name, TF_SESSION_NAME_MAX);
 
@@ -177,6 +191,9 @@ tf_msg_session_client_register(struct tf *tfp,
 	struct tfp_send_msg_parms parms = { 0 };
 	uint8_t fw_session_id;
 	struct tf_dev_info *dev;
+	int name_len;
+	char *session_name;
+	char *tcam_session_name;
 
 	/* Retrieve the device information */
 	rc = tf_session_get_device(tfs, &dev);
@@ -197,9 +214,24 @@ tf_msg_session_client_register(struct tf *tfp,
 
 	/* Populate the request */
 	req.fw_session_id = tfp_cpu_to_le_32(fw_session_id);
-	tfp_memcpy(&req.session_client_name,
-		   ctrl_channel_name,
-		   TF_SESSION_NAME_MAX);
+	name_len = strnlen(ctrl_channel_name, TF_SESSION_NAME_MAX);
+	session_name = &ctrl_channel_name[name_len - strlen("tf_shared")];
+	tcam_session_name = &ctrl_channel_name[name_len -
+		strlen("tf_shared-wc_tcam")];
+	if (!strncmp(tcam_session_name,
+				"tf_shared-wc_tcam",
+				strlen("tf_shared-wc_tcam")))
+		tfp_memcpy(&req.session_client_name,
+				tcam_session_name,
+				TF_TCAM_SHARED_SESSION_NAME_LEN);
+	else if (!strncmp(session_name, "tf_shared", strlen("tf_shared")))
+		tfp_memcpy(&req.session_client_name,
+				session_name,
+				TF_SHARED_SESSION_NAME_LEN);
+	else
+		tfp_memcpy(&req.session_client_name,
+				ctrl_channel_name,
+				TF_SESSION_NAME_MAX);
 
 	parms.tf_type = HWRM_TF_SESSION_REGISTER;
 	parms.req_data = (uint32_t *)&req;
drivers/net/bnxt/tf_core/tf_session.c +5 -0
index 71ccb2e3e7..90b65c59e6 100644
@@ -188,6 +188,11 @@ tf_session_create(struct tf *tfp,
 	if (!strncmp(name, "tf_shared", strlen("tf_shared")))
 		session->shared_session = true;
 
+	name = &parms->open_cfg->ctrl_chan_name[name_len -
+		strlen("tf_shared-wc_tcam")];
+	if (!strncmp(name, "tf_shared-wc_tcam", strlen("tf_shared-wc_tcam")))
+		session->shared_session = true;
+
 	if (session->shared_session && shared_session_creator) {
 		session->shared_session_creator = true;
 		parms->open_cfg->shared_session_creator = true;
Signature · 1 line
2.17.1
#25 lore raw

PATCH 25/58 net/bnxt: add API to clear hi/lo WC region

In reply to Venkat Duvvuru

From: Farah Smith <[email protected]>

Provide TRUFLOW API to clear either the hi or the low region for ungraceful exit cleanup.

---
 drivers/net/bnxt/tf_core/tf_core.c        |  51 ++++++++++
 drivers/net/bnxt/tf_core/tf_core.h        |  39 +++++++-
 drivers/net/bnxt/tf_core/tf_device.h      |  19 +++-
 drivers/net/bnxt/tf_core/tf_device_p4.c   |   4 +-
 drivers/net/bnxt/tf_core/tf_device_p58.c  |   1 +
 drivers/net/bnxt/tf_core/tf_tcam_shared.c | 111 +++++++++++++++++++++-
 drivers/net/bnxt/tf_core/tf_tcam_shared.h |  21 ++++
 drivers/net/bnxt/tf_core/tf_util.h        |   1 -
 8 files changed, 235 insertions(+), 12 deletions(-)
drivers/net/bnxt/tf_core/tf_core.c +51 -0
index 0fbbd40252..97e6165e92 100644
@@ -968,6 +968,57 @@ tf_move_tcam_shared_entries(struct tf *tfp,
 
 	return 0;
 }
+
+int
+tf_clear_tcam_shared_entries(struct tf *tfp,
+			     struct tf_clear_tcam_shared_entries_parms *parms)
+{
+	int rc;
+	struct tf_session *tfs;
+	struct tf_dev_info *dev;
+
+	TF_CHECK_PARMS2(tfp, parms);
+
+	/* Retrieve the session information */
+	rc = tf_session_get_session(tfp, &tfs);
+	if (rc) {
+		TFP_DRV_LOG(ERR,
+			    "%s: Failed to lookup session, rc:%s\n",
+			    tf_dir_2_str(parms->dir),
+			    strerror(-rc));
+		return rc;
+	}
+
+	/* Retrieve the device information */
+	rc = tf_session_get_device(tfs, &dev);
+	if (rc) {
+		TFP_DRV_LOG(ERR,
+			    "%s: Failed to lookup device, rc:%s\n",
+			    tf_dir_2_str(parms->dir),
+			    strerror(-rc));
+		return rc;
+	}
+
+	if (dev->ops->tf_dev_clear_tcam == NULL) {
+		rc = -EOPNOTSUPP;
+		TFP_DRV_LOG(ERR,
+			    "%s: Operation not supported, rc:%s\n",
+			    tf_dir_2_str(parms->dir),
+			    strerror(-rc));
+		return rc;
+	}
+
+	rc = dev->ops->tf_dev_clear_tcam(tfp, parms);
+	if (rc) {
+		TFP_DRV_LOG(ERR,
+			    "%s: TCAM shared entries clear failed, rc:%s\n",
+			    tf_dir_2_str(parms->dir),
+			    strerror(-rc));
+		return rc;
+	}
+
+	return 0;
+}
 #endif /* TF_TCAM_SHARED */
 
 int
drivers/net/bnxt/tf_core/tf_core.h +36 -3
index 44c30fa904..0b06bb2bb5 100644
@@ -233,7 +233,7 @@ enum tf_identifier_type {
 	 */
 	TF_IDENT_TYPE_EM_PROF,
 	/**
-	 *  TH
+	 *  (Future)
 	 *  The L2 func is included in the ILT result and from recycling to
 	 *  enable virtualization of further lookups.
 	 */
@@ -1244,6 +1244,8 @@ int tf_free_tbl_scope(struct tf *tfp,
  *
 #ifdef TF_TCAM_SHARED
  * @ref tf_move_tcam_shared_entries
+ *
+ * @ref tf_clear_tcam_shared_entries
 #endif
  */
 
@@ -1580,6 +1582,37 @@ struct tf_move_tcam_shared_entries_parms {
 int tf_move_tcam_shared_entries(struct tf *tfp,
 				struct tf_move_tcam_shared_entries_parms *parms);
 
+/**
+ * tf_clear_tcam_shared_entries parameter definition
+ */
+struct tf_clear_tcam_shared_entries_parms {
+	/**
+	 * [in] receive or transmit direction
+	 */
+	enum tf_dir dir;
+	/**
+	 * [in] TCAM table type
+	 */
+	enum tf_tcam_tbl_type tcam_tbl_type;
+};
+
+/**
+ * Clear TCAM shared entries pool
+ *
+ * This API only affects the following TCAM pools within a shared session:
+ *
+ * TF_TCAM_TBL_TYPE_WC_TCAM_HIGH
+ * TF_TCAM_TBL_TYPE_WC_TCAM_LOW
+ *
+ * When called, the indicated WC TCAM high or low pool will be cleared.
+ *
+ * This API is not supported on a non-shared session.
+ *
+ * Returns success or failure code.
+ */
+int tf_clear_tcam_shared_entries(struct tf *tfp,
+			      struct tf_clear_tcam_shared_entries_parms *parms);
+
 #endif /* TF_TCAM_SHARED */
 /**
  * @page table Table Access
@@ -2108,7 +2141,7 @@ struct tf_move_em_entry_parms {
 	uint64_t flow_handle;
 };
 /**
- * tf_search_em_entry parameter definition
+ * tf_search_em_entry parameter definition (Future)
  */
 struct tf_search_em_entry_parms {
 	/**
@@ -2211,7 +2244,7 @@ int tf_delete_em_entry(struct tf *tfp,
 		       struct tf_delete_em_entry_parms *parms);
 
 /**
- * search em hash entry table memory
+ * search em hash entry table memory (Future)
  *
  * Internal:
 
drivers/net/bnxt/tf_core/tf_device.h +18 -1
index 1893f630e7..da3f541685 100644
@@ -595,7 +595,24 @@ struct tf_dev_ops {
 	 *    -EINVAL - Error
 	 */
 	int (*tf_dev_move_tcam)(struct tf *tfp,
-				struct tf_move_tcam_shared_entries_parms *parms);
+			       struct tf_move_tcam_shared_entries_parms *parms);
+
+	/**
+	 * Move TCAM shared entries
+	 *
+	 * [in] tfp
+	 *   Pointer to TF handle
+	 *
+	 * [in] parms
+	 *   Pointer to parameters
+	 *
+	 *    returns:
+	 *    0       - Success
+	 *    -EINVAL - Error
+	 */
+	int (*tf_dev_clear_tcam)(struct tf *tfp,
+			      struct tf_clear_tcam_shared_entries_parms *parms);
+
 #endif /* TF_TCAM_SHARED */
 
 	/**
drivers/net/bnxt/tf_core/tf_device_p4.c +1 -3
index 28a6e41906..c340098cde 100644
@@ -251,9 +251,6 @@ const struct tf_dev_ops tf_dev_ops_p4_init = {
 	.tf_dev_alloc_search_tcam = NULL,
 	.tf_dev_set_tcam = NULL,
 	.tf_dev_get_tcam = NULL,
-#ifdef TF_TCAM_SHARED
-	.tf_dev_move_tcam = NULL,
-#endif /* TF_TCAM_SHARED */
 	.tf_dev_get_tcam_resc_info = NULL,
 	.tf_dev_insert_int_em_entry = NULL,
 	.tf_dev_delete_int_em_entry = NULL,
@@ -301,6 +298,7 @@ const struct tf_dev_ops tf_dev_ops_p4 = {
 	.tf_dev_set_tcam = tf_tcam_shared_set,
 	.tf_dev_get_tcam = tf_tcam_shared_get,
 	.tf_dev_move_tcam = tf_tcam_shared_move_p4,
+	.tf_dev_clear_tcam = tf_tcam_shared_clear,
 #else /* !TF_TCAM_SHARED */
 	.tf_dev_alloc_tcam = tf_tcam_alloc,
 	.tf_dev_free_tcam = tf_tcam_free,
drivers/net/bnxt/tf_core/tf_device_p58.c +1 -0
index bd6813beef..77a884f645 100644
@@ -342,6 +342,7 @@ const struct tf_dev_ops tf_dev_ops_p58 = {
 	.tf_dev_set_tcam = tf_tcam_shared_set,
 	.tf_dev_get_tcam = tf_tcam_shared_get,
 	.tf_dev_move_tcam = tf_tcam_shared_move_p58,
+	.tf_dev_clear_tcam = tf_tcam_shared_clear,
 #else /* !TF_TCAM_SHARED */
 	.tf_dev_alloc_tcam = tf_tcam_alloc,
 	.tf_dev_free_tcam = tf_tcam_free,
drivers/net/bnxt/tf_core/tf_tcam_shared.c +107 -4

126 lines not on this page · raw message

drivers/net/bnxt/tf_core/tf_tcam_shared.h +21 -0
index 5588125470..020763af6b 100644
@@ -24,6 +24,11 @@
  *
  * @ref tf_tcam_shared_get
  *
+ * @ref tf_tcam_shared_move_p4
+ *
+ * @ref tf_tcam_shared_move_p58
+ *
+ * @ref tf_tcam_shared_clear
  */
 
 /**
@@ -159,4 +164,20 @@ int tf_tcam_shared_move_p4(struct tf *tfp,
 int tf_tcam_shared_move_p58(struct tf *tfp,
 			    struct tf_move_tcam_shared_entries_parms *parms);
 
+/**
+ * Allocates and clears the entire WC_TCAM_HI or WC_TCAM_LO shared pools
+ *
+ * [in] tfp
+ *   Pointer to the truflow handle
+ *
+ * [in] parms
+ *   Pointer to parameters
+ *
+ * Returns
+ *   - (0) if successful.
+ *   - (-EINVAL) on failure.
+ */
+int tf_tcam_shared_clear(struct tf *tfp,
+			 struct tf_clear_tcam_shared_entries_parms *parms);
+
 #endif /* _TF_TCAM_SHARED_H */
drivers/net/bnxt/tf_core/tf_util.h +0 -1
index 4caf50349d..854c51931a 100644
@@ -7,7 +7,6 @@
 #define _TF_UTIL_H_
 
 #include "tf_core.h"
-#include "tf_device.h"
 
 #define TF_BITS2BYTES(x) (((x) + 7) >> 3)
 #define TF_BITS2BYTES_WORD_ALIGN(x) ((((x) + 31) >> 5) * 4)
Signature · 1 line
2.17.1
#26 lore raw

PATCH 26/58 net/bnxt: check FW capability to support TRUFLOW

In reply to Venkat Duvvuru

Currently, a devarg (host-based-truflow) is passed while launching the app to enable truflow feature. However, this mechanism doesn't give a seamless experience when flow offloads has to work with firmware that doesn't/does support truflow feature. Also, it's likely that customers may not want to use devarg to enable flow offloads.

This patch fixes it by checking for truflow feature support in device's capabilities and configurations field of the hwrm_ver_get's response.

---
 doc/guides/nics/bnxt.rst       |  3 +-
 drivers/net/bnxt/bnxt.h        | 10 +++---
 drivers/net/bnxt/bnxt_ethdev.c | 56 ----------------------------------
 drivers/net/bnxt/bnxt_hwrm.c   |  7 ++++-
 4 files changed, 12 insertions(+), 64 deletions(-)
doc/guides/nics/bnxt.rst +1 -2
index 0fb2032447..fef8a7fac9 100644
@@ -658,8 +658,7 @@ which currently supports basic packet classification in the receive path.
 The feature uses a newly implemented control-plane firmware interface which
 optimizes flow insertions and deletions.
 
-This is a tech preview feature, and is disabled by default. It can be enabled
-using bnxt devargs. For ex: "-a 0000:0d:00.0,host-based-truflow=1”.
+This is a tech preview feature.
 
 This feature is currently supported on Whitney+ and Stingray devices.
 
drivers/net/bnxt/bnxt.h +5 -5
index db67bff127..882f577848 100644
@@ -645,10 +645,9 @@ struct bnxt {
 #define BNXT_FLAG_RX_VECTOR_PKT_MODE		BIT(24)
 #define BNXT_FLAG_FLOW_XSTATS_EN		BIT(25)
 #define BNXT_FLAG_DFLT_MAC_SET			BIT(26)
-#define BNXT_FLAG_TRUFLOW_EN			BIT(27)
-#define BNXT_FLAG_GFID_ENABLE			BIT(28)
-#define BNXT_FLAG_RFS_NEEDS_VNIC		BIT(29)
-#define BNXT_FLAG_FLOW_CFA_RFS_RING_TBL_IDX_V2	BIT(30)
+#define BNXT_FLAG_GFID_ENABLE			BIT(27)
+#define BNXT_FLAG_RFS_NEEDS_VNIC		BIT(28)
+#define BNXT_FLAG_FLOW_CFA_RFS_RING_TBL_IDX_V2	BIT(29)
 #define BNXT_RFS_NEEDS_VNIC(bp)	((bp)->flags & BNXT_FLAG_RFS_NEEDS_VNIC)
 #define BNXT_PF(bp)		(!((bp)->flags & BNXT_FLAG_VF))
 #define BNXT_VF(bp)		((bp)->flags & BNXT_FLAG_VF)
@@ -664,7 +663,6 @@ struct bnxt {
 #define BNXT_HAS_RING_GRPS(bp)	(!BNXT_CHIP_P5(bp))
 #define BNXT_FLOW_XSTATS_EN(bp)	((bp)->flags & BNXT_FLAG_FLOW_XSTATS_EN)
 #define BNXT_HAS_DFLT_MAC_SET(bp)      ((bp)->flags & BNXT_FLAG_DFLT_MAC_SET)
-#define BNXT_TRUFLOW_EN(bp)	((bp)->flags & BNXT_FLAG_TRUFLOW_EN)
 #define BNXT_GFID_ENABLED(bp)	((bp)->flags & BNXT_FLAG_GFID_ENABLE)
 
 	uint32_t			flags2;
@@ -686,6 +684,8 @@ struct bnxt {
 #define BNXT_FW_CAP_ADV_FLOW_MGMT	BIT(5)
 #define BNXT_FW_CAP_ADV_FLOW_COUNTERS	BIT(6)
 #define BNXT_FW_CAP_LINK_ADMIN		BIT(7)
+#define BNXT_FW_CAP_TRUFLOW_EN		BIT(8)
+#define BNXT_TRUFLOW_EN(bp)	((bp)->fw_cap & BNXT_FW_CAP_TRUFLOW_EN)
 
 	pthread_mutex_t         flow_lock;
 
drivers/net/bnxt/bnxt_ethdev.c +0 -56

86 lines not on this page · raw message

drivers/net/bnxt/bnxt_hwrm.c +6 -1
index 931ecea77c..4505321778 100644
@@ -1345,6 +1345,12 @@ int bnxt_hwrm_ver_get(struct bnxt *bp, uint32_t timeout)
 		bp->fw_cap |= BNXT_FW_CAP_ADV_FLOW_COUNTERS;
 	}
 
+	if (dev_caps_cfg &
+	    HWRM_VER_GET_OUTPUT_DEV_CAPS_CFG_CFA_TRUFLOW_SUPPORTED) {
+		PMD_DRV_LOG(DEBUG, "Host-based truflow feature enabled.\n");
+		bp->fw_cap |= BNXT_FW_CAP_TRUFLOW_EN;
+	}
+
 error:
 	HWRM_UNLOCK();
 	return rc;
@@ -4561,7 +4567,6 @@ int bnxt_hwrm_erase_nvram_directory(struct bnxt *bp, uint8_t index)
 	return rc;
 }
 
-
 int bnxt_hwrm_flash_nvram(struct bnxt *bp, uint16_t dir_type,
 			  uint16_t dir_ordinal, uint16_t dir_ext,
 			  uint16_t dir_attr, const uint8_t *data,
Signature · 1 line
2.17.1
#27 lore raw

PATCH 27/58 net/bnxt: add support for generic table processing

In reply to Venkat Duvvuru

From: Kishore Padmanabha <[email protected]>

Added support for generic table processing, this feature shall enable support for shared resource like mirror and tcam cache tables.

---
 drivers/net/bnxt/tf_ulp/meson.build           |    1 +
 drivers/net/bnxt/tf_ulp/ulp_gen_tbl.c         |  311 ++
 drivers/net/bnxt/tf_ulp/ulp_gen_tbl.h         |  142 +
 drivers/net/bnxt/tf_ulp/ulp_mapper.c          |  643 ++-
 drivers/net/bnxt/tf_ulp/ulp_mapper.h          |   15 +-
 .../net/bnxt/tf_ulp/ulp_template_db_enum.h    |   65 +-
 .../tf_ulp/ulp_template_db_stingray_class.c   | 3509 +++++++++++++++-
 drivers/net/bnxt/tf_ulp/ulp_template_db_tbl.c |   43 +-
 .../tf_ulp/ulp_template_db_wh_plus_class.c    | 3511 ++++++++++++++++-
 drivers/net/bnxt/tf_ulp/ulp_template_struct.h |   14 +
 drivers/net/bnxt/tf_ulp/ulp_utils.c           |  112 +-
 drivers/net/bnxt/tf_ulp/ulp_utils.h           |   68 +
 12 files changed, 7670 insertions(+), 764 deletions(-)
 create mode 100644 drivers/net/bnxt/tf_ulp/ulp_gen_tbl.c
 create mode 100644 drivers/net/bnxt/tf_ulp/ulp_gen_tbl.h
drivers/net/bnxt/tf_ulp/meson.build +1 -0
index 98cbdf3177..611d7ab58e 100644
@@ -22,6 +22,7 @@ sources += files(
         'ulp_def_rules.c',
         'ulp_fc_mgr.c',
         'ulp_tun.c',
+        'ulp_gen_tbl.c',
         'ulp_template_db_wh_plus_act.c',
         'ulp_template_db_wh_plus_class.c',
         'ulp_template_db_stingray_act.c',
drivers/net/bnxt/tf_ulp/ulp_gen_tbl.c new file +311 -0

311 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_gen_tbl.h new file +142 -0

142 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_mapper.c +267 -376

893 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_mapper.h +3 -12
index 4ce19cc88d..8422f44026 100644
@@ -14,6 +14,7 @@
 #include "ulp_template_struct.h"
 #include "bnxt_ulp.h"
 #include "ulp_utils.h"
+#include "ulp_gen_tbl.h"
 
 #define ULP_IDENTS_INVALID ((uint16_t)0xffff)
 
@@ -31,13 +32,6 @@ enum bnxt_ulp_cache_table_opc {
 	BNXT_ULP_MAPPER_TCAM_TBL_OPC_CACHE_ALLOC
 };
 
-struct bnxt_ulp_mapper_cache_entry {
-	uint32_t ref_count;
-	uint16_t tcam_idx;
-	uint16_t idents[BNXT_ULP_CACHE_TBL_IDENT_MAX_NUM];
-	uint8_t ident_types[BNXT_ULP_CACHE_TBL_IDENT_MAX_NUM];
-};
-
 struct bnxt_ulp_mapper_glb_resource_entry {
 	enum bnxt_ulp_resource_func	resource_func;
 	uint32_t			resource_type; /* TF_ enum type */
@@ -47,8 +41,7 @@ struct bnxt_ulp_mapper_glb_resource_entry {
 struct bnxt_ulp_mapper_data {
 	struct bnxt_ulp_mapper_glb_resource_entry
 		glb_res_tbl[TF_DIR_MAX][BNXT_ULP_GLB_RESOURCE_TBL_MAX_SZ];
-	struct bnxt_ulp_mapper_cache_entry
-		*cache_tbl[BNXT_ULP_CACHE_TBL_MAX_SZ];
+	struct ulp_mapper_gen_tbl_list gen_tbl_list[BNXT_ULP_GEN_TBL_MAX_SZ];
 };
 
 /* Internal Structure for passing the arguments around */
@@ -69,13 +62,11 @@ struct bnxt_ulp_mapper_parms {
 	struct ulp_regfile			*regfile;
 	struct tf				*tfp;
 	struct bnxt_ulp_context			*ulp_ctx;
-	uint8_t					encap_byte_swap;
 	uint32_t				fid;
 	enum bnxt_ulp_fdb_type			flow_type;
 	struct bnxt_ulp_mapper_data		*mapper_data;
 	enum bnxt_ulp_cache_table_opc		tcam_tbl_opc;
-	struct bnxt_ulp_mapper_cache_entry	*cache_ptr;
-	struct bnxt_ulp_device_params           *device_params;
+	struct bnxt_ulp_device_params		*device_params;
 	uint32_t				parent_fid;
 	uint32_t				parent_flow;
 	uint8_t					tun_idx;
drivers/net/bnxt/tf_ulp/ulp_template_db_enum.h +43 -22

95 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_template_db_stingray_class.c +3341 -168

1,509 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_template_db_tbl.c +38 -5

43 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_template_db_wh_plus_class.c +3342 -169

3,511 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_template_struct.h +14 -0
index a539ec0c84..67308f1cf1 100644

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

drivers/net/bnxt/tf_ulp/ulp_utils.c +100 -12

112 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_utils.h +68 -0

68 lines not on this page · raw message

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

Signature · 1 line
2.17.1

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

#28 lore raw

PATCH 28/58 net/bnxt: add support for mapper flow database opcodes

In reply to Venkat Duvvuru

From: Kishore Padmanabha <[email protected]>

Added support for mapper flow database opcode to enable shared resources like mirror action. This allows mapper to conditionally populate flow database based on template content.

---
 drivers/net/bnxt/tf_ulp/ulp_mapper.c          | 119 ++++++++++++------
 .../net/bnxt/tf_ulp/ulp_template_db_enum.h    |   8 ++
 drivers/net/bnxt/tf_ulp/ulp_template_struct.h |   4 +
 3 files changed, 95 insertions(+), 36 deletions(-)
drivers/net/bnxt/tf_ulp/ulp_mapper.c +83 -36
index 2bb8d08699..4e9211a7ab 100644
@@ -469,6 +469,80 @@ ulp_mapper_child_flow_free(struct bnxt_ulp_context *ulp,
 	return 0;
 }
 
+/*
+ * Process the flow database opcode action.
+ * returns 0 on success.
+ */
+static int32_t
+ulp_mapper_fdb_opc_process(struct bnxt_ulp_mapper_parms *parms,
+			   struct bnxt_ulp_mapper_tbl_info *tbl,
+			   struct ulp_flow_db_res_params *fid_parms)
+{
+	uint32_t push_fid, fid = 0;
+	uint64_t val64;
+	int32_t rc = 0;
+
+	switch (tbl->fdb_opcode) {
+	case BNXT_ULP_FDB_OPC_PUSH:
+		push_fid = parms->fid;
+		break;
+	case BNXT_ULP_FDB_OPC_ALLOC_PUSH_REGFILE:
+		/* allocate a new fid */
+		rc = ulp_flow_db_fid_alloc(parms->ulp_ctx,
+					   BNXT_ULP_FDB_TYPE_REGULAR,
+					   tbl->resource_func, &fid);
+		if (rc) {
+			BNXT_TF_DBG(ERR,
+				    "Unable to allocate flow table entry\n");
+			return rc;
+		}
+		/* Store the allocated fid in regfile*/
+		val64 = fid;
+		rc = ulp_regfile_write(parms->regfile, tbl->flow_db_operand,
+				       val64);
+		if (!rc) {
+			BNXT_TF_DBG(ERR, "Write regfile[%d] failed\n",
+				    tbl->flow_db_operand);
+			rc = -EINVAL;
+			goto error;
+		}
+		/* Use the allocated fid to update the flow resource */
+		push_fid = fid;
+		break;
+	case BNXT_ULP_FDB_OPC_PUSH_REGFILE:
+		/* get the fid from the regfile */
+		rc = ulp_regfile_read(parms->regfile, tbl->flow_db_operand,
+				      &val64);
+		if (!rc) {
+			BNXT_TF_DBG(ERR, "regfile[%d] read oob\n",
+				    tbl->flow_db_operand);
+			return -EINVAL;
+		}
+		/* Use the extracted fid to update the flow resource */
+		push_fid = (uint32_t)val64;
+		break;
+	default:
+		return rc; /* Nothing to be done */
+	}
+
+	/* Add the resource to the flow database */
+	rc = ulp_flow_db_resource_add(parms->ulp_ctx, parms->flow_type,
+				      push_fid, fid_parms);
+	if (rc) {
+		BNXT_TF_DBG(ERR, "Failed to add res to flow %x rc = %d\n",
+			    push_fid, rc);
+		goto error;
+	}
+	return rc;
+
+error:
+	/* free the allocated fid */
+	if (fid)
+		ulp_flow_db_fid_free(parms->ulp_ctx,
+				     BNXT_ULP_FDB_TYPE_REGULAR, fid);
+	return rc;
+}
+
 /*
  * Process the identifier instruction and either store it in the flow database
  * or return it in the val (if not NULL) on success.  If val is NULL, the
@@ -524,10 +598,7 @@ ulp_mapper_ident_process(struct bnxt_ulp_mapper_parms *parms,
 		fid_parms.resource_hndl	= iparms.id;
 		fid_parms.critical_resource = BNXT_ULP_CRITICAL_RESOURCE_NO;
 
-		rc = ulp_flow_db_resource_add(parms->ulp_ctx,
-					      parms->flow_type,
-					      parms->fid,
-					      &fid_parms);
+		rc = ulp_mapper_fdb_opc_process(parms, tbl, &fid_parms);
 		if (rc) {
 			BNXT_TF_DBG(ERR, "Failed to link res to flow rc = %d\n",
 				    rc);
@@ -618,10 +689,7 @@ ulp_mapper_ident_extract(struct bnxt_ulp_mapper_parms *parms,
 	fid_parms.resource_type = ident->ident_type;
 	fid_parms.resource_hndl = sparms.search_id;
 	fid_parms.critical_resource = BNXT_ULP_CRITICAL_RESOURCE_NO;
-	rc = ulp_flow_db_resource_add(parms->ulp_ctx,
-				      parms->flow_type,
-				      parms->fid,
-				      &fid_parms);
+	rc = ulp_mapper_fdb_opc_process(parms, tbl, &fid_parms);
 	if (rc) {
 		BNXT_TF_DBG(ERR, "Failed to link res to flow rc = %d\n",
 			    rc);
@@ -1103,10 +1171,7 @@ ulp_mapper_mark_gfid_process(struct bnxt_ulp_mapper_parms *parms,
 	fid_parms.critical_resource = BNXT_ULP_CRITICAL_RESOURCE_NO;
 	fid_parms.resource_type	= mark_flag;
 	fid_parms.resource_hndl	= gfid;
-	rc = ulp_flow_db_resource_add(parms->ulp_ctx,
-				      parms->flow_type,
-				      parms->fid,
-				      &fid_parms);
+	rc = ulp_mapper_fdb_opc_process(parms, tbl, &fid_parms);
 	if (rc)
 		BNXT_TF_DBG(ERR, "Fail to link res to flow rc = %d\n", rc);
 	return rc;
@@ -1152,10 +1217,7 @@ ulp_mapper_mark_act_ptr_process(struct bnxt_ulp_mapper_parms *parms,
 	fid_parms.critical_resource = BNXT_ULP_CRITICAL_RESOURCE_NO;
 	fid_parms.resource_type	= mark_flag;
 	fid_parms.resource_hndl	= act_idx;
-	rc = ulp_flow_db_resource_add(parms->ulp_ctx,
-				      parms->flow_type,
-				      parms->fid,
-				      &fid_parms);
+	rc = ulp_mapper_fdb_opc_process(parms, tbl, &fid_parms);
 	if (rc)
 		BNXT_TF_DBG(ERR, "Fail to link res to flow rc = %d\n", rc);
 	return rc;
@@ -1201,10 +1263,7 @@ ulp_mapper_mark_vfr_idx_process(struct bnxt_ulp_mapper_parms *parms,
 	fid_parms.critical_resource = BNXT_ULP_CRITICAL_RESOURCE_NO;
 	fid_parms.resource_type	= mark_flag;
 	fid_parms.resource_hndl	= act_idx;
-	rc = ulp_flow_db_resource_add(parms->ulp_ctx,
-				      parms->flow_type,
-				      parms->fid,
-				      &fid_parms);
+	rc = ulp_mapper_fdb_opc_process(parms, tbl, &fid_parms);
 	if (rc)
 		BNXT_TF_DBG(ERR, "Fail to link res to flow rc = %d\n", rc);
 	return rc;
@@ -1580,10 +1639,7 @@ ulp_mapper_tcam_tbl_process(struct bnxt_ulp_mapper_parms *parms,
 		fid_parms.resource_type	= tbl->resource_type;
 		fid_parms.critical_resource = tbl->critical_resource;
 		fid_parms.resource_hndl	= idx;
-		rc = ulp_flow_db_resource_add(parms->ulp_ctx,
-					      parms->flow_type,
-					      parms->fid,
-					      &fid_parms);
+		rc = ulp_mapper_fdb_opc_process(parms, tbl, &fid_parms);
 		if (rc) {
 			BNXT_TF_DBG(ERR,
 				    "Failed to link resource to flow rc = %d\n",
@@ -1741,10 +1797,7 @@ ulp_mapper_em_tbl_process(struct bnxt_ulp_mapper_parms *parms,
 	fid_parms.critical_resource	= tbl->critical_resource;
 	fid_parms.resource_hndl		= iparms.flow_handle;
 
-	rc = ulp_flow_db_resource_add(parms->ulp_ctx,
-				      parms->flow_type,
-				      parms->fid,
-				      &fid_parms);
+	rc = ulp_mapper_fdb_opc_process(parms, tbl, &fid_parms);
 	if (rc) {
 		BNXT_TF_DBG(ERR, "Fail to link res to flow rc = %d\n",
 			    rc);
@@ -1968,10 +2021,7 @@ ulp_mapper_index_tbl_process(struct bnxt_ulp_mapper_parms *parms,
 	fid_parms.resource_hndl	= index;
 	fid_parms.critical_resource = BNXT_ULP_CRITICAL_RESOURCE_NO;
 
-	rc = ulp_flow_db_resource_add(parms->ulp_ctx,
-				      parms->flow_type,
-				      parms->fid,
-				      &fid_parms);
+	rc = ulp_mapper_fdb_opc_process(parms, tbl, &fid_parms);
 	if (rc) {
 		BNXT_TF_DBG(ERR, "Failed to link resource to flow rc = %d\n",
 			    rc);
@@ -2280,10 +2330,7 @@ ulp_mapper_gen_tbl_process(struct bnxt_ulp_mapper_parms *parms,
 		fid_parms.resource_sub_type = tbl->resource_sub_type;
 		fid_parms.resource_hndl	= ckey;
 		fid_parms.critical_resource = tbl->critical_resource;
-		rc = ulp_flow_db_resource_add(parms->ulp_ctx,
-					      parms->flow_type,
-					      parms->fid,
-					      &fid_parms);
+		rc = ulp_mapper_fdb_opc_process(parms, tbl, &fid_parms);
 		if (rc)
 			BNXT_TF_DBG(ERR, "Fail to add gen ent flowdb %d\n", rc);
 	}
drivers/net/bnxt/tf_ulp/ulp_template_db_enum.h +8 -0
index 2a9a290eea..f16651a821 100644
@@ -179,6 +179,14 @@ enum bnxt_ulp_direction {
 	BNXT_ULP_DIRECTION_LAST = 2
 };
 
+enum bnxt_ulp_fdb_opc {
+	BNXT_ULP_FDB_OPC_PUSH = 0,
+	BNXT_ULP_FDB_OPC_ALLOC_PUSH_REGFILE = 1,
+	BNXT_ULP_FDB_OPC_PUSH_REGFILE = 2,
+	BNXT_ULP_FDB_OPC_NOP = 3,
+	BNXT_ULP_FDB_OPC_LAST = 4
+};
+
 enum bnxt_ulp_flow_mem_type {
 	BNXT_ULP_FLOW_MEM_TYPE_INT = 0,
 	BNXT_ULP_FLOW_MEM_TYPE_EXT = 1,
drivers/net/bnxt/tf_ulp/ulp_template_struct.h +4 -0
index 67308f1cf1..167116a2f4 100644
@@ -220,6 +220,10 @@ struct bnxt_ulp_mapper_tbl_info {
 
 	/* Table opcode for table operations */
 	uint32_t			tbl_opcode;
+
+	/* FDB table opcode */
+	enum bnxt_ulp_fdb_opc		fdb_opcode;
+	uint32_t			flow_db_operand;
 };
 
 struct bnxt_ulp_mapper_key_field_info {
Signature · 1 line
2.17.1
#29 lore raw

PATCH 29/58 net/bnxt: add conditional execution and rejection

In reply to Venkat Duvvuru

From: Mike Baucom <[email protected]>

Conditional execution and rejection processing added for templates and tables. This allows the mapper to skip tables and reject templates based on the content without having to hard code rules.

---
 drivers/net/bnxt/tf_ulp/bnxt_ulp_flow.c       |   1 +
 drivers/net/bnxt/tf_ulp/ulp_mapper.c          | 330 ++++++++++++++----
 drivers/net/bnxt/tf_ulp/ulp_mapper.h          |   2 +
 .../net/bnxt/tf_ulp/ulp_template_db_enum.h    |  30 +-
 .../tf_ulp/ulp_template_db_stingray_act.c     |  30 +-
 .../tf_ulp/ulp_template_db_stingray_class.c   |   8 +-
 drivers/net/bnxt/tf_ulp/ulp_template_db_tbl.c | 243 +++++++++++++
 drivers/net/bnxt/tf_ulp/ulp_template_db_tbl.h |   2 +
 .../bnxt/tf_ulp/ulp_template_db_wh_plus_act.c |  30 +-
 .../tf_ulp/ulp_template_db_wh_plus_class.c    |   8 +-
 drivers/net/bnxt/tf_ulp/ulp_template_struct.h |  18 +-
 11 files changed, 593 insertions(+), 109 deletions(-)
drivers/net/bnxt/tf_ulp/bnxt_ulp_flow.c +1 -0
index 777a6badd9..ddf38ed931 100644
@@ -93,6 +93,7 @@ bnxt_ulp_init_mapper_params(struct bnxt_ulp_mapper_create_parms *mapper_cparms,
 	mapper_cparms->flow_id		= params->fid;
 	mapper_cparms->parent_flow	= params->parent_flow;
 	mapper_cparms->parent_fid	= params->parent_fid;
+	mapper_cparms->fld_bitmap	= &params->fld_bitmap;
 }
 
 /* Function to create the rte flow. */
drivers/net/bnxt/tf_ulp/ulp_mapper.c +270 -60

376 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_mapper.h +2 -0
index 8422f44026..8bc6cdbdd5 100644
@@ -58,6 +58,7 @@ struct bnxt_ulp_mapper_parms {
 	struct ulp_rte_act_bitmap		*act_bitmap;
 	struct ulp_rte_hdr_bitmap		*hdr_bitmap;
 	struct ulp_rte_hdr_field		*hdr_field;
+	struct ulp_rte_field_bitmap		*fld_bitmap;
 	uint32_t				*comp_fld;
 	struct ulp_regfile			*regfile;
 	struct tf				*tfp;
@@ -79,6 +80,7 @@ struct bnxt_ulp_mapper_create_parms {
 	uint32_t			*comp_fld;
 	struct ulp_rte_act_bitmap	*act;
 	struct ulp_rte_act_prop		*act_prop;
+	struct ulp_rte_field_bitmap	*fld_bitmap;
 	uint32_t			class_tid;
 	uint32_t			act_tid;
 	uint16_t			func_id;
drivers/net/bnxt/tf_ulp/ulp_template_db_enum.h +21 -9
index f16651a821..e4b8c56472 100644
@@ -27,6 +27,7 @@
 #define BNXT_ULP_CACHE_TBL_IDENT_MAX_NUM 2
 #define BNXT_ULP_GLB_RESOURCE_TBL_MAX_SZ 8
 #define BNXT_ULP_GLB_TEMPLATE_TBL_MAX_SZ 1
+#define BNXT_ULP_GLB_FIELD_TBL_SHIFT 7
 
 enum bnxt_ulp_action_bit {
 	BNXT_ULP_ACTION_BIT_MARK             = 0x0000000000000001,
@@ -143,15 +144,26 @@ enum bnxt_ulp_cf_idx {
 	BNXT_ULP_CF_IDX_LAST = 46
 };
 
-enum bnxt_ulp_cond_opcode {
-	BNXT_ULP_COND_OPCODE_NOP = 0,
-	BNXT_ULP_COND_OPCODE_COMP_FIELD_IS_SET = 1,
-	BNXT_ULP_COND_OPCODE_ACTION_BIT_IS_SET = 2,
-	BNXT_ULP_COND_OPCODE_HDR_BIT_IS_SET = 3,
-	BNXT_ULP_COND_OPCODE_COMP_FIELD_NOT_SET = 4,
-	BNXT_ULP_COND_OPCODE_ACTION_BIT_NOT_SET = 5,
-	BNXT_ULP_COND_OPCODE_HDR_BIT_NOT_SET = 6,
-	BNXT_ULP_COND_OPCODE_LAST = 7
+enum bnxt_ulp_cond_list_opc {
+	BNXT_ULP_COND_LIST_OPC_TRUE = 0,
+	BNXT_ULP_COND_LIST_OPC_FALSE = 1,
+	BNXT_ULP_COND_LIST_OPC_OR = 2,
+	BNXT_ULP_COND_LIST_OPC_AND = 3,
+	BNXT_ULP_COND_LIST_OPC_LAST = 4
+};
+
+enum bnxt_ulp_cond_opc {
+	BNXT_ULP_COND_OPC_COMP_FIELD_IS_SET = 0,
+	BNXT_ULP_COND_OPC_COMP_FIELD_NOT_SET = 1,
+	BNXT_ULP_COND_OPC_ACTION_BIT_IS_SET = 2,
+	BNXT_ULP_COND_OPC_ACTION_BIT_NOT_SET = 3,
+	BNXT_ULP_COND_OPC_HDR_BIT_IS_SET = 4,
+	BNXT_ULP_COND_OPC_HDR_BIT_NOT_SET = 5,
+	BNXT_ULP_COND_OPC_FIELD_BIT_IS_SET = 6,
+	BNXT_ULP_COND_OPC_FIELD_BIT_NOT_SET = 7,
+	BNXT_ULP_COND_OPC_REGFILE_IS_SET = 8,
+	BNXT_ULP_COND_OPC_REGFILE_NOT_SET = 9,
+	BNXT_ULP_COND_OPC_LAST = 10
 };
 
 enum bnxt_ulp_critical_resource {
drivers/net/bnxt/tf_ulp/ulp_template_db_stingray_act.c +15 -15
index b370da22f7..6ad6263183 100644
@@ -47,7 +47,7 @@ struct bnxt_ulp_mapper_tbl_info ulp_stingray_act_tbl_list[] = {
 	.resource_type = TF_TBL_TYPE_ACT_STATS_64,
 	.resource_sub_type =
 		BNXT_ULP_RESOURCE_SUB_TYPE_INDEX_TYPE_INT_COUNT,
-	.cond_opcode = BNXT_ULP_COND_OPCODE_ACTION_BIT_IS_SET,
+	.cond_opcode = BNXT_ULP_COND_OPC_ACTION_BIT_IS_SET,
 	.cond_operand = BNXT_ULP_ACTION_BIT_COUNT,
 	.direction = TF_DIR_RX,
 	.srch_b4_alloc = BNXT_ULP_SEARCH_BEFORE_ALLOC_NO,
@@ -64,7 +64,7 @@ struct bnxt_ulp_mapper_tbl_info ulp_stingray_act_tbl_list[] = {
 	.resource_type = TF_TBL_TYPE_ACT_MODIFY_IPV4,
 	.resource_sub_type =
 		BNXT_ULP_RESOURCE_SUB_TYPE_INDEX_TYPE_NORMAL,
-	.cond_opcode = BNXT_ULP_COND_OPCODE_ACTION_BIT_IS_SET,
+	.cond_opcode = BNXT_ULP_COND_OPC_ACTION_BIT_IS_SET,
 	.cond_operand = BNXT_ULP_ACTION_BIT_SET_IPV4_SRC,
 	.direction = TF_DIR_RX,
 	.srch_b4_alloc = BNXT_ULP_SEARCH_BEFORE_ALLOC_NO,
@@ -81,7 +81,7 @@ struct bnxt_ulp_mapper_tbl_info ulp_stingray_act_tbl_list[] = {
 	.resource_type = TF_TBL_TYPE_ACT_MODIFY_IPV4,
 	.resource_sub_type =
 		BNXT_ULP_RESOURCE_SUB_TYPE_INDEX_TYPE_NORMAL,
-	.cond_opcode = BNXT_ULP_COND_OPCODE_ACTION_BIT_IS_SET,
+	.cond_opcode = BNXT_ULP_COND_OPC_ACTION_BIT_IS_SET,
 	.cond_operand = BNXT_ULP_ACTION_BIT_SET_IPV4_DST,
 	.direction = TF_DIR_RX,
 	.srch_b4_alloc = BNXT_ULP_SEARCH_BEFORE_ALLOC_NO,
@@ -146,7 +146,7 @@ struct bnxt_ulp_mapper_tbl_info ulp_stingray_act_tbl_list[] = {
 	.resource_type = TF_TBL_TYPE_ACT_STATS_64,
 	.resource_sub_type =
 		BNXT_ULP_RESOURCE_SUB_TYPE_INDEX_TYPE_INT_COUNT,
-	.cond_opcode = BNXT_ULP_COND_OPCODE_ACTION_BIT_IS_SET,
+	.cond_opcode = BNXT_ULP_COND_OPC_ACTION_BIT_IS_SET,
 	.cond_operand = BNXT_ULP_ACTION_BIT_COUNT,
 	.direction = TF_DIR_RX,
 	.srch_b4_alloc = BNXT_ULP_SEARCH_BEFORE_ALLOC_NO,
@@ -195,7 +195,7 @@ struct bnxt_ulp_mapper_tbl_info ulp_stingray_act_tbl_list[] = {
 	.resource_type = TF_TBL_TYPE_ACT_STATS_64,
 	.resource_sub_type =
 		BNXT_ULP_RESOURCE_SUB_TYPE_INDEX_TYPE_INT_COUNT,
-	.cond_opcode = BNXT_ULP_COND_OPCODE_ACTION_BIT_IS_SET,
+	.cond_opcode = BNXT_ULP_COND_OPC_ACTION_BIT_IS_SET,
 	.cond_operand = BNXT_ULP_ACTION_BIT_COUNT,
 	.direction = TF_DIR_RX,
 	.srch_b4_alloc = BNXT_ULP_SEARCH_BEFORE_ALLOC_NO,
@@ -244,7 +244,7 @@ struct bnxt_ulp_mapper_tbl_info ulp_stingray_act_tbl_list[] = {
 	.resource_type = TF_TBL_TYPE_ACT_STATS_64,
 	.resource_sub_type =
 		BNXT_ULP_RESOURCE_SUB_TYPE_INDEX_TYPE_INT_COUNT,
-	.cond_opcode = BNXT_ULP_COND_OPCODE_ACTION_BIT_IS_SET,
+	.cond_opcode = BNXT_ULP_COND_OPC_ACTION_BIT_IS_SET,
 	.cond_operand = BNXT_ULP_ACTION_BIT_COUNT,
 	.direction = TF_DIR_TX,
 	.srch_b4_alloc = BNXT_ULP_SEARCH_BEFORE_ALLOC_NO,
@@ -261,7 +261,7 @@ struct bnxt_ulp_mapper_tbl_info ulp_stingray_act_tbl_list[] = {
 	.resource_type = TF_TBL_TYPE_ACT_SP_SMAC_IPV4,
 	.resource_sub_type =
 		BNXT_ULP_RESOURCE_SUB_TYPE_INDEX_TYPE_NORMAL,
-	.cond_opcode = BNXT_ULP_COND_OPCODE_COMP_FIELD_IS_SET,
+	.cond_opcode = BNXT_ULP_COND_OPC_COMP_FIELD_IS_SET,
 	.cond_operand = BNXT_ULP_CF_IDX_ACT_ENCAP_IPV4_FLAG,
 	.direction = TF_DIR_TX,
 	.srch_b4_alloc = BNXT_ULP_SEARCH_BEFORE_ALLOC_SEARCH_IF_HIT_SKIP,
@@ -278,7 +278,7 @@ struct bnxt_ulp_mapper_tbl_info ulp_stingray_act_tbl_list[] = {
 	.resource_type = TF_TBL_TYPE_ACT_SP_SMAC_IPV6,
 	.resource_sub_type =
 		BNXT_ULP_RESOURCE_SUB_TYPE_INDEX_TYPE_NORMAL,
-	.cond_opcode = BNXT_ULP_COND_OPCODE_COMP_FIELD_IS_SET,
+	.cond_opcode = BNXT_ULP_COND_OPC_COMP_FIELD_IS_SET,
 	.cond_operand = BNXT_ULP_CF_IDX_ACT_ENCAP_IPV6_FLAG,
 	.direction = TF_DIR_TX,
 	.srch_b4_alloc = BNXT_ULP_SEARCH_BEFORE_ALLOC_SEARCH_IF_HIT_SKIP,
@@ -342,7 +342,7 @@ struct bnxt_ulp_mapper_tbl_info ulp_stingray_act_tbl_list[] = {
 	.resource_type = TF_TBL_TYPE_ACT_STATS_64,
 	.resource_sub_type =
 		BNXT_ULP_RESOURCE_SUB_TYPE_INDEX_TYPE_INT_COUNT,
-	.cond_opcode = BNXT_ULP_COND_OPCODE_ACTION_BIT_IS_SET,
+	.cond_opcode = BNXT_ULP_COND_OPC_ACTION_BIT_IS_SET,
 	.cond_operand = BNXT_ULP_ACTION_BIT_COUNT,
 	.direction = TF_DIR_TX,
 	.srch_b4_alloc = BNXT_ULP_SEARCH_BEFORE_ALLOC_NO,
@@ -359,7 +359,7 @@ struct bnxt_ulp_mapper_tbl_info ulp_stingray_act_tbl_list[] = {
 	.resource_type = TF_TBL_TYPE_ACT_MODIFY_IPV4,
 	.resource_sub_type =
 		BNXT_ULP_RESOURCE_SUB_TYPE_INDEX_TYPE_NORMAL,
-	.cond_opcode = BNXT_ULP_COND_OPCODE_ACTION_BIT_IS_SET,
+	.cond_opcode = BNXT_ULP_COND_OPC_ACTION_BIT_IS_SET,
 	.cond_operand = BNXT_ULP_ACTION_BIT_SET_IPV4_SRC,
 	.direction = TF_DIR_TX,
 	.srch_b4_alloc = BNXT_ULP_SEARCH_BEFORE_ALLOC_NO,
@@ -376,7 +376,7 @@ struct bnxt_ulp_mapper_tbl_info ulp_stingray_act_tbl_list[] = {
 	.resource_type = TF_TBL_TYPE_ACT_MODIFY_IPV4,
 	.resource_sub_type =
 		BNXT_ULP_RESOURCE_SUB_TYPE_INDEX_TYPE_NORMAL,
-	.cond_opcode = BNXT_ULP_COND_OPCODE_ACTION_BIT_IS_SET,
+	.cond_opcode = BNXT_ULP_COND_OPC_ACTION_BIT_IS_SET,
 	.cond_operand = BNXT_ULP_ACTION_BIT_SET_IPV4_DST,
 	.direction = TF_DIR_TX,
 	.srch_b4_alloc = BNXT_ULP_SEARCH_BEFORE_ALLOC_NO,
@@ -441,7 +441,7 @@ struct bnxt_ulp_mapper_tbl_info ulp_stingray_act_tbl_list[] = {
 	.resource_type = TF_TBL_TYPE_ACT_STATS_64,
 	.resource_sub_type =
 		BNXT_ULP_RESOURCE_SUB_TYPE_INDEX_TYPE_INT_COUNT,
-	.cond_opcode = BNXT_ULP_COND_OPCODE_ACTION_BIT_IS_SET,
+	.cond_opcode = BNXT_ULP_COND_OPC_ACTION_BIT_IS_SET,
 	.cond_operand = BNXT_ULP_ACTION_BIT_COUNT,
 	.direction = TF_DIR_TX,
 	.srch_b4_alloc = BNXT_ULP_SEARCH_BEFORE_ALLOC_NO,
@@ -459,7 +459,7 @@ struct bnxt_ulp_mapper_tbl_info ulp_stingray_act_tbl_list[] = {
 	.resource_sub_type =
 		BNXT_ULP_RESOURCE_SUB_TYPE_INDEX_TYPE_NORMAL,
 	.mem_type_opcode = BNXT_ULP_MEM_TYPE_OPCODE_EXECUTE_IF_INT,
-	.cond_opcode = BNXT_ULP_COND_OPCODE_ACTION_BIT_IS_SET,
+	.cond_opcode = BNXT_ULP_COND_OPC_ACTION_BIT_IS_SET,
 	.cond_operand = BNXT_ULP_ACTION_BIT_PUSH_VLAN,
 	.direction = TF_DIR_TX,
 	.srch_b4_alloc = BNXT_ULP_SEARCH_BEFORE_ALLOC_NO,
@@ -493,7 +493,7 @@ struct bnxt_ulp_mapper_tbl_info ulp_stingray_act_tbl_list[] = {
 	.resource_sub_type =
 		BNXT_ULP_RESOURCE_SUB_TYPE_INDEX_TYPE_NORMAL,
 	.mem_type_opcode = BNXT_ULP_MEM_TYPE_OPCODE_EXECUTE_IF_EXT,
-	.cond_opcode = BNXT_ULP_COND_OPCODE_ACTION_BIT_NOT_SET,
+	.cond_opcode = BNXT_ULP_COND_OPC_ACTION_BIT_NOT_SET,
 	.cond_operand = BNXT_ULP_ACTION_BIT_PUSH_VLAN,
 	.direction = TF_DIR_TX,
 	.srch_b4_alloc = BNXT_ULP_SEARCH_BEFORE_ALLOC_NO,
@@ -511,7 +511,7 @@ struct bnxt_ulp_mapper_tbl_info ulp_stingray_act_tbl_list[] = {
 	.resource_sub_type =
 		BNXT_ULP_RESOURCE_SUB_TYPE_INDEX_TYPE_NORMAL,
 	.mem_type_opcode = BNXT_ULP_MEM_TYPE_OPCODE_EXECUTE_IF_EXT,
-	.cond_opcode = BNXT_ULP_COND_OPCODE_ACTION_BIT_IS_SET,
+	.cond_opcode = BNXT_ULP_COND_OPC_ACTION_BIT_IS_SET,
 	.cond_operand = BNXT_ULP_ACTION_BIT_PUSH_VLAN,
 	.direction = TF_DIR_TX,
 	.srch_b4_alloc = BNXT_ULP_SEARCH_BEFORE_ALLOC_NO,
drivers/net/bnxt/tf_ulp/ulp_template_db_stingray_class.c +4 -4
index a8f26e8c51..c11d1ad96d 100644
@@ -292,7 +292,7 @@ struct bnxt_ulp_mapper_tbl_info ulp_stingray_class_tbl_list[] = {
 	{ /* class_tid: 2, stingray, table: l2_cntxt_tcam_vfr_0 */
 	.resource_func = BNXT_ULP_RESOURCE_FUNC_TCAM_TABLE,
 	.resource_type = TF_TCAM_TBL_TYPE_L2_CTXT_TCAM_LOW,
-	.cond_opcode = BNXT_ULP_COND_OPCODE_COMP_FIELD_IS_SET,
+	.cond_opcode = BNXT_ULP_COND_OPC_COMP_FIELD_IS_SET,
 	.cond_operand = BNXT_ULP_CF_IDX_VFR_MODE,
 	.direction = TF_DIR_TX,
 	.srch_b4_alloc = BNXT_ULP_SEARCH_BEFORE_ALLOC_NO,
@@ -315,7 +315,7 @@ struct bnxt_ulp_mapper_tbl_info ulp_stingray_class_tbl_list[] = {
 	.resource_type = TF_TCAM_TBL_TYPE_L2_CTXT_TCAM_LOW,
 	.resource_sub_type =
 		BNXT_ULP_RESOURCE_SUB_TYPE_CACHE_TYPE_L2_CNTXT_TCAM,
-	.cond_opcode = BNXT_ULP_COND_OPCODE_COMP_FIELD_NOT_SET,
+	.cond_opcode = BNXT_ULP_COND_OPC_COMP_FIELD_NOT_SET,
 	.cond_operand = BNXT_ULP_CF_IDX_VFR_MODE,
 	.direction = TF_DIR_TX,
 	.key_start_idx = 27,
@@ -332,7 +332,7 @@ struct bnxt_ulp_mapper_tbl_info ulp_stingray_class_tbl_list[] = {
 	{ /* class_tid: 2, stingray, table: l2_cntxt_tcam_0 */
 	.resource_func = BNXT_ULP_RESOURCE_FUNC_TCAM_TABLE,
 	.resource_type = TF_TCAM_TBL_TYPE_L2_CTXT_TCAM_LOW,
-	.cond_opcode = BNXT_ULP_COND_OPCODE_COMP_FIELD_NOT_SET,
+	.cond_opcode = BNXT_ULP_COND_OPC_COMP_FIELD_NOT_SET,
 	.cond_operand = BNXT_ULP_CF_IDX_VFR_MODE,
 	.direction = TF_DIR_TX,
 	.srch_b4_alloc = BNXT_ULP_SEARCH_BEFORE_ALLOC_NO,
@@ -1785,7 +1785,7 @@ struct bnxt_ulp_mapper_tbl_info ulp_stingray_class_tbl_list[] = {
 	.resource_type = TF_TBL_TYPE_ACT_STATS_64,
 	.resource_sub_type =
 		BNXT_ULP_RESOURCE_SUB_TYPE_INDEX_TYPE_INT_COUNT_ACC,
-	.cond_opcode = BNXT_ULP_COND_OPCODE_ACTION_BIT_IS_SET,
+	.cond_opcode = BNXT_ULP_COND_OPC_ACTION_BIT_IS_SET,
 	.cond_operand = BNXT_ULP_ACTION_BIT_COUNT,
 	.direction = TF_DIR_RX,
 	.srch_b4_alloc = BNXT_ULP_SEARCH_BEFORE_ALLOC_NO,
drivers/net/bnxt/tf_ulp/ulp_template_db_tbl.c +243 -0

249 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_template_db_tbl.h +2 -0
index 684e93f557..a656f3da52 100644
@@ -45,4 +45,6 @@ extern struct bnxt_ulp_mapper_tbl_info ulp_stingray_act_tbl_list[];
 
 extern struct
 bnxt_ulp_mapper_result_field_info ulp_stingray_act_result_field_list[];
+
+extern uint8_t ulp_glb_field_tbl[];
 #endif
drivers/net/bnxt/tf_ulp/ulp_template_db_wh_plus_act.c +15 -15
index 26eba56516..be6149b9ce 100644
@@ -47,7 +47,7 @@ struct bnxt_ulp_mapper_tbl_info ulp_wh_plus_act_tbl_list[] = {
 	.resource_type = TF_TBL_TYPE_ACT_STATS_64,
 	.resource_sub_type =
 		BNXT_ULP_RESOURCE_SUB_TYPE_INDEX_TYPE_INT_COUNT,
-	.cond_opcode = BNXT_ULP_COND_OPCODE_ACTION_BIT_IS_SET,
+	.cond_opcode = BNXT_ULP_COND_OPC_ACTION_BIT_IS_SET,
 	.cond_operand = BNXT_ULP_ACTION_BIT_COUNT,
 	.direction = TF_DIR_RX,
 	.srch_b4_alloc = BNXT_ULP_SEARCH_BEFORE_ALLOC_NO,
@@ -64,7 +64,7 @@ struct bnxt_ulp_mapper_tbl_info ulp_wh_plus_act_tbl_list[] = {
 	.resource_type = TF_TBL_TYPE_ACT_MODIFY_IPV4,
 	.resource_sub_type =
 		BNXT_ULP_RESOURCE_SUB_TYPE_INDEX_TYPE_NORMAL,
-	.cond_opcode = BNXT_ULP_COND_OPCODE_ACTION_BIT_IS_SET,
+	.cond_opcode = BNXT_ULP_COND_OPC_ACTION_BIT_IS_SET,
 	.cond_operand = BNXT_ULP_ACTION_BIT_SET_IPV4_SRC,
 	.direction = TF_DIR_RX,
 	.srch_b4_alloc = BNXT_ULP_SEARCH_BEFORE_ALLOC_NO,
@@ -81,7 +81,7 @@ struct bnxt_ulp_mapper_tbl_info ulp_wh_plus_act_tbl_list[] = {
 	.resource_type = TF_TBL_TYPE_ACT_MODIFY_IPV4,
 	.resource_sub_type =
 		BNXT_ULP_RESOURCE_SUB_TYPE_INDEX_TYPE_NORMAL,
-	.cond_opcode = BNXT_ULP_COND_OPCODE_ACTION_BIT_IS_SET,
+	.cond_opcode = BNXT_ULP_COND_OPC_ACTION_BIT_IS_SET,
 	.cond_operand = BNXT_ULP_ACTION_BIT_SET_IPV4_DST,
 	.direction = TF_DIR_RX,
 	.srch_b4_alloc = BNXT_ULP_SEARCH_BEFORE_ALLOC_NO,
@@ -145,7 +145,7 @@ struct bnxt_ulp_mapper_tbl_info ulp_wh_plus_act_tbl_list[] = {
 	.resource_type = TF_TBL_TYPE_ACT_STATS_64,
 	.resource_sub_type =
 		BNXT_ULP_RESOURCE_SUB_TYPE_INDEX_TYPE_INT_COUNT,
-	.cond_opcode = BNXT_ULP_COND_OPCODE_ACTION_BIT_IS_SET,
+	.cond_opcode = BNXT_ULP_COND_OPC_ACTION_BIT_IS_SET,
 	.cond_operand = BNXT_ULP_ACTION_BIT_COUNT,
 	.direction = TF_DIR_RX,
 	.srch_b4_alloc = BNXT_ULP_SEARCH_BEFORE_ALLOC_NO,
@@ -194,7 +194,7 @@ struct bnxt_ulp_mapper_tbl_info ulp_wh_plus_act_tbl_list[] = {
 	.resource_type = TF_TBL_TYPE_ACT_STATS_64,
 	.resource_sub_type =
 		BNXT_ULP_RESOURCE_SUB_TYPE_INDEX_TYPE_INT_COUNT,
-	.cond_opcode = BNXT_ULP_COND_OPCODE_ACTION_BIT_IS_SET,
+	.cond_opcode = BNXT_ULP_COND_OPC_ACTION_BIT_IS_SET,
 	.cond_operand = BNXT_ULP_ACTION_BIT_COUNT,
 	.direction = TF_DIR_RX,
 	.srch_b4_alloc = BNXT_ULP_SEARCH_BEFORE_ALLOC_NO,
@@ -243,7 +243,7 @@ struct bnxt_ulp_mapper_tbl_info ulp_wh_plus_act_tbl_list[] = {
 	.resource_type = TF_TBL_TYPE_ACT_STATS_64,
 	.resource_sub_type =
 		BNXT_ULP_RESOURCE_SUB_TYPE_INDEX_TYPE_INT_COUNT,
-	.cond_opcode = BNXT_ULP_COND_OPCODE_ACTION_BIT_IS_SET,
+	.cond_opcode = BNXT_ULP_COND_OPC_ACTION_BIT_IS_SET,
 	.cond_operand = BNXT_ULP_ACTION_BIT_COUNT,
 	.direction = TF_DIR_TX,
 	.srch_b4_alloc = BNXT_ULP_SEARCH_BEFORE_ALLOC_NO,
@@ -260,7 +260,7 @@ struct bnxt_ulp_mapper_tbl_info ulp_wh_plus_act_tbl_list[] = {
 	.resource_type = TF_TBL_TYPE_ACT_SP_SMAC_IPV4,
 	.resource_sub_type =
 		BNXT_ULP_RESOURCE_SUB_TYPE_INDEX_TYPE_NORMAL,
-	.cond_opcode = BNXT_ULP_COND_OPCODE_COMP_FIELD_IS_SET,
+	.cond_opcode = BNXT_ULP_COND_OPC_COMP_FIELD_IS_SET,
 	.cond_operand = BNXT_ULP_CF_IDX_ACT_ENCAP_IPV4_FLAG,
 	.direction = TF_DIR_TX,
 	.srch_b4_alloc = BNXT_ULP_SEARCH_BEFORE_ALLOC_SEARCH_IF_HIT_SKIP,
@@ -277,7 +277,7 @@ struct bnxt_ulp_mapper_tbl_info ulp_wh_plus_act_tbl_list[] = {
 	.resource_type = TF_TBL_TYPE_ACT_SP_SMAC_IPV6,
 	.resource_sub_type =
 		BNXT_ULP_RESOURCE_SUB_TYPE_INDEX_TYPE_NORMAL,
-	.cond_opcode = BNXT_ULP_COND_OPCODE_COMP_FIELD_IS_SET,
+	.cond_opcode = BNXT_ULP_COND_OPC_COMP_FIELD_IS_SET,
 	.cond_operand = BNXT_ULP_CF_IDX_ACT_ENCAP_IPV6_FLAG,
 	.direction = TF_DIR_TX,
 	.srch_b4_alloc = BNXT_ULP_SEARCH_BEFORE_ALLOC_SEARCH_IF_HIT_SKIP,
@@ -341,7 +341,7 @@ struct bnxt_ulp_mapper_tbl_info ulp_wh_plus_act_tbl_list[] = {
 	.resource_type = TF_TBL_TYPE_ACT_STATS_64,
 	.resource_sub_type =
 		BNXT_ULP_RESOURCE_SUB_TYPE_INDEX_TYPE_INT_COUNT,
-	.cond_opcode = BNXT_ULP_COND_OPCODE_ACTION_BIT_IS_SET,
+	.cond_opcode = BNXT_ULP_COND_OPC_ACTION_BIT_IS_SET,
 	.cond_operand = BNXT_ULP_ACTION_BIT_COUNT,
 	.direction = TF_DIR_TX,
 	.srch_b4_alloc = BNXT_ULP_SEARCH_BEFORE_ALLOC_NO,
@@ -358,7 +358,7 @@ struct bnxt_ulp_mapper_tbl_info ulp_wh_plus_act_tbl_list[] = {
 	.resource_type = TF_TBL_TYPE_ACT_MODIFY_IPV4,
 	.resource_sub_type =
 		BNXT_ULP_RESOURCE_SUB_TYPE_INDEX_TYPE_NORMAL,
-	.cond_opcode = BNXT_ULP_COND_OPCODE_ACTION_BIT_IS_SET,
+	.cond_opcode = BNXT_ULP_COND_OPC_ACTION_BIT_IS_SET,
 	.cond_operand = BNXT_ULP_ACTION_BIT_SET_IPV4_SRC,
 	.direction = TF_DIR_TX,
 	.srch_b4_alloc = BNXT_ULP_SEARCH_BEFORE_ALLOC_NO,
@@ -375,7 +375,7 @@ struct bnxt_ulp_mapper_tbl_info ulp_wh_plus_act_tbl_list[] = {
 	.resource_type = TF_TBL_TYPE_ACT_MODIFY_IPV4,
 	.resource_sub_type =
 		BNXT_ULP_RESOURCE_SUB_TYPE_INDEX_TYPE_NORMAL,
-	.cond_opcode = BNXT_ULP_COND_OPCODE_ACTION_BIT_IS_SET,
+	.cond_opcode = BNXT_ULP_COND_OPC_ACTION_BIT_IS_SET,
 	.cond_operand = BNXT_ULP_ACTION_BIT_SET_IPV4_DST,
 	.direction = TF_DIR_TX,
 	.srch_b4_alloc = BNXT_ULP_SEARCH_BEFORE_ALLOC_NO,
@@ -440,7 +440,7 @@ struct bnxt_ulp_mapper_tbl_info ulp_wh_plus_act_tbl_list[] = {
 	.resource_type = TF_TBL_TYPE_ACT_STATS_64,
 	.resource_sub_type =
 		BNXT_ULP_RESOURCE_SUB_TYPE_INDEX_TYPE_INT_COUNT,
-	.cond_opcode = BNXT_ULP_COND_OPCODE_ACTION_BIT_IS_SET,
+	.cond_opcode = BNXT_ULP_COND_OPC_ACTION_BIT_IS_SET,
 	.cond_operand = BNXT_ULP_ACTION_BIT_COUNT,
 	.direction = TF_DIR_TX,
 	.srch_b4_alloc = BNXT_ULP_SEARCH_BEFORE_ALLOC_NO,
@@ -458,7 +458,7 @@ struct bnxt_ulp_mapper_tbl_info ulp_wh_plus_act_tbl_list[] = {
 	.resource_sub_type =
 		BNXT_ULP_RESOURCE_SUB_TYPE_INDEX_TYPE_NORMAL,
 	.mem_type_opcode = BNXT_ULP_MEM_TYPE_OPCODE_EXECUTE_IF_INT,
-	.cond_opcode = BNXT_ULP_COND_OPCODE_ACTION_BIT_IS_SET,
+	.cond_opcode = BNXT_ULP_COND_OPC_ACTION_BIT_IS_SET,
 	.cond_operand = BNXT_ULP_ACTION_BIT_PUSH_VLAN,
 	.direction = TF_DIR_TX,
 	.srch_b4_alloc = BNXT_ULP_SEARCH_BEFORE_ALLOC_NO,
@@ -492,7 +492,7 @@ struct bnxt_ulp_mapper_tbl_info ulp_wh_plus_act_tbl_list[] = {
 	.resource_sub_type =
 		BNXT_ULP_RESOURCE_SUB_TYPE_INDEX_TYPE_NORMAL,
 	.mem_type_opcode = BNXT_ULP_MEM_TYPE_OPCODE_EXECUTE_IF_EXT,
-	.cond_opcode = BNXT_ULP_COND_OPCODE_ACTION_BIT_NOT_SET,
+	.cond_opcode = BNXT_ULP_COND_OPC_ACTION_BIT_NOT_SET,
 	.cond_operand = BNXT_ULP_ACTION_BIT_PUSH_VLAN,
 	.direction = TF_DIR_TX,
 	.srch_b4_alloc = BNXT_ULP_SEARCH_BEFORE_ALLOC_NO,
@@ -510,7 +510,7 @@ struct bnxt_ulp_mapper_tbl_info ulp_wh_plus_act_tbl_list[] = {
 	.resource_sub_type =
 		BNXT_ULP_RESOURCE_SUB_TYPE_INDEX_TYPE_NORMAL,
 	.mem_type_opcode = BNXT_ULP_MEM_TYPE_OPCODE_EXECUTE_IF_EXT,
-	.cond_opcode = BNXT_ULP_COND_OPCODE_ACTION_BIT_IS_SET,
+	.cond_opcode = BNXT_ULP_COND_OPC_ACTION_BIT_IS_SET,
 	.cond_operand = BNXT_ULP_ACTION_BIT_PUSH_VLAN,
 	.direction = TF_DIR_TX,
 	.srch_b4_alloc = BNXT_ULP_SEARCH_BEFORE_ALLOC_NO,
drivers/net/bnxt/tf_ulp/ulp_template_db_wh_plus_class.c +4 -4
index 89f1bef75f..f248d33203 100644
@@ -292,7 +292,7 @@ struct bnxt_ulp_mapper_tbl_info ulp_wh_plus_class_tbl_list[] = {
 	{ /* class_tid: 2, wh_plus, table: l2_cntxt_tcam_vfr_0 */
 	.resource_func = BNXT_ULP_RESOURCE_FUNC_TCAM_TABLE,
 	.resource_type = TF_TCAM_TBL_TYPE_L2_CTXT_TCAM_LOW,
-	.cond_opcode = BNXT_ULP_COND_OPCODE_COMP_FIELD_IS_SET,
+	.cond_opcode = BNXT_ULP_COND_OPC_COMP_FIELD_IS_SET,
 	.cond_operand = BNXT_ULP_CF_IDX_VFR_MODE,
 	.direction = TF_DIR_TX,
 	.srch_b4_alloc = BNXT_ULP_SEARCH_BEFORE_ALLOC_NO,
@@ -315,7 +315,7 @@ struct bnxt_ulp_mapper_tbl_info ulp_wh_plus_class_tbl_list[] = {
 	.resource_type = TF_TCAM_TBL_TYPE_L2_CTXT_TCAM_LOW,
 	.resource_sub_type =
 		BNXT_ULP_RESOURCE_SUB_TYPE_CACHE_TYPE_L2_CNTXT_TCAM,
-	.cond_opcode = BNXT_ULP_COND_OPCODE_COMP_FIELD_NOT_SET,
+	.cond_opcode = BNXT_ULP_COND_OPC_COMP_FIELD_NOT_SET,
 	.cond_operand = BNXT_ULP_CF_IDX_VFR_MODE,
 	.direction = TF_DIR_TX,
 	.key_start_idx = 27,
@@ -332,7 +332,7 @@ struct bnxt_ulp_mapper_tbl_info ulp_wh_plus_class_tbl_list[] = {
 	{ /* class_tid: 2, wh_plus, table: l2_cntxt_tcam_0 */
 	.resource_func = BNXT_ULP_RESOURCE_FUNC_TCAM_TABLE,
 	.resource_type = TF_TCAM_TBL_TYPE_L2_CTXT_TCAM_LOW,
-	.cond_opcode = BNXT_ULP_COND_OPCODE_COMP_FIELD_NOT_SET,
+	.cond_opcode = BNXT_ULP_COND_OPC_COMP_FIELD_NOT_SET,
 	.cond_operand = BNXT_ULP_CF_IDX_VFR_MODE,
 	.direction = TF_DIR_TX,
 	.srch_b4_alloc = BNXT_ULP_SEARCH_BEFORE_ALLOC_NO,
@@ -1785,7 +1785,7 @@ struct bnxt_ulp_mapper_tbl_info ulp_wh_plus_class_tbl_list[] = {
 	.resource_type = TF_TBL_TYPE_ACT_STATS_64,
 	.resource_sub_type =
 		BNXT_ULP_RESOURCE_SUB_TYPE_INDEX_TYPE_INT_COUNT_ACC,
-	.cond_opcode = BNXT_ULP_COND_OPCODE_ACTION_BIT_IS_SET,
+	.cond_opcode = BNXT_ULP_COND_OPC_ACTION_BIT_IS_SET,
 	.cond_operand = BNXT_ULP_ACTION_BIT_COUNT,
 	.direction = TF_DIR_RX,
 	.srch_b4_alloc = BNXT_ULP_SEARCH_BEFORE_ALLOC_NO,
drivers/net/bnxt/tf_ulp/ulp_template_struct.h +16 -2
index 167116a2f4..9a15968ea8 100644
@@ -149,12 +149,24 @@ extern	uint16_t ulp_act_sig_tbl[];
 extern struct bnxt_ulp_act_match_info ulp_act_match_list[];
 
 /* Device Specific Tables for mapper */
+struct bnxt_ulp_mapper_cond_info {
+	enum bnxt_ulp_cond_opc cond_opcode;
+	uint32_t cond_operand;
+};
+
+struct bnxt_ulp_mapper_cond_list_info {
+	enum bnxt_ulp_cond_list_opc cond_list_opcode;
+	uint32_t cond_start_idx;
+	uint32_t cond_nums;
+};
+
 struct ulp_template_device_tbls {
 	struct bnxt_ulp_mapper_tbl_list_info *tmpl_list;
 	struct bnxt_ulp_mapper_tbl_info *tbl_list;
 	struct bnxt_ulp_mapper_key_field_info *key_field_list;
 	struct bnxt_ulp_mapper_result_field_info *result_field_list;
 	struct bnxt_ulp_mapper_ident_info *ident_list;
+	struct bnxt_ulp_mapper_cond_info *cond_list;
 };
 
 /* Device specific parameters */
@@ -183,14 +195,16 @@ struct bnxt_ulp_mapper_tbl_list_info {
 	uint32_t		device_name;
 	uint32_t		start_tbl_idx;
 	uint32_t		num_tbls;
+	struct bnxt_ulp_mapper_cond_list_info reject_info;
 };
 
 struct bnxt_ulp_mapper_tbl_info {
 	enum bnxt_ulp_resource_func	resource_func;
 	uint32_t			resource_type; /* TF_ enum type */
 	enum bnxt_ulp_resource_sub_type	resource_sub_type;
-	enum bnxt_ulp_cond_opcode	cond_opcode;
-	uint32_t			cond_operand;
+	struct bnxt_ulp_mapper_cond_list_info execute_info;
+	enum bnxt_ulp_cond_opc cond_opcode;
+	uint32_t cond_operand;
 	enum bnxt_ulp_mem_type_opcode	mem_type_opcode;
 	uint8_t				direction;
 	uint32_t			priority;
Signature · 1 line
2.17.1
#30 lore raw

PATCH 30/58 net/bnxt: modify TCAM opcode processing

In reply to Venkat Duvvuru

From: Kishore Padmanabha <[email protected]>

Added TCAM table specific opcode to process TCAM entry creation and reuse. This change removes the TCAM cache mechanism and uses the generic table mechanism for reuse of TCAM entries.

---
 drivers/net/bnxt/tf_ulp/ulp_mapper.c          | 135 ++++++-----------
 drivers/net/bnxt/tf_ulp/ulp_mapper.h          |  15 --
 .../net/bnxt/tf_ulp/ulp_template_db_enum.h    |   7 +
 .../tf_ulp/ulp_template_db_wh_plus_class.c    | 138 ++++++++++++------
 drivers/net/bnxt/tf_ulp/ulp_template_struct.h |   1 +
 5 files changed, 144 insertions(+), 152 deletions(-)
drivers/net/bnxt/tf_ulp/ulp_mapper.c +44 -91
index d84614fcd1..c511f835ff 100644
@@ -1356,20 +1356,11 @@ ulp_mapper_tcam_tbl_scan_ident_alloc(struct bnxt_ulp_mapper_parms *parms,
 	uint32_t num_idents;
 	uint32_t i;
 
-	/*
-	 * Since the cache entry is responsible for allocating
-	 * identifiers when in use, allocate the identifiers only
-	 * during normal processing.
-	 */
-	if (parms->tcam_tbl_opc ==
-	    BNXT_ULP_MAPPER_TCAM_TBL_OPC_NORMAL) {
-		idents = ulp_mapper_ident_fields_get(parms, tbl, &num_idents);
-
-		for (i = 0; i < num_idents; i++) {
-			if (ulp_mapper_ident_process(parms, tbl,
-						     &idents[i], NULL))
-				return -EINVAL;
-		}
+	idents = ulp_mapper_ident_fields_get(parms, tbl, &num_idents);
+	for (i = 0; i < num_idents; i++) {
+		if (ulp_mapper_ident_process(parms, tbl,
+					     &idents[i], NULL))
+			return -EINVAL;
 	}
 	return 0;
 }
@@ -1490,14 +1481,15 @@ ulp_mapper_tcam_tbl_process(struct bnxt_ulp_mapper_parms *parms,
 	struct tf_search_tcam_entry_parms searchparms   = { 0 };
 	struct ulp_flow_db_res_params	fid_parms	= { 0 };
 	struct tf_free_tcam_entry_parms free_parms	= { 0 };
-	enum bnxt_ulp_search_before_alloc search_flag;
 	uint32_t hit = 0;
 	uint16_t tmplen = 0;
 	uint16_t idx;
 
-	/* Skip this if was handled by the cache. */
-	if (parms->tcam_tbl_opc == BNXT_ULP_MAPPER_TCAM_TBL_OPC_CACHE_SKIP) {
-		parms->tcam_tbl_opc = BNXT_ULP_MAPPER_TCAM_TBL_OPC_NORMAL;
+	/* Skip this if table opcode is NOP */
+	if (tbl->tbl_opcode == BNXT_ULP_TCAM_TBL_OPC_NOT_USED ||
+	    tbl->tbl_opcode >= BNXT_ULP_TCAM_TBL_OPC_LAST) {
+		BNXT_TF_DBG(ERR, "Invalid tcam table opcode %d\n",
+			    tbl->tbl_opcode);
 		return 0;
 	}
 
@@ -1555,41 +1547,31 @@ ulp_mapper_tcam_tbl_process(struct bnxt_ulp_mapper_parms *parms,
 		}
 	}
 
+	/* For wild card tcam perform the post process to swap the blob */
 	if (tbl->resource_type == TF_TCAM_TBL_TYPE_WC_TCAM) {
 		ulp_mapper_wc_tcam_tbl_post_process(&key, tbl->key_bit_size);
 		ulp_mapper_wc_tcam_tbl_post_process(&mask, tbl->key_bit_size);
 	}
 
-	if (tbl->srch_b4_alloc == BNXT_ULP_SEARCH_BEFORE_ALLOC_NO) {
-		/*
-		 * No search for re-use is requested, so simply allocate the
-		 * tcam index.
-		 */
-		aparms.dir		= tbl->direction;
-		aparms.tcam_tbl_type	= tbl->resource_type;
-		aparms.search_enable	= tbl->srch_b4_alloc;
-		aparms.key		= ulp_blob_data_get(&key, &tmplen);
-		aparms.key_sz_in_bits	= tmplen;
+	if (tbl->tbl_opcode == BNXT_ULP_TCAM_TBL_OPC_ALLOC_WR_REGFILE) {
+		/* allocate the tcam index */
+		aparms.dir = tbl->direction;
+		aparms.tcam_tbl_type = tbl->resource_type;
+		aparms.key = ulp_blob_data_get(&key, &tmplen);
+		aparms.key_sz_in_bits = tmplen;
 		if (tbl->blob_key_bit_size != tmplen) {
 			BNXT_TF_DBG(ERR, "Key len (%d) != Expected (%d)\n",
 				    tmplen, tbl->blob_key_bit_size);
 			return -EINVAL;
 		}
 
-		aparms.mask		= ulp_blob_data_get(&mask, &tmplen);
+		aparms.mask = ulp_blob_data_get(&mask, &tmplen);
 		if (tbl->blob_key_bit_size != tmplen) {
 			BNXT_TF_DBG(ERR, "Mask len (%d) != Expected (%d)\n",
 				    tmplen, tbl->blob_key_bit_size);
 			return -EINVAL;
 		}
-
-		aparms.priority		= tbl->priority;
-
-		/*
-		 * All failures after this succeeds require the entry to be
-		 * freed. cannot return directly on failure, but needs to goto
-		 * error.
-		 */
+		aparms.priority = tbl->priority;
 		rc = tf_alloc_tcam_entry(tfp, &aparms);
 		if (rc) {
 			BNXT_TF_DBG(ERR, "tcam alloc failed rc=%d.\n", rc);
@@ -1627,14 +1609,18 @@ ulp_mapper_tcam_tbl_process(struct bnxt_ulp_mapper_parms *parms,
 		hit = searchparms.hit;
 	}
 
-	/* if it is miss then it is same as no search before alloc */
-	if (!hit)
-		search_flag = BNXT_ULP_SEARCH_BEFORE_ALLOC_NO;
-	else
-		search_flag = tbl->srch_b4_alloc;
+	/* Write the tcam index into the regfile*/
+	if (!ulp_regfile_write(parms->regfile, tbl->tbl_operand,
+			       (uint64_t)tfp_cpu_to_be_64(idx))) {
+		BNXT_TF_DBG(ERR, "Regfile[%d] write failed.\n",
+			    tbl->tbl_operand);
+		rc = -EINVAL;
+		/* Need to free the tcam idx, so goto error */
+		goto error;
+	}
 
-	switch (search_flag) {
-	case BNXT_ULP_SEARCH_BEFORE_ALLOC_NO:
+	/* if it is miss then it is same as no search before alloc */
+	if (!hit || tbl->tbl_opcode == BNXT_ULP_TCAM_TBL_OPC_ALLOC_WR_REGFILE) {
 		/*Scan identifier list, allocate identifier and update regfile*/
 		rc = ulp_mapper_tcam_tbl_scan_ident_alloc(parms, tbl);
 		/* Create the result blob */
@@ -1645,60 +1631,29 @@ ulp_mapper_tcam_tbl_process(struct bnxt_ulp_mapper_parms *parms,
 		if (!rc)
 			rc = ulp_mapper_tcam_tbl_entry_write(parms, tbl, &key,
 							     &mask, &data, idx);
-		break;
-	case BNXT_ULP_SEARCH_BEFORE_ALLOC_SEARCH_IF_HIT_SKIP:
-		/*Scan identifier list, extract identifier and update regfile*/
-		rc = ulp_mapper_tcam_tbl_scan_ident_extract(parms, tbl, &data);
-		break;
-	case BNXT_ULP_SEARCH_BEFORE_ALLOC_SEARCH_IF_HIT_UPDATE:
+	} else {
 		/*Scan identifier list, extract identifier and update regfile*/
 		rc = ulp_mapper_tcam_tbl_scan_ident_extract(parms, tbl, &data);
-		/* Create the result blob */
-		if (!rc)
-			rc = ulp_mapper_tcam_tbl_result_create(parms, tbl,
-							       &update_data);
-		/* Update/overwrite the tcam entry */
-		if (!rc)
-			rc = ulp_mapper_tcam_tbl_entry_write(parms, tbl, &key,
-							     &mask,
-							     &update_data, idx);
-		break;
-	default:
-		BNXT_TF_DBG(ERR, "invalid search opcode\n");
-		rc =  -EINVAL;
-		break;
 	}
 	if (rc)
 		goto error;
-	/*
-	 * Only link the entry to the flow db in the event that cache was not
-	 * used.
-	 */
-	if (parms->tcam_tbl_opc == BNXT_ULP_MAPPER_TCAM_TBL_OPC_NORMAL) {
-		fid_parms.direction = tbl->direction;
-		fid_parms.resource_func	= tbl->resource_func;
-		fid_parms.resource_type	= tbl->resource_type;
-		fid_parms.critical_resource = tbl->critical_resource;
-		fid_parms.resource_hndl	= idx;
-		rc = ulp_mapper_fdb_opc_process(parms, tbl, &fid_parms);
-		if (rc) {
-			BNXT_TF_DBG(ERR,
-				    "Failed to link resource to flow rc = %d\n",
-				    rc);
-			/* Need to free the identifier, so goto error */
-			goto error;
-		}
-	} else {
-		/*
-		 * Reset the tcam table opcode to normal in case the next tcam
-		 * entry does not use cache.
-		 */
-		parms->tcam_tbl_opc = BNXT_ULP_MAPPER_TCAM_TBL_OPC_NORMAL;
+
+	/* Add the tcam index to the flow database */
+	fid_parms.direction = tbl->direction;
+	fid_parms.resource_func	= tbl->resource_func;
+	fid_parms.resource_type	= tbl->resource_type;
+	fid_parms.critical_resource = tbl->critical_resource;
+	fid_parms.resource_hndl	= idx;
+	rc = ulp_mapper_fdb_opc_process(parms, tbl, &fid_parms);
+	if (rc) {
+		BNXT_TF_DBG(ERR, "Failed to link resource to flow rc = %d\n",
+			    rc);
+		/* Need to free the identifier, so goto error */
+		goto error;
 	}
 
 	return 0;
 error:
-	parms->tcam_tbl_opc = BNXT_ULP_MAPPER_TCAM_TBL_OPC_NORMAL;
 	free_parms.dir			= tbl->direction;
 	free_parms.tcam_tbl_type	= tbl->resource_type;
 	free_parms.idx			= idx;
@@ -1706,7 +1661,6 @@ ulp_mapper_tcam_tbl_process(struct bnxt_ulp_mapper_parms *parms,
 	if (trc)
 		BNXT_TF_DBG(ERR, "Failed to free tcam[%d][%d][%d] on failure\n",
 			    tbl->resource_type, tbl->direction, idx);
-
 	return rc;
 }
 
@@ -2976,7 +2930,6 @@ ulp_mapper_flow_create(struct bnxt_ulp_context *ulp_ctx,
 	parms.comp_fld = cparms->comp_fld;
 	parms.tfp = bnxt_ulp_cntxt_tfp_get(ulp_ctx);
 	parms.ulp_ctx = ulp_ctx;
-	parms.tcam_tbl_opc = BNXT_ULP_MAPPER_TCAM_TBL_OPC_NORMAL;
 	parms.act_tid = cparms->act_tid;
 	parms.class_tid = cparms->class_tid;
 	parms.flow_type = cparms->flow_type;
drivers/net/bnxt/tf_ulp/ulp_mapper.h +0 -15
index 8bc6cdbdd5..4c423d2374 100644
@@ -18,20 +18,6 @@
 
 #define ULP_IDENTS_INVALID ((uint16_t)0xffff)
 
-/*
- * The cache table opcode is used to convey informat from the cache handler
- * to the tcam handler.  The opcodes do the following:
- * NORMAL - tcam should process all instructions as normal
- * SKIP - tcam is using the cached entry and doesn't need to process the
- *	instruction.
- * ALLOC - tcam needs to allocate the tcam index and store in the cache entry
- */
-enum bnxt_ulp_cache_table_opc {
-	BNXT_ULP_MAPPER_TCAM_TBL_OPC_NORMAL,
-	BNXT_ULP_MAPPER_TCAM_TBL_OPC_CACHE_SKIP,
-	BNXT_ULP_MAPPER_TCAM_TBL_OPC_CACHE_ALLOC
-};
-
 struct bnxt_ulp_mapper_glb_resource_entry {
 	enum bnxt_ulp_resource_func	resource_func;
 	uint32_t			resource_type; /* TF_ enum type */
@@ -66,7 +52,6 @@ struct bnxt_ulp_mapper_parms {
 	uint32_t				fid;
 	enum bnxt_ulp_fdb_type			flow_type;
 	struct bnxt_ulp_mapper_data		*mapper_data;
-	enum bnxt_ulp_cache_table_opc		tcam_tbl_opc;
 	struct bnxt_ulp_device_params		*device_params;
 	uint32_t				parent_fid;
 	uint32_t				parent_flow;
drivers/net/bnxt/tf_ulp/ulp_template_db_enum.h +7 -0
index e4b8c56472..ddc396b3f9 100644
@@ -323,6 +323,13 @@ enum bnxt_ulp_regfile_index {
 	BNXT_ULP_REGFILE_INDEX_LAST = 30
 };
 
+enum bnxt_ulp_tcam_tbl_opc {
+	BNXT_ULP_TCAM_TBL_OPC_NOT_USED = 0,
+	BNXT_ULP_TCAM_TBL_OPC_ALLOC_WR_REGFILE = 1,
+	BNXT_ULP_TCAM_TBL_OPC_SRCH_ALLOC_WR_REGFILE = 2,
+	BNXT_ULP_TCAM_TBL_OPC_LAST = 3
+};
+
 enum bnxt_ulp_search_before_alloc {
 	BNXT_ULP_SEARCH_BEFORE_ALLOC_NO = 0,
 	BNXT_ULP_SEARCH_BEFORE_ALLOC_SEARCH_IF_HIT_SKIP = 1,
drivers/net/bnxt/tf_ulp/ulp_template_db_wh_plus_class.c +92 -46

414 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_template_struct.h +1 -0
index 9a15968ea8..ee17390358 100644
@@ -234,6 +234,7 @@ struct bnxt_ulp_mapper_tbl_info {
 
 	/* Table opcode for table operations */
 	uint32_t			tbl_opcode;
+	uint32_t			tbl_operand;
 
 	/* FDB table opcode */
 	enum bnxt_ulp_fdb_opc		fdb_opcode;
Signature · 1 line
2.17.1
#31 lore raw

PATCH 31/58 net/bnxt: modify VXLAN decap for multichannel mode

In reply to Venkat Duvvuru

The driver is using physical port id as the index into the tunnel inner flow table. However, this will not work in case of multichannel mode where multiple physical functions are going to share the same physical port id.

When tunnel inner flow offload request comes before tunnel outer flow offload request, the driver caches the tunnel inner flow details and programs it in the hardware after installing the tunnel outer flow in the hardware. If more than one tunnel inner flow arrives before tunnel outer flow is offloaded, the driver rejects any such tunnel inner flow offload requests.

This patch fixes the above two problems by
1. Using dpdk port id as the index to store tunnel inner info.
2. Caching any number of tunnel inner flow offload requests that come before offloading tunnel outer flow offload request

---
 drivers/net/bnxt/tf_ulp/bnxt_ulp.c            |   3 +
 drivers/net/bnxt/tf_ulp/bnxt_ulp_flow.c       |   3 +-
 drivers/net/bnxt/tf_ulp/ulp_template_struct.h |   1 +
 drivers/net/bnxt/tf_ulp/ulp_tun.c             | 192 ++++++++++++------
 drivers/net/bnxt/tf_ulp/ulp_tun.h             |  30 ++-
 5 files changed, 150 insertions(+), 79 deletions(-)
drivers/net/bnxt/tf_ulp/bnxt_ulp.c +3 -0
index 5c805eef97..59fb530fb1 100644
@@ -22,6 +22,7 @@
 #include "ulp_flow_db.h"
 #include "ulp_mapper.h"
 #include "ulp_port_db.h"
+#include "ulp_tun.h"
 
 /* Linked list of all TF sessions. */
 STAILQ_HEAD(, bnxt_ulp_session_state) bnxt_ulp_session_list =
@@ -533,6 +534,8 @@ ulp_ctx_init(struct bnxt *bp,
 	if (rc)
 		goto error_deinit;
 
+	ulp_tun_tbl_init(ulp_data->tun_tbl);
+
 	bnxt_ulp_cntxt_tfp_set(bp->ulp_ctx, &bp->tfp);
 	return rc;
 
drivers/net/bnxt/tf_ulp/bnxt_ulp_flow.c +2 -1
index ddf38ed931..836e94bc60 100644
@@ -79,6 +79,7 @@ bnxt_ulp_init_mapper_params(struct bnxt_ulp_mapper_create_parms *mapper_cparms,
 			    struct ulp_rte_parser_params *params,
 			    enum bnxt_ulp_fdb_type flow_type)
 {
+	memset(mapper_cparms, 0, sizeof(*mapper_cparms));
 	mapper_cparms->flow_type	= flow_type;
 	mapper_cparms->app_priority	= params->priority;
 	mapper_cparms->dir_attr		= params->dir_attr;
@@ -176,7 +177,7 @@ bnxt_ulp_flow_create(struct rte_eth_dev *dev,
 	params.fid = fid;
 	params.func_id = func_id;
 	params.priority = attr->priority;
-	params.port_id = bnxt_get_phy_port_id(dev->data->port_id);
+	params.port_id = dev->data->port_id;
 	/* Perform the rte flow post process */
 	ret = bnxt_ulp_rte_parser_post_process(&params);
 	if (ret == BNXT_TF_RC_ERROR)
drivers/net/bnxt/tf_ulp/ulp_template_struct.h +1 -0
index ee17390358..b253aefe8d 100644
@@ -62,6 +62,7 @@ struct ulp_rte_act_prop {
 
 /* Structure to be used for passing all the parser functions */
 struct ulp_rte_parser_params {
+	STAILQ_ENTRY(ulp_rte_parser_params)  next;
 	struct ulp_rte_hdr_bitmap	hdr_bitmap;
 	struct ulp_rte_hdr_bitmap	hdr_fp_bit;
 	struct ulp_rte_field_bitmap	fld_bitmap;
drivers/net/bnxt/tf_ulp/ulp_tun.c +132 -60

302 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_tun.h +12 -18
index af6926f0e4..7e31f81f13 100644
@@ -15,7 +15,7 @@
 #include "ulp_template_db_enum.h"
 #include "ulp_template_struct.h"
 
-#define	BNXT_OUTER_TUN_SIGNATURE(l3_tun, params)		\
+#define	BNXT_OUTER_TUN_FLOW(l3_tun, params)		\
 	((l3_tun) &&					\
 	 ULP_BITMAP_ISSET((params)->act_bitmap.bits,	\
 			  BNXT_ULP_ACTION_BIT_JUMP))
@@ -24,22 +24,16 @@
 	 !ULP_BITMAP_ISSET((params)->hdr_bitmap.bits,			\
 			   BNXT_ULP_HDR_BIT_O_ETH))
 
-#define	BNXT_FIRST_INNER_TUN_FLOW(state, inner_tun_sig)	\
+#define	BNXT_CACHE_INNER_TUN_FLOW(state, inner_tun_sig)	\
 	((state) == BNXT_ULP_FLOW_STATE_NORMAL && (inner_tun_sig))
 #define	BNXT_INNER_TUN_FLOW(state, inner_tun_sig)		\
 	((state) == BNXT_ULP_FLOW_STATE_TUN_O_OFFLD && (inner_tun_sig))
-#define	BNXT_OUTER_TUN_FLOW(outer_tun_sig)		((outer_tun_sig))
 
 /* It is invalid to get another outer flow offload request
  * for the same tunnel, while the outer flow is already offloaded.
  */
 #define	BNXT_REJECT_OUTER_TUN_FLOW(state, outer_tun_sig)	\
 	((state) == BNXT_ULP_FLOW_STATE_TUN_O_OFFLD && (outer_tun_sig))
-/* It is invalid to get another inner flow offload request
- * for the same tunnel, while the outer flow is not yet offloaded.
- */
-#define	BNXT_REJECT_INNER_TUN_FLOW(state, inner_tun_sig)	\
-	((state) == BNXT_ULP_FLOW_STATE_TUN_I_CACHED && (inner_tun_sig))
 
 #define	ULP_TUN_O_DMAC_HDR_FIELD_INDEX	1
 #define	ULP_TUN_O_IPV4_DIP_INDEX	19
@@ -50,10 +44,10 @@
  * requests arrive.
  *
  * If inner tunnel flow offload request arrives first then the flow
- * state will change from BNXT_ULP_FLOW_STATE_NORMAL to
- * BNXT_ULP_FLOW_STATE_TUN_I_CACHED and the following outer tunnel
- * flow offload request will change the state of the flow to
- * BNXT_ULP_FLOW_STATE_TUN_O_OFFLD from BNXT_ULP_FLOW_STATE_TUN_I_CACHED.
+ * state will remain in BNXT_ULP_FLOW_STATE_NORMAL state.
+ * The following outer tunnel flow offload request will change the
+ * state of the flow to BNXT_ULP_FLOW_STATE_TUN_O_OFFLD from
+ * BNXT_ULP_FLOW_STATE_NORMAL.
  *
  * If outer tunnel flow offload request arrives first then the flow state
  * will change from BNXT_ULP_FLOW_STATE_NORMAL to
@@ -67,17 +61,15 @@
 enum bnxt_ulp_tun_flow_state {
 	BNXT_ULP_FLOW_STATE_NORMAL = 0,
 	BNXT_ULP_FLOW_STATE_TUN_O_OFFLD,
-	BNXT_ULP_FLOW_STATE_TUN_I_CACHED
 };
 
 struct ulp_per_port_flow_info {
-	enum bnxt_ulp_tun_flow_state	state;
-	uint32_t			first_tun_i_fid;
-	struct ulp_rte_parser_params	first_inner_tun_params;
+	enum bnxt_ulp_tun_flow_state		state;
+	uint32_t				tun_i_cnt;
+	STAILQ_HEAD(, ulp_rte_parser_params)	tun_i_prms_list;
 };
 
 struct bnxt_tun_cache_entry {
-	bool				valid;
 	bool				t_dst_ip_valid;
 	uint8_t				t_dmac[RTE_ETHER_ADDR_LEN];
 	union {
@@ -86,10 +78,12 @@ struct bnxt_tun_cache_entry {
 	};
 	uint32_t			outer_tun_flow_id;
 	uint16_t			outer_tun_rej_cnt;
-	uint16_t			inner_tun_rej_cnt;
 	struct ulp_per_port_flow_info	tun_flow_info[RTE_MAX_ETHPORTS];
 };
 
+void
+ulp_tun_tbl_init(struct bnxt_tun_cache_entry *tun_tbl);
+
 void
 ulp_clear_tun_entry(struct bnxt_tun_cache_entry *tun_tbl, uint8_t tun_idx);
 
Signature · 1 line
2.17.1
#32 lore raw

PATCH 32/58 net/bnxt: modify table processing

In reply to Venkat Duvvuru

From: Kishore Padmanabha <[email protected]>

1. Added interface table specific opcode to process interface table entry creation and reuse. This allows reuse of the interface table entry for multiple flows. Changed the regfile apis to store the data in big endian format.

2. The result blob creation being done in tcam, interface, index tables are consolidate to a common method.

3. Added result blob processing for generic table write

4. Modified the index table opcode processing to support new opcodes.

5. The driver was setting key size that did not take into account the word alignment.

6. The hard coded values for critical resource is replaced with template defined values.

---
 drivers/net/bnxt/tf_ulp/ulp_gen_tbl.c         |  18 +-
 drivers/net/bnxt/tf_ulp/ulp_gen_tbl.h         |   4 +-
 drivers/net/bnxt/tf_ulp/ulp_mapper.c          | 674 ++++++++++--------
 .../net/bnxt/tf_ulp/ulp_template_db_enum.h    |  22 +
 .../bnxt/tf_ulp/ulp_template_db_wh_plus_act.c | 108 +--
 .../tf_ulp/ulp_template_db_wh_plus_class.c    |  69 +-
 6 files changed, 512 insertions(+), 383 deletions(-)
drivers/net/bnxt/tf_ulp/ulp_gen_tbl.c +14 -4
index 0edbe77a96..dd2b799b30 100644
@@ -5,6 +5,8 @@
 
 #include <rte_log.h>
 #include <rte_malloc.h>
+#include "tf_core.h"
+#include "tfp.h"
 #include "ulp_mapper.h"
 #include "ulp_flow_db.h"
 
@@ -163,18 +165,20 @@ ulp_mapper_gen_tbl_idx_calculate(uint32_t res_sub_type, uint32_t dir)
 }
 
 /*
- * Set the data in the generic table entry
+ * Set the data in the generic table entry, Data is in Big endian format
  *
  * entry [in] - generic table entry
  * offset [in] - The offset in bits where the data has to be set
  * len [in] - The length of the data in bits to be set
  * data [in] - pointer to the data to be used for setting the value.
+ * data_size [in] - length of the data pointer in bytes.
  *
  * returns 0 on success
  */
 int32_t
 ulp_mapper_gen_tbl_entry_data_set(struct ulp_mapper_gen_tbl_entry *entry,
-				  uint32_t offset, uint32_t len, uint8_t *data)
+				  uint32_t offset, uint32_t len, uint8_t *data,
+				  uint32_t data_size)
 {
 	/* validate the null arguments */
 	if (!entry || !data) {
@@ -183,12 +187,17 @@ ulp_mapper_gen_tbl_entry_data_set(struct ulp_mapper_gen_tbl_entry *entry,
 	}
 
 	/* check the size of the buffer for validation */
-	if ((offset + len) > ULP_BYTE_2_BITS(entry->byte_data_size)) {
+	if ((offset + len) > ULP_BYTE_2_BITS(entry->byte_data_size) ||
+	    data_size < ULP_BITS_2_BYTE(len)) {
 		BNXT_TF_DBG(ERR, "invalid offset or length %x:%x:%x\n",
 			    offset, len, entry->byte_data_size);
 		return -EINVAL;
 	}
 
+	/* adjust the data pointer */
+	data = data + (data_size - ULP_BITS_2_BYTE(len));
+
+	/* Push the data into the byte data array */
 	if (entry->byte_order == BNXT_ULP_BYTE_ORDER_LE) {
 		if (ulp_bs_push_lsb(entry->byte_data, offset, len, data) !=
 		    len) {
@@ -208,7 +217,7 @@ ulp_mapper_gen_tbl_entry_data_set(struct ulp_mapper_gen_tbl_entry *entry,
 }
 
 /*
- * Get the data in the generic table entry
+ * Get the data in the generic table entry, Data is in Big endian format
  *
  * entry [in] - generic table entry
  * offset [in] - The offset in bits where the data has to get
@@ -298,6 +307,7 @@ ulp_mapper_gen_tbl_res_free(struct bnxt_ulp_context *ulp_ctx,
 			    tbl_idx, res->resource_hndl);
 		return -EINVAL;
 	}
+	fid = tfp_be_to_cpu_32(fid);
 
 	/* Destroy the flow associated with the shared flow id */
 	if (ulp_mapper_flow_destroy(ulp_ctx, BNXT_ULP_FDB_TYPE_REGULAR,
drivers/net/bnxt/tf_ulp/ulp_gen_tbl.h +3 -1
index c8a1112af4..701a8d10e5 100644
@@ -104,12 +104,14 @@ ulp_mapper_gen_tbl_idx_calculate(uint32_t res_sub_type, uint32_t dir);
  * offset [in] - The offset in bits where the data has to be set
  * len [in] - The length of the data in bits to be set
  * data [in] - pointer to the data to be used for setting the value.
+ * data_size [in] - length of the data pointer in bytes.
  *
  * returns 0 on success
  */
 int32_t
 ulp_mapper_gen_tbl_entry_data_set(struct ulp_mapper_gen_tbl_entry *entry,
-				  uint32_t offset, uint32_t len, uint8_t *data);
+				  uint32_t offset, uint32_t len, uint8_t *data,
+				  uint32_t data_size);
 
 /*
  * Get the data in the generic table entry
drivers/net/bnxt/tf_ulp/ulp_mapper.c +384 -290

896 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_template_db_enum.h +22 -0
index ddc396b3f9..b9a81d881b 100644
@@ -3,6 +3,8 @@
  * All rights reserved.
  */
 
+/* date: Thu Oct 15 17:28:37 2020 */
+
 #ifndef ULP_TEMPLATE_DB_H_
 #define ULP_TEMPLATE_DB_H_
 
@@ -230,6 +232,26 @@ enum bnxt_ulp_hdr_type {
 	BNXT_ULP_HDR_TYPE_LAST = 3
 };
 
+enum bnxt_ulp_if_tbl_opc {
+	BNXT_ULP_IF_TBL_OPC_NOT_USED = 0,
+	BNXT_ULP_IF_TBL_OPC_WR_COMP_FIELD = 1,
+	BNXT_ULP_IF_TBL_OPC_WR_REGFILE = 2,
+	BNXT_ULP_IF_TBL_OPC_WR_CONST = 3,
+	BNXT_ULP_IF_TBL_OPC_RD_COMP_FIELD = 4,
+	BNXT_ULP_IF_TBL_OPC_LAST = 5
+};
+
+enum bnxt_ulp_index_tbl_opc {
+	BNXT_ULP_INDEX_TBL_OPC_NOT_USED = 0,
+	BNXT_ULP_INDEX_TBL_OPC_ALLOC_REGFILE = 1,
+	BNXT_ULP_INDEX_TBL_OPC_ALLOC_WR_REGFILE = 2,
+	BNXT_ULP_INDEX_TBL_OPC_SRCH_ALLOC_WR_REGFILE = 3,
+	BNXT_ULP_INDEX_TBL_OPC_WR_GLB_REGFILE = 4,
+	BNXT_ULP_INDEX_TBL_OPC_WR_REGFILE = 5,
+	BNXT_ULP_INDEX_TBL_OPC_RD_REGFILE = 6,
+	BNXT_ULP_INDEX_TBL_OPC_LAST = 7
+};
+
 enum bnxt_ulp_index_opcode {
 	BNXT_ULP_INDEX_OPCODE_NOT_USED = 0,
 	BNXT_ULP_INDEX_OPCODE_ALLOCATE = 1,
drivers/net/bnxt/tf_ulp/ulp_template_db_wh_plus_act.c +54 -54

282 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_template_db_wh_plus_class.c +35 -34

171 lines not on this page · raw message

Signature · 1 line
2.17.1
#33 lore raw

PATCH 33/58 net/bnxt: modify ULP priority opcode processing

In reply to Venkat Duvvuru

From: Kishore Padmanabha <[email protected]>

Added ulp priority opcode to enable flexibility to the usage of the flow priority. New opcodes help template specify the flow priority accordingly.

---
 drivers/net/bnxt/tf_ulp/bnxt_ulp.h            |   7 +
 drivers/net/bnxt/tf_ulp/ulp_fc_mgr.c          |  27 +-
 drivers/net/bnxt/tf_ulp/ulp_flow_db.c         |  23 +-
 drivers/net/bnxt/tf_ulp/ulp_flow_db.h         |   3 +-
 drivers/net/bnxt/tf_ulp/ulp_mapper.c          |  92 +-
 drivers/net/bnxt/tf_ulp/ulp_mapper.h          |   1 +
 .../net/bnxt/tf_ulp/ulp_template_db_enum.h    |  75 +-
 .../tf_ulp/ulp_template_db_stingray_act.c     | 835 ++++++++++++++----
 .../tf_ulp/ulp_template_db_stingray_class.c   | 620 +++++++------
 drivers/net/bnxt/tf_ulp/ulp_template_db_tbl.c |  12 +-
 drivers/net/bnxt/tf_ulp/ulp_template_db_tbl.h |  14 +-
 .../bnxt/tf_ulp/ulp_template_db_wh_plus_act.c | 725 ++++++++++++---
 .../tf_ulp/ulp_template_db_wh_plus_class.c    | 506 ++++++-----
 drivers/net/bnxt/tf_ulp/ulp_template_struct.h |  18 +-
 14 files changed, 1959 insertions(+), 999 deletions(-)
drivers/net/bnxt/tf_ulp/bnxt_ulp.h +7 -0
index 330965061a..96aef28b92 100644
@@ -30,6 +30,13 @@
 #define BNXT_ULP_VF_REP_ENABLED		0x1
 #define ULP_VF_REP_IS_ENABLED(flag)	((flag) & BNXT_ULP_VF_REP_ENABLED)
 
+enum bnxt_ulp_flow_mem_type {
+	BNXT_ULP_FLOW_MEM_TYPE_INT = 0,
+	BNXT_ULP_FLOW_MEM_TYPE_EXT = 1,
+	BNXT_ULP_FLOW_MEM_TYPE_BOTH = 2,
+	BNXT_ULP_FLOW_MEM_TYPE_LAST = 3
+};
+
 struct bnxt_ulp_df_rule_info {
 	uint32_t			port_to_app_flow_id;
 	uint32_t			app_to_port_flow_id;
drivers/net/bnxt/tf_ulp/ulp_fc_mgr.c +16 -11
index 3eddbd6831..054a76b5ee 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2014-2021 Broadcom
+ * Copyright(c) 2014-2020 Broadcom
  * All rights reserved.
  */
 
@@ -251,7 +251,8 @@ ulp_bulk_get_flow_stats(struct tf *tfp,
 	 */
 	parms.entry_sz_in_bytes = sizeof(uint64_t);
 	stats = (uint64_t *)fc_info->shadow_hw_tbl[dir].mem_va;
-	parms.physical_mem_addr = (uintptr_t)fc_info->shadow_hw_tbl[dir].mem_pa;
+	parms.physical_mem_addr = (uint64_t)
+		((uintptr_t)(fc_info->shadow_hw_tbl[dir].mem_pa));
 
 	if (!stats) {
 		PMD_DRV_LOG(ERR,
@@ -588,11 +589,11 @@ int ulp_fc_mgr_query_count_get(struct bnxt_ulp_context *ctxt,
 		if (params.resource_func ==
 		     BNXT_ULP_RESOURCE_FUNC_INDEX_TABLE &&
 		     (params.resource_sub_type ==
-		      BNXT_ULP_RESOURCE_SUB_TYPE_INDEX_TYPE_INT_COUNT ||
+		      BNXT_ULP_RESOURCE_SUB_TYPE_INDEX_TABLE_INT_COUNT ||
 		      params.resource_sub_type ==
-		      BNXT_ULP_RESOURCE_SUB_TYPE_INDEX_TYPE_EXT_COUNT ||
+		      BNXT_ULP_RESOURCE_SUB_TYPE_INDEX_TABLE_EXT_COUNT ||
 		      params.resource_sub_type ==
-		      BNXT_ULP_RESOURCE_SUB_TYPE_INDEX_TYPE_INT_COUNT_ACC)) {
+		      BNXT_ULP_RESOURCE_SUB_TYPE_INDEX_TABLE_INT_COUNT_ACC)) {
 			found_cntr_resource = true;
 			break;
 		}
@@ -606,7 +607,10 @@ int ulp_fc_mgr_query_count_get(struct bnxt_ulp_context *ctxt,
 	dir = params.direction;
 	hw_cntr_id = params.resource_hndl;
 	if (params.resource_sub_type ==
-			BNXT_ULP_RESOURCE_SUB_TYPE_INDEX_TYPE_INT_COUNT) {
+			BNXT_ULP_RESOURCE_SUB_TYPE_INDEX_TABLE_INT_COUNT) {
+		/* TODO:
+		 * Think about optimizing with try_lock later
+		 */
 		pthread_mutex_lock(&ulp_fc_info->fc_lock);
 		sw_cntr_idx = hw_cntr_id -
 			ulp_fc_info->shadow_hw_tbl[dir].start_idx;
@@ -623,11 +627,12 @@ int ulp_fc_mgr_query_count_get(struct bnxt_ulp_context *ctxt,
 		}
 		pthread_mutex_unlock(&ulp_fc_info->fc_lock);
 	} else if (params.resource_sub_type ==
-			BNXT_ULP_RESOURCE_SUB_TYPE_INDEX_TYPE_INT_COUNT_ACC) {
-		/* Get stats from the parent child table */
-		ulp_flow_db_parent_flow_count_get(ctxt, flow_id,
-						  &count->hits, &count->bytes,
-						  count->reset);
+			BNXT_ULP_RESOURCE_SUB_TYPE_INDEX_TABLE_INT_COUNT_ACC) {
+		/* Get the stats from the parent child table */
+		ulp_flow_db_parent_flow_count_get(ctxt,
+						  flow_id,
+						  &count->hits,
+						  &count->bytes);
 		count->hits_set = 1;
 		count->bytes_set = 1;
 	} else {
drivers/net/bnxt/tf_ulp/ulp_flow_db.c +10 -13
index 8669edfeba..c599e0c7e1 100644
@@ -720,7 +720,7 @@ ulp_flow_db_resource_add(struct bnxt_ulp_context *ulp_ctxt,
 
 	if (params->resource_type == TF_TBL_TYPE_ACT_STATS_64 &&
 	    params->resource_sub_type ==
-	    BNXT_ULP_RESOURCE_SUB_TYPE_INDEX_TYPE_INT_COUNT) {
+	    BNXT_ULP_RESOURCE_SUB_TYPE_INDEX_TABLE_INT_COUNT) {
 		/* Store the first HW counter ID for this table */
 		if (!ulp_fc_mgr_start_idx_isset(ulp_ctxt, params->direction))
 			ulp_fc_mgr_start_idx_set(ulp_ctxt, params->direction,
@@ -833,7 +833,7 @@ ulp_flow_db_resource_del(struct bnxt_ulp_context *ulp_ctxt,
 	 */
 	if (params->resource_type == TF_TBL_TYPE_ACT_STATS_64 &&
 	    params->resource_sub_type ==
-	    BNXT_ULP_RESOURCE_SUB_TYPE_INDEX_TYPE_INT_COUNT) {
+	    BNXT_ULP_RESOURCE_SUB_TYPE_INDEX_TABLE_INT_COUNT) {
 		ulp_fc_mgr_cntr_reset(ulp_ctxt, params->direction,
 				      params->resource_hndl);
 	}
@@ -1259,7 +1259,7 @@ ulp_default_flow_db_cfa_action_get(struct bnxt_ulp_context *ulp_ctx,
 				   uint32_t flow_id,
 				   uint16_t *cfa_action)
 {
-	uint8_t sub_type = BNXT_ULP_RESOURCE_SUB_TYPE_INDEX_TYPE_VFR_CFA_ACTION;
+	uint8_t sub_typ = BNXT_ULP_RESOURCE_SUB_TYPE_INDEX_TABLE_VFR_CFA_ACTION;
 	struct ulp_flow_db_res_params params;
 	int32_t rc;
 
@@ -1267,7 +1267,7 @@ ulp_default_flow_db_cfa_action_get(struct bnxt_ulp_context *ulp_ctx,
 					     BNXT_ULP_FDB_TYPE_DEFAULT,
 					     flow_id,
 					     BNXT_ULP_RESOURCE_FUNC_INDEX_TABLE,
-					     sub_type, &params);
+					     sub_typ, &params);
 	if (rc) {
 		BNXT_TF_DBG(ERR, "CFA Action ptr not found for flow id %u\n",
 			    flow_id);
@@ -1647,7 +1647,7 @@ int32_t
 ulp_flow_db_parent_flow_create(struct bnxt_ulp_mapper_parms *parms)
 {
 	struct ulp_flow_db_res_params fid_parms;
-	uint32_t sub_type = BNXT_ULP_RESOURCE_SUB_TYPE_INDEX_TYPE_INT_COUNT_ACC;
+	uint32_t sub_typ = BNXT_ULP_RESOURCE_SUB_TYPE_INDEX_TABLE_INT_COUNT_ACC;
 	struct ulp_flow_db_res_params res_params;
 	int32_t fid_idx, rc;
 
@@ -1676,7 +1676,7 @@ ulp_flow_db_parent_flow_create(struct bnxt_ulp_mapper_parms *parms)
 					     BNXT_ULP_FDB_TYPE_REGULAR,
 					     parms->fid,
 					     BNXT_ULP_RESOURCE_FUNC_INDEX_TABLE,
-					     sub_type,
+					     sub_typ,
 					     &res_params)) {
 		/* Enable the counter accumulation in parent entry */
 		if (ulp_flow_db_parent_flow_count_accum_set(parms->ulp_ctx,
@@ -1708,7 +1708,7 @@ int32_t
 ulp_flow_db_child_flow_create(struct bnxt_ulp_mapper_parms *parms)
 {
 	struct ulp_flow_db_res_params fid_parms;
-	uint32_t sub_type = BNXT_ULP_RESOURCE_SUB_TYPE_INDEX_TYPE_INT_COUNT;
+	uint32_t sub_type = BNXT_ULP_RESOURCE_SUB_TYPE_INDEX_TABLE_INT_COUNT;
 	enum bnxt_ulp_resource_func res_fun;
 	struct ulp_flow_db_res_params res_p;
 	uint32_t parent_fid = parms->parent_fid;
@@ -1819,8 +1819,9 @@ ulp_flow_db_parent_flow_count_update(struct bnxt_ulp_context *ulp_ctxt,
  */
 int32_t
 ulp_flow_db_parent_flow_count_get(struct bnxt_ulp_context *ulp_ctxt,
-				  uint32_t parent_fid, uint64_t *packet_count,
-				  uint64_t *byte_count, uint8_t count_reset)
+				  uint32_t parent_fid,
+				  uint64_t *packet_count,
+				  uint64_t *byte_count)
 {
 	struct bnxt_ulp_flow_db *flow_db;
 	struct ulp_fdb_parent_child_db *p_pdb;
@@ -1841,10 +1842,6 @@ ulp_flow_db_parent_flow_count_get(struct bnxt_ulp_context *ulp_ctxt,
 					p_pdb->parent_flow_tbl[idx].pkt_count;
 				*byte_count =
 					p_pdb->parent_flow_tbl[idx].byte_count;
-				if (count_reset) {
-					p_pdb->parent_flow_tbl[idx].pkt_count = 0;
-					p_pdb->parent_flow_tbl[idx].byte_count = 0;
-				}
 			}
 			return 0;
 		}
drivers/net/bnxt/tf_ulp/ulp_flow_db.h +1 -2
index 62c914833b..14369271ff 100644
@@ -390,8 +390,7 @@ int32_t
 ulp_flow_db_parent_flow_count_get(struct bnxt_ulp_context *ulp_ctxt,
 				  uint32_t parent_fid,
 				  uint64_t *packet_count,
-				  uint64_t *byte_count,
-				  uint8_t count_reset);
+				  uint64_t *byte_count);
 
 /*
  * reset the parent accumulation counters
drivers/net/bnxt/tf_ulp/ulp_mapper.c +69 -23

210 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_mapper.h +1 -0
index 4c423d2374..bef72696d3 100644
@@ -56,6 +56,7 @@ struct bnxt_ulp_mapper_parms {
 	uint32_t				parent_fid;
 	uint32_t				parent_flow;
 	uint8_t					tun_idx;
+	uint32_t				app_priority;
 };
 
 struct bnxt_ulp_mapper_create_parms {
drivers/net/bnxt/tf_ulp/ulp_template_db_enum.h +23 -52

119 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_template_db_stingray_act.c +643 -192

2,508 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_template_db_stingray_class.c +306 -314

620 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_template_db_tbl.c +6 -6
index 4fe90d8bb9..bb48ad284a 100644

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

drivers/net/bnxt/tf_ulp/ulp_template_db_tbl.h +9 -5
index a656f3da52..dbfcc46164 100644

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

drivers/net/bnxt/tf_ulp/ulp_template_db_wh_plus_act.c +588 -137

725 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_template_db_wh_plus_class.c +272 -234

506 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_template_struct.h +8 -10
index b253aefe8d..23b4c89896 100644

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

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

Signature · 1 line
2.17.1

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

#34 lore raw

PATCH 34/58 net/bnxt: add support for conflict resolution

In reply to Venkat Duvvuru

From: Kishore Padmanabha <[email protected]>

Conflict resolution feature allows rejection of flows based on the previously added flows that conflict. For instance, a five tuple flow is added and then you add a new flow with only 4 tuple instead having same layer2 details then it will be rejected.

---
 drivers/net/bnxt/tf_ulp/bnxt_tf_common.h      |     2 +-
 drivers/net/bnxt/tf_ulp/bnxt_ulp.c            |    14 +-
 drivers/net/bnxt/tf_ulp/bnxt_ulp.h            |     2 +-
 drivers/net/bnxt/tf_ulp/bnxt_ulp_flow.c       |    10 +-
 drivers/net/bnxt/tf_ulp/meson.build           |     1 +
 drivers/net/bnxt/tf_ulp/ulp_def_rules.c       |    12 +-
 drivers/net/bnxt/tf_ulp/ulp_fc_mgr.h          |     2 +-
 drivers/net/bnxt/tf_ulp/ulp_flow_db.c         |    64 +-
 drivers/net/bnxt/tf_ulp/ulp_flow_db.h         |     2 +-
 drivers/net/bnxt/tf_ulp/ulp_gen_tbl.c         |    38 +-
 drivers/net/bnxt/tf_ulp/ulp_gen_tbl.h         |     3 +-
 drivers/net/bnxt/tf_ulp/ulp_mapper.c          |   789 +-
 drivers/net/bnxt/tf_ulp/ulp_mark_mgr.c        |     2 +-
 drivers/net/bnxt/tf_ulp/ulp_mark_mgr.h        |     2 +-
 drivers/net/bnxt/tf_ulp/ulp_matcher.c         |     4 +-
 drivers/net/bnxt/tf_ulp/ulp_matcher.h         |     2 +-
 drivers/net/bnxt/tf_ulp/ulp_port_db.c         |     6 +-
 drivers/net/bnxt/tf_ulp/ulp_port_db.h         |     2 +-
 drivers/net/bnxt/tf_ulp/ulp_rte_handler_tbl.c |   412 +
 drivers/net/bnxt/tf_ulp/ulp_rte_parser.c      |    55 +-
 drivers/net/bnxt/tf_ulp/ulp_rte_parser.h      |     2 +-
 drivers/net/bnxt/tf_ulp/ulp_template_db_act.c |   768 +-
 .../net/bnxt/tf_ulp/ulp_template_db_class.c   |  4146 +--
 .../net/bnxt/tf_ulp/ulp_template_db_enum.h    |  1235 +-
 .../net/bnxt/tf_ulp/ulp_template_db_field.h   |  1396 +-
 .../tf_ulp/ulp_template_db_stingray_act.c     |  3706 +-
 .../tf_ulp/ulp_template_db_stingray_class.c   | 28599 ++++-----------
 drivers/net/bnxt/tf_ulp/ulp_template_db_tbl.c |  1024 +-
 drivers/net/bnxt/tf_ulp/ulp_template_db_tbl.h |    24 +-
 .../bnxt/tf_ulp/ulp_template_db_wh_plus_act.c |  3705 +-
 .../tf_ulp/ulp_template_db_wh_plus_class.c    | 28654 ++++------------
 drivers/net/bnxt/tf_ulp/ulp_template_struct.h |    63 +-
 drivers/net/bnxt/tf_ulp/ulp_tun.c             |   227 +-
 drivers/net/bnxt/tf_ulp/ulp_tun.h             |    39 +-
 drivers/net/bnxt/tf_ulp/ulp_utils.c           |    16 +-
 drivers/net/bnxt/tf_ulp/ulp_utils.h           |    12 +-
 36 files changed, 15693 insertions(+), 59347 deletions(-)
 create mode 100644 drivers/net/bnxt/tf_ulp/ulp_rte_handler_tbl.c
drivers/net/bnxt/tf_ulp/bnxt_tf_common.h +1 -1
index 7b405f4dc3..b2629e47b6 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2014-2021 Broadcom
+ * Copyright(c) 2014-2019 Broadcom
  * All rights reserved.
  */
 
drivers/net/bnxt/tf_ulp/bnxt_ulp.c +3 -11
index 59fb530fb1..458c37b4e9 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2019-2021 Broadcom
+ * Copyright(c) 2019-2020 Broadcom
  * All rights reserved.
  */
 
@@ -22,7 +22,6 @@
 #include "ulp_flow_db.h"
 #include "ulp_mapper.h"
 #include "ulp_port_db.h"
-#include "ulp_tun.h"
 
 /* Linked list of all TF sessions. */
 STAILQ_HEAD(, bnxt_ulp_session_state) bnxt_ulp_session_list =
@@ -55,14 +54,13 @@ bnxt_ulp_devid_get(struct bnxt *bp,
 {
 	if (BNXT_CHIP_P5(bp))
 		return -EINVAL;
-	/* Assuming Whitney */
-	*ulp_dev_id = BNXT_ULP_DEVICE_ID_WH_PLUS;
 
 	if (BNXT_STINGRAY(bp))
 		*ulp_dev_id = BNXT_ULP_DEVICE_ID_STINGRAY;
 	else
 		/* Assuming Whitney */
 		*ulp_dev_id = BNXT_ULP_DEVICE_ID_WH_PLUS;
+
 	return 0;
 }
 
@@ -400,21 +398,18 @@ ulp_eem_tbl_scope_init(struct bnxt *bp)
 
 	if (bnxt_ulp_cntxt_mem_type_get(bp->ulp_ctx, &mtype))
 		return -EINVAL;
-
 	if (mtype != BNXT_ULP_FLOW_MEM_TYPE_EXT) {
 		BNXT_TF_DBG(INFO, "Table Scope alloc is not required\n");
 		return 0;
 	}
 
 	bnxt_init_tbl_scope_parms(bp, &params);
-
 	rc = tf_alloc_tbl_scope(&bp->tfp, &params);
 	if (rc) {
 		BNXT_TF_DBG(ERR, "Unable to allocate eem table scope rc = %d\n",
 			    rc);
 		return rc;
 	}
-
 	rc = bnxt_ulp_cntxt_tbl_scope_id_set(bp->ulp_ctx, params.tbl_scope_id);
 	if (rc) {
 		BNXT_TF_DBG(ERR, "Unable to set table scope id\n");
@@ -534,8 +529,6 @@ ulp_ctx_init(struct bnxt *bp,
 	if (rc)
 		goto error_deinit;
 
-	ulp_tun_tbl_init(ulp_data->tun_tbl);
-
 	bnxt_ulp_cntxt_tfp_set(bp->ulp_ctx, &bp->tfp);
 	return rc;
 
@@ -547,8 +540,7 @@ ulp_ctx_init(struct bnxt *bp,
 
 /* The function to initialize ulp dparms with devargs */
 static int32_t
-ulp_dparms_init(struct bnxt *bp,
-		struct bnxt_ulp_context *ulp_ctx)
+ulp_dparms_init(struct bnxt *bp, struct bnxt_ulp_context *ulp_ctx)
 {
 	struct bnxt_ulp_device_params *dparms;
 	uint32_t dev_id;
drivers/net/bnxt/tf_ulp/bnxt_ulp.h +1 -1
index 96aef28b92..c2e71430ec 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2019-2021 Broadcom
+ * Copyright(c) 2019-2020 Broadcom
  * All rights reserved.
  */
 
drivers/net/bnxt/tf_ulp/bnxt_ulp_flow.c +7 -3
index 836e94bc60..1655b0f29a 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2014-2021 Broadcom
+ * Copyright(c) 2014-2020 Broadcom
  * All rights reserved.
  */
 
@@ -79,7 +79,6 @@ bnxt_ulp_init_mapper_params(struct bnxt_ulp_mapper_create_parms *mapper_cparms,
 			    struct ulp_rte_parser_params *params,
 			    enum bnxt_ulp_fdb_type flow_type)
 {
-	memset(mapper_cparms, 0, sizeof(*mapper_cparms));
 	mapper_cparms->flow_type	= flow_type;
 	mapper_cparms->app_priority	= params->priority;
 	mapper_cparms->dir_attr		= params->dir_attr;
@@ -95,6 +94,12 @@ bnxt_ulp_init_mapper_params(struct bnxt_ulp_mapper_create_parms *mapper_cparms,
 	mapper_cparms->parent_flow	= params->parent_flow;
 	mapper_cparms->parent_fid	= params->parent_fid;
 	mapper_cparms->fld_bitmap	= &params->fld_bitmap;
+
+	/* update the signature fields into the computed field list */
+	ULP_COMP_FLD_IDX_WR(params, BNXT_ULP_CF_IDX_HDR_SIG_ID,
+			    params->hdr_sig_id);
+	ULP_COMP_FLD_IDX_WR(params, BNXT_ULP_CF_IDX_FLOW_SIG_ID,
+			    params->flow_sig_id);
 }
 
 /* Function to create the rte flow. */
@@ -177,7 +182,6 @@ bnxt_ulp_flow_create(struct rte_eth_dev *dev,
 	params.fid = fid;
 	params.func_id = func_id;
 	params.priority = attr->priority;
-	params.port_id = dev->data->port_id;
 	/* Perform the rte flow post process */
 	ret = bnxt_ulp_rte_parser_post_process(&params);
 	if (ret == BNXT_TF_RC_ERROR)
drivers/net/bnxt/tf_ulp/meson.build +1 -0
index 611d7ab58e..701a510f27 100644
@@ -23,6 +23,7 @@ sources += files(
         'ulp_fc_mgr.c',
         'ulp_tun.c',
         'ulp_gen_tbl.c',
+	'ulp_rte_handler_tbl.c',
         'ulp_template_db_wh_plus_act.c',
         'ulp_template_db_wh_plus_class.c',
         'ulp_template_db_stingray_act.c',
drivers/net/bnxt/tf_ulp/ulp_def_rules.c +6 -6
index 8a3c5ee8fb..5e9b12e4f5 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2019-2021 Broadcom
+ * Copyright(c) 2019-2020 Broadcom
  * All rights reserved.
  */
 
@@ -366,7 +366,7 @@ ulp_default_flow_create(struct rte_eth_dev *eth_dev,
 		goto err1;
 	}
 
-	rc = ulp_flow_db_fid_alloc(ulp_ctx, BNXT_ULP_FDB_TYPE_DEFAULT,
+	rc = ulp_flow_db_fid_alloc(ulp_ctx, mapper_params.flow_type,
 				   mapper_params.func_id, &fid);
 	if (rc) {
 		BNXT_TF_DBG(ERR, "Unable to allocate flow table entry\n");
@@ -383,7 +383,7 @@ ulp_default_flow_create(struct rte_eth_dev *eth_dev,
 	return 0;
 
 err3:
-	ulp_flow_db_fid_free(ulp_ctx, BNXT_ULP_FDB_TYPE_DEFAULT, fid);
+	ulp_flow_db_fid_free(ulp_ctx, mapper_params.flow_type, fid);
 err2:
 	bnxt_ulp_cntxt_release_fdb_lock(ulp_ctx);
 err1:
@@ -437,7 +437,7 @@ void
 bnxt_ulp_destroy_df_rules(struct bnxt *bp, bool global)
 {
 	struct bnxt_ulp_df_rule_info *info;
-	uint16_t port_id;
+	uint8_t port_id;
 
 	if (!BNXT_TRUFLOW_EN(bp) ||
 	    BNXT_ETH_DEV_IS_REPRESENTOR(bp->eth_dev))
@@ -501,7 +501,7 @@ int32_t
 bnxt_ulp_create_df_rules(struct bnxt *bp)
 {
 	struct bnxt_ulp_df_rule_info *info;
-	uint16_t port_id;
+	uint8_t port_id;
 	int rc;
 
 	if (!BNXT_TRUFLOW_EN(bp) ||
@@ -575,7 +575,7 @@ bnxt_ulp_create_vfr_default_rules(struct rte_eth_dev *vfr_ethdev)
 	struct rte_eth_dev *parent_dev = vfr->parent_dev;
 	struct bnxt *bp = parent_dev->data->dev_private;
 	uint16_t vfr_port_id = vfr_ethdev->data->port_id;
-	uint16_t port_id;
+	uint8_t port_id;
 	int rc;
 
 	if (!bp || !BNXT_TRUFLOW_EN(bp))
drivers/net/bnxt/tf_ulp/ulp_fc_mgr.h +1 -1
index 04cb86bea2..de4d3dfe95 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2014-2021 Broadcom
+ * Copyright(c) 2014-2019 Broadcom
  * All rights reserved.
  */
 
drivers/net/bnxt/tf_ulp/ulp_flow_db.c +36 -28

187 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_flow_db.h +1 -1
index 14369271ff..f7dfd67bed 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2014-2021 Broadcom
+ * Copyright(c) 2014-2019 Broadcom
  * All rights reserved.
  */
 
drivers/net/bnxt/tf_ulp/ulp_gen_tbl.c +9 -29
index dd2b799b30..a762408d77 100644
@@ -47,7 +47,7 @@ ulp_mapper_generic_tbl_list_init(struct bnxt_ulp_mapper_data *mapper_data)
 		if (tbl->result_num_entries != 0) {
 			/* add 4 bytes for reference count */
 			entry->mem_data_size = (tbl->result_num_entries + 1) *
-				(tbl->result_byte_size + sizeof(uint32_t));
+				(tbl->result_num_bytes + sizeof(uint32_t));
 
 			/* allocate the big chunk of memory */
 			entry->mem_data = rte_zmalloc("ulp mapper gen tbl",
@@ -60,7 +60,7 @@ ulp_mapper_generic_tbl_list_init(struct bnxt_ulp_mapper_data *mapper_data)
 			}
 			/* Populate the generic table container */
 			entry->container.num_elem = tbl->result_num_entries;
-			entry->container.byte_data_size = tbl->result_byte_size;
+			entry->container.byte_data_size = tbl->result_num_bytes;
 			entry->container.ref_count =
 				(uint32_t *)entry->mem_data;
 			size = sizeof(uint32_t) * (tbl->result_num_entries + 1);
@@ -168,7 +168,6 @@ ulp_mapper_gen_tbl_idx_calculate(uint32_t res_sub_type, uint32_t dir)
  * Set the data in the generic table entry, Data is in Big endian format
  *
  * entry [in] - generic table entry
- * offset [in] - The offset in bits where the data has to be set
  * len [in] - The length of the data in bits to be set
  * data [in] - pointer to the data to be used for setting the value.
  * data_size [in] - length of the data pointer in bytes.
@@ -177,7 +176,7 @@ ulp_mapper_gen_tbl_idx_calculate(uint32_t res_sub_type, uint32_t dir)
  */
 int32_t
 ulp_mapper_gen_tbl_entry_data_set(struct ulp_mapper_gen_tbl_entry *entry,
-				  uint32_t offset, uint32_t len, uint8_t *data,
+				  uint32_t len, uint8_t *data,
 				  uint32_t data_size)
 {
 	/* validate the null arguments */
@@ -187,32 +186,13 @@ ulp_mapper_gen_tbl_entry_data_set(struct ulp_mapper_gen_tbl_entry *entry,
 	}
 
 	/* check the size of the buffer for validation */
-	if ((offset + len) > ULP_BYTE_2_BITS(entry->byte_data_size) ||
+	if (len > ULP_BYTE_2_BITS(entry->byte_data_size) ||
 	    data_size < ULP_BITS_2_BYTE(len)) {
-		BNXT_TF_DBG(ERR, "invalid offset or length %x:%x:%x\n",
-			    offset, len, entry->byte_data_size);
+		BNXT_TF_DBG(ERR, "invalid offset or length %x:%x\n",
+			    len, entry->byte_data_size);
 		return -EINVAL;
 	}
-
-	/* adjust the data pointer */
-	data = data + (data_size - ULP_BITS_2_BYTE(len));
-
-	/* Push the data into the byte data array */
-	if (entry->byte_order == BNXT_ULP_BYTE_ORDER_LE) {
-		if (ulp_bs_push_lsb(entry->byte_data, offset, len, data) !=
-		    len) {
-			BNXT_TF_DBG(ERR, "write failed offset = %x, len =%x\n",
-				    offset, len);
-			return -EIO;
-		}
-	} else {
-		if (ulp_bs_push_msb(entry->byte_data, offset, len, data) !=
-		    len) {
-			BNXT_TF_DBG(ERR, "write failed offset = %x, len =%x\n",
-				    offset, len);
-			return -EIO;
-		}
-	}
+	memcpy(entry->byte_data, data, ULP_BITS_2_BYTE(len));
 	return 0;
 }
 
@@ -267,7 +247,7 @@ ulp_mapper_gen_tbl_res_free(struct bnxt_ulp_context *ulp_ctx,
 {
 	struct ulp_mapper_gen_tbl_entry entry;
 	int32_t tbl_idx;
-	uint32_t fid;
+	uint32_t fid = 0;
 
 	/* Extract the resource sub type and direction */
 	tbl_idx = ulp_mapper_gen_tbl_idx_calculate(res->resource_sub_type,
@@ -310,7 +290,7 @@ ulp_mapper_gen_tbl_res_free(struct bnxt_ulp_context *ulp_ctx,
 	fid = tfp_be_to_cpu_32(fid);
 
 	/* Destroy the flow associated with the shared flow id */
-	if (ulp_mapper_flow_destroy(ulp_ctx, BNXT_ULP_FDB_TYPE_REGULAR,
+	if (ulp_mapper_flow_destroy(ulp_ctx, BNXT_ULP_FDB_TYPE_RID,
 				    fid))
 		BNXT_TF_DBG(ERR, "Error in deleting shared flow id %x\n", fid);
 
drivers/net/bnxt/tf_ulp/ulp_gen_tbl.h +1 -2
index 701a8d10e5..6236dc3ca2 100644
@@ -101,7 +101,6 @@ ulp_mapper_gen_tbl_idx_calculate(uint32_t res_sub_type, uint32_t dir);
  * Set the data in the generic table entry
  *
  * entry [in] - generic table entry
- * offset [in] - The offset in bits where the data has to be set
  * len [in] - The length of the data in bits to be set
  * data [in] - pointer to the data to be used for setting the value.
  * data_size [in] - length of the data pointer in bytes.
@@ -110,7 +109,7 @@ ulp_mapper_gen_tbl_idx_calculate(uint32_t res_sub_type, uint32_t dir);
  */
 int32_t
 ulp_mapper_gen_tbl_entry_data_set(struct ulp_mapper_gen_tbl_entry *entry,
-				  uint32_t offset, uint32_t len, uint8_t *data,
+				  uint32_t len, uint8_t *data,
 				  uint32_t data_size);
 
 /*
drivers/net/bnxt/tf_ulp/ulp_mapper.c +398 -391

1,207 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_mark_mgr.c +1 -1
index 06ad5a94e2..8b8dccf9f1 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2014-2021 Broadcom
+ * Copyright(c) 2014-2020 Broadcom
  * All rights reserved.
  */
 
drivers/net/bnxt/tf_ulp/ulp_mark_mgr.h +1 -1
index d9d82d4644..9696730cc2 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2014-2021 Broadcom
+ * Copyright(c) 2014-2019 Broadcom
  * All rights reserved.
  */
 
drivers/net/bnxt/tf_ulp/ulp_matcher.c +3 -1
index e23867f8b9..6e2506cfa3 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2014-2021 Broadcom
+ * Copyright(c) 2014-2020 Broadcom
  * All rights reserved.
  */
 
@@ -77,6 +77,8 @@ ulp_matcher_pattern_match(struct ulp_rte_parser_params *params,
 	BNXT_TF_DBG(DEBUG, "Found matching pattern template %d\n",
 		    class_match->class_tid);
 	*class_id = class_match->class_tid;
+	params->hdr_sig_id = class_match->hdr_sig_id;
+	params->flow_sig_id = class_match->flow_sig_id;
 	return BNXT_TF_RC_SUCCESS;
 
 error:
drivers/net/bnxt/tf_ulp/ulp_matcher.h +1 -1
index dc2487889c..a582188252 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2014-2021 Broadcom
+ * Copyright(c) 2014-2020 Broadcom
  * All rights reserved.
  */
 
drivers/net/bnxt/tf_ulp/ulp_port_db.c +2 -4
index a11e6786c0..94075784d8 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2014-2021 Broadcom
+ * Copyright(c) 2014-2020 Broadcom
  * All rights reserved.
  */
 
@@ -185,15 +185,13 @@ int32_t	ulp_port_db_dev_port_intf_update(struct bnxt_ulp_context *ulp_ctxt,
 	port_data = &port_db->phy_port_list[func->phy_port_id];
 	if (!port_data->port_valid) {
 		port_data->port_svif =
-			bnxt_get_svif(port_id, false,
-				      BNXT_ULP_INTF_TYPE_INVALID);
+			bnxt_get_svif(port_id, false, BNXT_ULP_INTF_TYPE_INVALID);
 		port_data->port_spif = bnxt_get_phy_port_id(port_id);
 		port_data->port_parif =
 			bnxt_get_parif(port_id, BNXT_ULP_INTF_TYPE_INVALID);
 		port_data->port_vport = bnxt_get_vport(port_id);
 		port_data->port_valid = true;
 	}
-
 	return 0;
 }
 
drivers/net/bnxt/tf_ulp/ulp_port_db.h +1 -1
index ae2b71df25..7b85987a0c 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2014-2021 Broadcom
+ * Copyright(c) 2014-2019 Broadcom
  * All rights reserved.
  */
 
drivers/net/bnxt/tf_ulp/ulp_rte_handler_tbl.c new file +412 -0

412 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_rte_parser.c +18 -37

153 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_rte_parser.h +1 -1
index 27a5131bb3..7996317903 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2014-2021 Broadcom
+ * Copyright(c) 2014-2020 Broadcom
  * All rights reserved.
  */
 
drivers/net/bnxt/tf_ulp/ulp_template_db_act.c +48 -720

702 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_template_db_class.c +514 -3632

4,146 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_template_db_enum.h +622 -613

1,235 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_template_db_field.h +214 -1182

1,396 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_template_db_stingray_act.c +317 -3389

3,706 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_template_db_stingray_class.c +6187 -22412

28,599 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_template_db_tbl.c +248 -776

1,024 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_template_db_tbl.h +18 -6
index dbfcc46164..93b0afbf25 100644

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

drivers/net/bnxt/tf_ulp/ulp_template_db_wh_plus_act.c +316 -3389

3,705 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_template_db_wh_plus_class.c +6172 -22482

28,654 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_template_struct.h +37 -26

63 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_tun.c +62 -165

227 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_tun.h +19 -20
index 7e31f81f13..ad70ae6164 100644

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

drivers/net/bnxt/tf_ulp/ulp_utils.c +8 -8
index ff8eabd3f3..8e3a920ab4 100644

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

drivers/net/bnxt/tf_ulp/ulp_utils.h +6 -6
index bbd8c16407..caad5628c9 100644

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

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

Signature · 1 line
2.17.1

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

#35 lore raw

PATCH 35/58 net/bnxt: add support for conditional goto processing

In reply to Venkat Duvvuru

From: Kishore Padmanabha <[email protected]>

The condition execute of the mapper tables have goto field that defines the offset of the next table to be processed instead of sequential processing of the tables, this improving the performance. Also, modify key and mask field opcode processing

---
 drivers/net/bnxt/tf_ulp/ulp_def_rules.c       |    6 +-
 drivers/net/bnxt/tf_ulp/ulp_mapper.c          |  393 +-
 drivers/net/bnxt/tf_ulp/ulp_rte_parser.c      |   36 +-
 drivers/net/bnxt/tf_ulp/ulp_template_db_act.c |   48 +-
 .../net/bnxt/tf_ulp/ulp_template_db_class.c   | 3286 ++++++++--
 .../net/bnxt/tf_ulp/ulp_template_db_enum.h    | 1222 ++--
 .../net/bnxt/tf_ulp/ulp_template_db_field.h   |  462 +-
 .../tf_ulp/ulp_template_db_stingray_act.c     |  585 +-
 .../tf_ulp/ulp_template_db_stingray_class.c   | 5638 +++++++---------
 drivers/net/bnxt/tf_ulp/ulp_template_db_tbl.c |  234 +-
 .../bnxt/tf_ulp/ulp_template_db_wh_plus_act.c |  581 +-
 .../tf_ulp/ulp_template_db_wh_plus_class.c    | 5656 +++++++----------
 drivers/net/bnxt/tf_ulp/ulp_template_struct.h |   16 +-
 drivers/net/bnxt/tf_ulp/ulp_tun.c             |    2 +-
 drivers/net/bnxt/tf_ulp/ulp_tun.h             |    2 +-
 15 files changed, 9532 insertions(+), 8635 deletions(-)
drivers/net/bnxt/tf_ulp/ulp_def_rules.c +3 -3
index 5e9b12e4f5..6d6c22b157 100644
@@ -139,7 +139,7 @@ ulp_set_vlan_in_act_prop(uint16_t port_id,
 	struct ulp_rte_act_prop *act_prop = mapper_params->act_prop;
 
 	if (ULP_BITMAP_ISSET(mapper_params->act->bits,
-			     BNXT_ULP_ACTION_BIT_SET_VLAN_VID)) {
+			     BNXT_ULP_ACT_BIT_SET_VLAN_VID)) {
 		BNXT_TF_DBG(ERR,
 			    "VLAN already set, multiple VLANs unsupported\n");
 		return BNXT_TF_RC_ERROR;
@@ -148,7 +148,7 @@ ulp_set_vlan_in_act_prop(uint16_t port_id,
 	port_id = rte_cpu_to_be_16(port_id);
 
 	ULP_BITMAP_SET(mapper_params->act->bits,
-		       BNXT_ULP_ACTION_BIT_SET_VLAN_VID);
+		       BNXT_ULP_ACT_BIT_SET_VLAN_VID);
 
 	memcpy(&act_prop->act_details[BNXT_ULP_ACT_PROP_IDX_ENCAP_VTAG],
 	       &port_id, sizeof(port_id));
@@ -161,7 +161,7 @@ ulp_set_mark_in_act_prop(uint16_t port_id,
 			 struct bnxt_ulp_mapper_create_parms *mapper_params)
 {
 	if (ULP_BITMAP_ISSET(mapper_params->act->bits,
-			     BNXT_ULP_ACTION_BIT_MARK)) {
+			     BNXT_ULP_ACT_BIT_MARK)) {
 		BNXT_TF_DBG(ERR,
 			    "MARK already set, multiple MARKs unsupported\n");
 		return BNXT_TF_RC_ERROR;
drivers/net/bnxt/tf_ulp/ulp_mapper.c +213 -180

559 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_rte_parser.c +18 -18
index 7c048a33a0..02e2b7fdc0 100644
@@ -274,7 +274,7 @@ ulp_post_process_normal_flow(struct ulp_rte_parser_params *params)
 
 	/* Update the decrement ttl computational fields */
 	if (ULP_BITMAP_ISSET(params->act_bitmap.bits,
-			     BNXT_ULP_ACTION_BIT_DEC_TTL)) {
+			     BNXT_ULP_ACT_BIT_DEC_TTL)) {
 		/*
 		 * Check that vxlan proto is included and vxlan decap
 		 * action is not set then decrement tunnel ttl.
@@ -283,7 +283,7 @@ ulp_post_process_normal_flow(struct ulp_rte_parser_params *params)
 		if ((ULP_BITMAP_ISSET(params->hdr_bitmap.bits,
 				      BNXT_ULP_HDR_BIT_T_VXLAN) &&
 		    !ULP_BITMAP_ISSET(params->act_bitmap.bits,
-				      BNXT_ULP_ACTION_BIT_VXLAN_DECAP))) {
+				      BNXT_ULP_ACT_BIT_VXLAN_DECAP))) {
 			ULP_COMP_FLD_IDX_WR(params,
 					    BNXT_ULP_CF_IDX_ACT_T_DEC_TTL, 1);
 		} else {
@@ -1439,7 +1439,7 @@ ulp_rte_mark_act_handler(const struct rte_flow_action *action_item,
 		       &mark_id, BNXT_ULP_ACT_PROP_SZ_MARK);
 
 		/* Update the hdr_bitmap with vxlan */
-		ULP_BITMAP_SET(act->bits, BNXT_ULP_ACTION_BIT_MARK);
+		ULP_BITMAP_SET(act->bits, BNXT_ULP_ACT_BIT_MARK);
 		return BNXT_TF_RC_SUCCESS;
 	}
 	BNXT_TF_DBG(ERR, "Parse Error: Mark arg is invalid\n");
@@ -1455,7 +1455,7 @@ ulp_rte_rss_act_handler(const struct rte_flow_action *action_item,
 
 	if (rss) {
 		/* Update the hdr_bitmap with vxlan */
-		ULP_BITMAP_SET(param->act_bitmap.bits, BNXT_ULP_ACTION_BIT_RSS);
+		ULP_BITMAP_SET(param->act_bitmap.bits, BNXT_ULP_ACT_BIT_RSS);
 		return BNXT_TF_RC_SUCCESS;
 	}
 	BNXT_TF_DBG(ERR, "Parse Error: RSS arg is invalid\n");
@@ -1728,7 +1728,7 @@ ulp_rte_vxlan_encap_act_handler(const struct rte_flow_action *action_item,
 	       &vxlan_size, sizeof(uint32_t));
 
 	/* update the hdr_bitmap with vxlan */
-	ULP_BITMAP_SET(act->bits, BNXT_ULP_ACTION_BIT_VXLAN_ENCAP);
+	ULP_BITMAP_SET(act->bits, BNXT_ULP_ACT_BIT_VXLAN_ENCAP);
 	return BNXT_TF_RC_SUCCESS;
 }
 
@@ -1740,7 +1740,7 @@ ulp_rte_vxlan_decap_act_handler(const struct rte_flow_action *action_item
 {
 	/* update the hdr_bitmap with vxlan */
 	ULP_BITMAP_SET(params->act_bitmap.bits,
-		       BNXT_ULP_ACTION_BIT_VXLAN_DECAP);
+		       BNXT_ULP_ACT_BIT_VXLAN_DECAP);
 	/* Update computational field with tunnel decap info */
 	ULP_COMP_FLD_IDX_WR(params, BNXT_ULP_CF_IDX_L3_TUN_DECAP, 1);
 	ULP_COMP_FLD_IDX_WR(params, BNXT_ULP_CF_IDX_L3_TUN, 1);
@@ -1753,7 +1753,7 @@ ulp_rte_drop_act_handler(const struct rte_flow_action *action_item __rte_unused,
 			 struct ulp_rte_parser_params *params)
 {
 	/* Update the hdr_bitmap with drop */
-	ULP_BITMAP_SET(params->act_bitmap.bits, BNXT_ULP_ACTION_BIT_DROP);
+	ULP_BITMAP_SET(params->act_bitmap.bits, BNXT_ULP_ACT_BIT_DROP);
 	return BNXT_TF_RC_SUCCESS;
 }
 
@@ -1779,7 +1779,7 @@ ulp_rte_count_act_handler(const struct rte_flow_action *action_item,
 	}
 
 	/* Update the hdr_bitmap with count */
-	ULP_BITMAP_SET(params->act_bitmap.bits, BNXT_ULP_ACTION_BIT_COUNT);
+	ULP_BITMAP_SET(params->act_bitmap.bits, BNXT_ULP_ACT_BIT_COUNT);
 	return BNXT_TF_RC_SUCCESS;
 }
 
@@ -1992,7 +1992,7 @@ ulp_rte_of_pop_vlan_act_handler(const struct rte_flow_action *a __rte_unused,
 				struct ulp_rte_parser_params *params)
 {
 	/* Update the act_bitmap with pop */
-	ULP_BITMAP_SET(params->act_bitmap.bits, BNXT_ULP_ACTION_BIT_POP_VLAN);
+	ULP_BITMAP_SET(params->act_bitmap.bits, BNXT_ULP_ACT_BIT_POP_VLAN);
 	return BNXT_TF_RC_SUCCESS;
 }
 
@@ -2017,7 +2017,7 @@ ulp_rte_of_push_vlan_act_handler(const struct rte_flow_action *action_item,
 		       &ethertype, BNXT_ULP_ACT_PROP_SZ_PUSH_VLAN);
 		/* Update the hdr_bitmap with push vlan */
 		ULP_BITMAP_SET(params->act_bitmap.bits,
-			       BNXT_ULP_ACTION_BIT_PUSH_VLAN);
+			       BNXT_ULP_ACT_BIT_PUSH_VLAN);
 		return BNXT_TF_RC_SUCCESS;
 	}
 	BNXT_TF_DBG(ERR, "Parse Error: Push vlan arg is invalid\n");
@@ -2040,7 +2040,7 @@ ulp_rte_of_set_vlan_vid_act_handler(const struct rte_flow_action *action_item,
 		       &vid, BNXT_ULP_ACT_PROP_SZ_SET_VLAN_VID);
 		/* Update the hdr_bitmap with vlan vid */
 		ULP_BITMAP_SET(params->act_bitmap.bits,
-			       BNXT_ULP_ACTION_BIT_SET_VLAN_VID);
+			       BNXT_ULP_ACT_BIT_SET_VLAN_VID);
 		return BNXT_TF_RC_SUCCESS;
 	}
 	BNXT_TF_DBG(ERR, "Parse Error: Vlan vid arg is invalid\n");
@@ -2063,7 +2063,7 @@ ulp_rte_of_set_vlan_pcp_act_handler(const struct rte_flow_action *action_item,
 		       &pcp, BNXT_ULP_ACT_PROP_SZ_SET_VLAN_PCP);
 		/* Update the hdr_bitmap with vlan vid */
 		ULP_BITMAP_SET(params->act_bitmap.bits,
-			       BNXT_ULP_ACTION_BIT_SET_VLAN_PCP);
+			       BNXT_ULP_ACT_BIT_SET_VLAN_PCP);
 		return BNXT_TF_RC_SUCCESS;
 	}
 	BNXT_TF_DBG(ERR, "Parse Error: Vlan pcp arg is invalid\n");
@@ -2084,7 +2084,7 @@ ulp_rte_set_ipv4_src_act_handler(const struct rte_flow_action *action_item,
 		       &set_ipv4->ipv4_addr, BNXT_ULP_ACT_PROP_SZ_SET_IPV4_SRC);
 		/* Update the hdr_bitmap with set ipv4 src */
 		ULP_BITMAP_SET(params->act_bitmap.bits,
-			       BNXT_ULP_ACTION_BIT_SET_IPV4_SRC);
+			       BNXT_ULP_ACT_BIT_SET_IPV4_SRC);
 		return BNXT_TF_RC_SUCCESS;
 	}
 	BNXT_TF_DBG(ERR, "Parse Error: set ipv4 src arg is invalid\n");
@@ -2105,7 +2105,7 @@ ulp_rte_set_ipv4_dst_act_handler(const struct rte_flow_action *action_item,
 		       &set_ipv4->ipv4_addr, BNXT_ULP_ACT_PROP_SZ_SET_IPV4_DST);
 		/* Update the hdr_bitmap with set ipv4 dst */
 		ULP_BITMAP_SET(params->act_bitmap.bits,
-			       BNXT_ULP_ACTION_BIT_SET_IPV4_DST);
+			       BNXT_ULP_ACT_BIT_SET_IPV4_DST);
 		return BNXT_TF_RC_SUCCESS;
 	}
 	BNXT_TF_DBG(ERR, "Parse Error: set ipv4 dst arg is invalid\n");
@@ -2126,7 +2126,7 @@ ulp_rte_set_tp_src_act_handler(const struct rte_flow_action *action_item,
 		       &set_tp->port, BNXT_ULP_ACT_PROP_SZ_SET_TP_SRC);
 		/* Update the hdr_bitmap with set tp src */
 		ULP_BITMAP_SET(params->act_bitmap.bits,
-			       BNXT_ULP_ACTION_BIT_SET_TP_SRC);
+			       BNXT_ULP_ACT_BIT_SET_TP_SRC);
 		return BNXT_TF_RC_SUCCESS;
 	}
 
@@ -2148,7 +2148,7 @@ ulp_rte_set_tp_dst_act_handler(const struct rte_flow_action *action_item,
 		       &set_tp->port, BNXT_ULP_ACT_PROP_SZ_SET_TP_DST);
 		/* Update the hdr_bitmap with set tp dst */
 		ULP_BITMAP_SET(params->act_bitmap.bits,
-			       BNXT_ULP_ACTION_BIT_SET_TP_DST);
+			       BNXT_ULP_ACT_BIT_SET_TP_DST);
 		return BNXT_TF_RC_SUCCESS;
 	}
 
@@ -2162,7 +2162,7 @@ ulp_rte_dec_ttl_act_handler(const struct rte_flow_action *act __rte_unused,
 			    struct ulp_rte_parser_params *params)
 {
 	/* Update the act_bitmap with dec ttl */
-	ULP_BITMAP_SET(params->act_bitmap.bits, BNXT_ULP_ACTION_BIT_DEC_TTL);
+	ULP_BITMAP_SET(params->act_bitmap.bits, BNXT_ULP_ACT_BIT_DEC_TTL);
 	return BNXT_TF_RC_SUCCESS;
 }
 
@@ -2172,6 +2172,6 @@ ulp_rte_jump_act_handler(const struct rte_flow_action *action_item __rte_unused,
 			    struct ulp_rte_parser_params *params)
 {
 	/* Update the act_bitmap with dec ttl */
-	ULP_BITMAP_SET(params->act_bitmap.bits, BNXT_ULP_ACTION_BIT_JUMP);
+	ULP_BITMAP_SET(params->act_bitmap.bits, BNXT_ULP_ACT_BIT_JUMP);
 	return BNXT_TF_RC_SUCCESS;
 }
drivers/net/bnxt/tf_ulp/ulp_template_db_act.c +24 -24

132 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_template_db_class.c +2909 -377

2,142 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_template_db_enum.h +674 -548

1,222 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_template_db_field.h +274 -188

462 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_template_db_stingray_act.c +305 -280

585 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_template_db_stingray_class.c +2311 -3327

5,638 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_template_db_tbl.c +166 -68

234 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_template_db_wh_plus_act.c +303 -278

581 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_template_db_wh_plus_class.c +2320 -3336

5,656 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_template_struct.h +10 -6
index b06b1b12d3..16802fb89a 100644

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

drivers/net/bnxt/tf_ulp/ulp_tun.c +1 -1
index e8d2861880..dd3d8703fb 100644

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

drivers/net/bnxt/tf_ulp/ulp_tun.h +1 -1
index ad70ae6164..763138218b 100644

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

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

Signature · 1 line
2.17.1

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

#36 lore raw

PATCH 36/58 net/bnxt: set shared handle for generic table

In reply to Venkat Duvvuru

From: Kishore Padmanabha <[email protected]>

The shared handle is set in the mapper params when generic resource are created, this shall be used by application as a handle to the shared resource like mirror handle.

---
 drivers/net/bnxt/tf_ulp/ulp_mapper.c | 1 +
 drivers/net/bnxt/tf_ulp/ulp_mapper.h | 1 +
 2 files changed, 2 insertions(+)
drivers/net/bnxt/tf_ulp/ulp_mapper.c +1 -0
index ad5fde9730..73a6a4cdb5 100644
@@ -2403,6 +2403,7 @@ ulp_mapper_gen_tbl_process(struct bnxt_ulp_mapper_parms *parms,
 		/* increment the reference count */
 		ULP_GEN_TBL_REF_CNT_INC(&gen_tbl_ent);
 		fdb_write = 1;
+		parms->shared_hndl = (uint64_t)tbl_idx << 32 | ckey;
 		break;
 	default:
 		BNXT_TF_DBG(ERR, "Invalid table opcode %x\n", tbl->tbl_opcode);
drivers/net/bnxt/tf_ulp/ulp_mapper.h +1 -0
index bef72696d3..b7399b8949 100644
@@ -57,6 +57,7 @@ struct bnxt_ulp_mapper_parms {
 	uint32_t				parent_flow;
 	uint8_t					tun_idx;
 	uint32_t				app_priority;
+	uint64_t				shared_hndl;
 };
 
 struct bnxt_ulp_mapper_create_parms {
Signature · 1 line
2.17.1