Skip to contentSkip to conversation

bnxt patches

PATCH New Somnath Kotur 3 participants 43 messages Oct 9, 2020 – May 24, 2022

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

cover bnxt patches

Fixes and enchancements in the bnxt PMD, mostly in the TRUFLOW layer, including templates support for another chip

Kishore Padmanabha (4):
net/bnxt: fix the corruption of the session details net/bnxt: combine default and regular flows in flow database net/bnxt: add support for parent child flow database net/bnxt: add support for parent child flow create and free

Mike Baucom (6):
net/bnxt: add multi-device infrastucture net/bnxt: add Stingray support to ULP net/bnxt: consolidate template table processing net/bnxt: runtime external vs internal em support net/bnxt: consolidate template table processing net/bnxt: remove flow db table type from templates

Venkat Duvvuru (3):
net/bnxt: fixes for PMD PF support in SR-IOV mode net/bnxt: register PF for default vnic change async event net/bnxt: remove parent fid validation in vnic change event processing

 drivers/net/bnxt/bnxt.h                            |     6 +-
 drivers/net/bnxt/bnxt_cpr.c                        |    13 +-
 drivers/net/bnxt/bnxt_ethdev.c                     |    40 +-
 drivers/net/bnxt/bnxt_hwrm.c                       |   460 +-
 drivers/net/bnxt/bnxt_hwrm.h                       |    12 +-
 drivers/net/bnxt/meson.build                       |     4 +
 drivers/net/bnxt/tf_ulp/bnxt_ulp.c                 |   387 +-
 drivers/net/bnxt/tf_ulp/bnxt_ulp.h                 |    11 +
 drivers/net/bnxt/tf_ulp/bnxt_ulp_flow.c            |     5 +-
 drivers/net/bnxt/tf_ulp/ulp_def_rules.c            |     5 +-
 drivers/net/bnxt/tf_ulp/ulp_fc_mgr.c               |     2 +-
 drivers/net/bnxt/tf_ulp/ulp_flow_db.c              |   892 +-
 drivers/net/bnxt/tf_ulp/ulp_flow_db.h              |   179 +-
 drivers/net/bnxt/tf_ulp/ulp_mapper.c               |   520 +-
 drivers/net/bnxt/tf_ulp/ulp_mapper.h               |    22 +-
 drivers/net/bnxt/tf_ulp/ulp_template_db_act.c      |  1810 --
 drivers/net/bnxt/tf_ulp/ulp_template_db_class.c    | 16271 ----------------
 drivers/net/bnxt/tf_ulp/ulp_template_db_enum.h     |    18 +-
 .../net/bnxt/tf_ulp/ulp_template_db_stingray_act.c |  3305 ++++
 .../bnxt/tf_ulp/ulp_template_db_stingray_class.c   | 19005 +++++++++++++++++++
 drivers/net/bnxt/tf_ulp/ulp_template_db_tbl.c      |    59 +-
 drivers/net/bnxt/tf_ulp/ulp_template_db_tbl.h      |    48 +
 .../net/bnxt/tf_ulp/ulp_template_db_wh_plus_act.c  |  3304 ++++
 .../bnxt/tf_ulp/ulp_template_db_wh_plus_class.c    | 19005 +++++++++++++++++++
 drivers/net/bnxt/tf_ulp/ulp_template_struct.h      |    64 +-
 drivers/net/bnxt/tf_ulp/ulp_utils.h                |     4 +
 26 files changed, 46484 insertions(+), 18967 deletions(-)
 create mode 100644 drivers/net/bnxt/tf_ulp/ulp_template_db_stingray_act.c
 create mode 100644 drivers/net/bnxt/tf_ulp/ulp_template_db_stingray_class.c
 create mode 100644 drivers/net/bnxt/tf_ulp/ulp_template_db_tbl.h
 create mode 100644 drivers/net/bnxt/tf_ulp/ulp_template_db_wh_plus_act.c
 create mode 100644 drivers/net/bnxt/tf_ulp/ulp_template_db_wh_plus_class.c
Signature · 1 line
2.7.4
#1 lore raw

PATCH 1/13 net/bnxt: fix the corruption of the session details

From: Kishore Padmanabha <[email protected]>

The session details that is shared among multiple ports need to be outside the bnxt structure.

Fixes 70e64b27af5b ("net/bnxt: support ULP session manager cleanup")
---
 drivers/net/bnxt/tf_ulp/bnxt_ulp.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/net/bnxt/tf_ulp/bnxt_ulp.c +4 -1
index 2896194..a4d48c7 100644
@@ -159,7 +159,9 @@ ulp_ctx_session_open(struct bnxt *bp,
 	}
 	if (!session->session_opened) {
 		session->session_opened = 1;
-		session->g_tfp = &bp->tfp;
+		session->g_tfp = rte_zmalloc("bnxt_ulp_session_tfp",
+					     sizeof(struct tf), 0);
+		session->g_tfp->session = bp->tfp.session;
 	}
 	return rc;
 }
@@ -176,6 +178,7 @@ ulp_ctx_session_close(struct bnxt *bp,
 	if (session->session_opened)
 		tf_close_session(&bp->tfp);
 	session->session_opened = 0;
+	rte_free(session->g_tfp);
 	session->g_tfp = NULL;
 }
 
Signature · 1 line
2.7.4
#2 lore raw

PATCH 2/13 net/bnxt: add multi-device infrastucture

In reply to Somnath Kotur

From: Mike Baucom <[email protected]>

- Break the template into device specific files
- Change template list retrieval to use device id
- Determine the software device id based on bp
- Determine the tf resources based on device id

---
 drivers/net/bnxt/meson.build                       |     2 +
 drivers/net/bnxt/tf_ulp/bnxt_ulp.c                 |   223 +-
 drivers/net/bnxt/tf_ulp/ulp_mapper.c               |   150 +-
 drivers/net/bnxt/tf_ulp/ulp_template_db_act.c      |  1810 ---
 drivers/net/bnxt/tf_ulp/ulp_template_db_class.c    | 16271 -------------------
 drivers/net/bnxt/tf_ulp/ulp_template_db_tbl.c      |    16 +-
 drivers/net/bnxt/tf_ulp/ulp_template_db_tbl.h      |    29 +
 .../net/bnxt/tf_ulp/ulp_template_db_wh_plus_act.c  |  1813 +++
 .../bnxt/tf_ulp/ulp_template_db_wh_plus_class.c    | 16258 ++++++++++++++++++
 drivers/net/bnxt/tf_ulp/ulp_template_struct.h      |    58 +-
 10 files changed, 18355 insertions(+), 18275 deletions(-)
 create mode 100644 drivers/net/bnxt/tf_ulp/ulp_template_db_tbl.h
 create mode 100644 drivers/net/bnxt/tf_ulp/ulp_template_db_wh_plus_act.c
 create mode 100644 drivers/net/bnxt/tf_ulp/ulp_template_db_wh_plus_class.c
drivers/net/bnxt/meson.build +2 -0
index a89d1f9..b00da60 100644
@@ -64,6 +64,8 @@ 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_template_db_wh_plus_act.c',
+	'tf_ulp/ulp_template_db_wh_plus_class.c',
 
 	'rte_pmd_bnxt.c')
 
drivers/net/bnxt/tf_ulp/bnxt_ulp.c +148 -75

259 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_mapper.c +77 -73

384 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_template_db_act.c +0 -1810

1,813 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_template_db_class.c +0 -16271

536 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_template_db_tbl.c +15 -1
index f2e2a59..9cf62a0 100644

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

drivers/net/bnxt/tf_ulp/ulp_template_db_tbl.h new file +29 -0
new file mode 100644
index 0000000..55c3385

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

drivers/net/bnxt/tf_ulp/ulp_template_db_wh_plus_act.c new file +1813 -0

1,813 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_template_db_wh_plus_class.c new file +16258 -0

16,258 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_template_struct.h +13 -45

58 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.

#3 lore raw

PATCH 3/13 net/bnxt: add Stingray support to ULP

In reply to Somnath Kotur

From: Mike Baucom <[email protected]>

- Add new template files for Stingray
- Add new TRUFLOW resources for Stingray

---
 drivers/net/bnxt/meson.build                       |     2 +
 drivers/net/bnxt/tf_ulp/bnxt_ulp.c                 |    81 +-
 .../net/bnxt/tf_ulp/ulp_template_db_stingray_act.c |  1813 +++
 .../bnxt/tf_ulp/ulp_template_db_stingray_class.c   | 16258 +++++++++++++++++++
 drivers/net/bnxt/tf_ulp/ulp_template_db_tbl.h      |    19 +
 5 files changed, 18172 insertions(+), 1 deletion(-)
 create mode 100644 drivers/net/bnxt/tf_ulp/ulp_template_db_stingray_act.c
 create mode 100644 drivers/net/bnxt/tf_ulp/ulp_template_db_stingray_class.c
drivers/net/bnxt/meson.build +2 -0
index b00da60..3952108 100644
@@ -66,6 +66,8 @@ sources = files('bnxt_cpr.c',
 	'tf_ulp/ulp_fc_mgr.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',
+	'tf_ulp/ulp_template_db_stingray_class.c',
 
 	'rte_pmd_bnxt.c')
 
drivers/net/bnxt/tf_ulp/bnxt_ulp.c +80 -1

103 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_template_db_stingray_act.c new file +1813 -0

1,813 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_template_db_stingray_class.c new file +16258 -0

1,076 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_template_db_tbl.h +19 -0
index 55c3385..93f87f3 100644

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

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

Signature · 1 line
2.7.4

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

#4 lore raw

PATCH 4/13 net/bnxt: fixes for PMD PF support in SR-IOV mode

In reply to Somnath Kotur

From: Venkat Duvvuru <[email protected]>

1. Implement HWRM_FUNC_VF_RESOURCE_CFG command and use it to reserve resources for VFs when NEW RM is enabled.
2. Invoke PF’s FUNC_CFG before configuring VFs resources.
3. Don’t consider max_rx_em_flows in max_l2_ctx calculation when VFs are configured.
4. Issue HWRM_FUNC_QCFG instead of HWRM_FUNC_QCAPS to find out the actual allocated resources for VF.
5. Don’t add random mac to the VF.
6. Handle completion type CMPL_BASE_TYPE_HWRM_FWD_REQ instead of CMPL_BASE_TYPE_HWRM_FWD_RESP.
7. Don't enable HWRM_FUNC_DRV_RGTR_INPUT_FLAGS_FWD_NONE_MODE when the list of HWRM commands that needs to be forwarded to the PF is specified in HWRM_FUNC_DRV_RGTR.
8. Update the HWRM commands list that can be forwared to the PF.

Fixes b7778e8a1c00 ("net/bnxt: refactor to properly allocate resources for PF/VF")
---
 drivers/net/bnxt/bnxt.h        |   6 +-
 drivers/net/bnxt/bnxt_cpr.c    |   6 +-
 drivers/net/bnxt/bnxt_ethdev.c |  40 +---
 drivers/net/bnxt/bnxt_hwrm.c   | 458 +++++++++++++++++++++++++----------------
 drivers/net/bnxt/bnxt_hwrm.h   |  12 +-
 5 files changed, 306 insertions(+), 216 deletions(-)
drivers/net/bnxt/bnxt.h +5 -1
index eca7448..a951bca 100644
@@ -167,6 +167,9 @@
 #define	BNXT_DEFAULT_VNIC_CHANGE_VF_ID_SFT		\
 	HWRM_ASYNC_EVENT_CMPL_DEFAULT_VNIC_CHANGE_EVENT_DATA1_VF_ID_SFT
 
+#define BNXT_HWRM_CMD_TO_FORWARD(cmd)	\
+		(bp->pf->vf_req_fwd[(cmd) / 32] |= (1 << ((cmd) % 32)))
+
 struct bnxt_led_info {
 	uint8_t	     num_leds;
 	uint8_t      led_id;
@@ -664,9 +667,10 @@ struct bnxt {
 #define BNXT_FW_CAP_IF_CHANGE		BIT(1)
 #define BNXT_FW_CAP_ERROR_RECOVERY	BIT(2)
 #define BNXT_FW_CAP_ERR_RECOVER_RELOAD	BIT(3)
+#define BNXT_FW_CAP_HCOMM_FW_STATUS	BIT(4)
 #define BNXT_FW_CAP_ADV_FLOW_MGMT	BIT(5)
 #define BNXT_FW_CAP_ADV_FLOW_COUNTERS	BIT(6)
-#define BNXT_FW_CAP_HCOMM_FW_STATUS	BIT(7)
+#define BNXT_FW_CAP_LINK_ADMIN		BIT(7)
 
 	pthread_mutex_t         flow_lock;
 
drivers/net/bnxt/bnxt_cpr.c +4 -2
index a3a7e6a..5492394 100644
@@ -239,7 +239,7 @@ void bnxt_handle_fwd_req(struct bnxt *bp, struct cmpl_base *cmpl)
 		goto reject;
 	}
 
-	if (bnxt_rcv_msg_from_vf(bp, vf_id, fwd_cmd) == true) {
+	if (bnxt_rcv_msg_from_vf(bp, vf_id, fwd_cmd)) {
 		/*
 		 * In older firmware versions, the MAC had to be all zeros for
 		 * the VF to set it's MAC via hwrm_func_vf_cfg. Set to all
@@ -254,6 +254,7 @@ void bnxt_handle_fwd_req(struct bnxt *bp, struct cmpl_base *cmpl)
 				(const uint8_t *)"\x00\x00\x00\x00\x00");
 			}
 		}
+
 		if (fwd_cmd->req_type == HWRM_CFA_L2_SET_RX_MASK) {
 			struct hwrm_cfa_l2_set_rx_mask_input *srm =
 							(void *)fwd_cmd;
@@ -265,6 +266,7 @@ void bnxt_handle_fwd_req(struct bnxt *bp, struct cmpl_base *cmpl)
 			    HWRM_CFA_L2_SET_RX_MASK_INPUT_MASK_VLAN_NONVLAN |
 			    HWRM_CFA_L2_SET_RX_MASK_INPUT_MASK_ANYVLAN_NONVLAN);
 		}
+
 		/* Forward */
 		rc = bnxt_hwrm_exec_fwd_resp(bp, fw_vf_id, fwd_cmd, req_len);
 		if (rc) {
@@ -306,7 +308,7 @@ int bnxt_event_hwrm_resp_handler(struct bnxt *bp, struct cmpl_base *cmp)
 		bnxt_handle_async_event(bp, cmp);
 		evt = 1;
 		break;
-	case CMPL_BASE_TYPE_HWRM_FWD_RESP:
+	case CMPL_BASE_TYPE_HWRM_FWD_REQ:
 		/* Handle HWRM forwarded responses */
 		bnxt_handle_fwd_req(bp, cmp);
 		evt = 1;
drivers/net/bnxt/bnxt_ethdev.c +10 -30
index 8b63134..b4654ec 100644
@@ -5208,37 +5208,14 @@ static void bnxt_config_vf_req_fwd(struct bnxt *bp)
 	if (!BNXT_PF(bp))
 		return;
 
-#define ALLOW_FUNC(x)	\
-	{ \
-		uint32_t arg = (x); \
-		bp->pf->vf_req_fwd[((arg) >> 5)] &= \
-		~rte_cpu_to_le_32(1 << ((arg) & 0x1f)); \
-	}
-
-	/* Forward all requests if firmware is new enough */
-	if (((bp->fw_ver >= ((20 << 24) | (6 << 16) | (100 << 8))) &&
-	     (bp->fw_ver < ((20 << 24) | (7 << 16)))) ||
-	    ((bp->fw_ver >= ((20 << 24) | (8 << 16))))) {
-		memset(bp->pf->vf_req_fwd, 0xff, sizeof(bp->pf->vf_req_fwd));
-	} else {
-		PMD_DRV_LOG(WARNING,
-			    "Firmware too old for VF mailbox functionality\n");
-		memset(bp->pf->vf_req_fwd, 0, sizeof(bp->pf->vf_req_fwd));
-	}
+	memset(bp->pf->vf_req_fwd, 0, sizeof(bp->pf->vf_req_fwd));
 
-	/*
-	 * The following are used for driver cleanup. If we disallow these,
-	 * VF drivers can't clean up cleanly.
-	 */
-	ALLOW_FUNC(HWRM_FUNC_DRV_UNRGTR);
-	ALLOW_FUNC(HWRM_VNIC_FREE);
-	ALLOW_FUNC(HWRM_RING_FREE);
-	ALLOW_FUNC(HWRM_RING_GRP_FREE);
-	ALLOW_FUNC(HWRM_VNIC_RSS_COS_LB_CTX_FREE);
-	ALLOW_FUNC(HWRM_CFA_L2_FILTER_FREE);
-	ALLOW_FUNC(HWRM_STAT_CTX_FREE);
-	ALLOW_FUNC(HWRM_PORT_PHY_QCFG);
-	ALLOW_FUNC(HWRM_VNIC_TPA_CFG);
+	if (!(bp->fw_cap & BNXT_FW_CAP_LINK_ADMIN))
+		BNXT_HWRM_CMD_TO_FORWARD(HWRM_PORT_PHY_QCFG);
+	BNXT_HWRM_CMD_TO_FORWARD(HWRM_FUNC_CFG);
+	BNXT_HWRM_CMD_TO_FORWARD(HWRM_FUNC_VF_CFG);
+	BNXT_HWRM_CMD_TO_FORWARD(HWRM_CFA_L2_FILTER_ALLOC);
+	BNXT_HWRM_CMD_TO_FORWARD(HWRM_OEM_CMD);
 }
 
 uint16_t
@@ -6189,7 +6166,10 @@ bnxt_uninit_resources(struct bnxt *bp, bool reconfig_dev)
 
 	bnxt_free_int(bp);
 	bnxt_free_mem(bp, reconfig_dev);
+
 	bnxt_hwrm_func_buf_unrgtr(bp);
+	rte_free(bp->pf->vf_req_buf);
+
 	rc = bnxt_hwrm_func_driver_unregister(bp, 0);
 	bp->flags &= ~BNXT_FLAG_REGISTERED;
 	bnxt_free_ctx_mem(bp);
drivers/net/bnxt/bnxt_hwrm.c +276 -182

629 lines not on this page · raw message

drivers/net/bnxt/bnxt_hwrm.h +11 -1
index e98b1fe..a7fa7f6 100644
@@ -107,6 +107,16 @@ enum bnxt_flow_dir {
 	BNXT_DIR_MAX
 };
 
+struct bnxt_pf_resource_info {
+	uint16_t num_rsscos_ctxs;
+	uint16_t num_stat_ctxs;
+	uint16_t num_tx_rings;
+	uint16_t num_rx_rings;
+	uint16_t num_cp_rings;
+	uint16_t num_l2_ctxs;
+	uint32_t num_hw_ring_grps;
+};
+
 #define BNXT_CTX_VAL_INVAL	0xFFFF
 
 int bnxt_hwrm_cfa_l2_clear_rx_mask(struct bnxt *bp,
@@ -127,7 +137,7 @@ int bnxt_hwrm_exec_fwd_resp(struct bnxt *bp, uint16_t target_id,
 int bnxt_hwrm_reject_fwd_resp(struct bnxt *bp, uint16_t target_id,
 			      void *encaped, size_t ec_size);
 
-int bnxt_hwrm_func_buf_rgtr(struct bnxt *bp);
+int bnxt_hwrm_func_buf_rgtr(struct bnxt *bp, int num_vfs);
 int bnxt_hwrm_func_buf_unrgtr(struct bnxt *bp);
 int bnxt_hwrm_func_driver_register(struct bnxt *bp);
 int bnxt_hwrm_func_qcaps(struct bnxt *bp);
Signature · 1 line
2.7.4
#5 lore raw

PATCH 5/13 net/bnxt: consolidate template table processing

In reply to Somnath Kotur

From: Mike Baucom <[email protected]>

The table processing has been consolidated to be able to reuse the same code for action and classification template processing.

---
 drivers/net/bnxt/tf_ulp/bnxt_ulp_flow.c            |   1 +
 drivers/net/bnxt/tf_ulp/ulp_def_rules.c            |   1 +
 drivers/net/bnxt/tf_ulp/ulp_mapper.c               | 298 ++++++---------------
 drivers/net/bnxt/tf_ulp/ulp_mapper.h               |   4 +-
 drivers/net/bnxt/tf_ulp/ulp_template_db_enum.h     |   6 +
 .../bnxt/tf_ulp/ulp_template_db_stingray_class.c   |   2 +-
 drivers/net/bnxt/tf_ulp/ulp_template_db_tbl.c      |  56 +++-
 drivers/net/bnxt/tf_ulp/ulp_template_db_tbl.h      |   4 +-
 .../bnxt/tf_ulp/ulp_template_db_wh_plus_class.c    |   2 +-
 drivers/net/bnxt/tf_ulp/ulp_template_struct.h      |  11 +-
 10 files changed, 144 insertions(+), 241 deletions(-)
drivers/net/bnxt/tf_ulp/bnxt_ulp_flow.c +1 -0
index 566e125..eea39f6 100644
@@ -147,6 +147,7 @@ bnxt_ulp_flow_create(struct rte_eth_dev *dev,
 	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;
 
 	/* Get the function id */
 	if (ulp_port_db_port_func_id_get(ulp_ctx,
drivers/net/bnxt/tf_ulp/ulp_def_rules.c +1 -0
index 8dea235..01f4fd0 100644
@@ -351,6 +351,7 @@ ulp_default_flow_create(struct rte_eth_dev *eth_dev,
 	}
 
 	mapper_params.class_tid = ulp_class_tid;
+	mapper_params.flow_type = BNXT_ULP_FDB_TYPE_DEFAULT;
 
 	rc = ulp_mapper_flow_create(ulp_ctx, &mapper_params, flow_id);
 	if (rc) {
drivers/net/bnxt/tf_ulp/ulp_mapper.c +79 -219

491 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_mapper.h +3 -1
index a19fb0d..936fb9a 100644
@@ -53,6 +53,7 @@ struct bnxt_ulp_mapper_data {
 
 /* Internal Structure for passing the arguments around */
 struct bnxt_ulp_mapper_parms {
+	enum bnxt_ulp_template_type		tmpl_type;
 	uint32_t				dev_id;
 	uint32_t				act_tid;
 	struct bnxt_ulp_mapper_tbl_info		*atbls; /* action table */
@@ -70,7 +71,7 @@ struct bnxt_ulp_mapper_parms {
 	struct bnxt_ulp_context			*ulp_ctx;
 	uint8_t					encap_byte_swap;
 	uint32_t				fid;
-	enum bnxt_ulp_flow_db_tables		tbl_idx;
+	enum bnxt_ulp_fdb_type			flow_type;
 	struct bnxt_ulp_mapper_data		*mapper_data;
 	enum bnxt_ulp_cache_table_opc		tcam_tbl_opc;
 	struct bnxt_ulp_mapper_cache_entry	*cache_ptr;
@@ -88,6 +89,7 @@ struct bnxt_ulp_mapper_create_parms {
 	uint32_t			act_tid;
 	uint16_t			func_id;
 	uint32_t			dir_attr;
+	enum bnxt_ulp_fdb_type		flow_type;
 };
 
 /* Function to initialize any dynamic mapper data. */
drivers/net/bnxt/tf_ulp/ulp_template_db_enum.h +6 -0
index de56b7e..e083af0 100644
@@ -278,6 +278,12 @@ enum bnxt_ulp_search_before_alloc {
 	BNXT_ULP_SEARCH_BEFORE_ALLOC_LAST = 3
 };
 
+enum bnxt_ulp_template_type {
+	BNXT_ULP_TEMPLATE_TYPE_CLASS = 0,
+	BNXT_ULP_TEMPLATE_TYPE_ACTION = 1,
+	BNXT_ULP_TEMPLATE_TYPE_LAST = 2
+};
+
 enum bnxt_ulp_fdb_resource_flags {
 	BNXT_ULP_FDB_RESOURCE_FLAGS_DIR_INGR = 0x00,
 	BNXT_ULP_FDB_RESOURCE_FLAGS_DIR_EGR = 0x01
drivers/net/bnxt/tf_ulp/ulp_template_db_stingray_class.c +1 -1
index 2d40cde..f365c5c 100644
@@ -15980,7 +15980,7 @@ struct bnxt_ulp_mapper_result_field_info ulp_class_stingray_result_field_list[]
 	}
 };
 
-struct bnxt_ulp_mapper_ident_info ulp_stingray_ident_list[] = {
+struct bnxt_ulp_mapper_ident_info ulp_class_stingray_ident_list[] = {
 	{
 	.resource_func = BNXT_ULP_RESOURCE_FUNC_IDENTIFIER,
 	.ident_type = TF_IDENT_TYPE_L2_CTXT_HIGH,
drivers/net/bnxt/tf_ulp/ulp_template_db_tbl.c +46 -10

68 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_template_db_tbl.h +2 -2
index 93f87f3..7a541cb 100644
@@ -18,7 +18,7 @@ bnxt_ulp_mapper_class_key_field_info ulp_class_wh_plus_key_field_list[];
 extern struct
 bnxt_ulp_mapper_result_field_info ulp_class_wh_plus_result_field_list[];
 
-extern struct bnxt_ulp_mapper_ident_info ulp_wh_plus_ident_list[];
+extern struct bnxt_ulp_mapper_ident_info ulp_class_wh_plus_ident_list[];
 
 extern struct bnxt_ulp_mapper_tbl_list_info ulp_act_wh_plus_tmpl_list[];
 
@@ -37,7 +37,7 @@ bnxt_ulp_mapper_class_key_field_info ulp_class_stingray_key_field_list[];
 extern struct
 bnxt_ulp_mapper_result_field_info ulp_class_stingray_result_field_list[];
 
-extern struct bnxt_ulp_mapper_ident_info ulp_stingray_ident_list[];
+extern struct bnxt_ulp_mapper_ident_info ulp_class_stingray_ident_list[];
 
 extern struct bnxt_ulp_mapper_tbl_list_info ulp_act_stingray_tmpl_list[];
 
drivers/net/bnxt/tf_ulp/ulp_template_db_wh_plus_class.c +1 -1
index 10160f8..b747241 100644
@@ -15980,7 +15980,7 @@ struct bnxt_ulp_mapper_result_field_info ulp_class_wh_plus_result_field_list[] =
 	}
 };
 
-struct bnxt_ulp_mapper_ident_info ulp_wh_plus_ident_list[] = {
+struct bnxt_ulp_mapper_ident_info ulp_class_wh_plus_ident_list[] = {
 	{
 	.resource_func = BNXT_ULP_RESOURCE_FUNC_IDENTIFIER,
 	.ident_type = TF_IDENT_TYPE_L2_CTXT_HIGH,
drivers/net/bnxt/tf_ulp/ulp_template_struct.h +4 -7
index 621ccce..026c42d 100644
@@ -142,14 +142,11 @@ extern struct bnxt_ulp_act_match_info ulp_act_match_list[];
 
 /* Device Specific Tables for mapper */
 struct ulp_template_device_tbls {
-	struct bnxt_ulp_mapper_tbl_list_info *class_tmpl_list;
-	struct bnxt_ulp_mapper_tbl_info *class_tbl_list;
-	struct bnxt_ulp_mapper_class_key_field_info *class_key_field_list;
-	struct bnxt_ulp_mapper_result_field_info *class_result_field_list;
+	struct bnxt_ulp_mapper_tbl_list_info *tmpl_list;
+	struct bnxt_ulp_mapper_tbl_info *tbl_list;
+	struct bnxt_ulp_mapper_class_key_field_info *key_field_list;
+	struct bnxt_ulp_mapper_result_field_info *result_field_list;
 	struct bnxt_ulp_mapper_ident_info *ident_list;
-	struct bnxt_ulp_mapper_tbl_list_info *act_tmpl_list;
-	struct bnxt_ulp_mapper_tbl_info *act_tbl_list;
-	struct bnxt_ulp_mapper_result_field_info *act_result_field_list;
 };
 
 /* Device specific parameters */
Signature · 1 line
2.7.4
#6 lore raw

PATCH 6/13 net/bnxt: combine default and regular flows in flow database

In reply to Somnath Kotur

From: Kishore Padmanabha <[email protected]>

The default and regular flows are stored in the same flow table instead of different flow tables.

---
 drivers/net/bnxt/tf_ulp/bnxt_ulp.c      |   2 +-
 drivers/net/bnxt/tf_ulp/bnxt_ulp_flow.c |   4 +-
 drivers/net/bnxt/tf_ulp/ulp_def_rules.c |   4 +-
 drivers/net/bnxt/tf_ulp/ulp_fc_mgr.c    |   2 +-
 drivers/net/bnxt/tf_ulp/ulp_flow_db.c   | 423 +++++++++++++++-----------------
 drivers/net/bnxt/tf_ulp/ulp_flow_db.h   |  75 +++---
 drivers/net/bnxt/tf_ulp/ulp_mapper.c    |  33 +--
 drivers/net/bnxt/tf_ulp/ulp_mapper.h    |  11 +-
 8 files changed, 259 insertions(+), 295 deletions(-)
drivers/net/bnxt/tf_ulp/bnxt_ulp.c +1 -1
index eeda2d0..9ed92a8 100644
@@ -853,7 +853,7 @@ bnxt_ulp_deinit(struct bnxt *bp,
 	bnxt_ulp_destroy_vfr_default_rules(bp, true);
 
 	/* clean up regular flows */
-	ulp_flow_db_flush_flows(bp->ulp_ctx, BNXT_ULP_REGULAR_FLOW_TABLE);
+	ulp_flow_db_flush_flows(bp->ulp_ctx, BNXT_ULP_FDB_TYPE_REGULAR);
 
 	/* cleanup the eem table scope */
 	ulp_eem_tbl_scope_deinit(bp, bp->ulp_ctx);
drivers/net/bnxt/tf_ulp/bnxt_ulp_flow.c +2 -2
index eea39f6..c7b2982 100644
@@ -281,8 +281,8 @@ bnxt_ulp_flow_destroy(struct rte_eth_dev *dev,
 		return -EINVAL;
 	}
 
-	ret = ulp_mapper_flow_destroy(ulp_ctx, flow_id,
-				      BNXT_ULP_REGULAR_FLOW_TABLE);
+	ret = ulp_mapper_flow_destroy(ulp_ctx, BNXT_ULP_FDB_TYPE_REGULAR,
+				      flow_id);
 	if (ret) {
 		BNXT_TF_DBG(ERR, "Failed to destroy flow.\n");
 		if (error)
drivers/net/bnxt/tf_ulp/ulp_def_rules.c +2 -2
index 01f4fd0..c36d4d4 100644
@@ -391,8 +391,8 @@ ulp_default_flow_destroy(struct rte_eth_dev *eth_dev, uint32_t flow_id)
 		return rc;
 	}
 
-	rc = ulp_mapper_flow_destroy(ulp_ctx, flow_id,
-				     BNXT_ULP_DEFAULT_FLOW_TABLE);
+	rc = ulp_mapper_flow_destroy(ulp_ctx, BNXT_ULP_FDB_TYPE_DEFAULT,
+				     flow_id);
 	if (rc)
 		BNXT_TF_DBG(ERR, "Failed to destroy flow.\n");
 
drivers/net/bnxt/tf_ulp/ulp_fc_mgr.c +1 -1
index 5a0bf60..051ebac 100644
@@ -561,7 +561,7 @@ int ulp_fc_mgr_query_count_get(struct bnxt_ulp_context *ctxt,
 
 	do {
 		rc = ulp_flow_db_resource_get(ctxt,
-					      BNXT_ULP_REGULAR_FLOW_TABLE,
+					      BNXT_ULP_FDB_TYPE_REGULAR,
 					      flow_id,
 					      &nxt_resource_index,
 					      &params);
drivers/net/bnxt/tf_ulp/ulp_flow_db.c +198 -225

748 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_flow_db.h +32 -43

133 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_mapper.c +17 -16
index 5ed481a..0f55f4f 100644
@@ -2482,12 +2482,12 @@ ulp_mapper_resource_free(struct bnxt_ulp_context *ulp,
 }
 
 int32_t
-ulp_mapper_resources_free(struct bnxt_ulp_context	*ulp_ctx,
-			  uint32_t fid,
-			  enum bnxt_ulp_flow_db_tables	tbl_type)
+ulp_mapper_resources_free(struct bnxt_ulp_context *ulp_ctx,
+			  enum bnxt_ulp_fdb_type flow_type,
+			  uint32_t fid)
 {
-	struct ulp_flow_db_res_params	res_parms = { 0 };
-	int32_t				rc, trc;
+	struct ulp_flow_db_res_params res_parms = { 0 };
+	int32_t rc, trc;
 
 	if (!ulp_ctx) {
 		BNXT_TF_DBG(ERR, "Invalid parms, unable to free flow\n");
@@ -2499,7 +2499,7 @@ ulp_mapper_resources_free(struct bnxt_ulp_context	*ulp_ctx,
 	 * while status is good
 	 */
 	res_parms.critical_resource = BNXT_ULP_CRITICAL_RESOURCE_YES;
-	rc = ulp_flow_db_resource_del(ulp_ctx, tbl_type, fid, &res_parms);
+	rc = ulp_flow_db_resource_del(ulp_ctx, flow_type, fid, &res_parms);
 
 	if (rc) {
 		/*
@@ -2507,7 +2507,7 @@ ulp_mapper_resources_free(struct bnxt_ulp_context	*ulp_ctx,
 		 * It likely means that the flow did not exist in the flow db.
 		 */
 		BNXT_TF_DBG(ERR, "Flow[%d][0x%08x] failed to free (rc=%d)\n",
-			    tbl_type, fid, rc);
+			    flow_type, fid, rc);
 		return rc;
 	}
 
@@ -2521,20 +2521,20 @@ ulp_mapper_resources_free(struct bnxt_ulp_context	*ulp_ctx,
 			BNXT_TF_DBG(ERR,
 				    "Flow[%d][0x%x] Res[%d][0x%016" PRIx64
 				    "] failed rc=%d.\n",
-				    tbl_type, fid, res_parms.resource_func,
+				    flow_type, fid, res_parms.resource_func,
 				    res_parms.resource_hndl, trc);
 
 		/* All subsequent call require the non-critical_resource */
 		res_parms.critical_resource = BNXT_ULP_CRITICAL_RESOURCE_NO;
 
 		rc = ulp_flow_db_resource_del(ulp_ctx,
-					      tbl_type,
+					      flow_type,
 					      fid,
 					      &res_parms);
 	}
 
 	/* Free the Flow ID since we've removed all resources */
-	rc = ulp_flow_db_fid_free(ulp_ctx, tbl_type, fid);
+	rc = ulp_flow_db_fid_free(ulp_ctx, flow_type, fid);
 
 	return rc;
 }
@@ -2568,8 +2568,9 @@ ulp_mapper_glb_resource_info_deinit(struct bnxt_ulp_context *ulp_ctx,
 }
 
 int32_t
-ulp_mapper_flow_destroy(struct bnxt_ulp_context	*ulp_ctx, uint32_t fid,
-			enum bnxt_ulp_flow_db_tables flow_tbl_type)
+ulp_mapper_flow_destroy(struct bnxt_ulp_context *ulp_ctx,
+			enum bnxt_ulp_fdb_type flow_type,
+			uint32_t fid)
 {
 	int32_t rc;
 
@@ -2582,7 +2583,7 @@ ulp_mapper_flow_destroy(struct bnxt_ulp_context	*ulp_ctx, uint32_t fid,
 		return -EINVAL;
 	}
 
-	rc = ulp_mapper_resources_free(ulp_ctx, fid, flow_tbl_type);
+	rc = ulp_mapper_resources_free(ulp_ctx, flow_type, fid);
 	bnxt_ulp_cntxt_release_fdb_lock(ulp_ctx);
 	return rc;
 
@@ -2624,7 +2625,7 @@ ulp_mapper_glb_template_table_init(struct bnxt_ulp_context *ulp_ctx)
 		parms.ulp_ctx = ulp_ctx;
 		parms.dev_id = dev_id;
 		parms.mapper_data = mapper_data;
-		parms.flow_type = BNXT_ULP_DEFAULT_FLOW_TABLE;
+		parms.flow_type = BNXT_ULP_FDB_TYPE_DEFAULT;
 		parms.tmpl_type = BNXT_ULP_TEMPLATE_TYPE_CLASS;
 
 		/* Get the class table entry from dev id and class id */
@@ -2758,8 +2759,8 @@ ulp_mapper_flow_create(struct bnxt_ulp_context *ulp_ctx,
 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, parms.fid,
-				      BNXT_ULP_REGULAR_FLOW_TABLE);
+	trc = ulp_mapper_flow_destroy(ulp_ctx, BNXT_ULP_FDB_TYPE_REGULAR,
+				      parms.fid);
 	if (trc)
 		BNXT_TF_DBG(ERR, "Failed to free all resources rc=%d\n", trc);
 
drivers/net/bnxt/tf_ulp/ulp_mapper.h +6 -5
index 936fb9a..6f93bcd 100644
@@ -111,16 +111,17 @@ ulp_mapper_flow_create(struct bnxt_ulp_context	*ulp_ctx,
 
 /* Function that frees all resources associated with the flow. */
 int32_t
-ulp_mapper_flow_destroy(struct bnxt_ulp_context	*ulp_ctx, uint32_t fid,
-			enum bnxt_ulp_flow_db_tables flow_tbl_type);
+ulp_mapper_flow_destroy(struct bnxt_ulp_context *ulp_ctx,
+			enum bnxt_ulp_fdb_type flow_type,
+			uint32_t fid);
 
 /*
  * Function that frees all resources and can be called on default or regular
  * flows
  */
 int32_t
-ulp_mapper_resources_free(struct bnxt_ulp_context	*ulp_ctx,
-			  uint32_t fid,
-			  enum bnxt_ulp_flow_db_tables	tbl_type);
+ulp_mapper_resources_free(struct bnxt_ulp_context *ulp_ctx,
+			  enum bnxt_ulp_fdb_type flow_type,
+			  uint32_t fid);
 
 #endif /* _ULP_MAPPER_H_ */
Signature · 1 line
2.7.4
#7 lore raw

PATCH 7/13 net/bnxt: register PF for default vnic change async event

In reply to Somnath Kotur

From: Venkat Duvvuru <[email protected]>

Currently, we are only registering to this event if the function is a trusted VF. This patch extends it for PFs as well.

Fixes 322bd6e70272 ("net/bnxt: add port representor infrastructure")
---
 drivers/net/bnxt/bnxt_hwrm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/bnxt/bnxt_hwrm.c +1 -1
index e49f56c..4e2061e 100644
@@ -938,7 +938,7 @@ int bnxt_hwrm_func_driver_register(struct bnxt *bp)
 		req.async_event_fwd[1] |=
 			rte_cpu_to_le_32(ASYNC_CMPL_EVENT_ID_DBG_NOTIFICATION);
 
-	if (BNXT_VF_IS_TRUSTED(bp))
+	if (BNXT_PF(bp) || BNXT_VF_IS_TRUSTED(bp))
 		req.async_event_fwd[1] |=
 		rte_cpu_to_le_32(ASYNC_CMPL_EVENT_ID_DEFAULT_VNIC_CHANGE);
 
Signature · 1 line
2.7.4
#8 lore raw

PATCH 8/13 net/bnxt: runtime external vs internal em support

In reply to Somnath Kotur

From: Mike Baucom <[email protected]>

- Added new mem type conditional opcode for internal/external
- Adapted the flowdb resource counts based on selected mode
- Template changes to use the new opcode
- The decision for internal/external em support is based on the devargs parameter max_num_kflows. If this is set, external em is used.

---
 drivers/net/bnxt/tf_ulp/bnxt_ulp.c                 |   78 +-
 drivers/net/bnxt/tf_ulp/bnxt_ulp.h                 |   11 +
 drivers/net/bnxt/tf_ulp/ulp_flow_db.c              |   16 +-
 drivers/net/bnxt/tf_ulp/ulp_mapper.c               |   48 +-
 drivers/net/bnxt/tf_ulp/ulp_template_db_enum.h     |    7 +
 .../net/bnxt/tf_ulp/ulp_template_db_stingray_act.c | 2282 +++++++++---
 .../bnxt/tf_ulp/ulp_template_db_stingray_class.c   | 3646 +++++++++++++++++---
 drivers/net/bnxt/tf_ulp/ulp_template_db_tbl.c      |   48 +-
 .../net/bnxt/tf_ulp/ulp_template_db_wh_plus_act.c  | 2281 +++++++++---
 .../bnxt/tf_ulp/ulp_template_db_wh_plus_class.c    | 3390 ++++++++++++++++--
 drivers/net/bnxt/tf_ulp/ulp_template_struct.h      |    5 +-
 11 files changed, 10228 insertions(+), 1584 deletions(-)
drivers/net/bnxt/tf_ulp/bnxt_ulp.c +56 -22
index 9ed92a8..b22929a 100644
@@ -359,16 +359,20 @@ bnxt_init_tbl_scope_parms(struct bnxt *bp,
 		params->rx_max_action_entry_sz_in_bits =
 			BNXT_ULP_DFLT_RX_MAX_ACTN_ENTRY;
 		params->rx_mem_size_in_mb = BNXT_ULP_DFLT_RX_MEM;
-		params->rx_num_flows_in_k = dparms->flow_db_num_entries / 1024;
+		params->rx_num_flows_in_k =
+			dparms->ext_flow_db_num_entries / 1024;
 		params->rx_tbl_if_id = BNXT_ULP_RX_TBL_IF_ID;
 
 		params->tx_max_key_sz_in_bits = BNXT_ULP_DFLT_TX_MAX_KEY;
 		params->tx_max_action_entry_sz_in_bits =
 			BNXT_ULP_DFLT_TX_MAX_ACTN_ENTRY;
 		params->tx_mem_size_in_mb = BNXT_ULP_DFLT_TX_MEM;
-		params->tx_num_flows_in_k = dparms->flow_db_num_entries / 1024;
+		params->tx_num_flows_in_k =
+			dparms->ext_flow_db_num_entries / 1024;
 		params->tx_tbl_if_id = BNXT_ULP_TX_TBL_IF_ID;
 	}
+	BNXT_TF_DBG(INFO, "Table Scope initialized with %uK flows.\n",
+		    params->rx_num_flows_in_k);
 }
 
 /* Initialize Extended Exact Match host memory. */
@@ -376,8 +380,9 @@ static int32_t
 ulp_eem_tbl_scope_init(struct bnxt *bp)
 {
 	struct tf_alloc_tbl_scope_parms params = {0};
-	uint32_t dev_id;
 	struct bnxt_ulp_device_params *dparms;
+	enum bnxt_ulp_flow_mem_type mtype;
+	uint32_t dev_id;
 	int rc;
 
 	/* Get the dev specific number of flows that needed to be supported. */
@@ -392,7 +397,10 @@ ulp_eem_tbl_scope_init(struct bnxt *bp)
 		return -ENODEV;
 	}
 
-	if (dparms->flow_mem_type != BNXT_ULP_FLOW_MEM_TYPE_EXT) {
+	if (bnxt_ulp_cntxt_mem_type_get(bp->ulp_ctx, &mtype))
+		return -EINVAL;
+
+	if (mtype != BNXT_ULP_FLOW_MEM_TYPE_EXT) {
 		BNXT_TF_DBG(INFO, "Table Scope alloc is not required\n");
 		return 0;
 	}
@@ -423,6 +431,7 @@ ulp_eem_tbl_scope_deinit(struct bnxt *bp, struct bnxt_ulp_context *ulp_ctx)
 	struct tf			*tfp;
 	int32_t				rc = 0;
 	struct bnxt_ulp_device_params *dparms;
+	enum bnxt_ulp_flow_mem_type mtype;
 	uint32_t dev_id;
 
 	if (!ulp_ctx || !ulp_ctx->cfg_data)
@@ -446,7 +455,9 @@ ulp_eem_tbl_scope_deinit(struct bnxt *bp, struct bnxt_ulp_context *ulp_ctx)
 		return -ENODEV;
 	}
 
-	if (dparms->flow_mem_type != BNXT_ULP_FLOW_MEM_TYPE_EXT) {
+	if (bnxt_ulp_cntxt_mem_type_get(ulp_ctx, &mtype))
+		return -EINVAL;
+	if (mtype != BNXT_ULP_FLOW_MEM_TYPE_EXT) {
 		BNXT_TF_DBG(INFO, "Table Scope free is not required\n");
 		return 0;
 	}
@@ -539,8 +550,16 @@ ulp_dparms_init(struct bnxt *bp,
 	struct bnxt_ulp_device_params *dparms;
 	uint32_t dev_id;
 
-	if (!bp->max_num_kflows)
+	if (!bp->max_num_kflows) {
+		/* Defaults to Internal */
+		bnxt_ulp_cntxt_mem_type_set(ulp_ctx,
+					    BNXT_ULP_FLOW_MEM_TYPE_INT);
 		return 0;
+	}
+
+	/* The max_num_kflows were set, so move to external */
+	if (bnxt_ulp_cntxt_mem_type_set(ulp_ctx, BNXT_ULP_FLOW_MEM_TYPE_EXT))
+		return -EINVAL;
 
 	if (bnxt_ulp_cntxt_dev_id_get(ulp_ctx, &dev_id)) {
 		BNXT_TF_DBG(DEBUG, "Failed to get device id\n");
@@ -554,11 +573,11 @@ ulp_dparms_init(struct bnxt *bp,
 	}
 
 	/* num_flows = max_num_kflows * 1024 */
-	dparms->flow_db_num_entries = bp->max_num_kflows * 1024;
+	dparms->ext_flow_db_num_entries = bp->max_num_kflows * 1024;
 	/* GFID =  2 * num_flows */
-	dparms->mark_db_gfid_entries = dparms->flow_db_num_entries * 2;
+	dparms->mark_db_gfid_entries = dparms->ext_flow_db_num_entries * 2;
 	BNXT_TF_DBG(DEBUG, "Set the number of flows = %"PRIu64"\n",
-		    dparms->flow_db_num_entries);
+		    dparms->ext_flow_db_num_entries);
 
 	return 0;
 }
@@ -568,22 +587,12 @@ static int32_t
 ulp_dparms_dev_port_intf_update(struct bnxt *bp,
 				struct bnxt_ulp_context *ulp_ctx)
 {
-	struct bnxt_ulp_device_params *dparms;
-	uint32_t dev_id;
+	enum bnxt_ulp_flow_mem_type mtype;
 
-	if (bnxt_ulp_cntxt_dev_id_get(ulp_ctx, &dev_id)) {
-		BNXT_TF_DBG(DEBUG, "Failed to get device id\n");
-		return -EINVAL;
-	}
-
-	dparms = bnxt_ulp_device_params_get(dev_id);
-	if (!dparms) {
-		BNXT_TF_DBG(DEBUG, "Failed to get device parms\n");
+	if (bnxt_ulp_cntxt_mem_type_get(ulp_ctx, &mtype))
 		return -EINVAL;
-	}
-
 	/* Update the bp flag with gfid flag */
-	if (dparms->flow_mem_type == BNXT_ULP_FLOW_MEM_TYPE_EXT)
+	if (mtype == BNXT_ULP_FLOW_MEM_TYPE_EXT)
 		bp->flags |= BNXT_FLAG_GFID_ENABLE;
 
 	return 0;
@@ -1197,6 +1206,31 @@ bnxt_ulp_cntxt_dev_id_get(struct bnxt_ulp_context *ulp_ctx,
 		return 0;
 	}
 
+	BNXT_TF_DBG(ERR, "Failed to read dev_id from ulp ctxt\n");
+	return -EINVAL;
+}
+
+int32_t
+bnxt_ulp_cntxt_mem_type_set(struct bnxt_ulp_context *ulp_ctx,
+			    enum bnxt_ulp_flow_mem_type mem_type)
+{
+	if (ulp_ctx && ulp_ctx->cfg_data) {
+		ulp_ctx->cfg_data->mem_type = mem_type;
+		return 0;
+	}
+	BNXT_TF_DBG(ERR, "Failed to write mem_type in ulp ctxt\n");
+	return -EINVAL;
+}
+
+int32_t
+bnxt_ulp_cntxt_mem_type_get(struct bnxt_ulp_context *ulp_ctx,
+			    enum bnxt_ulp_flow_mem_type *mem_type)
+{
+	if (ulp_ctx && ulp_ctx->cfg_data) {
+		*mem_type = ulp_ctx->cfg_data->mem_type;
+		return 0;
+	}
+	BNXT_TF_DBG(ERR, "Failed to read mem_type in ulp ctxt\n");
 	return -EINVAL;
 }
 
drivers/net/bnxt/tf_ulp/bnxt_ulp.h +11 -0
index 36405ae..c2c5bcb 100644
@@ -54,6 +54,7 @@ struct bnxt_ulp_data {
 	uint32_t			ulp_flags;
 	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;
 };
 
 struct bnxt_ulp_context {
@@ -102,6 +103,16 @@ bnxt_ulp_cntxt_dev_id_set(struct bnxt_ulp_context *ulp_ctx, uint32_t dev_id);
 int32_t
 bnxt_ulp_cntxt_dev_id_get(struct bnxt_ulp_context *ulp_ctx, uint32_t *dev_id);
 
+/* Function to get whether or not ext mem is used for EM */
+int32_t
+bnxt_ulp_cntxt_mem_type_get(struct bnxt_ulp_context *ulp_ctx,
+			    enum bnxt_ulp_flow_mem_type *mem_type);
+
+/* Function to set whether or not ext mem is used for EM */
+int32_t
+bnxt_ulp_cntxt_mem_type_set(struct bnxt_ulp_context *ulp_ctx,
+			    enum bnxt_ulp_flow_mem_type mem_type);
+
 /* Function to set the table scope id of the EEM table. */
 int32_t
 bnxt_ulp_cntxt_tbl_scope_id_set(struct bnxt_ulp_context *ulp_ctx,
drivers/net/bnxt/tf_ulp/ulp_flow_db.c +13 -3
index 0a3fb01..da01245 100644
@@ -298,7 +298,8 @@ ulp_flow_db_init(struct bnxt_ulp_context *ulp_ctxt)
 	struct bnxt_ulp_device_params *dparms;
 	struct bnxt_ulp_flow_tbl *flow_tbl;
 	struct bnxt_ulp_flow_db *flow_db;
-	uint32_t dev_id;
+	uint32_t dev_id, num_flows;
+	enum bnxt_ulp_flow_mem_type mtype;
 
 	/* Get the dev specific number of flows that needed to be supported. */
 	if (bnxt_ulp_cntxt_dev_id_get(ulp_ctxt, &dev_id)) {
@@ -323,10 +324,17 @@ ulp_flow_db_init(struct bnxt_ulp_context *ulp_ctxt)
 	/* Attach the flow database to the ulp context. */
 	bnxt_ulp_cntxt_ptr2_flow_db_set(ulp_ctxt, flow_db);
 
+	/* Determine the number of flows based on EM type */
+	bnxt_ulp_cntxt_mem_type_get(ulp_ctxt, &mtype);
+	if (mtype == BNXT_ULP_FLOW_MEM_TYPE_INT)
+		num_flows = dparms->int_flow_db_num_entries;
+	else
+		num_flows = dparms->ext_flow_db_num_entries;
+
 	/* Populate the regular flow table limits. */
 	flow_tbl = &flow_db->flow_tbl;
-	flow_tbl->num_flows = dparms->flow_db_num_entries + 1;
-	flow_tbl->num_resources = ((dparms->flow_db_num_entries + 1) *
+	flow_tbl->num_flows = num_flows + 1;
+	flow_tbl->num_resources = ((num_flows + 1) *
 				   dparms->num_resources_per_flow);
 
 	/* Include the default flow table limits. */
@@ -350,6 +358,8 @@ ulp_flow_db_init(struct bnxt_ulp_context *ulp_ctxt)
 		goto error_free;
 	}
 	/* All good so return. */
+	BNXT_TF_DBG(INFO, "FlowDB initialized with %d flows.\n",
+		    flow_tbl->num_flows);
 	return 0;
 error_free:
 	ulp_flow_db_deinit(ulp_ctxt);
drivers/net/bnxt/tf_ulp/ulp_mapper.c +47 -1

76 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_template_db_enum.h +7 -0
index e083af0..81da34e 100644
@@ -235,6 +235,13 @@ enum bnxt_ulp_match_type {
 	BNXT_ULP_MATCH_TYPE_LAST = 2
 };
 
+enum bnxt_ulp_mem_type_opcode {
+	BNXT_ULP_MEM_TYPE_OPCODE_NOP = 0,
+	BNXT_ULP_MEM_TYPE_OPCODE_EXECUTE_IF_INT = 1,
+	BNXT_ULP_MEM_TYPE_OPCODE_EXECUTE_IF_EXT = 2,
+	BNXT_ULP_MEM_TYPE_OPCODE_LAST = 3
+};
+
 enum bnxt_ulp_priority {
 	BNXT_ULP_PRIORITY_LEVEL_0 = 0,
 	BNXT_ULP_PRIORITY_LEVEL_1 = 1,
drivers/net/bnxt/tf_ulp/ulp_template_db_stingray_act.c +1890 -392

2,705 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_template_db_stingray_class.c +3208 -438

3,646 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_template_db_tbl.c +24 -24

48 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_template_db_wh_plus_act.c +1889 -392

2,281 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_template_db_wh_plus_class.c +3080 -310

3,390 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_template_struct.h +3 -2
index 026c42d..50a986c 100644

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

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

Signature · 1 line
2.7.4

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

#9 lore raw

PATCH 9/13 net/bnxt: add support for parent child flow database

In reply to Somnath Kotur

From: Kishore Padmanabha <[email protected]>

Added support for parent child flow database apis. This feature adds support to enable vxlan decap support where flows needs to maintain parent-child flow relationship.

---
 drivers/net/bnxt/tf_ulp/ulp_flow_db.c         | 348 +++++++++++++++++++++++++-
 drivers/net/bnxt/tf_ulp/ulp_flow_db.h         |  84 +++++++
 drivers/net/bnxt/tf_ulp/ulp_template_db_tbl.c |   1 +
 drivers/net/bnxt/tf_ulp/ulp_template_struct.h |   1 +
 drivers/net/bnxt/tf_ulp/ulp_utils.h           |   4 +
 5 files changed, 435 insertions(+), 3 deletions(-)
drivers/net/bnxt/tf_ulp/ulp_flow_db.c +345 -3
index da01245..a1c3932 100644
@@ -207,13 +207,16 @@ ulp_flow_db_alloc_resource(struct bnxt_ulp_flow_db *flow_db)
 		return -ENOMEM;
 	}
 	size = (flow_tbl->num_flows / sizeof(uint64_t)) + 1;
-	flow_tbl->active_reg_flows = rte_zmalloc("active reg flows", size, 0);
+	size =  ULP_BYTE_ROUND_OFF_8(size);
+	flow_tbl->active_reg_flows = rte_zmalloc("active reg flows", size,
+						 ULP_BUFFER_ALIGN_64_BYTE);
 	if (!flow_tbl->active_reg_flows) {
 		BNXT_TF_DBG(ERR, "Failed to alloc memory active reg flows\n");
 		return -ENOMEM;
 	}
 
-	flow_tbl->active_dflt_flows = rte_zmalloc("active dflt flows", size, 0);
+	flow_tbl->active_dflt_flows = rte_zmalloc("active dflt flows", size,
+						  ULP_BUFFER_ALIGN_64_BYTE);
 	if (!flow_tbl->active_dflt_flows) {
 		BNXT_TF_DBG(ERR, "Failed to alloc memory active dflt flows\n");
 		return -ENOMEM;
@@ -285,6 +288,86 @@ ulp_flow_db_func_id_set(struct bnxt_ulp_flow_db *flow_db,
 }
 
 /*
+ * Initialize the parent-child database. Memory is allocated in this
+ * call and assigned to the database
+ *
+ * flow_db [in] Ptr to flow table
+ * num_entries[in] - number of entries to allocate
+ *
+ * Returns 0 on success or negative number on failure.
+ */
+static int32_t
+ulp_flow_db_parent_tbl_init(struct bnxt_ulp_flow_db *flow_db,
+			    uint32_t num_entries)
+{
+	struct ulp_fdb_parent_child_db *p_db;
+	uint32_t size, idx;
+
+	/* update the sizes for the allocation */
+	p_db = &flow_db->parent_child_db;
+	p_db->child_bitset_size = (flow_db->flow_tbl.num_flows /
+				   sizeof(uint64_t)) + 1; /* size in bytes */
+	p_db->child_bitset_size = ULP_BYTE_ROUND_OFF_8(p_db->child_bitset_size);
+	p_db->entries_count = num_entries;
+
+	/* allocate the memory */
+	p_db->parent_flow_tbl = rte_zmalloc("fdb parent flow tbl",
+					    sizeof(struct ulp_fdb_parent_info) *
+					    p_db->entries_count, 0);
+	if (!p_db->parent_flow_tbl) {
+		BNXT_TF_DBG(ERR,
+			    "Failed to allocate memory fdb parent flow tbl\n");
+		return -ENOMEM;
+	}
+	size = p_db->child_bitset_size * p_db->entries_count;
+
+	/*
+	 * allocate the big chunk of memory to be statically carved into
+	 * child_fid_bitset pointer.
+	 */
+	p_db->parent_flow_tbl_mem = rte_zmalloc("fdb parent flow tbl mem",
+						size,
+						ULP_BUFFER_ALIGN_64_BYTE);
+	if (!p_db->parent_flow_tbl_mem) {
+		BNXT_TF_DBG(ERR,
+			    "Failed to allocate memory fdb parent flow mem\n");
+		return -ENOMEM;
+	}
+
+	/* set the pointers in parent table to their offsets */
+	for (idx = 0 ; idx < p_db->entries_count; idx++) {
+		p_db->parent_flow_tbl[idx].child_fid_bitset =
+			(uint64_t *)&p_db->parent_flow_tbl_mem[idx *
+			p_db->child_bitset_size];
+	}
+	/* success */
+	return 0;
+}
+
+/*
+ * Deinitialize the parent-child database. Memory is deallocated in
+ * this call and all flows should have been purged before this
+ * call.
+ *
+ * flow_db [in] Ptr to flow table
+ *
+ * Returns none
+ */
+static void
+ulp_flow_db_parent_tbl_deinit(struct bnxt_ulp_flow_db *flow_db)
+{
+	/* free the memory related to parent child database */
+	if (flow_db->parent_child_db.parent_flow_tbl_mem) {
+		rte_free(flow_db->parent_child_db.parent_flow_tbl_mem);
+		flow_db->parent_child_db.parent_flow_tbl_mem = NULL;
+	}
+	if (flow_db->parent_child_db.parent_flow_tbl) {
+		rte_free(flow_db->parent_child_db.parent_flow_tbl);
+		flow_db->parent_child_db.parent_flow_tbl = NULL;
+	}
+}
+
+/*
  * Initialize the flow database. Memory is allocated in this
  * call and assigned to the flow database.
  *
@@ -357,6 +440,14 @@ ulp_flow_db_init(struct bnxt_ulp_context *ulp_ctxt)
 			    "Failed to allocate mem for flow table func id\n");
 		goto error_free;
 	}
+	/* initialize the parent child database */
+	if (ulp_flow_db_parent_tbl_init(flow_db,
+					dparms->fdb_parent_flow_entries)) {
+		BNXT_TF_DBG(ERR,
+			    "Failed to allocate mem for parent child db\n");
+		goto error_free;
+	}
+
 	/* All good so return. */
 	BNXT_TF_DBG(INFO, "FlowDB initialized with %d flows.\n",
 		    flow_tbl->num_flows);
@@ -388,6 +479,7 @@ ulp_flow_db_deinit(struct bnxt_ulp_context *ulp_ctxt)
 	bnxt_ulp_cntxt_ptr2_flow_db_set(ulp_ctxt, NULL);
 
 	/* Free up all the memory. */
+	ulp_flow_db_parent_tbl_deinit(flow_db);
 	ulp_flow_db_dealloc_resource(flow_db);
 	rte_free(flow_db->func_id_tbl);
 	rte_free(flow_db);
@@ -578,7 +670,7 @@ ulp_flow_db_resource_del(struct bnxt_ulp_context *ulp_ctxt,
 	flow_tbl = &flow_db->flow_tbl;
 	/* check for max flows */
 	if (fid >= flow_tbl->num_flows || !fid) {
-		BNXT_TF_DBG(ERR, "Invalid flow index\n");
+		BNXT_TF_DBG(ERR, "Invalid flow index %x\n", fid);
 		return -EINVAL;
 	}
 
@@ -1050,3 +1142,253 @@ ulp_default_flow_db_cfa_action_get(struct bnxt_ulp_context *ulp_ctx,
 	*cfa_action = hndl;
 	return 0;
 }
+
+/*
+ * Allocate the entry in the parent-child database
+ *
+ * ulp_ctxt [in] Ptr to ulp_context
+ * fid [in] The flow id to the flow entry
+ *
+ * returns index on success and negative on failure.
+ */
+int32_t
+ulp_flow_db_parent_flow_alloc(struct bnxt_ulp_context *ulp_ctxt,
+			      uint32_t fid)
+{
+	struct bnxt_ulp_flow_db *flow_db;
+	struct ulp_fdb_parent_child_db *p_pdb;
+	uint32_t idx, free_idx = 0;
+
+	flow_db = bnxt_ulp_cntxt_ptr2_flow_db_get(ulp_ctxt);
+	if (!flow_db) {
+		BNXT_TF_DBG(ERR, "Invalid Arguments\n");
+		return -EINVAL;
+	}
+
+	/* check for max flows */
+	if (fid >= flow_db->flow_tbl.num_flows || !fid) {
+		BNXT_TF_DBG(ERR, "Invalid flow index\n");
+		return -EINVAL;
+	}
+
+	p_pdb = &flow_db->parent_child_db;
+	for (idx = 0; idx <= p_pdb->entries_count; idx++) {
+		if (p_pdb->parent_flow_tbl[idx].parent_fid == fid) {
+			BNXT_TF_DBG(ERR, "fid is already allocated\n");
+			return -EINVAL;
+		}
+		if (!p_pdb->parent_flow_tbl[idx].parent_fid && !free_idx)
+			free_idx = idx + 1;
+	}
+	/* no free slots */
+	if (!free_idx) {
+		BNXT_TF_DBG(ERR, "parent child db is full\n");
+		return -ENOMEM;
+	}
+
+	free_idx -= 1;
+	/* set the Fid in the parent child */
+	p_pdb->parent_flow_tbl[free_idx].parent_fid = fid;
+	return free_idx;
+}
+
+/*
+ * Free the entry in the parent-child database
+ *
+ * ulp_ctxt [in] Ptr to ulp_context
+ * fid [in] The flow id to the flow entry
+ *
+ * returns 0 on success and negative on failure.
+ */
+int32_t
+ulp_flow_db_parent_flow_free(struct bnxt_ulp_context *ulp_ctxt,
+			     uint32_t fid)
+{
+	struct bnxt_ulp_flow_db *flow_db;
+	struct ulp_fdb_parent_child_db *p_pdb;
+	uint32_t idx;
+
+	flow_db = bnxt_ulp_cntxt_ptr2_flow_db_get(ulp_ctxt);
+	if (!flow_db) {
+		BNXT_TF_DBG(ERR, "Invalid Arguments\n");
+		return -EINVAL;
+	}
+
+	/* check for max flows */
+	if (fid >= flow_db->flow_tbl.num_flows || !fid) {
+		BNXT_TF_DBG(ERR, "Invalid flow index\n");
+		return -EINVAL;
+	}
+
+	p_pdb = &flow_db->parent_child_db;
+	for (idx = 0; idx <= p_pdb->entries_count; idx++) {
+		if (p_pdb->parent_flow_tbl[idx].parent_fid == fid) {
+			/* free the contents */
+			p_pdb->parent_flow_tbl[idx].parent_fid = 0;
+			memset(p_pdb->parent_flow_tbl[idx].child_fid_bitset,
+			       0, p_pdb->child_bitset_size);
+			return 0;
+		}
+	}
+	BNXT_TF_DBG(ERR, "parent entry not found = %x\n", fid);
+	return -EINVAL;
+}
+
+/*
+ * Set or reset the child flow in the parent-child database
+ *
+ * ulp_ctxt [in] Ptr to ulp_context
+ * parent_fid [in] The flow id of the parent flow entry
+ * child_fid [in] The flow id of the child flow entry
+ * set_flag [in] Use 1 for setting child, 0 to reset
+ *
+ * returns zero on success and negative on failure.
+ */
+int32_t
+ulp_flow_db_parent_child_flow_set(struct bnxt_ulp_context *ulp_ctxt,
+				  uint32_t parent_fid,
+				  uint32_t child_fid,
+				  uint32_t set_flag)
+{
+	struct bnxt_ulp_flow_db *flow_db;
+	struct ulp_fdb_parent_child_db *p_pdb;
+	uint32_t idx, a_idx;
+	uint64_t *t;
+
+	flow_db = bnxt_ulp_cntxt_ptr2_flow_db_get(ulp_ctxt);
+	if (!flow_db) {
+		BNXT_TF_DBG(ERR, "Invalid Arguments\n");
+		return -EINVAL;
+	}
+
+	/* check for fid validity */
+	if (parent_fid >= flow_db->flow_tbl.num_flows || !parent_fid) {
+		BNXT_TF_DBG(ERR, "Invalid parent flow index %x\n", parent_fid);
+		return -EINVAL;
+	}
+
+	/* check for fid validity */
+	if (child_fid >= flow_db->flow_tbl.num_flows || !child_fid) {
+		BNXT_TF_DBG(ERR, "Invalid child flow index %x\n", child_fid);
+		return -EINVAL;
+	}
+
+	p_pdb = &flow_db->parent_child_db;
+	a_idx = child_fid / ULP_INDEX_BITMAP_SIZE;
+	for (idx = 0; idx <= p_pdb->entries_count; idx++) {
+		if (p_pdb->parent_flow_tbl[idx].parent_fid == parent_fid) {
+			t = p_pdb->parent_flow_tbl[idx].child_fid_bitset;
+			if (set_flag)
+				ULP_INDEX_BITMAP_SET(t[a_idx], child_fid);
+			else
+				ULP_INDEX_BITMAP_RESET(t[a_idx], child_fid);
+			return 0;
+		}
+	}
+	BNXT_TF_DBG(ERR, "Unable to set the parent-child flow %x:%x\n",
+		    parent_fid, child_fid);
+	return -1;
+}
+
+/*
+ * Get the parent index from the parent-child database
+ *
+ * ulp_ctxt [in] Ptr to ulp_context
+ * parent_fid [in] The flow id of the parent flow entry
+ * parent_idx [out] The parent index of parent flow entry
+ *
+ * returns zero on success and negative on failure.
+ */
+int32_t
+ulp_flow_db_parent_flow_idx_get(struct bnxt_ulp_context *ulp_ctxt,
+				uint32_t parent_fid,
+				uint32_t *parent_idx)
+{
+	struct bnxt_ulp_flow_db *flow_db;
+	struct ulp_fdb_parent_child_db *p_pdb;
+	uint32_t idx;
+
+	flow_db = bnxt_ulp_cntxt_ptr2_flow_db_get(ulp_ctxt);
+	if (!flow_db) {
+		BNXT_TF_DBG(ERR, "Invalid Arguments\n");
+		return -EINVAL;
+	}
+
+	/* check for fid validity */
+	if (parent_fid >= flow_db->flow_tbl.num_flows || !parent_fid) {
+		BNXT_TF_DBG(ERR, "Invalid parent flow index %x\n", parent_fid);
+		return -EINVAL;
+	}
+
+	p_pdb = &flow_db->parent_child_db;
+	for (idx = 0; idx <= p_pdb->entries_count; idx++) {
+		if (p_pdb->parent_flow_tbl[idx].parent_fid == parent_fid) {
+			*parent_idx = idx;
+			return 0;
+		}
+	}
+	BNXT_TF_DBG(ERR, "Unable to get the parent flow %x\n", parent_fid);
+	return -1;
+}
+
+/*
+ * Get the next child flow in the parent-child database
+ *
+ * ulp_ctxt [in] Ptr to ulp_context
+ * parent_fid [in] The flow id of the parent flow entry
+ * child_fid [in/out] The flow id of the child flow entry
+ *
+ * returns zero on success and negative on failure.
+ * Pass child_fid as zero for first entry.
+ */
+int32_t
+ulp_flow_db_parent_child_flow_next_entry_get(struct bnxt_ulp_flow_db *flow_db,
+					     uint32_t parent_idx,
+					     uint32_t *child_fid)
+{
+	struct ulp_fdb_parent_child_db *p_pdb;
+	uint32_t idx, s_idx, mod_fid;
+	uint32_t next_fid = *child_fid;
+	uint64_t *child_bitset;
+	uint64_t bs;
+
+	/* check for fid validity */
+	p_pdb = &flow_db->parent_child_db;
+	if (parent_idx >= p_pdb->entries_count ||
+	    !p_pdb->parent_flow_tbl[parent_idx].parent_fid) {
+		BNXT_TF_DBG(ERR, "Invalid parent flow index %x\n", parent_idx);
+		return -EINVAL;
+	}
+
+	child_bitset = p_pdb->parent_flow_tbl[parent_idx].child_fid_bitset;
+	do {
+		/* increment the flow id to find the next valid flow id */
+		next_fid++;
+		if (next_fid >= flow_db->flow_tbl.num_flows)
+			return -ENOENT;
+		idx = next_fid / ULP_INDEX_BITMAP_SIZE;
+		mod_fid = next_fid % ULP_INDEX_BITMAP_SIZE;
+		s_idx = idx;
+		while (!(bs = child_bitset[idx])) {
+			idx++;
+			if ((idx * ULP_INDEX_BITMAP_SIZE) >=
+			    flow_db->flow_tbl.num_flows)
+				return -ENOENT;
+		}
+		/*
+		 * remove the previous bits in the bitset bs to find the
+		 * next non zero bit in the bitset. This needs to be done
+		 * only if the idx is same as he one you started.
+		 */
+		if (s_idx == idx)
+			bs &= (-1UL >> mod_fid);
+		next_fid = (idx * ULP_INDEX_BITMAP_SIZE) + __builtin_clzl(bs);
+		if (*child_fid >= next_fid) {
+			BNXT_TF_DBG(ERR, "Parent Child Database is corrupt\n");
+			return -ENOENT;
+		}
+		idx = next_fid / ULP_INDEX_BITMAP_SIZE;
+	} while (!ULP_INDEX_BITMAP_GET(child_bitset[idx], next_fid));
+	*child_fid = next_fid;
+	return 0;
+}
drivers/net/bnxt/tf_ulp/ulp_flow_db.h +84 -0

100 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_template_db_tbl.c +1 -0
index 4904a41..a677b0c 100644
@@ -368,6 +368,7 @@ struct bnxt_ulp_device_params ulp_device_params[BNXT_ULP_DEVICE_ID_LAST] = {
 	.mark_db_lfid_entries    = 65536,
 	.mark_db_gfid_entries    = 65536,
 	.flow_count_db_entries   = 16384,
+	.fdb_parent_flow_entries = 2,
 	.num_resources_per_flow  = 8,
 	.num_phy_ports           = 2,
 	.ext_cntr_table_type     = 0,
drivers/net/bnxt/tf_ulp/ulp_template_struct.h +1 -0
index 50a986c..2e94b6f 100644
@@ -160,6 +160,7 @@ struct bnxt_ulp_device_params {
 	uint64_t			int_flow_db_num_entries;
 	uint64_t			ext_flow_db_num_entries;
 	uint32_t			flow_count_db_entries;
+	uint32_t			fdb_parent_flow_entries;
 	uint32_t			num_resources_per_flow;
 	uint32_t			ext_cntr_table_type;
 	uint64_t			byte_count_mask;
drivers/net/bnxt/tf_ulp/ulp_utils.h +4 -0
index c054a77..898e851 100644
@@ -11,6 +11,7 @@
 
 #define ULP_BUFFER_ALIGN_8_BYTE		8
 #define ULP_BUFFER_ALIGN_16_BYTE	16
+#define ULP_BUFFER_ALIGN_64_BYTE	64
 
 /*
  * Macros for bitmap sets and gets
@@ -53,6 +54,9 @@
 /* Macro to convert bits to bytes with no round off*/
 #define ULP_BITS_2_BYTE_NR(bits_x)	((bits_x) / 8)
 
+/* Macro to round off to next multiple of 8*/
+#define ULP_BYTE_ROUND_OFF_8(x)	(((x) + 7) & ~7)
+
 /* Macros to read the computed fields */
 #define ULP_COMP_FLD_IDX_RD(params, idx) \
 	rte_be_to_cpu_32((params)->comp_fld[(idx)])
Signature · 1 line
2.7.4
#10 lore raw

PATCH 10/13 net/bnxt: consolidate template table processing

In reply to Somnath Kotur

From: Mike Baucom <[email protected]>

Name changes due to consolidating the template table processing.

- chip before type in name
- removal of class in key field info

---
 drivers/net/bnxt/tf_ulp/ulp_mapper.c               | 12 ++++----
 .../net/bnxt/tf_ulp/ulp_template_db_stingray_act.c |  6 ++--
 .../bnxt/tf_ulp/ulp_template_db_stingray_class.c   | 10 +++----
 drivers/net/bnxt/tf_ulp/ulp_template_db_tbl.c      | 34 +++++++++++-----------
 drivers/net/bnxt/tf_ulp/ulp_template_db_tbl.h      | 32 ++++++++++----------
 .../net/bnxt/tf_ulp/ulp_template_db_wh_plus_act.c  |  6 ++--
 .../bnxt/tf_ulp/ulp_template_db_wh_plus_class.c    | 10 +++----
 drivers/net/bnxt/tf_ulp/ulp_template_struct.h      |  4 +--
 8 files changed, 57 insertions(+), 57 deletions(-)
drivers/net/bnxt/tf_ulp/ulp_mapper.c +6 -6
index 812e35c..cd289cc 100644
@@ -256,7 +256,7 @@ ulp_mapper_tbl_list_get(struct bnxt_ulp_mapper_parms *mparms,
  *
  * Returns array of Key fields, or NULL on error.
  */
-static struct bnxt_ulp_mapper_class_key_field_info *
+static struct bnxt_ulp_mapper_key_field_info *
 ulp_mapper_key_fields_get(struct bnxt_ulp_mapper_parms *mparms,
 			  struct bnxt_ulp_mapper_tbl_info *tbl,
 			  uint32_t *num_flds)
@@ -1009,7 +1009,7 @@ ulp_mapper_result_field_process(struct bnxt_ulp_mapper_parms *parms,
 static int32_t
 ulp_mapper_keymask_field_process(struct bnxt_ulp_mapper_parms *parms,
 				 enum tf_dir dir,
-				 struct bnxt_ulp_mapper_class_key_field_info *f,
+				 struct bnxt_ulp_mapper_key_field_info *f,
 				 struct ulp_blob *blob,
 				 uint8_t is_key,
 				 const char *name)
@@ -1020,7 +1020,7 @@ ulp_mapper_keymask_field_process(struct bnxt_ulp_mapper_parms *parms,
 	uint8_t *operand;
 	struct ulp_regfile *regfile = parms->regfile;
 	uint8_t *val = NULL;
-	struct bnxt_ulp_mapper_class_key_field_info *fld = f;
+	struct bnxt_ulp_mapper_key_field_info *fld = f;
 	uint32_t field_size;
 
 	if (is_key) {
@@ -1442,7 +1442,7 @@ static int32_t
 ulp_mapper_tcam_tbl_process(struct bnxt_ulp_mapper_parms *parms,
 			    struct bnxt_ulp_mapper_tbl_info *tbl)
 {
-	struct bnxt_ulp_mapper_class_key_field_info	*kflds;
+	struct bnxt_ulp_mapper_key_field_info	*kflds;
 	struct ulp_blob key, mask, data, update_data;
 	uint32_t i, num_kflds;
 	struct tf *tfp;
@@ -1670,7 +1670,7 @@ static int32_t
 ulp_mapper_em_tbl_process(struct bnxt_ulp_mapper_parms *parms,
 			  struct bnxt_ulp_mapper_tbl_info *tbl)
 {
-	struct bnxt_ulp_mapper_class_key_field_info	*kflds;
+	struct bnxt_ulp_mapper_key_field_info	*kflds;
 	struct bnxt_ulp_mapper_result_field_info *dflds;
 	struct ulp_blob key, data;
 	uint32_t i, num_kflds, num_dflds;
@@ -2061,7 +2061,7 @@ static int32_t
 ulp_mapper_cache_tbl_process(struct bnxt_ulp_mapper_parms *parms,
 			     struct bnxt_ulp_mapper_tbl_info *tbl)
 {
-	struct bnxt_ulp_mapper_class_key_field_info *kflds;
+	struct bnxt_ulp_mapper_key_field_info *kflds;
 	struct bnxt_ulp_mapper_cache_entry *cache_entry;
 	struct bnxt_ulp_mapper_ident_info *idents;
 	uint32_t i, num_kflds = 0, num_idents = 0;
drivers/net/bnxt/tf_ulp/ulp_template_db_stingray_act.c +3 -3
index a5019d6..68e4d8e 100644
@@ -8,7 +8,7 @@
 #include "ulp_template_struct.h"
 #include "ulp_rte_parser.h"
 
-struct bnxt_ulp_mapper_tbl_list_info ulp_act_stingray_tmpl_list[] = {
+struct bnxt_ulp_mapper_tbl_list_info ulp_stingray_act_tmpl_list[] = {
 	[1] = {
 	.device_name = BNXT_ULP_DEVICE_ID_STINGRAY,
 	.num_tbls = 6,
@@ -47,7 +47,7 @@ struct bnxt_ulp_mapper_tbl_list_info ulp_act_stingray_tmpl_list[] = {
 	}
 };
 
-struct bnxt_ulp_mapper_tbl_info ulp_act_stingray_tbl_list[] = {
+struct bnxt_ulp_mapper_tbl_info ulp_stingray_act_tbl_list[] = {
 	{
 	.resource_func = BNXT_ULP_RESOURCE_FUNC_INDEX_TABLE,
 	.resource_type = TF_TBL_TYPE_ACT_STATS_64,
@@ -531,7 +531,7 @@ struct bnxt_ulp_mapper_tbl_info ulp_act_stingray_tbl_list[] = {
 	}
 };
 
-struct bnxt_ulp_mapper_result_field_info ulp_act_stingray_result_field_list[] = {
+struct bnxt_ulp_mapper_result_field_info ulp_stingray_act_result_field_list[] = {
 	{
 	.field_bit_size = 64,
 	.result_opcode = BNXT_ULP_MAPPER_OPC_SET_TO_ZERO
drivers/net/bnxt/tf_ulp/ulp_template_db_stingray_class.c +5 -5
index b5bdb94..1fa364e 100644
@@ -8,7 +8,7 @@
 #include "ulp_template_struct.h"
 #include "ulp_rte_parser.h"
 
-struct bnxt_ulp_mapper_tbl_list_info ulp_class_stingray_tmpl_list[] = {
+struct bnxt_ulp_mapper_tbl_list_info ulp_stingray_class_tmpl_list[] = {
 	[1] = {
 	.device_name = BNXT_ULP_DEVICE_ID_STINGRAY,
 	.num_tbls = 6,
@@ -149,7 +149,7 @@ struct bnxt_ulp_mapper_tbl_list_info ulp_class_stingray_tmpl_list[] = {
 	}
 };
 
-struct bnxt_ulp_mapper_tbl_info ulp_class_stingray_tbl_list[] = {
+struct bnxt_ulp_mapper_tbl_info ulp_stingray_class_tbl_list[] = {
 	{
 	.resource_func = BNXT_ULP_RESOURCE_FUNC_INDEX_TABLE,
 	.resource_type = TF_TBL_TYPE_FULL_ACT_RECORD,
@@ -2349,7 +2349,7 @@ struct bnxt_ulp_mapper_tbl_info ulp_class_stingray_tbl_list[] = {
 	}
 };
 
-struct bnxt_ulp_mapper_class_key_field_info ulp_class_stingray_key_field_list[] = {
+struct bnxt_ulp_mapper_key_field_info ulp_stingray_class_key_field_list[] = {
 	{
 	.field_bit_size = 12,
 	.mask_opcode = BNXT_ULP_MAPPER_OPC_SET_TO_ZERO,
@@ -13070,7 +13070,7 @@ struct bnxt_ulp_mapper_class_key_field_info ulp_class_stingray_key_field_list[]
 	}
 };
 
-struct bnxt_ulp_mapper_result_field_info ulp_class_stingray_result_field_list[] = {
+struct bnxt_ulp_mapper_result_field_info ulp_stingray_class_result_field_list[] = {
 	{
 	.field_bit_size = 14,
 	.result_opcode = BNXT_ULP_MAPPER_OPC_SET_TO_ZERO
@@ -18750,7 +18750,7 @@ struct bnxt_ulp_mapper_result_field_info ulp_class_stingray_result_field_list[]
 	}
 };
 
-struct bnxt_ulp_mapper_ident_info ulp_class_stingray_ident_list[] = {
+struct bnxt_ulp_mapper_ident_info ulp_stingray_class_ident_list[] = {
 	{
 	.resource_func = BNXT_ULP_RESOURCE_FUNC_IDENTIFIER,
 	.ident_type = TF_IDENT_TYPE_L2_CTXT_HIGH,
drivers/net/bnxt/tf_ulp/ulp_template_db_tbl.c +17 -17
index a677b0c..7f5a316 100644
@@ -314,31 +314,31 @@ struct bnxt_ulp_cache_tbl_params ulp_cache_tbl_params[] = {
 
 const struct ulp_template_device_tbls ulp_template_stingray_tbls[] = {
 	[BNXT_ULP_TEMPLATE_TYPE_CLASS] = {
-	.tmpl_list               = ulp_class_stingray_tmpl_list,
-	.tbl_list                = ulp_class_stingray_tbl_list,
-	.key_field_list          = ulp_class_stingray_key_field_list,
-	.result_field_list       = ulp_class_stingray_result_field_list,
-	.ident_list              = ulp_class_stingray_ident_list
+	.tmpl_list               = ulp_stingray_class_tmpl_list,
+	.tbl_list                = ulp_stingray_class_tbl_list,
+	.key_field_list          = ulp_stingray_class_key_field_list,
+	.result_field_list       = ulp_stingray_class_result_field_list,
+	.ident_list              = ulp_stingray_class_ident_list
 	},
 	[BNXT_ULP_TEMPLATE_TYPE_ACTION] = {
-	.tmpl_list               = ulp_act_stingray_tmpl_list,
-	.tbl_list                = ulp_act_stingray_tbl_list,
-	.result_field_list       = ulp_act_stingray_result_field_list
+	.tmpl_list               = ulp_stingray_act_tmpl_list,
+	.tbl_list                = ulp_stingray_act_tbl_list,
+	.result_field_list       = ulp_stingray_act_result_field_list
 	}
 };
 
 const struct ulp_template_device_tbls ulp_template_wh_plus_tbls[] = {
 	[BNXT_ULP_TEMPLATE_TYPE_CLASS] = {
-	.tmpl_list               = ulp_class_wh_plus_tmpl_list,
-	.tbl_list                = ulp_class_wh_plus_tbl_list,
-	.key_field_list          = ulp_class_wh_plus_key_field_list,
-	.result_field_list       = ulp_class_wh_plus_result_field_list,
-	.ident_list              = ulp_class_wh_plus_ident_list
+	.tmpl_list               = ulp_wh_plus_class_tmpl_list,
+	.tbl_list                = ulp_wh_plus_class_tbl_list,
+	.key_field_list          = ulp_wh_plus_class_key_field_list,
+	.result_field_list       = ulp_wh_plus_class_result_field_list,
+	.ident_list              = ulp_wh_plus_class_ident_list
 	},
 	[BNXT_ULP_TEMPLATE_TYPE_ACTION] = {
-	.tmpl_list               = ulp_act_wh_plus_tmpl_list,
-	.tbl_list                = ulp_act_wh_plus_tbl_list,
-	.result_field_list       = ulp_act_wh_plus_result_field_list
+	.tmpl_list               = ulp_wh_plus_act_tmpl_list,
+	.tbl_list                = ulp_wh_plus_act_tbl_list,
+	.result_field_list       = ulp_wh_plus_act_result_field_list
 	}
 };
 
@@ -351,6 +351,7 @@ struct bnxt_ulp_device_params ulp_device_params[BNXT_ULP_DEVICE_ID_LAST] = {
 	.mark_db_lfid_entries    = 65536,
 	.mark_db_gfid_entries    = 65536,
 	.flow_count_db_entries   = 16384,
+	.fdb_parent_flow_entries = 2,
 	.num_resources_per_flow  = 8,
 	.num_phy_ports           = 2,
 	.ext_cntr_table_type     = 0,
@@ -368,7 +369,6 @@ struct bnxt_ulp_device_params ulp_device_params[BNXT_ULP_DEVICE_ID_LAST] = {
 	.mark_db_lfid_entries    = 65536,
 	.mark_db_gfid_entries    = 65536,
 	.flow_count_db_entries   = 16384,
-	.fdb_parent_flow_entries = 2,
 	.num_resources_per_flow  = 8,
 	.num_phy_ports           = 2,
 	.ext_cntr_table_type     = 0,
drivers/net/bnxt/tf_ulp/ulp_template_db_tbl.h +16 -16
index 7a541cb..8c13ca3 100644
@@ -8,41 +8,41 @@
 
 #include "ulp_template_struct.h"
 
-extern struct bnxt_ulp_mapper_tbl_list_info ulp_class_wh_plus_tmpl_list[];
+extern struct bnxt_ulp_mapper_tbl_list_info ulp_wh_plus_class_tmpl_list[];
 
-extern struct bnxt_ulp_mapper_tbl_info ulp_class_wh_plus_tbl_list[];
+extern struct bnxt_ulp_mapper_tbl_info ulp_wh_plus_class_tbl_list[];
 
 extern struct
-bnxt_ulp_mapper_class_key_field_info ulp_class_wh_plus_key_field_list[];
+bnxt_ulp_mapper_key_field_info ulp_wh_plus_class_key_field_list[];
 
 extern struct
-bnxt_ulp_mapper_result_field_info ulp_class_wh_plus_result_field_list[];
+bnxt_ulp_mapper_result_field_info ulp_wh_plus_class_result_field_list[];
 
-extern struct bnxt_ulp_mapper_ident_info ulp_class_wh_plus_ident_list[];
+extern struct bnxt_ulp_mapper_ident_info ulp_wh_plus_class_ident_list[];
 
-extern struct bnxt_ulp_mapper_tbl_list_info ulp_act_wh_plus_tmpl_list[];
+extern struct bnxt_ulp_mapper_tbl_list_info ulp_wh_plus_act_tmpl_list[];
 
-extern struct bnxt_ulp_mapper_tbl_info ulp_act_wh_plus_tbl_list[];
+extern struct bnxt_ulp_mapper_tbl_info ulp_wh_plus_act_tbl_list[];
 
 extern struct
-bnxt_ulp_mapper_result_field_info ulp_act_wh_plus_result_field_list[];
+bnxt_ulp_mapper_result_field_info ulp_wh_plus_act_result_field_list[];
 
-extern struct bnxt_ulp_mapper_tbl_list_info ulp_class_stingray_tmpl_list[];
+extern struct bnxt_ulp_mapper_tbl_list_info ulp_stingray_class_tmpl_list[];
 
-extern struct bnxt_ulp_mapper_tbl_info ulp_class_stingray_tbl_list[];
+extern struct bnxt_ulp_mapper_tbl_info ulp_stingray_class_tbl_list[];
 
 extern struct
-bnxt_ulp_mapper_class_key_field_info ulp_class_stingray_key_field_list[];
+bnxt_ulp_mapper_key_field_info ulp_stingray_class_key_field_list[];
 
 extern struct
-bnxt_ulp_mapper_result_field_info ulp_class_stingray_result_field_list[];
+bnxt_ulp_mapper_result_field_info ulp_stingray_class_result_field_list[];
 
-extern struct bnxt_ulp_mapper_ident_info ulp_class_stingray_ident_list[];
+extern struct bnxt_ulp_mapper_ident_info ulp_stingray_class_ident_list[];
 
-extern struct bnxt_ulp_mapper_tbl_list_info ulp_act_stingray_tmpl_list[];
+extern struct bnxt_ulp_mapper_tbl_list_info ulp_stingray_act_tmpl_list[];
 
-extern struct bnxt_ulp_mapper_tbl_info ulp_act_stingray_tbl_list[];
+extern struct bnxt_ulp_mapper_tbl_info ulp_stingray_act_tbl_list[];
 
 extern struct
-bnxt_ulp_mapper_result_field_info ulp_act_stingray_result_field_list[];
+bnxt_ulp_mapper_result_field_info ulp_stingray_act_result_field_list[];
 #endif
drivers/net/bnxt/tf_ulp/ulp_template_db_wh_plus_act.c +3 -3
index 82b2ad9..381278e 100644
@@ -8,7 +8,7 @@
 #include "ulp_template_struct.h"
 #include "ulp_rte_parser.h"
 
-struct bnxt_ulp_mapper_tbl_list_info ulp_act_wh_plus_tmpl_list[] = {
+struct bnxt_ulp_mapper_tbl_list_info ulp_wh_plus_act_tmpl_list[] = {
 	[1] = {
 	.device_name = BNXT_ULP_DEVICE_ID_WH_PLUS,
 	.num_tbls = 6,
@@ -47,7 +47,7 @@ struct bnxt_ulp_mapper_tbl_list_info ulp_act_wh_plus_tmpl_list[] = {
 	}
 };
 
-struct bnxt_ulp_mapper_tbl_info ulp_act_wh_plus_tbl_list[] = {
+struct bnxt_ulp_mapper_tbl_info ulp_wh_plus_act_tbl_list[] = {
 	{
 	.resource_func = BNXT_ULP_RESOURCE_FUNC_INDEX_TABLE,
 	.resource_type = TF_TBL_TYPE_ACT_STATS_64,
@@ -530,7 +530,7 @@ struct bnxt_ulp_mapper_tbl_info ulp_act_wh_plus_tbl_list[] = {
 	}
 };
 
-struct bnxt_ulp_mapper_result_field_info ulp_act_wh_plus_result_field_list[] = {
+struct bnxt_ulp_mapper_result_field_info ulp_wh_plus_act_result_field_list[] = {
 	{
 	.field_bit_size = 64,
 	.result_opcode = BNXT_ULP_MAPPER_OPC_SET_TO_ZERO
drivers/net/bnxt/tf_ulp/ulp_template_db_wh_plus_class.c +5 -5
index 9f40b39..7024658 100644
@@ -8,7 +8,7 @@
 #include "ulp_template_struct.h"
 #include "ulp_rte_parser.h"
 
-struct bnxt_ulp_mapper_tbl_list_info ulp_class_wh_plus_tmpl_list[] = {
+struct bnxt_ulp_mapper_tbl_list_info ulp_wh_plus_class_tmpl_list[] = {
 	[1] = {
 	.device_name = BNXT_ULP_DEVICE_ID_WH_PLUS,
 	.num_tbls = 6,
@@ -149,7 +149,7 @@ struct bnxt_ulp_mapper_tbl_list_info ulp_class_wh_plus_tmpl_list[] = {
 	}
 };
 
-struct bnxt_ulp_mapper_tbl_info ulp_class_wh_plus_tbl_list[] = {
+struct bnxt_ulp_mapper_tbl_info ulp_wh_plus_class_tbl_list[] = {
 	{
 	.resource_func = BNXT_ULP_RESOURCE_FUNC_INDEX_TABLE,
 	.resource_type = TF_TBL_TYPE_FULL_ACT_RECORD,
@@ -2349,7 +2349,7 @@ struct bnxt_ulp_mapper_tbl_info ulp_class_wh_plus_tbl_list[] = {
 	}
 };
 
-struct bnxt_ulp_mapper_class_key_field_info ulp_class_wh_plus_key_field_list[] = {
+struct bnxt_ulp_mapper_key_field_info ulp_wh_plus_class_key_field_list[] = {
 	{
 	.field_bit_size = 8,
 	.mask_opcode = BNXT_ULP_MAPPER_OPC_SET_TO_ZERO,
@@ -13070,7 +13070,7 @@ struct bnxt_ulp_mapper_class_key_field_info ulp_class_wh_plus_key_field_list[] =
 	}
 };
 
-struct bnxt_ulp_mapper_result_field_info ulp_class_wh_plus_result_field_list[] = {
+struct bnxt_ulp_mapper_result_field_info ulp_wh_plus_class_result_field_list[] = {
 	{
 	.field_bit_size = 14,
 	.result_opcode = BNXT_ULP_MAPPER_OPC_SET_TO_ZERO
@@ -18750,7 +18750,7 @@ struct bnxt_ulp_mapper_result_field_info ulp_class_wh_plus_result_field_list[] =
 	}
 };
 
-struct bnxt_ulp_mapper_ident_info ulp_class_wh_plus_ident_list[] = {
+struct bnxt_ulp_mapper_ident_info ulp_wh_plus_class_ident_list[] = {
 	{
 	.resource_func = BNXT_ULP_RESOURCE_FUNC_IDENTIFIER,
 	.ident_type = TF_IDENT_TYPE_L2_CTXT_HIGH,
drivers/net/bnxt/tf_ulp/ulp_template_struct.h +2 -2
index 2e94b6f..107a06a 100644
@@ -144,7 +144,7 @@ extern struct bnxt_ulp_act_match_info ulp_act_match_list[];
 struct ulp_template_device_tbls {
 	struct bnxt_ulp_mapper_tbl_list_info *tmpl_list;
 	struct bnxt_ulp_mapper_tbl_info *tbl_list;
-	struct bnxt_ulp_mapper_class_key_field_info *key_field_list;
+	struct bnxt_ulp_mapper_key_field_info *key_field_list;
 	struct bnxt_ulp_mapper_result_field_info *result_field_list;
 	struct bnxt_ulp_mapper_ident_info *ident_list;
 };
@@ -212,7 +212,7 @@ struct bnxt_ulp_mapper_tbl_info {
 	uint32_t			index_operand;
 };
 
-struct bnxt_ulp_mapper_class_key_field_info {
+struct bnxt_ulp_mapper_key_field_info {
 	uint8_t				description[64];
 	enum bnxt_ulp_mapper_opc	mask_opcode;
 	enum bnxt_ulp_mapper_opc	spec_opcode;
Signature · 1 line
2.7.4
#11 lore raw

PATCH 11/13 net/bnxt: remove flow db table type from templates

In reply to Somnath Kotur

From: Mike Baucom <[email protected]>

FDB type is now driven by the caller, not the template.

---
 .../net/bnxt/tf_ulp/ulp_template_db_stingray_act.c | 18 ++----
 .../bnxt/tf_ulp/ulp_template_db_stingray_class.c   | 69 ++++++++--------------
 .../net/bnxt/tf_ulp/ulp_template_db_wh_plus_act.c  | 18 ++----
 .../bnxt/tf_ulp/ulp_template_db_wh_plus_class.c    | 69 ++++++++--------------
 drivers/net/bnxt/tf_ulp/ulp_template_struct.h      |  1 -
 5 files changed, 58 insertions(+), 117 deletions(-)
drivers/net/bnxt/tf_ulp/ulp_template_db_stingray_act.c +6 -12
index 68e4d8e..2237ffb 100644
@@ -12,38 +12,32 @@ struct bnxt_ulp_mapper_tbl_list_info ulp_stingray_act_tmpl_list[] = {
 	[1] = {
 	.device_name = BNXT_ULP_DEVICE_ID_STINGRAY,
 	.num_tbls = 6,
-	.start_tbl_idx = 0,
-	.flow_db_table_type = BNXT_ULP_FDB_TYPE_REGULAR
+	.start_tbl_idx = 0
 	},
 	[2] = {
 	.device_name = BNXT_ULP_DEVICE_ID_STINGRAY,
 	.num_tbls = 3,
-	.start_tbl_idx = 6,
-	.flow_db_table_type = BNXT_ULP_FDB_TYPE_REGULAR
+	.start_tbl_idx = 6
 	},
 	[3] = {
 	.device_name = BNXT_ULP_DEVICE_ID_STINGRAY,
 	.num_tbls = 3,
-	.start_tbl_idx = 9,
-	.flow_db_table_type = BNXT_ULP_FDB_TYPE_REGULAR
+	.start_tbl_idx = 9
 	},
 	[4] = {
 	.device_name = BNXT_ULP_DEVICE_ID_STINGRAY,
 	.num_tbls = 6,
-	.start_tbl_idx = 12,
-	.flow_db_table_type = BNXT_ULP_FDB_TYPE_REGULAR
+	.start_tbl_idx = 12
 	},
 	[5] = {
 	.device_name = BNXT_ULP_DEVICE_ID_STINGRAY,
 	.num_tbls = 6,
-	.start_tbl_idx = 18,
-	.flow_db_table_type = BNXT_ULP_FDB_TYPE_REGULAR
+	.start_tbl_idx = 18
 	},
 	[6] = {
 	.device_name = BNXT_ULP_DEVICE_ID_STINGRAY,
 	.num_tbls = 5,
-	.start_tbl_idx = 24,
-	.flow_db_table_type = BNXT_ULP_FDB_TYPE_REGULAR
+	.start_tbl_idx = 24
 	}
 };
 
drivers/net/bnxt/tf_ulp/ulp_template_db_stingray_class.c +23 -46

163 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_template_db_wh_plus_act.c +6 -12
index 381278e..39e8ec4 100644
@@ -12,38 +12,32 @@ struct bnxt_ulp_mapper_tbl_list_info ulp_wh_plus_act_tmpl_list[] = {
 	[1] = {
 	.device_name = BNXT_ULP_DEVICE_ID_WH_PLUS,
 	.num_tbls = 6,
-	.start_tbl_idx = 0,
-	.flow_db_table_type = BNXT_ULP_FDB_TYPE_REGULAR
+	.start_tbl_idx = 0
 	},
 	[2] = {
 	.device_name = BNXT_ULP_DEVICE_ID_WH_PLUS,
 	.num_tbls = 3,
-	.start_tbl_idx = 6,
-	.flow_db_table_type = BNXT_ULP_FDB_TYPE_REGULAR
+	.start_tbl_idx = 6
 	},
 	[3] = {
 	.device_name = BNXT_ULP_DEVICE_ID_WH_PLUS,
 	.num_tbls = 3,
-	.start_tbl_idx = 9,
-	.flow_db_table_type = BNXT_ULP_FDB_TYPE_REGULAR
+	.start_tbl_idx = 9
 	},
 	[4] = {
 	.device_name = BNXT_ULP_DEVICE_ID_WH_PLUS,
 	.num_tbls = 6,
-	.start_tbl_idx = 12,
-	.flow_db_table_type = BNXT_ULP_FDB_TYPE_REGULAR
+	.start_tbl_idx = 12
 	},
 	[5] = {
 	.device_name = BNXT_ULP_DEVICE_ID_WH_PLUS,
 	.num_tbls = 6,
-	.start_tbl_idx = 18,
-	.flow_db_table_type = BNXT_ULP_FDB_TYPE_REGULAR
+	.start_tbl_idx = 18
 	},
 	[6] = {
 	.device_name = BNXT_ULP_DEVICE_ID_WH_PLUS,
 	.num_tbls = 5,
-	.start_tbl_idx = 24,
-	.flow_db_table_type = BNXT_ULP_FDB_TYPE_REGULAR
+	.start_tbl_idx = 24
 	}
 };
 
drivers/net/bnxt/tf_ulp/ulp_template_db_wh_plus_class.c +23 -46

163 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_template_struct.h +0 -1
index 107a06a..69bb61e 100644
@@ -175,7 +175,6 @@ struct bnxt_ulp_mapper_tbl_list_info {
 	uint32_t		device_name;
 	uint32_t		start_tbl_idx;
 	uint32_t		num_tbls;
-	enum bnxt_ulp_fdb_type	flow_db_table_type;
 };
 
 struct bnxt_ulp_mapper_tbl_info {
Signature · 1 line
2.7.4
#12 lore raw

PATCH 12/13 net/bnxt: add support for parent child flow create and free

In reply to Somnath Kotur

From: Kishore Padmanabha <[email protected]>

Added support in the ulp mapper to enable parent child flow creation and destroy. This feature enables support for the vxlan decap functionality

---
 drivers/net/bnxt/tf_ulp/ulp_flow_db.c          | 177 ++++++++++++++++++++++++-
 drivers/net/bnxt/tf_ulp/ulp_flow_db.h          |  36 +++++
 drivers/net/bnxt/tf_ulp/ulp_mapper.c           |  87 +++++++++++-
 drivers/net/bnxt/tf_ulp/ulp_mapper.h           |   7 +
 drivers/net/bnxt/tf_ulp/ulp_template_db_enum.h |   5 +-
 5 files changed, 302 insertions(+), 10 deletions(-)
drivers/net/bnxt/tf_ulp/ulp_flow_db.c +171 -6
index a1c3932..3be7489 100644
@@ -6,10 +6,10 @@
 #include <rte_malloc.h>
 #include "bnxt.h"
 #include "bnxt_tf_common.h"
-#include "ulp_flow_db.h"
 #include "ulp_utils.h"
 #include "ulp_template_struct.h"
 #include "ulp_mapper.h"
+#include "ulp_flow_db.h"
 #include "ulp_fc_mgr.h"
 
 #define ULP_FLOW_DB_RES_DIR_BIT		31
@@ -56,10 +56,10 @@ ulp_flow_db_active_flows_bit_set(struct bnxt_ulp_flow_db *flow_db,
 	} else {
 		if (flow_type == BNXT_ULP_FDB_TYPE_REGULAR)
 			ULP_INDEX_BITMAP_RESET(f_tbl->active_reg_flows[a_idx],
-					     idx);
+					       idx);
 		else
 			ULP_INDEX_BITMAP_RESET(f_tbl->active_dflt_flows[a_idx],
-					     idx);
+					       idx);
 	}
 }
 
@@ -89,6 +89,13 @@ ulp_flow_db_active_flows_bit_is_set(struct bnxt_ulp_flow_db *flow_db,
 					    idx);
 }
 
+static inline enum tf_dir
+ulp_flow_db_resource_dir_get(struct ulp_fdb_resource_info *res_info)
+{
+	return ((res_info->nxt_resource_idx & ULP_FLOW_DB_RES_DIR_MASK) >>
+		ULP_FLOW_DB_RES_DIR_BIT);
+}
+
 static uint8_t
 ulp_flow_db_resource_func_get(struct ulp_fdb_resource_info *res_info)
 {
@@ -157,11 +164,9 @@ ulp_flow_db_res_info_to_params(struct ulp_fdb_resource_info *resource_info,
 			       struct ulp_flow_db_res_params *params)
 {
 	memset(params, 0, sizeof(struct ulp_flow_db_res_params));
-	params->direction = ((resource_info->nxt_resource_idx &
-				 ULP_FLOW_DB_RES_DIR_MASK) >>
-				 ULP_FLOW_DB_RES_DIR_BIT);
 
 	/* use the helper function to get the resource func */
+	params->direction = ulp_flow_db_resource_dir_get(resource_info);
 	params->resource_func = ulp_flow_db_resource_func_get(resource_info);
 
 	if (params->resource_func == BNXT_ULP_RESOURCE_FUNC_EXT_EM_TABLE ||
@@ -303,6 +308,9 @@ ulp_flow_db_parent_tbl_init(struct bnxt_ulp_flow_db *flow_db,
 	struct ulp_fdb_parent_child_db *p_db;
 	uint32_t size, idx;
 
+	if (!num_entries)
+		return 0;
+
 	/* update the sizes for the allocation */
 	p_db = &flow_db->parent_child_db;
 	p_db->child_bitset_size = (flow_db->flow_tbl.num_flows /
@@ -1171,6 +1179,12 @@ ulp_flow_db_parent_flow_alloc(struct bnxt_ulp_context *ulp_ctxt,
 		return -EINVAL;
 	}
 
+	/* No support for parent child db then just exit */
+	if (!flow_db->parent_child_db.entries_count) {
+		BNXT_TF_DBG(ERR, "parent child db not supported\n");
+		return -EINVAL;
+	}
+
 	p_pdb = &flow_db->parent_child_db;
 	for (idx = 0; idx <= p_pdb->entries_count; idx++) {
 		if (p_pdb->parent_flow_tbl[idx].parent_fid == fid) {
@@ -1220,6 +1234,12 @@ ulp_flow_db_parent_flow_free(struct bnxt_ulp_context *ulp_ctxt,
 		return -EINVAL;
 	}
 
+	/* No support for parent child db then just exit */
+	if (!flow_db->parent_child_db.entries_count) {
+		BNXT_TF_DBG(ERR, "parent child db not supported\n");
+		return -EINVAL;
+	}
+
 	p_pdb = &flow_db->parent_child_db;
 	for (idx = 0; idx <= p_pdb->entries_count; idx++) {
 		if (p_pdb->parent_flow_tbl[idx].parent_fid == fid) {
@@ -1273,6 +1293,12 @@ ulp_flow_db_parent_child_flow_set(struct bnxt_ulp_context *ulp_ctxt,
 		return -EINVAL;
 	}
 
+	/* No support for parent child db then just exit */
+	if (!flow_db->parent_child_db.entries_count) {
+		BNXT_TF_DBG(ERR, "parent child db not supported\n");
+		return -EINVAL;
+	}
+
 	p_pdb = &flow_db->parent_child_db;
 	a_idx = child_fid / ULP_INDEX_BITMAP_SIZE;
 	for (idx = 0; idx <= p_pdb->entries_count; idx++) {
@@ -1320,6 +1346,12 @@ ulp_flow_db_parent_flow_idx_get(struct bnxt_ulp_context *ulp_ctxt,
 		return -EINVAL;
 	}
 
+	/* No support for parent child db then just exit */
+	if (!flow_db->parent_child_db.entries_count) {
+		BNXT_TF_DBG(ERR, "parent child db not supported\n");
+		return -EINVAL;
+	}
+
 	p_pdb = &flow_db->parent_child_db;
 	for (idx = 0; idx <= p_pdb->entries_count; idx++) {
 		if (p_pdb->parent_flow_tbl[idx].parent_fid == parent_fid) {
@@ -1392,3 +1424,136 @@ ulp_flow_db_parent_child_flow_next_entry_get(struct bnxt_ulp_flow_db *flow_db,
 	*child_fid = next_fid;
 	return 0;
 }
+
+/*
+ * Orphan the child flow entry
+ * This is called only for child flows that have
+ * BNXT_ULP_RESOURCE_FUNC_CHILD_FLOW resource
+ *
+ * ulp_ctxt [in] Ptr to ulp_context
+ * flow_type [in] Specify it is regular or default flow
+ * fid [in] The index to the flow entry
+ *
+ * Returns 0 on success and negative on failure.
+ */
+int32_t
+ulp_flow_db_child_flow_reset(struct bnxt_ulp_context *ulp_ctxt,
+			     enum bnxt_ulp_fdb_type flow_type,
+			     uint32_t fid)
+{
+	struct bnxt_ulp_flow_db *flow_db;
+	struct bnxt_ulp_flow_tbl *flow_tbl;
+	struct ulp_fdb_resource_info *fid_res;
+	uint32_t res_id = 0;
+
+	flow_db = bnxt_ulp_cntxt_ptr2_flow_db_get(ulp_ctxt);
+	if (!flow_db) {
+		BNXT_TF_DBG(ERR, "Invalid Arguments\n");
+		return -EINVAL;
+	}
+
+	if (flow_type > BNXT_ULP_FDB_TYPE_DEFAULT) {
+		BNXT_TF_DBG(ERR, "Invalid flow type\n");
+		return -EINVAL;
+	}
+
+	flow_tbl = &flow_db->flow_tbl;
+	/* check for max flows */
+	if (fid >= flow_tbl->num_flows || !fid) {
+		BNXT_TF_DBG(ERR, "Invalid flow index %x\n", fid);
+		return -EINVAL;
+	}
+
+	/* check if the flow is active or not */
+	if (!ulp_flow_db_active_flows_bit_is_set(flow_db, flow_type, fid)) {
+		BNXT_TF_DBG(ERR, "flow does not exist\n");
+		return -EINVAL;
+	}
+
+	/* Iterate the resource to get the resource handle */
+	res_id =  fid;
+	while (res_id) {
+		fid_res = &flow_tbl->flow_resources[res_id];
+		if (ulp_flow_db_resource_func_get(fid_res) ==
+		    BNXT_ULP_RESOURCE_FUNC_CHILD_FLOW) {
+			/* invalidate the resource details */
+			fid_res->resource_hndl = 0;
+			return 0;
+		}
+		res_id = 0;
+		ULP_FLOW_DB_RES_NXT_SET(res_id, fid_res->nxt_resource_idx);
+	}
+	/* failed */
+	return -1;
+}
+
+/*
+ * Create parent flow in the parent flow tbl
+ *
+ * parms [in] Ptr to mapper params
+ *
+ * Returns 0 on success and negative on failure.
+ */
+int32_t
+ulp_flow_db_parent_flow_create(struct bnxt_ulp_mapper_parms *parms)
+{
+	struct ulp_flow_db_res_params fid_parms;
+	int32_t fid_idx;
+
+	/* create the child flow entry in parent flow table */
+	fid_idx = ulp_flow_db_parent_flow_alloc(parms->ulp_ctx, parms->fid);
+	if (fid_idx < 0) {
+		BNXT_TF_DBG(ERR, "Error in creating parent flow fid %x\n",
+			    parms->fid);
+		return -1;
+	}
+
+	/* Add the parent details in the resource list of the flow */
+	memset(&fid_parms, 0, sizeof(fid_parms));
+	fid_parms.resource_func	= BNXT_ULP_RESOURCE_FUNC_PARENT_FLOW;
+	fid_parms.resource_hndl	= fid_idx;
+	fid_parms.critical_resource = BNXT_ULP_CRITICAL_RESOURCE_NO;
+	if (ulp_flow_db_resource_add(parms->ulp_ctx, BNXT_ULP_FDB_TYPE_REGULAR,
+				     parms->fid, &fid_parms)) {
+		BNXT_TF_DBG(ERR, "Error in adding flow res for fid %x\n",
+			    parms->fid);
+		return -1;
+	}
+	return 0;
+}
+
+/*
+ * Create child flow in the parent flow tbl
+ *
+ * parms [in] Ptr to mapper params
+ *
+ * Returns 0 on success and negative on failure.
+ */
+int32_t
+ulp_flow_db_child_flow_create(struct bnxt_ulp_mapper_parms *parms)
+{
+	struct ulp_flow_db_res_params fid_parms;
+	int32_t rc;
+
+	/* create the parent flow entry in parent flow table */
+	rc = ulp_flow_db_parent_child_flow_set(parms->ulp_ctx,
+					       parms->parent_fid,
+					       parms->fid, 1);
+	if (rc) {
+		BNXT_TF_DBG(ERR, "Error in setting child fid %x\n", parms->fid);
+		return -1;
+	}
+
+	/* Add the parent details in the resource list of the flow */
+	memset(&fid_parms, 0, sizeof(fid_parms));
+	fid_parms.resource_func	= BNXT_ULP_RESOURCE_FUNC_CHILD_FLOW;
+	fid_parms.resource_hndl	= parms->parent_fid;
+	fid_parms.critical_resource = BNXT_ULP_CRITICAL_RESOURCE_NO;
+	if (ulp_flow_db_resource_add(parms->ulp_ctx, BNXT_ULP_FDB_TYPE_REGULAR,
+				     parms->fid, &fid_parms)) {
+		BNXT_TF_DBG(ERR, "Error in adding flow res for fid %x\n",
+			    parms->fid);
+		return -1;
+	}
+	return 0;
+}
drivers/net/bnxt/tf_ulp/ulp_flow_db.h +36 -0
index 87bcd69..95fd199 100644
@@ -8,6 +8,7 @@
 
 #include "bnxt_ulp.h"
 #include "ulp_template_db_enum.h"
+#include "ulp_mapper.h"
 
 #define BNXT_FLOW_DB_DEFAULT_NUM_FLOWS		512
 #define BNXT_FLOW_DB_DEFAULT_NUM_RESOURCES	8
@@ -319,5 +320,40 @@ ulp_flow_db_parent_child_flow_next_entry_get(struct bnxt_ulp_flow_db *flow_db,
 					     uint32_t parent_idx,
 					     uint32_t *child_fid);
 
+/*
+ * Orphan the child flow entry
+ * This is called only for child flows that have
+ * BNXT_ULP_RESOURCE_FUNC_CHILD_FLOW resource
+ *
+ * ulp_ctxt [in] Ptr to ulp_context
+ * flow_type [in] Specify it is regular or default flow
+ * fid [in] The index to the flow entry
+ *
+ * Returns 0 on success and negative on failure.
+ */
+int32_t
+ulp_flow_db_child_flow_reset(struct bnxt_ulp_context *ulp_ctxt,
+			     enum bnxt_ulp_fdb_type flow_type,
+			     uint32_t fid);
+
+/*
+ * Create parent flow in the parent flow tbl
+ *
+ * parms [in] Ptr to mapper params
+ *
+ * Returns 0 on success and negative on failure.
+ */
+int32_t
+ulp_flow_db_parent_flow_create(struct bnxt_ulp_mapper_parms *parms);
+
+/*
+ * Create child flow in the parent flow tbl
+ *
+ * parms [in] Ptr to mapper params
+ *
+ * Returns 0 on success and negative on failure.
+ */
+int32_t
+ulp_flow_db_child_flow_create(struct bnxt_ulp_mapper_parms *parms);
 
 #endif /* _ULP_FLOW_DB_H_ */
drivers/net/bnxt/tf_ulp/ulp_mapper.c +84 -3

136 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_mapper.h +7 -0
index 6f93bcd..542e41e 100644
@@ -76,6 +76,8 @@ struct bnxt_ulp_mapper_parms {
 	enum bnxt_ulp_cache_table_opc		tcam_tbl_opc;
 	struct bnxt_ulp_mapper_cache_entry	*cache_ptr;
 	struct bnxt_ulp_device_params           *device_params;
+	uint32_t				parent_fid;
+	uint32_t				parent_flow;
 };
 
 struct bnxt_ulp_mapper_create_parms {
@@ -90,6 +92,11 @@ struct bnxt_ulp_mapper_create_parms {
 	uint16_t			func_id;
 	uint32_t			dir_attr;
 	enum bnxt_ulp_fdb_type		flow_type;
+
+	/* 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 */
+	uint32_t			parent_flow;
 };
 
 /* Function to initialize any dynamic mapper data. */
drivers/net/bnxt/tf_ulp/ulp_template_db_enum.h +4 -1
index 81da34e..168e308 100644
@@ -321,7 +321,10 @@ enum bnxt_ulp_resource_func {
 	BNXT_ULP_RESOURCE_FUNC_CACHE_TABLE = 0x82,
 	BNXT_ULP_RESOURCE_FUNC_IDENTIFIER = 0x83,
 	BNXT_ULP_RESOURCE_FUNC_IF_TABLE = 0x84,
-	BNXT_ULP_RESOURCE_FUNC_HW_FID = 0x85
+	BNXT_ULP_RESOURCE_FUNC_HW_FID = 0x85,
+	BNXT_ULP_RESOURCE_FUNC_SHARED_TABLE = 0x86,
+	BNXT_ULP_RESOURCE_FUNC_PARENT_FLOW = 0x87,
+	BNXT_ULP_RESOURCE_FUNC_CHILD_FLOW = 0x88
 };
 
 enum bnxt_ulp_resource_sub_type {
Signature · 1 line
2.7.4
#13 lore raw

PATCH 13/13 net/bnxt: remove parent fid validation in vnic change event processing

In reply to Somnath Kotur

From: Venkat Duvvuru <[email protected]>

Currently, when default vnic change async event is received, the async event handler will try to validate whether the parent fid that is coming as part of the event data is of the control channel's fid. This validation will fail in case of SR device because the parent function of the vnic and the control channel function (Foster parent) are different.

This patch fixes the problem by removing this parent fid validation as it is not really needed in case of Wh+ also.

Fixes 322bd6e70272 ("net/bnxt: add port representor infrastructure")
---
 drivers/net/bnxt/bnxt_cpr.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)
drivers/net/bnxt/bnxt_cpr.c +2 -5
index 5492394..91d1ffe 100644
@@ -50,7 +50,7 @@ static void
 bnxt_process_default_vnic_change(struct bnxt *bp,
 				 struct hwrm_async_event_cmpl *async_cmp)
 {
-	uint16_t fid, vnic_state, parent_id, vf_fid, vf_id;
+	uint16_t vnic_state, vf_fid, vf_id;
 	struct bnxt_representor *vf_rep_bp;
 	struct rte_eth_dev *eth_dev;
 	bool vfr_found = false;
@@ -67,10 +67,7 @@ bnxt_process_default_vnic_change(struct bnxt *bp,
 	if (vnic_state != BNXT_DEFAULT_VNIC_ALLOC)
 		return;
 
-	parent_id = (event_data & BNXT_DEFAULT_VNIC_CHANGE_PF_ID_MASK) >>
-			BNXT_DEFAULT_VNIC_CHANGE_PF_ID_SFT;
-	fid = BNXT_PF(bp) ? bp->fw_fid : bp->parent->fid;
-	if (parent_id != fid || !bp->rep_info)
+	if (!bp->rep_info)
 		return;
 
 	vf_fid = (event_data & BNXT_DEFAULT_VNIC_CHANGE_VF_ID_MASK) >>
Signature · 1 line
2.7.4
#14 lore raw

PATCH v2 1/12 net/bnxt: fix the corruption of the session details

In reply to Somnath Kotur

From: Kishore Padmanabha <[email protected]>

The session details that is shared among multiple ports need to be outside the bnxt structure.

Fixes 70e64b27af5b ("net/bnxt: support ULP session manager cleanup")
---
 drivers/net/bnxt/tf_ulp/bnxt_ulp.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/net/bnxt/tf_ulp/bnxt_ulp.c +4 -1
index 289619411..a4d48c71a 100644
@@ -159,7 +159,9 @@ ulp_ctx_session_open(struct bnxt *bp,
 	}
 	if (!session->session_opened) {
 		session->session_opened = 1;
-		session->g_tfp = &bp->tfp;
+		session->g_tfp = rte_zmalloc("bnxt_ulp_session_tfp",
+					     sizeof(struct tf), 0);
+		session->g_tfp->session = bp->tfp.session;
 	}
 	return rc;
 }
@@ -176,6 +178,7 @@ ulp_ctx_session_close(struct bnxt *bp,
 	if (session->session_opened)
 		tf_close_session(&bp->tfp);
 	session->session_opened = 0;
+	rte_free(session->g_tfp);
 	session->g_tfp = NULL;
 }
 
Signature · 1 line
2.21.1 (Apple Git-122.3)
#15 lore raw

v2 cover bnxt patches

In reply to Somnath Kotur

Fixes and enchancements in the bnxt PMD, mostly in the TRUFLOW layer, including templates to add support for Stingray device.

v2:
- squashed patch patch 13 to patch 7
- updated and fixed commit logs
- updated docs and release notes where necessary

Kishore Padmanabha (4):
net/bnxt: fix the corruption of the session details net/bnxt: combine default and regular flows net/bnxt: add support for parent child flow database net/bnxt: add parent child flow create and free

Mike Baucom (6):
net/bnxt: add multi-device infrastructure net/bnxt: add Stingray device support to ULP net/bnxt: consolidate template table processing net/bnxt: support runtime EM selection net/bnxt: consolidate template table processing net/bnxt: remove flow db table type from templates

Venkat Duvvuru (2):
net/bnxt: fix PMD PF support in SR-IOV mode net/bnxt: handle default vnic change async event

 doc/guides/nics/bnxt.rst                      |    42 +
 doc/guides/rel_notes/release_20_11.rst        |     1 +
 drivers/net/bnxt/bnxt.h                       |     6 +-
 drivers/net/bnxt/bnxt_cpr.c                   |    13 +-
 drivers/net/bnxt/bnxt_ethdev.c                |    40 +-
 drivers/net/bnxt/bnxt_hwrm.c                  |   463 +-
 drivers/net/bnxt/bnxt_hwrm.h                  |    12 +-
 drivers/net/bnxt/meson.build                  |     4 +
 drivers/net/bnxt/tf_ulp/bnxt_ulp.c            |   387 +-
 drivers/net/bnxt/tf_ulp/bnxt_ulp.h            |    11 +
 drivers/net/bnxt/tf_ulp/bnxt_ulp_flow.c       |     5 +-
 drivers/net/bnxt/tf_ulp/ulp_def_rules.c       |     5 +-
 drivers/net/bnxt/tf_ulp/ulp_fc_mgr.c          |     2 +-
 drivers/net/bnxt/tf_ulp/ulp_flow_db.c         |   892 +-
 drivers/net/bnxt/tf_ulp/ulp_flow_db.h         |   179 +-
 drivers/net/bnxt/tf_ulp/ulp_mapper.c          |   520 +-
 drivers/net/bnxt/tf_ulp/ulp_mapper.h          |    22 +-
 drivers/net/bnxt/tf_ulp/ulp_template_db_act.c |  1810 --
 .../net/bnxt/tf_ulp/ulp_template_db_class.c   | 16271 -------------
 .../net/bnxt/tf_ulp/ulp_template_db_enum.h    |    18 +-
 .../tf_ulp/ulp_template_db_stingray_act.c     |  3305 +++
 .../tf_ulp/ulp_template_db_stingray_class.c   | 19005 ++++++++++++++++
 drivers/net/bnxt/tf_ulp/ulp_template_db_tbl.c |    59 +-
 drivers/net/bnxt/tf_ulp/ulp_template_db_tbl.h |    48 +
 .../bnxt/tf_ulp/ulp_template_db_wh_plus_act.c |  3304 +++
 .../tf_ulp/ulp_template_db_wh_plus_class.c    | 19005 ++++++++++++++++
 drivers/net/bnxt/tf_ulp/ulp_template_struct.h |    64 +-
 drivers/net/bnxt/tf_ulp/ulp_utils.h           |     4 +
 28 files changed, 46530 insertions(+), 18967 deletions(-)
 create mode 100644 drivers/net/bnxt/tf_ulp/ulp_template_db_stingray_act.c
 create mode 100644 drivers/net/bnxt/tf_ulp/ulp_template_db_stingray_class.c
 create mode 100644 drivers/net/bnxt/tf_ulp/ulp_template_db_tbl.h
 create mode 100644 drivers/net/bnxt/tf_ulp/ulp_template_db_wh_plus_act.c
 create mode 100644 drivers/net/bnxt/tf_ulp/ulp_template_db_wh_plus_class.c
Signature · 1 line
2.21.1 (Apple Git-122.3)
#16 lore raw

PATCH v2 3/12 net/bnxt: add Stingray device support to ULP

In reply to Somnath Kotur

From: Mike Baucom <[email protected]>

- Add new template files for Stingray
- Add new TRUFLOW resources for Stingray

---
 doc/guides/nics/bnxt.rst                      |    29 +
 doc/guides/rel_notes/release_20_11.rst        |     1 +
 drivers/net/bnxt/meson.build                  |     2 +
 drivers/net/bnxt/tf_ulp/bnxt_ulp.c            |    81 +-
 .../tf_ulp/ulp_template_db_stingray_act.c     |  1813 ++
 .../tf_ulp/ulp_template_db_stingray_class.c   | 16258 ++++++++++++++++
 drivers/net/bnxt/tf_ulp/ulp_template_db_tbl.h |    19 +
 7 files changed, 18202 insertions(+), 1 deletion(-)
 create mode 100644 drivers/net/bnxt/tf_ulp/ulp_template_db_stingray_act.c
 create mode 100644 drivers/net/bnxt/tf_ulp/ulp_template_db_stingray_class.c
doc/guides/nics/bnxt.rst +29 -0
index 129a16cfc..553f57178 100644
@@ -734,6 +734,35 @@ Note that currently hot-plugging of representor ports is not supported so all
 the required representors must be specified on the creation of the PF or the
 trusted VF.
 
+Representors on Stingray SoC
+----------------------------
+A representor created on X86 host typically represents a VF running in the same
+X86 domain. But in case of the SoC, the application can run on the CPU complex
+inside the SoC. The representor can be created on the SoC to represent a PF or a
+VF running in the x86 domain. Since the representator creation requires passing
+the bus:device.function of the PCI device endpoint which is not necessarily in the
+same host domain, additional dev args have been added to the PMD.
+
+* rep_is_vf - false to indicate VF representor
+* rep_is_pf - true to indicate PF representor
+* rep_based_pf - Physical index of the PF
+* rep_q_r2f - Logical COS Queue index for the rep to endpoint direction
+* rep_q_f2r - Logical COS Queue index for the endpoint to rep direction
+* rep_fc_r2f - Flow control for the representor to endpoint direction
+* rep_fc_f2r - Flow control for the endpoint to representor direction
+
+The sample command line with the new ``devargs`` looks like this::
+
+  -w 0000:06:02.0,host-based-truflow=1,representor=[1],rep-based-pf=8,\
+	rep-is-pf=1,rep-q-r2f=1,rep-fc-r2f=0,rep-q-f2r=1,rep-fc-f2r=1
+
+.. code-block:: console
+
+	testpmd -l1-4 -n2 -w 0008:01:00.0,host-based-truflow=1,\
+	representor=[0], rep-based-pf=8,rep-is-pf=0,rep-q-r2f=1,rep-fc-r2f=1,\
+	rep-q-f2r=0,rep-fc-f2r=1 --log-level="pmd.*",8 -- -i --rxq=3 --txq=3
+
+
 Application Support
 -------------------
 
doc/guides/rel_notes/release_20_11.rst +1 -0
index 26cc0949a..ee97bb7c3 100644
@@ -67,6 +67,7 @@ New Features
   * Added support for 200G PAM4 link speed.
   * Added support for RSS hash level selection.
   * Updated HWRM structures to 1.10.1.70 version.
+  * Added TRUFLOW support for Stingray devices.
 
 * **Updated Cisco enic driver.**
 
drivers/net/bnxt/meson.build +2 -0
index b00da6074..39521080f 100644
@@ -66,6 +66,8 @@ sources = files('bnxt_cpr.c',
 	'tf_ulp/ulp_fc_mgr.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',
+	'tf_ulp/ulp_template_db_stingray_class.c',
 
 	'rte_pmd_bnxt.c')
 
drivers/net/bnxt/tf_ulp/bnxt_ulp.c +80 -1

103 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_template_db_stingray_act.c new file +1813 -0

1,813 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_template_db_stingray_class.c new file +16258 -0

1,034 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_template_db_tbl.h +19 -0
index 55c33851d..93f87f32b 100644

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

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

Signature · 1 line
2.21.1 (Apple Git-122.3)

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

#17 lore raw

PATCH v2 4/12 net/bnxt: fix PMD PF support in SR-IOV mode

In reply to Somnath Kotur

From: Venkat Duvvuru <[email protected]>

1. Implement HWRM_FUNC_VF_RESOURCE_CFG command and use it to reserve resources for VFs when NEW RM is enabled.
2. Invoke PF’s FUNC_CFG before configuring VFs resources.
3. Don’t consider max_rx_em_flows in max_l2_ctx calculation when VFs are configured.
4. Issue HWRM_FUNC_QCFG instead of HWRM_FUNC_QCAPS to find out the actual allocated resources for VF.
5. Don’t add random mac to the VF.
6. Handle completion type CMPL_BASE_TYPE_HWRM_FWD_REQ instead of CMPL_BASE_TYPE_HWRM_FWD_RESP.
7. Don't enable HWRM_FUNC_DRV_RGTR_INPUT_FLAGS_FWD_NONE_MODE when the list of HWRM commands that needs to be forwarded to the PF is specified in HWRM_FUNC_DRV_RGTR.
8. Update the HWRM commands list that can be forwared to the PF.

Fixes b7778e8a1c00 ("net/bnxt: refactor to properly allocate resources for PF/VF")
---
 drivers/net/bnxt/bnxt.h        |   6 +-
 drivers/net/bnxt/bnxt_cpr.c    |   6 +-
 drivers/net/bnxt/bnxt_ethdev.c |  40 +--
 drivers/net/bnxt/bnxt_hwrm.c   | 461 ++++++++++++++++++++-------------
 drivers/net/bnxt/bnxt_hwrm.h   |  12 +-
 5 files changed, 309 insertions(+), 216 deletions(-)
drivers/net/bnxt/bnxt.h +5 -1
index eca74486e..a951bca7a 100644
@@ -167,6 +167,9 @@
 #define	BNXT_DEFAULT_VNIC_CHANGE_VF_ID_SFT		\
 	HWRM_ASYNC_EVENT_CMPL_DEFAULT_VNIC_CHANGE_EVENT_DATA1_VF_ID_SFT
 
+#define BNXT_HWRM_CMD_TO_FORWARD(cmd)	\
+		(bp->pf->vf_req_fwd[(cmd) / 32] |= (1 << ((cmd) % 32)))
+
 struct bnxt_led_info {
 	uint8_t	     num_leds;
 	uint8_t      led_id;
@@ -664,9 +667,10 @@ struct bnxt {
 #define BNXT_FW_CAP_IF_CHANGE		BIT(1)
 #define BNXT_FW_CAP_ERROR_RECOVERY	BIT(2)
 #define BNXT_FW_CAP_ERR_RECOVER_RELOAD	BIT(3)
+#define BNXT_FW_CAP_HCOMM_FW_STATUS	BIT(4)
 #define BNXT_FW_CAP_ADV_FLOW_MGMT	BIT(5)
 #define BNXT_FW_CAP_ADV_FLOW_COUNTERS	BIT(6)
-#define BNXT_FW_CAP_HCOMM_FW_STATUS	BIT(7)
+#define BNXT_FW_CAP_LINK_ADMIN		BIT(7)
 
 	pthread_mutex_t         flow_lock;
 
drivers/net/bnxt/bnxt_cpr.c +4 -2
index a3a7e6ab7..54923948f 100644
@@ -239,7 +239,7 @@ void bnxt_handle_fwd_req(struct bnxt *bp, struct cmpl_base *cmpl)
 		goto reject;
 	}
 
-	if (bnxt_rcv_msg_from_vf(bp, vf_id, fwd_cmd) == true) {
+	if (bnxt_rcv_msg_from_vf(bp, vf_id, fwd_cmd)) {
 		/*
 		 * In older firmware versions, the MAC had to be all zeros for
 		 * the VF to set it's MAC via hwrm_func_vf_cfg. Set to all
@@ -254,6 +254,7 @@ void bnxt_handle_fwd_req(struct bnxt *bp, struct cmpl_base *cmpl)
 				(const uint8_t *)"\x00\x00\x00\x00\x00");
 			}
 		}
+
 		if (fwd_cmd->req_type == HWRM_CFA_L2_SET_RX_MASK) {
 			struct hwrm_cfa_l2_set_rx_mask_input *srm =
 							(void *)fwd_cmd;
@@ -265,6 +266,7 @@ void bnxt_handle_fwd_req(struct bnxt *bp, struct cmpl_base *cmpl)
 			    HWRM_CFA_L2_SET_RX_MASK_INPUT_MASK_VLAN_NONVLAN |
 			    HWRM_CFA_L2_SET_RX_MASK_INPUT_MASK_ANYVLAN_NONVLAN);
 		}
+
 		/* Forward */
 		rc = bnxt_hwrm_exec_fwd_resp(bp, fw_vf_id, fwd_cmd, req_len);
 		if (rc) {
@@ -306,7 +308,7 @@ int bnxt_event_hwrm_resp_handler(struct bnxt *bp, struct cmpl_base *cmp)
 		bnxt_handle_async_event(bp, cmp);
 		evt = 1;
 		break;
-	case CMPL_BASE_TYPE_HWRM_FWD_RESP:
+	case CMPL_BASE_TYPE_HWRM_FWD_REQ:
 		/* Handle HWRM forwarded responses */
 		bnxt_handle_fwd_req(bp, cmp);
 		evt = 1;
drivers/net/bnxt/bnxt_ethdev.c +10 -30
index 8b63134c3..b4654ec6a 100644
@@ -5208,37 +5208,14 @@ static void bnxt_config_vf_req_fwd(struct bnxt *bp)
 	if (!BNXT_PF(bp))
 		return;
 
-#define ALLOW_FUNC(x)	\
-	{ \
-		uint32_t arg = (x); \
-		bp->pf->vf_req_fwd[((arg) >> 5)] &= \
-		~rte_cpu_to_le_32(1 << ((arg) & 0x1f)); \
-	}
-
-	/* Forward all requests if firmware is new enough */
-	if (((bp->fw_ver >= ((20 << 24) | (6 << 16) | (100 << 8))) &&
-	     (bp->fw_ver < ((20 << 24) | (7 << 16)))) ||
-	    ((bp->fw_ver >= ((20 << 24) | (8 << 16))))) {
-		memset(bp->pf->vf_req_fwd, 0xff, sizeof(bp->pf->vf_req_fwd));
-	} else {
-		PMD_DRV_LOG(WARNING,
-			    "Firmware too old for VF mailbox functionality\n");
-		memset(bp->pf->vf_req_fwd, 0, sizeof(bp->pf->vf_req_fwd));
-	}
+	memset(bp->pf->vf_req_fwd, 0, sizeof(bp->pf->vf_req_fwd));
 
-	/*
-	 * The following are used for driver cleanup. If we disallow these,
-	 * VF drivers can't clean up cleanly.
-	 */
-	ALLOW_FUNC(HWRM_FUNC_DRV_UNRGTR);
-	ALLOW_FUNC(HWRM_VNIC_FREE);
-	ALLOW_FUNC(HWRM_RING_FREE);
-	ALLOW_FUNC(HWRM_RING_GRP_FREE);
-	ALLOW_FUNC(HWRM_VNIC_RSS_COS_LB_CTX_FREE);
-	ALLOW_FUNC(HWRM_CFA_L2_FILTER_FREE);
-	ALLOW_FUNC(HWRM_STAT_CTX_FREE);
-	ALLOW_FUNC(HWRM_PORT_PHY_QCFG);
-	ALLOW_FUNC(HWRM_VNIC_TPA_CFG);
+	if (!(bp->fw_cap & BNXT_FW_CAP_LINK_ADMIN))
+		BNXT_HWRM_CMD_TO_FORWARD(HWRM_PORT_PHY_QCFG);
+	BNXT_HWRM_CMD_TO_FORWARD(HWRM_FUNC_CFG);
+	BNXT_HWRM_CMD_TO_FORWARD(HWRM_FUNC_VF_CFG);
+	BNXT_HWRM_CMD_TO_FORWARD(HWRM_CFA_L2_FILTER_ALLOC);
+	BNXT_HWRM_CMD_TO_FORWARD(HWRM_OEM_CMD);
 }
 
 uint16_t
@@ -6189,7 +6166,10 @@ bnxt_uninit_resources(struct bnxt *bp, bool reconfig_dev)
 
 	bnxt_free_int(bp);
 	bnxt_free_mem(bp, reconfig_dev);
+
 	bnxt_hwrm_func_buf_unrgtr(bp);
+	rte_free(bp->pf->vf_req_buf);
+
 	rc = bnxt_hwrm_func_driver_unregister(bp, 0);
 	bp->flags &= ~BNXT_FLAG_REGISTERED;
 	bnxt_free_ctx_mem(bp);
drivers/net/bnxt/bnxt_hwrm.c +279 -182

632 lines not on this page · raw message

drivers/net/bnxt/bnxt_hwrm.h +11 -1
index e98b1fe41..a7fa7f66b 100644
@@ -107,6 +107,16 @@ enum bnxt_flow_dir {
 	BNXT_DIR_MAX
 };
 
+struct bnxt_pf_resource_info {
+	uint16_t num_rsscos_ctxs;
+	uint16_t num_stat_ctxs;
+	uint16_t num_tx_rings;
+	uint16_t num_rx_rings;
+	uint16_t num_cp_rings;
+	uint16_t num_l2_ctxs;
+	uint32_t num_hw_ring_grps;
+};
+
 #define BNXT_CTX_VAL_INVAL	0xFFFF
 
 int bnxt_hwrm_cfa_l2_clear_rx_mask(struct bnxt *bp,
@@ -127,7 +137,7 @@ int bnxt_hwrm_exec_fwd_resp(struct bnxt *bp, uint16_t target_id,
 int bnxt_hwrm_reject_fwd_resp(struct bnxt *bp, uint16_t target_id,
 			      void *encaped, size_t ec_size);
 
-int bnxt_hwrm_func_buf_rgtr(struct bnxt *bp);
+int bnxt_hwrm_func_buf_rgtr(struct bnxt *bp, int num_vfs);
 int bnxt_hwrm_func_buf_unrgtr(struct bnxt *bp);
 int bnxt_hwrm_func_driver_register(struct bnxt *bp);
 int bnxt_hwrm_func_qcaps(struct bnxt *bp);
Signature · 1 line
2.21.1 (Apple Git-122.3)
#18 lore raw

PATCH v2 5/12 net/bnxt: consolidate template table processing

In reply to Somnath Kotur

From: Mike Baucom <[email protected]>

The table processing has been consolidated to be able to reuse the same code for action and classification template processing.

---
 drivers/net/bnxt/tf_ulp/bnxt_ulp_flow.c       |   1 +
 drivers/net/bnxt/tf_ulp/ulp_def_rules.c       |   1 +
 drivers/net/bnxt/tf_ulp/ulp_mapper.c          | 298 +++++-------------
 drivers/net/bnxt/tf_ulp/ulp_mapper.h          |   4 +-
 .../net/bnxt/tf_ulp/ulp_template_db_enum.h    |   6 +
 .../tf_ulp/ulp_template_db_stingray_class.c   |   2 +-
 drivers/net/bnxt/tf_ulp/ulp_template_db_tbl.c |  56 +++-
 drivers/net/bnxt/tf_ulp/ulp_template_db_tbl.h |   4 +-
 .../tf_ulp/ulp_template_db_wh_plus_class.c    |   2 +-
 drivers/net/bnxt/tf_ulp/ulp_template_struct.h |  11 +-
 10 files changed, 144 insertions(+), 241 deletions(-)
drivers/net/bnxt/tf_ulp/bnxt_ulp_flow.c +1 -0
index 566e1254a..eea39f6b7 100644
@@ -147,6 +147,7 @@ bnxt_ulp_flow_create(struct rte_eth_dev *dev,
 	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;
 
 	/* Get the function id */
 	if (ulp_port_db_port_func_id_get(ulp_ctx,
drivers/net/bnxt/tf_ulp/ulp_def_rules.c +1 -0
index 8dea235f0..01f4fd087 100644
@@ -351,6 +351,7 @@ ulp_default_flow_create(struct rte_eth_dev *eth_dev,
 	}
 
 	mapper_params.class_tid = ulp_class_tid;
+	mapper_params.flow_type = BNXT_ULP_FDB_TYPE_DEFAULT;
 
 	rc = ulp_mapper_flow_create(ulp_ctx, &mapper_params, flow_id);
 	if (rc) {
drivers/net/bnxt/tf_ulp/ulp_mapper.c +79 -219

491 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_mapper.h +3 -1
index a19fb0d76..936fb9af4 100644
@@ -53,6 +53,7 @@ struct bnxt_ulp_mapper_data {
 
 /* Internal Structure for passing the arguments around */
 struct bnxt_ulp_mapper_parms {
+	enum bnxt_ulp_template_type		tmpl_type;
 	uint32_t				dev_id;
 	uint32_t				act_tid;
 	struct bnxt_ulp_mapper_tbl_info		*atbls; /* action table */
@@ -70,7 +71,7 @@ struct bnxt_ulp_mapper_parms {
 	struct bnxt_ulp_context			*ulp_ctx;
 	uint8_t					encap_byte_swap;
 	uint32_t				fid;
-	enum bnxt_ulp_flow_db_tables		tbl_idx;
+	enum bnxt_ulp_fdb_type			flow_type;
 	struct bnxt_ulp_mapper_data		*mapper_data;
 	enum bnxt_ulp_cache_table_opc		tcam_tbl_opc;
 	struct bnxt_ulp_mapper_cache_entry	*cache_ptr;
@@ -88,6 +89,7 @@ struct bnxt_ulp_mapper_create_parms {
 	uint32_t			act_tid;
 	uint16_t			func_id;
 	uint32_t			dir_attr;
+	enum bnxt_ulp_fdb_type		flow_type;
 };
 
 /* Function to initialize any dynamic mapper data. */
drivers/net/bnxt/tf_ulp/ulp_template_db_enum.h +6 -0
index de56b7ef9..e083af0ae 100644
@@ -278,6 +278,12 @@ enum bnxt_ulp_search_before_alloc {
 	BNXT_ULP_SEARCH_BEFORE_ALLOC_LAST = 3
 };
 
+enum bnxt_ulp_template_type {
+	BNXT_ULP_TEMPLATE_TYPE_CLASS = 0,
+	BNXT_ULP_TEMPLATE_TYPE_ACTION = 1,
+	BNXT_ULP_TEMPLATE_TYPE_LAST = 2
+};
+
 enum bnxt_ulp_fdb_resource_flags {
 	BNXT_ULP_FDB_RESOURCE_FLAGS_DIR_INGR = 0x00,
 	BNXT_ULP_FDB_RESOURCE_FLAGS_DIR_EGR = 0x01
drivers/net/bnxt/tf_ulp/ulp_template_db_stingray_class.c +1 -1
index 2d40cde8e..f365c5c5b 100644
@@ -15980,7 +15980,7 @@ struct bnxt_ulp_mapper_result_field_info ulp_class_stingray_result_field_list[]
 	}
 };
 
-struct bnxt_ulp_mapper_ident_info ulp_stingray_ident_list[] = {
+struct bnxt_ulp_mapper_ident_info ulp_class_stingray_ident_list[] = {
 	{
 	.resource_func = BNXT_ULP_RESOURCE_FUNC_IDENTIFIER,
 	.ident_type = TF_IDENT_TYPE_L2_CTXT_HIGH,
drivers/net/bnxt/tf_ulp/ulp_template_db_tbl.c +46 -10

68 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_template_db_tbl.h +2 -2
index 93f87f32b..7a541cb8e 100644
@@ -18,7 +18,7 @@ bnxt_ulp_mapper_class_key_field_info ulp_class_wh_plus_key_field_list[];
 extern struct
 bnxt_ulp_mapper_result_field_info ulp_class_wh_plus_result_field_list[];
 
-extern struct bnxt_ulp_mapper_ident_info ulp_wh_plus_ident_list[];
+extern struct bnxt_ulp_mapper_ident_info ulp_class_wh_plus_ident_list[];
 
 extern struct bnxt_ulp_mapper_tbl_list_info ulp_act_wh_plus_tmpl_list[];
 
@@ -37,7 +37,7 @@ bnxt_ulp_mapper_class_key_field_info ulp_class_stingray_key_field_list[];
 extern struct
 bnxt_ulp_mapper_result_field_info ulp_class_stingray_result_field_list[];
 
-extern struct bnxt_ulp_mapper_ident_info ulp_stingray_ident_list[];
+extern struct bnxt_ulp_mapper_ident_info ulp_class_stingray_ident_list[];
 
 extern struct bnxt_ulp_mapper_tbl_list_info ulp_act_stingray_tmpl_list[];
 
drivers/net/bnxt/tf_ulp/ulp_template_db_wh_plus_class.c +1 -1
index 10160f821..b747241cd 100644
@@ -15980,7 +15980,7 @@ struct bnxt_ulp_mapper_result_field_info ulp_class_wh_plus_result_field_list[] =
 	}
 };
 
-struct bnxt_ulp_mapper_ident_info ulp_wh_plus_ident_list[] = {
+struct bnxt_ulp_mapper_ident_info ulp_class_wh_plus_ident_list[] = {
 	{
 	.resource_func = BNXT_ULP_RESOURCE_FUNC_IDENTIFIER,
 	.ident_type = TF_IDENT_TYPE_L2_CTXT_HIGH,
drivers/net/bnxt/tf_ulp/ulp_template_struct.h +4 -7
index 621ccce15..026c42d1c 100644
@@ -142,14 +142,11 @@ extern struct bnxt_ulp_act_match_info ulp_act_match_list[];
 
 /* Device Specific Tables for mapper */
 struct ulp_template_device_tbls {
-	struct bnxt_ulp_mapper_tbl_list_info *class_tmpl_list;
-	struct bnxt_ulp_mapper_tbl_info *class_tbl_list;
-	struct bnxt_ulp_mapper_class_key_field_info *class_key_field_list;
-	struct bnxt_ulp_mapper_result_field_info *class_result_field_list;
+	struct bnxt_ulp_mapper_tbl_list_info *tmpl_list;
+	struct bnxt_ulp_mapper_tbl_info *tbl_list;
+	struct bnxt_ulp_mapper_class_key_field_info *key_field_list;
+	struct bnxt_ulp_mapper_result_field_info *result_field_list;
 	struct bnxt_ulp_mapper_ident_info *ident_list;
-	struct bnxt_ulp_mapper_tbl_list_info *act_tmpl_list;
-	struct bnxt_ulp_mapper_tbl_info *act_tbl_list;
-	struct bnxt_ulp_mapper_result_field_info *act_result_field_list;
 };
 
 /* Device specific parameters */
Signature · 1 line
2.21.1 (Apple Git-122.3)
#19 lore raw

PATCH v2 6/12 net/bnxt: combine default and regular flows

In reply to Somnath Kotur

From: Kishore Padmanabha <[email protected]>

The default and regular flows are stored in the same flow table instead of different flow tables. This should help code reuse and reducing the number of allocations.
So combine default and regular flows in flow database.

---
 drivers/net/bnxt/tf_ulp/bnxt_ulp.c      |   2 +-
 drivers/net/bnxt/tf_ulp/bnxt_ulp_flow.c |   4 +-
 drivers/net/bnxt/tf_ulp/ulp_def_rules.c |   4 +-
 drivers/net/bnxt/tf_ulp/ulp_fc_mgr.c    |   2 +-
 drivers/net/bnxt/tf_ulp/ulp_flow_db.c   | 423 +++++++++++-------------
 drivers/net/bnxt/tf_ulp/ulp_flow_db.h   |  75 ++---
 drivers/net/bnxt/tf_ulp/ulp_mapper.c    |  33 +-
 drivers/net/bnxt/tf_ulp/ulp_mapper.h    |  11 +-
 8 files changed, 259 insertions(+), 295 deletions(-)
drivers/net/bnxt/tf_ulp/bnxt_ulp.c +1 -1
index eeda2d033..9ed92a88d 100644
@@ -853,7 +853,7 @@ bnxt_ulp_deinit(struct bnxt *bp,
 	bnxt_ulp_destroy_vfr_default_rules(bp, true);
 
 	/* clean up regular flows */
-	ulp_flow_db_flush_flows(bp->ulp_ctx, BNXT_ULP_REGULAR_FLOW_TABLE);
+	ulp_flow_db_flush_flows(bp->ulp_ctx, BNXT_ULP_FDB_TYPE_REGULAR);
 
 	/* cleanup the eem table scope */
 	ulp_eem_tbl_scope_deinit(bp, bp->ulp_ctx);
drivers/net/bnxt/tf_ulp/bnxt_ulp_flow.c +2 -2
index eea39f6b7..c7b29824e 100644
@@ -281,8 +281,8 @@ bnxt_ulp_flow_destroy(struct rte_eth_dev *dev,
 		return -EINVAL;
 	}
 
-	ret = ulp_mapper_flow_destroy(ulp_ctx, flow_id,
-				      BNXT_ULP_REGULAR_FLOW_TABLE);
+	ret = ulp_mapper_flow_destroy(ulp_ctx, BNXT_ULP_FDB_TYPE_REGULAR,
+				      flow_id);
 	if (ret) {
 		BNXT_TF_DBG(ERR, "Failed to destroy flow.\n");
 		if (error)
drivers/net/bnxt/tf_ulp/ulp_def_rules.c +2 -2
index 01f4fd087..c36d4d4c4 100644
@@ -391,8 +391,8 @@ ulp_default_flow_destroy(struct rte_eth_dev *eth_dev, uint32_t flow_id)
 		return rc;
 	}
 
-	rc = ulp_mapper_flow_destroy(ulp_ctx, flow_id,
-				     BNXT_ULP_DEFAULT_FLOW_TABLE);
+	rc = ulp_mapper_flow_destroy(ulp_ctx, BNXT_ULP_FDB_TYPE_DEFAULT,
+				     flow_id);
 	if (rc)
 		BNXT_TF_DBG(ERR, "Failed to destroy flow.\n");
 
drivers/net/bnxt/tf_ulp/ulp_fc_mgr.c +1 -1
index 5a0bf602a..051ebac04 100644
@@ -561,7 +561,7 @@ int ulp_fc_mgr_query_count_get(struct bnxt_ulp_context *ctxt,
 
 	do {
 		rc = ulp_flow_db_resource_get(ctxt,
-					      BNXT_ULP_REGULAR_FLOW_TABLE,
+					      BNXT_ULP_FDB_TYPE_REGULAR,
 					      flow_id,
 					      &nxt_resource_index,
 					      &params);
drivers/net/bnxt/tf_ulp/ulp_flow_db.c +198 -225

748 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_flow_db.h +32 -43

133 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_mapper.c +17 -16
index 5ed481ab3..0f55f4f75 100644
@@ -2482,12 +2482,12 @@ ulp_mapper_resource_free(struct bnxt_ulp_context *ulp,
 }
 
 int32_t
-ulp_mapper_resources_free(struct bnxt_ulp_context	*ulp_ctx,
-			  uint32_t fid,
-			  enum bnxt_ulp_flow_db_tables	tbl_type)
+ulp_mapper_resources_free(struct bnxt_ulp_context *ulp_ctx,
+			  enum bnxt_ulp_fdb_type flow_type,
+			  uint32_t fid)
 {
-	struct ulp_flow_db_res_params	res_parms = { 0 };
-	int32_t				rc, trc;
+	struct ulp_flow_db_res_params res_parms = { 0 };
+	int32_t rc, trc;
 
 	if (!ulp_ctx) {
 		BNXT_TF_DBG(ERR, "Invalid parms, unable to free flow\n");
@@ -2499,7 +2499,7 @@ ulp_mapper_resources_free(struct bnxt_ulp_context	*ulp_ctx,
 	 * while status is good
 	 */
 	res_parms.critical_resource = BNXT_ULP_CRITICAL_RESOURCE_YES;
-	rc = ulp_flow_db_resource_del(ulp_ctx, tbl_type, fid, &res_parms);
+	rc = ulp_flow_db_resource_del(ulp_ctx, flow_type, fid, &res_parms);
 
 	if (rc) {
 		/*
@@ -2507,7 +2507,7 @@ ulp_mapper_resources_free(struct bnxt_ulp_context	*ulp_ctx,
 		 * It likely means that the flow did not exist in the flow db.
 		 */
 		BNXT_TF_DBG(ERR, "Flow[%d][0x%08x] failed to free (rc=%d)\n",
-			    tbl_type, fid, rc);
+			    flow_type, fid, rc);
 		return rc;
 	}
 
@@ -2521,20 +2521,20 @@ ulp_mapper_resources_free(struct bnxt_ulp_context	*ulp_ctx,
 			BNXT_TF_DBG(ERR,
 				    "Flow[%d][0x%x] Res[%d][0x%016" PRIx64
 				    "] failed rc=%d.\n",
-				    tbl_type, fid, res_parms.resource_func,
+				    flow_type, fid, res_parms.resource_func,
 				    res_parms.resource_hndl, trc);
 
 		/* All subsequent call require the non-critical_resource */
 		res_parms.critical_resource = BNXT_ULP_CRITICAL_RESOURCE_NO;
 
 		rc = ulp_flow_db_resource_del(ulp_ctx,
-					      tbl_type,
+					      flow_type,
 					      fid,
 					      &res_parms);
 	}
 
 	/* Free the Flow ID since we've removed all resources */
-	rc = ulp_flow_db_fid_free(ulp_ctx, tbl_type, fid);
+	rc = ulp_flow_db_fid_free(ulp_ctx, flow_type, fid);
 
 	return rc;
 }
@@ -2568,8 +2568,9 @@ ulp_mapper_glb_resource_info_deinit(struct bnxt_ulp_context *ulp_ctx,
 }
 
 int32_t
-ulp_mapper_flow_destroy(struct bnxt_ulp_context	*ulp_ctx, uint32_t fid,
-			enum bnxt_ulp_flow_db_tables flow_tbl_type)
+ulp_mapper_flow_destroy(struct bnxt_ulp_context *ulp_ctx,
+			enum bnxt_ulp_fdb_type flow_type,
+			uint32_t fid)
 {
 	int32_t rc;
 
@@ -2582,7 +2583,7 @@ ulp_mapper_flow_destroy(struct bnxt_ulp_context	*ulp_ctx, uint32_t fid,
 		return -EINVAL;
 	}
 
-	rc = ulp_mapper_resources_free(ulp_ctx, fid, flow_tbl_type);
+	rc = ulp_mapper_resources_free(ulp_ctx, flow_type, fid);
 	bnxt_ulp_cntxt_release_fdb_lock(ulp_ctx);
 	return rc;
 
@@ -2624,7 +2625,7 @@ ulp_mapper_glb_template_table_init(struct bnxt_ulp_context *ulp_ctx)
 		parms.ulp_ctx = ulp_ctx;
 		parms.dev_id = dev_id;
 		parms.mapper_data = mapper_data;
-		parms.flow_type = BNXT_ULP_DEFAULT_FLOW_TABLE;
+		parms.flow_type = BNXT_ULP_FDB_TYPE_DEFAULT;
 		parms.tmpl_type = BNXT_ULP_TEMPLATE_TYPE_CLASS;
 
 		/* Get the class table entry from dev id and class id */
@@ -2758,8 +2759,8 @@ ulp_mapper_flow_create(struct bnxt_ulp_context *ulp_ctx,
 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, parms.fid,
-				      BNXT_ULP_REGULAR_FLOW_TABLE);
+	trc = ulp_mapper_flow_destroy(ulp_ctx, BNXT_ULP_FDB_TYPE_REGULAR,
+				      parms.fid);
 	if (trc)
 		BNXT_TF_DBG(ERR, "Failed to free all resources rc=%d\n", trc);
 
drivers/net/bnxt/tf_ulp/ulp_mapper.h +6 -5
index 936fb9af4..6f93bcdc1 100644
@@ -111,16 +111,17 @@ ulp_mapper_flow_create(struct bnxt_ulp_context	*ulp_ctx,
 
 /* Function that frees all resources associated with the flow. */
 int32_t
-ulp_mapper_flow_destroy(struct bnxt_ulp_context	*ulp_ctx, uint32_t fid,
-			enum bnxt_ulp_flow_db_tables flow_tbl_type);
+ulp_mapper_flow_destroy(struct bnxt_ulp_context *ulp_ctx,
+			enum bnxt_ulp_fdb_type flow_type,
+			uint32_t fid);
 
 /*
  * Function that frees all resources and can be called on default or regular
  * flows
  */
 int32_t
-ulp_mapper_resources_free(struct bnxt_ulp_context	*ulp_ctx,
-			  uint32_t fid,
-			  enum bnxt_ulp_flow_db_tables	tbl_type);
+ulp_mapper_resources_free(struct bnxt_ulp_context *ulp_ctx,
+			  enum bnxt_ulp_fdb_type flow_type,
+			  uint32_t fid);
 
 #endif /* _ULP_MAPPER_H_ */
Signature · 1 line
2.21.1 (Apple Git-122.3)
#20 lore raw

PATCH v2 7/12 net/bnxt: handle default vnic change async event

In reply to Somnath Kotur

From: Venkat Duvvuru <[email protected]>

Currently, we are only registering to this event if the function is a trusted VF. This patch extends it for PFs as well.

Fixes 322bd6e70272 ("net/bnxt: add port representor infrastructure")
---
 drivers/net/bnxt/bnxt_cpr.c  | 7 ++-----
 drivers/net/bnxt/bnxt_hwrm.c | 2 +-
 2 files changed, 3 insertions(+), 6 deletions(-)
drivers/net/bnxt/bnxt_cpr.c +2 -5
index 54923948f..91d1ffe46 100644
@@ -50,7 +50,7 @@ static void
 bnxt_process_default_vnic_change(struct bnxt *bp,
 				 struct hwrm_async_event_cmpl *async_cmp)
 {
-	uint16_t fid, vnic_state, parent_id, vf_fid, vf_id;
+	uint16_t vnic_state, vf_fid, vf_id;
 	struct bnxt_representor *vf_rep_bp;
 	struct rte_eth_dev *eth_dev;
 	bool vfr_found = false;
@@ -67,10 +67,7 @@ bnxt_process_default_vnic_change(struct bnxt *bp,
 	if (vnic_state != BNXT_DEFAULT_VNIC_ALLOC)
 		return;
 
-	parent_id = (event_data & BNXT_DEFAULT_VNIC_CHANGE_PF_ID_MASK) >>
-			BNXT_DEFAULT_VNIC_CHANGE_PF_ID_SFT;
-	fid = BNXT_PF(bp) ? bp->fw_fid : bp->parent->fid;
-	if (parent_id != fid || !bp->rep_info)
+	if (!bp->rep_info)
 		return;
 
 	vf_fid = (event_data & BNXT_DEFAULT_VNIC_CHANGE_VF_ID_MASK) >>
drivers/net/bnxt/bnxt_hwrm.c +1 -1
index 8133afc74..eef282b69 100644
@@ -938,7 +938,7 @@ int bnxt_hwrm_func_driver_register(struct bnxt *bp)
 		req.async_event_fwd[1] |=
 			rte_cpu_to_le_32(ASYNC_CMPL_EVENT_ID_DBG_NOTIFICATION);
 
-	if (BNXT_VF_IS_TRUSTED(bp))
+	if (BNXT_PF(bp) || BNXT_VF_IS_TRUSTED(bp))
 		req.async_event_fwd[1] |=
 		rte_cpu_to_le_32(ASYNC_CMPL_EVENT_ID_DEFAULT_VNIC_CHANGE);
 
Signature · 1 line
2.21.1 (Apple Git-122.3)
#21 lore raw

PATCH v2 8/12 net/bnxt: support runtime EM selection

In reply to Somnath Kotur

From: Mike Baucom <[email protected]>

This patch adds support to select internal Exact Match vs External Exact Match support while loading the PMD.
- Added new mem type conditional opcode for internal/external
- Adapted the flowdb resource counts based on selected mode
- Template changes to use the new opcode
- The decision for internal/external EM support is based on the devargs parameter max_num_kflows. If this is set, external EM is used.

---
 doc/guides/nics/bnxt.rst                      |   13 +
 drivers/net/bnxt/tf_ulp/bnxt_ulp.c            |   78 +-
 drivers/net/bnxt/tf_ulp/bnxt_ulp.h            |   11 +
 drivers/net/bnxt/tf_ulp/ulp_flow_db.c         |   16 +-
 drivers/net/bnxt/tf_ulp/ulp_mapper.c          |   48 +-
 .../net/bnxt/tf_ulp/ulp_template_db_enum.h    |    7 +
 .../tf_ulp/ulp_template_db_stingray_act.c     | 2282 +++++++++--
 .../tf_ulp/ulp_template_db_stingray_class.c   | 3646 +++++++++++++++--
 drivers/net/bnxt/tf_ulp/ulp_template_db_tbl.c |   48 +-
 .../bnxt/tf_ulp/ulp_template_db_wh_plus_act.c | 2281 +++++++++--
 .../tf_ulp/ulp_template_db_wh_plus_class.c    | 3390 +++++++++++++--
 drivers/net/bnxt/tf_ulp/ulp_template_struct.h |    5 +-
 12 files changed, 10241 insertions(+), 1584 deletions(-)
doc/guides/nics/bnxt.rst +13 -0
index 553f57178..74d90ba97 100644
@@ -762,6 +762,19 @@ The sample command line with the new ``devargs`` looks like this::
 	representor=[0], rep-based-pf=8,rep-is-pf=0,rep-q-r2f=1,rep-fc-r2f=1,\
 	rep-q-f2r=0,rep-fc-f2r=1 --log-level="pmd.*",8 -- -i --rxq=3 --txq=3
 
+Number of flows supported
+-------------------------
+The number of flows that can be support can be changed using the devargs
+parameter ``max_num_kflows``. The default number of flows supported is 16K each
+in ingress and egress path.
+
+Selecting EM vs EEM
+-------------------
+Broadcom devices can support filter creation in the onchip memory or the
+external memory. This is referred to as EM or EEM mode respectively.
+The decision for internal/external EM support is based on the ``devargs``
+parameter ``max_num_kflows``.  If this is set by the user, external EM is used.
+Otherwise EM support is enabled with flows created in internal memory.
 
 Application Support
 -------------------
drivers/net/bnxt/tf_ulp/bnxt_ulp.c +56 -22

147 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/bnxt_ulp.h +11 -0
index 36405ae1e..c2c5bcb1d 100644
@@ -54,6 +54,7 @@ struct bnxt_ulp_data {
 	uint32_t			ulp_flags;
 	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;
 };
 
 struct bnxt_ulp_context {
@@ -102,6 +103,16 @@ bnxt_ulp_cntxt_dev_id_set(struct bnxt_ulp_context *ulp_ctx, uint32_t dev_id);
 int32_t
 bnxt_ulp_cntxt_dev_id_get(struct bnxt_ulp_context *ulp_ctx, uint32_t *dev_id);
 
+/* Function to get whether or not ext mem is used for EM */
+int32_t
+bnxt_ulp_cntxt_mem_type_get(struct bnxt_ulp_context *ulp_ctx,
+			    enum bnxt_ulp_flow_mem_type *mem_type);
+
+/* Function to set whether or not ext mem is used for EM */
+int32_t
+bnxt_ulp_cntxt_mem_type_set(struct bnxt_ulp_context *ulp_ctx,
+			    enum bnxt_ulp_flow_mem_type mem_type);
+
 /* Function to set the table scope id of the EEM table. */
 int32_t
 bnxt_ulp_cntxt_tbl_scope_id_set(struct bnxt_ulp_context *ulp_ctx,
drivers/net/bnxt/tf_ulp/ulp_flow_db.c +13 -3
index 0a3fb015c..da012451d 100644
@@ -298,7 +298,8 @@ ulp_flow_db_init(struct bnxt_ulp_context *ulp_ctxt)
 	struct bnxt_ulp_device_params *dparms;
 	struct bnxt_ulp_flow_tbl *flow_tbl;
 	struct bnxt_ulp_flow_db *flow_db;
-	uint32_t dev_id;
+	uint32_t dev_id, num_flows;
+	enum bnxt_ulp_flow_mem_type mtype;
 
 	/* Get the dev specific number of flows that needed to be supported. */
 	if (bnxt_ulp_cntxt_dev_id_get(ulp_ctxt, &dev_id)) {
@@ -323,10 +324,17 @@ ulp_flow_db_init(struct bnxt_ulp_context *ulp_ctxt)
 	/* Attach the flow database to the ulp context. */
 	bnxt_ulp_cntxt_ptr2_flow_db_set(ulp_ctxt, flow_db);
 
+	/* Determine the number of flows based on EM type */
+	bnxt_ulp_cntxt_mem_type_get(ulp_ctxt, &mtype);
+	if (mtype == BNXT_ULP_FLOW_MEM_TYPE_INT)
+		num_flows = dparms->int_flow_db_num_entries;
+	else
+		num_flows = dparms->ext_flow_db_num_entries;
+
 	/* Populate the regular flow table limits. */
 	flow_tbl = &flow_db->flow_tbl;
-	flow_tbl->num_flows = dparms->flow_db_num_entries + 1;
-	flow_tbl->num_resources = ((dparms->flow_db_num_entries + 1) *
+	flow_tbl->num_flows = num_flows + 1;
+	flow_tbl->num_resources = ((num_flows + 1) *
 				   dparms->num_resources_per_flow);
 
 	/* Include the default flow table limits. */
@@ -350,6 +358,8 @@ ulp_flow_db_init(struct bnxt_ulp_context *ulp_ctxt)
 		goto error_free;
 	}
 	/* All good so return. */
+	BNXT_TF_DBG(INFO, "FlowDB initialized with %d flows.\n",
+		    flow_tbl->num_flows);
 	return 0;
 error_free:
 	ulp_flow_db_deinit(ulp_ctxt);
drivers/net/bnxt/tf_ulp/ulp_mapper.c +47 -1

76 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_template_db_enum.h +7 -0
index e083af0ae..81da34e3a 100644
@@ -235,6 +235,13 @@ enum bnxt_ulp_match_type {
 	BNXT_ULP_MATCH_TYPE_LAST = 2
 };
 
+enum bnxt_ulp_mem_type_opcode {
+	BNXT_ULP_MEM_TYPE_OPCODE_NOP = 0,
+	BNXT_ULP_MEM_TYPE_OPCODE_EXECUTE_IF_INT = 1,
+	BNXT_ULP_MEM_TYPE_OPCODE_EXECUTE_IF_EXT = 2,
+	BNXT_ULP_MEM_TYPE_OPCODE_LAST = 3
+};
+
 enum bnxt_ulp_priority {
 	BNXT_ULP_PRIORITY_LEVEL_0 = 0,
 	BNXT_ULP_PRIORITY_LEVEL_1 = 1,
drivers/net/bnxt/tf_ulp/ulp_template_db_stingray_act.c +1890 -392

2,686 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_template_db_stingray_class.c +3208 -438

3,646 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_template_db_tbl.c +24 -24

48 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_template_db_wh_plus_act.c +1889 -392

2,281 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_template_db_wh_plus_class.c +3080 -310

3,390 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_template_struct.h +3 -2
index 026c42d1c..50a986c89 100644

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

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

Signature · 1 line
2.21.1 (Apple Git-122.3)

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

#22 lore raw

PATCH v2 9/12 net/bnxt: add support for parent child flow database

In reply to Somnath Kotur

From: Kishore Padmanabha <[email protected]>

Added support for parent child flow database apis. This feature adds support to enable vxlan decap support where flows needs to maintain parent-child flow relationship.

---
 drivers/net/bnxt/tf_ulp/ulp_flow_db.c         | 348 +++++++++++++++++-
 drivers/net/bnxt/tf_ulp/ulp_flow_db.h         |  84 +++++
 drivers/net/bnxt/tf_ulp/ulp_template_db_tbl.c |   1 +
 drivers/net/bnxt/tf_ulp/ulp_template_struct.h |   1 +
 drivers/net/bnxt/tf_ulp/ulp_utils.h           |   4 +
 5 files changed, 435 insertions(+), 3 deletions(-)
drivers/net/bnxt/tf_ulp/ulp_flow_db.c +345 -3
index da012451d..a1c39329f 100644
@@ -207,13 +207,16 @@ ulp_flow_db_alloc_resource(struct bnxt_ulp_flow_db *flow_db)
 		return -ENOMEM;
 	}
 	size = (flow_tbl->num_flows / sizeof(uint64_t)) + 1;
-	flow_tbl->active_reg_flows = rte_zmalloc("active reg flows", size, 0);
+	size =  ULP_BYTE_ROUND_OFF_8(size);
+	flow_tbl->active_reg_flows = rte_zmalloc("active reg flows", size,
+						 ULP_BUFFER_ALIGN_64_BYTE);
 	if (!flow_tbl->active_reg_flows) {
 		BNXT_TF_DBG(ERR, "Failed to alloc memory active reg flows\n");
 		return -ENOMEM;
 	}
 
-	flow_tbl->active_dflt_flows = rte_zmalloc("active dflt flows", size, 0);
+	flow_tbl->active_dflt_flows = rte_zmalloc("active dflt flows", size,
+						  ULP_BUFFER_ALIGN_64_BYTE);
 	if (!flow_tbl->active_dflt_flows) {
 		BNXT_TF_DBG(ERR, "Failed to alloc memory active dflt flows\n");
 		return -ENOMEM;
@@ -284,6 +287,86 @@ ulp_flow_db_func_id_set(struct bnxt_ulp_flow_db *flow_db,
 		BNXT_TF_DBG(ERR, "Invalid flow id, flowdb corrupt\n");
 }
 
+/*
+ * Initialize the parent-child database. Memory is allocated in this
+ * call and assigned to the database
+ *
+ * flow_db [in] Ptr to flow table
+ * num_entries[in] - number of entries to allocate
+ *
+ * Returns 0 on success or negative number on failure.
+ */
+static int32_t
+ulp_flow_db_parent_tbl_init(struct bnxt_ulp_flow_db *flow_db,
+			    uint32_t num_entries)
+{
+	struct ulp_fdb_parent_child_db *p_db;
+	uint32_t size, idx;
+
+	/* update the sizes for the allocation */
+	p_db = &flow_db->parent_child_db;
+	p_db->child_bitset_size = (flow_db->flow_tbl.num_flows /
+				   sizeof(uint64_t)) + 1; /* size in bytes */
+	p_db->child_bitset_size = ULP_BYTE_ROUND_OFF_8(p_db->child_bitset_size);
+	p_db->entries_count = num_entries;
+
+	/* allocate the memory */
+	p_db->parent_flow_tbl = rte_zmalloc("fdb parent flow tbl",
+					    sizeof(struct ulp_fdb_parent_info) *
+					    p_db->entries_count, 0);
+	if (!p_db->parent_flow_tbl) {
+		BNXT_TF_DBG(ERR,
+			    "Failed to allocate memory fdb parent flow tbl\n");
+		return -ENOMEM;
+	}
+	size = p_db->child_bitset_size * p_db->entries_count;
+
+	/*
+	 * allocate the big chunk of memory to be statically carved into
+	 * child_fid_bitset pointer.
+	 */
+	p_db->parent_flow_tbl_mem = rte_zmalloc("fdb parent flow tbl mem",
+						size,
+						ULP_BUFFER_ALIGN_64_BYTE);
+	if (!p_db->parent_flow_tbl_mem) {
+		BNXT_TF_DBG(ERR,
+			    "Failed to allocate memory fdb parent flow mem\n");
+		return -ENOMEM;
+	}
+
+	/* set the pointers in parent table to their offsets */
+	for (idx = 0 ; idx < p_db->entries_count; idx++) {
+		p_db->parent_flow_tbl[idx].child_fid_bitset =
+			(uint64_t *)&p_db->parent_flow_tbl_mem[idx *
+			p_db->child_bitset_size];
+	}
+	/* success */
+	return 0;
+}
+
+/*
+ * Deinitialize the parent-child database. Memory is deallocated in
+ * this call and all flows should have been purged before this
+ * call.
+ *
+ * flow_db [in] Ptr to flow table
+ *
+ * Returns none
+ */
+static void
+ulp_flow_db_parent_tbl_deinit(struct bnxt_ulp_flow_db *flow_db)
+{
+	/* free the memory related to parent child database */
+	if (flow_db->parent_child_db.parent_flow_tbl_mem) {
+		rte_free(flow_db->parent_child_db.parent_flow_tbl_mem);
+		flow_db->parent_child_db.parent_flow_tbl_mem = NULL;
+	}
+	if (flow_db->parent_child_db.parent_flow_tbl) {
+		rte_free(flow_db->parent_child_db.parent_flow_tbl);
+		flow_db->parent_child_db.parent_flow_tbl = NULL;
+	}
+}
+
 /*
  * Initialize the flow database. Memory is allocated in this
  * call and assigned to the flow database.
@@ -357,6 +440,14 @@ ulp_flow_db_init(struct bnxt_ulp_context *ulp_ctxt)
 			    "Failed to allocate mem for flow table func id\n");
 		goto error_free;
 	}
+	/* initialize the parent child database */
+	if (ulp_flow_db_parent_tbl_init(flow_db,
+					dparms->fdb_parent_flow_entries)) {
+		BNXT_TF_DBG(ERR,
+			    "Failed to allocate mem for parent child db\n");
+		goto error_free;
+	}
+
 	/* All good so return. */
 	BNXT_TF_DBG(INFO, "FlowDB initialized with %d flows.\n",
 		    flow_tbl->num_flows);
@@ -388,6 +479,7 @@ ulp_flow_db_deinit(struct bnxt_ulp_context *ulp_ctxt)
 	bnxt_ulp_cntxt_ptr2_flow_db_set(ulp_ctxt, NULL);
 
 	/* Free up all the memory. */
+	ulp_flow_db_parent_tbl_deinit(flow_db);
 	ulp_flow_db_dealloc_resource(flow_db);
 	rte_free(flow_db->func_id_tbl);
 	rte_free(flow_db);
@@ -578,7 +670,7 @@ ulp_flow_db_resource_del(struct bnxt_ulp_context *ulp_ctxt,
 	flow_tbl = &flow_db->flow_tbl;
 	/* check for max flows */
 	if (fid >= flow_tbl->num_flows || !fid) {
-		BNXT_TF_DBG(ERR, "Invalid flow index\n");
+		BNXT_TF_DBG(ERR, "Invalid flow index %x\n", fid);
 		return -EINVAL;
 	}
 
@@ -1050,3 +1142,253 @@ ulp_default_flow_db_cfa_action_get(struct bnxt_ulp_context *ulp_ctx,
 	*cfa_action = hndl;
 	return 0;
 }
+
+/*
+ * Allocate the entry in the parent-child database
+ *
+ * ulp_ctxt [in] Ptr to ulp_context
+ * fid [in] The flow id to the flow entry
+ *
+ * returns index on success and negative on failure.
+ */
+int32_t
+ulp_flow_db_parent_flow_alloc(struct bnxt_ulp_context *ulp_ctxt,
+			      uint32_t fid)
+{
+	struct bnxt_ulp_flow_db *flow_db;
+	struct ulp_fdb_parent_child_db *p_pdb;
+	uint32_t idx, free_idx = 0;
+
+	flow_db = bnxt_ulp_cntxt_ptr2_flow_db_get(ulp_ctxt);
+	if (!flow_db) {
+		BNXT_TF_DBG(ERR, "Invalid Arguments\n");
+		return -EINVAL;
+	}
+
+	/* check for max flows */
+	if (fid >= flow_db->flow_tbl.num_flows || !fid) {
+		BNXT_TF_DBG(ERR, "Invalid flow index\n");
+		return -EINVAL;
+	}
+
+	p_pdb = &flow_db->parent_child_db;
+	for (idx = 0; idx <= p_pdb->entries_count; idx++) {
+		if (p_pdb->parent_flow_tbl[idx].parent_fid == fid) {
+			BNXT_TF_DBG(ERR, "fid is already allocated\n");
+			return -EINVAL;
+		}
+		if (!p_pdb->parent_flow_tbl[idx].parent_fid && !free_idx)
+			free_idx = idx + 1;
+	}
+	/* no free slots */
+	if (!free_idx) {
+		BNXT_TF_DBG(ERR, "parent child db is full\n");
+		return -ENOMEM;
+	}
+
+	free_idx -= 1;
+	/* set the Fid in the parent child */
+	p_pdb->parent_flow_tbl[free_idx].parent_fid = fid;
+	return free_idx;
+}
+
+/*
+ * Free the entry in the parent-child database
+ *
+ * ulp_ctxt [in] Ptr to ulp_context
+ * fid [in] The flow id to the flow entry
+ *
+ * returns 0 on success and negative on failure.
+ */
+int32_t
+ulp_flow_db_parent_flow_free(struct bnxt_ulp_context *ulp_ctxt,
+			     uint32_t fid)
+{
+	struct bnxt_ulp_flow_db *flow_db;
+	struct ulp_fdb_parent_child_db *p_pdb;
+	uint32_t idx;
+
+	flow_db = bnxt_ulp_cntxt_ptr2_flow_db_get(ulp_ctxt);
+	if (!flow_db) {
+		BNXT_TF_DBG(ERR, "Invalid Arguments\n");
+		return -EINVAL;
+	}
+
+	/* check for max flows */
+	if (fid >= flow_db->flow_tbl.num_flows || !fid) {
+		BNXT_TF_DBG(ERR, "Invalid flow index\n");
+		return -EINVAL;
+	}
+
+	p_pdb = &flow_db->parent_child_db;
+	for (idx = 0; idx <= p_pdb->entries_count; idx++) {
+		if (p_pdb->parent_flow_tbl[idx].parent_fid == fid) {
+			/* free the contents */
+			p_pdb->parent_flow_tbl[idx].parent_fid = 0;
+			memset(p_pdb->parent_flow_tbl[idx].child_fid_bitset,
+			       0, p_pdb->child_bitset_size);
+			return 0;
+		}
+	}
+	BNXT_TF_DBG(ERR, "parent entry not found = %x\n", fid);
+	return -EINVAL;
+}
+
+/*
+ * Set or reset the child flow in the parent-child database
+ *
+ * ulp_ctxt [in] Ptr to ulp_context
+ * parent_fid [in] The flow id of the parent flow entry
+ * child_fid [in] The flow id of the child flow entry
+ * set_flag [in] Use 1 for setting child, 0 to reset
+ *
+ * returns zero on success and negative on failure.
+ */
+int32_t
+ulp_flow_db_parent_child_flow_set(struct bnxt_ulp_context *ulp_ctxt,
+				  uint32_t parent_fid,
+				  uint32_t child_fid,
+				  uint32_t set_flag)
+{
+	struct bnxt_ulp_flow_db *flow_db;
+	struct ulp_fdb_parent_child_db *p_pdb;
+	uint32_t idx, a_idx;
+	uint64_t *t;
+
+	flow_db = bnxt_ulp_cntxt_ptr2_flow_db_get(ulp_ctxt);
+	if (!flow_db) {
+		BNXT_TF_DBG(ERR, "Invalid Arguments\n");
+		return -EINVAL;
+	}
+
+	/* check for fid validity */
+	if (parent_fid >= flow_db->flow_tbl.num_flows || !parent_fid) {
+		BNXT_TF_DBG(ERR, "Invalid parent flow index %x\n", parent_fid);
+		return -EINVAL;
+	}
+
+	/* check for fid validity */
+	if (child_fid >= flow_db->flow_tbl.num_flows || !child_fid) {
+		BNXT_TF_DBG(ERR, "Invalid child flow index %x\n", child_fid);
+		return -EINVAL;
+	}
+
+	p_pdb = &flow_db->parent_child_db;
+	a_idx = child_fid / ULP_INDEX_BITMAP_SIZE;
+	for (idx = 0; idx <= p_pdb->entries_count; idx++) {
+		if (p_pdb->parent_flow_tbl[idx].parent_fid == parent_fid) {
+			t = p_pdb->parent_flow_tbl[idx].child_fid_bitset;
+			if (set_flag)
+				ULP_INDEX_BITMAP_SET(t[a_idx], child_fid);
+			else
+				ULP_INDEX_BITMAP_RESET(t[a_idx], child_fid);
+			return 0;
+		}
+	}
+	BNXT_TF_DBG(ERR, "Unable to set the parent-child flow %x:%x\n",
+		    parent_fid, child_fid);
+	return -1;
+}
+
+/*
+ * Get the parent index from the parent-child database
+ *
+ * ulp_ctxt [in] Ptr to ulp_context
+ * parent_fid [in] The flow id of the parent flow entry
+ * parent_idx [out] The parent index of parent flow entry
+ *
+ * returns zero on success and negative on failure.
+ */
+int32_t
+ulp_flow_db_parent_flow_idx_get(struct bnxt_ulp_context *ulp_ctxt,
+				uint32_t parent_fid,
+				uint32_t *parent_idx)
+{
+	struct bnxt_ulp_flow_db *flow_db;
+	struct ulp_fdb_parent_child_db *p_pdb;
+	uint32_t idx;
+
+	flow_db = bnxt_ulp_cntxt_ptr2_flow_db_get(ulp_ctxt);
+	if (!flow_db) {
+		BNXT_TF_DBG(ERR, "Invalid Arguments\n");
+		return -EINVAL;
+	}
+
+	/* check for fid validity */
+	if (parent_fid >= flow_db->flow_tbl.num_flows || !parent_fid) {
+		BNXT_TF_DBG(ERR, "Invalid parent flow index %x\n", parent_fid);
+		return -EINVAL;
+	}
+
+	p_pdb = &flow_db->parent_child_db;
+	for (idx = 0; idx <= p_pdb->entries_count; idx++) {
+		if (p_pdb->parent_flow_tbl[idx].parent_fid == parent_fid) {
+			*parent_idx = idx;
+			return 0;
+		}
+	}
+	BNXT_TF_DBG(ERR, "Unable to get the parent flow %x\n", parent_fid);
+	return -1;
+}
+
+/*
+ * Get the next child flow in the parent-child database
+ *
+ * ulp_ctxt [in] Ptr to ulp_context
+ * parent_fid [in] The flow id of the parent flow entry
+ * child_fid [in/out] The flow id of the child flow entry
+ *
+ * returns zero on success and negative on failure.
+ * Pass child_fid as zero for first entry.
+ */
+int32_t
+ulp_flow_db_parent_child_flow_next_entry_get(struct bnxt_ulp_flow_db *flow_db,
+					     uint32_t parent_idx,
+					     uint32_t *child_fid)
+{
+	struct ulp_fdb_parent_child_db *p_pdb;
+	uint32_t idx, s_idx, mod_fid;
+	uint32_t next_fid = *child_fid;
+	uint64_t *child_bitset;
+	uint64_t bs;
+
+	/* check for fid validity */
+	p_pdb = &flow_db->parent_child_db;
+	if (parent_idx >= p_pdb->entries_count ||
+	    !p_pdb->parent_flow_tbl[parent_idx].parent_fid) {
+		BNXT_TF_DBG(ERR, "Invalid parent flow index %x\n", parent_idx);
+		return -EINVAL;
+	}
+
+	child_bitset = p_pdb->parent_flow_tbl[parent_idx].child_fid_bitset;
+	do {
+		/* increment the flow id to find the next valid flow id */
+		next_fid++;
+		if (next_fid >= flow_db->flow_tbl.num_flows)
+			return -ENOENT;
+		idx = next_fid / ULP_INDEX_BITMAP_SIZE;
+		mod_fid = next_fid % ULP_INDEX_BITMAP_SIZE;
+		s_idx = idx;
+		while (!(bs = child_bitset[idx])) {
+			idx++;
+			if ((idx * ULP_INDEX_BITMAP_SIZE) >=
+			    flow_db->flow_tbl.num_flows)
+				return -ENOENT;
+		}
+		/*
+		 * remove the previous bits in the bitset bs to find the
+		 * next non zero bit in the bitset. This needs to be done
+		 * only if the idx is same as he one you started.
+		 */
+		if (s_idx == idx)
+			bs &= (-1UL >> mod_fid);
+		next_fid = (idx * ULP_INDEX_BITMAP_SIZE) + __builtin_clzl(bs);
+		if (*child_fid >= next_fid) {
+			BNXT_TF_DBG(ERR, "Parent Child Database is corrupt\n");
+			return -ENOENT;
+		}
+		idx = next_fid / ULP_INDEX_BITMAP_SIZE;
+	} while (!ULP_INDEX_BITMAP_GET(child_bitset[idx], next_fid));
+	*child_fid = next_fid;
+	return 0;
+}
drivers/net/bnxt/tf_ulp/ulp_flow_db.h +84 -0

100 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_template_db_tbl.c +1 -0
index 4904a41c3..a677b0ca5 100644
@@ -368,6 +368,7 @@ struct bnxt_ulp_device_params ulp_device_params[BNXT_ULP_DEVICE_ID_LAST] = {
 	.mark_db_lfid_entries    = 65536,
 	.mark_db_gfid_entries    = 65536,
 	.flow_count_db_entries   = 16384,
+	.fdb_parent_flow_entries = 2,
 	.num_resources_per_flow  = 8,
 	.num_phy_ports           = 2,
 	.ext_cntr_table_type     = 0,
drivers/net/bnxt/tf_ulp/ulp_template_struct.h +1 -0
index 50a986c89..2e94b6f19 100644
@@ -160,6 +160,7 @@ struct bnxt_ulp_device_params {
 	uint64_t			int_flow_db_num_entries;
 	uint64_t			ext_flow_db_num_entries;
 	uint32_t			flow_count_db_entries;
+	uint32_t			fdb_parent_flow_entries;
 	uint32_t			num_resources_per_flow;
 	uint32_t			ext_cntr_table_type;
 	uint64_t			byte_count_mask;
drivers/net/bnxt/tf_ulp/ulp_utils.h +4 -0
index c054a77a9..898e85123 100644
@@ -11,6 +11,7 @@
 
 #define ULP_BUFFER_ALIGN_8_BYTE		8
 #define ULP_BUFFER_ALIGN_16_BYTE	16
+#define ULP_BUFFER_ALIGN_64_BYTE	64
 
 /*
  * Macros for bitmap sets and gets
@@ -53,6 +54,9 @@
 /* Macro to convert bits to bytes with no round off*/
 #define ULP_BITS_2_BYTE_NR(bits_x)	((bits_x) / 8)
 
+/* Macro to round off to next multiple of 8*/
+#define ULP_BYTE_ROUND_OFF_8(x)	(((x) + 7) & ~7)
+
 /* Macros to read the computed fields */
 #define ULP_COMP_FLD_IDX_RD(params, idx) \
 	rte_be_to_cpu_32((params)->comp_fld[(idx)])
Signature · 1 line
2.21.1 (Apple Git-122.3)
#23 lore raw

PATCH v2 10/12 net/bnxt: consolidate template table processing

In reply to Somnath Kotur

From: Mike Baucom <[email protected]>

Name changes due to consolidating the template table processing and hence are not necessary.

- chip before type in name
- removal of class in key field info

---
 drivers/net/bnxt/tf_ulp/ulp_mapper.c          | 12 +++----
 .../tf_ulp/ulp_template_db_stingray_act.c     |  6 ++--
 .../tf_ulp/ulp_template_db_stingray_class.c   | 10 +++---
 drivers/net/bnxt/tf_ulp/ulp_template_db_tbl.c | 34 +++++++++----------
 drivers/net/bnxt/tf_ulp/ulp_template_db_tbl.h | 32 ++++++++---------
 .../bnxt/tf_ulp/ulp_template_db_wh_plus_act.c |  6 ++--
 .../tf_ulp/ulp_template_db_wh_plus_class.c    | 10 +++---
 drivers/net/bnxt/tf_ulp/ulp_template_struct.h |  4 +--
 8 files changed, 57 insertions(+), 57 deletions(-)
drivers/net/bnxt/tf_ulp/ulp_mapper.c +6 -6
index 812e35c27..cd289cc40 100644
@@ -256,7 +256,7 @@ ulp_mapper_tbl_list_get(struct bnxt_ulp_mapper_parms *mparms,
  *
  * Returns array of Key fields, or NULL on error.
  */
-static struct bnxt_ulp_mapper_class_key_field_info *
+static struct bnxt_ulp_mapper_key_field_info *
 ulp_mapper_key_fields_get(struct bnxt_ulp_mapper_parms *mparms,
 			  struct bnxt_ulp_mapper_tbl_info *tbl,
 			  uint32_t *num_flds)
@@ -1009,7 +1009,7 @@ ulp_mapper_result_field_process(struct bnxt_ulp_mapper_parms *parms,
 static int32_t
 ulp_mapper_keymask_field_process(struct bnxt_ulp_mapper_parms *parms,
 				 enum tf_dir dir,
-				 struct bnxt_ulp_mapper_class_key_field_info *f,
+				 struct bnxt_ulp_mapper_key_field_info *f,
 				 struct ulp_blob *blob,
 				 uint8_t is_key,
 				 const char *name)
@@ -1020,7 +1020,7 @@ ulp_mapper_keymask_field_process(struct bnxt_ulp_mapper_parms *parms,
 	uint8_t *operand;
 	struct ulp_regfile *regfile = parms->regfile;
 	uint8_t *val = NULL;
-	struct bnxt_ulp_mapper_class_key_field_info *fld = f;
+	struct bnxt_ulp_mapper_key_field_info *fld = f;
 	uint32_t field_size;
 
 	if (is_key) {
@@ -1442,7 +1442,7 @@ static int32_t
 ulp_mapper_tcam_tbl_process(struct bnxt_ulp_mapper_parms *parms,
 			    struct bnxt_ulp_mapper_tbl_info *tbl)
 {
-	struct bnxt_ulp_mapper_class_key_field_info	*kflds;
+	struct bnxt_ulp_mapper_key_field_info	*kflds;
 	struct ulp_blob key, mask, data, update_data;
 	uint32_t i, num_kflds;
 	struct tf *tfp;
@@ -1670,7 +1670,7 @@ static int32_t
 ulp_mapper_em_tbl_process(struct bnxt_ulp_mapper_parms *parms,
 			  struct bnxt_ulp_mapper_tbl_info *tbl)
 {
-	struct bnxt_ulp_mapper_class_key_field_info	*kflds;
+	struct bnxt_ulp_mapper_key_field_info	*kflds;
 	struct bnxt_ulp_mapper_result_field_info *dflds;
 	struct ulp_blob key, data;
 	uint32_t i, num_kflds, num_dflds;
@@ -2061,7 +2061,7 @@ static int32_t
 ulp_mapper_cache_tbl_process(struct bnxt_ulp_mapper_parms *parms,
 			     struct bnxt_ulp_mapper_tbl_info *tbl)
 {
-	struct bnxt_ulp_mapper_class_key_field_info *kflds;
+	struct bnxt_ulp_mapper_key_field_info *kflds;
 	struct bnxt_ulp_mapper_cache_entry *cache_entry;
 	struct bnxt_ulp_mapper_ident_info *idents;
 	uint32_t i, num_kflds = 0, num_idents = 0;
drivers/net/bnxt/tf_ulp/ulp_template_db_stingray_act.c +3 -3
index a5019d664..68e4d8e59 100644
@@ -8,7 +8,7 @@
 #include "ulp_template_struct.h"
 #include "ulp_rte_parser.h"
 
-struct bnxt_ulp_mapper_tbl_list_info ulp_act_stingray_tmpl_list[] = {
+struct bnxt_ulp_mapper_tbl_list_info ulp_stingray_act_tmpl_list[] = {
 	[1] = {
 	.device_name = BNXT_ULP_DEVICE_ID_STINGRAY,
 	.num_tbls = 6,
@@ -47,7 +47,7 @@ struct bnxt_ulp_mapper_tbl_list_info ulp_act_stingray_tmpl_list[] = {
 	}
 };
 
-struct bnxt_ulp_mapper_tbl_info ulp_act_stingray_tbl_list[] = {
+struct bnxt_ulp_mapper_tbl_info ulp_stingray_act_tbl_list[] = {
 	{
 	.resource_func = BNXT_ULP_RESOURCE_FUNC_INDEX_TABLE,
 	.resource_type = TF_TBL_TYPE_ACT_STATS_64,
@@ -531,7 +531,7 @@ struct bnxt_ulp_mapper_tbl_info ulp_act_stingray_tbl_list[] = {
 	}
 };
 
-struct bnxt_ulp_mapper_result_field_info ulp_act_stingray_result_field_list[] = {
+struct bnxt_ulp_mapper_result_field_info ulp_stingray_act_result_field_list[] = {
 	{
 	.field_bit_size = 64,
 	.result_opcode = BNXT_ULP_MAPPER_OPC_SET_TO_ZERO
drivers/net/bnxt/tf_ulp/ulp_template_db_stingray_class.c +5 -5
index b5bdb94e8..1fa364e29 100644
@@ -8,7 +8,7 @@
 #include "ulp_template_struct.h"
 #include "ulp_rte_parser.h"
 
-struct bnxt_ulp_mapper_tbl_list_info ulp_class_stingray_tmpl_list[] = {
+struct bnxt_ulp_mapper_tbl_list_info ulp_stingray_class_tmpl_list[] = {
 	[1] = {
 	.device_name = BNXT_ULP_DEVICE_ID_STINGRAY,
 	.num_tbls = 6,
@@ -149,7 +149,7 @@ struct bnxt_ulp_mapper_tbl_list_info ulp_class_stingray_tmpl_list[] = {
 	}
 };
 
-struct bnxt_ulp_mapper_tbl_info ulp_class_stingray_tbl_list[] = {
+struct bnxt_ulp_mapper_tbl_info ulp_stingray_class_tbl_list[] = {
 	{
 	.resource_func = BNXT_ULP_RESOURCE_FUNC_INDEX_TABLE,
 	.resource_type = TF_TBL_TYPE_FULL_ACT_RECORD,
@@ -2349,7 +2349,7 @@ struct bnxt_ulp_mapper_tbl_info ulp_class_stingray_tbl_list[] = {
 	}
 };
 
-struct bnxt_ulp_mapper_class_key_field_info ulp_class_stingray_key_field_list[] = {
+struct bnxt_ulp_mapper_key_field_info ulp_stingray_class_key_field_list[] = {
 	{
 	.field_bit_size = 12,
 	.mask_opcode = BNXT_ULP_MAPPER_OPC_SET_TO_ZERO,
@@ -13070,7 +13070,7 @@ struct bnxt_ulp_mapper_class_key_field_info ulp_class_stingray_key_field_list[]
 	}
 };
 
-struct bnxt_ulp_mapper_result_field_info ulp_class_stingray_result_field_list[] = {
+struct bnxt_ulp_mapper_result_field_info ulp_stingray_class_result_field_list[] = {
 	{
 	.field_bit_size = 14,
 	.result_opcode = BNXT_ULP_MAPPER_OPC_SET_TO_ZERO
@@ -18750,7 +18750,7 @@ struct bnxt_ulp_mapper_result_field_info ulp_class_stingray_result_field_list[]
 	}
 };
 
-struct bnxt_ulp_mapper_ident_info ulp_class_stingray_ident_list[] = {
+struct bnxt_ulp_mapper_ident_info ulp_stingray_class_ident_list[] = {
 	{
 	.resource_func = BNXT_ULP_RESOURCE_FUNC_IDENTIFIER,
 	.ident_type = TF_IDENT_TYPE_L2_CTXT_HIGH,
drivers/net/bnxt/tf_ulp/ulp_template_db_tbl.c +17 -17
index a677b0ca5..7f5a31680 100644
@@ -314,31 +314,31 @@ struct bnxt_ulp_cache_tbl_params ulp_cache_tbl_params[] = {
 
 const struct ulp_template_device_tbls ulp_template_stingray_tbls[] = {
 	[BNXT_ULP_TEMPLATE_TYPE_CLASS] = {
-	.tmpl_list               = ulp_class_stingray_tmpl_list,
-	.tbl_list                = ulp_class_stingray_tbl_list,
-	.key_field_list          = ulp_class_stingray_key_field_list,
-	.result_field_list       = ulp_class_stingray_result_field_list,
-	.ident_list              = ulp_class_stingray_ident_list
+	.tmpl_list               = ulp_stingray_class_tmpl_list,
+	.tbl_list                = ulp_stingray_class_tbl_list,
+	.key_field_list          = ulp_stingray_class_key_field_list,
+	.result_field_list       = ulp_stingray_class_result_field_list,
+	.ident_list              = ulp_stingray_class_ident_list
 	},
 	[BNXT_ULP_TEMPLATE_TYPE_ACTION] = {
-	.tmpl_list               = ulp_act_stingray_tmpl_list,
-	.tbl_list                = ulp_act_stingray_tbl_list,
-	.result_field_list       = ulp_act_stingray_result_field_list
+	.tmpl_list               = ulp_stingray_act_tmpl_list,
+	.tbl_list                = ulp_stingray_act_tbl_list,
+	.result_field_list       = ulp_stingray_act_result_field_list
 	}
 };
 
 const struct ulp_template_device_tbls ulp_template_wh_plus_tbls[] = {
 	[BNXT_ULP_TEMPLATE_TYPE_CLASS] = {
-	.tmpl_list               = ulp_class_wh_plus_tmpl_list,
-	.tbl_list                = ulp_class_wh_plus_tbl_list,
-	.key_field_list          = ulp_class_wh_plus_key_field_list,
-	.result_field_list       = ulp_class_wh_plus_result_field_list,
-	.ident_list              = ulp_class_wh_plus_ident_list
+	.tmpl_list               = ulp_wh_plus_class_tmpl_list,
+	.tbl_list                = ulp_wh_plus_class_tbl_list,
+	.key_field_list          = ulp_wh_plus_class_key_field_list,
+	.result_field_list       = ulp_wh_plus_class_result_field_list,
+	.ident_list              = ulp_wh_plus_class_ident_list
 	},
 	[BNXT_ULP_TEMPLATE_TYPE_ACTION] = {
-	.tmpl_list               = ulp_act_wh_plus_tmpl_list,
-	.tbl_list                = ulp_act_wh_plus_tbl_list,
-	.result_field_list       = ulp_act_wh_plus_result_field_list
+	.tmpl_list               = ulp_wh_plus_act_tmpl_list,
+	.tbl_list                = ulp_wh_plus_act_tbl_list,
+	.result_field_list       = ulp_wh_plus_act_result_field_list
 	}
 };
 
@@ -351,6 +351,7 @@ struct bnxt_ulp_device_params ulp_device_params[BNXT_ULP_DEVICE_ID_LAST] = {
 	.mark_db_lfid_entries    = 65536,
 	.mark_db_gfid_entries    = 65536,
 	.flow_count_db_entries   = 16384,
+	.fdb_parent_flow_entries = 2,
 	.num_resources_per_flow  = 8,
 	.num_phy_ports           = 2,
 	.ext_cntr_table_type     = 0,
@@ -368,7 +369,6 @@ struct bnxt_ulp_device_params ulp_device_params[BNXT_ULP_DEVICE_ID_LAST] = {
 	.mark_db_lfid_entries    = 65536,
 	.mark_db_gfid_entries    = 65536,
 	.flow_count_db_entries   = 16384,
-	.fdb_parent_flow_entries = 2,
 	.num_resources_per_flow  = 8,
 	.num_phy_ports           = 2,
 	.ext_cntr_table_type     = 0,
drivers/net/bnxt/tf_ulp/ulp_template_db_tbl.h +16 -16
index 7a541cb8e..8c13ca387 100644
@@ -8,41 +8,41 @@
 
 #include "ulp_template_struct.h"
 
-extern struct bnxt_ulp_mapper_tbl_list_info ulp_class_wh_plus_tmpl_list[];
+extern struct bnxt_ulp_mapper_tbl_list_info ulp_wh_plus_class_tmpl_list[];
 
-extern struct bnxt_ulp_mapper_tbl_info ulp_class_wh_plus_tbl_list[];
+extern struct bnxt_ulp_mapper_tbl_info ulp_wh_plus_class_tbl_list[];
 
 extern struct
-bnxt_ulp_mapper_class_key_field_info ulp_class_wh_plus_key_field_list[];
+bnxt_ulp_mapper_key_field_info ulp_wh_plus_class_key_field_list[];
 
 extern struct
-bnxt_ulp_mapper_result_field_info ulp_class_wh_plus_result_field_list[];
+bnxt_ulp_mapper_result_field_info ulp_wh_plus_class_result_field_list[];
 
-extern struct bnxt_ulp_mapper_ident_info ulp_class_wh_plus_ident_list[];
+extern struct bnxt_ulp_mapper_ident_info ulp_wh_plus_class_ident_list[];
 
-extern struct bnxt_ulp_mapper_tbl_list_info ulp_act_wh_plus_tmpl_list[];
+extern struct bnxt_ulp_mapper_tbl_list_info ulp_wh_plus_act_tmpl_list[];
 
-extern struct bnxt_ulp_mapper_tbl_info ulp_act_wh_plus_tbl_list[];
+extern struct bnxt_ulp_mapper_tbl_info ulp_wh_plus_act_tbl_list[];
 
 extern struct
-bnxt_ulp_mapper_result_field_info ulp_act_wh_plus_result_field_list[];
+bnxt_ulp_mapper_result_field_info ulp_wh_plus_act_result_field_list[];
 
-extern struct bnxt_ulp_mapper_tbl_list_info ulp_class_stingray_tmpl_list[];
+extern struct bnxt_ulp_mapper_tbl_list_info ulp_stingray_class_tmpl_list[];
 
-extern struct bnxt_ulp_mapper_tbl_info ulp_class_stingray_tbl_list[];
+extern struct bnxt_ulp_mapper_tbl_info ulp_stingray_class_tbl_list[];
 
 extern struct
-bnxt_ulp_mapper_class_key_field_info ulp_class_stingray_key_field_list[];
+bnxt_ulp_mapper_key_field_info ulp_stingray_class_key_field_list[];
 
 extern struct
-bnxt_ulp_mapper_result_field_info ulp_class_stingray_result_field_list[];
+bnxt_ulp_mapper_result_field_info ulp_stingray_class_result_field_list[];
 
-extern struct bnxt_ulp_mapper_ident_info ulp_class_stingray_ident_list[];
+extern struct bnxt_ulp_mapper_ident_info ulp_stingray_class_ident_list[];
 
-extern struct bnxt_ulp_mapper_tbl_list_info ulp_act_stingray_tmpl_list[];
+extern struct bnxt_ulp_mapper_tbl_list_info ulp_stingray_act_tmpl_list[];
 
-extern struct bnxt_ulp_mapper_tbl_info ulp_act_stingray_tbl_list[];
+extern struct bnxt_ulp_mapper_tbl_info ulp_stingray_act_tbl_list[];
 
 extern struct
-bnxt_ulp_mapper_result_field_info ulp_act_stingray_result_field_list[];
+bnxt_ulp_mapper_result_field_info ulp_stingray_act_result_field_list[];
 #endif
drivers/net/bnxt/tf_ulp/ulp_template_db_wh_plus_act.c +3 -3
index 82b2ad980..381278ee9 100644
@@ -8,7 +8,7 @@
 #include "ulp_template_struct.h"
 #include "ulp_rte_parser.h"
 
-struct bnxt_ulp_mapper_tbl_list_info ulp_act_wh_plus_tmpl_list[] = {
+struct bnxt_ulp_mapper_tbl_list_info ulp_wh_plus_act_tmpl_list[] = {
 	[1] = {
 	.device_name = BNXT_ULP_DEVICE_ID_WH_PLUS,
 	.num_tbls = 6,
@@ -47,7 +47,7 @@ struct bnxt_ulp_mapper_tbl_list_info ulp_act_wh_plus_tmpl_list[] = {
 	}
 };
 
-struct bnxt_ulp_mapper_tbl_info ulp_act_wh_plus_tbl_list[] = {
+struct bnxt_ulp_mapper_tbl_info ulp_wh_plus_act_tbl_list[] = {
 	{
 	.resource_func = BNXT_ULP_RESOURCE_FUNC_INDEX_TABLE,
 	.resource_type = TF_TBL_TYPE_ACT_STATS_64,
@@ -530,7 +530,7 @@ struct bnxt_ulp_mapper_tbl_info ulp_act_wh_plus_tbl_list[] = {
 	}
 };
 
-struct bnxt_ulp_mapper_result_field_info ulp_act_wh_plus_result_field_list[] = {
+struct bnxt_ulp_mapper_result_field_info ulp_wh_plus_act_result_field_list[] = {
 	{
 	.field_bit_size = 64,
 	.result_opcode = BNXT_ULP_MAPPER_OPC_SET_TO_ZERO
drivers/net/bnxt/tf_ulp/ulp_template_db_wh_plus_class.c +5 -5
index 9f40b39d8..7024658ce 100644
@@ -8,7 +8,7 @@
 #include "ulp_template_struct.h"
 #include "ulp_rte_parser.h"
 
-struct bnxt_ulp_mapper_tbl_list_info ulp_class_wh_plus_tmpl_list[] = {
+struct bnxt_ulp_mapper_tbl_list_info ulp_wh_plus_class_tmpl_list[] = {
 	[1] = {
 	.device_name = BNXT_ULP_DEVICE_ID_WH_PLUS,
 	.num_tbls = 6,
@@ -149,7 +149,7 @@ struct bnxt_ulp_mapper_tbl_list_info ulp_class_wh_plus_tmpl_list[] = {
 	}
 };
 
-struct bnxt_ulp_mapper_tbl_info ulp_class_wh_plus_tbl_list[] = {
+struct bnxt_ulp_mapper_tbl_info ulp_wh_plus_class_tbl_list[] = {
 	{
 	.resource_func = BNXT_ULP_RESOURCE_FUNC_INDEX_TABLE,
 	.resource_type = TF_TBL_TYPE_FULL_ACT_RECORD,
@@ -2349,7 +2349,7 @@ struct bnxt_ulp_mapper_tbl_info ulp_class_wh_plus_tbl_list[] = {
 	}
 };
 
-struct bnxt_ulp_mapper_class_key_field_info ulp_class_wh_plus_key_field_list[] = {
+struct bnxt_ulp_mapper_key_field_info ulp_wh_plus_class_key_field_list[] = {
 	{
 	.field_bit_size = 8,
 	.mask_opcode = BNXT_ULP_MAPPER_OPC_SET_TO_ZERO,
@@ -13070,7 +13070,7 @@ struct bnxt_ulp_mapper_class_key_field_info ulp_class_wh_plus_key_field_list[] =
 	}
 };
 
-struct bnxt_ulp_mapper_result_field_info ulp_class_wh_plus_result_field_list[] = {
+struct bnxt_ulp_mapper_result_field_info ulp_wh_plus_class_result_field_list[] = {
 	{
 	.field_bit_size = 14,
 	.result_opcode = BNXT_ULP_MAPPER_OPC_SET_TO_ZERO
@@ -18750,7 +18750,7 @@ struct bnxt_ulp_mapper_result_field_info ulp_class_wh_plus_result_field_list[] =
 	}
 };
 
-struct bnxt_ulp_mapper_ident_info ulp_class_wh_plus_ident_list[] = {
+struct bnxt_ulp_mapper_ident_info ulp_wh_plus_class_ident_list[] = {
 	{
 	.resource_func = BNXT_ULP_RESOURCE_FUNC_IDENTIFIER,
 	.ident_type = TF_IDENT_TYPE_L2_CTXT_HIGH,
drivers/net/bnxt/tf_ulp/ulp_template_struct.h +2 -2
index 2e94b6f19..107a06a3d 100644
@@ -144,7 +144,7 @@ extern struct bnxt_ulp_act_match_info ulp_act_match_list[];
 struct ulp_template_device_tbls {
 	struct bnxt_ulp_mapper_tbl_list_info *tmpl_list;
 	struct bnxt_ulp_mapper_tbl_info *tbl_list;
-	struct bnxt_ulp_mapper_class_key_field_info *key_field_list;
+	struct bnxt_ulp_mapper_key_field_info *key_field_list;
 	struct bnxt_ulp_mapper_result_field_info *result_field_list;
 	struct bnxt_ulp_mapper_ident_info *ident_list;
 };
@@ -212,7 +212,7 @@ struct bnxt_ulp_mapper_tbl_info {
 	uint32_t			index_operand;
 };
 
-struct bnxt_ulp_mapper_class_key_field_info {
+struct bnxt_ulp_mapper_key_field_info {
 	uint8_t				description[64];
 	enum bnxt_ulp_mapper_opc	mask_opcode;
 	enum bnxt_ulp_mapper_opc	spec_opcode;
Signature · 1 line
2.21.1 (Apple Git-122.3)
#24 lore raw

PATCH v2 11/12 net/bnxt: remove flow db table type from templates

In reply to Somnath Kotur

From: Mike Baucom <[email protected]>

FDB type is now driven by the caller, not the template. So remove it.

---
 .../tf_ulp/ulp_template_db_stingray_act.c     | 18 ++---
 .../tf_ulp/ulp_template_db_stingray_class.c   | 69 +++++++------------
 .../bnxt/tf_ulp/ulp_template_db_wh_plus_act.c | 18 ++---
 .../tf_ulp/ulp_template_db_wh_plus_class.c    | 69 +++++++------------
 drivers/net/bnxt/tf_ulp/ulp_template_struct.h |  1 -
 5 files changed, 58 insertions(+), 117 deletions(-)
drivers/net/bnxt/tf_ulp/ulp_template_db_stingray_act.c +6 -12
index 68e4d8e59..2237ffb94 100644
@@ -12,38 +12,32 @@ struct bnxt_ulp_mapper_tbl_list_info ulp_stingray_act_tmpl_list[] = {
 	[1] = {
 	.device_name = BNXT_ULP_DEVICE_ID_STINGRAY,
 	.num_tbls = 6,
-	.start_tbl_idx = 0,
-	.flow_db_table_type = BNXT_ULP_FDB_TYPE_REGULAR
+	.start_tbl_idx = 0
 	},
 	[2] = {
 	.device_name = BNXT_ULP_DEVICE_ID_STINGRAY,
 	.num_tbls = 3,
-	.start_tbl_idx = 6,
-	.flow_db_table_type = BNXT_ULP_FDB_TYPE_REGULAR
+	.start_tbl_idx = 6
 	},
 	[3] = {
 	.device_name = BNXT_ULP_DEVICE_ID_STINGRAY,
 	.num_tbls = 3,
-	.start_tbl_idx = 9,
-	.flow_db_table_type = BNXT_ULP_FDB_TYPE_REGULAR
+	.start_tbl_idx = 9
 	},
 	[4] = {
 	.device_name = BNXT_ULP_DEVICE_ID_STINGRAY,
 	.num_tbls = 6,
-	.start_tbl_idx = 12,
-	.flow_db_table_type = BNXT_ULP_FDB_TYPE_REGULAR
+	.start_tbl_idx = 12
 	},
 	[5] = {
 	.device_name = BNXT_ULP_DEVICE_ID_STINGRAY,
 	.num_tbls = 6,
-	.start_tbl_idx = 18,
-	.flow_db_table_type = BNXT_ULP_FDB_TYPE_REGULAR
+	.start_tbl_idx = 18
 	},
 	[6] = {
 	.device_name = BNXT_ULP_DEVICE_ID_STINGRAY,
 	.num_tbls = 5,
-	.start_tbl_idx = 24,
-	.flow_db_table_type = BNXT_ULP_FDB_TYPE_REGULAR
+	.start_tbl_idx = 24
 	}
 };
 
drivers/net/bnxt/tf_ulp/ulp_template_db_stingray_class.c +23 -46

163 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_template_db_wh_plus_act.c +6 -12
index 381278ee9..39e8ec40b 100644
@@ -12,38 +12,32 @@ struct bnxt_ulp_mapper_tbl_list_info ulp_wh_plus_act_tmpl_list[] = {
 	[1] = {
 	.device_name = BNXT_ULP_DEVICE_ID_WH_PLUS,
 	.num_tbls = 6,
-	.start_tbl_idx = 0,
-	.flow_db_table_type = BNXT_ULP_FDB_TYPE_REGULAR
+	.start_tbl_idx = 0
 	},
 	[2] = {
 	.device_name = BNXT_ULP_DEVICE_ID_WH_PLUS,
 	.num_tbls = 3,
-	.start_tbl_idx = 6,
-	.flow_db_table_type = BNXT_ULP_FDB_TYPE_REGULAR
+	.start_tbl_idx = 6
 	},
 	[3] = {
 	.device_name = BNXT_ULP_DEVICE_ID_WH_PLUS,
 	.num_tbls = 3,
-	.start_tbl_idx = 9,
-	.flow_db_table_type = BNXT_ULP_FDB_TYPE_REGULAR
+	.start_tbl_idx = 9
 	},
 	[4] = {
 	.device_name = BNXT_ULP_DEVICE_ID_WH_PLUS,
 	.num_tbls = 6,
-	.start_tbl_idx = 12,
-	.flow_db_table_type = BNXT_ULP_FDB_TYPE_REGULAR
+	.start_tbl_idx = 12
 	},
 	[5] = {
 	.device_name = BNXT_ULP_DEVICE_ID_WH_PLUS,
 	.num_tbls = 6,
-	.start_tbl_idx = 18,
-	.flow_db_table_type = BNXT_ULP_FDB_TYPE_REGULAR
+	.start_tbl_idx = 18
 	},
 	[6] = {
 	.device_name = BNXT_ULP_DEVICE_ID_WH_PLUS,
 	.num_tbls = 5,
-	.start_tbl_idx = 24,
-	.flow_db_table_type = BNXT_ULP_FDB_TYPE_REGULAR
+	.start_tbl_idx = 24
 	}
 };
 
drivers/net/bnxt/tf_ulp/ulp_template_db_wh_plus_class.c +23 -46

163 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_template_struct.h +0 -1
index 107a06a3d..69bb61e11 100644
@@ -175,7 +175,6 @@ struct bnxt_ulp_mapper_tbl_list_info {
 	uint32_t		device_name;
 	uint32_t		start_tbl_idx;
 	uint32_t		num_tbls;
-	enum bnxt_ulp_fdb_type	flow_db_table_type;
 };
 
 struct bnxt_ulp_mapper_tbl_info {
Signature · 1 line
2.21.1 (Apple Git-122.3)
#25 lore raw

PATCH v2 12/12 net/bnxt: add parent child flow create and free

In reply to Somnath Kotur

From: Kishore Padmanabha <[email protected]>

Added support in the ULP mapper to enable parent child flow creation and destroy. This feature enables support for the vxlan decap functionality.

---
 drivers/net/bnxt/tf_ulp/ulp_flow_db.c         | 177 +++++++++++++++++-
 drivers/net/bnxt/tf_ulp/ulp_flow_db.h         |  36 ++++
 drivers/net/bnxt/tf_ulp/ulp_mapper.c          |  87 ++++++++-
 drivers/net/bnxt/tf_ulp/ulp_mapper.h          |   7 +
 .../net/bnxt/tf_ulp/ulp_template_db_enum.h    |   5 +-
 5 files changed, 302 insertions(+), 10 deletions(-)
drivers/net/bnxt/tf_ulp/ulp_flow_db.c +171 -6
index a1c39329f..3be748908 100644
@@ -6,10 +6,10 @@
 #include <rte_malloc.h>
 #include "bnxt.h"
 #include "bnxt_tf_common.h"
-#include "ulp_flow_db.h"
 #include "ulp_utils.h"
 #include "ulp_template_struct.h"
 #include "ulp_mapper.h"
+#include "ulp_flow_db.h"
 #include "ulp_fc_mgr.h"
 
 #define ULP_FLOW_DB_RES_DIR_BIT		31
@@ -56,10 +56,10 @@ ulp_flow_db_active_flows_bit_set(struct bnxt_ulp_flow_db *flow_db,
 	} else {
 		if (flow_type == BNXT_ULP_FDB_TYPE_REGULAR)
 			ULP_INDEX_BITMAP_RESET(f_tbl->active_reg_flows[a_idx],
-					     idx);
+					       idx);
 		else
 			ULP_INDEX_BITMAP_RESET(f_tbl->active_dflt_flows[a_idx],
-					     idx);
+					       idx);
 	}
 }
 
@@ -89,6 +89,13 @@ ulp_flow_db_active_flows_bit_is_set(struct bnxt_ulp_flow_db *flow_db,
 					    idx);
 }
 
+static inline enum tf_dir
+ulp_flow_db_resource_dir_get(struct ulp_fdb_resource_info *res_info)
+{
+	return ((res_info->nxt_resource_idx & ULP_FLOW_DB_RES_DIR_MASK) >>
+		ULP_FLOW_DB_RES_DIR_BIT);
+}
+
 static uint8_t
 ulp_flow_db_resource_func_get(struct ulp_fdb_resource_info *res_info)
 {
@@ -157,11 +164,9 @@ ulp_flow_db_res_info_to_params(struct ulp_fdb_resource_info *resource_info,
 			       struct ulp_flow_db_res_params *params)
 {
 	memset(params, 0, sizeof(struct ulp_flow_db_res_params));
-	params->direction = ((resource_info->nxt_resource_idx &
-				 ULP_FLOW_DB_RES_DIR_MASK) >>
-				 ULP_FLOW_DB_RES_DIR_BIT);
 
 	/* use the helper function to get the resource func */
+	params->direction = ulp_flow_db_resource_dir_get(resource_info);
 	params->resource_func = ulp_flow_db_resource_func_get(resource_info);
 
 	if (params->resource_func == BNXT_ULP_RESOURCE_FUNC_EXT_EM_TABLE ||
@@ -303,6 +308,9 @@ ulp_flow_db_parent_tbl_init(struct bnxt_ulp_flow_db *flow_db,
 	struct ulp_fdb_parent_child_db *p_db;
 	uint32_t size, idx;
 
+	if (!num_entries)
+		return 0;
+
 	/* update the sizes for the allocation */
 	p_db = &flow_db->parent_child_db;
 	p_db->child_bitset_size = (flow_db->flow_tbl.num_flows /
@@ -1171,6 +1179,12 @@ ulp_flow_db_parent_flow_alloc(struct bnxt_ulp_context *ulp_ctxt,
 		return -EINVAL;
 	}
 
+	/* No support for parent child db then just exit */
+	if (!flow_db->parent_child_db.entries_count) {
+		BNXT_TF_DBG(ERR, "parent child db not supported\n");
+		return -EINVAL;
+	}
+
 	p_pdb = &flow_db->parent_child_db;
 	for (idx = 0; idx <= p_pdb->entries_count; idx++) {
 		if (p_pdb->parent_flow_tbl[idx].parent_fid == fid) {
@@ -1220,6 +1234,12 @@ ulp_flow_db_parent_flow_free(struct bnxt_ulp_context *ulp_ctxt,
 		return -EINVAL;
 	}
 
+	/* No support for parent child db then just exit */
+	if (!flow_db->parent_child_db.entries_count) {
+		BNXT_TF_DBG(ERR, "parent child db not supported\n");
+		return -EINVAL;
+	}
+
 	p_pdb = &flow_db->parent_child_db;
 	for (idx = 0; idx <= p_pdb->entries_count; idx++) {
 		if (p_pdb->parent_flow_tbl[idx].parent_fid == fid) {
@@ -1273,6 +1293,12 @@ ulp_flow_db_parent_child_flow_set(struct bnxt_ulp_context *ulp_ctxt,
 		return -EINVAL;
 	}
 
+	/* No support for parent child db then just exit */
+	if (!flow_db->parent_child_db.entries_count) {
+		BNXT_TF_DBG(ERR, "parent child db not supported\n");
+		return -EINVAL;
+	}
+
 	p_pdb = &flow_db->parent_child_db;
 	a_idx = child_fid / ULP_INDEX_BITMAP_SIZE;
 	for (idx = 0; idx <= p_pdb->entries_count; idx++) {
@@ -1320,6 +1346,12 @@ ulp_flow_db_parent_flow_idx_get(struct bnxt_ulp_context *ulp_ctxt,
 		return -EINVAL;
 	}
 
+	/* No support for parent child db then just exit */
+	if (!flow_db->parent_child_db.entries_count) {
+		BNXT_TF_DBG(ERR, "parent child db not supported\n");
+		return -EINVAL;
+	}
+
 	p_pdb = &flow_db->parent_child_db;
 	for (idx = 0; idx <= p_pdb->entries_count; idx++) {
 		if (p_pdb->parent_flow_tbl[idx].parent_fid == parent_fid) {
@@ -1392,3 +1424,136 @@ ulp_flow_db_parent_child_flow_next_entry_get(struct bnxt_ulp_flow_db *flow_db,
 	*child_fid = next_fid;
 	return 0;
 }
+
+/*
+ * Orphan the child flow entry
+ * This is called only for child flows that have
+ * BNXT_ULP_RESOURCE_FUNC_CHILD_FLOW resource
+ *
+ * ulp_ctxt [in] Ptr to ulp_context
+ * flow_type [in] Specify it is regular or default flow
+ * fid [in] The index to the flow entry
+ *
+ * Returns 0 on success and negative on failure.
+ */
+int32_t
+ulp_flow_db_child_flow_reset(struct bnxt_ulp_context *ulp_ctxt,
+			     enum bnxt_ulp_fdb_type flow_type,
+			     uint32_t fid)
+{
+	struct bnxt_ulp_flow_db *flow_db;
+	struct bnxt_ulp_flow_tbl *flow_tbl;
+	struct ulp_fdb_resource_info *fid_res;
+	uint32_t res_id = 0;
+
+	flow_db = bnxt_ulp_cntxt_ptr2_flow_db_get(ulp_ctxt);
+	if (!flow_db) {
+		BNXT_TF_DBG(ERR, "Invalid Arguments\n");
+		return -EINVAL;
+	}
+
+	if (flow_type > BNXT_ULP_FDB_TYPE_DEFAULT) {
+		BNXT_TF_DBG(ERR, "Invalid flow type\n");
+		return -EINVAL;
+	}
+
+	flow_tbl = &flow_db->flow_tbl;
+	/* check for max flows */
+	if (fid >= flow_tbl->num_flows || !fid) {
+		BNXT_TF_DBG(ERR, "Invalid flow index %x\n", fid);
+		return -EINVAL;
+	}
+
+	/* check if the flow is active or not */
+	if (!ulp_flow_db_active_flows_bit_is_set(flow_db, flow_type, fid)) {
+		BNXT_TF_DBG(ERR, "flow does not exist\n");
+		return -EINVAL;
+	}
+
+	/* Iterate the resource to get the resource handle */
+	res_id =  fid;
+	while (res_id) {
+		fid_res = &flow_tbl->flow_resources[res_id];
+		if (ulp_flow_db_resource_func_get(fid_res) ==
+		    BNXT_ULP_RESOURCE_FUNC_CHILD_FLOW) {
+			/* invalidate the resource details */
+			fid_res->resource_hndl = 0;
+			return 0;
+		}
+		res_id = 0;
+		ULP_FLOW_DB_RES_NXT_SET(res_id, fid_res->nxt_resource_idx);
+	}
+	/* failed */
+	return -1;
+}
+
+/*
+ * Create parent flow in the parent flow tbl
+ *
+ * parms [in] Ptr to mapper params
+ *
+ * Returns 0 on success and negative on failure.
+ */
+int32_t
+ulp_flow_db_parent_flow_create(struct bnxt_ulp_mapper_parms *parms)
+{
+	struct ulp_flow_db_res_params fid_parms;
+	int32_t fid_idx;
+
+	/* create the child flow entry in parent flow table */
+	fid_idx = ulp_flow_db_parent_flow_alloc(parms->ulp_ctx, parms->fid);
+	if (fid_idx < 0) {
+		BNXT_TF_DBG(ERR, "Error in creating parent flow fid %x\n",
+			    parms->fid);
+		return -1;
+	}
+
+	/* Add the parent details in the resource list of the flow */
+	memset(&fid_parms, 0, sizeof(fid_parms));
+	fid_parms.resource_func	= BNXT_ULP_RESOURCE_FUNC_PARENT_FLOW;
+	fid_parms.resource_hndl	= fid_idx;
+	fid_parms.critical_resource = BNXT_ULP_CRITICAL_RESOURCE_NO;
+	if (ulp_flow_db_resource_add(parms->ulp_ctx, BNXT_ULP_FDB_TYPE_REGULAR,
+				     parms->fid, &fid_parms)) {
+		BNXT_TF_DBG(ERR, "Error in adding flow res for fid %x\n",
+			    parms->fid);
+		return -1;
+	}
+	return 0;
+}
+
+/*
+ * Create child flow in the parent flow tbl
+ *
+ * parms [in] Ptr to mapper params
+ *
+ * Returns 0 on success and negative on failure.
+ */
+int32_t
+ulp_flow_db_child_flow_create(struct bnxt_ulp_mapper_parms *parms)
+{
+	struct ulp_flow_db_res_params fid_parms;
+	int32_t rc;
+
+	/* create the parent flow entry in parent flow table */
+	rc = ulp_flow_db_parent_child_flow_set(parms->ulp_ctx,
+					       parms->parent_fid,
+					       parms->fid, 1);
+	if (rc) {
+		BNXT_TF_DBG(ERR, "Error in setting child fid %x\n", parms->fid);
+		return -1;
+	}
+
+	/* Add the parent details in the resource list of the flow */
+	memset(&fid_parms, 0, sizeof(fid_parms));
+	fid_parms.resource_func	= BNXT_ULP_RESOURCE_FUNC_CHILD_FLOW;
+	fid_parms.resource_hndl	= parms->parent_fid;
+	fid_parms.critical_resource = BNXT_ULP_CRITICAL_RESOURCE_NO;
+	if (ulp_flow_db_resource_add(parms->ulp_ctx, BNXT_ULP_FDB_TYPE_REGULAR,
+				     parms->fid, &fid_parms)) {
+		BNXT_TF_DBG(ERR, "Error in adding flow res for fid %x\n",
+			    parms->fid);
+		return -1;
+	}
+	return 0;
+}
drivers/net/bnxt/tf_ulp/ulp_flow_db.h +36 -0
index 87bcd69ae..95fd1992d 100644
@@ -8,6 +8,7 @@
 
 #include "bnxt_ulp.h"
 #include "ulp_template_db_enum.h"
+#include "ulp_mapper.h"
 
 #define BNXT_FLOW_DB_DEFAULT_NUM_FLOWS		512
 #define BNXT_FLOW_DB_DEFAULT_NUM_RESOURCES	8
@@ -319,5 +320,40 @@ ulp_flow_db_parent_child_flow_next_entry_get(struct bnxt_ulp_flow_db *flow_db,
 					     uint32_t parent_idx,
 					     uint32_t *child_fid);
 
+/*
+ * Orphan the child flow entry
+ * This is called only for child flows that have
+ * BNXT_ULP_RESOURCE_FUNC_CHILD_FLOW resource
+ *
+ * ulp_ctxt [in] Ptr to ulp_context
+ * flow_type [in] Specify it is regular or default flow
+ * fid [in] The index to the flow entry
+ *
+ * Returns 0 on success and negative on failure.
+ */
+int32_t
+ulp_flow_db_child_flow_reset(struct bnxt_ulp_context *ulp_ctxt,
+			     enum bnxt_ulp_fdb_type flow_type,
+			     uint32_t fid);
+
+/*
+ * Create parent flow in the parent flow tbl
+ *
+ * parms [in] Ptr to mapper params
+ *
+ * Returns 0 on success and negative on failure.
+ */
+int32_t
+ulp_flow_db_parent_flow_create(struct bnxt_ulp_mapper_parms *parms);
+
+/*
+ * Create child flow in the parent flow tbl
+ *
+ * parms [in] Ptr to mapper params
+ *
+ * Returns 0 on success and negative on failure.
+ */
+int32_t
+ulp_flow_db_child_flow_create(struct bnxt_ulp_mapper_parms *parms);
 
 #endif /* _ULP_FLOW_DB_H_ */
drivers/net/bnxt/tf_ulp/ulp_mapper.c +84 -3

136 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_mapper.h +7 -0
index 6f93bcdc1..542e41e5a 100644
@@ -76,6 +76,8 @@ struct bnxt_ulp_mapper_parms {
 	enum bnxt_ulp_cache_table_opc		tcam_tbl_opc;
 	struct bnxt_ulp_mapper_cache_entry	*cache_ptr;
 	struct bnxt_ulp_device_params           *device_params;
+	uint32_t				parent_fid;
+	uint32_t				parent_flow;
 };
 
 struct bnxt_ulp_mapper_create_parms {
@@ -90,6 +92,11 @@ struct bnxt_ulp_mapper_create_parms {
 	uint16_t			func_id;
 	uint32_t			dir_attr;
 	enum bnxt_ulp_fdb_type		flow_type;
+
+	/* 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 */
+	uint32_t			parent_flow;
 };
 
 /* Function to initialize any dynamic mapper data. */
drivers/net/bnxt/tf_ulp/ulp_template_db_enum.h +4 -1
index 81da34e3a..168e308c2 100644
@@ -321,7 +321,10 @@ enum bnxt_ulp_resource_func {
 	BNXT_ULP_RESOURCE_FUNC_CACHE_TABLE = 0x82,
 	BNXT_ULP_RESOURCE_FUNC_IDENTIFIER = 0x83,
 	BNXT_ULP_RESOURCE_FUNC_IF_TABLE = 0x84,
-	BNXT_ULP_RESOURCE_FUNC_HW_FID = 0x85
+	BNXT_ULP_RESOURCE_FUNC_HW_FID = 0x85,
+	BNXT_ULP_RESOURCE_FUNC_SHARED_TABLE = 0x86,
+	BNXT_ULP_RESOURCE_FUNC_PARENT_FLOW = 0x87,
+	BNXT_ULP_RESOURCE_FUNC_CHILD_FLOW = 0x88
 };
 
 enum bnxt_ulp_resource_sub_type {
Signature · 1 line
2.21.1 (Apple Git-122.3)
#26 lore raw

v2 cover bnxt patches

In reply to Somnath Kotur

Fixes and enchancements in the bnxt PMD, mostly in the TRUFLOW layer, including templates to add support for Stingray device.

v2:
- squashed patch patch 13 to patch 7
- updated and fixed commit logs
- updated docs and release notes where necessary

Kishore Padmanabha (4):
net/bnxt: fix the corruption of the session details net/bnxt: combine default and regular flows net/bnxt: add support for parent child flow database net/bnxt: add parent child flow create and free

Mike Baucom (6):
net/bnxt: add multi-device infrastructure net/bnxt: add Stingray device support to ULP net/bnxt: consolidate template table processing net/bnxt: support runtime EM selection net/bnxt: consolidate template table processing net/bnxt: remove flow db table type from templates

Venkat Duvvuru (2):
net/bnxt: fix PMD PF support in SR-IOV mode net/bnxt: handle default vnic change async event

 doc/guides/nics/bnxt.rst                      |    42 +
 doc/guides/rel_notes/release_20_11.rst        |     1 +
 drivers/net/bnxt/bnxt.h                       |     6 +-
 drivers/net/bnxt/bnxt_cpr.c                   |    13 +-
 drivers/net/bnxt/bnxt_ethdev.c                |    40 +-
 drivers/net/bnxt/bnxt_hwrm.c                  |   463 +-
 drivers/net/bnxt/bnxt_hwrm.h                  |    12 +-
 drivers/net/bnxt/meson.build                  |     4 +
 drivers/net/bnxt/tf_ulp/bnxt_ulp.c            |   387 +-
 drivers/net/bnxt/tf_ulp/bnxt_ulp.h            |    11 +
 drivers/net/bnxt/tf_ulp/bnxt_ulp_flow.c       |     5 +-
 drivers/net/bnxt/tf_ulp/ulp_def_rules.c       |     5 +-
 drivers/net/bnxt/tf_ulp/ulp_fc_mgr.c          |     2 +-
 drivers/net/bnxt/tf_ulp/ulp_flow_db.c         |   892 +-
 drivers/net/bnxt/tf_ulp/ulp_flow_db.h         |   179 +-
 drivers/net/bnxt/tf_ulp/ulp_mapper.c          |   520 +-
 drivers/net/bnxt/tf_ulp/ulp_mapper.h          |    22 +-
 drivers/net/bnxt/tf_ulp/ulp_template_db_act.c |  1810 --
 .../net/bnxt/tf_ulp/ulp_template_db_class.c   | 16271 -------------
 .../net/bnxt/tf_ulp/ulp_template_db_enum.h    |    18 +-
 .../tf_ulp/ulp_template_db_stingray_act.c     |  3305 +++
 .../tf_ulp/ulp_template_db_stingray_class.c   | 19005 ++++++++++++++++
 drivers/net/bnxt/tf_ulp/ulp_template_db_tbl.c |    59 +-
 drivers/net/bnxt/tf_ulp/ulp_template_db_tbl.h |    48 +
 .../bnxt/tf_ulp/ulp_template_db_wh_plus_act.c |  3304 +++
 .../tf_ulp/ulp_template_db_wh_plus_class.c    | 19005 ++++++++++++++++
 drivers/net/bnxt/tf_ulp/ulp_template_struct.h |    64 +-
 drivers/net/bnxt/tf_ulp/ulp_utils.h           |     4 +
 28 files changed, 46530 insertions(+), 18967 deletions(-)
 create mode 100644 drivers/net/bnxt/tf_ulp/ulp_template_db_stingray_act.c
 create mode 100644 drivers/net/bnxt/tf_ulp/ulp_template_db_stingray_class.c
 create mode 100644 drivers/net/bnxt/tf_ulp/ulp_template_db_tbl.h
 create mode 100644 drivers/net/bnxt/tf_ulp/ulp_template_db_wh_plus_act.c
 create mode 100644 drivers/net/bnxt/tf_ulp/ulp_template_db_wh_plus_class.c
Signature · 1 line
2.21.1 (Apple Git-122.3)
#27 lore raw

PATCH v2 1/12 net/bnxt: fix the corruption of the session details

From: Kishore Padmanabha <[email protected]>

The session details that is shared among multiple ports need to be outside the bnxt structure.

Fixes 70e64b27af5b ("net/bnxt: support ULP session manager cleanup")
---
 drivers/net/bnxt/tf_ulp/bnxt_ulp.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/net/bnxt/tf_ulp/bnxt_ulp.c +4 -1
index 289619411..a4d48c71a 100644
@@ -159,7 +159,9 @@ ulp_ctx_session_open(struct bnxt *bp,
 	}
 	if (!session->session_opened) {
 		session->session_opened = 1;
-		session->g_tfp = &bp->tfp;
+		session->g_tfp = rte_zmalloc("bnxt_ulp_session_tfp",
+					     sizeof(struct tf), 0);
+		session->g_tfp->session = bp->tfp.session;
 	}
 	return rc;
 }
@@ -176,6 +178,7 @@ ulp_ctx_session_close(struct bnxt *bp,
 	if (session->session_opened)
 		tf_close_session(&bp->tfp);
 	session->session_opened = 0;
+	rte_free(session->g_tfp);
 	session->g_tfp = NULL;
 }
 
Signature · 1 line
2.21.1 (Apple Git-122.3)
#28 lore raw

PATCH v2 2/12 net/bnxt: add multi-device infrastructure

In reply to Ajit Khaparde

From: Mike Baucom <[email protected]>

In order to support multiple devices this patch:
- Breaks the template into device specific files
- Changes template list retrieval to use device id
- Determines the software device id using the bp pointer
- Determines the TRUFLOW resources based on device id

---
 drivers/net/bnxt/meson.build                  |     2 +
 drivers/net/bnxt/tf_ulp/bnxt_ulp.c            |   223 +-
 drivers/net/bnxt/tf_ulp/ulp_mapper.c          |   150 +-
 drivers/net/bnxt/tf_ulp/ulp_template_db_act.c |  1810 --
 .../net/bnxt/tf_ulp/ulp_template_db_class.c   | 16271 ----------------
 drivers/net/bnxt/tf_ulp/ulp_template_db_tbl.c |    16 +-
 drivers/net/bnxt/tf_ulp/ulp_template_db_tbl.h |    29 +
 .../bnxt/tf_ulp/ulp_template_db_wh_plus_act.c |  1813 ++
 .../tf_ulp/ulp_template_db_wh_plus_class.c    | 16258 +++++++++++++++
 drivers/net/bnxt/tf_ulp/ulp_template_struct.h |    58 +-
 10 files changed, 18355 insertions(+), 18275 deletions(-)
 create mode 100644 drivers/net/bnxt/tf_ulp/ulp_template_db_tbl.h
 create mode 100644 drivers/net/bnxt/tf_ulp/ulp_template_db_wh_plus_act.c
 create mode 100644 drivers/net/bnxt/tf_ulp/ulp_template_db_wh_plus_class.c
drivers/net/bnxt/meson.build +2 -0
index a89d1f97c..b00da6074 100644
@@ -64,6 +64,8 @@ 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_template_db_wh_plus_act.c',
+	'tf_ulp/ulp_template_db_wh_plus_class.c',
 
 	'rte_pmd_bnxt.c')
 
drivers/net/bnxt/tf_ulp/bnxt_ulp.c +148 -75

259 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_mapper.c +77 -73

384 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_template_db_act.c +0 -1810

1,813 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_template_db_class.c +0 -16271

536 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_template_db_tbl.c +15 -1
index f2e2a5950..9cf62a094 100644

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

drivers/net/bnxt/tf_ulp/ulp_template_db_tbl.h new file +29 -0
new file mode 100644
index 000000000..55c33851d

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

drivers/net/bnxt/tf_ulp/ulp_template_db_wh_plus_act.c new file +1813 -0

1,813 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_template_db_wh_plus_class.c new file +16258 -0

16,258 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_template_struct.h +13 -45

58 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.

#29 lore raw

PATCH v2 3/12 net/bnxt: add Stingray device support to ULP

In reply to Ajit Khaparde

From: Mike Baucom <[email protected]>

- Add new template files for Stingray
- Add new TRUFLOW resources for Stingray

---
 doc/guides/nics/bnxt.rst                      |    29 +
 doc/guides/rel_notes/release_20_11.rst        |     1 +
 drivers/net/bnxt/meson.build                  |     2 +
 drivers/net/bnxt/tf_ulp/bnxt_ulp.c            |    81 +-
 .../tf_ulp/ulp_template_db_stingray_act.c     |  1813 ++
 .../tf_ulp/ulp_template_db_stingray_class.c   | 16258 ++++++++++++++++
 drivers/net/bnxt/tf_ulp/ulp_template_db_tbl.h |    19 +
 7 files changed, 18202 insertions(+), 1 deletion(-)
 create mode 100644 drivers/net/bnxt/tf_ulp/ulp_template_db_stingray_act.c
 create mode 100644 drivers/net/bnxt/tf_ulp/ulp_template_db_stingray_class.c
doc/guides/nics/bnxt.rst +29 -0
index 129a16cfc..553f57178 100644
@@ -734,6 +734,35 @@ Note that currently hot-plugging of representor ports is not supported so all
 the required representors must be specified on the creation of the PF or the
 trusted VF.
 
+Representors on Stingray SoC
+----------------------------
+A representor created on X86 host typically represents a VF running in the same
+X86 domain. But in case of the SoC, the application can run on the CPU complex
+inside the SoC. The representor can be created on the SoC to represent a PF or a
+VF running in the x86 domain. Since the representator creation requires passing
+the bus:device.function of the PCI device endpoint which is not necessarily in the
+same host domain, additional dev args have been added to the PMD.
+
+* rep_is_vf - false to indicate VF representor
+* rep_is_pf - true to indicate PF representor
+* rep_based_pf - Physical index of the PF
+* rep_q_r2f - Logical COS Queue index for the rep to endpoint direction
+* rep_q_f2r - Logical COS Queue index for the endpoint to rep direction
+* rep_fc_r2f - Flow control for the representor to endpoint direction
+* rep_fc_f2r - Flow control for the endpoint to representor direction
+
+The sample command line with the new ``devargs`` looks like this::
+
+  -w 0000:06:02.0,host-based-truflow=1,representor=[1],rep-based-pf=8,\
+	rep-is-pf=1,rep-q-r2f=1,rep-fc-r2f=0,rep-q-f2r=1,rep-fc-f2r=1
+
+.. code-block:: console
+
+	testpmd -l1-4 -n2 -w 0008:01:00.0,host-based-truflow=1,\
+	representor=[0], rep-based-pf=8,rep-is-pf=0,rep-q-r2f=1,rep-fc-r2f=1,\
+	rep-q-f2r=0,rep-fc-f2r=1 --log-level="pmd.*",8 -- -i --rxq=3 --txq=3
+
+
 Application Support
 -------------------
 
doc/guides/rel_notes/release_20_11.rst +1 -0
index 26cc0949a..ee97bb7c3 100644
@@ -67,6 +67,7 @@ New Features
   * Added support for 200G PAM4 link speed.
   * Added support for RSS hash level selection.
   * Updated HWRM structures to 1.10.1.70 version.
+  * Added TRUFLOW support for Stingray devices.
 
 * **Updated Cisco enic driver.**
 
drivers/net/bnxt/meson.build +2 -0
index b00da6074..39521080f 100644
@@ -66,6 +66,8 @@ sources = files('bnxt_cpr.c',
 	'tf_ulp/ulp_fc_mgr.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',
+	'tf_ulp/ulp_template_db_stingray_class.c',
 
 	'rte_pmd_bnxt.c')
 
drivers/net/bnxt/tf_ulp/bnxt_ulp.c +80 -1

103 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_template_db_stingray_act.c new file +1813 -0

1,813 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_template_db_stingray_class.c new file +16258 -0

1,034 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_template_db_tbl.h +19 -0
index 55c33851d..93f87f32b 100644

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

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

Signature · 1 line
2.21.1 (Apple Git-122.3)

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

#30 lore raw

PATCH v2 4/12 net/bnxt: fix PMD PF support in SR-IOV mode

In reply to Ajit Khaparde

From: Venkat Duvvuru <[email protected]>

1. Implement HWRM_FUNC_VF_RESOURCE_CFG command and use it to reserve resources for VFs when NEW RM is enabled.
2. Invoke PF’s FUNC_CFG before configuring VFs resources.
3. Don’t consider max_rx_em_flows in max_l2_ctx calculation when VFs are configured.
4. Issue HWRM_FUNC_QCFG instead of HWRM_FUNC_QCAPS to find out the actual allocated resources for VF.
5. Don’t add random mac to the VF.
6. Handle completion type CMPL_BASE_TYPE_HWRM_FWD_REQ instead of CMPL_BASE_TYPE_HWRM_FWD_RESP.
7. Don't enable HWRM_FUNC_DRV_RGTR_INPUT_FLAGS_FWD_NONE_MODE when the list of HWRM commands that needs to be forwarded to the PF is specified in HWRM_FUNC_DRV_RGTR.
8. Update the HWRM commands list that can be forwared to the PF.

Fixes b7778e8a1c00 ("net/bnxt: refactor to properly allocate resources for PF/VF")
---
 drivers/net/bnxt/bnxt.h        |   6 +-
 drivers/net/bnxt/bnxt_cpr.c    |   6 +-
 drivers/net/bnxt/bnxt_ethdev.c |  40 +--
 drivers/net/bnxt/bnxt_hwrm.c   | 461 ++++++++++++++++++++-------------
 drivers/net/bnxt/bnxt_hwrm.h   |  12 +-
 5 files changed, 309 insertions(+), 216 deletions(-)
drivers/net/bnxt/bnxt.h +5 -1
index eca74486e..a951bca7a 100644
@@ -167,6 +167,9 @@
 #define	BNXT_DEFAULT_VNIC_CHANGE_VF_ID_SFT		\
 	HWRM_ASYNC_EVENT_CMPL_DEFAULT_VNIC_CHANGE_EVENT_DATA1_VF_ID_SFT
 
+#define BNXT_HWRM_CMD_TO_FORWARD(cmd)	\
+		(bp->pf->vf_req_fwd[(cmd) / 32] |= (1 << ((cmd) % 32)))
+
 struct bnxt_led_info {
 	uint8_t	     num_leds;
 	uint8_t      led_id;
@@ -664,9 +667,10 @@ struct bnxt {
 #define BNXT_FW_CAP_IF_CHANGE		BIT(1)
 #define BNXT_FW_CAP_ERROR_RECOVERY	BIT(2)
 #define BNXT_FW_CAP_ERR_RECOVER_RELOAD	BIT(3)
+#define BNXT_FW_CAP_HCOMM_FW_STATUS	BIT(4)
 #define BNXT_FW_CAP_ADV_FLOW_MGMT	BIT(5)
 #define BNXT_FW_CAP_ADV_FLOW_COUNTERS	BIT(6)
-#define BNXT_FW_CAP_HCOMM_FW_STATUS	BIT(7)
+#define BNXT_FW_CAP_LINK_ADMIN		BIT(7)
 
 	pthread_mutex_t         flow_lock;
 
drivers/net/bnxt/bnxt_cpr.c +4 -2
index a3a7e6ab7..54923948f 100644
@@ -239,7 +239,7 @@ void bnxt_handle_fwd_req(struct bnxt *bp, struct cmpl_base *cmpl)
 		goto reject;
 	}
 
-	if (bnxt_rcv_msg_from_vf(bp, vf_id, fwd_cmd) == true) {
+	if (bnxt_rcv_msg_from_vf(bp, vf_id, fwd_cmd)) {
 		/*
 		 * In older firmware versions, the MAC had to be all zeros for
 		 * the VF to set it's MAC via hwrm_func_vf_cfg. Set to all
@@ -254,6 +254,7 @@ void bnxt_handle_fwd_req(struct bnxt *bp, struct cmpl_base *cmpl)
 				(const uint8_t *)"\x00\x00\x00\x00\x00");
 			}
 		}
+
 		if (fwd_cmd->req_type == HWRM_CFA_L2_SET_RX_MASK) {
 			struct hwrm_cfa_l2_set_rx_mask_input *srm =
 							(void *)fwd_cmd;
@@ -265,6 +266,7 @@ void bnxt_handle_fwd_req(struct bnxt *bp, struct cmpl_base *cmpl)
 			    HWRM_CFA_L2_SET_RX_MASK_INPUT_MASK_VLAN_NONVLAN |
 			    HWRM_CFA_L2_SET_RX_MASK_INPUT_MASK_ANYVLAN_NONVLAN);
 		}
+
 		/* Forward */
 		rc = bnxt_hwrm_exec_fwd_resp(bp, fw_vf_id, fwd_cmd, req_len);
 		if (rc) {
@@ -306,7 +308,7 @@ int bnxt_event_hwrm_resp_handler(struct bnxt *bp, struct cmpl_base *cmp)
 		bnxt_handle_async_event(bp, cmp);
 		evt = 1;
 		break;
-	case CMPL_BASE_TYPE_HWRM_FWD_RESP:
+	case CMPL_BASE_TYPE_HWRM_FWD_REQ:
 		/* Handle HWRM forwarded responses */
 		bnxt_handle_fwd_req(bp, cmp);
 		evt = 1;
drivers/net/bnxt/bnxt_ethdev.c +10 -30
index 8b63134c3..b4654ec6a 100644
@@ -5208,37 +5208,14 @@ static void bnxt_config_vf_req_fwd(struct bnxt *bp)
 	if (!BNXT_PF(bp))
 		return;
 
-#define ALLOW_FUNC(x)	\
-	{ \
-		uint32_t arg = (x); \
-		bp->pf->vf_req_fwd[((arg) >> 5)] &= \
-		~rte_cpu_to_le_32(1 << ((arg) & 0x1f)); \
-	}
-
-	/* Forward all requests if firmware is new enough */
-	if (((bp->fw_ver >= ((20 << 24) | (6 << 16) | (100 << 8))) &&
-	     (bp->fw_ver < ((20 << 24) | (7 << 16)))) ||
-	    ((bp->fw_ver >= ((20 << 24) | (8 << 16))))) {
-		memset(bp->pf->vf_req_fwd, 0xff, sizeof(bp->pf->vf_req_fwd));
-	} else {
-		PMD_DRV_LOG(WARNING,
-			    "Firmware too old for VF mailbox functionality\n");
-		memset(bp->pf->vf_req_fwd, 0, sizeof(bp->pf->vf_req_fwd));
-	}
+	memset(bp->pf->vf_req_fwd, 0, sizeof(bp->pf->vf_req_fwd));
 
-	/*
-	 * The following are used for driver cleanup. If we disallow these,
-	 * VF drivers can't clean up cleanly.
-	 */
-	ALLOW_FUNC(HWRM_FUNC_DRV_UNRGTR);
-	ALLOW_FUNC(HWRM_VNIC_FREE);
-	ALLOW_FUNC(HWRM_RING_FREE);
-	ALLOW_FUNC(HWRM_RING_GRP_FREE);
-	ALLOW_FUNC(HWRM_VNIC_RSS_COS_LB_CTX_FREE);
-	ALLOW_FUNC(HWRM_CFA_L2_FILTER_FREE);
-	ALLOW_FUNC(HWRM_STAT_CTX_FREE);
-	ALLOW_FUNC(HWRM_PORT_PHY_QCFG);
-	ALLOW_FUNC(HWRM_VNIC_TPA_CFG);
+	if (!(bp->fw_cap & BNXT_FW_CAP_LINK_ADMIN))
+		BNXT_HWRM_CMD_TO_FORWARD(HWRM_PORT_PHY_QCFG);
+	BNXT_HWRM_CMD_TO_FORWARD(HWRM_FUNC_CFG);
+	BNXT_HWRM_CMD_TO_FORWARD(HWRM_FUNC_VF_CFG);
+	BNXT_HWRM_CMD_TO_FORWARD(HWRM_CFA_L2_FILTER_ALLOC);
+	BNXT_HWRM_CMD_TO_FORWARD(HWRM_OEM_CMD);
 }
 
 uint16_t
@@ -6189,7 +6166,10 @@ bnxt_uninit_resources(struct bnxt *bp, bool reconfig_dev)
 
 	bnxt_free_int(bp);
 	bnxt_free_mem(bp, reconfig_dev);
+
 	bnxt_hwrm_func_buf_unrgtr(bp);
+	rte_free(bp->pf->vf_req_buf);
+
 	rc = bnxt_hwrm_func_driver_unregister(bp, 0);
 	bp->flags &= ~BNXT_FLAG_REGISTERED;
 	bnxt_free_ctx_mem(bp);
drivers/net/bnxt/bnxt_hwrm.c +279 -182

632 lines not on this page · raw message

drivers/net/bnxt/bnxt_hwrm.h +11 -1
index e98b1fe41..a7fa7f66b 100644
@@ -107,6 +107,16 @@ enum bnxt_flow_dir {
 	BNXT_DIR_MAX
 };
 
+struct bnxt_pf_resource_info {
+	uint16_t num_rsscos_ctxs;
+	uint16_t num_stat_ctxs;
+	uint16_t num_tx_rings;
+	uint16_t num_rx_rings;
+	uint16_t num_cp_rings;
+	uint16_t num_l2_ctxs;
+	uint32_t num_hw_ring_grps;
+};
+
 #define BNXT_CTX_VAL_INVAL	0xFFFF
 
 int bnxt_hwrm_cfa_l2_clear_rx_mask(struct bnxt *bp,
@@ -127,7 +137,7 @@ int bnxt_hwrm_exec_fwd_resp(struct bnxt *bp, uint16_t target_id,
 int bnxt_hwrm_reject_fwd_resp(struct bnxt *bp, uint16_t target_id,
 			      void *encaped, size_t ec_size);
 
-int bnxt_hwrm_func_buf_rgtr(struct bnxt *bp);
+int bnxt_hwrm_func_buf_rgtr(struct bnxt *bp, int num_vfs);
 int bnxt_hwrm_func_buf_unrgtr(struct bnxt *bp);
 int bnxt_hwrm_func_driver_register(struct bnxt *bp);
 int bnxt_hwrm_func_qcaps(struct bnxt *bp);
Signature · 1 line
2.21.1 (Apple Git-122.3)
#31 lore raw

PATCH v2 5/12 net/bnxt: consolidate template table processing

In reply to Ajit Khaparde

From: Mike Baucom <[email protected]>

The table processing has been consolidated to be able to reuse the same code for action and classification template processing.

---
 drivers/net/bnxt/tf_ulp/bnxt_ulp_flow.c       |   1 +
 drivers/net/bnxt/tf_ulp/ulp_def_rules.c       |   1 +
 drivers/net/bnxt/tf_ulp/ulp_mapper.c          | 298 +++++-------------
 drivers/net/bnxt/tf_ulp/ulp_mapper.h          |   4 +-
 .../net/bnxt/tf_ulp/ulp_template_db_enum.h    |   6 +
 .../tf_ulp/ulp_template_db_stingray_class.c   |   2 +-
 drivers/net/bnxt/tf_ulp/ulp_template_db_tbl.c |  56 +++-
 drivers/net/bnxt/tf_ulp/ulp_template_db_tbl.h |   4 +-
 .../tf_ulp/ulp_template_db_wh_plus_class.c    |   2 +-
 drivers/net/bnxt/tf_ulp/ulp_template_struct.h |  11 +-
 10 files changed, 144 insertions(+), 241 deletions(-)
drivers/net/bnxt/tf_ulp/bnxt_ulp_flow.c +1 -0
index 566e1254a..eea39f6b7 100644
@@ -147,6 +147,7 @@ bnxt_ulp_flow_create(struct rte_eth_dev *dev,
 	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;
 
 	/* Get the function id */
 	if (ulp_port_db_port_func_id_get(ulp_ctx,
drivers/net/bnxt/tf_ulp/ulp_def_rules.c +1 -0
index 8dea235f0..01f4fd087 100644
@@ -351,6 +351,7 @@ ulp_default_flow_create(struct rte_eth_dev *eth_dev,
 	}
 
 	mapper_params.class_tid = ulp_class_tid;
+	mapper_params.flow_type = BNXT_ULP_FDB_TYPE_DEFAULT;
 
 	rc = ulp_mapper_flow_create(ulp_ctx, &mapper_params, flow_id);
 	if (rc) {
drivers/net/bnxt/tf_ulp/ulp_mapper.c +79 -219

491 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_mapper.h +3 -1
index a19fb0d76..936fb9af4 100644
@@ -53,6 +53,7 @@ struct bnxt_ulp_mapper_data {
 
 /* Internal Structure for passing the arguments around */
 struct bnxt_ulp_mapper_parms {
+	enum bnxt_ulp_template_type		tmpl_type;
 	uint32_t				dev_id;
 	uint32_t				act_tid;
 	struct bnxt_ulp_mapper_tbl_info		*atbls; /* action table */
@@ -70,7 +71,7 @@ struct bnxt_ulp_mapper_parms {
 	struct bnxt_ulp_context			*ulp_ctx;
 	uint8_t					encap_byte_swap;
 	uint32_t				fid;
-	enum bnxt_ulp_flow_db_tables		tbl_idx;
+	enum bnxt_ulp_fdb_type			flow_type;
 	struct bnxt_ulp_mapper_data		*mapper_data;
 	enum bnxt_ulp_cache_table_opc		tcam_tbl_opc;
 	struct bnxt_ulp_mapper_cache_entry	*cache_ptr;
@@ -88,6 +89,7 @@ struct bnxt_ulp_mapper_create_parms {
 	uint32_t			act_tid;
 	uint16_t			func_id;
 	uint32_t			dir_attr;
+	enum bnxt_ulp_fdb_type		flow_type;
 };
 
 /* Function to initialize any dynamic mapper data. */
drivers/net/bnxt/tf_ulp/ulp_template_db_enum.h +6 -0
index de56b7ef9..e083af0ae 100644
@@ -278,6 +278,12 @@ enum bnxt_ulp_search_before_alloc {
 	BNXT_ULP_SEARCH_BEFORE_ALLOC_LAST = 3
 };
 
+enum bnxt_ulp_template_type {
+	BNXT_ULP_TEMPLATE_TYPE_CLASS = 0,
+	BNXT_ULP_TEMPLATE_TYPE_ACTION = 1,
+	BNXT_ULP_TEMPLATE_TYPE_LAST = 2
+};
+
 enum bnxt_ulp_fdb_resource_flags {
 	BNXT_ULP_FDB_RESOURCE_FLAGS_DIR_INGR = 0x00,
 	BNXT_ULP_FDB_RESOURCE_FLAGS_DIR_EGR = 0x01
drivers/net/bnxt/tf_ulp/ulp_template_db_stingray_class.c +1 -1
index 2d40cde8e..f365c5c5b 100644
@@ -15980,7 +15980,7 @@ struct bnxt_ulp_mapper_result_field_info ulp_class_stingray_result_field_list[]
 	}
 };
 
-struct bnxt_ulp_mapper_ident_info ulp_stingray_ident_list[] = {
+struct bnxt_ulp_mapper_ident_info ulp_class_stingray_ident_list[] = {
 	{
 	.resource_func = BNXT_ULP_RESOURCE_FUNC_IDENTIFIER,
 	.ident_type = TF_IDENT_TYPE_L2_CTXT_HIGH,
drivers/net/bnxt/tf_ulp/ulp_template_db_tbl.c +46 -10

68 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_template_db_tbl.h +2 -2
index 93f87f32b..7a541cb8e 100644
@@ -18,7 +18,7 @@ bnxt_ulp_mapper_class_key_field_info ulp_class_wh_plus_key_field_list[];
 extern struct
 bnxt_ulp_mapper_result_field_info ulp_class_wh_plus_result_field_list[];
 
-extern struct bnxt_ulp_mapper_ident_info ulp_wh_plus_ident_list[];
+extern struct bnxt_ulp_mapper_ident_info ulp_class_wh_plus_ident_list[];
 
 extern struct bnxt_ulp_mapper_tbl_list_info ulp_act_wh_plus_tmpl_list[];
 
@@ -37,7 +37,7 @@ bnxt_ulp_mapper_class_key_field_info ulp_class_stingray_key_field_list[];
 extern struct
 bnxt_ulp_mapper_result_field_info ulp_class_stingray_result_field_list[];
 
-extern struct bnxt_ulp_mapper_ident_info ulp_stingray_ident_list[];
+extern struct bnxt_ulp_mapper_ident_info ulp_class_stingray_ident_list[];
 
 extern struct bnxt_ulp_mapper_tbl_list_info ulp_act_stingray_tmpl_list[];
 
drivers/net/bnxt/tf_ulp/ulp_template_db_wh_plus_class.c +1 -1
index 10160f821..b747241cd 100644
@@ -15980,7 +15980,7 @@ struct bnxt_ulp_mapper_result_field_info ulp_class_wh_plus_result_field_list[] =
 	}
 };
 
-struct bnxt_ulp_mapper_ident_info ulp_wh_plus_ident_list[] = {
+struct bnxt_ulp_mapper_ident_info ulp_class_wh_plus_ident_list[] = {
 	{
 	.resource_func = BNXT_ULP_RESOURCE_FUNC_IDENTIFIER,
 	.ident_type = TF_IDENT_TYPE_L2_CTXT_HIGH,
drivers/net/bnxt/tf_ulp/ulp_template_struct.h +4 -7
index 621ccce15..026c42d1c 100644
@@ -142,14 +142,11 @@ extern struct bnxt_ulp_act_match_info ulp_act_match_list[];
 
 /* Device Specific Tables for mapper */
 struct ulp_template_device_tbls {
-	struct bnxt_ulp_mapper_tbl_list_info *class_tmpl_list;
-	struct bnxt_ulp_mapper_tbl_info *class_tbl_list;
-	struct bnxt_ulp_mapper_class_key_field_info *class_key_field_list;
-	struct bnxt_ulp_mapper_result_field_info *class_result_field_list;
+	struct bnxt_ulp_mapper_tbl_list_info *tmpl_list;
+	struct bnxt_ulp_mapper_tbl_info *tbl_list;
+	struct bnxt_ulp_mapper_class_key_field_info *key_field_list;
+	struct bnxt_ulp_mapper_result_field_info *result_field_list;
 	struct bnxt_ulp_mapper_ident_info *ident_list;
-	struct bnxt_ulp_mapper_tbl_list_info *act_tmpl_list;
-	struct bnxt_ulp_mapper_tbl_info *act_tbl_list;
-	struct bnxt_ulp_mapper_result_field_info *act_result_field_list;
 };
 
 /* Device specific parameters */
Signature · 1 line
2.21.1 (Apple Git-122.3)
#32 lore raw

PATCH v2 6/12 net/bnxt: combine default and regular flows

In reply to Ajit Khaparde

From: Kishore Padmanabha <[email protected]>

The default and regular flows are stored in the same flow table instead of different flow tables. This should help code reuse and reducing the number of allocations.
So combine default and regular flows in flow database.

---
 drivers/net/bnxt/tf_ulp/bnxt_ulp.c      |   2 +-
 drivers/net/bnxt/tf_ulp/bnxt_ulp_flow.c |   4 +-
 drivers/net/bnxt/tf_ulp/ulp_def_rules.c |   4 +-
 drivers/net/bnxt/tf_ulp/ulp_fc_mgr.c    |   2 +-
 drivers/net/bnxt/tf_ulp/ulp_flow_db.c   | 423 +++++++++++-------------
 drivers/net/bnxt/tf_ulp/ulp_flow_db.h   |  75 ++---
 drivers/net/bnxt/tf_ulp/ulp_mapper.c    |  33 +-
 drivers/net/bnxt/tf_ulp/ulp_mapper.h    |  11 +-
 8 files changed, 259 insertions(+), 295 deletions(-)
drivers/net/bnxt/tf_ulp/bnxt_ulp.c +1 -1
index eeda2d033..9ed92a88d 100644
@@ -853,7 +853,7 @@ bnxt_ulp_deinit(struct bnxt *bp,
 	bnxt_ulp_destroy_vfr_default_rules(bp, true);
 
 	/* clean up regular flows */
-	ulp_flow_db_flush_flows(bp->ulp_ctx, BNXT_ULP_REGULAR_FLOW_TABLE);
+	ulp_flow_db_flush_flows(bp->ulp_ctx, BNXT_ULP_FDB_TYPE_REGULAR);
 
 	/* cleanup the eem table scope */
 	ulp_eem_tbl_scope_deinit(bp, bp->ulp_ctx);
drivers/net/bnxt/tf_ulp/bnxt_ulp_flow.c +2 -2
index eea39f6b7..c7b29824e 100644
@@ -281,8 +281,8 @@ bnxt_ulp_flow_destroy(struct rte_eth_dev *dev,
 		return -EINVAL;
 	}
 
-	ret = ulp_mapper_flow_destroy(ulp_ctx, flow_id,
-				      BNXT_ULP_REGULAR_FLOW_TABLE);
+	ret = ulp_mapper_flow_destroy(ulp_ctx, BNXT_ULP_FDB_TYPE_REGULAR,
+				      flow_id);
 	if (ret) {
 		BNXT_TF_DBG(ERR, "Failed to destroy flow.\n");
 		if (error)
drivers/net/bnxt/tf_ulp/ulp_def_rules.c +2 -2
index 01f4fd087..c36d4d4c4 100644
@@ -391,8 +391,8 @@ ulp_default_flow_destroy(struct rte_eth_dev *eth_dev, uint32_t flow_id)
 		return rc;
 	}
 
-	rc = ulp_mapper_flow_destroy(ulp_ctx, flow_id,
-				     BNXT_ULP_DEFAULT_FLOW_TABLE);
+	rc = ulp_mapper_flow_destroy(ulp_ctx, BNXT_ULP_FDB_TYPE_DEFAULT,
+				     flow_id);
 	if (rc)
 		BNXT_TF_DBG(ERR, "Failed to destroy flow.\n");
 
drivers/net/bnxt/tf_ulp/ulp_fc_mgr.c +1 -1
index 5a0bf602a..051ebac04 100644
@@ -561,7 +561,7 @@ int ulp_fc_mgr_query_count_get(struct bnxt_ulp_context *ctxt,
 
 	do {
 		rc = ulp_flow_db_resource_get(ctxt,
-					      BNXT_ULP_REGULAR_FLOW_TABLE,
+					      BNXT_ULP_FDB_TYPE_REGULAR,
 					      flow_id,
 					      &nxt_resource_index,
 					      &params);
drivers/net/bnxt/tf_ulp/ulp_flow_db.c +198 -225

748 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_flow_db.h +32 -43

133 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_mapper.c +17 -16
index 5ed481ab3..0f55f4f75 100644
@@ -2482,12 +2482,12 @@ ulp_mapper_resource_free(struct bnxt_ulp_context *ulp,
 }
 
 int32_t
-ulp_mapper_resources_free(struct bnxt_ulp_context	*ulp_ctx,
-			  uint32_t fid,
-			  enum bnxt_ulp_flow_db_tables	tbl_type)
+ulp_mapper_resources_free(struct bnxt_ulp_context *ulp_ctx,
+			  enum bnxt_ulp_fdb_type flow_type,
+			  uint32_t fid)
 {
-	struct ulp_flow_db_res_params	res_parms = { 0 };
-	int32_t				rc, trc;
+	struct ulp_flow_db_res_params res_parms = { 0 };
+	int32_t rc, trc;
 
 	if (!ulp_ctx) {
 		BNXT_TF_DBG(ERR, "Invalid parms, unable to free flow\n");
@@ -2499,7 +2499,7 @@ ulp_mapper_resources_free(struct bnxt_ulp_context	*ulp_ctx,
 	 * while status is good
 	 */
 	res_parms.critical_resource = BNXT_ULP_CRITICAL_RESOURCE_YES;
-	rc = ulp_flow_db_resource_del(ulp_ctx, tbl_type, fid, &res_parms);
+	rc = ulp_flow_db_resource_del(ulp_ctx, flow_type, fid, &res_parms);
 
 	if (rc) {
 		/*
@@ -2507,7 +2507,7 @@ ulp_mapper_resources_free(struct bnxt_ulp_context	*ulp_ctx,
 		 * It likely means that the flow did not exist in the flow db.
 		 */
 		BNXT_TF_DBG(ERR, "Flow[%d][0x%08x] failed to free (rc=%d)\n",
-			    tbl_type, fid, rc);
+			    flow_type, fid, rc);
 		return rc;
 	}
 
@@ -2521,20 +2521,20 @@ ulp_mapper_resources_free(struct bnxt_ulp_context	*ulp_ctx,
 			BNXT_TF_DBG(ERR,
 				    "Flow[%d][0x%x] Res[%d][0x%016" PRIx64
 				    "] failed rc=%d.\n",
-				    tbl_type, fid, res_parms.resource_func,
+				    flow_type, fid, res_parms.resource_func,
 				    res_parms.resource_hndl, trc);
 
 		/* All subsequent call require the non-critical_resource */
 		res_parms.critical_resource = BNXT_ULP_CRITICAL_RESOURCE_NO;
 
 		rc = ulp_flow_db_resource_del(ulp_ctx,
-					      tbl_type,
+					      flow_type,
 					      fid,
 					      &res_parms);
 	}
 
 	/* Free the Flow ID since we've removed all resources */
-	rc = ulp_flow_db_fid_free(ulp_ctx, tbl_type, fid);
+	rc = ulp_flow_db_fid_free(ulp_ctx, flow_type, fid);
 
 	return rc;
 }
@@ -2568,8 +2568,9 @@ ulp_mapper_glb_resource_info_deinit(struct bnxt_ulp_context *ulp_ctx,
 }
 
 int32_t
-ulp_mapper_flow_destroy(struct bnxt_ulp_context	*ulp_ctx, uint32_t fid,
-			enum bnxt_ulp_flow_db_tables flow_tbl_type)
+ulp_mapper_flow_destroy(struct bnxt_ulp_context *ulp_ctx,
+			enum bnxt_ulp_fdb_type flow_type,
+			uint32_t fid)
 {
 	int32_t rc;
 
@@ -2582,7 +2583,7 @@ ulp_mapper_flow_destroy(struct bnxt_ulp_context	*ulp_ctx, uint32_t fid,
 		return -EINVAL;
 	}
 
-	rc = ulp_mapper_resources_free(ulp_ctx, fid, flow_tbl_type);
+	rc = ulp_mapper_resources_free(ulp_ctx, flow_type, fid);
 	bnxt_ulp_cntxt_release_fdb_lock(ulp_ctx);
 	return rc;
 
@@ -2624,7 +2625,7 @@ ulp_mapper_glb_template_table_init(struct bnxt_ulp_context *ulp_ctx)
 		parms.ulp_ctx = ulp_ctx;
 		parms.dev_id = dev_id;
 		parms.mapper_data = mapper_data;
-		parms.flow_type = BNXT_ULP_DEFAULT_FLOW_TABLE;
+		parms.flow_type = BNXT_ULP_FDB_TYPE_DEFAULT;
 		parms.tmpl_type = BNXT_ULP_TEMPLATE_TYPE_CLASS;
 
 		/* Get the class table entry from dev id and class id */
@@ -2758,8 +2759,8 @@ ulp_mapper_flow_create(struct bnxt_ulp_context *ulp_ctx,
 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, parms.fid,
-				      BNXT_ULP_REGULAR_FLOW_TABLE);
+	trc = ulp_mapper_flow_destroy(ulp_ctx, BNXT_ULP_FDB_TYPE_REGULAR,
+				      parms.fid);
 	if (trc)
 		BNXT_TF_DBG(ERR, "Failed to free all resources rc=%d\n", trc);
 
drivers/net/bnxt/tf_ulp/ulp_mapper.h +6 -5
index 936fb9af4..6f93bcdc1 100644
@@ -111,16 +111,17 @@ ulp_mapper_flow_create(struct bnxt_ulp_context	*ulp_ctx,
 
 /* Function that frees all resources associated with the flow. */
 int32_t
-ulp_mapper_flow_destroy(struct bnxt_ulp_context	*ulp_ctx, uint32_t fid,
-			enum bnxt_ulp_flow_db_tables flow_tbl_type);
+ulp_mapper_flow_destroy(struct bnxt_ulp_context *ulp_ctx,
+			enum bnxt_ulp_fdb_type flow_type,
+			uint32_t fid);
 
 /*
  * Function that frees all resources and can be called on default or regular
  * flows
  */
 int32_t
-ulp_mapper_resources_free(struct bnxt_ulp_context	*ulp_ctx,
-			  uint32_t fid,
-			  enum bnxt_ulp_flow_db_tables	tbl_type);
+ulp_mapper_resources_free(struct bnxt_ulp_context *ulp_ctx,
+			  enum bnxt_ulp_fdb_type flow_type,
+			  uint32_t fid);
 
 #endif /* _ULP_MAPPER_H_ */
Signature · 1 line
2.21.1 (Apple Git-122.3)
#33 lore raw

Re: [dpdk-dev] [PATCH v2 06/12] net/bnxt: combine default and regular flows

Quoted 10 lines · Ajit Khaparde

From: Kishore Padmanabha <[email protected]>

The default and regular flows are stored in the same flow table instead of different flow tables. This should help code reuse and reducing the number of allocations.
So combine default and regular flows in flow database.

<...>

drivers/net/bnxt/tf_ulp/ulp_flow_db.c ulp_flow_db_next_entry_get(struct bnxt_ulp_flow_tbl *flowtbl, · line 826

Quoted 8 lines
   *
   * returns 0 on success or negative number on failure
   */
drivers/net/bnxt/tf_ulp/ulp_flow_db.c +3 -2
-int32_t	ulp_flow_db_flush_flows(struct bnxt_ulp_context *ulp_ctx,
-				uint32_t		idx)
+int32_t
+ulp_flow_db_flush_flows(struct bnxt_ulp_context *ulp_ctx,
+			enum bnxt_ulp_fdb_type flow_type)

Above change is causing build error [1] because the function declaration [2] differs from definition. Reproduced by latest gcc [3].

[1]
../drivers/net/bnxt/tf_ulp/ulp_flow_db.c:962:1: error: conflicting types for ‘ulp_flow_db_flush_flows’ due to enum/integer mismatch; have ‘int32_t(struct bnxt_ulp_context *, enum bnxt_ulp_fdb_type)’
{aka ‘int(struct bnxt_ulp_context *, enum bnxt_ulp_fdb_type)’} [-Werror=enum-int-mismatch]
962 | ulp_flow_db_flush_flows(struct bnxt_ulp_context *ulp_ctx,

      | ^~~~~~~~~~~~~~~~~~~~~~~
In file included from ../drivers/net/bnxt/tf_ulp/ulp_flow_db.c:12:
../drivers/net/bnxt/tf_ulp/ulp_flow_db.h:211:1: note: previous declaration of ‘ulp_flow_db_flush_flows’ with type ‘int32_t(struct bnxt_ulp_context *,uint32_t)’ {aka ‘int(struct bnxt_ulp_context *, unsigned int)’}
  211 | ulp_flow_db_flush_flows(struct bnxt_ulp_context *ulp_ctx,
      | ^~~~~~~~~~~~~~~~~~~~~~~

[2]

drivers/net/bnxt/tf_ulp/ulp_flow_db.h int32_t ulp_flow_db_resource_get(struct bnxt_ulp_context *ulp_ctxt, · line 187

Quoted 3 lines
drivers/net/bnxt/tf_ulp/ulp_flow_db.h +2 -0
+ulp_flow_db_flush_flows(struct bnxt_ulp_context *ulp_ctx,
+			uint32_t idx);

[3]
gcc 13.0.0 "gcc (GCC) 13.0.0 20220524 (experimental)")

#34 lore raw

Re: [dpdk-dev] [PATCH v2 06/12] net/bnxt: combine default and regular flows

Quoted 45 lines · Ferruh Yigit
Quoted 10 lines · Ajit Khaparde

From: Kishore Padmanabha <[email protected]>

The default and regular flows are stored in the same flow table instead of different flow tables. This should help code reuse and reducing the number of allocations.
So combine default and regular flows in flow database.

<...>

drivers/net/bnxt/tf_ulp/ulp_flow_db.c ulp_flow_db_next_entry_get(struct bnxt_ulp_flow_tbl *flowtbl, · line 826

Quoted 8 lines
   *
   * returns 0 on success or negative number on failure
   */
drivers/net/bnxt/tf_ulp/ulp_flow_db.c +3 -2
-int32_t      ulp_flow_db_flush_flows(struct bnxt_ulp_context *ulp_ctx,
-                             uint32_t                idx)
+int32_t
+ulp_flow_db_flush_flows(struct bnxt_ulp_context *ulp_ctx,
+                     enum bnxt_ulp_fdb_type flow_type)

Above change is causing build error [1] because the function declaration
[2] differs from definition. Reproduced by latest gcc [3].

[1]
../drivers/net/bnxt/tf_ulp/ulp_flow_db.c:962:1: error: conflicting types for ‘ulp_flow_db_flush_flows’ due to enum/integer mismatch; have ‘int32_t(struct bnxt_ulp_context *, enum bnxt_ulp_fdb_type)’ {aka ‘int(struct bnxt_ulp_context *, enum bnxt_ulp_fdb_type)’} [-Werror=enum-int-mismatch]
962 | ulp_flow_db_flush_flows(struct bnxt_ulp_context *ulp_ctx,

       | ^~~~~~~~~~~~~~~~~~~~~~~

In file included from ../drivers/net/bnxt/tf_ulp/ulp_flow_db.c:12:
../drivers/net/bnxt/tf_ulp/ulp_flow_db.h:211:1: note: previous declaration of ‘ulp_flow_db_flush_flows’ with type ‘int32_t(struct bnxt_ulp_context *,uint32_t)’ {aka ‘int(struct bnxt_ulp_context *, unsigned int)’}
211 | ulp_flow_db_flush_flows(struct bnxt_ulp_context *ulp_ctx,

       | ^~~~~~~~~~~~~~~~~~~~~~~
Quoted 8 lines

[2]

drivers/net/bnxt/tf_ulp/ulp_flow_db.h int32_t ulp_flow_db_resource_get(struct bnxt_ulp_context *ulp_ctxt, · line 187

Quoted 3 lines
drivers/net/bnxt/tf_ulp/ulp_flow_db.h +2 -0
+ulp_flow_db_flush_flows(struct bnxt_ulp_context *ulp_ctx,
+                     uint32_t idx);

[3]
gcc 13.0.0 "gcc (GCC) 13.0.0 20220524 (experimental)")

Bleeding edge gcc.
Thanks Ferruh. We will take a look at this.

#35 lore raw

PATCH v2 7/12 net/bnxt: handle default vnic change async event

In reply to Ajit Khaparde

From: Venkat Duvvuru <[email protected]>

Currently, we are only registering to this event if the function is a trusted VF. This patch extends it for PFs as well.

Fixes 322bd6e70272 ("net/bnxt: add port representor infrastructure")
---
 drivers/net/bnxt/bnxt_cpr.c  | 7 ++-----
 drivers/net/bnxt/bnxt_hwrm.c | 2 +-
 2 files changed, 3 insertions(+), 6 deletions(-)
drivers/net/bnxt/bnxt_cpr.c +2 -5
index 54923948f..91d1ffe46 100644
@@ -50,7 +50,7 @@ static void
 bnxt_process_default_vnic_change(struct bnxt *bp,
 				 struct hwrm_async_event_cmpl *async_cmp)
 {
-	uint16_t fid, vnic_state, parent_id, vf_fid, vf_id;
+	uint16_t vnic_state, vf_fid, vf_id;
 	struct bnxt_representor *vf_rep_bp;
 	struct rte_eth_dev *eth_dev;
 	bool vfr_found = false;
@@ -67,10 +67,7 @@ bnxt_process_default_vnic_change(struct bnxt *bp,
 	if (vnic_state != BNXT_DEFAULT_VNIC_ALLOC)
 		return;
 
-	parent_id = (event_data & BNXT_DEFAULT_VNIC_CHANGE_PF_ID_MASK) >>
-			BNXT_DEFAULT_VNIC_CHANGE_PF_ID_SFT;
-	fid = BNXT_PF(bp) ? bp->fw_fid : bp->parent->fid;
-	if (parent_id != fid || !bp->rep_info)
+	if (!bp->rep_info)
 		return;
 
 	vf_fid = (event_data & BNXT_DEFAULT_VNIC_CHANGE_VF_ID_MASK) >>
drivers/net/bnxt/bnxt_hwrm.c +1 -1
index 8133afc74..eef282b69 100644
@@ -938,7 +938,7 @@ int bnxt_hwrm_func_driver_register(struct bnxt *bp)
 		req.async_event_fwd[1] |=
 			rte_cpu_to_le_32(ASYNC_CMPL_EVENT_ID_DBG_NOTIFICATION);
 
-	if (BNXT_VF_IS_TRUSTED(bp))
+	if (BNXT_PF(bp) || BNXT_VF_IS_TRUSTED(bp))
 		req.async_event_fwd[1] |=
 		rte_cpu_to_le_32(ASYNC_CMPL_EVENT_ID_DEFAULT_VNIC_CHANGE);
 
Signature · 1 line
2.21.1 (Apple Git-122.3)
#36 lore raw

PATCH v2 8/12 net/bnxt: support runtime EM selection

In reply to Ajit Khaparde

From: Mike Baucom <[email protected]>

This patch adds support to select internal Exact Match vs External Exact Match support while loading the PMD.
- Added new mem type conditional opcode for internal/external
- Adapted the flowdb resource counts based on selected mode
- Template changes to use the new opcode
- The decision for internal/external EM support is based on the devargs parameter max_num_kflows. If this is set, external EM is used.

---
 doc/guides/nics/bnxt.rst                      |   13 +
 drivers/net/bnxt/tf_ulp/bnxt_ulp.c            |   78 +-
 drivers/net/bnxt/tf_ulp/bnxt_ulp.h            |   11 +
 drivers/net/bnxt/tf_ulp/ulp_flow_db.c         |   16 +-
 drivers/net/bnxt/tf_ulp/ulp_mapper.c          |   48 +-
 .../net/bnxt/tf_ulp/ulp_template_db_enum.h    |    7 +
 .../tf_ulp/ulp_template_db_stingray_act.c     | 2282 +++++++++--
 .../tf_ulp/ulp_template_db_stingray_class.c   | 3646 +++++++++++++++--
 drivers/net/bnxt/tf_ulp/ulp_template_db_tbl.c |   48 +-
 .../bnxt/tf_ulp/ulp_template_db_wh_plus_act.c | 2281 +++++++++--
 .../tf_ulp/ulp_template_db_wh_plus_class.c    | 3390 +++++++++++++--
 drivers/net/bnxt/tf_ulp/ulp_template_struct.h |    5 +-
 12 files changed, 10241 insertions(+), 1584 deletions(-)
doc/guides/nics/bnxt.rst +13 -0
index 553f57178..74d90ba97 100644
@@ -762,6 +762,19 @@ The sample command line with the new ``devargs`` looks like this::
 	representor=[0], rep-based-pf=8,rep-is-pf=0,rep-q-r2f=1,rep-fc-r2f=1,\
 	rep-q-f2r=0,rep-fc-f2r=1 --log-level="pmd.*",8 -- -i --rxq=3 --txq=3
 
+Number of flows supported
+-------------------------
+The number of flows that can be support can be changed using the devargs
+parameter ``max_num_kflows``. The default number of flows supported is 16K each
+in ingress and egress path.
+
+Selecting EM vs EEM
+-------------------
+Broadcom devices can support filter creation in the onchip memory or the
+external memory. This is referred to as EM or EEM mode respectively.
+The decision for internal/external EM support is based on the ``devargs``
+parameter ``max_num_kflows``.  If this is set by the user, external EM is used.
+Otherwise EM support is enabled with flows created in internal memory.
 
 Application Support
 -------------------
drivers/net/bnxt/tf_ulp/bnxt_ulp.c +56 -22

147 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/bnxt_ulp.h +11 -0
index 36405ae1e..c2c5bcb1d 100644
@@ -54,6 +54,7 @@ struct bnxt_ulp_data {
 	uint32_t			ulp_flags;
 	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;
 };
 
 struct bnxt_ulp_context {
@@ -102,6 +103,16 @@ bnxt_ulp_cntxt_dev_id_set(struct bnxt_ulp_context *ulp_ctx, uint32_t dev_id);
 int32_t
 bnxt_ulp_cntxt_dev_id_get(struct bnxt_ulp_context *ulp_ctx, uint32_t *dev_id);
 
+/* Function to get whether or not ext mem is used for EM */
+int32_t
+bnxt_ulp_cntxt_mem_type_get(struct bnxt_ulp_context *ulp_ctx,
+			    enum bnxt_ulp_flow_mem_type *mem_type);
+
+/* Function to set whether or not ext mem is used for EM */
+int32_t
+bnxt_ulp_cntxt_mem_type_set(struct bnxt_ulp_context *ulp_ctx,
+			    enum bnxt_ulp_flow_mem_type mem_type);
+
 /* Function to set the table scope id of the EEM table. */
 int32_t
 bnxt_ulp_cntxt_tbl_scope_id_set(struct bnxt_ulp_context *ulp_ctx,
drivers/net/bnxt/tf_ulp/ulp_flow_db.c +13 -3
index 0a3fb015c..da012451d 100644
@@ -298,7 +298,8 @@ ulp_flow_db_init(struct bnxt_ulp_context *ulp_ctxt)
 	struct bnxt_ulp_device_params *dparms;
 	struct bnxt_ulp_flow_tbl *flow_tbl;
 	struct bnxt_ulp_flow_db *flow_db;
-	uint32_t dev_id;
+	uint32_t dev_id, num_flows;
+	enum bnxt_ulp_flow_mem_type mtype;
 
 	/* Get the dev specific number of flows that needed to be supported. */
 	if (bnxt_ulp_cntxt_dev_id_get(ulp_ctxt, &dev_id)) {
@@ -323,10 +324,17 @@ ulp_flow_db_init(struct bnxt_ulp_context *ulp_ctxt)
 	/* Attach the flow database to the ulp context. */
 	bnxt_ulp_cntxt_ptr2_flow_db_set(ulp_ctxt, flow_db);
 
+	/* Determine the number of flows based on EM type */
+	bnxt_ulp_cntxt_mem_type_get(ulp_ctxt, &mtype);
+	if (mtype == BNXT_ULP_FLOW_MEM_TYPE_INT)
+		num_flows = dparms->int_flow_db_num_entries;
+	else
+		num_flows = dparms->ext_flow_db_num_entries;
+
 	/* Populate the regular flow table limits. */
 	flow_tbl = &flow_db->flow_tbl;
-	flow_tbl->num_flows = dparms->flow_db_num_entries + 1;
-	flow_tbl->num_resources = ((dparms->flow_db_num_entries + 1) *
+	flow_tbl->num_flows = num_flows + 1;
+	flow_tbl->num_resources = ((num_flows + 1) *
 				   dparms->num_resources_per_flow);
 
 	/* Include the default flow table limits. */
@@ -350,6 +358,8 @@ ulp_flow_db_init(struct bnxt_ulp_context *ulp_ctxt)
 		goto error_free;
 	}
 	/* All good so return. */
+	BNXT_TF_DBG(INFO, "FlowDB initialized with %d flows.\n",
+		    flow_tbl->num_flows);
 	return 0;
 error_free:
 	ulp_flow_db_deinit(ulp_ctxt);
drivers/net/bnxt/tf_ulp/ulp_mapper.c +47 -1

76 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_template_db_enum.h +7 -0
index e083af0ae..81da34e3a 100644
@@ -235,6 +235,13 @@ enum bnxt_ulp_match_type {
 	BNXT_ULP_MATCH_TYPE_LAST = 2
 };
 
+enum bnxt_ulp_mem_type_opcode {
+	BNXT_ULP_MEM_TYPE_OPCODE_NOP = 0,
+	BNXT_ULP_MEM_TYPE_OPCODE_EXECUTE_IF_INT = 1,
+	BNXT_ULP_MEM_TYPE_OPCODE_EXECUTE_IF_EXT = 2,
+	BNXT_ULP_MEM_TYPE_OPCODE_LAST = 3
+};
+
 enum bnxt_ulp_priority {
 	BNXT_ULP_PRIORITY_LEVEL_0 = 0,
 	BNXT_ULP_PRIORITY_LEVEL_1 = 1,
drivers/net/bnxt/tf_ulp/ulp_template_db_stingray_act.c +1890 -392

2,686 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_template_db_stingray_class.c +3208 -438

3,646 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_template_db_tbl.c +24 -24

48 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_template_db_wh_plus_act.c +1889 -392

2,281 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_template_db_wh_plus_class.c +3080 -310

3,390 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_template_struct.h +3 -2
index 026c42d1c..50a986c89 100644

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

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

Signature · 1 line
2.21.1 (Apple Git-122.3)

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

#37 lore raw

PATCH v2 9/12 net/bnxt: add support for parent child flow database

In reply to Ajit Khaparde

From: Kishore Padmanabha <[email protected]>

Added support for parent child flow database apis. This feature adds support to enable vxlan decap support where flows needs to maintain parent-child flow relationship.

---
 drivers/net/bnxt/tf_ulp/ulp_flow_db.c         | 348 +++++++++++++++++-
 drivers/net/bnxt/tf_ulp/ulp_flow_db.h         |  84 +++++
 drivers/net/bnxt/tf_ulp/ulp_template_db_tbl.c |   1 +
 drivers/net/bnxt/tf_ulp/ulp_template_struct.h |   1 +
 drivers/net/bnxt/tf_ulp/ulp_utils.h           |   4 +
 5 files changed, 435 insertions(+), 3 deletions(-)
drivers/net/bnxt/tf_ulp/ulp_flow_db.c +345 -3
index da012451d..a1c39329f 100644
@@ -207,13 +207,16 @@ ulp_flow_db_alloc_resource(struct bnxt_ulp_flow_db *flow_db)
 		return -ENOMEM;
 	}
 	size = (flow_tbl->num_flows / sizeof(uint64_t)) + 1;
-	flow_tbl->active_reg_flows = rte_zmalloc("active reg flows", size, 0);
+	size =  ULP_BYTE_ROUND_OFF_8(size);
+	flow_tbl->active_reg_flows = rte_zmalloc("active reg flows", size,
+						 ULP_BUFFER_ALIGN_64_BYTE);
 	if (!flow_tbl->active_reg_flows) {
 		BNXT_TF_DBG(ERR, "Failed to alloc memory active reg flows\n");
 		return -ENOMEM;
 	}
 
-	flow_tbl->active_dflt_flows = rte_zmalloc("active dflt flows", size, 0);
+	flow_tbl->active_dflt_flows = rte_zmalloc("active dflt flows", size,
+						  ULP_BUFFER_ALIGN_64_BYTE);
 	if (!flow_tbl->active_dflt_flows) {
 		BNXT_TF_DBG(ERR, "Failed to alloc memory active dflt flows\n");
 		return -ENOMEM;
@@ -284,6 +287,86 @@ ulp_flow_db_func_id_set(struct bnxt_ulp_flow_db *flow_db,
 		BNXT_TF_DBG(ERR, "Invalid flow id, flowdb corrupt\n");
 }
 
+/*
+ * Initialize the parent-child database. Memory is allocated in this
+ * call and assigned to the database
+ *
+ * flow_db [in] Ptr to flow table
+ * num_entries[in] - number of entries to allocate
+ *
+ * Returns 0 on success or negative number on failure.
+ */
+static int32_t
+ulp_flow_db_parent_tbl_init(struct bnxt_ulp_flow_db *flow_db,
+			    uint32_t num_entries)
+{
+	struct ulp_fdb_parent_child_db *p_db;
+	uint32_t size, idx;
+
+	/* update the sizes for the allocation */
+	p_db = &flow_db->parent_child_db;
+	p_db->child_bitset_size = (flow_db->flow_tbl.num_flows /
+				   sizeof(uint64_t)) + 1; /* size in bytes */
+	p_db->child_bitset_size = ULP_BYTE_ROUND_OFF_8(p_db->child_bitset_size);
+	p_db->entries_count = num_entries;
+
+	/* allocate the memory */
+	p_db->parent_flow_tbl = rte_zmalloc("fdb parent flow tbl",
+					    sizeof(struct ulp_fdb_parent_info) *
+					    p_db->entries_count, 0);
+	if (!p_db->parent_flow_tbl) {
+		BNXT_TF_DBG(ERR,
+			    "Failed to allocate memory fdb parent flow tbl\n");
+		return -ENOMEM;
+	}
+	size = p_db->child_bitset_size * p_db->entries_count;
+
+	/*
+	 * allocate the big chunk of memory to be statically carved into
+	 * child_fid_bitset pointer.
+	 */
+	p_db->parent_flow_tbl_mem = rte_zmalloc("fdb parent flow tbl mem",
+						size,
+						ULP_BUFFER_ALIGN_64_BYTE);
+	if (!p_db->parent_flow_tbl_mem) {
+		BNXT_TF_DBG(ERR,
+			    "Failed to allocate memory fdb parent flow mem\n");
+		return -ENOMEM;
+	}
+
+	/* set the pointers in parent table to their offsets */
+	for (idx = 0 ; idx < p_db->entries_count; idx++) {
+		p_db->parent_flow_tbl[idx].child_fid_bitset =
+			(uint64_t *)&p_db->parent_flow_tbl_mem[idx *
+			p_db->child_bitset_size];
+	}
+	/* success */
+	return 0;
+}
+
+/*
+ * Deinitialize the parent-child database. Memory is deallocated in
+ * this call and all flows should have been purged before this
+ * call.
+ *
+ * flow_db [in] Ptr to flow table
+ *
+ * Returns none
+ */
+static void
+ulp_flow_db_parent_tbl_deinit(struct bnxt_ulp_flow_db *flow_db)
+{
+	/* free the memory related to parent child database */
+	if (flow_db->parent_child_db.parent_flow_tbl_mem) {
+		rte_free(flow_db->parent_child_db.parent_flow_tbl_mem);
+		flow_db->parent_child_db.parent_flow_tbl_mem = NULL;
+	}
+	if (flow_db->parent_child_db.parent_flow_tbl) {
+		rte_free(flow_db->parent_child_db.parent_flow_tbl);
+		flow_db->parent_child_db.parent_flow_tbl = NULL;
+	}
+}
+
 /*
  * Initialize the flow database. Memory is allocated in this
  * call and assigned to the flow database.
@@ -357,6 +440,14 @@ ulp_flow_db_init(struct bnxt_ulp_context *ulp_ctxt)
 			    "Failed to allocate mem for flow table func id\n");
 		goto error_free;
 	}
+	/* initialize the parent child database */
+	if (ulp_flow_db_parent_tbl_init(flow_db,
+					dparms->fdb_parent_flow_entries)) {
+		BNXT_TF_DBG(ERR,
+			    "Failed to allocate mem for parent child db\n");
+		goto error_free;
+	}
+
 	/* All good so return. */
 	BNXT_TF_DBG(INFO, "FlowDB initialized with %d flows.\n",
 		    flow_tbl->num_flows);
@@ -388,6 +479,7 @@ ulp_flow_db_deinit(struct bnxt_ulp_context *ulp_ctxt)
 	bnxt_ulp_cntxt_ptr2_flow_db_set(ulp_ctxt, NULL);
 
 	/* Free up all the memory. */
+	ulp_flow_db_parent_tbl_deinit(flow_db);
 	ulp_flow_db_dealloc_resource(flow_db);
 	rte_free(flow_db->func_id_tbl);
 	rte_free(flow_db);
@@ -578,7 +670,7 @@ ulp_flow_db_resource_del(struct bnxt_ulp_context *ulp_ctxt,
 	flow_tbl = &flow_db->flow_tbl;
 	/* check for max flows */
 	if (fid >= flow_tbl->num_flows || !fid) {
-		BNXT_TF_DBG(ERR, "Invalid flow index\n");
+		BNXT_TF_DBG(ERR, "Invalid flow index %x\n", fid);
 		return -EINVAL;
 	}
 
@@ -1050,3 +1142,253 @@ ulp_default_flow_db_cfa_action_get(struct bnxt_ulp_context *ulp_ctx,
 	*cfa_action = hndl;
 	return 0;
 }
+
+/*
+ * Allocate the entry in the parent-child database
+ *
+ * ulp_ctxt [in] Ptr to ulp_context
+ * fid [in] The flow id to the flow entry
+ *
+ * returns index on success and negative on failure.
+ */
+int32_t
+ulp_flow_db_parent_flow_alloc(struct bnxt_ulp_context *ulp_ctxt,
+			      uint32_t fid)
+{
+	struct bnxt_ulp_flow_db *flow_db;
+	struct ulp_fdb_parent_child_db *p_pdb;
+	uint32_t idx, free_idx = 0;
+
+	flow_db = bnxt_ulp_cntxt_ptr2_flow_db_get(ulp_ctxt);
+	if (!flow_db) {
+		BNXT_TF_DBG(ERR, "Invalid Arguments\n");
+		return -EINVAL;
+	}
+
+	/* check for max flows */
+	if (fid >= flow_db->flow_tbl.num_flows || !fid) {
+		BNXT_TF_DBG(ERR, "Invalid flow index\n");
+		return -EINVAL;
+	}
+
+	p_pdb = &flow_db->parent_child_db;
+	for (idx = 0; idx <= p_pdb->entries_count; idx++) {
+		if (p_pdb->parent_flow_tbl[idx].parent_fid == fid) {
+			BNXT_TF_DBG(ERR, "fid is already allocated\n");
+			return -EINVAL;
+		}
+		if (!p_pdb->parent_flow_tbl[idx].parent_fid && !free_idx)
+			free_idx = idx + 1;
+	}
+	/* no free slots */
+	if (!free_idx) {
+		BNXT_TF_DBG(ERR, "parent child db is full\n");
+		return -ENOMEM;
+	}
+
+	free_idx -= 1;
+	/* set the Fid in the parent child */
+	p_pdb->parent_flow_tbl[free_idx].parent_fid = fid;
+	return free_idx;
+}
+
+/*
+ * Free the entry in the parent-child database
+ *
+ * ulp_ctxt [in] Ptr to ulp_context
+ * fid [in] The flow id to the flow entry
+ *
+ * returns 0 on success and negative on failure.
+ */
+int32_t
+ulp_flow_db_parent_flow_free(struct bnxt_ulp_context *ulp_ctxt,
+			     uint32_t fid)
+{
+	struct bnxt_ulp_flow_db *flow_db;
+	struct ulp_fdb_parent_child_db *p_pdb;
+	uint32_t idx;
+
+	flow_db = bnxt_ulp_cntxt_ptr2_flow_db_get(ulp_ctxt);
+	if (!flow_db) {
+		BNXT_TF_DBG(ERR, "Invalid Arguments\n");
+		return -EINVAL;
+	}
+
+	/* check for max flows */
+	if (fid >= flow_db->flow_tbl.num_flows || !fid) {
+		BNXT_TF_DBG(ERR, "Invalid flow index\n");
+		return -EINVAL;
+	}
+
+	p_pdb = &flow_db->parent_child_db;
+	for (idx = 0; idx <= p_pdb->entries_count; idx++) {
+		if (p_pdb->parent_flow_tbl[idx].parent_fid == fid) {
+			/* free the contents */
+			p_pdb->parent_flow_tbl[idx].parent_fid = 0;
+			memset(p_pdb->parent_flow_tbl[idx].child_fid_bitset,
+			       0, p_pdb->child_bitset_size);
+			return 0;
+		}
+	}
+	BNXT_TF_DBG(ERR, "parent entry not found = %x\n", fid);
+	return -EINVAL;
+}
+
+/*
+ * Set or reset the child flow in the parent-child database
+ *
+ * ulp_ctxt [in] Ptr to ulp_context
+ * parent_fid [in] The flow id of the parent flow entry
+ * child_fid [in] The flow id of the child flow entry
+ * set_flag [in] Use 1 for setting child, 0 to reset
+ *
+ * returns zero on success and negative on failure.
+ */
+int32_t
+ulp_flow_db_parent_child_flow_set(struct bnxt_ulp_context *ulp_ctxt,
+				  uint32_t parent_fid,
+				  uint32_t child_fid,
+				  uint32_t set_flag)
+{
+	struct bnxt_ulp_flow_db *flow_db;
+	struct ulp_fdb_parent_child_db *p_pdb;
+	uint32_t idx, a_idx;
+	uint64_t *t;
+
+	flow_db = bnxt_ulp_cntxt_ptr2_flow_db_get(ulp_ctxt);
+	if (!flow_db) {
+		BNXT_TF_DBG(ERR, "Invalid Arguments\n");
+		return -EINVAL;
+	}
+
+	/* check for fid validity */
+	if (parent_fid >= flow_db->flow_tbl.num_flows || !parent_fid) {
+		BNXT_TF_DBG(ERR, "Invalid parent flow index %x\n", parent_fid);
+		return -EINVAL;
+	}
+
+	/* check for fid validity */
+	if (child_fid >= flow_db->flow_tbl.num_flows || !child_fid) {
+		BNXT_TF_DBG(ERR, "Invalid child flow index %x\n", child_fid);
+		return -EINVAL;
+	}
+
+	p_pdb = &flow_db->parent_child_db;
+	a_idx = child_fid / ULP_INDEX_BITMAP_SIZE;
+	for (idx = 0; idx <= p_pdb->entries_count; idx++) {
+		if (p_pdb->parent_flow_tbl[idx].parent_fid == parent_fid) {
+			t = p_pdb->parent_flow_tbl[idx].child_fid_bitset;
+			if (set_flag)
+				ULP_INDEX_BITMAP_SET(t[a_idx], child_fid);
+			else
+				ULP_INDEX_BITMAP_RESET(t[a_idx], child_fid);
+			return 0;
+		}
+	}
+	BNXT_TF_DBG(ERR, "Unable to set the parent-child flow %x:%x\n",
+		    parent_fid, child_fid);
+	return -1;
+}
+
+/*
+ * Get the parent index from the parent-child database
+ *
+ * ulp_ctxt [in] Ptr to ulp_context
+ * parent_fid [in] The flow id of the parent flow entry
+ * parent_idx [out] The parent index of parent flow entry
+ *
+ * returns zero on success and negative on failure.
+ */
+int32_t
+ulp_flow_db_parent_flow_idx_get(struct bnxt_ulp_context *ulp_ctxt,
+				uint32_t parent_fid,
+				uint32_t *parent_idx)
+{
+	struct bnxt_ulp_flow_db *flow_db;
+	struct ulp_fdb_parent_child_db *p_pdb;
+	uint32_t idx;
+
+	flow_db = bnxt_ulp_cntxt_ptr2_flow_db_get(ulp_ctxt);
+	if (!flow_db) {
+		BNXT_TF_DBG(ERR, "Invalid Arguments\n");
+		return -EINVAL;
+	}
+
+	/* check for fid validity */
+	if (parent_fid >= flow_db->flow_tbl.num_flows || !parent_fid) {
+		BNXT_TF_DBG(ERR, "Invalid parent flow index %x\n", parent_fid);
+		return -EINVAL;
+	}
+
+	p_pdb = &flow_db->parent_child_db;
+	for (idx = 0; idx <= p_pdb->entries_count; idx++) {
+		if (p_pdb->parent_flow_tbl[idx].parent_fid == parent_fid) {
+			*parent_idx = idx;
+			return 0;
+		}
+	}
+	BNXT_TF_DBG(ERR, "Unable to get the parent flow %x\n", parent_fid);
+	return -1;
+}
+
+/*
+ * Get the next child flow in the parent-child database
+ *
+ * ulp_ctxt [in] Ptr to ulp_context
+ * parent_fid [in] The flow id of the parent flow entry
+ * child_fid [in/out] The flow id of the child flow entry
+ *
+ * returns zero on success and negative on failure.
+ * Pass child_fid as zero for first entry.
+ */
+int32_t
+ulp_flow_db_parent_child_flow_next_entry_get(struct bnxt_ulp_flow_db *flow_db,
+					     uint32_t parent_idx,
+					     uint32_t *child_fid)
+{
+	struct ulp_fdb_parent_child_db *p_pdb;
+	uint32_t idx, s_idx, mod_fid;
+	uint32_t next_fid = *child_fid;
+	uint64_t *child_bitset;
+	uint64_t bs;
+
+	/* check for fid validity */
+	p_pdb = &flow_db->parent_child_db;
+	if (parent_idx >= p_pdb->entries_count ||
+	    !p_pdb->parent_flow_tbl[parent_idx].parent_fid) {
+		BNXT_TF_DBG(ERR, "Invalid parent flow index %x\n", parent_idx);
+		return -EINVAL;
+	}
+
+	child_bitset = p_pdb->parent_flow_tbl[parent_idx].child_fid_bitset;
+	do {
+		/* increment the flow id to find the next valid flow id */
+		next_fid++;
+		if (next_fid >= flow_db->flow_tbl.num_flows)
+			return -ENOENT;
+		idx = next_fid / ULP_INDEX_BITMAP_SIZE;
+		mod_fid = next_fid % ULP_INDEX_BITMAP_SIZE;
+		s_idx = idx;
+		while (!(bs = child_bitset[idx])) {
+			idx++;
+			if ((idx * ULP_INDEX_BITMAP_SIZE) >=
+			    flow_db->flow_tbl.num_flows)
+				return -ENOENT;
+		}
+		/*
+		 * remove the previous bits in the bitset bs to find the
+		 * next non zero bit in the bitset. This needs to be done
+		 * only if the idx is same as he one you started.
+		 */
+		if (s_idx == idx)
+			bs &= (-1UL >> mod_fid);
+		next_fid = (idx * ULP_INDEX_BITMAP_SIZE) + __builtin_clzl(bs);
+		if (*child_fid >= next_fid) {
+			BNXT_TF_DBG(ERR, "Parent Child Database is corrupt\n");
+			return -ENOENT;
+		}
+		idx = next_fid / ULP_INDEX_BITMAP_SIZE;
+	} while (!ULP_INDEX_BITMAP_GET(child_bitset[idx], next_fid));
+	*child_fid = next_fid;
+	return 0;
+}
drivers/net/bnxt/tf_ulp/ulp_flow_db.h +84 -0

100 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_template_db_tbl.c +1 -0
index 4904a41c3..a677b0ca5 100644
@@ -368,6 +368,7 @@ struct bnxt_ulp_device_params ulp_device_params[BNXT_ULP_DEVICE_ID_LAST] = {
 	.mark_db_lfid_entries    = 65536,
 	.mark_db_gfid_entries    = 65536,
 	.flow_count_db_entries   = 16384,
+	.fdb_parent_flow_entries = 2,
 	.num_resources_per_flow  = 8,
 	.num_phy_ports           = 2,
 	.ext_cntr_table_type     = 0,
drivers/net/bnxt/tf_ulp/ulp_template_struct.h +1 -0
index 50a986c89..2e94b6f19 100644
@@ -160,6 +160,7 @@ struct bnxt_ulp_device_params {
 	uint64_t			int_flow_db_num_entries;
 	uint64_t			ext_flow_db_num_entries;
 	uint32_t			flow_count_db_entries;
+	uint32_t			fdb_parent_flow_entries;
 	uint32_t			num_resources_per_flow;
 	uint32_t			ext_cntr_table_type;
 	uint64_t			byte_count_mask;
drivers/net/bnxt/tf_ulp/ulp_utils.h +4 -0
index c054a77a9..898e85123 100644
@@ -11,6 +11,7 @@
 
 #define ULP_BUFFER_ALIGN_8_BYTE		8
 #define ULP_BUFFER_ALIGN_16_BYTE	16
+#define ULP_BUFFER_ALIGN_64_BYTE	64
 
 /*
  * Macros for bitmap sets and gets
@@ -53,6 +54,9 @@
 /* Macro to convert bits to bytes with no round off*/
 #define ULP_BITS_2_BYTE_NR(bits_x)	((bits_x) / 8)
 
+/* Macro to round off to next multiple of 8*/
+#define ULP_BYTE_ROUND_OFF_8(x)	(((x) + 7) & ~7)
+
 /* Macros to read the computed fields */
 #define ULP_COMP_FLD_IDX_RD(params, idx) \
 	rte_be_to_cpu_32((params)->comp_fld[(idx)])
Signature · 1 line
2.21.1 (Apple Git-122.3)
#38 lore raw

PATCH v2 10/12 net/bnxt: consolidate template table processing

In reply to Ajit Khaparde

From: Mike Baucom <[email protected]>

Name changes due to consolidating the template table processing and hence are not necessary.

- chip before type in name
- removal of class in key field info

---
 drivers/net/bnxt/tf_ulp/ulp_mapper.c          | 12 +++----
 .../tf_ulp/ulp_template_db_stingray_act.c     |  6 ++--
 .../tf_ulp/ulp_template_db_stingray_class.c   | 10 +++---
 drivers/net/bnxt/tf_ulp/ulp_template_db_tbl.c | 34 +++++++++----------
 drivers/net/bnxt/tf_ulp/ulp_template_db_tbl.h | 32 ++++++++---------
 .../bnxt/tf_ulp/ulp_template_db_wh_plus_act.c |  6 ++--
 .../tf_ulp/ulp_template_db_wh_plus_class.c    | 10 +++---
 drivers/net/bnxt/tf_ulp/ulp_template_struct.h |  4 +--
 8 files changed, 57 insertions(+), 57 deletions(-)
drivers/net/bnxt/tf_ulp/ulp_mapper.c +6 -6
index 812e35c27..cd289cc40 100644
@@ -256,7 +256,7 @@ ulp_mapper_tbl_list_get(struct bnxt_ulp_mapper_parms *mparms,
  *
  * Returns array of Key fields, or NULL on error.
  */
-static struct bnxt_ulp_mapper_class_key_field_info *
+static struct bnxt_ulp_mapper_key_field_info *
 ulp_mapper_key_fields_get(struct bnxt_ulp_mapper_parms *mparms,
 			  struct bnxt_ulp_mapper_tbl_info *tbl,
 			  uint32_t *num_flds)
@@ -1009,7 +1009,7 @@ ulp_mapper_result_field_process(struct bnxt_ulp_mapper_parms *parms,
 static int32_t
 ulp_mapper_keymask_field_process(struct bnxt_ulp_mapper_parms *parms,
 				 enum tf_dir dir,
-				 struct bnxt_ulp_mapper_class_key_field_info *f,
+				 struct bnxt_ulp_mapper_key_field_info *f,
 				 struct ulp_blob *blob,
 				 uint8_t is_key,
 				 const char *name)
@@ -1020,7 +1020,7 @@ ulp_mapper_keymask_field_process(struct bnxt_ulp_mapper_parms *parms,
 	uint8_t *operand;
 	struct ulp_regfile *regfile = parms->regfile;
 	uint8_t *val = NULL;
-	struct bnxt_ulp_mapper_class_key_field_info *fld = f;
+	struct bnxt_ulp_mapper_key_field_info *fld = f;
 	uint32_t field_size;
 
 	if (is_key) {
@@ -1442,7 +1442,7 @@ static int32_t
 ulp_mapper_tcam_tbl_process(struct bnxt_ulp_mapper_parms *parms,
 			    struct bnxt_ulp_mapper_tbl_info *tbl)
 {
-	struct bnxt_ulp_mapper_class_key_field_info	*kflds;
+	struct bnxt_ulp_mapper_key_field_info	*kflds;
 	struct ulp_blob key, mask, data, update_data;
 	uint32_t i, num_kflds;
 	struct tf *tfp;
@@ -1670,7 +1670,7 @@ static int32_t
 ulp_mapper_em_tbl_process(struct bnxt_ulp_mapper_parms *parms,
 			  struct bnxt_ulp_mapper_tbl_info *tbl)
 {
-	struct bnxt_ulp_mapper_class_key_field_info	*kflds;
+	struct bnxt_ulp_mapper_key_field_info	*kflds;
 	struct bnxt_ulp_mapper_result_field_info *dflds;
 	struct ulp_blob key, data;
 	uint32_t i, num_kflds, num_dflds;
@@ -2061,7 +2061,7 @@ static int32_t
 ulp_mapper_cache_tbl_process(struct bnxt_ulp_mapper_parms *parms,
 			     struct bnxt_ulp_mapper_tbl_info *tbl)
 {
-	struct bnxt_ulp_mapper_class_key_field_info *kflds;
+	struct bnxt_ulp_mapper_key_field_info *kflds;
 	struct bnxt_ulp_mapper_cache_entry *cache_entry;
 	struct bnxt_ulp_mapper_ident_info *idents;
 	uint32_t i, num_kflds = 0, num_idents = 0;
drivers/net/bnxt/tf_ulp/ulp_template_db_stingray_act.c +3 -3
index a5019d664..68e4d8e59 100644
@@ -8,7 +8,7 @@
 #include "ulp_template_struct.h"
 #include "ulp_rte_parser.h"
 
-struct bnxt_ulp_mapper_tbl_list_info ulp_act_stingray_tmpl_list[] = {
+struct bnxt_ulp_mapper_tbl_list_info ulp_stingray_act_tmpl_list[] = {
 	[1] = {
 	.device_name = BNXT_ULP_DEVICE_ID_STINGRAY,
 	.num_tbls = 6,
@@ -47,7 +47,7 @@ struct bnxt_ulp_mapper_tbl_list_info ulp_act_stingray_tmpl_list[] = {
 	}
 };
 
-struct bnxt_ulp_mapper_tbl_info ulp_act_stingray_tbl_list[] = {
+struct bnxt_ulp_mapper_tbl_info ulp_stingray_act_tbl_list[] = {
 	{
 	.resource_func = BNXT_ULP_RESOURCE_FUNC_INDEX_TABLE,
 	.resource_type = TF_TBL_TYPE_ACT_STATS_64,
@@ -531,7 +531,7 @@ struct bnxt_ulp_mapper_tbl_info ulp_act_stingray_tbl_list[] = {
 	}
 };
 
-struct bnxt_ulp_mapper_result_field_info ulp_act_stingray_result_field_list[] = {
+struct bnxt_ulp_mapper_result_field_info ulp_stingray_act_result_field_list[] = {
 	{
 	.field_bit_size = 64,
 	.result_opcode = BNXT_ULP_MAPPER_OPC_SET_TO_ZERO
drivers/net/bnxt/tf_ulp/ulp_template_db_stingray_class.c +5 -5
index b5bdb94e8..1fa364e29 100644
@@ -8,7 +8,7 @@
 #include "ulp_template_struct.h"
 #include "ulp_rte_parser.h"
 
-struct bnxt_ulp_mapper_tbl_list_info ulp_class_stingray_tmpl_list[] = {
+struct bnxt_ulp_mapper_tbl_list_info ulp_stingray_class_tmpl_list[] = {
 	[1] = {
 	.device_name = BNXT_ULP_DEVICE_ID_STINGRAY,
 	.num_tbls = 6,
@@ -149,7 +149,7 @@ struct bnxt_ulp_mapper_tbl_list_info ulp_class_stingray_tmpl_list[] = {
 	}
 };
 
-struct bnxt_ulp_mapper_tbl_info ulp_class_stingray_tbl_list[] = {
+struct bnxt_ulp_mapper_tbl_info ulp_stingray_class_tbl_list[] = {
 	{
 	.resource_func = BNXT_ULP_RESOURCE_FUNC_INDEX_TABLE,
 	.resource_type = TF_TBL_TYPE_FULL_ACT_RECORD,
@@ -2349,7 +2349,7 @@ struct bnxt_ulp_mapper_tbl_info ulp_class_stingray_tbl_list[] = {
 	}
 };
 
-struct bnxt_ulp_mapper_class_key_field_info ulp_class_stingray_key_field_list[] = {
+struct bnxt_ulp_mapper_key_field_info ulp_stingray_class_key_field_list[] = {
 	{
 	.field_bit_size = 12,
 	.mask_opcode = BNXT_ULP_MAPPER_OPC_SET_TO_ZERO,
@@ -13070,7 +13070,7 @@ struct bnxt_ulp_mapper_class_key_field_info ulp_class_stingray_key_field_list[]
 	}
 };
 
-struct bnxt_ulp_mapper_result_field_info ulp_class_stingray_result_field_list[] = {
+struct bnxt_ulp_mapper_result_field_info ulp_stingray_class_result_field_list[] = {
 	{
 	.field_bit_size = 14,
 	.result_opcode = BNXT_ULP_MAPPER_OPC_SET_TO_ZERO
@@ -18750,7 +18750,7 @@ struct bnxt_ulp_mapper_result_field_info ulp_class_stingray_result_field_list[]
 	}
 };
 
-struct bnxt_ulp_mapper_ident_info ulp_class_stingray_ident_list[] = {
+struct bnxt_ulp_mapper_ident_info ulp_stingray_class_ident_list[] = {
 	{
 	.resource_func = BNXT_ULP_RESOURCE_FUNC_IDENTIFIER,
 	.ident_type = TF_IDENT_TYPE_L2_CTXT_HIGH,
drivers/net/bnxt/tf_ulp/ulp_template_db_tbl.c +17 -17
index a677b0ca5..7f5a31680 100644
@@ -314,31 +314,31 @@ struct bnxt_ulp_cache_tbl_params ulp_cache_tbl_params[] = {
 
 const struct ulp_template_device_tbls ulp_template_stingray_tbls[] = {
 	[BNXT_ULP_TEMPLATE_TYPE_CLASS] = {
-	.tmpl_list               = ulp_class_stingray_tmpl_list,
-	.tbl_list                = ulp_class_stingray_tbl_list,
-	.key_field_list          = ulp_class_stingray_key_field_list,
-	.result_field_list       = ulp_class_stingray_result_field_list,
-	.ident_list              = ulp_class_stingray_ident_list
+	.tmpl_list               = ulp_stingray_class_tmpl_list,
+	.tbl_list                = ulp_stingray_class_tbl_list,
+	.key_field_list          = ulp_stingray_class_key_field_list,
+	.result_field_list       = ulp_stingray_class_result_field_list,
+	.ident_list              = ulp_stingray_class_ident_list
 	},
 	[BNXT_ULP_TEMPLATE_TYPE_ACTION] = {
-	.tmpl_list               = ulp_act_stingray_tmpl_list,
-	.tbl_list                = ulp_act_stingray_tbl_list,
-	.result_field_list       = ulp_act_stingray_result_field_list
+	.tmpl_list               = ulp_stingray_act_tmpl_list,
+	.tbl_list                = ulp_stingray_act_tbl_list,
+	.result_field_list       = ulp_stingray_act_result_field_list
 	}
 };
 
 const struct ulp_template_device_tbls ulp_template_wh_plus_tbls[] = {
 	[BNXT_ULP_TEMPLATE_TYPE_CLASS] = {
-	.tmpl_list               = ulp_class_wh_plus_tmpl_list,
-	.tbl_list                = ulp_class_wh_plus_tbl_list,
-	.key_field_list          = ulp_class_wh_plus_key_field_list,
-	.result_field_list       = ulp_class_wh_plus_result_field_list,
-	.ident_list              = ulp_class_wh_plus_ident_list
+	.tmpl_list               = ulp_wh_plus_class_tmpl_list,
+	.tbl_list                = ulp_wh_plus_class_tbl_list,
+	.key_field_list          = ulp_wh_plus_class_key_field_list,
+	.result_field_list       = ulp_wh_plus_class_result_field_list,
+	.ident_list              = ulp_wh_plus_class_ident_list
 	},
 	[BNXT_ULP_TEMPLATE_TYPE_ACTION] = {
-	.tmpl_list               = ulp_act_wh_plus_tmpl_list,
-	.tbl_list                = ulp_act_wh_plus_tbl_list,
-	.result_field_list       = ulp_act_wh_plus_result_field_list
+	.tmpl_list               = ulp_wh_plus_act_tmpl_list,
+	.tbl_list                = ulp_wh_plus_act_tbl_list,
+	.result_field_list       = ulp_wh_plus_act_result_field_list
 	}
 };
 
@@ -351,6 +351,7 @@ struct bnxt_ulp_device_params ulp_device_params[BNXT_ULP_DEVICE_ID_LAST] = {
 	.mark_db_lfid_entries    = 65536,
 	.mark_db_gfid_entries    = 65536,
 	.flow_count_db_entries   = 16384,
+	.fdb_parent_flow_entries = 2,
 	.num_resources_per_flow  = 8,
 	.num_phy_ports           = 2,
 	.ext_cntr_table_type     = 0,
@@ -368,7 +369,6 @@ struct bnxt_ulp_device_params ulp_device_params[BNXT_ULP_DEVICE_ID_LAST] = {
 	.mark_db_lfid_entries    = 65536,
 	.mark_db_gfid_entries    = 65536,
 	.flow_count_db_entries   = 16384,
-	.fdb_parent_flow_entries = 2,
 	.num_resources_per_flow  = 8,
 	.num_phy_ports           = 2,
 	.ext_cntr_table_type     = 0,
drivers/net/bnxt/tf_ulp/ulp_template_db_tbl.h +16 -16
index 7a541cb8e..8c13ca387 100644
@@ -8,41 +8,41 @@
 
 #include "ulp_template_struct.h"
 
-extern struct bnxt_ulp_mapper_tbl_list_info ulp_class_wh_plus_tmpl_list[];
+extern struct bnxt_ulp_mapper_tbl_list_info ulp_wh_plus_class_tmpl_list[];
 
-extern struct bnxt_ulp_mapper_tbl_info ulp_class_wh_plus_tbl_list[];
+extern struct bnxt_ulp_mapper_tbl_info ulp_wh_plus_class_tbl_list[];
 
 extern struct
-bnxt_ulp_mapper_class_key_field_info ulp_class_wh_plus_key_field_list[];
+bnxt_ulp_mapper_key_field_info ulp_wh_plus_class_key_field_list[];
 
 extern struct
-bnxt_ulp_mapper_result_field_info ulp_class_wh_plus_result_field_list[];
+bnxt_ulp_mapper_result_field_info ulp_wh_plus_class_result_field_list[];
 
-extern struct bnxt_ulp_mapper_ident_info ulp_class_wh_plus_ident_list[];
+extern struct bnxt_ulp_mapper_ident_info ulp_wh_plus_class_ident_list[];
 
-extern struct bnxt_ulp_mapper_tbl_list_info ulp_act_wh_plus_tmpl_list[];
+extern struct bnxt_ulp_mapper_tbl_list_info ulp_wh_plus_act_tmpl_list[];
 
-extern struct bnxt_ulp_mapper_tbl_info ulp_act_wh_plus_tbl_list[];
+extern struct bnxt_ulp_mapper_tbl_info ulp_wh_plus_act_tbl_list[];
 
 extern struct
-bnxt_ulp_mapper_result_field_info ulp_act_wh_plus_result_field_list[];
+bnxt_ulp_mapper_result_field_info ulp_wh_plus_act_result_field_list[];
 
-extern struct bnxt_ulp_mapper_tbl_list_info ulp_class_stingray_tmpl_list[];
+extern struct bnxt_ulp_mapper_tbl_list_info ulp_stingray_class_tmpl_list[];
 
-extern struct bnxt_ulp_mapper_tbl_info ulp_class_stingray_tbl_list[];
+extern struct bnxt_ulp_mapper_tbl_info ulp_stingray_class_tbl_list[];
 
 extern struct
-bnxt_ulp_mapper_class_key_field_info ulp_class_stingray_key_field_list[];
+bnxt_ulp_mapper_key_field_info ulp_stingray_class_key_field_list[];
 
 extern struct
-bnxt_ulp_mapper_result_field_info ulp_class_stingray_result_field_list[];
+bnxt_ulp_mapper_result_field_info ulp_stingray_class_result_field_list[];
 
-extern struct bnxt_ulp_mapper_ident_info ulp_class_stingray_ident_list[];
+extern struct bnxt_ulp_mapper_ident_info ulp_stingray_class_ident_list[];
 
-extern struct bnxt_ulp_mapper_tbl_list_info ulp_act_stingray_tmpl_list[];
+extern struct bnxt_ulp_mapper_tbl_list_info ulp_stingray_act_tmpl_list[];
 
-extern struct bnxt_ulp_mapper_tbl_info ulp_act_stingray_tbl_list[];
+extern struct bnxt_ulp_mapper_tbl_info ulp_stingray_act_tbl_list[];
 
 extern struct
-bnxt_ulp_mapper_result_field_info ulp_act_stingray_result_field_list[];
+bnxt_ulp_mapper_result_field_info ulp_stingray_act_result_field_list[];
 #endif
drivers/net/bnxt/tf_ulp/ulp_template_db_wh_plus_act.c +3 -3
index 82b2ad980..381278ee9 100644
@@ -8,7 +8,7 @@
 #include "ulp_template_struct.h"
 #include "ulp_rte_parser.h"
 
-struct bnxt_ulp_mapper_tbl_list_info ulp_act_wh_plus_tmpl_list[] = {
+struct bnxt_ulp_mapper_tbl_list_info ulp_wh_plus_act_tmpl_list[] = {
 	[1] = {
 	.device_name = BNXT_ULP_DEVICE_ID_WH_PLUS,
 	.num_tbls = 6,
@@ -47,7 +47,7 @@ struct bnxt_ulp_mapper_tbl_list_info ulp_act_wh_plus_tmpl_list[] = {
 	}
 };
 
-struct bnxt_ulp_mapper_tbl_info ulp_act_wh_plus_tbl_list[] = {
+struct bnxt_ulp_mapper_tbl_info ulp_wh_plus_act_tbl_list[] = {
 	{
 	.resource_func = BNXT_ULP_RESOURCE_FUNC_INDEX_TABLE,
 	.resource_type = TF_TBL_TYPE_ACT_STATS_64,
@@ -530,7 +530,7 @@ struct bnxt_ulp_mapper_tbl_info ulp_act_wh_plus_tbl_list[] = {
 	}
 };
 
-struct bnxt_ulp_mapper_result_field_info ulp_act_wh_plus_result_field_list[] = {
+struct bnxt_ulp_mapper_result_field_info ulp_wh_plus_act_result_field_list[] = {
 	{
 	.field_bit_size = 64,
 	.result_opcode = BNXT_ULP_MAPPER_OPC_SET_TO_ZERO
drivers/net/bnxt/tf_ulp/ulp_template_db_wh_plus_class.c +5 -5
index 9f40b39d8..7024658ce 100644
@@ -8,7 +8,7 @@
 #include "ulp_template_struct.h"
 #include "ulp_rte_parser.h"
 
-struct bnxt_ulp_mapper_tbl_list_info ulp_class_wh_plus_tmpl_list[] = {
+struct bnxt_ulp_mapper_tbl_list_info ulp_wh_plus_class_tmpl_list[] = {
 	[1] = {
 	.device_name = BNXT_ULP_DEVICE_ID_WH_PLUS,
 	.num_tbls = 6,
@@ -149,7 +149,7 @@ struct bnxt_ulp_mapper_tbl_list_info ulp_class_wh_plus_tmpl_list[] = {
 	}
 };
 
-struct bnxt_ulp_mapper_tbl_info ulp_class_wh_plus_tbl_list[] = {
+struct bnxt_ulp_mapper_tbl_info ulp_wh_plus_class_tbl_list[] = {
 	{
 	.resource_func = BNXT_ULP_RESOURCE_FUNC_INDEX_TABLE,
 	.resource_type = TF_TBL_TYPE_FULL_ACT_RECORD,
@@ -2349,7 +2349,7 @@ struct bnxt_ulp_mapper_tbl_info ulp_class_wh_plus_tbl_list[] = {
 	}
 };
 
-struct bnxt_ulp_mapper_class_key_field_info ulp_class_wh_plus_key_field_list[] = {
+struct bnxt_ulp_mapper_key_field_info ulp_wh_plus_class_key_field_list[] = {
 	{
 	.field_bit_size = 8,
 	.mask_opcode = BNXT_ULP_MAPPER_OPC_SET_TO_ZERO,
@@ -13070,7 +13070,7 @@ struct bnxt_ulp_mapper_class_key_field_info ulp_class_wh_plus_key_field_list[] =
 	}
 };
 
-struct bnxt_ulp_mapper_result_field_info ulp_class_wh_plus_result_field_list[] = {
+struct bnxt_ulp_mapper_result_field_info ulp_wh_plus_class_result_field_list[] = {
 	{
 	.field_bit_size = 14,
 	.result_opcode = BNXT_ULP_MAPPER_OPC_SET_TO_ZERO
@@ -18750,7 +18750,7 @@ struct bnxt_ulp_mapper_result_field_info ulp_class_wh_plus_result_field_list[] =
 	}
 };
 
-struct bnxt_ulp_mapper_ident_info ulp_class_wh_plus_ident_list[] = {
+struct bnxt_ulp_mapper_ident_info ulp_wh_plus_class_ident_list[] = {
 	{
 	.resource_func = BNXT_ULP_RESOURCE_FUNC_IDENTIFIER,
 	.ident_type = TF_IDENT_TYPE_L2_CTXT_HIGH,
drivers/net/bnxt/tf_ulp/ulp_template_struct.h +2 -2
index 2e94b6f19..107a06a3d 100644
@@ -144,7 +144,7 @@ extern struct bnxt_ulp_act_match_info ulp_act_match_list[];
 struct ulp_template_device_tbls {
 	struct bnxt_ulp_mapper_tbl_list_info *tmpl_list;
 	struct bnxt_ulp_mapper_tbl_info *tbl_list;
-	struct bnxt_ulp_mapper_class_key_field_info *key_field_list;
+	struct bnxt_ulp_mapper_key_field_info *key_field_list;
 	struct bnxt_ulp_mapper_result_field_info *result_field_list;
 	struct bnxt_ulp_mapper_ident_info *ident_list;
 };
@@ -212,7 +212,7 @@ struct bnxt_ulp_mapper_tbl_info {
 	uint32_t			index_operand;
 };
 
-struct bnxt_ulp_mapper_class_key_field_info {
+struct bnxt_ulp_mapper_key_field_info {
 	uint8_t				description[64];
 	enum bnxt_ulp_mapper_opc	mask_opcode;
 	enum bnxt_ulp_mapper_opc	spec_opcode;
Signature · 1 line
2.21.1 (Apple Git-122.3)
#39 lore raw

PATCH v2 11/12 net/bnxt: remove flow db table type from templates

In reply to Ajit Khaparde

From: Mike Baucom <[email protected]>

FDB type is now driven by the caller, not the template. So remove it.

---
 .../tf_ulp/ulp_template_db_stingray_act.c     | 18 ++---
 .../tf_ulp/ulp_template_db_stingray_class.c   | 69 +++++++------------
 .../bnxt/tf_ulp/ulp_template_db_wh_plus_act.c | 18 ++---
 .../tf_ulp/ulp_template_db_wh_plus_class.c    | 69 +++++++------------
 drivers/net/bnxt/tf_ulp/ulp_template_struct.h |  1 -
 5 files changed, 58 insertions(+), 117 deletions(-)
drivers/net/bnxt/tf_ulp/ulp_template_db_stingray_act.c +6 -12
index 68e4d8e59..2237ffb94 100644
@@ -12,38 +12,32 @@ struct bnxt_ulp_mapper_tbl_list_info ulp_stingray_act_tmpl_list[] = {
 	[1] = {
 	.device_name = BNXT_ULP_DEVICE_ID_STINGRAY,
 	.num_tbls = 6,
-	.start_tbl_idx = 0,
-	.flow_db_table_type = BNXT_ULP_FDB_TYPE_REGULAR
+	.start_tbl_idx = 0
 	},
 	[2] = {
 	.device_name = BNXT_ULP_DEVICE_ID_STINGRAY,
 	.num_tbls = 3,
-	.start_tbl_idx = 6,
-	.flow_db_table_type = BNXT_ULP_FDB_TYPE_REGULAR
+	.start_tbl_idx = 6
 	},
 	[3] = {
 	.device_name = BNXT_ULP_DEVICE_ID_STINGRAY,
 	.num_tbls = 3,
-	.start_tbl_idx = 9,
-	.flow_db_table_type = BNXT_ULP_FDB_TYPE_REGULAR
+	.start_tbl_idx = 9
 	},
 	[4] = {
 	.device_name = BNXT_ULP_DEVICE_ID_STINGRAY,
 	.num_tbls = 6,
-	.start_tbl_idx = 12,
-	.flow_db_table_type = BNXT_ULP_FDB_TYPE_REGULAR
+	.start_tbl_idx = 12
 	},
 	[5] = {
 	.device_name = BNXT_ULP_DEVICE_ID_STINGRAY,
 	.num_tbls = 6,
-	.start_tbl_idx = 18,
-	.flow_db_table_type = BNXT_ULP_FDB_TYPE_REGULAR
+	.start_tbl_idx = 18
 	},
 	[6] = {
 	.device_name = BNXT_ULP_DEVICE_ID_STINGRAY,
 	.num_tbls = 5,
-	.start_tbl_idx = 24,
-	.flow_db_table_type = BNXT_ULP_FDB_TYPE_REGULAR
+	.start_tbl_idx = 24
 	}
 };
 
drivers/net/bnxt/tf_ulp/ulp_template_db_stingray_class.c +23 -46

163 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_template_db_wh_plus_act.c +6 -12
index 381278ee9..39e8ec40b 100644
@@ -12,38 +12,32 @@ struct bnxt_ulp_mapper_tbl_list_info ulp_wh_plus_act_tmpl_list[] = {
 	[1] = {
 	.device_name = BNXT_ULP_DEVICE_ID_WH_PLUS,
 	.num_tbls = 6,
-	.start_tbl_idx = 0,
-	.flow_db_table_type = BNXT_ULP_FDB_TYPE_REGULAR
+	.start_tbl_idx = 0
 	},
 	[2] = {
 	.device_name = BNXT_ULP_DEVICE_ID_WH_PLUS,
 	.num_tbls = 3,
-	.start_tbl_idx = 6,
-	.flow_db_table_type = BNXT_ULP_FDB_TYPE_REGULAR
+	.start_tbl_idx = 6
 	},
 	[3] = {
 	.device_name = BNXT_ULP_DEVICE_ID_WH_PLUS,
 	.num_tbls = 3,
-	.start_tbl_idx = 9,
-	.flow_db_table_type = BNXT_ULP_FDB_TYPE_REGULAR
+	.start_tbl_idx = 9
 	},
 	[4] = {
 	.device_name = BNXT_ULP_DEVICE_ID_WH_PLUS,
 	.num_tbls = 6,
-	.start_tbl_idx = 12,
-	.flow_db_table_type = BNXT_ULP_FDB_TYPE_REGULAR
+	.start_tbl_idx = 12
 	},
 	[5] = {
 	.device_name = BNXT_ULP_DEVICE_ID_WH_PLUS,
 	.num_tbls = 6,
-	.start_tbl_idx = 18,
-	.flow_db_table_type = BNXT_ULP_FDB_TYPE_REGULAR
+	.start_tbl_idx = 18
 	},
 	[6] = {
 	.device_name = BNXT_ULP_DEVICE_ID_WH_PLUS,
 	.num_tbls = 5,
-	.start_tbl_idx = 24,
-	.flow_db_table_type = BNXT_ULP_FDB_TYPE_REGULAR
+	.start_tbl_idx = 24
 	}
 };
 
drivers/net/bnxt/tf_ulp/ulp_template_db_wh_plus_class.c +23 -46

163 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_template_struct.h +0 -1
index 107a06a3d..69bb61e11 100644
@@ -175,7 +175,6 @@ struct bnxt_ulp_mapper_tbl_list_info {
 	uint32_t		device_name;
 	uint32_t		start_tbl_idx;
 	uint32_t		num_tbls;
-	enum bnxt_ulp_fdb_type	flow_db_table_type;
 };
 
 struct bnxt_ulp_mapper_tbl_info {
Signature · 1 line
2.21.1 (Apple Git-122.3)
#40 lore raw

PATCH v2 12/12 net/bnxt: add parent child flow create and free

In reply to Ajit Khaparde

From: Kishore Padmanabha <[email protected]>

Added support in the ULP mapper to enable parent child flow creation and destroy. This feature enables support for the vxlan decap functionality.

---
 drivers/net/bnxt/tf_ulp/ulp_flow_db.c         | 177 +++++++++++++++++-
 drivers/net/bnxt/tf_ulp/ulp_flow_db.h         |  36 ++++
 drivers/net/bnxt/tf_ulp/ulp_mapper.c          |  87 ++++++++-
 drivers/net/bnxt/tf_ulp/ulp_mapper.h          |   7 +
 .../net/bnxt/tf_ulp/ulp_template_db_enum.h    |   5 +-
 5 files changed, 302 insertions(+), 10 deletions(-)
drivers/net/bnxt/tf_ulp/ulp_flow_db.c +171 -6
index a1c39329f..3be748908 100644
@@ -6,10 +6,10 @@
 #include <rte_malloc.h>
 #include "bnxt.h"
 #include "bnxt_tf_common.h"
-#include "ulp_flow_db.h"
 #include "ulp_utils.h"
 #include "ulp_template_struct.h"
 #include "ulp_mapper.h"
+#include "ulp_flow_db.h"
 #include "ulp_fc_mgr.h"
 
 #define ULP_FLOW_DB_RES_DIR_BIT		31
@@ -56,10 +56,10 @@ ulp_flow_db_active_flows_bit_set(struct bnxt_ulp_flow_db *flow_db,
 	} else {
 		if (flow_type == BNXT_ULP_FDB_TYPE_REGULAR)
 			ULP_INDEX_BITMAP_RESET(f_tbl->active_reg_flows[a_idx],
-					     idx);
+					       idx);
 		else
 			ULP_INDEX_BITMAP_RESET(f_tbl->active_dflt_flows[a_idx],
-					     idx);
+					       idx);
 	}
 }
 
@@ -89,6 +89,13 @@ ulp_flow_db_active_flows_bit_is_set(struct bnxt_ulp_flow_db *flow_db,
 					    idx);
 }
 
+static inline enum tf_dir
+ulp_flow_db_resource_dir_get(struct ulp_fdb_resource_info *res_info)
+{
+	return ((res_info->nxt_resource_idx & ULP_FLOW_DB_RES_DIR_MASK) >>
+		ULP_FLOW_DB_RES_DIR_BIT);
+}
+
 static uint8_t
 ulp_flow_db_resource_func_get(struct ulp_fdb_resource_info *res_info)
 {
@@ -157,11 +164,9 @@ ulp_flow_db_res_info_to_params(struct ulp_fdb_resource_info *resource_info,
 			       struct ulp_flow_db_res_params *params)
 {
 	memset(params, 0, sizeof(struct ulp_flow_db_res_params));
-	params->direction = ((resource_info->nxt_resource_idx &
-				 ULP_FLOW_DB_RES_DIR_MASK) >>
-				 ULP_FLOW_DB_RES_DIR_BIT);
 
 	/* use the helper function to get the resource func */
+	params->direction = ulp_flow_db_resource_dir_get(resource_info);
 	params->resource_func = ulp_flow_db_resource_func_get(resource_info);
 
 	if (params->resource_func == BNXT_ULP_RESOURCE_FUNC_EXT_EM_TABLE ||
@@ -303,6 +308,9 @@ ulp_flow_db_parent_tbl_init(struct bnxt_ulp_flow_db *flow_db,
 	struct ulp_fdb_parent_child_db *p_db;
 	uint32_t size, idx;
 
+	if (!num_entries)
+		return 0;
+
 	/* update the sizes for the allocation */
 	p_db = &flow_db->parent_child_db;
 	p_db->child_bitset_size = (flow_db->flow_tbl.num_flows /
@@ -1171,6 +1179,12 @@ ulp_flow_db_parent_flow_alloc(struct bnxt_ulp_context *ulp_ctxt,
 		return -EINVAL;
 	}
 
+	/* No support for parent child db then just exit */
+	if (!flow_db->parent_child_db.entries_count) {
+		BNXT_TF_DBG(ERR, "parent child db not supported\n");
+		return -EINVAL;
+	}
+
 	p_pdb = &flow_db->parent_child_db;
 	for (idx = 0; idx <= p_pdb->entries_count; idx++) {
 		if (p_pdb->parent_flow_tbl[idx].parent_fid == fid) {
@@ -1220,6 +1234,12 @@ ulp_flow_db_parent_flow_free(struct bnxt_ulp_context *ulp_ctxt,
 		return -EINVAL;
 	}
 
+	/* No support for parent child db then just exit */
+	if (!flow_db->parent_child_db.entries_count) {
+		BNXT_TF_DBG(ERR, "parent child db not supported\n");
+		return -EINVAL;
+	}
+
 	p_pdb = &flow_db->parent_child_db;
 	for (idx = 0; idx <= p_pdb->entries_count; idx++) {
 		if (p_pdb->parent_flow_tbl[idx].parent_fid == fid) {
@@ -1273,6 +1293,12 @@ ulp_flow_db_parent_child_flow_set(struct bnxt_ulp_context *ulp_ctxt,
 		return -EINVAL;
 	}
 
+	/* No support for parent child db then just exit */
+	if (!flow_db->parent_child_db.entries_count) {
+		BNXT_TF_DBG(ERR, "parent child db not supported\n");
+		return -EINVAL;
+	}
+
 	p_pdb = &flow_db->parent_child_db;
 	a_idx = child_fid / ULP_INDEX_BITMAP_SIZE;
 	for (idx = 0; idx <= p_pdb->entries_count; idx++) {
@@ -1320,6 +1346,12 @@ ulp_flow_db_parent_flow_idx_get(struct bnxt_ulp_context *ulp_ctxt,
 		return -EINVAL;
 	}
 
+	/* No support for parent child db then just exit */
+	if (!flow_db->parent_child_db.entries_count) {
+		BNXT_TF_DBG(ERR, "parent child db not supported\n");
+		return -EINVAL;
+	}
+
 	p_pdb = &flow_db->parent_child_db;
 	for (idx = 0; idx <= p_pdb->entries_count; idx++) {
 		if (p_pdb->parent_flow_tbl[idx].parent_fid == parent_fid) {
@@ -1392,3 +1424,136 @@ ulp_flow_db_parent_child_flow_next_entry_get(struct bnxt_ulp_flow_db *flow_db,
 	*child_fid = next_fid;
 	return 0;
 }
+
+/*
+ * Orphan the child flow entry
+ * This is called only for child flows that have
+ * BNXT_ULP_RESOURCE_FUNC_CHILD_FLOW resource
+ *
+ * ulp_ctxt [in] Ptr to ulp_context
+ * flow_type [in] Specify it is regular or default flow
+ * fid [in] The index to the flow entry
+ *
+ * Returns 0 on success and negative on failure.
+ */
+int32_t
+ulp_flow_db_child_flow_reset(struct bnxt_ulp_context *ulp_ctxt,
+			     enum bnxt_ulp_fdb_type flow_type,
+			     uint32_t fid)
+{
+	struct bnxt_ulp_flow_db *flow_db;
+	struct bnxt_ulp_flow_tbl *flow_tbl;
+	struct ulp_fdb_resource_info *fid_res;
+	uint32_t res_id = 0;
+
+	flow_db = bnxt_ulp_cntxt_ptr2_flow_db_get(ulp_ctxt);
+	if (!flow_db) {
+		BNXT_TF_DBG(ERR, "Invalid Arguments\n");
+		return -EINVAL;
+	}
+
+	if (flow_type > BNXT_ULP_FDB_TYPE_DEFAULT) {
+		BNXT_TF_DBG(ERR, "Invalid flow type\n");
+		return -EINVAL;
+	}
+
+	flow_tbl = &flow_db->flow_tbl;
+	/* check for max flows */
+	if (fid >= flow_tbl->num_flows || !fid) {
+		BNXT_TF_DBG(ERR, "Invalid flow index %x\n", fid);
+		return -EINVAL;
+	}
+
+	/* check if the flow is active or not */
+	if (!ulp_flow_db_active_flows_bit_is_set(flow_db, flow_type, fid)) {
+		BNXT_TF_DBG(ERR, "flow does not exist\n");
+		return -EINVAL;
+	}
+
+	/* Iterate the resource to get the resource handle */
+	res_id =  fid;
+	while (res_id) {
+		fid_res = &flow_tbl->flow_resources[res_id];
+		if (ulp_flow_db_resource_func_get(fid_res) ==
+		    BNXT_ULP_RESOURCE_FUNC_CHILD_FLOW) {
+			/* invalidate the resource details */
+			fid_res->resource_hndl = 0;
+			return 0;
+		}
+		res_id = 0;
+		ULP_FLOW_DB_RES_NXT_SET(res_id, fid_res->nxt_resource_idx);
+	}
+	/* failed */
+	return -1;
+}
+
+/*
+ * Create parent flow in the parent flow tbl
+ *
+ * parms [in] Ptr to mapper params
+ *
+ * Returns 0 on success and negative on failure.
+ */
+int32_t
+ulp_flow_db_parent_flow_create(struct bnxt_ulp_mapper_parms *parms)
+{
+	struct ulp_flow_db_res_params fid_parms;
+	int32_t fid_idx;
+
+	/* create the child flow entry in parent flow table */
+	fid_idx = ulp_flow_db_parent_flow_alloc(parms->ulp_ctx, parms->fid);
+	if (fid_idx < 0) {
+		BNXT_TF_DBG(ERR, "Error in creating parent flow fid %x\n",
+			    parms->fid);
+		return -1;
+	}
+
+	/* Add the parent details in the resource list of the flow */
+	memset(&fid_parms, 0, sizeof(fid_parms));
+	fid_parms.resource_func	= BNXT_ULP_RESOURCE_FUNC_PARENT_FLOW;
+	fid_parms.resource_hndl	= fid_idx;
+	fid_parms.critical_resource = BNXT_ULP_CRITICAL_RESOURCE_NO;
+	if (ulp_flow_db_resource_add(parms->ulp_ctx, BNXT_ULP_FDB_TYPE_REGULAR,
+				     parms->fid, &fid_parms)) {
+		BNXT_TF_DBG(ERR, "Error in adding flow res for fid %x\n",
+			    parms->fid);
+		return -1;
+	}
+	return 0;
+}
+
+/*
+ * Create child flow in the parent flow tbl
+ *
+ * parms [in] Ptr to mapper params
+ *
+ * Returns 0 on success and negative on failure.
+ */
+int32_t
+ulp_flow_db_child_flow_create(struct bnxt_ulp_mapper_parms *parms)
+{
+	struct ulp_flow_db_res_params fid_parms;
+	int32_t rc;
+
+	/* create the parent flow entry in parent flow table */
+	rc = ulp_flow_db_parent_child_flow_set(parms->ulp_ctx,
+					       parms->parent_fid,
+					       parms->fid, 1);
+	if (rc) {
+		BNXT_TF_DBG(ERR, "Error in setting child fid %x\n", parms->fid);
+		return -1;
+	}
+
+	/* Add the parent details in the resource list of the flow */
+	memset(&fid_parms, 0, sizeof(fid_parms));
+	fid_parms.resource_func	= BNXT_ULP_RESOURCE_FUNC_CHILD_FLOW;
+	fid_parms.resource_hndl	= parms->parent_fid;
+	fid_parms.critical_resource = BNXT_ULP_CRITICAL_RESOURCE_NO;
+	if (ulp_flow_db_resource_add(parms->ulp_ctx, BNXT_ULP_FDB_TYPE_REGULAR,
+				     parms->fid, &fid_parms)) {
+		BNXT_TF_DBG(ERR, "Error in adding flow res for fid %x\n",
+			    parms->fid);
+		return -1;
+	}
+	return 0;
+}
drivers/net/bnxt/tf_ulp/ulp_flow_db.h +36 -0
index 87bcd69ae..95fd1992d 100644
@@ -8,6 +8,7 @@
 
 #include "bnxt_ulp.h"
 #include "ulp_template_db_enum.h"
+#include "ulp_mapper.h"
 
 #define BNXT_FLOW_DB_DEFAULT_NUM_FLOWS		512
 #define BNXT_FLOW_DB_DEFAULT_NUM_RESOURCES	8
@@ -319,5 +320,40 @@ ulp_flow_db_parent_child_flow_next_entry_get(struct bnxt_ulp_flow_db *flow_db,
 					     uint32_t parent_idx,
 					     uint32_t *child_fid);
 
+/*
+ * Orphan the child flow entry
+ * This is called only for child flows that have
+ * BNXT_ULP_RESOURCE_FUNC_CHILD_FLOW resource
+ *
+ * ulp_ctxt [in] Ptr to ulp_context
+ * flow_type [in] Specify it is regular or default flow
+ * fid [in] The index to the flow entry
+ *
+ * Returns 0 on success and negative on failure.
+ */
+int32_t
+ulp_flow_db_child_flow_reset(struct bnxt_ulp_context *ulp_ctxt,
+			     enum bnxt_ulp_fdb_type flow_type,
+			     uint32_t fid);
+
+/*
+ * Create parent flow in the parent flow tbl
+ *
+ * parms [in] Ptr to mapper params
+ *
+ * Returns 0 on success and negative on failure.
+ */
+int32_t
+ulp_flow_db_parent_flow_create(struct bnxt_ulp_mapper_parms *parms);
+
+/*
+ * Create child flow in the parent flow tbl
+ *
+ * parms [in] Ptr to mapper params
+ *
+ * Returns 0 on success and negative on failure.
+ */
+int32_t
+ulp_flow_db_child_flow_create(struct bnxt_ulp_mapper_parms *parms);
 
 #endif /* _ULP_FLOW_DB_H_ */
drivers/net/bnxt/tf_ulp/ulp_mapper.c +84 -3

136 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_mapper.h +7 -0
index 6f93bcdc1..542e41e5a 100644
@@ -76,6 +76,8 @@ struct bnxt_ulp_mapper_parms {
 	enum bnxt_ulp_cache_table_opc		tcam_tbl_opc;
 	struct bnxt_ulp_mapper_cache_entry	*cache_ptr;
 	struct bnxt_ulp_device_params           *device_params;
+	uint32_t				parent_fid;
+	uint32_t				parent_flow;
 };
 
 struct bnxt_ulp_mapper_create_parms {
@@ -90,6 +92,11 @@ struct bnxt_ulp_mapper_create_parms {
 	uint16_t			func_id;
 	uint32_t			dir_attr;
 	enum bnxt_ulp_fdb_type		flow_type;
+
+	/* 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 */
+	uint32_t			parent_flow;
 };
 
 /* Function to initialize any dynamic mapper data. */
drivers/net/bnxt/tf_ulp/ulp_template_db_enum.h +4 -1
index 81da34e3a..168e308c2 100644
@@ -321,7 +321,10 @@ enum bnxt_ulp_resource_func {
 	BNXT_ULP_RESOURCE_FUNC_CACHE_TABLE = 0x82,
 	BNXT_ULP_RESOURCE_FUNC_IDENTIFIER = 0x83,
 	BNXT_ULP_RESOURCE_FUNC_IF_TABLE = 0x84,
-	BNXT_ULP_RESOURCE_FUNC_HW_FID = 0x85
+	BNXT_ULP_RESOURCE_FUNC_HW_FID = 0x85,
+	BNXT_ULP_RESOURCE_FUNC_SHARED_TABLE = 0x86,
+	BNXT_ULP_RESOURCE_FUNC_PARENT_FLOW = 0x87,
+	BNXT_ULP_RESOURCE_FUNC_CHILD_FLOW = 0x88
 };
 
 enum bnxt_ulp_resource_sub_type {
Signature · 1 line
2.21.1 (Apple Git-122.3)
#41 lore raw
In reply to Ajit Khaparde
Quoted 9 lines · Ajit Khaparde

Fixes and enchancements in the bnxt PMD, mostly in the TRUFLOW layer, including templates to add support for Stingray device.

v2:
- squashed patch patch 13 to patch 7
- updated and fixed commit logs
- updated docs and release notes where necessary

Patchset applied to dpdk-next-net-brcm/for-next-net. Thanks

Quoted 57 lines

Kishore Padmanabha (4):
net/bnxt: fix the corruption of the session details net/bnxt: combine default and regular flows net/bnxt: add support for parent child flow database net/bnxt: add parent child flow create and free

Mike Baucom (6):
net/bnxt: add multi-device infrastructure net/bnxt: add Stingray device support to ULP net/bnxt: consolidate template table processing net/bnxt: support runtime EM selection net/bnxt: consolidate template table processing net/bnxt: remove flow db table type from templates

Venkat Duvvuru (2):
net/bnxt: fix PMD PF support in SR-IOV mode net/bnxt: handle default vnic change async event

 doc/guides/nics/bnxt.rst                      |    42 +
 doc/guides/rel_notes/release_20_11.rst        |     1 +
 drivers/net/bnxt/bnxt.h                       |     6 +-
 drivers/net/bnxt/bnxt_cpr.c                   |    13 +-
 drivers/net/bnxt/bnxt_ethdev.c                |    40 +-
 drivers/net/bnxt/bnxt_hwrm.c                  |   463 +-
 drivers/net/bnxt/bnxt_hwrm.h                  |    12 +-
 drivers/net/bnxt/meson.build                  |     4 +
 drivers/net/bnxt/tf_ulp/bnxt_ulp.c            |   387 +-
 drivers/net/bnxt/tf_ulp/bnxt_ulp.h            |    11 +
 drivers/net/bnxt/tf_ulp/bnxt_ulp_flow.c       |     5 +-
 drivers/net/bnxt/tf_ulp/ulp_def_rules.c       |     5 +-
 drivers/net/bnxt/tf_ulp/ulp_fc_mgr.c          |     2 +-
 drivers/net/bnxt/tf_ulp/ulp_flow_db.c         |   892 +-
 drivers/net/bnxt/tf_ulp/ulp_flow_db.h         |   179 +-
 drivers/net/bnxt/tf_ulp/ulp_mapper.c          |   520 +-
 drivers/net/bnxt/tf_ulp/ulp_mapper.h          |    22 +-
 drivers/net/bnxt/tf_ulp/ulp_template_db_act.c |  1810 --
 .../net/bnxt/tf_ulp/ulp_template_db_class.c   | 16271 -------------
 .../net/bnxt/tf_ulp/ulp_template_db_enum.h    |    18 +-
 .../tf_ulp/ulp_template_db_stingray_act.c     |  3305 +++
 .../tf_ulp/ulp_template_db_stingray_class.c   | 19005 ++++++++++++++++
 drivers/net/bnxt/tf_ulp/ulp_template_db_tbl.c |    59 +-
 drivers/net/bnxt/tf_ulp/ulp_template_db_tbl.h |    48 +
 .../bnxt/tf_ulp/ulp_template_db_wh_plus_act.c |  3304 +++
 .../tf_ulp/ulp_template_db_wh_plus_class.c    | 19005 ++++++++++++++++
 drivers/net/bnxt/tf_ulp/ulp_template_struct.h |    64 +-
 drivers/net/bnxt/tf_ulp/ulp_utils.h           |     4 +
 28 files changed, 46530 insertions(+), 18967 deletions(-)
 create mode 100644 drivers/net/bnxt/tf_ulp/ulp_template_db_stingray_act.c
 create mode 100644 drivers/net/bnxt/tf_ulp/ulp_template_db_stingray_class.c
 create mode 100644 drivers/net/bnxt/tf_ulp/ulp_template_db_tbl.h
 create mode 100644 drivers/net/bnxt/tf_ulp/ulp_template_db_wh_plus_act.c
 create mode 100644 drivers/net/bnxt/tf_ulp/ulp_template_db_wh_plus_class.c

--
2.21.1 (Apple Git-122.3)

#42 lore raw

PATCH v2 2/12 net/bnxt: add multi-device infrastructure

In reply to Somnath Kotur

From: Mike Baucom <[email protected]>

In order to support multiple devices this patch:
- Breaks the template into device specific files
- Changes template list retrieval to use device id
- Determines the software device id using the bp pointer
- Determines the TRUFLOW resources based on device id

---
 drivers/net/bnxt/meson.build                  |     2 +
 drivers/net/bnxt/tf_ulp/bnxt_ulp.c            |   223 +-
 drivers/net/bnxt/tf_ulp/ulp_mapper.c          |   150 +-
 drivers/net/bnxt/tf_ulp/ulp_template_db_act.c |  1810 --
 .../net/bnxt/tf_ulp/ulp_template_db_class.c   | 16271 ----------------
 drivers/net/bnxt/tf_ulp/ulp_template_db_tbl.c |    16 +-
 drivers/net/bnxt/tf_ulp/ulp_template_db_tbl.h |    29 +
 .../bnxt/tf_ulp/ulp_template_db_wh_plus_act.c |  1813 ++
 .../tf_ulp/ulp_template_db_wh_plus_class.c    | 16258 +++++++++++++++
 drivers/net/bnxt/tf_ulp/ulp_template_struct.h |    58 +-
 10 files changed, 18355 insertions(+), 18275 deletions(-)
 create mode 100644 drivers/net/bnxt/tf_ulp/ulp_template_db_tbl.h
 create mode 100644 drivers/net/bnxt/tf_ulp/ulp_template_db_wh_plus_act.c
 create mode 100644 drivers/net/bnxt/tf_ulp/ulp_template_db_wh_plus_class.c
drivers/net/bnxt/meson.build +2 -0
index a89d1f97c..b00da6074 100644
@@ -64,6 +64,8 @@ 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_template_db_wh_plus_act.c',
+	'tf_ulp/ulp_template_db_wh_plus_class.c',
 
 	'rte_pmd_bnxt.c')
 
drivers/net/bnxt/tf_ulp/bnxt_ulp.c +148 -75

259 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_mapper.c +77 -73

384 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_template_db_act.c +0 -1810

1,813 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_template_db_class.c +0 -16271

536 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_template_db_tbl.c +15 -1
index f2e2a5950..9cf62a094 100644

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

drivers/net/bnxt/tf_ulp/ulp_template_db_tbl.h new file +29 -0
new file mode 100644
index 000000000..55c33851d

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

drivers/net/bnxt/tf_ulp/ulp_template_db_wh_plus_act.c new file +1813 -0

1,813 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_template_db_wh_plus_class.c new file +16258 -0

16,258 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_template_struct.h +13 -45

58 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.