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 2726CA0A03; Mon, 18 Jan 2021 09:37:20 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E8213140D73; Mon, 18 Jan 2021 09:37:19 +0100 (CET) Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by mails.dpdk.org (Postfix) with ESMTP id D07E6140D6C; Mon, 18 Jan 2021 09:37:17 +0100 (CET) IronPort-SDR: 2VvJuMToQbh9tblPxFWs1lQvcWKmaZxZ/sDtUJ3VO3fKZson3mSyY4I5/bel0TwF4Vem3RF+6s wwxiygSerIkQ== X-IronPort-AV: E=McAfee;i="6000,8403,9867"; a="175271636" X-IronPort-AV: E=Sophos;i="5.79,355,1602572400"; d="scan'208";a="175271636" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Jan 2021 00:37:12 -0800 IronPort-SDR: M2CyHvKD3Omiy46GzVOhoqbc8QpPFrznFBLGOXatqQOgAm51Lr3V09MK0j0gwbXgc4KAHMh82q rdwu0vYM3bvQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.79,355,1602572400"; d="scan'208";a="383492459" Received: from fmsmsx601.amr.corp.intel.com ([10.18.126.81]) by orsmga008.jf.intel.com with ESMTP; 18 Jan 2021 00:37:11 -0800 Received: from shsmsx603.ccr.corp.intel.com (10.109.6.143) by fmsmsx601.amr.corp.intel.com (10.18.126.81) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Mon, 18 Jan 2021 00:37:09 -0800 Received: from shsmsx601.ccr.corp.intel.com (10.109.6.141) by SHSMSX603.ccr.corp.intel.com (10.109.6.143) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Mon, 18 Jan 2021 16:37:08 +0800 Received: from shsmsx601.ccr.corp.intel.com ([10.109.6.141]) by SHSMSX601.ccr.corp.intel.com ([10.109.6.141]) with mapi id 15.01.1713.004; Mon, 18 Jan 2021 16:37:08 +0800 From: "Guo, Jia" To: "Zhang, AlvinX" , "Xie, WeiX" , "Wang, Haiyue" CC: "dev@dpdk.org" , "Zhang, AlvinX" , "stable@dpdk.org" Thread-Topic: [PATCH v6] net/ixgbe: fix configuration of max frame size Thread-Index: AQHW7XTYZ3Umxq24AESxx2QQLuNriaotD0Kg Date: Mon, 18 Jan 2021 08:37:08 +0000 Message-ID: <2178d7258751463abd729ba76054565a@intel.com> References: <20210118050341.1460-1-alvinx.zhang@intel.com> <20210118083507.13544-1-alvinx.zhang@intel.com> In-Reply-To: <20210118083507.13544-1-alvinx.zhang@intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-reaction: no-action dlp-version: 11.5.1.3 x-originating-ip: [10.239.127.36] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH v6] 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" Acked-by: Jeff Guo > -----Original Message----- > From: Zhang,Alvin > Sent: Monday, January 18, 2021 4:35 PM > To: Guo, Jia ; Xie, WeiX ; Wang, > Haiyue > Cc: dev@dpdk.org; Zhang, AlvinX ; > stable@dpdk.org > Subject: [PATCH v6] net/ixgbe: fix configuration of max frame size >=20 > From: Alvin Zhang >=20 > For some types of NIC, jumbo frame is not supported in IOV mode, so if a = VF > requests to configure the frame size to 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 b= y DPDK > ixgbe PMD. >=20 > This patch keeps ixgbe PMD's handling mode consistent with kernel driver = in > above situation. >=20 > In addition, the value set by the command IXGBE_VF_SET_LPE represents > the max frame size, not the mtu. >=20 > Fixes: 1b9ea09c067b ("ixgbe: support X550") > Fixes: 95a27b3ba5f5 ("net/ixgbe: enable jumbo frame for VF") > Cc: stable@dpdk.org >=20 > Signed-off-by: Alvin Zhang > --- >=20 > V3: Restore variable name from cur_frame_size to max_frs. > V4: Update git log and add notes. > V5: Add check for VF api version. > V6: Update notes. > --- > drivers/net/ixgbe/ixgbe_pf.c | 43 > +++++++++++++++++++++++++++++++++++-------- > 1 file changed, 35 insertions(+), 8 deletions(-) >=20 > diff --git a/drivers/net/ixgbe/ixgbe_pf.c b/drivers/net/ixgbe/ixgbe_pf.c > index 833863a..2762995 100644 > --- a/drivers/net/ixgbe/ixgbe_pf.c > +++ b/drivers/net/ixgbe/ixgbe_pf.c > @@ -552,20 +552,47 @@ int ixgbe_pf_host_configure(struct rte_eth_dev > *eth_dev) } >=20 > static int > -ixgbe_set_vf_lpe(struct rte_eth_dev *dev, __rte_unused uint32_t vf, > uint32_t *msgbuf) > +ixgbe_set_vf_lpe(struct rte_eth_dev *dev, uint32_t vf, uint32_t > +*msgbuf) > { > struct ixgbe_hw *hw =3D IXGBE_DEV_PRIVATE_TO_HW(dev->data- > >dev_private); > - uint32_t new_mtu =3D msgbuf[1]; > + uint32_t max_frame =3D msgbuf[1]; > uint32_t max_frs; > uint32_t hlreg0; > - int max_frame =3D new_mtu + RTE_ETHER_HDR_LEN + > RTE_ETHER_CRC_LEN; >=20 > /* X540 and X550 support jumbo frames in IOV mode */ > if (hw->mac.type !=3D ixgbe_mac_X540 && > hw->mac.type !=3D ixgbe_mac_X550 && > hw->mac.type !=3D ixgbe_mac_X550EM_x && > - hw->mac.type !=3D ixgbe_mac_X550EM_a) > - return -1; > + hw->mac.type !=3D ixgbe_mac_X550EM_a) { > + struct ixgbe_vf_info *vfinfo =3D > + *IXGBE_DEV_PRIVATE_TO_P_VFDATA(dev->data- > >dev_private); > + > + switch (vfinfo[vf].api_version) { > + case ixgbe_mbox_api_11: > + case ixgbe_mbox_api_12: > + case ixgbe_mbox_api_13: > + /** > + * Version 1.1&1.2&1.3 supports jumbo frames on > VFs > + * if PF has jumbo frames enabled which means > legacy > + * VFs are disabled. > + */ > + if (dev->data->dev_conf.rxmode.max_rx_pkt_len > > + RTE_ETHER_MAX_LEN) > + break; > + /* fall through */ > + default: > + /** > + * If the PF or VF are running w/ jumbo frames > enabled, > + * we return -1 as we cannot support jumbo frames > on > + * legacy VFs. > + */ > + if (max_frame > RTE_ETHER_MAX_LEN || > + dev->data->dev_conf.rxmode.max_rx_pkt_len > > + RTE_ETHER_MAX_LEN) > + return -1; > + break; > + } > + } >=20 > if (max_frame < RTE_ETHER_MIN_LEN || > max_frame > > RTE_ETHER_MAX_JUMBO_FRAME_LEN) @@ -573,9 +600,9 @@ int > ixgbe_pf_host_configure(struct rte_eth_dev *eth_dev) >=20 > max_frs =3D (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 =3D 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 |=3D > DEV_RX_OFFLOAD_JUMBO_FRAME; > hlreg0 |=3D IXGBE_HLREG0_JUMBOEN; > @@ -586,7 +613,7 @@ int ixgbe_pf_host_configure(struct rte_eth_dev > *eth_dev) > } > IXGBE_WRITE_REG(hw, IXGBE_HLREG0, hlreg0); >=20 > - max_frs =3D new_mtu << IXGBE_MHADD_MFS_SHIFT; > + max_frs =3D max_frame << IXGBE_MHADD_MFS_SHIFT; > IXGBE_WRITE_REG(hw, IXGBE_MAXFRS, max_frs); > } >=20 > -- > 1.8.3.1