Skip to contentSkip to conversation

bnxt patches

PATCH New Venkat Duvvuru 3 participants 64 messages Oct 17, 2020 – Oct 26, 2020

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

cover bnxt patches

This patchset has support for vxlan decap full offload, SR device support in tf_core and a few bug fixes.

Farah Smith (3):
net/bnxt: map table scope API
net/bnxt: table scope to PF Mapping for SR and Wh+ net/bnxt: update SR ULP resource counts

Jay Ding (2):
net/bnxt: add stingray support
net/bnxt: changes to support 2 table scopes

Kishore Padmanabha (2):
net/bnxt: add support for parent flow accumulation counters net/bnxt: add mapper support for wildcard TCAM entry

Peter Spreadborough (2):
net/bnxt: device cleanup of FW
net/bnxt: add build option for EM slot allocation

Somnath Kotur (2):
net/bnxt: fix infinite loop in flow query count API net/bnxt: use cfa pair alloc for configuring reps

Venkat Duvvuru (3):
net/bnxt: refactor flow id allocation
net/bnxt: add support for VXLAN decap templates
net/bnxt: add VXLAN decap offload support

 drivers/net/bnxt/bnxt.h                            |    6 +-
 drivers/net/bnxt/bnxt_ethdev.c                     |    2 +
 drivers/net/bnxt/bnxt_hwrm.c                       |   60 +-
 drivers/net/bnxt/bnxt_hwrm.h                       |    2 -
 drivers/net/bnxt/bnxt_reps.c                       |   18 +-
 drivers/net/bnxt/hcapi/hcapi_cfa.h                 |   39 +-
 drivers/net/bnxt/meson.build                       |    1 +
 drivers/net/bnxt/tf_core/cfa_resource_types.h      |   95 +-
 drivers/net/bnxt/tf_core/tf_core.c                 |   57 +-
 drivers/net/bnxt/tf_core/tf_core.h                 |   57 +-
 drivers/net/bnxt/tf_core/tf_device.c               |    9 +-
 drivers/net/bnxt/tf_core/tf_device.h               |   47 +-
 drivers/net/bnxt/tf_core/tf_device_p4.c            |   69 +-
 drivers/net/bnxt/tf_core/tf_device_p4.h            |    6 +
 drivers/net/bnxt/tf_core/tf_device_p45.h           |  105 +
 drivers/net/bnxt/tf_core/tf_em.h                   |   25 +-
 drivers/net/bnxt/tf_core/tf_em_common.c            |  175 +-
 drivers/net/bnxt/tf_core/tf_em_common.h            |   27 +-
 drivers/net/bnxt/tf_core/tf_em_host.c              |   31 +-
 drivers/net/bnxt/tf_core/tf_global_cfg.c           |    4 +-
 drivers/net/bnxt/tf_core/tf_global_cfg.h           |   42 +-
 drivers/net/bnxt/tf_core/tf_msg.c                  |   13 +-
 drivers/net/bnxt/tf_core/tf_msg.h                  |    4 +-
 drivers/net/bnxt/tf_core/tf_session.h              |   16 +-
 drivers/net/bnxt/tf_core/tf_tbl.h                  |    3 +
 drivers/net/bnxt/tf_core/tfp.c                     |   19 +
 drivers/net/bnxt/tf_core/tfp.h                     |   16 +
 drivers/net/bnxt/tf_ulp/bnxt_tf_common.h           |    4 +-
 drivers/net/bnxt/tf_ulp/bnxt_ulp.c                 |   50 +-
 drivers/net/bnxt/tf_ulp/bnxt_ulp.h                 |   12 +
 drivers/net/bnxt/tf_ulp/bnxt_ulp_flow.c            |  129 +-
 drivers/net/bnxt/tf_ulp/ulp_def_rules.c            |   48 +-
 drivers/net/bnxt/tf_ulp/ulp_fc_mgr.c               |  133 +-
 drivers/net/bnxt/tf_ulp/ulp_fc_mgr.h               |   19 +
 drivers/net/bnxt/tf_ulp/ulp_flow_db.c              |  475 +++-
 drivers/net/bnxt/tf_ulp/ulp_flow_db.h              |   46 +
 drivers/net/bnxt/tf_ulp/ulp_mapper.c               |   83 +-
 drivers/net/bnxt/tf_ulp/ulp_mapper.h               |    6 +-
 drivers/net/bnxt/tf_ulp/ulp_rte_parser.c           |   85 +-
 drivers/net/bnxt/tf_ulp/ulp_rte_parser.h           |   12 +
 drivers/net/bnxt/tf_ulp/ulp_template_db_class.c    |  962 +++++---
 drivers/net/bnxt/tf_ulp/ulp_template_db_enum.h     |   42 +-
 drivers/net/bnxt/tf_ulp/ulp_template_db_field.h    |  363 ++-
 .../net/bnxt/tf_ulp/ulp_template_db_stingray_act.c |  116 +-
 .../bnxt/tf_ulp/ulp_template_db_stingray_class.c   | 2493 ++++++++++++++++----
 drivers/net/bnxt/tf_ulp/ulp_template_db_tbl.c      |    9 +-
 .../net/bnxt/tf_ulp/ulp_template_db_wh_plus_act.c  |  116 +-
 .../bnxt/tf_ulp/ulp_template_db_wh_plus_class.c    | 2489 +++++++++++++++----
 drivers/net/bnxt/tf_ulp/ulp_template_struct.h      |    7 +
 drivers/net/bnxt/tf_ulp/ulp_tun.c                  |  310 +++
 drivers/net/bnxt/tf_ulp/ulp_tun.h                  |   92 +
 drivers/net/bnxt/tf_ulp/ulp_utils.c                |  125 +
 drivers/net/bnxt/tf_ulp/ulp_utils.h                |   48 +-
 53 files changed, 7185 insertions(+), 2037 deletions(-)
 create mode 100644 drivers/net/bnxt/tf_core/tf_device_p45.h
 create mode 100644 drivers/net/bnxt/tf_ulp/ulp_tun.c
 create mode 100644 drivers/net/bnxt/tf_ulp/ulp_tun.h
Signature · 1 line
2.7.4
#1 lore raw

PATCH 1/14 net/bnxt: device cleanup of FW

From: Peter Spreadborough <[email protected]>

- Moved P4 specific code under the P4 directory
- Added P45 skeleton code for SR to build on

---
 drivers/net/bnxt/hcapi/hcapi_cfa.h       | 39 ++++++++++++++++++++++++--------
 drivers/net/bnxt/tf_core/tf_core.h       |  2 +-
 drivers/net/bnxt/tf_core/tf_device_p45.h | 16 +++++++++++++
 drivers/net/bnxt/tf_core/tf_em.h         |  6 -----
 4 files changed, 46 insertions(+), 17 deletions(-)
 create mode 100644 drivers/net/bnxt/tf_core/tf_device_p45.h
drivers/net/bnxt/hcapi/hcapi_cfa.h +29 -10
index c7d87de..aa218d7 100644
@@ -14,7 +14,15 @@
 
 #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
@@ -81,17 +89,20 @@ struct hcapi_cfa_key_result {
 /* common CFA register access macros */
 #define CFA_REG(x)		OFFSETOF(cfa_reg_t, cfa_##x)
 
-#ifndef REG_WR
-#define REG_WR(_p, x, y)  (*((uint32_t volatile *)(x)) = (y))
+#ifndef TF_REG_WR
+#define TF_REG_WR(_p, x, y)  (*((uint32_t volatile *)(x)) = (y))
 #endif
-#ifndef REG_RD
-#define REG_RD(_p, x)  (*((uint32_t volatile *)(x)))
+#ifndef TF_REG_RD
+#define TF_REG_RD(_p, x)  (*((uint32_t volatile *)(x)))
+#endif
+#ifndef TF_CFA_REG_RD
+#define TF_CFA_REG_RD(_p, x)	\
+	TF_REG_RD(0, (uint32_t)(_p)->base_addr + CFA_REG(x))
+#endif
+#ifndef TF_CFA_REG_WR
+#define TF_CFA_REG_WR(_p, x, y)	\
+	TF_REG_WR(0, (uint32_t)(_p)->base_addr + CFA_REG(x), y)
 #endif
-#define CFA_REG_RD(_p, x)	\
-	REG_RD(0, (uint32_t)(_p)->base_addr + CFA_REG(x))
-#define CFA_REG_WR(_p, x, y)	\
-	REG_WR(0, (uint32_t)(_p)->base_addr + CFA_REG(x), y)
-
 
 /* Constants used by Resource Manager Registration*/
 #define RM_CLIENT_NAME_MAX_LEN          32
@@ -248,7 +259,15 @@ int hcapi_cfa_p4_mirror_hwop(struct hcapi_cfa_hwop *op,
 int hcapi_cfa_p4_global_cfg_hwop(struct hcapi_cfa_hwop *op,
 				 uint32_t type,
 				 struct hcapi_cfa_data *config);
-#endif /* SUPPORT_CFA_HW_P4 */
+/* 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
drivers/net/bnxt/tf_core/tf_core.h +1 -1
index db10935..65be8f5 100644
@@ -10,7 +10,7 @@
 #include <stdlib.h>
 #include <stdbool.h>
 #include <stdio.h>
-#include "hcapi/hcapi_cfa.h"
+#include "hcapi/hcapi_cfa_defs.h"
 #include "tf_project.h"
 
 /**
drivers/net/bnxt/tf_core/tf_device_p45.h new file +16 -0
new file mode 100644
index 0000000..2da59d1
@@ -0,0 +1,16 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2019-2020 Broadcom
+ * All rights reserved.
+ */
+
+#ifndef _TF_DEVICE_P45_H_
+#define _TF_DEVICE_P45_H_
+
+#include <cfa_resource_types.h>
+
+#include "tf_core.h"
+#include "tf_rm.h"
+#include "tf_if_tbl.h"
+#include "tf_global_cfg.h"
+
+#endif /* _TF_DEVICE_P45_H_ */
drivers/net/bnxt/tf_core/tf_em.h +0 -6
index 2a67e47..51b0813 100644
@@ -9,12 +9,6 @@
 #include "tf_core.h"
 #include "tf_session.h"
 
-
-#define SUPPORT_CFA_HW_P4 1
-#define SUPPORT_CFA_HW_P58 0
-#define SUPPORT_CFA_HW_P59 0
-#define SUPPORT_CFA_HW_ALL 0
-
 #include "hcapi/hcapi_cfa_defs.h"
 
 #define TF_EM_MIN_ENTRIES     (1 << 15) /* 32K */
Signature · 1 line
2.7.4
#2 lore raw

PATCH 2/14 net/bnxt: add stingray support

In reply to Venkat Duvvuru

From: Jay Ding <[email protected]>

Add SR support in truflow.

---
 drivers/net/bnxt/tf_core/cfa_resource_types.h | 95 ++++++++++-----------------
 drivers/net/bnxt/tf_core/tf_core.c            |  3 +-
 drivers/net/bnxt/tf_core/tf_device.c          |  9 ++-
 drivers/net/bnxt/tf_core/tf_device_p4.c       | 25 ++++++-
 drivers/net/bnxt/tf_core/tf_device_p4.h       |  6 ++
 drivers/net/bnxt/tf_core/tf_device_p45.h      | 89 +++++++++++++++++++++++++
 6 files changed, 161 insertions(+), 66 deletions(-)
drivers/net/bnxt/tf_core/cfa_resource_types.h +35 -60
index 19838c3..a62063b 100644
@@ -1,6 +1,13 @@
-/* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2019-2020 Broadcom
- * All rights reserved.
+/*
+ * Copyright(c) 2001-2020, Broadcom. All rights reserved. The
+ * term Broadcom refers to Broadcom Inc. and/or its subsidiaries.
+ * Proprietary and Confidential Information.
+ *
+ * This source file is the property of Broadcom Corporation, and
+ * may not be copied or distributed in any isomorphic form without
+ * the prior written consent of Broadcom Corporation.
+ *
+ * DO NOT MODIFY!!! This file is automatically generated.
  */
 
 #ifndef _CFA_RESOURCE_TYPES_H_
@@ -64,79 +71,47 @@
 #define CFA_RESOURCE_TYPE_P59_LAST              CFA_RESOURCE_TYPE_P59_VEB_TCAM
 
 
-/* Multicast Group */
-#define CFA_RESOURCE_TYPE_P58_MCG                 0x0UL
-/* Encap 8 byte record */
-#define CFA_RESOURCE_TYPE_P58_ENCAP_8B            0x1UL
-/* Encap 16 byte record */
-#define CFA_RESOURCE_TYPE_P58_ENCAP_16B           0x2UL
-/* Encap 64 byte record */
-#define CFA_RESOURCE_TYPE_P58_ENCAP_64B           0x3UL
-/* Source Property MAC */
-#define CFA_RESOURCE_TYPE_P58_SP_MAC              0x4UL
-/* Source Property MAC and IPv4 */
-#define CFA_RESOURCE_TYPE_P58_SP_MAC_IPV4         0x5UL
-/* Source Property MAC and IPv6 */
-#define CFA_RESOURCE_TYPE_P58_SP_MAC_IPV6         0x6UL
-/* Network Address Translation Port */
-#define CFA_RESOURCE_TYPE_P58_NAT_PORT            0x7UL
-/* Network Address Translation IPv4 address */
-#define CFA_RESOURCE_TYPE_P58_NAT_IPV4            0x8UL
 /* Meter */
-#define CFA_RESOURCE_TYPE_P58_METER               0x9UL
-/* Flow State */
-#define CFA_RESOURCE_TYPE_P58_FLOW_STATE          0xaUL
-/* Full Action Records */
-#define CFA_RESOURCE_TYPE_P58_FULL_ACTION         0xbUL
-/* Action Record Format 0 */
-#define CFA_RESOURCE_TYPE_P58_FORMAT_0_ACTION     0xcUL
-/* Action Record Ext Format 0 */
-#define CFA_RESOURCE_TYPE_P58_EXT_FORMAT_0_ACTION 0xdUL
-/* Action Record Format 1 */
-#define CFA_RESOURCE_TYPE_P58_FORMAT_1_ACTION     0xeUL
-/* Action Record Format 2 */
-#define CFA_RESOURCE_TYPE_P58_FORMAT_2_ACTION     0xfUL
-/* Action Record Format 3 */
-#define CFA_RESOURCE_TYPE_P58_FORMAT_3_ACTION     0x10UL
-/* Action Record Format 4 */
-#define CFA_RESOURCE_TYPE_P58_FORMAT_4_ACTION     0x11UL
-/* Action Record Format 5 */
-#define CFA_RESOURCE_TYPE_P58_FORMAT_5_ACTION     0x12UL
-/* Action Record Format 6 */
-#define CFA_RESOURCE_TYPE_P58_FORMAT_6_ACTION     0x13UL
+#define CFA_RESOURCE_TYPE_P58_METER              0x0UL
+/* SRAM_Bank_0 */
+#define CFA_RESOURCE_TYPE_P58_SRAM_BANK_0        0x1UL
+/* SRAM_Bank_1 */
+#define CFA_RESOURCE_TYPE_P58_SRAM_BANK_1        0x2UL
+/* SRAM_Bank_2 */
+#define CFA_RESOURCE_TYPE_P58_SRAM_BANK_2        0x3UL
+/* SRAM_Bank_3 */
+#define CFA_RESOURCE_TYPE_P58_SRAM_BANK_3        0x4UL
 /* L2 Context TCAM High priority entries */
-#define CFA_RESOURCE_TYPE_P58_L2_CTXT_TCAM_HIGH   0x14UL
+#define CFA_RESOURCE_TYPE_P58_L2_CTXT_TCAM_HIGH  0x5UL
 /* L2 Context TCAM Low priority entries */
-#define CFA_RESOURCE_TYPE_P58_L2_CTXT_TCAM_LOW    0x15UL
+#define CFA_RESOURCE_TYPE_P58_L2_CTXT_TCAM_LOW   0x6UL
 /* L2 Context REMAP high priority entries */
-#define CFA_RESOURCE_TYPE_P58_L2_CTXT_REMAP_HIGH  0x16UL
+#define CFA_RESOURCE_TYPE_P58_L2_CTXT_REMAP_HIGH 0x7UL
 /* L2 Context REMAP Low priority entries */
-#define CFA_RESOURCE_TYPE_P58_L2_CTXT_REMAP_LOW   0x17UL
+#define CFA_RESOURCE_TYPE_P58_L2_CTXT_REMAP_LOW  0x8UL
 /* Profile Func */
-#define CFA_RESOURCE_TYPE_P58_PROF_FUNC           0x18UL
+#define CFA_RESOURCE_TYPE_P58_PROF_FUNC          0x9UL
 /* Profile TCAM */
-#define CFA_RESOURCE_TYPE_P58_PROF_TCAM           0x19UL
+#define CFA_RESOURCE_TYPE_P58_PROF_TCAM          0xaUL
 /* Exact Match Profile Id */
-#define CFA_RESOURCE_TYPE_P58_EM_PROF_ID          0x1aUL
+#define CFA_RESOURCE_TYPE_P58_EM_PROF_ID         0xbUL
 /* Wildcard Profile Id */
-#define CFA_RESOURCE_TYPE_P58_WC_TCAM_PROF_ID     0x1bUL
+#define CFA_RESOURCE_TYPE_P58_WC_TCAM_PROF_ID    0xcUL
 /* Exact Match Record */
-#define CFA_RESOURCE_TYPE_P58_EM_REC              0x1cUL
+#define CFA_RESOURCE_TYPE_P58_EM_REC             0xdUL
 /* Wildcard TCAM */
-#define CFA_RESOURCE_TYPE_P58_WC_TCAM             0x1dUL
+#define CFA_RESOURCE_TYPE_P58_WC_TCAM            0xeUL
 /* Meter profile */
-#define CFA_RESOURCE_TYPE_P58_METER_PROF          0x1eUL
+#define CFA_RESOURCE_TYPE_P58_METER_PROF         0xfUL
 /* Meter */
-#define CFA_RESOURCE_TYPE_P58_MIRROR              0x1fUL
-/* Source Property TCAM */
-#define CFA_RESOURCE_TYPE_P58_SP_TCAM             0x20UL
+#define CFA_RESOURCE_TYPE_P58_MIRROR             0x10UL
 /* Exact Match Flexible Key Builder */
-#define CFA_RESOURCE_TYPE_P58_EM_FKB              0x21UL
+#define CFA_RESOURCE_TYPE_P58_EM_FKB             0x11UL
 /* Wildcard Flexible Key Builder */
-#define CFA_RESOURCE_TYPE_P58_WC_FKB              0x22UL
+#define CFA_RESOURCE_TYPE_P58_WC_FKB             0x12UL
 /* VEB TCAM */
-#define CFA_RESOURCE_TYPE_P58_VEB_TCAM            0x23UL
-#define CFA_RESOURCE_TYPE_P58_LAST               CFA_RESOURCE_TYPE_P58_VEB_TCAM
+#define CFA_RESOURCE_TYPE_P58_VEB_TCAM           0x13UL
+#define CFA_RESOURCE_TYPE_P58_LAST              CFA_RESOURCE_TYPE_P58_VEB_TCAM
 
 
 /* Multicast Group */
drivers/net/bnxt/tf_core/tf_core.c +2 -1
index 0dbde1d..788335b 100644
@@ -34,7 +34,8 @@ tf_open_session(struct tf *tfp,
 	 * side. It is assumed that the Firmware will be supported if
 	 * firmware open session succeeds.
 	 */
-	if (parms->device_type != TF_DEVICE_TYPE_WH) {
+	if (parms->device_type != TF_DEVICE_TYPE_WH &&
+	    parms->device_type != TF_DEVICE_TYPE_SR) {
 		TFP_DRV_LOG(ERR,
 			    "Unsupported device type %d\n",
 			    parms->device_type);
drivers/net/bnxt/tf_core/tf_device.c +7 -2
index 1129440..8389828 100644
@@ -47,7 +47,6 @@ tf_dev_bind_p4(struct tf *tfp,
 	struct tf_if_tbl_cfg_parms if_tbl_cfg;
 	struct tf_global_cfg_cfg_parms global_cfg;
 
-	dev_handle->type = TF_DEVICE_TYPE_WH;
 	/* Initial function initialization */
 	dev_handle->ops = &tf_dev_ops_p4_init;
 
@@ -90,7 +89,10 @@ tf_dev_bind_p4(struct tf *tfp,
 	 * EEM
 	 */
 	em_cfg.num_elements = TF_EM_TBL_TYPE_MAX;
-	em_cfg.cfg = tf_em_ext_p4;
+	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);
@@ -241,6 +243,8 @@ tf_dev_bind(struct tf *tfp __rte_unused,
 {
 	switch (type) {
 	case TF_DEVICE_TYPE_WH:
+	case TF_DEVICE_TYPE_SR:
+		dev_handle->type = type;
 		return tf_dev_bind_p4(tfp,
 				      shadow_copy,
 				      resources,
@@ -258,6 +262,7 @@ tf_dev_unbind(struct tf *tfp,
 {
 	switch (dev_handle->type) {
 	case TF_DEVICE_TYPE_WH:
+	case TF_DEVICE_TYPE_SR:
 		return tf_dev_unbind_p4(tfp);
 	default:
 		TFP_DRV_LOG(ERR,
drivers/net/bnxt/tf_core/tf_device_p4.c +22 -3
index fe8dec3..0344565 100644
@@ -28,13 +28,32 @@
  *   - (-EINVAL) on failure.
  */
 static int
-tf_dev_p4_get_max_types(struct tf *tfp __rte_unused,
+tf_dev_p4_get_max_types(struct tf *tfp,
 			uint16_t *max_types)
 {
-	if (max_types == NULL)
+	struct tf_session *tfs;
+	struct tf_dev_info *dev;
+	int rc;
+
+	if (max_types == NULL || tfp == NULL)
 		return -EINVAL;
 
-	*max_types = CFA_RESOURCE_TYPE_P4_LAST + 1;
+	/* 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;
 
 	return 0;
 }
drivers/net/bnxt/tf_core/tf_device_p4.h +6 -0
index 7e58469..aba28fe 100644
@@ -83,6 +83,12 @@ struct tf_rm_element_cfg tf_em_ext_p4[TF_EM_TBL_TYPE_MAX] = {
 	{ TF_RM_ELEM_CFG_HCAPI_BA, CFA_RESOURCE_TYPE_P4_TBL_SCOPE },
 };
 
+struct tf_rm_element_cfg tf_em_ext_p45[TF_EM_TBL_TYPE_MAX] = {
+	/* CFA_RESOURCE_TYPE_P4_EM_REC */
+	{ TF_RM_ELEM_CFG_NULL, CFA_RESOURCE_TYPE_INVALID },
+	{ TF_RM_ELEM_CFG_HCAPI_BA, CFA_RESOURCE_TYPE_P45_TBL_SCOPE },
+};
+
 struct tf_rm_element_cfg tf_em_int_p4[TF_EM_TBL_TYPE_MAX] = {
 	{ TF_RM_ELEM_CFG_HCAPI, CFA_RESOURCE_TYPE_P4_EM_REC },
 	/* CFA_RESOURCE_TYPE_P4_TBL_SCOPE */
drivers/net/bnxt/tf_core/tf_device_p45.h +89 -0

93 lines not on this page · raw message

Signature · 1 line
2.7.4
#3 lore raw

PATCH 3/14 net/bnxt: changes to support 2 table scopes

In reply to Venkat Duvvuru

From: Jay Ding <[email protected]>

This reverts commit 1312374a4e3c1851ae5e0d52cb8788c5b5e76fe0.

---
 drivers/net/bnxt/tf_core/tf_em_common.c | 85 +--------------------------------
 drivers/net/bnxt/tf_core/tf_em_common.h | 27 +----------
 drivers/net/bnxt/tf_core/tf_em_host.c   | 23 +++++++--
 3 files changed, 21 insertions(+), 114 deletions(-)
drivers/net/bnxt/tf_core/tf_em_common.c +1 -84
index 0d8b908..0f4b121 100644
@@ -44,28 +44,6 @@ static enum tf_mem_type mem_type;
 /** Table scope array */
 struct tf_tbl_scope_cb tbl_scopes[TF_NUM_TBL_SCOPE];
 
-/** Table scope reversal table
- *
- * Table scope are allocated from 15 to 0 within HCAPI RM.  Because of the
- * association between PFs and legacy table scopes, reverse table scope ids.
- * 15 indicates 0, 14 indicates 1, etc... The application will only see the 0
- * based number.  The firmware will only use the 0 based number.  Only HCAPI RM
- * and Truflow RM believe the number is 15.  When HCAPI RM support allocation
- * from low to high is supported, this adjust function can be removed.
- */
-const uint32_t tbl_scope_reverse[TF_NUM_TBL_SCOPE] = {
-	15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 };
-
-static uint32_t
-tf_tbl_scope_adjust(uint32_t tbl_scope_id)
-{
-	if (tbl_scope_id < TF_NUM_TBL_SCOPE)
-		return tbl_scope_reverse[tbl_scope_id];
-	else
-		return TF_TBL_SCOPE_INVALID;
-};
-
-
 /* API defined in tf_em.h */
 struct tf_tbl_scope_cb *
 tbl_scope_cb_find(uint32_t tbl_scope_id)
@@ -73,17 +51,11 @@ tbl_scope_cb_find(uint32_t tbl_scope_id)
 	int i;
 	struct tf_rm_is_allocated_parms parms = { 0 };
 	int allocated;
-	uint32_t rm_tbl_scope_id;
-
-	rm_tbl_scope_id = tf_tbl_scope_adjust(tbl_scope_id);
-
-	if (rm_tbl_scope_id == TF_TBL_SCOPE_INVALID)
-		return NULL;
 
 	/* Check that id is valid */
 	parms.rm_db = eem_db[TF_DIR_RX];
 	parms.db_index = TF_EM_TBL_TYPE_TBL_SCOPE;
-	parms.index = rm_tbl_scope_id;
+	parms.index = tbl_scope_id;
 	parms.allocated = &allocated;
 
 	i = tf_rm_is_allocated(&parms);
@@ -99,61 +71,6 @@ tbl_scope_cb_find(uint32_t tbl_scope_id)
 	return NULL;
 }
 
-int tf_tbl_scope_alloc(uint32_t *tbl_scope_id)
-{
-	int rc;
-	struct tf_rm_allocate_parms parms = { 0 };
-	uint32_t rm_tbl_scope_id;
-	uint32_t usr_tbl_scope_id = TF_TBL_SCOPE_INVALID;
-
-	/* Get Table Scope control block from the session pool */
-	parms.rm_db = eem_db[TF_DIR_RX];
-	parms.db_index = TF_EM_TBL_TYPE_TBL_SCOPE;
-	parms.index = &rm_tbl_scope_id;
-
-	rc = tf_rm_allocate(&parms);
-	if (rc) {
-		TFP_DRV_LOG(ERR,
-			    "Failed to allocate table scope rc:%s\n",
-			    strerror(-rc));
-		return rc;
-	}
-
-	usr_tbl_scope_id = tf_tbl_scope_adjust(rm_tbl_scope_id);
-
-	if (usr_tbl_scope_id == TF_TBL_SCOPE_INVALID) {
-		TFP_DRV_LOG(ERR,
-			    "Invalid table scope allocated id:%d\n",
-			    (int)rm_tbl_scope_id);
-		return -EINVAL;
-	}
-	*tbl_scope_id = usr_tbl_scope_id;
-	return 0;
-};
-
-int tf_tbl_scope_free(uint32_t tbl_scope_id)
-{
-	struct tf_rm_free_parms parms = { 0 };
-	uint32_t rm_tbl_scope_id;
-	uint32_t rc;
-
-	rm_tbl_scope_id = tf_tbl_scope_adjust(tbl_scope_id);
-
-	if (rm_tbl_scope_id == TF_TBL_SCOPE_INVALID) {
-		TFP_DRV_LOG(ERR,
-			    "Invalid table scope allocated id:%d\n",
-			    (int)tbl_scope_id);
-		return -EINVAL;
-	}
-
-	parms.rm_db = eem_db[TF_DIR_RX];
-	parms.db_index = TF_EM_TBL_TYPE_TBL_SCOPE;
-	parms.index = rm_tbl_scope_id;
-
-	rc = tf_rm_free(&parms);
-	return rc;
-};
-
 int
 tf_create_tbl_pool_external(enum tf_dir dir,
 			    struct tf_tbl_scope_cb *tbl_scope_cb,
drivers/net/bnxt/tf_core/tf_em_common.h +1 -26
index f71a487..fa313c4 100644
@@ -9,6 +9,7 @@
 #include "tf_core.h"
 #include "tf_session.h"
 
+
 /**
  * Function to search for table scope control block structure
  * with specified table scope ID.
@@ -23,32 +24,6 @@
 struct tf_tbl_scope_cb *tbl_scope_cb_find(uint32_t tbl_scope_id);
 
 /**
- * Table Scope Allocate
- *
- * Allocate a table scope
- *
- * [in/out] pointer to tbl_scope_id
- *
- * Returns:
- *  0 - success
- *  -EINVAL - error
- */
-int tf_tbl_scope_alloc(uint32_t *tbl_scope_id);
-
-/**
- * Table Scope Free
- *
- * Free a table scope
- *
- * [in] tbl_scope_id to free
- *
- * Returns:
- *  0 - success
- *  -EINVAL - error
- */
-int tf_tbl_scope_free(uint32_t tbl_scope_id);
-
-/**
  * Create and initialize a stack to use for action entries
  *
  * [in] dir
drivers/net/bnxt/tf_core/tf_em_host.c +19 -4
index cfcb12f..b5db94f 100644
@@ -374,8 +374,14 @@ tf_em_ext_alloc(struct tf *tfp, struct tf_alloc_tbl_scope_parms *parms)
 	struct tf_tbl_scope_cb *tbl_scope_cb;
 	struct hcapi_cfa_em_table *em_tables;
 	struct tf_free_tbl_scope_parms free_parms;
-
-	rc = tf_tbl_scope_alloc(&parms->tbl_scope_id);
+	struct tf_rm_allocate_parms aparms = { 0 };
+	struct tf_rm_free_parms fparms = { 0 };
+
+	/* 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.index = (uint32_t *)&parms->tbl_scope_id;
+	rc = tf_rm_allocate(&aparms);
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to allocate table scope\n");
@@ -472,7 +478,11 @@ tf_em_ext_alloc(struct tf *tfp, struct tf_alloc_tbl_scope_parms *parms)
 	return -EINVAL;
 
 cleanup:
-	tf_tbl_scope_free(parms->tbl_scope_id);
+	/* Free Table control block */
+	fparms.rm_db = eem_db[TF_DIR_RX];
+	fparms.db_index = TF_EM_TBL_TYPE_TBL_SCOPE;
+	fparms.index = parms->tbl_scope_id;
+	tf_rm_free(&fparms);
 	return -EINVAL;
 }
 
@@ -483,6 +493,7 @@ tf_em_ext_free(struct tf *tfp,
 	int rc = 0;
 	enum tf_dir  dir;
 	struct tf_tbl_scope_cb *tbl_scope_cb;
+	struct tf_rm_free_parms aparms = { 0 };
 
 	tbl_scope_cb = tbl_scope_cb_find(parms->tbl_scope_id);
 
@@ -491,7 +502,11 @@ tf_em_ext_free(struct tf *tfp,
 		return -EINVAL;
 	}
 
-	rc = tf_tbl_scope_free(parms->tbl_scope_id);
+	/* Free Table control block */
+	aparms.rm_db = eem_db[TF_DIR_RX];
+	aparms.db_index = TF_EM_TBL_TYPE_TBL_SCOPE;
+	aparms.index = parms->tbl_scope_id;
+	rc = tf_rm_free(&aparms);
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to free table scope\n");
Signature · 1 line
2.7.4
#4 lore raw

PATCH 4/14 net/bnxt: map table scope API

In reply to Venkat Duvvuru

From: Farah Smith <[email protected]>

New API to map a PARIF to an EEM table scope (set of rx and tx EEM base addresses). Uses HWRM_TF_GLOBAL_CFG_SET HWRM to configure. Adjustments to tf_global_cfg_set() to reduce overhead and nominal name clarification.

---
 drivers/net/bnxt/tf_core/tf_core.c       | 54 +++++++++++++++-----
 drivers/net/bnxt/tf_core/tf_core.h       | 55 +++++++++++++++++---
 drivers/net/bnxt/tf_core/tf_device.h     | 43 +++++++++++++++-
 drivers/net/bnxt/tf_core/tf_device_p4.c  | 44 ++++++++++++++++
 drivers/net/bnxt/tf_core/tf_em.h         | 19 ++++++-
 drivers/net/bnxt/tf_core/tf_em_common.c  | 88 ++++++++++++++++++++++++++++++++
 drivers/net/bnxt/tf_core/tf_global_cfg.c |  4 +-
 drivers/net/bnxt/tf_core/tf_global_cfg.h | 42 ++++-----------
 drivers/net/bnxt/tf_core/tf_msg.c        | 13 ++++-
 drivers/net/bnxt/tf_core/tf_msg.h        |  4 +-
 10 files changed, 304 insertions(+), 62 deletions(-)
drivers/net/bnxt/tf_core/tf_core.c +40 -14
index 788335b..0f49a00 100644
@@ -303,7 +303,6 @@ int tf_get_global_cfg(struct tf *tfp,
 	int rc = 0;
 	struct tf_session *tfs;
 	struct tf_dev_info *dev;
-	struct tf_dev_global_cfg_parms gparms = { 0 };
 
 	TF_CHECK_PARMS2(tfp, parms);
 
@@ -342,12 +341,7 @@ int tf_get_global_cfg(struct tf *tfp,
 		return -EOPNOTSUPP;
 	}
 
-	gparms.dir = parms->dir;
-	gparms.type = parms->type;
-	gparms.offset = parms->offset;
-	gparms.config = parms->config;
-	gparms.config_sz_in_bytes = parms->config_sz_in_bytes;
-	rc = dev->ops->tf_dev_get_global_cfg(tfp, &gparms);
+	rc = dev->ops->tf_dev_get_global_cfg(tfp, parms);
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "%s: Global Cfg get failed, rc:%s\n",
@@ -371,7 +365,6 @@ int tf_set_global_cfg(struct tf *tfp,
 	int rc = 0;
 	struct tf_session *tfs;
 	struct tf_dev_info *dev;
-	struct tf_dev_global_cfg_parms gparms = { 0 };
 
 	TF_CHECK_PARMS2(tfp, parms);
 
@@ -410,12 +403,7 @@ int tf_set_global_cfg(struct tf *tfp,
 		return -EOPNOTSUPP;
 	}
 
-	gparms.dir = parms->dir;
-	gparms.type = parms->type;
-	gparms.offset = parms->offset;
-	gparms.config = parms->config;
-	gparms.config_sz_in_bytes = parms->config_sz_in_bytes;
-	rc = dev->ops->tf_dev_set_global_cfg(tfp, &gparms);
+	rc = dev->ops->tf_dev_set_global_cfg(tfp, parms);
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "%s: Global Cfg set failed, rc:%s\n",
@@ -1352,6 +1340,44 @@ tf_alloc_tbl_scope(struct tf *tfp,
 
 	return rc;
 }
+int
+tf_map_tbl_scope(struct tf *tfp,
+		   struct tf_map_tbl_scope_parms *parms)
+{
+	struct tf_session *tfs;
+	struct tf_dev_info *dev;
+	int rc;
+
+	TF_CHECK_PARMS2(tfp, parms);
+
+	/* Retrieve the session information */
+	rc = tf_session_get_session(tfp, &tfs);
+	if (rc) {
+		TFP_DRV_LOG(ERR,
+			    "Failed to lookup session, rc:%s\n",
+			    strerror(-rc));
+		return rc;
+	}
+
+	/* 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;
+	}
+
+	if (dev->ops->tf_dev_map_tbl_scope != NULL) {
+		rc = dev->ops->tf_dev_map_tbl_scope(tfp, parms);
+	} else {
+		TFP_DRV_LOG(ERR,
+			    "Map table scope not supported by device\n");
+		return -EINVAL;
+	}
+
+	return rc;
+}
 
 int
 tf_free_tbl_scope(struct tf *tfp,
drivers/net/bnxt/tf_core/tf_core.h +48 -7

87 lines not on this page · raw message

drivers/net/bnxt/tf_core/tf_device.h +41 -2

61 lines not on this page · raw message

drivers/net/bnxt/tf_core/tf_device_p4.c +44 -0

68 lines not on this page · raw message

drivers/net/bnxt/tf_core/tf_em.h +17 -2
index 51b0813..8820b28 100644
@@ -358,7 +358,7 @@ int tf_em_ext_free(struct tf *tfp,
 		   struct tf_free_tbl_scope_parms *parms);
 
 /**
- * Common free for external EEM using host or system memory
+ * Common free table scope for external EEM using host or system memory
  *
  * [in] tfp
  *   Pointer to TruFlow handle
@@ -374,7 +374,7 @@ int tf_em_ext_common_free(struct tf *tfp,
 			  struct tf_free_tbl_scope_parms *parms);
 
 /**
- * Common alloc for external EEM using host or system memory
+ * Common alloc table scope for external EEM using host or system memory
  *
  * [in] tfp
  *   Pointer to TruFlow handle
@@ -388,6 +388,21 @@ int tf_em_ext_common_free(struct tf *tfp,
  */
 int tf_em_ext_common_alloc(struct tf *tfp,
 			   struct tf_alloc_tbl_scope_parms *parms);
+/**
+ * Map a set of parifs to a set of EEM base addresses (table scope)
+ *
+ * [in] tfp
+ *   Pointer to TruFlow handle
+ *
+ * [in] parms
+ *   Pointer to input parameters
+ *
+ * Returns:
+ *   0       - Success
+ *   -EINVAL - Parameter error
+ */
+int tf_em_ext_map_tbl_scope(struct tf *tfp,
+			    struct tf_map_tbl_scope_parms *parms);
 
 /**
  * Allocate External Tbl entry from the scope pool.
drivers/net/bnxt/tf_core/tf_em_common.c +88 -0

91 lines not on this page · raw message

drivers/net/bnxt/tf_core/tf_global_cfg.c +2 -2
index 4ed4039..ebd1a86 100644
@@ -113,7 +113,7 @@ tf_global_cfg_unbind(struct tf *tfp __rte_unused)
 
 int
 tf_global_cfg_set(struct tf *tfp,
-		  struct tf_dev_global_cfg_parms *parms)
+		  struct tf_global_cfg_parms *parms)
 {
 	int rc;
 	struct tf_global_cfg_get_hcapi_parms hparms;
@@ -156,7 +156,7 @@ tf_global_cfg_set(struct tf *tfp,
 
 int
 tf_global_cfg_get(struct tf *tfp,
-		  struct tf_dev_global_cfg_parms *parms)
+		  struct tf_global_cfg_parms *parms)
 
 {
 	int rc;
drivers/net/bnxt/tf_core/tf_global_cfg.h +11 -31

65 lines not on this page · raw message

drivers/net/bnxt/tf_core/tf_msg.c +11 -2
index 7c2ad17..5615eed 100644
@@ -1075,7 +1075,7 @@ tf_msg_get_tbl_entry(struct tf *tfp,
 
 int
 tf_msg_get_global_cfg(struct tf *tfp,
-		      struct tf_dev_global_cfg_parms *params)
+		      struct tf_global_cfg_parms *params)
 {
 	int rc = 0;
 	struct tfp_send_msg_parms parms = { 0 };
@@ -1133,7 +1133,7 @@ tf_msg_get_global_cfg(struct tf *tfp,
 
 int
 tf_msg_set_global_cfg(struct tf *tfp,
-		      struct tf_dev_global_cfg_parms *params)
+		      struct tf_global_cfg_parms *params)
 {
 	int rc = 0;
 	struct tfp_send_msg_parms parms = { 0 };
@@ -1173,6 +1173,15 @@ tf_msg_set_global_cfg(struct tf *tfp,
 
 	tfp_memcpy(req.data, params->config,
 		   params->config_sz_in_bytes);
+
+	/* Only set mask if pointer is provided
+	 */
+	if (params->config_mask) {
+		tfp_memcpy(req.data + params->config_sz_in_bytes,
+			   params->config_mask,
+			   params->config_sz_in_bytes);
+	}
+
 	req.size = tfp_cpu_to_le_32(params->config_sz_in_bytes);
 
 	parms.tf_type = HWRM_TF_GLOBAL_CFG_SET;
drivers/net/bnxt/tf_core/tf_msg.h +2 -2
index 195710e..72bf850 100644
@@ -462,7 +462,7 @@ int tf_msg_get_tbl_entry(struct tf *tfp,
  *   0 on Success else internal Truflow error
  */
 int tf_msg_get_global_cfg(struct tf *tfp,
-			  struct tf_dev_global_cfg_parms *params);
+			  struct tf_global_cfg_parms *params);
 
 /**
  * Sends global cfg update request to Firmware
@@ -477,7 +477,7 @@ int tf_msg_get_global_cfg(struct tf *tfp,
  *   0 on Success else internal Truflow error
  */
 int tf_msg_set_global_cfg(struct tf *tfp,
-			  struct tf_dev_global_cfg_parms *params);
+			  struct tf_global_cfg_parms *params);
 
 /**
  * Sends bulk get message of a Table Type element to the firmware.
Signature · 1 line
2.7.4
#5 lore raw

PATCH 5/14 net/bnxt: table scope to PF Mapping for SR and Wh+

In reply to Venkat Duvvuru

From: Farah Smith <[email protected]>

Legacy devices require PF set of base addresses for EEM operation. A table scope id is a logical construct and is mapped to the PF associated with the communications channel used.
In the case of a VF, the parent PF is used.

---
 drivers/net/bnxt/tf_core/tf_device.h    | 10 +++++++---
 drivers/net/bnxt/tf_core/tf_device_p4.c | 10 +++++-----
 drivers/net/bnxt/tf_core/tf_em_common.c |  6 ++++--
 drivers/net/bnxt/tf_core/tf_em_host.c   |  8 ++++++++
 drivers/net/bnxt/tf_core/tf_tbl.h       |  3 +++
 drivers/net/bnxt/tf_core/tfp.c          | 19 +++++++++++++++++++
 drivers/net/bnxt/tf_core/tfp.h          | 16 ++++++++++++++++
 7 files changed, 62 insertions(+), 10 deletions(-)
drivers/net/bnxt/tf_core/tf_device.h +7 -3
index cf7c36e..b5fc695 100644
@@ -579,8 +579,11 @@ struct tf_dev_ops {
 	 * [in] tfp
 	 *   Pointer to TF handle
 	 *
-	 * [in] parms
-	 *   Pointer to table scope map parameters
+	 * [in] pf
+	 * PF associated with the table scope
+	 *
+	 * [in] parif_bitmask
+	 * Bitmask of PARIFs to enable
 	 *
 	 * [in/out] pointer to the parif_2_pf data to be updated
 	 *
@@ -593,7 +596,8 @@ struct tf_dev_ops {
 	 *    -EINVAL - Error
 	 */
 	int (*tf_dev_map_parif)(struct tf *tfp,
-				struct tf_map_tbl_scope_parms *parms,
+				uint16_t parif_bitmask,
+				uint16_t pf,
 				uint8_t *data,
 				uint8_t *mask,
 				uint16_t sz_in_bytes);
drivers/net/bnxt/tf_core/tf_device_p4.c +5 -5
index 07c8d02..b35e65a 100644
@@ -103,7 +103,8 @@ tf_dev_p4_get_tcam_slice_info(struct tf *tfp __rte_unused,
 
 static int
 tf_dev_p4_map_parif(struct tf *tfp __rte_unused,
-		    struct tf_map_tbl_scope_parms *parms,
+		    uint16_t parif_bitmask,
+		    uint16_t pf,
 		    uint8_t *data,
 		    uint8_t *mask,
 		    uint16_t sz_in_bytes)
@@ -112,21 +113,20 @@ tf_dev_p4_map_parif(struct tf *tfp __rte_unused,
 	uint32_t parif_pf_mask[2] = { 0 };
 	uint32_t parif;
 	uint32_t shift;
-	uint32_t scope_id = (uint32_t)(parms->tbl_scope_id);
 
 	if (sz_in_bytes != sizeof(uint64_t))
 		return -ENOTSUP;
 
 	for (parif = 0; parif < TF_DEV_P4_PARIF_MAX; parif++) {
-		if (parms->parif_bitmask & (1UL << parif)) {
+		if (parif_bitmask & (1UL << parif)) {
 			if (parif < 8) {
 				shift = 4 * parif;
 				parif_pf_mask[0] |= TF_DEV_P4_PF_MASK << shift;
-				parif_pf[0] |= scope_id << shift;
+				parif_pf[0] |= pf << shift;
 			} else {
 				shift = 4 * (parif - 8);
 				parif_pf_mask[1] |= TF_DEV_P4_PF_MASK << shift;
-				parif_pf[1] |= scope_id << shift;
+				parif_pf[1] |= pf << shift;
 			}
 		}
 	}
drivers/net/bnxt/tf_core/tf_em_common.c +4 -2
index c4f3de0..c975bca 100644
@@ -1104,8 +1104,10 @@ int tf_em_ext_map_tbl_scope(struct tf *tfp,
 	}
 	mask = aparms.mem_va;
 
-	rc = dev->ops->tf_dev_map_parif(tfp, parms, (uint8_t *)data,
-					(uint8_t *)mask, sz_in_bytes);
+	rc = dev->ops->tf_dev_map_parif(tfp, parms->parif_bitmask,
+					tbl_scope_cb->pf,
+					(uint8_t *)data, (uint8_t *)mask,
+					sz_in_bytes);
 
 	if (rc) {
 		TFP_DRV_LOG(ERR,
drivers/net/bnxt/tf_core/tf_em_host.c +8 -0
index b5db94f..a106bdf 100644
@@ -392,6 +392,14 @@ tf_em_ext_alloc(struct tf *tfp, struct tf_alloc_tbl_scope_parms *parms)
 	tbl_scope_cb->index = parms->tbl_scope_id;
 	tbl_scope_cb->tbl_scope_id = parms->tbl_scope_id;
 
+	rc = tfp_get_pf(tfp, &tbl_scope_cb->pf);
+	if (rc) {
+		TFP_DRV_LOG(ERR,
+			    "EEM: PF query error rc:%s\n",
+			    strerror(-rc));
+		goto cleanup;
+	}
+
 	for (dir = 0; dir < TF_DIR_MAX; dir++) {
 		rc = tf_msg_em_qcaps(tfp,
 				     dir,
drivers/net/bnxt/tf_core/tf_tbl.h +3 -0
index 2a5d24c..230338c 100644
@@ -38,6 +38,9 @@ struct tf_em_caps {
  */
 struct tf_tbl_scope_cb {
 	uint32_t tbl_scope_id;
+       /** The pf or parent pf of the vf used for table scope creation
+	*/
+	uint16_t pf;
 	int index;
 	struct hcapi_cfa_em_ctx_mem_info em_ctx_info[TF_DIR_MAX];
 	struct tf_em_caps em_caps[TF_DIR_MAX];
drivers/net/bnxt/tf_core/tfp.c +19 -0
index 426a182..0f6d63c 100644
@@ -178,3 +178,22 @@ tfp_get_fid(struct tf *tfp, uint16_t *fw_fid)
 
 	return 0;
 }
+
+int
+tfp_get_pf(struct tf *tfp, uint16_t *pf)
+{
+	struct bnxt *bp = NULL;
+
+	if (tfp == NULL || pf == NULL)
+		return -EINVAL;
+
+	bp = container_of(tfp, struct bnxt, tfp);
+	if (BNXT_VF(bp) && bp->parent) {
+		*pf = bp->parent->fid - 1;
+		return 0;
+	} else if (BNXT_PF(bp)) {
+		*pf = bp->fw_fid - 1;
+		return 0;
+	}
+	return -EINVAL;
+}
drivers/net/bnxt/tf_core/tfp.h +16 -0
index 421a7d9..551b9c5 100644
@@ -268,4 +268,20 @@ int tfp_get_fid(struct tf *tfp, uint16_t *fw_fid);
  */
 int tfp_get_fid(struct tf *tfp, uint16_t *fw_fid);
 
+/**
+ * Get the PF associated with the fw communications channel.
+ *
+ * [in] session
+ *   Pointer to session handle
+ *
+ * [out] pf
+ *   Pointer to the pf id
+ *
+ * Returns:
+ *   0       - Success
+ *   -EINVAL - Failure
+ *
+ */
+int tfp_get_pf(struct tf *tfp, uint16_t *pf);
+
 #endif /* _TFP_H_ */
Signature · 1 line
2.7.4
#6 lore raw

PATCH 6/14 net/bnxt: add build option for EM slot allocation

In reply to Venkat Duvvuru

From: Peter Spreadborough <[email protected]>

- Add build option to select either 2 or 4 slot EM entries.
- The default is 4 slot entries.

---
 drivers/net/bnxt/tf_core/tf_session.h | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)
drivers/net/bnxt/tf_core/tf_session.h +8 -8
index aa7a278..6a5c894 100644
@@ -33,16 +33,16 @@
 #define TF_SESSION_ID_INVALID     0xFFFFFFFF /** Invalid Session ID define */
 
 /**
- * Number of EM entries. Static for now will be removed
- * when parameter added at a later date. At this stage we
- * are using fixed size entries so that each stack entry
- * represents 4 RT (f/n)blocks. So we take the total block
- * allocation for truflow and divide that by 4.
+ * At this stage we are using fixed size entries so that each
+ * stack entry represents either 2 or 4 RT (f/n)blocks. So we
+ * take the total block allocation for truflow and divide that
+ * by either 2 or 4.
  */
-#define TF_SESSION_TOTAL_FN_BLOCKS (1024 * 8) /* 8K blocks */
+#ifdef TF_EM_ENTRY_IPV4_ONLY
+#define TF_SESSION_EM_ENTRY_SIZE 2 /* 2 blocks per entry */
+#else
 #define TF_SESSION_EM_ENTRY_SIZE 4 /* 4 blocks per entry */
-#define TF_SESSION_EM_POOL_SIZE \
-	(TF_SESSION_TOTAL_FN_BLOCKS / TF_SESSION_EM_ENTRY_SIZE)
+#endif
 
 /**
  * Session
Signature · 1 line
2.7.4
#7 lore raw

PATCH 7/14 net/bnxt: update SR ULP resource counts

In reply to Venkat Duvvuru

From: Farah Smith <[email protected]>

Updated the SR ULP requested resource counts to reflect those available after AFM resources are accounted for.

---
 drivers/net/bnxt/tf_ulp/bnxt_ulp.c | 40 +++++++++++++++++++-------------------
 1 file changed, 20 insertions(+), 20 deletions(-)
drivers/net/bnxt/tf_ulp/bnxt_ulp.c +20 -20
index b22929a..d753b5a 100644
@@ -153,11 +153,11 @@ bnxt_ulp_tf_session_resources_get(struct bnxt *bp,
 	case BNXT_ULP_DEVICE_ID_STINGRAY:
 		/** RX **/
 		/* Identifiers */
-		res->ident_cnt[TF_DIR_RX].cnt[TF_IDENT_TYPE_L2_CTXT_HIGH] = 100;
+		res->ident_cnt[TF_DIR_RX].cnt[TF_IDENT_TYPE_L2_CTXT_HIGH] = 315;
 		res->ident_cnt[TF_DIR_RX].cnt[TF_IDENT_TYPE_L2_CTXT_LOW] = 6;
-		res->ident_cnt[TF_DIR_RX].cnt[TF_IDENT_TYPE_WC_PROF] = 10;
-		res->ident_cnt[TF_DIR_RX].cnt[TF_IDENT_TYPE_PROF_FUNC] = 10;
-		res->ident_cnt[TF_DIR_RX].cnt[TF_IDENT_TYPE_EM_PROF] = 10;
+		res->ident_cnt[TF_DIR_RX].cnt[TF_IDENT_TYPE_WC_PROF] = 192;
+		res->ident_cnt[TF_DIR_RX].cnt[TF_IDENT_TYPE_PROF_FUNC] = 64;
+		res->ident_cnt[TF_DIR_RX].cnt[TF_IDENT_TYPE_EM_PROF] = 192;
 
 		/* Table Types */
 		res->tbl_cnt[TF_DIR_RX].cnt[TF_TBL_TYPE_FULL_ACT_RECORD] = 8192;
@@ -170,28 +170,28 @@ bnxt_ulp_tf_session_resources_get(struct bnxt *bp,
 
 		/* TCAMs */
 		res->tcam_cnt[TF_DIR_RX].cnt[TF_TCAM_TBL_TYPE_L2_CTXT_TCAM_HIGH] =
-			100;
+			315;
 		res->tcam_cnt[TF_DIR_RX].cnt[TF_TCAM_TBL_TYPE_L2_CTXT_TCAM_LOW] =
 			6;
-		res->tcam_cnt[TF_DIR_RX].cnt[TF_TCAM_TBL_TYPE_PROF_TCAM] = 100;
-		res->tcam_cnt[TF_DIR_RX].cnt[TF_TCAM_TBL_TYPE_WC_TCAM] = 0;
+		res->tcam_cnt[TF_DIR_RX].cnt[TF_TCAM_TBL_TYPE_PROF_TCAM] = 960;
+		res->tcam_cnt[TF_DIR_RX].cnt[TF_TCAM_TBL_TYPE_WC_TCAM] = 112;
 
 		/* EM */
-		res->em_cnt[TF_DIR_RX].cnt[TF_EM_TBL_TYPE_EM_RECORD] = 13168;
+		res->em_cnt[TF_DIR_RX].cnt[TF_EM_TBL_TYPE_EM_RECORD] = 13200;
 
 		/* EEM */
 		res->em_cnt[TF_DIR_RX].cnt[TF_EM_TBL_TYPE_TBL_SCOPE] = 1;
 
 		/* SP */
-		res->tbl_cnt[TF_DIR_RX].cnt[TF_TBL_TYPE_ACT_SP_SMAC] = 255;
+		res->tbl_cnt[TF_DIR_RX].cnt[TF_TBL_TYPE_ACT_SP_SMAC] = 256;
 
 		/** TX **/
 		/* Identifiers */
-		res->ident_cnt[TF_DIR_TX].cnt[TF_IDENT_TYPE_L2_CTXT_HIGH] = 100;
-		res->ident_cnt[TF_DIR_TX].cnt[TF_IDENT_TYPE_L2_CTXT_LOW] = 100;
-		res->ident_cnt[TF_DIR_TX].cnt[TF_IDENT_TYPE_WC_PROF] = 10;
-		res->ident_cnt[TF_DIR_TX].cnt[TF_IDENT_TYPE_PROF_FUNC] = 10;
-		res->ident_cnt[TF_DIR_TX].cnt[TF_IDENT_TYPE_EM_PROF] = 10;
+		res->ident_cnt[TF_DIR_TX].cnt[TF_IDENT_TYPE_L2_CTXT_HIGH] = 292;
+		res->ident_cnt[TF_DIR_TX].cnt[TF_IDENT_TYPE_L2_CTXT_LOW] = 127;
+		res->ident_cnt[TF_DIR_TX].cnt[TF_IDENT_TYPE_WC_PROF] = 192;
+		res->ident_cnt[TF_DIR_TX].cnt[TF_IDENT_TYPE_PROF_FUNC] = 64;
+		res->ident_cnt[TF_DIR_TX].cnt[TF_IDENT_TYPE_EM_PROF] = 192;
 
 		/* Table Types */
 		res->tbl_cnt[TF_DIR_TX].cnt[TF_TBL_TYPE_FULL_ACT_RECORD] = 8192;
@@ -199,17 +199,17 @@ bnxt_ulp_tf_session_resources_get(struct bnxt *bp,
 		res->tbl_cnt[TF_DIR_TX].cnt[TF_TBL_TYPE_ACT_MODIFY_IPV4] = 1023;
 
 		/* ENCAP */
-		res->tbl_cnt[TF_DIR_TX].cnt[TF_TBL_TYPE_ACT_ENCAP_64B] = 511;
+		res->tbl_cnt[TF_DIR_TX].cnt[TF_TBL_TYPE_ACT_ENCAP_64B] = 367;
 		res->tbl_cnt[TF_DIR_TX].cnt[TF_TBL_TYPE_ACT_ENCAP_16B] = 223;
 		res->tbl_cnt[TF_DIR_TX].cnt[TF_TBL_TYPE_ACT_ENCAP_8B] = 255;
 
 		/* TCAMs */
 		res->tcam_cnt[TF_DIR_TX].cnt[TF_TCAM_TBL_TYPE_L2_CTXT_TCAM_HIGH] =
-			100;
+			292;
 		res->tcam_cnt[TF_DIR_TX].cnt[TF_TCAM_TBL_TYPE_L2_CTXT_TCAM_LOW] =
-			100;
-		res->tcam_cnt[TF_DIR_TX].cnt[TF_TCAM_TBL_TYPE_PROF_TCAM] = 100;
-		res->tcam_cnt[TF_DIR_TX].cnt[TF_TCAM_TBL_TYPE_WC_TCAM] = 0;
+			127;
+		res->tcam_cnt[TF_DIR_TX].cnt[TF_TCAM_TBL_TYPE_PROF_TCAM] = 960;
+		res->tcam_cnt[TF_DIR_TX].cnt[TF_TCAM_TBL_TYPE_WC_TCAM] = 928;
 
 		/* EM */
 		res->em_cnt[TF_DIR_TX].cnt[TF_EM_TBL_TYPE_EM_RECORD] = 15232;
@@ -219,7 +219,7 @@ bnxt_ulp_tf_session_resources_get(struct bnxt *bp,
 
 		/* SP */
 		res->tbl_cnt[TF_DIR_TX].cnt[TF_TBL_TYPE_ACT_SP_SMAC_IPV4] = 488;
-		res->tbl_cnt[TF_DIR_TX].cnt[TF_TBL_TYPE_ACT_SP_SMAC_IPV6] = 511;
+		res->tbl_cnt[TF_DIR_TX].cnt[TF_TBL_TYPE_ACT_SP_SMAC_IPV6] = 512;
 		break;
 	default:
 		return -EINVAL;
Signature · 1 line
2.7.4
#8 lore raw

PATCH 8/14 net/bnxt: fix infinite loop in flow query count API

In reply to Venkat Duvvuru

From: Somnath Kotur <[email protected]>

nxt_resource_idx could be zero in some cases which is invalid and should be part of the while loop condition. Also synchronize access to the flow db using the fdb_lock

Fixes 306c2d28e247 ("net/bnxt: support count action in flow query")
---
 drivers/net/bnxt/tf_ulp/ulp_fc_mgr.c | 51 +++++++++++++++++++-----------------
 1 file changed, 27 insertions(+), 24 deletions(-)
drivers/net/bnxt/tf_ulp/ulp_fc_mgr.c +27 -24
index 051ebac..41736a8 100644
@@ -559,6 +559,9 @@ int ulp_fc_mgr_query_count_get(struct bnxt_ulp_context *ctxt,
 	if (!ulp_fc_info)
 		return -ENODEV;
 
+	if (bnxt_ulp_cntxt_acquire_fdb_lock(ctxt))
+		return -EIO;
+
 	do {
 		rc = ulp_flow_db_resource_get(ctxt,
 					      BNXT_ULP_FDB_TYPE_REGULAR,
@@ -575,35 +578,35 @@ int ulp_fc_mgr_query_count_get(struct bnxt_ulp_context *ctxt,
 			break;
 		}
 
-	} while (!rc);
+	} while (!rc && nxt_resource_index);
+
+	bnxt_ulp_cntxt_release_fdb_lock(ctxt);
 
-	if (rc)
+	if (rc || !found_cntr_resource)
 		return rc;
 
-	if (found_cntr_resource) {
-		dir = params.direction;
-		hw_cntr_id = params.resource_hndl;
-		sw_cntr_idx = hw_cntr_id -
-				ulp_fc_info->shadow_hw_tbl[dir].start_idx;
-		sw_acc_tbl_entry = &ulp_fc_info->sw_acc_tbl[dir][sw_cntr_idx];
-		if (params.resource_sub_type ==
+	dir = params.direction;
+	hw_cntr_id = params.resource_hndl;
+	sw_cntr_idx = hw_cntr_id -
+		ulp_fc_info->shadow_hw_tbl[dir].start_idx;
+	sw_acc_tbl_entry = &ulp_fc_info->sw_acc_tbl[dir][sw_cntr_idx];
+	if (params.resource_sub_type ==
 			BNXT_ULP_RESOURCE_SUB_TYPE_INDEX_TYPE_INT_COUNT) {
-			pthread_mutex_lock(&ulp_fc_info->fc_lock);
-			if (sw_acc_tbl_entry->pkt_count) {
-				count->hits_set = 1;
-				count->bytes_set = 1;
-				count->hits = sw_acc_tbl_entry->pkt_count;
-				count->bytes = sw_acc_tbl_entry->byte_count;
-			}
-			if (count->reset) {
-				sw_acc_tbl_entry->pkt_count = 0;
-				sw_acc_tbl_entry->byte_count = 0;
-			}
-			pthread_mutex_unlock(&ulp_fc_info->fc_lock);
-		} else {
-			/* TBD: Handle External counters */
-			rc = -EINVAL;
+		pthread_mutex_lock(&ulp_fc_info->fc_lock);
+		if (sw_acc_tbl_entry->pkt_count) {
+			count->hits_set = 1;
+			count->bytes_set = 1;
+			count->hits = sw_acc_tbl_entry->pkt_count;
+			count->bytes = sw_acc_tbl_entry->byte_count;
 		}
+		if (count->reset) {
+			sw_acc_tbl_entry->pkt_count = 0;
+			sw_acc_tbl_entry->byte_count = 0;
+		}
+		pthread_mutex_unlock(&ulp_fc_info->fc_lock);
+	} else {
+		/* TBD: Handle External counters */
+		rc = -EINVAL;
 	}
 
 	return rc;
Signature · 1 line
2.7.4
#9 lore raw

PATCH 9/14 net/bnxt: add support for parent flow accumulation counters

In reply to Venkat Duvvuru

From: Kishore Padmanabha <[email protected]>

Added support for parent flow accumulation counters, the child flow counters are aggregated to get the parent flow counter details.

---
 drivers/net/bnxt/tf_ulp/ulp_fc_mgr.c           |  92 +++++-
 drivers/net/bnxt/tf_ulp/ulp_fc_mgr.h           |  19 ++
 drivers/net/bnxt/tf_ulp/ulp_flow_db.c          | 382 ++++++++++++++++++++-----
 drivers/net/bnxt/tf_ulp/ulp_flow_db.h          |  44 +++
 drivers/net/bnxt/tf_ulp/ulp_template_db_enum.h |   3 +-
 5 files changed, 447 insertions(+), 93 deletions(-)
drivers/net/bnxt/tf_ulp/ulp_fc_mgr.c +79 -13
index 41736a8..734b419 100644
@@ -21,13 +21,13 @@ static int
 ulp_fc_mgr_shadow_mem_alloc(struct hw_fc_mem_info *parms, int size)
 {
 	/* Allocate memory*/
-	if (parms == NULL)
+	if (!parms)
 		return -EINVAL;
 
 	parms->mem_va = rte_zmalloc("ulp_fc_info",
 				    RTE_CACHE_LINE_ROUNDUP(size),
 				    4096);
-	if (parms->mem_va == NULL) {
+	if (!parms->mem_va) {
 		BNXT_TF_DBG(ERR, "Allocate failed mem_va\n");
 		return -ENOMEM;
 	}
@@ -149,7 +149,6 @@ ulp_fc_mgr_deinit(struct bnxt_ulp_context *ctxt)
 	for (i = 0; i < TF_DIR_MAX; i++)
 		ulp_fc_mgr_shadow_mem_free(&ulp_fc_info->shadow_hw_tbl[i]);
 
-
 	rte_free(ulp_fc_info);
 
 	/* Safe to ignore on deinit */
@@ -254,7 +253,7 @@ ulp_bulk_get_flow_stats(struct tf *tfp,
 	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;
 
-	if (stats == NULL) {
+	if (!stats) {
 		PMD_DRV_LOG(ERR,
 			    "BULK: Memory not initialized id:0x%x dir:%d\n",
 			    parms.starting_idx, dir);
@@ -274,7 +273,8 @@ ulp_bulk_get_flow_stats(struct tf *tfp,
 		sw_acc_tbl_entry = &fc_info->sw_acc_tbl[dir][i];
 		if (!sw_acc_tbl_entry->valid)
 			continue;
-		sw_acc_tbl_entry->pkt_count += FLOW_CNTR_PKTS(stats[i], dparms);
+		sw_acc_tbl_entry->pkt_count += FLOW_CNTR_PKTS(stats[i],
+							      dparms);
 		sw_acc_tbl_entry->byte_count += FLOW_CNTR_BYTES(stats[i],
 								dparms);
 	}
@@ -282,7 +282,8 @@ ulp_bulk_get_flow_stats(struct tf *tfp,
 	return rc;
 }
 
-static int ulp_get_single_flow_stat(struct tf *tfp,
+static int ulp_get_single_flow_stat(struct bnxt_ulp_context *ctxt,
+				    struct tf *tfp,
 				    struct bnxt_ulp_fc_info *fc_info,
 				    enum tf_dir dir,
 				    uint32_t hw_cntr_id,
@@ -291,7 +292,7 @@ static int ulp_get_single_flow_stat(struct tf *tfp,
 	int rc = 0;
 	struct tf_get_tbl_entry_parms parms = { 0 };
 	enum tf_tbl_type stype = TF_TBL_TYPE_ACT_STATS_64;  /* TBD:Template? */
-	struct sw_acc_counter *sw_acc_tbl_entry = NULL;
+	struct sw_acc_counter *sw_acc_tbl_entry = NULL, *t_sw;
 	uint64_t stats = 0;
 	uint32_t sw_cntr_indx = 0;
 
@@ -318,6 +319,18 @@ static int ulp_get_single_flow_stat(struct tf *tfp,
 	sw_acc_tbl_entry->pkt_count = FLOW_CNTR_PKTS(stats, dparms);
 	sw_acc_tbl_entry->byte_count = FLOW_CNTR_BYTES(stats, dparms);
 
+	/* Update the parent counters if it is child flow */
+	if (sw_acc_tbl_entry->parent_flow_id) {
+		/* Update the parent counters */
+		t_sw = sw_acc_tbl_entry;
+		if (ulp_flow_db_parent_flow_count_update(ctxt,
+							 t_sw->parent_flow_id,
+							 t_sw->pkt_count,
+							 t_sw->byte_count)) {
+			PMD_DRV_LOG(ERR, "Error updating parent counters\n");
+		}
+	}
+
 	return rc;
 }
 
@@ -384,13 +397,17 @@ ulp_fc_mgr_alarm_cb(void *arg)
 			break;
 	}
 	*/
+
+	/* reset the parent accumulation counters before accumulation if any */
+	ulp_flow_db_parent_flow_count_reset(ctxt);
+
 	num_entries = dparms->flow_count_db_entries / 2;
 	for (i = 0; i < TF_DIR_MAX; i++) {
 		for (j = 0; j < num_entries; j++) {
 			if (!ulp_fc_info->sw_acc_tbl[i][j].valid)
 				continue;
 			hw_cntr_id = ulp_fc_info->sw_acc_tbl[i][j].hw_cntr_id;
-			rc = ulp_get_single_flow_stat(tfp, ulp_fc_info, i,
+			rc = ulp_get_single_flow_stat(ctxt, tfp, ulp_fc_info, i,
 						      hw_cntr_id, dparms);
 			if (rc)
 				break;
@@ -573,11 +590,12 @@ int ulp_fc_mgr_query_count_get(struct bnxt_ulp_context *ctxt,
 		     (params.resource_sub_type ==
 		      BNXT_ULP_RESOURCE_SUB_TYPE_INDEX_TYPE_INT_COUNT ||
 		      params.resource_sub_type ==
-		      BNXT_ULP_RESOURCE_SUB_TYPE_INDEX_TYPE_EXT_COUNT)) {
+		      BNXT_ULP_RESOURCE_SUB_TYPE_INDEX_TYPE_EXT_COUNT ||
+		      params.resource_sub_type ==
+		      BNXT_ULP_RESOURCE_SUB_TYPE_INDEX_TYPE_INT_COUNT_ACC)) {
 			found_cntr_resource = true;
 			break;
 		}
-
 	} while (!rc && nxt_resource_index);
 
 	bnxt_ulp_cntxt_release_fdb_lock(ctxt);
@@ -587,12 +605,12 @@ int ulp_fc_mgr_query_count_get(struct bnxt_ulp_context *ctxt,
 
 	dir = params.direction;
 	hw_cntr_id = params.resource_hndl;
-	sw_cntr_idx = hw_cntr_id -
-		ulp_fc_info->shadow_hw_tbl[dir].start_idx;
-	sw_acc_tbl_entry = &ulp_fc_info->sw_acc_tbl[dir][sw_cntr_idx];
 	if (params.resource_sub_type ==
 			BNXT_ULP_RESOURCE_SUB_TYPE_INDEX_TYPE_INT_COUNT) {
 		pthread_mutex_lock(&ulp_fc_info->fc_lock);
+		sw_cntr_idx = hw_cntr_id -
+			ulp_fc_info->shadow_hw_tbl[dir].start_idx;
+		sw_acc_tbl_entry = &ulp_fc_info->sw_acc_tbl[dir][sw_cntr_idx];
 		if (sw_acc_tbl_entry->pkt_count) {
 			count->hits_set = 1;
 			count->bytes_set = 1;
@@ -604,6 +622,15 @@ int ulp_fc_mgr_query_count_get(struct bnxt_ulp_context *ctxt,
 			sw_acc_tbl_entry->byte_count = 0;
 		}
 		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 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 {
 		/* TBD: Handle External counters */
 		rc = -EINVAL;
@@ -611,3 +638,42 @@ int ulp_fc_mgr_query_count_get(struct bnxt_ulp_context *ctxt,
 
 	return rc;
 }
+
+/*
+ * Set the parent flow if it is SW accumulation counter entry.
+ *
+ * ctxt [in] The ulp context for the flow counter manager
+ *
+ * dir [in] The direction of the flow
+ *
+ * hw_cntr_id [in] The HW flow counter ID
+ *
+ * fid [in] parent flow id
+ *
+ */
+int32_t ulp_fc_mgr_cntr_parent_flow_set(struct bnxt_ulp_context *ctxt,
+					enum tf_dir dir,
+					uint32_t hw_cntr_id,
+					uint32_t fid)
+{
+	struct bnxt_ulp_fc_info *ulp_fc_info;
+	uint32_t sw_cntr_idx;
+	int32_t rc = 0;
+
+	ulp_fc_info = bnxt_ulp_cntxt_ptr2_fc_info_get(ctxt);
+	if (!ulp_fc_info)
+		return -EIO;
+
+	pthread_mutex_lock(&ulp_fc_info->fc_lock);
+	sw_cntr_idx = hw_cntr_id - ulp_fc_info->shadow_hw_tbl[dir].start_idx;
+	if (ulp_fc_info->sw_acc_tbl[dir][sw_cntr_idx].valid) {
+		ulp_fc_info->sw_acc_tbl[dir][sw_cntr_idx].parent_flow_id = fid;
+	} else {
+		BNXT_TF_DBG(ERR, "Failed to set parent flow id %x:%x\n",
+			    hw_cntr_id, fid);
+		rc = -ENOENT;
+	}
+	pthread_mutex_unlock(&ulp_fc_info->fc_lock);
+
+	return rc;
+}
drivers/net/bnxt/tf_ulp/ulp_fc_mgr.h +19 -0
index 0cb880d..de4d3df 100644
@@ -26,6 +26,7 @@ struct sw_acc_counter {
 	uint64_t byte_count;
 	bool	valid;
 	uint32_t hw_cntr_id;
+	uint32_t parent_flow_id;
 };
 
 struct hw_fc_mem_info {
@@ -163,4 +164,22 @@ bool ulp_fc_mgr_thread_isstarted(struct bnxt_ulp_context *ctxt);
 int ulp_fc_mgr_query_count_get(struct bnxt_ulp_context *ulp_ctx,
 			       uint32_t flow_id,
 			       struct rte_flow_query_count *count);
+
+/*
+ * Set the parent flow if in the SW accumulator table entry
+ *
+ * ctxt [in] The ulp context for the flow counter manager
+ *
+ * dir [in] The direction of the flow
+ *
+ * hw_cntr_id [in] The HW flow counter ID
+ *
+ * fid [in] parent flow id
+ *
+ */
+int32_t ulp_fc_mgr_cntr_parent_flow_set(struct bnxt_ulp_context *ctxt,
+					enum tf_dir dir,
+					uint32_t hw_cntr_id,
+					uint32_t fid);
+
 #endif /* _ULP_FC_MGR_H_ */
drivers/net/bnxt/tf_ulp/ulp_flow_db.c +303 -79

513 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_flow_db.h +44 -0

54 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_template_db_enum.h +2 -1
index 168e308..6dade9a 100644
@@ -332,7 +332,8 @@ enum bnxt_ulp_resource_sub_type {
 	BNXT_ULP_RESOURCE_SUB_TYPE_INDEX_TYPE_NORMAL = 0,
 	BNXT_ULP_RESOURCE_SUB_TYPE_INDEX_TYPE_VFR_CFA_ACTION = 1,
 	BNXT_ULP_RESOURCE_SUB_TYPE_INDEX_TYPE_INT_COUNT = 2,
-	BNXT_ULP_RESOURCE_SUB_TYPE_INDEX_TYPE_EXT_COUNT = 3,
+	BNXT_ULP_RESOURCE_SUB_TYPE_INDEX_TYPE_INT_COUNT_ACC = 3,
+	BNXT_ULP_RESOURCE_SUB_TYPE_INDEX_TYPE_EXT_COUNT = 4,
 	BNXT_ULP_RESOURCE_SUB_TYPE_CACHE_TYPE_L2_CNTXT_TCAM = 0,
 	BNXT_ULP_RESOURCE_SUB_TYPE_CACHE_TYPE_PROFILE_TCAM = 1
 };
Signature · 1 line
2.7.4
#10 lore raw

PATCH 10/14 net/bnxt: use cfa pair alloc for configuring reps

In reply to Venkat Duvvuru

From: Somnath Kotur <[email protected]>

Instead of vfr_alloc for Wh+ and pair_alloc for Stingray, converge to cfa_pair_alloc/free for both and set the cmd request structure bits accordingly.
As part of this, remove the old vfr_alloc cmd definitions as FW has deprecated support for them

---
 drivers/net/bnxt/bnxt.h        |  6 ++++-
 drivers/net/bnxt/bnxt_ethdev.c |  2 ++
 drivers/net/bnxt/bnxt_hwrm.c   | 60 +++++-------------------------------------
 drivers/net/bnxt/bnxt_hwrm.h   |  2 --
 drivers/net/bnxt/bnxt_reps.c   | 18 ++++++-------
 5 files changed, 21 insertions(+), 67 deletions(-)
drivers/net/bnxt/bnxt.h +5 -1
index a951bca..5717819 100644
@@ -836,12 +836,14 @@ struct bnxt_representor {
 #define BNXT_REP_Q_F2R_VALID		BIT(2)
 #define BNXT_REP_FC_R2F_VALID		BIT(3)
 #define BNXT_REP_FC_F2R_VALID		BIT(4)
+#define BNXT_REP_BASED_PF_VALID		BIT(5)
 	uint32_t		flags;
 	uint16_t		fw_fid;
 #define	BNXT_DFLT_VNIC_ID_INVALID	0xFFFF
 	uint16_t		dflt_vnic_id;
 	uint16_t		svif;
 	uint16_t		vfr_tx_cfa_action;
+	uint8_t			parent_pf_idx; /* Logical PF index */
 	uint32_t		dpdk_port_id;
 	uint32_t		rep_based_pf;
 	uint8_t			rep_q_r2f;
@@ -863,7 +865,9 @@ struct bnxt_representor {
 	uint64_t                rx_drop_bytes[BNXT_MAX_VF_REP_RINGS];
 };
 
-#define BNXT_REP_PF(vfr_bp)	((vfr_bp)->flags & BNXT_REP_IS_PF)
+#define BNXT_REP_PF(vfr_bp)		((vfr_bp)->flags & BNXT_REP_IS_PF)
+#define BNXT_REP_BASED_PF(vfr_bp)	\
+		((vfr_bp)->flags & BNXT_REP_BASED_PF_VALID)
 
 struct bnxt_vf_rep_tx_queue {
 	struct bnxt_tx_queue *txq;
drivers/net/bnxt/bnxt_ethdev.c +2 -0
index 8dd4ec3..35491d8 100644
@@ -5762,6 +5762,8 @@ bnxt_parse_devarg_rep_based_pf(__rte_unused const char *key,
 	}
 
 	vfr_bp->rep_based_pf = rep_based_pf;
+	vfr_bp->flags |= BNXT_REP_BASED_PF_VALID;
+
 	PMD_DRV_LOG(INFO, "rep-based-pf = %d\n", vfr_bp->rep_based_pf);
 
 	return 0;
drivers/net/bnxt/bnxt_hwrm.c +6 -54

79 lines not on this page · raw message

drivers/net/bnxt/bnxt_hwrm.h +0 -2
index a7fa7f6..23ca6ab 100644
@@ -297,8 +297,6 @@ int bnxt_hwrm_port_phy_qcaps(struct bnxt *bp);
 int bnxt_hwrm_oem_cmd(struct bnxt *bp, uint32_t entry_num);
 int bnxt_clear_one_vnic_filter(struct bnxt *bp,
 			       struct bnxt_filter_info *filter);
-int bnxt_hwrm_cfa_vfr_alloc(struct bnxt *bp, uint16_t vf_idx);
-int bnxt_hwrm_cfa_vfr_free(struct bnxt *bp, uint16_t vf_idx);
 void bnxt_hwrm_free_vf_info(struct bnxt *bp);
 int bnxt_hwrm_first_vf_id_query(struct bnxt *bp, uint16_t fid,
 				uint16_t *first_vf_id);
drivers/net/bnxt/bnxt_reps.c +8 -10
index 74a76fc..957021d 100644
@@ -215,8 +215,9 @@ int bnxt_representor_init(struct rte_eth_dev *eth_dev, void *params)
 		    "Switch domain id %d: Representor Device %d init done\n",
 		    vf_rep_bp->switch_domain_id, vf_rep_bp->vf_id);
 
-	if (vf_rep_bp->rep_based_pf) {
+	if (BNXT_REP_BASED_PF(vf_rep_bp)) {
 		vf_rep_bp->fw_fid = vf_rep_bp->rep_based_pf + 1;
+		vf_rep_bp->parent_pf_idx = vf_rep_bp->rep_based_pf;
 		if (!(BNXT_REP_PF(vf_rep_bp))) {
 			/* VF representor for the remote PF,get first_vf_id */
 			rc = bnxt_hwrm_first_vf_id_query(parent_bp,
@@ -236,6 +237,10 @@ int bnxt_representor_init(struct rte_eth_dev *eth_dev, void *params)
 		}
 	}  else {
 		vf_rep_bp->fw_fid = rep_params->vf_id + parent_bp->first_vf_id;
+		if (BNXT_VF_IS_TRUSTED(parent_bp))
+			vf_rep_bp->parent_pf_idx = parent_bp->parent->fid - 1;
+		else
+			vf_rep_bp->parent_pf_idx = parent_bp->fw_fid - 1;
 	}
 
 	PMD_DRV_LOG(INFO, "vf_rep->fw_fid = %d\n", vf_rep_bp->fw_fid);
@@ -329,11 +334,7 @@ static int bnxt_tf_vfr_alloc(struct rte_eth_dev *vfr_ethdev)
 	/* update the port id so you can backtrack to ethdev */
 	vfr->dpdk_port_id = vfr_ethdev->data->port_id;
 
-	if (BNXT_STINGRAY(parent_bp)) {
-		rc = bnxt_hwrm_cfa_pair_alloc(parent_bp, vfr);
-	} else {
-		rc = bnxt_hwrm_cfa_vfr_alloc(parent_bp, vfr->vf_id);
-	}
+	rc = bnxt_hwrm_cfa_pair_alloc(parent_bp, vfr);
 	if (rc) {
 		BNXT_TF_DBG(ERR, "Failed in hwrm vfr alloc vfr:%u rc=%d\n",
 			    vfr->vf_id, rc);
@@ -468,10 +469,7 @@ static int bnxt_vfr_free(struct bnxt_representor *vfr)
 		    vfr->vf_id);
 	vfr->vfr_tx_cfa_action = 0;
 
-	if (BNXT_STINGRAY(parent_bp))
-		rc = bnxt_hwrm_cfa_pair_free(parent_bp, vfr);
-	else
-		rc = bnxt_hwrm_cfa_vfr_free(parent_bp, vfr->vf_id);
+	rc = bnxt_hwrm_cfa_pair_free(parent_bp, vfr);
 
 	return rc;
 }
Signature · 1 line
2.7.4
#11 lore raw

PATCH 11/14 net/bnxt: add mapper support for wildcard TCAM entry

In reply to Venkat Duvvuru

From: Kishore Padmanabha <[email protected]>

Added support for the key and mask fields encoding for the wildcard tcam entry.

---
 drivers/net/bnxt/tf_ulp/ulp_mapper.c |  47 +++++++++++--
 drivers/net/bnxt/tf_ulp/ulp_utils.c  | 125 +++++++++++++++++++++++++++++++++++
 drivers/net/bnxt/tf_ulp/ulp_utils.h  |  48 +++++++++++++-
 3 files changed, 212 insertions(+), 8 deletions(-)
drivers/net/bnxt/tf_ulp/ulp_mapper.c +40 -7
index b74cb92..27b4780 100644
@@ -1497,6 +1497,29 @@ ulp_mapper_tcam_tbl_entry_write(struct bnxt_ulp_mapper_parms *parms,
 	return rc;
 }
 
+#define BNXT_ULP_WC_TCAM_SLICE_SIZE 80
+/* internal function to post process the key/mask blobs for wildcard tcam tbl */
+static void ulp_mapper_wc_tcam_tbl_post_process(struct ulp_blob *blob,
+						uint32_t len)
+{
+	uint8_t mode[2] = {0x0, 0x0};
+	uint32_t mode_len = len / BNXT_ULP_WC_TCAM_SLICE_SIZE;
+	uint32_t size, idx;
+
+	/* Add the mode bits to the key and mask*/
+	if (mode_len == 2)
+		mode[1] = 2;
+	else if (mode_len > 2)
+		mode[1] = 3;
+
+	size = BNXT_ULP_WC_TCAM_SLICE_SIZE + ULP_BYTE_2_BITS(sizeof(mode));
+	for (idx = 0; idx < mode_len; idx++)
+		ulp_blob_insert(blob, (size * idx), mode,
+				ULP_BYTE_2_BITS(sizeof(mode)));
+	ulp_blob_perform_64B_word_swap(blob);
+	ulp_blob_perform_64B_byte_swap(blob);
+}
+
 static int32_t
 ulp_mapper_tcam_tbl_process(struct bnxt_ulp_mapper_parms *parms,
 			    struct bnxt_ulp_mapper_tbl_info *tbl)
@@ -1533,9 +1556,9 @@ ulp_mapper_tcam_tbl_process(struct bnxt_ulp_mapper_parms *parms,
 		return -EINVAL;
 	}
 
-	if (!ulp_blob_init(&key, tbl->key_bit_size,
+	if (!ulp_blob_init(&key, tbl->blob_key_bit_size,
 			   parms->device_params->byte_order) ||
-	    !ulp_blob_init(&mask, tbl->key_bit_size,
+	    !ulp_blob_init(&mask, tbl->blob_key_bit_size,
 			   parms->device_params->byte_order) ||
 	    !ulp_blob_init(&data, tbl->result_bit_size,
 			   parms->device_params->byte_order) ||
@@ -1545,6 +1568,11 @@ ulp_mapper_tcam_tbl_process(struct bnxt_ulp_mapper_parms *parms,
 		return -EINVAL;
 	}
 
+	if (tbl->resource_type == TF_TCAM_TBL_TYPE_WC_TCAM) {
+		key.byte_order = BNXT_ULP_BYTE_ORDER_BE;
+		mask.byte_order = BNXT_ULP_BYTE_ORDER_BE;
+	}
+
 	/* create the key/mask */
 	/*
 	 * NOTE: The WC table will require some kind of flag to handle the
@@ -1570,6 +1598,11 @@ ulp_mapper_tcam_tbl_process(struct bnxt_ulp_mapper_parms *parms,
 		}
 	}
 
+	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
@@ -1578,18 +1611,18 @@ ulp_mapper_tcam_tbl_process(struct bnxt_ulp_mapper_parms *parms,
 		aparms.dir		= tbl->direction;
 		aparms.tcam_tbl_type	= tbl->resource_type;
 		aparms.search_enable	= tbl->srch_b4_alloc;
-		aparms.key_sz_in_bits	= tbl->key_bit_size;
 		aparms.key		= ulp_blob_data_get(&key, &tmplen);
-		if (tbl->key_bit_size != 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->key_bit_size);
+				    tmplen, tbl->blob_key_bit_size);
 			return -EINVAL;
 		}
 
 		aparms.mask		= ulp_blob_data_get(&mask, &tmplen);
-		if (tbl->key_bit_size != tmplen) {
+		if (tbl->blob_key_bit_size != tmplen) {
 			BNXT_TF_DBG(ERR, "Mask len (%d) != Expected (%d)\n",
-				    tmplen, tbl->key_bit_size);
+				    tmplen, tbl->blob_key_bit_size);
 			return -EINVAL;
 		}
 
drivers/net/bnxt/tf_ulp/ulp_utils.c +125 -0

137 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_utils.h +47 -1

72 lines not on this page · raw message

Signature · 1 line
2.7.4
#12 lore raw

PATCH 12/14 net/bnxt: refactor flow id allocation

In reply to Venkat Duvvuru

Currently, the flow id is allocated inside ulp_mapper_flow_create. However with vxlan decap feature if F2 flow comes before F1 flow then F2 is cached and not really installed in the hardware which means the code will return without calling ulp_mapper_flow_create. But, ULP has to still return valid flow id to the stack. Hence, move the flow id allocation outside ulp_mapper_flow_create.

---
 drivers/net/bnxt/tf_ulp/bnxt_ulp_flow.c  | 109 ++++++++++++++++++++++---------
 drivers/net/bnxt/tf_ulp/ulp_def_rules.c  |  48 ++++++++++++--
 drivers/net/bnxt/tf_ulp/ulp_mapper.c     |  35 +---------
 drivers/net/bnxt/tf_ulp/ulp_mapper.h     |   4 +-
 drivers/net/bnxt/tf_ulp/ulp_rte_parser.h |   9 +++
 5 files changed, 132 insertions(+), 73 deletions(-)
drivers/net/bnxt/tf_ulp/bnxt_ulp_flow.c +77 -32
index c7b2982..47fbaba 100644
@@ -74,6 +74,29 @@ bnxt_ulp_set_dir_attributes(struct ulp_rte_parser_params *params,
 		params->dir_attr |= BNXT_ULP_FLOW_ATTR_TRANSFER;
 }
 
+void
+bnxt_ulp_init_mapper_params(struct bnxt_ulp_mapper_create_parms *mapper_cparms,
+			    struct ulp_rte_parser_params *params,
+			    uint32_t priority, uint32_t class_id,
+			    uint32_t act_tmpl, uint16_t func_id,
+			    uint32_t fid,
+			    enum bnxt_ulp_fdb_type flow_type)
+{
+	mapper_cparms->app_priority = priority;
+	mapper_cparms->dir_attr = params->dir_attr;
+
+	mapper_cparms->class_tid = class_id;
+	mapper_cparms->act_tid = act_tmpl;
+	mapper_cparms->func_id = func_id;
+	mapper_cparms->hdr_bitmap = &params->hdr_bitmap;
+	mapper_cparms->hdr_field = params->hdr_field;
+	mapper_cparms->comp_fld = params->comp_fld;
+	mapper_cparms->act = &params->act_bitmap;
+	mapper_cparms->act_prop = &params->act_prop;
+	mapper_cparms->flow_type = flow_type;
+	mapper_cparms->flow_id = fid;
+}
+
 /* Function to create the rte flow. */
 static struct rte_flow *
 bnxt_ulp_flow_create(struct rte_eth_dev *dev,
@@ -85,22 +108,23 @@ bnxt_ulp_flow_create(struct rte_eth_dev *dev,
 	struct bnxt_ulp_mapper_create_parms mapper_cparms = { 0 };
 	struct ulp_rte_parser_params params;
 	struct bnxt_ulp_context *ulp_ctx;
+	int rc, ret = BNXT_TF_RC_ERROR;
 	uint32_t class_id, act_tmpl;
 	struct rte_flow *flow_id;
+	uint16_t func_id;
 	uint32_t fid;
-	int ret = BNXT_TF_RC_ERROR;
 
 	if (bnxt_ulp_flow_validate_args(attr,
 					pattern, actions,
 					error) == BNXT_TF_RC_ERROR) {
 		BNXT_TF_DBG(ERR, "Invalid arguments being passed\n");
-		goto parse_error;
+		goto parse_err1;
 	}
 
 	ulp_ctx = bnxt_ulp_eth_dev_ptr2_cntxt_get(dev);
 	if (!ulp_ctx) {
 		BNXT_TF_DBG(ERR, "ULP context is not initialized\n");
-		goto parse_error;
+		goto parse_err1;
 	}
 
 	/* Initialize the parser params */
@@ -116,56 +140,72 @@ bnxt_ulp_flow_create(struct rte_eth_dev *dev,
 	ULP_COMP_FLD_IDX_WR(&params, BNXT_ULP_CF_IDX_SVIF_FLAG,
 			    BNXT_ULP_INVALID_SVIF_VAL);
 
+	/* Get the function id */
+	if (ulp_port_db_port_func_id_get(ulp_ctx,
+					 dev->data->port_id,
+					 &func_id)) {
+		BNXT_TF_DBG(ERR, "conversion of port to func id failed\n");
+		goto parse_err1;
+	}
+
+	/* Protect flow creation */
+	if (bnxt_ulp_cntxt_acquire_fdb_lock(ulp_ctx)) {
+		BNXT_TF_DBG(ERR, "Flow db lock acquire failed\n");
+		goto parse_err1;
+	}
+
+	/* Allocate a Flow ID for attaching all resources for the flow to.
+	 * Once allocated, all errors have to walk the list of resources and
+	 * free each of them.
+	 */
+	rc = ulp_flow_db_fid_alloc(ulp_ctx, BNXT_ULP_FDB_TYPE_REGULAR,
+				   func_id, &fid);
+	if (rc) {
+		BNXT_TF_DBG(ERR, "Unable to allocate flow table entry\n");
+		goto parse_err2;
+	}
+
 	/* Parse the rte flow pattern */
 	ret = bnxt_ulp_rte_parser_hdr_parse(pattern, &params);
 	if (ret != BNXT_TF_RC_SUCCESS)
-		goto parse_error;
+		goto parse_err3;
 
 	/* Parse the rte flow action */
 	ret = bnxt_ulp_rte_parser_act_parse(actions, &params);
 	if (ret != BNXT_TF_RC_SUCCESS)
-		goto parse_error;
+		goto parse_err3;
 
 	/* Perform the rte flow post process */
 	ret = bnxt_ulp_rte_parser_post_process(&params);
 	if (ret != BNXT_TF_RC_SUCCESS)
-		goto parse_error;
+		goto parse_err3;
 
 	ret = ulp_matcher_pattern_match(&params, &class_id);
 	if (ret != BNXT_TF_RC_SUCCESS)
-		goto parse_error;
+		goto parse_err3;
 
 	ret = ulp_matcher_action_match(&params, &act_tmpl);
 	if (ret != BNXT_TF_RC_SUCCESS)
-		goto parse_error;
+		goto parse_err3;
 
-	mapper_cparms.app_priority = attr->priority;
-	mapper_cparms.hdr_bitmap = &params.hdr_bitmap;
-	mapper_cparms.hdr_field = params.hdr_field;
-	mapper_cparms.comp_fld = params.comp_fld;
-	mapper_cparms.act = &params.act_bitmap;
-	mapper_cparms.act_prop = &params.act_prop;
-	mapper_cparms.class_tid = class_id;
-	mapper_cparms.act_tid = act_tmpl;
-	mapper_cparms.flow_type = BNXT_ULP_FDB_TYPE_REGULAR;
+	bnxt_ulp_init_mapper_params(&mapper_cparms, &params, attr->priority,
+				    class_id, act_tmpl, func_id, fid,
+				    BNXT_ULP_FDB_TYPE_REGULAR);
+	/* Call the ulp mapper to create the flow in the hardware. */
+	ret = ulp_mapper_flow_create(ulp_ctx, &mapper_cparms);
+	if (ret)
+		goto parse_err3;
 
-	/* Get the function id */
-	if (ulp_port_db_port_func_id_get(ulp_ctx,
-					 dev->data->port_id,
-					 &mapper_cparms.func_id)) {
-		BNXT_TF_DBG(ERR, "conversion of port to func id failed\n");
-		goto parse_error;
-	}
-	mapper_cparms.dir_attr = params.dir_attr;
+	bnxt_ulp_cntxt_release_fdb_lock(ulp_ctx);
 
-	/* Call the ulp mapper to create the flow in the hardware. */
-	ret = ulp_mapper_flow_create(ulp_ctx, &mapper_cparms, &fid);
-	if (!ret) {
-		flow_id = (struct rte_flow *)((uintptr_t)fid);
-		return flow_id;
-	}
+	flow_id = (struct rte_flow *)((uintptr_t)fid);
+	return flow_id;
 
-parse_error:
+parse_err3:
+	ulp_flow_db_fid_free(ulp_ctx, BNXT_ULP_FDB_TYPE_REGULAR, fid);
+parse_err2:
+	bnxt_ulp_cntxt_release_fdb_lock(ulp_ctx);
+parse_err1:
 	rte_flow_error_set(error, ret, RTE_FLOW_ERROR_TYPE_HANDLE, NULL,
 			   "Failed to create flow.");
 	return NULL;
@@ -281,6 +321,10 @@ bnxt_ulp_flow_destroy(struct rte_eth_dev *dev,
 		return -EINVAL;
 	}
 
+	if (bnxt_ulp_cntxt_acquire_fdb_lock(ulp_ctx)) {
+		BNXT_TF_DBG(ERR, "Flow db lock acquire failed\n");
+		return -EINVAL;
+	}
 	ret = ulp_mapper_flow_destroy(ulp_ctx, BNXT_ULP_FDB_TYPE_REGULAR,
 				      flow_id);
 	if (ret) {
@@ -290,6 +334,7 @@ bnxt_ulp_flow_destroy(struct rte_eth_dev *dev,
 					   RTE_FLOW_ERROR_TYPE_HANDLE, NULL,
 					   "Failed to destroy flow.");
 	}
+	bnxt_ulp_cntxt_release_fdb_lock(ulp_ctx);
 
 	return ret;
 }
drivers/net/bnxt/tf_ulp/ulp_def_rules.c +41 -7

81 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_mapper.c +3 -32
index 27b4780..d5c129b 100644
@@ -2723,15 +2723,9 @@ ulp_mapper_flow_destroy(struct bnxt_ulp_context *ulp_ctx,
 		BNXT_TF_DBG(ERR, "Invalid parms, unable to free flow\n");
 		return -EINVAL;
 	}
-	if (bnxt_ulp_cntxt_acquire_fdb_lock(ulp_ctx)) {
-		BNXT_TF_DBG(ERR, "Flow db lock acquire failed\n");
-		return -EINVAL;
-	}
 
 	rc = ulp_mapper_resources_free(ulp_ctx, flow_type, fid);
-	bnxt_ulp_cntxt_release_fdb_lock(ulp_ctx);
 	return rc;
-
 }
 
 /* Function to handle the default global templates that are allocated during
@@ -2795,8 +2789,7 @@ ulp_mapper_glb_template_table_init(struct bnxt_ulp_context *ulp_ctx)
  */
 int32_t
 ulp_mapper_flow_create(struct bnxt_ulp_context *ulp_ctx,
-		       struct bnxt_ulp_mapper_create_parms *cparms,
-		       uint32_t *flowid)
+		       struct bnxt_ulp_mapper_create_parms *cparms)
 {
 	struct bnxt_ulp_mapper_parms parms;
 	struct ulp_regfile regfile;
@@ -2821,6 +2814,7 @@ ulp_mapper_flow_create(struct bnxt_ulp_context *ulp_ctx,
 	parms.flow_type = cparms->flow_type;
 	parms.parent_flow = cparms->parent_flow;
 	parms.parent_fid = cparms->parent_fid;
+	parms.fid = cparms->flow_id;
 
 	/* Get the device id from the ulp context */
 	if (bnxt_ulp_cntxt_dev_id_get(ulp_ctx, &parms.dev_id)) {
@@ -2861,26 +2855,7 @@ ulp_mapper_flow_create(struct bnxt_ulp_context *ulp_ctx,
 		return -EINVAL;
 	}
 
-	/* Protect flow creation */
-	if (bnxt_ulp_cntxt_acquire_fdb_lock(ulp_ctx)) {
-		BNXT_TF_DBG(ERR, "Flow db lock acquire failed\n");
-		return -EINVAL;
-	}
-
-	/* Allocate a Flow ID for attaching all resources for the flow to.
-	 * Once allocated, all errors have to walk the list of resources and
-	 * free each of them.
-	 */
-	rc = ulp_flow_db_fid_alloc(ulp_ctx,
-				   parms.flow_type,
-				   cparms->func_id,
-				   &parms.fid);
-	if (rc) {
-		BNXT_TF_DBG(ERR, "Unable to allocate flow table entry\n");
-		bnxt_ulp_cntxt_release_fdb_lock(ulp_ctx);
-		return rc;
-	}
-
+	/* Process the action template list from the selected action table*/
 	if (parms.act_tid) {
 		parms.tmpl_type = BNXT_ULP_TEMPLATE_TYPE_ACTION;
 		/* Process the action template tables */
@@ -2911,13 +2886,9 @@ ulp_mapper_flow_create(struct bnxt_ulp_context *ulp_ctx,
 			goto flow_error;
 	}
 
-	*flowid = parms.fid;
-	bnxt_ulp_cntxt_release_fdb_lock(ulp_ctx);
-
 	return rc;
 
 flow_error:
-	bnxt_ulp_cntxt_release_fdb_lock(ulp_ctx);
 	/* Free all resources that were allocated during flow creation */
 	trc = ulp_mapper_flow_destroy(ulp_ctx, BNXT_ULP_FDB_TYPE_REGULAR,
 				      parms.fid);
drivers/net/bnxt/tf_ulp/ulp_mapper.h +2 -2
index 542e41e..0595d15 100644
@@ -93,6 +93,7 @@ struct bnxt_ulp_mapper_create_parms {
 	uint32_t			dir_attr;
 	enum bnxt_ulp_fdb_type		flow_type;
 
+	uint32_t			flow_id;
 	/* if set then create it as a child flow with parent as parent_fid */
 	uint32_t			parent_fid;
 	/* if set then create a parent flow */
@@ -113,8 +114,7 @@ ulp_mapper_deinit(struct bnxt_ulp_context *ulp_ctx);
  */
 int32_t
 ulp_mapper_flow_create(struct bnxt_ulp_context	*ulp_ctx,
-		       struct bnxt_ulp_mapper_create_parms *parms,
-		       uint32_t *flowid);
+		       struct bnxt_ulp_mapper_create_parms *parms);
 
 /* Function that frees all resources associated with the flow. */
 int32_t
drivers/net/bnxt/tf_ulp/ulp_rte_parser.h +9 -0
index 41f3df9..bb5a8a4 100644
@@ -11,6 +11,7 @@
 #include <rte_flow_driver.h>
 #include "ulp_template_db_enum.h"
 #include "ulp_template_struct.h"
+#include "ulp_mapper.h"
 
 /* defines to be used in the tunnel header parsing */
 #define BNXT_ULP_ENCAP_IPV4_VER_HLEN_TOS	2
@@ -34,6 +35,14 @@
 #define	BNXT_ULP_PARSER_IPV6_TC			0x0ff00000
 #define	BNXT_ULP_PARSER_IPV6_FLOW_LABEL		0x000fffff
 
+void
+bnxt_ulp_init_mapper_params(struct bnxt_ulp_mapper_create_parms *mapper_cparms,
+			    struct ulp_rte_parser_params *params,
+			    uint32_t priority, uint32_t class_id,
+			    uint32_t act_tmpl, uint16_t func_id,
+			    uint32_t flow_id,
+			    enum bnxt_ulp_fdb_type flow_type);
+
 /* Function to handle the parsing of the RTE port id. */
 int32_t
 ulp_rte_parser_implicit_match_port_process(struct ulp_rte_parser_params *param);
Signature · 1 line
2.7.4
#13 lore raw

PATCH 13/14 net/bnxt: add support for VXLAN decap templates

In reply to Venkat Duvvuru

outer tunnel & inner tunnel flow templates are added.

---
 drivers/net/bnxt/tf_ulp/ulp_rte_parser.c           |   10 +
 drivers/net/bnxt/tf_ulp/ulp_rte_parser.h           |    5 +
 drivers/net/bnxt/tf_ulp/ulp_template_db_class.c    |  962 +++++---
 drivers/net/bnxt/tf_ulp/ulp_template_db_enum.h     |   35 +-
 drivers/net/bnxt/tf_ulp/ulp_template_db_field.h    |  363 ++-
 .../net/bnxt/tf_ulp/ulp_template_db_stingray_act.c |  116 +-
 .../bnxt/tf_ulp/ulp_template_db_stingray_class.c   | 2493 ++++++++++++++++----
 drivers/net/bnxt/tf_ulp/ulp_template_db_tbl.c      |    9 +-
 .../net/bnxt/tf_ulp/ulp_template_db_wh_plus_act.c  |  116 +-
 .../bnxt/tf_ulp/ulp_template_db_wh_plus_class.c    | 2489 +++++++++++++++----
 10 files changed, 5127 insertions(+), 1471 deletions(-)
drivers/net/bnxt/tf_ulp/ulp_rte_parser.c +10 -0
index 770fec5..42021ae 100644
@@ -2110,3 +2110,13 @@ ulp_rte_dec_ttl_act_handler(const struct rte_flow_action *act __rte_unused,
 	ULP_BITMAP_SET(params->act_bitmap.bits, BNXT_ULP_ACTION_BIT_DEC_TTL);
 	return BNXT_TF_RC_SUCCESS;
 }
+
+/* Function to handle the parsing of RTE Flow action JUMP */
+int32_t
+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);
+	return BNXT_TF_RC_SUCCESS;
+}
drivers/net/bnxt/tf_ulp/ulp_rte_parser.h +5 -0
index bb5a8a4..a71aabe 100644
@@ -233,4 +233,9 @@ int32_t
 ulp_rte_dec_ttl_act_handler(const struct rte_flow_action *action_item,
 			    struct ulp_rte_parser_params *params);
 
+/* Function to handle the parsing of RTE Flow action JUMP .*/
+int32_t
+ulp_rte_jump_act_handler(const struct rte_flow_action *action_item,
+			 struct ulp_rte_parser_params *params);
+
 #endif /* _ULP_RTE_PARSER_H_ */
drivers/net/bnxt/tf_ulp/ulp_template_db_class.c +645 -317

1,476 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_template_db_enum.h +30 -5
index 6dade9a..10838f5 100644
@@ -11,7 +11,7 @@
 #define BNXT_ULP_LOG2_MAX_NUM_DEV 2
 #define BNXT_ULP_CACHE_TBL_MAX_SZ 4
 #define BNXT_ULP_CLASS_SIG_TBL_MAX_SZ 2048
-#define BNXT_ULP_CLASS_MATCH_LIST_MAX_SZ 201
+#define BNXT_ULP_CLASS_MATCH_LIST_MAX_SZ 217
 #define BNXT_ULP_CLASS_HID_LOW_PRIME 7919
 #define BNXT_ULP_CLASS_HID_HIGH_PRIME 7907
 #define BNXT_ULP_CLASS_HID_SHFTR 32
@@ -52,7 +52,8 @@ enum bnxt_ulp_action_bit {
 	BNXT_ULP_ACTION_BIT_SET_TP_SRC       = 0x0000000000100000,
 	BNXT_ULP_ACTION_BIT_SET_TP_DST       = 0x0000000000200000,
 	BNXT_ULP_ACTION_BIT_VXLAN_ENCAP      = 0x0000000000400000,
-	BNXT_ULP_ACTION_BIT_LAST             = 0x0000000000800000
+	BNXT_ULP_ACTION_BIT_JUMP             = 0x0000000000800000,
+	BNXT_ULP_ACTION_BIT_LAST             = 0x0000000001000000
 };
 
 enum bnxt_ulp_hdr_bit {
@@ -72,7 +73,8 @@ enum bnxt_ulp_hdr_bit {
 	BNXT_ULP_HDR_BIT_I_IPV6              = 0x0000000000002000,
 	BNXT_ULP_HDR_BIT_I_TCP               = 0x0000000000004000,
 	BNXT_ULP_HDR_BIT_I_UDP               = 0x0000000000008000,
-	BNXT_ULP_HDR_BIT_LAST                = 0x0000000000010000
+	BNXT_ULP_HDR_BIT_F1                  = 0x0000000000010000,
+	BNXT_ULP_HDR_BIT_LAST                = 0x0000000000020000
 };
 
 enum bnxt_ulp_act_type {
@@ -341,6 +343,10 @@ enum bnxt_ulp_resource_sub_type {
 enum bnxt_ulp_sym {
 	BNXT_ULP_SYM_PKT_TYPE_IGNORE = 0,
 	BNXT_ULP_SYM_PKT_TYPE_L2 = 0,
+	BNXT_ULP_SYM_PKT_TYPE_0_IGNORE = 0,
+	BNXT_ULP_SYM_PKT_TYPE_0_L2 = 0,
+	BNXT_ULP_SYM_PKT_TYPE_1_IGNORE = 0,
+	BNXT_ULP_SYM_PKT_TYPE_1_L2 = 0,
 	BNXT_ULP_SYM_RECYCLE_CNT_IGNORE = 0,
 	BNXT_ULP_SYM_RECYCLE_CNT_ZERO = 0,
 	BNXT_ULP_SYM_RECYCLE_CNT_ONE = 1,
@@ -551,7 +557,8 @@ enum bnxt_ulp_sym {
 	BNXT_ULP_SYM_IP_PROTO_UDP = 17,
 	BNXT_ULP_SYM_VF_FUNC_PARIF = 15,
 	BNXT_ULP_SYM_NO = 0,
-	BNXT_ULP_SYM_YES = 1
+	BNXT_ULP_SYM_YES = 1,
+	BNXT_ULP_SYM_RECYCLE_DST = 0x800
 };
 
 enum bnxt_ulp_wh_plus {
@@ -600,6 +607,7 @@ enum bnxt_ulp_act_prop_sz {
 	BNXT_ULP_ACT_PROP_SZ_ENCAP_IP_SRC = 16,
 	BNXT_ULP_ACT_PROP_SZ_ENCAP_UDP = 4,
 	BNXT_ULP_ACT_PROP_SZ_ENCAP_TUN = 32,
+	BNXT_ULP_ACT_PROP_SZ_JUMP = 4,
 	BNXT_ULP_ACT_PROP_SZ_LAST = 4
 };
 
@@ -644,7 +652,8 @@ enum bnxt_ulp_act_prop_idx {
 	BNXT_ULP_ACT_PROP_IDX_ENCAP_IP_SRC = 205,
 	BNXT_ULP_ACT_PROP_IDX_ENCAP_UDP = 221,
 	BNXT_ULP_ACT_PROP_IDX_ENCAP_TUN = 225,
-	BNXT_ULP_ACT_PROP_IDX_LAST = 257
+	BNXT_ULP_ACT_PROP_IDX_JUMP = 257,
+	BNXT_ULP_ACT_PROP_IDX_LAST = 261
 };
 
 enum bnxt_ulp_class_hid {
@@ -796,6 +805,22 @@ enum bnxt_ulp_class_hid {
 	BNXT_ULP_CLASS_HID_05b9 = 0x05b9,
 	BNXT_ULP_CLASS_HID_0371 = 0x0371,
 	BNXT_ULP_CLASS_HID_00e1 = 0x00e1,
+	BNXT_ULP_CLASS_HID_0000 = 0x0000,
+	BNXT_ULP_CLASS_HID_00ce = 0x00ce,
+	BNXT_ULP_CLASS_HID_01b6 = 0x01b6,
+	BNXT_ULP_CLASS_HID_0074 = 0x0074,
+	BNXT_ULP_CLASS_HID_00fe = 0x00fe,
+	BNXT_ULP_CLASS_HID_03bc = 0x03bc,
+	BNXT_ULP_CLASS_HID_0206 = 0x0206,
+	BNXT_ULP_CLASS_HID_02c4 = 0x02c4,
+	BNXT_ULP_CLASS_HID_055a = 0x055a,
+	BNXT_ULP_CLASS_HID_045a = 0x045a,
+	BNXT_ULP_CLASS_HID_061a = 0x061a,
+	BNXT_ULP_CLASS_HID_051a = 0x051a,
+	BNXT_ULP_CLASS_HID_074a = 0x074a,
+	BNXT_ULP_CLASS_HID_004e = 0x004e,
+	BNXT_ULP_CLASS_HID_040a = 0x040a,
+	BNXT_ULP_CLASS_HID_010e = 0x010e,
 	BNXT_ULP_CLASS_HID_048b = 0x048b,
 	BNXT_ULP_CLASS_HID_0749 = 0x0749,
 	BNXT_ULP_CLASS_HID_05f1 = 0x05f1,
drivers/net/bnxt/tf_ulp/ulp_template_db_field.h +263 -100

434 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_template_db_stingray_act.c +58 -58

319 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_template_db_stingray_class.c +2027 -466

666 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_template_db_tbl.c +6 -3
index 7f5a316..c5f340d 100644

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

drivers/net/bnxt/tf_ulp/ulp_template_db_wh_plus_act.c +58 -58

116 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_template_db_wh_plus_class.c +2025 -464

2,489 lines not on this page · raw message

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

Signature · 1 line
2.7.4

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

#14 lore raw

PATCH 14/14 net/bnxt: add VXLAN decap offload support

In reply to Venkat Duvvuru

vxlan decap offload can happen in stages. The offload request may not come as a single flow request rather may come as two flow offload requests F1 & F2. This patch is adding support for this two stage offload design. The match criteria for F1 is O_DMAC, O_SMAC, O_DST_IP, O_UDP_DPORT and actions are COUNT, MARK, JUMP. The match criteria for F2 is O_SRC_IP, O_DST_IP, VNI and inner header fields. F1 and F2 flow offload requests can come in any order. If F2 flow offload request comes first then F2 can’t be offloaded as there is no O_DMAC information in F2. In this case, F2 will be deferred until F1 flow offload request arrives. When F1 flow offload request is received it will have O_DMAC information. Using F1’s O_DMAC, driver creates an L2 context entry in the hardware as part of offloading F1. F2 will now use F1’s O_DMAC to get the L2 context id associated with this O_DMAC and other flow fields that are cached already at the time of deferring F2 for offloading. F2s that arrive after F1 is offloaded will be directly programmed and not cached.

---
 drivers/net/bnxt/meson.build                   |   1 +
 drivers/net/bnxt/tf_ulp/bnxt_tf_common.h       |   4 +-
 drivers/net/bnxt/tf_ulp/bnxt_ulp.c             |  10 +
 drivers/net/bnxt/tf_ulp/bnxt_ulp.h             |  12 +
 drivers/net/bnxt/tf_ulp/bnxt_ulp_flow.c        |  84 +++----
 drivers/net/bnxt/tf_ulp/ulp_flow_db.c          | 149 +++++++++---
 drivers/net/bnxt/tf_ulp/ulp_flow_db.h          |   2 +
 drivers/net/bnxt/tf_ulp/ulp_mapper.c           |   1 +
 drivers/net/bnxt/tf_ulp/ulp_mapper.h           |   2 +
 drivers/net/bnxt/tf_ulp/ulp_rte_parser.c       |  75 +++++-
 drivers/net/bnxt/tf_ulp/ulp_rte_parser.h       |   4 +-
 drivers/net/bnxt/tf_ulp/ulp_template_db_enum.h |   4 +-
 drivers/net/bnxt/tf_ulp/ulp_template_struct.h  |   7 +
 drivers/net/bnxt/tf_ulp/ulp_tun.c              | 310 +++++++++++++++++++++++++
 drivers/net/bnxt/tf_ulp/ulp_tun.h              |  92 ++++++++
 15 files changed, 675 insertions(+), 82 deletions(-)
 create mode 100644 drivers/net/bnxt/tf_ulp/ulp_tun.c
 create mode 100644 drivers/net/bnxt/tf_ulp/ulp_tun.h
drivers/net/bnxt/meson.build +1 -0
index 3952108..bc74f88 100644
@@ -64,6 +64,7 @@ sources = files('bnxt_cpr.c',
 	'tf_ulp/ulp_port_db.c',
 	'tf_ulp/ulp_def_rules.c',
 	'tf_ulp/ulp_fc_mgr.c',
+	'tf_ulp/ulp_tun.c',
 	'tf_ulp/ulp_template_db_wh_plus_act.c',
 	'tf_ulp/ulp_template_db_wh_plus_class.c',
 	'tf_ulp/ulp_template_db_stingray_act.c',
drivers/net/bnxt/tf_ulp/bnxt_tf_common.h +3 -1
index f0633f0..b2629e4 100644
@@ -33,7 +33,9 @@
 enum bnxt_tf_rc {
 	BNXT_TF_RC_PARSE_ERR	= -2,
 	BNXT_TF_RC_ERROR	= -1,
-	BNXT_TF_RC_SUCCESS	= 0
+	BNXT_TF_RC_SUCCESS	= 0,
+	BNXT_TF_RC_NORMAL	= 1,
+	BNXT_TF_RC_FID		= 2,
 };
 
 /* eth IPv4 Type */
drivers/net/bnxt/tf_ulp/bnxt_ulp.c +10 -0
index d753b5a..26fd300 100644
@@ -1321,6 +1321,16 @@ bnxt_ulp_cntxt_ptr2_flow_db_get(struct bnxt_ulp_context	*ulp_ctx)
 	return ulp_ctx->cfg_data->flow_db;
 }
 
+/* Function to get the tunnel cache table info from the ulp context. */
+struct bnxt_tun_cache_entry *
+bnxt_ulp_cntxt_ptr2_tun_tbl_get(struct bnxt_ulp_context *ulp_ctx)
+{
+	if (!ulp_ctx || !ulp_ctx->cfg_data)
+		return NULL;
+
+	return ulp_ctx->cfg_data->tun_tbl;
+}
+
 /* Function to get the ulp context from eth device. */
 struct bnxt_ulp_context	*
 bnxt_ulp_eth_dev_ptr2_cntxt_get(struct rte_eth_dev	*dev)
drivers/net/bnxt/tf_ulp/bnxt_ulp.h +12 -0
index c2c5bcb..db1ee50 100644
@@ -13,6 +13,8 @@
 #include "rte_ethdev.h"
 
 #include "ulp_template_db_enum.h"
+#include "ulp_tun.h"
+#include "bnxt_tf_common.h"
 
 /* NAT defines to reuse existing inner L2 SMAC and DMAC */
 #define BNXT_ULP_NAT_INNER_L2_HEADER_SMAC	0x2000
@@ -55,6 +57,9 @@ struct bnxt_ulp_data {
 	struct bnxt_ulp_df_rule_info	df_rule_info[RTE_MAX_ETHPORTS];
 	struct bnxt_ulp_vfr_rule_info	vfr_rule_info[RTE_MAX_ETHPORTS];
 	enum bnxt_ulp_flow_mem_type	mem_type;
+#define	BNXT_ULP_TUN_ENTRY_INVALID	-1
+#define	BNXT_ULP_MAX_TUN_CACHE_ENTRIES	16
+	struct bnxt_tun_cache_entry	tun_tbl[BNXT_ULP_MAX_TUN_CACHE_ENTRIES];
 };
 
 struct bnxt_ulp_context {
@@ -151,6 +156,10 @@ bnxt_ulp_cntxt_ptr2_flow_db_set(struct bnxt_ulp_context	*ulp_ctx,
 struct bnxt_ulp_flow_db	*
 bnxt_ulp_cntxt_ptr2_flow_db_get(struct bnxt_ulp_context	*ulp_ctx);
 
+/* Function to get the tunnel cache table info from the ulp context. */
+struct bnxt_tun_cache_entry *
+bnxt_ulp_cntxt_ptr2_tun_tbl_get(struct bnxt_ulp_context	*ulp_ctx);
+
 /* Function to get the ulp context from eth device. */
 struct bnxt_ulp_context	*
 bnxt_ulp_eth_dev_ptr2_cntxt_get(struct rte_eth_dev *dev);
@@ -214,4 +223,7 @@ bnxt_ulp_cntxt_acquire_fdb_lock(struct bnxt_ulp_context	*ulp_ctx);
 void
 bnxt_ulp_cntxt_release_fdb_lock(struct bnxt_ulp_context	*ulp_ctx);
 
+int32_t
+ulp_post_process_tun_flow(struct ulp_rte_parser_params *params);
+
 #endif /* _BNXT_ULP_H_ */
drivers/net/bnxt/tf_ulp/bnxt_ulp_flow.c +44 -40

179 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_flow_db.c +120 -29

191 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_flow_db.h +2 -0
index 10e69ba..f7dfd67 100644
@@ -60,6 +60,8 @@ struct ulp_fdb_parent_info {
 	uint64_t	pkt_count;
 	uint64_t	byte_count;
 	uint64_t	*child_fid_bitset;
+	uint32_t	f2_cnt;
+	uint8_t		tun_idx;
 };
 
 /* Structure to maintain parent-child flow relationships */
drivers/net/bnxt/tf_ulp/ulp_mapper.c +1 -0
index d5c129b..2964323 100644
@@ -2815,6 +2815,7 @@ ulp_mapper_flow_create(struct bnxt_ulp_context *ulp_ctx,
 	parms.parent_flow = cparms->parent_flow;
 	parms.parent_fid = cparms->parent_fid;
 	parms.fid = cparms->flow_id;
+	parms.tun_idx = cparms->tun_idx;
 
 	/* Get the device id from the ulp context */
 	if (bnxt_ulp_cntxt_dev_id_get(ulp_ctx, &parms.dev_id)) {
drivers/net/bnxt/tf_ulp/ulp_mapper.h +2 -0
index 0595d15..9bd94f5 100644
@@ -78,6 +78,7 @@ struct bnxt_ulp_mapper_parms {
 	struct bnxt_ulp_device_params           *device_params;
 	uint32_t				parent_fid;
 	uint32_t				parent_flow;
+	uint8_t					tun_idx;
 };
 
 struct bnxt_ulp_mapper_create_parms {
@@ -98,6 +99,7 @@ struct bnxt_ulp_mapper_create_parms {
 	uint32_t			parent_fid;
 	/* if set then create a parent flow */
 	uint32_t			parent_flow;
+	uint8_t				tun_idx;
 };
 
 /* Function to initialize any dynamic mapper data. */
drivers/net/bnxt/tf_ulp/ulp_rte_parser.c +67 -8

138 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_rte_parser.h +1 -3
index a71aabe..7996317 100644
@@ -12,6 +12,7 @@
 #include "ulp_template_db_enum.h"
 #include "ulp_template_struct.h"
 #include "ulp_mapper.h"
+#include "bnxt_tf_common.h"
 
 /* defines to be used in the tunnel header parsing */
 #define BNXT_ULP_ENCAP_IPV4_VER_HLEN_TOS	2
@@ -38,9 +39,6 @@
 void
 bnxt_ulp_init_mapper_params(struct bnxt_ulp_mapper_create_parms *mapper_cparms,
 			    struct ulp_rte_parser_params *params,
-			    uint32_t priority, uint32_t class_id,
-			    uint32_t act_tmpl, uint16_t func_id,
-			    uint32_t flow_id,
 			    enum bnxt_ulp_fdb_type flow_type);
 
 /* Function to handle the parsing of the RTE port id. */
drivers/net/bnxt/tf_ulp/ulp_template_db_enum.h +3 -1
index 10838f5..6802deb 100644
@@ -135,7 +135,9 @@ enum bnxt_ulp_cf_idx {
 	BNXT_ULP_CF_IDX_L4_HDR_CNT = 41,
 	BNXT_ULP_CF_IDX_VFR_MODE = 42,
 	BNXT_ULP_CF_IDX_LOOPBACK_PARIF = 43,
-	BNXT_ULP_CF_IDX_LAST = 44
+	BNXT_ULP_CF_IDX_L3_TUN = 44,
+	BNXT_ULP_CF_IDX_L3_TUN_DECAP = 45,
+	BNXT_ULP_CF_IDX_LAST = 46
 };
 
 enum bnxt_ulp_cond_opcode {
drivers/net/bnxt/tf_ulp/ulp_template_struct.h +7 -0
index 69bb61e..9d690a9 100644
@@ -72,6 +72,13 @@ struct ulp_rte_parser_params {
 	struct ulp_rte_act_bitmap	act_bitmap;
 	struct ulp_rte_act_prop		act_prop;
 	uint32_t			dir_attr;
+	uint32_t			priority;
+	uint32_t			fid;
+	uint32_t			parent_flow;
+	uint32_t			parent_fid;
+	uint16_t			func_id;
+	uint32_t			class_id;
+	uint32_t			act_tmpl;
 	struct bnxt_ulp_context		*ulp_ctx;
 };
 
drivers/net/bnxt/tf_ulp/ulp_tun.c new file +310 -0

310 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_tun.h new file +92 -0

92 lines not on this page · raw message

Signature · 1 line
2.7.4
#15 lore raw

v2 cover bnxt fixes and enhancements to TRUFLOW support

In reply to Venkat Duvvuru

This patchset has support for VXLAN decap full offload, SR device support in tf_core and a few bug fixes.

v1->v2:
 - Squashed some patches.
 - Updated commit logs.
- Fixed a compilation issue reported during clang builds.

Farah Smith (1):
net/bnxt: add table scope to PF Mapping

Jay Ding (1):
net/bnxt: changes to support two table scopes

Kishore Padmanabha (2):
net/bnxt: add support for flow counter accumulation net/bnxt: add mapper support for wildcard TCAM

Peter Spreadborough (2):
net/bnxt: add stingray support to core layer
net/bnxt: update ULP resource counts

Somnath Kotur (2):
net/bnxt: fix infinite loop in flow query count
net/bnxt: change HWRM command to create reps

Venkat Duvvuru (3):
net/bnxt: refactor flow id allocation
net/bnxt: add support for VXLAN decap templates
net/bnxt: add VXLAN decap offload support

 doc/guides/nics/bnxt.rst                      |   18 +
 doc/guides/rel_notes/release_20_11.rst        |    2 +
 drivers/net/bnxt/bnxt.h                       |    6 +-
 drivers/net/bnxt/bnxt_ethdev.c                |    2 +
 drivers/net/bnxt/bnxt_hwrm.c                  |   60 +-
 drivers/net/bnxt/bnxt_hwrm.h                  |    2 -
 drivers/net/bnxt/bnxt_reps.c                  |   18 +-
 drivers/net/bnxt/hcapi/hcapi_cfa.h            |   39 +-
 drivers/net/bnxt/meson.build                  |    1 +
 drivers/net/bnxt/tf_core/cfa_resource_types.h |   95 +-
 drivers/net/bnxt/tf_core/tf_core.c            |   57 +-
 drivers/net/bnxt/tf_core/tf_core.h            |   57 +-
 drivers/net/bnxt/tf_core/tf_device.c          |    9 +-
 drivers/net/bnxt/tf_core/tf_device.h          |   47 +-
 drivers/net/bnxt/tf_core/tf_device_p4.c       |   69 +-
 drivers/net/bnxt/tf_core/tf_device_p4.h       |    6 +
 drivers/net/bnxt/tf_core/tf_device_p45.h      |  105 +
 drivers/net/bnxt/tf_core/tf_em.h              |   25 +-
 drivers/net/bnxt/tf_core/tf_em_common.c       |  176 +-
 drivers/net/bnxt/tf_core/tf_em_common.h       |   27 +-
 drivers/net/bnxt/tf_core/tf_em_host.c         |   31 +-
 drivers/net/bnxt/tf_core/tf_global_cfg.c      |    4 +-
 drivers/net/bnxt/tf_core/tf_global_cfg.h      |   42 +-
 drivers/net/bnxt/tf_core/tf_msg.c             |   13 +-
 drivers/net/bnxt/tf_core/tf_msg.h             |    4 +-
 drivers/net/bnxt/tf_core/tf_session.h         |   16 +-
 drivers/net/bnxt/tf_core/tf_tbl.h             |    3 +
 drivers/net/bnxt/tf_core/tfp.c                |   19 +
 drivers/net/bnxt/tf_core/tfp.h                |   16 +
 drivers/net/bnxt/tf_ulp/bnxt_tf_common.h      |    4 +-
 drivers/net/bnxt/tf_ulp/bnxt_ulp.c            |   50 +-
 drivers/net/bnxt/tf_ulp/bnxt_ulp.h            |   12 +
 drivers/net/bnxt/tf_ulp/bnxt_ulp_flow.c       |  129 +-
 drivers/net/bnxt/tf_ulp/ulp_def_rules.c       |   48 +-
 drivers/net/bnxt/tf_ulp/ulp_fc_mgr.c          |  133 +-
 drivers/net/bnxt/tf_ulp/ulp_fc_mgr.h          |   19 +
 drivers/net/bnxt/tf_ulp/ulp_flow_db.c         |  475 +++-
 drivers/net/bnxt/tf_ulp/ulp_flow_db.h         |   46 +
 drivers/net/bnxt/tf_ulp/ulp_mapper.c          |   83 +-
 drivers/net/bnxt/tf_ulp/ulp_mapper.h          |    6 +-
 drivers/net/bnxt/tf_ulp/ulp_rte_parser.c      |   85 +-
 drivers/net/bnxt/tf_ulp/ulp_rte_parser.h      |   12 +
 .../net/bnxt/tf_ulp/ulp_template_db_class.c   |  962 ++++---
 .../net/bnxt/tf_ulp/ulp_template_db_enum.h    |   42 +-
 .../net/bnxt/tf_ulp/ulp_template_db_field.h   |  363 ++-
 .../tf_ulp/ulp_template_db_stingray_act.c     |  116 +-
 .../tf_ulp/ulp_template_db_stingray_class.c   | 2493 ++++++++++++++---
 drivers/net/bnxt/tf_ulp/ulp_template_db_tbl.c |    9 +-
 .../bnxt/tf_ulp/ulp_template_db_wh_plus_act.c |  116 +-
 .../tf_ulp/ulp_template_db_wh_plus_class.c    | 2489 +++++++++++++---
 drivers/net/bnxt/tf_ulp/ulp_template_struct.h |    7 +
 drivers/net/bnxt/tf_ulp/ulp_tun.c             |  310 ++
 drivers/net/bnxt/tf_ulp/ulp_tun.h             |   92 +
 drivers/net/bnxt/tf_ulp/ulp_utils.c           |  125 +
 drivers/net/bnxt/tf_ulp/ulp_utils.h           |   48 +-
 55 files changed, 7206 insertions(+), 2037 deletions(-)
 create mode 100644 drivers/net/bnxt/tf_core/tf_device_p45.h
 create mode 100644 drivers/net/bnxt/tf_ulp/ulp_tun.c
 create mode 100644 drivers/net/bnxt/tf_ulp/ulp_tun.h
Signature · 1 line
2.21.1 (Apple Git-122.3)
#16 lore raw

PATCH v2 1/11 net/bnxt: add stingray support to core layer

From: Peter Spreadborough <[email protected]>

- Moved P4 specific code under the P4 directory
- Added P45 skeleton code for SR to build on
- Add SR support in truflow core layer

---
 drivers/net/bnxt/hcapi/hcapi_cfa.h            |  39 +++++--
 drivers/net/bnxt/tf_core/cfa_resource_types.h |  95 ++++++----------
 drivers/net/bnxt/tf_core/tf_core.c            |   3 +-
 drivers/net/bnxt/tf_core/tf_core.h            |   2 +-
 drivers/net/bnxt/tf_core/tf_device.c          |   9 +-
 drivers/net/bnxt/tf_core/tf_device_p4.c       |  25 ++++-
 drivers/net/bnxt/tf_core/tf_device_p4.h       |   6 +
 drivers/net/bnxt/tf_core/tf_device_p45.h      | 105 ++++++++++++++++++
 drivers/net/bnxt/tf_core/tf_em.h              |   6 -
 9 files changed, 207 insertions(+), 83 deletions(-)
 create mode 100644 drivers/net/bnxt/tf_core/tf_device_p45.h
drivers/net/bnxt/hcapi/hcapi_cfa.h +29 -10
index c7d87dec7..aa218d714 100644
@@ -14,7 +14,15 @@
 
 #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
@@ -81,17 +89,20 @@ struct hcapi_cfa_key_result {
 /* common CFA register access macros */
 #define CFA_REG(x)		OFFSETOF(cfa_reg_t, cfa_##x)
 
-#ifndef REG_WR
-#define REG_WR(_p, x, y)  (*((uint32_t volatile *)(x)) = (y))
+#ifndef TF_REG_WR
+#define TF_REG_WR(_p, x, y)  (*((uint32_t volatile *)(x)) = (y))
 #endif
-#ifndef REG_RD
-#define REG_RD(_p, x)  (*((uint32_t volatile *)(x)))
+#ifndef TF_REG_RD
+#define TF_REG_RD(_p, x)  (*((uint32_t volatile *)(x)))
+#endif
+#ifndef TF_CFA_REG_RD
+#define TF_CFA_REG_RD(_p, x)	\
+	TF_REG_RD(0, (uint32_t)(_p)->base_addr + CFA_REG(x))
+#endif
+#ifndef TF_CFA_REG_WR
+#define TF_CFA_REG_WR(_p, x, y)	\
+	TF_REG_WR(0, (uint32_t)(_p)->base_addr + CFA_REG(x), y)
 #endif
-#define CFA_REG_RD(_p, x)	\
-	REG_RD(0, (uint32_t)(_p)->base_addr + CFA_REG(x))
-#define CFA_REG_WR(_p, x, y)	\
-	REG_WR(0, (uint32_t)(_p)->base_addr + CFA_REG(x), y)
-
 
 /* Constants used by Resource Manager Registration*/
 #define RM_CLIENT_NAME_MAX_LEN          32
@@ -248,7 +259,15 @@ int hcapi_cfa_p4_mirror_hwop(struct hcapi_cfa_hwop *op,
 int hcapi_cfa_p4_global_cfg_hwop(struct hcapi_cfa_hwop *op,
 				 uint32_t type,
 				 struct hcapi_cfa_data *config);
-#endif /* SUPPORT_CFA_HW_P4 */
+/* 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
drivers/net/bnxt/tf_core/cfa_resource_types.h +35 -60

120 lines not on this page · raw message

drivers/net/bnxt/tf_core/tf_core.c +2 -1
index 0dbde1de2..788335b81 100644
@@ -34,7 +34,8 @@ tf_open_session(struct tf *tfp,
 	 * side. It is assumed that the Firmware will be supported if
 	 * firmware open session succeeds.
 	 */
-	if (parms->device_type != TF_DEVICE_TYPE_WH) {
+	if (parms->device_type != TF_DEVICE_TYPE_WH &&
+	    parms->device_type != TF_DEVICE_TYPE_SR) {
 		TFP_DRV_LOG(ERR,
 			    "Unsupported device type %d\n",
 			    parms->device_type);
drivers/net/bnxt/tf_core/tf_core.h +1 -1
index db1093515..65be8f54a 100644
@@ -10,7 +10,7 @@
 #include <stdlib.h>
 #include <stdbool.h>
 #include <stdio.h>
-#include "hcapi/hcapi_cfa.h"
+#include "hcapi/hcapi_cfa_defs.h"
 #include "tf_project.h"
 
 /**
drivers/net/bnxt/tf_core/tf_device.c +7 -2
index 112944095..838982801 100644
@@ -47,7 +47,6 @@ tf_dev_bind_p4(struct tf *tfp,
 	struct tf_if_tbl_cfg_parms if_tbl_cfg;
 	struct tf_global_cfg_cfg_parms global_cfg;
 
-	dev_handle->type = TF_DEVICE_TYPE_WH;
 	/* Initial function initialization */
 	dev_handle->ops = &tf_dev_ops_p4_init;
 
@@ -90,7 +89,10 @@ tf_dev_bind_p4(struct tf *tfp,
 	 * EEM
 	 */
 	em_cfg.num_elements = TF_EM_TBL_TYPE_MAX;
-	em_cfg.cfg = tf_em_ext_p4;
+	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);
@@ -241,6 +243,8 @@ tf_dev_bind(struct tf *tfp __rte_unused,
 {
 	switch (type) {
 	case TF_DEVICE_TYPE_WH:
+	case TF_DEVICE_TYPE_SR:
+		dev_handle->type = type;
 		return tf_dev_bind_p4(tfp,
 				      shadow_copy,
 				      resources,
@@ -258,6 +262,7 @@ tf_dev_unbind(struct tf *tfp,
 {
 	switch (dev_handle->type) {
 	case TF_DEVICE_TYPE_WH:
+	case TF_DEVICE_TYPE_SR:
 		return tf_dev_unbind_p4(tfp);
 	default:
 		TFP_DRV_LOG(ERR,
drivers/net/bnxt/tf_core/tf_device_p4.c +22 -3
index fe8dec3af..0344565d7 100644
@@ -28,13 +28,32 @@
  *   - (-EINVAL) on failure.
  */
 static int
-tf_dev_p4_get_max_types(struct tf *tfp __rte_unused,
+tf_dev_p4_get_max_types(struct tf *tfp,
 			uint16_t *max_types)
 {
-	if (max_types == NULL)
+	struct tf_session *tfs;
+	struct tf_dev_info *dev;
+	int rc;
+
+	if (max_types == NULL || tfp == NULL)
 		return -EINVAL;
 
-	*max_types = CFA_RESOURCE_TYPE_P4_LAST + 1;
+	/* 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;
 
 	return 0;
 }
drivers/net/bnxt/tf_core/tf_device_p4.h +6 -0
index 7e58469a0..aba28fe5f 100644
@@ -83,6 +83,12 @@ struct tf_rm_element_cfg tf_em_ext_p4[TF_EM_TBL_TYPE_MAX] = {
 	{ TF_RM_ELEM_CFG_HCAPI_BA, CFA_RESOURCE_TYPE_P4_TBL_SCOPE },
 };
 
+struct tf_rm_element_cfg tf_em_ext_p45[TF_EM_TBL_TYPE_MAX] = {
+	/* CFA_RESOURCE_TYPE_P4_EM_REC */
+	{ TF_RM_ELEM_CFG_NULL, CFA_RESOURCE_TYPE_INVALID },
+	{ TF_RM_ELEM_CFG_HCAPI_BA, CFA_RESOURCE_TYPE_P45_TBL_SCOPE },
+};
+
 struct tf_rm_element_cfg tf_em_int_p4[TF_EM_TBL_TYPE_MAX] = {
 	{ TF_RM_ELEM_CFG_HCAPI, CFA_RESOURCE_TYPE_P4_EM_REC },
 	/* CFA_RESOURCE_TYPE_P4_TBL_SCOPE */
drivers/net/bnxt/tf_core/tf_device_p45.h new file +105 -0

105 lines not on this page · raw message

drivers/net/bnxt/tf_core/tf_em.h +0 -6
index 2a67e4760..51b08138e 100644
@@ -9,12 +9,6 @@
 #include "tf_core.h"
 #include "tf_session.h"
 
-
-#define SUPPORT_CFA_HW_P4 1
-#define SUPPORT_CFA_HW_P58 0
-#define SUPPORT_CFA_HW_P59 0
-#define SUPPORT_CFA_HW_ALL 0
-
 #include "hcapi/hcapi_cfa_defs.h"
 
 #define TF_EM_MIN_ENTRIES     (1 << 15) /* 32K */
Signature · 1 line
2.21.1 (Apple Git-122.3)
#17 lore raw

Re: [dpdk-dev] [PATCH v2 01/11] net/bnxt: add stingray support to core layer

Quoted 6 lines · Ajit Khaparde

From: Peter Spreadborough <[email protected]>

- Moved P4 specific code under the P4 directory
- Added P45 skeleton code for SR to build on
- Add SR support in truflow core layer

Related to the patch title, as far as I know Stingray device support already added, what is this "core layer" that Stingray support added, can it be possible to detail it in the commit log?

Quoted 4 lines

<...>

Quoted 9 lines
drivers/net/bnxt/tf_core/cfa_resource_types.h +1 -3
index 19838c393..a62063b0e 100644
@@ -1,6 +1,13 @@
-/* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2019-2020 Broadcom
- * All rights reserved.
+/*

drivers/net/bnxt/tf_core/cfa_resource_types.h line 11

Quoted 10 lines
drivers/net/bnxt/tf_core/cfa_resource_types.h +9 -0
+ * Copyright(c) 2001-2020, Broadcom. All rights reserved. The
+ * term Broadcom refers to Broadcom Inc. and/or its subsidiaries.
+ * Proprietary and Confidential Information.
+ *
+ * This source file is the property of Broadcom Corporation, and
+ * may not be copied or distributed in any isomorphic form without
+ * the prior written consent of Broadcom Corporation.
+ *
+ * DO NOT MODIFY!!! This file is automatically generated.
   */

Can Broadcom provide a written consent to me to push this into the public repo? :)

I assume license updated by mistake.

#18 lore raw

Re: [dpdk-dev] [PATCH v2 01/11] net/bnxt: add stingray support to core layer

Quoted 43 lines · Ferruh Yigit
Quoted 6 lines · Ajit Khaparde

From: Peter Spreadborough <[email protected]>

- Moved P4 specific code under the P4 directory
- Added P45 skeleton code for SR to build on
- Add SR support in truflow core layer

Related to the patch title, as far as I know Stingray device support already added, what is this "core layer" that Stingray support added, can it be possible to detail it in the commit log?

Quoted 4 lines

<...>

Quoted 9 lines
drivers/net/bnxt/tf_core/cfa_resource_types.h +1 -3
index 19838c393..a62063b0e 100644
@@ -1,6 +1,13 @@
-/* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2019-2020 Broadcom
- * All rights reserved.
+/*

drivers/net/bnxt/tf_core/cfa_resource_types.h line 11

Quoted 10 lines
drivers/net/bnxt/tf_core/cfa_resource_types.h +9 -0
+ * Copyright(c) 2001-2020, Broadcom. All rights reserved. The
+ * term Broadcom refers to Broadcom Inc. and/or its subsidiaries.
+ * Proprietary and Confidential Information.
+ *
+ * This source file is the property of Broadcom Corporation, and
+ * may not be copied or distributed in any isomorphic form without
+ * the prior written consent of Broadcom Corporation.
+ *
+ * DO NOT MODIFY!!! This file is automatically generated.
   */

Can Broadcom provide a written consent to me to push this into the public repo? :)

Quoted 1 line

I assume license updated by mistake.

Ferruh,
Yes. That was an oversight.
Please upload to the files in the patch set public repo. I will submit a change to clean it up in a follow on patch. Apologize for the inconvenience.

Thanks
Ajit

Quoted 1 line
#19 lore raw

Re: [dpdk-dev] [PATCH v2 01/11] net/bnxt: add stingray support to core layer

Quoted 44 lines · Ajit Khaparde
Quoted 43 lines · Ferruh Yigit
Quoted 6 lines · Ajit Khaparde

From: Peter Spreadborough <[email protected]>

- Moved P4 specific code under the P4 directory
- Added P45 skeleton code for SR to build on
- Add SR support in truflow core layer

Related to the patch title, as far as I know Stingray device support already added, what is this "core layer" that Stingray support added, can it be possible to detail it in the commit log?

Quoted 4 lines

<...>

Quoted 9 lines
drivers/net/bnxt/tf_core/cfa_resource_types.h +1 -3
index 19838c393..a62063b0e 100644
@@ -1,6 +1,13 @@
-/* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2019-2020 Broadcom
- * All rights reserved.
+/*

drivers/net/bnxt/tf_core/cfa_resource_types.h line 11

Quoted 10 lines
drivers/net/bnxt/tf_core/cfa_resource_types.h +9 -0
+ * Copyright(c) 2001-2020, Broadcom. All rights reserved. The
+ * term Broadcom refers to Broadcom Inc. and/or its subsidiaries.
+ * Proprietary and Confidential Information.
+ *
+ * This source file is the property of Broadcom Corporation, and
+ * may not be copied or distributed in any isomorphic form without
+ * the prior written consent of Broadcom Corporation.
+ *
+ * DO NOT MODIFY!!! This file is automatically generated.
    */

Can Broadcom provide a written consent to me to push this into the public repo? :)

Quoted 5 lines
Quoted 1 line

I assume license updated by mistake.

Ferruh,
Yes. That was an oversight.
Please upload to the files in the patch set public repo. I will submit a change to clean it up in a follow on patch.

Can it be possible to send a clean version and continue with it?

I am OK to fix small code issues in the tree, or by incremental fixes and squash them, but not sure about doing same for above note.

Thanks,
ferruh

Quoted 6 lines

Apologize for the inconvenience.

Thanks
Ajit

Quoted 1 line
#20 lore raw

Re: [dpdk-dev] [PATCH v2 01/11] net/bnxt: add stingray support to core layer

Quoted 52 lines · Ferruh Yigit
Quoted 44 lines · Ajit Khaparde
Quoted 43 lines · Ferruh Yigit
Quoted 6 lines · Ajit Khaparde

From: Peter Spreadborough <[email protected]>

- Moved P4 specific code under the P4 directory
- Added P45 skeleton code for SR to build on
- Add SR support in truflow core layer

Related to the patch title, as far as I know Stingray device support already added, what is this "core layer" that Stingray support added, can it be possible to detail it in the commit log?

Quoted 4 lines

<...>

Quoted 9 lines
drivers/net/bnxt/tf_core/cfa_resource_types.h +1 -3
index 19838c393..a62063b0e 100644
@@ -1,6 +1,13 @@
-/* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2019-2020 Broadcom
- * All rights reserved.
+/*

drivers/net/bnxt/tf_core/cfa_resource_types.h line 11

Quoted 10 lines
drivers/net/bnxt/tf_core/cfa_resource_types.h +9 -0
+ * Copyright(c) 2001-2020, Broadcom. All rights reserved. The
+ * term Broadcom refers to Broadcom Inc. and/or its subsidiaries.
+ * Proprietary and Confidential Information.
+ *
+ * This source file is the property of Broadcom Corporation, and
+ * may not be copied or distributed in any isomorphic form without
+ * the prior written consent of Broadcom Corporation.
+ *
+ * DO NOT MODIFY!!! This file is automatically generated.
    */

Can Broadcom provide a written consent to me to push this into the public repo? :)

Quoted 5 lines
Quoted 1 line

I assume license updated by mistake.

Ferruh,
Yes. That was an oversight.
Please upload to the files in the patch set public repo. I will submit a change to clean it up in a follow on patch.

Quoted 4 lines

Can it be possible to send a clean version and continue with it?

I am OK to fix small code issues in the tree, or by incremental fixes and squash them, but not sure about doing same for above note.

Done. The SPDX header update it the only change in the patch. No change in rest of the patches.

Quoted 11 lines

Thanks,
ferruh

Quoted 6 lines

Apologize for the inconvenience.

Thanks
Ajit

Quoted 1 line
#21 lore raw

PATCH v2 2/11 net/bnxt: changes to support two table scopes

In reply to Ajit Khaparde

From: Jay Ding <[email protected]>

New API to map a PARIF to an EEM table scope (set of Rx and Tx EEM base addresses). It uses HWRM_TF_GLOBAL_CFG_SET HWRM to configure. PARIF is handler to a partition of the physical port. Adjustments to tf_global_cfg_set() to reduce overhead and nominal name clarification.

---
 drivers/net/bnxt/tf_core/tf_core.c       |  54 +++++--
 drivers/net/bnxt/tf_core/tf_core.h       |  55 ++++++-
 drivers/net/bnxt/tf_core/tf_device.h     |  43 +++++-
 drivers/net/bnxt/tf_core/tf_device_p4.c  |  44 ++++++
 drivers/net/bnxt/tf_core/tf_em.h         |  19 ++-
 drivers/net/bnxt/tf_core/tf_em_common.c  | 174 ++++++++++++-----------
 drivers/net/bnxt/tf_core/tf_em_common.h  |  27 +---
 drivers/net/bnxt/tf_core/tf_em_host.c    |  23 ++-
 drivers/net/bnxt/tf_core/tf_global_cfg.c |   4 +-
 drivers/net/bnxt/tf_core/tf_global_cfg.h |  42 ++----
 drivers/net/bnxt/tf_core/tf_msg.c        |  13 +-
 drivers/net/bnxt/tf_core/tf_msg.h        |   4 +-
 12 files changed, 326 insertions(+), 176 deletions(-)
drivers/net/bnxt/tf_core/tf_core.c +40 -14
index 788335b81..0f49a0025 100644
@@ -303,7 +303,6 @@ int tf_get_global_cfg(struct tf *tfp,
 	int rc = 0;
 	struct tf_session *tfs;
 	struct tf_dev_info *dev;
-	struct tf_dev_global_cfg_parms gparms = { 0 };
 
 	TF_CHECK_PARMS2(tfp, parms);
 
@@ -342,12 +341,7 @@ int tf_get_global_cfg(struct tf *tfp,
 		return -EOPNOTSUPP;
 	}
 
-	gparms.dir = parms->dir;
-	gparms.type = parms->type;
-	gparms.offset = parms->offset;
-	gparms.config = parms->config;
-	gparms.config_sz_in_bytes = parms->config_sz_in_bytes;
-	rc = dev->ops->tf_dev_get_global_cfg(tfp, &gparms);
+	rc = dev->ops->tf_dev_get_global_cfg(tfp, parms);
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "%s: Global Cfg get failed, rc:%s\n",
@@ -371,7 +365,6 @@ int tf_set_global_cfg(struct tf *tfp,
 	int rc = 0;
 	struct tf_session *tfs;
 	struct tf_dev_info *dev;
-	struct tf_dev_global_cfg_parms gparms = { 0 };
 
 	TF_CHECK_PARMS2(tfp, parms);
 
@@ -410,12 +403,7 @@ int tf_set_global_cfg(struct tf *tfp,
 		return -EOPNOTSUPP;
 	}
 
-	gparms.dir = parms->dir;
-	gparms.type = parms->type;
-	gparms.offset = parms->offset;
-	gparms.config = parms->config;
-	gparms.config_sz_in_bytes = parms->config_sz_in_bytes;
-	rc = dev->ops->tf_dev_set_global_cfg(tfp, &gparms);
+	rc = dev->ops->tf_dev_set_global_cfg(tfp, parms);
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "%s: Global Cfg set failed, rc:%s\n",
@@ -1352,6 +1340,44 @@ tf_alloc_tbl_scope(struct tf *tfp,
 
 	return rc;
 }
+int
+tf_map_tbl_scope(struct tf *tfp,
+		   struct tf_map_tbl_scope_parms *parms)
+{
+	struct tf_session *tfs;
+	struct tf_dev_info *dev;
+	int rc;
+
+	TF_CHECK_PARMS2(tfp, parms);
+
+	/* Retrieve the session information */
+	rc = tf_session_get_session(tfp, &tfs);
+	if (rc) {
+		TFP_DRV_LOG(ERR,
+			    "Failed to lookup session, rc:%s\n",
+			    strerror(-rc));
+		return rc;
+	}
+
+	/* 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;
+	}
+
+	if (dev->ops->tf_dev_map_tbl_scope != NULL) {
+		rc = dev->ops->tf_dev_map_tbl_scope(tfp, parms);
+	} else {
+		TFP_DRV_LOG(ERR,
+			    "Map table scope not supported by device\n");
+		return -EINVAL;
+	}
+
+	return rc;
+}
 
 int
 tf_free_tbl_scope(struct tf *tfp,
drivers/net/bnxt/tf_core/tf_core.h +48 -7

87 lines not on this page · raw message

drivers/net/bnxt/tf_core/tf_device.h +41 -2

61 lines not on this page · raw message

drivers/net/bnxt/tf_core/tf_device_p4.c +44 -0

68 lines not on this page · raw message

drivers/net/bnxt/tf_core/tf_em.h +17 -2
index 51b08138e..8820b28ef 100644
@@ -358,7 +358,7 @@ int tf_em_ext_free(struct tf *tfp,
 		   struct tf_free_tbl_scope_parms *parms);
 
 /**
- * Common free for external EEM using host or system memory
+ * Common free table scope for external EEM using host or system memory
  *
  * [in] tfp
  *   Pointer to TruFlow handle
@@ -374,7 +374,7 @@ int tf_em_ext_common_free(struct tf *tfp,
 			  struct tf_free_tbl_scope_parms *parms);
 
 /**
- * Common alloc for external EEM using host or system memory
+ * Common alloc table scope for external EEM using host or system memory
  *
  * [in] tfp
  *   Pointer to TruFlow handle
@@ -388,6 +388,21 @@ int tf_em_ext_common_free(struct tf *tfp,
  */
 int tf_em_ext_common_alloc(struct tf *tfp,
 			   struct tf_alloc_tbl_scope_parms *parms);
+/**
+ * Map a set of parifs to a set of EEM base addresses (table scope)
+ *
+ * [in] tfp
+ *   Pointer to TruFlow handle
+ *
+ * [in] parms
+ *   Pointer to input parameters
+ *
+ * Returns:
+ *   0       - Success
+ *   -EINVAL - Parameter error
+ */
+int tf_em_ext_map_tbl_scope(struct tf *tfp,
+			    struct tf_map_tbl_scope_parms *parms);
 
 /**
  * Allocate External Tbl entry from the scope pool.
drivers/net/bnxt/tf_core/tf_em_common.c +90 -84

199 lines not on this page · raw message

drivers/net/bnxt/tf_core/tf_em_common.h +1 -26
index f71a48767..fa313c458 100644
@@ -9,6 +9,7 @@
 #include "tf_core.h"
 #include "tf_session.h"
 
+
 /**
  * Function to search for table scope control block structure
  * with specified table scope ID.
@@ -22,32 +23,6 @@
  */
 struct tf_tbl_scope_cb *tbl_scope_cb_find(uint32_t tbl_scope_id);
 
-/**
- * Table Scope Allocate
- *
- * Allocate a table scope
- *
- * [in/out] pointer to tbl_scope_id
- *
- * Returns:
- *  0 - success
- *  -EINVAL - error
- */
-int tf_tbl_scope_alloc(uint32_t *tbl_scope_id);
-
-/**
- * Table Scope Free
- *
- * Free a table scope
- *
- * [in] tbl_scope_id to free
- *
- * Returns:
- *  0 - success
- *  -EINVAL - error
- */
-int tf_tbl_scope_free(uint32_t tbl_scope_id);
-
 /**
  * Create and initialize a stack to use for action entries
  *
drivers/net/bnxt/tf_core/tf_em_host.c +19 -4
index cfcb12f3b..b5db94f3e 100644
@@ -374,8 +374,14 @@ tf_em_ext_alloc(struct tf *tfp, struct tf_alloc_tbl_scope_parms *parms)
 	struct tf_tbl_scope_cb *tbl_scope_cb;
 	struct hcapi_cfa_em_table *em_tables;
 	struct tf_free_tbl_scope_parms free_parms;
-
-	rc = tf_tbl_scope_alloc(&parms->tbl_scope_id);
+	struct tf_rm_allocate_parms aparms = { 0 };
+	struct tf_rm_free_parms fparms = { 0 };
+
+	/* 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.index = (uint32_t *)&parms->tbl_scope_id;
+	rc = tf_rm_allocate(&aparms);
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to allocate table scope\n");
@@ -472,7 +478,11 @@ tf_em_ext_alloc(struct tf *tfp, struct tf_alloc_tbl_scope_parms *parms)
 	return -EINVAL;
 
 cleanup:
-	tf_tbl_scope_free(parms->tbl_scope_id);
+	/* Free Table control block */
+	fparms.rm_db = eem_db[TF_DIR_RX];
+	fparms.db_index = TF_EM_TBL_TYPE_TBL_SCOPE;
+	fparms.index = parms->tbl_scope_id;
+	tf_rm_free(&fparms);
 	return -EINVAL;
 }
 
@@ -483,6 +493,7 @@ tf_em_ext_free(struct tf *tfp,
 	int rc = 0;
 	enum tf_dir  dir;
 	struct tf_tbl_scope_cb *tbl_scope_cb;
+	struct tf_rm_free_parms aparms = { 0 };
 
 	tbl_scope_cb = tbl_scope_cb_find(parms->tbl_scope_id);
 
@@ -491,7 +502,11 @@ tf_em_ext_free(struct tf *tfp,
 		return -EINVAL;
 	}
 
-	rc = tf_tbl_scope_free(parms->tbl_scope_id);
+	/* Free Table control block */
+	aparms.rm_db = eem_db[TF_DIR_RX];
+	aparms.db_index = TF_EM_TBL_TYPE_TBL_SCOPE;
+	aparms.index = parms->tbl_scope_id;
+	rc = tf_rm_free(&aparms);
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to free table scope\n");
drivers/net/bnxt/tf_core/tf_global_cfg.c +2 -2
index 4ed4039db..ebd1a86ad 100644
@@ -113,7 +113,7 @@ tf_global_cfg_unbind(struct tf *tfp __rte_unused)
 
 int
 tf_global_cfg_set(struct tf *tfp,
-		  struct tf_dev_global_cfg_parms *parms)
+		  struct tf_global_cfg_parms *parms)
 {
 	int rc;
 	struct tf_global_cfg_get_hcapi_parms hparms;
@@ -156,7 +156,7 @@ tf_global_cfg_set(struct tf *tfp,
 
 int
 tf_global_cfg_get(struct tf *tfp,
-		  struct tf_dev_global_cfg_parms *parms)
+		  struct tf_global_cfg_parms *parms)
 
 {
 	int rc;
drivers/net/bnxt/tf_core/tf_global_cfg.h +11 -31

65 lines not on this page · raw message

drivers/net/bnxt/tf_core/tf_msg.c +11 -2
index 7c2ad172f..5615eedbb 100644
@@ -1075,7 +1075,7 @@ tf_msg_get_tbl_entry(struct tf *tfp,
 
 int
 tf_msg_get_global_cfg(struct tf *tfp,
-		      struct tf_dev_global_cfg_parms *params)
+		      struct tf_global_cfg_parms *params)
 {
 	int rc = 0;
 	struct tfp_send_msg_parms parms = { 0 };
@@ -1133,7 +1133,7 @@ tf_msg_get_global_cfg(struct tf *tfp,
 
 int
 tf_msg_set_global_cfg(struct tf *tfp,
-		      struct tf_dev_global_cfg_parms *params)
+		      struct tf_global_cfg_parms *params)
 {
 	int rc = 0;
 	struct tfp_send_msg_parms parms = { 0 };
@@ -1173,6 +1173,15 @@ tf_msg_set_global_cfg(struct tf *tfp,
 
 	tfp_memcpy(req.data, params->config,
 		   params->config_sz_in_bytes);
+
+	/* Only set mask if pointer is provided
+	 */
+	if (params->config_mask) {
+		tfp_memcpy(req.data + params->config_sz_in_bytes,
+			   params->config_mask,
+			   params->config_sz_in_bytes);
+	}
+
 	req.size = tfp_cpu_to_le_32(params->config_sz_in_bytes);
 
 	parms.tf_type = HWRM_TF_GLOBAL_CFG_SET;
drivers/net/bnxt/tf_core/tf_msg.h +2 -2
index 195710eb8..72bf85048 100644
@@ -462,7 +462,7 @@ int tf_msg_get_tbl_entry(struct tf *tfp,
  *   0 on Success else internal Truflow error
  */
 int tf_msg_get_global_cfg(struct tf *tfp,
-			  struct tf_dev_global_cfg_parms *params);
+			  struct tf_global_cfg_parms *params);
 
 /**
  * Sends global cfg update request to Firmware
@@ -477,7 +477,7 @@ int tf_msg_get_global_cfg(struct tf *tfp,
  *   0 on Success else internal Truflow error
  */
 int tf_msg_set_global_cfg(struct tf *tfp,
-			  struct tf_dev_global_cfg_parms *params);
+			  struct tf_global_cfg_parms *params);
 
 /**
  * Sends bulk get message of a Table Type element to the firmware.
Signature · 1 line
2.21.1 (Apple Git-122.3)
#22 lore raw

PATCH v2 3/11 net/bnxt: add table scope to PF Mapping

In reply to Ajit Khaparde

From: Farah Smith <[email protected]>

Add table scope to PF Mapping for SR and Wh+ devices. Legacy devices require PF set of base addresses for EEM operation. A table scope id is a logical construct and is mapped to the PF associated with the communications channel used.
In the case of a VF, the parent PF is used.

---
 drivers/net/bnxt/tf_core/tf_device.h    | 10 +++++++---
 drivers/net/bnxt/tf_core/tf_device_p4.c | 10 +++++-----
 drivers/net/bnxt/tf_core/tf_em_common.c |  6 ++++--
 drivers/net/bnxt/tf_core/tf_em_host.c   |  8 ++++++++
 drivers/net/bnxt/tf_core/tf_tbl.h       |  3 +++
 drivers/net/bnxt/tf_core/tfp.c          | 19 +++++++++++++++++++
 drivers/net/bnxt/tf_core/tfp.h          | 16 ++++++++++++++++
 7 files changed, 62 insertions(+), 10 deletions(-)
drivers/net/bnxt/tf_core/tf_device.h +7 -3
index cf7c36e0e..b5fc695ec 100644
@@ -579,8 +579,11 @@ struct tf_dev_ops {
 	 * [in] tfp
 	 *   Pointer to TF handle
 	 *
-	 * [in] parms
-	 *   Pointer to table scope map parameters
+	 * [in] pf
+	 * PF associated with the table scope
+	 *
+	 * [in] parif_bitmask
+	 * Bitmask of PARIFs to enable
 	 *
 	 * [in/out] pointer to the parif_2_pf data to be updated
 	 *
@@ -593,7 +596,8 @@ struct tf_dev_ops {
 	 *    -EINVAL - Error
 	 */
 	int (*tf_dev_map_parif)(struct tf *tfp,
-				struct tf_map_tbl_scope_parms *parms,
+				uint16_t parif_bitmask,
+				uint16_t pf,
 				uint8_t *data,
 				uint8_t *mask,
 				uint16_t sz_in_bytes);
drivers/net/bnxt/tf_core/tf_device_p4.c +5 -5
index 07c8d02fa..b35e65a8d 100644
@@ -103,7 +103,8 @@ tf_dev_p4_get_tcam_slice_info(struct tf *tfp __rte_unused,
 
 static int
 tf_dev_p4_map_parif(struct tf *tfp __rte_unused,
-		    struct tf_map_tbl_scope_parms *parms,
+		    uint16_t parif_bitmask,
+		    uint16_t pf,
 		    uint8_t *data,
 		    uint8_t *mask,
 		    uint16_t sz_in_bytes)
@@ -112,21 +113,20 @@ tf_dev_p4_map_parif(struct tf *tfp __rte_unused,
 	uint32_t parif_pf_mask[2] = { 0 };
 	uint32_t parif;
 	uint32_t shift;
-	uint32_t scope_id = (uint32_t)(parms->tbl_scope_id);
 
 	if (sz_in_bytes != sizeof(uint64_t))
 		return -ENOTSUP;
 
 	for (parif = 0; parif < TF_DEV_P4_PARIF_MAX; parif++) {
-		if (parms->parif_bitmask & (1UL << parif)) {
+		if (parif_bitmask & (1UL << parif)) {
 			if (parif < 8) {
 				shift = 4 * parif;
 				parif_pf_mask[0] |= TF_DEV_P4_PF_MASK << shift;
-				parif_pf[0] |= scope_id << shift;
+				parif_pf[0] |= pf << shift;
 			} else {
 				shift = 4 * (parif - 8);
 				parif_pf_mask[1] |= TF_DEV_P4_PF_MASK << shift;
-				parif_pf[1] |= scope_id << shift;
+				parif_pf[1] |= pf << shift;
 			}
 		}
 	}
drivers/net/bnxt/tf_core/tf_em_common.c +4 -2
index a6ddb4eaf..cbce9389d 100644
@@ -1104,8 +1104,10 @@ int tf_em_ext_map_tbl_scope(struct tf *tfp,
 	}
 	mask = aparms.mem_va;
 
-	rc = dev->ops->tf_dev_map_parif(tfp, parms, (uint8_t *)data,
-					(uint8_t *)mask, sz_in_bytes);
+	rc = dev->ops->tf_dev_map_parif(tfp, parms->parif_bitmask,
+					tbl_scope_cb->pf,
+					(uint8_t *)data, (uint8_t *)mask,
+					sz_in_bytes);
 
 	if (rc) {
 		TFP_DRV_LOG(ERR,
drivers/net/bnxt/tf_core/tf_em_host.c +8 -0
index b5db94f3e..a106bdffd 100644
@@ -392,6 +392,14 @@ tf_em_ext_alloc(struct tf *tfp, struct tf_alloc_tbl_scope_parms *parms)
 	tbl_scope_cb->index = parms->tbl_scope_id;
 	tbl_scope_cb->tbl_scope_id = parms->tbl_scope_id;
 
+	rc = tfp_get_pf(tfp, &tbl_scope_cb->pf);
+	if (rc) {
+		TFP_DRV_LOG(ERR,
+			    "EEM: PF query error rc:%s\n",
+			    strerror(-rc));
+		goto cleanup;
+	}
+
 	for (dir = 0; dir < TF_DIR_MAX; dir++) {
 		rc = tf_msg_em_qcaps(tfp,
 				     dir,
drivers/net/bnxt/tf_core/tf_tbl.h +3 -0
index 2a5d24c94..230338c81 100644
@@ -38,6 +38,9 @@ struct tf_em_caps {
  */
 struct tf_tbl_scope_cb {
 	uint32_t tbl_scope_id;
+       /** The pf or parent pf of the vf used for table scope creation
+	*/
+	uint16_t pf;
 	int index;
 	struct hcapi_cfa_em_ctx_mem_info em_ctx_info[TF_DIR_MAX];
 	struct tf_em_caps em_caps[TF_DIR_MAX];
drivers/net/bnxt/tf_core/tfp.c +19 -0
index 426a182a9..0f6d63cc0 100644
@@ -178,3 +178,22 @@ tfp_get_fid(struct tf *tfp, uint16_t *fw_fid)
 
 	return 0;
 }
+
+int
+tfp_get_pf(struct tf *tfp, uint16_t *pf)
+{
+	struct bnxt *bp = NULL;
+
+	if (tfp == NULL || pf == NULL)
+		return -EINVAL;
+
+	bp = container_of(tfp, struct bnxt, tfp);
+	if (BNXT_VF(bp) && bp->parent) {
+		*pf = bp->parent->fid - 1;
+		return 0;
+	} else if (BNXT_PF(bp)) {
+		*pf = bp->fw_fid - 1;
+		return 0;
+	}
+	return -EINVAL;
+}
drivers/net/bnxt/tf_core/tfp.h +16 -0
index 421a7d9f7..551b9c569 100644
@@ -268,4 +268,20 @@ int tfp_get_fid(struct tf *tfp, uint16_t *fw_fid);
  */
 int tfp_get_fid(struct tf *tfp, uint16_t *fw_fid);
 
+/**
+ * Get the PF associated with the fw communications channel.
+ *
+ * [in] session
+ *   Pointer to session handle
+ *
+ * [out] pf
+ *   Pointer to the pf id
+ *
+ * Returns:
+ *   0       - Success
+ *   -EINVAL - Failure
+ *
+ */
+int tfp_get_pf(struct tf *tfp, uint16_t *pf);
+
 #endif /* _TFP_H_ */
Signature · 1 line
2.21.1 (Apple Git-122.3)
#23 lore raw

PATCH v2 4/11 net/bnxt: update ULP resource counts

In reply to Ajit Khaparde

From: Peter Spreadborough <[email protected]>

- Update the SR ULP requested resource counts to reflect those available after AFM resources are accounted for.
- Add build option to select either 2 or 4 slot EM entries. The default is 4 slot entries.

---
 drivers/net/bnxt/tf_core/tf_session.h | 16 +++++------
 drivers/net/bnxt/tf_ulp/bnxt_ulp.c    | 40 +++++++++++++--------------
 2 files changed, 28 insertions(+), 28 deletions(-)
drivers/net/bnxt/tf_core/tf_session.h +8 -8
index aa7a27877..6a5c89403 100644
@@ -33,16 +33,16 @@
 #define TF_SESSION_ID_INVALID     0xFFFFFFFF /** Invalid Session ID define */
 
 /**
- * Number of EM entries. Static for now will be removed
- * when parameter added at a later date. At this stage we
- * are using fixed size entries so that each stack entry
- * represents 4 RT (f/n)blocks. So we take the total block
- * allocation for truflow and divide that by 4.
+ * At this stage we are using fixed size entries so that each
+ * stack entry represents either 2 or 4 RT (f/n)blocks. So we
+ * take the total block allocation for truflow and divide that
+ * by either 2 or 4.
  */
-#define TF_SESSION_TOTAL_FN_BLOCKS (1024 * 8) /* 8K blocks */
+#ifdef TF_EM_ENTRY_IPV4_ONLY
+#define TF_SESSION_EM_ENTRY_SIZE 2 /* 2 blocks per entry */
+#else
 #define TF_SESSION_EM_ENTRY_SIZE 4 /* 4 blocks per entry */
-#define TF_SESSION_EM_POOL_SIZE \
-	(TF_SESSION_TOTAL_FN_BLOCKS / TF_SESSION_EM_ENTRY_SIZE)
+#endif
 
 /**
  * Session
drivers/net/bnxt/tf_ulp/bnxt_ulp.c +20 -20
index b22929a63..d753b5af9 100644
@@ -153,11 +153,11 @@ bnxt_ulp_tf_session_resources_get(struct bnxt *bp,
 	case BNXT_ULP_DEVICE_ID_STINGRAY:
 		/** RX **/
 		/* Identifiers */
-		res->ident_cnt[TF_DIR_RX].cnt[TF_IDENT_TYPE_L2_CTXT_HIGH] = 100;
+		res->ident_cnt[TF_DIR_RX].cnt[TF_IDENT_TYPE_L2_CTXT_HIGH] = 315;
 		res->ident_cnt[TF_DIR_RX].cnt[TF_IDENT_TYPE_L2_CTXT_LOW] = 6;
-		res->ident_cnt[TF_DIR_RX].cnt[TF_IDENT_TYPE_WC_PROF] = 10;
-		res->ident_cnt[TF_DIR_RX].cnt[TF_IDENT_TYPE_PROF_FUNC] = 10;
-		res->ident_cnt[TF_DIR_RX].cnt[TF_IDENT_TYPE_EM_PROF] = 10;
+		res->ident_cnt[TF_DIR_RX].cnt[TF_IDENT_TYPE_WC_PROF] = 192;
+		res->ident_cnt[TF_DIR_RX].cnt[TF_IDENT_TYPE_PROF_FUNC] = 64;
+		res->ident_cnt[TF_DIR_RX].cnt[TF_IDENT_TYPE_EM_PROF] = 192;
 
 		/* Table Types */
 		res->tbl_cnt[TF_DIR_RX].cnt[TF_TBL_TYPE_FULL_ACT_RECORD] = 8192;
@@ -170,28 +170,28 @@ bnxt_ulp_tf_session_resources_get(struct bnxt *bp,
 
 		/* TCAMs */
 		res->tcam_cnt[TF_DIR_RX].cnt[TF_TCAM_TBL_TYPE_L2_CTXT_TCAM_HIGH] =
-			100;
+			315;
 		res->tcam_cnt[TF_DIR_RX].cnt[TF_TCAM_TBL_TYPE_L2_CTXT_TCAM_LOW] =
 			6;
-		res->tcam_cnt[TF_DIR_RX].cnt[TF_TCAM_TBL_TYPE_PROF_TCAM] = 100;
-		res->tcam_cnt[TF_DIR_RX].cnt[TF_TCAM_TBL_TYPE_WC_TCAM] = 0;
+		res->tcam_cnt[TF_DIR_RX].cnt[TF_TCAM_TBL_TYPE_PROF_TCAM] = 960;
+		res->tcam_cnt[TF_DIR_RX].cnt[TF_TCAM_TBL_TYPE_WC_TCAM] = 112;
 
 		/* EM */
-		res->em_cnt[TF_DIR_RX].cnt[TF_EM_TBL_TYPE_EM_RECORD] = 13168;
+		res->em_cnt[TF_DIR_RX].cnt[TF_EM_TBL_TYPE_EM_RECORD] = 13200;
 
 		/* EEM */
 		res->em_cnt[TF_DIR_RX].cnt[TF_EM_TBL_TYPE_TBL_SCOPE] = 1;
 
 		/* SP */
-		res->tbl_cnt[TF_DIR_RX].cnt[TF_TBL_TYPE_ACT_SP_SMAC] = 255;
+		res->tbl_cnt[TF_DIR_RX].cnt[TF_TBL_TYPE_ACT_SP_SMAC] = 256;
 
 		/** TX **/
 		/* Identifiers */
-		res->ident_cnt[TF_DIR_TX].cnt[TF_IDENT_TYPE_L2_CTXT_HIGH] = 100;
-		res->ident_cnt[TF_DIR_TX].cnt[TF_IDENT_TYPE_L2_CTXT_LOW] = 100;
-		res->ident_cnt[TF_DIR_TX].cnt[TF_IDENT_TYPE_WC_PROF] = 10;
-		res->ident_cnt[TF_DIR_TX].cnt[TF_IDENT_TYPE_PROF_FUNC] = 10;
-		res->ident_cnt[TF_DIR_TX].cnt[TF_IDENT_TYPE_EM_PROF] = 10;
+		res->ident_cnt[TF_DIR_TX].cnt[TF_IDENT_TYPE_L2_CTXT_HIGH] = 292;
+		res->ident_cnt[TF_DIR_TX].cnt[TF_IDENT_TYPE_L2_CTXT_LOW] = 127;
+		res->ident_cnt[TF_DIR_TX].cnt[TF_IDENT_TYPE_WC_PROF] = 192;
+		res->ident_cnt[TF_DIR_TX].cnt[TF_IDENT_TYPE_PROF_FUNC] = 64;
+		res->ident_cnt[TF_DIR_TX].cnt[TF_IDENT_TYPE_EM_PROF] = 192;
 
 		/* Table Types */
 		res->tbl_cnt[TF_DIR_TX].cnt[TF_TBL_TYPE_FULL_ACT_RECORD] = 8192;
@@ -199,17 +199,17 @@ bnxt_ulp_tf_session_resources_get(struct bnxt *bp,
 		res->tbl_cnt[TF_DIR_TX].cnt[TF_TBL_TYPE_ACT_MODIFY_IPV4] = 1023;
 
 		/* ENCAP */
-		res->tbl_cnt[TF_DIR_TX].cnt[TF_TBL_TYPE_ACT_ENCAP_64B] = 511;
+		res->tbl_cnt[TF_DIR_TX].cnt[TF_TBL_TYPE_ACT_ENCAP_64B] = 367;
 		res->tbl_cnt[TF_DIR_TX].cnt[TF_TBL_TYPE_ACT_ENCAP_16B] = 223;
 		res->tbl_cnt[TF_DIR_TX].cnt[TF_TBL_TYPE_ACT_ENCAP_8B] = 255;
 
 		/* TCAMs */
 		res->tcam_cnt[TF_DIR_TX].cnt[TF_TCAM_TBL_TYPE_L2_CTXT_TCAM_HIGH] =
-			100;
+			292;
 		res->tcam_cnt[TF_DIR_TX].cnt[TF_TCAM_TBL_TYPE_L2_CTXT_TCAM_LOW] =
-			100;
-		res->tcam_cnt[TF_DIR_TX].cnt[TF_TCAM_TBL_TYPE_PROF_TCAM] = 100;
-		res->tcam_cnt[TF_DIR_TX].cnt[TF_TCAM_TBL_TYPE_WC_TCAM] = 0;
+			127;
+		res->tcam_cnt[TF_DIR_TX].cnt[TF_TCAM_TBL_TYPE_PROF_TCAM] = 960;
+		res->tcam_cnt[TF_DIR_TX].cnt[TF_TCAM_TBL_TYPE_WC_TCAM] = 928;
 
 		/* EM */
 		res->em_cnt[TF_DIR_TX].cnt[TF_EM_TBL_TYPE_EM_RECORD] = 15232;
@@ -219,7 +219,7 @@ bnxt_ulp_tf_session_resources_get(struct bnxt *bp,
 
 		/* SP */
 		res->tbl_cnt[TF_DIR_TX].cnt[TF_TBL_TYPE_ACT_SP_SMAC_IPV4] = 488;
-		res->tbl_cnt[TF_DIR_TX].cnt[TF_TBL_TYPE_ACT_SP_SMAC_IPV6] = 511;
+		res->tbl_cnt[TF_DIR_TX].cnt[TF_TBL_TYPE_ACT_SP_SMAC_IPV6] = 512;
 		break;
 	default:
 		return -EINVAL;
Signature · 1 line
2.21.1 (Apple Git-122.3)
#24 lore raw

PATCH v2 5/11 net/bnxt: fix infinite loop in flow query count

In reply to Ajit Khaparde

From: Somnath Kotur <[email protected]>

nxt_resource_idx could be zero in some cases which is invalid and should be part of the while loop condition. Also synchronize access to the flow db using the fdb_lock

Fixes 306c2d28e247 ("net/bnxt: support count action in flow query")
---
 drivers/net/bnxt/tf_ulp/ulp_fc_mgr.c | 51 +++++++++++++++-------------
 1 file changed, 27 insertions(+), 24 deletions(-)
drivers/net/bnxt/tf_ulp/ulp_fc_mgr.c +27 -24
index 051ebac04..41736a80d 100644
@@ -559,6 +559,9 @@ int ulp_fc_mgr_query_count_get(struct bnxt_ulp_context *ctxt,
 	if (!ulp_fc_info)
 		return -ENODEV;
 
+	if (bnxt_ulp_cntxt_acquire_fdb_lock(ctxt))
+		return -EIO;
+
 	do {
 		rc = ulp_flow_db_resource_get(ctxt,
 					      BNXT_ULP_FDB_TYPE_REGULAR,
@@ -575,35 +578,35 @@ int ulp_fc_mgr_query_count_get(struct bnxt_ulp_context *ctxt,
 			break;
 		}
 
-	} while (!rc);
+	} while (!rc && nxt_resource_index);
+
+	bnxt_ulp_cntxt_release_fdb_lock(ctxt);
 
-	if (rc)
+	if (rc || !found_cntr_resource)
 		return rc;
 
-	if (found_cntr_resource) {
-		dir = params.direction;
-		hw_cntr_id = params.resource_hndl;
-		sw_cntr_idx = hw_cntr_id -
-				ulp_fc_info->shadow_hw_tbl[dir].start_idx;
-		sw_acc_tbl_entry = &ulp_fc_info->sw_acc_tbl[dir][sw_cntr_idx];
-		if (params.resource_sub_type ==
+	dir = params.direction;
+	hw_cntr_id = params.resource_hndl;
+	sw_cntr_idx = hw_cntr_id -
+		ulp_fc_info->shadow_hw_tbl[dir].start_idx;
+	sw_acc_tbl_entry = &ulp_fc_info->sw_acc_tbl[dir][sw_cntr_idx];
+	if (params.resource_sub_type ==
 			BNXT_ULP_RESOURCE_SUB_TYPE_INDEX_TYPE_INT_COUNT) {
-			pthread_mutex_lock(&ulp_fc_info->fc_lock);
-			if (sw_acc_tbl_entry->pkt_count) {
-				count->hits_set = 1;
-				count->bytes_set = 1;
-				count->hits = sw_acc_tbl_entry->pkt_count;
-				count->bytes = sw_acc_tbl_entry->byte_count;
-			}
-			if (count->reset) {
-				sw_acc_tbl_entry->pkt_count = 0;
-				sw_acc_tbl_entry->byte_count = 0;
-			}
-			pthread_mutex_unlock(&ulp_fc_info->fc_lock);
-		} else {
-			/* TBD: Handle External counters */
-			rc = -EINVAL;
+		pthread_mutex_lock(&ulp_fc_info->fc_lock);
+		if (sw_acc_tbl_entry->pkt_count) {
+			count->hits_set = 1;
+			count->bytes_set = 1;
+			count->hits = sw_acc_tbl_entry->pkt_count;
+			count->bytes = sw_acc_tbl_entry->byte_count;
 		}
+		if (count->reset) {
+			sw_acc_tbl_entry->pkt_count = 0;
+			sw_acc_tbl_entry->byte_count = 0;
+		}
+		pthread_mutex_unlock(&ulp_fc_info->fc_lock);
+	} else {
+		/* TBD: Handle External counters */
+		rc = -EINVAL;
 	}
 
 	return rc;
Signature · 1 line
2.21.1 (Apple Git-122.3)
#25 lore raw

PATCH v2 6/11 net/bnxt: add support for flow counter accumulation

In reply to Ajit Khaparde

From: Kishore Padmanabha <[email protected]>

Add support for flow counter accumulation.
In case of hierarchical flows, involving parent and child flows, the child flow counters are aggregated to get the parent flow counter information.

---
 drivers/net/bnxt/tf_ulp/ulp_fc_mgr.c          |  92 ++++-
 drivers/net/bnxt/tf_ulp/ulp_fc_mgr.h          |  19 +
 drivers/net/bnxt/tf_ulp/ulp_flow_db.c         | 382 ++++++++++++++----
 drivers/net/bnxt/tf_ulp/ulp_flow_db.h         |  44 ++
 .../net/bnxt/tf_ulp/ulp_template_db_enum.h    |   3 +-
 5 files changed, 447 insertions(+), 93 deletions(-)
drivers/net/bnxt/tf_ulp/ulp_fc_mgr.c +79 -13
index 41736a80d..734b41998 100644
@@ -21,13 +21,13 @@ static int
 ulp_fc_mgr_shadow_mem_alloc(struct hw_fc_mem_info *parms, int size)
 {
 	/* Allocate memory*/
-	if (parms == NULL)
+	if (!parms)
 		return -EINVAL;
 
 	parms->mem_va = rte_zmalloc("ulp_fc_info",
 				    RTE_CACHE_LINE_ROUNDUP(size),
 				    4096);
-	if (parms->mem_va == NULL) {
+	if (!parms->mem_va) {
 		BNXT_TF_DBG(ERR, "Allocate failed mem_va\n");
 		return -ENOMEM;
 	}
@@ -149,7 +149,6 @@ ulp_fc_mgr_deinit(struct bnxt_ulp_context *ctxt)
 	for (i = 0; i < TF_DIR_MAX; i++)
 		ulp_fc_mgr_shadow_mem_free(&ulp_fc_info->shadow_hw_tbl[i]);
 
-
 	rte_free(ulp_fc_info);
 
 	/* Safe to ignore on deinit */
@@ -254,7 +253,7 @@ ulp_bulk_get_flow_stats(struct tf *tfp,
 	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;
 
-	if (stats == NULL) {
+	if (!stats) {
 		PMD_DRV_LOG(ERR,
 			    "BULK: Memory not initialized id:0x%x dir:%d\n",
 			    parms.starting_idx, dir);
@@ -274,7 +273,8 @@ ulp_bulk_get_flow_stats(struct tf *tfp,
 		sw_acc_tbl_entry = &fc_info->sw_acc_tbl[dir][i];
 		if (!sw_acc_tbl_entry->valid)
 			continue;
-		sw_acc_tbl_entry->pkt_count += FLOW_CNTR_PKTS(stats[i], dparms);
+		sw_acc_tbl_entry->pkt_count += FLOW_CNTR_PKTS(stats[i],
+							      dparms);
 		sw_acc_tbl_entry->byte_count += FLOW_CNTR_BYTES(stats[i],
 								dparms);
 	}
@@ -282,7 +282,8 @@ ulp_bulk_get_flow_stats(struct tf *tfp,
 	return rc;
 }
 
-static int ulp_get_single_flow_stat(struct tf *tfp,
+static int ulp_get_single_flow_stat(struct bnxt_ulp_context *ctxt,
+				    struct tf *tfp,
 				    struct bnxt_ulp_fc_info *fc_info,
 				    enum tf_dir dir,
 				    uint32_t hw_cntr_id,
@@ -291,7 +292,7 @@ static int ulp_get_single_flow_stat(struct tf *tfp,
 	int rc = 0;
 	struct tf_get_tbl_entry_parms parms = { 0 };
 	enum tf_tbl_type stype = TF_TBL_TYPE_ACT_STATS_64;  /* TBD:Template? */
-	struct sw_acc_counter *sw_acc_tbl_entry = NULL;
+	struct sw_acc_counter *sw_acc_tbl_entry = NULL, *t_sw;
 	uint64_t stats = 0;
 	uint32_t sw_cntr_indx = 0;
 
@@ -318,6 +319,18 @@ static int ulp_get_single_flow_stat(struct tf *tfp,
 	sw_acc_tbl_entry->pkt_count = FLOW_CNTR_PKTS(stats, dparms);
 	sw_acc_tbl_entry->byte_count = FLOW_CNTR_BYTES(stats, dparms);
 
+	/* Update the parent counters if it is child flow */
+	if (sw_acc_tbl_entry->parent_flow_id) {
+		/* Update the parent counters */
+		t_sw = sw_acc_tbl_entry;
+		if (ulp_flow_db_parent_flow_count_update(ctxt,
+							 t_sw->parent_flow_id,
+							 t_sw->pkt_count,
+							 t_sw->byte_count)) {
+			PMD_DRV_LOG(ERR, "Error updating parent counters\n");
+		}
+	}
+
 	return rc;
 }
 
@@ -384,13 +397,17 @@ ulp_fc_mgr_alarm_cb(void *arg)
 			break;
 	}
 	*/
+
+	/* reset the parent accumulation counters before accumulation if any */
+	ulp_flow_db_parent_flow_count_reset(ctxt);
+
 	num_entries = dparms->flow_count_db_entries / 2;
 	for (i = 0; i < TF_DIR_MAX; i++) {
 		for (j = 0; j < num_entries; j++) {
 			if (!ulp_fc_info->sw_acc_tbl[i][j].valid)
 				continue;
 			hw_cntr_id = ulp_fc_info->sw_acc_tbl[i][j].hw_cntr_id;
-			rc = ulp_get_single_flow_stat(tfp, ulp_fc_info, i,
+			rc = ulp_get_single_flow_stat(ctxt, tfp, ulp_fc_info, i,
 						      hw_cntr_id, dparms);
 			if (rc)
 				break;
@@ -573,11 +590,12 @@ int ulp_fc_mgr_query_count_get(struct bnxt_ulp_context *ctxt,
 		     (params.resource_sub_type ==
 		      BNXT_ULP_RESOURCE_SUB_TYPE_INDEX_TYPE_INT_COUNT ||
 		      params.resource_sub_type ==
-		      BNXT_ULP_RESOURCE_SUB_TYPE_INDEX_TYPE_EXT_COUNT)) {
+		      BNXT_ULP_RESOURCE_SUB_TYPE_INDEX_TYPE_EXT_COUNT ||
+		      params.resource_sub_type ==
+		      BNXT_ULP_RESOURCE_SUB_TYPE_INDEX_TYPE_INT_COUNT_ACC)) {
 			found_cntr_resource = true;
 			break;
 		}
-
 	} while (!rc && nxt_resource_index);
 
 	bnxt_ulp_cntxt_release_fdb_lock(ctxt);
@@ -587,12 +605,12 @@ int ulp_fc_mgr_query_count_get(struct bnxt_ulp_context *ctxt,
 
 	dir = params.direction;
 	hw_cntr_id = params.resource_hndl;
-	sw_cntr_idx = hw_cntr_id -
-		ulp_fc_info->shadow_hw_tbl[dir].start_idx;
-	sw_acc_tbl_entry = &ulp_fc_info->sw_acc_tbl[dir][sw_cntr_idx];
 	if (params.resource_sub_type ==
 			BNXT_ULP_RESOURCE_SUB_TYPE_INDEX_TYPE_INT_COUNT) {
 		pthread_mutex_lock(&ulp_fc_info->fc_lock);
+		sw_cntr_idx = hw_cntr_id -
+			ulp_fc_info->shadow_hw_tbl[dir].start_idx;
+		sw_acc_tbl_entry = &ulp_fc_info->sw_acc_tbl[dir][sw_cntr_idx];
 		if (sw_acc_tbl_entry->pkt_count) {
 			count->hits_set = 1;
 			count->bytes_set = 1;
@@ -604,6 +622,15 @@ int ulp_fc_mgr_query_count_get(struct bnxt_ulp_context *ctxt,
 			sw_acc_tbl_entry->byte_count = 0;
 		}
 		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 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 {
 		/* TBD: Handle External counters */
 		rc = -EINVAL;
@@ -611,3 +638,42 @@ int ulp_fc_mgr_query_count_get(struct bnxt_ulp_context *ctxt,
 
 	return rc;
 }
+
+/*
+ * Set the parent flow if it is SW accumulation counter entry.
+ *
+ * ctxt [in] The ulp context for the flow counter manager
+ *
+ * dir [in] The direction of the flow
+ *
+ * hw_cntr_id [in] The HW flow counter ID
+ *
+ * fid [in] parent flow id
+ *
+ */
+int32_t ulp_fc_mgr_cntr_parent_flow_set(struct bnxt_ulp_context *ctxt,
+					enum tf_dir dir,
+					uint32_t hw_cntr_id,
+					uint32_t fid)
+{
+	struct bnxt_ulp_fc_info *ulp_fc_info;
+	uint32_t sw_cntr_idx;
+	int32_t rc = 0;
+
+	ulp_fc_info = bnxt_ulp_cntxt_ptr2_fc_info_get(ctxt);
+	if (!ulp_fc_info)
+		return -EIO;
+
+	pthread_mutex_lock(&ulp_fc_info->fc_lock);
+	sw_cntr_idx = hw_cntr_id - ulp_fc_info->shadow_hw_tbl[dir].start_idx;
+	if (ulp_fc_info->sw_acc_tbl[dir][sw_cntr_idx].valid) {
+		ulp_fc_info->sw_acc_tbl[dir][sw_cntr_idx].parent_flow_id = fid;
+	} else {
+		BNXT_TF_DBG(ERR, "Failed to set parent flow id %x:%x\n",
+			    hw_cntr_id, fid);
+		rc = -ENOENT;
+	}
+	pthread_mutex_unlock(&ulp_fc_info->fc_lock);
+
+	return rc;
+}
drivers/net/bnxt/tf_ulp/ulp_fc_mgr.h +19 -0
index 0cb880d4b..de4d3dfe9 100644
@@ -26,6 +26,7 @@ struct sw_acc_counter {
 	uint64_t byte_count;
 	bool	valid;
 	uint32_t hw_cntr_id;
+	uint32_t parent_flow_id;
 };
 
 struct hw_fc_mem_info {
@@ -163,4 +164,22 @@ bool ulp_fc_mgr_thread_isstarted(struct bnxt_ulp_context *ctxt);
 int ulp_fc_mgr_query_count_get(struct bnxt_ulp_context *ulp_ctx,
 			       uint32_t flow_id,
 			       struct rte_flow_query_count *count);
+
+/*
+ * Set the parent flow if in the SW accumulator table entry
+ *
+ * ctxt [in] The ulp context for the flow counter manager
+ *
+ * dir [in] The direction of the flow
+ *
+ * hw_cntr_id [in] The HW flow counter ID
+ *
+ * fid [in] parent flow id
+ *
+ */
+int32_t ulp_fc_mgr_cntr_parent_flow_set(struct bnxt_ulp_context *ctxt,
+					enum tf_dir dir,
+					uint32_t hw_cntr_id,
+					uint32_t fid);
+
 #endif /* _ULP_FC_MGR_H_ */
drivers/net/bnxt/tf_ulp/ulp_flow_db.c +303 -79

513 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_flow_db.h +44 -0

54 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_template_db_enum.h +2 -1
index 168e308c2..6dade9afd 100644
@@ -332,7 +332,8 @@ enum bnxt_ulp_resource_sub_type {
 	BNXT_ULP_RESOURCE_SUB_TYPE_INDEX_TYPE_NORMAL = 0,
 	BNXT_ULP_RESOURCE_SUB_TYPE_INDEX_TYPE_VFR_CFA_ACTION = 1,
 	BNXT_ULP_RESOURCE_SUB_TYPE_INDEX_TYPE_INT_COUNT = 2,
-	BNXT_ULP_RESOURCE_SUB_TYPE_INDEX_TYPE_EXT_COUNT = 3,
+	BNXT_ULP_RESOURCE_SUB_TYPE_INDEX_TYPE_INT_COUNT_ACC = 3,
+	BNXT_ULP_RESOURCE_SUB_TYPE_INDEX_TYPE_EXT_COUNT = 4,
 	BNXT_ULP_RESOURCE_SUB_TYPE_CACHE_TYPE_L2_CNTXT_TCAM = 0,
 	BNXT_ULP_RESOURCE_SUB_TYPE_CACHE_TYPE_PROFILE_TCAM = 1
 };
Signature · 1 line
2.21.1 (Apple Git-122.3)
#26 lore raw

PATCH v2 7/11 net/bnxt: change HWRM command to create reps

In reply to Ajit Khaparde

From: Somnath Kotur <[email protected]>

Use cfa pair alloc for configuring reps.
Instead of cfa_vfr_alloc for Wh+ and cfa_pair_alloc for Stingray, converge to cfa_pair_alloc/free for both devices. Set the command request structure bits accordingly.
As part of this, remove the old cfa_vfr_alloc cmd definitions as FW has deprecated support for those commands.

---
 doc/guides/rel_notes/release_20_11.rst |  1 +
 drivers/net/bnxt/bnxt.h                |  6 ++-
 drivers/net/bnxt/bnxt_ethdev.c         |  2 +
 drivers/net/bnxt/bnxt_hwrm.c           | 60 +++-----------------------
 drivers/net/bnxt/bnxt_hwrm.h           |  2 -
 drivers/net/bnxt/bnxt_reps.c           | 18 ++++----
 6 files changed, 22 insertions(+), 67 deletions(-)
doc/guides/rel_notes/release_20_11.rst +1 -0
index caff9fe9d..c8b284e3b 100644
@@ -147,6 +147,7 @@ New Features
   * Added support for RSS hash level selection.
   * Updated HWRM structures to 1.10.1.70 version.
   * Added TRUFLOW support for Stingray devices.
+  * Added support for representors on MAIA cores of SR.
 
 * **Updated Cisco enic driver.**
 
drivers/net/bnxt/bnxt.h +5 -1
index a951bca7a..57178192d 100644
@@ -836,12 +836,14 @@ struct bnxt_representor {
 #define BNXT_REP_Q_F2R_VALID		BIT(2)
 #define BNXT_REP_FC_R2F_VALID		BIT(3)
 #define BNXT_REP_FC_F2R_VALID		BIT(4)
+#define BNXT_REP_BASED_PF_VALID		BIT(5)
 	uint32_t		flags;
 	uint16_t		fw_fid;
 #define	BNXT_DFLT_VNIC_ID_INVALID	0xFFFF
 	uint16_t		dflt_vnic_id;
 	uint16_t		svif;
 	uint16_t		vfr_tx_cfa_action;
+	uint8_t			parent_pf_idx; /* Logical PF index */
 	uint32_t		dpdk_port_id;
 	uint32_t		rep_based_pf;
 	uint8_t			rep_q_r2f;
@@ -863,7 +865,9 @@ struct bnxt_representor {
 	uint64_t                rx_drop_bytes[BNXT_MAX_VF_REP_RINGS];
 };
 
-#define BNXT_REP_PF(vfr_bp)	((vfr_bp)->flags & BNXT_REP_IS_PF)
+#define BNXT_REP_PF(vfr_bp)		((vfr_bp)->flags & BNXT_REP_IS_PF)
+#define BNXT_REP_BASED_PF(vfr_bp)	\
+		((vfr_bp)->flags & BNXT_REP_BASED_PF_VALID)
 
 struct bnxt_vf_rep_tx_queue {
 	struct bnxt_tx_queue *txq;
drivers/net/bnxt/bnxt_ethdev.c +2 -0
index 32318cfd0..2a00a5ea9 100644
@@ -5767,6 +5767,8 @@ bnxt_parse_devarg_rep_based_pf(__rte_unused const char *key,
 	}
 
 	vfr_bp->rep_based_pf = rep_based_pf;
+	vfr_bp->flags |= BNXT_REP_BASED_PF_VALID;
+
 	PMD_DRV_LOG(INFO, "rep-based-pf = %d\n", vfr_bp->rep_based_pf);
 
 	return 0;
drivers/net/bnxt/bnxt_hwrm.c +6 -54

79 lines not on this page · raw message

drivers/net/bnxt/bnxt_hwrm.h +0 -2
index a7fa7f66b..23ca6ab51 100644
@@ -297,8 +297,6 @@ int bnxt_hwrm_port_phy_qcaps(struct bnxt *bp);
 int bnxt_hwrm_oem_cmd(struct bnxt *bp, uint32_t entry_num);
 int bnxt_clear_one_vnic_filter(struct bnxt *bp,
 			       struct bnxt_filter_info *filter);
-int bnxt_hwrm_cfa_vfr_alloc(struct bnxt *bp, uint16_t vf_idx);
-int bnxt_hwrm_cfa_vfr_free(struct bnxt *bp, uint16_t vf_idx);
 void bnxt_hwrm_free_vf_info(struct bnxt *bp);
 int bnxt_hwrm_first_vf_id_query(struct bnxt *bp, uint16_t fid,
 				uint16_t *first_vf_id);
drivers/net/bnxt/bnxt_reps.c +8 -10
index b4566c926..e5ba0909b 100644
@@ -216,8 +216,9 @@ int bnxt_representor_init(struct rte_eth_dev *eth_dev, void *params)
 		    "Switch domain id %d: Representor Device %d init done\n",
 		    vf_rep_bp->switch_domain_id, vf_rep_bp->vf_id);
 
-	if (vf_rep_bp->rep_based_pf) {
+	if (BNXT_REP_BASED_PF(vf_rep_bp)) {
 		vf_rep_bp->fw_fid = vf_rep_bp->rep_based_pf + 1;
+		vf_rep_bp->parent_pf_idx = vf_rep_bp->rep_based_pf;
 		if (!(BNXT_REP_PF(vf_rep_bp))) {
 			/* VF representor for the remote PF,get first_vf_id */
 			rc = bnxt_hwrm_first_vf_id_query(parent_bp,
@@ -237,6 +238,10 @@ int bnxt_representor_init(struct rte_eth_dev *eth_dev, void *params)
 		}
 	}  else {
 		vf_rep_bp->fw_fid = rep_params->vf_id + parent_bp->first_vf_id;
+		if (BNXT_VF_IS_TRUSTED(parent_bp))
+			vf_rep_bp->parent_pf_idx = parent_bp->parent->fid - 1;
+		else
+			vf_rep_bp->parent_pf_idx = parent_bp->fw_fid - 1;
 	}
 
 	PMD_DRV_LOG(INFO, "vf_rep->fw_fid = %d\n", vf_rep_bp->fw_fid);
@@ -329,11 +334,7 @@ static int bnxt_tf_vfr_alloc(struct rte_eth_dev *vfr_ethdev)
 	/* update the port id so you can backtrack to ethdev */
 	vfr->dpdk_port_id = vfr_ethdev->data->port_id;
 
-	if (BNXT_STINGRAY(parent_bp)) {
-		rc = bnxt_hwrm_cfa_pair_alloc(parent_bp, vfr);
-	} else {
-		rc = bnxt_hwrm_cfa_vfr_alloc(parent_bp, vfr->vf_id);
-	}
+	rc = bnxt_hwrm_cfa_pair_alloc(parent_bp, vfr);
 	if (rc) {
 		BNXT_TF_DBG(ERR, "Failed in hwrm vfr alloc vfr:%u rc=%d\n",
 			    vfr->vf_id, rc);
@@ -468,10 +469,7 @@ static int bnxt_vfr_free(struct bnxt_representor *vfr)
 		    vfr->vf_id);
 	vfr->vfr_tx_cfa_action = 0;
 
-	if (BNXT_STINGRAY(parent_bp))
-		rc = bnxt_hwrm_cfa_pair_free(parent_bp, vfr);
-	else
-		rc = bnxt_hwrm_cfa_vfr_free(parent_bp, vfr->vf_id);
+	rc = bnxt_hwrm_cfa_pair_free(parent_bp, vfr);
 
 	return rc;
 }
Signature · 1 line
2.21.1 (Apple Git-122.3)
#27 lore raw

PATCH v2 8/11 net/bnxt: add mapper support for wildcard TCAM

In reply to Ajit Khaparde

From: Kishore Padmanabha <[email protected]>

Added support for the key and mask fields encoding for the wildcard tcam entry.

---
 drivers/net/bnxt/tf_ulp/ulp_mapper.c |  47 ++++++++--
 drivers/net/bnxt/tf_ulp/ulp_utils.c  | 125 +++++++++++++++++++++++++++
 drivers/net/bnxt/tf_ulp/ulp_utils.h  |  48 +++++++++-
 3 files changed, 212 insertions(+), 8 deletions(-)
drivers/net/bnxt/tf_ulp/ulp_mapper.c +40 -7
index b74cb92f5..27b478099 100644
@@ -1497,6 +1497,29 @@ ulp_mapper_tcam_tbl_entry_write(struct bnxt_ulp_mapper_parms *parms,
 	return rc;
 }
 
+#define BNXT_ULP_WC_TCAM_SLICE_SIZE 80
+/* internal function to post process the key/mask blobs for wildcard tcam tbl */
+static void ulp_mapper_wc_tcam_tbl_post_process(struct ulp_blob *blob,
+						uint32_t len)
+{
+	uint8_t mode[2] = {0x0, 0x0};
+	uint32_t mode_len = len / BNXT_ULP_WC_TCAM_SLICE_SIZE;
+	uint32_t size, idx;
+
+	/* Add the mode bits to the key and mask*/
+	if (mode_len == 2)
+		mode[1] = 2;
+	else if (mode_len > 2)
+		mode[1] = 3;
+
+	size = BNXT_ULP_WC_TCAM_SLICE_SIZE + ULP_BYTE_2_BITS(sizeof(mode));
+	for (idx = 0; idx < mode_len; idx++)
+		ulp_blob_insert(blob, (size * idx), mode,
+				ULP_BYTE_2_BITS(sizeof(mode)));
+	ulp_blob_perform_64B_word_swap(blob);
+	ulp_blob_perform_64B_byte_swap(blob);
+}
+
 static int32_t
 ulp_mapper_tcam_tbl_process(struct bnxt_ulp_mapper_parms *parms,
 			    struct bnxt_ulp_mapper_tbl_info *tbl)
@@ -1533,9 +1556,9 @@ ulp_mapper_tcam_tbl_process(struct bnxt_ulp_mapper_parms *parms,
 		return -EINVAL;
 	}
 
-	if (!ulp_blob_init(&key, tbl->key_bit_size,
+	if (!ulp_blob_init(&key, tbl->blob_key_bit_size,
 			   parms->device_params->byte_order) ||
-	    !ulp_blob_init(&mask, tbl->key_bit_size,
+	    !ulp_blob_init(&mask, tbl->blob_key_bit_size,
 			   parms->device_params->byte_order) ||
 	    !ulp_blob_init(&data, tbl->result_bit_size,
 			   parms->device_params->byte_order) ||
@@ -1545,6 +1568,11 @@ ulp_mapper_tcam_tbl_process(struct bnxt_ulp_mapper_parms *parms,
 		return -EINVAL;
 	}
 
+	if (tbl->resource_type == TF_TCAM_TBL_TYPE_WC_TCAM) {
+		key.byte_order = BNXT_ULP_BYTE_ORDER_BE;
+		mask.byte_order = BNXT_ULP_BYTE_ORDER_BE;
+	}
+
 	/* create the key/mask */
 	/*
 	 * NOTE: The WC table will require some kind of flag to handle the
@@ -1570,6 +1598,11 @@ ulp_mapper_tcam_tbl_process(struct bnxt_ulp_mapper_parms *parms,
 		}
 	}
 
+	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
@@ -1578,18 +1611,18 @@ ulp_mapper_tcam_tbl_process(struct bnxt_ulp_mapper_parms *parms,
 		aparms.dir		= tbl->direction;
 		aparms.tcam_tbl_type	= tbl->resource_type;
 		aparms.search_enable	= tbl->srch_b4_alloc;
-		aparms.key_sz_in_bits	= tbl->key_bit_size;
 		aparms.key		= ulp_blob_data_get(&key, &tmplen);
-		if (tbl->key_bit_size != 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->key_bit_size);
+				    tmplen, tbl->blob_key_bit_size);
 			return -EINVAL;
 		}
 
 		aparms.mask		= ulp_blob_data_get(&mask, &tmplen);
-		if (tbl->key_bit_size != tmplen) {
+		if (tbl->blob_key_bit_size != tmplen) {
 			BNXT_TF_DBG(ERR, "Mask len (%d) != Expected (%d)\n",
-				    tmplen, tbl->key_bit_size);
+				    tmplen, tbl->blob_key_bit_size);
 			return -EINVAL;
 		}
 
drivers/net/bnxt/tf_ulp/ulp_utils.c +125 -0

137 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_utils.h +47 -1

72 lines not on this page · raw message

Signature · 1 line
2.21.1 (Apple Git-122.3)
#28 lore raw

PATCH v2 9/11 net/bnxt: refactor flow id allocation

In reply to Ajit Khaparde

From: Venkat Duvvuru <[email protected]>

Currently, the flow id is allocated inside ulp_mapper_flow_create. However with vxlan decap feature if F2 flow comes before F1 flow then F2 is cached and not really installed in the hardware which means the code will return without calling ulp_mapper_flow_create. But, ULP has to still return valid flow id to the stack. Hence, move the flow id allocation outside ulp_mapper_flow_create.

---
 drivers/net/bnxt/tf_ulp/bnxt_ulp_flow.c  | 109 ++++++++++++++++-------
 drivers/net/bnxt/tf_ulp/ulp_def_rules.c  |  48 ++++++++--
 drivers/net/bnxt/tf_ulp/ulp_mapper.c     |  35 +-------
 drivers/net/bnxt/tf_ulp/ulp_mapper.h     |   4 +-
 drivers/net/bnxt/tf_ulp/ulp_rte_parser.h |   9 ++
 5 files changed, 132 insertions(+), 73 deletions(-)
drivers/net/bnxt/tf_ulp/bnxt_ulp_flow.c +77 -32
index c7b29824e..47fbaba03 100644
@@ -74,6 +74,29 @@ bnxt_ulp_set_dir_attributes(struct ulp_rte_parser_params *params,
 		params->dir_attr |= BNXT_ULP_FLOW_ATTR_TRANSFER;
 }
 
+void
+bnxt_ulp_init_mapper_params(struct bnxt_ulp_mapper_create_parms *mapper_cparms,
+			    struct ulp_rte_parser_params *params,
+			    uint32_t priority, uint32_t class_id,
+			    uint32_t act_tmpl, uint16_t func_id,
+			    uint32_t fid,
+			    enum bnxt_ulp_fdb_type flow_type)
+{
+	mapper_cparms->app_priority = priority;
+	mapper_cparms->dir_attr = params->dir_attr;
+
+	mapper_cparms->class_tid = class_id;
+	mapper_cparms->act_tid = act_tmpl;
+	mapper_cparms->func_id = func_id;
+	mapper_cparms->hdr_bitmap = &params->hdr_bitmap;
+	mapper_cparms->hdr_field = params->hdr_field;
+	mapper_cparms->comp_fld = params->comp_fld;
+	mapper_cparms->act = &params->act_bitmap;
+	mapper_cparms->act_prop = &params->act_prop;
+	mapper_cparms->flow_type = flow_type;
+	mapper_cparms->flow_id = fid;
+}
+
 /* Function to create the rte flow. */
 static struct rte_flow *
 bnxt_ulp_flow_create(struct rte_eth_dev *dev,
@@ -85,22 +108,23 @@ bnxt_ulp_flow_create(struct rte_eth_dev *dev,
 	struct bnxt_ulp_mapper_create_parms mapper_cparms = { 0 };
 	struct ulp_rte_parser_params params;
 	struct bnxt_ulp_context *ulp_ctx;
+	int rc, ret = BNXT_TF_RC_ERROR;
 	uint32_t class_id, act_tmpl;
 	struct rte_flow *flow_id;
+	uint16_t func_id;
 	uint32_t fid;
-	int ret = BNXT_TF_RC_ERROR;
 
 	if (bnxt_ulp_flow_validate_args(attr,
 					pattern, actions,
 					error) == BNXT_TF_RC_ERROR) {
 		BNXT_TF_DBG(ERR, "Invalid arguments being passed\n");
-		goto parse_error;
+		goto parse_err1;
 	}
 
 	ulp_ctx = bnxt_ulp_eth_dev_ptr2_cntxt_get(dev);
 	if (!ulp_ctx) {
 		BNXT_TF_DBG(ERR, "ULP context is not initialized\n");
-		goto parse_error;
+		goto parse_err1;
 	}
 
 	/* Initialize the parser params */
@@ -116,56 +140,72 @@ bnxt_ulp_flow_create(struct rte_eth_dev *dev,
 	ULP_COMP_FLD_IDX_WR(&params, BNXT_ULP_CF_IDX_SVIF_FLAG,
 			    BNXT_ULP_INVALID_SVIF_VAL);
 
+	/* Get the function id */
+	if (ulp_port_db_port_func_id_get(ulp_ctx,
+					 dev->data->port_id,
+					 &func_id)) {
+		BNXT_TF_DBG(ERR, "conversion of port to func id failed\n");
+		goto parse_err1;
+	}
+
+	/* Protect flow creation */
+	if (bnxt_ulp_cntxt_acquire_fdb_lock(ulp_ctx)) {
+		BNXT_TF_DBG(ERR, "Flow db lock acquire failed\n");
+		goto parse_err1;
+	}
+
+	/* Allocate a Flow ID for attaching all resources for the flow to.
+	 * Once allocated, all errors have to walk the list of resources and
+	 * free each of them.
+	 */
+	rc = ulp_flow_db_fid_alloc(ulp_ctx, BNXT_ULP_FDB_TYPE_REGULAR,
+				   func_id, &fid);
+	if (rc) {
+		BNXT_TF_DBG(ERR, "Unable to allocate flow table entry\n");
+		goto parse_err2;
+	}
+
 	/* Parse the rte flow pattern */
 	ret = bnxt_ulp_rte_parser_hdr_parse(pattern, &params);
 	if (ret != BNXT_TF_RC_SUCCESS)
-		goto parse_error;
+		goto parse_err3;
 
 	/* Parse the rte flow action */
 	ret = bnxt_ulp_rte_parser_act_parse(actions, &params);
 	if (ret != BNXT_TF_RC_SUCCESS)
-		goto parse_error;
+		goto parse_err3;
 
 	/* Perform the rte flow post process */
 	ret = bnxt_ulp_rte_parser_post_process(&params);
 	if (ret != BNXT_TF_RC_SUCCESS)
-		goto parse_error;
+		goto parse_err3;
 
 	ret = ulp_matcher_pattern_match(&params, &class_id);
 	if (ret != BNXT_TF_RC_SUCCESS)
-		goto parse_error;
+		goto parse_err3;
 
 	ret = ulp_matcher_action_match(&params, &act_tmpl);
 	if (ret != BNXT_TF_RC_SUCCESS)
-		goto parse_error;
+		goto parse_err3;
 
-	mapper_cparms.app_priority = attr->priority;
-	mapper_cparms.hdr_bitmap = &params.hdr_bitmap;
-	mapper_cparms.hdr_field = params.hdr_field;
-	mapper_cparms.comp_fld = params.comp_fld;
-	mapper_cparms.act = &params.act_bitmap;
-	mapper_cparms.act_prop = &params.act_prop;
-	mapper_cparms.class_tid = class_id;
-	mapper_cparms.act_tid = act_tmpl;
-	mapper_cparms.flow_type = BNXT_ULP_FDB_TYPE_REGULAR;
+	bnxt_ulp_init_mapper_params(&mapper_cparms, &params, attr->priority,
+				    class_id, act_tmpl, func_id, fid,
+				    BNXT_ULP_FDB_TYPE_REGULAR);
+	/* Call the ulp mapper to create the flow in the hardware. */
+	ret = ulp_mapper_flow_create(ulp_ctx, &mapper_cparms);
+	if (ret)
+		goto parse_err3;
 
-	/* Get the function id */
-	if (ulp_port_db_port_func_id_get(ulp_ctx,
-					 dev->data->port_id,
-					 &mapper_cparms.func_id)) {
-		BNXT_TF_DBG(ERR, "conversion of port to func id failed\n");
-		goto parse_error;
-	}
-	mapper_cparms.dir_attr = params.dir_attr;
+	bnxt_ulp_cntxt_release_fdb_lock(ulp_ctx);
 
-	/* Call the ulp mapper to create the flow in the hardware. */
-	ret = ulp_mapper_flow_create(ulp_ctx, &mapper_cparms, &fid);
-	if (!ret) {
-		flow_id = (struct rte_flow *)((uintptr_t)fid);
-		return flow_id;
-	}
+	flow_id = (struct rte_flow *)((uintptr_t)fid);
+	return flow_id;
 
-parse_error:
+parse_err3:
+	ulp_flow_db_fid_free(ulp_ctx, BNXT_ULP_FDB_TYPE_REGULAR, fid);
+parse_err2:
+	bnxt_ulp_cntxt_release_fdb_lock(ulp_ctx);
+parse_err1:
 	rte_flow_error_set(error, ret, RTE_FLOW_ERROR_TYPE_HANDLE, NULL,
 			   "Failed to create flow.");
 	return NULL;
@@ -281,6 +321,10 @@ bnxt_ulp_flow_destroy(struct rte_eth_dev *dev,
 		return -EINVAL;
 	}
 
+	if (bnxt_ulp_cntxt_acquire_fdb_lock(ulp_ctx)) {
+		BNXT_TF_DBG(ERR, "Flow db lock acquire failed\n");
+		return -EINVAL;
+	}
 	ret = ulp_mapper_flow_destroy(ulp_ctx, BNXT_ULP_FDB_TYPE_REGULAR,
 				      flow_id);
 	if (ret) {
@@ -290,6 +334,7 @@ bnxt_ulp_flow_destroy(struct rte_eth_dev *dev,
 					   RTE_FLOW_ERROR_TYPE_HANDLE, NULL,
 					   "Failed to destroy flow.");
 	}
+	bnxt_ulp_cntxt_release_fdb_lock(ulp_ctx);
 
 	return ret;
 }
drivers/net/bnxt/tf_ulp/ulp_def_rules.c +41 -7

81 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_mapper.c +3 -32
index 27b478099..d5c129b3a 100644
@@ -2723,15 +2723,9 @@ ulp_mapper_flow_destroy(struct bnxt_ulp_context *ulp_ctx,
 		BNXT_TF_DBG(ERR, "Invalid parms, unable to free flow\n");
 		return -EINVAL;
 	}
-	if (bnxt_ulp_cntxt_acquire_fdb_lock(ulp_ctx)) {
-		BNXT_TF_DBG(ERR, "Flow db lock acquire failed\n");
-		return -EINVAL;
-	}
 
 	rc = ulp_mapper_resources_free(ulp_ctx, flow_type, fid);
-	bnxt_ulp_cntxt_release_fdb_lock(ulp_ctx);
 	return rc;
-
 }
 
 /* Function to handle the default global templates that are allocated during
@@ -2795,8 +2789,7 @@ ulp_mapper_glb_template_table_init(struct bnxt_ulp_context *ulp_ctx)
  */
 int32_t
 ulp_mapper_flow_create(struct bnxt_ulp_context *ulp_ctx,
-		       struct bnxt_ulp_mapper_create_parms *cparms,
-		       uint32_t *flowid)
+		       struct bnxt_ulp_mapper_create_parms *cparms)
 {
 	struct bnxt_ulp_mapper_parms parms;
 	struct ulp_regfile regfile;
@@ -2821,6 +2814,7 @@ ulp_mapper_flow_create(struct bnxt_ulp_context *ulp_ctx,
 	parms.flow_type = cparms->flow_type;
 	parms.parent_flow = cparms->parent_flow;
 	parms.parent_fid = cparms->parent_fid;
+	parms.fid = cparms->flow_id;
 
 	/* Get the device id from the ulp context */
 	if (bnxt_ulp_cntxt_dev_id_get(ulp_ctx, &parms.dev_id)) {
@@ -2861,26 +2855,7 @@ ulp_mapper_flow_create(struct bnxt_ulp_context *ulp_ctx,
 		return -EINVAL;
 	}
 
-	/* Protect flow creation */
-	if (bnxt_ulp_cntxt_acquire_fdb_lock(ulp_ctx)) {
-		BNXT_TF_DBG(ERR, "Flow db lock acquire failed\n");
-		return -EINVAL;
-	}
-
-	/* Allocate a Flow ID for attaching all resources for the flow to.
-	 * Once allocated, all errors have to walk the list of resources and
-	 * free each of them.
-	 */
-	rc = ulp_flow_db_fid_alloc(ulp_ctx,
-				   parms.flow_type,
-				   cparms->func_id,
-				   &parms.fid);
-	if (rc) {
-		BNXT_TF_DBG(ERR, "Unable to allocate flow table entry\n");
-		bnxt_ulp_cntxt_release_fdb_lock(ulp_ctx);
-		return rc;
-	}
-
+	/* Process the action template list from the selected action table*/
 	if (parms.act_tid) {
 		parms.tmpl_type = BNXT_ULP_TEMPLATE_TYPE_ACTION;
 		/* Process the action template tables */
@@ -2911,13 +2886,9 @@ ulp_mapper_flow_create(struct bnxt_ulp_context *ulp_ctx,
 			goto flow_error;
 	}
 
-	*flowid = parms.fid;
-	bnxt_ulp_cntxt_release_fdb_lock(ulp_ctx);
-
 	return rc;
 
 flow_error:
-	bnxt_ulp_cntxt_release_fdb_lock(ulp_ctx);
 	/* Free all resources that were allocated during flow creation */
 	trc = ulp_mapper_flow_destroy(ulp_ctx, BNXT_ULP_FDB_TYPE_REGULAR,
 				      parms.fid);
drivers/net/bnxt/tf_ulp/ulp_mapper.h +2 -2
index 542e41e5a..0595d1555 100644
@@ -93,6 +93,7 @@ struct bnxt_ulp_mapper_create_parms {
 	uint32_t			dir_attr;
 	enum bnxt_ulp_fdb_type		flow_type;
 
+	uint32_t			flow_id;
 	/* if set then create it as a child flow with parent as parent_fid */
 	uint32_t			parent_fid;
 	/* if set then create a parent flow */
@@ -113,8 +114,7 @@ ulp_mapper_deinit(struct bnxt_ulp_context *ulp_ctx);
  */
 int32_t
 ulp_mapper_flow_create(struct bnxt_ulp_context	*ulp_ctx,
-		       struct bnxt_ulp_mapper_create_parms *parms,
-		       uint32_t *flowid);
+		       struct bnxt_ulp_mapper_create_parms *parms);
 
 /* Function that frees all resources associated with the flow. */
 int32_t
drivers/net/bnxt/tf_ulp/ulp_rte_parser.h +9 -0
index 41f3df998..bb5a8a477 100644
@@ -11,6 +11,7 @@
 #include <rte_flow_driver.h>
 #include "ulp_template_db_enum.h"
 #include "ulp_template_struct.h"
+#include "ulp_mapper.h"
 
 /* defines to be used in the tunnel header parsing */
 #define BNXT_ULP_ENCAP_IPV4_VER_HLEN_TOS	2
@@ -34,6 +35,14 @@
 #define	BNXT_ULP_PARSER_IPV6_TC			0x0ff00000
 #define	BNXT_ULP_PARSER_IPV6_FLOW_LABEL		0x000fffff
 
+void
+bnxt_ulp_init_mapper_params(struct bnxt_ulp_mapper_create_parms *mapper_cparms,
+			    struct ulp_rte_parser_params *params,
+			    uint32_t priority, uint32_t class_id,
+			    uint32_t act_tmpl, uint16_t func_id,
+			    uint32_t flow_id,
+			    enum bnxt_ulp_fdb_type flow_type);
+
 /* Function to handle the parsing of the RTE port id. */
 int32_t
 ulp_rte_parser_implicit_match_port_process(struct ulp_rte_parser_params *param);
Signature · 1 line
2.21.1 (Apple Git-122.3)
#29 lore raw

PATCH v2 10/11 net/bnxt: add support for VXLAN decap templates

In reply to Ajit Khaparde

From: Venkat Duvvuru <[email protected]>

Templates for outer tunnel & inner tunnel flow are added in this patch.

---
 drivers/net/bnxt/tf_ulp/ulp_rte_parser.c      |   10 +
 drivers/net/bnxt/tf_ulp/ulp_rte_parser.h      |    5 +
 .../net/bnxt/tf_ulp/ulp_template_db_class.c   |  962 ++++---
 .../net/bnxt/tf_ulp/ulp_template_db_enum.h    |   35 +-
 .../net/bnxt/tf_ulp/ulp_template_db_field.h   |  363 ++-
 .../tf_ulp/ulp_template_db_stingray_act.c     |  116 +-
 .../tf_ulp/ulp_template_db_stingray_class.c   | 2493 ++++++++++++++---
 drivers/net/bnxt/tf_ulp/ulp_template_db_tbl.c |    9 +-
 .../bnxt/tf_ulp/ulp_template_db_wh_plus_act.c |  116 +-
 .../tf_ulp/ulp_template_db_wh_plus_class.c    | 2489 +++++++++++++---
 10 files changed, 5127 insertions(+), 1471 deletions(-)
drivers/net/bnxt/tf_ulp/ulp_rte_parser.c +10 -0
index 770fec55c..42021ae8d 100644
@@ -2110,3 +2110,13 @@ ulp_rte_dec_ttl_act_handler(const struct rte_flow_action *act __rte_unused,
 	ULP_BITMAP_SET(params->act_bitmap.bits, BNXT_ULP_ACTION_BIT_DEC_TTL);
 	return BNXT_TF_RC_SUCCESS;
 }
+
+/* Function to handle the parsing of RTE Flow action JUMP */
+int32_t
+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);
+	return BNXT_TF_RC_SUCCESS;
+}
drivers/net/bnxt/tf_ulp/ulp_rte_parser.h +5 -0
index bb5a8a477..a71aabe5f 100644
@@ -233,4 +233,9 @@ int32_t
 ulp_rte_dec_ttl_act_handler(const struct rte_flow_action *action_item,
 			    struct ulp_rte_parser_params *params);
 
+/* Function to handle the parsing of RTE Flow action JUMP .*/
+int32_t
+ulp_rte_jump_act_handler(const struct rte_flow_action *action_item,
+			 struct ulp_rte_parser_params *params);
+
 #endif /* _ULP_RTE_PARSER_H_ */
drivers/net/bnxt/tf_ulp/ulp_template_db_class.c +645 -317

1,476 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_template_db_enum.h +30 -5
index 6dade9afd..10838f5cc 100644
@@ -11,7 +11,7 @@
 #define BNXT_ULP_LOG2_MAX_NUM_DEV 2
 #define BNXT_ULP_CACHE_TBL_MAX_SZ 4
 #define BNXT_ULP_CLASS_SIG_TBL_MAX_SZ 2048
-#define BNXT_ULP_CLASS_MATCH_LIST_MAX_SZ 201
+#define BNXT_ULP_CLASS_MATCH_LIST_MAX_SZ 217
 #define BNXT_ULP_CLASS_HID_LOW_PRIME 7919
 #define BNXT_ULP_CLASS_HID_HIGH_PRIME 7907
 #define BNXT_ULP_CLASS_HID_SHFTR 32
@@ -52,7 +52,8 @@ enum bnxt_ulp_action_bit {
 	BNXT_ULP_ACTION_BIT_SET_TP_SRC       = 0x0000000000100000,
 	BNXT_ULP_ACTION_BIT_SET_TP_DST       = 0x0000000000200000,
 	BNXT_ULP_ACTION_BIT_VXLAN_ENCAP      = 0x0000000000400000,
-	BNXT_ULP_ACTION_BIT_LAST             = 0x0000000000800000
+	BNXT_ULP_ACTION_BIT_JUMP             = 0x0000000000800000,
+	BNXT_ULP_ACTION_BIT_LAST             = 0x0000000001000000
 };
 
 enum bnxt_ulp_hdr_bit {
@@ -72,7 +73,8 @@ enum bnxt_ulp_hdr_bit {
 	BNXT_ULP_HDR_BIT_I_IPV6              = 0x0000000000002000,
 	BNXT_ULP_HDR_BIT_I_TCP               = 0x0000000000004000,
 	BNXT_ULP_HDR_BIT_I_UDP               = 0x0000000000008000,
-	BNXT_ULP_HDR_BIT_LAST                = 0x0000000000010000
+	BNXT_ULP_HDR_BIT_F1                  = 0x0000000000010000,
+	BNXT_ULP_HDR_BIT_LAST                = 0x0000000000020000
 };
 
 enum bnxt_ulp_act_type {
@@ -341,6 +343,10 @@ enum bnxt_ulp_resource_sub_type {
 enum bnxt_ulp_sym {
 	BNXT_ULP_SYM_PKT_TYPE_IGNORE = 0,
 	BNXT_ULP_SYM_PKT_TYPE_L2 = 0,
+	BNXT_ULP_SYM_PKT_TYPE_0_IGNORE = 0,
+	BNXT_ULP_SYM_PKT_TYPE_0_L2 = 0,
+	BNXT_ULP_SYM_PKT_TYPE_1_IGNORE = 0,
+	BNXT_ULP_SYM_PKT_TYPE_1_L2 = 0,
 	BNXT_ULP_SYM_RECYCLE_CNT_IGNORE = 0,
 	BNXT_ULP_SYM_RECYCLE_CNT_ZERO = 0,
 	BNXT_ULP_SYM_RECYCLE_CNT_ONE = 1,
@@ -551,7 +557,8 @@ enum bnxt_ulp_sym {
 	BNXT_ULP_SYM_IP_PROTO_UDP = 17,
 	BNXT_ULP_SYM_VF_FUNC_PARIF = 15,
 	BNXT_ULP_SYM_NO = 0,
-	BNXT_ULP_SYM_YES = 1
+	BNXT_ULP_SYM_YES = 1,
+	BNXT_ULP_SYM_RECYCLE_DST = 0x800
 };
 
 enum bnxt_ulp_wh_plus {
@@ -600,6 +607,7 @@ enum bnxt_ulp_act_prop_sz {
 	BNXT_ULP_ACT_PROP_SZ_ENCAP_IP_SRC = 16,
 	BNXT_ULP_ACT_PROP_SZ_ENCAP_UDP = 4,
 	BNXT_ULP_ACT_PROP_SZ_ENCAP_TUN = 32,
+	BNXT_ULP_ACT_PROP_SZ_JUMP = 4,
 	BNXT_ULP_ACT_PROP_SZ_LAST = 4
 };
 
@@ -644,7 +652,8 @@ enum bnxt_ulp_act_prop_idx {
 	BNXT_ULP_ACT_PROP_IDX_ENCAP_IP_SRC = 205,
 	BNXT_ULP_ACT_PROP_IDX_ENCAP_UDP = 221,
 	BNXT_ULP_ACT_PROP_IDX_ENCAP_TUN = 225,
-	BNXT_ULP_ACT_PROP_IDX_LAST = 257
+	BNXT_ULP_ACT_PROP_IDX_JUMP = 257,
+	BNXT_ULP_ACT_PROP_IDX_LAST = 261
 };
 
 enum bnxt_ulp_class_hid {
@@ -796,6 +805,22 @@ enum bnxt_ulp_class_hid {
 	BNXT_ULP_CLASS_HID_05b9 = 0x05b9,
 	BNXT_ULP_CLASS_HID_0371 = 0x0371,
 	BNXT_ULP_CLASS_HID_00e1 = 0x00e1,
+	BNXT_ULP_CLASS_HID_0000 = 0x0000,
+	BNXT_ULP_CLASS_HID_00ce = 0x00ce,
+	BNXT_ULP_CLASS_HID_01b6 = 0x01b6,
+	BNXT_ULP_CLASS_HID_0074 = 0x0074,
+	BNXT_ULP_CLASS_HID_00fe = 0x00fe,
+	BNXT_ULP_CLASS_HID_03bc = 0x03bc,
+	BNXT_ULP_CLASS_HID_0206 = 0x0206,
+	BNXT_ULP_CLASS_HID_02c4 = 0x02c4,
+	BNXT_ULP_CLASS_HID_055a = 0x055a,
+	BNXT_ULP_CLASS_HID_045a = 0x045a,
+	BNXT_ULP_CLASS_HID_061a = 0x061a,
+	BNXT_ULP_CLASS_HID_051a = 0x051a,
+	BNXT_ULP_CLASS_HID_074a = 0x074a,
+	BNXT_ULP_CLASS_HID_004e = 0x004e,
+	BNXT_ULP_CLASS_HID_040a = 0x040a,
+	BNXT_ULP_CLASS_HID_010e = 0x010e,
 	BNXT_ULP_CLASS_HID_048b = 0x048b,
 	BNXT_ULP_CLASS_HID_0749 = 0x0749,
 	BNXT_ULP_CLASS_HID_05f1 = 0x05f1,
drivers/net/bnxt/tf_ulp/ulp_template_db_field.h +263 -100

434 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_template_db_stingray_act.c +58 -58

319 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_template_db_stingray_class.c +2027 -466

666 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_template_db_tbl.c +6 -3
index 7f5a31680..c5f340d7b 100644

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

drivers/net/bnxt/tf_ulp/ulp_template_db_wh_plus_act.c +58 -58

116 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_template_db_wh_plus_class.c +2025 -464

2,489 lines not on this page · raw message

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

Signature · 1 line
2.21.1 (Apple Git-122.3)

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

#30 lore raw

PATCH v2 11/11 net/bnxt: add VXLAN decap offload support

In reply to Ajit Khaparde

From: Venkat Duvvuru <[email protected]>

VXLAN decap offload can happen in stages. The offload request may not come as a single flow request rather may come as two flow offload requests F1 & F2. This patch is adding support for this two stage offload design. The match criteria for F1 is O_DMAC, O_SMAC, O_DST_IP, O_UDP_DPORT and actions are COUNT, MARK, JUMP. The match criteria for F2 is O_SRC_IP, O_DST_IP, VNI and inner header fields. F1 and F2 flow offload requests can come in any order. If F2 flow offload request comes first then F2 can’t be offloaded as there is no O_DMAC information in F2. In this case, F2 will be deferred until F1 flow offload request arrives. When F1 flow offload request is received it will have O_DMAC information. Using F1’s O_DMAC, driver creates an L2 context entry in the hardware as part of offloading F1. F2 will now use F1’s O_DMAC to get the L2 context id associated with this O_DMAC and other flow fields that are cached already at the time of deferring F2 for offloading. F2s that arrive after F1 is offloaded will be directly programmed and not cached.

---
 doc/guides/nics/bnxt.rst                      |  18 +
 doc/guides/rel_notes/release_20_11.rst        |   1 +
 drivers/net/bnxt/meson.build                  |   1 +
 drivers/net/bnxt/tf_ulp/bnxt_tf_common.h      |   4 +-
 drivers/net/bnxt/tf_ulp/bnxt_ulp.c            |  10 +
 drivers/net/bnxt/tf_ulp/bnxt_ulp.h            |  12 +
 drivers/net/bnxt/tf_ulp/bnxt_ulp_flow.c       |  84 ++---
 drivers/net/bnxt/tf_ulp/ulp_flow_db.c         | 149 +++++++--
 drivers/net/bnxt/tf_ulp/ulp_flow_db.h         |   2 +
 drivers/net/bnxt/tf_ulp/ulp_mapper.c          |   1 +
 drivers/net/bnxt/tf_ulp/ulp_mapper.h          |   2 +
 drivers/net/bnxt/tf_ulp/ulp_rte_parser.c      |  75 ++++-
 drivers/net/bnxt/tf_ulp/ulp_rte_parser.h      |   4 +-
 .../net/bnxt/tf_ulp/ulp_template_db_enum.h    |   4 +-
 drivers/net/bnxt/tf_ulp/ulp_template_struct.h |   7 +
 drivers/net/bnxt/tf_ulp/ulp_tun.c             | 310 ++++++++++++++++++
 drivers/net/bnxt/tf_ulp/ulp_tun.h             |  92 ++++++
 17 files changed, 694 insertions(+), 82 deletions(-)
 create mode 100644 drivers/net/bnxt/tf_ulp/ulp_tun.c
 create mode 100644 drivers/net/bnxt/tf_ulp/ulp_tun.h
doc/guides/nics/bnxt.rst +18 -0
index 28973fc3e..eee10a3cd 100644
@@ -706,6 +706,24 @@ Notes
   flows to be directed to one or more queues associated with the VNIC id.
   This implementation is supported only when TRUFLOW functionality is disabled.
 
+- An application can issue a VXLAN decap offload request using rte_flow API
+  either as a single rte_flow request or a combination of two stages.
+  The PMD currently supports the two stage offload design.
+  In this approach the offload request may come as two flow offload requests
+  Flow1 & Flow2.  The match criteria for Flow1 is O_DMAC, O_SMAC, O_DST_IP,
+  O_UDP_DPORT and actions are COUNT, MARK, JUMP. The match criteria for Flow2
+  is O_SRC_IP, O_DST_IP, VNI and inner header fields.
+  Flow1 and Flow2 flow offload requests can come in any order. If Flow2 flow
+  offload request comes first then Flow2 can’t be offloaded as there is
+  no O_DMAC information in Flow2. In this case, Flow2 will be deferred until
+  Flow1 flow offload request arrives. When Flow1 flow offload request is
+  received it will have O_DMAC information. Using Flow1’s O_DMAC, driver
+  creates an L2 context entry in the hardware as part of offloading Flow1.
+  Flow2 will now use Flow1’s O_DMAC to get the L2 context id associated with
+  this O_DMAC and other flow fields that are cached already at the time
+  of deferring Flow2 for offloading. Flow2 that arrive after Flow1 is offloaded
+  will be directly programmed and not cached.
+
 Note: A VNIC represents a virtual interface in the hardware. It is a resource
 in the RX path of the chip and is used to setup various target actions such as
 RSS, MAC filtering etc. for the physical function in use.
doc/guides/rel_notes/release_20_11.rst +1 -0
index c8b284e3b..941ca2d9d 100644
@@ -148,6 +148,7 @@ New Features
   * Updated HWRM structures to 1.10.1.70 version.
   * Added TRUFLOW support for Stingray devices.
   * Added support for representors on MAIA cores of SR.
+  * Added support for VXLAN decap offload using rte_flow.
 
 * **Updated Cisco enic driver.**
 
drivers/net/bnxt/meson.build +1 -0
index 39521080f..bc74f88c6 100644
@@ -64,6 +64,7 @@ sources = files('bnxt_cpr.c',
 	'tf_ulp/ulp_port_db.c',
 	'tf_ulp/ulp_def_rules.c',
 	'tf_ulp/ulp_fc_mgr.c',
+	'tf_ulp/ulp_tun.c',
 	'tf_ulp/ulp_template_db_wh_plus_act.c',
 	'tf_ulp/ulp_template_db_wh_plus_class.c',
 	'tf_ulp/ulp_template_db_stingray_act.c',
drivers/net/bnxt/tf_ulp/bnxt_tf_common.h +3 -1
index f0633f009..b2629e47b 100644
@@ -33,7 +33,9 @@
 enum bnxt_tf_rc {
 	BNXT_TF_RC_PARSE_ERR	= -2,
 	BNXT_TF_RC_ERROR	= -1,
-	BNXT_TF_RC_SUCCESS	= 0
+	BNXT_TF_RC_SUCCESS	= 0,
+	BNXT_TF_RC_NORMAL	= 1,
+	BNXT_TF_RC_FID		= 2,
 };
 
 /* eth IPv4 Type */
drivers/net/bnxt/tf_ulp/bnxt_ulp.c +10 -0
index d753b5af9..26fd3009f 100644
@@ -1321,6 +1321,16 @@ bnxt_ulp_cntxt_ptr2_flow_db_get(struct bnxt_ulp_context	*ulp_ctx)
 	return ulp_ctx->cfg_data->flow_db;
 }
 
+/* Function to get the tunnel cache table info from the ulp context. */
+struct bnxt_tun_cache_entry *
+bnxt_ulp_cntxt_ptr2_tun_tbl_get(struct bnxt_ulp_context *ulp_ctx)
+{
+	if (!ulp_ctx || !ulp_ctx->cfg_data)
+		return NULL;
+
+	return ulp_ctx->cfg_data->tun_tbl;
+}
+
 /* Function to get the ulp context from eth device. */
 struct bnxt_ulp_context	*
 bnxt_ulp_eth_dev_ptr2_cntxt_get(struct rte_eth_dev	*dev)
drivers/net/bnxt/tf_ulp/bnxt_ulp.h +12 -0
index c2c5bcb1d..db1ee50c0 100644
@@ -13,6 +13,8 @@
 #include "rte_ethdev.h"
 
 #include "ulp_template_db_enum.h"
+#include "ulp_tun.h"
+#include "bnxt_tf_common.h"
 
 /* NAT defines to reuse existing inner L2 SMAC and DMAC */
 #define BNXT_ULP_NAT_INNER_L2_HEADER_SMAC	0x2000
@@ -55,6 +57,9 @@ struct bnxt_ulp_data {
 	struct bnxt_ulp_df_rule_info	df_rule_info[RTE_MAX_ETHPORTS];
 	struct bnxt_ulp_vfr_rule_info	vfr_rule_info[RTE_MAX_ETHPORTS];
 	enum bnxt_ulp_flow_mem_type	mem_type;
+#define	BNXT_ULP_TUN_ENTRY_INVALID	-1
+#define	BNXT_ULP_MAX_TUN_CACHE_ENTRIES	16
+	struct bnxt_tun_cache_entry	tun_tbl[BNXT_ULP_MAX_TUN_CACHE_ENTRIES];
 };
 
 struct bnxt_ulp_context {
@@ -151,6 +156,10 @@ bnxt_ulp_cntxt_ptr2_flow_db_set(struct bnxt_ulp_context	*ulp_ctx,
 struct bnxt_ulp_flow_db	*
 bnxt_ulp_cntxt_ptr2_flow_db_get(struct bnxt_ulp_context	*ulp_ctx);
 
+/* Function to get the tunnel cache table info from the ulp context. */
+struct bnxt_tun_cache_entry *
+bnxt_ulp_cntxt_ptr2_tun_tbl_get(struct bnxt_ulp_context	*ulp_ctx);
+
 /* Function to get the ulp context from eth device. */
 struct bnxt_ulp_context	*
 bnxt_ulp_eth_dev_ptr2_cntxt_get(struct rte_eth_dev *dev);
@@ -214,4 +223,7 @@ bnxt_ulp_cntxt_acquire_fdb_lock(struct bnxt_ulp_context	*ulp_ctx);
 void
 bnxt_ulp_cntxt_release_fdb_lock(struct bnxt_ulp_context	*ulp_ctx);
 
+int32_t
+ulp_post_process_tun_flow(struct ulp_rte_parser_params *params);
+
 #endif /* _BNXT_ULP_H_ */
drivers/net/bnxt/tf_ulp/bnxt_ulp_flow.c +44 -40

179 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_flow_db.c +120 -29

191 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_flow_db.h +2 -0
index 10e69bae4..f7dfd67be 100644
@@ -60,6 +60,8 @@ struct ulp_fdb_parent_info {
 	uint64_t	pkt_count;
 	uint64_t	byte_count;
 	uint64_t	*child_fid_bitset;
+	uint32_t	f2_cnt;
+	uint8_t		tun_idx;
 };
 
 /* Structure to maintain parent-child flow relationships */
drivers/net/bnxt/tf_ulp/ulp_mapper.c +1 -0
index d5c129b3a..29643232d 100644
@@ -2815,6 +2815,7 @@ ulp_mapper_flow_create(struct bnxt_ulp_context *ulp_ctx,
 	parms.parent_flow = cparms->parent_flow;
 	parms.parent_fid = cparms->parent_fid;
 	parms.fid = cparms->flow_id;
+	parms.tun_idx = cparms->tun_idx;
 
 	/* Get the device id from the ulp context */
 	if (bnxt_ulp_cntxt_dev_id_get(ulp_ctx, &parms.dev_id)) {
drivers/net/bnxt/tf_ulp/ulp_mapper.h +2 -0
index 0595d1555..9bd94f5c2 100644
@@ -78,6 +78,7 @@ struct bnxt_ulp_mapper_parms {
 	struct bnxt_ulp_device_params           *device_params;
 	uint32_t				parent_fid;
 	uint32_t				parent_flow;
+	uint8_t					tun_idx;
 };
 
 struct bnxt_ulp_mapper_create_parms {
@@ -98,6 +99,7 @@ struct bnxt_ulp_mapper_create_parms {
 	uint32_t			parent_fid;
 	/* if set then create a parent flow */
 	uint32_t			parent_flow;
+	uint8_t				tun_idx;
 };
 
 /* Function to initialize any dynamic mapper data. */
drivers/net/bnxt/tf_ulp/ulp_rte_parser.c +67 -8

138 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_rte_parser.h +1 -3
index a71aabe5f..799631790 100644
@@ -12,6 +12,7 @@
 #include "ulp_template_db_enum.h"
 #include "ulp_template_struct.h"
 #include "ulp_mapper.h"
+#include "bnxt_tf_common.h"
 
 /* defines to be used in the tunnel header parsing */
 #define BNXT_ULP_ENCAP_IPV4_VER_HLEN_TOS	2
@@ -38,9 +39,6 @@
 void
 bnxt_ulp_init_mapper_params(struct bnxt_ulp_mapper_create_parms *mapper_cparms,
 			    struct ulp_rte_parser_params *params,
-			    uint32_t priority, uint32_t class_id,
-			    uint32_t act_tmpl, uint16_t func_id,
-			    uint32_t flow_id,
 			    enum bnxt_ulp_fdb_type flow_type);
 
 /* Function to handle the parsing of the RTE port id. */
drivers/net/bnxt/tf_ulp/ulp_template_db_enum.h +3 -1
index 10838f5cc..6802debbb 100644
@@ -135,7 +135,9 @@ enum bnxt_ulp_cf_idx {
 	BNXT_ULP_CF_IDX_L4_HDR_CNT = 41,
 	BNXT_ULP_CF_IDX_VFR_MODE = 42,
 	BNXT_ULP_CF_IDX_LOOPBACK_PARIF = 43,
-	BNXT_ULP_CF_IDX_LAST = 44
+	BNXT_ULP_CF_IDX_L3_TUN = 44,
+	BNXT_ULP_CF_IDX_L3_TUN_DECAP = 45,
+	BNXT_ULP_CF_IDX_LAST = 46
 };
 
 enum bnxt_ulp_cond_opcode {
drivers/net/bnxt/tf_ulp/ulp_template_struct.h +7 -0
index 69bb61e11..9d690a937 100644
@@ -72,6 +72,13 @@ struct ulp_rte_parser_params {
 	struct ulp_rte_act_bitmap	act_bitmap;
 	struct ulp_rte_act_prop		act_prop;
 	uint32_t			dir_attr;
+	uint32_t			priority;
+	uint32_t			fid;
+	uint32_t			parent_flow;
+	uint32_t			parent_fid;
+	uint16_t			func_id;
+	uint32_t			class_id;
+	uint32_t			act_tmpl;
 	struct bnxt_ulp_context		*ulp_ctx;
 };
 
drivers/net/bnxt/tf_ulp/ulp_tun.c new file +310 -0

310 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_tun.h new file +92 -0

92 lines not on this page · raw message

Signature · 1 line
2.21.1 (Apple Git-122.3)
#31 lore raw

Re: [dpdk-dev] [PATCH v2 00/11] bnxt fixes and enhancements to TRUFLOW support

In reply to Ajit Khaparde
Quoted 8 lines · Ajit Khaparde

This patchset has support for VXLAN decap full offload, SR device support in tf_core and a few bug fixes.

v1->v2:
- Squashed some patches.
- Updated commit logs.
- Fixed a compilation issue reported during clang builds.

Fixed the checkpatch in [patch 2/14] warning during merge. Patchset applied to dpdk-next-net-brcm/for-next-net.

Quoted 87 lines

Farah Smith (1):
net/bnxt: add table scope to PF Mapping

Jay Ding (1):
net/bnxt: changes to support two table scopes

Kishore Padmanabha (2):
net/bnxt: add support for flow counter accumulation net/bnxt: add mapper support for wildcard TCAM

Peter Spreadborough (2):
net/bnxt: add stingray support to core layer
net/bnxt: update ULP resource counts

Somnath Kotur (2):
net/bnxt: fix infinite loop in flow query count
net/bnxt: change HWRM command to create reps

Venkat Duvvuru (3):
net/bnxt: refactor flow id allocation
net/bnxt: add support for VXLAN decap templates
net/bnxt: add VXLAN decap offload support

 doc/guides/nics/bnxt.rst                      |   18 +
 doc/guides/rel_notes/release_20_11.rst        |    2 +
 drivers/net/bnxt/bnxt.h                       |    6 +-
 drivers/net/bnxt/bnxt_ethdev.c                |    2 +
 drivers/net/bnxt/bnxt_hwrm.c                  |   60 +-
 drivers/net/bnxt/bnxt_hwrm.h                  |    2 -
 drivers/net/bnxt/bnxt_reps.c                  |   18 +-
 drivers/net/bnxt/hcapi/hcapi_cfa.h            |   39 +-
 drivers/net/bnxt/meson.build                  |    1 +
 drivers/net/bnxt/tf_core/cfa_resource_types.h |   95 +-
 drivers/net/bnxt/tf_core/tf_core.c            |   57 +-
 drivers/net/bnxt/tf_core/tf_core.h            |   57 +-
 drivers/net/bnxt/tf_core/tf_device.c          |    9 +-
 drivers/net/bnxt/tf_core/tf_device.h          |   47 +-
 drivers/net/bnxt/tf_core/tf_device_p4.c       |   69 +-
 drivers/net/bnxt/tf_core/tf_device_p4.h       |    6 +
 drivers/net/bnxt/tf_core/tf_device_p45.h      |  105 +
 drivers/net/bnxt/tf_core/tf_em.h              |   25 +-
 drivers/net/bnxt/tf_core/tf_em_common.c       |  176 +-
 drivers/net/bnxt/tf_core/tf_em_common.h       |   27 +-
 drivers/net/bnxt/tf_core/tf_em_host.c         |   31 +-
 drivers/net/bnxt/tf_core/tf_global_cfg.c      |    4 +-
 drivers/net/bnxt/tf_core/tf_global_cfg.h      |   42 +-
 drivers/net/bnxt/tf_core/tf_msg.c             |   13 +-
 drivers/net/bnxt/tf_core/tf_msg.h             |    4 +-
 drivers/net/bnxt/tf_core/tf_session.h         |   16 +-
 drivers/net/bnxt/tf_core/tf_tbl.h             |    3 +
 drivers/net/bnxt/tf_core/tfp.c                |   19 +
 drivers/net/bnxt/tf_core/tfp.h                |   16 +
 drivers/net/bnxt/tf_ulp/bnxt_tf_common.h      |    4 +-
 drivers/net/bnxt/tf_ulp/bnxt_ulp.c            |   50 +-
 drivers/net/bnxt/tf_ulp/bnxt_ulp.h            |   12 +
 drivers/net/bnxt/tf_ulp/bnxt_ulp_flow.c       |  129 +-
 drivers/net/bnxt/tf_ulp/ulp_def_rules.c       |   48 +-
 drivers/net/bnxt/tf_ulp/ulp_fc_mgr.c          |  133 +-
 drivers/net/bnxt/tf_ulp/ulp_fc_mgr.h          |   19 +
 drivers/net/bnxt/tf_ulp/ulp_flow_db.c         |  475 +++-
 drivers/net/bnxt/tf_ulp/ulp_flow_db.h         |   46 +
 drivers/net/bnxt/tf_ulp/ulp_mapper.c          |   83 +-
 drivers/net/bnxt/tf_ulp/ulp_mapper.h          |    6 +-
 drivers/net/bnxt/tf_ulp/ulp_rte_parser.c      |   85 +-
 drivers/net/bnxt/tf_ulp/ulp_rte_parser.h      |   12 +
 .../net/bnxt/tf_ulp/ulp_template_db_class.c   |  962 ++++---
 .../net/bnxt/tf_ulp/ulp_template_db_enum.h    |   42 +-
 .../net/bnxt/tf_ulp/ulp_template_db_field.h   |  363 ++-
 .../tf_ulp/ulp_template_db_stingray_act.c     |  116 +-
 .../tf_ulp/ulp_template_db_stingray_class.c   | 2493 ++++++++++++++---
 drivers/net/bnxt/tf_ulp/ulp_template_db_tbl.c |    9 +-
 .../bnxt/tf_ulp/ulp_template_db_wh_plus_act.c |  116 +-
 .../tf_ulp/ulp_template_db_wh_plus_class.c    | 2489 +++++++++++++---
 drivers/net/bnxt/tf_ulp/ulp_template_struct.h |    7 +
 drivers/net/bnxt/tf_ulp/ulp_tun.c             |  310 ++
 drivers/net/bnxt/tf_ulp/ulp_tun.h             |   92 +
 drivers/net/bnxt/tf_ulp/ulp_utils.c           |  125 +
 drivers/net/bnxt/tf_ulp/ulp_utils.h           |   48 +-
 55 files changed, 7206 insertions(+), 2037 deletions(-)
 create mode 100644 drivers/net/bnxt/tf_core/tf_device_p45.h
 create mode 100644 drivers/net/bnxt/tf_ulp/ulp_tun.c
 create mode 100644 drivers/net/bnxt/tf_ulp/ulp_tun.h

--
2.21.1 (Apple Git-122.3)

#32 lore raw

v3 cover bnxt fixes and enhancements to TRUFLOW support

In reply to Ajit Khaparde

This patchset has support for VXLAN decap full offload, SR device support in tf_core and a few bug fixes.

v1->v2:
- Squashed some patches.
- Updated commit logs.
- Fixed a compilation issue reported during clang builds.

v2->v3:
- Added the SPDX header for cfa_resource_types.h in patch [01/11].
- Update commit logs.

Farah Smith (1):
net/bnxt: add table scope to PF Mapping

Jay Ding (1):
net/bnxt: changes to support two table scopes

Kishore Padmanabha (2):
net/bnxt: add support for flow counter accumulation net/bnxt: add mapper support for wildcard TCAM

Peter Spreadborough (2):
net/bnxt: add stingray support to core layer
net/bnxt: update ULP resource counts

Somnath Kotur (2):
net/bnxt: fix infinite loop in flow query count
net/bnxt: change HWRM command to create reps

Venkat Duvvuru (3):
net/bnxt: refactor flow id allocation
net/bnxt: add support for VXLAN decap templates
net/bnxt: add VXLAN decap offload support

 doc/guides/nics/bnxt.rst                      |   18 +
 doc/guides/rel_notes/release_20_11.rst        |    2 +
 drivers/net/bnxt/bnxt.h                       |    6 +-
 drivers/net/bnxt/bnxt_ethdev.c                |    2 +
 drivers/net/bnxt/bnxt_hwrm.c                  |   60 +-
 drivers/net/bnxt/bnxt_hwrm.h                  |    2 -
 drivers/net/bnxt/bnxt_reps.c                  |   18 +-
 drivers/net/bnxt/hcapi/hcapi_cfa.h            |   39 +-
 drivers/net/bnxt/meson.build                  |    1 +
 drivers/net/bnxt/tf_core/cfa_resource_types.h |   84 +-
 drivers/net/bnxt/tf_core/tf_core.c            |   57 +-
 drivers/net/bnxt/tf_core/tf_core.h            |   57 +-
 drivers/net/bnxt/tf_core/tf_device.c          |    9 +-
 drivers/net/bnxt/tf_core/tf_device.h          |   47 +-
 drivers/net/bnxt/tf_core/tf_device_p4.c       |   69 +-
 drivers/net/bnxt/tf_core/tf_device_p4.h       |    6 +
 drivers/net/bnxt/tf_core/tf_device_p45.h      |  105 +
 drivers/net/bnxt/tf_core/tf_em.h              |   25 +-
 drivers/net/bnxt/tf_core/tf_em_common.c       |  176 +-
 drivers/net/bnxt/tf_core/tf_em_common.h       |   27 +-
 drivers/net/bnxt/tf_core/tf_em_host.c         |   31 +-
 drivers/net/bnxt/tf_core/tf_global_cfg.c      |    4 +-
 drivers/net/bnxt/tf_core/tf_global_cfg.h      |   42 +-
 drivers/net/bnxt/tf_core/tf_msg.c             |   13 +-
 drivers/net/bnxt/tf_core/tf_msg.h             |    4 +-
 drivers/net/bnxt/tf_core/tf_session.h         |   16 +-
 drivers/net/bnxt/tf_core/tf_tbl.h             |    3 +
 drivers/net/bnxt/tf_core/tfp.c                |   19 +
 drivers/net/bnxt/tf_core/tfp.h                |   16 +
 drivers/net/bnxt/tf_ulp/bnxt_tf_common.h      |    4 +-
 drivers/net/bnxt/tf_ulp/bnxt_ulp.c            |   50 +-
 drivers/net/bnxt/tf_ulp/bnxt_ulp.h            |   12 +
 drivers/net/bnxt/tf_ulp/bnxt_ulp_flow.c       |  129 +-
 drivers/net/bnxt/tf_ulp/ulp_def_rules.c       |   48 +-
 drivers/net/bnxt/tf_ulp/ulp_fc_mgr.c          |  133 +-
 drivers/net/bnxt/tf_ulp/ulp_fc_mgr.h          |   19 +
 drivers/net/bnxt/tf_ulp/ulp_flow_db.c         |  475 +++-
 drivers/net/bnxt/tf_ulp/ulp_flow_db.h         |   46 +
 drivers/net/bnxt/tf_ulp/ulp_mapper.c          |   83 +-
 drivers/net/bnxt/tf_ulp/ulp_mapper.h          |    6 +-
 drivers/net/bnxt/tf_ulp/ulp_rte_parser.c      |   85 +-
 drivers/net/bnxt/tf_ulp/ulp_rte_parser.h      |   12 +
 .../net/bnxt/tf_ulp/ulp_template_db_class.c   |  962 ++++---
 .../net/bnxt/tf_ulp/ulp_template_db_enum.h    |   42 +-
 .../net/bnxt/tf_ulp/ulp_template_db_field.h   |  363 ++-
 .../tf_ulp/ulp_template_db_stingray_act.c     |  116 +-
 .../tf_ulp/ulp_template_db_stingray_class.c   | 2493 ++++++++++++++---
 drivers/net/bnxt/tf_ulp/ulp_template_db_tbl.c |    9 +-
 .../bnxt/tf_ulp/ulp_template_db_wh_plus_act.c |  116 +-
 .../tf_ulp/ulp_template_db_wh_plus_class.c    | 2489 +++++++++++++---
 drivers/net/bnxt/tf_ulp/ulp_template_struct.h |    7 +
 drivers/net/bnxt/tf_ulp/ulp_tun.c             |  310 ++
 drivers/net/bnxt/tf_ulp/ulp_tun.h             |   92 +
 drivers/net/bnxt/tf_ulp/ulp_utils.c           |  125 +
 drivers/net/bnxt/tf_ulp/ulp_utils.h           |   48 +-
 55 files changed, 7197 insertions(+), 2035 deletions(-)
 create mode 100644 drivers/net/bnxt/tf_core/tf_device_p45.h
 create mode 100644 drivers/net/bnxt/tf_ulp/ulp_tun.c
 create mode 100644 drivers/net/bnxt/tf_ulp/ulp_tun.h
Signature · 1 line
2.21.1 (Apple Git-122.3)
#33 lore raw

Re: [dpdk-dev] [PATCH v3 00/11] bnxt fixes and enhancements to TRUFLOW support

Quoted 4 lines · Ajit Khaparde

This patchset has support for VXLAN decap full offload, SR device support in tf_core and a few bug fixes.

Quoted 8 lines

v1->v2:
- Squashed some patches.
- Updated commit logs.
- Fixed a compilation issue reported during clang builds.

v2->v3:
- Added the SPDX header for cfa_resource_types.h in patch [01/11].
- Update commit logs.

Patchset applied to dpdk-next-net-brcm.
For some reason, the set did not go out as a series.

Quoted 87 lines

Farah Smith (1):
net/bnxt: add table scope to PF Mapping

Jay Ding (1):
net/bnxt: changes to support two table scopes

Kishore Padmanabha (2):
net/bnxt: add support for flow counter accumulation net/bnxt: add mapper support for wildcard TCAM

Peter Spreadborough (2):
net/bnxt: add stingray support to core layer
net/bnxt: update ULP resource counts

Somnath Kotur (2):
net/bnxt: fix infinite loop in flow query count
net/bnxt: change HWRM command to create reps

Venkat Duvvuru (3):
net/bnxt: refactor flow id allocation
net/bnxt: add support for VXLAN decap templates
net/bnxt: add VXLAN decap offload support

 doc/guides/nics/bnxt.rst                      |   18 +
 doc/guides/rel_notes/release_20_11.rst        |    2 +
 drivers/net/bnxt/bnxt.h                       |    6 +-
 drivers/net/bnxt/bnxt_ethdev.c                |    2 +
 drivers/net/bnxt/bnxt_hwrm.c                  |   60 +-
 drivers/net/bnxt/bnxt_hwrm.h                  |    2 -
 drivers/net/bnxt/bnxt_reps.c                  |   18 +-
 drivers/net/bnxt/hcapi/hcapi_cfa.h            |   39 +-
 drivers/net/bnxt/meson.build                  |    1 +
 drivers/net/bnxt/tf_core/cfa_resource_types.h |   84 +-
 drivers/net/bnxt/tf_core/tf_core.c            |   57 +-
 drivers/net/bnxt/tf_core/tf_core.h            |   57 +-
 drivers/net/bnxt/tf_core/tf_device.c          |    9 +-
 drivers/net/bnxt/tf_core/tf_device.h          |   47 +-
 drivers/net/bnxt/tf_core/tf_device_p4.c       |   69 +-
 drivers/net/bnxt/tf_core/tf_device_p4.h       |    6 +
 drivers/net/bnxt/tf_core/tf_device_p45.h      |  105 +
 drivers/net/bnxt/tf_core/tf_em.h              |   25 +-
 drivers/net/bnxt/tf_core/tf_em_common.c       |  176 +-
 drivers/net/bnxt/tf_core/tf_em_common.h       |   27 +-
 drivers/net/bnxt/tf_core/tf_em_host.c         |   31 +-
 drivers/net/bnxt/tf_core/tf_global_cfg.c      |    4 +-
 drivers/net/bnxt/tf_core/tf_global_cfg.h      |   42 +-
 drivers/net/bnxt/tf_core/tf_msg.c             |   13 +-
 drivers/net/bnxt/tf_core/tf_msg.h             |    4 +-
 drivers/net/bnxt/tf_core/tf_session.h         |   16 +-
 drivers/net/bnxt/tf_core/tf_tbl.h             |    3 +
 drivers/net/bnxt/tf_core/tfp.c                |   19 +
 drivers/net/bnxt/tf_core/tfp.h                |   16 +
 drivers/net/bnxt/tf_ulp/bnxt_tf_common.h      |    4 +-
 drivers/net/bnxt/tf_ulp/bnxt_ulp.c            |   50 +-
 drivers/net/bnxt/tf_ulp/bnxt_ulp.h            |   12 +
 drivers/net/bnxt/tf_ulp/bnxt_ulp_flow.c       |  129 +-
 drivers/net/bnxt/tf_ulp/ulp_def_rules.c       |   48 +-
 drivers/net/bnxt/tf_ulp/ulp_fc_mgr.c          |  133 +-
 drivers/net/bnxt/tf_ulp/ulp_fc_mgr.h          |   19 +
 drivers/net/bnxt/tf_ulp/ulp_flow_db.c         |  475 +++-
 drivers/net/bnxt/tf_ulp/ulp_flow_db.h         |   46 +
 drivers/net/bnxt/tf_ulp/ulp_mapper.c          |   83 +-
 drivers/net/bnxt/tf_ulp/ulp_mapper.h          |    6 +-
 drivers/net/bnxt/tf_ulp/ulp_rte_parser.c      |   85 +-
 drivers/net/bnxt/tf_ulp/ulp_rte_parser.h      |   12 +
 .../net/bnxt/tf_ulp/ulp_template_db_class.c   |  962 ++++---
 .../net/bnxt/tf_ulp/ulp_template_db_enum.h    |   42 +-
 .../net/bnxt/tf_ulp/ulp_template_db_field.h   |  363 ++-
 .../tf_ulp/ulp_template_db_stingray_act.c     |  116 +-
 .../tf_ulp/ulp_template_db_stingray_class.c   | 2493 ++++++++++++++---
 drivers/net/bnxt/tf_ulp/ulp_template_db_tbl.c |    9 +-
 .../bnxt/tf_ulp/ulp_template_db_wh_plus_act.c |  116 +-
 .../tf_ulp/ulp_template_db_wh_plus_class.c    | 2489 +++++++++++++---
 drivers/net/bnxt/tf_ulp/ulp_template_struct.h |    7 +
 drivers/net/bnxt/tf_ulp/ulp_tun.c             |  310 ++
 drivers/net/bnxt/tf_ulp/ulp_tun.h             |   92 +
 drivers/net/bnxt/tf_ulp/ulp_utils.c           |  125 +
 drivers/net/bnxt/tf_ulp/ulp_utils.h           |   48 +-
 55 files changed, 7197 insertions(+), 2035 deletions(-)
 create mode 100644 drivers/net/bnxt/tf_core/tf_device_p45.h
 create mode 100644 drivers/net/bnxt/tf_ulp/ulp_tun.c
 create mode 100644 drivers/net/bnxt/tf_ulp/ulp_tun.h

--
2.21.1 (Apple Git-122.3)

#34 lore raw

v4 cover bnxt fixes and enhancements

This patchset has support for VXLAN decap full offload, SR device support in tf_core and a few bug fixes.

v1->v2:
- Squashed some patches.
- Updated commit logs.
- Fixed a compilation issue reported during clang builds.

v2->v3:
- Added the SPDX header for cfa_resource_types.h in patch [01/11].
- Update commit logs.

v3->v4:
- Addressed review comments.
- Added verbose commit messages.

Ajit Khaparde (3):
net/bnxt: increase the size of Rx CQ
net/bnxt: fix to reset mbuf data offset
net/bnxt: set thread safe flow ops flag

Farah Smith (1):
net/bnxt: add table scope to PF Mapping

Jay Ding (1):
net/bnxt: support two table scopes

Kishore Padmanabha (2):
net/bnxt: add hierarchical flow counters
net/bnxt: add mapper support for wildcard TCAM

Peter Spreadborough (2):
net/bnxt: add stingray support to core layer
net/bnxt: update ULP resource counts

Rahul Gupta (1):
net/bnxt: fix Rx performance by removing spinlock

Somnath Kotur (2):
net/bnxt: fix flow query count
net/bnxt: modify HWRM command to create reps

Venkat Duvvuru (3):
net/bnxt: refactor flow id allocation
net/bnxt: add VXLAN decap templates
net/bnxt: add VXLAN decap offload support

 doc/guides/nics/bnxt.rst                      |   20 +
 doc/guides/rel_notes/release_20_11.rst        |    3 +
 drivers/net/bnxt/bnxt.h                       |   10 +-
 drivers/net/bnxt/bnxt_cpr.c                   |   12 +
 drivers/net/bnxt/bnxt_cpr.h                   |    1 +
 drivers/net/bnxt/bnxt_ethdev.c                |    8 +
 drivers/net/bnxt/bnxt_hwrm.c                  |   60 +-
 drivers/net/bnxt/bnxt_hwrm.h                  |    2 -
 drivers/net/bnxt/bnxt_reps.c                  |   18 +-
 drivers/net/bnxt/bnxt_ring.h                  |    2 +-
 drivers/net/bnxt/bnxt_rxq.c                   |    4 -
 drivers/net/bnxt/bnxt_rxq.h                   |    3 -
 drivers/net/bnxt/bnxt_rxr.c                   |    6 +-
 drivers/net/bnxt/bnxt_rxr.h                   |    2 -
 drivers/net/bnxt/bnxt_txr.h                   |    2 -
 drivers/net/bnxt/hcapi/hcapi_cfa.h            |   39 +-
 drivers/net/bnxt/meson.build                  |    1 +
 drivers/net/bnxt/tf_core/cfa_resource_types.h |   82 +-
 drivers/net/bnxt/tf_core/tf_core.c            |   57 +-
 drivers/net/bnxt/tf_core/tf_core.h            |   57 +-
 drivers/net/bnxt/tf_core/tf_device.c          |    9 +-
 drivers/net/bnxt/tf_core/tf_device.h          |   47 +-
 drivers/net/bnxt/tf_core/tf_device_p4.c       |   69 +-
 drivers/net/bnxt/tf_core/tf_device_p4.h       |    6 +
 drivers/net/bnxt/tf_core/tf_device_p45.h      |  105 +
 drivers/net/bnxt/tf_core/tf_em.h              |   25 +-
 drivers/net/bnxt/tf_core/tf_em_common.c       |  176 +-
 drivers/net/bnxt/tf_core/tf_em_common.h       |   27 +-
 drivers/net/bnxt/tf_core/tf_em_host.c         |   31 +-
 drivers/net/bnxt/tf_core/tf_global_cfg.c      |    4 +-
 drivers/net/bnxt/tf_core/tf_global_cfg.h      |   42 +-
 drivers/net/bnxt/tf_core/tf_msg.c             |   13 +-
 drivers/net/bnxt/tf_core/tf_msg.h             |    4 +-
 drivers/net/bnxt/tf_core/tf_session.h         |   16 +-
 drivers/net/bnxt/tf_core/tf_tbl.h             |    3 +
 drivers/net/bnxt/tf_core/tfp.c                |   19 +
 drivers/net/bnxt/tf_core/tfp.h                |   16 +
 drivers/net/bnxt/tf_ulp/bnxt_tf_common.h      |    4 +-
 drivers/net/bnxt/tf_ulp/bnxt_ulp.c            |   50 +-
 drivers/net/bnxt/tf_ulp/bnxt_ulp.h            |   12 +
 drivers/net/bnxt/tf_ulp/bnxt_ulp_flow.c       |  129 +-
 drivers/net/bnxt/tf_ulp/ulp_def_rules.c       |   48 +-
 drivers/net/bnxt/tf_ulp/ulp_fc_mgr.c          |  133 +-
 drivers/net/bnxt/tf_ulp/ulp_fc_mgr.h          |   19 +
 drivers/net/bnxt/tf_ulp/ulp_flow_db.c         |  475 +++-
 drivers/net/bnxt/tf_ulp/ulp_flow_db.h         |   46 +
 drivers/net/bnxt/tf_ulp/ulp_mapper.c          |   83 +-
 drivers/net/bnxt/tf_ulp/ulp_mapper.h          |    6 +-
 drivers/net/bnxt/tf_ulp/ulp_rte_parser.c      |   85 +-
 drivers/net/bnxt/tf_ulp/ulp_rte_parser.h      |   12 +
 .../net/bnxt/tf_ulp/ulp_template_db_class.c   |  962 ++++---
 .../net/bnxt/tf_ulp/ulp_template_db_enum.h    |   42 +-
 .../net/bnxt/tf_ulp/ulp_template_db_field.h   |  363 ++-
 .../tf_ulp/ulp_template_db_stingray_act.c     |  116 +-
 .../tf_ulp/ulp_template_db_stingray_class.c   | 2493 ++++++++++++++---
 drivers/net/bnxt/tf_ulp/ulp_template_db_tbl.c |    9 +-
 .../bnxt/tf_ulp/ulp_template_db_wh_plus_act.c |  116 +-
 .../tf_ulp/ulp_template_db_wh_plus_class.c    | 2489 +++++++++++++---
 drivers/net/bnxt/tf_ulp/ulp_template_struct.h |    7 +
 drivers/net/bnxt/tf_ulp/ulp_tun.c             |  310 ++
 drivers/net/bnxt/tf_ulp/ulp_tun.h             |   92 +
 drivers/net/bnxt/tf_ulp/ulp_utils.c           |  125 +
 drivers/net/bnxt/tf_ulp/ulp_utils.h           |   48 +-
 63 files changed, 7225 insertions(+), 2050 deletions(-)
 create mode 100644 drivers/net/bnxt/tf_core/tf_device_p45.h
 create mode 100644 drivers/net/bnxt/tf_ulp/ulp_tun.c
 create mode 100644 drivers/net/bnxt/tf_ulp/ulp_tun.h
Signature · 1 line
2.21.1 (Apple Git-122.3)
#35 lore raw

PATCH v4 1/15 net/bnxt: add stingray support to core layer

From: Peter Spreadborough <[email protected]>

- Moved P4 chip specific code under the P4 directory
- Added P45 skeleton code for SR to build on
- Add SR support in TRUFLOW core layer.
The TRUFLOW core or the tf-core is a shim layer which communicates with the CFA block in the hardware.

---
 drivers/net/bnxt/hcapi/hcapi_cfa.h            |  39 +++++--
 drivers/net/bnxt/tf_core/cfa_resource_types.h |  82 +++++---------
 drivers/net/bnxt/tf_core/tf_core.c            |   3 +-
 drivers/net/bnxt/tf_core/tf_core.h            |   2 +-
 drivers/net/bnxt/tf_core/tf_device.c          |   9 +-
 drivers/net/bnxt/tf_core/tf_device_p4.c       |  25 ++++-
 drivers/net/bnxt/tf_core/tf_device_p4.h       |   6 +
 drivers/net/bnxt/tf_core/tf_device_p45.h      | 105 ++++++++++++++++++
 drivers/net/bnxt/tf_core/tf_em.h              |   6 -
 9 files changed, 197 insertions(+), 80 deletions(-)
 create mode 100644 drivers/net/bnxt/tf_core/tf_device_p45.h
drivers/net/bnxt/hcapi/hcapi_cfa.h +29 -10
index c7d87dec73..aa218d714d 100644
@@ -14,7 +14,15 @@
 
 #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
@@ -81,17 +89,20 @@ struct hcapi_cfa_key_result {
 /* common CFA register access macros */
 #define CFA_REG(x)		OFFSETOF(cfa_reg_t, cfa_##x)
 
-#ifndef REG_WR
-#define REG_WR(_p, x, y)  (*((uint32_t volatile *)(x)) = (y))
+#ifndef TF_REG_WR
+#define TF_REG_WR(_p, x, y)  (*((uint32_t volatile *)(x)) = (y))
 #endif
-#ifndef REG_RD
-#define REG_RD(_p, x)  (*((uint32_t volatile *)(x)))
+#ifndef TF_REG_RD
+#define TF_REG_RD(_p, x)  (*((uint32_t volatile *)(x)))
+#endif
+#ifndef TF_CFA_REG_RD
+#define TF_CFA_REG_RD(_p, x)	\
+	TF_REG_RD(0, (uint32_t)(_p)->base_addr + CFA_REG(x))
+#endif
+#ifndef TF_CFA_REG_WR
+#define TF_CFA_REG_WR(_p, x, y)	\
+	TF_REG_WR(0, (uint32_t)(_p)->base_addr + CFA_REG(x), y)
 #endif
-#define CFA_REG_RD(_p, x)	\
-	REG_RD(0, (uint32_t)(_p)->base_addr + CFA_REG(x))
-#define CFA_REG_WR(_p, x, y)	\
-	REG_WR(0, (uint32_t)(_p)->base_addr + CFA_REG(x), y)
-
 
 /* Constants used by Resource Manager Registration*/
 #define RM_CLIENT_NAME_MAX_LEN          32
@@ -248,7 +259,15 @@ int hcapi_cfa_p4_mirror_hwop(struct hcapi_cfa_hwop *op,
 int hcapi_cfa_p4_global_cfg_hwop(struct hcapi_cfa_hwop *op,
 				 uint32_t type,
 				 struct hcapi_cfa_data *config);
-#endif /* SUPPORT_CFA_HW_P4 */
+/* 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
drivers/net/bnxt/tf_core/cfa_resource_types.h +25 -57

104 lines not on this page · raw message

drivers/net/bnxt/tf_core/tf_core.c +2 -1
index 0dbde1de2d..788335b814 100644
@@ -34,7 +34,8 @@ tf_open_session(struct tf *tfp,
 	 * side. It is assumed that the Firmware will be supported if
 	 * firmware open session succeeds.
 	 */
-	if (parms->device_type != TF_DEVICE_TYPE_WH) {
+	if (parms->device_type != TF_DEVICE_TYPE_WH &&
+	    parms->device_type != TF_DEVICE_TYPE_SR) {
 		TFP_DRV_LOG(ERR,
 			    "Unsupported device type %d\n",
 			    parms->device_type);
drivers/net/bnxt/tf_core/tf_core.h +1 -1
index db1093515c..65be8f54a4 100644
@@ -10,7 +10,7 @@
 #include <stdlib.h>
 #include <stdbool.h>
 #include <stdio.h>
-#include "hcapi/hcapi_cfa.h"
+#include "hcapi/hcapi_cfa_defs.h"
 #include "tf_project.h"
 
 /**
drivers/net/bnxt/tf_core/tf_device.c +7 -2
index 1129440955..8389828018 100644
@@ -47,7 +47,6 @@ tf_dev_bind_p4(struct tf *tfp,
 	struct tf_if_tbl_cfg_parms if_tbl_cfg;
 	struct tf_global_cfg_cfg_parms global_cfg;
 
-	dev_handle->type = TF_DEVICE_TYPE_WH;
 	/* Initial function initialization */
 	dev_handle->ops = &tf_dev_ops_p4_init;
 
@@ -90,7 +89,10 @@ tf_dev_bind_p4(struct tf *tfp,
 	 * EEM
 	 */
 	em_cfg.num_elements = TF_EM_TBL_TYPE_MAX;
-	em_cfg.cfg = tf_em_ext_p4;
+	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);
@@ -241,6 +243,8 @@ tf_dev_bind(struct tf *tfp __rte_unused,
 {
 	switch (type) {
 	case TF_DEVICE_TYPE_WH:
+	case TF_DEVICE_TYPE_SR:
+		dev_handle->type = type;
 		return tf_dev_bind_p4(tfp,
 				      shadow_copy,
 				      resources,
@@ -258,6 +262,7 @@ tf_dev_unbind(struct tf *tfp,
 {
 	switch (dev_handle->type) {
 	case TF_DEVICE_TYPE_WH:
+	case TF_DEVICE_TYPE_SR:
 		return tf_dev_unbind_p4(tfp);
 	default:
 		TFP_DRV_LOG(ERR,
drivers/net/bnxt/tf_core/tf_device_p4.c +22 -3
index fe8dec3af7..0344565d72 100644
@@ -28,13 +28,32 @@
  *   - (-EINVAL) on failure.
  */
 static int
-tf_dev_p4_get_max_types(struct tf *tfp __rte_unused,
+tf_dev_p4_get_max_types(struct tf *tfp,
 			uint16_t *max_types)
 {
-	if (max_types == NULL)
+	struct tf_session *tfs;
+	struct tf_dev_info *dev;
+	int rc;
+
+	if (max_types == NULL || tfp == NULL)
 		return -EINVAL;
 
-	*max_types = CFA_RESOURCE_TYPE_P4_LAST + 1;
+	/* 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;
 
 	return 0;
 }
drivers/net/bnxt/tf_core/tf_device_p4.h +6 -0
index 7e58469a09..aba28fe5f6 100644
@@ -83,6 +83,12 @@ struct tf_rm_element_cfg tf_em_ext_p4[TF_EM_TBL_TYPE_MAX] = {
 	{ TF_RM_ELEM_CFG_HCAPI_BA, CFA_RESOURCE_TYPE_P4_TBL_SCOPE },
 };
 
+struct tf_rm_element_cfg tf_em_ext_p45[TF_EM_TBL_TYPE_MAX] = {
+	/* CFA_RESOURCE_TYPE_P4_EM_REC */
+	{ TF_RM_ELEM_CFG_NULL, CFA_RESOURCE_TYPE_INVALID },
+	{ TF_RM_ELEM_CFG_HCAPI_BA, CFA_RESOURCE_TYPE_P45_TBL_SCOPE },
+};
+
 struct tf_rm_element_cfg tf_em_int_p4[TF_EM_TBL_TYPE_MAX] = {
 	{ TF_RM_ELEM_CFG_HCAPI, CFA_RESOURCE_TYPE_P4_EM_REC },
 	/* CFA_RESOURCE_TYPE_P4_TBL_SCOPE */
drivers/net/bnxt/tf_core/tf_device_p45.h new file +105 -0

105 lines not on this page · raw message

drivers/net/bnxt/tf_core/tf_em.h +0 -6
index 2a67e47607..51b08138ea 100644
@@ -9,12 +9,6 @@
 #include "tf_core.h"
 #include "tf_session.h"
 
-
-#define SUPPORT_CFA_HW_P4 1
-#define SUPPORT_CFA_HW_P58 0
-#define SUPPORT_CFA_HW_P59 0
-#define SUPPORT_CFA_HW_ALL 0
-
 #include "hcapi/hcapi_cfa_defs.h"
 
 #define TF_EM_MIN_ENTRIES     (1 << 15) /* 32K */
Signature · 1 line
2.21.1 (Apple Git-122.3)
#36 lore raw

PATCH v4 2/15 net/bnxt: support two table scopes

In reply to Ajit Khaparde

From: Jay Ding <[email protected]>

Adding support for two table scopes. One for Exact Match tables and other for External Exact Match tables.
New API to map a PARIF to an EEM table scope (set of Rx and Tx EEM base addresses). It uses HWRM_TF_GLOBAL_CFG_SET HWRM to configure. PARIF is handler to a partition of the physical port. Adjustments to tf_global_cfg_set() to reduce overhead and nominal name clarification.

---
 drivers/net/bnxt/tf_core/tf_core.c       |  54 +++++--
 drivers/net/bnxt/tf_core/tf_core.h       |  55 ++++++-
 drivers/net/bnxt/tf_core/tf_device.h     |  43 +++++-
 drivers/net/bnxt/tf_core/tf_device_p4.c  |  44 ++++++
 drivers/net/bnxt/tf_core/tf_em.h         |  19 ++-
 drivers/net/bnxt/tf_core/tf_em_common.c  | 174 ++++++++++++-----------
 drivers/net/bnxt/tf_core/tf_em_common.h  |  27 +---
 drivers/net/bnxt/tf_core/tf_em_host.c    |  23 ++-
 drivers/net/bnxt/tf_core/tf_global_cfg.c |   4 +-
 drivers/net/bnxt/tf_core/tf_global_cfg.h |  42 ++----
 drivers/net/bnxt/tf_core/tf_msg.c        |  13 +-
 drivers/net/bnxt/tf_core/tf_msg.h        |   4 +-
 12 files changed, 326 insertions(+), 176 deletions(-)
drivers/net/bnxt/tf_core/tf_core.c +40 -14
index 788335b814..0f49a00256 100644
@@ -303,7 +303,6 @@ int tf_get_global_cfg(struct tf *tfp,
 	int rc = 0;
 	struct tf_session *tfs;
 	struct tf_dev_info *dev;
-	struct tf_dev_global_cfg_parms gparms = { 0 };
 
 	TF_CHECK_PARMS2(tfp, parms);
 
@@ -342,12 +341,7 @@ int tf_get_global_cfg(struct tf *tfp,
 		return -EOPNOTSUPP;
 	}
 
-	gparms.dir = parms->dir;
-	gparms.type = parms->type;
-	gparms.offset = parms->offset;
-	gparms.config = parms->config;
-	gparms.config_sz_in_bytes = parms->config_sz_in_bytes;
-	rc = dev->ops->tf_dev_get_global_cfg(tfp, &gparms);
+	rc = dev->ops->tf_dev_get_global_cfg(tfp, parms);
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "%s: Global Cfg get failed, rc:%s\n",
@@ -371,7 +365,6 @@ int tf_set_global_cfg(struct tf *tfp,
 	int rc = 0;
 	struct tf_session *tfs;
 	struct tf_dev_info *dev;
-	struct tf_dev_global_cfg_parms gparms = { 0 };
 
 	TF_CHECK_PARMS2(tfp, parms);
 
@@ -410,12 +403,7 @@ int tf_set_global_cfg(struct tf *tfp,
 		return -EOPNOTSUPP;
 	}
 
-	gparms.dir = parms->dir;
-	gparms.type = parms->type;
-	gparms.offset = parms->offset;
-	gparms.config = parms->config;
-	gparms.config_sz_in_bytes = parms->config_sz_in_bytes;
-	rc = dev->ops->tf_dev_set_global_cfg(tfp, &gparms);
+	rc = dev->ops->tf_dev_set_global_cfg(tfp, parms);
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "%s: Global Cfg set failed, rc:%s\n",
@@ -1352,6 +1340,44 @@ tf_alloc_tbl_scope(struct tf *tfp,
 
 	return rc;
 }
+int
+tf_map_tbl_scope(struct tf *tfp,
+		   struct tf_map_tbl_scope_parms *parms)
+{
+	struct tf_session *tfs;
+	struct tf_dev_info *dev;
+	int rc;
+
+	TF_CHECK_PARMS2(tfp, parms);
+
+	/* Retrieve the session information */
+	rc = tf_session_get_session(tfp, &tfs);
+	if (rc) {
+		TFP_DRV_LOG(ERR,
+			    "Failed to lookup session, rc:%s\n",
+			    strerror(-rc));
+		return rc;
+	}
+
+	/* 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;
+	}
+
+	if (dev->ops->tf_dev_map_tbl_scope != NULL) {
+		rc = dev->ops->tf_dev_map_tbl_scope(tfp, parms);
+	} else {
+		TFP_DRV_LOG(ERR,
+			    "Map table scope not supported by device\n");
+		return -EINVAL;
+	}
+
+	return rc;
+}
 
 int
 tf_free_tbl_scope(struct tf *tfp,
drivers/net/bnxt/tf_core/tf_core.h +48 -7

87 lines not on this page · raw message

drivers/net/bnxt/tf_core/tf_device.h +41 -2

61 lines not on this page · raw message

drivers/net/bnxt/tf_core/tf_device_p4.c +44 -0

68 lines not on this page · raw message

drivers/net/bnxt/tf_core/tf_em.h +17 -2
index 51b08138ea..8820b28ef1 100644
@@ -358,7 +358,7 @@ int tf_em_ext_free(struct tf *tfp,
 		   struct tf_free_tbl_scope_parms *parms);
 
 /**
- * Common free for external EEM using host or system memory
+ * Common free table scope for external EEM using host or system memory
  *
  * [in] tfp
  *   Pointer to TruFlow handle
@@ -374,7 +374,7 @@ int tf_em_ext_common_free(struct tf *tfp,
 			  struct tf_free_tbl_scope_parms *parms);
 
 /**
- * Common alloc for external EEM using host or system memory
+ * Common alloc table scope for external EEM using host or system memory
  *
  * [in] tfp
  *   Pointer to TruFlow handle
@@ -388,6 +388,21 @@ int tf_em_ext_common_free(struct tf *tfp,
  */
 int tf_em_ext_common_alloc(struct tf *tfp,
 			   struct tf_alloc_tbl_scope_parms *parms);
+/**
+ * Map a set of parifs to a set of EEM base addresses (table scope)
+ *
+ * [in] tfp
+ *   Pointer to TruFlow handle
+ *
+ * [in] parms
+ *   Pointer to input parameters
+ *
+ * Returns:
+ *   0       - Success
+ *   -EINVAL - Parameter error
+ */
+int tf_em_ext_map_tbl_scope(struct tf *tfp,
+			    struct tf_map_tbl_scope_parms *parms);
 
 /**
  * Allocate External Tbl entry from the scope pool.
drivers/net/bnxt/tf_core/tf_em_common.c +90 -84

199 lines not on this page · raw message

drivers/net/bnxt/tf_core/tf_em_common.h +1 -26
index f71a487675..fa313c458f 100644
@@ -9,6 +9,7 @@
 #include "tf_core.h"
 #include "tf_session.h"
 
+
 /**
  * Function to search for table scope control block structure
  * with specified table scope ID.
@@ -22,32 +23,6 @@
  */
 struct tf_tbl_scope_cb *tbl_scope_cb_find(uint32_t tbl_scope_id);
 
-/**
- * Table Scope Allocate
- *
- * Allocate a table scope
- *
- * [in/out] pointer to tbl_scope_id
- *
- * Returns:
- *  0 - success
- *  -EINVAL - error
- */
-int tf_tbl_scope_alloc(uint32_t *tbl_scope_id);
-
-/**
- * Table Scope Free
- *
- * Free a table scope
- *
- * [in] tbl_scope_id to free
- *
- * Returns:
- *  0 - success
- *  -EINVAL - error
- */
-int tf_tbl_scope_free(uint32_t tbl_scope_id);
-
 /**
  * Create and initialize a stack to use for action entries
  *
drivers/net/bnxt/tf_core/tf_em_host.c +19 -4
index cfcb12f3bc..b5db94f3ef 100644
@@ -374,8 +374,14 @@ tf_em_ext_alloc(struct tf *tfp, struct tf_alloc_tbl_scope_parms *parms)
 	struct tf_tbl_scope_cb *tbl_scope_cb;
 	struct hcapi_cfa_em_table *em_tables;
 	struct tf_free_tbl_scope_parms free_parms;
-
-	rc = tf_tbl_scope_alloc(&parms->tbl_scope_id);
+	struct tf_rm_allocate_parms aparms = { 0 };
+	struct tf_rm_free_parms fparms = { 0 };
+
+	/* 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.index = (uint32_t *)&parms->tbl_scope_id;
+	rc = tf_rm_allocate(&aparms);
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to allocate table scope\n");
@@ -472,7 +478,11 @@ tf_em_ext_alloc(struct tf *tfp, struct tf_alloc_tbl_scope_parms *parms)
 	return -EINVAL;
 
 cleanup:
-	tf_tbl_scope_free(parms->tbl_scope_id);
+	/* Free Table control block */
+	fparms.rm_db = eem_db[TF_DIR_RX];
+	fparms.db_index = TF_EM_TBL_TYPE_TBL_SCOPE;
+	fparms.index = parms->tbl_scope_id;
+	tf_rm_free(&fparms);
 	return -EINVAL;
 }
 
@@ -483,6 +493,7 @@ tf_em_ext_free(struct tf *tfp,
 	int rc = 0;
 	enum tf_dir  dir;
 	struct tf_tbl_scope_cb *tbl_scope_cb;
+	struct tf_rm_free_parms aparms = { 0 };
 
 	tbl_scope_cb = tbl_scope_cb_find(parms->tbl_scope_id);
 
@@ -491,7 +502,11 @@ tf_em_ext_free(struct tf *tfp,
 		return -EINVAL;
 	}
 
-	rc = tf_tbl_scope_free(parms->tbl_scope_id);
+	/* Free Table control block */
+	aparms.rm_db = eem_db[TF_DIR_RX];
+	aparms.db_index = TF_EM_TBL_TYPE_TBL_SCOPE;
+	aparms.index = parms->tbl_scope_id;
+	rc = tf_rm_free(&aparms);
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to free table scope\n");
drivers/net/bnxt/tf_core/tf_global_cfg.c +2 -2
index 4ed4039db4..ebd1a86ad3 100644
@@ -113,7 +113,7 @@ tf_global_cfg_unbind(struct tf *tfp __rte_unused)
 
 int
 tf_global_cfg_set(struct tf *tfp,
-		  struct tf_dev_global_cfg_parms *parms)
+		  struct tf_global_cfg_parms *parms)
 {
 	int rc;
 	struct tf_global_cfg_get_hcapi_parms hparms;
@@ -156,7 +156,7 @@ tf_global_cfg_set(struct tf *tfp,
 
 int
 tf_global_cfg_get(struct tf *tfp,
-		  struct tf_dev_global_cfg_parms *parms)
+		  struct tf_global_cfg_parms *parms)
 
 {
 	int rc;
drivers/net/bnxt/tf_core/tf_global_cfg.h +11 -31

65 lines not on this page · raw message

drivers/net/bnxt/tf_core/tf_msg.c +11 -2
index 7c2ad172f2..5615eedbbe 100644
@@ -1075,7 +1075,7 @@ tf_msg_get_tbl_entry(struct tf *tfp,
 
 int
 tf_msg_get_global_cfg(struct tf *tfp,
-		      struct tf_dev_global_cfg_parms *params)
+		      struct tf_global_cfg_parms *params)
 {
 	int rc = 0;
 	struct tfp_send_msg_parms parms = { 0 };
@@ -1133,7 +1133,7 @@ tf_msg_get_global_cfg(struct tf *tfp,
 
 int
 tf_msg_set_global_cfg(struct tf *tfp,
-		      struct tf_dev_global_cfg_parms *params)
+		      struct tf_global_cfg_parms *params)
 {
 	int rc = 0;
 	struct tfp_send_msg_parms parms = { 0 };
@@ -1173,6 +1173,15 @@ tf_msg_set_global_cfg(struct tf *tfp,
 
 	tfp_memcpy(req.data, params->config,
 		   params->config_sz_in_bytes);
+
+	/* Only set mask if pointer is provided
+	 */
+	if (params->config_mask) {
+		tfp_memcpy(req.data + params->config_sz_in_bytes,
+			   params->config_mask,
+			   params->config_sz_in_bytes);
+	}
+
 	req.size = tfp_cpu_to_le_32(params->config_sz_in_bytes);
 
 	parms.tf_type = HWRM_TF_GLOBAL_CFG_SET;
drivers/net/bnxt/tf_core/tf_msg.h +2 -2
index 195710eb80..72bf850487 100644
@@ -462,7 +462,7 @@ int tf_msg_get_tbl_entry(struct tf *tfp,
  *   0 on Success else internal Truflow error
  */
 int tf_msg_get_global_cfg(struct tf *tfp,
-			  struct tf_dev_global_cfg_parms *params);
+			  struct tf_global_cfg_parms *params);
 
 /**
  * Sends global cfg update request to Firmware
@@ -477,7 +477,7 @@ int tf_msg_get_global_cfg(struct tf *tfp,
  *   0 on Success else internal Truflow error
  */
 int tf_msg_set_global_cfg(struct tf *tfp,
-			  struct tf_dev_global_cfg_parms *params);
+			  struct tf_global_cfg_parms *params);
 
 /**
  * Sends bulk get message of a Table Type element to the firmware.
Signature · 1 line
2.21.1 (Apple Git-122.3)
#37 lore raw

PATCH v4 3/15 net/bnxt: add table scope to PF Mapping

In reply to Ajit Khaparde

From: Farah Smith <[email protected]>

Add table scope to PF Mapping for SR and Wh+ devices. Legacy devices require PF set of base addresses for EEM operation. A table scope id is a logical construct and is mapped to the PF associated with the communications channel used.
In the case of a VF, the parent PF is used.

---
 drivers/net/bnxt/tf_core/tf_device.h    | 10 +++++++---
 drivers/net/bnxt/tf_core/tf_device_p4.c | 10 +++++-----
 drivers/net/bnxt/tf_core/tf_em_common.c |  6 ++++--
 drivers/net/bnxt/tf_core/tf_em_host.c   |  8 ++++++++
 drivers/net/bnxt/tf_core/tf_tbl.h       |  3 +++
 drivers/net/bnxt/tf_core/tfp.c          | 19 +++++++++++++++++++
 drivers/net/bnxt/tf_core/tfp.h          | 16 ++++++++++++++++
 7 files changed, 62 insertions(+), 10 deletions(-)
drivers/net/bnxt/tf_core/tf_device.h +7 -3
index cf7c36e0ea..b5fc695ece 100644
@@ -579,8 +579,11 @@ struct tf_dev_ops {
 	 * [in] tfp
 	 *   Pointer to TF handle
 	 *
-	 * [in] parms
-	 *   Pointer to table scope map parameters
+	 * [in] pf
+	 * PF associated with the table scope
+	 *
+	 * [in] parif_bitmask
+	 * Bitmask of PARIFs to enable
 	 *
 	 * [in/out] pointer to the parif_2_pf data to be updated
 	 *
@@ -593,7 +596,8 @@ struct tf_dev_ops {
 	 *    -EINVAL - Error
 	 */
 	int (*tf_dev_map_parif)(struct tf *tfp,
-				struct tf_map_tbl_scope_parms *parms,
+				uint16_t parif_bitmask,
+				uint16_t pf,
 				uint8_t *data,
 				uint8_t *mask,
 				uint16_t sz_in_bytes);
drivers/net/bnxt/tf_core/tf_device_p4.c +5 -5
index 07c8d02faa..b35e65a8de 100644
@@ -103,7 +103,8 @@ tf_dev_p4_get_tcam_slice_info(struct tf *tfp __rte_unused,
 
 static int
 tf_dev_p4_map_parif(struct tf *tfp __rte_unused,
-		    struct tf_map_tbl_scope_parms *parms,
+		    uint16_t parif_bitmask,
+		    uint16_t pf,
 		    uint8_t *data,
 		    uint8_t *mask,
 		    uint16_t sz_in_bytes)
@@ -112,21 +113,20 @@ tf_dev_p4_map_parif(struct tf *tfp __rte_unused,
 	uint32_t parif_pf_mask[2] = { 0 };
 	uint32_t parif;
 	uint32_t shift;
-	uint32_t scope_id = (uint32_t)(parms->tbl_scope_id);
 
 	if (sz_in_bytes != sizeof(uint64_t))
 		return -ENOTSUP;
 
 	for (parif = 0; parif < TF_DEV_P4_PARIF_MAX; parif++) {
-		if (parms->parif_bitmask & (1UL << parif)) {
+		if (parif_bitmask & (1UL << parif)) {
 			if (parif < 8) {
 				shift = 4 * parif;
 				parif_pf_mask[0] |= TF_DEV_P4_PF_MASK << shift;
-				parif_pf[0] |= scope_id << shift;
+				parif_pf[0] |= pf << shift;
 			} else {
 				shift = 4 * (parif - 8);
 				parif_pf_mask[1] |= TF_DEV_P4_PF_MASK << shift;
-				parif_pf[1] |= scope_id << shift;
+				parif_pf[1] |= pf << shift;
 			}
 		}
 	}
drivers/net/bnxt/tf_core/tf_em_common.c +4 -2
index d4e8469edf..ad92cbdc75 100644
@@ -1104,8 +1104,10 @@ int tf_em_ext_map_tbl_scope(struct tf *tfp,
 	}
 	mask = aparms.mem_va;
 
-	rc = dev->ops->tf_dev_map_parif(tfp, parms, (uint8_t *)data,
-					(uint8_t *)mask, sz_in_bytes);
+	rc = dev->ops->tf_dev_map_parif(tfp, parms->parif_bitmask,
+					tbl_scope_cb->pf,
+					(uint8_t *)data, (uint8_t *)mask,
+					sz_in_bytes);
 
 	if (rc) {
 		TFP_DRV_LOG(ERR,
drivers/net/bnxt/tf_core/tf_em_host.c +8 -0
index b5db94f3ef..a106bdffde 100644
@@ -392,6 +392,14 @@ tf_em_ext_alloc(struct tf *tfp, struct tf_alloc_tbl_scope_parms *parms)
 	tbl_scope_cb->index = parms->tbl_scope_id;
 	tbl_scope_cb->tbl_scope_id = parms->tbl_scope_id;
 
+	rc = tfp_get_pf(tfp, &tbl_scope_cb->pf);
+	if (rc) {
+		TFP_DRV_LOG(ERR,
+			    "EEM: PF query error rc:%s\n",
+			    strerror(-rc));
+		goto cleanup;
+	}
+
 	for (dir = 0; dir < TF_DIR_MAX; dir++) {
 		rc = tf_msg_em_qcaps(tfp,
 				     dir,
drivers/net/bnxt/tf_core/tf_tbl.h +3 -0
index 2a5d24c940..230338c81b 100644
@@ -38,6 +38,9 @@ struct tf_em_caps {
  */
 struct tf_tbl_scope_cb {
 	uint32_t tbl_scope_id;
+       /** The pf or parent pf of the vf used for table scope creation
+	*/
+	uint16_t pf;
 	int index;
 	struct hcapi_cfa_em_ctx_mem_info em_ctx_info[TF_DIR_MAX];
 	struct tf_em_caps em_caps[TF_DIR_MAX];
drivers/net/bnxt/tf_core/tfp.c +19 -0
index 426a182a90..0f6d63cc00 100644
@@ -178,3 +178,22 @@ tfp_get_fid(struct tf *tfp, uint16_t *fw_fid)
 
 	return 0;
 }
+
+int
+tfp_get_pf(struct tf *tfp, uint16_t *pf)
+{
+	struct bnxt *bp = NULL;
+
+	if (tfp == NULL || pf == NULL)
+		return -EINVAL;
+
+	bp = container_of(tfp, struct bnxt, tfp);
+	if (BNXT_VF(bp) && bp->parent) {
+		*pf = bp->parent->fid - 1;
+		return 0;
+	} else if (BNXT_PF(bp)) {
+		*pf = bp->fw_fid - 1;
+		return 0;
+	}
+	return -EINVAL;
+}
drivers/net/bnxt/tf_core/tfp.h +16 -0
index 421a7d9f78..551b9c569f 100644
@@ -268,4 +268,20 @@ int tfp_get_fid(struct tf *tfp, uint16_t *fw_fid);
  */
 int tfp_get_fid(struct tf *tfp, uint16_t *fw_fid);
 
+/**
+ * Get the PF associated with the fw communications channel.
+ *
+ * [in] session
+ *   Pointer to session handle
+ *
+ * [out] pf
+ *   Pointer to the pf id
+ *
+ * Returns:
+ *   0       - Success
+ *   -EINVAL - Failure
+ *
+ */
+int tfp_get_pf(struct tf *tfp, uint16_t *pf);
+
 #endif /* _TFP_H_ */
Signature · 1 line
2.21.1 (Apple Git-122.3)
#38 lore raw

PATCH v4 4/15 net/bnxt: update ULP resource counts

In reply to Ajit Khaparde

From: Peter Spreadborough <[email protected]>

Update ULP resource counts for Stingray device.
- FW needs some resources for normal operation. Account those in the resource manager.
- Update the SR ULP requested resource counts to reflect those available after AFM resources are accounted for.
- Add build option to select either 2 or 4 slot EM entries. The default is 4 slot entries.

---
 drivers/net/bnxt/tf_core/tf_session.h | 16 +++++------
 drivers/net/bnxt/tf_ulp/bnxt_ulp.c    | 40 +++++++++++++--------------
 2 files changed, 28 insertions(+), 28 deletions(-)
drivers/net/bnxt/tf_core/tf_session.h +8 -8
index aa7a27877d..6a5c894033 100644
@@ -33,16 +33,16 @@
 #define TF_SESSION_ID_INVALID     0xFFFFFFFF /** Invalid Session ID define */
 
 /**
- * Number of EM entries. Static for now will be removed
- * when parameter added at a later date. At this stage we
- * are using fixed size entries so that each stack entry
- * represents 4 RT (f/n)blocks. So we take the total block
- * allocation for truflow and divide that by 4.
+ * At this stage we are using fixed size entries so that each
+ * stack entry represents either 2 or 4 RT (f/n)blocks. So we
+ * take the total block allocation for truflow and divide that
+ * by either 2 or 4.
  */
-#define TF_SESSION_TOTAL_FN_BLOCKS (1024 * 8) /* 8K blocks */
+#ifdef TF_EM_ENTRY_IPV4_ONLY
+#define TF_SESSION_EM_ENTRY_SIZE 2 /* 2 blocks per entry */
+#else
 #define TF_SESSION_EM_ENTRY_SIZE 4 /* 4 blocks per entry */
-#define TF_SESSION_EM_POOL_SIZE \
-	(TF_SESSION_TOTAL_FN_BLOCKS / TF_SESSION_EM_ENTRY_SIZE)
+#endif
 
 /**
  * Session
drivers/net/bnxt/tf_ulp/bnxt_ulp.c +20 -20
index b22929a634..d753b5af9f 100644
@@ -153,11 +153,11 @@ bnxt_ulp_tf_session_resources_get(struct bnxt *bp,
 	case BNXT_ULP_DEVICE_ID_STINGRAY:
 		/** RX **/
 		/* Identifiers */
-		res->ident_cnt[TF_DIR_RX].cnt[TF_IDENT_TYPE_L2_CTXT_HIGH] = 100;
+		res->ident_cnt[TF_DIR_RX].cnt[TF_IDENT_TYPE_L2_CTXT_HIGH] = 315;
 		res->ident_cnt[TF_DIR_RX].cnt[TF_IDENT_TYPE_L2_CTXT_LOW] = 6;
-		res->ident_cnt[TF_DIR_RX].cnt[TF_IDENT_TYPE_WC_PROF] = 10;
-		res->ident_cnt[TF_DIR_RX].cnt[TF_IDENT_TYPE_PROF_FUNC] = 10;
-		res->ident_cnt[TF_DIR_RX].cnt[TF_IDENT_TYPE_EM_PROF] = 10;
+		res->ident_cnt[TF_DIR_RX].cnt[TF_IDENT_TYPE_WC_PROF] = 192;
+		res->ident_cnt[TF_DIR_RX].cnt[TF_IDENT_TYPE_PROF_FUNC] = 64;
+		res->ident_cnt[TF_DIR_RX].cnt[TF_IDENT_TYPE_EM_PROF] = 192;
 
 		/* Table Types */
 		res->tbl_cnt[TF_DIR_RX].cnt[TF_TBL_TYPE_FULL_ACT_RECORD] = 8192;
@@ -170,28 +170,28 @@ bnxt_ulp_tf_session_resources_get(struct bnxt *bp,
 
 		/* TCAMs */
 		res->tcam_cnt[TF_DIR_RX].cnt[TF_TCAM_TBL_TYPE_L2_CTXT_TCAM_HIGH] =
-			100;
+			315;
 		res->tcam_cnt[TF_DIR_RX].cnt[TF_TCAM_TBL_TYPE_L2_CTXT_TCAM_LOW] =
 			6;
-		res->tcam_cnt[TF_DIR_RX].cnt[TF_TCAM_TBL_TYPE_PROF_TCAM] = 100;
-		res->tcam_cnt[TF_DIR_RX].cnt[TF_TCAM_TBL_TYPE_WC_TCAM] = 0;
+		res->tcam_cnt[TF_DIR_RX].cnt[TF_TCAM_TBL_TYPE_PROF_TCAM] = 960;
+		res->tcam_cnt[TF_DIR_RX].cnt[TF_TCAM_TBL_TYPE_WC_TCAM] = 112;
 
 		/* EM */
-		res->em_cnt[TF_DIR_RX].cnt[TF_EM_TBL_TYPE_EM_RECORD] = 13168;
+		res->em_cnt[TF_DIR_RX].cnt[TF_EM_TBL_TYPE_EM_RECORD] = 13200;
 
 		/* EEM */
 		res->em_cnt[TF_DIR_RX].cnt[TF_EM_TBL_TYPE_TBL_SCOPE] = 1;
 
 		/* SP */
-		res->tbl_cnt[TF_DIR_RX].cnt[TF_TBL_TYPE_ACT_SP_SMAC] = 255;
+		res->tbl_cnt[TF_DIR_RX].cnt[TF_TBL_TYPE_ACT_SP_SMAC] = 256;
 
 		/** TX **/
 		/* Identifiers */
-		res->ident_cnt[TF_DIR_TX].cnt[TF_IDENT_TYPE_L2_CTXT_HIGH] = 100;
-		res->ident_cnt[TF_DIR_TX].cnt[TF_IDENT_TYPE_L2_CTXT_LOW] = 100;
-		res->ident_cnt[TF_DIR_TX].cnt[TF_IDENT_TYPE_WC_PROF] = 10;
-		res->ident_cnt[TF_DIR_TX].cnt[TF_IDENT_TYPE_PROF_FUNC] = 10;
-		res->ident_cnt[TF_DIR_TX].cnt[TF_IDENT_TYPE_EM_PROF] = 10;
+		res->ident_cnt[TF_DIR_TX].cnt[TF_IDENT_TYPE_L2_CTXT_HIGH] = 292;
+		res->ident_cnt[TF_DIR_TX].cnt[TF_IDENT_TYPE_L2_CTXT_LOW] = 127;
+		res->ident_cnt[TF_DIR_TX].cnt[TF_IDENT_TYPE_WC_PROF] = 192;
+		res->ident_cnt[TF_DIR_TX].cnt[TF_IDENT_TYPE_PROF_FUNC] = 64;
+		res->ident_cnt[TF_DIR_TX].cnt[TF_IDENT_TYPE_EM_PROF] = 192;
 
 		/* Table Types */
 		res->tbl_cnt[TF_DIR_TX].cnt[TF_TBL_TYPE_FULL_ACT_RECORD] = 8192;
@@ -199,17 +199,17 @@ bnxt_ulp_tf_session_resources_get(struct bnxt *bp,
 		res->tbl_cnt[TF_DIR_TX].cnt[TF_TBL_TYPE_ACT_MODIFY_IPV4] = 1023;
 
 		/* ENCAP */
-		res->tbl_cnt[TF_DIR_TX].cnt[TF_TBL_TYPE_ACT_ENCAP_64B] = 511;
+		res->tbl_cnt[TF_DIR_TX].cnt[TF_TBL_TYPE_ACT_ENCAP_64B] = 367;
 		res->tbl_cnt[TF_DIR_TX].cnt[TF_TBL_TYPE_ACT_ENCAP_16B] = 223;
 		res->tbl_cnt[TF_DIR_TX].cnt[TF_TBL_TYPE_ACT_ENCAP_8B] = 255;
 
 		/* TCAMs */
 		res->tcam_cnt[TF_DIR_TX].cnt[TF_TCAM_TBL_TYPE_L2_CTXT_TCAM_HIGH] =
-			100;
+			292;
 		res->tcam_cnt[TF_DIR_TX].cnt[TF_TCAM_TBL_TYPE_L2_CTXT_TCAM_LOW] =
-			100;
-		res->tcam_cnt[TF_DIR_TX].cnt[TF_TCAM_TBL_TYPE_PROF_TCAM] = 100;
-		res->tcam_cnt[TF_DIR_TX].cnt[TF_TCAM_TBL_TYPE_WC_TCAM] = 0;
+			127;
+		res->tcam_cnt[TF_DIR_TX].cnt[TF_TCAM_TBL_TYPE_PROF_TCAM] = 960;
+		res->tcam_cnt[TF_DIR_TX].cnt[TF_TCAM_TBL_TYPE_WC_TCAM] = 928;
 
 		/* EM */
 		res->em_cnt[TF_DIR_TX].cnt[TF_EM_TBL_TYPE_EM_RECORD] = 15232;
@@ -219,7 +219,7 @@ bnxt_ulp_tf_session_resources_get(struct bnxt *bp,
 
 		/* SP */
 		res->tbl_cnt[TF_DIR_TX].cnt[TF_TBL_TYPE_ACT_SP_SMAC_IPV4] = 488;
-		res->tbl_cnt[TF_DIR_TX].cnt[TF_TBL_TYPE_ACT_SP_SMAC_IPV6] = 511;
+		res->tbl_cnt[TF_DIR_TX].cnt[TF_TBL_TYPE_ACT_SP_SMAC_IPV6] = 512;
 		break;
 	default:
 		return -EINVAL;
Signature · 1 line
2.21.1 (Apple Git-122.3)
#39 lore raw

PATCH v4 5/15 net/bnxt: fix flow query count

In reply to Ajit Khaparde

From: Somnath Kotur <[email protected]>

Fix infinite loop in flow query count.
nxt_resource_idx could be zero in some cases which is invalid and should be part of the while loop condition. Also synchronize access to the flow db using the fdb_lock

Fixes 306c2d28e247 ("net/bnxt: support count action in flow query")
---
 drivers/net/bnxt/tf_ulp/ulp_fc_mgr.c | 51 +++++++++++++++-------------
 1 file changed, 27 insertions(+), 24 deletions(-)
drivers/net/bnxt/tf_ulp/ulp_fc_mgr.c +27 -24
index 051ebac049..41736a80df 100644
@@ -559,6 +559,9 @@ int ulp_fc_mgr_query_count_get(struct bnxt_ulp_context *ctxt,
 	if (!ulp_fc_info)
 		return -ENODEV;
 
+	if (bnxt_ulp_cntxt_acquire_fdb_lock(ctxt))
+		return -EIO;
+
 	do {
 		rc = ulp_flow_db_resource_get(ctxt,
 					      BNXT_ULP_FDB_TYPE_REGULAR,
@@ -575,35 +578,35 @@ int ulp_fc_mgr_query_count_get(struct bnxt_ulp_context *ctxt,
 			break;
 		}
 
-	} while (!rc);
+	} while (!rc && nxt_resource_index);
+
+	bnxt_ulp_cntxt_release_fdb_lock(ctxt);
 
-	if (rc)
+	if (rc || !found_cntr_resource)
 		return rc;
 
-	if (found_cntr_resource) {
-		dir = params.direction;
-		hw_cntr_id = params.resource_hndl;
-		sw_cntr_idx = hw_cntr_id -
-				ulp_fc_info->shadow_hw_tbl[dir].start_idx;
-		sw_acc_tbl_entry = &ulp_fc_info->sw_acc_tbl[dir][sw_cntr_idx];
-		if (params.resource_sub_type ==
+	dir = params.direction;
+	hw_cntr_id = params.resource_hndl;
+	sw_cntr_idx = hw_cntr_id -
+		ulp_fc_info->shadow_hw_tbl[dir].start_idx;
+	sw_acc_tbl_entry = &ulp_fc_info->sw_acc_tbl[dir][sw_cntr_idx];
+	if (params.resource_sub_type ==
 			BNXT_ULP_RESOURCE_SUB_TYPE_INDEX_TYPE_INT_COUNT) {
-			pthread_mutex_lock(&ulp_fc_info->fc_lock);
-			if (sw_acc_tbl_entry->pkt_count) {
-				count->hits_set = 1;
-				count->bytes_set = 1;
-				count->hits = sw_acc_tbl_entry->pkt_count;
-				count->bytes = sw_acc_tbl_entry->byte_count;
-			}
-			if (count->reset) {
-				sw_acc_tbl_entry->pkt_count = 0;
-				sw_acc_tbl_entry->byte_count = 0;
-			}
-			pthread_mutex_unlock(&ulp_fc_info->fc_lock);
-		} else {
-			/* TBD: Handle External counters */
-			rc = -EINVAL;
+		pthread_mutex_lock(&ulp_fc_info->fc_lock);
+		if (sw_acc_tbl_entry->pkt_count) {
+			count->hits_set = 1;
+			count->bytes_set = 1;
+			count->hits = sw_acc_tbl_entry->pkt_count;
+			count->bytes = sw_acc_tbl_entry->byte_count;
 		}
+		if (count->reset) {
+			sw_acc_tbl_entry->pkt_count = 0;
+			sw_acc_tbl_entry->byte_count = 0;
+		}
+		pthread_mutex_unlock(&ulp_fc_info->fc_lock);
+	} else {
+		/* TBD: Handle External counters */
+		rc = -EINVAL;
 	}
 
 	return rc;
Signature · 1 line
2.21.1 (Apple Git-122.3)
#40 lore raw

PATCH v4 6/15 net/bnxt: add hierarchical flow counters

In reply to Ajit Khaparde

From: Kishore Padmanabha <[email protected]>

Add support for hierarchical flow counter accumulation.
In case of hierarchical flows, involving parent and child flows, the child flow counters are aggregated to get the parent flow counter information. This should help in cases where one ore more flows is related to a previously offloaded flow.

---
 drivers/net/bnxt/tf_ulp/ulp_fc_mgr.c          |  92 ++++-
 drivers/net/bnxt/tf_ulp/ulp_fc_mgr.h          |  19 +
 drivers/net/bnxt/tf_ulp/ulp_flow_db.c         | 382 ++++++++++++++----
 drivers/net/bnxt/tf_ulp/ulp_flow_db.h         |  44 ++
 .../net/bnxt/tf_ulp/ulp_template_db_enum.h    |   3 +-
 5 files changed, 447 insertions(+), 93 deletions(-)
drivers/net/bnxt/tf_ulp/ulp_fc_mgr.c +79 -13
index 41736a80df..734b419986 100644
@@ -21,13 +21,13 @@ static int
 ulp_fc_mgr_shadow_mem_alloc(struct hw_fc_mem_info *parms, int size)
 {
 	/* Allocate memory*/
-	if (parms == NULL)
+	if (!parms)
 		return -EINVAL;
 
 	parms->mem_va = rte_zmalloc("ulp_fc_info",
 				    RTE_CACHE_LINE_ROUNDUP(size),
 				    4096);
-	if (parms->mem_va == NULL) {
+	if (!parms->mem_va) {
 		BNXT_TF_DBG(ERR, "Allocate failed mem_va\n");
 		return -ENOMEM;
 	}
@@ -149,7 +149,6 @@ ulp_fc_mgr_deinit(struct bnxt_ulp_context *ctxt)
 	for (i = 0; i < TF_DIR_MAX; i++)
 		ulp_fc_mgr_shadow_mem_free(&ulp_fc_info->shadow_hw_tbl[i]);
 
-
 	rte_free(ulp_fc_info);
 
 	/* Safe to ignore on deinit */
@@ -254,7 +253,7 @@ ulp_bulk_get_flow_stats(struct tf *tfp,
 	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;
 
-	if (stats == NULL) {
+	if (!stats) {
 		PMD_DRV_LOG(ERR,
 			    "BULK: Memory not initialized id:0x%x dir:%d\n",
 			    parms.starting_idx, dir);
@@ -274,7 +273,8 @@ ulp_bulk_get_flow_stats(struct tf *tfp,
 		sw_acc_tbl_entry = &fc_info->sw_acc_tbl[dir][i];
 		if (!sw_acc_tbl_entry->valid)
 			continue;
-		sw_acc_tbl_entry->pkt_count += FLOW_CNTR_PKTS(stats[i], dparms);
+		sw_acc_tbl_entry->pkt_count += FLOW_CNTR_PKTS(stats[i],
+							      dparms);
 		sw_acc_tbl_entry->byte_count += FLOW_CNTR_BYTES(stats[i],
 								dparms);
 	}
@@ -282,7 +282,8 @@ ulp_bulk_get_flow_stats(struct tf *tfp,
 	return rc;
 }
 
-static int ulp_get_single_flow_stat(struct tf *tfp,
+static int ulp_get_single_flow_stat(struct bnxt_ulp_context *ctxt,
+				    struct tf *tfp,
 				    struct bnxt_ulp_fc_info *fc_info,
 				    enum tf_dir dir,
 				    uint32_t hw_cntr_id,
@@ -291,7 +292,7 @@ static int ulp_get_single_flow_stat(struct tf *tfp,
 	int rc = 0;
 	struct tf_get_tbl_entry_parms parms = { 0 };
 	enum tf_tbl_type stype = TF_TBL_TYPE_ACT_STATS_64;  /* TBD:Template? */
-	struct sw_acc_counter *sw_acc_tbl_entry = NULL;
+	struct sw_acc_counter *sw_acc_tbl_entry = NULL, *t_sw;
 	uint64_t stats = 0;
 	uint32_t sw_cntr_indx = 0;
 
@@ -318,6 +319,18 @@ static int ulp_get_single_flow_stat(struct tf *tfp,
 	sw_acc_tbl_entry->pkt_count = FLOW_CNTR_PKTS(stats, dparms);
 	sw_acc_tbl_entry->byte_count = FLOW_CNTR_BYTES(stats, dparms);
 
+	/* Update the parent counters if it is child flow */
+	if (sw_acc_tbl_entry->parent_flow_id) {
+		/* Update the parent counters */
+		t_sw = sw_acc_tbl_entry;
+		if (ulp_flow_db_parent_flow_count_update(ctxt,
+							 t_sw->parent_flow_id,
+							 t_sw->pkt_count,
+							 t_sw->byte_count)) {
+			PMD_DRV_LOG(ERR, "Error updating parent counters\n");
+		}
+	}
+
 	return rc;
 }
 
@@ -384,13 +397,17 @@ ulp_fc_mgr_alarm_cb(void *arg)
 			break;
 	}
 	*/
+
+	/* reset the parent accumulation counters before accumulation if any */
+	ulp_flow_db_parent_flow_count_reset(ctxt);
+
 	num_entries = dparms->flow_count_db_entries / 2;
 	for (i = 0; i < TF_DIR_MAX; i++) {
 		for (j = 0; j < num_entries; j++) {
 			if (!ulp_fc_info->sw_acc_tbl[i][j].valid)
 				continue;
 			hw_cntr_id = ulp_fc_info->sw_acc_tbl[i][j].hw_cntr_id;
-			rc = ulp_get_single_flow_stat(tfp, ulp_fc_info, i,
+			rc = ulp_get_single_flow_stat(ctxt, tfp, ulp_fc_info, i,
 						      hw_cntr_id, dparms);
 			if (rc)
 				break;
@@ -573,11 +590,12 @@ int ulp_fc_mgr_query_count_get(struct bnxt_ulp_context *ctxt,
 		     (params.resource_sub_type ==
 		      BNXT_ULP_RESOURCE_SUB_TYPE_INDEX_TYPE_INT_COUNT ||
 		      params.resource_sub_type ==
-		      BNXT_ULP_RESOURCE_SUB_TYPE_INDEX_TYPE_EXT_COUNT)) {
+		      BNXT_ULP_RESOURCE_SUB_TYPE_INDEX_TYPE_EXT_COUNT ||
+		      params.resource_sub_type ==
+		      BNXT_ULP_RESOURCE_SUB_TYPE_INDEX_TYPE_INT_COUNT_ACC)) {
 			found_cntr_resource = true;
 			break;
 		}
-
 	} while (!rc && nxt_resource_index);
 
 	bnxt_ulp_cntxt_release_fdb_lock(ctxt);
@@ -587,12 +605,12 @@ int ulp_fc_mgr_query_count_get(struct bnxt_ulp_context *ctxt,
 
 	dir = params.direction;
 	hw_cntr_id = params.resource_hndl;
-	sw_cntr_idx = hw_cntr_id -
-		ulp_fc_info->shadow_hw_tbl[dir].start_idx;
-	sw_acc_tbl_entry = &ulp_fc_info->sw_acc_tbl[dir][sw_cntr_idx];
 	if (params.resource_sub_type ==
 			BNXT_ULP_RESOURCE_SUB_TYPE_INDEX_TYPE_INT_COUNT) {
 		pthread_mutex_lock(&ulp_fc_info->fc_lock);
+		sw_cntr_idx = hw_cntr_id -
+			ulp_fc_info->shadow_hw_tbl[dir].start_idx;
+		sw_acc_tbl_entry = &ulp_fc_info->sw_acc_tbl[dir][sw_cntr_idx];
 		if (sw_acc_tbl_entry->pkt_count) {
 			count->hits_set = 1;
 			count->bytes_set = 1;
@@ -604,6 +622,15 @@ int ulp_fc_mgr_query_count_get(struct bnxt_ulp_context *ctxt,
 			sw_acc_tbl_entry->byte_count = 0;
 		}
 		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 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 {
 		/* TBD: Handle External counters */
 		rc = -EINVAL;
@@ -611,3 +638,42 @@ int ulp_fc_mgr_query_count_get(struct bnxt_ulp_context *ctxt,
 
 	return rc;
 }
+
+/*
+ * Set the parent flow if it is SW accumulation counter entry.
+ *
+ * ctxt [in] The ulp context for the flow counter manager
+ *
+ * dir [in] The direction of the flow
+ *
+ * hw_cntr_id [in] The HW flow counter ID
+ *
+ * fid [in] parent flow id
+ *
+ */
+int32_t ulp_fc_mgr_cntr_parent_flow_set(struct bnxt_ulp_context *ctxt,
+					enum tf_dir dir,
+					uint32_t hw_cntr_id,
+					uint32_t fid)
+{
+	struct bnxt_ulp_fc_info *ulp_fc_info;
+	uint32_t sw_cntr_idx;
+	int32_t rc = 0;
+
+	ulp_fc_info = bnxt_ulp_cntxt_ptr2_fc_info_get(ctxt);
+	if (!ulp_fc_info)
+		return -EIO;
+
+	pthread_mutex_lock(&ulp_fc_info->fc_lock);
+	sw_cntr_idx = hw_cntr_id - ulp_fc_info->shadow_hw_tbl[dir].start_idx;
+	if (ulp_fc_info->sw_acc_tbl[dir][sw_cntr_idx].valid) {
+		ulp_fc_info->sw_acc_tbl[dir][sw_cntr_idx].parent_flow_id = fid;
+	} else {
+		BNXT_TF_DBG(ERR, "Failed to set parent flow id %x:%x\n",
+			    hw_cntr_id, fid);
+		rc = -ENOENT;
+	}
+	pthread_mutex_unlock(&ulp_fc_info->fc_lock);
+
+	return rc;
+}
drivers/net/bnxt/tf_ulp/ulp_fc_mgr.h +19 -0
index 0cb880d4bc..de4d3dfe95 100644
@@ -26,6 +26,7 @@ struct sw_acc_counter {
 	uint64_t byte_count;
 	bool	valid;
 	uint32_t hw_cntr_id;
+	uint32_t parent_flow_id;
 };
 
 struct hw_fc_mem_info {
@@ -163,4 +164,22 @@ bool ulp_fc_mgr_thread_isstarted(struct bnxt_ulp_context *ctxt);
 int ulp_fc_mgr_query_count_get(struct bnxt_ulp_context *ulp_ctx,
 			       uint32_t flow_id,
 			       struct rte_flow_query_count *count);
+
+/*
+ * Set the parent flow if in the SW accumulator table entry
+ *
+ * ctxt [in] The ulp context for the flow counter manager
+ *
+ * dir [in] The direction of the flow
+ *
+ * hw_cntr_id [in] The HW flow counter ID
+ *
+ * fid [in] parent flow id
+ *
+ */
+int32_t ulp_fc_mgr_cntr_parent_flow_set(struct bnxt_ulp_context *ctxt,
+					enum tf_dir dir,
+					uint32_t hw_cntr_id,
+					uint32_t fid);
+
 #endif /* _ULP_FC_MGR_H_ */
drivers/net/bnxt/tf_ulp/ulp_flow_db.c +303 -79

513 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_flow_db.h +44 -0

54 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_template_db_enum.h +2 -1
index 168e308c2b..6dade9afdb 100644
@@ -332,7 +332,8 @@ enum bnxt_ulp_resource_sub_type {
 	BNXT_ULP_RESOURCE_SUB_TYPE_INDEX_TYPE_NORMAL = 0,
 	BNXT_ULP_RESOURCE_SUB_TYPE_INDEX_TYPE_VFR_CFA_ACTION = 1,
 	BNXT_ULP_RESOURCE_SUB_TYPE_INDEX_TYPE_INT_COUNT = 2,
-	BNXT_ULP_RESOURCE_SUB_TYPE_INDEX_TYPE_EXT_COUNT = 3,
+	BNXT_ULP_RESOURCE_SUB_TYPE_INDEX_TYPE_INT_COUNT_ACC = 3,
+	BNXT_ULP_RESOURCE_SUB_TYPE_INDEX_TYPE_EXT_COUNT = 4,
 	BNXT_ULP_RESOURCE_SUB_TYPE_CACHE_TYPE_L2_CNTXT_TCAM = 0,
 	BNXT_ULP_RESOURCE_SUB_TYPE_CACHE_TYPE_PROFILE_TCAM = 1
 };
Signature · 1 line
2.21.1 (Apple Git-122.3)
#41 lore raw

PATCH v4 7/15 net/bnxt: modify HWRM command to create reps

In reply to Ajit Khaparde

From: Somnath Kotur <[email protected]>

Use cfa pair alloc for configuring reps.
Instead of cfa_vfr_alloc for Wh+ and cfa_pair_alloc for Stingray, converge to cfa_pair_alloc/free for both devices. Set the command request structure bits accordingly.
As part of this, remove the old cfa_vfr_alloc cmd definitions as FW has deprecated support for those commands.

---
 doc/guides/rel_notes/release_20_11.rst |  1 +
 drivers/net/bnxt/bnxt.h                |  6 ++-
 drivers/net/bnxt/bnxt_ethdev.c         |  2 +
 drivers/net/bnxt/bnxt_hwrm.c           | 60 +++-----------------------
 drivers/net/bnxt/bnxt_hwrm.h           |  2 -
 drivers/net/bnxt/bnxt_reps.c           | 18 ++++----
 6 files changed, 22 insertions(+), 67 deletions(-)
doc/guides/rel_notes/release_20_11.rst +1 -0
index f9ef4fe77b..edbcaf170b 100644
@@ -147,6 +147,7 @@ New Features
   * Added support for RSS hash level selection.
   * Updated HWRM structures to 1.10.1.70 version.
   * Added TRUFLOW support for Stingray devices.
+  * Added support for representors on MAIA cores of SR.
 
 * **Updated Cisco enic driver.**
 
drivers/net/bnxt/bnxt.h +5 -1
index a951bca7aa..57178192d2 100644
@@ -836,12 +836,14 @@ struct bnxt_representor {
 #define BNXT_REP_Q_F2R_VALID		BIT(2)
 #define BNXT_REP_FC_R2F_VALID		BIT(3)
 #define BNXT_REP_FC_F2R_VALID		BIT(4)
+#define BNXT_REP_BASED_PF_VALID		BIT(5)
 	uint32_t		flags;
 	uint16_t		fw_fid;
 #define	BNXT_DFLT_VNIC_ID_INVALID	0xFFFF
 	uint16_t		dflt_vnic_id;
 	uint16_t		svif;
 	uint16_t		vfr_tx_cfa_action;
+	uint8_t			parent_pf_idx; /* Logical PF index */
 	uint32_t		dpdk_port_id;
 	uint32_t		rep_based_pf;
 	uint8_t			rep_q_r2f;
@@ -863,7 +865,9 @@ struct bnxt_representor {
 	uint64_t                rx_drop_bytes[BNXT_MAX_VF_REP_RINGS];
 };
 
-#define BNXT_REP_PF(vfr_bp)	((vfr_bp)->flags & BNXT_REP_IS_PF)
+#define BNXT_REP_PF(vfr_bp)		((vfr_bp)->flags & BNXT_REP_IS_PF)
+#define BNXT_REP_BASED_PF(vfr_bp)	\
+		((vfr_bp)->flags & BNXT_REP_BASED_PF_VALID)
 
 struct bnxt_vf_rep_tx_queue {
 	struct bnxt_tx_queue *txq;
drivers/net/bnxt/bnxt_ethdev.c +2 -0
index 5718cc877d..a0e01d059d 100644
@@ -5765,6 +5765,8 @@ bnxt_parse_devarg_rep_based_pf(__rte_unused const char *key,
 	}
 
 	vfr_bp->rep_based_pf = rep_based_pf;
+	vfr_bp->flags |= BNXT_REP_BASED_PF_VALID;
+
 	PMD_DRV_LOG(INFO, "rep-based-pf = %d\n", vfr_bp->rep_based_pf);
 
 	return 0;
drivers/net/bnxt/bnxt_hwrm.c +6 -54

79 lines not on this page · raw message

drivers/net/bnxt/bnxt_hwrm.h +0 -2
index a7fa7f66b1..23ca6ab515 100644
@@ -297,8 +297,6 @@ int bnxt_hwrm_port_phy_qcaps(struct bnxt *bp);
 int bnxt_hwrm_oem_cmd(struct bnxt *bp, uint32_t entry_num);
 int bnxt_clear_one_vnic_filter(struct bnxt *bp,
 			       struct bnxt_filter_info *filter);
-int bnxt_hwrm_cfa_vfr_alloc(struct bnxt *bp, uint16_t vf_idx);
-int bnxt_hwrm_cfa_vfr_free(struct bnxt *bp, uint16_t vf_idx);
 void bnxt_hwrm_free_vf_info(struct bnxt *bp);
 int bnxt_hwrm_first_vf_id_query(struct bnxt *bp, uint16_t fid,
 				uint16_t *first_vf_id);
drivers/net/bnxt/bnxt_reps.c +8 -10
index b4566c926a..e5ba0909b9 100644
@@ -216,8 +216,9 @@ int bnxt_representor_init(struct rte_eth_dev *eth_dev, void *params)
 		    "Switch domain id %d: Representor Device %d init done\n",
 		    vf_rep_bp->switch_domain_id, vf_rep_bp->vf_id);
 
-	if (vf_rep_bp->rep_based_pf) {
+	if (BNXT_REP_BASED_PF(vf_rep_bp)) {
 		vf_rep_bp->fw_fid = vf_rep_bp->rep_based_pf + 1;
+		vf_rep_bp->parent_pf_idx = vf_rep_bp->rep_based_pf;
 		if (!(BNXT_REP_PF(vf_rep_bp))) {
 			/* VF representor for the remote PF,get first_vf_id */
 			rc = bnxt_hwrm_first_vf_id_query(parent_bp,
@@ -237,6 +238,10 @@ int bnxt_representor_init(struct rte_eth_dev *eth_dev, void *params)
 		}
 	}  else {
 		vf_rep_bp->fw_fid = rep_params->vf_id + parent_bp->first_vf_id;
+		if (BNXT_VF_IS_TRUSTED(parent_bp))
+			vf_rep_bp->parent_pf_idx = parent_bp->parent->fid - 1;
+		else
+			vf_rep_bp->parent_pf_idx = parent_bp->fw_fid - 1;
 	}
 
 	PMD_DRV_LOG(INFO, "vf_rep->fw_fid = %d\n", vf_rep_bp->fw_fid);
@@ -329,11 +334,7 @@ static int bnxt_tf_vfr_alloc(struct rte_eth_dev *vfr_ethdev)
 	/* update the port id so you can backtrack to ethdev */
 	vfr->dpdk_port_id = vfr_ethdev->data->port_id;
 
-	if (BNXT_STINGRAY(parent_bp)) {
-		rc = bnxt_hwrm_cfa_pair_alloc(parent_bp, vfr);
-	} else {
-		rc = bnxt_hwrm_cfa_vfr_alloc(parent_bp, vfr->vf_id);
-	}
+	rc = bnxt_hwrm_cfa_pair_alloc(parent_bp, vfr);
 	if (rc) {
 		BNXT_TF_DBG(ERR, "Failed in hwrm vfr alloc vfr:%u rc=%d\n",
 			    vfr->vf_id, rc);
@@ -468,10 +469,7 @@ static int bnxt_vfr_free(struct bnxt_representor *vfr)
 		    vfr->vf_id);
 	vfr->vfr_tx_cfa_action = 0;
 
-	if (BNXT_STINGRAY(parent_bp))
-		rc = bnxt_hwrm_cfa_pair_free(parent_bp, vfr);
-	else
-		rc = bnxt_hwrm_cfa_vfr_free(parent_bp, vfr->vf_id);
+	rc = bnxt_hwrm_cfa_pair_free(parent_bp, vfr);
 
 	return rc;
 }
Signature · 1 line
2.21.1 (Apple Git-122.3)
#42 lore raw

PATCH v4 8/15 net/bnxt: add mapper support for wildcard TCAM

In reply to Ajit Khaparde

From: Kishore Padmanabha <[email protected]>

Added support for the key and mask fields encoding for the wildcard TCAM entry. Also add internal function to post process the key/mask blobs for wildcard TCAM table. The size of the wildcard TCAM slice is 80 bytes.

---
 drivers/net/bnxt/tf_ulp/ulp_mapper.c |  47 ++++++++--
 drivers/net/bnxt/tf_ulp/ulp_utils.c  | 125 +++++++++++++++++++++++++++
 drivers/net/bnxt/tf_ulp/ulp_utils.h  |  48 +++++++++-
 3 files changed, 212 insertions(+), 8 deletions(-)
drivers/net/bnxt/tf_ulp/ulp_mapper.c +40 -7
index b74cb92f57..27b4780990 100644
@@ -1497,6 +1497,29 @@ ulp_mapper_tcam_tbl_entry_write(struct bnxt_ulp_mapper_parms *parms,
 	return rc;
 }
 
+#define BNXT_ULP_WC_TCAM_SLICE_SIZE 80
+/* internal function to post process the key/mask blobs for wildcard tcam tbl */
+static void ulp_mapper_wc_tcam_tbl_post_process(struct ulp_blob *blob,
+						uint32_t len)
+{
+	uint8_t mode[2] = {0x0, 0x0};
+	uint32_t mode_len = len / BNXT_ULP_WC_TCAM_SLICE_SIZE;
+	uint32_t size, idx;
+
+	/* Add the mode bits to the key and mask*/
+	if (mode_len == 2)
+		mode[1] = 2;
+	else if (mode_len > 2)
+		mode[1] = 3;
+
+	size = BNXT_ULP_WC_TCAM_SLICE_SIZE + ULP_BYTE_2_BITS(sizeof(mode));
+	for (idx = 0; idx < mode_len; idx++)
+		ulp_blob_insert(blob, (size * idx), mode,
+				ULP_BYTE_2_BITS(sizeof(mode)));
+	ulp_blob_perform_64B_word_swap(blob);
+	ulp_blob_perform_64B_byte_swap(blob);
+}
+
 static int32_t
 ulp_mapper_tcam_tbl_process(struct bnxt_ulp_mapper_parms *parms,
 			    struct bnxt_ulp_mapper_tbl_info *tbl)
@@ -1533,9 +1556,9 @@ ulp_mapper_tcam_tbl_process(struct bnxt_ulp_mapper_parms *parms,
 		return -EINVAL;
 	}
 
-	if (!ulp_blob_init(&key, tbl->key_bit_size,
+	if (!ulp_blob_init(&key, tbl->blob_key_bit_size,
 			   parms->device_params->byte_order) ||
-	    !ulp_blob_init(&mask, tbl->key_bit_size,
+	    !ulp_blob_init(&mask, tbl->blob_key_bit_size,
 			   parms->device_params->byte_order) ||
 	    !ulp_blob_init(&data, tbl->result_bit_size,
 			   parms->device_params->byte_order) ||
@@ -1545,6 +1568,11 @@ ulp_mapper_tcam_tbl_process(struct bnxt_ulp_mapper_parms *parms,
 		return -EINVAL;
 	}
 
+	if (tbl->resource_type == TF_TCAM_TBL_TYPE_WC_TCAM) {
+		key.byte_order = BNXT_ULP_BYTE_ORDER_BE;
+		mask.byte_order = BNXT_ULP_BYTE_ORDER_BE;
+	}
+
 	/* create the key/mask */
 	/*
 	 * NOTE: The WC table will require some kind of flag to handle the
@@ -1570,6 +1598,11 @@ ulp_mapper_tcam_tbl_process(struct bnxt_ulp_mapper_parms *parms,
 		}
 	}
 
+	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
@@ -1578,18 +1611,18 @@ ulp_mapper_tcam_tbl_process(struct bnxt_ulp_mapper_parms *parms,
 		aparms.dir		= tbl->direction;
 		aparms.tcam_tbl_type	= tbl->resource_type;
 		aparms.search_enable	= tbl->srch_b4_alloc;
-		aparms.key_sz_in_bits	= tbl->key_bit_size;
 		aparms.key		= ulp_blob_data_get(&key, &tmplen);
-		if (tbl->key_bit_size != 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->key_bit_size);
+				    tmplen, tbl->blob_key_bit_size);
 			return -EINVAL;
 		}
 
 		aparms.mask		= ulp_blob_data_get(&mask, &tmplen);
-		if (tbl->key_bit_size != tmplen) {
+		if (tbl->blob_key_bit_size != tmplen) {
 			BNXT_TF_DBG(ERR, "Mask len (%d) != Expected (%d)\n",
-				    tmplen, tbl->key_bit_size);
+				    tmplen, tbl->blob_key_bit_size);
 			return -EINVAL;
 		}
 
drivers/net/bnxt/tf_ulp/ulp_utils.c +125 -0

137 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_utils.h +47 -1

72 lines not on this page · raw message

Signature · 1 line
2.21.1 (Apple Git-122.3)
#43 lore raw

PATCH v4 9/15 net/bnxt: refactor flow id allocation

In reply to Ajit Khaparde

From: Venkat Duvvuru <[email protected]>

Currently, the flow id is allocated inside ulp_mapper_flow_create. However with vxlan decap feature if F2 flow comes before F1 flow then F2 is cached and not really installed in the hardware which means the code will return without calling ulp_mapper_flow_create. But, ULP has to still return valid flow id to the stack. Hence, move the flow id allocation outside ulp_mapper_flow_create.

---
 drivers/net/bnxt/tf_ulp/bnxt_ulp_flow.c  | 109 ++++++++++++++++-------
 drivers/net/bnxt/tf_ulp/ulp_def_rules.c  |  48 ++++++++--
 drivers/net/bnxt/tf_ulp/ulp_mapper.c     |  35 +-------
 drivers/net/bnxt/tf_ulp/ulp_mapper.h     |   4 +-
 drivers/net/bnxt/tf_ulp/ulp_rte_parser.h |   9 ++
 5 files changed, 132 insertions(+), 73 deletions(-)
drivers/net/bnxt/tf_ulp/bnxt_ulp_flow.c +77 -32
index c7b29824e4..47fbaba03c 100644
@@ -74,6 +74,29 @@ bnxt_ulp_set_dir_attributes(struct ulp_rte_parser_params *params,
 		params->dir_attr |= BNXT_ULP_FLOW_ATTR_TRANSFER;
 }
 
+void
+bnxt_ulp_init_mapper_params(struct bnxt_ulp_mapper_create_parms *mapper_cparms,
+			    struct ulp_rte_parser_params *params,
+			    uint32_t priority, uint32_t class_id,
+			    uint32_t act_tmpl, uint16_t func_id,
+			    uint32_t fid,
+			    enum bnxt_ulp_fdb_type flow_type)
+{
+	mapper_cparms->app_priority = priority;
+	mapper_cparms->dir_attr = params->dir_attr;
+
+	mapper_cparms->class_tid = class_id;
+	mapper_cparms->act_tid = act_tmpl;
+	mapper_cparms->func_id = func_id;
+	mapper_cparms->hdr_bitmap = &params->hdr_bitmap;
+	mapper_cparms->hdr_field = params->hdr_field;
+	mapper_cparms->comp_fld = params->comp_fld;
+	mapper_cparms->act = &params->act_bitmap;
+	mapper_cparms->act_prop = &params->act_prop;
+	mapper_cparms->flow_type = flow_type;
+	mapper_cparms->flow_id = fid;
+}
+
 /* Function to create the rte flow. */
 static struct rte_flow *
 bnxt_ulp_flow_create(struct rte_eth_dev *dev,
@@ -85,22 +108,23 @@ bnxt_ulp_flow_create(struct rte_eth_dev *dev,
 	struct bnxt_ulp_mapper_create_parms mapper_cparms = { 0 };
 	struct ulp_rte_parser_params params;
 	struct bnxt_ulp_context *ulp_ctx;
+	int rc, ret = BNXT_TF_RC_ERROR;
 	uint32_t class_id, act_tmpl;
 	struct rte_flow *flow_id;
+	uint16_t func_id;
 	uint32_t fid;
-	int ret = BNXT_TF_RC_ERROR;
 
 	if (bnxt_ulp_flow_validate_args(attr,
 					pattern, actions,
 					error) == BNXT_TF_RC_ERROR) {
 		BNXT_TF_DBG(ERR, "Invalid arguments being passed\n");
-		goto parse_error;
+		goto parse_err1;
 	}
 
 	ulp_ctx = bnxt_ulp_eth_dev_ptr2_cntxt_get(dev);
 	if (!ulp_ctx) {
 		BNXT_TF_DBG(ERR, "ULP context is not initialized\n");
-		goto parse_error;
+		goto parse_err1;
 	}
 
 	/* Initialize the parser params */
@@ -116,56 +140,72 @@ bnxt_ulp_flow_create(struct rte_eth_dev *dev,
 	ULP_COMP_FLD_IDX_WR(&params, BNXT_ULP_CF_IDX_SVIF_FLAG,
 			    BNXT_ULP_INVALID_SVIF_VAL);
 
+	/* Get the function id */
+	if (ulp_port_db_port_func_id_get(ulp_ctx,
+					 dev->data->port_id,
+					 &func_id)) {
+		BNXT_TF_DBG(ERR, "conversion of port to func id failed\n");
+		goto parse_err1;
+	}
+
+	/* Protect flow creation */
+	if (bnxt_ulp_cntxt_acquire_fdb_lock(ulp_ctx)) {
+		BNXT_TF_DBG(ERR, "Flow db lock acquire failed\n");
+		goto parse_err1;
+	}
+
+	/* Allocate a Flow ID for attaching all resources for the flow to.
+	 * Once allocated, all errors have to walk the list of resources and
+	 * free each of them.
+	 */
+	rc = ulp_flow_db_fid_alloc(ulp_ctx, BNXT_ULP_FDB_TYPE_REGULAR,
+				   func_id, &fid);
+	if (rc) {
+		BNXT_TF_DBG(ERR, "Unable to allocate flow table entry\n");
+		goto parse_err2;
+	}
+
 	/* Parse the rte flow pattern */
 	ret = bnxt_ulp_rte_parser_hdr_parse(pattern, &params);
 	if (ret != BNXT_TF_RC_SUCCESS)
-		goto parse_error;
+		goto parse_err3;
 
 	/* Parse the rte flow action */
 	ret = bnxt_ulp_rte_parser_act_parse(actions, &params);
 	if (ret != BNXT_TF_RC_SUCCESS)
-		goto parse_error;
+		goto parse_err3;
 
 	/* Perform the rte flow post process */
 	ret = bnxt_ulp_rte_parser_post_process(&params);
 	if (ret != BNXT_TF_RC_SUCCESS)
-		goto parse_error;
+		goto parse_err3;
 
 	ret = ulp_matcher_pattern_match(&params, &class_id);
 	if (ret != BNXT_TF_RC_SUCCESS)
-		goto parse_error;
+		goto parse_err3;
 
 	ret = ulp_matcher_action_match(&params, &act_tmpl);
 	if (ret != BNXT_TF_RC_SUCCESS)
-		goto parse_error;
+		goto parse_err3;
 
-	mapper_cparms.app_priority = attr->priority;
-	mapper_cparms.hdr_bitmap = &params.hdr_bitmap;
-	mapper_cparms.hdr_field = params.hdr_field;
-	mapper_cparms.comp_fld = params.comp_fld;
-	mapper_cparms.act = &params.act_bitmap;
-	mapper_cparms.act_prop = &params.act_prop;
-	mapper_cparms.class_tid = class_id;
-	mapper_cparms.act_tid = act_tmpl;
-	mapper_cparms.flow_type = BNXT_ULP_FDB_TYPE_REGULAR;
+	bnxt_ulp_init_mapper_params(&mapper_cparms, &params, attr->priority,
+				    class_id, act_tmpl, func_id, fid,
+				    BNXT_ULP_FDB_TYPE_REGULAR);
+	/* Call the ulp mapper to create the flow in the hardware. */
+	ret = ulp_mapper_flow_create(ulp_ctx, &mapper_cparms);
+	if (ret)
+		goto parse_err3;
 
-	/* Get the function id */
-	if (ulp_port_db_port_func_id_get(ulp_ctx,
-					 dev->data->port_id,
-					 &mapper_cparms.func_id)) {
-		BNXT_TF_DBG(ERR, "conversion of port to func id failed\n");
-		goto parse_error;
-	}
-	mapper_cparms.dir_attr = params.dir_attr;
+	bnxt_ulp_cntxt_release_fdb_lock(ulp_ctx);
 
-	/* Call the ulp mapper to create the flow in the hardware. */
-	ret = ulp_mapper_flow_create(ulp_ctx, &mapper_cparms, &fid);
-	if (!ret) {
-		flow_id = (struct rte_flow *)((uintptr_t)fid);
-		return flow_id;
-	}
+	flow_id = (struct rte_flow *)((uintptr_t)fid);
+	return flow_id;
 
-parse_error:
+parse_err3:
+	ulp_flow_db_fid_free(ulp_ctx, BNXT_ULP_FDB_TYPE_REGULAR, fid);
+parse_err2:
+	bnxt_ulp_cntxt_release_fdb_lock(ulp_ctx);
+parse_err1:
 	rte_flow_error_set(error, ret, RTE_FLOW_ERROR_TYPE_HANDLE, NULL,
 			   "Failed to create flow.");
 	return NULL;
@@ -281,6 +321,10 @@ bnxt_ulp_flow_destroy(struct rte_eth_dev *dev,
 		return -EINVAL;
 	}
 
+	if (bnxt_ulp_cntxt_acquire_fdb_lock(ulp_ctx)) {
+		BNXT_TF_DBG(ERR, "Flow db lock acquire failed\n");
+		return -EINVAL;
+	}
 	ret = ulp_mapper_flow_destroy(ulp_ctx, BNXT_ULP_FDB_TYPE_REGULAR,
 				      flow_id);
 	if (ret) {
@@ -290,6 +334,7 @@ bnxt_ulp_flow_destroy(struct rte_eth_dev *dev,
 					   RTE_FLOW_ERROR_TYPE_HANDLE, NULL,
 					   "Failed to destroy flow.");
 	}
+	bnxt_ulp_cntxt_release_fdb_lock(ulp_ctx);
 
 	return ret;
 }
drivers/net/bnxt/tf_ulp/ulp_def_rules.c +41 -7

81 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_mapper.c +3 -32
index 27b4780990..d5c129b3a6 100644
@@ -2723,15 +2723,9 @@ ulp_mapper_flow_destroy(struct bnxt_ulp_context *ulp_ctx,
 		BNXT_TF_DBG(ERR, "Invalid parms, unable to free flow\n");
 		return -EINVAL;
 	}
-	if (bnxt_ulp_cntxt_acquire_fdb_lock(ulp_ctx)) {
-		BNXT_TF_DBG(ERR, "Flow db lock acquire failed\n");
-		return -EINVAL;
-	}
 
 	rc = ulp_mapper_resources_free(ulp_ctx, flow_type, fid);
-	bnxt_ulp_cntxt_release_fdb_lock(ulp_ctx);
 	return rc;
-
 }
 
 /* Function to handle the default global templates that are allocated during
@@ -2795,8 +2789,7 @@ ulp_mapper_glb_template_table_init(struct bnxt_ulp_context *ulp_ctx)
  */
 int32_t
 ulp_mapper_flow_create(struct bnxt_ulp_context *ulp_ctx,
-		       struct bnxt_ulp_mapper_create_parms *cparms,
-		       uint32_t *flowid)
+		       struct bnxt_ulp_mapper_create_parms *cparms)
 {
 	struct bnxt_ulp_mapper_parms parms;
 	struct ulp_regfile regfile;
@@ -2821,6 +2814,7 @@ ulp_mapper_flow_create(struct bnxt_ulp_context *ulp_ctx,
 	parms.flow_type = cparms->flow_type;
 	parms.parent_flow = cparms->parent_flow;
 	parms.parent_fid = cparms->parent_fid;
+	parms.fid = cparms->flow_id;
 
 	/* Get the device id from the ulp context */
 	if (bnxt_ulp_cntxt_dev_id_get(ulp_ctx, &parms.dev_id)) {
@@ -2861,26 +2855,7 @@ ulp_mapper_flow_create(struct bnxt_ulp_context *ulp_ctx,
 		return -EINVAL;
 	}
 
-	/* Protect flow creation */
-	if (bnxt_ulp_cntxt_acquire_fdb_lock(ulp_ctx)) {
-		BNXT_TF_DBG(ERR, "Flow db lock acquire failed\n");
-		return -EINVAL;
-	}
-
-	/* Allocate a Flow ID for attaching all resources for the flow to.
-	 * Once allocated, all errors have to walk the list of resources and
-	 * free each of them.
-	 */
-	rc = ulp_flow_db_fid_alloc(ulp_ctx,
-				   parms.flow_type,
-				   cparms->func_id,
-				   &parms.fid);
-	if (rc) {
-		BNXT_TF_DBG(ERR, "Unable to allocate flow table entry\n");
-		bnxt_ulp_cntxt_release_fdb_lock(ulp_ctx);
-		return rc;
-	}
-
+	/* Process the action template list from the selected action table*/
 	if (parms.act_tid) {
 		parms.tmpl_type = BNXT_ULP_TEMPLATE_TYPE_ACTION;
 		/* Process the action template tables */
@@ -2911,13 +2886,9 @@ ulp_mapper_flow_create(struct bnxt_ulp_context *ulp_ctx,
 			goto flow_error;
 	}
 
-	*flowid = parms.fid;
-	bnxt_ulp_cntxt_release_fdb_lock(ulp_ctx);
-
 	return rc;
 
 flow_error:
-	bnxt_ulp_cntxt_release_fdb_lock(ulp_ctx);
 	/* Free all resources that were allocated during flow creation */
 	trc = ulp_mapper_flow_destroy(ulp_ctx, BNXT_ULP_FDB_TYPE_REGULAR,
 				      parms.fid);
drivers/net/bnxt/tf_ulp/ulp_mapper.h +2 -2
index 542e41e5aa..0595d1555d 100644
@@ -93,6 +93,7 @@ struct bnxt_ulp_mapper_create_parms {
 	uint32_t			dir_attr;
 	enum bnxt_ulp_fdb_type		flow_type;
 
+	uint32_t			flow_id;
 	/* if set then create it as a child flow with parent as parent_fid */
 	uint32_t			parent_fid;
 	/* if set then create a parent flow */
@@ -113,8 +114,7 @@ ulp_mapper_deinit(struct bnxt_ulp_context *ulp_ctx);
  */
 int32_t
 ulp_mapper_flow_create(struct bnxt_ulp_context	*ulp_ctx,
-		       struct bnxt_ulp_mapper_create_parms *parms,
-		       uint32_t *flowid);
+		       struct bnxt_ulp_mapper_create_parms *parms);
 
 /* Function that frees all resources associated with the flow. */
 int32_t
drivers/net/bnxt/tf_ulp/ulp_rte_parser.h +9 -0
index 41f3df998e..bb5a8a477e 100644
@@ -11,6 +11,7 @@
 #include <rte_flow_driver.h>
 #include "ulp_template_db_enum.h"
 #include "ulp_template_struct.h"
+#include "ulp_mapper.h"
 
 /* defines to be used in the tunnel header parsing */
 #define BNXT_ULP_ENCAP_IPV4_VER_HLEN_TOS	2
@@ -34,6 +35,14 @@
 #define	BNXT_ULP_PARSER_IPV6_TC			0x0ff00000
 #define	BNXT_ULP_PARSER_IPV6_FLOW_LABEL		0x000fffff
 
+void
+bnxt_ulp_init_mapper_params(struct bnxt_ulp_mapper_create_parms *mapper_cparms,
+			    struct ulp_rte_parser_params *params,
+			    uint32_t priority, uint32_t class_id,
+			    uint32_t act_tmpl, uint16_t func_id,
+			    uint32_t flow_id,
+			    enum bnxt_ulp_fdb_type flow_type);
+
 /* Function to handle the parsing of the RTE port id. */
 int32_t
 ulp_rte_parser_implicit_match_port_process(struct ulp_rte_parser_params *param);
Signature · 1 line
2.21.1 (Apple Git-122.3)
#44 lore raw

PATCH v4 10/15 net/bnxt: add VXLAN decap templates

In reply to Ajit Khaparde

From: Venkat Duvvuru <[email protected]>

Templates for outer tunnel & inner tunnel flow are added in this patch. This will be used by subsequent patches to implement support for VXLAN decap rte_flow offload.

---
 drivers/net/bnxt/tf_ulp/ulp_rte_parser.c      |   10 +
 drivers/net/bnxt/tf_ulp/ulp_rte_parser.h      |    5 +
 .../net/bnxt/tf_ulp/ulp_template_db_class.c   |  962 ++++---
 .../net/bnxt/tf_ulp/ulp_template_db_enum.h    |   35 +-
 .../net/bnxt/tf_ulp/ulp_template_db_field.h   |  363 ++-
 .../tf_ulp/ulp_template_db_stingray_act.c     |  116 +-
 .../tf_ulp/ulp_template_db_stingray_class.c   | 2493 ++++++++++++++---
 drivers/net/bnxt/tf_ulp/ulp_template_db_tbl.c |    9 +-
 .../bnxt/tf_ulp/ulp_template_db_wh_plus_act.c |  116 +-
 .../tf_ulp/ulp_template_db_wh_plus_class.c    | 2489 +++++++++++++---
 10 files changed, 5127 insertions(+), 1471 deletions(-)
drivers/net/bnxt/tf_ulp/ulp_rte_parser.c +10 -0
index 770fec55c2..42021ae8d5 100644
@@ -2110,3 +2110,13 @@ ulp_rte_dec_ttl_act_handler(const struct rte_flow_action *act __rte_unused,
 	ULP_BITMAP_SET(params->act_bitmap.bits, BNXT_ULP_ACTION_BIT_DEC_TTL);
 	return BNXT_TF_RC_SUCCESS;
 }
+
+/* Function to handle the parsing of RTE Flow action JUMP */
+int32_t
+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);
+	return BNXT_TF_RC_SUCCESS;
+}
drivers/net/bnxt/tf_ulp/ulp_rte_parser.h +5 -0
index bb5a8a477e..a71aabe5f0 100644
@@ -233,4 +233,9 @@ int32_t
 ulp_rte_dec_ttl_act_handler(const struct rte_flow_action *action_item,
 			    struct ulp_rte_parser_params *params);
 
+/* Function to handle the parsing of RTE Flow action JUMP .*/
+int32_t
+ulp_rte_jump_act_handler(const struct rte_flow_action *action_item,
+			 struct ulp_rte_parser_params *params);
+
 #endif /* _ULP_RTE_PARSER_H_ */
drivers/net/bnxt/tf_ulp/ulp_template_db_class.c +645 -317

1,476 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_template_db_enum.h +30 -5
index 6dade9afdb..10838f5cc2 100644
@@ -11,7 +11,7 @@
 #define BNXT_ULP_LOG2_MAX_NUM_DEV 2
 #define BNXT_ULP_CACHE_TBL_MAX_SZ 4
 #define BNXT_ULP_CLASS_SIG_TBL_MAX_SZ 2048
-#define BNXT_ULP_CLASS_MATCH_LIST_MAX_SZ 201
+#define BNXT_ULP_CLASS_MATCH_LIST_MAX_SZ 217
 #define BNXT_ULP_CLASS_HID_LOW_PRIME 7919
 #define BNXT_ULP_CLASS_HID_HIGH_PRIME 7907
 #define BNXT_ULP_CLASS_HID_SHFTR 32
@@ -52,7 +52,8 @@ enum bnxt_ulp_action_bit {
 	BNXT_ULP_ACTION_BIT_SET_TP_SRC       = 0x0000000000100000,
 	BNXT_ULP_ACTION_BIT_SET_TP_DST       = 0x0000000000200000,
 	BNXT_ULP_ACTION_BIT_VXLAN_ENCAP      = 0x0000000000400000,
-	BNXT_ULP_ACTION_BIT_LAST             = 0x0000000000800000
+	BNXT_ULP_ACTION_BIT_JUMP             = 0x0000000000800000,
+	BNXT_ULP_ACTION_BIT_LAST             = 0x0000000001000000
 };
 
 enum bnxt_ulp_hdr_bit {
@@ -72,7 +73,8 @@ enum bnxt_ulp_hdr_bit {
 	BNXT_ULP_HDR_BIT_I_IPV6              = 0x0000000000002000,
 	BNXT_ULP_HDR_BIT_I_TCP               = 0x0000000000004000,
 	BNXT_ULP_HDR_BIT_I_UDP               = 0x0000000000008000,
-	BNXT_ULP_HDR_BIT_LAST                = 0x0000000000010000
+	BNXT_ULP_HDR_BIT_F1                  = 0x0000000000010000,
+	BNXT_ULP_HDR_BIT_LAST                = 0x0000000000020000
 };
 
 enum bnxt_ulp_act_type {
@@ -341,6 +343,10 @@ enum bnxt_ulp_resource_sub_type {
 enum bnxt_ulp_sym {
 	BNXT_ULP_SYM_PKT_TYPE_IGNORE = 0,
 	BNXT_ULP_SYM_PKT_TYPE_L2 = 0,
+	BNXT_ULP_SYM_PKT_TYPE_0_IGNORE = 0,
+	BNXT_ULP_SYM_PKT_TYPE_0_L2 = 0,
+	BNXT_ULP_SYM_PKT_TYPE_1_IGNORE = 0,
+	BNXT_ULP_SYM_PKT_TYPE_1_L2 = 0,
 	BNXT_ULP_SYM_RECYCLE_CNT_IGNORE = 0,
 	BNXT_ULP_SYM_RECYCLE_CNT_ZERO = 0,
 	BNXT_ULP_SYM_RECYCLE_CNT_ONE = 1,
@@ -551,7 +557,8 @@ enum bnxt_ulp_sym {
 	BNXT_ULP_SYM_IP_PROTO_UDP = 17,
 	BNXT_ULP_SYM_VF_FUNC_PARIF = 15,
 	BNXT_ULP_SYM_NO = 0,
-	BNXT_ULP_SYM_YES = 1
+	BNXT_ULP_SYM_YES = 1,
+	BNXT_ULP_SYM_RECYCLE_DST = 0x800
 };
 
 enum bnxt_ulp_wh_plus {
@@ -600,6 +607,7 @@ enum bnxt_ulp_act_prop_sz {
 	BNXT_ULP_ACT_PROP_SZ_ENCAP_IP_SRC = 16,
 	BNXT_ULP_ACT_PROP_SZ_ENCAP_UDP = 4,
 	BNXT_ULP_ACT_PROP_SZ_ENCAP_TUN = 32,
+	BNXT_ULP_ACT_PROP_SZ_JUMP = 4,
 	BNXT_ULP_ACT_PROP_SZ_LAST = 4
 };
 
@@ -644,7 +652,8 @@ enum bnxt_ulp_act_prop_idx {
 	BNXT_ULP_ACT_PROP_IDX_ENCAP_IP_SRC = 205,
 	BNXT_ULP_ACT_PROP_IDX_ENCAP_UDP = 221,
 	BNXT_ULP_ACT_PROP_IDX_ENCAP_TUN = 225,
-	BNXT_ULP_ACT_PROP_IDX_LAST = 257
+	BNXT_ULP_ACT_PROP_IDX_JUMP = 257,
+	BNXT_ULP_ACT_PROP_IDX_LAST = 261
 };
 
 enum bnxt_ulp_class_hid {
@@ -796,6 +805,22 @@ enum bnxt_ulp_class_hid {
 	BNXT_ULP_CLASS_HID_05b9 = 0x05b9,
 	BNXT_ULP_CLASS_HID_0371 = 0x0371,
 	BNXT_ULP_CLASS_HID_00e1 = 0x00e1,
+	BNXT_ULP_CLASS_HID_0000 = 0x0000,
+	BNXT_ULP_CLASS_HID_00ce = 0x00ce,
+	BNXT_ULP_CLASS_HID_01b6 = 0x01b6,
+	BNXT_ULP_CLASS_HID_0074 = 0x0074,
+	BNXT_ULP_CLASS_HID_00fe = 0x00fe,
+	BNXT_ULP_CLASS_HID_03bc = 0x03bc,
+	BNXT_ULP_CLASS_HID_0206 = 0x0206,
+	BNXT_ULP_CLASS_HID_02c4 = 0x02c4,
+	BNXT_ULP_CLASS_HID_055a = 0x055a,
+	BNXT_ULP_CLASS_HID_045a = 0x045a,
+	BNXT_ULP_CLASS_HID_061a = 0x061a,
+	BNXT_ULP_CLASS_HID_051a = 0x051a,
+	BNXT_ULP_CLASS_HID_074a = 0x074a,
+	BNXT_ULP_CLASS_HID_004e = 0x004e,
+	BNXT_ULP_CLASS_HID_040a = 0x040a,
+	BNXT_ULP_CLASS_HID_010e = 0x010e,
 	BNXT_ULP_CLASS_HID_048b = 0x048b,
 	BNXT_ULP_CLASS_HID_0749 = 0x0749,
 	BNXT_ULP_CLASS_HID_05f1 = 0x05f1,
drivers/net/bnxt/tf_ulp/ulp_template_db_field.h +263 -100

434 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_template_db_stingray_act.c +58 -58

319 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_template_db_stingray_class.c +2027 -466

666 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_template_db_tbl.c +6 -3
index 7f5a316804..c5f340d7bb 100644

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

drivers/net/bnxt/tf_ulp/ulp_template_db_wh_plus_act.c +58 -58

116 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_template_db_wh_plus_class.c +2025 -464

2,489 lines not on this page · raw message

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

Signature · 1 line
2.21.1 (Apple Git-122.3)

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

#45 lore raw

PATCH v4 11/15 net/bnxt: add VXLAN decap offload support

In reply to Ajit Khaparde

From: Venkat Duvvuru <[email protected]>

VXLAN decap offload can happen in stages. The offload request may not come as a single flow request rather may come as two flow offload requests F1 & F2. This patch is adding support for this two stage offload design. The match criteria for F1 is O_DMAC, O_SMAC, O_DST_IP, O_UDP_DPORT and actions are COUNT, MARK, JUMP. The match criteria for F2 is O_SRC_IP, O_DST_IP, VNI and inner header fields. F1 and F2 flow offload requests can come in any order. If F2 flow offload request comes first then F2 can’t be offloaded as there is no O_DMAC information in F2. In this case, F2 will be deferred until F1 flow offload request arrives. When F1 flow offload request is received it will have O_DMAC information. Using F1’s O_DMAC, driver creates an L2 context entry in the hardware as part of offloading F1. F2 will now use F1’s O_DMAC to get the L2 context id associated with this O_DMAC and other flow fields that are cached already at the time of deferring F2 for offloading. F2s that arrive after F1 is offloaded will be directly programmed and not cached.

---
 doc/guides/nics/bnxt.rst                      |  18 +
 doc/guides/rel_notes/release_20_11.rst        |   1 +
 drivers/net/bnxt/meson.build                  |   1 +
 drivers/net/bnxt/tf_ulp/bnxt_tf_common.h      |   4 +-
 drivers/net/bnxt/tf_ulp/bnxt_ulp.c            |  10 +
 drivers/net/bnxt/tf_ulp/bnxt_ulp.h            |  12 +
 drivers/net/bnxt/tf_ulp/bnxt_ulp_flow.c       |  84 ++---
 drivers/net/bnxt/tf_ulp/ulp_flow_db.c         | 149 +++++++--
 drivers/net/bnxt/tf_ulp/ulp_flow_db.h         |   2 +
 drivers/net/bnxt/tf_ulp/ulp_mapper.c          |   1 +
 drivers/net/bnxt/tf_ulp/ulp_mapper.h          |   2 +
 drivers/net/bnxt/tf_ulp/ulp_rte_parser.c      |  75 ++++-
 drivers/net/bnxt/tf_ulp/ulp_rte_parser.h      |   4 +-
 .../net/bnxt/tf_ulp/ulp_template_db_enum.h    |   4 +-
 drivers/net/bnxt/tf_ulp/ulp_template_struct.h |   7 +
 drivers/net/bnxt/tf_ulp/ulp_tun.c             | 310 ++++++++++++++++++
 drivers/net/bnxt/tf_ulp/ulp_tun.h             |  92 ++++++
 17 files changed, 694 insertions(+), 82 deletions(-)
 create mode 100644 drivers/net/bnxt/tf_ulp/ulp_tun.c
 create mode 100644 drivers/net/bnxt/tf_ulp/ulp_tun.h
doc/guides/nics/bnxt.rst +18 -0
index 2540ddd5c2..bf2ef19adb 100644
@@ -703,6 +703,24 @@ Notes
   flows to be directed to one or more queues associated with the VNIC id.
   This implementation is supported only when TRUFLOW functionality is disabled.
 
+- An application can issue a VXLAN decap offload request using rte_flow API
+  either as a single rte_flow request or a combination of two stages.
+  The PMD currently supports the two stage offload design.
+  In this approach the offload request may come as two flow offload requests
+  Flow1 & Flow2.  The match criteria for Flow1 is O_DMAC, O_SMAC, O_DST_IP,
+  O_UDP_DPORT and actions are COUNT, MARK, JUMP. The match criteria for Flow2
+  is O_SRC_IP, O_DST_IP, VNI and inner header fields.
+  Flow1 and Flow2 flow offload requests can come in any order. If Flow2 flow
+  offload request comes first then Flow2 can’t be offloaded as there is
+  no O_DMAC information in Flow2. In this case, Flow2 will be deferred until
+  Flow1 flow offload request arrives. When Flow1 flow offload request is
+  received it will have O_DMAC information. Using Flow1’s O_DMAC, driver
+  creates an L2 context entry in the hardware as part of offloading Flow1.
+  Flow2 will now use Flow1’s O_DMAC to get the L2 context id associated with
+  this O_DMAC and other flow fields that are cached already at the time
+  of deferring Flow2 for offloading. Flow2 that arrive after Flow1 is offloaded
+  will be directly programmed and not cached.
+
 Note: A VNIC represents a virtual interface in the hardware. It is a resource
 in the RX path of the chip and is used to setup various target actions such as
 RSS, MAC filtering etc. for the physical function in use.
doc/guides/rel_notes/release_20_11.rst +1 -0
index edbcaf170b..471c670317 100644
@@ -148,6 +148,7 @@ New Features
   * Updated HWRM structures to 1.10.1.70 version.
   * Added TRUFLOW support for Stingray devices.
   * Added support for representors on MAIA cores of SR.
+  * Added support for VXLAN decap offload using rte_flow.
 
 * **Updated Cisco enic driver.**
 
drivers/net/bnxt/meson.build +1 -0
index 9c153c402b..2896337b5d 100644
@@ -64,6 +64,7 @@ sources = files('bnxt_cpr.c',
 	'tf_ulp/ulp_port_db.c',
 	'tf_ulp/ulp_def_rules.c',
 	'tf_ulp/ulp_fc_mgr.c',
+	'tf_ulp/ulp_tun.c',
 	'tf_ulp/ulp_template_db_wh_plus_act.c',
 	'tf_ulp/ulp_template_db_wh_plus_class.c',
 	'tf_ulp/ulp_template_db_stingray_act.c',
drivers/net/bnxt/tf_ulp/bnxt_tf_common.h +3 -1
index f0633f009c..b2629e47b6 100644
@@ -33,7 +33,9 @@
 enum bnxt_tf_rc {
 	BNXT_TF_RC_PARSE_ERR	= -2,
 	BNXT_TF_RC_ERROR	= -1,
-	BNXT_TF_RC_SUCCESS	= 0
+	BNXT_TF_RC_SUCCESS	= 0,
+	BNXT_TF_RC_NORMAL	= 1,
+	BNXT_TF_RC_FID		= 2,
 };
 
 /* eth IPv4 Type */
drivers/net/bnxt/tf_ulp/bnxt_ulp.c +10 -0
index d753b5af9f..26fd3009f2 100644
@@ -1321,6 +1321,16 @@ bnxt_ulp_cntxt_ptr2_flow_db_get(struct bnxt_ulp_context	*ulp_ctx)
 	return ulp_ctx->cfg_data->flow_db;
 }
 
+/* Function to get the tunnel cache table info from the ulp context. */
+struct bnxt_tun_cache_entry *
+bnxt_ulp_cntxt_ptr2_tun_tbl_get(struct bnxt_ulp_context *ulp_ctx)
+{
+	if (!ulp_ctx || !ulp_ctx->cfg_data)
+		return NULL;
+
+	return ulp_ctx->cfg_data->tun_tbl;
+}
+
 /* Function to get the ulp context from eth device. */
 struct bnxt_ulp_context	*
 bnxt_ulp_eth_dev_ptr2_cntxt_get(struct rte_eth_dev	*dev)
drivers/net/bnxt/tf_ulp/bnxt_ulp.h +12 -0
index c2c5bcb1d2..db1ee50c05 100644
@@ -13,6 +13,8 @@
 #include "rte_ethdev.h"
 
 #include "ulp_template_db_enum.h"
+#include "ulp_tun.h"
+#include "bnxt_tf_common.h"
 
 /* NAT defines to reuse existing inner L2 SMAC and DMAC */
 #define BNXT_ULP_NAT_INNER_L2_HEADER_SMAC	0x2000
@@ -55,6 +57,9 @@ struct bnxt_ulp_data {
 	struct bnxt_ulp_df_rule_info	df_rule_info[RTE_MAX_ETHPORTS];
 	struct bnxt_ulp_vfr_rule_info	vfr_rule_info[RTE_MAX_ETHPORTS];
 	enum bnxt_ulp_flow_mem_type	mem_type;
+#define	BNXT_ULP_TUN_ENTRY_INVALID	-1
+#define	BNXT_ULP_MAX_TUN_CACHE_ENTRIES	16
+	struct bnxt_tun_cache_entry	tun_tbl[BNXT_ULP_MAX_TUN_CACHE_ENTRIES];
 };
 
 struct bnxt_ulp_context {
@@ -151,6 +156,10 @@ bnxt_ulp_cntxt_ptr2_flow_db_set(struct bnxt_ulp_context	*ulp_ctx,
 struct bnxt_ulp_flow_db	*
 bnxt_ulp_cntxt_ptr2_flow_db_get(struct bnxt_ulp_context	*ulp_ctx);
 
+/* Function to get the tunnel cache table info from the ulp context. */
+struct bnxt_tun_cache_entry *
+bnxt_ulp_cntxt_ptr2_tun_tbl_get(struct bnxt_ulp_context	*ulp_ctx);
+
 /* Function to get the ulp context from eth device. */
 struct bnxt_ulp_context	*
 bnxt_ulp_eth_dev_ptr2_cntxt_get(struct rte_eth_dev *dev);
@@ -214,4 +223,7 @@ bnxt_ulp_cntxt_acquire_fdb_lock(struct bnxt_ulp_context	*ulp_ctx);
 void
 bnxt_ulp_cntxt_release_fdb_lock(struct bnxt_ulp_context	*ulp_ctx);
 
+int32_t
+ulp_post_process_tun_flow(struct ulp_rte_parser_params *params);
+
 #endif /* _BNXT_ULP_H_ */
drivers/net/bnxt/tf_ulp/bnxt_ulp_flow.c +44 -40

179 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_flow_db.c +120 -29

191 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_flow_db.h +2 -0
index 10e69bae45..f7dfd67bed 100644
@@ -60,6 +60,8 @@ struct ulp_fdb_parent_info {
 	uint64_t	pkt_count;
 	uint64_t	byte_count;
 	uint64_t	*child_fid_bitset;
+	uint32_t	f2_cnt;
+	uint8_t		tun_idx;
 };
 
 /* Structure to maintain parent-child flow relationships */
drivers/net/bnxt/tf_ulp/ulp_mapper.c +1 -0
index d5c129b3a6..29643232d8 100644
@@ -2815,6 +2815,7 @@ ulp_mapper_flow_create(struct bnxt_ulp_context *ulp_ctx,
 	parms.parent_flow = cparms->parent_flow;
 	parms.parent_fid = cparms->parent_fid;
 	parms.fid = cparms->flow_id;
+	parms.tun_idx = cparms->tun_idx;
 
 	/* Get the device id from the ulp context */
 	if (bnxt_ulp_cntxt_dev_id_get(ulp_ctx, &parms.dev_id)) {
drivers/net/bnxt/tf_ulp/ulp_mapper.h +2 -0
index 0595d1555d..9bd94f5c29 100644
@@ -78,6 +78,7 @@ struct bnxt_ulp_mapper_parms {
 	struct bnxt_ulp_device_params           *device_params;
 	uint32_t				parent_fid;
 	uint32_t				parent_flow;
+	uint8_t					tun_idx;
 };
 
 struct bnxt_ulp_mapper_create_parms {
@@ -98,6 +99,7 @@ struct bnxt_ulp_mapper_create_parms {
 	uint32_t			parent_fid;
 	/* if set then create a parent flow */
 	uint32_t			parent_flow;
+	uint8_t				tun_idx;
 };
 
 /* Function to initialize any dynamic mapper data. */
drivers/net/bnxt/tf_ulp/ulp_rte_parser.c +67 -8

138 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_rte_parser.h +1 -3
index a71aabe5f0..7996317903 100644
@@ -12,6 +12,7 @@
 #include "ulp_template_db_enum.h"
 #include "ulp_template_struct.h"
 #include "ulp_mapper.h"
+#include "bnxt_tf_common.h"
 
 /* defines to be used in the tunnel header parsing */
 #define BNXT_ULP_ENCAP_IPV4_VER_HLEN_TOS	2
@@ -38,9 +39,6 @@
 void
 bnxt_ulp_init_mapper_params(struct bnxt_ulp_mapper_create_parms *mapper_cparms,
 			    struct ulp_rte_parser_params *params,
-			    uint32_t priority, uint32_t class_id,
-			    uint32_t act_tmpl, uint16_t func_id,
-			    uint32_t flow_id,
 			    enum bnxt_ulp_fdb_type flow_type);
 
 /* Function to handle the parsing of the RTE port id. */
drivers/net/bnxt/tf_ulp/ulp_template_db_enum.h +3 -1
index 10838f5cc2..6802debbb7 100644
@@ -135,7 +135,9 @@ enum bnxt_ulp_cf_idx {
 	BNXT_ULP_CF_IDX_L4_HDR_CNT = 41,
 	BNXT_ULP_CF_IDX_VFR_MODE = 42,
 	BNXT_ULP_CF_IDX_LOOPBACK_PARIF = 43,
-	BNXT_ULP_CF_IDX_LAST = 44
+	BNXT_ULP_CF_IDX_L3_TUN = 44,
+	BNXT_ULP_CF_IDX_L3_TUN_DECAP = 45,
+	BNXT_ULP_CF_IDX_LAST = 46
 };
 
 enum bnxt_ulp_cond_opcode {
drivers/net/bnxt/tf_ulp/ulp_template_struct.h +7 -0
index 69bb61e110..9d690a9378 100644
@@ -72,6 +72,13 @@ struct ulp_rte_parser_params {
 	struct ulp_rte_act_bitmap	act_bitmap;
 	struct ulp_rte_act_prop		act_prop;
 	uint32_t			dir_attr;
+	uint32_t			priority;
+	uint32_t			fid;
+	uint32_t			parent_flow;
+	uint32_t			parent_fid;
+	uint16_t			func_id;
+	uint32_t			class_id;
+	uint32_t			act_tmpl;
 	struct bnxt_ulp_context		*ulp_ctx;
 };
 
drivers/net/bnxt/tf_ulp/ulp_tun.c new file +310 -0

310 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_tun.h new file +92 -0

92 lines not on this page · raw message

Signature · 1 line
2.21.1 (Apple Git-122.3)
#46 lore raw

PATCH v4 12/15 net/bnxt: increase the size of Rx CQ

In reply to Ajit Khaparde

LRO aka TPA and jumbo frame support uses aggregation ring for placing Rx buffers. These features can generate multiple Rx completions for a single Rx packet. Increase size of Rx Completion Queue to handle TPA and aggregation ring events.

Fixes daef48efe5e5 ("net/bnxt: support set MTU")
---
 drivers/net/bnxt/bnxt_ring.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/bnxt/bnxt_ring.h +1 -1
index daf9804956..3d81f610c1 100644
@@ -27,7 +27,7 @@
 #define DEFAULT_RX_RING_SIZE	256
 #define DEFAULT_TX_RING_SIZE	256
 
-#define AGG_RING_SIZE_FACTOR	2
+#define AGG_RING_SIZE_FACTOR	4
 #define AGG_RING_MULTIPLIER	2
 
 /* These assume 4k pages */
Signature · 1 line
2.21.1 (Apple Git-122.3)
#47 lore raw

PATCH v4 13/15 net/bnxt: fix to reset mbuf data offset

In reply to Ajit Khaparde

Reset mbuf->data_off before handing the Rx packet to the application. We were not doing this in the TPA path. It can cause applications using this field for post processing to work incorrectly.

Fixes 0958d8b6435d ("net/bnxt: support LRO")
---
 drivers/net/bnxt/bnxt_rxr.c | 1 +
 1 file changed, 1 insertion(+)
drivers/net/bnxt/bnxt_rxr.c +1 -0
index 039217fa60..e41833cc43 100644
@@ -150,6 +150,7 @@ static void bnxt_tpa_start(struct bnxt_rx_queue *rxq,
 	tpa_info->mbuf = mbuf;
 	tpa_info->len = rte_le_to_cpu_32(tpa_start->len);
 
+	mbuf->data_off = RTE_PKTMBUF_HEADROOM;
 	mbuf->nb_segs = 1;
 	mbuf->next = NULL;
 	mbuf->pkt_len = rte_le_to_cpu_32(tpa_start->len);
Signature · 1 line
2.21.1 (Apple Git-122.3)
#48 lore raw

PATCH v4 14/15 net/bnxt: set thread safe flow ops flag

In reply to Ajit Khaparde

PMD supports thread-safe flow operations. Set the RTE_ETH_DEV_FLOW_OPS_THREAD_SAFE dev_flag to indicate this info to the application. rte_flow API functions can avoid using its own mutex for safe multi-thread flow handling.

---
 doc/guides/nics/bnxt.rst               | 2 ++
 doc/guides/rel_notes/release_20_11.rst | 1 +
 drivers/net/bnxt/bnxt_ethdev.c         | 6 ++++++
 3 files changed, 9 insertions(+)
doc/guides/nics/bnxt.rst +2 -0
index bf2ef19adb..b38fc0b330 100644
@@ -721,6 +721,8 @@ Notes
   of deferring Flow2 for offloading. Flow2 that arrive after Flow1 is offloaded
   will be directly programmed and not cached.
 
+- PMD supports thread-safe rte_flow operations.
+
 Note: A VNIC represents a virtual interface in the hardware. It is a resource
 in the RX path of the chip and is used to setup various target actions such as
 RSS, MAC filtering etc. for the physical function in use.
doc/guides/rel_notes/release_20_11.rst +1 -0
index 471c670317..367ccb3248 100644
@@ -149,6 +149,7 @@ New Features
   * Added TRUFLOW support for Stingray devices.
   * Added support for representors on MAIA cores of SR.
   * Added support for VXLAN decap offload using rte_flow.
+  * Added support to indicate native rte_flow API thread safety.
 
 * **Updated Cisco enic driver.**
 
drivers/net/bnxt/bnxt_ethdev.c +6 -0
index a0e01d059d..71ad05dfe9 100644
@@ -3824,6 +3824,12 @@ bnxt_filter_ctrl_op(struct rte_eth_dev *dev,
 	case RTE_ETH_FILTER_GENERIC:
 		if (filter_op != RTE_ETH_FILTER_GET)
 			return -EINVAL;
+
+		/* PMD supports thread-safe flow operations.  rte_flow API
+		 * functions can avoid mutex for multi-thread safety.
+		 */
+		dev->data->dev_flags |= RTE_ETH_DEV_FLOW_OPS_THREAD_SAFE;
+
 		if (BNXT_TRUFLOW_EN(bp))
 			*(const void **)arg = &bnxt_ulp_rte_flow_ops;
 		else
Signature · 1 line
2.21.1 (Apple Git-122.3)
#49 lore raw

PATCH v4 15/15 net/bnxt: fix Rx performance by removing spinlock

In reply to Ajit Khaparde

From: Rahul Gupta <[email protected]>

The spinlock was trying to protect scenarios where rx_queue stop/start could be initiated dynamically. Assigning bnxt_dummy_recv_pkts and bnxt_dummy_xmit_pkts immediately to avoid concurrent access of mbuf in Rx and cleanup path should help achieve the same result.

Fixes 14255b351537 ("net/bnxt: fix queue start/stop operations")
---
 drivers/net/bnxt/bnxt.h     |  4 ++++
 drivers/net/bnxt/bnxt_cpr.c | 12 ++++++++++++
 drivers/net/bnxt/bnxt_cpr.h |  1 +
 drivers/net/bnxt/bnxt_rxq.c |  4 ----
 drivers/net/bnxt/bnxt_rxq.h |  3 ---
 drivers/net/bnxt/bnxt_rxr.c |  5 +----
 drivers/net/bnxt/bnxt_rxr.h |  2 --
 drivers/net/bnxt/bnxt_txr.h |  2 --
 8 files changed, 18 insertions(+), 15 deletions(-)
drivers/net/bnxt/bnxt.h +4 -0
index 57178192d2..90ced972c0 100644
@@ -890,6 +890,10 @@ void bnxt_print_link_info(struct rte_eth_dev *eth_dev);
 uint16_t bnxt_rss_hash_tbl_size(const struct bnxt *bp);
 int bnxt_link_update_op(struct rte_eth_dev *eth_dev,
 			int wait_to_complete);
+uint16_t bnxt_dummy_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
+			      uint16_t nb_pkts);
+uint16_t bnxt_dummy_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
+			      uint16_t nb_pkts);
 
 extern const struct rte_flow_ops bnxt_flow_ops;
 
drivers/net/bnxt/bnxt_cpr.c +12 -0
index 91d1ffe46c..ee96ae81bf 100644
@@ -121,6 +121,12 @@ void bnxt_handle_async_event(struct bnxt *bp,
 		PMD_DRV_LOG(INFO, "Port conn async event\n");
 		break;
 	case HWRM_ASYNC_EVENT_CMPL_EVENT_ID_RESET_NOTIFY:
+		/*
+		 * Avoid any rx/tx packet processing during firmware reset
+		 * operation.
+		 */
+		bnxt_stop_rxtx(bp);
+
 		/* Ignore reset notify async events when stopping the port */
 		if (!bp->eth_dev->data->dev_started) {
 			bp->flags |= BNXT_FLAG_FATAL_ERROR;
@@ -337,3 +343,9 @@ bool bnxt_is_recovery_enabled(struct bnxt *bp)
 
 	return false;
 }
+
+void bnxt_stop_rxtx(struct bnxt *bp)
+{
+	bp->eth_dev->rx_pkt_burst = &bnxt_dummy_recv_pkts;
+	bp->eth_dev->tx_pkt_burst = &bnxt_dummy_xmit_pkts;
+}
drivers/net/bnxt/bnxt_cpr.h +1 -0
index cccd6cdbe0..ff9697f4c8 100644
@@ -126,4 +126,5 @@ void bnxt_wait_for_device_shutdown(struct bnxt *bp);
 bool bnxt_is_recovery_enabled(struct bnxt *bp);
 bool bnxt_is_master_func(struct bnxt *bp);
 
+void bnxt_stop_rxtx(struct bnxt *bp);
 #endif
drivers/net/bnxt/bnxt_rxq.c +0 -4
index 78514143e5..e0ec342162 100644
@@ -210,8 +210,6 @@ void bnxt_rx_queue_release_mbufs(struct bnxt_rx_queue *rxq)
 	if (!rxq || !rxq->rx_ring)
 		return;
 
-	rte_spinlock_lock(&rxq->lock);
-
 	sw_ring = rxq->rx_ring->rx_buf_ring;
 	if (sw_ring) {
 		for (i = 0;
@@ -248,7 +246,6 @@ void bnxt_rx_queue_release_mbufs(struct bnxt_rx_queue *rxq)
 		}
 	}
 
-	rte_spinlock_unlock(&rxq->lock);
 }
 
 void bnxt_free_rx_mbufs(struct bnxt *bp)
@@ -389,7 +386,6 @@ int bnxt_rx_queue_setup_op(struct rte_eth_dev *eth_dev,
 		rxq->rx_started = true;
 	}
 	eth_dev->data->rx_queue_state[queue_idx] = queue_state;
-	rte_spinlock_init(&rxq->lock);
 
 	/* Configure mtu if it is different from what was configured before */
 	if (!queue_idx)
drivers/net/bnxt/bnxt_rxq.h +0 -3
index 201bda2269..c72105cf06 100644
@@ -16,9 +16,6 @@ struct bnxt;
 struct bnxt_rx_ring_info;
 struct bnxt_cp_ring_info;
 struct bnxt_rx_queue {
-	rte_spinlock_t		lock;	/* Synchronize between rx_queue_stop
-					 * and fast path
-					 */
 	struct rte_mempool	*mb_pool; /* mbuf pool for RX ring */
 	uint64_t		mbuf_initializer; /* val to init mbuf */
 	uint16_t		nb_rx_desc; /* num of RX desc */
drivers/net/bnxt/bnxt_rxr.c +1 -4
index e41833cc43..4a8326e335 100644
@@ -843,8 +843,7 @@ uint16_t bnxt_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
 		return 0;
 
 	/* If Rx Q was stopped return */
-	if (unlikely(!rxq->rx_started ||
-		     !rte_spinlock_trylock(&rxq->lock)))
+	if (unlikely(!rxq->rx_started))
 		return 0;
 
 #if defined(RTE_ARCH_X86) || defined(RTE_ARCH_ARM64)
@@ -946,8 +945,6 @@ uint16_t bnxt_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
 	}
 
 done:
-	rte_spinlock_unlock(&rxq->lock);
-
 	return nb_rx_pkts;
 }
 
drivers/net/bnxt/bnxt_rxr.h +0 -2
index b874e54a8c..2e2d1242eb 100644
@@ -77,8 +77,6 @@ struct bnxt_rx_ring_info {
 
 uint16_t bnxt_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
 			       uint16_t nb_pkts);
-uint16_t bnxt_dummy_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
-			      uint16_t nb_pkts);
 void bnxt_free_rx_rings(struct bnxt *bp);
 int bnxt_init_rx_ring_struct(struct bnxt_rx_queue *rxq, unsigned int socket_id);
 int bnxt_init_one_rx_ring(struct bnxt_rx_queue *rxq);
drivers/net/bnxt/bnxt_txr.h +0 -2
index d241227d4c..3dfc8ef9b4 100644
@@ -49,8 +49,6 @@ int bnxt_init_one_tx_ring(struct bnxt_tx_queue *txq);
 int bnxt_init_tx_ring_struct(struct bnxt_tx_queue *txq, unsigned int socket_id);
 uint16_t bnxt_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
 			       uint16_t nb_pkts);
-uint16_t bnxt_dummy_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
-			      uint16_t nb_pkts);
 #if defined(RTE_ARCH_X86) || defined(RTE_ARCH_ARM64)
 uint16_t bnxt_xmit_pkts_vec(void *tx_queue, struct rte_mbuf **tx_pkts,
 			    uint16_t nb_pkts);
Signature · 1 line
2.21.1 (Apple Git-122.3)
#50 lore raw

Re: [dpdk-dev] [PATCH v4 00/15] bnxt fixes and enhancements

In reply to Ajit Khaparde
Quoted 9 lines · Ajit Khaparde

This patchset has support for VXLAN decap full offload, SR device support in tf_core and a few bug fixes.

v1->v2:
- Squashed some patches.
- Updated commit logs.
- Fixed a compilation issue reported during clang builds.

Quoted 7 lines

v2->v3:
- Added the SPDX header for cfa_resource_types.h in patch [01/11].
- Update commit logs.

v3->v4:
- Addressed review comments.
- Added verbose commit messages.

Patchset applied to dpdk-next-net-brcm.

Quoted 103 lines

Ajit Khaparde (3):
net/bnxt: increase the size of Rx CQ
net/bnxt: fix to reset mbuf data offset
net/bnxt: set thread safe flow ops flag

Farah Smith (1):
net/bnxt: add table scope to PF Mapping

Jay Ding (1):
net/bnxt: support two table scopes

Kishore Padmanabha (2):
net/bnxt: add hierarchical flow counters
net/bnxt: add mapper support for wildcard TCAM

Peter Spreadborough (2):
net/bnxt: add stingray support to core layer
net/bnxt: update ULP resource counts

Rahul Gupta (1):
net/bnxt: fix Rx performance by removing spinlock

Somnath Kotur (2):
net/bnxt: fix flow query count
net/bnxt: modify HWRM command to create reps

Venkat Duvvuru (3):
net/bnxt: refactor flow id allocation
net/bnxt: add VXLAN decap templates
net/bnxt: add VXLAN decap offload support

 doc/guides/nics/bnxt.rst                      |   20 +
 doc/guides/rel_notes/release_20_11.rst        |    3 +
 drivers/net/bnxt/bnxt.h                       |   10 +-
 drivers/net/bnxt/bnxt_cpr.c                   |   12 +
 drivers/net/bnxt/bnxt_cpr.h                   |    1 +
 drivers/net/bnxt/bnxt_ethdev.c                |    8 +
 drivers/net/bnxt/bnxt_hwrm.c                  |   60 +-
 drivers/net/bnxt/bnxt_hwrm.h                  |    2 -
 drivers/net/bnxt/bnxt_reps.c                  |   18 +-
 drivers/net/bnxt/bnxt_ring.h                  |    2 +-
 drivers/net/bnxt/bnxt_rxq.c                   |    4 -
 drivers/net/bnxt/bnxt_rxq.h                   |    3 -
 drivers/net/bnxt/bnxt_rxr.c                   |    6 +-
 drivers/net/bnxt/bnxt_rxr.h                   |    2 -
 drivers/net/bnxt/bnxt_txr.h                   |    2 -
 drivers/net/bnxt/hcapi/hcapi_cfa.h            |   39 +-
 drivers/net/bnxt/meson.build                  |    1 +
 drivers/net/bnxt/tf_core/cfa_resource_types.h |   82 +-
 drivers/net/bnxt/tf_core/tf_core.c            |   57 +-
 drivers/net/bnxt/tf_core/tf_core.h            |   57 +-
 drivers/net/bnxt/tf_core/tf_device.c          |    9 +-
 drivers/net/bnxt/tf_core/tf_device.h          |   47 +-
 drivers/net/bnxt/tf_core/tf_device_p4.c       |   69 +-
 drivers/net/bnxt/tf_core/tf_device_p4.h       |    6 +
 drivers/net/bnxt/tf_core/tf_device_p45.h      |  105 +
 drivers/net/bnxt/tf_core/tf_em.h              |   25 +-
 drivers/net/bnxt/tf_core/tf_em_common.c       |  176 +-
 drivers/net/bnxt/tf_core/tf_em_common.h       |   27 +-
 drivers/net/bnxt/tf_core/tf_em_host.c         |   31 +-
 drivers/net/bnxt/tf_core/tf_global_cfg.c      |    4 +-
 drivers/net/bnxt/tf_core/tf_global_cfg.h      |   42 +-
 drivers/net/bnxt/tf_core/tf_msg.c             |   13 +-
 drivers/net/bnxt/tf_core/tf_msg.h             |    4 +-
 drivers/net/bnxt/tf_core/tf_session.h         |   16 +-
 drivers/net/bnxt/tf_core/tf_tbl.h             |    3 +
 drivers/net/bnxt/tf_core/tfp.c                |   19 +
 drivers/net/bnxt/tf_core/tfp.h                |   16 +
 drivers/net/bnxt/tf_ulp/bnxt_tf_common.h      |    4 +-
 drivers/net/bnxt/tf_ulp/bnxt_ulp.c            |   50 +-
 drivers/net/bnxt/tf_ulp/bnxt_ulp.h            |   12 +
 drivers/net/bnxt/tf_ulp/bnxt_ulp_flow.c       |  129 +-
 drivers/net/bnxt/tf_ulp/ulp_def_rules.c       |   48 +-
 drivers/net/bnxt/tf_ulp/ulp_fc_mgr.c          |  133 +-
 drivers/net/bnxt/tf_ulp/ulp_fc_mgr.h          |   19 +
 drivers/net/bnxt/tf_ulp/ulp_flow_db.c         |  475 +++-
 drivers/net/bnxt/tf_ulp/ulp_flow_db.h         |   46 +
 drivers/net/bnxt/tf_ulp/ulp_mapper.c          |   83 +-
 drivers/net/bnxt/tf_ulp/ulp_mapper.h          |    6 +-
 drivers/net/bnxt/tf_ulp/ulp_rte_parser.c      |   85 +-
 drivers/net/bnxt/tf_ulp/ulp_rte_parser.h      |   12 +
 .../net/bnxt/tf_ulp/ulp_template_db_class.c   |  962 ++++---
 .../net/bnxt/tf_ulp/ulp_template_db_enum.h    |   42 +-
 .../net/bnxt/tf_ulp/ulp_template_db_field.h   |  363 ++-
 .../tf_ulp/ulp_template_db_stingray_act.c     |  116 +-
 .../tf_ulp/ulp_template_db_stingray_class.c   | 2493 ++++++++++++++---
 drivers/net/bnxt/tf_ulp/ulp_template_db_tbl.c |    9 +-
 .../bnxt/tf_ulp/ulp_template_db_wh_plus_act.c |  116 +-
 .../tf_ulp/ulp_template_db_wh_plus_class.c    | 2489 +++++++++++++---
 drivers/net/bnxt/tf_ulp/ulp_template_struct.h |    7 +
 drivers/net/bnxt/tf_ulp/ulp_tun.c             |  310 ++
 drivers/net/bnxt/tf_ulp/ulp_tun.h             |   92 +
 drivers/net/bnxt/tf_ulp/ulp_utils.c           |  125 +
 drivers/net/bnxt/tf_ulp/ulp_utils.h           |   48 +-
 63 files changed, 7225 insertions(+), 2050 deletions(-)
 create mode 100644 drivers/net/bnxt/tf_core/tf_device_p45.h
 create mode 100644 drivers/net/bnxt/tf_ulp/ulp_tun.c
 create mode 100644 drivers/net/bnxt/tf_ulp/ulp_tun.h

--
2.21.1 (Apple Git-122.3)

#51 lore raw

PATCH v3 1/11 net/bnxt: add stingray support to core layer

In reply to Ajit Khaparde

From: Peter Spreadborough <[email protected]>

- Moved P4 specific code under the P4 directory
- Added P45 skeleton code for SR to build on
- Add SR support in TRUFLOW core layer.
The TRUFLOW core or the tf-core is a shim layer which communicates with the CFA block in the hardware.

---
 drivers/net/bnxt/hcapi/hcapi_cfa.h            |  39 +++++--
 drivers/net/bnxt/tf_core/cfa_resource_types.h |  84 +++++---------
 drivers/net/bnxt/tf_core/tf_core.c            |   3 +-
 drivers/net/bnxt/tf_core/tf_core.h            |   2 +-
 drivers/net/bnxt/tf_core/tf_device.c          |   9 +-
 drivers/net/bnxt/tf_core/tf_device_p4.c       |  25 ++++-
 drivers/net/bnxt/tf_core/tf_device_p4.h       |   6 +
 drivers/net/bnxt/tf_core/tf_device_p45.h      | 105 ++++++++++++++++++
 drivers/net/bnxt/tf_core/tf_em.h              |   6 -
 9 files changed, 198 insertions(+), 81 deletions(-)
 create mode 100644 drivers/net/bnxt/tf_core/tf_device_p45.h
drivers/net/bnxt/hcapi/hcapi_cfa.h +29 -10
index c7d87dec73..aa218d714d 100644
@@ -14,7 +14,15 @@
 
 #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
@@ -81,17 +89,20 @@ struct hcapi_cfa_key_result {
 /* common CFA register access macros */
 #define CFA_REG(x)		OFFSETOF(cfa_reg_t, cfa_##x)
 
-#ifndef REG_WR
-#define REG_WR(_p, x, y)  (*((uint32_t volatile *)(x)) = (y))
+#ifndef TF_REG_WR
+#define TF_REG_WR(_p, x, y)  (*((uint32_t volatile *)(x)) = (y))
 #endif
-#ifndef REG_RD
-#define REG_RD(_p, x)  (*((uint32_t volatile *)(x)))
+#ifndef TF_REG_RD
+#define TF_REG_RD(_p, x)  (*((uint32_t volatile *)(x)))
+#endif
+#ifndef TF_CFA_REG_RD
+#define TF_CFA_REG_RD(_p, x)	\
+	TF_REG_RD(0, (uint32_t)(_p)->base_addr + CFA_REG(x))
+#endif
+#ifndef TF_CFA_REG_WR
+#define TF_CFA_REG_WR(_p, x, y)	\
+	TF_REG_WR(0, (uint32_t)(_p)->base_addr + CFA_REG(x), y)
 #endif
-#define CFA_REG_RD(_p, x)	\
-	REG_RD(0, (uint32_t)(_p)->base_addr + CFA_REG(x))
-#define CFA_REG_WR(_p, x, y)	\
-	REG_WR(0, (uint32_t)(_p)->base_addr + CFA_REG(x), y)
-
 
 /* Constants used by Resource Manager Registration*/
 #define RM_CLIENT_NAME_MAX_LEN          32
@@ -248,7 +259,15 @@ int hcapi_cfa_p4_mirror_hwop(struct hcapi_cfa_hwop *op,
 int hcapi_cfa_p4_global_cfg_hwop(struct hcapi_cfa_hwop *op,
 				 uint32_t type,
 				 struct hcapi_cfa_data *config);
-#endif /* SUPPORT_CFA_HW_P4 */
+/* 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
drivers/net/bnxt/tf_core/cfa_resource_types.h +26 -58

110 lines not on this page · raw message

drivers/net/bnxt/tf_core/tf_core.c +2 -1
index 0dbde1de2d..788335b814 100644
@@ -34,7 +34,8 @@ tf_open_session(struct tf *tfp,
 	 * side. It is assumed that the Firmware will be supported if
 	 * firmware open session succeeds.
 	 */
-	if (parms->device_type != TF_DEVICE_TYPE_WH) {
+	if (parms->device_type != TF_DEVICE_TYPE_WH &&
+	    parms->device_type != TF_DEVICE_TYPE_SR) {
 		TFP_DRV_LOG(ERR,
 			    "Unsupported device type %d\n",
 			    parms->device_type);
drivers/net/bnxt/tf_core/tf_core.h +1 -1
index db1093515c..65be8f54a4 100644
@@ -10,7 +10,7 @@
 #include <stdlib.h>
 #include <stdbool.h>
 #include <stdio.h>
-#include "hcapi/hcapi_cfa.h"
+#include "hcapi/hcapi_cfa_defs.h"
 #include "tf_project.h"
 
 /**
drivers/net/bnxt/tf_core/tf_device.c +7 -2
index 1129440955..8389828018 100644
@@ -47,7 +47,6 @@ tf_dev_bind_p4(struct tf *tfp,
 	struct tf_if_tbl_cfg_parms if_tbl_cfg;
 	struct tf_global_cfg_cfg_parms global_cfg;
 
-	dev_handle->type = TF_DEVICE_TYPE_WH;
 	/* Initial function initialization */
 	dev_handle->ops = &tf_dev_ops_p4_init;
 
@@ -90,7 +89,10 @@ tf_dev_bind_p4(struct tf *tfp,
 	 * EEM
 	 */
 	em_cfg.num_elements = TF_EM_TBL_TYPE_MAX;
-	em_cfg.cfg = tf_em_ext_p4;
+	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);
@@ -241,6 +243,8 @@ tf_dev_bind(struct tf *tfp __rte_unused,
 {
 	switch (type) {
 	case TF_DEVICE_TYPE_WH:
+	case TF_DEVICE_TYPE_SR:
+		dev_handle->type = type;
 		return tf_dev_bind_p4(tfp,
 				      shadow_copy,
 				      resources,
@@ -258,6 +262,7 @@ tf_dev_unbind(struct tf *tfp,
 {
 	switch (dev_handle->type) {
 	case TF_DEVICE_TYPE_WH:
+	case TF_DEVICE_TYPE_SR:
 		return tf_dev_unbind_p4(tfp);
 	default:
 		TFP_DRV_LOG(ERR,
drivers/net/bnxt/tf_core/tf_device_p4.c +22 -3
index fe8dec3af7..0344565d72 100644
@@ -28,13 +28,32 @@
  *   - (-EINVAL) on failure.
  */
 static int
-tf_dev_p4_get_max_types(struct tf *tfp __rte_unused,
+tf_dev_p4_get_max_types(struct tf *tfp,
 			uint16_t *max_types)
 {
-	if (max_types == NULL)
+	struct tf_session *tfs;
+	struct tf_dev_info *dev;
+	int rc;
+
+	if (max_types == NULL || tfp == NULL)
 		return -EINVAL;
 
-	*max_types = CFA_RESOURCE_TYPE_P4_LAST + 1;
+	/* 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;
 
 	return 0;
 }
drivers/net/bnxt/tf_core/tf_device_p4.h +6 -0
index 7e58469a09..aba28fe5f6 100644
@@ -83,6 +83,12 @@ struct tf_rm_element_cfg tf_em_ext_p4[TF_EM_TBL_TYPE_MAX] = {
 	{ TF_RM_ELEM_CFG_HCAPI_BA, CFA_RESOURCE_TYPE_P4_TBL_SCOPE },
 };
 
+struct tf_rm_element_cfg tf_em_ext_p45[TF_EM_TBL_TYPE_MAX] = {
+	/* CFA_RESOURCE_TYPE_P4_EM_REC */
+	{ TF_RM_ELEM_CFG_NULL, CFA_RESOURCE_TYPE_INVALID },
+	{ TF_RM_ELEM_CFG_HCAPI_BA, CFA_RESOURCE_TYPE_P45_TBL_SCOPE },
+};
+
 struct tf_rm_element_cfg tf_em_int_p4[TF_EM_TBL_TYPE_MAX] = {
 	{ TF_RM_ELEM_CFG_HCAPI, CFA_RESOURCE_TYPE_P4_EM_REC },
 	/* CFA_RESOURCE_TYPE_P4_TBL_SCOPE */
drivers/net/bnxt/tf_core/tf_device_p45.h new file +105 -0

105 lines not on this page · raw message

drivers/net/bnxt/tf_core/tf_em.h +0 -6
index 2a67e47607..51b08138ea 100644
@@ -9,12 +9,6 @@
 #include "tf_core.h"
 #include "tf_session.h"
 
-
-#define SUPPORT_CFA_HW_P4 1
-#define SUPPORT_CFA_HW_P58 0
-#define SUPPORT_CFA_HW_P59 0
-#define SUPPORT_CFA_HW_ALL 0
-
 #include "hcapi/hcapi_cfa_defs.h"
 
 #define TF_EM_MIN_ENTRIES     (1 << 15) /* 32K */
Signature · 1 line
2.21.1 (Apple Git-122.3)
#52 lore raw

Re: [dpdk-dev] [PATCH v3 01/11] net/bnxt: add stingray support to core layer

drivers/net/bnxt/tf_core/cfa_resource_types.h line 4

Quoted 10 lines · Ajit Khaparde
drivers/net/bnxt/tf_core/cfa_resource_types.h +1 -1
index 19838c393d..412204f7ed 100644
@@ -1,5 +1,5 @@
  /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2019-2020 Broadcom
+ * Copyright(c) 2014-2018 Broadcom
   * All rights reserved.
   */

Is this intentional, pulling back the copyright years, should I fix in the tree?

#53 lore raw

Re: [dpdk-dev] [PATCH v3 01/11] net/bnxt: add stingray support to core layer

Quoted 14 lines · Ferruh Yigit

drivers/net/bnxt/tf_core/cfa_resource_types.h line 4

Quoted 10 lines · Ajit Khaparde
drivers/net/bnxt/tf_core/cfa_resource_types.h +1 -1
index 19838c393d..412204f7ed 100644
@@ -1,5 +1,5 @@
  /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2019-2020 Broadcom
+ * Copyright(c) 2014-2018 Broadcom
   * All rights reserved.
   */

Is this intentional, pulling back the copyright years, should I fix in the tree?

That's not right. Can you please fix it in the tree? Thanks

#54 lore raw

PATCH v3 2/11 net/bnxt: changes to support two table scopes

In reply to Ajit Khaparde

From: Jay Ding <[email protected]>

New API to map a PARIF to an EEM table scope (set of Rx and Tx EEM base addresses). It uses HWRM_TF_GLOBAL_CFG_SET HWRM to configure. PARIF is handler to a partition of the physical port. Adjustments to tf_global_cfg_set() to reduce overhead and nominal name clarification.

---
 drivers/net/bnxt/tf_core/tf_core.c       |  54 +++++--
 drivers/net/bnxt/tf_core/tf_core.h       |  55 ++++++-
 drivers/net/bnxt/tf_core/tf_device.h     |  43 +++++-
 drivers/net/bnxt/tf_core/tf_device_p4.c  |  44 ++++++
 drivers/net/bnxt/tf_core/tf_em.h         |  19 ++-
 drivers/net/bnxt/tf_core/tf_em_common.c  | 174 ++++++++++++-----------
 drivers/net/bnxt/tf_core/tf_em_common.h  |  27 +---
 drivers/net/bnxt/tf_core/tf_em_host.c    |  23 ++-
 drivers/net/bnxt/tf_core/tf_global_cfg.c |   4 +-
 drivers/net/bnxt/tf_core/tf_global_cfg.h |  42 ++----
 drivers/net/bnxt/tf_core/tf_msg.c        |  13 +-
 drivers/net/bnxt/tf_core/tf_msg.h        |   4 +-
 12 files changed, 326 insertions(+), 176 deletions(-)
drivers/net/bnxt/tf_core/tf_core.c +40 -14
index 788335b814..0f49a00256 100644
@@ -303,7 +303,6 @@ int tf_get_global_cfg(struct tf *tfp,
 	int rc = 0;
 	struct tf_session *tfs;
 	struct tf_dev_info *dev;
-	struct tf_dev_global_cfg_parms gparms = { 0 };
 
 	TF_CHECK_PARMS2(tfp, parms);
 
@@ -342,12 +341,7 @@ int tf_get_global_cfg(struct tf *tfp,
 		return -EOPNOTSUPP;
 	}
 
-	gparms.dir = parms->dir;
-	gparms.type = parms->type;
-	gparms.offset = parms->offset;
-	gparms.config = parms->config;
-	gparms.config_sz_in_bytes = parms->config_sz_in_bytes;
-	rc = dev->ops->tf_dev_get_global_cfg(tfp, &gparms);
+	rc = dev->ops->tf_dev_get_global_cfg(tfp, parms);
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "%s: Global Cfg get failed, rc:%s\n",
@@ -371,7 +365,6 @@ int tf_set_global_cfg(struct tf *tfp,
 	int rc = 0;
 	struct tf_session *tfs;
 	struct tf_dev_info *dev;
-	struct tf_dev_global_cfg_parms gparms = { 0 };
 
 	TF_CHECK_PARMS2(tfp, parms);
 
@@ -410,12 +403,7 @@ int tf_set_global_cfg(struct tf *tfp,
 		return -EOPNOTSUPP;
 	}
 
-	gparms.dir = parms->dir;
-	gparms.type = parms->type;
-	gparms.offset = parms->offset;
-	gparms.config = parms->config;
-	gparms.config_sz_in_bytes = parms->config_sz_in_bytes;
-	rc = dev->ops->tf_dev_set_global_cfg(tfp, &gparms);
+	rc = dev->ops->tf_dev_set_global_cfg(tfp, parms);
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "%s: Global Cfg set failed, rc:%s\n",
@@ -1352,6 +1340,44 @@ tf_alloc_tbl_scope(struct tf *tfp,
 
 	return rc;
 }
+int
+tf_map_tbl_scope(struct tf *tfp,
+		   struct tf_map_tbl_scope_parms *parms)
+{
+	struct tf_session *tfs;
+	struct tf_dev_info *dev;
+	int rc;
+
+	TF_CHECK_PARMS2(tfp, parms);
+
+	/* Retrieve the session information */
+	rc = tf_session_get_session(tfp, &tfs);
+	if (rc) {
+		TFP_DRV_LOG(ERR,
+			    "Failed to lookup session, rc:%s\n",
+			    strerror(-rc));
+		return rc;
+	}
+
+	/* 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;
+	}
+
+	if (dev->ops->tf_dev_map_tbl_scope != NULL) {
+		rc = dev->ops->tf_dev_map_tbl_scope(tfp, parms);
+	} else {
+		TFP_DRV_LOG(ERR,
+			    "Map table scope not supported by device\n");
+		return -EINVAL;
+	}
+
+	return rc;
+}
 
 int
 tf_free_tbl_scope(struct tf *tfp,
drivers/net/bnxt/tf_core/tf_core.h +48 -7

87 lines not on this page · raw message

drivers/net/bnxt/tf_core/tf_device.h +41 -2

61 lines not on this page · raw message

drivers/net/bnxt/tf_core/tf_device_p4.c +44 -0

68 lines not on this page · raw message

drivers/net/bnxt/tf_core/tf_em.h +17 -2
index 51b08138ea..8820b28ef1 100644
@@ -358,7 +358,7 @@ int tf_em_ext_free(struct tf *tfp,
 		   struct tf_free_tbl_scope_parms *parms);
 
 /**
- * Common free for external EEM using host or system memory
+ * Common free table scope for external EEM using host or system memory
  *
  * [in] tfp
  *   Pointer to TruFlow handle
@@ -374,7 +374,7 @@ int tf_em_ext_common_free(struct tf *tfp,
 			  struct tf_free_tbl_scope_parms *parms);
 
 /**
- * Common alloc for external EEM using host or system memory
+ * Common alloc table scope for external EEM using host or system memory
  *
  * [in] tfp
  *   Pointer to TruFlow handle
@@ -388,6 +388,21 @@ int tf_em_ext_common_free(struct tf *tfp,
  */
 int tf_em_ext_common_alloc(struct tf *tfp,
 			   struct tf_alloc_tbl_scope_parms *parms);
+/**
+ * Map a set of parifs to a set of EEM base addresses (table scope)
+ *
+ * [in] tfp
+ *   Pointer to TruFlow handle
+ *
+ * [in] parms
+ *   Pointer to input parameters
+ *
+ * Returns:
+ *   0       - Success
+ *   -EINVAL - Parameter error
+ */
+int tf_em_ext_map_tbl_scope(struct tf *tfp,
+			    struct tf_map_tbl_scope_parms *parms);
 
 /**
  * Allocate External Tbl entry from the scope pool.
drivers/net/bnxt/tf_core/tf_em_common.c +90 -84

199 lines not on this page · raw message

drivers/net/bnxt/tf_core/tf_em_common.h +1 -26
index f71a487675..fa313c458f 100644
@@ -9,6 +9,7 @@
 #include "tf_core.h"
 #include "tf_session.h"
 
+
 /**
  * Function to search for table scope control block structure
  * with specified table scope ID.
@@ -22,32 +23,6 @@
  */
 struct tf_tbl_scope_cb *tbl_scope_cb_find(uint32_t tbl_scope_id);
 
-/**
- * Table Scope Allocate
- *
- * Allocate a table scope
- *
- * [in/out] pointer to tbl_scope_id
- *
- * Returns:
- *  0 - success
- *  -EINVAL - error
- */
-int tf_tbl_scope_alloc(uint32_t *tbl_scope_id);
-
-/**
- * Table Scope Free
- *
- * Free a table scope
- *
- * [in] tbl_scope_id to free
- *
- * Returns:
- *  0 - success
- *  -EINVAL - error
- */
-int tf_tbl_scope_free(uint32_t tbl_scope_id);
-
 /**
  * Create and initialize a stack to use for action entries
  *
drivers/net/bnxt/tf_core/tf_em_host.c +19 -4
index cfcb12f3bc..b5db94f3ef 100644
@@ -374,8 +374,14 @@ tf_em_ext_alloc(struct tf *tfp, struct tf_alloc_tbl_scope_parms *parms)
 	struct tf_tbl_scope_cb *tbl_scope_cb;
 	struct hcapi_cfa_em_table *em_tables;
 	struct tf_free_tbl_scope_parms free_parms;
-
-	rc = tf_tbl_scope_alloc(&parms->tbl_scope_id);
+	struct tf_rm_allocate_parms aparms = { 0 };
+	struct tf_rm_free_parms fparms = { 0 };
+
+	/* 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.index = (uint32_t *)&parms->tbl_scope_id;
+	rc = tf_rm_allocate(&aparms);
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to allocate table scope\n");
@@ -472,7 +478,11 @@ tf_em_ext_alloc(struct tf *tfp, struct tf_alloc_tbl_scope_parms *parms)
 	return -EINVAL;
 
 cleanup:
-	tf_tbl_scope_free(parms->tbl_scope_id);
+	/* Free Table control block */
+	fparms.rm_db = eem_db[TF_DIR_RX];
+	fparms.db_index = TF_EM_TBL_TYPE_TBL_SCOPE;
+	fparms.index = parms->tbl_scope_id;
+	tf_rm_free(&fparms);
 	return -EINVAL;
 }
 
@@ -483,6 +493,7 @@ tf_em_ext_free(struct tf *tfp,
 	int rc = 0;
 	enum tf_dir  dir;
 	struct tf_tbl_scope_cb *tbl_scope_cb;
+	struct tf_rm_free_parms aparms = { 0 };
 
 	tbl_scope_cb = tbl_scope_cb_find(parms->tbl_scope_id);
 
@@ -491,7 +502,11 @@ tf_em_ext_free(struct tf *tfp,
 		return -EINVAL;
 	}
 
-	rc = tf_tbl_scope_free(parms->tbl_scope_id);
+	/* Free Table control block */
+	aparms.rm_db = eem_db[TF_DIR_RX];
+	aparms.db_index = TF_EM_TBL_TYPE_TBL_SCOPE;
+	aparms.index = parms->tbl_scope_id;
+	rc = tf_rm_free(&aparms);
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to free table scope\n");
drivers/net/bnxt/tf_core/tf_global_cfg.c +2 -2
index 4ed4039db4..ebd1a86ad3 100644
@@ -113,7 +113,7 @@ tf_global_cfg_unbind(struct tf *tfp __rte_unused)
 
 int
 tf_global_cfg_set(struct tf *tfp,
-		  struct tf_dev_global_cfg_parms *parms)
+		  struct tf_global_cfg_parms *parms)
 {
 	int rc;
 	struct tf_global_cfg_get_hcapi_parms hparms;
@@ -156,7 +156,7 @@ tf_global_cfg_set(struct tf *tfp,
 
 int
 tf_global_cfg_get(struct tf *tfp,
-		  struct tf_dev_global_cfg_parms *parms)
+		  struct tf_global_cfg_parms *parms)
 
 {
 	int rc;
drivers/net/bnxt/tf_core/tf_global_cfg.h +11 -31

65 lines not on this page · raw message

drivers/net/bnxt/tf_core/tf_msg.c +11 -2
index 7c2ad172f2..5615eedbbe 100644
@@ -1075,7 +1075,7 @@ tf_msg_get_tbl_entry(struct tf *tfp,
 
 int
 tf_msg_get_global_cfg(struct tf *tfp,
-		      struct tf_dev_global_cfg_parms *params)
+		      struct tf_global_cfg_parms *params)
 {
 	int rc = 0;
 	struct tfp_send_msg_parms parms = { 0 };
@@ -1133,7 +1133,7 @@ tf_msg_get_global_cfg(struct tf *tfp,
 
 int
 tf_msg_set_global_cfg(struct tf *tfp,
-		      struct tf_dev_global_cfg_parms *params)
+		      struct tf_global_cfg_parms *params)
 {
 	int rc = 0;
 	struct tfp_send_msg_parms parms = { 0 };
@@ -1173,6 +1173,15 @@ tf_msg_set_global_cfg(struct tf *tfp,
 
 	tfp_memcpy(req.data, params->config,
 		   params->config_sz_in_bytes);
+
+	/* Only set mask if pointer is provided
+	 */
+	if (params->config_mask) {
+		tfp_memcpy(req.data + params->config_sz_in_bytes,
+			   params->config_mask,
+			   params->config_sz_in_bytes);
+	}
+
 	req.size = tfp_cpu_to_le_32(params->config_sz_in_bytes);
 
 	parms.tf_type = HWRM_TF_GLOBAL_CFG_SET;
drivers/net/bnxt/tf_core/tf_msg.h +2 -2
index 195710eb80..72bf850487 100644
@@ -462,7 +462,7 @@ int tf_msg_get_tbl_entry(struct tf *tfp,
  *   0 on Success else internal Truflow error
  */
 int tf_msg_get_global_cfg(struct tf *tfp,
-			  struct tf_dev_global_cfg_parms *params);
+			  struct tf_global_cfg_parms *params);
 
 /**
  * Sends global cfg update request to Firmware
@@ -477,7 +477,7 @@ int tf_msg_get_global_cfg(struct tf *tfp,
  *   0 on Success else internal Truflow error
  */
 int tf_msg_set_global_cfg(struct tf *tfp,
-			  struct tf_dev_global_cfg_parms *params);
+			  struct tf_global_cfg_parms *params);
 
 /**
  * Sends bulk get message of a Table Type element to the firmware.
Signature · 1 line
2.21.1 (Apple Git-122.3)
#55 lore raw

PATCH v3 3/11 net/bnxt: add table scope to PF Mapping

In reply to Ajit Khaparde

From: Farah Smith <[email protected]>

Add table scope to PF Mapping for SR and Wh+ devices. Legacy devices require PF set of base addresses for EEM operation. A table scope id is a logical construct and is mapped to the PF associated with the communications channel used.
In the case of a VF, the parent PF is used.

---
 drivers/net/bnxt/tf_core/tf_device.h    | 10 +++++++---
 drivers/net/bnxt/tf_core/tf_device_p4.c | 10 +++++-----
 drivers/net/bnxt/tf_core/tf_em_common.c |  6 ++++--
 drivers/net/bnxt/tf_core/tf_em_host.c   |  8 ++++++++
 drivers/net/bnxt/tf_core/tf_tbl.h       |  3 +++
 drivers/net/bnxt/tf_core/tfp.c          | 19 +++++++++++++++++++
 drivers/net/bnxt/tf_core/tfp.h          | 16 ++++++++++++++++
 7 files changed, 62 insertions(+), 10 deletions(-)
drivers/net/bnxt/tf_core/tf_device.h +7 -3
index cf7c36e0ea..b5fc695ece 100644
@@ -579,8 +579,11 @@ struct tf_dev_ops {
 	 * [in] tfp
 	 *   Pointer to TF handle
 	 *
-	 * [in] parms
-	 *   Pointer to table scope map parameters
+	 * [in] pf
+	 * PF associated with the table scope
+	 *
+	 * [in] parif_bitmask
+	 * Bitmask of PARIFs to enable
 	 *
 	 * [in/out] pointer to the parif_2_pf data to be updated
 	 *
@@ -593,7 +596,8 @@ struct tf_dev_ops {
 	 *    -EINVAL - Error
 	 */
 	int (*tf_dev_map_parif)(struct tf *tfp,
-				struct tf_map_tbl_scope_parms *parms,
+				uint16_t parif_bitmask,
+				uint16_t pf,
 				uint8_t *data,
 				uint8_t *mask,
 				uint16_t sz_in_bytes);
drivers/net/bnxt/tf_core/tf_device_p4.c +5 -5
index 07c8d02faa..b35e65a8de 100644
@@ -103,7 +103,8 @@ tf_dev_p4_get_tcam_slice_info(struct tf *tfp __rte_unused,
 
 static int
 tf_dev_p4_map_parif(struct tf *tfp __rte_unused,
-		    struct tf_map_tbl_scope_parms *parms,
+		    uint16_t parif_bitmask,
+		    uint16_t pf,
 		    uint8_t *data,
 		    uint8_t *mask,
 		    uint16_t sz_in_bytes)
@@ -112,21 +113,20 @@ tf_dev_p4_map_parif(struct tf *tfp __rte_unused,
 	uint32_t parif_pf_mask[2] = { 0 };
 	uint32_t parif;
 	uint32_t shift;
-	uint32_t scope_id = (uint32_t)(parms->tbl_scope_id);
 
 	if (sz_in_bytes != sizeof(uint64_t))
 		return -ENOTSUP;
 
 	for (parif = 0; parif < TF_DEV_P4_PARIF_MAX; parif++) {
-		if (parms->parif_bitmask & (1UL << parif)) {
+		if (parif_bitmask & (1UL << parif)) {
 			if (parif < 8) {
 				shift = 4 * parif;
 				parif_pf_mask[0] |= TF_DEV_P4_PF_MASK << shift;
-				parif_pf[0] |= scope_id << shift;
+				parif_pf[0] |= pf << shift;
 			} else {
 				shift = 4 * (parif - 8);
 				parif_pf_mask[1] |= TF_DEV_P4_PF_MASK << shift;
-				parif_pf[1] |= scope_id << shift;
+				parif_pf[1] |= pf << shift;
 			}
 		}
 	}
drivers/net/bnxt/tf_core/tf_em_common.c +4 -2
index d4e8469edf..ad92cbdc75 100644
@@ -1104,8 +1104,10 @@ int tf_em_ext_map_tbl_scope(struct tf *tfp,
 	}
 	mask = aparms.mem_va;
 
-	rc = dev->ops->tf_dev_map_parif(tfp, parms, (uint8_t *)data,
-					(uint8_t *)mask, sz_in_bytes);
+	rc = dev->ops->tf_dev_map_parif(tfp, parms->parif_bitmask,
+					tbl_scope_cb->pf,
+					(uint8_t *)data, (uint8_t *)mask,
+					sz_in_bytes);
 
 	if (rc) {
 		TFP_DRV_LOG(ERR,
drivers/net/bnxt/tf_core/tf_em_host.c +8 -0
index b5db94f3ef..a106bdffde 100644
@@ -392,6 +392,14 @@ tf_em_ext_alloc(struct tf *tfp, struct tf_alloc_tbl_scope_parms *parms)
 	tbl_scope_cb->index = parms->tbl_scope_id;
 	tbl_scope_cb->tbl_scope_id = parms->tbl_scope_id;
 
+	rc = tfp_get_pf(tfp, &tbl_scope_cb->pf);
+	if (rc) {
+		TFP_DRV_LOG(ERR,
+			    "EEM: PF query error rc:%s\n",
+			    strerror(-rc));
+		goto cleanup;
+	}
+
 	for (dir = 0; dir < TF_DIR_MAX; dir++) {
 		rc = tf_msg_em_qcaps(tfp,
 				     dir,
drivers/net/bnxt/tf_core/tf_tbl.h +3 -0
index 2a5d24c940..230338c81b 100644
@@ -38,6 +38,9 @@ struct tf_em_caps {
  */
 struct tf_tbl_scope_cb {
 	uint32_t tbl_scope_id;
+       /** The pf or parent pf of the vf used for table scope creation
+	*/
+	uint16_t pf;
 	int index;
 	struct hcapi_cfa_em_ctx_mem_info em_ctx_info[TF_DIR_MAX];
 	struct tf_em_caps em_caps[TF_DIR_MAX];
drivers/net/bnxt/tf_core/tfp.c +19 -0
index 426a182a90..0f6d63cc00 100644
@@ -178,3 +178,22 @@ tfp_get_fid(struct tf *tfp, uint16_t *fw_fid)
 
 	return 0;
 }
+
+int
+tfp_get_pf(struct tf *tfp, uint16_t *pf)
+{
+	struct bnxt *bp = NULL;
+
+	if (tfp == NULL || pf == NULL)
+		return -EINVAL;
+
+	bp = container_of(tfp, struct bnxt, tfp);
+	if (BNXT_VF(bp) && bp->parent) {
+		*pf = bp->parent->fid - 1;
+		return 0;
+	} else if (BNXT_PF(bp)) {
+		*pf = bp->fw_fid - 1;
+		return 0;
+	}
+	return -EINVAL;
+}
drivers/net/bnxt/tf_core/tfp.h +16 -0
index 421a7d9f78..551b9c569f 100644
@@ -268,4 +268,20 @@ int tfp_get_fid(struct tf *tfp, uint16_t *fw_fid);
  */
 int tfp_get_fid(struct tf *tfp, uint16_t *fw_fid);
 
+/**
+ * Get the PF associated with the fw communications channel.
+ *
+ * [in] session
+ *   Pointer to session handle
+ *
+ * [out] pf
+ *   Pointer to the pf id
+ *
+ * Returns:
+ *   0       - Success
+ *   -EINVAL - Failure
+ *
+ */
+int tfp_get_pf(struct tf *tfp, uint16_t *pf);
+
 #endif /* _TFP_H_ */
Signature · 1 line
2.21.1 (Apple Git-122.3)
#56 lore raw

PATCH v3 4/11 net/bnxt: update ULP resource counts

In reply to Ajit Khaparde

From: Peter Spreadborough <[email protected]>

- Update the SR ULP requested resource counts to reflect those available after AFM resources are accounted for.
- Add build option to select either 2 or 4 slot EM entries. The default is 4 slot entries.

---
 drivers/net/bnxt/tf_core/tf_session.h | 16 +++++------
 drivers/net/bnxt/tf_ulp/bnxt_ulp.c    | 40 +++++++++++++--------------
 2 files changed, 28 insertions(+), 28 deletions(-)
drivers/net/bnxt/tf_core/tf_session.h +8 -8
index aa7a27877d..6a5c894033 100644
@@ -33,16 +33,16 @@
 #define TF_SESSION_ID_INVALID     0xFFFFFFFF /** Invalid Session ID define */
 
 /**
- * Number of EM entries. Static for now will be removed
- * when parameter added at a later date. At this stage we
- * are using fixed size entries so that each stack entry
- * represents 4 RT (f/n)blocks. So we take the total block
- * allocation for truflow and divide that by 4.
+ * At this stage we are using fixed size entries so that each
+ * stack entry represents either 2 or 4 RT (f/n)blocks. So we
+ * take the total block allocation for truflow and divide that
+ * by either 2 or 4.
  */
-#define TF_SESSION_TOTAL_FN_BLOCKS (1024 * 8) /* 8K blocks */
+#ifdef TF_EM_ENTRY_IPV4_ONLY
+#define TF_SESSION_EM_ENTRY_SIZE 2 /* 2 blocks per entry */
+#else
 #define TF_SESSION_EM_ENTRY_SIZE 4 /* 4 blocks per entry */
-#define TF_SESSION_EM_POOL_SIZE \
-	(TF_SESSION_TOTAL_FN_BLOCKS / TF_SESSION_EM_ENTRY_SIZE)
+#endif
 
 /**
  * Session
drivers/net/bnxt/tf_ulp/bnxt_ulp.c +20 -20
index b22929a634..d753b5af9f 100644
@@ -153,11 +153,11 @@ bnxt_ulp_tf_session_resources_get(struct bnxt *bp,
 	case BNXT_ULP_DEVICE_ID_STINGRAY:
 		/** RX **/
 		/* Identifiers */
-		res->ident_cnt[TF_DIR_RX].cnt[TF_IDENT_TYPE_L2_CTXT_HIGH] = 100;
+		res->ident_cnt[TF_DIR_RX].cnt[TF_IDENT_TYPE_L2_CTXT_HIGH] = 315;
 		res->ident_cnt[TF_DIR_RX].cnt[TF_IDENT_TYPE_L2_CTXT_LOW] = 6;
-		res->ident_cnt[TF_DIR_RX].cnt[TF_IDENT_TYPE_WC_PROF] = 10;
-		res->ident_cnt[TF_DIR_RX].cnt[TF_IDENT_TYPE_PROF_FUNC] = 10;
-		res->ident_cnt[TF_DIR_RX].cnt[TF_IDENT_TYPE_EM_PROF] = 10;
+		res->ident_cnt[TF_DIR_RX].cnt[TF_IDENT_TYPE_WC_PROF] = 192;
+		res->ident_cnt[TF_DIR_RX].cnt[TF_IDENT_TYPE_PROF_FUNC] = 64;
+		res->ident_cnt[TF_DIR_RX].cnt[TF_IDENT_TYPE_EM_PROF] = 192;
 
 		/* Table Types */
 		res->tbl_cnt[TF_DIR_RX].cnt[TF_TBL_TYPE_FULL_ACT_RECORD] = 8192;
@@ -170,28 +170,28 @@ bnxt_ulp_tf_session_resources_get(struct bnxt *bp,
 
 		/* TCAMs */
 		res->tcam_cnt[TF_DIR_RX].cnt[TF_TCAM_TBL_TYPE_L2_CTXT_TCAM_HIGH] =
-			100;
+			315;
 		res->tcam_cnt[TF_DIR_RX].cnt[TF_TCAM_TBL_TYPE_L2_CTXT_TCAM_LOW] =
 			6;
-		res->tcam_cnt[TF_DIR_RX].cnt[TF_TCAM_TBL_TYPE_PROF_TCAM] = 100;
-		res->tcam_cnt[TF_DIR_RX].cnt[TF_TCAM_TBL_TYPE_WC_TCAM] = 0;
+		res->tcam_cnt[TF_DIR_RX].cnt[TF_TCAM_TBL_TYPE_PROF_TCAM] = 960;
+		res->tcam_cnt[TF_DIR_RX].cnt[TF_TCAM_TBL_TYPE_WC_TCAM] = 112;
 
 		/* EM */
-		res->em_cnt[TF_DIR_RX].cnt[TF_EM_TBL_TYPE_EM_RECORD] = 13168;
+		res->em_cnt[TF_DIR_RX].cnt[TF_EM_TBL_TYPE_EM_RECORD] = 13200;
 
 		/* EEM */
 		res->em_cnt[TF_DIR_RX].cnt[TF_EM_TBL_TYPE_TBL_SCOPE] = 1;
 
 		/* SP */
-		res->tbl_cnt[TF_DIR_RX].cnt[TF_TBL_TYPE_ACT_SP_SMAC] = 255;
+		res->tbl_cnt[TF_DIR_RX].cnt[TF_TBL_TYPE_ACT_SP_SMAC] = 256;
 
 		/** TX **/
 		/* Identifiers */
-		res->ident_cnt[TF_DIR_TX].cnt[TF_IDENT_TYPE_L2_CTXT_HIGH] = 100;
-		res->ident_cnt[TF_DIR_TX].cnt[TF_IDENT_TYPE_L2_CTXT_LOW] = 100;
-		res->ident_cnt[TF_DIR_TX].cnt[TF_IDENT_TYPE_WC_PROF] = 10;
-		res->ident_cnt[TF_DIR_TX].cnt[TF_IDENT_TYPE_PROF_FUNC] = 10;
-		res->ident_cnt[TF_DIR_TX].cnt[TF_IDENT_TYPE_EM_PROF] = 10;
+		res->ident_cnt[TF_DIR_TX].cnt[TF_IDENT_TYPE_L2_CTXT_HIGH] = 292;
+		res->ident_cnt[TF_DIR_TX].cnt[TF_IDENT_TYPE_L2_CTXT_LOW] = 127;
+		res->ident_cnt[TF_DIR_TX].cnt[TF_IDENT_TYPE_WC_PROF] = 192;
+		res->ident_cnt[TF_DIR_TX].cnt[TF_IDENT_TYPE_PROF_FUNC] = 64;
+		res->ident_cnt[TF_DIR_TX].cnt[TF_IDENT_TYPE_EM_PROF] = 192;
 
 		/* Table Types */
 		res->tbl_cnt[TF_DIR_TX].cnt[TF_TBL_TYPE_FULL_ACT_RECORD] = 8192;
@@ -199,17 +199,17 @@ bnxt_ulp_tf_session_resources_get(struct bnxt *bp,
 		res->tbl_cnt[TF_DIR_TX].cnt[TF_TBL_TYPE_ACT_MODIFY_IPV4] = 1023;
 
 		/* ENCAP */
-		res->tbl_cnt[TF_DIR_TX].cnt[TF_TBL_TYPE_ACT_ENCAP_64B] = 511;
+		res->tbl_cnt[TF_DIR_TX].cnt[TF_TBL_TYPE_ACT_ENCAP_64B] = 367;
 		res->tbl_cnt[TF_DIR_TX].cnt[TF_TBL_TYPE_ACT_ENCAP_16B] = 223;
 		res->tbl_cnt[TF_DIR_TX].cnt[TF_TBL_TYPE_ACT_ENCAP_8B] = 255;
 
 		/* TCAMs */
 		res->tcam_cnt[TF_DIR_TX].cnt[TF_TCAM_TBL_TYPE_L2_CTXT_TCAM_HIGH] =
-			100;
+			292;
 		res->tcam_cnt[TF_DIR_TX].cnt[TF_TCAM_TBL_TYPE_L2_CTXT_TCAM_LOW] =
-			100;
-		res->tcam_cnt[TF_DIR_TX].cnt[TF_TCAM_TBL_TYPE_PROF_TCAM] = 100;
-		res->tcam_cnt[TF_DIR_TX].cnt[TF_TCAM_TBL_TYPE_WC_TCAM] = 0;
+			127;
+		res->tcam_cnt[TF_DIR_TX].cnt[TF_TCAM_TBL_TYPE_PROF_TCAM] = 960;
+		res->tcam_cnt[TF_DIR_TX].cnt[TF_TCAM_TBL_TYPE_WC_TCAM] = 928;
 
 		/* EM */
 		res->em_cnt[TF_DIR_TX].cnt[TF_EM_TBL_TYPE_EM_RECORD] = 15232;
@@ -219,7 +219,7 @@ bnxt_ulp_tf_session_resources_get(struct bnxt *bp,
 
 		/* SP */
 		res->tbl_cnt[TF_DIR_TX].cnt[TF_TBL_TYPE_ACT_SP_SMAC_IPV4] = 488;
-		res->tbl_cnt[TF_DIR_TX].cnt[TF_TBL_TYPE_ACT_SP_SMAC_IPV6] = 511;
+		res->tbl_cnt[TF_DIR_TX].cnt[TF_TBL_TYPE_ACT_SP_SMAC_IPV6] = 512;
 		break;
 	default:
 		return -EINVAL;
Signature · 1 line
2.21.1 (Apple Git-122.3)
#57 lore raw

PATCH v3 5/11 net/bnxt: fix infinite loop in flow query count

In reply to Ajit Khaparde

From: Somnath Kotur <[email protected]>

nxt_resource_idx could be zero in some cases which is invalid and should be part of the while loop condition. Also synchronize access to the flow db using the fdb_lock

Fixes 306c2d28e247 ("net/bnxt: support count action in flow query")
---
 drivers/net/bnxt/tf_ulp/ulp_fc_mgr.c | 51 +++++++++++++++-------------
 1 file changed, 27 insertions(+), 24 deletions(-)
drivers/net/bnxt/tf_ulp/ulp_fc_mgr.c +27 -24
index 051ebac049..41736a80df 100644
@@ -559,6 +559,9 @@ int ulp_fc_mgr_query_count_get(struct bnxt_ulp_context *ctxt,
 	if (!ulp_fc_info)
 		return -ENODEV;
 
+	if (bnxt_ulp_cntxt_acquire_fdb_lock(ctxt))
+		return -EIO;
+
 	do {
 		rc = ulp_flow_db_resource_get(ctxt,
 					      BNXT_ULP_FDB_TYPE_REGULAR,
@@ -575,35 +578,35 @@ int ulp_fc_mgr_query_count_get(struct bnxt_ulp_context *ctxt,
 			break;
 		}
 
-	} while (!rc);
+	} while (!rc && nxt_resource_index);
+
+	bnxt_ulp_cntxt_release_fdb_lock(ctxt);
 
-	if (rc)
+	if (rc || !found_cntr_resource)
 		return rc;
 
-	if (found_cntr_resource) {
-		dir = params.direction;
-		hw_cntr_id = params.resource_hndl;
-		sw_cntr_idx = hw_cntr_id -
-				ulp_fc_info->shadow_hw_tbl[dir].start_idx;
-		sw_acc_tbl_entry = &ulp_fc_info->sw_acc_tbl[dir][sw_cntr_idx];
-		if (params.resource_sub_type ==
+	dir = params.direction;
+	hw_cntr_id = params.resource_hndl;
+	sw_cntr_idx = hw_cntr_id -
+		ulp_fc_info->shadow_hw_tbl[dir].start_idx;
+	sw_acc_tbl_entry = &ulp_fc_info->sw_acc_tbl[dir][sw_cntr_idx];
+	if (params.resource_sub_type ==
 			BNXT_ULP_RESOURCE_SUB_TYPE_INDEX_TYPE_INT_COUNT) {
-			pthread_mutex_lock(&ulp_fc_info->fc_lock);
-			if (sw_acc_tbl_entry->pkt_count) {
-				count->hits_set = 1;
-				count->bytes_set = 1;
-				count->hits = sw_acc_tbl_entry->pkt_count;
-				count->bytes = sw_acc_tbl_entry->byte_count;
-			}
-			if (count->reset) {
-				sw_acc_tbl_entry->pkt_count = 0;
-				sw_acc_tbl_entry->byte_count = 0;
-			}
-			pthread_mutex_unlock(&ulp_fc_info->fc_lock);
-		} else {
-			/* TBD: Handle External counters */
-			rc = -EINVAL;
+		pthread_mutex_lock(&ulp_fc_info->fc_lock);
+		if (sw_acc_tbl_entry->pkt_count) {
+			count->hits_set = 1;
+			count->bytes_set = 1;
+			count->hits = sw_acc_tbl_entry->pkt_count;
+			count->bytes = sw_acc_tbl_entry->byte_count;
 		}
+		if (count->reset) {
+			sw_acc_tbl_entry->pkt_count = 0;
+			sw_acc_tbl_entry->byte_count = 0;
+		}
+		pthread_mutex_unlock(&ulp_fc_info->fc_lock);
+	} else {
+		/* TBD: Handle External counters */
+		rc = -EINVAL;
 	}
 
 	return rc;
Signature · 1 line
2.21.1 (Apple Git-122.3)
#58 lore raw

PATCH v3 6/11 net/bnxt: add support for flow counter accumulation

In reply to Ajit Khaparde

From: Kishore Padmanabha <[email protected]>

Add support for flow counter accumulation.
In case of hierarchical flows, involving parent and child flows, the child flow counters are aggregated to get the parent flow counter information.

---
 drivers/net/bnxt/tf_ulp/ulp_fc_mgr.c          |  92 ++++-
 drivers/net/bnxt/tf_ulp/ulp_fc_mgr.h          |  19 +
 drivers/net/bnxt/tf_ulp/ulp_flow_db.c         | 382 ++++++++++++++----
 drivers/net/bnxt/tf_ulp/ulp_flow_db.h         |  44 ++
 .../net/bnxt/tf_ulp/ulp_template_db_enum.h    |   3 +-
 5 files changed, 447 insertions(+), 93 deletions(-)
drivers/net/bnxt/tf_ulp/ulp_fc_mgr.c +79 -13
index 41736a80df..734b419986 100644
@@ -21,13 +21,13 @@ static int
 ulp_fc_mgr_shadow_mem_alloc(struct hw_fc_mem_info *parms, int size)
 {
 	/* Allocate memory*/
-	if (parms == NULL)
+	if (!parms)
 		return -EINVAL;
 
 	parms->mem_va = rte_zmalloc("ulp_fc_info",
 				    RTE_CACHE_LINE_ROUNDUP(size),
 				    4096);
-	if (parms->mem_va == NULL) {
+	if (!parms->mem_va) {
 		BNXT_TF_DBG(ERR, "Allocate failed mem_va\n");
 		return -ENOMEM;
 	}
@@ -149,7 +149,6 @@ ulp_fc_mgr_deinit(struct bnxt_ulp_context *ctxt)
 	for (i = 0; i < TF_DIR_MAX; i++)
 		ulp_fc_mgr_shadow_mem_free(&ulp_fc_info->shadow_hw_tbl[i]);
 
-
 	rte_free(ulp_fc_info);
 
 	/* Safe to ignore on deinit */
@@ -254,7 +253,7 @@ ulp_bulk_get_flow_stats(struct tf *tfp,
 	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;
 
-	if (stats == NULL) {
+	if (!stats) {
 		PMD_DRV_LOG(ERR,
 			    "BULK: Memory not initialized id:0x%x dir:%d\n",
 			    parms.starting_idx, dir);
@@ -274,7 +273,8 @@ ulp_bulk_get_flow_stats(struct tf *tfp,
 		sw_acc_tbl_entry = &fc_info->sw_acc_tbl[dir][i];
 		if (!sw_acc_tbl_entry->valid)
 			continue;
-		sw_acc_tbl_entry->pkt_count += FLOW_CNTR_PKTS(stats[i], dparms);
+		sw_acc_tbl_entry->pkt_count += FLOW_CNTR_PKTS(stats[i],
+							      dparms);
 		sw_acc_tbl_entry->byte_count += FLOW_CNTR_BYTES(stats[i],
 								dparms);
 	}
@@ -282,7 +282,8 @@ ulp_bulk_get_flow_stats(struct tf *tfp,
 	return rc;
 }
 
-static int ulp_get_single_flow_stat(struct tf *tfp,
+static int ulp_get_single_flow_stat(struct bnxt_ulp_context *ctxt,
+				    struct tf *tfp,
 				    struct bnxt_ulp_fc_info *fc_info,
 				    enum tf_dir dir,
 				    uint32_t hw_cntr_id,
@@ -291,7 +292,7 @@ static int ulp_get_single_flow_stat(struct tf *tfp,
 	int rc = 0;
 	struct tf_get_tbl_entry_parms parms = { 0 };
 	enum tf_tbl_type stype = TF_TBL_TYPE_ACT_STATS_64;  /* TBD:Template? */
-	struct sw_acc_counter *sw_acc_tbl_entry = NULL;
+	struct sw_acc_counter *sw_acc_tbl_entry = NULL, *t_sw;
 	uint64_t stats = 0;
 	uint32_t sw_cntr_indx = 0;
 
@@ -318,6 +319,18 @@ static int ulp_get_single_flow_stat(struct tf *tfp,
 	sw_acc_tbl_entry->pkt_count = FLOW_CNTR_PKTS(stats, dparms);
 	sw_acc_tbl_entry->byte_count = FLOW_CNTR_BYTES(stats, dparms);
 
+	/* Update the parent counters if it is child flow */
+	if (sw_acc_tbl_entry->parent_flow_id) {
+		/* Update the parent counters */
+		t_sw = sw_acc_tbl_entry;
+		if (ulp_flow_db_parent_flow_count_update(ctxt,
+							 t_sw->parent_flow_id,
+							 t_sw->pkt_count,
+							 t_sw->byte_count)) {
+			PMD_DRV_LOG(ERR, "Error updating parent counters\n");
+		}
+	}
+
 	return rc;
 }
 
@@ -384,13 +397,17 @@ ulp_fc_mgr_alarm_cb(void *arg)
 			break;
 	}
 	*/
+
+	/* reset the parent accumulation counters before accumulation if any */
+	ulp_flow_db_parent_flow_count_reset(ctxt);
+
 	num_entries = dparms->flow_count_db_entries / 2;
 	for (i = 0; i < TF_DIR_MAX; i++) {
 		for (j = 0; j < num_entries; j++) {
 			if (!ulp_fc_info->sw_acc_tbl[i][j].valid)
 				continue;
 			hw_cntr_id = ulp_fc_info->sw_acc_tbl[i][j].hw_cntr_id;
-			rc = ulp_get_single_flow_stat(tfp, ulp_fc_info, i,
+			rc = ulp_get_single_flow_stat(ctxt, tfp, ulp_fc_info, i,
 						      hw_cntr_id, dparms);
 			if (rc)
 				break;
@@ -573,11 +590,12 @@ int ulp_fc_mgr_query_count_get(struct bnxt_ulp_context *ctxt,
 		     (params.resource_sub_type ==
 		      BNXT_ULP_RESOURCE_SUB_TYPE_INDEX_TYPE_INT_COUNT ||
 		      params.resource_sub_type ==
-		      BNXT_ULP_RESOURCE_SUB_TYPE_INDEX_TYPE_EXT_COUNT)) {
+		      BNXT_ULP_RESOURCE_SUB_TYPE_INDEX_TYPE_EXT_COUNT ||
+		      params.resource_sub_type ==
+		      BNXT_ULP_RESOURCE_SUB_TYPE_INDEX_TYPE_INT_COUNT_ACC)) {
 			found_cntr_resource = true;
 			break;
 		}
-
 	} while (!rc && nxt_resource_index);
 
 	bnxt_ulp_cntxt_release_fdb_lock(ctxt);
@@ -587,12 +605,12 @@ int ulp_fc_mgr_query_count_get(struct bnxt_ulp_context *ctxt,
 
 	dir = params.direction;
 	hw_cntr_id = params.resource_hndl;
-	sw_cntr_idx = hw_cntr_id -
-		ulp_fc_info->shadow_hw_tbl[dir].start_idx;
-	sw_acc_tbl_entry = &ulp_fc_info->sw_acc_tbl[dir][sw_cntr_idx];
 	if (params.resource_sub_type ==
 			BNXT_ULP_RESOURCE_SUB_TYPE_INDEX_TYPE_INT_COUNT) {
 		pthread_mutex_lock(&ulp_fc_info->fc_lock);
+		sw_cntr_idx = hw_cntr_id -
+			ulp_fc_info->shadow_hw_tbl[dir].start_idx;
+		sw_acc_tbl_entry = &ulp_fc_info->sw_acc_tbl[dir][sw_cntr_idx];
 		if (sw_acc_tbl_entry->pkt_count) {
 			count->hits_set = 1;
 			count->bytes_set = 1;
@@ -604,6 +622,15 @@ int ulp_fc_mgr_query_count_get(struct bnxt_ulp_context *ctxt,
 			sw_acc_tbl_entry->byte_count = 0;
 		}
 		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 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 {
 		/* TBD: Handle External counters */
 		rc = -EINVAL;
@@ -611,3 +638,42 @@ int ulp_fc_mgr_query_count_get(struct bnxt_ulp_context *ctxt,
 
 	return rc;
 }
+
+/*
+ * Set the parent flow if it is SW accumulation counter entry.
+ *
+ * ctxt [in] The ulp context for the flow counter manager
+ *
+ * dir [in] The direction of the flow
+ *
+ * hw_cntr_id [in] The HW flow counter ID
+ *
+ * fid [in] parent flow id
+ *
+ */
+int32_t ulp_fc_mgr_cntr_parent_flow_set(struct bnxt_ulp_context *ctxt,
+					enum tf_dir dir,
+					uint32_t hw_cntr_id,
+					uint32_t fid)
+{
+	struct bnxt_ulp_fc_info *ulp_fc_info;
+	uint32_t sw_cntr_idx;
+	int32_t rc = 0;
+
+	ulp_fc_info = bnxt_ulp_cntxt_ptr2_fc_info_get(ctxt);
+	if (!ulp_fc_info)
+		return -EIO;
+
+	pthread_mutex_lock(&ulp_fc_info->fc_lock);
+	sw_cntr_idx = hw_cntr_id - ulp_fc_info->shadow_hw_tbl[dir].start_idx;
+	if (ulp_fc_info->sw_acc_tbl[dir][sw_cntr_idx].valid) {
+		ulp_fc_info->sw_acc_tbl[dir][sw_cntr_idx].parent_flow_id = fid;
+	} else {
+		BNXT_TF_DBG(ERR, "Failed to set parent flow id %x:%x\n",
+			    hw_cntr_id, fid);
+		rc = -ENOENT;
+	}
+	pthread_mutex_unlock(&ulp_fc_info->fc_lock);
+
+	return rc;
+}
drivers/net/bnxt/tf_ulp/ulp_fc_mgr.h +19 -0
index 0cb880d4bc..de4d3dfe95 100644
@@ -26,6 +26,7 @@ struct sw_acc_counter {
 	uint64_t byte_count;
 	bool	valid;
 	uint32_t hw_cntr_id;
+	uint32_t parent_flow_id;
 };
 
 struct hw_fc_mem_info {
@@ -163,4 +164,22 @@ bool ulp_fc_mgr_thread_isstarted(struct bnxt_ulp_context *ctxt);
 int ulp_fc_mgr_query_count_get(struct bnxt_ulp_context *ulp_ctx,
 			       uint32_t flow_id,
 			       struct rte_flow_query_count *count);
+
+/*
+ * Set the parent flow if in the SW accumulator table entry
+ *
+ * ctxt [in] The ulp context for the flow counter manager
+ *
+ * dir [in] The direction of the flow
+ *
+ * hw_cntr_id [in] The HW flow counter ID
+ *
+ * fid [in] parent flow id
+ *
+ */
+int32_t ulp_fc_mgr_cntr_parent_flow_set(struct bnxt_ulp_context *ctxt,
+					enum tf_dir dir,
+					uint32_t hw_cntr_id,
+					uint32_t fid);
+
 #endif /* _ULP_FC_MGR_H_ */
drivers/net/bnxt/tf_ulp/ulp_flow_db.c +303 -79

513 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_flow_db.h +44 -0

54 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_template_db_enum.h +2 -1
index 168e308c2b..6dade9afdb 100644
@@ -332,7 +332,8 @@ enum bnxt_ulp_resource_sub_type {
 	BNXT_ULP_RESOURCE_SUB_TYPE_INDEX_TYPE_NORMAL = 0,
 	BNXT_ULP_RESOURCE_SUB_TYPE_INDEX_TYPE_VFR_CFA_ACTION = 1,
 	BNXT_ULP_RESOURCE_SUB_TYPE_INDEX_TYPE_INT_COUNT = 2,
-	BNXT_ULP_RESOURCE_SUB_TYPE_INDEX_TYPE_EXT_COUNT = 3,
+	BNXT_ULP_RESOURCE_SUB_TYPE_INDEX_TYPE_INT_COUNT_ACC = 3,
+	BNXT_ULP_RESOURCE_SUB_TYPE_INDEX_TYPE_EXT_COUNT = 4,
 	BNXT_ULP_RESOURCE_SUB_TYPE_CACHE_TYPE_L2_CNTXT_TCAM = 0,
 	BNXT_ULP_RESOURCE_SUB_TYPE_CACHE_TYPE_PROFILE_TCAM = 1
 };
Signature · 1 line
2.21.1 (Apple Git-122.3)
#59 lore raw

PATCH v3 7/11 net/bnxt: change HWRM command to create reps

In reply to Ajit Khaparde

From: Somnath Kotur <[email protected]>

Use cfa pair alloc for configuring reps.
Instead of cfa_vfr_alloc for Wh+ and cfa_pair_alloc for Stingray, converge to cfa_pair_alloc/free for both devices. Set the command request structure bits accordingly.
As part of this, remove the old cfa_vfr_alloc cmd definitions as FW has deprecated support for those commands.

---
 doc/guides/rel_notes/release_20_11.rst |  1 +
 drivers/net/bnxt/bnxt.h                |  6 ++-
 drivers/net/bnxt/bnxt_ethdev.c         |  2 +
 drivers/net/bnxt/bnxt_hwrm.c           | 60 +++-----------------------
 drivers/net/bnxt/bnxt_hwrm.h           |  2 -
 drivers/net/bnxt/bnxt_reps.c           | 18 ++++----
 6 files changed, 22 insertions(+), 67 deletions(-)
doc/guides/rel_notes/release_20_11.rst +1 -0
index fa666e04fd..4c1961ced7 100644
@@ -147,6 +147,7 @@ New Features
   * Added support for RSS hash level selection.
   * Updated HWRM structures to 1.10.1.70 version.
   * Added TRUFLOW support for Stingray devices.
+  * Added support for representors on MAIA cores of SR.
 
 * **Updated Cisco enic driver.**
 
drivers/net/bnxt/bnxt.h +5 -1
index a951bca7aa..57178192d2 100644
@@ -836,12 +836,14 @@ struct bnxt_representor {
 #define BNXT_REP_Q_F2R_VALID		BIT(2)
 #define BNXT_REP_FC_R2F_VALID		BIT(3)
 #define BNXT_REP_FC_F2R_VALID		BIT(4)
+#define BNXT_REP_BASED_PF_VALID		BIT(5)
 	uint32_t		flags;
 	uint16_t		fw_fid;
 #define	BNXT_DFLT_VNIC_ID_INVALID	0xFFFF
 	uint16_t		dflt_vnic_id;
 	uint16_t		svif;
 	uint16_t		vfr_tx_cfa_action;
+	uint8_t			parent_pf_idx; /* Logical PF index */
 	uint32_t		dpdk_port_id;
 	uint32_t		rep_based_pf;
 	uint8_t			rep_q_r2f;
@@ -863,7 +865,9 @@ struct bnxt_representor {
 	uint64_t                rx_drop_bytes[BNXT_MAX_VF_REP_RINGS];
 };
 
-#define BNXT_REP_PF(vfr_bp)	((vfr_bp)->flags & BNXT_REP_IS_PF)
+#define BNXT_REP_PF(vfr_bp)		((vfr_bp)->flags & BNXT_REP_IS_PF)
+#define BNXT_REP_BASED_PF(vfr_bp)	\
+		((vfr_bp)->flags & BNXT_REP_BASED_PF_VALID)
 
 struct bnxt_vf_rep_tx_queue {
 	struct bnxt_tx_queue *txq;
drivers/net/bnxt/bnxt_ethdev.c +2 -0
index 484b02c5d4..562cf14ba4 100644
@@ -5765,6 +5765,8 @@ bnxt_parse_devarg_rep_based_pf(__rte_unused const char *key,
 	}
 
 	vfr_bp->rep_based_pf = rep_based_pf;
+	vfr_bp->flags |= BNXT_REP_BASED_PF_VALID;
+
 	PMD_DRV_LOG(INFO, "rep-based-pf = %d\n", vfr_bp->rep_based_pf);
 
 	return 0;
drivers/net/bnxt/bnxt_hwrm.c +6 -54

79 lines not on this page · raw message

drivers/net/bnxt/bnxt_hwrm.h +0 -2
index a7fa7f66b1..23ca6ab515 100644
@@ -297,8 +297,6 @@ int bnxt_hwrm_port_phy_qcaps(struct bnxt *bp);
 int bnxt_hwrm_oem_cmd(struct bnxt *bp, uint32_t entry_num);
 int bnxt_clear_one_vnic_filter(struct bnxt *bp,
 			       struct bnxt_filter_info *filter);
-int bnxt_hwrm_cfa_vfr_alloc(struct bnxt *bp, uint16_t vf_idx);
-int bnxt_hwrm_cfa_vfr_free(struct bnxt *bp, uint16_t vf_idx);
 void bnxt_hwrm_free_vf_info(struct bnxt *bp);
 int bnxt_hwrm_first_vf_id_query(struct bnxt *bp, uint16_t fid,
 				uint16_t *first_vf_id);
drivers/net/bnxt/bnxt_reps.c +8 -10
index b4566c926a..e5ba0909b9 100644
@@ -216,8 +216,9 @@ int bnxt_representor_init(struct rte_eth_dev *eth_dev, void *params)
 		    "Switch domain id %d: Representor Device %d init done\n",
 		    vf_rep_bp->switch_domain_id, vf_rep_bp->vf_id);
 
-	if (vf_rep_bp->rep_based_pf) {
+	if (BNXT_REP_BASED_PF(vf_rep_bp)) {
 		vf_rep_bp->fw_fid = vf_rep_bp->rep_based_pf + 1;
+		vf_rep_bp->parent_pf_idx = vf_rep_bp->rep_based_pf;
 		if (!(BNXT_REP_PF(vf_rep_bp))) {
 			/* VF representor for the remote PF,get first_vf_id */
 			rc = bnxt_hwrm_first_vf_id_query(parent_bp,
@@ -237,6 +238,10 @@ int bnxt_representor_init(struct rte_eth_dev *eth_dev, void *params)
 		}
 	}  else {
 		vf_rep_bp->fw_fid = rep_params->vf_id + parent_bp->first_vf_id;
+		if (BNXT_VF_IS_TRUSTED(parent_bp))
+			vf_rep_bp->parent_pf_idx = parent_bp->parent->fid - 1;
+		else
+			vf_rep_bp->parent_pf_idx = parent_bp->fw_fid - 1;
 	}
 
 	PMD_DRV_LOG(INFO, "vf_rep->fw_fid = %d\n", vf_rep_bp->fw_fid);
@@ -329,11 +334,7 @@ static int bnxt_tf_vfr_alloc(struct rte_eth_dev *vfr_ethdev)
 	/* update the port id so you can backtrack to ethdev */
 	vfr->dpdk_port_id = vfr_ethdev->data->port_id;
 
-	if (BNXT_STINGRAY(parent_bp)) {
-		rc = bnxt_hwrm_cfa_pair_alloc(parent_bp, vfr);
-	} else {
-		rc = bnxt_hwrm_cfa_vfr_alloc(parent_bp, vfr->vf_id);
-	}
+	rc = bnxt_hwrm_cfa_pair_alloc(parent_bp, vfr);
 	if (rc) {
 		BNXT_TF_DBG(ERR, "Failed in hwrm vfr alloc vfr:%u rc=%d\n",
 			    vfr->vf_id, rc);
@@ -468,10 +469,7 @@ static int bnxt_vfr_free(struct bnxt_representor *vfr)
 		    vfr->vf_id);
 	vfr->vfr_tx_cfa_action = 0;
 
-	if (BNXT_STINGRAY(parent_bp))
-		rc = bnxt_hwrm_cfa_pair_free(parent_bp, vfr);
-	else
-		rc = bnxt_hwrm_cfa_vfr_free(parent_bp, vfr->vf_id);
+	rc = bnxt_hwrm_cfa_pair_free(parent_bp, vfr);
 
 	return rc;
 }
Signature · 1 line
2.21.1 (Apple Git-122.3)
#60 lore raw

PATCH v3 8/11 net/bnxt: add mapper support for wildcard TCAM

In reply to Ajit Khaparde

From: Kishore Padmanabha <[email protected]>

Added support for the key and mask fields encoding for the wildcard tcam entry.

---
 drivers/net/bnxt/tf_ulp/ulp_mapper.c |  47 ++++++++--
 drivers/net/bnxt/tf_ulp/ulp_utils.c  | 125 +++++++++++++++++++++++++++
 drivers/net/bnxt/tf_ulp/ulp_utils.h  |  48 +++++++++-
 3 files changed, 212 insertions(+), 8 deletions(-)
drivers/net/bnxt/tf_ulp/ulp_mapper.c +40 -7
index b74cb92f57..27b4780990 100644
@@ -1497,6 +1497,29 @@ ulp_mapper_tcam_tbl_entry_write(struct bnxt_ulp_mapper_parms *parms,
 	return rc;
 }
 
+#define BNXT_ULP_WC_TCAM_SLICE_SIZE 80
+/* internal function to post process the key/mask blobs for wildcard tcam tbl */
+static void ulp_mapper_wc_tcam_tbl_post_process(struct ulp_blob *blob,
+						uint32_t len)
+{
+	uint8_t mode[2] = {0x0, 0x0};
+	uint32_t mode_len = len / BNXT_ULP_WC_TCAM_SLICE_SIZE;
+	uint32_t size, idx;
+
+	/* Add the mode bits to the key and mask*/
+	if (mode_len == 2)
+		mode[1] = 2;
+	else if (mode_len > 2)
+		mode[1] = 3;
+
+	size = BNXT_ULP_WC_TCAM_SLICE_SIZE + ULP_BYTE_2_BITS(sizeof(mode));
+	for (idx = 0; idx < mode_len; idx++)
+		ulp_blob_insert(blob, (size * idx), mode,
+				ULP_BYTE_2_BITS(sizeof(mode)));
+	ulp_blob_perform_64B_word_swap(blob);
+	ulp_blob_perform_64B_byte_swap(blob);
+}
+
 static int32_t
 ulp_mapper_tcam_tbl_process(struct bnxt_ulp_mapper_parms *parms,
 			    struct bnxt_ulp_mapper_tbl_info *tbl)
@@ -1533,9 +1556,9 @@ ulp_mapper_tcam_tbl_process(struct bnxt_ulp_mapper_parms *parms,
 		return -EINVAL;
 	}
 
-	if (!ulp_blob_init(&key, tbl->key_bit_size,
+	if (!ulp_blob_init(&key, tbl->blob_key_bit_size,
 			   parms->device_params->byte_order) ||
-	    !ulp_blob_init(&mask, tbl->key_bit_size,
+	    !ulp_blob_init(&mask, tbl->blob_key_bit_size,
 			   parms->device_params->byte_order) ||
 	    !ulp_blob_init(&data, tbl->result_bit_size,
 			   parms->device_params->byte_order) ||
@@ -1545,6 +1568,11 @@ ulp_mapper_tcam_tbl_process(struct bnxt_ulp_mapper_parms *parms,
 		return -EINVAL;
 	}
 
+	if (tbl->resource_type == TF_TCAM_TBL_TYPE_WC_TCAM) {
+		key.byte_order = BNXT_ULP_BYTE_ORDER_BE;
+		mask.byte_order = BNXT_ULP_BYTE_ORDER_BE;
+	}
+
 	/* create the key/mask */
 	/*
 	 * NOTE: The WC table will require some kind of flag to handle the
@@ -1570,6 +1598,11 @@ ulp_mapper_tcam_tbl_process(struct bnxt_ulp_mapper_parms *parms,
 		}
 	}
 
+	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
@@ -1578,18 +1611,18 @@ ulp_mapper_tcam_tbl_process(struct bnxt_ulp_mapper_parms *parms,
 		aparms.dir		= tbl->direction;
 		aparms.tcam_tbl_type	= tbl->resource_type;
 		aparms.search_enable	= tbl->srch_b4_alloc;
-		aparms.key_sz_in_bits	= tbl->key_bit_size;
 		aparms.key		= ulp_blob_data_get(&key, &tmplen);
-		if (tbl->key_bit_size != 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->key_bit_size);
+				    tmplen, tbl->blob_key_bit_size);
 			return -EINVAL;
 		}
 
 		aparms.mask		= ulp_blob_data_get(&mask, &tmplen);
-		if (tbl->key_bit_size != tmplen) {
+		if (tbl->blob_key_bit_size != tmplen) {
 			BNXT_TF_DBG(ERR, "Mask len (%d) != Expected (%d)\n",
-				    tmplen, tbl->key_bit_size);
+				    tmplen, tbl->blob_key_bit_size);
 			return -EINVAL;
 		}
 
drivers/net/bnxt/tf_ulp/ulp_utils.c +125 -0

137 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_utils.h +47 -1

72 lines not on this page · raw message

Signature · 1 line
2.21.1 (Apple Git-122.3)
#61 lore raw

PATCH v3 9/11 net/bnxt: refactor flow id allocation

In reply to Ajit Khaparde

From: Venkat Duvvuru <[email protected]>

Currently, the flow id is allocated inside ulp_mapper_flow_create. However with vxlan decap feature if F2 flow comes before F1 flow then F2 is cached and not really installed in the hardware which means the code will return without calling ulp_mapper_flow_create. But, ULP has to still return valid flow id to the stack. Hence, move the flow id allocation outside ulp_mapper_flow_create.

---
 drivers/net/bnxt/tf_ulp/bnxt_ulp_flow.c  | 109 ++++++++++++++++-------
 drivers/net/bnxt/tf_ulp/ulp_def_rules.c  |  48 ++++++++--
 drivers/net/bnxt/tf_ulp/ulp_mapper.c     |  35 +-------
 drivers/net/bnxt/tf_ulp/ulp_mapper.h     |   4 +-
 drivers/net/bnxt/tf_ulp/ulp_rte_parser.h |   9 ++
 5 files changed, 132 insertions(+), 73 deletions(-)
drivers/net/bnxt/tf_ulp/bnxt_ulp_flow.c +77 -32
index c7b29824e4..47fbaba03c 100644
@@ -74,6 +74,29 @@ bnxt_ulp_set_dir_attributes(struct ulp_rte_parser_params *params,
 		params->dir_attr |= BNXT_ULP_FLOW_ATTR_TRANSFER;
 }
 
+void
+bnxt_ulp_init_mapper_params(struct bnxt_ulp_mapper_create_parms *mapper_cparms,
+			    struct ulp_rte_parser_params *params,
+			    uint32_t priority, uint32_t class_id,
+			    uint32_t act_tmpl, uint16_t func_id,
+			    uint32_t fid,
+			    enum bnxt_ulp_fdb_type flow_type)
+{
+	mapper_cparms->app_priority = priority;
+	mapper_cparms->dir_attr = params->dir_attr;
+
+	mapper_cparms->class_tid = class_id;
+	mapper_cparms->act_tid = act_tmpl;
+	mapper_cparms->func_id = func_id;
+	mapper_cparms->hdr_bitmap = &params->hdr_bitmap;
+	mapper_cparms->hdr_field = params->hdr_field;
+	mapper_cparms->comp_fld = params->comp_fld;
+	mapper_cparms->act = &params->act_bitmap;
+	mapper_cparms->act_prop = &params->act_prop;
+	mapper_cparms->flow_type = flow_type;
+	mapper_cparms->flow_id = fid;
+}
+
 /* Function to create the rte flow. */
 static struct rte_flow *
 bnxt_ulp_flow_create(struct rte_eth_dev *dev,
@@ -85,22 +108,23 @@ bnxt_ulp_flow_create(struct rte_eth_dev *dev,
 	struct bnxt_ulp_mapper_create_parms mapper_cparms = { 0 };
 	struct ulp_rte_parser_params params;
 	struct bnxt_ulp_context *ulp_ctx;
+	int rc, ret = BNXT_TF_RC_ERROR;
 	uint32_t class_id, act_tmpl;
 	struct rte_flow *flow_id;
+	uint16_t func_id;
 	uint32_t fid;
-	int ret = BNXT_TF_RC_ERROR;
 
 	if (bnxt_ulp_flow_validate_args(attr,
 					pattern, actions,
 					error) == BNXT_TF_RC_ERROR) {
 		BNXT_TF_DBG(ERR, "Invalid arguments being passed\n");
-		goto parse_error;
+		goto parse_err1;
 	}
 
 	ulp_ctx = bnxt_ulp_eth_dev_ptr2_cntxt_get(dev);
 	if (!ulp_ctx) {
 		BNXT_TF_DBG(ERR, "ULP context is not initialized\n");
-		goto parse_error;
+		goto parse_err1;
 	}
 
 	/* Initialize the parser params */
@@ -116,56 +140,72 @@ bnxt_ulp_flow_create(struct rte_eth_dev *dev,
 	ULP_COMP_FLD_IDX_WR(&params, BNXT_ULP_CF_IDX_SVIF_FLAG,
 			    BNXT_ULP_INVALID_SVIF_VAL);
 
+	/* Get the function id */
+	if (ulp_port_db_port_func_id_get(ulp_ctx,
+					 dev->data->port_id,
+					 &func_id)) {
+		BNXT_TF_DBG(ERR, "conversion of port to func id failed\n");
+		goto parse_err1;
+	}
+
+	/* Protect flow creation */
+	if (bnxt_ulp_cntxt_acquire_fdb_lock(ulp_ctx)) {
+		BNXT_TF_DBG(ERR, "Flow db lock acquire failed\n");
+		goto parse_err1;
+	}
+
+	/* Allocate a Flow ID for attaching all resources for the flow to.
+	 * Once allocated, all errors have to walk the list of resources and
+	 * free each of them.
+	 */
+	rc = ulp_flow_db_fid_alloc(ulp_ctx, BNXT_ULP_FDB_TYPE_REGULAR,
+				   func_id, &fid);
+	if (rc) {
+		BNXT_TF_DBG(ERR, "Unable to allocate flow table entry\n");
+		goto parse_err2;
+	}
+
 	/* Parse the rte flow pattern */
 	ret = bnxt_ulp_rte_parser_hdr_parse(pattern, &params);
 	if (ret != BNXT_TF_RC_SUCCESS)
-		goto parse_error;
+		goto parse_err3;
 
 	/* Parse the rte flow action */
 	ret = bnxt_ulp_rte_parser_act_parse(actions, &params);
 	if (ret != BNXT_TF_RC_SUCCESS)
-		goto parse_error;
+		goto parse_err3;
 
 	/* Perform the rte flow post process */
 	ret = bnxt_ulp_rte_parser_post_process(&params);
 	if (ret != BNXT_TF_RC_SUCCESS)
-		goto parse_error;
+		goto parse_err3;
 
 	ret = ulp_matcher_pattern_match(&params, &class_id);
 	if (ret != BNXT_TF_RC_SUCCESS)
-		goto parse_error;
+		goto parse_err3;
 
 	ret = ulp_matcher_action_match(&params, &act_tmpl);
 	if (ret != BNXT_TF_RC_SUCCESS)
-		goto parse_error;
+		goto parse_err3;
 
-	mapper_cparms.app_priority = attr->priority;
-	mapper_cparms.hdr_bitmap = &params.hdr_bitmap;
-	mapper_cparms.hdr_field = params.hdr_field;
-	mapper_cparms.comp_fld = params.comp_fld;
-	mapper_cparms.act = &params.act_bitmap;
-	mapper_cparms.act_prop = &params.act_prop;
-	mapper_cparms.class_tid = class_id;
-	mapper_cparms.act_tid = act_tmpl;
-	mapper_cparms.flow_type = BNXT_ULP_FDB_TYPE_REGULAR;
+	bnxt_ulp_init_mapper_params(&mapper_cparms, &params, attr->priority,
+				    class_id, act_tmpl, func_id, fid,
+				    BNXT_ULP_FDB_TYPE_REGULAR);
+	/* Call the ulp mapper to create the flow in the hardware. */
+	ret = ulp_mapper_flow_create(ulp_ctx, &mapper_cparms);
+	if (ret)
+		goto parse_err3;
 
-	/* Get the function id */
-	if (ulp_port_db_port_func_id_get(ulp_ctx,
-					 dev->data->port_id,
-					 &mapper_cparms.func_id)) {
-		BNXT_TF_DBG(ERR, "conversion of port to func id failed\n");
-		goto parse_error;
-	}
-	mapper_cparms.dir_attr = params.dir_attr;
+	bnxt_ulp_cntxt_release_fdb_lock(ulp_ctx);
 
-	/* Call the ulp mapper to create the flow in the hardware. */
-	ret = ulp_mapper_flow_create(ulp_ctx, &mapper_cparms, &fid);
-	if (!ret) {
-		flow_id = (struct rte_flow *)((uintptr_t)fid);
-		return flow_id;
-	}
+	flow_id = (struct rte_flow *)((uintptr_t)fid);
+	return flow_id;
 
-parse_error:
+parse_err3:
+	ulp_flow_db_fid_free(ulp_ctx, BNXT_ULP_FDB_TYPE_REGULAR, fid);
+parse_err2:
+	bnxt_ulp_cntxt_release_fdb_lock(ulp_ctx);
+parse_err1:
 	rte_flow_error_set(error, ret, RTE_FLOW_ERROR_TYPE_HANDLE, NULL,
 			   "Failed to create flow.");
 	return NULL;
@@ -281,6 +321,10 @@ bnxt_ulp_flow_destroy(struct rte_eth_dev *dev,
 		return -EINVAL;
 	}
 
+	if (bnxt_ulp_cntxt_acquire_fdb_lock(ulp_ctx)) {
+		BNXT_TF_DBG(ERR, "Flow db lock acquire failed\n");
+		return -EINVAL;
+	}
 	ret = ulp_mapper_flow_destroy(ulp_ctx, BNXT_ULP_FDB_TYPE_REGULAR,
 				      flow_id);
 	if (ret) {
@@ -290,6 +334,7 @@ bnxt_ulp_flow_destroy(struct rte_eth_dev *dev,
 					   RTE_FLOW_ERROR_TYPE_HANDLE, NULL,
 					   "Failed to destroy flow.");
 	}
+	bnxt_ulp_cntxt_release_fdb_lock(ulp_ctx);
 
 	return ret;
 }
drivers/net/bnxt/tf_ulp/ulp_def_rules.c +41 -7

81 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_mapper.c +3 -32
index 27b4780990..d5c129b3a6 100644
@@ -2723,15 +2723,9 @@ ulp_mapper_flow_destroy(struct bnxt_ulp_context *ulp_ctx,
 		BNXT_TF_DBG(ERR, "Invalid parms, unable to free flow\n");
 		return -EINVAL;
 	}
-	if (bnxt_ulp_cntxt_acquire_fdb_lock(ulp_ctx)) {
-		BNXT_TF_DBG(ERR, "Flow db lock acquire failed\n");
-		return -EINVAL;
-	}
 
 	rc = ulp_mapper_resources_free(ulp_ctx, flow_type, fid);
-	bnxt_ulp_cntxt_release_fdb_lock(ulp_ctx);
 	return rc;
-
 }
 
 /* Function to handle the default global templates that are allocated during
@@ -2795,8 +2789,7 @@ ulp_mapper_glb_template_table_init(struct bnxt_ulp_context *ulp_ctx)
  */
 int32_t
 ulp_mapper_flow_create(struct bnxt_ulp_context *ulp_ctx,
-		       struct bnxt_ulp_mapper_create_parms *cparms,
-		       uint32_t *flowid)
+		       struct bnxt_ulp_mapper_create_parms *cparms)
 {
 	struct bnxt_ulp_mapper_parms parms;
 	struct ulp_regfile regfile;
@@ -2821,6 +2814,7 @@ ulp_mapper_flow_create(struct bnxt_ulp_context *ulp_ctx,
 	parms.flow_type = cparms->flow_type;
 	parms.parent_flow = cparms->parent_flow;
 	parms.parent_fid = cparms->parent_fid;
+	parms.fid = cparms->flow_id;
 
 	/* Get the device id from the ulp context */
 	if (bnxt_ulp_cntxt_dev_id_get(ulp_ctx, &parms.dev_id)) {
@@ -2861,26 +2855,7 @@ ulp_mapper_flow_create(struct bnxt_ulp_context *ulp_ctx,
 		return -EINVAL;
 	}
 
-	/* Protect flow creation */
-	if (bnxt_ulp_cntxt_acquire_fdb_lock(ulp_ctx)) {
-		BNXT_TF_DBG(ERR, "Flow db lock acquire failed\n");
-		return -EINVAL;
-	}
-
-	/* Allocate a Flow ID for attaching all resources for the flow to.
-	 * Once allocated, all errors have to walk the list of resources and
-	 * free each of them.
-	 */
-	rc = ulp_flow_db_fid_alloc(ulp_ctx,
-				   parms.flow_type,
-				   cparms->func_id,
-				   &parms.fid);
-	if (rc) {
-		BNXT_TF_DBG(ERR, "Unable to allocate flow table entry\n");
-		bnxt_ulp_cntxt_release_fdb_lock(ulp_ctx);
-		return rc;
-	}
-
+	/* Process the action template list from the selected action table*/
 	if (parms.act_tid) {
 		parms.tmpl_type = BNXT_ULP_TEMPLATE_TYPE_ACTION;
 		/* Process the action template tables */
@@ -2911,13 +2886,9 @@ ulp_mapper_flow_create(struct bnxt_ulp_context *ulp_ctx,
 			goto flow_error;
 	}
 
-	*flowid = parms.fid;
-	bnxt_ulp_cntxt_release_fdb_lock(ulp_ctx);
-
 	return rc;
 
 flow_error:
-	bnxt_ulp_cntxt_release_fdb_lock(ulp_ctx);
 	/* Free all resources that were allocated during flow creation */
 	trc = ulp_mapper_flow_destroy(ulp_ctx, BNXT_ULP_FDB_TYPE_REGULAR,
 				      parms.fid);
drivers/net/bnxt/tf_ulp/ulp_mapper.h +2 -2
index 542e41e5aa..0595d1555d 100644
@@ -93,6 +93,7 @@ struct bnxt_ulp_mapper_create_parms {
 	uint32_t			dir_attr;
 	enum bnxt_ulp_fdb_type		flow_type;
 
+	uint32_t			flow_id;
 	/* if set then create it as a child flow with parent as parent_fid */
 	uint32_t			parent_fid;
 	/* if set then create a parent flow */
@@ -113,8 +114,7 @@ ulp_mapper_deinit(struct bnxt_ulp_context *ulp_ctx);
  */
 int32_t
 ulp_mapper_flow_create(struct bnxt_ulp_context	*ulp_ctx,
-		       struct bnxt_ulp_mapper_create_parms *parms,
-		       uint32_t *flowid);
+		       struct bnxt_ulp_mapper_create_parms *parms);
 
 /* Function that frees all resources associated with the flow. */
 int32_t
drivers/net/bnxt/tf_ulp/ulp_rte_parser.h +9 -0
index 41f3df998e..bb5a8a477e 100644
@@ -11,6 +11,7 @@
 #include <rte_flow_driver.h>
 #include "ulp_template_db_enum.h"
 #include "ulp_template_struct.h"
+#include "ulp_mapper.h"
 
 /* defines to be used in the tunnel header parsing */
 #define BNXT_ULP_ENCAP_IPV4_VER_HLEN_TOS	2
@@ -34,6 +35,14 @@
 #define	BNXT_ULP_PARSER_IPV6_TC			0x0ff00000
 #define	BNXT_ULP_PARSER_IPV6_FLOW_LABEL		0x000fffff
 
+void
+bnxt_ulp_init_mapper_params(struct bnxt_ulp_mapper_create_parms *mapper_cparms,
+			    struct ulp_rte_parser_params *params,
+			    uint32_t priority, uint32_t class_id,
+			    uint32_t act_tmpl, uint16_t func_id,
+			    uint32_t flow_id,
+			    enum bnxt_ulp_fdb_type flow_type);
+
 /* Function to handle the parsing of the RTE port id. */
 int32_t
 ulp_rte_parser_implicit_match_port_process(struct ulp_rte_parser_params *param);
Signature · 1 line
2.21.1 (Apple Git-122.3)
#62 lore raw

PATCH v3 10/11 net/bnxt: add support for VXLAN decap templates

In reply to Ajit Khaparde

From: Venkat Duvvuru <[email protected]>

Templates for outer tunnel & inner tunnel flow are added in this patch.

---
 drivers/net/bnxt/tf_ulp/ulp_rte_parser.c      |   10 +
 drivers/net/bnxt/tf_ulp/ulp_rte_parser.h      |    5 +
 .../net/bnxt/tf_ulp/ulp_template_db_class.c   |  962 ++++---
 .../net/bnxt/tf_ulp/ulp_template_db_enum.h    |   35 +-
 .../net/bnxt/tf_ulp/ulp_template_db_field.h   |  363 ++-
 .../tf_ulp/ulp_template_db_stingray_act.c     |  116 +-
 .../tf_ulp/ulp_template_db_stingray_class.c   | 2493 ++++++++++++++---
 drivers/net/bnxt/tf_ulp/ulp_template_db_tbl.c |    9 +-
 .../bnxt/tf_ulp/ulp_template_db_wh_plus_act.c |  116 +-
 .../tf_ulp/ulp_template_db_wh_plus_class.c    | 2489 +++++++++++++---
 10 files changed, 5127 insertions(+), 1471 deletions(-)
drivers/net/bnxt/tf_ulp/ulp_rte_parser.c +10 -0
index 770fec55c2..42021ae8d5 100644
@@ -2110,3 +2110,13 @@ ulp_rte_dec_ttl_act_handler(const struct rte_flow_action *act __rte_unused,
 	ULP_BITMAP_SET(params->act_bitmap.bits, BNXT_ULP_ACTION_BIT_DEC_TTL);
 	return BNXT_TF_RC_SUCCESS;
 }
+
+/* Function to handle the parsing of RTE Flow action JUMP */
+int32_t
+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);
+	return BNXT_TF_RC_SUCCESS;
+}
drivers/net/bnxt/tf_ulp/ulp_rte_parser.h +5 -0
index bb5a8a477e..a71aabe5f0 100644
@@ -233,4 +233,9 @@ int32_t
 ulp_rte_dec_ttl_act_handler(const struct rte_flow_action *action_item,
 			    struct ulp_rte_parser_params *params);
 
+/* Function to handle the parsing of RTE Flow action JUMP .*/
+int32_t
+ulp_rte_jump_act_handler(const struct rte_flow_action *action_item,
+			 struct ulp_rte_parser_params *params);
+
 #endif /* _ULP_RTE_PARSER_H_ */
drivers/net/bnxt/tf_ulp/ulp_template_db_class.c +645 -317

1,476 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_template_db_enum.h +30 -5
index 6dade9afdb..10838f5cc2 100644
@@ -11,7 +11,7 @@
 #define BNXT_ULP_LOG2_MAX_NUM_DEV 2
 #define BNXT_ULP_CACHE_TBL_MAX_SZ 4
 #define BNXT_ULP_CLASS_SIG_TBL_MAX_SZ 2048
-#define BNXT_ULP_CLASS_MATCH_LIST_MAX_SZ 201
+#define BNXT_ULP_CLASS_MATCH_LIST_MAX_SZ 217
 #define BNXT_ULP_CLASS_HID_LOW_PRIME 7919
 #define BNXT_ULP_CLASS_HID_HIGH_PRIME 7907
 #define BNXT_ULP_CLASS_HID_SHFTR 32
@@ -52,7 +52,8 @@ enum bnxt_ulp_action_bit {
 	BNXT_ULP_ACTION_BIT_SET_TP_SRC       = 0x0000000000100000,
 	BNXT_ULP_ACTION_BIT_SET_TP_DST       = 0x0000000000200000,
 	BNXT_ULP_ACTION_BIT_VXLAN_ENCAP      = 0x0000000000400000,
-	BNXT_ULP_ACTION_BIT_LAST             = 0x0000000000800000
+	BNXT_ULP_ACTION_BIT_JUMP             = 0x0000000000800000,
+	BNXT_ULP_ACTION_BIT_LAST             = 0x0000000001000000
 };
 
 enum bnxt_ulp_hdr_bit {
@@ -72,7 +73,8 @@ enum bnxt_ulp_hdr_bit {
 	BNXT_ULP_HDR_BIT_I_IPV6              = 0x0000000000002000,
 	BNXT_ULP_HDR_BIT_I_TCP               = 0x0000000000004000,
 	BNXT_ULP_HDR_BIT_I_UDP               = 0x0000000000008000,
-	BNXT_ULP_HDR_BIT_LAST                = 0x0000000000010000
+	BNXT_ULP_HDR_BIT_F1                  = 0x0000000000010000,
+	BNXT_ULP_HDR_BIT_LAST                = 0x0000000000020000
 };
 
 enum bnxt_ulp_act_type {
@@ -341,6 +343,10 @@ enum bnxt_ulp_resource_sub_type {
 enum bnxt_ulp_sym {
 	BNXT_ULP_SYM_PKT_TYPE_IGNORE = 0,
 	BNXT_ULP_SYM_PKT_TYPE_L2 = 0,
+	BNXT_ULP_SYM_PKT_TYPE_0_IGNORE = 0,
+	BNXT_ULP_SYM_PKT_TYPE_0_L2 = 0,
+	BNXT_ULP_SYM_PKT_TYPE_1_IGNORE = 0,
+	BNXT_ULP_SYM_PKT_TYPE_1_L2 = 0,
 	BNXT_ULP_SYM_RECYCLE_CNT_IGNORE = 0,
 	BNXT_ULP_SYM_RECYCLE_CNT_ZERO = 0,
 	BNXT_ULP_SYM_RECYCLE_CNT_ONE = 1,
@@ -551,7 +557,8 @@ enum bnxt_ulp_sym {
 	BNXT_ULP_SYM_IP_PROTO_UDP = 17,
 	BNXT_ULP_SYM_VF_FUNC_PARIF = 15,
 	BNXT_ULP_SYM_NO = 0,
-	BNXT_ULP_SYM_YES = 1
+	BNXT_ULP_SYM_YES = 1,
+	BNXT_ULP_SYM_RECYCLE_DST = 0x800
 };
 
 enum bnxt_ulp_wh_plus {
@@ -600,6 +607,7 @@ enum bnxt_ulp_act_prop_sz {
 	BNXT_ULP_ACT_PROP_SZ_ENCAP_IP_SRC = 16,
 	BNXT_ULP_ACT_PROP_SZ_ENCAP_UDP = 4,
 	BNXT_ULP_ACT_PROP_SZ_ENCAP_TUN = 32,
+	BNXT_ULP_ACT_PROP_SZ_JUMP = 4,
 	BNXT_ULP_ACT_PROP_SZ_LAST = 4
 };
 
@@ -644,7 +652,8 @@ enum bnxt_ulp_act_prop_idx {
 	BNXT_ULP_ACT_PROP_IDX_ENCAP_IP_SRC = 205,
 	BNXT_ULP_ACT_PROP_IDX_ENCAP_UDP = 221,
 	BNXT_ULP_ACT_PROP_IDX_ENCAP_TUN = 225,
-	BNXT_ULP_ACT_PROP_IDX_LAST = 257
+	BNXT_ULP_ACT_PROP_IDX_JUMP = 257,
+	BNXT_ULP_ACT_PROP_IDX_LAST = 261
 };
 
 enum bnxt_ulp_class_hid {
@@ -796,6 +805,22 @@ enum bnxt_ulp_class_hid {
 	BNXT_ULP_CLASS_HID_05b9 = 0x05b9,
 	BNXT_ULP_CLASS_HID_0371 = 0x0371,
 	BNXT_ULP_CLASS_HID_00e1 = 0x00e1,
+	BNXT_ULP_CLASS_HID_0000 = 0x0000,
+	BNXT_ULP_CLASS_HID_00ce = 0x00ce,
+	BNXT_ULP_CLASS_HID_01b6 = 0x01b6,
+	BNXT_ULP_CLASS_HID_0074 = 0x0074,
+	BNXT_ULP_CLASS_HID_00fe = 0x00fe,
+	BNXT_ULP_CLASS_HID_03bc = 0x03bc,
+	BNXT_ULP_CLASS_HID_0206 = 0x0206,
+	BNXT_ULP_CLASS_HID_02c4 = 0x02c4,
+	BNXT_ULP_CLASS_HID_055a = 0x055a,
+	BNXT_ULP_CLASS_HID_045a = 0x045a,
+	BNXT_ULP_CLASS_HID_061a = 0x061a,
+	BNXT_ULP_CLASS_HID_051a = 0x051a,
+	BNXT_ULP_CLASS_HID_074a = 0x074a,
+	BNXT_ULP_CLASS_HID_004e = 0x004e,
+	BNXT_ULP_CLASS_HID_040a = 0x040a,
+	BNXT_ULP_CLASS_HID_010e = 0x010e,
 	BNXT_ULP_CLASS_HID_048b = 0x048b,
 	BNXT_ULP_CLASS_HID_0749 = 0x0749,
 	BNXT_ULP_CLASS_HID_05f1 = 0x05f1,
drivers/net/bnxt/tf_ulp/ulp_template_db_field.h +263 -100

434 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_template_db_stingray_act.c +58 -58

319 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_template_db_stingray_class.c +2027 -466

666 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_template_db_tbl.c +6 -3
index 7f5a316804..c5f340d7bb 100644

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

drivers/net/bnxt/tf_ulp/ulp_template_db_wh_plus_act.c +58 -58

116 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_template_db_wh_plus_class.c +2025 -464

2,489 lines not on this page · raw message

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

Signature · 1 line
2.21.1 (Apple Git-122.3)

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

#63 lore raw

PATCH v3 11/11 net/bnxt: add VXLAN decap offload support

In reply to Ajit Khaparde

From: Venkat Duvvuru <[email protected]>

VXLAN decap offload can happen in stages. The offload request may not come as a single flow request rather may come as two flow offload requests F1 & F2. This patch is adding support for this two stage offload design. The match criteria for F1 is O_DMAC, O_SMAC, O_DST_IP, O_UDP_DPORT and actions are COUNT, MARK, JUMP. The match criteria for F2 is O_SRC_IP, O_DST_IP, VNI and inner header fields. F1 and F2 flow offload requests can come in any order. If F2 flow offload request comes first then F2 can’t be offloaded as there is no O_DMAC information in F2. In this case, F2 will be deferred until F1 flow offload request arrives. When F1 flow offload request is received it will have O_DMAC information. Using F1’s O_DMAC, driver creates an L2 context entry in the hardware as part of offloading F1. F2 will now use F1’s O_DMAC to get the L2 context id associated with this O_DMAC and other flow fields that are cached already at the time of deferring F2 for offloading. F2s that arrive after F1 is offloaded will be directly programmed and not cached.

---
 doc/guides/nics/bnxt.rst                      |  18 +
 doc/guides/rel_notes/release_20_11.rst        |   1 +
 drivers/net/bnxt/meson.build                  |   1 +
 drivers/net/bnxt/tf_ulp/bnxt_tf_common.h      |   4 +-
 drivers/net/bnxt/tf_ulp/bnxt_ulp.c            |  10 +
 drivers/net/bnxt/tf_ulp/bnxt_ulp.h            |  12 +
 drivers/net/bnxt/tf_ulp/bnxt_ulp_flow.c       |  84 ++---
 drivers/net/bnxt/tf_ulp/ulp_flow_db.c         | 149 +++++++--
 drivers/net/bnxt/tf_ulp/ulp_flow_db.h         |   2 +
 drivers/net/bnxt/tf_ulp/ulp_mapper.c          |   1 +
 drivers/net/bnxt/tf_ulp/ulp_mapper.h          |   2 +
 drivers/net/bnxt/tf_ulp/ulp_rte_parser.c      |  75 ++++-
 drivers/net/bnxt/tf_ulp/ulp_rte_parser.h      |   4 +-
 .../net/bnxt/tf_ulp/ulp_template_db_enum.h    |   4 +-
 drivers/net/bnxt/tf_ulp/ulp_template_struct.h |   7 +
 drivers/net/bnxt/tf_ulp/ulp_tun.c             | 310 ++++++++++++++++++
 drivers/net/bnxt/tf_ulp/ulp_tun.h             |  92 ++++++
 17 files changed, 694 insertions(+), 82 deletions(-)
 create mode 100644 drivers/net/bnxt/tf_ulp/ulp_tun.c
 create mode 100644 drivers/net/bnxt/tf_ulp/ulp_tun.h
doc/guides/nics/bnxt.rst +18 -0
index 28973fc3e2..eee10a3cd6 100644
@@ -706,6 +706,24 @@ Notes
   flows to be directed to one or more queues associated with the VNIC id.
   This implementation is supported only when TRUFLOW functionality is disabled.
 
+- An application can issue a VXLAN decap offload request using rte_flow API
+  either as a single rte_flow request or a combination of two stages.
+  The PMD currently supports the two stage offload design.
+  In this approach the offload request may come as two flow offload requests
+  Flow1 & Flow2.  The match criteria for Flow1 is O_DMAC, O_SMAC, O_DST_IP,
+  O_UDP_DPORT and actions are COUNT, MARK, JUMP. The match criteria for Flow2
+  is O_SRC_IP, O_DST_IP, VNI and inner header fields.
+  Flow1 and Flow2 flow offload requests can come in any order. If Flow2 flow
+  offload request comes first then Flow2 can’t be offloaded as there is
+  no O_DMAC information in Flow2. In this case, Flow2 will be deferred until
+  Flow1 flow offload request arrives. When Flow1 flow offload request is
+  received it will have O_DMAC information. Using Flow1’s O_DMAC, driver
+  creates an L2 context entry in the hardware as part of offloading Flow1.
+  Flow2 will now use Flow1’s O_DMAC to get the L2 context id associated with
+  this O_DMAC and other flow fields that are cached already at the time
+  of deferring Flow2 for offloading. Flow2 that arrive after Flow1 is offloaded
+  will be directly programmed and not cached.
+
 Note: A VNIC represents a virtual interface in the hardware. It is a resource
 in the RX path of the chip and is used to setup various target actions such as
 RSS, MAC filtering etc. for the physical function in use.
doc/guides/rel_notes/release_20_11.rst +1 -0
index 4c1961ced7..06b74e56c1 100644
@@ -148,6 +148,7 @@ New Features
   * Updated HWRM structures to 1.10.1.70 version.
   * Added TRUFLOW support for Stingray devices.
   * Added support for representors on MAIA cores of SR.
+  * Added support for VXLAN decap offload using rte_flow.
 
 * **Updated Cisco enic driver.**
 
drivers/net/bnxt/meson.build +1 -0
index 39521080f8..bc74f88c69 100644
@@ -64,6 +64,7 @@ sources = files('bnxt_cpr.c',
 	'tf_ulp/ulp_port_db.c',
 	'tf_ulp/ulp_def_rules.c',
 	'tf_ulp/ulp_fc_mgr.c',
+	'tf_ulp/ulp_tun.c',
 	'tf_ulp/ulp_template_db_wh_plus_act.c',
 	'tf_ulp/ulp_template_db_wh_plus_class.c',
 	'tf_ulp/ulp_template_db_stingray_act.c',
drivers/net/bnxt/tf_ulp/bnxt_tf_common.h +3 -1
index f0633f009c..b2629e47b6 100644
@@ -33,7 +33,9 @@
 enum bnxt_tf_rc {
 	BNXT_TF_RC_PARSE_ERR	= -2,
 	BNXT_TF_RC_ERROR	= -1,
-	BNXT_TF_RC_SUCCESS	= 0
+	BNXT_TF_RC_SUCCESS	= 0,
+	BNXT_TF_RC_NORMAL	= 1,
+	BNXT_TF_RC_FID		= 2,
 };
 
 /* eth IPv4 Type */
drivers/net/bnxt/tf_ulp/bnxt_ulp.c +10 -0
index d753b5af9f..26fd3009f2 100644
@@ -1321,6 +1321,16 @@ bnxt_ulp_cntxt_ptr2_flow_db_get(struct bnxt_ulp_context	*ulp_ctx)
 	return ulp_ctx->cfg_data->flow_db;
 }
 
+/* Function to get the tunnel cache table info from the ulp context. */
+struct bnxt_tun_cache_entry *
+bnxt_ulp_cntxt_ptr2_tun_tbl_get(struct bnxt_ulp_context *ulp_ctx)
+{
+	if (!ulp_ctx || !ulp_ctx->cfg_data)
+		return NULL;
+
+	return ulp_ctx->cfg_data->tun_tbl;
+}
+
 /* Function to get the ulp context from eth device. */
 struct bnxt_ulp_context	*
 bnxt_ulp_eth_dev_ptr2_cntxt_get(struct rte_eth_dev	*dev)
drivers/net/bnxt/tf_ulp/bnxt_ulp.h +12 -0
index c2c5bcb1d2..db1ee50c05 100644
@@ -13,6 +13,8 @@
 #include "rte_ethdev.h"
 
 #include "ulp_template_db_enum.h"
+#include "ulp_tun.h"
+#include "bnxt_tf_common.h"
 
 /* NAT defines to reuse existing inner L2 SMAC and DMAC */
 #define BNXT_ULP_NAT_INNER_L2_HEADER_SMAC	0x2000
@@ -55,6 +57,9 @@ struct bnxt_ulp_data {
 	struct bnxt_ulp_df_rule_info	df_rule_info[RTE_MAX_ETHPORTS];
 	struct bnxt_ulp_vfr_rule_info	vfr_rule_info[RTE_MAX_ETHPORTS];
 	enum bnxt_ulp_flow_mem_type	mem_type;
+#define	BNXT_ULP_TUN_ENTRY_INVALID	-1
+#define	BNXT_ULP_MAX_TUN_CACHE_ENTRIES	16
+	struct bnxt_tun_cache_entry	tun_tbl[BNXT_ULP_MAX_TUN_CACHE_ENTRIES];
 };
 
 struct bnxt_ulp_context {
@@ -151,6 +156,10 @@ bnxt_ulp_cntxt_ptr2_flow_db_set(struct bnxt_ulp_context	*ulp_ctx,
 struct bnxt_ulp_flow_db	*
 bnxt_ulp_cntxt_ptr2_flow_db_get(struct bnxt_ulp_context	*ulp_ctx);
 
+/* Function to get the tunnel cache table info from the ulp context. */
+struct bnxt_tun_cache_entry *
+bnxt_ulp_cntxt_ptr2_tun_tbl_get(struct bnxt_ulp_context	*ulp_ctx);
+
 /* Function to get the ulp context from eth device. */
 struct bnxt_ulp_context	*
 bnxt_ulp_eth_dev_ptr2_cntxt_get(struct rte_eth_dev *dev);
@@ -214,4 +223,7 @@ bnxt_ulp_cntxt_acquire_fdb_lock(struct bnxt_ulp_context	*ulp_ctx);
 void
 bnxt_ulp_cntxt_release_fdb_lock(struct bnxt_ulp_context	*ulp_ctx);
 
+int32_t
+ulp_post_process_tun_flow(struct ulp_rte_parser_params *params);
+
 #endif /* _BNXT_ULP_H_ */
drivers/net/bnxt/tf_ulp/bnxt_ulp_flow.c +44 -40

179 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_flow_db.c +120 -29

191 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_flow_db.h +2 -0
index 10e69bae45..f7dfd67bed 100644
@@ -60,6 +60,8 @@ struct ulp_fdb_parent_info {
 	uint64_t	pkt_count;
 	uint64_t	byte_count;
 	uint64_t	*child_fid_bitset;
+	uint32_t	f2_cnt;
+	uint8_t		tun_idx;
 };
 
 /* Structure to maintain parent-child flow relationships */
drivers/net/bnxt/tf_ulp/ulp_mapper.c +1 -0
index d5c129b3a6..29643232d8 100644
@@ -2815,6 +2815,7 @@ ulp_mapper_flow_create(struct bnxt_ulp_context *ulp_ctx,
 	parms.parent_flow = cparms->parent_flow;
 	parms.parent_fid = cparms->parent_fid;
 	parms.fid = cparms->flow_id;
+	parms.tun_idx = cparms->tun_idx;
 
 	/* Get the device id from the ulp context */
 	if (bnxt_ulp_cntxt_dev_id_get(ulp_ctx, &parms.dev_id)) {
drivers/net/bnxt/tf_ulp/ulp_mapper.h +2 -0
index 0595d1555d..9bd94f5c29 100644
@@ -78,6 +78,7 @@ struct bnxt_ulp_mapper_parms {
 	struct bnxt_ulp_device_params           *device_params;
 	uint32_t				parent_fid;
 	uint32_t				parent_flow;
+	uint8_t					tun_idx;
 };
 
 struct bnxt_ulp_mapper_create_parms {
@@ -98,6 +99,7 @@ struct bnxt_ulp_mapper_create_parms {
 	uint32_t			parent_fid;
 	/* if set then create a parent flow */
 	uint32_t			parent_flow;
+	uint8_t				tun_idx;
 };
 
 /* Function to initialize any dynamic mapper data. */
drivers/net/bnxt/tf_ulp/ulp_rte_parser.c +67 -8

138 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_rte_parser.h +1 -3
index a71aabe5f0..7996317903 100644
@@ -12,6 +12,7 @@
 #include "ulp_template_db_enum.h"
 #include "ulp_template_struct.h"
 #include "ulp_mapper.h"
+#include "bnxt_tf_common.h"
 
 /* defines to be used in the tunnel header parsing */
 #define BNXT_ULP_ENCAP_IPV4_VER_HLEN_TOS	2
@@ -38,9 +39,6 @@
 void
 bnxt_ulp_init_mapper_params(struct bnxt_ulp_mapper_create_parms *mapper_cparms,
 			    struct ulp_rte_parser_params *params,
-			    uint32_t priority, uint32_t class_id,
-			    uint32_t act_tmpl, uint16_t func_id,
-			    uint32_t flow_id,
 			    enum bnxt_ulp_fdb_type flow_type);
 
 /* Function to handle the parsing of the RTE port id. */
drivers/net/bnxt/tf_ulp/ulp_template_db_enum.h +3 -1
index 10838f5cc2..6802debbb7 100644
@@ -135,7 +135,9 @@ enum bnxt_ulp_cf_idx {
 	BNXT_ULP_CF_IDX_L4_HDR_CNT = 41,
 	BNXT_ULP_CF_IDX_VFR_MODE = 42,
 	BNXT_ULP_CF_IDX_LOOPBACK_PARIF = 43,
-	BNXT_ULP_CF_IDX_LAST = 44
+	BNXT_ULP_CF_IDX_L3_TUN = 44,
+	BNXT_ULP_CF_IDX_L3_TUN_DECAP = 45,
+	BNXT_ULP_CF_IDX_LAST = 46
 };
 
 enum bnxt_ulp_cond_opcode {
drivers/net/bnxt/tf_ulp/ulp_template_struct.h +7 -0
index 69bb61e110..9d690a9378 100644
@@ -72,6 +72,13 @@ struct ulp_rte_parser_params {
 	struct ulp_rte_act_bitmap	act_bitmap;
 	struct ulp_rte_act_prop		act_prop;
 	uint32_t			dir_attr;
+	uint32_t			priority;
+	uint32_t			fid;
+	uint32_t			parent_flow;
+	uint32_t			parent_fid;
+	uint16_t			func_id;
+	uint32_t			class_id;
+	uint32_t			act_tmpl;
 	struct bnxt_ulp_context		*ulp_ctx;
 };
 
drivers/net/bnxt/tf_ulp/ulp_tun.c new file +310 -0

310 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_tun.h new file +92 -0

92 lines not on this page · raw message

Signature · 1 line
2.21.1 (Apple Git-122.3)