Skip to contentSkip to conversation

add support for host based flow table management

PATCH Superseded Venkat Duvvuru 4 participants 154 messages Mar 17, 2020 – Apr 22, 2020 Page 3 of 3

Subsystems (2)
lore
Share & tools
lore
#107 lore raw

PATCH v4 1/34 net/bnxt: add updated dpdk hsi structure

In reply to Venkat Duvvuru

From: Ajit Kumar Khaparde <[email protected]>

- Add most recent bnxt dpdk header.
- HWRM version updated to 1.10.1.30

---
 drivers/net/bnxt/hsi_struct_def_dpdk.h | 3786 +++++++++++++++++++++++++++++---
 1 file changed, 3436 insertions(+), 350 deletions(-)
drivers/net/bnxt/hsi_struct_def_dpdk.h +3436 -350
index c2bae0f..cde96e7 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright (c) 2014-2019 Broadcom Inc.
+ * Copyright (c) 2014-2020 Broadcom Inc.
  * All rights reserved.
  *
  * DO NOT MODIFY!!! This file is automatically generated.
@@ -386,6 +386,8 @@ struct cmd_nums {
 	#define HWRM_PORT_PHY_MDIO_READ                   UINT32_C(0xb6)
 	#define HWRM_PORT_PHY_MDIO_BUS_ACQUIRE            UINT32_C(0xb7)
 	#define HWRM_PORT_PHY_MDIO_BUS_RELEASE            UINT32_C(0xb8)
+	#define HWRM_PORT_QSTATS_EXT_PFC_WD               UINT32_C(0xb9)
+	#define HWRM_PORT_ECN_QSTATS                      UINT32_C(0xba)
 	#define HWRM_FW_RESET                             UINT32_C(0xc0)
 	#define HWRM_FW_QSTATUS                           UINT32_C(0xc1)
 	#define HWRM_FW_HEALTH_CHECK                      UINT32_C(0xc2)
@@ -404,6 +406,8 @@ struct cmd_nums {
 	#define HWRM_FW_GET_STRUCTURED_DATA               UINT32_C(0xcb)
 	/* Experimental */
 	#define HWRM_FW_IPC_MAILBOX                       UINT32_C(0xcc)
+	#define HWRM_FW_ECN_CFG                           UINT32_C(0xcd)
+	#define HWRM_FW_ECN_QCFG                          UINT32_C(0xce)
 	#define HWRM_EXEC_FWD_RESP                        UINT32_C(0xd0)
 	#define HWRM_REJECT_FWD_RESP                      UINT32_C(0xd1)
 	#define HWRM_FWD_RESP                             UINT32_C(0xd2)
@@ -419,6 +423,7 @@ struct cmd_nums {
 	#define HWRM_TEMP_MONITOR_QUERY                   UINT32_C(0xe0)
 	#define HWRM_REG_POWER_QUERY                      UINT32_C(0xe1)
 	#define HWRM_CORE_FREQUENCY_QUERY                 UINT32_C(0xe2)
+	#define HWRM_REG_POWER_HISTOGRAM                  UINT32_C(0xe3)
 	#define HWRM_WOL_FILTER_ALLOC                     UINT32_C(0xf0)
 	#define HWRM_WOL_FILTER_FREE                      UINT32_C(0xf1)
 	#define HWRM_WOL_FILTER_QCFG                      UINT32_C(0xf2)
@@ -510,7 +515,7 @@ struct cmd_nums {
 	#define HWRM_CFA_EEM_OP                           UINT32_C(0x123)
 	/* Experimental */
 	#define HWRM_CFA_ADV_FLOW_MGNT_QCAPS              UINT32_C(0x124)
-	/* Experimental */
+	/* Experimental - DEPRECATED */
 	#define HWRM_CFA_TFLIB                            UINT32_C(0x125)
 	/* Engine CKV - Get the current allocation status of keys provisioned in the key vault. */
 	#define HWRM_ENGINE_CKV_STATUS                    UINT32_C(0x12e)
@@ -629,6 +634,56 @@ struct cmd_nums {
 	 * to the host test.
 	 */
 	#define HWRM_MFG_HDMA_TEST                        UINT32_C(0x209)
+	/* Tells the fw to program the fru memory */
+	#define HWRM_MFG_FRU_EEPROM_WRITE                 UINT32_C(0x20a)
+	/* Tells the fw to read the fru memory */
+	#define HWRM_MFG_FRU_EEPROM_READ                  UINT32_C(0x20b)
+	/* Experimental */
+	#define HWRM_TF                                   UINT32_C(0x2bc)
+	/* Experimental */
+	#define HWRM_TF_VERSION_GET                       UINT32_C(0x2bd)
+	/* Experimental */
+	#define HWRM_TF_SESSION_OPEN                      UINT32_C(0x2c6)
+	/* Experimental */
+	#define HWRM_TF_SESSION_ATTACH                    UINT32_C(0x2c7)
+	/* Experimental */
+	#define HWRM_TF_SESSION_CLOSE                     UINT32_C(0x2c8)
+	/* Experimental */
+	#define HWRM_TF_SESSION_QCFG                      UINT32_C(0x2c9)
+	/* Experimental */
+	#define HWRM_TF_SESSION_RESC_QCAPS                UINT32_C(0x2ca)
+	/* Experimental */
+	#define HWRM_TF_SESSION_RESC_ALLOC                UINT32_C(0x2cb)
+	/* Experimental */
+	#define HWRM_TF_SESSION_RESC_FREE                 UINT32_C(0x2cc)
+	/* Experimental */
+	#define HWRM_TF_SESSION_RESC_FLUSH                UINT32_C(0x2cd)
+	/* Experimental */
+	#define HWRM_TF_TBL_TYPE_GET                      UINT32_C(0x2d0)
+	/* Experimental */
+	#define HWRM_TF_TBL_TYPE_SET                      UINT32_C(0x2d1)
+	/* Experimental */
+	#define HWRM_TF_CTXT_MEM_RGTR                     UINT32_C(0x2da)
+	/* Experimental */
+	#define HWRM_TF_CTXT_MEM_UNRGTR                   UINT32_C(0x2db)
+	/* Experimental */
+	#define HWRM_TF_EXT_EM_QCAPS                      UINT32_C(0x2dc)
+	/* Experimental */
+	#define HWRM_TF_EXT_EM_OP                         UINT32_C(0x2dd)
+	/* Experimental */
+	#define HWRM_TF_EXT_EM_CFG                        UINT32_C(0x2de)
+	/* Experimental */
+	#define HWRM_TF_EXT_EM_QCFG                       UINT32_C(0x2df)
+	/* Experimental */
+	#define HWRM_TF_TCAM_SET                          UINT32_C(0x2ee)
+	/* Experimental */
+	#define HWRM_TF_TCAM_GET                          UINT32_C(0x2ef)
+	/* Experimental */
+	#define HWRM_TF_TCAM_MOVE                         UINT32_C(0x2f0)
+	/* Experimental */
+	#define HWRM_TF_TCAM_FREE                         UINT32_C(0x2f1)
+	/* Experimental */
+	#define HWRM_SV                                   UINT32_C(0x400)
 	/* Experimental */
 	#define HWRM_DBG_READ_DIRECT                      UINT32_C(0xff10)
 	/* Experimental */
@@ -658,6 +713,8 @@ struct cmd_nums {
 	#define HWRM_DBG_CRASHDUMP_HEADER                 UINT32_C(0xff1d)
 	/* Experimental */
 	#define HWRM_DBG_CRASHDUMP_ERASE                  UINT32_C(0xff1e)
+	/* Send driver debug information to firmware */
+	#define HWRM_DBG_DRV_TRACE                        UINT32_C(0xff1f)
 	/* Experimental */
 	#define HWRM_NVM_FACTORY_DEFAULTS                 UINT32_C(0xffee)
 	#define HWRM_NVM_VALIDATE_OPTION                  UINT32_C(0xffef)
@@ -857,8 +914,8 @@ struct hwrm_err_output {
 #define HWRM_VERSION_MINOR 10
 #define HWRM_VERSION_UPDATE 1
 /* non-zero means beta version */
-#define HWRM_VERSION_RSVD 6
-#define HWRM_VERSION_STR "1.10.1.6"
+#define HWRM_VERSION_RSVD 30
+#define HWRM_VERSION_STR "1.10.1.30"
 
 /****************
  * hwrm_ver_get *
@@ -1143,6 +1200,7 @@ struct hwrm_ver_get_output {
 	#define HWRM_VER_GET_OUTPUT_DEV_CAPS_CFG_CFA_ADV_FLOW_MGNT_SUPPORTED \
 		UINT32_C(0x1000)
 	/*
+	 * Deprecated and replaced with cfa_truflow_supported.
 	 * If set to 1, the firmware is able to support TFLIB features.
 	 * If set to 0, then the firmware doesn’t support TFLIB features.
 	 * By default, this flag should be 0 for older version of core firmware.
@@ -1150,6 +1208,14 @@ struct hwrm_ver_get_output {
 	#define HWRM_VER_GET_OUTPUT_DEV_CAPS_CFG_CFA_TFLIB_SUPPORTED \
 		UINT32_C(0x2000)
 	/*
+	 * If set to 1, the firmware is able to support TruFlow features.
+	 * If set to 0, then the firmware doesn’t support TruFlow features.
+	 * By default, this flag should be 0 for older version of
+	 * core firmware.
+	 */
+	#define HWRM_VER_GET_OUTPUT_DEV_CAPS_CFG_CFA_TRUFLOW_SUPPORTED \
+		UINT32_C(0x4000)
+	/*
 	 * This field represents the major version of RoCE firmware.
 	 * A change in major version represents a major release.
 	 */
@@ -4508,10 +4574,16 @@ struct hwrm_async_event_cmpl {
 	 */
 	#define HWRM_ASYNC_EVENT_CMPL_EVENT_ID_EEM_CFG_CHANGE \
 		UINT32_C(0x3c)
-	/* TFLIB unique default VNIC Configuration Change */
+	/*
+	 * Deprecated.
+	 * TFLIB unique default VNIC Configuration Change
+	 */
 	#define HWRM_ASYNC_EVENT_CMPL_EVENT_ID_TFLIB_DEFAULT_VNIC_CHANGE \
 		UINT32_C(0x3d)
-	/* TFLIB unique link status changed */
+	/*
+	 * Deprecated.
+	 * TFLIB unique link status changed
+	 */
 	#define HWRM_ASYNC_EVENT_CMPL_EVENT_ID_TFLIB_LINK_STATUS_CHANGE \
 		UINT32_C(0x3e)
 	/*
@@ -4521,6 +4593,19 @@ struct hwrm_async_event_cmpl {
 	#define HWRM_ASYNC_EVENT_CMPL_EVENT_ID_QUIESCE_DONE \
 		UINT32_C(0x3f)
 	/*
+	 * An event signifying a HWRM command is in progress and its
+	 * response will be deferred. This event is used on crypto controllers
+	 * only.
+	 */
+	#define HWRM_ASYNC_EVENT_CMPL_EVENT_ID_DEFERRED_RESPONSE \
+		UINT32_C(0x40)
+	/*
+	 * An event signifying that a PFC WatchDog configuration
+	 * has changed on any port / cos.
+	 */
+	#define HWRM_ASYNC_EVENT_CMPL_EVENT_ID_PFC_WATCHDOG_CFG_CHANGE \
+		UINT32_C(0x41)
+	/*
 	 * A trace log message. This contains firmware trace logs string
 	 * embedded in the asynchronous message. This is an experimental
 	 * event, not meant for production use at this time.
@@ -6393,6 +6478,36 @@ struct hwrm_async_event_cmpl_quiesce_done {
 		UINT32_C(0x2)
 	#define HWRM_ASYNC_EVENT_CMPL_QUIESCE_DONE_EVENT_DATA2_QUIESCE_STATUS_LAST \
 		HWRM_ASYNC_EVENT_CMPL_QUIESCE_DONE_EVENT_DATA2_QUIESCE_STATUS_ERROR
+	/* opaque is 8 b */
+	#define HWRM_ASYNC_EVENT_CMPL_QUIESCE_DONE_EVENT_DATA2_OPAQUE_MASK \
+		UINT32_C(0xff00)
+	#define HWRM_ASYNC_EVENT_CMPL_QUIESCE_DONE_EVENT_DATA2_OPAQUE_SFT \
+		8
+	/*
+	 * Additional information about internal hardware state related to
+	 * idle/quiesce state.  QUIESCE may succeed per quiesce_status
+	 * regardless of idle_state_flags.  If QUIESCE fails, the host may
+	 * inspect idle_state_flags to determine whether a retry is warranted.
+	 */
+	#define HWRM_ASYNC_EVENT_CMPL_QUIESCE_DONE_EVENT_DATA2_IDLE_STATE_FLAGS_MASK \
+		UINT32_C(0xff0000)
+	#define HWRM_ASYNC_EVENT_CMPL_QUIESCE_DONE_EVENT_DATA2_IDLE_STATE_FLAGS_SFT \
+		16
+	/*
+	 * Failure to quiesce is caused by host not updating the NQ consumer
+	 * index.
+	 */
+	#define HWRM_ASYNC_EVENT_CMPL_QUIESCE_DONE_EVENT_DATA2_IDLE_STATE_FLAGS_INCOMPLETE_NQ \
+		UINT32_C(0x10000)
+	/* Flag 1 indicating partial non-idle state. */
+	#define HWRM_ASYNC_EVENT_CMPL_QUIESCE_DONE_EVENT_DATA2_IDLE_STATE_FLAGS_IDLE_STATUS_1 \
+		UINT32_C(0x20000)
+	/* Flag 2 indicating partial non-idle state. */
+	#define HWRM_ASYNC_EVENT_CMPL_QUIESCE_DONE_EVENT_DATA2_IDLE_STATE_FLAGS_IDLE_STATUS_2 \
+		UINT32_C(0x40000)
+	/* Flag 3 indicating partial non-idle state. */
+	#define HWRM_ASYNC_EVENT_CMPL_QUIESCE_DONE_EVENT_DATA2_IDLE_STATE_FLAGS_IDLE_STATUS_3 \
+		UINT32_C(0x80000)
 	uint8_t	opaque_v;
 	/*
 	 * This value is written by the NIC such that it will be different
@@ -6414,6 +6529,152 @@ struct hwrm_async_event_cmpl_quiesce_done {
 		UINT32_C(0x1)
 } __attribute__((packed));
 
+/* hwrm_async_event_cmpl_deferred_response (size:128b/16B) */
+struct hwrm_async_event_cmpl_deferred_response {
+	uint16_t	type;
+	/*
+	 * This field indicates the exact type of the completion.
+	 * By convention, the LSB identifies the length of the
+	 * record in 16B units. Even values indicate 16B
+	 * records. Odd values indicate 32B
+	 * records.
+	 */
+	#define HWRM_ASYNC_EVENT_CMPL_DEFERRED_RESPONSE_TYPE_MASK \
+		UINT32_C(0x3f)
+	#define HWRM_ASYNC_EVENT_CMPL_DEFERRED_RESPONSE_TYPE_SFT             0
+	/* HWRM Asynchronous Event Information */
+	#define HWRM_ASYNC_EVENT_CMPL_DEFERRED_RESPONSE_TYPE_HWRM_ASYNC_EVENT \
+		UINT32_C(0x2e)
+	#define HWRM_ASYNC_EVENT_CMPL_DEFERRED_RESPONSE_TYPE_LAST \
+		HWRM_ASYNC_EVENT_CMPL_DEFERRED_RESPONSE_TYPE_HWRM_ASYNC_EVENT
+	/* Identifiers of events. */
+	uint16_t	event_id;
+	/*
+	 * An event signifying a HWRM command is in progress and its
+	 * response will be deferred
+	 */
+	#define HWRM_ASYNC_EVENT_CMPL_DEFERRED_RESPONSE_EVENT_ID_DEFERRED_RESPONSE \
+		UINT32_C(0x40)
+	#define HWRM_ASYNC_EVENT_CMPL_DEFERRED_RESPONSE_EVENT_ID_LAST \
+		HWRM_ASYNC_EVENT_CMPL_DEFERRED_RESPONSE_EVENT_ID_DEFERRED_RESPONSE
+	/* Event specific data */
+	uint32_t	event_data2;
+	/*
+	 * The PF's mailbox is clear to issue another command.
+	 * A command with this seq_id is still in progress
+	 * and will return a regualr HWRM completion when done.
+	 * 'event_data1' field, if non-zero, contains the estimated
+	 * execution time for the command.
+	 */
+	#define HWRM_ASYNC_EVENT_CMPL_DEFERRED_RESPONSE_EVENT_DATA2_SEQ_ID_MASK \
+		UINT32_C(0xffff)
+	#define HWRM_ASYNC_EVENT_CMPL_DEFERRED_RESPONSE_EVENT_DATA2_SEQ_ID_SFT \
+		0
+	uint8_t	opaque_v;
+	/*
+	 * This value is written by the NIC such that it will be different
+	 * for each pass through the completion queue. The even passes
+	 * will write 1. The odd passes will write 0.
+	 */
+	#define HWRM_ASYNC_EVENT_CMPL_DEFERRED_RESPONSE_V \
+		UINT32_C(0x1)
+	/* opaque is 7 b */
+	#define HWRM_ASYNC_EVENT_CMPL_DEFERRED_RESPONSE_OPAQUE_MASK \
+		UINT32_C(0xfe)
+	#define HWRM_ASYNC_EVENT_CMPL_DEFERRED_RESPONSE_OPAQUE_SFT 1
+	/* 8-lsb timestamp from POR (100-msec resolution) */
+	uint8_t	timestamp_lo;
+	/* 16-lsb timestamp from POR (100-msec resolution) */
+	uint16_t	timestamp_hi;
+	/* Estimated remaining time of command execution in ms (if not zero) */
+	uint32_t	event_data1;
+} __attribute__((packed));
+
+/* hwrm_async_event_cmpl_pfc_watchdog_cfg_change (size:128b/16B) */
+struct hwrm_async_event_cmpl_pfc_watchdog_cfg_change {
+	uint16_t	type;
+	/*
+	 * This field indicates the exact type of the completion.
+	 * By convention, the LSB identifies the length of the
+	 * record in 16B units. Even values indicate 16B
+	 * records. Odd values indicate 32B
+	 * records.
+	 */
+	#define HWRM_ASYNC_EVENT_CMPL_PFC_WATCHDOG_CFG_CHANGE_TYPE_MASK \
+		UINT32_C(0x3f)
+	#define HWRM_ASYNC_EVENT_CMPL_PFC_WATCHDOG_CFG_CHANGE_TYPE_SFT \
+		0
+	/* HWRM Asynchronous Event Information */
+	#define HWRM_ASYNC_EVENT_CMPL_PFC_WATCHDOG_CFG_CHANGE_TYPE_HWRM_ASYNC_EVENT \
+		UINT32_C(0x2e)
+	#define HWRM_ASYNC_EVENT_CMPL_PFC_WATCHDOG_CFG_CHANGE_TYPE_LAST \
+		HWRM_ASYNC_EVENT_CMPL_PFC_WATCHDOG_CFG_CHANGE_TYPE_HWRM_ASYNC_EVENT
+	/* Identifiers of events. */
+	uint16_t	event_id;
+	/* PFC watchdog configuration change for given port/cos */
+	#define HWRM_ASYNC_EVENT_CMPL_PFC_WATCHDOG_CFG_CHANGE_EVENT_ID_PFC_WATCHDOG_CFG_CHANGE \
+		UINT32_C(0x41)
+	#define HWRM_ASYNC_EVENT_CMPL_PFC_WATCHDOG_CFG_CHANGE_EVENT_ID_LAST \
+		HWRM_ASYNC_EVENT_CMPL_PFC_WATCHDOG_CFG_CHANGE_EVENT_ID_PFC_WATCHDOG_CFG_CHANGE
+	/* Event specific data */
+	uint32_t	event_data2;
+	uint8_t	opaque_v;
+	/*
+	 * This value is written by the NIC such that it will be different
+	 * for each pass through the completion queue. The even passes
+	 * will write 1. The odd passes will write 0.
+	 */
+	#define HWRM_ASYNC_EVENT_CMPL_PFC_WATCHDOG_CFG_CHANGE_V \
+		UINT32_C(0x1)
+	/* opaque is 7 b */
+	#define HWRM_ASYNC_EVENT_CMPL_PFC_WATCHDOG_CFG_CHANGE_OPAQUE_MASK \
+		UINT32_C(0xfe)
+	#define HWRM_ASYNC_EVENT_CMPL_PFC_WATCHDOG_CFG_CHANGE_OPAQUE_SFT 1
+	/* 8-lsb timestamp from POR (100-msec resolution) */
+	uint8_t	timestamp_lo;
+	/* 16-lsb timestamp from POR (100-msec resolution) */
+	uint16_t	timestamp_hi;
+	/* Event specific data */
+	uint32_t	event_data1;
+	/*
+	 * 1 in bit position X indicates PFC watchdog should
+	 * be on for COSX
+	 */
+	#define HWRM_ASYNC_EVENT_CMPL_PFC_WATCHDOG_CFG_CHANGE_EVENT_DATA1_PFC_WD_COS_MASK \
+		UINT32_C(0xff)
+	#define HWRM_ASYNC_EVENT_CMPL_PFC_WATCHDOG_CFG_CHANGE_EVENT_DATA1_PFC_WD_COS_SFT \
+		0
+	/* 1 means PFC WD for COS0 is on, 0 - off. */
+	#define HWRM_ASYNC_EVENT_CMPL_PFC_WATCHDOG_CFG_CHANGE_EVENT_DATA1_PFC_WD_COS_PFC_WD_COS0 \
+		UINT32_C(0x1)
+	/* 1 means PFC WD for COS1 is on, 0 - off. */
+	#define HWRM_ASYNC_EVENT_CMPL_PFC_WATCHDOG_CFG_CHANGE_EVENT_DATA1_PFC_WD_COS_PFC_WD_COS1 \
+		UINT32_C(0x2)
+	/* 1 means PFC WD for COS2 is on, 0 - off. */
+	#define HWRM_ASYNC_EVENT_CMPL_PFC_WATCHDOG_CFG_CHANGE_EVENT_DATA1_PFC_WD_COS_PFC_WD_COS2 \
+		UINT32_C(0x4)
+	/* 1 means PFC WD for COS3 is on, 0 - off. */
+	#define HWRM_ASYNC_EVENT_CMPL_PFC_WATCHDOG_CFG_CHANGE_EVENT_DATA1_PFC_WD_COS_PFC_WD_COS3 \
+		UINT32_C(0x8)
+	/* 1 means PFC WD for COS4 is on, 0 - off. */
+	#define HWRM_ASYNC_EVENT_CMPL_PFC_WATCHDOG_CFG_CHANGE_EVENT_DATA1_PFC_WD_COS_PFC_WD_COS4 \
+		UINT32_C(0x10)
+	/* 1 means PFC WD for COS5 is on, 0 - off. */
+	#define HWRM_ASYNC_EVENT_CMPL_PFC_WATCHDOG_CFG_CHANGE_EVENT_DATA1_PFC_WD_COS_PFC_WD_COS5 \
+		UINT32_C(0x20)
+	/* 1 means PFC WD for COS6 is on, 0 - off. */
+	#define HWRM_ASYNC_EVENT_CMPL_PFC_WATCHDOG_CFG_CHANGE_EVENT_DATA1_PFC_WD_COS_PFC_WD_COS6 \
+		UINT32_C(0x40)
+	/* 1 means PFC WD for COS7 is on, 0 - off. */
+	#define HWRM_ASYNC_EVENT_CMPL_PFC_WATCHDOG_CFG_CHANGE_EVENT_DATA1_PFC_WD_COS_PFC_WD_COS7 \
+		UINT32_C(0x80)
+	/* PORT ID */
+	#define HWRM_ASYNC_EVENT_CMPL_PFC_WATCHDOG_CFG_CHANGE_EVENT_DATA1_PORT_ID_MASK \
+		UINT32_C(0xffff00)
+	#define HWRM_ASYNC_EVENT_CMPL_PFC_WATCHDOG_CFG_CHANGE_EVENT_DATA1_PORT_ID_SFT \
+		8
+} __attribute__((packed));
+
 /* hwrm_async_event_cmpl_fw_trace_msg (size:128b/16B) */
 struct hwrm_async_event_cmpl_fw_trace_msg {
 	uint16_t	type;
@@ -7220,7 +7481,7 @@ struct hwrm_func_qcaps_input {
 	uint8_t	unused_0[6];
 } __attribute__((packed));
 
-/* hwrm_func_qcaps_output (size:640b/80B) */
+/* hwrm_func_qcaps_output (size:704b/88B) */
 struct hwrm_func_qcaps_output {
 	/* The specific error status for the command. */
 	uint16_t	error_code;
@@ -7441,6 +7702,33 @@ struct hwrm_func_qcaps_output {
 	 */
 	#define HWRM_FUNC_QCAPS_OUTPUT_FLAGS_NOTIFY_VF_DEF_VNIC_CHNG_SUPPORTED \
 		UINT32_C(0x4000000)
+	/* If set to 1, then the vlan acceleration for TX is disabled. */
+	#define HWRM_FUNC_QCAPS_OUTPUT_FLAGS_VLAN_ACCELERATION_TX_DISABLED \
+		UINT32_C(0x8000000)
+	/*
+	 * When this bit is '1', it indicates that core firmware supports
+	 * DBG_COREDUMP_XXX commands.
+	 */
+	#define HWRM_FUNC_QCAPS_OUTPUT_FLAGS_COREDUMP_CMD_SUPPORTED \
+		UINT32_C(0x10000000)
+	/*
+	 * When this bit is '1', it indicates that core firmware supports
+	 * DBG_CRASHDUMP_XXX commands.
+	 */
+	#define HWRM_FUNC_QCAPS_OUTPUT_FLAGS_CRASHDUMP_CMD_SUPPORTED \
+		UINT32_C(0x20000000)
+	/*
+	 * If the query is for a VF, then this flag should be ignored.
+	 * If the query is for a PF and this flag is set to 1, then
+	 * the PF has the capability to support retrieval of
+	 * rx_port_stats_ext_pfc_wd statistics (supported by the PFC
+	 * WatchDog feature) via the hwrm_port_qstats_ext_pfc_wd command.
+	 * If this flag is set to 1, only that (supported) command should
+	 * be used for retrieval of PFC related statistics (rather than
+	 * hwrm_port_qstats_ext command, which could previously be used).
+	 */
+	#define HWRM_FUNC_QCAPS_OUTPUT_FLAGS_PFC_WD_STATS_SUPPORTED \
+		UINT32_C(0x40000000)
 	/*
 	 * This value is current MAC address configured for this
 	 * function. A value of 00-00-00-00-00-00 indicates no
@@ -7551,7 +7839,22 @@ struct hwrm_func_qcaps_output {
 	 * (max_tx_rings) to the function.
 	 */
 	uint16_t	max_sp_tx_rings;
-	uint8_t	unused_0;
+	uint8_t	unused_0[2];
+	uint32_t	flags_ext;
+	/*
+	 * If 1, the device can be configured to set the ECN bits in the
+	 * IP header of received packets if the receive queue length
+	 * exceeds a given threshold.
+	 */
+	#define HWRM_FUNC_QCAPS_OUTPUT_FLAGS_EXT_ECN_MARK_SUPPORTED \
+		UINT32_C(0x1)
+	/*
+	 * If 1, the device can report the number of received packets
+	 * that it marked as having experienced congestion.
+	 */
+	#define HWRM_FUNC_QCAPS_OUTPUT_FLAGS_EXT_ECN_STATS_SUPPORTED \
+		UINT32_C(0x2)
+	uint8_t	unused_1[3];
 	/*
 	 * This field is used in Output records to indicate that the output
 	 * is completely written to RAM.  This field should be read as '1'
@@ -7606,7 +7909,7 @@ struct hwrm_func_qcfg_input {
 	uint8_t	unused_0[6];
 } __attribute__((packed));
 
-/* hwrm_func_qcfg_output (size:704b/88B) */
+/* hwrm_func_qcfg_output (size:768b/96B) */
 struct hwrm_func_qcfg_output {
 	/* The specific error status for the command. */
 	uint16_t	error_code;
@@ -8016,7 +8319,17 @@ struct hwrm_func_qcfg_output {
 	 * this value to find out the doorbell page offset from the BAR.
 	 */
 	uint16_t	legacy_l2_db_size_kb;
-	uint8_t	unused_2[1];
+	uint16_t	svif_info;
+	/*
+	 * This field specifies the source virtual interface of the function being
+	 * queried. Drivers can use this to program svif field in the L2 context
+	 * table
+	 */
+	#define HWRM_FUNC_QCFG_OUTPUT_SVIF_INFO_SVIF_MASK      UINT32_C(0x7fff)
+	#define HWRM_FUNC_QCFG_OUTPUT_SVIF_INFO_SVIF_SFT       0
+	/* This field specifies whether svif is valid or not */
+	#define HWRM_FUNC_QCFG_OUTPUT_SVIF_INFO_SVIF_VALID     UINT32_C(0x8000)
+	uint8_t	unused_2[7];
 	/*
 	 * This field is used in Output records to indicate that the output
 	 * is completely written to RAM.  This field should be read as '1'
@@ -9862,8 +10175,12 @@ struct hwrm_func_backing_store_qcaps_output {
 	uint32_t	rsvd;
 	/* Reserved for future. */
 	uint16_t	rsvd1;
-	/* Reserved for future. */
-	uint8_t	rsvd2;
+	/*
+	 * Count of TQM fastpath rings to be used for allocating backing store.
+	 * Backing store configuration must be specified for each TQM ring from
+	 * this count in `backing_store_cfg`.
+	 */
+	uint8_t	tqm_fp_rings_count;
 	/*
 	 * This field is used in Output records to indicate that the output
 	 * is completely written to RAM.  This field should be read as '1'
@@ -12178,116 +12495,163 @@ struct hwrm_error_recovery_qcfg_output {
 	 * this much time after writing reset_reg_val in reset_reg.
 	 */
 	uint8_t	delay_after_reset[16];
-	uint8_t	unused_1[7];
 	/*
-	 * This field is used in Output records to indicate that the output
-	 * is completely written to RAM.  This field should be read as '1'
-	 * to indicate that the output has been completely written.
-	 * When writing a command completion or response to an internal
-	 * processor, the order of writes has to be such that this field
-	 * is written last.
-	 */
-	uint8_t	valid;
-} __attribute__((packed));
-
-/***********************
- * hwrm_func_vlan_qcfg *
- ***********************/
-
-
-/* hwrm_func_vlan_qcfg_input (size:192b/24B) */
-struct hwrm_func_vlan_qcfg_input {
-	/* The HWRM command request type. */
-	uint16_t	req_type;
-	/*
-	 * The completion ring to send the completion event on. This should
-	 * be the NQ ID returned from the `nq_alloc` HWRM command.
-	 */
-	uint16_t	cmpl_ring;
-	/*
-	 * The sequence ID is used by the driver for tracking multiple
-	 * commands. This ID is treated as opaque data by the firmware and
-	 * the value is returned in the `hwrm_resp_hdr` upon completion.
-	 */
-	uint16_t	seq_id;
-	/*
-	 * The target ID of the command:
-	 * * 0x0-0xFFF8 - The function ID
-	 * * 0xFFF8-0xFFFC, 0xFFFE - Reserved for internal processors
-	 * * 0xFFFD - Reserved for user-space HWRM interface
-	 * * 0xFFFF - HWRM
+	 * Error recovery counter.
+	 * Lower 2 bits indicates address space location and upper 30 bits
+	 * indicates actual address.
+	 * A value of 0xFFFF-FFFF indicates this register does not exist.
 	 */
-	uint16_t	target_id;
+	uint32_t	err_recovery_cnt_reg;
+	/* Lower 2 bits indicates address space location. */
+	#define HWRM_ERROR_RECOVERY_QCFG_OUTPUT_ERR_RECOVERY_CNT_REG_ADDR_SPACE_MASK \
+		UINT32_C(0x3)
+	#define HWRM_ERROR_RECOVERY_QCFG_OUTPUT_ERR_RECOVERY_CNT_REG_ADDR_SPACE_SFT \
+		0
 	/*
-	 * A physical address pointer pointing to a host buffer that the
-	 * command's response data will be written. This can be either a host
-	 * physical address (HPA) or a guest physical address (GPA) and must
-	 * point to a physically contiguous block of memory.
+	 * If value is 0, this register is located in PCIe config space.
+	 * Drivers have to map appropriate window to access this
+	 * register.
 	 */
-	uint64_t	resp_addr;
+	#define HWRM_ERROR_RECOVERY_QCFG_OUTPUT_ERR_RECOVERY_CNT_REG_ADDR_SPACE_PCIE_CFG \
+		UINT32_C(0x0)
 	/*
-	 * Function ID of the function that is being
-	 * configured.
-	 * If set to 0xFF... (All Fs), then the configuration is
-	 * for the requesting function.
+	 * If value is 1, this register is located in GRC address space.
+	 * Drivers have to map appropriate window to access this
+	 * register.
 	 */
-	uint16_t	fid;
-	uint8_t	unused_0[6];
-} __attribute__((packed));
-
-/* hwrm_func_vlan_qcfg_output (size:320b/40B) */
-struct hwrm_func_vlan_qcfg_output {
-	/* The specific error status for the command. */
-	uint16_t	error_code;
-	/* The HWRM command request type. */
-	uint16_t	req_type;
-	/* The sequence ID from the original command. */
-	uint16_t	seq_id;
-	/* The length of the response data in number of bytes. */
-	uint16_t	resp_len;
-	uint64_t	unused_0;
-	/* S-TAG VLAN identifier configured for the function. */
-	uint16_t	stag_vid;
-	/* S-TAG PCP value configured for the function. */
-	uint8_t	stag_pcp;
-	uint8_t	unused_1;
+	#define HWRM_ERROR_RECOVERY_QCFG_OUTPUT_ERR_RECOVERY_CNT_REG_ADDR_SPACE_GRC \
+		UINT32_C(0x1)
 	/*
-	 * S-TAG TPID value configured for the function. This field is specified in
-	 * network byte order.
+	 * If value is 2, this register is located in first BAR address
+	 * space. Drivers have to map appropriate window to access this
+	 * register.
 	 */
-	uint16_t	stag_tpid;
-	/* C-TAG VLAN identifier configured for the function. */
-	uint16_t	ctag_vid;
-	/* C-TAG PCP value configured for the function. */
-	uint8_t	ctag_pcp;
-	uint8_t	unused_2;
+	#define HWRM_ERROR_RECOVERY_QCFG_OUTPUT_ERR_RECOVERY_CNT_REG_ADDR_SPACE_BAR0 \
+		UINT32_C(0x2)
 	/*
-	 * C-TAG TPID value configured for the function. This field is specified in
-	 * network byte order.
+	 * If value is 3, this register is located in second BAR address
+	 * space. Drivers have to map appropriate window to access this
+	 * register.
 	 */
-	uint16_t	ctag_tpid;
-	/* Future use. */
-	uint32_t	rsvd2;
-	/* Future use. */
-	uint32_t	rsvd3;
-	uint8_t	unused_3[3];
+	#define HWRM_ERROR_RECOVERY_QCFG_OUTPUT_ERR_RECOVERY_CNT_REG_ADDR_SPACE_BAR1 \
+		UINT32_C(0x3)
+	#define HWRM_ERROR_RECOVERY_QCFG_OUTPUT_ERR_RECOVERY_CNT_REG_ADDR_SPACE_LAST \
+		HWRM_ERROR_RECOVERY_QCFG_OUTPUT_ERR_RECOVERY_CNT_REG_ADDR_SPACE_BAR1
+	/* Upper 30bits of the register address. */
+	#define HWRM_ERROR_RECOVERY_QCFG_OUTPUT_ERR_RECOVERY_CNT_REG_ADDR_MASK \
+		UINT32_C(0xfffffffc)
+	#define HWRM_ERROR_RECOVERY_QCFG_OUTPUT_ERR_RECOVERY_CNT_REG_ADDR_SFT \
+		2
+	uint8_t	unused_1[3];
 	/*
 	 * This field is used in Output records to indicate that the output
 	 * is completely written to RAM.  This field should be read as '1'
 	 * to indicate that the output has been completely written.
-	 * When writing a command completion or response to an internal processor,
-	 * the order of writes has to be such that this field is written last.
+	 * When writing a command completion or response to an internal
+	 * processor, the order of writes has to be such that this field
+	 * is written last.
 	 */
 	uint8_t	valid;
 } __attribute__((packed));
 
-/**********************
- * hwrm_func_vlan_cfg *
- **********************/
+/***********************
+ * hwrm_func_vlan_qcfg *
+ ***********************/
 
 
-/* hwrm_func_vlan_cfg_input (size:384b/48B) */
-struct hwrm_func_vlan_cfg_input {
+/* hwrm_func_vlan_qcfg_input (size:192b/24B) */
+struct hwrm_func_vlan_qcfg_input {
+	/* The HWRM command request type. */
+	uint16_t	req_type;
+	/*
+	 * The completion ring to send the completion event on. This should
+	 * be the NQ ID returned from the `nq_alloc` HWRM command.
+	 */
+	uint16_t	cmpl_ring;
+	/*
+	 * The sequence ID is used by the driver for tracking multiple
+	 * commands. This ID is treated as opaque data by the firmware and
+	 * the value is returned in the `hwrm_resp_hdr` upon completion.
+	 */
+	uint16_t	seq_id;
+	/*
+	 * The target ID of the command:
+	 * * 0x0-0xFFF8 - The function ID
+	 * * 0xFFF8-0xFFFC, 0xFFFE - Reserved for internal processors
+	 * * 0xFFFD - Reserved for user-space HWRM interface
+	 * * 0xFFFF - HWRM
+	 */
+	uint16_t	target_id;
+	/*
+	 * A physical address pointer pointing to a host buffer that the
+	 * command's response data will be written. This can be either a host
+	 * physical address (HPA) or a guest physical address (GPA) and must
+	 * point to a physically contiguous block of memory.
+	 */
+	uint64_t	resp_addr;
+	/*
+	 * Function ID of the function that is being
+	 * configured.
+	 * If set to 0xFF... (All Fs), then the configuration is
+	 * for the requesting function.
+	 */
+	uint16_t	fid;
+	uint8_t	unused_0[6];
+} __attribute__((packed));
+
+/* hwrm_func_vlan_qcfg_output (size:320b/40B) */
+struct hwrm_func_vlan_qcfg_output {
+	/* The specific error status for the command. */
+	uint16_t	error_code;
+	/* The HWRM command request type. */
+	uint16_t	req_type;
+	/* The sequence ID from the original command. */
+	uint16_t	seq_id;
+	/* The length of the response data in number of bytes. */
+	uint16_t	resp_len;
+	uint64_t	unused_0;
+	/* S-TAG VLAN identifier configured for the function. */
+	uint16_t	stag_vid;
+	/* S-TAG PCP value configured for the function. */
+	uint8_t	stag_pcp;
+	uint8_t	unused_1;
+	/*
+	 * S-TAG TPID value configured for the function. This field is specified in
+	 * network byte order.
+	 */
+	uint16_t	stag_tpid;
+	/* C-TAG VLAN identifier configured for the function. */
+	uint16_t	ctag_vid;
+	/* C-TAG PCP value configured for the function. */
+	uint8_t	ctag_pcp;
+	uint8_t	unused_2;
+	/*
+	 * C-TAG TPID value configured for the function. This field is specified in
+	 * network byte order.
+	 */
+	uint16_t	ctag_tpid;
+	/* Future use. */
+	uint32_t	rsvd2;
+	/* Future use. */
+	uint32_t	rsvd3;
+	uint8_t	unused_3[3];
+	/*
+	 * This field is used in Output records to indicate that the output
+	 * is completely written to RAM.  This field should be read as '1'
+	 * to indicate that the output has been completely written.
+	 * When writing a command completion or response to an internal processor,
+	 * the order of writes has to be such that this field is written last.
+	 */
+	uint8_t	valid;
+} __attribute__((packed));
+
+/**********************
+ * hwrm_func_vlan_cfg *
+ **********************/
+
+
+/* hwrm_func_vlan_cfg_input (size:384b/48B) */
+struct hwrm_func_vlan_cfg_input {
 	/* The HWRM command request type. */
 	uint16_t	req_type;
 	/*
@@ -14039,6 +14403,9 @@ struct hwrm_port_phy_qcfg_output {
 	/* Module is not inserted. */
 	#define HWRM_PORT_PHY_QCFG_OUTPUT_MODULE_STATUS_NOTINSERTED \
 		UINT32_C(0x4)
+	/* Module is powered down becuase of over current fault. */
+	#define HWRM_PORT_PHY_QCFG_OUTPUT_MODULE_STATUS_CURRENTFAULT \
+		UINT32_C(0x5)
 	/* Module status is not applicable. */
 	#define HWRM_PORT_PHY_QCFG_OUTPUT_MODULE_STATUS_NOTAPPLICABLE \
 		UINT32_C(0xff)
@@ -15010,7 +15377,7 @@ struct hwrm_port_mac_qcfg_input {
 	uint8_t	unused_0[6];
 } __attribute__((packed));
 
-/* hwrm_port_mac_qcfg_output (size:192b/24B) */
+/* hwrm_port_mac_qcfg_output (size:256b/32B) */
 struct hwrm_port_mac_qcfg_output {
 	/* The specific error status for the command. */
 	uint16_t	error_code;
@@ -15250,6 +15617,20 @@ struct hwrm_port_mac_qcfg_output {
 		UINT32_C(0xe0)
 	#define HWRM_PORT_MAC_QCFG_OUTPUT_COS_FIELD_CFG_DEFAULT_COS_SFT \
 		5
+	uint8_t	unused_1;
+	uint16_t	port_svif_info;
+	/*
+	 * This field specifies the source virtual interface of the port being
+	 * queried. Drivers can use this to program port svif field in the
+	 * L2 context table
+	 */
+	#define HWRM_PORT_MAC_QCFG_OUTPUT_PORT_SVIF_INFO_PORT_SVIF_MASK \
+		UINT32_C(0x7fff)
+	#define HWRM_PORT_MAC_QCFG_OUTPUT_PORT_SVIF_INFO_PORT_SVIF_SFT       0
+	/* This field specifies whether port_svif is valid or not */
+	#define HWRM_PORT_MAC_QCFG_OUTPUT_PORT_SVIF_INFO_PORT_SVIF_VALID \
+		UINT32_C(0x8000)
+	uint8_t	unused_2[5];
 	/*
 	 * This field is used in Output records to indicate that the output
 	 * is completely written to RAM.  This field should be read as '1'
@@ -15322,17 +15703,17 @@ struct hwrm_port_mac_ptp_qcfg_output {
 	#define HWRM_PORT_MAC_PTP_QCFG_OUTPUT_FLAGS_DIRECT_ACCESS \
 		UINT32_C(0x1)
 	/*
-	 * When this bit is set to '1', the PTP information is accessible
-	 * via HWRM commands.
-	 */
-	#define HWRM_PORT_MAC_PTP_QCFG_OUTPUT_FLAGS_HWRM_ACCESS \
-		UINT32_C(0x2)
-	/*
 	 * When this bit is set to '1', the device supports one-step
 	 * Tx timestamping.
 	 */
 	#define HWRM_PORT_MAC_PTP_QCFG_OUTPUT_FLAGS_ONE_STEP_TX_TS \
 		UINT32_C(0x4)
+	/*
+	 * When this bit is set to '1', the PTP information is accessible
+	 * via HWRM commands.
+	 */
+	#define HWRM_PORT_MAC_PTP_QCFG_OUTPUT_FLAGS_HWRM_ACCESS \
+		UINT32_C(0x8)
 	uint8_t	unused_0[3];
 	/* Offset of the PTP register for the lower 32 bits of timestamp for RX. */
 	uint32_t	rx_ts_reg_off_lower;
@@ -15375,7 +15756,7 @@ struct hwrm_port_mac_ptp_qcfg_output {
 	uint8_t	valid;
 } __attribute__((packed));
 
-/* Port Tx Statistics Formats */
+/* Port Tx Statistics Format */
 /* tx_port_stats (size:3264b/408B) */
 struct tx_port_stats {
 	/* Total Number of 64 Bytes frames transmitted */
@@ -15516,7 +15897,7 @@ struct tx_port_stats {
 	uint64_t	tx_stat_error;
 } __attribute__((packed));
 
-/* Port Rx Statistics Formats */
+/* Port Rx Statistics Format */
 /* rx_port_stats (size:4224b/528B) */
 struct rx_port_stats {
 	/* Total Number of 64 Bytes frames received */
@@ -15806,7 +16187,7 @@ struct hwrm_port_qstats_output {
 	uint8_t	valid;
 } __attribute__((packed));
 
-/* Port Tx Statistics extended Formats */
+/* Port Tx Statistics extended Format */
 /* tx_port_stats_ext (size:2048b/256B) */
 struct tx_port_stats_ext {
 	/* Total number of tx bytes count on cos queue 0 */
@@ -15875,7 +16256,7 @@ struct tx_port_stats_ext {
 	uint64_t	pfc_pri7_tx_transitions;
 } __attribute__((packed));
 
-/* Port Rx Statistics extended Formats */
+/* Port Rx Statistics extended Format */
 /* rx_port_stats_ext (size:3648b/456B) */
 struct rx_port_stats_ext {
 	/* Number of times link state changed to down */
@@ -15997,6 +16378,424 @@ struct rx_port_stats_ext {
 	uint64_t	rx_discard_packets_cos7;
 } __attribute__((packed));
 
+/*
+ * Port Rx Statistics extended PFC WatchDog Format.
+ * StormDetect and StormRevert event determination is based
+ * on an integration period and a percentage threshold.
+ * StormDetect event - when percentage of XOFF frames receieved
+ * within an integration period exceeds the configured threshold.
+ * StormRevert event - when percentage of XON frames received
+ * within an integration period exceeds the configured threshold.
+ * Actual number of XOFF/XON frames for the events to be triggered
+ * depends on both configured integration period and sampling rate.
+ * The statistics in this structure represent counts of specified
+ * events from the moment the feature (PFC WatchDog) is enabled via
+ * hwrm_queue_pfc_enable_cfg call.
+ */
+/* rx_port_stats_ext_pfc_wd (size:5120b/640B) */
+struct rx_port_stats_ext_pfc_wd {
+	/*
+	 * Total number of PFC WatchDog StormDetect events detected
+	 * for Pri 0
+	 */
+	uint64_t	rx_pfc_watchdog_storms_detected_pri0;
+	/*
+	 * Total number of PFC WatchDog StormDetect events detected
+	 * for Pri 1
+	 */
+	uint64_t	rx_pfc_watchdog_storms_detected_pri1;
+	/*
+	 * Total number of PFC WatchDog StormDetect events detected
+	 * for Pri 2
+	 */
+	uint64_t	rx_pfc_watchdog_storms_detected_pri2;
+	/*
+	 * Total number of PFC WatchDog StormDetect events detected
+	 * for Pri 3
+	 */
+	uint64_t	rx_pfc_watchdog_storms_detected_pri3;
+	/*
+	 * Total number of PFC WatchDog StormDetect events detected
+	 * for Pri 4
+	 */
+	uint64_t	rx_pfc_watchdog_storms_detected_pri4;
+	/*
+	 * Total number of PFC WatchDog StormDetect events detected
+	 * for Pri 5
+	 */
+	uint64_t	rx_pfc_watchdog_storms_detected_pri5;
+	/*
+	 * Total number of PFC WatchDog StormDetect events detected
+	 * for Pri 6
+	 */
+	uint64_t	rx_pfc_watchdog_storms_detected_pri6;
+	/*
+	 * Total number of PFC WatchDog StormDetect events detected
+	 * for Pri 7
+	 */
+	uint64_t	rx_pfc_watchdog_storms_detected_pri7;
+	/*
+	 * Total number of PFC WatchDog StormRevert events detected
+	 * for Pri 0
+	 */
+	uint64_t	rx_pfc_watchdog_storms_reverted_pri0;
+	/*
+	 * Total number of PFC WatchDog StormRevert events detected
+	 * for Pri 1
+	 */
+	uint64_t	rx_pfc_watchdog_storms_reverted_pri1;
+	/*
+	 * Total number of PFC WatchDog StormRevert events detected
+	 * for Pri 2
+	 */
+	uint64_t	rx_pfc_watchdog_storms_reverted_pri2;
+	/*
+	 * Total number of PFC WatchDog StormRevert events detected
+	 * for Pri 3
+	 */
+	uint64_t	rx_pfc_watchdog_storms_reverted_pri3;
+	/*
+	 * Total number of PFC WatchDog StormRevert events detected
+	 * for Pri 4
+	 */
+	uint64_t	rx_pfc_watchdog_storms_reverted_pri4;
+	/*
+	 * Total number of PFC WatchDog StormRevert events detected
+	 * for Pri 5
+	 */
+	uint64_t	rx_pfc_watchdog_storms_reverted_pri5;
+	/*
+	 * Total number of PFC WatchDog StormRevert events detected
+	 * for Pri 6
+	 */
+	uint64_t	rx_pfc_watchdog_storms_reverted_pri6;
+	/*
+	 * Total number of PFC WatchDog StormRevert events detected
+	 * for Pri 7
+	 */
+	uint64_t	rx_pfc_watchdog_storms_reverted_pri7;
+	/*
+	 * Total number of packets received during PFC watchdog storm
+	 * for pri 0
+	 */
+	uint64_t	rx_pfc_watchdog_storms_rx_packets_pri0;
+	/*
+	 * Total number of packets received during PFC watchdog storm
+	 * for pri 1
+	 */
+	uint64_t	rx_pfc_watchdog_storms_rx_packets_pri1;
+	/*
+	 * Total number of packets received during PFC watchdog storm
+	 *  for pri 2
+	 */
+	uint64_t	rx_pfc_watchdog_storms_rx_packets_pri2;
+	/*
+	 * Total number of packets received during PFC watchdog storm
+	 *  for pri 3
+	 */
+	uint64_t	rx_pfc_watchdog_storms_rx_packets_pri3;
+	/*
+	 * Total number of packets received during PFC watchdog storm
+	 *  for pri 4
+	 */
+	uint64_t	rx_pfc_watchdog_storms_rx_packets_pri4;
+	/*
+	 * Total number of packets received during PFC watchdog storm
+	 *  for pri 5
+	 */
+	uint64_t	rx_pfc_watchdog_storms_rx_packets_pri5;
+	/*
+	 * Total number of packets received during PFC watchdog storm
+	 *  for pri 6
+	 */
+	uint64_t	rx_pfc_watchdog_storms_rx_packets_pri6;
+	/*
+	 * Total number of packets received during PFC watchdog storm
+	 *  for pri 7
+	 */
+	uint64_t	rx_pfc_watchdog_storms_rx_packets_pri7;
+	/*
+	 * Total number of bytes received during PFC watchdog storm
+	 * for pri 0
+	 */
+	uint64_t	rx_pfc_watchdog_storms_rx_bytes_pri0;
+	/*
+	 * Total number of bytes received during PFC watchdog storm
+	 * for pri 1
+	 */
+	uint64_t	rx_pfc_watchdog_storms_rx_bytes_pri1;
+	/*
+	 * Total number of bytes received during PFC watchdog storm
+	 *  for pri 2
+	 */
+	uint64_t	rx_pfc_watchdog_storms_rx_bytes_pri2;
+	/*
+	 * Total number of bytes received during PFC watchdog storm
+	 *  for pri 3
+	 */
+	uint64_t	rx_pfc_watchdog_storms_rx_bytes_pri3;
+	/*
+	 * Total number of bytes received during PFC watchdog storm
+	 *  for pri 4
+	 */
+	uint64_t	rx_pfc_watchdog_storms_rx_bytes_pri4;
+	/*
+	 * Total number of bytes received during PFC watchdog storm
+	 *  for pri 5
+	 */
+	uint64_t	rx_pfc_watchdog_storms_rx_bytes_pri5;
+	/*
+	 * Total number of bytes received during PFC watchdog storm
+	 *  for pri 6
+	 */
+	uint64_t	rx_pfc_watchdog_storms_rx_bytes_pri6;
+	/*
+	 * Total number of bytes received during PFC watchdog storm
+	 *  for pri 7
+	 */
+	uint64_t	rx_pfc_watchdog_storms_rx_bytes_pri7;
+	/*
+	 * Total number of packets dropped on rx during PFC watchdog storm
+	 * for pri 0
+	 */
+	uint64_t	rx_pfc_watchdog_storms_rx_packets_dropped_pri0;
+	/*
+	 * Total number of packets dropped on rx during PFC watchdog storm
+	 * for pri 1
+	 */
+	uint64_t	rx_pfc_watchdog_storms_rx_packets_dropped_pri1;
+	/*
+	 * Total number of packets dropped on rx during PFC watchdog storm
+	 *  for pri 2
+	 */
+	uint64_t	rx_pfc_watchdog_storms_rx_packets_dropped_pri2;
+	/*
+	 * Total number of packets dropped on rx during PFC watchdog storm
+	 *  for pri 3
+	 */
+	uint64_t	rx_pfc_watchdog_storms_rx_packets_dropped_pri3;
+	/*
+	 * Total number of packets dropped on rx during PFC watchdog storm
+	 *  for pri 4
+	 */
+	uint64_t	rx_pfc_watchdog_storms_rx_packets_dropped_pri4;
+	/*
+	 * Total number of packets dropped on rx during PFC watchdog storm
+	 *  for pri 5
+	 */
+	uint64_t	rx_pfc_watchdog_storms_rx_packets_dropped_pri5;
+	/*
+	 * Total number of packets dropped on rx during PFC watchdog storm
+	 *  for pri 6
+	 */
+	uint64_t	rx_pfc_watchdog_storms_rx_packets_dropped_pri6;
+	/*
+	 * Total number of packets dropped on rx during PFC watchdog storm
+	 *  for pri 7
+	 */
+	uint64_t	rx_pfc_watchdog_storms_rx_packets_dropped_pri7;
+	/*
+	 * Total number of bytes dropped on rx during PFC watchdog storm
+	 * for pri 0
+	 */
+	uint64_t	rx_pfc_watchdog_storms_rx_bytes_dropped_pri0;
+	/*
+	 * Total number of bytes dropped on rx during PFC watchdog storm
+	 * for pri 1
+	 */
+	uint64_t	rx_pfc_watchdog_storms_rx_bytes_dropped_pri1;
+	/*
+	 * Total number of bytes dropped on rx during PFC watchdog storm
+	 *  for pri 2
+	 */
+	uint64_t	rx_pfc_watchdog_storms_rx_bytes_dropped_pri2;
+	/*
+	 * Total number of bytes dropped on rx during PFC watchdog storm
+	 *  for pri 3
+	 */
+	uint64_t	rx_pfc_watchdog_storms_rx_bytes_dropped_pri3;
+	/*
+	 * Total number of bytes dropped on rx during PFC watchdog storm
+	 *  for pri 4
+	 */
+	uint64_t	rx_pfc_watchdog_storms_rx_bytes_dropped_pri4;
+	/*
+	 * Total number of bytes dropped on rx during PFC watchdog storm
+	 *  for pri 5
+	 */
+	uint64_t	rx_pfc_watchdog_storms_rx_bytes_dropped_pri5;
+	/*
+	 * Total number of bytes dropped on rx during PFC watchdog storm
+	 *  for pri 6
+	 */
+	uint64_t	rx_pfc_watchdog_storms_rx_bytes_dropped_pri6;
+	/*
+	 * Total number of bytes dropped on rx during PFC watchdog storm
+	 *  for pri 7
+	 */
+	uint64_t	rx_pfc_watchdog_storms_rx_bytes_dropped_pri7;
+	/*
+	 * Number of packets received during last PFC watchdog storm
+	 * for pri 0
+	 */
+	uint64_t	rx_pfc_watchdog_last_storm_rx_packets_pri0;
+	/*
+	 * Number of packets received during last PFC watchdog storm
+	 * for pri 1
+	 */
+	uint64_t	rx_pfc_watchdog_last_storm_rx_packets_pri1;
+	/*
+	 * Number of packets received during last PFC watchdog storm
+	 *  for pri 2
+	 */
+	uint64_t	rx_pfc_watchdog_last_storm_rx_packets_pri2;
+	/*
+	 * Number of packets received during last PFC watchdog storm
+	 *  for pri 3
+	 */
+	uint64_t	rx_pfc_watchdog_last_storm_rx_packets_pri3;
+	/*
+	 * Number of packets received during last PFC watchdog storm
+	 *  for pri 4
+	 */
+	uint64_t	rx_pfc_watchdog_last_storm_rx_packets_pri4;
+	/*
+	 * Number of packets received during last PFC watchdog storm
+	 *  for pri 5
+	 */
+	uint64_t	rx_pfc_watchdog_last_storm_rx_packets_pri5;
+	/*
+	 * Number of packets received during last PFC watchdog storm
+	 *  for pri 6
+	 */
+	uint64_t	rx_pfc_watchdog_last_storm_rx_packets_pri6;
+	/*
+	 * Number of packets received during last PFC watchdog storm
+	 *  for pri 7
+	 */
+	uint64_t	rx_pfc_watchdog_last_storm_rx_packets_pri7;
+	/*
+	 * Number of bytes received during last PFC watchdog storm
+	 * for pri 0
+	 */
+	uint64_t	rx_pfc_watchdog_last_storm_rx_bytes_pri0;
+	/*
+	 * Number of bytes received during last PFC watchdog storm
+	 * for pri 1
+	 */
+	uint64_t	rx_pfc_watchdog_last_storm_rx_bytes_pri1;
+	/*
+	 * Number of bytes received during last PFC watchdog storm
+	 *  for pri 2
+	 */
+	uint64_t	rx_pfc_watchdog_last_storm_rx_bytes_pri2;
+	/*
+	 * Number of bytes received during last PFC watchdog storm
+	 *  for pri 3
+	 */
+	uint64_t	rx_pfc_watchdog_last_storm_rx_bytes_pri3;
+	/*
+	 * Number of bytes received during last PFC watchdog storm
+	 *  for pri 4
+	 */
+	uint64_t	rx_pfc_watchdog_last_storm_rx_bytes_pri4;
+	/*
+	 * Number of bytes received during last PFC watchdog storm
+	 *  for pri 5
+	 */
+	uint64_t	rx_pfc_watchdog_last_storm_rx_bytes_pri5;
+	/*
+	 * Number of bytes received during last PFC watchdog storm
+	 *  for pri 6
+	 */
+	uint64_t	rx_pfc_watchdog_last_storm_rx_bytes_pri6;
+	/*
+	 * Number of bytes received during last PFC watchdog storm
+	 *  for pri 7
+	 */
+	uint64_t	rx_pfc_watchdog_last_storm_rx_bytes_pri7;
+	/*
+	 * Number of packets dropped on rx during last PFC watchdog storm
+	 * for pri 0
+	 */
+	uint64_t	rx_pfc_watchdog_last_storm_rx_packets_dropped_pri0;
+	/*
+	 * Number of packets dropped on rx during last PFC watchdog storm
+	 * for pri 1
+	 */
+	uint64_t	rx_pfc_watchdog_last_storm_rx_packets_dropped_pri1;
+	/*
+	 * Number of packets dropped on rx during last PFC watchdog storm
+	 *  for pri 2
+	 */
+	uint64_t	rx_pfc_watchdog_last_storm_rx_packets_dropped_pri2;
+	/*
+	 * Number of packets dropped on rx during last PFC watchdog storm
+	 *  for pri 3
+	 */
+	uint64_t	rx_pfc_watchdog_last_storm_rx_packets_dropped_pri3;
+	/*
+	 * Number of packets dropped on rx during last PFC watchdog storm
+	 *  for pri 4
+	 */
+	uint64_t	rx_pfc_watchdog_last_storm_rx_packets_dropped_pri4;
+	/*
+	 * Number of packets dropped on rx during last PFC watchdog storm
+	 *  for pri 5
+	 */
+	uint64_t	rx_pfc_watchdog_last_storm_rx_packets_dropped_pri5;
+	/*
+	 * Number of packets dropped on rx during last PFC watchdog storm
+	 *  for pri 6
+	 */
+	uint64_t	rx_pfc_watchdog_last_storm_rx_packets_dropped_pri6;
+	/*
+	 * Number of packets dropped on rx during last PFC watchdog storm
+	 *  for pri 7
+	 */
+	uint64_t	rx_pfc_watchdog_last_storm_rx_packets_dropped_pri7;
+	/*
+	 * Total number of bytes dropped on rx during PFC watchdog storm
+	 * for pri 0
+	 */
+	uint64_t	rx_pfc_watchdog_last_storm_rx_bytes_dropped_pri0;
+	/*
+	 * Number of bytes dropped on rx during last PFC watchdog storm
+	 * for pri 1
+	 */
+	uint64_t	rx_pfc_watchdog_last_storm_rx_bytes_dropped_pri1;
+	/*
+	 * Number of bytes dropped on rx during last PFC watchdog storm
+	 *  for pri 2
+	 */
+	uint64_t	rx_pfc_watchdog_last_storm_rx_bytes_dropped_pri2;
+	/*
+	 * Number of bytes dropped on rx during last PFC watchdog storm
+	 *  for pri 3
+	 */
+	uint64_t	rx_pfc_watchdog_last_storm_rx_bytes_dropped_pri3;
+	/*
+	 * Number of bytes dropped on rx during last PFC watchdog storm
+	 *  for pri 4
+	 */
+	uint64_t	rx_pfc_watchdog_last_storm_rx_bytes_dropped_pri4;
+	/*
+	 * Number of bytes dropped on rx during last PFC watchdog storm
+	 *  for pri 5
+	 */
+	uint64_t	rx_pfc_watchdog_last_storm_rx_bytes_dropped_pri5;
+	/*
+	 * Number of bytes dropped on rx during last PFC watchdog storm
+	 *  for pri 6
+	 */
+	uint64_t	rx_pfc_watchdog_last_storm_rx_bytes_dropped_pri6;
+	/*
+	 * Number of bytes dropped on rx during last PFC watchdog storm
+	 *  for pri 7
+	 */
+	uint64_t	rx_pfc_watchdog_last_storm_rx_bytes_dropped_pri7;
+} __attribute__((packed));
+
 /************************
  * hwrm_port_qstats_ext *
  ************************/
@@ -16090,6 +16889,83 @@ struct hwrm_port_qstats_ext_output {
 	uint8_t	valid;
 } __attribute__((packed));
 
+/*******************************
+ * hwrm_port_qstats_ext_pfc_wd *
+ *******************************/
+
+
+/* hwrm_port_qstats_ext_pfc_wd_input (size:256b/32B) */
+struct hwrm_port_qstats_ext_pfc_wd_input {
+	/* The HWRM command request type. */
+	uint16_t	req_type;
+	/*
+	 * The completion ring to send the completion event on. This should
+	 * be the NQ ID returned from the `nq_alloc` HWRM command.
+	 */
+	uint16_t	cmpl_ring;
+	/*
+	 * The sequence ID is used by the driver for tracking multiple
+	 * commands. This ID is treated as opaque data by the firmware and
+	 * the value is returned in the `hwrm_resp_hdr` upon completion.
+	 */
+	uint16_t	seq_id;
+	/*
+	 * The target ID of the command:
+	 * * 0x0-0xFFF8 - The function ID
+	 * * 0xFFF8-0xFFFC, 0xFFFE - Reserved for internal processors
+	 * * 0xFFFD - Reserved for user-space HWRM interface
+	 * * 0xFFFF - HWRM
+	 */
+	uint16_t	target_id;
+	/*
+	 * A physical address pointer pointing to a host buffer that the
+	 * command's response data will be written. This can be either a host
+	 * physical address (HPA) or a guest physical address (GPA) and must
+	 * point to a physically contiguous block of memory.
+	 */
+	uint64_t	resp_addr;
+	/* Port ID of port that is being queried. */
+	uint16_t	port_id;
+	/*
+	 * The size of rx_port_stats_ext_pfc_wd
+	 * block in bytes
+	 */
+	uint16_t	pfc_wd_stat_size;
+	uint8_t	unused_0[4];
+	/*
+	 * This is the host address where
+	 * rx_port_stats_ext_pfc_wd will be stored
+	 */
+	uint64_t	pfc_wd_stat_host_addr;
+} __attribute__((packed));
+
+/* hwrm_port_qstats_ext_pfc_wd_output (size:128b/16B) */
+struct hwrm_port_qstats_ext_pfc_wd_output {
+	/* The specific error status for the command. */
+	uint16_t	error_code;
+	/* The HWRM command request type. */
+	uint16_t	req_type;
+	/* The sequence ID from the original command. */
+	uint16_t	seq_id;
+	/* The length of the response data in number of bytes. */
+	uint16_t	resp_len;
+	/*
+	 * The size of rx_port_stats_ext_pfc_wd
+	 * statistics block in bytes.
+	 */
+	uint16_t	pfc_wd_stat_size;
+	uint8_t	flags;
+	/*
+	 * This field is used in Output records to indicate that the output
+	 * is completely written to RAM.  This field should be read as '1'
+	 * to indicate that the output has been completely written.
+	 * When writing a command completion or response to an internal processor,
+	 * the order of writes has to be such that this field is written last.
+	 */
+	uint8_t	valid;
+	uint8_t	unused_0[4];
+} __attribute__((packed));
+
 /*************************
  * hwrm_port_lpbk_qstats *
  *************************/
@@ -16168,6 +17044,91 @@ struct hwrm_port_lpbk_qstats_output {
 	uint8_t	valid;
 } __attribute__((packed));
 
+/************************
+ * hwrm_port_ecn_qstats *
+ ************************/
+
+
+/* hwrm_port_ecn_qstats_input (size:192b/24B) */
+struct hwrm_port_ecn_qstats_input {
+	/* The HWRM command request type. */
+	uint16_t	req_type;
+	/*
+	 * The completion ring to send the completion event on. This should
+	 * be the NQ ID returned from the `nq_alloc` HWRM command.
+	 */
+	uint16_t	cmpl_ring;
+	/*
+	 * The sequence ID is used by the driver for tracking multiple
+	 * commands. This ID is treated as opaque data by the firmware and
+	 * the value is returned in the `hwrm_resp_hdr` upon completion.
+	 */
+	uint16_t	seq_id;
+	/*
+	 * The target ID of the command:
+	 * * 0x0-0xFFF8 - The function ID
+	 * * 0xFFF8-0xFFFC, 0xFFFE - Reserved for internal processors
+	 * * 0xFFFD - Reserved for user-space HWRM interface
+	 * * 0xFFFF - HWRM
+	 */
+	uint16_t	target_id;
+	/*
+	 * A physical address pointer pointing to a host buffer that the
+	 * command's response data will be written. This can be either a host
+	 * physical address (HPA) or a guest physical address (GPA) and must
+	 * point to a physically contiguous block of memory.
+	 */
+	uint64_t	resp_addr;
+	/*
+	 * Port ID of port that is being queried. Unused if NIC is in
+	 * multi-host mode.
+	 */
+	uint16_t	port_id;
+	uint8_t	unused_0[6];
+} __attribute__((packed));
+
+/* hwrm_port_ecn_qstats_output (size:384b/48B) */
+struct hwrm_port_ecn_qstats_output {
+	/* The specific error status for the command. */
+	uint16_t	error_code;
+	/* The HWRM command request type. */
+	uint16_t	req_type;
+	/* The sequence ID from the original command. */
+	uint16_t	seq_id;
+	/* The length of the response data in number of bytes. */
+	uint16_t	resp_len;
+	/* Number of packets marked in CoS queue 0. */
+	uint32_t	mark_cnt_cos0;
+	/* Number of packets marked in CoS queue 1. */
+	uint32_t	mark_cnt_cos1;
+	/* Number of packets marked in CoS queue 2. */
+	uint32_t	mark_cnt_cos2;
+	/* Number of packets marked in CoS queue 3. */
+	uint32_t	mark_cnt_cos3;
+	/* Number of packets marked in CoS queue 4. */
+	uint32_t	mark_cnt_cos4;
+	/* Number of packets marked in CoS queue 5. */
+	uint32_t	mark_cnt_cos5;
+	/* Number of packets marked in CoS queue 6. */
+	uint32_t	mark_cnt_cos6;
+	/* Number of packets marked in CoS queue 7. */
+	uint32_t	mark_cnt_cos7;
+	/*
+	 * Bitmask that indicates which CoS queues have ECN marking enabled.
+	 * Bit i corresponds to CoS queue i.
+	 */
+	uint8_t	mark_en;
+	uint8_t	unused_0[6];
+	/*
+	 * This field is used in Output records to indicate that the output
+	 * is completely written to RAM.  This field should be read as '1'
+	 * to indicate that the output has been completely written.
+	 * When writing a command completion or response to an internal processor,
+	 * the order of writes has to be such that this field is written last.
+	 */
+	uint8_t	valid;
+} __attribute__((packed));
+
 /***********************
  * hwrm_port_clr_stats *
  ***********************/
@@ -18322,7 +19283,7 @@ struct hwrm_port_phy_mdio_bus_acquire_input {
 	 * Timeout in milli seconds, MDIO BUS will be released automatically
 	 * after this time, if another mdio acquire command is not received
 	 * within the timeout window from the same client.
-	 * A 0xFFFF will hold the bus until this bus is released.
+	 * A 0xFFFF will hold the bus untill this bus is released.
 	 */
 	uint16_t	mdio_bus_timeout;
 	uint8_t	unused_0[2];
@@ -19158,6 +20119,30 @@ struct hwrm_queue_pfcenable_qcfg_output {
 	/* If set to 1, then PFC is enabled on PRI 7. */
 	#define HWRM_QUEUE_PFCENABLE_QCFG_OUTPUT_FLAGS_PRI7_PFC_ENABLED \
 		UINT32_C(0x80)
+	/* If set to 1, then PFC WatchDog is requested to be enabled on PRI0. */
+	#define HWRM_QUEUE_PFCENABLE_QCFG_OUTPUT_FLAGS_PRI0_PFC_WATCHDOG_ENABLED \
+		UINT32_C(0x100)
+	/* If set to 1, then PFC WatchDog is requested to be enabled on PRI1. */
+	#define HWRM_QUEUE_PFCENABLE_QCFG_OUTPUT_FLAGS_PRI1_PFC_WATCHDOG_ENABLED \
+		UINT32_C(0x200)
+	/* If set to 1, then PFC WatchDog is requested to be enabled on PRI2. */
+	#define HWRM_QUEUE_PFCENABLE_QCFG_OUTPUT_FLAGS_PRI2_PFC_WATCHDOG_ENABLED \
+		UINT32_C(0x400)
+	/* If set to 1, then PFC WatchDog is requested to be enabled on PRI3. */
+	#define HWRM_QUEUE_PFCENABLE_QCFG_OUTPUT_FLAGS_PRI3_PFC_WATCHDOG_ENABLED \
+		UINT32_C(0x800)
+	/* If set to 1, then PFC WatchDog is requested to be enabled on PRI4. */
+	#define HWRM_QUEUE_PFCENABLE_QCFG_OUTPUT_FLAGS_PRI4_PFC_WATCHDOG_ENABLED \
+		UINT32_C(0x1000)
+	/* If set to 1, then PFC WatchDog is requested to be enabled on PRI5. */
+	#define HWRM_QUEUE_PFCENABLE_QCFG_OUTPUT_FLAGS_PRI5_PFC_WATCHDOG_ENABLED \
+		UINT32_C(0x2000)
+	/* If set to 1, then PFC WatchDog is requested to be enabled on PRI6. */
+	#define HWRM_QUEUE_PFCENABLE_QCFG_OUTPUT_FLAGS_PRI6_PFC_WATCHDOG_ENABLED \
+		UINT32_C(0x4000)
+	/* If set to 1, then PFC WatchDog is requested to be enabled on PRI7. */
+	#define HWRM_QUEUE_PFCENABLE_QCFG_OUTPUT_FLAGS_PRI7_PFC_WATCHDOG_ENABLED \
+		UINT32_C(0x8000)
 	uint8_t	unused_0[3];
 	/*
 	 * This field is used in Output records to indicate that the output
@@ -19229,6 +20214,30 @@ struct hwrm_queue_pfcenable_cfg_input {
 	/* If set to 1, then PFC is requested to be enabled on PRI 7. */
 	#define HWRM_QUEUE_PFCENABLE_CFG_INPUT_FLAGS_PRI7_PFC_ENABLED \
 		UINT32_C(0x80)
+	/* If set to 1, then PFC WatchDog is requested to be enabled on PRI0. */
+	#define HWRM_QUEUE_PFCENABLE_CFG_INPUT_FLAGS_PRI0_PFC_WATCHDOG_ENABLED \
+		UINT32_C(0x100)
+	/* If set to 1, then PFC WatchDog is requested to be enabled on PRI1. */
+	#define HWRM_QUEUE_PFCENABLE_CFG_INPUT_FLAGS_PRI1_PFC_WATCHDOG_ENABLED \
+		UINT32_C(0x200)
+	/* If set to 1, then PFC WatchDog is requested to be enabled on PRI2. */
+	#define HWRM_QUEUE_PFCENABLE_CFG_INPUT_FLAGS_PRI2_PFC_WATCHDOG_ENABLED \
+		UINT32_C(0x400)
+	/* If set to 1, then PFC WatchDog is requested to be enabled on PRI3. */
+	#define HWRM_QUEUE_PFCENABLE_CFG_INPUT_FLAGS_PRI3_PFC_WATCHDOG_ENABLED \
+		UINT32_C(0x800)
+	/* If set to 1, then PFC WatchDog is requested to be enabled on PRI4. */
+	#define HWRM_QUEUE_PFCENABLE_CFG_INPUT_FLAGS_PRI4_PFC_WATCHDOG_ENABLED \
+		UINT32_C(0x1000)
+	/* If set to 1, then PFC WatchDog is requested to be enabled on PRI5. */
+	#define HWRM_QUEUE_PFCENABLE_CFG_INPUT_FLAGS_PRI5_PFC_WATCHDOG_ENABLED \
+		UINT32_C(0x2000)
+	/* If set to 1, then PFC WatchDog is requested to be enabled on PRI6. */
+	#define HWRM_QUEUE_PFCENABLE_CFG_INPUT_FLAGS_PRI6_PFC_WATCHDOG_ENABLED \
+		UINT32_C(0x4000)
+	/* If set to 1, then PFC WatchDog is requested to be enabled on PRI7. */
+	#define HWRM_QUEUE_PFCENABLE_CFG_INPUT_FLAGS_PRI7_PFC_WATCHDOG_ENABLED \
+		UINT32_C(0x8000)
 	/*
 	 * Port ID of port for which the table is being configured.
 	 * The HWRM needs to check whether this function is allowed
@@ -31831,15 +32840,2172 @@ struct hwrm_cfa_eem_qcfg_input {
 	 */
 	uint64_t	resp_addr;
 	uint32_t	flags;
-	/* When set to 1, indicates the configuration is the TX flow. */
-	#define HWRM_CFA_EEM_QCFG_INPUT_FLAGS_PATH_TX     UINT32_C(0x1)
-	/* When set to 1, indicates the configuration is the RX flow. */
-	#define HWRM_CFA_EEM_QCFG_INPUT_FLAGS_PATH_RX     UINT32_C(0x2)
-	uint32_t	unused_0;
+	/* When set to 1, indicates the configuration is the TX flow. */
+	#define HWRM_CFA_EEM_QCFG_INPUT_FLAGS_PATH_TX     UINT32_C(0x1)
+	/* When set to 1, indicates the configuration is the RX flow. */
+	#define HWRM_CFA_EEM_QCFG_INPUT_FLAGS_PATH_RX     UINT32_C(0x2)
+	uint32_t	unused_0;
+} __attribute__((packed));
+
+/* hwrm_cfa_eem_qcfg_output (size:256b/32B) */
+struct hwrm_cfa_eem_qcfg_output {
+	/* The specific error status for the command. */
+	uint16_t	error_code;
+	/* The HWRM command request type. */
+	uint16_t	req_type;
+	/* The sequence ID from the original command. */
+	uint16_t	seq_id;
+	/* The length of the response data in number of bytes. */
+	uint16_t	resp_len;
+	uint32_t	flags;
+	/* When set to 1, indicates the configuration is the TX flow. */
+	#define HWRM_CFA_EEM_QCFG_OUTPUT_FLAGS_PATH_TX \
+		UINT32_C(0x1)
+	/* When set to 1, indicates the configuration is the RX flow. */
+	#define HWRM_CFA_EEM_QCFG_OUTPUT_FLAGS_PATH_RX \
+		UINT32_C(0x2)
+	/* When set to 1, all offloaded flows will be sent to EEM. */
+	#define HWRM_CFA_EEM_QCFG_OUTPUT_FLAGS_PREFERRED_OFFLOAD \
+		UINT32_C(0x4)
+	/* The number of entries the FW has configured for EEM. */
+	uint32_t	num_entries;
+	/* Configured EEM with the given context if for KEY0 table. */
+	uint16_t	key0_ctx_id;
+	/* Configured EEM with the given context if for KEY1 table. */
+	uint16_t	key1_ctx_id;
+	/* Configured EEM with the given context if for RECORD table. */
+	uint16_t	record_ctx_id;
+	/* Configured EEM with the given context if for EFC table. */
+	uint16_t	efc_ctx_id;
+	/* Configured EEM with the given context if for EFC table. */
+	uint16_t	fid_ctx_id;
+	uint8_t	unused_2[5];
+	/*
+	 * This field is used in Output records to indicate that the output
+	 * is completely written to RAM. This field should be read as '1'
+	 * to indicate that the output has been completely written.
+	 * When writing a command completion or response to an internal processor,
+	 * the order of writes has to be such that this field is written last.
+	 */
+	uint8_t	valid;
+} __attribute__((packed));
+
+/*******************
+ * hwrm_cfa_eem_op *
+ *******************/
+
+
+/* hwrm_cfa_eem_op_input (size:192b/24B) */
+struct hwrm_cfa_eem_op_input {
+	/* The HWRM command request type. */
+	uint16_t	req_type;
+	/*
+	 * The completion ring to send the completion event on. This should
+	 * be the NQ ID returned from the `nq_alloc` HWRM command.
+	 */
+	uint16_t	cmpl_ring;
+	/*
+	 * The sequence ID is used by the driver for tracking multiple
+	 * commands. This ID is treated as opaque data by the firmware and
+	 * the value is returned in the `hwrm_resp_hdr` upon completion.
+	 */
+	uint16_t	seq_id;
+	/*
+	 * The target ID of the command:
+	 * * 0x0-0xFFF8 - The function ID
+	 * * 0xFFF8-0xFFFC, 0xFFFE - Reserved for internal processors
+	 * * 0xFFFD - Reserved for user-space HWRM interface
+	 * * 0xFFFF - HWRM
+	 */
+	uint16_t	target_id;
+	/*
+	 * A physical address pointer pointing to a host buffer that the
+	 * command's response data will be written. This can be either a host
+	 * physical address (HPA) or a guest physical address (GPA) and must
+	 * point to a physically contiguous block of memory.
+	 */
+	uint64_t	resp_addr;
+	uint32_t	flags;
+	/*
+	 * When set to 1, indicates the host memory which is passed will be
+	 * used for the TX flow offload function specified in fid.
+	 * Note if this bit is set then the path_rx bit can't be set.
+	 */
+	#define HWRM_CFA_EEM_OP_INPUT_FLAGS_PATH_TX     UINT32_C(0x1)
+	/*
+	 * When set to 1, indicates the host memory which is passed will be
+	 * used for the RX flow offload function specified in fid.
+	 * Note if this bit is set then the path_tx bit can't be set.
+	 */
+	#define HWRM_CFA_EEM_OP_INPUT_FLAGS_PATH_RX     UINT32_C(0x2)
+	uint16_t	unused_0;
+	/* The number of EEM key table entries to be configured. */
+	uint16_t	op;
+	/* This value is reserved and should not be used. */
+	#define HWRM_CFA_EEM_OP_INPUT_OP_RESERVED    UINT32_C(0x0)
+	/*
+	 * To properly stop EEM and ensure there are no DMA's, the caller
+	 * must disable EEM for the given PF, using this call. This will
+	 * safely disable EEM and ensure that all DMA'ed to the
+	 * keys/records/efc have been completed.
+	 */
+	#define HWRM_CFA_EEM_OP_INPUT_OP_EEM_DISABLE UINT32_C(0x1)
+	/*
+	 * Once the EEM host memory has been configured, EEM options have
+	 * been configured. Then the caller should enable EEM for the given
+	 * PF. Note once this call has been made, then the EEM mechanism
+	 * will be active and DMA's will occur as packets are processed.
+	 */
+	#define HWRM_CFA_EEM_OP_INPUT_OP_EEM_ENABLE  UINT32_C(0x2)
+	/*
+	 * Clear EEM settings for the given PF so that the register values
+	 * are reset back to there initial state.
+	 */
+	#define HWRM_CFA_EEM_OP_INPUT_OP_EEM_CLEANUP UINT32_C(0x3)
+	#define HWRM_CFA_EEM_OP_INPUT_OP_LAST \
+		HWRM_CFA_EEM_OP_INPUT_OP_EEM_CLEANUP
+} __attribute__((packed));
+
+/* hwrm_cfa_eem_op_output (size:128b/16B) */
+struct hwrm_cfa_eem_op_output {
+	/* The specific error status for the command. */
+	uint16_t	error_code;
+	/* The HWRM command request type. */
+	uint16_t	req_type;
+	/* The sequence ID from the original command. */
+	uint16_t	seq_id;
+	/* The length of the response data in number of bytes. */
+	uint16_t	resp_len;
+	uint8_t	unused_0[7];
+	/*
+	 * This field is used in Output records to indicate that the output
+	 * is completely written to RAM. This field should be read as '1'
+	 * to indicate that the output has been completely written.
+	 * When writing a command completion or response to an internal processor,
+	 * the order of writes has to be such that this field is written last.
+	 */
+	uint8_t	valid;
+} __attribute__((packed));
+
+/********************************
+ * hwrm_cfa_adv_flow_mgnt_qcaps *
+ ********************************/
+
+
+/* hwrm_cfa_adv_flow_mgnt_qcaps_input (size:256b/32B) */
+struct hwrm_cfa_adv_flow_mgnt_qcaps_input {
+	/* The HWRM command request type. */
+	uint16_t	req_type;
+	/*
+	 * The completion ring to send the completion event on. This should
+	 * be the NQ ID returned from the `nq_alloc` HWRM command.
+	 */
+	uint16_t	cmpl_ring;
+	/*
+	 * The sequence ID is used by the driver for tracking multiple
+	 * commands. This ID is treated as opaque data by the firmware and
+	 * the value is returned in the `hwrm_resp_hdr` upon completion.
+	 */
+	uint16_t	seq_id;
+	/*
+	 * The target ID of the command:
+	 * * 0x0-0xFFF8 - The function ID
+	 * * 0xFFF8-0xFFFC, 0xFFFE - Reserved for internal processors
+	 * * 0xFFFD - Reserved for user-space HWRM interface
+	 * * 0xFFFF - HWRM
+	 */
+	uint16_t	target_id;
+	/*
+	 * A physical address pointer pointing to a host buffer that the
+	 * command's response data will be written. This can be either a host
+	 * physical address (HPA) or a guest physical address (GPA) and must
+	 * point to a physically contiguous block of memory.
+	 */
+	uint64_t	resp_addr;
+	uint32_t	unused_0[4];
+} __attribute__((packed));
+
+/* hwrm_cfa_adv_flow_mgnt_qcaps_output (size:128b/16B) */
+struct hwrm_cfa_adv_flow_mgnt_qcaps_output {
+	/* The specific error status for the command. */
+	uint16_t	error_code;
+	/* The HWRM command request type. */
+	uint16_t	req_type;
+	/* The sequence ID from the original command. */
+	uint16_t	seq_id;
+	/* The length of the response data in number of bytes. */
+	uint16_t	resp_len;
+	uint32_t	flags;
+	/*
+	 * Value of 1 to indicate firmware support 16-bit flow handle.
+	 * Value of 0 to indicate firmware not support 16-bit flow handle.
+	 */
+	#define HWRM_CFA_ADV_FLOW_MGNT_QCAPS_OUTPUT_FLAGS_FLOW_HND_16BIT_SUPPORTED \
+		UINT32_C(0x1)
+	/*
+	 * Value of 1 to indicate firmware support 64-bit flow handle.
+	 * Value of 0 to indicate firmware not support 64-bit flow handle.
+	 */
+	#define HWRM_CFA_ADV_FLOW_MGNT_QCAPS_OUTPUT_FLAGS_FLOW_HND_64BIT_SUPPORTED \
+		UINT32_C(0x2)
+	/*
+	 * Value of 1 to indicate firmware support flow batch delete operation through
+	 * HWRM_CFA_FLOW_FLUSH command.
+	 * Value of 0 to indicate that the firmware does not support flow batch delete
+	 * operation.
+	 */
+	#define HWRM_CFA_ADV_FLOW_MGNT_QCAPS_OUTPUT_FLAGS_FLOW_BATCH_DELETE_SUPPORTED \
+		UINT32_C(0x4)
+	/*
+	 * Value of 1 to indicate that the firmware support flow reset all operation through
+	 * HWRM_CFA_FLOW_FLUSH command.
+	 * Value of 0 indicates firmware does not support flow reset all operation.
+	 */
+	#define HWRM_CFA_ADV_FLOW_MGNT_QCAPS_OUTPUT_FLAGS_FLOW_RESET_ALL_SUPPORTED \
+		UINT32_C(0x8)
+	/*
+	 * Value of 1 to indicate that firmware supports use of FID as dest_id in
+	 * HWRM_CFA_NTUPLE_ALLOC/CFG commands.
+	 * Value of 0 indicates firmware does not support use of FID as dest_id.
+	 */
+	#define HWRM_CFA_ADV_FLOW_MGNT_QCAPS_OUTPUT_FLAGS_NTUPLE_FLOW_DEST_FUNC_SUPPORTED \
+		UINT32_C(0x10)
+	/*
+	 * Value of 1 to indicate that firmware supports TX EEM flows.
+	 * Value of 0 indicates firmware does not support TX EEM flows.
+	 */
+	#define HWRM_CFA_ADV_FLOW_MGNT_QCAPS_OUTPUT_FLAGS_TX_EEM_FLOW_SUPPORTED \
+		UINT32_C(0x20)
+	/*
+	 * Value of 1 to indicate that firmware supports RX EEM flows.
+	 * Value of 0 indicates firmware does not support RX EEM flows.
+	 */
+	#define HWRM_CFA_ADV_FLOW_MGNT_QCAPS_OUTPUT_FLAGS_RX_EEM_FLOW_SUPPORTED \
+		UINT32_C(0x40)
+	/*
+	 * Value of 1 to indicate that firmware supports the dynamic allocation of an
+	 * on-chip flow counter which can be used for EEM flows.
+	 * Value of 0 indicates firmware does not support the dynamic allocation of an
+	 * on-chip flow counter.
+	 */
+	#define HWRM_CFA_ADV_FLOW_MGNT_QCAPS_OUTPUT_FLAGS_FLOW_COUNTER_ALLOC_SUPPORTED \
+		UINT32_C(0x80)
+	/*
+	 * Value of 1 to indicate that firmware supports setting of
+	 * rfs_ring_tbl_idx in HWRM_CFA_NTUPLE_ALLOC command.
+	 * Value of 0 indicates firmware does not support rfs_ring_tbl_idx.
+	 */
+	#define HWRM_CFA_ADV_FLOW_MGNT_QCAPS_OUTPUT_FLAGS_RFS_RING_TBL_IDX_SUPPORTED \
+		UINT32_C(0x100)
+	/*
+	 * Value of 1 to indicate that firmware supports untagged matching
+	 * criteria on HWRM_CFA_L2_FILTER_ALLOC command. Value of 0
+	 * indicates firmware does not support untagged matching.
+	 */
+	#define HWRM_CFA_ADV_FLOW_MGNT_QCAPS_OUTPUT_FLAGS_UNTAGGED_VLAN_SUPPORTED \
+		UINT32_C(0x200)
+	/*
+	 * Value of 1 to indicate that firmware supports XDP filter. Value
+	 * of 0 indicates firmware does not support XDP filter.
+	 */
+	#define HWRM_CFA_ADV_FLOW_MGNT_QCAPS_OUTPUT_FLAGS_XDP_SUPPORTED \
+		UINT32_C(0x400)
+	/*
+	 * Value of 1 to indicate that the firmware support L2 header source
+	 * fields matching criteria on HWRM_CFA_L2_FILTER_ALLOC command.
+	 * Value of 0 indicates firmware does not support L2 header source
+	 * fields matching.
+	 */
+	#define HWRM_CFA_ADV_FLOW_MGNT_QCAPS_OUTPUT_FLAGS_L2_HEADER_SOURCE_FIELDS_SUPPORTED \
+		UINT32_C(0x800)
+	/*
+	 * If set to 1, firmware is capable of supporting ARP ethertype as
+	 * matching criteria for HWRM_CFA_NTUPLE_FILTER_ALLOC command on the
+	 * RX direction. By default, this flag should be 0 for older version
+	 * of firmware.
+	 */
+	#define HWRM_CFA_ADV_FLOW_MGNT_QCAPS_OUTPUT_FLAGS_NTUPLE_FLOW_RX_ARP_SUPPORTED \
+		UINT32_C(0x1000)
+	/*
+	 * Value of 1 to indicate that firmware supports setting of
+	 * rfs_ring_tbl_idx in dst_id field of the HWRM_CFA_NTUPLE_ALLOC
+	 * command. Value of 0 indicates firmware does not support
+	 * rfs_ring_tbl_idx in dst_id field.
+	 */
+	#define HWRM_CFA_ADV_FLOW_MGNT_QCAPS_OUTPUT_FLAGS_RFS_RING_TBL_IDX_V2_SUPPORTED \
+		UINT32_C(0x2000)
+	/*
+	 * If set to 1, firmware is capable of supporting IPv4/IPv6 as
+	 * ethertype in HWRM_CFA_NTUPLE_FILTER_ALLOC command on the RX
+	 * direction. By default, this flag should be 0 for older version
+	 * of firmware.
+	 */
+	#define HWRM_CFA_ADV_FLOW_MGNT_QCAPS_OUTPUT_FLAGS_NTUPLE_FLOW_RX_ETHERTYPE_IP_SUPPORTED \
+		UINT32_C(0x4000)
+	uint8_t	unused_0[3];
+	/*
+	 * This field is used in Output records to indicate that the output
+	 * is completely written to RAM. This field should be read as '1'
+	 * to indicate that the output has been completely written.
+	 * When writing a command completion or response to an internal processor,
+	 * the order of writes has to be such that this field is written last.
+	 */
+	uint8_t	valid;
+} __attribute__((packed));
+
+/******************
+ * hwrm_cfa_tflib *
+ ******************/
+
+
+/* hwrm_cfa_tflib_input (size:1024b/128B) */
+struct hwrm_cfa_tflib_input {
+	/* The HWRM command request type. */
+	uint16_t	req_type;
+	/*
+	 * The completion ring to send the completion event on. This should
+	 * be the NQ ID returned from the `nq_alloc` HWRM command.
+	 */
+	uint16_t	cmpl_ring;
+	/*
+	 * The sequence ID is used by the driver for tracking multiple
+	 * commands. This ID is treated as opaque data by the firmware and
+	 * the value is returned in the `hwrm_resp_hdr` upon completion.
+	 */
+	uint16_t	seq_id;
+	/*
+	 * The target ID of the command:
+	 * * 0x0-0xFFF8 - The function ID
+	 * * 0xFFF8-0xFFFC, 0xFFFE - Reserved for internal processors
+	 * * 0xFFFD - Reserved for user-space HWRM interface
+	 * * 0xFFFF - HWRM
+	 */
+	uint16_t	target_id;
+	/*
+	 * A physical address pointer pointing to a host buffer that the
+	 * command's response data will be written. This can be either a host
+	 * physical address (HPA) or a guest physical address (GPA) and must
+	 * point to a physically contiguous block of memory.
+	 */
+	uint64_t	resp_addr;
+	/* TFLIB message type. */
+	uint16_t	tf_type;
+	/* TFLIB message subtype. */
+	uint16_t	tf_subtype;
+	/* unused. */
+	uint8_t	unused0[4];
+	/* TFLIB request data. */
+	uint32_t	tf_req[26];
+} __attribute__((packed));
+
+/* hwrm_cfa_tflib_output (size:5632b/704B) */
+struct hwrm_cfa_tflib_output {
+	/* The specific error status for the command. */
+	uint16_t	error_code;
+	/* The HWRM command request type. */
+	uint16_t	req_type;
+	/* The sequence ID from the original command. */
+	uint16_t	seq_id;
+	/* The length of the response data in number of bytes. */
+	uint16_t	resp_len;
+	/* TFLIB message type. */
+	uint16_t	tf_type;
+	/* TFLIB message subtype. */
+	uint16_t	tf_subtype;
+	/* TFLIB response code */
+	uint32_t	tf_resp_code;
+	/* TFLIB response data. */
+	uint32_t	tf_resp[170];
+	/* unused. */
+	uint8_t	unused1[7];
+	/*
+	 * This field is used in Output records to indicate that the output
+	 * is completely written to RAM. This field should be read as '1'
+	 * to indicate that the output has been completely written.
+	 * When writing a command completion or response to an internal processor,
+	 * the order of writes has to be such that this field is written last.
+	 */
+	uint8_t	valid;
+} __attribute__((packed));
+
+/***********
+ * hwrm_tf *
+ ***********/
+
+
+/* hwrm_tf_input (size:1024b/128B) */
+struct hwrm_tf_input {
+	/* The HWRM command request type. */
+	uint16_t	req_type;
+	/*
+	 * The completion ring to send the completion event on. This should
+	 * be the NQ ID returned from the `nq_alloc` HWRM command.
+	 */
+	uint16_t	cmpl_ring;
+	/*
+	 * The sequence ID is used by the driver for tracking multiple
+	 * commands. This ID is treated as opaque data by the firmware and
+	 * the value is returned in the `hwrm_resp_hdr` upon completion.
+	 */
+	uint16_t	seq_id;
+	/*
+	 * The target ID of the command:
+	 * * 0x0-0xFFF8 - The function ID
+	 * * 0xFFF8-0xFFFC, 0xFFFE - Reserved for internal processors
+	 * * 0xFFFD - Reserved for user-space HWRM interface
+	 * * 0xFFFF - HWRM
+	 */
+	uint16_t	target_id;
+	/*
+	 * A physical address pointer pointing to a host buffer that the
+	 * command's response data will be written. This can be either a host
+	 * physical address (HPA) or a guest physical address (GPA) and must
+	 * point to a physically contiguous block of memory.
+	 */
+	uint64_t	resp_addr;
+	/* TF message type. */
+	uint16_t	type;
+	/* TF message subtype. */
+	uint16_t	subtype;
+	/* unused. */
+	uint8_t	unused0[4];
+	/* TF request data. */
+	uint32_t	req[26];
+} __attribute__((packed));
+
+/* hwrm_tf_output (size:5632b/704B) */
+struct hwrm_tf_output {
+	/* The specific error status for the command. */
+	uint16_t	error_code;
+	/* The HWRM command request type. */
+	uint16_t	req_type;
+	/* The sequence ID from the original command. */
+	uint16_t	seq_id;
+	/* The length of the response data in number of bytes. */
+	uint16_t	resp_len;
+	/* TF message type. */
+	uint16_t	type;
+	/* TF message subtype. */
+	uint16_t	subtype;
+	/* TF response code */
+	uint32_t	resp_code;
+	/* TF response data. */
+	uint32_t	resp[170];
+	/* unused. */
+	uint8_t	unused1[7];
+	/*
+	 * This field is used in Output records to indicate that the
+	 * output is completely written to RAM. This field should be
+	 * read as '1' to indicate that the output has been
+	 * completely written.  When writing a command completion or
+	 * response to an internal processor, the order of writes has
+	 * to be such that this field is written last.
+	 */
+	uint8_t	valid;
+} __attribute__((packed));
+
+/***********************
+ * hwrm_tf_version_get *
+ ***********************/
+
+
+/* hwrm_tf_version_get_input (size:128b/16B) */
+struct hwrm_tf_version_get_input {
+	/* The HWRM command request type. */
+	uint16_t	req_type;
+	/*
+	 * The completion ring to send the completion event on. This should
+	 * be the NQ ID returned from the `nq_alloc` HWRM command.
+	 */
+	uint16_t	cmpl_ring;
+	/*
+	 * The sequence ID is used by the driver for tracking multiple
+	 * commands. This ID is treated as opaque data by the firmware and
+	 * the value is returned in the `hwrm_resp_hdr` upon completion.
+	 */
+	uint16_t	seq_id;
+	/*
+	 * The target ID of the command:
+	 * * 0x0-0xFFF8 - The function ID
+	 * * 0xFFF8-0xFFFC, 0xFFFE - Reserved for internal processors
+	 * * 0xFFFD - Reserved for user-space HWRM interface
+	 * * 0xFFFF - HWRM
+	 */
+	uint16_t	target_id;
+	/*
+	 * A physical address pointer pointing to a host buffer that the
+	 * command's response data will be written. This can be either a host
+	 * physical address (HPA) or a guest physical address (GPA) and must
+	 * point to a physically contiguous block of memory.
+	 */
+	uint64_t	resp_addr;
+} __attribute__((packed));
+
+/* hwrm_tf_version_get_output (size:128b/16B) */
+struct hwrm_tf_version_get_output {
+	/* The specific error status for the command. */
+	uint16_t	error_code;
+	/* The HWRM command request type. */
+	uint16_t	req_type;
+	/* The sequence ID from the original command. */
+	uint16_t	seq_id;
+	/* The length of the response data in number of bytes. */
+	uint16_t	resp_len;
+	/* Version Major number. */
+	uint8_t	major;
+	/* Version Minor number. */
+	uint8_t	minor;
+	/* Version Update number. */
+	uint8_t	update;
+	/* unused. */
+	uint8_t	unused0[4];
+	/*
+	 * This field is used in Output records to indicate that the output
+	 * is completely written to RAM. This field should be read as '1'
+	 * to indicate that the output has been completely written.
+	 * When writing a command completion or response to an internal
+	 * processor, the order of writes has to be such that this field is
+	 * written last.
+	 */
+	uint8_t	valid;
+} __attribute__((packed));
+
+/************************
+ * hwrm_tf_session_open *
+ ************************/
+
+
+/* hwrm_tf_session_open_input (size:640b/80B) */
+struct hwrm_tf_session_open_input {
+	/* The HWRM command request type. */
+	uint16_t	req_type;
+	/*
+	 * The completion ring to send the completion event on. This should
+	 * be the NQ ID returned from the `nq_alloc` HWRM command.
+	 */
+	uint16_t	cmpl_ring;
+	/*
+	 * The sequence ID is used by the driver for tracking multiple
+	 * commands. This ID is treated as opaque data by the firmware and
+	 * the value is returned in the `hwrm_resp_hdr` upon completion.
+	 */
+	uint16_t	seq_id;
+	/*
+	 * The target ID of the command:
+	 * * 0x0-0xFFF8 - The function ID
+	 * * 0xFFF8-0xFFFC, 0xFFFE - Reserved for internal processors
+	 * * 0xFFFD - Reserved for user-space HWRM interface
+	 * * 0xFFFF - HWRM
+	 */
+	uint16_t	target_id;
+	/*
+	 * A physical address pointer pointing to a host buffer that the
+	 * command's response data will be written. This can be either a host
+	 * physical address (HPA) or a guest physical address (GPA) and must
+	 * point to a physically contiguous block of memory.
+	 */
+	uint64_t	resp_addr;
+	/* Name of the session. */
+	uint8_t	session_name[64];
+} __attribute__((packed));
+
+/* hwrm_tf_session_open_output (size:128b/16B) */
+struct hwrm_tf_session_open_output {
+	/* The specific error status for the command. */
+	uint16_t	error_code;
+	/* The HWRM command request type. */
+	uint16_t	req_type;
+	/* The sequence ID from the original command. */
+	uint16_t	seq_id;
+	/* The length of the response data in number of bytes. */
+	uint16_t	resp_len;
+	/*
+	 * Unique session identifier for the session created by the
+	 * firmware. It includes PCIe bus info to distinguish the PF
+	 * and session info to identify the associated TruFlow
+	 * session.
+	 */
+	uint32_t	fw_session_id;
+	/* unused. */
+	uint8_t	unused0[3];
+	/*
+	 * This field is used in Output records to indicate that the output
+	 * is completely written to RAM. This field should be read as '1'
+	 * to indicate that the output has been completely written.
+	 * When writing a command completion or response to an internal
+	 * processor, the order of writes has to be such that this field is
+	 * written last.
+	 */
+	uint8_t	valid;
+} __attribute__((packed));
+
+/**************************
+ * hwrm_tf_session_attach *
+ **************************/
+
+
+/* hwrm_tf_session_attach_input (size:704b/88B) */
+struct hwrm_tf_session_attach_input {
+	/* The HWRM command request type. */
+	uint16_t	req_type;
+	/*
+	 * The completion ring to send the completion event on. This should
+	 * be the NQ ID returned from the `nq_alloc` HWRM command.
+	 */
+	uint16_t	cmpl_ring;
+	/*
+	 * The sequence ID is used by the driver for tracking multiple
+	 * commands. This ID is treated as opaque data by the firmware and
+	 * the value is returned in the `hwrm_resp_hdr` upon completion.
+	 */
+	uint16_t	seq_id;
+	/*
+	 * The target ID of the command:
+	 * * 0x0-0xFFF8 - The function ID
+	 * * 0xFFF8-0xFFFC, 0xFFFE - Reserved for internal processors
+	 * * 0xFFFD - Reserved for user-space HWRM interface
+	 * * 0xFFFF - HWRM
+	 */
+	uint16_t	target_id;
+	/*
+	 * A physical address pointer pointing to a host buffer that the
+	 * command's response data will be written. This can be either a host
+	 * physical address (HPA) or a guest physical address (GPA) and must
+	 * point to a physically contiguous block of memory.
+	 */
+	uint64_t	resp_addr;
+	/*
+	 * Unique session identifier for the session that the attach
+	 * request want to attach to. This value originates from the
+	 * shared session memory that the attach request opened by
+	 * way of the 'attach name' that was passed in to the core
+	 * attach API.
+	 * The fw_session_id of the attach session includes PCIe bus
+	 * info to distinguish the PF and session info to identify
+	 * the associated TruFlow session.
+	 */
+	uint32_t	attach_fw_session_id;
+	/* unused. */
+	uint32_t	unused0;
+	/* Name of the session it self. */
+	uint8_t	session_name[64];
+} __attribute__((packed));
+
+/* hwrm_tf_session_attach_output (size:128b/16B) */
+struct hwrm_tf_session_attach_output {
+	/* The specific error status for the command. */
+	uint16_t	error_code;
+	/* The HWRM command request type. */
+	uint16_t	req_type;
+	/* The sequence ID from the original command. */
+	uint16_t	seq_id;
+	/* The length of the response data in number of bytes. */
+	uint16_t	resp_len;
+	/*
+	 * Unique session identifier for the session created by the
+	 * firmware. It includes PCIe bus info to distinguish the PF
+	 * and session info to identify the associated TruFlow
+	 * session. This fw_session_id is unique to the attach
+	 * request.
+	 */
+	uint32_t	fw_session_id;
+	/* unused. */
+	uint8_t	unused0[3];
+	/*
+	 * This field is used in Output records to indicate that the output
+	 * is completely written to RAM. This field should be read as '1'
+	 * to indicate that the output has been completely written.
+	 * When writing a command completion or response to an internal
+	 * processor, the order of writes has to be such that this field is
+	 * written last.
+	 */
+	uint8_t	valid;
+} __attribute__((packed));
+
+/*************************
+ * hwrm_tf_session_close *
+ *************************/
+
+
+/* hwrm_tf_session_close_input (size:192b/24B) */
+struct hwrm_tf_session_close_input {
+	/* The HWRM command request type. */
+	uint16_t	req_type;
+	/*
+	 * The completion ring to send the completion event on. This should
+	 * be the NQ ID returned from the `nq_alloc` HWRM command.
+	 */
+	uint16_t	cmpl_ring;
+	/*
+	 * The sequence ID is used by the driver for tracking multiple
+	 * commands. This ID is treated as opaque data by the firmware and
+	 * the value is returned in the `hwrm_resp_hdr` upon completion.
+	 */
+	uint16_t	seq_id;
+	/*
+	 * The target ID of the command:
+	 * * 0x0-0xFFF8 - The function ID
+	 * * 0xFFF8-0xFFFC, 0xFFFE - Reserved for internal processors
+	 * * 0xFFFD - Reserved for user-space HWRM interface
+	 * * 0xFFFF - HWRM
+	 */
+	uint16_t	target_id;
+	/*
+	 * A physical address pointer pointing to a host buffer that the
+	 * command's response data will be written. This can be either a host
+	 * physical address (HPA) or a guest physical address (GPA) and must
+	 * point to a physically contiguous block of memory.
+	 */
+	uint64_t	resp_addr;
+	/* Firmware session id returned when HWRM_TF_SESSION_OPEN is sent. */
+	uint32_t	fw_session_id;
+	/* unused. */
+	uint8_t	unused0[4];
+} __attribute__((packed));
+
+/* hwrm_tf_session_close_output (size:128b/16B) */
+struct hwrm_tf_session_close_output {
+	/* The specific error status for the command. */
+	uint16_t	error_code;
+	/* The HWRM command request type. */
+	uint16_t	req_type;
+	/* The sequence ID from the original command. */
+	uint16_t	seq_id;
+	/* The length of the response data in number of bytes. */
+	uint16_t	resp_len;
+	/* unused. */
+	uint8_t	unused0[7];
+	/*
+	 * This field is used in Output records to indicate that the output
+	 * is completely written to RAM. This field should be read as '1'
+	 * to indicate that the output has been completely written.
+	 * When writing a command completion or response to an internal
+	 * processor, the order of writes has to be such that this field
+	 * is written last.
+	 */
+	uint8_t	valid;
+} __attribute__((packed));
+
+/************************
+ * hwrm_tf_session_qcfg *
+ ************************/
+
+
+/* hwrm_tf_session_qcfg_input (size:192b/24B) */
+struct hwrm_tf_session_qcfg_input {
+	/* The HWRM command request type. */
+	uint16_t	req_type;
+	/*
+	 * The completion ring to send the completion event on. This should
+	 * be the NQ ID returned from the `nq_alloc` HWRM command.
+	 */
+	uint16_t	cmpl_ring;
+	/*
+	 * The sequence ID is used by the driver for tracking multiple
+	 * commands. This ID is treated as opaque data by the firmware and
+	 * the value is returned in the `hwrm_resp_hdr` upon completion.
+	 */
+	uint16_t	seq_id;
+	/*
+	 * The target ID of the command:
+	 * * 0x0-0xFFF8 - The function ID
+	 * * 0xFFF8-0xFFFC, 0xFFFE - Reserved for internal processors
+	 * * 0xFFFD - Reserved for user-space HWRM interface
+	 * * 0xFFFF - HWRM
+	 */
+	uint16_t	target_id;
+	/*
+	 * A physical address pointer pointing to a host buffer that the
+	 * command's response data will be written. This can be either a host
+	 * physical address (HPA) or a guest physical address (GPA) and must
+	 * point to a physically contiguous block of memory.
+	 */
+	uint64_t	resp_addr;
+	/* Firmware session id returned when HWRM_TF_SESSION_OPEN is sent. */
+	uint32_t	fw_session_id;
+	/* unused. */
+	uint8_t	unused0[4];
+} __attribute__((packed));
+
+/* hwrm_tf_session_qcfg_output (size:128b/16B) */
+struct hwrm_tf_session_qcfg_output {
+	/* The specific error status for the command. */
+	uint16_t	error_code;
+	/* The HWRM command request type. */
+	uint16_t	req_type;
+	/* The sequence ID from the original command. */
+	uint16_t	seq_id;
+	/* The length of the response data in number of bytes. */
+	uint16_t	resp_len;
+	/* RX action control settings flags. */
+	uint8_t	rx_act_flags;
+	/*
+	 * A value of 1 in this field indicates that Global Flow ID
+	 * reporting into cfa_code and cfa_metadata is enabled.
+	 */
+	#define HWRM_TF_SESSION_QCFG_OUTPUT_RX_ACT_FLAGS_ABCR_GFID_EN \
+		UINT32_C(0x1)
+	/*
+	 * A value of 1 in this field indicates that both inner and outer
+	 * are stripped and inner tag is passed.
+	 * Enabled.
+	 */
+	#define HWRM_TF_SESSION_QCFG_OUTPUT_RX_ACT_FLAGS_ABCR_VTAG_DLT_BOTH \
+		UINT32_C(0x2)
+	/*
+	 * A value of 1 in this field indicates that the re-use of
+	 * existing tunnel L2 header SMAC is enabled for
+	 * Non-tunnel L2, L2-L3 and IP-IP tunnel.
+	 */
+	#define HWRM_TF_SESSION_QCFG_OUTPUT_RX_ACT_FLAGS_TECT_SMAC_OVR_RUTNSL2 \
+		UINT32_C(0x4)
+	/* TX Action control settings flags. */
+	uint8_t	tx_act_flags;
+	/* Disabled. */
+	#define HWRM_TF_SESSION_QCFG_OUTPUT_TX_ACT_FLAGS_ABCR_VEB_EN \
+		UINT32_C(0x1)
+	/*
+	 * When set to 1 any GRE tunnels will include the
+	 * optional Key field.
+	 */
+	#define HWRM_TF_SESSION_QCFG_OUTPUT_TX_ACT_FLAGS_TECT_GRE_SET_K \
+		UINT32_C(0x2)
+	/*
+	 * When set to 1, for GRE tunnels, the IPV6 Traffic Class (TC)
+	 * field of the outer header is inherited from the inner header
+	 * (if present) or the fixed value as taken from the encap
+	 * record.
+	 */
+	#define HWRM_TF_SESSION_QCFG_OUTPUT_TX_ACT_FLAGS_TECT_IPV6_TC_IH \
+		UINT32_C(0x4)
+	/*
+	 * When set to 1, for GRE tunnels, the IPV4 Type Of Service (TOS)
+	 * field of the outer header is inherited from the inner header
+	 * (if present) or the fixed value as taken from the encap record.
+	 */
+	#define HWRM_TF_SESSION_QCFG_OUTPUT_TX_ACT_FLAGS_TECT_IPV4_TOS_IH \
+		UINT32_C(0x8)
+	/* unused. */
+	uint8_t	unused0[5];
+	/*
+	 * This field is used in Output records to indicate that the output
+	 * is completely written to RAM. This field should be read as '1'
+	 * to indicate that the output has been completely written.
+	 * When writing a command completion or response to an internal
+	 * processor, the order of writes has to be such that this field
+	 * is written last.
+	 */
+	uint8_t	valid;
+} __attribute__((packed));
+
+/******************************
+ * hwrm_tf_session_resc_qcaps *
+ ******************************/
+
+
+/* hwrm_tf_session_resc_qcaps_input (size:256b/32B) */
+struct hwrm_tf_session_resc_qcaps_input {
+	/* The HWRM command request type. */
+	uint16_t	req_type;
+	/*
+	 * The completion ring to send the completion event on. This should
+	 * be the NQ ID returned from the `nq_alloc` HWRM command.
+	 */
+	uint16_t	cmpl_ring;
+	/*
+	 * The sequence ID is used by the driver for tracking multiple
+	 * commands. This ID is treated as opaque data by the firmware and
+	 * the value is returned in the `hwrm_resp_hdr` upon completion.
+	 */
+	uint16_t	seq_id;
+	/*
+	 * The target ID of the command:
+	 * * 0x0-0xFFF8 - The function ID
+	 * * 0xFFF8-0xFFFC, 0xFFFE - Reserved for internal processors
+	 * * 0xFFFD - Reserved for user-space HWRM interface
+	 * * 0xFFFF - HWRM
+	 */
+	uint16_t	target_id;
+	/*
+	 * A physical address pointer pointing to a host buffer that the
+	 * command's response data will be written. This can be either a host
+	 * physical address (HPA) or a guest physical address (GPA) and must
+	 * point to a physically contiguous block of memory.
+	 */
+	uint64_t	resp_addr;
+	/* Firmware session id returned when HWRM_TF_SESSION_OPEN is sent. */
+	uint32_t	fw_session_id;
+	/* Control flags. */
+	uint16_t	flags;
+	/* Indicates the flow direction. */
+	#define HWRM_TF_SESSION_RESC_QCAPS_INPUT_FLAGS_DIR     UINT32_C(0x1)
+	/* If this bit set to 0, then it indicates rx flow. */
+	#define HWRM_TF_SESSION_RESC_QCAPS_INPUT_FLAGS_DIR_RX    UINT32_C(0x0)
+	/* If this bit is set to 1, then it indicates that tx flow. */
+	#define HWRM_TF_SESSION_RESC_QCAPS_INPUT_FLAGS_DIR_TX    UINT32_C(0x1)
+	#define HWRM_TF_SESSION_RESC_QCAPS_INPUT_FLAGS_DIR_LAST \
+		HWRM_TF_SESSION_RESC_QCAPS_INPUT_FLAGS_DIR_TX
+	/*
+	 * Defines the size, in bytes, of the provided qcaps_addr
+	 * buffer. The size should be set to the Resource Manager
+	 * provided max qcaps value that is device specific. This is
+	 * the max size possible.
+	 */
+	uint16_t	size;
+	/*
+	 * This is the DMA address for the qcaps output data
+	 * array. Array is of tf_rm_cap type and is device specific.
+	 */
+	uint64_t	qcaps_addr;
+} __attribute__((packed));
+
+/* hwrm_tf_session_resc_qcaps_output (size:192b/24B) */
+struct hwrm_tf_session_resc_qcaps_output {
+	/* The specific error status for the command. */
+	uint16_t	error_code;
+	/* The HWRM command request type. */
+	uint16_t	req_type;
+	/* The sequence ID from the original command. */
+	uint16_t	seq_id;
+	/* The length of the response data in number of bytes. */
+	uint16_t	resp_len;
+	/* Control flags. */
+	uint32_t	flags;
+	/* Session reservation strategy. */
+	#define HWRM_TF_SESSION_RESC_QCAPS_OUTPUT_FLAGS_SESS_RES_STRATEGY_MASK \
+		UINT32_C(0x3)
+	#define HWRM_TF_SESSION_RESC_QCAPS_OUTPUT_FLAGS_SESS_RES_STRATEGY_SFT \
+		0
+	/* Static partitioning. */
+	#define HWRM_TF_SESSION_RESC_QCAPS_OUTPUT_FLAGS_SESS_RES_STRATEGY_STATIC \
+		UINT32_C(0x0)
+	/* Strategy 1. */
+	#define HWRM_TF_SESSION_RESC_QCAPS_OUTPUT_FLAGS_SESS_RES_STRATEGY_1 \
+		UINT32_C(0x1)
+	/* Strategy 2. */
+	#define HWRM_TF_SESSION_RESC_QCAPS_OUTPUT_FLAGS_SESS_RES_STRATEGY_2 \
+		UINT32_C(0x2)
+	/* Strategy 3. */
+	#define HWRM_TF_SESSION_RESC_QCAPS_OUTPUT_FLAGS_SESS_RES_STRATEGY_3 \
+		UINT32_C(0x3)
+	#define HWRM_TF_SESSION_RESC_QCAPS_OUTPUT_FLAGS_SESS_RES_STRATEGY_LAST \
+		HWRM_TF_SESSION_RESC_QCAPS_OUTPUT_FLAGS_SESS_RES_STRATEGY_3
+	/*
+	 * Size of the returned tf_rm_cap data array. The value
+	 * cannot exceed the size defined by the input msg. The data
+	 * array is returned using the qcaps_addr specified DMA
+	 * address also provided by the input msg.
+	 */
+	uint16_t	size;
+	/* unused. */
+	uint16_t	unused0;
+	/* unused. */
+	uint8_t	unused1[7];
+	/*
+	 * This field is used in Output records to indicate that the output
+	 * is completely written to RAM. This field should be read as '1'
+	 * to indicate that the output has been completely written.
+	 * When writing a command completion or response to an internal
+	 * processor, the order of writes has to be such that this field is
+	 * written last.
+	 */
+	uint8_t	valid;
+} __attribute__((packed));
+
+/******************************
+ * hwrm_tf_session_resc_alloc *
+ ******************************/
+
+
+/* hwrm_tf_session_resc_alloc_input (size:256b/32B) */
+struct hwrm_tf_session_resc_alloc_input {
+	/* The HWRM command request type. */
+	uint16_t	req_type;
+	/*
+	 * The completion ring to send the completion event on. This should
+	 * be the NQ ID returned from the `nq_alloc` HWRM command.
+	 */
+	uint16_t	cmpl_ring;
+	/*
+	 * The sequence ID is used by the driver for tracking multiple
+	 * commands. This ID is treated as opaque data by the firmware and
+	 * the value is returned in the `hwrm_resp_hdr` upon completion.
+	 */
+	uint16_t	seq_id;
+	/*
+	 * The target ID of the command:
+	 * * 0x0-0xFFF8 - The function ID
+	 * * 0xFFF8-0xFFFC, 0xFFFE - Reserved for internal processors
+	 * * 0xFFFD - Reserved for user-space HWRM interface
+	 * * 0xFFFF - HWRM
+	 */
+	uint16_t	target_id;
+	/*
+	 * A physical address pointer pointing to a host buffer that the
+	 * command's response data will be written. This can be either a host
+	 * physical address (HPA) or a guest physical address (GPA) and must
+	 * point to a physically contiguous block of memory.
+	 */
+	uint64_t	resp_addr;
+	/* Firmware session id returned when HWRM_TF_SESSION_OPEN is sent. */
+	uint32_t	fw_session_id;
+	/* Control flags. */
+	uint16_t	flags;
+	/* Indicates the flow direction. */
+	#define HWRM_TF_SESSION_RESC_ALLOC_INPUT_FLAGS_DIR     UINT32_C(0x1)
+	/* If this bit set to 0, then it indicates rx flow. */
+	#define HWRM_TF_SESSION_RESC_ALLOC_INPUT_FLAGS_DIR_RX    UINT32_C(0x0)
+	/* If this bit is set to 1, then it indicates that tx flow. */
+	#define HWRM_TF_SESSION_RESC_ALLOC_INPUT_FLAGS_DIR_TX    UINT32_C(0x1)
+	#define HWRM_TF_SESSION_RESC_ALLOC_INPUT_FLAGS_DIR_LAST \
+		HWRM_TF_SESSION_RESC_ALLOC_INPUT_FLAGS_DIR_TX
+	/*
+	 * Defines the size, in bytes, of the provided num_addr
+	 * buffer.
+	 */
+	uint16_t	size;
+	/*
+	 * This is the DMA address for the num input data array
+	 * buffer. Array is of tf_rm_num type. Size of the buffer is
+	 * provided by the 'size' field in this message.
+	 */
+	uint64_t	num_addr;
+} __attribute__((packed));
+
+/* hwrm_tf_session_resc_alloc_output (size:128b/16B) */
+struct hwrm_tf_session_resc_alloc_output {
+	/* The specific error status for the command. */
+	uint16_t	error_code;
+	/* The HWRM command request type. */
+	uint16_t	req_type;
+	/* The sequence ID from the original command. */
+	uint16_t	seq_id;
+	/* The length of the response data in number of bytes. */
+	uint16_t	resp_len;
+	/* unused. */
+	uint8_t	unused0[7];
+	/*
+	 * This field is used in Output records to indicate that the output
+	 * is completely written to RAM. This field should be read as '1'
+	 * to indicate that the output has been completely written.
+	 * When writing a command completion or response to an internal
+	 * processor, the order of writes has to be such that this field is
+	 * written last.
+	 */
+	uint8_t	valid;
+} __attribute__((packed));
+
+/*****************************
+ * hwrm_tf_session_resc_free *
+ *****************************/
+
+
+/* hwrm_tf_session_resc_free_input (size:256b/32B) */
+struct hwrm_tf_session_resc_free_input {
+	/* The HWRM command request type. */
+	uint16_t	req_type;
+	/*
+	 * The completion ring to send the completion event on. This should
+	 * be the NQ ID returned from the `nq_alloc` HWRM command.
+	 */
+	uint16_t	cmpl_ring;
+	/*
+	 * The sequence ID is used by the driver for tracking multiple
+	 * commands. This ID is treated as opaque data by the firmware and
+	 * the value is returned in the `hwrm_resp_hdr` upon completion.
+	 */
+	uint16_t	seq_id;
+	/*
+	 * The target ID of the command:
+	 * * 0x0-0xFFF8 - The function ID
+	 * * 0xFFF8-0xFFFC, 0xFFFE - Reserved for internal processors
+	 * * 0xFFFD - Reserved for user-space HWRM interface
+	 * * 0xFFFF - HWRM
+	 */
+	uint16_t	target_id;
+	/*
+	 * A physical address pointer pointing to a host buffer that the
+	 * command's response data will be written. This can be either a host
+	 * physical address (HPA) or a guest physical address (GPA) and must
+	 * point to a physically contiguous block of memory.
+	 */
+	uint64_t	resp_addr;
+	/* Firmware session id returned when HWRM_TF_SESSION_OPEN is sent. */
+	uint32_t	fw_session_id;
+	/* Control flags. */
+	uint16_t	flags;
+	/* Indicates the flow direction. */
+	#define HWRM_TF_SESSION_RESC_FREE_INPUT_FLAGS_DIR     UINT32_C(0x1)
+	/* If this bit set to 0, then it indicates rx flow. */
+	#define HWRM_TF_SESSION_RESC_FREE_INPUT_FLAGS_DIR_RX    UINT32_C(0x0)
+	/* If this bit is set to 1, then it indicates that tx flow. */
+	#define HWRM_TF_SESSION_RESC_FREE_INPUT_FLAGS_DIR_TX    UINT32_C(0x1)
+	#define HWRM_TF_SESSION_RESC_FREE_INPUT_FLAGS_DIR_LAST \
+		HWRM_TF_SESSION_RESC_FREE_INPUT_FLAGS_DIR_TX
+	/*
+	 * Defines the size, in bytes, of the provided free_addr
+	 * buffer.
+	 */
+	uint16_t	size;
+	/*
+	 * This is the DMA address for the free input data array
+	 * buffer.  Array of tf_rm_res type. Size of the buffer is
+	 * provided by the 'size field of this message.
+	 */
+	uint64_t	free_addr;
+} __attribute__((packed));
+
+/* hwrm_tf_session_resc_free_output (size:128b/16B) */
+struct hwrm_tf_session_resc_free_output {
+	/* The specific error status for the command. */
+	uint16_t	error_code;
+	/* The HWRM command request type. */
+	uint16_t	req_type;
+	/* The sequence ID from the original command. */
+	uint16_t	seq_id;
+	/* The length of the response data in number of bytes. */
+	uint16_t	resp_len;
+	/* unused. */
+	uint8_t	unused0[7];
+	/*
+	 * This field is used in Output records to indicate that the output
+	 * is completely written to RAM. This field should be read as '1'
+	 * to indicate that the output has been completely written.
+	 * When writing a command completion or response to an internal
+	 * processor, the order of writes has to be such that this field is
+	 * written last.
+	 */
+	uint8_t	valid;
+} __attribute__((packed));
+
+/******************************
+ * hwrm_tf_session_resc_flush *
+ ******************************/
+
+
+/* hwrm_tf_session_resc_flush_input (size:256b/32B) */
+struct hwrm_tf_session_resc_flush_input {
+	/* The HWRM command request type. */
+	uint16_t	req_type;
+	/*
+	 * The completion ring to send the completion event on. This should
+	 * be the NQ ID returned from the `nq_alloc` HWRM command.
+	 */
+	uint16_t	cmpl_ring;
+	/*
+	 * The sequence ID is used by the driver for tracking multiple
+	 * commands. This ID is treated as opaque data by the firmware and
+	 * the value is returned in the `hwrm_resp_hdr` upon completion.
+	 */
+	uint16_t	seq_id;
+	/*
+	 * The target ID of the command:
+	 * * 0x0-0xFFF8 - The function ID
+	 * * 0xFFF8-0xFFFC, 0xFFFE - Reserved for internal processors
+	 * * 0xFFFD - Reserved for user-space HWRM interface
+	 * * 0xFFFF - HWRM
+	 */
+	uint16_t	target_id;
+	/*
+	 * A physical address pointer pointing to a host buffer that the
+	 * command's response data will be written. This can be either a host
+	 * physical address (HPA) or a guest physical address (GPA) and must
+	 * point to a physically contiguous block of memory.
+	 */
+	uint64_t	resp_addr;
+	/* Firmware session id returned when HWRM_TF_SESSION_OPEN is sent. */
+	uint32_t	fw_session_id;
+	/* Control flags. */
+	uint16_t	flags;
+	/* Indicates the flow direction. */
+	#define HWRM_TF_SESSION_RESC_FLUSH_INPUT_FLAGS_DIR     UINT32_C(0x1)
+	/* If this bit set to 0, then it indicates rx flow. */
+	#define HWRM_TF_SESSION_RESC_FLUSH_INPUT_FLAGS_DIR_RX    UINT32_C(0x0)
+	/* If this bit is set to 1, then it indicates that tx flow. */
+	#define HWRM_TF_SESSION_RESC_FLUSH_INPUT_FLAGS_DIR_TX    UINT32_C(0x1)
+	#define HWRM_TF_SESSION_RESC_FLUSH_INPUT_FLAGS_DIR_LAST \
+		HWRM_TF_SESSION_RESC_FLUSH_INPUT_FLAGS_DIR_TX
+	/*
+	 * Defines the size, in bytes, of the provided flush_addr
+	 * buffer.
+	 */
+	uint16_t	size;
+	/*
+	 * This is the DMA address for the flush input data array
+	 * buffer.  Array of tf_rm_res type. Size of the buffer is
+	 * provided by the 'size' field in this message.
+	 */
+	uint64_t	flush_addr;
+} __attribute__((packed));
+
+/* hwrm_tf_session_resc_flush_output (size:128b/16B) */
+struct hwrm_tf_session_resc_flush_output {
+	/* The specific error status for the command. */
+	uint16_t	error_code;
+	/* The HWRM command request type. */
+	uint16_t	req_type;
+	/* The sequence ID from the original command. */
+	uint16_t	seq_id;
+	/* The length of the response data in number of bytes. */
+	uint16_t	resp_len;
+	/* unused. */
+	uint8_t	unused0[7];
+	/*
+	 * This field is used in Output records to indicate that the output
+	 * is completely written to RAM. This field should be read as '1'
+	 * to indicate that the output has been completely written.
+	 * When writing a command completion or response to an internal
+	 * processor, the order of writes has to be such that this field is
+	 * written last.
+	 */
+	uint8_t	valid;
+} __attribute__((packed));
+
+/* TruFlow RM capability of a resource. */
+/* tf_rm_cap (size:64b/8B) */
+struct tf_rm_cap {
+	/*
+	 * Type of the resource, defined globally in the
+	 * hwrm_tf_resc_type enum.
+	 */
+	uint32_t	type;
+	/* Minimum value. */
+	uint16_t	min;
+	/* Maximum value. */
+	uint16_t	max;
+} __attribute__((packed));
+
+/* TruFlow RM number of a resource. */
+/* tf_rm_num (size:64b/8B) */
+struct tf_rm_num {
+	/*
+	 * Type of the resource, defined globally in the
+	 * hwrm_tf_resc_type enum.
+	 */
+	uint32_t	type;
+	/* Number of resources. */
+	uint32_t	num;
+} __attribute__((packed));
+
+/* TruFlow RM reservation information. */
+/* tf_rm_res (size:64b/8B) */
+struct tf_rm_res {
+	/*
+	 * Type of the resource, defined globally in the
+	 * hwrm_tf_resc_type enum.
+	 */
+	uint32_t	type;
+	/* Start offset. */
+	uint16_t	start;
+	/* Number of resources. */
+	uint16_t	stride;
+} __attribute__((packed));
+
+/************************
+ * hwrm_tf_tbl_type_get *
+ ************************/
+
+
+/* hwrm_tf_tbl_type_get_input (size:256b/32B) */
+struct hwrm_tf_tbl_type_get_input {
+	/* The HWRM command request type. */
+	uint16_t	req_type;
+	/*
+	 * The completion ring to send the completion event on. This should
+	 * be the NQ ID returned from the `nq_alloc` HWRM command.
+	 */
+	uint16_t	cmpl_ring;
+	/*
+	 * The sequence ID is used by the driver for tracking multiple
+	 * commands. This ID is treated as opaque data by the firmware and
+	 * the value is returned in the `hwrm_resp_hdr` upon completion.
+	 */
+	uint16_t	seq_id;
+	/*
+	 * The target ID of the command:
+	 * * 0x0-0xFFF8 - The function ID
+	 * * 0xFFF8-0xFFFC, 0xFFFE - Reserved for internal processors
+	 * * 0xFFFD - Reserved for user-space HWRM interface
+	 * * 0xFFFF - HWRM
+	 */
+	uint16_t	target_id;
+	/*
+	 * A physical address pointer pointing to a host buffer that the
+	 * command's response data will be written. This can be either a host
+	 * physical address (HPA) or a guest physical address (GPA) and must
+	 * point to a physically contiguous block of memory.
+	 */
+	uint64_t	resp_addr;
+	/* Firmware session id returned when HWRM_TF_SESSION_OPEN is sent. */
+	uint32_t	fw_session_id;
+	/* Control flags. */
+	uint16_t	flags;
+	/* Indicates the flow direction. */
+	#define HWRM_TF_TBL_TYPE_GET_INPUT_FLAGS_DIR     UINT32_C(0x1)
+	/* If this bit set to 0, then it indicates rx flow. */
+	#define HWRM_TF_TBL_TYPE_GET_INPUT_FLAGS_DIR_RX    UINT32_C(0x0)
+	/* If this bit is set to 1, then it indicates that tx flow. */
+	#define HWRM_TF_TBL_TYPE_GET_INPUT_FLAGS_DIR_TX    UINT32_C(0x1)
+	#define HWRM_TF_TBL_TYPE_GET_INPUT_FLAGS_DIR_LAST \
+		HWRM_TF_TBL_TYPE_GET_INPUT_FLAGS_DIR_TX
+	/* unused. */
+	uint8_t	unused0[2];
+	/*
+	 * Type of the resource, defined globally in the
+	 * hwrm_tf_resc_type enum.
+	 */
+	uint32_t	type;
+	/* Index of the type to retrieve. */
+	uint32_t	index;
+} __attribute__((packed));
+
+/* hwrm_tf_tbl_type_get_output (size:1216b/152B) */
+struct hwrm_tf_tbl_type_get_output {
+	/* The specific error status for the command. */
+	uint16_t	error_code;
+	/* The HWRM command request type. */
+	uint16_t	req_type;
+	/* The sequence ID from the original command. */
+	uint16_t	seq_id;
+	/* The length of the response data in number of bytes. */
+	uint16_t	resp_len;
+	/* Response code. */
+	uint32_t	resp_code;
+	/* Response size. */
+	uint16_t	size;
+	/* unused */
+	uint16_t	unused0;
+	/* Response data. */
+	uint8_t	data[128];
+	/* unused */
+	uint8_t	unused1[7];
+	/*
+	 * This field is used in Output records to indicate that the output
+	 * is completely written to RAM. This field should be read as '1'
+	 * to indicate that the output has been completely written.
+	 * When writing a command completion or response to an internal
+	 * processor, the order of writes has to be such that this field
+	 * is written last.
+	 */
+	uint8_t	valid;
+} __attribute__((packed));
+
+/************************
+ * hwrm_tf_tbl_type_set *
+ ************************/
+
+
+/* hwrm_tf_tbl_type_set_input (size:1024b/128B) */
+struct hwrm_tf_tbl_type_set_input {
+	/* The HWRM command request type. */
+	uint16_t	req_type;
+	/*
+	 * The completion ring to send the completion event on. This should
+	 * be the NQ ID returned from the `nq_alloc` HWRM command.
+	 */
+	uint16_t	cmpl_ring;
+	/*
+	 * The sequence ID is used by the driver for tracking multiple
+	 * commands. This ID is treated as opaque data by the firmware and
+	 * the value is returned in the `hwrm_resp_hdr` upon completion.
+	 */
+	uint16_t	seq_id;
+	/*
+	 * The target ID of the command:
+	 * * 0x0-0xFFF8 - The function ID
+	 * * 0xFFF8-0xFFFC, 0xFFFE - Reserved for internal processors
+	 * * 0xFFFD - Reserved for user-space HWRM interface
+	 * * 0xFFFF - HWRM
+	 */
+	uint16_t	target_id;
+	/*
+	 * A physical address pointer pointing to a host buffer that the
+	 * command's response data will be written. This can be either a host
+	 * physical address (HPA) or a guest physical address (GPA) and must
+	 * point to a physically contiguous block of memory.
+	 */
+	uint64_t	resp_addr;
+	/* Firmware session id returned when HWRM_TF_SESSION_OPEN is sent. */
+	uint32_t	fw_session_id;
+	/* Control flags. */
+	uint16_t	flags;
+	/* Indicates the flow direction. */
+	#define HWRM_TF_TBL_TYPE_SET_INPUT_FLAGS_DIR     UINT32_C(0x1)
+	/* If this bit set to 0, then it indicates rx flow. */
+	#define HWRM_TF_TBL_TYPE_SET_INPUT_FLAGS_DIR_RX    UINT32_C(0x0)
+	/* If this bit is set to 1, then it indicates that tx flow. */
+	#define HWRM_TF_TBL_TYPE_SET_INPUT_FLAGS_DIR_TX    UINT32_C(0x1)
+	#define HWRM_TF_TBL_TYPE_SET_INPUT_FLAGS_DIR_LAST \
+		HWRM_TF_TBL_TYPE_SET_INPUT_FLAGS_DIR_TX
+	/* unused. */
+	uint8_t	unused0[2];
+	/*
+	 * Type of the resource, defined globally in the
+	 * hwrm_tf_resc_type enum.
+	 */
+	uint32_t	type;
+	/* Index of the type to retrieve. */
+	uint32_t	index;
+	/* Size of the data to set. */
+	uint16_t	size;
+	/* unused */
+	uint8_t	unused1[6];
+	/* Data to be set. */
+	uint8_t	data[88];
+} __attribute__((packed));
+
+/* hwrm_tf_tbl_type_set_output (size:128b/16B) */
+struct hwrm_tf_tbl_type_set_output {
+	/* The specific error status for the command. */
+	uint16_t	error_code;
+	/* The HWRM command request type. */
+	uint16_t	req_type;
+	/* The sequence ID from the original command. */
+	uint16_t	seq_id;
+	/* The length of the response data in number of bytes. */
+	uint16_t	resp_len;
+	/* unused. */
+	uint8_t	unused0[7];
+	/*
+	 * This field is used in Output records to indicate that the output
+	 * is completely written to RAM. This field should be read as '1'
+	 * to indicate that the output has been completely written.
+	 * When writing a command completion or response to an internal
+	 * processor, the order of writes has to be such that this field
+	 * is written last.
+	 */
+	uint8_t	valid;
+} __attribute__((packed));
+
+/*************************
+ * hwrm_tf_ctxt_mem_rgtr *
+ *************************/
+
+
+/* hwrm_tf_ctxt_mem_rgtr_input (size:256b/32B) */
+struct hwrm_tf_ctxt_mem_rgtr_input {
+	/* The HWRM command request type. */
+	uint16_t	req_type;
+	/*
+	 * The completion ring to send the completion event on. This should
+	 * be the NQ ID returned from the `nq_alloc` HWRM command.
+	 */
+	uint16_t	cmpl_ring;
+	/*
+	 * The sequence ID is used by the driver for tracking multiple
+	 * commands. This ID is treated as opaque data by the firmware and
+	 * the value is returned in the `hwrm_resp_hdr` upon completion.
+	 */
+	uint16_t	seq_id;
+	/*
+	 * The target ID of the command:
+	 * * 0x0-0xFFF8 - The function ID
+	 * * 0xFFF8-0xFFFC, 0xFFFE - Reserved for internal processors
+	 * * 0xFFFD - Reserved for user-space HWRM interface
+	 * * 0xFFFF - HWRM
+	 */
+	uint16_t	target_id;
+	/*
+	 * A physical address pointer pointing to a host buffer that the
+	 * command's response data will be written. This can be either a host
+	 * physical address (HPA) or a guest physical address (GPA) and must
+	 * point to a physically contiguous block of memory.
+	 */
+	uint64_t	resp_addr;
+	/* Control flags. */
+	uint16_t	flags;
+	/* Counter PBL indirect levels. */
+	uint8_t	page_level;
+	/* PBL pointer is physical start address. */
+	#define HWRM_TF_CTXT_MEM_RGTR_INPUT_PAGE_LEVEL_LVL_0 UINT32_C(0x0)
+	/* PBL pointer points to PTE table. */
+	#define HWRM_TF_CTXT_MEM_RGTR_INPUT_PAGE_LEVEL_LVL_1 UINT32_C(0x1)
+	/*
+	 * PBL pointer points to PDE table with each entry pointing
+	 * to PTE tables.
+	 */
+	#define HWRM_TF_CTXT_MEM_RGTR_INPUT_PAGE_LEVEL_LVL_2 UINT32_C(0x2)
+	#define HWRM_TF_CTXT_MEM_RGTR_INPUT_PAGE_LEVEL_LAST \
+		HWRM_TF_CTXT_MEM_RGTR_INPUT_PAGE_LEVEL_LVL_2
+	/* Page size. */
+	uint8_t	page_size;
+	/* 4KB page size. */
+	#define HWRM_TF_CTXT_MEM_RGTR_INPUT_PAGE_SIZE_4K   UINT32_C(0x0)
+	/* 8KB page size. */
+	#define HWRM_TF_CTXT_MEM_RGTR_INPUT_PAGE_SIZE_8K   UINT32_C(0x1)
+	/* 64KB page size. */
+	#define HWRM_TF_CTXT_MEM_RGTR_INPUT_PAGE_SIZE_64K  UINT32_C(0x4)
+	/* 256KB page size. */
+	#define HWRM_TF_CTXT_MEM_RGTR_INPUT_PAGE_SIZE_256K UINT32_C(0x6)
+	/* 1MB page size. */
+	#define HWRM_TF_CTXT_MEM_RGTR_INPUT_PAGE_SIZE_1M   UINT32_C(0x8)
+	/* 2MB page size. */
+	#define HWRM_TF_CTXT_MEM_RGTR_INPUT_PAGE_SIZE_2M   UINT32_C(0x9)
+	/* 4MB page size. */
+	#define HWRM_TF_CTXT_MEM_RGTR_INPUT_PAGE_SIZE_4M   UINT32_C(0xa)
+	/* 1GB page size. */
+	#define HWRM_TF_CTXT_MEM_RGTR_INPUT_PAGE_SIZE_1G   UINT32_C(0x12)
+	#define HWRM_TF_CTXT_MEM_RGTR_INPUT_PAGE_SIZE_LAST \
+		HWRM_TF_CTXT_MEM_RGTR_INPUT_PAGE_SIZE_1G
+	/* unused. */
+	uint32_t	unused0;
+	/* Pointer to the PBL, or PDL depending on number of levels */
+	uint64_t	page_dir;
+} __attribute__((packed));
+
+/* hwrm_tf_ctxt_mem_rgtr_output (size:128b/16B) */
+struct hwrm_tf_ctxt_mem_rgtr_output {
+	/* The specific error status for the command. */
+	uint16_t	error_code;
+	/* The HWRM command request type. */
+	uint16_t	req_type;
+	/* The sequence ID from the original command. */
[… more lines in the raw message]

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

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

Signature · 1 line
2.7.4

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

#108 lore raw

PATCH v4 2/34 net/bnxt: update hwrm prep to use ptr

In reply to Venkat Duvvuru

From: Randy Schacher <[email protected]>

- Change HWRM_PREP to use pointer and use the full HWRM enum

---
 drivers/net/bnxt/bnxt.h      |   2 +-
 drivers/net/bnxt/bnxt_hwrm.c | 202 ++++++++++++++++++++++---------------------
 2 files changed, 103 insertions(+), 101 deletions(-)
drivers/net/bnxt/bnxt.h +1 -1
index 3ae08a2..b795ed6 100644
@@ -594,7 +594,7 @@ struct bnxt {
 
 	uint8_t			mac_addr[RTE_ETHER_ADDR_LEN];
 
-	uint16_t			hwrm_cmd_seq;
+	uint16_t			chimp_cmd_seq;
 	uint16_t			kong_cmd_seq;
 	void				*hwrm_cmd_resp_addr;
 	rte_iova_t			hwrm_cmd_resp_dma_addr;
drivers/net/bnxt/bnxt_hwrm.c +102 -100

772 lines not on this page · raw message

Signature · 1 line
2.7.4
#109 lore raw

PATCH v4 3/34 net/bnxt: add truflow message handlers

In reply to Venkat Duvvuru

From: Pete Spreadborough <[email protected]>

- Add bnxt message functions for truflow APIs

---
 drivers/net/bnxt/bnxt_hwrm.c | 83 ++++++++++++++++++++++++++++++++++++++++++++
 drivers/net/bnxt/bnxt_hwrm.h | 18 ++++++++++
 2 files changed, 101 insertions(+)
drivers/net/bnxt/bnxt_hwrm.c +83 -0
index 93b2ea7..443553b 100644
@@ -257,6 +257,89 @@ static int bnxt_hwrm_send_message(struct bnxt *bp, void *msg,
 
 #define HWRM_UNLOCK()		rte_spinlock_unlock(&bp->hwrm_lock)
 
+int bnxt_hwrm_tf_message_direct(struct bnxt *bp,
+				bool use_kong_mb,
+				uint16_t msg_type,
+				void *msg,
+				uint32_t msg_len,
+				void *resp_msg,
+				uint32_t resp_len)
+{
+	int rc = 0;
+	bool mailbox = BNXT_USE_CHIMP_MB;
+	struct input *req = msg;
+	struct output *resp = bp->hwrm_cmd_resp_addr;
+
+	if (use_kong_mb)
+		mailbox = BNXT_USE_KONG(bp);
+
+	HWRM_PREP(req, msg_type, mailbox);
+
+	rc = bnxt_hwrm_send_message(bp, req, msg_len, mailbox);
+
+	HWRM_CHECK_RESULT();
+
+	if (resp_msg)
+		memcpy(resp_msg, resp, resp_len);
+
+	HWRM_UNLOCK();
+
+	return rc;
+}
+
+int bnxt_hwrm_tf_message_tunneled(struct bnxt *bp,
+				  bool use_kong_mb,
+				  uint16_t tf_type,
+				  uint16_t tf_subtype,
+				  uint32_t *tf_response_code,
+				  void *msg,
+				  uint32_t msg_len,
+				  void *response,
+				  uint32_t response_len)
+{
+	int rc = 0;
+	struct hwrm_cfa_tflib_input req = { .req_type = 0 };
+	struct hwrm_cfa_tflib_output *resp = bp->hwrm_cmd_resp_addr;
+	bool mailbox = BNXT_USE_CHIMP_MB;
+
+	if (msg_len > sizeof(req.tf_req))
+		return -ENOMEM;
+
+	if (use_kong_mb)
+		mailbox = BNXT_USE_KONG(bp);
+
+	HWRM_PREP(&req, HWRM_TF, mailbox);
+	/* Build request using the user supplied request payload.
+	 * TLV request size is checked at build time against HWRM
+	 * request max size, thus no checking required.
+	 */
+	req.tf_type = tf_type;
+	req.tf_subtype = tf_subtype;
+	memcpy(req.tf_req, msg, msg_len);
+
+	rc = bnxt_hwrm_send_message(bp, &req, sizeof(req), mailbox);
+	HWRM_CHECK_RESULT();
+
+	/* Copy the resp to user provided response buffer */
+	if (response != NULL)
+		/* Post process response data. We need to copy only
+		 * the 'payload' as the HWRM data structure really is
+		 * HWRM header + msg header + payload and the TFLIB
+		 * only provided a payload place holder.
+		 */
+		if (response_len != 0) {
+			memcpy(response,
+			       resp->tf_resp,
+			       response_len);
+		}
+
+	/* Extract the internal tflib response code */
+	*tf_response_code = resp->tf_resp_code;
+	HWRM_UNLOCK();
+
+	return rc;
+}
+
 int bnxt_hwrm_cfa_l2_clear_rx_mask(struct bnxt *bp, struct bnxt_vnic_info *vnic)
 {
 	int rc = 0;
drivers/net/bnxt/bnxt_hwrm.h +18 -0
index 5eb2ee8..df7aa74 100644
@@ -69,6 +69,24 @@ HWRM_CFA_ADV_FLOW_MGNT_QCAPS_OUTPUT_FLAGS_L2_HEADER_SOURCE_FIELDS_SUPPORTED
 	bp->rx_cos_queue[x].profile =	\
 		resp->queue_id##x##_service_profile
 
+int bnxt_hwrm_tf_message_tunneled(struct bnxt *bp,
+				  bool use_kong_mb,
+				  uint16_t tf_type,
+				  uint16_t tf_subtype,
+				  uint32_t *tf_response_code,
+				  void *msg,
+				  uint32_t msg_len,
+				  void *response,
+				  uint32_t response_len);
+
+int bnxt_hwrm_tf_message_direct(struct bnxt *bp,
+				bool use_kong_mb,
+				uint16_t msg_type,
+				void *msg,
+				uint32_t msg_len,
+				void *resp_msg,
+				uint32_t resp_len);
+
 int bnxt_hwrm_cfa_l2_clear_rx_mask(struct bnxt *bp,
 				   struct bnxt_vnic_info *vnic);
 int bnxt_hwrm_cfa_l2_set_rx_mask(struct bnxt *bp, struct bnxt_vnic_info *vnic,
Signature · 1 line
2.7.4
#110 lore raw

PATCH v4 4/34 net/bnxt: add initial tf core session open

In reply to Venkat Duvvuru

From: Michael Wildt <[email protected]>

- Add infrastructure support
- Add tf_core open session support

---
 drivers/net/bnxt/Makefile                |   8 +
 drivers/net/bnxt/bnxt.h                  |   4 +
 drivers/net/bnxt/tf_core/hwrm_tf.h       | 971 +++++++++++++++++++++++++++++++
 drivers/net/bnxt/tf_core/tf_core.c       | 145 +++++
 drivers/net/bnxt/tf_core/tf_core.h       | 347 +++++++++++
 drivers/net/bnxt/tf_core/tf_msg.c        |  79 +++
 drivers/net/bnxt/tf_core/tf_msg.h        |  44 ++
 drivers/net/bnxt/tf_core/tf_msg_common.h |  47 ++
 drivers/net/bnxt/tf_core/tf_project.h    |  24 +
 drivers/net/bnxt/tf_core/tf_resources.h  |  46 ++
 drivers/net/bnxt/tf_core/tf_rm.h         |  33 ++
 drivers/net/bnxt/tf_core/tf_session.h    |  85 +++
 drivers/net/bnxt/tf_core/tfp.c           | 163 ++++++
 drivers/net/bnxt/tf_core/tfp.h           | 188 ++++++
 14 files changed, 2184 insertions(+)
 create mode 100644 drivers/net/bnxt/tf_core/hwrm_tf.h
 create mode 100644 drivers/net/bnxt/tf_core/tf_core.c
 create mode 100644 drivers/net/bnxt/tf_core/tf_core.h
 create mode 100644 drivers/net/bnxt/tf_core/tf_msg.c
 create mode 100644 drivers/net/bnxt/tf_core/tf_msg.h
 create mode 100644 drivers/net/bnxt/tf_core/tf_msg_common.h
 create mode 100644 drivers/net/bnxt/tf_core/tf_project.h
 create mode 100644 drivers/net/bnxt/tf_core/tf_resources.h
 create mode 100644 drivers/net/bnxt/tf_core/tf_rm.h
 create mode 100644 drivers/net/bnxt/tf_core/tf_session.h
 create mode 100644 drivers/net/bnxt/tf_core/tfp.c
 create mode 100644 drivers/net/bnxt/tf_core/tfp.h
drivers/net/bnxt/Makefile +8 -0
index b77532b..8a68059 100644
@@ -43,6 +43,14 @@ ifeq ($(CONFIG_RTE_ARCH_X86), y)
 SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += bnxt_rxtx_vec_sse.c
 endif
 
+ifeq ($(CONFIG_RTE_LIBRTE_BNXT_PMD), y)
+CFLAGS += -I$(SRCDIR) -I$(SRCDIR)/tf_core
+endif
+
+SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += tf_core/tf_core.c
+SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += tf_core/tf_msg.c
+SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += tf_core/tfp.c
+
 #
 # Export include files
 #
drivers/net/bnxt/bnxt.h +4 -0
index b795ed6..a8e57ca 100644
@@ -21,6 +21,8 @@
 #include "bnxt_cpr.h"
 #include "bnxt_util.h"
 
+#include "tf_core.h"
+
 /* Vendor ID */
 #define PCI_VENDOR_ID_BROADCOM		0x14E4
 
@@ -679,6 +681,8 @@ struct bnxt {
 /* TCAM and EM should be 16-bit only. Other modes not supported. */
 #define BNXT_FLOW_ID_MASK	0x0000ffff
 	struct bnxt_mark_info	*mark_table;
+
+	struct tf               tfp;
 };
 
 int bnxt_mtu_set_op(struct rte_eth_dev *eth_dev, uint16_t new_mtu);
drivers/net/bnxt/tf_core/hwrm_tf.h new file +971 -0

971 lines not on this page · raw message

drivers/net/bnxt/tf_core/tf_core.c new file +145 -0

145 lines not on this page · raw message

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

347 lines not on this page · raw message

drivers/net/bnxt/tf_core/tf_msg.c new file +79 -0

79 lines not on this page · raw message

drivers/net/bnxt/tf_core/tf_msg.h new file +44 -0

44 lines not on this page · raw message

drivers/net/bnxt/tf_core/tf_msg_common.h new file +47 -0

47 lines not on this page · raw message

drivers/net/bnxt/tf_core/tf_project.h new file +24 -0
new file mode 100644
index 0000000..ab5f113
@@ -0,0 +1,24 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2019-2020 Broadcom
+ * All rights reserved.
+ */
+
+#ifndef _TF_PROJECT_H_
+#define _TF_PROJECT_H_
+
+/* Wh+ support enabled */
+#ifndef TF_SUPPORT_P4
+#define TF_SUPPORT_P4 1
+#endif
+
+/* Shadow DB Support */
+#ifndef TF_SHADOW
+#define TF_SHADOW 0
+#endif
+
+/* Shared memory for session */
+#ifndef TF_SHARED
+#define TF_SHARED 0
+#endif
+
+#endif /* _TF_PROJECT_H_ */
drivers/net/bnxt/tf_core/tf_resources.h new file +46 -0

46 lines not on this page · raw message

drivers/net/bnxt/tf_core/tf_rm.h new file +33 -0
new file mode 100644
index 0000000..5164d6b
@@ -0,0 +1,33 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2019-2020 Broadcom
+ * All rights reserved.
+ */
+
+#ifndef TF_RM_H_
+#define TF_RM_H_
+
+#include "tf_resources.h"
+#include "tf_core.h"
+
+struct tf;
+struct tf_session;
+
+/**
+ * Resource query single entry
+ */
+struct tf_rm_query_entry {
+	/** Minimum guaranteed number of elements */
+	uint16_t min;
+	/** Maximum non-guaranteed number of elements */
+	uint16_t max;
+};
+
+/**
+ * Resource query array of HW entities
+ */
+struct tf_rm_hw_query {
+	/** array of HW resource entries */
+	struct tf_rm_query_entry hw_query[TF_RESC_TYPE_HW_MAX];
+};
+
+#endif /* TF_RM_H_ */
drivers/net/bnxt/tf_core/tf_session.h new file +85 -0

85 lines not on this page · raw message

drivers/net/bnxt/tf_core/tfp.c new file +163 -0

163 lines not on this page · raw message

drivers/net/bnxt/tf_core/tfp.h new file +188 -0

188 lines not on this page · raw message

Signature · 1 line
2.7.4
#111 lore raw

Re: [dpdk-dev] [PATCH v4 04/34] net/bnxt: add initial tf core session open

Quoted 9 lines · Venkat Duvvuru

From: Michael Wildt <[email protected]>

- Add infrastructure support
- Add tf_core open session support

<...>

Quoted 6 lines
drivers/net/bnxt/tf_core/tfp.c new file +6 -0
+int
+tfp_calloc(struct tfp_calloc_parms *parms)
+{
+	if (parms == NULL)
+		return -EINVAL;
+

drivers/net/bnxt/tf_core/tfp.c line 110

Quoted 10 lines
drivers/net/bnxt/tf_core/tfp.c new file +10 -0
+	parms->mem_va = rte_zmalloc("tf",
+				    (parms->nitems * parms->size),
+				    parms->alignment);
+	if (parms->mem_va == NULL) {
+		PMD_DRV_LOG(ERR, "Allocate failed mem_va\n");
+		return -ENOMEM;
+	}
+
+	parms->mem_pa = (void *)((uintptr_t)rte_mem_virt2iova(parms->mem_va));
+	if (parms->mem_pa == (void *)RTE_BAD_IOVA) {

This is causing a warning for 32bit icc [1], becuase 64-bit value converted to 32-bit pointer. Can you do the same casting that has been done in one line above, like [2].

[1]
.../drivers/net/bnxt/tf_core/tfp.c(110): warning #2259: non-pointer conversion from "rte_iova_t={uint64_t={__uint64_t={unsigned long long}}}" to "void *" may lose significant bits

        if (parms->mem_pa == (void *)RTE_BAD_IOVA) {
                             ^

[2]
- if (parms->mem_pa == (void *)RTE_BAD_IOVA) {
+ if (parms->mem_pa == (void *)((uintptr_t)RTE_BAD_IOVA)) {

#112 lore raw

Re: [dpdk-dev] [PATCH v4 04/34] net/bnxt: add initial tf core session open

Quoted 42 lines · Ferruh Yigit
Quoted 9 lines · Venkat Duvvuru

From: Michael Wildt <[email protected]>

- Add infrastructure support
- Add tf_core open session support

<...>

Quoted 5 lines
drivers/net/bnxt/tf_core/tfp.c new file +5 -0
+int
+tfp_calloc(struct tfp_calloc_parms *parms)
+{
+     if (parms == NULL)
+             return -EINVAL;

drivers/net/bnxt/tf_core/tfp.c

Quoted 10 lines
drivers/net/bnxt/tf_core/tfp.c new file +10 -0
+
+     parms->mem_va = rte_zmalloc("tf",
+                                 (parms->nitems * parms->size),
+                                 parms->alignment);
+     if (parms->mem_va == NULL) {
+             PMD_DRV_LOG(ERR, "Allocate failed mem_va\n");
+             return -ENOMEM;
+     }
+
+     parms->mem_pa = (void

*)((uintptr_t)rte_mem_virt2iova(parms->mem_va));

Quoted 1 line

+ if (parms->mem_pa == (void *)RTE_BAD_IOVA) {

This is causing a warning for 32bit icc [1], becuase 64-bit value converted to
32-bit pointer. Can you do the same casting that has been done in one line above, like [2].

[1]
.../drivers/net/bnxt/tf_core/tfp.c(110): warning #2259: non-pointer conversion
from "rte_iova_t={uint64_t={__uint64_t={unsigned long long}}}" to "void *" may
lose significant bits

Quoted 6 lines
        if (parms->mem_pa == (void *)RTE_BAD_IOVA) {
                             ^

[2]
- if (parms->mem_pa == (void *)RTE_BAD_IOVA) {
+ if (parms->mem_pa == (void *)((uintptr_t)RTE_BAD_IOVA)) {

Makes sense. Thanks

#113 lore raw

PATCH v4 5/34 net/bnxt: add initial tf core session close support

In reply to Venkat Duvvuru

From: Michael Wildt <[email protected]>

- Add TruFlow session and resource support functions
- Add Truflow session close API and related message support functions for both session and hw resources

---
 drivers/net/bnxt/Makefile               |   1 +
 drivers/net/bnxt/tf_core/bitalloc.c     | 364 +++++++++++++++++++++++++++++
 drivers/net/bnxt/tf_core/bitalloc.h     | 119 ++++++++++
 drivers/net/bnxt/tf_core/tf_core.c      |  86 +++++++
 drivers/net/bnxt/tf_core/tf_msg.c       | 401 ++++++++++++++++++++++++++++++++
 drivers/net/bnxt/tf_core/tf_msg.h       |  42 ++++
 drivers/net/bnxt/tf_core/tf_resources.h |  24 +-
 drivers/net/bnxt/tf_core/tf_rm.h        | 113 +++++++++
 drivers/net/bnxt/tf_core/tf_session.h   |   1 +
 9 files changed, 1146 insertions(+), 5 deletions(-)
 create mode 100644 drivers/net/bnxt/tf_core/bitalloc.c
 create mode 100644 drivers/net/bnxt/tf_core/bitalloc.h
drivers/net/bnxt/Makefile +1 -0
index 8a68059..8474673 100644
@@ -48,6 +48,7 @@ CFLAGS += -I$(SRCDIR) -I$(SRCDIR)/tf_core
 endif
 
 SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += tf_core/tf_core.c
+SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += tf_core/bitalloc.c
 SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += tf_core/tf_msg.c
 SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += tf_core/tfp.c
 
drivers/net/bnxt/tf_core/bitalloc.c new file +364 -0

364 lines not on this page · raw message

drivers/net/bnxt/tf_core/bitalloc.h new file +119 -0

119 lines not on this page · raw message

drivers/net/bnxt/tf_core/tf_core.c +86 -0

101 lines not on this page · raw message

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

416 lines not on this page · raw message

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

52 lines not on this page · raw message

drivers/net/bnxt/tf_core/tf_resources.h +19 -5
index 160abac..8dbb2f9 100644
@@ -6,11 +6,6 @@
 #ifndef _TF_RESOURCES_H_
 #define _TF_RESOURCES_H_
 
-/*
- * Hardware specific MAX values
- * NOTE: Should really come from the chip_cfg.h in some MAX form or HCAPI
- */
-
 /** HW Resource types
  */
 enum tf_resource_type_hw {
@@ -43,4 +38,23 @@ enum tf_resource_type_hw {
 	TF_RESC_TYPE_HW_LAG_ENTRY,
 	TF_RESC_TYPE_HW_MAX
 };
+
+/** HW Resource types
+ */
+enum tf_resource_type_sram {
+	TF_RESC_TYPE_SRAM_FULL_ACTION,
+	TF_RESC_TYPE_SRAM_MCG,
+	TF_RESC_TYPE_SRAM_ENCAP_8B,
+	TF_RESC_TYPE_SRAM_ENCAP_16B,
+	TF_RESC_TYPE_SRAM_ENCAP_64B,
+	TF_RESC_TYPE_SRAM_SP_SMAC,
+	TF_RESC_TYPE_SRAM_SP_SMAC_IPV4,
+	TF_RESC_TYPE_SRAM_SP_SMAC_IPV6,
+	TF_RESC_TYPE_SRAM_COUNTER_64B,
+	TF_RESC_TYPE_SRAM_NAT_SPORT,
+	TF_RESC_TYPE_SRAM_NAT_DPORT,
+	TF_RESC_TYPE_SRAM_NAT_S_IPV4,
+	TF_RESC_TYPE_SRAM_NAT_D_IPV4,
+	TF_RESC_TYPE_SRAM_MAX
+};
 #endif /* _TF_RESOURCES_H_ */
drivers/net/bnxt/tf_core/tf_rm.h +113 -0

133 lines not on this page · raw message

drivers/net/bnxt/tf_core/tf_session.h +1 -0
index 32e53c0..651d3ee 100644
@@ -9,6 +9,7 @@
 #include <stdint.h>
 #include <stdlib.h>
 
+#include "bitalloc.h"
 #include "tf_core.h"
 #include "tf_rm.h"
 
Signature · 1 line
2.7.4
#114 lore raw

Re: [dpdk-dev] [PATCH v4 05/34] net/bnxt: add initial tf core session close support

Quoted 9 lines · Venkat Duvvuru

From: Michael Wildt <[email protected]>

- Add TruFlow session and resource support functions
- Add Truflow session close API and related message support functions for both session and hw resources

<...>

drivers/net/bnxt/tf_core/tf_core.c line 21

Quoted 6 lines
drivers/net/bnxt/tf_core/tf_core.c +6 -0
+static inline uint32_t SWAP_WORDS32(uint32_t val32)
+{
+	return (((val32 & 0x0000ffff) << 16) |
+		((val32 & 0xffff0000) >> 16));
+}
+

'SWAP_WORDS32()' is not used in this patch and causing a build warning [1], can you please add this function on the patch it is used?

[1]
.../drivers/net/bnxt/tf_core/tf_core.c:17:24: error: unused function 'SWAP_WORDS32' [-Werror,-Wunused-function]
static inline uint32_t SWAP_WORDS32(uint32_t val32)

                       ^
#115 lore raw

Re: [dpdk-dev] [PATCH v4 05/34] net/bnxt: add initial tf core session close support

Quoted 24 lines · Ferruh Yigit
Quoted 9 lines · Venkat Duvvuru

From: Michael Wildt <[email protected]>

- Add TruFlow session and resource support functions
- Add Truflow session close API and related message support functions for both session and hw resources

<...>

drivers/net/bnxt/tf_core/tf_core.c line 21

Quoted 6 lines
drivers/net/bnxt/tf_core/tf_core.c +6 -0
+static inline uint32_t SWAP_WORDS32(uint32_t val32)
+{
+     return (((val32 & 0x0000ffff) << 16) |
+             ((val32 & 0xffff0000) >> 16));
+}
+

'SWAP_WORDS32()' is not used in this patch and causing a build warning [1], can
you please add this function on the patch it is used?

Quoted 6 lines

[1]
.../drivers/net/bnxt/tf_core/tf_core.c:17:24: error: unused function 'SWAP_WORDS32' [-Werror,-Wunused-function]
static inline uint32_t SWAP_WORDS32(uint32_t val32)

                       ^

Can respin and send with this taken care of. Thanks

#116 lore raw

PATCH v4 6/34 net/bnxt: add tf core session sram functions

In reply to Venkat Duvvuru

From: Michael Wildt <[email protected]>

- Add TruFlow session resource support functionality
- Add TruFlow session hw flush capability as well as sram support functions.
- Add resource definitions for session pools.

---
 drivers/net/bnxt/Makefile               |   1 +
 drivers/net/bnxt/tf_core/rand.c         |  47 ++++
 drivers/net/bnxt/tf_core/rand.h         |  36 +++
 drivers/net/bnxt/tf_core/tf_core.c      |   1 +
 drivers/net/bnxt/tf_core/tf_msg.c       | 344 +++++++++++++++++++++++
 drivers/net/bnxt/tf_core/tf_msg.h       |  37 +++
 drivers/net/bnxt/tf_core/tf_resources.h | 482 ++++++++++++++++++++++++++++++++
 7 files changed, 948 insertions(+)
 create mode 100644 drivers/net/bnxt/tf_core/rand.c
 create mode 100644 drivers/net/bnxt/tf_core/rand.h
drivers/net/bnxt/Makefile +1 -0
index 8474673..c39c098 100644
@@ -50,6 +50,7 @@ endif
 SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += tf_core/tf_core.c
 SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += tf_core/bitalloc.c
 SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += tf_core/tf_msg.c
+SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += tf_core/rand.c
 SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += tf_core/tfp.c
 
 #
drivers/net/bnxt/tf_core/rand.c new file +47 -0

47 lines not on this page · raw message

drivers/net/bnxt/tf_core/rand.h new file +36 -0
new file mode 100644
index 0000000..31cd76e
@@ -0,0 +1,36 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2019-2020 Broadcom
+ * All rights reserved.
+ */
+
+/* Random Number Functions */
+#ifndef __RAND_H__
+#define __RAND_H__
+
+/**
+ * Generates a 16 bit pseudo random number
+ *
+ * Returns:
+ * uint16_t number
+ *
+ */
+uint16_t rand16(void);
+
+/**
+ * Generates a 32 bit pseudo random number
+ *
+ * Returns:
+ * uint32_t number
+ *
+ */
+uint32_t rand32(void);
+
+/**
+ * Resets the seed used by the pseudo random number generator
+ *
+ * Returns:
+ *
+ */
+void rand_init(void);
+
+#endif /* __RAND_H__ */
drivers/net/bnxt/tf_core/tf_core.c +1 -0
index 3c5d55d..d82f746 100644
@@ -12,6 +12,7 @@
 #include "tfp.h"
 #include "bitalloc.h"
 #include "bnxt.h"
+#include "rand.h"
 
 static inline uint32_t SWAP_WORDS32(uint32_t val32)
 {
drivers/net/bnxt/tf_core/tf_msg.c +344 -0

347 lines not on this page · raw message

drivers/net/bnxt/tf_core/tf_msg.h +37 -0
index da5ccf3..057de84 100644
@@ -83,4 +83,41 @@ int tf_msg_session_hw_resc_alloc(struct tf *tfp,
 int tf_msg_session_hw_resc_free(struct tf *tfp,
 				enum tf_dir dir,
 				struct tf_rm_entry *hw_entry);
+
+/**
+ * Sends session HW resource flush request to TF Firmware
+ */
+int tf_msg_session_hw_resc_flush(struct tf *tfp,
+				 enum tf_dir dir,
+				 struct tf_rm_entry *hw_entry);
+
+/**
+ * Sends session SRAM resource query capability request to TF Firmware
+ */
+int tf_msg_session_sram_resc_qcaps(struct tf *tfp,
+				   enum tf_dir dir,
+				   struct tf_rm_sram_query *sram_query);
+
+/**
+ * Sends session SRAM resource allocation request to TF Firmware
+ */
+int tf_msg_session_sram_resc_alloc(struct tf *tfp,
+				   enum tf_dir dir,
+				   struct tf_rm_sram_alloc *sram_alloc,
+				   struct tf_rm_entry *sram_entry);
+
+/**
+ * Sends session SRAM resource free request to TF Firmware
+ */
+int tf_msg_session_sram_resc_free(struct tf *tfp,
+				  enum tf_dir dir,
+				  struct tf_rm_entry *sram_entry);
+
+/**
+ * Sends session SRAM resource flush request to TF Firmware
+ */
+int tf_msg_session_sram_resc_flush(struct tf *tfp,
+				   enum tf_dir dir,
+				   struct tf_rm_entry *sram_entry);
+
 #endif  /* _TF_MSG_H_ */
drivers/net/bnxt/tf_core/tf_resources.h +482 -0

492 lines not on this page · raw message

Signature · 1 line
2.7.4
#117 lore raw

PATCH v4 7/34 net/bnxt: add initial tf core resource mgmt support

In reply to Venkat Duvvuru

From: Shahaji Bhosle <[email protected]>

- Add TruFlow public API definitions for resources as well as RM infrastructure

---
 drivers/net/bnxt/Makefile             |    1 +
 drivers/net/bnxt/tf_core/tf_core.c    |   40 +
 drivers/net/bnxt/tf_core/tf_core.h    |  125 +++
 drivers/net/bnxt/tf_core/tf_rm.c      | 1731 +++++++++++++++++++++++++++++++++
 drivers/net/bnxt/tf_core/tf_rm.h      |  175 ++++
 drivers/net/bnxt/tf_core/tf_session.h |  206 +++-
 6 files changed, 2277 insertions(+), 1 deletion(-)
 create mode 100644 drivers/net/bnxt/tf_core/tf_rm.c
drivers/net/bnxt/Makefile +1 -0
index c39c098..02f8c3f 100644
@@ -51,6 +51,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += tf_core/tf_core.c
 SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += tf_core/bitalloc.c
 SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += tf_core/tf_msg.c
 SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += tf_core/rand.c
+SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += tf_core/tf_rm.c
 SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += tf_core/tfp.c
 
 #
drivers/net/bnxt/tf_core/tf_core.c +40 -0
index d82f746..7d76efa 100644
@@ -20,6 +20,29 @@ static inline uint32_t SWAP_WORDS32(uint32_t val32)
 		((val32 & 0xffff0000) >> 16));
 }
 
+static void tf_seeds_init(struct tf_session *session)
+{
+	int i;
+	uint32_t r;
+
+	/* Initialize the lfsr */
+	rand_init();
+
+	/* RX and TX use the same seed values */
+	session->lkup_lkup3_init_cfg[TF_DIR_RX] =
+		session->lkup_lkup3_init_cfg[TF_DIR_TX] =
+						SWAP_WORDS32(rand32());
+
+	for (i = 0; i < TF_LKUP_SEED_MEM_SIZE / 2; i++) {
+		r = SWAP_WORDS32(rand32());
+		session->lkup_em_seed_mem[TF_DIR_RX][i * 2] = r;
+		session->lkup_em_seed_mem[TF_DIR_TX][i * 2] = r;
+		r = SWAP_WORDS32(rand32());
+		session->lkup_em_seed_mem[TF_DIR_RX][i * 2 + 1] = (r & 0x1);
+		session->lkup_em_seed_mem[TF_DIR_TX][i * 2 + 1] = (r & 0x1);
+	}
+}
+
 int
 tf_open_session(struct tf                    *tfp,
 		struct tf_open_session_parms *parms)
@@ -109,6 +132,7 @@ tf_open_session(struct tf                    *tfp,
 
 	/* Initialize Session */
 	session->device_type = parms->device_type;
+	tf_rm_init(tfp);
 
 	/* Construct the Session ID */
 	session->session_id.internal.domain = domain;
@@ -125,6 +149,16 @@ tf_open_session(struct tf                    *tfp,
 		goto cleanup_close;
 	}
 
+	/* Adjust the Session with what firmware allowed us to get */
+	rc = tf_rm_allocate_validate(tfp);
+	if (rc) {
+		/* Log error */
+		goto cleanup_close;
+	}
+
+	/* Setup hash seeds */
+	tf_seeds_init(session);
+
 	session->ref_count++;
 
 	/* Return session ID */
@@ -195,6 +229,12 @@ tf_close_session(struct tf *tfp)
 
 	tfs = (struct tf_session *)(tfp->session->core_data);
 
+	/* Cleanup if we're last user of the session */
+	if (tfs->ref_count == 1) {
+		/* Cleanup any outstanding resources */
+		rc_close = tf_rm_close(tfp);
+	}
+
 	if (tfs->session_id.id != TF_SESSION_ID_INVALID) {
 		rc = tf_msg_session_close(tfp);
 		if (rc) {
drivers/net/bnxt/tf_core/tf_core.h +125 -0

129 lines not on this page · raw message

drivers/net/bnxt/tf_core/tf_rm.c new file +1731 -0

1,731 lines not on this page · raw message

drivers/net/bnxt/tf_core/tf_rm.h +175 -0

185 lines not on this page · raw message

drivers/net/bnxt/tf_core/tf_session.h +205 -1

216 lines not on this page · raw message

Signature · 1 line
2.7.4
#118 lore raw

PATCH v4 8/34 net/bnxt: add resource manager functionality

In reply to Venkat Duvvuru

From: Michael Wildt <[email protected]>

- Add TruFlow RM functionality for resource handling
- Update the TruFlow Resource Manager (RM) with resource support functions for debugging as well as resource cleanup.
- Add support for Internal and external pools.

---
 drivers/net/bnxt/tf_core/tf_core.c    |   14 +
 drivers/net/bnxt/tf_core/tf_core.h    |   26 +
 drivers/net/bnxt/tf_core/tf_rm.c      | 1718 +++++++++++++++++++++++++++++++--
 drivers/net/bnxt/tf_core/tf_session.h |   10 +
 drivers/net/bnxt/tf_core/tf_tbl.h     |   43 +
 5 files changed, 1735 insertions(+), 76 deletions(-)
 create mode 100644 drivers/net/bnxt/tf_core/tf_tbl.h
drivers/net/bnxt/tf_core/tf_core.c +14 -0
index 7d76efa..bb6d38b 100644
@@ -149,6 +149,20 @@ tf_open_session(struct tf                    *tfp,
 		goto cleanup_close;
 	}
 
+	/* Shadow DB configuration */
+	if (parms->shadow_copy) {
+		/* Ignore shadow_copy setting */
+		session->shadow_copy = 0;/* parms->shadow_copy; */
+#if (TF_SHADOW == 1)
+		rc = tf_rm_shadow_db_init(tfs);
+		if (rc)
+			PMD_DRV_LOG(ERR,
+				    "Shadow DB Initialization failed\n, rc:%d",
+				    rc);
+		/* Add additional processing */
+#endif /* TF_SHADOW */
+	}
+
 	/* Adjust the Session with what firmware allowed us to get */
 	rc = tf_rm_allocate_validate(tfp);
 	if (rc) {
drivers/net/bnxt/tf_core/tf_core.h +26 -0
index 3455d8f..16c8251 100644
@@ -30,6 +30,32 @@ enum tf_dir {
 	TF_DIR_MAX
 };
 
+/**
+ * External pool size
+ *
+ * Defines a single pool of external action records of
+ * fixed size.  Currently, this is an index.
+ */
+#define TF_EXT_POOL_ENTRY_SZ_BYTES 1
+
+/**
+ *  External pool entry count
+ *
+ *  Defines the number of entries in the external action pool
+ */
+#define TF_EXT_POOL_ENTRY_CNT (1 * 1024)
+
+/**
+ * Number of external pools
+ */
+#define TF_EXT_POOL_CNT_MAX 1
+
+/**
+ * External pool Id
+ */
+#define TF_EXT_POOL_0      0 /**< matches TF_TBL_TYPE_EXT   */
+#define TF_EXT_POOL_1      1 /**< matches TF_TBL_TYPE_EXT_0 */
+
 /********** BEGIN API FUNCTION PROTOTYPES/PARAMETERS **********/
 
 /**
drivers/net/bnxt/tf_core/tf_rm.c +1642 -76

1,866 lines not on this page · raw message

drivers/net/bnxt/tf_core/tf_session.h +10 -0
index 34b6c41..fed34f1 100644
@@ -12,6 +12,7 @@
 #include "bitalloc.h"
 #include "tf_core.h"
 #include "tf_rm.h"
+#include "tf_tbl.h"
 
 /** Session defines
  */
@@ -285,6 +286,15 @@ struct tf_session {
 
 	/** Lookup3 init values */
 	uint32_t lkup_lkup3_init_cfg[TF_DIR_MAX];
+
+	/** Table scope array */
+	struct tf_tbl_scope_cb tbl_scopes[TF_NUM_TBL_SCOPE];
+
+	/** Each external pool is associated with a single table scope
+	 *  For each external pool store the associated table scope in
+	 *  this data structure
+	 */
+	uint32_t ext_pool_2_scope[TF_DIR_MAX][TF_EXT_POOL_CNT_MAX];
 };
 
 #endif /* _TF_SESSION_H_ */
drivers/net/bnxt/tf_core/tf_tbl.h new file +43 -0

43 lines not on this page · raw message

Signature · 1 line
2.7.4
#119 lore raw

PATCH v4 9/34 net/bnxt: add tf core identifier support

In reply to Venkat Duvvuru

From: Farah Smith <[email protected]>

- Add TruFlow Identifier resource support
- Add TruFlow public API for Identifier resources.
- Add support code and stack for Identifier resource allocation control.

---
 drivers/net/bnxt/tf_core/tf_core.c | 156 +++++++++++++++++++++++++++++++++++++
 drivers/net/bnxt/tf_core/tf_core.h |  55 +++++++++++++
 drivers/net/bnxt/tf_core/tf_msg.c  |  13 ++++
 3 files changed, 224 insertions(+)
drivers/net/bnxt/tf_core/tf_core.c +156 -0
index bb6d38b..7b027f7 100644
@@ -284,3 +284,159 @@ tf_close_session(struct tf *tfp)
 
 	return rc_close;
 }
+
+/** allocate identifier resource
+ *
+ * Returns success or failure code.
+ */
+int tf_alloc_identifier(struct tf *tfp,
+			struct tf_alloc_identifier_parms *parms)
+{
+	struct bitalloc *session_pool;
+	struct tf_session *tfs;
+	int id;
+	int rc;
+
+	if (parms == NULL || tfp == NULL)
+		return -EINVAL;
+
+	if (tfp->session == NULL || tfp->session->core_data == NULL) {
+		PMD_DRV_LOG(ERR, "%s: session error\n",
+			    tf_dir_2_str(parms->dir));
+		return -EINVAL;
+	}
+
+	tfs = (struct tf_session *)(tfp->session->core_data);
+
+	switch (parms->ident_type) {
+	case TF_IDENT_TYPE_L2_CTXT:
+		TF_RM_GET_POOLS(tfs, parms->dir, &session_pool,
+				TF_L2_CTXT_REMAP_POOL_NAME,
+				rc);
+		break;
+	case TF_IDENT_TYPE_PROF_FUNC:
+		TF_RM_GET_POOLS(tfs, parms->dir, &session_pool,
+				TF_PROF_FUNC_POOL_NAME,
+				rc);
+		break;
+	case TF_IDENT_TYPE_EM_PROF:
+		TF_RM_GET_POOLS(tfs, parms->dir, &session_pool,
+				TF_EM_PROF_ID_POOL_NAME,
+				rc);
+		break;
+	case TF_IDENT_TYPE_WC_PROF:
+		TF_RM_GET_POOLS(tfs, parms->dir, &session_pool,
+				TF_WC_TCAM_PROF_ID_POOL_NAME,
+				rc);
+		break;
+	case TF_IDENT_TYPE_L2_FUNC:
+		PMD_DRV_LOG(ERR, "%s: unsupported %s\n",
+			    tf_dir_2_str(parms->dir),
+			    tf_ident_2_str(parms->ident_type));
+		rc = -EOPNOTSUPP;
+		break;
+	default:
+		PMD_DRV_LOG(ERR, "%s: %s\n",
+			    tf_dir_2_str(parms->dir),
+			    tf_ident_2_str(parms->ident_type));
+		rc = -EINVAL;
+		break;
+	}
+
+	if (rc) {
+		PMD_DRV_LOG(ERR, "%s: identifier pool %s failure\n",
+			    tf_dir_2_str(parms->dir),
+			    tf_ident_2_str(parms->ident_type));
+		return rc;
+	}
+
+	id = ba_alloc(session_pool);
+
+	if (id == BA_FAIL) {
+		PMD_DRV_LOG(ERR, "%s: %s: No resource available\n",
+			    tf_dir_2_str(parms->dir),
+			    tf_ident_2_str(parms->ident_type));
+		return -ENOMEM;
+	}
+	parms->id = id;
+	return 0;
+}
+
+/** free identifier resource
+ *
+ * Returns success or failure code.
+ */
+int tf_free_identifier(struct tf *tfp,
+		       struct tf_free_identifier_parms *parms)
+{
+	struct bitalloc *session_pool;
+	int rc;
+	int ba_rc;
+	struct tf_session *tfs;
+
+	if (parms == NULL || tfp == NULL)
+		return -EINVAL;
+
+	if (tfp->session == NULL || tfp->session->core_data == NULL) {
+		PMD_DRV_LOG(ERR, "%s: Session error\n",
+			    tf_dir_2_str(parms->dir));
+		return -EINVAL;
+	}
+
+	tfs = (struct tf_session *)(tfp->session->core_data);
+
+	switch (parms->ident_type) {
+	case TF_IDENT_TYPE_L2_CTXT:
+		TF_RM_GET_POOLS(tfs, parms->dir, &session_pool,
+				TF_L2_CTXT_REMAP_POOL_NAME,
+				rc);
+		break;
+	case TF_IDENT_TYPE_PROF_FUNC:
+		TF_RM_GET_POOLS(tfs, parms->dir, &session_pool,
+				TF_PROF_FUNC_POOL_NAME,
+				rc);
+		break;
+	case TF_IDENT_TYPE_EM_PROF:
+		TF_RM_GET_POOLS(tfs, parms->dir, &session_pool,
+				TF_EM_PROF_ID_POOL_NAME,
+				rc);
+		break;
+	case TF_IDENT_TYPE_WC_PROF:
+		TF_RM_GET_POOLS(tfs, parms->dir, &session_pool,
+				TF_WC_TCAM_PROF_ID_POOL_NAME,
+				rc);
+		break;
+	case TF_IDENT_TYPE_L2_FUNC:
+		PMD_DRV_LOG(ERR, "%s: unsupported %s\n",
+			    tf_dir_2_str(parms->dir),
+			    tf_ident_2_str(parms->ident_type));
+		rc = -EOPNOTSUPP;
+		break;
+	default:
+		PMD_DRV_LOG(ERR, "%s: invalid %s\n",
+			    tf_dir_2_str(parms->dir),
+			    tf_ident_2_str(parms->ident_type));
+		rc = -EINVAL;
+		break;
+	}
+	if (rc) {
+		PMD_DRV_LOG(ERR, "%s: %s Identifier pool access failed\n",
+			    tf_dir_2_str(parms->dir),
+			    tf_ident_2_str(parms->ident_type));
+		return rc;
+	}
+
+	ba_rc = ba_inuse(session_pool, (int)parms->id);
+
+	if (ba_rc == BA_FAIL || ba_rc == BA_ENTRY_FREE) {
+		PMD_DRV_LOG(ERR, "%s: %s: Entry %d already free",
+			    tf_dir_2_str(parms->dir),
+			    tf_ident_2_str(parms->ident_type),
+			    parms->id);
+		return -EINVAL;
+	}
+
+	ba_free(session_pool, (int)parms->id);
+
+	return 0;
+}
drivers/net/bnxt/tf_core/tf_core.h +55 -0

61 lines not on this page · raw message

drivers/net/bnxt/tf_core/tf_msg.c +13 -0
index 4ce2bc5..c44f96f 100644
@@ -94,6 +94,19 @@
 } while (0)
 
 /**
+ * This is the MAX data we can transport across regular HWRM
+ */
+#define TF_PCI_BUF_SIZE_MAX 88
+
+/**
+ * If data bigger than TF_PCI_BUF_SIZE_MAX then use DMA method
+ */
+struct tf_msg_dma_buf {
+	void *va_addr;
+	uint64_t pa_addr;
+};
+
+/**
  * Sends session open request to TF Firmware
  */
 int
Signature · 1 line
2.7.4
#120 lore raw

PATCH v4 10/34 net/bnxt: add tf core TCAM support

In reply to Venkat Duvvuru

From: Shahaji Bhosle <[email protected]>

- Add TruFlow TCAM public API functions
- Add TCAM support functions as well as public APIs.

---
 drivers/net/bnxt/tf_core/tf_core.c | 163 ++++++++++++++++++++++++++
 drivers/net/bnxt/tf_core/tf_core.h | 227 +++++++++++++++++++++++++++++++++++++
 drivers/net/bnxt/tf_core/tf_msg.c  | 159 ++++++++++++++++++++++++++
 drivers/net/bnxt/tf_core/tf_msg.h  |  30 +++++
 4 files changed, 579 insertions(+)
drivers/net/bnxt/tf_core/tf_core.c +163 -0
index 7b027f7..39f4a11 100644
@@ -440,3 +440,166 @@ int tf_free_identifier(struct tf *tfp,
 
 	return 0;
 }
+
+int
+tf_alloc_tcam_entry(struct tf *tfp,
+		    struct tf_alloc_tcam_entry_parms *parms)
+{
+	int rc;
+	int index;
+	struct tf_session *tfs;
+	struct bitalloc *session_pool;
+
+	if (parms == NULL || tfp == NULL)
+		return -EINVAL;
+
+	if (tfp->session == NULL || tfp->session->core_data == NULL) {
+		PMD_DRV_LOG(ERR, "%s: session error\n",
+			    tf_dir_2_str(parms->dir));
+		return -EINVAL;
+	}
+
+	tfs = (struct tf_session *)(tfp->session->core_data);
+
+	rc = tf_rm_lookup_tcam_type_pool(tfs,
+					 parms->dir,
+					 parms->tcam_tbl_type,
+					 &session_pool);
+	/* Error logging handled by tf_rm_lookup_tcam_type_pool */
+	if (rc)
+		return rc;
+
+	index = ba_alloc(session_pool);
+	if (index == BA_FAIL) {
+		PMD_DRV_LOG(ERR, "%s: %s: No resource available\n",
+			    tf_dir_2_str(parms->dir),
+			    tf_tcam_tbl_2_str(parms->tcam_tbl_type));
+		return -ENOMEM;
+	}
+
+	parms->idx = index;
+	return 0;
+}
+
+int
+tf_set_tcam_entry(struct tf *tfp,
+		  struct tf_set_tcam_entry_parms *parms)
+{
+	int rc;
+	int id;
+	struct tf_session *tfs;
+	struct bitalloc *session_pool;
+
+	if (tfp == NULL || parms == NULL) {
+		PMD_DRV_LOG(ERR, "Invalid parameters\n");
+		return -EINVAL;
+	}
+
+	if (tfp->session == NULL || tfp->session->core_data == NULL) {
+		PMD_DRV_LOG(ERR,
+			    "%s, Session info invalid\n",
+			    tf_dir_2_str(parms->dir));
+		return -EINVAL;
+	}
+
+	tfs = (struct tf_session *)(tfp->session->core_data);
+
+	/*
+	 * Each tcam send msg function should check for key sizes range
+	 */
+
+	rc = tf_rm_lookup_tcam_type_pool(tfs,
+					 parms->dir,
+					 parms->tcam_tbl_type,
+					 &session_pool);
+	/* Error logging handled by tf_rm_lookup_tcam_type_pool */
+	if (rc)
+		return rc;
+
+
+	/* Verify that the entry has been previously allocated */
+	id = ba_inuse(session_pool, parms->idx);
+	if (id != 1) {
+		PMD_DRV_LOG(ERR,
+		   "%s: %s: Invalid or not allocated index, idx:%d\n",
+		   tf_dir_2_str(parms->dir),
+		   tf_tcam_tbl_2_str(parms->tcam_tbl_type),
+		   parms->idx);
+		return -EINVAL;
+	}
+
+	rc = tf_msg_tcam_entry_set(tfp, parms);
+
+	return rc;
+}
+
+int
+tf_get_tcam_entry(struct tf *tfp __rte_unused,
+		  struct tf_get_tcam_entry_parms *parms __rte_unused)
+{
+	int rc = -EOPNOTSUPP;
+
+	if (tfp == NULL || parms == NULL) {
+		PMD_DRV_LOG(ERR, "Invalid parameters\n");
+		return -EINVAL;
+	}
+
+	if (tfp->session == NULL || tfp->session->core_data == NULL) {
+		PMD_DRV_LOG(ERR,
+			    "%s, Session info invalid\n",
+			    tf_dir_2_str(parms->dir));
+		return -EINVAL;
+	}
+
+	return rc;
+}
+
+int
+tf_free_tcam_entry(struct tf *tfp,
+		   struct tf_free_tcam_entry_parms *parms)
+{
+	int rc;
+	struct tf_session *tfs;
+	struct bitalloc *session_pool;
+
+	if (parms == NULL || tfp == NULL)
+		return -EINVAL;
+
+	if (tfp->session == NULL || tfp->session->core_data == NULL) {
+		PMD_DRV_LOG(ERR, "%s: Session error\n",
+			    tf_dir_2_str(parms->dir));
+		return -EINVAL;
+	}
+
+	tfs = (struct tf_session *)(tfp->session->core_data);
+
+	rc = tf_rm_lookup_tcam_type_pool(tfs,
+					 parms->dir,
+					 parms->tcam_tbl_type,
+					 &session_pool);
+	/* Error logging handled by tf_rm_lookup_tcam_type_pool */
+	if (rc)
+		return rc;
+
+	rc = ba_inuse(session_pool, (int)parms->idx);
+	if (rc == BA_FAIL || rc == BA_ENTRY_FREE) {
+		PMD_DRV_LOG(ERR, "%s: %s: Entry %d already free",
+			    tf_dir_2_str(parms->dir),
+			    tf_tcam_tbl_2_str(parms->tcam_tbl_type),
+			    parms->idx);
+		return -EINVAL;
+	}
+
+	ba_free(session_pool, (int)parms->idx);
+
+	rc = tf_msg_tcam_entry_free(tfp, parms);
+	if (rc) {
+		/* Log error */
+		PMD_DRV_LOG(ERR, "%s: %s: Entry %d free failed",
+			    tf_dir_2_str(parms->dir),
+			    tf_tcam_tbl_2_str(parms->tcam_tbl_type),
+			    parms->idx);
+	}
+
+	return rc;
+}
drivers/net/bnxt/tf_core/tf_core.h +227 -0

233 lines not on this page · raw message

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

168 lines not on this page · raw message

drivers/net/bnxt/tf_core/tf_msg.h +30 -0
index 057de84..fa74d78 100644
@@ -120,4 +120,34 @@ int tf_msg_session_sram_resc_flush(struct tf *tfp,
 				   enum tf_dir dir,
 				   struct tf_rm_entry *sram_entry);
 
+/**
+ * Sends tcam entry 'set' to the Firmware.
+ *
+ * [in] tfp
+ *   Pointer to session handle
+ *
+ * [in] parms
+ *   Pointer to set parameters
+ *
+ * Returns:
+ *  0 on Success else internal Truflow error
+ */
+int tf_msg_tcam_entry_set(struct tf *tfp,
+			  struct tf_set_tcam_entry_parms *parms);
+
+/**
+ * Sends tcam entry 'free' to the Firmware.
+ *
+ * [in] tfp
+ *   Pointer to session handle
+ *
+ * [in] parms
+ *   Pointer to free parameters
+ *
+ * Returns:
+ *  0 on Success else internal Truflow error
+ */
+int tf_msg_tcam_entry_free(struct tf *tfp,
+			   struct tf_free_tcam_entry_parms *parms);
+
 #endif  /* _TF_MSG_H_ */
Signature · 1 line
2.7.4
#121 lore raw

PATCH v4 11/34 net/bnxt: add tf core table scope support

In reply to Venkat Duvvuru

From: Farah Smith <[email protected]>

- Added TruFlow Table public API
- Added Table Scope capability including Table Type support code for setting and getting Table Types.

---
 drivers/net/bnxt/Makefile          |   1 +
 drivers/net/bnxt/tf_core/hwrm_tf.h |  21 ++++++
 drivers/net/bnxt/tf_core/tf_core.c |   4 ++
 drivers/net/bnxt/tf_core/tf_core.h | 128 +++++++++++++++++++++++++++++++++++++
 drivers/net/bnxt/tf_core/tf_msg.c  |  81 +++++++++++++++++++++++
 drivers/net/bnxt/tf_core/tf_msg.h  |  63 ++++++++++++++++++
 drivers/net/bnxt/tf_core/tf_tbl.c  |  43 +++++++++++++
 7 files changed, 341 insertions(+)
 create mode 100644 drivers/net/bnxt/tf_core/tf_tbl.c
drivers/net/bnxt/Makefile +1 -0
index 02f8c3f..6714a6a 100644
@@ -52,6 +52,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += tf_core/bitalloc.c
 SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += tf_core/tf_msg.c
 SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += tf_core/rand.c
 SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += tf_core/tf_rm.c
+SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += tf_core/tf_tbl.c
 SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += tf_core/tfp.c
 
 #
drivers/net/bnxt/tf_core/hwrm_tf.h +21 -0
index a8a5547..acb9a8b 100644
@@ -891,6 +891,27 @@ typedef struct tf_session_sram_resc_flush_input {
 } tf_session_sram_resc_flush_input_t, *ptf_session_sram_resc_flush_input_t;
 BUILD_BUG_ON(sizeof(tf_session_sram_resc_flush_input_t) <= TF_MAX_REQ_SIZE);
 
+/* Input params for table type set */
+typedef struct tf_tbl_type_set_input {
+	/* Session Id */
+	uint32_t			 fw_session_id;
+	/* flags */
+	uint16_t			 flags;
+	/* When set to 0, indicates the get apply to RX */
+#define TF_TBL_TYPE_SET_INPUT_FLAGS_DIR_RX			(0x0)
+	/* When set to 1, indicates the get apply to TX */
+#define TF_TBL_TYPE_SET_INPUT_FLAGS_DIR_TX			(0x1)
+	/* Type of the object to set */
+	uint32_t			 type;
+	/* Size of the data to set in bytes */
+	uint16_t			 size;
+	/* Data to set */
+	uint8_t			  data[TF_BULK_SEND];
+	/* Index to set */
+	uint32_t			 index;
+} tf_tbl_type_set_input_t, *ptf_tbl_type_set_input_t;
+BUILD_BUG_ON(sizeof(tf_tbl_type_set_input_t) <= TF_MAX_REQ_SIZE);
+
 /* Input params for table type get */
 typedef struct tf_tbl_type_get_input {
 	/* Session Id */
drivers/net/bnxt/tf_core/tf_core.c +4 -0
index 39f4a11..f04a9b1 100644
@@ -7,6 +7,7 @@
 
 #include "tf_core.h"
 #include "tf_session.h"
+#include "tf_tbl.h"
 #include "tf_rm.h"
 #include "tf_msg.h"
 #include "tfp.h"
@@ -173,6 +174,9 @@ tf_open_session(struct tf                    *tfp,
 	/* Setup hash seeds */
 	tf_seeds_init(session);
 
+	/* Initialize external pool data structures */
+	tf_init_tbl_pool(session);
+
 	session->ref_count++;
 
 	/* Return session ID */
drivers/net/bnxt/tf_core/tf_core.h +128 -0

134 lines not on this page · raw message

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

87 lines not on this page · raw message

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

73 lines not on this page · raw message

drivers/net/bnxt/tf_core/tf_tbl.c new file +43 -0

43 lines not on this page · raw message

Signature · 1 line
2.7.4
#122 lore raw

PATCH v4 12/34 net/bnxt: add EM/EEM functionality

In reply to Venkat Duvvuru

From: Pete Spreadborough <[email protected]>

- Add TruFlow flow memory support
- Exact Match (EM) adds the capability to manage and manipulate data flows using on chip memory.
- Extended Exact Match (EEM) behaves similarly to EM, but at a vastly increased scale by using host DDR, with performance tradeoff due to the need to access off-chip memory.

---
 drivers/net/bnxt/Makefile                     |    2 +
 drivers/net/bnxt/tf_core/lookup3.h            |  162 +++
 drivers/net/bnxt/tf_core/stack.c              |  107 ++
 drivers/net/bnxt/tf_core/stack.h              |  107 ++
 drivers/net/bnxt/tf_core/tf_core.c            |   50 +
 drivers/net/bnxt/tf_core/tf_core.h            |  480 ++++++-
 drivers/net/bnxt/tf_core/tf_em.c              |  515 +++++++
 drivers/net/bnxt/tf_core/tf_em.h              |  117 ++
 drivers/net/bnxt/tf_core/tf_ext_flow_handle.h |  166 +++
 drivers/net/bnxt/tf_core/tf_msg.c             |  171 +++
 drivers/net/bnxt/tf_core/tf_msg.h             |   40 +
 drivers/net/bnxt/tf_core/tf_tbl.c             | 1795 ++++++++++++++++++++++++-
 drivers/net/bnxt/tf_core/tf_tbl.h             |   83 ++
 13 files changed, 3788 insertions(+), 7 deletions(-)
 create mode 100644 drivers/net/bnxt/tf_core/lookup3.h
 create mode 100644 drivers/net/bnxt/tf_core/stack.c
 create mode 100644 drivers/net/bnxt/tf_core/stack.h
 create mode 100644 drivers/net/bnxt/tf_core/tf_em.c
 create mode 100644 drivers/net/bnxt/tf_core/tf_em.h
 create mode 100644 drivers/net/bnxt/tf_core/tf_ext_flow_handle.h
drivers/net/bnxt/Makefile +2 -0
index 6714a6a..4c95847 100644
@@ -51,6 +51,8 @@ SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += tf_core/tf_core.c
 SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += tf_core/bitalloc.c
 SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += tf_core/tf_msg.c
 SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += tf_core/rand.c
+SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += tf_core/stack.c
+SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += tf_core/tf_em.c
 SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += tf_core/tf_rm.c
 SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += tf_core/tf_tbl.c
 SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += tf_core/tfp.c
drivers/net/bnxt/tf_core/lookup3.h new file +162 -0

162 lines not on this page · raw message

drivers/net/bnxt/tf_core/stack.c new file +107 -0

107 lines not on this page · raw message

drivers/net/bnxt/tf_core/stack.h new file +107 -0

107 lines not on this page · raw message

drivers/net/bnxt/tf_core/tf_core.c +50 -0

62 lines not on this page · raw message

drivers/net/bnxt/tf_core/tf_core.h +474 -6

538 lines not on this page · raw message

drivers/net/bnxt/tf_core/tf_em.c new file +515 -0

515 lines not on this page · raw message

drivers/net/bnxt/tf_core/tf_em.h new file +117 -0

117 lines not on this page · raw message

drivers/net/bnxt/tf_core/tf_ext_flow_handle.h new file +166 -0

166 lines not on this page · raw message

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

177 lines not on this page · raw message

drivers/net/bnxt/tf_core/tf_msg.h +40 -0
index 9055b16..b8d8c1e 100644
@@ -122,6 +122,46 @@ int tf_msg_session_sram_resc_flush(struct tf *tfp,
 				   struct tf_rm_entry *sram_entry);
 
 /**
+ * Sends EM mem register request to Firmware
+ */
+int tf_msg_em_mem_rgtr(struct tf *tfp,
+		       int           page_lvl,
+		       int           page_size,
+		       uint64_t      dma_addr,
+		       uint16_t     *ctx_id);
+
+/**
+ * Sends EM mem unregister request to Firmware
+ */
+int tf_msg_em_mem_unrgtr(struct tf *tfp,
+			 uint16_t     *ctx_id);
+
+/**
+ * Sends EM qcaps request to Firmware
+ */
+int tf_msg_em_qcaps(struct tf *tfp,
+		    int dir,
+		    struct tf_em_caps *em_caps);
+
+/**
+ * Sends EM config request to Firmware
+ */
+int tf_msg_em_cfg(struct tf *tfp,
+		  uint32_t      num_entries,
+		  uint16_t      key0_ctx_id,
+		  uint16_t      key1_ctx_id,
+		  uint16_t      record_ctx_id,
+		  uint16_t      efc_ctx_id,
+		  int           dir);
+
+/**
+ * Sends EM operation request to Firmware
+ */
+int tf_msg_em_op(struct tf *tfp,
+		 int        dir,
+		 uint16_t   op);
+
+/**
  * Sends tcam entry 'set' to the Firmware.
  *
  * [in] tfp
drivers/net/bnxt/tf_core/tf_tbl.c +1794 -1

995 lines not on this page · raw message

drivers/net/bnxt/tf_core/tf_tbl.h +83 -0

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

#123 lore raw

PATCH v4 13/34 net/bnxt: fetch SVIF information from the firmware

In reply to Venkat Duvvuru

SVIF (source virtual interface) is used to represent a physical port, physical function, or a virtual function. SVIF is compared during L2 context and exact match lookups in TX direction. SVIF is masked for port information during L2 context and exact match lookup in RX direction. Hence, driver needs this SVIF information to program L2 context and Exact match tables.

---
 drivers/net/bnxt/bnxt.h        |  6 ++++++
 drivers/net/bnxt/bnxt_ethdev.c | 14 ++++++++++++++
 drivers/net/bnxt/bnxt_hwrm.c   | 34 ++++++++++++++++++++++++++++++++++
 drivers/net/bnxt/bnxt_hwrm.h   |  1 +
 4 files changed, 55 insertions(+)
drivers/net/bnxt/bnxt.h +6 -0
index a8e57ca..2ed56f4 100644
@@ -682,6 +682,9 @@ struct bnxt {
 #define BNXT_FLOW_ID_MASK	0x0000ffff
 	struct bnxt_mark_info	*mark_table;
 
+#define	BNXT_SVIF_INVALID	0xFFFF
+	uint16_t		func_svif;
+	uint16_t		port_svif;
 	struct tf               tfp;
 };
 
@@ -723,4 +726,7 @@ extern int bnxt_logtype_driver;
 
 #define PMD_DRV_LOG(level, fmt, args...) \
 	  PMD_DRV_LOG_RAW(level, fmt, ## args)
+
+uint16_t bnxt_get_svif(uint16_t port_id, bool func_svif);
+
 #endif
drivers/net/bnxt/bnxt_ethdev.c +14 -0
index 93d0062..f3cc745 100644
@@ -4696,6 +4696,18 @@ static void bnxt_config_vf_req_fwd(struct bnxt *bp)
 	ALLOW_FUNC(HWRM_VNIC_TPA_CFG);
 }
 
+uint16_t
+bnxt_get_svif(uint16_t port_id, bool func_svif)
+{
+	struct rte_eth_dev *eth_dev;
+	struct bnxt *bp;
+
+	eth_dev = &rte_eth_devices[port_id];
+	bp = eth_dev->data->dev_private;
+
+	return func_svif ? bp->func_svif : bp->port_svif;
+}
+
 static int bnxt_init_fw(struct bnxt *bp)
 {
 	uint16_t mtu;
@@ -4731,6 +4743,8 @@ static int bnxt_init_fw(struct bnxt *bp)
 	if (rc)
 		return rc;
 
+	bnxt_hwrm_port_mac_qcfg(bp);
+
 	rc = bnxt_hwrm_cfa_adv_flow_mgmt_qcaps(bp);
 	if (rc)
 		return rc;
drivers/net/bnxt/bnxt_hwrm.c +34 -0
index 443553b..0eaf917 100644
@@ -3010,6 +3010,8 @@ int bnxt_hwrm_func_qcfg(struct bnxt *bp, uint16_t *mtu)
 	struct hwrm_func_qcfg_output *resp = bp->hwrm_cmd_resp_addr;
 	uint16_t flags;
 	int rc = 0;
+	bp->func_svif = BNXT_SVIF_INVALID;
+	uint16_t svif_info;
 
 	HWRM_PREP(&req, HWRM_FUNC_QCFG, BNXT_USE_CHIMP_MB);
 	req.fid = rte_cpu_to_le_16(0xffff);
@@ -3020,6 +3022,12 @@ int bnxt_hwrm_func_qcfg(struct bnxt *bp, uint16_t *mtu)
 
 	/* Hard Coded.. 0xfff VLAN ID mask */
 	bp->vlan = rte_le_to_cpu_16(resp->vlan) & 0xfff;
+
+	svif_info = rte_le_to_cpu_16(resp->svif_info);
+	if (svif_info & HWRM_FUNC_QCFG_OUTPUT_SVIF_INFO_SVIF_VALID)
+		bp->func_svif =	svif_info &
+				     HWRM_FUNC_QCFG_OUTPUT_SVIF_INFO_SVIF_MASK;
+
 	flags = rte_le_to_cpu_16(resp->flags);
 	if (BNXT_PF(bp) && (flags & HWRM_FUNC_QCFG_OUTPUT_FLAGS_MULTI_HOST))
 		bp->flags |= BNXT_FLAG_MULTI_HOST;
@@ -3056,6 +3064,32 @@ int bnxt_hwrm_func_qcfg(struct bnxt *bp, uint16_t *mtu)
 	return rc;
 }
 
+int bnxt_hwrm_port_mac_qcfg(struct bnxt *bp)
+{
+	struct hwrm_port_mac_qcfg_input req = {0};
+	struct hwrm_port_mac_qcfg_output *resp = bp->hwrm_cmd_resp_addr;
+	uint16_t port_svif_info;
+	int rc;
+
+	bp->port_svif = BNXT_SVIF_INVALID;
+
+	HWRM_PREP(&req, HWRM_PORT_MAC_QCFG, BNXT_USE_CHIMP_MB);
+
+	rc = bnxt_hwrm_send_message(bp, &req, sizeof(req), BNXT_USE_CHIMP_MB);
+
+	HWRM_CHECK_RESULT();
+
+	port_svif_info = rte_le_to_cpu_16(resp->port_svif_info);
+	if (port_svif_info &
+	    HWRM_PORT_MAC_QCFG_OUTPUT_PORT_SVIF_INFO_PORT_SVIF_VALID)
+		bp->port_svif = port_svif_info &
+			HWRM_PORT_MAC_QCFG_OUTPUT_PORT_SVIF_INFO_PORT_SVIF_MASK;
+
+	HWRM_UNLOCK();
+
+	return 0;
+}
+
 static void copy_func_cfg_to_qcaps(struct hwrm_func_cfg_input *fcfg,
 				   struct hwrm_func_qcaps_output *qcaps)
 {
drivers/net/bnxt/bnxt_hwrm.h +1 -0
index df7aa74..0079d8a 100644
@@ -193,6 +193,7 @@ int bnxt_hwrm_port_qstats(struct bnxt *bp);
 int bnxt_hwrm_port_clr_stats(struct bnxt *bp);
 int bnxt_hwrm_port_led_cfg(struct bnxt *bp, bool led_on);
 int bnxt_hwrm_port_led_qcaps(struct bnxt *bp);
+int bnxt_hwrm_port_mac_qcfg(struct bnxt *bp);
 int bnxt_hwrm_func_cfg_vf_set_flags(struct bnxt *bp, uint16_t vf,
 					uint32_t flags);
 void vf_vnic_set_rxmask_cb(struct bnxt_vnic_info *vnic, void *flagp);
Signature · 1 line
2.7.4
#124 lore raw

PATCH v4 14/34 net/bnxt: fetch vnic info from DPDK port

In reply to Venkat Duvvuru

VNIC is needed for the driver to program the action record for rx flows. VNIC determines what receive rings to use to place the received packets. This patch introduces a routine that will convert a given dpdk port to VNIC.

---
 drivers/net/bnxt/bnxt.h        |  1 +
 drivers/net/bnxt/bnxt_ethdev.c | 15 +++++++++++++++
 2 files changed, 16 insertions(+)
drivers/net/bnxt/bnxt.h +1 -0
index 2ed56f4..c4507f7 100644
@@ -727,6 +727,7 @@ extern int bnxt_logtype_driver;
 #define PMD_DRV_LOG(level, fmt, args...) \
 	  PMD_DRV_LOG_RAW(level, fmt, ## args)
 
+uint16_t bnxt_get_vnic_id(uint16_t port);
 uint16_t bnxt_get_svif(uint16_t port_id, bool func_svif);
 
 #endif
drivers/net/bnxt/bnxt_ethdev.c +15 -0
index f3cc745..57ed90f 100644
@@ -4708,6 +4708,21 @@ bnxt_get_svif(uint16_t port_id, bool func_svif)
 	return func_svif ? bp->func_svif : bp->port_svif;
 }
 
+uint16_t
+bnxt_get_vnic_id(uint16_t port)
+{
+	struct rte_eth_dev *eth_dev;
+	struct bnxt_vnic_info *vnic;
+	struct bnxt *bp;
+
+	eth_dev = &rte_eth_devices[port];
+	bp = eth_dev->data->dev_private;
+
+	vnic = BNXT_GET_DEFAULT_VNIC(bp);
+
+	return vnic->fw_vnic_id;
+}
+
 static int bnxt_init_fw(struct bnxt *bp)
 {
 	uint16_t mtu;
Signature · 1 line
2.7.4
#125 lore raw

PATCH v4 15/34 net/bnxt: add devargs parameter for host memory based TRUFLOW feature

In reply to Venkat Duvvuru

This feature can be enabled by passing
"-w 0000:0d:00.0,host-based-truflow=1” to the DPDK application.

---
 drivers/net/bnxt/bnxt.h        |  4 ++-
 drivers/net/bnxt/bnxt_ethdev.c | 73 ++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 76 insertions(+), 1 deletion(-)
drivers/net/bnxt/bnxt.h +3 -1
index c4507f7..cd84ebd 100644
@@ -685,7 +685,9 @@ struct bnxt {
 #define	BNXT_SVIF_INVALID	0xFFFF
 	uint16_t		func_svif;
 	uint16_t		port_svif;
-	struct tf               tfp;
+
+	struct tf		tfp;
+	uint8_t			truflow;
 };
 
 int bnxt_mtu_set_op(struct rte_eth_dev *eth_dev, uint16_t new_mtu);
drivers/net/bnxt/bnxt_ethdev.c +73 -0

97 lines not on this page · raw message

Signature · 1 line
2.7.4
#126 lore raw

PATCH v4 16/34 net/bnxt: add support for ULP session manager init

In reply to Venkat Duvvuru

A ULP session will contain all the resources needed to support rte flow offloads. A session is initialized as part of rte_eth_device start. A DPDK application can have multiple interfaces which means rte_eth_device start will be called for each of these devices. ULP session manager will make sure that a single ULP session is only initialized once. Apart from this, it also initializes MARK database, EEM table & flow database. ULP session manager also manages a list of all opened ULP sessions.

---
 drivers/net/bnxt/Makefile                     |   6 +-
 drivers/net/bnxt/bnxt.h                       |   5 +
 drivers/net/bnxt/bnxt_ethdev.c                |   4 +
 drivers/net/bnxt/tf_ulp/bnxt_tf_common.h      |  35 ++
 drivers/net/bnxt/tf_ulp/bnxt_ulp.c            | 527 ++++++++++++++++++++++++++
 drivers/net/bnxt/tf_ulp/bnxt_ulp.h            | 100 +++++
 drivers/net/bnxt/tf_ulp/ulp_flow_db.c         | 187 +++++++++
 drivers/net/bnxt/tf_ulp/ulp_flow_db.h         |  77 ++++
 drivers/net/bnxt/tf_ulp/ulp_mark_mgr.c        |  94 +++++
 drivers/net/bnxt/tf_ulp/ulp_mark_mgr.h        |  49 +++
 drivers/net/bnxt/tf_ulp/ulp_template_db.c     |  27 ++
 drivers/net/bnxt/tf_ulp/ulp_template_db.h     |  35 ++
 drivers/net/bnxt/tf_ulp/ulp_template_struct.h |  40 ++
 13 files changed, 1185 insertions(+), 1 deletion(-)
 create mode 100644 drivers/net/bnxt/tf_ulp/bnxt_tf_common.h
 create mode 100644 drivers/net/bnxt/tf_ulp/bnxt_ulp.c
 create mode 100644 drivers/net/bnxt/tf_ulp/bnxt_ulp.h
 create mode 100644 drivers/net/bnxt/tf_ulp/ulp_flow_db.c
 create mode 100644 drivers/net/bnxt/tf_ulp/ulp_flow_db.h
 create mode 100644 drivers/net/bnxt/tf_ulp/ulp_mark_mgr.c
 create mode 100644 drivers/net/bnxt/tf_ulp/ulp_mark_mgr.h
 create mode 100644 drivers/net/bnxt/tf_ulp/ulp_template_db.c
 create mode 100644 drivers/net/bnxt/tf_ulp/ulp_template_db.h
 create mode 100644 drivers/net/bnxt/tf_ulp/ulp_template_struct.h
drivers/net/bnxt/Makefile +5 -1
index 4c95847..bb9b888 100644
@@ -44,7 +44,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += bnxt_rxtx_vec_sse.c
 endif
 
 ifeq ($(CONFIG_RTE_LIBRTE_BNXT_PMD), y)
-CFLAGS += -I$(SRCDIR) -I$(SRCDIR)/tf_core
+CFLAGS += -I$(SRCDIR) -I$(SRCDIR)/tf_core -I$(SRCDIR)/tf_ulp
 endif
 
 SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += tf_core/tf_core.c
@@ -57,6 +57,10 @@ SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += tf_core/tf_rm.c
 SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += tf_core/tf_tbl.c
 SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += tf_core/tfp.c
 
+SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += tf_ulp/bnxt_ulp.c
+SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += tf_ulp/ulp_mark_mgr.c
+SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += tf_ulp/ulp_flow_db.c
+SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += tf_ulp/ulp_template_db.c
 #
 # Export include files
 #
drivers/net/bnxt/bnxt.h +5 -0
index cd84ebd..cd20740 100644
@@ -22,6 +22,7 @@
 #include "bnxt_util.h"
 
 #include "tf_core.h"
+#include "bnxt_ulp.h"
 
 /* Vendor ID */
 #define PCI_VENDOR_ID_BROADCOM		0x14E4
@@ -687,6 +688,7 @@ struct bnxt {
 	uint16_t		port_svif;
 
 	struct tf		tfp;
+	struct bnxt_ulp_context	ulp_ctx;
 	uint8_t			truflow;
 };
 
@@ -729,6 +731,9 @@ extern int bnxt_logtype_driver;
 #define PMD_DRV_LOG(level, fmt, args...) \
 	  PMD_DRV_LOG_RAW(level, fmt, ## args)
 
+int32_t bnxt_ulp_init(struct bnxt *bp);
+void bnxt_ulp_deinit(struct bnxt *bp);
+
 uint16_t bnxt_get_vnic_id(uint16_t port);
 uint16_t bnxt_get_svif(uint16_t port_id, bool func_svif);
 
drivers/net/bnxt/bnxt_ethdev.c +4 -0
index c4bbf1d..1703ce3 100644
@@ -904,6 +904,10 @@ static int bnxt_dev_start_op(struct rte_eth_dev *eth_dev)
 	pthread_mutex_lock(&bp->def_cp_lock);
 	bnxt_schedule_fw_health_check(bp);
 	pthread_mutex_unlock(&bp->def_cp_lock);
+
+	if (bp->truflow)
+		bnxt_ulp_init(bp);
+
 	return 0;
 
 error:
drivers/net/bnxt/tf_ulp/bnxt_tf_common.h new file +35 -0
new file mode 100644
index 0000000..3516df4
@@ -0,0 +1,35 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2014-2019 Broadcom
+ * All rights reserved.
+ */
+
+#ifndef _BNXT_TF_COMMON_H_
+#define _BNXT_TF_COMMON_H_
+
+#define BNXT_TF_DBG(lvl, fmt, args...)	PMD_DRV_LOG(lvl, fmt, ## args)
+
+#define BNXT_ULP_EM_FLOWS			8192
+#define BNXT_ULP_1M_FLOWS			1000000
+#define BNXT_EEM_RX_GLOBAL_ID_MASK		(BNXT_ULP_1M_FLOWS - 1)
+#define BNXT_EEM_TX_GLOBAL_ID_MASK		(BNXT_ULP_1M_FLOWS - 1)
+#define BNXT_EEM_HASH_KEY2_USED			0x8000000
+#define BNXT_EEM_RX_HW_HASH_KEY2_BIT		BNXT_ULP_1M_FLOWS
+#define	BNXT_ULP_DFLT_RX_MAX_KEY		512
+#define	BNXT_ULP_DFLT_RX_MAX_ACTN_ENTRY		256
+#define	BNXT_ULP_DFLT_RX_MEM			0
+#define	BNXT_ULP_RX_NUM_FLOWS			32
+#define	BNXT_ULP_RX_TBL_IF_ID			0
+#define	BNXT_ULP_DFLT_TX_MAX_KEY		512
+#define	BNXT_ULP_DFLT_TX_MAX_ACTN_ENTRY		256
+#define	BNXT_ULP_DFLT_TX_MEM			0
+#define	BNXT_ULP_TX_NUM_FLOWS			32
+#define	BNXT_ULP_TX_TBL_IF_ID			0
+
+struct bnxt_ulp_mark_tbl *
+bnxt_ulp_cntxt_ptr2_mark_db_get(struct bnxt_ulp_context *ulp_ctx);
+
+int32_t
+bnxt_ulp_cntxt_ptr2_mark_db_set(struct bnxt_ulp_context *ulp_ctx,
+				struct bnxt_ulp_mark_tbl *mark_tbl);
+
+#endif /* _BNXT_TF_COMMON_H_ */
drivers/net/bnxt/tf_ulp/bnxt_ulp.c new file +527 -0

527 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/bnxt_ulp.h new file +100 -0

100 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_flow_db.c new file +187 -0

187 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_flow_db.h new file +77 -0

77 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_mark_mgr.c new file +94 -0

94 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_mark_mgr.h new file +49 -0

49 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_template_db.c new file +27 -0
new file mode 100644
index 0000000..9670635
@@ -0,0 +1,27 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2014-2019 Broadcom
+ * All rights reserved.
+ */
+
+/*
+ * date: Mon Mar  9 02:37:53 2020
+ * version: 0.0
+ */
+
+#include "ulp_template_db.h"
+#include "ulp_template_struct.h"
+
+struct bnxt_ulp_device_params ulp_device_params[] = {
+	[BNXT_ULP_DEVICE_ID_WH_PLUS] = {
+		.global_fid_enable       = BNXT_ULP_SYM_YES,
+		.byte_order              = (enum bnxt_ulp_byte_order)
+						BNXT_ULP_SYM_LITTLE_ENDIAN,
+		.encap_byte_swap         = 1,
+		.lfid_entries            = 16384,
+		.lfid_entry_size         = 4,
+		.gfid_entries            = 65536,
+		.gfid_entry_size         = 4,
+		.num_flows               = 32768,
+		.num_resources_per_flow  = 8
+	}
+};
drivers/net/bnxt/tf_ulp/ulp_template_db.h new file +35 -0
new file mode 100644
index 0000000..ba2a101
@@ -0,0 +1,35 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2014-2019 Broadcom
+ * All rights reserved.
+ */
+
+/*
+ * date: Mon Mar  9 02:37:53 2020
+ * version: 0.0
+ */
+
+#ifndef ULP_TEMPLATE_DB_H_
+#define ULP_TEMPLATE_DB_H_
+
+#define BNXT_ULP_MAX_NUM_DEVICES 4
+
+enum bnxt_ulp_byte_order {
+	BNXT_ULP_BYTE_ORDER_BE,
+	BNXT_ULP_BYTE_ORDER_LE,
+	BNXT_ULP_BYTE_ORDER_LAST
+};
+
+enum bnxt_ulp_device_id {
+	BNXT_ULP_DEVICE_ID_WH_PLUS,
+	BNXT_ULP_DEVICE_ID_THOR,
+	BNXT_ULP_DEVICE_ID_STINGRAY,
+	BNXT_ULP_DEVICE_ID_STINGRAY2,
+	BNXT_ULP_DEVICE_ID_LAST
+};
+
+enum bnxt_ulp_sym {
+	BNXT_ULP_SYM_LITTLE_ENDIAN = 1,
+	BNXT_ULP_SYM_YES = 1
+};
+
+#endif /* _ULP_TEMPLATE_DB_H_ */
drivers/net/bnxt/tf_ulp/ulp_template_struct.h new file +40 -0
new file mode 100644
index 0000000..4b9d0b2
@@ -0,0 +1,40 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2014-2019 Broadcom
+ * All rights reserved.
+ */
+
+#ifndef _ULP_TEMPLATE_STRUCT_H_
+#define _ULP_TEMPLATE_STRUCT_H_
+
+#include <stdint.h>
+#include "rte_ether.h"
+#include "rte_icmp.h"
+#include "rte_ip.h"
+#include "rte_tcp.h"
+#include "rte_udp.h"
+#include "rte_esp.h"
+#include "rte_sctp.h"
+#include "rte_flow.h"
+#include "tf_core.h"
+
+/* Device specific parameters. */
+struct bnxt_ulp_device_params {
+	uint8_t				description[16];
+	uint32_t			global_fid_enable;
+	enum bnxt_ulp_byte_order	byte_order;
+	uint8_t				encap_byte_swap;
+	uint32_t			lfid_entries;
+	uint32_t			lfid_entry_size;
+	uint64_t			gfid_entries;
+	uint32_t			gfid_entry_size;
+	uint64_t			num_flows;
+	uint32_t			num_resources_per_flow;
+};
+
+/*
+ * The ulp_device_params is indexed by the dev_id.
+ * This table maintains the device specific parameters.
+ */
+extern struct bnxt_ulp_device_params ulp_device_params[];
+
+#endif /* _ULP_TEMPLATE_STRUCT_H_ */
Signature · 1 line
2.7.4
#127 lore raw

PATCH v4 17/34 net/bnxt: add support for ULP session manager cleanup

In reply to Venkat Duvvuru

A ULP session will contain all the resources needed to support rte flow offloads. A session is initialized as part of rte_eth_device start. A DPDK application can have multiple interfaces which means rte_eth_device start will be called for each of these devices. ULP session manager will make sure that a single ULP session is only initialized once. Apart from this, it also initializes MARK database, EEM table & flow database. ULP session manager also manages a list of all opened ULP sessions.

This patch adds support for cleaning up resources initialized for ULP sessions.

---
 drivers/net/bnxt/bnxt_ethdev.c         |   3 +
 drivers/net/bnxt/tf_ulp/bnxt_ulp.c     | 167 ++++++++++++++++++++++++++++++++-
 drivers/net/bnxt/tf_ulp/bnxt_ulp.h     |  10 ++
 drivers/net/bnxt/tf_ulp/ulp_mark_mgr.c |  25 +++++
 drivers/net/bnxt/tf_ulp/ulp_mark_mgr.h |   8 ++
 5 files changed, 212 insertions(+), 1 deletion(-)
drivers/net/bnxt/bnxt_ethdev.c +3 -0
index 1703ce3..2f08921 100644
@@ -951,6 +951,9 @@ static void bnxt_dev_stop_op(struct rte_eth_dev *eth_dev)
 	struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(eth_dev);
 	struct rte_intr_handle *intr_handle = &pci_dev->intr_handle;
 
+	if (bp->truflow)
+		bnxt_ulp_deinit(bp);
+
 	eth_dev->data->dev_started = 0;
 	/* Prevent crashes when queues are still in use */
 	eth_dev->rx_pkt_burst = &bnxt_dummy_recv_pkts;
drivers/net/bnxt/tf_ulp/bnxt_ulp.c +166 -1

214 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/bnxt_ulp.h +10 -0
index d88225f..b3e9e96 100644
@@ -47,6 +47,16 @@ struct rte_tf_flow {
 	uint32_t	flow_id;
 };
 
+/*
+ * Allow the deletion of context only for the bnxt device that
+ * created the session
+ * TBD - The implementation of the function should change to
+ * using the reference count once tf_session_attach functionality
+ * is fixed.
+ */
+bool
+ulp_ctx_deinit_allowed(void *bp);
+
 /* Function to set the device id of the hardware. */
 int32_t
 bnxt_ulp_cntxt_dev_id_set(struct bnxt_ulp_context *ulp_ctx, uint32_t dev_id);
drivers/net/bnxt/tf_ulp/ulp_mark_mgr.c +25 -0
index 3f28a73..9e4307e 100644
@@ -92,3 +92,28 @@ ulp_mark_db_init(struct bnxt_ulp_context *ctxt)
 
 	return -ENOMEM;
 }
+
+/*
+ * Release all resources in the Mark Manager for this ulp context
+ *
+ * ctxt [in] The ulp context for the mark manager
+ *
+ */
+int32_t
+ulp_mark_db_deinit(struct bnxt_ulp_context *ctxt)
+{
+	struct bnxt_ulp_mark_tbl *mtbl;
+
+	mtbl = bnxt_ulp_cntxt_ptr2_mark_db_get(ctxt);
+
+	if (mtbl) {
+		rte_free(mtbl->gfid_tbl);
+		rte_free(mtbl->lfid_tbl);
+		rte_free(mtbl);
+
+		/* Safe to ignore on deinit */
+		(void)bnxt_ulp_cntxt_ptr2_mark_db_set(ctxt, NULL);
+	}
+
+	return 0;
+}
drivers/net/bnxt/tf_ulp/ulp_mark_mgr.h +8 -0
index b175abd..5948683 100644
@@ -46,4 +46,12 @@ struct bnxt_ulp_mark_tbl {
 int32_t
 ulp_mark_db_init(struct bnxt_ulp_context *ctxt);
 
+/*
+ * Release all resources in the Mark Manager for this ulp context
+ *
+ * ctxt [in] The ulp context for the mark manager
+ */
+int32_t
+ulp_mark_db_deinit(struct bnxt_ulp_context *ctxt);
+
 #endif /* _ULP_MARK_MGR_H_ */
Signature · 1 line
2.7.4
#128 lore raw

PATCH v4 18/34 net/bnxt: add helper functions for blob/regfile ops

In reply to Venkat Duvvuru

From: Mike Baucom <[email protected]>

1. blob routines for managing key/mask/result data
2. regfile routines for managing temporal data during flow construction

---
 drivers/net/bnxt/Makefile                 |   2 +
 drivers/net/bnxt/tf_ulp/ulp_template_db.h |  12 +
 drivers/net/bnxt/tf_ulp/ulp_utils.c       | 521 ++++++++++++++++++++++++++++++
 drivers/net/bnxt/tf_ulp/ulp_utils.h       | 279 ++++++++++++++++
 4 files changed, 814 insertions(+)
 create mode 100644 drivers/net/bnxt/tf_ulp/ulp_utils.c
 create mode 100644 drivers/net/bnxt/tf_ulp/ulp_utils.h
drivers/net/bnxt/Makefile +2 -0
index bb9b888..4e0dea1 100644
@@ -61,6 +61,8 @@ SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += tf_ulp/bnxt_ulp.c
 SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += tf_ulp/ulp_mark_mgr.c
 SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += tf_ulp/ulp_flow_db.c
 SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += tf_ulp/ulp_template_db.c
+SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += tf_ulp/ulp_utils.c
+
 #
 # Export include files
 #
drivers/net/bnxt/tf_ulp/ulp_template_db.h +12 -0
index ba2a101..1eed828 100644
@@ -27,6 +27,18 @@ enum bnxt_ulp_device_id {
 	BNXT_ULP_DEVICE_ID_LAST
 };
 
+enum bnxt_ulp_fmf_mask {
+	BNXT_ULP_FMF_MASK_IGNORE,
+	BNXT_ULP_FMF_MASK_ANY,
+	BNXT_ULP_FMF_MASK_EXACT,
+	BNXT_ULP_FMF_MASK_WILDCARD,
+	BNXT_ULP_FMF_MASK_LAST
+};
+
+enum bnxt_ulp_regfile_index {
+	BNXT_ULP_REGFILE_INDEX_LAST
+};
+
 enum bnxt_ulp_sym {
 	BNXT_ULP_SYM_LITTLE_ENDIAN = 1,
 	BNXT_ULP_SYM_YES = 1
drivers/net/bnxt/tf_ulp/ulp_utils.c new file +521 -0

521 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_utils.h new file +279 -0

279 lines not on this page · raw message

Signature · 1 line
2.7.4
#129 lore raw

PATCH v4 19/34 net/bnxt: add support to process action tables

In reply to Venkat Duvvuru

From: Mike Baucom <[email protected]>

This patch processes the action template. Iterates through the list of action info templates and processes it.

---
 drivers/net/bnxt/Makefile                     |   1 +
 drivers/net/bnxt/tf_ulp/ulp_flow_db.c         | 136 ++++++++++
 drivers/net/bnxt/tf_ulp/ulp_flow_db.h         |  25 ++
 drivers/net/bnxt/tf_ulp/ulp_mapper.c          | 364 ++++++++++++++++++++++++++
 drivers/net/bnxt/tf_ulp/ulp_mapper.h          |  39 +++
 drivers/net/bnxt/tf_ulp/ulp_template_db.c     | 245 +++++++++++++++++
 drivers/net/bnxt/tf_ulp/ulp_template_db.h     | 104 ++++++++
 drivers/net/bnxt/tf_ulp/ulp_template_struct.h |  48 +++-
 8 files changed, 959 insertions(+), 3 deletions(-)
 create mode 100644 drivers/net/bnxt/tf_ulp/ulp_mapper.c
 create mode 100644 drivers/net/bnxt/tf_ulp/ulp_mapper.h
drivers/net/bnxt/Makefile +1 -0
index 4e0dea1..f464d9e 100644
@@ -62,6 +62,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += tf_ulp/ulp_mark_mgr.c
 SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += tf_ulp/ulp_flow_db.c
 SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += tf_ulp/ulp_template_db.c
 SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += tf_ulp/ulp_utils.c
+SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += tf_ulp/ulp_mapper.c
 
 #
 # Export include files
drivers/net/bnxt/tf_ulp/ulp_flow_db.c +136 -0

146 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_flow_db.h +25 -0
index a2ee8fa..f6055a5 100644
@@ -53,6 +53,15 @@ struct bnxt_ulp_flow_db {
 	struct bnxt_ulp_flow_tbl	flow_tbl[BNXT_ULP_FLOW_TABLE_MAX];
 };
 
+/* flow db resource params to add resources */
+struct ulp_flow_db_res_params {
+	enum tf_dir			direction;
+	enum bnxt_ulp_resource_func	resource_func;
+	uint64_t			resource_hndl;
+	uint32_t			resource_type;
+	uint32_t			critical_resource;
+};
+
 /*
  * Initialize the flow database. Memory is allocated in this
  * call and assigned to the flow database.
@@ -74,4 +83,20 @@ int32_t	ulp_flow_db_init(struct bnxt_ulp_context *ulp_ctxt);
  */
 int32_t	ulp_flow_db_deinit(struct bnxt_ulp_context *ulp_ctxt);
 
+/*
+ * Allocate the flow database entry.
+ * The params->critical_resource has to be set to 0 to allocate a new resource.
+ *
+ * ulp_ctxt [in] Ptr to ulp_context
+ * tbl_idx [in] Specify it is regular or default flow
+ * fid [in] The index to the flow entry
+ * params [in] The contents to be copied into resource
+ *
+ * returns 0 on success and negative on failure.
+ */
+int32_t	ulp_flow_db_resource_add(struct bnxt_ulp_context	*ulp_ctxt,
+				 enum bnxt_ulp_flow_db_tables	tbl_idx,
+				 uint32_t			fid,
+				 struct ulp_flow_db_res_params	*params);
+
 #endif /* _ULP_FLOW_DB_H_ */
drivers/net/bnxt/tf_ulp/ulp_mapper.c new file +364 -0

364 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_mapper.h new file +39 -0
new file mode 100644
index 0000000..adbcec2
@@ -0,0 +1,39 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2014-2019 Broadcom
+ * All rights reserved.
+ */
+
+#ifndef _ULP_MAPPER_H_
+#define _ULP_MAPPER_H_
+
+#include <tf_core.h>
+#include <rte_log.h>
+#include <rte_flow.h>
+#include <rte_flow_driver.h>
+#include "ulp_template_db.h"
+#include "ulp_template_struct.h"
+#include "bnxt_ulp.h"
+#include "ulp_utils.h"
+
+/* Internal Structure for passing the arguments around */
+struct bnxt_ulp_mapper_parms {
+	uint32_t				dev_id;
+	enum bnxt_ulp_byte_order		order;
+	uint32_t				act_tid;
+	struct bnxt_ulp_mapper_act_tbl_info	*atbls;
+	uint32_t				num_atbls;
+	uint32_t				class_tid;
+	struct bnxt_ulp_mapper_class_tbl_info	*ctbls;
+	uint32_t				num_ctbls;
+	struct ulp_rte_act_prop			*act_prop;
+	struct ulp_rte_act_bitmap		*act_bitmap;
+	struct ulp_rte_hdr_field		*hdr_field;
+	struct ulp_regfile			*regfile;
+	struct tf				*tfp;
+	struct bnxt_ulp_context			*ulp_ctx;
+	uint8_t					encap_byte_swap;
+	uint32_t				fid;
+	enum bnxt_ulp_flow_db_tables		tbl_idx;
+};
+
+#endif /* _ULP_MAPPER_H_ */
drivers/net/bnxt/tf_ulp/ulp_template_db.c +245 -0

254 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_template_db.h +104 -0

113 lines not on this page · raw message

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

62 lines not on this page · raw message

Signature · 1 line
2.7.4
#130 lore raw

PATCH v4 20/34 net/bnxt: add support to process key tables

In reply to Venkat Duvvuru

From: Mike Baucom <[email protected]>

This patch creates the classifier table entries for a flow.

---
 drivers/net/bnxt/tf_ulp/ulp_mapper.c            | 784 +++++++++++++++++++++-
 drivers/net/bnxt/tf_ulp/ulp_mapper.h            |   2 +
 drivers/net/bnxt/tf_ulp/ulp_mark_mgr.c          |  80 ++-
 drivers/net/bnxt/tf_ulp/ulp_mark_mgr.h          |  18 +
 drivers/net/bnxt/tf_ulp/ulp_template_db.c       | 829 ++++++++++++++++++++++++
 drivers/net/bnxt/tf_ulp/ulp_template_db.h       | 142 +++-
 drivers/net/bnxt/tf_ulp/ulp_template_field_db.h | 130 ++++
 drivers/net/bnxt/tf_ulp/ulp_template_struct.h   |  93 ++-
 8 files changed, 2070 insertions(+), 8 deletions(-)
 create mode 100644 drivers/net/bnxt/tf_ulp/ulp_template_field_db.h
drivers/net/bnxt/tf_ulp/ulp_mapper.c +782 -2
index 9cfc382..f378f8e 100644
@@ -19,6 +19,9 @@
 int32_t
 ulp_mapper_action_tbls_process(struct bnxt_ulp_mapper_parms *parms);
 
+int32_t
+ulp_mapper_class_tbls_process(struct bnxt_ulp_mapper_parms *parms);
+
 /*
  * Get the size of the action property for a given index.
  *
@@ -37,10 +40,65 @@ ulp_mapper_act_prop_size_get(uint32_t idx)
 /*
  * Get the list of result fields that implement the flow action
  *
+ * ctxt [in] The ulp context
+ *
+ * tbl [in] A single table instance to get the key fields from
+ *
+ * num_flds [out] The number of key fields in the returned array
+ *
+ * returns array of Key fields, or NULL on error
+ */
+static struct bnxt_ulp_mapper_class_key_field_info *
+ulp_mapper_key_fields_get(struct bnxt_ulp_mapper_class_tbl_info *tbl,
+			  uint32_t *num_flds)
+{
+	uint32_t idx;
+
+	if (!tbl || !num_flds)
+		return NULL;
+
+	idx		= tbl->key_start_idx;
+	*num_flds	= tbl->key_num_fields;
+
+	/* NOTE: Need template to provide range checking define */
+	return &ulp_class_key_field_list[idx];
+}
+
+/*
+ * Get the list of data fields that implement the flow.
+ *
+ * ctxt [in] The ulp context
+ *
+ * tbl [in] A single table instance to get the data fields from
+ *
+ * num_flds [out] The number of data fields in the returned array.
+ *
+ * Returns array of data fields, or NULL on error.
+ */
+static struct bnxt_ulp_mapper_result_field_info *
+ulp_mapper_result_fields_get(struct bnxt_ulp_mapper_class_tbl_info *tbl,
+			     uint32_t *num_flds)
+{
+	uint32_t idx;
+
+	if (!tbl || !num_flds)
+		return NULL;
+
+	idx		= tbl->result_start_idx;
+	*num_flds	= tbl->result_num_fields;
+
+	/* NOTE: Need template to provide range checking define */
+	return &ulp_class_result_field_list[idx];
+}
+
+/*
+ * Get the list of result fields that implement the flow action.
+ *
  * tbl [in] A single table instance to get the results fields
  * from num_flds [out] The number of data fields in the returned
- * array
- * returns array of data fields, or NULL on error
+ * array.
+ *
+ * Returns array of data fields, or NULL on error.
  */
 static struct bnxt_ulp_mapper_result_field_info *
 ulp_mapper_act_result_fields_get(struct bnxt_ulp_mapper_act_tbl_info *tbl,
@@ -60,6 +118,106 @@ ulp_mapper_act_result_fields_get(struct bnxt_ulp_mapper_act_tbl_info *tbl,
 	return &ulp_act_result_field_list[idx];
 }
 
+/*
+ * Get the list of ident fields that implement the flow
+ *
+ * tbl [in] A single table instance to get the ident fields from
+ *
+ * num_flds [out] The number of ident fields in the returned array
+ *
+ * returns array of ident fields, or NULL on error
+ */
+static struct bnxt_ulp_mapper_ident_info *
+ulp_mapper_ident_fields_get(struct bnxt_ulp_mapper_class_tbl_info *tbl,
+			    uint32_t *num_flds)
+{
+	uint32_t idx;
+
+	if (!tbl || !num_flds)
+		return NULL;
+
+	idx = tbl->ident_start_idx;
+	*num_flds = tbl->ident_nums;
+
+	/* NOTE: Need template to provide range checking define */
+	return &ulp_ident_list[idx];
+}
+
+static int32_t
+ulp_mapper_ident_process(struct bnxt_ulp_mapper_parms *parms,
+			 struct bnxt_ulp_mapper_class_tbl_info *tbl,
+			 struct bnxt_ulp_mapper_ident_info *ident)
+{
+	struct ulp_flow_db_res_params	fid_parms;
+	uint64_t id = 0;
+	int32_t idx;
+	struct tf_alloc_identifier_parms iparms = { 0 };
+	struct tf_free_identifier_parms free_parms = { 0 };
+	struct tf *tfp;
+	int rc;
+
+	tfp = bnxt_ulp_cntxt_tfp_get(parms->ulp_ctx);
+	if (!tfp) {
+		BNXT_TF_DBG(ERR, "Failed to get tf pointer\n");
+		return -EINVAL;
+	}
+
+	idx = ident->regfile_wr_idx;
+
+	iparms.ident_type = ident->ident_type;
+	iparms.dir = tbl->direction;
+
+	rc = tf_alloc_identifier(tfp, &iparms);
+	if (rc) {
+		BNXT_TF_DBG(ERR, "Alloc ident %s:%d failed.\n",
+			    (iparms.dir == TF_DIR_RX) ? "RX" : "TX",
+			    iparms.ident_type);
+		return rc;
+	}
+
+	id = (uint64_t)tfp_cpu_to_be_64(iparms.id);
+	if (!ulp_regfile_write(parms->regfile, idx, id)) {
+		BNXT_TF_DBG(ERR, "Regfile[%d] write failed.\n", idx);
+		rc = -EINVAL;
+		/* Need to free the identifier, so goto error */
+		goto error;
+	}
+
+	/* Link the resource to the flow in the flow db */
+	memset(&fid_parms, 0, sizeof(fid_parms));
+	fid_parms.direction		= tbl->direction;
+	fid_parms.resource_func	= ident->resource_func;
+	fid_parms.resource_type	= ident->ident_type;
+	fid_parms.resource_hndl	= iparms.id;
+	fid_parms.critical_resource	= 0;
+
+	rc = ulp_flow_db_resource_add(parms->ulp_ctx,
+				      parms->tbl_idx,
+				      parms->fid,
+				      &fid_parms);
+	if (rc) {
+		BNXT_TF_DBG(ERR, "Failed to link resource to flow rc = %d\n",
+			    rc);
+		/* Need to free the identifier, so goto error */
+		goto error;
+	}
+
+	return 0;
+
+error:
+	/* Need to free the identifier */
+	free_parms.dir		= tbl->direction;
+	free_parms.ident_type	= ident->ident_type;
+	free_parms.id		= iparms.id;
+
+	(void)tf_free_identifier(tfp, &free_parms);
+
+	BNXT_TF_DBG(ERR, "Ident process failed for %s:%s\n",
+		    ident->name,
+		    (tbl->direction == TF_DIR_RX) ? "RX" : "TX");
+	return rc;
+}
+
 static int32_t
 ulp_mapper_result_field_process(struct bnxt_ulp_mapper_parms *parms,
 				struct bnxt_ulp_mapper_result_field_info *fld,
@@ -163,6 +321,100 @@ ulp_mapper_result_field_process(struct bnxt_ulp_mapper_parms *parms,
 
 /* Function to alloc action record and set the table. */
 static int32_t
+ulp_mapper_keymask_field_process(struct bnxt_ulp_mapper_parms *parms,
+				 struct bnxt_ulp_mapper_class_key_field_info *f,
+				 struct ulp_blob *blob,
+				 uint8_t is_key)
+{
+	uint64_t regval;
+	uint16_t idx, bitlen;
+	uint32_t opcode;
+	uint8_t *operand;
+	struct ulp_regfile *regfile = parms->regfile;
+	uint8_t *val = NULL;
+	struct bnxt_ulp_mapper_class_key_field_info *fld = f;
+	uint32_t field_size;
+
+	if (is_key) {
+		operand = fld->spec_operand;
+		opcode	= fld->spec_opcode;
+	} else {
+		operand = fld->mask_operand;
+		opcode	= fld->mask_opcode;
+	}
+
+	bitlen = fld->field_bit_size;
+
+	switch (opcode) {
+	case BNXT_ULP_SPEC_OPC_SET_TO_CONSTANT:
+		val = operand;
+		if (!ulp_blob_push(blob, val, bitlen)) {
+			BNXT_TF_DBG(ERR, "push to key blob failed\n");
+			return -EINVAL;
+		}
+		break;
+	case BNXT_ULP_SPEC_OPC_ADD_PAD:
+		if (!ulp_blob_pad_push(blob, bitlen)) {
+			BNXT_TF_DBG(ERR, "Pad too large for blob\n");
+			return -EINVAL;
+		}
+
+		break;
+	case BNXT_ULP_SPEC_OPC_SET_TO_HDR_FIELD:
+		if (!ulp_operand_read(operand, (uint8_t *)&idx,
+				      sizeof(uint16_t))) {
+			BNXT_TF_DBG(ERR, "key operand read failed.\n");
+			return -EINVAL;
+		}
+		idx = tfp_be_to_cpu_16(idx);
+		if (is_key)
+			val = parms->hdr_field[idx].spec;
+		else
+			val = parms->hdr_field[idx].mask;
+
+		/*
+		 * Need to account for how much data was pushed to the header
+		 * field vs how much is to be inserted in the key/mask.
+		 */
+		field_size = parms->hdr_field[idx].size;
+		if (bitlen < ULP_BYTE_2_BITS(field_size)) {
+			field_size  = field_size - ((bitlen + 7) / 8);
+			val += field_size;
+		}
+
+		if (!ulp_blob_push(blob, val, bitlen)) {
+			BNXT_TF_DBG(ERR, "push to key blob failed\n");
+			return -EINVAL;
+		}
+		break;
+	case BNXT_ULP_SPEC_OPC_SET_TO_REGFILE:
+		if (!ulp_operand_read(operand, (uint8_t *)&idx,
+				      sizeof(uint16_t))) {
+			BNXT_TF_DBG(ERR, "key operand read failed.\n");
+			return -EINVAL;
+		}
+		idx = tfp_be_to_cpu_16(idx);
+
+		if (!ulp_regfile_read(regfile, idx, &regval)) {
+			BNXT_TF_DBG(ERR, "regfile[%d] read failed.\n",
+				    idx);
+			return -EINVAL;
+		}
+
+		val = ulp_blob_push_64(blob, &regval, bitlen);
+		if (!val) {
+			BNXT_TF_DBG(ERR, "push to key blob failed\n");
+			return -EINVAL;
+		}
+	default:
+		break;
+	}
+
+	return 0;
+}
+
+/* Function to alloc action record and set the table. */
+static int32_t
 ulp_mapper_action_alloc_and_set(struct bnxt_ulp_mapper_parms *parms,
 				struct ulp_blob *blob)
 {
@@ -338,6 +590,489 @@ ulp_mapper_action_info_process(struct bnxt_ulp_mapper_parms *parms,
 	return rc;
 }
 
+static int32_t
+ulp_mapper_tcam_tbl_process(struct bnxt_ulp_mapper_parms *parms,
+			    struct bnxt_ulp_mapper_class_tbl_info *tbl)
+{
+	struct bnxt_ulp_mapper_class_key_field_info	*kflds;
+	struct ulp_blob key, mask, data;
+	uint32_t i, num_kflds;
+	struct tf *tfp;
+	int32_t rc, trc;
+	struct tf_alloc_tcam_entry_parms aparms		= { 0 };
+	struct tf_set_tcam_entry_parms sparms		= { 0 };
+	struct ulp_flow_db_res_params	fid_parms	= { 0 };
+	struct tf_free_tcam_entry_parms free_parms	= { 0 };
+	uint32_t hit = 0;
+	uint16_t tmplen = 0;
+
+	tfp = bnxt_ulp_cntxt_tfp_get(parms->ulp_ctx);
+	if (!tfp) {
+		BNXT_TF_DBG(ERR, "Failed to get truflow pointer\n");
+		return -EINVAL;
+	}
+
+	kflds = ulp_mapper_key_fields_get(tbl, &num_kflds);
+	if (!kflds || !num_kflds) {
+		BNXT_TF_DBG(ERR, "Failed to get key fields\n");
+		return -EINVAL;
+	}
+
+	if (!ulp_blob_init(&key, tbl->key_bit_size, parms->order) ||
+	    !ulp_blob_init(&mask, tbl->key_bit_size, parms->order) ||
+	    !ulp_blob_init(&data, tbl->result_bit_size, parms->order)) {
+		BNXT_TF_DBG(ERR, "blob inits failed.\n");
+		return -EINVAL;
+	}
+
+	/* create the key/mask */
+	/*
+	 * NOTE: The WC table will require some kind of flag to handle the
+	 * mode bits within the key/mask
+	 */
+	for (i = 0; i < num_kflds; i++) {
+		/* Setup the key */
+		rc = ulp_mapper_keymask_field_process(parms, &kflds[i],
+						      &key, 1);
+		if (rc) {
+			BNXT_TF_DBG(ERR, "Key field set failed.\n");
+			return rc;
+		}
+
+		/* Setup the mask */
+		rc = ulp_mapper_keymask_field_process(parms, &kflds[i],
+						      &mask, 0);
+		if (rc) {
+			BNXT_TF_DBG(ERR, "Mask field set failed.\n");
+			return rc;
+		}
+	}
+
+	aparms.dir		= tbl->direction;
+	aparms.tcam_tbl_type	= tbl->table_type;
+	aparms.search_enable	= tbl->srch_b4_alloc;
+	aparms.key_sz_in_bits	= tbl->key_bit_size;
+	aparms.key		= ulp_blob_data_get(&key, &tmplen);
+	if (tbl->key_bit_size != tmplen) {
+		BNXT_TF_DBG(ERR, "Key len (%d) != Expected (%d)\n",
+			    tmplen, tbl->key_bit_size);
+		return -EINVAL;
+	}
+
+	aparms.mask		= ulp_blob_data_get(&mask, &tmplen);
+	if (tbl->key_bit_size != tmplen) {
+		BNXT_TF_DBG(ERR, "Mask len (%d) != Expected (%d)\n",
+			    tmplen, tbl->key_bit_size);
+		return -EINVAL;
+	}
+
+	aparms.priority		= tbl->priority;
+
+	/*
+	 * All failures after this succeeds require the entry to be freed.
+	 * cannot return directly on failure, but needs to goto error
+	 */
+	rc = tf_alloc_tcam_entry(tfp, &aparms);
+	if (rc) {
+		BNXT_TF_DBG(ERR, "tcam alloc failed rc=%d.\n", rc);
+		return rc;
+	}
+
+	hit = aparms.hit;
+
+	/* Build the result */
+	if (!tbl->srch_b4_alloc || !hit) {
+		struct bnxt_ulp_mapper_result_field_info *dflds;
+		struct bnxt_ulp_mapper_ident_info *idents;
+		uint32_t num_dflds, num_idents;
+
+		/* Alloc identifiers */
+		idents = ulp_mapper_ident_fields_get(tbl, &num_idents);
+
+		for (i = 0; i < num_idents; i++) {
+			rc = ulp_mapper_ident_process(parms, tbl, &idents[i]);
+
+			/* Already logged the error, just return */
+			if (rc)
+				goto error;
+		}
+
+		/* Create the result data blob */
+		dflds = ulp_mapper_result_fields_get(tbl, &num_dflds);
+		if (!dflds || !num_dflds) {
+			BNXT_TF_DBG(ERR, "Failed to get data fields.\n");
+			rc = -EINVAL;
+			goto error;
+		}
+
+		for (i = 0; i < num_dflds; i++) {
+			rc = ulp_mapper_result_field_process(parms,
+							     &dflds[i],
+							     &data);
+			if (rc) {
+				BNXT_TF_DBG(ERR, "Failed to set data fields\n");
+				goto error;
+			}
+		}
+
+		sparms.dir		= aparms.dir;
+		sparms.tcam_tbl_type	= aparms.tcam_tbl_type;
+		sparms.idx		= aparms.idx;
+		/* Already verified the key/mask lengths */
+		sparms.key		= ulp_blob_data_get(&key, &tmplen);
+		sparms.mask		= ulp_blob_data_get(&mask, &tmplen);
+		sparms.key_sz_in_bits	= tbl->key_bit_size;
+		sparms.result		= ulp_blob_data_get(&data, &tmplen);
+
+		if (tbl->result_bit_size != tmplen) {
+			BNXT_TF_DBG(ERR, "Result len (%d) != Expected (%d)\n",
+				    tmplen, tbl->result_bit_size);
+			rc = -EINVAL;
+			goto error;
+		}
+		sparms.result_sz_in_bits = tbl->result_bit_size;
+
+		rc = tf_set_tcam_entry(tfp, &sparms);
+		if (rc) {
+			BNXT_TF_DBG(ERR, "tcam[%d][%s][%d] write failed.\n",
+				    sparms.tcam_tbl_type,
+				    (sparms.dir == TF_DIR_RX) ? "RX" : "TX",
+				    sparms.idx);
+			goto error;
+		}
+	} else {
+		BNXT_TF_DBG(ERR, "Not supporting search before alloc now\n");
+		rc = -EINVAL;
+		goto error;
+	}
+
+	/* Link the resource to the flow in the flow db */
+	fid_parms.direction = tbl->direction;
+	fid_parms.resource_func	= tbl->resource_func;
+	fid_parms.resource_type	= tbl->table_type;
+	fid_parms.critical_resource = tbl->critical_resource;
+	fid_parms.resource_hndl	= aparms.idx;
+
+	rc = ulp_flow_db_resource_add(parms->ulp_ctx,
+				      parms->tbl_idx,
+				      parms->fid,
+				      &fid_parms);
+	if (rc) {
+		BNXT_TF_DBG(ERR, "Failed to link resource to flow rc = %d\n",
+			    rc);
+		/* Need to free the identifier, so goto error */
+		goto error;
+	}
+
+	return 0;
+error:
+	free_parms.dir			= tbl->direction;
+	free_parms.tcam_tbl_type	= tbl->table_type;
+	free_parms.idx			= aparms.idx;
+	trc = tf_free_tcam_entry(tfp, &free_parms);
+	if (trc)
+		BNXT_TF_DBG(ERR, "Failed to free tcam[%d][%d][%d] on failure\n",
+			    tbl->table_type, tbl->direction, aparms.idx);
+
+	return rc;
+}
+
+static int32_t
+ulp_mapper_em_tbl_process(struct bnxt_ulp_mapper_parms *parms,
+			  struct bnxt_ulp_mapper_class_tbl_info *tbl)
+{
+	struct bnxt_ulp_mapper_class_key_field_info	*kflds;
+	struct bnxt_ulp_mapper_result_field_info *dflds;
+	struct ulp_blob key, data;
+	uint32_t i, num_kflds, num_dflds;
+	uint16_t tmplen;
+	struct tf *tfp = bnxt_ulp_cntxt_tfp_get(parms->ulp_ctx);
+	struct ulp_rte_act_prop	 *a_prop = parms->act_prop;
+	struct ulp_flow_db_res_params	fid_parms = { 0 };
+	struct tf_insert_em_entry_parms iparms = { 0 };
+	struct tf_delete_em_entry_parms free_parms = { 0 };
+	int32_t	trc;
+	int32_t rc = 0;
+
+	kflds = ulp_mapper_key_fields_get(tbl, &num_kflds);
+	if (!kflds || !num_kflds) {
+		BNXT_TF_DBG(ERR, "Failed to get key fields\n");
+		return -EINVAL;
+	}
+
+	/* Initialize the key/result blobs */
+	if (!ulp_blob_init(&key, tbl->blob_key_bit_size, parms->order) ||
+	    !ulp_blob_init(&data, tbl->result_bit_size, parms->order)) {
+		BNXT_TF_DBG(ERR, "blob inits failed.\n");
+		return -EINVAL;
+	}
+
+	/* create the key */
+	for (i = 0; i < num_kflds; i++) {
+		/* Setup the key */
+		rc = ulp_mapper_keymask_field_process(parms, &kflds[i],
+						      &key, 1);
+		if (rc) {
+			BNXT_TF_DBG(ERR, "Key field set failed.\n");
+			return rc;
+		}
+	}
+
+	/*
+	 * TBD: Normally should process identifiers in case of using recycle or
+	 * loopback.  Not supporting recycle for now.
+	 */
+
+	/* Create the result data blob */
+	dflds = ulp_mapper_result_fields_get(tbl, &num_dflds);
+	if (!dflds || !num_dflds) {
+		BNXT_TF_DBG(ERR, "Failed to get data fields.\n");
+		return -EINVAL;
+	}
+
+	for (i = 0; i < num_dflds; i++) {
+		struct bnxt_ulp_mapper_result_field_info *fld;
+
+		fld = &dflds[i];
+
+		rc = ulp_mapper_result_field_process(parms,
+						     fld,
+						     &data);
+		if (rc) {
+			BNXT_TF_DBG(ERR, "Failed to set data fields.\n");
+			return rc;
+		}
+	}
+
+	rc = bnxt_ulp_cntxt_tbl_scope_id_get(parms->ulp_ctx,
+					     &iparms.tbl_scope_id);
+	if (rc) {
+		BNXT_TF_DBG(ERR, "Failed to get table scope rc=%d\n", rc);
+		return rc;
+	}
+
+	/*
+	 * NOTE: the actual blob size will differ from the size in the tbl
+	 * entry due to the padding.
+	 */
+	iparms.dup_check		= 0;
+	iparms.dir			= tbl->direction;
+	iparms.mem			= tbl->mem;
+	iparms.key			= ulp_blob_data_get(&key, &tmplen);
+	iparms.key_sz_in_bits		= tbl->key_bit_size;
+	iparms.em_record		= ulp_blob_data_get(&data, &tmplen);
+	iparms.em_record_sz_in_bits	= tbl->result_bit_size;
+
+	rc = tf_insert_em_entry(tfp, &iparms);
+	if (rc) {
+		BNXT_TF_DBG(ERR, "Failed to insert em entry rc=%d.\n", rc);
+		return rc;
+	}
+
+	if (tbl->mark_enable &&
+	    ULP_BITMAP_ISSET(parms->act_bitmap->bits,
+			     BNXT_ULP_ACTION_BIT_MARK)) {
+		uint32_t val, mark, gfid, flag;
+		/* TBD: Need to determine if GFID is enabled globally */
+		if (sizeof(val) != BNXT_ULP_ACT_PROP_SZ_MARK) {
+			BNXT_TF_DBG(ERR, "Mark size (%d) != expected (%zu)\n",
+				    BNXT_ULP_ACT_PROP_SZ_MARK, sizeof(val));
+			rc = -EINVAL;
+			goto error;
+		}
+
+		memcpy(&val,
+		       &a_prop->act_details[BNXT_ULP_ACT_PROP_IDX_MARK],
+		       sizeof(val));
+
+		mark = tfp_be_to_cpu_32(val);
+
+		TF_GET_GFID_FROM_FLOW_ID(iparms.flow_id, gfid);
+		TF_GET_FLAG_FROM_FLOW_ID(iparms.flow_id, flag);
+
+		rc = ulp_mark_db_mark_add(parms->ulp_ctx,
+					  (flag == TF_GFID_TABLE_EXTERNAL),
+					  gfid,
+					  mark);
+		if (rc) {
+			BNXT_TF_DBG(ERR, "Failed to add mark to flow\n");
+			goto error;
+		}
+
+		/*
+		 * Link the mark resource to the flow in the flow db
+		 * The mark is never the critical resource, so it is 0.
+		 */
+		memset(&fid_parms, 0, sizeof(fid_parms));
+		fid_parms.direction	= tbl->direction;
+		fid_parms.resource_func	= BNXT_ULP_RESOURCE_FUNC_HW_FID;
+		fid_parms.resource_type	= tbl->table_type;
+		fid_parms.resource_hndl	= iparms.flow_id;
+		fid_parms.critical_resource = 0;
+
+		rc = ulp_flow_db_resource_add(parms->ulp_ctx,
+					      parms->tbl_idx,
+					      parms->fid,
+					      &fid_parms);
+		if (rc) {
+			BNXT_TF_DBG(ERR, "Fail to link res to flow rc = %d\n",
+				    rc);
+			/* Need to free the identifier, so goto error */
+			goto error;
+		}
+	}
+
+	/* Link the EM resource to the flow in the flow db */
+	memset(&fid_parms, 0, sizeof(fid_parms));
+	fid_parms.direction		= tbl->direction;
+	fid_parms.resource_func		= tbl->resource_func;
+	fid_parms.resource_type		= tbl->table_type;
+	fid_parms.critical_resource	= tbl->critical_resource;
+	fid_parms.resource_hndl		= iparms.flow_handle;
+
+	rc = ulp_flow_db_resource_add(parms->ulp_ctx,
+				      parms->tbl_idx,
+				      parms->fid,
+				      &fid_parms);
+	if (rc) {
+		BNXT_TF_DBG(ERR, "Fail to link res to flow rc = %d\n",
+			    rc);
+		/* Need to free the identifier, so goto error */
+		goto error;
+	}
+
+	return 0;
+error:
+	free_parms.dir		= iparms.dir;
+	free_parms.mem		= iparms.mem;
+	free_parms.tbl_scope_id	= iparms.tbl_scope_id;
+	free_parms.flow_handle	= iparms.flow_handle;
+
+	trc = tf_delete_em_entry(tfp, &free_parms);
+	if (trc)
+		BNXT_TF_DBG(ERR, "Failed to delete EM entry on failed add\n");
+
+	return rc;
+}
+
+static int32_t
+ulp_mapper_index_tbl_process(struct bnxt_ulp_mapper_parms *parms,
+			     struct bnxt_ulp_mapper_class_tbl_info *tbl)
+{
+	struct bnxt_ulp_mapper_result_field_info *flds;
+	struct ulp_flow_db_res_params	fid_parms;
+	struct ulp_blob	data;
+	uint64_t idx;
+	uint16_t tmplen;
+	uint32_t i, num_flds;
+	int32_t rc = 0, trc = 0;
+	struct tf_alloc_tbl_entry_parms	aparms = { 0 };
+	struct tf_set_tbl_entry_parms	sparms = { 0 };
+	struct tf_free_tbl_entry_parms	free_parms = { 0 };
+
+	struct tf *tfp = bnxt_ulp_cntxt_tfp_get(parms->ulp_ctx);
+
+	if (!ulp_blob_init(&data, tbl->result_bit_size, parms->order)) {
+		BNXT_TF_DBG(ERR, "Failed initial index table blob\n");
+		return -EINVAL;
+	}
+
+	flds = ulp_mapper_result_fields_get(tbl, &num_flds);
+	if (!flds || !num_flds) {
+		BNXT_TF_DBG(ERR, "Template undefined for action\n");
+		return -EINVAL;
+	}
+
+	for (i = 0; i < num_flds; i++) {
+		rc = ulp_mapper_result_field_process(parms,
+						     &flds[i],
+						     &data);
+		if (rc) {
+			BNXT_TF_DBG(ERR, "data field failed\n");
+			return rc;
+		}
+	}
+
+	aparms.dir		= tbl->direction;
+	aparms.type		= tbl->table_type;
+	aparms.search_enable	= tbl->srch_b4_alloc;
+	aparms.result		= ulp_blob_data_get(&data, &tmplen);
+	aparms.result_sz_in_bytes = ULP_SZ_BITS2BYTES(tbl->result_bit_size);
+
+	/* All failures after the alloc succeeds require a free */
+	rc = tf_alloc_tbl_entry(tfp, &aparms);
+	if (rc) {
+		BNXT_TF_DBG(ERR, "Alloc table[%d][%s] failed rc=%d\n",
+			    tbl->table_type,
+			    (tbl->direction == TF_DIR_RX) ? "RX" : "TX",
+			    rc);
+		return rc;
+	}
+
+	/* Always storing values in Regfile in BE */
+	idx = tfp_cpu_to_be_64(aparms.idx);
+	rc = ulp_regfile_write(parms->regfile, tbl->regfile_wr_idx, idx);
+	if (!rc) {
+		BNXT_TF_DBG(ERR, "Write regfile[%d] failed\n",
+			    tbl->regfile_wr_idx);
+		goto error;
+	}
+
+	if (!tbl->srch_b4_alloc) {
+		sparms.dir		= tbl->direction;
+		sparms.type		= tbl->table_type;
+		sparms.data		= ulp_blob_data_get(&data, &tmplen);
+		sparms.data_sz_in_bytes =
+			ULP_SZ_BITS2BYTES(tbl->result_bit_size);
+		sparms.idx		= aparms.idx;
+
+		rc = tf_set_tbl_entry(tfp, &sparms);
+		if (rc) {
+			BNXT_TF_DBG(ERR, "Set table[%d][%s][%d] failed rc=%d\n",
+				    tbl->table_type,
+				    (tbl->direction == TF_DIR_RX) ? "RX" : "TX",
+				    sparms.idx,
+				    rc);
+
+			goto error;
+		}
+	}
+
+	/* Link the resource to the flow in the flow db */
+	memset(&fid_parms, 0, sizeof(fid_parms));
+	fid_parms.direction	= tbl->direction;
+	fid_parms.resource_func	= tbl->resource_func;
+	fid_parms.resource_type	= tbl->table_type;
+	fid_parms.resource_hndl	= aparms.idx;
+	fid_parms.critical_resource	= 0;
+
+	rc = ulp_flow_db_resource_add(parms->ulp_ctx,
+				      parms->tbl_idx,
+				      parms->fid,
+				      &fid_parms);
+	if (rc) {
+		BNXT_TF_DBG(ERR, "Failed to link resource to flow rc = %d\n",
+			    rc);
+		goto error;
+	}
+
+	return rc;
+error:
+	/*
+	 * Free the allocated resource since we failed to either
+	 * write to the entry or link the flow
+	 */
+	free_parms.dir	= tbl->direction;
+	free_parms.type	= tbl->table_type;
+	free_parms.idx	= aparms.idx;
+
+	trc = tf_free_tbl_entry(tfp, &free_parms);
+	if (trc)
+		BNXT_TF_DBG(ERR, "Failed to free tbl entry on failure\n");
+
+	return rc;
+}
+
 /*
  * Function to process the action template. Iterate through the list
  * action info templates and process it.
@@ -362,3 +1097,48 @@ ulp_mapper_action_tbls_process(struct bnxt_ulp_mapper_parms *parms)
 
 	return rc;
 }
+
+/* Create the classifier table entries for a flow. */
+int32_t
+ulp_mapper_class_tbls_process(struct bnxt_ulp_mapper_parms *parms)
+{
+	uint32_t	i;
+	int32_t		rc = 0;
+
+	if (!parms)
+		return -EINVAL;
+
+	if (!parms->ctbls || !parms->num_ctbls) {
+		BNXT_TF_DBG(ERR, "No class tables for template[%d][%d].\n",
+			    parms->dev_id, parms->class_tid);
+		return -EINVAL;
+	}
+
+	for (i = 0; i < parms->num_ctbls; i++) {
+		struct bnxt_ulp_mapper_class_tbl_info *tbl = &parms->ctbls[i];
+
+		switch (tbl->resource_func) {
+		case BNXT_ULP_RESOURCE_FUNC_TCAM_TABLE:
+			rc = ulp_mapper_tcam_tbl_process(parms, tbl);
+			break;
+		case BNXT_ULP_RESOURCE_FUNC_EM_TABLE:
+			rc = ulp_mapper_em_tbl_process(parms, tbl);
+			break;
+		case BNXT_ULP_RESOURCE_FUNC_INDEX_TABLE:
+			rc = ulp_mapper_index_tbl_process(parms, tbl);
+			break;
+		default:
+			BNXT_TF_DBG(ERR, "Unexpected class resource %d\n",
+				    tbl->resource_func);
+			return -EINVAL;
+		}
+
+		if (rc) {
+			BNXT_TF_DBG(ERR, "Resource type %d failed\n",
+				    tbl->resource_func);
+			return rc;
+		}
+	}
+
+	return rc;
+}
drivers/net/bnxt/tf_ulp/ulp_mapper.h +2 -0
index adbcec2..2221e12 100644
@@ -15,6 +15,8 @@
 #include "bnxt_ulp.h"
 #include "ulp_utils.h"
 
+#define ULP_SZ_BITS2BYTES(x) (((x) + 7) / 8)
+
 /* Internal Structure for passing the arguments around */
 struct bnxt_ulp_mapper_parms {
 	uint32_t				dev_id;
drivers/net/bnxt/tf_ulp/ulp_mark_mgr.c +79 -1

96 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_mark_mgr.h +18 -0
index 5948683..18abea4 100644
@@ -54,4 +54,22 @@ ulp_mark_db_init(struct bnxt_ulp_context *ctxt);
 int32_t
 ulp_mark_db_deinit(struct bnxt_ulp_context *ctxt);
 
+/*
+ * Adds a Mark to the Mark Manager
+ *
+ * ctxt [in] The ulp context for the mark manager
+ *
+ * is_gfid [in] The type of fid (GFID or LFID)
+ *
+ * fid [in] The flow id that is returned by HW in BD
+ *
+ * mark [in] The mark to be associated with the FID
+ *
+ */
+int32_t
+ulp_mark_db_mark_add(struct bnxt_ulp_context *ctxt,
+		     bool is_gfid,
+		     uint32_t gfid,
+		     uint32_t mark);
+
 #endif /* _ULP_MARK_MGR_H_ */
drivers/net/bnxt/tf_ulp/ulp_template_db.c +829 -0

841 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_template_db.h +141 -1

164 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_template_field_db.h new file +130 -0

130 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_template_struct.h +89 -4

130 lines not on this page · raw message

Signature · 1 line
2.7.4
#131 lore raw

PATCH v4 21/34 net/bnxt: add support to free key and action tables

In reply to Venkat Duvvuru

From: Mike Baucom <[email protected]>

This patch does the following
1. Gets all the flow resources from the flow id
2. Frees all the table resources
3. Frees the flow in the flow table

---
 drivers/net/bnxt/tf_ulp/ulp_flow_db.c  | 199 ++++++++++++++++++++++++++++++++-
 drivers/net/bnxt/tf_ulp/ulp_flow_db.h  |  30 +++++
 drivers/net/bnxt/tf_ulp/ulp_mapper.c   | 193 ++++++++++++++++++++++++++++++++
 drivers/net/bnxt/tf_ulp/ulp_mapper.h   |  13 +++
 drivers/net/bnxt/tf_ulp/ulp_mark_mgr.c |  23 +++-
 drivers/net/bnxt/tf_ulp/ulp_mark_mgr.h |  18 +++
 6 files changed, 474 insertions(+), 2 deletions(-)
drivers/net/bnxt/tf_ulp/ulp_flow_db.c +198 -1
index 6e73f25..eecee6b 100644
@@ -23,6 +23,32 @@
 #define ULP_FLOW_DB_RES_NXT_RESET(dst)	((dst) &= ~(ULP_FLOW_DB_RES_NXT_MASK))
 
 /*
+ * Helper function to set the bit in the active flow table
+ * No validation is done in this function.
+ *
+ * flow_tbl [in] Ptr to flow table
+ * idx [in] The index to bit to be set or reset.
+ * flag [in] 1 to set and 0 to reset.
+ *
+ * returns none
+ */
+static void
+ulp_flow_db_active_flow_set(struct bnxt_ulp_flow_tbl	*flow_tbl,
+			    uint32_t			idx,
+			    uint32_t			flag)
+{
+	uint32_t		active_index;
+
+	active_index = idx / ULP_INDEX_BITMAP_SIZE;
+	if (flag)
+		ULP_INDEX_BITMAP_SET(flow_tbl->active_flow_tbl[active_index],
+				     idx);
+	else
+		ULP_INDEX_BITMAP_RESET(flow_tbl->active_flow_tbl[active_index],
+				       idx);
+}
+
+/*
  * Helper function to allocate the flow table and initialize
  *  is set.No validation being done in this function.
  *
@@ -71,6 +97,35 @@ ulp_flow_db_res_params_to_info(struct ulp_fdb_resource_info   *resource_info,
 }
 
 /*
+ * Helper function to copy the resource params to resource info
+ *  No validation being done in this function.
+ *
+ * resource_info [in] Ptr to resource information
+ * params [out] The output params to the caller
+ *
+ * returns none
+ */
+static void
+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);
+	params->resource_func = ((resource_info->nxt_resource_idx &
+				 ULP_FLOW_DB_RES_FUNC_MASK) >>
+				 ULP_FLOW_DB_RES_FUNC_BITS);
+
+	if (params->resource_func != BNXT_ULP_RESOURCE_FUNC_EM_TABLE) {
+		params->resource_hndl = resource_info->resource_hndl;
+		params->resource_type = resource_info->resource_type;
+	} else {
+		params->resource_hndl = resource_info->resource_em_handle;
+	}
+}
+
+/*
  * Helper function to allocate the flow table and initialize
  * the stack for allocation operations.
  *
@@ -122,7 +177,7 @@ ulp_flow_db_alloc_resource(struct bnxt_ulp_flow_db *flow_db,
 }
 
 /*
- * Helper function to de allocate the flow table.
+ * Helper function to deallocate the flow table.
  *
  * flow_db [in] Ptr to flow database structure
  * tbl_idx [in] The index to table creation.
@@ -321,3 +376,145 @@ int32_t	ulp_flow_db_resource_add(struct bnxt_ulp_context	*ulp_ctxt,
 	/* all good, return success */
 	return 0;
 }
+
+/*
+ * Free the flow database entry.
+ * The params->critical_resource has to be set to 1 to free the first resource.
+ *
+ * ulp_ctxt [in] Ptr to ulp_context
+ * tbl_idx [in] Specify it is regular or default flow
+ * fid [in] The index to the flow entry
+ * params [in/out] The contents to be copied into params.
+ * Onlythe critical_resource needs to be set by the caller.
+ *
+ * Returns 0 on success and negative on failure.
+ */
+int32_t	ulp_flow_db_resource_del(struct bnxt_ulp_context	*ulp_ctxt,
+				 enum bnxt_ulp_flow_db_tables	tbl_idx,
+				 uint32_t			fid,
+				 struct ulp_flow_db_res_params	*params)
+{
+	struct bnxt_ulp_flow_db		*flow_db;
+	struct bnxt_ulp_flow_tbl	*flow_tbl;
+	struct ulp_fdb_resource_info	*nxt_resource, *fid_resource;
+	uint32_t			nxt_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;
+	}
+
+	if (tbl_idx >= BNXT_ULP_FLOW_TABLE_MAX) {
+		BNXT_TF_DBG(ERR, "Invalid table index\n");
+		return -EINVAL;
+	}
+	flow_tbl = &flow_db->flow_tbl[tbl_idx];
+
+	/* check for max flows */
+	if (fid >= flow_tbl->num_flows || !fid) {
+		BNXT_TF_DBG(ERR, "Invalid flow index\n");
+		return -EINVAL;
+	}
+
+	/* check if the flow is active or not */
+	if (!ulp_flow_db_active_flow_is_set(flow_tbl, fid)) {
+		BNXT_TF_DBG(ERR, "flow does not exist\n");
+		return -EINVAL;
+	}
+
+	fid_resource = &flow_tbl->flow_resources[fid];
+	if (!params->critical_resource) {
+		/* Not the critical resource so free the resource */
+		ULP_FLOW_DB_RES_NXT_SET(nxt_idx,
+					fid_resource->nxt_resource_idx);
+		if (!nxt_idx) {
+			/* reached end of resources */
+			return -ENOENT;
+		}
+		nxt_resource = &flow_tbl->flow_resources[nxt_idx];
+
+		/* connect the fid resource to the next resource */
+		ULP_FLOW_DB_RES_NXT_RESET(fid_resource->nxt_resource_idx);
+		ULP_FLOW_DB_RES_NXT_SET(fid_resource->nxt_resource_idx,
+					nxt_resource->nxt_resource_idx);
+
+		/* update the contents to be given to caller */
+		ulp_flow_db_res_info_to_params(nxt_resource, params);
+
+		/* Delete the nxt_resource */
+		memset(nxt_resource, 0, sizeof(struct ulp_fdb_resource_info));
+
+		/* add it to the free list */
+		flow_tbl->tail_index++;
+		if (flow_tbl->tail_index >= flow_tbl->num_resources) {
+			BNXT_TF_DBG(ERR, "FlowDB:Tail reached max\n");
+			return -ENOENT;
+		}
+		flow_tbl->flow_tbl_stack[flow_tbl->tail_index] = nxt_idx;
+
+	} else {
+		/* Critical resource. copy the contents and exit */
+		ulp_flow_db_res_info_to_params(fid_resource, params);
+		ULP_FLOW_DB_RES_NXT_SET(nxt_idx,
+					fid_resource->nxt_resource_idx);
+		memset(fid_resource, 0, sizeof(struct ulp_fdb_resource_info));
+		ULP_FLOW_DB_RES_NXT_SET(fid_resource->nxt_resource_idx,
+					nxt_idx);
+	}
+
+	/* all good, return success */
+	return 0;
+}
+
+/*
+ * Free the flow database entry
+ *
+ * ulp_ctxt [in] Ptr to ulp_context
+ * tbl_idx [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_fid_free(struct bnxt_ulp_context		*ulp_ctxt,
+			     enum bnxt_ulp_flow_db_tables	tbl_idx,
+			     uint32_t				fid)
+{
+	struct bnxt_ulp_flow_db		*flow_db;
+	struct bnxt_ulp_flow_tbl	*flow_tbl;
+
+	flow_db = bnxt_ulp_cntxt_ptr2_flow_db_get(ulp_ctxt);
+	if (!flow_db) {
+		BNXT_TF_DBG(ERR, "Invalid Arguments\n");
+		return -EINVAL;
+	}
+
+	if (tbl_idx >= BNXT_ULP_FLOW_TABLE_MAX) {
+		BNXT_TF_DBG(ERR, "Invalid table index\n");
+		return -EINVAL;
+	}
+
+	flow_tbl = &flow_db->flow_tbl[tbl_idx];
+
+	/* check for limits of fid */
+	if (fid >= flow_tbl->num_flows || !fid) {
+		BNXT_TF_DBG(ERR, "Invalid flow index\n");
+		return -EINVAL;
+	}
+
+	/* check if the flow is active or not */
+	if (!ulp_flow_db_active_flow_is_set(flow_tbl, fid)) {
+		BNXT_TF_DBG(ERR, "flow does not exist\n");
+		return -EINVAL;
+	}
+	flow_tbl->head_index--;
+	if (!flow_tbl->head_index) {
+		BNXT_TF_DBG(ERR, "FlowDB: Head Ptr is zero\n");
+		return -ENOENT;
+	}
+	flow_tbl->flow_tbl_stack[flow_tbl->head_index] = fid;
+	ulp_flow_db_active_flow_set(flow_tbl, fid, 0);
+
+	/* all good, return success */
+	return 0;
+}
drivers/net/bnxt/tf_ulp/ulp_flow_db.h +30 -0
index f6055a5..20109b9 100644
@@ -99,4 +99,34 @@ int32_t	ulp_flow_db_resource_add(struct bnxt_ulp_context	*ulp_ctxt,
 				 uint32_t			fid,
 				 struct ulp_flow_db_res_params	*params);
 
+/*
+ * Free the flow database entry.
+ * The params->critical_resource has to be set to 1 to free the first resource.
+ *
+ * ulp_ctxt [in] Ptr to ulp_context
+ * tbl_idx [in] Specify it is regular or default flow
+ * fid [in] The index to the flow entry
+ * params [in/out] The contents to be copied into params.
+ * Only the critical_resource needs to be set by the caller.
+ *
+ * Returns 0 on success and negative on failure.
+ */
+int32_t	ulp_flow_db_resource_del(struct bnxt_ulp_context	*ulp_ctxt,
+				 enum bnxt_ulp_flow_db_tables	tbl_idx,
+				 uint32_t			fid,
+				 struct ulp_flow_db_res_params	*params);
+
+/*
+ * Free the flow database entry
+ *
+ * ulp_ctxt [in] Ptr to ulp_context
+ * tbl_idx [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_fid_free(struct bnxt_ulp_context		*ulp_ctxt,
+			     enum bnxt_ulp_flow_db_tables	tbl_idx,
+			     uint32_t				fid);
+
 #endif /* _ULP_FLOW_DB_H_ */
drivers/net/bnxt/tf_ulp/ulp_mapper.c +193 -0

202 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_mapper.h +13 -0
index 2221e12..8655728 100644
@@ -38,4 +38,17 @@ struct bnxt_ulp_mapper_parms {
 	enum bnxt_ulp_flow_db_tables		tbl_idx;
 };
 
+/* Function that frees all resources associated with the flow. */
+int32_t
+ulp_mapper_flow_destroy(struct bnxt_ulp_context	*ulp_ctx, 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);
+
 #endif /* _ULP_MAPPER_H_ */
drivers/net/bnxt/tf_ulp/ulp_mark_mgr.c +22 -1
index 837064e..566668e 100644
@@ -135,7 +135,7 @@ ulp_mark_db_init(struct bnxt_ulp_context *ctxt)
 		    mark_tbl->gfid_max,
 		    mark_tbl->gfid_mask);
 
-	/* Add the mart tbl to the ulp context. */
+	/* Add the mark tbl to the ulp context. */
 	bnxt_ulp_cntxt_ptr2_mark_db_set(ctxt, mark_tbl);
 
 	return 0;
@@ -195,3 +195,24 @@ ulp_mark_db_mark_add(struct bnxt_ulp_context *ctxt,
 {
 	return ulp_mark_db_mark_set(ctxt, is_gfid, gfid, mark);
 }
+
+/*
+ * Removes a Mark from the Mark Manager
+ *
+ * ctxt [in] The ulp context for the mark manager
+ *
+ * is_gfid [in] The type of fid (GFID or LFID)
+ *
+ * fid [in] The flow id that is returned by HW in BD
+ *
+ * mark [in] The mark to be associated with the FID
+ *
+ */
+int32_t
+ulp_mark_db_mark_del(struct bnxt_ulp_context *ctxt,
+		     bool is_gfid,
+		     uint32_t gfid,
+		     uint32_t mark  __rte_unused)
+{
+	return ulp_mark_db_mark_set(ctxt, is_gfid, gfid, ULP_MARK_INVALID);
+}
drivers/net/bnxt/tf_ulp/ulp_mark_mgr.h +18 -0
index 18abea4..f0d1515 100644
@@ -72,4 +72,22 @@ ulp_mark_db_mark_add(struct bnxt_ulp_context *ctxt,
 		     uint32_t gfid,
 		     uint32_t mark);
 
+/*
+ * Removes a Mark from the Mark Manager
+ *
+ * ctxt [in] The ulp context for the mark manager
+ *
+ * is_gfid [in] The type of fid (GFID or LFID)
+ *
+ * fid [in] The flow id that is returned by HW in BD
+ *
+ * mark [in] The mark to be associated with the FID
+ *
+ */
+int32_t
+ulp_mark_db_mark_del(struct bnxt_ulp_context *ctxt,
+		     bool is_gfid,
+		     uint32_t gfid,
+		     uint32_t mark);
+
 #endif /* _ULP_MARK_MGR_H_ */
Signature · 1 line
2.7.4
#132 lore raw

PATCH v4 22/34 net/bnxt: add support to alloc and program key and act tbls

In reply to Venkat Duvvuru

From: Mike Baucom <[email protected]>

This patch does the following
1. Gets the action tables information from the action template id
2. Gets the class tables information from the class template id
3. Initializes the registry file
4. Allocates a flow id from the flow table
5. Process the class & action tables

---
 drivers/net/bnxt/tf_ulp/ulp_flow_db.c         |  37 +++++
 drivers/net/bnxt/tf_ulp/ulp_flow_db.h         |  13 ++
 drivers/net/bnxt/tf_ulp/ulp_mapper.c          | 196 ++++++++++++++++++++++++--
 drivers/net/bnxt/tf_ulp/ulp_mapper.h          |  15 ++
 drivers/net/bnxt/tf_ulp/ulp_template_db.c     |  90 ++++++++++++
 drivers/net/bnxt/tf_ulp/ulp_template_db.h     |   7 +
 drivers/net/bnxt/tf_ulp/ulp_template_struct.h |  31 +++-
 7 files changed, 378 insertions(+), 11 deletions(-)
drivers/net/bnxt/tf_ulp/ulp_flow_db.c +37 -0
index eecee6b..ee703a1 100644
@@ -303,6 +303,43 @@ int32_t	ulp_flow_db_deinit(struct bnxt_ulp_context *ulp_ctxt)
 }
 
 /*
+ * Allocate the flow database entry
+ *
+ * ulp_ctxt [in] Ptr to ulp_context
+ * tbl_idx [in] Specify it is regular or default flow
+ * fid [out] The index to the flow entry
+ *
+ * returns 0 on success and negative on failure.
+ */
+int32_t ulp_flow_db_fid_alloc(struct bnxt_ulp_context		*ulp_ctxt,
+			      enum bnxt_ulp_flow_db_tables	tbl_idx,
+			      uint32_t				*fid)
+{
+	struct bnxt_ulp_flow_db		*flow_db;
+	struct bnxt_ulp_flow_tbl	*flow_tbl;
+
+	*fid = 0; /* Initialize fid to invalid value */
+	flow_db = bnxt_ulp_cntxt_ptr2_flow_db_get(ulp_ctxt);
+	if (!flow_db) {
+		BNXT_TF_DBG(ERR, "Invalid Arguments\n");
+		return -EINVAL;
+	}
+
+	flow_tbl = &flow_db->flow_tbl[tbl_idx];
+	/* check for max flows */
+	if (flow_tbl->num_flows <= flow_tbl->head_index) {
+		BNXT_TF_DBG(ERR, "Flow database has reached max flows\n");
+		return -ENOMEM;
+	}
+	*fid = flow_tbl->flow_tbl_stack[flow_tbl->head_index];
+	flow_tbl->head_index++;
+	ulp_flow_db_active_flow_set(flow_tbl, *fid, 1);
+
+	/* all good, return success */
+	return 0;
+}
+
+/*
  * Allocate the flow database entry.
  * The params->critical_resource has to be set to 0 to allocate a new resource.
  *
drivers/net/bnxt/tf_ulp/ulp_flow_db.h +13 -0
index 20109b9..eb5effa 100644
@@ -84,6 +84,19 @@ int32_t	ulp_flow_db_init(struct bnxt_ulp_context *ulp_ctxt);
 int32_t	ulp_flow_db_deinit(struct bnxt_ulp_context *ulp_ctxt);
 
 /*
+ * Allocate the flow database entry
+ *
+ * ulp_ctxt [in] Ptr to ulp_context
+ * tbl_idx [in] Specify it is regular or default flow
+ * fid [out] The index to the flow entry
+ *
+ * returns 0 on success and negative on failure.
+ */
+int32_t ulp_flow_db_fid_alloc(struct bnxt_ulp_context		*ulp_ctxt,
+			      enum bnxt_ulp_flow_db_tables	tbl_idx,
+			      uint32_t				*fid);
+
+/*
  * Allocate the flow database entry.
  * The params->critical_resource has to be set to 0 to allocate a new resource.
  *
drivers/net/bnxt/tf_ulp/ulp_mapper.c +186 -10

229 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_mapper.h +15 -0
index 8655728..5f3d46e 100644
@@ -38,6 +38,21 @@ struct bnxt_ulp_mapper_parms {
 	enum bnxt_ulp_flow_db_tables		tbl_idx;
 };
 
+/*
+ * Function to handle the mapping of the Flow to be compatible
+ * with the underlying hardware.
+ */
+int32_t
+ulp_mapper_flow_create(struct bnxt_ulp_context	*ulp_ctx,
+		       uint32_t		app_priority,
+		       struct ulp_rte_hdr_bitmap  *hdr_bitmap,
+		       struct ulp_rte_hdr_field *hdr_field,
+		       struct ulp_rte_act_bitmap *act,
+		       struct ulp_rte_act_prop *act_prop,
+		       uint32_t		class_tid,
+		       uint32_t		act_tid,
+		       uint32_t		*flow_id);
+
 /* Function that frees all resources associated with the flow. */
 int32_t
 ulp_mapper_flow_destroy(struct bnxt_ulp_context	*ulp_ctx, uint32_t fid);
drivers/net/bnxt/tf_ulp/ulp_template_db.c +90 -0

102 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_template_db.h +7 -0
index 733836a..957b21a 100644
@@ -12,6 +12,7 @@
 #define ULP_TEMPLATE_DB_H_
 
 #define BNXT_ULP_MAX_NUM_DEVICES 4
+#define BNXT_ULP_LOG2_MAX_NUM_DEV 2
 
 enum bnxt_ulp_action_bit {
 	BNXT_ULP_ACTION_BIT_MARK             = 0x0000000000000001,
@@ -127,6 +128,12 @@ enum bnxt_ulp_result_opc {
 	BNXT_ULP_RESULT_OPC_LAST = 4
 };
 
+enum bnxt_ulp_search_before_alloc {
+	BNXT_ULP_SEARCH_BEFORE_ALLOC_NO = 0,
+	BNXT_ULP_SEARCH_BEFORE_ALLOC_YES = 1,
+	BNXT_ULP_SEARCH_BEFORE_ALLOC_LAST = 2
+};
+
 enum bnxt_ulp_spec_opc {
 	BNXT_ULP_SPEC_OPC_SET_TO_CONSTANT = 0,
 	BNXT_ULP_SPEC_OPC_SET_TO_HDR_FIELD = 1,
drivers/net/bnxt/tf_ulp/ulp_template_struct.h +30 -1
index e28d049..b7094c5 100644
@@ -17,6 +17,10 @@
 #include "rte_flow.h"
 #include "tf_core.h"
 
+struct ulp_rte_hdr_bitmap {
+	uint64_t	bits;
+};
+
 /* Structure to store the protocol fields */
 #define RTE_PARSER_FLOW_HDR_FIELD_SIZE		16
 struct ulp_rte_hdr_field {
@@ -51,6 +55,13 @@ struct bnxt_ulp_device_params {
 	uint32_t			num_resources_per_flow;
 };
 
+/* Flow Mapper */
+struct bnxt_ulp_mapper_tbl_list_info {
+	uint32_t	device_name;
+	uint32_t	start_tbl_idx;
+	uint32_t	num_tbls;
+};
+
 struct bnxt_ulp_mapper_class_tbl_info {
 	enum bnxt_ulp_resource_func	resource_func;
 	uint32_t	table_type;
@@ -132,7 +143,25 @@ struct bnxt_ulp_mapper_ident_info {
 extern struct bnxt_ulp_device_params ulp_device_params[];
 
 /*
- * The ulp_data_field_list provides the instructions for creating an action
+ * The ulp_class_tmpl_list and ulp_act_tmpl_list are indexed by the dev_id
+ * and template id (either class or action) returned by the matcher.
+ * The result provides the start index and number of entries in the connected
+ * ulp_class_tbl_list/ulp_act_tbl_list.
+ */
+extern struct bnxt_ulp_mapper_tbl_list_info	ulp_class_tmpl_list[];
+extern struct bnxt_ulp_mapper_tbl_list_info	ulp_act_tmpl_list[];
+
+/*
+ * The ulp_class_tbl_list and ulp_act_tbl_list are indexed based on the results
+ * of the template lists.  Each entry describes the high level details of the
+ * table entry to include the start index and number of instructions in the
+ * field lists.
+ */
+extern struct bnxt_ulp_mapper_class_tbl_info	ulp_class_tbl_list[];
+extern struct bnxt_ulp_mapper_act_tbl_info	ulp_act_tbl_list[];
+
+/*
+ * The ulp_class_result_field_list provides the instructions for creating result
  * records such as tcam/em results.
  */
 extern struct bnxt_ulp_mapper_result_field_info	ulp_class_result_field_list[];
Signature · 1 line
2.7.4
#133 lore raw

PATCH v4 23/34 net/bnxt: match rte flow items with flow template patterns

In reply to Venkat Duvvuru

From: Kishore Padmanabha <[email protected]>

This patch does the following
1. Takes hdr_bitmap generated from the rte_flow_items
2. Iterates through the static hdr_bitmap list
3. Returns success if a match is found, otherwise an error

---
 drivers/net/bnxt/Makefile                     |   1 +
 drivers/net/bnxt/tf_ulp/bnxt_tf_common.h      |  12 ++
 drivers/net/bnxt/tf_ulp/ulp_matcher.c         | 152 ++++++++++++++++++++++++++
 drivers/net/bnxt/tf_ulp/ulp_matcher.h         |  26 +++++
 drivers/net/bnxt/tf_ulp/ulp_template_db.c     | 115 +++++++++++++++++++
 drivers/net/bnxt/tf_ulp/ulp_template_db.h     |  40 +++++++
 drivers/net/bnxt/tf_ulp/ulp_template_struct.h |  21 ++++
 7 files changed, 367 insertions(+)
 create mode 100644 drivers/net/bnxt/tf_ulp/ulp_matcher.c
 create mode 100644 drivers/net/bnxt/tf_ulp/ulp_matcher.h
drivers/net/bnxt/Makefile +1 -0
index f464d9e..455fd5c 100644
@@ -63,6 +63,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += tf_ulp/ulp_flow_db.c
 SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += tf_ulp/ulp_template_db.c
 SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += tf_ulp/ulp_utils.c
 SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += tf_ulp/ulp_mapper.c
+SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += tf_ulp/ulp_matcher.c
 
 #
 # Export include files
drivers/net/bnxt/tf_ulp/bnxt_tf_common.h +12 -0
index 3516df4..e4ebfc5 100644
@@ -25,6 +25,18 @@
 #define	BNXT_ULP_TX_NUM_FLOWS			32
 #define	BNXT_ULP_TX_TBL_IF_ID			0
 
+enum bnxt_tf_rc {
+	BNXT_TF_RC_PARSE_ERR	= -2,
+	BNXT_TF_RC_ERROR	= -1,
+	BNXT_TF_RC_SUCCESS	= 0
+};
+
+/* ulp direction Type */
+enum ulp_direction_type {
+	ULP_DIR_INGRESS,
+	ULP_DIR_EGRESS,
+};
+
 struct bnxt_ulp_mark_tbl *
 bnxt_ulp_cntxt_ptr2_mark_db_get(struct bnxt_ulp_context *ulp_ctx);
 
drivers/net/bnxt/tf_ulp/ulp_matcher.c new file +152 -0

152 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_matcher.h new file +26 -0
new file mode 100644
index 0000000..57a161d
@@ -0,0 +1,26 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2014-2020 Broadcom
+ * All rights reserved.
+ */
+
+#ifndef ULP_MATCHER_H_
+#define ULP_MATCHER_H_
+
+#include <rte_log.h>
+#include "bnxt.h"
+#include "ulp_template_db.h"
+#include "ulp_template_struct.h"
+#include "bnxt_tf_common.h"
+
+/*
+ * Function to handle the matching of RTE Flows and validating
+ * the pattern masks against the flow templates.
+ */
+int32_t
+ulp_matcher_pattern_match(enum ulp_direction_type	    dir,
+			  struct ulp_rte_hdr_bitmap	   *hdr_bitmap,
+			  struct ulp_rte_hdr_field	   *hdr_field,
+			  struct ulp_rte_act_bitmap	   *act_bitmap,
+			  uint32_t			   *class_id);
+
+#endif /* ULP_MATCHER_H_ */
drivers/net/bnxt/tf_ulp/ulp_template_db.c +115 -0

121 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_template_db.h +40 -0
index 957b21a..319500a 100644
@@ -13,6 +13,8 @@
 
 #define BNXT_ULP_MAX_NUM_DEVICES 4
 #define BNXT_ULP_LOG2_MAX_NUM_DEV 2
+#define BNXT_ULP_INGRESS_HDR_MATCH_SZ 2
+#define BNXT_ULP_EGRESS_HDR_MATCH_SZ 1
 
 enum bnxt_ulp_action_bit {
 	BNXT_ULP_ACTION_BIT_MARK             = 0x0000000000000001,
@@ -45,6 +47,31 @@ enum bnxt_ulp_action_bit {
 	BNXT_ULP_ACTION_BIT_LAST             = 0x0000000008000000
 };
 
+enum bnxt_ulp_hdr_bit {
+	BNXT_ULP_HDR_BIT_SVIF                = 0x0000000000000001,
+	BNXT_ULP_HDR_BIT_O_ETH               = 0x0000000000000002,
+	BNXT_ULP_HDR_BIT_OO_VLAN             = 0x0000000000000004,
+	BNXT_ULP_HDR_BIT_OI_VLAN             = 0x0000000000000008,
+	BNXT_ULP_HDR_BIT_O_L3                = 0x0000000000000010,
+	BNXT_ULP_HDR_BIT_O_IPV4              = 0x0000000000000020,
+	BNXT_ULP_HDR_BIT_O_IPV6              = 0x0000000000000040,
+	BNXT_ULP_HDR_BIT_O_L4                = 0x0000000000000080,
+	BNXT_ULP_HDR_BIT_O_TCP               = 0x0000000000000100,
+	BNXT_ULP_HDR_BIT_O_UDP               = 0x0000000000000200,
+	BNXT_ULP_HDR_BIT_T_VXLAN             = 0x0000000000000400,
+	BNXT_ULP_HDR_BIT_T_GRE               = 0x0000000000000800,
+	BNXT_ULP_HDR_BIT_I_ETH               = 0x0000000000001000,
+	BNXT_ULP_HDR_BIT_IO_VLAN             = 0x0000000000002000,
+	BNXT_ULP_HDR_BIT_II_VLAN             = 0x0000000000004000,
+	BNXT_ULP_HDR_BIT_I_L3                = 0x0000000000008000,
+	BNXT_ULP_HDR_BIT_I_IPV4              = 0x0000000000010000,
+	BNXT_ULP_HDR_BIT_I_IPV6              = 0x0000000000020000,
+	BNXT_ULP_HDR_BIT_I_L4                = 0x0000000000040000,
+	BNXT_ULP_HDR_BIT_I_TCP               = 0x0000000000080000,
+	BNXT_ULP_HDR_BIT_I_UDP               = 0x0000000000100000,
+	BNXT_ULP_HDR_BIT_LAST                = 0x0000000000200000
+};
+
 enum bnxt_ulp_byte_order {
 	BNXT_ULP_BYTE_ORDER_BE,
 	BNXT_ULP_BYTE_ORDER_LE,
@@ -67,12 +94,25 @@ enum bnxt_ulp_fmf_mask {
 	BNXT_ULP_FMF_MASK_LAST
 };
 
+enum bnxt_ulp_fmf_spec {
+	BNXT_ULP_FMF_SPEC_IGNORE = 0,
+	BNXT_ULP_FMF_SPEC_LAST = 1
+};
+
 enum bnxt_ulp_mark_enable {
 	BNXT_ULP_MARK_ENABLE_NO = 0,
 	BNXT_ULP_MARK_ENABLE_YES = 1,
 	BNXT_ULP_MARK_ENABLE_LAST = 2
 };
 
+enum bnxt_ulp_hdr_field {
+	BNXT_ULP_HDR_FIELD_MPLS_TAG_NUM = 0,
+	BNXT_ULP_HDR_FIELD_O_VTAG_NUM = 1,
+	BNXT_ULP_HDR_FIELD_I_VTAG_NUM = 2,
+	BNXT_ULP_HDR_FIELD_SVIF_INDEX = 3,
+	BNXT_ULP_HDR_FIELD_LAST = 4
+};
+
 enum bnxt_ulp_mask_opc {
 	BNXT_ULP_MASK_OPC_SET_TO_CONSTANT = 0,
 	BNXT_ULP_MASK_OPC_SET_TO_HDR_FIELD = 1,
drivers/net/bnxt/tf_ulp/ulp_template_struct.h +21 -0
index b7094c5..dd06fb1 100644
@@ -29,6 +29,11 @@ struct ulp_rte_hdr_field {
 	uint32_t	size;
 };
 
+struct bnxt_ulp_matcher_field_info {
+	enum bnxt_ulp_fmf_mask	mask_opcode;
+	enum bnxt_ulp_fmf_spec	spec_opcode;
+};
+
 struct ulp_rte_act_bitmap {
 	uint64_t	bits;
 };
@@ -41,6 +46,22 @@ struct ulp_rte_act_prop {
 	uint8_t	act_details[BNXT_ULP_ACT_PROP_IDX_LAST];
 };
 
+/* Flow Matcher structures */
+struct bnxt_ulp_header_match_info {
+	struct ulp_rte_hdr_bitmap		hdr_bitmap;
+	uint32_t				start_idx;
+	uint32_t				num_entries;
+	uint32_t				class_tmpl_id;
+	uint32_t				act_vnic;
+};
+
+/* Flow Matcher templates Structure Array defined in template source*/
+extern struct bnxt_ulp_header_match_info  ulp_ingress_hdr_match_list[];
+extern struct bnxt_ulp_header_match_info  ulp_egress_hdr_match_list[];
+
+/* Flow field match Information Structure Array defined in template source*/
+extern struct bnxt_ulp_matcher_field_info	ulp_field_match[];
+
 /* Device specific parameters */
 struct bnxt_ulp_device_params {
 	uint8_t				description[16];
Signature · 1 line
2.7.4
#134 lore raw

PATCH v4 24/34 net/bnxt: match rte flow actions with flow template actions

In reply to Venkat Duvvuru

From: Kishore Padmanabha <[email protected]>

This patch does the following
1. Takes act_bitmap generated from the rte_flow_actions
2. Iterates through the static act_bitmap list
3. Returns success if a match is found, otherwise an error

---
 drivers/net/bnxt/tf_ulp/ulp_matcher.c         | 36 +++++++++++++++++++++++++++
 drivers/net/bnxt/tf_ulp/ulp_matcher.h         |  9 +++++++
 drivers/net/bnxt/tf_ulp/ulp_template_db.c     | 12 +++++++++
 drivers/net/bnxt/tf_ulp/ulp_template_db.h     |  2 ++
 drivers/net/bnxt/tf_ulp/ulp_template_struct.h | 10 ++++++++
 5 files changed, 69 insertions(+)
drivers/net/bnxt/tf_ulp/ulp_matcher.c +36 -0
index f367e4c..ec4121d 100644
@@ -150,3 +150,39 @@ ulp_matcher_pattern_match(enum ulp_direction_type   dir,
 	*class_id = 0;
 	return BNXT_TF_RC_ERROR;
 }
+
+/*
+ * Function to handle the matching of RTE Flows and validating
+ * the action against the flow templates.
+ */
+int32_t
+ulp_matcher_action_match(enum ulp_direction_type		dir,
+			 struct ulp_rte_act_bitmap		*act_bitmap,
+			 uint32_t				*act_id)
+{
+	struct bnxt_ulp_action_match_info	*sel_act_match;
+	uint32_t				act_num, idx;
+
+	/* Select the ingress or egress template to match against */
+	if (dir == ULP_DIR_INGRESS) {
+		sel_act_match = ulp_ingress_act_match_list;
+		act_num = BNXT_ULP_INGRESS_ACT_MATCH_SZ;
+	} else {
+		sel_act_match = ulp_egress_act_match_list;
+		act_num = BNXT_ULP_EGRESS_ACT_MATCH_SZ;
+	}
+
+	/* Loop through the list of action templates to find the match */
+	for (idx = 0; idx < act_num; idx++, sel_act_match++) {
+		if (!ULP_BITSET_CMP(&sel_act_match->act_bitmap,
+				    act_bitmap)) {
+			*act_id = sel_act_match->act_tmpl_id;
+			BNXT_TF_DBG(DEBUG, "Found matching act template %u\n",
+				    *act_id);
+			return BNXT_TF_RC_SUCCESS;
+		}
+	}
+	BNXT_TF_DBG(DEBUG, "Did not find any matching action template\n");
+	*act_id = 0;
+	return BNXT_TF_RC_ERROR;
+}
drivers/net/bnxt/tf_ulp/ulp_matcher.h +9 -0
index 57a161d..c818bbe 100644
@@ -23,4 +23,13 @@ ulp_matcher_pattern_match(enum ulp_direction_type	    dir,
 			  struct ulp_rte_act_bitmap	   *act_bitmap,
 			  uint32_t			   *class_id);
 
+/*
+ * Function to handle the matching of RTE Flows and validating
+ * the action against the flow templates.
+ */
+int32_t
+ulp_matcher_action_match(enum ulp_direction_type	dir,
+			 struct ulp_rte_act_bitmap	*act_bitmap,
+			 uint32_t			*act_id);
+
 #endif /* ULP_MATCHER_H_ */
drivers/net/bnxt/tf_ulp/ulp_template_db.c +12 -0
index 9fc4b08..5a5b1f1 100644
@@ -1121,6 +1121,18 @@ struct bnxt_ulp_mapper_ident_info ulp_ident_list[] = {
 	}
 };
 
+struct bnxt_ulp_action_match_info ulp_ingress_act_match_list[] = {
+	{
+	.act_bitmap = { .bits =
+		BNXT_ULP_ACTION_BIT_MARK |
+		BNXT_ULP_ACTION_BIT_RSS },
+	.act_tmpl_id = 0
+	}
+};
+
+struct bnxt_ulp_action_match_info ulp_egress_act_match_list[] = {
+};
+
 struct bnxt_ulp_mapper_tbl_list_info ulp_act_tmpl_list[] = {
 	[((0 << BNXT_ULP_LOG2_MAX_NUM_DEV) | BNXT_ULP_DEVICE_ID_WH_PLUS)] = {
 	.device_name = BNXT_ULP_DEVICE_ID_WH_PLUS,
drivers/net/bnxt/tf_ulp/ulp_template_db.h +2 -0
index 319500a..f4850bf 100644
@@ -15,6 +15,8 @@
 #define BNXT_ULP_LOG2_MAX_NUM_DEV 2
 #define BNXT_ULP_INGRESS_HDR_MATCH_SZ 2
 #define BNXT_ULP_EGRESS_HDR_MATCH_SZ 1
+#define BNXT_ULP_INGRESS_ACT_MATCH_SZ 2
+#define BNXT_ULP_EGRESS_ACT_MATCH_SZ 1
 
 enum bnxt_ulp_action_bit {
 	BNXT_ULP_ACTION_BIT_MARK             = 0x0000000000000001,
drivers/net/bnxt/tf_ulp/ulp_template_struct.h +10 -0
index dd06fb1..0e811ec 100644
@@ -62,6 +62,16 @@ extern struct bnxt_ulp_header_match_info  ulp_egress_hdr_match_list[];
 /* Flow field match Information Structure Array defined in template source*/
 extern struct bnxt_ulp_matcher_field_info	ulp_field_match[];
 
+/* Flow Matcher Action structures */
+struct bnxt_ulp_action_match_info {
+	struct ulp_rte_act_bitmap		act_bitmap;
+	uint32_t				act_tmpl_id;
+};
+
+/* Flow Matcher templates Structure Array defined in template source */
+extern struct bnxt_ulp_action_match_info  ulp_ingress_act_match_list[];
+extern struct bnxt_ulp_action_match_info  ulp_egress_act_match_list[];
+
 /* Device specific parameters */
 struct bnxt_ulp_device_params {
 	uint8_t				description[16];
Signature · 1 line
2.7.4
#135 lore raw

PATCH v4 25/34 net/bnxt: add support for rte flow item parsing

In reply to Venkat Duvvuru

From: Kishore Padmanabha <[email protected]>

1. Registers a callback handler for each rte_flow_item type, if it is supported
2. Iterates through each rte_flow_item till RTE_FLOW_ITEM_TYPE_END
3. Invokes the header call back handler
4. Each header call back handler will populate the respective fields in hdr_field & hdr_bitmap

---
 drivers/net/bnxt/Makefile                     |   1 +
 drivers/net/bnxt/tf_ulp/ulp_rte_parser.c      | 767 ++++++++++++++++++++++++++
 drivers/net/bnxt/tf_ulp/ulp_rte_parser.h      | 120 ++++
 drivers/net/bnxt/tf_ulp/ulp_template_db.c     | 196 +++++++
 drivers/net/bnxt/tf_ulp/ulp_template_db.h     |   7 +
 drivers/net/bnxt/tf_ulp/ulp_template_struct.h |  26 +
 6 files changed, 1117 insertions(+)
 create mode 100644 drivers/net/bnxt/tf_ulp/ulp_rte_parser.c
 create mode 100644 drivers/net/bnxt/tf_ulp/ulp_rte_parser.h
drivers/net/bnxt/Makefile +1 -0
index 455fd5c..5e2d751 100644
@@ -64,6 +64,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += tf_ulp/ulp_template_db.c
 SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += tf_ulp/ulp_utils.c
 SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += tf_ulp/ulp_mapper.c
 SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += tf_ulp/ulp_matcher.c
+SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += tf_ulp/ulp_rte_parser.c
 
 #
 # Export include files
drivers/net/bnxt/tf_ulp/ulp_rte_parser.c new file +767 -0

767 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_rte_parser.h new file +120 -0

120 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_template_db.c +196 -0

208 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_template_db.h +7 -0
index f4850bf..906b542 100644
@@ -115,6 +115,13 @@ enum bnxt_ulp_hdr_field {
 	BNXT_ULP_HDR_FIELD_LAST = 4
 };
 
+enum bnxt_ulp_hdr_type {
+	BNXT_ULP_HDR_TYPE_NOT_SUPPORTED = 0,
+	BNXT_ULP_HDR_TYPE_SUPPORTED = 1,
+	BNXT_ULP_HDR_TYPE_END = 2,
+	BNXT_ULP_HDR_TYPE_LAST = 3
+};
+
 enum bnxt_ulp_mask_opc {
 	BNXT_ULP_MASK_OPC_SET_TO_CONSTANT = 0,
 	BNXT_ULP_MASK_OPC_SET_TO_HDR_FIELD = 1,
drivers/net/bnxt/tf_ulp/ulp_template_struct.h +26 -0
index 0e811ec..0699634 100644
@@ -17,6 +17,18 @@
 #include "rte_flow.h"
 #include "tf_core.h"
 
+/* Number of fields for each protocol */
+#define BNXT_ULP_PROTO_HDR_SVIF_NUM	1
+#define BNXT_ULP_PROTO_HDR_ETH_NUM	3
+#define BNXT_ULP_PROTO_HDR_S_VLAN_NUM	3
+#define BNXT_ULP_PROTO_HDR_VLAN_NUM	6
+#define BNXT_ULP_PROTO_HDR_IPV4_NUM	10
+#define BNXT_ULP_PROTO_HDR_IPV6_NUM	6
+#define BNXT_ULP_PROTO_HDR_UDP_NUM	4
+#define BNXT_ULP_PROTO_HDR_TCP_NUM	9
+#define BNXT_ULP_PROTO_HDR_VXLAN_NUM	4
+#define BNXT_ULP_PROTO_HDR_MAX		128
+
 struct ulp_rte_hdr_bitmap {
 	uint64_t	bits;
 };
@@ -29,6 +41,20 @@ struct ulp_rte_hdr_field {
 	uint32_t	size;
 };
 
+/* Flow Parser Header Information Structure */
+struct bnxt_ulp_rte_hdr_info {
+	enum bnxt_ulp_hdr_type					hdr_type;
+	/* Flow Parser Protocol Header Function Prototype */
+	int (*proto_hdr_func)(const struct rte_flow_item	*item_list,
+			      struct ulp_rte_hdr_bitmap		*hdr_bitmap,
+			      struct ulp_rte_hdr_field		*hdr_field,
+			      uint32_t				*field_idx,
+			      uint32_t				*vlan_idx);
+};
+
+/* Flow Parser Header Information Structure Array defined in template source*/
+extern struct bnxt_ulp_rte_hdr_info	ulp_hdr_info[];
+
 struct bnxt_ulp_matcher_field_info {
 	enum bnxt_ulp_fmf_mask	mask_opcode;
 	enum bnxt_ulp_fmf_spec	spec_opcode;
Signature · 1 line
2.7.4
#136 lore raw

PATCH v4 26/34 net/bnxt: add support for rte flow action parsing

In reply to Venkat Duvvuru

From: Kishore Padmanabha <[email protected]>

This patch does the following
1. Registers a callback handler for each rte_flow_action type, if it is supported
2. Iterates through each rte_flow_action till RTE_FLOW_ACTION_TYPE_END
3. Invokes the action call back handler
4. Each action call back handler will populate the respective fields in act_details & act_bitmap

---
 drivers/net/bnxt/tf_ulp/bnxt_tf_common.h      |   7 +
 drivers/net/bnxt/tf_ulp/ulp_rte_parser.c      | 441 ++++++++++++++++++++++++++
 drivers/net/bnxt/tf_ulp/ulp_rte_parser.h      |  85 ++++-
 drivers/net/bnxt/tf_ulp/ulp_template_db.c     | 199 ++++++++++++
 drivers/net/bnxt/tf_ulp/ulp_template_db.h     |   7 +
 drivers/net/bnxt/tf_ulp/ulp_template_struct.h |  13 +
 6 files changed, 751 insertions(+), 1 deletion(-)
drivers/net/bnxt/tf_ulp/bnxt_tf_common.h +7 -0
index e4ebfc5..f417579 100644
@@ -31,6 +31,13 @@ enum bnxt_tf_rc {
 	BNXT_TF_RC_SUCCESS	= 0
 };
 
+/* eth IPv4 Type */
+enum bnxt_ulp_eth_ip_type {
+	BNXT_ULP_ETH_IPV4 = 4,
+	BNXT_ULP_ETH_IPV6 = 5,
+	BNXT_ULP_MAX_ETH_IP_TYPE = 0
+};
+
 /* ulp direction Type */
 enum ulp_direction_type {
 	ULP_DIR_INGRESS,
drivers/net/bnxt/tf_ulp/ulp_rte_parser.c +441 -0

456 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_rte_parser.h +84 -1

107 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_template_db.c +199 -0

205 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_template_db.h +7 -0
index 906b542..dfab266 100644
@@ -74,6 +74,13 @@ enum bnxt_ulp_hdr_bit {
 	BNXT_ULP_HDR_BIT_LAST                = 0x0000000000200000
 };
 
+enum bnxt_ulp_act_type {
+	BNXT_ULP_ACT_TYPE_NOT_SUPPORTED = 0,
+	BNXT_ULP_ACT_TYPE_SUPPORTED = 1,
+	BNXT_ULP_ACT_TYPE_END = 2,
+	BNXT_ULP_ACT_TYPE_LAST = 3
+};
+
 enum bnxt_ulp_byte_order {
 	BNXT_ULP_BYTE_ORDER_BE,
 	BNXT_ULP_BYTE_ORDER_LE,
drivers/net/bnxt/tf_ulp/ulp_template_struct.h +13 -0
index 0699634..47c0dd8 100644
@@ -72,6 +72,19 @@ struct ulp_rte_act_prop {
 	uint8_t	act_details[BNXT_ULP_ACT_PROP_IDX_LAST];
 };
 
+/* Flow Parser Action Information Structure */
+struct bnxt_ulp_rte_act_info {
+	enum bnxt_ulp_act_type					act_type;
+	/* Flow Parser Protocol Action Function Prototype */
+	int32_t (*proto_act_func)
+		(const struct rte_flow_action			*action_item,
+		struct ulp_rte_act_bitmap			*act_bitmap,
+		struct ulp_rte_act_prop				*act_prop);
+};
+
+/* Flow Parser Action Information Structure Array defined in template source*/
+extern struct bnxt_ulp_rte_act_info	ulp_act_info[];
+
 /* Flow Matcher structures */
 struct bnxt_ulp_header_match_info {
 	struct ulp_rte_hdr_bitmap		hdr_bitmap;
Signature · 1 line
2.7.4
#137 lore raw

PATCH v4 27/34 net/bnxt: add support for rte flow create driver hook

In reply to Venkat Duvvuru

From: Kishore Padmanabha <[email protected]>

This patch does the following
1. Validates rte_flow_create arguments
2. Parses rte_flow_item types
3. Parses rte_flow_action types
4. Calls ulp_matcher_pattern_match to see if the flow is supported
5. If there is a match, calls ulp_mapper_flow_create to program key & action tables

---
 drivers/net/bnxt/Makefile               |   1 +
 drivers/net/bnxt/tf_ulp/bnxt_ulp_flow.c | 177 ++++++++++++++++++++++++++++++++
 2 files changed, 178 insertions(+)
 create mode 100644 drivers/net/bnxt/tf_ulp/bnxt_ulp_flow.c
drivers/net/bnxt/Makefile +1 -0
index 5e2d751..5ed33cc 100644
@@ -65,6 +65,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += tf_ulp/ulp_utils.c
 SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += tf_ulp/ulp_mapper.c
 SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += tf_ulp/ulp_matcher.c
 SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += tf_ulp/ulp_rte_parser.c
+SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += tf_ulp/bnxt_ulp_flow.c
 
 #
 # Export include files
drivers/net/bnxt/tf_ulp/bnxt_ulp_flow.c new file +177 -0

177 lines not on this page · raw message

Signature · 1 line
2.7.4
#138 lore raw

PATCH v4 28/34 net/bnxt: add support for rte flow validate driver hook

In reply to Venkat Duvvuru

From: Kishore Padmanabha <[email protected]>

This patch does the following
1. Validates rte_flow_create arguments
2. Parses rte_flow_item types
3. Parses rte_flow_action types
4. Calls ulp_matcher_pattern_match to see if the flow is supported
5. If there is a match, returns success otherwise failure

---
 drivers/net/bnxt/tf_ulp/bnxt_ulp_flow.c | 67 ++++++++++++++++++++++++++++++++-
 1 file changed, 66 insertions(+), 1 deletion(-)
drivers/net/bnxt/tf_ulp/bnxt_ulp_flow.c +66 -1
index 6402dd3..490b2ba 100644
@@ -167,8 +167,73 @@ bnxt_ulp_flow_create(struct rte_eth_dev			*dev,
 	return NULL;
 }
 
+/* Function to validate the rte flow. */
+static int
+bnxt_ulp_flow_validate(struct rte_eth_dev *dev __rte_unused,
+		       const struct rte_flow_attr *attr,
+		       const struct rte_flow_item pattern[],
+		       const struct rte_flow_action actions[],
+		       struct rte_flow_error *error)
+{
+	struct ulp_rte_hdr_bitmap hdr_bitmap;
+	struct ulp_rte_hdr_field hdr_field[BNXT_ULP_PROTO_HDR_MAX];
+	struct ulp_rte_act_bitmap act_bitmap;
+	struct ulp_rte_act_prop act_prop;
+	enum ulp_direction_type dir = ULP_DIR_INGRESS;
+	uint32_t class_id, act_tmpl;
+	int ret;
+
+	if (bnxt_ulp_flow_validate_args(attr,
+					pattern, actions,
+					error) == BNXT_TF_RC_ERROR) {
+		BNXT_TF_DBG(ERR, "Invalid arguments being passed\n");
+		return -EINVAL;
+	}
+
+	/* clear the header bitmap and field structure */
+	memset(&hdr_bitmap, 0, sizeof(struct ulp_rte_hdr_bitmap));
+	memset(hdr_field, 0, sizeof(hdr_field));
+	memset(&act_bitmap, 0, sizeof(act_bitmap));
+	memset(&act_prop, 0, sizeof(act_prop));
+
+	/* Parse the rte flow pattern */
+	ret = bnxt_ulp_rte_parser_hdr_parse(pattern,
+					    &hdr_bitmap,
+					    hdr_field);
+	if (ret != BNXT_TF_RC_SUCCESS)
+		goto parse_error;
+
+	/* Parse the rte flow action */
+	ret = bnxt_ulp_rte_parser_act_parse(actions,
+					    &act_bitmap,
+					    &act_prop);
+	if (ret != BNXT_TF_RC_SUCCESS)
+		goto parse_error;
+
+	if (attr->egress)
+		dir = ULP_DIR_EGRESS;
+
+	ret = ulp_matcher_pattern_match(dir, &hdr_bitmap, hdr_field,
+					&act_bitmap, &class_id);
+
+	if (ret != BNXT_TF_RC_SUCCESS)
+		goto parse_error;
+
+	ret = ulp_matcher_action_match(dir, &act_bitmap, &act_tmpl);
+	if (ret != BNXT_TF_RC_SUCCESS)
+		goto parse_error;
+
+	/* all good return success */
+	return ret;
+
+parse_error:
+	rte_flow_error_set(error, ret, RTE_FLOW_ERROR_TYPE_HANDLE, NULL,
+			   "Failed to validate flow.");
+	return -EINVAL;
+}
+
 const struct rte_flow_ops bnxt_ulp_rte_flow_ops = {
-	.validate = NULL,
+	.validate = bnxt_ulp_flow_validate,
 	.create = bnxt_ulp_flow_create,
 	.destroy = NULL,
 	.flush = NULL,
Signature · 1 line
2.7.4
#139 lore raw

PATCH v4 29/34 net/bnxt: add support for rte flow destroy driver hook

In reply to Venkat Duvvuru

From: Kishore Padmanabha <[email protected]>

This patch does the following
1. Gets the ulp session information from eth_dev
2. Fetches the flow associated with the flow id from the flow table
3. Calls ulp_mapper_resources_free which releases the key & action tables associated with that flow

---
 drivers/net/bnxt/tf_ulp/bnxt_ulp_flow.c | 32 +++++++++++++++++++++++++++++++-
 1 file changed, 31 insertions(+), 1 deletion(-)
drivers/net/bnxt/tf_ulp/bnxt_ulp_flow.c +31 -1
index 490b2ba..35099a3 100644
@@ -232,10 +232,40 @@ bnxt_ulp_flow_validate(struct rte_eth_dev *dev __rte_unused,
 	return -EINVAL;
 }
 
+/* Function to destroy the rte flow. */
+static int
+bnxt_ulp_flow_destroy(struct rte_eth_dev *dev,
+		      struct rte_flow *flow,
+		      struct rte_flow_error *error)
+{
+	int ret = 0;
+	struct bnxt_ulp_context *ulp_ctx;
+	uint32_t fid;
+
+	ulp_ctx = bnxt_ulp_eth_dev_ptr2_cntxt_get(dev);
+	if (!ulp_ctx) {
+		BNXT_TF_DBG(ERR, "ULP context is not initialized\n");
+		rte_flow_error_set(error, EINVAL,
+				   RTE_FLOW_ERROR_TYPE_HANDLE, NULL,
+				   "Failed to destroy flow.");
+		return -EINVAL;
+	}
+
+	fid = (uint32_t)(uintptr_t)flow;
+
+	ret = ulp_mapper_flow_destroy(ulp_ctx, fid);
+	if (ret)
+		rte_flow_error_set(error, -ret,
+				   RTE_FLOW_ERROR_TYPE_HANDLE, NULL,
+				   "Failed to destroy flow.");
+
+	return ret;
+}
+
 const struct rte_flow_ops bnxt_ulp_rte_flow_ops = {
 	.validate = bnxt_ulp_flow_validate,
 	.create = bnxt_ulp_flow_create,
-	.destroy = NULL,
+	.destroy = bnxt_ulp_flow_destroy,
 	.flush = NULL,
 	.query = NULL,
 	.isolate = NULL
Signature · 1 line
2.7.4
#140 lore raw

PATCH v4 30/34 net/bnxt: add support for rte flow flush driver hook

In reply to Venkat Duvvuru

From: Kishore Padmanabha <[email protected]>

This patch does the following
1. Gets the ulp session information from eth_dev
2. Fetches the rte_flow table associated with this session
3. Iterates through all the flows in the flow table
4. Calls ulp_mapper_resources_free which releases the key & action tables associated with each flow

---
 drivers/net/bnxt/tf_ulp/bnxt_ulp.c      |  3 ++
 drivers/net/bnxt/tf_ulp/bnxt_ulp_flow.c | 33 +++++++++++++++-
 drivers/net/bnxt/tf_ulp/ulp_flow_db.c   | 69 +++++++++++++++++++++++++++++++++
 drivers/net/bnxt/tf_ulp/ulp_flow_db.h   | 11 ++++++
 4 files changed, 115 insertions(+), 1 deletion(-)
drivers/net/bnxt/tf_ulp/bnxt_ulp.c +3 -0
index 3795c6d..56e08f2 100644
@@ -517,6 +517,9 @@ bnxt_ulp_deinit(struct bnxt *bp)
 	if (!session)
 		return;
 
+	/* clean up regular flows */
+	ulp_flow_db_flush_flows(&bp->ulp_ctx, BNXT_ULP_REGULAR_FLOW_TABLE);
+
 	/* cleanup the eem table scope */
 	ulp_eem_tbl_scope_deinit(bp, &bp->ulp_ctx);
 
drivers/net/bnxt/tf_ulp/bnxt_ulp_flow.c +32 -1
index 35099a3..4958895 100644
@@ -262,11 +262,42 @@ bnxt_ulp_flow_destroy(struct rte_eth_dev *dev,
 	return ret;
 }
 
+/* Function to destroy the rte flows. */
+static int32_t
+bnxt_ulp_flow_flush(struct rte_eth_dev *eth_dev,
+		    struct rte_flow_error *error)
+{
+	struct bnxt_ulp_context *ulp_ctx;
+	int32_t ret;
+	struct bnxt *bp;
+
+	ulp_ctx = bnxt_ulp_eth_dev_ptr2_cntxt_get(eth_dev);
+	if (!ulp_ctx) {
+		BNXT_TF_DBG(ERR, "ULP context is not initialized\n");
+		rte_flow_error_set(error, EINVAL,
+				   RTE_FLOW_ERROR_TYPE_HANDLE, NULL,
+				   "Failed to flush flow.");
+		return -EINVAL;
+	}
+	bp = eth_dev->data->dev_private;
+
+	/* Free the resources for the last device */
+	if (!ulp_ctx_deinit_allowed(bp))
+		return 0;
+
+	ret = ulp_flow_db_flush_flows(ulp_ctx, BNXT_ULP_REGULAR_FLOW_TABLE);
+	if (ret)
+		rte_flow_error_set(error, ret,
+				   RTE_FLOW_ERROR_TYPE_HANDLE, NULL,
+				   "Failed to flush flow.");
+	return ret;
+}
+
 const struct rte_flow_ops bnxt_ulp_rte_flow_ops = {
 	.validate = bnxt_ulp_flow_validate,
 	.create = bnxt_ulp_flow_create,
 	.destroy = bnxt_ulp_flow_destroy,
-	.flush = NULL,
+	.flush = bnxt_ulp_flow_flush,
 	.query = NULL,
 	.isolate = NULL
 };
drivers/net/bnxt/tf_ulp/ulp_flow_db.c +69 -0

72 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_flow_db.h +11 -0
index eb5effa..5435415 100644
@@ -142,4 +142,15 @@ int32_t	ulp_flow_db_fid_free(struct bnxt_ulp_context		*ulp_ctxt,
 			     enum bnxt_ulp_flow_db_tables	tbl_idx,
 			     uint32_t				fid);
 
+/*
+ * Flush all flows in the flow database.
+ *
+ * ulp_ctxt [in] Ptr to ulp context
+ * tbl_idx [in] The index to table
+ *
+ * returns 0 on success or negative number on failure
+ */
+int32_t	ulp_flow_db_flush_flows(struct bnxt_ulp_context *ulp_ctx,
+				uint32_t		idx);
+
 #endif /* _ULP_FLOW_DB_H_ */
Signature · 1 line
2.7.4
#141 lore raw

PATCH v4 31/34 net/bnxt: register tf rte flow ops

In reply to Venkat Duvvuru

Register bnxt_ulp_rte_flow_ops when host based TRUFLOW is enabled.

---
 drivers/net/bnxt/bnxt.h        | 1 +
 drivers/net/bnxt/bnxt_ethdev.c | 6 +++++-
 2 files changed, 6 insertions(+), 1 deletion(-)
drivers/net/bnxt/bnxt.h +1 -0
index cd20740..a70cdff 100644
@@ -731,6 +731,7 @@ extern int bnxt_logtype_driver;
 #define PMD_DRV_LOG(level, fmt, args...) \
 	  PMD_DRV_LOG_RAW(level, fmt, ## args)
 
+extern const struct rte_flow_ops bnxt_ulp_rte_flow_ops;
 int32_t bnxt_ulp_init(struct bnxt *bp);
 void bnxt_ulp_deinit(struct bnxt *bp);
 
drivers/net/bnxt/bnxt_ethdev.c +5 -1
index 2f08921..783e6a4 100644
@@ -3288,6 +3288,7 @@ bnxt_filter_ctrl_op(struct rte_eth_dev *dev,
 		    enum rte_filter_type filter_type,
 		    enum rte_filter_op filter_op, void *arg)
 {
+	struct bnxt *bp = dev->data->dev_private;
 	int ret = 0;
 
 	ret = is_bnxt_in_error(dev->data->dev_private);
@@ -3311,7 +3312,10 @@ bnxt_filter_ctrl_op(struct rte_eth_dev *dev,
 	case RTE_ETH_FILTER_GENERIC:
 		if (filter_op != RTE_ETH_FILTER_GET)
 			return -EINVAL;
-		*(const void **)arg = &bnxt_flow_ops;
+		if (bp->truflow)
+			*(const void **)arg = &bnxt_ulp_rte_flow_ops;
+		else
+			*(const void **)arg = &bnxt_flow_ops;
 		break;
 	default:
 		PMD_DRV_LOG(ERR,
Signature · 1 line
2.7.4
#142 lore raw

PATCH v4 32/34 net/bnxt: disable vector mode when host based TRUFLOW is enabled

In reply to Venkat Duvvuru

If bp->truflow is not set then don't enable vector mode.

---
 drivers/net/bnxt/bnxt_ethdev.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/bnxt/bnxt_ethdev.c +2 -1
index 783e6a4..5d5b8e0 100644
@@ -788,7 +788,8 @@ bnxt_receive_function(struct rte_eth_dev *eth_dev)
 		DEV_RX_OFFLOAD_TCP_CKSUM |
 		DEV_RX_OFFLOAD_OUTER_IPV4_CKSUM |
 		DEV_RX_OFFLOAD_RSS_HASH |
-		DEV_RX_OFFLOAD_VLAN_FILTER))) {
+		DEV_RX_OFFLOAD_VLAN_FILTER)) &&
+	    !bp->truflow) {
 		PMD_DRV_LOG(INFO, "Using vector mode receive for port %d\n",
 			    eth_dev->data->port_id);
 		bp->flags |= BNXT_FLAG_RX_VECTOR_PKT_MODE;
Signature · 1 line
2.7.4
#143 lore raw

PATCH v4 33/34 net/bnxt: add support for injecting mark into packet’s mbuf

In reply to Venkat Duvvuru

When a flow is offloaded with MARK action (RTE_FLOW_ACTION_TYPE_MARK), each packet of that flow will have metadata set in its completion. This metadata will be used to fetch an index into a mark table where the actual MARK for that flow is stored. Fetch the MARK from the mark table and inject it into packet’s mbuf.

---
 drivers/net/bnxt/bnxt_rxr.c            | 153 ++++++++++++++++++++++++---------
 drivers/net/bnxt/tf_ulp/ulp_mark_mgr.c |  55 +++++++++++-
 drivers/net/bnxt/tf_ulp/ulp_mark_mgr.h |  18 ++++
 3 files changed, 183 insertions(+), 43 deletions(-)
drivers/net/bnxt/bnxt_rxr.c +111 -42
index bef9720..40da2f2 100644
@@ -20,6 +20,9 @@
 #include "bnxt_hwrm.h"
 #endif
 
+#include <bnxt_tf_common.h>
+#include <ulp_mark_mgr.h>
+
 /*
  * RX Ring handling
  */
@@ -399,6 +402,109 @@ bnxt_get_rx_ts_thor(struct bnxt *bp, uint32_t rx_ts_cmpl)
 }
 #endif
 
+static void
+bnxt_ulp_set_mark_in_mbuf(struct bnxt *bp, struct rx_pkt_cmpl_hi *rxcmp1,
+			  struct rte_mbuf *mbuf)
+{
+	uint32_t cfa_code;
+	uint32_t meta_fmt;
+	uint32_t meta;
+	uint32_t eem = 0;
+	uint32_t mark_id;
+	uint32_t flags2;
+	int rc;
+
+	cfa_code = rte_le_to_cpu_16(rxcmp1->cfa_code);
+	flags2 = rte_le_to_cpu_32(rxcmp1->flags2);
+	meta = rte_le_to_cpu_32(rxcmp1->metadata);
+	if (meta) {
+		meta >>= BNXT_RX_META_CFA_CODE_SHIFT;
+
+		/* The flags field holds extra bits of info from [6:4]
+		 * which indicate if the flow is in TCAM or EM or EEM
+		 */
+		meta_fmt = (flags2 & BNXT_CFA_META_FMT_MASK) >>
+			    BNXT_CFA_META_FMT_SHFT;
+		/* meta_fmt == 4 => 'b100 => 'b10x => EM.
+		 * meta_fmt == 5 => 'b101 => 'b10x => EM + VLAN
+		 * meta_fmt == 6 => 'b110 => 'b11x => EEM
+		 * meta_fmt == 7 => 'b111 => 'b11x => EEM + VLAN.
+		 */
+		meta_fmt >>= BNXT_CFA_META_FMT_EM_EEM_SHFT;
+
+		eem = meta_fmt == BNXT_CFA_META_FMT_EEM;
+
+		/* For EEM flows, The first part of cfa_code is 16 bits.
+		 * The second part is embedded in the
+		 * metadata field from bit 19 onwards. The driver needs to
+		 * ignore the first 19 bits of metadata and use the next 12
+		 * bits as higher 12 bits of cfa_code.
+		 */
+		if (eem)
+			cfa_code |= meta << BNXT_CFA_CODE_META_SHIFT;
+	}
+
+	if (cfa_code) {
+		mbuf->hash.fdir.hi = 0;
+		mbuf->hash.fdir.id = 0;
+		if (eem)
+			rc = ulp_mark_db_mark_get(&bp->ulp_ctx, true,
+						  cfa_code, &mark_id);
+		else
+			rc = ulp_mark_db_mark_get(&bp->ulp_ctx, false,
+						  cfa_code, &mark_id);
+		/* If the above fails, simply return and don't add the mark to
+		 * mbuf
+		 */
+		if (rc)
+			return;
+
+		mbuf->hash.fdir.hi	= mark_id;
+		mbuf->udata64		= (cfa_code & 0xffffffffull) << 32;
+		mbuf->hash.fdir.id	= rxcmp1->cfa_code;
+		mbuf->ol_flags		|= PKT_RX_FDIR | PKT_RX_FDIR_ID;
+	}
+}
+
+void bnxt_set_mark_in_mbuf(struct bnxt *bp,
+			   struct rx_pkt_cmpl_hi *rxcmp1,
+			   struct rte_mbuf *mbuf)
+{
+	uint32_t cfa_code = 0;
+	uint8_t meta_fmt = 0;
+	uint16_t flags2 = 0;
+	uint32_t meta =  0;
+
+	cfa_code = rte_le_to_cpu_16(rxcmp1->cfa_code);
+	if (!cfa_code)
+		return;
+
+	if (cfa_code && !bp->mark_table[cfa_code].valid)
+		return;
+
+	flags2 = rte_le_to_cpu_16(rxcmp1->flags2);
+	meta = rte_le_to_cpu_32(rxcmp1->metadata);
+	if (meta) {
+		meta >>= BNXT_RX_META_CFA_CODE_SHIFT;
+
+		/* The flags field holds extra bits of info from [6:4]
+		 * which indicate if the flow is in TCAM or EM or EEM
+		 */
+		meta_fmt = (flags2 & BNXT_CFA_META_FMT_MASK) >>
+			   BNXT_CFA_META_FMT_SHFT;
+
+		/* meta_fmt == 4 => 'b100 => 'b10x => EM.
+		 * meta_fmt == 5 => 'b101 => 'b10x => EM + VLAN
+		 * meta_fmt == 6 => 'b110 => 'b11x => EEM
+		 * meta_fmt == 7 => 'b111 => 'b11x => EEM + VLAN.
+		 */
+		meta_fmt >>= BNXT_CFA_META_FMT_EM_EEM_SHFT;
+	}
+
+	mbuf->hash.fdir.hi = bp->mark_table[cfa_code].mark_id;
+	mbuf->ol_flags |= PKT_RX_FDIR | PKT_RX_FDIR_ID;
+}
+
 static int bnxt_rx_pkt(struct rte_mbuf **rx_pkt,
 			    struct bnxt_rx_queue *rxq, uint32_t *raw_cons)
 {
@@ -415,6 +521,7 @@ static int bnxt_rx_pkt(struct rte_mbuf **rx_pkt,
 	uint16_t cmp_type;
 	uint32_t flags2_f = 0;
 	uint16_t flags_type;
+	struct bnxt *bp = rxq->bp;
 
 	rxcmp = (struct rx_pkt_cmpl *)
 	    &cpr->cp_desc_ring[cp_cons];
@@ -490,7 +597,10 @@ static int bnxt_rx_pkt(struct rte_mbuf **rx_pkt,
 		mbuf->ol_flags |= PKT_RX_RSS_HASH;
 	}
 
-	bnxt_set_mark_in_mbuf(rxq->bp, rxcmp1, mbuf);
+	if (bp->truflow)
+		bnxt_ulp_set_mark_in_mbuf(rxq->bp, rxcmp1, mbuf);
+	else
+		bnxt_set_mark_in_mbuf(rxq->bp, rxcmp1, mbuf);
 
 #ifdef RTE_LIBRTE_IEEE1588
 	if (unlikely((flags_type & RX_PKT_CMPL_FLAGS_MASK) ==
@@ -896,44 +1006,3 @@ int bnxt_init_one_rx_ring(struct bnxt_rx_queue *rxq)
 
 	return 0;
 }
-
-void bnxt_set_mark_in_mbuf(struct bnxt *bp,
-			   struct rx_pkt_cmpl_hi *rxcmp1,
-			   struct rte_mbuf *mbuf)
-{
-	uint32_t cfa_code = 0;
-	uint8_t meta_fmt =  0;
-	uint16_t flags2 = 0;
-	uint32_t meta =  0;
-
-	cfa_code = rte_le_to_cpu_16(rxcmp1->cfa_code);
-	if (!cfa_code)
-		return;
-
-	if (cfa_code && !bp->mark_table[cfa_code].valid)
-		return;
-
-	flags2 = rte_le_to_cpu_16(rxcmp1->flags2);
-	meta = rte_le_to_cpu_32(rxcmp1->metadata);
-	if (meta) {
-		meta >>= BNXT_RX_META_CFA_CODE_SHIFT;
-
-		/*
-		 * The flags field holds extra bits of info from [6:4]
-		 * which indicate if the flow is in TCAM or EM or EEM
-		 */
-		meta_fmt = (flags2 & BNXT_CFA_META_FMT_MASK) >>
-			   BNXT_CFA_META_FMT_SHFT;
-
-		/*
-		 * meta_fmt == 4 => 'b100 => 'b10x => EM.
-		 * meta_fmt == 5 => 'b101 => 'b10x => EM + VLAN
-		 * meta_fmt == 6 => 'b110 => 'b11x => EEM
-		 * meta_fmt == 7 => 'b111 => 'b11x => EEM + VLAN.
-		 */
-		meta_fmt >>= BNXT_CFA_META_FMT_EM_EEM_SHFT;
-	}
-
-	mbuf->hash.fdir.hi = bp->mark_table[cfa_code].mark_id;
-	mbuf->ol_flags |= PKT_RX_FDIR | PKT_RX_FDIR_ID;
-}
drivers/net/bnxt/tf_ulp/ulp_mark_mgr.c +54 -1

67 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_mark_mgr.h +18 -0
index f0d1515..0f8a5e5 100644
@@ -55,6 +55,24 @@ int32_t
 ulp_mark_db_deinit(struct bnxt_ulp_context *ctxt);
 
 /*
+ * Get a Mark from the Mark Manager
+ *
+ * ctxt [in] The ulp context for the mark manager
+ *
+ * is_gfid [in] The type of fid (GFID or LFID)
+ *
+ * fid [in] The flow id that is returned by HW in BD
+ *
+ * mark [out] The mark that is associated with the FID
+ *
+ */
+int32_t
+ulp_mark_db_mark_get(struct bnxt_ulp_context *ctxt,
+		     bool is_gfid,
+		     uint32_t fid,
+		     uint32_t *mark);
+
+/*
  * Adds a Mark to the Mark Manager
  *
  * ctxt [in] The ulp context for the mark manager
Signature · 1 line
2.7.4
#144 lore raw

PATCH v4 34/34 net/bnxt: enable meson build on truflow code

In reply to Venkat Duvvuru

Include tf_ulp & tf_core directories and the files inside them.

---
 drivers/net/bnxt/meson.build | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)
drivers/net/bnxt/meson.build +26 -0
index 0c311d2..d75f887 100644
@@ -1,7 +1,12 @@
 # SPDX-License-Identifier: BSD-3-Clause
 # Copyright(c) 2018 Intel Corporation
+# Copyright(c) 2020 Broadcom
 
 install_headers('rte_pmd_bnxt.h')
+
+includes += include_directories('tf_ulp')
+includes += include_directories('tf_core')
+
 sources = files('bnxt_cpr.c',
 	'bnxt_ethdev.c',
 	'bnxt_filter.c',
@@ -16,6 +21,27 @@ sources = files('bnxt_cpr.c',
 	'bnxt_txr.c',
 	'bnxt_util.c',
 	'bnxt_vnic.c',
+
+	'tf_core/tf_core.c',
+	'tf_core/bitalloc.c',
+	'tf_core/tf_msg.c',
+	'tf_core/rand.c',
+	'tf_core/stack.c',
+	'tf_core/tf_em.c',
+	'tf_core/tf_rm.c',
+	'tf_core/tf_tbl.c',
+	'tf_core/tfp.c',
+
+	'tf_ulp/bnxt_ulp.c',
+	'tf_ulp/ulp_mark_mgr.c',
+	'tf_ulp/ulp_flow_db.c',
+	'tf_ulp/ulp_template_db.c',
+	'tf_ulp/ulp_utils.c',
+	'tf_ulp/ulp_mapper.c',
+	'tf_ulp/ulp_matcher.c',
+	'tf_ulp/ulp_rte_parser.c',
+	'tf_ulp/bnxt_ulp_flow.c',
+
 	'rte_pmd_bnxt.c')
 
 if arch_subdir == 'x86'
Signature · 1 line
2.7.4
#145 lore raw

Re: [dpdk-dev] [PATCH v4 34/34] net/bnxt: enable meson build on truflow code

15/04/2020 10:19, Venkat Duvvuru:

Quoted 1 line

Include tf_ulp & tf_core directories and the files inside them.

This commit is non-sense.
You should compile files while adding them.
It is not a lot more expensive to prepare proper patches.

#146 lore raw
In reply to Venkat Duvvuru
Quoted 12 lines · Venkat Duvvuru

This patchset introduces a new mechanism to allow host-memory based flow table management. This should allow higher flow scalability than what is currently supported. This new approach also defines a new rte_flow parser, and mapper which currently supports basic packet classification in receive path. The patchset uses a newly implemented control-plane firmware interface which optimizes flow insertions and deletions.

This is a baseline patchset with limited scale. Follow on patches will add support for more protocol headers, rte_flow attributes, actions and such.

Quoted 8 lines

This is a tech preview feature, hence disabled by default and can be enabled
using bnxt devargs. For ex: "-w 0000:0d:00.0,host-based-truflow=1”.

v3==>v4
=======
1. Fixed some more compilation issues reported by CI

Patchset applied to dpdk-next-net-brcm.

Quoted 159 lines

Ajit Kumar Khaparde (1):
net/bnxt: add updated dpdk hsi structure

Farah Smith (2):
net/bnxt: add tf core identifier support
net/bnxt: add tf core table scope support

Kishore Padmanabha (8):
net/bnxt: match rte flow items with flow template patterns net/bnxt: match rte flow actions with flow template actions net/bnxt: add support for rte flow item parsing net/bnxt: add support for rte flow action parsing net/bnxt: add support for rte flow create driver hook net/bnxt: add support for rte flow validate driver hook net/bnxt: add support for rte flow destroy driver hook net/bnxt: add support for rte flow flush driver hook

Michael Wildt (4):
net/bnxt: add initial tf core session open net/bnxt: add initial tf core session close support net/bnxt: add tf core session sram functions net/bnxt: add resource manager functionality

Mike Baucom (5):
net/bnxt: add helper functions for blob/regfile ops net/bnxt: add support to process action tables net/bnxt: add support to process key tables net/bnxt: add support to free key and action tables net/bnxt: add support to alloc and program key and act tbls

Pete Spreadborough (2):
net/bnxt: add truflow message handlers
net/bnxt: add EM/EEM functionality

Randy Schacher (1):
net/bnxt: update hwrm prep to use ptr

Shahaji Bhosle (2):
net/bnxt: add initial tf core resource mgmt support net/bnxt: add tf core TCAM support

Venkat Duvvuru (9):
net/bnxt: fetch SVIF information from the firmware net/bnxt: fetch vnic info from DPDK port
net/bnxt: add devargs parameter for host memory based TRUFLOW feature net/bnxt: add support for ULP session manager init net/bnxt: add support for ULP session manager cleanup net/bnxt: register tf rte flow ops
net/bnxt: disable vector mode when host based TRUFLOW is enabled net/bnxt: add support for injecting mark into packet’s mbuf net/bnxt: enable meson build on truflow code

 drivers/net/bnxt/Makefile                       |   24 +
 drivers/net/bnxt/bnxt.h                         |   21 +-
 drivers/net/bnxt/bnxt_ethdev.c                  |  118 +-
 drivers/net/bnxt/bnxt_hwrm.c                    |  319 +-
 drivers/net/bnxt/bnxt_hwrm.h                    |   19 +
 drivers/net/bnxt/bnxt_rxr.c                     |  153 +-
 drivers/net/bnxt/hsi_struct_def_dpdk.h          | 3786
++++++++++++++++++++---
 drivers/net/bnxt/meson.build                    |   26 +
 drivers/net/bnxt/tf_core/bitalloc.c             |  364 +++
 drivers/net/bnxt/tf_core/bitalloc.h             |  119 +
 drivers/net/bnxt/tf_core/hwrm_tf.h              |  992 ++++++
 drivers/net/bnxt/tf_core/lookup3.h              |  162 +
 drivers/net/bnxt/tf_core/rand.c                 |   47 +
 drivers/net/bnxt/tf_core/rand.h                 |   36 +
 drivers/net/bnxt/tf_core/stack.c                |  107 +
 drivers/net/bnxt/tf_core/stack.h                |  107 +
 drivers/net/bnxt/tf_core/tf_core.c              |  659 ++++
 drivers/net/bnxt/tf_core/tf_core.h              | 1376 ++++++++
 drivers/net/bnxt/tf_core/tf_em.c                |  515 +++
 drivers/net/bnxt/tf_core/tf_em.h                |  117 +
 drivers/net/bnxt/tf_core/tf_ext_flow_handle.h   |  166 +
 drivers/net/bnxt/tf_core/tf_msg.c               | 1248 ++++++++
 drivers/net/bnxt/tf_core/tf_msg.h               |  256 ++
 drivers/net/bnxt/tf_core/tf_msg_common.h        |   47 +
 drivers/net/bnxt/tf_core/tf_project.h           |   24 +
 drivers/net/bnxt/tf_core/tf_resources.h         |  542 ++++
 drivers/net/bnxt/tf_core/tf_rm.c                | 3297
++++++++++++++++++++
 drivers/net/bnxt/tf_core/tf_rm.h                |  321 ++
 drivers/net/bnxt/tf_core/tf_session.h           |  300 ++
 drivers/net/bnxt/tf_core/tf_tbl.c               | 1836 +++++++++++
 drivers/net/bnxt/tf_core/tf_tbl.h               |  126 +
 drivers/net/bnxt/tf_core/tfp.c                  |  163 +
 drivers/net/bnxt/tf_core/tfp.h                  |  188 ++
 drivers/net/bnxt/tf_ulp/bnxt_tf_common.h        |   54 +
 drivers/net/bnxt/tf_ulp/bnxt_ulp.c              |  695 +++++
 drivers/net/bnxt/tf_ulp/bnxt_ulp.h              |  110 +
 drivers/net/bnxt/tf_ulp/bnxt_ulp_flow.c         |  303 ++
 drivers/net/bnxt/tf_ulp/ulp_flow_db.c           |  626 ++++
 drivers/net/bnxt/tf_ulp/ulp_flow_db.h           |  156 +
 drivers/net/bnxt/tf_ulp/ulp_mapper.c            | 1513 +++++++++
 drivers/net/bnxt/tf_ulp/ulp_mapper.h            |   69 +
 drivers/net/bnxt/tf_ulp/ulp_mark_mgr.c          |  271 ++
 drivers/net/bnxt/tf_ulp/ulp_mark_mgr.h          |  111 +
 drivers/net/bnxt/tf_ulp/ulp_matcher.c           |  188 ++
 drivers/net/bnxt/tf_ulp/ulp_matcher.h           |   35 +
 drivers/net/bnxt/tf_ulp/ulp_rte_parser.c        | 1208 ++++++++
 drivers/net/bnxt/tf_ulp/ulp_rte_parser.h        |  203 ++
 drivers/net/bnxt/tf_ulp/ulp_template_db.c       | 1713 ++++++++++
 drivers/net/bnxt/tf_ulp/ulp_template_db.h       |  354 +++
 drivers/net/bnxt/tf_ulp/ulp_template_field_db.h |  130 +
 drivers/net/bnxt/tf_ulp/ulp_template_struct.h   |  266 ++
 drivers/net/bnxt/tf_ulp/ulp_utils.c             |  521 ++++
 drivers/net/bnxt/tf_ulp/ulp_utils.h             |  279 ++
 53 files changed, 25891 insertions(+), 495 deletions(-)
 create mode 100644 drivers/net/bnxt/tf_core/bitalloc.c
 create mode 100644 drivers/net/bnxt/tf_core/bitalloc.h
 create mode 100644 drivers/net/bnxt/tf_core/hwrm_tf.h
 create mode 100644 drivers/net/bnxt/tf_core/lookup3.h
 create mode 100644 drivers/net/bnxt/tf_core/rand.c
 create mode 100644 drivers/net/bnxt/tf_core/rand.h
 create mode 100644 drivers/net/bnxt/tf_core/stack.c
 create mode 100644 drivers/net/bnxt/tf_core/stack.h
 create mode 100644 drivers/net/bnxt/tf_core/tf_core.c
 create mode 100644 drivers/net/bnxt/tf_core/tf_core.h
 create mode 100644 drivers/net/bnxt/tf_core/tf_em.c
 create mode 100644 drivers/net/bnxt/tf_core/tf_em.h
 create mode 100644 drivers/net/bnxt/tf_core/tf_ext_flow_handle.h
 create mode 100644 drivers/net/bnxt/tf_core/tf_msg.c
 create mode 100644 drivers/net/bnxt/tf_core/tf_msg.h
 create mode 100644 drivers/net/bnxt/tf_core/tf_msg_common.h
 create mode 100644 drivers/net/bnxt/tf_core/tf_project.h
 create mode 100644 drivers/net/bnxt/tf_core/tf_resources.h
 create mode 100644 drivers/net/bnxt/tf_core/tf_rm.c
 create mode 100644 drivers/net/bnxt/tf_core/tf_rm.h
 create mode 100644 drivers/net/bnxt/tf_core/tf_session.h
 create mode 100644 drivers/net/bnxt/tf_core/tf_tbl.c
 create mode 100644 drivers/net/bnxt/tf_core/tf_tbl.h
 create mode 100644 drivers/net/bnxt/tf_core/tfp.c
 create mode 100644 drivers/net/bnxt/tf_core/tfp.h
 create mode 100644 drivers/net/bnxt/tf_ulp/bnxt_tf_common.h
 create mode 100644 drivers/net/bnxt/tf_ulp/bnxt_ulp.c
 create mode 100644 drivers/net/bnxt/tf_ulp/bnxt_ulp.h
 create mode 100644 drivers/net/bnxt/tf_ulp/bnxt_ulp_flow.c
 create mode 100644 drivers/net/bnxt/tf_ulp/ulp_flow_db.c
 create mode 100644 drivers/net/bnxt/tf_ulp/ulp_flow_db.h
 create mode 100644 drivers/net/bnxt/tf_ulp/ulp_mapper.c
 create mode 100644 drivers/net/bnxt/tf_ulp/ulp_mapper.h
 create mode 100644 drivers/net/bnxt/tf_ulp/ulp_mark_mgr.c
 create mode 100644 drivers/net/bnxt/tf_ulp/ulp_mark_mgr.h
 create mode 100644 drivers/net/bnxt/tf_ulp/ulp_matcher.c
 create mode 100644 drivers/net/bnxt/tf_ulp/ulp_matcher.h
 create mode 100644 drivers/net/bnxt/tf_ulp/ulp_rte_parser.c
 create mode 100644 drivers/net/bnxt/tf_ulp/ulp_rte_parser.h
 create mode 100644 drivers/net/bnxt/tf_ulp/ulp_template_db.c
 create mode 100644 drivers/net/bnxt/tf_ulp/ulp_template_db.h
 create mode 100644 drivers/net/bnxt/tf_ulp/ulp_template_field_db.h
 create mode 100644 drivers/net/bnxt/tf_ulp/ulp_template_struct.h
 create mode 100644 drivers/net/bnxt/tf_ulp/ulp_utils.c
 create mode 100644 drivers/net/bnxt/tf_ulp/ulp_utils.h

--
2.7.4

#147 lore raw
In reply to Venkat Duvvuru
Quoted 60 lines · Venkat Duvvuru

This patchset introduces a new mechanism to allow host-memory based flow table management. This should allow higher flow scalability than what is currently supported. This new approach also defines a new rte_flow parser, and mapper which currently supports basic packet classification in receive path. The patchset uses a newly implemented control-plane firmware interface which optimizes flow insertions and deletions.

This is a baseline patchset with limited scale. Follow on patches will add support for more protocol headers, rte_flow attributes, actions and such.

This is a tech preview feature, hence disabled by default and can be enabled using bnxt devargs. For ex: "-w 0000:0d:00.0,host-based-truflow=1”.

v3==>v4
=======
1. Fixed some more compilation issues reported by CI

Ajit Kumar Khaparde (1):
net/bnxt: add updated dpdk hsi structure

Farah Smith (2):
net/bnxt: add tf core identifier support
net/bnxt: add tf core table scope support

Kishore Padmanabha (8):
net/bnxt: match rte flow items with flow template patterns net/bnxt: match rte flow actions with flow template actions net/bnxt: add support for rte flow item parsing net/bnxt: add support for rte flow action parsing net/bnxt: add support for rte flow create driver hook net/bnxt: add support for rte flow validate driver hook net/bnxt: add support for rte flow destroy driver hook net/bnxt: add support for rte flow flush driver hook

Michael Wildt (4):
net/bnxt: add initial tf core session open net/bnxt: add initial tf core session close support net/bnxt: add tf core session sram functions net/bnxt: add resource manager functionality

Mike Baucom (5):
net/bnxt: add helper functions for blob/regfile ops net/bnxt: add support to process action tables net/bnxt: add support to process key tables net/bnxt: add support to free key and action tables net/bnxt: add support to alloc and program key and act tbls

Pete Spreadborough (2):
net/bnxt: add truflow message handlers
net/bnxt: add EM/EEM functionality

Randy Schacher (1):
net/bnxt: update hwrm prep to use ptr

Shahaji Bhosle (2):
net/bnxt: add initial tf core resource mgmt support net/bnxt: add tf core TCAM support

Quoted 11 lines

Venkat Duvvuru (9):
net/bnxt: fetch SVIF information from the firmware net/bnxt: fetch vnic info from DPDK port
net/bnxt: add devargs parameter for host memory based TRUFLOW feature net/bnxt: add support for ULP session manager init net/bnxt: add support for ULP session manager cleanup net/bnxt: register tf rte flow ops
net/bnxt: disable vector mode when host based TRUFLOW is enabled net/bnxt: add support for injecting mark into packet’s mbuf net/bnxt: enable meson build on truflow code

Can you please update the release notes too?
Also what do you think about updating the PMD documentation for TruFlow?

These can be separate patches and can be merged to next-net separately.

Thanks,
ferruh

#148 lore raw
Quoted 74 lines · Ferruh Yigit
Quoted 8 lines · Venkat Duvvuru

This patchset introduces a new mechanism to allow host-memory based flow table management. This should allow higher flow scalability than what is currently supported. This new approach also defines a new rte_flow parser, and mapper which currently supports basic packet classification in receive path. The patchset uses a newly implemented control-plane firmware interface which optimizes flow insertions and deletions.

Quoted 5 lines

This is a baseline patchset with limited scale. Follow on patches will add support for more protocol headers, rte_flow attributes, actions and such.

This is a tech preview feature, hence disabled by default and can be

enabled

Quoted 47 lines

using bnxt devargs. For ex: "-w 0000:0d:00.0,host-based-truflow=1”.

v3==>v4
=======
1. Fixed some more compilation issues reported by CI

Ajit Kumar Khaparde (1):
net/bnxt: add updated dpdk hsi structure

Farah Smith (2):
net/bnxt: add tf core identifier support
net/bnxt: add tf core table scope support

Kishore Padmanabha (8):
net/bnxt: match rte flow items with flow template patterns net/bnxt: match rte flow actions with flow template actions net/bnxt: add support for rte flow item parsing net/bnxt: add support for rte flow action parsing net/bnxt: add support for rte flow create driver hook net/bnxt: add support for rte flow validate driver hook net/bnxt: add support for rte flow destroy driver hook net/bnxt: add support for rte flow flush driver hook

Michael Wildt (4):
net/bnxt: add initial tf core session open net/bnxt: add initial tf core session close support net/bnxt: add tf core session sram functions net/bnxt: add resource manager functionality

Mike Baucom (5):
net/bnxt: add helper functions for blob/regfile ops net/bnxt: add support to process action tables net/bnxt: add support to process key tables net/bnxt: add support to free key and action tables net/bnxt: add support to alloc and program key and act tbls

Pete Spreadborough (2):
net/bnxt: add truflow message handlers
net/bnxt: add EM/EEM functionality

Randy Schacher (1):
net/bnxt: update hwrm prep to use ptr

Shahaji Bhosle (2):
net/bnxt: add initial tf core resource mgmt support net/bnxt: add tf core TCAM support

Quoted 11 lines

Venkat Duvvuru (9):
net/bnxt: fetch SVIF information from the firmware net/bnxt: fetch vnic info from DPDK port
net/bnxt: add devargs parameter for host memory based TRUFLOW feature net/bnxt: add support for ULP session manager init net/bnxt: add support for ULP session manager cleanup net/bnxt: register tf rte flow ops
net/bnxt: disable vector mode when host based TRUFLOW is enabled net/bnxt: add support for injecting mark into packet’s mbuf net/bnxt: enable meson build on truflow code

Quoted 5 lines

Can you please update the release notes too?
Also what do you think about updating the PMD documentation for TruFlow?

These can be separate patches and can be merged to next-net separately.

Yes Ferruh. We. do have follow on patches. We will include the release notes update.
PMD documentation is also in the works. It will be submitted soon.

Quoted 5 lines

Thanks,
ferruh

#149 lore raw
In reply to Venkat Duvvuru
Quoted 60 lines · Venkat Duvvuru

This patchset introduces a new mechanism to allow host-memory based flow table management. This should allow higher flow scalability than what is currently supported. This new approach also defines a new rte_flow parser, and mapper which currently supports basic packet classification in receive path. The patchset uses a newly implemented control-plane firmware interface which optimizes flow insertions and deletions.

This is a baseline patchset with limited scale. Follow on patches will add support for more protocol headers, rte_flow attributes, actions and such.

This is a tech preview feature, hence disabled by default and can be enabled using bnxt devargs. For ex: "-w 0000:0d:00.0,host-based-truflow=1”.

v3==>v4
=======
1. Fixed some more compilation issues reported by CI

Ajit Kumar Khaparde (1):
net/bnxt: add updated dpdk hsi structure

Farah Smith (2):
net/bnxt: add tf core identifier support
net/bnxt: add tf core table scope support

Kishore Padmanabha (8):
net/bnxt: match rte flow items with flow template patterns net/bnxt: match rte flow actions with flow template actions net/bnxt: add support for rte flow item parsing net/bnxt: add support for rte flow action parsing net/bnxt: add support for rte flow create driver hook net/bnxt: add support for rte flow validate driver hook net/bnxt: add support for rte flow destroy driver hook net/bnxt: add support for rte flow flush driver hook

Michael Wildt (4):
net/bnxt: add initial tf core session open net/bnxt: add initial tf core session close support net/bnxt: add tf core session sram functions net/bnxt: add resource manager functionality

Mike Baucom (5):
net/bnxt: add helper functions for blob/regfile ops net/bnxt: add support to process action tables net/bnxt: add support to process key tables net/bnxt: add support to free key and action tables net/bnxt: add support to alloc and program key and act tbls

Pete Spreadborough (2):
net/bnxt: add truflow message handlers
net/bnxt: add EM/EEM functionality

Randy Schacher (1):
net/bnxt: update hwrm prep to use ptr

Shahaji Bhosle (2):
net/bnxt: add initial tf core resource mgmt support net/bnxt: add tf core TCAM support

Quoted 11 lines

Venkat Duvvuru (9):
net/bnxt: fetch SVIF information from the firmware net/bnxt: fetch vnic info from DPDK port
net/bnxt: add devargs parameter for host memory based TRUFLOW feature net/bnxt: add support for ULP session manager init net/bnxt: add support for ULP session manager cleanup net/bnxt: register tf rte flow ops
net/bnxt: disable vector mode when host based TRUFLOW is enabled net/bnxt: add support for injecting mark into packet’s mbuf net/bnxt: enable meson build on truflow code

Hi Ajit,

If there will be a new version, I suggest following commit titles, if they make sense can you update accordingly?

net/bnxt: update HSI structure
net/bnxt: update HWRM prep to use pointer net/bnxt: add TruFlow message handlers
net/bnxt: add initial TruFlow core session open net/bnxt: add initial TruFlow core session close net/bnxt: add TruFlow core session SRAM
net/bnxt: add initial TruFlow core resource management net/bnxt: add resource manager
net/bnxt: add TruFlow core identifier
net/bnxt: support TruFlow core TCAM
net/bnxt: support TruFlow core table scope net/bnxt: support EM/EEM
net/bnxt: fetch SVIF information from firmware net/bnxt: fetch VNIC info
net/bnxt: support host memory based TruFlow net/bnxt: support ULP session manager init net/bnxt: support ULP session manager cleanup net/bnxt: add helper functions for blob/regfile ops net/bnxt: support process action tables
net/bnxt: support process key tables
net/bnxt: support freeing key and action tables net/bnxt: support alloc and program key and act tables net/bnxt: match flow API items with flow template patterns net/bnxt: match flow API actions with flow template actions net/bnxt: support flow API item parsing
net/bnxt: support flow API action parsing net/bnxt: support flow API create
net/bnxt: support flow API validate
net/bnxt: support flow API destroy
net/bnxt: support flow API flush
net/bnxt: register TruFlow flow API ops
net/bnxt: disable vector mode on host based TruFlow net/bnxt: support marking packet
net/bnxt: enable meson build on TruFlow

#150 lore raw
Quoted 106 lines · Ferruh Yigit
Quoted 8 lines · Venkat Duvvuru

This patchset introduces a new mechanism to allow host-memory based flow table management. This should allow higher flow scalability than what is currently supported. This new approach also defines a new rte_flow parser, and mapper which currently supports basic packet classification in receive path. The patchset uses a newly implemented control-plane firmware interface which optimizes flow insertions and deletions.

Quoted 5 lines

This is a baseline patchset with limited scale. Follow on patches will add support for more protocol headers, rte_flow attributes, actions and such.

This is a tech preview feature, hence disabled by default and can be

enabled

Quoted 47 lines

using bnxt devargs. For ex: "-w 0000:0d:00.0,host-based-truflow=1”.

v3==>v4
=======
1. Fixed some more compilation issues reported by CI

Ajit Kumar Khaparde (1):
net/bnxt: add updated dpdk hsi structure

Farah Smith (2):
net/bnxt: add tf core identifier support
net/bnxt: add tf core table scope support

Kishore Padmanabha (8):
net/bnxt: match rte flow items with flow template patterns net/bnxt: match rte flow actions with flow template actions net/bnxt: add support for rte flow item parsing net/bnxt: add support for rte flow action parsing net/bnxt: add support for rte flow create driver hook net/bnxt: add support for rte flow validate driver hook net/bnxt: add support for rte flow destroy driver hook net/bnxt: add support for rte flow flush driver hook

Michael Wildt (4):
net/bnxt: add initial tf core session open net/bnxt: add initial tf core session close support net/bnxt: add tf core session sram functions net/bnxt: add resource manager functionality

Mike Baucom (5):
net/bnxt: add helper functions for blob/regfile ops net/bnxt: add support to process action tables net/bnxt: add support to process key tables net/bnxt: add support to free key and action tables net/bnxt: add support to alloc and program key and act tbls

Pete Spreadborough (2):
net/bnxt: add truflow message handlers
net/bnxt: add EM/EEM functionality

Randy Schacher (1):
net/bnxt: update hwrm prep to use ptr

Shahaji Bhosle (2):
net/bnxt: add initial tf core resource mgmt support net/bnxt: add tf core TCAM support

Quoted 11 lines

Venkat Duvvuru (9):
net/bnxt: fetch SVIF information from the firmware net/bnxt: fetch vnic info from DPDK port
net/bnxt: add devargs parameter for host memory based TRUFLOW feature net/bnxt: add support for ULP session manager init net/bnxt: add support for ULP session manager cleanup net/bnxt: register tf rte flow ops
net/bnxt: disable vector mode when host based TRUFLOW is enabled net/bnxt: add support for injecting mark into packet’s mbuf net/bnxt: enable meson build on truflow code

Hi Ajit,

If there will be a new version, I suggest following commit titles, if they make
sense can you update accordingly?

net/bnxt: update HSI structure
net/bnxt: update HWRM prep to use pointer net/bnxt: add TruFlow message handlers
net/bnxt: add initial TruFlow core session open net/bnxt: add initial TruFlow core session close net/bnxt: add TruFlow core session SRAM
net/bnxt: add initial TruFlow core resource management net/bnxt: add resource manager
net/bnxt: add TruFlow core identifier
net/bnxt: support TruFlow core TCAM
net/bnxt: support TruFlow core table scope net/bnxt: support EM/EEM
net/bnxt: fetch SVIF information from firmware net/bnxt: fetch VNIC info
net/bnxt: support host memory based TruFlow net/bnxt: support ULP session manager init net/bnxt: support ULP session manager cleanup net/bnxt: add helper functions for blob/regfile ops net/bnxt: support process action tables
net/bnxt: support process key tables
net/bnxt: support freeing key and action tables net/bnxt: support alloc and program key and act tables net/bnxt: match flow API items with flow template patterns net/bnxt: match flow API actions with flow template actions net/bnxt: support flow API item parsing
net/bnxt: support flow API action parsing

Quoted 9 lines

net/bnxt: support flow API create
net/bnxt: support flow API validate net/bnxt: support flow API destroy net/bnxt: support flow API flush
net/bnxt: register TruFlow flow API ops net/bnxt: disable vector mode on host based TruFlow net/bnxt: support marking packet
net/bnxt: enable meson build on TruFlow

Ferruh,
These look ok to me.
Do you want me to respin the set or can you handle it this time? I am fine with both.

Thanks
Ajit

#151 lore raw
Quoted 118 lines · Ajit Khaparde

On Thu, Apr 16, 2020 at 10:40 AM Ferruh Yigit <[email protected] <mailto:[email protected]>> wrote:

On 4/15/2020 9:18 AM, Venkat Duvvuru wrote:
> This patchset introduces a new mechanism to allow host-memory based > flow table management. This should allow higher flow scalability > than what is currently supported. This new approach also defines a > new rte_flow parser, and mapper which currently supports basic packet > classification in receive path. The patchset uses a newly implemented > control-plane firmware interface which optimizes flow insertions and > deletions.
>
> This is a baseline patchset with limited scale. Follow on patches will > add support for more protocol headers, rte_flow attributes, actions > and such.
>
> This is a tech preview feature, hence disabled by default and can be enabled > using bnxt devargs. For ex: "-w 0000:0d:00.0,host-based-truflow=1”. >
> v3==>v4
> =======
> 1. Fixed some more compilation issues reported by CI
>
> Ajit Kumar Khaparde (1):
>   net/bnxt: add updated dpdk hsi structure
>
> Farah Smith (2):
>   net/bnxt: add tf core identifier support
>   net/bnxt: add tf core table scope support
>
> Kishore Padmanabha (8):
>   net/bnxt: match rte flow items with flow template patterns
>   net/bnxt: match rte flow actions with flow template actions
>   net/bnxt: add support for rte flow item parsing
>   net/bnxt: add support for rte flow action parsing
>   net/bnxt: add support for rte flow create driver hook
>   net/bnxt: add support for rte flow validate driver hook
>   net/bnxt: add support for rte flow destroy driver hook
>   net/bnxt: add support for rte flow flush driver hook
>
> Michael Wildt (4):
>   net/bnxt: add initial tf core session open
>   net/bnxt: add initial tf core session close support
>   net/bnxt: add tf core session sram functions
>   net/bnxt: add resource manager functionality
>
> Mike Baucom (5):
>   net/bnxt: add helper functions for blob/regfile ops
>   net/bnxt: add support to process action tables
>   net/bnxt: add support to process key tables
>   net/bnxt: add support to free key and action tables
>   net/bnxt: add support to alloc and program key and act tbls
>
> Pete Spreadborough (2):
>   net/bnxt: add truflow message handlers
>   net/bnxt: add EM/EEM functionality
>
> Randy Schacher (1):
>   net/bnxt: update hwrm prep to use ptr
>
> Shahaji Bhosle (2):
>   net/bnxt: add initial tf core resource mgmt support
>   net/bnxt: add tf core TCAM support
>
> Venkat Duvvuru (9):
>   net/bnxt: fetch SVIF information from the firmware
>   net/bnxt: fetch vnic info from DPDK port
>   net/bnxt: add devargs parameter for host memory based TRUFLOW feature >   net/bnxt: add support for ULP session manager init
>   net/bnxt: add support for ULP session manager cleanup
>   net/bnxt: register tf rte flow ops
>   net/bnxt: disable vector mode when host based TRUFLOW is enabled >   net/bnxt: add support for injecting mark into packet’s mbuf
>   net/bnxt: enable meson build on truflow code
>

Hi Ajit,

If there will be a new version, I suggest following commit titles, if they make sense can you update accordingly?

 net/bnxt: update HSI structure
 net/bnxt: update HWRM prep to use pointer net/bnxt: add TruFlow message handlers
 net/bnxt: add initial TruFlow core session open net/bnxt: add initial TruFlow core session close net/bnxt: add TruFlow core session SRAM
 net/bnxt: add initial TruFlow core resource management net/bnxt: add resource manager
 net/bnxt: add TruFlow core identifier
 net/bnxt: support TruFlow core TCAM
 net/bnxt: support TruFlow core table scope net/bnxt: support EM/EEM
 net/bnxt: fetch SVIF information from firmware net/bnxt: fetch VNIC info
 net/bnxt: support host memory based TruFlow net/bnxt: support ULP session manager init net/bnxt: support ULP session manager cleanup net/bnxt: add helper functions for blob/regfile ops net/bnxt: support process action tables
 net/bnxt: support process key tables
 net/bnxt: support freeing key and action tables net/bnxt: support alloc and program key and act tables net/bnxt: match flow API items with flow template patterns net/bnxt: match flow API actions with flow template actions net/bnxt: support flow API item parsing
 net/bnxt: support flow API action parsing net/bnxt: support flow API create
 net/bnxt: support flow API validate
 net/bnxt: support flow API destroy
 net/bnxt: support flow API flush
 net/bnxt: register TruFlow flow API ops
 net/bnxt: disable vector mode on host based TruFlow net/bnxt: support marking packet
 net/bnxt: enable meson build on TruFlow

Quoted 4 lines

Ferruh,
These look ok to me.
Do you want me to respin the set or can you handle it this time? I am fine with both.

Hi Ajit,

Let me check if I can fix the build errors quickly, if so it is easier for me to handle myself. If I can't fix them I will ping you.

#152 lore raw
Quoted 124 lines · Ferruh Yigit
Quoted 118 lines · Ajit Khaparde

On Thu, Apr 16, 2020 at 10:40 AM Ferruh Yigit <[email protected] <mailto:[email protected]>> wrote:

On 4/15/2020 9:18 AM, Venkat Duvvuru wrote:
> This patchset introduces a new mechanism to allow host-memory based > flow table management. This should allow higher flow scalability > than what is currently supported. This new approach also defines a > new rte_flow parser, and mapper which currently supports basic packet > classification in receive path. The patchset uses a newly implemented > control-plane firmware interface which optimizes flow insertions and > deletions.
>
> This is a baseline patchset with limited scale. Follow on patches will > add support for more protocol headers, rte_flow attributes, actions > and such.
>
> This is a tech preview feature, hence disabled by default and can be enabled > using bnxt devargs. For ex: "-w 0000:0d:00.0,host-based-truflow=1”. >
> v3==>v4
> =======
> 1. Fixed some more compilation issues reported by CI
>
> Ajit Kumar Khaparde (1):
>   net/bnxt: add updated dpdk hsi structure
>
> Farah Smith (2):
>   net/bnxt: add tf core identifier support
>   net/bnxt: add tf core table scope support
>
> Kishore Padmanabha (8):
>   net/bnxt: match rte flow items with flow template patterns
>   net/bnxt: match rte flow actions with flow template actions
>   net/bnxt: add support for rte flow item parsing
>   net/bnxt: add support for rte flow action parsing
>   net/bnxt: add support for rte flow create driver hook
>   net/bnxt: add support for rte flow validate driver hook
>   net/bnxt: add support for rte flow destroy driver hook
>   net/bnxt: add support for rte flow flush driver hook
>
> Michael Wildt (4):
>   net/bnxt: add initial tf core session open
>   net/bnxt: add initial tf core session close support
>   net/bnxt: add tf core session sram functions
>   net/bnxt: add resource manager functionality
>
> Mike Baucom (5):
>   net/bnxt: add helper functions for blob/regfile ops
>   net/bnxt: add support to process action tables
>   net/bnxt: add support to process key tables
>   net/bnxt: add support to free key and action tables
>   net/bnxt: add support to alloc and program key and act tbls
>
> Pete Spreadborough (2):
>   net/bnxt: add truflow message handlers
>   net/bnxt: add EM/EEM functionality
>
> Randy Schacher (1):
>   net/bnxt: update hwrm prep to use ptr
>
> Shahaji Bhosle (2):
>   net/bnxt: add initial tf core resource mgmt support
>   net/bnxt: add tf core TCAM support
>
> Venkat Duvvuru (9):
>   net/bnxt: fetch SVIF information from the firmware
>   net/bnxt: fetch vnic info from DPDK port
>   net/bnxt: add devargs parameter for host memory based TRUFLOW feature >   net/bnxt: add support for ULP session manager init
>   net/bnxt: add support for ULP session manager cleanup
>   net/bnxt: register tf rte flow ops
>   net/bnxt: disable vector mode when host based TRUFLOW is enabled >   net/bnxt: add support for injecting mark into packet’s mbuf
>   net/bnxt: enable meson build on truflow code
>

Hi Ajit,

If there will be a new version, I suggest following commit titles, if they make sense can you update accordingly?

 net/bnxt: update HSI structure
 net/bnxt: update HWRM prep to use pointer net/bnxt: add TruFlow message handlers
 net/bnxt: add initial TruFlow core session open net/bnxt: add initial TruFlow core session close net/bnxt: add TruFlow core session SRAM
 net/bnxt: add initial TruFlow core resource management net/bnxt: add resource manager
 net/bnxt: add TruFlow core identifier
 net/bnxt: support TruFlow core TCAM
 net/bnxt: support TruFlow core table scope net/bnxt: support EM/EEM
 net/bnxt: fetch SVIF information from firmware net/bnxt: fetch VNIC info
 net/bnxt: support host memory based TruFlow net/bnxt: support ULP session manager init net/bnxt: support ULP session manager cleanup net/bnxt: add helper functions for blob/regfile ops net/bnxt: support process action tables
 net/bnxt: support process key tables
 net/bnxt: support freeing key and action tables net/bnxt: support alloc and program key and act tables net/bnxt: match flow API items with flow template patterns net/bnxt: match flow API actions with flow template actions net/bnxt: support flow API item parsing
 net/bnxt: support flow API action parsing net/bnxt: support flow API create
 net/bnxt: support flow API validate
 net/bnxt: support flow API destroy
 net/bnxt: support flow API flush
 net/bnxt: register TruFlow flow API ops
 net/bnxt: disable vector mode on host based TruFlow net/bnxt: support marking packet
 net/bnxt: enable meson build on TruFlow

Quoted 4 lines

Ferruh,
These look ok to me.
Do you want me to respin the set or can you handle it this time? I am fine with both.

Quoted 5 lines

Hi Ajit,

Let me check if I can fix the build errors quickly, if so it is easier for me to handle myself. If I can't fix them I will ping you.

Fixed and pulled.

#153 lore raw
Quoted 135 lines · Ferruh Yigit
Quoted 8 lines · Ferruh Yigit
Quoted 7 lines · Ajit Khaparde

On Thu, Apr 16, 2020 at 10:40 AM Ferruh Yigit <[email protected] <mailto:[email protected]>> wrote:

On 4/15/2020 9:18 AM, Venkat Duvvuru wrote:
> This patchset introduces a new mechanism to allow host-memory

based

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

flow table management. This should allow higher flow scalability than what is currently supported. This new approach also defines a new rte_flow parser, and mapper which currently supports basic

packet

Quoted 1 line
Quoted 1 line
Quoted 1 line

classification in receive path. The patchset uses a newly

implemented

Quoted 1 line
Quoted 1 line
Quoted 1 line

control-plane firmware interface which optimizes flow insertions

and

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

deletions.

This is a baseline patchset with limited scale. Follow on patches

will

Quoted 1 line
Quoted 1 line
Quoted 1 line

add support for more protocol headers, rte_flow attributes,

actions

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

and such.

This is a tech preview feature, hence disabled by default and can

be enabled

Quoted 1 line
Quoted 1 line
Quoted 1 line

using bnxt devargs. For ex: "-w

0000:0d:00.0,host-based-truflow=1”.

Quoted 42 lines
Quoted 42 lines
Quoted 42 lines

v3==>v4
=======
1. Fixed some more compilation issues reported by CI

Ajit Kumar Khaparde (1):
net/bnxt: add updated dpdk hsi structure

Farah Smith (2):
net/bnxt: add tf core identifier support
net/bnxt: add tf core table scope support

Kishore Padmanabha (8):
net/bnxt: match rte flow items with flow template patterns net/bnxt: match rte flow actions with flow template actions net/bnxt: add support for rte flow item parsing net/bnxt: add support for rte flow action parsing net/bnxt: add support for rte flow create driver hook net/bnxt: add support for rte flow validate driver hook net/bnxt: add support for rte flow destroy driver hook net/bnxt: add support for rte flow flush driver hook

Michael Wildt (4):
net/bnxt: add initial tf core session open net/bnxt: add initial tf core session close support net/bnxt: add tf core session sram functions net/bnxt: add resource manager functionality

Mike Baucom (5):
net/bnxt: add helper functions for blob/regfile ops net/bnxt: add support to process action tables net/bnxt: add support to process key tables net/bnxt: add support to free key and action tables net/bnxt: add support to alloc and program key and act tbls

Pete Spreadborough (2):
net/bnxt: add truflow message handlers
net/bnxt: add EM/EEM functionality

Randy Schacher (1):
net/bnxt: update hwrm prep to use ptr

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

Shahaji Bhosle (2):
net/bnxt: add initial tf core resource mgmt support net/bnxt: add tf core TCAM support

Venkat Duvvuru (9):
net/bnxt: fetch SVIF information from the firmware net/bnxt: fetch vnic info from DPDK port
net/bnxt: add devargs parameter for host memory based TRUFLOW

feature

Quoted 11 lines
Quoted 11 lines
Quoted 7 lines

net/bnxt: add support for ULP session manager init net/bnxt: add support for ULP session manager cleanup net/bnxt: register tf rte flow ops
net/bnxt: disable vector mode when host based TRUFLOW is enabled net/bnxt: add support for injecting mark into packet’s mbuf net/bnxt: enable meson build on truflow code

Hi Ajit,

If there will be a new version, I suggest following commit titles,

if they make

Quoted 42 lines
Quoted 41 lines

sense can you update accordingly?

net/bnxt: update HSI structure
net/bnxt: update HWRM prep to use pointer net/bnxt: add TruFlow message handlers
net/bnxt: add initial TruFlow core session open net/bnxt: add initial TruFlow core session close net/bnxt: add TruFlow core session SRAM
net/bnxt: add initial TruFlow core resource management net/bnxt: add resource manager
net/bnxt: add TruFlow core identifier
net/bnxt: support TruFlow core TCAM
net/bnxt: support TruFlow core table scope net/bnxt: support EM/EEM
net/bnxt: fetch SVIF information from firmware net/bnxt: fetch VNIC info
net/bnxt: support host memory based TruFlow net/bnxt: support ULP session manager init net/bnxt: support ULP session manager cleanup net/bnxt: add helper functions for blob/regfile ops net/bnxt: support process action tables
net/bnxt: support process key tables
net/bnxt: support freeing key and action tables net/bnxt: support alloc and program key and act tables net/bnxt: match flow API items with flow template patterns net/bnxt: match flow API actions with flow template actions net/bnxt: support flow API item parsing
net/bnxt: support flow API action parsing net/bnxt: support flow API create
net/bnxt: support flow API validate
net/bnxt: support flow API destroy
net/bnxt: support flow API flush
net/bnxt: register TruFlow flow API ops
net/bnxt: disable vector mode on host based TruFlow net/bnxt: support marking packet
net/bnxt: enable meson build on TruFlow

Ferruh,
These look ok to me.
Do you want me to respin the set or can you handle it this time? I am fine with both.

Quoted 9 lines
Quoted 3 lines

Hi Ajit,

Let me check if I can fix the build errors quickly, if so it is easier

for me to

Quoted 2 lines

handle myself. If I can't fix them I will ping you.

Fixed and pulled.

Thanks Ferruh.