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 55BB845C9F; Thu, 7 Nov 2024 14:44:21 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 34F7442F5B; Thu, 7 Nov 2024 14:43:47 +0100 (CET) Received: from mail-pl1-f179.google.com (mail-pl1-f179.google.com [209.85.214.179]) by mails.dpdk.org (Postfix) with ESMTP id 5BD2842F73 for ; Thu, 7 Nov 2024 14:43:45 +0100 (CET) Received: by mail-pl1-f179.google.com with SMTP id d9443c01a7336-20ca1b6a80aso11081325ad.2 for ; Thu, 07 Nov 2024 05:43:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1730987024; x=1731591824; 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=vITqe0sczdj7vW0yEQxgx2KXpRT+BctIcRhUZB9ovFs=; b=VdtxH5Rng42LrFr08jxQYK0csK6jK+3Xuk079OI8qUWNCWtCahxsdhjEsOjX3Lvd17 xAGNO342Sy3qgQyP9Fz0evmBssiYKjLGBwIwWeLiC/wlM6KOwsExegWeZsoH/WC3haCY 6yReOqHGSTdMVJpCnPRiNOJehzVIETJItLQL8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730987024; x=1731591824; 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=vITqe0sczdj7vW0yEQxgx2KXpRT+BctIcRhUZB9ovFs=; b=jVdjgDwMN3ZkHTgcGcvYgMizUyfUtKH7DZAwaK8D77JGMG1mwxkWc9WYZEC3CsqCH1 A34gVMmkTqbJ95BvdHXQC5hTUZzm+SHYcrIuXrlEL3gFq6wwqG6AEcae91OXHnr/VAm6 JzjbCYz7SDyHXO+oUMz71EwOl5kIqE7Nw4zEmVhCs2jY+44g2YnQrDOvftlgkEjU8WSV bOhysHZ1mOPwiqrAbYeIwB9Hw60YJbjQ+dOZsPhikTtw3i1QD4mGREeF43QgIJdHltTG kiOglxHPmfk9YLfoGLFp/oao2zzx5bn/wR+P1N2DWY/BSfGiXyNrHRrn8HK6zQzbizg4 NrSQ== X-Gm-Message-State: AOJu0YxKeXp/fz3iyJ9ctyahQ1rb1sduxNTAlzoBvkeVbPtfssQ+QNrN Xi5vX0KLrsUrt1ZHpbJrnOWC5bmRmxmDeJN5fnmVR4dsLZGRIbd7vBcfvkn4pSZFTQ9kKPFKwFI 7xVrZrIBJ5ZcTpJdXl9LQdUntBLj5OU1VQ4yQWt3VaaJM5l4xG88GIONs2dLJu/QE+eYUfkX8gz 7GG30cGIfhl6VsN4ZnAnKZzTeeaY0DG5qSQATvE3iACQ== X-Google-Smtp-Source: AGHT+IGD2BEyqM0/ivdvxr5sEMzsuKWGZXV+hzXfFi1Gz1QbDwVII+pHR9FVWISyxOzCpICivJDzUQ== X-Received: by 2002:a17:90b:548d:b0:2e2:b719:d581 with SMTP id 98e67ed59e1d1-2e94c295017mr32950607a91.5.1730987022326; Thu, 07 Nov 2024 05:43:42 -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.43.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Nov 2024 05:43:41 -0800 (PST) From: Sriharsha Basavapatna To: dev@dpdk.org Cc: Manish Kurup , Sriharsha Basavapatna , Kishore Padmanabha , Ajit Khaparde Subject: [PATCH v8 15/47] net/bnxt: tf_ulp: Wh+ mirroring support Date: Thu, 7 Nov 2024 19:22:22 +0530 Message-Id: <20241107135254.1611676-16-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: Manish Kurup 1. ULP fixes to enable primitives to support mirroring 2. RTE parser changes to support and use multiple ports in RTE input msgs 3. Template changes required to support ingress mirroring 4. Template changes required to support egress mirroring (using VFR pipeline) Signed-off-by: Manish Kurup Signed-off-by: Sriharsha Basavapatna Reviewed-by: Kishore Padmanabha Reviewed-by: Ajit Khaparde --- drivers/net/bnxt/tf_ulp/ulp_mapper.c | 8 + drivers/net/bnxt/tf_ulp/ulp_rte_parser.c | 179 ++++++++++++++++++++--- 2 files changed, 167 insertions(+), 20 deletions(-) diff --git a/drivers/net/bnxt/tf_ulp/ulp_mapper.c b/drivers/net/bnxt/tf_ulp/ulp_mapper.c index 9dda70d75b..eb0f95cfee 100644 --- a/drivers/net/bnxt/tf_ulp/ulp_mapper.c +++ b/drivers/net/bnxt/tf_ulp/ulp_mapper.c @@ -3789,6 +3789,8 @@ ulp_mapper_func_info_process(struct bnxt_ulp_mapper_parms *parms, case BNXT_ULP_FUNC_OPC_GT: case BNXT_ULP_FUNC_OPC_LE: case BNXT_ULP_FUNC_OPC_LT: + case BNXT_ULP_FUNC_OPC_ADD: + case BNXT_ULP_FUNC_OPC_SUB: process_src1 = 1; process_src2 = 1; break; @@ -3841,6 +3843,12 @@ ulp_mapper_func_info_process(struct bnxt_ulp_mapper_parms *parms, if (res1 < res2) res = 1; break; + case BNXT_ULP_FUNC_OPC_ADD: + res = res1 + res2; + break; + case BNXT_ULP_FUNC_OPC_SUB: + res = res1 - res2; + break; case BNXT_ULP_FUNC_OPC_COPY_SRC1_TO_RF: res = res1; break; diff --git a/drivers/net/bnxt/tf_ulp/ulp_rte_parser.c b/drivers/net/bnxt/tf_ulp/ulp_rte_parser.c index 013d8b0a59..da20b41c72 100644 --- a/drivers/net/bnxt/tf_ulp/ulp_rte_parser.c +++ b/drivers/net/bnxt/tf_ulp/ulp_rte_parser.c @@ -330,9 +330,21 @@ ulp_post_process_normal_flow(struct ulp_rte_parser_params *params) /* Evaluate the VF to VF flag */ if (act_port_set && act_port_type == BNXT_ULP_INTF_TYPE_VF_REP && - match_port_type == BNXT_ULP_INTF_TYPE_VF_REP) - ULP_BITMAP_SET(params->act_bitmap.bits, - BNXT_ULP_ACT_BIT_VF_TO_VF); + match_port_type == BNXT_ULP_INTF_TYPE_VF_REP) { + if (!ULP_BITMAP_ISSET(params->act_bitmap.bits, + BNXT_ULP_ACT_BIT_MULTIPLE_PORT)) { + ULP_BITMAP_SET(params->act_bitmap.bits, + BNXT_ULP_ACT_BIT_VF_TO_VF); + } else { + if (ULP_COMP_FLD_IDX_RD(params, BNXT_ULP_CF_IDX_MP_A_IS_VFREP) && + ULP_COMP_FLD_IDX_RD(params, BNXT_ULP_CF_IDX_MP_B_IS_VFREP)) + ULP_BITMAP_SET(params->act_bitmap.bits, + BNXT_ULP_ACT_BIT_VF_TO_VF); + else + ULP_BITMAP_RESET(params->act_bitmap.bits, + BNXT_ULP_ACT_BIT_VF_TO_VF); + } + } /* Update the decrement ttl computational fields */ if (ULP_BITMAP_ISSET(params->act_bitmap.bits, @@ -2349,15 +2361,74 @@ ulp_rte_count_act_handler(const struct rte_flow_action *action_item, return BNXT_TF_RC_SUCCESS; } +static bool ulp_rte_parser_is_portb_vfrep(struct ulp_rte_parser_params *param) +{ + return ULP_COMP_FLD_IDX_RD(param, BNXT_ULP_CF_IDX_MP_B_IS_VFREP); +} + +/* + * Swaps info related to multi-port: + * common: + * BNXT_ULP_CF_IDX_MP_B_IS_VFREP, BNXT_ULP_CF_IDX_MP_A_IS_VFREP + * BNXT_ULP_CF_IDX_MP_PORT_A, BNXT_ULP_CF_IDX_MP_PORT_B + * + * ingress: + * BNXT_ULP_CF_IDX_MP_VNIC_B, BNXT_ULP_CF_IDX_MP_VNIC_A + * + * egress: + * BNXT_ULP_CF_IDX_MP_MDATA_B, BNXT_ULP_CF_IDX_MP_MDATA_A + * BNXT_ULP_CF_IDX_MP_VPORT_B, BNXT_ULP_CF_IDX_MP_VPORT_A + * + * Note: This is done as OVS could give us a non-VFREP port in port B, and we + * cannot use that to mirror, so we swap out the ports so that a VFREP is now + * in port B instead. + */ +static int32_t +ulp_rte_parser_normalize_port_info(struct ulp_rte_parser_params *param) +{ + uint16_t mp_port_a, mp_port_b, mp_mdata_a, mp_mdata_b, + mp_vport_a, mp_vport_b, mp_vnic_a, mp_vnic_b, + mp_is_vfrep_a, mp_is_vfrep_b; + + mp_is_vfrep_a = ULP_COMP_FLD_IDX_RD(param, BNXT_ULP_CF_IDX_MP_A_IS_VFREP); + mp_is_vfrep_b = ULP_COMP_FLD_IDX_RD(param, BNXT_ULP_CF_IDX_MP_B_IS_VFREP); + ULP_COMP_FLD_IDX_WR(param, BNXT_ULP_CF_IDX_MP_B_IS_VFREP, mp_is_vfrep_a); + ULP_COMP_FLD_IDX_WR(param, BNXT_ULP_CF_IDX_MP_A_IS_VFREP, mp_is_vfrep_b); + + mp_port_a = ULP_COMP_FLD_IDX_RD(param, BNXT_ULP_CF_IDX_MP_PORT_A); + mp_port_b = ULP_COMP_FLD_IDX_RD(param, BNXT_ULP_CF_IDX_MP_PORT_B); + ULP_COMP_FLD_IDX_WR(param, BNXT_ULP_CF_IDX_MP_PORT_B, mp_port_a); + ULP_COMP_FLD_IDX_WR(param, BNXT_ULP_CF_IDX_MP_PORT_A, mp_port_b); + + mp_vport_a = ULP_COMP_FLD_IDX_RD(param, BNXT_ULP_CF_IDX_MP_VPORT_A); + mp_vport_b = ULP_COMP_FLD_IDX_RD(param, BNXT_ULP_CF_IDX_MP_VPORT_B); + ULP_COMP_FLD_IDX_WR(param, BNXT_ULP_CF_IDX_MP_VPORT_B, mp_vport_a); + ULP_COMP_FLD_IDX_WR(param, BNXT_ULP_CF_IDX_MP_VPORT_A, mp_vport_b); + + mp_vnic_a = ULP_COMP_FLD_IDX_RD(param, BNXT_ULP_CF_IDX_MP_VNIC_A); + mp_vnic_b = ULP_COMP_FLD_IDX_RD(param, BNXT_ULP_CF_IDX_MP_VNIC_B); + ULP_COMP_FLD_IDX_WR(param, BNXT_ULP_CF_IDX_MP_VNIC_B, mp_vnic_a); + ULP_COMP_FLD_IDX_WR(param, BNXT_ULP_CF_IDX_MP_VNIC_A, mp_vnic_b); + + mp_mdata_a = ULP_COMP_FLD_IDX_RD(param, BNXT_ULP_CF_IDX_MP_MDATA_A); + mp_mdata_b = ULP_COMP_FLD_IDX_RD(param, BNXT_ULP_CF_IDX_MP_MDATA_B); + ULP_COMP_FLD_IDX_WR(param, BNXT_ULP_CF_IDX_MP_MDATA_B, mp_mdata_a); + ULP_COMP_FLD_IDX_WR(param, BNXT_ULP_CF_IDX_MP_MDATA_A, mp_mdata_b); + + return BNXT_TF_RC_SUCCESS; +} + + /* Function to handle the parsing of action ports. */ static int32_t ulp_rte_parser_act_port_set(struct ulp_rte_parser_params *param, - uint32_t ifindex, + uint32_t ifindex, bool multi_port, enum bnxt_ulp_direction_type act_dir) { enum bnxt_ulp_direction_type dir; uint16_t pid_s; - uint32_t pid; + uint8_t *p_mdata; + uint32_t pid, port_index; struct ulp_rte_act_prop *act = ¶m->act_prop; enum bnxt_ulp_intf_type port_type; uint32_t vnic_type; @@ -2367,27 +2438,63 @@ ulp_rte_parser_act_port_set(struct ulp_rte_parser_params *param, dir = (act_dir == BNXT_ULP_DIR_INVALID) ? ULP_COMP_FLD_IDX_RD(param, BNXT_ULP_CF_IDX_DIRECTION) : act_dir; - port_type = ULP_COMP_FLD_IDX_RD(param, BNXT_ULP_CF_IDX_ACT_PORT_TYPE); - if (dir == BNXT_ULP_DIR_EGRESS && - port_type != BNXT_ULP_INTF_TYPE_VF_REP) { + + port_type = ULP_COMP_FLD_IDX_RD(param, + BNXT_ULP_CF_IDX_ACT_PORT_TYPE); + + /* Update flag if Port A/B type is VF-REP */ + ULP_COMP_FLD_IDX_WR(param, multi_port ? + BNXT_ULP_CF_IDX_MP_B_IS_VFREP : + BNXT_ULP_CF_IDX_MP_A_IS_VFREP, + (port_type == BNXT_ULP_INTF_TYPE_VF_REP) ? 1 : 0); + if (dir == BNXT_ULP_DIR_EGRESS) { /* For egress direction, fill vport */ if (ulp_port_db_vport_get(param->ulp_ctx, ifindex, &pid_s)) return BNXT_TF_RC_ERROR; pid = pid_s; pid = rte_cpu_to_be_32(pid); - memcpy(&act->act_details[BNXT_ULP_ACT_PROP_IDX_VPORT], - &pid, BNXT_ULP_ACT_PROP_SZ_VPORT); + if (!multi_port) + memcpy(&act->act_details[BNXT_ULP_ACT_PROP_IDX_VPORT], + &pid, BNXT_ULP_ACT_PROP_SZ_VPORT); + + /* Fill metadata */ + if (port_type == BNXT_ULP_INTF_TYPE_VF_REP) { + port_index = ULP_COMP_FLD_IDX_RD(param, multi_port ? + BNXT_ULP_CF_IDX_MP_PORT_B : + BNXT_ULP_CF_IDX_MP_PORT_A); + if (ulp_port_db_port_meta_data_get(param->ulp_ctx, + port_index, &p_mdata)) + return BNXT_TF_RC_ERROR; + /* + * Update appropriate port (A/B) metadata based on multi-port + * indication + */ + ULP_COMP_FLD_IDX_WR(param, + multi_port ? + BNXT_ULP_CF_IDX_MP_MDATA_B : + BNXT_ULP_CF_IDX_MP_MDATA_A, + rte_cpu_to_be_16(*((uint16_t *)p_mdata))); + } + /* + * Update appropriate port (A/B) VPORT based on multi-port + * indication. + */ + ULP_COMP_FLD_IDX_WR(param, + multi_port ? + BNXT_ULP_CF_IDX_MP_VPORT_B : + BNXT_ULP_CF_IDX_MP_VPORT_A, + pid_s); } else { /* For ingress direction, fill vnic */ /* - * Action Destination + * Action Destination * ------------------------------------ - * PORT_REPRESENTOR Driver Function + * PORT_REPRESENTOR Driver Function * ------------------------------------ - * REPRESENTED_PORT VF + * REPRESENTED_PORT VF * ------------------------------------ - * PORT_ID VF + * PORT_ID VF */ if (act_dir != BNXT_ULP_DIR_INGRESS && port_type == BNXT_ULP_INTF_TYPE_VF_REP) @@ -2401,10 +2508,23 @@ ulp_rte_parser_act_port_set(struct ulp_rte_parser_params *param, pid = pid_s; pid = rte_cpu_to_be_32(pid); - memcpy(&act->act_details[BNXT_ULP_ACT_PROP_IDX_VNIC], - &pid, BNXT_ULP_ACT_PROP_SZ_VNIC); + if (!multi_port) + memcpy(&act->act_details[BNXT_ULP_ACT_PROP_IDX_VNIC], + &pid, BNXT_ULP_ACT_PROP_SZ_VNIC); + /* + * Update appropriate port (A/B) VNIC based on multi-port + * indication. + */ + ULP_COMP_FLD_IDX_WR(param, + multi_port ? + BNXT_ULP_CF_IDX_MP_VNIC_B : + BNXT_ULP_CF_IDX_MP_VNIC_A, + pid_s); } + if (multi_port && !ulp_rte_parser_is_portb_vfrep(param)) + ulp_rte_parser_normalize_port_info(param); + /* Update the action port set bit */ ULP_COMP_FLD_IDX_WR(param, BNXT_ULP_CF_IDX_ACT_PORT_IS_SET, 1); return BNXT_TF_RC_SUCCESS; @@ -2437,7 +2557,7 @@ ulp_rte_pf_act_handler(const struct rte_flow_action *action_item __rte_unused, } /* Update the action properties */ ULP_COMP_FLD_IDX_WR(params, BNXT_ULP_CF_IDX_ACT_PORT_TYPE, intf_type); - return ulp_rte_parser_act_port_set(params, ifindex, + return ulp_rte_parser_act_port_set(params, ifindex, false, BNXT_ULP_DIR_INVALID); } @@ -2489,7 +2609,7 @@ ulp_rte_vf_act_handler(const struct rte_flow_action *action_item, /* Update the action properties */ ULP_COMP_FLD_IDX_WR(params, BNXT_ULP_CF_IDX_ACT_PORT_TYPE, intf_type); - return ulp_rte_parser_act_port_set(params, ifindex, + return ulp_rte_parser_act_port_set(params, ifindex, false, BNXT_ULP_DIR_INVALID); } @@ -2500,12 +2620,14 @@ ulp_rte_port_act_handler(const struct rte_flow_action *act_item, { uint32_t ethdev_id; uint32_t ifindex; + const struct rte_flow_action_port_id *port_id = act_item->conf; + uint32_t num_ports; enum bnxt_ulp_intf_type intf_type; enum bnxt_ulp_direction_type act_dir; if (!act_item->conf) { BNXT_TF_DBG(ERR, - "ParseErr: Invalid Argument\n"); + "ParseErr: Invalid Argument\n"); return BNXT_TF_RC_PARSE_ERR; } switch (act_item->type) { @@ -2540,6 +2662,18 @@ ulp_rte_port_act_handler(const struct rte_flow_action *act_item, return BNXT_TF_RC_ERROR; } + num_ports = ULP_COMP_FLD_IDX_RD(param, BNXT_ULP_CF_IDX_MP_NPORTS); + + if (num_ports) { + ULP_COMP_FLD_IDX_WR(param, BNXT_ULP_CF_IDX_MP_PORT_B, + port_id->id); + ULP_BITMAP_SET(param->act_bitmap.bits, + BNXT_ULP_ACT_BIT_MULTIPLE_PORT); + } else { + ULP_COMP_FLD_IDX_WR(param, BNXT_ULP_CF_IDX_MP_PORT_A, + port_id->id); + } + /* Get the port db ifindex */ if (ulp_port_db_dev_port_to_ulp_index(param->ulp_ctx, ethdev_id, &ifindex)) { @@ -2558,7 +2692,12 @@ ulp_rte_port_act_handler(const struct rte_flow_action *act_item, ULP_COMP_FLD_IDX_WR(param, BNXT_ULP_CF_IDX_ACT_PORT_TYPE, intf_type); ULP_COMP_FLD_IDX_WR(param, BNXT_ULP_CF_IDX_DEV_ACT_PORT_ID, ethdev_id); - return ulp_rte_parser_act_port_set(param, ifindex, act_dir); + + ULP_COMP_FLD_IDX_WR(param, BNXT_ULP_CF_IDX_MP_NPORTS, ++num_ports); + return ulp_rte_parser_act_port_set(param, ifindex, + ULP_BITMAP_ISSET(param->act_bitmap.bits, + BNXT_ULP_ACT_BIT_MULTIPLE_PORT), + act_dir); } /* Function to handle the parsing of RTE Flow action pop vlan. */ -- 2.39.3