From patchwork Wed Oct 14 09:19:41 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Yang X-Patchwork-Id: 80702 X-Patchwork-Delegate: qi.z.zhang@intel.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 5184EA04B7; Wed, 14 Oct 2020 11:21:47 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 6DB1E1DD6A; Wed, 14 Oct 2020 11:21:29 +0200 (CEST) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by dpdk.org (Postfix) with ESMTP id 605301DD14 for ; Wed, 14 Oct 2020 11:21:26 +0200 (CEST) IronPort-SDR: CPgVHxMEOYeL9VbfjEjLMZVdv1DkIMXyGmcRYtL8SkQRj5n24F7pmkgKClg+9OwUbnzber2MeE PMV4OYRXZ/Nw== X-IronPort-AV: E=McAfee;i="6000,8403,9773"; a="183585310" X-IronPort-AV: E=Sophos;i="5.77,374,1596524400"; d="scan'208";a="183585310" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Oct 2020 02:21:25 -0700 IronPort-SDR: T9qwrTpp40WkPsb0GMVC8AcXRjQIr67eGdCMBNq6IJF5lWFOzpyFtxRcV0VBpXG9fMjtAZCsBl vFk3Zpj50V6g== X-IronPort-AV: E=Sophos;i="5.77,374,1596524400"; d="scan'208";a="530752275" Received: from intel-npg-odc-srv01.cd.intel.com ([10.240.178.136]) by orsmga005-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Oct 2020 02:21:23 -0700 From: SteveX Yang To: dev@dpdk.org Cc: jia.guo@intel.com, qiming.yang@intel.com, qi.z.zhang@intel.com, jingjing.wu@intel.com, beilei.xing@intel.com, konstantin.ananyev@intel.com, SteveX Yang Date: Wed, 14 Oct 2020 09:19:41 +0000 Message-Id: <20201014091945.1934-2-stevex.yang@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201014091945.1934-1-stevex.yang@intel.com> References: <20200928065541.7520-1-stevex.yang@intel.com> <20201014091945.1934-1-stevex.yang@intel.com> Subject: [dpdk-dev] [PATCH v5 1/5] net/e1000: fix max mtu size packets with vlan tag cannot be received by default X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 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" when application presets the max rx packet length and expected mtu at the same time, driver need identify if the preset max frame size can hold mtu data and Ether overhead completely. if not, adjust the max frame size via mtu_set ops within dev_configure. Fixes: 35b2d13fd6fd ("net: add rte prefix to ether defines") Signed-off-by: SteveX Yang --- drivers/net/e1000/em_ethdev.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/drivers/net/e1000/em_ethdev.c b/drivers/net/e1000/em_ethdev.c index d050eb478..d2cf318f8 100644 --- a/drivers/net/e1000/em_ethdev.c +++ b/drivers/net/e1000/em_ethdev.c @@ -432,10 +432,22 @@ eth_em_configure(struct rte_eth_dev *dev) { struct e1000_interrupt *intr = E1000_DEV_PRIVATE_TO_INTR(dev->data->dev_private); + uint16_t frame_size = dev->data->mtu + E1000_ETH_OVERHEAD; + int rc = 0; PMD_INIT_FUNC_TRACE(); intr->flags |= E1000_FLAG_NEED_LINK_UPDATE; + /** + * Reset the max frame size via mtu_set ops if preset max frame + * cannot hold MTU data and Ether overhead. + */ + if (frame_size > dev->data->dev_conf.rxmode.max_rx_pkt_len) { + rc = eth_em_mtu_set(dev, dev->data->mtu); + if (rc != 0) + return rc; + } + PMD_INIT_FUNC_TRACE(); return 0; From patchwork Wed Oct 14 09:19:42 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Yang X-Patchwork-Id: 80703 X-Patchwork-Delegate: qi.z.zhang@intel.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id BC0CCA04B7; Wed, 14 Oct 2020 11:22:09 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 149251DD72; Wed, 14 Oct 2020 11:21:31 +0200 (CEST) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by dpdk.org (Postfix) with ESMTP id 3BA7E1DD36 for ; Wed, 14 Oct 2020 11:21:29 +0200 (CEST) IronPort-SDR: hagoZvryUb3VCjwYuJyra4hQH4uGdmlkFDuYGTH/fivhRJd03Z2euL6BoMdUsY/gJUTcIv6ct0 pZly9bKDIkVw== X-IronPort-AV: E=McAfee;i="6000,8403,9773"; a="183585319" X-IronPort-AV: E=Sophos;i="5.77,374,1596524400"; d="scan'208";a="183585319" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Oct 2020 02:21:28 -0700 IronPort-SDR: YdsVgwn/esEa0wddY1o9rMATZM42s951QfCccP5L37E32GBVMPg05X6eeshhkE8+l3dJzxnhVA X+E6NYU2pzKA== X-IronPort-AV: E=Sophos;i="5.77,374,1596524400"; d="scan'208";a="530752296" Received: from intel-npg-odc-srv01.cd.intel.com ([10.240.178.136]) by orsmga005-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Oct 2020 02:21:26 -0700 From: SteveX Yang To: dev@dpdk.org Cc: jia.guo@intel.com, qiming.yang@intel.com, qi.z.zhang@intel.com, jingjing.wu@intel.com, beilei.xing@intel.com, konstantin.ananyev@intel.com, SteveX Yang Date: Wed, 14 Oct 2020 09:19:42 +0000 Message-Id: <20201014091945.1934-3-stevex.yang@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201014091945.1934-1-stevex.yang@intel.com> References: <20200928065541.7520-1-stevex.yang@intel.com> <20201014091945.1934-1-stevex.yang@intel.com> Subject: [dpdk-dev] [PATCH v5 2/5] net/igc: fix max mtu size packets with vlan tag cannot be received by default X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 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" when application presets the max rx packet length and expected mtu at the same time, driver need identify if the preset max frame size can hold mtu data and Ether overhead completely. if not, adjust the max frame size via mtu_set ops within dev_configure. Fixes: a5aeb2b9e225 ("net/igc: support Rx and Tx") Signed-off-by: SteveX Yang --- drivers/net/igc/igc_ethdev.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/drivers/net/igc/igc_ethdev.c b/drivers/net/igc/igc_ethdev.c index 7f5066df4..98e98b3e4 100644 --- a/drivers/net/igc/igc_ethdev.c +++ b/drivers/net/igc/igc_ethdev.c @@ -337,11 +337,22 @@ static int eth_igc_configure(struct rte_eth_dev *dev) { struct igc_interrupt *intr = IGC_DEV_PRIVATE_INTR(dev); + uint32_t frame_size = dev->data->mtu + IGC_ETH_OVERHEAD; int ret; PMD_INIT_FUNC_TRACE(); - ret = igc_check_mq_mode(dev); + /** + * Reset the max frame size via mtu_set ops if preset max frame + * cannot hold MTU data and Ether overhead. + */ + if (frame_size > dev->data->dev_conf.rxmode.max_rx_pkt_len) { + ret = eth_igc_mtu_set(dev, dev->data->mtu); + if (ret != 0) + return ret; + } + + ret = igc_check_mq_mode(dev); if (ret != 0) return ret; From patchwork Wed Oct 14 09:19:43 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Yang X-Patchwork-Id: 80704 X-Patchwork-Delegate: qi.z.zhang@intel.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 15140A04B7; Wed, 14 Oct 2020 11:22:32 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 8FB6E1DD79; Wed, 14 Oct 2020 11:21:34 +0200 (CEST) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by dpdk.org (Postfix) with ESMTP id 03BB11DD77 for ; Wed, 14 Oct 2020 11:21:31 +0200 (CEST) IronPort-SDR: ZxQ75MfKCIarEWHgNqgFcpmpf0V0TcbKFjpgXaHq9GAhwpRzMKqYGuJcA9Vjdqk2IeP6hRavdv dCasWc/cMFOg== X-IronPort-AV: E=McAfee;i="6000,8403,9773"; a="183585322" X-IronPort-AV: E=Sophos;i="5.77,374,1596524400"; d="scan'208";a="183585322" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Oct 2020 02:21:31 -0700 IronPort-SDR: Tl4tLOf29VIGQThVXMKhXNQSjxnsTnh+dmZNBtZFUERA/Lj+uuhzkN7XRI9Cnk06qDh0FbSnOG qDkzwhpraa/A== X-IronPort-AV: E=Sophos;i="5.77,374,1596524400"; d="scan'208";a="530752314" Received: from intel-npg-odc-srv01.cd.intel.com ([10.240.178.136]) by orsmga005-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Oct 2020 02:21:29 -0700 From: SteveX Yang To: dev@dpdk.org Cc: jia.guo@intel.com, qiming.yang@intel.com, qi.z.zhang@intel.com, jingjing.wu@intel.com, beilei.xing@intel.com, konstantin.ananyev@intel.com, SteveX Yang Date: Wed, 14 Oct 2020 09:19:43 +0000 Message-Id: <20201014091945.1934-4-stevex.yang@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201014091945.1934-1-stevex.yang@intel.com> References: <20200928065541.7520-1-stevex.yang@intel.com> <20201014091945.1934-1-stevex.yang@intel.com> Subject: [dpdk-dev] [PATCH v5 3/5] net/ice: fix max mtu size packets with vlan tag cannot be received by default X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 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" when application presets the max rx packet length and expected mtu at the same time, driver need identify if the preset max frame size can hold mtu data and Ether overhead completely. if not, adjust the max frame size via mtu_set ops within dev_configure. Fixes: 50cc9d2a6e9d ("net/ice: fix max frame size") Signed-off-by: SteveX Yang --- drivers/net/ice/ice_ethdev.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/drivers/net/ice/ice_ethdev.c b/drivers/net/ice/ice_ethdev.c index 0056da78a..a707612c2 100644 --- a/drivers/net/ice/ice_ethdev.c +++ b/drivers/net/ice/ice_ethdev.c @@ -3305,6 +3305,7 @@ ice_dev_configure(struct rte_eth_dev *dev) struct ice_adapter *ad = ICE_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private); struct ice_pf *pf = ICE_DEV_PRIVATE_TO_PF(dev->data->dev_private); + uint32_t frame_size = dev->data->mtu + ICE_ETH_OVERHEAD; int ret; /* Initialize to TRUE. If any of Rx queues doesn't meet the @@ -3316,6 +3317,16 @@ ice_dev_configure(struct rte_eth_dev *dev) if (dev->data->dev_conf.rxmode.mq_mode & ETH_MQ_RX_RSS_FLAG) dev->data->dev_conf.rxmode.offloads |= DEV_RX_OFFLOAD_RSS_HASH; + /** + * Reset the max frame size via mtu_set ops if preset max frame + * cannot hold MTU data and Ether overhead. + */ + if (frame_size > dev->data->dev_conf.rxmode.max_rx_pkt_len) { + ret = ice_mtu_set(dev, dev->data->mtu); + if (ret != 0) + return ret; + } + ret = ice_init_rss(pf); if (ret) { PMD_DRV_LOG(ERR, "Failed to enable rss for PF"); From patchwork Wed Oct 14 09:19:44 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Yang X-Patchwork-Id: 80705 X-Patchwork-Delegate: qi.z.zhang@intel.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id C8932A04B7; Wed, 14 Oct 2020 11:22:51 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 2CE081DD7F; Wed, 14 Oct 2020 11:21:37 +0200 (CEST) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by dpdk.org (Postfix) with ESMTP id C61D91DD7D for ; Wed, 14 Oct 2020 11:21:34 +0200 (CEST) IronPort-SDR: ZHjll1P5GZjGXVodHbqJsmq+MuHoMBUUf3O8VOcbh9AzcV1Up129R+FrWF5uCkUTczGKl3lc5K iJQWzWd7rn7w== X-IronPort-AV: E=McAfee;i="6000,8403,9773"; a="183585328" X-IronPort-AV: E=Sophos;i="5.77,374,1596524400"; d="scan'208";a="183585328" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Oct 2020 02:21:34 -0700 IronPort-SDR: jw6hnQ/qXQF9OS7/Gs0hYiqREIxHM7G2xNlpeaBgbvWyWqlUAScP23jUmQDls0mJw5j+z/KeIh rDKTpUjYPx2Q== X-IronPort-AV: E=Sophos;i="5.77,374,1596524400"; d="scan'208";a="530752329" Received: from intel-npg-odc-srv01.cd.intel.com ([10.240.178.136]) by orsmga005-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Oct 2020 02:21:31 -0700 From: SteveX Yang To: dev@dpdk.org Cc: jia.guo@intel.com, qiming.yang@intel.com, qi.z.zhang@intel.com, jingjing.wu@intel.com, beilei.xing@intel.com, konstantin.ananyev@intel.com, SteveX Yang Date: Wed, 14 Oct 2020 09:19:44 +0000 Message-Id: <20201014091945.1934-5-stevex.yang@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201014091945.1934-1-stevex.yang@intel.com> References: <20200928065541.7520-1-stevex.yang@intel.com> <20201014091945.1934-1-stevex.yang@intel.com> Subject: [dpdk-dev] [PATCH v5 4/5] net/i40e: fix max mtu size packets with vlan tag cannot be received by default X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 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" when application presets the max rx packet length and expected mtu at the same time, driver need identify if the preset max frame size can hold mtu data and Ether overhead completely. if not, adjust the max frame size via mtu_set ops within dev_configure. Fixes: ff8282f4bbcd ("net/i40e: consider QinQ when setting MTU") Signed-off-by: SteveX Yang Acked-by: Konstantin Ananyev --- drivers/net/i40e/i40e_ethdev.c | 11 +++++++++++ drivers/net/i40e/i40e_ethdev_vf.c | 13 ++++++++++++- 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c index 943cfe71d..272cfc7ca 100644 --- a/drivers/net/i40e/i40e_ethdev.c +++ b/drivers/net/i40e/i40e_ethdev.c @@ -1911,6 +1911,7 @@ i40e_dev_configure(struct rte_eth_dev *dev) struct i40e_pf *pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private); struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data->dev_private); enum rte_eth_rx_mq_mode mq_mode = dev->data->dev_conf.rxmode.mq_mode; + uint32_t frame_size = dev->data->mtu + I40E_ETH_OVERHEAD; int i, ret; ret = i40e_dev_sync_phy_type(hw); @@ -1925,6 +1926,16 @@ i40e_dev_configure(struct rte_eth_dev *dev) ad->tx_simple_allowed = true; ad->tx_vec_allowed = true; + /** + * Reset the max frame size via mtu_set ops if preset max frame + * cannot hold MTU data and Ether overhead. + */ + if (frame_size > dev->data->dev_conf.rxmode.max_rx_pkt_len) { + ret = i40e_dev_mtu_set(dev, dev->data->mtu); + if (ret != 0) + return ret; + } + if (dev->data->dev_conf.rxmode.mq_mode & ETH_MQ_RX_RSS_FLAG) dev->data->dev_conf.rxmode.offloads |= DEV_RX_OFFLOAD_RSS_HASH; diff --git a/drivers/net/i40e/i40e_ethdev_vf.c b/drivers/net/i40e/i40e_ethdev_vf.c index 4d6510d1f..686f3c627 100644 --- a/drivers/net/i40e/i40e_ethdev_vf.c +++ b/drivers/net/i40e/i40e_ethdev_vf.c @@ -1664,6 +1664,8 @@ i40evf_dev_configure(struct rte_eth_dev *dev) I40E_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private); uint16_t num_queue_pairs = RTE_MAX(dev->data->nb_rx_queues, dev->data->nb_tx_queues); + uint32_t frame_size = dev->data->mtu + I40E_ETH_OVERHEAD; + int ret; /* Initialize to TRUE. If any of Rx queues doesn't meet the bulk * allocation or vector Rx preconditions we will reset it. @@ -1676,9 +1678,18 @@ i40evf_dev_configure(struct rte_eth_dev *dev) dev->data->dev_conf.intr_conf.lsc = !!(dev->data->dev_flags & RTE_ETH_DEV_INTR_LSC); + /** + * Reset the max frame size via mtu_set ops if preset max frame + * cannot hold MTU data and Ether overhead. + */ + if (frame_size > dev->data->dev_conf.rxmode.max_rx_pkt_len) { + ret = i40evf_dev_mtu_set(dev, dev->data->mtu); + if (ret != 0) + return ret; + } + if (num_queue_pairs > vf->vsi_res->num_queue_pairs) { struct i40e_hw *hw; - int ret; if (rte_eal_process_type() != RTE_PROC_PRIMARY) { PMD_DRV_LOG(ERR, From patchwork Wed Oct 14 09:19:45 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Yang X-Patchwork-Id: 80706 X-Patchwork-Delegate: qi.z.zhang@intel.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 2E10AA04B7; Wed, 14 Oct 2020 11:23:10 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id C68641DD85; Wed, 14 Oct 2020 11:21:38 +0200 (CEST) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by dpdk.org (Postfix) with ESMTP id 985EF1DD82 for ; Wed, 14 Oct 2020 11:21:37 +0200 (CEST) IronPort-SDR: y1G46G5ZRhxlixTLMzS9K3nWXGOz3hkCsrxbvZpOApXzZjdzDF+FtpHJBx+kJ4tCmAL90/qzwp iymhxZRvZc+Q== X-IronPort-AV: E=McAfee;i="6000,8403,9773"; a="183585340" X-IronPort-AV: E=Sophos;i="5.77,374,1596524400"; d="scan'208";a="183585340" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Oct 2020 02:21:37 -0700 IronPort-SDR: h1jctK65KWZGzPu91wQzmh0Sv2bo+o1lZOWdRB2zTcVyMqSmi4rvusrvfe8jtWAvRaReJ3ssSc Kf1S+HkHMABQ== X-IronPort-AV: E=Sophos;i="5.77,374,1596524400"; d="scan'208";a="530752346" Received: from intel-npg-odc-srv01.cd.intel.com ([10.240.178.136]) by orsmga005-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Oct 2020 02:21:34 -0700 From: SteveX Yang To: dev@dpdk.org Cc: jia.guo@intel.com, qiming.yang@intel.com, qi.z.zhang@intel.com, jingjing.wu@intel.com, beilei.xing@intel.com, konstantin.ananyev@intel.com, SteveX Yang Date: Wed, 14 Oct 2020 09:19:45 +0000 Message-Id: <20201014091945.1934-6-stevex.yang@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201014091945.1934-1-stevex.yang@intel.com> References: <20200928065541.7520-1-stevex.yang@intel.com> <20201014091945.1934-1-stevex.yang@intel.com> Subject: [dpdk-dev] [PATCH v5 5/5] net/iavf: fix max mtu size packets with vlan tag cannot be received by default X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 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" when application presets the max rx packet length and expected mtu at the same time, driver need identify if the preset max frame size can hold mtu data and Ether overhead completely. if not, adjust the max frame size via mtu_set ops within dev_configure. Fixes: 02d212ca3125 ("net/iavf: rename remaining avf strings") Signed-off-by: SteveX Yang --- drivers/net/iavf/iavf_ethdev.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/drivers/net/iavf/iavf_ethdev.c b/drivers/net/iavf/iavf_ethdev.c index 93e26c768..8b1cf8f1c 100644 --- a/drivers/net/iavf/iavf_ethdev.c +++ b/drivers/net/iavf/iavf_ethdev.c @@ -291,6 +291,8 @@ iavf_dev_configure(struct rte_eth_dev *dev) IAVF_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private); struct iavf_info *vf = IAVF_DEV_PRIVATE_TO_VF(ad); struct rte_eth_conf *dev_conf = &dev->data->dev_conf; + uint32_t frame_size = dev->data->mtu + IAVF_ETH_OVERHEAD; + int ret; ad->rx_bulk_alloc_allowed = true; /* Initialize to TRUE. If any of Rx queues doesn't meet the @@ -302,6 +304,16 @@ iavf_dev_configure(struct rte_eth_dev *dev) if (dev->data->dev_conf.rxmode.mq_mode & ETH_MQ_RX_RSS_FLAG) dev->data->dev_conf.rxmode.offloads |= DEV_RX_OFFLOAD_RSS_HASH; + /** + * Reset the max frame size via mtu_set ops if preset max frame + * cannot hold MTU data and Ether overhead. + */ + if (frame_size > dev->data->dev_conf.rxmode.max_rx_pkt_len) { + ret = iavf_dev_mtu_set(dev, dev->data->mtu); + if (ret != 0) + return ret; + } + /* Vlan stripping setting */ if (vf->vf_res->vf_cap_flags & VIRTCHNL_VF_OFFLOAD_VLAN) { if (dev_conf->rxmode.offloads & DEV_RX_OFFLOAD_VLAN_STRIP)