From patchwork Wed Jun 10 11:44:05 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Somnath Kotur X-Patchwork-Id: 71150 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 91DA1A051A; Wed, 10 Jun 2020 13:51:28 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id D4B711BEC7; Wed, 10 Jun 2020 13:49:16 +0200 (CEST) Received: from relay.smtp.broadcom.com (unknown [192.19.232.149]) by dpdk.org (Postfix) with ESMTP id ADC411BEB0 for ; Wed, 10 Jun 2020 13:49:13 +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 0E9B01BD53A; Wed, 10 Jun 2020 04:49:12 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.10.3 relay.smtp.broadcom.com 0E9B01BD53A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=broadcom.com; s=dkimrelay; t=1591789753; bh=maXl4C1PihR7XThttsWzGJj1kQdUUBUEUZ4PKHE/wTM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SfkA5VVE+vSTpAo2/ZXYGm5F3G28n4xYLSr0SzI0npAvZoTDQ1X5+bmrGGWd/BzWd WyFWONdnqr3Np1UjryYYlbxLqld+0LOEJq22fvIOUVKIFIo2hSFZInb12u/kXtOe7m V6xRv6rmNVLfpydzc57Z14ZZNh8msgTVd1G3CrRE= From: Somnath Kotur To: dev@dpdk.org Cc: ferruh.yigit@intel.com Date: Wed, 10 Jun 2020 17:14:05 +0530 Message-Id: <20200610114427.22146-15-somnath.kotur@broadcom.com> X-Mailer: git-send-email 2.10.1.613.g2cc2e70 In-Reply-To: <20200610114427.22146-1-somnath.kotur@broadcom.com> References: <20200610114427.22146-1-somnath.kotur@broadcom.com> Subject: [dpdk-dev] [PATCH 14/36] net/bnxt: add support for action bitmap opcode in result field processing 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 This enables using the action bitmap to update the action result fields in the flow creation instead of using computed header fields. An example would be the usage of the vlan pop action bitmap that is used to updated action result field as part of this commit. Signed-off-by: Kishore Padmanabha Reviewed-by: Michael Baucom Signed-off-by: Somnath Kotur --- drivers/net/bnxt/tf_ulp/ulp_mapper.c | 20 ++++++++++++++++++++ drivers/net/bnxt/tf_ulp/ulp_template_db.c | 14 +++++++++++--- drivers/net/bnxt/tf_ulp/ulp_template_db.h | 11 ++++++----- 3 files changed, 37 insertions(+), 8 deletions(-) diff --git a/drivers/net/bnxt/tf_ulp/ulp_mapper.c b/drivers/net/bnxt/tf_ulp/ulp_mapper.c index 40c515d..a0b77c0 100644 --- a/drivers/net/bnxt/tf_ulp/ulp_mapper.c +++ b/drivers/net/bnxt/tf_ulp/ulp_mapper.c @@ -611,6 +611,8 @@ ulp_mapper_result_field_process(struct bnxt_ulp_mapper_parms *parms, uint8_t *val = NULL; uint64_t regval; uint32_t val_size = 0, field_size = 0; + uint64_t act_bit; + uint8_t act_val; switch (fld->result_opcode) { case BNXT_ULP_RESULT_OPC_SET_TO_CONSTANT: @@ -644,6 +646,24 @@ ulp_mapper_result_field_process(struct bnxt_ulp_mapper_parms *parms, return -EINVAL; } break; + case BNXT_ULP_RESULT_OPC_SET_TO_ACT_BIT: + if (!ulp_operand_read(fld->result_operand, + (uint8_t *)&act_bit, sizeof(uint64_t))) { + BNXT_TF_DBG(ERR, "%s operand read failed\n", name); + return -EINVAL; + } + act_bit = tfp_be_to_cpu_64(act_bit); + act_val = ULP_BITMAP_ISSET(parms->act_bitmap->bits, act_bit); + if (fld->field_bit_size > ULP_BYTE_2_BITS(sizeof(act_val))) { + BNXT_TF_DBG(ERR, "%s field size is incorrect\n", name); + return -EINVAL; + } + if (!ulp_blob_push(blob, &act_val, fld->field_bit_size)) { + BNXT_TF_DBG(ERR, "%s push field failed\n", name); + return -EINVAL; + } + val = &act_val; + break; case BNXT_ULP_RESULT_OPC_SET_TO_ENCAP_ACT_PROP_SZ: if (!ulp_operand_read(fld->result_operand, (uint8_t *)&idx, sizeof(uint16_t))) { diff --git a/drivers/net/bnxt/tf_ulp/ulp_template_db.c b/drivers/net/bnxt/tf_ulp/ulp_template_db.c index 013bc13..cb5e325 100644 --- a/drivers/net/bnxt/tf_ulp/ulp_template_db.c +++ b/drivers/net/bnxt/tf_ulp/ulp_template_db.c @@ -1774,9 +1774,17 @@ struct bnxt_ulp_mapper_result_field_info ulp_act_result_field_list[] = { }, { .field_bit_size = 1, - .result_opcode = BNXT_ULP_RESULT_OPC_SET_TO_CONSTANT, - .result_operand = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} + .result_opcode = BNXT_ULP_RESULT_OPC_SET_TO_ACT_BIT, + .result_operand = { + ((uint64_t)BNXT_ULP_ACTION_BIT_POP_VLAN >> 56) & 0xff, + ((uint64_t)BNXT_ULP_ACTION_BIT_POP_VLAN >> 48) & 0xff, + ((uint64_t)BNXT_ULP_ACTION_BIT_POP_VLAN >> 40) & 0xff, + ((uint64_t)BNXT_ULP_ACTION_BIT_POP_VLAN >> 32) & 0xff, + ((uint64_t)BNXT_ULP_ACTION_BIT_POP_VLAN >> 24) & 0xff, + ((uint64_t)BNXT_ULP_ACTION_BIT_POP_VLAN >> 16) & 0xff, + ((uint64_t)BNXT_ULP_ACTION_BIT_POP_VLAN >> 8) & 0xff, + (uint64_t)BNXT_ULP_ACTION_BIT_POP_VLAN & 0xff, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} }, { .field_bit_size = 2, diff --git a/drivers/net/bnxt/tf_ulp/ulp_template_db.h b/drivers/net/bnxt/tf_ulp/ulp_template_db.h index 8554a03..6935072 100644 --- a/drivers/net/bnxt/tf_ulp/ulp_template_db.h +++ b/drivers/net/bnxt/tf_ulp/ulp_template_db.h @@ -211,11 +211,12 @@ enum bnxt_ulp_regfile_index { enum bnxt_ulp_result_opc { BNXT_ULP_RESULT_OPC_SET_TO_CONSTANT = 0, BNXT_ULP_RESULT_OPC_SET_TO_ACT_PROP = 1, - BNXT_ULP_RESULT_OPC_SET_TO_ENCAP_ACT_PROP_SZ = 2, - BNXT_ULP_RESULT_OPC_SET_TO_REGFILE = 3, - BNXT_ULP_RESULT_OPC_SET_TO_GLB_REGFILE = 4, - BNXT_ULP_RESULT_OPC_SET_TO_COMP_FIELD = 5, - BNXT_ULP_RESULT_OPC_LAST = 6 + BNXT_ULP_RESULT_OPC_SET_TO_ACT_BIT = 2, + BNXT_ULP_RESULT_OPC_SET_TO_ENCAP_ACT_PROP_SZ = 3, + BNXT_ULP_RESULT_OPC_SET_TO_REGFILE = 4, + BNXT_ULP_RESULT_OPC_SET_TO_GLB_REGFILE = 5, + BNXT_ULP_RESULT_OPC_SET_TO_COMP_FIELD = 6, + BNXT_ULP_RESULT_OPC_LAST = 7 }; enum bnxt_ulp_search_before_alloc {