From patchwork Wed Jul 1 06:51:31 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ajit Khaparde X-Patchwork-Id: 72533 X-Patchwork-Delegate: ajit.khaparde@broadcom.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 91A99A0350; Wed, 1 Jul 2020 08:54:08 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id AE5901C1B2; Wed, 1 Jul 2020 08:52:34 +0200 (CEST) Received: from rnd-relay.smtp.broadcom.com (rnd-relay.smtp.broadcom.com [192.19.229.170]) by dpdk.org (Postfix) with ESMTP id 3DAD71C029 for ; Wed, 1 Jul 2020 08:52:19 +0200 (CEST) Received: from mail-irv-17.broadcom.com (mail-irv-17.lvn.broadcom.net [10.75.242.48]) by rnd-relay.smtp.broadcom.com (Postfix) with ESMTP id 8710F30C31A; Tue, 30 Jun 2020 23:52:18 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.10.3 rnd-relay.smtp.broadcom.com 8710F30C31A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=broadcom.com; s=dkimrelay; t=1593586338; bh=vALNCTqtddWJI+OVARfOmZyVD+iIS/AeUocFzxk2LRw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oLkpxXRZCq4BiYVSvddvoyLRYsYBIlGTDDvxchiK5x6hMOV1kzUwVqL8E5mQDpMma qxW0zCYastQrdJmusqmu5G0hvN8DsnBVZa6+bjaabyvbPgdTZau+2mF04mIJxuiAZk Fwr13FfziDbPe+D6ZaoN9bDaWgDuxYMUn1nRyShE= Received: from localhost.localdomain (unknown [10.230.185.215]) by mail-irv-17.broadcom.com (Postfix) with ESMTP id 5D424140069; Tue, 30 Jun 2020 23:52:18 -0700 (PDT) From: Ajit Khaparde To: dev@dpdk.org Cc: Peter Spreadborough , Venkat Duvvuru , Randy Schacher Date: Tue, 30 Jun 2020 23:51:31 -0700 Message-Id: <20200701065212.41391-11-ajit.khaparde@broadcom.com> X-Mailer: git-send-email 2.21.1 (Apple Git-122.3) In-Reply-To: <20200701065212.41391-1-ajit.khaparde@broadcom.com> References: <20200612132934.16488-1-somnath.kotur@broadcom.com> <20200701065212.41391-1-ajit.khaparde@broadcom.com> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH v2 10/51] 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: Peter Spreadborough 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 --- 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 439950e02..d342c695c 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 554a8491d..c8f6b88d3 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; } /**