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 239FA45A76; Tue, 1 Oct 2024 07:50:45 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id A847F402BB; Tue, 1 Oct 2024 07:50:17 +0200 (CEST) Received: from mail-ot1-f46.google.com (mail-ot1-f46.google.com [209.85.210.46]) by mails.dpdk.org (Postfix) with ESMTP id 854B640299 for ; Tue, 1 Oct 2024 07:50:16 +0200 (CEST) Received: by mail-ot1-f46.google.com with SMTP id 46e09a7af769-710d77380cdso2989325a34.0 for ; Mon, 30 Sep 2024 22:50:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1727761815; x=1728366615; 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=Ec/gq2lygkjPZNXwQ2IFWB6MA20JF8C49hT4dGS+31w=; b=ZKS3UxHQFqGeOr9PZSo5PKgSvnS3EjRNUzEQyKlIeCBMNLwV5Rqdoz1XfAec9Dphv6 RTUtLkvvMZMovD4QQWyjm6oYZDKou0OzEHSRRlkhxI+6kAWXCxBfJ+V4w0ufYcwI+YkK oIsX/vrE6EBvAM/ZzlqhY7WvRwy/idxQ2On9Q= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727761815; x=1728366615; 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=Ec/gq2lygkjPZNXwQ2IFWB6MA20JF8C49hT4dGS+31w=; b=JYoqG2/VGDW0o2Qf2PSlEMoBsR6Kos/uSSkSLYesBl5NvRmdIYrEmTPO3B0nubB97X 7APq9k3c0YLV8eV7FdgDm+yFhrQf9sr6GZlvl6FuEw/Ob7rluB1SHX97rmslGF9V7Uqd k1BWZiMKeD3M6zKlTE1fWWc74XksccL9zx18wCCJG7PvqE9gA+x2j2J+df/5dw+Ms18x bt0fwgv41n3Jg9j7I9zuRuwe3Q420NnpgSRNdjkDwLd9DWJgH0AFy+y1EBj39mC2jhLN MsL/rEQ0QU7ISwLiecYYWvOAgPT2efh+0f3ME2MmvTdm8qVl4Wscis6X/4JAjLCcUrlI Mvjw== X-Gm-Message-State: AOJu0Yy/OPJw+TUYiOgFPUGeZFagmT3FarmedaZGJ+Rg/LYZvkDQa3xf JIpoU1FxY248kcP4enAD34OqEX+E05Wxyw/wo7bDCGt+Ta+TbuqhqZNUQapfpeR/QyO6uydA6Zd iIWf61uHXPtaY8yCYwz5N2+aJd4ccFusBrqLWMZGD+9nE5CrXyx3ooNHPN+Kr3ucOcryNxN0Cl/ WpQ5Gw0isP61ylznsE7XqF3VYgUtMG0zjg7rAXJAsWeQ== X-Google-Smtp-Source: AGHT+IEMKHhV1fLxdeMTq71ohSqBjv0l9OMdqnr5jdAzDx7uXtlmcMVM58hvwbj9YaCEcBV40NXLSw== X-Received: by 2002:a05:6358:60c3:b0:1b1:acd4:d155 with SMTP id e5c5f4694b2df-1becbb9bf0emr366579155d.16.1727761815063; Mon, 30 Sep 2024 22:50:15 -0700 (PDT) Received: from dhcp-10-123-154-23.dhcp.broadcom.net ([192.19.234.250]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-7e6db2c8af2sm7513792a12.48.2024.09.30.22.50.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Sep 2024 22:50:14 -0700 (PDT) From: Sriharsha Basavapatna To: dev@dpdk.org Cc: Shahaji Bhosle , Sriharsha Basavapatna , Kishore Padmanabha , Ajit Khaparde Subject: [PATCH v3 13/47] net/bnxt: tf_ulp: add custom l2 etype tunnel support Date: Tue, 1 Oct 2024 11:27:59 +0530 Message-Id: <20241001055833.757163-14-sriharsha.basavapatna@broadcom.com> X-Mailer: git-send-email 2.39.0.189.g4dbebc36b0 In-Reply-To: <20241001055833.757163-1-sriharsha.basavapatna@broadcom.com> References: <20241001055833.757163-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 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