From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id EC161A00BE; Fri, 12 Jun 2020 15:38:53 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 8A4151BF98; Fri, 12 Jun 2020 15:34:21 +0200 (CEST) Received: from relay.smtp.broadcom.com (unknown [192.19.232.149]) by dpdk.org (Postfix) with ESMTP id C2FB81BF7A for ; Fri, 12 Jun 2020 15:34:18 +0200 (CEST) Received: from dhcp-10-123-153-55.dhcp.broadcom.net (dhcp-10-123-153-55.dhcp.broadcom.net [10.123.153.55]) by relay.smtp.broadcom.com (Postfix) with ESMTP id 517BC1BD7A4; Fri, 12 Jun 2020 06:34:17 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.10.3 relay.smtp.broadcom.com 517BC1BD7A4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=broadcom.com; s=dkimrelay; t=1591968858; bh=j6eGA/ehwkKbE1ZwifmPaBsxQ0rZU7TJ43I78cIspAQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=t0qoNrAAX6Puc0jZsteRLCvL0vz87kTTBSJfHQ+fqsqdKY8lPLpd6BZgLtWAZGAY9 Bwh+ndRQIoNEreZErmJ6DlgPeQXmJ4tGYwJlRCBOTFYs6/DmFIkD1BYDhg0VGQda7t 6J+lJI8/vdeGaOrmcwSUDpQezjcov6jtHY7FfmBc= From: Somnath Kotur To: dev@dpdk.org Cc: ferruh.yigit@intel.com Date: Fri, 12 Jun 2020 18:58:54 +0530 Message-Id: <20200612132934.16488-11-somnath.kotur@broadcom.com> X-Mailer: git-send-email 2.10.1.613.g2cc2e70 In-Reply-To: <20200612132934.16488-1-somnath.kotur@broadcom.com> References: <20200612132934.16488-1-somnath.kotur@broadcom.com> Subject: [dpdk-dev] [PATCH 10/50] net/bnxt: modify EM insert and delete to use HWRM direct X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" From: Pete Spreadborough Modify Exact Match insert and delete to use the HWRM messages directly. Remove tunneled EM insert and delete message types. Signed-off-by: Pete Spreadborough Reviewed-by: Randy Schacher Signed-off-by: Venkat Duvvuru --- 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(-) diff --git a/drivers/net/bnxt/tf_core/hwrm_tf.h b/drivers/net/bnxt/tf_core/hwrm_tf.h index 439950e..d342c69 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 */ @@ -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_ */ diff --git a/drivers/net/bnxt/tf_core/tf_msg.c b/drivers/net/bnxt/tf_core/tf_msg.c index 554a849..c8f6b88 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; } /** -- 2.7.4