From: Peter Spreadborough Date: Thu, 2 Jul 2020 23:27:57 +0000 (-0700) Subject: net/bnxt: use HWRM direct for exact match insert and delete X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=ce28720e006404729c358ff651672dea8203d3b2;p=dpdk.git net/bnxt: use HWRM direct for exact match insert and delete 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 Signed-off-by: Venkat Duvvuru Reviewed-by: Randy Schacher Reviewed-by: Ajit Khaparde --- diff --git a/drivers/net/bnxt/tf_core/hwrm_tf.h b/drivers/net/bnxt/tf_core/hwrm_tf.h index 439950e022..d69bed863b 100644 --- a/drivers/net/bnxt/tf_core/hwrm_tf.h +++ b/drivers/net/bnxt/tf_core/hwrm_tf.h @@ -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 */ @@ -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_ */ diff --git a/drivers/net/bnxt/tf_core/tf_msg.c b/drivers/net/bnxt/tf_core/tf_msg.c index 554a8491df..c8f6b88d3b 100644 --- a/drivers/net/bnxt/tf_core/tf_msg.c +++ b/drivers/net/bnxt/tf_core/tf_msg.c @@ -1023,32 +1023,38 @@ int tf_msg_insert_em_internal_entry(struct tf *tfp, uint8_t *rptr_entry, uint8_t *num_of_entries) { - int rc; - struct tfp_send_msg_parms parms = { 0 }; - struct tf_em_internal_insert_input req = { 0 }; - struct tf_em_internal_insert_output resp = { 0 }; + int rc; + struct tfp_send_msg_parms parms = { 0 }; + struct hwrm_tf_em_insert_input req = { 0 }; + struct hwrm_tf_em_insert_output resp = { 0 }; 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; req.fw_session_id = tfp_cpu_to_le_32(tfs->session_id.internal.fw_session_id); memcpy(req.em_key, em_parms->key, ((em_parms->key_sz_in_bits + 7) / 8)); - req.flags = tfp_cpu_to_le_16(em_parms->dir); + + flags = (em_parms->dir == TF_DIR_TX ? + 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.em_key_bitlen = em_parms->key_sz_in_bits; req.action_ptr = em_result->hdr.pointer; req.em_record_idx = *rptr_index; - MSG_PREP(parms, - TF_KONG_MB, - HWRM_TF, - HWRM_TFT_EM_RULE_INSERT, - req, - resp); + parms.tf_type = HWRM_TF_EM_INSERT; + parms.req_data = (uint32_t *)&req; + parms.req_size = sizeof(req); + parms.resp_data = (uint32_t *)&resp; + parms.resp_size = sizeof(resp); + parms.mailbox = TF_KONG_MB; - rc = tfp_send_msg_tunneled(tfp, &parms); + rc = tfp_send_msg_direct(tfp, + &parms); if (rc) return rc; @@ -1056,7 +1062,7 @@ int tf_msg_insert_em_internal_entry(struct tf *tfp, *rptr_index = resp.rptr_index; *num_of_entries = resp.num_of_entries; - return tfp_le_to_cpu_32(parms.tf_resp_code); + return 0; } /** @@ -1065,32 +1071,38 @@ int tf_msg_insert_em_internal_entry(struct tf *tfp, int tf_msg_delete_em_entry(struct tf *tfp, struct tf_delete_em_entry_parms *em_parms) { - int rc; - struct tfp_send_msg_parms parms = { 0 }; - struct tf_em_internal_delete_input req = { 0 }; - struct tf_em_internal_delete_output resp = { 0 }; + int rc; + 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; struct tf_session *tfs = (struct tf_session *)(tfp->session->core_data); - req.tf_session_id = + req.fw_session_id = tfp_cpu_to_le_32(tfs->session_id.internal.fw_session_id); - req.flags = tfp_cpu_to_le_16(em_parms->dir); + + flags = (em_parms->dir == TF_DIR_TX ? + HWRM_TF_EM_DELETE_INPUT_FLAGS_DIR_TX : + HWRM_TF_EM_DELETE_INPUT_FLAGS_DIR_RX); + req.flags = tfp_cpu_to_le_16(flags); req.flow_handle = tfp_cpu_to_le_64(em_parms->flow_handle); - MSG_PREP(parms, - TF_KONG_MB, - HWRM_TF, - HWRM_TFT_EM_RULE_DELETE, - req, - resp); + parms.tf_type = HWRM_TF_EM_DELETE; + parms.req_data = (uint32_t *)&req; + parms.req_size = sizeof(req); + parms.resp_data = (uint32_t *)&resp; + parms.resp_size = sizeof(resp); + parms.mailbox = TF_KONG_MB; - rc = tfp_send_msg_tunneled(tfp, &parms); + rc = tfp_send_msg_direct(tfp, + &parms); if (rc) return rc; em_parms->index = tfp_le_to_cpu_16(resp.em_index); - return tfp_le_to_cpu_32(parms.tf_resp_code); + return 0; } /**