add features for host-based flow management
Subsystems (2)
PATCH v5 9/51 net/bnxt: add support for exact match
In reply to Ajit KhapardeFrom: Peter Spreadborough <[email protected]>
- Add Exact Match support
- Create EM table pool of memory indices
- Insert exact match internal entry API
- Sends EM internal insert and delete request to firmware
--- drivers/net/bnxt/hsi_struct_def_dpdk.h | 3091 ++++++++++++++--- drivers/net/bnxt/tf_core/hwrm_tf.h | 9 + drivers/net/bnxt/tf_core/lookup3.h | 1 - drivers/net/bnxt/tf_core/stack.c | 8 + drivers/net/bnxt/tf_core/stack.h | 10 + drivers/net/bnxt/tf_core/tf_core.c | 144 +- drivers/net/bnxt/tf_core/tf_core.h | 383 +- drivers/net/bnxt/tf_core/tf_em.c | 98 +- drivers/net/bnxt/tf_core/tf_em.h | 31 + drivers/net/bnxt/tf_core/tf_ext_flow_handle.h | 12 + drivers/net/bnxt/tf_core/tf_msg.c | 86 +- drivers/net/bnxt/tf_core/tf_msg.h | 13 + drivers/net/bnxt/tf_core/tf_session.h | 18 + drivers/net/bnxt/tf_core/tf_tbl.c | 99 +- drivers/net/bnxt/tf_core/tf_tbl.h | 57 +- drivers/net/bnxt/tf_core/tfp.h | 123 +- 16 files changed, 3493 insertions(+), 690 deletions(-)
drivers/net/bnxt/hsi_struct_def_dpdk.h +2656 -435
@@ -611,6 +611,10 @@ struct cmd_nums {#define HWRM_FUNC_VF_BW_QCFG UINT32_C(0x196)/* Queries pf ids belong to specified host(s) */ #define HWRM_FUNC_HOST_PF_IDS_QUERY UINT32_C(0x197) +/* Queries extended stats per function */ +#define HWRM_FUNC_QSTATS_EXT UINT32_C(0x198) +/* Queries exteded statitics context */ +#define HWRM_STAT_EXT_CTX_QUERY UINT32_C(0x199)/* Experimental */ #define HWRM_SELFTEST_QLIST UINT32_C(0x200)/* Experimental */
@@ -647,41 +651,49 @@ struct cmd_nums {/* Experimental */ #define HWRM_TF_SESSION_ATTACH UINT32_C(0x2c7)/* Experimental */ -#define HWRM_TF_SESSION_CLOSE UINT32_C(0x2c8) +#define HWRM_TF_SESSION_REGISTER UINT32_C(0x2c8)/* Experimental */ -#define HWRM_TF_SESSION_QCFG UINT32_C(0x2c9) +#define HWRM_TF_SESSION_UNREGISTER UINT32_C(0x2c9)/* Experimental */ -#define HWRM_TF_SESSION_RESC_QCAPS UINT32_C(0x2ca) +#define HWRM_TF_SESSION_CLOSE UINT32_C(0x2ca)/* Experimental */ -#define HWRM_TF_SESSION_RESC_ALLOC UINT32_C(0x2cb) +#define HWRM_TF_SESSION_QCFG UINT32_C(0x2cb)/* Experimental */ -#define HWRM_TF_SESSION_RESC_FREE UINT32_C(0x2cc) +#define HWRM_TF_SESSION_RESC_QCAPS UINT32_C(0x2cc)/* Experimental */ -#define HWRM_TF_SESSION_RESC_FLUSH UINT32_C(0x2cd) +#define HWRM_TF_SESSION_RESC_ALLOC UINT32_C(0x2cd)/* Experimental */ -#define HWRM_TF_TBL_TYPE_GET UINT32_C(0x2d0) +#define HWRM_TF_SESSION_RESC_FREE UINT32_C(0x2ce)/* Experimental */ -#define HWRM_TF_TBL_TYPE_SET UINT32_C(0x2d1) +#define HWRM_TF_SESSION_RESC_FLUSH UINT32_C(0x2cf)/* Experimental */ -#define HWRM_TF_CTXT_MEM_RGTR UINT32_C(0x2da) +#define HWRM_TF_TBL_TYPE_GET UINT32_C(0x2da)/* Experimental */ -#define HWRM_TF_CTXT_MEM_UNRGTR UINT32_C(0x2db) +#define HWRM_TF_TBL_TYPE_SET UINT32_C(0x2db)/* Experimental */ -#define HWRM_TF_EXT_EM_QCAPS UINT32_C(0x2dc) +#define HWRM_TF_CTXT_MEM_RGTR UINT32_C(0x2e4)/* Experimental */ -#define HWRM_TF_EXT_EM_OP UINT32_C(0x2dd) +#define HWRM_TF_CTXT_MEM_UNRGTR UINT32_C(0x2e5)/* Experimental */ -#define HWRM_TF_EXT_EM_CFG UINT32_C(0x2de) +#define HWRM_TF_EXT_EM_QCAPS UINT32_C(0x2e6)/* Experimental */ -#define HWRM_TF_EXT_EM_QCFG UINT32_C(0x2df) +#define HWRM_TF_EXT_EM_OP UINT32_C(0x2e7)/* Experimental */ -#define HWRM_TF_TCAM_SET UINT32_C(0x2ee) +#define HWRM_TF_EXT_EM_CFG UINT32_C(0x2e8)/* Experimental */ -#define HWRM_TF_TCAM_GET UINT32_C(0x2ef) +#define HWRM_TF_EXT_EM_QCFG UINT32_C(0x2e9)/* Experimental */ -#define HWRM_TF_TCAM_MOVE UINT32_C(0x2f0) +#define HWRM_TF_EM_INSERT UINT32_C(0x2ea)/* Experimental */ -#define HWRM_TF_TCAM_FREE UINT32_C(0x2f1) +#define HWRM_TF_EM_DELETE UINT32_C(0x2eb) +/* Experimental */ +#define HWRM_TF_TCAM_SET UINT32_C(0x2f8) +/* Experimental */ +#define HWRM_TF_TCAM_GET UINT32_C(0x2f9) +/* Experimental */ +#define HWRM_TF_TCAM_MOVE UINT32_C(0x2fa) +/* Experimental */ +#define HWRM_TF_TCAM_FREE UINT32_C(0x2fb)/* Experimental */ #define HWRM_SV UINT32_C(0x400)/* Experimental */
@@ -715,6 +727,13 @@ struct cmd_nums {#define HWRM_DBG_CRASHDUMP_ERASE UINT32_C(0xff1e)/* Send driver debug information to firmware */ #define HWRM_DBG_DRV_TRACE UINT32_C(0xff1f) +/* Query debug capabilities of firmware */ +#define HWRM_DBG_QCAPS UINT32_C(0xff20) +/* Retrieve debug settings of firmware */ +#define HWRM_DBG_QCFG UINT32_C(0xff21) +/* Set destination parameters for crashdump medium */ +#define HWRM_DBG_CRASHDUMP_MEDIUM_CFG UINT32_C(0xff22) +#define HWRM_NVM_REQ_ARBITRATION UINT32_C(0xffed)/* Experimental */ #define HWRM_NVM_FACTORY_DEFAULTS UINT32_C(0xffee)#define HWRM_NVM_VALIDATE_OPTION UINT32_C(0xffef)
@@ -914,8 +933,8 @@ struct hwrm_err_output {#define HWRM_VERSION_MINOR 10#define HWRM_VERSION_UPDATE 1/* non-zero means beta version */ -#define HWRM_VERSION_RSVD 30 -#define HWRM_VERSION_STR "1.10.1.30" +#define HWRM_VERSION_RSVD 45 +#define HWRM_VERSION_STR "1.10.1.45"/**************** * hwrm_ver_get *
@@ -2292,6 +2311,35 @@ struct cmpl_base {* Completion of TX packet. Length = 16B */ #define CMPL_BASE_TYPE_TX_L2 UINT32_C(0x0) +/* +* NO-OP completion: +* Completion of NO-OP. Length = 16B +*/ +#define CMPL_BASE_TYPE_NO_OP UINT32_C(0x1) +/* +* TX L2 coalesced completion: +* Completion of coalesced TX packet. Length = 16B +*/ +#define CMPL_BASE_TYPE_TX_L2_COAL UINT32_C(0x2) +/* +* TX L2 PTP completion: +* Completion of PTP TX packet. Length = 32B +*/ +#define CMPL_BASE_TYPE_TX_L2_PTP UINT32_C(0x3) +/* +* RX L2 TPA Start V2 Completion: +* Completion of and L2 RX packet. Length = 32B +* This is the new version of the RX_TPA_START completion used +* in SR2 and later chips. +*/ +#define CMPL_BASE_TYPE_RX_TPA_START_V2 UINT32_C(0xd) +/* +* RX L2 V2 completion: +* Completion of and L2 RX packet. Length = 32B +* This is the new version of the RX_L2 completion used in SR2 +* and later chips. +*/ +#define CMPL_BASE_TYPE_RX_L2_V2 UINT32_C(0xf)/* * RX L2 completion: * Completion of and L2 RX packet. Length = 32B
@@ -2321,6 +2369,24 @@ struct cmpl_base {* Length = 16B */ #define CMPL_BASE_TYPE_STAT_EJECT UINT32_C(0x1a) +/* +* VEE Flush Completion: +* This completion is inserted manually by +* the Primate and processed by the VEE hardware to ensure that +* all completions on a VEE function have been processed by the +* VEE hardware before FLR process is completed. +*/ +#define CMPL_BASE_TYPE_VEE_FLUSH UINT32_C(0x1c) +/* +* Mid Path Short Completion : +* Completion of a Mid Path Command. Length = 16B +*/ +#define CMPL_BASE_TYPE_MID_PATH_SHORT UINT32_C(0x1e) +/* +* Mid Path Long Completion : +* Completion of a Mid Path Command. Length = 32B +*/ +#define CMPL_BASE_TYPE_MID_PATH_LONG UINT32_C(0x1f)/* * HWRM Command Completion: * Completion of an HWRM command.
@@ -2398,7 +2464,9 @@ struct tx_cmpl {uint16_t unused_0;/* * This is a copy of the opaque field from the first TX BD of this -* transmitted packet. +* transmitted packet. Note that, if the packet was described by a short +* CSO or short CSO inline BD, then the 16-bit opaque field from the +* short CSO BD will appear in the bottom 16 bits of this field. */ uint32_t opaque;uint16_t errors_v;
@@ -2407,58 +2475,352 @@ struct tx_cmpl {* for each pass through the completion queue. The even passes * will write 1. The odd passes will write 0. */ -#define TX_CMPL_V UINT32_C(0x1) -#define TX_CMPL_ERRORS_MASK UINT32_C(0xfffe) -#define TX_CMPL_ERRORS_SFT 1 +#define TX_CMPL_V UINT32_C(0x1) +#define TX_CMPL_ERRORS_MASK UINT32_C(0xfffe) +#define TX_CMPL_ERRORS_SFT 1/* * This error indicates that there was some sort of problem * with the BDs for the packet. */ -#define TX_CMPL_ERRORS_BUFFER_ERROR_MASK UINT32_C(0xe) -#define TX_CMPL_ERRORS_BUFFER_ERROR_SFT 1 +#define TX_CMPL_ERRORS_BUFFER_ERROR_MASK UINT32_C(0xe) +#define TX_CMPL_ERRORS_BUFFER_ERROR_SFT 1/* No error */ -#define TX_CMPL_ERRORS_BUFFER_ERROR_NO_ERROR (UINT32_C(0x0) << 1) +#define TX_CMPL_ERRORS_BUFFER_ERROR_NO_ERROR \ + (UINT32_C(0x0) << 1)/* * Bad Format: * BDs were not formatted correctly. */ -#define TX_CMPL_ERRORS_BUFFER_ERROR_BAD_FMT (UINT32_C(0x2) << 1) +#define TX_CMPL_ERRORS_BUFFER_ERROR_BAD_FMT \ + (UINT32_C(0x2) << 1)#define TX_CMPL_ERRORS_BUFFER_ERROR_LAST \ TX_CMPL_ERRORS_BUFFER_ERROR_BAD_FMT/* * When this bit is '1', it indicates that the length of * the packet was zero. No packet was transmitted. */ -#define TX_CMPL_ERRORS_ZERO_LENGTH_PKT UINT32_C(0x10) +#define TX_CMPL_ERRORS_ZERO_LENGTH_PKT UINT32_C(0x10)/* * When this bit is '1', it indicates that the packet * was longer than the programmed limit in TDI. No * packet was transmitted. */ -#define TX_CMPL_ERRORS_EXCESSIVE_BD_LENGTH UINT32_C(0x20) +#define TX_CMPL_ERRORS_EXCESSIVE_BD_LENGTH UINT32_C(0x20)/* * When this bit is '1', it indicates that one or more of the * BDs associated with this packet generated a PCI error. * This probably means the address was not valid. */ -#define TX_CMPL_ERRORS_DMA_ERROR UINT32_C(0x40) +#define TX_CMPL_ERRORS_DMA_ERROR UINT32_C(0x40)/* * When this bit is '1', it indicates that the packet was longer * than indicated by the hint. No packet was transmitted. */ -#define TX_CMPL_ERRORS_HINT_TOO_SHORT UINT32_C(0x80) +#define TX_CMPL_ERRORS_HINT_TOO_SHORT UINT32_C(0x80)/* * When this bit is '1', it indicates that the packet was * dropped due to Poison TLP error on one or more of the * TLPs in the PXP completion. */ -#define TX_CMPL_ERRORS_POISON_TLP_ERROR UINT32_C(0x100) +#define TX_CMPL_ERRORS_POISON_TLP_ERROR UINT32_C(0x100) +/* +* When this bit is '1', it indicates that the packet was dropped +* due to a transient internal error in TDC. The packet or LSO can +* be retried and may transmit successfully on a subsequent attempt. +*/ +#define TX_CMPL_ERRORS_INTERNAL_ERROR UINT32_C(0x200) +/* +* When this bit is '1', it was not possible to collect a a timestamp +* for a PTP completion, in which case the timestamp_hi and +* timestamp_lo fields are invalid. When this bit is '0' for a PTP +* completion, the timestamp_hi and timestamp_lo fields are valid. +* RJRN will copy the value of this bit into the field of the same +* name in all TX completions, regardless of whether such completions +* are PTP completions or other TX completions. +*/ +#define TX_CMPL_ERRORS_TIMESTAMP_INVALID_ERROR UINT32_C(0x400)/* unused2 is 16 b */ uint16_t unused_1;/* unused3 is 32 b */ uint32_t unused_2; } __rte_packed; +/* tx_cmpl_coal (size:128b/16B) */ +struct tx_cmpl_coal { +uint16_t flags_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 TX_CMPL_COAL_TYPE_MASK UINT32_C(0x3f) +#define TX_CMPL_COAL_TYPE_SFT 0 +/* +* TX L2 coalesced completion: +* Completion of TX packet. Length = 16B +*/ +#define TX_CMPL_COAL_TYPE_TX_L2_COAL UINT32_C(0x2) +#define TX_CMPL_COAL_TYPE_LAST TX_CMPL_COAL_TYPE_TX_L2_COAL +#define TX_CMPL_COAL_FLAGS_MASK UINT32_C(0xffc0) +#define TX_CMPL_COAL_FLAGS_SFT 6 +/* +* When this bit is '1', it indicates a packet that has an +* error of some type. Type of error is indicated in +* error_flags. +*/ +#define TX_CMPL_COAL_FLAGS_ERROR UINT32_C(0x40) +/* +* When this bit is '1', it indicates that the packet completed +* was transmitted using the push acceleration data provided +* by the driver. When this bit is '0', it indicates that the +* packet had not push acceleration data written or was executed +* as a normal packet even though push data was provided. +*/ +#define TX_CMPL_COAL_FLAGS_PUSH UINT32_C(0x80) +/* unused1 is 16 b */ +uint16_t unused_0; +/* +* This is a copy of the opaque field from the first TX BD of the packet +* which corresponds with the reported sq_cons_idx. Note that, with +* coalesced completions, completions are generated for only some of the +* packets. The driver will see the opaque field for only those packets. +* Note that, if the packet was described by a short CSO or short CSO +* inline BD, then the 16-bit opaque field from the short CSO BD will +* appear in the bottom 16 bits of this field. For TX rings with +* completion coalescing enabled (which would use the coalesced +* completion record), it is suggested that the driver populate the +* opaque field to indicate the specific TX ring with which the +* completion is associated, then utilize the opaque and sq_cons_idx +* fields in the coalesced completion record to determine the specific +* packets that are to be completed on that ring. +*/ +uint32_t opaque; +uint16_t errors_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 TX_CMPL_COAL_V UINT32_C(0x1) +#define TX_CMPL_COAL_ERRORS_MASK \ + UINT32_C(0xfffe) +#define TX_CMPL_COAL_ERRORS_SFT 1 +/* +* This error indicates that there was some sort of problem +* with the BDs for the packet. +*/ +#define TX_CMPL_COAL_ERRORS_BUFFER_ERROR_MASK UINT32_C(0xe) +#define TX_CMPL_COAL_ERRORS_BUFFER_ERROR_SFT 1 +/* No error */ +#define TX_CMPL_COAL_ERRORS_BUFFER_ERROR_NO_ERROR \ + (UINT32_C(0x0) << 1) +/* +* Bad Format: +* BDs were not formatted correctly. +*/ +#define TX_CMPL_COAL_ERRORS_BUFFER_ERROR_BAD_FMT \ + (UINT32_C(0x2) << 1) +#define TX_CMPL_COAL_ERRORS_BUFFER_ERROR_LAST \ + TX_CMPL_COAL_ERRORS_BUFFER_ERROR_BAD_FMT +/* +* When this bit is '1', it indicates that the length of +* the packet was zero. No packet was transmitted. +*/ +#define TX_CMPL_COAL_ERRORS_ZERO_LENGTH_PKT UINT32_C(0x10) +/* +* When this bit is '1', it indicates that the packet +* was longer than the programmed limit in TDI. No +* packet was transmitted. +*/ +#define TX_CMPL_COAL_ERRORS_EXCESSIVE_BD_LENGTH UINT32_C(0x20) +/* +* When this bit is '1', it indicates that one or more of the +* BDs associated with this packet generated a PCI error. +* This probably means the address was not valid. +*/ +#define TX_CMPL_COAL_ERRORS_DMA_ERROR UINT32_C(0x40) +/* +* When this bit is '1', it indicates that the packet was longer +* than indicated by the hint. No packet was transmitted. +*/ +#define TX_CMPL_COAL_ERRORS_HINT_TOO_SHORT UINT32_C(0x80) +/* +* When this bit is '1', it indicates that the packet was +* dropped due to Poison TLP error on one or more of the +* TLPs in the PXP completion. +*/ +#define TX_CMPL_COAL_ERRORS_POISON_TLP_ERROR \ + UINT32_C(0x100) +/* +* When this bit is '1', it indicates that the packet was dropped +* due to a transient internal error in TDC. The packet or LSO can +* be retried and may transmit successfully on a subsequent attempt. +*/ +#define TX_CMPL_COAL_ERRORS_INTERNAL_ERROR \ + UINT32_C(0x200) +/* +* When this bit is '1', it was not possible to collect a a timestamp +* for a PTP completion, in which case the timestamp_hi and +* timestamp_lo fields are invalid. When this bit is '0' for a PTP +* completion, the timestamp_hi and timestamp_lo fields are valid. +* RJRN will copy the value of this bit into the field of the same +* name in all TX completions, regardless of whether such +* completions are PTP completions or other TX completions. +*/ +#define TX_CMPL_COAL_ERRORS_TIMESTAMP_INVALID_ERROR \ + UINT32_C(0x400) +/* unused2 is 16 b */ +uint16_t unused_1; +uint32_t sq_cons_idx; +/* +* This value is SQ index for the start of the packet following the +* last completed packet. +*/ +#define TX_CMPL_COAL_SQ_CONS_IDX_MASK UINT32_C(0xffffff) +#define TX_CMPL_COAL_SQ_CONS_IDX_SFT 0 +} __rte_packed; + +/* tx_cmpl_ptp (size:128b/16B) */ +struct tx_cmpl_ptp { +uint16_t flags_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 TX_CMPL_PTP_TYPE_MASK UINT32_C(0x3f) +#define TX_CMPL_PTP_TYPE_SFT 0 +/* +* TX L2 PTP completion: +* Completion of TX packet. Length = 32B +*/ +#define TX_CMPL_PTP_TYPE_TX_L2_PTP UINT32_C(0x2) +#define TX_CMPL_PTP_TYPE_LAST TX_CMPL_PTP_TYPE_TX_L2_PTP +#define TX_CMPL_PTP_FLAGS_MASK UINT32_C(0xffc0) +#define TX_CMPL_PTP_FLAGS_SFT 6 +/* +* When this bit is '1', it indicates a packet that has an +* error of some type. Type of error is indicated in +* error_flags. +*/ +#define TX_CMPL_PTP_FLAGS_ERROR UINT32_C(0x40) +/* +* When this bit is '1', it indicates that the packet completed +* was transmitted using the push acceleration data provided +* by the driver. When this bit is '0', it indicates that the +* packet had not push acceleration data written or was executed +* as a normal packet even though push data was provided. +*/ +#define TX_CMPL_PTP_FLAGS_PUSH UINT32_C(0x80) +/* unused1 is 16 b */ +uint16_t unused_0; +/* +* This is a copy of the opaque field from the first TX BD of this +* transmitted packet. Note that, if the packet was described by a short +* CSO or short CSO inline BD, then the 16-bit opaque field from the +* short CSO BD will appear in the bottom 16 bits of this field. +*/ +uint32_t opaque; +uint16_t errors_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 TX_CMPL_PTP_V UINT32_C(0x1) +#define TX_CMPL_PTP_ERRORS_MASK UINT32_C(0xfffe) +#define TX_CMPL_PTP_ERRORS_SFT 1 +/* +* This error indicates that there was some sort of problem +* with the BDs for the packet. +*/ +#define TX_CMPL_PTP_ERRORS_BUFFER_ERROR_MASK UINT32_C(0xe) +#define TX_CMPL_PTP_ERRORS_BUFFER_ERROR_SFT 1 +/* No error */ +#define TX_CMPL_PTP_ERRORS_BUFFER_ERROR_NO_ERROR \ + (UINT32_C(0x0) << 1) +/* +* Bad Format: +* BDs were not formatted correctly. +*/ +#define TX_CMPL_PTP_ERRORS_BUFFER_ERROR_BAD_FMT \ + (UINT32_C(0x2) << 1) +#define TX_CMPL_PTP_ERRORS_BUFFER_ERROR_LAST \ + TX_CMPL_PTP_ERRORS_BUFFER_ERROR_BAD_FMT +/* +* When this bit is '1', it indicates that the length of +* the packet was zero. No packet was transmitted. +*/ +#define TX_CMPL_PTP_ERRORS_ZERO_LENGTH_PKT UINT32_C(0x10) +/* +* When this bit is '1', it indicates that the packet +* was longer than the programmed limit in TDI. No +* packet was transmitted. +*/ +#define TX_CMPL_PTP_ERRORS_EXCESSIVE_BD_LENGTH UINT32_C(0x20) +/* +* When this bit is '1', it indicates that one or more of the +* BDs associated with this packet generated a PCI error. +* This probably means the address was not valid. +*/ +#define TX_CMPL_PTP_ERRORS_DMA_ERROR UINT32_C(0x40) +/* +* When this bit is '1', it indicates that the packet was longer +* than indicated by the hint. No packet was transmitted. +*/ +#define TX_CMPL_PTP_ERRORS_HINT_TOO_SHORT UINT32_C(0x80) +/* +* When this bit is '1', it indicates that the packet was +* dropped due to Poison TLP error on one or more of the +* TLPs in the PXP completion. +*/ +#define TX_CMPL_PTP_ERRORS_POISON_TLP_ERROR UINT32_C(0x100) +/* +* When this bit is '1', it indicates that the packet was dropped due +* to a transient internal error in TDC. The packet or LSO can be +* retried and may transmit successfully on a subsequent attempt. +*/ +#define TX_CMPL_PTP_ERRORS_INTERNAL_ERROR UINT32_C(0x200) +/* +* When this bit is '1', it was not possible to collect a a timestamp +* for a PTP completion, in which case the timestamp_hi and +* timestamp_lo fields are invalid. When this bit is '0' for a PTP +* completion, the timestamp_hi and timestamp_lo fields are valid. +* RJRN will copy the value of this bit into the field of the same +* name in all TX completions, regardless of whether such +* completions are PTP completions or other TX completions. +*/ +#define TX_CMPL_PTP_ERRORS_TIMESTAMP_INVALID_ERROR UINT32_C(0x400) +/* unused2 is 16 b */ +uint16_t unused_1; +/* +* This is timestamp value (lower 32bits) read from PM for the PTP +* timestamp enabled packet. +*/ +uint32_t timestamp_lo; +} __rte_packed; + +/* tx_cmpl_ptp_hi (size:128b/16B) */ +struct tx_cmpl_ptp_hi { +/* +* This is timestamp value (lower 32bits) read from PM for the PTP +* timestamp enabled packet. +*/ +uint16_t timestamp_hi[3 ]; +uint16_t reserved16; +uint64_t v2; +/* +* 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 TX_CMPL_PTP_HI_V2 UINT32_C(0x1) +} __rte_packed; +/* rx_pkt_cmpl (size:128b/16B) */ struct rx_pkt_cmpl {uint16_t flags_type;
@@ -3003,12 +3365,8 @@ struct rx_pkt_cmpl_hi {#define RX_PKT_CMPL_REORDER_SFT 0 } __rte_packed; -/* -* This TPA completion structure is used on devices where the -* `hwrm_vnic_qcaps.max_aggs_supported` value is 0. -*/ -/* rx_tpa_start_cmpl (size:128b/16B) */ -struct rx_tpa_start_cmpl { +/* rx_pkt_v2_cmpl (size:128b/16B) */ +struct rx_pkt_v2_cmpl {uint16_t flags_type;/* * This field indicates the exact type of the completion.
@@ -3017,84 +3375,143 @@ struct rx_tpa_start_cmpl {* records. Odd values indicate 32B * records. */ -#define RX_TPA_START_CMPL_TYPE_MASK UINT32_C(0x3f) -#define RX_TPA_START_CMPL_TYPE_SFT 0 +#define RX_PKT_V2_CMPL_TYPE_MASK UINT32_C(0x3f) +#define RX_PKT_V2_CMPL_TYPE_SFT 0/* -* RX L2 TPA Start Completion: -* Completion at the beginning of a TPA operation. -* Length = 32B +* RX L2 V2 completion: +* Completion of and L2 RX packet. Length = 32B +* This is the new version of the RX_L2 completion used in SR2 +* and later chips. */ -#define RX_TPA_START_CMPL_TYPE_RX_TPA_START UINT32_C(0x13) -#define RX_TPA_START_CMPL_TYPE_LAST \ - RX_TPA_START_CMPL_TYPE_RX_TPA_START -#define RX_TPA_START_CMPL_FLAGS_MASK UINT32_C(0xffc0) -#define RX_TPA_START_CMPL_FLAGS_SFT 6 -/* This bit will always be '0' for TPA start completions. */ -#define RX_TPA_START_CMPL_FLAGS_ERROR UINT32_C(0x40) +#define RX_PKT_V2_CMPL_TYPE_RX_L2_V2 UINT32_C(0xf) +#define RX_PKT_V2_CMPL_TYPE_LAST \ + RX_PKT_V2_CMPL_TYPE_RX_L2_V2 +#define RX_PKT_V2_CMPL_FLAGS_MASK UINT32_C(0xffc0) +#define RX_PKT_V2_CMPL_FLAGS_SFT 6 +/* +* When this bit is '1', it indicates a packet that has an +* error of some type. Type of error is indicated in +* error_flags. +*/ +#define RX_PKT_V2_CMPL_FLAGS_ERROR UINT32_C(0x40)/* This field indicates how the packet was placed in the buffer. */ -#define RX_TPA_START_CMPL_FLAGS_PLACEMENT_MASK UINT32_C(0x380) -#define RX_TPA_START_CMPL_FLAGS_PLACEMENT_SFT 7 +#define RX_PKT_V2_CMPL_FLAGS_PLACEMENT_MASK UINT32_C(0x380) +#define RX_PKT_V2_CMPL_FLAGS_PLACEMENT_SFT 7 +/* +* Normal: +* Packet was placed using normal algorithm. +*/ +#define RX_PKT_V2_CMPL_FLAGS_PLACEMENT_NORMAL \ + (UINT32_C(0x0) << 7)/* * Jumbo: -* TPA Packet was placed using jumbo algorithm. This means -* that the first buffer will be filled with data before -* moving to aggregation buffers. Each aggregation buffer -* will be filled before moving to the next aggregation -* buffer. +* Packet was placed using jumbo algorithm. */ -#define RX_TPA_START_CMPL_FLAGS_PLACEMENT_JUMBO \ +#define RX_PKT_V2_CMPL_FLAGS_PLACEMENT_JUMBO \ (UINT32_C(0x1) << 7)/* * Header/Data Separation: * Packet was placed using Header/Data separation algorithm. * The separation location is indicated by the itype field. */ -#define RX_TPA_START_CMPL_FLAGS_PLACEMENT_HDS \ +#define RX_PKT_V2_CMPL_FLAGS_PLACEMENT_HDS \ (UINT32_C(0x2) << 7)/* -* GRO/Jumbo: -* Packet will be placed using GRO/Jumbo where the first -* packet is filled with data. Subsequent packets will be -* placed such that any one packet does not span two -* aggregation buffers unless it starts at the beginning of -* an aggregation buffer. +* Truncation: +* Packet was placed using truncation algorithm. The +* placed (truncated) length is indicated in the payload_offset +* field. The original length is indicated in the len field. */ -#define RX_TPA_START_CMPL_FLAGS_PLACEMENT_GRO_JUMBO \ - (UINT32_C(0x5) << 7) +#define RX_PKT_V2_CMPL_FLAGS_PLACEMENT_TRUNCATION \ + (UINT32_C(0x3) << 7) +#define RX_PKT_V2_CMPL_FLAGS_PLACEMENT_LAST \ + RX_PKT_V2_CMPL_FLAGS_PLACEMENT_TRUNCATION +/* This bit is '1' if the RSS field in this completion is valid. */ +#define RX_PKT_V2_CMPL_FLAGS_RSS_VALID UINT32_C(0x400)/* -* GRO/Header-Data Separation: -* Packet will be placed using GRO/HDS where the header -* is in the first packet. -* Payload of each packet will be -* placed such that any one packet does not span two -* aggregation buffers unless it starts at the beginning of -* an aggregation buffer. +* This bit is '1' if metadata has been added to the end of the +* packet in host memory. Metadata starts at the first 32B boundary +* after the end of the packet for regular and jumbo placement. +* It starts at the first 32B boundary after the end of the header +* for HDS placement. The length of the metadata is indicated in the +* metadata itself. */ -#define RX_TPA_START_CMPL_FLAGS_PLACEMENT_GRO_HDS \ - (UINT32_C(0x6) << 7) -#define RX_TPA_START_CMPL_FLAGS_PLACEMENT_LAST \ - RX_TPA_START_CMPL_FLAGS_PLACEMENT_GRO_HDS -/* This bit is '1' if the RSS field in this completion is valid. */ -#define RX_TPA_START_CMPL_FLAGS_RSS_VALID UINT32_C(0x400) -/* unused is 1 b */ -#define RX_TPA_START_CMPL_FLAGS_UNUSED UINT32_C(0x800) +#define RX_PKT_V2_CMPL_FLAGS_PKT_METADATA_PRESENT UINT32_C(0x800)/* * This value indicates what the inner packet determined for the * packet was. */ -#define RX_TPA_START_CMPL_FLAGS_ITYPE_MASK UINT32_C(0xf000) -#define RX_TPA_START_CMPL_FLAGS_ITYPE_SFT 12 +#define RX_PKT_V2_CMPL_FLAGS_ITYPE_MASK UINT32_C(0xf000) +#define RX_PKT_V2_CMPL_FLAGS_ITYPE_SFT 12 +/* +* Not Known: +* Indicates that the packet type was not known. +*/ +#define RX_PKT_V2_CMPL_FLAGS_ITYPE_NOT_KNOWN \ + (UINT32_C(0x0) << 12) +/* +* IP Packet: +* Indicates that the packet was an IP packet, but further +* classification was not possible. +*/ +#define RX_PKT_V2_CMPL_FLAGS_ITYPE_IP \ + (UINT32_C(0x1) << 12)/* * TCP Packet: * Indicates that the packet was IP and TCP. +* This indicates that the payload_offset field is valid. */ -#define RX_TPA_START_CMPL_FLAGS_ITYPE_TCP \ +#define RX_PKT_V2_CMPL_FLAGS_ITYPE_TCP \ (UINT32_C(0x2) << 12) -#define RX_TPA_START_CMPL_FLAGS_ITYPE_LAST \ - RX_TPA_START_CMPL_FLAGS_ITYPE_TCP/* -* This value indicates the amount of packet data written to the -* buffer the opaque field in this completion corresponds to. +* UDP Packet: +* Indicates that the packet was IP and UDP. +* This indicates that the payload_offset field is valid. +*/ +#define RX_PKT_V2_CMPL_FLAGS_ITYPE_UDP \ + (UINT32_C(0x3) << 12) +/* +* FCoE Packet: +* Indicates that the packet was recognized as a FCoE. +* This also indicates that the payload_offset field is valid. +*/ +#define RX_PKT_V2_CMPL_FLAGS_ITYPE_FCOE \ + (UINT32_C(0x4) << 12) +/* +* RoCE Packet: +* Indicates that the packet was recognized as a RoCE. +* This also indicates that the payload_offset field is valid. +*/ +#define RX_PKT_V2_CMPL_FLAGS_ITYPE_ROCE \ + (UINT32_C(0x5) << 12) +/* +* ICMP Packet: +* Indicates that the packet was recognized as ICMP. +* This indicates that the payload_offset field is valid. +*/ +#define RX_PKT_V2_CMPL_FLAGS_ITYPE_ICMP \ + (UINT32_C(0x7) << 12) +/* +* PtP packet wo/timestamp: +* Indicates that the packet was recognized as a PtP +* packet. +*/ +#define RX_PKT_V2_CMPL_FLAGS_ITYPE_PTP_WO_TIMESTAMP \ + (UINT32_C(0x8) << 12) +/* +* PtP packet w/timestamp: +* Indicates that the packet was recognized as a PtP +* packet and that a timestamp was taken for the packet. +*/ +#define RX_PKT_V2_CMPL_FLAGS_ITYPE_PTP_W_TIMESTAMP \ + (UINT32_C(0x9) << 12) +#define RX_PKT_V2_CMPL_FLAGS_ITYPE_LAST \ + RX_PKT_V2_CMPL_FLAGS_ITYPE_PTP_W_TIMESTAMP +/* +* This is the length of the data for the packet stored in the +* buffer(s) identified by the opaque value. This includes +* the packet BD and any associated buffer BDs. This does not include +* the length of any data places in aggregation BDs. */ uint16_t len;/*
@@ -3102,19 +3519,597 @@ struct rx_tpa_start_cmpl {* corresponds to. */ uint32_t opaque; +uint8_t agg_bufs_v1;/* * 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. */ -uint8_t v1; +#define RX_PKT_V2_CMPL_V1 UINT32_C(0x1)/* -* 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. +* This value is the number of aggregation buffers that follow this +* entry in the completion ring that are a part of this packet. +* If the value is zero, then the packet is completely contained +* in the buffer space provided for the packet in the RX ring. */ -#define RX_TPA_START_CMPL_V1 UINT32_C(0x1) -#define RX_TPA_START_CMPL_LAST RX_TPA_START_CMPL_V1 +#define RX_PKT_V2_CMPL_AGG_BUFS_MASK UINT32_C(0x3e) +#define RX_PKT_V2_CMPL_AGG_BUFS_SFT 1 +/* unused1 is 2 b */ +#define RX_PKT_V2_CMPL_UNUSED1_MASK UINT32_C(0xc0) +#define RX_PKT_V2_CMPL_UNUSED1_SFT 6 +/* +* This is the RSS hash type for the packet. The value is packed +* {tuple_extrac_op[1:0],rss_profile_id[4:0],tuple_extrac_op[2]}. +* +* The value of tuple_extrac_op provides the information about +* what fields the hash was computed on. +* * 0: The RSS hash was computed over source IP address, +* destination IP address, source port, and destination port of inner +* IP and TCP or UDP headers. Note: For non-tunneled packets, +* the packet headers are considered inner packet headers for the RSS +* hash computation purpose. +* * 1: The RSS hash was computed over source IP address and destination +* IP address of inner IP header. Note: For non-tunneled packets, +* the packet headers are considered inner packet headers for the RSS +* hash computation purpose. +* * 2: The RSS hash was computed over source IP address, +* destination IP address, source port, and destination port of +* IP and TCP or UDP headers of outer tunnel headers. +* Note: For non-tunneled packets, this value is not applicable. +* * 3: The RSS hash was computed over source IP address and +* destination IP address of IP header of outer tunnel headers. +* Note: For non-tunneled packets, this value is not applicable. +* +* Note that 4-tuples values listed above are applicable +* for layer 4 protocols supported and enabled for RSS in the hardware, +* HWRM firmware, and drivers. For example, if RSS hash is supported and +* enabled for TCP traffic only, then the values of tuple_extract_op +* corresponding to 4-tuples are only valid for TCP traffic. +*/ +uint8_t rss_hash_type; +uint16_t metadata1_payload_offset; +/* +* This is data from the CFA as indicated by the meta_format field. +* If truncation placement is not used, this value indicates the offset +* in bytes from the beginning of the packet where the inner payload +* starts. This value is valid for TCP, UDP, FCoE, and RoCE packets. If +* truncation placement is used, this value represents the placed +* (truncated) length of the packet. +*/ +#define RX_PKT_V2_CMPL_PAYLOAD_OFFSET_MASK UINT32_C(0x1ff) +#define RX_PKT_V2_CMPL_PAYLOAD_OFFSET_SFT 0 +/* This is data from the CFA as indicated by the meta_format field. */ +#define RX_PKT_V2_CMPL_METADATA1_MASK UINT32_C(0xf000) +#define RX_PKT_V2_CMPL_METADATA1_SFT 12 +/* When meta_format != 0, this value is the VLAN TPID_SEL. */ +#define RX_PKT_V2_CMPL_METADATA1_TPID_SEL_MASK UINT32_C(0x7000) +#define RX_PKT_V2_CMPL_METADATA1_TPID_SEL_SFT 12 +/* When meta_format != 0, this value is the VLAN TPID_SEL. */ +#define RX_PKT_V2_CMPL_METADATA1_VALID UINT32_C(0x8000) +/* +* This value is the RSS hash value calculated for the packet +* based on the mode bits and key value in the VNIC. When vee_cmpl_mode +* is set in VNIC context, this is the lower 32b of the host address +* from the first BD used to place the packet. +*/ +uint32_t rss_hash; +} __rte_packed; + +/* Last 16 bytes of RX Packet V2 Completion Record */ +/* rx_pkt_v2_cmpl_hi (size:128b/16B) */ +struct rx_pkt_v2_cmpl_hi { +uint32_t flags2; +/* +* When this bit is '0', the cs_ok field has the following definition:- +* ip_cs_ok[2:0] = The number of header groups with a valid IP checksum +* in the delivered packet, counted from the outer-most header group to +* the inner-most header group, stopping at the first error. - +* l4_cs_ok[5:3] = The number of header groups with a valid L4 checksum +* in the delivered packet, counted from the outer-most header group to +* the inner-most header group, stopping at the first error. When this +* bit is '1', the cs_ok field has the following definition: - +* hdr_cnt[2:0] = The number of header groups that were parsed by the +* chip and passed in the delivered packet. - ip_cs_all_ok[3] =This bit +* will be '1' if all the parsed header groups with an IP checksum are +* valid. - l4_cs_all_ok[4] = This bit will be '1' if all the parsed +* header groups with an L4 checksum are valid. +*/ +#define RX_PKT_V2_CMPL_HI_FLAGS2_CS_ALL_OK_MODE \ + UINT32_C(0x8) +/* This value indicates what format the metadata field is. */ +#define RX_PKT_V2_CMPL_HI_FLAGS2_META_FORMAT_MASK \ + UINT32_C(0xf0) +#define RX_PKT_V2_CMPL_HI_FLAGS2_META_FORMAT_SFT 4 +/* There is no metadata information. Values are zero. */ +#define RX_PKT_V2_CMPL_HI_FLAGS2_META_FORMAT_NONE \ + (UINT32_C(0x0) << 4) +/* +* The {metadata1, metadata0} fields contain the vtag +* information: - vtag[19:0] = {valid, tpid_sel[2:0], pri[2:0], +* de, vid[11:0]} The metadata2 field contains the table scope +* and action record pointer. - metadata2[25:0] contains the +* action record pointer. - metadata2[31:26] contains the table +* scope. +*/ +#define RX_PKT_V2_CMPL_HI_FLAGS2_META_FORMAT_ACT_REC_PTR \ + (UINT32_C(0x1) << 4) +/* +* The {metadata1, metadata0} fields contain the vtag +* information: +* - vtag[19:0] = {valid, tpid_sel[2:0], pri[2:0], de, vid[11:0]} +* The metadata2 field contains the Tunnel ID +* value, justified to LSB. i +* - VXLAN = VNI[23:0] -> VXLAN Network ID +* - Geneve (NGE) = VNI[23:0] a-> Virtual Network Identifier +* - NVGRE = TNI[23:0] -> Tenant Network ID +* - GRE = KEY[31:0] -> key field with bit mask. zero if K=0 +* - IPv4 = 0 (not populated) +* - IPv6 = Flow Label[19:0] +* - PPPoE = sessionID[15:0] +* - MPLs = Outer label[19:0] +* - UPAR = Selected[31:0] with bit mask +*/ +#define RX_PKT_V2_CMPL_HI_FLAGS2_META_FORMAT_TUNNEL_ID \ + (UINT32_C(0x2) << 4) +/* +* The {metadata1, metadata0} fields contain the vtag +* information: +* - vtag[19:0] = {valid, tpid_sel[2:0], pri[2:0],de, vid[11:0]} +* The metadata2 field contains the 32b metadata from the prepended +* header (chdr_data). +*/ +#define RX_PKT_V2_CMPL_HI_FLAGS2_META_FORMAT_CHDR_DATA \ + (UINT32_C(0x3) << 4) +/* +* The {metadata1, metadata0} fields contain the vtag +* information: +* - vtag[19:0] = {valid, tpid_sel[2:0], pri[2:0], de, vid[11:0]} +* The metadata2 field contains the outer_l3_offset, +* inner_l2_offset, inner_l3_offset, and inner_l4_size. +* - metadata2[8:0] contains the outer_l3_offset. +* - metadata2[17:9] contains the inner_l2_offset. +* - metadata2[26:18] contains the inner_l3_offset. +* - metadata2[31:27] contains the inner_l4_size. +*/ +#define RX_PKT_V2_CMPL_HI_FLAGS2_META_FORMAT_HDR_OFFSET \ + (UINT32_C(0x4) << 4) +#define RX_PKT_V2_CMPL_HI_FLAGS2_META_FORMAT_LAST \ + RX_PKT_V2_CMPL_HI_FLAGS2_META_FORMAT_HDR_OFFSET +/* +* This field indicates the IP type for the inner-most IP header. +* A value of '0' indicates IPv4. A value of '1' indicates IPv6. +* This value is only valid if itype indicates a packet +* with an IP header. +*/ +#define RX_PKT_V2_CMPL_HI_FLAGS2_IP_TYPE \ + UINT32_C(0x100) +/* +* This indicates that the complete 1's complement checksum was +* calculated for the packet. +*/ +#define RX_PKT_V2_CMPL_HI_FLAGS2_COMPLETE_CHECKSUM_CALC \ + UINT32_C(0x200) +/* +* This field indicates the status of IP and L4 CS calculations done +* by the chip. The format of this field is indicated by the +* cs_all_ok_mode bit. +*/ +#define RX_PKT_V2_CMPL_HI_FLAGS2_CS_OK_MASK \ + UINT32_C(0xfc00) +#define RX_PKT_V2_CMPL_HI_FLAGS2_CS_OK_SFT 10 +/* +* This value is the complete 1's complement checksum calculated from +* the start of the outer L3 header to the end of the packet (not +* including the ethernet crc). It is valid when the +* 'complete_checksum_calc' flag is set. +*/ +#define RX_PKT_V2_CMPL_HI_FLAGS2_COMPLETE_CHECKSUM_MASK \ + UINT32_C(0xffff0000) +#define RX_PKT_V2_CMPL_HI_FLAGS2_COMPLETE_CHECKSUM_SFT 16 +/* +* This is data from the CFA block as indicated by the meta_format +* field. +* - meta_format 0 - none - metadata2 = 0 - not valid/not stripped +* - meta_format 1 - act_rec_ptr - metadata2 = {table_scope[5:0], +* act_rec_ptr[25:0]} +* - meta_format 2 - tunnel_id - metadata2 = tunnel_id[31:0] +* - meta_format 3 - chdr_data - metadata2 = updated_chdr_data[31:0] +* - meta_format 4 - hdr_offsets - metadata2 = hdr_offsets[31:0] +* When vee_cmpl_mode is set in VNIC context, this is the upper 32b +* of the host address from the first BD used to place the packet. +*/ +uint32_t metadata2; +uint16_t errors_v2; +/* +* 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 RX_PKT_V2_CMPL_HI_V2 \ + UINT32_C(0x1) +#define RX_PKT_V2_CMPL_HI_ERRORS_MASK \ + UINT32_C(0xfffe) +#define RX_PKT_V2_CMPL_HI_ERRORS_SFT 1 +/* +* This error indicates that there was some sort of problem with +* the BDs for the packet that was found after part of the +* packet was already placed. The packet should be treated as +* invalid. +*/ +#define RX_PKT_V2_CMPL_HI_ERRORS_BUFFER_ERROR_MASK \ + UINT32_C(0xe) +#define RX_PKT_V2_CMPL_HI_ERRORS_BUFFER_ERROR_SFT 1 +/* No buffer error */ +#define RX_PKT_V2_CMPL_HI_ERRORS_BUFFER_ERROR_NO_BUFFER \ + (UINT32_C(0x0) << 1) +/* +* Did Not Fit: Packet did not fit into packet buffer provided. +* For regular placement, this means the packet did not fit in +* the buffer provided. For HDS and jumbo placement, this means +* that the packet could not be placed into 8 physical buffers +* (if fixed-size buffers are used), or that the packet could +* not be placed in the number of physical buffers configured +* for the VNIC (if variable-size buffers are used) +*/ +#define RX_PKT_V2_CMPL_HI_ERRORS_BUFFER_ERROR_DID_NOT_FIT \ + (UINT32_C(0x1) << 1) +/* +* Not On Chip: All BDs needed for the packet were not on-chip +* when the packet arrived. For regular placement, this error is +* not valid. For HDS and jumbo placement, this means that not +* enough agg BDs were posted to place the packet. +*/ +#define RX_PKT_V2_CMPL_HI_ERRORS_BUFFER_ERROR_NOT_ON_CHIP \ + (UINT32_C(0x2) << 1) +/* +* Bad Format: +* BDs were not formatted correctly. +*/ +#define RX_PKT_V2_CMPL_HI_ERRORS_BUFFER_ERROR_BAD_FORMAT \ + (UINT32_C(0x3) << 1) +/* +* Flush: +* There was a bad_format error on the previous operation +*/ +#define RX_PKT_V2_CMPL_HI_ERRORS_BUFFER_ERROR_FLUSH \ + (UINT32_C(0x5) << 1) +#define RX_PKT_V2_CMPL_HI_ERRORS_BUFFER_ERROR_LAST \ + RX_PKT_V2_CMPL_HI_ERRORS_BUFFER_ERROR_FLUSH +/* +* This indicates that there was an error in the outer tunnel +* portion of the packet when this field is non-zero. +*/ +#define RX_PKT_V2_CMPL_HI_ERRORS_OT_PKT_ERROR_MASK \ + UINT32_C(0x70) +#define RX_PKT_V2_CMPL_HI_ERRORS_OT_PKT_ERROR_SFT 4 +/* +* No additional error occurred on the outer tunnel portion +* of the packet or the packet does not have a outer tunnel. +*/ +#define RX_PKT_V2_CMPL_HI_ERRORS_OT_PKT_ERROR_NO_ERROR \ + (UINT32_C(0x0) << 4) +/* +* Indicates that IP header version does not match expectation +* from L2 Ethertype for IPv4 and IPv6 in the outer tunnel header. +*/ +#define RX_PKT_V2_CMPL_HI_ERRORS_OT_PKT_ERROR_OT_L3_BAD_VERSION \ + (UINT32_C(0x1) << 4) +/* +* Indicates that header length is out of range in the outer +* tunnel header. Valid for IPv4. +*/ +#define RX_PKT_V2_CMPL_HI_ERRORS_OT_PKT_ERROR_OT_L3_BAD_HDR_LEN \ + (UINT32_C(0x2) << 4) +/* +* Indicates that physical packet is shorter than that claimed +* by the outer tunnel l3 header length. Valid for IPv4, or +* IPv6 outer tunnel packets. +*/ +#define RX_PKT_V2_CMPL_HI_ERRORS_OT_PKT_ERROR_OT_IP_TOTAL_ERROR \ + (UINT32_C(0x3) << 4) +/* +* Indicates that the physical packet is shorter than that +* claimed by the outer tunnel UDP header length for a outer +* tunnel UDP packet that is not fragmented. +*/ +#define RX_PKT_V2_CMPL_HI_ERRORS_OT_PKT_ERROR_OT_UDP_TOTAL_ERROR \ + (UINT32_C(0x4) << 4) +/* +* Indicates that the IPv4 TTL or IPv6 hop limit check have +* failed (e.g. TTL = 0) in the outer tunnel header. Valid for +* IPv4, and IPv6. +*/ +#define RX_PKT_V2_CMPL_HI_ERRORS_OT_PKT_ERROR_OT_L3_BAD_TTL \ + (UINT32_C(0x5) << 4) +/* +* Indicates that the IP checksum failed its check in the outer +* tunnel header. +*/ +#define RX_PKT_V2_CMPL_HI_ERRORS_OT_PKT_ERROR_OT_IP_CS_ERROR \ + (UINT32_C(0x6) << 4) +/* +* Indicates that the L4 checksum failed its check in the outer +* tunnel header. +*/ +#define RX_PKT_V2_CMPL_HI_ERRORS_OT_PKT_ERROR_OT_L4_CS_ERROR \ + (UINT32_C(0x7) << 4) +#define RX_PKT_V2_CMPL_HI_ERRORS_OT_PKT_ERROR_LAST \ + RX_PKT_V2_CMPL_HI_ERRORS_OT_PKT_ERROR_OT_L4_CS_ERROR +/* +* This indicates that there was a CRC error on either an FCoE +* or RoCE packet. The itype indicates the packet type. +*/ +#define RX_PKT_V2_CMPL_HI_ERRORS_CRC_ERROR \ + UINT32_C(0x100) +/* +* This indicates that there was an error in the tunnel portion +* of the packet when this field is non-zero. +*/ +#define RX_PKT_V2_CMPL_HI_ERRORS_T_PKT_ERROR_MASK \ + UINT32_C(0xe00) +#define RX_PKT_V2_CMPL_HI_ERRORS_T_PKT_ERROR_SFT 9 +/* +* No additional error occurred on the tunnel portion +* of the packet or the packet does not have a tunnel. +*/ +#define RX_PKT_V2_CMPL_HI_ERRORS_T_PKT_ERROR_NO_ERROR \ + (UINT32_C(0x0) << 9) +/* +* Indicates that IP header version does not match expectation +* from L2 Ethertype for IPv4 and IPv6 in the tunnel header. +*/ +#define RX_PKT_V2_CMPL_HI_ERRORS_T_PKT_ERROR_T_L3_BAD_VERSION \ + (UINT32_C(0x1) << 9) +/* +* Indicates that header length is out of range in the tunnel +* header. Valid for IPv4. +*/ +#define RX_PKT_V2_CMPL_HI_ERRORS_T_PKT_ERROR_T_L3_BAD_HDR_LEN \ + (UINT32_C(0x2) << 9) +/* +* Indicates that physical packet is shorter than that claimed +* by the tunnel l3 header length. Valid for IPv4, or IPv6 tunnel +* packet packets. +*/ +#define RX_PKT_V2_CMPL_HI_ERRORS_T_PKT_ERROR_T_IP_TOTAL_ERROR \ + (UINT32_C(0x3) << 9) +/* +* Indicates that the physical packet is shorter than that claimed +* by the tunnel UDP header length for a tunnel UDP packet that is +* not fragmented. +*/ +#define RX_PKT_V2_CMPL_HI_ERRORS_T_PKT_ERROR_T_UDP_TOTAL_ERROR \ + (UINT32_C(0x4) << 9) +/* +* Indicates that the IPv4 TTL or IPv6 hop limit check have failed +* (e.g. TTL = 0) in the tunnel header. Valid for IPv4, and IPv6. +*/ +#define RX_PKT_V2_CMPL_HI_ERRORS_T_PKT_ERROR_T_L3_BAD_TTL \ + (UINT32_C(0x5) << 9) +/* +* Indicates that the IP checksum failed its check in the tunnel +* header. +*/ +#define RX_PKT_V2_CMPL_HI_ERRORS_T_PKT_ERROR_T_IP_CS_ERROR \ + (UINT32_C(0x6) << 9) +/* +* Indicates that the L4 checksum failed its check in the tunnel +* header. +*/ +#define RX_PKT_V2_CMPL_HI_ERRORS_T_PKT_ERROR_T_L4_CS_ERROR \ + (UINT32_C(0x7) << 9) +#define RX_PKT_V2_CMPL_HI_ERRORS_T_PKT_ERROR_LAST \ + RX_PKT_V2_CMPL_HI_ERRORS_T_PKT_ERROR_T_L4_CS_ERROR +/* +* This indicates that there was an error in the inner +* portion of the packet when this +* field is non-zero. +*/ +#define RX_PKT_V2_CMPL_HI_ERRORS_PKT_ERROR_MASK \ + UINT32_C(0xf000) +#define RX_PKT_V2_CMPL_HI_ERRORS_PKT_ERROR_SFT 12 +/* +* No additional error occurred on the tunnel portion +* or the packet of the packet does not have a tunnel. +*/ +#define RX_PKT_V2_CMPL_HI_ERRORS_PKT_ERROR_NO_ERROR \ + (UINT32_C(0x0) << 12) +/* +* Indicates that IP header version does not match +* expectation from L2 Ethertype for IPv4 and IPv6 or that +* option other than VFT was parsed on +* FCoE packet. +*/ +#define RX_PKT_V2_CMPL_HI_ERRORS_PKT_ERROR_L3_BAD_VERSION \ + (UINT32_C(0x1) << 12) +/* +* indicates that header length is out of range. Valid for +* IPv4 and RoCE +*/ +#define RX_PKT_V2_CMPL_HI_ERRORS_PKT_ERROR_L3_BAD_HDR_LEN \ + (UINT32_C(0x2) << 12) +/* +* indicates that the IPv4 TTL or IPv6 hop limit check +* have failed (e.g. TTL = 0). Valid for IPv4, and IPv6 +*/ +#define RX_PKT_V2_CMPL_HI_ERRORS_PKT_ERROR_L3_BAD_TTL \ + (UINT32_C(0x3) << 12) +/* +* Indicates that physical packet is shorter than that +* claimed by the l3 header length. Valid for IPv4, +* IPv6 packet or RoCE packets. +*/ +#define RX_PKT_V2_CMPL_HI_ERRORS_PKT_ERROR_IP_TOTAL_ERROR \ + (UINT32_C(0x4) << 12) +/* +* Indicates that the physical packet is shorter than that +* claimed by the UDP header length for a UDP packet that is +* not fragmented. +*/ +#define RX_PKT_V2_CMPL_HI_ERRORS_PKT_ERROR_UDP_TOTAL_ERROR \ + (UINT32_C(0x5) << 12) +/* +* Indicates that TCP header length > IP payload. Valid for +* TCP packets only. +*/ +#define RX_PKT_V2_CMPL_HI_ERRORS_PKT_ERROR_L4_BAD_HDR_LEN \ + (UINT32_C(0x6) << 12) +/* Indicates that TCP header length < 5. Valid for TCP. */ +#define RX_PKT_V2_CMPL_HI_ERRORS_PKT_ERROR_L4_BAD_HDR_LEN_TOO_SMALL \ + (UINT32_C(0x7) << 12) +/* +* Indicates that TCP option headers result in a TCP header +* size that does not match data offset in TCP header. Valid +* for TCP. +*/ +#define RX_PKT_V2_CMPL_HI_ERRORS_PKT_ERROR_L4_BAD_OPT_LEN \ + (UINT32_C(0x8) << 12) +/* +* Indicates that the IP checksum failed its check in the +* inner header. +*/ +#define RX_PKT_V2_CMPL_HI_ERRORS_PKT_ERROR_IP_CS_ERROR \ + (UINT32_C(0x9) << 12) +/* +* Indicates that the L4 checksum failed its check in the +* inner header. +*/ +#define RX_PKT_V2_CMPL_HI_ERRORS_PKT_ERROR_L4_CS_ERROR \ + (UINT32_C(0xa) << 12) +#define RX_PKT_V2_CMPL_HI_ERRORS_PKT_ERROR_LAST \ + RX_PKT_V2_CMPL_HI_ERRORS_PKT_ERROR_L4_CS_ERROR +/* +* This is data from the CFA block as indicated by the meta_format +* field. +*/ +uint16_t metadata0; +/* When meta_format=1, this value is the VLAN VID. */ +#define RX_PKT_V2_CMPL_HI_METADATA0_VID_MASK UINT32_C(0xfff) +#define RX_PKT_V2_CMPL_HI_METADATA0_VID_SFT 0 +/* When meta_format=1, this value is the VLAN DE. */ +#define RX_PKT_V2_CMPL_HI_METADATA0_DE UINT32_C(0x1000) +/* When meta_format=1, this value is the VLAN PRI. */ +#define RX_PKT_V2_CMPL_HI_METADATA0_PRI_MASK UINT32_C(0xe000) +#define RX_PKT_V2_CMPL_HI_METADATA0_PRI_SFT 13 +/* +* The timestamp field contains the 32b timestamp for the packet from +* the MAC. +*/ +uint32_t timestamp; +} __rte_packed; + +/* +* This TPA completion structure is used on devices where the +* `hwrm_vnic_qcaps.max_aggs_supported` value is 0. +*/ +/* rx_tpa_start_cmpl (size:128b/16B) */ +struct rx_tpa_start_cmpl { +uint16_t flags_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 RX_TPA_START_CMPL_TYPE_MASK UINT32_C(0x3f) +#define RX_TPA_START_CMPL_TYPE_SFT 0 +/* +* RX L2 TPA Start Completion: +* Completion at the beginning of a TPA operation. +* Length = 32B +*/ +#define RX_TPA_START_CMPL_TYPE_RX_TPA_START UINT32_C(0x13) +#define RX_TPA_START_CMPL_TYPE_LAST \ + RX_TPA_START_CMPL_TYPE_RX_TPA_START +#define RX_TPA_START_CMPL_FLAGS_MASK UINT32_C(0xffc0) +#define RX_TPA_START_CMPL_FLAGS_SFT 6 +/* This bit will always be '0' for TPA start completions. */ +#define RX_TPA_START_CMPL_FLAGS_ERROR UINT32_C(0x40) +/* This field indicates how the packet was placed in the buffer. */ +#define RX_TPA_START_CMPL_FLAGS_PLACEMENT_MASK UINT32_C(0x380) +#define RX_TPA_START_CMPL_FLAGS_PLACEMENT_SFT 7 +/* +* Jumbo: +* TPA Packet was placed using jumbo algorithm. This means +* that the first buffer will be filled with data before +* moving to aggregation buffers. Each aggregation buffer +* will be filled before moving to the next aggregation +* buffer. +*/ +#define RX_TPA_START_CMPL_FLAGS_PLACEMENT_JUMBO \ + (UINT32_C(0x1) << 7) +/* +* Header/Data Separation: +* Packet was placed using Header/Data separation algorithm. +* The separation location is indicated by the itype field. +*/ +#define RX_TPA_START_CMPL_FLAGS_PLACEMENT_HDS \ + (UINT32_C(0x2) << 7) +/* +* GRO/Jumbo: +* Packet will be placed using GRO/Jumbo where the first +* packet is filled with data. Subsequent packets will be +* placed such that any one packet does not span two +* aggregation buffers unless it starts at the beginning of +* an aggregation buffer. +*/ +#define RX_TPA_START_CMPL_FLAGS_PLACEMENT_GRO_JUMBO \ + (UINT32_C(0x5) << 7) +/* +* GRO/Header-Data Separation: +* Packet will be placed using GRO/HDS where the header +* is in the first packet. +* Payload of each packet will be +* placed such that any one packet does not span two +* aggregation buffers unless it starts at the beginning of +* an aggregation buffer. +*/ +#define RX_TPA_START_CMPL_FLAGS_PLACEMENT_GRO_HDS \ + (UINT32_C(0x6) << 7) +#define RX_TPA_START_CMPL_FLAGS_PLACEMENT_LAST \ + RX_TPA_START_CMPL_FLAGS_PLACEMENT_GRO_HDS +/* This bit is '1' if the RSS field in this completion is valid. */ +#define RX_TPA_START_CMPL_FLAGS_RSS_VALID UINT32_C(0x400) +/* unused is 1 b */ +#define RX_TPA_START_CMPL_FLAGS_UNUSED UINT32_C(0x800) +/* +* This value indicates what the inner packet determined for the +* packet was. +*/ +#define RX_TPA_START_CMPL_FLAGS_ITYPE_MASK UINT32_C(0xf000) +#define RX_TPA_START_CMPL_FLAGS_ITYPE_SFT 12 +/* +* TCP Packet: +* Indicates that the packet was IP and TCP. +*/ +#define RX_TPA_START_CMPL_FLAGS_ITYPE_TCP \ + (UINT32_C(0x2) << 12) +#define RX_TPA_START_CMPL_FLAGS_ITYPE_LAST \ + RX_TPA_START_CMPL_FLAGS_ITYPE_TCP +/* +* This value indicates the amount of packet data written to the +* buffer the opaque field in this completion corresponds to. +*/ +uint16_t len; +/* +* This is a copy of the opaque field from the RX BD this completion +* corresponds to. +*/ +uint32_t opaque; +/* +* 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. +*/ +uint8_t v1; +/* +* 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 RX_TPA_START_CMPL_V1 UINT32_C(0x1) +#define RX_TPA_START_CMPL_LAST RX_TPA_START_CMPL_V1/* * This is the RSS hash type for the packet. The value is packed * {tuple_extrac_op[1:0],rss_profile_id[4:0],tuple_extrac_op[2]}.
@@ -3285,6 +4280,430 @@ struct rx_tpa_start_cmpl_hi {#define RX_TPA_START_CMPL_INNER_L4_SIZE_SFT 27 } __rte_packed; +/* +* This TPA completion structure is used on devices where the +* `hwrm_vnic_qcaps.max_aggs_supported` value is 0. +* RX L2 TPA Start V2 Completion Record (32 bytes split to 2 16-byte +* struct) +*/ +/* rx_tpa_start_v2_cmpl (size:128b/16B) */ +struct rx_tpa_start_v2_cmpl { +uint16_t flags_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 RX_TPA_START_V2_CMPL_TYPE_MASK \ + UINT32_C(0x3f) +#define RX_TPA_START_V2_CMPL_TYPE_SFT 0 +/* +* RX L2 TPA Start V2 Completion: +* Completion at the beginning of a TPA operation. +* Length = 32B +* This is the new version of the RX_TPA_START completion used +* in SR2 and later chips. +*/ +#define RX_TPA_START_V2_CMPL_TYPE_RX_TPA_START_V2 \ + UINT32_C(0xd) +#define RX_TPA_START_V2_CMPL_TYPE_LAST \ + RX_TPA_START_V2_CMPL_TYPE_RX_TPA_START_V2 +#define RX_TPA_START_V2_CMPL_FLAGS_MASK \ + UINT32_C(0xffc0) +#define RX_TPA_START_V2_CMPL_FLAGS_SFT 6 +/* +* When this bit is '1', it indicates a packet that has an error +* of some type. Type of error is indicated in error_flags. +*/ +#define RX_TPA_START_V2_CMPL_FLAGS_ERROR \ + UINT32_C(0x40) +/* This field indicates how the packet was placed in the buffer. */ +#define RX_TPA_START_V2_CMPL_FLAGS_PLACEMENT_MASK \ + UINT32_C(0x380) +#define RX_TPA_START_V2_CMPL_FLAGS_PLACEMENT_SFT 7 +/* +* Jumbo: +* TPA Packet was placed using jumbo algorithm. This means +* that the first buffer will be filled with data before +* moving to aggregation buffers. Each aggregation buffer +* will be filled before moving to the next aggregation +* buffer. +*/ +#define RX_TPA_START_V2_CMPL_FLAGS_PLACEMENT_JUMBO \ + (UINT32_C(0x1) << 7) +/* +* Header/Data Separation: +* Packet was placed using Header/Data separation algorithm. +* The separation location is indicated by the itype field. +*/ +#define RX_TPA_START_V2_CMPL_FLAGS_PLACEMENT_HDS \ + (UINT32_C(0x2) << 7) +/* +* IOC/Jumbo: +* Packet will be placed using In-Order Completion/Jumbo where +* the first packet of the aggregation is placed using Jumbo +* Placement. Subsequent packets will be placed such that each +* packet starts at the beginning of an aggregation buffer. +*/ +#define RX_TPA_START_V2_CMPL_FLAGS_PLACEMENT_IOC_JUMBO \ + (UINT32_C(0x4) << 7) +/* +* GRO/Jumbo: +* Packet will be placed using GRO/Jumbo where the first +* packet is filled with data. Subsequent packets will be +* placed such that any one packet does not span two +* aggregation buffers unless it starts at the beginning of +* an aggregation buffer. +*/ +#define RX_TPA_START_V2_CMPL_FLAGS_PLACEMENT_GRO_JUMBO \ + (UINT32_C(0x5) << 7) +/* +* GRO/Header-Data Separation: +* Packet will be placed using GRO/HDS where the header +* is in the first packet. +* Payload of each packet will be +* placed such that any one packet does not span two +* aggregation buffers unless it starts at the beginning of +* an aggregation buffer. +*/ +#define RX_TPA_START_V2_CMPL_FLAGS_PLACEMENT_GRO_HDS \ + (UINT32_C(0x6) << 7) +/* +* IOC/Header-Data Separation: +* Packet will be placed using In-Order Completion/HDS where +* the header is in the first packet buffer. Payload of each +* packet will be placed such that each packet starts at the +* beginning of an aggregation buffer. +*/ +#define RX_TPA_START_V2_CMPL_FLAGS_PLACEMENT_IOC_HDS \ + (UINT32_C(0x7) << 7) +#define RX_TPA_START_V2_CMPL_FLAGS_PLACEMENT_LAST \ + RX_TPA_START_V2_CMPL_FLAGS_PLACEMENT_IOC_HDS +/* This bit is '1' if the RSS field in this completion is valid. */ +#define RX_TPA_START_V2_CMPL_FLAGS_RSS_VALID \ + UINT32_C(0x400) +/* +* This bit is '1' if metadata has been added to the end of the +* packet in host memory. Metadata starts at the first 32B boundary +* after the end of the packet for regular and jumbo placement. It +* starts at the first 32B boundary after the end of the header for +* HDS placement. The length of the metadata is indicated in the +* metadata itself. +*/ +#define RX_TPA_START_V2_CMPL_FLAGS_PKT_METADATA_PRESENT \ + UINT32_C(0x800) +/* +* This value indicates what the inner packet determined for the +* packet was. +*/ +#define RX_TPA_START_V2_CMPL_FLAGS_ITYPE_MASK \ + UINT32_C(0xf000) +#define RX_TPA_START_V2_CMPL_FLAGS_ITYPE_SFT 12 +/* +* TCP Packet: +* Indicates that the packet was IP and TCP. +*/ +#define RX_TPA_START_V2_CMPL_FLAGS_ITYPE_TCP \ + (UINT32_C(0x2) << 12) +#define RX_TPA_START_V2_CMPL_FLAGS_ITYPE_LAST \ + RX_TPA_START_V2_CMPL_FLAGS_ITYPE_TCP +/* +* This value indicates the amount of packet data written to the +* buffer the opaque field in this completion corresponds to. +*/ +uint16_t len; +/* +* This is a copy of the opaque field from the RX BD this completion +* corresponds to. If the VNIC is configured to not use an Rx BD for +* the TPA Start completion, then this is a copy of the opaque field +* from the first BD used to place the TPA Start packet. +*/ +uint32_t opaque; +/* +* 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. +*/ +uint8_t v1; +/* +* 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 RX_TPA_START_V2_CMPL_V1 UINT32_C(0x1) +#define RX_TPA_START_V2_CMPL_LAST RX_TPA_START_V2_CMPL_V1 +/* +* This is the RSS hash type for the packet. The value is packed +* {tuple_extrac_op[1:0],rss_profile_id[4:0],tuple_extrac_op[2]}. +* +* The value of tuple_extrac_op provides the information about +* what fields the hash was computed on. +* * 0: The RSS hash was computed over source IP address, +* destination IP address, source port, and destination port of inner +* IP and TCP or UDP headers. Note: For non-tunneled packets, +* the packet headers are considered inner packet headers for the RSS +* hash computation purpose. +* * 1: The RSS hash was computed over source IP address and destination +* IP address of inner IP header. Note: For non-tunneled packets, +* the packet headers are considered inner packet headers for the RSS +* hash computation purpose. +* * 2: The RSS hash was computed over source IP address, +* destination IP address, source port, and destination port of +* IP and TCP or UDP headers of outer tunnel headers. +* Note: For non-tunneled packets, this value is not applicable. +* * 3: The RSS hash was computed over source IP address and +* destination IP address of IP header of outer tunnel headers. +* Note: For non-tunneled packets, this value is not applicable. +* +* Note that 4-tuples values listed above are applicable +* for layer 4 protocols supported and enabled for RSS in the hardware, +* HWRM firmware, and drivers. For example, if RSS hash is supported and +* enabled for TCP traffic only, then the values of tuple_extract_op +* corresponding to 4-tuples are only valid for TCP traffic. +*/ +uint8_t rss_hash_type; +/* +* This is the aggregation ID that the completion is associated +* with. Use this number to correlate the TPA start completion +* with the TPA end completion. +*/ +uint16_t agg_id; +/* +* This is the aggregation ID that the completion is associated +* with. Use this number to correlate the TPA start completion +* with the TPA end completion. +*/ +#define RX_TPA_START_V2_CMPL_AGG_ID_MASK UINT32_C(0xfff) +#define RX_TPA_START_V2_CMPL_AGG_ID_SFT 0 +#define RX_TPA_START_V2_CMPL_METADATA1_MASK UINT32_C(0xf000) +#define RX_TPA_START_V2_CMPL_METADATA1_SFT 12 +/* When meta_format != 0, this value is the VLAN TPID_SEL. */ +#define RX_TPA_START_V2_CMPL_METADATA1_TPID_SEL_MASK UINT32_C(0x7000) +#define RX_TPA_START_V2_CMPL_METADATA1_TPID_SEL_SFT 12 +/* When meta_format != 0, this value is the VLAN valid. */ +#define RX_TPA_START_V2_CMPL_METADATA1_VALID UINT32_C(0x8000) +/* +* This value is the RSS hash value calculated for the packet +* based on the mode bits and key value in the VNIC. +* When vee_cmpl_mode is set in VNIC context, this is the lower +* 32b of the host address from the first BD used to place the packet. +*/ +uint32_t rss_hash; +} __rte_packed; + +/* +* Last 16 bytes of RX L2 TPA Start V2 Completion Record +* +* This TPA completion structure is used on devices where the +* `hwrm_vnic_qcaps.max_aggs_supported` value is 0. +*/ +/* rx_tpa_start_v2_cmpl_hi (size:128b/16B) */ +struct rx_tpa_start_v2_cmpl_hi { +uint32_t flags2; +/* This indicates that the aggregation was done using GRO rules. */ +#define RX_TPA_START_V2_CMPL_FLAGS2_AGG_GRO \ + UINT32_C(0x4) +/* +* When this bit is '0', the cs_ok field has the following definition:- +* ip_cs_ok[2:0] = The number of header groups with a valid IP checksum +* in the delivered packet, counted from the outer-most header group to +* the inner-most header group, stopping at the first error. - +* l4_cs_ok[5:3] = The number of header groups with a valid L4 checksum +* in the delivered packet, counted from the outer-most header group to +* the inner-most header group, stopping at the first error. When this +* bit is '1', the cs_ok field has the following definition: - +* hdr_cnt[2:0] = The number of header groups that were parsed by the +* chip and passed in the delivered packet. - ip_cs_all_ok[3] =This bit +* will be '1' if all the parsed header groups with an IP checksum are +* valid. - l4_cs_all_ok[4] = This bit will be '1' if all the parsed +* header groups with an L4 checksum are valid. +*/ +#define RX_TPA_START_V2_CMPL_FLAGS2_CS_ALL_OK_MODE \ + UINT32_C(0x8) +/* This value indicates what format the metadata field is. */ +#define RX_TPA_START_V2_CMPL_FLAGS2_META_FORMAT_MASK \ + UINT32_C(0xf0) +#define RX_TPA_START_V2_CMPL_FLAGS2_META_FORMAT_SFT 4 +/* There is no metadata information. Values are zero. */ +#define RX_TPA_START_V2_CMPL_FLAGS2_META_FORMAT_NONE \ + (UINT32_C(0x0) << 4) +/* +* The {metadata1, metadata0} fields contain the vtag +* information: - vtag[19:0] = {valid, tpid_sel[2:0], pri[2:0], +* de, vid[11:0]} The metadata2 field contains the table scope +* and action record pointer. - metadata2[25:0] contains the +* action record pointer. - metadata2[31:26] contains the table +* scope. +*/ +#define RX_TPA_START_V2_CMPL_FLAGS2_META_FORMAT_ACT_REC_PTR \ + (UINT32_C(0x1) << 4) +/* +* The {metadata1, metadata0} fields contain the vtag +* information: +* - vtag[19:0] = {valid, tpid_sel[2:0], pri[2:0], de, vid[11:0]} +* The metadata2 field contains the Tunnel ID +* value, justified to LSB. i +* - VXLAN = VNI[23:0] -> VXLAN Network ID +* - Geneve (NGE) = VNI[23:0] a-> Virtual Network Identifier +* - NVGRE = TNI[23:0] -> Tenant Network ID +* - GRE = KEY[31:0] -> key field with bit mask. zero if K=0 +* - IPv4 = 0 (not populated) +* - IPv6 = Flow Label[19:0] +* - PPPoE = sessionID[15:0] +* - MPLs = Outer label[19:0] +* - UPAR = Selected[31:0] with bit mask +*/ +#define RX_TPA_START_V2_CMPL_FLAGS2_META_FORMAT_TUNNEL_ID \ + (UINT32_C(0x2) << 4) +/* +* The {metadata1, metadata0} fields contain the vtag +* information: +* - vtag[19:0] = {valid, tpid_sel[2:0], pri[2:0],de, vid[11:0]} +* The metadata2 field contains the 32b metadata from the prepended +* header (chdr_data). +*/ +#define RX_TPA_START_V2_CMPL_FLAGS2_META_FORMAT_CHDR_DATA \ + (UINT32_C(0x3) << 4) +/* +* The {metadata1, metadata0} fields contain the vtag +* information: +* - vtag[19:0] = {valid, tpid_sel[2:0], pri[2:0], de, vid[11:0]} +* The metadata2 field contains the outer_l3_offset, +* inner_l2_offset, inner_l3_offset, and inner_l4_size. +* - metadata2[8:0] contains the outer_l3_offset. +* - metadata2[17:9] contains the inner_l2_offset. +* - metadata2[26:18] contains the inner_l3_offset. +* - metadata2[31:27] contains the inner_l4_size. +*/ +#define RX_TPA_START_V2_CMPL_FLAGS2_META_FORMAT_HDR_OFFSET \ + (UINT32_C(0x4) << 4) +#define RX_TPA_START_V2_CMPL_FLAGS2_META_FORMAT_LAST \ + RX_TPA_START_V2_CMPL_FLAGS2_META_FORMAT_HDR_OFFSET +/* +* This field indicates the IP type for the inner-most IP header. +* A value of '0' indicates IPv4. A value of '1' indicates IPv6. +* This value is only valid if itype indicates a packet +* with an IP header. +*/ +#define RX_TPA_START_V2_CMPL_FLAGS2_IP_TYPE \ + UINT32_C(0x100) +/* +* This indicates that the complete 1's complement checksum was +* calculated for the packet in the affregation. +*/ +#define RX_TPA_START_V2_CMPL_FLAGS2_COMPLETE_CHECKSUM_CALC \ + UINT32_C(0x200) +/* +* This field indicates the status of IP and L4 CS calculations done +* by the chip. The format of this field is indicated by the +* cs_all_ok_mode bit. +* CS status for TPA packets is always valid. This means that "all_ok" +* status will always be set. The ok count status will be set +* appropriately for the packet header, such that all existing CS +* values are ok. +*/ +#define RX_TPA_START_V2_CMPL_FLAGS2_CS_OK_MASK \ + UINT32_C(0xfc00) +#define RX_TPA_START_V2_CMPL_FLAGS2_CS_OK_SFT 10 +/* +* This value is the complete 1's complement checksum calculated from +* the start of the outer L3 header to the end of the packet (not +* including the ethernet crc). It is valid when the +* 'complete_checksum_calc' flag is set. For TPA Start completions, +* the complete checksum is calculated for the first packet in the +* aggregation only. +*/ +#define RX_TPA_START_V2_CMPL_FLAGS2_COMPLETE_CHECKSUM_MASK \ + UINT32_C(0xffff0000) +#define RX_TPA_START_V2_CMPL_FLAGS2_COMPLETE_CHECKSUM_SFT 16 +/* +* This is data from the CFA block as indicated by the meta_format +* field. +* - meta_format 0 - none - metadata2 = 0 - not valid/not stripped +* - meta_format 1 - act_rec_ptr - metadata2 = {table_scope[5:0], +* act_rec_ptr[25:0]} +* - meta_format 2 - tunnel_id - metadata2 = tunnel_id[31:0] +* - meta_format 3 - chdr_data - metadata2 = updated_chdr_data[31:0] +* - meta_format 4 - hdr_offsets - metadata2 = hdr_offsets[31:0] +* When vee_cmpl_mode is set in VNIC context, this is the upper 32b +* of the host address from the first BD used to place the packet. +*/ +uint32_t metadata2; +uint16_t errors_v2; +/* +* 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 RX_TPA_START_V2_CMPL_V2 \ + UINT32_C(0x1) +#define RX_TPA_START_V2_CMPL_ERRORS_MASK \ + UINT32_C(0xfffe) +#define RX_TPA_START_V2_CMPL_ERRORS_SFT 1 +/* +* This error indicates that there was some sort of problem with +* the BDs for the packetThe packet should be treated as +* invalid. +*/ +#define RX_TPA_START_V2_CMPL_ERRORS_BUFFER_ERROR_MASK \ + UINT32_C(0xe) +#define RX_TPA_START_V2_CMPL_ERRORS_BUFFER_ERROR_SFT 1 +/* No buffer error */ +#define RX_TPA_START_V2_CMPL_ERRORS_BUFFER_ERROR_NO_BUFFER \ + (UINT32_C(0x0) << 1) +/* +* Did Not Fit: +* Packet did not fit into packet buffer provided. This means +* that the TPA Start packet was too big to be placed into the +* per-packet maximum number of physical buffers configured for +* the VNIC, or that it was too big to be placed into the +* per-aggregation maximum number of physical buffers configured +* for the VNIC. This error only occurs when the VNIC is +* configured for variable size receive buffers. +*/ +#define RX_TPA_START_V2_CMPL_ERRORS_BUFFER_ERROR_DID_NOT_FIT \ + (UINT32_C(0x1) << 1) +/* +* Bad Format: +* BDs were not formatted correctly. +*/ +#define RX_TPA_START_V2_CMPL_ERRORS_BUFFER_ERROR_BAD_FORMAT \ + (UINT32_C(0x3) << 1) +/* +* Flush: +* There was a bad_format error on the previous operation +*/ +#define RX_TPA_START_V2_CMPL_ERRORS_BUFFER_ERROR_FLUSH \ + (UINT32_C(0x5) << 1) +#define RX_TPA_START_V2_CMPL_ERRORS_BUFFER_ERROR_LAST \ + RX_TPA_START_V2_CMPL_ERRORS_BUFFER_ERROR_FLUSH +/* +* This is data from the CFA block as indicated by the meta_format +* field. +*/ +uint16_t metadata0; +/* When meta_format != 0, this value is the VLAN VID. */ +#define RX_TPA_START_V2_CMPL_METADATA0_VID_MASK UINT32_C(0xfff) +#define RX_TPA_START_V2_CMPL_METADATA0_VID_SFT 0 +/* When meta_format != 0, this value is the VLAN DE. */ +#define RX_TPA_START_V2_CMPL_METADATA0_DE UINT32_C(0x1000) +/* When meta_format != 0, this value is the VLAN PRI. */ +#define RX_TPA_START_V2_CMPL_METADATA0_PRI_MASK UINT32_C(0xe000) +#define RX_TPA_START_V2_CMPL_METADATA0_PRI_SFT 13 +/* +* This field contains the outer_l3_offset, inner_l2_offset, +* inner_l3_offset, and inner_l4_size. +* +* hdr_offsets[8:0] contains the outer_l3_offset. +* hdr_offsets[17:9] contains the inner_l2_offset. +* hdr_offsets[26:18] contains the inner_l3_offset. +* hdr_offsets[31:27] contains the inner_l4_size. +*/ +uint32_t hdr_offsets; +} __rte_packed; +/* * This TPA completion structure is used on devices where the * `hwrm_vnic_qcaps.max_aggs_supported` value is 0.
@@ -3299,27 +4718,27 @@ struct rx_tpa_end_cmpl {* records. Odd values indicate 32B * records. */ -#define RX_TPA_END_CMPL_TYPE_MASK UINT32_C(0x3f) -#define RX_TPA_END_CMPL_TYPE_SFT 0 +#define RX_TPA_END_CMPL_TYPE_MASK UINT32_C(0x3f) +#define RX_TPA_END_CMPL_TYPE_SFT 0/* * RX L2 TPA End Completion: * Completion at the end of a TPA operation. * Length = 32B */ -#define RX_TPA_END_CMPL_TYPE_RX_TPA_END UINT32_C(0x15) +#define RX_TPA_END_CMPL_TYPE_RX_TPA_END UINT32_C(0x15)#define RX_TPA_END_CMPL_TYPE_LAST \ RX_TPA_END_CMPL_TYPE_RX_TPA_END -#define RX_TPA_END_CMPL_FLAGS_MASK UINT32_C(0xffc0) -#define RX_TPA_END_CMPL_FLAGS_SFT 6 +#define RX_TPA_END_CMPL_FLAGS_MASK UINT32_C(0xffc0) +#define RX_TPA_END_CMPL_FLAGS_SFT 6/* * When this bit is '1', it indicates a packet that has an * error of some type. Type of error is indicated in * error_flags. */ -#define RX_TPA_END_CMPL_FLAGS_ERROR UINT32_C(0x40) +#define RX_TPA_END_CMPL_FLAGS_ERROR UINT32_C(0x40)/* This field indicates how the packet was placed in the buffer. */ -#define RX_TPA_END_CMPL_FLAGS_PLACEMENT_MASK UINT32_C(0x380) -#define RX_TPA_END_CMPL_FLAGS_PLACEMENT_SFT 7 +#define RX_TPA_END_CMPL_FLAGS_PLACEMENT_MASK UINT32_C(0x380) +#define RX_TPA_END_CMPL_FLAGS_PLACEMENT_SFT 7/* * Jumbo: * TPA Packet was placed using jumbo algorithm. This means
@@ -3337,6 +4756,15 @@ struct rx_tpa_end_cmpl {*/ #define RX_TPA_END_CMPL_FLAGS_PLACEMENT_HDS \ (UINT32_C(0x2) << 7) +/* +* IOC/Jumbo: +* Packet will be placed using In-Order Completion/Jumbo where +* the first packet of the aggregation is placed using Jumbo +* Placement. Subsequent packets will be placed such that each +* packet starts at the beginning of an aggregation buffer. +*/ +#define RX_TPA_END_CMPL_FLAGS_PLACEMENT_IOC_JUMBO \ + (UINT32_C(0x4) << 7)/* * GRO/Jumbo: * Packet will be placed using GRO/Jumbo where the first
@@ -3358,11 +4786,28 @@ struct rx_tpa_end_cmpl {*/ #define RX_TPA_END_CMPL_FLAGS_PLACEMENT_GRO_HDS \ (UINT32_C(0x6) << 7) +/* +* IOC/Header-Data Separation: +* Packet will be placed using In-Order Completion/HDS where +* the header is in the first packet buffer. Payload of each +* packet will be placed such that each packet starts at the +* beginning of an aggregation buffer. +*/ +#define RX_TPA_END_CMPL_FLAGS_PLACEMENT_IOC_HDS \ + (UINT32_C(0x7) << 7)#define RX_TPA_END_CMPL_FLAGS_PLACEMENT_LAST \ - RX_TPA_END_CMPL_FLAGS_PLACEMENT_GRO_HDS -/* unused is 2 b */ -#define RX_TPA_END_CMPL_FLAGS_UNUSED_MASK UINT32_C(0xc00) -#define RX_TPA_END_CMPL_FLAGS_UNUSED_SFT 10 + RX_TPA_END_CMPL_FLAGS_PLACEMENT_IOC_HDS +/* unused is 1 b */ +#define RX_TPA_END_CMPL_FLAGS_UNUSED UINT32_C(0x400) +/* +* This bit is '1' if metadata has been added to the end of the +* packet in host memory. Metadata starts at the first 32B boundary +* after the end of the packet for regular and jumbo placement. +* It starts at the first 32B boundary after the end of the header +* for HDS placement. The length of the metadata is indicated in the +* metadata itself. +*/ +#define RX_TPA_END_CMPL_FLAGS_PKT_METADATA_PRESENT UINT32_C(0x800)/* * This value indicates what the inner packet determined for the * packet was.
@@ -3372,8 +4817,9 @@ struct rx_tpa_end_cmpl {* field is valid and contains the TCP checksum. * This also indicates that the payload_offset field is valid. */ -#define RX_TPA_END_CMPL_FLAGS_ITYPE_MASK UINT32_C(0xf000) -#define RX_TPA_END_CMPL_FLAGS_ITYPE_SFT 12 +#define RX_TPA_END_CMPL_FLAGS_ITYPE_MASK \ + UINT32_C(0xf000) +#define RX_TPA_END_CMPL_FLAGS_ITYPE_SFT 12/* * This value is zero for TPA End completions. * There is no data in the buffer that corresponds to the opaque
@@ -4243,6 +5689,52 @@ struct rx_abuf_cmpl {uint32_t unused_2; } __rte_packed; +/* VEE FLUSH Completion Record (16 bytes) */ +/* vee_flush (size:128b/16B) */ +struct vee_flush { +uint32_t downstream_path_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 VEE_FLUSH_TYPE_MASK UINT32_C(0x3f) +#define VEE_FLUSH_TYPE_SFT 0 +/* +* VEE Flush Completion: +* This completion is inserted manually by the Primate and processed +* by the VEE hardware to ensure that all completions on a VEE +* function have been processed by the VEE hardware before FLR +* process is completed. +*/ +#define VEE_FLUSH_TYPE_VEE_FLUSH UINT32_C(0x1c) +#define VEE_FLUSH_TYPE_LAST VEE_FLUSH_TYPE_VEE_FLUSH +/* downstream_path is 1 b */ +#define VEE_FLUSH_DOWNSTREAM_PATH UINT32_C(0x40) +/* This completion is associated with VEE Transmit */ +#define VEE_FLUSH_DOWNSTREAM_PATH_TX (UINT32_C(0x0) << 6) +/* This completion is associated with VEE Receive */ +#define VEE_FLUSH_DOWNSTREAM_PATH_RX (UINT32_C(0x1) << 6) +#define VEE_FLUSH_DOWNSTREAM_PATH_LAST VEE_FLUSH_DOWNSTREAM_PATH_RX +/* +* This is an opaque value that is passed through the completion +* to the VEE handler SW and is used to indicate what VEE VQ or +* function has completed FLR processing. +*/ +uint32_t opaque; +uint32_t 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 VEE_FLUSH_V UINT32_C(0x1) +/* unused3 is 32 b */ +uint32_t unused_3; +} __rte_packed; +/* eject_cmpl (size:128b/16B) */ struct eject_cmpl {uint16_t type;
@@ -6562,7 +8054,7 @@ struct hwrm_async_event_cmpl_deferred_response {/* * The PF's mailbox is clear to issue another command. * A command with this seq_id is still in progress -* and will return a regular HWRM completion when done. +* and will return a regualr HWRM completion when done. * 'event_data1' field, if non-zero, contains the estimated * execution time for the command. */
@@ -7476,6 +8968,8 @@ struct hwrm_func_qcaps_input {* Function ID of the function that is being queried. * 0xFF... (All Fs) if the query is for the requesting * function. +* 0xFFFE (REQUESTING_PARENT_FID) This is a special FID +* to be used by a trusted VF to query its parent PF. */ uint16_t fid;uint8_t unused_0[6 ];
@@ -7729,6 +9223,12 @@ struct hwrm_func_qcaps_output {*/ #define HWRM_FUNC_QCAPS_OUTPUT_FLAGS_PFC_WD_STATS_SUPPORTED \ UINT32_C(0x40000000) +/* +* When this bit is '1', it indicates that core firmware supports +* DBG_QCAPS command +*/ +#define HWRM_FUNC_QCAPS_OUTPUT_FLAGS_DBG_QCAPS_CMD_SUPPORTED \ + UINT32_C(0x80000000)/* * This value is current MAC address configured for this * function. A value of 00-00-00-00-00-00 indicates no
@@ -7854,6 +9354,19 @@ struct hwrm_func_qcaps_output {*/ #define HWRM_FUNC_QCAPS_OUTPUT_FLAGS_EXT_ECN_STATS_SUPPORTED \ UINT32_C(0x2) +/* +* If 1, the device can report extended hw statistics (including +* additional tpa statistics). +*/ +#define HWRM_FUNC_QCAPS_OUTPUT_FLAGS_EXT_EXT_HW_STATS_SUPPORTED \ + UINT32_C(0x4) +/* +* If set to 1, then the core firmware has support to enable/ +* disable hot reset support for interface dynamically through +* HWRM_FUNC_CFG. +*/ +#define HWRM_FUNC_QCAPS_OUTPUT_FLAGS_EXT_HOT_RESET_IF_SUPPORT \ + UINT32_C(0x8)uint8_t unused_1[3 ];/* * This field is used in Output records to indicate that the output
@@ -7904,6 +9417,8 @@ struct hwrm_func_qcfg_input {* Function ID of the function that is being queried. * 0xFF... (All Fs) if the query is for the requesting * function. +* 0xFFFE (REQUESTING_PARENT_FID) This is a special FID +* to be used by a trusted VF to query its parent PF. */ uint16_t fid;uint8_t unused_0[6 ];
@@ -8013,6 +9528,15 @@ struct hwrm_func_qcfg_output {*/ #define HWRM_FUNC_QCFG_OUTPUT_FLAGS_PREBOOT_LEGACY_L2_RINGS \ UINT32_C(0x100) +/* +* If set to 1, then the firmware and all currently registered driver +* instances support hot reset. The hot reset support will be updated +* dynamically based on the driver interface advertisement. +* If set to 0, then the adapter is not currently able to initiate +* hot reset. +*/ +#define HWRM_FUNC_QCFG_OUTPUT_FLAGS_HOT_RESET_ALLOWED \ + UINT32_C(0x200)/* * This value is current MAC address configured for this * function. A value of 00-00-00-00-00-00 indicates no
@@ -8565,6 +10089,17 @@ struct hwrm_func_cfg_input {*/ #define HWRM_FUNC_CFG_INPUT_FLAGS_PREBOOT_LEGACY_L2_RINGS \ UINT32_C(0x2000000) +/* +* If this bit is set to 0, then the interface does not support hot +* reset capability which it advertised with the hot_reset_support +* flag in HWRM_FUNC_DRV_RGTR. If any of the function has set this +* flag to 0, adapter cannot do the hot reset. In this state, if the +* firmware receives a hot reset request, firmware must fail the +* request. If this bit is set to 1, then interface is renabling the +* hot reset capability. +*/ +#define HWRM_FUNC_CFG_INPUT_FLAGS_HOT_RESET_IF_EN_DIS \ + UINT32_C(0x4000000)uint32_t enables;/* * This bit must be '1' for the mtu field to be
@@ -8704,6 +10239,12 @@ struct hwrm_func_cfg_input {*/ #define HWRM_FUNC_CFG_INPUT_ENABLES_ADMIN_LINK_STATE \ UINT32_C(0x400000) +/* +* This bit must be '1' for the hot_reset_if_en_dis field to be +* configured. +*/ +#define HWRM_FUNC_CFG_INPUT_ENABLES_HOT_RESET_IF_SUPPORT \ + UINT32_C(0x800000)/* * The maximum transmission unit of the function. * The HWRM should make sure that the mtu of
@@ -9036,15 +10577,21 @@ struct hwrm_func_qstats_input {/* This flags indicates the type of statistics request. */ uint8_t flags;/* This value is not used to avoid backward compatibility issues. */ -#define HWRM_FUNC_QSTATS_INPUT_FLAGS_UNUSED UINT32_C(0x0) +#define HWRM_FUNC_QSTATS_INPUT_FLAGS_UNUSED UINT32_C(0x0)/* * flags should be set to 1 when request is for only RoCE statistics. * This will be honored only if the caller_fid is a privileged PF. * In all other cases FID and caller_fid should be the same. */ -#define HWRM_FUNC_QSTATS_INPUT_FLAGS_ROCE_ONLY UINT32_C(0x1) +#define HWRM_FUNC_QSTATS_INPUT_FLAGS_ROCE_ONLY UINT32_C(0x1) +/* +* flags should be set to 2 when request is for the counter mask, +* representing the width of each of the stats counters, rather +* than counters themselves. +*/ +#define HWRM_FUNC_QSTATS_INPUT_FLAGS_COUNTER_MASK UINT32_C(0x2)#define HWRM_FUNC_QSTATS_INPUT_FLAGS_LAST \ - HWRM_FUNC_QSTATS_INPUT_FLAGS_ROCE_ONLY + HWRM_FUNC_QSTATS_INPUT_FLAGS_COUNTER_MASKuint8_t unused_0[5 ]; } __rte_packed;
@@ -9130,6 +10677,132 @@ struct hwrm_func_qstats_output {uint8_t valid; } __rte_packed; +/************************ +* hwrm_func_qstats_ext * +************************/ + + +/* hwrm_func_qstats_ext_input (size:192b/24B) */ +struct hwrm_func_qstats_ext_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 queried. +* 0xFF... (All Fs) if the query is for the requesting +* function. +* A privileged PF can query for other function's statistics. +*/ +uint16_t fid; +/* This flags indicates the type of statistics request. */ +uint8_t flags; +/* This value is not used to avoid backward compatibility issues. */ +#define HWRM_FUNC_QSTATS_EXT_INPUT_FLAGS_UNUSED UINT32_C(0x0) +/* +* flags should be set to 1 when request is for only RoCE statistics. +* This will be honored only if the caller_fid is a privileged PF. +* In all other cases FID and caller_fid should be the same. +*/ +#define HWRM_FUNC_QSTATS_EXT_INPUT_FLAGS_ROCE_ONLY UINT32_C(0x1) +/* +* flags should be set to 2 when request is for the counter mask +* representing the width of each of the stats counters, rather +* than counters themselves. +*/ +#define HWRM_FUNC_QSTATS_EXT_INPUT_FLAGS_COUNTER_MASK UINT32_C(0x2) +#define HWRM_FUNC_QSTATS_EXT_INPUT_FLAGS_LAST \ + HWRM_FUNC_QSTATS_EXT_INPUT_FLAGS_COUNTER_MASK +uint8_t unused_0[5 ]; +} __rte_packed; + +/* hwrm_func_qstats_ext_output (size:1472b/184B) */ +struct hwrm_func_qstats_ext_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 received unicast packets */ +uint64_t rx_ucast_pkts; +/* Number of received multicast packets */ +uint64_t rx_mcast_pkts; +/* Number of received broadcast packets */ +uint64_t rx_bcast_pkts; +/* Number of discarded packets on received path */ +uint64_t rx_discard_pkts; +/* Number of packets on receive path with error */ +uint64_t rx_error_pkts; +/* Number of received bytes for unicast traffic */ +uint64_t rx_ucast_bytes; +/* Number of received bytes for multicast traffic */ +uint64_t rx_mcast_bytes; +/* Number of received bytes for broadcast traffic */ +uint64_t rx_bcast_bytes; +/* Number of transmitted unicast packets */ +uint64_t tx_ucast_pkts; +/* Number of transmitted multicast packets */ +uint64_t tx_mcast_pkts; +/* Number of transmitted broadcast packets */ +uint64_t tx_bcast_pkts; +/* Number of packets on transmit path with error */ +uint64_t tx_error_pkts; +/* Number of discarded packets on transmit path */ +uint64_t tx_discard_pkts; +/* Number of transmitted bytes for unicast traffic */ +uint64_t tx_ucast_bytes; +/* Number of transmitted bytes for multicast traffic */ +uint64_t tx_mcast_bytes; +/* Number of transmitted bytes for broadcast traffic */ +uint64_t tx_bcast_bytes; +/* Number of TPA eligible packets */ +uint64_t rx_tpa_eligible_pkt; +/* Number of TPA eligible bytes */ +uint64_t rx_tpa_eligible_bytes; +/* Number of TPA packets */ +uint64_t rx_tpa_pkt; +/* Number of TPA bytes */ +uint64_t rx_tpa_bytes; +/* Number of TPA errors */ +uint64_t rx_tpa_errors; +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; +} __rte_packed; +/*********************** * hwrm_func_clr_stats * ***********************/
@@ -10116,7 +11789,7 @@ struct hwrm_func_backing_store_qcaps_output {* * TQM slowpath rings should be sized as follows: * -* num_entries = num_vnics + num_l2_tx_rings + num_roce_qps + tqm_min_size +* num_entries = num_vnics + num_l2_tx_rings + 2 * num_roce_qps + tqm_min_size * * Where: * num_vnics is the number of VNICs allocated in the VNIC backing store
@@ -11039,7 +12712,7 @@ struct hwrm_func_backing_store_cfg_input {* * TQM slowpath rings should be sized as follows: * -* num_entries = num_vnics + num_l2_tx_rings + num_roce_qps + tqm_min_size +* num_entries = num_vnics + num_l2_tx_rings + 2 * num_roce_qps + tqm_min_size * * Where: * num_vnics is the number of VNICs allocated in the VNIC backing store
@@ -16149,7 +17822,18 @@ struct hwrm_port_qstats_input {uint64_t resp_addr;/* Port ID of port that is being queried. */ uint16_t port_id; -uint8_t unused_0[6 ]; +uint8_t flags; +/* This value is not used to avoid backward compatibility issues. */ +#define HWRM_PORT_QSTATS_INPUT_FLAGS_UNUSED UINT32_C(0x0) +/* +* This bit is set to 1 when request is for a counter mask, +* representing the width of each of the stats counters, rather +* than counters themselves. +*/ +#define HWRM_PORT_QSTATS_INPUT_FLAGS_COUNTER_MASK UINT32_C(0x1) +#define HWRM_PORT_QSTATS_INPUT_FLAGS_LAST \ + HWRM_PORT_QSTATS_INPUT_FLAGS_COUNTER_MASK +uint8_t unused_0[5 ];/* * This is the host address where * Tx port statistics will be stored
@@ -16382,7 +18066,7 @@ struct rx_port_stats_ext {* 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 received +* 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.
@@ -16843,7 +18527,18 @@ struct hwrm_port_qstats_ext_input {* statistics block in bytes */ uint16_t rx_stat_size; -uint8_t unused_0[2 ]; +uint8_t flags; +/* This value is not used to avoid backward compatibility issues. */ +#define HWRM_PORT_QSTATS_EXT_INPUT_FLAGS_UNUSED UINT32_C(0x0) +/* +* This bit is set to 1 when request is for the counter mask, +* representing width of each of the stats counters, rather than +* counters themselves. +*/ +#define HWRM_PORT_QSTATS_EXT_INPUT_FLAGS_COUNTER_MASK UINT32_C(0x1) +#define HWRM_PORT_QSTATS_EXT_INPUT_FLAGS_LAST \ + HWRM_PORT_QSTATS_EXT_INPUT_FLAGS_COUNTER_MASK +uint8_t unused_0;/* * This is the host address where * Tx port statistics will be stored
@@ -25312,95 +27007,104 @@ struct hwrm_ring_free_input {/* Ring Type. */ uint8_t ring_type;/* L2 Completion Ring (CR) */ -#define HWRM_RING_FREE_INPUT_RING_TYPE_L2_CMPL UINT32_C(0x0) +#define HWRM_RING_FREE_INPUT_RING_TYPE_L2_CMPL UINT32_C(0x0) +/* TX Ring (TR) */ +#define HWRM_RING_FREE_INPUT_RING_TYPE_TX UINT32_C(0x1) +/* RX Ring (RR) */ +#define HWRM_RING_FREE_INPUT_RING_TYPE_RX UINT32_C(0x2) +/* RoCE Notification Completion Ring (ROCE_CR) */ +#define HWRM_RING_FREE_INPUT_RING_TYPE_ROCE_CMPL UINT32_C(0x3) +/* RX Aggregation Ring */ +#define HWRM_RING_FREE_INPUT_RING_TYPE_RX_AGG UINT32_C(0x4) +/* Notification Queue */ +#define HWRM_RING_FREE_INPUT_RING_TYPE_NQ UINT32_C(0x5) +#define HWRM_RING_FREE_INPUT_RING_TYPE_LAST \ + HWRM_RING_FREE_INPUT_RING_TYPE_NQ +uint8_t unused_0; +/* Physical number of ring allocated. */ +uint16_t ring_id; +uint8_t unused_1[4 ]; +} __rte_packed; + +/* hwrm_ring_free_output (size:128b/16B) */ +struct hwrm_ring_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; +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; +} __rte_packed; + +/******************* +* hwrm_ring_reset * +*******************/ + + +/* hwrm_ring_reset_input (size:192b/24B) */ +struct hwrm_ring_reset_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; +/* Ring Type. */ +uint8_t ring_type; +/* L2 Completion Ring (CR) */ +#define HWRM_RING_RESET_INPUT_RING_TYPE_L2_CMPL UINT32_C(0x0)/* TX Ring (TR) */ -#define HWRM_RING_FREE_INPUT_RING_TYPE_TX UINT32_C(0x1) +#define HWRM_RING_RESET_INPUT_RING_TYPE_TX UINT32_C(0x1)/* RX Ring (RR) */ -#define HWRM_RING_FREE_INPUT_RING_TYPE_RX UINT32_C(0x2) +#define HWRM_RING_RESET_INPUT_RING_TYPE_RX UINT32_C(0x2)/* RoCE Notification Completion Ring (ROCE_CR) */ -#define HWRM_RING_FREE_INPUT_RING_TYPE_ROCE_CMPL UINT32_C(0x3) -/* RX Aggregation Ring */ -#define HWRM_RING_FREE_INPUT_RING_TYPE_RX_AGG UINT32_C(0x4) -/* Notification Queue */ -#define HWRM_RING_FREE_INPUT_RING_TYPE_NQ UINT32_C(0x5) -#define HWRM_RING_FREE_INPUT_RING_TYPE_LAST \ - HWRM_RING_FREE_INPUT_RING_TYPE_NQ -uint8_t unused_0; -/* Physical number of ring allocated. */ -uint16_t ring_id; -uint8_t unused_1[4 ]; -} __rte_packed; - -/* hwrm_ring_free_output (size:128b/16B) */ -struct hwrm_ring_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; -uint8_t unused_0[7 ]; +#define HWRM_RING_RESET_INPUT_RING_TYPE_ROCE_CMPL UINT32_C(0x3)/* -* 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. +* Rx Ring Group. This is to reset rx and aggregation in an atomic +* operation. Completion ring associated with this ring group is +* not reset. */ -uint8_t valid; -} __rte_packed; - -/******************* -* hwrm_ring_reset * -*******************/ - - -/* hwrm_ring_reset_input (size:192b/24B) */ -struct hwrm_ring_reset_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; -/* Ring Type. */ -uint8_t ring_type; -/* L2 Completion Ring (CR) */ -#define HWRM_RING_RESET_INPUT_RING_TYPE_L2_CMPL UINT32_C(0x0) -/* TX Ring (TR) */ -#define HWRM_RING_RESET_INPUT_RING_TYPE_TX UINT32_C(0x1) -/* RX Ring (RR) */ -#define HWRM_RING_RESET_INPUT_RING_TYPE_RX UINT32_C(0x2) -/* RoCE Notification Completion Ring (ROCE_CR) */ -#define HWRM_RING_RESET_INPUT_RING_TYPE_ROCE_CMPL UINT32_C(0x3) +#define HWRM_RING_RESET_INPUT_RING_TYPE_RX_RING_GRP UINT32_C(0x6)#define HWRM_RING_RESET_INPUT_RING_TYPE_LAST \ - HWRM_RING_RESET_INPUT_RING_TYPE_ROCE_CMPL + HWRM_RING_RESET_INPUT_RING_TYPE_RX_RING_GRPuint8_t unused_0; -/* Physical number of the ring. */ +/* +* Physical number of the ring. When ring type is rx_ring_grp, ring id +* actually refers to ring group id. +*/ uint16_t ring_id;uint8_t unused_1[4 ]; } __rte_packed;
@@ -25615,7 +27319,18 @@ struct hwrm_ring_cmpl_ring_qaggint_params_input {uint64_t resp_addr;/* Physical number of completion ring. */ uint16_t ring_id; -uint8_t unused_0[6 ]; +uint16_t flags; +#define HWRM_RING_CMPL_RING_QAGGINT_PARAMS_INPUT_FLAGS_UNUSED_0_MASK \ + UINT32_C(0x3) +#define HWRM_RING_CMPL_RING_QAGGINT_PARAMS_INPUT_FLAGS_UNUSED_0_SFT 0 +/* +* Set this flag to 1 when querying parameters on a notification +* queue. Set this flag to 0 when querying parameters on a +* completion queue or completion ring. +*/ +#define HWRM_RING_CMPL_RING_QAGGINT_PARAMS_INPUT_FLAGS_IS_NQ \ + UINT32_C(0x4) +uint8_t unused_0[4 ]; } __rte_packed;/* hwrm_ring_cmpl_ring_qaggint_params_output (size:256b/32B) */
@@ -25652,19 +27367,19 @@ struct hwrm_ring_cmpl_ring_qaggint_params_output {*/ uint16_t num_cmpl_dma_aggr_during_int;/* -* Timer in unit of 80-nsec used to aggregate completions before +* Timer used to aggregate completions before * DMA during the normal mode (not in interrupt mode). */ uint16_t cmpl_aggr_dma_tmr;/* -* Timer in unit of 80-nsec used to aggregate completions before -* DMA during the interrupt mode. +* Timer used to aggregate completions before +* DMA when in interrupt mode. */ uint16_t cmpl_aggr_dma_tmr_during_int; -/* Minimum time (in unit of 80-nsec) between two interrupts. */ +/* Minimum time between two interrupts. */ uint16_t int_lat_tmr_min;/* -* Maximum wait time (in unit of 80-nsec) spent aggregating +* Maximum wait time spent aggregating * completions before signaling the interrupt after the * interrupt is enabled. */
@@ -25738,7 +27453,7 @@ struct hwrm_ring_cmpl_ring_cfg_aggint_params_input {/* * Set this flag to 1 when configuring parameters on a * notification queue. Set this flag to 0 when configuring -* parameters on a completion queue. +* parameters on a completion queue or completion ring. */ #define HWRM_RING_CMPL_RING_CFG_AGGINT_PARAMS_INPUT_FLAGS_IS_NQ \ UINT32_C(0x4)
@@ -25753,20 +27468,20 @@ struct hwrm_ring_cmpl_ring_cfg_aggint_params_input {*/ uint16_t num_cmpl_dma_aggr_during_int;/* -* Timer in unit of 80-nsec used to aggregate completions before +* Timer used to aggregate completions before * DMA during the normal mode (not in interrupt mode). */ uint16_t cmpl_aggr_dma_tmr;/* -* Timer in unit of 80-nsec used to aggregate completions before -* DMA during the interrupt mode. +* Timer used to aggregate completions before +* DMA while in interrupt mode. */ uint16_t cmpl_aggr_dma_tmr_during_int; -/* Minimum time (in unit of 80-nsec) between two interrupts. */ +/* Minimum time between two interrupts. */ uint16_t int_lat_tmr_min;/* -* Maximum wait time (in unit of 80-nsec) spent aggregating -* cmpls before signaling the interrupt after the +* Maximum wait time spent aggregating +* completions before signaling the interrupt after the * interrupt is enabled. */ uint16_t int_lat_tmr_max;
@@ -33339,78 +35054,246 @@ struct hwrm_tf_version_get_input {* point to a physically contiguous block of memory. */ uint64_t resp_addr; -} __rte_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 ]; +} __rte_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; +} __rte_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 ]; +} __rte_packed; + +/* hwrm_tf_session_open_output (size:192b/24B) */ +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. +*/ +uint32_t fw_session_id; +/* +* Unique session client identifier for the first client on +* the newly created session. +*/ +uint32_t fw_session_client_id; +/* unused. */ +uint32_t unused0; +/* unused. */ +uint8_t unused1[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; +} __rte_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 ]; +} __rte_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; +} __rte_packed; + +/**************************** +* hwrm_tf_session_register * +****************************/ + + +/* hwrm_tf_session_register_input (size:704b/88B) */ +struct hwrm_tf_session_register_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;/* -* This field is used in Output records to indicate that the output -* is completely written to RAM. This field should be read as '1' -* to indicate that the output has been completely written. -* When writing a command completion or response to an internal -* processor, the order of writes has to be such that this field is -* written last. -*/ -uint8_t valid; -} __rte_packed; - -/************************ -* 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. +* Unique session identifier for the session that the +* register request want to create a new client on. This +* value originates from the first open request. +* 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. */ -uint64_t resp_addr; -/* Name of the session. */ -uint8_t session_name[64 ]; +uint32_t fw_session_id; +/* unused. */ +uint32_t unused0; +/* Name of the session client. */ +uint8_t session_client_name[64 ]; } __rte_packed; -/* hwrm_tf_session_open_output (size:128b/16B) */ -struct hwrm_tf_session_open_output { +/* hwrm_tf_session_register_output (size:128b/16B) */ +struct hwrm_tf_session_register_output {/* The specific error status for the command. */ uint16_t error_code;/* The HWRM command request type. */
@@ -33420,12 +35303,11 @@ struct hwrm_tf_session_open_output {/* 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. +* Unique session client identifier for the session created +* by the firmware. It includes the session the client it +* attached to and session client info. */ -uint32_t fw_session_id; +uint32_t fw_session_client_id;/* unused. */ uint8_t unused0[3 ];/*
@@ -33439,13 +35321,13 @@ struct hwrm_tf_session_open_output {uint8_t valid; } __rte_packed; -/************************** -* hwrm_tf_session_attach * -**************************/ +/****************************** +* hwrm_tf_session_unregister * +******************************/ -/* hwrm_tf_session_attach_input (size:704b/88B) */ -struct hwrm_tf_session_attach_input { +/* hwrm_tf_session_unregister_input (size:192b/24B) */ +struct hwrm_tf_session_unregister_input {/* The HWRM command request type. */ uint16_t req_type;/*
@@ -33475,24 +35357,19 @@ struct hwrm_tf_session_attach_input {*/ 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. +* Unique session identifier for the session that the +* unregister request want to close a session client on. */ -uint32_t attach_fw_session_id; -/* unused. */ -uint32_t unused0; -/* Name of the session it self. */ -uint8_t session_name[64 ]; +uint32_t fw_session_id; +/* +* Unique session client identifier for the session that the +* unregister request want to close. +*/ +uint32_t fw_session_client_id; } __rte_packed; -/* hwrm_tf_session_attach_output (size:128b/16B) */ -struct hwrm_tf_session_attach_output { +/* hwrm_tf_session_unregister_output (size:128b/16B) */ +struct hwrm_tf_session_unregister_output {/* The specific error status for the command. */ uint16_t error_code;/* The HWRM command request type. */
@@ -33501,16 +35378,8 @@ struct hwrm_tf_session_attach_output {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 ]; +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'
@@ -33746,15 +35615,17 @@ struct hwrm_tf_session_resc_qcaps_input {#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 +* Defines the size of the provided qcaps_addr array * buffer. The size should be set to the Resource Manager -* provided max qcaps value that is device specific. This is -* the max size possible. +* provided max number of qcaps entries which is device +* specific. Resource Manager gets the max size from HCAPI +* RM. */ -uint16_t size; +uint16_t qcaps_size;/* -* This is the DMA address for the qcaps output data -* array. Array is of tf_rm_cap type and is device specific. +* This is the DMA address for the qcaps output data array +* buffer. Array is of tf_rm_resc_req_entry type and is +* device specific. */ uint64_t qcaps_addr; } __rte_packed;
@@ -33772,29 +35643,28 @@ struct hwrm_tf_session_resc_qcaps_output {/* Control flags. */ uint32_t flags;/* Session reservation strategy. */ -#define HWRM_TF_SESSION_RESC_QCAPS_OUTPUT_FLAGS_SESS_RES_STRATEGY_MASK \ +#define HWRM_TF_SESSION_RESC_QCAPS_OUTPUT_FLAGS_SESS_RESV_STRATEGY_MASK \ UINT32_C(0x3) -#define HWRM_TF_SESSION_RESC_QCAPS_OUTPUT_FLAGS_SESS_RES_STRATEGY_SFT \ +#define HWRM_TF_SESSION_RESC_QCAPS_OUTPUT_FLAGS_SESS_RESV_STRATEGY_SFT \ 0/* Static partitioning. */ -#define HWRM_TF_SESSION_RESC_QCAPS_OUTPUT_FLAGS_SESS_RES_STRATEGY_STATIC \ +#define HWRM_TF_SESSION_RESC_QCAPS_OUTPUT_FLAGS_SESS_RESV_STRATEGY_STATIC \ UINT32_C(0x0)/* Strategy 1. */ -#define HWRM_TF_SESSION_RESC_QCAPS_OUTPUT_FLAGS_SESS_RES_STRATEGY_1 \ +#define HWRM_TF_SESSION_RESC_QCAPS_OUTPUT_FLAGS_SESS_RESV_STRATEGY_1 \ UINT32_C(0x1)/* Strategy 2. */ -#define HWRM_TF_SESSION_RESC_QCAPS_OUTPUT_FLAGS_SESS_RES_STRATEGY_2 \ +#define HWRM_TF_SESSION_RESC_QCAPS_OUTPUT_FLAGS_SESS_RESV_STRATEGY_2 \ UINT32_C(0x2)/* Strategy 3. */ -#define HWRM_TF_SESSION_RESC_QCAPS_OUTPUT_FLAGS_SESS_RES_STRATEGY_3 \ +#define HWRM_TF_SESSION_RESC_QCAPS_OUTPUT_FLAGS_SESS_RESV_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 +#define HWRM_TF_SESSION_RESC_QCAPS_OUTPUT_FLAGS_SESS_RESV_STRATEGY_LAST \ + HWRM_TF_SESSION_RESC_QCAPS_OUTPUT_FLAGS_SESS_RESV_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. +* Size of the returned qcaps_addr data array buffer. The +* value cannot exceed the size defined by the input msg, +* qcaps_size. */ uint16_t size;/* unused. */
@@ -33817,7 +35687,7 @@ struct hwrm_tf_session_resc_qcaps_output {******************************/ -/* hwrm_tf_session_resc_alloc_input (size:256b/32B) */ +/* hwrm_tf_session_resc_alloc_input (size:320b/40B) */ struct hwrm_tf_session_resc_alloc_input {/* The HWRM command request type. */ uint16_t req_type;
@@ -33860,16 +35730,25 @@ struct hwrm_tf_session_resc_alloc_input {#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. +* Defines the array size of the provided req_addr and +* resv_addr array buffers. Should be set to the number of +* request entries. */ -uint16_t size; +uint16_t req_size; +/* +* This is the DMA address for the request input data array +* buffer. Array is of tf_rm_resc_req_entry type. Size of the +* array buffer is provided by the 'req_size' field in this +* message. +*/ +uint64_t req_addr;/* -* This is the DMA address for the 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. +* This is the DMA address for the resc output data array +* buffer. Array is of tf_rm_resc_entry type. Size of the array +* buffer is provided by the 'req_size' field in this +* message. */ -uint64_t num_addr; +uint64_t resc_addr; } __rte_packed;
Lines of this file are not shown. View the raw message.
drivers/net/bnxt/tf_core/tf_core.c +133 -11
144 lines not on this page · raw message
drivers/net/bnxt/tf_core/tf_core.h +208 -175
383 lines not on this page · raw message
drivers/net/bnxt/tf_core/tf_em.c +94 -4
98 lines not on this page · raw message
drivers/net/bnxt/tf_core/tf_ext_flow_handle.h +12 -0
Lines of this file are not shown. View the raw message.
drivers/net/bnxt/tf_core/tf_msg.c +83 -3
86 lines not on this page · raw message
drivers/net/bnxt/tf_core/tf_tbl.c +95 -4
99 lines not on this page · raw message
drivers/net/bnxt/tf_core/tf_tbl.h +35 -22
57 lines not on this page · raw message
drivers/net/bnxt/tf_core/tfp.h +88 -35
123 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 1 line
2.21.1 (Apple Git-122.3)
Part of the diff is not shown here. View the raw message.
PATCH v5 10/51 net/bnxt: use HWRM direct for EM insert and delete
In reply to Ajit KhapardeFrom: Peter Spreadborough <[email protected]>
Modify Exact Match insert and delete to use the HWRM messages directly. Remove tunneled EM insert and delete message types.
--- drivers/net/bnxt/tf_core/hwrm_tf.h | 70 ++---------------------------- drivers/net/bnxt/tf_core/tf_msg.c | 66 ++++++++++++++++------------ 2 files changed, 43 insertions(+), 93 deletions(-)
drivers/net/bnxt/tf_core/hwrm_tf.h +4 -66
@@ -1,5 +1,5 @@/* SPDX-License-Identifier: BSD-3-Clause -* Copyright(c) 2019-2020 Broadcom +* Copyright(c) 2019 Broadcom * All rights reserved. */ #ifndef _HWRM_TF_H_
@@ -23,8 +23,6 @@ typedef enum tf_subtype {HWRM_TFT_SESSION_SRAM_RESC_FREE =727 ,HWRM_TFT_SESSION_SRAM_RESC_FLUSH =728 ,HWRM_TFT_TBL_SCOPE_CFG =731 , -HWRM_TFT_EM_RULE_INSERT =739 , -HWRM_TFT_EM_RULE_DELETE =740 ,HWRM_TFT_REG_GET =821 ,HWRM_TFT_REG_SET =822 , HWRM_TFT_TBL_TYPE_SET = 823,
@@ -83,10 +81,6 @@ struct tf_session_sram_resc_flush_input;struct tf_tbl_type_set_input ;struct tf_tbl_type_get_input ;struct tf_tbl_type_get_output ; -struct tf_em_internal_insert_input ; -struct tf_em_internal_insert_output ; -struct tf_em_internal_delete_input ; -struct tf_em_internal_delete_output ;/* Input params for session attach */ typedef struct tf_session_attach_input { /* Firmware session id returned when HWRM_TF_SESSION_OPEN is sent */
@@ -351,7 +345,7 @@ typedef struct tf_session_hw_resc_alloc_output {uint16_t range_prof_start;/* Number range profiles allocated */ uint16_t range_prof_stride; -/* Starting index of range entries allocated to the session */ +/* Starting index of range enntries allocated to the session */ uint16_t range_entries_start;/* Number of range entries allocated */ uint16_t range_entries_stride;
@@ -453,7 +447,7 @@ typedef struct tf_session_hw_resc_free_input {uint16_t range_prof_start;/* Number range profiles allocated */ uint16_t range_prof_stride; -/* Starting index of range entries allocated to the session */ +/* Starting index of range enntries allocated to the session */ uint16_t range_entries_start;/* Number of range entries allocated */ uint16_t range_entries_stride;
@@ -555,7 +549,7 @@ typedef struct tf_session_hw_resc_flush_input {uint16_t range_prof_start;/* Number range profiles allocated */ uint16_t range_prof_stride; -/* Starting index of range entries allocated to the session */ +/* Starting index of range enntries allocated to the session */ uint16_t range_entries_start;/* Number of range entries allocated */ uint16_t range_entries_stride;
@@ -922,60 +916,4 @@ typedef struct tf_tbl_type_get_output { uint8_t data[TF_BULK_RECV]; } tf_tbl_type_get_output_t, *ptf_tbl_type_get_output_t; -/* Input params for EM internal rule insert */ -typedef struct tf_em_internal_insert_input { -/* Firmware Session Id */ -uint32_t fw_session_id; -/* flags */ -uint16_t flags; -/* When set to 0, indicates the get apply to RX */ -#define TF_EM_INTERNAL_INSERT_INPUT_FLAGS_DIR_RX (0x0) -/* When set to 1, indicates the get apply to TX */ -#define TF_EM_INTERNAL_INSERT_INPUT_FLAGS_DIR_TX (0x1) -/* strength */ -uint16_t strength; -/* index to action */ -uint32_t action_ptr; -/* index of em record */ -uint32_t em_record_idx; -/* EM Key value */ -uint64_t em_key[8 ]; -/* number of bits in em_key */ -uint16_t em_key_bitlen; -}tf_em_internal_insert_input_t , *ptf_em_internal_insert_input_t ; - -/* Output params for EM internal rule insert */ -typedef struct tf_em_internal_insert_output { -/* EM record pointer index */ -uint16_t rptr_index; -/* EM record offset 0~3 */ -uint8_t rptr_entry; -/* Number of word entries consumed by the key */ -uint8_t num_of_entries; -}tf_em_internal_insert_output_t , *ptf_em_internal_insert_output_t ; - -/* Input params for EM INTERNAL rule delete */ -typedef struct tf_em_internal_delete_input { -/* Session Id */ -uint32_t tf_session_id; -/* flags */ -uint16_t flags; -/* When set to 0, indicates the get apply to RX */ -#define TF_EM_INTERNAL_DELETE_INPUT_FLAGS_DIR_RX (0x0) -/* When set to 1, indicates the get apply to TX */ -#define TF_EM_INTERNAL_DELETE_INPUT_FLAGS_DIR_TX (0x1) -/* EM internal flow hanndle */ -uint64_t flow_handle; -/* EM Key value */ -uint64_t em_key[8 ]; -/* number of bits in em_key */ -uint16_t em_key_bitlen; -}tf_em_internal_delete_input_t , *ptf_em_internal_delete_input_t ; - -/* Input params for EM INTERNAL rule delete */ -typedef struct tf_em_internal_delete_output { -/* Original stack allocation index */ -uint16_t em_index; -}tf_em_internal_delete_output_t , *ptf_em_internal_delete_output_t ; -#endif /* _HWRM_TF_H_ */
drivers/net/bnxt/tf_core/tf_msg.c +39 -27
110 lines not on this page · raw message
Signature · 1 line
2.21.1 (Apple Git-122.3)
Re: [dpdk-dev] [PATCH v5 10/51] net/bnxt: use HWRM direct for EM insert and delete
Quoted 19 lines · Ajit Khaparde
From: Peter Spreadborough <[email protected]>
Modify Exact Match insert and delete to use the HWRM messages directly. Remove tunneled EM insert and delete message types.
Signed-off-by Peter Spreadborough <[email protected]>Signed-off-by Venkat Duvvuru <[email protected]>Reviewed-by Randy Schacher <[email protected]>Reviewed-by Ajit Khaparde <[email protected]>--- drivers/net/bnxt/tf_core/hwrm_tf.h | 70 ++---------------------------- drivers/net/bnxt/tf_core/tf_msg.c | 66 ++++++++++++++++------------ 2 files changed, 43 insertions(+), 93 deletions(-)drivers/net/bnxt/tf_core/hwrm_tf.h +0
-0
drivers/net/bnxt/tf_core/hwrm_tf.h line 4
Quoted 5 lines
drivers/net/bnxt/tf_core/hwrm_tf.h +1
-1@@ -1,5 +1,5 @@/* SPDX-License-Identifier: BSD-3-Clause -* Copyright(c) 2019-2020 Broadcom +* Copyright(c) 2019 Broadcom * All rights reserved. */
Why '2020' removed from the copyright year, -although many seems feeling similar about the '2020' :/
Re: [dpdk-dev] [PATCH v5 10/51] net/bnxt: use HWRM direct for EM insert and delete
In reply to Ajit KhapardeQuoted 9 lines · Ajit Khaparde
From: Peter Spreadborough <[email protected]>
Modify Exact Match insert and delete to use the HWRM messages directly. Remove tunneled EM insert and delete message types.
Signed-off-by Peter Spreadborough <[email protected]>Signed-off-by Venkat Duvvuru <[email protected]>Reviewed-by Randy Schacher <[email protected]>Reviewed-by Ajit Khaparde <[email protected]>
<...>
Quoted 19 lines
drivers/net/bnxt/tf_core/hwrm_tf.h +2
-2@@ -351,7 +345,7 @@ typedef struct tf_session_hw_resc_alloc_output {uint16_t range_prof_start;/* Number range profiles allocated */ uint16_t range_prof_stride; -/* Starting index of range entries allocated to the session */ +/* Starting index of range enntries allocated to the session */ uint16_t range_entries_start;/* Number of range entries allocated */ uint16_t range_entries_stride;@@ -453,7 +447,7 @@ typedef struct tf_session_hw_resc_free_input {uint16_t range_prof_start;/* Number range profiles allocated */ uint16_t range_prof_stride; -/* Starting index of range entries allocated to the session */ +/* Starting index of range enntries allocated to the session */ uint16_t range_entries_start;/* Number of range entries allocated */ uint16_t range_entries_stride;
drivers/net/bnxt/tf_core/hwrm_tf.h typedef struct tf_session_hw_resc_flush_input { · line 555
Quoted 8 lines
drivers/net/bnxt/tf_core/hwrm_tf.h +1
-1@@ -555,7 +549,7 @@ typedef struct tf_session_hw_resc_flush_input {uint16_t range_prof_start;/* Number range profiles allocated */ uint16_t range_prof_stride; -/* Starting index of range entries allocated to the session */ +/* Starting index of range enntries allocated to the session */ uint16_t range_entries_start;/* Number of range entries allocated */ uint16_t range_entries_stride;
And adding spelling errors back?
Is this patch revert of any previous patch? Would you mind keeping the spelling fixes?
This set is big and confusing to me ...
PATCH v5 11/51 net/bnxt: add multi device support
In reply to Ajit KhapardeFrom: Michael Wildt <[email protected]>
Introduce new modules for Device, Resource Manager, Identifier, Table Types, and TCAM for multi device support.
--- drivers/net/bnxt/meson.build | 8 + drivers/net/bnxt/tf_core/Makefile | 9 + drivers/net/bnxt/tf_core/cfa_resource_types.h | 266 +++++++++++++ drivers/net/bnxt/tf_core/tf_core.c | 2 + drivers/net/bnxt/tf_core/tf_core.h | 56 +-- drivers/net/bnxt/tf_core/tf_device.c | 50 +++ drivers/net/bnxt/tf_core/tf_device.h | 331 ++++++++++++++++ drivers/net/bnxt/tf_core/tf_device_p4.c | 24 ++ drivers/net/bnxt/tf_core/tf_device_p4.h | 64 +++ drivers/net/bnxt/tf_core/tf_identifier.c | 47 +++ drivers/net/bnxt/tf_core/tf_identifier.h | 140 +++++++ drivers/net/bnxt/tf_core/tf_rm.c | 54 +-- drivers/net/bnxt/tf_core/tf_rm.h | 18 - drivers/net/bnxt/tf_core/tf_rm_new.c | 102 +++++ drivers/net/bnxt/tf_core/tf_rm_new.h | 368 ++++++++++++++++++ drivers/net/bnxt/tf_core/tf_session.c | 31 ++ drivers/net/bnxt/tf_core/tf_session.h | 54 +++ drivers/net/bnxt/tf_core/tf_shadow_tbl.c | 63 +++ drivers/net/bnxt/tf_core/tf_shadow_tbl.h | 240 ++++++++++++ drivers/net/bnxt/tf_core/tf_shadow_tcam.c | 63 +++ drivers/net/bnxt/tf_core/tf_shadow_tcam.h | 239 ++++++++++++ drivers/net/bnxt/tf_core/tf_tbl.c | 1 + drivers/net/bnxt/tf_core/tf_tbl_type.c | 78 ++++ drivers/net/bnxt/tf_core/tf_tbl_type.h | 309 +++++++++++++++ drivers/net/bnxt/tf_core/tf_tcam.c | 78 ++++ drivers/net/bnxt/tf_core/tf_tcam.h | 314 +++++++++++++++ drivers/net/bnxt/tf_core/tf_util.c | 145 +++++++ drivers/net/bnxt/tf_core/tf_util.h | 41 ++ 28 files changed, 3101 insertions(+), 94 deletions(-) create mode 100644 drivers/net/bnxt/tf_core/cfa_resource_types.h create mode 100644 drivers/net/bnxt/tf_core/tf_device.c create mode 100644 drivers/net/bnxt/tf_core/tf_device.h create mode 100644 drivers/net/bnxt/tf_core/tf_device_p4.c create mode 100644 drivers/net/bnxt/tf_core/tf_device_p4.h create mode 100644 drivers/net/bnxt/tf_core/tf_identifier.c create mode 100644 drivers/net/bnxt/tf_core/tf_identifier.h create mode 100644 drivers/net/bnxt/tf_core/tf_rm_new.c create mode 100644 drivers/net/bnxt/tf_core/tf_rm_new.h create mode 100644 drivers/net/bnxt/tf_core/tf_session.c create mode 100644 drivers/net/bnxt/tf_core/tf_shadow_tbl.c create mode 100644 drivers/net/bnxt/tf_core/tf_shadow_tbl.h create mode 100644 drivers/net/bnxt/tf_core/tf_shadow_tcam.c create mode 100644 drivers/net/bnxt/tf_core/tf_shadow_tcam.h create mode 100644 drivers/net/bnxt/tf_core/tf_tbl_type.c create mode 100644 drivers/net/bnxt/tf_core/tf_tbl_type.h create mode 100644 drivers/net/bnxt/tf_core/tf_tcam.c create mode 100644 drivers/net/bnxt/tf_core/tf_tcam.h create mode 100644 drivers/net/bnxt/tf_core/tf_util.c create mode 100644 drivers/net/bnxt/tf_core/tf_util.h
drivers/net/bnxt/meson.build +8 -0
@@ -32,6 +32,14 @@ sources = files('bnxt_cpr.c', 'tf_core/tf_rm.c', 'tf_core/tf_tbl.c', 'tf_core/tfp.c', + 'tf_core/tf_device_p4.c', + 'tf_core/tf_identifier.c', + 'tf_core/tf_shadow_tbl.c', + 'tf_core/tf_shadow_tcam.c', + 'tf_core/tf_tbl_type.c', + 'tf_core/tf_tcam.c', + 'tf_core/tf_util.c', + 'tf_core/tf_rm_new.c', 'tf_ulp/bnxt_ulp.c', 'tf_ulp/ulp_mark_mgr.c',
drivers/net/bnxt/tf_core/Makefile +9 -0
@@ -14,3 +14,12 @@ SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += tf_core/tfp.c SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += tf_core/tf_msg.c SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += tf_core/tf_em.c SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += tf_core/tf_tbl.c +SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += tf_core/tf_device.c +SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += tf_core/tf_device_p4.c +SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += tf_core/tf_identifier.c +SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += tf_core/tf_shadow_tbl.c +SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += tf_core/tf_shadow_tcam.c +SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += tf_core/tf_tbl_type.c +SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += tf_core/tf_tcam.c +SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += tf_core/tf_util.c +SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += tf_core/tf_rm_new.c
drivers/net/bnxt/tf_core/cfa_resource_types.h new file +266 -0
266 lines not on this page · raw message
drivers/net/bnxt/tf_core/tf_core.c +2 -0
@@ -6,6 +6,7 @@#include <stdio.h> #include "tf_core.h" +#include "tf_util.h" #include "tf_session.h" #include "tf_tbl.h" #include "tf_em.h"
@@ -229,6 +230,7 @@ tf_open_session(struct tf *tfp,/* Initialize Session */ session->device_type = parms->device_type; + session->dev =NULL ;tf_rm_init (tfp);/* Construct the Session ID */
drivers/net/bnxt/tf_core/tf_core.h +33 -23
72 lines not on this page · raw message
drivers/net/bnxt/tf_core/tf_device.c new file +50 -0
50 lines not on this page · raw message
drivers/net/bnxt/tf_core/tf_device.h new file +331 -0
331 lines not on this page · raw message
drivers/net/bnxt/tf_core/tf_device_p4.c new file +24 -0
@@ -0,0 +1,24 @@ +/* SPDX-License-Identifier: BSD-3-Clause +* Copyright(c) 2019-2020 Broadcom +* All rights reserved. +*/ + +#include "tf_device.h" +#include "tf_identifier.h" +#include "tf_tbl_type.h" +#include "tf_tcam.h" + +const struct tf_dev_ops tf_dev_ops_p4 = { + .tf_dev_alloc_ident = tf_ident_alloc, + .tf_dev_free_ident = tf_ident_free, + .tf_dev_alloc_tbl_type = tf_tbl_type_alloc, + .tf_dev_free_tbl_type = tf_tbl_type_free, + .tf_dev_alloc_search_tbl_type = tf_tbl_type_alloc_search, + .tf_dev_set_tbl_type = tf_tbl_type_set, + .tf_dev_get_tbl_type = tf_tbl_type_get, + .tf_dev_alloc_tcam = tf_tcam_alloc, + .tf_dev_free_tcam = tf_tcam_free, + .tf_dev_alloc_search_tcam = tf_tcam_alloc_search, + .tf_dev_set_tcam = tf_tcam_set, + .tf_dev_get_tcam = tf_tcam_get, +};
drivers/net/bnxt/tf_core/tf_device_p4.h new file +64 -0
64 lines not on this page · raw message
drivers/net/bnxt/tf_core/tf_identifier.c new file +47 -0
47 lines not on this page · raw message
drivers/net/bnxt/tf_core/tf_identifier.h new file +140 -0
140 lines not on this page · raw message
drivers/net/bnxt/tf_core/tf_rm.c +1 -53
66 lines not on this page · raw message
drivers/net/bnxt/tf_core/tf_rm.h +0 -18
@@ -124,24 +124,6 @@ struct tf_rm_db {struct tf_rm_resc tx; }; -/** -* Helper function converting direction to text string -*/ -const char -*tf_dir_2_str (enum tf_dir dir); - -/** -* Helper function converting identifier to text string -*/ -const char -*tf_ident_2_str (enum tf_identifier_type id_type); - -/** -* Helper function converting tcam type to text string -*/ -const char -*tf_tcam_tbl_2_str (enum tf_tcam_tbl_type tcam_type); -/** * Helper function used to convert HW HCAPI resource type to a string. */
drivers/net/bnxt/tf_core/tf_rm_new.c new file +102 -0
102 lines not on this page · raw message
drivers/net/bnxt/tf_core/tf_rm_new.h new file +368 -0
368 lines not on this page · raw message
drivers/net/bnxt/tf_core/tf_session.c new file +31 -0
@@ -0,0 +1,31 @@ +/* SPDX-License-Identifier: BSD-3-Clause +* Copyright(c) 2019-2020 Broadcom +* All rights reserved. +*/ + +int +tf_session_get_session (struct tf *tfp, +struct tf_session *tfs) +{ +if (tfp->session ==NULL || tfp->session->core_data ==NULL ) { +TFP_DRV_LOG (ERR ,"Session not created\n" ); +return -EINVAL ; + } + + tfs = (struct tf_session *)(tfp->session->core_data); + +return 0 ; +} + +int +tf_session_get_device (struct tf_session *tfs, +struct tf_device *tfd) +{ +if (tfs->dev ==NULL ) { +TFP_DRV_LOG (ERR ,"Device not created\n" ); +return -EINVAL ; + } + tfd = tfs->dev; + +return 0 ; +}
drivers/net/bnxt/tf_core/tf_session.h +54 -0
74 lines not on this page · raw message
drivers/net/bnxt/tf_core/tf_shadow_tbl.c new file +63 -0
63 lines not on this page · raw message
drivers/net/bnxt/tf_core/tf_shadow_tbl.h new file +240 -0
240 lines not on this page · raw message
drivers/net/bnxt/tf_core/tf_shadow_tcam.c new file +63 -0
63 lines not on this page · raw message
drivers/net/bnxt/tf_core/tf_shadow_tcam.h new file +239 -0
239 lines not on this page · raw message
drivers/net/bnxt/tf_core/tf_tbl.c +1 -0
@@ -15,6 +15,7 @@#include "hsi_struct_def_dpdk.h" #include "tf_core.h" +#include "tf_util.h" #include "tf_em.h" #include "tf_msg.h" #include "tfp.h"
drivers/net/bnxt/tf_core/tf_tbl_type.c new file +78 -0
78 lines not on this page · raw message
drivers/net/bnxt/tf_core/tf_tbl_type.h new file +309 -0
309 lines not on this page · raw message
drivers/net/bnxt/tf_core/tf_tcam.c new file +78 -0
78 lines not on this page · raw message
drivers/net/bnxt/tf_core/tf_tcam.h new file +314 -0
224 lines not on this page · raw message
drivers/net/bnxt/tf_core/tf_util.c new file +145 -0
145 lines not on this page · raw message
drivers/net/bnxt/tf_core/tf_util.h new file +41 -0
41 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 1 line
2.21.1 (Apple Git-122.3)
Part of the diff is not shown here. View the raw message.
PATCH v5 12/51 net/bnxt: support bulk table get and mirror
In reply to Ajit KhapardeFrom: Shahaji Bhosle <[email protected]>
- Add new bulk table type get using FW
to DMA the data back to host.
- Add flag to allow records to be cleared if possible
- Set mirror using tf_alloc_tbl_entry
--- drivers/net/bnxt/tf_core/hwrm_tf.h | 37 ++++++++- drivers/net/bnxt/tf_core/tf_common.h | 54 +++++++++++++ drivers/net/bnxt/tf_core/tf_core.c | 2 + drivers/net/bnxt/tf_core/tf_core.h | 55 ++++++++++++- drivers/net/bnxt/tf_core/tf_msg.c | 70 ++++++++++++---- drivers/net/bnxt/tf_core/tf_msg.h | 15 ++++ drivers/net/bnxt/tf_core/tf_resources.h | 5 +- drivers/net/bnxt/tf_core/tf_tbl.c | 103 ++++++++++++++++++++++++ 8 files changed, 319 insertions(+), 22 deletions(-) create mode 100644 drivers/net/bnxt/tf_core/tf_common.h
drivers/net/bnxt/tf_core/hwrm_tf.h +35 -2
@@ -1,5 +1,5 @@/* SPDX-License-Identifier: BSD-3-Clause -* Copyright(c) 2019 Broadcom +* Copyright(c) 2019-2020 Broadcom * All rights reserved. */ #ifndef _HWRM_TF_H_
@@ -27,7 +27,8 @@ typedef enum tf_subtype {HWRM_TFT_REG_SET =822 ,HWRM_TFT_TBL_TYPE_SET =823 ,HWRM_TFT_TBL_TYPE_GET =824 , -TF_SUBTYPE_LAST =HWRM_TFT_TBL_TYPE_GET , +HWRM_TFT_TBL_TYPE_GET_BULK =825 , +TF_SUBTYPE_LAST =HWRM_TFT_TBL_TYPE_GET_BULK , } tf_subtype_t;/* Request and Response compile time checking */
@@ -81,6 +82,8 @@ struct tf_session_sram_resc_flush_input;struct tf_tbl_type_set_input ;struct tf_tbl_type_get_input ;struct tf_tbl_type_get_output ; +struct tf_tbl_type_get_bulk_input ; +struct tf_tbl_type_get_bulk_output ;/* Input params for session attach */ typedef struct tf_session_attach_input { /* Firmware session id returned when HWRM_TF_SESSION_OPEN is sent */
@@ -902,6 +905,8 @@ typedef struct tf_tbl_type_get_input {#define TF_TBL_TYPE_GET_INPUT_FLAGS_DIR_RX (0x0)/* When set to 1, indicates the get apply to TX */ #define TF_TBL_TYPE_GET_INPUT_FLAGS_DIR_TX (0x1) +/* When set to 1, indicates the clear entry on read */ +#define TF_TBL_TYPE_GET_INPUT_FLAGS_CLEAR_ON_READ (0x2)/* Type of the object to set */ uint32_t type;/* Index to get */
@@ -916,4 +921,32 @@ typedef struct tf_tbl_type_get_output { uint8_t data[TF_BULK_RECV]; } tf_tbl_type_get_output_t, *ptf_tbl_type_get_output_t; +/* Input params for table type get */ +typedef struct tf_tbl_type_get_bulk_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_GET_BULK_INPUT_FLAGS_DIR_RX (0x0) +/* When set to 1, indicates the get apply to TX */ +#define TF_TBL_TYPE_GET_BULK_INPUT_FLAGS_DIR_TX (0x1) +/* When set to 1, indicates the clear entry on read */ +#define TF_TBL_TYPE_GET_BULK_INPUT_FLAGS_CLEAR_ON_READ (0x2) +/* Type of the object to set */ +uint32_t type; +/* Starting index to get from */ +uint32_t start_index; +/* Number of entries to get */ +uint32_t num_entries; +/* Host memory where data will be stored */ +uint64_t host_addr; +}tf_tbl_type_get_bulk_input_t , *ptf_tbl_type_get_bulk_input_t ; + +/* Output params for table type get */ +typedef struct tf_tbl_type_get_bulk_output { +/* Size of the total data read in bytes */ +uint16_t size; +}tf_tbl_type_get_bulk_output_t , *ptf_tbl_type_get_bulk_output_t ; +#endif /* _HWRM_TF_H_ */
drivers/net/bnxt/tf_core/tf_common.h new file +54 -0
54 lines not on this page · raw message
drivers/net/bnxt/tf_core/tf_core.c +2 -0
@@ -16,6 +16,8 @@#include "bitalloc.h" #include "bnxt.h" #include "rand.h" +#include "tf_common.h" +#include "hwrm_tf.h" static inline uint32_t SWAP_WORDS32 (uint32_t val32) {
drivers/net/bnxt/tf_core/tf_core.h +54 -1
67 lines not on this page · raw message
drivers/net/bnxt/tf_core/tf_msg.c +54 -16
104 lines not on this page · raw message
drivers/net/bnxt/tf_core/tf_msg.h +15 -0
@@ -267,4 +267,19 @@ int tf_msg_get_tbl_entry(struct tf *tfp,uint8_t *data, uint32_t index); +/** +* Sends bulk get message of a Table Type element to the firmware. +* +* [in] tfp +* Pointer to session handle +* +* [in] parms +* Pointer to table get bulk parameters +* +* Returns: +* 0 on Success else internal Truflow error +*/ +int tf_msg_get_bulk_tbl_entry (struct tf *tfp, +struct tf_get_bulk_tbl_entry_parms *parms); +#endif /* _TF_MSG_H_ */
drivers/net/bnxt/tf_core/tf_resources.h +2 -3
@@ -149,11 +149,10 @@#define TF_RSVD_METER_INST_END_IDX_TX 0/* Mirror */ -/* Not yet supported fully in the infra */ -#define TF_RSVD_MIRROR_RX 0 +#define TF_RSVD_MIRROR_RX 1#define TF_RSVD_MIRROR_BEGIN_IDX_RX 0#define TF_RSVD_MIRROR_END_IDX_RX 0 -#define TF_RSVD_MIRROR_TX 0 +#define TF_RSVD_MIRROR_TX 1#define TF_RSVD_MIRROR_BEGIN_IDX_TX 0#define TF_RSVD_MIRROR_END_IDX_TX 0
drivers/net/bnxt/tf_core/tf_tbl.c +103 -0
133 lines not on this page · raw message
Signature · 1 line
2.21.1 (Apple Git-122.3)
PATCH v5 13/51 net/bnxt: update multi device design support
In reply to Ajit KhapardeFrom: Michael Wildt <[email protected]>
- Implement the modules RM, Device (WH+), Identifier.
- Update Session module.
- Implement new HWRMs for RM direct messaging.
- Add new parameter check macro's and clean up the header includes for i.e. tfp such that bnxt.h is not directly included in the new modules.
- Add cfa_resource_types, required for RM design.
--- drivers/net/bnxt/meson.build | 2 + drivers/net/bnxt/tf_core/Makefile | 1 + drivers/net/bnxt/tf_core/cfa_resource_types.h | 291 ++++++------ drivers/net/bnxt/tf_core/tf_common.h | 24 + drivers/net/bnxt/tf_core/tf_core.c | 286 +++++++++++- drivers/net/bnxt/tf_core/tf_core.h | 12 +- drivers/net/bnxt/tf_core/tf_device.c | 150 +++++- drivers/net/bnxt/tf_core/tf_device.h | 79 +++- drivers/net/bnxt/tf_core/tf_device_p4.c | 78 +++- drivers/net/bnxt/tf_core/tf_device_p4.h | 79 ++-- drivers/net/bnxt/tf_core/tf_identifier.c | 142 +++++- drivers/net/bnxt/tf_core/tf_identifier.h | 25 +- drivers/net/bnxt/tf_core/tf_msg.c | 268 +++++++++-- drivers/net/bnxt/tf_core/tf_msg.h | 59 +++ drivers/net/bnxt/tf_core/tf_rm_new.c | 434 ++++++++++++++++-- drivers/net/bnxt/tf_core/tf_rm_new.h | 72 ++- drivers/net/bnxt/tf_core/tf_session.c | 256 ++++++++++- drivers/net/bnxt/tf_core/tf_session.h | 118 ++++- drivers/net/bnxt/tf_core/tf_tbl.h | 4 + drivers/net/bnxt/tf_core/tf_tbl_type.c | 30 +- drivers/net/bnxt/tf_core/tf_tbl_type.h | 95 ++-- drivers/net/bnxt/tf_core/tf_tcam.h | 14 +- 22 files changed, 2120 insertions(+), 399 deletions(-)
drivers/net/bnxt/meson.build +2 -0
@@ -32,6 +32,8 @@ sources = files('bnxt_cpr.c', 'tf_core/tf_rm.c', 'tf_core/tf_tbl.c', 'tf_core/tfp.c', + 'tf_core/tf_session.c', + 'tf_core/tf_device.c', 'tf_core/tf_device_p4.c', 'tf_core/tf_identifier.c', 'tf_core/tf_shadow_tbl.c',
drivers/net/bnxt/tf_core/Makefile +1 -0
@@ -14,6 +14,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += tf_core/tfp.c SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += tf_core/tf_msg.c SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += tf_core/tf_em.c SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += tf_core/tf_tbl.c +SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += tf_core/tf_session.c SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += tf_core/tf_device.c SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += tf_core/tf_device_p4.c SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += tf_core/tf_identifier.c
drivers/net/bnxt/tf_core/cfa_resource_types.h +146 -145
361 lines not on this page · raw message
drivers/net/bnxt/tf_core/tf_common.h +24 -0
@@ -51,4 +51,28 @@ } \ } while (0) + +#define TF_CHECK_PARMS1 (parms) do { \ + if ((parms) == NULL) { \ + TFP_DRV_LOG(ERR, "Invalid Argument(s)\n"); \ + return -EINVAL; \ + } \ + } while (0) + +#define TF_CHECK_PARMS2 (parms1, parms2) do { \ + if ((parms1) == NULL || (parms2) == NULL) { \ + TFP_DRV_LOG(ERR, "Invalid Argument(s)\n"); \ + return -EINVAL; \ + } \ + } while (0) + +#define TF_CHECK_PARMS3 (parms1, parms2, parms3) do { \ + if ((parms1) == NULL || \ + (parms2) == NULL || \ + (parms3) == NULL) { \ + TFP_DRV_LOG(ERR, "Invalid Argument(s)\n"); \ + return -EINVAL; \ + } \ + } while (0) +#endif /* _TF_COMMON_H_ */
drivers/net/bnxt/tf_core/tf_core.c +278 -8
340 lines not on this page · raw message
drivers/net/bnxt/tf_core/tf_core.h +11 -1
@@ -380,7 +380,7 @@ struct tf_session_resources {* The number of identifier resources requested for the session. * The index used is tf_identifier_type. */ -uint16_t identifer_cnt[TF_DIR_MAX ][TF_IDENT_TYPE_MAX ]; +uint16_t identifier_cnt[TF_IDENT_TYPE_MAX ][TF_DIR_MAX ];/** [in] Requested Index Table resource counts * * The number of index table resources requested for the session.
@@ -480,6 +480,9 @@ struct tf_open_session_parms {int tf_open_session (struct tf *tfp,struct tf_open_session_parms *parms); +int tf_open_session_new (struct tf *tfp, +struct tf_open_session_parms *parms); +struct tf_attach_session_parms {/** [in] ctrl_chan_name *
@@ -542,6 +545,8 @@ struct tf_attach_session_parms {*/ int tf_attach_session (struct tf *tfp,struct tf_attach_session_parms *parms); +int tf_attach_session_new (struct tf *tfp, +struct tf_attach_session_parms *parms);/** * Closes an existing session. Cleans up all hardware and firmware
@@ -551,6 +556,7 @@ int tf_attach_session(struct tf *tfp,* Returns success or failure code. */ int tf_close_session (struct tf *tfp); +int tf_close_session_new (struct tf *tfp);/** * @page ident Identity Management
@@ -602,6 +608,8 @@ struct tf_free_identifier_parms {*/ int tf_alloc_identifier (struct tf *tfp,struct tf_alloc_identifier_parms *parms); +int tf_alloc_identifier_new (struct tf *tfp, +struct tf_alloc_identifier_parms *parms);/** free identifier resource *
@@ -613,6 +621,8 @@ int tf_alloc_identifier(struct tf *tfp,*/ int tf_free_identifier (struct tf *tfp,struct tf_free_identifier_parms *parms); +int tf_free_identifier_new (struct tf *tfp, +struct tf_free_identifier_parms *parms);/** * @page dram_table DRAM Table Scope Interface
drivers/net/bnxt/tf_core/tf_device.c +137 -13
182 lines not on this page · raw message
drivers/net/bnxt/tf_core/tf_device.h +62 -17
161 lines not on this page · raw message
drivers/net/bnxt/tf_core/tf_device_p4.c +73 -5
92 lines not on this page · raw message
drivers/net/bnxt/tf_core/tf_device_p4.h +48 -31
100 lines not on this page · raw message
drivers/net/bnxt/tf_core/tf_identifier.c +136 -6
178 lines not on this page · raw message
drivers/net/bnxt/tf_core/tf_identifier.h +16 -9
@@ -12,21 +12,28 @@* The Identifier module provides processing of Identifiers. */ -struct tf_ident_cfg { +struct tf_ident_cfg_parms {/** -* Number of identifier types in each of the configuration -* arrays +* [in] Number of identifier types in each of the +* configuration arrays */ uint16_t num_elements; -/** -* TCAM configuration array +* [in] Identifier configuration array +*/ +struct tf_rm_element_cfg *cfg; +/** +* [in] Boolean controlling the request shadow copy. */ -struct tf_rm_element_cfg *ident_cfg[TF_DIR_MAX ]; +bool shadow_copy; +/** +* [in] Session resource allocations +*/ +struct tf_session_resources *resources; };/** -* Identifier allcoation parameter definition +* Identifier allocation parameter definition */ struct tf_ident_alloc_parms {/**
@@ -40,7 +47,7 @@ struct tf_ident_alloc_parms {/** * [out] Identifier allocated */ -uint16_t id; +uint16_t *id; };/**
@@ -88,7 +95,7 @@ struct tf_ident_free_parms {* - (-EINVAL) on failure. */ int tf_ident_bind (struct tf *tfp, -struct tf_ident_cfg *parms); +struct tf_ident_cfg_parms *parms);/** * Cleans up the private DBs and releases all the data.
drivers/net/bnxt/tf_core/tf_msg.c +234 -34
321 lines not on this page · raw message
drivers/net/bnxt/tf_core/tf_msg.h +59 -0
73 lines not on this page · raw message
drivers/net/bnxt/tf_core/tf_rm_new.c +407 -27
487 lines not on this page · raw message
drivers/net/bnxt/tf_core/tf_rm_new.h +50 -22
187 lines not on this page · raw message
drivers/net/bnxt/tf_core/tf_session.c +248 -8
277 lines not on this page · raw message
drivers/net/bnxt/tf_core/tf_session.h +107 -11
99 lines not on this page · raw message
drivers/net/bnxt/tf_core/tf_tbl_type.c +15 -15
Lines of this file are not shown. View the raw message.
drivers/net/bnxt/tf_core/tf_tbl_type.h +52 -43
95 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 1 line
2.21.1 (Apple Git-122.3)
Part of the diff is not shown here. View the raw message.
PATCH v5 14/51 net/bnxt: support two-level priority for TCAMs
In reply to Ajit KhapardeFrom: Shahaji Bhosle <[email protected]>
Allow TCAM indexes to be allocated from top or bottom. If the priority is set to 0, allocate from the lowest tcam indexes i.e. from top. Any other value, allocate it from the highest tcam indexes i.e. from bottom.
--- drivers/net/bnxt/tf_core/tf_core.c | 36 ++++++++++++++++++++++++------ drivers/net/bnxt/tf_core/tf_core.h | 4 +++- drivers/net/bnxt/tf_core/tf_em.c | 6 ++--- drivers/net/bnxt/tf_core/tf_tbl.c | 2 +- 4 files changed, 35 insertions(+), 13 deletions(-)
drivers/net/bnxt/tf_core/tf_core.c +29 -7
@@ -893,7 +893,7 @@ tf_alloc_tcam_entry(struct tf *tfp, struct tf_alloc_tcam_entry_parms *parms) {int rc; -int index; +int index =0 ;struct tf_session *tfs;struct bitalloc *session_pool;
@@ -916,12 +916,34 @@ tf_alloc_tcam_entry(struct tf *tfp,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 ; +/* +* priority 0: allocate from top of the tcam i.e. high +* priority !0: allocate index from bottom i.e lowest +*/ +if (parms->priority) { +for (index = session_pool->size -1 ; index >=0 ; index--) { +if (ba_inuse (session_pool, + index) ==BA_ENTRY_FREE ) { +break ; + } + } +if (ba_alloc_index (session_pool, + index) ==BA_FAIL ) { +TFP_DRV_LOG (ERR , +"%s: %s: ba_alloc index %d failed\n" , +tf_dir_2_str (parms->dir), +tf_tcam_tbl_2_str (parms->tcam_tbl_type), + index); +return -ENOMEM ; + } + }else { + index =ba_alloc (session_pool); +if (index ==BA_FAIL ) { +TFP_DRV_LOG (ERR ,"%s: %s: Out of resource\n" , +tf_dir_2_str (parms->dir), +tf_tcam_tbl_2_str (parms->tcam_tbl_type)); +return -ENOMEM ; + } } parms->idx = index;
drivers/net/bnxt/tf_core/tf_core.h +3 -1
@@ -799,7 +799,9 @@ struct tf_alloc_tcam_entry_parms {*/ uint8_t *mask;/** -* [in] Priority of entry requested (definition TBD) +* [in] Priority of entry requested +* 0: index from top i.e. highest priority first +* !0: index from bottom i.e lowest priority first */ uint32_t priority;/**
drivers/net/bnxt/tf_core/tf_em.c +2 -4
@@ -479,8 +479,7 @@ int tf_insert_em_internal_entry(struct tf *tfp, rc =stack_pop (pool, &index);if (rc !=0 ) { -PMD_DRV_LOG - (ERR , +TFP_DRV_LOG (ERR ,"dir:%d, EM entry index allocation failed\n" , parms->dir);return rc;
@@ -495,8 +494,7 @@ int tf_insert_em_internal_entry(struct tf *tfp,if (rc !=0 )return -1 ; -PMD_DRV_LOG - (ERR, + TFP_DRV_LOG(INFO, "Internal entry @ Index:%d rptr_index:0x%x rptr_entry:0x%x num_of_entries:%d\n", index * TF_SESSION_EM_ENTRY_SIZE, rptr_index,
drivers/net/bnxt/tf_core/tf_tbl.c +1 -1
@@ -1967,7 +1967,7 @@ void tf_dump_dma(struct tf *tfp, uint32_t tbl_scope_id) tbl_scope_cb =tbl_scope_cb_find (session, tbl_scope_id);if (tbl_scope_cb ==NULL ) -PMD_DRV_LOG (ERR ,"No table scope\n" ); +TFP_DRV_LOG (ERR ,"No table scope\n" );for (dir =0 ; dir <TF_DIR_MAX ; dir++) {printf ("Direction %s:\n" , (dir ==TF_DIR_RX ?"Rx" :"Tx" ));
Signature · 1 line
2.21.1 (Apple Git-122.3)
PATCH v5 15/51 net/bnxt: add HCAPI interface support
In reply to Ajit KhapardeFrom: Peter Spreadborough <[email protected]>
Add new hardware shim APIs to support multiple
device generations
--- drivers/net/bnxt/hcapi/Makefile | 10 + drivers/net/bnxt/hcapi/hcapi_cfa.h | 271 +++++++++ drivers/net/bnxt/hcapi/hcapi_cfa_common.c | 92 +++ drivers/net/bnxt/hcapi/hcapi_cfa_defs.h | 672 ++++++++++++++++++++++ drivers/net/bnxt/hcapi/hcapi_cfa_p4.c | 399 +++++++++++++ drivers/net/bnxt/hcapi/hcapi_cfa_p4.h | 451 +++++++++++++++ drivers/net/bnxt/meson.build | 2 + drivers/net/bnxt/tf_core/tf_em.c | 28 +- drivers/net/bnxt/tf_core/tf_tbl.c | 94 +-- drivers/net/bnxt/tf_core/tf_tbl.h | 24 +- 10 files changed, 1970 insertions(+), 73 deletions(-) create mode 100644 drivers/net/bnxt/hcapi/Makefile create mode 100644 drivers/net/bnxt/hcapi/hcapi_cfa.h create mode 100644 drivers/net/bnxt/hcapi/hcapi_cfa_common.c create mode 100644 drivers/net/bnxt/hcapi/hcapi_cfa_defs.h create mode 100644 drivers/net/bnxt/hcapi/hcapi_cfa_p4.c create mode 100644 drivers/net/bnxt/hcapi/hcapi_cfa_p4.h
drivers/net/bnxt/hcapi/Makefile new file +10 -0
@@ -0,0 +1,10 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright(c) 2019-2020 Broadcom Limited. +# All rights reserved. + +SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += hcapi/hcapi_cfa_p4.c + +SYMLINK-$(CONFIG_RTE_LIBRTE_BNXT_PMD)-include += hcapi/hcapi_cfa.h +SYMLINK-$(CONFIG_RTE_LIBRTE_BNXT_PMD)-include += hcapi/hcapi_cfa_defs.h +SYMLINK-$(CONFIG_RTE_LIBRTE_BNXT_PMD)-include += hcapi/hcapi_cfa_p4.h +SYMLINK-$(CONFIG_RTE_LIBRTE_BNXT_PMD)-include += hcapi/cfa_p40_hw.h
drivers/net/bnxt/hcapi/hcapi_cfa.h new file +271 -0
271 lines not on this page · raw message
drivers/net/bnxt/hcapi/hcapi_cfa_common.c new file +92 -0
92 lines not on this page · raw message
drivers/net/bnxt/hcapi/hcapi_cfa_defs.h new file +672 -0
672 lines not on this page · raw message
drivers/net/bnxt/hcapi/hcapi_cfa_p4.c new file +399 -0
399 lines not on this page · raw message
drivers/net/bnxt/hcapi/hcapi_cfa_p4.h new file +451 -0
451 lines not on this page · raw message
drivers/net/bnxt/meson.build +2 -0
@@ -43,6 +43,8 @@ sources = files('bnxt_cpr.c', 'tf_core/tf_util.c', 'tf_core/tf_rm_new.c', + 'hcapi/hcapi_cfa_p4.c', + 'tf_ulp/bnxt_ulp.c', 'tf_ulp/ulp_mark_mgr.c', 'tf_ulp/ulp_flow_db.c',
drivers/net/bnxt/tf_core/tf_em.c +14 -14
@@ -189,7 +189,7 @@ void *tf_em_get_table_page(struct tf_tbl_scope_cb *tbl_scope_cb,if (dir !=TF_DIR_RX && dir !=TF_DIR_TX )return NULL ; -if (table_type <KEY0_TABLE || table_type >EFC_TABLE ) +if (table_type <TF_KEY0_TABLE || table_type >TF_EFC_TABLE )return NULL ;/*
@@ -325,7 +325,7 @@ static int tf_em_select_inject_table(struct tf_tbl_scope_cb *tbl_scope_cb, key0_entry =tf_em_entry_exists (tbl_scope_cb, entry, key0_hash, -KEY0_TABLE , +TF_KEY0_TABLE , dir);/*
@@ -334,23 +334,23 @@ static int tf_em_select_inject_table(struct tf_tbl_scope_cb *tbl_scope_cb, key1_entry =tf_em_entry_exists (tbl_scope_cb, entry, key1_hash, -KEY1_TABLE , +TF_KEY1_TABLE , dir);if (key0_entry == -EEXIST ) { - *table =KEY0_TABLE ; + *table =TF_KEY0_TABLE ; *index = key0_hash;return -EEXIST ; }else if (key1_entry == -EEXIST ) { - *table =KEY1_TABLE ; + *table =TF_KEY1_TABLE ; *index = key1_hash;return -EEXIST ; }else if (key0_entry ==0 ) { - *table =KEY0_TABLE ; + *table =TF_KEY0_TABLE ; *index = key0_hash;return 0 ; }else if (key1_entry ==0 ) { - *table =KEY1_TABLE ; + *table =TF_KEY1_TABLE ; *index = key1_hash;return 0 ; }
@@ -384,7 +384,7 @@ int tf_insert_eem_entry(struct tf_session *session,int num_of_entry;/* Get mask to use on hash */ - mask =tf_em_get_key_mask (tbl_scope_cb->em_ctx_info[parms->dir].em_tables[KEY0_TABLE ].num_entries); + mask =tf_em_get_key_mask (tbl_scope_cb->em_ctx_info[parms->dir].em_tables[TF_KEY0_TABLE ].num_entries);if (!mask)return -EINVAL ;
@@ -392,13 +392,13 @@ int tf_insert_eem_entry(struct tf_session *session, num_of_entry =TF_HW_EM_KEY_MAX_SIZE +4 ; key0_hash =tf_em_lkup_get_crc32_hash (session, - &parms->key[num_of_entry] -1 , - parms->dir); + &parms->key[num_of_entry] -1 , + parms->dir); key0_index = key0_hash & mask; key1_hash =tf_em_lkup_get_lookup3_hash (session->lkup_lkup3_init_cfg[parms->dir], - parms->key); + parms->key); key1_index = key1_hash & mask;/*
@@ -420,14 +420,14 @@ int tf_insert_eem_entry(struct tf_session *session, key1_index, &index, &table_type) == 0) { -if (table_type ==KEY0_TABLE ) { +if (table_type ==TF_KEY0_TABLE ) {TF_SET_GFID (gfid, key0_index, -KEY0_TABLE ); +TF_KEY0_TABLE ); }else {TF_SET_GFID (gfid, key1_index, -KEY1_TABLE ); +TF_KEY1_TABLE ); }/*
drivers/net/bnxt/tf_core/tf_tbl.c +47 -47
195 lines not on this page · raw message
drivers/net/bnxt/tf_core/tf_tbl.h +12 -12
@@ -14,18 +14,18 @@struct tf_session ;enum tf_pg_tbl_lvl { -PT_LVL_0 , -PT_LVL_1 , -PT_LVL_2 , -PT_LVL_MAX +TF_PT_LVL_0 , +TF_PT_LVL_1 , +TF_PT_LVL_2 , +TF_PT_LVL_MAX };enum tf_em_table_type { -KEY0_TABLE , -KEY1_TABLE , -RECORD_TABLE , -EFC_TABLE , -MAX_TABLE +TF_KEY0_TABLE , +TF_KEY1_TABLE , +TF_RECORD_TABLE , +TF_EFC_TABLE , +TF_MAX_TABLE };struct tf_em_page_tbl {
@@ -41,15 +41,15 @@ struct tf_em_table {uint16_t ctx_id;uint32_t entry_size;int num_lvl; -uint32_t page_cnt[PT_LVL_MAX ]; +uint32_t page_cnt[TF_PT_LVL_MAX ];uint64_t num_data_pages;void *l0_addr;uint64_t l0_dma_addr; -struct tf_em_page_tbl pg_tbl[PT_LVL_MAX ]; +struct tf_em_page_tbl pg_tbl[TF_PT_LVL_MAX ]; };struct tf_em_ctx_mem_info { -struct tf_em_table em_tables[MAX_TABLE ]; +struct tf_em_table em_tables[TF_MAX_TABLE ]; };/** table scope control block content */
Signature · 1 line
2.21.1 (Apple Git-122.3)
Re: [dpdk-dev] [PATCH v5 15/51] net/bnxt: add HCAPI interface support
Quoted 34 lines · Ajit Khaparde
From: Peter Spreadborough <[email protected]>
Add new hardware shim APIs to support multiple
device generationsSigned-off-by Peter Spreadborough <[email protected]>Signed-off-by Venkat Duvvuru <[email protected]>Reviewed-by Randy Schacher <[email protected]>Reviewed-by Ajit Khaparde <[email protected]>--- drivers/net/bnxt/hcapi/Makefile | 10 + drivers/net/bnxt/hcapi/hcapi_cfa.h | 271 +++++++++ drivers/net/bnxt/hcapi/hcapi_cfa_common.c | 92 +++ drivers/net/bnxt/hcapi/hcapi_cfa_defs.h | 672 ++++++++++++++++++++++ drivers/net/bnxt/hcapi/hcapi_cfa_p4.c | 399 +++++++++++++ drivers/net/bnxt/hcapi/hcapi_cfa_p4.h | 451 +++++++++++++++ drivers/net/bnxt/meson.build | 2 + drivers/net/bnxt/tf_core/tf_em.c | 28 +- drivers/net/bnxt/tf_core/tf_tbl.c | 94 +-- drivers/net/bnxt/tf_core/tf_tbl.h | 24 +- 10 files changed, 1970 insertions(+), 73 deletions(-) create mode 100644 drivers/net/bnxt/hcapi/Makefile create mode 100644 drivers/net/bnxt/hcapi/hcapi_cfa.h create mode 100644 drivers/net/bnxt/hcapi/hcapi_cfa_common.c create mode 100644 drivers/net/bnxt/hcapi/hcapi_cfa_defs.h create mode 100644 drivers/net/bnxt/hcapi/hcapi_cfa_p4.c create mode 100644 drivers/net/bnxt/hcapi/hcapi_cfa_p4.hdrivers/net/bnxt/hcapi/Makefile new file +0
-0
drivers/net/bnxt/hcapi/Makefile line 10
Quoted 10 lines
drivers/net/bnxt/hcapi/Makefile new file +10
-0@@ -0,0 +1,10 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright(c) 2019-2020 Broadcom Limited. +# All rights reserved. + +SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += hcapi/hcapi_cfa_p4.c + +SYMLINK-$(CONFIG_RTE_LIBRTE_BNXT_PMD)-include += hcapi/hcapi_cfa.h +SYMLINK-$(CONFIG_RTE_LIBRTE_BNXT_PMD)-include += hcapi/hcapi_cfa_defs.h +SYMLINK-$(CONFIG_RTE_LIBRTE_BNXT_PMD)-include += hcapi/hcapi_cfa_p4.h +SYMLINK-$(CONFIG_RTE_LIBRTE_BNXT_PMD)-include += hcapi/cfa_p40_hw.h
Why PMD header files added to install?
They should not accessed by the application, so they should not installed.
I will try to remove them.
PATCH v5 16/51 net/bnxt: add core changes for EM and EEM lookups
In reply to Ajit KhapardeFrom: Randy Schacher <[email protected]>
- Move External Exact and Exact Match to device module using HCAPI to add and delete entries
- Make EM active through the device interface.
--- drivers/net/bnxt/Makefile | 3 +- drivers/net/bnxt/hcapi/cfa_p40_hw.h | 781 ++++++++++++++++++++++ drivers/net/bnxt/hcapi/hcapi_cfa_common.c | 92 --- drivers/net/bnxt/hcapi/hcapi_cfa_p4.c | 2 +- drivers/net/bnxt/tf_core/Makefile | 8 + drivers/net/bnxt/tf_core/hwrm_tf.h | 24 +- drivers/net/bnxt/tf_core/tf_core.c | 441 ++++++------ drivers/net/bnxt/tf_core/tf_core.h | 141 ++-- drivers/net/bnxt/tf_core/tf_device.h | 32 + drivers/net/bnxt/tf_core/tf_device_p4.c | 3 + drivers/net/bnxt/tf_core/tf_em.c | 567 +++++----------- drivers/net/bnxt/tf_core/tf_em.h | 72 +- drivers/net/bnxt/tf_core/tf_msg.c | 23 +- drivers/net/bnxt/tf_core/tf_msg.h | 4 +- drivers/net/bnxt/tf_core/tf_resources.h | 25 +- drivers/net/bnxt/tf_core/tf_rm.c | 156 +++-- drivers/net/bnxt/tf_core/tf_tbl.c | 437 +++++------- drivers/net/bnxt/tf_core/tf_tbl.h | 49 +- 18 files changed, 1627 insertions(+), 1233 deletions(-) create mode 100644 drivers/net/bnxt/hcapi/cfa_p40_hw.h delete mode 100644 drivers/net/bnxt/hcapi/hcapi_cfa_common.c
drivers/net/bnxt/Makefile +2 -1
@@ -46,9 +46,10 @@ 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_ulp -I$(SRCDIR)/tf_core +CFLAGS += -I$(SRCDIR) -I$(SRCDIR)/tf_ulp -I$(SRCDIR)/tf_core -I$(SRCDIR)/hcapi include $(SRCDIR)/tf_ulp/Makefile include $(SRCDIR)/tf_core/Makefile +include $(SRCDIR)/hcapi/Makefile endif #
drivers/net/bnxt/hcapi/cfa_p40_hw.h new file +781 -0
781 lines not on this page · raw message
drivers/net/bnxt/hcapi/hcapi_cfa_common.c deleted +0 -92
92 lines not on this page · raw message
drivers/net/bnxt/hcapi/hcapi_cfa_p4.c +1 -1
@@ -2,7 +2,7 @@* Copyright(c) 2019-2020 Broadcom * All rights reserved. */ - +#include <inttypes.h> #include <stdint.h> #include <stdlib.h> #include <stdbool.h>
drivers/net/bnxt/tf_core/Makefile +8 -0
@@ -24,3 +24,11 @@ SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += tf_core/tf_tbl_type.c SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += tf_core/tf_tcam.c SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += tf_core/tf_util.c SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += tf_core/tf_rm_new.c + +SYMLINK-$(CONFIG_RTE_LIBRTE_BNXT_PMD)-include += tf_core/tf_core.h +SYMLINK-$(CONFIG_RTE_LIBRTE_BNXT_PMD)-include += tf_core/tf_project.h +SYMLINK-$(CONFIG_RTE_LIBRTE_BNXT_PMD)-include += tf_core/tf_device.h +SYMLINK-$(CONFIG_RTE_LIBRTE_BNXT_PMD)-include += tf_core/tf_identifier.h +SYMLINK-$(CONFIG_RTE_LIBRTE_BNXT_PMD)-include += tf_core/tf_tbl.h +SYMLINK-$(CONFIG_RTE_LIBRTE_BNXT_PMD)-include += tf_core/stack.h +SYMLINK-$(CONFIG_RTE_LIBRTE_BNXT_PMD)-include += tf_core/tf_tcam.h
drivers/net/bnxt/tf_core/hwrm_tf.h +11 -13
@@ -27,8 +27,8 @@ typedef enum tf_subtype {HWRM_TFT_REG_SET =822 ,HWRM_TFT_TBL_TYPE_SET =823 ,HWRM_TFT_TBL_TYPE_GET =824 , -HWRM_TFT_TBL_TYPE_GET_BULK =825 , -TF_SUBTYPE_LAST =HWRM_TFT_TBL_TYPE_GET_BULK , +HWRM_TFT_TBL_TYPE_BULK_GET =825 , +TF_SUBTYPE_LAST =HWRM_TFT_TBL_TYPE_BULK_GET , } tf_subtype_t;/* Request and Response compile time checking */
@@ -82,8 +82,8 @@ struct tf_session_sram_resc_flush_input;struct tf_tbl_type_set_input ;struct tf_tbl_type_get_input ;struct tf_tbl_type_get_output ; -struct tf_tbl_type_get_bulk_input ; -struct tf_tbl_type_get_bulk_output ; +struct tf_tbl_type_bulk_get_input ; +struct tf_tbl_type_bulk_get_output ;/* Input params for session attach */ typedef struct tf_session_attach_input { /* Firmware session id returned when HWRM_TF_SESSION_OPEN is sent */
@@ -905,8 +905,6 @@ typedef struct tf_tbl_type_get_input {#define TF_TBL_TYPE_GET_INPUT_FLAGS_DIR_RX (0x0)/* When set to 1, indicates the get apply to TX */ #define TF_TBL_TYPE_GET_INPUT_FLAGS_DIR_TX (0x1) -/* When set to 1, indicates the clear entry on read */ -#define TF_TBL_TYPE_GET_INPUT_FLAGS_CLEAR_ON_READ (0x2)/* Type of the object to set */ uint32_t type;/* Index to get */
@@ -922,17 +920,17 @@ typedef struct tf_tbl_type_get_output { } tf_tbl_type_get_output_t, *ptf_tbl_type_get_output_t;/* Input params for table type get */ -typedef struct tf_tbl_type_get_bulk_input { +typedef struct tf_tbl_type_bulk_get_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_GET_BULK_INPUT_FLAGS_DIR_RX (0x0) +#define TF_TBL_TYPE_BULK_GET_INPUT_FLAGS_DIR_RX (0x0) /* When set to 1, indicates the get apply to TX */ -#define TF_TBL_TYPE_GET_BULK_INPUT_FLAGS_DIR_TX (0x1) +#define TF_TBL_TYPE_BULK_GET_INPUT_FLAGS_DIR_TX (0x1) /* When set to 1, indicates the clear entry on read */ -#define TF_TBL_TYPE_GET_BULK_INPUT_FLAGS_CLEAR_ON_READ (0x2) +#define TF_TBL_TYPE_BULK_GET_INPUT_FLAGS_CLEAR_ON_READ (0x2) /* Type of the object to set */ uint32_t type; /* Starting index to get from */
@@ -941,12 +939,12 @@ typedef struct tf_tbl_type_get_bulk_input {uint32_t num_entries;/* Host memory where data will be stored */ uint64_t host_addr; -} tf_tbl_type_get_bulk_input_t, *ptf_tbl_type_get_bulk_input_t; +} tf_tbl_type_bulk_get_input_t, *ptf_tbl_type_bulk_get_input_t;/* Output params for table type get */ -typedef struct tf_tbl_type_get_bulk_output { +typedef struct tf_tbl_type_bulk_get_output {/* Size of the total data read in bytes */ uint16_t size; -}tf_tbl_type_get_bulk_output_t , *ptf_tbl_type_get_bulk_output_t ; +}tf_tbl_type_bulk_get_output_t , *ptf_tbl_type_bulk_get_output_t ;#endif /* _HWRM_TF_H_ */
drivers/net/bnxt/tf_core/tf_core.c +229 -212
712 lines not on this page · raw message
drivers/net/bnxt/tf_core/tf_core.h +84 -57
427 lines not on this page · raw message
drivers/net/bnxt/tf_core/tf_device.h +32 -0
@@ -366,6 +366,38 @@ struct tf_dev_ops {*/ int (*tf_dev_get_tcam)(struct tf *tfp,struct tf_tcam_get_parms *parms); + +/** +* Insert EM hash entry API +* +* [in] tfp +* Pointer to TF handle +* +* [in] parms +* Pointer to E/EM insert parameters +* +* Returns: +* 0 - Success +* -EINVAL - Error +*/ +int (*tf_dev_insert_em_entry)(struct tf *tfp, +struct tf_insert_em_entry_parms *parms); + +/** +* Delete EM hash entry API +* +* [in] tfp +* Pointer to TF handle +* +* [in] parms +* Pointer to E/EM delete parameters +* +* returns: +* 0 - Success +* -EINVAL - Error +*/ +int (*tf_dev_delete_em_entry)(struct tf *tfp, +struct tf_delete_em_entry_parms *parms); };/**
drivers/net/bnxt/tf_core/tf_device_p4.c +3 -0
@@ -10,6 +10,7 @@#include "tf_identifier.h" #include "tf_tbl_type.h" #include "tf_tcam.h" +#include "tf_em.h" /** * Device specific function that retrieves the MAX number of HCAPI
@@ -89,4 +90,6 @@ const struct tf_dev_ops tf_dev_ops_p4 = { .tf_dev_alloc_search_tcam = tf_tcam_alloc_search, .tf_dev_set_tcam = tf_tcam_set, .tf_dev_get_tcam = tf_tcam_get, + .tf_dev_insert_em_entry = tf_em_insert_entry, + .tf_dev_delete_em_entry = tf_em_delete_entry, };
drivers/net/bnxt/tf_core/tf_em.c +162 -405
660 lines not on this page · raw message
drivers/net/bnxt/tf_core/tf_em.h +15 -57
99 lines not on this page · raw message
drivers/net/bnxt/tf_core/tf_msg.c +13 -10
@@ -183,6 +183,10 @@ tf_msg_free_dma_buf(struct tf_msg_dma_buf *buf)tfp_free (buf->va_addr); } +/** +* NEW HWRM direct messages +*/ +/** * Sends session open request to TF Firmware */
@@ -1259,8 +1263,9 @@ int tf_msg_insert_em_internal_entry(struct tf *tfp, HWRM_TF_EM_INSERT_INPUT_FLAGS_DIR_TX : HWRM_TF_EM_INSERT_INPUT_FLAGS_DIR_RX); req.flags =tfp_cpu_to_le_16 (flags); - req.strength = (em_result->hdr.word1 &TF_LKUP_RECORD_STRENGTH_MASK ) >> -TF_LKUP_RECORD_STRENGTH_SHIFT ; + req.strength = + (em_result->hdr.word1 &CFA_P4_EEM_ENTRY_STRENGTH_MASK ) >> +CFA_P4_EEM_ENTRY_STRENGTH_SHIFT ; req.em_key_bitlen = em_parms->key_sz_in_bits; req.action_ptr = em_result->hdr.pointer; req.em_record_idx = *rptr_index;
@@ -1436,22 +1441,20 @@ tf_msg_get_tbl_entry(struct tf *tfp, }int -tf_msg_get_bulk_tbl_entry (struct tf *tfp, -struct tf_get_bulk_tbl_entry_parms *params) +tf_msg_bulk_get_tbl_entry (struct tf *tfp, +struct tf_bulk_get_tbl_entry_parms *params) {int rc;struct tfp_send_msg_parms parms = {0 }; -struct tf_tbl_type_get_bulk_input req = {0 }; -struct tf_tbl_type_get_bulk_output resp = {0 }; +struct tf_tbl_type_bulk_get_input req = {0 }; +struct tf_tbl_type_bulk_get_output resp = {0 };struct tf_session *tfs = (struct tf_session *)(tfp->session->core_data);int data_size =0 ;/* Populate the request */ req.fw_session_id =tfp_cpu_to_le_32 (tfs->session_id.internal.fw_session_id); - req.flags =tfp_cpu_to_le_16 ((params->dir) | - ((params->clear_on_read) ? -TF_TBL_TYPE_GET_BULK_INPUT_FLAGS_CLEAR_ON_READ :0x0 )); + req.flags =tfp_cpu_to_le_16 (params->dir); req.type =tfp_cpu_to_le_32 (params->type); req.start_index =tfp_cpu_to_le_32 (params->starting_idx); req.num_entries =tfp_cpu_to_le_32 (params->num_entries);
@@ -1462,7 +1465,7 @@ tf_msg_get_bulk_tbl_entry(struct tf *tfp,MSG_PREP (parms,TF_KONG_MB ,HWRM_TF , -HWRM_TFT_TBL_TYPE_GET_BULK , +HWRM_TFT_TBL_TYPE_BULK_GET , req, resp);
drivers/net/bnxt/tf_core/tf_msg.h +2 -2
@@ -338,7 +338,7 @@ int tf_msg_get_tbl_entry(struct tf *tfp,* Returns: * 0 on Success else internal Truflow error */ -int tf_msg_get_bulk_tbl_entry (struct tf *tfp, -struct tf_get_bulk_tbl_entry_parms *parms); +int tf_msg_bulk_get_tbl_entry (struct tf *tfp, +struct tf_bulk_get_tbl_entry_parms *parms);#endif /* _TF_MSG_H_ */
drivers/net/bnxt/tf_core/tf_resources.h +12 -13
@@ -23,29 +23,27 @@* IDs */ #define TF_NUM_WC_PROF_ID 256/* < Number WC profile IDs */ -#define TF_NUM_WC_TCAM_ROW 256/* Number slices per row in WC -* TCAM. A slices is a WC TCAM entry. -*/ +#define TF_NUM_WC_TCAM_ROW 512/* < Number of rows in WC TCAM */ #define TF_NUM_METER_PROF 256/* < Number of meter profiles */ #define TF_NUM_METER 1024/* < Number of meter instances */ #define TF_NUM_MIRROR 2/* < Number of mirror instances */ #define TF_NUM_UPAR 2/* < Number of UPAR instances */ -/* Wh+/Brd2 specific HW resources */ +/* Wh+/SR specific HW resources */ #define TF_NUM_SP_TCAM 512/* < Number of Source Property TCAM * entries */ -/* Brd2/Brd4 specific HW resources */
Lines of this file are not shown. View the raw message.
drivers/net/bnxt/tf_core/tf_rm.c +88 -68
156 lines not on this page · raw message
drivers/net/bnxt/tf_core/tf_tbl.c +181 -256
437 lines not on this page · raw message
drivers/net/bnxt/tf_core/tf_tbl.h +3 -46
49 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 1 line
2.21.1 (Apple Git-122.3)
Part of the diff is not shown here. View the raw message.
Re: [dpdk-dev] [PATCH v5 16/51] net/bnxt: add core changes for EM and EEM lookups
Quoted 10 lines · Ajit Khaparde
From: Randy Schacher <[email protected]>
- Move External Exact and Exact Match to device module using HCAPI to add and delete entries
- Make EM active through the device interface.Signed-off-by Randy Schacher <[email protected]>Signed-off-by Venkat Duvvuru <[email protected]>Reviewed-by Shahaji Bhosle <[email protected]>Reviewed-by Ajit Khaparde <[email protected]>
<...>
Quoted 6 lines
drivers/net/bnxt/tf_core/Makefile +0
-0@@ -24,3 +24,11 @@ SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += tf_core/tf_tbl_type.c SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += tf_core/tf_tcam.c
drivers/net/bnxt/tf_core/Makefile SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += tf_core/tf_tbl_type.c · line 34
Quoted 10 lines
drivers/net/bnxt/tf_core/Makefile +8
-0SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += tf_core/tf_util.c SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += tf_core/tf_rm_new.c + +SYMLINK-$(CONFIG_RTE_LIBRTE_BNXT_PMD)-include += tf_core/tf_core.h +SYMLINK-$(CONFIG_RTE_LIBRTE_BNXT_PMD)-include += tf_core/tf_project.h +SYMLINK-$(CONFIG_RTE_LIBRTE_BNXT_PMD)-include += tf_core/tf_device.h +SYMLINK-$(CONFIG_RTE_LIBRTE_BNXT_PMD)-include += tf_core/tf_identifier.h +SYMLINK-$(CONFIG_RTE_LIBRTE_BNXT_PMD)-include += tf_core/tf_tbl.h +SYMLINK-$(CONFIG_RTE_LIBRTE_BNXT_PMD)-include += tf_core/stack.h +SYMLINK-$(CONFIG_RTE_LIBRTE_BNXT_PMD)-include += tf_core/tf_tcam.h
Same comment here, these header files should keep PMD local and shouldn't installed. Installing a header file as generic as "stack.h" is breaking some sample apps but anyway I assume these are added by mistake and I will drop them.
PATCH v5 17/51 net/bnxt: implement support for TCAM access
In reply to Ajit KhapardeFrom: Jay Ding <[email protected]>
Implement TCAM alloc, free, bind, and unbind functions Update tf_core, tf_msg, etc.
--- drivers/net/bnxt/tf_core/tf_core.c | 258 ++++++++++----------- drivers/net/bnxt/tf_core/tf_device.h | 14 +- drivers/net/bnxt/tf_core/tf_device_p4.c | 25 ++- drivers/net/bnxt/tf_core/tf_msg.c | 31 +-- drivers/net/bnxt/tf_core/tf_msg.h | 4 +- drivers/net/bnxt/tf_core/tf_tcam.c | 285 +++++++++++++++++++++++- drivers/net/bnxt/tf_core/tf_tcam.h | 66 ++++-- 7 files changed, 480 insertions(+), 203 deletions(-)
drivers/net/bnxt/tf_core/tf_core.c +113 -145
@@ -19,43 +19,6 @@#include "tf_common.h" #include "hwrm_tf.h" -static int tf_check_tcam_entry (enum tf_tcam_tbl_type tcam_tbl_type, -enum tf_device_type device, -uint16_t key_sz_in_bits, -uint16_t *num_slice_per_row) -{ -uint16_t key_bytes; -uint16_t slice_sz =0 ; - -#define CFA_P4_WC_TCAM_SLICES_PER_ROW 2 -#define CFA_P4_WC_TCAM_SLICE_SIZE 12 - -if (tcam_tbl_type ==TF_TCAM_TBL_TYPE_WC_TCAM ) { - key_bytes =TF_BITS2BYTES_WORD_ALIGN (key_sz_in_bits); -if (device ==TF_DEVICE_TYPE_WH ) { - slice_sz =CFA_P4_WC_TCAM_SLICE_SIZE ; - *num_slice_per_row =CFA_P4_WC_TCAM_SLICES_PER_ROW ; - }else { -TFP_DRV_LOG (ERR , -"Unsupported device type %d\n" , - device); -return -ENOTSUP ; - } - -if (key_bytes > *num_slice_per_row * slice_sz) { -TFP_DRV_LOG (ERR , -"%s: Key size %d is not supported\n" , -tf_tcam_tbl_2_str (tcam_tbl_type), - key_bytes); -return -ENOTSUP ; - } - }else {/* for other type of tcam */ - *num_slice_per_row =1 ; - } - -return 0 ; -} -/** * Create EM Tbl pool of memory indexes. *
@@ -918,49 +881,56 @@ 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; -uint16_t num_slice_per_row; - -/* TEMP, due to device design. When tcam is modularized device -* should be retrieved from the session -*/ -enum tf_device_type device_type; -/* TEMP */ - device_type =TF_DEVICE_TYPE_WH ; +struct tf_dev_info *dev; +struct tf_tcam_alloc_parms aparms = {0 }; -TF_CHECK_PARMS_SESSION (tfp, parms); +TF_CHECK_PARMS2 (tfp, parms); - tfs = (struct tf_session *)(tfp->session->core_data); +/* Retrieve the session information */ + rc =tf_session_get_session (tfp, &tfs); +if (rc) { +TFP_DRV_LOG (ERR , +"%s: Failed to lookup session, rc:%s\n" , +tf_dir_2_str (parms->dir), +strerror (-rc)); +return rc; + } - rc =tf_check_tcam_entry (parms->tcam_tbl_type, - device_type, - parms->key_sz_in_bits, - &num_slice_per_row); -/* Error logging handled by tf_check_tcam_entry */ -if (rc) +/* Retrieve the device information */ + rc =tf_session_get_device (tfs, &dev); +if (rc) { +TFP_DRV_LOG (ERR , +"%s: Failed to lookup device, rc:%s\n" , +tf_dir_2_str (parms->dir), +strerror (-rc));return rc; + } - 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) +if (dev->ops->tf_dev_alloc_tcam ==NULL ) { + rc = -EOPNOTSUPP ; +TFP_DRV_LOG (ERR , +"%s: Operation not supported, rc:%s\n" , +tf_dir_2_str (parms->dir), +strerror (-rc));return rc; + } - index =ba_alloc (session_pool); -if (index ==BA_FAIL ) { -TFP_DRV_LOG (ERR ,"%s: %s: No resource available\n" , + aparms.dir = parms->dir; + aparms.type = parms->tcam_tbl_type; + aparms.key_size =TF_BITS2BYTES_WORD_ALIGN (parms->key_sz_in_bits); + aparms.priority = parms->priority; + rc = dev->ops->tf_dev_alloc_tcam (tfp, &aparms); +if (rc) { +TFP_DRV_LOG (ERR , +"%s: TCAM allocation failed, rc:%s\n" ,tf_dir_2_str (parms->dir), -tf_tcam_tbl_2_str (parms->tcam_tbl_type)); -return -ENOMEM ; +strerror (-rc)); +return rc; } - index *= num_slice_per_row; + parms->idx = aparms.idx; - parms->idx = index;return 0 ; }
@@ -969,55 +939,60 @@ tf_set_tcam_entry(struct tf *tfp, struct tf_set_tcam_entry_parms *parms) {int rc; -int id; -int index;struct tf_session *tfs; -struct bitalloc *session_pool; -uint16_t num_slice_per_row; - -/* TEMP, due to device design. When tcam is modularized device -* should be retrieved from the session -*/ -enum tf_device_type device_type; -/* TEMP */ - device_type =TF_DEVICE_TYPE_WH ; +struct tf_dev_info *dev; +struct tf_tcam_set_parms sparms = {0 }; -TF_CHECK_PARMS_SESSION (tfp, parms); +TF_CHECK_PARMS2 (tfp, parms); - tfs = (struct tf_session *)(tfp->session->core_data); +/* Retrieve the session information */ + rc =tf_session_get_session (tfp, &tfs); +if (rc) { +TFP_DRV_LOG (ERR , +"%s: Failed to lookup session, rc:%s\n" , +tf_dir_2_str (parms->dir), +strerror (-rc)); +return rc; + } - rc =tf_check_tcam_entry (parms->tcam_tbl_type, - device_type, - parms->key_sz_in_bits, - &num_slice_per_row); -/* Error logging handled by tf_check_tcam_entry */ -if (rc) +/* Retrieve the device information */ + rc =tf_session_get_device (tfs, &dev); +if (rc) { +TFP_DRV_LOG (ERR , +"%s: Failed to lookup device, rc:%s\n" , +tf_dir_2_str (parms->dir), +strerror (-rc));return rc; + } - 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) +if (dev->ops->tf_dev_set_tcam ==NULL ) { + rc = -EOPNOTSUPP ; +TFP_DRV_LOG (ERR , +"%s: Operation not supported, rc:%s\n" , +tf_dir_2_str (parms->dir), +strerror (-rc));return rc; + } -/* Verify that the entry has been previously allocated */ - index = parms->idx / num_slice_per_row; + sparms.dir = parms->dir; + sparms.type = parms->tcam_tbl_type; + sparms.idx = parms->idx; + sparms.key = parms->key; + sparms.mask = parms->mask; + sparms.key_size =TF_BITS2BYTES_WORD_ALIGN (parms->key_sz_in_bits); + sparms.result = parms->result; + sparms.result_size =TF_BITS2BYTES_WORD_ALIGN (parms->result_sz_in_bits); - id =ba_inuse (session_pool, index); -if (id !=1 ) { + rc = dev->ops->tf_dev_set_tcam (tfp, &sparms); +if (rc) {TFP_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 ; +"%s: TCAM set failed, rc:%s\n" , +tf_dir_2_str (parms->dir), +strerror (-rc)); +return rc; } - rc =tf_msg_tcam_entry_set (tfp, parms); - -return rc; +return 0 ; }int
@@ -1033,59 +1008,52 @@ tf_free_tcam_entry(struct tf *tfp, struct tf_free_tcam_entry_parms *parms) {int rc; -int index;struct tf_session *tfs; -struct bitalloc *session_pool; -uint16_t num_slice_per_row =1 ; - -/* TEMP, due to device design. When tcam is modularized device -* should be retrieved from the session -*/ -enum tf_device_type device_type; -/* TEMP */ - device_type =TF_DEVICE_TYPE_WH ; +struct tf_dev_info *dev; +struct tf_tcam_free_parms fparms = {0 }; -TF_CHECK_PARMS_SESSION (tfp, parms); - tfs = (struct tf_session *)(tfp->session->core_data); +TF_CHECK_PARMS2 (tfp, parms); - rc =tf_check_tcam_entry (parms->tcam_tbl_type, - device_type, -0 , - &num_slice_per_row); -/* Error logging handled by tf_check_tcam_entry */ -if (rc) +/* Retrieve the session information */ + rc =tf_session_get_session (tfp, &tfs); +if (rc) { +TFP_DRV_LOG (ERR , +"%s: Failed to lookup session, rc:%s\n" , +tf_dir_2_str (parms->dir), +strerror (-rc));return rc; + } - 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) +/* Retrieve the device information */ + rc =tf_session_get_device (tfs, &dev); +if (rc) { +TFP_DRV_LOG (ERR , +"%s: Failed to lookup device, rc:%s\n" , +tf_dir_2_str (parms->dir), +strerror (-rc));return rc; + } - index = parms->idx / num_slice_per_row; - - rc =ba_inuse (session_pool, index); -if (rc ==BA_FAIL || rc ==BA_ENTRY_FREE ) { -TFP_DRV_LOG (ERR ,"%s: %s: Entry %d already free" , +if (dev->ops->tf_dev_free_tcam ==NULL ) { + rc = -EOPNOTSUPP ; +TFP_DRV_LOG (ERR , +"%s: Operation not supported, rc:%s\n" ,tf_dir_2_str (parms->dir), -tf_tcam_tbl_2_str (parms->tcam_tbl_type), - index); -return -EINVAL ; +strerror (-rc)); +return rc; } -ba_free (session_pool, index); - - rc =tf_msg_tcam_entry_free (tfp, parms); + fparms.dir = parms->dir; + fparms.type = parms->tcam_tbl_type; + fparms.idx = parms->idx; + rc = dev->ops->tf_dev_free_tcam (tfp, &fparms);if (rc) { -/* Log error */ -TFP_DRV_LOG (ERR ,"%s: %s: Entry %d free failed with err %s" , +TFP_DRV_LOG (ERR , +"%s: TCAM allocation failed, rc:%s\n" ,tf_dir_2_str (parms->dir), -tf_tcam_tbl_2_str (parms->tcam_tbl_type), - parms->idx,strerror (-rc)); +return rc; } -return rc; +return 0 ; }
drivers/net/bnxt/tf_core/tf_device.h +9 -5
@@ -116,8 +116,11 @@ struct tf_dev_ops {* [in] tfp * Pointer to TF handle * -* [out] slice_size -* Pointer to slice size the device supports +* [in] type +* TCAM table type +* +* [in] key_sz +* Key size * * [out] num_slices_per_row * Pointer to number of slices per row the device supports
@@ -126,9 +129,10 @@ struct tf_dev_ops {* - (0) if successful. * - (-EINVAL) on failure. */ -int (*tf_dev_get_wc_tcam_slices)(struct tf *tfp, -uint16_t *slice_size, -uint16_t *num_slices_per_row); +int (*tf_dev_get_tcam_slice_info)(struct tf *tfp, +enum tf_tcam_tbl_type type, +uint16_t key_sz, +uint16_t *num_slices_per_row);/** * Allocation of an identifier element.
drivers/net/bnxt/tf_core/tf_device_p4.c +14 -11
@@ -56,18 +56,21 @@ tf_dev_p4_get_max_types(struct tf *tfp __rte_unused,* - (-EINVAL) on failure. */ static int -tf_dev_p4_get_wc_tcam_slices(struct tf *tfp __rte_unused, -uint16_t *slice_size, -uint16_t *num_slices_per_row) +tf_dev_p4_get_tcam_slice_info(struct tf *tfp __rte_unused, +enum tf_tcam_tbl_type type, +uint16_t key_sz, +uint16_t *num_slices_per_row) { -#define CFA_P4_WC_TCAM_SLICE_SIZE 12 -#define CFA_P4_WC_TCAM_SLICES_PER_ROW 2 +#define CFA_P4_WC_TCAM_SLICES_PER_ROW 2 +#define CFA_P4_WC_TCAM_SLICE_SIZE 12 -if (slice_size ==NULL || num_slices_per_row ==NULL ) -return -EINVAL ; - - *slice_size =CFA_P4_WC_TCAM_SLICE_SIZE ; - *num_slices_per_row =CFA_P4_WC_TCAM_SLICES_PER_ROW ; +if (type ==TF_TCAM_TBL_TYPE_WC_TCAM ) { + *num_slices_per_row =CFA_P4_WC_TCAM_SLICES_PER_ROW ; +if (key_sz > *num_slices_per_row *CFA_P4_WC_TCAM_SLICE_SIZE ) +return -ENOTSUP ; + }else {/* for other type of tcam */ + *num_slices_per_row =1 ; + }return 0 ; }
@@ -77,7 +80,7 @@ tf_dev_p4_get_wc_tcam_slices(struct tf *tfp __rte_unused,*/ const struct tf_dev_ops tf_dev_ops_p4 = { .tf_dev_get_max_types = tf_dev_p4_get_max_types, - .tf_dev_get_wc_tcam_slices = tf_dev_p4_get_wc_tcam_slices, + .tf_dev_get_tcam_slice_info = tf_dev_p4_get_tcam_slice_info, .tf_dev_alloc_ident = tf_ident_alloc, .tf_dev_free_ident = tf_ident_free, .tf_dev_alloc_tbl = tf_tbl_alloc,
drivers/net/bnxt/tf_core/tf_msg.c +12 -19
@@ -9,6 +9,7 @@#include <string.h> #include "tf_msg_common.h" +#include "tf_device.h" #include "tf_msg.h" #include "tf_util.h" #include "tf_session.h"
@@ -1480,27 +1481,19 @@ tf_msg_bulk_get_tbl_entry(struct tf *tfp,return tfp_le_to_cpu_32 (parms.tf_resp_code); } -#define TF_BYTES_PER_SLICE (tfp) 12 -#define NUM_SLICES (tfp, bytes) \ - (((bytes) + TF_BYTES_PER_SLICE(tfp) - 1) / TF_BYTES_PER_SLICE(tfp)) -int tf_msg_tcam_entry_set (struct tf *tfp, -struct tf_set_tcam_entry_parms *parms) +struct tf_tcam_set_parms *parms) {int rc;struct tfp_send_msg_parms mparms = {0 };struct hwrm_tf_tcam_set_input req = {0 };struct hwrm_tf_tcam_set_output resp = {0 }; -uint16_t key_bytes = -TF_BITS2BYTES_WORD_ALIGN (parms->key_sz_in_bits); -uint16_t result_bytes = -TF_BITS2BYTES_WORD_ALIGN (parms->result_sz_in_bits);struct tf_msg_dma_buf buf = {0 };uint8_t *data =NULL ;int data_size =0 ; - rc =tf_tcam_tbl_2_hwrm (parms->tcam_tbl_type, &req.type); + rc =tf_tcam_tbl_2_hwrm (parms->type, &req.type);if (rc !=0 )return rc;
@@ -1508,11 +1501,11 @@ tf_msg_tcam_entry_set(struct tf *tfp,if (parms->dir ==TF_DIR_TX ) req.flags |=HWRM_TF_TCAM_SET_INPUT_FLAGS_DIR_TX ; - req.key_size = key_bytes; - req.mask_offset = key_bytes; + req.key_size = parms->key_size; + req.mask_offset = parms->key_size;/* Result follows after key and mask, thus multiply by 2 */ - req.result_offset =2 * key_bytes; - req.result_size = result_bytes; + req.result_offset =2 * parms->key_size; + req.result_size = parms->result_size; data_size =2 * req.key_size + req.result_size;if (data_size <=TF_PCI_BUF_SIZE_MAX ) {
@@ -1530,9 +1523,9 @@ tf_msg_tcam_entry_set(struct tf *tfp, sizeof(buf.pa_addr)); } -tfp_memcpy (&data[0 ], parms->key, key_bytes); -tfp_memcpy (&data[key_bytes], parms->mask, key_bytes); -tfp_memcpy (&data[req.result_offset], parms->result, result_bytes); +tfp_memcpy (&data[0 ], parms->key, parms->key_size); +tfp_memcpy (&data[parms->key_size], parms->mask, parms->key_size); +tfp_memcpy (&data[req.result_offset], parms->result, parms->result_size); mparms.tf_type =HWRM_TF_TCAM_SET ; mparms.req_data = (uint32_t *)&req;
@@ -1554,7 +1547,7 @@ tf_msg_tcam_entry_set(struct tf *tfp,int tf_msg_tcam_entry_free (struct tf *tfp, -struct tf_free_tcam_entry_parms *in_parms) +struct tf_tcam_free_parms *in_parms) {int rc;struct hwrm_tf_tcam_free_input req = {0 };
@@ -1562,7 +1555,7 @@ tf_msg_tcam_entry_free(struct tf *tfp,struct tfp_send_msg_parms parms = {0 };/* Populate the request */ - rc =tf_tcam_tbl_2_hwrm (in_parms->tcam_tbl_type, &req.type); + rc =tf_tcam_tbl_2_hwrm (in_parms->type, &req.type);if (rc !=0 )return rc;
drivers/net/bnxt/tf_core/tf_msg.h +2 -2
@@ -247,7 +247,7 @@ int tf_msg_em_op(struct tf *tfp,* 0 on Success else internal Truflow error */ int tf_msg_tcam_entry_set (struct tf *tfp, -struct tf_set_tcam_entry_parms *parms); +struct tf_tcam_set_parms *parms);/** * Sends tcam entry 'free' to the Firmware.
@@ -262,7 +262,7 @@ int tf_msg_tcam_entry_set(struct tf *tfp,* 0 on Success else internal Truflow error */ int tf_msg_tcam_entry_free (struct tf *tfp, -struct tf_free_tcam_entry_parms *parms); +struct tf_tcam_free_parms *parms);/** * Sends Set message of a Table Type element to the firmware.
drivers/net/bnxt/tf_core/tf_tcam.c +281 -4
335 lines not on this page · raw message
drivers/net/bnxt/tf_core/tf_tcam.h +49 -17
116 lines not on this page · raw message
Signature · 1 line
2.21.1 (Apple Git-122.3)
PATCH v5 18/51 net/bnxt: multiple device implementation
In reply to Ajit KhapardeFrom: Michael Wildt <[email protected]>
Implement the Identifier, Table Type and the Resource Manager modules.
Integrate Resource Manager with HCAPI.
Update open/close session.
Move to direct msgs for qcaps and resv messages.
--- drivers/net/bnxt/tf_core/tf_core.c | 751 ++++++++--------------- drivers/net/bnxt/tf_core/tf_core.h | 97 ++- drivers/net/bnxt/tf_core/tf_device.c | 10 +- drivers/net/bnxt/tf_core/tf_device.h | 1 + drivers/net/bnxt/tf_core/tf_device_p4.c | 26 +- drivers/net/bnxt/tf_core/tf_identifier.c | 29 +- drivers/net/bnxt/tf_core/tf_identifier.h | 4 +- drivers/net/bnxt/tf_core/tf_msg.c | 45 +- drivers/net/bnxt/tf_core/tf_msg.h | 1 + drivers/net/bnxt/tf_core/tf_rm_new.c | 225 +++++-- drivers/net/bnxt/tf_core/tf_rm_new.h | 11 +- drivers/net/bnxt/tf_core/tf_session.c | 28 +- drivers/net/bnxt/tf_core/tf_session.h | 2 +- drivers/net/bnxt/tf_core/tf_tbl.c | 611 +----------------- drivers/net/bnxt/tf_core/tf_tbl_type.c | 252 +++++++- drivers/net/bnxt/tf_core/tf_tbl_type.h | 2 +- drivers/net/bnxt/tf_core/tf_tcam.c | 12 +- drivers/net/bnxt/tf_core/tf_util.h | 45 +- drivers/net/bnxt/tf_core/tfp.c | 4 +- 19 files changed, 880 insertions(+), 1276 deletions(-)
drivers/net/bnxt/tf_core/tf_core.c +250 -501
@@ -19,284 +19,15 @@#include "tf_common.h" #include "hwrm_tf.h" -/** -* Create EM Tbl pool of memory indexes. -* -* [in] session -* Pointer to session -* [in] dir -* direction -* [in] num_entries -* number of entries to write -* -* Return: -* 0 - Success, entry allocated - no search support -* -ENOMEM -EINVAL -EOPNOTSUPP -* - Failure, entry not allocated, out of resources -*/ -static int -tf_create_em_pool (struct tf_session *session, -enum tf_dir dir, -uint32_t num_entries) -{ -struct tfp_calloc_parms parms; -uint32_t i, j; -int rc =0 ; -struct stack *pool = &session->em_pool[dir]; - - parms.nitems = num_entries; - parms.size =sizeof (uint32_t ); - parms.alignment =0 ; - -if (tfp_calloc (&parms) !=0 ) { -TFP_DRV_LOG (ERR ,"EM pool allocation failure %s\n" , -strerror (-ENOMEM )); -return -ENOMEM ; - } - -/* Create empty stack -*/ - rc =stack_init (num_entries, (uint32_t *)parms.mem_va, pool); - -if (rc !=0 ) { -TFP_DRV_LOG (ERR ,"EM pool stack init failure %s\n" , -strerror (-rc)); - goto cleanup; - } - -/* Fill pool with indexes -*/ - j = num_entries -1 ; - -for (i =0 ; i < num_entries; i++) { - rc =stack_push (pool, j); -if (rc !=0 ) { -TFP_DRV_LOG (ERR ,"EM pool stack push failure %s\n" , -strerror (-rc)); - goto cleanup; - } - j--; - } - -if (!stack_is_full (pool)) { - rc = -EINVAL ; -TFP_DRV_LOG (ERR ,"EM pool stack failure %s\n" , -strerror (-rc)); - goto cleanup; - } - -return 0 ; -cleanup: -tfp_free ((void *)parms.mem_va); -return rc; -} - -/** -* Create EM Tbl pool of memory indexes. -* -* [in] session -* Pointer to session -* [in] dir -* direction -* -* Return: -*/ -static void -tf_free_em_pool (struct tf_session *session, -enum tf_dir dir) -{ -struct stack *pool = &session->em_pool[dir]; -uint32_t *ptr; - - ptr =stack_items (pool); - -tfp_free (ptr); -} -int -tf_open_session (struct tf *tfp, +tf_open_session (struct tf *tfp,struct tf_open_session_parms *parms) -{ -int rc; -struct tf_session *session; -struct tfp_calloc_parms alloc_parms; -unsigned int domain, bus, slot, device; -uint8_t fw_session_id; -int dir; - -TF_CHECK_PARMS (tfp, parms); - -/* Filter out any non-supported device types on the Core -* side. It is assumed that the Firmware will be supported if -* firmware open session succeeds. -*/ -if (parms->device_type !=TF_DEVICE_TYPE_WH ) { -TFP_DRV_LOG (ERR , -"Unsupported device type %d\n" , - parms->device_type); -return -ENOTSUP ; - } - -/* Build the beginning of session_id */ - rc =sscanf (parms->ctrl_chan_name, -"%x:%x:%x.%d" , - &domain, - &bus, - &slot, - &device); -if (rc !=4 ) { -TFP_DRV_LOG (ERR , -"Failed to scan device ctrl_chan_name\n" ); -return -EINVAL ; - } - -/* open FW session and get a new session_id */ - rc =tf_msg_session_open (tfp, - parms->ctrl_chan_name, - &fw_session_id); -if (rc) { -/* Log error */ -if (rc == -EEXIST ) -TFP_DRV_LOG (ERR , -"Session is already open, rc:%s\n" , -strerror (-rc)); -else -TFP_DRV_LOG (ERR , -"Open message send failed, rc:%s\n" , -strerror (-rc)); - - parms->session_id.id =TF_FW_SESSION_ID_INVALID ; -return rc; - } - -/* Allocate session */ - alloc_parms.nitems =1 ; - alloc_parms.size =sizeof (struct tf_session_info ); - alloc_parms.alignment =0 ; - rc =tfp_calloc (&alloc_parms); -if (rc) { -/* Log error */ -TFP_DRV_LOG (ERR , -"Failed to allocate session info, rc:%s\n" , -strerror (-rc)); - goto cleanup; - } - - tfp->session = (struct tf_session_info *)alloc_parms.mem_va; - -/* Allocate core data for the session */ - alloc_parms.nitems =1 ; - alloc_parms.size =sizeof (struct tf_session ); - alloc_parms.alignment =0 ; - rc =tfp_calloc (&alloc_parms); -if (rc) { -/* Log error */ -TFP_DRV_LOG (ERR , -"Failed to allocate session data, rc:%s\n" , -strerror (-rc)); - goto cleanup; - } - - tfp->session->core_data = alloc_parms.mem_va; - - session = (struct tf_session *)tfp->session->core_data; -tfp_memcpy (session->ctrl_chan_name, - parms->ctrl_chan_name, -TF_SESSION_NAME_MAX ); - -/* Initialize Session */ - session->dev =NULL ; -tf_rm_init (tfp); - -/* Construct the Session ID */ - session->session_id.internal.domain = domain; - session->session_id.internal.bus = bus; - session->session_id.internal.device = device; - session->session_id.internal.fw_session_id = fw_session_id; - -/* Query for Session Config -*/ - rc =tf_msg_session_qcfg (tfp); -if (rc) { -TFP_DRV_LOG (ERR , -"Query config message send failed, rc:%s\n" , -strerror (-rc)); - 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) -TFP_DRV_LOG (ERR , -"Shadow DB Initialization failed\n, rc:%s" , -strerror (-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) { -TFP_DRV_LOG (ERR , -"Rm allocate validate failed, rc:%s\n" , -strerror (-rc)); - goto cleanup_close; - } - -/* Initialize EM pool */ -for (dir =0 ; dir <TF_DIR_MAX ; dir++) { - rc =tf_create_em_pool (session, - (enum tf_dir )dir, -TF_SESSION_EM_POOL_SIZE ); -if (rc) { -TFP_DRV_LOG (ERR , -"EM Pool initialization failed\n" ); - goto cleanup_close; - } - } - - session->ref_count++; - -/* Return session ID */ - parms->session_id = session->session_id; - -TFP_DRV_LOG (INFO , -"Session created, session_id:%d\n" , - parms->session_id.id); - -TFP_DRV_LOG (INFO , -"domain:%d, bus:%d, device:%d, fw_session_id:%d\n" , - parms->session_id.internal.domain, - parms->session_id.internal.bus, - parms->session_id.internal.device, - parms->session_id.internal.fw_session_id); - -return 0 ; - - cleanup: -tfp_free (tfp->session->core_data); -tfp_free (tfp->session); - tfp->session =NULL ; -return rc; - - cleanup_close: -tf_close_session (tfp); -return -EINVAL ; -} - -int -tf_open_session_new (struct tf *tfp, -struct tf_open_session_parms *parms) {int rc;unsigned int domain, bus, slot, device;struct tf_session_open_session_parms oparms; -TF_CHECK_PARMS (tfp, parms); +TF_CHECK_PARMS2 (tfp, parms);/* Filter out any non-supported device types on the Core * side. It is assumed that the Firmware will be supported if
@@ -347,33 +78,8 @@ tf_open_session_new(struct tf *tfp, }int -tf_attach_session(struct tf *tfp __rte_unused, - struct tf_attach_session_parms *parms __rte_unused) -{ -#if (TF_SHARED ==1 ) -int rc; - -TF_CHECK_PARMS_SESSION (tfp, parms); - -/* - Open the shared memory for the attach_chan_name -* - Point to the shared session for this Device instance -* - Check that session is valid -* - Attach to the firmware so it can record there is more -* than one client of the session. -*/ - -if (tfp->session->session_id.id !=TF_SESSION_ID_INVALID ) { - rc =tf_msg_session_attach (tfp, - parms->ctrl_chan_name, - parms->session_id); - } -#endif /* TF_SHARED */ -return -1 ; -} - -int -tf_attach_session_new (struct tf *tfp, -struct tf_attach_session_parms *parms) +tf_attach_session (struct tf *tfp, +struct tf_attach_session_parms *parms) {int rc;unsigned int domain, bus, slot, device;
@@ -436,65 +142,6 @@ tf_attach_session_new(struct tf *tfp,int tf_close_session (struct tf *tfp) -{ -int rc; -int rc_close =0 ; -struct tf_session *tfs; -union tf_session_id session_id; -int dir; - -TF_CHECK_TFP_SESSION (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) { -/* Log error */ -TFP_DRV_LOG (ERR , -"Message send failed, rc:%s\n" , -strerror (-rc)); - } - -/* Update the ref_count */ - tfs->ref_count--; - } - - session_id = tfs->session_id; - -/* Final cleanup as we're last user of the session */ -if (tfs->ref_count ==0 ) { -/* Free EM pool */ -for (dir =0 ; dir <TF_DIR_MAX ; dir++) -tf_free_em_pool (tfs, (enum tf_dir )dir); - -tfp_free (tfp->session->core_data); -tfp_free (tfp->session); - tfp->session =NULL ; - } - -TFP_DRV_LOG (INFO , -"Session closed, session_id:%d\n" , - session_id.id); - -TFP_DRV_LOG (INFO , -"domain:%d, bus:%d, device:%d, fw_session_id:%d\n" , - session_id.internal.domain, - session_id.internal.bus, - session_id.internal.device, - session_id.internal.fw_session_id); - -return rc_close; -} - -int -tf_close_session_new (struct tf *tfp) {int rc;struct tf_session_close_session_parms cparms = {0 };
@@ -620,76 +267,9 @@ int tf_delete_em_entry(struct tf *tfp,return rc; } -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; - -TF_CHECK_PARMS_SESSION (tfp, parms); - - 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 : -TFP_DRV_LOG (ERR ,"%s: unsupported %s\n" , -tf_dir_2_str (parms->dir), -tf_ident_2_str (parms->ident_type)); - rc = -EOPNOTSUPP ; -break ; -default : -TFP_DRV_LOG (ERR ,"%s: %s\n" , -tf_dir_2_str (parms->dir), -tf_ident_2_str (parms->ident_type)); - rc = -EOPNOTSUPP ; -break ; - } - -if (rc) { -TFP_DRV_LOG (ERR ,"%s: identifier pool %s failure, rc:%s\n" , -tf_dir_2_str (parms->dir), -tf_ident_2_str (parms->ident_type), -strerror (-rc)); -return rc; - } - - id =ba_alloc (session_pool); - -if (id ==BA_FAIL ) { -TFP_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 ; -} -int -tf_alloc_identifier_new (struct tf *tfp, -struct tf_alloc_identifier_parms *parms) +tf_alloc_identifier (struct tf *tfp, +struct tf_alloc_identifier_parms *parms) {int rc;struct tf_session *tfs;
@@ -732,7 +312,7 @@ tf_alloc_identifier_new(struct tf *tfp, } aparms.dir = parms->dir; - aparms.ident_type = parms->ident_type; + aparms.type = parms->ident_type; aparms.id = &id; rc = dev->ops->tf_dev_alloc_ident (tfp, &aparms);if (rc) {
@@ -748,79 +328,9 @@ tf_alloc_identifier_new(struct tf *tfp,return 0 ; } -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; - -TF_CHECK_PARMS_SESSION (tfp, parms); - - 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 : -TFP_DRV_LOG (ERR ,"%s: unsupported %s\n" , -tf_dir_2_str (parms->dir), -tf_ident_2_str (parms->ident_type)); - rc = -EOPNOTSUPP ; -break ; -default : -TFP_DRV_LOG (ERR ,"%s: invalid %s\n" , -tf_dir_2_str (parms->dir), -tf_ident_2_str (parms->ident_type)); - rc = -EOPNOTSUPP ; -break ; - } -if (rc) { -TFP_DRV_LOG (ERR , -"%s: %s Identifier pool access failed, rc:%s\n" , -tf_dir_2_str (parms->dir), -tf_ident_2_str (parms->ident_type), -strerror (-rc)); -return rc; - } - - ba_rc =ba_inuse (session_pool, (int )parms->id); - -if (ba_rc ==BA_FAIL || ba_rc ==BA_ENTRY_FREE ) { -TFP_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 ; -} -int -tf_free_identifier_new (struct tf *tfp, -struct tf_free_identifier_parms *parms) +tf_free_identifier (struct tf *tfp, +struct tf_free_identifier_parms *parms) {int rc;struct tf_session *tfs;
@@ -862,12 +372,12 @@ tf_free_identifier_new(struct tf *tfp, } fparms.dir = parms->dir; - fparms.ident_type = parms->ident_type; + fparms.type = parms->ident_type; fparms.id = parms->id; rc = dev->ops->tf_dev_free_ident (tfp, &fparms);if (rc) {TFP_DRV_LOG (ERR , -"%s: Identifier allocation failed, rc:%s\n" , +"%s: Identifier free failed, rc:%s\n" ,tf_dir_2_str (parms->dir),strerror (-rc));return rc;
@@ -1057,3 +567,242 @@ tf_free_tcam_entry(struct tf *tfp,return 0 ; } + +int +tf_alloc_tbl_entry (struct tf *tfp, +struct tf_alloc_tbl_entry_parms *parms) +{ +int rc; +struct tf_session *tfs; +struct tf_dev_info *dev; +struct tf_tbl_alloc_parms aparms; +uint32_t idx; + +TF_CHECK_PARMS2 (tfp, parms); + +/* Can't do static initialization due to UT enum check */ +memset (&aparms,0 ,sizeof (struct tf_tbl_alloc_parms )); + +/* Retrieve the session information */ + rc =tf_session_get_session (tfp, &tfs); +if (rc) { +TFP_DRV_LOG (ERR , +"%s: Failed to lookup session, rc:%s\n" , +tf_dir_2_str (parms->dir), +strerror (-rc)); +return rc; + } + +/* Retrieve the device information */ + rc =tf_session_get_device (tfs, &dev); +if (rc) { +TFP_DRV_LOG (ERR , +"%s: Failed to lookup device, rc:%s\n" , +tf_dir_2_str (parms->dir), +strerror (-rc)); +return rc; + } + +if (dev->ops->tf_dev_alloc_tbl ==NULL ) { + rc = -EOPNOTSUPP ; +TFP_DRV_LOG (ERR , +"%s: Operation not supported, rc:%s\n" , +tf_dir_2_str (parms->dir), +strerror (-rc)); +return -EOPNOTSUPP ; + } + + aparms.dir = parms->dir; + aparms.type = parms->type; + aparms.idx = &idx; + rc = dev->ops->tf_dev_alloc_tbl (tfp, &aparms); +if (rc) { +TFP_DRV_LOG (ERR , +"%s: Table allocation failed, rc:%s\n" , +tf_dir_2_str (parms->dir), +strerror (-rc)); +return rc; + } + + parms->idx = idx; + +return 0 ; +} + +int +tf_free_tbl_entry (struct tf *tfp, +struct tf_free_tbl_entry_parms *parms) +{ +int rc; +struct tf_session *tfs; +struct tf_dev_info *dev; +struct tf_tbl_free_parms fparms; + +TF_CHECK_PARMS2 (tfp, parms); + +/* Can't do static initialization due to UT enum check */ +memset (&fparms,0 ,sizeof (struct tf_tbl_free_parms )); + +/* Retrieve the session information */ + rc =tf_session_get_session (tfp, &tfs); +if (rc) { +TFP_DRV_LOG (ERR , +"%s: Failed to lookup session, rc:%s\n" , +tf_dir_2_str (parms->dir), +strerror (-rc)); +return rc; + } + +/* Retrieve the device information */ + rc =tf_session_get_device (tfs, &dev); +if (rc) { +TFP_DRV_LOG (ERR , +"%s: Failed to lookup device, rc:%s\n" , +tf_dir_2_str (parms->dir), +strerror (-rc)); +return rc; + } + +if (dev->ops->tf_dev_free_tbl ==NULL ) { + rc = -EOPNOTSUPP ; +TFP_DRV_LOG (ERR , +"%s: Operation not supported, rc:%s\n" , +tf_dir_2_str (parms->dir), +strerror (-rc)); +return -EOPNOTSUPP ; + } + + fparms.dir = parms->dir; + fparms.type = parms->type; + fparms.idx = parms->idx; + rc = dev->ops->tf_dev_free_tbl (tfp, &fparms); +if (rc) { +TFP_DRV_LOG (ERR , +"%s: Table free failed, rc:%s\n" , +tf_dir_2_str (parms->dir), +strerror (-rc)); +return rc; + } + +return 0 ; +} + +int +tf_set_tbl_entry (struct tf *tfp, +struct tf_set_tbl_entry_parms *parms) +{ +int rc =0 ; +struct tf_session *tfs; +struct tf_dev_info *dev; +struct tf_tbl_set_parms sparms; + +TF_CHECK_PARMS3 (tfp, parms, parms->data); + +/* Can't do static initialization due to UT enum check */ +memset (&sparms,0 ,sizeof (struct tf_tbl_set_parms )); + +/* Retrieve the session information */ + rc =tf_session_get_session (tfp, &tfs); +if (rc) { +TFP_DRV_LOG (ERR , +"%s: Failed to lookup session, rc:%s\n" , +tf_dir_2_str (parms->dir), +strerror (-rc)); +return rc; + } + +/* Retrieve the device information */ + rc =tf_session_get_device (tfs, &dev); +if (rc) { +TFP_DRV_LOG (ERR , +"%s: Failed to lookup device, rc:%s\n" , +tf_dir_2_str (parms->dir), +strerror (-rc)); +return rc; + } + +if (dev->ops->tf_dev_set_tbl ==NULL ) { + rc = -EOPNOTSUPP ; +TFP_DRV_LOG (ERR , +"%s: Operation not supported, rc:%s\n" , +tf_dir_2_str (parms->dir), +strerror (-rc)); +return -EOPNOTSUPP ; + } + + sparms.dir = parms->dir; + sparms.type = parms->type; + sparms.data = parms->data; + sparms.data_sz_in_bytes = parms->data_sz_in_bytes; + sparms.idx = parms->idx; + rc = dev->ops->tf_dev_set_tbl (tfp, &sparms); +if (rc) { +TFP_DRV_LOG (ERR , +"%s: Table set failed, rc:%s\n" , +tf_dir_2_str (parms->dir), +strerror (-rc)); +return rc; + } + +return rc; +} + +int +tf_get_tbl_entry (struct tf *tfp, +struct tf_get_tbl_entry_parms *parms) +{ +int rc =0 ; +struct tf_session *tfs; +struct tf_dev_info *dev; +struct tf_tbl_get_parms gparms; + +TF_CHECK_PARMS3 (tfp, parms, parms->data); + +/* Can't do static initialization due to UT enum check */ +memset (&gparms,0 ,sizeof (struct tf_tbl_get_parms )); + +/* Retrieve the session information */ + rc =tf_session_get_session (tfp, &tfs); +if (rc) { +TFP_DRV_LOG (ERR , +"%s: Failed to lookup session, rc:%s\n" , +tf_dir_2_str (parms->dir), +strerror (-rc)); +return rc; + } + +/* Retrieve the device information */ + rc =tf_session_get_device (tfs, &dev); +if (rc) { +TFP_DRV_LOG (ERR , +"%s: Failed to lookup device, rc:%s\n" , +tf_dir_2_str (parms->dir), +strerror (-rc)); +return rc; + } + +if (dev->ops->tf_dev_get_tbl ==NULL ) { + rc = -EOPNOTSUPP ; +TFP_DRV_LOG (ERR , +"%s: Operation not supported, rc:%s\n" , +tf_dir_2_str (parms->dir), +strerror (-rc)); +return -EOPNOTSUPP ; + } + + gparms.dir = parms->dir; + gparms.type = parms->type; + gparms.data = parms->data; + gparms.data_sz_in_bytes = parms->data_sz_in_bytes; + gparms.idx = parms->idx; + rc = dev->ops->tf_dev_get_tbl (tfp, &gparms); +if (rc) { +TFP_DRV_LOG (ERR , +"%s: Table get failed, rc:%s\n" , +tf_dir_2_str (parms->dir), +strerror (-rc)); +return rc; + } + +return rc; +}
drivers/net/bnxt/tf_core/tf_core.h +70 -27
151 lines not on this page · raw message
drivers/net/bnxt/tf_core/tf_device.c +9 -1
@@ -43,6 +43,14 @@ dev_bind_p4(struct tf *tfp,struct tf_tbl_cfg_parms tbl_cfg;struct tf_tcam_cfg_parms tcam_cfg; + dev_handle->type =TF_DEVICE_TYPE_WH ; +/* Initial function initialization */ + dev_handle->ops = &tf_dev_ops_p4_init; + + dev_handle->type =TF_DEVICE_TYPE_WH ; +/* Initial function initialization */ + dev_handle->ops = &tf_dev_ops_p4_init; +/* Initialize the modules */ ident_cfg.num_elements =TF_IDENT_TYPE_MAX ;
@@ -78,7 +86,7 @@ dev_bind_p4(struct tf *tfp, goto fail; } - dev_handle->type =TF_DEVICE_TYPE_WH ; +/* Final function initialization */ dev_handle->ops = &tf_dev_ops_p4;return 0 ;
drivers/net/bnxt/tf_core/tf_device.h +1 -0
@@ -407,6 +407,7 @@ struct tf_dev_ops {/** * Supported device operation structures */ +extern const struct tf_dev_ops tf_dev_ops_p4_init;extern const struct tf_dev_ops tf_dev_ops_p4;#endif /* _TF_DEVICE_H_ */
drivers/net/bnxt/tf_core/tf_device_p4.c +23 -3
@@ -75,6 +75,26 @@ tf_dev_p4_get_tcam_slice_info(struct tf *tfp __rte_unused,return 0 ; } +/** +* Truflow P4 device specific functions +*/ +const struct tf_dev_ops tf_dev_ops_p4_init = { + .tf_dev_get_max_types = tf_dev_p4_get_max_types, + .tf_dev_get_tcam_slice_info = tf_dev_p4_get_tcam_slice_info, + .tf_dev_alloc_ident =NULL , + .tf_dev_free_ident =NULL , + .tf_dev_alloc_tbl =NULL , + .tf_dev_free_tbl =NULL , + .tf_dev_alloc_search_tbl =NULL , + .tf_dev_set_tbl =NULL , + .tf_dev_get_tbl =NULL , + .tf_dev_alloc_tcam =NULL , + .tf_dev_free_tcam =NULL , + .tf_dev_alloc_search_tcam =NULL , + .tf_dev_set_tcam =NULL , + .tf_dev_get_tcam =NULL , +}; +/** * Truflow P4 device specific functions */
@@ -85,14 +105,14 @@ const struct tf_dev_ops tf_dev_ops_p4 = { .tf_dev_free_ident = tf_ident_free, .tf_dev_alloc_tbl = tf_tbl_alloc, .tf_dev_free_tbl = tf_tbl_free, - .tf_dev_alloc_search_tbl = tf_tbl_alloc_search, + .tf_dev_alloc_search_tbl = NULL, .tf_dev_set_tbl = tf_tbl_set, .tf_dev_get_tbl = tf_tbl_get, .tf_dev_alloc_tcam = tf_tcam_alloc, .tf_dev_free_tcam = tf_tcam_free, - .tf_dev_alloc_search_tcam = tf_tcam_alloc_search, + .tf_dev_alloc_search_tcam = NULL, .tf_dev_set_tcam = tf_tcam_set, - .tf_dev_get_tcam = tf_tcam_get, + .tf_dev_get_tcam = NULL, .tf_dev_insert_em_entry = tf_em_insert_entry, .tf_dev_delete_em_entry = tf_em_delete_entry, };
drivers/net/bnxt/tf_core/tf_identifier.c +19 -10
@@ -45,19 +45,22 @@ tf_ident_bind(struct tf *tfp, db_cfg.dir = i; db_cfg.num_elements = parms->num_elements; db_cfg.cfg = parms->cfg; - db_cfg.alloc_num = parms->resources->identifier_cnt[i]; - db_cfg.rm_db = ident_db[i]; + db_cfg.alloc_cnt = parms->resources->ident_cnt[i].cnt; + db_cfg.rm_db = &ident_db[i]; rc =tf_rm_create_db (tfp, &db_cfg);if (rc) {TFP_DRV_LOG (ERR ,"%s: Identifier DB creation failed\n" ,tf_dir_2_str (i)); +return rc; } } init =1 ; +printf ("Identifier - initialized\n" ); +return 0 ; }
@@ -73,8 +76,11 @@ tf_ident_unbind(struct tf *tfp __rte_unused)/* Bail if nothing has been initialized done silent as to * allow for creation cleanup. */ -if (!init) +if (!init) { +TFP_DRV_LOG (ERR , +"No Identifier DBs created\n" );return -EINVAL ; + }for (i =0 ; i <TF_DIR_MAX ; i++) { fparms.dir = i;
@@ -96,6 +102,7 @@ tf_ident_alloc(struct tf *tfp __rte_unused, struct tf_ident_alloc_parms *parms) {int rc; +uint32_t id;struct tf_rm_allocate_parms aparms = {0 };TF_CHECK_PARMS2 (tfp, parms);
@@ -109,17 +116,19 @@ tf_ident_alloc(struct tf *tfp __rte_unused,/* Allocate requested element */ aparms.rm_db = ident_db[parms->dir]; - aparms.db_index = parms->ident_type; - aparms.index = (uint32_t *)&parms->id; + aparms.db_index = parms->type; + aparms.index = &id; rc =tf_rm_allocate (&aparms);if (rc) {TFP_DRV_LOG (ERR ,"%s: Failed allocate, type:%d\n" ,tf_dir_2_str (parms->dir), - parms->ident_type); + parms->type);return rc; } + *parms->id = id; +return 0 ; }
@@ -143,7 +152,7 @@ tf_ident_free(struct tf *tfp __rte_unused,/* Check if element is in use */ aparms.rm_db = ident_db[parms->dir]; - aparms.db_index = parms->ident_type; + aparms.db_index = parms->type; aparms.index = parms->id; aparms.allocated = &allocated; rc =tf_rm_is_allocated (&aparms);
@@ -154,21 +163,21 @@ tf_ident_free(struct tf *tfp __rte_unused,TFP_DRV_LOG (ERR ,"%s: Entry already free, type:%d, index:%d\n" ,tf_dir_2_str (parms->dir), - parms->ident_type, + parms->type, parms->id);return rc; }/* Free requested element */ fparms.rm_db = ident_db[parms->dir]; - fparms.db_index = parms->ident_type; + fparms.db_index = parms->type; fparms.index = parms->id; rc =tf_rm_free (&fparms);if (rc) {TFP_DRV_LOG (ERR ,"%s: Free failed, type:%d, index:%d\n" ,tf_dir_2_str (parms->dir), - parms->ident_type, + parms->type, parms->id);return rc; }
drivers/net/bnxt/tf_core/tf_identifier.h +2 -2
@@ -43,7 +43,7 @@ struct tf_ident_alloc_parms {/** * [in] Identifier type */ -enum tf_identifier_type ident_type; +enum tf_identifier_type type;/** * [out] Identifier allocated */
@@ -61,7 +61,7 @@ struct tf_ident_free_parms {/** * [in] Identifier type */ -enum tf_identifier_type ident_type; +enum tf_identifier_type type;/** * [in] ID to free */
drivers/net/bnxt/tf_core/tf_msg.c +32 -13
115 lines not on this page · raw message
drivers/net/bnxt/tf_core/tf_msg.h +1 -0
@@ -12,6 +12,7 @@#include "tf_tbl.h" #include "tf_rm.h" #include "tf_rm_new.h" +#include "tf_tcam.h" struct tf ;
drivers/net/bnxt/tf_core/tf_rm_new.c +175 -50
374 lines not on this page · raw message
drivers/net/bnxt/tf_core/tf_rm_new.h +7 -4
@@ -135,13 +135,16 @@ struct tf_rm_create_db_parms {*/ struct tf_rm_element_cfg *cfg;/** -* Allocation number array. Array size is num_elements. +* Resource allocation count array. This array content +* originates from the tf_session_resources that is passed in +* on session open. +* Array size is num_elements. */ -uint16_t *alloc_num; +uint16_t *alloc_cnt;/** * [out] RM DB Handle */ -void *rm_db; +void **rm_db; };/**
@@ -382,7 +385,7 @@ int tf_rm_get_info(struct tf_rm_get_alloc_info_parms *parms);/** * Performs a lookup in the Resource Manager DB and retrives the -* requested HCAPI type. +* requested HCAPI RM type. * * [in] parms * Pointer to get hcapi parameters
drivers/net/bnxt/tf_core/tf_session.c +2 -26
@@ -95,21 +95,11 @@ tf_session_open_session(struct tf *tfp, parms->open_cfg->device_type, session->shadow_copy, &parms->open_cfg->resources, - session->dev); + &session->dev);/* Logging handled by dev_bind */ if (rc)return rc; -/* Query for Session Config -*/ - rc =tf_msg_session_qcfg (tfp); -if (rc) { -TFP_DRV_LOG (ERR , -"Query config message send failed, rc:%s\n" , -strerror (-rc)); - goto cleanup_close; - } - session->ref_count++;return 0 ;
@@ -119,10 +109,6 @@ tf_session_open_session(struct tf *tfp,tfp_free (tfp->session); tfp->session =NULL ;return rc; - - cleanup_close: -tf_close_session (tfp); -return -EINVAL ; }int
@@ -231,17 +217,7 @@ int tf_session_get_device(struct tf_session *tfs, struct tf_dev_info **tfd) { - int rc; - -if (tfs->dev ==NULL ) { - rc = -EINVAL ; -TFP_DRV_LOG (ERR , -"Device not created, rc:%s\n" , -strerror (-rc)); -return rc; - } - - *tfd = tfs->dev; + *tfd = &tfs->dev;return 0 ; }
drivers/net/bnxt/tf_core/tf_session.h +1 -1
@@ -97,7 +97,7 @@ struct tf_session {uint8_t ref_count;/** Device handle */ -struct tf_dev_info *dev; +struct tf_dev_info dev;/** Session HW and SRAM resources */ struct tf_rm_db resc;
drivers/net/bnxt/tf_core/tf_tbl.c +1 -610
635 lines not on this page · raw message
drivers/net/bnxt/tf_core/tf_tbl_type.c +242 -10
306 lines not on this page · raw message
drivers/net/bnxt/tf_core/tf_tbl_type.h +1 -1
@@ -55,7 +55,7 @@ struct tf_tbl_alloc_parms {/** * [out] Idx of allocated entry or found entry (if search_enable) */ -uint32_t idx; +uint32_t *idx; };/**
drivers/net/bnxt/tf_core/tf_tcam.c +7 -5
@@ -38,8 +38,8 @@ static uint8_t init;/* static uint8_t shadow_init; */ int -tf_tcam_bind(struct tf *tfp __rte_unused, - struct tf_tcam_cfg_parms *parms __rte_unused) +tf_tcam_bind (struct tf *tfp, +struct tf_tcam_cfg_parms *parms) {int rc;int i;
@@ -59,8 +59,8 @@ tf_tcam_bind(struct tf *tfp __rte_unused, db_cfg.dir = i; db_cfg.num_elements = parms->num_elements; db_cfg.cfg = parms->cfg; - db_cfg.alloc_num = parms->resources->tcam_tbl_cnt[i]; - db_cfg.rm_db = tcam_db[i]; + db_cfg.alloc_cnt = parms->resources->tcam_cnt[i].cnt; + db_cfg.rm_db = &tcam_db[i]; rc =tf_rm_create_db (tfp, &db_cfg);if (rc) { TFP_DRV_LOG(ERR,
@@ -72,11 +72,13 @@ tf_tcam_bind(struct tf *tfp __rte_unused, init =1 ; +printf ("TCAM - initialized\n" ); +return 0 ; }int -tf_tcam_unbind(struct tf *tfp __rte_unused) +tf_tcam_unbind (struct tf *tfp) {int rc;int i;
drivers/net/bnxt/tf_core/tf_util.h +35 -10
67 lines not on this page · raw message
drivers/net/bnxt/tf_core/tfp.c +2 -2
@@ -102,13 +102,13 @@ tfp_calloc(struct tfp_calloc_parms *parms) (parms->nitems * parms->size), parms->alignment);if (parms->mem_va ==NULL ) { -PMD_DRV_LOG (ERR ,"Allocate failed mem_va\n" ); +TFP_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 *)((uintptr_t )RTE_BAD_IOVA )) { -PMD_DRV_LOG (ERR ,"Allocate failed mem_pa\n" ); +TFP_DRV_LOG (ERR ,"Allocate failed mem_pa\n" );return -ENOMEM ; }
Signature · 1 line
2.21.1 (Apple Git-122.3)
PATCH v5 19/51 net/bnxt: update identifier with remap support
In reply to Ajit KhapardeFrom: Michael Wildt <[email protected]>
- Add Identifier L2 CTXT Remap to the P4 device and updated the cfa_resource_types.h to get the type support.
--- drivers/net/bnxt/tf_core/cfa_resource_types.h | 110 ++++++++++-------- drivers/net/bnxt/tf_core/tf_device_p4.h | 2 +- 2 files changed, 60 insertions(+), 52 deletions(-)
drivers/net/bnxt/tf_core/cfa_resource_types.h +59 -51
@@ -20,46 +20,48 @@/* L2 Context TCAM */ #define CFA_RESOURCE_TYPE_P59_L2_CTXT_TCAM 0x0UL +/* L2 Context REMAP */ +#define CFA_RESOURCE_TYPE_P59_L2_CTXT_REMAP 0x1UL/* Profile Func */ -#define CFA_RESOURCE_TYPE_P59_PROF_FUNC 0x1UL +#define CFA_RESOURCE_TYPE_P59_PROF_FUNC 0x2UL/* Profile TCAM */ -#define CFA_RESOURCE_TYPE_P59_PROF_TCAM 0x2UL +#define CFA_RESOURCE_TYPE_P59_PROF_TCAM 0x3UL/* Exact Match Profile Id */ -#define CFA_RESOURCE_TYPE_P59_EM_PROF_ID 0x3UL +#define CFA_RESOURCE_TYPE_P59_EM_PROF_ID 0x4UL/* Wildcard TCAM Profile Id */ -#define CFA_RESOURCE_TYPE_P59_WC_TCAM_PROF_ID 0x4UL +#define CFA_RESOURCE_TYPE_P59_WC_TCAM_PROF_ID 0x5UL/* Wildcard TCAM */ -#define CFA_RESOURCE_TYPE_P59_WC_TCAM 0x5UL +#define CFA_RESOURCE_TYPE_P59_WC_TCAM 0x6UL/* Meter Profile */ -#define CFA_RESOURCE_TYPE_P59_METER_PROF 0x6UL +#define CFA_RESOURCE_TYPE_P59_METER_PROF 0x7UL/* Meter */ -#define CFA_RESOURCE_TYPE_P59_METER 0x7UL +#define CFA_RESOURCE_TYPE_P59_METER 0x8UL/* Meter */ -#define CFA_RESOURCE_TYPE_P59_MIRROR 0x8UL +#define CFA_RESOURCE_TYPE_P59_MIRROR 0x9UL/* Source Properties TCAM */ -#define CFA_RESOURCE_TYPE_P59_SP_TCAM 0x9UL +#define CFA_RESOURCE_TYPE_P59_SP_TCAM 0xaUL/* Exact Match Flexible Key Builder */ -#define CFA_RESOURCE_TYPE_P59_EM_FKB 0xaUL +#define CFA_RESOURCE_TYPE_P59_EM_FKB 0xbUL/* Wildcard Flexible Key Builder */ -#define CFA_RESOURCE_TYPE_P59_WC_FKB 0xbUL +#define CFA_RESOURCE_TYPE_P59_WC_FKB 0xcUL/* Table Scope */ -#define CFA_RESOURCE_TYPE_P59_TBL_SCOPE 0xcUL +#define CFA_RESOURCE_TYPE_P59_TBL_SCOPE 0xdUL/* L2 Func */ -#define CFA_RESOURCE_TYPE_P59_L2_FUNC 0xdUL +#define CFA_RESOURCE_TYPE_P59_L2_FUNC 0xeUL/* EPOCH */ -#define CFA_RESOURCE_TYPE_P59_EPOCH 0xeUL +#define CFA_RESOURCE_TYPE_P59_EPOCH 0xfUL/* Metadata */ -#define CFA_RESOURCE_TYPE_P59_METADATA 0xfUL +#define CFA_RESOURCE_TYPE_P59_METADATA 0x10UL/* Connection Tracking Rule TCAM */ -#define CFA_RESOURCE_TYPE_P59_CT_RULE_TCAM 0x10UL +#define CFA_RESOURCE_TYPE_P59_CT_RULE_TCAM 0x11UL/* Range Profile */ -#define CFA_RESOURCE_TYPE_P59_RANGE_PROF 0x11UL +#define CFA_RESOURCE_TYPE_P59_RANGE_PROF 0x12UL/* Range */ -#define CFA_RESOURCE_TYPE_P59_RANGE 0x12UL +#define CFA_RESOURCE_TYPE_P59_RANGE 0x13UL/* Link Aggrigation */ -#define CFA_RESOURCE_TYPE_P59_LAG 0x13UL +#define CFA_RESOURCE_TYPE_P59_LAG 0x14UL/* VEB TCAM */ -#define CFA_RESOURCE_TYPE_P59_VEB_TCAM 0x14UL +#define CFA_RESOURCE_TYPE_P59_VEB_TCAM 0x15UL#define CFA_RESOURCE_TYPE_P59_LAST CFA_RESOURCE_TYPE_P59_VEB_TCAM
@@ -105,30 +107,32 @@#define CFA_RESOURCE_TYPE_P58_FORMAT_4_ACTION 0x13UL/* L2 Context TCAM */ #define CFA_RESOURCE_TYPE_P58_L2_CTXT_TCAM 0x14UL +/* L2 Context REMAP */ +#define CFA_RESOURCE_TYPE_P58_L2_CTXT_REMAP 0x15UL/* Profile Func */ -#define CFA_RESOURCE_TYPE_P58_PROF_FUNC 0x15UL +#define CFA_RESOURCE_TYPE_P58_PROF_FUNC 0x16UL/* Profile TCAM */ -#define CFA_RESOURCE_TYPE_P58_PROF_TCAM 0x16UL +#define CFA_RESOURCE_TYPE_P58_PROF_TCAM 0x17UL/* Exact Match Profile Id */ -#define CFA_RESOURCE_TYPE_P58_EM_PROF_ID 0x17UL +#define CFA_RESOURCE_TYPE_P58_EM_PROF_ID 0x18UL/* Wildcard Profile Id */ -#define CFA_RESOURCE_TYPE_P58_WC_TCAM_PROF_ID 0x18UL +#define CFA_RESOURCE_TYPE_P58_WC_TCAM_PROF_ID 0x19UL/* Exact Match Record */ -#define CFA_RESOURCE_TYPE_P58_EM_REC 0x19UL +#define CFA_RESOURCE_TYPE_P58_EM_REC 0x1aUL/* Wildcard TCAM */ -#define CFA_RESOURCE_TYPE_P58_WC_TCAM 0x1aUL +#define CFA_RESOURCE_TYPE_P58_WC_TCAM 0x1bUL/* Meter profile */ -#define CFA_RESOURCE_TYPE_P58_METER_PROF 0x1bUL +#define CFA_RESOURCE_TYPE_P58_METER_PROF 0x1cUL/* Meter */ -#define CFA_RESOURCE_TYPE_P58_MIRROR 0x1cUL +#define CFA_RESOURCE_TYPE_P58_MIRROR 0x1dUL/* Source Property TCAM */ -#define CFA_RESOURCE_TYPE_P58_SP_TCAM 0x1dUL +#define CFA_RESOURCE_TYPE_P58_SP_TCAM 0x1eUL/* Exact Match Flexible Key Builder */ -#define CFA_RESOURCE_TYPE_P58_EM_FKB 0x1eUL +#define CFA_RESOURCE_TYPE_P58_EM_FKB 0x1fUL/* Wildcard Flexible Key Builder */ -#define CFA_RESOURCE_TYPE_P58_WC_FKB 0x1fUL +#define CFA_RESOURCE_TYPE_P58_WC_FKB 0x20UL/* VEB TCAM */ -#define CFA_RESOURCE_TYPE_P58_VEB_TCAM 0x20UL +#define CFA_RESOURCE_TYPE_P58_VEB_TCAM 0x21UL#define CFA_RESOURCE_TYPE_P58_LAST CFA_RESOURCE_TYPE_P58_VEB_TCAM
@@ -176,26 +180,28 @@#define CFA_RESOURCE_TYPE_P45_FORMAT_4_ACTION 0x14UL/* L2 Context TCAM */ #define CFA_RESOURCE_TYPE_P45_L2_CTXT_TCAM 0x15UL +/* L2 Context REMAP */ +#define CFA_RESOURCE_TYPE_P45_L2_CTXT_REMAP 0x16UL/* Profile Func */ -#define CFA_RESOURCE_TYPE_P45_PROF_FUNC 0x16UL +#define CFA_RESOURCE_TYPE_P45_PROF_FUNC 0x17UL/* Profile TCAM */ -#define CFA_RESOURCE_TYPE_P45_PROF_TCAM 0x17UL +#define CFA_RESOURCE_TYPE_P45_PROF_TCAM 0x18UL/* Exact Match Profile Id */ -#define CFA_RESOURCE_TYPE_P45_EM_PROF_ID 0x18UL +#define CFA_RESOURCE_TYPE_P45_EM_PROF_ID 0x19UL/* Exact Match Record */ -#define CFA_RESOURCE_TYPE_P45_EM_REC 0x19UL +#define CFA_RESOURCE_TYPE_P45_EM_REC 0x1aUL/* Wildcard Profile Id */ -#define CFA_RESOURCE_TYPE_P45_WC_TCAM_PROF_ID 0x1aUL +#define CFA_RESOURCE_TYPE_P45_WC_TCAM_PROF_ID 0x1bUL/* Wildcard TCAM */ -#define CFA_RESOURCE_TYPE_P45_WC_TCAM 0x1bUL +#define CFA_RESOURCE_TYPE_P45_WC_TCAM 0x1cUL/* Meter profile */ -#define CFA_RESOURCE_TYPE_P45_METER_PROF 0x1cUL +#define CFA_RESOURCE_TYPE_P45_METER_PROF 0x1dUL/* Meter */ -#define CFA_RESOURCE_TYPE_P45_MIRROR 0x1dUL +#define CFA_RESOURCE_TYPE_P45_MIRROR 0x1eUL/* Source Property TCAM */ -#define CFA_RESOURCE_TYPE_P45_SP_TCAM 0x1eUL +#define CFA_RESOURCE_TYPE_P45_SP_TCAM 0x1fUL/* VEB TCAM */ -#define CFA_RESOURCE_TYPE_P45_VEB_TCAM 0x1fUL +#define CFA_RESOURCE_TYPE_P45_VEB_TCAM 0x20UL#define CFA_RESOURCE_TYPE_P45_LAST CFA_RESOURCE_TYPE_P45_VEB_TCAM
@@ -243,24 +249,26 @@#define CFA_RESOURCE_TYPE_P4_FORMAT_4_ACTION 0x14UL/* L2 Context TCAM */ #define CFA_RESOURCE_TYPE_P4_L2_CTXT_TCAM 0x15UL +/* L2 Context REMAP */ +#define CFA_RESOURCE_TYPE_P4_L2_CTXT_REMAP 0x16UL/* Profile Func */ -#define CFA_RESOURCE_TYPE_P4_PROF_FUNC 0x16UL +#define CFA_RESOURCE_TYPE_P4_PROF_FUNC 0x17UL/* Profile TCAM */ -#define CFA_RESOURCE_TYPE_P4_PROF_TCAM 0x17UL +#define CFA_RESOURCE_TYPE_P4_PROF_TCAM 0x18UL/* Exact Match Profile Id */ -#define CFA_RESOURCE_TYPE_P4_EM_PROF_ID 0x18UL +#define CFA_RESOURCE_TYPE_P4_EM_PROF_ID 0x19UL/* Exact Match Record */ -#define CFA_RESOURCE_TYPE_P4_EM_REC 0x19UL +#define CFA_RESOURCE_TYPE_P4_EM_REC 0x1aUL/* Wildcard Profile Id */ -#define CFA_RESOURCE_TYPE_P4_WC_TCAM_PROF_ID 0x1aUL +#define CFA_RESOURCE_TYPE_P4_WC_TCAM_PROF_ID 0x1bUL/* Wildcard TCAM */ -#define CFA_RESOURCE_TYPE_P4_WC_TCAM 0x1bUL +#define CFA_RESOURCE_TYPE_P4_WC_TCAM 0x1cUL/* Meter profile */ -#define CFA_RESOURCE_TYPE_P4_METER_PROF 0x1cUL +#define CFA_RESOURCE_TYPE_P4_METER_PROF 0x1dUL/* Meter */ -#define CFA_RESOURCE_TYPE_P4_MIRROR 0x1dUL +#define CFA_RESOURCE_TYPE_P4_MIRROR 0x1eUL/* Source Property TCAM */ -#define CFA_RESOURCE_TYPE_P4_SP_TCAM 0x1eUL +#define CFA_RESOURCE_TYPE_P4_SP_TCAM 0x1fUL#define CFA_RESOURCE_TYPE_P4_LAST CFA_RESOURCE_TYPE_P4_SP_TCAM
drivers/net/bnxt/tf_core/tf_device_p4.h +1 -1
@@ -12,7 +12,7 @@#include "tf_rm_new.h" struct tf_rm_element_cfg tf_ident_p4[TF_IDENT_TYPE_MAX ] = { - {TF_RM_ELEM_CFG_PRIVATE ,CFA_RESOURCE_TYPE_INVALID }, + {TF_RM_ELEM_CFG_HCAPI ,CFA_RESOURCE_TYPE_P4_L2_CTXT_REMAP }, {TF_RM_ELEM_CFG_HCAPI ,CFA_RESOURCE_TYPE_P4_PROF_FUNC }, {TF_RM_ELEM_CFG_HCAPI ,CFA_RESOURCE_TYPE_P4_WC_TCAM_PROF_ID }, {TF_RM_ELEM_CFG_HCAPI ,CFA_RESOURCE_TYPE_P4_EM_PROF_ID },
Signature · 1 line
2.21.1 (Apple Git-122.3)
PATCH v5 20/51 net/bnxt: update RM with residual checker
In reply to Ajit KhapardeFrom: Michael Wildt <[email protected]>
- Add residual checker to the TF Host RM as well as new RM APIs. On close it will scan the DB and check of any remaining elements. If found they will be logged and FW msg sent for FW to scrub that specific type of resources.
- Update the module bind to be aware of the module type, for each of the modules.
- Add additional type 2 string util functions.
- Fix the device naming to be in compliance with TF.
- Update the device unbind order as to assure TCAMs gets flushed first.
- Update the close functionality such that the session gets closed after the device is unbound.
--- drivers/net/bnxt/tf_core/tf_device.c | 53 +++-- drivers/net/bnxt/tf_core/tf_device.h | 25 +- drivers/net/bnxt/tf_core/tf_device_p4.h | 1 - drivers/net/bnxt/tf_core/tf_identifier.c | 10 +- drivers/net/bnxt/tf_core/tf_msg.c | 67 +++++- drivers/net/bnxt/tf_core/tf_msg.h | 7 + drivers/net/bnxt/tf_core/tf_rm_new.c | 287 +++++++++++++++++++++-- drivers/net/bnxt/tf_core/tf_rm_new.h | 45 +++- drivers/net/bnxt/tf_core/tf_session.c | 58 +++-- drivers/net/bnxt/tf_core/tf_tbl_type.c | 5 +- drivers/net/bnxt/tf_core/tf_tcam.c | 5 +- drivers/net/bnxt/tf_core/tf_tcam.h | 4 + drivers/net/bnxt/tf_core/tf_util.c | 55 ++++- drivers/net/bnxt/tf_core/tf_util.h | 32 +++ 14 files changed, 561 insertions(+), 93 deletions(-)
drivers/net/bnxt/tf_core/tf_device.c +28 -25
@@ -10,7 +10,7 @@struct tf ;/* Forward declarations */ -static int dev_unbind_p4 (struct tf *tfp); +static int tf_dev_unbind_p4 (struct tf *tfp);/** * Device specific bind function, WH+
@@ -32,10 +32,10 @@ static int dev_unbind_p4(struct tf *tfp);* - (-EINVAL) on parameter or internal failure. */ static int -dev_bind_p4 (struct tf *tfp, -bool shadow_copy, -struct tf_session_resources *resources, -struct tf_dev_info *dev_handle) +tf_dev_bind_p4 (struct tf *tfp, +bool shadow_copy, +struct tf_session_resources *resources, +struct tf_dev_info *dev_handle) {int rc;int frc;
@@ -93,7 +93,7 @@ dev_bind_p4(struct tf *tfp, fail:/* Cleanup of already created modules */ - frc =dev_unbind_p4 (tfp); + frc =tf_dev_unbind_p4 (tfp);if (frc)return frc;
@@ -111,7 +111,7 @@ dev_bind_p4(struct tf *tfp,* - (-EINVAL) on failure. */ static int -dev_unbind_p4 (struct tf *tfp) +tf_dev_unbind_p4 (struct tf *tfp) {int rc =0 ;bool fail = false;
@@ -119,25 +119,28 @@ dev_unbind_p4(struct tf *tfp)/* Unbind all the support modules. As this is only done on * close we only report errors as everything has to be cleaned * up regardless. +* +* In case of residuals TCAMs are cleaned up first as to +* invalidate the pipeline in a clean manner. */ - rc =tf_ident_unbind (tfp); + rc =tf_tcam_unbind (tfp);if (rc) {TFP_DRV_LOG (ERR , -"Device unbind failed, Identifier\n" ); +"Device unbind failed, TCAM\n" ); fail = true; } - rc =tf_tbl_unbind (tfp); + rc =tf_ident_unbind (tfp);if (rc) {TFP_DRV_LOG (ERR , -"Device unbind failed, Table Type\n" ); +"Device unbind failed, Identifier\n" ); fail = true; } - rc =tf_tcam_unbind (tfp); + rc =tf_tbl_unbind (tfp);if (rc) {TFP_DRV_LOG (ERR , -"Device unbind failed, TCAM\n" ); +"Device unbind failed, Table Type\n" ); fail = true; }
@@ -148,18 +151,18 @@ dev_unbind_p4(struct tf *tfp) }int -dev_bind(struct tf *tfp __rte_unused, -enum tf_device_type type, -bool shadow_copy, -struct tf_session_resources *resources, -struct tf_dev_info *dev_handle) +tf_dev_bind(struct tf *tfp __rte_unused, +enum tf_device_type type, +bool shadow_copy, +struct tf_session_resources *resources, +struct tf_dev_info *dev_handle) {switch (type) {case TF_DEVICE_TYPE_WH : -return dev_bind_p4 (tfp, - shadow_copy, - resources, - dev_handle); +return tf_dev_bind_p4 (tfp, + shadow_copy, + resources, + dev_handle);default :TFP_DRV_LOG (ERR ,"No such device\n" );
@@ -168,12 +171,12 @@ dev_bind(struct tf *tfp __rte_unused, }int -dev_unbind (struct tf *tfp, -struct tf_dev_info *dev_handle) +tf_dev_unbind (struct tf *tfp, +struct tf_dev_info *dev_handle) {switch (dev_handle->type) {case TF_DEVICE_TYPE_WH : -return dev_unbind_p4 (tfp); +return tf_dev_unbind_p4 (tfp);default :TFP_DRV_LOG (ERR ,"No such device\n" );
drivers/net/bnxt/tf_core/tf_device.h +18 -7
@@ -14,6 +14,17 @@struct tf ;struct tf_session ; +/** +* +*/ +enum tf_device_module_type { +TF_DEVICE_MODULE_TYPE_IDENTIFIER , +TF_DEVICE_MODULE_TYPE_TABLE , +TF_DEVICE_MODULE_TYPE_TCAM , +TF_DEVICE_MODULE_TYPE_EM , +TF_DEVICE_MODULE_TYPE_MAX +}; +/** * The Device module provides a general device template. A supported * device type should implement one or more of the listed function
@@ -60,11 +71,11 @@ struct tf_dev_info {* - (-EINVAL) parameter failure. * - (-ENODEV) no such device supported. */ -int dev_bind (struct tf *tfp, -enum tf_device_type type, -bool shadow_copy, -struct tf_session_resources *resources, -struct tf_dev_info *dev_handle); +int tf_dev_bind (struct tf *tfp, +enum tf_device_type type, +bool shadow_copy, +struct tf_session_resources *resources, +struct tf_dev_info *dev_handle);/** * Device release handles cleanup of the device specific information.
@@ -80,8 +91,8 @@ int dev_bind(struct tf *tfp,* - (-EINVAL) parameter failure. * - (-ENODEV) no such device supported. */ -int dev_unbind (struct tf *tfp, -struct tf_dev_info *dev_handle); +int tf_dev_unbind (struct tf *tfp, +struct tf_dev_info *dev_handle);/** * Truflow device specific function hooks structure
drivers/net/bnxt/tf_core/tf_device_p4.h +0 -1
@@ -77,5 +77,4 @@ struct tf_rm_element_cfg tf_tbl_p4[TF_TBL_TYPE_MAX] = {/* CFA_RESOURCE_TYPE_P4_EXT */ { TF_RM_ELEM_CFG_NULL, CFA_RESOURCE_TYPE_INVALID } }; -#endif /* _TF_DEVICE_P4_H_ */
drivers/net/bnxt/tf_core/tf_identifier.c +6 -4
@@ -39,12 +39,12 @@ tf_ident_bind(struct tf *tfp,return -EINVAL ; } + db_cfg.type =TF_DEVICE_MODULE_TYPE_IDENTIFIER ; db_cfg.num_elements = parms->num_elements; + db_cfg.cfg = parms->cfg;for (i =0 ; i <TF_DIR_MAX ; i++) { db_cfg.dir = i; - db_cfg.num_elements = parms->num_elements; - db_cfg.cfg = parms->cfg; db_cfg.alloc_cnt = parms->resources->ident_cnt[i].cnt; db_cfg.rm_db = &ident_db[i]; rc =tf_rm_create_db (tfp, &db_cfg);
@@ -86,8 +86,10 @@ tf_ident_unbind(struct tf *tfp __rte_unused) fparms.dir = i; fparms.rm_db = ident_db[i]; rc =tf_rm_free_db (tfp, &fparms); -if (rc) -return rc; +if (rc) { +TFP_DRV_LOG (ERR , +"rm free failed on unbind\n" ); + } ident_db[i] =NULL ; }
drivers/net/bnxt/tf_core/tf_msg.c +64 -3
79 lines not on this page · raw message
drivers/net/bnxt/tf_core/tf_msg.h +7 -0
@@ -181,6 +181,13 @@ int tf_msg_session_resc_alloc(struct tf *tfp,struct tf_rm_resc_req_entry *request, struct tf_rm_resc_entry *resv); +/** +* Sends session resource flush request to TF Firmware +*/ +int tf_msg_session_resc_flush (struct tf *tfp, +enum tf_dir dir, +uint16_t size, +struct tf_rm_resc_entry *resv);/** * Sends EM internal insert request to Firmware */
drivers/net/bnxt/tf_core/tf_rm_new.c +273 -14
370 lines not on this page · raw message
drivers/net/bnxt/tf_core/tf_rm_new.h +42 -3
80 lines not on this page · raw message
drivers/net/bnxt/tf_core/tf_session.c +36 -22
82 lines not on this page · raw message
drivers/net/bnxt/tf_core/tf_tbl_type.c +3 -2
@@ -51,11 +51,12 @@ tf_tbl_bind(struct tf *tfp, } db_cfg.num_elements = parms->num_elements; + db_cfg.type =TF_DEVICE_MODULE_TYPE_TABLE ; + db_cfg.num_elements = parms->num_elements; + db_cfg.cfg = parms->cfg;for (i =0 ; i <TF_DIR_MAX ; i++) { db_cfg.dir = i; - db_cfg.num_elements = parms->num_elements; - db_cfg.cfg = parms->cfg; db_cfg.alloc_cnt = parms->resources->tbl_cnt[i].cnt; db_cfg.rm_db = &tbl_db[i]; rc =tf_rm_create_db (tfp, &db_cfg);
drivers/net/bnxt/tf_core/tf_tcam.c +3 -2
@@ -54,11 +54,12 @@ tf_tcam_bind(struct tf *tfp, } db_cfg.num_elements = parms->num_elements; + db_cfg.type =TF_DEVICE_MODULE_TYPE_TCAM ; + db_cfg.num_elements = parms->num_elements; + db_cfg.cfg = parms->cfg;for (i =0 ; i <TF_DIR_MAX ; i++) { db_cfg.dir = i; - db_cfg.num_elements = parms->num_elements; - db_cfg.cfg = parms->cfg; db_cfg.alloc_cnt = parms->resources->tcam_cnt[i].cnt; db_cfg.rm_db = &tcam_db[i]; rc =tf_rm_create_db (tfp, &db_cfg);
drivers/net/bnxt/tf_core/tf_tcam.h +4 -0
@@ -146,6 +146,10 @@ struct tf_tcam_set_parms {* [in] Type of object to set */ enum tf_tcam_tbl_type type; +/** +* [in] Type of HCAPI +*/ +uint16_t hcapi_type;/** * [in] Entry index to write to */
drivers/net/bnxt/tf_core/tf_util.c +45 -10
88 lines not on this page · raw message
drivers/net/bnxt/tf_core/tf_util.h +32 -0
@@ -7,6 +7,7 @@#define _TF_UTIL_H_#include "tf_core.h" +#include "tf_device.h" /** * Helper function converting direction to text string
@@ -63,4 +64,35 @@ const char *tf_tbl_type_2_str(enum tf_tbl_type tbl_type);*/ const char *tf_em_tbl_type_2_str (enum tf_em_tbl_type em_type); +/** +* Helper function converting device module type and module type to +* text string. +* +* [in] dm_type +* Device Module type +* +* [in] mod_type +* Module specific type +* +* Returns: +* Pointer to a char string holding the string for the EM type +*/ +const char *tf_device_module_type_subtype_2_str + (enum tf_device_module_type dm_type, +uint16_t mod_type); + +/** +* Helper function converting device module type to text string +* +* [in] dm_type +* Device Module type +* +* [in] mod_type +* Module specific type +* +* Returns: +* Pointer to a char string holding the string for the EM type +*/ +const char *tf_device_module_type_2_str (enum tf_device_module_type dm_type); +#endif /* _TF_UTIL_H_ */
Signature · 1 line
2.21.1 (Apple Git-122.3)
PATCH v5 21/51 net/bnxt: support two level priority for TCAMs
In reply to Ajit KhapardeFrom: Jay Ding <[email protected]>
Allow TCAM indexes to be allocated from top or bottom. If the priority is set to 0, allocate from the lowest tcam indexes i.e. from top. Any other value, allocate it from the highest tcam indexes i.e. from bottom.
--- drivers/net/bnxt/tf_core/bitalloc.c | 107 +++++++++++++++++++++++++++ drivers/net/bnxt/tf_core/bitalloc.h | 5 ++ drivers/net/bnxt/tf_core/tf_rm_new.c | 9 ++- drivers/net/bnxt/tf_core/tf_rm_new.h | 8 ++ drivers/net/bnxt/tf_core/tf_tcam.c | 1 + 5 files changed, 129 insertions(+), 1 deletion(-)
drivers/net/bnxt/tf_core/bitalloc.c +107 -0
@@ -7,6 +7,40 @@#define BITALLOC_MAX_LEVELS 6 + +/* Finds the last bit set plus 1, equivalent to gcc __builtin_fls */ +static int +ba_fls (bitalloc_word_t v) +{ +int c =32 ; + +if (!v) +return 0 ; + +if (!(v &0xFFFF0000u )) { + v <<=16 ; + c -=16 ; + } +if (!(v &0xFF000000u )) { + v <<=8 ; + c -=8 ; + } +if (!(v &0xF0000000u )) { + v <<=4 ; + c -=4 ; + } +if (!(v &0xC0000000u )) { + v <<=2 ; + c -=2 ; + } +if (!(v &0x80000000u )) { + v <<=1 ; + c -=1 ; + } + +return c; +} +/* Finds the first bit set plus 1, equivalent to gcc __builtin_ffs */ static int ba_ffs (bitalloc_word_t v)
@@ -120,6 +154,79 @@ ba_alloc(struct bitalloc *pool)return ba_alloc_helper (pool,0 ,1 ,32 ,0 , &clear); } +/** +* Help function to alloc entry from highest available index +* +* Searching the pool from highest index for the empty entry. +* +* [in] pool +* Pointer to the resource pool +* +* [in] offset +* Offset of the storage in the pool +* +* [in] words +* Number of words in this level +* +* [in] size +* Number of entries in this level +* +* [in] index +* Index of words that has the entry +* +* [in] clear +* Indicate if a bit needs to be clear due to the entry is allocated +* +* Returns: +* 0 - Success +* -1 - Failure +*/ +static int +ba_alloc_reverse_helper (struct bitalloc *pool, +int offset, +int words, +unsigned int size, +int index, +int *clear) +{ +bitalloc_word_t *storage = &pool->storage[offset]; +int loc =ba_fls (storage[index]); +int r; + +if (loc ==0 ) +return -1 ; + + loc--; + +if (pool->size > size) { + r =ba_alloc_reverse_helper (pool, + offset + words +1 , + storage[words], + size *32 , + index *32 + loc, + clear); + }else { + r = index *32 + loc; + *clear =1 ; + pool->free_count--; + } + +if (*clear) { + storage[index] &= ~(1 << loc); + *clear = (storage[index] ==0 ); + } + +return r; +} + +int +ba_alloc_reverse (struct bitalloc *pool) +{ +int clear =0 ; + +return ba_alloc_reverse_helper (pool,0 ,1 ,32 ,0 , &clear); +} + static int ba_alloc_index_helper(struct bitalloc *pool, int offset,
drivers/net/bnxt/tf_core/bitalloc.h +5 -0
@@ -72,6 +72,11 @@ int ba_init(struct bitalloc *pool, int size);int ba_alloc (struct bitalloc *pool);int ba_alloc_index (struct bitalloc *pool,int index); +/** +* Returns -1 on failure, or index of allocated entry +*/ +int ba_alloc_reverse (struct bitalloc *pool); +/** * Query a particular index in a pool to check if its in use. *
drivers/net/bnxt/tf_core/tf_rm_new.c +8 -1
@@ -671,7 +671,14 @@ tf_rm_allocate(struct tf_rm_allocate_parms *parms)return rc; } - id =ba_alloc (rm_db->db[parms->db_index].pool); +/* +* priority 0: allocate from top of the tcam i.e. high +* priority !0: allocate index from bottom i.e lowest +*/ +if (parms->priority) + id =ba_alloc_reverse (rm_db->db[parms->db_index].pool); +else + id =ba_alloc (rm_db->db[parms->db_index].pool);if (id ==BA_FAIL ) { rc = -ENOMEM ; TFP_DRV_LOG(ERR,
drivers/net/bnxt/tf_core/tf_rm_new.h +8 -0
@@ -185,6 +185,14 @@ struct tf_rm_allocate_parms {* i.e. Full Action Record offsets. */ uint32_t *index; +/** +* [in] Priority, indicates the prority of the entry +* priority 0: allocate from top of the tcam (from index 0 +* or lowest available index) +* priority !0: allocate from bottom of the tcam (from highest +* available index) +*/ +uint32_t priority; };/**
drivers/net/bnxt/tf_core/tf_tcam.c +1 -0
@@ -157,6 +157,7 @@ tf_tcam_alloc(struct tf *tfp,/* Allocate requested element */ aparms.rm_db = tcam_db[parms->dir]; aparms.db_index = parms->type; + aparms.priority = parms->priority; aparms.index = (uint32_t *)&parms->idx; rc =tf_rm_allocate (&aparms);if (rc) {
Signature · 1 line
2.21.1 (Apple Git-122.3)
PATCH v5 22/51 net/bnxt: use table scope for EM and TCAM lookup
In reply to Ajit KhapardeFrom: Peter Spreadborough <[email protected]>
- Support for table scope within the EM module
- Support for host and system memory
- Update TCAM set/free.
- Replace TF device type by HCAPI RM type.
- Update TCAM set and free for HCAPI RM type
--- drivers/net/bnxt/meson.build | 5 +- drivers/net/bnxt/tf_core/Makefile | 5 +- drivers/net/bnxt/tf_core/cfa_resource_types.h | 8 +- drivers/net/bnxt/tf_core/hwrm_tf.h | 864 +----------- drivers/net/bnxt/tf_core/tf_core.c | 100 +- drivers/net/bnxt/tf_core/tf_device.c | 50 +- drivers/net/bnxt/tf_core/tf_device.h | 86 +- drivers/net/bnxt/tf_core/tf_device_p4.c | 14 +- drivers/net/bnxt/tf_core/tf_device_p4.h | 20 +- drivers/net/bnxt/tf_core/tf_em.c | 360 ----- drivers/net/bnxt/tf_core/tf_em.h | 310 +++- drivers/net/bnxt/tf_core/tf_em_common.c | 281 ++++ drivers/net/bnxt/tf_core/tf_em_common.h | 107 ++ drivers/net/bnxt/tf_core/tf_em_host.c | 1146 +++++++++++++++ drivers/net/bnxt/tf_core/tf_em_internal.c | 312 +++++ drivers/net/bnxt/tf_core/tf_em_system.c | 118 ++ drivers/net/bnxt/tf_core/tf_msg.c | 1248 ++++------------- drivers/net/bnxt/tf_core/tf_msg.h | 233 +-- drivers/net/bnxt/tf_core/tf_rm.c | 89 +- drivers/net/bnxt/tf_core/tf_rm_new.c | 40 +- drivers/net/bnxt/tf_core/tf_tbl.c | 1134 --------------- drivers/net/bnxt/tf_core/tf_tbl_type.c | 39 +- drivers/net/bnxt/tf_core/tf_tcam.c | 25 +- drivers/net/bnxt/tf_core/tf_tcam.h | 4 + drivers/net/bnxt/tf_core/tf_util.c | 4 +- 25 files changed, 3030 insertions(+), 3572 deletions(-) delete mode 100644 drivers/net/bnxt/tf_core/tf_em.c create mode 100644 drivers/net/bnxt/tf_core/tf_em_common.c create mode 100644 drivers/net/bnxt/tf_core/tf_em_common.h create mode 100644 drivers/net/bnxt/tf_core/tf_em_host.c create mode 100644 drivers/net/bnxt/tf_core/tf_em_internal.c create mode 100644 drivers/net/bnxt/tf_core/tf_em_system.c
drivers/net/bnxt/meson.build +4 -1
@@ -28,7 +28,10 @@ sources = files('bnxt_cpr.c', 'tf_core/tf_msg.c', 'tf_core/rand.c', 'tf_core/stack.c', - 'tf_core/tf_em.c', + 'tf_core/tf_em_common.c', + 'tf_core/tf_em_host.c', + 'tf_core/tf_em_internal.c', + 'tf_core/tf_em_system.c', 'tf_core/tf_rm.c', 'tf_core/tf_tbl.c', 'tf_core/tfp.c',
drivers/net/bnxt/tf_core/Makefile +4 -1
@@ -12,8 +12,11 @@ SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += tf_core/tf_core.c SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += tf_core/tf_rm.c SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += tf_core/tfp.c SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += tf_core/tf_msg.c -SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += tf_core/tf_em.c SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += tf_core/tf_tbl.c +SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += tf_core/tf_em_common.c +SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += tf_core/tf_em_internal.c +SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += tf_core/tf_em_host.c +SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += tf_core/tf_em_system.c SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += tf_core/tf_session.c SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += tf_core/tf_device.c SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += tf_core/tf_device_p4.c
drivers/net/bnxt/tf_core/cfa_resource_types.h +6 -2
@@ -202,7 +202,9 @@#define CFA_RESOURCE_TYPE_P45_SP_TCAM 0x1fUL/* VEB TCAM */ #define CFA_RESOURCE_TYPE_P45_VEB_TCAM 0x20UL -#define CFA_RESOURCE_TYPE_P45_LAST CFA_RESOURCE_TYPE_P45_VEB_TCAM +/* Table Scope */ +#define CFA_RESOURCE_TYPE_P45_TBL_SCOPE 0x21UL +#define CFA_RESOURCE_TYPE_P45_LAST CFA_RESOURCE_TYPE_P45_TBL_SCOPE/* Multicast Group */
@@ -269,7 +271,9 @@#define CFA_RESOURCE_TYPE_P4_MIRROR 0x1eUL/* Source Property TCAM */ #define CFA_RESOURCE_TYPE_P4_SP_TCAM 0x1fUL -#define CFA_RESOURCE_TYPE_P4_LAST CFA_RESOURCE_TYPE_P4_SP_TCAM +/* Table Scope */ +#define CFA_RESOURCE_TYPE_P4_TBL_SCOPE 0x20UL +#define CFA_RESOURCE_TYPE_P4_LAST CFA_RESOURCE_TYPE_P4_TBL_SCOPE#endif /* _CFA_RESOURCE_TYPES_H_ */
drivers/net/bnxt/tf_core/hwrm_tf.h +1 -863
884 lines not on this page · raw message
drivers/net/bnxt/tf_core/tf_core.c +97 -3
121 lines not on this page · raw message
drivers/net/bnxt/tf_core/tf_device.c +46 -4
74 lines not on this page · raw message
drivers/net/bnxt/tf_core/tf_device.h +81 -5
109 lines not on this page · raw message
drivers/net/bnxt/tf_core/tf_device_p4.c +12 -2
@@ -93,6 +93,12 @@ const struct tf_dev_ops tf_dev_ops_p4_init = { .tf_dev_alloc_search_tcam = NULL, .tf_dev_set_tcam = NULL, .tf_dev_get_tcam = NULL, + .tf_dev_insert_int_em_entry = NULL, + .tf_dev_delete_int_em_entry = NULL, + .tf_dev_insert_ext_em_entry = NULL, + .tf_dev_delete_ext_em_entry = NULL, + .tf_dev_alloc_tbl_scope = NULL, + .tf_dev_free_tbl_scope = NULL, };/**
@@ -113,6 +119,10 @@ const struct tf_dev_ops tf_dev_ops_p4 = { .tf_dev_alloc_search_tcam = NULL, .tf_dev_set_tcam = tf_tcam_set, .tf_dev_get_tcam = NULL, - .tf_dev_insert_em_entry = tf_em_insert_entry, - .tf_dev_delete_em_entry = tf_em_delete_entry, + .tf_dev_insert_int_em_entry = tf_em_insert_int_entry, + .tf_dev_delete_int_em_entry = tf_em_delete_int_entry, + .tf_dev_insert_ext_em_entry = tf_em_insert_ext_entry, + .tf_dev_delete_ext_em_entry = tf_em_delete_ext_entry, + .tf_dev_alloc_tbl_scope = tf_em_ext_common_alloc, + .tf_dev_free_tbl_scope = tf_em_ext_common_free, };
drivers/net/bnxt/tf_core/tf_device_p4.h +16 -4
@@ -36,13 +36,12 @@ struct tf_rm_element_cfg tf_tbl_p4[TF_TBL_TYPE_MAX] = { { TF_RM_ELEM_CFG_HCAPI, CFA_RESOURCE_TYPE_P4_MCG }, { TF_RM_ELEM_CFG_HCAPI, CFA_RESOURCE_TYPE_P4_ENCAP_8B }, { TF_RM_ELEM_CFG_HCAPI, CFA_RESOURCE_TYPE_P4_ENCAP_16B }, -/* CFA_RESOURCE_TYPE_P4_SRAM_ENCAP_32B */ +/* CFA_RESOURCE_TYPE_P4_ENCAP_32B */ { TF_RM_ELEM_CFG_NULL, CFA_RESOURCE_TYPE_INVALID }, { TF_RM_ELEM_CFG_HCAPI, CFA_RESOURCE_TYPE_P4_ENCAP_64B }, { TF_RM_ELEM_CFG_HCAPI, CFA_RESOURCE_TYPE_P4_SP_MAC }, -/* CFA_RESOURCE_TYPE_P4_SRAM_SP_SMAC_IPV4 */ - { TF_RM_ELEM_CFG_NULL, CFA_RESOURCE_TYPE_INVALID }, -/* CFA_RESOURCE_TYPE_P4_SRAM_SP_SMAC_IPV6 */ + { TF_RM_ELEM_CFG_HCAPI, CFA_RESOURCE_TYPE_P4_SP_MAC_IPV4 }, +/* CFA_RESOURCE_TYPE_P4_SP_MAC_IPV6 */ { TF_RM_ELEM_CFG_NULL, CFA_RESOURCE_TYPE_INVALID }, { TF_RM_ELEM_CFG_HCAPI, CFA_RESOURCE_TYPE_P4_COUNTER_64B }, { TF_RM_ELEM_CFG_HCAPI, CFA_RESOURCE_TYPE_P4_NAT_SPORT },
@@ -77,4 +76,17 @@ struct tf_rm_element_cfg tf_tbl_p4[TF_TBL_TYPE_MAX] = {/* CFA_RESOURCE_TYPE_P4_EXT */ { TF_RM_ELEM_CFG_NULL, CFA_RESOURCE_TYPE_INVALID } }; + +struct tf_rm_element_cfg tf_em_ext_p4[TF_EM_TBL_TYPE_MAX ] = { +/* CFA_RESOURCE_TYPE_P4_EM_REC */ + {TF_RM_ELEM_CFG_NULL ,CFA_RESOURCE_TYPE_INVALID }, + {TF_RM_ELEM_CFG_HCAPI ,CFA_RESOURCE_TYPE_P4_TBL_SCOPE }, +}; + +struct tf_rm_element_cfg tf_em_int_p4[TF_EM_TBL_TYPE_MAX ] = { + {TF_RM_ELEM_CFG_HCAPI ,CFA_RESOURCE_TYPE_P4_EM_REC }, +/* CFA_RESOURCE_TYPE_P4_TBL_SCOPE */ + {TF_RM_ELEM_CFG_NULL ,CFA_RESOURCE_TYPE_INVALID }, +}; +#endif /* _TF_DEVICE_P4_H_ */
drivers/net/bnxt/tf_core/tf_em.c deleted +0 -360
360 lines not on this page · raw message
drivers/net/bnxt/tf_core/tf_em.h +292 -18
339 lines not on this page · raw message
drivers/net/bnxt/tf_core/tf_em_common.c new file +281 -0
281 lines not on this page · raw message
drivers/net/bnxt/tf_core/tf_em_common.h new file +107 -0
107 lines not on this page · raw message
drivers/net/bnxt/tf_core/tf_em_host.c new file +1146 -0
625 lines not on this page · raw message
drivers/net/bnxt/tf_core/tf_em_internal.c new file +312 -0
312 lines not on this page · raw message
drivers/net/bnxt/tf_core/tf_em_system.c new file +118 -0
118 lines not on this page · raw message
drivers/net/bnxt/tf_core/tf_msg.c +251 -997
1,248 lines not on this page · raw message
drivers/net/bnxt/tf_core/tf_msg.h +154 -79
233 lines not on this page · raw message
drivers/net/bnxt/tf_core/tf_rm.c +2 -87
89 lines not on this page · raw message
drivers/net/bnxt/tf_core/tf_tbl.c +0 -1134
1,134 lines not on this page · raw message
drivers/net/bnxt/tf_core/tf_tbl_type.c +35 -4
Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
Signature · 1 line
2.21.1 (Apple Git-122.3)
Part of the diff is not shown here. View the raw message.
PATCH v5 23/51 net/bnxt: update table get to use new design
In reply to Ajit KhapardeFrom: Michael Wildt <[email protected]>
- Move bulk table get implementation to new Tbl Module design.
- Update messages for bulk table get
- Retrieve specified table element using bulk mechanism
- Remove deprecated resource definitions
- Update device type configuration for P4.
- Update RM DB HCAPI count check and fix EM internal and host code such that EM DBs can be created correctly.
- Update error logging to be info on unbind in the different modules.
- Move RTE RSVD out of tf_resources.h
--- drivers/net/bnxt/hcapi/cfa_p40_tbl.h | 250 ++ drivers/net/bnxt/hcapi/hcapi_cfa.h | 2 + drivers/net/bnxt/meson.build | 3 +- drivers/net/bnxt/tf_core/Makefile | 2 - drivers/net/bnxt/tf_core/tf_common.h | 55 +- drivers/net/bnxt/tf_core/tf_core.c | 86 +- drivers/net/bnxt/tf_core/tf_device.h | 24 +- drivers/net/bnxt/tf_core/tf_device_p4.c | 4 +- drivers/net/bnxt/tf_core/tf_device_p4.h | 5 +- drivers/net/bnxt/tf_core/tf_em.h | 88 +- drivers/net/bnxt/tf_core/tf_em_common.c | 29 +- drivers/net/bnxt/tf_core/tf_em_internal.c | 59 +- drivers/net/bnxt/tf_core/tf_identifier.c | 14 +- drivers/net/bnxt/tf_core/tf_msg.c | 31 +- drivers/net/bnxt/tf_core/tf_msg.h | 8 +- drivers/net/bnxt/tf_core/tf_resources.h | 529 --- drivers/net/bnxt/tf_core/tf_rm.c | 3695 ++++----------------- drivers/net/bnxt/tf_core/tf_rm.h | 539 +-- drivers/net/bnxt/tf_core/tf_rm_new.c | 907 ----- drivers/net/bnxt/tf_core/tf_rm_new.h | 446 --- drivers/net/bnxt/tf_core/tf_session.h | 214 +- drivers/net/bnxt/tf_core/tf_tbl.c | 478 ++- drivers/net/bnxt/tf_core/tf_tbl.h | 436 ++- drivers/net/bnxt/tf_core/tf_tbl_type.c | 342 -- drivers/net/bnxt/tf_core/tf_tbl_type.h | 318 -- drivers/net/bnxt/tf_core/tf_tcam.c | 15 +- 26 files changed, 2337 insertions(+), 6242 deletions(-) create mode 100644 drivers/net/bnxt/hcapi/cfa_p40_tbl.h delete mode 100644 drivers/net/bnxt/tf_core/tf_rm_new.c delete mode 100644 drivers/net/bnxt/tf_core/tf_rm_new.h delete mode 100644 drivers/net/bnxt/tf_core/tf_tbl_type.c delete mode 100644 drivers/net/bnxt/tf_core/tf_tbl_type.h
drivers/net/bnxt/hcapi/cfa_p40_tbl.h new file +250 -0
@@ -0,0 +1,250 @@ +/* SPDX-License-Identifier: BSD-3-Clause +* Copyright(c) 2019-2020 Broadcom +* All rights reserved. +*/ +/* +* Name: cfa_p40_tbl.h +* +* Description: header for SWE based on Truflow +* +* Date: 12/16/19 17:18:12 +* +* Note: This file was originally generated by tflib_decode.py. +* Remainder is hand coded due to lack of availability of xml for +* addtional tables at this time (EEM Record and union fields) +* +**/ +#ifndef _CFA_P40_TBL_H_ +#define _CFA_P40_TBL_H_ + +#include "cfa_p40_hw.h" + +#include "hcapi_cfa_defs.h" + +const struct hcapi_cfa_field cfa_p40_prof_l2_ctxt_tcam_layout[] = { + {CFA_P40_PROF_L2_CTXT_TCAM_VALID_BITPOS , +CFA_P40_PROF_L2_CTXT_TCAM_VALID_NUM_BITS }, + {CFA_P40_PROF_L2_CTXT_TCAM_KEY_TYPE_BITPOS , +CFA_P40_PROF_L2_CTXT_TCAM_KEY_TYPE_NUM_BITS }, + {CFA_P40_PROF_L2_CTXT_TCAM_TUN_HDR_TYPE_BITPOS , +CFA_P40_PROF_L2_CTXT_TCAM_TUN_HDR_TYPE_NUM_BITS }, + {CFA_P40_PROF_L2_CTXT_TCAM_T_L2_NUMTAGS_BITPOS , +CFA_P40_PROF_L2_CTXT_TCAM_T_L2_NUMTAGS_NUM_BITS }, + {CFA_P40_PROF_L2_CTXT_TCAM_L2_NUMTAGS_BITPOS , +CFA_P40_PROF_L2_CTXT_TCAM_L2_NUMTAGS_NUM_BITS }, + {CFA_P40_PROF_L2_CTXT_TCAM_MAC1_BITPOS , +CFA_P40_PROF_L2_CTXT_TCAM_MAC1_NUM_BITS }, + {CFA_P40_PROF_L2_CTXT_TCAM_T_OVID_BITPOS , +CFA_P40_PROF_L2_CTXT_TCAM_T_OVID_NUM_BITS }, + {CFA_P40_PROF_L2_CTXT_TCAM_T_IVID_BITPOS , +CFA_P40_PROF_L2_CTXT_TCAM_T_IVID_NUM_BITS }, + {CFA_P40_PROF_L2_CTXT_TCAM_SPARIF_BITPOS , +CFA_P40_PROF_L2_CTXT_TCAM_SPARIF_NUM_BITS }, + {CFA_P40_PROF_L2_CTXT_TCAM_SVIF_BITPOS , +CFA_P40_PROF_L2_CTXT_TCAM_SVIF_NUM_BITS }, + {CFA_P40_PROF_L2_CTXT_TCAM_MAC0_BITPOS , +CFA_P40_PROF_L2_CTXT_TCAM_MAC0_NUM_BITS }, + {CFA_P40_PROF_L2_CTXT_TCAM_OVID_BITPOS , +CFA_P40_PROF_L2_CTXT_TCAM_OVID_NUM_BITS }, + {CFA_P40_PROF_L2_CTXT_TCAM_IVID_BITPOS , +CFA_P40_PROF_L2_CTXT_TCAM_IVID_NUM_BITS }, +}; + +const struct hcapi_cfa_field cfa_p40_act_veb_tcam_layout[] = { + {CFA_P40_ACT_VEB_TCAM_VALID_BITPOS , +CFA_P40_ACT_VEB_TCAM_VALID_NUM_BITS }, + {CFA_P40_ACT_VEB_TCAM_RESERVED_BITPOS , +CFA_P40_ACT_VEB_TCAM_RESERVED_NUM_BITS }, + {CFA_P40_ACT_VEB_TCAM_PARIF_IN_BITPOS , +CFA_P40_ACT_VEB_TCAM_PARIF_IN_NUM_BITS }, + {CFA_P40_ACT_VEB_TCAM_NUM_VTAGS_BITPOS , +CFA_P40_ACT_VEB_TCAM_NUM_VTAGS_NUM_BITS }, + {CFA_P40_ACT_VEB_TCAM_MAC_BITPOS , +CFA_P40_ACT_VEB_TCAM_MAC_NUM_BITS }, + {CFA_P40_ACT_VEB_TCAM_OVID_BITPOS , +CFA_P40_ACT_VEB_TCAM_OVID_NUM_BITS }, + {CFA_P40_ACT_VEB_TCAM_IVID_BITPOS , +CFA_P40_ACT_VEB_TCAM_IVID_NUM_BITS }, +}; + +const struct hcapi_cfa_field cfa_p40_lkup_tcam_record_mem_layout[] = { + {CFA_P40_LKUP_TCAM_RECORD_MEM_VALID_BITPOS , +CFA_P40_LKUP_TCAM_RECORD_MEM_VALID_NUM_BITS }, + {CFA_P40_LKUP_TCAM_RECORD_MEM_ACT_REC_PTR_BITPOS , +CFA_P40_LKUP_TCAM_RECORD_MEM_ACT_REC_PTR_NUM_BITS }, + {CFA_P40_LKUP_TCAM_RECORD_MEM_STRENGTH_BITPOS , +CFA_P40_LKUP_TCAM_RECORD_MEM_STRENGTH_NUM_BITS }, +}; + +const struct hcapi_cfa_field cfa_p40_prof_ctxt_remap_mem_layout[] = { + {CFA_P40_PROF_CTXT_REMAP_MEM_TPID_ANTI_SPOOF_CTL_BITPOS , +CFA_P40_PROF_CTXT_REMAP_MEM_TPID_ANTI_SPOOF_CTL_NUM_BITS }, + {CFA_P40_PROF_CTXT_REMAP_MEM_PRI_ANTI_SPOOF_CTL_BITPOS , +CFA_P40_PROF_CTXT_REMAP_MEM_PRI_ANTI_SPOOF_CTL_NUM_BITS }, + {CFA_P40_PROF_CTXT_REMAP_MEM_BYP_SP_LKUP_BITPOS , +CFA_P40_PROF_CTXT_REMAP_MEM_BYP_SP_LKUP_NUM_BITS }, + {CFA_P40_PROF_CTXT_REMAP_MEM_SP_REC_PTR_BITPOS , +CFA_P40_PROF_CTXT_REMAP_MEM_SP_REC_PTR_NUM_BITS }, + {CFA_P40_PROF_CTXT_REMAP_MEM_BD_ACT_EN_BITPOS , +CFA_P40_PROF_CTXT_REMAP_MEM_BD_ACT_EN_NUM_BITS }, + {CFA_P40_PROF_CTXT_REMAP_MEM_DEFAULT_TPID_BITPOS , +CFA_P40_PROF_CTXT_REMAP_MEM_DEFAULT_TPID_NUM_BITS }, + {CFA_P40_PROF_CTXT_REMAP_MEM_ALLOWED_TPID_BITPOS , +CFA_P40_PROF_CTXT_REMAP_MEM_ALLOWED_TPID_NUM_BITS }, + {CFA_P40_PROF_CTXT_REMAP_MEM_DEFAULT_PRI_BITPOS , +CFA_P40_PROF_CTXT_REMAP_MEM_DEFAULT_PRI_NUM_BITS }, + {CFA_P40_PROF_CTXT_REMAP_MEM_ALLOWED_PRI_BITPOS , +CFA_P40_PROF_CTXT_REMAP_MEM_ALLOWED_PRI_NUM_BITS }, + {CFA_P40_PROF_CTXT_REMAP_MEM_PARIF_BITPOS , +CFA_P40_PROF_CTXT_REMAP_MEM_PARIF_NUM_BITS }, + {CFA_P40_PROF_CTXT_REMAP_MEM_BYP_LKUP_EN_BITPOS , +CFA_P40_PROF_CTXT_REMAP_MEM_BYP_LKUP_EN_NUM_BITS }, +/* Fields below not generated through automation */ + {CFA_P40_PROF_CTXT_REMAP_MEM_PROF_VNIC_BITPOS , +CFA_P40_PROF_CTXT_REMAP_MEM_PROF_VNIC_NUM_BITS }, + {CFA_P40_PROF_CTXT_REMAP_MEM_PROF_FUNC_BITPOS , +CFA_P40_PROF_CTXT_REMAP_MEM_PROF_FUNC_NUM_BITS }, + {CFA_P40_PROF_CTXT_REMAP_MEM_L2_CTXT_BITPOS , +CFA_P40_PROF_CTXT_REMAP_MEM_L2_CTXT_NUM_BITS }, + {CFA_P40_PROF_CTXT_REMAP_MEM_ARP_BITPOS , +CFA_P40_PROF_CTXT_REMAP_MEM_ARP_NUM_BITS }, +}; + +const struct hcapi_cfa_field cfa_p40_prof_profile_tcam_remap_mem_layout[] = { + {CFA_P40_PROF_PROFILE_TCAM_REMAP_MEM_PL_BYP_LKUP_EN_BITPOS , +CFA_P40_PROF_PROFILE_TCAM_REMAP_MEM_PL_BYP_LKUP_EN_NUM_BITS }, + {CFA_P40_PROF_PROFILE_TCAM_REMAP_MEM_EM_SEARCH_ENB_BITPOS , +CFA_P40_PROF_PROFILE_TCAM_REMAP_MEM_EM_SEARCH_ENB_NUM_BITS }, + {CFA_P40_PROF_PROFILE_TCAM_REMAP_MEM_EM_PROFILE_ID_BITPOS , +CFA_P40_PROF_PROFILE_TCAM_REMAP_MEM_EM_PROFILE_ID_NUM_BITS }, + {CFA_P40_PROF_PROFILE_TCAM_REMAP_MEM_EM_KEY_ID_BITPOS , +CFA_P40_PROF_PROFILE_TCAM_REMAP_MEM_EM_KEY_ID_NUM_BITS }, + {CFA_P40_PROF_PROFILE_TCAM_REMAP_MEM_EM_KEY_MASK_BITPOS , +CFA_P40_PROF_PROFILE_TCAM_REMAP_MEM_EM_KEY_MASK_NUM_BITS }, + {CFA_P40_PROF_PROFILE_TCAM_REMAP_MEM_TCAM_SEARCH_ENB_BITPOS , +CFA_P40_PROF_PROFILE_TCAM_REMAP_MEM_TCAM_SEARCH_ENB_NUM_BITS }, + {CFA_P40_PROF_PROFILE_TCAM_REMAP_MEM_TCAM_PROFILE_ID_BITPOS , +CFA_P40_PROF_PROFILE_TCAM_REMAP_MEM_TCAM_PROFILE_ID_NUM_BITS }, + {CFA_P40_PROF_PROFILE_TCAM_REMAP_MEM_TCAM_KEY_ID_BITPOS , +CFA_P40_PROF_PROFILE_TCAM_REMAP_MEM_TCAM_KEY_ID_NUM_BITS }, +}; + +const struct hcapi_cfa_field cfa_p40_prof_profile_tcam_layout[] = { + {CFA_P40_PROF_PROFILE_TCAM_VALID_BITPOS , +CFA_P40_PROF_PROFILE_TCAM_VALID_NUM_BITS }, + {CFA_P40_PROF_PROFILE_TCAM_PKT_TYPE_BITPOS , +CFA_P40_PROF_PROFILE_TCAM_PKT_TYPE_NUM_BITS }, + {CFA_P40_PROF_PROFILE_TCAM_RECYCLE_CNT_BITPOS , +CFA_P40_PROF_PROFILE_TCAM_RECYCLE_CNT_NUM_BITS }, + {CFA_P40_PROF_PROFILE_TCAM_AGG_ERROR_BITPOS , +CFA_P40_PROF_PROFILE_TCAM_AGG_ERROR_NUM_BITS }, + {CFA_P40_PROF_PROFILE_TCAM_PROF_FUNC_BITPOS , +CFA_P40_PROF_PROFILE_TCAM_PROF_FUNC_NUM_BITS }, + {CFA_P40_PROF_PROFILE_TCAM_RESERVED_BITPOS , +CFA_P40_PROF_PROFILE_TCAM_RESERVED_NUM_BITS }, + {CFA_P40_PROF_PROFILE_TCAM_HREC_NEXT_BITPOS , +CFA_P40_PROF_PROFILE_TCAM_HREC_NEXT_NUM_BITS }, + {CFA_P40_PROF_PROFILE_TCAM_TL2_HDR_VALID_BITPOS , +CFA_P40_PROF_PROFILE_TCAM_TL2_HDR_VALID_NUM_BITS }, + {CFA_P40_PROF_PROFILE_TCAM_TL2_HDR_TYPE_BITPOS , +CFA_P40_PROF_PROFILE_TCAM_TL2_HDR_TYPE_NUM_BITS }, + {CFA_P40_PROF_PROFILE_TCAM_TL2_UC_MC_BC_BITPOS , +CFA_P40_PROF_PROFILE_TCAM_TL2_UC_MC_BC_NUM_BITS }, + {CFA_P40_PROF_PROFILE_TCAM_TL2_VTAG_PRESENT_BITPOS , +CFA_P40_PROF_PROFILE_TCAM_TL2_VTAG_PRESENT_NUM_BITS }, + {CFA_P40_PROF_PROFILE_TCAM_TL2_TWO_VTAGS_BITPOS , +CFA_P40_PROF_PROFILE_TCAM_TL2_TWO_VTAGS_NUM_BITS }, + {CFA_P40_PROF_PROFILE_TCAM_TL3_VALID_BITPOS , +CFA_P40_PROF_PROFILE_TCAM_TL3_VALID_NUM_BITS }, + {CFA_P40_PROF_PROFILE_TCAM_TL3_ERROR_BITPOS , +CFA_P40_PROF_PROFILE_TCAM_TL3_ERROR_NUM_BITS }, + {CFA_P40_PROF_PROFILE_TCAM_TL3_HDR_TYPE_BITPOS , +CFA_P40_PROF_PROFILE_TCAM_TL3_HDR_TYPE_NUM_BITS }, + {CFA_P40_PROF_PROFILE_TCAM_TL3_HDR_ISIP_BITPOS , +CFA_P40_PROF_PROFILE_TCAM_TL3_HDR_ISIP_NUM_BITS }, + {CFA_P40_PROF_PROFILE_TCAM_TL3_IPV6_CMP_SRC_BITPOS , +CFA_P40_PROF_PROFILE_TCAM_TL3_IPV6_CMP_SRC_NUM_BITS }, + {CFA_P40_PROF_PROFILE_TCAM_TL3_IPV6_CMP_DEST_BITPOS , +CFA_P40_PROF_PROFILE_TCAM_TL3_IPV6_CMP_DEST_NUM_BITS }, + {CFA_P40_PROF_PROFILE_TCAM_TL4_HDR_VALID_BITPOS , +CFA_P40_PROF_PROFILE_TCAM_TL4_HDR_VALID_NUM_BITS }, + {CFA_P40_PROF_PROFILE_TCAM_TL4_HDR_ERROR_BITPOS , +CFA_P40_PROF_PROFILE_TCAM_TL4_HDR_ERROR_NUM_BITS }, + {CFA_P40_PROF_PROFILE_TCAM_TL4_HDR_TYPE_BITPOS , +CFA_P40_PROF_PROFILE_TCAM_TL4_HDR_TYPE_NUM_BITS }, + {CFA_P40_PROF_PROFILE_TCAM_TL4_HDR_IS_UDP_TCP_BITPOS , +CFA_P40_PROF_PROFILE_TCAM_TL4_HDR_IS_UDP_TCP_NUM_BITS }, + {CFA_P40_PROF_PROFILE_TCAM_TUN_HDR_VALID_BITPOS , +CFA_P40_PROF_PROFILE_TCAM_TUN_HDR_VALID_NUM_BITS }, + {CFA_P40_PROF_PROFILE_TCAM_TUN_HDR_ERR_BITPOS , +CFA_P40_PROF_PROFILE_TCAM_TUN_HDR_ERR_NUM_BITS }, + {CFA_P40_PROF_PROFILE_TCAM_TUN_HDR_TYPE_BITPOS , +CFA_P40_PROF_PROFILE_TCAM_TUN_HDR_TYPE_NUM_BITS }, + {CFA_P40_PROF_PROFILE_TCAM_TUN_HDR_FLAGS_BITPOS , +CFA_P40_PROF_PROFILE_TCAM_TUN_HDR_FLAGS_NUM_BITS }, + {CFA_P40_PROF_PROFILE_TCAM_L2_HDR_VALID_BITPOS , +CFA_P40_PROF_PROFILE_TCAM_L2_HDR_VALID_NUM_BITS }, + {CFA_P40_PROF_PROFILE_TCAM_L2_HDR_ERROR_BITPOS , +CFA_P40_PROF_PROFILE_TCAM_L2_HDR_ERROR_NUM_BITS }, + {CFA_P40_PROF_PROFILE_TCAM_L2_HDR_TYPE_BITPOS , +CFA_P40_PROF_PROFILE_TCAM_L2_HDR_TYPE_NUM_BITS }, + {CFA_P40_PROF_PROFILE_TCAM_L2_UC_MC_BC_BITPOS , +CFA_P40_PROF_PROFILE_TCAM_L2_UC_MC_BC_NUM_BITS }, + {CFA_P40_PROF_PROFILE_TCAM_L2_VTAG_PRESENT_BITPOS , +CFA_P40_PROF_PROFILE_TCAM_L2_VTAG_PRESENT_NUM_BITS }, + {CFA_P40_PROF_PROFILE_TCAM_L2_TWO_VTAGS_BITPOS , +CFA_P40_PROF_PROFILE_TCAM_L2_TWO_VTAGS_NUM_BITS }, + {CFA_P40_PROF_PROFILE_TCAM_L3_VALID_BITPOS , +CFA_P40_PROF_PROFILE_TCAM_L3_VALID_NUM_BITS }, + {CFA_P40_PROF_PROFILE_TCAM_L3_ERROR_BITPOS , +CFA_P40_PROF_PROFILE_TCAM_L3_ERROR_NUM_BITS }, + {CFA_P40_PROF_PROFILE_TCAM_L3_HDR_TYPE_BITPOS , +CFA_P40_PROF_PROFILE_TCAM_L3_HDR_TYPE_NUM_BITS }, + {CFA_P40_PROF_PROFILE_TCAM_L3_HDR_ISIP_BITPOS , +CFA_P40_PROF_PROFILE_TCAM_L3_HDR_ISIP_NUM_BITS }, + {CFA_P40_PROF_PROFILE_TCAM_L3_IPV6_CMP_SRC_BITPOS , +CFA_P40_PROF_PROFILE_TCAM_L3_IPV6_CMP_SRC_NUM_BITS }, + {CFA_P40_PROF_PROFILE_TCAM_L3_IPV6_CMP_DEST_BITPOS , +CFA_P40_PROF_PROFILE_TCAM_L3_IPV6_CMP_DEST_NUM_BITS }, + {CFA_P40_PROF_PROFILE_TCAM_L4_HDR_VALID_BITPOS , +CFA_P40_PROF_PROFILE_TCAM_L4_HDR_VALID_NUM_BITS }, + {CFA_P40_PROF_PROFILE_TCAM_L4_HDR_ERROR_BITPOS , +CFA_P40_PROF_PROFILE_TCAM_L4_HDR_ERROR_NUM_BITS }, + {CFA_P40_PROF_PROFILE_TCAM_L4_HDR_TYPE_BITPOS , +CFA_P40_PROF_PROFILE_TCAM_L4_HDR_TYPE_NUM_BITS }, + {CFA_P40_PROF_PROFILE_TCAM_L4_HDR_IS_UDP_TCP_BITPOS , +CFA_P40_PROF_PROFILE_TCAM_L4_HDR_IS_UDP_TCP_NUM_BITS }, +}; + +/**************************************************************************/ +/** +* Non-autogenerated fields +*/ + +const struct hcapi_cfa_field cfa_p40_eem_key_tbl_layout[] = { + {CFA_P40_EEM_KEY_TBL_VALID_BITPOS , +CFA_P40_EEM_KEY_TBL_VALID_NUM_BITS }, + + {CFA_P40_EEM_KEY_TBL_L1_CACHEABLE_BITPOS , +CFA_P40_EEM_KEY_TBL_L1_CACHEABLE_NUM_BITS }, + + {CFA_P40_EEM_KEY_TBL_STRENGTH_BITPOS , +CFA_P40_EEM_KEY_TBL_STRENGTH_NUM_BITS }, + + {CFA_P40_EEM_KEY_TBL_KEY_SZ_BITPOS , +CFA_P40_EEM_KEY_TBL_KEY_SZ_NUM_BITS }, + + {CFA_P40_EEM_KEY_TBL_REC_SZ_BITPOS , +CFA_P40_EEM_KEY_TBL_REC_SZ_NUM_BITS }, + + {CFA_P40_EEM_KEY_TBL_ACT_REC_INT_BITPOS , +CFA_P40_EEM_KEY_TBL_ACT_REC_INT_NUM_BITS }, + + {CFA_P40_EEM_KEY_TBL_EXT_FLOW_CTR_BITPOS , +CFA_P40_EEM_KEY_TBL_EXT_FLOW_CTR_NUM_BITS }, + + {CFA_P40_EEM_KEY_TBL_AR_PTR_BITPOS , +CFA_P40_EEM_KEY_TBL_AR_PTR_NUM_BITS }, + +}; +#endif /* _CFA_P40_TBL_H_ */
drivers/net/bnxt/hcapi/hcapi_cfa.h +2 -0
@@ -243,6 +243,8 @@ int hcapi_cfa_p4_wc_tcam_hwop(struct hcapi_cfa_hwop *op, struct hcapi_cfa_data *obj_data);int hcapi_cfa_p4_wc_tcam_rec_hwop (struct hcapi_cfa_hwop *op,struct hcapi_cfa_data *obj_data); +int hcapi_cfa_p4_mirror_hwop (struct hcapi_cfa_hwop *op, +struct hcapi_cfa_data *mirror);#endif /* SUPPORT_CFA_HW_P4 */ /** * HCAPI CFA device HW operation function callback definition
drivers/net/bnxt/meson.build +1 -2
@@ -41,10 +41,9 @@ sources = files('bnxt_cpr.c', 'tf_core/tf_identifier.c', 'tf_core/tf_shadow_tbl.c', 'tf_core/tf_shadow_tcam.c', - 'tf_core/tf_tbl_type.c', 'tf_core/tf_tcam.c', 'tf_core/tf_util.c', - 'tf_core/tf_rm_new.c', + 'tf_core/tf_rm.c', 'hcapi/hcapi_cfa_p4.c',
drivers/net/bnxt/tf_core/Makefile +0 -2
@@ -23,10 +23,8 @@ SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += tf_core/tf_device_p4.c SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += tf_core/tf_identifier.c SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += tf_core/tf_shadow_tbl.c SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += tf_core/tf_shadow_tcam.c -SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += tf_core/tf_tbl_type.c SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += tf_core/tf_tcam.c SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += tf_core/tf_util.c -SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += tf_core/tf_rm_new.c SYMLINK-$(CONFIG_RTE_LIBRTE_BNXT_PMD)-include += tf_core/tf_core.h SYMLINK-$(CONFIG_RTE_LIBRTE_BNXT_PMD)-include += tf_core/tf_project.h
drivers/net/bnxt/tf_core/tf_common.h +10 -45
74 lines not on this page · raw message
drivers/net/bnxt/tf_core/tf_core.c +79 -7
128 lines not on this page · raw message
drivers/net/bnxt/tf_core/tf_device.h +22 -2
@@ -8,7 +8,7 @@#include "tf_core.h" #include "tf_identifier.h" -#include "tf_tbl_type.h" +#include "tf_tbl.h" #include "tf_tcam.h" struct tf ;
@@ -293,7 +293,27 @@ struct tf_dev_ops {* - (-EINVAL) on failure. */ int (*tf_dev_get_tbl)(struct tf *tfp, -struct tf_tbl_get_parms *parms); +struct tf_tbl_get_parms *parms); + +/** +* Retrieves the specified table type element using 'bulk' +* mechanism. +* +* This API retrieves the specified element data by invoking the +* firmware. +* +* [in] tfp +* Pointer to TF handle +* +* [in] parms +* Pointer to table get bulk parameters +* +* Returns +* - (0) if successful. +* - (-EINVAL) on failure. +*/ +int (*tf_dev_get_bulk_tbl)(struct tf *tfp, +struct tf_tbl_get_bulk_parms *parms);/** * Allocation of a tcam element.
drivers/net/bnxt/tf_core/tf_device_p4.c +3 -1
@@ -8,7 +8,7 @@#include "tf_device.h" #include "tf_identifier.h" -#include "tf_tbl_type.h" +#include "tf_tbl.h" #include "tf_tcam.h" #include "tf_em.h"
@@ -88,6 +88,7 @@ const struct tf_dev_ops tf_dev_ops_p4_init = { .tf_dev_alloc_search_tbl = NULL, .tf_dev_set_tbl = NULL, .tf_dev_get_tbl = NULL, + .tf_dev_get_bulk_tbl = NULL, .tf_dev_alloc_tcam = NULL, .tf_dev_free_tcam = NULL, .tf_dev_alloc_search_tcam = NULL,
@@ -114,6 +115,7 @@ const struct tf_dev_ops tf_dev_ops_p4 = { .tf_dev_alloc_search_tbl = NULL, .tf_dev_set_tbl = tf_tbl_set, .tf_dev_get_tbl = tf_tbl_get, + .tf_dev_get_bulk_tbl = tf_tbl_bulk_get, .tf_dev_alloc_tcam = tf_tcam_alloc, .tf_dev_free_tcam = tf_tcam_free, .tf_dev_alloc_search_tcam = NULL,
drivers/net/bnxt/tf_core/tf_device_p4.h +2 -3
@@ -9,7 +9,7 @@#include <cfa_resource_types.h> #include "tf_core.h" -#include "tf_rm_new.h" +#include "tf_rm.h" struct tf_rm_element_cfg tf_ident_p4[TF_IDENT_TYPE_MAX ] = { {TF_RM_ELEM_CFG_HCAPI ,CFA_RESOURCE_TYPE_P4_L2_CTXT_REMAP },
@@ -41,8 +41,7 @@ struct tf_rm_element_cfg tf_tbl_p4[TF_TBL_TYPE_MAX] = { { TF_RM_ELEM_CFG_HCAPI, CFA_RESOURCE_TYPE_P4_ENCAP_64B }, { TF_RM_ELEM_CFG_HCAPI, CFA_RESOURCE_TYPE_P4_SP_MAC }, { TF_RM_ELEM_CFG_HCAPI, CFA_RESOURCE_TYPE_P4_SP_MAC_IPV4 }, -/* CFA_RESOURCE_TYPE_P4_SP_MAC_IPV6 */ - { TF_RM_ELEM_CFG_NULL, CFA_RESOURCE_TYPE_INVALID }, + { TF_RM_ELEM_CFG_HCAPI, CFA_RESOURCE_TYPE_P4_SP_MAC_IPV6 }, { TF_RM_ELEM_CFG_HCAPI, CFA_RESOURCE_TYPE_P4_COUNTER_64B }, { TF_RM_ELEM_CFG_HCAPI, CFA_RESOURCE_TYPE_P4_NAT_SPORT }, { TF_RM_ELEM_CFG_HCAPI, CFA_RESOURCE_TYPE_P4_NAT_DPORT },
drivers/net/bnxt/tf_core/tf_em.h +84 -4
117 lines not on this page · raw message
drivers/net/bnxt/tf_core/tf_em_common.c +19 -10
@@ -194,12 +194,13 @@ tf_em_ext_common_bind(struct tf *tfp,int rc;int i;struct tf_rm_create_db_parms db_cfg = {0 }; +uint8_t db_exists =0 ;TF_CHECK_PARMS2 (tfp, parms);if (init) {TFP_DRV_LOG (ERR , -"Identifier already initialized\n" ); +"EM Ext DB already initialized\n" );return -EINVAL ; }
@@ -210,19 +211,29 @@ tf_em_ext_common_bind(struct tf *tfp,for (i =0 ; i <TF_DIR_MAX ; i++) { db_cfg.dir = i; db_cfg.alloc_cnt = parms->resources->em_cnt[i].cnt; + +/* Check if we got any request to support EEM, if so +* we build an EM Ext DB holding Table Scopes. +*/ +if (db_cfg.alloc_cnt[TF_EM_TBL_TYPE_TBL_SCOPE ] ==0 ) +continue ; + db_cfg.rm_db = &eem_db[i]; rc =tf_rm_create_db (tfp, &db_cfg);if (rc) {TFP_DRV_LOG (ERR , -"%s: EM DB creation failed\n" , +"%s: EM Ext DB creation failed\n" ,tf_dir_2_str (i));return rc; } + db_exists =1 ; } - mem_type = parms->mem_type; - init =1 ; +if (db_exists) { + mem_type = parms->mem_type; + init =1 ; + }return 0 ; }
@@ -236,13 +247,11 @@ tf_em_ext_common_unbind(struct tf *tfp)TF_CHECK_PARMS1 (tfp); -/* Bail if nothing has been initialized done silent as to -* allow for creation cleanup. -*/ +/* Bail if nothing has been initialized */ if (!init) { -TFP_DRV_LOG (ERR , -"No EM DBs created\n" ); -return -EINVAL ; +TFP_DRV_LOG (INFO , +"No EM Ext DBs created\n" ); +return 0 ; }for (i =0 ; i <TF_DIR_MAX ; i++) {
drivers/net/bnxt/tf_core/tf_em_internal.c +31 -28
87 lines not on this page · raw message
drivers/net/bnxt/tf_core/tf_identifier.c +6 -8
@@ -7,7 +7,7 @@#include "tf_identifier.h" #include "tf_common.h" -#include "tf_rm_new.h" +#include "tf_rm.h" #include "tf_util.h" #include "tfp.h"
@@ -35,7 +35,7 @@ tf_ident_bind(struct tf *tfp,if (init) {TFP_DRV_LOG (ERR , -"Identifier already initialized\n" ); +"Identifier DB already initialized\n" );return -EINVAL ; }
@@ -65,7 +65,7 @@ tf_ident_bind(struct tf *tfp, }int -tf_ident_unbind(struct tf *tfp __rte_unused) +tf_ident_unbind (struct tf *tfp) {int rc;int i;
@@ -73,13 +73,11 @@ tf_ident_unbind(struct tf *tfp __rte_unused)TF_CHECK_PARMS1 (tfp); -/* Bail if nothing has been initialized done silent as to -* allow for creation cleanup. -*/ +/* Bail if nothing has been initialized */ if (!init) { -TFP_DRV_LOG (ERR , +TFP_DRV_LOG (INFO ,"No Identifier DBs created\n" ); -return -EINVAL ; +return 0 ; }for (i =0 ; i <TF_DIR_MAX ; i++) {
drivers/net/bnxt/tf_core/tf_msg.c +23 -8
@@ -871,26 +871,41 @@ tf_msg_get_tbl_entry(struct tf *tfp,int tf_msg_bulk_get_tbl_entry (struct tf *tfp, -struct tf_bulk_get_tbl_entry_parms *params) +enum tf_dir dir, +uint16_t hcapi_type, +uint32_t starting_idx, +uint16_t num_entries, +uint16_t entry_sz_in_bytes, +uint64_t physical_mem_addr) {int rc;struct tfp_send_msg_parms parms = {0 };struct tf_tbl_type_bulk_get_input req = {0 };struct tf_tbl_type_bulk_get_output resp = {0 }; -struct tf_session *tfs = (struct tf_session *)(tfp->session->core_data); +struct tf_session *tfs;int data_size =0 ; +/* Retrieve the session information */ + rc =tf_session_get_session (tfp, &tfs); +if (rc) { +TFP_DRV_LOG (ERR , +"%s: Failed to lookup session, rc:%s\n" , +tf_dir_2_str (dir), +strerror (-rc)); +return rc; + } +/* Populate the request */ req.fw_session_id =tfp_cpu_to_le_32 (tfs->session_id.internal.fw_session_id); - req.flags =tfp_cpu_to_le_16 (params->dir); - req.type =tfp_cpu_to_le_32 (params->type); - req.start_index =tfp_cpu_to_le_32 (params->starting_idx); - req.num_entries =tfp_cpu_to_le_32 (params->num_entries); + req.flags =tfp_cpu_to_le_16 (dir); + req.type =tfp_cpu_to_le_32 (hcapi_type); + req.start_index =tfp_cpu_to_le_32 (starting_idx); + req.num_entries =tfp_cpu_to_le_32 (num_entries); - data_size = params->num_entries * params->entry_sz_in_bytes; + data_size = num_entries * entry_sz_in_bytes; - req.host_addr =tfp_cpu_to_le_64 (params->physical_mem_addr); + req.host_addr =tfp_cpu_to_le_64 (physical_mem_addr); MSG_PREP(parms, TF_KONG_MB,
drivers/net/bnxt/tf_core/tf_msg.h +6 -2
@@ -11,7 +11,6 @@#include "tf_tbl.h" #include "tf_rm.h" -#include "tf_rm_new.h" #include "tf_tcam.h" struct tf ;
@@ -422,6 +421,11 @@ int tf_msg_get_tbl_entry(struct tf *tfp,* 0 on Success else internal Truflow error */ int tf_msg_bulk_get_tbl_entry (struct tf *tfp, -struct tf_bulk_get_tbl_entry_parms *parms); +enum tf_dir dir, +uint16_t hcapi_type, +uint32_t starting_idx, +uint16_t num_entries, +uint16_t entry_sz_in_bytes, +uint64_t physical_mem_addr);#endif /* _TF_MSG_H_ */
drivers/net/bnxt/tf_core/tf_resources.h +0 -529
535 lines not on this page · raw message
drivers/net/bnxt/tf_core/tf_rm.c +720 -2975
1,534 lines not on this page · raw message
drivers/net/bnxt/tf_core/tf_rm.h +341 -198
539 lines not on this page · raw message
drivers/net/bnxt/tf_core/tf_rm_new.c deleted +0 -907
907 lines not on this page · raw message
drivers/net/bnxt/tf_core/tf_rm_new.h deleted +0 -446
446 lines not on this page · raw message
drivers/net/bnxt/tf_core/tf_session.h +3 -211
214 lines not on this page · raw message
drivers/net/bnxt/tf_core/tf_tbl.c +358 -120
478 lines not on this page · raw message
drivers/net/bnxt/tf_core/tf_tbl.h +369 -67
436 lines not on this page · raw message
drivers/net/bnxt/tf_core/tf_tbl_type.c deleted +0 -342
342 lines not on this page · raw message
drivers/net/bnxt/tf_core/tf_tbl_type.h deleted +0 -318
318 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 1 line
2.21.1 (Apple Git-122.3)
Part of the diff is not shown here. View the raw message.
PATCH v5 24/51 net/bnxt: update RM to support HCAPI only
In reply to Ajit KhapardeFrom: Peter Spreadborough <[email protected]>
- For the EM Module there is a need to only allocate the EM Records in HCAPI RM but the storage control is requested to be outside of the RM DB.
- Add TF_RM_ELEM_CFG_HCAPI_BA.
- Return error when the number of reserved entries for wc tcam is odd number in tf_tcam_bind.
- Remove em_pool from session
- Use RM provided start offset and size
- HCAPI returns entry index instead of row index for WC TCAM.
- Move resource type conversion to hrwm set/free tcam functions.
--- drivers/net/bnxt/tf_core/tf_device_p4.c | 2 + drivers/net/bnxt/tf_core/tf_device_p4.h | 54 ++++----- drivers/net/bnxt/tf_core/tf_em_internal.c | 131 ++++++++++++++-------- drivers/net/bnxt/tf_core/tf_msg.c | 6 +- drivers/net/bnxt/tf_core/tf_rm.c | 81 ++++++------- drivers/net/bnxt/tf_core/tf_rm.h | 14 ++- drivers/net/bnxt/tf_core/tf_session.h | 5 - drivers/net/bnxt/tf_core/tf_tcam.c | 21 ++++ 8 files changed, 190 insertions(+), 124 deletions(-)
drivers/net/bnxt/tf_core/tf_device_p4.c +2 -0
@@ -68,6 +68,8 @@ tf_dev_p4_get_tcam_slice_info(struct tf *tfp __rte_unused, *num_slices_per_row =CFA_P4_WC_TCAM_SLICES_PER_ROW ;if (key_sz > *num_slices_per_row *CFA_P4_WC_TCAM_SLICE_SIZE )return -ENOTSUP ; + + *num_slices_per_row =1 ; }else {/* for other type of tcam */ *num_slices_per_row =1 ; }
drivers/net/bnxt/tf_core/tf_device_p4.h +27 -27
79 lines not on this page · raw message
drivers/net/bnxt/tf_core/tf_em_internal.c +84 -47
272 lines not on this page · raw message
drivers/net/bnxt/tf_core/tf_msg.c +3 -3
@@ -857,12 +857,12 @@ tf_msg_get_tbl_entry(struct tf *tfp,return rc;/* Verify that we got enough buffer to return the requested data */ -if (resp.size < size) +if (tfp_le_to_cpu_32 (resp.size) != size)return -EINVAL ;tfp_memcpy (data, &resp.data, - resp.size); + size);return tfp_le_to_cpu_32 (parms.tf_resp_code); }
@@ -919,7 +919,7 @@ tf_msg_bulk_get_tbl_entry(struct tf *tfp,return rc;/* Verify that we got enough buffer to return the requested data */ -if (resp.size < data_size) +if (tfp_le_to_cpu_32 (resp.size) != data_size)return -EINVAL ;return tfp_le_to_cpu_32 (parms.tf_resp_code);
drivers/net/bnxt/tf_core/tf_rm.c +43 -38
149 lines not on this page · raw message
drivers/net/bnxt/tf_core/tf_rm.h +10 -4
@@ -56,12 +56,18 @@ struct tf_rm_new_entry {* ULP layer that is not controlled by HCAPI within the Firmware. */ enum tf_rm_elem_cfg_type { -/** No configuration */ +/** +* No configuration +*/ TF_RM_ELEM_CFG_NULL , -/** HCAPI 'controlled', uses a Pool for internal storage */ +/** HCAPI 'controlled', no RM storage thus the Device Module +* using the RM can chose to handle storage locally. +*/ TF_RM_ELEM_CFG_HCAPI , -/** Private thus not HCAPI 'controlled', creates a Pool for storage */ -TF_RM_ELEM_CFG_PRIVATE , +/** HCAPI 'controlled', uses a Bit Allocator Pool for internal +* storage in the RM. +*/ +TF_RM_ELEM_CFG_HCAPI_BA ,/** * Shared element thus it belongs to a shared FW Session and * is not controlled by the Host.
drivers/net/bnxt/tf_core/tf_session.h +0 -5
@@ -103,11 +103,6 @@ struct tf_session {/** Table scope array */ struct tf_tbl_scope_cb tbl_scopes[TF_NUM_TBL_SCOPE ]; - -/** -* EM Pools -*/ -struct stack em_pool[TF_DIR_MAX ]; };/**
drivers/net/bnxt/tf_core/tf_tcam.c +21 -0
@@ -43,6 +43,7 @@ tf_tcam_bind(struct tf *tfp, {int rc;int i; +struct tf_tcam_resources *tcam_cnt;struct tf_rm_create_db_parms db_cfg = {0 };TF_CHECK_PARMS2 (tfp, parms);
@@ -53,6 +54,14 @@ tf_tcam_bind(struct tf *tfp,return -EINVAL ; } + tcam_cnt = parms->resources->tcam_cnt; +if ((tcam_cnt[TF_DIR_RX ].cnt[TF_TCAM_TBL_TYPE_WC_TCAM ] %2 ) || + (tcam_cnt[TF_DIR_TX ].cnt[TF_TCAM_TBL_TYPE_WC_TCAM ] %2 )) { +TFP_DRV_LOG (ERR , +"Number of WC TCAM entries cannot be odd num\n" ); +return -EINVAL ; + } + db_cfg.type =TF_DEVICE_MODULE_TYPE_TCAM ; db_cfg.num_elements = parms->num_elements; db_cfg.cfg = parms->cfg;
@@ -168,6 +177,18 @@ tf_tcam_alloc(struct tf *tfp,return rc; } +if (parms->type ==TF_TCAM_TBL_TYPE_WC_TCAM && + (parms->idx %2 ) !=0 ) { + rc =tf_rm_allocate (&aparms); +if (rc) { +TFP_DRV_LOG (ERR , +"%s: Failed tcam, type:%d\n" , +tf_dir_2_str (parms->dir), + parms->type); +return rc; + } + } + parms->idx *= num_slice_per_row;return 0 ;
Signature · 1 line
2.21.1 (Apple Git-122.3)
PATCH v5 25/51 net/bnxt: remove table scope from session
In reply to Ajit KhapardeFrom: Peter Spreadborough <[email protected]>
- Remove table scope data from session. Added to EEM.
- Complete move to RM of table scope base and range.
- Fix some err messaging strings.
- Fix the tcam logging message.
--- drivers/net/bnxt/tf_core/tf_core.c | 2 +- drivers/net/bnxt/tf_core/tf_em.h | 1 - drivers/net/bnxt/tf_core/tf_em_common.c | 16 +++++++---- drivers/net/bnxt/tf_core/tf_em_common.h | 5 +--- drivers/net/bnxt/tf_core/tf_em_host.c | 38 ++++++++++--------------- drivers/net/bnxt/tf_core/tf_em_system.c | 12 +++----- drivers/net/bnxt/tf_core/tf_session.h | 3 -- drivers/net/bnxt/tf_core/tf_tcam.c | 6 ++-- 8 files changed, 35 insertions(+), 48 deletions(-)
drivers/net/bnxt/tf_core/tf_core.c +1 -1
@@ -573,7 +573,7 @@ tf_free_tcam_entry(struct tf *tfp, rc = dev->ops->tf_dev_free_tcam (tfp, &fparms);if (rc) {TFP_DRV_LOG (ERR , -"%s: TCAM allocation failed, rc:%s\n" , +"%s: TCAM free failed, rc:%s\n" ,tf_dir_2_str (parms->dir),strerror (-rc));return rc;
drivers/net/bnxt/tf_core/tf_em.h +0 -1
@@ -9,7 +9,6 @@#include "tf_core.h" #include "tf_session.h" -#define TF_HACK_TBL_SCOPE_BASE 68#define SUPPORT_CFA_HW_P4 1#define SUPPORT_CFA_HW_P58 0#define SUPPORT_CFA_HW_P59 0
drivers/net/bnxt/tf_core/tf_em_common.c +10 -6
@@ -29,6 +29,8 @@*/ void *eem_db[TF_DIR_MAX ]; +#define TF_EEM_DB_TBL_SCOPE 1 +/** * Init flag, set on bind and cleared on unbind */
@@ -39,10 +41,12 @@ static uint8_t init;*/ static enum tf_mem_type mem_type; +/** Table scope array */ +struct tf_tbl_scope_cb tbl_scopes[TF_NUM_TBL_SCOPE ]; +/* API defined in tf_em.h */ struct tf_tbl_scope_cb * -tbl_scope_cb_find (struct tf_session *session, -uint32_t tbl_scope_id) +tbl_scope_cb_find (uint32_t tbl_scope_id) {int i;struct tf_rm_is_allocated_parms parms;
@@ -50,8 +54,8 @@ tbl_scope_cb_find(struct tf_session *session,/* Check that id is valid */ parms.rm_db = eem_db[TF_DIR_RX ]; - parms.db_index =1 /**** TYPE TABLE-SCOPE??? ****/ ; - parms.index = tbl_scope_id +TF_HACK_TBL_SCOPE_BASE ; + parms.db_index =TF_EEM_DB_TBL_SCOPE ; + parms.index = tbl_scope_id; parms.allocated = &allocated; i =tf_rm_is_allocated (&parms);
@@ -60,8 +64,8 @@ tbl_scope_cb_find(struct tf_session *session,return NULL ;for (i =0 ; i <TF_NUM_TBL_SCOPE ; i++) { -if (session->tbl_scopes[i].tbl_scope_id == tbl_scope_id) -return &session->tbl_scopes[i]; +if (tbl_scopes[i].tbl_scope_id == tbl_scope_id) +return &tbl_scopes[i]; }return NULL ;
drivers/net/bnxt/tf_core/tf_em_common.h +1 -4
@@ -14,8 +14,6 @@* Function to search for table scope control block structure * with specified table scope ID. * -* [in] session -* Session to use for the search of the table scope control block * [in] tbl_scope_id * Table scope ID to search for *
@@ -23,8 +21,7 @@* Pointer to the found table scope control block struct or NULL if * table scope control block struct not found */ -struct tf_tbl_scope_cb *tbl_scope_cb_find (struct tf_session *session, -uint32_t tbl_scope_id); +struct tf_tbl_scope_cb *tbl_scope_cb_find (uint32_t tbl_scope_id);/** * Create and initialize a stack to use for action entries
drivers/net/bnxt/tf_core/tf_em_host.c +15 -23
@@ -48,6 +48,9 @@* EM DBs. */ extern void *eem_db[TF_DIR_MAX ]; +#define TF_EEM_DB_TBL_SCOPE 1 + +extern struct tf_tbl_scope_cb tbl_scopes[TF_NUM_TBL_SCOPE ];/** * Function to free a page table
@@ -934,14 +937,12 @@ tf_delete_eem_entry(struct tf_tbl_scope_cb *tbl_scope_cb,* -EINVAL - Error */ int -tf_em_insert_ext_entry (struct tf *tfp, +tf_em_insert_ext_entry(struct tf *tfp __rte_unused,struct tf_insert_em_entry_parms *parms) {struct tf_tbl_scope_cb *tbl_scope_cb; - tbl_scope_cb = -tbl_scope_cb_find ((struct tf_session *)(tfp->session->core_data), - parms->tbl_scope_id); + tbl_scope_cb =tbl_scope_cb_find (parms->tbl_scope_id);if (tbl_scope_cb ==NULL ) {TFP_DRV_LOG (ERR ,"Invalid tbl_scope_cb\n" );return -EINVAL ;
@@ -957,14 +958,12 @@ tf_em_insert_ext_entry(struct tf *tfp,* -EINVAL - Error */ int -tf_em_delete_ext_entry (struct tf *tfp, +tf_em_delete_ext_entry(struct tf *tfp __rte_unused,struct tf_delete_em_entry_parms *parms) {struct tf_tbl_scope_cb *tbl_scope_cb; - tbl_scope_cb = -tbl_scope_cb_find ((struct tf_session *)(tfp->session->core_data), - parms->tbl_scope_id); + tbl_scope_cb =tbl_scope_cb_find (parms->tbl_scope_id);if (tbl_scope_cb ==NULL ) {TFP_DRV_LOG (ERR ,"Invalid tbl_scope_cb\n" );return -EINVAL ;
@@ -981,16 +980,13 @@ tf_em_ext_host_alloc(struct tf *tfp,enum tf_dir dir;struct tf_tbl_scope_cb *tbl_scope_cb;struct hcapi_cfa_em_table *em_tables; -struct tf_session *session;struct tf_free_tbl_scope_parms free_parms;struct tf_rm_allocate_parms aparms = {0 };struct tf_rm_free_parms fparms = {0 }; - session = (struct tf_session *)tfp->session->core_data; -/* Get Table Scope control block from the session pool */ aparms.rm_db = eem_db[TF_DIR_RX ]; - aparms.db_index =1 /**** TYPE TABLE-SCOPE??? ****/ ; + aparms.db_index =TF_EEM_DB_TBL_SCOPE ; aparms.index = (uint32_t *)&parms->tbl_scope_id; rc =tf_rm_allocate (&aparms);if (rc) {
@@ -999,8 +995,7 @@ tf_em_ext_host_alloc(struct tf *tfp,return rc; } - parms->tbl_scope_id -=TF_HACK_TBL_SCOPE_BASE ; - tbl_scope_cb = &session->tbl_scopes[parms->tbl_scope_id]; + tbl_scope_cb = &tbl_scopes[parms->tbl_scope_id]; tbl_scope_cb->index = parms->tbl_scope_id; tbl_scope_cb->tbl_scope_id = parms->tbl_scope_id;
@@ -1092,8 +1087,8 @@ tf_em_ext_host_alloc(struct tf *tfp, cleanup:/* Free Table control block */ fparms.rm_db = eem_db[TF_DIR_RX ]; - fparms.db_index =1 /**** TYPE TABLE-SCOPE??? ****/ ; - fparms.index = parms->tbl_scope_id +TF_HACK_TBL_SCOPE_BASE ; + fparms.db_index =TF_EEM_DB_TBL_SCOPE ; + fparms.index = parms->tbl_scope_id;tf_rm_free (&fparms);return -EINVAL ; }
@@ -1105,13 +1100,9 @@ tf_em_ext_host_free(struct tf *tfp,int rc =0 ;enum tf_dir dir;struct tf_tbl_scope_cb *tbl_scope_cb; -struct tf_session *session;struct tf_rm_free_parms aparms = {0 }; - session = (struct tf_session *)(tfp->session->core_data); - - tbl_scope_cb =tbl_scope_cb_find (session, - parms->tbl_scope_id); + tbl_scope_cb =tbl_scope_cb_find (parms->tbl_scope_id);if (tbl_scope_cb ==NULL ) {TFP_DRV_LOG (ERR ,"Table scope error\n" );
@@ -1120,8 +1111,8 @@ tf_em_ext_host_free(struct tf *tfp,/* Free Table control block */ aparms.rm_db = eem_db[TF_DIR_RX ]; - aparms.db_index =1 /**** TYPE TABLE-SCOPE??? ****/ ; - aparms.index = parms->tbl_scope_id +TF_HACK_TBL_SCOPE_BASE ; + aparms.db_index =TF_EEM_DB_TBL_SCOPE ; + aparms.index = parms->tbl_scope_id; rc =tf_rm_free (&aparms);if (rc) { TFP_DRV_LOG(ERR,
@@ -1142,5 +1133,6 @@ tf_em_ext_host_free(struct tf *tfp,tf_em_ctx_unreg (tfp, tbl_scope_cb, dir); } + tbl_scopes[parms->tbl_scope_id].tbl_scope_id =-1 ;return rc; }
drivers/net/bnxt/tf_core/tf_em_system.c +4 -8
@@ -63,14 +63,12 @@ tf_delete_eem_entry(struct tf_tbl_scope_cb *tbl_scope_cb __rte_unused,* -EINVAL - Error */ int -tf_em_insert_ext_sys_entry (struct tf *tfp, +tf_em_insert_ext_sys_entry(struct tf *tfp __rte_unused,struct tf_insert_em_entry_parms *parms) {struct tf_tbl_scope_cb *tbl_scope_cb; - tbl_scope_cb =tbl_scope_cb_find - ((struct tf_session *)(tfp->session->core_data), - parms->tbl_scope_id); + tbl_scope_cb =tbl_scope_cb_find (parms->tbl_scope_id);if (tbl_scope_cb ==NULL ) {TFP_DRV_LOG (ERR ,"Invalid tbl_scope_cb\n" );return -EINVAL ;
@@ -87,14 +85,12 @@ tf_em_insert_ext_sys_entry(struct tf *tfp,* -EINVAL - Error */ int -tf_em_delete_ext_sys_entry (struct tf *tfp, +tf_em_delete_ext_sys_entry(struct tf *tfp __rte_unused,struct tf_delete_em_entry_parms *parms) {struct tf_tbl_scope_cb *tbl_scope_cb; - tbl_scope_cb =tbl_scope_cb_find - ((struct tf_session *)(tfp->session->core_data), - parms->tbl_scope_id); + tbl_scope_cb =tbl_scope_cb_find (parms->tbl_scope_id);if (tbl_scope_cb ==NULL ) {TFP_DRV_LOG (ERR ,"Invalid tbl_scope_cb\n" );return -EINVAL ;
drivers/net/bnxt/tf_core/tf_session.h +0 -3
@@ -100,9 +100,6 @@ struct tf_session {/** Device handle */ struct tf_dev_info dev; - -/** Table scope array */ -struct tf_tbl_scope_cb tbl_scopes[TF_NUM_TBL_SCOPE ]; };/**
drivers/net/bnxt/tf_core/tf_tcam.c +4 -2
@@ -287,7 +287,8 @@ tf_tcam_free(struct tf *tfp, rc =tf_msg_tcam_entry_free (tfp, parms);if (rc) {/* Log error */ - TFP_DRV_LOG(ERR, "%s: %s: Entry %d free failed with err %s", + TFP_DRV_LOG(ERR, + "%s: %s: Entry %d free failed, rc:%s\n", tf_dir_2_str(parms->dir), tf_tcam_tbl_2_str(parms->type), parms->idx,
@@ -382,7 +383,8 @@ tf_tcam_set(struct tf *tfp __rte_unused, rc =tf_msg_tcam_entry_set (tfp, parms);if (rc) {/* Log error */ - TFP_DRV_LOG(ERR, "%s: %s: Entry %d free failed with err %s", + TFP_DRV_LOG(ERR, + "%s: %s: Entry %d set failed, rc:%s", tf_dir_2_str(parms->dir), tf_tcam_tbl_2_str(parms->type), parms->idx,
Signature · 1 line
2.21.1 (Apple Git-122.3)
PATCH v5 26/51 net/bnxt: add external action alloc and free
In reply to Ajit KhapardeFrom: Jay Ding <[email protected]>
- Link external action alloc and free to new hcapi interface
- Add parameter range checking
- Fix issues with index allocation check
--- drivers/net/bnxt/tf_core/tf_core.c | 163 ++++++++++++++++------- drivers/net/bnxt/tf_core/tf_core.h | 4 - drivers/net/bnxt/tf_core/tf_device.h | 58 ++++++++ drivers/net/bnxt/tf_core/tf_device_p4.c | 6 + drivers/net/bnxt/tf_core/tf_device_p4.h | 2 - drivers/net/bnxt/tf_core/tf_em.h | 95 +++++++++++++ drivers/net/bnxt/tf_core/tf_em_common.c | 120 ++++++++++++++++- drivers/net/bnxt/tf_core/tf_em_host.c | 80 ++++++++++- drivers/net/bnxt/tf_core/tf_em_system.c | 6 + drivers/net/bnxt/tf_core/tf_identifier.c | 4 +- drivers/net/bnxt/tf_core/tf_rm.h | 5 + drivers/net/bnxt/tf_core/tf_tbl.c | 10 +- drivers/net/bnxt/tf_core/tf_tbl.h | 12 ++ drivers/net/bnxt/tf_core/tf_tcam.c | 8 +- drivers/net/bnxt/tf_core/tf_util.c | 4 - 15 files changed, 499 insertions(+), 78 deletions(-)
drivers/net/bnxt/tf_core/tf_core.c +115 -48
@@ -617,25 +617,48 @@ tf_alloc_tbl_entry(struct tf *tfp,return rc; } -if (dev->ops->tf_dev_alloc_tbl ==NULL ) { - rc = -EOPNOTSUPP ; -TFP_DRV_LOG (ERR , -"%s: Operation not supported, rc:%s\n" , -tf_dir_2_str (parms->dir), -strerror (-rc)); -return -EOPNOTSUPP ; - } - aparms.dir = parms->dir; aparms.type = parms->type; aparms.idx = &idx; - rc = dev->ops->tf_dev_alloc_tbl (tfp, &aparms); -if (rc) { -TFP_DRV_LOG (ERR , -"%s: Table allocation failed, rc:%s\n" , -tf_dir_2_str (parms->dir), -strerror (-rc)); -return rc; + aparms.tbl_scope_id = parms->tbl_scope_id; + +if (parms->type ==TF_TBL_TYPE_EXT ) { +if (dev->ops->tf_dev_alloc_ext_tbl ==NULL ) { + rc = -EOPNOTSUPP ; +TFP_DRV_LOG (ERR , +"%s: Operation not supported, rc:%s\n" , +tf_dir_2_str (parms->dir), +strerror (-rc)); +return -EOPNOTSUPP ; + } + + rc = dev->ops->tf_dev_alloc_ext_tbl (tfp, &aparms); +if (rc) { +TFP_DRV_LOG (ERR , +"%s: External table allocation failed, rc:%s\n" , +tf_dir_2_str (parms->dir), +strerror (-rc)); +return rc; + } + + }else { +if (dev->ops->tf_dev_alloc_tbl ==NULL ) { + rc = -EOPNOTSUPP ; +TFP_DRV_LOG (ERR , +"%s: Operation not supported, rc:%s\n" , +tf_dir_2_str (parms->dir), +strerror (-rc)); +return -EOPNOTSUPP ; + } + + rc = dev->ops->tf_dev_alloc_tbl (tfp, &aparms); +if (rc) { +TFP_DRV_LOG (ERR , +"%s: Table allocation failed, rc:%s\n" , +tf_dir_2_str (parms->dir), +strerror (-rc)); +return rc; + } } parms->idx = idx;
@@ -677,25 +700,47 @@ tf_free_tbl_entry(struct tf *tfp,return rc; } -if (dev->ops->tf_dev_free_tbl ==NULL ) { - rc = -EOPNOTSUPP ; -TFP_DRV_LOG (ERR , -"%s: Operation not supported, rc:%s\n" , -tf_dir_2_str (parms->dir), -strerror (-rc)); -return -EOPNOTSUPP ; - } - fparms.dir = parms->dir; fparms.type = parms->type; fparms.idx = parms->idx; - rc = dev->ops->tf_dev_free_tbl (tfp, &fparms); -if (rc) { -TFP_DRV_LOG (ERR , -"%s: Table free failed, rc:%s\n" , -tf_dir_2_str (parms->dir), -strerror (-rc)); -return rc; + fparms.tbl_scope_id = parms->tbl_scope_id; + +if (parms->type ==TF_TBL_TYPE_EXT ) { +if (dev->ops->tf_dev_free_ext_tbl ==NULL ) { + rc = -EOPNOTSUPP ; +TFP_DRV_LOG (ERR , +"%s: Operation not supported, rc:%s\n" , +tf_dir_2_str (parms->dir), +strerror (-rc)); +return -EOPNOTSUPP ; + } + + rc = dev->ops->tf_dev_free_ext_tbl (tfp, &fparms); +if (rc) { +TFP_DRV_LOG (ERR , +"%s: Table free failed, rc:%s\n" , +tf_dir_2_str (parms->dir), +strerror (-rc)); +return rc; + } + }else { +if (dev->ops->tf_dev_free_tbl ==NULL ) { + rc = -EOPNOTSUPP ; +TFP_DRV_LOG (ERR , +"%s: Operation not supported, rc:%s\n" , +tf_dir_2_str (parms->dir), +strerror (-rc)); +return -EOPNOTSUPP ; + } + + rc = dev->ops->tf_dev_free_tbl (tfp, &fparms); +if (rc) { +TFP_DRV_LOG (ERR , +"%s: Table free failed, rc:%s\n" , +tf_dir_2_str (parms->dir), +strerror (-rc)); +return rc; + } }return 0 ;
@@ -735,27 +780,49 @@ tf_set_tbl_entry(struct tf *tfp,return rc; } -if (dev->ops->tf_dev_set_tbl ==NULL ) { - rc = -EOPNOTSUPP ; -TFP_DRV_LOG (ERR , -"%s: Operation not supported, rc:%s\n" , -tf_dir_2_str (parms->dir), -strerror (-rc)); -return -EOPNOTSUPP ; - } - sparms.dir = parms->dir; sparms.type = parms->type; sparms.data = parms->data; sparms.data_sz_in_bytes = parms->data_sz_in_bytes; sparms.idx = parms->idx; - rc = dev->ops->tf_dev_set_tbl (tfp, &sparms); -if (rc) { -TFP_DRV_LOG (ERR , -"%s: Table set failed, rc:%s\n" , -tf_dir_2_str (parms->dir), -strerror (-rc)); -return rc; + sparms.tbl_scope_id = parms->tbl_scope_id; + +if (parms->type ==TF_TBL_TYPE_EXT ) { +if (dev->ops->tf_dev_set_ext_tbl ==NULL ) { + rc = -EOPNOTSUPP ; +TFP_DRV_LOG (ERR , +"%s: Operation not supported, rc:%s\n" , +tf_dir_2_str (parms->dir), +strerror (-rc)); +return -EOPNOTSUPP ; + } + + rc = dev->ops->tf_dev_set_ext_tbl (tfp, &sparms); +if (rc) { +TFP_DRV_LOG (ERR , +"%s: Table set failed, rc:%s\n" , +tf_dir_2_str (parms->dir), +strerror (-rc)); +return rc; + } + }else { +if (dev->ops->tf_dev_set_tbl ==NULL ) { + rc = -EOPNOTSUPP ; +TFP_DRV_LOG (ERR , +"%s: Operation not supported, rc:%s\n" , +tf_dir_2_str (parms->dir), +strerror (-rc)); +return -EOPNOTSUPP ; + } + + rc = dev->ops->tf_dev_set_tbl (tfp, &sparms); +if (rc) { +TFP_DRV_LOG (ERR , +"%s: Table set failed, rc:%s\n" , +tf_dir_2_str (parms->dir), +strerror (-rc)); +return rc; + } }return rc;
drivers/net/bnxt/tf_core/tf_core.h +0 -4
@@ -211,10 +211,6 @@ enum tf_tbl_type {TF_TBL_TYPE_ACT_MODIFY_IPV4_SRC ,/** Wh+/SR Action _Modify L4 Dest Port */ TF_TBL_TYPE_ACT_MODIFY_IPV4_DEST , -/** Action Modify IPv6 Source */ -TF_TBL_TYPE_ACT_MODIFY_IPV6_SRC , -/** Action Modify IPv6 Destination */ -TF_TBL_TYPE_ACT_MODIFY_IPV6_DEST ,/** Meter Profiles */ TF_TBL_TYPE_METER_PROF,/** Meter Instance */
drivers/net/bnxt/tf_core/tf_device.h +58 -0
76 lines not on this page · raw message
drivers/net/bnxt/tf_core/tf_device_p4.c +6 -0
@@ -85,10 +85,13 @@ const struct tf_dev_ops tf_dev_ops_p4_init = { .tf_dev_get_tcam_slice_info = tf_dev_p4_get_tcam_slice_info, .tf_dev_alloc_ident = NULL, .tf_dev_free_ident = NULL, + .tf_dev_alloc_ext_tbl = NULL, .tf_dev_alloc_tbl = NULL, + .tf_dev_free_ext_tbl = NULL, .tf_dev_free_tbl = NULL, .tf_dev_alloc_search_tbl = NULL, .tf_dev_set_tbl = NULL, + .tf_dev_set_ext_tbl = NULL, .tf_dev_get_tbl = NULL, .tf_dev_get_bulk_tbl = NULL, .tf_dev_alloc_tcam = NULL,
@@ -113,9 +116,12 @@ const struct tf_dev_ops tf_dev_ops_p4 = { .tf_dev_alloc_ident = tf_ident_alloc, .tf_dev_free_ident = tf_ident_free, .tf_dev_alloc_tbl = tf_tbl_alloc, + .tf_dev_alloc_ext_tbl = tf_tbl_ext_alloc, .tf_dev_free_tbl = tf_tbl_free, + .tf_dev_free_ext_tbl = tf_tbl_ext_free, .tf_dev_alloc_search_tbl = NULL, .tf_dev_set_tbl = tf_tbl_set, + .tf_dev_set_ext_tbl = tf_tbl_ext_set, .tf_dev_get_tbl = tf_tbl_get, .tf_dev_get_bulk_tbl = tf_tbl_bulk_get, .tf_dev_alloc_tcam = tf_tcam_alloc,
drivers/net/bnxt/tf_core/tf_device_p4.h +0 -2
@@ -47,8 +47,6 @@ struct tf_rm_element_cfg tf_tbl_p4[TF_TBL_TYPE_MAX] = { { TF_RM_ELEM_CFG_HCAPI_BA, CFA_RESOURCE_TYPE_P4_NAT_DPORT }, { TF_RM_ELEM_CFG_HCAPI_BA, CFA_RESOURCE_TYPE_P4_NAT_S_IPV4 }, { TF_RM_ELEM_CFG_HCAPI_BA, CFA_RESOURCE_TYPE_P4_NAT_D_IPV4 }, - { TF_RM_ELEM_CFG_HCAPI_BA, CFA_RESOURCE_TYPE_P4_NAT_S_IPV6 }, - { TF_RM_ELEM_CFG_HCAPI_BA, CFA_RESOURCE_TYPE_P4_NAT_D_IPV6 }, { TF_RM_ELEM_CFG_HCAPI_BA, CFA_RESOURCE_TYPE_P4_METER_PROF }, { TF_RM_ELEM_CFG_HCAPI_BA, CFA_RESOURCE_TYPE_P4_METER }, { TF_RM_ELEM_CFG_HCAPI_BA, CFA_RESOURCE_TYPE_P4_MIRROR },
drivers/net/bnxt/tf_core/tf_em.h +95 -0
99 lines not on this page · raw message
drivers/net/bnxt/tf_core/tf_em_common.c +116 -4
149 lines not on this page · raw message
drivers/net/bnxt/tf_core/tf_em_host.c +75 -5
109 lines not on this page · raw message
drivers/net/bnxt/tf_core/tf_em_system.c +6 -0
@@ -112,3 +112,9 @@ tf_em_ext_system_free(struct tf *tfp __rte_unused, {return 0 ; } + +int tf_tbl_ext_system_set(struct tf *tfp __rte_unused, + struct tf_tbl_set_parms *parms __rte_unused) +{ +return 0 ; +}
drivers/net/bnxt/tf_core/tf_identifier.c +2 -2
@@ -159,13 +159,13 @@ tf_ident_free(struct tf *tfp __rte_unused,if (rc)return rc; -if (!allocated) { +if (allocated !=TF_RM_ALLOCATED_ENTRY_IN_USE ) {TFP_DRV_LOG (ERR ,"%s: Entry already free, type:%d, index:%d\n" ,tf_dir_2_str (parms->dir), parms->type, parms->id); -return rc; +return -EINVAL ; }/* Free requested element */
drivers/net/bnxt/tf_core/tf_rm.h +5 -0
@@ -12,6 +12,11 @@struct tf ; +/** RM return codes */ +#define TF_RM_ALLOCATED_ENTRY_FREE 0 +#define TF_RM_ALLOCATED_ENTRY_IN_USE 1 +#define TF_RM_ALLOCATED_NO_ENTRY_FOUND -1 +/** * The Resource Manager (RM) module provides basic DB handling for * internal resources. These resources exists within the actual device
drivers/net/bnxt/tf_core/tf_tbl.c +5 -5
@@ -172,13 +172,13 @@ tf_tbl_free(struct tf *tfp __rte_unused,if (rc)return rc; -if (!allocated) { +if (allocated !=TF_RM_ALLOCATED_ENTRY_IN_USE ) {TFP_DRV_LOG (ERR ,"%s: Entry already free, type:%d, index:%d\n" ,tf_dir_2_str (parms->dir), parms->type, parms->idx); -return rc; +return -EINVAL ; }/* Free requested element */
@@ -233,7 +233,7 @@ tf_tbl_set(struct tf *tfp,if (rc)return rc; -if (!allocated) { +if (allocated !=TF_RM_ALLOCATED_ENTRY_IN_USE ) { TFP_DRV_LOG(ERR, "%s, Invalid or not allocated index, type:%d, idx:%d\n", tf_dir_2_str(parms->dir),
@@ -301,7 +301,7 @@ tf_tbl_get(struct tf *tfp,if (rc)return rc; -if (!allocated) { +if (allocated !=TF_RM_ALLOCATED_ENTRY_IN_USE ) { TFP_DRV_LOG(ERR, "%s, Invalid or not allocated index, type:%d, idx:%d\n", tf_dir_2_str(parms->dir),
@@ -374,7 +374,7 @@ tf_tbl_bulk_get(struct tf *tfp,if (rc)return rc; -if (!allocated) { +if (allocated !=TF_RM_ALLOCATED_ENTRY_IN_USE ) { TFP_DRV_LOG(ERR, "%s, Invalid or not allocated index, type:%d, idx:%d\n", tf_dir_2_str(parms->dir),
drivers/net/bnxt/tf_core/tf_tbl.h +12 -0
@@ -83,6 +83,10 @@ struct tf_tbl_alloc_parms {* [in] Type of the allocation */ enum tf_tbl_type type; +/** +* [in] Table scope identifier (ignored unless TF_TBL_TYPE_EXT) +*/ +uint32_t tbl_scope_id;/** * [out] Idx of allocated entry or found entry (if search_enable) */
@@ -101,6 +105,10 @@ struct tf_tbl_free_parms {* [in] Type of the allocation type */ enum tf_tbl_type type; +/** +* [in] Table scope identifier (ignored unless TF_TBL_TYPE_EXT) +*/ +uint32_t tbl_scope_id;/** * [in] Index to free */
@@ -168,6 +176,10 @@ struct tf_tbl_set_parms {* [in] Type of object to set */ enum tf_tbl_type type; +/** +* [in] Table scope identifier (ignored unless TF_TBL_TYPE_EXT) +*/ +uint32_t tbl_scope_id;/** * [in] Entry data */
drivers/net/bnxt/tf_core/tf_tcam.c +4 -4
@@ -252,13 +252,13 @@ tf_tcam_free(struct tf *tfp,if (rc)return rc; -if (!allocated) { +if (allocated !=TF_RM_ALLOCATED_ENTRY_IN_USE ) {TFP_DRV_LOG (ERR ,"%s: Entry already free, type:%d, index:%d\n" ,tf_dir_2_str (parms->dir), parms->type, parms->idx); -return rc; +return -EINVAL ; }/* Free requested element */
@@ -362,13 +362,13 @@ tf_tcam_set(struct tf *tfp __rte_unused,if (rc)return rc; -if (!allocated) { +if (allocated !=TF_RM_ALLOCATED_ENTRY_IN_USE ) {TFP_DRV_LOG (ERR ,"%s: Entry is not allocated, type:%d, index:%d\n" ,tf_dir_2_str (parms->dir), parms->type, parms->idx); -return rc; +return -EINVAL ; }/* Convert TF type to HCAPI RM type */
drivers/net/bnxt/tf_core/tf_util.c +0 -4
@@ -92,10 +92,6 @@ tf_tbl_type_2_str(enum tf_tbl_type tbl_type)return "NAT IPv4 Source" ;case TF_TBL_TYPE_ACT_MODIFY_IPV4_DEST :return "NAT IPv4 Destination" ; -case TF_TBL_TYPE_ACT_MODIFY_IPV6_SRC : -return "NAT IPv6 Source" ; -case TF_TBL_TYPE_ACT_MODIFY_IPV6_DEST : -return "NAT IPv6 Destination" ;case TF_TBL_TYPE_METER_PROF :return "Meter Profile" ;case TF_TBL_TYPE_METER_INST :
Signature · 1 line
2.21.1 (Apple Git-122.3)
PATCH v5 27/51 net/bnxt: align CFA resources with RM
In reply to Ajit KhapardeFrom: Randy Schacher <[email protected]>
- HCAPI resources need to align for Resource Manager
- Clean up unnecessary debug messages
--- drivers/net/bnxt/tf_core/cfa_resource_types.h | 250 +++++++++--------- drivers/net/bnxt/tf_core/tf_identifier.c | 3 +- drivers/net/bnxt/tf_core/tf_msg.c | 37 ++- drivers/net/bnxt/tf_core/tf_rm.c | 21 +- drivers/net/bnxt/tf_core/tf_tbl.c | 3 +- drivers/net/bnxt/tf_core/tf_tcam.c | 28 +- 6 files changed, 197 insertions(+), 145 deletions(-)
drivers/net/bnxt/tf_core/cfa_resource_types.h +132 -118
@@ -48,232 +48,246 @@#define CFA_RESOURCE_TYPE_P59_TBL_SCOPE 0xdUL/* L2 Func */ #define CFA_RESOURCE_TYPE_P59_L2_FUNC 0xeUL -/* EPOCH */ -#define CFA_RESOURCE_TYPE_P59_EPOCH 0xfUL +/* EPOCH 0 */ +#define CFA_RESOURCE_TYPE_P59_EPOCH0 0xfUL +/* EPOCH 1 */ +#define CFA_RESOURCE_TYPE_P59_EPOCH1 0x10UL/* Metadata */ -#define CFA_RESOURCE_TYPE_P59_METADATA 0x10UL +#define CFA_RESOURCE_TYPE_P59_METADATA 0x11UL/* Connection Tracking Rule TCAM */ -#define CFA_RESOURCE_TYPE_P59_CT_RULE_TCAM 0x11UL +#define CFA_RESOURCE_TYPE_P59_CT_RULE_TCAM 0x12UL/* Range Profile */ -#define CFA_RESOURCE_TYPE_P59_RANGE_PROF 0x12UL +#define CFA_RESOURCE_TYPE_P59_RANGE_PROF 0x13UL/* Range */ -#define CFA_RESOURCE_TYPE_P59_RANGE 0x13UL +#define CFA_RESOURCE_TYPE_P59_RANGE 0x14UL/* Link Aggrigation */ -#define CFA_RESOURCE_TYPE_P59_LAG 0x14UL +#define CFA_RESOURCE_TYPE_P59_LAG 0x15UL/* VEB TCAM */ -#define CFA_RESOURCE_TYPE_P59_VEB_TCAM 0x15UL +#define CFA_RESOURCE_TYPE_P59_VEB_TCAM 0x16UL#define CFA_RESOURCE_TYPE_P59_LAST CFA_RESOURCE_TYPE_P59_VEB_TCAM/* Multicast Group */ -#define CFA_RESOURCE_TYPE_P58_MCG 0x0UL +#define CFA_RESOURCE_TYPE_P58_MCG 0x0UL/* Encap 8 byte record */ -#define CFA_RESOURCE_TYPE_P58_ENCAP_8B 0x1UL +#define CFA_RESOURCE_TYPE_P58_ENCAP_8B 0x1UL/* Encap 16 byte record */ -#define CFA_RESOURCE_TYPE_P58_ENCAP_16B 0x2UL +#define CFA_RESOURCE_TYPE_P58_ENCAP_16B 0x2UL/* Encap 64 byte record */ -#define CFA_RESOURCE_TYPE_P58_ENCAP_64B 0x3UL +#define CFA_RESOURCE_TYPE_P58_ENCAP_64B 0x3UL/* Source Property MAC */ -#define CFA_RESOURCE_TYPE_P58_SP_MAC 0x4UL +#define CFA_RESOURCE_TYPE_P58_SP_MAC 0x4UL/* Source Property MAC and IPv4 */ -#define CFA_RESOURCE_TYPE_P58_SP_MAC_IPV4 0x5UL +#define CFA_RESOURCE_TYPE_P58_SP_MAC_IPV4 0x5UL/* Source Property MAC and IPv6 */ -#define CFA_RESOURCE_TYPE_P58_SP_MAC_IPV6 0x6UL +#define CFA_RESOURCE_TYPE_P58_SP_MAC_IPV6 0x6UL/* Network Address Translation Source Port */ -#define CFA_RESOURCE_TYPE_P58_NAT_SPORT 0x7UL +#define CFA_RESOURCE_TYPE_P58_NAT_SPORT 0x7UL/* Network Address Translation Destination Port */ -#define CFA_RESOURCE_TYPE_P58_NAT_DPORT 0x8UL +#define CFA_RESOURCE_TYPE_P58_NAT_DPORT 0x8UL/* Network Address Translation Source IPv4 address */ -#define CFA_RESOURCE_TYPE_P58_NAT_S_IPV4 0x9UL +#define CFA_RESOURCE_TYPE_P58_NAT_S_IPV4 0x9UL/* Network Address Translation Destination IPv4 address */ -#define CFA_RESOURCE_TYPE_P58_NAT_D_IPV4 0xaUL -/* Network Address Translation Source IPv4 address */ -#define CFA_RESOURCE_TYPE_P58_NAT_S_IPV6 0xbUL -/* Network Address Translation Destination IPv4 address */ -#define CFA_RESOURCE_TYPE_P58_NAT_D_IPV6 0xcUL +#define CFA_RESOURCE_TYPE_P58_NAT_D_IPV4 0xaUL/* Meter */ -#define CFA_RESOURCE_TYPE_P58_METER 0xdUL +#define CFA_RESOURCE_TYPE_P58_METER 0xbUL/* Flow State */ -#define CFA_RESOURCE_TYPE_P58_FLOW_STATE 0xeUL +#define CFA_RESOURCE_TYPE_P58_FLOW_STATE 0xcUL/* Full Action Records */ -#define CFA_RESOURCE_TYPE_P58_FULL_ACTION 0xfUL +#define CFA_RESOURCE_TYPE_P58_FULL_ACTION 0xdUL/* Action Record Format 0 */ -#define CFA_RESOURCE_TYPE_P58_FORMAT_0_ACTION 0x10UL +#define CFA_RESOURCE_TYPE_P58_FORMAT_0_ACTION 0xeUL +/* Action Record Ext Format 0 */ +#define CFA_RESOURCE_TYPE_P58_EXT_FORMAT_0_ACTION 0xfUL +/* Action Record Format 1 */ +#define CFA_RESOURCE_TYPE_P58_FORMAT_1_ACTION 0x10UL/* Action Record Format 2 */ -#define CFA_RESOURCE_TYPE_P58_FORMAT_2_ACTION 0x11UL +#define CFA_RESOURCE_TYPE_P58_FORMAT_2_ACTION 0x11UL/* Action Record Format 3 */ -#define CFA_RESOURCE_TYPE_P58_FORMAT_3_ACTION 0x12UL +#define CFA_RESOURCE_TYPE_P58_FORMAT_3_ACTION 0x12UL/* Action Record Format 4 */ -#define CFA_RESOURCE_TYPE_P58_FORMAT_4_ACTION 0x13UL +#define CFA_RESOURCE_TYPE_P58_FORMAT_4_ACTION 0x13UL +/* Action Record Format 5 */ +#define CFA_RESOURCE_TYPE_P58_FORMAT_5_ACTION 0x14UL +/* Action Record Format 6 */ +#define CFA_RESOURCE_TYPE_P58_FORMAT_6_ACTION 0x15UL/* L2 Context TCAM */ -#define CFA_RESOURCE_TYPE_P58_L2_CTXT_TCAM 0x14UL +#define CFA_RESOURCE_TYPE_P58_L2_CTXT_TCAM 0x16UL/* L2 Context REMAP */ -#define CFA_RESOURCE_TYPE_P58_L2_CTXT_REMAP 0x15UL +#define CFA_RESOURCE_TYPE_P58_L2_CTXT_REMAP 0x17UL/* Profile Func */ -#define CFA_RESOURCE_TYPE_P58_PROF_FUNC 0x16UL +#define CFA_RESOURCE_TYPE_P58_PROF_FUNC 0x18UL/* Profile TCAM */ -#define CFA_RESOURCE_TYPE_P58_PROF_TCAM 0x17UL +#define CFA_RESOURCE_TYPE_P58_PROF_TCAM 0x19UL/* Exact Match Profile Id */ -#define CFA_RESOURCE_TYPE_P58_EM_PROF_ID 0x18UL +#define CFA_RESOURCE_TYPE_P58_EM_PROF_ID 0x1aUL/* Wildcard Profile Id */ -#define CFA_RESOURCE_TYPE_P58_WC_TCAM_PROF_ID 0x19UL +#define CFA_RESOURCE_TYPE_P58_WC_TCAM_PROF_ID 0x1bUL/* Exact Match Record */ -#define CFA_RESOURCE_TYPE_P58_EM_REC 0x1aUL +#define CFA_RESOURCE_TYPE_P58_EM_REC 0x1cUL/* Wildcard TCAM */ -#define CFA_RESOURCE_TYPE_P58_WC_TCAM 0x1bUL +#define CFA_RESOURCE_TYPE_P58_WC_TCAM 0x1dUL/* Meter profile */ -#define CFA_RESOURCE_TYPE_P58_METER_PROF 0x1cUL +#define CFA_RESOURCE_TYPE_P58_METER_PROF 0x1eUL/* Meter */ -#define CFA_RESOURCE_TYPE_P58_MIRROR 0x1dUL +#define CFA_RESOURCE_TYPE_P58_MIRROR 0x1fUL/* Source Property TCAM */ -#define CFA_RESOURCE_TYPE_P58_SP_TCAM 0x1eUL +#define CFA_RESOURCE_TYPE_P58_SP_TCAM 0x20UL/* Exact Match Flexible Key Builder */ -#define CFA_RESOURCE_TYPE_P58_EM_FKB 0x1fUL +#define CFA_RESOURCE_TYPE_P58_EM_FKB 0x21UL/* Wildcard Flexible Key Builder */ -#define CFA_RESOURCE_TYPE_P58_WC_FKB 0x20UL +#define CFA_RESOURCE_TYPE_P58_WC_FKB 0x22UL/* VEB TCAM */ -#define CFA_RESOURCE_TYPE_P58_VEB_TCAM 0x21UL -#define CFA_RESOURCE_TYPE_P58_LAST CFA_RESOURCE_TYPE_P58_VEB_TCAM +#define CFA_RESOURCE_TYPE_P58_VEB_TCAM 0x23UL +#define CFA_RESOURCE_TYPE_P58_LAST CFA_RESOURCE_TYPE_P58_VEB_TCAM/* Multicast Group */ -#define CFA_RESOURCE_TYPE_P45_MCG 0x0UL +#define CFA_RESOURCE_TYPE_P45_MCG 0x0UL/* Encap 8 byte record */ -#define CFA_RESOURCE_TYPE_P45_ENCAP_8B 0x1UL +#define CFA_RESOURCE_TYPE_P45_ENCAP_8B 0x1UL/* Encap 16 byte record */ -#define CFA_RESOURCE_TYPE_P45_ENCAP_16B 0x2UL +#define CFA_RESOURCE_TYPE_P45_ENCAP_16B 0x2UL/* Encap 64 byte record */ -#define CFA_RESOURCE_TYPE_P45_ENCAP_64B 0x3UL +#define CFA_RESOURCE_TYPE_P45_ENCAP_64B 0x3UL/* Source Property MAC */ -#define CFA_RESOURCE_TYPE_P45_SP_MAC 0x4UL +#define CFA_RESOURCE_TYPE_P45_SP_MAC 0x4UL/* Source Property MAC and IPv4 */ -#define CFA_RESOURCE_TYPE_P45_SP_MAC_IPV4 0x5UL +#define CFA_RESOURCE_TYPE_P45_SP_MAC_IPV4 0x5UL/* Source Property MAC and IPv6 */ -#define CFA_RESOURCE_TYPE_P45_SP_MAC_IPV6 0x6UL +#define CFA_RESOURCE_TYPE_P45_SP_MAC_IPV6 0x6UL/* 64B Counters */ -#define CFA_RESOURCE_TYPE_P45_COUNTER_64B 0x7UL +#define CFA_RESOURCE_TYPE_P45_COUNTER_64B 0x7UL/* Network Address Translation Source Port */ -#define CFA_RESOURCE_TYPE_P45_NAT_SPORT 0x8UL +#define CFA_RESOURCE_TYPE_P45_NAT_SPORT 0x8UL/* Network Address Translation Destination Port */ -#define CFA_RESOURCE_TYPE_P45_NAT_DPORT 0x9UL +#define CFA_RESOURCE_TYPE_P45_NAT_DPORT 0x9UL/* Network Address Translation Source IPv4 address */ -#define CFA_RESOURCE_TYPE_P45_NAT_S_IPV4 0xaUL +#define CFA_RESOURCE_TYPE_P45_NAT_S_IPV4 0xaUL/* Network Address Translation Destination IPv4 address */ -#define CFA_RESOURCE_TYPE_P45_NAT_D_IPV4 0xbUL -/* Network Address Translation Source IPv6 address */ -#define CFA_RESOURCE_TYPE_P45_NAT_S_IPV6 0xcUL -/* Network Address Translation Destination IPv6 address */ -#define CFA_RESOURCE_TYPE_P45_NAT_D_IPV6 0xdUL +#define CFA_RESOURCE_TYPE_P45_NAT_D_IPV4 0xbUL/* Meter */ -#define CFA_RESOURCE_TYPE_P45_METER 0xeUL +#define CFA_RESOURCE_TYPE_P45_METER 0xcUL/* Flow State */ -#define CFA_RESOURCE_TYPE_P45_FLOW_STATE 0xfUL +#define CFA_RESOURCE_TYPE_P45_FLOW_STATE 0xdUL/* Full Action Records */ -#define CFA_RESOURCE_TYPE_P45_FULL_ACTION 0x10UL +#define CFA_RESOURCE_TYPE_P45_FULL_ACTION 0xeUL/* Action Record Format 0 */ -#define CFA_RESOURCE_TYPE_P45_FORMAT_0_ACTION 0x11UL +#define CFA_RESOURCE_TYPE_P45_FORMAT_0_ACTION 0xfUL +/* Action Record Ext Format 0 */ +#define CFA_RESOURCE_TYPE_P45_EXT_FORMAT_0_ACTION 0x10UL +/* Action Record Format 1 */ +#define CFA_RESOURCE_TYPE_P45_FORMAT_1_ACTION 0x11UL/* Action Record Format 2 */ -#define CFA_RESOURCE_TYPE_P45_FORMAT_2_ACTION 0x12UL +#define CFA_RESOURCE_TYPE_P45_FORMAT_2_ACTION 0x12UL/* Action Record Format 3 */ -#define CFA_RESOURCE_TYPE_P45_FORMAT_3_ACTION 0x13UL +#define CFA_RESOURCE_TYPE_P45_FORMAT_3_ACTION 0x13UL/* Action Record Format 4 */ -#define CFA_RESOURCE_TYPE_P45_FORMAT_4_ACTION 0x14UL +#define CFA_RESOURCE_TYPE_P45_FORMAT_4_ACTION 0x14UL +/* Action Record Format 5 */ +#define CFA_RESOURCE_TYPE_P45_FORMAT_5_ACTION 0x15UL +/* Action Record Format 6 */ +#define CFA_RESOURCE_TYPE_P45_FORMAT_6_ACTION 0x16UL/* L2 Context TCAM */ -#define CFA_RESOURCE_TYPE_P45_L2_CTXT_TCAM 0x15UL +#define CFA_RESOURCE_TYPE_P45_L2_CTXT_TCAM 0x17UL/* L2 Context REMAP */ -#define CFA_RESOURCE_TYPE_P45_L2_CTXT_REMAP 0x16UL +#define CFA_RESOURCE_TYPE_P45_L2_CTXT_REMAP 0x18UL/* Profile Func */ -#define CFA_RESOURCE_TYPE_P45_PROF_FUNC 0x17UL +#define CFA_RESOURCE_TYPE_P45_PROF_FUNC 0x19UL/* Profile TCAM */ -#define CFA_RESOURCE_TYPE_P45_PROF_TCAM 0x18UL +#define CFA_RESOURCE_TYPE_P45_PROF_TCAM 0x1aUL/* Exact Match Profile Id */ -#define CFA_RESOURCE_TYPE_P45_EM_PROF_ID 0x19UL +#define CFA_RESOURCE_TYPE_P45_EM_PROF_ID 0x1bUL/* Exact Match Record */ -#define CFA_RESOURCE_TYPE_P45_EM_REC 0x1aUL +#define CFA_RESOURCE_TYPE_P45_EM_REC 0x1cUL/* Wildcard Profile Id */ -#define CFA_RESOURCE_TYPE_P45_WC_TCAM_PROF_ID 0x1bUL +#define CFA_RESOURCE_TYPE_P45_WC_TCAM_PROF_ID 0x1dUL/* Wildcard TCAM */ -#define CFA_RESOURCE_TYPE_P45_WC_TCAM 0x1cUL +#define CFA_RESOURCE_TYPE_P45_WC_TCAM 0x1eUL/* Meter profile */ -#define CFA_RESOURCE_TYPE_P45_METER_PROF 0x1dUL +#define CFA_RESOURCE_TYPE_P45_METER_PROF 0x1fUL/* Meter */ -#define CFA_RESOURCE_TYPE_P45_MIRROR 0x1eUL +#define CFA_RESOURCE_TYPE_P45_MIRROR 0x20UL/* Source Property TCAM */ -#define CFA_RESOURCE_TYPE_P45_SP_TCAM 0x1fUL +#define CFA_RESOURCE_TYPE_P45_SP_TCAM 0x21UL/* VEB TCAM */ -#define CFA_RESOURCE_TYPE_P45_VEB_TCAM 0x20UL +#define CFA_RESOURCE_TYPE_P45_VEB_TCAM 0x22UL/* Table Scope */ -#define CFA_RESOURCE_TYPE_P45_TBL_SCOPE 0x21UL -#define CFA_RESOURCE_TYPE_P45_LAST CFA_RESOURCE_TYPE_P45_TBL_SCOPE +#define CFA_RESOURCE_TYPE_P45_TBL_SCOPE 0x23UL +#define CFA_RESOURCE_TYPE_P45_LAST CFA_RESOURCE_TYPE_P45_TBL_SCOPE/* Multicast Group */ -#define CFA_RESOURCE_TYPE_P4_MCG 0x0UL +#define CFA_RESOURCE_TYPE_P4_MCG 0x0UL/* Encap 8 byte record */ -#define CFA_RESOURCE_TYPE_P4_ENCAP_8B 0x1UL +#define CFA_RESOURCE_TYPE_P4_ENCAP_8B 0x1UL/* Encap 16 byte record */ -#define CFA_RESOURCE_TYPE_P4_ENCAP_16B 0x2UL +#define CFA_RESOURCE_TYPE_P4_ENCAP_16B 0x2UL/* Encap 64 byte record */ -#define CFA_RESOURCE_TYPE_P4_ENCAP_64B 0x3UL +#define CFA_RESOURCE_TYPE_P4_ENCAP_64B 0x3UL/* Source Property MAC */ -#define CFA_RESOURCE_TYPE_P4_SP_MAC 0x4UL +#define CFA_RESOURCE_TYPE_P4_SP_MAC 0x4UL/* Source Property MAC and IPv4 */ -#define CFA_RESOURCE_TYPE_P4_SP_MAC_IPV4 0x5UL +#define CFA_RESOURCE_TYPE_P4_SP_MAC_IPV4 0x5UL/* Source Property MAC and IPv6 */ -#define CFA_RESOURCE_TYPE_P4_SP_MAC_IPV6 0x6UL +#define CFA_RESOURCE_TYPE_P4_SP_MAC_IPV6 0x6UL/* 64B Counters */ -#define CFA_RESOURCE_TYPE_P4_COUNTER_64B 0x7UL +#define CFA_RESOURCE_TYPE_P4_COUNTER_64B 0x7UL/* Network Address Translation Source Port */ -#define CFA_RESOURCE_TYPE_P4_NAT_SPORT 0x8UL +#define CFA_RESOURCE_TYPE_P4_NAT_SPORT 0x8UL/* Network Address Translation Destination Port */ -#define CFA_RESOURCE_TYPE_P4_NAT_DPORT 0x9UL +#define CFA_RESOURCE_TYPE_P4_NAT_DPORT 0x9UL/* Network Address Translation Source IPv4 address */ -#define CFA_RESOURCE_TYPE_P4_NAT_S_IPV4 0xaUL +#define CFA_RESOURCE_TYPE_P4_NAT_S_IPV4 0xaUL/* Network Address Translation Destination IPv4 address */ -#define CFA_RESOURCE_TYPE_P4_NAT_D_IPV4 0xbUL -/* Network Address Translation Source IPv6 address */ -#define CFA_RESOURCE_TYPE_P4_NAT_S_IPV6 0xcUL -/* Network Address Translation Destination IPv6 address */ -#define CFA_RESOURCE_TYPE_P4_NAT_D_IPV6 0xdUL +#define CFA_RESOURCE_TYPE_P4_NAT_D_IPV4 0xbUL/* Meter */ -#define CFA_RESOURCE_TYPE_P4_METER 0xeUL +#define CFA_RESOURCE_TYPE_P4_METER 0xcUL/* Flow State */ -#define CFA_RESOURCE_TYPE_P4_FLOW_STATE 0xfUL +#define CFA_RESOURCE_TYPE_P4_FLOW_STATE 0xdUL/* Full Action Records */ -#define CFA_RESOURCE_TYPE_P4_FULL_ACTION 0x10UL +#define CFA_RESOURCE_TYPE_P4_FULL_ACTION 0xeUL/* Action Record Format 0 */ -#define CFA_RESOURCE_TYPE_P4_FORMAT_0_ACTION 0x11UL +#define CFA_RESOURCE_TYPE_P4_FORMAT_0_ACTION 0xfUL +/* Action Record Ext Format 0 */ +#define CFA_RESOURCE_TYPE_P4_EXT_FORMAT_0_ACTION 0x10UL +/* Action Record Format 1 */ +#define CFA_RESOURCE_TYPE_P4_FORMAT_1_ACTION 0x11UL/* Action Record Format 2 */ -#define CFA_RESOURCE_TYPE_P4_FORMAT_2_ACTION 0x12UL +#define CFA_RESOURCE_TYPE_P4_FORMAT_2_ACTION 0x12UL/* Action Record Format 3 */ -#define CFA_RESOURCE_TYPE_P4_FORMAT_3_ACTION 0x13UL +#define CFA_RESOURCE_TYPE_P4_FORMAT_3_ACTION 0x13UL/* Action Record Format 4 */ -#define CFA_RESOURCE_TYPE_P4_FORMAT_4_ACTION 0x14UL +#define CFA_RESOURCE_TYPE_P4_FORMAT_4_ACTION 0x14UL +/* Action Record Format 5 */ +#define CFA_RESOURCE_TYPE_P4_FORMAT_5_ACTION 0x15UL +/* Action Record Format 6 */ +#define CFA_RESOURCE_TYPE_P4_FORMAT_6_ACTION 0x16UL/* L2 Context TCAM */ -#define CFA_RESOURCE_TYPE_P4_L2_CTXT_TCAM 0x15UL +#define CFA_RESOURCE_TYPE_P4_L2_CTXT_TCAM 0x17UL/* L2 Context REMAP */ -#define CFA_RESOURCE_TYPE_P4_L2_CTXT_REMAP 0x16UL +#define CFA_RESOURCE_TYPE_P4_L2_CTXT_REMAP 0x18UL/* Profile Func */ -#define CFA_RESOURCE_TYPE_P4_PROF_FUNC 0x17UL +#define CFA_RESOURCE_TYPE_P4_PROF_FUNC 0x19UL/* Profile TCAM */ -#define CFA_RESOURCE_TYPE_P4_PROF_TCAM 0x18UL +#define CFA_RESOURCE_TYPE_P4_PROF_TCAM 0x1aUL/* Exact Match Profile Id */ -#define CFA_RESOURCE_TYPE_P4_EM_PROF_ID 0x19UL +#define CFA_RESOURCE_TYPE_P4_EM_PROF_ID 0x1bUL/* Exact Match Record */ -#define CFA_RESOURCE_TYPE_P4_EM_REC 0x1aUL +#define CFA_RESOURCE_TYPE_P4_EM_REC 0x1cUL/* Wildcard Profile Id */ -#define CFA_RESOURCE_TYPE_P4_WC_TCAM_PROF_ID 0x1bUL +#define CFA_RESOURCE_TYPE_P4_WC_TCAM_PROF_ID 0x1dUL/* Wildcard TCAM */ -#define CFA_RESOURCE_TYPE_P4_WC_TCAM 0x1cUL +#define CFA_RESOURCE_TYPE_P4_WC_TCAM 0x1eUL/* Meter profile */ -#define CFA_RESOURCE_TYPE_P4_METER_PROF 0x1dUL +#define CFA_RESOURCE_TYPE_P4_METER_PROF 0x1fUL/* Meter */ -#define CFA_RESOURCE_TYPE_P4_MIRROR 0x1eUL +#define CFA_RESOURCE_TYPE_P4_MIRROR 0x20UL/* Source Property TCAM */ -#define CFA_RESOURCE_TYPE_P4_SP_TCAM 0x1fUL +#define CFA_RESOURCE_TYPE_P4_SP_TCAM 0x21UL/* Table Scope */ -#define CFA_RESOURCE_TYPE_P4_TBL_SCOPE 0x20UL -#define CFA_RESOURCE_TYPE_P4_LAST CFA_RESOURCE_TYPE_P4_TBL_SCOPE +#define CFA_RESOURCE_TYPE_P4_TBL_SCOPE 0x22UL +#define CFA_RESOURCE_TYPE_P4_LAST CFA_RESOURCE_TYPE_P4_TBL_SCOPE#endif /* _CFA_RESOURCE_TYPES_H_ */
drivers/net/bnxt/tf_core/tf_identifier.c +2 -1
@@ -59,7 +59,8 @@ tf_ident_bind(struct tf *tfp, init =1 ; -printf ("Identifier - initialized\n" ); +TFP_DRV_LOG (INFO , +"Identifier - initialized\n" );return 0 ; }
drivers/net/bnxt/tf_core/tf_msg.c +26 -11
@@ -18,6 +18,9 @@#include "hwrm_tf.h" #include "tf_em.h" +/* Logging defines */ +#define TF_RM_MSG_DEBUG 0 +/** * This is the MAX data we can transport across regular HWRM */
@@ -215,7 +218,7 @@ tf_msg_session_resc_qcaps(struct tf *tfp, rc =tfp_send_msg_direct (tfp, &parms);if (rc) -return rc; + goto cleanup;/* Process the response * Should always get expected number of entries
@@ -225,31 +228,39 @@ tf_msg_session_resc_qcaps(struct tf *tfp,"%s: QCAPS message size error, rc:%s\n" ,tf_dir_2_str (dir), strerror(-EINVAL)); -return -EINVAL ; + rc = -EINVAL ; + goto cleanup; } +#if (TF_RM_MSG_DEBUG ==1 )printf ("size: %d\n" ,tfp_le_to_cpu_32 (resp.size)); +#endif /* (TF_RM_MSG_DEBUG == 1) */ /* Post process the response */ data = (struct tf_rm_resc_req_entry *)qcaps_buf.va_addr; +#if (TF_RM_MSG_DEBUG ==1 )printf ("\nQCAPS\n" ); +#endif /* (TF_RM_MSG_DEBUG == 1) */ for (i =0 ; i < size; i++) { query[i].type =tfp_le_to_cpu_32 (data[i].type); query[i].min =tfp_le_to_cpu_16 (data[i].min); query[i].max =tfp_le_to_cpu_16 (data[i].max); +#if (TF_RM_MSG_DEBUG ==1 )printf ("type: %d(0x%x) %d %d\n" , query[i].type, query[i].type, query[i].min, query[i].max); +#endif /* (TF_RM_MSG_DEBUG == 1) */ } *resv_strategy = resp.flags &HWRM_TF_SESSION_RESC_QCAPS_OUTPUT_FLAGS_SESS_RESV_STRATEGY_MASK ; +cleanup:tf_msg_free_dma_buf (&qcaps_buf);return rc;
@@ -293,8 +304,10 @@ tf_msg_session_resc_alloc(struct tf *tfp, dma_size = size *sizeof (struct tf_rm_resc_entry ); rc =tf_msg_alloc_dma_buf (&resv_buf, dma_size); -if (rc) +if (rc) { +tf_msg_free_dma_buf (&req_buf);return rc; + }/* Populate the request */ req.fw_session_id =tfp_cpu_to_le_32 (fw_session_id);
@@ -320,7 +333,7 @@ tf_msg_session_resc_alloc(struct tf *tfp, rc =tfp_send_msg_direct (tfp, &parms);if (rc) -return rc; + goto cleanup;/* Process the response * Should always get expected number of entries
@@ -330,11 +343,14 @@ tf_msg_session_resc_alloc(struct tf *tfp,"%s: Alloc message size error, rc:%s\n" ,tf_dir_2_str (dir), strerror(-EINVAL)); -return -EINVAL ; + rc = -EINVAL ; + goto cleanup; } +#if (TF_RM_MSG_DEBUG ==1 )printf ("\nRESV\n" );printf ("size: %d\n" ,tfp_le_to_cpu_32 (resp.size)); +#endif /* (TF_RM_MSG_DEBUG == 1) */ /* Post process the response */ resv_data = (struct tf_rm_resc_entry *)resv_buf.va_addr;
@@ -343,14 +359,17 @@ tf_msg_session_resc_alloc(struct tf *tfp, resv[i].start =tfp_le_to_cpu_16 (resv_data[i].start); resv[i].stride =tfp_le_to_cpu_16 (resv_data[i].stride); +#if (TF_RM_MSG_DEBUG ==1 )printf ("%d type: %d(0x%x) %d %d\n" , i, resv[i].type, resv[i].type, resv[i].start, resv[i].stride); +#endif /* (TF_RM_MSG_DEBUG == 1) */ } +cleanup:tf_msg_free_dma_buf (&req_buf);tf_msg_free_dma_buf (&resv_buf);
@@ -412,8 +431,6 @@ tf_msg_session_resc_flush(struct tf *tfp, parms.mailbox =TF_KONG_MB ; rc =tfp_send_msg_direct (tfp, &parms); -if (rc) -return rc;tf_msg_free_dma_buf (&resv_buf);
@@ -434,7 +451,7 @@ tf_msg_insert_em_internal_entry(struct tf *tfp,struct tf_session *tfs = (struct tf_session *)(tfp->session->core_data);struct tf_em_64b_entry *em_result = (struct tf_em_64b_entry *)em_parms->em_record; -uint32_t flags; +uint16_t flags; req.fw_session_id =tfp_cpu_to_le_32 (tfs->session_id.internal.fw_session_id);
@@ -480,7 +497,7 @@ tf_msg_delete_em_entry(struct tf *tfp,struct tfp_send_msg_parms parms = {0 };struct hwrm_tf_em_delete_input req = {0 };struct hwrm_tf_em_delete_output resp = {0 }; -uint32_t flags; +uint16_t flags;struct tf_session *tfs = (struct tf_session *)(tfp->session->core_data);
@@ -726,8 +743,6 @@ tf_msg_tcam_entry_set(struct tf *tfp, rc =tfp_send_msg_direct (tfp, &mparms); -if (rc) - goto cleanup; cleanup:tf_msg_free_dma_buf (&buf);
drivers/net/bnxt/tf_core/tf_rm.c +8 -13
@@ -17,6 +17,9 @@#include "tfp.h" #include "tf_msg.h" +/* Logging defines */ +#define TF_RM_DEBUG 0 +/** * Generic RM Element data type that an RM DB is build upon. */
@@ -120,16 +123,11 @@ tf_rm_count_hcapi_reservations(enum tf_dir dir, cfg[i].cfg_type == TF_RM_ELEM_CFG_NULL && reservations[i] > 0) {TFP_DRV_LOG (ERR , -"%s, %s, %s allocation not supported\n" , -tf_device_module_type_2_str (type), -tf_dir_2_str (dir), -tf_device_module_type_subtype_2_str (type, i)); -printf ("%s, %s, %s allocation of %d not supported\n" , +"%s, %s, %s allocation of %d not supported\n" ,tf_device_module_type_2_str (type),tf_dir_2_str (dir), -tf_device_module_type_subtype_2_str (type, i), - reservations[i]); - +tf_device_module_type_subtype_2_str (type, i), + reservations[i]); } }
@@ -549,11 +547,6 @@ tf_rm_create_db(struct tf *tfp, db[i].alloc.entry.start = resv[j].start; db[i].alloc.entry.stride = resv[j].stride; -printf ("Entry:%d Start:%d Stride:%d\n" , - i, - resv[j].start, - resv[j].stride); -/* Only allocate BA pool if so requested */ if (parms->cfg[i].cfg_type ==TF_RM_ELEM_CFG_HCAPI_BA ) {/* Create pool */
@@ -603,10 +596,12 @@ tf_rm_create_db(struct tf *tfp, rm_db->type = parms->type; *parms->rm_db = (void *)rm_db; +#if (TF_RM_DEBUG ==1 )printf ("%s: type:%d num_entries:%d\n" ,tf_dir_2_str (parms->dir), parms->type, i); +#endif /* (TF_RM_DEBUG == 1) */ tfp_free ((void *)req);tfp_free ((void *)resv);
drivers/net/bnxt/tf_core/tf_tbl.c +2 -1
@@ -74,7 +74,8 @@ tf_tbl_bind(struct tf *tfp, init =1 ; -printf ("Table Type - initialized\n" ); +TFP_DRV_LOG (INFO , +"Table Type - initialized\n" );return 0 ; }
drivers/net/bnxt/tf_core/tf_tcam.c +27 -1
@@ -81,7 +81,8 @@ tf_tcam_bind(struct tf *tfp, init =1 ; -printf ("TCAM - initialized\n" ); +TFP_DRV_LOG (INFO , +"TCAM - initialized\n" );return 0 ; }
@@ -275,6 +276,31 @@ tf_tcam_free(struct tf *tfp,return rc; } +if (parms->type ==TF_TCAM_TBL_TYPE_WC_TCAM ) { +int i; + +for (i =-1 ; i <3 ; i +=3 ) { + aparms.index += i; + rc =tf_rm_is_allocated (&aparms); +if (rc) +return rc; + +if (allocated ==TF_RM_ALLOCATED_ENTRY_IN_USE ) { +/* Free requested element */ + fparms.index = aparms.index; + rc =tf_rm_free (&fparms); +if (rc) { +TFP_DRV_LOG (ERR , +"%s: Free failed, type:%d, index:%d\n" , +tf_dir_2_str (parms->dir), + parms->type, + fparms.index); +return rc; + } + } + } + } +/* Convert TF type to HCAPI RM type */ hparms.rm_db = tcam_db[parms->dir]; hparms.db_index = parms->type;
Signature · 1 line
2.21.1 (Apple Git-122.3)
PATCH v5 28/51 net/bnxt: implement IF tables set and get
In reply to Ajit KhapardeFrom: Jay Ding <[email protected]>
- Implement set/get for PROF_SPIF_CTXT, LKUP_PF_DFLT_ARP, PROF_PF_ERR_ARP with tunneled HWRM messages
- Add IF table for PROF_PARIF_DFLT_ARP
- Fix page size offset in the HCAPI code
- Fix Entry offset calculation
--- drivers/net/bnxt/hcapi/cfa_p40_tbl.h | 53 +++++ drivers/net/bnxt/hcapi/hcapi_cfa_defs.h | 12 +- drivers/net/bnxt/hcapi/hcapi_cfa_p4.c | 8 +- drivers/net/bnxt/hcapi/hcapi_cfa_p4.h | 18 +- drivers/net/bnxt/meson.build | 2 +- drivers/net/bnxt/tf_core/Makefile | 2 + drivers/net/bnxt/tf_core/hwrm_tf.h | 63 +++++- drivers/net/bnxt/tf_core/tf_core.c | 116 +++++++++++ drivers/net/bnxt/tf_core/tf_core.h | 104 ++++++++++ drivers/net/bnxt/tf_core/tf_device.c | 21 ++ drivers/net/bnxt/tf_core/tf_device.h | 39 ++++ drivers/net/bnxt/tf_core/tf_device_p4.c | 5 + drivers/net/bnxt/tf_core/tf_device_p4.h | 10 + drivers/net/bnxt/tf_core/tf_em_common.c | 5 +- drivers/net/bnxt/tf_core/tf_em_host.c | 12 +- drivers/net/bnxt/tf_core/tf_identifier.c | 3 +- drivers/net/bnxt/tf_core/tf_if_tbl.c | 178 +++++++++++++++++ drivers/net/bnxt/tf_core/tf_if_tbl.h | 236 +++++++++++++++++++++++ drivers/net/bnxt/tf_core/tf_msg.c | 186 +++++++++++++++--- drivers/net/bnxt/tf_core/tf_msg.h | 30 +++ drivers/net/bnxt/tf_core/tf_session.c | 14 +- 21 files changed, 1060 insertions(+), 57 deletions(-) create mode 100644 drivers/net/bnxt/tf_core/tf_if_tbl.c create mode 100644 drivers/net/bnxt/tf_core/tf_if_tbl.h
drivers/net/bnxt/hcapi/cfa_p40_tbl.h +53 -0
@@ -127,6 +127,11 @@ const struct hcapi_cfa_field cfa_p40_prof_profile_tcam_remap_mem_layout[] = { CFA_P40_PROF_PROFILE_TCAM_REMAP_MEM_TCAM_PROFILE_ID_NUM_BITS}, {CFA_P40_PROF_PROFILE_TCAM_REMAP_MEM_TCAM_KEY_ID_BITPOS, CFA_P40_PROF_PROFILE_TCAM_REMAP_MEM_TCAM_KEY_ID_NUM_BITS}, +/* Fields below not generated through automation */ + {CFA_P40_PROF_PROFILE_TCAM_REMAP_MEM_BYPASS_OPT_BITPOS, + CFA_P40_PROF_PROFILE_TCAM_REMAP_MEM_BYPASS_OPT_NUM_BITS}, + {CFA_P40_PROF_PROFILE_TCAM_REMAP_MEM_ACT_REC_PTR_BITPOS, + CFA_P40_PROF_PROFILE_TCAM_REMAP_MEM_ACT_REC_PTR_NUM_BITS}, };const struct hcapi_cfa_field cfa_p40_prof_profile_tcam_layout[] = {
@@ -247,4 +252,52 @@ const struct hcapi_cfa_field cfa_p40_eem_key_tbl_layout[] = { CFA_P40_EEM_KEY_TBL_AR_PTR_NUM_BITS}, }; + +const struct hcapi_cfa_field cfa_p40_mirror_tbl_layout[] = { + {CFA_P40_MIRROR_TBL_SP_PTR_BITPOS , +CFA_P40_MIRROR_TBL_SP_PTR_NUM_BITS }, + + {CFA_P40_MIRROR_TBL_IGN_DROP_BITPOS , +CFA_P40_MIRROR_TBL_IGN_DROP_NUM_BITS }, + + {CFA_P40_MIRROR_TBL_COPY_BITPOS , +CFA_P40_MIRROR_TBL_COPY_NUM_BITS }, + + {CFA_P40_MIRROR_TBL_EN_BITPOS , +CFA_P40_MIRROR_TBL_EN_NUM_BITS }, + + {CFA_P40_MIRROR_TBL_AR_PTR_BITPOS , +CFA_P40_MIRROR_TBL_AR_PTR_NUM_BITS }, +}; + +/* P45 Defines */ + +const struct hcapi_cfa_field cfa_p45_prof_l2_ctxt_tcam_layout[] = { + {CFA_P45_PROF_L2_CTXT_TCAM_VALID_BITPOS , +CFA_P45_PROF_L2_CTXT_TCAM_VALID_NUM_BITS }, + {CFA_P45_PROF_L2_CTXT_TCAM_SPARIF_BITPOS , +CFA_P45_PROF_L2_CTXT_TCAM_SPARIF_NUM_BITS }, + {CFA_P40_PROF_L2_CTXT_TCAM_KEY_TYPE_BITPOS , +CFA_P40_PROF_L2_CTXT_TCAM_KEY_TYPE_NUM_BITS }, + {CFA_P40_PROF_L2_CTXT_TCAM_TUN_HDR_TYPE_BITPOS , +CFA_P40_PROF_L2_CTXT_TCAM_TUN_HDR_TYPE_NUM_BITS }, + {CFA_P40_PROF_L2_CTXT_TCAM_T_L2_NUMTAGS_BITPOS , +CFA_P40_PROF_L2_CTXT_TCAM_T_L2_NUMTAGS_NUM_BITS }, + {CFA_P40_PROF_L2_CTXT_TCAM_L2_NUMTAGS_BITPOS , +CFA_P40_PROF_L2_CTXT_TCAM_L2_NUMTAGS_NUM_BITS }, + {CFA_P40_PROF_L2_CTXT_TCAM_MAC1_BITPOS , +CFA_P40_PROF_L2_CTXT_TCAM_MAC1_NUM_BITS }, + {CFA_P40_PROF_L2_CTXT_TCAM_T_OVID_BITPOS , +CFA_P40_PROF_L2_CTXT_TCAM_T_OVID_NUM_BITS }, + {CFA_P40_PROF_L2_CTXT_TCAM_T_IVID_BITPOS , +CFA_P40_PROF_L2_CTXT_TCAM_T_IVID_NUM_BITS }, + {CFA_P45_PROF_L2_CTXT_TCAM_SVIF_BITPOS , +CFA_P45_PROF_L2_CTXT_TCAM_SVIF_NUM_BITS }, + {CFA_P40_PROF_L2_CTXT_TCAM_MAC0_BITPOS , +CFA_P40_PROF_L2_CTXT_TCAM_MAC0_NUM_BITS }, + {CFA_P40_PROF_L2_CTXT_TCAM_OVID_BITPOS , +CFA_P40_PROF_L2_CTXT_TCAM_OVID_NUM_BITS }, + {CFA_P40_PROF_L2_CTXT_TCAM_IVID_BITPOS , +CFA_P40_PROF_L2_CTXT_TCAM_IVID_NUM_BITS }, +};#endif /* _CFA_P40_TBL_H_ */
drivers/net/bnxt/hcapi/hcapi_cfa_defs.h +6 -6
@@ -35,10 +35,6 @@#define CFA_GLOBAL_CFG_DATA_SZ (100) -#if SUPPORT_CFA_HW_P4 &&SUPPORT_CFA_HW_P58 &&SUPPORT_CFA_HW_P59 -#define SUPPORT_CFA_HW_ALL (1) -#endif -#include "hcapi_cfa_p4.h" #define CFA_PROF_L2CTXT_TCAM_MAX_FIELD_CNT CFA_P40_PROF_L2_CTXT_TCAM_MAX_FLD#define CFA_PROF_L2CTXT_REMAP_MAX_FIELD_CNT CFA_P40_PROF_L2_CTXT_RMP_DR_MAX_FLD
@@ -121,6 +117,8 @@ struct hcapi_cfa_layout {const struct hcapi_cfa_field *field_array;/** [out] number of HW field entries in the HW layout field array */ uint32_t array_sz; +/** [out] layout_id - layout id associated with the layout */ +uint16_t layout_id; };/**
@@ -247,6 +245,8 @@ struct hcapi_cfa_key_tbl {* applicable for newer chip */ uint8_t *base1; +/** [in] Page size for EEM tables */ +uint32_t page_size; };/**
@@ -267,7 +267,7 @@ struct hcapi_cfa_key_obj {struct hcapi_cfa_key_data {/** [in] For on-chip key table, it is the offset in unit of smallest * key. For off-chip key table, it is the byte offset relative -* to the key record memory base. +* to the key record memory base and adjusted for page and entry size. */ uint32_t offset;/** [in] HW key data buffer pointer */
@@ -668,5 +668,5 @@ int hcapi_cfa_key_hw_op(struct hcapi_cfa_hwop *op, struct hcapi_cfa_key_loc *key_loc);uint64_t hcapi_get_table_page (struct hcapi_cfa_em_table *mem, -uint32_t offset); +uint32_t page);#endif /* HCAPI_CFA_DEFS_H_ */
drivers/net/bnxt/hcapi/hcapi_cfa_p4.c +4 -4
@@ -13,7 +13,6 @@#include "hcapi_cfa_defs.h" #define HCAPI_CFA_LKUP_SEED_MEM_SIZE 512 -#define TF_EM_PAGE_SIZE (1 << 21)uint32_t hcapi_cfa_lkup_lkup3_init_cfg;uint32_t hcapi_cfa_lkup_em_seed_mem[HCAPI_CFA_LKUP_SEED_MEM_SIZE ];bool hcapi_cfa_lkup_init;
@@ -199,10 +198,9 @@ static uint32_t hcapi_cfa_lookup3_hash(uint8_t *in_key)uint64_t hcapi_get_table_page (struct hcapi_cfa_em_table *mem, -uint32_t offset) +uint32_t page) {int level =0 ; -int page = offset /TF_EM_PAGE_SIZE ;uint64_t addr;if (mem ==NULL )
@@ -362,7 +360,9 @@ int hcapi_cfa_key_hw_op(struct hcapi_cfa_hwop *op, op->hw.base_addr =hcapi_get_table_page ((struct hcapi_cfa_em_table *) key_tbl->base0, - key_obj->offset); + key_obj->offset / key_tbl->page_size); +/* Offset is adjusted to be the offset into the page */ + key_obj->offset = key_obj->offset % key_tbl->page_size;if (op->hw.base_addr ==0 )return -1 ;
drivers/net/bnxt/hcapi/hcapi_cfa_p4.h +17 -1
@@ -21,6 +21,10 @@ enum cfa_p4_tbl_id {CFA_P4_TBL_WC_TCAM_REMAP ,CFA_P4_TBL_VEB_TCAM ,CFA_P4_TBL_SP_TCAM , +CFA_P4_TBL_PROF_SPIF_DFLT_L2CTXT , +CFA_P4_TBL_PROF_PARIF_DFLT_ACT_REC_PTR , +CFA_P4_TBL_PROF_PARIF_ERR_ACT_REC_PTR , +CFA_P4_TBL_LKUP_PARIF_DFLT_ACT_REC_PTR , CFA_P4_TBL_MAX };
@@ -333,17 +337,29 @@ enum cfa_p4_action_sram_entry_type {*/ /** SRAM Action Record */ -CFA_P4_ACTION_SRAM_ENTRY_TYPE_ACT , +CFA_P4_ACTION_SRAM_ENTRY_TYPE_FULL_ACTION , + +CFA_P4_ACTION_SRAM_ENTRY_TYPE_FORMAT_0_ACTION , +CFA_P4_ACTION_SRAM_ENTRY_TYPE_FORMAT_1_ACTION , +CFA_P4_ACTION_SRAM_ENTRY_TYPE_FORMAT_2_ACTION , +CFA_P4_ACTION_SRAM_ENTRY_TYPE_FORMAT_3_ACTION , +CFA_P4_ACTION_SRAM_ENTRY_TYPE_FORMAT_4_ACTION , +/** SRAM Action Encap 8 Bytes */ CFA_P4_ACTION_SRAM_ENTRY_TYPE_ENCAP_8B ,/** SRAM Action Encap 16 Bytes */ CFA_P4_ACTION_SRAM_ENTRY_TYPE_ENCAP_16B ,/** SRAM Action Encap 64 Bytes */ CFA_P4_ACTION_SRAM_ENTRY_TYPE_ENCAP_64B , + +CFA_P4_ACTION_SRAM_ENTRY_TYPE_MODIFY_PORT_SRC , +CFA_P4_ACTION_SRAM_ENTRY_TYPE_MODIFY_PORT_DEST , +/** SRAM Action Modify IPv4 Source */ CFA_P4_ACTION_SRAM_ENTRY_TYPE_MODIFY_IPV4_SRC ,/** SRAM Action Modify IPv4 Destination */ CFA_P4_ACTION_SRAM_ENTRY_TYPE_MODIFY_IPV4_DEST , +/** SRAM Action Source Properties SMAC */ CFA_P4_ACTION_SRAM_ENTRY_TYPE_SP_SMAC , /** SRAM Action Source Properties SMAC IPv4 */
drivers/net/bnxt/meson.build +1 -1
@@ -43,7 +43,7 @@ sources = files('bnxt_cpr.c', 'tf_core/tf_shadow_tcam.c', 'tf_core/tf_tcam.c', 'tf_core/tf_util.c', - 'tf_core/tf_rm.c', + 'tf_core/tf_if_tbl.c', 'hcapi/hcapi_cfa_p4.c',
drivers/net/bnxt/tf_core/Makefile +2 -0
@@ -25,6 +25,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += tf_core/tf_shadow_tbl.c SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += tf_core/tf_shadow_tcam.c SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += tf_core/tf_tcam.c SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += tf_core/tf_util.c +SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += tf_core/tf_if_tbl.c SYMLINK-$(CONFIG_RTE_LIBRTE_BNXT_PMD)-include += tf_core/tf_core.h SYMLINK-$(CONFIG_RTE_LIBRTE_BNXT_PMD)-include += tf_core/tf_project.h
@@ -33,3 +34,4 @@ SYMLINK-$(CONFIG_RTE_LIBRTE_BNXT_PMD)-include += tf_core/tf_identifier.h SYMLINK-$(CONFIG_RTE_LIBRTE_BNXT_PMD)-include += tf_core/tf_tbl.h SYMLINK-$(CONFIG_RTE_LIBRTE_BNXT_PMD)-include += tf_core/stack.h SYMLINK-$(CONFIG_RTE_LIBRTE_BNXT_PMD)-include += tf_core/tf_tcam.h +SYMLINK-$(CONFIG_RTE_LIBRTE_BNXT_PMD)-include += tf_core/tf_if_tbl.h
drivers/net/bnxt/tf_core/hwrm_tf.h +61 -2
85 lines not on this page · raw message
drivers/net/bnxt/tf_core/tf_core.c +116 -0
119 lines not on this page · raw message
drivers/net/bnxt/tf_core/tf_core.h +104 -0
108 lines not on this page · raw message
drivers/net/bnxt/tf_core/tf_device.c +21 -0
@@ -44,6 +44,7 @@ tf_dev_bind_p4(struct tf *tfp,struct tf_tbl_cfg_parms tbl_cfg;struct tf_tcam_cfg_parms tcam_cfg;struct tf_em_cfg_parms em_cfg; +struct tf_if_tbl_cfg_parms if_tbl_cfg; dev_handle->type =TF_DEVICE_TYPE_WH ;/* Initial function initialization */
@@ -114,6 +115,19 @@ tf_dev_bind_p4(struct tf *tfp, goto fail; } +/* +* IF_TBL +*/ + if_tbl_cfg.num_elements =TF_IF_TBL_TYPE_MAX ; + if_tbl_cfg.cfg = tf_if_tbl_p4; + if_tbl_cfg.shadow_copy = shadow_copy; + rc =tf_if_tbl_bind (tfp, &if_tbl_cfg); +if (rc) { +TFP_DRV_LOG (ERR , +"IF Table initialization failure\n" ); + goto fail; + } +/* Final function initialization */ dev_handle->ops = &tf_dev_ops_p4;
@@ -186,6 +200,13 @@ tf_dev_unbind_p4(struct tf *tfp) fail = true; } + rc =tf_if_tbl_unbind (tfp); +if (rc) { +TFP_DRV_LOG (ERR , +"Device unbind failed, IF Table Type\n" ); + fail = true; + } +if (fail)return -1 ;
drivers/net/bnxt/tf_core/tf_device.h +39 -0
@@ -10,6 +10,7 @@#include "tf_identifier.h" #include "tf_tbl.h" #include "tf_tcam.h" +#include "tf_if_tbl.h" struct tf ;struct tf_session ;
@@ -567,6 +568,44 @@ struct tf_dev_ops {*/ int (*tf_dev_free_tbl_scope)(struct tf *tfp,struct tf_free_tbl_scope_parms *parms); + +/** +* Sets the specified interface table type element. +* +* This API sets the specified element data by invoking the +* firmware. +* +* [in] tfp +* Pointer to TF handle +* +* [in] parms +* Pointer to interface table set parameters +* +* Returns +* - (0) if successful. +* - (-EINVAL) on failure. +*/ +int (*tf_dev_set_if_tbl)(struct tf *tfp, +struct tf_if_tbl_set_parms *parms); + +/** +* Retrieves the specified interface table type element. +* +* This API retrieves the specified element data by invoking the +* firmware. +* +* [in] tfp +* Pointer to TF handle +* +* [in] parms +* Pointer to table get parameters +* +* Returns +* - (0) if successful. +* - (-EINVAL) on failure. +*/ +int (*tf_dev_get_if_tbl)(struct tf *tfp, +struct tf_if_tbl_get_parms *parms); };/**
drivers/net/bnxt/tf_core/tf_device_p4.c +5 -0
@@ -11,6 +11,7 @@#include "tf_tbl.h" #include "tf_tcam.h" #include "tf_em.h" +#include "tf_if_tbl.h" /** * Device specific function that retrieves the MAX number of HCAPI
@@ -105,6 +106,8 @@ const struct tf_dev_ops tf_dev_ops_p4_init = { .tf_dev_delete_ext_em_entry = NULL, .tf_dev_alloc_tbl_scope = NULL, .tf_dev_free_tbl_scope = NULL, + .tf_dev_set_if_tbl = NULL, + .tf_dev_get_if_tbl = NULL, };/**
@@ -135,4 +138,6 @@ const struct tf_dev_ops tf_dev_ops_p4 = { .tf_dev_delete_ext_em_entry = tf_em_delete_ext_entry, .tf_dev_alloc_tbl_scope = tf_em_ext_common_alloc, .tf_dev_free_tbl_scope = tf_em_ext_common_free, + .tf_dev_set_if_tbl = tf_if_tbl_set, + .tf_dev_get_if_tbl = tf_if_tbl_get, };
drivers/net/bnxt/tf_core/tf_device_p4.h +10 -0
@@ -10,6 +10,7 @@#include "tf_core.h" #include "tf_rm.h" +#include "tf_if_tbl.h" struct tf_rm_element_cfg tf_ident_p4[TF_IDENT_TYPE_MAX ] = { {TF_RM_ELEM_CFG_HCAPI_BA ,CFA_RESOURCE_TYPE_P4_L2_CTXT_REMAP },
@@ -86,4 +87,13 @@ struct tf_rm_element_cfg tf_em_int_p4[TF_EM_TBL_TYPE_MAX] = { { TF_RM_ELEM_CFG_NULL, CFA_RESOURCE_TYPE_INVALID }, }; +struct tf_if_tbl_cfg tf_if_tbl_p4[TF_IF_TBL_TYPE_MAX] = { + { TF_IF_TBL_CFG, CFA_P4_TBL_PROF_SPIF_DFLT_L2CTXT }, + { TF_IF_TBL_CFG, CFA_P4_TBL_PROF_PARIF_DFLT_ACT_REC_PTR }, + { TF_IF_TBL_CFG, CFA_P4_TBL_PROF_PARIF_ERR_ACT_REC_PTR }, + { TF_IF_TBL_CFG, CFA_P4_TBL_LKUP_PARIF_DFLT_ACT_REC_PTR }, + { TF_IF_TBL_CFG_NULL, CFA_IF_TBL_TYPE_INVALID }, + { TF_IF_TBL_CFG_NULL, CFA_IF_TBL_TYPE_INVALID } +}; + #endif /* _TF_DEVICE_P4_H_ */
drivers/net/bnxt/tf_core/tf_em_common.c +2 -3
@@ -337,11 +337,10 @@ tf_em_ext_common_bind(struct tf *tfp, db_exists =1 ; } -if (db_exists) { - mem_type = parms->mem_type; +if (db_exists) init =1 ; - } + mem_type = parms->mem_type;return 0 ; }
drivers/net/bnxt/tf_core/tf_em_host.c +7 -5
@@ -831,7 +831,8 @@ tf_insert_eem_entry(struct tf_tbl_scope_cb *tbl_scope_cb, op.opcode =HCAPI_CFA_HWOPS_ADD ; key_tbl.base0 = (uint8_t *) &tbl_scope_cb->em_ctx_info[parms->dir].em_tables[TF_KEY0_TABLE ]; - key_obj.offset = (index *TF_EM_KEY_RECORD_SIZE ) %TF_EM_PAGE_SIZE ; + key_tbl.page_size =TF_EM_PAGE_SIZE ; + key_obj.offset = index *TF_EM_KEY_RECORD_SIZE ; key_obj.data = (uint8_t *)&key_entry; key_obj.size =TF_EM_KEY_RECORD_SIZE ;
@@ -847,8 +848,7 @@ tf_insert_eem_entry(struct tf_tbl_scope_cb *tbl_scope_cb, key_tbl.base0 = (uint8_t *) &tbl_scope_cb->em_ctx_info[parms->dir].em_tables[TF_KEY1_TABLE ]; - key_obj.offset = - (index *TF_EM_KEY_RECORD_SIZE ) %TF_EM_PAGE_SIZE ; + key_obj.offset = index *TF_EM_KEY_RECORD_SIZE ; rc = hcapi_cfa_key_hw_op(&op, &key_tbl,
@@ -914,7 +914,8 @@ tf_delete_eem_entry(struct tf_tbl_scope_cb *tbl_scope_cb, &tbl_scope_cb->em_ctx_info[parms->dir].em_tables[(hash_type ==0 ?TF_KEY0_TABLE :TF_KEY1_TABLE )]; - key_obj.offset = (index *TF_EM_KEY_RECORD_SIZE ) %TF_EM_PAGE_SIZE ; + key_tbl.page_size =TF_EM_PAGE_SIZE ; + key_obj.offset = index *TF_EM_KEY_RECORD_SIZE ; key_obj.data =NULL ; key_obj.size =TF_EM_KEY_RECORD_SIZE ;
@@ -1195,7 +1196,8 @@ int tf_tbl_ext_host_set(struct tf *tfp, op.opcode =HCAPI_CFA_HWOPS_PUT ; key_tbl.base0 = (uint8_t *)&tbl_scope_cb->em_ctx_info[parms->dir].em_tables[TF_RECORD_TABLE ]; - key_obj.offset = parms->idx %TF_EM_PAGE_SIZE ; + key_tbl.page_size =TF_EM_PAGE_SIZE ; + key_obj.offset = parms->idx; key_obj.data = parms->data; key_obj.size = parms->data_sz_in_bytes;
drivers/net/bnxt/tf_core/tf_identifier.c +1 -2
@@ -68,7 +68,7 @@ tf_ident_bind(struct tf *tfp,int tf_ident_unbind (struct tf *tfp) { -int rc; +int rc =0 ;int i;struct tf_rm_free_db_parms fparms = {0 };
@@ -89,7 +89,6 @@ tf_ident_unbind(struct tf *tfp)TFP_DRV_LOG (ERR ,"rm free failed on unbind\n" ); } - ident_db[i] =NULL ; }
drivers/net/bnxt/tf_core/tf_if_tbl.c new file +178 -0
178 lines not on this page · raw message
drivers/net/bnxt/tf_core/tf_if_tbl.h new file +236 -0
236 lines not on this page · raw message
drivers/net/bnxt/tf_core/tf_msg.c +155 -31
270 lines not on this page · raw message
drivers/net/bnxt/tf_core/tf_msg.h +30 -0
@@ -428,4 +428,34 @@ int tf_msg_bulk_get_tbl_entry(struct tf *tfp,uint16_t entry_sz_in_bytes, uint64_t physical_mem_addr); +/** +* Sends Set message of a IF Table Type element to the firmware. +* +* [in] tfp +* Pointer to session handle +* +* [in] parms +* Pointer to IF table set parameters +* +* Returns: +* 0 on Success else internal Truflow error +*/ +int tf_msg_set_if_tbl_entry (struct tf *tfp, +struct tf_if_tbl_set_parms *params); + +/** +* Sends get message of a IF Table Type element to the firmware. +* +* [in] tfp +* Pointer to session handle +* +* [in] parms +* Pointer to IF table get parameters +* +* Returns: +* 0 on Success else internal Truflow error +*/ +int tf_msg_get_if_tbl_entry (struct tf *tfp, +struct tf_if_tbl_get_parms *params); +#endif /* _TF_MSG_H_ */
drivers/net/bnxt/tf_core/tf_session.c +12 -2
@@ -70,14 +70,24 @@ tf_session_open_session(struct tf *tfp, goto cleanup; } tfp->session->core_data = cparms.mem_va; + session_id = &parms->open_cfg->session_id; + +/* Update Session Info, which is what is visible to the caller */ + tfp->session->ver.major =0 ; + tfp->session->ver.minor =0 ; + tfp->session->ver.update =0 ; -/* Initialize Session and Device */ + tfp->session->session_id.internal.domain = session_id->internal.domain; + tfp->session->session_id.internal.bus = session_id->internal.bus; + tfp->session->session_id.internal.device = session_id->internal.device; + tfp->session->session_id.internal.fw_session_id = fw_session_id; + +/* Initialize Session and Device, which is private */ session = (struct tf_session *)tfp->session->core_data; session->ver.major =0 ; session->ver.minor =0 ; session->ver.update =0 ; - session_id = &parms->open_cfg->session_id; session->session_id.internal.domain = session_id->internal.domain; session->session_id.internal.bus = session_id->internal.bus; session->session_id.internal.device = session_id->internal.device;
Signature · 1 line
2.21.1 (Apple Git-122.3)
PATCH v5 29/51 net/bnxt: add TF register and unregister
In reply to Ajit KhapardeFrom: Michael Wildt <[email protected]>
- Add TF register/unregister support. Session got session clients to keep track of the ctrl-channels/function.
- Add support code to tfp layer
--- drivers/net/bnxt/meson.build | 1 + drivers/net/bnxt/tf_core/Makefile | 1 + drivers/net/bnxt/tf_core/ll.c | 52 +++ drivers/net/bnxt/tf_core/ll.h | 46 +++ drivers/net/bnxt/tf_core/tf_core.c | 26 +- drivers/net/bnxt/tf_core/tf_core.h | 105 +++-- drivers/net/bnxt/tf_core/tf_msg.c | 84 +++- drivers/net/bnxt/tf_core/tf_msg.h | 42 +- drivers/net/bnxt/tf_core/tf_rm.c | 2 +- drivers/net/bnxt/tf_core/tf_session.c | 569 ++++++++++++++++++++++++-- drivers/net/bnxt/tf_core/tf_session.h | 201 ++++++++- drivers/net/bnxt/tf_core/tf_tbl.c | 2 + drivers/net/bnxt/tf_core/tf_tcam.c | 8 +- drivers/net/bnxt/tf_core/tfp.c | 17 + drivers/net/bnxt/tf_core/tfp.h | 15 + 15 files changed, 1075 insertions(+), 96 deletions(-) create mode 100644 drivers/net/bnxt/tf_core/ll.c create mode 100644 drivers/net/bnxt/tf_core/ll.h
drivers/net/bnxt/meson.build +1 -0
@@ -44,6 +44,7 @@ sources = files('bnxt_cpr.c', 'tf_core/tf_tcam.c', 'tf_core/tf_util.c', 'tf_core/tf_if_tbl.c', + 'tf_core/ll.c', 'hcapi/hcapi_cfa_p4.c',
drivers/net/bnxt/tf_core/Makefile +1 -0
@@ -8,6 +8,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += tf_core/bitalloc.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/ll.c SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += tf_core/tf_core.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/ll.c new file +52 -0
52 lines not on this page · raw message
drivers/net/bnxt/tf_core/ll.h new file +46 -0
46 lines not on this page · raw message
drivers/net/bnxt/tf_core/tf_core.c +11 -15
@@ -58,21 +58,20 @@ tf_open_session(struct tf *tfp, parms->session_id.internal.device = device; oparms.open_cfg = parms; +/* Session vs session client is decided in +* tf_session_open_session() +*/ +printf ("TF_OPEN, %s\n" , parms->ctrl_chan_name); rc =tf_session_open_session (tfp, &oparms);/* Logging handled by tf_session_open_session */ if (rc)return rc;TFP_DRV_LOG (INFO , -"Session created, session_id:%d\n" , - parms->session_id.id); - -TFP_DRV_LOG (INFO , -"domain:%d, bus:%d, device:%d, fw_session_id:%d\n" , +"domain:%d, bus:%d, device:%d\n" , parms->session_id.internal.domain, parms->session_id.internal.bus, - parms->session_id.internal.device, - parms->session_id.internal.fw_session_id); + parms->session_id.internal.device);return 0 ; }
@@ -152,6 +151,9 @@ tf_close_session(struct tf *tfp) cparms.ref_count = &ref_count; cparms.session_id = &session_id; +/* Session vs session client is decided in +* tf_session_close_session() +*/ rc =tf_session_close_session (tfp, &cparms);/* Logging handled by tf_session_close_session */
@@ -159,16 +161,10 @@ tf_close_session(struct tf *tfp)return rc;TFP_DRV_LOG (INFO , -"Closed session, session_id:%d, ref_count:%d\n" , - cparms.session_id->id, - *cparms.ref_count); - -TFP_DRV_LOG (INFO , -"domain:%d, bus:%d, device:%d, fw_session_id:%d\n" , +"domain:%d, bus:%d, device:%d\n" , cparms.session_id->internal.domain, cparms.session_id->internal.bus, - cparms.session_id->internal.device, - cparms.session_id->internal.fw_session_id); + cparms.session_id->internal.device);return rc; }
drivers/net/bnxt/tf_core/tf_core.h +80 -25
176 lines not on this page · raw message
drivers/net/bnxt/tf_core/tf_msg.c +82 -2
102 lines not on this page · raw message
drivers/net/bnxt/tf_core/tf_msg.h +41 -1
60 lines not on this page · raw message
drivers/net/bnxt/tf_core/tf_rm.c +1 -1
@@ -389,7 +389,7 @@ tf_rm_create_db(struct tf *tfp,TF_CHECK_PARMS2 (tfp, parms);/* Retrieve the session information */ - rc =tf_session_get_session (tfp, &tfs); + rc =tf_session_get_session_internal (tfp, &tfs);if (rc)return rc;
drivers/net/bnxt/tf_core/tf_session.c +537 -32
671 lines not on this page · raw message
drivers/net/bnxt/tf_core/tf_session.h +184 -17
291 lines not on this page · raw message
drivers/net/bnxt/tf_core/tf_tbl.c +2 -0
@@ -269,6 +269,7 @@ tf_tbl_set(struct tf *tfp,tf_dir_2_str (parms->dir), parms->type, strerror(-rc)); +return rc; }return 0 ;
@@ -338,6 +339,7 @@ tf_tbl_get(struct tf *tfp,tf_dir_2_str (parms->dir), parms->type, strerror(-rc)); +return rc; }return 0 ;
drivers/net/bnxt/tf_core/tf_tcam.c +5 -3
@@ -138,7 +138,7 @@ tf_tcam_alloc(struct tf *tfp, }/* Retrieve the session information */ - rc =tf_session_get_session (tfp, &tfs); + rc =tf_session_get_session_internal (tfp, &tfs);if (rc)return rc;
@@ -218,7 +218,7 @@ tf_tcam_free(struct tf *tfp, }/* Retrieve the session information */ - rc =tf_session_get_session (tfp, &tfs); + rc =tf_session_get_session_internal (tfp, &tfs);if (rc)return rc;
@@ -319,6 +319,7 @@ tf_tcam_free(struct tf *tfp,tf_tcam_tbl_2_str (parms->type), parms->idx, strerror(-rc)); +return rc; }return 0 ;
@@ -353,7 +354,7 @@ tf_tcam_set(struct tf *tfp __rte_unused, }/* Retrieve the session information */ - rc =tf_session_get_session (tfp, &tfs); + rc =tf_session_get_session_internal (tfp, &tfs);if (rc)return rc;
@@ -415,6 +416,7 @@ tf_tcam_set(struct tf *tfp __rte_unused,tf_tcam_tbl_2_str (parms->type), parms->idx, strerror(-rc)); +return rc; }return 0 ;
drivers/net/bnxt/tf_core/tfp.c +17 -0
@@ -161,3 +161,20 @@ tfp_spinlock_unlock(struct tfp_spinlock_parms *parms) {rte_spinlock_unlock (&parms->slock); } + +int +tfp_get_fid (struct tf *tfp,uint16_t *fw_fid) +{ +struct bnxt *bp =NULL ; + +if (tfp ==NULL || fw_fid ==NULL ) +return -EINVAL ; + + bp = container_of(tfp, struct bnxt, tfp); +if (bp ==NULL ) +return -EINVAL ; + + *fw_fid = bp->fw_fid; + +return 0 ; +}
drivers/net/bnxt/tf_core/tfp.h +15 -0
@@ -238,4 +238,19 @@ int tfp_get_fid(struct tf *tfp, uint16_t *fw_fid);#define tfp_bswap_32 (val) rte_bswap32(val)#define tfp_bswap_64 (val) rte_bswap64(val) +/** +* Lookup of the FID in the platform specific structure. +* +* [in] session +* Pointer to session handle +* +* [out] fw_fid +* Pointer to the fw_fid +* +* Returns: +* 0 - Success +* -EINVAL - Parameter error +*/ +int tfp_get_fid (struct tf *tfp,uint16_t *fw_fid); +#endif /* _TFP_H_ */
Signature · 1 line
2.21.1 (Apple Git-122.3)
PATCH v5 30/51 net/bnxt: add global config set and get APIs
In reply to Ajit KhapardeFrom: Jay Ding <[email protected]>
- Add support to update global configuration for ACT_TECT and ACT_ABCR.
- Add support to allow Tunnel and Action global configuration.
- Remove register read and write operations.
- Remove the register read and write support.
--- drivers/net/bnxt/hcapi/hcapi_cfa.h | 3 + drivers/net/bnxt/meson.build | 1 + drivers/net/bnxt/tf_core/Makefile | 2 + drivers/net/bnxt/tf_core/hwrm_tf.h | 54 +++++- drivers/net/bnxt/tf_core/tf_core.c | 137 ++++++++++++++++ drivers/net/bnxt/tf_core/tf_core.h | 77 +++++++++ drivers/net/bnxt/tf_core/tf_device.c | 20 +++ drivers/net/bnxt/tf_core/tf_device.h | 33 ++++ drivers/net/bnxt/tf_core/tf_device_p4.c | 4 + drivers/net/bnxt/tf_core/tf_device_p4.h | 5 + drivers/net/bnxt/tf_core/tf_global_cfg.c | 199 +++++++++++++++++++++++ drivers/net/bnxt/tf_core/tf_global_cfg.h | 170 +++++++++++++++++++ drivers/net/bnxt/tf_core/tf_msg.c | 109 ++++++++++++- drivers/net/bnxt/tf_core/tf_msg.h | 31 ++++ 14 files changed, 840 insertions(+), 5 deletions(-) create mode 100644 drivers/net/bnxt/tf_core/tf_global_cfg.c create mode 100644 drivers/net/bnxt/tf_core/tf_global_cfg.h
drivers/net/bnxt/hcapi/hcapi_cfa.h +3 -0
@@ -245,6 +245,9 @@ int hcapi_cfa_p4_wc_tcam_rec_hwop(struct hcapi_cfa_hwop *op, struct hcapi_cfa_data *obj_data);int hcapi_cfa_p4_mirror_hwop (struct hcapi_cfa_hwop *op,struct hcapi_cfa_data *mirror); +int hcapi_cfa_p4_global_cfg_hwop (struct hcapi_cfa_hwop *op, +uint32_t type, +struct hcapi_cfa_data *config);#endif /* SUPPORT_CFA_HW_P4 */ /** * HCAPI CFA device HW operation function callback definition
drivers/net/bnxt/meson.build +1 -0
@@ -45,6 +45,7 @@ sources = files('bnxt_cpr.c', 'tf_core/tf_util.c', 'tf_core/tf_if_tbl.c', 'tf_core/ll.c', + 'tf_core/tf_global_cfg.c', 'hcapi/hcapi_cfa_p4.c',
drivers/net/bnxt/tf_core/Makefile +2 -0
@@ -27,6 +27,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += tf_core/tf_shadow_tcam.c SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += tf_core/tf_tcam.c SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += tf_core/tf_util.c SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += tf_core/tf_if_tbl.c +SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += tf_core/tf_global_cfg.c SYMLINK-$(CONFIG_RTE_LIBRTE_BNXT_PMD)-include += tf_core/tf_core.h SYMLINK-$(CONFIG_RTE_LIBRTE_BNXT_PMD)-include += tf_core/tf_project.h
@@ -36,3 +37,4 @@ SYMLINK-$(CONFIG_RTE_LIBRTE_BNXT_PMD)-include += tf_core/tf_tbl.h SYMLINK-$(CONFIG_RTE_LIBRTE_BNXT_PMD)-include += tf_core/stack.h SYMLINK-$(CONFIG_RTE_LIBRTE_BNXT_PMD)-include += tf_core/tf_tcam.h SYMLINK-$(CONFIG_RTE_LIBRTE_BNXT_PMD)-include += tf_core/tf_if_tbl.h +SYMLINK-$(CONFIG_RTE_LIBRTE_BNXT_PMD)-include += tf_core/tf_global_cfg.h
drivers/net/bnxt/tf_core/hwrm_tf.h +51 -3
77 lines not on this page · raw message
drivers/net/bnxt/tf_core/tf_core.c +137 -0
149 lines not on this page · raw message
drivers/net/bnxt/tf_core/tf_core.h +77 -0
83 lines not on this page · raw message
drivers/net/bnxt/tf_core/tf_device.c +20 -0
@@ -45,6 +45,7 @@ tf_dev_bind_p4(struct tf *tfp,struct tf_tcam_cfg_parms tcam_cfg;struct tf_em_cfg_parms em_cfg;struct tf_if_tbl_cfg_parms if_tbl_cfg; +struct tf_global_cfg_cfg_parms global_cfg; dev_handle->type =TF_DEVICE_TYPE_WH ;/* Initial function initialization */
@@ -128,6 +129,18 @@ tf_dev_bind_p4(struct tf *tfp, goto fail; } +/* +* GLOBAL_CFG +*/ + global_cfg.num_elements =TF_GLOBAL_CFG_TYPE_MAX ; + global_cfg.cfg = tf_global_cfg_p4; + rc =tf_global_cfg_bind (tfp, &global_cfg); +if (rc) { +TFP_DRV_LOG (ERR , +"Global Cfg initialization failure\n" ); + goto fail; + } +/* Final function initialization */ dev_handle->ops = &tf_dev_ops_p4;
@@ -207,6 +220,13 @@ tf_dev_unbind_p4(struct tf *tfp) fail = true; } + rc =tf_global_cfg_unbind (tfp); +if (rc) { +TFP_DRV_LOG (ERR , +"Device unbind failed, Global Cfg Type\n" ); + fail = true; + } +if (fail)return -1 ;
drivers/net/bnxt/tf_core/tf_device.h +33 -0
@@ -11,6 +11,7 @@#include "tf_tbl.h" #include "tf_tcam.h" #include "tf_if_tbl.h" +#include "tf_global_cfg.h" struct tf ;struct tf_session ;
@@ -606,6 +607,38 @@ struct tf_dev_ops {*/ int (*tf_dev_get_if_tbl)(struct tf *tfp,struct tf_if_tbl_get_parms *parms); + +/** +* Update global cfg +* +* [in] tfp +* Pointer to TF handle +* +* [in] parms +* Pointer to global cfg parameters +* +* returns: +* 0 - Success +* -EINVAL - Error +*/ +int (*tf_dev_set_global_cfg)(struct tf *tfp, +struct tf_dev_global_cfg_parms *parms); + +/** +* Get global cfg +* +* [in] tfp +* Pointer to TF handle +* +* [in] parms +* Pointer to global cfg parameters +* +* returns: +* 0 - Success +* -EINVAL - Error +*/ +int (*tf_dev_get_global_cfg)(struct tf *tfp, +struct tf_dev_global_cfg_parms *parms); };/**
drivers/net/bnxt/tf_core/tf_device_p4.c +4 -0
@@ -108,6 +108,8 @@ const struct tf_dev_ops tf_dev_ops_p4_init = { .tf_dev_free_tbl_scope = NULL, .tf_dev_set_if_tbl = NULL, .tf_dev_get_if_tbl = NULL, + .tf_dev_set_global_cfg = NULL, + .tf_dev_get_global_cfg = NULL, };/**
@@ -140,4 +142,6 @@ const struct tf_dev_ops tf_dev_ops_p4 = { .tf_dev_free_tbl_scope = tf_em_ext_common_free, .tf_dev_set_if_tbl = tf_if_tbl_set, .tf_dev_get_if_tbl = tf_if_tbl_get, + .tf_dev_set_global_cfg = tf_global_cfg_set, + .tf_dev_get_global_cfg = tf_global_cfg_get, };
drivers/net/bnxt/tf_core/tf_device_p4.h +5 -0
@@ -11,6 +11,7 @@#include "tf_core.h" #include "tf_rm.h" #include "tf_if_tbl.h" +#include "tf_global_cfg.h" struct tf_rm_element_cfg tf_ident_p4[TF_IDENT_TYPE_MAX ] = { {TF_RM_ELEM_CFG_HCAPI_BA ,CFA_RESOURCE_TYPE_P4_L2_CTXT_REMAP },
@@ -96,4 +97,8 @@ struct tf_if_tbl_cfg tf_if_tbl_p4[TF_IF_TBL_TYPE_MAX] = { { TF_IF_TBL_CFG_NULL, CFA_IF_TBL_TYPE_INVALID } }; +struct tf_global_cfg_cfg tf_global_cfg_p4[TF_GLOBAL_CFG_TYPE_MAX ] = { + {TF_GLOBAL_CFG_CFG_HCAPI ,TF_TUNNEL_ENCAP }, + {TF_GLOBAL_CFG_CFG_HCAPI ,TF_ACTION_BLOCK }, +};#endif /* _TF_DEVICE_P4_H_ */
drivers/net/bnxt/tf_core/tf_global_cfg.c new file +199 -0
199 lines not on this page · raw message
drivers/net/bnxt/tf_core/tf_global_cfg.h new file +170 -0
170 lines not on this page · raw message
drivers/net/bnxt/tf_core/tf_msg.c +107 -2
121 lines not on this page · raw message
drivers/net/bnxt/tf_core/tf_msg.h +31 -0
@@ -12,6 +12,7 @@#include "tf_tbl.h" #include "tf_rm.h" #include "tf_tcam.h" +#include "tf_global_cfg.h" struct tf ;
@@ -448,6 +449,36 @@ int tf_msg_get_tbl_entry(struct tf *tfp,/* HWRM Tunneled messages */ +/** +* Sends global cfg read request to Firmware +* +* [in] tfp +* Pointer to TF handle +* +* [in] params +* Pointer to read parameters +* +* Returns: +* 0 on Success else internal Truflow error +*/ +int tf_msg_get_global_cfg (struct tf *tfp, +struct tf_dev_global_cfg_parms *params); + +/** +* Sends global cfg update request to Firmware +* +* [in] tfp +* Pointer to TF handle +* +* [in] params +* Pointer to write parameters +* +* Returns: +* 0 on Success else internal Truflow error +*/ +int tf_msg_set_global_cfg (struct tf *tfp, +struct tf_dev_global_cfg_parms *params); +/** * Sends bulk get message of a Table Type element to the firmware. *
Signature · 1 line
2.21.1 (Apple Git-122.3)
PATCH v5 31/51 net/bnxt: add support for EEM System memory
In reply to Ajit KhapardeFrom: Peter Spreadborough <[email protected]>
- Select EEM Host or System memory via config parameter
- Add EEM system memory support for kernel memory
- Dependent on DPDK changes that add support for the HWRM_OEM_CMD.
--- config/common_base | 1 + drivers/net/bnxt/Makefile | 3 + drivers/net/bnxt/bnxt.h | 8 + drivers/net/bnxt/bnxt_hwrm.c | 27 + drivers/net/bnxt/bnxt_hwrm.h | 1 + drivers/net/bnxt/meson.build | 2 +- drivers/net/bnxt/tf_core/Makefile | 5 +- drivers/net/bnxt/tf_core/tf_core.c | 13 +- drivers/net/bnxt/tf_core/tf_core.h | 4 +- drivers/net/bnxt/tf_core/tf_device.c | 5 +- drivers/net/bnxt/tf_core/tf_device_p4.c | 2 +- drivers/net/bnxt/tf_core/tf_em.h | 113 +--- drivers/net/bnxt/tf_core/tf_em_common.c | 683 ++++++++++++++++++++++- drivers/net/bnxt/tf_core/tf_em_common.h | 30 ++ drivers/net/bnxt/tf_core/tf_em_host.c | 689 +----------------------- drivers/net/bnxt/tf_core/tf_em_system.c | 541 ++++++++++++++++--- drivers/net/bnxt/tf_core/tf_if_tbl.h | 4 +- drivers/net/bnxt/tf_core/tf_msg.c | 24 + drivers/net/bnxt/tf_core/tf_tbl.h | 7 + drivers/net/bnxt/tf_core/tfp.c | 12 + drivers/net/bnxt/tf_core/tfp.h | 15 + 21 files changed, 1319 insertions(+), 870 deletions(-)
config/common_base +1 -0
@@ -220,6 +220,7 @@ CONFIG_RTE_LIBRTE_BNX2X_DEBUG_PERIODIC=n # Compile burst-oriented Broadcom BNXT PMD driver # CONFIG_RTE_LIBRTE_BNXT_PMD=y +CONFIG_RTE_LIBRTE_BNXT_PMD_SYSTEM=n # # Compile burst-oriented Chelsio Terminator (CXGBE) PMD
drivers/net/bnxt/Makefile +3 -0
@@ -50,6 +50,9 @@ CFLAGS += -I$(SRCDIR) -I$(SRCDIR)/tf_ulp -I$(SRCDIR)/tf_core -I$(SRCDIR)/hcapi include $(SRCDIR)/tf_ulp/Makefile include $(SRCDIR)/tf_core/Makefile include $(SRCDIR)/hcapi/Makefile +ifeq ($(CONFIG_RTE_LIBRTE_BNXT_PMD_SYSTEM), y) +CFLAGS += -DTF_USE_SYSTEM_MEM +endif endif #
drivers/net/bnxt/bnxt.h +8 -0
@@ -563,6 +563,13 @@ struct bnxt_rep_info { DEV_RX_OFFLOAD_SCATTER | \ DEV_RX_OFFLOAD_RSS_HASH) +#define MAX_TABLE_SUPPORT 4 +#define MAX_DIR_SUPPORT 2 +struct bnxt_dmabuf_info { +uint32_t entry_num; +int fd[MAX_DIR_SUPPORT ][MAX_TABLE_SUPPORT ]; +}; +#define BNXT_HWRM_SHORT_REQ_LEN sizeof(struct hwrm_short_input)struct bnxt_flow_stat_info {
@@ -780,6 +787,7 @@ struct bnxt {uint16_t port_svif;struct tf tfp; +struct bnxt_dmabuf_info dmabuf;struct bnxt_ulp_context *ulp_ctx;struct bnxt_flow_stat_info *flow_stat;uint8_t flow_xstat;
drivers/net/bnxt/bnxt_hwrm.c +27 -0
@@ -5506,3 +5506,30 @@ int bnxt_hwrm_cfa_counter_qstats(struct bnxt *bp,return 0 ; } + +#ifdef RTE_LIBRTE_BNXT_PMD_SYSTEM +int +bnxt_hwrm_oem_cmd (struct bnxt *bp,uint32_t entry_num) +{ +struct hwrm_oem_cmd_input req = {0 }; +struct hwrm_oem_cmd_output *resp = bp->hwrm_cmd_resp_addr; +struct bnxt_dmabuf_info oem_data; +int rc =0 ; + +HWRM_PREP (&req,HWRM_OEM_CMD ,BNXT_USE_CHIMP_MB ); + req.IANA =0x14e4 ; + +memset (&oem_data,0 ,sizeof (struct bnxt_dmabuf_info )); + oem_data.entry_num = (entry_num); +memcpy (&req.oem_data[0 ], &oem_data,sizeof (struct bnxt_dmabuf_info )); + + rc =bnxt_hwrm_send_message (bp, &req,sizeof (req),BNXT_USE_CHIMP_MB ); +HWRM_CHECK_RESULT (); + + bp->dmabuf.entry_num = entry_num; + +HWRM_UNLOCK (); + +return rc; +} +#endif /* RTE_LIBRTE_BNXT_PMD_SYSTEM */
drivers/net/bnxt/bnxt_hwrm.h +1 -0
@@ -276,4 +276,5 @@ int bnxt_hwrm_get_dflt_vnic_svif(struct bnxt *bp, uint16_t fid, uint16_t *vnic_id, uint16_t *svif);int bnxt_hwrm_parent_pf_qcfg (struct bnxt *bp);int bnxt_hwrm_port_phy_qcaps (struct bnxt *bp); +int bnxt_hwrm_oem_cmd (struct bnxt *bp,uint32_t entry_num);#endif
drivers/net/bnxt/meson.build +1 -1
@@ -31,7 +31,6 @@ sources = files('bnxt_cpr.c', 'tf_core/tf_em_common.c', 'tf_core/tf_em_host.c', 'tf_core/tf_em_internal.c', - 'tf_core/tf_em_system.c', 'tf_core/tf_rm.c', 'tf_core/tf_tbl.c', 'tf_core/tfp.c',
@@ -46,6 +45,7 @@ sources = files('bnxt_cpr.c', 'tf_core/tf_if_tbl.c', 'tf_core/ll.c', 'tf_core/tf_global_cfg.c', + 'tf_core/tf_em_host.c', 'hcapi/hcapi_cfa_p4.c',
drivers/net/bnxt/tf_core/Makefile +4 -1
@@ -16,8 +16,11 @@ SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += tf_core/tf_msg.c SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += tf_core/tf_tbl.c SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += tf_core/tf_em_common.c SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += tf_core/tf_em_internal.c +ifeq ($(CONFIG_RTE_LIBRTE_BNXT_PMD_SYSTEM), n) SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += tf_core/tf_em_host.c -SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += tf_core/tf_em_system.c +else +SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD_SYSTEM) += tf_core/tf_em_system.c +endif SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += tf_core/tf_session.c SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += tf_core/tf_device.c SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += tf_core/tf_device_p4.c
drivers/net/bnxt/tf_core/tf_core.c +10 -3
@@ -540,10 +540,12 @@ tf_alloc_tcam_entry(struct tf *tfp,int rc;struct tf_session *tfs;struct tf_dev_info *dev; -struct tf_tcam_alloc_parms aparms = {0 }; +struct tf_tcam_alloc_parms aparms;TF_CHECK_PARMS2 (tfp, parms); +memset (&aparms,0 ,sizeof (struct tf_tcam_alloc_parms )); +/* Retrieve the session information */ rc =tf_session_get_session (tfp, &tfs);if (rc) {
@@ -598,10 +600,13 @@ tf_set_tcam_entry(struct tf *tfp,int rc;struct tf_session *tfs;struct tf_dev_info *dev; -struct tf_tcam_set_parms sparms = {0 }; +struct tf_tcam_set_parms sparms;TF_CHECK_PARMS2 (tfp, parms); +memset (&sparms,0 ,sizeof (struct tf_tcam_set_parms )); + +/* Retrieve the session information */ rc =tf_session_get_session (tfp, &tfs);if (rc) {
@@ -667,10 +672,12 @@ tf_free_tcam_entry(struct tf *tfp,int rc;struct tf_session *tfs;struct tf_dev_info *dev; -struct tf_tcam_free_parms fparms = {0 }; +struct tf_tcam_free_parms fparms;TF_CHECK_PARMS2 (tfp, parms); +memset (&fparms,0 ,sizeof (struct tf_tcam_free_parms )); +/* Retrieve the session information */ rc =tf_session_get_session (tfp, &tfs);if (rc) {
drivers/net/bnxt/tf_core/tf_core.h +2 -2
@@ -1731,7 +1731,7 @@ struct tf_set_if_tbl_entry_parms {/** * [in] Entry data */ -uint32_t *data; +uint8_t *data;/** * [in] Entry size */
@@ -1768,7 +1768,7 @@ struct tf_get_if_tbl_entry_parms {/** * [out] Entry data */ -uint32_t *data; +uint8_t *data;/** * [in] Entry size */
drivers/net/bnxt/tf_core/tf_device.c +4 -1
@@ -92,8 +92,11 @@ tf_dev_bind_p4(struct tf *tfp, em_cfg.num_elements =TF_EM_TBL_TYPE_MAX ; em_cfg.cfg = tf_em_ext_p4; em_cfg.resources = resources; +#ifdef TF_USE_SYSTEM_MEM + em_cfg.mem_type =TF_EEM_MEM_TYPE_SYSTEM ; +#else em_cfg.mem_type =TF_EEM_MEM_TYPE_HOST ; - +#endif rc =tf_em_ext_common_bind (tfp, &em_cfg);if (rc) { TFP_DRV_LOG(ERR,
drivers/net/bnxt/tf_core/tf_device_p4.c +1 -1
@@ -126,7 +126,7 @@ const struct tf_dev_ops tf_dev_ops_p4 = { .tf_dev_free_ext_tbl = tf_tbl_ext_free, .tf_dev_alloc_search_tbl = NULL, .tf_dev_set_tbl = tf_tbl_set, - .tf_dev_set_ext_tbl = tf_tbl_ext_set, + .tf_dev_set_ext_tbl = tf_tbl_ext_common_set, .tf_dev_get_tbl = tf_tbl_get, .tf_dev_get_bulk_tbl = tf_tbl_bulk_get, .tf_dev_alloc_tcam = tf_tcam_alloc,
drivers/net/bnxt/tf_core/tf_em.h +22 -91
157 lines not on this page · raw message
drivers/net/bnxt/tf_core/tf_em_common.c +663 -20
725 lines not on this page · raw message
drivers/net/bnxt/tf_core/tf_em_common.h +30 -0
@@ -101,4 +101,34 @@ void *tf_em_get_table_page(struct tf_tbl_scope_cb *tbl_scope_cb,uint32_t offset, enum hcapi_cfa_em_table_type table_type); +/** +* Validates EM number of entries requested +* +* [in] tbl_scope_cb +* Pointer to table scope control block to be populated +* +* [in] parms +* Pointer to input parameters +* +* Returns: +* 0 - Success +* -EINVAL - Parameter error +*/ +int tf_em_validate_num_entries (struct tf_tbl_scope_cb *tbl_scope_cb, +struct tf_alloc_tbl_scope_parms *parms); + +/** +* Size the EM table based on capabilities +* +* [in] tbl +* EM table to size +* +* Returns: +* 0 - Success +* - EINVAL - Parameter error +* - ENOMEM - Out of memory +*/ +int tf_em_size_table (struct hcapi_cfa_em_table *tbl, +uint32_t page_size); +#endif /* _TF_EM_COMMON_H_ */
drivers/net/bnxt/tf_core/tf_em_host.c +5 -684
735 lines not on this page · raw message
drivers/net/bnxt/tf_core/tf_em_system.c +477 -64
591 lines not on this page · raw message
drivers/net/bnxt/tf_core/tf_if_tbl.h +2 -2
@@ -113,7 +113,7 @@ struct tf_if_tbl_set_parms {/** * [in] Entry data */ -uint32_t *data; +uint8_t *data;/** * [in] Entry size */
@@ -143,7 +143,7 @@ struct tf_if_tbl_get_parms {/** * [out] Entry data */ -uint32_t *data; +uint8_t *data;/** * [out] Entry size */
drivers/net/bnxt/tf_core/tf_msg.c +24 -0
@@ -813,7 +813,19 @@ tf_msg_tcam_entry_set(struct tf *tfp,struct tf_msg_dma_buf buf = {0 };uint8_t *data =NULL ;int data_size =0 ; +uint8_t fw_session_id; + rc =tf_session_get_fw_session_id (tfp, &fw_session_id); +if (rc) { +TFP_DRV_LOG (ERR , +"%s: Unable to lookup FW id, rc:%s\n" , +tf_dir_2_str (parms->dir), +strerror (-rc)); +return rc; + } + +/* Populate the request */ + req.fw_session_id =tfp_cpu_to_le_32 (fw_session_id); req.type = parms->hcapi_type; req.idx =tfp_cpu_to_le_16 (parms->idx);if (parms->dir ==TF_DIR_TX )
@@ -869,7 +881,19 @@ tf_msg_tcam_entry_free(struct tf *tfp,struct hwrm_tf_tcam_free_input req = {0 };struct hwrm_tf_tcam_free_output resp = {0 };struct tfp_send_msg_parms parms = {0 }; +uint8_t fw_session_id; + rc =tf_session_get_fw_session_id (tfp, &fw_session_id); +if (rc) { +TFP_DRV_LOG (ERR , +"%s: Unable to lookup FW id, rc:%s\n" , +tf_dir_2_str (in_parms->dir), +strerror (-rc)); +return rc; + } + +/* Populate the request */ + req.fw_session_id =tfp_cpu_to_le_32 (fw_session_id); req.type = in_parms->hcapi_type; req.count =1 ; req.idx_list[0 ] =tfp_cpu_to_le_16 (in_parms->idx);
drivers/net/bnxt/tf_core/tf_tbl.h +7 -0
@@ -38,6 +38,13 @@ struct tf_em_caps {*/ struct tf_tbl_scope_cb {uint32_t tbl_scope_id; +#ifdef TF_USE_SYSTEM_MEM +int lfc_fd; +uint32_t bus; +uint32_t devfn; +int fd[TF_DIR_MAX ][TF_MAX_TABLE ]; +bool valid; +#endif int index;struct hcapi_cfa_em_ctx_mem_info em_ctx_info[TF_DIR_MAX ];struct tf_em_caps em_caps[TF_DIR_MAX ];
drivers/net/bnxt/tf_core/tfp.c +12 -0
@@ -87,6 +87,18 @@ tfp_send_msg_tunneled(struct tf *tfp,return rc; } +#ifdef TF_USE_SYSTEM_MEM +int +tfp_msg_hwrm_oem_cmd (struct tf *tfp, +uint32_t max_flows) +{ +return bnxt_hwrm_oem_cmd (container_of (tfp, + struct bnxt, + tfp), + max_flows); +} +#endif /* TF_USE_SYSTEM_MEM */ +/** * Allocates zero'ed memory from the heap. *
drivers/net/bnxt/tf_core/tfp.h +15 -0
@@ -170,6 +170,21 @@ int tfp_msg_hwrm_oem_cmd(struct tf *tfp, uint32_t max_flows); +/** +* Sends OEM command message to Chimp +* +* [in] session, pointer to session handle +* [in] max_flows, max number of flows requested +* +* Returns: +* 0 - Success +* -1 - Global error like not supported +* -EINVAL - Parameter Error +*/ +int +tfp_msg_hwrm_oem_cmd (struct tf *tfp, +uint32_t max_flows); +/** * Allocates zero'ed memory from the heap. *
Signature · 1 line
2.21.1 (Apple Git-122.3)
PATCH v5 32/51 net/bnxt: integrate with the latest tf core changes
In reply to Ajit KhapardeFrom: Kishore Padmanabha <[email protected]>
ULP changes to integrate with the latest session open interface in tf_core
--- drivers/net/bnxt/tf_ulp/bnxt_ulp.c | 46 ++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+)
drivers/net/bnxt/tf_ulp/bnxt_ulp.c +46 -0
@@ -68,6 +68,7 @@ ulp_ctx_session_open(struct bnxt *bp,struct rte_eth_dev *ethdev = bp->eth_dev;int32_t rc =0 ;struct tf_open_session_parms params; +struct tf_session_resources *resources;memset (¶ms,0 ,sizeof (params));
@@ -79,6 +80,51 @@ ulp_ctx_session_open(struct bnxt *bp,return rc; } + params.shadow_copy = false; + params.device_type =TF_DEVICE_TYPE_WH ; + resources = ¶ms.resources; +/** RX **/ +/* Identifiers */ + resources->ident_cnt[TF_DIR_RX ].cnt[TF_IDENT_TYPE_L2_CTXT ] =16 ; + resources->ident_cnt[TF_DIR_RX ].cnt[TF_IDENT_TYPE_WC_PROF ] =8 ; + resources->ident_cnt[TF_DIR_RX ].cnt[TF_IDENT_TYPE_PROF_FUNC ] =8 ; + resources->ident_cnt[TF_DIR_RX ].cnt[TF_IDENT_TYPE_EM_PROF ] =8 ; + +/* Table Types */ + resources->tbl_cnt[TF_DIR_RX ].cnt[TF_TBL_TYPE_FULL_ACT_RECORD ] =720 ; + resources->tbl_cnt[TF_DIR_RX ].cnt[TF_TBL_TYPE_ACT_STATS_64 ] =720 ; + +/* TCAMs */ + resources->tcam_cnt[TF_DIR_RX ].cnt[TF_TCAM_TBL_TYPE_L2_CTXT_TCAM ] =16 ; + resources->tcam_cnt[TF_DIR_RX ].cnt[TF_TCAM_TBL_TYPE_PROF_TCAM ] =8 ; + resources->tcam_cnt[TF_DIR_RX ].cnt[TF_TCAM_TBL_TYPE_WC_TCAM ] =416 ; + +/* EM */ + resources->em_cnt[TF_DIR_RX ].cnt[TF_EM_TBL_TYPE_EM_RECORD ] =2048 ; + +/** TX **/ +/* Identifiers */ + resources->ident_cnt[TF_DIR_TX ].cnt[TF_IDENT_TYPE_L2_CTXT ] =8 ; + resources->ident_cnt[TF_DIR_TX ].cnt[TF_IDENT_TYPE_WC_PROF ] =8 ; + resources->ident_cnt[TF_DIR_TX ].cnt[TF_IDENT_TYPE_PROF_FUNC ] =8 ; + resources->ident_cnt[TF_DIR_TX ].cnt[TF_IDENT_TYPE_EM_PROF ] =8 ; + +/* Table Types */ + resources->tbl_cnt[TF_DIR_TX ].cnt[TF_TBL_TYPE_FULL_ACT_RECORD ] =16 ; + resources->tbl_cnt[TF_DIR_TX ].cnt[TF_TBL_TYPE_ACT_STATS_64 ] =16 ; + +/* TCAMs */ + resources->tcam_cnt[TF_DIR_TX ].cnt[TF_TCAM_TBL_TYPE_L2_CTXT_TCAM ] =8 ; + resources->tcam_cnt[TF_DIR_TX ].cnt[TF_TCAM_TBL_TYPE_PROF_TCAM ] =8 ; + resources->tcam_cnt[TF_DIR_TX ].cnt[TF_TCAM_TBL_TYPE_WC_TCAM ] =8 ; + +/* EM */ + resources->em_cnt[TF_DIR_TX ].cnt[TF_EM_TBL_TYPE_EM_RECORD ] =8 ; + +/* EEM */ + resources->em_cnt[TF_DIR_RX ].cnt[TF_EM_TBL_TYPE_TBL_SCOPE ] =1 ; + resources->em_cnt[TF_DIR_TX ].cnt[TF_EM_TBL_TYPE_TBL_SCOPE ] =1 ; + rc =tf_open_session (&bp->tfp, ¶ms);if (rc) { BNXT_TF_DBG(ERR, "Failed to open TF session - %s, rc = %d\n",
Signature · 1 line
2.21.1 (Apple Git-122.3)
PATCH v5 33/51 net/bnxt: add support for internal encap records
In reply to Ajit KhapardeFrom: Mike Baucom <[email protected]>
Modifications to allow internal encap records to be supported:
- Modified the mapper index table processing to handle encap without an action record
- Modified the session open code to reserve some 64 Byte internal encap records on tx
- Modified the blob encap swap to support encap without action record
--- drivers/net/bnxt/tf_ulp/bnxt_ulp.c | 3 +++ drivers/net/bnxt/tf_ulp/ulp_mapper.c | 29 +++++++++++++--------------- drivers/net/bnxt/tf_ulp/ulp_utils.c | 2 +- 3 files changed, 17 insertions(+), 17 deletions(-)
drivers/net/bnxt/tf_ulp/bnxt_ulp.c +3 -0
@@ -113,6 +113,9 @@ ulp_ctx_session_open(struct bnxt *bp, resources->tbl_cnt[TF_DIR_TX ].cnt[TF_TBL_TYPE_FULL_ACT_RECORD ] =16 ; resources->tbl_cnt[TF_DIR_TX ].cnt[TF_TBL_TYPE_ACT_STATS_64 ] =16 ; +/* ENCAP */ + resources->tbl_cnt[TF_DIR_TX ].cnt[TF_TBL_TYPE_ACT_ENCAP_64B ] =16 ; +/* TCAMs */ resources->tcam_cnt[TF_DIR_TX ].cnt[TF_TCAM_TBL_TYPE_L2_CTXT_TCAM ] =8 ; resources->tcam_cnt[TF_DIR_TX ].cnt[TF_TCAM_TBL_TYPE_PROF_TCAM ] =8 ;
drivers/net/bnxt/tf_ulp/ulp_mapper.c +13 -16
@@ -1473,7 +1473,7 @@ ulp_mapper_index_tbl_process(struct bnxt_ulp_mapper_parms *parms, flds =ulp_mapper_act_result_fields_get (tbl, &num_flds, &encap_flds); -if (!flds || !num_flds) { +if (!flds || (!num_flds && !encap_flds)) {BNXT_TF_DBG (ERR ,"template undefined for the index table\n" );return -EINVAL ; }
@@ -1482,7 +1482,7 @@ ulp_mapper_index_tbl_process(struct bnxt_ulp_mapper_parms *parms,for (i =0 ; i < (num_flds + encap_flds); i++) {/* set the swap index if encap swap bit is enabled */ if (parms->device_params->encap_byte_swap && encap_flds && - ((i +1 ) == num_flds)) + (i == num_flds))ulp_blob_encap_swap_idx_set (&data);/* Process the result fields */
@@ -1495,18 +1495,15 @@ ulp_mapper_index_tbl_process(struct bnxt_ulp_mapper_parms *parms,BNXT_TF_DBG (ERR ,"data field failed\n" );return rc; } + } -/* if encap bit swap is enabled perform the bit swap */ -if (parms->device_params->encap_byte_swap && encap_flds) { -if ((i +1 ) == (num_flds + encap_flds)) -ulp_blob_perform_encap_swap (&data); +/* if encap bit swap is enabled perform the bit swap */ +if (parms->device_params->encap_byte_swap && encap_flds) { +ulp_blob_perform_encap_swap (&data);#ifdef RTE_LIBRTE_BNXT_TRUFLOW_DEBUG -if ((i +1 ) == (num_flds + encap_flds)) { -BNXT_TF_DBG (INFO ,"Dump fter encap swap\n" ); -ulp_mapper_blob_dump (&data); - } +BNXT_TF_DBG (INFO ,"Dump after encap swap\n" ); +ulp_mapper_blob_dump (&data);#endif - } }/* Perform the tf table allocation by filling the alloc params */
@@ -1817,6 +1814,11 @@ ulp_mapper_action_tbls_process(struct bnxt_ulp_mapper_parms *parms)switch (tbl->resource_func) {case BNXT_ULP_RESOURCE_FUNC_INDEX_TABLE : rc =ulp_mapper_index_tbl_process (parms, tbl, false); +if (rc) { +BNXT_TF_DBG (ERR ,"Resource type %d failed\n" , + tbl->resource_func); +return rc; + }break ;default : BNXT_TF_DBG(ERR, "Unexpected action resource %d\n",
@@ -1824,11 +1826,6 @@ ulp_mapper_action_tbls_process(struct bnxt_ulp_mapper_parms *parms)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_utils.c +1 -1
@@ -478,7 +478,7 @@ ulp_blob_perform_encap_swap(struct ulp_blob *blob)BNXT_TF_DBG (ERR ,"invalid argument\n" );return ;/* failure */ } - idx =ULP_BITS_2_BYTE_NR (blob->encap_swap_idx +1 ); + idx =ULP_BITS_2_BYTE_NR (blob->encap_swap_idx); end_idx =ULP_BITS_2_BYTE (blob->write_idx);while (idx <= end_idx) {
Signature · 1 line
2.21.1 (Apple Git-122.3)
PATCH v5 34/51 net/bnxt: add support for if table processing
In reply to Ajit KhapardeFrom: Kishore Padmanabha <[email protected]>
Added support for if table processing in the ulp mapper layer. This enables support for the default partition action record pointer interface table.
--- drivers/net/bnxt/tf_ulp/bnxt_ulp.c | 1 + drivers/net/bnxt/tf_ulp/ulp_flow_db.c | 2 +- drivers/net/bnxt/tf_ulp/ulp_mapper.c | 141 +++++++++++++++--- drivers/net/bnxt/tf_ulp/ulp_mark_mgr.c | 1 + .../net/bnxt/tf_ulp/ulp_template_db_enum.h | 117 ++++++++------- drivers/net/bnxt/tf_ulp/ulp_template_struct.h | 8 +- 6 files changed, 187 insertions(+), 83 deletions(-)
drivers/net/bnxt/tf_ulp/bnxt_ulp.c +1 -0
@@ -115,6 +115,7 @@ ulp_ctx_session_open(struct bnxt *bp,/* ENCAP */ resources->tbl_cnt[TF_DIR_TX ].cnt[TF_TBL_TYPE_ACT_ENCAP_64B ] =16 ; + resources->tbl_cnt[TF_DIR_TX ].cnt[TF_TBL_TYPE_ACT_ENCAP_16B ] =16 ;/* TCAMs */ resources->tcam_cnt[TF_DIR_TX ].cnt[TF_TCAM_TBL_TYPE_L2_CTXT_TCAM ] =8 ;
drivers/net/bnxt/tf_ulp/ulp_flow_db.c +1 -1
@@ -933,7 +933,7 @@ ulp_default_flow_db_cfa_action_get(struct bnxt_ulp_context *ulp_ctx,uint32_t flow_id, uint32_t *cfa_action) { - uint8_t sub_type = BNXT_ULP_RESOURCE_SUB_TYPE_INDEX_TYPE_VFR_ACT_IDX; + uint8_t sub_type = BNXT_ULP_RESOURCE_SUB_TYPE_INDEX_TYPE_VFR_CFA_ACTION;uint64_t hndl;int32_t rc;
drivers/net/bnxt/tf_ulp/ulp_mapper.c +118 -23
243 lines not on this page · raw message
drivers/net/bnxt/tf_ulp/ulp_mark_mgr.c +1 -0
@@ -256,6 +256,7 @@ ulp_mark_db_mark_add(struct bnxt_ulp_context *ctxt,BNXT_TF_DBG (ERR ,"Mark index greater than allocated\n" );return -EINVAL ; } +BNXT_TF_DBG (DEBUG ,"Set LFID[0x%0x] = 0x%0x\n" , fid, mark); mtbl->lfid_tbl[fid].mark_id = mark;ULP_MARK_DB_ENTRY_SET_VALID (&mtbl->lfid_tbl[fid]); }
drivers/net/bnxt/tf_ulp/ulp_template_db_enum.h +61 -56
170 lines not on this page · raw message
drivers/net/bnxt/tf_ulp/ulp_template_struct.h +5 -3
@@ -150,9 +150,10 @@ struct bnxt_ulp_device_params {/* Flow Mapper */ struct bnxt_ulp_mapper_tbl_list_info { -uint32_t device_name; -uint32_t start_tbl_idx; -uint32_t num_tbls; +uint32_t device_name; +uint32_t start_tbl_idx; +uint32_t num_tbls; +enum bnxt_ulp_fdb_type flow_db_table_type; };struct bnxt_ulp_mapper_tbl_info {
@@ -183,6 +184,7 @@ struct bnxt_ulp_mapper_tbl_info {enum bnxt_ulp_regfile_index regfile_idx;enum bnxt_ulp_mark_db_opcode mark_db_opcode; +uint32_t comp_field_idx; };struct bnxt_ulp_mapper_class_key_field_info {
Signature · 1 line
2.21.1 (Apple Git-122.3)
PATCH v5 35/51 net/bnxt: disable Tx vector mode if truflow is set
In reply to Ajit KhapardeFrom: Kishore Padmanabha <[email protected]>
The vector mode in the tx handler is disabled when truflow is enabled since truflow now requires bd action record support.
--- drivers/net/bnxt/bnxt_ethdev.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/net/bnxt/bnxt_ethdev.c +4 -1
@@ -1115,12 +1115,15 @@ bnxt_transmit_function(__rte_unused struct rte_eth_dev *eth_dev) { #ifdef RTE_ARCH_X86 #ifndef RTE_LIBRTE_IEEE1588 + struct bnxt *bp = eth_dev->data->dev_private; + /* * Vector mode transmit can be enabled only if not using scatter rx * or tx offloads. */ if (!eth_dev->data->scattered_rx && - !eth_dev->data->dev_conf.txmode.offloads) { + !eth_dev->data->dev_conf.txmode.offloads && + !BNXT_TRUFLOW_EN(bp)) { PMD_DRV_LOG(INFO, "Using vector mode transmit for port %d\n", eth_dev->data->port_id); return bnxt_xmit_pkts_vec;
Signature · 1 line
2.21.1 (Apple Git-122.3)
PATCH v5 36/51 net/bnxt: add index opcode and operand to mapper table
In reply to Ajit KhapardeFrom: Kishore Padmanabha <[email protected]>
Extended the regfile and computed field operations to a common index opcode operation and added globlal resource operations are also part of the index opcode operation.
--- drivers/net/bnxt/tf_ulp/ulp_mapper.c | 56 ++++++++++++++++--- drivers/net/bnxt/tf_ulp/ulp_template_db_act.c | 9 ++- .../net/bnxt/tf_ulp/ulp_template_db_class.c | 45 +++++---------- .../net/bnxt/tf_ulp/ulp_template_db_enum.h | 8 +++ drivers/net/bnxt/tf_ulp/ulp_template_struct.h | 4 +- 5 files changed, 80 insertions(+), 42 deletions(-)
drivers/net/bnxt/tf_ulp/ulp_mapper.c +49 -7
@@ -1443,7 +1443,7 @@ ulp_mapper_index_tbl_process(struct bnxt_ulp_mapper_parms *parms,struct bnxt_ulp_mapper_result_field_info *flds;struct ulp_flow_db_res_params fid_parms;struct ulp_blob data; -uint64_t idx; +uint64_t idx =0 ;uint16_t tmplen;uint32_t i, num_flds;int32_t rc =0 , trc =0 ;
@@ -1516,6 +1516,42 @@ ulp_mapper_index_tbl_process(struct bnxt_ulp_mapper_parms *parms,#endif } +/* +* Check for index opcode, if it is Global then +* no need to allocate the table, just set the table +* and exit since it is not maintained in the flow db. +*/ +if (tbl->index_opcode ==BNXT_ULP_INDEX_OPCODE_GLOBAL ) { +/* get the index from index operand */ +if (tbl->index_operand <BNXT_ULP_GLB_REGFILE_INDEX_LAST && +ulp_mapper_glb_resource_read (parms->mapper_data, + tbl->direction, + tbl->index_operand, + &idx)) { +BNXT_TF_DBG (ERR ,"Glbl regfile[%d] read failed.\n" , + tbl->index_operand); +return -EINVAL ; + } +/* set the Tf index table */ + sparms.dir = tbl->direction; + sparms.type = tbl->resource_type; + sparms.data =ulp_blob_data_get (&data, &tmplen); + sparms.data_sz_in_bytes =ULP_BITS_2_BYTE (tmplen); + sparms.idx =tfp_be_to_cpu_64 (idx); + sparms.tbl_scope_id = tbl_scope_id; + + rc =tf_set_tbl_entry (tfp, &sparms); +if (rc) { +BNXT_TF_DBG (ERR , +"Glbl Set table[%d][%s][%d] failed rc=%d\n" , + sparms.type, + (sparms.dir ==TF_DIR_RX ) ?"RX" :"TX" , + sparms.idx, + rc); +return rc; + } +return 0 ;/* success */ + }/* Perform the tf table allocation by filling the alloc params */ aparms.dir = tbl->direction; aparms.type = tbl->resource_type;
@@ -1546,11 +1582,13 @@ ulp_mapper_index_tbl_process(struct bnxt_ulp_mapper_parms *parms,/* Always storing values in Regfile in BE */ idx =tfp_cpu_to_be_64 (idx); - rc =ulp_regfile_write (parms->regfile, tbl->regfile_idx, idx); -if (!rc) { -BNXT_TF_DBG (ERR ,"Write regfile[%d] failed\n" , - tbl->regfile_idx); - goto error; +if (tbl->index_opcode ==BNXT_ULP_INDEX_OPCODE_ALLOCATE ) { + rc =ulp_regfile_write (parms->regfile, tbl->index_operand, idx); +if (!rc) { +BNXT_TF_DBG (ERR ,"Write regfile[%d] failed\n" , + tbl->index_operand); + goto error; + } }/* Perform the tf table set by filling the set params */
@@ -1815,7 +1853,11 @@ ulp_mapper_if_tbl_process(struct bnxt_ulp_mapper_parms *parms, }/* Get the index details from computed field */ - idx =ULP_COMP_FLD_IDX_RD (parms, tbl->comp_field_idx); +if (tbl->index_opcode !=BNXT_ULP_INDEX_OPCODE_COMP_FIELD ) { +BNXT_TF_DBG (ERR ,"Invalid tbl index opcode\n" ); +return -EINVAL ; + } + idx =ULP_COMP_FLD_IDX_RD (parms, tbl->index_operand);/* Perform the tf table set by filling the set params */ iftbl_params.dir = tbl->direction;
drivers/net/bnxt/tf_ulp/ulp_template_db_act.c +6 -3
@@ -76,7 +76,8 @@ struct bnxt_ulp_mapper_tbl_info ulp_act_tbl_list[] = { .result_bit_size = 128, .result_num_fields = 26, .encap_num_fields = 0, - .regfile_idx = BNXT_ULP_REGFILE_INDEX_MAIN_ACTION_PTR, + .index_opcode = BNXT_ULP_INDEX_OPCODE_ALLOCATE, + .index_operand = BNXT_ULP_REGFILE_INDEX_MAIN_ACTION_PTR, .mark_db_opcode =BNXT_ULP_MARK_DB_OPCODE_NOP }, {
@@ -90,7 +91,8 @@ struct bnxt_ulp_mapper_tbl_info ulp_act_tbl_list[] = { .result_bit_size = 128, .result_num_fields = 26, .encap_num_fields = 0, - .regfile_idx = BNXT_ULP_REGFILE_INDEX_MAIN_ACTION_PTR, + .index_opcode = BNXT_ULP_INDEX_OPCODE_ALLOCATE, + .index_operand = BNXT_ULP_REGFILE_INDEX_MAIN_ACTION_PTR, .mark_db_opcode =BNXT_ULP_MARK_DB_OPCODE_NOP }, {
@@ -104,7 +106,8 @@ struct bnxt_ulp_mapper_tbl_info ulp_act_tbl_list[] = { .result_bit_size = 128, .result_num_fields = 26, .encap_num_fields = 12, - .regfile_idx = BNXT_ULP_REGFILE_INDEX_MAIN_ACTION_PTR, + .index_opcode = BNXT_ULP_INDEX_OPCODE_ALLOCATE, + .index_operand = BNXT_ULP_REGFILE_INDEX_MAIN_ACTION_PTR, .mark_db_opcode = BNXT_ULP_MARK_DB_OPCODE_NOP } };
drivers/net/bnxt/tf_ulp/ulp_template_db_class.c +15 -30
135 lines not on this page · raw message
drivers/net/bnxt/tf_ulp/ulp_template_db_enum.h +8 -0
@@ -161,6 +161,14 @@ enum bnxt_ulp_hdr_type {BNXT_ULP_HDR_TYPE_LAST =3 }; +enum bnxt_ulp_index_opcode { +BNXT_ULP_INDEX_OPCODE_NOT_USED =0 , +BNXT_ULP_INDEX_OPCODE_ALLOCATE =1 , +BNXT_ULP_INDEX_OPCODE_GLOBAL =2 , +BNXT_ULP_INDEX_OPCODE_COMP_FIELD =3 , +BNXT_ULP_INDEX_OPCODE_LAST =4 +}; +enum bnxt_ulp_mapper_opc {BNXT_ULP_MAPPER_OPC_SET_TO_CONSTANT =0 ,BNXT_ULP_MAPPER_OPC_SET_TO_HDR_FIELD =1 ,
drivers/net/bnxt/tf_ulp/ulp_template_struct.h +2 -2
@@ -182,9 +182,9 @@ struct bnxt_ulp_mapper_tbl_info {uint32_t ident_start_idx;uint16_t ident_nums; -enum bnxt_ulp_regfile_index regfile_idx;enum bnxt_ulp_mark_db_opcode mark_db_opcode; -uint32_t comp_field_idx; +enum bnxt_ulp_index_opcode index_opcode; +uint32_t index_operand; };struct bnxt_ulp_mapper_class_key_field_info {
Signature · 1 line
2.21.1 (Apple Git-122.3)
PATCH v5 37/51 net/bnxt: add support for global resource templates
In reply to Ajit KhapardeFrom: Kishore Padmanabha <[email protected]>
Added support for the global resource templates, so that they can be reused by the other regular templates.
--- drivers/net/bnxt/tf_ulp/ulp_mapper.c | 178 +++++++++++++++++- .../net/bnxt/tf_ulp/ulp_template_db_enum.h | 1 + drivers/net/bnxt/tf_ulp/ulp_template_db_tbl.c | 3 + drivers/net/bnxt/tf_ulp/ulp_template_struct.h | 6 + 4 files changed, 181 insertions(+), 7 deletions(-)
drivers/net/bnxt/tf_ulp/ulp_mapper.c +171 -7
@@ -80,15 +80,20 @@ ulp_mapper_glb_resource_write(struct bnxt_ulp_mapper_data *data,* returns 0 on success */ static int32_t -ulp_mapper_resource_ident_allocate (struct tf *tfp, +ulp_mapper_resource_ident_allocate (struct bnxt_ulp_context *ulp_ctx,struct bnxt_ulp_mapper_data *mapper_data,struct bnxt_ulp_glb_resource_info *glb_res) {struct tf_alloc_identifier_parms iparms = {0 };struct tf_free_identifier_parms fparms;uint64_t regval; +struct tf *tfp;int32_t rc =0 ; + tfp =bnxt_ulp_cntxt_tfp_get (ulp_ctx); +if (!tfp) +return -EINVAL ; + iparms.ident_type = glb_res->resource_type; iparms.dir = glb_res->direction;
@@ -115,13 +120,76 @@ ulp_mapper_resource_ident_allocate(struct tf *tfp,return rc; }#ifdef RTE_LIBRTE_BNXT_TRUFLOW_DEBUG -BNXT_TF_DBG (DEBUG ,"Allocated Glb Res[%s][%d][%d] = 0x%04x\n" , +BNXT_TF_DBG (DEBUG ,"Allocated Glb Res Ident [%s][%d][%d] = 0x%04x\n" , (iparms.dir ==TF_DIR_RX ) ?"RX" :"TX" , glb_res->glb_regfile_index, iparms.ident_type, iparms.id);#endif return rc; } +/* +* Internal function to allocate index tbl resource and store it in mapper data. +* +* returns 0 on success +*/ +static int32_t +ulp_mapper_resource_index_tbl_alloc (struct bnxt_ulp_context *ulp_ctx, +struct bnxt_ulp_mapper_data *mapper_data, +struct bnxt_ulp_glb_resource_info *glb_res) +{ +struct tf_alloc_tbl_entry_parms aparms = {0 }; +struct tf_free_tbl_entry_parms free_parms = {0 }; +uint64_t regval; +struct tf *tfp; +uint32_t tbl_scope_id; +int32_t rc =0 ; + + tfp =bnxt_ulp_cntxt_tfp_get (ulp_ctx); +if (!tfp) +return -EINVAL ; + +/* Get the scope id */ + rc =bnxt_ulp_cntxt_tbl_scope_id_get (ulp_ctx, &tbl_scope_id); +if (rc) { +BNXT_TF_DBG (ERR ,"Failed to get table scope rc=%d\n" , rc); +return rc; + } + + aparms.type = glb_res->resource_type; + aparms.dir = glb_res->direction; + aparms.search_enable =BNXT_ULP_SEARCH_BEFORE_ALLOC_NO ; + aparms.tbl_scope_id = tbl_scope_id; + +/* Allocate the index tbl using tf api */ + rc =tf_alloc_tbl_entry (tfp, &aparms); +if (rc) { +BNXT_TF_DBG (ERR ,"Failed to alloc identifier [%s][%d]\n" , + (aparms.dir ==TF_DIR_RX ) ?"RX" :"TX" , + aparms.type); +return rc; + } + +/* entries are stored as big-endian format */ + regval =tfp_cpu_to_be_64 ((uint64_t )aparms.idx); +/* write to the mapper global resource */ + rc =ulp_mapper_glb_resource_write (mapper_data, glb_res, regval); +if (rc) { +BNXT_TF_DBG (ERR ,"Failed to write to global resource id\n" ); +/* Free the identifer when update failed */ + free_parms.dir = aparms.dir; + free_parms.type = aparms.type; + free_parms.idx = aparms.idx; +tf_free_tbl_entry (tfp, &free_parms); +return rc; + } +#ifdef RTE_LIBRTE_BNXT_TRUFLOW_DEBUG +BNXT_TF_DBG (DEBUG ,"Allocated Glb Res Index [%s][%d][%d] = 0x%04x\n" , + (aparms.dir ==TF_DIR_RX ) ?"RX" :"TX" , + glb_res->glb_regfile_index, aparms.type, aparms.idx); +#endif +return rc; +} +/* Retrieve the cache initialization parameters for the tbl_idx */ static struct bnxt_ulp_cache_tbl_params *ulp_mapper_cache_tbl_params_get (uint32_t tbl_idx)
@@ -132,6 +200,16 @@ ulp_mapper_cache_tbl_params_get(uint32_t tbl_idx)return &ulp_cache_tbl_params[tbl_idx]; } +/* Retrieve the global template table */ +static uint32_t * +ulp_mapper_glb_template_table_get (uint32_t *num_entries) +{ +if (!num_entries) +return NULL ; + *num_entries =BNXT_ULP_GLB_TEMPLATE_TBL_MAX_SZ ; +return ulp_glb_template_tbl; +} +/* * Get the size of the action property for a given index. *
@@ -659,7 +737,10 @@ ulp_mapper_result_field_process(struct bnxt_ulp_mapper_parms *parms,return -EINVAL ; } act_bit =tfp_be_to_cpu_64 (act_bit); - act_val =ULP_BITMAP_ISSET (parms->act_bitmap->bits, act_bit); +if (ULP_BITMAP_ISSET (parms->act_bitmap->bits, act_bit)) + act_val =1 ; +else + act_val =0 ;if (fld->field_bit_size >ULP_BYTE_2_BITS (sizeof (act_val))) {BNXT_TF_DBG (ERR ,"%s field size is incorrect\n" , name);return -EINVAL ;
@@ -1552,6 +1633,7 @@ ulp_mapper_index_tbl_process(struct bnxt_ulp_mapper_parms *parms, }return 0 ;/* success */ } +/* Perform the tf table allocation by filling the alloc params */ aparms.dir = tbl->direction; aparms.type = tbl->resource_type;
@@ -1616,6 +1698,7 @@ ulp_mapper_index_tbl_process(struct bnxt_ulp_mapper_parms *parms, fid_parms.direction = tbl->direction; fid_parms.resource_func = tbl->resource_func; fid_parms.resource_type = tbl->resource_type; + fid_parms.resource_sub_type = tbl->resource_sub_type; fid_parms.resource_hndl = aparms.idx; fid_parms.critical_resource =BNXT_ULP_CRITICAL_RESOURCE_NO ;
@@ -1884,7 +1967,7 @@ ulp_mapper_if_tbl_process(struct bnxt_ulp_mapper_parms *parms, }static int32_t -ulp_mapper_glb_resource_info_init (struct tf *tfp, +ulp_mapper_glb_resource_info_init (struct bnxt_ulp_context *ulp_ctx,struct bnxt_ulp_mapper_data *mapper_data) {struct bnxt_ulp_glb_resource_info *glb_res;
@@ -1901,15 +1984,23 @@ ulp_mapper_glb_resource_info_init(struct tf *tfp,for (idx =0 ; idx < num_glb_res_ids; idx++) {switch (glb_res[idx].resource_func) {case BNXT_ULP_RESOURCE_FUNC_IDENTIFIER : - rc =ulp_mapper_resource_ident_allocate (tfp, + rc =ulp_mapper_resource_ident_allocate (ulp_ctx, mapper_data, &glb_res[idx]);break ; +case BNXT_ULP_RESOURCE_FUNC_INDEX_TABLE : + rc =ulp_mapper_resource_index_tbl_alloc (ulp_ctx, + mapper_data, + &glb_res[idx]); +break ;default :BNXT_TF_DBG (ERR ,"Global resource %x not supported\n" , glb_res[idx].resource_func); + rc = -EINVAL ;break ; } +if (rc) +return rc; }return rc; }
@@ -2125,7 +2216,9 @@ ulp_mapper_glb_resource_info_deinit(struct bnxt_ulp_context *ulp_ctx, res.resource_func = ent->resource_func; res.direction = dir; res.resource_type = ent->resource_type; - res.resource_hndl = ent->resource_hndl; +/*convert it from BE to cpu */ + res.resource_hndl = +tfp_be_to_cpu_64 (ent->resource_hndl);ulp_mapper_resource_free (ulp_ctx, &res); } }
@@ -2144,6 +2237,71 @@ ulp_mapper_flow_destroy(struct bnxt_ulp_context *ulp_ctx, uint32_t fid) BNXT_ULP_REGULAR_FLOW_TABLE); } +/* Function to handle the default global templates that are allocated during +* the startup and reused later. +*/ +static int32_t +ulp_mapper_glb_template_table_init (struct bnxt_ulp_context *ulp_ctx) +{ +uint32_t *glbl_tmpl_list; +uint32_t num_glb_tmpls, idx, dev_id; +struct bnxt_ulp_mapper_parms parms; +struct bnxt_ulp_mapper_data *mapper_data; +int32_t rc =0 ; + + glbl_tmpl_list =ulp_mapper_glb_template_table_get (&num_glb_tmpls); +if (!glbl_tmpl_list || !num_glb_tmpls) +return rc;/* No global templates to process */ + +/* Get the device id from the ulp context */ +if (bnxt_ulp_cntxt_dev_id_get (ulp_ctx, &dev_id)) { +BNXT_TF_DBG (ERR ,"Invalid ulp context\n" ); +return -EINVAL ; + } + + mapper_data =bnxt_ulp_cntxt_ptr2_mapper_data_get (ulp_ctx); +if (!mapper_data) { +BNXT_TF_DBG (ERR ,"Failed to get the ulp mapper data\n" ); +return -EINVAL ; + } + +/* Iterate the global resources and process each one */ +for (idx =0 ; idx < num_glb_tmpls; idx++) { +/* Initialize the parms structure */ +memset (&parms,0 ,sizeof (parms)); + parms.tfp =bnxt_ulp_cntxt_tfp_get (ulp_ctx); + parms.ulp_ctx = ulp_ctx; + parms.dev_id = dev_id; + parms.mapper_data = mapper_data; + +/* Get the class table entry from dev id and class id */ + parms.class_tid = glbl_tmpl_list[idx]; + parms.ctbls =ulp_mapper_class_tbl_list_get (parms.dev_id, + parms.class_tid, + &parms.num_ctbls, + &parms.tbl_idx); +if (!parms.ctbls || !parms.num_ctbls) { +BNXT_TF_DBG (ERR ,"No class tables for %d:%d\n" , + parms.dev_id, parms.class_tid); +return -EINVAL ; + } + parms.device_params =bnxt_ulp_device_params_get (parms.dev_id); +if (!parms.device_params) { +BNXT_TF_DBG (ERR ,"No class tables for %d:%d\n" , + parms.dev_id, parms.class_tid); +return -EINVAL ; + } + rc =ulp_mapper_class_tbls_process (&parms); +if (rc) { +BNXT_TF_DBG (ERR , +"class tables failed creation for %d:%d\n" , + parms.dev_id, parms.class_tid); +return rc; + } + } +return rc; +} +/* Function to handle the mapping of the Flow to be compatible * with the underlying hardware. */
@@ -2316,7 +2474,7 @@ ulp_mapper_init(struct bnxt_ulp_context *ulp_ctx) }/* Allocate the global resource ids */ - rc =ulp_mapper_glb_resource_info_init (tfp, data); + rc =ulp_mapper_glb_resource_info_init (ulp_ctx, data);if (rc) {BNXT_TF_DBG (ERR ,"Failed to initialize global resource ids\n" ); goto error;
@@ -2344,6 +2502,12 @@ ulp_mapper_init(struct bnxt_ulp_context *ulp_ctx) } } + rc =ulp_mapper_glb_template_table_init (ulp_ctx); +if (rc) { +BNXT_TF_DBG (ERR ,"Failed to initialize global templates\n" ); + goto error; + } +return 0 ; error:/* Ignore the return code in favor of returning the original error. */
drivers/net/bnxt/tf_ulp/ulp_template_db_enum.h +1 -0
@@ -26,6 +26,7 @@#define BNXT_ULP_ACT_HID_MASK 255#define BNXT_ULP_CACHE_TBL_IDENT_MAX_NUM 2#define BNXT_ULP_GLB_RESOURCE_INFO_TBL_MAX_SZ 3 +#define BNXT_ULP_GLB_TEMPLATE_TBL_MAX_SZ 0enum bnxt_ulp_action_bit {BNXT_ULP_ACTION_BIT_MARK =0x0000000000000001 ,
drivers/net/bnxt/tf_ulp/ulp_template_db_tbl.c +3 -0
@@ -546,3 +546,6 @@ uint32_t bnxt_ulp_encap_vtag_map[] = { [1] = BNXT_ULP_SYM_ECV_VTAG_TYPE_ADD_1_ENCAP_PRI, [2] = BNXT_ULP_SYM_ECV_VTAG_TYPE_ADD_2_ENCAP_PRI }; + +uint32_t ulp_glb_template_tbl[] = { +};
drivers/net/bnxt/tf_ulp/ulp_template_struct.h +6 -0
@@ -299,4 +299,10 @@ extern struct bnxt_ulp_glb_resource_info ulp_glb_resource_tbl[];*/ extern struct bnxt_ulp_cache_tbl_params ulp_cache_tbl_params[]; +/* +* The ulp_global template table is used to initialize default entries +* that could be reused by other templates. +*/ +extern uint32_t ulp_glb_template_tbl[]; +#endif /* _ULP_TEMPLATE_STRUCT_H_ */
Signature · 1 line
2.21.1 (Apple Git-122.3)
PATCH v5 38/51 net/bnxt: add support for internal exact match
In reply to Ajit KhapardeFrom: Kishore Padmanabha <[email protected]>
Added support for the internal exact match entries. Prior to this patch only external entries were supported.
--- drivers/net/bnxt/tf_ulp/bnxt_ulp.c | 38 +++++++++++++++++++ drivers/net/bnxt/tf_ulp/ulp_flow_db.c | 13 +++++-- drivers/net/bnxt/tf_ulp/ulp_mapper.c | 21 ++++++---- drivers/net/bnxt/tf_ulp/ulp_mark_mgr.c | 4 ++ .../net/bnxt/tf_ulp/ulp_template_db_class.c | 6 +-- .../net/bnxt/tf_ulp/ulp_template_db_enum.h | 13 ++++--- drivers/net/bnxt/tf_ulp/ulp_template_db_tbl.c | 7 +++- drivers/net/bnxt/tf_ulp/ulp_template_struct.h | 5 +++ 8 files changed, 85 insertions(+), 22 deletions(-)
drivers/net/bnxt/tf_ulp/bnxt_ulp.c +38 -0
@@ -213,8 +213,27 @@ static int32_t ulp_eem_tbl_scope_init(struct bnxt *bp) {struct tf_alloc_tbl_scope_parms params = {0 }; +uint32_t dev_id; +struct bnxt_ulp_device_params *dparms;int rc; +/* Get the dev specific number of flows that needed to be supported. */ +if (bnxt_ulp_cntxt_dev_id_get (bp->ulp_ctx, &dev_id)) { +BNXT_TF_DBG (ERR ,"Invalid device id\n" ); +return -EINVAL ; + } + + dparms =bnxt_ulp_device_params_get (dev_id); +if (!dparms) { +BNXT_TF_DBG (ERR ,"could not fetch the device params\n" ); +return -ENODEV ; + } + +if (dparms->flow_mem_type !=BNXT_ULP_FLOW_MEM_TYPE_EXT ) { +BNXT_TF_DBG (INFO ,"Table Scope alloc is not required\n" ); +return 0 ; + } +bnxt_init_tbl_scope_parms (bp, ¶ms); rc =tf_alloc_tbl_scope (&bp->tfp, ¶ms);
@@ -240,6 +259,8 @@ ulp_eem_tbl_scope_deinit(struct bnxt *bp, struct bnxt_ulp_context *ulp_ctx)struct tf_free_tbl_scope_parms params = {0 };struct tf *tfp;int32_t rc =0 ; +struct bnxt_ulp_device_params *dparms; +uint32_t dev_id;if (!ulp_ctx || !ulp_ctx->cfg_data)return -EINVAL ;
@@ -254,6 +275,23 @@ ulp_eem_tbl_scope_deinit(struct bnxt *bp, struct bnxt_ulp_context *ulp_ctx)return -EINVAL ; } +/* Get the dev specific number of flows that needed to be supported. */ +if (bnxt_ulp_cntxt_dev_id_get (bp->ulp_ctx, &dev_id)) { +BNXT_TF_DBG (ERR ,"Invalid device id\n" ); +return -EINVAL ; + } + + dparms =bnxt_ulp_device_params_get (dev_id); +if (!dparms) { +BNXT_TF_DBG (ERR ,"could not fetch the device params\n" ); +return -ENODEV ; + } + +if (dparms->flow_mem_type !=BNXT_ULP_FLOW_MEM_TYPE_EXT ) { +BNXT_TF_DBG (INFO ,"Table Scope free is not required\n" ); +return 0 ; + } + rc =bnxt_ulp_cntxt_tbl_scope_id_get (ulp_ctx, ¶ms.tbl_scope_id);if (rc) {BNXT_TF_DBG (ERR ,"Failed to get the table scope id\n" );
drivers/net/bnxt/tf_ulp/ulp_flow_db.c +9 -4
@@ -114,7 +114,8 @@ ulp_flow_db_res_params_to_info(struct ulp_fdb_resource_info *resource_info, }/* Store the handle as 64bit only for EM table entries */ -if (params->resource_func !=BNXT_ULP_RESOURCE_FUNC_EM_TABLE ) { +if (params->resource_func !=BNXT_ULP_RESOURCE_FUNC_EXT_EM_TABLE && + params->resource_func !=BNXT_ULP_RESOURCE_FUNC_INT_EM_TABLE ) { resource_info->resource_hndl = (uint32_t )params->resource_hndl; resource_info->resource_type = params->resource_type; resource_info->resource_sub_type = params->resource_sub_type;
@@ -145,7 +146,8 @@ ulp_flow_db_res_info_to_params(struct ulp_fdb_resource_info *resource_info,/* use the helper function to get the resource func */ params->resource_func =ulp_flow_db_resource_func_get (resource_info); -if (params->resource_func ==BNXT_ULP_RESOURCE_FUNC_EM_TABLE ) { +if (params->resource_func ==BNXT_ULP_RESOURCE_FUNC_EXT_EM_TABLE || + params->resource_func ==BNXT_ULP_RESOURCE_FUNC_INT_EM_TABLE ) { params->resource_hndl = resource_info->resource_em_handle; }else if (params->resource_func &ULP_FLOW_DB_RES_FUNC_NEED_LOWER ) { params->resource_hndl = resource_info->resource_hndl;
@@ -908,7 +910,9 @@ ulp_flow_db_resource_hndl_get(struct bnxt_ulp_context *ulp_ctx, } }else if (resource_func == -BNXT_ULP_RESOURCE_FUNC_EM_TABLE ){ +BNXT_ULP_RESOURCE_FUNC_EXT_EM_TABLE || + resource_func == +BNXT_ULP_RESOURCE_FUNC_INT_EM_TABLE ) { *res_hndl = fid_res->resource_em_handle;return 0 ; }
@@ -966,7 +970,8 @@ static void ulp_flow_db_res_dump(struct ulp_fdb_resource_info *r,BNXT_TF_DBG (DEBUG ,"Resource func = %x, nxt_resource_idx = %x\n" , res_func, (ULP_FLOW_DB_RES_NXT_MASK & r->nxt_resource_idx)); -if (res_func ==BNXT_ULP_RESOURCE_FUNC_EM_TABLE ) +if (res_func ==BNXT_ULP_RESOURCE_FUNC_EXT_EM_TABLE || + res_func ==BNXT_ULP_RESOURCE_FUNC_INT_EM_TABLE )BNXT_TF_DBG (DEBUG ,"EM Handle = 0x%016" PRIX64 "\n" , r->resource_em_handle);else
drivers/net/bnxt/tf_ulp/ulp_mapper.c +13 -8
@@ -556,15 +556,18 @@ ulp_mapper_index_entry_free(struct bnxt_ulp_context *ulp, }static inline int32_t -ulp_mapper_eem_entry_free (struct bnxt_ulp_context *ulp, -struct tf *tfp, -struct ulp_flow_db_res_params *res) +ulp_mapper_em_entry_free (struct bnxt_ulp_context *ulp, +struct tf *tfp, +struct ulp_flow_db_res_params *res) {struct tf_delete_em_entry_parms fparms = {0 };int32_t rc; fparms.dir = res->direction; - fparms.mem =TF_MEM_EXTERNAL ; +if (res->resource_func ==BNXT_ULP_RESOURCE_FUNC_EXT_EM_TABLE ) + fparms.mem =TF_MEM_EXTERNAL ; +else + fparms.mem =TF_MEM_INTERNAL ; fparms.flow_handle = res->resource_hndl; rc =bnxt_ulp_cntxt_tbl_scope_id_get (ulp, &fparms.tbl_scope_id);
@@ -1443,7 +1446,7 @@ ulp_mapper_em_tbl_process(struct bnxt_ulp_mapper_parms *parms,#endif /* do the transpose for the internal EM keys */ -if (tbl->resource_type ==TF_MEM_INTERNAL ) +if (tbl->resource_func ==BNXT_ULP_RESOURCE_FUNC_INT_EM_TABLE )ulp_blob_perform_byte_reverse (&key); rc = bnxt_ulp_cntxt_tbl_scope_id_get(parms->ulp_ctx,
@@ -2066,7 +2069,8 @@ ulp_mapper_class_tbls_process(struct bnxt_ulp_mapper_parms *parms)case BNXT_ULP_RESOURCE_FUNC_TCAM_TABLE : rc =ulp_mapper_tcam_tbl_process (parms, tbl);break ; -case BNXT_ULP_RESOURCE_FUNC_EM_TABLE : +case BNXT_ULP_RESOURCE_FUNC_EXT_EM_TABLE : +case BNXT_ULP_RESOURCE_FUNC_INT_EM_TABLE : rc =ulp_mapper_em_tbl_process (parms, tbl);break ;case BNXT_ULP_RESOURCE_FUNC_INDEX_TABLE :
@@ -2119,8 +2123,9 @@ ulp_mapper_resource_free(struct bnxt_ulp_context *ulp,case BNXT_ULP_RESOURCE_FUNC_TCAM_TABLE : rc =ulp_mapper_tcam_entry_free (ulp, tfp, res);break ; -case BNXT_ULP_RESOURCE_FUNC_EM_TABLE : - rc =ulp_mapper_eem_entry_free (ulp, tfp, res); +case BNXT_ULP_RESOURCE_FUNC_EXT_EM_TABLE : +case BNXT_ULP_RESOURCE_FUNC_INT_EM_TABLE : + rc =ulp_mapper_em_entry_free (ulp, tfp, res);break ;case BNXT_ULP_RESOURCE_FUNC_INDEX_TABLE : rc =ulp_mapper_index_entry_free (ulp, tfp, res);
drivers/net/bnxt/tf_ulp/ulp_mark_mgr.c +4 -0
@@ -87,6 +87,9 @@ ulp_mark_db_init(struct bnxt_ulp_context *ctxt)/* Need to allocate 2 * Num flows to account for hash type bit */ mark_tbl->gfid_num_entries = dparms->mark_db_gfid_entries; +if (!mark_tbl->gfid_num_entries) + goto gfid_not_required; + mark_tbl->gfid_tbl = rte_zmalloc("ulp_rx_eem_flow_mark_table", mark_tbl->gfid_num_entries * sizeof(struct bnxt_gfid_mark_info),
@@ -109,6 +112,7 @@ ulp_mark_db_init(struct bnxt_ulp_context *ctxt) mark_tbl->gfid_num_entries -1 , mark_tbl->gfid_mask); +gfid_not_required:/* Add the mark tbl to the ulp context. */ bnxt_ulp_cntxt_ptr2_mark_db_set (ctxt, mark_tbl);return 0 ;
drivers/net/bnxt/tf_ulp/ulp_template_db_class.c +3 -3
@@ -179,7 +179,7 @@ struct bnxt_ulp_mapper_tbl_info ulp_class_tbl_list[] = { .critical_resource = BNXT_ULP_CRITICAL_RESOURCE_NO }, { - .resource_func = BNXT_ULP_RESOURCE_FUNC_EM_TABLE, + .resource_func = BNXT_ULP_RESOURCE_FUNC_EXT_EM_TABLE, .resource_type = TF_MEM_EXTERNAL, .resource_sub_type = BNXT_ULP_RESOURCE_SUB_TYPE_NOT_USED,
@@ -284,7 +284,7 @@ struct bnxt_ulp_mapper_tbl_info ulp_class_tbl_list[] = { .critical_resource = BNXT_ULP_CRITICAL_RESOURCE_NO }, { - .resource_func = BNXT_ULP_RESOURCE_FUNC_EM_TABLE, + .resource_func = BNXT_ULP_RESOURCE_FUNC_EXT_EM_TABLE, .resource_type = TF_MEM_EXTERNAL, .resource_sub_type = BNXT_ULP_RESOURCE_SUB_TYPE_NOT_USED,
@@ -389,7 +389,7 @@ struct bnxt_ulp_mapper_tbl_info ulp_class_tbl_list[] = { .critical_resource = BNXT_ULP_CRITICAL_RESOURCE_NO }, { - .resource_func = BNXT_ULP_RESOURCE_FUNC_EM_TABLE, + .resource_func = BNXT_ULP_RESOURCE_FUNC_EXT_EM_TABLE, .resource_type = TF_MEM_EXTERNAL, .resource_sub_type = BNXT_ULP_RESOURCE_SUB_TYPE_NOT_USED,
drivers/net/bnxt/tf_ulp/ulp_template_db_enum.h +7 -6
@@ -149,10 +149,11 @@ enum bnxt_ulp_flow_mem_type { };enum bnxt_ulp_glb_regfile_index { -BNXT_ULP_GLB_REGFILE_INDEX_GLB_PROF_FUNC_ID =0 , -BNXT_ULP_GLB_REGFILE_INDEX_GLB_L2_CNTXT_ID =1 , -BNXT_ULP_GLB_REGFILE_INDEX_GLB_LOOPBACK_AREC_INDEX =2 , -BNXT_ULP_GLB_REGFILE_INDEX_LAST =3 +BNXT_ULP_GLB_REGFILE_INDEX_NOT_USED =0 , +BNXT_ULP_GLB_REGFILE_INDEX_GLB_PROF_FUNC_ID =1 , +BNXT_ULP_GLB_REGFILE_INDEX_GLB_L2_CNTXT_ID =2 , +BNXT_ULP_GLB_REGFILE_INDEX_GLB_LB_AREC_PTR =3 , +BNXT_ULP_GLB_REGFILE_INDEX_LAST =4 };enum bnxt_ulp_hdr_type {
@@ -257,8 +258,8 @@ enum bnxt_ulp_match_type_bitmask {enum bnxt_ulp_resource_func {BNXT_ULP_RESOURCE_FUNC_INVALID =0x00 , -BNXT_ULP_RESOURCE_FUNC_EM_TABLE =0x20 , -BNXT_ULP_RESOURCE_FUNC_RSVD1 =0x40 , +BNXT_ULP_RESOURCE_FUNC_EXT_EM_TABLE =0x20 , +BNXT_ULP_RESOURCE_FUNC_INT_EM_TABLE =0x40 ,BNXT_ULP_RESOURCE_FUNC_RSVD2 =0x60 ,BNXT_ULP_RESOURCE_FUNC_TCAM_TABLE =0x80 ,BNXT_ULP_RESOURCE_FUNC_INDEX_TABLE =0x81 ,
drivers/net/bnxt/tf_ulp/ulp_template_db_tbl.c +6 -1
@@ -321,7 +321,12 @@ struct bnxt_ulp_device_params ulp_device_params[BNXT_ULP_DEVICE_ID_LAST] = { .mark_db_gfid_entries = 65536, .flow_count_db_entries = 16384, .num_resources_per_flow = 8, - .num_phy_ports = 2 + .num_phy_ports = 2, + .ext_cntr_table_type = 0, + .byte_count_mask = 0x00000003ffffffff, + .packet_count_mask = 0xfffffffc00000000, + .byte_count_shift = 0, + .packet_count_shift = 36 } };
drivers/net/bnxt/tf_ulp/ulp_template_struct.h +5 -0
@@ -146,6 +146,11 @@ struct bnxt_ulp_device_params {uint64_t flow_db_num_entries;uint32_t flow_count_db_entries;uint32_t num_resources_per_flow; +uint32_t ext_cntr_table_type; +uint64_t byte_count_mask; +uint64_t packet_count_mask; +uint32_t byte_count_shift; +uint32_t packet_count_shift; };/* Flow Mapper */
Signature · 1 line
2.21.1 (Apple Git-122.3)
PATCH v5 39/51 net/bnxt: add conditional execution of mapper tables
In reply to Ajit KhapardeFrom: Kishore Padmanabha <[email protected]>
Added support for conditional execution of the mapper tables so that actions like count will have table processed only if action count is configured.
--- drivers/net/bnxt/tf_ulp/ulp_mapper.c | 45 +++++++++++++++++++ drivers/net/bnxt/tf_ulp/ulp_mapper.h | 1 + drivers/net/bnxt/tf_ulp/ulp_rte_parser.c | 8 ++++ .../net/bnxt/tf_ulp/ulp_template_db_enum.h | 12 ++++- drivers/net/bnxt/tf_ulp/ulp_template_struct.h | 2 + 5 files changed, 67 insertions(+), 1 deletion(-)
drivers/net/bnxt/tf_ulp/ulp_mapper.c +45 -0
@@ -2008,6 +2008,44 @@ ulp_mapper_glb_resource_info_init(struct bnxt_ulp_context *ulp_ctx,return rc; } +/* +* Function to process the conditional opcode of the mapper table. +* returns 1 to skip the table. +* return 0 to continue processing the table. +*/ +static int32_t +ulp_mapper_tbl_cond_opcode_process (struct bnxt_ulp_mapper_parms *parms, +struct bnxt_ulp_mapper_tbl_info *tbl) +{ +int32_t rc =1 ; + +switch (tbl->cond_opcode) { +case BNXT_ULP_COND_OPCODE_NOP : + rc =0 ; +break ; +case BNXT_ULP_COND_OPCODE_COMP_FIELD : +if (tbl->cond_operand <BNXT_ULP_CF_IDX_LAST && +ULP_COMP_FLD_IDX_RD (parms, tbl->cond_operand)) + rc =0 ; +break ; +case BNXT_ULP_COND_OPCODE_ACTION_BIT : +if (ULP_BITMAP_ISSET (parms->act_bitmap->bits, + tbl->cond_operand)) + rc =0 ; +break ; +case BNXT_ULP_COND_OPCODE_HDR_BIT : +if (ULP_BITMAP_ISSET (parms->hdr_bitmap->bits, + tbl->cond_operand)) + rc =0 ; +break ; +default : +BNXT_TF_DBG (ERR , +"Invalid arg in mapper tbl for cond opcode\n" ); +break ; + } +return rc; +} +/* * Function to process the action template. Iterate through the list * action info templates and process it.
@@ -2027,6 +2065,9 @@ ulp_mapper_action_tbls_process(struct bnxt_ulp_mapper_parms *parms)for (i =0 ; i < parms->num_atbls; i++) { tbl = &parms->atbls[i]; +if (ulp_mapper_tbl_cond_opcode_process (parms, tbl)) +continue ; +switch (tbl->resource_func) {case BNXT_ULP_RESOURCE_FUNC_INDEX_TABLE : rc =ulp_mapper_index_tbl_process (parms, tbl, false);
@@ -2065,6 +2106,9 @@ ulp_mapper_class_tbls_process(struct bnxt_ulp_mapper_parms *parms)for (i =0 ; i < parms->num_ctbls; i++) {struct bnxt_ulp_mapper_tbl_info *tbl = &parms->ctbls[i]; +if (ulp_mapper_tbl_cond_opcode_process (parms, tbl)) +continue ; +switch (tbl->resource_func) {case BNXT_ULP_RESOURCE_FUNC_TCAM_TABLE : rc =ulp_mapper_tcam_tbl_process (parms, tbl);
@@ -2326,6 +2370,7 @@ ulp_mapper_flow_create(struct bnxt_ulp_context *ulp_ctx,memset (&parms,0 ,sizeof (parms)); parms.act_prop = cparms->act_prop; parms.act_bitmap = cparms->act; + parms.hdr_bitmap = cparms->hdr_bitmap; parms.regfile = ®file; parms.hdr_field = cparms->hdr_field; parms.comp_fld = cparms->comp_fld;
drivers/net/bnxt/tf_ulp/ulp_mapper.h +1 -0
@@ -62,6 +62,7 @@ struct bnxt_ulp_mapper_parms {uint32_t num_ctbls;struct ulp_rte_act_prop *act_prop;struct ulp_rte_act_bitmap *act_bitmap; +struct ulp_rte_hdr_bitmap *hdr_bitmap;struct ulp_rte_hdr_field *hdr_field;uint32_t *comp_fld;struct ulp_regfile *regfile;
drivers/net/bnxt/tf_ulp/ulp_rte_parser.c +8 -0
@@ -1128,6 +1128,10 @@ ulp_rte_vxlan_encap_act_handler(const struct rte_flow_action *action_item,memcpy (&ap->act_details[BNXT_ULP_ACT_PROP_IDX_ENCAP_L3_TYPE ], &ip_type,sizeof (uint32_t )); +/* update the computed field to notify it is ipv4 header */ +ULP_COMP_FLD_IDX_WR (params,BNXT_ULP_CF_IDX_ACT_ENCAP_IPV4_FLAG , +1 ); +if (!ulp_rte_item_skip_void (&item,1 ))return BNXT_TF_RC_ERROR ; }else if (item->type ==RTE_FLOW_ITEM_TYPE_IPV6 ) {
@@ -1148,6 +1152,10 @@ ulp_rte_vxlan_encap_act_handler(const struct rte_flow_action *action_item,memcpy (&ap->act_details[BNXT_ULP_ACT_PROP_IDX_ENCAP_L3_TYPE ], &ip_type,sizeof (uint32_t )); +/* update the computed field to notify it is ipv6 header */ +ULP_COMP_FLD_IDX_WR (params,BNXT_ULP_CF_IDX_ACT_ENCAP_IPV6_FLAG , +1 ); +if (!ulp_rte_item_skip_void (&item,1 ))return BNXT_TF_RC_ERROR ; }else {
drivers/net/bnxt/tf_ulp/ulp_template_db_enum.h +11 -1
@@ -118,7 +118,17 @@ enum bnxt_ulp_cf_idx {BNXT_ULP_CF_IDX_PHY_PORT_SPIF =26 ,BNXT_ULP_CF_IDX_PHY_PORT_PARIF =27 ,BNXT_ULP_CF_IDX_PHY_PORT_VPORT =28 , -BNXT_ULP_CF_IDX_LAST =29 +BNXT_ULP_CF_IDX_ACT_ENCAP_IPV4_FLAG =29 , +BNXT_ULP_CF_IDX_ACT_ENCAP_IPV6_FLAG =30 , +BNXT_ULP_CF_IDX_LAST =31 +}; + +enum bnxt_ulp_cond_opcode { +BNXT_ULP_COND_OPCODE_NOP =0 , +BNXT_ULP_COND_OPCODE_COMP_FIELD =1 , +BNXT_ULP_COND_OPCODE_ACTION_BIT =2 , +BNXT_ULP_COND_OPCODE_HDR_BIT =3 , +BNXT_ULP_COND_OPCODE_LAST =4 }; enum bnxt_ulp_critical_resource {
drivers/net/bnxt/tf_ulp/ulp_template_struct.h +2 -0
@@ -165,6 +165,8 @@ struct bnxt_ulp_mapper_tbl_info {enum bnxt_ulp_resource_func resource_func;uint32_t resource_type;/* TF_ enum type */ enum bnxt_ulp_resource_sub_type resource_sub_type; +enum bnxt_ulp_cond_opcode cond_opcode; +uint32_t cond_operand;uint8_t direction;uint32_t priority;uint8_t srch_b4_alloc;
Signature · 1 line
2.21.1 (Apple Git-122.3)
PATCH v5 40/51 net/bnxt: allow port MAC qcfg command for trusted VF
In reply to Ajit KhapardeFrom: Venkat Duvvuru <[email protected]>
Issue HWRM_PORT_MAC_QCFG command on trusted vf to fetch the port count.
--- drivers/net/bnxt/bnxt_hwrm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/bnxt/bnxt_hwrm.c +2 -2
@@ -3194,14 +3194,14 @@ int bnxt_hwrm_port_mac_qcfg(struct bnxt *bp) bp->port_svif =BNXT_SVIF_INVALID ; -if (!BNXT_PF (bp)) +if (BNXT_VF (bp) && !BNXT_VF_IS_TRUSTED (bp))return 0 ;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 (); +HWRM_CHECK_RESULT_SILENT (); port_svif_info =rte_le_to_cpu_16 (resp->port_svif_info); if (port_svif_info &
Signature · 1 line
2.21.1 (Apple Git-122.3)
PATCH v5 41/51 net/bnxt: enhancements for port db
In reply to Ajit KhapardeFrom: Venkat Duvvuru <[email protected]>
1. Add "enum bnxt_ulp_intf_type” as the second parameter for the port & func helper functions
2. Return vfrep related port & func information in the helper functions
3. Allocate phy_port_list dynamically based on port count
4. Introduce ulp_func_id_tbl array for book keeping func related information indexed by func_id
--- drivers/net/bnxt/bnxt.h | 10 +- drivers/net/bnxt/bnxt_ethdev.c | 64 ++++++++-- drivers/net/bnxt/tf_ulp/bnxt_tf_common.h | 6 + drivers/net/bnxt/tf_ulp/bnxt_ulp.c | 2 +- drivers/net/bnxt/tf_ulp/bnxt_ulp_flow.c | 9 +- drivers/net/bnxt/tf_ulp/ulp_port_db.c | 143 +++++++++++++++++------ drivers/net/bnxt/tf_ulp/ulp_port_db.h | 56 +++++++-- drivers/net/bnxt/tf_ulp/ulp_rte_parser.c | 22 +++- 8 files changed, 250 insertions(+), 62 deletions(-)
drivers/net/bnxt/bnxt.h +6 -4
@@ -23,6 +23,7 @@#include "tf_core.h" #include "bnxt_ulp.h" +#include "bnxt_tf_common.h" /* Vendor ID */ #define PCI_VENDOR_ID_BROADCOM 0x14E4
@@ -879,10 +880,11 @@ 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); -uint16_t bnxt_get_vnic_id (uint16_t port); -uint16_t bnxt_get_svif (uint16_t port_id,bool func_svif); -uint16_t bnxt_get_fw_func_id (uint16_t port); -uint16_t bnxt_get_parif (uint16_t port); +uint16_t bnxt_get_vnic_id (uint16_t port,enum bnxt_ulp_intf_type type); +uint16_t bnxt_get_svif (uint16_t port_id,bool func_svif, +enum bnxt_ulp_intf_type type); +uint16_t bnxt_get_fw_func_id (uint16_t port,enum bnxt_ulp_intf_type type); +uint16_t bnxt_get_parif (uint16_t port,enum bnxt_ulp_intf_type type);uint16_t bnxt_get_phy_port_id (uint16_t port);uint16_t bnxt_get_vport (uint16_t port);enum bnxt_ulp_intf_type
drivers/net/bnxt/bnxt_ethdev.c +56 -8
122 lines not on this page · raw message
drivers/net/bnxt/tf_ulp/bnxt_tf_common.h +6 -0
@@ -6,6 +6,11 @@#ifndef _BNXT_TF_COMMON_H_#define _BNXT_TF_COMMON_H_ +#include <inttypes.h> + +#include "bnxt_ulp.h" +#include "ulp_template_db_enum.h" + #define BNXT_TF_DBG(lvl, fmt, args...) PMD_DRV_LOG(lvl, fmt, ## args)#define BNXT_ULP_EM_FLOWS 8192
@@ -48,6 +53,7 @@ enum ulp_direction_type {enum bnxt_ulp_intf_type {BNXT_ULP_INTF_TYPE_INVALID =0 ,BNXT_ULP_INTF_TYPE_PF , +BNXT_ULP_INTF_TYPE_TRUSTED_VF ,BNXT_ULP_INTF_TYPE_VF ,BNXT_ULP_INTF_TYPE_PF_REP ,BNXT_ULP_INTF_TYPE_VF_REP ,
drivers/net/bnxt/tf_ulp/bnxt_ulp.c +1 -1
@@ -658,7 +658,7 @@ bnxt_ulp_init(struct bnxt *bp) rc =ulp_dparms_init (bp, bp->ulp_ctx);/* create the port database */ - rc =ulp_port_db_init (bp->ulp_ctx); + rc =ulp_port_db_init (bp->ulp_ctx, bp->port_cnt);if (rc) {BNXT_TF_DBG (ERR ,"Failed to create the port database\n" ); goto jump_to_error;
drivers/net/bnxt/tf_ulp/bnxt_ulp_flow.c +6 -3
@@ -128,7 +128,8 @@ bnxt_ulp_flow_create(struct rte_eth_dev *dev, mapper_cparms.act_prop = ¶ms.act_prop; mapper_cparms.class_tid = class_id; mapper_cparms.act_tid = act_tmpl; - mapper_cparms.func_id =bnxt_get_fw_func_id (dev->data->port_id); + mapper_cparms.func_id =bnxt_get_fw_func_id (dev->data->port_id, +BNXT_ULP_INTF_TYPE_INVALID ); mapper_cparms.dir = params.dir;/* Call the ulp mapper to create the flow in the hardware. */
@@ -226,7 +227,8 @@ bnxt_ulp_flow_destroy(struct rte_eth_dev *dev, } flow_id = (uint32_t )(uintptr_t )flow; - func_id =bnxt_get_fw_func_id (dev->data->port_id); + func_id =bnxt_get_fw_func_id (dev->data->port_id, +BNXT_ULP_INTF_TYPE_INVALID );if (ulp_flow_db_validate_flow_func (ulp_ctx, flow_id, func_id) == false) {
@@ -270,7 +272,8 @@ bnxt_ulp_flow_flush(struct rte_eth_dev *eth_dev,if (ulp_ctx_deinit_allowed (bp)) { ret =ulp_flow_db_session_flow_flush (ulp_ctx); }else if (bnxt_ulp_cntxt_ptr2_flow_db_get (ulp_ctx)) { - func_id =bnxt_get_fw_func_id (eth_dev->data->port_id); + func_id =bnxt_get_fw_func_id (eth_dev->data->port_id, +BNXT_ULP_INTF_TYPE_INVALID ); ret =ulp_flow_db_function_flow_flush (ulp_ctx, func_id); }if (ret)
drivers/net/bnxt/tf_ulp/ulp_port_db.c +110 -33
282 lines not on this page · raw message
drivers/net/bnxt/tf_ulp/ulp_port_db.h +47 -9
94 lines not on this page · raw message
drivers/net/bnxt/tf_ulp/ulp_rte_parser.c +18 -4
@@ -166,6 +166,8 @@ ulp_rte_parser_svif_set(struct ulp_rte_parser_params *params,uint16_t port_id = svif;uint32_t dir =0 ;struct ulp_rte_hdr_field *hdr_field; +enum bnxt_ulp_svif_type svif_type; +enum bnxt_ulp_intf_type if_type;uint32_t ifindex;int32_t rc;
@@ -187,7 +189,18 @@ ulp_rte_parser_svif_set(struct ulp_rte_parser_params *params, "Invalid port id\n");return BNXT_TF_RC_ERROR ; } -ulp_port_db_svif_get (params->ulp_ctx, ifindex, dir, &svif); + +if (dir ==ULP_DIR_INGRESS ) { + svif_type =BNXT_ULP_PHY_PORT_SVIF ; + }else { + if_type =bnxt_get_interface_type (port_id); +if (if_type ==BNXT_ULP_INTF_TYPE_VF_REP ) + svif_type =BNXT_ULP_VF_FUNC_SVIF ; +else + svif_type =BNXT_ULP_DRV_FUNC_SVIF ; + } +ulp_port_db_svif_get (params->ulp_ctx, ifindex, svif_type, + &svif); svif =rte_cpu_to_be_16 (svif); } hdr_field = ¶ms->hdr_field[BNXT_ULP_PROTO_HDR_FIELD_SVIF_IDX ];
@@ -1256,7 +1269,7 @@ ulp_rte_pf_act_handler(const struct rte_flow_action *action_item __rte_unused,/* copy the PF of the current device into VNIC Property */ svif =ULP_COMP_FLD_IDX_RD (params,BNXT_ULP_CF_IDX_INCOMING_IF ); - svif =bnxt_get_vnic_id (svif); + svif =bnxt_get_vnic_id (svif,BNXT_ULP_INTF_TYPE_INVALID ); svif =rte_cpu_to_be_32 (svif);memcpy (¶ms->act_prop.act_details[BNXT_ULP_ACT_PROP_IDX_VNIC ], &svif,BNXT_ULP_ACT_PROP_SZ_VNIC );
@@ -1280,7 +1293,8 @@ ulp_rte_vf_act_handler(const struct rte_flow_action *action_item,return BNXT_TF_RC_PARSE_ERR ; }/* TBD: Update the computed VNIC using VF conversion */ - pid =bnxt_get_vnic_id (vf_action->id); + pid =bnxt_get_vnic_id (vf_action->id, +BNXT_ULP_INTF_TYPE_INVALID ); pid =rte_cpu_to_be_32 (pid);memcpy (¶m->act_prop.act_details[BNXT_ULP_ACT_PROP_IDX_VNIC ], &pid,BNXT_ULP_ACT_PROP_SZ_VNIC );
@@ -1307,7 +1321,7 @@ ulp_rte_port_id_act_handler(const struct rte_flow_action *act_item,return BNXT_TF_RC_PARSE_ERR ; }/* TBD: Update the computed VNIC using port conversion */ - pid =bnxt_get_vnic_id (port_id->id); + pid =bnxt_get_vnic_id (port_id->id,BNXT_ULP_INTF_TYPE_INVALID ); pid =rte_cpu_to_be_32 (pid);memcpy (¶m->act_prop.act_details[BNXT_ULP_ACT_PROP_IDX_VNIC ], &pid,BNXT_ULP_ACT_PROP_SZ_VNIC );
Signature · 1 line
2.21.1 (Apple Git-122.3)
PATCH v5 42/51 net/bnxt: manage VF to VFR conduit
In reply to Ajit KhapardeFrom: Venkat Duvvuru <[email protected]>
When VF-VFR conduits are created, a mark is added to the mark database. mark_flag indicates whether the mark is valid and has VFR information (VFR_ID bit in mark_flag). Rx path was checking for this VFR_ID bit. However, while adding the mark to the mark database, VFR_ID bit is not set in mark_flag.
--- drivers/net/bnxt/tf_ulp/ulp_mark_mgr.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/net/bnxt/tf_ulp/ulp_mark_mgr.c +5 -0
@@ -18,6 +18,8 @@ BNXT_ULP_MARK_VALID)#define ULP_MARK_DB_ENTRY_IS_INVALID (mark_info) (!((mark_info)->flags &\ BNXT_ULP_MARK_VALID)) +#define ULP_MARK_DB_ENTRY_SET_VFR_ID (mark_info) ((mark_info)->flags |=\ + BNXT_ULP_MARK_VFR_ID)#define ULP_MARK_DB_ENTRY_IS_VFR_ID (mark_info) ((mark_info)->flags &\ BNXT_ULP_MARK_VFR_ID)#define ULP_MARK_DB_ENTRY_IS_GLOBAL_HW_FID (mark_info) ((mark_info)->flags &\
@@ -263,6 +265,9 @@ ulp_mark_db_mark_add(struct bnxt_ulp_context *ctxt,BNXT_TF_DBG (DEBUG ,"Set LFID[0x%0x] = 0x%0x\n" , fid, mark); mtbl->lfid_tbl[fid].mark_id = mark;ULP_MARK_DB_ENTRY_SET_VALID (&mtbl->lfid_tbl[fid]); + +if (mark_flag &BNXT_ULP_MARK_VFR_ID ) +ULP_MARK_DB_ENTRY_SET_VFR_ID (&mtbl->lfid_tbl[fid]); }return 0 ;
Signature · 1 line
2.21.1 (Apple Git-122.3)
PATCH v5 43/51 net/bnxt: parse reps along with other dev-args
In reply to Ajit KhapardeFrom: Somnath Kotur <[email protected]>
Representor dev-args need to be parsed during pci probe as they determine subsequent probe of VF representor ports as well.
--- drivers/net/bnxt/bnxt_ethdev.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/net/bnxt/bnxt_ethdev.c +2 -0
@@ -97,8 +97,10 @@ static const struct rte_pci_id bnxt_pci_id_map[] = {#define BNXT_DEVARG_TRUFLOW "host-based-truflow"#define BNXT_DEVARG_FLOW_XSTAT "flow-xstat"#define BNXT_DEVARG_MAX_NUM_KFLOWS "max-num-kflows" +#define BNXT_DEVARG_REPRESENTOR "representor"static const char *const bnxt_dev_args[] = { +BNXT_DEVARG_REPRESENTOR ,BNXT_DEVARG_TRUFLOW ,BNXT_DEVARG_FLOW_XSTAT ,BNXT_DEVARG_MAX_NUM_KFLOWS ,
Signature · 1 line
2.21.1 (Apple Git-122.3)