net/bnxt: align CFA resources with RM

- HCAPI resources need to align for Resource Manager
- Clean up unnecessary debug messages

Signed-off-by: Randy Schacher <stuart.schacher@broadcom.com>
Signed-off-by: Venkat Duvvuru <venkatkumar.duvvuru@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
This commit is contained in:
Randy Schacher 2020-07-02 16:28:14 -07:00 committed by Ferruh Yigit
parent f000d3dcd5
commit d0d22f1f06
6 changed files with 197 additions and 145 deletions

View File

@ -48,20 +48,22 @@
#define CFA_RESOURCE_TYPE_P59_TBL_SCOPE 0xdUL #define CFA_RESOURCE_TYPE_P59_TBL_SCOPE 0xdUL
/* L2 Func */ /* L2 Func */
#define CFA_RESOURCE_TYPE_P59_L2_FUNC 0xeUL #define CFA_RESOURCE_TYPE_P59_L2_FUNC 0xeUL
/* EPOCH */ /* EPOCH 0 */
#define CFA_RESOURCE_TYPE_P59_EPOCH 0xfUL #define CFA_RESOURCE_TYPE_P59_EPOCH0 0xfUL
/* EPOCH 1 */
#define CFA_RESOURCE_TYPE_P59_EPOCH1 0x10UL
/* Metadata */ /* Metadata */
#define CFA_RESOURCE_TYPE_P59_METADATA 0x10UL #define CFA_RESOURCE_TYPE_P59_METADATA 0x11UL
/* Connection Tracking Rule TCAM */ /* Connection Tracking Rule TCAM */
#define CFA_RESOURCE_TYPE_P59_CT_RULE_TCAM 0x11UL #define CFA_RESOURCE_TYPE_P59_CT_RULE_TCAM 0x12UL
/* Range Profile */ /* Range Profile */
#define CFA_RESOURCE_TYPE_P59_RANGE_PROF 0x12UL #define CFA_RESOURCE_TYPE_P59_RANGE_PROF 0x13UL
/* Range */ /* Range */
#define CFA_RESOURCE_TYPE_P59_RANGE 0x13UL #define CFA_RESOURCE_TYPE_P59_RANGE 0x14UL
/* Link Aggrigation */ /* Link Aggrigation */
#define CFA_RESOURCE_TYPE_P59_LAG 0x14UL #define CFA_RESOURCE_TYPE_P59_LAG 0x15UL
/* VEB TCAM */ /* 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 #define CFA_RESOURCE_TYPE_P59_LAST CFA_RESOURCE_TYPE_P59_VEB_TCAM
@ -87,52 +89,56 @@
#define CFA_RESOURCE_TYPE_P58_NAT_S_IPV4 0x9UL #define CFA_RESOURCE_TYPE_P58_NAT_S_IPV4 0x9UL
/* Network Address Translation Destination IPv4 address */ /* Network Address Translation Destination IPv4 address */
#define CFA_RESOURCE_TYPE_P58_NAT_D_IPV4 0xaUL #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
/* Meter */ /* Meter */
#define CFA_RESOURCE_TYPE_P58_METER 0xdUL #define CFA_RESOURCE_TYPE_P58_METER 0xbUL
/* Flow State */ /* Flow State */
#define CFA_RESOURCE_TYPE_P58_FLOW_STATE 0xeUL #define CFA_RESOURCE_TYPE_P58_FLOW_STATE 0xcUL
/* Full Action Records */ /* Full Action Records */
#define CFA_RESOURCE_TYPE_P58_FULL_ACTION 0xfUL #define CFA_RESOURCE_TYPE_P58_FULL_ACTION 0xdUL
/* Action Record Format 0 */ /* 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 */ /* 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 */ /* 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 */ /* 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 */ /* L2 Context TCAM */
#define CFA_RESOURCE_TYPE_P58_L2_CTXT_TCAM 0x14UL #define CFA_RESOURCE_TYPE_P58_L2_CTXT_TCAM 0x16UL
/* L2 Context REMAP */ /* L2 Context REMAP */
#define CFA_RESOURCE_TYPE_P58_L2_CTXT_REMAP 0x15UL #define CFA_RESOURCE_TYPE_P58_L2_CTXT_REMAP 0x17UL
/* Profile Func */ /* Profile Func */
#define CFA_RESOURCE_TYPE_P58_PROF_FUNC 0x16UL #define CFA_RESOURCE_TYPE_P58_PROF_FUNC 0x18UL
/* Profile TCAM */ /* Profile TCAM */
#define CFA_RESOURCE_TYPE_P58_PROF_TCAM 0x17UL #define CFA_RESOURCE_TYPE_P58_PROF_TCAM 0x19UL
/* Exact Match Profile Id */ /* 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 */ /* 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 */ /* Exact Match Record */
#define CFA_RESOURCE_TYPE_P58_EM_REC 0x1aUL #define CFA_RESOURCE_TYPE_P58_EM_REC 0x1cUL
/* Wildcard TCAM */ /* Wildcard TCAM */
#define CFA_RESOURCE_TYPE_P58_WC_TCAM 0x1bUL #define CFA_RESOURCE_TYPE_P58_WC_TCAM 0x1dUL
/* Meter profile */ /* Meter profile */
#define CFA_RESOURCE_TYPE_P58_METER_PROF 0x1cUL #define CFA_RESOURCE_TYPE_P58_METER_PROF 0x1eUL
/* Meter */ /* Meter */
#define CFA_RESOURCE_TYPE_P58_MIRROR 0x1dUL #define CFA_RESOURCE_TYPE_P58_MIRROR 0x1fUL
/* Source Property TCAM */ /* Source Property TCAM */
#define CFA_RESOURCE_TYPE_P58_SP_TCAM 0x1eUL #define CFA_RESOURCE_TYPE_P58_SP_TCAM 0x20UL
/* Exact Match Flexible Key Builder */ /* 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 */ /* Wildcard Flexible Key Builder */
#define CFA_RESOURCE_TYPE_P58_WC_FKB 0x20UL #define CFA_RESOURCE_TYPE_P58_WC_FKB 0x22UL
/* VEB TCAM */ /* VEB TCAM */
#define CFA_RESOURCE_TYPE_P58_VEB_TCAM 0x21UL #define CFA_RESOURCE_TYPE_P58_VEB_TCAM 0x23UL
#define CFA_RESOURCE_TYPE_P58_LAST CFA_RESOURCE_TYPE_P58_VEB_TCAM #define CFA_RESOURCE_TYPE_P58_LAST CFA_RESOURCE_TYPE_P58_VEB_TCAM
@ -160,50 +166,54 @@
#define CFA_RESOURCE_TYPE_P45_NAT_S_IPV4 0xaUL #define CFA_RESOURCE_TYPE_P45_NAT_S_IPV4 0xaUL
/* Network Address Translation Destination IPv4 address */ /* Network Address Translation Destination IPv4 address */
#define CFA_RESOURCE_TYPE_P45_NAT_D_IPV4 0xbUL #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
/* Meter */ /* Meter */
#define CFA_RESOURCE_TYPE_P45_METER 0xeUL #define CFA_RESOURCE_TYPE_P45_METER 0xcUL
/* Flow State */ /* Flow State */
#define CFA_RESOURCE_TYPE_P45_FLOW_STATE 0xfUL #define CFA_RESOURCE_TYPE_P45_FLOW_STATE 0xdUL
/* Full Action Records */ /* Full Action Records */
#define CFA_RESOURCE_TYPE_P45_FULL_ACTION 0x10UL #define CFA_RESOURCE_TYPE_P45_FULL_ACTION 0xeUL
/* Action Record Format 0 */ /* 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 */ /* 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 */ /* 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 */ /* 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 */ /* L2 Context TCAM */
#define CFA_RESOURCE_TYPE_P45_L2_CTXT_TCAM 0x15UL #define CFA_RESOURCE_TYPE_P45_L2_CTXT_TCAM 0x17UL
/* L2 Context REMAP */ /* L2 Context REMAP */
#define CFA_RESOURCE_TYPE_P45_L2_CTXT_REMAP 0x16UL #define CFA_RESOURCE_TYPE_P45_L2_CTXT_REMAP 0x18UL
/* Profile Func */ /* Profile Func */
#define CFA_RESOURCE_TYPE_P45_PROF_FUNC 0x17UL #define CFA_RESOURCE_TYPE_P45_PROF_FUNC 0x19UL
/* Profile TCAM */ /* Profile TCAM */
#define CFA_RESOURCE_TYPE_P45_PROF_TCAM 0x18UL #define CFA_RESOURCE_TYPE_P45_PROF_TCAM 0x1aUL
/* Exact Match Profile Id */ /* 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 */ /* Exact Match Record */
#define CFA_RESOURCE_TYPE_P45_EM_REC 0x1aUL #define CFA_RESOURCE_TYPE_P45_EM_REC 0x1cUL
/* Wildcard Profile Id */ /* 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 */ /* Wildcard TCAM */
#define CFA_RESOURCE_TYPE_P45_WC_TCAM 0x1cUL #define CFA_RESOURCE_TYPE_P45_WC_TCAM 0x1eUL
/* Meter profile */ /* Meter profile */
#define CFA_RESOURCE_TYPE_P45_METER_PROF 0x1dUL #define CFA_RESOURCE_TYPE_P45_METER_PROF 0x1fUL
/* Meter */ /* Meter */
#define CFA_RESOURCE_TYPE_P45_MIRROR 0x1eUL #define CFA_RESOURCE_TYPE_P45_MIRROR 0x20UL
/* Source Property TCAM */ /* Source Property TCAM */
#define CFA_RESOURCE_TYPE_P45_SP_TCAM 0x1fUL #define CFA_RESOURCE_TYPE_P45_SP_TCAM 0x21UL
/* VEB TCAM */ /* VEB TCAM */
#define CFA_RESOURCE_TYPE_P45_VEB_TCAM 0x20UL #define CFA_RESOURCE_TYPE_P45_VEB_TCAM 0x22UL
/* Table Scope */ /* Table Scope */
#define CFA_RESOURCE_TYPE_P45_TBL_SCOPE 0x21UL #define CFA_RESOURCE_TYPE_P45_TBL_SCOPE 0x23UL
#define CFA_RESOURCE_TYPE_P45_LAST CFA_RESOURCE_TYPE_P45_TBL_SCOPE #define CFA_RESOURCE_TYPE_P45_LAST CFA_RESOURCE_TYPE_P45_TBL_SCOPE
@ -231,48 +241,52 @@
#define CFA_RESOURCE_TYPE_P4_NAT_S_IPV4 0xaUL #define CFA_RESOURCE_TYPE_P4_NAT_S_IPV4 0xaUL
/* Network Address Translation Destination IPv4 address */ /* Network Address Translation Destination IPv4 address */
#define CFA_RESOURCE_TYPE_P4_NAT_D_IPV4 0xbUL #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
/* Meter */ /* Meter */
#define CFA_RESOURCE_TYPE_P4_METER 0xeUL #define CFA_RESOURCE_TYPE_P4_METER 0xcUL
/* Flow State */ /* Flow State */
#define CFA_RESOURCE_TYPE_P4_FLOW_STATE 0xfUL #define CFA_RESOURCE_TYPE_P4_FLOW_STATE 0xdUL
/* Full Action Records */ /* Full Action Records */
#define CFA_RESOURCE_TYPE_P4_FULL_ACTION 0x10UL #define CFA_RESOURCE_TYPE_P4_FULL_ACTION 0xeUL
/* Action Record Format 0 */ /* 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 */ /* 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 */ /* 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 */ /* 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 */ /* L2 Context TCAM */
#define CFA_RESOURCE_TYPE_P4_L2_CTXT_TCAM 0x15UL #define CFA_RESOURCE_TYPE_P4_L2_CTXT_TCAM 0x17UL
/* L2 Context REMAP */ /* L2 Context REMAP */
#define CFA_RESOURCE_TYPE_P4_L2_CTXT_REMAP 0x16UL #define CFA_RESOURCE_TYPE_P4_L2_CTXT_REMAP 0x18UL
/* Profile Func */ /* Profile Func */
#define CFA_RESOURCE_TYPE_P4_PROF_FUNC 0x17UL #define CFA_RESOURCE_TYPE_P4_PROF_FUNC 0x19UL
/* Profile TCAM */ /* Profile TCAM */
#define CFA_RESOURCE_TYPE_P4_PROF_TCAM 0x18UL #define CFA_RESOURCE_TYPE_P4_PROF_TCAM 0x1aUL
/* Exact Match Profile Id */ /* 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 */ /* Exact Match Record */
#define CFA_RESOURCE_TYPE_P4_EM_REC 0x1aUL #define CFA_RESOURCE_TYPE_P4_EM_REC 0x1cUL
/* Wildcard Profile Id */ /* 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 */ /* Wildcard TCAM */
#define CFA_RESOURCE_TYPE_P4_WC_TCAM 0x1cUL #define CFA_RESOURCE_TYPE_P4_WC_TCAM 0x1eUL
/* Meter profile */ /* Meter profile */
#define CFA_RESOURCE_TYPE_P4_METER_PROF 0x1dUL #define CFA_RESOURCE_TYPE_P4_METER_PROF 0x1fUL
/* Meter */ /* Meter */
#define CFA_RESOURCE_TYPE_P4_MIRROR 0x1eUL #define CFA_RESOURCE_TYPE_P4_MIRROR 0x20UL
/* Source Property TCAM */ /* Source Property TCAM */
#define CFA_RESOURCE_TYPE_P4_SP_TCAM 0x1fUL #define CFA_RESOURCE_TYPE_P4_SP_TCAM 0x21UL
/* Table Scope */ /* Table Scope */
#define CFA_RESOURCE_TYPE_P4_TBL_SCOPE 0x20UL #define CFA_RESOURCE_TYPE_P4_TBL_SCOPE 0x22UL
#define CFA_RESOURCE_TYPE_P4_LAST CFA_RESOURCE_TYPE_P4_TBL_SCOPE #define CFA_RESOURCE_TYPE_P4_LAST CFA_RESOURCE_TYPE_P4_TBL_SCOPE

View File

@ -59,7 +59,8 @@ tf_ident_bind(struct tf *tfp,
init = 1; init = 1;
printf("Identifier - initialized\n"); TFP_DRV_LOG(INFO,
"Identifier - initialized\n");
return 0; return 0;
} }

View File

@ -18,6 +18,9 @@
#include "hwrm_tf.h" #include "hwrm_tf.h"
#include "tf_em.h" #include "tf_em.h"
/* Logging defines */
#define TF_RM_MSG_DEBUG 0
/** /**
* This is the MAX data we can transport across regular HWRM * 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); rc = tfp_send_msg_direct(tfp, &parms);
if (rc) if (rc)
return rc; goto cleanup;
/* Process the response /* Process the response
* Should always get expected number of entries * 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", "%s: QCAPS message size error, rc:%s\n",
tf_dir_2_str(dir), tf_dir_2_str(dir),
strerror(-EINVAL)); 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)); printf("size: %d\n", tfp_le_to_cpu_32(resp.size));
#endif /* (TF_RM_MSG_DEBUG == 1) */
/* Post process the response */ /* Post process the response */
data = (struct tf_rm_resc_req_entry *)qcaps_buf.va_addr; data = (struct tf_rm_resc_req_entry *)qcaps_buf.va_addr;
#if (TF_RM_MSG_DEBUG == 1)
printf("\nQCAPS\n"); printf("\nQCAPS\n");
#endif /* (TF_RM_MSG_DEBUG == 1) */
for (i = 0; i < size; i++) { for (i = 0; i < size; i++) {
query[i].type = tfp_le_to_cpu_32(data[i].type); query[i].type = tfp_le_to_cpu_32(data[i].type);
query[i].min = tfp_le_to_cpu_16(data[i].min); query[i].min = tfp_le_to_cpu_16(data[i].min);
query[i].max = tfp_le_to_cpu_16(data[i].max); 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", printf("type: %d(0x%x) %d %d\n",
query[i].type, query[i].type,
query[i].type, query[i].type,
query[i].min, query[i].min,
query[i].max); query[i].max);
#endif /* (TF_RM_MSG_DEBUG == 1) */
} }
*resv_strategy = resp.flags & *resv_strategy = resp.flags &
HWRM_TF_SESSION_RESC_QCAPS_OUTPUT_FLAGS_SESS_RESV_STRATEGY_MASK; HWRM_TF_SESSION_RESC_QCAPS_OUTPUT_FLAGS_SESS_RESV_STRATEGY_MASK;
cleanup:
tf_msg_free_dma_buf(&qcaps_buf); tf_msg_free_dma_buf(&qcaps_buf);
return rc; return rc;
@ -293,8 +304,10 @@ tf_msg_session_resc_alloc(struct tf *tfp,
dma_size = size * sizeof(struct tf_rm_resc_entry); dma_size = size * sizeof(struct tf_rm_resc_entry);
rc = tf_msg_alloc_dma_buf(&resv_buf, dma_size); rc = tf_msg_alloc_dma_buf(&resv_buf, dma_size);
if (rc) if (rc) {
tf_msg_free_dma_buf(&req_buf);
return rc; return rc;
}
/* Populate the request */ /* Populate the request */
req.fw_session_id = tfp_cpu_to_le_32(fw_session_id); 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); rc = tfp_send_msg_direct(tfp, &parms);
if (rc) if (rc)
return rc; goto cleanup;
/* Process the response /* Process the response
* Should always get expected number of entries * 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", "%s: Alloc message size error, rc:%s\n",
tf_dir_2_str(dir), tf_dir_2_str(dir),
strerror(-EINVAL)); strerror(-EINVAL));
return -EINVAL; rc = -EINVAL;
goto cleanup;
} }
#if (TF_RM_MSG_DEBUG == 1)
printf("\nRESV\n"); printf("\nRESV\n");
printf("size: %d\n", tfp_le_to_cpu_32(resp.size)); printf("size: %d\n", tfp_le_to_cpu_32(resp.size));
#endif /* (TF_RM_MSG_DEBUG == 1) */
/* Post process the response */ /* Post process the response */
resv_data = (struct tf_rm_resc_entry *)resv_buf.va_addr; 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].start = tfp_le_to_cpu_16(resv_data[i].start);
resv[i].stride = tfp_le_to_cpu_16(resv_data[i].stride); 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", printf("%d type: %d(0x%x) %d %d\n",
i, i,
resv[i].type, resv[i].type,
resv[i].type, resv[i].type,
resv[i].start, resv[i].start,
resv[i].stride); resv[i].stride);
#endif /* (TF_RM_MSG_DEBUG == 1) */
} }
cleanup:
tf_msg_free_dma_buf(&req_buf); tf_msg_free_dma_buf(&req_buf);
tf_msg_free_dma_buf(&resv_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; parms.mailbox = TF_KONG_MB;
rc = tfp_send_msg_direct(tfp, &parms); rc = tfp_send_msg_direct(tfp, &parms);
if (rc)
return rc;
tf_msg_free_dma_buf(&resv_buf); 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_session *tfs = (struct tf_session *)(tfp->session->core_data);
struct tf_em_64b_entry *em_result = struct tf_em_64b_entry *em_result =
(struct tf_em_64b_entry *)em_parms->em_record; (struct tf_em_64b_entry *)em_parms->em_record;
uint32_t flags; uint16_t flags;
req.fw_session_id = req.fw_session_id =
tfp_cpu_to_le_32(tfs->session_id.internal.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 tfp_send_msg_parms parms = { 0 };
struct hwrm_tf_em_delete_input req = { 0 }; struct hwrm_tf_em_delete_input req = { 0 };
struct hwrm_tf_em_delete_output resp = { 0 }; struct hwrm_tf_em_delete_output resp = { 0 };
uint32_t flags; uint16_t flags;
struct tf_session *tfs = struct tf_session *tfs =
(struct tf_session *)(tfp->session->core_data); (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, rc = tfp_send_msg_direct(tfp,
&mparms); &mparms);
if (rc)
goto cleanup;
cleanup: cleanup:
tf_msg_free_dma_buf(&buf); tf_msg_free_dma_buf(&buf);

View File

@ -17,6 +17,9 @@
#include "tfp.h" #include "tfp.h"
#include "tf_msg.h" #include "tf_msg.h"
/* Logging defines */
#define TF_RM_DEBUG 0
/** /**
* Generic RM Element data type that an RM DB is build upon. * 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 && cfg[i].cfg_type == TF_RM_ELEM_CFG_NULL &&
reservations[i] > 0) { reservations[i] > 0) {
TFP_DRV_LOG(ERR, TFP_DRV_LOG(ERR,
"%s, %s, %s allocation 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));
printf("%s, %s, %s allocation of %d not supported\n",
tf_device_module_type_2_str(type), tf_device_module_type_2_str(type),
tf_dir_2_str(dir), tf_dir_2_str(dir),
tf_device_module_type_subtype_2_str(type, i), tf_device_module_type_subtype_2_str(type, i),
reservations[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.start = resv[j].start;
db[i].alloc.entry.stride = resv[j].stride; 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 */ /* Only allocate BA pool if so requested */
if (parms->cfg[i].cfg_type == TF_RM_ELEM_CFG_HCAPI_BA) { if (parms->cfg[i].cfg_type == TF_RM_ELEM_CFG_HCAPI_BA) {
/* Create pool */ /* Create pool */
@ -603,10 +596,12 @@ tf_rm_create_db(struct tf *tfp,
rm_db->type = parms->type; rm_db->type = parms->type;
*parms->rm_db = (void *)rm_db; *parms->rm_db = (void *)rm_db;
#if (TF_RM_DEBUG == 1)
printf("%s: type:%d num_entries:%d\n", printf("%s: type:%d num_entries:%d\n",
tf_dir_2_str(parms->dir), tf_dir_2_str(parms->dir),
parms->type, parms->type,
i); i);
#endif /* (TF_RM_DEBUG == 1) */
tfp_free((void *)req); tfp_free((void *)req);
tfp_free((void *)resv); tfp_free((void *)resv);

View File

@ -74,7 +74,8 @@ tf_tbl_bind(struct tf *tfp,
init = 1; init = 1;
printf("Table Type - initialized\n"); TFP_DRV_LOG(INFO,
"Table Type - initialized\n");
return 0; return 0;
} }

View File

@ -81,7 +81,8 @@ tf_tcam_bind(struct tf *tfp,
init = 1; init = 1;
printf("TCAM - initialized\n"); TFP_DRV_LOG(INFO,
"TCAM - initialized\n");
return 0; return 0;
} }
@ -275,6 +276,31 @@ tf_tcam_free(struct tf *tfp,
return rc; 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 */ /* Convert TF type to HCAPI RM type */
hparms.rm_db = tcam_db[parms->dir]; hparms.rm_db = tcam_db[parms->dir];
hparms.db_index = parms->type; hparms.db_index = parms->type;