From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 694C045C9F; Thu, 7 Nov 2024 14:46:27 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 90ACA42FC3; Thu, 7 Nov 2024 14:45:51 +0100 (CET) Received: from mail-pg1-f169.google.com (mail-pg1-f169.google.com [209.85.215.169]) by mails.dpdk.org (Postfix) with ESMTP id 52DB442F49 for ; Thu, 7 Nov 2024 14:45:49 +0100 (CET) Received: by mail-pg1-f169.google.com with SMTP id 41be03b00d2f7-7e6cbf6cd1dso691346a12.3 for ; Thu, 07 Nov 2024 05:45:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1730987148; x=1731591948; darn=dpdk.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=MSdXTDYsLL2efmfeKFINKsrc6f9sAJ3lYSfdkX9ruSA=; b=WajXm1I6XedDxfxpPeZswS3ooGoif6evSP/z6wDeo2IrMl6niXFtphvgUQ6myGszUx ZgDbnDXJn+fNYV3lDQ3PiC9R8N+nrYbJgDXMKnvOj6S/jXtKEaEW4Uc0J7uaCpU/se1x 5cDQnZwYLCZk/3TwSbGStjMTYfHCMvHXD7m1Q= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730987148; x=1731591948; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=MSdXTDYsLL2efmfeKFINKsrc6f9sAJ3lYSfdkX9ruSA=; b=HH30pG8GxCvzhKxAwPU7PlFvR/p0gT4wHF/frB+OS/u78mqnaHizQ1Q4G7osINrWTX kpnKFOncCjzwjq0j+VYQaYwvhp8cE22q0ZcWoHxVLwZuODXG/dyH4GVdP+QfVVnGx4xQ 0FGqaiW3tZh43fUXrpy944T85PSPoPQzRVdlZ6T5w+oDOWYvQfbv24aN9ejWxiyxEIDP pEJdpF70xlqalXTzgUUZk+qVoatr8giUs25tTPOmr4q3mtatTNn7dxyeSZ/QB5N31XRT V/3fSVq9WcFiR8aYWsI0dKuGIcTUBGEZfC0iLUKGusCKDwpgmakZy733E0gFy86aebGC mnLA== X-Gm-Message-State: AOJu0YzZCXgqf8zFmXDTDWREewAIoj1Zzxh6a7aqbJGupPlV9LpuP5eN WlWNaabaR1C/aM/hZXnjt1AARsb3sxPPCAZ/zT9jGpWe+OdKi9xqdtEpmqD9uCCl5NQ+D6rxWcE Ves+3eQdC+XRMPRlZPn0tWe9CA5f28zlhLTCxJ81DSpyfmhGVnHOQrPpw9/d/gDGVM2CCtzXyco E72KHXAAnMeKHpO4VE7Uihzn0FxiMDlO9Cf49uZKc5Yg== X-Google-Smtp-Source: AGHT+IGr+veJJQ5Cg1g1hZtbt4ggM9uSKWM28HDJ8vL/pnCNLUgkdbfM1pjwpjkuxMCrPOtrSDC2IQ== X-Received: by 2002:a05:6a20:a10a:b0:1d9:c5ad:c995 with SMTP id adf61e73a8af0-1dc1e23f786mr36995637.9.1730987147754; Thu, 07 Nov 2024 05:45:47 -0800 (PST) Received: from dhcp-10-123-154-23.dhcp.broadcom.net ([192.19.234.250]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2e9a5f52969sm1409878a91.2.2024.11.07.05.45.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Nov 2024 05:45:47 -0800 (PST) From: Sriharsha Basavapatna To: dev@dpdk.org Cc: Kishore Padmanabha , Sriharsha Basavapatna , Shuanglin Wang , Shahaji Bhosle , Ajit Khaparde Subject: [PATCH v8 30/47] net/bnxt: tf_ulp: add mask defaults when mask is not specified Date: Thu, 7 Nov 2024 19:22:37 +0530 Message-Id: <20241107135254.1611676-31-sriharsha.basavapatna@broadcom.com> X-Mailer: git-send-email 2.39.0.189.g4dbebc36b0 In-Reply-To: <20241107135254.1611676-1-sriharsha.basavapatna@broadcom.com> References: <20241107135254.1611676-1-sriharsha.basavapatna@broadcom.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org From: Kishore Padmanabha If application does not specify mask in a field description then use the default mask values from dpdk header files. This patch also includes the following related changes. fix stats collection for shared session The stats accumulation was being performed on default session, it needs to get the correct session type to get shared session counters. updated ulp flow db for 64 bit handles Updated the ulp flow database so that all the hardware handles are 64 bit for all the resource types. Template rejection with no tables fails for vf to vf Fixed the template rejection logic to include the table even on unconditional rejection. This was exposed for vf to vf traffic on Thor 2 and resulted in a segmentation fault. fix spec and default mask parsing for flow items. Fixed the protocol header parsing when bith spec and mask are not given. Thor2 priority for l2 tcam records not adhered to Fix l2 context records priority in template compiler Fix flow handle mask offset Fix cpu_to_le_16 macro issues Fix misspellings in code Signed-off-by: Kishore Padmanabha Signed-off-by: Sriharsha Basavapatna Reviewed-by: Shuanglin Wang Reviewed-by: Shahaji Bhosle Reviewed-by: Ajit Khaparde --- drivers/net/bnxt/tf_ulp/ulp_fc_mgr.c | 6 +- drivers/net/bnxt/tf_ulp/ulp_fc_mgr.h | 2 + drivers/net/bnxt/tf_ulp/ulp_fc_mgr_tf.c | 17 +++-- drivers/net/bnxt/tf_ulp/ulp_fc_mgr_tfc.c | 1 + drivers/net/bnxt/tf_ulp/ulp_flow_db.c | 92 +++++------------------- drivers/net/bnxt/tf_ulp/ulp_flow_db.h | 27 +++---- drivers/net/bnxt/tf_ulp/ulp_mapper.c | 7 +- drivers/net/bnxt/tf_ulp/ulp_mapper_tfc.c | 4 +- drivers/net/bnxt/tf_ulp/ulp_matcher.c | 10 +-- drivers/net/bnxt/tf_ulp/ulp_rte_parser.c | 64 +++++++++++++++-- 10 files changed, 118 insertions(+), 112 deletions(-) diff --git a/drivers/net/bnxt/tf_ulp/ulp_fc_mgr.c b/drivers/net/bnxt/tf_ulp/ulp_fc_mgr.c index 0c46c7d4c9..eb2d14f3be 100644 --- a/drivers/net/bnxt/tf_ulp/ulp_fc_mgr.c +++ b/drivers/net/bnxt/tf_ulp/ulp_fc_mgr.c @@ -525,6 +525,7 @@ int ulp_fc_mgr_query_count_get(struct bnxt_ulp_context *ctxt, bool found_cntr_resource = false; bool found_parent_flow = false; uint32_t pc_idx = 0; + uint32_t session_type = 0; uint8_t dir; ulp_fc_info = bnxt_ulp_cntxt_ptr2_fc_info_get(ctxt); @@ -569,8 +570,9 @@ int ulp_fc_mgr_query_count_get(struct bnxt_ulp_context *ctxt, } dir = params.direction; + session_type = ulp_flow_db_shared_session_get(¶ms); if (!(ulp_fc_info->flags & ULP_FLAG_FC_SW_AGG_EN)) { - rc = fc_ops->ulp_flow_stat_get(ctxt, dir, + rc = fc_ops->ulp_flow_stat_get(ctxt, dir, session_type, params.resource_hndl, count); bnxt_ulp_cntxt_release_fdb_lock(ctxt); return rc; @@ -581,7 +583,7 @@ int ulp_fc_mgr_query_count_get(struct bnxt_ulp_context *ctxt, BNXT_ULP_RESOURCE_SUB_TYPE_INDEX_TABLE_INT_COUNT) { hw_cntr_id = params.resource_hndl; if (!ulp_fc_info->num_counters) { - rc = fc_ops->ulp_flow_stat_get(ctxt, dir, + rc = fc_ops->ulp_flow_stat_get(ctxt, dir, session_type, hw_cntr_id, count); bnxt_ulp_cntxt_release_fdb_lock(ctxt); return rc; diff --git a/drivers/net/bnxt/tf_ulp/ulp_fc_mgr.h b/drivers/net/bnxt/tf_ulp/ulp_fc_mgr.h index daa2210728..0b81be7af9 100644 --- a/drivers/net/bnxt/tf_ulp/ulp_fc_mgr.h +++ b/drivers/net/bnxt/tf_ulp/ulp_fc_mgr.h @@ -7,6 +7,7 @@ #define _ULP_FC_MGR_H_ #include "bnxt_ulp.h" +#include "ulp_flow_db.h" #define ULP_FLAG_FC_THREAD BIT(0) #define ULP_FLAG_FC_SW_AGG_EN BIT(1) @@ -28,6 +29,7 @@ struct bnxt_ulp_fc_core_ops { int32_t (*ulp_flow_stat_get)(struct bnxt_ulp_context *ctxt, uint8_t direction, + uint32_t session_type, uint64_t handle, struct rte_flow_query_count *count); int32_t diff --git a/drivers/net/bnxt/tf_ulp/ulp_fc_mgr_tf.c b/drivers/net/bnxt/tf_ulp/ulp_fc_mgr_tf.c index c46ee51709..a9b2267881 100644 --- a/drivers/net/bnxt/tf_ulp/ulp_fc_mgr_tf.c +++ b/drivers/net/bnxt/tf_ulp/ulp_fc_mgr_tf.c @@ -157,17 +157,19 @@ ulp_fc_tf_update_accum_stats(struct bnxt_ulp_context *ctxt, enum tf_dir dir; struct tf *tfp; - tfp = bnxt_ulp_cntxt_tfp_get(ctxt, BNXT_ULP_SESSION_TYPE_DEFAULT); - if (!tfp) { - BNXT_DRV_DBG(ERR, "Failed to get the truflow pointer\n"); - return 0; /* This can happen, return for now with success */ - } - num_entries = dparms->flow_count_db_entries / 2; for (dir = 0; dir < TF_DIR_MAX; dir++) { for (j = 0; j < num_entries; j++) { if (!fc_info->sw_acc_tbl[dir][j].valid) continue; + tfp = bnxt_ulp_cntxt_tfp_get(ctxt, + fc_info->sw_acc_tbl[dir][j].session_type); + if (!tfp) { + BNXT_DRV_DBG(ERR, + "Failed to get the tfp\n"); + return 0; + } + hw_cntr_id = fc_info->sw_acc_tbl[dir][j].hw_cntr_id; rc = ulp_fc_tf_flow_stat_update(ctxt, tfp, fc_info, dir, @@ -183,6 +185,7 @@ ulp_fc_tf_update_accum_stats(struct bnxt_ulp_context *ctxt, static int32_t ulp_fc_tf_flow_stat_get(struct bnxt_ulp_context *ctxt, uint8_t direction, + uint32_t session_type, uint64_t handle, struct rte_flow_query_count *qcount) { @@ -195,7 +198,7 @@ ulp_fc_tf_flow_stat_get(struct bnxt_ulp_context *ctxt, uint32_t dev_id = 0; int32_t rc = 0; - tfp = bnxt_ulp_cntxt_tfp_get(ctxt, BNXT_ULP_SESSION_TYPE_DEFAULT); + tfp = bnxt_ulp_cntxt_tfp_get(ctxt, session_type); if (!tfp) { BNXT_DRV_DBG(ERR, "Failed to get the truflow pointer\n"); return -EINVAL; diff --git a/drivers/net/bnxt/tf_ulp/ulp_fc_mgr_tfc.c b/drivers/net/bnxt/tf_ulp/ulp_fc_mgr_tfc.c index 24299a269b..7c404685df 100644 --- a/drivers/net/bnxt/tf_ulp/ulp_fc_mgr_tfc.c +++ b/drivers/net/bnxt/tf_ulp/ulp_fc_mgr_tfc.c @@ -43,6 +43,7 @@ static uint8_t *data; static int32_t ulp_fc_tfc_flow_stat_get(struct bnxt_ulp_context *ctxt, uint8_t direction, + uint32_t session_type __rte_unused, uint64_t handle, struct rte_flow_query_count *count) { diff --git a/drivers/net/bnxt/tf_ulp/ulp_flow_db.c b/drivers/net/bnxt/tf_ulp/ulp_flow_db.c index 27f1115990..23382fecb3 100644 --- a/drivers/net/bnxt/tf_ulp/ulp_flow_db.c +++ b/drivers/net/bnxt/tf_ulp/ulp_flow_db.c @@ -17,12 +17,7 @@ #define ULP_FLOW_DB_RES_DIR_BIT 31 #define ULP_FLOW_DB_RES_DIR_MASK 0x80000000 -#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 +#define ULP_FLOW_DB_RES_NXT_MASK 0x7FFFFFFF /* Macro to copy the nxt_resource_idx */ #define ULP_FLOW_DB_RES_NXT_SET(dst, src) {(dst) |= ((src) &\ @@ -111,17 +106,10 @@ ulp_flow_db_resource_dir_get(struct ulp_fdb_resource_info *res_info) ULP_FLOW_DB_RES_DIR_BIT); } -static uint8_t +static inline uint8_t ulp_flow_db_resource_func_get(struct ulp_fdb_resource_info *res_info) { - uint8_t func; - - func = (((res_info->nxt_resource_idx & ULP_FLOW_DB_RES_FUNC_MASK) >> - ULP_FLOW_DB_RES_FUNC_BITS) << ULP_FLOW_DB_RES_FUNC_UPPER); - /* The resource func is split into upper and lower */ - if (func & ULP_FLOW_DB_RES_FUNC_NEED_LOWER) - return (func | res_info->resource_func_lower); - return func; + return res_info->resource_func; } /* @@ -136,35 +124,14 @@ static void 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_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 && - params->resource_func != BNXT_ULP_RESOURCE_FUNC_CMM_TABLE && - params->resource_func != BNXT_ULP_RESOURCE_FUNC_CMM_STAT) { - 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->fdb_flags = params->fdb_flags; - } else { - resource_info->resource_em_handle = params->resource_hndl; - resource_info->reserve_flag = params->reserve_flag; - } + resource_info->resource_func = params->resource_func; + resource_info->resource_type = params->resource_type; + resource_info->resource_sub_type = params->resource_sub_type; + resource_info->fdb_flags = params->fdb_flags; + resource_info->resource_hndl = params->resource_hndl; } /* @@ -181,22 +148,13 @@ ulp_flow_db_res_info_to_params(struct ulp_fdb_resource_info *resource_info, struct ulp_flow_db_res_params *params) { memset(params, 0, sizeof(struct ulp_flow_db_res_params)); - /* use the helper function to get the resource func */ params->direction = ulp_flow_db_resource_dir_get(resource_info); params->resource_func = ulp_flow_db_resource_func_get(resource_info); - - if (params->resource_func == BNXT_ULP_RESOURCE_FUNC_EM_TABLE || - params->resource_func == BNXT_ULP_RESOURCE_FUNC_CMM_TABLE || - params->resource_func == BNXT_ULP_RESOURCE_FUNC_CMM_STAT) { - params->resource_hndl = resource_info->resource_em_handle; - params->reserve_flag = resource_info->reserve_flag; - } 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; - params->resource_sub_type = resource_info->resource_sub_type; - params->fdb_flags = resource_info->fdb_flags; - } + params->resource_type = resource_info->resource_type; + params->resource_sub_type = resource_info->resource_sub_type; + params->fdb_flags = resource_info->fdb_flags; + params->resource_hndl = resource_info->resource_hndl; } /* @@ -629,7 +587,8 @@ ulp_flow_db_resource_add(struct bnxt_ulp_context *ulp_ctxt, } fid_resource = &flow_tbl->flow_resources[fid]; - if (params->critical_resource && fid_resource->resource_em_handle) { + if (params->critical_resource && (fid_resource->fdb_flags & + ULP_FDB_FLAG_CRITICAL_RES)) { BNXT_DRV_DBG(DEBUG, "Ignore multiple critical resources\n"); /* Ignore the multiple critical resources */ params->critical_resource = BNXT_ULP_CRITICAL_RESOURCE_NO; @@ -652,6 +611,7 @@ ulp_flow_db_resource_add(struct bnxt_ulp_context *ulp_ctxt, } else { /* critical resource. Just update the fid resource */ ulp_flow_db_res_params_to_info(fid_resource, params); + fid_resource->fdb_flags |= ULP_FDB_FLAG_CRITICAL_RES; } ulp_fc_info = bnxt_ulp_cntxt_ptr2_fc_info_get(ulp_ctxt); @@ -1150,24 +1110,10 @@ ulp_flow_db_resource_params_get(struct bnxt_ulp_context *ulp_ctx, memset(params, 0, sizeof(struct ulp_flow_db_res_params)); while (res_id) { fid_res = &flow_tbl->flow_resources[res_id]; - if (ulp_flow_db_resource_func_get(fid_res) == resource_func) { - if (resource_func & ULP_FLOW_DB_RES_FUNC_NEED_LOWER) { - if (res_subtype == fid_res->resource_sub_type) { - ulp_flow_db_res_info_to_params(fid_res, - params); - return 0; - } - - } else if (resource_func == - BNXT_ULP_RESOURCE_FUNC_EM_TABLE || - resource_func == - BNXT_ULP_RESOURCE_FUNC_CMM_TABLE || - resource_func == - BNXT_ULP_RESOURCE_FUNC_CMM_STAT) { - ulp_flow_db_res_info_to_params(fid_res, - params); - return 0; - } + if (ulp_flow_db_resource_func_get(fid_res) == resource_func && + fid_res->resource_sub_type == res_subtype) { + ulp_flow_db_res_info_to_params(fid_res, params); + return 0; } res_id = 0; ULP_FLOW_DB_RES_NXT_SET(res_id, fid_res->nxt_resource_idx); diff --git a/drivers/net/bnxt/tf_ulp/ulp_flow_db.h b/drivers/net/bnxt/tf_ulp/ulp_flow_db.h index 5a4b5a1ebf..762ebb039d 100644 --- a/drivers/net/bnxt/tf_ulp/ulp_flow_db.h +++ b/drivers/net/bnxt/tf_ulp/ulp_flow_db.h @@ -16,30 +16,22 @@ /* Defines for the fdb flag */ #define ULP_FDB_FLAG_SHARED_SESSION 0x1 #define ULP_FDB_FLAG_SHARED_WC_SESSION 0x2 +#define ULP_FDB_FLAG_SW_ONLY 0x4 +#define ULP_FDB_FLAG_CRITICAL_RES 0x8 /* * Structure for the flow database resource information * The below structure is based on the below partitions - * 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 + * nxt_resource_idx = dir[31],nxt_resource_idx[30:0] */ struct ulp_fdb_resource_info { /* Points to next resource in the chained list. */ - uint32_t nxt_resource_idx; - /* TBD: used for tfc stat resource for now */ - uint32_t reserve_flag; - union { - uint64_t resource_em_handle; - struct { - uint8_t resource_func_lower; - uint8_t resource_type; - uint8_t resource_sub_type; - uint8_t fdb_flags; - uint32_t resource_hndl; - }; - }; + uint32_t nxt_resource_idx; + uint8_t resource_func; + uint8_t resource_type; + uint8_t resource_sub_type; + uint8_t fdb_flags; + uint64_t resource_hndl; }; /* Structure for the flow database resource information. */ @@ -97,7 +89,6 @@ struct ulp_flow_db_res_params { uint8_t fdb_flags; uint8_t critical_resource; uint64_t resource_hndl; - uint32_t reserve_flag; }; /* diff --git a/drivers/net/bnxt/tf_ulp/ulp_mapper.c b/drivers/net/bnxt/tf_ulp/ulp_mapper.c index ff57469aa3..3034397166 100644 --- a/drivers/net/bnxt/tf_ulp/ulp_mapper.c +++ b/drivers/net/bnxt/tf_ulp/ulp_mapper.c @@ -585,7 +585,7 @@ ulp_mapper_fdb_opc_process(struct bnxt_ulp_mapper_parms *parms, case BNXT_ULP_FDB_OPC_PUSH_FID_SW_ONLY: push_fid = parms->flow_id; flow_type = parms->flow_type; - fid_parms->reserve_flag = 0x1; + fid_parms->fdb_flags = ULP_FDB_FLAG_SW_ONLY; break; default: return rc; /* Nothing to be done */ @@ -3804,6 +3804,11 @@ ulp_mapper_cond_reject_list_process(struct bnxt_ulp_mapper_parms *parms, /* get the reject condition list */ reject_info = ulp_mapper_tmpl_reject_list_get(parms, tid); + if (reject_info->cond_list_opcode == BNXT_ULP_COND_LIST_OPC_TRUE) { + cond_list_res = 1; + goto jump_exit; + } + /* If there are no reject conditions then skip */ if (!reject_info->cond_nums) return rc; diff --git a/drivers/net/bnxt/tf_ulp/ulp_mapper_tfc.c b/drivers/net/bnxt/tf_ulp/ulp_mapper_tfc.c index ed50117754..5cdac99b4b 100644 --- a/drivers/net/bnxt/tf_ulp/ulp_mapper_tfc.c +++ b/drivers/net/bnxt/tf_ulp/ulp_mapper_tfc.c @@ -1381,8 +1381,8 @@ ulp_mapper_tfc_cmm_entry_free(struct bnxt_ulp_context *ulp_ctx, uint16_t fw_fid = 0; int32_t rc = 0; - /* skip cmm processing if reserve flag is enabled */ - if (res->reserve_flag) + /* skip cmm processing if fdb flag is sw only */ + if (res->fdb_flags & ULP_FDB_FLAG_SW_ONLY) return 0; if (bnxt_ulp_cntxt_fid_get(ulp_ctx, &fw_fid)) { diff --git a/drivers/net/bnxt/tf_ulp/ulp_matcher.c b/drivers/net/bnxt/tf_ulp/ulp_matcher.c index 9615fc7919..9b951c0931 100644 --- a/drivers/net/bnxt/tf_ulp/ulp_matcher.c +++ b/drivers/net/bnxt/tf_ulp/ulp_matcher.c @@ -43,7 +43,7 @@ ulp_matcher_action_list_lookup(struct ulp_rte_parser_params *params, uint32_t idx = 0; while (++idx < BNXT_ULP_ACT_MATCH_LIST_MAX_SZ) { - /* iterate the list of class matches to find header match */ + /* iterate the list of action matches to find header match */ if ((act_bits & act_list[idx].act_bitmap.bits) == act_bits) { /* Found the match */ *act_tmpl_idx = act_list[idx].act_tid; @@ -111,7 +111,7 @@ ulp_matcher_class_hash_lookup(struct bnxt_ulp_matcher_data *matcher_data, int32_t idx; int32_t rc = -ENOENT; - /* popoulate the key for the search */ + /* populate the key for the search */ key.app_id = params->app_id; key.hdr_bitmap = params->hdr_bitmap; @@ -142,7 +142,7 @@ ulp_matcher_class_hash_add(struct bnxt_ulp_matcher_data *matcher_data, int32_t hash_idx; int32_t rc = -EINVAL; - /* popoulate the key for the search */ + /* populate the key for the search */ key.app_id = params->app_id; key.hdr_bitmap = params->hdr_bitmap; @@ -239,7 +239,7 @@ ulp_matcher_action_hash_lookup(struct bnxt_ulp_matcher_data *matcher_data, struct ulp_matcher_act_db_node *node; int32_t idx; - /* popoulate the key for the search */ + /* populate the key for the search */ key.act_bitmap = params->act_bitmap; /* search the hash table for the hdr bit match */ @@ -263,7 +263,7 @@ ulp_matcher_action_hash_add(struct bnxt_ulp_matcher_data *matcher_data, int32_t hash_idx; int32_t rc = -EINVAL; - /* popoulate the key for the search */ + /* populate the key for the search */ key.act_bitmap = params->act_bitmap; /* add to the hash table for the hdr bit match */ diff --git a/drivers/net/bnxt/tf_ulp/ulp_rte_parser.c b/drivers/net/bnxt/tf_ulp/ulp_rte_parser.c index 82197cde86..335cdcc130 100644 --- a/drivers/net/bnxt/tf_ulp/ulp_rte_parser.c +++ b/drivers/net/bnxt/tf_ulp/ulp_rte_parser.c @@ -106,7 +106,8 @@ ulp_rte_prsr_fld_mask(struct ulp_rte_parser_params *params, field->size = size; /* copy the mask specifications only if mask is not null */ - if (!(prsr_act & ULP_PRSR_ACT_MASK_IGNORE) && mask_buff) { + if (!(prsr_act & ULP_PRSR_ACT_MASK_IGNORE) && mask_buff && + spec_buff && ulp_bitmap_notzero(spec_buff, size)) { memcpy(field->mask, mask_buff, size); ulp_rte_parser_field_bitmap_update(params, *idx, prsr_act); } @@ -724,8 +725,13 @@ ulp_rte_eth_hdr_handler(const struct rte_flow_item *item, eth_type = eth_spec->hdr.ether_type; has_vlan = eth_spec->has_vlan; } + + /* If mask is not specified then use the default mask */ + if (eth_spec && !eth_mask) + eth_mask = &rte_flow_item_eth_mask; + if (eth_mask) { - eth_type &= eth_mask->hdr.ether_type; + eth_type &= eth_mask->type; has_vlan_mask = eth_mask->has_vlan; } @@ -808,11 +814,14 @@ ulp_rte_vlan_hdr_handler(const struct rte_flow_item *item, eth_type = vlan_spec->hdr.eth_proto; } + /* assign default vlan mask if spec is valid and mask is not */ + if (vlan_spec && !vlan_mask) + vlan_mask = &rte_flow_item_vlan_mask; + if (vlan_mask) { - vlan_tag_mask = ntohs(vlan_mask->hdr.vlan_tci); + vlan_tag_mask = ntohs(vlan_mask->tci); priority_mask = htons(vlan_tag_mask >> ULP_VLAN_PRIORITY_SHIFT); vlan_tag_mask &= 0xfff; - /* * the storage for priority and vlan tag is 2 bytes * The mask of priority which is 3 bits if it is all 1's @@ -1018,6 +1027,10 @@ ulp_rte_ipv4_hdr_handler(const struct rte_flow_item *item, return BNXT_TF_RC_ERROR; } + /* If mask is not specified then use the default mask */ + if (ipv4_spec && !ipv4_mask) + ipv4_mask = &rte_flow_item_ipv4_mask; + /* * Copy the rte_flow_item for ipv4 into hdr_field using ipv4 * header fields @@ -1166,6 +1179,10 @@ ulp_rte_ipv6_hdr_handler(const struct rte_flow_item *item, return BNXT_TF_RC_ERROR; } + /* If mask is not specified then use the default mask */ + if (ipv6_spec && !ipv6_mask) + ipv6_mask = &rte_flow_item_ipv6_mask; + /* * Copy the rte_flow_item for ipv6 into hdr_field using ipv6 * header fields @@ -1399,6 +1416,9 @@ ulp_rte_udp_hdr_handler(const struct rte_flow_item *item, sport = udp_spec->hdr.src_port; dport = udp_spec->hdr.dst_port; } + if (udp_spec && !udp_mask) + udp_mask = &rte_flow_item_udp_mask; + if (udp_mask) { sport_mask = udp_mask->hdr.src_port; dport_mask = udp_mask->hdr.dst_port; @@ -1475,6 +1495,10 @@ ulp_rte_tcp_hdr_handler(const struct rte_flow_item *item, sport = tcp_spec->hdr.src_port; dport = tcp_spec->hdr.dst_port; } + + if (tcp_spec && !tcp_mask) + tcp_mask = &rte_flow_item_tcp_mask; + if (tcp_mask) { sport_mask = tcp_mask->hdr.src_port; dport_mask = tcp_mask->hdr.dst_port; @@ -1574,6 +1598,8 @@ ulp_rte_vxlan_hdr_handler(const struct rte_flow_item *item, return BNXT_TF_RC_ERROR; } + if (vxlan_spec && !vxlan_mask) + vxlan_mask = &rte_flow_item_vxlan_mask; /* * Copy the rte_flow_item for vxlan into hdr_field using vxlan * header fields @@ -1646,6 +1672,8 @@ ulp_rte_vxlan_gpe_hdr_handler(const struct rte_flow_item *item, return BNXT_TF_RC_ERROR; } + if (vxlan_gpe_spec && !vxlan_gpe_mask) + vxlan_gpe_mask = &rte_flow_item_vxlan_gpe_mask; /* * Copy the rte_flow_item for vxlan gpe into hdr_field using vxlan * header fields @@ -1724,6 +1752,9 @@ ulp_rte_geneve_hdr_handler(const struct rte_flow_item *item, return BNXT_TF_RC_ERROR; } + if (geneve_spec && !geneve_mask) + geneve_mask = &rte_flow_item_geneve_mask; + /* * Copy the rte_flow_item for geneve into hdr_field using geneve * header fields @@ -1784,6 +1815,9 @@ ulp_rte_gre_hdr_handler(const struct rte_flow_item *item, return BNXT_TF_RC_ERROR; } + if (gre_spec && !gre_mask) + gre_mask = &rte_flow_item_gre_mask; + size = sizeof(((struct rte_flow_item_gre *)NULL)->c_rsvd0_ver); ulp_rte_prsr_fld_mask(params, &idx, size, ulp_deference_struct(gre_spec, c_rsvd0_ver), @@ -1827,6 +1861,9 @@ ulp_rte_icmp_hdr_handler(const struct rte_flow_item *item, return BNXT_TF_RC_ERROR; } + if (icmp_spec && !icmp_mask) + icmp_mask = &rte_flow_item_icmp_mask; + size = sizeof(((struct rte_flow_item_icmp *)NULL)->hdr.icmp_type); ulp_rte_prsr_fld_mask(params, &idx, size, ulp_deference_struct(icmp_spec, hdr.icmp_type), @@ -1882,6 +1919,9 @@ ulp_rte_icmp6_hdr_handler(const struct rte_flow_item *item, return BNXT_TF_RC_ERROR; } + if (icmp_spec && !icmp_mask) + icmp_mask = &rte_flow_item_icmp6_mask; + size = sizeof(((struct rte_flow_item_icmp6 *)NULL)->type); ulp_rte_prsr_fld_mask(params, &idx, size, ulp_deference_struct(icmp_spec, type), @@ -1933,6 +1973,9 @@ ulp_rte_ecpri_hdr_handler(const struct rte_flow_item *item, return BNXT_TF_RC_ERROR; } + if (ecpri_spec && !ecpri_mask) + ecpri_mask = &rte_flow_item_ecpri_mask; + /* Figure out if eCPRI is within L4(UDP), unsupported, for now */ cnt = ULP_COMP_FLD_IDX_RD(params, BNXT_ULP_CF_IDX_L4_HDR_CNT); if (cnt >= 1) { @@ -2652,6 +2695,19 @@ ulp_rte_parser_act_port_set(struct ulp_rte_parser_params *param, BNXT_ULP_CF_IDX_MP_VPORT_B : BNXT_ULP_CF_IDX_MP_VPORT_A, pid_s); + + /* Setup the VF_TO_VF VNIC information */ + if (!multi_port && port_type == BNXT_ULP_INTF_TYPE_VF_REP) { + if (ulp_port_db_default_vnic_get(param->ulp_ctx, + ifindex, + BNXT_ULP_VF_FUNC_VNIC, + &pid_s)) + return BNXT_TF_RC_ERROR; + pid = pid_s; + + /* Allows use of func_opcode with VNIC */ + ULP_COMP_FLD_IDX_WR(param, BNXT_ULP_CF_IDX_VNIC, pid); + } } else { /* For ingress direction, fill vnic */ /* -- 2.39.3