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 20BA945C9A; Thu, 7 Nov 2024 14:44:06 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 9BFEA42F15; Thu, 7 Nov 2024 14:43:40 +0100 (CET) Received: from mail-pj1-f47.google.com (mail-pj1-f47.google.com [209.85.216.47]) by mails.dpdk.org (Postfix) with ESMTP id F23C542F15 for ; Thu, 7 Nov 2024 14:43:37 +0100 (CET) Received: by mail-pj1-f47.google.com with SMTP id 98e67ed59e1d1-2e2e87153a3so698113a91.3 for ; Thu, 07 Nov 2024 05:43:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1730987017; x=1731591817; 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=0YeyqQN5wy3JktkoW4aCa0Gnw4xxwHJl6Fs8NY7MqgI=; b=B8Qa9AOWL9fd+a4ZwsY0vKN29RVRbC9E3sVFg+jvR4ziSBiAg3uXXlSD9uGog+Bmvi Tf9I7ezfaXGL0/xouW1wAEqZf/xShdfBx4i6aB22oHr5AZHikkGSdyND3YH31TOMj1Kn PbWg77gP/sx8Y8/asoj33bXvOUst9vod/k8rU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730987017; x=1731591817; 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=0YeyqQN5wy3JktkoW4aCa0Gnw4xxwHJl6Fs8NY7MqgI=; b=hizB1xVhSbQOY306oL2IDMNwuy6OdRwPJYCtAPTTCpzKoaL3mv4xgg8nsG72yPU7rr N1dffUCgA3UmMWhMw+iW+kTyeH+tfVL6hGoAS55eIsJrCyVUBcG2AO1XoE7SL3URLiv5 cWVzyNXltGPOf41hOvjnZtf7ac3Dr4IKrgU9pUpNR1ttIFQmWM7oamd1qvGfGJvoAdbq G02Ze7bLL7gxPwe1E4ZupeR0n3lXodmj4oEt7iENO+OTTxcw2QCaKUtpqkBgt4l4wnYv +kpIJNRFoZNxUtoreyKy9YT5muHF9HgTX66QN4sq2wNN4xOjyK54yx0RV12Zkx39Az4t H2kw== X-Gm-Message-State: AOJu0YzHtB4QHw4YUuM9pryrcvFUDsWQqd9zH6eGehQMGMHZL6CgC2IH dtztxnc+7ZfTSWyvwmiRquZR8AwbQSQw7HU3H0Z681N9BGj8mk3+6fjM+0hoaLawaBgwrMgPQYP bbS/BLMSFPoeraa91yUU66CapfRXyKAfCLq8vgYDXl71hc8ezodol8LJYRBmWwrh75+7ZwbtBVU OChzlwBSWdoAAdQCv084vt4TIPURD9p90Da8o2sbDnrg== X-Google-Smtp-Source: AGHT+IHVBfCtK+oFbiWus/78o2nyHOOJVyzn06104MzHfgkwmZoXMifF5/Q3ASTn2XX+A2PYynmrXw== X-Received: by 2002:a17:90b:224c:b0:2e2:da8d:2098 with SMTP id 98e67ed59e1d1-2e94c294fcemr32733125a91.2.1730987016397; Thu, 07 Nov 2024 05:43:36 -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.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Nov 2024 05:43:35 -0800 (PST) From: Sriharsha Basavapatna To: dev@dpdk.org Cc: Shahaji Bhosle , Sriharsha Basavapatna , Kishore Padmanabha , Ajit Khaparde Subject: [PATCH v8 13/47] net/bnxt: tf_ulp: add custom l2 etype tunnel support Date: Thu, 7 Nov 2024 19:22:20 +0530 Message-Id: <20241107135254.1611676-14-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: Shahaji Bhosle Add hooks in the hwrm and ulp layer to enable, custom tunnel header support on wh+ generic app(ovs). Signed-off-by: Shahaji Bhosle Signed-off-by: Sriharsha Basavapatna Reviewed-by: Kishore Padmanabha Reviewed-by: Ajit Khaparde --- drivers/net/bnxt/bnxt.h | 4 +++ drivers/net/bnxt/bnxt_hwrm.c | 18 ++++++++++ drivers/net/bnxt/tf_ulp/bnxt_ulp.c | 54 ++++++++++++++++++++++++++++++ drivers/net/bnxt/tf_ulp/bnxt_ulp.h | 3 ++ 4 files changed, 79 insertions(+) diff --git a/drivers/net/bnxt/bnxt.h b/drivers/net/bnxt/bnxt.h index ce10167e1f..b50ae71c1f 100644 --- a/drivers/net/bnxt/bnxt.h +++ b/drivers/net/bnxt/bnxt.h @@ -989,13 +989,17 @@ struct bnxt { uint8_t vxlan_port_cnt; uint8_t geneve_port_cnt; uint8_t ecpri_port_cnt; + uint8_t l2_etype_tunnel_cnt; uint16_t vxlan_port; uint16_t geneve_port; uint16_t ecpri_port; uint16_t vxlan_fw_dst_port_id; uint16_t geneve_fw_dst_port_id; uint16_t ecpri_fw_dst_port_id; +#define BNXT_L2_ETYPE_TUNNEL_ID 0xFFFF /* CUSTOM L2 ENCAP - VF representors */ + uint16_t l2_etype_tunnel_id; uint16_t ecpri_upar_in_use; + uint8_t l2_etype_upar_in_use; uint32_t fw_ver; uint32_t hwrm_spec_code; diff --git a/drivers/net/bnxt/bnxt_hwrm.c b/drivers/net/bnxt/bnxt_hwrm.c index 97ea32b286..c102e2cdb3 100644 --- a/drivers/net/bnxt/bnxt_hwrm.c +++ b/drivers/net/bnxt/bnxt_hwrm.c @@ -3542,6 +3542,10 @@ bnxt_free_tunnel_ports(struct bnxt *bp) if (bp->ecpri_port_cnt) bnxt_hwrm_tunnel_dst_port_free(bp, bp->ecpri_fw_dst_port_id, HWRM_TUNNEL_DST_PORT_FREE_INPUT_TUNNEL_TYPE_ECPRI); + + if (bp->l2_etype_tunnel_cnt) + bnxt_hwrm_tunnel_dst_port_free(bp, bp->l2_etype_tunnel_id, + HWRM_TUNNEL_DST_PORT_FREE_INPUT_TUNNEL_TYPE_L2_ETYPE); } void bnxt_free_all_hwrm_resources(struct bnxt *bp) @@ -4839,6 +4843,10 @@ int bnxt_hwrm_tunnel_dst_port_alloc(struct bnxt *bp, uint16_t port, bp->ecpri_port = port; bp->ecpri_upar_in_use = resp->upar_in_use; break; + case HWRM_TUNNEL_DST_PORT_ALLOC_INPUT_TUNNEL_TYPE_L2_ETYPE: + bp->l2_etype_tunnel_id = port; + bp->l2_etype_upar_in_use = resp->upar_in_use; + break; default: break; } @@ -4869,6 +4877,9 @@ int bnxt_hwrm_tunnel_upar_id_get(struct bnxt *bp, uint8_t *upar_id, case HWRM_TUNNEL_DST_PORT_ALLOC_INPUT_TUNNEL_TYPE_SRV6: *upar_id = resp->upar_in_use; break; + case HWRM_TUNNEL_DST_PORT_ALLOC_INPUT_TUNNEL_TYPE_L2_ETYPE: + *upar_id = resp->upar_in_use; + break; default: /* INVALID UPAR Id if another tunnel type tries to retrieve */ *upar_id = 0xff; @@ -4915,6 +4926,13 @@ int bnxt_hwrm_tunnel_dst_port_free(struct bnxt *bp, uint16_t port, bp->ecpri_port_cnt = 0; } + if (tunnel_type == + HWRM_TUNNEL_DST_PORT_FREE_INPUT_TUNNEL_TYPE_L2_ETYPE) { + bp->l2_etype_tunnel_cnt = 0; + bp->l2_etype_tunnel_id = 0; + bp->l2_etype_upar_in_use = 0; + } + bnxt_hwrm_set_tpa(bp); return rc; } diff --git a/drivers/net/bnxt/tf_ulp/bnxt_ulp.c b/drivers/net/bnxt/tf_ulp/bnxt_ulp.c index 5afb4d4e3d..a0b252c6e4 100644 --- a/drivers/net/bnxt/tf_ulp/bnxt_ulp.c +++ b/drivers/net/bnxt/tf_ulp/bnxt_ulp.c @@ -454,6 +454,10 @@ bnxt_ulp_cntxt_app_caps_init(struct bnxt *bp, } } + if (info[i].flags & BNXT_ULP_APP_CAP_L2_ETYPE) + ulp_ctx->cfg_data->ulp_flags |= + BNXT_ULP_APP_L2_ETYPE; + bnxt_ulp_vxlan_ip_port_set(ulp_ctx, info[i].vxlan_ip_port); bnxt_ulp_vxlan_port_set(ulp_ctx, info[i].vxlan_port); bnxt_ulp_ecpri_udp_port_set(ulp_ctx, info[i].ecpri_udp_port); @@ -1795,6 +1799,29 @@ bnxt_ulp_init(struct bnxt *bp, return rc; } +static int +ulp_l2_etype_tunnel_alloc(struct bnxt *bp) +{ + int rc = 0; + + if (!ULP_APP_L2_ETYPE_SUPPORT(bp->ulp_ctx)) + return rc; + + if (bp->l2_etype_tunnel_cnt) { + BNXT_TF_DBG(DEBUG, "L2 ETYPE Custom Tunnel already allocated\n"); + return rc; + } + rc = bnxt_tunnel_dst_port_alloc(bp, + BNXT_L2_ETYPE_TUNNEL_ID, + HWRM_TUNNEL_DST_PORT_ALLOC_INPUT_TUNNEL_TYPE_L2_ETYPE); + if (rc) + BNXT_TF_DBG(ERR, "Failed to set global L2 ETYPE Custom Tunnel\n"); + else + bp->l2_etype_tunnel_cnt++; + + return rc; +} + static int ulp_cust_vxlan_alloc(struct bnxt *bp) { @@ -1943,6 +1970,10 @@ bnxt_ulp_port_init(struct bnxt *bp) if (rc) goto jump_to_error; + rc = ulp_l2_etype_tunnel_alloc(bp); + if (rc) + goto jump_to_error; + return rc; jump_to_error: @@ -1950,6 +1981,28 @@ bnxt_ulp_port_init(struct bnxt *bp) return rc; } +static void +ulp_l2_etype_tunnel_free(struct bnxt *bp) +{ + int rc; + + if (!ULP_APP_L2_ETYPE_SUPPORT(bp->ulp_ctx)) + return; + + if (bp->l2_etype_tunnel_cnt == 0) { + BNXT_TF_DBG(DEBUG, "L2 ETYPE Custom Tunnel already freed\n"); + return; + } + + rc = bnxt_tunnel_dst_port_free(bp, + BNXT_L2_ETYPE_TUNNEL_ID, + HWRM_TUNNEL_DST_PORT_ALLOC_INPUT_TUNNEL_TYPE_L2_ETYPE); + if (rc) + BNXT_TF_DBG(ERR, "Failed to clear L2 ETYPE Custom Tunnel\n"); + + bp->l2_etype_tunnel_cnt--; +} + static void ulp_cust_vxlan_free(struct bnxt *bp) { @@ -2026,6 +2079,7 @@ bnxt_ulp_port_deinit(struct bnxt *bp) if (bp->ulp_ctx->cfg_data->ref_cnt) { /* Free tunnel configurations */ ulp_cust_vxlan_free(bp); + ulp_l2_etype_tunnel_free(bp); /* free the port details */ /* Free the default flow rule associated to this port */ diff --git a/drivers/net/bnxt/tf_ulp/bnxt_ulp.h b/drivers/net/bnxt/tf_ulp/bnxt_ulp.h index d42382d947..8b75120926 100644 --- a/drivers/net/bnxt/tf_ulp/bnxt_ulp.h +++ b/drivers/net/bnxt/tf_ulp/bnxt_ulp.h @@ -40,6 +40,7 @@ #define BNXT_ULP_CUST_VXLAN_SUPPORT 0x100 #define BNXT_ULP_MULTI_SHARED_SUPPORT 0x200 #define BNXT_ULP_APP_HA_DYNAMIC 0x400 +#define BNXT_ULP_APP_L2_ETYPE 0x800 #define ULP_VF_REP_IS_ENABLED(flag) ((flag) & BNXT_ULP_VF_REP_ENABLED) #define ULP_SHARED_SESSION_IS_ENABLED(flag) ((flag) &\ @@ -60,6 +61,8 @@ #define ULP_APP_CUST_VXLAN_SUPPORT(ctx) ((ctx)->cfg_data->vxlan_port != 0) #define ULP_APP_VXLAN_GPE_SUPPORT(ctx) ((ctx)->cfg_data->vxlan_gpe_port != 0) #define ULP_APP_CUST_VXLAN_IP_SUPPORT(ctx) ((ctx)->cfg_data->vxlan_ip_port != 0) +#define ULP_APP_L2_ETYPE_SUPPORT(ctx) ((ctx)->cfg_data->ulp_flags &\ + BNXT_ULP_APP_L2_ETYPE) enum bnxt_ulp_flow_mem_type { BNXT_ULP_FLOW_MEM_TYPE_INT = 0, -- 2.39.3