DPDK patches and discussions
 help / color / mirror / Atom feed
From: Somnath Kotur <somnath.kotur@broadcom.com>
To: dev@dpdk.org
Cc: ferruh.yigit@intel.com
Subject: [dpdk-dev] [PATCH 02/16] net/bnxt: fix ping failure with MTU change
Date: Thu, 24 Oct 2019 11:28:57 +0530	[thread overview]
Message-ID: <20191024055913.28817-3-somnath.kotur@broadcom.com> (raw)
In-Reply-To: <20191024055913.28817-1-somnath.kotur@broadcom.com>

From: Santoshkumar Karanappa Rastapur <santosh.rastapur@broadcom.com>

Driver was setting maximum receive unit differently in bnxt_mtu_set_op
and bnxt_hwrm_vnic_alloc. Moreover firmware adds the 4 bytes for FCS.
Fixed it by setting correct maximum receive unit value.

Reviewed-by: Ajit Kumar Khaparde <ajit.khaparde@broadcom.com>
Signed-off-by: Santoshkumar Karanappa Rastapur <santosh.rastapur@broadcom.com>
Signed-off-by: Somnath Kotur <somnath.kotur@broadcom.com>
---
 drivers/net/bnxt/bnxt.h        |  3 +++
 drivers/net/bnxt/bnxt_ethdev.c |  3 +--
 drivers/net/bnxt/bnxt_hwrm.c   | 11 +++--------
 3 files changed, 7 insertions(+), 10 deletions(-)

diff --git a/drivers/net/bnxt/bnxt.h b/drivers/net/bnxt/bnxt.h
index e5bdf63..975bcf9 100644
--- a/drivers/net/bnxt/bnxt.h
+++ b/drivers/net/bnxt/bnxt.h
@@ -77,6 +77,9 @@
 #define BNXT_MAX_PKT_LEN	(BNXT_MAX_MTU + RTE_ETHER_HDR_LEN +\
 				 RTE_ETHER_CRC_LEN +\
 				 (BNXT_NUM_VLANS * VLAN_TAG_SIZE))
+/* FW adds extra 4 bytes for FCS */
+#define BNXT_VNIC_MRU(mtu)\
+	((mtu) + RTE_ETHER_HDR_LEN + VLAN_TAG_SIZE * BNXT_NUM_VLANS)
 #define BNXT_VF_RSV_NUM_RSS_CTX	1
 #define BNXT_VF_RSV_NUM_L2_CTX	4
 /* TODO: For now, do not support VMDq/RFS on VFs. */
diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index e7ec99e..c97fcac 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -2174,8 +2174,7 @@ static int bnxt_mtu_set_op(struct rte_eth_dev *eth_dev, uint16_t new_mtu)
 		struct bnxt_vnic_info *vnic = &bp->vnic_info[i];
 		uint16_t size = 0;
 
-		vnic->mru = new_mtu + RTE_ETHER_HDR_LEN +
-				RTE_ETHER_CRC_LEN + VLAN_TAG_SIZE * 2;
+		vnic->mru = BNXT_VNIC_MRU(new_mtu);
 		rc = bnxt_hwrm_vnic_cfg(bp, vnic);
 		if (rc)
 			break;
diff --git a/drivers/net/bnxt/bnxt_hwrm.c b/drivers/net/bnxt/bnxt_hwrm.c
index 18e7429..018113c 100644
--- a/drivers/net/bnxt/bnxt_hwrm.c
+++ b/drivers/net/bnxt/bnxt_hwrm.c
@@ -1592,8 +1592,7 @@ int bnxt_hwrm_vnic_alloc(struct bnxt *bp, struct bnxt_vnic_info *vnic)
 	vnic->lb_rule = (uint16_t)HWRM_NA_SIGNATURE;
 
 skip_ring_grps:
-	vnic->mru = bp->eth_dev->data->mtu + RTE_ETHER_HDR_LEN +
-				RTE_ETHER_CRC_LEN + VLAN_TAG_SIZE;
+	vnic->mru = BNXT_VNIC_MRU(bp->eth_dev->data->mtu);
 	HWRM_PREP(req, VNIC_ALLOC, BNXT_USE_CHIMP_MB);
 
 	if (vnic->func_default)
@@ -2954,9 +2953,7 @@ static int bnxt_hwrm_pf_func_cfg(struct bnxt *bp, int tx_rings)
 
 	req.flags = rte_cpu_to_le_32(bp->pf.func_cfg_flags);
 	req.mtu = rte_cpu_to_le_16(BNXT_MAX_MTU);
-	req.mru = rte_cpu_to_le_16(bp->eth_dev->data->mtu + RTE_ETHER_HDR_LEN +
-				   RTE_ETHER_CRC_LEN + VLAN_TAG_SIZE *
-				   BNXT_NUM_VLANS);
+	req.mru = rte_cpu_to_le_16(BNXT_VNIC_MRU(bp->eth_dev->data->mtu));
 	req.num_rsscos_ctxs = rte_cpu_to_le_16(bp->max_rsscos_ctx);
 	req.num_stat_ctxs = rte_cpu_to_le_16(bp->max_stat_ctx);
 	req.num_cmpl_rings = rte_cpu_to_le_16(bp->max_cp_rings);
@@ -2995,9 +2992,7 @@ static void populate_vf_func_cfg_req(struct bnxt *bp,
 	req->mtu = rte_cpu_to_le_16(bp->eth_dev->data->mtu + RTE_ETHER_HDR_LEN +
 				    RTE_ETHER_CRC_LEN + VLAN_TAG_SIZE *
 				    BNXT_NUM_VLANS);
-	req->mru = rte_cpu_to_le_16(bp->eth_dev->data->mtu + RTE_ETHER_HDR_LEN +
-				    RTE_ETHER_CRC_LEN + VLAN_TAG_SIZE *
-				    BNXT_NUM_VLANS);
+	req->mru = rte_cpu_to_le_16(BNXT_VNIC_MRU(bp->eth_dev->data->mtu));
 	req->num_rsscos_ctxs = rte_cpu_to_le_16(bp->max_rsscos_ctx /
 						(num_vfs + 1));
 	req->num_stat_ctxs = rte_cpu_to_le_16(bp->max_stat_ctx / (num_vfs + 1));
-- 
1.8.3.1


  parent reply	other threads:[~2019-10-24  6:07 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-24  5:58 [dpdk-dev] [PATCH 00/18] bnxt patchset with bug fixes Somnath Kotur
2019-10-24  5:58 ` [dpdk-dev] [PATCH 01/16] net/bnxt: fix unused value in free filter mem Somnath Kotur
2019-10-24  5:58 ` Somnath Kotur [this message]
2019-10-24  5:58 ` [dpdk-dev] [PATCH 03/16] net/bnxt: fix to set MAX RSS contexts for maximal reservation Somnath Kotur
2019-10-24  5:58 ` [dpdk-dev] [PATCH 04/16] net/bnxt: fix to write the correct MTU to FW Somnath Kotur
2019-10-24  5:59 ` [dpdk-dev] [PATCH 05/16] net/bnxt: fix RSS configuration failure for thor-based controllers Somnath Kotur
2019-10-24  5:59 ` [dpdk-dev] [PATCH 06/16] net/bnxt: update HWRM API to version 1.10.1.6 Somnath Kotur
2019-10-24  5:59 ` [dpdk-dev] [PATCH 07/16] net/bnxt: use mac index, while checking for default mac Somnath Kotur
2019-10-24  5:59 ` [dpdk-dev] [PATCH 08/16] net/bnxt: fix a possible race between start and interrupt handler Somnath Kotur
2019-10-24  5:59 ` [dpdk-dev] [PATCH 09/16] net/bnxt: fix to use HWRM_CFA_L2_FILTER as the filter_type for non-ntuple flows Somnath Kotur
2019-10-24  5:59 ` [dpdk-dev] [PATCH 10/16] net/bnxt: expose some missing counters in port statistics Somnath Kotur
2019-10-24  5:59 ` [dpdk-dev] [PATCH 11/16] net/bnxt: fix to check for zero mac address while parsing flow arguments Somnath Kotur
2019-10-24  5:59 ` [dpdk-dev] [PATCH 12/16] net/bnxt: fix segfault after removing and adding the slaves Somnath Kotur
2019-10-24  5:59 ` [dpdk-dev] [PATCH 13/16] net/bnxt: add more checks for fw reset Somnath Kotur
2019-10-24  5:59 ` [dpdk-dev] [PATCH 14/16] net/bnxt: add PCI IDs for 57500 series NPAR devices Somnath Kotur
2019-10-24  5:59 ` [dpdk-dev] [PATCH 15/16] net/bnxt: add a wrapper function for thor device check Somnath Kotur
2019-10-24  5:59 ` [dpdk-dev] [PATCH 16/16] net/bnxt: fix a possible memory leak Somnath Kotur
2019-10-24  5:59 ` [dpdk-dev] [PATCH 17/17] net/bnxt: fix mbuf free when clearing Tx queue Somnath Kotur
2019-10-24  5:59 ` [dpdk-dev] [PATCH 18/18] net/bnxt: call bnxt_uninit_locks from bnxt_uninit_resources Somnath Kotur

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191024055913.28817-3-somnath.kotur@broadcom.com \
    --to=somnath.kotur@broadcom.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).