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 6D393A0C46; Tue, 28 Sep 2021 00:48:57 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id CB5CF410E4; Tue, 28 Sep 2021 00:48:56 +0200 (CEST) Received: from mail-pg1-f180.google.com (mail-pg1-f180.google.com [209.85.215.180]) by mails.dpdk.org (Postfix) with ESMTP id 0F4F940DF6 for ; Tue, 28 Sep 2021 00:48:56 +0200 (CEST) Received: by mail-pg1-f180.google.com with SMTP id n18so19153587pgm.12 for ; Mon, 27 Sep 2021 15:48:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=from:to:cc:subject:date:message-id:mime-version; bh=guTWYmOt0wgAZzer0Rvx+Xf6v/U1UEPu3nE6kGGdtxw=; b=S56zp/kDu1T9s+e2zius8GytVfl3nCk9uaT/+Cs1U/KCnh9NiRlVIOhO+ePuPmwnrt PLfl4rkOKrbiXw/qd7hafbFMidSpEwtGE9RDM/SleB8sr2ir29Btd7yKcuPL0n4pA1z/ zm5XMU2W6c0TjKgb/m6+emQ1h/oaD3uWIMeLE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version; bh=guTWYmOt0wgAZzer0Rvx+Xf6v/U1UEPu3nE6kGGdtxw=; b=bIOM9LH4nltjRyFMY44K0dDUxAagyXiVko1k1uoAeUbpUYcSDwqwPFV18Tx+uslBG7 VM7mZuUy3iRzmwVimiODU0RgBKou0oesrSgXqKukzigaCz6IMHwoZb6NfbOfFN2bOVDN GN0ND/fuFqW1+Jmyfhi3dSNFUC0CfzysoSYaSVewCve3y2slT2wW14ymMhgNmSpM9E1H Z4uWGrIGcIldqaCz7Pic8HzGF9BEoiko2jwRFHm/fkdEPwrKVf3DAOaS+XhGDSDs7JwO O27GrOx3IYgWjkcKLZbMpaBi5Ctj9OL7kSlYVGAhuI+Bec/fVE/JtIJUeXlBy54GcjOy WGGg== X-Gm-Message-State: AOAM530UPM5O0fyhmLqrI+OBxAqk7Cxsb28z4WyunPL46d7IcDzvAHye 5BDiP9glPvpR1mN8Bd79q3q51SP34fnJ8JclrTXGdXeDD020j9EeMiSjv+2R1ONtmtbmUJJTEOj RP8XjtzexXDCxuLxbZrCbMUG6gBmyJrP2EXKP5OHYJ3ZgcTRQjP+GAimtmlO/me0= X-Google-Smtp-Source: ABdhPJwYSER91bMP/+HBYzwA86ZCCu9L0cuEXcMjG0onu38FfB+bF4ylcDHQa0lPv464l/Zbq3d32Q== X-Received: by 2002:a63:cc49:: with SMTP id q9mr1706566pgi.463.1632782934524; Mon, 27 Sep 2021 15:48:54 -0700 (PDT) Received: from localhost.localdomain ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id m11sm7397035pga.27.2021.09.27.15.48.51 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 27 Sep 2021 15:48:54 -0700 (PDT) From: Ajit Khaparde To: dev@dpdk.org Cc: stable@dpdk.org, Lance Richardson Date: Mon, 27 Sep 2021 15:48:35 -0700 Message-Id: <20210927224834.90837-1-ajit.khaparde@broadcom.com> X-Mailer: git-send-email 2.30.1 (Apple Git-130) MIME-Version: 1.0 Content-Type: multipart/signed; protocol="application/pkcs7-signature"; micalg=sha-256; boundary="000000000000d818d605cd01e687" X-Content-Filtered-By: Mailman/MimeDel 2.1.29 Subject: [dpdk-dev] [PATCH] net/bnxt: fix tunnel port accounting 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 Sender: "dev" --000000000000d818d605cd01e687 Content-Transfer-Encoding: 8bit Fix the tunnel port counting logic. Currently we are incrementing the port count without checking the if bnxt_hwrm_tunnel_dst_port_alloc would return success or failure. Modify the logic to increment it only if the firmware returns success. Fixes: 10d074b2022d ("net/bnxt: support tunneling") Cc: stable@dpdk.org Signed-off-by: Ajit Khaparde Reviewed-by: Lance Richardson --- drivers/net/bnxt/bnxt_ethdev.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c index 857da91c9d..aa7e7fdc85 100644 --- a/drivers/net/bnxt/bnxt_ethdev.c +++ b/drivers/net/bnxt/bnxt_ethdev.c @@ -2369,7 +2369,6 @@ bnxt_udp_tunnel_port_add_op(struct rte_eth_dev *eth_dev, } tunnel_type = HWRM_TUNNEL_DST_PORT_ALLOC_INPUT_TUNNEL_TYPE_VXLAN; - bp->vxlan_port_cnt++; break; case RTE_TUNNEL_TYPE_GENEVE: if (bp->geneve_port_cnt) { @@ -2384,7 +2383,6 @@ bnxt_udp_tunnel_port_add_op(struct rte_eth_dev *eth_dev, } tunnel_type = HWRM_TUNNEL_DST_PORT_ALLOC_INPUT_TUNNEL_TYPE_GENEVE; - bp->geneve_port_cnt++; break; default: PMD_DRV_LOG(ERR, "Tunnel type is not supported\n"); @@ -2392,6 +2390,18 @@ bnxt_udp_tunnel_port_add_op(struct rte_eth_dev *eth_dev, } rc = bnxt_hwrm_tunnel_dst_port_alloc(bp, udp_tunnel->udp_port, tunnel_type); + + if (rc != 0) + return rc; + + if (tunnel_type == + HWRM_TUNNEL_DST_PORT_ALLOC_INPUT_TUNNEL_TYPE_VXLAN) + bp->vxlan_port_cnt++; + + if (tunnel_type == + HWRM_TUNNEL_DST_PORT_ALLOC_INPUT_TUNNEL_TYPE_GENEVE) + bp->geneve_port_cnt++; + return rc; } -- 2.30.1 (Apple Git-130) --000000000000d818d605cd01e687--