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 9A6A9458A8; Fri, 30 Aug 2024 15:52:47 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 75C1F42EAA; Fri, 30 Aug 2024 15:52:10 +0200 (CEST) Received: from mail-pl1-f182.google.com (mail-pl1-f182.google.com [209.85.214.182]) by mails.dpdk.org (Postfix) with ESMTP id CE06F42E9D for ; Fri, 30 Aug 2024 15:52:08 +0200 (CEST) Received: by mail-pl1-f182.google.com with SMTP id d9443c01a7336-2020e83eca1so19516605ad.2 for ; Fri, 30 Aug 2024 06:52:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1725025928; x=1725630728; 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=ud5OnMlKNk7v1iGSXXLQk9K3RpGX7RekVeygUXcqu9Q=; b=Wz0MiBsJ74WhI5Bu67tQ+u6KdpT1drlaUXNnN6vd55+TPv5pwSOmS0vBZHUXieRIup eNJqslrJX9v9PvVT1RXy8RrVUW+sFYYHtDDB83joS30UmaZKTG8KsepCZ3SmaBvH0JR0 nuy0UMrWCG3dL8OMw+GwPohm9MuzDc/p87Jj4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725025928; x=1725630728; 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=ud5OnMlKNk7v1iGSXXLQk9K3RpGX7RekVeygUXcqu9Q=; b=pvvw+rF7mKRrCd1drCHl6ol9jaaQYtyQ86I6xfEsqQTBH0ODuSQQt5q634YPuq0b5c nz44hTMaS5uAQ62DznQtWaEWAvRb+eJoVTrW6eW5DFFFZYMIfa0nhRjcKQMXZHpvF3Nb OXX/uIUNxDfk2rzUjALU6TJL0qvvgJ+J1S/+FwSjJk9SkLAAaniQTQM4H+0xOoIMd2rP P2yqcZKMAkBctCpXauZrJs0ZhmcTPN5r1Y5iWm4xuVQ5XSlo8lsMjytlJ45NNTnxaqyZ hPcsm5K3uXXARwojJCXynH25gDH7N5+DFOWyMlUbHJXiPivvvip9JagFl3Tq6HlM0U3i /4Lw== X-Gm-Message-State: AOJu0YyP2oyz9Rkdua1t4oVmKF5ppMVjuyvJDpo9SVynLqQJnN2F3YdV Hj5uApkysOp0UFdYvjmp/3caBVj7LT8shtTXOLC/9Wyy2OSvHcViVgLii409t5zD1wozSl1y+NU dye4i1eGuIsvXOzfgyK+4bhBnCidbTC7yfBzoROjFdbLL8R3C4hcJoDywop/r+YQ2cGwo0Eh/mo M2mki3kHfQpQHcm/Ecr0TbND2XNSKOGG9FrWLdPuc/zaPF X-Google-Smtp-Source: AGHT+IH4O4j5NBPs495RFBDpz6fIz9tU/xd3oJsbjkUlpUD3MvKzwI1TPhJsyqogjakFMSLqVl8ysw== X-Received: by 2002:a17:902:e54a:b0:202:2cd5:2095 with SMTP id d9443c01a7336-2050c237c31mr70652435ad.18.1725025927433; Fri, 30 Aug 2024 06:52:07 -0700 (PDT) Received: from dhcp-10-123-154-23.dhcp.broadcom.net ([192.19.234.250]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-205155658dfsm27067145ad.297.2024.08.30.06.52.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 30 Aug 2024 06:52:06 -0700 (PDT) From: Sriharsha Basavapatna To: dev@dpdk.org Cc: Shahaji Bhosle , Kishore Padmanabha , Sriharsha Basavapatna Subject: [PATCH 13/47] net/bnxt: tf_ulp: add custom l2 etype tunnel support Date: Fri, 30 Aug 2024 19:30:15 +0530 Message-Id: <20240830140049.1715230-14-sriharsha.basavapatna@broadcom.com> X-Mailer: git-send-email 2.39.0.189.g4dbebc36b0 In-Reply-To: <20240830140049.1715230-1-sriharsha.basavapatna@broadcom.com> References: <20240830140049.1715230-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 Reviewed-by: Kishore Padmanabha Signed-off-by: Sriharsha Basavapatna --- 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 00123e51ac..b905d9fd3e 100644 --- a/drivers/net/bnxt/bnxt.h +++ b/drivers/net/bnxt/bnxt.h @@ -988,13 +988,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 4e62dbbcca..778488ce1a 100644 --- a/drivers/net/bnxt/bnxt_hwrm.c +++ b/drivers/net/bnxt/bnxt_hwrm.c @@ -3515,6 +3515,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) @@ -4811,6 +4815,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; } @@ -4841,6 +4849,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; @@ -4887,6 +4898,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 96a5353aaf..912946303a 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