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 5C432A00BE; Fri, 12 Jun 2020 14:55:55 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 6D16C1BDF8; Fri, 12 Jun 2020 14:55:04 +0200 (CEST) Received: from relay.smtp.broadcom.com (unknown [192.19.232.149]) by dpdk.org (Postfix) with ESMTP id 96F8614583 for ; Fri, 12 Jun 2020 14:55:01 +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 5AC841BD6D3; Fri, 12 Jun 2020 05:55:01 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.10.3 relay.smtp.broadcom.com 5AC841BD6D3 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=broadcom.com; s=dkimrelay; t=1591966502; bh=jYM7ced58UrvRZSwvuPKOrLJTiLhUM4kf1YoH2P93zY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KkHWwgFIXQxIKPYYjP0/bem7rmgrKaNRH1it++/BPMKAuuW7ru7jkonzwoU1hhGas swWlznHSGgpurhxWRu1FQ3QsyyOIg6NBYTUk1Ye0rtBKdqV5h6DVX5Cg7ej23UzPfL 2san7z4Xf0GlurK1mVIvMbGajuf9BJvBIaQwTaYA= From: Somnath Kotur To: dev@dpdk.org Cc: ferruh.yigit@intel.com Date: Fri, 12 Jun 2020 18:19:54 +0530 Message-Id: <20200612125024.15989-7-somnath.kotur@broadcom.com> X-Mailer: git-send-email 2.10.1.613.g2cc2e70 In-Reply-To: <20200612125024.15989-1-somnath.kotur@broadcom.com> References: <20200612125024.15989-1-somnath.kotur@broadcom.com> Subject: [dpdk-dev] [PATCH 06/36] net/bnxt: support more resource functions in flow database 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: Kishore Padmanabha Added support to include more resource functions in the flow database. The number of bits increased from 3 to 8 for storing the resource function. Signed-off-by: Kishore Padmanabha Reviewed-by: Somnath Kotur Signed-off-by: Somnath Kotur --- drivers/net/bnxt/tf_ulp/ulp_flow_db.c | 51 +++++++++++++++++++++++-------- drivers/net/bnxt/tf_ulp/ulp_flow_db.h | 24 +++++++++++---- drivers/net/bnxt/tf_ulp/ulp_mapper.c | 13 +++----- drivers/net/bnxt/tf_ulp/ulp_mapper.h | 3 -- drivers/net/bnxt/tf_ulp/ulp_template_db.h | 18 ++++++----- 5 files changed, 71 insertions(+), 38 deletions(-) diff --git a/drivers/net/bnxt/tf_ulp/ulp_flow_db.c b/drivers/net/bnxt/tf_ulp/ulp_flow_db.c index 35a7f86..30a809a 100644 --- a/drivers/net/bnxt/tf_ulp/ulp_flow_db.c +++ b/drivers/net/bnxt/tf_ulp/ulp_flow_db.c @@ -16,6 +16,9 @@ #define ULP_FLOW_DB_RES_FUNC_BITS 28 #define ULP_FLOW_DB_RES_FUNC_MASK 0x70000000 #define ULP_FLOW_DB_RES_NXT_MASK 0x0FFFFFFF +#define ULP_FLOW_DB_RES_FUNC_UPPER 5 +#define ULP_FLOW_DB_RES_FUNC_NEED_LOWER 0x80 +#define ULP_FLOW_DB_RES_FUNC_LOWER_MASK 0x1F /* Macro to copy the nxt_resource_idx */ #define ULP_FLOW_DB_RES_NXT_SET(dst, src) {(dst) |= ((src) &\ @@ -77,20 +80,32 @@ ulp_flow_db_active_flow_is_set(struct bnxt_ulp_flow_tbl *flow_tbl, * returns none */ static void -ulp_flow_db_res_params_to_info(struct ulp_fdb_resource_info *resource_info, - struct ulp_flow_db_res_params *params) +ulp_flow_db_res_params_to_info(struct ulp_fdb_resource_info *resource_info, + struct ulp_flow_db_res_params *params) { + uint32_t resource_func; + resource_info->nxt_resource_idx |= ((params->direction << ULP_FLOW_DB_RES_DIR_BIT) & ULP_FLOW_DB_RES_DIR_MASK); - resource_info->nxt_resource_idx |= ((params->resource_func << + resource_func = (params->resource_func >> ULP_FLOW_DB_RES_FUNC_UPPER); + resource_info->nxt_resource_idx |= ((resource_func << ULP_FLOW_DB_RES_FUNC_BITS) & ULP_FLOW_DB_RES_FUNC_MASK); + if (params->resource_func & ULP_FLOW_DB_RES_FUNC_NEED_LOWER) { + /* Break the resource func into two parts */ + resource_func = (params->resource_func & + ULP_FLOW_DB_RES_FUNC_LOWER_MASK); + resource_info->resource_func_lower = resource_func; + } + + /* Store the handle as 64bit only for EM table entries */ if (params->resource_func != BNXT_ULP_RESOURCE_FUNC_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; + resource_info->reserved = params->reserved; } else { resource_info->resource_em_handle = params->resource_hndl; } @@ -106,22 +121,34 @@ ulp_flow_db_res_params_to_info(struct ulp_fdb_resource_info *resource_info, * returns none */ static void -ulp_flow_db_res_info_to_params(struct ulp_fdb_resource_info *resource_info, - struct ulp_flow_db_res_params *params) +ulp_flow_db_res_info_to_params(struct ulp_fdb_resource_info *resource_info, + struct ulp_flow_db_res_params *params) { + uint8_t resource_func_upper; + memset(params, 0, sizeof(struct ulp_flow_db_res_params)); params->direction = ((resource_info->nxt_resource_idx & ULP_FLOW_DB_RES_DIR_MASK) >> ULP_FLOW_DB_RES_DIR_BIT); - params->resource_func = ((resource_info->nxt_resource_idx & - ULP_FLOW_DB_RES_FUNC_MASK) >> - ULP_FLOW_DB_RES_FUNC_BITS); + resource_func_upper = (((resource_info->nxt_resource_idx & + ULP_FLOW_DB_RES_FUNC_MASK) >> + ULP_FLOW_DB_RES_FUNC_BITS) << + ULP_FLOW_DB_RES_FUNC_UPPER); + + /* The reource func is split into upper and lower */ + if (resource_func_upper & ULP_FLOW_DB_RES_FUNC_NEED_LOWER) + params->resource_func = (resource_func_upper | + resource_info->resource_func_lower); + else + params->resource_func = resource_func_upper; - if (params->resource_func != BNXT_ULP_RESOURCE_FUNC_EM_TABLE) { + if (params->resource_func == BNXT_ULP_RESOURCE_FUNC_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; params->resource_type = resource_info->resource_type; - } else { - params->resource_hndl = resource_info->resource_em_handle; + params->resource_sub_type = resource_info->resource_sub_type; + params->reserved = resource_info->reserved; } } diff --git a/drivers/net/bnxt/tf_ulp/ulp_flow_db.h b/drivers/net/bnxt/tf_ulp/ulp_flow_db.h index ebca849..9037dc5 100644 --- a/drivers/net/bnxt/tf_ulp/ulp_flow_db.h +++ b/drivers/net/bnxt/tf_ulp/ulp_flow_db.h @@ -12,14 +12,24 @@ #define BNXT_FLOW_DB_DEFAULT_NUM_FLOWS 128 #define BNXT_FLOW_DB_DEFAULT_NUM_RESOURCES 5 -/* Structure for the flow database resource information. */ +/* + * Structure for the flow database resource information + * The below structure is based on the below paritions + * nxt_resource_idx = dir[31],resource_func_upper[30:28],nxt_resource_idx[27:0] + * If resource_func is EM_TBL then use resource_em_handle. + * Else the other part of the union is used and + * resource_func is resource_func_upper[30:28] << 5 | resource_func_lower + */ struct ulp_fdb_resource_info { /* Points to next resource in the chained list. */ - uint32_t nxt_resource_idx; + uint32_t nxt_resource_idx; union { - uint64_t resource_em_handle; + uint64_t resource_em_handle; struct { - uint32_t resource_type; + uint8_t resource_func_lower; + uint8_t resource_type; + uint8_t resource_sub_type; + uint8_t reserved; uint32_t resource_hndl; }; }; @@ -59,9 +69,11 @@ struct bnxt_ulp_flow_db { struct ulp_flow_db_res_params { enum tf_dir direction; enum bnxt_ulp_resource_func resource_func; + uint8_t resource_type; + uint8_t resource_sub_type; + uint8_t reserved; + uint8_t critical_resource; uint64_t resource_hndl; - uint32_t resource_type; - uint32_t critical_resource; }; /* diff --git a/drivers/net/bnxt/tf_ulp/ulp_mapper.c b/drivers/net/bnxt/tf_ulp/ulp_mapper.c index 9531bed..437b055 100644 --- a/drivers/net/bnxt/tf_ulp/ulp_mapper.c +++ b/drivers/net/bnxt/tf_ulp/ulp_mapper.c @@ -292,9 +292,8 @@ ulp_mapper_cache_res_type_set(struct ulp_flow_db_res_params *res, uint16_t tbl_type, uint16_t tbl_id) { - res->resource_type = - ((uint32_t)tbl_id << ULP_MAPPER_CACHE_RES_TBL_ID_SHFT) | - ((uint32_t)tbl_type << ULP_MAPPER_CACHE_RES_TBL_TYPE_SHFT); + res->resource_type = tbl_type; + res->resource_sub_type = tbl_id; } /* Extracts the tbl_type and tbl_id from the 32bit resource type. */ @@ -303,12 +302,8 @@ ulp_mapper_cache_res_type_get(struct ulp_flow_db_res_params *res, uint16_t *tbl_type, uint16_t *tbl_id) { - *tbl_type = (uint16_t)((res->resource_type >> - ULP_MAPPER_CACHE_RES_TBL_TYPE_SHFT) & - ULP_MAPPER_CACHE_RES_TBL_MASK); - *tbl_id = (uint16_t)((res->resource_type >> - ULP_MAPPER_CACHE_RES_TBL_ID_SHFT) & - ULP_MAPPER_CACHE_RES_TBL_MASK); + *tbl_type = res->resource_type; + *tbl_id = res->resource_sub_type; } static int32_t diff --git a/drivers/net/bnxt/tf_ulp/ulp_mapper.h b/drivers/net/bnxt/tf_ulp/ulp_mapper.h index 0754e39..3be04e8 100644 --- a/drivers/net/bnxt/tf_ulp/ulp_mapper.h +++ b/drivers/net/bnxt/tf_ulp/ulp_mapper.h @@ -17,9 +17,6 @@ #define ULP_SZ_BITS2BYTES(x) (((x) + 7) / 8) #define ULP_IDENTS_INVALID ((uint16_t)0xffff) -#define ULP_MAPPER_CACHE_RES_TBL_ID_SHFT 16 -#define ULP_MAPPER_CACHE_RES_TBL_TYPE_SHFT 0 -#define ULP_MAPPER_CACHE_RES_TBL_MASK ((uint32_t)0x0000ffff) /* * The cache table opcode is used to convey informat from the cache handler diff --git a/drivers/net/bnxt/tf_ulp/ulp_template_db.h b/drivers/net/bnxt/tf_ulp/ulp_template_db.h index fcd80d9..4721177 100644 --- a/drivers/net/bnxt/tf_ulp/ulp_template_db.h +++ b/drivers/net/bnxt/tf_ulp/ulp_template_db.h @@ -196,14 +196,16 @@ enum bnxt_ulp_regfile_index { }; enum bnxt_ulp_resource_func { - BNXT_ULP_RESOURCE_FUNC_INVALID = 0, - BNXT_ULP_RESOURCE_FUNC_TCAM_TABLE = 1, - BNXT_ULP_RESOURCE_FUNC_EM_TABLE = 2, - BNXT_ULP_RESOURCE_FUNC_INDEX_TABLE = 3, - BNXT_ULP_RESOURCE_FUNC_CACHE_TABLE = 4, - BNXT_ULP_RESOURCE_FUNC_IDENTIFIER = 5, - BNXT_ULP_RESOURCE_FUNC_HW_FID = 6, - BNXT_ULP_RESOURCE_FUNC_LAST = 7 + BNXT_ULP_RESOURCE_FUNC_INVALID = 0x00, + BNXT_ULP_RESOURCE_FUNC_EM_TABLE = 0x20, + BNXT_ULP_RESOURCE_FUNC_RSVD1 = 0x40, + BNXT_ULP_RESOURCE_FUNC_RSVD2 = 0x60, + BNXT_ULP_RESOURCE_FUNC_TCAM_TABLE = 0x80, + BNXT_ULP_RESOURCE_FUNC_INDEX_TABLE = 0x81, + BNXT_ULP_RESOURCE_FUNC_CACHE_TABLE = 0x82, + BNXT_ULP_RESOURCE_FUNC_IDENTIFIER = 0x83, + BNXT_ULP_RESOURCE_FUNC_IF_TABLE = 0x84, + BNXT_ULP_RESOURCE_FUNC_HW_FID = 0x85 }; enum bnxt_ulp_result_opc { -- 2.7.4