From patchwork Fri Jan 15 10:08:29 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alvin Zhang X-Patchwork-Id: 86664 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 mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 608F7A0A02; Fri, 15 Jan 2021 11:08:42 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id BF927140E55; Fri, 15 Jan 2021 11:08:41 +0100 (CET) Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by mails.dpdk.org (Postfix) with ESMTP id 77091140E53; Fri, 15 Jan 2021 11:08:39 +0100 (CET) IronPort-SDR: C62QCAHP0kalCyqnyaYI0nakMBMSl+PDxg3mLLZ6qhER9t9sU6piEgHGrQ3b57bluMzA+H12L1 dSCBfnQtAjJA== X-IronPort-AV: E=McAfee;i="6000,8403,9864"; a="178614931" X-IronPort-AV: E=Sophos;i="5.79,349,1602572400"; d="scan'208";a="178614931" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Jan 2021 02:08:36 -0800 IronPort-SDR: 2ESRtJk9I4wWqfmuSeDM9qTJmU192NfVoWnn2Ckw2caJ6VRu4t6F9CRqlO9V1GHYlC69F+bnBm pbnR9nsS+hjg== X-IronPort-AV: E=Sophos;i="5.79,349,1602572400"; d="scan'208";a="401238266" Received: from shwdenpg235.ccr.corp.intel.com ([10.240.182.60]) by fmsmga002-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Jan 2021 02:08:34 -0800 From: "Zhang,Alvin" To: jia.guo@intel.com, WeiX.Xie@intel.com, haiyue.wang@intel.com Cc: dev@dpdk.org, Alvin Zhang , stable@dpdk.org Date: Fri, 15 Jan 2021 18:08:29 +0800 Message-Id: <20210115100829.31980-1-alvinx.zhang@intel.com> X-Mailer: git-send-email 2.21.0.windows.1 In-Reply-To: <20210115070029.2768-1-alvinx.zhang@intel.com> References: <20210115070029.2768-1-alvinx.zhang@intel.com> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH v4] net/ixgbe: fix configuration of max frame size 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" From: Alvin Zhang For 82599 NIC, jumbo frame feature is not supported in IOV mode, if a VF requests to configure the max frame size to that not bigger than RTE_ETHER_MAX_LEN, the kernel driver returns 0, but the DPDK ixgbe PMD returens -1, this will cause the VF to fail to start when the PF driven by DPDK ixgbe PMD. This patch keeps ixgbe PMD's handling mode consistent with kernel driver in above situation. In addition, the value set by the command IXGBE_VF_SET_LPE represents the max frame size, not the mtu. Fixes: 1b9ea09c067b ("ixgbe: support X550") Fixes: 95a27b3ba5f5 ("net/ixgbe: enable jumbo frame for VF") Cc: stable@dpdk.org Signed-off-by: Alvin Zhang --- V3: Restore variable name from cur_frame_size to max_frs. V4: Update git log and add notes. --- drivers/net/ixgbe/ixgbe_pf.c | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/drivers/net/ixgbe/ixgbe_pf.c b/drivers/net/ixgbe/ixgbe_pf.c index 833863a..911a145 100644 --- a/drivers/net/ixgbe/ixgbe_pf.c +++ b/drivers/net/ixgbe/ixgbe_pf.c @@ -555,17 +555,26 @@ int ixgbe_pf_host_configure(struct rte_eth_dev *eth_dev) ixgbe_set_vf_lpe(struct rte_eth_dev *dev, __rte_unused uint32_t vf, uint32_t *msgbuf) { struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private); - uint32_t new_mtu = msgbuf[1]; + uint32_t max_frame = msgbuf[1]; uint32_t max_frs; uint32_t hlreg0; - int max_frame = new_mtu + RTE_ETHER_HDR_LEN + RTE_ETHER_CRC_LEN; /* X540 and X550 support jumbo frames in IOV mode */ if (hw->mac.type != ixgbe_mac_X540 && hw->mac.type != ixgbe_mac_X550 && hw->mac.type != ixgbe_mac_X550EM_x && - hw->mac.type != ixgbe_mac_X550EM_a) - return -1; + hw->mac.type != ixgbe_mac_X550EM_a) { + /** + * For Other NICs, set max packet length is not enabled, + * but if the value is not bigger than that has been set + * by PF, here return -1 will cause the VF to fail to + * start. + */ + if (max_frame > dev->data->dev_conf.rxmode.max_rx_pkt_len) + return -1; + + return 0; + } if (max_frame < RTE_ETHER_MIN_LEN || max_frame > RTE_ETHER_MAX_JUMBO_FRAME_LEN) @@ -573,9 +582,9 @@ int ixgbe_pf_host_configure(struct rte_eth_dev *eth_dev) max_frs = (IXGBE_READ_REG(hw, IXGBE_MAXFRS) & IXGBE_MHADD_MFS_MASK) >> IXGBE_MHADD_MFS_SHIFT; - if (max_frs < new_mtu) { + if (max_frs < max_frame) { hlreg0 = IXGBE_READ_REG(hw, IXGBE_HLREG0); - if (new_mtu > RTE_ETHER_MAX_LEN) { + if (max_frame > RTE_ETHER_MAX_LEN) { dev->data->dev_conf.rxmode.offloads |= DEV_RX_OFFLOAD_JUMBO_FRAME; hlreg0 |= IXGBE_HLREG0_JUMBOEN; @@ -586,7 +595,7 @@ int ixgbe_pf_host_configure(struct rte_eth_dev *eth_dev) } IXGBE_WRITE_REG(hw, IXGBE_HLREG0, hlreg0); - max_frs = new_mtu << IXGBE_MHADD_MFS_SHIFT; + max_frs = max_frame << IXGBE_MHADD_MFS_SHIFT; IXGBE_WRITE_REG(hw, IXGBE_MAXFRS, max_frs); }