DPDK patches and discussions
 help / color / mirror / Atom feed
From: Jiawen Wu <jiawenwu@trustnetic.com>
To: dev@dpdk.org
Cc: Jiawen Wu <jiawenwu@trustnetic.com>, stable@dpdk.org
Subject: [dpdk-dev] [PATCH v2 2/5] net/txgbe: fix VF MTU limit setting
Date: Thu, 29 Apr 2021 18:33:32 +0800	[thread overview]
Message-ID: <20210429103335.23060-3-jiawenwu@trustnetic.com> (raw)
In-Reply-To: <20210429103335.23060-1-jiawenwu@trustnetic.com>

Add the dev_started check to remove the limitation of VF MTU setting.
When device is stopped, it is allowed to set MTU bigger than mbuf size.
Scattered rx may be enabled in next starting, exempt from setting in
EAL parameters.

Fixes: a2beaa4a769e ("net/txgbe: support VF MTU update")
Cc: stable@dpdk.org

Signed-off-by: Jiawen Wu <jiawenwu@trustnetic.com>
---
 drivers/net/txgbe/txgbe_ethdev_vf.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/drivers/net/txgbe/txgbe_ethdev_vf.c b/drivers/net/txgbe/txgbe_ethdev_vf.c
index 3a5123733e..5597968e18 100644
--- a/drivers/net/txgbe/txgbe_ethdev_vf.c
+++ b/drivers/net/txgbe/txgbe_ethdev_vf.c
@@ -1115,7 +1115,7 @@ txgbevf_dev_set_mtu(struct rte_eth_dev *dev, uint16_t mtu)
 {
 	struct txgbe_hw *hw;
 	uint32_t max_frame = mtu + RTE_ETHER_HDR_LEN + RTE_ETHER_CRC_LEN;
-	struct rte_eth_rxmode *rx_conf = &dev->data->dev_conf.rxmode;
+	struct rte_eth_dev_data *dev_data = dev->data;
 
 	hw = TXGBE_DEV_HW(dev);
 
@@ -1123,13 +1123,15 @@ txgbevf_dev_set_mtu(struct rte_eth_dev *dev, uint16_t mtu)
 			max_frame > RTE_ETHER_MAX_JUMBO_FRAME_LEN)
 		return -EINVAL;
 
-	/* refuse mtu that requires the support of scattered packets when this
-	 * feature has not been enabled before.
+	/* If device is started, refuse mtu that requires the support of
+	 * scattered packets when this feature has not been enabled before.
 	 */
-	if (!(rx_conf->offloads & DEV_RX_OFFLOAD_SCATTER) &&
+	if (dev_data->dev_started && !dev_data->scattered_rx &&
 	    (max_frame + 2 * TXGBE_VLAN_TAG_SIZE >
-	     dev->data->min_rx_buf_size - RTE_PKTMBUF_HEADROOM))
+	     dev->data->min_rx_buf_size - RTE_PKTMBUF_HEADROOM)) {
+		PMD_INIT_LOG(ERR, "Stop port first.");
 		return -EINVAL;
+	}
 
 	/*
 	 * When supported by the underlying PF driver, use the TXGBE_VF_SET_MTU
-- 
2.21.0.windows.1




  parent reply	other threads:[~2021-04-29 10:34 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-29 10:33 [dpdk-dev] [PATCH v2 0/5] Fixes and supports for txgbe Jiawen Wu
2021-04-29 10:33 ` [dpdk-dev] [PATCH v2 1/5] net/txgbe: fix RSS in QINQ Jiawen Wu
2021-04-29 14:31   ` [dpdk-dev] [dpdk-stable] " Ferruh Yigit
2021-05-06  3:33     ` Jiawen Wu
2021-04-29 10:33 ` Jiawen Wu [this message]
2021-04-29 14:59   ` [dpdk-dev] [dpdk-stable] [PATCH v2 2/5] net/txgbe: fix VF MTU limit setting Ferruh Yigit
2021-05-06  1:43     ` Jiawen Wu
2021-04-29 10:33 ` [dpdk-dev] [PATCH v2 3/5] net/txgbe: support VXLAN-GPE Jiawen Wu
2021-04-29 10:33 ` [dpdk-dev] [PATCH v2 4/5] net/txgbe: remove port representor Jiawen Wu
2021-04-29 10:33 ` [dpdk-dev] [PATCH v2 5/5] net/txgbe: add copyright owner Jiawen Wu
2021-04-29 14:59   ` Ferruh Yigit
2021-04-29 15:02 ` [dpdk-dev] [PATCH v2 0/5] Fixes and supports for txgbe Ferruh Yigit

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=20210429103335.23060-3-jiawenwu@trustnetic.com \
    --to=jiawenwu@trustnetic.com \
    --cc=dev@dpdk.org \
    --cc=stable@dpdk.org \
    /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).