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 F3F2841DE6; Mon, 6 Mar 2023 13:20:11 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id D7ECF40E50; Mon, 6 Mar 2023 13:20:11 +0100 (CET) Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by mails.dpdk.org (Postfix) with ESMTP id F079E40A8A; Mon, 6 Mar 2023 13:20:09 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1678105210; x=1709641210; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=s8IkjaaH/MmI4PttgIlDkQ9WJ/zXn35cjAg6JVOs0jg=; b=SFCc1A9BCNhKpXuJzvpA9KLjxP03FsYOGx05fbUn2My8hwrz2muguQYZ tGl/cl+lfN/hvM32GA3FylfuTCjjFTxoqDGaNbKyJ+qIUy32sY/ZQ0w3J EdQOnHoJeAEflg7Xr8dT/vT1OBYeLryvFaJ0Qk91ioysGb70YEGXO6K+m r+9UZqVmNO5t3vStTtxu9qKOc8n1RrBcLemSAblEYy4OMoqg2PfSf1zG1 xk5MqQe8NNiBg4nl2o2n6kEu99XVeMtUGE/u9U5RAyIEfb+WnXmgpDiVW +4d6Hs671zJsVU+U9W0QCgyYOuzuNxf027a4eNIU6VdVUf1xYR/yjYlVf g==; X-IronPort-AV: E=McAfee;i="6500,9779,10640"; a="315199928" X-IronPort-AV: E=Sophos;i="5.98,236,1673942400"; d="scan'208";a="315199928" Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Mar 2023 04:20:09 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10640"; a="799985730" X-IronPort-AV: E=Sophos;i="5.98,236,1673942400"; d="scan'208";a="799985730" Received: from unknown (HELO npg-dpdk-simeisu-cvl-119d218.sh.intel.com) ([10.67.119.208]) by orsmga004.jf.intel.com with ESMTP; 06 Mar 2023 04:20:06 -0800 From: Simei Su To: beilei.xing@intel.com, yuying.zhang@intel.com, qi.z.zhang@intel.com Cc: dev@dpdk.org, qiming.yang@intel.com, david.marchand@redhat.com, Simei Su , stable@dpdk.org Subject: [PATCH v7] net/i40e: fix max frame size configuration Date: Mon, 6 Mar 2023 20:18:53 +0800 Message-Id: <20230306121853.27547-1-simei.su@intel.com> X-Mailer: git-send-email 2.9.5 In-Reply-To: <20230220075952.444153-1-simei.su@intel.com> References: <20230220075952.444153-1-simei.su@intel.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 This patch sets max frame size at port level rather than queue level to avoid unexpected packets received by port. Fixes: 34fe803c051f ("net/i40e: don't check link status on device start") Cc: stable@dpdk.org Signed-off-by: Simei Su --- v7: * Split v6 patch into two parts: - David Marchand's revert patch first: https://patchwork.dpdk.org/project/dpdk/patch/20221213091837.87953-1-david.marchand@redhat.com/ - issue fix patch * Refine commit title and commit log. v6: * Refine commit log. * Remove return error. v5: * Fix misspelling in commit log. v4: * Refine commit log. * Avoid duplicate call to set parameter "wait to complete" true. v3: * Put link update before interrupt enable. v2: * Refine commit log. * Add link update. drivers/net/i40e/i40e_ethdev.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c index a982e42..371f422 100644 --- a/drivers/net/i40e/i40e_ethdev.c +++ b/drivers/net/i40e/i40e_ethdev.c @@ -1710,11 +1710,6 @@ eth_i40e_dev_init(struct rte_eth_dev *dev, void *init_params __rte_unused) */ i40e_add_tx_flow_control_drop_filter(pf); - /* Set the max frame size to 0x2600 by default, - * in case other drivers changed the default value. - */ - i40e_aq_set_mac_config(hw, I40E_FRAME_SIZE_MAX, TRUE, false, 0, NULL); - /* initialize RSS rule list */ TAILQ_INIT(&pf->rss_config_list); @@ -2332,6 +2327,7 @@ i40e_dev_start(struct rte_eth_dev *dev) uint32_t intr_vector = 0; struct i40e_vsi *vsi; uint16_t nb_rxq, nb_txq; + uint16_t max_frame_size; hw->adapter_stopped = 0; @@ -2452,7 +2448,7 @@ i40e_dev_start(struct rte_eth_dev *dev) PMD_DRV_LOG(WARNING, "Fail to set phy mask"); /* Call get_link_info aq command to enable/disable LSE */ - i40e_dev_link_update(dev, 0); + i40e_dev_link_update(dev, 1); } if (dev->data->dev_conf.intr_conf.rxq == 0) { @@ -2470,6 +2466,13 @@ i40e_dev_start(struct rte_eth_dev *dev) "please call hierarchy_commit() " "before starting the port"); + max_frame_size = dev->data->mtu ? + dev->data->mtu + I40E_ETH_OVERHEAD : + I40E_FRAME_SIZE_MAX; + + /* Set the max frame size to HW*/ + i40e_aq_set_mac_config(hw, max_frame_size, TRUE, false, 0, NULL); + return I40E_SUCCESS; tx_err: -- 2.9.5