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 DD6F7A0547; Thu, 29 Apr 2021 12:34:06 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C09A14131F; Thu, 29 Apr 2021 12:33:56 +0200 (CEST) Received: from smtpbgeu2.qq.com (smtpbgeu2.qq.com [18.194.254.142]) by mails.dpdk.org (Postfix) with ESMTP id 35DC54130C for ; Thu, 29 Apr 2021 12:33:55 +0200 (CEST) X-QQ-mid: bizesmtp32t1619692425to5q2e96 Received: from jiawenwu.trustnetic.com (unknown [183.129.236.74]) by esmtp6.qq.com (ESMTP) with id ; Thu, 29 Apr 2021 18:33:45 +0800 (CST) X-QQ-SSF: 01400000002000D0E000000A0000000 X-QQ-FEAT: 4ufqJHNJpU1D1FjFJPa3dqtJPvNuDGR+HBXGV71f3P4HibJ5bPMOrE1NUzO9u /zPwz5myZ2JKnAaeUgt99HCpuT/U+Jb3sccQ4ORVGSigX/vfANHu67YTywp36uMJ9sBwzio 54a9/elZnAteCJnkphITaBf4st8tq6S3t7IzwoDAHtSWcMbDj24M5ojrPLJIHJhPQpM7u1N tVBoV3XFd2g+7UZvKeOdcmyYIOhcgzVPERIofsdKBHvckzndEKQ+iqEp7J2mFp2zgS3Ub2J g2t0SyHh+T00k9Ln1g4MSsklMx2JJdsB824ENSwx9s2L5Ya98Lcm3MkcDeBtGUK8NZVdDnW VtRnUmjqMzL9fKAd9tEmHM0xbb+Gw== X-QQ-GoodBg: 2 From: Jiawen Wu To: dev@dpdk.org Cc: Jiawen Wu , stable@dpdk.org Date: Thu, 29 Apr 2021 18:33:32 +0800 Message-Id: <20210429103335.23060-3-jiawenwu@trustnetic.com> X-Mailer: git-send-email 2.21.0.windows.1 In-Reply-To: <20210429103335.23060-1-jiawenwu@trustnetic.com> References: <20210429103335.23060-1-jiawenwu@trustnetic.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-QQ-SENDSIZE: 520 Feedback-ID: bizesmtp:trustnetic.com:qybgforeign:qybgforeign6 X-QQ-Bgrelay: 1 Subject: [dpdk-dev] [PATCH v2 2/5] net/txgbe: fix VF MTU limit setting 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" 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 --- 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