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 26752A0548; Wed, 15 Jun 2022 16:58:21 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 1A5C142B8A; Wed, 15 Jun 2022 16:57:53 +0200 (CEST) Received: from relay.smtp-ext.broadcom.com (relay.smtp-ext.broadcom.com [192.19.166.231]) by mails.dpdk.org (Postfix) with ESMTP id 1F18C42B92 for ; Wed, 15 Jun 2022 16:57:51 +0200 (CEST) Received: from dhcp-10-123-153-22.dhcp.broadcom.net (bgccx-dev-host-lnx2.bec.broadcom.net [10.123.153.22]) by relay.smtp-ext.broadcom.com (Postfix) with ESMTP id 6D011C0000F3; Wed, 15 Jun 2022 07:57:49 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 relay.smtp-ext.broadcom.com 6D011C0000F3 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=broadcom.com; s=dkimrelay; t=1655305070; bh=UBoTeAeoczpCcTmSg6BtuOYk1IVaPJz4xJrEDjQogKo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=R/Mk4oLJ3Y7E6YOiFs2Yy36DZh1gJFdpz7I3DUuZw8IEmwg/Se74kBCqTQaUpKiJJ aB3ln27NQ76ydYMTVLrm/SZvrI5wfsj2tMCc/jywhXnfDxDAbTdMPzum8OfDy00drR OZINkK6ro3MVjtDQt+tJPep0/2z3jKvPaPUm8ps8= From: Kalesh A P 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 Message-Id: <20220615145703.6613-7-kalesh-anakkur.purayil@broadcom.com> X-Mailer: git-send-email 2.10.1 In-Reply-To: <20220615145703.6613-1-kalesh-anakkur.purayil@broadcom.com> References: <20220615145703.6613-1-kalesh-anakkur.purayil@broadcom.com> 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: Damodharam Ammepalli 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 Reviewed-by: Andy Gospodarek Reviewed-by: Ajit Khaparde --- 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