DPDK patches and discussions
 help / color / mirror / Atom feed
From: Kalesh A P <kalesh-anakkur.purayil@broadcom.com>
To: dev@dpdk.org
Cc: ferruh.yigit@xilinx.com, ajit.khaparde@broadcom.com
Subject: [dpdk-dev] [PATCH 6/8] net/bnxt: disallow MTU change when device is started
Date: Wed, 15 Jun 2022 20:27:01 +0530	[thread overview]
Message-ID: <20220615145703.6613-7-kalesh-anakkur.purayil@broadcom.com> (raw)
In-Reply-To: <20220615145703.6613-1-kalesh-anakkur.purayil@broadcom.com>

From: Damodharam Ammepalli <damodharam.ammepall@broadcom.com>

With this patch, bnxt_mtu_set_op() will return an error code if the
device has already started. The user application will have to take
care to bring down device before invoking the mtu_set()

Fixes: daef48efe5e5 ("net/bnxt: support set MTU")
Cc: stable@dpdk.org

Signed-off-by: Damodharam Ammepalli <damodharam.ammepall@broadcom.com>
Reviewed-by: Andy Gospodarek <andrew.gospodarek@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
---
 drivers/net/bnxt/bnxt_ethdev.c | 28 ++++++++--------------------
 1 file changed, 8 insertions(+), 20 deletions(-)

diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index 4e4791c..f040cdc 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -3019,9 +3019,7 @@ bnxt_tx_burst_mode_get(struct rte_eth_dev *dev, __rte_unused uint16_t queue_id,
 
 int bnxt_mtu_set_op(struct rte_eth_dev *eth_dev, uint16_t new_mtu)
 {
-	uint32_t overhead = BNXT_MAX_PKT_LEN - BNXT_MAX_MTU;
 	struct bnxt *bp = eth_dev->data->dev_private;
-	uint32_t new_pkt_size;
 	uint32_t rc;
 	uint32_t i;
 
@@ -3029,25 +3027,15 @@ int bnxt_mtu_set_op(struct rte_eth_dev *eth_dev, uint16_t new_mtu)
 	if (rc)
 		return rc;
 
+	/* Return if port is active */
+	if (eth_dev->data->dev_started) {
+		PMD_DRV_LOG(ERR, "Stop port before changing MTU\n");
+		return -EPERM;
+	}
+
 	/* Exit if receive queues are not configured yet */
 	if (!eth_dev->data->nb_rx_queues)
-		return rc;
-
-	new_pkt_size = new_mtu + overhead;
-
-	/*
-	 * Disallow any MTU change that would require scattered receive support
-	 * if it is not already enabled.
-	 */
-	if (eth_dev->data->dev_started &&
-	    !eth_dev->data->scattered_rx &&
-	    (new_pkt_size >
-	     eth_dev->data->min_rx_buf_size - RTE_PKTMBUF_HEADROOM)) {
-		PMD_DRV_LOG(ERR,
-			    "MTU change would require scattered rx support. ");
-		PMD_DRV_LOG(ERR, "Stop port before changing MTU.\n");
-		return -EINVAL;
-	}
+		return -ENOTSUP;
 
 	if (new_mtu > RTE_ETHER_MTU)
 		bp->flags |= BNXT_FLAG_JUMBO;
@@ -3056,7 +3044,7 @@ int bnxt_mtu_set_op(struct rte_eth_dev *eth_dev, uint16_t new_mtu)
 
 	/* Is there a change in mtu setting? */
 	if (eth_dev->data->mtu == new_mtu)
-		return rc;
+		return 0;
 
 	for (i = 0; i < bp->nr_vnics; i++) {
 		struct bnxt_vnic_info *vnic = &bp->vnic_info[i];
-- 
2.10.1


  parent reply	other threads:[~2022-06-15 14:58 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-15 14:56 [dpdk-dev] [PATCH 0/8] bnxt PMD fixes Kalesh A P
2022-06-15 14:56 ` [dpdk-dev] [PATCH 1/8] net/bnxt: remove assert for zero data len in Tx path Kalesh A P
2022-06-16 17:03   ` Ferruh Yigit
2022-06-19 23:09     ` Ajit Khaparde
2022-06-20 10:55       ` Ferruh Yigit
2022-06-20 17:03         ` Ajit Khaparde
2022-06-15 14:56 ` [dpdk-dev] [PATCH 2/8] net/bnxt: fix switch domain allocation Kalesh A P
2022-06-15 14:56 ` [dpdk-dev] [PATCH 3/8] net/bnxt: reduce the verbosity of a log Kalesh A P
2022-06-15 14:56 ` [dpdk-dev] [PATCH 4/8] net/bnxt: allow Tx only or Rx only configs in PMD Kalesh A P
2022-06-16 17:03   ` Ferruh Yigit
2022-06-21  4:46     ` Kalesh Anakkur Purayil
2022-06-21  4:54       ` Damodharam Ammepalli
2022-06-21  7:57         ` Ferruh Yigit
2022-06-15 14:57 ` [dpdk-dev] [PATCH 5/8] net/bnxt: fix setting forced speed Kalesh A P
2022-06-15 14:57 ` Kalesh A P [this message]
2022-06-15 14:57 ` [dpdk-dev] [PATCH 7/8] net/bnxt: cleanups in MTU set callback Kalesh A P
2022-06-15 14:57 ` [dpdk-dev] [PATCH 8/8] net/bnxt: fix the check for autoneg enablement in the PHY FW Kalesh A P
2022-06-16 17:04   ` Ferruh Yigit
2022-06-19 23:11     ` Ajit Khaparde
2022-06-26 20:45 ` [dpdk-dev] [PATCH 0/8] bnxt PMD fixes Ajit Khaparde
2022-06-27  2:08   ` Thomas Monjalon
2022-06-27  3:28     ` Ajit Khaparde

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=20220615145703.6613-7-kalesh-anakkur.purayil@broadcom.com \
    --to=kalesh-anakkur.purayil@broadcom.com \
    --cc=ajit.khaparde@broadcom.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@xilinx.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).